diff --git a/.buildkite/DockerFile b/.buildkite/DockerFile index 227524274d2..9ccd51b4944 100644 --- a/.buildkite/DockerFile +++ b/.buildkite/DockerFile @@ -1,4 +1,4 @@ -ARG DOTNET_VERSION=8.0.400 +ARG DOTNET_VERSION=9.0.100 FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build ENV NUGET_SCRATCH="/tmp/NuGetScratch" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 87f461176da..b702d1737b2 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,7 +5,7 @@ steps: env: TEST_SUITE: "{{ matrix.suite }}" STACK_VERSION: master-SNAPSHOT - DOTNET_VERSION: 8.0.400 + DOTNET_VERSION: 9.0.100 matrix: setup: suite: diff --git a/.buildkite/run-repository.ps1 b/.buildkite/run-repository.ps1 index 4a290f1c625..774f3684ccd 100644 --- a/.buildkite/run-repository.ps1 +++ b/.buildkite/run-repository.ps1 @@ -14,7 +14,7 @@ param( $NODE_NAME, [string] - $DOTNET_VERSION = "8.0.400" + $DOTNET_VERSION = "9.0.100" ) $ESC = [char]27 diff --git a/.buildkite/run-repository.sh b/.buildkite/run-repository.sh index 9c212f484c1..d0b1ba84870 100755 --- a/.buildkite/run-repository.sh +++ b/.buildkite/run-repository.sh @@ -9,7 +9,7 @@ script_path=$(dirname $(realpath -s $0)) source $script_path/functions/imports.sh set -euo pipefail -DOTNET_VERSION=${DOTNET_VERSION-8.0.400} +DOTNET_VERSION=${DOTNET_VERSION-9.0.100} ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"} elasticsearch_container=${elasticsearch_container-} diff --git a/.buildkite/run-tests.ps1 b/.buildkite/run-tests.ps1 index 503edd8df06..3113065ce2d 100644 --- a/.buildkite/run-tests.ps1 +++ b/.buildkite/run-tests.ps1 @@ -8,7 +8,7 @@ param ( $TEST_SUITE = "free", [string] - $DOTNET_VERSION = "8.0.400" + $DOTNET_VERSION = "9.0.100" ) $ESC = [char]27 diff --git a/.ci/DockerFile b/.ci/DockerFile index 8c642b99967..5ba098c2552 100644 --- a/.ci/DockerFile +++ b/.ci/DockerFile @@ -1,4 +1,4 @@ -ARG DOTNET_VERSION=8.0.400 +ARG DOTNET_VERSION=9.0.100 FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build ENV NUGET_SCRATCH="/tmp/NuGetScratch" diff --git a/.ci/make.sh b/.ci/make.sh index 672ad78bd7d..ad1dd59e455 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -42,7 +42,7 @@ OUTPUT_DIR="$repo/${output_folder}" REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}" mkdir -p "$OUTPUT_DIR" -DOTNET_VERSION=${DOTNET_VERSION-8.0.400} +DOTNET_VERSION=${DOTNET_VERSION-9.0.100} echo -e "\033[34;1mINFO:\033[0m PRODUCT ${product}\033[0m" echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m" diff --git a/.ci/readme.md b/.ci/readme.md index fe87c60afd4..95bd4f20fc9 100644 --- a/.ci/readme.md +++ b/.ci/readme.md @@ -30,7 +30,7 @@ $ STACK_VERSION=8.0.0-SNAPSHOT ./.ci/run-tests |-------------------------|-------------|-------------| | `STACK_VERSION` | `N/A` | The elasticsearch version to target | `TEST_SUITE` | `basic` | `free` or `platinum` sets which test suite to run and which container to run against. | -| `DOTNET_VERSION` | `8.0.400` | The .NET sdk version used to grab the proper container | +| `DOTNET_VERSION` | `9.0.100` | The .NET sdk version used to grab the proper container | If you want to manually spin up elasticsearch for these tests and call the runner afterwards you can use diff --git a/.ci/run-repository.ps1 b/.ci/run-repository.ps1 index e842f7fe215..877995e542f 100644 --- a/.ci/run-repository.ps1 +++ b/.ci/run-repository.ps1 @@ -14,7 +14,7 @@ param( $NODE_NAME, [string] - $DOTNET_VERSION = "8.0.400" + $DOTNET_VERSION = "9.0.100" ) $ESC = [char]27 diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index 0e49cdaf1bf..2191e872ea9 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -9,7 +9,7 @@ script_path=$(dirname $(realpath -s $0)) source $script_path/functions/imports.sh set -euo pipefail -DOTNET_VERSION=${DOTNET_VERSION-8.0.400} +DOTNET_VERSION=${DOTNET_VERSION-9.0.100} ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"} elasticsearch_container=${elasticsearch_container-} diff --git a/.ci/run-tests.ps1 b/.ci/run-tests.ps1 index 481ad155dbd..89b91ebaadf 100644 --- a/.ci/run-tests.ps1 +++ b/.ci/run-tests.ps1 @@ -8,7 +8,7 @@ param ( $TEST_SUITE = "free", [string] - $DOTNET_VERSION = "8.0.400" + $DOTNET_VERSION = "9.0.100" ) $ESC = [char]27 diff --git a/.ci/test-matrix.yml b/.ci/test-matrix.yml index 421f57f8973..0c4a5a2b9ba 100755 --- a/.ci/test-matrix.yml +++ b/.ci/test-matrix.yml @@ -8,6 +8,6 @@ TEST_SUITE: - platinum DOTNET_VERSION: - - 8.0.400 + - 9.0.100 exclude: ~ diff --git a/Directory.Build.props b/Directory.Build.props index 91ddb2e93ec..cdc634db8d7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -50,4 +50,8 @@ + + + NU1901;NU1902;NU1903;NU1904 + \ No newline at end of file diff --git a/Elasticsearch.sln b/Elasticsearch.sln index 4bf57fbcf3a..242fd14cf6b 100644 --- a/Elasticsearch.sln +++ b/Elasticsearch.sln @@ -55,8 +55,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "scripts", "build\scripts\sc EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.ClusterLauncher", "tests\Tests.ClusterLauncher\Tests.ClusterLauncher.csproj", "{F6162603-D134-4121-8106-2BA4DAD7350B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Clients.Elasticsearch.JsonNetSerializer", "src\Elastic.Clients.Elasticsearch.JsonNetSerializer\Elastic.Clients.Elasticsearch.JsonNetSerializer.csproj", "{8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "tests\Tests\Tests.csproj", "{6FD804B2-CE80-41CB-A411-2023F34C18FE}" EndProject Global @@ -101,10 +99,6 @@ Global {F6162603-D134-4121-8106-2BA4DAD7350B}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6162603-D134-4121-8106-2BA4DAD7350B}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6162603-D134-4121-8106-2BA4DAD7350B}.Release|Any CPU.Build.0 = Release|Any CPU - {8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB}.Release|Any CPU.Build.0 = Release|Any CPU {6FD804B2-CE80-41CB-A411-2023F34C18FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FD804B2-CE80-41CB-A411-2023F34C18FE}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FD804B2-CE80-41CB-A411-2023F34C18FE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -123,7 +117,6 @@ Global {F8A7E60C-0C48-4D76-AF7F-7881DF5A263D} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7} {68D1BFDC-F447-4D2C-AF81-537807636610} = {1FE49D14-216A-41EE-A177-E42BFF53E0DC} {F6162603-D134-4121-8106-2BA4DAD7350B} = {362B2776-4B29-46AB-B237-56776B5372B6} - {8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7} {6FD804B2-CE80-41CB-A411-2023F34C18FE} = {362B2776-4B29-46AB-B237-56776B5372B6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/build/scripts/Versioning.fs b/build/scripts/Versioning.fs index 4b27be22871..a3b9d7f2c07 100644 --- a/build/scripts/Versioning.fs +++ b/build/scripts/Versioning.fs @@ -17,7 +17,7 @@ module Versioning = // Since that file is now generated by the dotnet tooling and GitVersion and similar tooling all still have // active issues related to dotnet core, we now just burn this info in global.json - let parse (v:string) = SemVer.parse(v) + let parse (v: string) = SemVer.parse(if String.IsNullOrEmpty(v) then "1.0.0" else v) //Versions in form of e.g 6.1.0 is inferred as datetime so we bake the json shape into the provider like this type SdkVersion = { version:string; rollForward:string; allowPrerelease:bool } diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 29ab285f8f5..94f4e3194ff 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Exe $(NoWarn);NU1701 diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index d228e13f0b9..e6f8d4c8c5a 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -5,22 +5,208 @@ mapped_pages: --- # Elasticsearch .NET Client breaking changes [elasticsearch-net-client-breaking-changes] + Breaking changes can impact your Elastic applications, potentially disrupting normal operations. Before you upgrade, carefully review the Elasticsearch .NET Client breaking changes and take the necessary steps to mitigate any issues. To learn how to upgrade, check [Upgrade](docs-content://deploy-manage/upgrade.md). -% ## Next version [elasticsearch-nett-client-nextversion-breaking-changes] +% ## Next version [elasticsearch-net-client-nextversion-breaking-changes] % ::::{dropdown} Title of breaking change +% +% **Impact**: High/Low. +% % Description of the breaking change. % For more information, check [PR #](PR link). -% **Impact**
Impact of the breaking change. -% **Action**
Steps for mitigating deprecation impact. +% % :::: -% ## 9.0.0 [elasticsearch-nett-client-900-breaking-changes] +## 9.0.0 [elasticsearch-net-client-900-breaking-changes] -% ::::{dropdown} Title of breaking change -% Description of the breaking change. -% For more information, check [PR #](PR link). -% **Impact**
Impact of the breaking change. -% **Action**
Steps for mitigating deprecation impact. -% :::: \ No newline at end of file +### Overview + +- [1. Container types](#1-container-types) +- [2. Removal of certain generic request descriptors](#2-removal-of-certain-generic-request-descriptors) +- [3. Removal of certain descriptor constructors and related request APIs](#3-removal-of-certain-descriptor-constructors-and-related-request-apis) +- [4. Date / Time / Duration values](#4-date--time--duration-values) +- [5. `ExtendedBounds`](#5-extendedbounds) +- [6. `Field.Format`](#6-fieldformat) +- [7. `Field`/`Fields` semantics](#7-fieldfields-semantics) +- [8. `FieldValue`](#8-fieldvalue) +- [9. `FieldSort`](#9-fieldsort) +- [10. Descriptor types `class` -\> `struct`](#10-descriptor-types-class---struct) + +### Breaking changes + +#### 1. Container types + +**Impact**: High. + +Container types now use regular properties for their variants instead of static factory methods ([read more](index.md#7-improved-container-design)). + +This change primarily affects the `Query` and `Aggregation` types. + +```csharp +// 8.x +new SearchRequest +{ + Query = Query.MatchAll( + new MatchAllQuery + { + } + ) +}; + +// 9.0 +new SearchRequest +{ + Query = new Query + { + MatchAll = new MatchAllQuery + { + } + } +}; +``` + +#### 2. Removal of certain generic request descriptors + +**Impact**: High. + +Removed the generic version of some request descriptors for which the corresponding requests do not contain inferrable properties. + +These descriptors were generated unintentionally. + +When migrating, the generic type parameter must be removed from the type, e.g., `AsyncSearchStatusRequestDescriptor` should become just `AsyncSearchStatusRequestDescriptor`. + +List of affected descriptors: + +- `AsyncQueryDeleteRequestDescriptor` +- `AsyncQueryGetRequestDescriptor` +- `AsyncSearchStatusRequestDescriptor` +- `DatabaseConfigurationDescriptor` +- `DatabaseConfigurationFullDescriptor` +- `DeleteAsyncRequestDescriptor` +- `DeleteAsyncSearchRequestDescriptor` +- `DeleteDataFrameAnalyticsRequestDescriptor` +- `DeleteGeoipDatabaseRequestDescriptor` +- `DeleteIpLocationDatabaseRequestDescriptor` +- `DeleteJobRequestDescriptor` +- `DeletePipelineRequestDescriptor` +- `DeleteScriptRequestDescriptor` +- `DeleteSynonymRequestDescriptor` +- `EqlDeleteRequestDescriptor` +- `EqlGetRequestDescriptor` +- `GetAsyncRequestDescriptor` +- `GetAsyncSearchRequestDescriptor` +- `GetAsyncStatusRequestDescriptor` +- `GetDataFrameAnalyticsRequestDescriptor` +- `GetDataFrameAnalyticsStatsRequestDescriptor` +- `GetEqlStatusRequestDescriptor` +- `GetGeoipDatabaseRequestDescriptor` +- `GetIpLocationDatabaseRequestDescriptor` +- `GetJobsRequestDescriptor` +- `GetPipelineRequestDescriptor` +- `GetRollupCapsRequestDescriptor` +- `GetRollupIndexCapsRequestDescriptor` +- `GetScriptRequestDescriptor` +- `GetSynonymRequestDescriptor` +- `IndexModifyDataStreamActionDescriptor` +- `PreprocessorDescriptor` +- `PutGeoipDatabaseRequestDescriptor` +- `PutIpLocationDatabaseRequestDescriptor` +- `PutScriptRequestDescriptor` +- `PutSynonymRequestDescriptor` +- `QueryVectorBuilderDescriptor` +- `RankDescriptor` +- `RenderSearchTemplateRequestDescriptor` +- `SmoothingModelDescriptor` +- `StartDataFrameAnalyticsRequestDescriptor` +- `StartJobRequestDescriptor` +- `StopDataFrameAnalyticsRequestDescriptor` +- `StopJobRequestDescriptor` +- `TokenizationConfigDescriptor` +- `UpdateDataFrameAnalyticsRequestDescriptor` + +#### 3. Removal of certain descriptor constructors and related request APIs + +**Impact**: High. + +Removed `(TDocument, IndexName)` descriptor constructors and related request APIs for all requests with `IndexName` and `Id` path parameters. + +For example: + +```csharp +// 8.x +public IndexRequestDescriptor(TDocument document, IndexName index, Id? id) { } +public IndexRequestDescriptor(TDocument document, IndexName index) { } +public IndexRequestDescriptor(TDocument document, Id? id) { } +public IndexRequestDescriptor(TDocument document) { } + +// 9.0 +public IndexRequestDescriptor(TDocument document, IndexName index, Id? id) { } +public IndexRequestDescriptor(TDocument document, Id? id) { } +public IndexRequestDescriptor(TDocument document) { } +``` + +These overloads caused invocation ambiguities since both, `IndexName` and `Id` implement implicit conversion operators from `string`. + +Alternative with same semantics: + +```csharp +// Descriptor constructor. +new IndexRequestDescriptor(document, "my_index", Id.From(document)); + +// Request API method. +await client.IndexAsync(document, "my_index", Id.From(document), ...); +``` + +#### 4. Date / Time / Duration values + +**Impact**: High. + +In places where previously `long` or `double` was used to represent a date/time/duration value, `DateTimeOffset` or `TimeSpan` is now used instead. + +#### 5. `ExtendedBounds` + +**Impact**: High. + +Removed `ExtendedBoundsDate`/`ExtendedBoundsDateDescriptor`, `ExtendedBoundsFloat`/`ExtendedBoundsFloatDescriptor`. + +Replaced by `ExtendedBounds`, `ExtendedBoundsOfFieldDateMathDescriptor`, and `ExtendedBoundsOfDoubleDescriptor`. + +#### 6. `Field.Format` + +**Impact**: Low. + +Removed `Field.Format` property and corresponding constructor and inferrer overloads. + +This property has not been used for some time (replaced by the `FieldAndFormat` type). + +#### 7. `Field`/`Fields` semantics + +**Impact**: Low. + +`Field`/`Fields` static factory methods and conversion operators no longer return nullable references but throw exceptions instead (`Field`) if the input `string`/`Expression`/`PropertyInfo` argument is `null`. + +This makes implicit conversions to `Field` more user-friendly without requiring the null-forgiveness operator (`!`) ([read more](index.md#field-name-inference)). + +#### 8. `FieldValue` + +**Impact**: Low. + +Removed `FieldValue.IsLazyDocument`, `FieldValue.IsComposite`, and the corresponding members in the `FieldValue.ValueKind` enum. + +These values have not been used for some time. + +#### 9. `FieldSort` + +**Impact**: Low. + +Removed static `FieldSort.Empty` member. + +Sorting got reworked which makes this member obsolete ([read more](index.md#sorting)). + +#### 10. Descriptor types `class` -> `struct` + +**Impact**: Low. + +All descriptor types are now implemented as `struct` instead of `class`. diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md index 414f025096e..2c5ead4c142 100644 --- a/docs/release-notes/index.md +++ b/docs/release-notes/index.md @@ -6,22 +6,388 @@ mapped_pages: # Elasticsearch .NET Client release notes [elasticsearch-net-client-release-notes] -Review the changes, fixes, and more in each version of Elasticsearch .NET Client. +Review the changes, fixes, and more in each version of Elasticsearch .NET Client. To check for security updates, go to [Security announcements for the Elastic stack](https://discuss.elastic.co/c/announcements/security-announcements/31). -% Release notes include only features, enhancements, and fixes. Add breaking changes, deprecations, and known issues to the applicable release notes sections. +% Release notes include only features, enhancements, and fixes. Add breaking changes, deprecations, and known issues to the applicable release notes sections. % ## version.next [felasticsearch-net-client-next-release-notes] % ### Features and enhancements [elasticsearch-net-client-next-features-enhancements] -% * +% * % ### Fixes [elasticsearch-net-client-next-fixes] -% * +% * ## 9.0.0 [elasticsearch-net-client-900-release-notes] -### Features and enhancements [elasticsearch-net-client-900-features-enhancements] +### Overview -### Fixes [elasticsearch-net-client-900-fixes] \ No newline at end of file +- [1. Request Method/API Changes](#1-request-methodapi-changes) + - [1.1. Synchronous Request APIs](#11-synchronous-request-apis) + - [1.2. Separate Type Arguments for Request/Response](#12-separate-type-arguments-for-requestresponse) +- [2. Improved Fluent API](#2-improved-fluent-api) + - [2.1. `ICollection`](#21-icollectione) + - [2.2. `IDictionary`](#22-idictionaryk-v) + - [2.3. `ICollection>`](#23-icollectionkeyvaluepairk-v) + - [2.4. Union Types](#24-union-types) +- [3. Improved Descriptor Design](#3-improved-descriptor-design) + - [3.1. Wrap](#31-wrap) + - [3.2. Unwrap / Inspect](#32-unwrap--inspect) + - [3.3. Removal of Side Effects](#33-removal-of-side-effects) +- [4. Request Path Parameter Properties](#4-request-path-parameter-properties) +- [5. Field Name Inference](#5-field-name-inference) +- [6. Uniform Date/Time/Duration Types](#6-uniform-datetimeduration-types) +- [7. Improved Container Design](#7-improved-container-design) +- [8. Sorting](#8-sorting) +- [9. Safer Object Creation](#9-safer-object-creation) +- [10. Serialization](#10-serialization) + +### Features and enhancements + +#### 1. Request Method/API Changes + +##### 1.1. Synchronous Request APIs + +Synchronous request APIs are no longer marked as `obsolete`. We received some feedback about this deprecation and decided to revert it. + +##### 1.2. Separate Type Arguments for Request/Response + +It is now possible to specify separate type arguments for requests/responses when executing request methods: + +```csharp +var response = await client.SearchAsync(x => x + .Query(x => x.Term(x => x.Field(x => x.FirstName).Value("Florian"))) +); + +var documents = response.Documents; <1> +``` + +1. `IReadOnlyCollection` + +The regular APIs with merged type arguments are still available. + +#### 2. Improved Fluent API + +The enhanced fluent API generation is likely the most notable change in the 9.0 client. + +This section describes the main syntax constructs generated based on the type of the property in the corresponding object. + +##### 2.1. `ICollection` + +Note: This syntax already existed in 8.x. + +```csharp +new SearchRequestDescriptor() + .Query(q => q + .Bool(b => b + .Must(new Query()) // Scalar: Single element. + .Must(new Query(), new Query()) // Scalar: Multiple elements (params). + .Must(m => m.MatchAll()) // Fluent: Single element. + .Must(m => m.MatchAll(), m => m.MatchNone()) // Fluent: Multiple elements (params). + ) + ); +``` + +##### 2.2. `IDictionary` + +The 9.0 client introduces full fluent API support for dictionary types. + +```csharp +new SearchRequestDescriptor() + .Aggregations(new Dictionary()) // Scalar. + .Aggregations(aggs => aggs // Fluent: Nested. + .Add("key", new MaxAggregation()) // Scalar: Key + Value. + .Add("key", x => x.Max()) // Fluent: Key + Value. + ) + .AddAggregation("key", new MaxAggregation()) // Scalar. + .AddAggregation("key", x => x.Max()); // Fluent. +``` + +:::{warning} + +The `Add{Element}` methods have different semantics compared to the standard setter methods. + +Standard fluent setters set or **replace** a value. + +In contrast, the new additive methods append new elements to the dictionary. + +::: + +For dictionaries where the value type does not contain required properties that must be initialized, another syntax is generated that allows easy addition of new entries by just specifying the key: + +```csharp +// Dictionary() + +new CreateIndexRequestDescriptor("index") + // ... all previous overloads ... + .Aliases(aliases => aliases // Fluent: Nested. + .Add("key") // Key only. + ) + .Aliases("key") // Key only: Single element. + .Aliases("first", "second") // Key only: Multiple elements (params). +``` + +If the value type in the dictionary is a collection, additional `params` overloads are generated: + +```csharp +// Dictionary> + +new CompletionSuggesterDescriptor() + // ... all previous overloads ... + .AddContext("key", + new CompletionContext{ Context = new Context("first") }, + new CompletionContext{ Context = new Context("second") } + ) + .AddContext("key", + x => x.Context(x => x.Category("first")), + x => x.Context(x => x.Category("second")) + ); +``` + +##### 2.3. `ICollection>` + +Elasticsearch often uses `ICollection>` types for ordered dictionaries. + +The 9.0 client abstracts this implementation detail by providing a fluent API that can be used exactly like the one for `IDictionary` types: + +```csharp +new PutMappingRequestDescriptor("index") + .DynamicTemplates(new List>()) // Scalar. + .DynamicTemplates(x => x // Fluent: Nested. + .Add("key", new DynamicTemplate()) // Scalar: Key + Value. + .Add("key", x => x.Mapping(new TextProperty())) // Fluent: Key + Value. + ) + .AddDynamicTemplate("key", new DynamicTemplate()) // Scalar: Key + Value. + .AddDynamicTemplate("key", x => x.Runtime(x => x.Format("123"))); // Fluent: Key + Value. +``` + +##### 2.4. Union Types + +Fluent syntax is now as well available for all auto-generated union- and variant-types. + +```csharp +// TermsQueryField : Union, TermsLookup> + +new TermsQueryDescriptor() + .Terms(x => x.Value("a", "b", "c")) <1> + .Terms(x => x.Lookup(x => x.Index("index").Id("id"))); <2> +``` + +1. `ICollection` +2. `TermsLookup` + +#### 3. Improved Descriptor Design + +The 9.0 release features a completely overhauled descriptor design. + +Descriptors now wrap the object representation. This brings several internal quality-of-life improvements as well as noticeable benefits to end-users. + +##### 3.1. Wrap + +Use the wrap constructor to create a new descriptor for an existing object: + +```csharp +var request = new SearchRequest(); + +// Wrap. +var descriptor = new SearchRequestDescriptor(request); +``` + +All fluent methods of the descriptor will mutate the existing `request` passed to the wrap constructor. + +:::{note} + +Descriptors are now implemented as `struct` instead of `class`, reducing allocation overhead as much as possible. + +::: + +##### 3.2. Unwrap / Inspect + +Descriptor values can now be inspected by unwrapping the object using an implicit conversion operator: + +```csharp +var descriptor = new SearchRequestDescriptor(); + +// Unwrap. +SearchRequest request = descriptor; +``` + +Unwrapping does not allocate or copy. + +##### 3.3. Removal of Side Effects + +In 8.x, execution of (most but not all) lambda actions passed to descriptors was deferred until the actual request was made. It was never clear to the user when, and how often an action would be executed. + +In 9.0, descriptor actions are always executed immediately. This ensures no unforeseen side effects occur if the user-provided lambda action mutates external state (it is still recommended to exclusively use pure/invariant actions). Consequently, the effects of all changes performed by a descriptor method are immediately applied to the wrapped object. + +#### 4. Request Path Parameter Properties + +In 8.x, request path parameters like `Index`, `Id`, etc. could only be set by calling the corresponding constructor of the request. Afterwards, there was no way to read or change the current value. + +In the 9.0 client, all request path parameters are exposed as `get/set` properties, allowing for easy access: + +```csharp +// 8.x and 9.0 +var request = new SearchRequest(Indices.All); + +// 9.0 +var request = new SearchRequest { Indices = Indices.All }; +var indices = request.Indices; +request.Indices = "my_index"; +``` + +#### 5. Field Name Inference + +The `Field` type and especially its implicit conversion operations allowed for `null` return values. This led to a poor developer experience, as the null-forgiveness operator (`!`) had to be used frequently without good reason. + +This is no longer required in 9.0: + +```csharp +// 8.x +Field field = "field"!; + +// 9.0 +Field field = "field"; +``` + +#### 6. Uniform Date/Time/Duration Types + +The encoding of date, time and duration values in Elasticsearch often varies depending on the context. In addition to string representations in ISO 8601 and RFC 3339 format (always UTC), also Unix timestamps (in seconds, milliseconds, nanoseconds) or simply seconds, milliseconds, nanoseconds are frequently used. + +In 8.x, some date/time values are already mapped as `DateTimeOffset`, but the various non-ISO/RFC representations were not. + +9.0 now represents all date/time values uniformly as `DateTimeOffset` and also uses the native `TimeSpan` type for all durations. + +:::{note} + +There are some places where the Elasticsearch custom date/time/duration types are continued to be used. This is always the case when the type has special semantics and/or offers functionality that goes beyond that of the native date/time/duration types (e.g. `Duration`, `DateMath`). + +::: + +#### 7. Improved Container Design + +In 8.x, container types like `Query` or `Aggregation` had to be initialized using static factory methods. + +```csharp +// 8.x +var agg = Aggregation.Max(new MaxAggregation { Field = "my_field" }); +``` + +This made it mandatory to assign the created container to a temporary variable if additional properties of the container (not the contained variant) needed to be set: + +```csharp +// 8.x +var agg = Aggregation.Max(new MaxAggregation { Field = "my_field" }); +agg.Aggregations ??= new Dictionary(); +agg.Aggregations.Add("my_sub_agg", Aggregation.Terms(new TermsAggregation())); +``` + +Additionally, it was not possible to inspect the contained variant. + +In 9.0, each possible container variant is represented as a regular property of the container. This allows for determining and inspecting the contained variant and initializing container properties in one go when using an object initializer: + +```csharp +// 9.0 +var agg = new Aggregation +{ + Max = new MaxAggregation { Field = "my_field" }, + Aggregations = new Dictionary + { + { "my_sub_agg", new Aggregation{ Terms = new TermsAggregation() } } + } +}; +``` + +:::{warning} + +A container can still only contain a single variant. Setting multiple variants at once is invalid. + +Consecutive assignments of variant properties (e.g., first setting `Max`, then `Min`) will cause the previous variant to be replaced. + +::: + +#### 8. Sorting + +Applying a sort order to a search request using the fluent API is now more convenient: + +```csharp +var search = new SearchRequestDescriptor() + .Sort( + x => x.Score(), + x => x.Score(x => x.Order(SortOrder.Desc)), + x => x.Field(x => x.FirstName), + x => x.Field(x => x.Age, x => x.Order(SortOrder.Desc)), + x => x.Field(x => x.Age, SortOrder.Desc) + // 7.x syntax + x => x.Field(x => x.Field(x => x.FirstName).Order(SortOrder.Desc)) + ); +``` + +The improvements are even more evident when specifying a sort order for aggregations: + +```csharp +new SearchRequestDescriptor() + .Aggregations(aggs => aggs + .Add("my_terms", agg => agg + .Terms(terms => terms + // 8.x syntax. + .Order(new List> + { + new KeyValuePair("_key", SortOrder.Desc) + }) + // 9.0 fluent syntax. + .Order(x => x + .Add(x => x.Age, SortOrder.Asc) + .Add("_key", SortOrder.Desc) + ) + // 9.0 fluent add syntax (valid for all dictionary-like values). + .AddOrder("_key", SortOrder.Desc) + ) + ) + ); +``` + +#### 9. Safer Object Creation + +In version 9.0, users are better guided to correctly initialize objects and thus prevent invalid requests. + +For this purpose, at least one constructor is now created that enforces the initialization of all required properties. Existing parameterless constructors or constructor variants that allow the creation of incomplete objects are preserved for backwards compatibility reasons, but are marked as obsolete. + +For NET7+ TFMs, required properties are marked with the `required` keyword, and a non-deprecated parameterless constructor is unconditionally generated. + +:::{note} + +Please note that the use of descriptors still provides the chance to create incomplete objects/requests, as descriptors do not enforce the initialization of all required properties for usability reasons. + +::: + +#### 10. Serialization + +Serialization in version 9.0 has been completely overhauled, with a primary focus on robustness and performance. Additionally, initial milestones have been set for future support of native AOT. + +In 9.0, round-trip serialization is now supported for all types (limited to all JSON serializable types). + +```csharp +var request = new SearchRequest{ /* ... */ }; + +var json = client.ElasticsearchClientSettings.RequestResponseSerializer.SerializeToString( + request, + SerializationFormatting.Indented +); + +var searchRequestBody = client.ElasticsearchClientSettings.RequestResponseSerializer.Deserialize(json)!; +``` + +:::{warning} + +Note that only the body is serialized for request types. Path- and query properties must be handled manually. + +::: + +:::{note} + +It is important to use the `RequestResponseSerializer` when (de-)serializing client internal types. Direct use of `JsonSerializer` will not work. + +::: diff --git a/global.json b/global.json index c1ae6f120d3..00b67caef9e 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,7 @@ { "sdk": { - "version": "8.0.400", + "version": "9.0.100", "rollForward": "latestFeature", "allowPrerelease": false - }, - "version": "8.8.0-alpha.1", - "doc_current": "main", - "doc_branch": "main" + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareContractResolver.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareContractResolver.cs deleted file mode 100644 index 41b756d9aab..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareContractResolver.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Elastic.Clients.Elasticsearch; -using Elastic.Clients.Elasticsearch.QueryDsl; -using Elastic.Clients.Elasticsearch.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Serialization; -using JsonProperty = Newtonsoft.Json.Serialization.JsonProperty; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer; - -public class ConnectionSettingsAwareContractResolver : DefaultContractResolver -{ - public ConnectionSettingsAwareContractResolver(IElasticsearchClientSettings connectionSettings) => - ConnectionSettings = connectionSettings ?? throw new ArgumentNullException(nameof(connectionSettings)); - - protected IElasticsearchClientSettings ConnectionSettings { get; } - - protected override string ResolvePropertyName(string fieldName) => - ConnectionSettings.DefaultFieldNameInferrer != null - ? ConnectionSettings.DefaultFieldNameInferrer(fieldName) - : base.ResolvePropertyName(fieldName); - - protected override JsonContract CreateContract(Type objectType) - { - var contract = base.CreateContract(objectType); - if (objectType.IsEnum && objectType.GetCustomAttribute() != null) - contract.Converter = new StringEnumConverter(); - - return contract; - } - - protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) - { - var property = base.CreateProperty(member, memberSerialization); - ApplyShouldSerializer(property); - ApplyPropertyOverrides(member, property); - return property; - } - - /// Renames/Ignores a property based on the connection settings mapping or custom attributes for the property - private void ApplyPropertyOverrides(MemberInfo member, JsonProperty property) - { - //if (!ConnectionSettings.PropertyMappings.TryGetValue(member, out var propertyMapping)) - // propertyMapping = ElasticsearchPropertyAttributeBase.From(member); - - var serializerMapping = ConnectionSettings.PropertyMappingProvider?.CreatePropertyMapping(member); - - var nameOverride = /*propertyMapping?.Name ??*/ serializerMapping?.Name; - if (!string.IsNullOrWhiteSpace(nameOverride)) - property.PropertyName = nameOverride; - - var overrideIgnore = /*propertyMapping?.Ignore ??*/ serializerMapping?.Ignore; - if (overrideIgnore.HasValue) - property.Ignored = overrideIgnore.Value; - } - - private static void ApplyShouldSerializer(JsonProperty property) - { - if (property.PropertyType == typeof(Query)) - property.ShouldSerialize = o => ShouldSerializeQuery(o, property); - else if (property.PropertyType == typeof(IEnumerable)) - property.ShouldSerialize = o => ShouldSerializeQuerys(o, property); - } - - private static bool ShouldSerializeQuery(object o, JsonProperty prop) - { - if (o == null) - return false; - if (prop.ValueProvider.GetValue(o) is not Query q) - return false; - //return q.IsWritable; - return true; - } - - private static bool ShouldSerializeQuerys(object o, JsonProperty prop) - { - if (o == null) - return false; - if (prop.ValueProvider.GetValue(o) is not IEnumerable q) - return false; - - var queryContainers = q as Query[] ?? q.ToArray(); - //return queryContainers.Any(qq => qq != null && ((Query)qq).IsWritable); - return queryContainers.Any(qq => qq != null); - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Customization.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Customization.cs deleted file mode 100644 index 5df10b9d9d0..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Customization.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Elastic.Transport; -using Newtonsoft.Json; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer; - -public abstract partial class ConnectionSettingsAwareSerializer : Serializer -{ - // Default buffer size of StreamWriter, which is private :( - internal const int DefaultBufferSize = 1024; - - private static readonly Task CompletedTask = Task.CompletedTask; - - internal static readonly Encoding ExpectedEncoding = new UTF8Encoding(false); - private readonly JsonSerializer _collapsedSerializer; - - private readonly JsonSerializer _serializer; - protected virtual int BufferSize => DefaultBufferSize; - - public override T Deserialize(Stream stream) - { - using var streamReader = new StreamReader(stream); - using var jsonTextReader = new JsonTextReader(streamReader); - return _serializer.Deserialize(jsonTextReader); - } - - public override object Deserialize(Type type, Stream stream) - { - using var streamReader = new StreamReader(stream); - using var jsonTextReader = new JsonTextReader(streamReader); - return _serializer.Deserialize(jsonTextReader, type); - } - - public override async ValueTask DeserializeAsync(Stream stream, CancellationToken cancellationToken = default) - { - using var streamReader = new StreamReader(stream); - using var jsonTextReader = new JsonTextReader(streamReader); - var token = await jsonTextReader.ReadTokenWithDateParseHandlingNoneAsync(cancellationToken).ConfigureAwait(false); - return token.ToObject(_serializer); - } - - public override async ValueTask DeserializeAsync(Type type, Stream stream, CancellationToken cancellationToken = default(CancellationToken)) - { - using var streamReader = new StreamReader(stream); - using var jsonTextReader = new JsonTextReader(streamReader); - var token = await jsonTextReader.ReadTokenWithDateParseHandlingNoneAsync(cancellationToken).ConfigureAwait(false); - return token.ToObject(type, _serializer); - } - - public override void Serialize(T data, Stream stream, SerializationFormatting formatting = SerializationFormatting.None) - { - using var writer = new StreamWriter(stream, ExpectedEncoding, BufferSize, true); - using var jsonWriter = new JsonTextWriter(writer); - var serializer = formatting == SerializationFormatting.Indented ? _serializer : _collapsedSerializer; - serializer.Serialize(jsonWriter, data); - } - - public override Task SerializeAsync(T data, Stream stream, SerializationFormatting formatting = SerializationFormatting.None, - CancellationToken cancellationToken = default) - { - //This makes no sense now but we need the async method on the interface in 6.x so we can start swapping this out - //for an implementation that does make sense without having to wait for 7.x - Serialize(data, stream, formatting); - return CompletedTask; - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.PropertyMappingProvider.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.PropertyMappingProvider.cs deleted file mode 100644 index f38cfdbabeb..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.PropertyMappingProvider.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Concurrent; -using System.Reflection; -using System.Runtime.Serialization; -using Elastic.Clients.Elasticsearch; -using Newtonsoft.Json; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer -{ - public abstract partial class ConnectionSettingsAwareSerializer : IPropertyMappingProvider - { - protected readonly ConcurrentDictionary Properties = new(); - - public PropertyMapping CreatePropertyMapping(MemberInfo memberInfo) - { - var memberInfoString = $"{memberInfo.DeclaringType?.FullName}.{memberInfo.Name}"; - if (Properties.TryGetValue(memberInfoString, out var mapping)) return mapping; - mapping = FromAttributes(memberInfo); - - Properties.TryAdd(memberInfoString, mapping); - return mapping; - } - - private static PropertyMapping FromAttributes(MemberInfo memberInfo) - { - var jsonProperty = memberInfo.GetCustomAttribute(true); - var dataMemberProperty = memberInfo.GetCustomAttribute(true); - var jsonIgnore = memberInfo.GetCustomAttribute(true); - - if (jsonProperty is null && dataMemberProperty is null && jsonIgnore is null) return default; - - return new PropertyMapping - { - Name = jsonProperty?.PropertyName ?? dataMemberProperty?.Name, - Ignore = jsonIgnore != null - }; - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Serializer.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Serializer.cs deleted file mode 100644 index 856969b09bb..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Serializer.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; -using Elastic.Transport; -using Newtonsoft.Json.Converters; -using Elastic.Clients.Elasticsearch.JsonNetSerializer.Converters; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer; - -public abstract partial class ConnectionSettingsAwareSerializer -{ - protected ConnectionSettingsAwareSerializer(Serializer builtinSerializer, IElasticsearchClientSettings connectionSettings) - : this(builtinSerializer, connectionSettings, null, null, null) { } - - internal ConnectionSettingsAwareSerializer( - Serializer builtinSerializer, - IElasticsearchClientSettings connectionSettings, - Func jsonSerializerSettingsFactory, - Action modifyContractResolver, - IEnumerable contractJsonConverters - ) - { - JsonSerializerSettingsFactory = jsonSerializerSettingsFactory; - ModifyContractResolverCallback = modifyContractResolver; - ContractJsonConverters = contractJsonConverters ?? Enumerable.Empty(); - - ConnectionSettings = connectionSettings; - BuiltinSerializer = builtinSerializer; - Converters = new List - { - new HandleNestTypesOnSourceJsonConverter(BuiltinSerializer, connectionSettings.MemoryStreamFactory), - new TimeSpanToStringConverter(), - new StringEnumConverter() - }; - _serializer = CreateSerializer(SerializationFormatting.Indented); - _collapsedSerializer = CreateSerializer(SerializationFormatting.None); - } - - protected Serializer BuiltinSerializer { get; } - - protected IElasticsearchClientSettings ConnectionSettings { get; } - protected IEnumerable ContractJsonConverters { get; } - protected Func JsonSerializerSettingsFactory { get; } - protected Action ModifyContractResolverCallback { get; } - - private List Converters { get; } - - private JsonSerializer CreateSerializer(SerializationFormatting formatting) - { - var s = CreateJsonSerializerSettings() ?? new JsonSerializerSettings(); - var converters = CreateJsonConverters() ?? Enumerable.Empty(); - var contract = CreateContractResolver(); - s.Formatting = formatting == SerializationFormatting.Indented ? Formatting.Indented : Formatting.None; - s.ContractResolver = contract; - foreach (var converter in converters.Concat(Converters)) - s.Converters.Add(converter); - - return JsonSerializer.Create(s); - } - - protected virtual ConnectionSettingsAwareContractResolver CreateContractResolver() - { - var contract = new ConnectionSettingsAwareContractResolver(ConnectionSettings); - ModifyContractResolver(contract); - return contract; - } - - protected virtual JsonSerializerSettings CreateJsonSerializerSettings() => JsonSerializerSettingsFactory?.Invoke(); - - protected virtual IEnumerable CreateJsonConverters() => ContractJsonConverters; - - protected virtual void ModifyContractResolver(ConnectionSettingsAwareContractResolver resolver) => - ModifyContractResolverCallback?.Invoke(resolver); -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/HandleNestTypesOnSourceJsonConverter.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/HandleNestTypesOnSourceJsonConverter.cs deleted file mode 100644 index 1f85d945151..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/HandleNestTypesOnSourceJsonConverter.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using Elastic.Clients.Elasticsearch; -using Elastic.Clients.Elasticsearch.QueryDsl; -using Elastic.Transport; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer.Converters -{ - public class HandleNestTypesOnSourceJsonConverter : JsonConverter - { - private static readonly HashSet NestTypesThatCanAppearInSource = new() - { - typeof(JoinField), - typeof(Query), - //typeof(CompletionField), - //typeof(Attachment), - typeof(LazyJson), - //typeof(GeoCoordinate), - //typeof(GeoLocation), - //typeof(CartesianPoint), - }; - - private readonly Serializer _builtInSerializer; - private readonly MemoryStreamFactory _memoryStreamFactory; - - public HandleNestTypesOnSourceJsonConverter(Serializer builtInSerializer, MemoryStreamFactory memoryStreamFactory - ) - { - _builtInSerializer = builtInSerializer; - _memoryStreamFactory = memoryStreamFactory; - } - - public override bool CanRead => true; - public override bool CanWrite => true; - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var formatting = serializer.Formatting == Formatting.Indented - ? SerializationFormatting.Indented - : SerializationFormatting.None; - - using (var ms = _memoryStreamFactory.Create()) - using (var streamReader = new StreamReader(ms, ConnectionSettingsAwareSerializer.ExpectedEncoding)) - using (var reader = new JsonTextReader(streamReader)) - { - _builtInSerializer.Serialize(value, ms, formatting); - ms.Position = 0; - var token = reader.ReadTokenWithDateParseHandlingNone(); - writer.WriteToken(token.CreateReader(), true); - } - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var token = reader.ReadTokenWithDateParseHandlingNone(); - //in place because JsonConverter.Deserialize() only works on full json objects. - //even though we pass type JSON.NET won't try the registered converter for that type - //even if it can handle string tokens :( - if (objectType == typeof(JoinField) && token.Type == JTokenType.String) - return JoinField.Root(token.Value()); - - using (var ms = token.ToStream(_memoryStreamFactory)) - return _builtInSerializer.Deserialize(objectType, ms); - } - - public override bool CanConvert(Type objectType) => - NestTypesThatCanAppearInSource.Contains(objectType); - //|| - //typeof(GeoShape).IsAssignableFrom(objectType) || - //typeof(GeometryCollection).IsAssignableFrom(objectType); - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/TimeSpanToStringConverter.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/TimeSpanToStringConverter.cs deleted file mode 100644 index 5d48ccd7af4..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Converters/TimeSpanToStringConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using Newtonsoft.Json; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer.Converters -{ - /// - /// Included for compatibility reasons - /// - internal class TimeSpanToStringConverter : JsonConverter - { - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - if (value == null) - writer.WriteNull(); - else - { - var timeSpan = (TimeSpan)value; - writer.WriteValue(timeSpan.Ticks); - } - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - switch (reader.TokenType) - { - case JsonToken.Null: return null; - case JsonToken.String: return TimeSpan.Parse((string)reader.Value); - case JsonToken.Integer: return new TimeSpan((long)reader.Value); - } - throw new JsonSerializationException($"Cannot convert token of type {reader.TokenType} to {objectType}."); - } - - public override bool CanConvert(Type objectType) => objectType == typeof(TimeSpan) || objectType == typeof(TimeSpan?); - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Elastic.Clients.Elasticsearch.JsonNetSerializer.csproj b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Elastic.Clients.Elasticsearch.JsonNetSerializer.csproj deleted file mode 100644 index 5dcb5ab51b3..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Elastic.Clients.Elasticsearch.JsonNetSerializer.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - Elastic.Clients.Elasticsearch.JsonNetSerializer - Elastic.Clients.Elasticsearch.JsonNetSerializer - Elasticsearch .NET custom Json.NET serializer - elasticsearch,elastic,search,lucene,nest,serializer,json - Elastic.Clients.Elasticsearch uses an internal serializer. This package enables serialization for your documents using your own custom Json.NET serializer. - - - - true - true - netstandard2.0;net462;netstandard2.1;net8.0 - - - - - - - - \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JTokenExtensions.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JTokenExtensions.cs deleted file mode 100644 index d10d0594282..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JTokenExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.IO; -using Elastic.Transport; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer -{ - internal static class JTokenExtensions - { - /// - /// Writes a to a using - /// - public static MemoryStream ToStream(this JToken token, MemoryStreamFactory memoryStreamFactory) - { - var ms = memoryStreamFactory.Create(); - using (var streamWriter = new StreamWriter(ms, ConnectionSettingsAwareSerializer.ExpectedEncoding, - ConnectionSettingsAwareSerializer.DefaultBufferSize, true)) - using (var writer = new JsonTextWriter(streamWriter)) - { - token.WriteTo(writer); - writer.Flush(); - ms.Position = 0; - return ms; - } - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonNetSerializer.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonNetSerializer.cs deleted file mode 100644 index db8361aa6fa..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonNetSerializer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Elastic.Transport; -using Elastic.Clients.Elasticsearch; -using Newtonsoft.Json; -using Elastic.Clients.Elasticsearch.JsonNetSerializer; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer -{ - public class JsonNetSerializer : ConnectionSettingsAwareSerializer - { - public JsonNetSerializer( - Serializer builtinSerializer, - IElasticsearchClientSettings connectionSettings, - Func jsonSerializerSettingsFactory = null, - Action modifyContractResolver = null, - IEnumerable contractJsonConverters = null - ) - : base(builtinSerializer, connectionSettings, jsonSerializerSettingsFactory, modifyContractResolver, contractJsonConverters) { } - - public static JsonNetSerializer Default(Serializer builtin, IElasticsearchClientSettings values) => new(builtin, values); - } -} diff --git a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonReaderExtensions.cs b/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonReaderExtensions.cs deleted file mode 100644 index c2a45bc962c..00000000000 --- a/src/Elastic.Clients.Elasticsearch.JsonNetSerializer/JsonReaderExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Threading; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Elastic.Clients.Elasticsearch.JsonNetSerializer -{ - internal static class JsonReaderExtensions - { - public static JToken ReadTokenWithDateParseHandlingNone(this JsonReader reader) - { - var dateParseHandling = reader.DateParseHandling; - reader.DateParseHandling = DateParseHandling.None; - var token = JToken.ReadFrom(reader); - reader.DateParseHandling = dateParseHandling; - return token; - } - - public static async Task ReadTokenWithDateParseHandlingNoneAsync(this JsonReader reader, - CancellationToken cancellationToken = default - ) - { - var dateParseHandling = reader.DateParseHandling; - reader.DateParseHandling = DateParseHandling.None; - var token = await JToken.ReadFromAsync(reader, cancellationToken).ConfigureAwait(false); - reader.DateParseHandling = dateParseHandling; - return token; - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/Api/IndexManagement/GetTemplateResponse.cs b/src/Elastic.Clients.Elasticsearch/Api/IndexManagement/GetTemplateResponse.cs deleted file mode 100644 index bc09793b8ad..00000000000 --- a/src/Elastic.Clients.Elasticsearch/Api/IndexManagement/GetTemplateResponse.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.IndexManagement; - -public partial class GetTemplateResponse -{ - [JsonIgnore] - public IReadOnlyDictionary TemplateMappings => BackingDictionary; -} diff --git a/src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj b/src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj index 6ff6841ca78..cf7b323601d 100644 --- a/src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj +++ b/src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj @@ -16,9 +16,14 @@ true true annotations + true + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs index 0fbea097dfe..6facc66b7f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs @@ -17,6 +17,10 @@ #nullable restore +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + namespace Elastic.Clients.Elasticsearch.Requests; internal static class ApiUrlLookup @@ -63,6 +67,7 @@ internal static class ApiUrlLookup internal static ApiUrls EsqlAsyncQuery = new ApiUrls(new[] { "_query/async" }); internal static ApiUrls EsqlAsyncQueryDelete = new ApiUrls(new[] { "_query/async/{id}" }); internal static ApiUrls EsqlAsyncQueryGet = new ApiUrls(new[] { "_query/async/{id}" }); + internal static ApiUrls EsqlAsyncQueryStop = new ApiUrls(new[] { "_query/async/{id}/stop" }); internal static ApiUrls EsqlQuery = new ApiUrls(new[] { "_query" }); internal static ApiUrls FeaturesGetFeatures = new ApiUrls(new[] { "_features" }); internal static ApiUrls FeaturesResetFeatures = new ApiUrls(new[] { "_features/_reset" }); @@ -78,14 +83,16 @@ internal static class ApiUrlLookup internal static ApiUrls IndexLifecycleManagementStart = new ApiUrls(new[] { "_ilm/start" }); internal static ApiUrls IndexLifecycleManagementStop = new ApiUrls(new[] { "_ilm/stop" }); internal static ApiUrls IndexManagementAnalyze = new ApiUrls(new[] { "_analyze", "{index}/_analyze" }); + internal static ApiUrls IndexManagementCancelMigrateReindex = new ApiUrls(new[] { "_migration/reindex/{index}/_cancel" }); internal static ApiUrls IndexManagementClearCache = new ApiUrls(new[] { "_cache/clear", "{index}/_cache/clear" }); internal static ApiUrls IndexManagementClone = new ApiUrls(new[] { "{index}/_clone/{target}" }); internal static ApiUrls IndexManagementClose = new ApiUrls(new[] { "{index}/_close" }); internal static ApiUrls IndexManagementCreate = new ApiUrls(new[] { "{index}" }); internal static ApiUrls IndexManagementCreateDataStream = new ApiUrls(new[] { "_data_stream/{name}" }); + internal static ApiUrls IndexManagementCreateFrom = new ApiUrls(new[] { "_create_from/{source}/{dest}" }); internal static ApiUrls IndexManagementDataStreamsStats = new ApiUrls(new[] { "_data_stream/_stats", "_data_stream/{name}/_stats" }); internal static ApiUrls IndexManagementDelete = new ApiUrls(new[] { "{index}" }); - internal static ApiUrls IndexManagementDeleteAlias = new ApiUrls(new[] { "{index}/_alias/{name}", "{index}/_aliases/{name}" }); + internal static ApiUrls IndexManagementDeleteAlias = new ApiUrls(new[] { "{index}/_alias/{name}" }); internal static ApiUrls IndexManagementDeleteDataLifecycle = new ApiUrls(new[] { "_data_stream/{name}/_lifecycle" }); internal static ApiUrls IndexManagementDeleteDataStream = new ApiUrls(new[] { "_data_stream/{name}" }); internal static ApiUrls IndexManagementDeleteIndexTemplate = new ApiUrls(new[] { "_index_template/{name}" }); @@ -108,13 +115,15 @@ internal static class ApiUrlLookup internal static ApiUrls IndexManagementGetFieldMapping = new ApiUrls(new[] { "_mapping/field/{fields}", "{index}/_mapping/field/{fields}" }); internal static ApiUrls IndexManagementGetIndexTemplate = new ApiUrls(new[] { "_index_template", "_index_template/{name}" }); internal static ApiUrls IndexManagementGetMapping = new ApiUrls(new[] { "_mapping", "{index}/_mapping" }); + internal static ApiUrls IndexManagementGetMigrateReindexStatus = new ApiUrls(new[] { "_migration/reindex/{index}/_status" }); internal static ApiUrls IndexManagementGetSettings = new ApiUrls(new[] { "_settings", "{index}/_settings", "{index}/_settings/{name}", "_settings/{name}" }); internal static ApiUrls IndexManagementGetTemplate = new ApiUrls(new[] { "_template", "_template/{name}" }); + internal static ApiUrls IndexManagementMigrateReindex = new ApiUrls(new[] { "_migration/reindex" }); internal static ApiUrls IndexManagementMigrateToDataStream = new ApiUrls(new[] { "_data_stream/_migrate/{name}" }); internal static ApiUrls IndexManagementModifyDataStream = new ApiUrls(new[] { "_data_stream/_modify" }); internal static ApiUrls IndexManagementOpen = new ApiUrls(new[] { "{index}/_open" }); internal static ApiUrls IndexManagementPromoteDataStream = new ApiUrls(new[] { "_data_stream/_promote/{name}" }); - internal static ApiUrls IndexManagementPutAlias = new ApiUrls(new[] { "{index}/_alias/{name}", "{index}/_aliases/{name}" }); + internal static ApiUrls IndexManagementPutAlias = new ApiUrls(new[] { "{index}/_alias/{name}" }); internal static ApiUrls IndexManagementPutDataLifecycle = new ApiUrls(new[] { "_data_stream/{name}/_lifecycle" }); internal static ApiUrls IndexManagementPutIndexTemplate = new ApiUrls(new[] { "_index_template/{name}" }); internal static ApiUrls IndexManagementPutMapping = new ApiUrls(new[] { "{index}/_mapping" }); @@ -123,7 +132,7 @@ internal static class ApiUrlLookup internal static ApiUrls IndexManagementRecovery = new ApiUrls(new[] { "_recovery", "{index}/_recovery" }); internal static ApiUrls IndexManagementRefresh = new ApiUrls(new[] { "_refresh", "{index}/_refresh" }); internal static ApiUrls IndexManagementReloadSearchAnalyzers = new ApiUrls(new[] { "{index}/_reload_search_analyzers" }); - internal static ApiUrls IndexManagementResolveCluster = new ApiUrls(new[] { "_resolve/cluster/{name}" }); + internal static ApiUrls IndexManagementResolveCluster = new ApiUrls(new[] { "_resolve/cluster", "_resolve/cluster/{name}" }); internal static ApiUrls IndexManagementResolveIndex = new ApiUrls(new[] { "_resolve/index/{name}" }); internal static ApiUrls IndexManagementRollover = new ApiUrls(new[] { "{alias}/_rollover", "{alias}/_rollover/{new_index}" }); internal static ApiUrls IndexManagementSegments = new ApiUrls(new[] { "_segments", "{index}/_segments" }); @@ -135,11 +144,31 @@ internal static class ApiUrlLookup internal static ApiUrls IndexManagementStats = new ApiUrls(new[] { "_stats", "_stats/{metric}", "{index}/_stats", "{index}/_stats/{metric}" }); internal static ApiUrls IndexManagementUpdateAliases = new ApiUrls(new[] { "_aliases" }); internal static ApiUrls IndexManagementValidateQuery = new ApiUrls(new[] { "_validate/query", "{index}/_validate/query" }); + internal static ApiUrls InferenceChatCompletionUnified = new ApiUrls(new[] { "_inference/chat_completion/{inference_id}/_stream" }); + internal static ApiUrls InferenceCompletion = new ApiUrls(new[] { "_inference/completion/{inference_id}" }); internal static ApiUrls InferenceDelete = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); internal static ApiUrls InferenceGet = new ApiUrls(new[] { "_inference", "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); - internal static ApiUrls InferenceInference = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); internal static ApiUrls InferencePut = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); - internal static ApiUrls InferenceStreamInference = new ApiUrls(new[] { "_inference/{inference_id}/_stream", "_inference/{task_type}/{inference_id}/_stream" }); + internal static ApiUrls InferencePutAlibabacloud = new ApiUrls(new[] { "_inference/{task_type}/{alibabacloud_inference_id}" }); + internal static ApiUrls InferencePutAmazonbedrock = new ApiUrls(new[] { "_inference/{task_type}/{amazonbedrock_inference_id}" }); + internal static ApiUrls InferencePutAnthropic = new ApiUrls(new[] { "_inference/{task_type}/{anthropic_inference_id}" }); + internal static ApiUrls InferencePutAzureaistudio = new ApiUrls(new[] { "_inference/{task_type}/{azureaistudio_inference_id}" }); + internal static ApiUrls InferencePutAzureopenai = new ApiUrls(new[] { "_inference/{task_type}/{azureopenai_inference_id}" }); + internal static ApiUrls InferencePutCohere = new ApiUrls(new[] { "_inference/{task_type}/{cohere_inference_id}" }); + internal static ApiUrls InferencePutElasticsearch = new ApiUrls(new[] { "_inference/{task_type}/{elasticsearch_inference_id}" }); + internal static ApiUrls InferencePutElser = new ApiUrls(new[] { "_inference/{task_type}/{elser_inference_id}" }); + internal static ApiUrls InferencePutGoogleaistudio = new ApiUrls(new[] { "_inference/{task_type}/{googleaistudio_inference_id}" }); + internal static ApiUrls InferencePutGooglevertexai = new ApiUrls(new[] { "_inference/{task_type}/{googlevertexai_inference_id}" }); + internal static ApiUrls InferencePutHuggingFace = new ApiUrls(new[] { "_inference/{task_type}/{huggingface_inference_id}" }); + internal static ApiUrls InferencePutJinaai = new ApiUrls(new[] { "_inference/{task_type}/{jinaai_inference_id}" }); + internal static ApiUrls InferencePutMistral = new ApiUrls(new[] { "_inference/{task_type}/{mistral_inference_id}" }); + internal static ApiUrls InferencePutOpenai = new ApiUrls(new[] { "_inference/{task_type}/{openai_inference_id}" }); + internal static ApiUrls InferencePutVoyageai = new ApiUrls(new[] { "_inference/{task_type}/{voyageai_inference_id}" }); + internal static ApiUrls InferencePutWatsonx = new ApiUrls(new[] { "_inference/{task_type}/{watsonx_inference_id}" }); + internal static ApiUrls InferenceRerank = new ApiUrls(new[] { "_inference/rerank/{inference_id}" }); + internal static ApiUrls InferenceSparseEmbedding = new ApiUrls(new[] { "_inference/sparse_embedding/{inference_id}" }); + internal static ApiUrls InferenceStreamCompletion = new ApiUrls(new[] { "_inference/completion/{inference_id}/_stream" }); + internal static ApiUrls InferenceTextEmbedding = new ApiUrls(new[] { "_inference/text_embedding/{inference_id}" }); internal static ApiUrls InferenceUpdate = new ApiUrls(new[] { "_inference/{inference_id}/_update", "_inference/{task_type}/{inference_id}/_update" }); internal static ApiUrls IngestDeleteGeoipDatabase = new ApiUrls(new[] { "_ingest/geoip/database/{id}" }); internal static ApiUrls IngestDeleteIpLocationDatabase = new ApiUrls(new[] { "_ingest/ip_location/database/{id}" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusRequest.g.cs index ed385a30bf7..d4fb5f65fde 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusRequest.g.cs @@ -17,48 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class AsyncSearchStatusRequestParameters : RequestParameters +public sealed partial class AsyncSearchStatusRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Specifies how long the async search needs to be available. + /// The length of time that the async search needs to be available. /// Ongoing async searches and any saved search results are deleted after this period. /// /// public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } } +internal sealed partial class AsyncSearchStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the async search status. /// /// /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. -/// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. +/// If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to: +/// +/// +/// +/// +/// The user or API key that submitted the original async search request. +/// +/// +/// +/// +/// Users that have the monitor cluster privilege or greater privileges. /// +/// +/// /// -public sealed partial class AsyncSearchStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestConverter))] +public sealed partial class AsyncSearchStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public AsyncSearchStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchStatus; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.AsyncSearchStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -66,11 +112,21 @@ public AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// /// - /// Specifies how long the async search needs to be available. + /// A unique identifier for the async search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The length of time that the async search needs to be available. /// Ongoing async searches and any saved search results are deleted after this period. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } } @@ -80,72 +136,115 @@ public AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// /// /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. -/// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. +/// If the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to: +/// +/// +/// +/// +/// The user or API key that submitted the original async search request. /// +/// +/// +/// +/// Users that have the monitor cluster privilege or greater privileges. +/// +/// +/// /// -public sealed partial class AsyncSearchStatusRequestDescriptor : RequestDescriptor, AsyncSearchStatusRequestParameters> +public readonly partial struct AsyncSearchStatusRequestDescriptor { - internal AsyncSearchStatusRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest Instance { get; init; } - public AsyncSearchStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncSearchStatusRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchStatus; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public AsyncSearchStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest(id); + } - internal override string OperationName => "async_search.status"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public AsyncSearchStatusRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public AsyncSearchStatusRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); + public static explicit operator Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest instance) => new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor descriptor) => descriptor.Instance; - public AsyncSearchStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// A unique identifier for the async search. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The length of time that the async search needs to be available. + /// Ongoing async searches and any saved search results are deleted after this period. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.KeepAlive = value; + return this; } -} -/// -/// -/// Get the async search status. -/// -/// -/// Get the status of a previously submitted async search request given its identifier, without retrieving search results. -/// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. -/// -/// -public sealed partial class AsyncSearchStatusRequestDescriptor : RequestDescriptor -{ - internal AsyncSearchStatusRequestDescriptor(Action configure) => configure.Invoke(this); - - public AsyncSearchStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchStatus; + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "async_search.status"; + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public AsyncSearchStatusRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public AsyncSearchStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusResponse.g.cs index 126481dc53a..be4446982ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchStatusResponse.g.cs @@ -17,58 +17,202 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class AsyncSearchStatusResponse : ElasticsearchResponse +internal sealed partial class AsyncSearchStatusResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionStatus = System.Text.Json.JsonEncodedText.Encode("completion_status"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTime = System.Text.Json.JsonEncodedText.Encode("completion_time"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTimeInMillis = System.Text.Json.JsonEncodedText.Encode("completion_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTime = System.Text.Json.JsonEncodedText.Encode("expiration_time"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTimeInMillis = System.Text.Json.JsonEncodedText.Encode("expiration_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusters = default; + LocalJsonValue propCompletionStatus = default; + LocalJsonValue propCompletionTime = default; + LocalJsonValue propCompletionTimeInMillis = default; + LocalJsonValue propExpirationTime = default; + LocalJsonValue propExpirationTimeInMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue propShards = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propCompletionStatus.TryReadProperty(ref reader, options, PropCompletionStatus, null)) + { + continue; + } + + if (propCompletionTime.TryReadProperty(ref reader, options, PropCompletionTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCompletionTimeInMillis.TryReadProperty(ref reader, options, PropCompletionTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propExpirationTime.TryReadProperty(ref reader, options, PropExpirationTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExpirationTimeInMillis.TryReadProperty(ref reader, options, PropExpirationTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Clusters = propClusters.Value, + CompletionStatus = propCompletionStatus.Value, + CompletionTime = propCompletionTime.Value, + CompletionTimeInMillis = propCompletionTimeInMillis.Value, + ExpirationTime = propExpirationTime.Value, + ExpirationTimeInMillis = propExpirationTimeInMillis.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + Shards = propShards.Value, + StartTime = propStartTime.Value, + StartTimeInMillis = propStartTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropCompletionStatus, value.CompletionStatus, null, null); + writer.WriteProperty(options, PropCompletionTime, value.CompletionTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCompletionTimeInMillis, value.CompletionTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropExpirationTime, value.ExpirationTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExpirationTimeInMillis, value.ExpirationTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponseConverter))] +public sealed partial class AsyncSearchStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncSearchStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncSearchStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Metadata about clusters involved in the cross-cluster search. - /// Not shown for local-only searches. + /// It is not shown for local-only searches. /// /// - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } /// /// /// If the async search completed, this field shows the status code of the search. - /// For example, 200 indicates that the async search was successfully completed. - /// 503 indicates that the async search was completed with an error. + /// For example, 200 indicates that the async search was successfully completed. + /// 503 indicates that the async search was completed with an error. /// /// - [JsonInclude, JsonPropertyName("completion_status")] - public int? CompletionStatus { get; init; } + public int? CompletionStatus { get; set; } /// /// - /// Indicates when the async search completed. Only present - /// when the search has completed. + /// Indicates when the async search completed. + /// It is present only when the search has completed. /// /// - [JsonInclude, JsonPropertyName("completion_time")] - public DateTimeOffset? CompletionTime { get; init; } - [JsonInclude, JsonPropertyName("completion_time_in_millis")] - public long? CompletionTimeInMillis { get; init; } + public System.DateTimeOffset? CompletionTime { get; set; } + public System.DateTimeOffset? CompletionTimeInMillis { get; set; } /// /// /// Indicates when the async search will expire. /// /// - [JsonInclude, JsonPropertyName("expiration_time")] - public DateTimeOffset? ExpirationTime { get; init; } - [JsonInclude, JsonPropertyName("expiration_time_in_millis")] - public long ExpirationTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public System.DateTimeOffset? ExpirationTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpirationTimeInMillis { get; set; } + public string? Id { get; set; } /// /// @@ -76,27 +220,41 @@ public sealed partial class AsyncSearchStatusResponse : ElasticsearchResponse /// While the query is running, is_partial is always set to true. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// /// Indicates whether the search is still running or has completed. - /// NOTE: If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. + /// + /// + /// info + /// If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } /// /// - /// Indicates how many shards have run the query so far. + /// The number of shards that have run the query so far. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchRequest.g.cs index e59001fda74..0d1d5481707 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class DeleteAsyncSearchRequestParameters : RequestParameters +public sealed partial class DeleteAsyncSearchRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteAsyncSearchRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -44,19 +66,42 @@ public sealed partial class DeleteAsyncSearchRequestParameters : RequestParamete /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. /// /// -public sealed partial class DeleteAsyncSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestConverter))] +public sealed partial class DeleteAsyncSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteAsyncSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.AsyncSearchDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "async_search.delete"; + + /// + /// + /// A unique identifier for the async search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -69,66 +114,88 @@ public DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. /// /// -public sealed partial class DeleteAsyncSearchRequestDescriptor : RequestDescriptor, DeleteAsyncSearchRequestParameters> +public readonly partial struct DeleteAsyncSearchRequestDescriptor { - internal DeleteAsyncSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest Instance { get; init; } - public DeleteAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchDelete; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public DeleteAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteAsyncSearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "async_search.delete"; + public static explicit operator Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest instance) => new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor descriptor) => descriptor.Instance; - public DeleteAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// A unique identifier for the async search. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Delete an async search. -/// -/// -/// If the asynchronous search is still running, it is cancelled. -/// Otherwise, the saved search results are deleted. -/// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. -/// -/// -public sealed partial class DeleteAsyncSearchRequestDescriptor : RequestDescriptor -{ - internal DeleteAsyncSearchRequestDescriptor(Action configure) => configure.Invoke(this); - - public DeleteAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchDelete; + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "async_search.delete"; + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchResponse.g.cs index ea208db9469..2607a4672c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/DeleteAsyncSearchResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class DeleteAsyncSearchResponse : ElasticsearchResponse +internal sealed partial class DeleteAsyncSearchResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponseConverter))] +public sealed partial class DeleteAsyncSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAsyncSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchRequest.g.cs index c2884fe1b43..e68424ae83f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchRequest.g.cs @@ -17,24 +17,17 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class GetAsyncSearchRequestParameters : RequestParameters +public sealed partial class GetAsyncSearchRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Specifies how long the async search should be available in the cluster. + /// The length of time that the async search should be available in the cluster. /// When not specified, the keep_alive set with the corresponding submit async request will be used. /// Otherwise, it is possible to override the value and extend the validity of the request. /// When this period expires, the search, if still running, is cancelled. @@ -60,6 +53,35 @@ public sealed partial class GetAsyncSearchRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } +internal sealed partial class GetAsyncSearchRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get async search results. @@ -69,15 +91,27 @@ public sealed partial class GetAsyncSearchRequestParameters : RequestParameters /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. /// /// -public sealed partial class GetAsyncSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestConverter))] +public partial class GetAsyncSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetAsyncSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.AsyncSearchGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -85,14 +119,24 @@ public GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// /// - /// Specifies how long the async search should be available in the cluster. + /// A unique identifier for the async search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The length of time that the async search should be available in the cluster. /// When not specified, the keep_alive set with the corresponding submit async request will be used. /// Otherwise, it is possible to override the value and extend the validity of the request. /// When this period expires, the search, if still running, is cancelled. /// If the search is completed, its saved results are deleted. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -100,7 +144,6 @@ public GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -110,7 +153,6 @@ public GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// By default no timeout is set meaning that the currently available results will be returned without any additional wait. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } @@ -123,73 +165,127 @@ public GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. /// /// -public sealed partial class GetAsyncSearchRequestDescriptor : RequestDescriptor, GetAsyncSearchRequestParameters> +public readonly partial struct GetAsyncSearchRequestDescriptor { - internal GetAsyncSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest Instance { get; init; } - public GetAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchGet; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public GetAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetAsyncSearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "async_search.get"; + public static explicit operator Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest instance) => new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor descriptor) => descriptor.Instance; - public GetAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public GetAsyncSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public GetAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + /// + /// + /// A unique identifier for the async search. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public GetAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The length of time that the async search should be available in the cluster. + /// When not specified, the keep_alive set with the corresponding submit async request will be used. + /// Otherwise, it is possible to override the value and extend the validity of the request. + /// When this period expires, the search, if still running, is cancelled. + /// If the search is completed, its saved results are deleted. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("id", id); - return Self; + Instance.KeepAlive = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor TypedKeys(bool? value = true) { + Instance.TypedKeys = value; + return this; } -} -/// -/// -/// Get async search results. -/// -/// -/// Retrieve the results of a previously submitted asynchronous search request. -/// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. -/// -/// -public sealed partial class GetAsyncSearchRequestDescriptor : RequestDescriptor -{ - internal GetAsyncSearchRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Specifies to wait for the search to be completed up until the provided timeout. + /// Final results will be returned if available before the timeout expires, otherwise the currently available results will be returned once the timeout expires. + /// By default no timeout is set meaning that the currently available results will be returned without any additional wait. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } - public GetAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchGet; + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "async_search.get"; + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public GetAsyncSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public GetAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetAsyncSearchRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchResponse.g.cs index 3dd949e280f..e3713e3ef6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/GetAsyncSearchResponse.g.cs @@ -17,39 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class GetAsyncSearchResponse : ElasticsearchResponse +internal sealed partial class GetAsyncSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { + private static readonly System.Text.Json.JsonEncodedText PropCompletionTime = System.Text.Json.JsonEncodedText.Encode("completion_time"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTimeInMillis = System.Text.Json.JsonEncodedText.Encode("completion_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTime = System.Text.Json.JsonEncodedText.Encode("expiration_time"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTimeInMillis = System.Text.Json.JsonEncodedText.Encode("expiration_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropResponse = System.Text.Json.JsonEncodedText.Encode("response"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompletionTime = default; + LocalJsonValue propCompletionTimeInMillis = default; + LocalJsonValue propExpirationTime = default; + LocalJsonValue propExpirationTimeInMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue> propResponse = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompletionTime.TryReadProperty(ref reader, options, PropCompletionTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCompletionTimeInMillis.TryReadProperty(ref reader, options, PropCompletionTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propExpirationTime.TryReadProperty(ref reader, options, PropExpirationTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExpirationTimeInMillis.TryReadProperty(ref reader, options, PropExpirationTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propResponse.TryReadProperty(ref reader, options, PropResponse, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompletionTime = propCompletionTime.Value, + CompletionTimeInMillis = propCompletionTimeInMillis.Value, + ExpirationTime = propExpirationTime.Value, + ExpirationTimeInMillis = propExpirationTimeInMillis.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + Response = propResponse.Value, + StartTime = propStartTime.Value, + StartTimeInMillis = propStartTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompletionTime, value.CompletionTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCompletionTimeInMillis, value.CompletionTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropExpirationTime, value.ExpirationTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExpirationTimeInMillis, value.ExpirationTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropResponse, value.Response, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class GetAsyncSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(GetAsyncSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(GetAsyncSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponseConverterFactory))] +public sealed partial class GetAsyncSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// - /// Indicates when the async search completed. Only present - /// when the search has completed. + /// Indicates when the async search completed. + /// It is present only when the search has completed. /// /// - [JsonInclude, JsonPropertyName("completion_time")] - public DateTimeOffset? CompletionTime { get; init; } - [JsonInclude, JsonPropertyName("completion_time_in_millis")] - public long? CompletionTimeInMillis { get; init; } + public System.DateTimeOffset? CompletionTime { get; set; } + public System.DateTimeOffset? CompletionTimeInMillis { get; set; } /// /// /// Indicates when the async search will expire. /// /// - [JsonInclude, JsonPropertyName("expiration_time")] - public DateTimeOffset? ExpirationTime { get; init; } - [JsonInclude, JsonPropertyName("expiration_time_in_millis")] - public long ExpirationTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public System.DateTimeOffset? ExpirationTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpirationTimeInMillis { get; set; } + public string? Id { get; set; } /// /// @@ -57,21 +202,35 @@ public sealed partial class GetAsyncSearchResponse : ElasticsearchRes /// While the query is running, is_partial is always set to true. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// /// Indicates whether the search is still running or has completed. - /// NOTE: If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. + /// + /// + /// info + /// If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } - [JsonInclude, JsonPropertyName("response")] - public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch Response { get; init; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch Response { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchRequest.g.cs index d44016dcd11..983f2108868 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class SubmitAsyncSearchRequestParameters : RequestParameters +public sealed partial class SubmitAsyncSearchRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -94,7 +87,7 @@ public sealed partial class SubmitAsyncSearchRequestParameters : RequestParamete /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -137,8 +130,7 @@ public sealed partial class SubmitAsyncSearchRequestParameters : RequestParamete /// The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests /// /// - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } - public string? MinCompatibleShardNode { get => Q("min_compatible_shard_node"); set => Q("min_compatible_shard_node", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// @@ -240,410 +232,321 @@ public sealed partial class SubmitAsyncSearchRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } -internal sealed partial class SubmitAsyncSearchRequestConverter : JsonConverter +internal sealed partial class SubmitAsyncSearchRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override SubmitAsyncSearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new SubmitAsyncSearchRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropDocvalueFields = System.Text.Json.JsonEncodedText.Encode("docvalue_fields"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropExt = System.Text.Json.JsonEncodedText.Encode("ext"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesBoost = System.Text.Json.JsonEncodedText.Encode("indices_boost"); + private static readonly System.Text.Json.JsonEncodedText PropKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropPit = System.Text.Json.JsonEncodedText.Encode("pit"); + private static readonly System.Text.Json.JsonEncodedText PropPostFilter = System.Text.Json.JsonEncodedText.Encode("post_filter"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRescore = System.Text.Json.JsonEncodedText.Encode("rescore"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNoPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("seq_no_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminateAfter = System.Text.Json.JsonEncodedText.Encode("terminate_after"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + private static readonly System.Text.Json.JsonEncodedText PropTrackScores = System.Text.Json.JsonEncodedText.Encode("track_scores"); + private static readonly System.Text.Json.JsonEncodedText PropTrackTotalHits = System.Text.Json.JsonEncodedText.Encode("track_total_hits"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propCollapse = default; + LocalJsonValue?> propDocvalueFields = default; + LocalJsonValue propExplain = default; + LocalJsonValue?> propExt = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propFrom = default; + LocalJsonValue propHighlight = default; + LocalJsonValue>?> propIndicesBoost = default; + LocalJsonValue?> propKnn = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propPit = default; + LocalJsonValue propPostFilter = default; + LocalJsonValue propProfile = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propRescore = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSeqNoPrimaryTerm = default; + LocalJsonValue propSize = default; + LocalJsonValue propSlice = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue?> propStats = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propSuggest = default; + LocalJsonValue propTerminateAfter = default; + LocalJsonValue propTimeout = default; + LocalJsonValue propTrackScores = default; + LocalJsonValue propTrackTotalHits = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "collapse") - { - variant.Collapse = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "docvalue_fields") - { - variant.DocvalueFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "explain") - { - variant.Explain = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ext") - { - variant.Ext = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "fields") - { - variant.Fields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "from") - { - variant.From = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "highlight") - { - variant.Highlight = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices_boost") - { - variant.IndicesBoost = JsonSerializer.Deserialize>?>(ref reader, options); - continue; - } - - if (property == "knn") - { - variant.Knn = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "min_score") - { - variant.MinScore = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "pit") - { - variant.Pit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "post_filter") - { - variant.PostFilter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "profile") - { - variant.Profile = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rescore") - { - variant.Rescore = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "search_after") - { - variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "seq_no_primary_term") - { - variant.SeqNoPrimaryTerm = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "size") - { - variant.Size = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "slice") - { - variant.Slice = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "sort") - { - variant.Sort = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "_source") - { - variant.Source = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "stats") - { - variant.Stats = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "stored_fields") - { - variant.StoredFields = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "suggest") - { - variant.Suggest = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "terminate_after") - { - variant.TerminateAfter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "timeout") - { - variant.Timeout = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_scores") - { - variant.TrackScores = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_total_hits") - { - variant.TrackTotalHits = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - variant.Version = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - - return variant; - } - public override void Write(Utf8JsonWriter writer, SubmitAsyncSearchRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } - if (value.Collapse is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, value.Collapse, options); - } + if (propDocvalueFields.TryReadProperty(ref reader, options, PropDocvalueFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.DocvalueFields is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, value.DocvalueFields, options); - } + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } - if (value.Explain.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(value.Explain.Value); - } + if (propExt.TryReadProperty(ref reader, options, PropExt, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.Ext is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, value.Ext, options); - } + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Fields is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, value.Fields, options); - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (value.From.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(value.From.Value); - } + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } - if (value.Highlight is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, value.Highlight, options); - } + if (propIndicesBoost.TryReadProperty(ref reader, options, PropIndicesBoost, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } - if (value.IndicesBoost is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, value.IndicesBoost, options); - } + if (propKnn.TryReadProperty(ref reader, options, PropKnn, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Knn is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, value.Knn, options); - } + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } - if (value.MinScore.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(value.MinScore.Value); - } + if (propPit.TryReadProperty(ref reader, options, PropPit, null)) + { + continue; + } - if (value.Pit is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, value.Pit, options); - } + if (propPostFilter.TryReadProperty(ref reader, options, PropPostFilter, null)) + { + continue; + } - if (value.PostFilter is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, value.PostFilter, options); - } + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } - if (value.Profile.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(value.Profile.Value); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRescore.TryReadProperty(ref reader, options, PropRescore, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Rescore is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, value.Rescore, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); - } + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.SearchAfter is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, value.SearchAfter, options); - } + if (propSeqNoPrimaryTerm.TryReadProperty(ref reader, options, PropSeqNoPrimaryTerm, null)) + { + continue; + } - if (value.SeqNoPrimaryTerm.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(value.SeqNoPrimaryTerm.Value); - } + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } - if (value.Size.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(value.Size.Value); - } + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } - if (value.Slice is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, value.Slice, options); - } + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Sort is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, value.Sort, options); - } + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } - if (value.Source is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, value.Source, options); - } + if (propStats.TryReadProperty(ref reader, options, PropStats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Stats is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, value.Stats, options); - } + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } - if (value.StoredFields is not null) - { - writer.WritePropertyName("stored_fields"); - new FieldsConverter().Write(writer, value.StoredFields, options); - } + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } - if (value.Suggest is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, value.Suggest, options); - } + if (propTerminateAfter.TryReadProperty(ref reader, options, PropTerminateAfter, null)) + { + continue; + } - if (value.TerminateAfter.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(value.TerminateAfter.Value); - } + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Timeout)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(value.Timeout); - } + if (propTrackScores.TryReadProperty(ref reader, options, PropTrackScores, null)) + { + continue; + } - if (value.TrackScores.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(value.TrackScores.Value); - } + if (propTrackTotalHits.TryReadProperty(ref reader, options, PropTrackTotalHits, null)) + { + continue; + } - if (value.TrackTotalHits is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, value.TrackTotalHits, options); - } + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } - if (value.Version.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(value.Version.Value); - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Collapse = propCollapse.Value, + DocvalueFields = propDocvalueFields.Value, + Explain = propExplain.Value, + Ext = propExt.Value, + Fields = propFields.Value, + From = propFrom.Value, + Highlight = propHighlight.Value, + IndicesBoost = propIndicesBoost.Value, + Knn = propKnn.Value, + MinScore = propMinScore.Value, + Pit = propPit.Value, + PostFilter = propPostFilter.Value, + Profile = propProfile.Value, + Query = propQuery.Value, + Rescore = propRescore.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + SearchAfter = propSearchAfter.Value, + SeqNoPrimaryTerm = propSeqNoPrimaryTerm.Value, + Size = propSize.Value, + Slice = propSlice.Value, + Sort = propSort.Value, + Source = propSource.Value, + Stats = propStats.Value, + StoredFields = propStoredFields.Value, + Suggest = propSuggest.Value, + TerminateAfter = propTerminateAfter.Value, + Timeout = propTimeout.Value, + TrackScores = propTrackScores.Value, + TrackTotalHits = propTrackTotalHits.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropDocvalueFields, value.DocvalueFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropExt, value.Ext, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropIndicesBoost, value.IndicesBoost, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropKnn, value.Knn, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropPit, value.Pit, null, null); + writer.WriteProperty(options, PropPostFilter, value.PostFilter, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRescore, value.Rescore, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeqNoPrimaryTerm, value.SeqNoPrimaryTerm, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminateAfter, value.TerminateAfter, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteProperty(options, PropTrackScores, value.TrackScores, null, null); + writer.WriteProperty(options, PropTrackTotalHits, value.TrackTotalHits, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); writer.WriteEndObject(); } } @@ -663,31 +566,48 @@ public override void Write(Utf8JsonWriter writer, SubmitAsyncSearchRequest value /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. /// /// -[JsonConverter(typeof(SubmitAsyncSearchRequestConverter))] -public sealed partial class SubmitAsyncSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestConverter))] +public partial class SubmitAsyncSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SubmitAsyncSearchRequest() { } - - public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SubmitAsyncSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchSubmit; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.AsyncSearchSubmit; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "async_search.submit"; + /// + /// + /// A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -695,7 +615,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Indicate if an error should be returned if there is a partial search failure or timeout /// /// - [JsonIgnore] public bool? AllowPartialSearchResults { get => Q("allow_partial_search_results"); set => Q("allow_partial_search_results", value); } /// @@ -703,7 +622,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The analyzer to use for the query string /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -711,7 +629,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specify whether wildcard and prefix queries should be analyzed (default: false) /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -720,7 +637,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default). /// /// - [JsonIgnore] public long? BatchedReduceSize { get => Q("batched_reduce_size"); set => Q("batched_reduce_size", value); } /// @@ -728,7 +644,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The default value is the only supported value. /// /// - [JsonIgnore] public bool? CcsMinimizeRoundtrips { get => Q("ccs_minimize_roundtrips"); set => Q("ccs_minimize_roundtrips", value); } /// @@ -736,7 +651,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The default operator for query string query (AND or OR) /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -744,7 +658,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The field to use as default where no field prefix is given in the query string /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -752,15 +665,13 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Whether specified concrete, expanded or aliased indices should be ignored when throttled /// /// - [JsonIgnore] public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// @@ -768,7 +679,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Whether specified concrete indices should be ignored when unavailable (missing or closed) /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -777,7 +687,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Ongoing async searches and any saved search results are deleted after this period. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -785,7 +694,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// If true, results are stored for later retrieval when the search completes within the wait_for_completion_timeout. /// /// - [JsonIgnore] public bool? KeepOnCompletion { get => Q("keep_on_completion"); set => Q("keep_on_completion", value); } /// @@ -793,7 +701,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specify whether format-based query failures (such as providing text to a numeric field) should be ignored /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -801,17 +708,13 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests /// /// - [JsonIgnore] - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } - [JsonIgnore] - public string? MinCompatibleShardNode { get => Q("min_compatible_shard_node"); set => Q("min_compatible_shard_node", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// /// Specify the node or shard the operation should be performed on (default: random) /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -819,7 +722,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Query in the Lucene query string syntax /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -827,7 +729,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specify if request cache should be used for this request or not, defaults to true /// /// - [JsonIgnore] public bool? RequestCache { get => Q("request_cache"); set => Q("request_cache", value); } /// @@ -835,7 +736,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -843,7 +743,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// A comma-separated list of specific routing values /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -851,7 +750,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Search operation type /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -859,7 +757,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// A list of fields to exclude from the returned _source field /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -867,7 +764,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// A list of fields to extract and return from the _source field /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -875,7 +771,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specifies which field to use for suggestions. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Field? SuggestField { get => Q("suggest_field"); set => Q("suggest_field", value); } /// @@ -883,7 +778,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specify suggest mode /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get => Q("suggest_mode"); set => Q("suggest_mode", value); } /// @@ -891,7 +785,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// How many suggestions to return in response /// /// - [JsonIgnore] public long? SuggestSize { get => Q("suggest_size"); set => Q("suggest_size", value); } /// @@ -899,7 +792,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The source text for which the suggestions should be returned. /// /// - [JsonIgnore] public string? SuggestText { get => Q("suggest_text"); set => Q("suggest_text", value); } /// @@ -907,7 +799,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -916,11 +807,8 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } - [JsonInclude, JsonPropertyName("collapse")] + public System.Collections.Generic.IDictionary? Aggregations { get; set; } public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } /// @@ -929,15 +817,13 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// names matching these patterns in the hits.fields property of the response. /// /// - [JsonInclude, JsonPropertyName("docvalue_fields")] - public ICollection? DocvalueFields { get; set; } + public System.Collections.Generic.ICollection? DocvalueFields { get; set; } /// /// /// If true, returns detailed information about score computation as part of a hit. /// /// - [JsonInclude, JsonPropertyName("explain")] public bool? Explain { get; set; } /// @@ -945,8 +831,7 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - [JsonInclude, JsonPropertyName("ext")] - public IDictionary? Ext { get; set; } + public System.Collections.Generic.IDictionary? Ext { get; set; } /// /// @@ -954,8 +839,7 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// matching these patterns in the hits.fields property of the response. /// /// - [JsonInclude, JsonPropertyName("fields")] - public ICollection? Fields { get; set; } + public System.Collections.Generic.ICollection? Fields { get; set; } /// /// @@ -964,9 +848,7 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// search_after parameter. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } - [JsonInclude, JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Core.Search.Highlight? Highlight { get; set; } /// @@ -974,25 +856,21 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Boosts the _score of documents from specified indices. /// /// - [JsonInclude, JsonPropertyName("indices_boost")] - public ICollection>? IndicesBoost { get; set; } + public System.Collections.Generic.ICollection>? IndicesBoost { get; set; } /// /// /// Defines the approximate kNN search to run. /// /// - [JsonInclude, JsonPropertyName("knn")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.KnnSearch))] - public ICollection? Knn { get; set; } + public System.Collections.Generic.ICollection? Knn { get; set; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// not included in search results and results collected by aggregations. /// /// - [JsonInclude, JsonPropertyName("min_score")] public double? MinScore { get; set; } /// @@ -1001,11 +879,8 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// cannot specify an <index> in the request path. /// /// - [JsonInclude, JsonPropertyName("pit")] public Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? Pit { get; set; } - [JsonInclude, JsonPropertyName("post_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilter { get; set; } - [JsonInclude, JsonPropertyName("profile")] public bool? Profile { get; set; } /// @@ -1013,11 +888,8 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Defines the search definition using the Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } - [JsonInclude, JsonPropertyName("rescore")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.Rescore))] - public ICollection? Rescore { get; set; } + public System.Collections.Generic.ICollection? Rescore { get; set; } /// /// @@ -1025,18 +897,15 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// precedence over mapped fields with the same name. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// @@ -1044,7 +913,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// of each hit. See Optimistic concurrency control. /// /// - [JsonInclude, JsonPropertyName("seq_no_primary_term")] public bool? SeqNoPrimaryTerm { get; set; } /// @@ -1054,13 +922,9 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// hits, use the search_after parameter. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - [JsonInclude, JsonPropertyName("slice")] public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } /// /// @@ -1068,7 +932,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// fields are returned in the hits._source property of the search response. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// @@ -1078,8 +941,7 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// the indices stats API. /// /// - [JsonInclude, JsonPropertyName("stats")] - public ICollection? Stats { get; set; } + public System.Collections.Generic.ICollection? Stats { get; set; } /// /// @@ -1089,10 +951,7 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// and stored fields in the search response. /// /// - [JsonInclude, JsonPropertyName("stored_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } - [JsonInclude, JsonPropertyName("suggest")] public Elastic.Clients.Elasticsearch.Core.Search.Suggester? Suggest { get; set; } /// @@ -1102,7 +961,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// before sorting. Defaults to 0, which does not terminate query execution early. /// /// - [JsonInclude, JsonPropertyName("terminate_after")] public long? TerminateAfter { get; set; } /// @@ -1112,7 +970,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Defaults to no timeout. /// /// - [JsonInclude, JsonPropertyName("timeout")] public string? Timeout { get; set; } /// @@ -1120,7 +977,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// - [JsonInclude, JsonPropertyName("track_scores")] public bool? TrackScores { get; set; } /// @@ -1131,7 +987,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// Defaults to 10,000 hits. /// /// - [JsonInclude, JsonPropertyName("track_total_hits")] public Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHits { get; set; } /// @@ -1139,7 +994,6 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// If true, returns document version as part of a hit. /// /// - [JsonInclude, JsonPropertyName("version")] public bool? Version { get; set; } } @@ -1158,1276 +1012,1839 @@ public SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. /// /// -public sealed partial class SubmitAsyncSearchRequestDescriptor : RequestDescriptor, SubmitAsyncSearchRequestParameters> +public readonly partial struct SubmitAsyncSearchRequestDescriptor { - internal SubmitAsyncSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest Instance { get; init; } - public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest instance) { + Instance = instance; } - public SubmitAsyncSearchRequestDescriptor() + public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchSubmit; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "async_search.submit"; - - public SubmitAsyncSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SubmitAsyncSearchRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public SubmitAsyncSearchRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public SubmitAsyncSearchRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public SubmitAsyncSearchRequestDescriptor BatchedReduceSize(long? batchedReduceSize) => Qs("batched_reduce_size", batchedReduceSize); - public SubmitAsyncSearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SubmitAsyncSearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public SubmitAsyncSearchRequestDescriptor Df(string? df) => Qs("df", df); - public SubmitAsyncSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SubmitAsyncSearchRequestDescriptor IgnoreThrottled(bool? ignoreThrottled = true) => Qs("ignore_throttled", ignoreThrottled); - public SubmitAsyncSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SubmitAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public SubmitAsyncSearchRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) => Qs("keep_on_completion", keepOnCompletion); - public SubmitAsyncSearchRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public SubmitAsyncSearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public SubmitAsyncSearchRequestDescriptor MinCompatibleShardNode(string? minCompatibleShardNode) => Qs("min_compatible_shard_node", minCompatibleShardNode); - public SubmitAsyncSearchRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SubmitAsyncSearchRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public SubmitAsyncSearchRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public SubmitAsyncSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SubmitAsyncSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SubmitAsyncSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SubmitAsyncSearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public SubmitAsyncSearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public SubmitAsyncSearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? suggestField) => Qs("suggest_field", suggestField); - public SubmitAsyncSearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) => Qs("suggest_mode", suggestMode); - public SubmitAsyncSearchRequestDescriptor SuggestSize(long? suggestSize) => Qs("suggest_size", suggestSize); - public SubmitAsyncSearchRequestDescriptor SuggestText(string? suggestText) => Qs("suggest_text", suggestText); - public SubmitAsyncSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public SubmitAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); - - public SubmitAsyncSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) - { - RouteValues.Optional("index", indices); - return Self; - } - - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action> DocvalueFieldsDescriptorAction { get; set; } - private Action>[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action> HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action> KnnDescriptorAction { get; set; } - private Action>[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action> PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action> RescoreDescriptorAction { get; set; } - private Action>[] RescoreDescriptorActions { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action> SliceDescriptorAction { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action> SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } - - public SubmitAsyncSearchRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) - { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) - { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) - { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Action> configure) - { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + public SubmitAsyncSearchRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest instance) => new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor descriptor) => descriptor.Instance; + /// /// - /// Array of wildcard (*) patterns. The request returns doc values for field - /// names matching these patterns in the hits.fields property of the response. + /// A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices /// /// - public SubmitAsyncSearchRequestDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.Indices = value; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AllowNoIndices(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.AllowNoIndices = value; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(Action> configure) + /// + /// + /// Indicate if an error should be returned if there is a partial search failure or timeout + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AllowPartialSearchResults(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(params Action>[] configure) + /// + /// + /// The analyzer to use for the query string + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Analyzer(string? value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.Analyzer = value; + return this; } /// /// - /// If true, returns detailed information about score computation as part of a hit. + /// Specify whether wildcard and prefix queries should be analyzed (default: false) /// /// - public SubmitAsyncSearchRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AnalyzeWildcard(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// /// - /// Configuration of search extensions defined by Elasticsearch plugins. + /// Affects how often partial results become available, which happens whenever shard results are reduced. + /// A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default). /// /// - public SubmitAsyncSearchRequestDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor BatchedReduceSize(long? value) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.BatchedReduceSize = value; + return this; } /// /// - /// Array of wildcard (*) patterns. The request returns values for field names - /// matching these patterns in the hits.fields property of the response. + /// The default value is the only supported value. /// /// - public SubmitAsyncSearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.CcsMinimizeRoundtrips = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// The default operator for query string query (AND or OR) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.DefaultOperator = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Fields(Action> configure) + /// + /// + /// The field to use as default where no field prefix is given in the query string + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Df(string? value) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; + Instance.Df = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Fields(params Action>[] configure) + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.ExpandWildcards = value; + return this; } /// /// - /// Starting document offset. By default, you cannot page through more than 10,000 - /// hits using the from and size parameters. To page through more hits, use the - /// search_after parameter. + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public SubmitAsyncSearchRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - FromValue = from; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + /// + /// + /// Whether specified concrete, expanded or aliased indices should be ignored when throttled + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IgnoreThrottled(bool? value = true) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.IgnoreThrottled = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IgnoreUnavailable(bool? value = true) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Action> configure) + /// + /// + /// Specifies how long the async search needs to be available. + /// Ongoing async searches and any saved search results are deleted after this period. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.KeepAlive = value; + return this; } /// /// - /// Boosts the _score of documents from specified indices. + /// If true, results are stored for later retrieval when the search completes within the wait_for_completion_timeout. /// /// - public SubmitAsyncSearchRequestDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor KeepOnCompletion(bool? value = true) { - IndicesBoostValue = indicesBoost; - return Self; + Instance.KeepOnCompletion = value; + return this; } /// /// - /// Defines the approximate kNN search to run. + /// Specify whether format-based query failures (such as providing text to a numeric field) should be ignored /// /// - public SubmitAsyncSearchRequestDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Lenient(bool? value = true) { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; + Instance.Lenient = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) + /// + /// + /// The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor MaxConcurrentShardRequests(int? value) { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; + Instance.MaxConcurrentShardRequests = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(Action> configure) + /// + /// + /// Specify the node or shard the operation should be performed on (default: random) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Preference(string? value) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; + Instance.Preference = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(params Action>[] configure) + /// + /// + /// Query in the Lucene query string syntax + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor QueryLuceneSyntax(string? value) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + Instance.QueryLuceneSyntax = value; + return this; } /// /// - /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// Specify if request cache should be used for this request or not, defaults to true /// /// - public SubmitAsyncSearchRequestDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestCache(bool? value = true) { - MinScoreValue = minScore; - return Self; + Instance.RequestCache = value; + return this; } /// /// - /// Limits the search to a point in time (PIT). If you provide a PIT, you - /// cannot specify an <index> in the request path. + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response /// /// - public SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; + Instance.RestTotalHitsAsInt = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) + /// + /// + /// A comma-separated list of specific routing values + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; + Instance.Routing = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Pit(Action configure) + /// + /// + /// Search operation type + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; + Instance.SearchType = value; + return this; } - public SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) - { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A list of fields to exclude from the returned _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; + Instance.SourceExcludes = value; + return this; } - public SubmitAsyncSearchRequestDescriptor PostFilter(Action> configure) + /// + /// + /// A list of fields to exclude from the returned _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.SourceExcludes = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Profile(bool? profile = true) + /// + /// + /// A list of fields to extract and return from the _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) { - ProfileValue = profile; - return Self; + Instance.SourceIncludes = value; + return this; } /// /// - /// Defines the search definition using the Query DSL. + /// A list of fields to extract and return from the _source field /// /// - public SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.SourceIncludes = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies which field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.SuggestField = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Query(Action> configure) + /// + /// + /// Specifies which field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestField(System.Linq.Expressions.Expression> value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SuggestField = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(ICollection? rescore) + /// + /// + /// Specify suggest mode + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; + Instance.SuggestMode = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) + /// + /// + /// How many suggestions to return in response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestSize(long? value) { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.SuggestSize = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(Action> configure) + /// + /// + /// The source text for which the suggestions should be returned. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestText(string? value) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; + Instance.SuggestText = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(params Action>[] configure) + /// + /// + /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TypedKeys(bool? value = true) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.TypedKeys = value; + return this; } /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// Blocks and waits until the search is completed up to a certain timeout. + /// When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. /// /// - public SubmitAsyncSearchRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) + { + Instance.Collapse = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Collapse(System.Action action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Collapse(System.Action> action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// /// - /// Retrieve a script evaluation (based on different fields) for each hit. + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. /// /// - public SubmitAsyncSearchRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.DocvalueFields = value; + return this; } - public SubmitAsyncSearchRequestDescriptor SearchAfter(ICollection? searchAfter) + /// + /// + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } /// /// - /// If true, returns sequence number and primary term of the last modification - /// of each hit. See Optimistic concurrency control. + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. /// /// - public SubmitAsyncSearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(params System.Action[] actions) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } /// /// - /// The number of hits to return. By default, you cannot page through more - /// than 10,000 hits using the from and size parameters. To page through more - /// hits, use the search_after parameter. + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. /// /// - public SubmitAsyncSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(params System.Action>[] actions) { - SizeValue = size; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + /// + /// + /// If true, returns detailed information about score computation as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Explain(bool? value = true) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Explain = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext(System.Collections.Generic.IDictionary? value) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Ext = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Action> configure) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext() { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(ICollection? sort) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext(System.Action? action) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddExt(string key, object value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(Action> configure) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Fields = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(params Action>[] configure) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Fields = [.. values]; + return this; } /// /// - /// Indicates which source fields are returned for matching documents. These - /// fields are returned in the hits._source property of the search response. + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. /// /// - public SubmitAsyncSearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(params System.Action[] actions) { - SourceValue = source; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; } /// /// - /// Stats groups to associate with the search. Each group maintains a statistics - /// aggregation for its associated searches. You can retrieve these stats using - /// the indices stats API. + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. /// /// - public SubmitAsyncSearchRequestDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(params System.Action>[] actions) { - StatsValue = stats; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; } /// /// - /// List of stored fields to return as part of a hit. If no fields are specified, - /// no stored fields are included in the response. If this field is specified, the _source - /// parameter defaults to false. You can pass _source: true to return both source fields - /// and stored fields in the search response. + /// Starting document offset. By default, you cannot page through more than 10,000 + /// hits using the from and size parameters. To page through more hits, use the + /// search_after parameter. /// /// - public SubmitAsyncSearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor From(int? value) { - StoredFieldsValue = storedFields; - return Self; + Instance.From = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; + Instance.Highlight = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Highlight(System.Action action) { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Action> configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Highlight(System.Action> action) { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } /// /// - /// Maximum number of documents to collect for each shard. If a query reaches this - /// limit, Elasticsearch terminates the query early. Elasticsearch collects documents - /// before sorting. Defaults to 0, which does not terminate query execution early. + /// Boosts the _score of documents from specified indices. /// /// - public SubmitAsyncSearchRequestDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.IndicesBoost = value; + return this; } /// /// - /// Specifies the period of time to wait for a response from each shard. If no response - /// is received before the timeout expires, the request fails and returns an error. - /// Defaults to no timeout. + /// Boosts the _score of documents from specified indices. /// /// - public SubmitAsyncSearchRequestDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost() { - TimeoutValue = timeout; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; } /// /// - /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// Boosts the _score of documents from specified indices. /// /// - public SubmitAsyncSearchRequestDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost(System.Action? action) { - TrackScoresValue = trackScores; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) + { + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } /// /// - /// Number of hits matching the query to count accurately. If true, the exact - /// number of hits is returned at the cost of some performance. If false, the - /// response does not include the total number of hits matching the query. - /// Defaults to 10,000 hits. + /// Defines the approximate kNN search to run. /// /// - public SubmitAsyncSearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(System.Collections.Generic.ICollection? value) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.Knn = value; + return this; } /// /// - /// If true, returns document version as part of a hit. + /// Defines the approximate kNN search to run. /// /// - public SubmitAsyncSearchRequestDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) { - VersionValue = version; - return Self; + Instance.Knn = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Defines the approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(params System.Action[] actions) { - writer.WriteStartObject(); - if (AggregationsValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); } - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } + Instance.Knn = items; + return this; + } - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) + /// + /// + /// Defines the approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } + Instance.Knn = items; + return this; + } - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } + /// + /// + /// Minimum _score for matching documents. Documents with a lower _score are + /// not included in search results and results collected by aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } - if (ExtValue is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); - } + /// + /// + /// Limits the search to a point in time (PIT). If you provide a PIT, you + /// cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) + { + Instance.Pit = value; + return this; + } - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } + /// + /// + /// Limits the search to a point in time (PIT). If you provide a PIT, you + /// cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pit(System.Action action) + { + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; + } - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.PostFilter = value; + return this; + } - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor PostFilter(System.Action action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor PostFilter(System.Action> action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Profile(bool? value = true) + { + Instance.Profile = value; + return this; + } - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(System.Collections.Generic.ICollection? value) + { + Instance.Rescore = value; + return this; + } - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) + { + Instance.Rescore = [.. values]; + return this; + } - if (ProfileValue.HasValue) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Rescore = items; + return this; + } - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } + Instance.Rescore = items; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) + { + Instance.SearchAfter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.SearchAfter = [.. values]; + return this; + } + + /// + /// + /// If true, returns sequence number and primary term of the last modification + /// of each hit. See Optimistic concurrency control. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SeqNoPrimaryTerm(bool? value = true) + { + Instance.SeqNoPrimaryTerm = value; + return this; + } + + /// + /// + /// The number of hits to return. By default, you cannot page through more + /// than 10,000 hits using the from and size parameters. To page through more + /// hits, use the search_after parameter. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) + { + Instance.Slice = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Slice(System.Action action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Slice(System.Action> action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) + { + Instance.Sort = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - else if (SliceValue is not null) + + Instance.Sort = items; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } + + /// + /// + /// Indicates which source fields are returned for matching documents. These + /// fields are returned in the hits._source property of the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates which source fields are returned for matching documents. These + /// fields are returned in the hits._source property of the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Source(System.Func action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// Indicates which source fields are returned for matching documents. These + /// fields are returned in the hits._source property of the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// Stats groups to associate with the search. Each group maintains a statistics + /// aggregation for its associated searches. You can retrieve these stats using + /// the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// Stats groups to associate with the search. Each group maintains a statistics + /// aggregation for its associated searches. You can retrieve these stats using + /// the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// List of stored fields to return as part of a hit. If no fields are specified, + /// no stored fields are included in the response. If this field is specified, the _source + /// parameter defaults to false. You can pass _source: true to return both source fields + /// and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// List of stored fields to return as part of a hit. If no fields are specified, + /// no stored fields are included in the response. If this field is specified, the _source + /// parameter defaults to false. You can pass _source: true to return both source fields + /// and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) + { + Instance.Suggest = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest() + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest(System.Action? action) + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest(System.Action>? action) + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; + } + + /// + /// + /// Maximum number of documents to collect for each shard. If a query reaches this + /// limit, Elasticsearch terminates the query early. Elasticsearch collects documents + /// before sorting. Defaults to 0, which does not terminate query execution early. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// Specifies the period of time to wait for a response from each shard. If no response + /// is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Timeout(string? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackScores(bool? value = true) + { + Instance.TrackScores = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. If true, the exact + /// number of hits is returned at the cost of some performance. If false, the + /// response does not include the total number of hits matching the query. + /// Defaults to 10,000 hits. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) + { + Instance.TrackTotalHits = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. If true, the exact + /// number of hits is returned at the cost of some performance. If false, the + /// response does not include the total number of hits matching the query. + /// Defaults to 10,000 hits. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackTotalHits(System.Func action) + { + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; + } + + /// + /// + /// If true, returns document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Run an async search. +/// +/// +/// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. +/// +/// +/// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. +/// +/// +/// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. +/// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. +/// +/// +public readonly partial struct SubmitAsyncSearchRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest instance) + { + Instance = instance; + } + + public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(indices); + } + + public SubmitAsyncSearchRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest instance) => new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Indicate if an error should be returned if there is a partial search failure or timeout + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AllowPartialSearchResults(bool? value = true) + { + Instance.AllowPartialSearchResults = value; + return this; + } + + /// + /// + /// The analyzer to use for the query string + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// Specify whether wildcard and prefix queries should be analyzed (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// Affects how often partial results become available, which happens whenever shard results are reduced. + /// A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default). + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor BatchedReduceSize(long? value) + { + Instance.BatchedReduceSize = value; + return this; + } + + /// + /// + /// The default value is the only supported value. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } + + /// + /// + /// The default operator for query string query (AND or OR) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// The field to use as default where no field prefix is given in the query string + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Whether specified concrete, expanded or aliased indices should be ignored when throttled + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Specifies how long the async search needs to be available. + /// Ongoing async searches and any saved search results are deleted after this period. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.KeepAlive = value; + return this; + } + + /// + /// + /// If true, results are stored for later retrieval when the search completes within the wait_for_completion_timeout. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor KeepOnCompletion(bool? value = true) + { + Instance.KeepOnCompletion = value; + return this; + } + + /// + /// + /// Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor MaxConcurrentShardRequests(int? value) + { + Instance.MaxConcurrentShardRequests = value; + return this; + } + + /// + /// + /// Specify the node or shard the operation should be performed on (default: random) + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// Query in the Lucene query string syntax + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// Specify if request cache should be used for this request or not, defaults to true + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } + + /// + /// + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } + + /// + /// + /// A comma-separated list of specific routing values + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Search operation type + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + /// + /// + /// A list of fields to exclude from the returned _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + /// + /// + /// A list of fields to exclude from the returned _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } - if (StatsValue is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); - } + /// + /// + /// A list of fields to extract and return from the _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + /// + /// + /// A list of fields to extract and return from the _source field + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } + /// + /// + /// Specifies which field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.SuggestField = value; + return this; + } - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } + /// + /// + /// Specifies which field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestField(System.Linq.Expressions.Expression> value) + { + Instance.SuggestField = value; + return this; + } - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } + /// + /// + /// Specify suggest mode + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) + { + Instance.SuggestMode = value; + return this; + } - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } + /// + /// + /// How many suggestions to return in response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestSize(long? value) + { + Instance.SuggestSize = value; + return this; + } - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } + /// + /// + /// The source text for which the suggestions should be returned. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SuggestText(string? value) + { + Instance.SuggestText = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } + /// + /// + /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Blocks and waits until the search is completed up to a certain timeout. + /// When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; } -} -/// -/// -/// Run an async search. -/// -/// -/// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. -/// -/// -/// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. -/// -/// -/// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. -/// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. -/// -/// -public sealed partial class SubmitAsyncSearchRequestDescriptor : RequestDescriptor -{ - internal SubmitAsyncSearchRequestDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } - public SubmitAsyncSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations() { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } - public SubmitAsyncSearchRequestDescriptor() + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Aggregations(System.Action>? action) { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.AsyncSearchSubmit; + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } - internal override bool SupportsBody => true; + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) + { + Instance.Collapse = value; + return this; + } - internal override string OperationName => "async_search.submit"; + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Collapse(System.Action> action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } - public SubmitAsyncSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SubmitAsyncSearchRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public SubmitAsyncSearchRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public SubmitAsyncSearchRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public SubmitAsyncSearchRequestDescriptor BatchedReduceSize(long? batchedReduceSize) => Qs("batched_reduce_size", batchedReduceSize); - public SubmitAsyncSearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SubmitAsyncSearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public SubmitAsyncSearchRequestDescriptor Df(string? df) => Qs("df", df); - public SubmitAsyncSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SubmitAsyncSearchRequestDescriptor IgnoreThrottled(bool? ignoreThrottled = true) => Qs("ignore_throttled", ignoreThrottled); - public SubmitAsyncSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SubmitAsyncSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public SubmitAsyncSearchRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) => Qs("keep_on_completion", keepOnCompletion); - public SubmitAsyncSearchRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public SubmitAsyncSearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public SubmitAsyncSearchRequestDescriptor MinCompatibleShardNode(string? minCompatibleShardNode) => Qs("min_compatible_shard_node", minCompatibleShardNode); - public SubmitAsyncSearchRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SubmitAsyncSearchRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public SubmitAsyncSearchRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public SubmitAsyncSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SubmitAsyncSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SubmitAsyncSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SubmitAsyncSearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public SubmitAsyncSearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public SubmitAsyncSearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? suggestField) => Qs("suggest_field", suggestField); - public SubmitAsyncSearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) => Qs("suggest_mode", suggestMode); - public SubmitAsyncSearchRequestDescriptor SuggestSize(long? suggestSize) => Qs("suggest_size", suggestSize); - public SubmitAsyncSearchRequestDescriptor SuggestText(string? suggestText) => Qs("suggest_text", suggestText); - public SubmitAsyncSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public SubmitAsyncSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); - - public SubmitAsyncSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) - { - RouteValues.Optional("index", indices); - return Self; - } - - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action DocvalueFieldsDescriptorAction { get; set; } - private Action[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action KnnDescriptorAction { get; set; } - private Action[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action RescoreDescriptorAction { get; set; } - private Action[] RescoreDescriptorActions { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action SliceDescriptorAction { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } - - public SubmitAsyncSearchRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) - { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) - { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) - { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor Collapse(Action configure) - { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + /// + /// + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) + { + Instance.DocvalueFields = value; + return this; } /// @@ -2436,51 +2853,61 @@ public SubmitAsyncSearchRequestDescriptor Collapse(Action /// - public SubmitAsyncSearchRequestDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Array of wildcard (*) patterns. The request returns doc values for field + /// names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor DocvalueFields(params System.Action>[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(Action configure) + /// + /// + /// If true, returns detailed information about score computation as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Explain(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.Explain = value; + return this; } - public SubmitAsyncSearchRequestDescriptor DocvalueFields(params Action[] configure) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext(System.Collections.Generic.IDictionary? value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.Ext = value; + return this; } /// /// - /// If true, returns detailed information about score computation as part of a hit. + /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public SubmitAsyncSearchRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext() { - ExplainValue = explain; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -2488,10 +2915,17 @@ public SubmitAsyncSearchRequestDescriptor Explain(bool? explain = true) /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public SubmitAsyncSearchRequestDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Ext(System.Action? action) + { + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddExt(string key, object value) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; } /// @@ -2500,40 +2934,40 @@ public SubmitAsyncSearchRequestDescriptor Ext(Func /// - public SubmitAsyncSearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor Fields(Action configure) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public SubmitAsyncSearchRequestDescriptor Fields(params Action[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// @@ -2543,34 +2977,33 @@ public SubmitAsyncSearchRequestDescriptor Fields(params Action /// - public SubmitAsyncSearchRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.Highlight = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Highlight(System.Action> action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Highlight(Action configure) + /// + /// + /// Boosts the _score of documents from specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.IndicesBoost = value; + return this; } /// @@ -2578,63 +3011,91 @@ public SubmitAsyncSearchRequestDescriptor Highlight(Action /// - public SubmitAsyncSearchRequestDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost() { - IndicesBoostValue = indicesBoost; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; } /// /// - /// Defines the approximate kNN search to run. + /// Boosts the _score of documents from specified indices. /// /// - public SubmitAsyncSearchRequestDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor IndicesBoost(System.Action? action) + { + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) + /// + /// + /// Defines the approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(System.Collections.Generic.ICollection? value) { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; + Instance.Knn = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(Action configure) + /// + /// + /// Defines the approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; + Instance.Knn = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor Knn(params Action[] configure) + /// + /// + /// Defines the approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Knn(params System.Action>[] actions) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); + } + + Instance.Knn = items; + return this; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// not included in search results and results collected by aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } + + /// + /// + /// Limits the search to a point in time (PIT). If you provide a PIT, you + /// cannot specify an <index> in the request path. /// /// - public SubmitAsyncSearchRequestDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) { - MinScoreValue = minScore; - return Self; + Instance.Pit = value; + return this; } /// @@ -2643,135 +3104,160 @@ public SubmitAsyncSearchRequestDescriptor MinScore(double? minScore) /// cannot specify an <index> in the request path. /// /// - public SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pit(System.Action action) + { + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.PostFilter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor PostFilter(System.Action> action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Profile(bool? value = true) + { + Instance.Profile = value; + return this; + } + + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Query(System.Action> action) { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(System.Collections.Generic.ICollection? value) { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; + Instance.Rescore = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Pit(Action configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; + Instance.Rescore = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Rescore(params System.Action>[] actions) { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; - } - - public SubmitAsyncSearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); + } - public SubmitAsyncSearchRequestDescriptor PostFilter(Action configure) - { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.Rescore = items; + return this; } - public SubmitAsyncSearchRequestDescriptor Profile(bool? profile = true) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - ProfileValue = profile; - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Defines the search definition using the Query DSL. + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. /// /// - public SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings() { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } - public SubmitAsyncSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RuntimeMappings(System.Action>? action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(ICollection? rescore) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(Action configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public SubmitAsyncSearchRequestDescriptor Rescore(params Action[] configure) + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.ScriptFields = value; + return this; } /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public SubmitAsyncSearchRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields() { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; } /// @@ -2779,16 +3265,36 @@ public SubmitAsyncSearchRequestDescriptor RuntimeMappings(Func /// - public SubmitAsyncSearchRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor AddScriptField(string key, System.Action action) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } - public SubmitAsyncSearchRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.SearchAfter = [.. values]; + return this; } /// @@ -2797,10 +3303,10 @@ public SubmitAsyncSearchRequestDescriptor SearchAfter(ICollection /// - public SubmitAsyncSearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SeqNoPrimaryTerm(bool? value = true) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// @@ -2810,70 +3316,58 @@ public SubmitAsyncSearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTer /// hits, use the search_after parameter. /// /// - public SubmitAsyncSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Slice = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Slice(System.Action> action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public SubmitAsyncSearchRequestDescriptor Slice(Action configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = [.. values]; + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public SubmitAsyncSearchRequestDescriptor Sort(Action configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = items; + return this; } - public SubmitAsyncSearchRequestDescriptor Sort(params Action[] configure) + /// + /// + /// Indicates which source fields are returned for matching documents. These + /// fields are returned in the hits._source property of the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Source = value; + return this; } /// @@ -2882,10 +3376,23 @@ public SubmitAsyncSearchRequestDescriptor Sort(params Action /// - public SubmitAsyncSearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// Stats groups to associate with the search. Each group maintains a statistics + /// aggregation for its associated searches. You can retrieve these stats using + /// the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Stats(System.Collections.Generic.ICollection? value) { - SourceValue = source; - return Self; + Instance.Stats = value; + return this; } /// @@ -2895,10 +3402,24 @@ public SubmitAsyncSearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.C /// the indices stats API. /// /// - public SubmitAsyncSearchRequestDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// List of stored fields to return as part of a hit. If no fields are specified, + /// no stored fields are included in the response. If this field is specified, the _source + /// parameter defaults to false. You can pass _source: true to return both source fields + /// and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - StatsValue = stats; - return Self; + Instance.StoredFields = value; + return this; } /// @@ -2909,34 +3430,28 @@ public SubmitAsyncSearchRequestDescriptor Stats(ICollection? stats) /// and stored fields in the search response. /// /// - public SubmitAsyncSearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - StoredFieldsValue = storedFields; - return Self; + Instance.StoredFields = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; + Instance.Suggest = value; + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest() { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; } - public SubmitAsyncSearchRequestDescriptor Suggest(Action configure) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Suggest(System.Action>? action) { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; } /// @@ -2946,10 +3461,10 @@ public SubmitAsyncSearchRequestDescriptor Suggest(Action /// - public SubmitAsyncSearchRequestDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TerminateAfter(long? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.TerminateAfter = value; + return this; } /// @@ -2959,10 +3474,10 @@ public SubmitAsyncSearchRequestDescriptor TerminateAfter(long? terminateAfter) /// Defaults to no timeout. /// /// - public SubmitAsyncSearchRequestDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Timeout(string? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } /// @@ -2970,10 +3485,10 @@ public SubmitAsyncSearchRequestDescriptor Timeout(string? timeout) /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// - public SubmitAsyncSearchRequestDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackScores(bool? value = true) { - TrackScoresValue = trackScores; - return Self; + Instance.TrackScores = value; + return this; } /// @@ -2984,407 +3499,89 @@ public SubmitAsyncSearchRequestDescriptor TrackScores(bool? trackScores = true) /// Defaults to 10,000 hits. /// /// - public SubmitAsyncSearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.TrackTotalHits = value; + return this; } /// /// - /// If true, returns document version as part of a hit. + /// Number of hits matching the query to count accurately. If true, the exact + /// number of hits is returned at the cost of some performance. If false, the + /// response does not include the total number of hits matching the query. + /// Defaults to 10,000 hits. /// /// - public SubmitAsyncSearchRequestDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor TrackTotalHits(System.Func action) { - VersionValue = version; - return Self; + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, returns document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Version(bool? value = true) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } - - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (ExtValue is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } - - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } - - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } - - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } - - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); - } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } - - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + Instance.Version = value; + return this; + } - if (StatsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); + return new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchResponse.g.cs index 1eaf8d1c848..c61794f4dc4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/SubmitAsyncSearchResponse.g.cs @@ -17,39 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class SubmitAsyncSearchResponse : ElasticsearchResponse +internal sealed partial class SubmitAsyncSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { + private static readonly System.Text.Json.JsonEncodedText PropCompletionTime = System.Text.Json.JsonEncodedText.Encode("completion_time"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTimeInMillis = System.Text.Json.JsonEncodedText.Encode("completion_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTime = System.Text.Json.JsonEncodedText.Encode("expiration_time"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTimeInMillis = System.Text.Json.JsonEncodedText.Encode("expiration_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropResponse = System.Text.Json.JsonEncodedText.Encode("response"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompletionTime = default; + LocalJsonValue propCompletionTimeInMillis = default; + LocalJsonValue propExpirationTime = default; + LocalJsonValue propExpirationTimeInMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue> propResponse = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompletionTime.TryReadProperty(ref reader, options, PropCompletionTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCompletionTimeInMillis.TryReadProperty(ref reader, options, PropCompletionTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propExpirationTime.TryReadProperty(ref reader, options, PropExpirationTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExpirationTimeInMillis.TryReadProperty(ref reader, options, PropExpirationTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propResponse.TryReadProperty(ref reader, options, PropResponse, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompletionTime = propCompletionTime.Value, + CompletionTimeInMillis = propCompletionTimeInMillis.Value, + ExpirationTime = propExpirationTime.Value, + ExpirationTimeInMillis = propExpirationTimeInMillis.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + Response = propResponse.Value, + StartTime = propStartTime.Value, + StartTimeInMillis = propStartTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompletionTime, value.CompletionTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCompletionTimeInMillis, value.CompletionTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropExpirationTime, value.ExpirationTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExpirationTimeInMillis, value.ExpirationTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropResponse, value.Response, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class SubmitAsyncSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SubmitAsyncSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(SubmitAsyncSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponseConverterFactory))] +public sealed partial class SubmitAsyncSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SubmitAsyncSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SubmitAsyncSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// - /// Indicates when the async search completed. Only present - /// when the search has completed. + /// Indicates when the async search completed. + /// It is present only when the search has completed. /// /// - [JsonInclude, JsonPropertyName("completion_time")] - public DateTimeOffset? CompletionTime { get; init; } - [JsonInclude, JsonPropertyName("completion_time_in_millis")] - public long? CompletionTimeInMillis { get; init; } + public System.DateTimeOffset? CompletionTime { get; set; } + public System.DateTimeOffset? CompletionTimeInMillis { get; set; } /// /// /// Indicates when the async search will expire. /// /// - [JsonInclude, JsonPropertyName("expiration_time")] - public DateTimeOffset? ExpirationTime { get; init; } - [JsonInclude, JsonPropertyName("expiration_time_in_millis")] - public long ExpirationTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public System.DateTimeOffset? ExpirationTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpirationTimeInMillis { get; set; } + public string? Id { get; set; } /// /// @@ -57,21 +202,35 @@ public sealed partial class SubmitAsyncSearchResponse : Elasticsearch /// While the query is running, is_partial is always set to true. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// /// Indicates whether the search is still running or has completed. - /// NOTE: If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. + /// + /// + /// info + /// If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though is_running is false. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } - [JsonInclude, JsonPropertyName("response")] - public Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch Response { get; init; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch Response { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkRequest.g.cs index ef6467a0c3a..46ea213ae05 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkRequest.g.cs @@ -17,21 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class BulkRequestParameters : RequestParameters +public sealed partial class BulkRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// If true, the response will include the ingest pipelines that were run for each index or create. @@ -124,6 +124,35 @@ public sealed partial class BulkRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class BulkRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.BulkRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.BulkRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Bulk index or delete documents. @@ -314,30 +343,55 @@ public sealed partial class BulkRequestParameters : RequestParameters /// The other two shards that make up the index do not participate in the _bulk request at all. /// /// -public sealed partial class BulkRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.BulkRequestConverter))] +public partial class BulkRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + { + } +#if NET7_0_OR_GREATER public BulkRequest() { } - - public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) +#endif +#if !NET7_0_OR_GREATER + public BulkRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceBulk; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceBulk; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "bulk"; + /// + /// + /// The name of the data stream, index, or index alias to perform bulk actions on. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Index { get => P("index"); set => PO("index", value); } + + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// If true, the response will include the ingest pipelines that were run for each index or create. /// /// - [JsonIgnore] public bool? ListExecutedPipelines { get => Q("list_executed_pipelines"); set => Q("list_executed_pipelines", value); } /// @@ -347,7 +401,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// If a final pipeline is configured, it will always run regardless of the value of this parameter. /// /// - [JsonIgnore] public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } /// @@ -358,7 +411,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// Valid values: true, false, wait_for. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -366,7 +418,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// If true, the request's actions must target an index alias. /// /// - [JsonIgnore] public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } /// @@ -374,7 +425,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// If true, the request's actions must target a data stream (existing or to be created). /// /// - [JsonIgnore] public bool? RequireDataStream { get => Q("require_data_stream"); set => Q("require_data_stream", value); } /// @@ -382,7 +432,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -390,7 +439,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -400,7 +448,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -411,7 +458,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -421,7 +467,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -431,7 +476,6 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// The default is 1, which waits for each primary shard to be active. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -625,48 +669,288 @@ public BulkRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r /// The other two shards that make up the index do not participate in the _bulk request at all. /// /// -public sealed partial class BulkRequestDescriptor : RequestDescriptor, BulkRequestParameters> +public readonly partial struct BulkRequestDescriptor { - internal BulkRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.BulkRequest Instance { get; init; } - public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.BulkRequest instance) { + Instance = instance; } - public BulkRequestDescriptor() : this(typeof(TDocument)) + public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.BulkRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceBulk; + public BulkRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.BulkRequestDescriptor(Elastic.Clients.Elasticsearch.BulkRequest instance) => new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.BulkRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The name of the data stream, index, or index alias to perform bulk actions on. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "bulk"; + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor IncludeSourceOnError(bool? value = true) + { + Instance.IncludeSourceOnError = value; + return this; + } - public BulkRequestDescriptor ListExecutedPipelines(bool? listExecutedPipelines = true) => Qs("list_executed_pipelines", listExecutedPipelines); - public BulkRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public BulkRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public BulkRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public BulkRequestDescriptor RequireDataStream(bool? requireDataStream = true) => Qs("require_data_stream", requireDataStream); - public BulkRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public BulkRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public BulkRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public BulkRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public BulkRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public BulkRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// If true, the response will include the ingest pipelines that were run for each index or create. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor ListExecutedPipelines(bool? value = true) + { + Instance.ListExecutedPipelines = value; + return this; + } - public BulkRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// The pipeline identifier to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, setting the value to _none turns off the default ingest pipeline for this request. + /// If a final pipeline is configured, it will always run regardless of the value of this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Pipeline(string? value) { - RouteValues.Optional("index", index); - return Self; + Instance.Pipeline = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, wait for a refresh to make this operation visible to search. + /// If false, do nothing with refreshes. + /// Valid values: true, false, wait_for. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance.Refresh = value; + return this; + } + + /// + /// + /// If true, the request's actions must target an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequireAlias(bool? value = true) + { + Instance.RequireAlias = value; + return this; + } + + /// + /// + /// If true, the request's actions must target a data stream (existing or to be created). + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequireDataStream(bool? value = true) + { + Instance.RequireDataStream = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Source(System.Func action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. + /// The default is 1m (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default is 1, which waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.BulkRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -860,47 +1144,276 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The other two shards that make up the index do not participate in the _bulk request at all. /// /// -public sealed partial class BulkRequestDescriptor : RequestDescriptor +public readonly partial struct BulkRequestDescriptor { - internal BulkRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.BulkRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.BulkRequest instance) + { + Instance = instance; + } - public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + public BulkRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.BulkRequest(index); } public BulkRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.BulkRequest(typeof(TDocument)); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceBulk; + public static explicit operator Elastic.Clients.Elasticsearch.BulkRequestDescriptor(Elastic.Clients.Elasticsearch.BulkRequest instance) => new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.BulkRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The name of the data stream, index, or index alias to perform bulk actions on. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor IncludeSourceOnError(bool? value = true) + { + Instance.IncludeSourceOnError = value; + return this; + } - internal override string OperationName => "bulk"; + /// + /// + /// If true, the response will include the ingest pipelines that were run for each index or create. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor ListExecutedPipelines(bool? value = true) + { + Instance.ListExecutedPipelines = value; + return this; + } - public BulkRequestDescriptor ListExecutedPipelines(bool? listExecutedPipelines = true) => Qs("list_executed_pipelines", listExecutedPipelines); - public BulkRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public BulkRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public BulkRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public BulkRequestDescriptor RequireDataStream(bool? requireDataStream = true) => Qs("require_data_stream", requireDataStream); - public BulkRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public BulkRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public BulkRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public BulkRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public BulkRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public BulkRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// The pipeline identifier to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, setting the value to _none turns off the default ingest pipeline for this request. + /// If a final pipeline is configured, it will always run regardless of the value of this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Pipeline(string? value) + { + Instance.Pipeline = value; + return this; + } - public BulkRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, wait for a refresh to make this operation visible to search. + /// If false, do nothing with refreshes. + /// Valid values: true, false, wait_for. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) { - RouteValues.Optional("index", index); - return Self; + Instance.Refresh = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the request's actions must target an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequireAlias(bool? value = true) { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance.RequireAlias = value; + return this; + } + + /// + /// + /// If true, the request's actions must target a data stream (existing or to be created). + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequireDataStream(bool? value = true) + { + Instance.RequireDataStream = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or contains a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. + /// The default is 1m (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default is 1, which waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.BulkRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(new Elastic.Clients.Elasticsearch.BulkRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.BulkRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkResponse.g.cs index 9bb66902b31..366c541b6dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/BulkResponse.g.cs @@ -17,32 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class BulkResponse : ElasticsearchResponse +internal sealed partial class BulkResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropIngestTook = System.Text.Json.JsonEncodedText.Encode("ingest_took"); + private static readonly System.Text.Json.JsonEncodedText PropItems = System.Text.Json.JsonEncodedText.Encode("items"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.BulkResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrors = default; + LocalJsonValue propIngestTook = default; + LocalJsonValue> propItems = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propIngestTook.TryReadProperty(ref reader, options, PropIngestTook, null)) + { + continue; + } + + if (propItems.TryReadProperty(ref reader, options, PropItems, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.BulkResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Errors = propErrors.Value, + IngestTook = propIngestTook.Value, + Items = propItems.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.BulkResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropIngestTook, value.IngestTook, null, null); + writer.WriteProperty(options, PropItems, value.Items, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.BulkResponseConverter))] +public partial class BulkResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, one or more of the operations in the bulk request did not complete successfully. /// /// - [JsonInclude, JsonPropertyName("errors")] - public bool Errors { get; init; } - [JsonInclude, JsonPropertyName("ingest_took")] - public long? IngestTook { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Errors { get; set; } + public long? IngestTook { get; set; } + + /// + /// + /// The result of each operation in the bulk request, in the order they were submitted. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Items { get; set; } /// /// /// The length of time, in milliseconds, it took to process the bulk request. /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollRequest.g.cs index 1399f8ad99c..d12e46cd088 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollRequest.g.cs @@ -17,34 +17,83 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ClearScrollRequestParameters : RequestParameters +public sealed partial class ClearScrollRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ClearScrollRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("scroll_id"); + + public override Elastic.Clients.Elasticsearch.ClearScrollRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScrollId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClearScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ScrollId = propScrollId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClearScrollRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Clear a scrolling search. /// Clear the search context and results for a scrolling search. /// /// -public sealed partial class ClearScrollRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClearScrollRequestConverter))] +public sealed partial class ClearScrollRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClearScroll; +#if NET7_0_OR_GREATER + public ClearScrollRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClearScrollRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceClearScroll; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; @@ -56,7 +105,6 @@ public sealed partial class ClearScrollRequest : PlainRequest_all. /// /// - [JsonInclude, JsonPropertyName("scroll_id")] public Elastic.Clients.Elasticsearch.ScrollIds? ScrollId { get; set; } } @@ -66,23 +114,23 @@ public sealed partial class ClearScrollRequest : PlainRequest /// -public sealed partial class ClearScrollRequestDescriptor : RequestDescriptor +public readonly partial struct ClearScrollRequestDescriptor { - internal ClearScrollRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ClearScrollRequest Instance { get; init; } - public ClearScrollRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearScrollRequestDescriptor(Elastic.Clients.Elasticsearch.ClearScrollRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClearScroll; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; - - internal override string OperationName => "clear_scroll"; + public ClearScrollRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ClearScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.ScrollIds? ScrollIdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(Elastic.Clients.Elasticsearch.ClearScrollRequest instance) => new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ClearScrollRequest(Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -90,21 +138,64 @@ public ClearScrollRequestDescriptor() /// To clear all scroll IDs, use _all. /// /// - public ClearScrollRequestDescriptor ScrollId(Elastic.Clients.Elasticsearch.ScrollIds? scrollId) + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor ScrollId(Elastic.Clients.Elasticsearch.ScrollIds? value) { - ScrollIdValue = scrollId; - return Self; + Instance.ScrollId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ClearScrollRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (ScrollIdValue is not null) + if (action is null) { - writer.WritePropertyName("scroll_id"); - JsonSerializer.Serialize(writer, ScrollIdValue, options); + return new Elastic.Clients.Elasticsearch.ClearScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(new Elastic.Clients.Elasticsearch.ClearScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollResponse.g.cs index 09f12a13975..23428595c6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClearScrollResponse.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ClearScrollResponse : ElasticsearchResponse +internal sealed partial class ClearScrollResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumFreed = System.Text.Json.JsonEncodedText.Encode("num_freed"); + private static readonly System.Text.Json.JsonEncodedText PropSucceeded = System.Text.Json.JsonEncodedText.Encode("succeeded"); + + public override Elastic.Clients.Elasticsearch.ClearScrollResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumFreed = default; + LocalJsonValue propSucceeded = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumFreed.TryReadProperty(ref reader, options, PropNumFreed, null)) + { + continue; + } + + if (propSucceeded.TryReadProperty(ref reader, options, PropSucceeded, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClearScrollResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumFreed = propNumFreed.Value, + Succeeded = propSucceeded.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClearScrollResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumFreed, value.NumFreed, null, null); + writer.WriteProperty(options, PropSucceeded, value.Succeeded, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClearScrollResponseConverter))] +public sealed partial class ClearScrollResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearScrollResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearScrollResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of scrolling search requests cleared. /// /// - [JsonInclude, JsonPropertyName("num_freed")] - public int NumFreed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumFreed { get; set; } /// /// @@ -42,6 +102,9 @@ public sealed partial class ClearScrollResponse : ElasticsearchResponse /// This does not indicate whether any scrolling search requests were cleared. /// /// - [JsonInclude, JsonPropertyName("succeeded")] - public bool Succeeded { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Succeeded { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeRequest.g.cs index 72511ba0d11..0b5a601afbd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeRequest.g.cs @@ -17,23 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ClosePointInTimeRequestParameters : RequestParameters +public sealed partial class ClosePointInTimeRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ClosePointInTimeRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + + public override Elastic.Clients.Elasticsearch.ClosePointInTimeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClosePointInTimeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Close a point in time. @@ -43,11 +75,34 @@ public sealed partial class ClosePointInTimeRequestParameters : RequestParameter /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. /// /// -public sealed partial class ClosePointInTimeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClosePointInTimeRequestConverter))] +public sealed partial class ClosePointInTimeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClosePointInTime; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.Id id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public ClosePointInTimeRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClosePointInTimeRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceClosePointInTime; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; @@ -58,8 +113,11 @@ public sealed partial class ClosePointInTimeRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } } /// @@ -71,40 +129,82 @@ public sealed partial class ClosePointInTimeRequest : PlainRequest /// -public sealed partial class ClosePointInTimeRequestDescriptor : RequestDescriptor +public readonly partial struct ClosePointInTimeRequestDescriptor { - internal ClosePointInTimeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ClosePointInTimeRequest Instance { get; init; } - public ClosePointInTimeRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClosePointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.ClosePointInTimeRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClosePointInTime; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; - - internal override string OperationName => "close_point_in_time"; + public ClosePointInTimeRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.ClosePointInTimeRequest instance) => new Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The ID of the point-in-time. /// /// - public ClosePointInTimeRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ClosePointInTimeRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor(new Elastic.Clients.Elasticsearch.ClosePointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeResponse.g.cs index da1514d5bcc..758ab425680 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ClosePointInTimeResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ClosePointInTimeResponse : ElasticsearchResponse +internal sealed partial class ClosePointInTimeResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumFreed = System.Text.Json.JsonEncodedText.Encode("num_freed"); + private static readonly System.Text.Json.JsonEncodedText PropSucceeded = System.Text.Json.JsonEncodedText.Encode("succeeded"); + + public override Elastic.Clients.Elasticsearch.ClosePointInTimeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumFreed = default; + LocalJsonValue propSucceeded = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumFreed.TryReadProperty(ref reader, options, PropNumFreed, null)) + { + continue; + } + + if (propSucceeded.TryReadProperty(ref reader, options, PropSucceeded, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClosePointInTimeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumFreed = propNumFreed.Value, + Succeeded = propSucceeded.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClosePointInTimeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumFreed, value.NumFreed, null, null); + writer.WriteProperty(options, PropSucceeded, value.Succeeded, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClosePointInTimeResponseConverter))] +public sealed partial class ClosePointInTimeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClosePointInTimeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClosePointInTimeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of search contexts that were successfully closed. /// /// - [JsonInclude, JsonPropertyName("num_freed")] - public int NumFreed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumFreed { get; set; } /// /// /// If true, all search contexts associated with the point-in-time ID were successfully closed. /// /// - [JsonInclude, JsonPropertyName("succeeded")] - public bool Succeeded { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Succeeded { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainRequest.g.cs index 23e668b1bcd..5e9716147d5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class AllocationExplainRequestParameters : RequestParameters +public sealed partial class AllocationExplainRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -45,6 +38,79 @@ public sealed partial class AllocationExplainRequestParameters : RequestParamete /// /// public bool? IncludeYesDecisions { get => Q("include_yes_decisions"); set => Q("include_yes_decisions", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class AllocationExplainRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentNode = System.Text.Json.JsonEncodedText.Encode("current_node"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropShard = System.Text.Json.JsonEncodedText.Encode("shard"); + + public override Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentNode = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propShard = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentNode.TryReadProperty(ref reader, options, PropCurrentNode, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propShard.TryReadProperty(ref reader, options, PropShard, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentNode = propCurrentNode.Value, + Index = propIndex.Value, + Primary = propPrimary.Value, + Shard = propShard.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentNode, value.CurrentNode, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropShard, value.Shard, null, null); + writer.WriteEndObject(); + } } /// @@ -56,11 +122,28 @@ public sealed partial class AllocationExplainRequestParameters : RequestParamete /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. /// /// -public sealed partial class AllocationExplainRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestConverter))] +public sealed partial class AllocationExplainRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain; +#if NET7_0_OR_GREATER + public AllocationExplainRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public AllocationExplainRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllocationExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterAllocationExplain; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -71,7 +154,6 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// - [JsonIgnore] public bool? IncludeDiskInfo { get => Q("include_disk_info"); set => Q("include_disk_info", value); } /// @@ -79,15 +161,20 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// - [JsonIgnore] public bool? IncludeYesDecisions { get => Q("include_yes_decisions"); set => Q("include_yes_decisions", value); } + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. /// /// - [JsonInclude, JsonPropertyName("current_node")] public string? CurrentNode { get; set; } /// @@ -95,7 +182,6 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -103,7 +189,6 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("primary")] public bool? Primary { get; set; } /// @@ -111,7 +196,6 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("shard")] public int? Shard { get; set; } } @@ -124,39 +208,66 @@ public sealed partial class AllocationExplainRequest : PlainRequest /// -public sealed partial class AllocationExplainRequestDescriptor : RequestDescriptor +public readonly partial struct AllocationExplainRequestDescriptor { - internal AllocationExplainRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest Instance { get; init; } - public AllocationExplainRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocationExplainRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterAllocationExplain; + public AllocationExplainRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; - - internal override string OperationName => "cluster.allocation_explain"; + /// + /// + /// If true, returns information about disk usage and shard sizes. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor IncludeDiskInfo(bool? value = true) + { + Instance.IncludeDiskInfo = value; + return this; + } - public AllocationExplainRequestDescriptor IncludeDiskInfo(bool? includeDiskInfo = true) => Qs("include_disk_info", includeDiskInfo); - public AllocationExplainRequestDescriptor IncludeYesDecisions(bool? includeYesDecisions = true) => Qs("include_yes_decisions", includeYesDecisions); + /// + /// + /// If true, returns YES decisions in explanation. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor IncludeYesDecisions(bool? value = true) + { + Instance.IncludeYesDecisions = value; + return this; + } - private string? CurrentNodeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private bool? PrimaryValue { get; set; } - private int? ShardValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// /// Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. /// /// - public AllocationExplainRequestDescriptor CurrentNode(string? currentNode) + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor CurrentNode(string? value) { - CurrentNodeValue = currentNode; - return Self; + Instance.CurrentNode = value; + return this; } /// @@ -164,10 +275,10 @@ public AllocationExplainRequestDescriptor CurrentNode(string? currentNode) /// Specifies the name of the index that you would like an explanation for. /// /// - public AllocationExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -175,10 +286,10 @@ public AllocationExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.In /// If true, returns explanation for the primary shard for the given shard ID. /// /// - public AllocationExplainRequestDescriptor Primary(bool? primary = true) + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor Primary(bool? value = true) { - PrimaryValue = primary; - return Self; + Instance.Primary = value; + return this; } /// @@ -186,39 +297,64 @@ public AllocationExplainRequestDescriptor Primary(bool? primary = true) /// Specifies the ID of the shard that you would like an explanation for. /// /// - public AllocationExplainRequestDescriptor Shard(int? shard) + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor Shard(int? value) { - ShardValue = shard; - return Self; + Instance.Shard = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CurrentNodeValue)) + if (action is null) { - writer.WritePropertyName("current_node"); - writer.WriteStringValue(CurrentNodeValue); + return new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (PrimaryValue.HasValue) - { - writer.WritePropertyName("primary"); - writer.WriteBooleanValue(PrimaryValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ShardValue.HasValue) - { - writer.WritePropertyName("shard"); - writer.WriteNumberValue(ShardValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainResponse.g.cs index a17abac6f3c..3e6df5c86a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/AllocationExplainResponse.g.cs @@ -17,65 +17,320 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class AllocationExplainResponse : ElasticsearchResponse +internal sealed partial class AllocationExplainResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("allocate_explanation")] - public string? AllocateExplanation { get; init; } - [JsonInclude, JsonPropertyName("allocation_delay")] - public Elastic.Clients.Elasticsearch.Duration? AllocationDelay { get; init; } - [JsonInclude, JsonPropertyName("allocation_delay_in_millis")] - public long? AllocationDelayInMillis { get; init; } - [JsonInclude, JsonPropertyName("can_allocate")] - public Elastic.Clients.Elasticsearch.Cluster.Decision? CanAllocate { get; init; } - [JsonInclude, JsonPropertyName("can_move_to_other_node")] - public Elastic.Clients.Elasticsearch.Cluster.Decision? CanMoveToOtherNode { get; init; } - [JsonInclude, JsonPropertyName("can_rebalance_cluster")] - public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceCluster { get; init; } - [JsonInclude, JsonPropertyName("can_rebalance_cluster_decisions")] - public IReadOnlyCollection? CanRebalanceClusterDecisions { get; init; } - [JsonInclude, JsonPropertyName("can_rebalance_to_other_node")] - public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceToOtherNode { get; init; } - [JsonInclude, JsonPropertyName("can_remain_decisions")] - public IReadOnlyCollection? CanRemainDecisions { get; init; } - [JsonInclude, JsonPropertyName("can_remain_on_current_node")] - public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRemainOnCurrentNode { get; init; } - [JsonInclude, JsonPropertyName("cluster_info")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterInfo? ClusterInfo { get; init; } - [JsonInclude, JsonPropertyName("configured_delay")] - public Elastic.Clients.Elasticsearch.Duration? ConfiguredDelay { get; init; } - [JsonInclude, JsonPropertyName("configured_delay_in_millis")] - public long? ConfiguredDelayInMillis { get; init; } - [JsonInclude, JsonPropertyName("current_node")] - public Elastic.Clients.Elasticsearch.Cluster.CurrentNode? CurrentNode { get; init; } - [JsonInclude, JsonPropertyName("current_state")] - public string CurrentState { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("move_explanation")] - public string? MoveExplanation { get; init; } - [JsonInclude, JsonPropertyName("node_allocation_decisions")] - public IReadOnlyCollection? NodeAllocationDecisions { get; init; } - [JsonInclude, JsonPropertyName("note")] - public string? Note { get; init; } - [JsonInclude, JsonPropertyName("primary")] - public bool Primary { get; init; } - [JsonInclude, JsonPropertyName("rebalance_explanation")] - public string? RebalanceExplanation { get; init; } - [JsonInclude, JsonPropertyName("remaining_delay")] - public Elastic.Clients.Elasticsearch.Duration? RemainingDelay { get; init; } - [JsonInclude, JsonPropertyName("remaining_delay_in_millis")] - public long? RemainingDelayInMillis { get; init; } - [JsonInclude, JsonPropertyName("shard")] - public int Shard { get; init; } - [JsonInclude, JsonPropertyName("unassigned_info")] - public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAllocateExplanation = System.Text.Json.JsonEncodedText.Encode("allocate_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropAllocationDelay = System.Text.Json.JsonEncodedText.Encode("allocation_delay"); + private static readonly System.Text.Json.JsonEncodedText PropAllocationDelayInMillis = System.Text.Json.JsonEncodedText.Encode("allocation_delay_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropCanAllocate = System.Text.Json.JsonEncodedText.Encode("can_allocate"); + private static readonly System.Text.Json.JsonEncodedText PropCanMoveToOtherNode = System.Text.Json.JsonEncodedText.Encode("can_move_to_other_node"); + private static readonly System.Text.Json.JsonEncodedText PropCanRebalanceCluster = System.Text.Json.JsonEncodedText.Encode("can_rebalance_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropCanRebalanceClusterDecisions = System.Text.Json.JsonEncodedText.Encode("can_rebalance_cluster_decisions"); + private static readonly System.Text.Json.JsonEncodedText PropCanRebalanceToOtherNode = System.Text.Json.JsonEncodedText.Encode("can_rebalance_to_other_node"); + private static readonly System.Text.Json.JsonEncodedText PropCanRemainDecisions = System.Text.Json.JsonEncodedText.Encode("can_remain_decisions"); + private static readonly System.Text.Json.JsonEncodedText PropCanRemainOnCurrentNode = System.Text.Json.JsonEncodedText.Encode("can_remain_on_current_node"); + private static readonly System.Text.Json.JsonEncodedText PropClusterInfo = System.Text.Json.JsonEncodedText.Encode("cluster_info"); + private static readonly System.Text.Json.JsonEncodedText PropConfiguredDelay = System.Text.Json.JsonEncodedText.Encode("configured_delay"); + private static readonly System.Text.Json.JsonEncodedText PropConfiguredDelayInMillis = System.Text.Json.JsonEncodedText.Encode("configured_delay_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentNode = System.Text.Json.JsonEncodedText.Encode("current_node"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentState = System.Text.Json.JsonEncodedText.Encode("current_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMoveExplanation = System.Text.Json.JsonEncodedText.Encode("move_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropNodeAllocationDecisions = System.Text.Json.JsonEncodedText.Encode("node_allocation_decisions"); + private static readonly System.Text.Json.JsonEncodedText PropNote = System.Text.Json.JsonEncodedText.Encode("note"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropRebalanceExplanation = System.Text.Json.JsonEncodedText.Encode("rebalance_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropRemainingDelay = System.Text.Json.JsonEncodedText.Encode("remaining_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRemainingDelayInMillis = System.Text.Json.JsonEncodedText.Encode("remaining_delay_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropShard = System.Text.Json.JsonEncodedText.Encode("shard"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedInfo = System.Text.Json.JsonEncodedText.Encode("unassigned_info"); + + public override Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocateExplanation = default; + LocalJsonValue propAllocationDelay = default; + LocalJsonValue propAllocationDelayInMillis = default; + LocalJsonValue propCanAllocate = default; + LocalJsonValue propCanMoveToOtherNode = default; + LocalJsonValue propCanRebalanceCluster = default; + LocalJsonValue?> propCanRebalanceClusterDecisions = default; + LocalJsonValue propCanRebalanceToOtherNode = default; + LocalJsonValue?> propCanRemainDecisions = default; + LocalJsonValue propCanRemainOnCurrentNode = default; + LocalJsonValue propClusterInfo = default; + LocalJsonValue propConfiguredDelay = default; + LocalJsonValue propConfiguredDelayInMillis = default; + LocalJsonValue propCurrentNode = default; + LocalJsonValue propCurrentState = default; + LocalJsonValue propIndex = default; + LocalJsonValue propMoveExplanation = default; + LocalJsonValue?> propNodeAllocationDecisions = default; + LocalJsonValue propNote = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propRebalanceExplanation = default; + LocalJsonValue propRemainingDelay = default; + LocalJsonValue propRemainingDelayInMillis = default; + LocalJsonValue propShard = default; + LocalJsonValue propUnassignedInfo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocateExplanation.TryReadProperty(ref reader, options, PropAllocateExplanation, null)) + { + continue; + } + + if (propAllocationDelay.TryReadProperty(ref reader, options, PropAllocationDelay, null)) + { + continue; + } + + if (propAllocationDelayInMillis.TryReadProperty(ref reader, options, PropAllocationDelayInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propCanAllocate.TryReadProperty(ref reader, options, PropCanAllocate, null)) + { + continue; + } + + if (propCanMoveToOtherNode.TryReadProperty(ref reader, options, PropCanMoveToOtherNode, null)) + { + continue; + } + + if (propCanRebalanceCluster.TryReadProperty(ref reader, options, PropCanRebalanceCluster, null)) + { + continue; + } + + if (propCanRebalanceClusterDecisions.TryReadProperty(ref reader, options, PropCanRebalanceClusterDecisions, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCanRebalanceToOtherNode.TryReadProperty(ref reader, options, PropCanRebalanceToOtherNode, null)) + { + continue; + } + + if (propCanRemainDecisions.TryReadProperty(ref reader, options, PropCanRemainDecisions, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCanRemainOnCurrentNode.TryReadProperty(ref reader, options, PropCanRemainOnCurrentNode, null)) + { + continue; + } + + if (propClusterInfo.TryReadProperty(ref reader, options, PropClusterInfo, null)) + { + continue; + } + + if (propConfiguredDelay.TryReadProperty(ref reader, options, PropConfiguredDelay, null)) + { + continue; + } + + if (propConfiguredDelayInMillis.TryReadProperty(ref reader, options, PropConfiguredDelayInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propCurrentNode.TryReadProperty(ref reader, options, PropCurrentNode, null)) + { + continue; + } + + if (propCurrentState.TryReadProperty(ref reader, options, PropCurrentState, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMoveExplanation.TryReadProperty(ref reader, options, PropMoveExplanation, null)) + { + continue; + } + + if (propNodeAllocationDecisions.TryReadProperty(ref reader, options, PropNodeAllocationDecisions, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNote.TryReadProperty(ref reader, options, PropNote, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propRebalanceExplanation.TryReadProperty(ref reader, options, PropRebalanceExplanation, null)) + { + continue; + } + + if (propRemainingDelay.TryReadProperty(ref reader, options, PropRemainingDelay, null)) + { + continue; + } + + if (propRemainingDelayInMillis.TryReadProperty(ref reader, options, PropRemainingDelayInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propShard.TryReadProperty(ref reader, options, PropShard, null)) + { + continue; + } + + if (propUnassignedInfo.TryReadProperty(ref reader, options, PropUnassignedInfo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocateExplanation = propAllocateExplanation.Value, + AllocationDelay = propAllocationDelay.Value, + AllocationDelayInMillis = propAllocationDelayInMillis.Value, + CanAllocate = propCanAllocate.Value, + CanMoveToOtherNode = propCanMoveToOtherNode.Value, + CanRebalanceCluster = propCanRebalanceCluster.Value, + CanRebalanceClusterDecisions = propCanRebalanceClusterDecisions.Value, + CanRebalanceToOtherNode = propCanRebalanceToOtherNode.Value, + CanRemainDecisions = propCanRemainDecisions.Value, + CanRemainOnCurrentNode = propCanRemainOnCurrentNode.Value, + ClusterInfo = propClusterInfo.Value, + ConfiguredDelay = propConfiguredDelay.Value, + ConfiguredDelayInMillis = propConfiguredDelayInMillis.Value, + CurrentNode = propCurrentNode.Value, + CurrentState = propCurrentState.Value, + Index = propIndex.Value, + MoveExplanation = propMoveExplanation.Value, + NodeAllocationDecisions = propNodeAllocationDecisions.Value, + Note = propNote.Value, + Primary = propPrimary.Value, + RebalanceExplanation = propRebalanceExplanation.Value, + RemainingDelay = propRemainingDelay.Value, + RemainingDelayInMillis = propRemainingDelayInMillis.Value, + Shard = propShard.Value, + UnassignedInfo = propUnassignedInfo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocateExplanation, value.AllocateExplanation, null, null); + writer.WriteProperty(options, PropAllocationDelay, value.AllocationDelay, null, null); + writer.WriteProperty(options, PropAllocationDelayInMillis, value.AllocationDelayInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropCanAllocate, value.CanAllocate, null, null); + writer.WriteProperty(options, PropCanMoveToOtherNode, value.CanMoveToOtherNode, null, null); + writer.WriteProperty(options, PropCanRebalanceCluster, value.CanRebalanceCluster, null, null); + writer.WriteProperty(options, PropCanRebalanceClusterDecisions, value.CanRebalanceClusterDecisions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCanRebalanceToOtherNode, value.CanRebalanceToOtherNode, null, null); + writer.WriteProperty(options, PropCanRemainDecisions, value.CanRemainDecisions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCanRemainOnCurrentNode, value.CanRemainOnCurrentNode, null, null); + writer.WriteProperty(options, PropClusterInfo, value.ClusterInfo, null, null); + writer.WriteProperty(options, PropConfiguredDelay, value.ConfiguredDelay, null, null); + writer.WriteProperty(options, PropConfiguredDelayInMillis, value.ConfiguredDelayInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropCurrentNode, value.CurrentNode, null, null); + writer.WriteProperty(options, PropCurrentState, value.CurrentState, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMoveExplanation, value.MoveExplanation, null, null); + writer.WriteProperty(options, PropNodeAllocationDecisions, value.NodeAllocationDecisions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNote, value.Note, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropRebalanceExplanation, value.RebalanceExplanation, null, null); + writer.WriteProperty(options, PropRemainingDelay, value.RemainingDelay, null, null); + writer.WriteProperty(options, PropRemainingDelayInMillis, value.RemainingDelayInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropShard, value.Shard, null, null); + writer.WriteProperty(options, PropUnassignedInfo, value.UnassignedInfo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponseConverter))] +public sealed partial class AllocationExplainResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocationExplainResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllocationExplainResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? AllocateExplanation { get; set; } + public Elastic.Clients.Elasticsearch.Duration? AllocationDelay { get; set; } + public System.TimeSpan? AllocationDelayInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.Decision? CanAllocate { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.Decision? CanMoveToOtherNode { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceCluster { get; set; } + public System.Collections.Generic.IReadOnlyCollection? CanRebalanceClusterDecisions { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRebalanceToOtherNode { get; set; } + public System.Collections.Generic.IReadOnlyCollection? CanRemainDecisions { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.Decision? CanRemainOnCurrentNode { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfo? ClusterInfo { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ConfiguredDelay { get; set; } + public System.TimeSpan? ConfiguredDelayInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.CurrentNode? CurrentNode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string CurrentState { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public string? MoveExplanation { get; set; } + public System.Collections.Generic.IReadOnlyCollection? NodeAllocationDecisions { get; set; } + public string? Note { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Primary { get; set; } + public string? RebalanceExplanation { get; set; } + public Elastic.Clients.Elasticsearch.Duration? RemainingDelay { get; set; } + public System.TimeSpan? RemainingDelayInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Shard { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoRequest.g.cs index 64573f02d86..2ebeabf06a9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoRequest.g.cs @@ -17,42 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ClusterInfoRequestParameters : RequestParameters +public sealed partial class ClusterInfoRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ClusterInfoRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get cluster info. /// Returns basic information about the cluster. /// /// -public sealed partial class ClusterInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestConverter))] +public sealed partial class ClusterInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public ClusterInfoRequest(IReadOnlyCollection target) : base(r => r.Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterInfoRequest(System.Collections.Generic.ICollection target) : base(r => r.Required("target", target)) + { + } +#if NET7_0_OR_GREATER + public ClusterInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterInfo; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "cluster.info"; + + /// + /// + /// Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Target { get => P>("target"); set => PR("target", value); } } /// @@ -61,29 +106,99 @@ public ClusterInfoRequest(IReadOnlyCollection /// -public sealed partial class ClusterInfoRequestDescriptor : RequestDescriptor +public readonly partial struct ClusterInfoRequestDescriptor { - internal ClusterInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest Instance { get; init; } - public ClusterInfoRequestDescriptor(IReadOnlyCollection target) : base(r => r.Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterInfo; + public ClusterInfoRequestDescriptor(System.Collections.Generic.ICollection target) + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest(target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClusterInfoRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "cluster.info"; + /// + /// + /// Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor Target(System.Collections.Generic.ICollection value) + { + Instance.Target = value; + return this; + } + + /// + /// + /// Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor Target(params Elastic.Clients.Elasticsearch.ClusterInfoTarget[] values) + { + Instance.Target = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClusterInfoRequestDescriptor Target(IReadOnlyCollection target) + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("target", target); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoResponse.g.cs index 3a0c28fa600..8b21c9c519e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterInfoResponse.g.cs @@ -17,25 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ClusterInfoResponse : ElasticsearchResponse +internal sealed partial class ClusterInfoResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Nodes.Http? Http { get; init; } - [JsonInclude, JsonPropertyName("ingest")] - public Elastic.Clients.Elasticsearch.Nodes.Ingest? Ingest { get; init; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Nodes.Scripting? Script { get; init; } - [JsonInclude, JsonPropertyName("thread_pool")] - public IReadOnlyDictionary? ThreadPool { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropThreadPool = System.Text.Json.JsonEncodedText.Encode("thread_pool"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue propHttp = default; + LocalJsonValue propIngest = default; + LocalJsonValue propScript = default; + LocalJsonValue?> propThreadPool = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propThreadPool.TryReadProperty(ref reader, options, PropThreadPool, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Http = propHttp.Value, + Ingest = propIngest.Value, + Script = propScript.Value, + ThreadPool = propThreadPool.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropThreadPool, value.ThreadPool, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponseConverter))] +public sealed partial class ClusterInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.Http? Http { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.Ingest? Ingest { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.Scripting? Script { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ThreadPool { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsRequest.g.cs index f9395e795b6..5daead7278a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ClusterStatsRequestParameters : RequestParameters +public sealed partial class ClusterStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,36 +42,83 @@ public sealed partial class ClusterStatsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ClusterStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get cluster statistics. /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). /// /// -public sealed partial class ClusterStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestConverter))] +public sealed partial class ClusterStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ClusterStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + { + } +#if NET7_0_OR_GREATER public ClusterStatsRequest() { } - - public ClusterStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) +#endif +#if !NET7_0_OR_GREATER + public ClusterStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "cluster.stats"; + /// + /// + /// Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } + /// /// /// Include remote cluster data into the response /// /// - [JsonIgnore] public bool? IncludeRemotes { get => Q("include_remotes"); set => Q("include_remotes", value); } /// @@ -88,7 +128,6 @@ public ClusterStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base /// However, timed out nodes are included in the response’s _nodes.failed property. Defaults to no timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -98,36 +137,116 @@ public ClusterStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). /// /// -public sealed partial class ClusterStatsRequestDescriptor : RequestDescriptor +public readonly partial struct ClusterStatsRequestDescriptor { - internal ClusterStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest instance) + { + Instance = instance; + } - public ClusterStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + public ClusterStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(nodeId); } public ClusterStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterStats; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Include remote cluster data into the response + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor IncludeRemotes(bool? value = true) + { + Instance.IncludeRemotes = value; + return this; + } - internal override string OperationName => "cluster.stats"; + /// + /// + /// Period to wait for each node to respond. + /// If a node does not respond before its timeout expires, the response does not include its stats. + /// However, timed out nodes are included in the response’s _nodes.failed property. Defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public ClusterStatsRequestDescriptor IncludeRemotes(bool? includeRemotes = true) => Qs("include_remotes", includeRemotes); - public ClusterStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClusterStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsResponse.g.cs index 75d8dfb2977..862976dff3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterStatsResponse.g.cs @@ -17,70 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ClusterStatsResponse : ElasticsearchResponse +internal sealed partial class ClusterStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropClusterUuid = System.Text.Json.JsonEncodedText.Encode("cluster_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue propClusterUuid = default; + LocalJsonValue propIndices = default; + LocalJsonValue propNodes = default; + LocalJsonValue propNodeStats = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propClusterUuid.TryReadProperty(ref reader, options, PropClusterUuid, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, null)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + ClusterUuid = propClusterUuid.Value, + Indices = propIndices.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value, + Status = propStatus.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropClusterUuid, value.ClusterUuid, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, null); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponseConverter))] +public sealed partial class ClusterStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the cluster, based on the cluster name setting. /// /// - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } /// /// /// Unique identifier for the cluster. /// /// - [JsonInclude, JsonPropertyName("cluster_uuid")] - public string ClusterUuid { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterUuid { get; set; } /// /// /// Contains statistics about indices with shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("indices")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterIndices Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterIndices Indices { get; set; } /// /// /// Contains statistics about nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("nodes")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterNodes Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterNodes Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } /// /// /// Health status of the cluster, based on the state of its primary and replica shards. /// /// - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } /// /// /// Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateRequest.g.cs index c0ef544063c..640c6f2855b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class DeleteComponentTemplateRequestParameters : RequestParameters +public sealed partial class DeleteComponentTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,33 +42,84 @@ public sealed partial class DeleteComponentTemplateRequestParameters : RequestPa public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteComponentTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete component templates. /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. /// /// -public sealed partial class DeleteComponentTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestConverter))] +public sealed partial class DeleteComponentTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteComponentTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterDeleteComponentTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterDeleteComponentTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "cluster.delete_component_template"; + /// + /// + /// Comma-separated list or wildcard expression of component template names used to limit the request. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -84,7 +128,6 @@ public DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -94,32 +137,112 @@ public DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. /// /// -public sealed partial class DeleteComponentTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteComponentTemplateRequestDescriptor { - internal DeleteComponentTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest Instance { get; init; } - public DeleteComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterDeleteComponentTemplate; + public DeleteComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteComponentTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "cluster.delete_component_template"; + /// + /// + /// Comma-separated list or wildcard expression of component template names used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public DeleteComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteComponentTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateResponse.g.cs index 7f8b65c9cbe..a1405d1fc73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteComponentTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class DeleteComponentTemplateResponse : ElasticsearchResponse +internal sealed partial class DeleteComponentTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponseConverter))] +public sealed partial class DeleteComponentTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteComponentTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsRequest.g.cs index b666916f7c7..3903bdef781 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsRequest.g.cs @@ -17,21 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class DeleteVotingConfigExclusionsRequestParameters : RequestParameters +public sealed partial class DeleteVotingConfigExclusionsRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// Specifies whether to wait for all excluded nodes to be removed from the @@ -45,22 +45,75 @@ public sealed partial class DeleteVotingConfigExclusionsRequestParameters : Requ public bool? WaitForRemoval { get => Q("wait_for_removal"); set => Q("wait_for_removal", value); } } +internal sealed partial class DeleteVotingConfigExclusionsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Clear cluster voting config exclusions. /// Remove master-eligible nodes from the voting configuration exclusion list. /// /// -public sealed partial class DeleteVotingConfigExclusionsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestConverter))] +public sealed partial class DeleteVotingConfigExclusionsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterDeleteVotingConfigExclusions; +#if NET7_0_OR_GREATER + public DeleteVotingConfigExclusionsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public DeleteVotingConfigExclusionsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterDeleteVotingConfigExclusions; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "cluster.delete_voting_config_exclusions"; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// Specifies whether to wait for all excluded nodes to be removed from the @@ -71,7 +124,6 @@ public sealed partial class DeleteVotingConfigExclusionsRequest : PlainRequest /// - [JsonIgnore] public bool? WaitForRemoval { get => Q("wait_for_removal"); set => Q("wait_for_removal", value); } } @@ -81,25 +133,103 @@ public sealed partial class DeleteVotingConfigExclusionsRequest : PlainRequest /// -public sealed partial class DeleteVotingConfigExclusionsRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteVotingConfigExclusionsRequestDescriptor { - internal DeleteVotingConfigExclusionsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteVotingConfigExclusionsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest instance) + { + Instance = instance; + } public DeleteVotingConfigExclusionsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterDeleteVotingConfigExclusions; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies whether to wait for all excluded nodes to be removed from the + /// cluster before clearing the voting configuration exclusions list. + /// Defaults to true, meaning that all excluded nodes must be removed from + /// the cluster before this API takes any action. If set to false then the + /// voting configuration exclusions list is cleared even if some excluded + /// nodes are still in the cluster. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor WaitForRemoval(bool? value = true) + { + Instance.WaitForRemoval = value; + return this; + } - internal override string OperationName => "cluster.delete_voting_config_exclusions"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteVotingConfigExclusionsRequestDescriptor WaitForRemoval(bool? waitForRemoval = true) => Qs("wait_for_removal", waitForRemoval); + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsResponse.g.cs index 1b46c283041..3e7bd003c15 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/DeleteVotingConfigExclusionsResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class DeleteVotingConfigExclusionsResponse : ElasticsearchResponse +internal sealed partial class DeleteVotingConfigExclusionsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponseConverter))] +public sealed partial class DeleteVotingConfigExclusionsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteVotingConfigExclusionsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteVotingConfigExclusionsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateRequest.g.cs index 8f2da988a43..d6220d81354 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ExistsComponentTemplateRequestParameters : RequestParameters +public sealed partial class ExistsComponentTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -50,33 +43,85 @@ public sealed partial class ExistsComponentTemplateRequestParameters : RequestPa public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class ExistsComponentTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check component templates. /// Returns information about whether a particular component template exists. /// /// -public sealed partial class ExistsComponentTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestConverter))] +public sealed partial class ExistsComponentTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ExistsComponentTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterExistsComponentTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterExistsComponentTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "cluster.exists_component_template"; + /// + /// + /// Comma-separated list of component template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// If true, the request retrieves information from the local node only. /// Defaults to false, which means information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -86,7 +131,6 @@ public ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) /// error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -96,32 +140,114 @@ public ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Names name) /// Returns information about whether a particular component template exists. /// /// -public sealed partial class ExistsComponentTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsComponentTemplateRequestDescriptor { - internal ExistsComponentTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest Instance { get; init; } - public ExistsComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterExistsComponentTemplate; + public ExistsComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsComponentTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "cluster.exists_component_template"; + /// + /// + /// Comma-separated list of component template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } - public ExistsComponentTemplateRequestDescriptor Local(bool? local = true) => Qs("local", local); - public ExistsComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// If true, the request retrieves information from the local node only. + /// Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExistsComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateResponse.g.cs index 1fea8228f4f..c93632f0e74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ExistsComponentTemplateResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class ExistsComponentTemplateResponse : ElasticsearchResponse +internal sealed partial class ExistsComponentTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponseConverter))] +public sealed partial class ExistsComponentTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsComponentTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsRequest.g.cs index c4fc5d41325..6c6f59d5469 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class GetClusterSettingsRequestParameters : RequestParameters +public sealed partial class GetClusterSettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -63,17 +56,63 @@ public sealed partial class GetClusterSettingsRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetClusterSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get cluster-wide settings. /// By default, it returns only settings that have been explicitly defined. /// /// -public sealed partial class GetClusterSettingsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestConverter))] +public sealed partial class GetClusterSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterGetSettings; +#if NET7_0_OR_GREATER + public GetClusterSettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetClusterSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterGetSettings; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -84,7 +123,6 @@ public sealed partial class GetClusterSettingsRequest : PlainRequesttrue, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -92,7 +130,6 @@ public sealed partial class GetClusterSettingsRequest : PlainRequesttrue, returns default cluster settings from the local node. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -101,7 +138,6 @@ public sealed partial class GetClusterSettingsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -110,7 +146,6 @@ public sealed partial class GetClusterSettingsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -120,28 +155,122 @@ public sealed partial class GetClusterSettingsRequest : PlainRequest /// -public sealed partial class GetClusterSettingsRequestDescriptor : RequestDescriptor +public readonly partial struct GetClusterSettingsRequestDescriptor { - internal GetClusterSettingsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetClusterSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest instance) + { + Instance = instance; + } public GetClusterSettingsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterGetSettings; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, returns default cluster settings from the local node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } - internal override string OperationName => "cluster.get_settings"; + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GetClusterSettingsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetClusterSettingsRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetClusterSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetClusterSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsResponse.g.cs index febb734d698..c9f07e19eaf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetClusterSettingsResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class GetClusterSettingsResponse : ElasticsearchResponse +internal sealed partial class GetClusterSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("defaults")] - public IReadOnlyDictionary? Defaults { get; init; } - [JsonInclude, JsonPropertyName("persistent")] - public IReadOnlyDictionary Persistent { get; init; } - [JsonInclude, JsonPropertyName("transient")] - public IReadOnlyDictionary Transient { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDefaults = System.Text.Json.JsonEncodedText.Encode("defaults"); + private static readonly System.Text.Json.JsonEncodedText PropPersistent = System.Text.Json.JsonEncodedText.Encode("persistent"); + private static readonly System.Text.Json.JsonEncodedText PropTransient = System.Text.Json.JsonEncodedText.Encode("transient"); + + public override Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDefaults = default; + LocalJsonValue> propPersistent = default; + LocalJsonValue> propTransient = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaults.TryReadProperty(ref reader, options, PropDefaults, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPersistent.TryReadProperty(ref reader, options, PropPersistent, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTransient.TryReadProperty(ref reader, options, PropTransient, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Defaults = propDefaults.Value, + Persistent = propPersistent.Value, + Transient = propTransient.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaults, value.Defaults, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPersistent, value.Persistent, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTransient, value.Transient, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponseConverter))] +public sealed partial class GetClusterSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetClusterSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetClusterSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Defaults { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Persistent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Transient { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateRequest.g.cs index 15751974598..22a411944fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class GetComponentTemplateRequestParameters : RequestParameters +public sealed partial class GetComponentTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -63,36 +56,84 @@ public sealed partial class GetComponentTemplateRequestParameters : RequestParam public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetComponentTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get component templates. /// Get information about component templates. /// /// -public sealed partial class GetComponentTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestConverter))] +public sealed partial class GetComponentTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetComponentTemplateRequest() { } - - public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetComponentTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterGetComponentTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterGetComponentTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "cluster.get_component_template"; + /// + /// + /// Comma-separated list of component template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("name"); set => PO("name", value); } + /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -100,7 +141,6 @@ public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : b /// Return all default configurations for the component template (default: false) /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -109,7 +149,6 @@ public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : b /// If false, information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -118,7 +157,6 @@ public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : b /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -128,38 +166,139 @@ public GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : b /// Get information about component templates. /// /// -public sealed partial class GetComponentTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct GetComponentTemplateRequestDescriptor { - internal GetComponentTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest instance) + { + Instance = instance; + } - public GetComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + public GetComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) { + Instance = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(name); } public GetComponentTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterGetComponentTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of component template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - internal override string OperationName => "cluster.get_component_template"; + /// + /// + /// Return all default configurations for the component template (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. + /// If false, information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } - public GetComponentTemplateRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetComponentTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetComponentTemplateRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateResponse.g.cs index 629ad116f00..2f2b18232f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/GetComponentTemplateResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class GetComponentTemplateResponse : ElasticsearchResponse +internal sealed partial class GetComponentTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("component_templates")] - public IReadOnlyCollection ComponentTemplates { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropComponentTemplates = System.Text.Json.JsonEncodedText.Encode("component_templates"); + + public override Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propComponentTemplates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComponentTemplates.TryReadProperty(ref reader, options, PropComponentTemplates, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ComponentTemplates = propComponentTemplates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComponentTemplates, value.ComponentTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponseConverter))] +public sealed partial class GetComponentTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetComponentTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ComponentTemplates { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthRequest.g.cs index 07c6a721bf8..65712d6b40d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthRequest.g.cs @@ -17,27 +17,20 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class HealthRequestParameters : RequestParameters +public sealed partial class HealthRequestParameters : Elastic.Transport.RequestParameters { /// /// /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -86,7 +79,7 @@ public sealed partial class HealthRequestParameters : RequestParameters /// The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation. /// /// - public object? WaitForNodes { get => Q("wait_for_nodes"); set => Q("wait_for_nodes", value); } + public Elastic.Clients.Elasticsearch.Cluster.WaitForNodes? WaitForNodes { get => Q("wait_for_nodes"); set => Q("wait_for_nodes", value); } /// /// @@ -110,9 +103,40 @@ public sealed partial class HealthRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.HealthStatus? WaitForStatus { get => Q("wait_for_status"); set => Q("wait_for_status", value); } } +internal sealed partial class HealthRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.HealthRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.HealthRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the cluster health status. +/// +/// /// You can also use the API to get the health status of only specified data streams and indices. /// For data streams, the API retrieves the health status of the stream’s backing indices. /// @@ -126,38 +150,55 @@ public sealed partial class HealthRequestParameters : RequestParameters /// The cluster status is controlled by the worst index status. /// /// -public sealed partial class HealthRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.HealthRequestConverter))] +public sealed partial class HealthRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public HealthRequest() { } - - public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public HealthRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterHealth; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterHealth; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "cluster.health"; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Can be one of cluster, indices or shards. Controls the details level of the health information returned. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Level? Level { get => Q("level"); set => Q("level", value); } /// @@ -165,7 +206,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -173,7 +213,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -181,7 +220,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -189,7 +227,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -197,7 +234,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForEvents? WaitForEvents { get => Q("wait_for_events"); set => Q("wait_for_events", value); } /// @@ -205,15 +241,13 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation. /// /// - [JsonIgnore] - public object? WaitForNodes { get => Q("wait_for_nodes"); set => Q("wait_for_nodes", value); } + public Elastic.Clients.Elasticsearch.Cluster.WaitForNodes? WaitForNodes { get => Q("wait_for_nodes"); set => Q("wait_for_nodes", value); } /// /// /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. Defaults to false, which means it will not wait for initializing shards. /// /// - [JsonIgnore] public bool? WaitForNoInitializingShards { get => Q("wait_for_no_initializing_shards"); set => Q("wait_for_no_initializing_shards", value); } /// @@ -221,7 +255,6 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to false, which means it will not wait for relocating shards. /// /// - [JsonIgnore] public bool? WaitForNoRelocatingShards { get => Q("wait_for_no_relocating_shards"); set => Q("wait_for_no_relocating_shards", value); } /// @@ -229,13 +262,14 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.HealthStatus? WaitForStatus { get => Q("wait_for_status"); set => Q("wait_for_status", value); } } /// /// /// Get the cluster health status. +/// +/// /// You can also use the API to get the health status of only specified data streams and indices. /// For data streams, the API retrieves the health status of the stream’s backing indices. /// @@ -249,52 +283,233 @@ public HealthRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The cluster status is controlled by the worst index status. /// /// -public sealed partial class HealthRequestDescriptor : RequestDescriptor, HealthRequestParameters> +public readonly partial struct HealthRequestDescriptor { - internal HealthRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.HealthRequest Instance { get; init; } - public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.HealthRequest instance) { + Instance = instance; + } + + public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(indices); } public HealthRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterHealth; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.HealthRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override string OperationName => "cluster.health"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public HealthRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public HealthRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); - public HealthRequestDescriptor Local(bool? local = true) => Qs("local", local); - public HealthRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public HealthRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public HealthRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public HealthRequestDescriptor WaitForEvents(Elastic.Clients.Elasticsearch.WaitForEvents? waitForEvents) => Qs("wait_for_events", waitForEvents); - public HealthRequestDescriptor WaitForNodes(object? waitForNodes) => Qs("wait_for_nodes", waitForNodes); - public HealthRequestDescriptor WaitForNoInitializingShards(bool? waitForNoInitializingShards = true) => Qs("wait_for_no_initializing_shards", waitForNoInitializingShards); - public HealthRequestDescriptor WaitForNoRelocatingShards(bool? waitForNoRelocatingShards = true) => Qs("wait_for_no_relocating_shards", waitForNoRelocatingShards); - public HealthRequestDescriptor WaitForStatus(Elastic.Clients.Elasticsearch.HealthStatus? waitForStatus) => Qs("wait_for_status", waitForStatus); + /// + /// + /// Can be one of cluster, indices or shards. Controls the details level of the health information returned. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForEvents(Elastic.Clients.Elasticsearch.WaitForEvents? value) + { + Instance.WaitForEvents = value; + return this; + } + + /// + /// + /// The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNodes(Elastic.Clients.Elasticsearch.Cluster.WaitForNodes? value) + { + Instance.WaitForNodes = value; + return this; + } + + /// + /// + /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. Defaults to false, which means it will not wait for initializing shards. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNoInitializingShards(bool? value = true) + { + Instance.WaitForNoInitializingShards = value; + return this; + } + + /// + /// + /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to false, which means it will not wait for relocating shards. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNoRelocatingShards(bool? value = true) + { + Instance.WaitForNoRelocatingShards = value; + return this; + } + + /// + /// + /// One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForStatus(Elastic.Clients.Elasticsearch.HealthStatus? value) + { + Instance.WaitForStatus = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.HealthRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public HealthRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Human(bool? value) { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Get the cluster health status. +/// +/// /// You can also use the API to get the health status of only specified data streams and indices. /// For data streams, the API retrieves the health status of the stream’s backing indices. /// @@ -308,45 +523,224 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The cluster status is controlled by the worst index status. /// /// -public sealed partial class HealthRequestDescriptor : RequestDescriptor +public readonly partial struct HealthRequestDescriptor { - internal HealthRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.HealthRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.HealthRequest instance) + { + Instance = instance; + } - public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(indices); } public HealthRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterHealth; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.HealthRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override string OperationName => "cluster.health"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Can be one of cluster, indices or shards. Controls the details level of the health information returned. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForEvents(Elastic.Clients.Elasticsearch.WaitForEvents? value) + { + Instance.WaitForEvents = value; + return this; + } + + /// + /// + /// The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNodes(Elastic.Clients.Elasticsearch.Cluster.WaitForNodes? value) + { + Instance.WaitForNodes = value; + return this; + } + + /// + /// + /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. Defaults to false, which means it will not wait for initializing shards. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNoInitializingShards(bool? value = true) + { + Instance.WaitForNoInitializingShards = value; + return this; + } + + /// + /// + /// A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to false, which means it will not wait for relocating shards. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForNoRelocatingShards(bool? value = true) + { + Instance.WaitForNoRelocatingShards = value; + return this; + } + + /// + /// + /// One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor WaitForStatus(Elastic.Clients.Elasticsearch.HealthStatus? value) + { + Instance.WaitForStatus = value; + return this; + } - public HealthRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public HealthRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); - public HealthRequestDescriptor Local(bool? local = true) => Qs("local", local); - public HealthRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public HealthRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public HealthRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public HealthRequestDescriptor WaitForEvents(Elastic.Clients.Elasticsearch.WaitForEvents? waitForEvents) => Qs("wait_for_events", waitForEvents); - public HealthRequestDescriptor WaitForNodes(object? waitForNodes) => Qs("wait_for_nodes", waitForNodes); - public HealthRequestDescriptor WaitForNoInitializingShards(bool? waitForNoInitializingShards = true) => Qs("wait_for_no_initializing_shards", waitForNoInitializingShards); - public HealthRequestDescriptor WaitForNoRelocatingShards(bool? waitForNoRelocatingShards = true) => Qs("wait_for_no_relocating_shards", waitForNoRelocatingShards); - public HealthRequestDescriptor WaitForStatus(Elastic.Clients.Elasticsearch.HealthStatus? waitForStatus) => Qs("wait_for_status", waitForStatus); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.HealthRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.HealthRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public HealthRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthResponse.g.cs index e3fca0ec657..bdc87c8804b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/HealthResponse.g.cs @@ -17,147 +17,409 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class HealthResponse : ElasticsearchResponse +internal sealed partial class HealthResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActivePrimaryShards = System.Text.Json.JsonEncodedText.Encode("active_primary_shards"); + private static readonly System.Text.Json.JsonEncodedText PropActiveShards = System.Text.Json.JsonEncodedText.Encode("active_shards"); + private static readonly System.Text.Json.JsonEncodedText PropActiveShardsPercent = System.Text.Json.JsonEncodedText.Encode("active_shards_percent"); + private static readonly System.Text.Json.JsonEncodedText PropActiveShardsPercentAsNumber = System.Text.Json.JsonEncodedText.Encode("active_shards_percent_as_number"); + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedUnassignedShards = System.Text.Json.JsonEncodedText.Encode("delayed_unassigned_shards"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropInitializingShards = System.Text.Json.JsonEncodedText.Encode("initializing_shards"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfDataNodes = System.Text.Json.JsonEncodedText.Encode("number_of_data_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfInFlightFetch = System.Text.Json.JsonEncodedText.Encode("number_of_in_flight_fetch"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfNodes = System.Text.Json.JsonEncodedText.Encode("number_of_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfPendingTasks = System.Text.Json.JsonEncodedText.Encode("number_of_pending_tasks"); + private static readonly System.Text.Json.JsonEncodedText PropRelocatingShards = System.Text.Json.JsonEncodedText.Encode("relocating_shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTaskMaxWaitingInQueue = System.Text.Json.JsonEncodedText.Encode("task_max_waiting_in_queue"); + private static readonly System.Text.Json.JsonEncodedText PropTaskMaxWaitingInQueueMillis = System.Text.Json.JsonEncodedText.Encode("task_max_waiting_in_queue_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedPrimaryShards = System.Text.Json.JsonEncodedText.Encode("unassigned_primary_shards"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedShards = System.Text.Json.JsonEncodedText.Encode("unassigned_shards"); + + public override Elastic.Clients.Elasticsearch.Cluster.HealthResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActivePrimaryShards = default; + LocalJsonValue propActiveShards = default; + LocalJsonValue propActiveShardsPercent = default; + LocalJsonValue propActiveShardsPercentAsNumber = default; + LocalJsonValue propClusterName = default; + LocalJsonValue propDelayedUnassignedShards = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue propInitializingShards = default; + LocalJsonValue propNumberOfDataNodes = default; + LocalJsonValue propNumberOfInFlightFetch = default; + LocalJsonValue propNumberOfNodes = default; + LocalJsonValue propNumberOfPendingTasks = default; + LocalJsonValue propRelocatingShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTaskMaxWaitingInQueue = default; + LocalJsonValue propTaskMaxWaitingInQueueMillis = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propUnassignedPrimaryShards = default; + LocalJsonValue propUnassignedShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActivePrimaryShards.TryReadProperty(ref reader, options, PropActivePrimaryShards, null)) + { + continue; + } + + if (propActiveShards.TryReadProperty(ref reader, options, PropActiveShards, null)) + { + continue; + } + + if (propActiveShardsPercent.TryReadProperty(ref reader, options, PropActiveShardsPercent, null)) + { + continue; + } + + if (propActiveShardsPercentAsNumber.TryReadProperty(ref reader, options, PropActiveShardsPercentAsNumber, null)) + { + continue; + } + + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propDelayedUnassignedShards.TryReadProperty(ref reader, options, PropDelayedUnassignedShards, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propInitializingShards.TryReadProperty(ref reader, options, PropInitializingShards, null)) + { + continue; + } + + if (propNumberOfDataNodes.TryReadProperty(ref reader, options, PropNumberOfDataNodes, null)) + { + continue; + } + + if (propNumberOfInFlightFetch.TryReadProperty(ref reader, options, PropNumberOfInFlightFetch, null)) + { + continue; + } + + if (propNumberOfNodes.TryReadProperty(ref reader, options, PropNumberOfNodes, null)) + { + continue; + } + + if (propNumberOfPendingTasks.TryReadProperty(ref reader, options, PropNumberOfPendingTasks, null)) + { + continue; + } + + if (propRelocatingShards.TryReadProperty(ref reader, options, PropRelocatingShards, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTaskMaxWaitingInQueue.TryReadProperty(ref reader, options, PropTaskMaxWaitingInQueue, null)) + { + continue; + } + + if (propTaskMaxWaitingInQueueMillis.TryReadProperty(ref reader, options, PropTaskMaxWaitingInQueueMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propUnassignedPrimaryShards.TryReadProperty(ref reader, options, PropUnassignedPrimaryShards, null)) + { + continue; + } + + if (propUnassignedShards.TryReadProperty(ref reader, options, PropUnassignedShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.HealthResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActivePrimaryShards = propActivePrimaryShards.Value, + ActiveShards = propActiveShards.Value, + ActiveShardsPercent = propActiveShardsPercent.Value, + ActiveShardsPercentAsNumber = propActiveShardsPercentAsNumber.Value, + ClusterName = propClusterName.Value, + DelayedUnassignedShards = propDelayedUnassignedShards.Value, + Indices = propIndices.Value, + InitializingShards = propInitializingShards.Value, + NumberOfDataNodes = propNumberOfDataNodes.Value, + NumberOfInFlightFetch = propNumberOfInFlightFetch.Value, + NumberOfNodes = propNumberOfNodes.Value, + NumberOfPendingTasks = propNumberOfPendingTasks.Value, + RelocatingShards = propRelocatingShards.Value, + Status = propStatus.Value, + TaskMaxWaitingInQueue = propTaskMaxWaitingInQueue.Value, + TaskMaxWaitingInQueueMillis = propTaskMaxWaitingInQueueMillis.Value, + TimedOut = propTimedOut.Value, + UnassignedPrimaryShards = propUnassignedPrimaryShards.Value, + UnassignedShards = propUnassignedShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.HealthResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActivePrimaryShards, value.ActivePrimaryShards, null, null); + writer.WriteProperty(options, PropActiveShards, value.ActiveShards, null, null); + writer.WriteProperty(options, PropActiveShardsPercent, value.ActiveShardsPercent, null, null); + writer.WriteProperty(options, PropActiveShardsPercentAsNumber, value.ActiveShardsPercentAsNumber, null, null); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropDelayedUnassignedShards, value.DelayedUnassignedShards, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropInitializingShards, value.InitializingShards, null, null); + writer.WriteProperty(options, PropNumberOfDataNodes, value.NumberOfDataNodes, null, null); + writer.WriteProperty(options, PropNumberOfInFlightFetch, value.NumberOfInFlightFetch, null, null); + writer.WriteProperty(options, PropNumberOfNodes, value.NumberOfNodes, null, null); + writer.WriteProperty(options, PropNumberOfPendingTasks, value.NumberOfPendingTasks, null, null); + writer.WriteProperty(options, PropRelocatingShards, value.RelocatingShards, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTaskMaxWaitingInQueue, value.TaskMaxWaitingInQueue, null, null); + writer.WriteProperty(options, PropTaskMaxWaitingInQueueMillis, value.TaskMaxWaitingInQueueMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropUnassignedPrimaryShards, value.UnassignedPrimaryShards, null, null); + writer.WriteProperty(options, PropUnassignedShards, value.UnassignedShards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.HealthResponseConverter))] +public sealed partial class HealthResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HealthResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of active primary shards. /// /// - [JsonInclude, JsonPropertyName("active_primary_shards")] - public int ActivePrimaryShards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ActivePrimaryShards { get; set; } /// /// /// The total number of active primary and replica shards. /// /// - [JsonInclude, JsonPropertyName("active_shards")] - public int ActiveShards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ActiveShards { get; set; } + + /// + /// + /// The ratio of active shards in the cluster expressed as a string formatted percentage. + /// + /// + public string? ActiveShardsPercent { get; set; } /// /// /// The ratio of active shards in the cluster expressed as a percentage. /// /// - [JsonInclude, JsonPropertyName("active_shards_percent_as_number")] - public double ActiveShardsPercentAsNumber { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double ActiveShardsPercentAsNumber { get; set; } /// /// /// The name of the cluster. /// /// - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } /// /// /// The number of shards whose allocation has been delayed by the timeout settings. /// /// - [JsonInclude, JsonPropertyName("delayed_unassigned_shards")] - public int DelayedUnassignedShards { get; init; } - [JsonInclude, JsonPropertyName("indices")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndexHealthStats))] - public IReadOnlyDictionary? Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DelayedUnassignedShards { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Indices { get; set; } /// /// /// The number of shards that are under initialization. /// /// - [JsonInclude, JsonPropertyName("initializing_shards")] - public int InitializingShards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int InitializingShards { get; set; } /// /// /// The number of nodes that are dedicated data nodes. /// /// - [JsonInclude, JsonPropertyName("number_of_data_nodes")] - public int NumberOfDataNodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfDataNodes { get; set; } /// /// /// The number of unfinished fetches. /// /// - [JsonInclude, JsonPropertyName("number_of_in_flight_fetch")] - public int NumberOfInFlightFetch { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfInFlightFetch { get; set; } /// /// /// The number of nodes within the cluster. /// /// - [JsonInclude, JsonPropertyName("number_of_nodes")] - public int NumberOfNodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfNodes { get; set; } /// /// /// The number of cluster-level changes that have not yet been executed. /// /// - [JsonInclude, JsonPropertyName("number_of_pending_tasks")] - public int NumberOfPendingTasks { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfPendingTasks { get; set; } /// /// /// The number of shards that are under relocation. /// /// - [JsonInclude, JsonPropertyName("relocating_shards")] - public int RelocatingShards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int RelocatingShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } /// /// /// The time since the earliest initiated task is waiting for being performed. /// /// - [JsonInclude, JsonPropertyName("task_max_waiting_in_queue")] - public Elastic.Clients.Elasticsearch.Duration? TaskMaxWaitingInQueue { get; init; } + public Elastic.Clients.Elasticsearch.Duration? TaskMaxWaitingInQueue { get; set; } /// /// /// The time expressed in milliseconds since the earliest initiated task is waiting for being performed. /// /// - [JsonInclude, JsonPropertyName("task_max_waiting_in_queue_millis")] - public long TaskMaxWaitingInQueueMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TaskMaxWaitingInQueueMillis { get; set; } /// /// /// If false the response returned within the period of time that is specified by the timeout parameter (30s by default) /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } /// /// /// The number of primary shards that are not allocated. /// /// - [JsonInclude, JsonPropertyName("unassigned_primary_shards")] - public int UnassignedPrimaryShards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedPrimaryShards { get; set; } /// /// /// The number of shards that are not allocated. /// /// - [JsonInclude, JsonPropertyName("unassigned_shards")] - public int UnassignedShards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedShards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksRequest.g.cs index ed40db21041..fba6492a0ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PendingTasksRequestParameters : RequestParameters +public sealed partial class PendingTasksRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class PendingTasksRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class PendingTasksRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the pending cluster tasks. @@ -60,11 +82,28 @@ public sealed partial class PendingTasksRequestParameters : RequestParameters /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. /// /// -public sealed partial class PendingTasksRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestConverter))] +public sealed partial class PendingTasksRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPendingTasks; +#if NET7_0_OR_GREATER + public PendingTasksRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PendingTasksRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PendingTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterPendingTasks; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -76,7 +115,6 @@ public sealed partial class PendingTasksRequest : PlainRequestfalse, information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -85,7 +123,6 @@ public sealed partial class PendingTasksRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -100,26 +137,100 @@ public sealed partial class PendingTasksRequest : PlainRequest /// -public sealed partial class PendingTasksRequestDescriptor : RequestDescriptor +public readonly partial struct PendingTasksRequestDescriptor { - internal PendingTasksRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PendingTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest instance) + { + Instance = instance; + } public PendingTasksRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPendingTasks; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If true, the request retrieves information from the local node only. + /// If false, information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "cluster.pending_tasks"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public PendingTasksRequestDescriptor Local(bool? local = true) => Qs("local", local); - public PendingTasksRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksResponse.g.cs index 024b4bad879..01b43eacb90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PendingTasksResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PendingTasksResponse : ElasticsearchResponse +internal sealed partial class PendingTasksResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("tasks")] - public IReadOnlyCollection Tasks { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + + public override Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propTasks = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTasks.TryReadProperty(ref reader, options, PropTasks, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Tasks = propTasks.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTasks, value.Tasks, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponseConverter))] +public sealed partial class PendingTasksResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PendingTasksResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PendingTasksResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Tasks { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsRequest.g.cs index 75da7c39dae..d2bf6b682c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsRequest.g.cs @@ -17,21 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PostVotingConfigExclusionsRequestParameters : RequestParameters +public sealed partial class PostVotingConfigExclusionsRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// A comma-separated list of the persistent ids of the nodes to exclude @@ -59,6 +59,35 @@ public sealed partial class PostVotingConfigExclusionsRequestParameters : Reques public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PostVotingConfigExclusionsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Update voting configuration exclusions. @@ -84,23 +113,46 @@ public sealed partial class PostVotingConfigExclusionsRequestParameters : Reques /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. /// /// -public sealed partial class PostVotingConfigExclusionsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestConverter))] +public sealed partial class PostVotingConfigExclusionsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPostVotingConfigExclusions; +#if NET7_0_OR_GREATER + public PostVotingConfigExclusionsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PostVotingConfigExclusionsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterPostVotingConfigExclusions; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "cluster.post_voting_config_exclusions"; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// A comma-separated list of the persistent ids of the nodes to exclude /// from the voting configuration. If specified, you may not also specify node_names. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Ids? NodeIds { get => Q("node_ids"); set => Q("node_ids", value); } /// @@ -109,7 +161,6 @@ public sealed partial class PostVotingConfigExclusionsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Names? NodeNames { get => Q("node_names"); set => Q("node_names", value); } /// @@ -120,7 +171,6 @@ public sealed partial class PostVotingConfigExclusionsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -149,27 +199,125 @@ public sealed partial class PostVotingConfigExclusionsRequest : PlainRequest /// -public sealed partial class PostVotingConfigExclusionsRequestDescriptor : RequestDescriptor +public readonly partial struct PostVotingConfigExclusionsRequestDescriptor { - internal PostVotingConfigExclusionsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostVotingConfigExclusionsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest instance) + { + Instance = instance; + } public PostVotingConfigExclusionsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPostVotingConfigExclusions; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list of the persistent ids of the nodes to exclude + /// from the voting configuration. If specified, you may not also specify node_names. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor NodeIds(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.NodeIds = value; + return this; + } - internal override string OperationName => "cluster.post_voting_config_exclusions"; + /// + /// + /// A comma-separated list of the names of the nodes to exclude from the + /// voting configuration. If specified, you may not also specify node_ids. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor NodeNames(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.NodeNames = value; + return this; + } + + /// + /// + /// When adding a voting configuration exclusion, the API waits for the + /// specified nodes to be excluded from the voting configuration before + /// returning. If the timeout expires before the appropriate condition + /// is satisfied, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public PostVotingConfigExclusionsRequestDescriptor NodeIds(Elastic.Clients.Elasticsearch.Ids? nodeIds) => Qs("node_ids", nodeIds); - public PostVotingConfigExclusionsRequestDescriptor NodeNames(Elastic.Clients.Elasticsearch.Names? nodeNames) => Qs("node_names", nodeNames); - public PostVotingConfigExclusionsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsResponse.g.cs index 8f416a03098..8588bbc6dc4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PostVotingConfigExclusionsResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PostVotingConfigExclusionsResponse : ElasticsearchResponse +internal sealed partial class PostVotingConfigExclusionsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponseConverter))] +public sealed partial class PostVotingConfigExclusionsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostVotingConfigExclusionsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostVotingConfigExclusionsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs index 6189a98d131..c966445a8ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PutComponentTemplateRequestParameters : RequestParameters +public sealed partial class PutComponentTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,6 +41,72 @@ public sealed partial class PutComponentTemplateRequestParameters : RequestParam public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class PutComponentTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeprecated = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deprecated = propDeprecated.Value, + Meta = propMeta.Value, + Template = propTemplate.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a component template. @@ -78,26 +137,59 @@ public sealed partial class PutComponentTemplateRequestParameters : RequestParam /// To be applied, a component template must be included in an index template's composed_of list. /// /// -public sealed partial class PutComponentTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestConverter))] +public sealed partial class PutComponentTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPutComponentTemplate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name, Elastic.Clients.Elasticsearch.IndexManagement.IndexState template) : base(r => r.Required("name", name)) + { + Template = template; + } +#if NET7_0_OR_GREATER + public PutComponentTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterPutComponentTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "cluster.put_component_template"; + /// + /// + /// Name of the component template to create. + /// Elasticsearch includes the following built-in component templates: logs-mappings; logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. + /// Elastic Agent uses these templates to configure backing indices for its data streams. + /// If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. + /// If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true, this request cannot replace or update existing component templates. /// /// - [JsonIgnore] public bool? Create { get => Q("create"); set => Q("create", value); } /// @@ -106,7 +198,6 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -115,7 +206,6 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// that uses deprecated components, Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -126,16 +216,18 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// To unset _meta, replace the template without specifying this information. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// /// The template to be applied which includes mappings, settings, or aliases configuration. /// /// - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexState Template { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexState Template { get; set; } /// /// @@ -144,7 +236,6 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// To unset a version, replace the template without specifying a version. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } @@ -178,37 +269,69 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// To be applied, a component template must be included in an index template's composed_of list. /// /// -public sealed partial class PutComponentTemplateRequestDescriptor : RequestDescriptor, PutComponentTemplateRequestParameters> +public readonly partial struct PutComponentTemplateRequestDescriptor { - internal PutComponentTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest Instance { get; init; } - public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPutComponentTemplate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(name); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutComponentTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "cluster.put_component_template"; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor descriptor) => descriptor.Instance; - public PutComponentTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Name of the component template to create. + /// Elasticsearch includes the following built-in component templates: logs-mappings; logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. + /// Elastic Agent uses these templates to configure backing indices for its data streams. + /// If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. + /// If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// If true, this request cannot replace or update existing component templates. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Create(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Create = value; + return this; } - private bool? DeprecatedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexState TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor TemplateDescriptor { get; set; } - private Action> TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -216,10 +339,10 @@ public PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Ela /// that uses deprecated components, Elasticsearch will emit a deprecation warning. /// /// - public PutComponentTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -230,10 +353,45 @@ public PutComponentTemplateRequestDescriptor Deprecated(bool? depreca /// To unset _meta, replace the template without specifying this information. /// /// - public PutComponentTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; + } + + /// + /// + /// Optional user metadata about the component template. + /// It may have any contents. This map is not automatically generated by Elasticsearch. + /// This information is stored in the cluster state, so keeping it short is preferable. + /// To unset _meta, replace the template without specifying this information. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the component template. + /// It may have any contents. This map is not automatically generated by Elasticsearch. + /// This information is stored in the cluster state, so keeping it short is preferable. + /// To unset _meta, replace the template without specifying this information. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -241,28 +399,43 @@ public PutComponentTemplateRequestDescriptor Meta(Func /// - public PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexState template) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexState value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor descriptor) + /// + /// + /// The template to be applied which includes mappings, settings, or aliases configuration. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template() + { + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor.Build(null); + return this; + } + + /// + /// + /// The template to be applied which includes mappings, settings, or aliases configuration. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template(System.Action? action) { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor.Build(action); + return this; } - public PutComponentTemplateRequestDescriptor Template(Action> configure) + /// + /// + /// The template to be applied which includes mappings, settings, or aliases configuration. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor.Build(action); + return this; } /// @@ -272,50 +445,60 @@ public PutComponentTemplateRequestDescriptor Template(Action /// - public PutComponentTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest Build(System.Action action) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(TemplateDescriptorAction), options); - } - else - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -349,37 +532,69 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// To be applied, a component template must be included in an index template's composed_of list. /// /// -public sealed partial class PutComponentTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct PutComponentTemplateRequestDescriptor { - internal PutComponentTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest Instance { get; init; } - public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.ClusterPutComponentTemplate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(name); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutComponentTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "cluster.put_component_template"; + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor descriptor) => descriptor.Instance; - public PutComponentTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Name of the component template to create. + /// Elasticsearch includes the following built-in component templates: logs-mappings; logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. + /// Elastic Agent uses these templates to configure backing indices for its data streams. + /// If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. + /// If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// If true, this request cannot replace or update existing component templates. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Create(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Create = value; + return this; } - private bool? DeprecatedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexState TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -387,10 +602,24 @@ public PutComponentTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch. /// that uses deprecated components, Elasticsearch will emit a deprecation warning. /// /// - public PutComponentTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Deprecated(bool? value = true) + { + Instance.Deprecated = value; + return this; + } + + /// + /// + /// Optional user metadata about the component template. + /// It may have any contents. This map is not automatically generated by Elasticsearch. + /// This information is stored in the cluster state, so keeping it short is preferable. + /// To unset _meta, replace the template without specifying this information. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - DeprecatedValue = deprecated; - return Self; + Instance.Meta = value; + return this; } /// @@ -401,10 +630,31 @@ public PutComponentTemplateRequestDescriptor Deprecated(bool? deprecated = true) /// To unset _meta, replace the template without specifying this information. /// /// - public PutComponentTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the component template. + /// It may have any contents. This map is not automatically generated by Elasticsearch. + /// This information is stored in the cluster state, so keeping it short is preferable. + /// To unset _meta, replace the template without specifying this information. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -412,28 +662,32 @@ public PutComponentTemplateRequestDescriptor Meta(Func /// - public PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexState template) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexState value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public PutComponentTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor descriptor) + /// + /// + /// The template to be applied which includes mappings, settings, or aliases configuration. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor.Build(null); + return this; } - public PutComponentTemplateRequestDescriptor Template(Action configure) + /// + /// + /// The template to be applied which includes mappings, settings, or aliases configuration. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor.Build(action); + return this; } /// @@ -443,49 +697,59 @@ public PutComponentTemplateRequestDescriptor Template(Action /// - public PutComponentTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(TemplateDescriptorAction), options); - } - else - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateResponse.g.cs index 5b48a459f7a..b29b3251194 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public sealed partial class PutComponentTemplateResponse : ElasticsearchResponse +internal sealed partial class PutComponentTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponseConverter))] +public sealed partial class PutComponentTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutComponentTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutComponentTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountRequest.g.cs index 2ace77ec6b0..ca752f1edc1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class CountRequestParameters : RequestParameters +public sealed partial class CountRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -80,7 +73,15 @@ public sealed partial class CountRequestParameters : RequestParameters /// It supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// @@ -142,6 +143,45 @@ public sealed partial class CountRequestParameters : RequestParameters public long? TerminateAfter { get => Q("terminate_after"); set => Q("terminate_after", value); } } +internal sealed partial class CountRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.CountRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CountRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Count search results. @@ -160,24 +200,45 @@ public sealed partial class CountRequestParameters : RequestParameters /// This means that replicas increase the scalability of the count. /// /// -public partial class CountRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CountRequestConverter))] +public partial class CountRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public CountRequest() { } - - public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public CountRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceCount; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceCount; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "count"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -185,7 +246,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -194,7 +254,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -203,7 +262,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -212,7 +270,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -221,7 +278,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -231,15 +287,21 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// It supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -248,7 +310,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -256,7 +317,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The minimum _score value that documents must have to be included in the result. /// /// - [JsonIgnore] public double? MinScore { get => Q("min_score"); set => Q("min_score", value); } /// @@ -265,7 +325,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// By default, it is random. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -273,7 +332,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The query in Lucene query string syntax. This parameter cannot be used with a request body. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -281,7 +339,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -297,7 +354,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. /// /// - [JsonIgnore] public long? TerminateAfter { get => Q("terminate_after"); set => Q("terminate_after", value); } /// @@ -306,7 +362,6 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// with the q query string parameter. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } @@ -328,49 +383,227 @@ public CountRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This means that replicas increase the scalability of the count. /// /// -public sealed partial class CountRequestDescriptor : RequestDescriptor, CountRequestParameters> +public readonly partial struct CountRequestDescriptor { - internal CountRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CountRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountRequestDescriptor(Elastic.Clients.Elasticsearch.CountRequest instance) + { + Instance = instance; + } - public CountRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public CountRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.CountRequest(indices); } public CountRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceCount; + public static explicit operator Elastic.Clients.Elasticsearch.CountRequestDescriptor(Elastic.Clients.Elasticsearch.CountRequest instance) => new Elastic.Clients.Elasticsearch.CountRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.CountRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "count"; + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// The field to use as a default when no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The minimum _score value that documents must have to be included in the result. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, it is random. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - public CountRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public CountRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public CountRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public CountRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public CountRequestDescriptor Df(string? df) => Qs("df", df); - public CountRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public CountRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public CountRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public CountRequestDescriptor MinScore(double? minScore) => Qs("min_score", minScore); - public CountRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public CountRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public CountRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public CountRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); + /// + /// + /// The query in Lucene query string syntax. This parameter cannot be used with a request body. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } - public CountRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.Routing = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } /// /// @@ -378,50 +611,89 @@ public CountRequestDescriptor Indices(Elastic.Clients.Elasticsearch.I /// with the q query string parameter. /// /// - public CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines the search query using Query DSL. A request body query cannot be used + /// with the q query string parameter. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public CountRequestDescriptor Query(Action> configure) + /// + /// + /// Defines the search query using Query DSL. A request body query cannot be used + /// with the q query string parameter. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CountRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -443,99 +715,304 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This means that replicas increase the scalability of the count. /// /// -public sealed partial class CountRequestDescriptor : RequestDescriptor +public readonly partial struct CountRequestDescriptor { - internal CountRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CountRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountRequestDescriptor(Elastic.Clients.Elasticsearch.CountRequest instance) + { + Instance = instance; + } - public CountRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public CountRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.CountRequest(indices); } public CountRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceCount; + public static explicit operator Elastic.Clients.Elasticsearch.CountRequestDescriptor(Elastic.Clients.Elasticsearch.CountRequest instance) => new Elastic.Clients.Elasticsearch.CountRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.CountRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "count"; + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - public CountRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public CountRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public CountRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public CountRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public CountRequestDescriptor Df(string? df) => Qs("df", df); - public CountRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public CountRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public CountRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public CountRequestDescriptor MinScore(double? minScore) => Qs("min_score", minScore); - public CountRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public CountRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public CountRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public CountRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } - public CountRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.DefaultOperator = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + /// + /// + /// The field to use as a default when no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } /// /// - /// Defines the search query using Query DSL. A request body query cannot be used - /// with the q query string parameter. + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. /// /// - public CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.ExpandWildcards = value; + return this; } - public CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - public CountRequestDescriptor Query(Action configure) + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor IgnoreThrottled(bool? value = true) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.IgnoreThrottled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor IgnoreUnavailable(bool? value = true) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The minimum _score value that documents must have to be included in the result. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, it is random. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// The query in Lucene query string syntax. This parameter cannot be used with a request body. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// Defines the search query using Query DSL. A request body query cannot be used + /// with the q query string parameter. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// Defines the search query using Query DSL. A request body query cannot be used + /// with the q query string parameter. + /// + /// + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CountRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(new Elastic.Clients.Elasticsearch.CountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CountRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountResponse.g.cs index e225c0dee65..27c0fe92886 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CountResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class CountResponse : ElasticsearchResponse +internal sealed partial class CountResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.CountResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CountResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CountResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CountResponseConverter))] +public sealed partial class CountResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CountResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateRequest.g.cs index f477155194a..34df65aae6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateRequest.g.cs @@ -17,21 +17,47 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class CreateRequestParameters : RequestParameters +public sealed partial class CreateRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + + /// + /// + /// Set to create to only index the document if it does not already exist (put if absent). + /// If a document with the specified _id already exists, the indexing operation will fail. + /// The behavior is the same as using the <index>/_create endpoint. + /// If a document ID is specified, this paramater defaults to index. + /// Otherwise, it defaults to create. + /// If the request targets a data stream, an op_type of create is required. + /// + /// + public Elastic.Clients.Elasticsearch.OpType? OpType { get => Q("op_type"); set => Q("op_type", value); } + /// /// /// The ID of the pipeline to use to preprocess incoming documents. @@ -50,6 +76,20 @@ public sealed partial class CreateRequestParameters : RequestParameters /// public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } + + /// + /// + /// If true, the request's actions must target a data stream (existing or to be created). + /// + /// + public bool? RequireDataStream { get => Q("require_data_stream"); set => Q("require_data_stream", value); } + /// /// /// A custom value that is used to route operations to a specific shard. @@ -97,6 +137,36 @@ public sealed partial class CreateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class CreateRequestConverter : System.Text.Json.Serialization.JsonConverter> +{ + public override Elastic.Clients.Elasticsearch.CreateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.CreateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Document = reader.ReadValue(options, static TDocument (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CreateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Document, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + } +} + +internal sealed partial class CreateRequestConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(CreateRequest<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(CreateRequestConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + /// /// /// Create a new document in the index. @@ -168,7 +238,7 @@ public sealed partial class CreateRequestParameters : RequestParameters /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. /// /// -/// ** Distributed** +/// Distributed /// /// /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. @@ -203,20 +273,103 @@ public sealed partial class CreateRequestParameters : RequestParameters /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. /// /// -public sealed partial class CreateRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CreateRequestConverterFactory))] +public sealed partial class CreateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRequest(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { + Document = document; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceCreate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRequest(TDocument document, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", typeof(TDocument)).Required("id", id)) + { + Document = document; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRequest(TDocument document) : base(r => r.Required("index", typeof(TDocument)).Required("id", Elastic.Clients.Elasticsearch.Id.From(document))) + { + Document = document; + } +#if NET7_0_OR_GREATER + public CreateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceCreate; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "create"; + /// + /// + /// A unique identifier for the document. + /// To automatically generate a document ID, use the POST /<target>/_doc/ request format. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The name of the data stream or index to target. + /// If the target doesn't exist and matches the name or wildcard (*) pattern of an index template with a data_stream definition, this request creates the data stream. + /// If the target doesn't exist and doesn’t match a data stream template, this request creates the index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + + /// + /// + /// Set to create to only index the document if it does not already exist (put if absent). + /// If a document with the specified _id already exists, the indexing operation will fail. + /// The behavior is the same as using the <index>/_create endpoint. + /// If a document ID is specified, this paramater defaults to index. + /// Otherwise, it defaults to create. + /// If the request targets a data stream, an op_type of create is required. + /// + /// + public Elastic.Clients.Elasticsearch.OpType? OpType { get => Q("op_type"); set => Q("op_type", value); } + /// /// /// The ID of the pipeline to use to preprocess incoming documents. @@ -224,7 +377,6 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If a final pipeline is configured, it will always run regardless of the value of this parameter. /// /// - [JsonIgnore] public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } /// @@ -234,15 +386,27 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If false, it does nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } + + /// + /// + /// If true, the request's actions must target a data stream (existing or to be created). + /// + /// + public bool? RequireDataStream { get => Q("require_data_stream"); set => Q("require_data_stream", value); } + /// /// /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -258,7 +422,6 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -267,7 +430,6 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// It must be a non-negative long number. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -275,7 +437,6 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } /// @@ -285,15 +446,12 @@ public CreateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The default value of 1 means it waits for each primary shard to be active. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } - [JsonIgnore] - public TDocument Document { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - settings.SourceSerializer.Serialize(Document, writer); - } + public +#if NET7_0_OR_GREATER + required +#endif + TDocument Document { get; set; } } /// @@ -367,7 +525,7 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. /// /// -/// ** Distributed** +/// Distributed /// /// /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. @@ -402,61 +560,281 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. /// /// -public sealed partial class CreateRequestDescriptor : RequestDescriptor, CreateRequestParameters> +public readonly partial struct CreateRequestDescriptor { - internal CreateRequestDescriptor(Action> configure) => configure.Invoke(this); - public CreateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) => DocumentValue = document; + internal Elastic.Clients.Elasticsearch.CreateRequest Instance { get; init; } - public CreateRequestDescriptor(TDocument document) : this(document, typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRequestDescriptor(Elastic.Clients.Elasticsearch.CreateRequest instance) { + Instance = instance; } - public CreateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(document, index, Elastic.Clients.Elasticsearch.Id.From(document)) + public CreateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.CreateRequest(document, index, id); } - public CreateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(document, typeof(TDocument), id) + public CreateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.CreateRequest(document, id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceCreate; + public CreateRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.CreateRequest(document); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.CreateRequestDescriptor(Elastic.Clients.Elasticsearch.CreateRequest instance) => new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CreateRequest(Elastic.Clients.Elasticsearch.CreateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "create"; + /// + /// + /// A unique identifier for the document. + /// To automatically generate a document ID, use the POST /<target>/_doc/ request format. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// The name of the data stream or index to target. + /// If the target doesn't exist and matches the name or wildcard (*) pattern of an index template with a data_stream definition, this request creates the data stream. + /// If the target doesn't exist and doesn’t match a data stream template, this request creates the index. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor IfSeqNo(long? value) + { + Instance.IfSeqNo = value; + return this; + } + + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor IncludeSourceOnError(bool? value = true) + { + Instance.IncludeSourceOnError = value; + return this; + } + + /// + /// + /// Set to create to only index the document if it does not already exist (put if absent). + /// If a document with the specified _id already exists, the indexing operation will fail. + /// The behavior is the same as using the <index>/_create endpoint. + /// If a document ID is specified, this paramater defaults to index. + /// Otherwise, it defaults to create. + /// If the request targets a data stream, an op_type of create is required. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? value) + { + Instance.OpType = value; + return this; + } + + /// + /// + /// The ID of the pipeline to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, setting the value to _none turns off the default ingest pipeline for this request. + /// If a final pipeline is configured, it will always run regardless of the value of this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Pipeline(string? value) + { + Instance.Pipeline = value; + return this; + } - public CreateRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public CreateRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public CreateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public CreateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CreateRequestDescriptor Version(long? version) => Qs("version", version); - public CreateRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); - public CreateRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, it waits for a refresh to make this operation visible to search. + /// If false, it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - public CreateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor RequireAlias(bool? value = true) { - RouteValues.Required("id", id); - return Self; + Instance.RequireAlias = value; + return this; } - public CreateRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// If true, the request's actions must target a data stream (existing or to be created). + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor RequireDataStream(bool? value = true) { - RouteValues.Required("index", index); - return Self; + Instance.RequireDataStream = value; + return this; } - private TDocument DocumentValue { get; set; } + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + /// Elasticsearch waits for at least the specified timeout period before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + /// This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. + /// Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. + /// By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The explicit version number for concurrency control. + /// It must be a non-negative long number. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// You can set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value of 1 means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Document(TDocument value) + { + Instance.Document = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CreateRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(new Elastic.Clients.Elasticsearch.CreateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CreateRequestDescriptor Document(TDocument document) + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - DocumentValue = document; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CreateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - settings.SourceSerializer.Serialize(DocumentValue, writer); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs index 4f790c1c9c8..7be6879be5c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs @@ -17,51 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class CreateResponse : ElasticsearchResponse +internal sealed partial class CreateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForcedRefresh = System.Text.Json.JsonEncodedText.Encode("forced_refresh"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.CreateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForcedRefresh = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propResult = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShards = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForcedRefresh.TryReadProperty(ref reader, options, PropForcedRefresh, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CreateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForcedRefresh = propForcedRefresh.Value, + Id = propId.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Result = propResult.Value, + SeqNo = propSeqNo.Value, + Shards = propShards.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CreateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForcedRefresh, value.ForcedRefresh, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CreateResponseConverter))] +public sealed partial class CreateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("forced_refresh")] - public bool? ForcedRefresh { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? ForcedRefresh { get; set; } /// /// /// The unique identifier for the added document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the index the document was added to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The result of the indexing operation: created or updated. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } /// /// @@ -69,22 +187,27 @@ public sealed partial class CreateResponse : ElasticsearchResponse /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// /// Information about the replication process of the operation. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } /// /// /// The document version, which is incremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsRequest.g.cs index 0c05bca66b6..5dcdcf2040b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsRequest.g.cs @@ -17,63 +17,214 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class CcrStatsRequestParameters : RequestParameters +public sealed partial class CcrStatsRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class CcrStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get cross-cluster replication stats. +/// +/// /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. /// /// -public sealed partial class CcrStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestConverter))] +public sealed partial class CcrStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationStats; +#if NET7_0_OR_GREATER + public CcrStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public CcrStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CcrStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationStats; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ccr.stats"; + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Get cross-cluster replication stats. +/// +/// /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. /// /// -public sealed partial class CcrStatsRequestDescriptor : RequestDescriptor +public readonly partial struct CcrStatsRequestDescriptor { - internal CcrStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CcrStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest instance) + { + Instance = instance; + } public CcrStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationStats; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "ccr.stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsResponse.g.cs index 774d051bff4..c2d7f16dc72 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/CcrStatsResponse.g.cs @@ -17,19 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class CcrStatsResponse : ElasticsearchResponse +internal sealed partial class CcrStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("auto_follow_stats")] - public Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStats AutoFollowStats { get; init; } - [JsonInclude, JsonPropertyName("follow_stats")] - public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStats FollowStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAutoFollowStats = System.Text.Json.JsonEncodedText.Encode("auto_follow_stats"); + private static readonly System.Text.Json.JsonEncodedText PropFollowStats = System.Text.Json.JsonEncodedText.Encode("follow_stats"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAutoFollowStats = default; + LocalJsonValue propFollowStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAutoFollowStats.TryReadProperty(ref reader, options, PropAutoFollowStats, null)) + { + continue; + } + + if (propFollowStats.TryReadProperty(ref reader, options, PropFollowStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AutoFollowStats = propAutoFollowStats.Value, + FollowStats = propFollowStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAutoFollowStats, value.AutoFollowStats, null, null); + writer.WriteProperty(options, PropFollowStats, value.FollowStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponseConverter))] +public sealed partial class CcrStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CcrStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CcrStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Statistics for the auto-follow coordinator. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStats AutoFollowStats { get; set; } + + /// + /// + /// Shard-level statistics for follower indices. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStats FollowStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternRequest.g.cs index 838922632ca..51836ebfb64 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternRequest.g.cs @@ -17,73 +17,211 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class DeleteAutoFollowPatternRequestParameters : RequestParameters +public sealed partial class DeleteAutoFollowPatternRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class DeleteAutoFollowPatternRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete auto-follow patterns. +/// +/// /// Delete a collection of cross-cluster replication auto-follow patterns. /// /// -public sealed partial class DeleteAutoFollowPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestConverter))] +public sealed partial class DeleteAutoFollowPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteAutoFollowPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationDeleteAutoFollowPattern; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationDeleteAutoFollowPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ccr.delete_auto_follow_pattern"; + + /// + /// + /// The auto-follow pattern collection to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Delete auto-follow patterns. +/// +/// /// Delete a collection of cross-cluster replication auto-follow patterns. /// /// -public sealed partial class DeleteAutoFollowPatternRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteAutoFollowPatternRequestDescriptor { - internal DeleteAutoFollowPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest Instance { get; init; } - public DeleteAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationDeleteAutoFollowPattern; + public DeleteAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteAutoFollowPatternRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.delete_auto_follow_pattern"; + /// + /// + /// The auto-follow pattern collection to delete. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternResponse.g.cs index 99617d5ed3d..86c6ac311ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/DeleteAutoFollowPatternResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class DeleteAutoFollowPatternResponse : ElasticsearchResponse +internal sealed partial class DeleteAutoFollowPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponseConverter))] +public sealed partial class DeleteAutoFollowPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAutoFollowPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoRequest.g.cs index 75a456deb2a..cff1cbe2fef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoRequest.g.cs @@ -17,113 +17,320 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowInfoRequestParameters : RequestParameters +public sealed partial class FollowInfoRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class FollowInfoRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get follower information. +/// +/// /// Get information about all cross-cluster replication follower indices. /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. /// /// -public sealed partial class FollowInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestConverter))] +public sealed partial class FollowInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public FollowInfoRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public FollowInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowInfo; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationFollowInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ccr.follow_info"; + + /// + /// + /// A comma-delimited list of follower index patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Get follower information. +/// +/// /// Get information about all cross-cluster replication follower indices. /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. /// /// -public sealed partial class FollowInfoRequestDescriptor : RequestDescriptor, FollowInfoRequestParameters> +public readonly partial struct FollowInfoRequestDescriptor { - internal FollowInfoRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest Instance { get; init; } - public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest instance) { + Instance = instance; } - public FollowInfoRequestDescriptor() : this(typeof(TDocument)) + public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowInfo; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public FollowInfoRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// A comma-delimited list of follower index patterns. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "ccr.follow_info"; + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public FollowInfoRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest Build(System.Action action) { - RouteValues.Required("index", indices); - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Get follower information. +/// +/// /// Get information about all cross-cluster replication follower indices. /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. /// /// -public sealed partial class FollowInfoRequestDescriptor : RequestDescriptor +public readonly partial struct FollowInfoRequestDescriptor { - internal FollowInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest Instance { get; init; } - public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowInfo; + public FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public FollowInfoRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.follow_info"; + /// + /// + /// A comma-delimited list of follower index patterns. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public FollowInfoRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoResponse.g.cs index 54fcd7202df..3328e7f610e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowInfoResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowInfoResponse : ElasticsearchResponse +internal sealed partial class FollowInfoResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("follower_indices")] - public IReadOnlyCollection FollowerIndices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndices = System.Text.Json.JsonEncodedText.Encode("follower_indices"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFollowerIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFollowerIndices.TryReadProperty(ref reader, options, PropFollowerIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FollowerIndices = propFollowerIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFollowerIndices, value.FollowerIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponseConverter))] +public sealed partial class FollowInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FollowerIndices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowRequest.g.cs index bc1b6ba95fe..a789ac6515b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowRequest.g.cs @@ -17,29 +17,188 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowRequestParameters : RequestParameters +public sealed partial class FollowRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Sets the number of shard copies that must be active before returning. Defaults to 0. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be + /// active. + /// A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the + /// remote Lucene segment files to the follower index. /// /// public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class FollowRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataStreamName = System.Text.Json.JsonEncodedText.Encode("data_stream_name"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndex = System.Text.Json.JsonEncodedText.Encode("leader_index"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingWriteRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_read_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestSize = System.Text.Json.JsonEncodedText.Encode("max_read_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRetryDelay = System.Text.Json.JsonEncodedText.Encode("max_retry_delay"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferCount = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferSize = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_write_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestSize = System.Text.Json.JsonEncodedText.Encode("max_write_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropReadPollTimeout = System.Text.Json.JsonEncodedText.Encode("read_poll_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataStreamName = default; + LocalJsonValue propLeaderIndex = default; + LocalJsonValue propMaxOutstandingReadRequests = default; + LocalJsonValue propMaxOutstandingWriteRequests = default; + LocalJsonValue propMaxReadRequestOperationCount = default; + LocalJsonValue propMaxReadRequestSize = default; + LocalJsonValue propMaxRetryDelay = default; + LocalJsonValue propMaxWriteBufferCount = default; + LocalJsonValue propMaxWriteBufferSize = default; + LocalJsonValue propMaxWriteRequestOperationCount = default; + LocalJsonValue propMaxWriteRequestSize = default; + LocalJsonValue propReadPollTimeout = default; + LocalJsonValue propRemoteCluster = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreamName.TryReadProperty(ref reader, options, PropDataStreamName, null)) + { + continue; + } + + if (propLeaderIndex.TryReadProperty(ref reader, options, PropLeaderIndex, null)) + { + continue; + } + + if (propMaxOutstandingReadRequests.TryReadProperty(ref reader, options, PropMaxOutstandingReadRequests, null)) + { + continue; + } + + if (propMaxOutstandingWriteRequests.TryReadProperty(ref reader, options, PropMaxOutstandingWriteRequests, null)) + { + continue; + } + + if (propMaxReadRequestOperationCount.TryReadProperty(ref reader, options, PropMaxReadRequestOperationCount, null)) + { + continue; + } + + if (propMaxReadRequestSize.TryReadProperty(ref reader, options, PropMaxReadRequestSize, null)) + { + continue; + } + + if (propMaxRetryDelay.TryReadProperty(ref reader, options, PropMaxRetryDelay, null)) + { + continue; + } + + if (propMaxWriteBufferCount.TryReadProperty(ref reader, options, PropMaxWriteBufferCount, null)) + { + continue; + } + + if (propMaxWriteBufferSize.TryReadProperty(ref reader, options, PropMaxWriteBufferSize, null)) + { + continue; + } + + if (propMaxWriteRequestOperationCount.TryReadProperty(ref reader, options, PropMaxWriteRequestOperationCount, null)) + { + continue; + } + + if (propMaxWriteRequestSize.TryReadProperty(ref reader, options, PropMaxWriteRequestSize, null)) + { + continue; + } + + if (propReadPollTimeout.TryReadProperty(ref reader, options, PropReadPollTimeout, null)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreamName = propDataStreamName.Value, + LeaderIndex = propLeaderIndex.Value, + MaxOutstandingReadRequests = propMaxOutstandingReadRequests.Value, + MaxOutstandingWriteRequests = propMaxOutstandingWriteRequests.Value, + MaxReadRequestOperationCount = propMaxReadRequestOperationCount.Value, + MaxReadRequestSize = propMaxReadRequestSize.Value, + MaxRetryDelay = propMaxRetryDelay.Value, + MaxWriteBufferCount = propMaxWriteBufferCount.Value, + MaxWriteBufferSize = propMaxWriteBufferSize.Value, + MaxWriteRequestOperationCount = propMaxWriteRequestOperationCount.Value, + MaxWriteRequestSize = propMaxWriteRequestSize.Value, + ReadPollTimeout = propReadPollTimeout.Value, + RemoteCluster = propRemoteCluster.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreamName, value.DataStreamName, null, null); + writer.WriteProperty(options, PropLeaderIndex, value.LeaderIndex, null, null); + writer.WriteProperty(options, PropMaxOutstandingReadRequests, value.MaxOutstandingReadRequests, null, null); + writer.WriteProperty(options, PropMaxOutstandingWriteRequests, value.MaxOutstandingWriteRequests, null, null); + writer.WriteProperty(options, PropMaxReadRequestOperationCount, value.MaxReadRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxReadRequestSize, value.MaxReadRequestSize, null, null); + writer.WriteProperty(options, PropMaxRetryDelay, value.MaxRetryDelay, null, null); + writer.WriteProperty(options, PropMaxWriteBufferCount, value.MaxWriteBufferCount, null, null); + writer.WriteProperty(options, PropMaxWriteBufferSize, value.MaxWriteBufferSize, null, null); + writer.WriteProperty(options, PropMaxWriteRequestOperationCount, value.MaxWriteRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxWriteRequestSize, value.MaxWriteRequestSize, null, null); + writer.WriteProperty(options, PropReadPollTimeout, value.ReadPollTimeout, null, null); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create a follower. @@ -47,15 +206,35 @@ public sealed partial class FollowRequestParameters : RequestParameters /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. /// /// -public sealed partial class FollowRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestConverter))] +public sealed partial class FollowRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public FollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollow; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName leaderIndex, string remoteCluster) : base(r => r.Required("index", index)) + { + LeaderIndex = leaderIndex; + RemoteCluster = remoteCluster; + } +#if NET7_0_OR_GREATER + public FollowRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationFollow; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -63,35 +242,142 @@ public FollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => /// /// - /// Sets the number of shard copies that must be active before returning. Defaults to 0. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be + /// active. + /// A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the + /// remote Lucene segment files to the follower index. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } - [JsonInclude, JsonPropertyName("leader_index")] - public Elastic.Clients.Elasticsearch.IndexName? LeaderIndex { get; set; } - [JsonInclude, JsonPropertyName("max_outstanding_read_requests")] + + /// + /// + /// If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. + /// + /// + public string? DataStreamName { get; set; } + + /// + /// + /// The name of the index in the leader cluster to follow. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName LeaderIndex { get; set; } + + /// + /// + /// The maximum number of outstanding reads requests from the remote cluster. + /// + /// public long? MaxOutstandingReadRequests { get; set; } - [JsonInclude, JsonPropertyName("max_outstanding_write_requests")] - public long? MaxOutstandingWriteRequests { get; set; } - [JsonInclude, JsonPropertyName("max_read_request_operation_count")] - public long? MaxReadRequestOperationCount { get; set; } - [JsonInclude, JsonPropertyName("max_read_request_size")] - public string? MaxReadRequestSize { get; set; } - [JsonInclude, JsonPropertyName("max_retry_delay")] + + /// + /// + /// The maximum number of outstanding write requests on the follower. + /// + /// + public int? MaxOutstandingWriteRequests { get; set; } + + /// + /// + /// The maximum number of operations to pull per read from the remote cluster. + /// + /// + public int? MaxReadRequestOperationCount { get; set; } + + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxReadRequestSize { get; set; } + + /// + /// + /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when + /// retrying. + /// + /// public Elastic.Clients.Elasticsearch.Duration? MaxRetryDelay { get; set; } - [JsonInclude, JsonPropertyName("max_write_buffer_count")] - public long? MaxWriteBufferCount { get; set; } - [JsonInclude, JsonPropertyName("max_write_buffer_size")] - public string? MaxWriteBufferSize { get; set; } - [JsonInclude, JsonPropertyName("max_write_request_operation_count")] - public long? MaxWriteRequestOperationCount { get; set; } - [JsonInclude, JsonPropertyName("max_write_request_size")] - public string? MaxWriteRequestSize { get; set; } - [JsonInclude, JsonPropertyName("read_poll_timeout")] + + /// + /// + /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be + /// deferred until the number of queued operations goes below the limit. + /// + /// + public int? MaxWriteBufferCount { get; set; } + + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteBufferSize { get; set; } + + /// + /// + /// The maximum number of operations per bulk write request executed on the follower. + /// + /// + public int? MaxWriteRequestOperationCount { get; set; } + + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteRequestSize { get; set; } + + /// + /// + /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. + /// When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. + /// Then the follower will immediately attempt to read from the leader again. + /// + /// public Elastic.Clients.Elasticsearch.Duration? ReadPollTimeout { get; set; } - [JsonInclude, JsonPropertyName("remote_cluster")] - public string? RemoteCluster { get; set; } + + /// + /// + /// The remote cluster containing the leader index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string RemoteCluster { get; set; } + + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } } /// @@ -101,195 +387,342 @@ public FollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. /// /// -public sealed partial class FollowRequestDescriptor : RequestDescriptor, FollowRequestParameters> +public readonly partial struct FollowRequestDescriptor { - internal FollowRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest Instance { get; init; } - public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest instance) { + Instance = instance; } - public FollowRequestDescriptor() : this(typeof(TDocument)) + public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(index); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollow; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public FollowRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ccr.follow"; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public FollowRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be + /// active. + /// A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the + /// remote Lucene segment files to the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } - public FollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor DataStreamName(string? value) { - RouteValues.Required("index", index); - return Self; + Instance.DataStreamName = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexName? LeaderIndexValue { get; set; } - private long? MaxOutstandingReadRequestsValue { get; set; } - private long? MaxOutstandingWriteRequestsValue { get; set; } - private long? MaxReadRequestOperationCountValue { get; set; } - private string? MaxReadRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MaxRetryDelayValue { get; set; } - private long? MaxWriteBufferCountValue { get; set; } - private string? MaxWriteBufferSizeValue { get; set; } - private long? MaxWriteRequestOperationCountValue { get; set; } - private string? MaxWriteRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ReadPollTimeoutValue { get; set; } - private string? RemoteClusterValue { get; set; } + /// + /// + /// The name of the index in the leader cluster to follow. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor LeaderIndex(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.LeaderIndex = value; + return this; + } - public FollowRequestDescriptor LeaderIndex(Elastic.Clients.Elasticsearch.IndexName? leaderIndex) + /// + /// + /// The maximum number of outstanding reads requests from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxOutstandingReadRequests(long? value) { - LeaderIndexValue = leaderIndex; - return Self; + Instance.MaxOutstandingReadRequests = value; + return this; } - public FollowRequestDescriptor MaxOutstandingReadRequests(long? maxOutstandingReadRequests) + /// + /// + /// The maximum number of outstanding write requests on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxOutstandingWriteRequests(int? value) { - MaxOutstandingReadRequestsValue = maxOutstandingReadRequests; - return Self; + Instance.MaxOutstandingWriteRequests = value; + return this; } - public FollowRequestDescriptor MaxOutstandingWriteRequests(long? maxOutstandingWriteRequests) + /// + /// + /// The maximum number of operations to pull per read from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestOperationCount(int? value) { - MaxOutstandingWriteRequestsValue = maxOutstandingWriteRequests; - return Self; + Instance.MaxReadRequestOperationCount = value; + return this; } - public FollowRequestDescriptor MaxReadRequestOperationCount(long? maxReadRequestOperationCount) + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxReadRequestOperationCountValue = maxReadRequestOperationCount; - return Self; + Instance.MaxReadRequestSize = value; + return this; } - public FollowRequestDescriptor MaxReadRequestSize(string? maxReadRequestSize) + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestSize(System.Func action) { - MaxReadRequestSizeValue = maxReadRequestSize; - return Self; + Instance.MaxReadRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public FollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? maxRetryDelay) + /// + /// + /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when + /// retrying. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - MaxRetryDelayValue = maxRetryDelay; - return Self; + Instance.MaxRetryDelay = value; + return this; } - public FollowRequestDescriptor MaxWriteBufferCount(long? maxWriteBufferCount) + /// + /// + /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be + /// deferred until the number of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferCount(int? value) { - MaxWriteBufferCountValue = maxWriteBufferCount; - return Self; + Instance.MaxWriteBufferCount = value; + return this; } - public FollowRequestDescriptor MaxWriteBufferSize(string? maxWriteBufferSize) + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxWriteBufferSizeValue = maxWriteBufferSize; - return Self; + Instance.MaxWriteBufferSize = value; + return this; } - public FollowRequestDescriptor MaxWriteRequestOperationCount(long? maxWriteRequestOperationCount) + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferSize(System.Func action) { - MaxWriteRequestOperationCountValue = maxWriteRequestOperationCount; - return Self; + Instance.MaxWriteBufferSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public FollowRequestDescriptor MaxWriteRequestSize(string? maxWriteRequestSize) + /// + /// + /// The maximum number of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestOperationCount(int? value) { - MaxWriteRequestSizeValue = maxWriteRequestSize; - return Self; + Instance.MaxWriteRequestOperationCount = value; + return this; } - public FollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? readPollTimeout) + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - ReadPollTimeoutValue = readPollTimeout; - return Self; + Instance.MaxWriteRequestSize = value; + return this; } - public FollowRequestDescriptor RemoteCluster(string? remoteCluster) + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestSize(System.Func action) { - RemoteClusterValue = remoteCluster; - return Self; + Instance.MaxWriteRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. + /// When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. + /// Then the follower will immediately attempt to read from the leader again. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (LeaderIndexValue is not null) - { - writer.WritePropertyName("leader_index"); - JsonSerializer.Serialize(writer, LeaderIndexValue, options); - } + Instance.ReadPollTimeout = value; + return this; + } - if (MaxOutstandingReadRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_read_requests"); - writer.WriteNumberValue(MaxOutstandingReadRequestsValue.Value); - } + /// + /// + /// The remote cluster containing the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RemoteCluster(string value) + { + Instance.RemoteCluster = value; + return this; + } - if (MaxOutstandingWriteRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_write_requests"); - writer.WriteNumberValue(MaxOutstandingWriteRequestsValue.Value); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.Settings = value; + return this; + } - if (MaxReadRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_read_request_operation_count"); - writer.WriteNumberValue(MaxReadRequestOperationCountValue.Value); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } - if (!string.IsNullOrEmpty(MaxReadRequestSizeValue)) - { - writer.WritePropertyName("max_read_request_size"); - writer.WriteStringValue(MaxReadRequestSizeValue); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MaxRetryDelayValue is not null) - { - writer.WritePropertyName("max_retry_delay"); - JsonSerializer.Serialize(writer, MaxRetryDelayValue, options); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MaxWriteBufferCountValue.HasValue) - { - writer.WritePropertyName("max_write_buffer_count"); - writer.WriteNumberValue(MaxWriteBufferCountValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(MaxWriteBufferSizeValue)) - { - writer.WritePropertyName("max_write_buffer_size"); - writer.WriteStringValue(MaxWriteBufferSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxWriteRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_write_request_operation_count"); - writer.WriteNumberValue(MaxWriteRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteRequestSizeValue)) - { - writer.WritePropertyName("max_write_request_size"); - writer.WriteStringValue(MaxWriteRequestSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ReadPollTimeoutValue is not null) - { - writer.WritePropertyName("read_poll_timeout"); - JsonSerializer.Serialize(writer, ReadPollTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(RemoteClusterValue)) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStringValue(RemoteClusterValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -300,190 +733,331 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. /// /// -public sealed partial class FollowRequestDescriptor : RequestDescriptor +public readonly partial struct FollowRequestDescriptor { - internal FollowRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest Instance { get; init; } - public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollow; + public FollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(index); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public FollowRequestDescriptor() + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(typeof(TDocument)); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.follow"; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public FollowRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public FollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be + /// active. + /// A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the + /// remote Lucene segment files to the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) { - RouteValues.Required("index", index); - return Self; + Instance.WaitForActiveShards = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexName? LeaderIndexValue { get; set; } - private long? MaxOutstandingReadRequestsValue { get; set; } - private long? MaxOutstandingWriteRequestsValue { get; set; } - private long? MaxReadRequestOperationCountValue { get; set; } - private string? MaxReadRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MaxRetryDelayValue { get; set; } - private long? MaxWriteBufferCountValue { get; set; } - private string? MaxWriteBufferSizeValue { get; set; } - private long? MaxWriteRequestOperationCountValue { get; set; } - private string? MaxWriteRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ReadPollTimeoutValue { get; set; } - private string? RemoteClusterValue { get; set; } + /// + /// + /// If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor DataStreamName(string? value) + { + Instance.DataStreamName = value; + return this; + } - public FollowRequestDescriptor LeaderIndex(Elastic.Clients.Elasticsearch.IndexName? leaderIndex) + /// + /// + /// The name of the index in the leader cluster to follow. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor LeaderIndex(Elastic.Clients.Elasticsearch.IndexName value) { - LeaderIndexValue = leaderIndex; - return Self; + Instance.LeaderIndex = value; + return this; } - public FollowRequestDescriptor MaxOutstandingReadRequests(long? maxOutstandingReadRequests) + /// + /// + /// The maximum number of outstanding reads requests from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxOutstandingReadRequests(long? value) { - MaxOutstandingReadRequestsValue = maxOutstandingReadRequests; - return Self; + Instance.MaxOutstandingReadRequests = value; + return this; } - public FollowRequestDescriptor MaxOutstandingWriteRequests(long? maxOutstandingWriteRequests) + /// + /// + /// The maximum number of outstanding write requests on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxOutstandingWriteRequests(int? value) { - MaxOutstandingWriteRequestsValue = maxOutstandingWriteRequests; - return Self; + Instance.MaxOutstandingWriteRequests = value; + return this; } - public FollowRequestDescriptor MaxReadRequestOperationCount(long? maxReadRequestOperationCount) + /// + /// + /// The maximum number of operations to pull per read from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestOperationCount(int? value) { - MaxReadRequestOperationCountValue = maxReadRequestOperationCount; - return Self; + Instance.MaxReadRequestOperationCount = value; + return this; } - public FollowRequestDescriptor MaxReadRequestSize(string? maxReadRequestSize) + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxReadRequestSizeValue = maxReadRequestSize; - return Self; + Instance.MaxReadRequestSize = value; + return this; } - public FollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? maxRetryDelay) + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxReadRequestSize(System.Func action) { - MaxRetryDelayValue = maxRetryDelay; - return Self; + Instance.MaxReadRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public FollowRequestDescriptor MaxWriteBufferCount(long? maxWriteBufferCount) + /// + /// + /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when + /// retrying. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - MaxWriteBufferCountValue = maxWriteBufferCount; - return Self; + Instance.MaxRetryDelay = value; + return this; } - public FollowRequestDescriptor MaxWriteBufferSize(string? maxWriteBufferSize) + /// + /// + /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be + /// deferred until the number of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferCount(int? value) { - MaxWriteBufferSizeValue = maxWriteBufferSize; - return Self; + Instance.MaxWriteBufferCount = value; + return this; } - public FollowRequestDescriptor MaxWriteRequestOperationCount(long? maxWriteRequestOperationCount) + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxWriteRequestOperationCountValue = maxWriteRequestOperationCount; - return Self; + Instance.MaxWriteBufferSize = value; + return this; } - public FollowRequestDescriptor MaxWriteRequestSize(string? maxWriteRequestSize) + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteBufferSize(System.Func action) { - MaxWriteRequestSizeValue = maxWriteRequestSize; - return Self; + Instance.MaxWriteBufferSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public FollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? readPollTimeout) + /// + /// + /// The maximum number of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestOperationCount(int? value) { - ReadPollTimeoutValue = readPollTimeout; - return Self; + Instance.MaxWriteRequestOperationCount = value; + return this; } - public FollowRequestDescriptor RemoteCluster(string? remoteCluster) + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - RemoteClusterValue = remoteCluster; - return Self; + Instance.MaxWriteRequestSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor MaxWriteRequestSize(System.Func action) { - writer.WriteStartObject(); - if (LeaderIndexValue is not null) - { - writer.WritePropertyName("leader_index"); - JsonSerializer.Serialize(writer, LeaderIndexValue, options); - } + Instance.MaxWriteRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxOutstandingReadRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_read_requests"); - writer.WriteNumberValue(MaxOutstandingReadRequestsValue.Value); - } + /// + /// + /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. + /// When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. + /// Then the follower will immediately attempt to read from the leader again. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.ReadPollTimeout = value; + return this; + } - if (MaxOutstandingWriteRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_write_requests"); - writer.WriteNumberValue(MaxOutstandingWriteRequestsValue.Value); - } + /// + /// + /// The remote cluster containing the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RemoteCluster(string value) + { + Instance.RemoteCluster = value; + return this; + } - if (MaxReadRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_read_request_operation_count"); - writer.WriteNumberValue(MaxReadRequestOperationCountValue.Value); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.Settings = value; + return this; + } - if (!string.IsNullOrEmpty(MaxReadRequestSizeValue)) - { - writer.WritePropertyName("max_read_request_size"); - writer.WriteStringValue(MaxReadRequestSizeValue); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } - if (MaxRetryDelayValue is not null) - { - writer.WritePropertyName("max_retry_delay"); - JsonSerializer.Serialize(writer, MaxRetryDelayValue, options); - } + /// + /// + /// Settings to override from the leader index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MaxWriteBufferCountValue.HasValue) - { - writer.WritePropertyName("max_write_buffer_count"); - writer.WriteNumberValue(MaxWriteBufferCountValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(MaxWriteBufferSizeValue)) - { - writer.WritePropertyName("max_write_buffer_size"); - writer.WriteStringValue(MaxWriteBufferSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxWriteRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_write_request_operation_count"); - writer.WriteNumberValue(MaxWriteRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteRequestSizeValue)) - { - writer.WritePropertyName("max_write_request_size"); - writer.WriteStringValue(MaxWriteRequestSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ReadPollTimeoutValue is not null) - { - writer.WritePropertyName("read_poll_timeout"); - JsonSerializer.Serialize(writer, ReadPollTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(RemoteClusterValue)) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStringValue(RemoteClusterValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowResponse.g.cs index c30f351af3c..27e39e69f74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowResponse : ElasticsearchResponse +internal sealed partial class FollowResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("follow_index_created")] - public bool FollowIndexCreated { get; init; } - [JsonInclude, JsonPropertyName("follow_index_shards_acked")] - public bool FollowIndexShardsAcked { get; init; } - [JsonInclude, JsonPropertyName("index_following_started")] - public bool IndexFollowingStarted { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropFollowIndexCreated = System.Text.Json.JsonEncodedText.Encode("follow_index_created"); + private static readonly System.Text.Json.JsonEncodedText PropFollowIndexShardsAcked = System.Text.Json.JsonEncodedText.Encode("follow_index_shards_acked"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFollowingStarted = System.Text.Json.JsonEncodedText.Encode("index_following_started"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFollowIndexCreated = default; + LocalJsonValue propFollowIndexShardsAcked = default; + LocalJsonValue propIndexFollowingStarted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFollowIndexCreated.TryReadProperty(ref reader, options, PropFollowIndexCreated, null)) + { + continue; + } + + if (propFollowIndexShardsAcked.TryReadProperty(ref reader, options, PropFollowIndexShardsAcked, null)) + { + continue; + } + + if (propIndexFollowingStarted.TryReadProperty(ref reader, options, PropIndexFollowingStarted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FollowIndexCreated = propFollowIndexCreated.Value, + FollowIndexShardsAcked = propFollowIndexShardsAcked.Value, + IndexFollowingStarted = propIndexFollowingStarted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFollowIndexCreated, value.FollowIndexCreated, null, null); + writer.WriteProperty(options, PropFollowIndexShardsAcked, value.FollowIndexShardsAcked, null, null); + writer.WriteProperty(options, PropIndexFollowingStarted, value.IndexFollowingStarted, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponseConverter))] +public sealed partial class FollowResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool FollowIndexCreated { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool FollowIndexShardsAcked { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IndexFollowingStarted { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsRequest.g.cs index a08fd5c57f4..6c870091ac3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsRequest.g.cs @@ -17,113 +17,316 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowStatsRequestParameters : RequestParameters +public sealed partial class FollowStatsRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class FollowStatsRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get follower stats. +/// +/// /// Get cross-cluster replication follower stats. /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. /// /// -public sealed partial class FollowStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestConverter))] +public sealed partial class FollowStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public FollowStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public FollowStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationFollowStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ccr.follow_stats"; + + /// + /// + /// A comma-delimited list of index patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Get follower stats. +/// +/// /// Get cross-cluster replication follower stats. /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. /// /// -public sealed partial class FollowStatsRequestDescriptor : RequestDescriptor, FollowStatsRequestParameters> +public readonly partial struct FollowStatsRequestDescriptor { - internal FollowStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest Instance { get; init; } - public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest instance) { + Instance = instance; } - public FollowStatsRequestDescriptor() : this(typeof(TDocument)) + public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowStats; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public FollowStatsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// A comma-delimited list of index patterns. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "ccr.follow_stats"; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public FollowStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest Build(System.Action action) { - RouteValues.Required("index", indices); - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Get follower stats. +/// +/// /// Get cross-cluster replication follower stats. /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. /// /// -public sealed partial class FollowStatsRequestDescriptor : RequestDescriptor +public readonly partial struct FollowStatsRequestDescriptor { - internal FollowStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest Instance { get; init; } - public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationFollowStats; + public FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public FollowStatsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.follow_stats"; + /// + /// + /// A comma-delimited list of index patterns. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public FollowStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsResponse.g.cs index 46fc142371f..f2736a8c53d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/FollowStatsResponse.g.cs @@ -17,17 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class FollowStatsResponse : ElasticsearchResponse +internal sealed partial class FollowStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponseConverter))] +public sealed partial class FollowStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// An array of follower index statistics. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerRequest.g.cs index 83afef716e7..a3d3f4a5625 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerRequest.g.cs @@ -17,21 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ForgetFollowerRequestParameters : RequestParameters +public sealed partial class ForgetFollowerRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class ForgetFollowerRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFollowerCluster = System.Text.Json.JsonEncodedText.Encode("follower_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndex = System.Text.Json.JsonEncodedText.Encode("follower_index"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndexUuid = System.Text.Json.JsonEncodedText.Encode("follower_index_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderRemoteCluster = System.Text.Json.JsonEncodedText.Encode("leader_remote_cluster"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFollowerCluster = default; + LocalJsonValue propFollowerIndex = default; + LocalJsonValue propFollowerIndexUuid = default; + LocalJsonValue propLeaderRemoteCluster = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFollowerCluster.TryReadProperty(ref reader, options, PropFollowerCluster, null)) + { + continue; + } + + if (propFollowerIndex.TryReadProperty(ref reader, options, PropFollowerIndex, null)) + { + continue; + } + + if (propFollowerIndexUuid.TryReadProperty(ref reader, options, PropFollowerIndexUuid, null)) + { + continue; + } + + if (propLeaderRemoteCluster.TryReadProperty(ref reader, options, PropLeaderRemoteCluster, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FollowerCluster = propFollowerCluster.Value, + FollowerIndex = propFollowerIndex.Value, + FollowerIndexUuid = propFollowerIndexUuid.Value, + LeaderRemoteCluster = propLeaderRemoteCluster.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFollowerCluster, value.FollowerCluster, null, null); + writer.WriteProperty(options, PropFollowerIndex, value.FollowerIndex, null, null); + writer.WriteProperty(options, PropFollowerIndexUuid, value.FollowerIndexUuid, null, null); + writer.WriteProperty(options, PropLeaderRemoteCluster, value.LeaderRemoteCluster, null, null); + writer.WriteEndObject(); + } } /// @@ -52,27 +117,52 @@ public sealed partial class ForgetFollowerRequestParameters : RequestParameters /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. /// /// -public sealed partial class ForgetFollowerRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestConverter))] +public sealed partial class ForgetFollowerRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ForgetFollowerRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public ForgetFollowerRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForgetFollowerRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationForgetFollower; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationForgetFollower; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ccr.forget_follower"; - [JsonInclude, JsonPropertyName("follower_cluster")] + /// + /// + /// the name of the leader index for which specified follower retention leases should be removed + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } public string? FollowerCluster { get; set; } - [JsonInclude, JsonPropertyName("follower_index")] public Elastic.Clients.Elasticsearch.IndexName? FollowerIndex { get; set; } - [JsonInclude, JsonPropertyName("follower_index_uuid")] public string? FollowerIndexUuid { get; set; } - [JsonInclude, JsonPropertyName("leader_remote_cluster")] public string? LeaderRemoteCluster { get; set; } } @@ -94,89 +184,124 @@ public ForgetFollowerRequest(Elastic.Clients.Elasticsearch.IndexName index) : ba /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. /// /// -public sealed partial class ForgetFollowerRequestDescriptor : RequestDescriptor, ForgetFollowerRequestParameters> +public readonly partial struct ForgetFollowerRequestDescriptor { - internal ForgetFollowerRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest Instance { get; init; } - public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest instance) { + Instance = instance; } - public ForgetFollowerRequestDescriptor() : this(typeof(TDocument)) + public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationForgetFollower; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ForgetFollowerRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// the name of the leader index for which specified follower retention leases should be removed + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ccr.forget_follower"; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public ForgetFollowerRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerCluster(string? value) { - RouteValues.Required("index", index); - return Self; + Instance.FollowerCluster = value; + return this; } - private string? FollowerClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? FollowerIndexValue { get; set; } - private string? FollowerIndexUuidValue { get; set; } - private string? LeaderRemoteClusterValue { get; set; } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.FollowerIndex = value; + return this; + } - public ForgetFollowerRequestDescriptor FollowerCluster(string? followerCluster) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerIndexUuid(string? value) { - FollowerClusterValue = followerCluster; - return Self; + Instance.FollowerIndexUuid = value; + return this; } - public ForgetFollowerRequestDescriptor FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? followerIndex) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor LeaderRemoteCluster(string? value) { - FollowerIndexValue = followerIndex; - return Self; + Instance.LeaderRemoteCluster = value; + return this; } - public ForgetFollowerRequestDescriptor FollowerIndexUuid(string? followerIndexUuid) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest Build(System.Action action) { - FollowerIndexUuidValue = followerIndexUuid; - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public ForgetFollowerRequestDescriptor LeaderRemoteCluster(string? leaderRemoteCluster) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor ErrorTrace(bool? value) { - LeaderRemoteClusterValue = leaderRemoteCluster; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FollowerClusterValue)) - { - writer.WritePropertyName("follower_cluster"); - writer.WriteStringValue(FollowerClusterValue); - } + Instance.FilterPath = value; + return this; + } - if (FollowerIndexValue is not null) - { - writer.WritePropertyName("follower_index"); - JsonSerializer.Serialize(writer, FollowerIndexValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(FollowerIndexUuidValue)) - { - writer.WritePropertyName("follower_index_uuid"); - writer.WriteStringValue(FollowerIndexUuidValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(LeaderRemoteClusterValue)) - { - writer.WritePropertyName("leader_remote_cluster"); - writer.WriteStringValue(LeaderRemoteClusterValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -198,84 +323,122 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. /// /// -public sealed partial class ForgetFollowerRequestDescriptor : RequestDescriptor +public readonly partial struct ForgetFollowerRequestDescriptor { - internal ForgetFollowerRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest Instance { get; init; } - public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationForgetFollower; + public ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ForgetFollowerRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(typeof(TDocument)); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.forget_follower"; + /// + /// + /// the name of the leader index for which specified follower retention leases should be removed + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public ForgetFollowerRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.Timeout = value; + return this; } - private string? FollowerClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? FollowerIndexValue { get; set; } - private string? FollowerIndexUuidValue { get; set; } - private string? LeaderRemoteClusterValue { get; set; } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerCluster(string? value) + { + Instance.FollowerCluster = value; + return this; + } - public ForgetFollowerRequestDescriptor FollowerCluster(string? followerCluster) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? value) { - FollowerClusterValue = followerCluster; - return Self; + Instance.FollowerIndex = value; + return this; } - public ForgetFollowerRequestDescriptor FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? followerIndex) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FollowerIndexUuid(string? value) { - FollowerIndexValue = followerIndex; - return Self; + Instance.FollowerIndexUuid = value; + return this; } - public ForgetFollowerRequestDescriptor FollowerIndexUuid(string? followerIndexUuid) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor LeaderRemoteCluster(string? value) { - FollowerIndexUuidValue = followerIndexUuid; - return Self; + Instance.LeaderRemoteCluster = value; + return this; } - public ForgetFollowerRequestDescriptor LeaderRemoteCluster(string? leaderRemoteCluster) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest Build(System.Action> action) { - LeaderRemoteClusterValue = leaderRemoteCluster; - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FollowerClusterValue)) - { - writer.WritePropertyName("follower_cluster"); - writer.WriteStringValue(FollowerClusterValue); - } + Instance.ErrorTrace = value; + return this; + } - if (FollowerIndexValue is not null) - { - writer.WritePropertyName("follower_index"); - JsonSerializer.Serialize(writer, FollowerIndexValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(FollowerIndexUuidValue)) - { - writer.WritePropertyName("follower_index_uuid"); - writer.WriteStringValue(FollowerIndexUuidValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(LeaderRemoteClusterValue)) - { - writer.WritePropertyName("leader_remote_cluster"); - writer.WriteStringValue(LeaderRemoteClusterValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerResponse.g.cs index cb86186b4b9..e3a0a2fc62d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ForgetFollowerResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ForgetFollowerResponse : ElasticsearchResponse +internal sealed partial class ForgetFollowerResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponseConverter))] +public sealed partial class ForgetFollowerResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForgetFollowerResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForgetFollowerResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternRequest.g.cs index 0d67104509e..2ad171efd7e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternRequest.g.cs @@ -17,81 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class GetAutoFollowPatternRequestParameters : RequestParameters +public sealed partial class GetAutoFollowPatternRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class GetAutoFollowPatternRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get auto-follow patterns. +/// +/// /// Get cross-cluster replication auto-follow patterns. /// /// -public sealed partial class GetAutoFollowPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestConverter))] +public sealed partial class GetAutoFollowPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetAutoFollowPatternRequest() { } - - public GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetAutoFollowPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationGetAutoFollowPattern; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationGetAutoFollowPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ccr.get_auto_follow_pattern"; + + /// + /// + /// The auto-follow pattern collection that you want to retrieve. + /// If you do not specify a name, the API returns information for all collections. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("name"); set => PO("name", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Get auto-follow patterns. +/// +/// /// Get cross-cluster replication auto-follow patterns. /// /// -public sealed partial class GetAutoFollowPatternRequestDescriptor : RequestDescriptor +public readonly partial struct GetAutoFollowPatternRequestDescriptor { - internal GetAutoFollowPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest Instance { get; init; } - public GetAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest instance) { + Instance = instance; + } + + public GetAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(name); } public GetAutoFollowPatternRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationGetAutoFollowPattern; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The auto-follow pattern collection that you want to retrieve. + /// If you do not specify a name, the API returns information for all collections. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "ccr.get_auto_follow_pattern"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternResponse.g.cs index 7e0562b9122..cf963f54cb1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/GetAutoFollowPatternResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class GetAutoFollowPatternResponse : ElasticsearchResponse +internal sealed partial class GetAutoFollowPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("patterns")] - public IReadOnlyCollection Patterns { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropPatterns = System.Text.Json.JsonEncodedText.Encode("patterns"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPatterns = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPatterns.TryReadProperty(ref reader, options, PropPatterns, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Patterns = propPatterns.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPatterns, value.Patterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponseConverter))] +public sealed partial class GetAutoFollowPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAutoFollowPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Patterns { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternRequest.g.cs index 6d1d06ba408..5bc3e388ded 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternRequest.g.cs @@ -17,26 +17,58 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PauseAutoFollowPatternRequestParameters : RequestParameters +public sealed partial class PauseAutoFollowPatternRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class PauseAutoFollowPatternRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Pause an auto-follow pattern. +/// +/// /// Pause a cross-cluster replication auto-follow pattern. /// When the API returns, the auto-follow pattern is inactive. /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. @@ -47,24 +79,58 @@ public sealed partial class PauseAutoFollowPatternRequestParameters : RequestPar /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. /// /// -public sealed partial class PauseAutoFollowPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestConverter))] +public sealed partial class PauseAutoFollowPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PauseAutoFollowPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPauseAutoFollowPattern; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationPauseAutoFollowPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ccr.pause_auto_follow_pattern"; + + /// + /// + /// The name of the auto-follow pattern to pause. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Pause an auto-follow pattern. +/// +/// /// Pause a cross-cluster replication auto-follow pattern. /// When the API returns, the auto-follow pattern is inactive. /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. @@ -75,29 +141,101 @@ public PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. /// /// -public sealed partial class PauseAutoFollowPatternRequestDescriptor : RequestDescriptor +public readonly partial struct PauseAutoFollowPatternRequestDescriptor { - internal PauseAutoFollowPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest Instance { get; init; } - public PauseAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PauseAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPauseAutoFollowPattern; + public PauseAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PauseAutoFollowPatternRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.pause_auto_follow_pattern"; + /// + /// + /// The name of the auto-follow pattern to pause. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public PauseAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternResponse.g.cs index bb6d5fb3a2e..bb457f750c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseAutoFollowPatternResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PauseAutoFollowPatternResponse : ElasticsearchResponse +internal sealed partial class PauseAutoFollowPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponseConverter))] +public sealed partial class PauseAutoFollowPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PauseAutoFollowPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PauseAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowRequest.g.cs index ba974a7ce62..1c168128cc9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowRequest.g.cs @@ -17,119 +17,326 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PauseFollowRequestParameters : RequestParameters +public sealed partial class PauseFollowRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class PauseFollowRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Pause a follower. +/// +/// /// Pause a cross-cluster replication follower index. /// The follower index will not fetch any additional operations from the leader index. /// You can resume following with the resume follower API. /// You can pause and resume a follower index to change the configuration of the following task. /// /// -public sealed partial class PauseFollowRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestConverter))] +public sealed partial class PauseFollowRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PauseFollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public PauseFollowRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PauseFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPauseFollow; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationPauseFollow; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ccr.pause_follow"; + + /// + /// + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Pause a follower. +/// +/// /// Pause a cross-cluster replication follower index. /// The follower index will not fetch any additional operations from the leader index. /// You can resume following with the resume follower API. /// You can pause and resume a follower index to change the configuration of the following task. /// /// -public sealed partial class PauseFollowRequestDescriptor : RequestDescriptor, PauseFollowRequestParameters> +public readonly partial struct PauseFollowRequestDescriptor { - internal PauseFollowRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest Instance { get; init; } - public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest instance) { + Instance = instance; } - public PauseFollowRequestDescriptor() : this(typeof(TDocument)) + public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPauseFollow; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PauseFollowRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ccr.pause_follow"; + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public PauseFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest Build(System.Action action) { - RouteValues.Required("index", index); - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Pause a follower. +/// +/// /// Pause a cross-cluster replication follower index. /// The follower index will not fetch any additional operations from the leader index. /// You can resume following with the resume follower API. /// You can pause and resume a follower index to change the configuration of the following task. /// /// -public sealed partial class PauseFollowRequestDescriptor : RequestDescriptor +public readonly partial struct PauseFollowRequestDescriptor { - internal PauseFollowRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest Instance { get; init; } - public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPauseFollow; + public PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public PauseFollowRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.pause_follow"; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public PauseFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowResponse.g.cs index 1d2496b5ce9..84966187fa8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PauseFollowResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PauseFollowResponse : ElasticsearchResponse +internal sealed partial class PauseFollowResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponseConverter))] +public sealed partial class PauseFollowResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PauseFollowResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PauseFollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternRequest.g.cs index 0d2b49c3377..a77e49be32e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternRequest.g.cs @@ -17,21 +17,185 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PutAutoFollowPatternRequestParameters : RequestParameters +public sealed partial class PutAutoFollowPatternRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class PutAutoFollowPatternRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFollowIndexPattern = System.Text.Json.JsonEncodedText.Encode("follow_index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndexExclusionPatterns = System.Text.Json.JsonEncodedText.Encode("leader_index_exclusion_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndexPatterns = System.Text.Json.JsonEncodedText.Encode("leader_index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingWriteRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_read_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestSize = System.Text.Json.JsonEncodedText.Encode("max_read_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRetryDelay = System.Text.Json.JsonEncodedText.Encode("max_retry_delay"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferCount = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferSize = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_write_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestSize = System.Text.Json.JsonEncodedText.Encode("max_write_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropReadPollTimeout = System.Text.Json.JsonEncodedText.Encode("read_poll_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFollowIndexPattern = default; + LocalJsonValue?> propLeaderIndexExclusionPatterns = default; + LocalJsonValue?> propLeaderIndexPatterns = default; + LocalJsonValue propMaxOutstandingReadRequests = default; + LocalJsonValue propMaxOutstandingWriteRequests = default; + LocalJsonValue propMaxReadRequestOperationCount = default; + LocalJsonValue propMaxReadRequestSize = default; + LocalJsonValue propMaxRetryDelay = default; + LocalJsonValue propMaxWriteBufferCount = default; + LocalJsonValue propMaxWriteBufferSize = default; + LocalJsonValue propMaxWriteRequestOperationCount = default; + LocalJsonValue propMaxWriteRequestSize = default; + LocalJsonValue propReadPollTimeout = default; + LocalJsonValue propRemoteCluster = default; + LocalJsonValue?> propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFollowIndexPattern.TryReadProperty(ref reader, options, PropFollowIndexPattern, null)) + { + continue; + } + + if (propLeaderIndexExclusionPatterns.TryReadProperty(ref reader, options, PropLeaderIndexExclusionPatterns, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propLeaderIndexPatterns.TryReadProperty(ref reader, options, PropLeaderIndexPatterns, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMaxOutstandingReadRequests.TryReadProperty(ref reader, options, PropMaxOutstandingReadRequests, null)) + { + continue; + } + + if (propMaxOutstandingWriteRequests.TryReadProperty(ref reader, options, PropMaxOutstandingWriteRequests, null)) + { + continue; + } + + if (propMaxReadRequestOperationCount.TryReadProperty(ref reader, options, PropMaxReadRequestOperationCount, null)) + { + continue; + } + + if (propMaxReadRequestSize.TryReadProperty(ref reader, options, PropMaxReadRequestSize, null)) + { + continue; + } + + if (propMaxRetryDelay.TryReadProperty(ref reader, options, PropMaxRetryDelay, null)) + { + continue; + } + + if (propMaxWriteBufferCount.TryReadProperty(ref reader, options, PropMaxWriteBufferCount, null)) + { + continue; + } + + if (propMaxWriteBufferSize.TryReadProperty(ref reader, options, PropMaxWriteBufferSize, null)) + { + continue; + } + + if (propMaxWriteRequestOperationCount.TryReadProperty(ref reader, options, PropMaxWriteRequestOperationCount, null)) + { + continue; + } + + if (propMaxWriteRequestSize.TryReadProperty(ref reader, options, PropMaxWriteRequestSize, null)) + { + continue; + } + + if (propReadPollTimeout.TryReadProperty(ref reader, options, PropReadPollTimeout, null)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FollowIndexPattern = propFollowIndexPattern.Value, + LeaderIndexExclusionPatterns = propLeaderIndexExclusionPatterns.Value, + LeaderIndexPatterns = propLeaderIndexPatterns.Value, + MaxOutstandingReadRequests = propMaxOutstandingReadRequests.Value, + MaxOutstandingWriteRequests = propMaxOutstandingWriteRequests.Value, + MaxReadRequestOperationCount = propMaxReadRequestOperationCount.Value, + MaxReadRequestSize = propMaxReadRequestSize.Value, + MaxRetryDelay = propMaxRetryDelay.Value, + MaxWriteBufferCount = propMaxWriteBufferCount.Value, + MaxWriteBufferSize = propMaxWriteBufferSize.Value, + MaxWriteRequestOperationCount = propMaxWriteRequestOperationCount.Value, + MaxWriteRequestSize = propMaxWriteRequestSize.Value, + ReadPollTimeout = propReadPollTimeout.Value, + RemoteCluster = propRemoteCluster.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFollowIndexPattern, value.FollowIndexPattern, null, null); + writer.WriteProperty(options, PropLeaderIndexExclusionPatterns, value.LeaderIndexExclusionPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLeaderIndexPatterns, value.LeaderIndexPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxOutstandingReadRequests, value.MaxOutstandingReadRequests, null, null); + writer.WriteProperty(options, PropMaxOutstandingWriteRequests, value.MaxOutstandingWriteRequests, null, null); + writer.WriteProperty(options, PropMaxReadRequestOperationCount, value.MaxReadRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxReadRequestSize, value.MaxReadRequestSize, null, null); + writer.WriteProperty(options, PropMaxRetryDelay, value.MaxRetryDelay, null, null); + writer.WriteProperty(options, PropMaxWriteBufferCount, value.MaxWriteBufferCount, null, null); + writer.WriteProperty(options, PropMaxWriteBufferSize, value.MaxWriteBufferSize, null, null); + writer.WriteProperty(options, PropMaxWriteRequestOperationCount, value.MaxWriteRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxWriteRequestSize, value.MaxWriteRequestSize, null, null); + writer.WriteProperty(options, PropReadPollTimeout, value.ReadPollTimeout, null, null); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } } /// @@ -46,26 +210,62 @@ public sealed partial class PutAutoFollowPatternRequestParameters : RequestParam /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. /// /// -public sealed partial class PutAutoFollowPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestConverter))] +public sealed partial class PutAutoFollowPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPutAutoFollowPattern; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name, string remoteCluster) : base(r => r.Required("name", name)) + { + RemoteCluster = remoteCluster; + } +#if NET7_0_OR_GREATER + public PutAutoFollowPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationPutAutoFollowPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ccr.put_auto_follow_pattern"; + /// + /// + /// The name of the collection of auto-follow patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// The name of follower index. The template {{leader_index}} can be used to derive the name of the follower index from the name of the leader index. When following a data stream, use {{leader_index}}; CCR does not support changes to the names of a follower data stream’s backing indices. /// /// - [JsonInclude, JsonPropertyName("follow_index_pattern")] public string? FollowIndexPattern { get; set; } /// @@ -73,23 +273,20 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed. /// /// - [JsonInclude, JsonPropertyName("leader_index_exclusion_patterns")] - public ICollection? LeaderIndexExclusionPatterns { get; set; } + public System.Collections.Generic.ICollection? LeaderIndexExclusionPatterns { get; set; } /// /// /// An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field. /// /// - [JsonInclude, JsonPropertyName("leader_index_patterns")] - public ICollection? LeaderIndexPatterns { get; set; } + public System.Collections.Generic.ICollection? LeaderIndexPatterns { get; set; } /// /// /// The maximum number of outstanding reads requests from the remote cluster. /// /// - [JsonInclude, JsonPropertyName("max_outstanding_read_requests")] public int? MaxOutstandingReadRequests { get; set; } /// @@ -97,7 +294,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum number of outstanding reads requests from the remote cluster. /// /// - [JsonInclude, JsonPropertyName("max_outstanding_write_requests")] public int? MaxOutstandingWriteRequests { get; set; } /// @@ -105,7 +301,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum number of operations to pull per read from the remote cluster. /// /// - [JsonInclude, JsonPropertyName("max_read_request_operation_count")] public int? MaxReadRequestOperationCount { get; set; } /// @@ -113,7 +308,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. /// /// - [JsonInclude, JsonPropertyName("max_read_request_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxReadRequestSize { get; set; } /// @@ -121,7 +315,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying. /// /// - [JsonInclude, JsonPropertyName("max_retry_delay")] public Elastic.Clients.Elasticsearch.Duration? MaxRetryDelay { get; set; } /// @@ -129,7 +322,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit. /// /// - [JsonInclude, JsonPropertyName("max_write_buffer_count")] public int? MaxWriteBufferCount { get; set; } /// @@ -137,7 +329,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. /// /// - [JsonInclude, JsonPropertyName("max_write_buffer_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteBufferSize { get; set; } /// @@ -145,7 +336,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum number of operations per bulk write request executed on the follower. /// /// - [JsonInclude, JsonPropertyName("max_write_request_operation_count")] public int? MaxWriteRequestOperationCount { get; set; } /// @@ -153,7 +343,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum total bytes of operations per bulk write request executed on the follower. /// /// - [JsonInclude, JsonPropertyName("max_write_request_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteRequestSize { get; set; } /// @@ -161,7 +350,6 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again. /// /// - [JsonInclude, JsonPropertyName("read_poll_timeout")] public Elastic.Clients.Elasticsearch.Duration? ReadPollTimeout { get; set; } /// @@ -169,16 +357,18 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// The remote cluster containing the leader indices to match against. /// /// - [JsonInclude, JsonPropertyName("remote_cluster")] - public string RemoteCluster { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RemoteCluster { get; set; } /// /// /// Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards). /// /// - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } } /// @@ -193,53 +383,63 @@ public PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. /// /// -public sealed partial class PutAutoFollowPatternRequestDescriptor : RequestDescriptor +public readonly partial struct PutAutoFollowPatternRequestDescriptor { - internal PutAutoFollowPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest Instance { get; init; } - public PutAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationPutAutoFollowPattern; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest(name); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAutoFollowPatternRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ccr.put_auto_follow_pattern"; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor descriptor) => descriptor.Instance; - public PutAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// The name of the collection of auto-follow patterns. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("name", name); - return Self; + Instance.Name = value; + return this; } - private string? FollowIndexPatternValue { get; set; } - private ICollection? LeaderIndexExclusionPatternsValue { get; set; } - private ICollection? LeaderIndexPatternsValue { get; set; } - private int? MaxOutstandingReadRequestsValue { get; set; } - private int? MaxOutstandingWriteRequestsValue { get; set; } - private int? MaxReadRequestOperationCountValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxReadRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MaxRetryDelayValue { get; set; } - private int? MaxWriteBufferCountValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxWriteBufferSizeValue { get; set; } - private int? MaxWriteRequestOperationCountValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxWriteRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ReadPollTimeoutValue { get; set; } - private string RemoteClusterValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// /// The name of follower index. The template {{leader_index}} can be used to derive the name of the follower index from the name of the leader index. When following a data stream, use {{leader_index}}; CCR does not support changes to the names of a follower data stream’s backing indices. /// /// - public PutAutoFollowPatternRequestDescriptor FollowIndexPattern(string? followIndexPattern) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor FollowIndexPattern(string? value) { - FollowIndexPatternValue = followIndexPattern; - return Self; + Instance.FollowIndexPattern = value; + return this; } /// @@ -247,10 +447,32 @@ public PutAutoFollowPatternRequestDescriptor FollowIndexPattern(string? followIn /// An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed. /// /// - public PutAutoFollowPatternRequestDescriptor LeaderIndexExclusionPatterns(ICollection? leaderIndexExclusionPatterns) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor LeaderIndexExclusionPatterns(System.Collections.Generic.ICollection? value) { - LeaderIndexExclusionPatternsValue = leaderIndexExclusionPatterns; - return Self; + Instance.LeaderIndexExclusionPatterns = value; + return this; + } + + /// + /// + /// An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor LeaderIndexExclusionPatterns(params string[] values) + { + Instance.LeaderIndexExclusionPatterns = [.. values]; + return this; + } + + /// + /// + /// An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor LeaderIndexPatterns(System.Collections.Generic.ICollection? value) + { + Instance.LeaderIndexPatterns = value; + return this; } /// @@ -258,10 +480,10 @@ public PutAutoFollowPatternRequestDescriptor LeaderIndexExclusionPatterns(IColle /// An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field. /// /// - public PutAutoFollowPatternRequestDescriptor LeaderIndexPatterns(ICollection? leaderIndexPatterns) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor LeaderIndexPatterns(params string[] values) { - LeaderIndexPatternsValue = leaderIndexPatterns; - return Self; + Instance.LeaderIndexPatterns = [.. values]; + return this; } /// @@ -269,10 +491,10 @@ public PutAutoFollowPatternRequestDescriptor LeaderIndexPatterns(ICollection /// - public PutAutoFollowPatternRequestDescriptor MaxOutstandingReadRequests(int? maxOutstandingReadRequests) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxOutstandingReadRequests(int? value) { - MaxOutstandingReadRequestsValue = maxOutstandingReadRequests; - return Self; + Instance.MaxOutstandingReadRequests = value; + return this; } /// @@ -280,10 +502,10 @@ public PutAutoFollowPatternRequestDescriptor MaxOutstandingReadRequests(int? max /// The maximum number of outstanding reads requests from the remote cluster. /// /// - public PutAutoFollowPatternRequestDescriptor MaxOutstandingWriteRequests(int? maxOutstandingWriteRequests) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxOutstandingWriteRequests(int? value) { - MaxOutstandingWriteRequestsValue = maxOutstandingWriteRequests; - return Self; + Instance.MaxOutstandingWriteRequests = value; + return this; } /// @@ -291,10 +513,10 @@ public PutAutoFollowPatternRequestDescriptor MaxOutstandingWriteRequests(int? ma /// The maximum number of operations to pull per read from the remote cluster. /// /// - public PutAutoFollowPatternRequestDescriptor MaxReadRequestOperationCount(int? maxReadRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxReadRequestOperationCount(int? value) { - MaxReadRequestOperationCountValue = maxReadRequestOperationCount; - return Self; + Instance.MaxReadRequestOperationCount = value; + return this; } /// @@ -302,10 +524,21 @@ public PutAutoFollowPatternRequestDescriptor MaxReadRequestOperationCount(int? m /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. /// /// - public PutAutoFollowPatternRequestDescriptor MaxReadRequestSize(Elastic.Clients.Elasticsearch.ByteSize? maxReadRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxReadRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxReadRequestSizeValue = maxReadRequestSize; - return Self; + Instance.MaxReadRequestSize = value; + return this; + } + + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxReadRequestSize(System.Func action) + { + Instance.MaxReadRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } /// @@ -313,10 +546,10 @@ public PutAutoFollowPatternRequestDescriptor MaxReadRequestSize(Elastic.Clients. /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying. /// /// - public PutAutoFollowPatternRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? maxRetryDelay) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - MaxRetryDelayValue = maxRetryDelay; - return Self; + Instance.MaxRetryDelay = value; + return this; } /// @@ -324,10 +557,21 @@ public PutAutoFollowPatternRequestDescriptor MaxRetryDelay(Elastic.Clients.Elast /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit. /// /// - public PutAutoFollowPatternRequestDescriptor MaxWriteBufferCount(int? maxWriteBufferCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteBufferCount(int? value) + { + Instance.MaxWriteBufferCount = value; + return this; + } + + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteBufferSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxWriteBufferCountValue = maxWriteBufferCount; - return Self; + Instance.MaxWriteBufferSize = value; + return this; } /// @@ -335,10 +579,10 @@ public PutAutoFollowPatternRequestDescriptor MaxWriteBufferCount(int? maxWriteBu /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. /// /// - public PutAutoFollowPatternRequestDescriptor MaxWriteBufferSize(Elastic.Clients.Elasticsearch.ByteSize? maxWriteBufferSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteBufferSize(System.Func action) { - MaxWriteBufferSizeValue = maxWriteBufferSize; - return Self; + Instance.MaxWriteBufferSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } /// @@ -346,10 +590,21 @@ public PutAutoFollowPatternRequestDescriptor MaxWriteBufferSize(Elastic.Clients. /// The maximum number of operations per bulk write request executed on the follower. /// /// - public PutAutoFollowPatternRequestDescriptor MaxWriteRequestOperationCount(int? maxWriteRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteRequestOperationCount(int? value) + { + Instance.MaxWriteRequestOperationCount = value; + return this; + } + + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteRequestSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxWriteRequestOperationCountValue = maxWriteRequestOperationCount; - return Self; + Instance.MaxWriteRequestSize = value; + return this; } /// @@ -357,10 +612,10 @@ public PutAutoFollowPatternRequestDescriptor MaxWriteRequestOperationCount(int? /// The maximum total bytes of operations per bulk write request executed on the follower. /// /// - public PutAutoFollowPatternRequestDescriptor MaxWriteRequestSize(Elastic.Clients.Elasticsearch.ByteSize? maxWriteRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor MaxWriteRequestSize(System.Func action) { - MaxWriteRequestSizeValue = maxWriteRequestSize; - return Self; + Instance.MaxWriteRequestSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } /// @@ -368,10 +623,10 @@ public PutAutoFollowPatternRequestDescriptor MaxWriteRequestSize(Elastic.Clients /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again. /// /// - public PutAutoFollowPatternRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? readPollTimeout) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - ReadPollTimeoutValue = readPollTimeout; - return Self; + Instance.ReadPollTimeout = value; + return this; } /// @@ -379,10 +634,10 @@ public PutAutoFollowPatternRequestDescriptor ReadPollTimeout(Elastic.Clients.Ela /// The remote cluster containing the leader indices to match against. /// /// - public PutAutoFollowPatternRequestDescriptor RemoteCluster(string remoteCluster) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor RemoteCluster(string value) { - RemoteClusterValue = remoteCluster; - return Self; + Instance.RemoteCluster = value; + return this; } /// @@ -390,101 +645,88 @@ public PutAutoFollowPatternRequestDescriptor RemoteCluster(string remoteCluster) /// Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards). /// /// - public PutAutoFollowPatternRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Settings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards). + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Settings() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FollowIndexPatternValue)) - { - writer.WritePropertyName("follow_index_pattern"); - writer.WriteStringValue(FollowIndexPatternValue); - } - - if (LeaderIndexExclusionPatternsValue is not null) - { - writer.WritePropertyName("leader_index_exclusion_patterns"); - JsonSerializer.Serialize(writer, LeaderIndexExclusionPatternsValue, options); - } - - if (LeaderIndexPatternsValue is not null) - { - writer.WritePropertyName("leader_index_patterns"); - JsonSerializer.Serialize(writer, LeaderIndexPatternsValue, options); - } - - if (MaxOutstandingReadRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_read_requests"); - writer.WriteNumberValue(MaxOutstandingReadRequestsValue.Value); - } - - if (MaxOutstandingWriteRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_write_requests"); - writer.WriteNumberValue(MaxOutstandingWriteRequestsValue.Value); - } + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (MaxReadRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_read_request_operation_count"); - writer.WriteNumberValue(MaxReadRequestOperationCountValue.Value); - } + /// + /// + /// Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards). + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MaxReadRequestSizeValue is not null) - { - writer.WritePropertyName("max_read_request_size"); - JsonSerializer.Serialize(writer, MaxReadRequestSizeValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } - if (MaxRetryDelayValue is not null) - { - writer.WritePropertyName("max_retry_delay"); - JsonSerializer.Serialize(writer, MaxRetryDelayValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MaxWriteBufferCountValue.HasValue) - { - writer.WritePropertyName("max_write_buffer_count"); - writer.WriteNumberValue(MaxWriteBufferCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxWriteBufferSizeValue is not null) - { - writer.WritePropertyName("max_write_buffer_size"); - JsonSerializer.Serialize(writer, MaxWriteBufferSizeValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MaxWriteRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_write_request_operation_count"); - writer.WriteNumberValue(MaxWriteRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (MaxWriteRequestSizeValue is not null) - { - writer.WritePropertyName("max_write_request_size"); - JsonSerializer.Serialize(writer, MaxWriteRequestSizeValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ReadPollTimeoutValue is not null) - { - writer.WritePropertyName("read_poll_timeout"); - JsonSerializer.Serialize(writer, ReadPollTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WritePropertyName("remote_cluster"); - writer.WriteStringValue(RemoteClusterValue); - if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternResponse.g.cs index 12a5140d0b3..f2bbf830201 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/PutAutoFollowPatternResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class PutAutoFollowPatternResponse : ElasticsearchResponse +internal sealed partial class PutAutoFollowPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponseConverter))] +public sealed partial class PutAutoFollowPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAutoFollowPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternRequest.g.cs index 33dd4afe9a4..d71daca75c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternRequest.g.cs @@ -17,77 +17,215 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ResumeAutoFollowPatternRequestParameters : RequestParameters +public sealed partial class ResumeAutoFollowPatternRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class ResumeAutoFollowPatternRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Resume an auto-follow pattern. +/// +/// /// Resume a cross-cluster replication auto-follow pattern that was paused. /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. /// /// -public sealed partial class ResumeAutoFollowPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestConverter))] +public sealed partial class ResumeAutoFollowPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ResumeAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ResumeAutoFollowPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResumeAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationResumeAutoFollowPattern; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationResumeAutoFollowPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ccr.resume_auto_follow_pattern"; + + /// + /// + /// The name of the auto-follow pattern to resume. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Resume an auto-follow pattern. +/// +/// /// Resume a cross-cluster replication auto-follow pattern that was paused. /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. /// /// -public sealed partial class ResumeAutoFollowPatternRequestDescriptor : RequestDescriptor +public readonly partial struct ResumeAutoFollowPatternRequestDescriptor { - internal ResumeAutoFollowPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest Instance { get; init; } - public ResumeAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResumeAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationResumeAutoFollowPattern; + public ResumeAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ResumeAutoFollowPatternRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.resume_auto_follow_pattern"; + /// + /// + /// The name of the auto-follow pattern to resume. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ResumeAutoFollowPatternRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternResponse.g.cs index c7cab6b189b..f56c55b444e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeAutoFollowPatternResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ResumeAutoFollowPatternResponse : ElasticsearchResponse +internal sealed partial class ResumeAutoFollowPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponseConverter))] +public sealed partial class ResumeAutoFollowPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResumeAutoFollowPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResumeAutoFollowPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowRequest.g.cs index ab0686ccb90..53b3077bbb4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowRequest.g.cs @@ -17,21 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ResumeFollowRequestParameters : RequestParameters +public sealed partial class ResumeFollowRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class ResumeFollowRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingWriteRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_read_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestSize = System.Text.Json.JsonEncodedText.Encode("max_read_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRetryDelay = System.Text.Json.JsonEncodedText.Encode("max_retry_delay"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferCount = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferSize = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_write_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestSize = System.Text.Json.JsonEncodedText.Encode("max_write_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropReadPollTimeout = System.Text.Json.JsonEncodedText.Encode("read_poll_timeout"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxOutstandingReadRequests = default; + LocalJsonValue propMaxOutstandingWriteRequests = default; + LocalJsonValue propMaxReadRequestOperationCount = default; + LocalJsonValue propMaxReadRequestSize = default; + LocalJsonValue propMaxRetryDelay = default; + LocalJsonValue propMaxWriteBufferCount = default; + LocalJsonValue propMaxWriteBufferSize = default; + LocalJsonValue propMaxWriteRequestOperationCount = default; + LocalJsonValue propMaxWriteRequestSize = default; + LocalJsonValue propReadPollTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxOutstandingReadRequests.TryReadProperty(ref reader, options, PropMaxOutstandingReadRequests, null)) + { + continue; + } + + if (propMaxOutstandingWriteRequests.TryReadProperty(ref reader, options, PropMaxOutstandingWriteRequests, null)) + { + continue; + } + + if (propMaxReadRequestOperationCount.TryReadProperty(ref reader, options, PropMaxReadRequestOperationCount, null)) + { + continue; + } + + if (propMaxReadRequestSize.TryReadProperty(ref reader, options, PropMaxReadRequestSize, null)) + { + continue; + } + + if (propMaxRetryDelay.TryReadProperty(ref reader, options, PropMaxRetryDelay, null)) + { + continue; + } + + if (propMaxWriteBufferCount.TryReadProperty(ref reader, options, PropMaxWriteBufferCount, null)) + { + continue; + } + + if (propMaxWriteBufferSize.TryReadProperty(ref reader, options, PropMaxWriteBufferSize, null)) + { + continue; + } + + if (propMaxWriteRequestOperationCount.TryReadProperty(ref reader, options, PropMaxWriteRequestOperationCount, null)) + { + continue; + } + + if (propMaxWriteRequestSize.TryReadProperty(ref reader, options, PropMaxWriteRequestSize, null)) + { + continue; + } + + if (propReadPollTimeout.TryReadProperty(ref reader, options, PropReadPollTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxOutstandingReadRequests = propMaxOutstandingReadRequests.Value, + MaxOutstandingWriteRequests = propMaxOutstandingWriteRequests.Value, + MaxReadRequestOperationCount = propMaxReadRequestOperationCount.Value, + MaxReadRequestSize = propMaxReadRequestSize.Value, + MaxRetryDelay = propMaxRetryDelay.Value, + MaxWriteBufferCount = propMaxWriteBufferCount.Value, + MaxWriteBufferSize = propMaxWriteBufferSize.Value, + MaxWriteRequestOperationCount = propMaxWriteRequestOperationCount.Value, + MaxWriteRequestSize = propMaxWriteRequestSize.Value, + ReadPollTimeout = propReadPollTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxOutstandingReadRequests, value.MaxOutstandingReadRequests, null, null); + writer.WriteProperty(options, PropMaxOutstandingWriteRequests, value.MaxOutstandingWriteRequests, null, null); + writer.WriteProperty(options, PropMaxReadRequestOperationCount, value.MaxReadRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxReadRequestSize, value.MaxReadRequestSize, null, null); + writer.WriteProperty(options, PropMaxRetryDelay, value.MaxRetryDelay, null, null); + writer.WriteProperty(options, PropMaxWriteBufferCount, value.MaxWriteBufferCount, null, null); + writer.WriteProperty(options, PropMaxWriteBufferSize, value.MaxWriteBufferSize, null, null); + writer.WriteProperty(options, PropMaxWriteRequestOperationCount, value.MaxWriteRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxWriteRequestSize, value.MaxWriteRequestSize, null, null); + writer.WriteProperty(options, PropReadPollTimeout, value.ReadPollTimeout, null, null); + writer.WriteEndObject(); + } } /// @@ -43,39 +162,58 @@ public sealed partial class ResumeFollowRequestParameters : RequestParameters /// When this API returns, the follower index will resume fetching operations from the leader index. /// /// -public sealed partial class ResumeFollowRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestConverter))] +public sealed partial class ResumeFollowRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ResumeFollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public ResumeFollowRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResumeFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationResumeFollow; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationResumeFollow; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ccr.resume_follow"; - [JsonInclude, JsonPropertyName("max_outstanding_read_requests")] + /// + /// + /// The name of the follow index to resume following. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } public long? MaxOutstandingReadRequests { get; set; } - [JsonInclude, JsonPropertyName("max_outstanding_write_requests")] public long? MaxOutstandingWriteRequests { get; set; } - [JsonInclude, JsonPropertyName("max_read_request_operation_count")] public long? MaxReadRequestOperationCount { get; set; } - [JsonInclude, JsonPropertyName("max_read_request_size")] public string? MaxReadRequestSize { get; set; } - [JsonInclude, JsonPropertyName("max_retry_delay")] public Elastic.Clients.Elasticsearch.Duration? MaxRetryDelay { get; set; } - [JsonInclude, JsonPropertyName("max_write_buffer_count")] public long? MaxWriteBufferCount { get; set; } - [JsonInclude, JsonPropertyName("max_write_buffer_size")] public string? MaxWriteBufferSize { get; set; } - [JsonInclude, JsonPropertyName("max_write_request_operation_count")] public long? MaxWriteRequestOperationCount { get; set; } - [JsonInclude, JsonPropertyName("max_write_request_size")] public string? MaxWriteRequestSize { get; set; } - [JsonInclude, JsonPropertyName("read_poll_timeout")] public Elastic.Clients.Elasticsearch.Duration? ReadPollTimeout { get; set; } } @@ -88,167 +226,160 @@ public ResumeFollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base /// When this API returns, the follower index will resume fetching operations from the leader index. /// /// -public sealed partial class ResumeFollowRequestDescriptor : RequestDescriptor, ResumeFollowRequestParameters> +public readonly partial struct ResumeFollowRequestDescriptor { - internal ResumeFollowRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest Instance { get; init; } - public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest instance) { + Instance = instance; } - public ResumeFollowRequestDescriptor() : this(typeof(TDocument)) + public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationResumeFollow; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ccr.resume_follow"; - - public ResumeFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ResumeFollowRequestDescriptor() { - RouteValues.Required("index", index); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private long? MaxOutstandingReadRequestsValue { get; set; } - private long? MaxOutstandingWriteRequestsValue { get; set; } - private long? MaxReadRequestOperationCountValue { get; set; } - private string? MaxReadRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MaxRetryDelayValue { get; set; } - private long? MaxWriteBufferCountValue { get; set; } - private string? MaxWriteBufferSizeValue { get; set; } - private long? MaxWriteRequestOperationCountValue { get; set; } - private string? MaxWriteRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ReadPollTimeoutValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor descriptor) => descriptor.Instance; - public ResumeFollowRequestDescriptor MaxOutstandingReadRequests(long? maxOutstandingReadRequests) + /// + /// + /// The name of the follow index to resume following. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - MaxOutstandingReadRequestsValue = maxOutstandingReadRequests; - return Self; + Instance.Index = value; + return this; } - public ResumeFollowRequestDescriptor MaxOutstandingWriteRequests(long? maxOutstandingWriteRequests) + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - MaxOutstandingWriteRequestsValue = maxOutstandingWriteRequests; - return Self; + Instance.MasterTimeout = value; + return this; } - public ResumeFollowRequestDescriptor MaxReadRequestOperationCount(long? maxReadRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxOutstandingReadRequests(long? value) { - MaxReadRequestOperationCountValue = maxReadRequestOperationCount; - return Self; + Instance.MaxOutstandingReadRequests = value; + return this; } - public ResumeFollowRequestDescriptor MaxReadRequestSize(string? maxReadRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxOutstandingWriteRequests(long? value) { - MaxReadRequestSizeValue = maxReadRequestSize; - return Self; + Instance.MaxOutstandingWriteRequests = value; + return this; } - public ResumeFollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? maxRetryDelay) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxReadRequestOperationCount(long? value) { - MaxRetryDelayValue = maxRetryDelay; - return Self; + Instance.MaxReadRequestOperationCount = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteBufferCount(long? maxWriteBufferCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxReadRequestSize(string? value) { - MaxWriteBufferCountValue = maxWriteBufferCount; - return Self; + Instance.MaxReadRequestSize = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteBufferSize(string? maxWriteBufferSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - MaxWriteBufferSizeValue = maxWriteBufferSize; - return Self; + Instance.MaxRetryDelay = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteRequestOperationCount(long? maxWriteRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteBufferCount(long? value) { - MaxWriteRequestOperationCountValue = maxWriteRequestOperationCount; - return Self; + Instance.MaxWriteBufferCount = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteRequestSize(string? maxWriteRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteBufferSize(string? value) { - MaxWriteRequestSizeValue = maxWriteRequestSize; - return Self; + Instance.MaxWriteBufferSize = value; + return this; } - public ResumeFollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? readPollTimeout) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteRequestOperationCount(long? value) { - ReadPollTimeoutValue = readPollTimeout; - return Self; + Instance.MaxWriteRequestOperationCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteRequestSize(string? value) { - writer.WriteStartObject(); - if (MaxOutstandingReadRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_read_requests"); - writer.WriteNumberValue(MaxOutstandingReadRequestsValue.Value); - } - - if (MaxOutstandingWriteRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_write_requests"); - writer.WriteNumberValue(MaxOutstandingWriteRequestsValue.Value); - } + Instance.MaxWriteRequestSize = value; + return this; + } - if (MaxReadRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_read_request_operation_count"); - writer.WriteNumberValue(MaxReadRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.ReadPollTimeout = value; + return this; + } - if (!string.IsNullOrEmpty(MaxReadRequestSizeValue)) - { - writer.WritePropertyName("max_read_request_size"); - writer.WriteStringValue(MaxReadRequestSizeValue); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MaxRetryDelayValue is not null) - { - writer.WritePropertyName("max_retry_delay"); - JsonSerializer.Serialize(writer, MaxRetryDelayValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxWriteBufferCountValue.HasValue) - { - writer.WritePropertyName("max_write_buffer_count"); - writer.WriteNumberValue(MaxWriteBufferCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteBufferSizeValue)) - { - writer.WritePropertyName("max_write_buffer_size"); - writer.WriteStringValue(MaxWriteBufferSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (MaxWriteRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_write_request_operation_count"); - writer.WriteNumberValue(MaxWriteRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteRequestSizeValue)) - { - writer.WritePropertyName("max_write_request_size"); - writer.WriteStringValue(MaxWriteRequestSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ReadPollTimeoutValue is not null) - { - writer.WritePropertyName("read_poll_timeout"); - JsonSerializer.Serialize(writer, ReadPollTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -261,162 +392,158 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// When this API returns, the follower index will resume fetching operations from the leader index. /// /// -public sealed partial class ResumeFollowRequestDescriptor : RequestDescriptor +public readonly partial struct ResumeFollowRequestDescriptor { - internal ResumeFollowRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest Instance { get; init; } - public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationResumeFollow; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ccr.resume_follow"; + public ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(index); + } - public ResumeFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public ResumeFollowRequestDescriptor() { - RouteValues.Required("index", index); - return Self; + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(typeof(TDocument)); } - private long? MaxOutstandingReadRequestsValue { get; set; } - private long? MaxOutstandingWriteRequestsValue { get; set; } - private long? MaxReadRequestOperationCountValue { get; set; } - private string? MaxReadRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MaxRetryDelayValue { get; set; } - private long? MaxWriteBufferCountValue { get; set; } - private string? MaxWriteBufferSizeValue { get; set; } - private long? MaxWriteRequestOperationCountValue { get; set; } - private string? MaxWriteRequestSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ReadPollTimeoutValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor descriptor) => descriptor.Instance; - public ResumeFollowRequestDescriptor MaxOutstandingReadRequests(long? maxOutstandingReadRequests) + /// + /// + /// The name of the follow index to resume following. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - MaxOutstandingReadRequestsValue = maxOutstandingReadRequests; - return Self; + Instance.Index = value; + return this; } - public ResumeFollowRequestDescriptor MaxOutstandingWriteRequests(long? maxOutstandingWriteRequests) + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - MaxOutstandingWriteRequestsValue = maxOutstandingWriteRequests; - return Self; + Instance.MasterTimeout = value; + return this; } - public ResumeFollowRequestDescriptor MaxReadRequestOperationCount(long? maxReadRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxOutstandingReadRequests(long? value) { - MaxReadRequestOperationCountValue = maxReadRequestOperationCount; - return Self; + Instance.MaxOutstandingReadRequests = value; + return this; } - public ResumeFollowRequestDescriptor MaxReadRequestSize(string? maxReadRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxOutstandingWriteRequests(long? value) { - MaxReadRequestSizeValue = maxReadRequestSize; - return Self; + Instance.MaxOutstandingWriteRequests = value; + return this; } - public ResumeFollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? maxRetryDelay) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxReadRequestOperationCount(long? value) { - MaxRetryDelayValue = maxRetryDelay; - return Self; + Instance.MaxReadRequestOperationCount = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteBufferCount(long? maxWriteBufferCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxReadRequestSize(string? value) { - MaxWriteBufferCountValue = maxWriteBufferCount; - return Self; + Instance.MaxReadRequestSize = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteBufferSize(string? maxWriteBufferSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - MaxWriteBufferSizeValue = maxWriteBufferSize; - return Self; + Instance.MaxRetryDelay = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteRequestOperationCount(long? maxWriteRequestOperationCount) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteBufferCount(long? value) { - MaxWriteRequestOperationCountValue = maxWriteRequestOperationCount; - return Self; + Instance.MaxWriteBufferCount = value; + return this; } - public ResumeFollowRequestDescriptor MaxWriteRequestSize(string? maxWriteRequestSize) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteBufferSize(string? value) { - MaxWriteRequestSizeValue = maxWriteRequestSize; - return Self; + Instance.MaxWriteBufferSize = value; + return this; } - public ResumeFollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? readPollTimeout) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteRequestOperationCount(long? value) { - ReadPollTimeoutValue = readPollTimeout; - return Self; + Instance.MaxWriteRequestOperationCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor MaxWriteRequestSize(string? value) { - writer.WriteStartObject(); - if (MaxOutstandingReadRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_read_requests"); - writer.WriteNumberValue(MaxOutstandingReadRequestsValue.Value); - } - - if (MaxOutstandingWriteRequestsValue.HasValue) - { - writer.WritePropertyName("max_outstanding_write_requests"); - writer.WriteNumberValue(MaxOutstandingWriteRequestsValue.Value); - } + Instance.MaxWriteRequestSize = value; + return this; + } - if (MaxReadRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_read_request_operation_count"); - writer.WriteNumberValue(MaxReadRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor ReadPollTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.ReadPollTimeout = value; + return this; + } - if (!string.IsNullOrEmpty(MaxReadRequestSizeValue)) - { - writer.WritePropertyName("max_read_request_size"); - writer.WriteStringValue(MaxReadRequestSizeValue); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MaxRetryDelayValue is not null) - { - writer.WritePropertyName("max_retry_delay"); - JsonSerializer.Serialize(writer, MaxRetryDelayValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxWriteBufferCountValue.HasValue) - { - writer.WritePropertyName("max_write_buffer_count"); - writer.WriteNumberValue(MaxWriteBufferCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteBufferSizeValue)) - { - writer.WritePropertyName("max_write_buffer_size"); - writer.WriteStringValue(MaxWriteBufferSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (MaxWriteRequestOperationCountValue.HasValue) - { - writer.WritePropertyName("max_write_request_operation_count"); - writer.WriteNumberValue(MaxWriteRequestOperationCountValue.Value); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(MaxWriteRequestSizeValue)) - { - writer.WritePropertyName("max_write_request_size"); - writer.WriteStringValue(MaxWriteRequestSizeValue); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ReadPollTimeoutValue is not null) - { - writer.WritePropertyName("read_poll_timeout"); - JsonSerializer.Serialize(writer, ReadPollTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowResponse.g.cs index 0a11009556d..f73f8315d12 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/ResumeFollowResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class ResumeFollowResponse : ElasticsearchResponse +internal sealed partial class ResumeFollowResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponseConverter))] +public sealed partial class ResumeFollowResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResumeFollowResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResumeFollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowRequest.g.cs index ab1fab0076b..8ad3f4cdf52 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowRequest.g.cs @@ -17,125 +17,335 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class UnfollowRequestParameters : RequestParameters +public sealed partial class UnfollowRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class UnfollowRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Unfollow an index. +/// +/// /// Convert a cross-cluster replication follower index to a regular index. /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. /// The follower index must be paused and closed before you call the unfollow API. /// /// -/// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. +/// info +/// Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. /// /// -public sealed partial class UnfollowRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestConverter))] +public sealed partial class UnfollowRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UnfollowRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public UnfollowRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnfollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationUnfollow; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.CrossClusterReplicationUnfollow; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ccr.unfollow"; + + /// + /// + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Unfollow an index. +/// +/// /// Convert a cross-cluster replication follower index to a regular index. /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. /// The follower index must be paused and closed before you call the unfollow API. /// /// -/// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. +/// info +/// Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. /// /// -public sealed partial class UnfollowRequestDescriptor : RequestDescriptor, UnfollowRequestParameters> +public readonly partial struct UnfollowRequestDescriptor { - internal UnfollowRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest Instance { get; init; } - public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest instance) { + Instance = instance; } - public UnfollowRequestDescriptor() : this(typeof(TDocument)) + public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationUnfollow; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UnfollowRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ccr.unfollow"; + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public UnfollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest Build(System.Action action) { - RouteValues.Required("index", index); - return Self; + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Unfollow an index. +/// +/// /// Convert a cross-cluster replication follower index to a regular index. /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. /// The follower index must be paused and closed before you call the unfollow API. /// /// -/// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. +/// info +/// Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. /// /// -public sealed partial class UnfollowRequestDescriptor : RequestDescriptor +public readonly partial struct UnfollowRequestDescriptor { - internal UnfollowRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest Instance { get; init; } - public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.CrossClusterReplicationUnfollow; + public UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UnfollowRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest instance) => new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ccr.unfollow"; + /// + /// + /// The name of the follower index. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public UnfollowRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowResponse.g.cs index ee58b3bcbb8..5edf4922a63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CrossClusterReplication/UnfollowResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public sealed partial class UnfollowResponse : ElasticsearchResponse +internal sealed partial class UnfollowResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponseConverter))] +public sealed partial class UnfollowResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnfollowResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnfollowResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesRequest.g.cs index 651b65cef03..ed8bd29b0fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.DanglingIndices; -public sealed partial class ListDanglingIndicesRequestParameters : RequestParameters +public sealed partial class ListDanglingIndicesRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ListDanglingIndicesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -46,11 +68,28 @@ public sealed partial class ListDanglingIndicesRequestParameters : RequestParame /// Use this API to list dangling indices, which you can then import or delete. /// /// -public sealed partial class ListDanglingIndicesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestConverter))] +public sealed partial class ListDanglingIndicesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.DanglingIndicesListDanglingIndices; +#if NET7_0_OR_GREATER + public ListDanglingIndicesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ListDanglingIndicesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.DanglingIndicesListDanglingIndices; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -69,23 +108,76 @@ public sealed partial class ListDanglingIndicesRequest : PlainRequest /// -public sealed partial class ListDanglingIndicesRequestDescriptor : RequestDescriptor +public readonly partial struct ListDanglingIndicesRequestDescriptor { - internal ListDanglingIndicesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListDanglingIndicesRequestDescriptor(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest instance) + { + Instance = instance; + } public ListDanglingIndicesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.DanglingIndicesListDanglingIndices; + public static explicit operator Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest instance) => new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "dangling_indices.list_dangling_indices"; + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesResponse.g.cs index b84dd6c6f7f..1acaa5d89a7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DanglingIndices/ListDanglingIndicesResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.DanglingIndices; -public sealed partial class ListDanglingIndicesResponse : ElasticsearchResponse +internal sealed partial class ListDanglingIndicesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dangling_indices")] - public IReadOnlyCollection DanglingIndices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDanglingIndices = System.Text.Json.JsonEncodedText.Encode("dangling_indices"); + + public override Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDanglingIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDanglingIndices.TryReadProperty(ref reader, options, PropDanglingIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DanglingIndices = propDanglingIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDanglingIndices, value.DanglingIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponseConverter))] +public sealed partial class ListDanglingIndicesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListDanglingIndicesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListDanglingIndicesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DanglingIndices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRequest.g.cs index 69efb1ad911..e11295bfb1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteByQueryRequestParameters : RequestParameters +public sealed partial class DeleteByQueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -87,11 +80,11 @@ public sealed partial class DeleteByQueryRequestParameters : RequestParameters /// It supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// Starting offset (default: 0) + /// Skips the specified number of documents. /// /// public long? From { get => Q("from"); set => Q("from", value); } @@ -199,14 +192,14 @@ public sealed partial class DeleteByQueryRequestParameters : RequestParameters /// A comma-separated list of <field>:<direction> pairs. /// /// - public ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } + public System.Collections.Generic.ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } /// /// /// The specific tag of the request for logging and statistical purposes. /// /// - public ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } + public System.Collections.Generic.ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } /// /// @@ -255,6 +248,63 @@ public sealed partial class DeleteByQueryRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class DeleteByQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + + public override Elastic.Clients.Elasticsearch.DeleteByQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxDocs = default; + LocalJsonValue propQuery = default; + LocalJsonValue propSlice = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxDocs = propMaxDocs.Value, + Query = propQuery.Value, + Slice = propSlice.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteByQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Delete documents. @@ -407,20 +457,45 @@ public sealed partial class DeleteByQueryRequestParameters : RequestParameters /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. /// /// -public sealed partial class DeleteByQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteByQueryRequestConverter))] +public sealed partial class DeleteByQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public DeleteByQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteByQuery; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceDeleteByQuery; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "delete_by_query"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -428,7 +503,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -437,7 +511,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -446,7 +519,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -454,7 +526,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// What to do if delete by query hits version conflicts: abort or proceed. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Conflicts? Conflicts { get => Q("conflicts"); set => Q("conflicts", value); } /// @@ -463,7 +534,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -472,7 +542,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -482,15 +551,13 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// It supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// Starting offset (default: 0) + /// Skips the specified number of documents. /// /// - [JsonIgnore] public long? From { get => Q("from"); set => Q("from", value); } /// @@ -498,7 +565,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -507,7 +573,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -516,7 +581,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -524,7 +588,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A query in the Lucene query string syntax. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -534,7 +597,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Unlike the delete API, it does not support wait_for. /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -543,7 +605,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Defaults to the index-level setting. /// /// - [JsonIgnore] public bool? RequestCache { get => Q("request_cache"); set => Q("request_cache", value); } /// @@ -551,7 +612,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The throttle for this request in sub-requests per second. /// /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } /// @@ -559,7 +619,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -567,7 +626,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The period to retain the search context for scrolling. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Scroll { get => Q("scroll"); set => Q("scroll", value); } /// @@ -575,7 +633,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The size of the scroll request that powers the operation. /// /// - [JsonIgnore] public long? ScrollSize { get => Q("scroll_size"); set => Q("scroll_size", value); } /// @@ -584,7 +641,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// It defaults to no timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? SearchTimeout { get => Q("search_timeout"); set => Q("search_timeout", value); } /// @@ -593,7 +649,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Available options include query_then_fetch and dfs_query_then_fetch. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -601,7 +656,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The number of slices this task should be divided into. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Slices? Slices { get => Q("slices"); set => Q("slices", value); } /// @@ -609,16 +663,14 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A comma-separated list of <field>:<direction> pairs. /// /// - [JsonIgnore] - public ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } + public System.Collections.Generic.ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } /// /// /// The specific tag of the request for logging and statistical purposes. /// /// - [JsonIgnore] - public ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } + public System.Collections.Generic.ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } /// /// @@ -633,7 +685,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. /// /// - [JsonIgnore] public long? TerminateAfter { get => Q("terminate_after"); set => Q("terminate_after", value); } /// @@ -641,7 +692,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The period each deletion request waits for active shards. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -649,7 +699,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If true, returns the document version as part of a hit. /// /// - [JsonIgnore] public bool? Version { get => Q("version"); set => Q("version", value); } /// @@ -659,7 +708,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The timeout value controls how long each write request waits for unavailable shards to become available. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -668,7 +716,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// @@ -676,7 +723,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The maximum number of documents to delete. /// /// - [JsonInclude, JsonPropertyName("max_docs")] public long? MaxDocs { get; set; } /// @@ -684,7 +730,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The documents to delete specified with Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -692,7 +737,6 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Slice the request manually using the provided slice ID and total number of slices. /// /// - [JsonInclude, JsonPropertyName("slice")] public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } } @@ -848,432 +892,1161 @@ public DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. /// /// -public sealed partial class DeleteByQueryRequestDescriptor : RequestDescriptor, DeleteByQueryRequestParameters> +public readonly partial struct DeleteByQueryRequestDescriptor { - internal DeleteByQueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DeleteByQueryRequest Instance { get; init; } - public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRequest instance) { + Instance = instance; } - public DeleteByQueryRequestDescriptor() : this(typeof(TDocument)) + public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteByQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "delete_by_query"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteByQueryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeleteByQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DeleteByQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public DeleteByQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public DeleteByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) => Qs("conflicts", conflicts); - public DeleteByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public DeleteByQueryRequestDescriptor Df(string? df) => Qs("df", df); - public DeleteByQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteByQueryRequestDescriptor From(long? from) => Qs("from", from); - public DeleteByQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DeleteByQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public DeleteByQueryRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public DeleteByQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public DeleteByQueryRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public DeleteByQueryRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public DeleteByQueryRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public DeleteByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public DeleteByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public DeleteByQueryRequestDescriptor ScrollSize(long? scrollSize) => Qs("scroll_size", scrollSize); - public DeleteByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? searchTimeout) => Qs("search_timeout", searchTimeout); - public DeleteByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public DeleteByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public DeleteByQueryRequestDescriptor Sort(ICollection? sort) => Qs("sort", sort); - public DeleteByQueryRequestDescriptor Stats(ICollection? stats) => Qs("stats", stats); - public DeleteByQueryRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); - public DeleteByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public DeleteByQueryRequestDescriptor Version(bool? version = true) => Qs("version", version); - public DeleteByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public DeleteByQueryRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - public DeleteByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) - { - RouteValues.Required("index", indices); - return Self; - } - - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action> SliceDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRequest instance) => new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRequest(Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// The maximum number of documents to delete. + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. /// /// - public DeleteByQueryRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - MaxDocsValue = maxDocs; - return Self; + Instance.Indices = value; + return this; } /// /// - /// The documents to delete specified with Query DSL. + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - public DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public DeleteByQueryRequestDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor AllowNoIndices(bool? value = true) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.AllowNoIndices = value; + return this; } /// /// - /// Slice the request manually using the provided slice ID and total number of slices. + /// Analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) - { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; - } - - public DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Analyzer(string? value) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Analyzer = value; + return this; } - public DeleteByQueryRequestDescriptor Slice(Action> configure) + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor AnalyzeWildcard(bool? value = true) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.AnalyzeWildcard = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// What to do if delete by query hits version conflicts: abort or proceed. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) { - writer.WriteStartObject(); - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } - - writer.WriteEndObject(); + Instance.Conflicts = value; + return this; } -} - -/// -/// -/// Delete documents. -/// -/// -/// Deletes documents that match the specified query. -/// -/// -/// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: -/// -/// -/// -/// -/// read -/// -/// -/// -/// -/// delete or write -/// -/// -/// -/// -/// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. -/// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. -/// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. -/// -/// -/// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. -/// -/// -/// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. -/// A bulk delete request is performed for each batch of matching documents. -/// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. -/// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. -/// Any delete requests that completed successfully still stick, they are not rolled back. -/// -/// -/// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. -/// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. -/// -/// -/// Throttling delete requests -/// -/// -/// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. -/// This pads each batch with a wait time to throttle the rate. -/// Set requests_per_second to -1 to disable throttling. -/// -/// -/// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. -/// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. -/// By default the batch size is 1000, so if requests_per_second is set to 500: -/// -/// -/// target_time = 1000 / 500 per second = 2 seconds -/// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds -/// -/// -/// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. -/// This is "bursty" instead of "smooth". -/// -/// -/// Slicing -/// -/// -/// Delete by query supports sliced scroll to parallelize the delete process. -/// This can improve efficiency and provide a convenient way to break the request down into smaller parts. -/// -/// -/// Setting slices to auto lets Elasticsearch choose the number of slices to use. -/// This setting will use one slice per shard, up to a certain limit. -/// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. -/// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: -/// -/// -/// -/// -/// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. -/// -/// -/// -/// -/// Fetching the status of the task for the request with slices only contains the status of completed slices. -/// -/// -/// -/// -/// These sub-requests are individually addressable for things like cancellation and rethrottling. -/// -/// -/// -/// -/// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. -/// -/// -/// -/// -/// Canceling the request with slices will cancel each sub-request. -/// -/// -/// -/// -/// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. -/// -/// -/// -/// -/// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. -/// -/// -/// -/// -/// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. -/// -/// -/// -/// -/// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: -/// -/// -/// -/// -/// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. -/// -/// -/// -/// -/// Delete performance scales linearly across available resources with the number of slices. -/// -/// -/// -/// -/// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. -/// -/// -/// Cancel a delete by query operation -/// -/// -/// Any delete by query can be canceled using the task cancel API. For example: -/// -/// -/// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel -/// -/// -/// The task ID can be found by using the get tasks API. -/// -/// -/// Cancellation should happen quickly but might take a few seconds. -/// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. -/// -/// -public sealed partial class DeleteByQueryRequestDescriptor : RequestDescriptor -{ - internal DeleteByQueryRequestDescriptor(Action configure) => configure.Invoke(this); - public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { + Instance.DefaultOperator = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteByQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "delete_by_query"; - - public DeleteByQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DeleteByQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public DeleteByQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public DeleteByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) => Qs("conflicts", conflicts); - public DeleteByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public DeleteByQueryRequestDescriptor Df(string? df) => Qs("df", df); - public DeleteByQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteByQueryRequestDescriptor From(long? from) => Qs("from", from); - public DeleteByQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DeleteByQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public DeleteByQueryRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public DeleteByQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public DeleteByQueryRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public DeleteByQueryRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public DeleteByQueryRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public DeleteByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public DeleteByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public DeleteByQueryRequestDescriptor ScrollSize(long? scrollSize) => Qs("scroll_size", scrollSize); - public DeleteByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? searchTimeout) => Qs("search_timeout", searchTimeout); - public DeleteByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public DeleteByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public DeleteByQueryRequestDescriptor Sort(ICollection? sort) => Qs("sort", sort); - public DeleteByQueryRequestDescriptor Stats(ICollection? stats) => Qs("stats", stats); - public DeleteByQueryRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); - public DeleteByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public DeleteByQueryRequestDescriptor Version(bool? version = true) => Qs("version", version); - public DeleteByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public DeleteByQueryRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - public DeleteByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) - { - RouteValues.Required("index", indices); - return Self; - } - - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action SliceDescriptorAction { get; set; } - /// /// - /// The maximum number of documents to delete. + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public DeleteByQueryRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Df(string? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.Df = value; + return this; } /// /// - /// The documents to delete specified with Query DSL. + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. /// /// - public DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.ExpandWildcards = value; + return this; } - public DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Skips the specified number of documents. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor From(long? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// If true, Elasticsearch refreshes all shards involved in the delete by query after the request completes. + /// This is different than the delete API's refresh parameter, which causes just the shard that received the delete request to be refreshed. + /// Unlike the delete API, it does not support wait_for. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// If true, the request cache is used for this request. + /// Defaults to the index-level setting. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period to retain the search context for scrolling. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } + + /// + /// + /// The size of the scroll request that powers the operation. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ScrollSize(long? value) + { + Instance.ScrollSize = value; + return this; + } + + /// + /// + /// The explicit timeout for each search request. + /// It defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.SearchTimeout = value; + return this; + } + + /// + /// + /// The type of the search operation. + /// Available options include query_then_fetch and dfs_query_then_fetch. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) + { + Instance.Slices = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slices(System.Func action) + { + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Sort(params string[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period each deletion request waits for active shards. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The timeout value controls how long each write request waits for unavailable shards to become available. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// If true, the request blocks until the operation is complete. + /// If false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + /// + /// + /// The maximum number of documents to delete. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor MaxDocs(long? value) + { + Instance.MaxDocs = value; + return this; + } + + /// + /// + /// The documents to delete specified with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// The documents to delete specified with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The documents to delete specified with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) + { + Instance.Slice = value; + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slice(System.Action action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slice(System.Action> action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteByQueryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Delete documents. +/// +/// +/// Deletes documents that match the specified query. +/// +/// +/// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: +/// +/// +/// +/// +/// read +/// +/// +/// +/// +/// delete or write +/// +/// +/// +/// +/// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. +/// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. +/// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. +/// +/// +/// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. +/// +/// +/// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. +/// A bulk delete request is performed for each batch of matching documents. +/// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. +/// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. +/// Any delete requests that completed successfully still stick, they are not rolled back. +/// +/// +/// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. +/// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. +/// +/// +/// Throttling delete requests +/// +/// +/// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. +/// This pads each batch with a wait time to throttle the rate. +/// Set requests_per_second to -1 to disable throttling. +/// +/// +/// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. +/// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. +/// By default the batch size is 1000, so if requests_per_second is set to 500: +/// +/// +/// target_time = 1000 / 500 per second = 2 seconds +/// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +/// +/// +/// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. +/// This is "bursty" instead of "smooth". +/// +/// +/// Slicing +/// +/// +/// Delete by query supports sliced scroll to parallelize the delete process. +/// This can improve efficiency and provide a convenient way to break the request down into smaller parts. +/// +/// +/// Setting slices to auto lets Elasticsearch choose the number of slices to use. +/// This setting will use one slice per shard, up to a certain limit. +/// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. +/// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: +/// +/// +/// +/// +/// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. +/// +/// +/// +/// +/// Fetching the status of the task for the request with slices only contains the status of completed slices. +/// +/// +/// +/// +/// These sub-requests are individually addressable for things like cancellation and rethrottling. +/// +/// +/// +/// +/// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. +/// +/// +/// +/// +/// Canceling the request with slices will cancel each sub-request. +/// +/// +/// +/// +/// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. +/// +/// +/// +/// +/// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. +/// +/// +/// +/// +/// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. +/// +/// +/// +/// +/// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: +/// +/// +/// +/// +/// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. +/// +/// +/// +/// +/// Delete performance scales linearly across available resources with the number of slices. +/// +/// +/// +/// +/// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. +/// +/// +/// Cancel a delete by query operation +/// +/// +/// Any delete by query can be canceled using the task cancel API. For example: +/// +/// +/// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel +/// +/// +/// The task ID can be found by using the get tasks API. +/// +/// +/// Cancellation should happen quickly but might take a few seconds. +/// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. +/// +/// +public readonly partial struct DeleteByQueryRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.DeleteByQueryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRequest instance) + { + Instance = instance; + } + + public DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(indices); + } + + public DeleteByQueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRequest instance) => new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRequest(Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// What to do if delete by query hits version conflicts: abort or proceed. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) + { + Instance.Conflicts = value; + return this; + } + + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Skips the specified number of documents. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor From(long? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// If true, Elasticsearch refreshes all shards involved in the delete by query after the request completes. + /// This is different than the delete API's refresh parameter, which causes just the shard that received the delete request to be refreshed. + /// Unlike the delete API, it does not support wait_for. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// If true, the request cache is used for this request. + /// Defaults to the index-level setting. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period to retain the search context for scrolling. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } + + /// + /// + /// The size of the scroll request that powers the operation. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ScrollSize(long? value) + { + Instance.ScrollSize = value; + return this; + } + + /// + /// + /// The explicit timeout for each search request. + /// It defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.SearchTimeout = value; + return this; + } + + /// + /// + /// The type of the search operation. + /// Available options include query_then_fetch and dfs_query_then_fetch. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) + { + Instance.Slices = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slices(System.Func action) + { + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Sort(params string[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period each deletion request waits for active shards. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The timeout value controls how long each write request waits for unavailable shards to become available. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// If true, the request blocks until the operation is complete. + /// If false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + /// + /// + /// The maximum number of documents to delete. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor MaxDocs(long? value) + { + Instance.MaxDocs = value; + return this; + } + + /// + /// + /// The documents to delete specified with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// The documents to delete specified with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public DeleteByQueryRequestDescriptor Query(Action configure) + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Slice = value; + return this; } /// @@ -1281,71 +2054,59 @@ public DeleteByQueryRequestDescriptor Query(Action /// - public DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Slice(System.Action> action) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public DeleteByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteByQueryRequest Build(System.Action> action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public DeleteByQueryRequestDescriptor Slice(Action configure) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor ErrorTrace(bool? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } + Instance.FilterPath = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryResponse.g.cs index 34d777cadbb..15d7f83b15b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryResponse.g.cs @@ -17,32 +17,213 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteByQueryResponse : ElasticsearchResponse +internal sealed partial class DeleteByQueryResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBatches = System.Text.Json.JsonEncodedText.Encode("batches"); + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropNoops = System.Text.Json.JsonEncodedText.Encode("noops"); + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerSecond = System.Text.Json.JsonEncodedText.Encode("requests_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropRetries = System.Text.Json.JsonEncodedText.Encode("retries"); + private static readonly System.Text.Json.JsonEncodedText PropSliceId = System.Text.Json.JsonEncodedText.Encode("slice_id"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + private static readonly System.Text.Json.JsonEncodedText PropThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledMillis = System.Text.Json.JsonEncodedText.Encode("throttled_millis"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntil = System.Text.Json.JsonEncodedText.Encode("throttled_until"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntilMillis = System.Text.Json.JsonEncodedText.Encode("throttled_until_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropVersionConflicts = System.Text.Json.JsonEncodedText.Encode("version_conflicts"); + + public override Elastic.Clients.Elasticsearch.DeleteByQueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBatches = default; + LocalJsonValue propDeleted = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue propNoops = default; + LocalJsonValue propRequestsPerSecond = default; + LocalJsonValue propRetries = default; + LocalJsonValue propSliceId = default; + LocalJsonValue propTask = default; + LocalJsonValue propThrottled = default; + LocalJsonValue propThrottledMillis = default; + LocalJsonValue propThrottledUntil = default; + LocalJsonValue propThrottledUntilMillis = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + LocalJsonValue propTotal = default; + LocalJsonValue propVersionConflicts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBatches.TryReadProperty(ref reader, options, PropBatches, null)) + { + continue; + } + + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNoops.TryReadProperty(ref reader, options, PropNoops, null)) + { + continue; + } + + if (propRequestsPerSecond.TryReadProperty(ref reader, options, PropRequestsPerSecond, null)) + { + continue; + } + + if (propRetries.TryReadProperty(ref reader, options, PropRetries, null)) + { + continue; + } + + if (propSliceId.TryReadProperty(ref reader, options, PropSliceId, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (propThrottled.TryReadProperty(ref reader, options, PropThrottled, null)) + { + continue; + } + + if (propThrottledMillis.TryReadProperty(ref reader, options, PropThrottledMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propThrottledUntil.TryReadProperty(ref reader, options, PropThrottledUntil, null)) + { + continue; + } + + if (propThrottledUntilMillis.TryReadProperty(ref reader, options, PropThrottledUntilMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propVersionConflicts.TryReadProperty(ref reader, options, PropVersionConflicts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteByQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Batches = propBatches.Value, + Deleted = propDeleted.Value, + Failures = propFailures.Value, + Noops = propNoops.Value, + RequestsPerSecond = propRequestsPerSecond.Value, + Retries = propRetries.Value, + SliceId = propSliceId.Value, + Task = propTask.Value, + Throttled = propThrottled.Value, + ThrottledMillis = propThrottledMillis.Value, + ThrottledUntil = propThrottledUntil.Value, + ThrottledUntilMillis = propThrottledUntilMillis.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value, + Total = propTotal.Value, + VersionConflicts = propVersionConflicts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteByQueryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBatches, value.Batches, null, null); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNoops, value.Noops, null, null); + writer.WriteProperty(options, PropRequestsPerSecond, value.RequestsPerSecond, null, null); + writer.WriteProperty(options, PropRetries, value.Retries, null, null); + writer.WriteProperty(options, PropSliceId, value.SliceId, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteProperty(options, PropThrottled, value.Throttled, null, null); + writer.WriteProperty(options, PropThrottledMillis, value.ThrottledMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropThrottledUntil, value.ThrottledUntil, null, null); + writer.WriteProperty(options, PropThrottledUntilMillis, value.ThrottledUntilMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropVersionConflicts, value.VersionConflicts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteByQueryResponseConverter))] +public sealed partial class DeleteByQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteByQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteByQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of scroll responses pulled back by the delete by query. /// /// - [JsonInclude, JsonPropertyName("batches")] - public long? Batches { get; init; } + public long? Batches { get; set; } /// /// /// The number of documents that were successfully deleted. /// /// - [JsonInclude, JsonPropertyName("deleted")] - public long? Deleted { get; init; } + public long? Deleted { get; set; } /// /// @@ -52,8 +233,7 @@ public sealed partial class DeleteByQueryResponse : ElasticsearchResponse /// You can use the conflicts option to prevent reindex from ending on version conflicts. /// /// - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } /// /// @@ -61,16 +241,14 @@ public sealed partial class DeleteByQueryResponse : ElasticsearchResponse /// It exists only so that delete by query, update by query, and reindex APIs return responses with the same structure. /// /// - [JsonInclude, JsonPropertyName("noops")] - public long? Noops { get; init; } + public long? Noops { get; set; } /// /// /// The number of requests per second effectively run during the delete by query. /// /// - [JsonInclude, JsonPropertyName("requests_per_second")] - public float? RequestsPerSecond { get; init; } + public float? RequestsPerSecond { get; set; } /// /// @@ -79,24 +257,18 @@ public sealed partial class DeleteByQueryResponse : ElasticsearchResponse /// search is the number of search actions retried. /// /// - [JsonInclude, JsonPropertyName("retries")] - public Elastic.Clients.Elasticsearch.Retries? Retries { get; init; } - [JsonInclude, JsonPropertyName("slice_id")] - public int? SliceId { get; init; } - [JsonInclude, JsonPropertyName("task")] - public Elastic.Clients.Elasticsearch.TaskId? Task { get; init; } - [JsonInclude, JsonPropertyName("throttled")] - public Elastic.Clients.Elasticsearch.Duration? Throttled { get; init; } + public Elastic.Clients.Elasticsearch.Retries? Retries { get; set; } + public int? SliceId { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? Task { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Throttled { get; set; } /// /// /// The number of milliseconds the request slept to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_millis")] - public long? ThrottledMillis { get; init; } - [JsonInclude, JsonPropertyName("throttled_until")] - public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; init; } + public System.TimeSpan? ThrottledMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; set; } /// /// @@ -104,38 +276,33 @@ public sealed partial class DeleteByQueryResponse : ElasticsearchResponse /// It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_until_millis")] - public long? ThrottledUntilMillis { get; init; } + public System.TimeSpan? ThrottledUntilMillis { get; set; } /// /// /// If true, some requests run during the delete by query operation timed out. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool? TimedOut { get; init; } + public bool? TimedOut { get; set; } /// /// /// The number of milliseconds from start to end of the whole operation. /// /// - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + public System.TimeSpan? Took { get; set; } /// /// /// The number of documents that were successfully processed. /// /// - [JsonInclude, JsonPropertyName("total")] - public long? Total { get; init; } + public long? Total { get; set; } /// /// /// The number of version conflicts that the delete by query hit. /// /// - [JsonInclude, JsonPropertyName("version_conflicts")] - public long? VersionConflicts { get; init; } + public long? VersionConflicts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleRequest.g.cs index 20985a3d66d..c2e17d4006d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteByQueryRethrottleRequestParameters : RequestParameters +public sealed partial class DeleteByQueryRethrottleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,35 @@ public sealed partial class DeleteByQueryRethrottleRequestParameters : RequestPa public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } +internal sealed partial class DeleteByQueryRethrottleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Throttle a delete by query operation. @@ -50,27 +72,49 @@ public sealed partial class DeleteByQueryRethrottleRequestParameters : RequestPa /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. /// /// -public sealed partial class DeleteByQueryRethrottleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestConverter))] +public sealed partial class DeleteByQueryRethrottleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.TaskId taskId) : base(r => r.Required("task_id", taskId)) { } +#if NET7_0_OR_GREATER + public DeleteByQueryRethrottleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteByQueryRethrottle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceDeleteByQueryRethrottle; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "delete_by_query_rethrottle"; + /// + /// + /// The ID for the task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TaskId TaskId { get => P("task_id"); set => PR("task_id", value); } + /// /// /// The throttle for this request in sub-requests per second. /// To disable throttling, set it to -1. /// /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } @@ -83,31 +127,100 @@ public DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.TaskId taskI /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. /// /// -public sealed partial class DeleteByQueryRethrottleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteByQueryRethrottleRequestDescriptor { - internal DeleteByQueryRethrottleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest Instance { get; init; } - public DeleteByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.TaskId taskId) : base(r => r.Required("task_id", taskId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteByQueryRethrottle; + public DeleteByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.TaskId taskId) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest(taskId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteByQueryRethrottleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest instance) => new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "delete_by_query_rethrottle"; + /// + /// + /// The ID for the task. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId value) + { + Instance.TaskId = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// To disable throttling, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteByQueryRethrottleRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteByQueryRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId taskId) + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("task_id", taskId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleResponse.g.cs index 1835de4dc4b..3dd0f0cd7d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteByQueryRethrottleResponse.g.cs @@ -17,29 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteByQueryRethrottleResponse : ElasticsearchResponse +internal sealed partial class DeleteByQueryRethrottleResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodeFailures = System.Text.Json.JsonEncodedText.Encode("node_failures"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropTaskFailures = System.Text.Json.JsonEncodedText.Encode("task_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + + public override Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propNodeFailures = default; + LocalJsonValue?> propNodes = default; + LocalJsonValue?> propTaskFailures = default; + LocalJsonValue propTasks = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodeFailures.TryReadProperty(ref reader, options, PropNodeFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTaskFailures.TryReadProperty(ref reader, options, PropTaskFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NodeFailures = propNodeFailures.Value, + Nodes = propNodes.Value, + TaskFailures = propTaskFailures.Value, + Tasks = propTasks.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodeFailures, value.NodeFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTaskFailures, value.TaskFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponseConverter))] +public sealed partial class DeleteByQueryRethrottleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("node_failures")] - public IReadOnlyCollection? NodeFailures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteByQueryRethrottleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteByQueryRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? NodeFailures { get; set; } /// /// /// Task information grouped by node, if group_by was set to node (the default). /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary? Nodes { get; init; } - [JsonInclude, JsonPropertyName("task_failures")] - public IReadOnlyCollection? TaskFailures { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Nodes { get; set; } + public System.Collections.Generic.IReadOnlyCollection? TaskFailures { get; set; } /// /// @@ -47,6 +119,5 @@ public sealed partial class DeleteByQueryRethrottleResponse : ElasticsearchRespo /// group_by was set to parents. /// /// - [JsonInclude, JsonPropertyName("tasks")] - public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; } + public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteRequest.g.cs index 4eee442b580..54fb28ded4f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteRequestParameters : RequestParameters +public sealed partial class DeleteRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -99,6 +92,35 @@ public sealed partial class DeleteRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class DeleteRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.DeleteRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a document. @@ -154,26 +176,59 @@ public sealed partial class DeleteRequestParameters : RequestParameters /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. /// /// -public partial class DeleteRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteRequestConverter))] +public partial class DeleteRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "delete"; + /// + /// + /// A unique identifier for the document. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The name of the target index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// Only perform the operation if the document has this primary term. /// /// - [JsonIgnore] public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } /// @@ -181,7 +236,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// Only perform the operation if the document has this sequence number. /// /// - [JsonIgnore] public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } /// @@ -191,7 +245,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If false, it does nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -199,7 +252,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -212,7 +264,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -221,7 +272,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// It must match the current version of the document for the request to succeed. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -229,7 +279,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } /// @@ -239,7 +288,6 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The default value of 1 means it waits for each primary shard to be active. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -298,61 +346,198 @@ public DeleteRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. /// /// -public sealed partial class DeleteRequestDescriptor : RequestDescriptor, DeleteRequestParameters> +public readonly partial struct DeleteRequestDescriptor { - internal DeleteRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DeleteRequest Instance { get; init; } - public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteRequest instance) { + Instance = instance; } - public DeleteRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.DeleteRequest(index, id); } - public DeleteRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public DeleteRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteRequest instance) => new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteRequest(Elastic.Clients.Elasticsearch.DeleteRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// The name of the target index. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDelete; + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor IfSeqNo(long? value) + { + Instance.IfSeqNo = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, it waits for a refresh to make this operation visible to search. + /// If false, it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - internal override string OperationName => "delete"; + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public DeleteRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); - public DeleteRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); - public DeleteRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public DeleteRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public DeleteRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public DeleteRequestDescriptor Version(long? version) => Qs("version", version); - public DeleteRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); - public DeleteRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// The period to wait for active shards. + /// + /// + /// This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. + /// Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. + /// By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// An explicit version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Version(long? value) { - RouteValues.Required("id", id); - return Self; + Instance.Version = value; + return this; } - public DeleteRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) { - RouteValues.Required("index", index); - return Self; + Instance.VersionType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The minimum number of shard copies that must be active before proceeding with the operation. + /// You can set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value of 1 means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -411,44 +596,212 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. /// /// -public sealed partial class DeleteRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRequestDescriptor { - internal DeleteRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DeleteRequest Instance { get; init; } - public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDelete; + public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public DeleteRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => false; + public DeleteRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteRequest(typeof(TDocument), id); + } - internal override string OperationName => "delete"; + public DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteRequest instance) => new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteRequest(Elastic.Clients.Elasticsearch.DeleteRequestDescriptor descriptor) => descriptor.Instance; - public DeleteRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); - public DeleteRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); - public DeleteRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public DeleteRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public DeleteRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public DeleteRequestDescriptor Version(long? version) => Qs("version", version); - public DeleteRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); - public DeleteRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// The name of the target index. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor IfSeqNo(long? value) + { + Instance.IfSeqNo = value; + return this; + } + + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, it waits for a refresh to make this operation visible to search. + /// If false, it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period to wait for active shards. + /// + /// + /// This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. + /// Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. + /// By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// An explicit version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// The minimum number of shard copies that must be active before proceeding with the operation. + /// You can set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value of 1 means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.DeleteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs index 8527471584b..b474a093846 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs @@ -17,51 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteResponse : ElasticsearchResponse +internal sealed partial class DeleteResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForcedRefresh = System.Text.Json.JsonEncodedText.Encode("forced_refresh"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.DeleteResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForcedRefresh = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propResult = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShards = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForcedRefresh.TryReadProperty(ref reader, options, PropForcedRefresh, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForcedRefresh = propForcedRefresh.Value, + Id = propId.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Result = propResult.Value, + SeqNo = propSeqNo.Value, + Shards = propShards.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForcedRefresh, value.ForcedRefresh, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteResponseConverter))] +public sealed partial class DeleteResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("forced_refresh")] - public bool? ForcedRefresh { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? ForcedRefresh { get; set; } /// /// /// The unique identifier for the added document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the index the document was added to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The result of the indexing operation: created or updated. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } /// /// @@ -69,22 +187,27 @@ public sealed partial class DeleteResponse : ElasticsearchResponse /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// /// Information about the replication process of the operation. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } /// /// /// The document version, which is incremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptRequest.g.cs index e435467e3a9..39fbf6bf0a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteScriptRequestParameters : RequestParameters +public sealed partial class DeleteScriptRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,26 +44,78 @@ public sealed partial class DeleteScriptRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteScriptRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.DeleteScriptRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteScriptRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a script or search template. /// Deletes a stored script or search template. /// /// -public sealed partial class DeleteScriptRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteScriptRequestConverter))] +public sealed partial class DeleteScriptRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteScriptRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteScript; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceDeleteScript; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "delete_script"; + /// + /// + /// The identifier for the stored script or search template. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -78,7 +123,6 @@ public DeleteScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// It can also be set to -1 to indicate that the request should never timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -88,7 +132,6 @@ public DeleteScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// It can also be set to -1 to indicate that the request should never timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -98,68 +141,114 @@ public DeleteScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// Deletes a stored script or search template. /// /// -public sealed partial class DeleteScriptRequestDescriptor : RequestDescriptor, DeleteScriptRequestParameters> +public readonly partial struct DeleteScriptRequestDescriptor { - internal DeleteScriptRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.DeleteScriptRequest Instance { get; init; } - public DeleteScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteScriptRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteScriptRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteScript; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; + public DeleteScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.DeleteScriptRequest(id); + } - internal override string OperationName => "delete_script"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteScriptRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeleteScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(Elastic.Clients.Elasticsearch.DeleteScriptRequest instance) => new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.DeleteScriptRequest(Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor descriptor) => descriptor.Instance; - public DeleteScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The identifier for the stored script or search template. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Delete a script or search template. -/// Deletes a stored script or search template. -/// -/// -public sealed partial class DeleteScriptRequestDescriptor : RequestDescriptor -{ - internal DeleteScriptRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeleteScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.DeleteScriptRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(new Elastic.Clients.Elasticsearch.DeleteScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceDeleteScript; + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "delete_script"; + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptResponse.g.cs index 660b7f3a641..bf9ab594c16 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteScriptResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteScriptResponse : ElasticsearchResponse +internal sealed partial class DeleteScriptResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.DeleteScriptResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DeleteScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DeleteScriptResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DeleteScriptResponseConverter))] +public sealed partial class DeleteScriptResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteScriptResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyRequest.g.cs index 6e2547bbd3c..3495de86f6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyRequest.g.cs @@ -17,21 +17,49 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class DeletePolicyRequestParameters : RequestParameters +public sealed partial class DeletePolicyRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class DeletePolicyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,19 +68,49 @@ public sealed partial class DeletePolicyRequestParameters : RequestParameters /// Deletes an existing enrich policy and its enrich index. /// /// -public sealed partial class DeletePolicyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestConverter))] +public sealed partial class DeletePolicyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeletePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeletePolicyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichDeletePolicy; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EnrichDeletePolicy; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "enrich.delete_policy"; + + /// + /// + /// Enrich policy to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -61,29 +119,99 @@ public DeletePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => /// Deletes an existing enrich policy and its enrich index. /// /// -public sealed partial class DeletePolicyRequestDescriptor : RequestDescriptor +public readonly partial struct DeletePolicyRequestDescriptor { - internal DeletePolicyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest Instance { get; init; } - public DeletePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichDeletePolicy; + public DeletePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeletePolicyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "enrich.delete_policy"; + /// + /// + /// Enrich policy to delete. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeletePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyResponse.g.cs index ce4f5649cb9..23e71f984c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/DeletePolicyResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class DeletePolicyResponse : ElasticsearchResponse +internal sealed partial class DeletePolicyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponseConverter))] +public sealed partial class DeletePolicyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePolicyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsRequest.g.cs index 83c270e3f05..50c3aefe116 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsRequest.g.cs @@ -17,21 +17,49 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class EnrichStatsRequestParameters : RequestParameters +public sealed partial class EnrichStatsRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class EnrichStatsRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,15 +68,39 @@ public sealed partial class EnrichStatsRequestParameters : RequestParameters /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. /// /// -public sealed partial class EnrichStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestConverter))] +public sealed partial class EnrichStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichStats; +#if NET7_0_OR_GREATER + public EnrichStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public EnrichStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrichStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EnrichStats; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "enrich.stats"; + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -57,23 +109,87 @@ public sealed partial class EnrichStatsRequest : PlainRequest /// -public sealed partial class EnrichStatsRequestDescriptor : RequestDescriptor +public readonly partial struct EnrichStatsRequestDescriptor { - internal EnrichStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest instance) + { + Instance = instance; + } public EnrichStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichStats; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "enrich.stats"; + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsResponse.g.cs index 9e9551fdeb4..3925c38020c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/EnrichStatsResponse.g.cs @@ -17,38 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class EnrichStatsResponse : ElasticsearchResponse +internal sealed partial class EnrichStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCacheStats = System.Text.Json.JsonEncodedText.Encode("cache_stats"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatorStats = System.Text.Json.JsonEncodedText.Encode("coordinator_stats"); + private static readonly System.Text.Json.JsonEncodedText PropExecutingPolicies = System.Text.Json.JsonEncodedText.Encode("executing_policies"); + + public override Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCacheStats = default; + LocalJsonValue> propCoordinatorStats = default; + LocalJsonValue> propExecutingPolicies = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheStats.TryReadProperty(ref reader, options, PropCacheStats, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCoordinatorStats.TryReadProperty(ref reader, options, PropCoordinatorStats, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propExecutingPolicies.TryReadProperty(ref reader, options, PropExecutingPolicies, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheStats = propCacheStats.Value, + CoordinatorStats = propCoordinatorStats.Value, + ExecutingPolicies = propExecutingPolicies.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheStats, value.CacheStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCoordinatorStats, value.CoordinatorStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExecutingPolicies, value.ExecutingPolicies, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponseConverter))] +public sealed partial class EnrichStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrichStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Objects containing information about the enrich cache stats on each ingest node. /// /// - [JsonInclude, JsonPropertyName("cache_stats")] - public IReadOnlyCollection? CacheStats { get; init; } + public System.Collections.Generic.IReadOnlyCollection? CacheStats { get; set; } /// /// /// Objects containing information about each coordinating ingest node for configured enrich processors. /// /// - [JsonInclude, JsonPropertyName("coordinator_stats")] - public IReadOnlyCollection CoordinatorStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection CoordinatorStats { get; set; } /// /// /// Objects containing information about each enrich policy that is currently executing. /// /// - [JsonInclude, JsonPropertyName("executing_policies")] - public IReadOnlyCollection ExecutingPolicies { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ExecutingPolicies { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyRequest.g.cs index daa404fd68f..ad29b049f08 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyRequest.g.cs @@ -17,21 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class ExecutePolicyRequestParameters : RequestParameters +public sealed partial class ExecutePolicyRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// If true, the request blocks other enrich policy execution requests until complete. @@ -40,32 +40,90 @@ public sealed partial class ExecutePolicyRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class ExecutePolicyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Run an enrich policy. /// Create the enrich index for an existing enrich policy. /// /// -public sealed partial class ExecutePolicyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestConverter))] +public sealed partial class ExecutePolicyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ExecutePolicyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichExecutePolicy; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EnrichExecutePolicy; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "enrich.execute_policy"; + /// + /// + /// Enrich policy to execute. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// If true, the request blocks other enrich policy execution requests until complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -75,31 +133,110 @@ public ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => /// Create the enrich index for an existing enrich policy. /// /// -public sealed partial class ExecutePolicyRequestDescriptor : RequestDescriptor +public readonly partial struct ExecutePolicyRequestDescriptor { - internal ExecutePolicyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest Instance { get; init; } - public ExecutePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecutePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichExecutePolicy; + public ExecutePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExecutePolicyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "enrich.execute_policy"; + /// + /// + /// Enrich policy to execute. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// If true, the request blocks other enrich policy execution requests until complete. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public ExecutePolicyRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExecutePolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyResponse.g.cs index 16db521cad5..b04a6dc08c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/ExecutePolicyResponse.g.cs @@ -17,19 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class ExecutePolicyResponse : ElasticsearchResponse +internal sealed partial class ExecutePolicyResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + + public override Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStatus = default; + LocalJsonValue propTask = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Status = propStatus.Value, + Task = propTask.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponseConverter))] +public sealed partial class ExecutePolicyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatus? Status { get; init; } - [JsonInclude, JsonPropertyName("task_id")] - public Elastic.Clients.Elasticsearch.TaskId? TaskId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecutePolicyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecutePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatus? Status { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? Task { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyRequest.g.cs index 48e5c1b5181..4ee0fe1f32f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyRequest.g.cs @@ -17,21 +17,49 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class GetPolicyRequestParameters : RequestParameters +public sealed partial class GetPolicyRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class GetPolicyRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,23 +68,50 @@ public sealed partial class GetPolicyRequestParameters : RequestParameters /// Returns information about an enrich policy. /// /// -public sealed partial class GetPolicyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestConverter))] +public sealed partial class GetPolicyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetPolicyRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetPolicyRequest() { } - - public GetPolicyRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetPolicyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichGetPolicy; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EnrichGetPolicy; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "enrich.get_policy"; + + /// + /// + /// Comma-separated list of enrich policy names used to limit the request. + /// To return information for all enrich policies, omit this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -65,33 +120,104 @@ public GetPolicyRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r /// Returns information about an enrich policy. /// /// -public sealed partial class GetPolicyRequestDescriptor : RequestDescriptor +public readonly partial struct GetPolicyRequestDescriptor { - internal GetPolicyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest Instance { get; init; } - public GetPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest instance) { + Instance = instance; + } + + public GetPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(name); } public GetPolicyRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichGetPolicy; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of enrich policy names used to limit the request. + /// To return information for all enrich policies, omit this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "enrich.get_policy"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyResponse.g.cs index cadd77f15f8..898c94603f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/GetPolicyResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class GetPolicyResponse : ElasticsearchResponse +internal sealed partial class GetPolicyResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("policies")] - public IReadOnlyCollection Policies { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropPolicies = System.Text.Json.JsonEncodedText.Encode("policies"); + + public override Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPolicies = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicies.TryReadProperty(ref reader, options, PropPolicies, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Policies = propPolicies.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicies, value.Policies, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponseConverter))] +public sealed partial class GetPolicyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPolicyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Policies { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyRequest.g.cs index 7431d4cedbb..81aa6a3c4f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyRequest.g.cs @@ -17,21 +17,77 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class PutPolicyRequestParameters : RequestParameters +public sealed partial class PutPolicyRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class PutPolicyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGeoMatch = System.Text.Json.JsonEncodedText.Encode("geo_match"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropRange = System.Text.Json.JsonEncodedText.Encode("range"); + + public override Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGeoMatch = default; + LocalJsonValue propMatch = default; + LocalJsonValue propRange = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGeoMatch.TryReadProperty(ref reader, options, PropGeoMatch, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propRange.TryReadProperty(ref reader, options, PropRange, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GeoMatch = propGeoMatch.Value, + Match = propMatch.Value, + Range = propRange.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGeoMatch, value.GeoMatch, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropRange, value.Range, null, null); + writer.WriteEndObject(); + } } /// @@ -40,26 +96,55 @@ public sealed partial class PutPolicyRequestParameters : RequestParameters /// Creates an enrich policy. /// /// -public sealed partial class PutPolicyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestConverter))] +public sealed partial class PutPolicyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutPolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutPolicyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichPutPolicy; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EnrichPutPolicy; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "enrich.put_policy"; + /// + /// + /// Name of the enrich policy to create or update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// Matches enrich data to incoming documents based on a geo_shape query. /// /// - [JsonInclude, JsonPropertyName("geo_match")] public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? GeoMatch { get; set; } /// @@ -67,7 +152,6 @@ public PutPolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.R /// Matches enrich data to incoming documents based on a term query. /// /// - [JsonInclude, JsonPropertyName("match")] public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? Match { get; set; } /// @@ -75,7 +159,6 @@ public PutPolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.R /// Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a term query. /// /// - [JsonInclude, JsonPropertyName("range")] public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? Range { get; set; } } @@ -85,65 +168,94 @@ public PutPolicyRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.R /// Creates an enrich policy. /// /// -public sealed partial class PutPolicyRequestDescriptor : RequestDescriptor, PutPolicyRequestParameters> +public readonly partial struct PutPolicyRequestDescriptor { - internal PutPolicyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest Instance { get; init; } - public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichPutPolicy; + public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutPolicyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "enrich.put_policy"; + /// + /// + /// Name of the enrich policy to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("name", name); - return Self; + Instance.MasterTimeout = value; + return this; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? GeoMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor GeoMatchDescriptor { get; set; } - private Action> GeoMatchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchDescriptor { get; set; } - private Action> MatchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? RangeValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor RangeDescriptor { get; set; } - private Action> RangeDescriptorAction { get; set; } + /// + /// + /// Matches enrich data to incoming documents based on a geo_shape query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) + { + Instance.GeoMatch = value; + return this; + } /// /// /// Matches enrich data to incoming documents based on a geo_shape query. /// /// - public PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? geoMatch) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor GeoMatch(System.Action action) { - GeoMatchDescriptor = null; - GeoMatchDescriptorAction = null; - GeoMatchValue = geoMatch; - return Self; + Instance.GeoMatch = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + /// + /// + /// Matches enrich data to incoming documents based on a geo_shape query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor GeoMatch(System.Action> action) { - GeoMatchValue = null; - GeoMatchDescriptorAction = null; - GeoMatchDescriptor = descriptor; - return Self; + Instance.GeoMatch = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor GeoMatch(Action> configure) + /// + /// + /// Matches enrich data to incoming documents based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) { - GeoMatchValue = null; - GeoMatchDescriptor = null; - GeoMatchDescriptorAction = configure; - return Self; + Instance.Match = value; + return this; } /// @@ -151,28 +263,32 @@ public PutPolicyRequestDescriptor GeoMatch(Actionterm query. /// /// - public PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? match) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Match(System.Action action) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + /// + /// + /// Matches enrich data to incoming documents based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Match(Action> configure) + /// + /// + /// Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.Range = value; + return this; } /// @@ -180,82 +296,71 @@ public PutPolicyRequestDescriptor Match(Actionterm query. /// /// - public PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? range) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Range(System.Action action) { - RangeDescriptor = null; - RangeDescriptorAction = null; - RangeValue = range; - return Self; + Instance.Range = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + /// + /// + /// Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Range(System.Action> action) { - RangeValue = null; - RangeDescriptorAction = null; - RangeDescriptor = descriptor; - return Self; + Instance.Range = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Range(Action> configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest Build(System.Action action) { - RangeValue = null; - RangeDescriptor = null; - RangeDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (GeoMatchDescriptor is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, GeoMatchDescriptor, options); - } - else if (GeoMatchDescriptorAction is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(GeoMatchDescriptorAction), options); - } - else if (GeoMatchValue is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, GeoMatchValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(MatchDescriptorAction), options); - } - else if (MatchValue is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RangeDescriptor is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, RangeDescriptor, options); - } - else if (RangeDescriptorAction is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(RangeDescriptorAction), options); - } - else if (RangeValue is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, RangeValue, options); - } + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -265,65 +370,72 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Creates an enrich policy. /// /// -public sealed partial class PutPolicyRequestDescriptor : RequestDescriptor +public readonly partial struct PutPolicyRequestDescriptor { - internal PutPolicyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest Instance { get; init; } - public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EnrichPutPolicy; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(name); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutPolicyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "enrich.put_policy"; + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest instance) => new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor descriptor) => descriptor.Instance; - public PutPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Name of the enrich policy to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("name", name); - return Self; + Instance.Name = value; + return this; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? GeoMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor GeoMatchDescriptor { get; set; } - private Action GeoMatchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchDescriptor { get; set; } - private Action MatchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? RangeValue { get; set; } - private Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor RangeDescriptor { get; set; } - private Action RangeDescriptorAction { get; set; } - /// /// - /// Matches enrich data to incoming documents based on a geo_shape query. + /// Period to wait for a connection to the master node. /// /// - public PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? geoMatch) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - GeoMatchDescriptor = null; - GeoMatchDescriptorAction = null; - GeoMatchValue = geoMatch; - return Self; + Instance.MasterTimeout = value; + return this; } - public PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + /// + /// + /// Matches enrich data to incoming documents based on a geo_shape query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor GeoMatch(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) { - GeoMatchValue = null; - GeoMatchDescriptorAction = null; - GeoMatchDescriptor = descriptor; - return Self; + Instance.GeoMatch = value; + return this; } - public PutPolicyRequestDescriptor GeoMatch(Action configure) + /// + /// + /// Matches enrich data to incoming documents based on a geo_shape query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor GeoMatch(System.Action> action) { - GeoMatchValue = null; - GeoMatchDescriptor = null; - GeoMatchDescriptorAction = configure; - return Self; + Instance.GeoMatch = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } /// @@ -331,28 +443,32 @@ public PutPolicyRequestDescriptor GeoMatch(Actionterm query. /// /// - public PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? match) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = value; + return this; } - public PutPolicyRequestDescriptor Match(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + /// + /// + /// Matches enrich data to incoming documents based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Match(Action configure) + /// + /// + /// Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? value) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.Range = value; + return this; } /// @@ -360,81 +476,59 @@ public PutPolicyRequestDescriptor Match(Actionterm query. /// /// - public PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy? range) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Range(System.Action> action) { - RangeDescriptor = null; - RangeDescriptorAction = null; - RangeValue = range; - return Self; + Instance.Range = Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor.Build(action); + return this; } - public PutPolicyRequestDescriptor Range(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest Build(System.Action> action) { - RangeValue = null; - RangeDescriptorAction = null; - RangeDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PutPolicyRequestDescriptor Range(Action configure) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor ErrorTrace(bool? value) { - RangeValue = null; - RangeDescriptor = null; - RangeDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (GeoMatchDescriptor is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, GeoMatchDescriptor, options); - } - else if (GeoMatchDescriptorAction is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(GeoMatchDescriptorAction), options); - } - else if (GeoMatchValue is not null) - { - writer.WritePropertyName("geo_match"); - JsonSerializer.Serialize(writer, GeoMatchValue, options); - } + Instance.FilterPath = value; + return this; + } - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(MatchDescriptorAction), options); - } - else if (MatchValue is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RangeDescriptor is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, RangeDescriptor, options); - } - else if (RangeDescriptorAction is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(RangeDescriptorAction), options); - } - else if (RangeValue is not null) - { - writer.WritePropertyName("range"); - JsonSerializer.Serialize(writer, RangeValue, options); - } + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyResponse.g.cs index b1c1eb5625c..fba8a52ecbf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Enrich/PutPolicyResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public sealed partial class PutPolicyResponse : ElasticsearchResponse +internal sealed partial class PutPolicyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponseConverter))] +public sealed partial class PutPolicyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPolicyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteRequest.g.cs index ab270a990cd..ee4b95c5aa9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlDeleteRequestParameters : RequestParameters +public sealed partial class EqlDeleteRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class EqlDeleteRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an async EQL search. @@ -41,19 +63,44 @@ public sealed partial class EqlDeleteRequestParameters : RequestParameters /// The API also deletes results for the search. /// /// -public sealed partial class EqlDeleteRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestConverter))] +public sealed partial class EqlDeleteRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public EqlDeleteRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public EqlDeleteRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EqlDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "eql.delete"; + + /// + /// + /// Identifier for the search to delete. + /// A search ID is provided in the EQL search API's response for an async search. + /// A search ID is also provided if the request’s keep_on_completion parameter is true. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -63,63 +110,90 @@ public EqlDeleteRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requi /// The API also deletes results for the search. /// /// -public sealed partial class EqlDeleteRequestDescriptor : RequestDescriptor, EqlDeleteRequestParameters> +public readonly partial struct EqlDeleteRequestDescriptor { - internal EqlDeleteRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest Instance { get; init; } - public EqlDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlDelete; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; - - internal override string OperationName => "eql.delete"; + public EqlDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest(id); + } - public EqlDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public EqlDeleteRequestDescriptor() { - RouteValues.Required("id", id); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public static explicit operator Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest instance) => new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Identifier for the search to delete. + /// A search ID is provided in the EQL search API's response for an async search. + /// A search ID is also provided if the request’s keep_on_completion parameter is true. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } -} -/// -/// -/// Delete an async EQL search. -/// Delete an async EQL search or a stored synchronous EQL search. -/// The API also deletes results for the search. -/// -/// -public sealed partial class EqlDeleteRequestDescriptor : RequestDescriptor -{ - internal EqlDeleteRequestDescriptor(Action configure) => configure.Invoke(this); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public EqlDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlDelete; + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "eql.delete"; + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public EqlDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteResponse.g.cs index 2ab88cfe2cc..2d63f8986d1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlDeleteResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlDeleteResponse : ElasticsearchResponse +internal sealed partial class EqlDeleteResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponseConverter))] +public sealed partial class EqlDeleteResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlDeleteResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlDeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetRequest.g.cs index bb6b31ce705..7394b9c2157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlGetRequestParameters : RequestParameters +public sealed partial class EqlGetRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,33 +42,84 @@ public sealed partial class EqlGetRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } +internal sealed partial class EqlGetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Eql.EqlGetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlGetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get async EQL search results. /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. /// /// -public sealed partial class EqlGetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlGetRequestConverter))] +public sealed partial class EqlGetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public EqlGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public EqlGetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EqlGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "eql.get"; + /// + /// + /// Identifier for the search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Period for which the search and its results are stored on the cluster. /// Defaults to the keep_alive value set by the search’s EQL search API request. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -84,7 +128,6 @@ public EqlGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// Defaults to no timeout, meaning the request waits for complete search results. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } @@ -94,68 +137,112 @@ public EqlGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. /// /// -public sealed partial class EqlGetRequestDescriptor : RequestDescriptor, EqlGetRequestParameters> +public readonly partial struct EqlGetRequestDescriptor { - internal EqlGetRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Eql.EqlGetRequest Instance { get; init; } - public EqlGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlGetRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlGetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGet; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public EqlGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequest(id); + } - internal override string OperationName => "eql.get"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public EqlGetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public EqlGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public EqlGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + public static explicit operator Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlGetRequest instance) => new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Eql.EqlGetRequest(Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor descriptor) => descriptor.Instance; - public EqlGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Period for which the search and its results are stored on the cluster. + /// Defaults to the keep_alive value set by the search’s EQL search API request. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.KeepAlive = value; + return this; } -} -/// -/// -/// Get async EQL search results. -/// Get the current status and available results for an async EQL search or a stored synchronous EQL search. -/// -/// -public sealed partial class EqlGetRequestDescriptor : RequestDescriptor -{ - internal EqlGetRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Timeout duration to wait for the request to finish. + /// Defaults to no timeout, meaning the request waits for complete search results. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } - public EqlGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Eql.EqlGetRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(new Elastic.Clients.Elasticsearch.Eql.EqlGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGet; + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "eql.get"; + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public EqlGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public EqlGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public EqlGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetResponse.g.cs index b808cd86302..a3ebea57b32 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlGetResponse.g.cs @@ -17,62 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlGetResponse : ElasticsearchResponse +internal sealed partial class EqlGetResponseConverter : System.Text.Json.Serialization.JsonConverter> { + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropShardFailures = System.Text.Json.JsonEncodedText.Encode("shard_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.Eql.EqlGetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHits = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue?> propShardFailures = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propShardFailures.TryReadProperty(ref reader, options, PropShardFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlGetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + ShardFailures = propShardFailures.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlGetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropShardFailures, value.ShardFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class EqlGetResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(EqlGetResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(EqlGetResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlGetResponseConverterFactory))] +public partial class EqlGetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlGetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlGetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains matching events and sequences. Also contains related metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Eql.EqlHits Hits { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Eql.EqlHits Hits { get; set; } /// /// /// Identifier for the search. /// /// - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public string? Id { get; set; } /// /// /// If true, the response does not contain complete search results. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool? IsPartial { get; init; } + public bool? IsPartial { get; set; } /// /// /// If true, the search request is still executing. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool? IsRunning { get; init; } + public bool? IsRunning { get; set; } + + /// + /// + /// Contains information about shard failures (if any), in case allow_partial_search_results=true + /// + /// + public System.Collections.Generic.IReadOnlyCollection? ShardFailures { get; set; } /// /// /// If true, the request timed out before completion. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool? TimedOut { get; init; } + public bool? TimedOut { get; set; } /// /// /// Milliseconds it took Elasticsearch to execute the request. /// /// - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + public System.TimeSpan? Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchRequest.g.cs index d9b227b20ef..edadd293dce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchRequest.g.cs @@ -17,23 +17,16 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlSearchRequestParameters : RequestParameters +public sealed partial class EqlSearchRequestParameters : Elastic.Transport.RequestParameters { public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -43,6 +36,189 @@ public sealed partial class EqlSearchRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } +internal sealed partial class EqlSearchRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowPartialSearchResults = System.Text.Json.JsonEncodedText.Encode("allow_partial_search_results"); + private static readonly System.Text.Json.JsonEncodedText PropAllowPartialSequenceResults = System.Text.Json.JsonEncodedText.Encode("allow_partial_sequence_results"); + private static readonly System.Text.Json.JsonEncodedText PropCaseSensitive = System.Text.Json.JsonEncodedText.Encode("case_sensitive"); + private static readonly System.Text.Json.JsonEncodedText PropEventCategoryField = System.Text.Json.JsonEncodedText.Encode("event_category_field"); + private static readonly System.Text.Json.JsonEncodedText PropFetchSize = System.Text.Json.JsonEncodedText.Encode("fetch_size"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropKeepAlive = System.Text.Json.JsonEncodedText.Encode("keep_alive"); + private static readonly System.Text.Json.JsonEncodedText PropKeepOnCompletion = System.Text.Json.JsonEncodedText.Encode("keep_on_completion"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSamplesPerKey = System.Text.Json.JsonEncodedText.Encode("max_samples_per_key"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropResultPosition = System.Text.Json.JsonEncodedText.Encode("result_position"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropTiebreakerField = System.Text.Json.JsonEncodedText.Encode("tiebreaker_field"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampField = System.Text.Json.JsonEncodedText.Encode("timestamp_field"); + private static readonly System.Text.Json.JsonEncodedText PropWaitForCompletionTimeout = System.Text.Json.JsonEncodedText.Encode("wait_for_completion_timeout"); + + public override Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowPartialSearchResults = default; + LocalJsonValue propAllowPartialSequenceResults = default; + LocalJsonValue propCaseSensitive = default; + LocalJsonValue propEventCategoryField = default; + LocalJsonValue propFetchSize = default; + LocalJsonValue?> propFields = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propKeepAlive = default; + LocalJsonValue propKeepOnCompletion = default; + LocalJsonValue propMaxSamplesPerKey = default; + LocalJsonValue propQuery = default; + LocalJsonValue propResultPosition = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue propSize = default; + LocalJsonValue propTiebreakerField = default; + LocalJsonValue propTimestampField = default; + LocalJsonValue propWaitForCompletionTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowPartialSearchResults.TryReadProperty(ref reader, options, PropAllowPartialSearchResults, null)) + { + continue; + } + + if (propAllowPartialSequenceResults.TryReadProperty(ref reader, options, PropAllowPartialSequenceResults, null)) + { + continue; + } + + if (propCaseSensitive.TryReadProperty(ref reader, options, PropCaseSensitive, null)) + { + continue; + } + + if (propEventCategoryField.TryReadProperty(ref reader, options, PropEventCategoryField, null)) + { + continue; + } + + if (propFetchSize.TryReadProperty(ref reader, options, PropFetchSize, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propKeepAlive.TryReadProperty(ref reader, options, PropKeepAlive, null)) + { + continue; + } + + if (propKeepOnCompletion.TryReadProperty(ref reader, options, PropKeepOnCompletion, null)) + { + continue; + } + + if (propMaxSamplesPerKey.TryReadProperty(ref reader, options, PropMaxSamplesPerKey, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propResultPosition.TryReadProperty(ref reader, options, PropResultPosition, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propTiebreakerField.TryReadProperty(ref reader, options, PropTiebreakerField, null)) + { + continue; + } + + if (propTimestampField.TryReadProperty(ref reader, options, PropTimestampField, null)) + { + continue; + } + + if (propWaitForCompletionTimeout.TryReadProperty(ref reader, options, PropWaitForCompletionTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowPartialSearchResults = propAllowPartialSearchResults.Value, + AllowPartialSequenceResults = propAllowPartialSequenceResults.Value, + CaseSensitive = propCaseSensitive.Value, + EventCategoryField = propEventCategoryField.Value, + FetchSize = propFetchSize.Value, + Fields = propFields.Value, + Filter = propFilter.Value, + KeepAlive = propKeepAlive.Value, + KeepOnCompletion = propKeepOnCompletion.Value, + MaxSamplesPerKey = propMaxSamplesPerKey.Value, + Query = propQuery.Value, + ResultPosition = propResultPosition.Value, + RuntimeMappings = propRuntimeMappings.Value, + Size = propSize.Value, + TiebreakerField = propTiebreakerField.Value, + TimestampField = propTimestampField.Value, + WaitForCompletionTimeout = propWaitForCompletionTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowPartialSearchResults, value.AllowPartialSearchResults, null, null); + writer.WriteProperty(options, PropAllowPartialSequenceResults, value.AllowPartialSequenceResults, null, null); + writer.WriteProperty(options, PropCaseSensitive, value.CaseSensitive, null, null); + writer.WriteProperty(options, PropEventCategoryField, value.EventCategoryField, null, null); + writer.WriteProperty(options, PropFetchSize, value.FetchSize, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropKeepAlive, value.KeepAlive, null, null); + writer.WriteProperty(options, PropKeepOnCompletion, value.KeepOnCompletion, null, null); + writer.WriteProperty(options, PropMaxSamplesPerKey, value.MaxSamplesPerKey, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropResultPosition, value.ResultPosition, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropTiebreakerField, value.TiebreakerField, null, null); + writer.WriteProperty(options, PropTimestampField, value.TimestampField, null, null); + writer.WriteProperty(options, PropWaitForCompletionTimeout, value.WaitForCompletionTimeout, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get EQL search results. @@ -50,33 +226,76 @@ public sealed partial class EqlSearchRequestParameters : RequestParameters /// EQL assumes each document in a data stream or index corresponds to an event. /// /// -public sealed partial class EqlSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestConverter))] +public sealed partial class EqlSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlSearch; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices, string query) : base(r => r.Required("index", indices)) + { + Query = query; + } +#if NET7_0_OR_GREATER + public EqlSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EqlSearch; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "eql.search"; - [JsonIgnore] + /// + /// + /// The name of the index to scope the operation + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } - [JsonInclude, JsonPropertyName("case_sensitive")] + + /// + /// + /// Allow query execution also in case of shard failures. + /// If true, the query will keep running and will return results based on the available shards. + /// For sequences, the behavior can be further refined using allow_partial_sequence_results + /// + /// + public bool? AllowPartialSearchResults { get; set; } + + /// + /// + /// This flag applies only to sequences and has effect only if allow_partial_search_results=true. + /// If true, the sequence query will return results based on the available shards, ignoring the others. + /// If false, the sequence query will return successfully, but will always have empty results. + /// + /// + public bool? AllowPartialSequenceResults { get; set; } public bool? CaseSensitive { get; set; } /// @@ -84,7 +303,6 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Field containing the event classification, such as process, file, or network. /// /// - [JsonInclude, JsonPropertyName("event_category_field")] public Elastic.Clients.Elasticsearch.Field? EventCategoryField { get; set; } /// @@ -92,7 +310,6 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Maximum number of events to search at a time for sequence queries. /// /// - [JsonInclude, JsonPropertyName("fetch_size")] public int? FetchSize { get; set; } /// @@ -100,41 +317,44 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. /// /// - [JsonInclude, JsonPropertyName("fields")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat))] - public ICollection? Fields { get; set; } + public System.Collections.Generic.ICollection? Fields { get; set; } /// /// /// Query, written in Query DSL, used to filter the events on which the EQL query runs. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } - [JsonInclude, JsonPropertyName("keep_alive")] + public System.Collections.Generic.ICollection? Filter { get; set; } public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get; set; } - [JsonInclude, JsonPropertyName("keep_on_completion")] public bool? KeepOnCompletion { get; set; } + /// + /// + /// By default, the response of a sample query contains up to 10 samples, with one sample per unique set of join keys. Use the size + /// parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the + /// max_samples_per_key parameter. Pipes are not supported for sample queries. + /// + /// + public int? MaxSamplesPerKey { get; set; } + /// /// /// EQL query you wish to run. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("result_position")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public Elastic.Clients.Elasticsearch.Eql.ResultPosition? ResultPosition { get; set; } - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// For basic queries, the maximum number of matching events to return. Defaults to 10 /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -142,7 +362,6 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Field used to sort hits with the same timestamp in ascending order /// /// - [JsonInclude, JsonPropertyName("tiebreaker_field")] public Elastic.Clients.Elasticsearch.Field? TiebreakerField { get; set; } /// @@ -150,9 +369,7 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Field containing event timestamp. Default "@timestamp" /// /// - [JsonInclude, JsonPropertyName("timestamp_field")] public Elastic.Clients.Elasticsearch.Field? TimestampField { get; set; } - [JsonInclude, JsonPropertyName("wait_for_completion_timeout")] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get; set; } } @@ -163,72 +380,102 @@ public EqlSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// EQL assumes each document in a data stream or index corresponds to an event. /// /// -public sealed partial class EqlSearchRequestDescriptor : RequestDescriptor, EqlSearchRequestParameters> +public readonly partial struct EqlSearchRequestDescriptor { - internal EqlSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest Instance { get; init; } - public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest instance) { + Instance = instance; } - public EqlSearchRequestDescriptor() : this(typeof(TDocument)) + public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(indices); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlSearch; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public EqlSearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest instance) => new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The name of the index to scope the operation + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "eql.search"; + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public EqlSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public EqlSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public EqlSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public EqlSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - RouteValues.Required("index", indices); - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - private bool? CaseSensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? EventCategoryFieldValue { get; set; } - private int? FetchSizeValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Duration? KeepAliveValue { get; set; } - private bool? KeepOnCompletionValue { get; set; } - private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Eql.ResultPosition? ResultPositionValue { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TiebreakerFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TimestampFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeoutValue { get; set; } + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public EqlSearchRequestDescriptor CaseSensitive(bool? caseSensitive = true) + /// + /// + /// Allow query execution also in case of shard failures. + /// If true, the query will keep running and will return results based on the available shards. + /// For sequences, the behavior can be further refined using allow_partial_sequence_results + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowPartialSearchResults(bool? value = true) { - CaseSensitiveValue = caseSensitive; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } /// /// - /// Field containing the event classification, such as process, file, or network. + /// This flag applies only to sequences and has effect only if allow_partial_search_results=true. + /// If true, the sequence query will return results based on the available shards, ignoring the others. + /// If false, the sequence query will return successfully, but will always have empty results. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients.Elasticsearch.Field? eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowPartialSequenceResults(bool? value = true) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.AllowPartialSequenceResults = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor CaseSensitive(bool? value = true) + { + Instance.CaseSensitive = value; + return this; } /// @@ -236,10 +483,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients. /// Field containing the event classification, such as process, file, or network. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Expression> eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients.Elasticsearch.Field? value) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.EventCategoryField = value; + return this; } /// @@ -247,10 +494,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Expressi /// Field containing the event classification, such as process, file, or network. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Expression> eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor EventCategoryField(System.Linq.Expressions.Expression> value) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.EventCategoryField = value; + return this; } /// @@ -258,10 +505,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Expression /// - public EqlSearchRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -269,149 +516,230 @@ public EqlSearchRequestDescriptor FetchSize(int? fetchSize) /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. /// /// - public EqlSearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public EqlSearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public EqlSearchRequestDescriptor Fields(Action> configure) + /// + /// + /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(params System.Action[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public EqlSearchRequestDescriptor Fields(params Action>[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// /// - /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. /// /// - public EqlSearchRequestDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(params System.Action>[] actions) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public EqlSearchRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Fields = items; + return this; } - public EqlSearchRequestDescriptor Filter(Action> configure) + /// + /// + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = value; + return this; } - public EqlSearchRequestDescriptor Filter(params Action>[] configure) + /// + /// + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = [.. values]; + return this; } - public EqlSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) + /// + /// + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(params System.Action[] actions) { - KeepAliveValue = keepAlive; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public EqlSearchRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) - { - KeepOnCompletionValue = keepOnCompletion; - return Self; + Instance.Filter = items; + return this; } /// /// - /// EQL query you wish to run. + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. /// /// - public EqlSearchRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(params System.Action>[] actions) { - QueryValue = query; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public EqlSearchRequestDescriptor ResultPosition(Elastic.Clients.Elasticsearch.Eql.ResultPosition? resultPosition) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - ResultPositionValue = resultPosition; - return Self; + Instance.KeepAlive = value; + return this; } - public EqlSearchRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor KeepOnCompletion(bool? value = true) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.KeepOnCompletion = value; + return this; } /// /// - /// For basic queries, the maximum number of matching events to return. Defaults to 10 + /// By default, the response of a sample query contains up to 10 samples, with one sample per unique set of join keys. Use the size + /// parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the + /// max_samples_per_key parameter. Pipes are not supported for sample queries. /// /// - public EqlSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor MaxSamplesPerKey(int? value) { - SizeValue = size; - return Self; + Instance.MaxSamplesPerKey = value; + return this; } /// /// - /// Field used to sort hits with the same timestamp in ascending order + /// EQL query you wish to run. /// /// - public EqlSearchRequestDescriptor TiebreakerField(Elastic.Clients.Elasticsearch.Field? tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Query(string value) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.Query = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ResultPosition(Elastic.Clients.Elasticsearch.Eql.ResultPosition? value) + { + Instance.ResultPosition = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// /// - /// Field used to sort hits with the same timestamp in ascending order + /// For basic queries, the maximum number of matching events to return. Defaults to 10 /// /// - public EqlSearchRequestDescriptor TiebreakerField(Expression> tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Size(int? value) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.Size = value; + return this; } /// @@ -419,21 +747,21 @@ public EqlSearchRequestDescriptor TiebreakerField(Expression< /// Field used to sort hits with the same timestamp in ascending order /// /// - public EqlSearchRequestDescriptor TiebreakerField(Expression> tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TiebreakerField(Elastic.Clients.Elasticsearch.Field? value) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.TiebreakerField = value; + return this; } /// /// - /// Field containing event timestamp. Default "@timestamp" + /// Field used to sort hits with the same timestamp in ascending order /// /// - public EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TiebreakerField(System.Linq.Expressions.Expression> value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TiebreakerField = value; + return this; } /// @@ -441,10 +769,10 @@ public EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elas /// Field containing event timestamp. Default "@timestamp" /// /// - public EqlSearchRequestDescriptor TimestampField(Expression> timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TimestampField = value; + return this; } /// @@ -452,148 +780,66 @@ public EqlSearchRequestDescriptor TimestampField(Expression /// - public EqlSearchRequestDescriptor TimestampField(Expression> timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TimestampField = value; + return this; } - public EqlSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - WaitForCompletionTimeoutValue = waitForCompletionTimeout; - return Self; + Instance.WaitForCompletionTimeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest Build(System.Action action) { - writer.WriteStartObject(); - if (CaseSensitiveValue.HasValue) - { - writer.WritePropertyName("case_sensitive"); - writer.WriteBooleanValue(CaseSensitiveValue.Value); - } - - if (EventCategoryFieldValue is not null) - { - writer.WritePropertyName("event_category_field"); - JsonSerializer.Serialize(writer, EventCategoryFieldValue, options); - } - - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - if (FieldsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - if (FieldsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - SingleOrManySerializationHelper.Serialize(FieldsValue, writer, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (KeepAliveValue is not null) - { - writer.WritePropertyName("keep_alive"); - JsonSerializer.Serialize(writer, KeepAliveValue, options); - } - - if (KeepOnCompletionValue.HasValue) - { - writer.WritePropertyName("keep_on_completion"); - writer.WriteBooleanValue(KeepOnCompletionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (ResultPositionValue is not null) - { - writer.WritePropertyName("result_position"); - JsonSerializer.Serialize(writer, ResultPositionValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (TiebreakerFieldValue is not null) - { - writer.WritePropertyName("tiebreaker_field"); - JsonSerializer.Serialize(writer, TiebreakerFieldValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TimestampFieldValue is not null) - { - writer.WritePropertyName("timestamp_field"); - JsonSerializer.Serialize(writer, TimestampFieldValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WaitForCompletionTimeoutValue is not null) - { - writer.WritePropertyName("wait_for_completion_timeout"); - JsonSerializer.Serialize(writer, WaitForCompletionTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -604,68 +850,103 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// EQL assumes each document in a data stream or index corresponds to an event. /// /// -public sealed partial class EqlSearchRequestDescriptor : RequestDescriptor +public readonly partial struct EqlSearchRequestDescriptor { - internal EqlSearchRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest Instance { get; init; } - public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlSearch; + public EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(indices); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public EqlSearchRequestDescriptor() + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(typeof(TDocument)); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest instance) => new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "eql.search"; + /// + /// + /// The name of the index to scope the operation + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public EqlSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public EqlSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public EqlSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public EqlSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - RouteValues.Required("index", indices); - return Self; + Instance.ExpandWildcards = value; + return this; } - private bool? CaseSensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? EventCategoryFieldValue { get; set; } - private int? FetchSizeValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Duration? KeepAliveValue { get; set; } - private bool? KeepOnCompletionValue { get; set; } - private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Eql.ResultPosition? ResultPositionValue { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TiebreakerFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TimestampFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeoutValue { get; set; } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public EqlSearchRequestDescriptor CaseSensitive(bool? caseSensitive = true) + /// + /// + /// Allow query execution also in case of shard failures. + /// If true, the query will keep running and will return results based on the available shards. + /// For sequences, the behavior can be further refined using allow_partial_sequence_results + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowPartialSearchResults(bool? value = true) { - CaseSensitiveValue = caseSensitive; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } /// /// - /// Field containing the event classification, such as process, file, or network. + /// This flag applies only to sequences and has effect only if allow_partial_search_results=true. + /// If true, the sequence query will return results based on the available shards, ignoring the others. + /// If false, the sequence query will return successfully, but will always have empty results. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients.Elasticsearch.Field? eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AllowPartialSequenceResults(bool? value = true) + { + Instance.AllowPartialSequenceResults = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor CaseSensitive(bool? value = true) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.CaseSensitive = value; + return this; } /// @@ -673,10 +954,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients.Elasticsear /// Field containing the event classification, such as process, file, or network. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Expression> eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor EventCategoryField(Elastic.Clients.Elasticsearch.Field? value) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.EventCategoryField = value; + return this; } /// @@ -684,10 +965,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Expressi /// Field containing the event classification, such as process, file, or network. /// /// - public EqlSearchRequestDescriptor EventCategoryField(Expression> eventCategoryField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor EventCategoryField(System.Linq.Expressions.Expression> value) { - EventCategoryFieldValue = eventCategoryField; - return Self; + Instance.EventCategoryField = value; + return this; } /// @@ -695,10 +976,10 @@ public EqlSearchRequestDescriptor EventCategoryField(Expression /// - public EqlSearchRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -706,40 +987,38 @@ public EqlSearchRequestDescriptor FetchSize(int? fetchSize) /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. /// /// - public EqlSearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public EqlSearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public EqlSearchRequestDescriptor Fields(Action configure) + /// + /// + /// Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public EqlSearchRequestDescriptor Fields(params Action[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// @@ -747,52 +1026,63 @@ public EqlSearchRequestDescriptor Fields(params Action /// - public EqlSearchRequestDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public EqlSearchRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public EqlSearchRequestDescriptor Filter(Action configure) + /// + /// + /// Query, written in Query DSL, used to filter the events on which the EQL query runs. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public EqlSearchRequestDescriptor Filter(params Action[] configure) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.KeepAlive = value; + return this; } - public EqlSearchRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor KeepOnCompletion(bool? value = true) { - KeepAliveValue = keepAlive; - return Self; + Instance.KeepOnCompletion = value; + return this; } - public EqlSearchRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) + /// + /// + /// By default, the response of a sample query contains up to 10 samples, with one sample per unique set of join keys. Use the size + /// parameter to get a smaller or larger set of samples. To retrieve more than one sample per set of join keys, use the + /// max_samples_per_key parameter. Pipes are not supported for sample queries. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor MaxSamplesPerKey(int? value) { - KeepOnCompletionValue = keepOnCompletion; - return Self; + Instance.MaxSamplesPerKey = value; + return this; } /// @@ -800,55 +1090,73 @@ public EqlSearchRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true /// EQL query you wish to run. /// /// - public EqlSearchRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public EqlSearchRequestDescriptor ResultPosition(Elastic.Clients.Elasticsearch.Eql.ResultPosition? resultPosition) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ResultPosition(Elastic.Clients.Elasticsearch.Eql.ResultPosition? value) { - ResultPositionValue = resultPosition; - return Self; + Instance.ResultPosition = value; + return this; } - public EqlSearchRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } - /// - /// - /// For basic queries, the maximum number of matching events to return. Defaults to 10 - /// - /// - public EqlSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings() { - SizeValue = size; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } - /// - /// - /// Field used to sort hits with the same timestamp in ascending order - /// - /// - public EqlSearchRequestDescriptor TiebreakerField(Elastic.Clients.Elasticsearch.Field? tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// /// - /// Field used to sort hits with the same timestamp in ascending order + /// For basic queries, the maximum number of matching events to return. Defaults to 10 /// /// - public EqlSearchRequestDescriptor TiebreakerField(Expression> tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Size(int? value) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.Size = value; + return this; } /// @@ -856,21 +1164,21 @@ public EqlSearchRequestDescriptor TiebreakerField(Expression< /// Field used to sort hits with the same timestamp in ascending order /// /// - public EqlSearchRequestDescriptor TiebreakerField(Expression> tiebreakerField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TiebreakerField(Elastic.Clients.Elasticsearch.Field? value) { - TiebreakerFieldValue = tiebreakerField; - return Self; + Instance.TiebreakerField = value; + return this; } /// /// - /// Field containing event timestamp. Default "@timestamp" + /// Field used to sort hits with the same timestamp in ascending order /// /// - public EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TiebreakerField(System.Linq.Expressions.Expression> value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TiebreakerField = value; + return this; } /// @@ -878,10 +1186,10 @@ public EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.F /// Field containing event timestamp. Default "@timestamp" /// /// - public EqlSearchRequestDescriptor TimestampField(Expression> timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TimestampField = value; + return this; } /// @@ -889,147 +1197,65 @@ public EqlSearchRequestDescriptor TimestampField(Expression /// - public EqlSearchRequestDescriptor TimestampField(Expression> timestampField) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) { - TimestampFieldValue = timestampField; - return Self; + Instance.TimestampField = value; + return this; } - public EqlSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - WaitForCompletionTimeoutValue = waitForCompletionTimeout; - return Self; + Instance.WaitForCompletionTimeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (CaseSensitiveValue.HasValue) - { - writer.WritePropertyName("case_sensitive"); - writer.WriteBooleanValue(CaseSensitiveValue.Value); - } - - if (EventCategoryFieldValue is not null) - { - writer.WritePropertyName("event_category_field"); - JsonSerializer.Serialize(writer, EventCategoryFieldValue, options); - } - - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - if (FieldsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - if (FieldsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - SingleOrManySerializationHelper.Serialize(FieldsValue, writer, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (KeepAliveValue is not null) - { - writer.WritePropertyName("keep_alive"); - JsonSerializer.Serialize(writer, KeepAliveValue, options); - } - - if (KeepOnCompletionValue.HasValue) - { - writer.WritePropertyName("keep_on_completion"); - writer.WriteBooleanValue(KeepOnCompletionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (ResultPositionValue is not null) - { - writer.WritePropertyName("result_position"); - JsonSerializer.Serialize(writer, ResultPositionValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (TiebreakerFieldValue is not null) - { - writer.WritePropertyName("tiebreaker_field"); - JsonSerializer.Serialize(writer, TiebreakerFieldValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TimestampFieldValue is not null) - { - writer.WritePropertyName("timestamp_field"); - JsonSerializer.Serialize(writer, TimestampFieldValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WaitForCompletionTimeoutValue is not null) - { - writer.WritePropertyName("wait_for_completion_timeout"); - JsonSerializer.Serialize(writer, WaitForCompletionTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchResponse.g.cs index 1f4602dc9b6..a4add7b80ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/EqlSearchResponse.g.cs @@ -17,62 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class EqlSearchResponse : ElasticsearchResponse +internal sealed partial class EqlSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropShardFailures = System.Text.Json.JsonEncodedText.Encode("shard_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHits = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue?> propShardFailures = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propShardFailures.TryReadProperty(ref reader, options, PropShardFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + ShardFailures = propShardFailures.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropShardFailures, value.ShardFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class EqlSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(EqlSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(EqlSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlSearchResponseConverterFactory))] +public sealed partial class EqlSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains matching events and sequences. Also contains related metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Eql.EqlHits Hits { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Eql.EqlHits Hits { get; set; } /// /// /// Identifier for the search. /// /// - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public string? Id { get; set; } /// /// /// If true, the response does not contain complete search results. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool? IsPartial { get; init; } + public bool? IsPartial { get; set; } /// /// /// If true, the search request is still executing. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool? IsRunning { get; init; } + public bool? IsRunning { get; set; } + + /// + /// + /// Contains information about shard failures (if any), in case allow_partial_search_results=true + /// + /// + public System.Collections.Generic.IReadOnlyCollection? ShardFailures { get; set; } /// /// /// If true, the request timed out before completion. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool? TimedOut { get; init; } + public bool? TimedOut { get; set; } /// /// /// Milliseconds it took Elasticsearch to execute the request. /// /// - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + public System.TimeSpan? Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusRequest.g.cs index faba4187dbb..3ee7aa8f79f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusRequest.g.cs @@ -17,42 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class GetEqlStatusRequestParameters : RequestParameters +public sealed partial class GetEqlStatusRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetEqlStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the async EQL status. /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. /// /// -public sealed partial class GetEqlStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestConverter))] +public sealed partial class GetEqlStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetEqlStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGetStatus; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EqlGetStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "eql.get_status"; + + /// + /// + /// Identifier for the search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -61,62 +106,88 @@ public GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. /// /// -public sealed partial class GetEqlStatusRequestDescriptor : RequestDescriptor, GetEqlStatusRequestParameters> +public readonly partial struct GetEqlStatusRequestDescriptor { - internal GetEqlStatusRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest Instance { get; init; } - public GetEqlStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetEqlStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGetStatus; + public GetEqlStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest(id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetEqlStatusRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest instance) => new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "eql.get_status"; - - public GetEqlStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Get the async EQL status. -/// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. -/// -/// -public sealed partial class GetEqlStatusRequestDescriptor : RequestDescriptor -{ - internal GetEqlStatusRequestDescriptor(Action configure) => configure.Invoke(this); - public GetEqlStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EqlGetStatus; + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "eql.get_status"; + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetEqlStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusResponse.g.cs index a087b94c3a8..b0d6fb139fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Eql/GetEqlStatusResponse.g.cs @@ -17,62 +17,161 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public sealed partial class GetEqlStatusResponse : ElasticsearchResponse +internal sealed partial class GetEqlStatusResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompletionStatus = System.Text.Json.JsonEncodedText.Encode("completion_status"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTimeInMillis = System.Text.Json.JsonEncodedText.Encode("expiration_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompletionStatus = default; + LocalJsonValue propExpirationTimeInMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue propStartTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompletionStatus.TryReadProperty(ref reader, options, PropCompletionStatus, null)) + { + continue; + } + + if (propExpirationTimeInMillis.TryReadProperty(ref reader, options, PropExpirationTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompletionStatus = propCompletionStatus.Value, + ExpirationTimeInMillis = propExpirationTimeInMillis.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + StartTimeInMillis = propStartTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompletionStatus, value.CompletionStatus, null, null); + writer.WriteProperty(options, PropExpirationTimeInMillis, value.ExpirationTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponseConverter))] +public sealed partial class GetEqlStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetEqlStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetEqlStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a completed search shows the http status code of the completed search. /// /// - [JsonInclude, JsonPropertyName("completion_status")] - public int? CompletionStatus { get; init; } + public int? CompletionStatus { get; set; } /// /// /// Shows a timestamp when the eql search will be expired, in milliseconds since the Unix epoch. When this time is reached, the search and its results are deleted, even if the search is still ongoing. /// /// - [JsonInclude, JsonPropertyName("expiration_time_in_millis")] - public long? ExpirationTimeInMillis { get; init; } + public System.DateTimeOffset? ExpirationTimeInMillis { get; set; } /// /// /// Identifier for the search. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// If true, the search request is still executing. If false, the search is completed. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// /// If true, the response does not contain complete search results. This could be because either the search is still running (is_running status is false), or because it is already completed (is_running status is true) and results are partial due to failures or timeouts. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } /// /// /// For a running search shows a timestamp when the eql search started, in milliseconds since the Unix epoch. /// /// - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long? StartTimeInMillis { get; init; } + public System.DateTimeOffset? StartTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteRequest.g.cs index 5d663bd9589..ddbb0be8c24 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryDeleteRequestParameters : RequestParameters +public sealed partial class AsyncQueryDeleteRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class AsyncQueryDeleteRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an async ES|QL query. @@ -56,19 +78,44 @@ public sealed partial class AsyncQueryDeleteRequestParameters : RequestParameter /// /// /// -public sealed partial class AsyncQueryDeleteRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestConverter))] +public sealed partial class AsyncQueryDeleteRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public AsyncQueryDeleteRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EsqlAsyncQueryDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "esql.async_query_delete"; + + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -93,78 +140,90 @@ public AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// /// /// -public sealed partial class AsyncQueryDeleteRequestDescriptor : RequestDescriptor, AsyncQueryDeleteRequestParameters> +public readonly partial struct AsyncQueryDeleteRequestDescriptor { - internal AsyncQueryDeleteRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest Instance { get; init; } - public AsyncQueryDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryDelete; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; - - internal override string OperationName => "esql.async_query_delete"; + public AsyncQueryDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest(id); + } - public AsyncQueryDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public AsyncQueryDeleteRequestDescriptor() { - RouteValues.Required("id", id); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public static explicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest instance) => new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } -} -/// -/// -/// Delete an async ES|QL query. -/// If the query is still running, it is cancelled. -/// Otherwise, the stored results are deleted. -/// -/// -/// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: -/// -/// -/// -/// -/// The authenticated user that submitted the original query request -/// -/// -/// -/// -/// Users with the cancel_task cluster privilege -/// -/// -/// -/// -public sealed partial class AsyncQueryDeleteRequestDescriptor : RequestDescriptor -{ - internal AsyncQueryDeleteRequestDescriptor(Action configure) => configure.Invoke(this); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public AsyncQueryDeleteRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryDelete; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "esql.async_query_delete"; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public AsyncQueryDeleteRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteResponse.g.cs index 4cc0e709c48..50d11077ee2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryDeleteResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryDeleteResponse : ElasticsearchResponse +internal sealed partial class AsyncQueryDeleteResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponseConverter))] +public sealed partial class AsyncQueryDeleteResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryDeleteResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryDeleteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetRequest.g.cs index 0f8f1900b21..7a7588a3119 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryGetRequestParameters : RequestParameters +public sealed partial class AsyncQueryGetRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -59,6 +52,35 @@ public sealed partial class AsyncQueryGetRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } +internal sealed partial class AsyncQueryGetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get async ES|QL query results. @@ -66,27 +88,51 @@ public sealed partial class AsyncQueryGetRequestParameters : RequestParameters /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. /// /// -public sealed partial class AsyncQueryGetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestConverter))] +public sealed partial class AsyncQueryGetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public AsyncQueryGetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EsqlAsyncQueryGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "esql.async_query_get"; + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. /// /// - [JsonIgnore] public bool? DropNullColumns { get => Q("drop_null_columns"); set => Q("drop_null_columns", value); } /// @@ -95,7 +141,6 @@ public AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.R /// When this period expires, the query and its results are deleted, even if the query is still ongoing. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -106,7 +151,6 @@ public AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.R /// Otherwise, the response returns an is_running value of true and no results. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } @@ -117,71 +161,128 @@ public AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.R /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. /// /// -public sealed partial class AsyncQueryGetRequestDescriptor : RequestDescriptor, AsyncQueryGetRequestParameters> +public readonly partial struct AsyncQueryGetRequestDescriptor { - internal AsyncQueryGetRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest Instance { get; init; } - public AsyncQueryGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryGetRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryGet; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public AsyncQueryGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public AsyncQueryGetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "esql.async_query_get"; + public static explicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest instance) => new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor descriptor) => descriptor.Instance; - public AsyncQueryGetRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public AsyncQueryGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public AsyncQueryGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public AsyncQueryGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor DropNullColumns(bool? value = true) { - RouteValues.Required("id", id); - return Self; + Instance.DropNullColumns = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period for which the query and its results are stored in the cluster. + /// When this period expires, the query and its results are deleted, even if the query is still ongoing. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.KeepAlive = value; + return this; } -} -/// -/// -/// Get async ES|QL query results. -/// Get the current status and available results or stored results for an ES|QL asynchronous query. -/// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. -/// -/// -public sealed partial class AsyncQueryGetRequestDescriptor : RequestDescriptor -{ - internal AsyncQueryGetRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The period to wait for the request to finish. + /// By default, the request waits for complete query results. + /// If the request completes during the period specified in this parameter, complete query results are returned. + /// Otherwise, the response returns an is_running value of true and no results. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } - public AsyncQueryGetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQueryGet; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "esql.async_query_get"; + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public AsyncQueryGetRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public AsyncQueryGetRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public AsyncQueryGetRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public AsyncQueryGetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetResponse.g.cs index 7e4c3c74151..1aba03b5bca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryGetResponse.g.cs @@ -17,15 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryGetResponse : ElasticsearchResponse +public sealed partial class AsyncQueryGetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryGetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryGetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryRequest.g.cs index ee4cbf7d5be..d3b14129965 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryRequestParameters : RequestParameters +public sealed partial class AsyncQueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -72,16 +65,108 @@ public sealed partial class AsyncQueryRequestParameters : RequestParameters /// /// public bool? KeepOnCompletion { get => Q("keep_on_completion"); set => Q("keep_on_completion", value); } +} - /// - /// - /// The period to wait for the request to finish. - /// By default, the request waits for 1 second for the query results. - /// If the query completes during this period, results are returned - /// Otherwise, a query ID is returned that can later be used to retrieve the results. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } +internal sealed partial class AsyncQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropColumnar = System.Text.Json.JsonEncodedText.Encode("columnar"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeCcsMetadata = System.Text.Json.JsonEncodedText.Encode("include_ccs_metadata"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropWaitForCompletionTimeout = System.Text.Json.JsonEncodedText.Encode("wait_for_completion_timeout"); + + public override Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propColumnar = default; + LocalJsonValue propFilter = default; + LocalJsonValue propIncludeCcsMetadata = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propProfile = default; + LocalJsonValue propQuery = default; + LocalJsonValue propWaitForCompletionTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propColumnar.TryReadProperty(ref reader, options, PropColumnar, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIncludeCcsMetadata.TryReadProperty(ref reader, options, PropIncludeCcsMetadata, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propWaitForCompletionTimeout.TryReadProperty(ref reader, options, PropWaitForCompletionTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Columnar = propColumnar.Value, + Filter = propFilter.Value, + IncludeCcsMetadata = propIncludeCcsMetadata.Value, + Locale = propLocale.Value, + Params = propParams.Value, + Profile = propProfile.Value, + Query = propQuery.Value, + WaitForCompletionTimeout = propWaitForCompletionTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropColumnar, value.Columnar, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIncludeCcsMetadata, value.IncludeCcsMetadata, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropWaitForCompletionTimeout, value.WaitForCompletionTimeout, null, null); + writer.WriteEndObject(); + } } /// @@ -93,11 +178,34 @@ public sealed partial class AsyncQueryRequestParameters : RequestParameters /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. /// /// -public sealed partial class AsyncQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestConverter))] +public sealed partial class AsyncQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQuery; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryRequest(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public AsyncQueryRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AsyncQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EsqlAsyncQuery; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -109,7 +217,6 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonIgnore] public string? Delimiter { get => Q("delimiter"); set => Q("delimiter", value); } /// @@ -118,7 +225,6 @@ public sealed partial class AsyncQueryRequest : PlainRequesttrue, the response will include an extra section under the name all_columns which has the name of all the columns. /// /// - [JsonIgnore] public bool? DropNullColumns { get => Q("drop_null_columns"); set => Q("drop_null_columns", value); } /// @@ -126,7 +232,6 @@ public sealed partial class AsyncQueryRequest : PlainRequestjson or yaml. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Esql.EsqlFormat? Format { get => Q("format"); set => Q("format", value); } /// @@ -137,7 +242,6 @@ public sealed partial class AsyncQueryRequest : PlainRequestkeep_on_completion parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the wait_for_completion_timeout parameter, regardless of this value. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -146,26 +250,13 @@ public sealed partial class AsyncQueryRequest : PlainRequestwait_for_completion_timeout parameter. /// /// - [JsonIgnore] public bool? KeepOnCompletion { get => Q("keep_on_completion"); set => Q("keep_on_completion", value); } - /// - /// - /// The period to wait for the request to finish. - /// By default, the request waits for 1 second for the query results. - /// If the query completes during this period, results are returned - /// Otherwise, a query ID is returned that can later be used to retrieve the results. - /// - /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } - /// /// /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. /// /// - [JsonInclude, JsonPropertyName("columnar")] public bool? Columnar { get; set; } /// @@ -173,7 +264,6 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -183,9 +273,7 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("include_ccs_metadata")] public bool? IncludeCcsMetadata { get; set; } - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -193,8 +281,7 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("params")] - public ICollection? Params { get; set; } + public System.Collections.Generic.ICollection? Params { get; set; } /// /// @@ -204,7 +291,6 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("profile")] public bool? Profile { get; set; } /// @@ -212,8 +298,21 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } + + /// + /// + /// The period to wait for the request to finish. + /// By default, the request waits for 1 second for the query results. + /// If the query completes during this period, results are returned + /// Otherwise, a query ID is returned that can later be used to retrieve the results. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get; set; } } /// @@ -225,48 +324,94 @@ public sealed partial class AsyncQueryRequest : PlainRequest /// -public sealed partial class AsyncQueryRequestDescriptor : RequestDescriptor, AsyncQueryRequestParameters> +public readonly partial struct AsyncQueryRequestDescriptor { - internal AsyncQueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest instance) + { + Instance = instance; + } public AsyncQueryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQuery; + public static explicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest instance) => new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The character to use between values within a CSV row. + /// It is valid only for the CSV format. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor DropNullColumns(bool? value = true) + { + Instance.DropNullColumns = value; + return this; + } - internal override string OperationName => "esql.async_query"; + /// + /// + /// A short version of the Accept header, for example json or yaml. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? value) + { + Instance.Format = value; + return this; + } - public AsyncQueryRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public AsyncQueryRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public AsyncQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? format) => Qs("format", format); - public AsyncQueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public AsyncQueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) => Qs("keep_on_completion", keepOnCompletion); - public AsyncQueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + /// + /// + /// The period for which the query and its results are stored in the cluster. + /// The default period is five days. + /// When this period expires, the query and its results are deleted, even if the query is still ongoing. + /// If the keep_on_completion parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the wait_for_completion_timeout parameter, regardless of this value. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.KeepAlive = value; + return this; + } - private bool? ColumnarValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private bool? IncludeCcsMetadataValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string QueryValue { get; set; } + /// + /// + /// Indicates whether the query and its results are stored in the cluster. + /// If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the wait_for_completion_timeout parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor KeepOnCompletion(bool? value = true) + { + Instance.KeepOnCompletion = value; + return this; + } /// /// /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. /// /// - public AsyncQueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Columnar(bool? value = true) { - ColumnarValue = columnar; - return Self; + Instance.Columnar = value; + return this; } /// @@ -274,28 +419,32 @@ public AsyncQueryRequestDescriptor Columnar(bool? columnar = true) /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. /// /// - public AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public AsyncQueryRequestDescriptor Filter(Action> configure) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -305,16 +454,16 @@ public AsyncQueryRequestDescriptor Filter(Action /// - public AsyncQueryRequestDescriptor IncludeCcsMetadata(bool? includeCcsMetadata = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor IncludeCcsMetadata(bool? value = true) { - IncludeCcsMetadataValue = includeCcsMetadata; - return Self; + Instance.IncludeCcsMetadata = value; + return this; } - public AsyncQueryRequestDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -322,10 +471,21 @@ public AsyncQueryRequestDescriptor Locale(string? locale) /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. /// /// - public AsyncQueryRequestDescriptor Params(ICollection? value) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Params(System.Collections.Generic.ICollection? value) { - ParamsValue = value; - return Self; + Instance.Params = value; + return this; + } + + /// + /// + /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Params(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Params = [.. values]; + return this; } /// @@ -336,10 +496,10 @@ public AsyncQueryRequestDescriptor Params(ICollection /// - public AsyncQueryRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -347,64 +507,74 @@ public AsyncQueryRequestDescriptor Profile(bool? profile = true) /// The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. /// /// - public AsyncQueryRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for the request to finish. + /// By default, the request waits for 1 second for the query results. + /// If the query completes during this period, results are returned + /// Otherwise, a query ID is returned that can later be used to retrieve the results. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } + Instance.WaitForCompletionTimeout = value; + return this; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IncludeCcsMetadataValue.HasValue) - { - writer.WritePropertyName("include_ccs_metadata"); - writer.WriteBooleanValue(IncludeCcsMetadataValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -417,77 +587,116 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. /// /// -public sealed partial class AsyncQueryRequestDescriptor : RequestDescriptor +public readonly partial struct AsyncQueryRequestDescriptor { - internal AsyncQueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest Instance { get; init; } - public AsyncQueryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlAsyncQuery; + public AsyncQueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest instance) => new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The character to use between values within a CSV row. + /// It is valid only for the CSV format. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - internal override string OperationName => "esql.async_query"; + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor DropNullColumns(bool? value = true) + { + Instance.DropNullColumns = value; + return this; + } - public AsyncQueryRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public AsyncQueryRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public AsyncQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? format) => Qs("format", format); - public AsyncQueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public AsyncQueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) => Qs("keep_on_completion", keepOnCompletion); - public AsyncQueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + /// + /// + /// A short version of the Accept header, for example json or yaml. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? value) + { + Instance.Format = value; + return this; + } - private bool? ColumnarValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private bool? IncludeCcsMetadataValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string QueryValue { get; set; } + /// + /// + /// The period for which the query and its results are stored in the cluster. + /// The default period is five days. + /// When this period expires, the query and its results are deleted, even if the query is still ongoing. + /// If the keep_on_completion parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the wait_for_completion_timeout parameter, regardless of this value. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.KeepAlive = value; + return this; + } /// /// - /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. + /// Indicates whether the query and its results are stored in the cluster. + /// If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the wait_for_completion_timeout parameter. /// /// - public AsyncQueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor KeepOnCompletion(bool? value = true) { - ColumnarValue = columnar; - return Self; + Instance.KeepOnCompletion = value; + return this; } /// /// - /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. /// /// - public AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Columnar(bool? value = true) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Columnar = value; + return this; } - public AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public AsyncQueryRequestDescriptor Filter(Action configure) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -497,16 +706,16 @@ public AsyncQueryRequestDescriptor Filter(Action /// - public AsyncQueryRequestDescriptor IncludeCcsMetadata(bool? includeCcsMetadata = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor IncludeCcsMetadata(bool? value = true) { - IncludeCcsMetadataValue = includeCcsMetadata; - return Self; + Instance.IncludeCcsMetadata = value; + return this; } - public AsyncQueryRequestDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -514,10 +723,21 @@ public AsyncQueryRequestDescriptor Locale(string? locale) /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. /// /// - public AsyncQueryRequestDescriptor Params(ICollection? value) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Params(System.Collections.Generic.ICollection? value) { - ParamsValue = value; - return Self; + Instance.Params = value; + return this; + } + + /// + /// + /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Params(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Params = [.. values]; + return this; } /// @@ -528,10 +748,10 @@ public AsyncQueryRequestDescriptor Params(ICollection /// - public AsyncQueryRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -539,63 +759,73 @@ public AsyncQueryRequestDescriptor Profile(bool? profile = true) /// The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. /// /// - public AsyncQueryRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for the request to finish. + /// By default, the request waits for 1 second for the query results. + /// If the query completes during this period, results are returned + /// Otherwise, a query ID is returned that can later be used to retrieve the results. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } + Instance.WaitForCompletionTimeout = value; + return this; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IncludeCcsMetadataValue.HasValue) - { - writer.WritePropertyName("include_ccs_metadata"); - writer.WriteBooleanValue(IncludeCcsMetadataValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryResponse.g.cs index b1f6ebd37a4..b94b8cdad48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryResponse.g.cs @@ -17,15 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class AsyncQueryResponse : ElasticsearchResponse +public sealed partial class AsyncQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopRequest.g.cs new file mode 100644 index 00000000000..2c416395633 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopRequest.g.cs @@ -0,0 +1,230 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Esql; + +public sealed partial class AsyncQueryStopRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public bool? DropNullColumns { get => Q("drop_null_columns"); set => Q("drop_null_columns", value); } +} + +internal sealed partial class AsyncQueryStopRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +/// +/// +/// Stop async ES|QL query. +/// +/// +/// This API interrupts the query execution and returns the results so far. +/// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestConverter))] +public sealed partial class AsyncQueryStopRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryStopRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } +#if NET7_0_OR_GREATER + public AsyncQueryStopRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryStopRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EsqlAsyncQueryStop; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "esql.async_query_stop"; + + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public bool? DropNullColumns { get => Q("drop_null_columns"); set => Q("drop_null_columns", value); } +} + +/// +/// +/// Stop async ES|QL query. +/// +/// +/// This API interrupts the query execution and returns the results so far. +/// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it. +/// +/// +public readonly partial struct AsyncQueryStopRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryStopRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest instance) + { + Instance = instance; + } + + public AsyncQueryStopRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest(id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public AsyncQueryStopRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest instance) => new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the query. + /// A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time. + /// A query ID is also provided when the request was submitted with the keep_on_completion parameter set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// Indicates whether columns that are entirely null will be removed from the columns and values portion of the results. + /// If true, the response will include an extra section under the name all_columns which has the name of all the columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor DropNullColumns(bool? value = true) + { + Instance.DropNullColumns = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FrozenIndices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopResponse.g.cs similarity index 70% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FrozenIndices.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopResponse.g.cs index ae0d4ec9870..81d8535b8e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FrozenIndices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/AsyncQueryStopResponse.g.cs @@ -17,22 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; -namespace Elastic.Clients.Elasticsearch.Xpack; +namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class FrozenIndices +public sealed partial class AsyncQueryStopResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("indices_count")] - public long IndicesCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncQueryStopResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncQueryStopResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs index 98f4d4fbde4..68a186e87bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class EsqlQueryRequestParameters : RequestParameters +public sealed partial class EsqlQueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -55,17 +48,133 @@ public sealed partial class EsqlQueryRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Esql.EsqlFormat? Format { get => Q("format"); set => Q("format", value); } } +internal sealed partial class EsqlQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropColumnar = System.Text.Json.JsonEncodedText.Encode("columnar"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeCcsMetadata = System.Text.Json.JsonEncodedText.Encode("include_ccs_metadata"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propColumnar = default; + LocalJsonValue propFilter = default; + LocalJsonValue propIncludeCcsMetadata = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propProfile = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propColumnar.TryReadProperty(ref reader, options, PropColumnar, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIncludeCcsMetadata.TryReadProperty(ref reader, options, PropIncludeCcsMetadata, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Columnar = propColumnar.Value, + Filter = propFilter.Value, + IncludeCcsMetadata = propIncludeCcsMetadata.Value, + Locale = propLocale.Value, + Params = propParams.Value, + Profile = propProfile.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropColumnar, value.Columnar, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIncludeCcsMetadata, value.IncludeCcsMetadata, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Run an ES|QL query. /// Get search results for an ES|QL (Elasticsearch query language) query. /// /// -public sealed partial class EsqlQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestConverter))] +public sealed partial class EsqlQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlQuery; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EsqlQueryRequest(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public EsqlQueryRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EsqlQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.EsqlQuery; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -76,7 +185,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonIgnore] public string? Delimiter { get => Q("delimiter"); set => Q("delimiter", value); } /// @@ -85,7 +193,6 @@ public sealed partial class EsqlQueryRequest : PlainRequestfalse. If true then the response will include an extra section under the name all_columns which has the name of all columns. /// /// - [JsonIgnore] public bool? DropNullColumns { get => Q("drop_null_columns"); set => Q("drop_null_columns", value); } /// @@ -93,7 +200,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Esql.EsqlFormat? Format { get => Q("format"); set => Q("format", value); } /// @@ -101,7 +207,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("columnar")] public bool? Columnar { get; set; } /// @@ -109,7 +214,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -119,9 +223,7 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("include_ccs_metadata")] public bool? IncludeCcsMetadata { get; set; } - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -129,8 +231,7 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("params")] - public ICollection? Params { get; set; } + public System.Collections.Generic.ICollection? Params { get; set; } /// /// @@ -140,7 +241,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("profile")] public bool? Profile { get; set; } /// @@ -148,8 +248,11 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } } /// @@ -158,45 +261,67 @@ public sealed partial class EsqlQueryRequest : PlainRequest /// -public sealed partial class EsqlQueryRequestDescriptor : RequestDescriptor, EsqlQueryRequestParameters> +public readonly partial struct EsqlQueryRequestDescriptor { - internal EsqlQueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest Instance { get; init; } - public EsqlQueryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EsqlQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public EsqlQueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest instance) => new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "esql.query"; + /// + /// + /// The character to use between values within a CSV row. Only valid for the CSV format. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - public EsqlQueryRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public EsqlQueryRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public EsqlQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? format) => Qs("format", format); + /// + /// + /// Should columns that are entirely null be removed from the columns and values portion of the results? + /// Defaults to false. If true then the response will include an extra section under the name all_columns which has the name of all columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor DropNullColumns(bool? value = true) + { + Instance.DropNullColumns = value; + return this; + } - private bool? ColumnarValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private bool? IncludeCcsMetadataValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string QueryValue { get; set; } + /// + /// + /// A short version of the Accept header, e.g. json, yaml. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? value) + { + Instance.Format = value; + return this; + } /// /// /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. /// /// - public EsqlQueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Columnar(bool? value = true) { - ColumnarValue = columnar; - return Self; + Instance.Columnar = value; + return this; } /// @@ -204,28 +329,32 @@ public EsqlQueryRequestDescriptor Columnar(bool? columnar = true) /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. /// /// - public EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public EsqlQueryRequestDescriptor Filter(Action> configure) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -235,16 +364,27 @@ public EsqlQueryRequestDescriptor Filter(Action /// - public EsqlQueryRequestDescriptor IncludeCcsMetadata(bool? includeCcsMetadata = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor IncludeCcsMetadata(bool? value = true) { - IncludeCcsMetadataValue = includeCcsMetadata; - return Self; + Instance.IncludeCcsMetadata = value; + return this; } - public EsqlQueryRequestDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Locale(string? value) + { + Instance.Locale = value; + return this; + } + + /// + /// + /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Params(System.Collections.Generic.ICollection? value) { - LocaleValue = locale; - return Self; + Instance.Params = value; + return this; } /// @@ -252,10 +392,10 @@ public EsqlQueryRequestDescriptor Locale(string? locale) /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. /// /// - public EsqlQueryRequestDescriptor Params(ICollection? value) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Params(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - ParamsValue = value; - return Self; + Instance.Params = [.. values]; + return this; } /// @@ -266,10 +406,10 @@ public EsqlQueryRequestDescriptor Params(ICollection /// - public EsqlQueryRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -277,64 +417,60 @@ public EsqlQueryRequestDescriptor Profile(bool? profile = true) /// The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. /// /// - public EsqlQueryRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest Build(System.Action action) { - writer.WriteStartObject(); - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IncludeCcsMetadataValue.HasValue) - { - writer.WritePropertyName("include_ccs_metadata"); - writer.WriteBooleanValue(IncludeCcsMetadataValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -344,74 +480,89 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Get search results for an ES|QL (Elasticsearch query language) query. /// /// -public sealed partial class EsqlQueryRequestDescriptor : RequestDescriptor +public readonly partial struct EsqlQueryRequestDescriptor { - internal EsqlQueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest Instance { get; init; } - public EsqlQueryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EsqlQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.EsqlQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public EsqlQueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "esql.query"; + public static explicit operator Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest instance) => new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor descriptor) => descriptor.Instance; - public EsqlQueryRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public EsqlQueryRequestDescriptor DropNullColumns(bool? dropNullColumns = true) => Qs("drop_null_columns", dropNullColumns); - public EsqlQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? format) => Qs("format", format); + /// + /// + /// The character to use between values within a CSV row. Only valid for the CSV format. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - private bool? ColumnarValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private bool? IncludeCcsMetadataValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string QueryValue { get; set; } + /// + /// + /// Should columns that are entirely null be removed from the columns and values portion of the results? + /// Defaults to false. If true then the response will include an extra section under the name all_columns which has the name of all columns. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor DropNullColumns(bool? value = true) + { + Instance.DropNullColumns = value; + return this; + } /// /// - /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. + /// A short version of the Accept header, e.g. json, yaml. /// /// - public EsqlQueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Esql.EsqlFormat? value) { - ColumnarValue = columnar; - return Self; + Instance.Format = value; + return this; } /// /// - /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. /// /// - public EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Columnar(bool? value = true) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Columnar = value; + return this; } - public EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public EsqlQueryRequestDescriptor Filter(Action configure) + /// + /// + /// Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -421,16 +572,27 @@ public EsqlQueryRequestDescriptor Filter(Action /// - public EsqlQueryRequestDescriptor IncludeCcsMetadata(bool? includeCcsMetadata = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor IncludeCcsMetadata(bool? value = true) + { + Instance.IncludeCcsMetadata = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Locale(string? value) { - IncludeCcsMetadataValue = includeCcsMetadata; - return Self; + Instance.Locale = value; + return this; } - public EsqlQueryRequestDescriptor Locale(string? locale) + /// + /// + /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Params(System.Collections.Generic.ICollection? value) { - LocaleValue = locale; - return Self; + Instance.Params = value; + return this; } /// @@ -438,10 +600,10 @@ public EsqlQueryRequestDescriptor Locale(string? locale) /// To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. /// /// - public EsqlQueryRequestDescriptor Params(ICollection? value) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Params(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - ParamsValue = value; - return Self; + Instance.Params = [.. values]; + return this; } /// @@ -452,10 +614,10 @@ public EsqlQueryRequestDescriptor Params(ICollection /// - public EsqlQueryRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -463,63 +625,59 @@ public EsqlQueryRequestDescriptor Profile(bool? profile = true) /// The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. /// /// - public EsqlQueryRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IncludeCcsMetadataValue.HasValue) - { - writer.WritePropertyName("include_ccs_metadata"); - writer.WriteBooleanValue(IncludeCcsMetadataValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryResponse.g.cs index 47d6c60463c..e59ae2fc626 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryResponse.g.cs @@ -17,15 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public sealed partial class EsqlQueryResponse : ElasticsearchResponse +public sealed partial class EsqlQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EsqlQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EsqlQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsRequest.g.cs index 332e8c2cc3e..21725210d8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExistsRequestParameters : RequestParameters +public sealed partial class ExistsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -119,6 +112,35 @@ public sealed partial class ExistsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } +internal sealed partial class ExistsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ExistsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExistsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check a document. @@ -146,20 +168,55 @@ public sealed partial class ExistsRequestParameters : RequestParameters /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class ExistsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExistsRequestConverter))] +public sealed partial class ExistsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public ExistsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExists; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceExists; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "exists"; + /// + /// + /// A unique document identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// The node or shard the operation should be performed on. @@ -172,7 +229,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// A sample value can be something like the web session ID or the user name. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -180,7 +236,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -189,7 +244,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -197,7 +251,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -205,7 +258,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// Indicates whether to return the _source field (true or false) or lists the fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -215,7 +267,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -226,7 +277,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -236,7 +286,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If this field is specified, the _source parameter defaults to false. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } /// @@ -245,7 +294,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The specified version must match the current version of the document for the request to succeed. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -253,7 +301,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } @@ -284,63 +331,289 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class ExistsRequestDescriptor : RequestDescriptor, ExistsRequestParameters> +public readonly partial struct ExistsRequestDescriptor { - internal ExistsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExistsRequest Instance { get; init; } - public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsRequest instance) { + Instance = instance; } - public ExistsRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.ExistsRequest(index, id); } - public ExistsRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public ExistsRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsRequest instance) => new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExistsRequest(Elastic.Clients.Elasticsearch.ExistsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExists; + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + /// If it is set to _local, the operation will prefer to be run on a local allocated shard when possible. + /// If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. + /// This can help with "jumping values" when hitting different shards in different refresh states. + /// A sample value can be something like the web session ID or the user name. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override string OperationName => "exists"; + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public ExistsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExistsRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public ExistsRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ExistsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExistsRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExistsRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExistsRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExistsRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public ExistsRequestDescriptor Version(long? version) => Qs("version", version); - public ExistsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } - public ExistsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Source(System.Func action) { - RouteValues.Required("id", id); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - public ExistsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) { - RouteValues.Required("index", index); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// Explicit version number for concurrency control. + /// The specified version must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExistsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(new Elastic.Clients.Elasticsearch.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -371,46 +644,292 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class ExistsRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsRequestDescriptor { - internal ExistsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExistsRequest Instance { get; init; } - public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExists; + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + public ExistsRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => false; + public ExistsRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsRequest(typeof(TDocument), id); + } - internal override string OperationName => "exists"; + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsRequest instance) => new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExistsRequest(Elastic.Clients.Elasticsearch.ExistsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + /// If it is set to _local, the operation will prefer to be run on a local allocated shard when possible. + /// If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. + /// This can help with "jumping values" when hitting different shards in different refresh states. + /// A sample value can be something like the web session ID or the user name. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } + + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } - public ExistsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExistsRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public ExistsRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ExistsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExistsRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExistsRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExistsRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExistsRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public ExistsRequestDescriptor Version(long? version) => Qs("version", version); - public ExistsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// Explicit version number for concurrency control. + /// The specified version must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExistsRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(new Elastic.Clients.Elasticsearch.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ExistsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.SourceQueryString = value; + return this; } - public ExistsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ExistsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsResponse.g.cs index 6d4ccb713e5..3d985a2fa68 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExistsResponse : ElasticsearchResponse +internal sealed partial class ExistsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ExistsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExistsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExistsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExistsResponseConverter))] +public sealed partial class ExistsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceRequest.g.cs index dc07cb2c935..30dee1597ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExistsSourceRequestParameters : RequestParameters +public sealed partial class ExistsSourceRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -99,6 +92,35 @@ public sealed partial class ExistsSourceRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } +internal sealed partial class ExistsSourceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ExistsSourceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExistsSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExistsSourceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check for a document source. @@ -114,27 +136,61 @@ public sealed partial class ExistsSourceRequestParameters : RequestParameters /// A document's source is not available if it is disabled in the mapping. /// /// -public sealed partial class ExistsSourceRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExistsSourceRequestConverter))] +public sealed partial class ExistsSourceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public ExistsSourceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExistsSource; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceExistsSource; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "exists_source"; + /// + /// + /// A unique identifier for the document. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// The node or shard the operation should be performed on. /// By default, the operation is randomized between the shard replicas. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -142,7 +198,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -151,7 +206,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -159,7 +213,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -167,7 +220,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// Indicates whether to return the _source field (true or false) or lists the fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -175,7 +227,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// A comma-separated list of source fields to exclude in the response. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -183,7 +234,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// A comma-separated list of source fields to include in the response. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -192,7 +242,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// It must match the current version of the document for the request to succeed. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -200,7 +249,6 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } @@ -219,62 +267,247 @@ public ExistsSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elasti /// A document's source is not available if it is disabled in the mapping. /// /// -public sealed partial class ExistsSourceRequestDescriptor : RequestDescriptor, ExistsSourceRequestParameters> +public readonly partial struct ExistsSourceRequestDescriptor { - internal ExistsSourceRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExistsSourceRequest Instance { get; init; } - public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsSourceRequest instance) { + Instance = instance; } - public ExistsSourceRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.ExistsSourceRequest(index, id); } - public ExistsSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsSourceRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public ExistsSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsSourceRequest instance) => new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExistsSourceRequest(Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExistsSource; + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override string OperationName => "exists_source"; + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public ExistsSourceRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExistsSourceRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public ExistsSourceRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ExistsSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExistsSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExistsSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExistsSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExistsSourceRequestDescriptor Version(long? version) => Qs("version", version); - public ExistsSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } - public ExistsSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Source(System.Func action) { - RouteValues.Required("id", id); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - public ExistsSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) { - RouteValues.Required("index", index); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExistsSourceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(new Elastic.Clients.Elasticsearch.ExistsSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -293,45 +526,250 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// A document's source is not available if it is disabled in the mapping. /// /// -public sealed partial class ExistsSourceRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsSourceRequestDescriptor { - internal ExistsSourceRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExistsSourceRequest Instance { get; init; } - public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsSourceRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExistsSource; + public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsSourceRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + public ExistsSourceRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsSourceRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => false; + public ExistsSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsSourceRequest(typeof(TDocument), id); + } - internal override string OperationName => "exists_source"; + public ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExistsSourceRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsSourceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(Elastic.Clients.Elasticsearch.ExistsSourceRequest instance) => new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExistsSourceRequest(Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// A comma-separated list of data streams, indices, and aliases. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } + + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } - public ExistsSourceRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExistsSourceRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public ExistsSourceRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ExistsSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExistsSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExistsSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExistsSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExistsSourceRequestDescriptor Version(long? version) => Qs("version", version); - public ExistsSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExistsSourceRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(new Elastic.Clients.Elasticsearch.ExistsSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ExistsSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.SourceQueryString = value; + return this; } - public ExistsSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceResponse.g.cs index eafd8f07e95..73a0da491ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExistsSourceResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExistsSourceResponse : ElasticsearchResponse +internal sealed partial class ExistsSourceResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ExistsSourceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExistsSourceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExistsSourceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExistsSourceResponseConverter))] +public sealed partial class ExistsSourceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsSourceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsSourceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainRequest.g.cs index 6d2e2946136..3d383d1fb8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExplainRequestParameters : RequestParameters +public sealed partial class ExplainRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -128,6 +121,45 @@ public sealed partial class ExplainRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } } +internal sealed partial class ExplainRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.ExplainRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExplainRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Explain a document match result. @@ -135,27 +167,61 @@ public sealed partial class ExplainRequestParameters : RequestParameters /// It computes a score explanation for a query and a specific document. /// /// -public sealed partial class ExplainRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExplainRequestConverter))] +public sealed partial class ExplainRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public ExplainRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExplain; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceExplain; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "explain"; + /// + /// + /// The document identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// Index names that are used to limit the request. + /// Only a single index name can be provided to this parameter. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// The analyzer to use for the query string. /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -164,7 +230,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -173,7 +238,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -182,7 +246,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -191,7 +254,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -200,7 +262,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -208,7 +269,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// The query in the Lucene query string syntax. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -216,7 +276,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -224,7 +283,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// True or false to return the _source field or not or a list of fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -234,7 +292,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -245,7 +302,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -253,7 +309,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// A comma-separated list of stored fields to return in the response. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } /// @@ -261,7 +316,6 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// Defines the search definition using the Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } @@ -272,116 +326,337 @@ public ExplainRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Cli /// It computes a score explanation for a query and a specific document. /// /// -public sealed partial class ExplainRequestDescriptor : RequestDescriptor, ExplainRequestParameters> +public readonly partial struct ExplainRequestDescriptor { - internal ExplainRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExplainRequest Instance { get; init; } - public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.ExplainRequest instance) { + Instance = instance; } - public ExplainRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.ExplainRequest(index, id); } - public ExplainRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExplainRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public ExplainRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.ExplainRequest instance) => new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExplainRequest(Elastic.Clients.Elasticsearch.ExplainRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// Index names that are used to limit the request. + /// Only a single index name can be provided to this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExplain; + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } - internal override string OperationName => "explain"; + /// + /// + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } - public ExplainRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public ExplainRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public ExplainRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public ExplainRequestDescriptor Df(string? df) => Qs("df", df); - public ExplainRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public ExplainRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExplainRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public ExplainRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExplainRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExplainRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExplainRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExplainRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } - public ExplainRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Preference(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.Preference = value; + return this; } - public ExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor QueryLuceneSyntax(string? value) { - RouteValues.Required("index", index); - return Self; + Instance.QueryLuceneSyntax = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// True or false to return the _source field or not or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// True or false to return the _source field or not or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Source(System.Func action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// True or false to return the _source field or not or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } /// /// /// Defines the search definition using the Query DSL. /// /// - public ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ExplainRequestDescriptor Query(Action> configure) + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExplainRequest Build(System.Action action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(new Elastic.Clients.Elasticsearch.ExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -392,99 +667,329 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// It computes a score explanation for a query and a specific document. /// /// -public sealed partial class ExplainRequestDescriptor : RequestDescriptor +public readonly partial struct ExplainRequestDescriptor { - internal ExplainRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ExplainRequest Instance { get; init; } - public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.ExplainRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceExplain; + public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExplainRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ExplainRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.ExplainRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => true; + public ExplainRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExplainRequest(typeof(TDocument), id); + } - internal override string OperationName => "explain"; + public ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.ExplainRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExplainRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(Elastic.Clients.Elasticsearch.ExplainRequest instance) => new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ExplainRequest(Elastic.Clients.Elasticsearch.ExplainRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// Index names that are used to limit the request. + /// Only a single index name can be provided to this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } - public ExplainRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public ExplainRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public ExplainRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public ExplainRequestDescriptor Df(string? df) => Qs("df", df); - public ExplainRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public ExplainRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public ExplainRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public ExplainRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExplainRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public ExplainRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public ExplainRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public ExplainRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); + /// + /// + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } - public ExplainRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Preference(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.Preference = value; + return this; } - public ExplainRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor QueryLuceneSyntax(string? value) { - RouteValues.Required("index", index); - return Self; + Instance.QueryLuceneSyntax = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// True or false to return the _source field or not or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// True or false to return the _source field or not or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return in the response. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } /// /// /// Defines the search definition using the Query DSL. /// /// - public ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public ExplainRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines the search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ExplainRequestDescriptor Query(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ExplainRequest Build(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(new Elastic.Clients.Elasticsearch.ExplainRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ExplainRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainResponse.g.cs index 507b277bdfe..2cf8e867bd0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ExplainResponse.g.cs @@ -17,25 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ExplainResponse : ElasticsearchResponse +internal sealed partial class ExplainResponseConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropExplanation = System.Text.Json.JsonEncodedText.Encode("explanation"); + private static readonly System.Text.Json.JsonEncodedText PropGet = System.Text.Json.JsonEncodedText.Encode("get"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropMatched = System.Text.Json.JsonEncodedText.Encode("matched"); + + public override Elastic.Clients.Elasticsearch.ExplainResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExplanation = default; + LocalJsonValue?> propGet = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propMatched = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExplanation.TryReadProperty(ref reader, options, PropExplanation, null)) + { + continue; + } + + if (propGet.TryReadProperty(ref reader, options, PropGet, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMatched.TryReadProperty(ref reader, options, PropMatched, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ExplainResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Explanation = propExplanation.Value, + Get = propGet.Value, + Id = propId.Value, + Index = propIndex.Value, + Matched = propMatched.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExplainResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExplanation, value.Explanation, null, null); + writer.WriteProperty(options, PropGet, value.Get, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMatched, value.Matched, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class ExplainResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory { - [JsonInclude, JsonPropertyName("explanation")] - public Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetail? Explanation { get; init; } - [JsonInclude, JsonPropertyName("get")] - public Elastic.Clients.Elasticsearch.InlineGet? Get { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("matched")] - public bool Matched { get; init; } + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(ExplainResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(ExplainResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExplainResponseConverterFactory))] +public sealed partial class ExplainResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetail? Explanation { get; set; } + public Elastic.Clients.Elasticsearch.InlineGet? Get { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +string Id { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +string Index { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +bool Matched { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesRequest.g.cs index ec3b39f037f..749b4ed3bd2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesRequest.g.cs @@ -17,21 +17,49 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; -public sealed partial class GetFeaturesRequestParameters : RequestParameters +public sealed partial class GetFeaturesRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class GetFeaturesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -50,15 +78,39 @@ public sealed partial class GetFeaturesRequestParameters : RequestParameters /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. /// /// -public sealed partial class GetFeaturesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestConverter))] +public sealed partial class GetFeaturesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.FeaturesGetFeatures; +#if NET7_0_OR_GREATER + public GetFeaturesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetFeaturesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.FeaturesGetFeatures; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "features.get_features"; + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -77,23 +129,87 @@ public sealed partial class GetFeaturesRequest : PlainRequest /// -public sealed partial class GetFeaturesRequestDescriptor : RequestDescriptor +public readonly partial struct GetFeaturesRequestDescriptor { - internal GetFeaturesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFeaturesRequestDescriptor(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest instance) + { + Instance = instance; + } public GetFeaturesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.FeaturesGetFeatures; + public static explicit operator Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest instance) => new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "features.get_features"; + var builder = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesResponse.g.cs index 330a44bf3e4..e408c4f84ca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/GetFeaturesResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; -public sealed partial class GetFeaturesResponse : ElasticsearchResponse +internal sealed partial class GetFeaturesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("features")] - public IReadOnlyCollection Features { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + + public override Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFeatures = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Features = propFeatures.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatures, value.Features, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Features.GetFeaturesResponseConverter))] +public sealed partial class GetFeaturesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFeaturesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFeaturesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Features { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesRequest.g.cs index 5a4891114bd..d8ccdc19b57 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesRequest.g.cs @@ -17,21 +17,49 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; -public sealed partial class ResetFeaturesRequestParameters : RequestParameters +public sealed partial class ResetFeaturesRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class ResetFeaturesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -61,15 +89,39 @@ public sealed partial class ResetFeaturesRequestParameters : RequestParameters /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. /// /// -public sealed partial class ResetFeaturesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestConverter))] +public sealed partial class ResetFeaturesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.FeaturesResetFeatures; +#if NET7_0_OR_GREATER + public ResetFeaturesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ResetFeaturesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.FeaturesResetFeatures; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "features.reset_features"; + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -99,23 +151,87 @@ public sealed partial class ResetFeaturesRequest : PlainRequest /// -public sealed partial class ResetFeaturesRequestDescriptor : RequestDescriptor +public readonly partial struct ResetFeaturesRequestDescriptor { - internal ResetFeaturesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetFeaturesRequestDescriptor(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest instance) + { + Instance = instance; + } public ResetFeaturesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.FeaturesResetFeatures; + public static explicit operator Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest instance) => new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "features.reset_features"; + var builder = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesResponse.g.cs index d92067d295e..ef610dc435b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Features/ResetFeaturesResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; -public sealed partial class ResetFeaturesResponse : ElasticsearchResponse +internal sealed partial class ResetFeaturesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("features")] - public IReadOnlyCollection Features { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + + public override Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFeatures = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Features = propFeatures.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatures, value.Features, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponseConverter))] +public sealed partial class ResetFeaturesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetFeaturesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetFeaturesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Features { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsRequest.g.cs index 743ac9c88b5..eb86b167775 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class FieldCapsRequestParameters : RequestParameters +public sealed partial class FieldCapsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,7 +39,7 @@ public sealed partial class FieldCapsRequestParameters : RequestParameters /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -83,7 +76,64 @@ public sealed partial class FieldCapsRequestParameters : RequestParameters /// It defaults to empty, meaning that all field types are returned. /// /// - public ICollection? Types { get => Q?>("types"); set => Q("types", value); } + public System.Collections.Generic.ICollection? Types { get => Q?>("types"); set => Q("types", value); } +} + +internal sealed partial class FieldCapsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFilter = System.Text.Json.JsonEncodedText.Encode("index_filter"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + + public override Elastic.Clients.Elasticsearch.FieldCapsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFields = default; + LocalJsonValue propIndexFilter = default; + LocalJsonValue?> propRuntimeMappings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propIndexFilter.TryReadProperty(ref reader, options, PropIndexFilter, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + IndexFilter = propIndexFilter.Value, + RuntimeMappings = propRuntimeMappings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldCapsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropIndexFilter, value.IndexFilter, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } } /// @@ -99,24 +149,43 @@ public sealed partial class FieldCapsRequestParameters : RequestParameters /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. /// /// -public sealed partial class FieldCapsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldCapsRequestConverter))] +public sealed partial class FieldCapsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public FieldCapsRequest() { } - - public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public FieldCapsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceFieldCaps; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceFieldCaps; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "field_caps"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, @@ -124,7 +193,6 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -132,15 +200,13 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// A comma-separated list of filters to apply to the response. /// /// - [JsonIgnore] public string? Filters { get => Q("filters"); set => Q("filters", value); } /// @@ -148,7 +214,6 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -156,7 +221,6 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// If false, empty fields are not included in the response. /// /// - [JsonIgnore] public bool? IncludeEmptyFields { get => Q("include_empty_fields"); set => Q("include_empty_fields", value); } /// @@ -164,7 +228,6 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// If true, unmapped fields are included in the response. /// /// - [JsonIgnore] public bool? IncludeUnmapped { get => Q("include_unmapped"); set => Q("include_unmapped", value); } /// @@ -174,16 +237,13 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// It defaults to empty, meaning that all field types are returned. /// /// - [JsonIgnore] - public ICollection? Types { get => Q?>("types"); set => Q("types", value); } + public System.Collections.Generic.ICollection? Types { get => Q?>("types"); set => Q("types", value); } /// /// /// A list of fields to retrieve capabilities for. Wildcard (*) expressions are supported. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -196,7 +256,6 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. /// /// - [JsonInclude, JsonPropertyName("index_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilter { get; set; } /// @@ -205,8 +264,7 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } } /// @@ -222,55 +280,197 @@ public FieldCapsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. /// /// -public sealed partial class FieldCapsRequestDescriptor : RequestDescriptor, FieldCapsRequestParameters> +public readonly partial struct FieldCapsRequestDescriptor { - internal FieldCapsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.FieldCapsRequest Instance { get; init; } - public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.FieldCapsRequest instance) { + Instance = instance; + } + + public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.FieldCapsRequest(indices); } public FieldCapsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceFieldCaps; + public static explicit operator Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.FieldCapsRequest instance) => new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, + /// or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request + /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "field_caps"; + /// + /// + /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of filters to apply to the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Filters(string? value) + { + Instance.Filters = value; + return this; + } - public FieldCapsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FieldCapsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FieldCapsRequestDescriptor Filters(string? filters) => Qs("filters", filters); - public FieldCapsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FieldCapsRequestDescriptor IncludeEmptyFields(bool? includeEmptyFields = true) => Qs("include_empty_fields", includeEmptyFields); - public FieldCapsRequestDescriptor IncludeUnmapped(bool? includeUnmapped = true) => Qs("include_unmapped", includeUnmapped); - public FieldCapsRequestDescriptor Types(ICollection? types) => Qs("types", types); + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public FieldCapsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If false, empty fields are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IncludeEmptyFields(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IncludeEmptyFields = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action> IndexFilterDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } + /// + /// + /// If true, unmapped fields are included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IncludeUnmapped(bool? value = true) + { + Instance.IncludeUnmapped = value; + return this; + } + + /// + /// + /// A comma-separated list of field types to include. + /// Any fields that do not match one of these types will be excluded from the results. + /// It defaults to empty, meaning that all field types are returned. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Types(System.Collections.Generic.ICollection? value) + { + Instance.Types = value; + return this; + } + + /// + /// + /// A comma-separated list of field types to include. + /// Any fields that do not match one of these types will be excluded from the results. + /// It defaults to empty, meaning that all field types are returned. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Types(params string[] values) + { + Instance.Types = [.. values]; + return this; + } + + /// + /// + /// A list of fields to retrieve capabilities for. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } /// /// /// A list of fields to retrieve capabilities for. Wildcard (*) expressions are supported. /// /// - public FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + /// IMPORTANT: The filtering is done on a best-effort basis, it uses index statistics and mappings to rewrite queries to match_none instead of fully running the request. + /// For instance a range query over a date field can rewrite to match_none if all documents within a shard (including deleted documents) are outside of the provided range. + /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.IndexFilter = value; + return this; + } + + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + /// IMPORTANT: The filtering is done on a best-effort basis, it uses index statistics and mappings to rewrite queries to match_none instead of fully running the request. + /// For instance a range query over a date field can rewrite to match_none if all documents within a shard (including deleted documents) are outside of the provided range. + /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IndexFilter(System.Action action) { - FieldsValue = fields; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -283,28 +483,46 @@ public FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearc /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. /// /// - public FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Define ad-hoc runtime fields in the request similar to the way it is done in search requests. + /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = value; + return this; } - public FieldCapsRequestDescriptor IndexFilter(Action> configure) + /// + /// + /// Define ad-hoc runtime fields in the request similar to the way it is done in search requests. + /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + /// + /// + /// Define ad-hoc runtime fields in the request similar to the way it is done in search requests. + /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings(System.Action? action) { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } /// @@ -313,44 +531,107 @@ public FieldCapsRequestDescriptor IndexFilter(Action /// - public FieldCapsRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings(System.Action>? action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (RuntimeMappingsValue is not null) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.FieldCapsRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); + return new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -367,55 +648,165 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. /// /// -public sealed partial class FieldCapsRequestDescriptor : RequestDescriptor +public readonly partial struct FieldCapsRequestDescriptor { - internal FieldCapsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.FieldCapsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.FieldCapsRequest instance) + { + Instance = instance; + } - public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.FieldCapsRequest(indices); } public FieldCapsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceFieldCaps; + public static explicit operator Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(Elastic.Clients.Elasticsearch.FieldCapsRequest instance) => new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, + /// or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request + /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "field_caps"; + /// + /// + /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of filters to apply to the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Filters(string? value) + { + Instance.Filters = value; + return this; + } - public FieldCapsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FieldCapsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FieldCapsRequestDescriptor Filters(string? filters) => Qs("filters", filters); - public FieldCapsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FieldCapsRequestDescriptor IncludeEmptyFields(bool? includeEmptyFields = true) => Qs("include_empty_fields", includeEmptyFields); - public FieldCapsRequestDescriptor IncludeUnmapped(bool? includeUnmapped = true) => Qs("include_unmapped", includeUnmapped); - public FieldCapsRequestDescriptor Types(ICollection? types) => Qs("types", types); + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public FieldCapsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If false, empty fields are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IncludeEmptyFields(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IncludeEmptyFields = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action IndexFilterDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } + /// + /// + /// If true, unmapped fields are included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IncludeUnmapped(bool? value = true) + { + Instance.IncludeUnmapped = value; + return this; + } + + /// + /// + /// A comma-separated list of field types to include. + /// Any fields that do not match one of these types will be excluded from the results. + /// It defaults to empty, meaning that all field types are returned. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Types(System.Collections.Generic.ICollection? value) + { + Instance.Types = value; + return this; + } + + /// + /// + /// A comma-separated list of field types to include. + /// Any fields that do not match one of these types will be excluded from the results. + /// It defaults to empty, meaning that all field types are returned. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Types(params string[] values) + { + Instance.Types = [.. values]; + return this; + } + + /// + /// + /// A list of fields to retrieve capabilities for. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } /// /// /// A list of fields to retrieve capabilities for. Wildcard (*) expressions are supported. /// /// - public FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -428,28 +819,50 @@ public FieldCapsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? f /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. /// /// - public FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; + Instance.IndexFilter = value; + return this; } - public FieldCapsRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + /// IMPORTANT: The filtering is done on a best-effort basis, it uses index statistics and mappings to rewrite queries to match_none instead of fully running the request. + /// For instance a range query over a date field can rewrite to match_none if all documents within a shard (including deleted documents) are outside of the provided range. + /// However, not all queries can rewrite to match_none so this API may return an index even if the provided filter matches no document. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FieldCapsRequestDescriptor IndexFilter(Action configure) + /// + /// + /// Define ad-hoc runtime fields in the request similar to the way it is done in search requests. + /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + /// + /// + /// Define ad-hoc runtime fields in the request similar to the way it is done in search requests. + /// These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. + /// + /// + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings() { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// @@ -458,43 +871,92 @@ public FieldCapsRequestDescriptor IndexFilter(Action /// - public FieldCapsRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RuntimeMappings(System.Action>? action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (RuntimeMappingsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.FieldCapsRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); + return new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(new Elastic.Clients.Elasticsearch.FieldCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsResponse.g.cs index efa756d8a3f..1a4d2e20066 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/FieldCapsResponse.g.cs @@ -17,27 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class FieldCapsResponse : ElasticsearchResponse +internal sealed partial class FieldCapsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.FieldCapsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propFields = default; + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FieldCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldCapsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldCapsResponseConverter))] +public sealed partial class FieldCapsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(IReadOnlyDictionary))] - public IReadOnlyDictionary> Fields { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCapsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Fields { get; set; } /// /// /// The list of indices where this field has the same type family, or null if all indices have the same type family for the field. /// /// - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetRequest.g.cs index b5f6178c117..6b5a6ed241f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetRequestParameters : RequestParameters +public sealed partial class GetRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -130,6 +123,35 @@ public sealed partial class GetRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } +internal sealed partial class GetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.GetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a document by its ID. @@ -202,20 +224,54 @@ public sealed partial class GetRequestParameters : RequestParameters /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class GetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetRequestConverter))] +public sealed partial class GetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "get"; + /// + /// + /// A unique document identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The name of the index that contains the document. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// Indicates whether the request forces synthetic _source. @@ -223,7 +279,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. /// /// - [JsonIgnore] public bool? ForceSyntheticSource { get => Q("force_synthetic_source"); set => Q("force_synthetic_source", value); } /// @@ -238,7 +293,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// A sample value can be something like the web session ID or the user name. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -246,7 +300,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -255,7 +308,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -263,7 +315,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -271,7 +322,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// Indicates whether to return the _source field (true or false) or lists the fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -281,7 +331,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -292,7 +341,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -304,7 +352,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// Object fields can't be returned;​if specified, the request fails. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } /// @@ -313,7 +360,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// It must match the current version of the document for the request to succeed. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -321,7 +367,6 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } @@ -397,64 +442,305 @@ public GetRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class GetRequestDescriptor : RequestDescriptor, GetRequestParameters> +public readonly partial struct GetRequestDescriptor { - internal GetRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetRequest Instance { get; init; } - public GetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRequestDescriptor(Elastic.Clients.Elasticsearch.GetRequest instance) { + Instance = instance; } - public GetRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public GetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.GetRequest(index, id); } - public GetRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public GetRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.GetRequestDescriptor(Elastic.Clients.Elasticsearch.GetRequest instance) => new Elastic.Clients.Elasticsearch.GetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetRequest(Elastic.Clients.Elasticsearch.GetRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public GetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// The name of the index that contains the document. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGet; + /// + /// + /// Indicates whether the request forces synthetic _source. + /// Use this paramater to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor ForceSyntheticSource(bool? value = true) + { + Instance.ForceSyntheticSource = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + /// If it is set to _local, the operation will prefer to be run on a local allocated shard when possible. + /// If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. + /// This can help with "jumping values" when hitting different shards in different refresh states. + /// A sample value can be something like the web session ID or the user name. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } - internal override string OperationName => "get"; + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Source(System.Func action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } - public GetRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public GetRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public GetRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public GetRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public GetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public GetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public GetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public GetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public GetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public GetRequestDescriptor Version(long? version) => Qs("version", version); - public GetRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// Only leaf fields can be retrieved with the stored_field option. + /// Object fields can't be returned;​if specified, the request fails. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// Only leaf fields can be retrieved with the stored_field option. + /// Object fields can't be returned;​if specified, the request fails. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(new Elastic.Clients.Elasticsearch.GetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Human(bool? value) { - RouteValues.Required("id", id); - return Self; + Instance.Human = value; + return this; } - public GetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", index); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -530,47 +816,308 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. /// /// -public sealed partial class GetRequestDescriptor : RequestDescriptor +public readonly partial struct GetRequestDescriptor { - internal GetRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetRequest Instance { get; init; } - public GetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRequestDescriptor(Elastic.Clients.Elasticsearch.GetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGet; + public GetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public GetRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.GetRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => false; + public GetRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetRequest(typeof(TDocument), id); + } - internal override string OperationName => "get"; + public GetRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.GetRequestDescriptor(Elastic.Clients.Elasticsearch.GetRequest instance) => new Elastic.Clients.Elasticsearch.GetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetRequest(Elastic.Clients.Elasticsearch.GetRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public GetRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public GetRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public GetRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public GetRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public GetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public GetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public GetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public GetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public GetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public GetRequestDescriptor Version(long? version) => Qs("version", version); - public GetRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// The name of the index that contains the document. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Indicates whether the request forces synthetic _source. + /// Use this paramater to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this parameter enabled will be slower than enabling synthetic source natively in the index. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor ForceSyntheticSource(bool? value = true) + { + Instance.ForceSyntheticSource = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + /// If it is set to _local, the operation will prefer to be run on a local allocated shard when possible. + /// If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. + /// This can help with "jumping values" when hitting different shards in different refresh states. + /// A sample value can be something like the web session ID or the user name. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } + + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// Only leaf fields can be retrieved with the stored_field option. + /// Object fields can't be returned;​if specified, the request fails. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source parameter defaults to false. + /// Only leaf fields can be retrieved with the stored_field option. + /// Object fields can't be returned;​if specified, the request fails. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.GetRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(new Elastic.Clients.Elasticsearch.GetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetResponse.g.cs index f110c87f9ca..e9f0a87b85a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetResponse.g.cs @@ -17,66 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetResponse : ElasticsearchResponse +internal sealed partial class GetResponseConverter : System.Text.Json.Serialization.JsonConverter> { + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIgnored = System.Text.Json.JsonEncodedText.Encode("_ignored"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.GetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFields = default; + LocalJsonValue propFound = default; + LocalJsonValue propId = default; + LocalJsonValue?> propIgnored = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIgnored.TryReadProperty(ref reader, options, PropIgnored, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Found = propFound.Value, + Id = propId.Value, + Ignored = propIgnored.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Routing = propRouting.Value, + SeqNo = propSeqNo.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIgnored, value.Ignored, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class GetResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(GetResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(GetResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetResponseConverterFactory))] +public sealed partial class GetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the stored_fields parameter is set to true and found is true, it contains the document fields stored in the index. /// /// - [JsonInclude, JsonPropertyName("fields")] - public Elastic.Clients.Elasticsearch.FieldValues? Fields { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// Indicates whether the document exists. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } /// /// /// The unique identifier for the document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_ignored")] - public IReadOnlyCollection? Ignored { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Ignored { get; set; } /// /// /// The name of the index the document belongs to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The explicit routing, if set. /// /// - [JsonInclude, JsonPropertyName("_routing")] - public string? Routing { get; init; } + public string? Routing { get; set; } /// /// @@ -84,8 +235,7 @@ public sealed partial class GetResponse : ElasticsearchResponse /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// @@ -93,15 +243,12 @@ public sealed partial class GetResponse : ElasticsearchResponse /// If the _source parameter is set to false or the stored_fields parameter is set to true, it is excluded. /// /// - [JsonInclude, JsonPropertyName("_source")] - [SourceConverter] - public TDocument? Source { get; init; } + public TDocument? Source { get; set; } /// /// /// The document version, which is ncremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long? Version { get; init; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextRequest.g.cs index 4364f3b5fe8..76328dc04dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptContextRequestParameters : RequestParameters +public sealed partial class GetScriptContextRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetScriptContextRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.GetScriptContextRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptContextRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptContextRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -42,11 +64,28 @@ public sealed partial class GetScriptContextRequestParameters : RequestParameter /// Get a list of supported script contexts and their methods. /// /// -public sealed partial class GetScriptContextRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptContextRequestConverter))] +public sealed partial class GetScriptContextRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScriptContext; +#if NET7_0_OR_GREATER + public GetScriptContextRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetScriptContextRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptContextRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceGetScriptContext; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -61,23 +100,76 @@ public sealed partial class GetScriptContextRequest : PlainRequest /// -public sealed partial class GetScriptContextRequestDescriptor : RequestDescriptor +public readonly partial struct GetScriptContextRequestDescriptor { - internal GetScriptContextRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetScriptContextRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptContextRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptContextRequest instance) + { + Instance = instance; + } public GetScriptContextRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.GetScriptContextRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScriptContext; + public static explicit operator Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptContextRequest instance) => new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetScriptContextRequest(Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetScriptContextRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.GetScriptContextRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(new Elastic.Clients.Elasticsearch.GetScriptContextRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "get_script_context"; + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextResponse.g.cs index 675104dff9c..8a91073a6c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptContextResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptContextResponse : ElasticsearchResponse +internal sealed partial class GetScriptContextResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("contexts")] - public IReadOnlyCollection Contexts { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + + public override Elastic.Clients.Elasticsearch.GetScriptContextResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propContexts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptContextResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Contexts = propContexts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptContextResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptContextResponseConverter))] +public sealed partial class GetScriptContextResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptContextResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptContextResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Contexts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesRequest.g.cs index eb6c1779d1b..6683edc7178 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptLanguagesRequestParameters : RequestParameters +public sealed partial class GetScriptLanguagesRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetScriptLanguagesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -42,11 +64,28 @@ public sealed partial class GetScriptLanguagesRequestParameters : RequestParamet /// Get a list of available script types, languages, and contexts. /// /// -public sealed partial class GetScriptLanguagesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestConverter))] +public sealed partial class GetScriptLanguagesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScriptLanguages; +#if NET7_0_OR_GREATER + public GetScriptLanguagesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetScriptLanguagesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceGetScriptLanguages; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -61,23 +100,76 @@ public sealed partial class GetScriptLanguagesRequest : PlainRequest /// -public sealed partial class GetScriptLanguagesRequestDescriptor : RequestDescriptor +public readonly partial struct GetScriptLanguagesRequestDescriptor { - internal GetScriptLanguagesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptLanguagesRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest instance) + { + Instance = instance; + } public GetScriptLanguagesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScriptLanguages; + public static explicit operator Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest instance) => new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "get_script_languages"; + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesResponse.g.cs index 37a210be29b..a8253210a4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptLanguagesResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptLanguagesResponse : ElasticsearchResponse +internal sealed partial class GetScriptLanguagesResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLanguageContexts = System.Text.Json.JsonEncodedText.Encode("language_contexts"); + private static readonly System.Text.Json.JsonEncodedText PropTypesAllowed = System.Text.Json.JsonEncodedText.Encode("types_allowed"); + + public override Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propLanguageContexts = default; + LocalJsonValue> propTypesAllowed = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLanguageContexts.TryReadProperty(ref reader, options, PropLanguageContexts, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTypesAllowed.TryReadProperty(ref reader, options, PropTypesAllowed, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + LanguageContexts = propLanguageContexts.Value, + TypesAllowed = propTypesAllowed.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguageContexts, value.LanguageContexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTypesAllowed, value.TypesAllowed, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptLanguagesResponseConverter))] +public sealed partial class GetScriptLanguagesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("language_contexts")] - public IReadOnlyCollection LanguageContexts { get; init; } - [JsonInclude, JsonPropertyName("types_allowed")] - public IReadOnlyCollection TypesAllowed { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptLanguagesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptLanguagesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection LanguageContexts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection TypesAllowed { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptRequest.g.cs index 34ef3573000..2eed12f90e1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptRequestParameters : RequestParameters +public sealed partial class GetScriptRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,26 +35,78 @@ public sealed partial class GetScriptRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetScriptRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.GetScriptRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a script or search template. /// Retrieves a stored script or search template. /// /// -public sealed partial class GetScriptRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptRequestConverter))] +public sealed partial class GetScriptRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetScriptRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScript; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceGetScript; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "get_script"; + /// + /// + /// The identifier for the stored script or search template. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The period to wait for the master node. @@ -69,7 +114,6 @@ public GetScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requi /// It can also be set to -1 to indicate that the request should never timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -79,66 +123,101 @@ public GetScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requi /// Retrieves a stored script or search template. /// /// -public sealed partial class GetScriptRequestDescriptor : RequestDescriptor, GetScriptRequestParameters> +public readonly partial struct GetScriptRequestDescriptor { - internal GetScriptRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetScriptRequest Instance { get; init; } - public GetScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScript; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public GetScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetScriptRequest(id); + } - internal override string OperationName => "get_script"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetScriptRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public GetScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public static explicit operator Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(Elastic.Clients.Elasticsearch.GetScriptRequest instance) => new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetScriptRequest(Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor descriptor) => descriptor.Instance; - public GetScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The identifier for the stored script or search template. + /// + /// + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Get a script or search template. -/// Retrieves a stored script or search template. -/// -/// -public sealed partial class GetScriptRequestDescriptor : RequestDescriptor -{ - internal GetScriptRequestDescriptor(Action configure) => configure.Invoke(this); - - public GetScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetScriptRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(new Elastic.Clients.Elasticsearch.GetScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetScript; + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "get_script"; + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptResponse.g.cs index e9e8fa8c010..5b151620d9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetScriptResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetScriptResponse : ElasticsearchResponse +internal sealed partial class GetScriptResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.StoredScript? Script { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.GetScriptResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + LocalJsonValue propId = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value, + Id = propId.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetScriptResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetScriptResponseConverter))] +public sealed partial class GetScriptResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetScriptResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public Elastic.Clients.Elasticsearch.StoredScript? Script { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceRequest.g.cs index 0f3e7044d4e..936f3dd5be1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetSourceRequestParameters : RequestParameters +public sealed partial class GetSourceRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -106,6 +99,35 @@ public sealed partial class GetSourceRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } +internal sealed partial class GetSourceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.GetSourceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetSourceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a document's source. @@ -124,27 +146,60 @@ public sealed partial class GetSourceRequestParameters : RequestParameters /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities /// /// -public sealed partial class GetSourceRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetSourceRequestConverter))] +public sealed partial class GetSourceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetSourceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetSource; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceGetSource; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "get_source"; + /// + /// + /// A unique document identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The name of the index that contains the document. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// The node or shard the operation should be performed on. /// By default, the operation is randomized between the shard replicas. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -152,7 +207,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -161,7 +215,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -169,7 +222,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -177,7 +229,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// Indicates whether to return the _source field (true or false) or lists the fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -185,7 +236,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// A comma-separated list of source fields to exclude in the response. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -193,7 +243,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// A comma-separated list of source fields to include in the response. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -201,7 +250,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// A comma-separated list of stored fields to return as part of a hit. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } /// @@ -210,7 +258,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// It must match the current version of the document for the request to succeed. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -218,7 +265,6 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } @@ -240,63 +286,268 @@ public GetSourceRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.C /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities /// /// -public sealed partial class GetSourceRequestDescriptor : RequestDescriptor, GetSourceRequestParameters> +public readonly partial struct GetSourceRequestDescriptor { - internal GetSourceRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetSourceRequest Instance { get; init; } - public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.GetSourceRequest instance) { + Instance = instance; } - public GetSourceRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.GetSourceRequest(index, id); } - public GetSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSourceRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public GetSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.GetSourceRequest instance) => new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetSourceRequest(Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// The name of the index that contains the document. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetSource; + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override string OperationName => "get_source"; + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public GetSourceRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public GetSourceRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public GetSourceRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public GetSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public GetSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public GetSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public GetSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public GetSourceRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public GetSourceRequestDescriptor Version(long? version) => Qs("version", version); - public GetSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } - public GetSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Source(System.Func action) { - RouteValues.Required("id", id); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - public GetSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) { - RouteValues.Required("index", index); - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetSourceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(new Elastic.Clients.Elasticsearch.GetSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -318,46 +569,271 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities /// /// -public sealed partial class GetSourceRequestDescriptor : RequestDescriptor +public readonly partial struct GetSourceRequestDescriptor { - internal GetSourceRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GetSourceRequest Instance { get; init; } - public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.GetSourceRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceGetSource; + public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetSourceRequest(index, id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public GetSourceRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.GetSourceRequest(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)); + } - internal override bool SupportsBody => false; + public GetSourceRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetSourceRequest(typeof(TDocument), id); + } - internal override string OperationName => "get_source"; + public GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.GetSourceRequest(typeof(TDocument), id); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSourceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(Elastic.Clients.Elasticsearch.GetSourceRequest instance) => new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GetSourceRequest(Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique document identifier. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// The name of the index that contains the document. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, the operation is randomized between the shard replicas. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } + + /// + /// + /// If true, the request refreshes the relevant shards before retrieving the document. + /// Setting it to true should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Indicates whether to return the _source field (true or false) or lists the fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } - public GetSourceRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public GetSourceRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public GetSourceRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public GetSourceRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public GetSourceRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public GetSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public GetSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public GetSourceRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); - public GetSourceRequestDescriptor Version(long? version) => Qs("version", version); - public GetSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// The version number for concurrency control. + /// It must match the current version of the document for the request to succeed. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GetSourceRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(new Elastic.Clients.Elasticsearch.GetSourceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetSourceRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetSourceRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceResponse.g.cs index d977820c73e..1ab09ffae6b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/GetSourceResponse.g.cs @@ -17,15 +17,59 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class GetSourceResponse : ElasticsearchResponse +internal sealed partial class GetSourceResponseConverter : System.Text.Json.Serialization.JsonConverter> +{ + public override Elastic.Clients.Elasticsearch.GetSourceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.GetSourceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Source = reader.ReadValue(options, static TDocument (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetSourceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Source, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + } +} + +internal sealed partial class GetSourceResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory { + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(GetSourceResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(GetSourceResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetSourceResponseConverterFactory))] +public partial class GetSourceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSourceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +TDocument Source { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreRequest.g.cs index 9a575d572f9..28df2adcebe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; -public sealed partial class ExploreRequestParameters : RequestParameters +public sealed partial class ExploreRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,72 @@ public sealed partial class ExploreRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ExploreRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConnections = System.Text.Json.JsonEncodedText.Encode("connections"); + private static readonly System.Text.Json.JsonEncodedText PropControls = System.Text.Json.JsonEncodedText.Encode("controls"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropVertices = System.Text.Json.JsonEncodedText.Encode("vertices"); + + public override Elastic.Clients.Elasticsearch.Graph.ExploreRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConnections = default; + LocalJsonValue propControls = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propVertices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnections.TryReadProperty(ref reader, options, PropConnections, null)) + { + continue; + } + + if (propControls.TryReadProperty(ref reader, options, PropControls, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propVertices.TryReadProperty(ref reader, options, PropVertices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Connections = propConnections.Value, + Controls = propControls.Value, + Query = propQuery.Value, + Vertices = propVertices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.ExploreRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnections, value.Connections, null, null); + writer.WriteProperty(options, PropControls, value.Controls, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropVertices, value.Vertices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Explore graph analytics. @@ -59,26 +118,48 @@ public sealed partial class ExploreRequestParameters : RequestParameters /// You can exclude vertices that have already been returned. /// /// -public sealed partial class ExploreRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.ExploreRequestConverter))] +public sealed partial class ExploreRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public ExploreRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExploreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.GraphExplore; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.GraphExplore; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "graph.explore"; + /// + /// + /// Name of the index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// Custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -88,7 +169,6 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Defaults to no timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -96,7 +176,6 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. /// /// - [JsonInclude, JsonPropertyName("connections")] public Elastic.Clients.Elasticsearch.Graph.Hop? Connections { get; set; } /// @@ -104,7 +183,6 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Direct the Graph API how to build the graph. /// /// - [JsonInclude, JsonPropertyName("controls")] public Elastic.Clients.Elasticsearch.Graph.ExploreControls? Controls { get; set; } /// @@ -112,7 +190,6 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -120,8 +197,7 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. /// /// - [JsonInclude, JsonPropertyName("vertices")] - public ICollection? Vertices { get; set; } + public System.Collections.Generic.ICollection? Vertices { get; set; } } /// @@ -134,76 +210,118 @@ public ExploreRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// You can exclude vertices that have already been returned. /// /// -public sealed partial class ExploreRequestDescriptor : RequestDescriptor, ExploreRequestParameters> +public readonly partial struct ExploreRequestDescriptor { - internal ExploreRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.ExploreRequest Instance { get; init; } - public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreRequest instance) { + Instance = instance; } - public ExploreRequestDescriptor() : this(typeof(TDocument)) + public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.GraphExplore; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExploreRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreRequest instance) => new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.ExploreRequest(Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the index. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "graph.explore"; + /// + /// + /// Custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public ExploreRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExploreRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Specifies the period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public ExploreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Connections = value; + return this; } - private Elastic.Clients.Elasticsearch.Graph.Hop? ConnectionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.HopDescriptor ConnectionsDescriptor { get; set; } - private Action> ConnectionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Graph.ExploreControls? ControlsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor ControlsDescriptor { get; set; } - private Action> ControlsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? VerticesValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor VerticesDescriptor { get; set; } - private Action> VerticesDescriptorAction { get; set; } - private Action>[] VerticesDescriptorActions { get; set; } + /// + /// + /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Connections(System.Action action) + { + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; + } /// /// /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. /// /// - public ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? connections) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Connections(System.Action> action) { - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = null; - ConnectionsValue = connections; - return Self; + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; } - public ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) + /// + /// + /// Direct the Graph API how to build the graph. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControls? value) { - ConnectionsValue = null; - ConnectionsDescriptorAction = null; - ConnectionsDescriptor = descriptor; - return Self; + Instance.Controls = value; + return this; } - public ExploreRequestDescriptor Connections(Action> configure) + /// + /// + /// Direct the Graph API how to build the graph. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Controls(System.Action action) { - ConnectionsValue = null; - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = configure; - return Self; + Instance.Controls = Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor.Build(action); + return this; } /// @@ -211,28 +329,32 @@ public ExploreRequestDescriptor Connections(Action /// - public ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControls? controls) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Controls(System.Action> action) { - ControlsDescriptor = null; - ControlsDescriptorAction = null; - ControlsValue = controls; - return Self; + Instance.Controls = Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor.Build(action); + return this; } - public ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor descriptor) + /// + /// + /// A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - ControlsValue = null; - ControlsDescriptorAction = null; - ControlsDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public ExploreRequestDescriptor Controls(Action> configure) + /// + /// + /// A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Query(System.Action action) { - ControlsValue = null; - ControlsDescriptor = null; - ControlsDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -240,28 +362,32 @@ public ExploreRequestDescriptor Controls(Action /// - public ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Vertices = value; + return this; } - public ExploreRequestDescriptor Query(Action> configure) + /// + /// + /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(params Elastic.Clients.Elasticsearch.Graph.VertexDefinition[] values) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Vertices = [.. values]; + return this; } /// @@ -269,125 +395,83 @@ public ExploreRequestDescriptor Query(Action /// - public ExploreRequestDescriptor Vertices(ICollection? vertices) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(params System.Action[] actions) { - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesValue = vertices; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); + } + + Instance.Vertices = items; + return this; } - public ExploreRequestDescriptor Vertices(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) + /// + /// + /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(params System.Action>[] actions) { - VerticesValue = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); + } + + Instance.Vertices = items; + return this; } - public ExploreRequestDescriptor Vertices(Action> configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.ExploreRequest Build(System.Action action) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorActions = null; - VerticesDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public ExploreRequestDescriptor Vertices(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor ErrorTrace(bool? value) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (ConnectionsDescriptor is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsDescriptor, options); - } - else if (ConnectionsDescriptorAction is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(ConnectionsDescriptorAction), options); - } - else if (ConnectionsValue is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsValue, options); - } + Instance.FilterPath = value; + return this; + } - if (ControlsDescriptor is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, ControlsDescriptor, options); - } - else if (ControlsDescriptorAction is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(ControlsDescriptorAction), options); - } - else if (ControlsValue is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, ControlsValue, options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (VerticesDescriptor is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, VerticesDescriptor, options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorAction is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(VerticesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorActions is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - foreach (var action in VerticesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndArray(); - } - else if (VerticesValue is not null) - { - writer.WritePropertyName("vertices"); - JsonSerializer.Serialize(writer, VerticesValue, options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -401,72 +485,84 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// You can exclude vertices that have already been returned. /// /// -public sealed partial class ExploreRequestDescriptor : RequestDescriptor +public readonly partial struct ExploreRequestDescriptor { - internal ExploreRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.ExploreRequest Instance { get; init; } - public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.GraphExplore; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(indices); + } - internal override string OperationName => "graph.explore"; + public ExploreRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(typeof(TDocument)); + } - public ExploreRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public ExploreRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreRequest instance) => new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.ExploreRequest(Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor descriptor) => descriptor.Instance; - public ExploreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Name of the index. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - RouteValues.Required("index", indices); - return Self; + Instance.Indices = value; + return this; } - private Elastic.Clients.Elasticsearch.Graph.Hop? ConnectionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.HopDescriptor ConnectionsDescriptor { get; set; } - private Action ConnectionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Graph.ExploreControls? ControlsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor ControlsDescriptor { get; set; } - private Action ControlsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? VerticesValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor VerticesDescriptor { get; set; } - private Action VerticesDescriptorAction { get; set; } - private Action[] VerticesDescriptorActions { get; set; } + /// + /// + /// Custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } /// /// - /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. + /// Specifies the period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. /// /// - public ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? connections) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = null; - ConnectionsValue = connections; - return Self; + Instance.Timeout = value; + return this; } - public ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) + /// + /// + /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? value) { - ConnectionsValue = null; - ConnectionsDescriptorAction = null; - ConnectionsDescriptor = descriptor; - return Self; + Instance.Connections = value; + return this; } - public ExploreRequestDescriptor Connections(Action configure) + /// + /// + /// Specifies or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Connections(System.Action> action) { - ConnectionsValue = null; - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = configure; - return Self; + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; } /// @@ -474,28 +570,32 @@ public ExploreRequestDescriptor Connections(Action /// - public ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControls? controls) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControls? value) { - ControlsDescriptor = null; - ControlsDescriptorAction = null; - ControlsValue = controls; - return Self; + Instance.Controls = value; + return this; } - public ExploreRequestDescriptor Controls(Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor descriptor) + /// + /// + /// Direct the Graph API how to build the graph. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Controls(System.Action> action) { - ControlsValue = null; - ControlsDescriptorAction = null; - ControlsDescriptor = descriptor; - return Self; + Instance.Controls = Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor.Build(action); + return this; } - public ExploreRequestDescriptor Controls(Action configure) + /// + /// + /// A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - ControlsValue = null; - ControlsDescriptor = null; - ControlsDescriptorAction = configure; - return Self; + Instance.Query = value; + return this; } /// @@ -503,28 +603,32 @@ public ExploreRequestDescriptor Controls(Action /// - public ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ExploreRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Vertices = value; + return this; } - public ExploreRequestDescriptor Query(Action configure) + /// + /// + /// Specifies one or more fields that contain the terms you want to include in the graph as vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(params Elastic.Clients.Elasticsearch.Graph.VertexDefinition[] values) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Vertices = [.. values]; + return this; } /// @@ -532,124 +636,65 @@ public ExploreRequestDescriptor Query(Action /// - public ExploreRequestDescriptor Vertices(ICollection? vertices) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Vertices(params System.Action>[] actions) { - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesValue = vertices; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); + } + + Instance.Vertices = items; + return this; } - public ExploreRequestDescriptor Vertices(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.ExploreRequest Build(System.Action> action) { - VerticesValue = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(new Elastic.Clients.Elasticsearch.Graph.ExploreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public ExploreRequestDescriptor Vertices(Action configure) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor ErrorTrace(bool? value) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorActions = null; - VerticesDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public ExploreRequestDescriptor Vertices(params Action[] configure) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor FilterPath(params string[]? value) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (ConnectionsDescriptor is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsDescriptor, options); - } - else if (ConnectionsDescriptorAction is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(ConnectionsDescriptorAction), options); - } - else if (ConnectionsValue is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsValue, options); - } - - if (ControlsDescriptor is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, ControlsDescriptor, options); - } - else if (ControlsDescriptorAction is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(ControlsDescriptorAction), options); - } - else if (ControlsValue is not null) - { - writer.WritePropertyName("controls"); - JsonSerializer.Serialize(writer, ControlsValue, options); - } + Instance.Human = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (VerticesDescriptor is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, VerticesDescriptor, options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorAction is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(VerticesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorActions is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - foreach (var action in VerticesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndArray(); - } - else if (VerticesValue is not null) - { - writer.WritePropertyName("vertices"); - JsonSerializer.Serialize(writer, VerticesValue, options); - } + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreResponse.g.cs index b916b224e45..55c5631a5b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Graph/ExploreResponse.g.cs @@ -17,25 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; -public sealed partial class ExploreResponse : ElasticsearchResponse +internal sealed partial class ExploreResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("connections")] - public IReadOnlyCollection Connections { get; init; } - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection Failures { get; init; } - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } - [JsonInclude, JsonPropertyName("vertices")] - public IReadOnlyCollection Vertices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropConnections = System.Text.Json.JsonEncodedText.Encode("connections"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropVertices = System.Text.Json.JsonEncodedText.Encode("vertices"); + + public override Elastic.Clients.Elasticsearch.Graph.ExploreResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propConnections = default; + LocalJsonValue> propFailures = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + LocalJsonValue> propVertices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnections.TryReadProperty(ref reader, options, PropConnections, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (propVertices.TryReadProperty(ref reader, options, PropVertices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.ExploreResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Connections = propConnections.Value, + Failures = propFailures.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value, + Vertices = propVertices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.ExploreResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnections, value.Connections, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteProperty(options, PropVertices, value.Vertices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.ExploreResponseConverter))] +public sealed partial class ExploreResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExploreResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Connections { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Failures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Vertices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportRequest.g.cs index 1e319f394cf..0c7d9e53afd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class HealthReportRequestParameters : RequestParameters +public sealed partial class HealthReportRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -54,6 +47,35 @@ public sealed partial class HealthReportRequestParameters : RequestParameters public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } +internal sealed partial class HealthReportRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.HealthReportRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.HealthReportRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.HealthReportRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the cluster health. @@ -81,30 +103,48 @@ public sealed partial class HealthReportRequestParameters : RequestParameters /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. /// /// -public sealed partial class HealthReportRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.HealthReportRequestConverter))] +public sealed partial class HealthReportRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public HealthReportRequest(System.Collections.Generic.ICollection? feature) : base(r => r.Optional("feature", feature)) + { + } +#if NET7_0_OR_GREATER public HealthReportRequest() { } - - public HealthReportRequest(IReadOnlyCollection? feature) : base(r => r.Optional("feature", feature)) +#endif +#if !NET7_0_OR_GREATER + public HealthReportRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HealthReportRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceHealthReport; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceHealthReport; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "health_report"; + /// + /// + /// A feature of the cluster, as returned by the top-level health report API. + /// + /// + public System.Collections.Generic.ICollection? Feature { get => P?>("feature"); set => PO("feature", value); } + /// /// /// Limit the number of affected resources the health report API returns. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -112,7 +152,6 @@ public HealthReportRequest(IReadOnlyCollection? feature) : base(r => r.O /// Explicit operation timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -120,7 +159,6 @@ public HealthReportRequest(IReadOnlyCollection? feature) : base(r => r.O /// Opt-in for more information about the health of the system. /// /// - [JsonIgnore] public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } @@ -151,37 +189,136 @@ public HealthReportRequest(IReadOnlyCollection? feature) : base(r => r.O /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. /// /// -public sealed partial class HealthReportRequestDescriptor : RequestDescriptor +public readonly partial struct HealthReportRequestDescriptor { - internal HealthReportRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.HealthReportRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthReportRequestDescriptor(Elastic.Clients.Elasticsearch.HealthReportRequest instance) + { + Instance = instance; + } - public HealthReportRequestDescriptor(IReadOnlyCollection? feature) : base(r => r.Optional("feature", feature)) + public HealthReportRequestDescriptor(System.Collections.Generic.ICollection? feature) { + Instance = new Elastic.Clients.Elasticsearch.HealthReportRequest(feature); } public HealthReportRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.HealthReportRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceHealthReport; + public static explicit operator Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(Elastic.Clients.Elasticsearch.HealthReportRequest instance) => new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.HealthReportRequest(Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A feature of the cluster, as returned by the top-level health report API. + /// + /// + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Feature(System.Collections.Generic.ICollection? value) + { + Instance.Feature = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A feature of the cluster, as returned by the top-level health report API. + /// + /// + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Feature(params string[] values) + { + Instance.Feature = [.. values]; + return this; + } - internal override string OperationName => "health_report"; + /// + /// + /// Limit the number of affected resources the health report API returns. + /// + /// + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Explicit operation timeout. + /// + /// + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// Opt-in for more information about the health of the system. + /// + /// + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Verbose(bool? value = true) + { + Instance.Verbose = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.HealthReportRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.HealthReportRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(new Elastic.Clients.Elasticsearch.HealthReportRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public HealthReportRequestDescriptor Size(int? size) => Qs("size", size); - public HealthReportRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public HealthReportRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public HealthReportRequestDescriptor Feature(IReadOnlyCollection? feature) + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("feature", feature); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportResponse.g.cs index a076c3eba52..422b2d9bcbc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/HealthReportResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class HealthReportResponse : ElasticsearchResponse +internal sealed partial class HealthReportResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("indicators")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.Indicators Indicators { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus? Status { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndicators = System.Text.Json.JsonEncodedText.Encode("indicators"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.HealthReportResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue propIndicators = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propIndicators.TryReadProperty(ref reader, options, PropIndicators, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.HealthReportResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Indicators = propIndicators.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.HealthReportResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropIndicators, value.Indicators, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.HealthReportResponseConverter))] +public sealed partial class HealthReportResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthReportResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HealthReportResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.Indicators Indicators { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus? Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleRequest.g.cs index aac721e8e18..3044b96a851 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class DeleteLifecycleRequestParameters : RequestParameters +public sealed partial class DeleteLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,32 +40,83 @@ public sealed partial class DeleteLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a lifecycle policy. /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. /// /// -public sealed partial class DeleteLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestConverter))] +public sealed partial class DeleteLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("policy", name)) { } +#if NET7_0_OR_GREATER + public DeleteLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementDeleteLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementDeleteLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ilm.delete_lifecycle"; + /// + /// + /// Identifier for the policy. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("policy"); set => PR("policy", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -80,7 +124,6 @@ public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -90,32 +133,110 @@ public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. /// /// -public sealed partial class DeleteLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteLifecycleRequestDescriptor { - internal DeleteLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest Instance { get; init; } - public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("policy", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementDeleteLifecycle; + public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ilm.delete_lifecycle"; + /// + /// + /// Identifier for the policy. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DeleteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("policy", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleResponse.g.cs index 07ce56d24ab..abc3d083f92 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/DeleteLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class DeleteLifecycleResponse : ElasticsearchResponse +internal sealed partial class DeleteLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponseConverter))] +public sealed partial class DeleteLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusRequest.g.cs index 7ca469ce9c7..339bce95d74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusRequest.g.cs @@ -17,34 +17,75 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class GetIlmStatusRequestParameters : RequestParameters +public sealed partial class GetIlmStatusRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetIlmStatusRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get the ILM status. +/// +/// /// Get the current index lifecycle management status. /// /// -public sealed partial class GetIlmStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestConverter))] +public sealed partial class GetIlmStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementGetStatus; +#if NET7_0_OR_GREATER + public GetIlmStatusRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetIlmStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementGetStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -54,26 +95,81 @@ public sealed partial class GetIlmStatusRequest : PlainRequest /// /// Get the ILM status. +/// +/// /// Get the current index lifecycle management status. /// /// -public sealed partial class GetIlmStatusRequestDescriptor : RequestDescriptor +public readonly partial struct GetIlmStatusRequestDescriptor { - internal GetIlmStatusRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIlmStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest instance) + { + Instance = instance; + } public GetIlmStatusRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementGetStatus; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "ilm.get_status"; + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusResponse.g.cs index 0cb87d29c09..9d3cb2c91b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetIlmStatusResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class GetIlmStatusResponse : ElasticsearchResponse +internal sealed partial class GetIlmStatusResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("operation_mode")] - public Elastic.Clients.Elasticsearch.LifecycleOperationMode OperationMode { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropOperationMode = System.Text.Json.JsonEncodedText.Encode("operation_mode"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOperationMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOperationMode.TryReadProperty(ref reader, options, PropOperationMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + OperationMode = propOperationMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOperationMode, value.OperationMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponseConverter))] +public sealed partial class GetIlmStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIlmStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIlmStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LifecycleOperationMode OperationMode { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleRequest.g.cs index c2d33b459fc..d335fcf10c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class GetLifecycleRequestParameters : RequestParameters +public sealed partial class GetLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,35 +40,82 @@ public sealed partial class GetLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get lifecycle policies. /// /// -public sealed partial class GetLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestConverter))] +public sealed partial class GetLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("policy", name)) + { + } +#if NET7_0_OR_GREATER public GetLifecycleRequest() { } - - public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("policy", name)) +#endif +#if !NET7_0_OR_GREATER + public GetLifecycleRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementGetLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementGetLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ilm.get_lifecycle"; + /// + /// + /// Identifier for the policy. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("policy"); set => PO("policy", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -83,7 +123,6 @@ public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -92,36 +131,114 @@ public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => /// Get lifecycle policies. /// /// -public sealed partial class GetLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct GetLifecycleRequestDescriptor { - internal GetLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest instance) + { + Instance = instance; + } - public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("policy", name)) + public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(name); } public GetLifecycleRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementGetLifecycle; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the policy. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "ilm.get_lifecycle"; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("policy", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleResponse.g.cs index e8ab42d8f8d..aad43ef2238 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/GetLifecycleResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class GetLifecycleResponse : DictionaryResponse +internal sealed partial class GetLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetLifecycleResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Lifecycles = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetLifecycleResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Lifecycles, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponseConverter))] +public sealed partial class GetLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Lifecycles { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersRequest.g.cs index 111adb650af..15b79526383 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class MigrateToDataTiersRequestParameters : RequestParameters +public sealed partial class MigrateToDataTiersRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,6 +32,63 @@ public sealed partial class MigrateToDataTiersRequestParameters : RequestParamet /// /// public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class MigrateToDataTiersRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLegacyTemplateToDelete = System.Text.Json.JsonEncodedText.Encode("legacy_template_to_delete"); + private static readonly System.Text.Json.JsonEncodedText PropNodeAttribute = System.Text.Json.JsonEncodedText.Encode("node_attribute"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLegacyTemplateToDelete = default; + LocalJsonValue propNodeAttribute = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLegacyTemplateToDelete.TryReadProperty(ref reader, options, PropLegacyTemplateToDelete, null)) + { + continue; + } + + if (propNodeAttribute.TryReadProperty(ref reader, options, PropNodeAttribute, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + LegacyTemplateToDelete = propLegacyTemplateToDelete.Value, + NodeAttribute = propNodeAttribute.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLegacyTemplateToDelete, value.LegacyTemplateToDelete, null, null); + writer.WriteProperty(options, PropNodeAttribute, value.NodeAttribute, null, null); + writer.WriteEndObject(); + } } /// @@ -74,11 +124,28 @@ public sealed partial class MigrateToDataTiersRequestParameters : RequestParamet /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. /// /// -public sealed partial class MigrateToDataTiersRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestConverter))] +public sealed partial class MigrateToDataTiersRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementMigrateToDataTiers; +#if NET7_0_OR_GREATER + public MigrateToDataTiersRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public MigrateToDataTiersRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementMigrateToDataTiers; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -90,11 +157,17 @@ public sealed partial class MigrateToDataTiersRequest : PlainRequest /// - [JsonIgnore] public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } - [JsonInclude, JsonPropertyName("legacy_template_to_delete")] + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } public string? LegacyTemplateToDelete { get; set; } - [JsonInclude, JsonPropertyName("node_attribute")] public string? NodeAttribute { get; set; } } @@ -131,54 +204,113 @@ public sealed partial class MigrateToDataTiersRequest : PlainRequestSTOPPED. /// /// -public sealed partial class MigrateToDataTiersRequestDescriptor : RequestDescriptor +public readonly partial struct MigrateToDataTiersRequestDescriptor { - internal MigrateToDataTiersRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateToDataTiersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest instance) + { + Instance = instance; + } public MigrateToDataTiersRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementMigrateToDataTiers; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. + /// This provides a way to retrieve the indices and ILM policies that need to be migrated. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor DryRun(bool? value = true) + { + Instance.DryRun = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "ilm.migrate_to_data_tiers"; + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor LegacyTemplateToDelete(string? value) + { + Instance.LegacyTemplateToDelete = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor NodeAttribute(string? value) + { + Instance.NodeAttribute = value; + return this; + } - public MigrateToDataTiersRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? LegacyTemplateToDeleteValue { get; set; } - private string? NodeAttributeValue { get; set; } + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public MigrateToDataTiersRequestDescriptor LegacyTemplateToDelete(string? legacyTemplateToDelete) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor ErrorTrace(bool? value) { - LegacyTemplateToDeleteValue = legacyTemplateToDelete; - return Self; + Instance.ErrorTrace = value; + return this; } - public MigrateToDataTiersRequestDescriptor NodeAttribute(string? nodeAttribute) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor FilterPath(params string[]? value) { - NodeAttributeValue = nodeAttribute; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(LegacyTemplateToDeleteValue)) - { - writer.WritePropertyName("legacy_template_to_delete"); - writer.WriteStringValue(LegacyTemplateToDeleteValue); - } + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(NodeAttributeValue)) - { - writer.WritePropertyName("node_attribute"); - writer.WriteStringValue(NodeAttributeValue); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersResponse.g.cs index 72723c175c6..9f05e3271a9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MigrateToDataTiersResponse.g.cs @@ -17,60 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class MigrateToDataTiersResponse : ElasticsearchResponse +internal sealed partial class MigrateToDataTiersResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dry_run")] - public bool DryRun { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDryRun = System.Text.Json.JsonEncodedText.Encode("dry_run"); + private static readonly System.Text.Json.JsonEncodedText PropMigratedComponentTemplates = System.Text.Json.JsonEncodedText.Encode("migrated_component_templates"); + private static readonly System.Text.Json.JsonEncodedText PropMigratedComposableTemplates = System.Text.Json.JsonEncodedText.Encode("migrated_composable_templates"); + private static readonly System.Text.Json.JsonEncodedText PropMigratedIlmPolicies = System.Text.Json.JsonEncodedText.Encode("migrated_ilm_policies"); + private static readonly System.Text.Json.JsonEncodedText PropMigratedIndices = System.Text.Json.JsonEncodedText.Encode("migrated_indices"); + private static readonly System.Text.Json.JsonEncodedText PropMigratedLegacyTemplates = System.Text.Json.JsonEncodedText.Encode("migrated_legacy_templates"); + private static readonly System.Text.Json.JsonEncodedText PropRemovedLegacyTemplate = System.Text.Json.JsonEncodedText.Encode("removed_legacy_template"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDryRun = default; + LocalJsonValue> propMigratedComponentTemplates = default; + LocalJsonValue> propMigratedComposableTemplates = default; + LocalJsonValue> propMigratedIlmPolicies = default; + LocalJsonValue> propMigratedIndices = default; + LocalJsonValue> propMigratedLegacyTemplates = default; + LocalJsonValue propRemovedLegacyTemplate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDryRun.TryReadProperty(ref reader, options, PropDryRun, null)) + { + continue; + } + + if (propMigratedComponentTemplates.TryReadProperty(ref reader, options, PropMigratedComponentTemplates, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMigratedComposableTemplates.TryReadProperty(ref reader, options, PropMigratedComposableTemplates, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMigratedIlmPolicies.TryReadProperty(ref reader, options, PropMigratedIlmPolicies, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMigratedIndices.TryReadProperty(ref reader, options, PropMigratedIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propMigratedLegacyTemplates.TryReadProperty(ref reader, options, PropMigratedLegacyTemplates, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRemovedLegacyTemplate.TryReadProperty(ref reader, options, PropRemovedLegacyTemplate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DryRun = propDryRun.Value, + MigratedComponentTemplates = propMigratedComponentTemplates.Value, + MigratedComposableTemplates = propMigratedComposableTemplates.Value, + MigratedIlmPolicies = propMigratedIlmPolicies.Value, + MigratedIndices = propMigratedIndices.Value, + MigratedLegacyTemplates = propMigratedLegacyTemplates.Value, + RemovedLegacyTemplate = propRemovedLegacyTemplate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDryRun, value.DryRun, null, null); + writer.WriteProperty(options, PropMigratedComponentTemplates, value.MigratedComponentTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMigratedComposableTemplates, value.MigratedComposableTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMigratedIlmPolicies, value.MigratedIlmPolicies, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMigratedIndices, value.MigratedIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMigratedLegacyTemplates, value.MigratedLegacyTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemovedLegacyTemplate, value.RemovedLegacyTemplate, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponseConverter))] +public sealed partial class MigrateToDataTiersResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateToDataTiersResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateToDataTiersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool DryRun { get; set; } /// /// /// The component templates that were updated to not contain custom routing settings for the provided data attribute. /// /// - [JsonInclude, JsonPropertyName("migrated_component_templates")] - public IReadOnlyCollection MigratedComponentTemplates { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MigratedComponentTemplates { get; set; } /// /// /// The composable index templates that were updated to not contain custom routing settings for the provided data attribute. /// /// - [JsonInclude, JsonPropertyName("migrated_composable_templates")] - public IReadOnlyCollection MigratedComposableTemplates { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MigratedComposableTemplates { get; set; } /// /// /// The ILM policies that were updated. /// /// - [JsonInclude, JsonPropertyName("migrated_ilm_policies")] - public IReadOnlyCollection MigratedIlmPolicies { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MigratedIlmPolicies { get; set; } /// /// /// The indices that were migrated to tier preference routing. /// /// - [JsonInclude, JsonPropertyName("migrated_indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection MigratedIndices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection MigratedIndices { get; set; } /// /// /// The legacy index templates that were updated to not contain custom routing settings for the provided data attribute. /// /// - [JsonInclude, JsonPropertyName("migrated_legacy_templates")] - public IReadOnlyCollection MigratedLegacyTemplates { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MigratedLegacyTemplates { get; set; } /// /// @@ -78,6 +197,9 @@ public sealed partial class MigrateToDataTiersResponse : ElasticsearchResponse /// This information is missing if no legacy index templates were deleted. /// /// - [JsonInclude, JsonPropertyName("removed_legacy_template")] - public string RemovedLegacyTemplate { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RemovedLegacyTemplate { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepRequest.g.cs index c45c2815647..5712af720f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class MoveToStepRequestParameters : RequestParameters +public sealed partial class MoveToStepRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class MoveToStepRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCurrentStep = System.Text.Json.JsonEncodedText.Encode("current_step"); + private static readonly System.Text.Json.JsonEncodedText PropNextStep = System.Text.Json.JsonEncodedText.Encode("next_step"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentStep = default; + LocalJsonValue propNextStep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentStep.TryReadProperty(ref reader, options, PropCurrentStep, null)) + { + continue; + } + + if (propNextStep.TryReadProperty(ref reader, options, PropNextStep, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentStep = propCurrentStep.Value, + NextStep = propNextStep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentStep, value.CurrentStep, null, null); + writer.WriteProperty(options, PropNextStep, value.NextStep, null, null); + writer.WriteEndObject(); + } } /// @@ -55,35 +96,72 @@ public sealed partial class MoveToStepRequestParameters : RequestParameters /// An index cannot move to a step that is not part of its policy. /// /// -public sealed partial class MoveToStepRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestConverter))] +public sealed partial class MoveToStepRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MoveToStepRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementMoveToStep; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoveToStepRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey currentStep, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey nextStep) : base(r => r.Required("index", index)) + { + CurrentStep = currentStep; + NextStep = nextStep; + } +#if NET7_0_OR_GREATER + public MoveToStepRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MoveToStepRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementMoveToStep; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ilm.move_to_step"; + /// + /// + /// The name of the index whose lifecycle step is to change + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// The step that the index is expected to be in. /// /// - [JsonInclude, JsonPropertyName("current_step")] - public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey CurrentStep { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey CurrentStep { get; set; } /// /// /// The step that you want to run. /// /// - [JsonInclude, JsonPropertyName("next_step")] - public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey NextStep { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey NextStep { get; set; } } /// @@ -107,66 +185,74 @@ public MoveToStepRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// An index cannot move to a step that is not part of its policy. /// /// -public sealed partial class MoveToStepRequestDescriptor : RequestDescriptor, MoveToStepRequestParameters> +public readonly partial struct MoveToStepRequestDescriptor { - internal MoveToStepRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest Instance { get; init; } - public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest instance) { + Instance = instance; } - public MoveToStepRequestDescriptor() : this(typeof(TDocument)) + public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(index); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementMoveToStep; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public MoveToStepRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ilm.move_to_step"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor descriptor) => descriptor.Instance; - public MoveToStepRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The name of the index whose lifecycle step is to change + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - RouteValues.Required("index", index); - return Self; + Instance.Index = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey CurrentStepValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor CurrentStepDescriptor { get; set; } - private Action CurrentStepDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey NextStepValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor NextStepDescriptor { get; set; } - private Action NextStepDescriptorAction { get; set; } - /// /// /// The step that the index is expected to be in. /// /// - public MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey currentStep) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey value) { - CurrentStepDescriptor = null; - CurrentStepDescriptorAction = null; - CurrentStepValue = currentStep; - return Self; + Instance.CurrentStep = value; + return this; } - public MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor descriptor) + /// + /// + /// The step that the index is expected to be in. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor CurrentStep(System.Action action) { - CurrentStepValue = null; - CurrentStepDescriptorAction = null; - CurrentStepDescriptor = descriptor; - return Self; + Instance.CurrentStep = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor.Build(action); + return this; } - public MoveToStepRequestDescriptor CurrentStep(Action configure) + /// + /// + /// The step that you want to run. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey value) { - CurrentStepValue = null; - CurrentStepDescriptor = null; - CurrentStepDescriptorAction = configure; - return Self; + Instance.NextStep = value; + return this; } /// @@ -174,66 +260,60 @@ public MoveToStepRequestDescriptor CurrentStep(Action /// - public MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey nextStep) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor NextStep(System.Action action) { - NextStepDescriptor = null; - NextStepDescriptorAction = null; - NextStepValue = nextStep; - return Self; + Instance.NextStep = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor.Build(action); + return this; } - public MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest Build(System.Action action) { - NextStepValue = null; - NextStepDescriptorAction = null; - NextStepDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public MoveToStepRequestDescriptor NextStep(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor ErrorTrace(bool? value) { - NextStepValue = null; - NextStepDescriptor = null; - NextStepDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (CurrentStepDescriptor is not null) - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, CurrentStepDescriptor, options); - } - else if (CurrentStepDescriptorAction is not null) - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(CurrentStepDescriptorAction), options); - } - else - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, CurrentStepValue, options); - } + Instance.FilterPath = value; + return this; + } - if (NextStepDescriptor is not null) - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, NextStepDescriptor, options); - } - else if (NextStepDescriptorAction is not null) - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(NextStepDescriptorAction), options); - } - else - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, NextStepValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -258,62 +338,75 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// An index cannot move to a step that is not part of its policy. /// /// -public sealed partial class MoveToStepRequestDescriptor : RequestDescriptor +public readonly partial struct MoveToStepRequestDescriptor { - internal MoveToStepRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest Instance { get; init; } - public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementMoveToStep; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(index); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public MoveToStepRequestDescriptor() + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(typeof(TDocument)); +#pragma warning restore CS0618 + } - internal override string OperationName => "ilm.move_to_step"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor descriptor) => descriptor.Instance; - public MoveToStepRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The name of the index whose lifecycle step is to change + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - RouteValues.Required("index", index); - return Self; + Instance.Index = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey CurrentStepValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor CurrentStepDescriptor { get; set; } - private Action CurrentStepDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey NextStepValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor NextStepDescriptor { get; set; } - private Action NextStepDescriptorAction { get; set; } - /// /// /// The step that the index is expected to be in. /// /// - public MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey currentStep) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey value) { - CurrentStepDescriptor = null; - CurrentStepDescriptorAction = null; - CurrentStepValue = currentStep; - return Self; + Instance.CurrentStep = value; + return this; } - public MoveToStepRequestDescriptor CurrentStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor descriptor) + /// + /// + /// The step that the index is expected to be in. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor CurrentStep(System.Action action) { - CurrentStepValue = null; - CurrentStepDescriptorAction = null; - CurrentStepDescriptor = descriptor; - return Self; + Instance.CurrentStep = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor.Build(action); + return this; } - public MoveToStepRequestDescriptor CurrentStep(Action configure) + /// + /// + /// The step that you want to run. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey value) { - CurrentStepValue = null; - CurrentStepDescriptor = null; - CurrentStepDescriptorAction = configure; - return Self; + Instance.NextStep = value; + return this; } /// @@ -321,65 +414,59 @@ public MoveToStepRequestDescriptor CurrentStep(Action /// - public MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey nextStep) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor NextStep(System.Action action) { - NextStepDescriptor = null; - NextStepDescriptorAction = null; - NextStepValue = nextStep; - return Self; + Instance.NextStep = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor.Build(action); + return this; } - public MoveToStepRequestDescriptor NextStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest Build(System.Action> action) { - NextStepValue = null; - NextStepDescriptorAction = null; - NextStepDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public MoveToStepRequestDescriptor NextStep(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor ErrorTrace(bool? value) { - NextStepValue = null; - NextStepDescriptor = null; - NextStepDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (CurrentStepDescriptor is not null) - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, CurrentStepDescriptor, options); - } - else if (CurrentStepDescriptorAction is not null) - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(CurrentStepDescriptorAction), options); - } - else - { - writer.WritePropertyName("current_step"); - JsonSerializer.Serialize(writer, CurrentStepValue, options); - } + Instance.FilterPath = value; + return this; + } - if (NextStepDescriptor is not null) - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, NextStepDescriptor, options); - } - else if (NextStepDescriptorAction is not null) - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(NextStepDescriptorAction), options); - } - else - { - writer.WritePropertyName("next_step"); - JsonSerializer.Serialize(writer, NextStepValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepResponse.g.cs index 081d908885b..60abe834936 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/MoveToStepResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class MoveToStepResponse : ElasticsearchResponse +internal sealed partial class MoveToStepResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponseConverter))] +public sealed partial class MoveToStepResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoveToStepResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MoveToStepResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleRequest.g.cs index 3b17d1e0c82..eeb1eb3431e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class PutLifecycleRequestParameters : RequestParameters +public sealed partial class PutLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,6 +40,45 @@ public sealed partial class PutLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPolicy = System.Text.Json.JsonEncodedText.Encode("policy"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicy.TryReadProperty(ref reader, options, PropPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Policy = propPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicy, value.Policy, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a lifecycle policy. @@ -56,26 +88,48 @@ public sealed partial class PutLifecycleRequestParameters : RequestParameters /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. /// /// -public sealed partial class PutLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestConverter))] +public sealed partial class PutLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("policy", name)) { } +#if NET7_0_OR_GREATER + public PutLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementPutLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementPutLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ilm.put_lifecycle"; + /// + /// + /// Identifier for the policy. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("policy"); set => PR("policy", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -83,9 +137,7 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } - [JsonInclude, JsonPropertyName("policy")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy? Policy { get; set; } } @@ -98,78 +150,122 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. /// /// -public sealed partial class PutLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct PutLifecycleRequestDescriptor { - internal PutLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest Instance { get; init; } - public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("policy", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementPutLifecycle; + public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ilm.put_lifecycle"; + /// + /// + /// Identifier for the policy. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public PutLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("policy", name); - return Self; + Instance.Timeout = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy? PolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor PolicyDescriptor { get; set; } - private Action PolicyDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Policy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy? value) + { + Instance.Policy = value; + return this; + } - public PutLifecycleRequestDescriptor Policy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy? policy) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Policy(System.Action action) { - PolicyDescriptor = null; - PolicyDescriptorAction = null; - PolicyValue = policy; - return Self; + Instance.Policy = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor.Build(action); + return this; } - public PutLifecycleRequestDescriptor Policy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest Build(System.Action action) { - PolicyValue = null; - PolicyDescriptorAction = null; - PolicyDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PutLifecycleRequestDescriptor Policy(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor ErrorTrace(bool? value) { - PolicyValue = null; - PolicyDescriptor = null; - PolicyDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (PolicyDescriptor is not null) - { - writer.WritePropertyName("policy"); - JsonSerializer.Serialize(writer, PolicyDescriptor, options); - } - else if (PolicyDescriptorAction is not null) - { - writer.WritePropertyName("policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor(PolicyDescriptorAction), options); - } - else if (PolicyValue is not null) - { - writer.WritePropertyName("policy"); - JsonSerializer.Serialize(writer, PolicyValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleResponse.g.cs index d9f92f43a06..ec681ebcb2b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/PutLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class PutLifecycleResponse : ElasticsearchResponse +internal sealed partial class PutLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponseConverter))] +public sealed partial class PutLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyRequest.g.cs index 9c0c9c4438b..ddff6d153c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class RemovePolicyRequestParameters : RequestParameters +public sealed partial class RemovePolicyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class RemovePolicyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Remove policies from an index. @@ -41,19 +63,42 @@ public sealed partial class RemovePolicyRequestParameters : RequestParameters /// It also stops managing the indices. /// /// -public sealed partial class RemovePolicyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestConverter))] +public sealed partial class RemovePolicyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RemovePolicyRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public RemovePolicyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemovePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRemovePolicy; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementRemovePolicy; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ilm.remove_policy"; + + /// + /// + /// The name of the index to remove policy on + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } } /// @@ -63,34 +108,89 @@ public RemovePolicyRequest(Elastic.Clients.Elasticsearch.IndexName index) : base /// It also stops managing the indices. /// /// -public sealed partial class RemovePolicyRequestDescriptor : RequestDescriptor, RemovePolicyRequestParameters> +public readonly partial struct RemovePolicyRequestDescriptor { - internal RemovePolicyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest Instance { get; init; } - public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest instance) { + Instance = instance; } - public RemovePolicyRequestDescriptor() : this(typeof(TDocument)) + public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRemovePolicy; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RemovePolicyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the index to remove policy on + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ilm.remove_policy"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public RemovePolicyRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", index); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -101,29 +201,87 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// It also stops managing the indices. /// /// -public sealed partial class RemovePolicyRequestDescriptor : RequestDescriptor +public readonly partial struct RemovePolicyRequestDescriptor { - internal RemovePolicyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest Instance { get; init; } - public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRemovePolicy; + public RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RemovePolicyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ilm.remove_policy"; + /// + /// + /// The name of the index to remove policy on + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RemovePolicyRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyResponse.g.cs index 2b40e8f3b60..c70fc96f128 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RemovePolicyResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class RemovePolicyResponse : ElasticsearchResponse +internal sealed partial class RemovePolicyResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailedIndexes = System.Text.Json.JsonEncodedText.Encode("failed_indexes"); + private static readonly System.Text.Json.JsonEncodedText PropHasFailures = System.Text.Json.JsonEncodedText.Encode("has_failures"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFailedIndexes = default; + LocalJsonValue propHasFailures = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailedIndexes.TryReadProperty(ref reader, options, PropFailedIndexes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propHasFailures.TryReadProperty(ref reader, options, PropHasFailures, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FailedIndexes = propFailedIndexes.Value, + HasFailures = propHasFailures.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailedIndexes, value.FailedIndexes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHasFailures, value.HasFailures, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponseConverter))] +public sealed partial class RemovePolicyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("failed_indexes")] - public IReadOnlyCollection FailedIndexes { get; init; } - [JsonInclude, JsonPropertyName("has_failures")] - public bool HasFailures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemovePolicyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemovePolicyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FailedIndexes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool HasFailures { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryRequest.g.cs index 7ffff1bb01e..74cfaf1ae4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class RetryRequestParameters : RequestParameters +public sealed partial class RetryRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class RetryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Retry a policy. @@ -42,19 +64,42 @@ public sealed partial class RetryRequestParameters : RequestParameters /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. /// /// -public sealed partial class RetryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestConverter))] +public sealed partial class RetryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RetryRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public RetryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RetryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRetry; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementRetry; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ilm.retry"; + + /// + /// + /// The name of the indices (comma-separated) whose failed lifecycle step is to be retry + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } } /// @@ -65,34 +110,89 @@ public RetryRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. /// /// -public sealed partial class RetryRequestDescriptor : RequestDescriptor, RetryRequestParameters> +public readonly partial struct RetryRequestDescriptor { - internal RetryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest Instance { get; init; } - public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest instance) { + Instance = instance; } - public RetryRequestDescriptor() : this(typeof(TDocument)) + public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRetry; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RetryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the indices (comma-separated) whose failed lifecycle step is to be retry + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "ilm.retry"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public RetryRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", index); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -104,29 +204,87 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. /// /// -public sealed partial class RetryRequestDescriptor : RequestDescriptor +public readonly partial struct RetryRequestDescriptor { - internal RetryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest Instance { get; init; } - public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementRetry; + public RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RetryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ilm.retry"; + /// + /// + /// The name of the indices (comma-separated) whose failed lifecycle step is to be retry + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RetryRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryResponse.g.cs index 73e6389fe10..e66effa2231 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/RetryResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class RetryResponse : ElasticsearchResponse +internal sealed partial class RetryResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponseConverter))] +public sealed partial class RetryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RetryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmRequest.g.cs index 5849282dd88..686f264c68d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmRequest.g.cs @@ -17,36 +17,58 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class StartIlmRequestParameters : RequestParameters +public sealed partial class StartIlmRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StartIlmRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start the ILM plugin. @@ -55,11 +77,28 @@ public sealed partial class StartIlmRequestParameters : RequestParameters /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. /// /// -public sealed partial class StartIlmRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestConverter))] +public sealed partial class StartIlmRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementStart; +#if NET7_0_OR_GREATER + public StartIlmRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public StartIlmRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementStart; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -67,18 +106,16 @@ public sealed partial class StartIlmRequest : PlainRequest /// - /// Explicit operation timeout for connection to master node + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -90,26 +127,98 @@ public sealed partial class StartIlmRequest : PlainRequest /// -public sealed partial class StartIlmRequestDescriptor : RequestDescriptor +public readonly partial struct StartIlmRequestDescriptor { - internal StartIlmRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartIlmRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest instance) + { + Instance = instance; + } public StartIlmRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementStart; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "ilm.start"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public StartIlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public StartIlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmResponse.g.cs index 039eca5b3fc..582b3d123b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StartIlmResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class StartIlmResponse : ElasticsearchResponse +internal sealed partial class StartIlmResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponseConverter))] +public sealed partial class StartIlmResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartIlmResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartIlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmRequest.g.cs index 3cd7e0ddf37..975729bead3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmRequest.g.cs @@ -17,36 +17,58 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class StopIlmRequestParameters : RequestParameters +public sealed partial class StopIlmRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StopIlmRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop the ILM plugin. @@ -58,11 +80,28 @@ public sealed partial class StopIlmRequestParameters : RequestParameters /// Use the get ILM status API to check whether ILM is running. /// /// -public sealed partial class StopIlmRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestConverter))] +public sealed partial class StopIlmRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementStop; +#if NET7_0_OR_GREATER + public StopIlmRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public StopIlmRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexLifecycleManagementStop; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -70,18 +109,16 @@ public sealed partial class StopIlmRequest : PlainRequest /// - /// Explicit operation timeout for connection to master node + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -96,26 +133,98 @@ public sealed partial class StopIlmRequest : PlainRequest /// -public sealed partial class StopIlmRequestDescriptor : RequestDescriptor +public readonly partial struct StopIlmRequestDescriptor { - internal StopIlmRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopIlmRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest instance) + { + Instance = instance; + } public StopIlmRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexLifecycleManagementStop; + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "ilm.stop"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public StopIlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public StopIlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmResponse.g.cs index d41403aec0b..fd76b4cba87 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexLifecycleManagement/StopIlmResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public sealed partial class StopIlmResponse : ElasticsearchResponse +internal sealed partial class StopIlmResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponseConverter))] +public sealed partial class StopIlmResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopIlmResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopIlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexRequest.g.cs index a542c96bd8a..e4139deac79 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexRequest.g.cs @@ -17,21 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class AnalyzeIndexRequestParameters : RequestParameters +public sealed partial class AnalyzeIndexRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class AnalyzeIndexRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropCharFilter = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizer = System.Text.Json.JsonEncodedText.Encode("normalizer"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue?> propAttributes = default; + LocalJsonValue?> propCharFilter = default; + LocalJsonValue propExplain = default; + LocalJsonValue propField = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propNormalizer = default; + LocalJsonValue?> propText = default; + LocalJsonValue propTokenizer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCharFilter.TryReadProperty(ref reader, options, PropCharFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNormalizer.TryReadProperty(ref reader, options, PropNormalizer, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Attributes = propAttributes.Value, + CharFilter = propCharFilter.Value, + Explain = propExplain.Value, + Field = propField.Value, + Filter = propFilter.Value, + Normalizer = propNormalizer.Value, + Text = propText.Value, + Tokenizer = propTokenizer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCharFilter, value.CharFilter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNormalizer, value.Normalizer, null, null); + writer.WriteProperty(options, PropText, value.Text, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteEndObject(); + } } /// @@ -46,31 +150,51 @@ public sealed partial class AnalyzeIndexRequestParameters : RequestParameters /// The _analyze endpoint without a specified index will always use 10000 as its limit. /// /// -public sealed partial class AnalyzeIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestConverter))] +public sealed partial class AnalyzeIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + { + } +#if NET7_0_OR_GREATER public AnalyzeIndexRequest() { } - - public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) +#endif +#if !NET7_0_OR_GREATER + public AnalyzeIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementAnalyze; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementAnalyze; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "indices.analyze"; + /// + /// + /// Index used to derive the analyzer. + /// If specified, the analyzer or field parameter overrides this value. + /// If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Index { get => P("index"); set => PO("index", value); } + /// /// /// The name of the analyzer that should be applied to the provided text. /// This could be a built-in analyzer, or an analyzer that’s been configured in the index. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -78,23 +202,20 @@ public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : bas /// Array of token attributes used to filter the output of the explain parameter. /// /// - [JsonInclude, JsonPropertyName("attributes")] - public ICollection? Attributes { get; set; } + public System.Collections.Generic.ICollection? Attributes { get; set; } /// /// /// Array of character filters used to preprocess characters before the tokenizer. /// /// - [JsonInclude, JsonPropertyName("char_filter")] - public ICollection? CharFilter { get; set; } + public System.Collections.Generic.ICollection? CharFilter { get; set; } /// /// /// If true, the response includes token attributes and additional details. /// /// - [JsonInclude, JsonPropertyName("explain")] public bool? Explain { get; set; } /// @@ -104,7 +225,6 @@ public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : bas /// If specified, the analyzer parameter overrides this value. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -112,15 +232,13 @@ public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : bas /// Array of token filters used to apply after the tokenizer. /// /// - [JsonInclude, JsonPropertyName("filter")] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Normalizer to use to convert text into a single token. /// /// - [JsonInclude, JsonPropertyName("normalizer")] public string? Normalizer { get; set; } /// @@ -129,16 +247,13 @@ public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : bas /// If an array of strings is provided, it is analyzed as a multi-value field. /// /// - [JsonInclude, JsonPropertyName("text")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Text { get; set; } + public System.Collections.Generic.ICollection? Text { get; set; } /// /// /// Tokenizer to use to convert text into tokens. /// /// - [JsonInclude, JsonPropertyName("tokenizer")] public Elastic.Clients.Elasticsearch.Analysis.ITokenizer? Tokenizer { get; set; } } @@ -154,52 +269,52 @@ public AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexName? index) : bas /// The _analyze endpoint without a specified index will always use 10000 as its limit. /// /// -public sealed partial class AnalyzeIndexRequestDescriptor : RequestDescriptor, AnalyzeIndexRequestParameters> +public readonly partial struct AnalyzeIndexRequestDescriptor { - internal AnalyzeIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest Instance { get; init; } - public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest instance) { + Instance = instance; } - public AnalyzeIndexRequestDescriptor() : this(typeof(TDocument)) + public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementAnalyze; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public AnalyzeIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "indices.analyze"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor descriptor) => descriptor.Instance; - public AnalyzeIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// Index used to derive the analyzer. + /// If specified, the analyzer or field parameter overrides this value. + /// If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - RouteValues.Optional("index", index); - return Self; + Instance.Index = value; + return this; } - private string? AnalyzerValue { get; set; } - private ICollection? AttributesValue { get; set; } - private ICollection? CharFilterValue { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private string? NormalizerValue { get; set; } - private ICollection? TextValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.ITokenizer? TokenizerValue { get; set; } - /// /// /// The name of the analyzer that should be applied to the provided text. /// This could be a built-in analyzer, or an analyzer that’s been configured in the index. /// /// - public AnalyzeIndexRequestDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -207,10 +322,32 @@ public AnalyzeIndexRequestDescriptor Analyzer(string? analyzer) /// Array of token attributes used to filter the output of the explain parameter. /// /// - public AnalyzeIndexRequestDescriptor Attributes(ICollection? attributes) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Attributes(System.Collections.Generic.ICollection? value) { - AttributesValue = attributes; - return Self; + Instance.Attributes = value; + return this; + } + + /// + /// + /// Array of token attributes used to filter the output of the explain parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Attributes(params string[] values) + { + Instance.Attributes = [.. values]; + return this; + } + + /// + /// + /// Array of character filters used to preprocess characters before the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(System.Collections.Generic.ICollection? value) + { + Instance.CharFilter = value; + return this; } /// @@ -218,10 +355,27 @@ public AnalyzeIndexRequestDescriptor Attributes(ICollection? /// Array of character filters used to preprocess characters before the tokenizer. /// /// - public AnalyzeIndexRequestDescriptor CharFilter(ICollection? charFilter) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(params Elastic.Clients.Elasticsearch.Analysis.ICharFilter[] values) { - CharFilterValue = charFilter; - return Self; + Instance.CharFilter = [.. values]; + return this; + } + + /// + /// + /// Array of character filters used to preprocess characters before the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Analysis.CharFilterFactory.Build(action)); + } + + Instance.CharFilter = items; + return this; } /// @@ -229,10 +383,10 @@ public AnalyzeIndexRequestDescriptor CharFilter(ICollectiontrue, the response includes token attributes and additional details. /// /// - public AnalyzeIndexRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -242,10 +396,10 @@ public AnalyzeIndexRequestDescriptor Explain(bool? explain = true) /// If specified, the analyzer parameter overrides this value. /// /// - public AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -255,23 +409,21 @@ public AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsea /// If specified, the analyzer parameter overrides this value. /// /// - public AnalyzeIndexRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field used to derive the analyzer. - /// To use this parameter, you must specify an index. - /// If specified, the analyzer parameter overrides this value. + /// Array of token filters used to apply after the tokenizer. /// /// - public AnalyzeIndexRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -279,10 +431,27 @@ public AnalyzeIndexRequestDescriptor Field(Expression /// - public AnalyzeIndexRequestDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(params Elastic.Clients.Elasticsearch.Analysis.ITokenFilter[] values) { - FilterValue = filter; - return Self; + Instance.Filter = [.. values]; + return this; + } + + /// + /// + /// Array of token filters used to apply after the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Analysis.TokenFilterFactory.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -290,10 +459,22 @@ public AnalyzeIndexRequestDescriptor Filter(ICollection /// - public AnalyzeIndexRequestDescriptor Normalizer(string? normalizer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Normalizer(string? value) + { + Instance.Normalizer = value; + return this; + } + + /// + /// + /// Text to analyze. + /// If an array of strings is provided, it is analyzed as a multi-value field. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Text(System.Collections.Generic.ICollection? value) { - NormalizerValue = normalizer; - return Self; + Instance.Text = value; + return this; } /// @@ -302,10 +483,10 @@ public AnalyzeIndexRequestDescriptor Normalizer(string? normalizer) /// If an array of strings is provided, it is analyzed as a multi-value field. /// /// - public AnalyzeIndexRequestDescriptor Text(ICollection? text) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Text(params string[] values) { - TextValue = text; - return Self; + Instance.Text = [.. values]; + return this; } /// @@ -313,70 +494,76 @@ public AnalyzeIndexRequestDescriptor Text(ICollection? text) /// Tokenizer to use to convert text into tokens. /// /// - public AnalyzeIndexRequestDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? tokenizer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? value) { - TokenizerValue = tokenizer; - return Self; + Instance.Tokenizer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Tokenizer to use to convert text into tokens. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Tokenizer(System.Func action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } + Instance.Tokenizer = Elastic.Clients.Elasticsearch.Analysis.TokenizerFactory.Build(action); + return this; + } - if (AttributesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("attributes"); - JsonSerializer.Serialize(writer, AttributesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CharFilterValue is not null) - { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFilterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(NormalizerValue)) - { - writer.WritePropertyName("normalizer"); - writer.WriteStringValue(NormalizerValue); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TextValue is not null) - { - writer.WritePropertyName("text"); - SingleOrManySerializationHelper.Serialize(TextValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TokenizerValue is not null) - { - writer.WritePropertyName("tokenizer"); - JsonSerializer.Serialize(writer, TokenizerValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -392,52 +579,63 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The _analyze endpoint without a specified index will always use 10000 as its limit. /// /// -public sealed partial class AnalyzeIndexRequestDescriptor : RequestDescriptor +public readonly partial struct AnalyzeIndexRequestDescriptor { - internal AnalyzeIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest Instance { get; init; } - public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest instance) { + Instance = instance; } - public AnalyzeIndexRequestDescriptor() + public AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementAnalyze; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public AnalyzeIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(typeof(TDocument)); + } - internal override string OperationName => "indices.analyze"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor descriptor) => descriptor.Instance; - public AnalyzeIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// Index used to derive the analyzer. + /// If specified, the analyzer or field parameter overrides this value. + /// If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - RouteValues.Optional("index", index); - return Self; + Instance.Index = value; + return this; } - private string? AnalyzerValue { get; set; } - private ICollection? AttributesValue { get; set; } - private ICollection? CharFilterValue { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private string? NormalizerValue { get; set; } - private ICollection? TextValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.ITokenizer? TokenizerValue { get; set; } - /// /// /// The name of the analyzer that should be applied to the provided text. /// This could be a built-in analyzer, or an analyzer that’s been configured in the index. /// /// - public AnalyzeIndexRequestDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// Array of token attributes used to filter the output of the explain parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Attributes(System.Collections.Generic.ICollection? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Attributes = value; + return this; } /// @@ -445,10 +643,10 @@ public AnalyzeIndexRequestDescriptor Analyzer(string? analyzer) /// Array of token attributes used to filter the output of the explain parameter. /// /// - public AnalyzeIndexRequestDescriptor Attributes(ICollection? attributes) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Attributes(params string[] values) { - AttributesValue = attributes; - return Self; + Instance.Attributes = [.. values]; + return this; } /// @@ -456,10 +654,38 @@ public AnalyzeIndexRequestDescriptor Attributes(ICollection? attributes) /// Array of character filters used to preprocess characters before the tokenizer. /// /// - public AnalyzeIndexRequestDescriptor CharFilter(ICollection? charFilter) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(System.Collections.Generic.ICollection? value) { - CharFilterValue = charFilter; - return Self; + Instance.CharFilter = value; + return this; + } + + /// + /// + /// Array of character filters used to preprocess characters before the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(params Elastic.Clients.Elasticsearch.Analysis.ICharFilter[] values) + { + Instance.CharFilter = [.. values]; + return this; + } + + /// + /// + /// Array of character filters used to preprocess characters before the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor CharFilter(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Analysis.CharFilterFactory.Build(action)); + } + + Instance.CharFilter = items; + return this; } /// @@ -467,10 +693,10 @@ public AnalyzeIndexRequestDescriptor CharFilter(ICollectiontrue, the response includes token attributes and additional details. /// /// - public AnalyzeIndexRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -480,10 +706,10 @@ public AnalyzeIndexRequestDescriptor Explain(bool? explain = true) /// If specified, the analyzer parameter overrides this value. /// /// - public AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -493,23 +719,32 @@ public AnalyzeIndexRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? /// If specified, the analyzer parameter overrides this value. /// /// - public AnalyzeIndexRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field used to derive the analyzer. - /// To use this parameter, you must specify an index. - /// If specified, the analyzer parameter overrides this value. + /// Array of token filters used to apply after the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(System.Collections.Generic.ICollection? value) + { + Instance.Filter = value; + return this; + } + + /// + /// + /// Array of token filters used to apply after the tokenizer. /// /// - public AnalyzeIndexRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(params Elastic.Clients.Elasticsearch.Analysis.ITokenFilter[] values) { - FieldValue = field; - return Self; + Instance.Filter = [.. values]; + return this; } /// @@ -517,10 +752,16 @@ public AnalyzeIndexRequestDescriptor Field(Expression /// - public AnalyzeIndexRequestDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Filter(params System.Func[] actions) { - FilterValue = filter; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Analysis.TokenFilterFactory.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -528,10 +769,10 @@ public AnalyzeIndexRequestDescriptor Filter(ICollection /// - public AnalyzeIndexRequestDescriptor Normalizer(string? normalizer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Normalizer(string? value) { - NormalizerValue = normalizer; - return Self; + Instance.Normalizer = value; + return this; } /// @@ -540,10 +781,22 @@ public AnalyzeIndexRequestDescriptor Normalizer(string? normalizer) /// If an array of strings is provided, it is analyzed as a multi-value field. /// /// - public AnalyzeIndexRequestDescriptor Text(ICollection? text) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Text(System.Collections.Generic.ICollection? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; + } + + /// + /// + /// Text to analyze. + /// If an array of strings is provided, it is analyzed as a multi-value field. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Text(params string[] values) + { + Instance.Text = [.. values]; + return this; } /// @@ -551,69 +804,75 @@ public AnalyzeIndexRequestDescriptor Text(ICollection? text) /// Tokenizer to use to convert text into tokens. /// /// - public AnalyzeIndexRequestDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? tokenizer) + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? value) { - TokenizerValue = tokenizer; - return Self; + Instance.Tokenizer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Tokenizer to use to convert text into tokens. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Tokenizer(System.Func action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } + Instance.Tokenizer = Elastic.Clients.Elasticsearch.Analysis.TokenizerFactory.Build(action); + return this; + } - if (AttributesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("attributes"); - JsonSerializer.Serialize(writer, AttributesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CharFilterValue is not null) - { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFilterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(NormalizerValue)) - { - writer.WritePropertyName("normalizer"); - writer.WriteStringValue(NormalizerValue); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TextValue is not null) - { - writer.WritePropertyName("text"); - SingleOrManySerializationHelper.Serialize(TextValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TokenizerValue is not null) - { - writer.WritePropertyName("tokenizer"); - JsonSerializer.Serialize(writer, TokenizerValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexResponse.g.cs index 13b4f7e9f3a..d8ecae19a57 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/AnalyzeIndexResponse.g.cs @@ -17,19 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class AnalyzeIndexResponse : ElasticsearchResponse +internal sealed partial class AnalyzeIndexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetail = System.Text.Json.JsonEncodedText.Encode("detail"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetail = default; + LocalJsonValue?> propTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetail.TryReadProperty(ref reader, options, PropDetail, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Detail = propDetail.Value, + Tokens = propTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetail, value.Detail, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponseConverter))] +public sealed partial class AnalyzeIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("detail")] - public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetail? Detail { get; init; } - [JsonInclude, JsonPropertyName("tokens")] - public IReadOnlyCollection? Tokens { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzeIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyzeIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetail? Detail { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Tokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexRequest.g.cs new file mode 100644 index 00000000000..d58f0310545 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexRequest.g.cs @@ -0,0 +1,290 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +public sealed partial class CancelMigrateReindexRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class CancelMigrateReindexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +/// +/// +/// Cancel a migration reindex operation. +/// +/// +/// Cancel a migration reindex attempt for a data stream or index. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestConverter))] +public sealed partial class CancelMigrateReindexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + { + } +#if NET7_0_OR_GREATER + public CancelMigrateReindexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementCancelMigrateReindex; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "indices.cancel_migrate_reindex"; + + /// + /// + /// The index or data stream name + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } +} + +/// +/// +/// Cancel a migration reindex operation. +/// +/// +/// Cancel a migration reindex attempt for a data stream or index. +/// +/// +public readonly partial struct CancelMigrateReindexRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest instance) + { + Instance = instance; + } + + public CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(indices); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CancelMigrateReindexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Cancel a migration reindex operation. +/// +/// +/// Cancel a migration reindex attempt for a data stream or index. +/// +/// +public readonly partial struct CancelMigrateReindexRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest instance) + { + Instance = instance; + } + + public CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(indices); + } + + public CancelMigrateReindexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexResponse.g.cs new file mode 100644 index 00000000000..110b04b9db8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CancelMigrateReindexResponse.g.cs @@ -0,0 +1,89 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class CancelMigrateReindexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponseConverter))] +public sealed partial class CancelMigrateReindexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelMigrateReindexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CancelMigrateReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheRequest.g.cs index 344bcff4e50..c3728ef77fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ClearCacheRequestParameters : RequestParameters +public sealed partial class ClearCacheRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class ClearCacheRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -87,6 +80,35 @@ public sealed partial class ClearCacheRequestParameters : RequestParameters public bool? Request { get => Q("request"); set => Q("request", value); } } +internal sealed partial class ClearCacheRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Clear the cache. @@ -99,31 +121,51 @@ public sealed partial class ClearCacheRequestParameters : RequestParameters /// To clear the cache only of specific fields, use the fields parameter. /// /// -public sealed partial class ClearCacheRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestConverter))] +public sealed partial class ClearCacheRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public ClearCacheRequest() { } - - public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public ClearCacheRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClearCache; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementClearCache; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.clear_cache"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -134,8 +176,7 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -143,7 +184,6 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Use the fields parameter to clear the cache of specific fields only. /// /// - [JsonIgnore] public bool? Fielddata { get => Q("fielddata"); set => Q("fielddata", value); } /// @@ -151,7 +191,6 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Comma-separated list of field names used to limit the fielddata parameter. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } /// @@ -159,7 +198,6 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -167,7 +205,6 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// If true, clears the query cache. /// /// - [JsonIgnore] public bool? Query { get => Q("query"); set => Q("query", value); } /// @@ -175,7 +212,6 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// If true, clears the request cache. /// /// - [JsonIgnore] public bool? Request { get => Q("request"); set => Q("request", value); } } @@ -191,42 +227,202 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// To clear the cache only of specific fields, use the fields parameter. /// /// -public sealed partial class ClearCacheRequestDescriptor : RequestDescriptor, ClearCacheRequestParameters> +public readonly partial struct ClearCacheRequestDescriptor { - internal ClearCacheRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest Instance { get; init; } - public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest instance) { + Instance = instance; + } + + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(indices); } public ClearCacheRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClearCache; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.clear_cache"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public ClearCacheRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ClearCacheRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ClearCacheRequestDescriptor Fielddata(bool? fielddata = true) => Qs("fielddata", fielddata); - public ClearCacheRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public ClearCacheRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ClearCacheRequestDescriptor Query(bool? query = true) => Qs("query", query); - public ClearCacheRequestDescriptor Request(bool? request = true) => Qs("request", request); + /// + /// + /// If true, clears the fields cache. + /// Use the fields parameter to clear the cache of specific fields only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fielddata(bool? value = true) + { + Instance.Fielddata = value; + return this; + } + + /// + /// + /// Comma-separated list of field names used to limit the fielddata parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } - public ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Comma-separated list of field names used to limit the fielddata parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - RouteValues.Optional("index", indices); - return Self; + Instance.Fields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor IgnoreUnavailable(bool? value = true) { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, clears the query cache. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Query(bool? value = true) + { + Instance.Query = value; + return this; + } + + /// + /// + /// If true, clears the request cache. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Request(bool? value = true) + { + Instance.Request = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -242,41 +438,201 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// To clear the cache only of specific fields, use the fields parameter. /// /// -public sealed partial class ClearCacheRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCacheRequestDescriptor { - internal ClearCacheRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest Instance { get; init; } - public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest instance) { + Instance = instance; + } + + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(indices); } public ClearCacheRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClearCache; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.clear_cache"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ClearCacheRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ClearCacheRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ClearCacheRequestDescriptor Fielddata(bool? fielddata = true) => Qs("fielddata", fielddata); - public ClearCacheRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public ClearCacheRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ClearCacheRequestDescriptor Query(bool? query = true) => Qs("query", query); - public ClearCacheRequestDescriptor Request(bool? request = true) => Qs("request", request); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, clears the fields cache. + /// Use the fields parameter to clear the cache of specific fields only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fielddata(bool? value = true) + { + Instance.Fielddata = value; + return this; + } + + /// + /// + /// Comma-separated list of field names used to limit the fielddata parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list of field names used to limit the fielddata parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, clears the query cache. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Query(bool? value = true) + { + Instance.Query = value; + return this; + } + + /// + /// + /// If true, clears the request cache. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Request(bool? value = true) + { + Instance.Request = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheResponse.g.cs index 889431a5852..48ac535ff35 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ClearCacheResponse.g.cs @@ -17,17 +17,64 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ClearCacheResponse : ElasticsearchResponse +internal sealed partial class ClearCacheResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponseConverter))] +public sealed partial class ClearCacheResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexRequest.g.cs index f5366157ae8..27b141436c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CloneIndexRequestParameters : RequestParameters +public sealed partial class CloneIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,6 +50,54 @@ public sealed partial class CloneIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class CloneIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue?> propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Clone an index. @@ -148,27 +189,60 @@ public sealed partial class CloneIndexRequestParameters : RequestParameters /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. /// /// -public sealed partial class CloneIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestConverter))] +public sealed partial class CloneIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) : base(r => r.Required("index", index).Required("target", target)) { } +#if NET7_0_OR_GREATER + public CloneIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloneIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClone; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementClone; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.clone"; + /// + /// + /// Name of the source index to clone. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Name of the target index to create. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Target { get => P("target"); set => PR("target", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -177,7 +251,6 @@ public CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -186,7 +259,6 @@ public CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -194,16 +266,14 @@ public CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// Aliases for the resulting index. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// /// Configuration options for the target index. /// /// - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } } /// @@ -297,83 +367,276 @@ public CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. /// /// -public sealed partial class CloneIndexRequestDescriptor : RequestDescriptor, CloneIndexRequestParameters> +public readonly partial struct CloneIndexRequestDescriptor { - internal CloneIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest Instance { get; init; } - public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest instance) { + Instance = instance; } - public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Name target) : this(typeof(TDocument), target) + public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(index, target); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClone; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CloneIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the source index to clone. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "indices.clone"; + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Target = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public CloneIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CloneIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CloneIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } - public CloneIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - RouteValues.Required("index", index); - return Self; + Instance.Aliases = value; + return this; } - public CloneIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.Name target) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases() { - RouteValues.Required("target", target); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; } - private IDictionary> AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(System.Action? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } /// /// /// Aliases for the resulting index. /// /// - public CloneIndexRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(System.Action>? action) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; } /// /// - /// Configuration options for the target index. + /// Aliases for the resulting index. /// /// - public CloneIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) { - writer.WriteStartObject(); - if (AliasesValue is not null) + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + Instance.Aliases = items; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -468,78 +731,257 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. /// /// -public sealed partial class CloneIndexRequestDescriptor : RequestDescriptor +public readonly partial struct CloneIndexRequestDescriptor { - internal CloneIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest Instance { get; init; } - public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClone; + public CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(index, target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CloneIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.clone"; + /// + /// + /// Name of the source index to clone. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Target = value; + return this; + } - public CloneIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CloneIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CloneIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public CloneIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.Timeout = value; + return this; } - public CloneIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.Name target) + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) { - RouteValues.Required("target", target); - return Self; + Instance.WaitForActiveShards = value; + return this; } - private IDictionary AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } /// /// /// Aliases for the resulting index. /// /// - public CloneIndexRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases() { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; } /// /// - /// Configuration options for the target index. + /// Aliases for the resulting index. /// /// - public CloneIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(System.Action>? action) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } - if (SettingsValue is not null) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexResponse.g.cs index e4a02be3cea..f4386d96453 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloneIndexResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CloneIndexResponse : ElasticsearchResponse +internal sealed partial class CloneIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propIndex = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Index = propIndex.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponseConverter))] +public sealed partial class CloneIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloneIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexRequest.g.cs index e531c9a51b4..ee1ef2337fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CloseIndexRequestParameters : RequestParameters +public sealed partial class CloseIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class CloseIndexRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -82,6 +75,35 @@ public sealed partial class CloseIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class CloseIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Close an index. @@ -108,27 +130,49 @@ public sealed partial class CloseIndexRequestParameters : RequestParameters /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. /// /// -public sealed partial class CloseIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestConverter))] +public sealed partial class CloseIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public CloseIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClose; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementClose; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.close"; + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -139,15 +183,13 @@ public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -156,7 +198,6 @@ public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -165,7 +206,6 @@ public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -174,7 +214,6 @@ public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -204,41 +243,176 @@ public CloseIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. /// /// -public sealed partial class CloseIndexRequestDescriptor : RequestDescriptor, CloseIndexRequestParameters> +public readonly partial struct CloseIndexRequestDescriptor { - internal CloseIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest Instance { get; init; } - public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest instance) { + Instance = instance; } - public CloseIndexRequestDescriptor() : this(typeof(TDocument)) + public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClose; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CloseIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.close"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public CloseIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public CloseIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public CloseIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public CloseIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CloseIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CloseIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public CloseIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -268,36 +442,174 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. /// /// -public sealed partial class CloseIndexRequestDescriptor : RequestDescriptor +public readonly partial struct CloseIndexRequestDescriptor { - internal CloseIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest Instance { get; init; } - public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementClose; + public CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public CloseIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.close"; + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public CloseIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public CloseIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public CloseIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public CloseIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CloseIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CloseIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CloseIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexResponse.g.cs index 388a41401eb..b45a50c4227 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CloseIndexResponse.g.cs @@ -17,22 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CloseIndexResponse : ElasticsearchResponse +internal sealed partial class CloseIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("indices")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResult))] - public IReadOnlyDictionary Indices { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Indices = propIndices.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponseConverter))] +public sealed partial class CloseIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamRequest.g.cs index 1c318a40ef9..5b8333827a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CreateDataStreamRequestParameters : RequestParameters +public sealed partial class CreateDataStreamRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,33 +40,90 @@ public sealed partial class CreateDataStreamRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class CreateDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Create a data stream. -/// Creates a data stream. +/// +/// /// You must have a matching index template with data stream enabled. /// /// -public sealed partial class CreateDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestConverter))] +public sealed partial class CreateDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CreateDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamName name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public CreateDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementCreateDataStream; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementCreateDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "indices.create_data_stream"; + /// + /// + /// Name of the data stream, which must meet the following criteria: + /// Lowercase only; + /// Cannot include \, /, *, ?, ", <, >, |, ,, #, :, or a space character; + /// Cannot start with -, _, +, or .ds-; + /// Cannot be . or ..; + /// Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamName Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -81,43 +131,126 @@ public CreateDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamName name /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Create a data stream. -/// Creates a data stream. +/// +/// /// You must have a matching index template with data stream enabled. /// /// -public sealed partial class CreateDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct CreateDataStreamRequestDescriptor { - internal CreateDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest Instance { get; init; } - public CreateDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamName name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementCreateDataStream; + public CreateDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamName name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateDataStreamRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.create_data_stream"; + /// + /// + /// Name of the data stream, which must meet the following criteria: + /// Lowercase only; + /// Cannot include \, /, *, ?, ", <, >, |, ,, #, :, or a space character; + /// Cannot start with -, _, +, or .ds-; + /// Cannot be . or ..; + /// Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamName value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public CreateDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CreateDataStreamRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CreateDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamName name) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamResponse.g.cs index 8317bdb2da9..03ca087e8c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateDataStreamResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CreateDataStreamResponse : ElasticsearchResponse +internal sealed partial class CreateDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponseConverter))] +public sealed partial class CreateDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromRequest.g.cs new file mode 100644 index 00000000000..057c105e439 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromRequest.g.cs @@ -0,0 +1,366 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +public sealed partial class CreateFromRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class CreateFromRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { CreateFrom = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.CreateFrom, null); + } +} + +/// +/// +/// Create an index from a source index. +/// +/// +/// Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestConverter))] +public sealed partial class CreateFromRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromRequest(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest) : base(r => r.Required("source", source).Required("dest", dest)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromRequest(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom createFrom) : base(r => r.Required("source", source).Required("dest", dest)) + { + CreateFrom = createFrom; + } +#if NET7_0_OR_GREATER + public CreateFromRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateFromRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementCreateFrom; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "indices.create_from"; + + /// + /// + /// The destination index or data stream name + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Dest { get => P("dest"); set => PR("dest", value); } + + /// + /// + /// The source index or data stream name + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Source { get => P("source"); set => PR("source", value); } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom CreateFrom { get; set; } +} + +/// +/// +/// Create an index from a source index. +/// +/// +/// Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. +/// +/// +public readonly partial struct CreateFromRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest instance) + { + Instance = instance; + } + + public CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(source, dest); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateFromRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The destination index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Dest(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Dest = value; + return this; + } + + /// + /// + /// The source index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Source(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Source = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom value) + { + Instance.CreateFrom = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom() + { + Instance.CreateFrom = Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom(System.Action? action) + { + Instance.CreateFrom = Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom(System.Action>? action) + { + Instance.CreateFrom = Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Create an index from a source index. +/// +/// +/// Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values. +/// +/// +public readonly partial struct CreateFromRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest instance) + { + Instance = instance; + } + + public CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(source, dest); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateFromRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The destination index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Dest(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Dest = value; + return this; + } + + /// + /// + /// The source index or data stream name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Source(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Source = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom value) + { + Instance.CreateFrom = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom() + { + Instance.CreateFrom = Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor CreateFrom(System.Action>? action) + { + Instance.CreateFrom = Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromResponse.g.cs new file mode 100644 index 00000000000..2803a79929d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateFromResponse.g.cs @@ -0,0 +1,112 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class CreateFromResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propIndex = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Index = propIndex.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponseConverter))] +public sealed partial class CreateFromResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateFromResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs index fc291de27db..efb3c6b30c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CreateIndexRequestParameters : RequestParameters +public sealed partial class CreateIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,6 +50,63 @@ public sealed partial class CreateIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class CreateIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propMappings = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create an index. @@ -97,27 +147,49 @@ public sealed partial class CreateIndexRequestParameters : RequestParameters /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. /// /// -public sealed partial class CreateIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestConverter))] +public sealed partial class CreateIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public CreateIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementCreate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementCreate; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.create"; + /// + /// + /// Name of the index you wish to create. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -126,7 +198,6 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -135,7 +206,6 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -143,8 +213,7 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// Aliases for the index. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// @@ -168,7 +237,6 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// /// /// - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } /// @@ -176,7 +244,6 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// Configuration options for the index. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } } @@ -220,53 +287,175 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. /// /// -public sealed partial class CreateIndexRequestDescriptor : RequestDescriptor, CreateIndexRequestParameters> +public readonly partial struct CreateIndexRequestDescriptor { - internal CreateIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest Instance { get; init; } - public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest instance) { + Instance = instance; } - public CreateIndexRequestDescriptor() : this(typeof(TDocument)) + public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementCreate; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the index you wish to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "indices.create"; + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public CreateIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CreateIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CreateIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias.Build(null); + return this; + } - public CreateIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(System.Action? action) { - RouteValues.Required("index", index); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias.Build(action); + return this; } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.Name key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } /// /// /// Aliases for the index. /// /// - public CreateIndexRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.Name[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key, System.Action>? action) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } /// @@ -291,28 +480,94 @@ public CreateIndexRequestDescriptor Aliases(Func /// /// - public CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. If specified, this mapping can include: + /// + /// + /// + /// + /// Field names + /// + /// + /// + /// + /// Field data types + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public CreateIndexRequestDescriptor Mappings(Action> configure) + /// + /// + /// Mapping for fields in the index. If specified, this mapping can include: + /// + /// + /// + /// + /// Field names + /// + /// + /// + /// + /// Field data types + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings(System.Action? action) + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// Mapping for fields in the index. If specified, this mapping can include: + /// + /// + /// + /// + /// Field names + /// + /// + /// + /// + /// Field data types + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -320,72 +575,93 @@ public CreateIndexRequestDescriptor Mappings(Action /// - public CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public CreateIndexRequestDescriptor Settings(Action> configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings(System.Action>? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -429,49 +705,212 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. /// /// -public sealed partial class CreateIndexRequestDescriptor : RequestDescriptor +public readonly partial struct CreateIndexRequestDescriptor { - internal CreateIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest Instance { get; init; } - public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementCreate; + public CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public CreateIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(typeof(TDocument)); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.create"; + /// + /// + /// Name of the index you wish to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public CreateIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CreateIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CreateIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } - public CreateIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases() { - RouteValues.Required("index", index); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias.Build(null); + return this; } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } /// /// /// Aliases for the index. /// /// - public CreateIndexRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.Name key) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.Name[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.Name key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Mapping for fields in the index. If specified, this mapping can include: + /// + /// + /// + /// + /// Field names + /// + /// + /// + /// + /// Field data types + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.Mappings = value; + return this; + } + + /// + /// + /// Mapping for fields in the index. If specified, this mapping can include: + /// + /// + /// + /// + /// Field names + /// + /// + /// + /// + /// Field data types + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings() + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } /// @@ -496,28 +935,32 @@ public CreateIndexRequestDescriptor Aliases(Func /// /// - public CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Mappings(System.Action>? action) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public CreateIndexRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Settings = value; + return this; } - public CreateIndexRequestDescriptor Mappings(Action configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings() { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } /// @@ -525,71 +968,59 @@ public CreateIndexRequestDescriptor Mappings(Action /// - public CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Settings(System.Action>? action) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public CreateIndexRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest Build(System.Action> action) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public CreateIndexRequestDescriptor Settings(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor ErrorTrace(bool? value) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.FilterPath = value; + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexResponse.g.cs index 8a847b2e204..4ac85ea3eff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class CreateIndexResponse : ElasticsearchResponse +internal sealed partial class CreateIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propIndex = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Index = propIndex.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponseConverter))] +public sealed partial class CreateIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsRequest.g.cs index 91a722ceab5..7525ffbed1e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DataStreamsStatsRequestParameters : RequestParameters +public sealed partial class DataStreamsStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,78 +31,338 @@ public sealed partial class DataStreamsStatsRequestParameters : RequestParameter /// Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } +} + +internal sealed partial class DataStreamsStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get data stream stats. -/// Retrieves statistics for one or more data streams. +/// +/// +/// Get statistics for one or more data streams. /// /// -public sealed partial class DataStreamsStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestConverter))] +public sealed partial class DataStreamsStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.IndexName? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public DataStreamsStatsRequest() { } - - public DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.IndexName? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public DataStreamsStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDataStreamsStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDataStreamsStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.data_streams_stats"; + /// + /// + /// Comma-separated list of data streams used to limit the request. + /// Wildcard expressions (*) are supported. + /// To target all data streams in a cluster, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Name { get => P("name"); set => PO("name", value); } + /// /// /// Type of data stream that wildcard patterns can match. /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } } /// /// /// Get data stream stats. -/// Retrieves statistics for one or more data streams. +/// +/// +/// Get statistics for one or more data streams. /// /// -public sealed partial class DataStreamsStatsRequestDescriptor : RequestDescriptor +public readonly partial struct DataStreamsStatsRequestDescriptor { - internal DataStreamsStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest Instance { get; init; } - public DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest instance) { + Instance = instance; + } + + public DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(name); } public DataStreamsStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDataStreamsStats; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams used to limit the request. + /// Wildcard expressions (*) are supported. + /// To target all data streams in a cluster, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override string OperationName => "indices.data_streams_stats"; + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public DataStreamsStatsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Get data stream stats. +/// +/// +/// Get statistics for one or more data streams. +/// +/// +public readonly partial struct DataStreamsStatsRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest instance) + { + Instance = instance; + } + + public DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(name); + } + + public DataStreamsStatsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Comma-separated list of data streams used to limit the request. + /// Wildcard expressions (*) are supported. + /// To target all data streams in a cluster, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DataStreamsStatsRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName? name) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsResponse.g.cs index e4b9e962207..d35dcd288d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DataStreamsStatsResponse.g.cs @@ -17,56 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DataStreamsStatsResponse : ElasticsearchResponse +internal sealed partial class DataStreamsStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackingIndices = System.Text.Json.JsonEncodedText.Encode("backing_indices"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreamCount = System.Text.Json.JsonEncodedText.Encode("data_stream_count"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropTotalStoreSizeBytes = System.Text.Json.JsonEncodedText.Encode("total_store_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalStoreSizes = System.Text.Json.JsonEncodedText.Encode("total_store_sizes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackingIndices = default; + LocalJsonValue propDataStreamCount = default; + LocalJsonValue> propDataStreams = default; + LocalJsonValue propShards = default; + LocalJsonValue propTotalStoreSizeBytes = default; + LocalJsonValue propTotalStoreSizes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackingIndices.TryReadProperty(ref reader, options, PropBackingIndices, null)) + { + continue; + } + + if (propDataStreamCount.TryReadProperty(ref reader, options, PropDataStreamCount, null)) + { + continue; + } + + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propTotalStoreSizeBytes.TryReadProperty(ref reader, options, PropTotalStoreSizeBytes, null)) + { + continue; + } + + if (propTotalStoreSizes.TryReadProperty(ref reader, options, PropTotalStoreSizes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackingIndices = propBackingIndices.Value, + DataStreamCount = propDataStreamCount.Value, + DataStreams = propDataStreams.Value, + Shards = propShards.Value, + TotalStoreSizeBytes = propTotalStoreSizeBytes.Value, + TotalStoreSizes = propTotalStoreSizes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackingIndices, value.BackingIndices, null, null); + writer.WriteProperty(options, PropDataStreamCount, value.DataStreamCount, null, null); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropTotalStoreSizeBytes, value.TotalStoreSizeBytes, null, null); + writer.WriteProperty(options, PropTotalStoreSizes, value.TotalStoreSizes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponseConverter))] +public sealed partial class DataStreamsStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamsStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of backing indices for the selected data streams. /// /// - [JsonInclude, JsonPropertyName("backing_indices")] - public int BackingIndices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int BackingIndices { get; set; } /// /// /// Total number of selected data streams. /// /// - [JsonInclude, JsonPropertyName("data_stream_count")] - public int DataStreamCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataStreamCount { get; set; } /// /// /// Contains statistics for the selected data streams. /// /// - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } /// /// /// Contains information about shards that attempted to execute the request. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } /// /// /// Total size, in bytes, of all shards for the selected data streams. /// /// - [JsonInclude, JsonPropertyName("total_store_size_bytes")] - public long TotalStoreSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalStoreSizeBytes { get; set; } /// /// @@ -74,6 +182,5 @@ public sealed partial class DataStreamsStatsResponse : ElasticsearchResponse /// This property is included only if the human query parameter is true /// /// - [JsonInclude, JsonPropertyName("total_store_sizes")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalStoreSizes { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalStoreSizes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasRequest.g.cs index 588bc1ad8f5..f7d3f34dde9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteAliasRequestParameters : RequestParameters +public sealed partial class DeleteAliasRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,33 +42,97 @@ public sealed partial class DeleteAliasRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteAliasRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an alias. /// Removes a data stream or index from an alias. /// /// -public sealed partial class DeleteAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestConverter))] +public sealed partial class DeleteAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("index", indices).Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDeleteAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// Comma-separated list of aliases to remove. + /// Supports wildcards (*). To remove all aliases, use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -84,7 +141,6 @@ public DeleteAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -94,43 +150,126 @@ public DeleteAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic /// Removes a data stream or index from an alias. /// /// -public sealed partial class DeleteAliasRequestDescriptor : RequestDescriptor, DeleteAliasRequestParameters> +public readonly partial struct DeleteAliasRequestDescriptor { - internal DeleteAliasRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest Instance { get; init; } - public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest instance) { + Instance = instance; } - public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : this(typeof(TDocument), name) + public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(indices, name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteAlias; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.delete_alias"; + /// + /// + /// Comma-separated list of aliases to remove. + /// Supports wildcards (*). To remove all aliases, use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } - public DeleteAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public DeleteAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Timeout = value; + return this; } - public DeleteAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest Build(System.Action action) { - RouteValues.Required("name", name); - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -140,38 +279,125 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Removes a data stream or index from an alias. /// /// -public sealed partial class DeleteAliasRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteAliasRequestDescriptor { - internal DeleteAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest Instance { get; init; } - public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteAlias; + public DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(indices, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.delete_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public DeleteAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Comma-separated list of aliases to remove. + /// Supports wildcards (*). To remove all aliases, use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasResponse.g.cs index ae5ec7e2278..1f03b6ee571 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteAliasResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteAliasResponse : ElasticsearchResponse +internal sealed partial class DeleteAliasResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponseConverter))] +public sealed partial class DeleteAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleRequest.g.cs index 0a961381c9e..00500f10e51 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleRequest.g.cs @@ -17,27 +17,20 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteDataLifecycleRequestParameters : RequestParameters +public sealed partial class DeleteDataLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// /// Whether wildcard expressions should get expanded to open or closed indices (default: open) /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -54,40 +47,90 @@ public sealed partial class DeleteDataLifecycleRequestParameters : RequestParame public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteDataLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete data stream lifecycles. /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. /// /// -public sealed partial class DeleteDataLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestConverter))] +public sealed partial class DeleteDataLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteDataLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteDataLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDeleteDataLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete_data_lifecycle"; + /// + /// + /// A comma-separated list of data streams of which the data stream lifecycle will be deleted; use * to get all data streams + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamNames Name { get => P("name"); set => PR("name", value); } + /// /// /// Whether wildcard expressions should get expanded to open or closed indices (default: open) /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Specify timeout for connection to master /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -95,7 +138,6 @@ public DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames /// Explicit timestamp for the document /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -105,33 +147,132 @@ public DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. /// /// -public sealed partial class DeleteDataLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteDataLifecycleRequestDescriptor { - internal DeleteDataLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest Instance { get; init; } - public DeleteDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteDataLifecycle; + public DeleteDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteDataLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.delete_data_lifecycle"; + /// + /// + /// A comma-separated list of data streams of which the data stream lifecycle will be deleted; use * to get all data streams + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Whether wildcard expressions should get expanded to open or closed indices (default: open) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public DeleteDataLifecycleRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteDataLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Whether wildcard expressions should get expanded to open or closed indices (default: open) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Specify timeout for connection to master + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Explicit timestamp for the document + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames name) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleResponse.g.cs index f9d2038fc50..e0ceb41957c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteDataLifecycleResponse : ElasticsearchResponse +internal sealed partial class DeleteDataLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponseConverter))] +public sealed partial class DeleteDataLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamRequest.g.cs index 80fccc1863f..8b27bcf4397 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamRequest.g.cs @@ -17,27 +17,20 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteDataStreamRequestParameters : RequestParameters +public sealed partial class DeleteDataStreamRequestParameters : Elastic.Transport.RequestParameters { /// /// /// Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -47,40 +40,90 @@ public sealed partial class DeleteDataStreamRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class DeleteDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete data streams. /// Deletes one or more data streams and their backing indices. /// /// -public sealed partial class DeleteDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestConverter))] +public sealed partial class DeleteDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteDataStream; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDeleteDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete_data_stream"; + /// + /// + /// Comma-separated list of data streams to delete. Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamNames Name { get => P("name"); set => PR("name", value); } + /// /// /// Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -90,32 +133,121 @@ public DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// Deletes one or more data streams and their backing indices. /// /// -public sealed partial class DeleteDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteDataStreamRequestDescriptor { - internal DeleteDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest Instance { get; init; } - public DeleteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteDataStream; + public DeleteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteDataStreamRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.delete_data_stream"; + /// + /// + /// Comma-separated list of data streams to delete. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DeleteDataStreamRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames name) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamResponse.g.cs index fbecc62a90f..082d2254028 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteDataStreamResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteDataStreamResponse : ElasticsearchResponse +internal sealed partial class DeleteDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponseConverter))] +public sealed partial class DeleteDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexRequest.g.cs index 9e2fde6fe70..e520feba365 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteIndexRequestParameters : RequestParameters +public sealed partial class DeleteIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class DeleteIndexRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -74,6 +67,35 @@ public sealed partial class DeleteIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete indices. @@ -86,27 +108,52 @@ public sealed partial class DeleteIndexRequestParameters : RequestParameters /// You can then use the delete index API to delete the previous write index. /// /// -public sealed partial class DeleteIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestConverter))] +public sealed partial class DeleteIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public DeleteIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete"; + /// + /// + /// Comma-separated list of indices to delete. + /// You cannot specify index aliases. + /// By default, this parameter does not support wildcards (*) or _all. + /// To use wildcards or _all, set the action.destructive_requires_name cluster setting to false. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -117,15 +164,13 @@ public DeleteIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base( /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -134,7 +179,6 @@ public DeleteIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base( /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -143,7 +187,6 @@ public DeleteIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base( /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -159,40 +202,167 @@ public DeleteIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base( /// You can then use the delete index API to delete the previous write index. /// /// -public sealed partial class DeleteIndexRequestDescriptor : RequestDescriptor, DeleteIndexRequestParameters> +public readonly partial struct DeleteIndexRequestDescriptor { - internal DeleteIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest Instance { get; init; } - public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest instance) { + Instance = instance; } - public DeleteIndexRequestDescriptor() : this(typeof(TDocument)) + public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDelete; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of indices to delete. + /// You cannot specify index aliases. + /// By default, this parameter does not support wildcards (*) or _all. + /// To use wildcards or _all, set the action.destructive_requires_name cluster setting to false. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.delete"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DeleteIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DeleteIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DeleteIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -208,35 +378,165 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// You can then use the delete index API to delete the previous write index. /// /// -public sealed partial class DeleteIndexRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteIndexRequestDescriptor { - internal DeleteIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest instance) + { + Instance = instance; + } - public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + public DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDelete; + public DeleteIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(typeof(TDocument)); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of indices to delete. + /// You cannot specify index aliases. + /// By default, this parameter does not support wildcards (*) or _all. + /// To use wildcards or _all, set the action.destructive_requires_name cluster setting to false. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.delete"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public DeleteIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DeleteIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DeleteIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DeleteIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexResponse.g.cs index 1462583eece..cff1f032dfe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexResponse.g.cs @@ -17,24 +17,83 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteIndexResponse : ElasticsearchResponse +internal sealed partial class DeleteIndexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponseConverter))] +public sealed partial class DeleteIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateRequest.g.cs index 196e97ac096..4499a366f63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteIndexTemplateRequestParameters : RequestParameters +public sealed partial class DeleteIndexTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,6 +40,35 @@ public sealed partial class DeleteIndexTemplateRequestParameters : RequestParame public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteIndexTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an index template. @@ -55,26 +77,48 @@ public sealed partial class DeleteIndexTemplateRequestParameters : RequestParame /// existing templates. /// /// -public sealed partial class DeleteIndexTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestConverter))] +public sealed partial class DeleteIndexTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteIndexTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteIndexTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDeleteIndexTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete_index_template"; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -82,7 +126,6 @@ public DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : ba /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -94,32 +137,110 @@ public DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : ba /// existing templates. /// /// -public sealed partial class DeleteIndexTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteIndexTemplateRequestDescriptor { - internal DeleteIndexTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest Instance { get; init; } - public DeleteIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteIndexTemplate; + public DeleteIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteIndexTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.delete_index_template"; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DeleteIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteIndexTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateResponse.g.cs index b80c8280abb..26b33dcdd3c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteIndexTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteIndexTemplateResponse : ElasticsearchResponse +internal sealed partial class DeleteIndexTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponseConverter))] +public sealed partial class DeleteIndexTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIndexTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateRequest.g.cs index 9636af46a91..f635a8a9deb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteTemplateRequestParameters : RequestParameters +public sealed partial class DeleteTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,32 +42,84 @@ public sealed partial class DeleteTemplateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a legacy index template. /// /// -public sealed partial class DeleteTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestConverter))] +public sealed partial class DeleteTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDeleteTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "indices.delete_template"; + /// + /// + /// The name of the legacy index template to delete. + /// Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -83,7 +128,6 @@ public DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -92,32 +136,113 @@ public DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// Delete a legacy index template. /// /// -public sealed partial class DeleteTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteTemplateRequestDescriptor { - internal DeleteTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest Instance { get; init; } - public DeleteTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDeleteTemplate; + public DeleteTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.delete_template"; + /// + /// + /// The name of the legacy index template to delete. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public DeleteTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateResponse.g.cs index a4129c54a7c..8406acc46b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DeleteTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DeleteTemplateResponse : ElasticsearchResponse +internal sealed partial class DeleteTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponseConverter))] +public sealed partial class DeleteTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageRequest.g.cs index b8a1b0e113d..60eb33ac732 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DiskUsageRequestParameters : RequestParameters +public sealed partial class DiskUsageRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class DiskUsageRequestParameters : RequestParameters /// Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -74,6 +67,35 @@ public sealed partial class DiskUsageRequestParameters : RequestParameters public bool? RunExpensiveTasks { get => Q("run_expensive_tasks"); set => Q("run_expensive_tasks", value); } } +internal sealed partial class DiskUsageRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Analyze the index disk usage. @@ -87,20 +109,44 @@ public sealed partial class DiskUsageRequestParameters : RequestParameters /// The stored size of the _id field is likely underestimated while the _source field is overestimated. /// /// -public sealed partial class DiskUsageRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestConverter))] +public sealed partial class DiskUsageRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public DiskUsageRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiskUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDiskUsage; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDiskUsage; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.disk_usage"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// It’s recommended to execute this API with a single index (or the latest backing index of a data stream) as the API consumes resources significantly. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -108,7 +154,6 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -118,8 +163,7 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -127,7 +171,6 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If false, the response may not include uncommitted data. /// /// - [JsonIgnore] public bool? Flush { get => Q("flush"); set => Q("flush", value); } /// @@ -135,7 +178,6 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -144,7 +186,6 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// To use the API, this parameter must be set to true. /// /// - [JsonIgnore] public bool? RunExpensiveTasks { get => Q("run_expensive_tasks"); set => Q("run_expensive_tasks", value); } } @@ -161,40 +202,164 @@ public DiskUsageRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// The stored size of the _id field is likely underestimated while the _source field is overestimated. /// /// -public sealed partial class DiskUsageRequestDescriptor : RequestDescriptor, DiskUsageRequestParameters> +public readonly partial struct DiskUsageRequestDescriptor { - internal DiskUsageRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest Instance { get; init; } - public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest instance) { + Instance = instance; } - public DiskUsageRequestDescriptor() : this(typeof(TDocument)) + public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDiskUsage; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DiskUsageRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// It’s recommended to execute this API with a single index (or the latest backing index of a data stream) as the API consumes resources significantly. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.disk_usage"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, the API performs a flush before analysis. + /// If false, the response may not include uncommitted data. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Flush(bool? value = true) + { + Instance.Flush = value; + return this; + } + + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Analyzing field disk usage is resource-intensive. + /// To use the API, this parameter must be set to true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RunExpensiveTasks(bool? value = true) + { + Instance.RunExpensiveTasks = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DiskUsageRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DiskUsageRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DiskUsageRequestDescriptor Flush(bool? flush = true) => Qs("flush", flush); - public DiskUsageRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DiskUsageRequestDescriptor RunExpensiveTasks(bool? runExpensiveTasks = true) => Qs("run_expensive_tasks", runExpensiveTasks); + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DiskUsageRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -211,35 +376,162 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The stored size of the _id field is likely underestimated while the _source field is overestimated. /// /// -public sealed partial class DiskUsageRequestDescriptor : RequestDescriptor +public readonly partial struct DiskUsageRequestDescriptor { - internal DiskUsageRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest Instance { get; init; } - public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDiskUsage; + public DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public DiskUsageRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.disk_usage"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// It’s recommended to execute this API with a single index (or the latest backing index of a data stream) as the API consumes resources significantly. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public DiskUsageRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public DiskUsageRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public DiskUsageRequestDescriptor Flush(bool? flush = true) => Qs("flush", flush); - public DiskUsageRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public DiskUsageRequestDescriptor RunExpensiveTasks(bool? runExpensiveTasks = true) => Qs("run_expensive_tasks", runExpensiveTasks); + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, the API performs a flush before analysis. + /// If false, the response may not include uncommitted data. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Flush(bool? value = true) + { + Instance.Flush = value; + return this; + } + + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Analyzing field disk usage is resource-intensive. + /// To use the API, this parameter must be set to true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RunExpensiveTasks(bool? value = true) + { + Instance.RunExpensiveTasks = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DiskUsageRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageResponse.g.cs index 5f5bc40839c..13d6ae3e918 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DiskUsageResponse.g.cs @@ -17,15 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DiskUsageResponse : ElasticsearchResponse +internal sealed partial class DiskUsageResponseConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { DiskUsage = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.DiskUsage, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponseConverter))] +public sealed partial class DiskUsageResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskUsageResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiskUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +object DiskUsage { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs index 0685bdc4ac9..0a1963b61b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleRequest.g.cs @@ -17,21 +17,27 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DownsampleRequestParameters : RequestParameters +public sealed partial class DownsampleRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DownsampleRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Config = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Config, null); + } } /// @@ -47,27 +53,65 @@ public sealed partial class DownsampleRequestParameters : RequestParameters /// The source index must be read only (index.blocks.write: true). /// /// -public sealed partial class DownsampleRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestConverter))] +public sealed partial class DownsampleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DownsampleRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) : base(r => r.Required("index", index).Required("target_index", targetIndex)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDownsample; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) : base(r => r.Required("index", index).Required("target_index", targetIndex)) + { + Config = config; + } +#if NET7_0_OR_GREATER + public DownsampleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DownsampleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementDownsample; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "indices.downsample"; - [JsonIgnore] - public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Config { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Config, options); - } + /// + /// + /// Name of the time series index to downsample. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Name of the index to create. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName TargetIndex { get => P("target_index"); set => PR("target_index", value); } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Config { get; set; } } /// @@ -83,62 +127,114 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// The source index must be read only (index.blocks.write: true). /// /// -public sealed partial class DownsampleRequestDescriptor : RequestDescriptor, DownsampleRequestParameters> +public readonly partial struct DownsampleRequestDescriptor { - internal DownsampleRequestDescriptor(Action> configure) => configure.Invoke(this); - public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) : base(r => r.Required("index", index).Required("target_index", targetIndex)) => ConfigValue = config; + internal Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDownsample; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(index, targetIndex); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DownsampleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "indices.downsample"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Name of the time series index to downsample. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Name of the index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.TargetIndex = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig value) + { + Instance.Config = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Config(System.Action action) + { + Instance.Config = Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor.Build(action); + return this; + } - public DownsampleRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest Build(System.Action action) { - RouteValues.Required("index", index); - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public DownsampleRequestDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName targetIndex) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Required("target_index", targetIndex); - return Self; + Instance.ErrorTrace = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor ConfigDescriptor { get; set; } - private Action ConfigDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Pretty(bool? value) { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; + Instance.Pretty = value; + return this; } - public DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor SourceQueryString(string? value) { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public DownsampleRequestDescriptor Config(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, ConfigValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -155,61 +251,113 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The source index must be read only (index.blocks.write: true). /// /// -public sealed partial class DownsampleRequestDescriptor : RequestDescriptor +public readonly partial struct DownsampleRequestDescriptor { - internal DownsampleRequestDescriptor(Action configure) => configure.Invoke(this); - public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) : base(r => r.Required("index", index).Required("target_index", targetIndex)) => ConfigValue = config; + internal Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementDownsample; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(index, targetIndex); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DownsampleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "indices.downsample"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor descriptor) => descriptor.Instance; - public DownsampleRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Name of the time series index to downsample. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - RouteValues.Required("index", index); - return Self; + Instance.Index = value; + return this; } - public DownsampleRequestDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName targetIndex) + /// + /// + /// Name of the index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName value) { - RouteValues.Required("target_index", targetIndex); - return Self; + Instance.TargetIndex = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor ConfigDescriptor { get; set; } - private Action ConfigDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig value) + { + Instance.Config = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Config(System.Action action) + { + Instance.Config = Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor Pretty(bool? value) { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; + Instance.Pretty = value; + return this; } - public DownsampleRequestDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor SourceQueryString(string? value) { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public DownsampleRequestDescriptor Config(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, ConfigValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleResponse.g.cs index e348e886329..b99be66c11f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/DownsampleResponse.g.cs @@ -17,15 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class DownsampleResponse : ElasticsearchResponse +internal sealed partial class DownsampleResponseConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Result, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponseConverter))] +public sealed partial class DownsampleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DownsampleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +object Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasRequest.g.cs index 497533fe195..36523580b09 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsAliasRequestParameters : RequestParameters +public sealed partial class ExistsAliasRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class ExistsAliasRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -56,39 +49,109 @@ public sealed partial class ExistsAliasRequestParameters : RequestParameters /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class ExistsAliasRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Check aliases. -/// Checks if one or more data stream or index aliases exist. +/// +/// +/// Check if one or more data stream or index aliases exist. /// /// -public sealed partial class ExistsAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestConverter))] +public sealed partial class ExistsAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsAliasRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Optional("index", indices).Required("name", name)) { } +#if NET7_0_OR_GREATER + public ExistsAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementExistsAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "indices.exists_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + + /// + /// + /// Comma-separated list of aliases to check. Supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -99,108 +162,368 @@ public ExistsAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elasti /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, requests that include a missing data stream or index in the target indices or data streams return an error. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Check aliases. -/// Checks if one or more data stream or index aliases exist. +/// +/// +/// Check if one or more data stream or index aliases exist. /// /// -public sealed partial class ExistsAliasRequestDescriptor : RequestDescriptor, ExistsAliasRequestParameters> +public readonly partial struct ExistsAliasRequestDescriptor { - internal ExistsAliasRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest Instance { get; init; } - public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Optional("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest instance) { + Instance = instance; } - public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsAlias; + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(indices, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.exists_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// Comma-separated list of aliases to check. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, requests that include a missing data stream or index in the target indices or data streams return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public ExistsAliasRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ExistsAliasRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ExistsAliasRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ExistsAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.ErrorTrace = value; + return this; } - public ExistsAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Required("name", name); - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Human(bool? value) { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Check aliases. -/// Checks if one or more data stream or index aliases exist. +/// +/// +/// Check if one or more data stream or index aliases exist. /// /// -public sealed partial class ExistsAliasRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsAliasRequestDescriptor { - internal ExistsAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest Instance { get; init; } - public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Optional("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest instance) { + Instance = instance; } - public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsAlias; + public ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(indices, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.exists_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - public ExistsAliasRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ExistsAliasRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ExistsAliasRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Comma-separated list of aliases to check. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, requests that include a missing data stream or index in the target indices or data streams return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ExistsAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public ExistsAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasResponse.g.cs index b3a7486f58f..2b90ad4157f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsAliasResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsAliasResponse : ElasticsearchResponse +internal sealed partial class ExistsAliasResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponseConverter))] +public sealed partial class ExistsAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateRequest.g.cs index 0fafea15669..4b4d689f780 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateRequest.g.cs @@ -17,21 +17,28 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsIndexTemplateRequestParameters : RequestParameters +public sealed partial class ExistsIndexTemplateRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// If true, returns settings in flat format. + /// + /// + public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public bool? Local { get => Q("local"); set => Q("local", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. @@ -40,66 +47,225 @@ public sealed partial class ExistsIndexTemplateRequestParameters : RequestParame public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class ExistsIndexTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check index templates. +/// +/// /// Check whether index templates exist. /// /// -public sealed partial class ExistsIndexTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestConverter))] +public sealed partial class ExistsIndexTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ExistsIndexTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsIndexTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementExistsIndexTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "indices.exists_index_template"; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public bool? Local { get => Q("local"); set => Q("local", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Check index templates. +/// +/// /// Check whether index templates exist. /// /// -public sealed partial class ExistsIndexTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsIndexTemplateRequestDescriptor { - internal ExistsIndexTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest instance) + { + Instance = instance; + } - public ExistsIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + public ExistsIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsIndexTemplate; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsIndexTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.exists_index_template"; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ExistsIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExistsIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateResponse.g.cs index 0ba3b979027..fa6cf02c5ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsIndexTemplateResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsIndexTemplateResponse : ElasticsearchResponse +internal sealed partial class ExistsIndexTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponseConverter))] +public sealed partial class ExistsIndexTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsIndexTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsRequest.g.cs index 0d37ec92318..0388a793b6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsRequestParameters : RequestParameters +public sealed partial class ExistsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class ExistsRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -79,33 +72,84 @@ public sealed partial class ExistsRequestParameters : RequestParameters public bool? Local { get => Q("local"); set => Q("local", value); } } +internal sealed partial class ExistsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check indices. /// Check if one or more indices, index aliases, or data streams exist. /// /// -public sealed partial class ExistsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestConverter))] +public sealed partial class ExistsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public ExistsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExists; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementExists; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "indices.exists"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases. Supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -116,15 +160,13 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -132,7 +174,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -140,7 +181,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// If true, return all default settings in the response. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -148,7 +188,6 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// If true, the request retrieves information from the local node only. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } } @@ -158,41 +197,173 @@ public ExistsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => /// Check if one or more indices, index aliases, or data streams exist. /// /// -public sealed partial class ExistsRequestDescriptor : RequestDescriptor, ExistsRequestParameters> +public readonly partial struct ExistsRequestDescriptor { - internal ExistsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest Instance { get; init; } - public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest instance) { + Instance = instance; } - public ExistsRequestDescriptor() : this(typeof(TDocument)) + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExists; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of data streams, indices, and aliases. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.exists"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public ExistsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ExistsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ExistsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public ExistsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ExistsRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public ExistsRequestDescriptor Local(bool? local = true) => Qs("local", local); + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public ExistsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -202,36 +373,171 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Check if one or more indices, index aliases, or data streams exist. /// /// -public sealed partial class ExistsRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsRequestDescriptor { - internal ExistsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest Instance { get; init; } - public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExists; + public ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + public ExistsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.exists"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } - public ExistsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ExistsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ExistsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public ExistsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ExistsRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public ExistsRequestDescriptor Local(bool? local = true) => Qs("local", local); + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExistsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsResponse.g.cs index 346d0d8ade9..9757005fe63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsResponse : ElasticsearchResponse +internal sealed partial class ExistsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponseConverter))] +public sealed partial class ExistsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateRequest.g.cs index de54274ac72..11bdd2b9903 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsTemplateRequestParameters : RequestParameters +public sealed partial class ExistsTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -56,6 +49,35 @@ public sealed partial class ExistsTemplateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class ExistsTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Check existence of index templates. @@ -66,26 +88,49 @@ public sealed partial class ExistsTemplateRequestParameters : RequestParameters /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. /// /// -public sealed partial class ExistsTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestConverter))] +public sealed partial class ExistsTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ExistsTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementExistsTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; internal override string OperationName => "indices.exists_template"; + /// + /// + /// A comma-separated list of index template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// Indicates whether to use a flat format for the response. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -93,7 +138,6 @@ public ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// Indicates whether to get information from the local node only. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -103,7 +147,6 @@ public ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -117,33 +160,124 @@ public ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. /// /// -public sealed partial class ExistsTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct ExistsTemplateRequestDescriptor { - internal ExistsTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest Instance { get; init; } - public ExistsTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExistsTemplate; + public ExistsTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExistsTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.exists_template"; + /// + /// + /// A comma-separated list of index template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Indicates whether to use a flat format for the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// Indicates whether to get information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ExistsTemplateRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public ExistsTemplateRequestDescriptor Local(bool? local = true) => Qs("local", local); - public ExistsTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExistsTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateResponse.g.cs index 20eeab8d7ab..43490f6eac4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExistsTemplateResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExistsTemplateResponse : ElasticsearchResponse +internal sealed partial class ExistsTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponseConverter))] +public sealed partial class ExistsTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleRequest.g.cs index 5eab5eca85d..9dfd3681075 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExplainDataLifecycleRequestParameters : RequestParameters +public sealed partial class ExplainDataLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,32 +40,83 @@ public sealed partial class ExplainDataLifecycleRequestParameters : RequestParam public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class ExplainDataLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the status for a data stream lifecycle. /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. /// /// -public sealed partial class ExplainDataLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestConverter))] +public sealed partial class ExplainDataLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public ExplainDataLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExplainDataLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementExplainDataLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.explain_data_lifecycle"; + /// + /// + /// The name of the index to explain + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// indicates if the API should return the default values the system uses for the index's lifecycle /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -80,7 +124,6 @@ public ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Indices indices /// Specify timeout for connection to master /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -90,37 +133,111 @@ public ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Indices indices /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. /// /// -public sealed partial class ExplainDataLifecycleRequestDescriptor : RequestDescriptor, ExplainDataLifecycleRequestParameters> +public readonly partial struct ExplainDataLifecycleRequestDescriptor { - internal ExplainDataLifecycleRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest Instance { get; init; } - public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest instance) { + Instance = instance; } - public ExplainDataLifecycleRequestDescriptor() : this(typeof(TDocument)) + public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExplainDataLifecycle; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExplainDataLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the index to explain + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.explain_data_lifecycle"; + /// + /// + /// indicates if the API should return the default values the system uses for the index's lifecycle + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// Specify timeout for connection to master + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ExplainDataLifecycleRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public ExplainDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExplainDataLifecycleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -130,32 +247,109 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. /// /// -public sealed partial class ExplainDataLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct ExplainDataLifecycleRequestDescriptor { - internal ExplainDataLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest Instance { get; init; } - public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementExplainDataLifecycle; + public ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public ExplainDataLifecycleRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.explain_data_lifecycle"; + /// + /// + /// The name of the index to explain + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// indicates if the API should return the default values the system uses for the index's lifecycle + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// Specify timeout for connection to master + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public ExplainDataLifecycleRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public ExplainDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExplainDataLifecycleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleResponse.g.cs index 8dfd1f29eeb..45623ce5591 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ExplainDataLifecycleResponse.g.cs @@ -17,18 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ExplainDataLifecycleResponse : ElasticsearchResponse +internal sealed partial class ExplainDataLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("indices")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleExplain))] - public IReadOnlyDictionary Indices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponseConverter))] +public sealed partial class ExplainDataLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsRequest.g.cs index 3d7957b2e4d..58b6e0921f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class FieldUsageStatsRequestParameters : RequestParameters +public sealed partial class FieldUsageStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class FieldUsageStatsRequestParameters : RequestParameters /// Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -63,30 +56,117 @@ public sealed partial class FieldUsageStatsRequestParameters : RequestParameters /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } +} + +internal sealed partial class FieldUsageStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +/// +/// +/// Get field usage stats. +/// Get field usage information for each shard and field of an index. +/// Field usage statistics are automatically captured when queries are running on a cluster. +/// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. +/// +/// +/// The response body reports the per-shard usage count of the data structures that back the fields in the index. +/// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestConverter))] +public sealed partial class FieldUsageStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + { + } +#if NET7_0_OR_GREATER + public FieldUsageStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementFieldUsageStats; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "indices.field_usage_stats"; + + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// /// - /// Period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. /// /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// Period to wait for a response. - /// If no response is received before the timeout expires, the request fails and returns an error. + /// Comma-separated list or wildcard expressions of fields to include in the statistics. /// /// - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } /// /// - /// The number of shard copies that must be active before proceeding with the operation. - /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// If true, missing or closed indices are not included in the response. /// /// - public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } + public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } /// @@ -101,19 +181,40 @@ public sealed partial class FieldUsageStatsRequestParameters : RequestParameters /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. /// /// -public sealed partial class FieldUsageStatsRequest : PlainRequest +public readonly partial struct FieldUsageStatsRequestDescriptor { - public FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + internal Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFieldUsageStats; + public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public FieldUsageStatsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.field_usage_stats"; + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } /// /// @@ -122,8 +223,11 @@ public FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] - public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } /// /// @@ -132,51 +236,107 @@ public FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } /// /// - /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } /// /// - /// If true, missing or closed indices are not included in the response. + /// Comma-separated list or wildcard expressions of fields to include in the statistics. /// /// - [JsonIgnore] - public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } /// /// - /// Period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. + /// Comma-separated list or wildcard expressions of fields to include in the statistics. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } /// /// - /// Period to wait for a response. - /// If no response is received before the timeout expires, the request fails and returns an error. + /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - /// - /// - /// The number of shard copies that must be active before proceeding with the operation. - /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). - /// - /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } } /// @@ -191,88 +351,159 @@ public FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. /// /// -public sealed partial class FieldUsageStatsRequestDescriptor : RequestDescriptor, FieldUsageStatsRequestParameters> +public readonly partial struct FieldUsageStatsRequestDescriptor { - internal FieldUsageStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest Instance { get; init; } - public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest instance) { + Instance = instance; } - public FieldUsageStatsRequestDescriptor() : this(typeof(TDocument)) + public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFieldUsageStats; + public FieldUsageStatsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(typeof(TDocument)); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expression of index names used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.field_usage_stats"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public FieldUsageStatsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FieldUsageStatsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FieldUsageStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public FieldUsageStatsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FieldUsageStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public FieldUsageStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FieldUsageStatsRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public FieldUsageStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Fields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { + Instance.Fields = value; + return this; } -} -/// -/// -/// Get field usage stats. -/// Get field usage information for each shard and field of an index. -/// Field usage statistics are automatically captured when queries are running on a cluster. -/// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. -/// -/// -/// The response body reports the per-shard usage count of the data structures that back the fields in the index. -/// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. -/// -/// -public sealed partial class FieldUsageStatsRequestDescriptor : RequestDescriptor -{ - internal FieldUsageStatsRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public FieldUsageStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest Build(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFieldUsageStats; + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "indices.field_usage_stats"; + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public FieldUsageStatsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FieldUsageStatsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FieldUsageStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public FieldUsageStatsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FieldUsageStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public FieldUsageStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FieldUsageStatsRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public FieldUsageStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsResponse.g.cs index f5e5ded303a..6665bfe081e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FieldUsageStatsResponse.g.cs @@ -17,17 +17,81 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class FieldUsageStatsResponse : ElasticsearchResponse +internal sealed partial class FieldUsageStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + System.Collections.Generic.Dictionary? propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + propStats ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsIndex value, null, null); + propStats[key] = value; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value, + Stats = propStats + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + if (value.Stats is not null) + { + foreach (var item in value.Stats) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponseConverter))] +public sealed partial class FieldUsageStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldUsageStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldUsageStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + + /// + /// + /// Per index statistics + /// + /// + public System.Collections.Generic.IReadOnlyDictionary? Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushRequest.g.cs index c11cb3fc5ee..267a9924b5f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class FlushRequestParameters : RequestParameters +public sealed partial class FlushRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class FlushRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -73,6 +66,35 @@ public sealed partial class FlushRequestParameters : RequestParameters public bool? WaitIfOngoing { get => Q("wait_if_ongoing"); set => Q("wait_if_ongoing", value); } } +internal sealed partial class FlushRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Flush data streams or indices. @@ -90,31 +112,51 @@ public sealed partial class FlushRequestParameters : RequestParameters /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. /// /// -public sealed partial class FlushRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestConverter))] +public sealed partial class FlushRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public FlushRequest() { } - - public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public FlushRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFlush; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementFlush; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.flush"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to flush. + /// Supports wildcards (*). + /// To flush all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -125,15 +167,13 @@ public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, the request forces a flush even if there are no changes to commit to the index. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -141,7 +181,6 @@ public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -150,7 +189,6 @@ public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If false, Elasticsearch returns an error if you request a flush when another flush operation is running. /// /// - [JsonIgnore] public bool? WaitIfOngoing { get => Q("wait_if_ongoing"); set => Q("wait_if_ongoing", value); } } @@ -171,40 +209,169 @@ public FlushRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. /// /// -public sealed partial class FlushRequestDescriptor : RequestDescriptor, FlushRequestParameters> +public readonly partial struct FlushRequestDescriptor { - internal FlushRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest Instance { get; init; } - public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest instance) { + Instance = instance; + } + + public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(indices); } public FlushRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFlush; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to flush. + /// Supports wildcards (*). + /// To flush all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.flush"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public FlushRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FlushRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FlushRequestDescriptor Force(bool? force = true) => Qs("force", force); - public FlushRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FlushRequestDescriptor WaitIfOngoing(bool? waitIfOngoing = true) => Qs("wait_if_ongoing", waitIfOngoing); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public FlushRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If true, the request forces a flush even if there are no changes to commit to the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Force(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.Force = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, the flush operation blocks until execution when another flush operation is running. + /// If false, Elasticsearch returns an error if you request a flush when another flush operation is running. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor WaitIfOngoing(bool? value = true) { + Instance.WaitIfOngoing = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -225,39 +392,168 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. /// /// -public sealed partial class FlushRequestDescriptor : RequestDescriptor +public readonly partial struct FlushRequestDescriptor { - internal FlushRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest instance) + { + Instance = instance; + } - public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public FlushRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(indices); } public FlushRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementFlush; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to flush. + /// Supports wildcards (*). + /// To flush all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.flush"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public FlushRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public FlushRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public FlushRequestDescriptor Force(bool? force = true) => Qs("force", force); - public FlushRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public FlushRequestDescriptor WaitIfOngoing(bool? waitIfOngoing = true) => Qs("wait_if_ongoing", waitIfOngoing); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, the request forces a flush even if there are no changes to commit to the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, the flush operation blocks until execution when another flush operation is running. + /// If false, Elasticsearch returns an error if you request a flush when another flush operation is running. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor WaitIfOngoing(bool? value = true) + { + Instance.WaitIfOngoing = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public FlushRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushResponse.g.cs index a65538aaae8..97bfbe6ca04 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/FlushResponse.g.cs @@ -17,17 +17,64 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class FlushResponse : ElasticsearchResponse +internal sealed partial class FlushResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FlushResponseConverter))] +public sealed partial class FlushResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlushResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeRequest.g.cs index d375c67ad88..3f35752dd7e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ForcemergeRequestParameters : RequestParameters +public sealed partial class ForcemergeRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -44,7 +37,7 @@ public sealed partial class ForcemergeRequestParameters : RequestParameters /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -82,6 +75,35 @@ public sealed partial class ForcemergeRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class ForcemergeRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Force a merge. @@ -167,30 +189,48 @@ public sealed partial class ForcemergeRequestParameters : RequestParameters /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 /// /// -public sealed partial class ForcemergeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestConverter))] +public sealed partial class ForcemergeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public ForcemergeRequest() { } - - public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public ForcemergeRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementForcemerge; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementForcemerge; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.forcemerge"; + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -198,15 +238,13 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Specify whether the index should be flushed after performing the operation (default: true) /// /// - [JsonIgnore] public bool? Flush { get => Q("flush"); set => Q("flush", value); } /// @@ -214,7 +252,6 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Whether specified concrete indices should be ignored when unavailable (missing or closed) /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -222,7 +259,6 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// The number of segments the index should be merged into (default: dynamic) /// /// - [JsonIgnore] public long? MaxNumSegments { get => Q("max_num_segments"); set => Q("max_num_segments", value); } /// @@ -230,7 +266,6 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Specify whether the operation should only expunge deleted documents /// /// - [JsonIgnore] public bool? OnlyExpungeDeletes { get => Q("only_expunge_deletes"); set => Q("only_expunge_deletes", value); } /// @@ -238,7 +273,6 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Should the request wait until the force merge is completed. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -327,42 +361,181 @@ public ForcemergeRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 /// /// -public sealed partial class ForcemergeRequestDescriptor : RequestDescriptor, ForcemergeRequestParameters> +public readonly partial struct ForcemergeRequestDescriptor { - internal ForcemergeRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest instance) + { + Instance = instance; + } - public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(indices); } public ForcemergeRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementForcemerge; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.forcemerge"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public ForcemergeRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ForcemergeRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ForcemergeRequestDescriptor Flush(bool? flush = true) => Qs("flush", flush); - public ForcemergeRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ForcemergeRequestDescriptor MaxNumSegments(long? maxNumSegments) => Qs("max_num_segments", maxNumSegments); - public ForcemergeRequestDescriptor OnlyExpungeDeletes(bool? onlyExpungeDeletes = true) => Qs("only_expunge_deletes", onlyExpungeDeletes); - public ForcemergeRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// Specify whether the index should be flushed after performing the operation (default: true) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Flush(bool? value = true) + { + Instance.Flush = value; + return this; + } - public ForcemergeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor IgnoreUnavailable(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The number of segments the index should be merged into (default: dynamic) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor MaxNumSegments(long? value) { + Instance.MaxNumSegments = value; + return this; + } + + /// + /// + /// Specify whether the operation should only expunge deleted documents + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor OnlyExpungeDeletes(bool? value = true) + { + Instance.OnlyExpungeDeletes = value; + return this; + } + + /// + /// + /// Should the request wait until the force merge is completed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -451,41 +624,180 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 /// /// -public sealed partial class ForcemergeRequestDescriptor : RequestDescriptor +public readonly partial struct ForcemergeRequestDescriptor { - internal ForcemergeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest instance) + { + Instance = instance; + } - public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(indices); } public ForcemergeRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementForcemerge; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.forcemerge"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ForcemergeRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ForcemergeRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ForcemergeRequestDescriptor Flush(bool? flush = true) => Qs("flush", flush); - public ForcemergeRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ForcemergeRequestDescriptor MaxNumSegments(long? maxNumSegments) => Qs("max_num_segments", maxNumSegments); - public ForcemergeRequestDescriptor OnlyExpungeDeletes(bool? onlyExpungeDeletes = true) => Qs("only_expunge_deletes", onlyExpungeDeletes); - public ForcemergeRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Specify whether the index should be flushed after performing the operation (default: true) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Flush(bool? value = true) + { + Instance.Flush = value; + return this; + } + + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// The number of segments the index should be merged into (default: dynamic) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor MaxNumSegments(long? value) + { + Instance.MaxNumSegments = value; + return this; + } + + /// + /// + /// Specify whether the operation should only expunge deleted documents + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor OnlyExpungeDeletes(bool? value = true) + { + Instance.OnlyExpungeDeletes = value; + return this; + } + + /// + /// + /// Should the request wait until the force merge is completed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ForcemergeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeResponse.g.cs index 31e852e84b8..1af7c2e37c2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ForcemergeResponse.g.cs @@ -17,19 +17,75 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ForcemergeResponse : ElasticsearchResponse +internal sealed partial class ForcemergeResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + LocalJsonValue propTask = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value, + Task = propTask.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponseConverter))] +public sealed partial class ForcemergeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForcemergeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForcemergeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } /// /// @@ -37,6 +93,5 @@ public sealed partial class ForcemergeResponse : ElasticsearchResponse /// you can use the task_id to get the status of the task at _tasks/<task_id> /// /// - [JsonInclude, JsonPropertyName("task")] - public string? Task { get; init; } + public string? Task { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasRequest.g.cs index dde2e261da7..179d8a53f9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetAliasRequestParameters : RequestParameters +public sealed partial class GetAliasRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class GetAliasRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -56,6 +49,43 @@ public sealed partial class GetAliasRequestParameters : RequestParameters /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class GetAliasRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -64,12 +94,9 @@ public sealed partial class GetAliasRequestParameters : RequestParameters /// Retrieves information for one or more data stream or index aliases. /// /// -public sealed partial class GetAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestConverter))] +public sealed partial class GetAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetAliasRequest() - { - } - public GetAliasRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) { } @@ -81,22 +108,54 @@ public GetAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.C public GetAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } +#if NET7_0_OR_GREATER + public GetAliasRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_alias"; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + + /// + /// + /// Comma-separated list of aliases to retrieve. + /// Supports wildcards (*). + /// To retrieve all aliases, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -107,16 +166,22 @@ public GetAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// @@ -125,44 +190,181 @@ public GetAliasRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Retrieves information for one or more data stream or index aliases. /// /// -public sealed partial class GetAliasRequestDescriptor : RequestDescriptor, GetAliasRequestParameters> +public readonly partial struct GetAliasRequestDescriptor { - internal GetAliasRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest Instance { get; init; } - public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("index", indices).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest instance) { + Instance = instance; + } + + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(name); + } + + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(indices, name); + } + + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(indices); } public GetAliasRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetAlias; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of aliases to retrieve. + /// Supports wildcards (*). + /// To retrieve all aliases, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.get_alias"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public GetAliasRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetAliasRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetAliasRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Human(bool? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.Human = value; + return this; } - public GetAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Pretty(bool? value) { - RouteValues.Optional("name", name); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -172,43 +374,180 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Retrieves information for one or more data stream or index aliases. /// /// -public sealed partial class GetAliasRequestDescriptor : RequestDescriptor +public readonly partial struct GetAliasRequestDescriptor { - internal GetAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest instance) + { + Instance = instance; + } + + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(name); + } + + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(indices, name); + } - public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("index", indices).Optional("name", name)) + public GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(indices); } public GetAliasRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetAlias; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams or indices used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of aliases to retrieve. + /// Supports wildcards (*). + /// To retrieve all aliases, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.get_alias"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public GetAliasRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetAliasRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetAliasRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasResponse.g.cs index 523c2d54832..0767eea0c1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetAliasResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetAliasResponse : DictionaryResponse +internal sealed partial class GetAliasResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetAliasResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Aliases = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetAliasResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Aliases, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponseConverter))] +public partial class GetAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Aliases { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleRequest.g.cs index 49f3058f361..baf82fd9bb7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataLifecycleRequestParameters : RequestParameters +public sealed partial class GetDataLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,7 +32,7 @@ public sealed partial class GetDataLifecycleRequestParameters : RequestParameter /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -56,26 +49,82 @@ public sealed partial class GetDataLifecycleRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetDataLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get data stream lifecycles. -/// Retrieves the data stream lifecycle configuration of one or more data streams. +/// +/// +/// Get the data stream lifecycle configuration of one or more data streams. /// /// -public sealed partial class GetDataLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestConverter))] +public sealed partial class GetDataLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public GetDataLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetDataLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_data_lifecycle"; + /// + /// + /// Comma-separated list of data streams to limit the request. + /// Supports wildcards (*). + /// To target all data streams, omit this parameter or use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamNames Name { get => P("name"); set => PR("name", value); } + /// /// /// Type of data stream that wildcard patterns can match. @@ -83,15 +132,13 @@ public GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, return all default settings in the response. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -99,43 +146,149 @@ public GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } /// /// /// Get data stream lifecycles. -/// Retrieves the data stream lifecycle configuration of one or more data streams. +/// +/// +/// Get the data stream lifecycle configuration of one or more data streams. /// /// -public sealed partial class GetDataLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct GetDataLifecycleRequestDescriptor { - internal GetDataLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest Instance { get; init; } - public GetDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataLifecycle; + public GetDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetDataLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.get_data_lifecycle"; + /// + /// + /// Comma-separated list of data streams to limit the request. + /// Supports wildcards (*). + /// To target all data streams, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public GetDataLifecycleRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetDataLifecycleRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleResponse.g.cs index 9fcbcfc0c5c..052d828a20e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataLifecycleResponse : ElasticsearchResponse +internal sealed partial class GetDataLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDataStreams = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreams = propDataStreams.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponseConverter))] +public sealed partial class GetDataLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsRequest.g.cs index edc0580d692..a6addc90a6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataLifecycleStatsRequestParameters : RequestParameters +public sealed partial class GetDataLifecycleStatsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetDataLifecycleStatsRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,11 +62,28 @@ public sealed partial class GetDataLifecycleStatsRequestParameters : RequestPara /// Get statistics about the data streams that are managed by a data stream lifecycle. /// /// -public sealed partial class GetDataLifecycleStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestConverter))] +public sealed partial class GetDataLifecycleStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataLifecycleStats; +#if NET7_0_OR_GREATER + public GetDataLifecycleStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetDataLifecycleStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetDataLifecycleStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -57,23 +96,76 @@ public sealed partial class GetDataLifecycleStatsRequest : PlainRequest /// -public sealed partial class GetDataLifecycleStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetDataLifecycleStatsRequestDescriptor { - internal GetDataLifecycleStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataLifecycleStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest instance) + { + Instance = instance; + } public GetDataLifecycleStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataLifecycleStats; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "indices.get_data_lifecycle_stats"; + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsResponse.g.cs index 53645820197..dba8e30ee07 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataLifecycleStatsResponse.g.cs @@ -17,40 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataLifecycleStatsResponse : ElasticsearchResponse +internal sealed partial class GetDataLifecycleStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataStreamCount = System.Text.Json.JsonEncodedText.Encode("data_stream_count"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropLastRunDurationInMillis = System.Text.Json.JsonEncodedText.Encode("last_run_duration_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimeBetweenStartsInMillis = System.Text.Json.JsonEncodedText.Encode("time_between_starts_in_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataStreamCount = default; + LocalJsonValue> propDataStreams = default; + LocalJsonValue propLastRunDurationInMillis = default; + LocalJsonValue propTimeBetweenStartsInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreamCount.TryReadProperty(ref reader, options, PropDataStreamCount, null)) + { + continue; + } + + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLastRunDurationInMillis.TryReadProperty(ref reader, options, PropLastRunDurationInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTimeBetweenStartsInMillis.TryReadProperty(ref reader, options, PropTimeBetweenStartsInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreamCount = propDataStreamCount.Value, + DataStreams = propDataStreams.Value, + LastRunDurationInMillis = propLastRunDurationInMillis.Value, + TimeBetweenStartsInMillis = propTimeBetweenStartsInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreamCount, value.DataStreamCount, null, null); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLastRunDurationInMillis, value.LastRunDurationInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTimeBetweenStartsInMillis, value.TimeBetweenStartsInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponseConverter))] +public sealed partial class GetDataLifecycleStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataLifecycleStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataLifecycleStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The count of data streams currently being managed by the data stream lifecycle. /// /// - [JsonInclude, JsonPropertyName("data_stream_count")] - public int DataStreamCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataStreamCount { get; set; } /// /// /// Information about the data streams that are managed by the data stream lifecycle. /// /// - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } /// /// /// The duration of the last data stream lifecycle execution. /// /// - [JsonInclude, JsonPropertyName("last_run_duration_in_millis")] - public long? LastRunDurationInMillis { get; init; } + public System.TimeSpan? LastRunDurationInMillis { get; set; } /// /// @@ -58,6 +138,5 @@ public sealed partial class GetDataLifecycleStatsResponse : ElasticsearchRespons /// This value should amount approximately to data_streams.lifecycle.poll_interval. /// /// - [JsonInclude, JsonPropertyName("time_between_starts_in_millis")] - public long? TimeBetweenStartsInMillis { get; init; } + public System.TimeSpan? TimeBetweenStartsInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamRequest.g.cs index ce6a1e7e754..1893e15081c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataStreamRequestParameters : RequestParameters +public sealed partial class GetDataStreamRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,7 +31,7 @@ public sealed partial class GetDataStreamRequestParameters : RequestParameters /// Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -62,45 +55,94 @@ public sealed partial class GetDataStreamRequestParameters : RequestParameters public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } +internal sealed partial class GetDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get data streams. -/// Retrieves information about one or more data streams. +/// +/// +/// Get information about one or more data streams. /// /// -public sealed partial class GetDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestConverter))] +public sealed partial class GetDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetDataStreamRequest() { } - - public GetDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataStream; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_data_stream"; + /// + /// + /// Comma-separated list of data stream names used to limit the request. + /// Wildcard (*) expressions are supported. If omitted, all data streams are returned. + /// + /// + public Elastic.Clients.Elasticsearch.DataStreamNames? Name { get => P("name"); set => PO("name", value); } + /// /// /// Type of data stream that wildcard patterns can match. /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, returns all relevant default configurations for the index template. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -108,7 +150,6 @@ public GetDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames? name) /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -116,48 +157,161 @@ public GetDataStreamRequest(Elastic.Clients.Elasticsearch.DataStreamNames? name) /// Whether the maximum timestamp for each data stream should be calculated and returned. /// /// - [JsonIgnore] public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } /// /// /// Get data streams. -/// Retrieves information about one or more data streams. +/// +/// +/// Get information about one or more data streams. /// /// -public sealed partial class GetDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct GetDataStreamRequestDescriptor { - internal GetDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest instance) + { + Instance = instance; + } - public GetDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames? name) : base(r => r.Optional("name", name)) + public GetDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames? name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(name); } public GetDataStreamRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetDataStream; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data stream names used to limit the request. + /// Wildcard (*) expressions are supported. If omitted, all data streams are returned. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override string OperationName => "indices.get_data_stream"; + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public GetDataStreamRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetDataStreamRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetDataStreamRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + /// + /// + /// If true, returns all relevant default configurations for the index template. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Whether the maximum timestamp for each data stream should be calculated and returned. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor Verbose(bool? value = true) + { + Instance.Verbose = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamResponse.g.cs index f6c1a882edf..f3177b46e90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetDataStreamResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetDataStreamResponse : ElasticsearchResponse +internal sealed partial class GetDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDataStreams = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreams = propDataStreams.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponseConverter))] +public sealed partial class GetDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingRequest.g.cs index 751c051c51c..cade1a7254e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetFieldMappingRequestParameters : RequestParameters +public sealed partial class GetFieldMappingRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class GetFieldMappingRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -72,6 +65,35 @@ public sealed partial class GetFieldMappingRequestParameters : RequestParameters public bool? Local { get => Q("local"); set => Q("local", value); } } +internal sealed partial class GetFieldMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get mapping definitions. @@ -82,31 +104,64 @@ public sealed partial class GetFieldMappingRequestParameters : RequestParameters /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. /// /// -public sealed partial class GetFieldMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestConverter))] +public sealed partial class GetFieldMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Required("fields", fields)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Optional("index", indices).Required("fields", fields)) { } +#if NET7_0_OR_GREATER + public GetFieldMappingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetFieldMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetFieldMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_field_mapping"; + /// + /// + /// Comma-separated list or wildcard expression of fields used to limit returned information. + /// Supports wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Fields { get => P("fields"); set => PR("fields", value); } + + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -117,15 +172,13 @@ public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices, El /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -133,7 +186,6 @@ public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices, El /// If true, return all default settings in the response. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -141,7 +193,6 @@ public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices, El /// If true, the request retrieves information from the local node only. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } } @@ -155,46 +206,193 @@ public GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices, El /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. /// /// -public sealed partial class GetFieldMappingRequestDescriptor : RequestDescriptor, GetFieldMappingRequestParameters> +public readonly partial struct GetFieldMappingRequestDescriptor { - internal GetFieldMappingRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest instance) + { + Instance = instance; + } - public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Optional("index", indices).Required("fields", fields)) + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Fields fields) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(fields); } - public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Required("fields", fields)) + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(indices, fields); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetFieldMapping; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetFieldMappingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expression of fields used to limit returned information. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) + { + Instance.Fields = value; + return this; + } - internal override string OperationName => "indices.get_field_mapping"; + /// + /// + /// Comma-separated list or wildcard expression of fields used to limit returned information. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetFieldMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetFieldMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetFieldMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetFieldMappingRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetFieldMappingRequestDescriptor Local(bool? local = true) => Qs("local", local); + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public GetFieldMappingRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Pretty(bool? value) { - RouteValues.Required("fields", fields); - return Self; + Instance.Pretty = value; + return this; } - public GetFieldMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -208,45 +406,192 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. /// /// -public sealed partial class GetFieldMappingRequestDescriptor : RequestDescriptor +public readonly partial struct GetFieldMappingRequestDescriptor { - internal GetFieldMappingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest Instance { get; init; } - public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Optional("index", indices).Required("fields", fields)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest instance) { + Instance = instance; } - public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Fields fields) : base(r => r.Required("fields", fields)) + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Fields fields) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(fields); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetFieldMapping; + public GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(indices, fields); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetFieldMappingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.get_field_mapping"; + /// + /// + /// Comma-separated list or wildcard expression of fields used to limit returned information. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expression of fields used to limit returned information. + /// Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - public GetFieldMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetFieldMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetFieldMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetFieldMappingRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetFieldMappingRequestDescriptor Local(bool? local = true) => Qs("local", local); + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetFieldMappingRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("fields", fields); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetFieldMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingResponse.g.cs index 480d5ef2f8f..f29f9b60078 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetFieldMappingResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetFieldMappingResponse : DictionaryResponse +internal sealed partial class GetFieldMappingResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetFieldMappingResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { FieldMappings = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetFieldMappingResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.FieldMappings, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponseConverter))] +public partial class GetFieldMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFieldMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFieldMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary FieldMappings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexRequest.g.cs index 82a29f2bd97..48956b6a999 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndexRequestParameters : RequestParameters +public sealed partial class GetIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,14 +41,14 @@ public sealed partial class GetIndexRequestParameters : RequestParameters /// such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Return only information on specified index features /// /// - public ICollection? Features { get => Q?>("features"); set => Q("features", value); } + public System.Collections.Generic.ICollection? Features { get => Q?>("features"); set => Q("features", value); } /// /// @@ -93,6 +86,35 @@ public sealed partial class GetIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index information. @@ -100,20 +122,44 @@ public sealed partial class GetIndexRequestParameters : RequestParameters /// stream’s backing indices. /// /// -public sealed partial class GetIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestConverter))] +public sealed partial class GetIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public GetIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get"; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard expressions (*) are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only @@ -121,7 +167,6 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -131,23 +176,20 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Return only information on specified index features /// /// - [JsonIgnore] - public ICollection? Features { get => Q?>("features"); set => Q("features", value); } + public System.Collections.Generic.ICollection? Features { get => Q?>("features"); set => Q("features", value); } /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -155,7 +197,6 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// If false, requests that target a missing index return an error. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -163,7 +204,6 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// If true, return all default settings in the response. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -171,7 +211,6 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -179,7 +218,6 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -190,43 +228,206 @@ public GetIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r = /// stream’s backing indices. /// /// -public sealed partial class GetIndexRequestDescriptor : RequestDescriptor, GetIndexRequestParameters> +public readonly partial struct GetIndexRequestDescriptor { - internal GetIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest Instance { get; init; } - public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest instance) { + Instance = instance; } - public GetIndexRequestDescriptor() : this(typeof(TDocument)) + public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGet; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard expressions (*) are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.get"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + /// missing or closed indices. This behavior applies even if the request targets other open indices. For example, + /// a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Return only information on specified index features + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Features(System.Collections.Generic.ICollection? value) + { + Instance.Features = value; + return this; + } + + /// + /// + /// Return only information on specified index features + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Features(params Elastic.Clients.Elasticsearch.IndexManagement.Feature[] values) + { + Instance.Features = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, requests that target a missing index return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetIndexRequestDescriptor Features(ICollection? features) => Qs("features", features); - public GetIndexRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetIndexRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetIndexRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -237,38 +438,204 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// stream’s backing indices. /// /// -public sealed partial class GetIndexRequestDescriptor : RequestDescriptor +public readonly partial struct GetIndexRequestDescriptor { - internal GetIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest Instance { get; init; } - public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGet; + public GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public GetIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.get"; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard expressions (*) are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + /// missing or closed indices. This behavior applies even if the request targets other open indices. For example, + /// a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public GetIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetIndexRequestDescriptor Features(ICollection? features) => Qs("features", features); - public GetIndexRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetIndexRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetIndexRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Return only information on specified index features + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Features(System.Collections.Generic.ICollection? value) + { + Instance.Features = value; + return this; + } + + /// + /// + /// Return only information on specified index features + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Features(params Elastic.Clients.Elasticsearch.IndexManagement.Feature[] values) + { + Instance.Features = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, requests that target a missing index return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexResponse.g.cs index 4169c622ef8..48d5f69c5d5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndexResponse : DictionaryResponse +internal sealed partial class GetIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetIndexResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Indices = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetIndexResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Indices, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponseConverter))] +public sealed partial class GetIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateRequest.g.cs index 60ed8e8db98..942177674ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndexTemplateRequestParameters : RequestParameters +public sealed partial class GetIndexTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -61,36 +54,83 @@ public sealed partial class GetIndexTemplateRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetIndexTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index templates. /// Get information about one or more index templates. /// /// -public sealed partial class GetIndexTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestConverter))] +public sealed partial class GetIndexTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetIndexTemplateRequest() { } - - public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetIndexTemplateRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetIndexTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetIndexTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_index_template"; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("name"); set => PO("name", value); } + /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -98,7 +138,6 @@ public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// If true, returns all relevant default configurations for the index template. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -106,7 +145,6 @@ public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -114,7 +152,6 @@ public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -124,38 +161,136 @@ public GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Get information about one or more index templates. /// /// -public sealed partial class GetIndexTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct GetIndexTemplateRequestDescriptor { - internal GetIndexTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest Instance { get; init; } - public GetIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest instance) { + Instance = instance; + } + + public GetIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(name); } public GetIndexTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetIndexTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - internal override string OperationName => "indices.get_index_template"; + /// + /// + /// If true, returns all relevant default configurations for the index template. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public GetIndexTemplateRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetIndexTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetIndexTemplateRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateResponse.g.cs index bc57e63ef5e..e06c3a788fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndexTemplateResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndexTemplateResponse : ElasticsearchResponse +internal sealed partial class GetIndexTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("index_templates")] - public IReadOnlyCollection IndexTemplates { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropIndexTemplates = System.Text.Json.JsonEncodedText.Encode("index_templates"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndexTemplates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexTemplates.TryReadProperty(ref reader, options, PropIndexTemplates, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexTemplates = propIndexTemplates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexTemplates, value.IndexTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponseConverter))] +public sealed partial class GetIndexTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndexTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection IndexTemplates { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsRequest.g.cs index 9f336f6bebe..0672ed95f38 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndicesSettingsRequestParameters : RequestParameters +public sealed partial class GetIndicesSettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -50,7 +43,7 @@ public sealed partial class GetIndicesSettingsRequestParameters : RequestParamet /// Supports comma-separated values, such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -91,6 +84,35 @@ public sealed partial class GetIndicesSettingsRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetIndicesSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index settings. @@ -98,12 +120,9 @@ public sealed partial class GetIndicesSettingsRequestParameters : RequestParamet /// For data streams, it returns setting information for the stream's backing indices. /// /// -public sealed partial class GetIndicesSettingsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestConverter))] +public sealed partial class GetIndicesSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetIndicesSettingsRequest() - { - } - public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } @@ -115,15 +134,46 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices, public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) { } +#if NET7_0_OR_GREATER + public GetIndicesSettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetIndicesSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetSettings; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetSettings; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_settings"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + + /// + /// + /// Comma-separated list or wildcard expression of settings to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index @@ -133,7 +183,6 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -143,15 +192,13 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// Supports comma-separated values, such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -159,7 +206,6 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -167,7 +213,6 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// If true, return all default settings in the response. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -176,7 +221,6 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// false, information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -186,7 +230,6 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -197,48 +240,215 @@ public GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Names? name) : ba /// For data streams, it returns setting information for the stream's backing indices. /// /// -public sealed partial class GetIndicesSettingsRequestDescriptor : RequestDescriptor, GetIndicesSettingsRequestParameters> +public readonly partial struct GetIndicesSettingsRequestDescriptor { - internal GetIndicesSettingsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest Instance { get; init; } - public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("index", indices).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest instance) { + Instance = instance; + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(indices); + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(indices, name); + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(name); } public GetIndicesSettingsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetSettings; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expression of settings to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.get_settings"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index + /// alias, or _all value targets only missing or closed indices. This + /// behavior applies even if the request targets other open indices. For + /// example, a request targeting foo*,bar* returns an error if an index + /// starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. If + /// false, information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public GetIndicesSettingsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetIndicesSettingsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetIndicesSettingsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetIndicesSettingsRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetIndicesSettingsRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetIndicesSettingsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -249,47 +459,214 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// For data streams, it returns setting information for the stream's backing indices. /// /// -public sealed partial class GetIndicesSettingsRequestDescriptor : RequestDescriptor +public readonly partial struct GetIndicesSettingsRequestDescriptor { - internal GetIndicesSettingsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest Instance { get; init; } - public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("index", indices).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest instance) { + Instance = instance; + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(indices); + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(indices, name); + } + + public GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(name); } public GetIndicesSettingsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetSettings; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expression of settings to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.get_settings"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index + /// alias, or _all value targets only missing or closed indices. This + /// behavior applies even if the request targets other open indices. For + /// example, a request targeting foo*,bar* returns an error if an index + /// starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public GetIndicesSettingsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetIndicesSettingsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetIndicesSettingsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetIndicesSettingsRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public GetIndicesSettingsRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, return all default settings in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. If + /// false, information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetIndicesSettingsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsResponse.g.cs index ab6b10aa35e..a4a6b6ac40b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetIndicesSettingsResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetIndicesSettingsResponse : DictionaryResponse +internal sealed partial class GetIndicesSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetIndicesSettingsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Settings = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetIndicesSettingsResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Settings, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponseConverter))] +public sealed partial class GetIndicesSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIndicesSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIndicesSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Settings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingRequest.g.cs index 9fe3b3aefb0..1191cbf2bc6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetMappingRequestParameters : RequestParameters +public sealed partial class GetMappingRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class GetMappingRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -62,6 +55,7 @@ public sealed partial class GetMappingRequestParameters : RequestParameters /// If true, the request retrieves information from the local node only. /// /// + [System.Obsolete("Deprecated in '7.8.0'. This parameter is a no-op and field mappings are always retrieved locally.")] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -73,37 +67,86 @@ public sealed partial class GetMappingRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get mapping definitions. /// For data streams, the API retrieves mappings for the stream’s backing indices. /// /// -public sealed partial class GetMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestConverter))] +public sealed partial class GetMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public GetMappingRequest() { } - - public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public GetMappingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_mapping"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -114,15 +157,13 @@ public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -130,7 +171,7 @@ public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// If true, the request retrieves information from the local node only. /// /// - [JsonIgnore] + [System.Obsolete("Deprecated in '7.8.0'. This parameter is a no-op and field mappings are always retrieved locally.")] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -139,7 +180,6 @@ public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -149,40 +189,170 @@ public GetMappingRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// For data streams, the API retrieves mappings for the stream’s backing indices. /// /// -public sealed partial class GetMappingRequestDescriptor : RequestDescriptor, GetMappingRequestParameters> +public readonly partial struct GetMappingRequestDescriptor { - internal GetMappingRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest Instance { get; init; } - public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest instance) { + Instance = instance; + } + + public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(indices); } public GetMappingRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetMapping; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.get_mapping"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public GetMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetMappingRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public GetMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor IgnoreUnavailable(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Obsolete("Deprecated in '7.8.0'. This parameter is a no-op and field mappings are always retrieved locally.")] + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -192,39 +362,169 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// For data streams, the API retrieves mappings for the stream’s backing indices. /// /// -public sealed partial class GetMappingRequestDescriptor : RequestDescriptor +public readonly partial struct GetMappingRequestDescriptor { - internal GetMappingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest instance) + { + Instance = instance; + } - public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(indices); } public GetMappingRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetMapping; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.get_mapping"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public GetMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public GetMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public GetMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetMappingRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Obsolete("Deprecated in '7.8.0'. This parameter is a no-op and field mappings are always retrieved locally.")] + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingResponse.g.cs index 57626a6b897..b5f25c00ec3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMappingResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetMappingResponse : DictionaryResponse +internal sealed partial class GetMappingResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetMappingResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Mappings = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetMappingResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Mappings, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponseConverter))] +public sealed partial class GetMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Mappings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusRequest.g.cs new file mode 100644 index 00000000000..cf60861f22c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusRequest.g.cs @@ -0,0 +1,290 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +public sealed partial class GetMigrateReindexStatusRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetMigrateReindexStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +/// +/// +/// Get the migration reindexing status. +/// +/// +/// Get the status of a migration reindex attempt for a data stream or index. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestConverter))] +public sealed partial class GetMigrateReindexStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + { + } +#if NET7_0_OR_GREATER + public GetMigrateReindexStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetMigrateReindexStatus; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "indices.get_migrate_reindex_status"; + + /// + /// + /// The index or data stream name. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } +} + +/// +/// +/// Get the migration reindexing status. +/// +/// +/// Get the status of a migration reindex attempt for a data stream or index. +/// +/// +public readonly partial struct GetMigrateReindexStatusRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest instance) + { + Instance = instance; + } + + public GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(indices); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetMigrateReindexStatusRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The index or data stream name. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Get the migration reindexing status. +/// +/// +/// Get the status of a migration reindex attempt for a data stream or index. +/// +/// +public readonly partial struct GetMigrateReindexStatusRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest instance) + { + Instance = instance; + } + + public GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(indices); + } + + public GetMigrateReindexStatusRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The index or data stream name. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusResponse.g.cs new file mode 100644 index 00000000000..7c092fbfd45 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetMigrateReindexStatusResponse.g.cs @@ -0,0 +1,202 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class GetMigrateReindexStatusResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropComplete = System.Text.Json.JsonEncodedText.Encode("complete"); + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropException = System.Text.Json.JsonEncodedText.Encode("exception"); + private static readonly System.Text.Json.JsonEncodedText PropInProgress = System.Text.Json.JsonEncodedText.Encode("in_progress"); + private static readonly System.Text.Json.JsonEncodedText PropPending = System.Text.Json.JsonEncodedText.Encode("pending"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeMillis = System.Text.Json.JsonEncodedText.Encode("start_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropSuccesses = System.Text.Json.JsonEncodedText.Encode("successes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalIndicesInDataStream = System.Text.Json.JsonEncodedText.Encode("total_indices_in_data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropTotalIndicesRequiringUpgrade = System.Text.Json.JsonEncodedText.Encode("total_indices_requiring_upgrade"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propComplete = default; + LocalJsonValue> propErrors = default; + LocalJsonValue propException = default; + LocalJsonValue> propInProgress = default; + LocalJsonValue propPending = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeMillis = default; + LocalJsonValue propSuccesses = default; + LocalJsonValue propTotalIndicesInDataStream = default; + LocalJsonValue propTotalIndicesRequiringUpgrade = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComplete.TryReadProperty(ref reader, options, PropComplete, null)) + { + continue; + } + + if (propErrors.TryReadProperty(ref reader, options, PropErrors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propException.TryReadProperty(ref reader, options, PropException, null)) + { + continue; + } + + if (propInProgress.TryReadProperty(ref reader, options, PropInProgress, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPending.TryReadProperty(ref reader, options, PropPending, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeMillis.TryReadProperty(ref reader, options, PropStartTimeMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propSuccesses.TryReadProperty(ref reader, options, PropSuccesses, null)) + { + continue; + } + + if (propTotalIndicesInDataStream.TryReadProperty(ref reader, options, PropTotalIndicesInDataStream, null)) + { + continue; + } + + if (propTotalIndicesRequiringUpgrade.TryReadProperty(ref reader, options, PropTotalIndicesRequiringUpgrade, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Complete = propComplete.Value, + Errors = propErrors.Value, + Exception = propException.Value, + InProgress = propInProgress.Value, + Pending = propPending.Value, + StartTime = propStartTime.Value, + StartTimeMillis = propStartTimeMillis.Value, + Successes = propSuccesses.Value, + TotalIndicesInDataStream = propTotalIndicesInDataStream.Value, + TotalIndicesRequiringUpgrade = propTotalIndicesRequiringUpgrade.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComplete, value.Complete, null, null); + writer.WriteProperty(options, PropErrors, value.Errors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropException, value.Exception, null, null); + writer.WriteProperty(options, PropInProgress, value.InProgress, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPending, value.Pending, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeMillis, value.StartTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropSuccesses, value.Successes, null, null); + writer.WriteProperty(options, PropTotalIndicesInDataStream, value.TotalIndicesInDataStream, null, null); + writer.WriteProperty(options, PropTotalIndicesRequiringUpgrade, value.TotalIndicesRequiringUpgrade, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponseConverter))] +public sealed partial class GetMigrateReindexStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMigrateReindexStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMigrateReindexStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Complete { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Errors { get; set; } + public string? Exception { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection InProgress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Pending { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Successes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalIndicesInDataStream { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalIndicesRequiringUpgrade { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateRequest.g.cs index fccb36b1bfe..747d6dc5dcd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetTemplateRequestParameters : RequestParameters +public sealed partial class GetTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -55,6 +48,35 @@ public sealed partial class GetTemplateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index templates. @@ -64,30 +86,50 @@ public sealed partial class GetTemplateRequestParameters : RequestParameters /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. /// /// -public sealed partial class GetTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestConverter))] +public sealed partial class GetTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetTemplateRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetTemplateRequest() { } - - public GetTemplateRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementGetTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.get_template"; + /// + /// + /// Comma-separated list of index template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// To return all index templates, omit this parameter or use a value of _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } + /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -95,7 +137,6 @@ public GetTemplateRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => /// If true, the request retrieves information from the local node only. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// @@ -104,7 +145,6 @@ public GetTemplateRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -117,37 +157,128 @@ public GetTemplateRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. /// /// -public sealed partial class GetTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct GetTemplateRequestDescriptor { - internal GetTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest Instance { get; init; } - public GetTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest instance) { + Instance = instance; + } + + public GetTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(name); } public GetTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementGetTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of index template names used to limit the request. + /// Wildcard (*) expressions are supported. + /// To return all index templates, omit this parameter or use a value of _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - internal override string OperationName => "indices.get_template"; + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public GetTemplateRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public GetTemplateRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateResponse.g.cs index 403afab1c1f..195c4a5d6e4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/GetTemplateResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class GetTemplateResponse : DictionaryResponse +internal sealed partial class GetTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetTemplateResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Templates = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetTemplateResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Templates, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponseConverter))] +public sealed partial class GetTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Templates { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsRequest.g.cs index ec9c41d2b62..b5dca3edf63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class IndicesStatsRequestParameters : RequestParameters +public sealed partial class IndicesStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,7 +39,7 @@ public sealed partial class IndicesStatsRequestParameters : RequestParameters /// such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -74,7 +67,7 @@ public sealed partial class IndicesStatsRequestParameters : RequestParameters /// Comma-separated list of search groups to include in the search statistics. /// /// - public ICollection? Groups { get => Q?>("groups"); set => Q("groups", value); } + public System.Collections.Generic.ICollection? Groups { get => Q?>("groups"); set => Q("groups", value); } /// /// @@ -98,6 +91,35 @@ public sealed partial class IndicesStatsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Level? Level { get => Q("level"); set => Q("level", value); } } +internal sealed partial class IndicesStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index statistics. @@ -116,12 +138,9 @@ public sealed partial class IndicesStatsRequestParameters : RequestParameters /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. /// /// -public sealed partial class IndicesStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestConverter))] +public sealed partial class IndicesStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public IndicesStatsRequest() - { - } - public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("metric", metric)) { } @@ -133,21 +152,49 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("index", indices).Optional("metric", metric)) { } +#if NET7_0_OR_GREATER + public IndicesStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndicesStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.stats"; + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + + /// + /// + /// Limit the information returned the specific metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Metrics? Metric { get => P("metric"); set => PO("metric", value); } + /// /// /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? CompletionFields { get => Q("completion_fields"); set => Q("completion_fields", value); } /// @@ -157,15 +204,13 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? FielddataFields { get => Q("fielddata_fields"); set => Q("fielddata_fields", value); } /// @@ -173,7 +218,6 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// Comma-separated list or wildcard expressions of fields to include in the statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } /// @@ -181,7 +225,6 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// If true, statistics are not collected from closed indices. /// /// - [JsonIgnore] public bool? ForbidClosedIndices { get => Q("forbid_closed_indices"); set => Q("forbid_closed_indices", value); } /// @@ -189,15 +232,13 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// Comma-separated list of search groups to include in the search statistics. /// /// - [JsonIgnore] - public ICollection? Groups { get => Q?>("groups"); set => Q("groups", value); } + public System.Collections.Generic.ICollection? Groups { get => Q?>("groups"); set => Q("groups", value); } /// /// /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). /// /// - [JsonIgnore] public bool? IncludeSegmentFileSizes { get => Q("include_segment_file_sizes"); set => Q("include_segment_file_sizes", value); } /// @@ -205,7 +246,6 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// If true, the response includes information from segments that are not loaded into memory. /// /// - [JsonIgnore] public bool? IncludeUnloadedSegments { get => Q("include_unloaded_segments"); set => Q("include_unloaded_segments", value); } /// @@ -213,7 +253,6 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// Indicates whether statistics are aggregated at the cluster, index, or shard level. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Level? Level { get => Q("level"); set => Q("level", value); } } @@ -235,50 +274,272 @@ public IndicesStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elast /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. /// /// -public sealed partial class IndicesStatsRequestDescriptor : RequestDescriptor, IndicesStatsRequestParameters> +public readonly partial struct IndicesStatsRequestDescriptor { - internal IndicesStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest Instance { get; init; } - public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("index", indices).Optional("metric", metric)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest instance) { + Instance = instance; + } + + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(metric); + } + + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(indices); + } + + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(indices, metric); } public IndicesStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementStats; + /// + /// + /// Limit the information returned the specific metrics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CompletionFields = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor CompletionFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.CompletionFields = value; + return this; + } - internal override string OperationName => "indices.stats"; + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FielddataFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// If true, statistics are not collected from closed indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ForbidClosedIndices(bool? value = true) + { + Instance.ForbidClosedIndices = value; + return this; + } + + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Groups(System.Collections.Generic.ICollection? value) + { + Instance.Groups = value; + return this; + } + + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Groups(params string[] values) + { + Instance.Groups = [.. values]; + return this; + } + + /// + /// + /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor IncludeSegmentFileSizes(bool? value = true) + { + Instance.IncludeSegmentFileSizes = value; + return this; + } + + /// + /// + /// If true, the response includes information from segments that are not loaded into memory. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor IncludeUnloadedSegments(bool? value = true) + { + Instance.IncludeUnloadedSegments = value; + return this; + } + + /// + /// + /// Indicates whether statistics are aggregated at the cluster, index, or shard level. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } - public IndicesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? completionFields) => Qs("completion_fields", completionFields); - public IndicesStatsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public IndicesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? fielddataFields) => Qs("fielddata_fields", fielddataFields); - public IndicesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public IndicesStatsRequestDescriptor ForbidClosedIndices(bool? forbidClosedIndices = true) => Qs("forbid_closed_indices", forbidClosedIndices); - public IndicesStatsRequestDescriptor Groups(ICollection? groups) => Qs("groups", groups); - public IndicesStatsRequestDescriptor IncludeSegmentFileSizes(bool? includeSegmentFileSizes = true) => Qs("include_segment_file_sizes", includeSegmentFileSizes); - public IndicesStatsRequestDescriptor IncludeUnloadedSegments(bool? includeUnloadedSegments = true) => Qs("include_unloaded_segments", includeUnloadedSegments); - public IndicesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public IndicesStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.ErrorTrace = value; + return this; } - public IndicesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Human(bool? value) { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -300,49 +561,271 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. /// /// -public sealed partial class IndicesStatsRequestDescriptor : RequestDescriptor +public readonly partial struct IndicesStatsRequestDescriptor { - internal IndicesStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest instance) + { + Instance = instance; + } + + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(metric); + } + + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(indices); + } - public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("index", indices).Optional("metric", metric)) + public IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(indices, metric); } public IndicesStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementStats; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A comma-separated list of index names; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Limit the information returned the specific metrics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - internal override string OperationName => "indices.stats"; + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CompletionFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor CompletionFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.CompletionFields = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FielddataFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// If true, statistics are not collected from closed indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ForbidClosedIndices(bool? value = true) + { + Instance.ForbidClosedIndices = value; + return this; + } + + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Groups(System.Collections.Generic.ICollection? value) + { + Instance.Groups = value; + return this; + } + + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Groups(params string[] values) + { + Instance.Groups = [.. values]; + return this; + } + + /// + /// + /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor IncludeSegmentFileSizes(bool? value = true) + { + Instance.IncludeSegmentFileSizes = value; + return this; + } + + /// + /// + /// If true, the response includes information from segments that are not loaded into memory. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor IncludeUnloadedSegments(bool? value = true) + { + Instance.IncludeUnloadedSegments = value; + return this; + } + + /// + /// + /// Indicates whether statistics are aggregated at the cluster, index, or shard level. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } - public IndicesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? completionFields) => Qs("completion_fields", completionFields); - public IndicesStatsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public IndicesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? fielddataFields) => Qs("fielddata_fields", fielddataFields); - public IndicesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public IndicesStatsRequestDescriptor ForbidClosedIndices(bool? forbidClosedIndices = true) => Qs("forbid_closed_indices", forbidClosedIndices); - public IndicesStatsRequestDescriptor Groups(ICollection? groups) => Qs("groups", groups); - public IndicesStatsRequestDescriptor IncludeSegmentFileSizes(bool? includeSegmentFileSizes = true) => Qs("include_segment_file_sizes", includeSegmentFileSizes); - public IndicesStatsRequestDescriptor IncludeUnloadedSegments(bool? includeUnloadedSegments = true) => Qs("include_unloaded_segments", includeUnloadedSegments); - public IndicesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public IndicesStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SourceQueryString = value; + return this; } - public IndicesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsResponse.g.cs index 7a78a645850..e85bf92e995 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/IndicesStatsResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class IndicesStatsResponse : ElasticsearchResponse +internal sealed partial class IndicesStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("_all")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats All { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyDictionary? Indices { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + Indices = propIndices.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponseConverter))] +public sealed partial class IndicesStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats All { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexRequest.g.cs new file mode 100644 index 00000000000..ad6a0f95ff0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexRequest.g.cs @@ -0,0 +1,182 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +public sealed partial class MigrateReindexRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class MigrateReindexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Reindex = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Reindex, null); + } +} + +/// +/// +/// Reindex legacy backing indices. +/// +/// +/// Reindex all legacy backing indices for a data stream. +/// This operation occurs in a persistent task. +/// The persistent task ID is returned immediately and the reindexing work is completed in that task. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestConverter))] +public sealed partial class MigrateReindexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindexRequest(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex reindex) + { + Reindex = reindex; + } +#if NET7_0_OR_GREATER + public MigrateReindexRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MigrateReindexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementMigrateReindex; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "indices.migrate_reindex"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex Reindex { get; set; } +} + +/// +/// +/// Reindex legacy backing indices. +/// +/// +/// Reindex all legacy backing indices for a data stream. +/// This operation occurs in a persistent task. +/// The persistent task ID is returned immediately and the reindexing work is completed in that task. +/// +/// +public readonly partial struct MigrateReindexRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest instance) + { + Instance = instance; + } + + public MigrateReindexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor Reindex(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex value) + { + Instance.Reindex = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor Reindex(System.Action action) + { + Instance.Reindex = Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexResponse.g.cs new file mode 100644 index 00000000000..32b4adf0a84 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateReindexResponse.g.cs @@ -0,0 +1,89 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class MigrateReindexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponseConverter))] +public sealed partial class MigrateReindexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamRequest.g.cs index c58975294e3..e4c21e20dec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class MigrateToDataStreamRequestParameters : RequestParameters +public sealed partial class MigrateToDataStreamRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,6 +40,35 @@ public sealed partial class MigrateToDataStreamRequestParameters : RequestParame public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class MigrateToDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Convert an index alias to a data stream. @@ -62,26 +84,48 @@ public sealed partial class MigrateToDataStreamRequestParameters : RequestParame /// The write index for the alias becomes the write index for the stream. /// /// -public sealed partial class MigrateToDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestConverter))] +public sealed partial class MigrateToDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.IndexName name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public MigrateToDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementMigrateToDataStream; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementMigrateToDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.migrate_to_data_stream"; + /// + /// + /// Name of the index alias to convert to a data stream. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -89,7 +133,6 @@ public MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.IndexName name) /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -108,32 +151,232 @@ public MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.IndexName name) /// The write index for the alias becomes the write index for the stream. /// /// -public sealed partial class MigrateToDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct MigrateToDataStreamRequestDescriptor { - internal MigrateToDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest Instance { get; init; } - public MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementMigrateToDataStream; + public MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public MigrateToDataStreamRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.migrate_to_data_stream"; + /// + /// + /// Name of the index alias to convert to a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Name = value; + return this; + } - public MigrateToDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public MigrateToDataStreamRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Convert an index alias to a data stream. +/// Converts an index alias to a data stream. +/// You must have a matching index template that is data stream enabled. +/// The alias must meet the following criteria: +/// The alias must have a write index; +/// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; +/// The alias must not have any filters; +/// The alias must not use custom routing. +/// If successful, the request removes the alias and creates a data stream with the same name. +/// The indices for the alias become hidden backing indices for the stream. +/// The write index for the alias becomes the write index for the stream. +/// +/// +public readonly partial struct MigrateToDataStreamRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest instance) + { + Instance = instance; + } + + public MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(name); + } + + public MigrateToDataStreamRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Name of the index alias to convert to a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public MigrateToDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName name) + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamResponse.g.cs index 48d6aa2e95e..4649db81d9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/MigrateToDataStreamResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class MigrateToDataStreamResponse : ElasticsearchResponse +internal sealed partial class MigrateToDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponseConverter))] +public sealed partial class MigrateToDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateToDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateToDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamRequest.g.cs index 38fe2a811e1..ad330a5af43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamRequest.g.cs @@ -17,34 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ModifyDataStreamRequestParameters : RequestParameters +public sealed partial class ModifyDataStreamRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ModifyDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propActions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Update data streams. /// Performs one or more data stream modification actions in a single atomic operation. /// /// -public sealed partial class ModifyDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestConverter))] +public sealed partial class ModifyDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementModifyDataStream; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModifyDataStreamRequest(System.Collections.Generic.ICollection actions) + { + Actions = actions; + } +#if NET7_0_OR_GREATER + public ModifyDataStreamRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ModifyDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModifyDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementModifyDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -55,8 +110,11 @@ public sealed partial class ModifyDataStreamRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("actions")] - public ICollection Actions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Actions { get; set; } } /// @@ -65,102 +123,110 @@ public sealed partial class ModifyDataStreamRequest : PlainRequest /// -public sealed partial class ModifyDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct ModifyDataStreamRequestDescriptor { - internal ModifyDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest Instance { get; init; } - public ModifyDataStreamRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModifyDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementModifyDataStream; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ModifyDataStreamRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.modify_data_stream"; + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor Actions(System.Collections.Generic.ICollection value) + { + Instance.Actions = value; + return this; + } - private ICollection ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor ActionsDescriptor { get; set; } - private Action ActionsDescriptorAction { get; set; } - private Action[] ActionsDescriptorActions { get; set; } + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor Actions(params Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction[] values) + { + Instance.Actions = [.. values]; + return this; + } /// /// /// Actions to perform. /// /// - public ModifyDataStreamRequestDescriptor Actions(ICollection actions) + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor Actions(params System.Action[] actions) { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsValue = actions; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor.Build(action)); + } + + Instance.Actions = items; + return this; } - public ModifyDataStreamRequestDescriptor Actions(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest Build(System.Action action) { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public ModifyDataStreamRequestDescriptor Actions(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor ErrorTrace(bool? value) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorActions = null; - ActionsDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public ModifyDataStreamRequestDescriptor Actions(params Action[] configure) + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor FilterPath(params string[]? value) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - writer.WriteEndArray(); - } - else if (ActionsDescriptorAction is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor(ActionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ActionsDescriptorActions is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - foreach (var action in ActionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor(action), options); - } + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamResponse.g.cs index f55c2d8935d..f7ec961334d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ModifyDataStreamResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ModifyDataStreamResponse : ElasticsearchResponse +internal sealed partial class ModifyDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponseConverter))] +public sealed partial class ModifyDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModifyDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModifyDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexRequest.g.cs index 170dddb414d..16b2fcd3177 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class OpenIndexRequestParameters : RequestParameters +public sealed partial class OpenIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class OpenIndexRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -82,6 +75,35 @@ public sealed partial class OpenIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class OpenIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Open a closed index. @@ -115,27 +137,53 @@ public sealed partial class OpenIndexRequestParameters : RequestParameters /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. /// /// -public sealed partial class OpenIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestConverter))] +public sealed partial class OpenIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public OpenIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementOpen; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementOpen; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.open"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// By default, you must explicitly name the indices you using to limit the request. + /// To limit a request using _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + /// You can update this setting in the elasticsearch.yml file or using the cluster update settings API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -146,15 +194,13 @@ public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -163,7 +209,6 @@ public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -172,7 +217,6 @@ public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -181,7 +225,6 @@ public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -218,41 +261,180 @@ public OpenIndexRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. /// /// -public sealed partial class OpenIndexRequestDescriptor : RequestDescriptor, OpenIndexRequestParameters> +public readonly partial struct OpenIndexRequestDescriptor { - internal OpenIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest Instance { get; init; } - public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest instance) { + Instance = instance; } - public OpenIndexRequestDescriptor() : this(typeof(TDocument)) + public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementOpen; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public OpenIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// By default, you must explicitly name the indices you using to limit the request. + /// To limit a request using _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + /// You can update this setting in the elasticsearch.yml file or using the cluster update settings API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.open"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public OpenIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public OpenIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public OpenIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public OpenIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public OpenIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public OpenIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public OpenIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Pretty(bool? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Pretty = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor SourceQueryString(string? value) { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -289,36 +471,178 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. /// /// -public sealed partial class OpenIndexRequestDescriptor : RequestDescriptor +public readonly partial struct OpenIndexRequestDescriptor { - internal OpenIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest Instance { get; init; } - public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementOpen; + public OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public OpenIndexRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.open"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// By default, you must explicitly name the indices you using to limit the request. + /// To limit a request using _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + /// You can update this setting in the elasticsearch.yml file or using the cluster update settings API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public OpenIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public OpenIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public OpenIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public OpenIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public OpenIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public OpenIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public OpenIndexRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexResponse.g.cs index bfbbff8b77c..c48a9603f6b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/OpenIndexResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class OpenIndexResponse : ElasticsearchResponse +internal sealed partial class OpenIndexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponseConverter))] +public sealed partial class OpenIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamRequest.g.cs index 1ba3ecb759f..ddbcb7a6980 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PromoteDataStreamRequestParameters : RequestParameters +public sealed partial class PromoteDataStreamRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class PromoteDataStreamRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class PromoteDataStreamRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Promote a data stream. @@ -57,26 +79,48 @@ public sealed partial class PromoteDataStreamRequestParameters : RequestParamete /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. /// /// -public sealed partial class PromoteDataStreamRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestConverter))] +public sealed partial class PromoteDataStreamRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.IndexName name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PromoteDataStreamRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPromoteDataStream; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPromoteDataStream; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.promote_data_stream"; + /// + /// + /// The name of the data stream + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -97,31 +141,212 @@ public PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.IndexName name) : /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. /// /// -public sealed partial class PromoteDataStreamRequestDescriptor : RequestDescriptor +public readonly partial struct PromoteDataStreamRequestDescriptor { - internal PromoteDataStreamRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest Instance { get; init; } - public PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPromoteDataStream; + public PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PromoteDataStreamRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.promote_data_stream"; + /// + /// + /// The name of the data stream + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public PromoteDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Promote a data stream. +/// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. +/// +/// +/// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. +/// These data streams can't be rolled over in the local cluster. +/// These replicated data streams roll over only if the upstream data stream rolls over. +/// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. +/// +/// +/// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. +/// If this is missing, the data stream will not be able to roll over until a matching index template is created. +/// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. +/// +/// +public readonly partial struct PromoteDataStreamRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest instance) + { + Instance = instance; + } + + public PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(name); + } + + public PromoteDataStreamRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the data stream + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public PromoteDataStreamRequestDescriptor Name(Elastic.Clients.Elasticsearch.IndexName name) + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamResponse.g.cs index de362b627e9..cff35bbd6b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PromoteDataStreamResponse.g.cs @@ -17,15 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PromoteDataStreamResponse : ElasticsearchResponse +internal sealed partial class PromoteDataStreamResponseConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Result, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponseConverter))] +public sealed partial class PromoteDataStreamResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PromoteDataStreamResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PromoteDataStreamResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +object Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasRequest.g.cs index 19d5e829a83..1af2e90b105 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutAliasRequestParameters : RequestParameters +public sealed partial class PutAliasRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,33 +42,145 @@ public sealed partial class PutAliasRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutAliasRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIndexRouting = System.Text.Json.JsonEncodedText.Encode("index_routing"); + private static readonly System.Text.Json.JsonEncodedText PropIsWriteIndex = System.Text.Json.JsonEncodedText.Encode("is_write_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearchRouting = System.Text.Json.JsonEncodedText.Encode("search_routing"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue propIndexRouting = default; + LocalJsonValue propIsWriteIndex = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearchRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIndexRouting.TryReadProperty(ref reader, options, PropIndexRouting, null)) + { + continue; + } + + if (propIsWriteIndex.TryReadProperty(ref reader, options, PropIsWriteIndex, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearchRouting.TryReadProperty(ref reader, options, PropSearchRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + IndexRouting = propIndexRouting.Value, + IsWriteIndex = propIsWriteIndex.Value, + Routing = propRouting.Value, + SearchRouting = propSearchRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIndexRouting, value.IndexRouting, null, null); + writer.WriteProperty(options, PropIsWriteIndex, value.IsWriteIndex, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearchRouting, value.SearchRouting, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update an alias. /// Adds a data stream or index to an alias. /// /// -public sealed partial class PutAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestConverter))] +public sealed partial class PutAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("index", indices).Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_alias"; + /// + /// + /// Comma-separated list of data streams or indices to add. + /// Supports wildcards (*). + /// Wildcard patterns that match both data streams and indices return an error. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// Alias to update. + /// If the alias doesn’t exist, the request creates it. + /// Index alias names support date math. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -84,7 +189,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -92,7 +196,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Query used to limit documents the alias can access. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -102,7 +205,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("index_routing")] public Elastic.Clients.Elasticsearch.Routing? IndexRouting { get; set; } /// @@ -113,7 +215,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream. /// /// - [JsonInclude, JsonPropertyName("is_write_index")] public bool? IsWriteIndex { get; set; } /// @@ -122,7 +223,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -132,7 +232,6 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("search_routing")] public Elastic.Clients.Elasticsearch.Routing? SearchRouting { get; set; } } @@ -142,76 +241,111 @@ public PutAliasRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Cl /// Adds a data stream or index to an alias. /// /// -public sealed partial class PutAliasRequestDescriptor : RequestDescriptor, PutAliasRequestParameters> +public readonly partial struct PutAliasRequestDescriptor { - internal PutAliasRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest Instance { get; init; } - public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest instance) { + Instance = instance; } - public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : this(typeof(TDocument), name) + public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(indices, name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutAlias; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "indices.put_alias"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor descriptor) => descriptor.Instance; - public PutAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Comma-separated list of data streams or indices to add. + /// Supports wildcards (*). + /// Wildcard patterns that match both data streams and indices return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public PutAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Alias to update. + /// If the alias doesn’t exist, the request creates it. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("index", indices); - return Self; + Instance.Name = value; + return this; } - public PutAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("name", name); - return Self; + Instance.MasterTimeout = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Query used to limit documents the alias can access. /// /// - public PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public PutAliasRequestDescriptor Filter(Action> configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -221,10 +355,10 @@ public PutAliasRequestDescriptor Filter(Action /// - public PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -235,10 +369,10 @@ public PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elastic /// Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream. /// /// - public PutAliasRequestDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -247,10 +381,10 @@ public PutAliasRequestDescriptor IsWriteIndex(bool? isWriteIndex = tr /// Data stream aliases don’t support this parameter. /// /// - public PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -260,56 +394,60 @@ public PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearc /// Data stream aliases don’t support this parameter. /// /// - public PutAliasRequestDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest Build(System.Action action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -319,72 +457,100 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Adds a data stream or index to an alias. /// /// -public sealed partial class PutAliasRequestDescriptor : RequestDescriptor +public readonly partial struct PutAliasRequestDescriptor { - internal PutAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest Instance { get; init; } - public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("index", indices).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutAlias; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(indices, name); + } - internal override string OperationName => "indices.put_alias"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public PutAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor descriptor) => descriptor.Instance; - public PutAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Comma-separated list of data streams or indices to add. + /// Supports wildcards (*). + /// Wildcard patterns that match both data streams and indices return an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - RouteValues.Required("index", indices); - return Self; + Instance.Indices = value; + return this; } - public PutAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Alias to update. + /// If the alias doesn’t exist, the request creates it. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("name", name); - return Self; + Instance.Name = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// - /// Query used to limit documents the alias can access. + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - public PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Timeout = value; + return this; } - public PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public PutAliasRequestDescriptor Filter(Action configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -394,10 +560,10 @@ public PutAliasRequestDescriptor Filter(Action /// - public PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -408,10 +574,10 @@ public PutAliasRequestDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Rout /// Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream. /// /// - public PutAliasRequestDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -420,10 +586,10 @@ public PutAliasRequestDescriptor IsWriteIndex(bool? isWriteIndex = true) /// Data stream aliases don’t support this parameter. /// /// - public PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -433,55 +599,59 @@ public PutAliasRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? /// Data stream aliases don’t support this parameter. /// /// - public PutAliasRequestDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasResponse.g.cs index 4b2d5f8e957..01d005d9db3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutAliasResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutAliasResponse : ElasticsearchResponse +internal sealed partial class PutAliasResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponseConverter))] +public sealed partial class PutAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs index 34af04025ab..faaabbc3a33 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutDataLifecycleRequestParameters : RequestParameters +public sealed partial class PutDataLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,7 +32,7 @@ public sealed partial class PutDataLifecycleRequestParameters : RequestParameter /// Valid values are: all, hidden, open, closed, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -59,26 +52,108 @@ public sealed partial class PutDataLifecycleRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutDataLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataRetention = System.Text.Json.JsonEncodedText.Encode("data_retention"); + private static readonly System.Text.Json.JsonEncodedText PropDownsampling = System.Text.Json.JsonEncodedText.Encode("downsampling"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataRetention = default; + LocalJsonValue propDownsampling = default; + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataRetention.TryReadProperty(ref reader, options, PropDataRetention, null)) + { + continue; + } + + if (propDownsampling.TryReadProperty(ref reader, options, PropDownsampling, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataRetention = propDataRetention.Value, + Downsampling = propDownsampling.Value, + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataRetention, value.DataRetention, null, null); + writer.WriteProperty(options, PropDownsampling, value.Downsampling, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update data stream lifecycles. /// Update the data stream lifecycle of the specified data streams. /// /// -public sealed partial class PutDataLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestConverter))] +public sealed partial class PutDataLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutDataLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutDataLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutDataLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_data_lifecycle"; + /// + /// + /// Comma-separated list of data streams used to limit the request. + /// Supports wildcards (*). + /// To target all data streams use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamNames Name { get => P("name"); set => PR("name", value); } + /// /// /// Type of data stream that wildcard patterns can match. @@ -86,8 +161,7 @@ public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// Valid values are: all, hidden, open, closed, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -96,7 +170,6 @@ public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -105,7 +178,6 @@ public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -115,17 +187,22 @@ public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// When empty, every document in this data stream will be stored indefinitely. /// /// - [JsonInclude, JsonPropertyName("data_retention")] public Elastic.Clients.Elasticsearch.Duration? DataRetention { get; set; } /// /// - /// If defined, every backing index will execute the configured downsampling configuration after the backing - /// index is not the data stream write index anymore. + /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - [JsonInclude, JsonPropertyName("downsampling")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? Downsampling { get; set; } + + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public bool? Enabled { get; set; } } /// @@ -134,36 +211,93 @@ public PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.DataStreamNames nam /// Update the data stream lifecycle of the specified data streams. /// /// -public sealed partial class PutDataLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct PutDataLifecycleRequestDescriptor { - internal PutDataLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest Instance { get; init; } - public PutDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutDataLifecycle; + public PutDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.DataStreamNames name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutDataLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.put_data_lifecycle"; + /// + /// + /// Comma-separated list of data streams used to limit the request. + /// Supports wildcards (*). + /// To target all data streams use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames value) + { + Instance.Name = value; + return this; + } - public PutDataLifecycleRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutDataLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, hidden, open, closed, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of data stream that wildcard patterns can match. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, hidden, open, closed, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public PutDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.DataStreamNames name) + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("name", name); - return Self; + Instance.MasterTimeout = value; + return this; } - private Elastic.Clients.Elasticsearch.Duration? DataRetentionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? DownsamplingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor DownsamplingDescriptor { get; set; } - private Action DownsamplingDescriptorAction { get; set; } + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// @@ -172,67 +306,93 @@ public PutDataLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Data /// When empty, every document in this data stream will be stored indefinitely. /// /// - public PutDataLifecycleRequestDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? dataRetention) + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? value) { - DataRetentionValue = dataRetention; - return Self; + Instance.DataRetention = value; + return this; } /// /// - /// If defined, every backing index will execute the configured downsampling configuration after the backing - /// index is not the data stream write index anymore. + /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - public PutDataLifecycleRequestDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? downsampling) + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? value) { - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = null; - DownsamplingValue = downsampling; - return Self; + Instance.Downsampling = value; + return this; } - public PutDataLifecycleRequestDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor descriptor) + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Downsampling(System.Action action) { - DownsamplingValue = null; - DownsamplingDescriptorAction = null; - DownsamplingDescriptor = descriptor; - return Self; + Instance.Downsampling = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor.Build(action); + return this; } - public PutDataLifecycleRequestDescriptor Downsampling(Action configure) + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Enabled(bool? value = true) { - DownsamplingValue = null; - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = configure; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest Build(System.Action action) { - writer.WriteStartObject(); - if (DataRetentionValue is not null) - { - writer.WritePropertyName("data_retention"); - JsonSerializer.Serialize(writer, DataRetentionValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (DownsamplingDescriptor is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingDescriptor, options); - } - else if (DownsamplingDescriptorAction is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(DownsamplingDescriptorAction), options); - } - else if (DownsamplingValue is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleResponse.g.cs index ba771b59fb4..0c7addc457d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutDataLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutDataLifecycleResponse : ElasticsearchResponse +internal sealed partial class PutDataLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponseConverter))] +public sealed partial class PutDataLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDataLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateRequest.g.cs index 32f549bebd0..1e5ac240245 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutIndexTemplateRequestParameters : RequestParameters +public sealed partial class PutIndexTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -55,6 +48,126 @@ public sealed partial class PutIndexTemplateRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class PutIndexTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowAutoCreate = System.Text.Json.JsonEncodedText.Encode("allow_auto_create"); + private static readonly System.Text.Json.JsonEncodedText PropComposedOf = System.Text.Json.JsonEncodedText.Encode("composed_of"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissingComponentTemplates = System.Text.Json.JsonEncodedText.Encode("ignore_missing_component_templates"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowAutoCreate = default; + LocalJsonValue?> propComposedOf = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propDeprecated = default; + LocalJsonValue?> propIgnoreMissingComponentTemplates = default; + LocalJsonValue propIndexPatterns = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPriority = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowAutoCreate.TryReadProperty(ref reader, options, PropAllowAutoCreate, null)) + { + continue; + } + + if (propComposedOf.TryReadProperty(ref reader, options, PropComposedOf, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propIgnoreMissingComponentTemplates.TryReadProperty(ref reader, options, PropIgnoreMissingComponentTemplates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowAutoCreate = propAllowAutoCreate.Value, + ComposedOf = propComposedOf.Value, + DataStream = propDataStream.Value, + Deprecated = propDeprecated.Value, + IgnoreMissingComponentTemplates = propIgnoreMissingComponentTemplates.Value, + IndexPatterns = propIndexPatterns.Value, + Meta = propMeta.Value, + Priority = propPriority.Value, + Template = propTemplate.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowAutoCreate, value.AllowAutoCreate, null, null); + writer.WriteProperty(options, PropComposedOf, value.ComposedOf, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropIgnoreMissingComponentTemplates, value.IgnoreMissingComponentTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update an index template. @@ -94,26 +207,48 @@ public sealed partial class PutIndexTemplateRequestParameters : RequestParameter /// If an entry already exists with the same key, then it is overwritten by the new definition. /// /// -public sealed partial class PutIndexTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestConverter))] +public sealed partial class PutIndexTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutIndexTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutIndexTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutIndexTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_index_template"; + /// + /// + /// Index or template name + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// User defined reason for creating/updating the index template /// /// - [JsonIgnore] public string? Cause { get => Q("cause"); set => Q("cause", value); } /// @@ -121,7 +256,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// If true, this request cannot replace or update existing index templates. /// /// - [JsonIgnore] public bool? Create { get => Q("create"); set => Q("create", value); } /// @@ -130,7 +264,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -140,7 +273,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - [JsonInclude, JsonPropertyName("allow_auto_create")] public bool? AllowAutoCreate { get; set; } /// @@ -149,8 +281,7 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - [JsonInclude, JsonPropertyName("composed_of")] - public ICollection? ComposedOf { get; set; } + public System.Collections.Generic.ICollection? ComposedOf { get; set; } /// /// @@ -159,7 +290,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// Data streams require a matching index template with a data_stream object. /// /// - [JsonInclude, JsonPropertyName("data_stream")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStream { get; set; } /// @@ -168,7 +298,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// that uses deprecated components, Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -177,15 +306,13 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// references a component template that might not exist /// /// - [JsonInclude, JsonPropertyName("ignore_missing_component_templates")] - public ICollection? IgnoreMissingComponentTemplates { get; set; } + public System.Collections.Generic.ICollection? IgnoreMissingComponentTemplates { get; set; } /// /// /// Name of the index template to create. /// /// - [JsonInclude, JsonPropertyName("index_patterns")] public Elastic.Clients.Elasticsearch.Indices? IndexPatterns { get; set; } /// @@ -197,8 +324,7 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// To unset the metadata, replace the template without specifying it. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -208,7 +334,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// This number is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("priority")] public long? Priority { get; set; } /// @@ -217,7 +342,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// It may optionally include an aliases, mappings, or settings configuration. /// /// - [JsonInclude, JsonPropertyName("template")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? Template { get; set; } /// @@ -228,7 +352,6 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// To unset a version, replace the template without specifying one. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } @@ -271,46 +394,74 @@ public PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// If an entry already exists with the same key, then it is overwritten by the new definition. /// /// -public sealed partial class PutIndexTemplateRequestDescriptor : RequestDescriptor, PutIndexTemplateRequestParameters> +public readonly partial struct PutIndexTemplateRequestDescriptor { - internal PutIndexTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest Instance { get; init; } - public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutIndexTemplate; + public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutIndexTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.put_index_template"; + /// + /// + /// Index or template name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutIndexTemplateRequestDescriptor Cause(string? cause) => Qs("cause", cause); - public PutIndexTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// User defined reason for creating/updating the index template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// If true, this request cannot replace or update existing index templates. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Create(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Create = value; + return this; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection? ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private ICollection? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor TemplateDescriptor { get; set; } - private Action> TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -319,10 +470,22 @@ public PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elastic /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - public PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? value = true) + { + Instance.AllowAutoCreate = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ComposedOf(System.Collections.Generic.ICollection? value) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.ComposedOf = value; + return this; } /// @@ -331,10 +494,10 @@ public PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? allowA /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public PutIndexTemplateRequestDescriptor ComposedOf(ICollection? composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = [.. values]; + return this; } /// @@ -344,28 +507,36 @@ public PutIndexTemplateRequestDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(null); + return this; } - public PutIndexTemplateRequestDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(action); + return this; } /// @@ -374,10 +545,10 @@ public PutIndexTemplateRequestDescriptor DataStream(Action /// - public PutIndexTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -386,10 +557,22 @@ public PutIndexTemplateRequestDescriptor Deprecated(bool? deprecated /// references a component template that might not exist /// /// - public PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollection? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(System.Collections.Generic.ICollection? value) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; + } + + /// + /// + /// The configuration option ignore_missing_component_templates can be used when an index template + /// references a component template that might not exist + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(params string[] values) + { + Instance.IgnoreMissingComponentTemplates = [.. values]; + return this; } /// @@ -397,10 +580,40 @@ public PutIndexTemplateRequestDescriptor IgnoreMissingComponentTempla /// Name of the index template to create. /// /// - public PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// It may have any contents. + /// It is not automatically generated or used by Elasticsearch. + /// This user-defined object is stored in the cluster state, so keeping it short is preferable + /// To unset the metadata, replace the template without specifying it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// It may have any contents. + /// It is not automatically generated or used by Elasticsearch. + /// This user-defined object is stored in the cluster state, so keeping it short is preferable + /// To unset the metadata, replace the template without specifying it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta() { - IndexPatternsValue = indexPatterns; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -412,10 +625,17 @@ public PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Client /// To unset the metadata, replace the template without specifying it. /// /// - public PutIndexTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -426,10 +646,10 @@ public PutIndexTemplateRequestDescriptor Meta(Func /// - public PutIndexTemplateRequestDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -438,28 +658,46 @@ public PutIndexTemplateRequestDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? template) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(null); + return this; } - public PutIndexTemplateRequestDescriptor Template(Action> configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template(System.Action? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; } /// @@ -470,96 +708,60 @@ public PutIndexTemplateRequestDescriptor Template(Action /// - public PutIndexTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) - { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); - } - - if (ComposedOfValue is not null) - { - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); - } - - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -602,46 +804,74 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If an entry already exists with the same key, then it is overwritten by the new definition. /// /// -public sealed partial class PutIndexTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct PutIndexTemplateRequestDescriptor { - internal PutIndexTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest Instance { get; init; } - public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutIndexTemplate; + public PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutIndexTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.put_index_template"; + /// + /// + /// Index or template name + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutIndexTemplateRequestDescriptor Cause(string? cause) => Qs("cause", cause); - public PutIndexTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// User defined reason for creating/updating the index template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// If true, this request cannot replace or update existing index templates. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Create(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Create = value; + return this; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection? ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private ICollection? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -650,10 +880,10 @@ public PutIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - public PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? value = true) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.AllowAutoCreate = value; + return this; } /// @@ -662,10 +892,22 @@ public PutIndexTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public PutIndexTemplateRequestDescriptor ComposedOf(ICollection? composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ComposedOf(System.Collections.Generic.ICollection? value) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) + { + Instance.ComposedOf = [.. values]; + return this; } /// @@ -675,28 +917,36 @@ public PutIndexTemplateRequestDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public PutIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(null); + return this; } - public PutIndexTemplateRequestDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(action); + return this; } /// @@ -705,10 +955,10 @@ public PutIndexTemplateRequestDescriptor DataStream(Action /// - public PutIndexTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -717,10 +967,22 @@ public PutIndexTemplateRequestDescriptor Deprecated(bool? deprecated = true) /// references a component template that might not exist /// /// - public PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollection? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(System.Collections.Generic.ICollection? value) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; + } + + /// + /// + /// The configuration option ignore_missing_component_templates can be used when an index template + /// references a component template that might not exist + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(params string[] values) + { + Instance.IgnoreMissingComponentTemplates = [.. values]; + return this; } /// @@ -728,10 +990,10 @@ public PutIndexTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollec /// Name of the index template to create. /// /// - public PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.IndexPatterns = value; + return this; } /// @@ -743,10 +1005,47 @@ public PutIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticse /// To unset the metadata, replace the template without specifying it. /// /// - public PutIndexTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// It may have any contents. + /// It is not automatically generated or used by Elasticsearch. + /// This user-defined object is stored in the cluster state, so keeping it short is preferable + /// To unset the metadata, replace the template without specifying it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// It may have any contents. + /// It is not automatically generated or used by Elasticsearch. + /// This user-defined object is stored in the cluster state, so keeping it short is preferable + /// To unset the metadata, replace the template without specifying it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -757,10 +1056,10 @@ public PutIndexTemplateRequestDescriptor Meta(Func /// - public PutIndexTemplateRequestDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -769,28 +1068,34 @@ public PutIndexTemplateRequestDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? template) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public PutIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(null); + return this; } - public PutIndexTemplateRequestDescriptor Template(Action configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; } /// @@ -801,95 +1106,59 @@ public PutIndexTemplateRequestDescriptor Template(Action /// - public PutIndexTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) - { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); - } - - if (ComposedOfValue is not null) - { - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); - } - - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateResponse.g.cs index ca9c859e0ba..569bd4b954b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndexTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutIndexTemplateResponse : ElasticsearchResponse +internal sealed partial class PutIndexTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponseConverter))] +public sealed partial class PutIndexTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndexTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsRequest.g.cs index 8bb53488e96..092f7376244 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutIndicesSettingsRequestParameters : RequestParameters +public sealed partial class PutIndicesSettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,7 +44,7 @@ public sealed partial class PutIndicesSettingsRequestParameters : RequestParamet /// open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -83,6 +76,15 @@ public sealed partial class PutIndicesSettingsRequestParameters : RequestParamet /// public bool? PreserveExisting { get => Q("preserve_existing"); set => Q("preserve_existing", value); } + /// + /// + /// Whether to close and reopen the index to apply non-dynamic settings. + /// If set to true the indices to which the settings are being applied + /// will be closed temporarily and then reopened in order to apply the changes. + /// + /// + public bool? Reopen { get => Q("reopen"); set => Q("reopen", value); } + /// /// /// Period to wait for a response. If no response is received before the @@ -92,6 +94,19 @@ public sealed partial class PutIndicesSettingsRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutIndicesSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Settings = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Settings, null); + } +} + /// /// /// Update index settings. @@ -114,24 +129,60 @@ public sealed partial class PutIndicesSettingsRequestParameters : RequestParamet /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. /// /// -public sealed partial class PutIndicesSettingsRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestConverter))] +public sealed partial class PutIndicesSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public PutIndicesSettingsRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } - public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) : base(r => r.Optional("index", indices)) { + Settings = settings; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutSettings; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + { + Settings = settings; + } +#if NET7_0_OR_GREATER + public PutIndicesSettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PutIndicesSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutSettings; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_settings"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index @@ -141,7 +192,6 @@ public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -152,15 +202,13 @@ public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// @@ -168,7 +216,6 @@ public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// If true, returns settings in flat format. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -178,7 +225,6 @@ public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -186,24 +232,29 @@ public PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Indices? indices) /// If true, existing index settings remain unchanged. /// /// - [JsonIgnore] public bool? PreserveExisting { get => Q("preserve_existing"); set => Q("preserve_existing", value); } + /// + /// + /// Whether to close and reopen the index to apply non-dynamic settings. + /// If set to true the indices to which the settings are being applied + /// will be closed temporarily and then reopened in order to apply the changes. + /// + /// + public bool? Reopen { get => Q("reopen"); set => Q("reopen", value); } + /// /// /// Period to wait for a response. If no response is received before the /// timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } - [JsonIgnore] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Settings { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Settings, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Settings { get; set; } } /// @@ -228,65 +279,230 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. /// /// -public sealed partial class PutIndicesSettingsRequestDescriptor : RequestDescriptor, PutIndicesSettingsRequestParameters> +public readonly partial struct PutIndicesSettingsRequestDescriptor { - internal PutIndicesSettingsRequestDescriptor(Action> configure) => configure.Invoke(this); - public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) => SettingsValue = settings; - public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) => SettingsValue = settings; + internal Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutSettings; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(indices); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public PutIndicesSettingsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "indices.put_settings"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index + /// alias, or _all value targets only missing or closed indices. This + /// behavior applies even if the request targets other open indices. For + /// example, a request targeting foo*,bar* returns an error if an index + /// starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public PutIndicesSettingsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutIndicesSettingsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutIndicesSettingsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public PutIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public PutIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutIndicesSettingsRequestDescriptor PreserveExisting(bool? preserveExisting = true) => Qs("preserve_existing", preserveExisting); - public PutIndicesSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Type of index that wildcard patterns can match. If the request can target + /// data streams, this argument determines whether wildcard expressions match + /// hidden data streams. Supports comma-separated values, such as + /// open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public PutIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Type of index that wildcard patterns can match. If the request can target + /// data streams, this argument determines whether wildcard expressions match + /// hidden data streams. Supports comma-separated values, such as + /// open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - RouteValues.Optional("index", indices); - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - public PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? value = true) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// If true, existing index settings remain unchanged. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor PreserveExisting(bool? value = true) + { + Instance.PreserveExisting = value; + return this; + } + + /// + /// + /// Whether to close and reopen the index to apply non-dynamic settings. + /// If set to true the indices to which the settings are being applied + /// will be closed temporarily and then reopened in order to apply the changes. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Reopen(bool? value = true) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Reopen = value; + return this; } - public PutIndicesSettingsRequestDescriptor Settings(Action> configure) + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings() { - JsonSerializer.Serialize(writer, SettingsValue, options); + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -312,64 +528,223 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. /// /// -public sealed partial class PutIndicesSettingsRequestDescriptor : RequestDescriptor +public readonly partial struct PutIndicesSettingsRequestDescriptor { - internal PutIndicesSettingsRequestDescriptor(Action configure) => configure.Invoke(this); - public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) => SettingsValue = settings; - public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) => SettingsValue = settings; + internal Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutSettings; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(indices); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public PutIndicesSettingsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "indices.put_settings"; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor descriptor) => descriptor.Instance; - public PutIndicesSettingsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutIndicesSettingsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutIndicesSettingsRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public PutIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public PutIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutIndicesSettingsRequestDescriptor PreserveExisting(bool? preserveExisting = true) => Qs("preserve_existing", preserveExisting); - public PutIndicesSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit + /// the request. Supports wildcards (*). To target all data streams and + /// indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index + /// alias, or _all value targets only missing or closed indices. This + /// behavior applies even if the request targets other open indices. For + /// example, a request targeting foo*,bar* returns an error if an index + /// starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target + /// data streams, this argument determines whether wildcard expressions match + /// hidden data streams. Supports comma-separated values, such as + /// open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public PutIndicesSettingsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Type of index that wildcard patterns can match. If the request can target + /// data streams, this argument determines whether wildcard expressions match + /// hidden data streams. Supports comma-separated values, such as + /// open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - RouteValues.Optional("index", indices); - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// If true, existing index settings remain unchanged. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor PreserveExisting(bool? value = true) + { + Instance.PreserveExisting = value; + return this; + } + + /// + /// + /// Whether to close and reopen the index to apply non-dynamic settings. + /// If set to true the indices to which the settings are being applied + /// will be closed temporarily and then reopened in order to apply the changes. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Reopen(bool? value = true) + { + Instance.Reopen = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) + { + Instance.Settings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor Pretty(bool? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Pretty = value; + return this; } - public PutIndicesSettingsRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor SourceQueryString(string? value) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public PutIndicesSettingsRequestDescriptor Settings(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, SettingsValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsResponse.g.cs index f5ada21c60d..6f03c73ac83 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutIndicesSettingsResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutIndicesSettingsResponse : ElasticsearchResponse +internal sealed partial class PutIndicesSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponseConverter))] +public sealed partial class PutIndicesSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIndicesSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIndicesSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingRequest.g.cs index d4375cf1a3d..ebccfe90c59 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutMappingRequestParameters : RequestParameters +public sealed partial class PutMappingRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class PutMappingRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -81,6 +74,135 @@ public sealed partial class PutMappingRequestParameters : RequestParameters public bool? WriteIndexOnly { get => Q("write_index_only"); set => Q("write_index_only", value); } } +internal sealed partial class PutMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDateDetection = System.Text.Json.JsonEncodedText.Encode("date_detection"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicDateFormats = System.Text.Json.JsonEncodedText.Encode("dynamic_date_formats"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicTemplates = System.Text.Json.JsonEncodedText.Encode("dynamic_templates"); + private static readonly System.Text.Json.JsonEncodedText PropFieldNames = System.Text.Json.JsonEncodedText.Encode("_field_names"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropNumericDetection = System.Text.Json.JsonEncodedText.Encode("numeric_detection"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropRuntime = System.Text.Json.JsonEncodedText.Encode("runtime"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDateDetection = default; + LocalJsonValue propDynamic = default; + LocalJsonValue?> propDynamicDateFormats = default; + LocalJsonValue>?> propDynamicTemplates = default; + LocalJsonValue propFieldNames = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNumericDetection = default; + LocalJsonValue propProperties = default; + LocalJsonValue propRouting = default; + LocalJsonValue?> propRuntime = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDateDetection.TryReadProperty(ref reader, options, PropDateDetection, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propDynamicDateFormats.TryReadProperty(ref reader, options, PropDynamicDateFormats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDynamicTemplates.TryReadProperty(ref reader, options, PropDynamicTemplates, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propFieldNames.TryReadProperty(ref reader, options, PropFieldNames, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNumericDetection.TryReadProperty(ref reader, options, PropNumericDetection, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propRuntime.TryReadProperty(ref reader, options, PropRuntime, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DateDetection = propDateDetection.Value, + Dynamic = propDynamic.Value, + DynamicDateFormats = propDynamicDateFormats.Value, + DynamicTemplates = propDynamicTemplates.Value, + FieldNames = propFieldNames.Value, + Meta = propMeta.Value, + NumericDetection = propNumericDetection.Value, + Properties = propProperties.Value, + Routing = propRouting.Value, + Runtime = propRuntime.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDateDetection, value.DateDetection, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropDynamicDateFormats, value.DynamicDateFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDynamicTemplates, value.DynamicTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropFieldNames, value.FieldNames, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNumericDetection, value.NumericDetection, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropRuntime, value.Runtime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update field mappings. @@ -123,27 +245,49 @@ public sealed partial class PutMappingRequestParameters : RequestParameters /// Instead, add an alias field to create an alternate field name. /// /// -public sealed partial class PutMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestConverter))] +public sealed partial class PutMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public PutMappingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_mapping"; + /// + /// + /// A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -154,15 +298,13 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -171,7 +313,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -180,7 +321,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -188,7 +328,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// If true, the mappings are applied only to the current write index for the target. /// /// - [JsonIgnore] public bool? WriteIndexOnly { get => Q("write_index_only"); set => Q("write_index_only", value); } /// @@ -196,7 +335,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Controls whether dynamic date detection is enabled. /// /// - [JsonInclude, JsonPropertyName("date_detection")] public bool? DateDetection { get; set; } /// @@ -204,7 +342,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Controls whether new fields are added dynamically. /// /// - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } /// @@ -214,23 +351,20 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// a new date field is added instead of string. /// /// - [JsonInclude, JsonPropertyName("dynamic_date_formats")] - public ICollection? DynamicDateFormats { get; set; } + public System.Collections.Generic.ICollection? DynamicDateFormats { get; set; } /// /// /// Specify dynamic templates for the mapping. /// /// - [JsonInclude, JsonPropertyName("dynamic_templates")] - public ICollection>? DynamicTemplates { get; set; } + public System.Collections.Generic.ICollection>? DynamicTemplates { get; set; } /// /// /// Control whether field names are enabled for the index. /// /// - [JsonInclude, JsonPropertyName("_field_names")] public Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNames { get; set; } /// @@ -240,15 +374,13 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// application-specific metadata. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// /// Automatically map strings into numeric data types for all fields. /// /// - [JsonInclude, JsonPropertyName("numeric_detection")] public bool? NumericDetection { get; set; } /// @@ -273,7 +405,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// /// /// - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } /// @@ -281,7 +412,6 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Enable making a routing value required on indexed documents. /// /// - [JsonInclude, JsonPropertyName("_routing")] public Elastic.Clients.Elasticsearch.Mapping.RoutingField? Routing { get; set; } /// @@ -289,15 +419,13 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Mapping of runtime fields for the index. /// /// - [JsonInclude, JsonPropertyName("runtime")] - public IDictionary? Runtime { get; set; } + public System.Collections.Generic.IDictionary? Runtime { get; set; } /// /// /// Control whether the _source field is enabled on the index. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Mapping.SourceField? Source { get; set; } } @@ -343,532 +471,286 @@ public PutMappingRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r /// Instead, add an alias field to create an alternate field name. /// /// -public sealed partial class PutMappingRequestDescriptor : RequestDescriptor, PutMappingRequestParameters> +public readonly partial struct PutMappingRequestDescriptor { - internal PutMappingRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest Instance { get; init; } - public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest instance) { + Instance = instance; } - public PutMappingRequestDescriptor() : this(typeof(TDocument)) + public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutMapping; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "indices.put_mapping"; - - public PutMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public PutMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutMappingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public PutMappingRequestDescriptor WriteIndexOnly(bool? writeIndexOnly = true) => Qs("write_index_only", writeIndexOnly); - - public PutMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutMappingRequestDescriptor() { - RouteValues.Required("index", indices); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private bool? DateDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private ICollection? DynamicDateFormatsValue { get; set; } - private ICollection>? DynamicTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNamesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor FieldNamesDescriptor { get; set; } - private Action FieldNamesDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NumericDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingField? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private IDictionary> RuntimeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceField? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// Controls whether dynamic date detection is enabled. + /// A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices. /// /// - public PutMappingRequestDescriptor DateDetection(bool? dateDetection = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - DateDetectionValue = dateDetection; - return Self; + Instance.Indices = value; + return this; } /// /// - /// Controls whether new fields are added dynamically. + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. /// /// - public PutMappingRequestDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AllowNoIndices(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.AllowNoIndices = value; + return this; } /// /// - /// If date detection is enabled then new string fields are checked - /// against 'dynamic_date_formats' and if the value matches then - /// a new date field is added instead of string. + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. /// /// - public PutMappingRequestDescriptor DynamicDateFormats(ICollection? dynamicDateFormats) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - DynamicDateFormatsValue = dynamicDateFormats; - return Self; + Instance.ExpandWildcards = value; + return this; } /// /// - /// Specify dynamic templates for the mapping. + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. /// /// - public PutMappingRequestDescriptor DynamicTemplates(ICollection>? dynamicTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - DynamicTemplatesValue = dynamicTemplates; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } /// /// - /// Control whether field names are enabled for the index. + /// If false, the request returns an error if it targets a missing or closed index. /// /// - public PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? fieldNames) - { - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = null; - FieldNamesValue = fieldNames; - return Self; - } - - public PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor descriptor) - { - FieldNamesValue = null; - FieldNamesDescriptorAction = null; - FieldNamesDescriptor = descriptor; - return Self; - } - - public PutMappingRequestDescriptor FieldNames(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor IgnoreUnavailable(bool? value = true) { - FieldNamesValue = null; - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = configure; - return Self; + Instance.IgnoreUnavailable = value; + return this; } /// /// - /// A mapping type can have custom meta data associated with it. These are - /// not used at all by Elasticsearch, but can be used to store - /// application-specific metadata. + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - public PutMappingRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.MasterTimeout = value; + return this; } /// /// - /// Automatically map strings into numeric data types for all fields. + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - public PutMappingRequestDescriptor NumericDetection(bool? numericDetection = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - NumericDetectionValue = numericDetection; - return Self; + Instance.Timeout = value; + return this; } /// /// - /// Mapping for a field. For new fields, this mapping can include: - /// - /// - /// - /// - /// Field name - /// - /// - /// - /// - /// Field data type - /// - /// - /// - /// - /// Mapping parameters + /// If true, the mappings are applied only to the current write index for the target. /// - /// - /// /// - public PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) - { - PropertiesValue = properties; - return Self; - } - - public PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) - { - PropertiesValue = descriptor.PromisedValue; - return Self; - } - - public PutMappingRequestDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor WriteIndexOnly(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.WriteIndexOnly = value; + return this; } /// /// - /// Enable making a routing value required on indexed documents. + /// Controls whether dynamic date detection is enabled. /// /// - public PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DateDetection(bool? value = true) { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.DateDetection = value; + return this; } - public PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor descriptor) + /// + /// + /// Controls whether new fields are added dynamically. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.Dynamic = value; + return this; } - public PutMappingRequestDescriptor Routing(Action configure) + /// + /// + /// If date detection is enabled then new string fields are checked + /// against 'dynamic_date_formats' and if the value matches then + /// a new date field is added instead of string. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicDateFormats(System.Collections.Generic.ICollection? value) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.DynamicDateFormats = value; + return this; } /// /// - /// Mapping of runtime fields for the index. + /// If date detection is enabled then new string fields are checked + /// against 'dynamic_date_formats' and if the value matches then + /// a new date field is added instead of string. /// /// - public PutMappingRequestDescriptor Runtime(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicDateFormats(params string[] values) { - RuntimeValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.DynamicDateFormats = [.. values]; + return this; } /// /// - /// Control whether the _source field is enabled on the index. + /// Specify dynamic templates for the mapping. /// /// - public PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? source) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates(System.Collections.Generic.ICollection>? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.DynamicTemplates = value; + return this; } - public PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor descriptor) + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates() { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(null); + return this; } - public PutMappingRequestDescriptor Source(Action configure) + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates(System.Action? action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates(System.Action>? action) { - writer.WriteStartObject(); - if (DateDetectionValue.HasValue) - { - writer.WritePropertyName("date_detection"); - writer.WriteBooleanValue(DateDetectionValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (DynamicDateFormatsValue is not null) - { - writer.WritePropertyName("dynamic_date_formats"); - JsonSerializer.Serialize(writer, DynamicDateFormatsValue, options); - } - - if (DynamicTemplatesValue is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, DynamicTemplatesValue, options); - } - - if (FieldNamesDescriptor is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesDescriptor, options); - } - else if (FieldNamesDescriptorAction is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(FieldNamesDescriptorAction), options); - } - else if (FieldNamesValue is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NumericDetectionValue.HasValue) - { - writer.WritePropertyName("numeric_detection"); - writer.WriteBooleanValue(NumericDetectionValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (RuntimeValue is not null) - { - writer.WritePropertyName("runtime"); - JsonSerializer.Serialize(writer, RuntimeValue, options); - } - - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - writer.WriteEndObject(); + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; } -} - -/// -/// -/// Update field mappings. -/// Add new fields to an existing data stream or index. -/// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. -/// For data streams, these changes are applied to all backing indices by default. -/// -/// -/// Add multi-fields to an existing field -/// -/// -/// Multi-fields let you index the same field in different ways. -/// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. -/// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. -/// You can populate the new multi-field with the update by query API. -/// -/// -/// Change supported mapping parameters for an existing field -/// -/// -/// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. -/// For example, you can use the update mapping API to update the ignore_above parameter. -/// -/// -/// Change the mapping of an existing field -/// -/// -/// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. -/// Changing an existing field could invalidate data that's already indexed. -/// -/// -/// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. -/// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. -/// -/// -/// Rename a field -/// -/// -/// Renaming a field would invalidate data already indexed under the old field name. -/// Instead, add an alias field to create an alternate field name. -/// -/// -public sealed partial class PutMappingRequestDescriptor : RequestDescriptor -{ - internal PutMappingRequestDescriptor(Action configure) => configure.Invoke(this); - public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddDynamicTemplate(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) { + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutMapping; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "indices.put_mapping"; - - public PutMappingRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutMappingRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutMappingRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public PutMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutMappingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public PutMappingRequestDescriptor WriteIndexOnly(bool? writeIndexOnly = true) => Qs("write_index_only", writeIndexOnly); - - public PutMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddDynamicTemplate(string key, System.Action action) { - RouteValues.Required("index", indices); - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; } - private bool? DateDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private ICollection? DynamicDateFormatsValue { get; set; } - private ICollection>? DynamicTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNamesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor FieldNamesDescriptor { get; set; } - private Action FieldNamesDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NumericDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingField? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private IDictionary RuntimeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceField? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - - /// - /// - /// Controls whether dynamic date detection is enabled. - /// - /// - public PutMappingRequestDescriptor DateDetection(bool? dateDetection = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddDynamicTemplate(string key, System.Action> action) { - DateDetectionValue = dateDetection; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; } /// /// - /// Controls whether new fields are added dynamically. + /// Control whether field names are enabled for the index. /// /// - public PutMappingRequestDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? value) { - DynamicValue = dynamic; - return Self; + Instance.FieldNames = value; + return this; } /// /// - /// If date detection is enabled then new string fields are checked - /// against 'dynamic_date_formats' and if the value matches then - /// a new date field is added instead of string. + /// Control whether field names are enabled for the index. /// /// - public PutMappingRequestDescriptor DynamicDateFormats(ICollection? dynamicDateFormats) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FieldNames(System.Action action) { - DynamicDateFormatsValue = dynamicDateFormats; - return Self; + Instance.FieldNames = Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor.Build(action); + return this; } /// /// - /// Specify dynamic templates for the mapping. + /// A mapping type can have custom meta data associated with it. These are + /// not used at all by Elasticsearch, but can be used to store + /// application-specific metadata. /// /// - public PutMappingRequestDescriptor DynamicTemplates(ICollection>? dynamicTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - DynamicTemplatesValue = dynamicTemplates; - return Self; + Instance.Meta = value; + return this; } /// /// - /// Control whether field names are enabled for the index. + /// A mapping type can have custom meta data associated with it. These are + /// not used at all by Elasticsearch, but can be used to store + /// application-specific metadata. /// /// - public PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? fieldNames) - { - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = null; - FieldNamesValue = fieldNames; - return Self; - } - - public PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor descriptor) - { - FieldNamesValue = null; - FieldNamesDescriptorAction = null; - FieldNamesDescriptor = descriptor; - return Self; - } - - public PutMappingRequestDescriptor FieldNames(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta() { - FieldNamesValue = null; - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = configure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -878,10 +760,17 @@ public PutMappingRequestDescriptor FieldNames(Action /// - public PutMappingRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -889,10 +778,10 @@ public PutMappingRequestDescriptor Meta(Func, F /// Automatically map strings into numeric data types for all fields. /// /// - public PutMappingRequestDescriptor NumericDetection(bool? numericDetection = true) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor NumericDetection(bool? value = true) { - NumericDetectionValue = numericDetection; - return Self; + Instance.NumericDetection = value; + return this; } /// @@ -917,24 +806,66 @@ public PutMappingRequestDescriptor NumericDetection(bool? numericDetection = tru /// /// /// - public PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) - { - PropertiesValue = descriptor.PromisedValue; - return Self; - } - - public PutMappingRequestDescriptor Properties(Action> configure) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + /// + /// + /// Mapping for a field. For new fields, this mapping can include: + /// + /// + /// + /// + /// Field name + /// + /// + /// + /// + /// Field data type + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Properties(System.Action action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + /// + /// + /// Mapping for a field. For new fields, this mapping can include: + /// + /// + /// + /// + /// Field name + /// + /// + /// + /// + /// Field data type + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } /// @@ -942,28 +873,54 @@ public PutMappingRequestDescriptor Properties(Action /// - public PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Enable making a routing value required on indexed documents. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Routing(System.Action action) + { + Instance.Routing = Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor.Build(action); + return this; + } + + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime(System.Collections.Generic.IDictionary? value) { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.Runtime = value; + return this; } - public PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor descriptor) + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime() { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } - public PutMappingRequestDescriptor Routing(Action configure) + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime(System.Action? action) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } /// @@ -971,10 +928,52 @@ public PutMappingRequestDescriptor Routing(Action /// - public PutMappingRequestDescriptor Runtime(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime(System.Action>? action) + { + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RuntimeValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// @@ -982,129 +981,640 @@ public PutMappingRequestDescriptor Runtime(Func /// - public PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? source) + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor descriptor) + /// + /// + /// Control whether the _source field is enabled on the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source() { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(null); + return this; } - public PutMappingRequestDescriptor Source(Action configure) + /// + /// + /// Control whether the _source field is enabled on the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source(System.Action? action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest Build(System.Action action) { - writer.WriteStartObject(); - if (DateDetectionValue.HasValue) - { - writer.WritePropertyName("date_detection"); - writer.WriteBooleanValue(DateDetectionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (DynamicDateFormatsValue is not null) - { - writer.WritePropertyName("dynamic_date_formats"); - JsonSerializer.Serialize(writer, DynamicDateFormatsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (DynamicTemplatesValue is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, DynamicTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (FieldNamesDescriptor is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesDescriptor, options); - } - else if (FieldNamesDescriptorAction is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(FieldNamesDescriptorAction), options); - } - else if (FieldNamesValue is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (NumericDetectionValue.HasValue) - { - writer.WritePropertyName("numeric_detection"); - writer.WriteBooleanValue(NumericDetectionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } +/// +/// +/// Update field mappings. +/// Add new fields to an existing data stream or index. +/// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. +/// For data streams, these changes are applied to all backing indices by default. +/// +/// +/// Add multi-fields to an existing field +/// +/// +/// Multi-fields let you index the same field in different ways. +/// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. +/// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. +/// You can populate the new multi-field with the update by query API. +/// +/// +/// Change supported mapping parameters for an existing field +/// +/// +/// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. +/// For example, you can use the update mapping API to update the ignore_above parameter. +/// +/// +/// Change the mapping of an existing field +/// +/// +/// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. +/// Changing an existing field could invalidate data that's already indexed. +/// +/// +/// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. +/// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. +/// +/// +/// Rename a field +/// +/// +/// Renaming a field would invalidate data already indexed under the old field name. +/// Instead, add an alias field to create an alternate field name. +/// +/// +public readonly partial struct PutMappingRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest Instance { get; init; } - if (RuntimeValue is not null) - { - writer.WritePropertyName("runtime"); - JsonSerializer.Serialize(writer, RuntimeValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest instance) + { + Instance = instance; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(indices); + } - writer.WriteEndObject(); + public PutMappingRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, the mappings are applied only to the current write index for the target. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor WriteIndexOnly(bool? value = true) + { + Instance.WriteIndexOnly = value; + return this; + } + + /// + /// + /// Controls whether dynamic date detection is enabled. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DateDetection(bool? value = true) + { + Instance.DateDetection = value; + return this; + } + + /// + /// + /// Controls whether new fields are added dynamically. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) + { + Instance.Dynamic = value; + return this; + } + + /// + /// + /// If date detection is enabled then new string fields are checked + /// against 'dynamic_date_formats' and if the value matches then + /// a new date field is added instead of string. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicDateFormats(System.Collections.Generic.ICollection? value) + { + Instance.DynamicDateFormats = value; + return this; + } + + /// + /// + /// If date detection is enabled then new string fields are checked + /// against 'dynamic_date_formats' and if the value matches then + /// a new date field is added instead of string. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicDateFormats(params string[] values) + { + Instance.DynamicDateFormats = [.. values]; + return this; + } + + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates(System.Collections.Generic.ICollection>? value) + { + Instance.DynamicTemplates = value; + return this; + } + + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates() + { + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(null); + return this; + } + + /// + /// + /// Specify dynamic templates for the mapping. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor DynamicTemplates(System.Action>? action) + { + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddDynamicTemplate(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) + { + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddDynamicTemplate(string key, System.Action> action) + { + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; + } + + /// + /// + /// Control whether field names are enabled for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? value) + { + Instance.FieldNames = value; + return this; + } + + /// + /// + /// Control whether field names are enabled for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FieldNames(System.Action action) + { + Instance.FieldNames = Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor.Build(action); + return this; + } + + /// + /// + /// A mapping type can have custom meta data associated with it. These are + /// not used at all by Elasticsearch, but can be used to store + /// application-specific metadata. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// A mapping type can have custom meta data associated with it. These are + /// not used at all by Elasticsearch, but can be used to store + /// application-specific metadata. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// A mapping type can have custom meta data associated with it. These are + /// not used at all by Elasticsearch, but can be used to store + /// application-specific metadata. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + /// + /// + /// Automatically map strings into numeric data types for all fields. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor NumericDetection(bool? value = true) + { + Instance.NumericDetection = value; + return this; + } + + /// + /// + /// Mapping for a field. For new fields, this mapping can include: + /// + /// + /// + /// + /// Field name + /// + /// + /// + /// + /// Field data type + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Properties = value; + return this; + } + + /// + /// + /// Mapping for a field. For new fields, this mapping can include: + /// + /// + /// + /// + /// Field name + /// + /// + /// + /// + /// Field data type + /// + /// + /// + /// + /// Mapping parameters + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + /// + /// + /// Enable making a routing value required on indexed documents. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Enable making a routing value required on indexed documents. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Routing(System.Action action) + { + Instance.Routing = Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor.Build(action); + return this; + } + + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime(System.Collections.Generic.IDictionary? value) + { + Instance.Runtime = value; + return this; + } + + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime() + { + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + /// + /// + /// Mapping of runtime fields for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Runtime(System.Action>? action) + { + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor AddRuntime(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Control whether the _source field is enabled on the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Control whether the _source field is enabled on the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source() + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(null); + return this; + } + + /// + /// + /// Control whether the _source field is enabled on the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Source(System.Action? action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingResponse.g.cs index ee2d54544d5..7b0d41d7d7b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutMappingResponse.g.cs @@ -17,24 +17,83 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutMappingResponse : ElasticsearchResponse +internal sealed partial class PutMappingResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponseConverter))] +public sealed partial class PutMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs index 3c6067ef0eb..13b4e0abdbb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs @@ -17,21 +17,19 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutTemplateRequestParameters : RequestParameters +public sealed partial class PutTemplateRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// User defined reason for creating/updating the index template + /// + /// public string? Cause { get => Q("cause"); set => Q("cause", value); } /// @@ -50,6 +48,90 @@ public sealed partial class PutTemplateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class PutTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue?> propIndexPatterns = default; + LocalJsonValue propMappings = default; + LocalJsonValue propOrder = default; + LocalJsonValue propSettings = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + IndexPatterns = propIndexPatterns.Value, + Mappings = propMappings.Value, + Order = propOrder.Value, + Settings = propSettings.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update an index template. @@ -81,21 +163,48 @@ public sealed partial class PutTemplateRequestParameters : RequestParameters /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. /// /// -public sealed partial class PutTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestConverter))] +public sealed partial class PutTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementPutTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.put_template"; - [JsonIgnore] + /// + /// + /// The name of the template + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// User defined reason for creating/updating the index template + /// + /// public string? Cause { get => Q("cause"); set => Q("cause", value); } /// @@ -103,7 +212,6 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// If true, this request cannot replace or update existing index templates. /// /// - [JsonIgnore] public bool? Create { get => Q("create"); set => Q("create", value); } /// @@ -112,7 +220,6 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -120,8 +227,7 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// Aliases for the index. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// @@ -129,16 +235,13 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// of indices during creation. /// /// - [JsonInclude, JsonPropertyName("index_patterns")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? IndexPatterns { get; set; } + public System.Collections.Generic.ICollection? IndexPatterns { get; set; } /// /// /// Mapping for fields in the index. /// /// - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } /// @@ -151,7 +254,6 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// 'order' values are merged later, overriding templates with lower values. /// /// - [JsonInclude, JsonPropertyName("order")] public int? Order { get; set; } /// @@ -159,7 +261,6 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// Configuration options for the index. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } /// @@ -169,7 +270,6 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// To unset a version, replace the template without specifying one. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } @@ -204,52 +304,173 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. /// /// -public sealed partial class PutTemplateRequestDescriptor : RequestDescriptor, PutTemplateRequestParameters> +public readonly partial struct PutTemplateRequestDescriptor { - internal PutTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest Instance { get; init; } - public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutTemplate; + public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.put_template"; + /// + /// + /// The name of the template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutTemplateRequestDescriptor Cause(string? cause) => Qs("cause", cause); - public PutTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// User defined reason for creating/updating the index template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// If true, this request cannot replace or update existing index templates. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Create(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Create = value; + return this; } - private IDictionary> AliasesValue { get; set; } - private ICollection? IndexPatternsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private int? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// /// Aliases for the index. /// /// - public PutTemplateRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases = value; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(System.Action? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } /// @@ -258,10 +479,22 @@ public PutTemplateRequestDescriptor Aliases(Func /// - public PutTemplateRequestDescriptor IndexPatterns(ICollection? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor IndexPatterns(System.Collections.Generic.ICollection? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Array of wildcard expressions used to match the names + /// of indices during creation. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor IndexPatterns(params string[] values) + { + Instance.IndexPatterns = [.. values]; + return this; } /// @@ -269,28 +502,43 @@ public PutTemplateRequestDescriptor IndexPatterns(ICollection /// Mapping for fields in the index. /// /// - public PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public PutTemplateRequestDescriptor Mappings(Action> configure) + /// + /// + /// Mapping for fields in the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings(System.Action? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// Mapping for fields in the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings(System.Action>? action) + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -303,10 +551,21 @@ public PutTemplateRequestDescriptor Mappings(Action /// - public PutTemplateRequestDescriptor Order(int? order) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Order(int? value) + { + Instance.Order = value; + return this; + } + + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - OrderValue = order; - return Self; + Instance.Settings = value; + return this; } /// @@ -314,28 +573,32 @@ public PutTemplateRequestDescriptor Order(int? order) /// Configuration options for the index. /// /// - public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings() { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public PutTemplateRequestDescriptor Settings(Action> configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -345,72 +608,60 @@ public PutTemplateRequestDescriptor Settings(Action /// - public PutTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - SingleOrManySerializationHelper.Serialize(IndexPatternsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (OrderValue.HasValue) - { - writer.WritePropertyName("order"); - writer.WriteNumberValue(OrderValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -445,52 +696,155 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. /// /// -public sealed partial class PutTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct PutTemplateRequestDescriptor { - internal PutTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest Instance { get; init; } - public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementPutTemplate; + public PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.put_template"; + /// + /// + /// The name of the template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// User defined reason for creating/updating the index template + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public PutTemplateRequestDescriptor Cause(string? cause) => Qs("cause", cause); - public PutTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public PutTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// If true, this request cannot replace or update existing index templates. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Create(bool? value = true) + { + Instance.Create = value; + return this; + } - public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Period to wait for a connection to the master node. If no response is + /// received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("name", name); - return Self; + Instance.MasterTimeout = value; + return this; } - private IDictionary AliasesValue { get; set; } - private ICollection? IndexPatternsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private int? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } /// /// /// Aliases for the index. /// /// - public PutTemplateRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases() { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } /// @@ -499,10 +853,22 @@ public PutTemplateRequestDescriptor Aliases(Func /// - public PutTemplateRequestDescriptor IndexPatterns(ICollection? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor IndexPatterns(System.Collections.Generic.ICollection? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Array of wildcard expressions used to match the names + /// of indices during creation. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor IndexPatterns(params string[] values) + { + Instance.IndexPatterns = [.. values]; + return this; } /// @@ -510,28 +876,32 @@ public PutTemplateRequestDescriptor IndexPatterns(ICollection? indexPatt /// Mapping for fields in the index. /// /// - public PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public PutTemplateRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public PutTemplateRequestDescriptor Mappings(Action configure) + /// + /// + /// Mapping for fields in the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -544,10 +914,10 @@ public PutTemplateRequestDescriptor Mappings(Action /// - public PutTemplateRequestDescriptor Order(int? order) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Order(int? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -555,28 +925,32 @@ public PutTemplateRequestDescriptor Order(int? order) /// Configuration options for the index. /// /// - public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public PutTemplateRequestDescriptor Settings(Action configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -586,71 +960,59 @@ public PutTemplateRequestDescriptor Settings(Action /// - public PutTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - SingleOrManySerializationHelper.Serialize(IndexPatternsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (OrderValue.HasValue) - { - writer.WritePropertyName("order"); - writer.WriteNumberValue(OrderValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateResponse.g.cs index 45918fda300..bf1b51b6783 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class PutTemplateResponse : ElasticsearchResponse +internal sealed partial class PutTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponseConverter))] +public sealed partial class PutTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryRequest.g.cs index 2b970903d67..e2fc37d2c1e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RecoveryRequestParameters : RequestParameters +public sealed partial class RecoveryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,6 +40,35 @@ public sealed partial class RecoveryRequestParameters : RequestParameters public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } } +internal sealed partial class RecoveryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get index recovery information. @@ -104,30 +126,50 @@ public sealed partial class RecoveryRequestParameters : RequestParameters /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. /// /// -public sealed partial class RecoveryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestConverter))] +public sealed partial class RecoveryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public RecoveryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public RecoveryRequest() { } - - public RecoveryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public RecoveryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRecovery; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementRecovery; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.recovery"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If true, the response only includes ongoing shard recoveries. /// /// - [JsonIgnore] public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } /// @@ -135,7 +177,6 @@ public RecoveryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// If true, the response includes detailed information about shard recoveries. /// /// - [JsonIgnore] public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } } @@ -196,37 +237,117 @@ public RecoveryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. /// /// -public sealed partial class RecoveryRequestDescriptor : RequestDescriptor, RecoveryRequestParameters> +public readonly partial struct RecoveryRequestDescriptor { - internal RecoveryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest instance) + { + Instance = instance; + } - public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(indices); } public RecoveryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRecovery; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If true, the response only includes ongoing shard recoveries. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor ActiveOnly(bool? value = true) + { + Instance.ActiveOnly = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the response includes detailed information about shard recoveries. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Detailed(bool? value = true) + { + Instance.Detailed = value; + return this; + } - internal override string OperationName => "indices.recovery"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public RecoveryRequestDescriptor ActiveOnly(bool? activeOnly = true) => Qs("active_only", activeOnly); - public RecoveryRequestDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed); + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public RecoveryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Human(bool? value) { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -287,36 +408,116 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. /// /// -public sealed partial class RecoveryRequestDescriptor : RequestDescriptor +public readonly partial struct RecoveryRequestDescriptor { - internal RecoveryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest instance) + { + Instance = instance; + } - public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(indices); } public RecoveryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRecovery; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, the response only includes ongoing shard recoveries. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor ActiveOnly(bool? value = true) + { + Instance.ActiveOnly = value; + return this; + } - internal override string OperationName => "indices.recovery"; + /// + /// + /// If true, the response includes detailed information about shard recoveries. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Detailed(bool? value = true) + { + Instance.Detailed = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public RecoveryRequestDescriptor ActiveOnly(bool? activeOnly = true) => Qs("active_only", activeOnly); - public RecoveryRequestDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed); + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RecoveryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryResponse.g.cs index a072a6f90b2..04306e39437 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RecoveryResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RecoveryResponse : DictionaryResponse +internal sealed partial class RecoveryResponseConverter : System.Text.Json.Serialization.JsonConverter { - public RecoveryResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Statuses = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public RecoveryResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Statuses, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponseConverter))] +public sealed partial class RecoveryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Statuses { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshRequest.g.cs index abecc21a22e..c9a3213b715 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RefreshRequestParameters : RequestParameters +public sealed partial class RefreshRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class RefreshRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -58,6 +51,35 @@ public sealed partial class RefreshRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } +internal sealed partial class RefreshRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Refresh an index. @@ -80,31 +102,51 @@ public sealed partial class RefreshRequestParameters : RequestParameters /// This option ensures the indexing operation waits for a periodic refresh before running the search. /// /// -public sealed partial class RefreshRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestConverter))] +public sealed partial class RefreshRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public RefreshRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public RefreshRequest() { } - - public RefreshRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public RefreshRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRefresh; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementRefresh; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.refresh"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -115,15 +157,13 @@ public RefreshRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r = /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } @@ -149,38 +189,146 @@ public RefreshRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r = /// This option ensures the indexing operation waits for a periodic refresh before running the search. /// /// -public sealed partial class RefreshRequestDescriptor : RequestDescriptor, RefreshRequestParameters> +public readonly partial struct RefreshRequestDescriptor { - internal RefreshRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest instance) + { + Instance = instance; + } - public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(indices); } public RefreshRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRefresh; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.refresh"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public RefreshRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public RefreshRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public RefreshRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public RefreshRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -206,37 +354,145 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This option ensures the indexing operation waits for a periodic refresh before running the search. /// /// -public sealed partial class RefreshRequestDescriptor : RequestDescriptor +public readonly partial struct RefreshRequestDescriptor { - internal RefreshRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest Instance { get; init; } - public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest instance) { + Instance = instance; + } + + public RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(indices); } public RefreshRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRefresh; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.refresh"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public RefreshRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public RefreshRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public RefreshRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RefreshRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshResponse.g.cs index 173d7f57182..e8448020648 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RefreshResponse.g.cs @@ -17,17 +17,64 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RefreshResponse : ElasticsearchResponse +internal sealed partial class RefreshResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponseConverter))] +public sealed partial class RefreshResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RefreshResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RefreshResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersRequest.g.cs index 736815127c6..ea63689b475 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ReloadSearchAnalyzersRequestParameters : RequestParameters +public sealed partial class ReloadSearchAnalyzersRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -44,7 +37,7 @@ public sealed partial class ReloadSearchAnalyzersRequestParameters : RequestPara /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -52,6 +45,42 @@ public sealed partial class ReloadSearchAnalyzersRequestParameters : RequestPara /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Changed resource to reload analyzers from if applicable + /// + /// + public string? Resource { get => Q("resource"); set => Q("resource", value); } +} + +internal sealed partial class ReloadSearchAnalyzersRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -75,26 +104,48 @@ public sealed partial class ReloadSearchAnalyzersRequestParameters : RequestPara /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. /// /// -public sealed partial class ReloadSearchAnalyzersRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestConverter))] +public sealed partial class ReloadSearchAnalyzersRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public ReloadSearchAnalyzersRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementReloadSearchAnalyzers; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementReloadSearchAnalyzers; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.reload_search_analyzers"; + /// + /// + /// A comma-separated list of index names to reload analyzers for + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -102,16 +153,21 @@ public ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Indices indice /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Whether specified concrete indices should be ignored when unavailable (missing or closed) /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// Changed resource to reload analyzers from if applicable + /// + /// + public string? Resource { get => Q("resource"); set => Q("resource", value); } } /// @@ -135,38 +191,144 @@ public ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Indices indice /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. /// /// -public sealed partial class ReloadSearchAnalyzersRequestDescriptor : RequestDescriptor, ReloadSearchAnalyzersRequestParameters> +public readonly partial struct ReloadSearchAnalyzersRequestDescriptor { - internal ReloadSearchAnalyzersRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest Instance { get; init; } - public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest instance) { + Instance = instance; } - public ReloadSearchAnalyzersRequestDescriptor() : this(typeof(TDocument)) + public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementReloadSearchAnalyzers; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ReloadSearchAnalyzersRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list of index names to reload analyzers for + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "indices.reload_search_analyzers"; + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Changed resource to reload analyzers from if applicable + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Resource(string? value) + { + Instance.Resource = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public ReloadSearchAnalyzersRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ReloadSearchAnalyzersRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public ReloadSearchAnalyzersRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Human(bool? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Human = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Pretty(bool? value) { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -191,33 +353,142 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. /// /// -public sealed partial class ReloadSearchAnalyzersRequestDescriptor : RequestDescriptor +public readonly partial struct ReloadSearchAnalyzersRequestDescriptor { - internal ReloadSearchAnalyzersRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest Instance { get; init; } - public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementReloadSearchAnalyzers; + public ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ReloadSearchAnalyzersRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(typeof(TDocument)); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.reload_search_analyzers"; + /// + /// + /// A comma-separated list of index names to reload analyzers for + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ReloadSearchAnalyzersRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ReloadSearchAnalyzersRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Changed resource to reload analyzers from if applicable + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Resource(string? value) + { + Instance.Resource = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ReloadSearchAnalyzersRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersResponse.g.cs index 63b89ee9ae3..7bf33f146d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ReloadSearchAnalyzersResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ReloadSearchAnalyzersResponse : ElasticsearchResponse +internal sealed partial class ReloadSearchAnalyzersResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReloadDetails = System.Text.Json.JsonEncodedText.Encode("reload_details"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propReloadDetails = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReloadDetails.TryReadProperty(ref reader, options, PropReloadDetails, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReloadDetails = propReloadDetails.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReloadDetails, value.ReloadDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponseConverter))] +public sealed partial class ReloadSearchAnalyzersResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("reload_details")] - public IReadOnlyCollection ReloadDetails { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadSearchAnalyzersResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadSearchAnalyzersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReloadDetails { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterRequest.g.cs index daee9636fb7..d03dab1bc70 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterRequest.g.cs @@ -17,26 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ResolveClusterRequestParameters : RequestParameters +public sealed partial class ResolveClusterRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing /// or closed indices. This behavior applies even if the request targets other open indices. For example, a request - /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } @@ -47,30 +42,83 @@ public sealed partial class ResolveClusterRequestParameters : RequestParameters /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. /// Supports comma-separated values, such as open,hidden. /// Valid values are: all, open, closed, hidden, none. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to false. + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// + [System.Obsolete("Deprecated in '7.16.0'.")] public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// - /// If false, the request returns an error if it targets a missing or closed index. Defaults to false. + /// If false, the request returns an error if it targets a missing or closed index. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// The maximum time to wait for remote clusters to respond. + /// If a remote cluster does not respond within this timeout period, the API response + /// will show the cluster as not connected and include an error message that the + /// request timed out. + /// + /// + /// The default timeout is unset and the query can take + /// as long as the networking layer is configured to wait for remote clusters that are + /// not responding (typically 30 seconds). + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class ResolveClusterRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Resolve the cluster. -/// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. -/// Multiple patterns and remote clusters are supported. +/// +/// +/// Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. +/// If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster. /// /// /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. @@ -85,7 +133,7 @@ public sealed partial class ResolveClusterRequestParameters : RequestParameters /// /// /// -/// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. +/// Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the remote/info endpoint. /// /// /// @@ -113,9 +161,15 @@ public sealed partial class ResolveClusterRequestParameters : RequestParameters /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. /// +/// Note on backwards compatibility /// -/// Advantages of using this endpoint before a cross-cluster search +/// The ability to query without an index expression was added in version 8.18, so when +/// querying remote clusters older than that, the local cluster will send the index +/// expression dummy* to those remote clusters. Thus, if an errors occur, you may see a reference +/// to that index expression even though you didn't request it. If it causes a problem, you can +/// instead include an index expression like *:* to bypass the issue. /// +/// Advantages of using this endpoint before a cross-cluster search /// /// You may want to exclude a cluster or index from a search when: /// @@ -141,16 +195,43 @@ public sealed partial class ResolveClusterRequestParameters : RequestParameters /// /// /// +/// Test availability of remote clusters +/// +/// The remote/info endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. +/// The remote cluster may be available, while the local cluster is not currently connected to it. +/// +/// +/// You can use the _resolve/cluster API to attempt to reconnect to remote clusters. +/// For example with GET _resolve/cluster or GET _resolve/cluster/*:*. +/// The connected field in the response will indicate whether it was successful. +/// If a connection was (re-)established, this will also cause the remote/info endpoint to now indicate a connected status. +/// /// -public sealed partial class ResolveClusterRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestConverter))] +public sealed partial class ResolveClusterRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) { } +#if NET7_0_OR_GREATER + public ResolveClusterRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ResolveClusterRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveClusterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementResolveCluster; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementResolveCluster; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -158,12 +239,24 @@ public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// /// - /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing + /// A comma-separated list of names or index patterns for the indices, aliases, and data streams to resolve. + /// Resources on remote clusters can be specified using the <cluster>:<name> syntax. + /// Index and cluster exclusions (e.g., -cluster1:*) are also supported. + /// If no index expression is specified, information about all remote clusters configured on the local cluster + /// is returned without doing any index matching + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing /// or closed indices. This behavior applies even if the request targets other open indices. For example, a request - /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -172,33 +265,54 @@ public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. /// Supports comma-separated values, such as open,hidden. /// Valid values are: all, open, closed, hidden, none. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to false. + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// - [JsonIgnore] + [System.Obsolete("Deprecated in '7.16.0'.")] public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// - /// If false, the request returns an error if it targets a missing or closed index. Defaults to false. + /// If false, the request returns an error if it targets a missing or closed index. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + + /// + /// + /// The maximum time to wait for remote clusters to respond. + /// If a remote cluster does not respond within this timeout period, the API response + /// will show the cluster as not connected and include an error message that the + /// request timed out. + /// + /// + /// The default timeout is unset and the query can take + /// as long as the networking layer is configured to wait for remote clusters that are + /// not responding (typically 30 seconds). + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Resolve the cluster. -/// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. -/// Multiple patterns and remote clusters are supported. +/// +/// +/// Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included. +/// If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster. /// /// /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. @@ -213,7 +327,7 @@ public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// /// /// -/// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. +/// Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the remote/info endpoint. /// /// /// @@ -241,9 +355,15 @@ public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. /// +/// Note on backwards compatibility /// -/// Advantages of using this endpoint before a cross-cluster search +/// The ability to query without an index expression was added in version 8.18, so when +/// querying remote clusters older than that, the local cluster will send the index +/// expression dummy* to those remote clusters. Thus, if an errors occur, you may see a reference +/// to that index expression even though you didn't request it. If it causes a problem, you can +/// instead include an index expression like *:* to bypass the issue. /// +/// Advantages of using this endpoint before a cross-cluster search /// /// You may want to exclude a cluster or index from a search when: /// @@ -269,35 +389,201 @@ public ResolveClusterRequest(Elastic.Clients.Elasticsearch.Names name) : base(r /// /// /// +/// Test availability of remote clusters +/// +/// The remote/info endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not. +/// The remote cluster may be available, while the local cluster is not currently connected to it. +/// +/// +/// You can use the _resolve/cluster API to attempt to reconnect to remote clusters. +/// For example with GET _resolve/cluster or GET _resolve/cluster/*:*. +/// The connected field in the response will indicate whether it was successful. +/// If a connection was (re-)established, this will also cause the remote/info endpoint to now indicate a connected status. +/// /// -public sealed partial class ResolveClusterRequestDescriptor : RequestDescriptor +public readonly partial struct ResolveClusterRequestDescriptor { - internal ResolveClusterRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest Instance { get; init; } - public ResolveClusterRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveClusterRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementResolveCluster; + public ResolveClusterRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public ResolveClusterRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.resolve_cluster"; + /// + /// + /// A comma-separated list of names or index patterns for the indices, aliases, and data streams to resolve. + /// Resources on remote clusters can be specified using the <cluster>:<name> syntax. + /// Index and cluster exclusions (e.g., -cluster1:*) are also supported. + /// If no index expression is specified, information about all remote clusters configured on the local cluster + /// is returned without doing any index matching + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing + /// or closed indices. This behavior applies even if the request targets other open indices. For example, a request + /// targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// NOTE: This option is only supported when specifying an index expression. You will get an error if you specify index + /// options to the _resolve/cluster API endpoint that takes no index expression. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// The maximum time to wait for remote clusters to respond. + /// If a remote cluster does not respond within this timeout period, the API response + /// will show the cluster as not connected and include an error message that the + /// request timed out. + /// + /// + /// The default timeout is unset and the query can take + /// as long as the networking layer is configured to wait for remote clusters that are + /// not responding (typically 30 seconds). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ResolveClusterRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ResolveClusterRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ResolveClusterRequestDescriptor IgnoreThrottled(bool? ignoreThrottled = true) => Qs("ignore_throttled", ignoreThrottled); - public ResolveClusterRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ResolveClusterRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterResponse.g.cs index 6632d166905..099c67650f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveClusterResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ResolveClusterResponse : DictionaryResponse +internal sealed partial class ResolveClusterResponseConverter : System.Text.Json.Serialization.JsonConverter { - public ResolveClusterResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Infos = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public ResolveClusterResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Infos, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponseConverter))] +public sealed partial class ResolveClusterResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveClusterResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveClusterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Infos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexRequest.g.cs index 453bca1e4ff..57fb4301537 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ResolveIndexRequestParameters : RequestParameters +public sealed partial class ResolveIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,7 +42,7 @@ public sealed partial class ResolveIndexRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -59,6 +52,35 @@ public sealed partial class ResolveIndexRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } +internal sealed partial class ResolveIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Resolve indices. @@ -66,20 +88,44 @@ public sealed partial class ResolveIndexRequestParameters : RequestParameters /// Multiple patterns and remote clusters are supported. /// /// -public sealed partial class ResolveIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestConverter))] +public sealed partial class ResolveIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ResolveIndexRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ResolveIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementResolveIndex; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementResolveIndex; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.resolve_index"; + /// + /// + /// Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. + /// Resources on remote clusters can be specified using the <cluster>:<name> syntax. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -87,7 +133,6 @@ public ResolveIndexRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -98,15 +143,13 @@ public ResolveIndexRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } @@ -117,33 +160,141 @@ public ResolveIndexRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => /// Multiple patterns and remote clusters are supported. /// /// -public sealed partial class ResolveIndexRequestDescriptor : RequestDescriptor +public readonly partial struct ResolveIndexRequestDescriptor { - internal ResolveIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest Instance { get; init; } - public ResolveIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementResolveIndex; + public ResolveIndexRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ResolveIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.resolve_index"; + /// + /// + /// Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. + /// Resources on remote clusters can be specified using the <cluster>:<name> syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ResolveIndexRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ResolveIndexRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ResolveIndexRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ResolveIndexRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexResponse.g.cs index 9fa71a9fca0..5e08cfcd78d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ResolveIndexResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ResolveIndexResponse : ElasticsearchResponse +internal sealed partial class ResolveIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("aliases")] - public IReadOnlyCollection Aliases { get; init; } - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAliases = default; + LocalJsonValue> propDataStreams = default; + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + DataStreams = propDataStreams.Value, + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponseConverter))] +public sealed partial class ResolveIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Aliases { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverRequest.g.cs index 331aa7bfe7b..1bfd1a7a4db 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RolloverRequestParameters : RequestParameters +public sealed partial class RolloverRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,6 +32,14 @@ public sealed partial class RolloverRequestParameters : RequestParameters /// public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } + /// + /// + /// If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. + /// Only allowed on data streams. + /// + /// + public bool? Lazy { get => Q("lazy"); set => Q("lazy", value); } + /// /// /// Period to wait for a connection to the master node. @@ -64,6 +65,72 @@ public sealed partial class RolloverRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class RolloverRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropConditions = System.Text.Json.JsonEncodedText.Encode("conditions"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propConditions = default; + LocalJsonValue propMappings = default; + LocalJsonValue?> propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propConditions.TryReadProperty(ref reader, options, PropConditions, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Conditions = propConditions.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropConditions, value.Conditions, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Roll over to a new index. @@ -118,39 +185,78 @@ public sealed partial class RolloverRequestParameters : RequestParameters /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. /// /// -public sealed partial class RolloverRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestConverter))] +public sealed partial class RolloverRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias) : base(r => r.Required("alias", alias)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) : base(r => r.Required("alias", alias).Optional("new_index", newIndex)) { } +#if NET7_0_OR_GREATER + public RolloverRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RolloverRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRollover; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementRollover; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "indices.rollover"; + /// + /// + /// Name of the data stream or index alias to roll over. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexAlias Alias { get => P("alias"); set => PR("alias", value); } + + /// + /// + /// Name of the index to create. + /// Supports date math. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? NewIndex { get => P("new_index"); set => PO("new_index", value); } + /// /// /// If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. /// /// - [JsonIgnore] public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } + /// + /// + /// If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. + /// Only allowed on data streams. + /// + /// + public bool? Lazy { get => Q("lazy"); set => Q("lazy", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -159,7 +265,6 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -168,7 +273,6 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -177,8 +281,7 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// Data streams do not support this parameter. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// @@ -189,7 +292,6 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied. /// /// - [JsonInclude, JsonPropertyName("conditions")] public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? Conditions { get; set; } /// @@ -198,7 +300,6 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// If specified, this mapping can include field names, field data types, and mapping paramaters. /// /// - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } /// @@ -207,8 +308,7 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// Data streams do not support this parameter. /// /// - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } } /// @@ -265,51 +365,172 @@ public RolloverRequest(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.C /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. /// /// -public sealed partial class RolloverRequestDescriptor : RequestDescriptor, RolloverRequestParameters> +public readonly partial struct RolloverRequestDescriptor { - internal RolloverRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest Instance { get; init; } - public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) : base(r => r.Required("alias", alias).Optional("new_index", newIndex)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest instance) { + Instance = instance; } - public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias) : this(alias, typeof(TDocument)) + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(alias); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRollover; + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(alias, newIndex); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RolloverRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.rollover"; + /// + /// + /// Name of the data stream or index alias to roll over. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias value) + { + Instance.Alias = value; + return this; + } + + /// + /// + /// Name of the index to create. + /// Supports date math. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.NewIndex = value; + return this; + } + + /// + /// + /// If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor DryRun(bool? value = true) + { + Instance.DryRun = value; + return this; + } + + /// + /// + /// If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. + /// Only allowed on data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Lazy(bool? value = true) + { + Instance.Lazy = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } - public RolloverRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun); - public RolloverRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public RolloverRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public RolloverRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } - public RolloverRequestDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias alias) + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(System.Action? action) { - RouteValues.Required("alias", alias); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - public RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsearch.IndexName? newIndex) + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(System.Action>? action) { - RouteValues.Optional("new_index", newIndex); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? ConditionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor ConditionsDescriptor { get; set; } - private Action ConditionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private IDictionary? SettingsValue { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } /// /// @@ -317,10 +538,64 @@ public RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsear /// Data streams do not support this parameter. /// /// - public RolloverRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Conditions for the rollover. + /// If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. + /// If this parameter is not specified, Elasticsearch performs the rollover unconditionally. + /// If conditions are specified, at least one of them must be a max_* condition. + /// The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Conditions = value; + return this; } /// @@ -332,28 +607,37 @@ public RolloverRequestDescriptor Aliases(Funcmax_* condition is satisfied and all min_* conditions are satisfied. /// /// - public RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? conditions) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions() { - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsValue = conditions; - return Self; + Instance.Conditions = Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor.Build(null); + return this; } - public RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor descriptor) + /// + /// + /// Conditions for the rollover. + /// If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. + /// If this parameter is not specified, Elasticsearch performs the rollover unconditionally. + /// If conditions are specified, at least one of them must be a max_* condition. + /// The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions(System.Action? action) { - ConditionsValue = null; - ConditionsDescriptorAction = null; - ConditionsDescriptor = descriptor; - return Self; + Instance.Conditions = Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor.Build(action); + return this; } - public RolloverRequestDescriptor Conditions(Action configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping paramaters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorAction = configure; - return Self; + Instance.Mappings = value; + return this; } /// @@ -362,28 +646,34 @@ public RolloverRequestDescriptor Conditions(Action /// - public RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings() { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping paramaters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings(System.Action? action) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public RolloverRequestDescriptor Mappings(Action> configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping paramaters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -392,60 +682,91 @@ public RolloverRequestDescriptor Mappings(Action /// - public RolloverRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Settings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration options for the index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings() { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (ConditionsDescriptor is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsDescriptor, options); - } - else if (ConditionsDescriptorAction is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor(ConditionsDescriptorAction), options); - } - else if (ConditionsValue is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsValue, options); - } + /// + /// + /// Configuration options for the index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } - if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -503,51 +824,129 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. /// /// -public sealed partial class RolloverRequestDescriptor : RequestDescriptor +public readonly partial struct RolloverRequestDescriptor { - internal RolloverRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest Instance { get; init; } - public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) : base(r => r.Required("alias", alias).Optional("new_index", newIndex)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest instance) { + Instance = instance; } - public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias) : base(r => r.Required("alias", alias)) + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(alias); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementRollover; + public RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(alias, newIndex); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RolloverRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.rollover"; + /// + /// + /// Name of the data stream or index alias to roll over. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias value) + { + Instance.Alias = value; + return this; + } + + /// + /// + /// Name of the index to create. + /// Supports date math. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.NewIndex = value; + return this; + } + + /// + /// + /// If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor DryRun(bool? value = true) + { + Instance.DryRun = value; + return this; + } - public RolloverRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun); - public RolloverRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public RolloverRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public RolloverRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. + /// Only allowed on data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Lazy(bool? value = true) + { + Instance.Lazy = value; + return this; + } - public RolloverRequestDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias alias) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("alias", alias); - return Self; + Instance.MasterTimeout = value; + return this; } - public RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsearch.IndexName? newIndex) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Optional("new_index", newIndex); - return Self; + Instance.Timeout = value; + return this; } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? ConditionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor ConditionsDescriptor { get; set; } - private Action ConditionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } /// /// @@ -555,10 +954,73 @@ public RolloverRequestDescriptor NewIndex(Elastic.Clients.Elasticsearch.IndexNam /// Data streams do not support this parameter. /// /// - public RolloverRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases() { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the target index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } /// @@ -570,28 +1032,40 @@ public RolloverRequestDescriptor Aliases(Funcmax_* condition is satisfied and all min_* conditions are satisfied. /// /// - public RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? conditions) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions? value) { - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsValue = conditions; - return Self; + Instance.Conditions = value; + return this; } - public RolloverRequestDescriptor Conditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor descriptor) + /// + /// + /// Conditions for the rollover. + /// If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. + /// If this parameter is not specified, Elasticsearch performs the rollover unconditionally. + /// If conditions are specified, at least one of them must be a max_* condition. + /// The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions() { - ConditionsValue = null; - ConditionsDescriptorAction = null; - ConditionsDescriptor = descriptor; - return Self; + Instance.Conditions = Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor.Build(null); + return this; } - public RolloverRequestDescriptor Conditions(Action configure) + /// + /// + /// Conditions for the rollover. + /// If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. + /// If this parameter is not specified, Elasticsearch performs the rollover unconditionally. + /// If conditions are specified, at least one of them must be a max_* condition. + /// The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Conditions(System.Action? action) { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorAction = configure; - return Self; + Instance.Conditions = Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor.Build(action); + return this; } /// @@ -600,28 +1074,34 @@ public RolloverRequestDescriptor Conditions(Action /// - public RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public RolloverRequestDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping paramaters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public RolloverRequestDescriptor Mappings(Action configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping paramaters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -630,59 +1110,90 @@ public RolloverRequestDescriptor Mappings(Action /// - public RolloverRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Settings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration options for the index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings() { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (ConditionsDescriptor is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsDescriptor, options); - } - else if (ConditionsDescriptorAction is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor(ConditionsDescriptorAction), options); - } - else if (ConditionsValue is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsValue, options); - } + /// + /// + /// Configuration options for the index. + /// Data streams do not support this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } - if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverResponse.g.cs index cf9804a869f..ba6b9e7f112 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/RolloverResponse.g.cs @@ -17,29 +17,152 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class RolloverResponse : ElasticsearchResponse +internal sealed partial class RolloverResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("conditions")] - public IReadOnlyDictionary Conditions { get; init; } - [JsonInclude, JsonPropertyName("dry_run")] - public bool DryRun { get; init; } - [JsonInclude, JsonPropertyName("new_index")] - public string NewIndex { get; init; } - [JsonInclude, JsonPropertyName("old_index")] - public string OldIndex { get; init; } - [JsonInclude, JsonPropertyName("rolled_over")] - public bool RolledOver { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropConditions = System.Text.Json.JsonEncodedText.Encode("conditions"); + private static readonly System.Text.Json.JsonEncodedText PropDryRun = System.Text.Json.JsonEncodedText.Encode("dry_run"); + private static readonly System.Text.Json.JsonEncodedText PropNewIndex = System.Text.Json.JsonEncodedText.Encode("new_index"); + private static readonly System.Text.Json.JsonEncodedText PropOldIndex = System.Text.Json.JsonEncodedText.Encode("old_index"); + private static readonly System.Text.Json.JsonEncodedText PropRolledOver = System.Text.Json.JsonEncodedText.Encode("rolled_over"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue> propConditions = default; + LocalJsonValue propDryRun = default; + LocalJsonValue propNewIndex = default; + LocalJsonValue propOldIndex = default; + LocalJsonValue propRolledOver = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propConditions.TryReadProperty(ref reader, options, PropConditions, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propDryRun.TryReadProperty(ref reader, options, PropDryRun, null)) + { + continue; + } + + if (propNewIndex.TryReadProperty(ref reader, options, PropNewIndex, null)) + { + continue; + } + + if (propOldIndex.TryReadProperty(ref reader, options, PropOldIndex, null)) + { + continue; + } + + if (propRolledOver.TryReadProperty(ref reader, options, PropRolledOver, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Conditions = propConditions.Value, + DryRun = propDryRun.Value, + NewIndex = propNewIndex.Value, + OldIndex = propOldIndex.Value, + RolledOver = propRolledOver.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropConditions, value.Conditions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDryRun, value.DryRun, null, null); + writer.WriteProperty(options, PropNewIndex, value.NewIndex, null, null); + writer.WriteProperty(options, PropOldIndex, value.OldIndex, null, null); + writer.WriteProperty(options, PropRolledOver, value.RolledOver, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponseConverter))] +public sealed partial class RolloverResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RolloverResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Conditions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool DryRun { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NewIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string OldIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool RolledOver { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsRequest.g.cs index 4bd6a06cc35..0fdf45bdbab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SegmentsRequestParameters : RequestParameters +public sealed partial class SegmentsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class SegmentsRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -56,13 +49,35 @@ public sealed partial class SegmentsRequestParameters : RequestParameters /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } +} - /// - /// - /// If true, the request returns a verbose response. - /// - /// - public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } +internal sealed partial class SegmentsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -72,31 +87,51 @@ public sealed partial class SegmentsRequestParameters : RequestParameters /// For data streams, the API returns information about the stream's backing indices. /// /// -public sealed partial class SegmentsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestConverter))] +public sealed partial class SegmentsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SegmentsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SegmentsRequest() { } - - public SegmentsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SegmentsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSegments; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementSegments; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.segments"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -107,24 +142,14 @@ public SegmentsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } - - /// - /// - /// If true, the request returns a verbose response. - /// - /// - [JsonIgnore] - public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } /// @@ -134,39 +159,146 @@ public SegmentsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// For data streams, the API returns information about the stream's backing indices. /// /// -public sealed partial class SegmentsRequestDescriptor : RequestDescriptor, SegmentsRequestParameters> +public readonly partial struct SegmentsRequestDescriptor { - internal SegmentsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest Instance { get; init; } - public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest instance) { + Instance = instance; + } + + public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(indices); } public SegmentsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSegments; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.segments"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public SegmentsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SegmentsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SegmentsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SegmentsRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public SegmentsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -177,38 +309,145 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// For data streams, the API returns information about the stream's backing indices. /// /// -public sealed partial class SegmentsRequestDescriptor : RequestDescriptor +public readonly partial struct SegmentsRequestDescriptor { - internal SegmentsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest Instance { get; init; } - public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest instance) { + Instance = instance; + } + + public SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(indices); } public SegmentsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSegments; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of data streams, indices, and aliases used to limit the request. + /// Supports wildcards (*). + /// To target all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.segments"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public SegmentsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SegmentsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SegmentsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SegmentsRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public SegmentsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsResponse.g.cs index eba31e77e85..209dcd0b00b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SegmentsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SegmentsResponse : ElasticsearchResponse +internal sealed partial class SegmentsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponseConverter))] +public sealed partial class SegmentsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyDictionary Indices { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SegmentsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SegmentsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresRequest.g.cs index 7214e3d289d..e14d3830eee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ShardStoresRequestParameters : RequestParameters +public sealed partial class ShardStoresRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,7 +40,7 @@ public sealed partial class ShardStoresRequestParameters : RequestParameters /// this argument determines whether wildcard expressions match hidden data streams. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -61,7 +54,36 @@ public sealed partial class ShardStoresRequestParameters : RequestParameters /// List of shard health statuses used to limit the request. /// /// - public ICollection? Status { get => Q?>("status"); set => Q("status", value); } + public System.Collections.Generic.ICollection? Status { get => Q?>("status"); set => Q("status", value); } +} + +internal sealed partial class ShardStoresRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -99,24 +121,43 @@ public sealed partial class ShardStoresRequestParameters : RequestParameters /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. /// /// -public sealed partial class ShardStoresRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestConverter))] +public sealed partial class ShardStoresRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public ShardStoresRequest() { } - - public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public ShardStoresRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShardStores; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementShardStores; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "indices.shard_stores"; + /// + /// + /// List of data streams, indices, and aliases used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all @@ -124,7 +165,6 @@ public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -133,15 +173,13 @@ public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// this argument determines whether wildcard expressions match hidden data streams. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -149,8 +187,7 @@ public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// List of shard health statuses used to limit the request. /// /// - [JsonIgnore] - public ICollection? Status { get => Q?>("status"); set => Q("status", value); } + public System.Collections.Generic.ICollection? Status { get => Q?>("status"); set => Q("status", value); } } /// @@ -188,39 +225,163 @@ public ShardStoresRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. /// /// -public sealed partial class ShardStoresRequestDescriptor : RequestDescriptor, ShardStoresRequestParameters> +public readonly partial struct ShardStoresRequestDescriptor { - internal ShardStoresRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest Instance { get; init; } - public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest instance) { + Instance = instance; + } + + public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(indices); } public ShardStoresRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShardStores; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// List of data streams, indices, and aliases used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all + /// value targets only missing or closed indices. This behavior applies even if the request + /// targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.shard_stores"; + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, + /// this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ShardStoresRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ShardStoresRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ShardStoresRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ShardStoresRequestDescriptor Status(ICollection? status) => Qs("status", status); + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, + /// this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public ShardStoresRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor IgnoreUnavailable(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// List of shard health statuses used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Status(System.Collections.Generic.ICollection? value) + { + Instance.Status = value; + return this; + } + + /// + /// + /// List of shard health statuses used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Status(params Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus[] values) + { + Instance.Status = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -259,38 +420,162 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. /// /// -public sealed partial class ShardStoresRequestDescriptor : RequestDescriptor +public readonly partial struct ShardStoresRequestDescriptor { - internal ShardStoresRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest Instance { get; init; } - public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest instance) { + Instance = instance; + } + + public ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(indices); } public ShardStoresRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShardStores; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// List of data streams, indices, and aliases used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all + /// value targets only missing or closed indices. This behavior applies even if the request + /// targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.shard_stores"; + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, + /// this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ShardStoresRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ShardStoresRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ShardStoresRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ShardStoresRequestDescriptor Status(ICollection? status) => Qs("status", status); + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, + /// this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// List of shard health statuses used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Status(System.Collections.Generic.ICollection? value) + { + Instance.Status = value; + return this; + } + + /// + /// + /// List of shard health statuses used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Status(params Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus[] values) + { + Instance.Status = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ShardStoresRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresResponse.g.cs index 09e274b9898..caa8257e86c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShardStoresResponse.g.cs @@ -17,18 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ShardStoresResponse : ElasticsearchResponse +internal sealed partial class ShardStoresResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("indices")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesShardStores))] - public IReadOnlyDictionary Indices { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponseConverter))] +public sealed partial class ShardStoresResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoresResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoresResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexRequest.g.cs index ad7eb567dd7..f87a36440b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ShrinkIndexRequestParameters : RequestParameters +public sealed partial class ShrinkIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,6 +50,54 @@ public sealed partial class ShrinkIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class ShrinkIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue?> propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Shrink an index. @@ -146,27 +187,60 @@ public sealed partial class ShrinkIndexRequestParameters : RequestParameters /// /// /// -public sealed partial class ShrinkIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestConverter))] +public sealed partial class ShrinkIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) { } +#if NET7_0_OR_GREATER + public ShrinkIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShrinkIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShrink; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementShrink; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.shrink"; + /// + /// + /// Name of the source index to shrink. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Name of the target index to create. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Target { get => P("target"); set => PR("target", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -175,7 +249,6 @@ public ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -184,7 +257,6 @@ public ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -193,16 +265,14 @@ public ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic /// Index alias names support date math. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// /// Configuration options for the target index. /// /// - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } } /// @@ -294,40 +364,87 @@ public ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic /// /// /// -public sealed partial class ShrinkIndexRequestDescriptor : RequestDescriptor, ShrinkIndexRequestParameters> +public readonly partial struct ShrinkIndexRequestDescriptor { - internal ShrinkIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest Instance { get; init; } - public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShrink; + public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(index, target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ShrinkIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.shrink"; + /// + /// + /// Name of the source index to shrink. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public ShrinkIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public ShrinkIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public ShrinkIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Target = value; + return this; + } - public ShrinkIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.MasterTimeout = value; + return this; } - public ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName target) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("target", target); - return Self; + Instance.Timeout = value; + return this; } - private IDictionary> AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } /// /// @@ -335,39 +452,194 @@ public ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsea /// Index alias names support date math. /// /// - public ShrinkIndexRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases = value; + return this; } /// /// - /// Configuration options for the target index. + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// The key is the alias name. + /// Index alias names support date math. /// /// - public ShrinkIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(System.Action? action) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(System.Action>? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } - if (SettingsValue is not null) + /// + /// + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -460,40 +732,87 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// /// /// -public sealed partial class ShrinkIndexRequestDescriptor : RequestDescriptor +public readonly partial struct ShrinkIndexRequestDescriptor { - internal ShrinkIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest Instance { get; init; } - public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementShrink; + public ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(index, target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ShrinkIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.shrink"; + /// + /// + /// Name of the source index to shrink. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public ShrinkIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public ShrinkIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public ShrinkIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Target = value; + return this; + } - public ShrinkIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.MasterTimeout = value; + return this; } - public ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName target) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("target", target); - return Self; + Instance.Timeout = value; + return this; } - private IDictionary AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } /// /// @@ -501,38 +820,174 @@ public ShrinkIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexNa /// Index alias names support date math. /// /// - public ShrinkIndexRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = value; + return this; } /// /// - /// Configuration options for the target index. + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// The key is the alias name. + /// Index alias names support date math. /// /// - public ShrinkIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(System.Action>? action) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } - if (SettingsValue is not null) + /// + /// + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// The key is the alias name. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexResponse.g.cs index 5cdc0a85eaf..d033a6bbccc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ShrinkIndexResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ShrinkIndexResponse : ElasticsearchResponse +internal sealed partial class ShrinkIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propIndex = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Index = propIndex.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponseConverter))] +public sealed partial class ShrinkIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShrinkIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShrinkIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateRequest.g.cs index 11c724fe951..0ca6b50a804 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateRequest.g.cs @@ -17,21 +17,28 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SimulateIndexTemplateRequestParameters : RequestParameters +public sealed partial class SimulateIndexTemplateRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public string? Cause { get => Q("cause"); set => Q("cause", value); } + + /// + /// + /// Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one + /// + /// + public bool? Create { get => Q("create"); set => Q("create", value); } + /// /// /// If true, returns all relevant default configurations for the index template. @@ -47,32 +54,97 @@ public sealed partial class SimulateIndexTemplateRequestParameters : RequestPara public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class SimulateIndexTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Simulate an index. /// Get the index configuration that would be applied to the specified index from an existing index template. /// /// -public sealed partial class SimulateIndexTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestConverter))] +public sealed partial class SimulateIndexTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public SimulateIndexTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateIndexTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementSimulateIndexTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "indices.simulate_index_template"; + /// + /// + /// Name of the index to simulate + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public string? Cause { get => Q("cause"); set => Q("cause", value); } + + /// + /// + /// Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one + /// + /// + public bool? Create { get => Q("create"); set => Q("create", value); } + /// /// /// If true, returns all relevant default configurations for the index template. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -80,7 +152,6 @@ public SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : b /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -90,32 +161,132 @@ public SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : b /// Get the index configuration that would be applied to the specified index from an existing index template. /// /// -public sealed partial class SimulateIndexTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct SimulateIndexTemplateRequestDescriptor { - internal SimulateIndexTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest Instance { get; init; } - public SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateIndexTemplate; + public SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SimulateIndexTemplateRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.simulate_index_template"; + /// + /// + /// Name of the index to simulate + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } + + /// + /// + /// Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor Create(bool? value = true) + { + Instance.Create = value; + return this; + } + + /// + /// + /// If true, returns all relevant default configurations for the index template. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor IncludeDefaults(bool? value = true) + { + Instance.IncludeDefaults = value; + return this; + } - public SimulateIndexTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public SimulateIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public SimulateIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateResponse.g.cs index 1319b5304d7..c899c11609c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateIndexTemplateResponse.g.cs @@ -17,19 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SimulateIndexTemplateResponse : ElasticsearchResponse +internal sealed partial class SimulateIndexTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOverlapping = System.Text.Json.JsonEncodedText.Encode("overlapping"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propOverlapping = default; + LocalJsonValue propTemplate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOverlapping.TryReadProperty(ref reader, options, PropOverlapping, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Overlapping = propOverlapping.Value, + Template = propTemplate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOverlapping, value.Overlapping, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponseConverter))] +public sealed partial class SimulateIndexTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("overlapping")] - public IReadOnlyCollection? Overlapping { get; init; } - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.IndexManagement.Template Template { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateIndexTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateIndexTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Overlapping { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.Template Template { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateRequest.g.cs index 2e522a02799..b2c35221491 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateRequest.g.cs @@ -17,21 +17,21 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SimulateTemplateRequestParameters : RequestParameters +public sealed partial class SimulateTemplateRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public string? Cause { get => Q("cause"); set => Q("cause", value); } + /// /// /// If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. @@ -54,36 +54,182 @@ public sealed partial class SimulateTemplateRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class SimulateTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowAutoCreate = System.Text.Json.JsonEncodedText.Encode("allow_auto_create"); + private static readonly System.Text.Json.JsonEncodedText PropComposedOf = System.Text.Json.JsonEncodedText.Encode("composed_of"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissingComponentTemplates = System.Text.Json.JsonEncodedText.Encode("ignore_missing_component_templates"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowAutoCreate = default; + LocalJsonValue?> propComposedOf = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propDeprecated = default; + LocalJsonValue?> propIgnoreMissingComponentTemplates = default; + LocalJsonValue propIndexPatterns = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPriority = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowAutoCreate.TryReadProperty(ref reader, options, PropAllowAutoCreate, null)) + { + continue; + } + + if (propComposedOf.TryReadProperty(ref reader, options, PropComposedOf, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propIgnoreMissingComponentTemplates.TryReadProperty(ref reader, options, PropIgnoreMissingComponentTemplates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowAutoCreate = propAllowAutoCreate.Value, + ComposedOf = propComposedOf.Value, + DataStream = propDataStream.Value, + Deprecated = propDeprecated.Value, + IgnoreMissingComponentTemplates = propIgnoreMissingComponentTemplates.Value, + IndexPatterns = propIndexPatterns.Value, + Meta = propMeta.Value, + Priority = propPriority.Value, + Template = propTemplate.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowAutoCreate, value.AllowAutoCreate, null, null); + writer.WriteProperty(options, PropComposedOf, value.ComposedOf, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropIgnoreMissingComponentTemplates, value.IgnoreMissingComponentTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Simulate an index template. /// Get the index configuration that would be applied by a particular index template. /// /// -public sealed partial class SimulateTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestConverter))] +public sealed partial class SimulateTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public SimulateTemplateRequest() { } - - public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public SimulateTemplateRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementSimulateTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "indices.simulate_template"; + /// + /// + /// Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit + /// this parameter and specify the template configuration in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("name"); set => PO("name", value); } + + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public string? Cause { get => Q("cause"); set => Q("cause", value); } + /// /// /// If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. /// /// - [JsonIgnore] public bool? Create { get => Q("create"); set => Q("create", value); } /// @@ -91,7 +237,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// If true, returns all relevant default configurations for the index template. /// /// - [JsonIgnore] public bool? IncludeDefaults { get => Q("include_defaults"); set => Q("include_defaults", value); } /// @@ -99,7 +244,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -109,7 +253,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - [JsonInclude, JsonPropertyName("allow_auto_create")] public bool? AllowAutoCreate { get; set; } /// @@ -118,8 +261,7 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - [JsonInclude, JsonPropertyName("composed_of")] - public ICollection? ComposedOf { get; set; } + public System.Collections.Generic.ICollection? ComposedOf { get; set; } /// /// @@ -128,7 +270,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Data streams require a matching index template with a data_stream object. /// /// - [JsonInclude, JsonPropertyName("data_stream")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStream { get; set; } /// @@ -137,7 +278,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// that uses deprecated components, Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -146,15 +286,13 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// references a component template that might not exist /// /// - [JsonInclude, JsonPropertyName("ignore_missing_component_templates")] - public ICollection? IgnoreMissingComponentTemplates { get; set; } + public System.Collections.Generic.ICollection? IgnoreMissingComponentTemplates { get; set; } /// /// /// Array of wildcard (*) expressions used to match the names of data streams and indices during creation. /// /// - [JsonInclude, JsonPropertyName("index_patterns")] public Elastic.Clients.Elasticsearch.Indices? IndexPatterns { get; set; } /// @@ -164,8 +302,7 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// This map is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -175,7 +312,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// This number is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("priority")] public long? Priority { get; set; } /// @@ -184,7 +320,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// It may optionally include an aliases, mappings, or settings configuration. /// /// - [JsonInclude, JsonPropertyName("template")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? Template { get; set; } /// @@ -193,7 +328,6 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// This number is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } @@ -203,50 +337,84 @@ public SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Name? name) : base( /// Get the index configuration that would be applied by a particular index template. /// /// -public sealed partial class SimulateTemplateRequestDescriptor : RequestDescriptor, SimulateTemplateRequestParameters> +public readonly partial struct SimulateTemplateRequestDescriptor { - internal SimulateTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest Instance { get; init; } - public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest instance) { + Instance = instance; } - public SimulateTemplateRequestDescriptor() + public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateTemplate; + public SimulateTemplateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit + /// this parameter and specify the template configuration in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.simulate_template"; + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public SimulateTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public SimulateTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public SimulateTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Create(bool? value = true) + { + Instance.Create = value; + return this; + } - public SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + /// + /// + /// If true, returns all relevant default configurations for the index template. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IncludeDefaults(bool? value = true) { - RouteValues.Optional("name", name); - return Self; + Instance.IncludeDefaults = value; + return this; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection? ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private ICollection? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor TemplateDescriptor { get; set; } - private Action> TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -255,10 +423,10 @@ public SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elastic /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - public SimulateTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor AllowAutoCreate(bool? value = true) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.AllowAutoCreate = value; + return this; } /// @@ -267,10 +435,22 @@ public SimulateTemplateRequestDescriptor AllowAutoCreate(bool? allowA /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public SimulateTemplateRequestDescriptor ComposedOf(ICollection? composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ComposedOf(System.Collections.Generic.ICollection? value) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) + { + Instance.ComposedOf = [.. values]; + return this; } /// @@ -280,28 +460,36 @@ public SimulateTemplateRequestDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(null); + return this; } - public SimulateTemplateRequestDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(action); + return this; } /// @@ -310,10 +498,22 @@ public SimulateTemplateRequestDescriptor DataStream(Action /// - public SimulateTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Deprecated(bool? value = true) + { + Instance.Deprecated = value; + return this; + } + + /// + /// + /// The configuration option ignore_missing_component_templates can be used when an index template + /// references a component template that might not exist + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(System.Collections.Generic.ICollection? value) { - DeprecatedValue = deprecated; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; } /// @@ -322,10 +522,10 @@ public SimulateTemplateRequestDescriptor Deprecated(bool? deprecated /// references a component template that might not exist /// /// - public SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollection? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(params string[] values) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = [.. values]; + return this; } /// @@ -333,10 +533,10 @@ public SimulateTemplateRequestDescriptor IgnoreMissingComponentTempla /// Array of wildcard (*) expressions used to match the names of data streams and indices during creation. /// /// - public SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.IndexPatterns = value; + return this; } /// @@ -346,10 +546,43 @@ public SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Client /// This map is not automatically generated by Elasticsearch. /// /// - public SimulateTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -360,10 +593,10 @@ public SimulateTemplateRequestDescriptor Meta(Func /// - public SimulateTemplateRequestDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -372,28 +605,46 @@ public SimulateTemplateRequestDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? template) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(null); + return this; } - public SimulateTemplateRequestDescriptor Template(Action> configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template(System.Action? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template(System.Action>? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; } /// @@ -402,96 +653,65 @@ public SimulateTemplateRequestDescriptor Template(Action /// - public SimulateTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) - { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); - } - - if (ComposedOfValue is not null) + if (action is null) { - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -501,50 +721,84 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Get the index configuration that would be applied by a particular index template. /// /// -public sealed partial class SimulateTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct SimulateTemplateRequestDescriptor { - internal SimulateTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest Instance { get; init; } - public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest instance) { + Instance = instance; } - public SimulateTemplateRequestDescriptor() + public SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name? name) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateTemplate; + public SimulateTemplateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit + /// this parameter and specify the template configuration in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "indices.simulate_template"; + /// + /// + /// User defined reason for dry-run creating the new template for simulation purposes + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Cause(string? value) + { + Instance.Cause = value; + return this; + } - public SimulateTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create); - public SimulateTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults); - public SimulateTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Create(bool? value = true) + { + Instance.Create = value; + return this; + } - public SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + /// + /// + /// If true, returns all relevant default configurations for the index template. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IncludeDefaults(bool? value = true) { - RouteValues.Optional("name", name); - return Self; + Instance.IncludeDefaults = value; + return this; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection? ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private ICollection? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// @@ -553,10 +807,10 @@ public SimulateTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name /// If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created. /// /// - public SimulateTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor AllowAutoCreate(bool? value = true) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.AllowAutoCreate = value; + return this; } /// @@ -565,10 +819,22 @@ public SimulateTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public SimulateTemplateRequestDescriptor ComposedOf(ICollection? composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ComposedOf(System.Collections.Generic.ICollection? value) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) + { + Instance.ComposedOf = [.. values]; + return this; } /// @@ -578,28 +844,36 @@ public SimulateTemplateRequestDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public SimulateTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(null); + return this; } - public SimulateTemplateRequestDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor.Build(action); + return this; } /// @@ -608,10 +882,22 @@ public SimulateTemplateRequestDescriptor DataStream(Action /// - public SimulateTemplateRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Deprecated(bool? value = true) + { + Instance.Deprecated = value; + return this; + } + + /// + /// + /// The configuration option ignore_missing_component_templates can be used when an index template + /// references a component template that might not exist + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(System.Collections.Generic.ICollection? value) { - DeprecatedValue = deprecated; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; } /// @@ -620,10 +906,10 @@ public SimulateTemplateRequestDescriptor Deprecated(bool? deprecated = true) /// references a component template that might not exist /// /// - public SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollection? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(params string[] values) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = [.. values]; + return this; } /// @@ -631,10 +917,23 @@ public SimulateTemplateRequestDescriptor IgnoreMissingComponentTemplates(ICollec /// Array of wildcard (*) expressions used to match the names of data streams and indices during creation. /// /// - public SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.Meta = value; + return this; } /// @@ -644,10 +943,30 @@ public SimulateTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticse /// This map is not automatically generated by Elasticsearch. /// /// - public SimulateTemplateRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the index template. + /// May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -658,10 +977,10 @@ public SimulateTemplateRequestDescriptor Meta(Func /// - public SimulateTemplateRequestDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -670,28 +989,34 @@ public SimulateTemplateRequestDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? template) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public SimulateTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(null); + return this; } - public SimulateTemplateRequestDescriptor Template(Action configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor.Build(action); + return this; } /// @@ -700,95 +1025,64 @@ public SimulateTemplateRequestDescriptor Template(Action /// - public SimulateTemplateRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) + if (action is null) { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ComposedOfValue is not null) - { - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); - } - - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexPatternsValue is not null) - { - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateResponse.g.cs index 13d495ed53a..7103b51c3cc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SimulateTemplateResponse.g.cs @@ -17,19 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SimulateTemplateResponse : ElasticsearchResponse +internal sealed partial class SimulateTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOverlapping = System.Text.Json.JsonEncodedText.Encode("overlapping"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propOverlapping = default; + LocalJsonValue propTemplate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOverlapping.TryReadProperty(ref reader, options, PropOverlapping, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Overlapping = propOverlapping.Value, + Template = propTemplate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOverlapping, value.Overlapping, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponseConverter))] +public sealed partial class SimulateTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("overlapping")] - public IReadOnlyCollection? Overlapping { get; init; } - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.IndexManagement.Template Template { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Overlapping { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.Template Template { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexRequest.g.cs index 132249bcd26..755d550475a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SplitIndexRequestParameters : RequestParameters +public sealed partial class SplitIndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,6 +50,54 @@ public sealed partial class SplitIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class SplitIndexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue?> propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Split an index. @@ -145,27 +186,60 @@ public sealed partial class SplitIndexRequestParameters : RequestParameters /// /// /// -public sealed partial class SplitIndexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestConverter))] +public sealed partial class SplitIndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) { } +#if NET7_0_OR_GREATER + public SplitIndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SplitIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSplit; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementSplit; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "indices.split"; + /// + /// + /// Name of the source index to split. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// Name of the target index to create. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Target { get => P("target"); set => PR("target", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -174,7 +248,6 @@ public SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -183,7 +256,6 @@ public SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -191,16 +263,14 @@ public SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// Aliases for the resulting index. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } + public System.Collections.Generic.IDictionary? Aliases { get; set; } /// /// /// Configuration options for the target index. /// /// - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } } /// @@ -291,79 +361,276 @@ public SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic. /// /// /// -public sealed partial class SplitIndexRequestDescriptor : RequestDescriptor, SplitIndexRequestParameters> +public readonly partial struct SplitIndexRequestDescriptor { - internal SplitIndexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest Instance { get; init; } - public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSplit; + public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(index, target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SplitIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.split"; + /// + /// + /// Name of the source index to split. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public SplitIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public SplitIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public SplitIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Target = value; + return this; + } - public SplitIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.MasterTimeout = value; + return this; } - public SplitIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName target) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("target", target); - return Self; + Instance.Timeout = value; + return this; } - private IDictionary> AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } /// /// /// Aliases for the resulting index. /// /// - public SplitIndexRequestDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases = value; + return this; } /// /// - /// Configuration options for the target index. + /// Aliases for the resulting index. /// /// - public SplitIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases() { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(System.Action? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } - if (SettingsValue is not null) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -455,78 +722,257 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// /// /// -public sealed partial class SplitIndexRequestDescriptor : RequestDescriptor +public readonly partial struct SplitIndexRequestDescriptor { - internal SplitIndexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest Instance { get; init; } - public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) : base(r => r.Required("index", index).Required("target", target)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSplit; + public SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(index, target); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SplitIndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "indices.split"; + /// + /// + /// Name of the source index to split. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public SplitIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public SplitIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public SplitIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Name of the target index to create. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Target = value; + return this; + } + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public SplitIndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("index", index); - return Self; + Instance.Timeout = value; + return this; } - public SplitIndexRequestDescriptor Target(Elastic.Clients.Elasticsearch.IndexName target) + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) { - RouteValues.Required("target", target); - return Self; + Instance.WaitForActiveShards = value; + return this; } - private IDictionary AliasesValue { get; set; } - private IDictionary? SettingsValue { get; set; } + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } /// /// /// Aliases for the resulting index. /// /// - public SplitIndexRequestDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases() { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; } /// /// - /// Configuration options for the target index. + /// Aliases for the resulting index. /// /// - public SplitIndexRequestDescriptor Settings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(System.Action>? action) { - SettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } - if (SettingsValue is not null) + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases for the resulting index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration options for the target index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor AddSetting(string key, object value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexResponse.g.cs index f029453776f..d683701b11e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/SplitIndexResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SplitIndexResponse : ElasticsearchResponse +internal sealed partial class SplitIndexResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("shards_acknowledged")] - public bool ShardsAcknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAcknowledged = System.Text.Json.JsonEncodedText.Encode("shards_acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propIndex = default; + LocalJsonValue propShardsAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShardsAcknowledged.TryReadProperty(ref reader, options, PropShardsAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Index = propIndex.Value, + ShardsAcknowledged = propShardsAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShardsAcknowledged, value.ShardsAcknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponseConverter))] +public sealed partial class SplitIndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitIndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SplitIndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ShardsAcknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesRequest.g.cs index 259de6072e3..db587964c0f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class UpdateAliasesRequestParameters : RequestParameters +public sealed partial class UpdateAliasesRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,17 +42,73 @@ public sealed partial class UpdateAliasesRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class UpdateAliasesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propActions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create or update an alias. /// Adds a data stream or index to an alias. /// /// -public sealed partial class UpdateAliasesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestConverter))] +public sealed partial class UpdateAliasesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementUpdateAliases; +#if NET7_0_OR_GREATER + public UpdateAliasesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public UpdateAliasesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementUpdateAliases; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -71,7 +120,6 @@ public sealed partial class UpdateAliasesRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -80,7 +128,6 @@ public sealed partial class UpdateAliasesRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -88,8 +135,7 @@ public sealed partial class UpdateAliasesRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("actions")] - public ICollection? Actions { get; set; } + public System.Collections.Generic.ICollection? Actions { get; set; } } /// @@ -98,106 +144,157 @@ public sealed partial class UpdateAliasesRequest : PlainRequest /// -public sealed partial class UpdateAliasesRequestDescriptor : RequestDescriptor, UpdateAliasesRequestParameters> +public readonly partial struct UpdateAliasesRequestDescriptor { - internal UpdateAliasesRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest Instance { get; init; } - public UpdateAliasesRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateAliasesRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementUpdateAliases; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "indices.update_aliases"; - - public UpdateAliasesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public UpdateAliasesRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public UpdateAliasesRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private ICollection? ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor ActionsDescriptor { get; set; } - private Action> ActionsDescriptorAction { get; set; } - private Action>[] ActionsDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// Actions to perform. + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - public UpdateAliasesRequestDescriptor Actions(ICollection? actions) + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsValue = actions; - return Self; + Instance.MasterTimeout = value; + return this; } - public UpdateAliasesRequestDescriptor Actions(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor descriptor) + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsDescriptor = descriptor; - return Self; + Instance.Timeout = value; + return this; } - public UpdateAliasesRequestDescriptor Actions(Action> configure) + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(System.Collections.Generic.ICollection? value) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorActions = null; - ActionsDescriptorAction = configure; - return Self; + Instance.Actions = value; + return this; } - public UpdateAliasesRequestDescriptor Actions(params Action>[] configure) + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(params Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction[] values) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = configure; - return Self; + Instance.Actions = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(params System.Action[] actions) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor.Build(action)); } - else if (ActionsDescriptorAction is not null) + + Instance.Actions = items; + return this; + } + + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(ActionsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor.Build(action)); } - else if (ActionsDescriptorActions is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - foreach (var action in ActionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (ActionsValue is not null) + Instance.Actions = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -207,105 +304,139 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Adds a data stream or index to an alias. /// /// -public sealed partial class UpdateAliasesRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateAliasesRequestDescriptor { - internal UpdateAliasesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest Instance { get; init; } - public UpdateAliasesRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateAliasesRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementUpdateAliases; + public UpdateAliasesRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "indices.update_aliases"; + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public UpdateAliasesRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public UpdateAliasesRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(System.Collections.Generic.ICollection? value) + { + Instance.Actions = value; + return this; + } - private ICollection? ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor ActionsDescriptor { get; set; } - private Action ActionsDescriptorAction { get; set; } - private Action[] ActionsDescriptorActions { get; set; } + /// + /// + /// Actions to perform. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(params Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction[] values) + { + Instance.Actions = [.. values]; + return this; + } /// /// /// Actions to perform. /// /// - public UpdateAliasesRequestDescriptor Actions(ICollection? actions) + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Actions(params System.Action>[] actions) { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsValue = actions; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor.Build(action)); + } + + Instance.Actions = items; + return this; } - public UpdateAliasesRequestDescriptor Actions(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest Build(System.Action>? action) { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = null; - ActionsDescriptor = descriptor; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public UpdateAliasesRequestDescriptor Actions(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor ErrorTrace(bool? value) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorActions = null; - ActionsDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public UpdateAliasesRequestDescriptor Actions(params Action[] configure) + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor FilterPath(params string[]? value) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - writer.WriteEndArray(); - } - else if (ActionsDescriptorAction is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(ActionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ActionsDescriptorActions is not null) - { - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - foreach (var action in ActionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(action), options); - } + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else if (ActionsValue is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesResponse.g.cs index 5b7fd8e987a..486e6d5c063 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/UpdateAliasesResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class UpdateAliasesResponse : ElasticsearchResponse +internal sealed partial class UpdateAliasesResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponseConverter))] +public sealed partial class UpdateAliasesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateAliasesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateAliasesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryRequest.g.cs index 0f5e89c0d8b..53eb30fbda4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ValidateQueryRequestParameters : RequestParameters +public sealed partial class ValidateQueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -85,7 +78,7 @@ public sealed partial class ValidateQueryRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -123,37 +116,96 @@ public sealed partial class ValidateQueryRequestParameters : RequestParameters public bool? Rewrite { get => Q("rewrite"); set => Q("rewrite", value); } } +internal sealed partial class ValidateQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Validate a query. /// Validates a query without running it. /// /// -public sealed partial class ValidateQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestConverter))] +public sealed partial class ValidateQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public ValidateQueryRequest() { } - - public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public ValidateQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementValidateQuery; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IndexManagementValidateQuery; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "indices.validate_query"; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to search. + /// Supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. /// This behavior applies even if the request targets other open indices. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -161,7 +213,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// If true, the validation is executed on all shards instead of one random shard per index. /// /// - [JsonIgnore] public bool? AllShards { get => Q("all_shards"); set => Q("all_shards", value); } /// @@ -170,7 +221,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// This parameter can only be used when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -178,7 +228,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// If true, wildcard and prefix queries are analyzed. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -186,7 +235,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// The default operator for query string query: AND or OR. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -195,7 +243,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// This parameter can only be used when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -206,15 +253,13 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, the response returns detailed information if an error has occurred. /// /// - [JsonIgnore] public bool? Explain { get => Q("explain"); set => Q("explain", value); } /// @@ -222,7 +267,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -230,7 +274,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -238,7 +281,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// Query in the Lucene query string syntax. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -246,7 +288,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// If true, returns a more detailed explanation showing the actual Lucene query that will be executed. /// /// - [JsonIgnore] public bool? Rewrite { get => Q("rewrite"); set => Q("rewrite", value); } /// @@ -254,7 +295,6 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// Query in the Lucene query string syntax. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } @@ -264,98 +304,280 @@ public ValidateQueryRequest(Elastic.Clients.Elasticsearch.Indices? indices) : ba /// Validates a query without running it. /// /// -public sealed partial class ValidateQueryRequestDescriptor : RequestDescriptor, ValidateQueryRequestParameters> +public readonly partial struct ValidateQueryRequestDescriptor { - internal ValidateQueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest Instance { get; init; } - public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest instance) { + Instance = instance; + } + + public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(indices); } public ValidateQueryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementValidateQuery; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to search. + /// Supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.validate_query"; + /// + /// + /// If true, the validation is executed on all shards instead of one random shard per index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AllShards(bool? value = true) + { + Instance.AllShards = value; + return this; + } - public ValidateQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ValidateQueryRequestDescriptor AllShards(bool? allShards = true) => Qs("all_shards", allShards); - public ValidateQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public ValidateQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public ValidateQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public ValidateQueryRequestDescriptor Df(string? df) => Qs("df", df); - public ValidateQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ValidateQueryRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public ValidateQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ValidateQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public ValidateQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public ValidateQueryRequestDescriptor Rewrite(bool? rewrite = true) => Qs("rewrite", rewrite); + /// + /// + /// Analyzer to use for the query string. + /// This parameter can only be used when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - public ValidateQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AnalyzeWildcard(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.AnalyzeWildcard = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } + /// + /// + /// The default operator for query string query: AND or OR. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// Field to use as default where no field prefix is given in the query string. + /// This parameter can only be used when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, the response returns detailed information if an error has occurred. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } /// /// /// Query in the Lucene query string syntax. /// /// - public ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor QueryLuceneSyntax(string? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.QueryLuceneSyntax = value; + return this; } - public ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// If true, returns a more detailed explanation showing the actual Lucene query that will be executed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Rewrite(bool? value = true) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Rewrite = value; + return this; } - public ValidateQueryRequestDescriptor Query(Action> configure) + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Query(System.Action action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -365,97 +587,268 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Validates a query without running it. /// /// -public sealed partial class ValidateQueryRequestDescriptor : RequestDescriptor +public readonly partial struct ValidateQueryRequestDescriptor { - internal ValidateQueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest instance) + { + Instance = instance; + } - public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(indices); } public ValidateQueryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementValidateQuery; + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest instance) => new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and aliases to search. + /// Supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "indices.validate_query"; + /// + /// + /// If true, the validation is executed on all shards instead of one random shard per index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AllShards(bool? value = true) + { + Instance.AllShards = value; + return this; + } - public ValidateQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ValidateQueryRequestDescriptor AllShards(bool? allShards = true) => Qs("all_shards", allShards); - public ValidateQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public ValidateQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public ValidateQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public ValidateQueryRequestDescriptor Df(string? df) => Qs("df", df); - public ValidateQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ValidateQueryRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public ValidateQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public ValidateQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public ValidateQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public ValidateQueryRequestDescriptor Rewrite(bool? rewrite = true) => Qs("rewrite", rewrite); + /// + /// + /// Analyzer to use for the query string. + /// This parameter can only be used when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - public ValidateQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor AnalyzeWildcard(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.AnalyzeWildcard = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + /// + /// + /// The default operator for query string query: AND or OR. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// Field to use as default where no field prefix is given in the query string. + /// This parameter can only be used when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, the response returns detailed information if an error has occurred. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } /// /// /// Query in the Lucene query string syntax. /// /// - public ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// If true, returns a more detailed explanation showing the actual Lucene query that will be executed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Rewrite(bool? value = true) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Rewrite = value; + return this; } - public ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public ValidateQueryRequestDescriptor Query(Action configure) + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryResponse.g.cs index 90f6de37d06..f3f3a062ee1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/ValidateQueryResponse.g.cs @@ -17,23 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class ValidateQueryResponse : ElasticsearchResponse +internal sealed partial class ValidateQueryResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropExplanations = System.Text.Json.JsonEncodedText.Encode("explanations"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropValid = System.Text.Json.JsonEncodedText.Encode("valid"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue?> propExplanations = default; + LocalJsonValue propShards = default; + LocalJsonValue propValid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propExplanations.TryReadProperty(ref reader, options, PropExplanations, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propValid.TryReadProperty(ref reader, options, PropValid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Explanations = propExplanations.Value, + Shards = propShards.Value, + Valid = propValid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropExplanations, value.Explanations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropValid, value.Valid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponseConverter))] +public sealed partial class ValidateQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("error")] - public string? Error { get; init; } - [JsonInclude, JsonPropertyName("explanations")] - public IReadOnlyCollection? Explanations { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } - [JsonInclude, JsonPropertyName("valid")] - public bool Valid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Error { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Explanations { get; set; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Valid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexRequest.g.cs index 044af3b8442..e3786c75032 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class IndexRequestParameters : RequestParameters +public sealed partial class IndexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,6 +39,13 @@ public sealed partial class IndexRequestParameters : RequestParameters /// public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// Set to create to only index the document if it does not already exist (put if absent). @@ -128,6 +128,36 @@ public sealed partial class IndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class IndexRequestConverter : System.Text.Json.Serialization.JsonConverter> +{ + public override Elastic.Clients.Elasticsearch.IndexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Document = reader.ReadValue(options, static TDocument (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Document, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + } +} + +internal sealed partial class IndexRequestConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(IndexRequest<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(IndexRequestConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + /// /// /// Create or update a document in an index. @@ -215,13 +245,9 @@ public sealed partial class IndexRequestParameters : RequestParameters /// /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. /// -/// -/// /// -/// ** Distributed** +/// Distributed /// -/// -/// /// /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. @@ -300,30 +326,72 @@ public sealed partial class IndexRequestParameters : RequestParameters /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. /// /// -public sealed partial class IndexRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexRequestConverterFactory))] +public partial class IndexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", index).Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRequest(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", index).Optional("id", id)) { + Document = document; } - public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRequest(TDocument document, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", typeof(TDocument)).Optional("id", id)) { + Document = document; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceIndex; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRequest(TDocument document) : base(r => r.Required("index", typeof(TDocument)).Optional("id", Elastic.Clients.Elasticsearch.Id.From(document))) + { + Document = document; + } +#if NET7_0_OR_GREATER + public IndexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceIndex; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "index"; + /// + /// + /// A unique identifier for the document. + /// To automatically generate a document ID, use the POST /<target>/_doc/ request format and omit this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + + /// + /// + /// The name of the data stream or index to target. + /// If the target doesn't exist and matches the name or wildcard (*) pattern of an index template with a data_stream definition, this request creates the data stream. + /// If the target doesn't exist and doesn't match a data stream template, this request creates the index. + /// You can check for existing targets with the resolve index API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// Only perform the operation if the document has this primary term. /// /// - [JsonIgnore] public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } /// @@ -331,9 +399,15 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// Only perform the operation if the document has this sequence number. /// /// - [JsonIgnore] public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// Set to create to only index the document if it does not already exist (put if absent). @@ -344,7 +418,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// If the request targets a data stream, an op_type of create is required. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.OpType? OpType { get => Q("op_type"); set => Q("op_type", value); } /// @@ -354,7 +427,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// If a final pipeline is configured it will always run, regardless of the value of this parameter. /// /// - [JsonIgnore] public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } /// @@ -364,7 +436,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// If false, it does nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -372,7 +443,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// If true, the destination must be an index alias. /// /// - [JsonIgnore] public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } /// @@ -380,7 +450,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -394,7 +463,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -403,7 +471,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// It must be a non-negative long number. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -411,7 +478,6 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } /// @@ -421,15 +487,12 @@ public IndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r /// The default value of 1 means it waits for each primary shard to be active. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } - [JsonIgnore] - public TDocument Document { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - settings.SourceSerializer.Serialize(Document, writer); - } + public +#if NET7_0_OR_GREATER + required +#endif + TDocument Document { get; set; } } /// @@ -519,13 +582,9 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. /// -/// -/// /// -/// ** Distributed** +/// Distributed /// -/// -/// /// /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. @@ -604,65 +663,269 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. /// /// -public sealed partial class IndexRequestDescriptor : RequestDescriptor, IndexRequestParameters> +public readonly partial struct IndexRequestDescriptor { - internal IndexRequestDescriptor(Action> configure) => configure.Invoke(this); - public IndexRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", index).Optional("id", id)) => DocumentValue = document; + internal Elastic.Clients.Elasticsearch.IndexRequest Instance { get; init; } - public IndexRequestDescriptor(TDocument document) : this(document, typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexRequest instance) { + Instance = instance; } - public IndexRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(document, index, Elastic.Clients.Elasticsearch.Id.From(document)) + public IndexRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.IndexRequest(document, index, id); } - public IndexRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id? id) : this(document, typeof(TDocument), id) + public IndexRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.IndexRequest(document, id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceIndex; + public IndexRequestDescriptor(TDocument document) + { + Instance = new Elastic.Clients.Elasticsearch.IndexRequest(document); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public IndexRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.IndexRequestDescriptor(Elastic.Clients.Elasticsearch.IndexRequest instance) => new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexRequest(Elastic.Clients.Elasticsearch.IndexRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "index"; + /// + /// + /// A unique identifier for the document. + /// To automatically generate a document ID, use the POST /<target>/_doc/ request format and omit this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// The name of the data stream or index to target. + /// If the target doesn't exist and matches the name or wildcard (*) pattern of an index template with a data_stream definition, this request creates the data stream. + /// If the target doesn't exist and doesn't match a data stream template, this request creates the index. + /// You can check for existing targets with the resolve index API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } - public IndexRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); - public IndexRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); - public IndexRequestDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? opType) => Qs("op_type", opType); - public IndexRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public IndexRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public IndexRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public IndexRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public IndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public IndexRequestDescriptor Version(long? version) => Qs("version", version); - public IndexRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); - public IndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } - public IndexRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor IfSeqNo(long? value) { - RouteValues.Optional("id", id); - return Self; + Instance.IfSeqNo = value; + return this; } - public IndexRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor IncludeSourceOnError(bool? value = true) { - RouteValues.Required("index", index); - return Self; + Instance.IncludeSourceOnError = value; + return this; } - private TDocument DocumentValue { get; set; } + /// + /// + /// Set to create to only index the document if it does not already exist (put if absent). + /// If a document with the specified _id already exists, the indexing operation will fail. + /// The behavior is the same as using the <index>/_create endpoint. + /// If a document ID is specified, this paramater defaults to index. + /// Otherwise, it defaults to create. + /// If the request targets a data stream, an op_type of create is required. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? value) + { + Instance.OpType = value; + return this; + } + + /// + /// + /// The ID of the pipeline to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, then setting the value to _none disables the default ingest pipeline for this request. + /// If a final pipeline is configured it will always run, regardless of the value of this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Pipeline(string? value) + { + Instance.Pipeline = value; + return this; + } + + /// + /// + /// If true, Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If wait_for, it waits for a refresh to make this operation visible to search. + /// If false, it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor RequireAlias(bool? value = true) + { + Instance.RequireAlias = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + /// + /// + /// This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. + /// Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. + /// By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// An explicit version number for concurrency control. + /// It must be a non-negative long number. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// You can set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value of 1 means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Document(TDocument value) + { + Instance.Document = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(new Elastic.Clients.Elasticsearch.IndexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public IndexRequestDescriptor Document(TDocument document) + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - DocumentValue = document; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - settings.SourceSerializer.Serialize(DocumentValue, writer); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs index f6d0222b690..49baf101077 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs @@ -17,51 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class IndexResponse : ElasticsearchResponse +internal sealed partial class IndexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForcedRefresh = System.Text.Json.JsonEncodedText.Encode("forced_refresh"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.IndexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForcedRefresh = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propResult = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShards = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForcedRefresh.TryReadProperty(ref reader, options, PropForcedRefresh, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForcedRefresh = propForcedRefresh.Value, + Id = propId.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Result = propResult.Value, + SeqNo = propSeqNo.Value, + Shards = propShards.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForcedRefresh, value.ForcedRefresh, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexResponseConverter))] +public sealed partial class IndexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("forced_refresh")] - public bool? ForcedRefresh { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? ForcedRefresh { get; set; } /// /// /// The unique identifier for the added document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the index the document was added to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The result of the indexing operation: created or updated. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } /// /// @@ -69,22 +187,27 @@ public sealed partial class IndexResponse : ElasticsearchResponse /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// /// Information about the replication process of the operation. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } /// /// /// The document version, which is incremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedRequest.g.cs new file mode 100644 index 00000000000..ed895a45ac2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedRequest.g.cs @@ -0,0 +1,225 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class ChatCompletionUnifiedRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class ChatCompletionUnifiedRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { ChatCompletionRequest = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.ChatCompletionRequest, null); + } +} + +/// +/// +/// Perform chat completion inference +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestConverter))] +public sealed partial class ChatCompletionUnifiedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Id inferenceId, Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion chatCompletionRequest) : base(r => r.Required("inference_id", inferenceId)) + { + ChatCompletionRequest = chatCompletionRequest; + } +#if NET7_0_OR_GREATER + public ChatCompletionUnifiedRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceChatCompletionUnified; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.chat_completion_unified"; + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion ChatCompletionRequest { get; set; } +} + +/// +/// +/// Perform chat completion inference +/// +/// +public readonly partial struct ChatCompletionUnifiedRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChatCompletionUnifiedRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest instance) + { + Instance = instance; + } + + public ChatCompletionUnifiedRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ChatCompletionUnifiedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest instance) => new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor ChatCompletionRequest(Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion value) + { + Instance.ChatCompletionRequest = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor ChatCompletionRequest(System.Action action) + { + Instance.ChatCompletionRequest = Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SpecUtils/OverloadOf.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedResponse.g.cs similarity index 68% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/SpecUtils/OverloadOf.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedResponse.g.cs index 3ad5c752f4e..481254cf227 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SpecUtils/OverloadOf.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/ChatCompletionUnifiedResponse.g.cs @@ -17,23 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; -namespace Elastic.Clients.Elasticsearch.SpecUtils; +namespace Elastic.Clients.Elasticsearch.Inference; -/// -/// -/// A class that implements OverloadOf should have the exact same properties with the same types. -/// It can change if a property is required or not. There is no need to port the descriptions -/// and js doc tags, the compiler will do that for you. -/// -/// -public sealed partial class OverloadOf +public sealed partial class ChatCompletionUnifiedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChatCompletionUnifiedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChatCompletionUnifiedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs new file mode 100644 index 00000000000..4e3c0e6d062 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionRequest.g.cs @@ -0,0 +1,297 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class CompletionRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class CompletionRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInput = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Input = propInput.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Perform completion inference on the service +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionRequestConverter))] +public sealed partial class CompletionRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionRequest(Elastic.Clients.Elasticsearch.Id inferenceId, System.Collections.Generic.ICollection input) : base(r => r.Required("inference_id", inferenceId)) + { + Input = input; + } +#if NET7_0_OR_GREATER + public CompletionRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceCompletion; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.completion"; + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Input { get; set; } + + /// + /// + /// Optional task settings + /// + /// + public object? TaskSettings { get; set; } +} + +/// +/// +/// Perform completion inference on the service +/// +/// +public readonly partial struct CompletionRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.CompletionRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionRequest instance) + { + Instance = instance; + } + + public CompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.CompletionRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CompletionRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionRequest instance) => new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.CompletionRequest(Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Input(System.Collections.Generic.ICollection value) + { + Instance.Input = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Input(params string[] values) + { + Instance.Input = [.. values]; + return this; + } + + /// + /// + /// Optional task settings + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor TaskSettings(object? value) + { + Instance.TaskSettings = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.CompletionRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.CompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionResponse.g.cs new file mode 100644 index 00000000000..e9a673738e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/CompletionResponse.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCompletion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompletion.TryReadProperty(ref reader, options, PropCompletion, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Completion = propCompletion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompletion, value.Completion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionResponseConverter))] +public sealed partial class CompletionResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Completion { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs index d8514b99866..7d9c9df7028 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs @@ -17,54 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class DeleteInferenceRequestParameters : RequestParameters +public sealed partial class DeleteInferenceRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// When true, the endpoint is not deleted, and a list of ingest processors which reference this endpoint is returned + /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. /// /// public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } /// /// - /// When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields + /// When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields. /// /// public bool? Force { get => Q("force"); set => Q("force", value); } } +internal sealed partial class DeleteInferenceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an inference endpoint /// /// -public sealed partial class DeleteInferenceRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestConverter))] +public sealed partial class DeleteInferenceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) { } +#if NET7_0_OR_GREATER + public DeleteInferenceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; @@ -72,18 +107,34 @@ public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? /// /// - /// When true, the endpoint is not deleted, and a list of ingest processors which reference this endpoint is returned + /// The inference identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TaskType? TaskType { get => P("task_type"); set => PO("task_type", value); } + + /// + /// + /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. /// /// - [JsonIgnore] public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } /// /// - /// When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields + /// When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } } @@ -92,42 +143,126 @@ public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? /// Delete an inference endpoint /// /// -public sealed partial class DeleteInferenceRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteInferenceRequestDescriptor { - internal DeleteInferenceRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest Instance { get; init; } - public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest instance) { + Instance = instance; } - public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) { + Instance = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest(inferenceId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDelete; + public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + { + Instance = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest(taskType, inferenceId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteInferenceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest instance) => new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "inference.delete"; + /// + /// + /// The inference identifier. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor DryRun(bool? value = true) + { + Instance.DryRun = value; + return this; + } + + /// + /// + /// When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public DeleteInferenceRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun); - public DeleteInferenceRequestDescriptor Force(bool? force = true) => Qs("force", force); + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("inference_id", inferenceId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("task_type", taskType); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs index 2e7e80f69d3..0cb0e7dcd47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs @@ -17,24 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class DeleteInferenceResponse : ElasticsearchResponse +internal sealed partial class DeleteInferenceResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropPipelines = System.Text.Json.JsonEncodedText.Encode("pipelines"); + + public override Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue> propPipelines = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propPipelines.TryReadProperty(ref reader, options, PropPipelines, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Pipelines = propPipelines.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropPipelines, value.Pipelines, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponseConverter))] +public sealed partial class DeleteInferenceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteInferenceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("pipelines")] - public IReadOnlyCollection Pipelines { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Pipelines { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs index 40c96fe6b8d..dcdf716dcf2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs @@ -17,34 +17,53 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class GetInferenceRequestParameters : RequestParameters +public sealed partial class GetInferenceRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetInferenceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get an inference endpoint /// /// -public sealed partial class GetInferenceRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestConverter))] +public sealed partial class GetInferenceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetInferenceRequest() - { - } - public GetInferenceRequest(Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("inference_id", inferenceId)) { } @@ -52,14 +71,43 @@ public GetInferenceRequest(Elastic.Clients.Elasticsearch.Id? inferenceId) : base public GetInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) { } +#if NET7_0_OR_GREATER + public GetInferenceRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetInferenceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "inference.get"; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Id? InferenceId { get => P("inference_id"); set => PO("inference_id", value); } + + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TaskType? TaskType { get => P("task_type"); set => PO("task_type", value); } } /// @@ -67,39 +115,108 @@ public GetInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? tas /// Get an inference endpoint /// /// -public sealed partial class GetInferenceRequestDescriptor : RequestDescriptor +public readonly partial struct GetInferenceRequestDescriptor { - internal GetInferenceRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest Instance { get; init; } - public GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest instance) { + Instance = instance; + } + + public GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id? inferenceId) + { + Instance = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(inferenceId); + } + + public GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) + { + Instance = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(taskType, inferenceId); } public GetInferenceRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGet; + public static explicit operator Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest instance) => new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.InferenceId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? value) + { + Instance.TaskType = value; + return this; + } - internal override string OperationName => "inference.get"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? inferenceId) + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("inference_id", inferenceId); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("task_type", taskType); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs index 254b29ef133..76808319901 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class GetInferenceResponse : ElasticsearchResponse +internal sealed partial class GetInferenceResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("endpoints")] - public IReadOnlyCollection Endpoints { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropEndpoints = System.Text.Json.JsonEncodedText.Encode("endpoints"); + + public override Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEndpoints = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEndpoints.TryReadProperty(ref reader, options, PropEndpoints, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Endpoints = propEndpoints.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEndpoints, value.Endpoints, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GetInferenceResponseConverter))] +public sealed partial class GetInferenceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInferenceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Endpoints { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs deleted file mode 100644 index 8c0ff5643b7..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs +++ /dev/null @@ -1,199 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Inference; - -public sealed partial class InferenceRequestParameters : RequestParameters -{ - /// - /// - /// Specifies the amount of time to wait for the inference request to complete. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } -} - -/// -/// -/// Perform inference on the service -/// -/// -public sealed partial class InferenceRequest : PlainRequest -{ - public InferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) - { - } - - public InferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceInference; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.inference"; - - /// - /// - /// Specifies the amount of time to wait for the inference request to complete. - /// - /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } - - /// - /// - /// Inference input. - /// Either a string or an array of strings. - /// - /// - [JsonInclude, JsonPropertyName("input")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection Input { get; set; } - - /// - /// - /// Query input, required for rerank task. - /// Not required for other tasks. - /// - /// - [JsonInclude, JsonPropertyName("query")] - public string? Query { get; set; } - - /// - /// - /// Optional task settings - /// - /// - [JsonInclude, JsonPropertyName("task_settings")] - public object? TaskSettings { get; set; } -} - -/// -/// -/// Perform inference on the service -/// -/// -public sealed partial class InferenceRequestDescriptor : RequestDescriptor -{ - internal InferenceRequestDescriptor(Action configure) => configure.Invoke(this); - - public InferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) - { - } - - public InferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceInference; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.inference"; - - public InferenceRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public InferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) - { - RouteValues.Required("inference_id", inferenceId); - return Self; - } - - public InferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) - { - RouteValues.Optional("task_type", taskType); - return Self; - } - - private ICollection InputValue { get; set; } - private string? QueryValue { get; set; } - private object? TaskSettingsValue { get; set; } - - /// - /// - /// Inference input. - /// Either a string or an array of strings. - /// - /// - public InferenceRequestDescriptor Input(ICollection input) - { - InputValue = input; - return Self; - } - - /// - /// - /// Query input, required for rerank task. - /// Not required for other tasks. - /// - /// - public InferenceRequestDescriptor Query(string? query) - { - QueryValue = query; - return Self; - } - - /// - /// - /// Optional task settings - /// - /// - public InferenceRequestDescriptor TaskSettings(object? taskSettings) - { - TaskSettingsValue = taskSettings; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - writer.WritePropertyName("input"); - SingleOrManySerializationHelper.Serialize(InputValue, writer, options); - if (!string.IsNullOrEmpty(QueryValue)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - } - - if (TaskSettingsValue is not null) - { - writer.WritePropertyName("task_settings"); - JsonSerializer.Serialize(writer, TaskSettingsValue, options); - } - - writer.WriteEndObject(); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudRequest.g.cs new file mode 100644 index 00000000000..df20259d4f9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudRequest.g.cs @@ -0,0 +1,402 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutAlibabacloudRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutAlibabacloudRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an AlibabaCloud AI Search inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the alibabacloud-ai-search service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestConverter))] +public sealed partial class PutAlibabacloudRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId) : base(r => r.Required("task_type", taskType).Required("alibabacloud_inference_id", alibabacloudInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId, Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("alibabacloud_inference_id", alibabacloudInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutAlibabacloudRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutAlibabacloud; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_alibabacloud"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AlibabacloudInferenceId { get => P("alibabacloud_inference_id"); set => PR("alibabacloud_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, alibabacloud-ai-search. + /// + /// + public string Service => "alibabacloud-ai-search"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the alibabacloud-ai-search service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an AlibabaCloud AI Search inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the alibabacloud-ai-search service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutAlibabacloudRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAlibabacloudRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest instance) + { + Instance = instance; + } + + public PutAlibabacloudRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest(taskType, alibabacloudInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAlibabacloudRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor AlibabacloudInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.AlibabacloudInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the alibabacloud-ai-search service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the alibabacloud-ai-search service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudResponse.g.cs new file mode 100644 index 00000000000..31d317bddda --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAlibabacloudResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutAlibabacloudResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponseConverter))] +public sealed partial class PutAlibabacloudResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAlibabacloudResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAlibabacloudResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockRequest.g.cs new file mode 100644 index 00000000000..89854e8ab97 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockRequest.g.cs @@ -0,0 +1,410 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutAmazonbedrockRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutAmazonbedrockRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Amazon Bedrock inference endpoint. +/// +/// +/// Creates an inference endpoint to perform an inference task with the amazonbedrock service. +/// +/// +/// info +/// You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestConverter))] +public sealed partial class PutAmazonbedrockRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId) : base(r => r.Required("task_type", taskType).Required("amazonbedrock_inference_id", amazonbedrockInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId, Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("amazonbedrock_inference_id", amazonbedrockInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutAmazonbedrockRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutAmazonbedrock; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_amazonbedrock"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AmazonbedrockInferenceId { get => P("amazonbedrock_inference_id"); set => PR("amazonbedrock_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, amazonbedrock. + /// + /// + public string Service => "amazonbedrock"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the amazonbedrock service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an Amazon Bedrock inference endpoint. +/// +/// +/// Creates an inference endpoint to perform an inference task with the amazonbedrock service. +/// +/// +/// info +/// You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutAmazonbedrockRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAmazonbedrockRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest instance) + { + Instance = instance; + } + + public PutAmazonbedrockRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest(taskType, amazonbedrockInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAmazonbedrockRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor AmazonbedrockInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.AmazonbedrockInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the amazonbedrock service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the amazonbedrock service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockResponse.g.cs new file mode 100644 index 00000000000..e3821f127f7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAmazonbedrockResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutAmazonbedrockResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponseConverter))] +public sealed partial class PutAmazonbedrockResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAmazonbedrockResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAmazonbedrockResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs new file mode 100644 index 00000000000..17051a4368b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicRequest.g.cs @@ -0,0 +1,392 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutAnthropicRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutAnthropicRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Anthropic inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the anthropic service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestConverter))] +public sealed partial class PutAnthropicRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAnthropicRequest(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId) : base(r => r.Required("task_type", taskType).Required("anthropic_inference_id", anthropicInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAnthropicRequest(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId, Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("anthropic_inference_id", anthropicInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutAnthropicRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAnthropicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutAnthropic; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_anthropic"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AnthropicInferenceId { get => P("anthropic_inference_id"); set => PR("anthropic_inference_id", value); } + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is completion. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, anthropic. + /// + /// + public string Service => "anthropic"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an Anthropic inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the anthropic service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutAnthropicRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAnthropicRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest instance) + { + Instance = instance; + } + + public PutAnthropicRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest(taskType, anthropicInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAnthropicRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor AnthropicInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.AnthropicInferenceId = value; + return this; + } + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is completion. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor TaskSettings(System.Action action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicResponse.g.cs new file mode 100644 index 00000000000..6363b51dfb6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAnthropicResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutAnthropicResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponseConverter))] +public sealed partial class PutAnthropicResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAnthropicResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAnthropicResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs new file mode 100644 index 00000000000..0e88c0587d4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioRequest.g.cs @@ -0,0 +1,402 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutAzureaistudioRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutAzureaistudioRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Azure AI studio inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the azureaistudio service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestConverter))] +public sealed partial class PutAzureaistudioRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId) : base(r => r.Required("task_type", taskType).Required("azureaistudio_inference_id", azureaistudioInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId, Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("azureaistudio_inference_id", azureaistudioInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutAzureaistudioRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutAzureaistudio; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_azureaistudio"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AzureaistudioInferenceId { get => P("azureaistudio_inference_id"); set => PR("azureaistudio_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, azureaistudio. + /// + /// + public string Service => "azureaistudio"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an Azure AI studio inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the azureaistudio service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutAzureaistudioRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest instance) + { + Instance = instance; + } + + public PutAzureaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest(taskType, azureaistudioInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAzureaistudioRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor AzureaistudioInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.AzureaistudioInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioResponse.g.cs new file mode 100644 index 00000000000..2ba6b24f432 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureaistudioResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutAzureaistudioResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponseConverter))] +public sealed partial class PutAzureaistudioResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureaistudioResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAzureaistudioResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiRequest.g.cs new file mode 100644 index 00000000000..1b49344477d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiRequest.g.cs @@ -0,0 +1,440 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutAzureopenaiRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutAzureopenaiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Azure OpenAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the azureopenai service. +/// +/// +/// The list of chat completion models that you can choose from in your Azure OpenAI deployment include: +/// +/// +/// +/// +/// GPT-4 and GPT-4 Turbo models +/// +/// +/// +/// +/// GPT-3.5 +/// +/// +/// +/// +/// The list of embeddings models that you can choose from in your deployment can be found in the Azure models documentation. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestConverter))] +public sealed partial class PutAzureopenaiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId) : base(r => r.Required("task_type", taskType).Required("azureopenai_inference_id", azureopenaiInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId, Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("azureopenai_inference_id", azureopenaiInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutAzureopenaiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutAzureopenai; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_azureopenai"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AzureopenaiInferenceId { get => P("azureopenai_inference_id"); set => PR("azureopenai_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// NOTE: The chat_completion task type only supports streaming and only through the _stream API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, azureopenai. + /// + /// + public string Service => "azureopenai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the azureopenai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an Azure OpenAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the azureopenai service. +/// +/// +/// The list of chat completion models that you can choose from in your Azure OpenAI deployment include: +/// +/// +/// +/// +/// GPT-4 and GPT-4 Turbo models +/// +/// +/// +/// +/// GPT-3.5 +/// +/// +/// +/// +/// The list of embeddings models that you can choose from in your deployment can be found in the Azure models documentation. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutAzureopenaiRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureopenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest instance) + { + Instance = instance; + } + + public PutAzureopenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest(taskType, azureopenaiInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutAzureopenaiRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor AzureopenaiInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.AzureopenaiInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// NOTE: The chat_completion task type only supports streaming and only through the _stream API. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the azureopenai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the azureopenai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiResponse.g.cs new file mode 100644 index 00000000000..c092479a798 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutAzureopenaiResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutAzureopenaiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponseConverter))] +public sealed partial class PutAzureopenaiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutAzureopenaiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutAzureopenaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereRequest.g.cs new file mode 100644 index 00000000000..2ec6aaca32c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereRequest.g.cs @@ -0,0 +1,405 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutCohereRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutCohereRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutCohereRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutCohereRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutCohereRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a Cohere inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the cohere service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutCohereRequestConverter))] +public sealed partial class PutCohereRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCohereRequest(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId) : base(r => r.Required("task_type", taskType).Required("cohere_inference_id", cohereInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCohereRequest(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId, Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("cohere_inference_id", cohereInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutCohereRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCohereRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutCohere; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_cohere"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CohereInferenceId { get => P("cohere_inference_id"); set => PR("cohere_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.CohereTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, cohere. + /// + /// + public string Service => "cohere"; + + /// + /// + /// Settings used to install the inference model. + /// These settings are specific to the cohere service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create a Cohere inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the cohere service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutCohereRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutCohereRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCohereRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutCohereRequest instance) + { + Instance = instance; + } + + public PutCohereRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequest(taskType, cohereInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutCohereRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutCohereRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutCohereRequest(Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor CohereInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CohereInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.CohereTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. + /// These settings are specific to the cohere service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. + /// These settings are specific to the cohere service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutCohereRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutCohereRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereResponse.g.cs new file mode 100644 index 00000000000..d04af5a4c56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutCohereResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutCohereResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutCohereResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutCohereResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutCohereResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutCohereResponseConverter))] +public sealed partial class PutCohereResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCohereResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCohereResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchRequest.g.cs new file mode 100644 index 00000000000..a944cf545cb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchRequest.g.cs @@ -0,0 +1,424 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutElasticsearchRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutElasticsearchRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Elasticsearch inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the elasticsearch service. +/// +/// +/// info +/// Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings. +/// +/// +/// If you use the ELSER or the E5 model through the elasticsearch service, the API request will automatically download and deploy the model if it isn't downloaded yet. +/// +/// +/// info +/// You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. +/// +/// +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestConverter))] +public sealed partial class PutElasticsearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId) : base(r => r.Required("task_type", taskType).Required("elasticsearch_inference_id", elasticsearchInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId, Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("elasticsearch_inference_id", elasticsearchInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutElasticsearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutElasticsearch; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_elasticsearch"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// The must not match the model_id. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ElasticsearchInferenceId { get => P("elasticsearch_inference_id"); set => PR("elasticsearch_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, elasticsearch. + /// + /// + public string Service => "elasticsearch"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elasticsearch service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an Elasticsearch inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the elasticsearch service. +/// +/// +/// info +/// Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings. +/// +/// +/// If you use the ELSER or the E5 model through the elasticsearch service, the API request will automatically download and deploy the model if it isn't downloaded yet. +/// +/// +/// info +/// You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. +/// +/// +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutElasticsearchRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElasticsearchRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest instance) + { + Instance = instance; + } + + public PutElasticsearchRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest(taskType, elasticsearchInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutElasticsearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// The must not match the model_id. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ElasticsearchInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ElasticsearchInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elasticsearch service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elasticsearch service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchResponse.g.cs new file mode 100644 index 00000000000..199c5f88133 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElasticsearchResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutElasticsearchResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponseConverter))] +public sealed partial class PutElasticsearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElasticsearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutElasticsearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserRequest.g.cs new file mode 100644 index 00000000000..e75f9b47c7e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserRequest.g.cs @@ -0,0 +1,371 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutElserRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutElserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutElserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutElserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutElserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an ELSER inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the elser service. +/// You can also deploy ELSER by using the Elasticsearch inference integration. +/// +/// +/// info +/// Your Elasticsearch deployment contains a preconfigured ELSER inference endpoint, you only need to create the enpoint using the API if you want to customize the settings. +/// +/// +/// The API request will automatically download and deploy the ELSER model if it isn't already downloaded. +/// +/// +/// info +/// You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. +/// +/// +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutElserRequestConverter))] +public sealed partial class PutElserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElserRequest(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId) : base(r => r.Required("task_type", taskType).Required("elser_inference_id", elserInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElserRequest(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId, Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("elser_inference_id", elserInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutElserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutElserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutElser; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_elser"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ElserInferenceId { get => P("elser_inference_id"); set => PR("elser_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.ElserTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, elser. + /// + /// + public string Service => "elser"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elser service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings ServiceSettings { get; set; } +} + +/// +/// +/// Create an ELSER inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the elser service. +/// You can also deploy ELSER by using the Elasticsearch inference integration. +/// +/// +/// info +/// Your Elasticsearch deployment contains a preconfigured ELSER inference endpoint, you only need to create the enpoint using the API if you want to customize the settings. +/// +/// +/// The API request will automatically download and deploy the ELSER model if it isn't already downloaded. +/// +/// +/// info +/// You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. +/// +/// +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutElserRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutElserRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElserRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutElserRequest instance) + { + Instance = instance; + } + + public PutElserRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutElserRequest(taskType, elserInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutElserRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutElserRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutElserRequest(Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ElserInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ElserInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.ElserTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elser service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the elser service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutElserRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutElserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserResponse.g.cs new file mode 100644 index 00000000000..826965b7f3d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutElserResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutElserResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutElserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutElserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutElserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutElserResponseConverter))] +public sealed partial class PutElserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutElserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutElserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioRequest.g.cs new file mode 100644 index 00000000000..140dab893bc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioRequest.g.cs @@ -0,0 +1,349 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutGoogleaistudioRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutGoogleaistudioRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an Google AI Studio inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the googleaistudio service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestConverter))] +public sealed partial class PutGoogleaistudioRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId) : base(r => r.Required("task_type", taskType).Required("googleaistudio_inference_id", googleaistudioInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId, Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("googleaistudio_inference_id", googleaistudioInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutGoogleaistudioRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutGoogleaistudio; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_googleaistudio"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id GoogleaistudioInferenceId { get => P("googleaistudio_inference_id"); set => PR("googleaistudio_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, googleaistudio. + /// + /// + public string Service => "googleaistudio"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googleaistudio service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings ServiceSettings { get; set; } +} + +/// +/// +/// Create an Google AI Studio inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the googleaistudio service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutGoogleaistudioRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGoogleaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest instance) + { + Instance = instance; + } + + public PutGoogleaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest(taskType, googleaistudioInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutGoogleaistudioRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor GoogleaistudioInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.GoogleaistudioInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googleaistudio service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googleaistudio service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioResponse.g.cs new file mode 100644 index 00000000000..f1c54653693 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGoogleaistudioResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutGoogleaistudioResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponseConverter))] +public sealed partial class PutGoogleaistudioResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGoogleaistudioResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGoogleaistudioResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiRequest.g.cs new file mode 100644 index 00000000000..661dd54566b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiRequest.g.cs @@ -0,0 +1,402 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutGooglevertexaiRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutGooglevertexaiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a Google Vertex AI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the googlevertexai service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestConverter))] +public sealed partial class PutGooglevertexaiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId) : base(r => r.Required("task_type", taskType).Required("googlevertexai_inference_id", googlevertexaiInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId, Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("googlevertexai_inference_id", googlevertexaiInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutGooglevertexaiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutGooglevertexai; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_googlevertexai"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id GooglevertexaiInferenceId { get => P("googlevertexai_inference_id"); set => PR("googlevertexai_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, googlevertexai. + /// + /// + public string Service => "googlevertexai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googlevertexai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create a Google Vertex AI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the googlevertexai service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutGooglevertexaiRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGooglevertexaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest instance) + { + Instance = instance; + } + + public PutGooglevertexaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest(taskType, googlevertexaiInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutGooglevertexaiRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor GooglevertexaiInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.GooglevertexaiInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googlevertexai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the googlevertexai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiResponse.g.cs new file mode 100644 index 00000000000..0497196f15b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutGooglevertexaiResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutGooglevertexaiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponseConverter))] +public sealed partial class PutGooglevertexaiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGooglevertexaiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGooglevertexaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceRequest.g.cs new file mode 100644 index 00000000000..add5d04ea5d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceRequest.g.cs @@ -0,0 +1,439 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutHuggingFaceRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutHuggingFaceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a Hugging Face inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the hugging_face service. +/// +/// +/// You must first create an inference endpoint on the Hugging Face endpoint page to get an endpoint URL. +/// Select the model you want to use on the new endpoint creation page (for example intfloat/e5-small-v2), then select the sentence embeddings task under the advanced configuration section. +/// Create the endpoint and copy the URL after the endpoint initialization has been finished. +/// +/// +/// The following models are recommended for the Hugging Face service: +/// +/// +/// +/// +/// all-MiniLM-L6-v2 +/// +/// +/// +/// +/// all-MiniLM-L12-v2 +/// +/// +/// +/// +/// all-mpnet-base-v2 +/// +/// +/// +/// +/// e5-base-v2 +/// +/// +/// +/// +/// e5-small-v2 +/// +/// +/// +/// +/// multilingual-e5-base +/// +/// +/// +/// +/// multilingual-e5-small +/// +/// +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestConverter))] +public sealed partial class PutHuggingFaceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId) : base(r => r.Required("task_type", taskType).Required("huggingface_inference_id", huggingfaceInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId, Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("huggingface_inference_id", huggingfaceInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutHuggingFaceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutHuggingFace; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_hugging_face"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id HuggingfaceInferenceId { get => P("huggingface_inference_id"); set => PR("huggingface_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, hugging_face. + /// + /// + public string Service => "hugging_face"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the hugging_face service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings ServiceSettings { get; set; } +} + +/// +/// +/// Create a Hugging Face inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the hugging_face service. +/// +/// +/// You must first create an inference endpoint on the Hugging Face endpoint page to get an endpoint URL. +/// Select the model you want to use on the new endpoint creation page (for example intfloat/e5-small-v2), then select the sentence embeddings task under the advanced configuration section. +/// Create the endpoint and copy the URL after the endpoint initialization has been finished. +/// +/// +/// The following models are recommended for the Hugging Face service: +/// +/// +/// +/// +/// all-MiniLM-L6-v2 +/// +/// +/// +/// +/// all-MiniLM-L12-v2 +/// +/// +/// +/// +/// all-mpnet-base-v2 +/// +/// +/// +/// +/// e5-base-v2 +/// +/// +/// +/// +/// e5-small-v2 +/// +/// +/// +/// +/// multilingual-e5-base +/// +/// +/// +/// +/// multilingual-e5-small +/// +/// +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutHuggingFaceRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutHuggingFaceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest instance) + { + Instance = instance; + } + + public PutHuggingFaceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest(taskType, huggingfaceInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutHuggingFaceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor HuggingfaceInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.HuggingfaceInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the hugging_face service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the hugging_face service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceResponse.g.cs new file mode 100644 index 00000000000..82f5edf1e93 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutHuggingFaceResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutHuggingFaceResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponseConverter))] +public sealed partial class PutHuggingFaceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutHuggingFaceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutHuggingFaceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs index 2b49b107239..6edf4da1ab4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs @@ -17,23 +17,29 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class PutInferenceRequestParameters : RequestParameters +public sealed partial class PutInferenceRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutInferenceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { InferenceConfig = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.InferenceConfig, null); + } +} + /// /// /// Create an inference endpoint. @@ -49,31 +55,73 @@ public sealed partial class PutInferenceRequestParameters : RequestParameters /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. /// /// -public sealed partial class PutInferenceRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestConverter))] +public sealed partial class PutInferenceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) { } + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePut; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId, Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) : base(r => r.Required("inference_id", inferenceId)) + { + InferenceConfig = inferenceConfig; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + { + InferenceConfig = inferenceConfig; + } +#if NET7_0_OR_GREATER + public PutInferenceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePut; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "inference.put"; - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfig { get; set; } + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, InferenceConfig, options); - } + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TaskType? TaskType { get => P("task_type"); set => PO("task_type", value); } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfig { get; set; } } /// @@ -91,62 +139,120 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. /// /// -public sealed partial class PutInferenceRequestDescriptor : RequestDescriptor +public readonly partial struct PutInferenceRequestDescriptor { - internal PutInferenceRequestDescriptor(Action configure) => configure.Invoke(this); - public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; - public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; + internal Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest instance) + { + Instance = instance; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePut; + public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest(inferenceId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest(taskType, inferenceId); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutInferenceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "inference.put"; + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } - public PutInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) + /// + /// + /// The task type + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? value) { - RouteValues.Required("inference_id", inferenceId); - return Self; + Instance.TaskType = value; + return this; } - public PutInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint value) { - RouteValues.Optional("task_type", taskType); - return Self; + Instance.InferenceConfig = value; + return this; } - private Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor InferenceConfig(System.Action action) + { + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public PutInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor Pretty(bool? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.Pretty = value; + return this; } - public PutInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor SourceQueryString(string? value) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public PutInferenceRequestDescriptor InferenceConfig(Action configure) + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, InferenceConfigValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs index a4efc6e47fa..bfa09f4b0d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs @@ -17,62 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class PutInferenceResponse : ElasticsearchResponse +internal sealed partial class PutInferenceResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutInferenceResponseConverter))] +public sealed partial class PutInferenceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutInferenceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Chunking configuration object /// /// - [JsonInclude, JsonPropertyName("chunking_settings")] - public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; init; } + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } /// /// /// The inference Id /// /// - [JsonInclude, JsonPropertyName("inference_id")] - public string InferenceId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } /// /// /// The service type /// /// - [JsonInclude, JsonPropertyName("service")] - public string Service { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } /// /// /// Settings specific to the service /// /// - [JsonInclude, JsonPropertyName("service_settings")] - public object ServiceSettings { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } /// /// /// Task settings specific to the service and task type /// /// - [JsonInclude, JsonPropertyName("task_settings")] - public object? TaskSettings { get; init; } + public object? TaskSettings { get; set; } /// /// /// The task type /// /// - [JsonInclude, JsonPropertyName("task_type")] - public Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiRequest.g.cs new file mode 100644 index 00000000000..2ff13758ab3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiRequest.g.cs @@ -0,0 +1,410 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutJinaaiRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutJinaaiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an JinaAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the jinaai service. +/// +/// +/// To review the available rerank models, refer to https://jina.ai/reranker. +/// To review the available text_embedding models, refer to the https://jina.ai/embeddings/. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestConverter))] +public sealed partial class PutJinaaiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJinaaiRequest(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId) : base(r => r.Required("task_type", taskType).Required("jinaai_inference_id", jinaaiInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJinaaiRequest(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId, Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("jinaai_inference_id", jinaaiInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutJinaaiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJinaaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutJinaai; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_jinaai"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JinaaiInferenceId { get => P("jinaai_inference_id"); set => PR("jinaai_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.JinaAITaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, jinaai. + /// + /// + public string Service => "jinaai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the jinaai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an JinaAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the jinaai service. +/// +/// +/// To review the available rerank models, refer to https://jina.ai/reranker. +/// To review the available text_embedding models, refer to the https://jina.ai/embeddings/. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutJinaaiRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJinaaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest instance) + { + Instance = instance; + } + + public PutJinaaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest(taskType, jinaaiInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutJinaaiRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor JinaaiInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JinaaiInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the jinaai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the jinaai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiResponse.g.cs new file mode 100644 index 00000000000..7b312e81b9e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutJinaaiResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutJinaaiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponseConverter))] +public sealed partial class PutJinaaiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJinaaiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJinaaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralRequest.g.cs new file mode 100644 index 00000000000..bc36345d25d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralRequest.g.cs @@ -0,0 +1,351 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutMistralRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutMistralRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutMistralRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutMistralRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutMistralRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a Mistral inference endpoint. +/// +/// +/// Creates an inference endpoint to perform an inference task with the mistral service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutMistralRequestConverter))] +public sealed partial class PutMistralRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMistralRequest(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId) : base(r => r.Required("task_type", taskType).Required("mistral_inference_id", mistralInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMistralRequest(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId, Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("mistral_inference_id", mistralInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutMistralRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutMistralRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutMistral; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_mistral"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id MistralInferenceId { get => P("mistral_inference_id"); set => PR("mistral_inference_id", value); } + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is text_embedding. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.MistralTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, mistral. + /// + /// + public string Service => "mistral"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the mistral service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings ServiceSettings { get; set; } +} + +/// +/// +/// Create a Mistral inference endpoint. +/// +/// +/// Creates an inference endpoint to perform an inference task with the mistral service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutMistralRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutMistralRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMistralRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutMistralRequest instance) + { + Instance = instance; + } + + public PutMistralRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequest(taskType, mistralInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutMistralRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutMistralRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutMistralRequest(Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor MistralInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.MistralInferenceId = value; + return this; + } + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is text_embedding. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.MistralTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the mistral service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the mistral service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutMistralRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutMistralRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralResponse.g.cs new file mode 100644 index 00000000000..99c51afe541 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutMistralResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutMistralResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutMistralResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutMistralResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutMistralResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutMistralResponseConverter))] +public sealed partial class PutMistralResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutMistralResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutMistralResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiRequest.g.cs new file mode 100644 index 00000000000..cf1af4bb0a4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiRequest.g.cs @@ -0,0 +1,404 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutOpenaiRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutOpenaiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an OpenAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the openai service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestConverter))] +public sealed partial class PutOpenaiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutOpenaiRequest(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId) : base(r => r.Required("task_type", taskType).Required("openai_inference_id", openaiInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutOpenaiRequest(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId, Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("openai_inference_id", openaiInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutOpenaiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutOpenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutOpenai; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_openai"; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id OpenaiInferenceId { get => P("openai_inference_id"); set => PR("openai_inference_id", value); } + + /// + /// + /// The type of the inference task that the model will perform. + /// NOTE: The chat_completion task type only supports streaming and only through the _stream API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.OpenAITaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, openai. + /// + /// + public string Service => "openai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create an OpenAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the openai service. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutOpenaiRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutOpenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest instance) + { + Instance = instance; + } + + public PutOpenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest(taskType, openaiInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutOpenaiRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor OpenaiInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.OpenaiInferenceId = value; + return this; + } + + /// + /// + /// The type of the inference task that the model will perform. + /// NOTE: The chat_completion task type only supports streaming and only through the _stream API. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the openai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiResponse.g.cs new file mode 100644 index 00000000000..9e147977087 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutOpenaiResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutOpenaiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponseConverter))] +public sealed partial class PutOpenaiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutOpenaiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutOpenaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiRequest.g.cs new file mode 100644 index 00000000000..7d4826808e8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiRequest.g.cs @@ -0,0 +1,394 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutVoyageaiRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutVoyageaiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a VoyageAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the voyageai service. +/// +/// +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestConverter))] +public sealed partial class PutVoyageaiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId) : base(r => r.Required("task_type", taskType).Required("voyageai_inference_id", voyageaiInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId, Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("voyageai_inference_id", voyageaiInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutVoyageaiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutVoyageai; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_voyageai"; + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id VoyageaiInferenceId { get => P("voyageai_inference_id"); set => PR("voyageai_inference_id", value); } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The type of service supported for the specified task type. In this case, voyageai. + /// + /// + public string Service => "voyageai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the voyageai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings ServiceSettings { get; set; } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings? TaskSettings { get; set; } +} + +/// +/// +/// Create a VoyageAI inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the voyageai service. +/// +/// +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutVoyageaiRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutVoyageaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest instance) + { + Instance = instance; + } + + public PutVoyageaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest(taskType, voyageaiInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutVoyageaiRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The type of the inference task that the model will perform. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor VoyageaiInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.VoyageaiInferenceId = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) + { + Instance.ChunkingSettings = value; + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ChunkingSettings() + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// The chunking configuration object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ChunkingSettings(System.Action? action) + { + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the voyageai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the voyageai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor TaskSettings(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings? value) + { + Instance.TaskSettings = value; + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor TaskSettings() + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to configure the inference task. + /// These settings are specific to the task type you specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor TaskSettings(System.Action? action) + { + Instance.TaskSettings = Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiResponse.g.cs new file mode 100644 index 00000000000..929cafb70b3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutVoyageaiResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutVoyageaiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponseConverter))] +public sealed partial class PutVoyageaiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutVoyageaiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutVoyageaiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxRequest.g.cs new file mode 100644 index 00000000000..92b3f8cee1b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxRequest.g.cs @@ -0,0 +1,306 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutWatsonxRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutWatsonxRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propServiceSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropService)) + { + reader.Skip(); + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ServiceSettings = propServiceSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Create a Watsonx inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the watsonxai service. +/// You need an IBM Cloud Databases for Elasticsearch deployment to use the watsonxai inference service. +/// You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestConverter))] +public sealed partial class PutWatsonxRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutWatsonxRequest(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId) : base(r => r.Required("task_type", taskType).Required("watsonx_inference_id", watsonxInferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutWatsonxRequest(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId, Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings serviceSettings) : base(r => r.Required("task_type", taskType).Required("watsonx_inference_id", watsonxInferenceId)) + { + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public PutWatsonxRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutWatsonxRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferencePutWatsonx; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put_watsonx"; + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is text_embedding. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType TaskType { get => P("task_type"); set => PR("task_type", value); } + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id WatsonxInferenceId { get => P("watsonx_inference_id"); set => PR("watsonx_inference_id", value); } + + /// + /// + /// The type of service supported for the specified task type. In this case, watsonxai. + /// + /// + public string Service => "watsonxai"; + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings ServiceSettings { get; set; } +} + +/// +/// +/// Create a Watsonx inference endpoint. +/// +/// +/// Create an inference endpoint to perform an inference task with the watsonxai service. +/// You need an IBM Cloud Databases for Elasticsearch deployment to use the watsonxai inference service. +/// You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. +/// +/// +/// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. +/// After creating the endpoint, wait for the model deployment to complete before using it. +/// To verify the deployment status, use the get trained model statistics API. +/// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". +/// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. +/// +/// +public readonly partial struct PutWatsonxRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutWatsonxRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest instance) + { + Instance = instance; + } + + public PutWatsonxRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest(taskType, watsonxInferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutWatsonxRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest instance) => new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The task type. + /// The only valid task type for the model to perform is text_embedding. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType value) + { + Instance.TaskType = value; + return this; + } + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor WatsonxInferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.WatsonxInferenceId = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor ServiceSettings(Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings value) + { + Instance.ServiceSettings = value; + return this; + } + + /// + /// + /// Settings used to install the inference model. These settings are specific to the watsonxai service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor ServiceSettings(System.Action action) + { + Instance.ServiceSettings = Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxResponse.g.cs new file mode 100644 index 00000000000..eac8b5e6efb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutWatsonxResponse.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class PutWatsonxResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponseConverter))] +public sealed partial class PutWatsonxResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutWatsonxResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutWatsonxResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } + + /// + /// + /// The service type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } + + /// + /// + /// Settings specific to the service + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } + + /// + /// + /// Task settings specific to the service and task type + /// + /// + public object? TaskSettings { get; set; } + + /// + /// + /// The task type + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankRequest.g.cs new file mode 100644 index 00000000000..74e9d32061a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankRequest.g.cs @@ -0,0 +1,343 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class RerankRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// The amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class RerankRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.RerankRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInput = default; + LocalJsonValue propQuery = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.RerankRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Input = propInput.Value, + Query = propQuery.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.RerankRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Perform rereanking inference on the service +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.RerankRequestConverter))] +public sealed partial class RerankRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerankRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerankRequest(Elastic.Clients.Elasticsearch.Id inferenceId, System.Collections.Generic.ICollection input, string query) : base(r => r.Required("inference_id", inferenceId)) + { + Input = input; + Query = query; + } +#if NET7_0_OR_GREATER + public RerankRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RerankRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceRerank; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.rerank"; + + /// + /// + /// The unique identifier for the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// The amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// info + /// Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Input { get; set; } + + /// + /// + /// Query input. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } + + /// + /// + /// Task settings for the individual inference request. + /// These settings are specific to the task type you specified and override the task settings specified when initializing the service. + /// + /// + public object? TaskSettings { get; set; } +} + +/// +/// +/// Perform rereanking inference on the service +/// +/// +public readonly partial struct RerankRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.RerankRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerankRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.RerankRequest instance) + { + Instance = instance; + } + + public RerankRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.RerankRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RerankRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.RerankRequest instance) => new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.RerankRequest(Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier for the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// The amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// info + /// Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Input(System.Collections.Generic.ICollection value) + { + Instance.Input = value; + return this; + } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// info + /// Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Input(params string[] values) + { + Instance.Input = [.. values]; + return this; + } + + /// + /// + /// Query input. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Query(string value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// Task settings for the individual inference request. + /// These settings are specific to the task type you specified and override the task settings specified when initializing the service. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor TaskSettings(object? value) + { + Instance.TaskSettings = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.RerankRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.RerankRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankResponse.g.cs new file mode 100644 index 00000000000..bfeccc466aa --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/RerankResponse.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class RerankResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + + public override Elastic.Clients.Elasticsearch.Inference.RerankResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRerank = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRerank.TryReadProperty(ref reader, options, PropRerank, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.RerankResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Rerank = propRerank.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.RerankResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRerank, value.Rerank, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.RerankResponseConverter))] +public sealed partial class RerankResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerankResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RerankResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Rerank { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs new file mode 100644 index 00000000000..ab5e44c0148 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingRequest.g.cs @@ -0,0 +1,297 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class SparseEmbeddingRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class SparseEmbeddingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInput = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Input = propInput.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Perform sparse embedding inference on the service +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestConverter))] +public sealed partial class SparseEmbeddingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Id inferenceId, System.Collections.Generic.ICollection input) : base(r => r.Required("inference_id", inferenceId)) + { + Input = input; + } +#if NET7_0_OR_GREATER + public SparseEmbeddingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceSparseEmbedding; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.sparse_embedding"; + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Input { get; set; } + + /// + /// + /// Optional task settings + /// + /// + public object? TaskSettings { get; set; } +} + +/// +/// +/// Perform sparse embedding inference on the service +/// +/// +public readonly partial struct SparseEmbeddingRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest instance) + { + Instance = instance; + } + + public SparseEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SparseEmbeddingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest instance) => new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor Input(System.Collections.Generic.ICollection value) + { + Instance.Input = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor Input(params string[] values) + { + Instance.Input = [.. values]; + return this; + } + + /// + /// + /// Optional task settings + /// + /// + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor TaskSettings(object? value) + { + Instance.TaskSettings = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingResponse.g.cs new file mode 100644 index 00000000000..50a074e961a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/SparseEmbeddingResponse.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class SparseEmbeddingResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSparseEmbedding = System.Text.Json.JsonEncodedText.Encode("sparse_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propSparseEmbedding = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSparseEmbedding.TryReadProperty(ref reader, options, PropSparseEmbedding, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SparseEmbedding = propSparseEmbedding.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSparseEmbedding, value.SparseEmbedding, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponseConverter))] +public sealed partial class SparseEmbeddingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseEmbeddingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SparseEmbeddingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection SparseEmbedding { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs new file mode 100644 index 00000000000..0ff5ddc2950 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionRequest.g.cs @@ -0,0 +1,298 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class StreamCompletionRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class StreamCompletionRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInput = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Input = propInput.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Perform streaming inference. +/// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. +/// This API works only with the completion task type. +/// +/// +/// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. +/// +/// +/// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestConverter))] +public sealed partial class StreamCompletionRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StreamCompletionRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StreamCompletionRequest(Elastic.Clients.Elasticsearch.Id inferenceId, System.Collections.Generic.ICollection input) : base(r => r.Required("inference_id", inferenceId)) + { + Input = input; + } +#if NET7_0_OR_GREATER + public StreamCompletionRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StreamCompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceStreamCompletion; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.stream_completion"; + + /// + /// + /// The unique identifier for the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// NOTE: Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Input { get; set; } + + /// + /// + /// Optional task settings + /// + /// + public object? TaskSettings { get; set; } +} + +/// +/// +/// Perform streaming inference. +/// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. +/// This API works only with the completion task type. +/// +/// +/// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. +/// +/// +/// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. +/// +/// +public readonly partial struct StreamCompletionRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StreamCompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest instance) + { + Instance = instance; + } + + public StreamCompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StreamCompletionRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest instance) => new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier for the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// NOTE: Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor Input(System.Collections.Generic.ICollection value) + { + Instance.Input = value; + return this; + } + + /// + /// + /// The text on which you want to perform the inference task. + /// It can be a single string or an array. + /// + /// + /// NOTE: Inference endpoints for the completion task type currently only support a single string as input. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor Input(params string[] values) + { + Instance.Input = [.. values]; + return this; + } + + /// + /// + /// Optional task settings + /// + /// + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor TaskSettings(object? value) + { + Instance.TaskSettings = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionResponse.g.cs new file mode 100644 index 00000000000..ba09dd6ed55 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamCompletionResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class StreamCompletionResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StreamCompletionResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StreamCompletionResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceRequest.g.cs deleted file mode 100644 index 13e9654e82f..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceRequest.g.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Inference; - -public sealed partial class StreamInferenceRequestParameters : RequestParameters -{ -} - -/// -/// -/// Perform streaming inference. -/// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. -/// This API works only with the completion task type. -/// -/// -/// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. -/// -/// -/// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. -/// -/// -public sealed partial class StreamInferenceRequest : PlainRequest -{ - public StreamInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) - { - } - - public StreamInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceStreamInference; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.stream_inference"; - - /// - /// - /// The text on which you want to perform the inference task. - /// It can be a single string or an array. - /// - /// - /// NOTE: Inference endpoints for the completion task type currently only support a single string as input. - /// - /// - [JsonInclude, JsonPropertyName("input")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection Input { get; set; } -} - -/// -/// -/// Perform streaming inference. -/// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. -/// This API works only with the completion task type. -/// -/// -/// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. -/// -/// -/// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. -/// -/// -public sealed partial class StreamInferenceRequestDescriptor : RequestDescriptor -{ - internal StreamInferenceRequestDescriptor(Action configure) => configure.Invoke(this); - - public StreamInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) - { - } - - public StreamInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceStreamInference; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.stream_inference"; - - public StreamInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) - { - RouteValues.Required("inference_id", inferenceId); - return Self; - } - - public StreamInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) - { - RouteValues.Optional("task_type", taskType); - return Self; - } - - private ICollection InputValue { get; set; } - - /// - /// - /// The text on which you want to perform the inference task. - /// It can be a single string or an array. - /// - /// - /// NOTE: Inference endpoints for the completion task type currently only support a single string as input. - /// - /// - public StreamInferenceRequestDescriptor Input(ICollection input) - { - InputValue = input; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - writer.WritePropertyName("input"); - SingleOrManySerializationHelper.Serialize(InputValue, writer, options); - writer.WriteEndObject(); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs new file mode 100644 index 00000000000..d2dd66fa066 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingRequest.g.cs @@ -0,0 +1,297 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class TextEmbeddingRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class TextEmbeddingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInput = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Input = propInput.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Perform text embedding inference on the service +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestConverter))] +public sealed partial class TextEmbeddingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Id inferenceId, System.Collections.Generic.ICollection input) : base(r => r.Required("inference_id", inferenceId)) + { + Input = input; + } +#if NET7_0_OR_GREATER + public TextEmbeddingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceTextEmbedding; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.text_embedding"; + + /// + /// + /// The inference Id + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Input { get; set; } + + /// + /// + /// Optional task settings + /// + /// + public object? TaskSettings { get; set; } +} + +/// +/// +/// Perform text embedding inference on the service +/// +/// +public readonly partial struct TextEmbeddingRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest instance) + { + Instance = instance; + } + + public TextEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest(inferenceId); +#pragma warning restore CS0618 + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public TextEmbeddingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest instance) => new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference Id + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// Specifies the amount of time to wait for the inference request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor Input(System.Collections.Generic.ICollection value) + { + Instance.Input = value; + return this; + } + + /// + /// + /// Inference input. + /// Either a string or an array of strings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor Input(params string[] values) + { + Instance.Input = [.. values]; + return this; + } + + /// + /// + /// Optional task settings + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor TaskSettings(object? value) + { + Instance.TaskSettings = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingResponse.g.cs new file mode 100644 index 00000000000..a659ad8e878 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/TextEmbeddingResponse.g.cs @@ -0,0 +1,58 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class TextEmbeddingResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { InferenceResult = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.InferenceResult, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponseConverter))] +public sealed partial class TextEmbeddingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult InferenceResult { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceRequest.g.cs index b3b1146f41e..9a7385d69f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceRequest.g.cs @@ -17,23 +17,29 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class UpdateInferenceRequestParameters : RequestParameters +public sealed partial class UpdateInferenceRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class UpdateInferenceRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { InferenceConfig = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.InferenceConfig, null); + } +} + /// /// /// Update an inference endpoint. @@ -47,31 +53,73 @@ public sealed partial class UpdateInferenceRequestParameters : RequestParameters /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. /// /// -public sealed partial class UpdateInferenceRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestConverter))] +public sealed partial class UpdateInferenceRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) { } + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceUpdate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId, Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) : base(r => r.Required("inference_id", inferenceId)) + { + InferenceConfig = inferenceConfig; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + { + InferenceConfig = inferenceConfig; + } +#if NET7_0_OR_GREATER + public UpdateInferenceRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.InferenceUpdate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "inference.update"; - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfig { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, InferenceConfig, options); - } + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id InferenceId { get => P("inference_id"); set => PR("inference_id", value); } + + /// + /// + /// The type of inference task that the model performs. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.TaskType? TaskType { get => P("task_type"); set => PO("task_type", value); } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfig { get; set; } } /// @@ -87,62 +135,120 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. /// /// -public sealed partial class UpdateInferenceRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateInferenceRequestDescriptor { - internal UpdateInferenceRequestDescriptor(Action configure) => configure.Invoke(this); - public UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; - public UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; + internal Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceUpdate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest(inferenceId); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + public UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest(taskType, inferenceId); +#pragma warning restore CS0618 + } - internal override string OperationName => "inference.update"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateInferenceRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public UpdateInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) + public static explicit operator Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest instance) => new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The unique identifier of the inference endpoint. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.InferenceId = value; + return this; + } + + /// + /// + /// The type of inference task that the model performs. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? value) { - RouteValues.Required("inference_id", inferenceId); - return Self; + Instance.TaskType = value; + return this; } - public UpdateInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint value) { - RouteValues.Optional("task_type", taskType); - return Self; + Instance.InferenceConfig = value; + return this; } - private Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor InferenceConfig(System.Action action) + { + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public UpdateInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor Pretty(bool? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.Pretty = value; + return this; } - public UpdateInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor SourceQueryString(string? value) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public UpdateInferenceRequestDescriptor InferenceConfig(Action configure) + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, InferenceConfigValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceResponse.g.cs index 219b81f402e..35bbf65c449 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/UpdateInferenceResponse.g.cs @@ -17,62 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class UpdateInferenceResponse : ElasticsearchResponse +internal sealed partial class UpdateInferenceResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponseConverter))] +public sealed partial class UpdateInferenceResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateInferenceResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateInferenceResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Chunking configuration object /// /// - [JsonInclude, JsonPropertyName("chunking_settings")] - public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; init; } + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } /// /// /// The inference Id /// /// - [JsonInclude, JsonPropertyName("inference_id")] - public string InferenceId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } /// /// /// The service type /// /// - [JsonInclude, JsonPropertyName("service")] - public string Service { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } /// /// /// Settings specific to the service /// /// - [JsonInclude, JsonPropertyName("service_settings")] - public object ServiceSettings { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } /// /// /// Task settings specific to the service and task type /// /// - [JsonInclude, JsonPropertyName("task_settings")] - public object? TaskSettings { get; init; } + public object? TaskSettings { get; set; } /// /// /// The task type /// /// - [JsonInclude, JsonPropertyName("task_type")] - public Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoRequest.g.cs index 792542afd63..1a8095232ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class InfoRequestParameters : RequestParameters +public sealed partial class InfoRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class InfoRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.InfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.InfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.InfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,11 +62,28 @@ public sealed partial class InfoRequestParameters : RequestParameters /// Get basic build, version, and cluster information. /// /// -public sealed partial class InfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.InfoRequestConverter))] +public sealed partial class InfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceInfo; +#if NET7_0_OR_GREATER + public InfoRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public InfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -57,23 +96,76 @@ public sealed partial class InfoRequest : PlainRequest /// Get basic build, version, and cluster information. /// /// -public sealed partial class InfoRequestDescriptor : RequestDescriptor +public readonly partial struct InfoRequestDescriptor { - internal InfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.InfoRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InfoRequestDescriptor(Elastic.Clients.Elasticsearch.InfoRequest instance) + { + Instance = instance; + } public InfoRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.InfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceInfo; + public static explicit operator Elastic.Clients.Elasticsearch.InfoRequestDescriptor(Elastic.Clients.Elasticsearch.InfoRequest instance) => new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.InfoRequest(Elastic.Clients.Elasticsearch.InfoRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.InfoRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.InfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(new Elastic.Clients.Elasticsearch.InfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "info"; + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.InfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoResponse.g.cs index 48d217b3951..4489d9a351c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/InfoResponse.g.cs @@ -17,42 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class InfoResponse : ElasticsearchResponse +internal sealed partial class InfoResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropClusterUuid = System.Text.Json.JsonEncodedText.Encode("cluster_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTagline = System.Text.Json.JsonEncodedText.Encode("tagline"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.InfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue propClusterUuid = default; + LocalJsonValue propName = default; + LocalJsonValue propTagline = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propClusterUuid.TryReadProperty(ref reader, options, PropClusterUuid, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTagline.TryReadProperty(ref reader, options, PropTagline, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.InfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + ClusterUuid = propClusterUuid.Value, + Name = propName.Value, + Tagline = propTagline.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.InfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropClusterUuid, value.ClusterUuid, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTagline, value.Tagline, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.InfoResponseConverter))] +public sealed partial class InfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The responding cluster's name. /// /// - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("cluster_uuid")] - public string ClusterUuid { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterUuid { get; set; } /// /// /// The responding node's name. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("tagline")] - public string Tagline { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Tagline { get; set; } /// /// /// The running version of Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("version")] - public Elastic.Clients.Elasticsearch.ElasticsearchVersionInfo Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ElasticsearchVersionInfo Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseRequest.g.cs index 26a49ab502d..48a35d59f0e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseRequest.g.cs @@ -17,24 +17,17 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeleteGeoipDatabaseRequestParameters : RequestParameters +public sealed partial class DeleteGeoipDatabaseRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Period to wait for a connection to the master node. + /// The period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// @@ -42,27 +35,70 @@ public sealed partial class DeleteGeoipDatabaseRequestParameters : RequestParame /// /// - /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteGeoipDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete GeoIP database configurations. +/// +/// /// Delete one or more IP geolocation database configurations. /// /// -public sealed partial class DeleteGeoipDatabaseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestConverter))] +public sealed partial class DeleteGeoipDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteGeoipDatabaseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteGeoipDatabase; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestDeleteGeoipDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; @@ -70,90 +106,144 @@ public DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : base(r /// /// - /// Period to wait for a connection to the master node. + /// A comma-separated list of geoip database configurations to delete + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Delete GeoIP database configurations. +/// +/// /// Delete one or more IP geolocation database configurations. /// /// -public sealed partial class DeleteGeoipDatabaseRequestDescriptor : RequestDescriptor, DeleteGeoipDatabaseRequestParameters> +public readonly partial struct DeleteGeoipDatabaseRequestDescriptor { - internal DeleteGeoipDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest Instance { get; init; } - public DeleteGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteGeoipDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; + public DeleteGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest(id); + } - internal override string OperationName => "ingest.delete_geoip_database"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteGeoipDatabaseRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeleteGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public DeleteGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids id) + /// + /// + /// A comma-separated list of geoip database configurations to delete + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Delete GeoIP database configurations. -/// Delete one or more IP geolocation database configurations. -/// -/// -public sealed partial class DeleteGeoipDatabaseRequestDescriptor : RequestDescriptor -{ - internal DeleteGeoipDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeleteGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteGeoipDatabase; + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.delete_geoip_database"; + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids id) + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseResponse.g.cs index dce6d2f572a..66d562febe0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteGeoipDatabaseResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeleteGeoipDatabaseResponse : ElasticsearchResponse +internal sealed partial class DeleteGeoipDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponseConverter))] +public sealed partial class DeleteGeoipDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteGeoipDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseRequest.g.cs index c59c95fc2ab..1d6715f1df5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeleteIpLocationDatabaseRequestParameters : RequestParameters +public sealed partial class DeleteIpLocationDatabaseRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,25 +44,77 @@ public sealed partial class DeleteIpLocationDatabaseRequestParameters : RequestP public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteIpLocationDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete IP geolocation database configurations. /// /// -public sealed partial class DeleteIpLocationDatabaseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestConverter))] +public sealed partial class DeleteIpLocationDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteIpLocationDatabaseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteIpLocationDatabase; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestDeleteIpLocationDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ingest.delete_ip_location_database"; + /// + /// + /// A comma-separated list of IP location database configurations. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Id { get => P("id"); set => PR("id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -77,7 +122,6 @@ public DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : b /// A value of -1 indicates that the request should never time out. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -87,7 +131,6 @@ public DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : b /// A value of -1 indicates that the request should never time out. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -96,67 +139,114 @@ public DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids id) : b /// Delete IP geolocation database configurations. /// /// -public sealed partial class DeleteIpLocationDatabaseRequestDescriptor : RequestDescriptor, DeleteIpLocationDatabaseRequestParameters> +public readonly partial struct DeleteIpLocationDatabaseRequestDescriptor { - internal DeleteIpLocationDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest Instance { get; init; } - public DeleteIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteIpLocationDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; + public DeleteIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest(id); + } - internal override string OperationName => "ingest.delete_ip_location_database"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteIpLocationDatabaseRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeleteIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public DeleteIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids id) + /// + /// + /// A comma-separated list of IP location database configurations. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// A value of -1 indicates that the request should never time out. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Delete IP geolocation database configurations. -/// -/// -public sealed partial class DeleteIpLocationDatabaseRequestDescriptor : RequestDescriptor -{ - internal DeleteIpLocationDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// A value of -1 indicates that the request should never time out. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeleteIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeleteIpLocationDatabase; + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.delete_ip_location_database"; + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids id) + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseResponse.g.cs index d221599c779..3f782febdb2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeleteIpLocationDatabaseResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeleteIpLocationDatabaseResponse : ElasticsearchResponse +internal sealed partial class DeleteIpLocationDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponseConverter))] +public sealed partial class DeleteIpLocationDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteIpLocationDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineRequest.g.cs index bae10014caa..195b508f0b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeletePipelineRequestParameters : RequestParameters +public sealed partial class DeletePipelineRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,33 +42,85 @@ public sealed partial class DeletePipelineRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeletePipelineRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete pipelines. /// Delete one or more ingest pipelines. /// /// -public sealed partial class DeletePipelineRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestConverter))] +public sealed partial class DeletePipelineRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeletePipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeletePipelineRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeletePipeline; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestDeletePipeline; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ingest.delete_pipeline"; + /// + /// + /// Pipeline ID or wildcard expression of pipeline IDs used to limit the request. + /// To delete all ingest pipelines in a cluster, use a value of *. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -84,7 +129,6 @@ public DeletePipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -94,68 +138,113 @@ public DeletePipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// Delete one or more ingest pipelines. /// /// -public sealed partial class DeletePipelineRequestDescriptor : RequestDescriptor, DeletePipelineRequestParameters> +public readonly partial struct DeletePipelineRequestDescriptor { - internal DeletePipelineRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest Instance { get; init; } - public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeletePipeline; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; + public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest(id); + } - internal override string OperationName => "ingest.delete_pipeline"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeletePipelineRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeletePipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeletePipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor descriptor) => descriptor.Instance; - public DeletePipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Pipeline ID or wildcard expression of pipeline IDs used to limit the request. + /// To delete all ingest pipelines in a cluster, use a value of *. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Delete pipelines. -/// Delete one or more ingest pipelines. -/// -/// -public sealed partial class DeletePipelineRequestDescriptor : RequestDescriptor -{ - internal DeletePipelineRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestDeletePipeline; + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.delete_pipeline"; + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeletePipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeletePipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeletePipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineResponse.g.cs index a56624fd181..0841523b0d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/DeletePipelineResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class DeletePipelineResponse : ElasticsearchResponse +internal sealed partial class DeletePipelineResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponseConverter))] +public sealed partial class DeletePipelineResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePipelineResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsRequest.g.cs index 7ca7d51ee62..dd0c52d2db0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GeoIpStatsRequestParameters : RequestParameters +public sealed partial class GeoIpStatsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GeoIpStatsRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,11 +62,28 @@ public sealed partial class GeoIpStatsRequestParameters : RequestParameters /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. /// /// -public sealed partial class GeoIpStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestConverter))] +public sealed partial class GeoIpStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGeoIpStats; +#if NET7_0_OR_GREATER + public GeoIpStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoIpStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestGeoIpStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -57,23 +96,76 @@ public sealed partial class GeoIpStatsRequest : PlainRequest /// -public sealed partial class GeoIpStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GeoIpStatsRequestDescriptor { - internal GeoIpStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest instance) + { + Instance = instance; + } public GeoIpStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGeoIpStats; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "ingest.geo_ip_stats"; + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsResponse.g.cs index dc229b51599..061d42be019 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GeoIpStatsResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GeoIpStatsResponse : ElasticsearchResponse +internal sealed partial class GeoIpStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + LocalJsonValue propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value, + Stats = propStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponseConverter))] +public sealed partial class GeoIpStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Downloaded GeoIP2 databases for each node. /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Download statistics for all GeoIP2 databases. /// /// - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics Stats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseRequest.g.cs index b118dfd90f7..12267b905d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseRequest.g.cs @@ -17,49 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetGeoipDatabaseRequestParameters : RequestParameters +public sealed partial class GetGeoipDatabaseRequestParameters : Elastic.Transport.RequestParameters { - /// - /// - /// Period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } +} + +internal sealed partial class GetGeoipDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Get GeoIP database configurations. +/// +/// /// Get information about one or more IP geolocation database configurations. /// /// -public sealed partial class GetGeoipDatabaseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestConverter))] +public sealed partial class GetGeoipDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetGeoipDatabaseRequest() { } - - public GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetGeoipDatabaseRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetGeoipDatabase; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestGetGeoipDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -67,88 +96,110 @@ public GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : base(r = /// /// - /// Period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. + /// A comma-separated list of database configuration IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all database configurations, omit this parameter or use *. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + public Elastic.Clients.Elasticsearch.Ids? Id { get => P("id"); set => PO("id", value); } } /// /// /// Get GeoIP database configurations. +/// +/// /// Get information about one or more IP geolocation database configurations. /// /// -public sealed partial class GetGeoipDatabaseRequestDescriptor : RequestDescriptor, GetGeoipDatabaseRequestParameters> +public readonly partial struct GetGeoipDatabaseRequestDescriptor { - internal GetGeoipDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest Instance { get; init; } - public GetGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest instance) { + Instance = instance; } - public GetGeoipDatabaseRequestDescriptor() + public GetGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetGeoipDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; - - internal override string OperationName => "ingest.get_geoip_database"; + public GetGeoipDatabaseRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GetGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public GetGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? id) + /// + /// + /// A comma-separated list of database configuration IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all database configurations, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Get GeoIP database configurations. -/// Get information about one or more IP geolocation database configurations. -/// -/// -public sealed partial class GetGeoipDatabaseRequestDescriptor : RequestDescriptor -{ - internal GetGeoipDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); - - public GetGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - public GetGeoipDatabaseRequestDescriptor() + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetGeoipDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.get_geoip_database"; + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? id) + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseResponse.g.cs index e0310e524bc..4a1186f2506 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetGeoipDatabaseResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetGeoipDatabaseResponse : ElasticsearchResponse +internal sealed partial class GetGeoipDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("databases")] - public IReadOnlyCollection Databases { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDatabases = System.Text.Json.JsonEncodedText.Encode("databases"); + + public override Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDatabases = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabases.TryReadProperty(ref reader, options, PropDatabases, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Databases = propDatabases.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabases, value.Databases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponseConverter))] +public sealed partial class GetGeoipDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetGeoipDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Databases { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseRequest.g.cs index ebded8be3a5..f31179e8e13 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetIpLocationDatabaseRequestParameters : RequestParameters +public sealed partial class GetIpLocationDatabaseRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,29 +35,79 @@ public sealed partial class GetIpLocationDatabaseRequestParameters : RequestPara public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetIpLocationDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get IP geolocation database configurations. /// /// -public sealed partial class GetIpLocationDatabaseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestConverter))] +public sealed partial class GetIpLocationDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetIpLocationDatabaseRequest() { } - - public GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetIpLocationDatabaseRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetIpLocationDatabase; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestGetIpLocationDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ingest.get_ip_location_database"; + /// + /// + /// Comma-separated list of database configuration IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all database configurations, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? Id { get => P("id"); set => PO("id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -72,7 +115,6 @@ public GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : bas /// A value of -1 indicates that the request should never time out. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -81,73 +123,107 @@ public GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ids? id) : bas /// Get IP geolocation database configurations. /// /// -public sealed partial class GetIpLocationDatabaseRequestDescriptor : RequestDescriptor, GetIpLocationDatabaseRequestParameters> +public readonly partial struct GetIpLocationDatabaseRequestDescriptor { - internal GetIpLocationDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest Instance { get; init; } - public GetIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest instance) { + Instance = instance; } - public GetIpLocationDatabaseRequestDescriptor() + public GetIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetIpLocationDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; - - internal override string OperationName => "ingest.get_ip_location_database"; + public GetIpLocationDatabaseRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GetIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public GetIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? id) + /// + /// + /// Comma-separated list of database configuration IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all database configurations, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// A value of -1 indicates that the request should never time out. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} -/// -/// -/// Get IP geolocation database configurations. -/// -/// -public sealed partial class GetIpLocationDatabaseRequestDescriptor : RequestDescriptor -{ - internal GetIpLocationDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); - - public GetIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? id) : base(r => r.Optional("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public GetIpLocationDatabaseRequestDescriptor() + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetIpLocationDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.get_ip_location_database"; + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Ids? id) + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseResponse.g.cs index 4e185a14181..5f7d00560f6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetIpLocationDatabaseResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetIpLocationDatabaseResponse : ElasticsearchResponse +internal sealed partial class GetIpLocationDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("databases")] - public IReadOnlyCollection Databases { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDatabases = System.Text.Json.JsonEncodedText.Encode("databases"); + + public override Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDatabases = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabases.TryReadProperty(ref reader, options, PropDatabases, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Databases = propDatabases.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabases, value.Databases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponseConverter))] +public sealed partial class GetIpLocationDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetIpLocationDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Databases { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineRequest.g.cs index 39ca9bc7147..f9bb11f8b94 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetPipelineRequestParameters : RequestParameters +public sealed partial class GetPipelineRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,38 +41,89 @@ public sealed partial class GetPipelineRequestParameters : RequestParameters public bool? Summary { get => Q("summary"); set => Q("summary", value); } } +internal sealed partial class GetPipelineRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get pipelines. +/// +/// /// Get information about one or more ingest pipelines. /// This API returns a local reference of the pipeline. /// /// -public sealed partial class GetPipelineRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestConverter))] +public sealed partial class GetPipelineRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetPipelineRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetPipelineRequest() { } - - public GetPipelineRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetPipelineRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetPipeline; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestGetPipeline; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ingest.get_pipeline"; + /// + /// + /// Comma-separated list of pipeline IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all ingest pipelines, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -87,88 +131,129 @@ public GetPipelineRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Op /// Return pipelines without their definitions (default: false) /// /// - [JsonIgnore] public bool? Summary { get => Q("summary"); set => Q("summary", value); } } /// /// /// Get pipelines. +/// +/// /// Get information about one or more ingest pipelines. /// This API returns a local reference of the pipeline. /// /// -public sealed partial class GetPipelineRequestDescriptor : RequestDescriptor, GetPipelineRequestParameters> +public readonly partial struct GetPipelineRequestDescriptor { - internal GetPipelineRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest Instance { get; init; } - public GetPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest instance) { + Instance = instance; } - public GetPipelineRequestDescriptor() + public GetPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetPipeline; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; - - internal override string OperationName => "ingest.get_pipeline"; + public GetPipelineRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GetPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetPipelineRequestDescriptor Summary(bool? summary = true) => Qs("summary", summary); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor descriptor) => descriptor.Instance; - public GetPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Comma-separated list of pipeline IDs to retrieve. + /// Wildcard (*) expressions are supported. + /// To get all ingest pipelines, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.MasterTimeout = value; + return this; } -} - -/// -/// -/// Get pipelines. -/// Get information about one or more ingest pipelines. -/// This API returns a local reference of the pipeline. -/// -/// -public sealed partial class GetPipelineRequestDescriptor : RequestDescriptor -{ - internal GetPipelineRequestDescriptor(Action configure) => configure.Invoke(this); - public GetPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + /// + /// + /// Return pipelines without their definitions (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor Summary(bool? value = true) { + Instance.Summary = value; + return this; } - public GetPipelineRequestDescriptor() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestGetPipeline; + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ingest.get_pipeline"; + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetPipelineRequestDescriptor Summary(bool? summary = true) => Qs("summary", summary); + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineResponse.g.cs index 9da46ea68de..7e194ae0645 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/GetPipelineResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class GetPipelineResponse : DictionaryResponse +internal sealed partial class GetPipelineResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetPipelineResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Pipelines = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetPipelineResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Pipelines, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponseConverter))] +public sealed partial class GetPipelineResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPipelineResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Pipelines { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokRequest.g.cs index 32a9e9194d4..ac196922f48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class ProcessorGrokRequestParameters : RequestParameters +public sealed partial class ProcessorGrokRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ProcessorGrokRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -42,11 +64,28 @@ public sealed partial class ProcessorGrokRequestParameters : RequestParameters /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. /// /// -public sealed partial class ProcessorGrokRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestConverter))] +public sealed partial class ProcessorGrokRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestProcessorGrok; +#if NET7_0_OR_GREATER + public ProcessorGrokRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ProcessorGrokRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestProcessorGrok; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -61,23 +100,76 @@ public sealed partial class ProcessorGrokRequest : PlainRequest /// -public sealed partial class ProcessorGrokRequestDescriptor : RequestDescriptor +public readonly partial struct ProcessorGrokRequestDescriptor { - internal ProcessorGrokRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorGrokRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest instance) + { + Instance = instance; + } public ProcessorGrokRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestProcessorGrok; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "ingest.processor_grok"; + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokResponse.g.cs index 823c43ea0e4..a57811929bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/ProcessorGrokResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class ProcessorGrokResponse : ElasticsearchResponse +internal sealed partial class ProcessorGrokResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("patterns")] - public IReadOnlyDictionary Patterns { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropPatterns = System.Text.Json.JsonEncodedText.Encode("patterns"); + + public override Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPatterns = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPatterns.TryReadProperty(ref reader, options, PropPatterns, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Patterns = propPatterns.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPatterns, value.Patterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponseConverter))] +public sealed partial class ProcessorGrokResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorGrokResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ProcessorGrokResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Patterns { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseRequest.g.cs index 8d0e30805a5..19d0424aa7b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutGeoipDatabaseRequestParameters : RequestParameters +public sealed partial class PutGeoipDatabaseRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,33 +41,113 @@ public sealed partial class PutGeoipDatabaseRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutGeoipDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxmind = System.Text.Json.JsonEncodedText.Encode("maxmind"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxmind = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxmind.TryReadProperty(ref reader, options, PropMaxmind, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Maxmind = propMaxmind.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxmind, value.Maxmind, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a GeoIP database configuration. +/// +/// /// Refer to the create or update IP geolocation database configuration API. /// /// -public sealed partial class PutGeoipDatabaseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestConverter))] +public sealed partial class PutGeoipDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutGeoipDatabase; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("id", id)) + { + Maxmind = maxmind; + Name = name; + } +#if NET7_0_OR_GREATER + public PutGeoipDatabaseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestPutGeoipDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ingest.put_geoip_database"; + /// + /// + /// ID of the database configuration to create or update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -82,7 +155,6 @@ public PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -91,82 +163,114 @@ public PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => /// At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. /// /// - [JsonInclude, JsonPropertyName("maxmind")] - public Elastic.Clients.Elasticsearch.Ingest.Maxmind Maxmind { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.Maxmind Maxmind { get; set; } /// /// /// The provider-assigned name of the IP geolocation database to download. /// /// - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } } /// /// /// Create or update a GeoIP database configuration. +/// +/// /// Refer to the create or update IP geolocation database configuration API. /// /// -public sealed partial class PutGeoipDatabaseRequestDescriptor : RequestDescriptor, PutGeoipDatabaseRequestParameters> +public readonly partial struct PutGeoipDatabaseRequestDescriptor { - internal PutGeoipDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest Instance { get; init; } - public PutGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutGeoipDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public PutGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest(id); +#pragma warning restore CS0618 + } - internal override string OperationName => "ingest.put_geoip_database"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutGeoipDatabaseRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public PutGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public PutGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// ID of the database configuration to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.Ingest.Maxmind MaxmindValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor MaxmindDescriptor { get; set; } - private Action MaxmindDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } /// /// - /// The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. - /// At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - public PutGeoipDatabaseRequestDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - MaxmindDescriptor = null; - MaxmindDescriptorAction = null; - MaxmindValue = maxmind; - return Self; + Instance.Timeout = value; + return this; } - public PutGeoipDatabaseRequestDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor descriptor) + /// + /// + /// The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. + /// At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind value) { - MaxmindValue = null; - MaxmindDescriptorAction = null; - MaxmindDescriptor = descriptor; - return Self; + Instance.Maxmind = value; + return this; } - public PutGeoipDatabaseRequestDescriptor Maxmind(Action configure) + /// + /// + /// The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. + /// At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Maxmind(System.Action action) { - MaxmindValue = null; - MaxmindDescriptor = null; - MaxmindDescriptorAction = configure; - return Self; + Instance.Maxmind = Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor.Build(action); + return this; } /// @@ -174,135 +278,59 @@ public PutGeoipDatabaseRequestDescriptor Maxmind(Action /// - public PutGeoipDatabaseRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest Build(System.Action action) { - writer.WriteStartObject(); - if (MaxmindDescriptor is not null) - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, MaxmindDescriptor, options); - } - else if (MaxmindDescriptorAction is not null) - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor(MaxmindDescriptorAction), options); - } - else - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, MaxmindValue, options); - } - - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Create or update a GeoIP database configuration. -/// Refer to the create or update IP geolocation database configuration API. -/// -/// -public sealed partial class PutGeoipDatabaseRequestDescriptor : RequestDescriptor -{ - internal PutGeoipDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); - public PutGeoipDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutGeoipDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ingest.put_geoip_database"; - - public PutGeoipDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutGeoipDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public PutGeoipDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Required("id", id); - return Self; + Instance.FilterPath = value; + return this; } - private Elastic.Clients.Elasticsearch.Ingest.Maxmind MaxmindValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor MaxmindDescriptor { get; set; } - private Action MaxmindDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - - /// - /// - /// The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. - /// At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. - /// - /// - public PutGeoipDatabaseRequestDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Human(bool? value) { - MaxmindDescriptor = null; - MaxmindDescriptorAction = null; - MaxmindValue = maxmind; - return Self; + Instance.Human = value; + return this; } - public PutGeoipDatabaseRequestDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor Pretty(bool? value) { - MaxmindValue = null; - MaxmindDescriptorAction = null; - MaxmindDescriptor = descriptor; - return Self; + Instance.Pretty = value; + return this; } - public PutGeoipDatabaseRequestDescriptor Maxmind(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor SourceQueryString(string? value) { - MaxmindValue = null; - MaxmindDescriptor = null; - MaxmindDescriptorAction = configure; - return Self; + Instance.SourceQueryString = value; + return this; } - /// - /// - /// The provider-assigned name of the IP geolocation database to download. - /// - /// - public PutGeoipDatabaseRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - NameValue = name; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - writer.WriteStartObject(); - if (MaxmindDescriptor is not null) - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, MaxmindDescriptor, options); - } - else if (MaxmindDescriptorAction is not null) - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor(MaxmindDescriptorAction), options); - } - else - { - writer.WritePropertyName("maxmind"); - JsonSerializer.Serialize(writer, MaxmindValue, options); - } - - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - writer.WriteEndObject(); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseResponse.g.cs index 9fa354707d9..839310896bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutGeoipDatabaseResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutGeoipDatabaseResponse : ElasticsearchResponse +internal sealed partial class PutGeoipDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponseConverter))] +public sealed partial class PutGeoipDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutGeoipDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutGeoipDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseRequest.g.cs index 49a39028b0f..af03733e82f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutIpLocationDatabaseRequestParameters : RequestParameters +public sealed partial class PutIpLocationDatabaseRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,25 +44,68 @@ public sealed partial class PutIpLocationDatabaseRequestParameters : RequestPara public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutIpLocationDatabaseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Configuration = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Configuration, null); + } +} + /// /// /// Create or update an IP geolocation database configuration. /// /// -public sealed partial class PutIpLocationDatabaseRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestConverter))] +public sealed partial class PutIpLocationDatabaseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutIpLocationDatabase; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration) : base(r => r.Required("id", id)) + { + Configuration = configuration; + } +#if NET7_0_OR_GREATER + public PutIpLocationDatabaseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestPutIpLocationDatabase; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ingest.put_ip_location_database"; + /// + /// + /// The database configuration identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -77,7 +113,6 @@ public PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// A value of -1 indicates that the request should never time out. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -87,15 +122,12 @@ public PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// A value of -1 indicates that the request should never time out. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Configuration { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Configuration, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Configuration { get; set; } } /// @@ -103,119 +135,128 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Create or update an IP geolocation database configuration. /// /// -public sealed partial class PutIpLocationDatabaseRequestDescriptor : RequestDescriptor, PutIpLocationDatabaseRequestParameters> +public readonly partial struct PutIpLocationDatabaseRequestDescriptor { - internal PutIpLocationDatabaseRequestDescriptor(Action> configure) => configure.Invoke(this); - public PutIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) => ConfigurationValue = configuration; - - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutIpLocationDatabase; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest Instance { get; init; } - internal override bool SupportsBody => true; - - internal override string OperationName => "ingest.put_ip_location_database"; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest instance) + { + Instance = instance; + } - public PutIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public PutIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest(id); +#pragma warning restore CS0618 + } - public PutIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutIpLocationDatabaseRequestDescriptor() { - RouteValues.Required("id", id); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration ConfigurationValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor ConfigurationDescriptor { get; set; } - private Action ConfigurationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor descriptor) => descriptor.Instance; - public PutIpLocationDatabaseRequestDescriptor Configuration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration) + /// + /// + /// The database configuration identifier. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - ConfigurationDescriptor = null; - ConfigurationDescriptorAction = null; - ConfigurationValue = configuration; - return Self; + Instance.Id = value; + return this; } - public PutIpLocationDatabaseRequestDescriptor Configuration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor descriptor) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// A value of -1 indicates that the request should never time out. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - ConfigurationValue = null; - ConfigurationDescriptorAction = null; - ConfigurationDescriptor = descriptor; - return Self; + Instance.MasterTimeout = value; + return this; } - public PutIpLocationDatabaseRequestDescriptor Configuration(Action configure) + /// + /// + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response indicates that it was not completely acknowledged. + /// A value of -1 indicates that the request should never time out. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - ConfigurationValue = null; - ConfigurationDescriptor = null; - ConfigurationDescriptorAction = configure; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Configuration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration value) { - JsonSerializer.Serialize(writer, ConfigurationValue, options); + Instance.Configuration = value; + return this; } -} - -/// -/// -/// Create or update an IP geolocation database configuration. -/// -/// -public sealed partial class PutIpLocationDatabaseRequestDescriptor : RequestDescriptor -{ - internal PutIpLocationDatabaseRequestDescriptor(Action configure) => configure.Invoke(this); - public PutIpLocationDatabaseRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) => ConfigurationValue = configuration; - - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutIpLocationDatabase; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Configuration(System.Action action) + { + Instance.Configuration = Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor.Build(action); + return this; + } - internal override string OperationName => "ingest.put_ip_location_database"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public PutIpLocationDatabaseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutIpLocationDatabaseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public PutIpLocationDatabaseRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Required("id", id); - return Self; + Instance.FilterPath = value; + return this; } - private Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration ConfigurationValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor ConfigurationDescriptor { get; set; } - private Action ConfigurationDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public PutIpLocationDatabaseRequestDescriptor Configuration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor Pretty(bool? value) { - ConfigurationDescriptor = null; - ConfigurationDescriptorAction = null; - ConfigurationValue = configuration; - return Self; + Instance.Pretty = value; + return this; } - public PutIpLocationDatabaseRequestDescriptor Configuration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor SourceQueryString(string? value) { - ConfigurationValue = null; - ConfigurationDescriptorAction = null; - ConfigurationDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public PutIpLocationDatabaseRequestDescriptor Configuration(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - ConfigurationValue = null; - ConfigurationDescriptor = null; - ConfigurationDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, ConfigurationValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseResponse.g.cs index 3d865e894d1..28307fa48eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutIpLocationDatabaseResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutIpLocationDatabaseResponse : ElasticsearchResponse +internal sealed partial class PutIpLocationDatabaseResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponseConverter))] +public sealed partial class PutIpLocationDatabaseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutIpLocationDatabaseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutIpLocationDatabaseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineRequest.g.cs index 2cf636c625b..c199bde3d89 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutPipelineRequestParameters : RequestParameters +public sealed partial class PutPipelineRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -54,32 +47,138 @@ public sealed partial class PutPipelineRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutPipelineRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeprecated = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProcessors = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deprecated = propDeprecated.Value, + Description = propDescription.Value, + Meta = propMeta.Value, + OnFailure = propOnFailure.Value, + Processors = propProcessors.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a pipeline. /// Changes made using this API take effect immediately. /// /// -public sealed partial class PutPipelineRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestConverter))] +public sealed partial class PutPipelineRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public PutPipelineRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutPipeline; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestPutPipeline; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ingest.put_pipeline"; + /// + /// + /// ID of the ingest pipeline to create or update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Required version for optimistic concurrency control for pipeline updates /// /// - [JsonIgnore] public long? IfVersion { get => Q("if_version"); set => Q("if_version", value); } /// @@ -87,7 +186,6 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -95,7 +193,6 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -104,7 +201,6 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -112,7 +208,6 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// Description of the ingest pipeline. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -120,31 +215,27 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. /// /// - [JsonInclude, JsonPropertyName("processors")] - public ICollection? Processors { get; set; } + public System.Collections.Generic.ICollection? Processors { get; set; } /// /// /// Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } @@ -154,44 +245,73 @@ public PutPipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// Changes made using this API take effect immediately. /// /// -public sealed partial class PutPipelineRequestDescriptor : RequestDescriptor, PutPipelineRequestParameters> +public readonly partial struct PutPipelineRequestDescriptor { - internal PutPipelineRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest Instance { get; init; } - public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutPipeline; + public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutPipelineRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ingest.put_pipeline"; + /// + /// + /// ID of the ingest pipeline to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public PutPipelineRequestDescriptor IfVersion(long? ifVersion) => Qs("if_version", ifVersion); - public PutPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutPipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Required version for optimistic concurrency control for pipeline updates + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor IfVersion(long? value) + { + Instance.IfVersion = value; + return this; + } - public PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("id", id); - return Self; + Instance.MasterTimeout = value; + return this; } - private bool? DeprecatedValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? ProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorsDescriptor { get; set; } - private Action> ProcessorsDescriptorAction { get; set; } - private Action>[] ProcessorsDescriptorActions { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// @@ -199,10 +319,10 @@ public PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch. /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - public PutPipelineRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -210,10 +330,10 @@ public PutPipelineRequestDescriptor Deprecated(bool? deprecated = tru /// Description of the ingest pipeline. /// /// - public PutPipelineRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -221,195 +341,212 @@ public PutPipelineRequestDescriptor Description(string? description) /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. /// /// - public PutPipelineRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } /// /// - /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. /// /// - public PutPipelineRequestDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta() { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public PutPipelineRequestDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PutPipelineRequestDescriptor OnFailure(Action> configure) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor AddMeta(string key, object value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PutPipelineRequestDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. /// /// - public PutPipelineRequestDescriptor Processors(ICollection? processors) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsValue = processors; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PutPipelineRequestDescriptor Processors(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(params System.Action[] actions) { - ProcessorsValue = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public PutPipelineRequestDescriptor Processors(Action> configure) + /// + /// + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(params System.Action>[] actions) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public PutPipelineRequestDescriptor Processors(params Action>[] configure) + /// + /// + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(System.Collections.Generic.ICollection? value) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = configure; - return Self; + Instance.Processors = value; + return this; } /// /// - /// Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. /// /// - public PutPipelineRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - VersionValue = version; - return Self; + Instance.Processors = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(params System.Action[] actions) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + Instance.Processors = items; + return this; + } - if (MetaValue is not null) + /// + /// + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.Processors = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (ProcessorsDescriptor is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - foreach (var action in ProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndArray(); - } - else if (ProcessorsValue is not null) - { - writer.WritePropertyName("processors"); - JsonSerializer.Serialize(writer, ProcessorsValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -419,44 +556,73 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Changes made using this API take effect immediately. /// /// -public sealed partial class PutPipelineRequestDescriptor : RequestDescriptor +public readonly partial struct PutPipelineRequestDescriptor { - internal PutPipelineRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest Instance { get; init; } - public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestPutPipeline; + public PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutPipelineRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ingest.put_pipeline"; + /// + /// + /// ID of the ingest pipeline to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public PutPipelineRequestDescriptor IfVersion(long? ifVersion) => Qs("if_version", ifVersion); - public PutPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutPipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Required version for optimistic concurrency control for pipeline updates + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor IfVersion(long? value) + { + Instance.IfVersion = value; + return this; + } - public PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("id", id); - return Self; + Instance.MasterTimeout = value; + return this; } - private bool? DeprecatedValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? ProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorsDescriptor { get; set; } - private Action ProcessorsDescriptorAction { get; set; } - private Action[] ProcessorsDescriptorActions { get; set; } - private long? VersionValue { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// @@ -464,10 +630,10 @@ public PutPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - public PutPipelineRequestDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -475,10 +641,10 @@ public PutPipelineRequestDescriptor Deprecated(bool? deprecated = true) /// Description of the ingest pipeline. /// /// - public PutPipelineRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -486,194 +652,177 @@ public PutPipelineRequestDescriptor Description(string? description) /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. /// /// - public PutPipelineRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } /// /// - /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. /// /// - public PutPipelineRequestDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta() { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public PutPipelineRequestDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Meta(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PutPipelineRequestDescriptor OnFailure(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor AddMeta(string key, object value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PutPipelineRequestDescriptor OnFailure(params Action[] configure) + /// + /// + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. /// /// - public PutPipelineRequestDescriptor Processors(ICollection? processors) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsValue = processors; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PutPipelineRequestDescriptor Processors(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline's remaining processors. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor OnFailure(params System.Action>[] actions) { - ProcessorsValue = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public PutPipelineRequestDescriptor Processors(Action configure) - { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptorAction = configure; - return Self; + Instance.OnFailure = items; + return this; } - public PutPipelineRequestDescriptor Processors(params Action[] configure) + /// + /// + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(System.Collections.Generic.ICollection? value) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = configure; - return Self; + Instance.Processors = value; + return this; } /// /// - /// Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. /// /// - public PutPipelineRequestDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - VersionValue = version; - return Self; + Instance.Processors = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Processors(params System.Action>[] actions) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + Instance.Processors = items; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + /// + /// + /// Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ProcessorsDescriptor is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - foreach (var action in ProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else if (ProcessorsValue is not null) - { - writer.WritePropertyName("processors"); - JsonSerializer.Serialize(writer, ProcessorsValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineResponse.g.cs index e4f7017c4e6..808d00f3c72 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/PutPipelineResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class PutPipelineResponse : ElasticsearchResponse +internal sealed partial class PutPipelineResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponseConverter))] +public sealed partial class PutPipelineResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPipelineResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPipelineResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateRequest.g.cs index 945801158d6..c598a8f68fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class SimulateRequestParameters : RequestParameters +public sealed partial class SimulateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,37 +33,121 @@ public sealed partial class SimulateRequestParameters : RequestParameters public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } +internal sealed partial class SimulateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + + public override Elastic.Clients.Elasticsearch.Ingest.SimulateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDocs = default; + LocalJsonValue propPipeline = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPipeline.TryReadProperty(ref reader, options, PropPipeline, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value, + Pipeline = propPipeline.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SimulateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPipeline, value.Pipeline, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Simulate a pipeline. +/// +/// /// Run an ingest pipeline against a set of provided documents. /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. /// /// -public sealed partial class SimulateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SimulateRequestConverter))] +public sealed partial class SimulateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public SimulateRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) { } - public SimulateRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateRequest(Elastic.Clients.Elasticsearch.Id? id, System.Collections.Generic.ICollection docs) : base(r => r.Optional("id", id)) + { + Docs = docs; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateRequest(System.Collections.Generic.ICollection docs) + { + Docs = docs; + } +#if NET7_0_OR_GREATER + public SimulateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SimulateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestSimulate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.IngestSimulate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ingest.simulate"; + /// + /// + /// The pipeline to test. + /// If you don't specify a pipeline in the request body, this parameter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// If true, the response includes output data for each processor in the executed pipeline. /// /// - [JsonIgnore] public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } /// @@ -78,354 +155,403 @@ public SimulateRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optio /// Sample documents to test in the pipeline. /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection Docs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Docs { get; set; } /// /// - /// Pipeline to test. - /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. /// If you specify both this and the request path parameter, the API only uses the request path parameter. /// /// - [JsonInclude, JsonPropertyName("pipeline")] public Elastic.Clients.Elasticsearch.Ingest.Pipeline? Pipeline { get; set; } } /// /// /// Simulate a pipeline. +/// +/// /// Run an ingest pipeline against a set of provided documents. /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. /// /// -public sealed partial class SimulateRequestDescriptor : RequestDescriptor, SimulateRequestParameters> +public readonly partial struct SimulateRequestDescriptor { - internal SimulateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SimulateRequest Instance { get; init; } - public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest instance) { + Instance = instance; } - public SimulateRequestDescriptor() + public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(id); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestSimulate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public SimulateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ingest.simulate"; + /// + /// + /// The pipeline to test. + /// If you don't specify a pipeline in the request body, this parameter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - public SimulateRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + /// + /// + /// If true, the response includes output data for each processor in the executed pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Verbose(bool? value = true) + { + Instance.Verbose = value; + return this; + } - public SimulateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(System.Collections.Generic.ICollection value) { - RouteValues.Optional("id", id); - return Self; + Instance.Docs = value; + return this; } - private ICollection DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.Pipeline? PipelineValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor PipelineDescriptor { get; set; } - private Action> PipelineDescriptorAction { get; set; } + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Ingest.Document[] values) + { + Instance.Docs = [.. values]; + return this; + } /// /// /// Sample documents to test in the pipeline. /// /// - public SimulateRequestDescriptor Docs(ICollection docs) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(params System.Action[] actions) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - public SimulateRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor descriptor) + /// + /// + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.Pipeline? value) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.Pipeline = value; + return this; } - public SimulateRequestDescriptor Docs(Action configure) + /// + /// + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline() { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null); + return this; } - public SimulateRequestDescriptor Docs(params Action[] configure) + /// + /// + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline(System.Action? action) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action); + return this; } /// /// - /// Pipeline to test. - /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. /// If you specify both this and the request path parameter, the API only uses the request path parameter. /// /// - public SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.Pipeline? pipeline) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline(System.Action>? action) { - PipelineDescriptor = null; - PipelineDescriptorAction = null; - PipelineValue = pipeline; - return Self; + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action); + return this; } - public SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SimulateRequest Build(System.Action action) { - PipelineValue = null; - PipelineDescriptorAction = null; - PipelineDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public SimulateRequestDescriptor Pipeline(Action> configure) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor ErrorTrace(bool? value) { - PipelineValue = null; - PipelineDescriptor = null; - PipelineDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(action), options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PipelineDescriptor is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, PipelineDescriptor, options); - } - else if (PipelineDescriptorAction is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(PipelineDescriptorAction), options); - } - else if (PipelineValue is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, PipelineValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Simulate a pipeline. +/// +/// /// Run an ingest pipeline against a set of provided documents. /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. /// /// -public sealed partial class SimulateRequestDescriptor : RequestDescriptor +public readonly partial struct SimulateRequestDescriptor { - internal SimulateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SimulateRequest Instance { get; init; } - public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest instance) { + Instance = instance; } - public SimulateRequestDescriptor() + public SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(id); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.IngestSimulate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public SimulateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ingest.simulate"; + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest instance) => new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor descriptor) => descriptor.Instance; - public SimulateRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + /// + /// + /// The pipeline to test. + /// If you don't specify a pipeline in the request body, this parameter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - public SimulateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// If true, the response includes output data for each processor in the executed pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Verbose(bool? value = true) { - RouteValues.Optional("id", id); - return Self; + Instance.Verbose = value; + return this; } - private ICollection DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.Pipeline? PipelineValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor PipelineDescriptor { get; set; } - private Action PipelineDescriptorAction { get; set; } + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(System.Collections.Generic.ICollection value) + { + Instance.Docs = value; + return this; + } /// /// /// Sample documents to test in the pipeline. /// /// - public SimulateRequestDescriptor Docs(ICollection docs) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Ingest.Document[] values) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Docs = [.. values]; + return this; } - public SimulateRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor descriptor) + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Docs(params System.Action[] actions) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - public SimulateRequestDescriptor Docs(Action configure) + /// + /// + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.Pipeline? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.Pipeline = value; + return this; } - public SimulateRequestDescriptor Docs(params Action[] configure) + /// + /// + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline() { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null); + return this; } /// /// - /// Pipeline to test. - /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// The pipeline to test. + /// If you don't specify the pipeline request path parameter, this parameter is required. /// If you specify both this and the request path parameter, the API only uses the request path parameter. /// /// - public SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.Pipeline? pipeline) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pipeline(System.Action>? action) { - PipelineDescriptor = null; - PipelineDescriptorAction = null; - PipelineValue = pipeline; - return Self; + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action); + return this; } - public SimulateRequestDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SimulateRequest Build(System.Action> action) { - PipelineValue = null; - PipelineDescriptorAction = null; - PipelineDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SimulateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public SimulateRequestDescriptor Pipeline(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor ErrorTrace(bool? value) { - PipelineValue = null; - PipelineDescriptor = null; - PipelineDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(action), options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PipelineDescriptor is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, PipelineDescriptor, options); - } - else if (PipelineDescriptorAction is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(PipelineDescriptorAction), options); - } - else if (PipelineValue is not null) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, PipelineValue, options); - } + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateResponse.g.cs index 557e500e320..689a8be4003 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Ingest/SimulateResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class SimulateResponse : ElasticsearchResponse +internal sealed partial class SimulateResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("docs")] - public IReadOnlyCollection Docs { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + + public override Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SimulateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SimulateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SimulateResponseConverter))] +public sealed partial class SimulateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimulateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Docs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseRequest.g.cs index 4f61497c928..7d4577310f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseRequest.g.cs @@ -17,69 +17,214 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class DeleteLicenseRequestParameters : RequestParameters +public sealed partial class DeleteLicenseRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class DeleteLicenseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete the license. +/// +/// /// When the license expires, your subscription level reverts to Basic. /// /// /// If the operator privileges feature is enabled, only operator users can use this API. /// /// -public sealed partial class DeleteLicenseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestConverter))] +public sealed partial class DeleteLicenseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementDelete; +#if NET7_0_OR_GREATER + public DeleteLicenseRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public DeleteLicenseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementDelete; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "license.delete"; + + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Delete the license. +/// +/// /// When the license expires, your subscription level reverts to Basic. /// /// /// If the operator privileges feature is enabled, only operator users can use this API. /// /// -public sealed partial class DeleteLicenseRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteLicenseRequestDescriptor { - internal DeleteLicenseRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLicenseRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest instance) + { + Instance = instance; + } public DeleteLicenseRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementDelete; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "license.delete"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseResponse.g.cs index 91e73fcccf5..cf21c68cf17 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/DeleteLicenseResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class DeleteLicenseResponse : ElasticsearchResponse +internal sealed partial class DeleteLicenseResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponseConverter))] +public sealed partial class DeleteLicenseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLicenseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLicenseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusRequest.g.cs index 038af0d7d54..13904166dec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetBasicStatusRequestParameters : RequestParameters +public sealed partial class GetBasicStatusRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetBasicStatusRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -39,11 +61,28 @@ public sealed partial class GetBasicStatusRequestParameters : RequestParameters /// Get the basic license status. /// /// -public sealed partial class GetBasicStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestConverter))] +public sealed partial class GetBasicStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGetBasicStatus; +#if NET7_0_OR_GREATER + public GetBasicStatusRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetBasicStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBasicStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementGetBasicStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -55,23 +94,76 @@ public sealed partial class GetBasicStatusRequest : PlainRequest /// -public sealed partial class GetBasicStatusRequestDescriptor : RequestDescriptor +public readonly partial struct GetBasicStatusRequestDescriptor { - internal GetBasicStatusRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBasicStatusRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest instance) + { + Instance = instance; + } public GetBasicStatusRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGetBasicStatus; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "license.get_basic_status"; + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusResponse.g.cs index ec1e0cba8ff..2173602367e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetBasicStatusResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetBasicStatusResponse : ElasticsearchResponse +internal sealed partial class GetBasicStatusResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("eligible_to_start_basic")] - public bool EligibleToStartBasic { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropEligibleToStartBasic = System.Text.Json.JsonEncodedText.Encode("eligible_to_start_basic"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEligibleToStartBasic = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEligibleToStartBasic.TryReadProperty(ref reader, options, PropEligibleToStartBasic, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EligibleToStartBasic = propEligibleToStartBasic.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEligibleToStartBasic, value.EligibleToStartBasic, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponseConverter))] +public sealed partial class GetBasicStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBasicStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBasicStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool EligibleToStartBasic { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseRequest.g.cs index 7cf79fc8f49..daa4591205f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseRequest.g.cs @@ -17,21 +17,23 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetLicenseRequestParameters : RequestParameters +public sealed partial class GetLicenseRequestParameters : Elastic.Transport.RequestParameters { + /// + /// + /// If true, this parameter returns enterprise for Enterprise license types. If false, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. + /// This parameter is deprecated and will always be set to true in 8.x. + /// + /// + [System.Obsolete("Deprecated in '7.6.0'.")] + public bool? AcceptEnterprise { get => Q("accept_enterprise"); set => Q("accept_enterprise", value); } + /// /// /// Specifies whether to retrieve local information. The default value is false, which means the information is retrieved from the master node. @@ -40,64 +42,199 @@ public sealed partial class GetLicenseRequestParameters : RequestParameters public bool? Local { get => Q("local"); set => Q("local", value); } } +internal sealed partial class GetLicenseRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get license information. +/// +/// /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. /// /// -/// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. +/// info +/// If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. /// /// -public sealed partial class GetLicenseRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestConverter))] +public sealed partial class GetLicenseRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGet; +#if NET7_0_OR_GREATER + public GetLicenseRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetLicenseRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "license.get"; + /// + /// + /// If true, this parameter returns enterprise for Enterprise license types. If false, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. + /// This parameter is deprecated and will always be set to true in 8.x. + /// + /// + [System.Obsolete("Deprecated in '7.6.0'.")] + public bool? AcceptEnterprise { get => Q("accept_enterprise"); set => Q("accept_enterprise", value); } + /// /// /// Specifies whether to retrieve local information. The default value is false, which means the information is retrieved from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } } /// /// /// Get license information. +/// +/// /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. /// /// -/// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. +/// info +/// If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. /// /// -public sealed partial class GetLicenseRequestDescriptor : RequestDescriptor +public readonly partial struct GetLicenseRequestDescriptor { - internal GetLicenseRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLicenseRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest instance) + { + Instance = instance; + } public GetLicenseRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGet; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// If true, this parameter returns enterprise for Enterprise license types. If false, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. + /// This parameter is deprecated and will always be set to true in 8.x. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor AcceptEnterprise(bool? value = true) + { + Instance.AcceptEnterprise = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies whether to retrieve local information. The default value is false, which means the information is retrieved from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } - internal override string OperationName => "license.get"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public GetLicenseRequestDescriptor Local(bool? local = true) => Qs("local", local); + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseResponse.g.cs index fae9931e751..064a44e24ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetLicenseResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetLicenseResponse : ElasticsearchResponse +internal sealed partial class GetLicenseResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("license")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformation License { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropLicense = System.Text.Json.JsonEncodedText.Encode("license"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLicense = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLicense.TryReadProperty(ref reader, options, PropLicense, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + License = propLicense.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLicense, value.License, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponseConverter))] +public sealed partial class GetLicenseResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLicenseResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLicenseResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformation License { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusRequest.g.cs index 45d709baff7..5960d49a367 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetTrialStatusRequestParameters : RequestParameters +public sealed partial class GetTrialStatusRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetTrialStatusRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -39,11 +61,28 @@ public sealed partial class GetTrialStatusRequestParameters : RequestParameters /// Get the trial status. /// /// -public sealed partial class GetTrialStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestConverter))] +public sealed partial class GetTrialStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGetTrialStatus; +#if NET7_0_OR_GREATER + public GetTrialStatusRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetTrialStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrialStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementGetTrialStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -55,23 +94,76 @@ public sealed partial class GetTrialStatusRequest : PlainRequest /// -public sealed partial class GetTrialStatusRequestDescriptor : RequestDescriptor +public readonly partial struct GetTrialStatusRequestDescriptor { - internal GetTrialStatusRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrialStatusRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest instance) + { + Instance = instance; + } public GetTrialStatusRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementGetTrialStatus; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "license.get_trial_status"; + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusResponse.g.cs index 0fa20962a0c..81539a570e4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/GetTrialStatusResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class GetTrialStatusResponse : ElasticsearchResponse +internal sealed partial class GetTrialStatusResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("eligible_to_start_trial")] - public bool EligibleToStartTrial { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropEligibleToStartTrial = System.Text.Json.JsonEncodedText.Encode("eligible_to_start_trial"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEligibleToStartTrial = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEligibleToStartTrial.TryReadProperty(ref reader, options, PropEligibleToStartTrial, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EligibleToStartTrial = propEligibleToStartTrial.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEligibleToStartTrial, value.EligibleToStartTrial, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponseConverter))] +public sealed partial class GetTrialStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrialStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrialStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool EligibleToStartTrial { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostRequest.g.cs index 44625e7feaa..b340a182809 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostRequestParameters : RequestParameters +public sealed partial class PostRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,11 +31,75 @@ public sealed partial class PostRequestParameters : RequestParameters /// /// public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class PostRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLicense = System.Text.Json.JsonEncodedText.Encode("license"); + private static readonly System.Text.Json.JsonEncodedText PropLicenses = System.Text.Json.JsonEncodedText.Encode("licenses"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLicense = default; + LocalJsonValue?> propLicenses = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLicense.TryReadProperty(ref reader, options, PropLicense, null)) + { + continue; + } + + if (propLicenses.TryReadProperty(ref reader, options, PropLicenses, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + License = propLicense.Value, + Licenses = propLicenses.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLicense, value.License, null, null); + writer.WriteProperty(options, PropLicenses, value.Licenses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } } /// /// /// Update the license. +/// +/// /// You can update your license at runtime without shutting down your nodes. /// License updates take effect immediately. /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. @@ -53,11 +110,28 @@ public sealed partial class PostRequestParameters : RequestParameters /// If the operator privileges feature is enabled, only operator users can use this API. /// /// -public sealed partial class PostRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestConverter))] +public sealed partial class PostRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPost; +#if NET7_0_OR_GREATER + public PostRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PostRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementPost; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -68,9 +142,21 @@ public sealed partial class PostRequest : PlainRequest /// Specifies whether you acknowledge the license changes. /// /// - [JsonIgnore] public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } - [JsonInclude, JsonPropertyName("license")] + + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } public Elastic.Clients.Elasticsearch.LicenseManagement.License? License { get; set; } /// @@ -78,13 +164,14 @@ public sealed partial class PostRequest : PlainRequest /// A sequence of one or more JSON documents containing the license information. /// /// - [JsonInclude, JsonPropertyName("licenses")] - public ICollection? Licenses { get; set; } + public System.Collections.Generic.ICollection? Licenses { get; set; } } /// /// /// Update the license. +/// +/// /// You can update your license at runtime without shutting down your nodes. /// License updates take effect immediately. /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. @@ -95,54 +182,89 @@ public sealed partial class PostRequest : PlainRequest /// If the operator privileges feature is enabled, only operator users can use this API. /// /// -public sealed partial class PostRequestDescriptor : RequestDescriptor +public readonly partial struct PostRequestDescriptor { - internal PostRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest Instance { get; init; } - public PostRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPost; + public PostRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Specifies whether you acknowledge the license changes. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Acknowledge(bool? value = true) + { + Instance.Acknowledge = value; + return this; + } - internal override string OperationName => "license.post"; + /// + /// + /// The period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public PostRequestDescriptor Acknowledge(bool? acknowledge = true) => Qs("acknowledge", acknowledge); + /// + /// + /// The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - private Elastic.Clients.Elasticsearch.LicenseManagement.License? LicenseValue { get; set; } - private Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor LicenseDescriptor { get; set; } - private Action LicenseDescriptorAction { get; set; } - private ICollection? LicensesValue { get; set; } - private Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor LicensesDescriptor { get; set; } - private Action LicensesDescriptorAction { get; set; } - private Action[] LicensesDescriptorActions { get; set; } + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor License(Elastic.Clients.Elasticsearch.LicenseManagement.License? value) + { + Instance.License = value; + return this; + } - public PostRequestDescriptor License(Elastic.Clients.Elasticsearch.LicenseManagement.License? license) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor License(System.Action action) { - LicenseDescriptor = null; - LicenseDescriptorAction = null; - LicenseValue = license; - return Self; + Instance.License = Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor.Build(action); + return this; } - public PostRequestDescriptor License(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor descriptor) + /// + /// + /// A sequence of one or more JSON documents containing the license information. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Licenses(System.Collections.Generic.ICollection? value) { - LicenseValue = null; - LicenseDescriptorAction = null; - LicenseDescriptor = descriptor; - return Self; + Instance.Licenses = value; + return this; } - public PostRequestDescriptor License(Action configure) + /// + /// + /// A sequence of one or more JSON documents containing the license information. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Licenses(params Elastic.Clients.Elasticsearch.LicenseManagement.License[] values) { - LicenseValue = null; - LicenseDescriptor = null; - LicenseDescriptorAction = configure; - return Self; + Instance.Licenses = [.. values]; + return this; } /// @@ -150,92 +272,70 @@ public PostRequestDescriptor License(Action /// - public PostRequestDescriptor Licenses(ICollection? licenses) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Licenses(params System.Action[] actions) { - LicensesDescriptor = null; - LicensesDescriptorAction = null; - LicensesDescriptorActions = null; - LicensesValue = licenses; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor.Build(action)); + } + + Instance.Licenses = items; + return this; } - public PostRequestDescriptor Licenses(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest Build(System.Action? action) { - LicensesValue = null; - LicensesDescriptorAction = null; - LicensesDescriptorActions = null; - LicensesDescriptor = descriptor; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PostRequestDescriptor Licenses(Action configure) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor ErrorTrace(bool? value) { - LicensesValue = null; - LicensesDescriptor = null; - LicensesDescriptorActions = null; - LicensesDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public PostRequestDescriptor Licenses(params Action[] configure) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor FilterPath(params string[]? value) { - LicensesValue = null; - LicensesDescriptor = null; - LicensesDescriptorAction = null; - LicensesDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (LicenseDescriptor is not null) - { - writer.WritePropertyName("license"); - JsonSerializer.Serialize(writer, LicenseDescriptor, options); - } - else if (LicenseDescriptorAction is not null) - { - writer.WritePropertyName("license"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(LicenseDescriptorAction), options); - } - else if (LicenseValue is not null) - { - writer.WritePropertyName("license"); - JsonSerializer.Serialize(writer, LicenseValue, options); - } + Instance.Human = value; + return this; + } - if (LicensesDescriptor is not null) - { - writer.WritePropertyName("licenses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, LicensesDescriptor, options); - writer.WriteEndArray(); - } - else if (LicensesDescriptorAction is not null) - { - writer.WritePropertyName("licenses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(LicensesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (LicensesDescriptorActions is not null) - { - writer.WritePropertyName("licenses"); - writer.WriteStartArray(); - foreach (var action in LicensesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndArray(); - } - else if (LicensesValue is not null) - { - writer.WritePropertyName("licenses"); - JsonSerializer.Serialize(writer, LicensesValue, options); - } + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostResponse.g.cs index 1ba8f7e99c6..6278d0d74b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostResponse : ElasticsearchResponse +internal sealed partial class PostResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledge")] - public Elastic.Clients.Elasticsearch.LicenseManagement.Acknowledgement? Acknowledge { get; init; } - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("license_status")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus LicenseStatus { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledge = System.Text.Json.JsonEncodedText.Encode("acknowledge"); + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropLicenseStatus = System.Text.Json.JsonEncodedText.Encode("license_status"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledge = default; + LocalJsonValue propAcknowledged = default; + LocalJsonValue propLicenseStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledge.TryReadProperty(ref reader, options, PropAcknowledge, null)) + { + continue; + } + + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propLicenseStatus.TryReadProperty(ref reader, options, PropLicenseStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledge = propAcknowledge.Value, + Acknowledged = propAcknowledged.Value, + LicenseStatus = propLicenseStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledge, value.Acknowledge, null, null); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropLicenseStatus, value.LicenseStatus, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostResponseConverter))] +public sealed partial class PostResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.Acknowledgement? Acknowledge { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus LicenseStatus { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicRequest.g.cs index f08108f337c..badc70f2eeb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostStartBasicRequestParameters : RequestParameters +public sealed partial class PostStartBasicRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,11 +31,56 @@ public sealed partial class PostStartBasicRequestParameters : RequestParameters /// /// public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class PostStartBasicRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Start a basic license. +/// +/// /// Start an indefinite basic license, which gives access to all the basic features. /// /// @@ -56,11 +94,28 @@ public sealed partial class PostStartBasicRequestParameters : RequestParameters /// To check the status of your basic license, use the get basic license API. /// /// -public sealed partial class PostStartBasicRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestConverter))] +public sealed partial class PostStartBasicRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPostStartBasic; +#if NET7_0_OR_GREATER + public PostStartBasicRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PostStartBasicRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostStartBasicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementPostStartBasic; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -71,13 +126,28 @@ public sealed partial class PostStartBasicRequest : PlainRequest /// - [JsonIgnore] public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Start a basic license. +/// +/// /// Start an indefinite basic license, which gives access to all the basic features. /// /// @@ -91,25 +161,109 @@ public sealed partial class PostStartBasicRequest : PlainRequest /// -public sealed partial class PostStartBasicRequestDescriptor : RequestDescriptor +public readonly partial struct PostStartBasicRequestDescriptor { - internal PostStartBasicRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostStartBasicRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest instance) + { + Instance = instance; + } public PostStartBasicRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPostStartBasic; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// whether the user has acknowledged acknowledge messages (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor Acknowledge(bool? value = true) + { + Instance.Acknowledge = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "license.post_start_basic"; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public PostStartBasicRequestDescriptor Acknowledge(bool? acknowledge = true) => Qs("acknowledge", acknowledge); + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicResponse.g.cs index 9d33f61d74b..ca8db273d91 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartBasicResponse.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostStartBasicResponse : ElasticsearchResponse +internal sealed partial class PostStartBasicResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledge")] - public IReadOnlyDictionary>>? Acknowledge { get; init; } - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("basic_was_started")] - public bool BasicWasStarted { get; init; } - [JsonInclude, JsonPropertyName("error_message")] - public string? ErrorMessage { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType? Type { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledge = System.Text.Json.JsonEncodedText.Encode("acknowledge"); + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropBasicWasStarted = System.Text.Json.JsonEncodedText.Encode("basic_was_started"); + private static readonly System.Text.Json.JsonEncodedText PropErrorMessage = System.Text.Json.JsonEncodedText.Encode("error_message"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propAcknowledge = default; + LocalJsonValue propAcknowledged = default; + LocalJsonValue propBasicWasStarted = default; + LocalJsonValue propErrorMessage = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledge.TryReadProperty(ref reader, options, PropAcknowledge, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propBasicWasStarted.TryReadProperty(ref reader, options, PropBasicWasStarted, null)) + { + continue; + } + + if (propErrorMessage.TryReadProperty(ref reader, options, PropErrorMessage, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledge = propAcknowledge.Value, + Acknowledged = propAcknowledged.Value, + BasicWasStarted = propBasicWasStarted.Value, + ErrorMessage = propErrorMessage.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledge, value.Acknowledge, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropBasicWasStarted, value.BasicWasStarted, null, null); + writer.WriteProperty(options, PropErrorMessage, value.ErrorMessage, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponseConverter))] +public sealed partial class PostStartBasicResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostStartBasicResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostStartBasicResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary>? Acknowledge { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool BasicWasStarted { get; set; } + public string? ErrorMessage { get; set; } + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialRequest.g.cs index e15c0abbf0f..10f98c1f647 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostStartTrialRequestParameters : RequestParameters +public sealed partial class PostStartTrialRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,9 +31,45 @@ public sealed partial class PostStartTrialRequestParameters : RequestParameters /// /// public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } public string? TypeQueryString { get => Q("type_query_string"); set => Q("type_query_string", value); } } +internal sealed partial class PostStartTrialRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start a trial. @@ -54,11 +83,28 @@ public sealed partial class PostStartTrialRequestParameters : RequestParameters /// To check the status of your trial, use the get trial status API. /// /// -public sealed partial class PostStartTrialRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestConverter))] +public sealed partial class PostStartTrialRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPostStartTrial; +#if NET7_0_OR_GREATER + public PostStartTrialRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PostStartTrialRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostStartTrialRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.LicenseManagementPostStartTrial; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -69,9 +115,14 @@ public sealed partial class PostStartTrialRequest : PlainRequest /// - [JsonIgnore] public bool? Acknowledge { get => Q("acknowledge"); set => Q("acknowledge", value); } - [JsonIgnore] + + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } public string? TypeQueryString { get => Q("type_query_string"); set => Q("type_query_string", value); } } @@ -88,26 +139,104 @@ public sealed partial class PostStartTrialRequest : PlainRequest /// -public sealed partial class PostStartTrialRequestDescriptor : RequestDescriptor +public readonly partial struct PostStartTrialRequestDescriptor { - internal PostStartTrialRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostStartTrialRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest instance) + { + Instance = instance; + } public PostStartTrialRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.LicenseManagementPostStartTrial; + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// whether the user has acknowledged acknowledge messages (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor Acknowledge(bool? value = true) + { + Instance.Acknowledge = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. + /// + /// + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "license.post_start_trial"; + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor TypeQueryString(string? value) + { + Instance.TypeQueryString = value; + return this; + } - public PostStartTrialRequestDescriptor Acknowledge(bool? acknowledge = true) => Qs("acknowledge", acknowledge); - public PostStartTrialRequestDescriptor TypeQueryString(string? typeQueryString) => Qs("type_query_string", typeQueryString); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialResponse.g.cs index c95c366c974..66145dadcc6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/LicenseManagement/PostStartTrialResponse.g.cs @@ -17,23 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public sealed partial class PostStartTrialResponse : ElasticsearchResponse +internal sealed partial class PostStartTrialResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropErrorMessage = System.Text.Json.JsonEncodedText.Encode("error_message"); + private static readonly System.Text.Json.JsonEncodedText PropTrialWasStarted = System.Text.Json.JsonEncodedText.Encode("trial_was_started"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propErrorMessage = default; + LocalJsonValue propTrialWasStarted = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propErrorMessage.TryReadProperty(ref reader, options, PropErrorMessage, null)) + { + continue; + } + + if (propTrialWasStarted.TryReadProperty(ref reader, options, PropTrialWasStarted, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + ErrorMessage = propErrorMessage.Value, + TrialWasStarted = propTrialWasStarted.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropErrorMessage, value.ErrorMessage, null, null); + writer.WriteProperty(options, PropTrialWasStarted, value.TrialWasStarted, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponseConverter))] +public sealed partial class PostStartTrialResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("error_message")] - public string? ErrorMessage { get; init; } - [JsonInclude, JsonPropertyName("trial_was_started")] - public bool TrialWasStarted { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType? Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostStartTrialResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostStartTrialResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public string? ErrorMessage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TrialWasStarted { get; set; } + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheRequest.g.cs index d0623e3f5cf..d480598c713 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheRequest.g.cs @@ -17,79 +17,187 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ClearTrainedModelDeploymentCacheRequestParameters : RequestParameters +public sealed partial class ClearTrainedModelDeploymentCacheRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ClearTrainedModelDeploymentCacheRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Clear trained model deployment cache. +/// +/// /// Cache will be cleared on all nodes where the trained model is assigned. /// A trained model deployment may have an inference cache enabled. /// As requests are handled by each allocated node, their responses may be cached on that individual node. /// Calling this API clears the caches without restarting the deployment. /// /// -public sealed partial class ClearTrainedModelDeploymentCacheRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestConverter))] +public sealed partial class ClearTrainedModelDeploymentCacheRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearTrainedModelDeploymentCacheRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public ClearTrainedModelDeploymentCacheRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearTrainedModelDeploymentCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningClearTrainedModelDeploymentCache; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningClearTrainedModelDeploymentCache; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.clear_trained_model_deployment_cache"; + + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } } /// /// /// Clear trained model deployment cache. +/// +/// /// Cache will be cleared on all nodes where the trained model is assigned. /// A trained model deployment may have an inference cache enabled. /// As requests are handled by each allocated node, their responses may be cached on that individual node. /// Calling this API clears the caches without restarting the deployment. /// /// -public sealed partial class ClearTrainedModelDeploymentCacheRequestDescriptor : RequestDescriptor +public readonly partial struct ClearTrainedModelDeploymentCacheRequestDescriptor { - internal ClearTrainedModelDeploymentCacheRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest Instance { get; init; } - public ClearTrainedModelDeploymentCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearTrainedModelDeploymentCacheRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningClearTrainedModelDeploymentCache; + public ClearTrainedModelDeploymentCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest(modelId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearTrainedModelDeploymentCacheRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.clear_trained_model_deployment_cache"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearTrainedModelDeploymentCacheRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheResponse.g.cs index 8043e6d4bfa..54bb57e516a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ClearTrainedModelDeploymentCacheResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ClearTrainedModelDeploymentCacheResponse : ElasticsearchResponse +internal sealed partial class ClearTrainedModelDeploymentCacheResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cleared")] - public bool Cleared { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropCleared = System.Text.Json.JsonEncodedText.Encode("cleared"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCleared = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCleared.TryReadProperty(ref reader, options, PropCleared, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cleared = propCleared.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCleared, value.Cleared, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponseConverter))] +public sealed partial class ClearTrainedModelDeploymentCacheResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearTrainedModelDeploymentCacheResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearTrainedModelDeploymentCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Cleared { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobRequest.g.cs index 57ebbdb573f..819f68b0e26 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobRequest.g.cs @@ -17,52 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class CloseJobRequestParameters : RequestParameters +public sealed partial class CloseJobRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class CloseJobRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAllowNoMatch = System.Text.Json.JsonEncodedText.Encode("allow_no_match"); + private static readonly System.Text.Json.JsonEncodedText PropForce = System.Text.Json.JsonEncodedText.Encode("force"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowNoMatch = default; + LocalJsonValue propForce = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowNoMatch.TryReadProperty(ref reader, options, PropAllowNoMatch, null)) + { + continue; + } + + if (propForce.TryReadProperty(ref reader, options, PropForce, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowNoMatch = propAllowNoMatch.Value, + Force = propForce.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowNoMatch, value.AllowNoMatch, null, null); + writer.WriteProperty(options, PropForce, value.Force, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } } /// /// /// Close anomaly detection jobs. +/// +/// /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. /// When a datafeed that has a specified end date stops, it automatically closes its associated job. /// /// -public sealed partial class CloseJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestConverter))] +public sealed partial class CloseJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CloseJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public CloseJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningCloseJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningCloseJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.close_job"; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection jobs in a single API request by using a group name, a comma-separated list of jobs, or a wildcard expression. You can close all jobs by using _all or by specifying * as the job identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - [JsonInclude, JsonPropertyName("allow_no_match")] public bool? AllowNoMatch { get; set; } /// @@ -70,7 +144,6 @@ public CloseJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// Refer to the descriptiion for the force query parameter. /// /// - [JsonInclude, JsonPropertyName("force")] public bool? Force { get; set; } /// @@ -78,54 +151,64 @@ public CloseJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// Refer to the description for the timeout query parameter. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } /// /// /// Close anomaly detection jobs. +/// +/// /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. /// When a datafeed that has a specified end date stops, it automatically closes its associated job. /// /// -public sealed partial class CloseJobRequestDescriptor : RequestDescriptor +public readonly partial struct CloseJobRequestDescriptor { - internal CloseJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest Instance { get; init; } - public CloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningCloseJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public CloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CloseJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.close_job"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor descriptor) => descriptor.Instance; - public CloseJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection jobs in a single API request by using a group name, a comma-separated list of jobs, or a wildcard expression. You can close all jobs by using _all or by specifying * as the job identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private bool? AllowNoMatchValue { get; set; } - private bool? ForceValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - public CloseJobRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor AllowNoMatch(bool? value = true) { - AllowNoMatchValue = allowNoMatch; - return Self; + Instance.AllowNoMatch = value; + return this; } /// @@ -133,10 +216,10 @@ public CloseJobRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) /// Refer to the descriptiion for the force query parameter. /// /// - public CloseJobRequestDescriptor Force(bool? force = true) + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor Force(bool? value = true) { - ForceValue = force; - return Self; + Instance.Force = value; + return this; } /// @@ -144,33 +227,59 @@ public CloseJobRequestDescriptor Force(bool? force = true) /// Refer to the description for the timeout query parameter. /// /// - public CloseJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowNoMatchValue.HasValue) - { - writer.WritePropertyName("allow_no_match"); - writer.WriteBooleanValue(AllowNoMatchValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ForceValue.HasValue) - { - writer.WritePropertyName("force"); - writer.WriteBooleanValue(ForceValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobResponse.g.cs index 6548e5bf9b3..9f967d831ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/CloseJobResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class CloseJobResponse : ElasticsearchResponse +internal sealed partial class CloseJobResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("closed")] - public bool Closed { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClosed = System.Text.Json.JsonEncodedText.Encode("closed"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClosed = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClosed.TryReadProperty(ref reader, options, PropClosed, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Closed = propClosed.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClosed, value.Closed, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponseConverter))] +public sealed partial class CloseJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Closed { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventRequest.g.cs index c1eee87a939..072f7da9e2e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventRequest.g.cs @@ -17,41 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarEventRequestParameters : RequestParameters +public sealed partial class DeleteCalendarEventRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteCalendarEventRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete events from a calendar. /// /// -public sealed partial class DeleteCalendarEventRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestConverter))] +public sealed partial class DeleteCalendarEventRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId) : base(r => r.Required("calendar_id", calendarId).Required("event_id", eventId)) { } +#if NET7_0_OR_GREATER + public DeleteCalendarEventRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendarEvent; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteCalendarEvent; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_calendar_event"; + + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + + /// + /// + /// Identifier for the scheduled event. + /// You can obtain this identifier by using the get calendar events API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id EventId { get => P("event_id"); set => PR("event_id", value); } } /// @@ -59,35 +116,100 @@ public DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Id calendarId, E /// Delete events from a calendar. /// /// -public sealed partial class DeleteCalendarEventRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteCalendarEventRequestDescriptor { - internal DeleteCalendarEventRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest Instance { get; init; } - public DeleteCalendarEventRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId) : base(r => r.Required("calendar_id", calendarId).Required("event_id", eventId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarEventRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendarEvent; + public DeleteCalendarEventRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest(calendarId, eventId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteCalendarEventRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_calendar_event"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } + + /// + /// + /// Identifier for the scheduled event. + /// You can obtain this identifier by using the get calendar events API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor EventId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.EventId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteCalendarEventRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteCalendarEventRequestDescriptor EventId(Elastic.Clients.Elasticsearch.Id eventId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("event_id", eventId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventResponse.g.cs index 47d28a27405..87017b3c105 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarEventResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarEventResponse : ElasticsearchResponse +internal sealed partial class DeleteCalendarEventResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponseConverter))] +public sealed partial class DeleteCalendarEventResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarEventResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarEventResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobRequest.g.cs index c6365779a10..ccfa853a64f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobRequest.g.cs @@ -17,41 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarJobRequestParameters : RequestParameters +public sealed partial class DeleteCalendarJobRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteCalendarJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete anomaly jobs from a calendar. /// /// -public sealed partial class DeleteCalendarJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestConverter))] +public sealed partial class DeleteCalendarJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) : base(r => r.Required("calendar_id", calendarId).Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public DeleteCalendarJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendarJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteCalendarJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_calendar_job"; + + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + + /// + /// + /// An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a + /// comma-separated list of jobs or groups. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids JobId { get => P("job_id"); set => PR("job_id", value); } } /// @@ -59,35 +116,100 @@ public DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.Id calendarId, Ela /// Delete anomaly jobs from a calendar. /// /// -public sealed partial class DeleteCalendarJobRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteCalendarJobRequestDescriptor { - internal DeleteCalendarJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest Instance { get; init; } - public DeleteCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) : base(r => r.Required("calendar_id", calendarId).Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendarJob; + public DeleteCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest(calendarId, jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteCalendarJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_calendar_job"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } + + /// + /// + /// An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a + /// comma-separated list of jobs or groups. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids value) + { + Instance.JobId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteCalendarJobRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteCalendarJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobResponse.g.cs index f79e96e6c83..fd62674ba97 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarJobResponse.g.cs @@ -17,39 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarJobResponse : ElasticsearchResponse +internal sealed partial class DeleteCalendarJobResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCalendarId = System.Text.Json.JsonEncodedText.Encode("calendar_id"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobIds = System.Text.Json.JsonEncodedText.Encode("job_ids"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarId = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propJobIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarId.TryReadProperty(ref reader, options, PropCalendarId, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobIds.TryReadProperty(ref reader, options, PropJobIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarId = propCalendarId.Value, + Description = propDescription.Value, + JobIds = propJobIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarId, value.CalendarId, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobIds, value.JobIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponseConverter))] +public sealed partial class DeleteCalendarJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that uniquely identifies a calendar. /// /// - [JsonInclude, JsonPropertyName("calendar_id")] - public string CalendarId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string CalendarId { get; set; } /// /// /// A description of the calendar. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// A list of anomaly detection job identifiers or group names. /// /// - [JsonInclude, JsonPropertyName("job_ids")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection JobIds { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection JobIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarRequest.g.cs index e96d8a0c6fc..b2c8fea57dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarRequest.g.cs @@ -17,73 +17,181 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarRequestParameters : RequestParameters +public sealed partial class DeleteCalendarRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteCalendarRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete a calendar. -/// Removes all scheduled events from a calendar, then deletes it. +/// +/// +/// Remove all scheduled events from a calendar, then delete it. /// /// -public sealed partial class DeleteCalendarRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestConverter))] +public sealed partial class DeleteCalendarRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteCalendarRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) { } +#if NET7_0_OR_GREATER + public DeleteCalendarRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendar; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteCalendar; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_calendar"; + + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } } /// /// /// Delete a calendar. -/// Removes all scheduled events from a calendar, then deletes it. +/// +/// +/// Remove all scheduled events from a calendar, then delete it. /// /// -public sealed partial class DeleteCalendarRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteCalendarRequestDescriptor { - internal DeleteCalendarRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest Instance { get; init; } - public DeleteCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteCalendar; + public DeleteCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest(calendarId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteCalendarRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_calendar"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteCalendarRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarResponse.g.cs index f2439430e4c..acac8c1e2a8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteCalendarResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteCalendarResponse : ElasticsearchResponse +internal sealed partial class DeleteCalendarResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponseConverter))] +public sealed partial class DeleteCalendarResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteCalendarResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteCalendarResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsRequest.g.cs index 0d7176897c5..959d8473ea9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class DeleteDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,31 +40,82 @@ public sealed partial class DeleteDataFrameAnalyticsRequestParameters : RequestP public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a data frame analytics job. /// /// -public sealed partial class DeleteDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestConverter))] +public sealed partial class DeleteDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// If true, it deletes a job that is not stopped; this method is quicker than stopping and deleting the job. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -79,7 +123,6 @@ public DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// The time to wait for the job to be deleted. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -88,67 +131,110 @@ public DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// Delete a data frame analytics job. /// /// -public sealed partial class DeleteDataFrameAnalyticsRequestDescriptor : RequestDescriptor, DeleteDataFrameAnalyticsRequestParameters> +public readonly partial struct DeleteDataFrameAnalyticsRequestDescriptor { - internal DeleteDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest Instance { get; init; } - public DeleteDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => false; + public DeleteDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest(id); + } - internal override string OperationName => "ml.delete_data_frame_analytics"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public DeleteDataFrameAnalyticsRequestDescriptor Force(bool? force = true) => Qs("force", force); - public DeleteDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public DeleteDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the data frame analytics job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, it deletes a job that is not stopped; this method is quicker than stopping and deleting the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor Force(bool? value = true) { + Instance.Force = value; + return this; } -} -/// -/// -/// Delete a data frame analytics job. -/// -/// -public sealed partial class DeleteDataFrameAnalyticsRequestDescriptor : RequestDescriptor -{ - internal DeleteDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The time to wait for the job to be deleted. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public DeleteDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteDataFrameAnalytics; + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ml.delete_data_frame_analytics"; + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteDataFrameAnalyticsRequestDescriptor Force(bool? force = true) => Qs("force", force); - public DeleteDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsResponse.g.cs index 78d91d8d7ff..33024ea9dea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDataFrameAnalyticsResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class DeleteDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponseConverter))] +public sealed partial class DeleteDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedRequest.g.cs index 9d4691e39ba..00f0422d278 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteDatafeedRequestParameters : RequestParameters +public sealed partial class DeleteDatafeedRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,32 +34,86 @@ public sealed partial class DeleteDatafeedRequestParameters : RequestParameters public bool? Force { get => Q("force"); set => Q("force", value); } } +internal sealed partial class DeleteDatafeedRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a datafeed. /// /// -public sealed partial class DeleteDatafeedRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestConverter))] +public sealed partial class DeleteDatafeedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) { } +#if NET7_0_OR_GREATER + public DeleteDatafeedRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteDatafeed; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteDatafeed; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This + /// identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It must start and end with alphanumeric + /// characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id DatafeedId { get => P("datafeed_id"); set => PR("datafeed_id", value); } + /// /// /// Use to forcefully delete a started datafeed; this method is quicker than /// stopping and deleting the datafeed. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } } @@ -75,31 +122,103 @@ public DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base /// Delete a datafeed. /// /// -public sealed partial class DeleteDatafeedRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteDatafeedRequestDescriptor { - internal DeleteDatafeedRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest Instance { get; init; } - public DeleteDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteDatafeed; + public DeleteDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest(datafeedId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This + /// identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It must start and end with alphanumeric + /// characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.DatafeedId = value; + return this; + } + + /// + /// + /// Use to forcefully delete a started datafeed; this method is quicker than + /// stopping and deleting the datafeed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteDatafeedRequestDescriptor Force(bool? force = true) => Qs("force", force); + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("datafeed_id", datafeedId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedResponse.g.cs index 985d0ec763f..c92c468bfca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteDatafeedResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteDatafeedResponse : ElasticsearchResponse +internal sealed partial class DeleteDatafeedResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponseConverter))] +public sealed partial class DeleteDatafeedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteDatafeedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataRequest.g.cs index 02f49150cf5..28d63c49ca4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataRequest.g.cs @@ -17,61 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteExpiredDataRequestParameters : RequestParameters +public sealed partial class DeleteExpiredDataRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteExpiredDataRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerSecond = System.Text.Json.JsonEncodedText.Encode("requests_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRequestsPerSecond = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRequestsPerSecond.TryReadProperty(ref reader, options, PropRequestsPerSecond, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RequestsPerSecond = propRequestsPerSecond.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRequestsPerSecond, value.RequestsPerSecond, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Delete expired ML data. -/// Deletes all job results, model snapshots and forecast data that have exceeded +/// +/// +/// Delete all job results, model snapshots and forecast data that have exceeded /// their retention days period. Machine learning state documents that are not /// associated with any job are also deleted. /// You can limit the request to a single or set of anomaly detection jobs by /// using a job identifier, a group name, a comma-separated list of jobs, or a /// wildcard expression. You can delete expired data for all anomaly detection -/// jobs by using _all, by specifying * as the <job_id>, or by omitting the -/// <job_id>. +/// jobs by using _all, by specifying * as the <job_id>, or by omitting the +/// <job_id>. /// /// -public sealed partial class DeleteExpiredDataRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestConverter))] +public sealed partial class DeleteExpiredDataRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) + { + } +#if NET7_0_OR_GREATER public DeleteExpiredDataRequest() { } - - public DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) +#endif +#if !NET7_0_OR_GREATER + public DeleteExpiredDataRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteExpiredData; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteExpiredData; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; internal override string OperationName => "ml.delete_expired_data"; + /// + /// + /// Identifier for an anomaly detection job. It can be a job identifier, a + /// group name, or a wildcard expression. + /// + /// + public Elastic.Clients.Elasticsearch.Id? JobId { get => P("job_id"); set => PO("job_id", value); } + /// /// /// The desired requests per second for the deletion processes. The default /// behavior is no throttling. /// /// - [JsonInclude, JsonPropertyName("requests_per_second")] public float? RequestsPerSecond { get; set; } /// @@ -79,62 +141,69 @@ public DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base( /// How long can the underlying delete processes run until they are canceled. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } /// /// /// Delete expired ML data. -/// Deletes all job results, model snapshots and forecast data that have exceeded +/// +/// +/// Delete all job results, model snapshots and forecast data that have exceeded /// their retention days period. Machine learning state documents that are not /// associated with any job are also deleted. /// You can limit the request to a single or set of anomaly detection jobs by /// using a job identifier, a group name, a comma-separated list of jobs, or a /// wildcard expression. You can delete expired data for all anomaly detection -/// jobs by using _all, by specifying * as the <job_id>, or by omitting the -/// <job_id>. +/// jobs by using _all, by specifying * as the <job_id>, or by omitting the +/// <job_id>. /// /// -public sealed partial class DeleteExpiredDataRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteExpiredDataRequestDescriptor { - internal DeleteExpiredDataRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest Instance { get; init; } - public DeleteExpiredDataRequestDescriptor(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteExpiredDataRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest instance) { + Instance = instance; } - public DeleteExpiredDataRequestDescriptor() + public DeleteExpiredDataRequestDescriptor(Elastic.Clients.Elasticsearch.Id? jobId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(jobId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteExpiredData; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; + public DeleteExpiredDataRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.delete_expired_data"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor descriptor) => descriptor.Instance; - public DeleteExpiredDataRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + /// + /// + /// Identifier for an anomaly detection job. It can be a job identifier, a + /// group name, or a wildcard expression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private float? RequestsPerSecondValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// The desired requests per second for the deletion processes. The default /// behavior is no throttling. /// /// - public DeleteExpiredDataRequestDescriptor RequestsPerSecond(float? requestsPerSecond) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor RequestsPerSecond(float? value) { - RequestsPerSecondValue = requestsPerSecond; - return Self; + Instance.RequestsPerSecond = value; + return this; } /// @@ -142,27 +211,64 @@ public DeleteExpiredDataRequestDescriptor RequestsPerSecond(float? requestsPerSe /// How long can the underlying delete processes run until they are canceled. /// /// - public DeleteExpiredDataRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (RequestsPerSecondValue.HasValue) + if (action is null) { - writer.WritePropertyName("requests_per_second"); - writer.WriteNumberValue(RequestsPerSecondValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataResponse.g.cs index 2fa4f758f7d..460dedef68e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteExpiredDataResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteExpiredDataResponse : ElasticsearchResponse +internal sealed partial class DeleteExpiredDataResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("deleted")] - public bool Deleted { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeleted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deleted = propDeleted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponseConverter))] +public sealed partial class DeleteExpiredDataResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteExpiredDataResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteExpiredDataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Deleted { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterRequest.g.cs index babccd97a41..f001d8e185f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterRequest.g.cs @@ -17,75 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteFilterRequestParameters : RequestParameters +public sealed partial class DeleteFilterRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteFilterRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete a filter. +/// +/// /// If an anomaly detection job references the filter, you cannot delete the /// filter. You must update or delete the job before you can delete the filter. /// /// -public sealed partial class DeleteFilterRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestConverter))] +public sealed partial class DeleteFilterRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) { } +#if NET7_0_OR_GREATER + public DeleteFilterRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteFilter; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteFilter; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_filter"; + + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id FilterId { get => P("filter_id"); set => PR("filter_id", value); } } /// /// /// Delete a filter. +/// +/// /// If an anomaly detection job references the filter, you cannot delete the /// filter. You must update or delete the job before you can delete the filter. /// /// -public sealed partial class DeleteFilterRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteFilterRequestDescriptor { - internal DeleteFilterRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest Instance { get; init; } - public DeleteFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteFilter; + public DeleteFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest(filterId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteFilterRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_filter"; + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.FilterId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id filterId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("filter_id", filterId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterResponse.g.cs index 6d37a717058..6bef5f55117 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteFilterResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteFilterResponse : ElasticsearchResponse +internal sealed partial class DeleteFilterResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponseConverter))] +public sealed partial class DeleteFilterResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteFilterResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastRequest.g.cs index f6ccf14951c..35954b07eb0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteForecastRequestParameters : RequestParameters +public sealed partial class DeleteForecastRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -52,33 +45,97 @@ public sealed partial class DeleteForecastRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteForecastRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete forecasts from a job. +/// +/// /// By default, forecasts are retained for 14 days. You can specify a /// different retention period with the expires_in parameter in the forecast /// jobs API. The delete forecast API enables you to delete one or more /// forecasts before they expire. /// /// -public sealed partial class DeleteForecastRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestConverter))] +public sealed partial class DeleteForecastRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteForecastRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteForecastRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId) : base(r => r.Required("job_id", jobId).Optional("forecast_id", forecastId)) { } +#if NET7_0_OR_GREATER + public DeleteForecastRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteForecast; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteForecast; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_forecast"; + /// + /// + /// A comma-separated list of forecast identifiers. If you do not specify + /// this optional parameter or if you specify _all or * the API deletes + /// all forecasts from the job. + /// + /// + public Elastic.Clients.Elasticsearch.Id? ForecastId { get => P("forecast_id"); set => PO("forecast_id", value); } + + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Specifies whether an error occurs when there are no forecasts. In @@ -87,7 +144,6 @@ public DeleteForecastRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Cli /// return an error. /// /// - [JsonIgnore] public bool? AllowNoForecasts { get => Q("allow_no_forecasts"); set => Q("allow_no_forecasts", value); } /// @@ -97,55 +153,147 @@ public DeleteForecastRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Cli /// error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Delete forecasts from a job. +/// +/// /// By default, forecasts are retained for 14 days. You can specify a /// different retention period with the expires_in parameter in the forecast /// jobs API. The delete forecast API enables you to delete one or more /// forecasts before they expire. /// /// -public sealed partial class DeleteForecastRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteForecastRequestDescriptor { - internal DeleteForecastRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest Instance { get; init; } - public DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId) : base(r => r.Required("job_id", jobId).Optional("forecast_id", forecastId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest instance) { + Instance = instance; } - public DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest(jobId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteForecast; + public DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest(jobId, forecastId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteForecastRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_forecast"; + /// + /// + /// A comma-separated list of forecast identifiers. If you do not specify + /// this optional parameter or if you specify _all or * the API deletes + /// all forecasts from the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor ForecastId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.ForecastId = value; + return this; + } - public DeleteForecastRequestDescriptor AllowNoForecasts(bool? allowNoForecasts = true) => Qs("allow_no_forecasts", allowNoForecasts); - public DeleteForecastRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// Specifies whether an error occurs when there are no forecasts. In + /// particular, if this parameter is set to false and there are no + /// forecasts associated with the job, attempts to delete all forecasts + /// return an error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor AllowNoForecasts(bool? value = true) + { + Instance.AllowNoForecasts = value; + return this; + } + + /// + /// + /// Specifies the period of time to wait for the completion of the delete + /// operation. When this period of time elapses, the API fails and returns an + /// error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteForecastRequestDescriptor ForecastId(Elastic.Clients.Elasticsearch.Id? forecastId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("forecast_id", forecastId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteForecastRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastResponse.g.cs index 00b3f7ab79e..9b6322ebf77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteForecastResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteForecastResponse : ElasticsearchResponse +internal sealed partial class DeleteForecastResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponseConverter))] +public sealed partial class DeleteForecastResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteForecastResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteForecastResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobRequest.g.cs index 68da0f7870a..e7e10e81c35 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteJobRequestParameters : RequestParameters +public sealed partial class DeleteJobRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -58,9 +51,40 @@ public sealed partial class DeleteJobRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class DeleteJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an anomaly detection job. +/// +/// /// All job configuration, model state and results are deleted. /// It is not currently possible to delete multiple jobs using wildcards or a /// comma separated list. If you delete a job that has a datafeed, the request @@ -69,20 +93,43 @@ public sealed partial class DeleteJobRequestParameters : RequestParameters /// delete job request. /// /// -public sealed partial class DeleteJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestConverter))] +public sealed partial class DeleteJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public DeleteJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_job"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Specifies whether annotations that have been added by the @@ -90,7 +137,6 @@ public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// reset. /// /// - [JsonIgnore] public bool? DeleteUserAnnotations { get => Q("delete_user_annotations"); set => Q("delete_user_annotations", value); } /// @@ -99,7 +145,6 @@ public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// closing and deleting the job. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -108,13 +153,14 @@ public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// job deletion completes. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } /// /// /// Delete an anomaly detection job. +/// +/// /// All job configuration, model state and results are deleted. /// It is not currently possible to delete multiple jobs using wildcards or a /// comma separated list. If you delete a job that has a datafeed, the request @@ -123,33 +169,125 @@ public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// delete job request. /// /// -public sealed partial class DeleteJobRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteJobRequestDescriptor { - internal DeleteJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest Instance { get; init; } - public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteJob; + public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest(jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_job"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// Specifies whether annotations that have been added by the + /// user should be deleted along with any auto-generated annotations when the job is + /// reset. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor DeleteUserAnnotations(bool? value = true) + { + Instance.DeleteUserAnnotations = value; + return this; + } - public DeleteJobRequestDescriptor DeleteUserAnnotations(bool? deleteUserAnnotations = true) => Qs("delete_user_annotations", deleteUserAnnotations); - public DeleteJobRequestDescriptor Force(bool? force = true) => Qs("force", force); - public DeleteJobRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// Use to forcefully delete an opened job; this method is quicker than + /// closing and deleting the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + /// + /// + /// Specifies whether the request should return immediately or wait until the + /// job deletion completes. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobResponse.g.cs index 94765430771..d275a3073aa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteJobResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteJobResponse : ElasticsearchResponse +internal sealed partial class DeleteJobResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponseConverter))] +public sealed partial class DeleteJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotRequest.g.cs index 60154991bb8..db42f1a720e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotRequest.g.cs @@ -17,83 +17,207 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteModelSnapshotRequestParameters : RequestParameters +public sealed partial class DeleteModelSnapshotRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteModelSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete a model snapshot. +/// +/// /// You cannot delete the active model snapshot. To delete that snapshot, first /// revert to a different one. To identify the active model snapshot, refer to /// the model_snapshot_id in the results from the get jobs API. /// /// -public sealed partial class DeleteModelSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestConverter))] +public sealed partial class DeleteModelSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) { } +#if NET7_0_OR_GREATER + public DeleteModelSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteModelSnapshot; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteModelSnapshot; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_model_snapshot"; + + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// Identifier for the model snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SnapshotId { get => P("snapshot_id"); set => PR("snapshot_id", value); } } /// /// /// Delete a model snapshot. +/// +/// /// You cannot delete the active model snapshot. To delete that snapshot, first /// revert to a different one. To identify the active model snapshot, refer to /// the model_snapshot_id in the results from the get jobs API. /// /// -public sealed partial class DeleteModelSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteModelSnapshotRequestDescriptor { - internal DeleteModelSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest Instance { get; init; } - public DeleteModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteModelSnapshot; + public DeleteModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest(jobId, snapshotId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteModelSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_model_snapshot"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// Identifier for the model snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.SnapshotId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("snapshot_id", snapshotId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotResponse.g.cs index 658f9205a22..9a62bae4e8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteModelSnapshotResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteModelSnapshotResponse : ElasticsearchResponse +internal sealed partial class DeleteModelSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponseConverter))] +public sealed partial class DeleteModelSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteModelSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasRequest.g.cs index a2802a0df4a..a92e1dc1d21 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasRequest.g.cs @@ -17,83 +17,207 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteTrainedModelAliasRequestParameters : RequestParameters +public sealed partial class DeleteTrainedModelAliasRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteTrainedModelAliasRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete a trained model alias. +/// +/// /// This API deletes an existing model alias that refers to a trained model. If /// the model alias is missing or refers to a model other than the one identified /// by the model_id, this API returns an error. /// /// -public sealed partial class DeleteTrainedModelAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestConverter))] +public sealed partial class DeleteTrainedModelAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) : base(r => r.Required("model_id", modelId).Required("model_alias", modelAlias)) { } +#if NET7_0_OR_GREATER + public DeleteTrainedModelAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteTrainedModelAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteTrainedModelAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_trained_model_alias"; + + /// + /// + /// The model alias to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name ModelAlias { get => P("model_alias"); set => PR("model_alias", value); } + + /// + /// + /// The trained model ID to which the model alias refers. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } } /// /// /// Delete a trained model alias. +/// +/// /// This API deletes an existing model alias that refers to a trained model. If /// the model alias is missing or refers to a model other than the one identified /// by the model_id, this API returns an error. /// /// -public sealed partial class DeleteTrainedModelAliasRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteTrainedModelAliasRequestDescriptor { - internal DeleteTrainedModelAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest Instance { get; init; } - public DeleteTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) : base(r => r.Required("model_id", modelId).Required("model_alias", modelAlias)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteTrainedModelAlias; + public DeleteTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest(modelId, modelAlias); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteTrainedModelAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_trained_model_alias"; + /// + /// + /// The model alias to delete. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor ModelAlias(Elastic.Clients.Elasticsearch.Name value) + { + Instance.ModelAlias = value; + return this; + } + + /// + /// + /// The trained model ID to which the model alias refers. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteTrainedModelAliasRequestDescriptor ModelAlias(Elastic.Clients.Elasticsearch.Name modelAlias) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("model_alias", modelAlias); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteTrainedModelAliasRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasResponse.g.cs index 9d8644ff51e..940ce59813a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelAliasResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteTrainedModelAliasResponse : ElasticsearchResponse +internal sealed partial class DeleteTrainedModelAliasResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponseConverter))] +public sealed partial class DeleteTrainedModelAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTrainedModelAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTrainedModelAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelRequest.g.cs index 11d60873725..eede526af31 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteTrainedModelRequestParameters : RequestParameters +public sealed partial class DeleteTrainedModelRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,68 +31,216 @@ public sealed partial class DeleteTrainedModelRequestParameters : RequestParamet /// /// public bool? Force { get => Q("force"); set => Q("force", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class DeleteTrainedModelRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete an unreferenced trained model. +/// +/// /// The request deletes a trained inference model that is not referenced by an ingest pipeline. /// /// -public sealed partial class DeleteTrainedModelRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestConverter))] +public sealed partial class DeleteTrainedModelRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public DeleteTrainedModelRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteTrainedModel; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningDeleteTrainedModel; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "ml.delete_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Delete an unreferenced trained model. +/// +/// /// The request deletes a trained inference model that is not referenced by an ingest pipeline. /// /// -public sealed partial class DeleteTrainedModelRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteTrainedModelRequestDescriptor { - internal DeleteTrainedModelRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest Instance { get; init; } - public DeleteTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningDeleteTrainedModel; + public DeleteTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest(modelId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteTrainedModelRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.delete_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteTrainedModelRequestDescriptor Force(bool? force = true) => Qs("force", force); + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelResponse.g.cs index 2a0564f9050..d44d74640df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/DeleteTrainedModelResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class DeleteTrainedModelResponse : ElasticsearchResponse +internal sealed partial class DeleteTrainedModelResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponseConverter))] +public sealed partial class DeleteTrainedModelResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTrainedModelResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryRequest.g.cs index 9ea7bd489fd..a5334052963 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryRequest.g.cs @@ -17,36 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class EstimateModelMemoryRequestParameters : RequestParameters +public sealed partial class EstimateModelMemoryRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class EstimateModelMemoryRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropMaxBucketCardinality = System.Text.Json.JsonEncodedText.Encode("max_bucket_cardinality"); + private static readonly System.Text.Json.JsonEncodedText PropOverallCardinality = System.Text.Json.JsonEncodedText.Encode("overall_cardinality"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue?> propMaxBucketCardinality = default; + LocalJsonValue?> propOverallCardinality = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propMaxBucketCardinality.TryReadProperty(ref reader, options, PropMaxBucketCardinality, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOverallCardinality.TryReadProperty(ref reader, options, PropOverallCardinality, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalysisConfig = propAnalysisConfig.Value, + MaxBucketCardinality = propMaxBucketCardinality.Value, + OverallCardinality = propOverallCardinality.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropMaxBucketCardinality, value.MaxBucketCardinality, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOverallCardinality, value.OverallCardinality, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } } /// /// /// Estimate job model memory usage. -/// Makes an estimation of the memory usage for an anomaly detection job model. -/// It is based on analysis configuration details for the job and cardinality +/// +/// +/// Make an estimation of the memory usage for an anomaly detection job model. +/// The estimate is based on analysis configuration details for the job and cardinality /// estimates for the fields it references. /// /// -public sealed partial class EstimateModelMemoryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestConverter))] +public sealed partial class EstimateModelMemoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEstimateModelMemory; +#if NET7_0_OR_GREATER + public EstimateModelMemoryRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public EstimateModelMemoryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningEstimateModelMemory; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -58,7 +127,6 @@ public sealed partial class EstimateModelMemoryRequest : PlainRequestanalysis_config component of the body of this API. /// /// - [JsonInclude, JsonPropertyName("analysis_config")] public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfig { get; set; } /// @@ -70,8 +138,7 @@ public sealed partial class EstimateModelMemoryRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("max_bucket_cardinality")] - public IDictionary? MaxBucketCardinality { get; set; } + public System.Collections.Generic.IDictionary? MaxBucketCardinality { get; set; } /// /// @@ -84,39 +151,60 @@ public sealed partial class EstimateModelMemoryRequest : PlainRequestover_field_name or partition_field_name. /// /// - [JsonInclude, JsonPropertyName("overall_cardinality")] - public IDictionary? OverallCardinality { get; set; } + public System.Collections.Generic.IDictionary? OverallCardinality { get; set; } } /// /// /// Estimate job model memory usage. -/// Makes an estimation of the memory usage for an anomaly detection job model. -/// It is based on analysis configuration details for the job and cardinality +/// +/// +/// Make an estimation of the memory usage for an anomaly detection job model. +/// The estimate is based on analysis configuration details for the job and cardinality /// estimates for the fields it references. /// /// -public sealed partial class EstimateModelMemoryRequestDescriptor : RequestDescriptor, EstimateModelMemoryRequestParameters> +public readonly partial struct EstimateModelMemoryRequestDescriptor { - internal EstimateModelMemoryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest Instance { get; init; } - public EstimateModelMemoryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EstimateModelMemoryRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEstimateModelMemory; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public EstimateModelMemoryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.estimate_model_memory"; + /// + /// + /// For a list of the properties that you can specify in the + /// analysis_config component of the body of this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? value) + { + Instance.AnalysisConfig = value; + return this; + } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action> AnalysisConfigDescriptorAction { get; set; } - private IDictionary? MaxBucketCardinalityValue { get; set; } - private IDictionary? OverallCardinalityValue { get; set; } + /// + /// + /// For a list of the properties that you can specify in the + /// analysis_config component of the body of this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AnalysisConfig(System.Action action) + { + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; + } /// /// @@ -124,28 +212,40 @@ public EstimateModelMemoryRequestDescriptor() /// analysis_config component of the body of this API. /// /// - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? analysisConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + /// + /// + /// Estimates of the highest cardinality in a single bucket that is observed + /// for influencer fields over the time period that the job analyzes data. + /// To produce a good answer, values must be provided for all influencer + /// fields. Providing values for fields that are not listed as influencers + /// has no effect on the estimation. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality(System.Collections.Generic.IDictionary? value) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.MaxBucketCardinality = value; + return this; } - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Action> configure) + /// + /// + /// Estimates of the highest cardinality in a single bucket that is observed + /// for influencer fields over the time period that the job analyzes data. + /// To produce a good answer, values must be provided for all influencer + /// fields. Providing values for fields that are not listed as influencers + /// has no effect on the estimation. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality() { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.MaxBucketCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(null); + return this; } /// @@ -157,10 +257,39 @@ public EstimateModelMemoryRequestDescriptor AnalysisConfig(Action /// - public EstimateModelMemoryRequestDescriptor MaxBucketCardinality(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality(System.Action? action) + { + Instance.MaxBucketCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } + + /// + /// + /// Estimates of the highest cardinality in a single bucket that is observed + /// for influencer fields over the time period that the job analyzes data. + /// To produce a good answer, values must be provided for all influencer + /// fields. Providing values for fields that are not listed as influencers + /// has no effect on the estimation. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality(System.Action>? action) + { + Instance.MaxBucketCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddMaxBucketCardinality(Elastic.Clients.Elasticsearch.Field key, long value) + { + Instance.MaxBucketCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.MaxBucketCardinality.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddMaxBucketCardinality(System.Linq.Expressions.Expression> key, long value) { - MaxBucketCardinalityValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.MaxBucketCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.MaxBucketCardinality.Add(key, value); + return this; } /// @@ -174,76 +303,172 @@ public EstimateModelMemoryRequestDescriptor MaxBucketCardinality(Func /// over_field_name or partition_field_name. /// /// - public EstimateModelMemoryRequestDescriptor OverallCardinality(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality(System.Collections.Generic.IDictionary? value) { - OverallCardinalityValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.OverallCardinality = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Estimates of the cardinality that is observed for fields over the whole + /// time period that the job analyzes data. To produce a good answer, values + /// must be provided for fields referenced in the by_field_name, + /// over_field_name and partition_field_name of any detectors. Providing + /// values for other fields has no effect on the estimation. It can be + /// omitted from the request if no detectors have a by_field_name, + /// over_field_name or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality() { - writer.WriteStartObject(); - if (AnalysisConfigDescriptor is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else if (AnalysisConfigValue is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); - } + Instance.OverallCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(null); + return this; + } - if (MaxBucketCardinalityValue is not null) - { - writer.WritePropertyName("max_bucket_cardinality"); - JsonSerializer.Serialize(writer, MaxBucketCardinalityValue, options); - } + /// + /// + /// Estimates of the cardinality that is observed for fields over the whole + /// time period that the job analyzes data. To produce a good answer, values + /// must be provided for fields referenced in the by_field_name, + /// over_field_name and partition_field_name of any detectors. Providing + /// values for other fields has no effect on the estimation. It can be + /// omitted from the request if no detectors have a by_field_name, + /// over_field_name or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality(System.Action? action) + { + Instance.OverallCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } + + /// + /// + /// Estimates of the cardinality that is observed for fields over the whole + /// time period that the job analyzes data. To produce a good answer, values + /// must be provided for fields referenced in the by_field_name, + /// over_field_name and partition_field_name of any detectors. Providing + /// values for other fields has no effect on the estimation. It can be + /// omitted from the request if no detectors have a by_field_name, + /// over_field_name or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality(System.Action>? action) + { + Instance.OverallCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } - if (OverallCardinalityValue is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddOverallCardinality(Elastic.Clients.Elasticsearch.Field key, long value) + { + Instance.OverallCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.OverallCardinality.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddOverallCardinality(System.Linq.Expressions.Expression> key, long value) + { + Instance.OverallCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.OverallCardinality.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("overall_cardinality"); - JsonSerializer.Serialize(writer, OverallCardinalityValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Estimate job model memory usage. -/// Makes an estimation of the memory usage for an anomaly detection job model. -/// It is based on analysis configuration details for the job and cardinality +/// +/// +/// Make an estimation of the memory usage for an anomaly detection job model. +/// The estimate is based on analysis configuration details for the job and cardinality /// estimates for the fields it references. /// /// -public sealed partial class EstimateModelMemoryRequestDescriptor : RequestDescriptor +public readonly partial struct EstimateModelMemoryRequestDescriptor { - internal EstimateModelMemoryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest Instance { get; init; } - public EstimateModelMemoryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EstimateModelMemoryRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEstimateModelMemory; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public EstimateModelMemoryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.estimate_model_memory"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action AnalysisConfigDescriptorAction { get; set; } - private IDictionary? MaxBucketCardinalityValue { get; set; } - private IDictionary? OverallCardinalityValue { get; set; } + /// + /// + /// For a list of the properties that you can specify in the + /// analysis_config component of the body of this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? value) + { + Instance.AnalysisConfig = value; + return this; + } /// /// @@ -251,28 +476,40 @@ public EstimateModelMemoryRequestDescriptor() /// analysis_config component of the body of this API. /// /// - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? analysisConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + /// + /// + /// Estimates of the highest cardinality in a single bucket that is observed + /// for influencer fields over the time period that the job analyzes data. + /// To produce a good answer, values must be provided for all influencer + /// fields. Providing values for fields that are not listed as influencers + /// has no effect on the estimation. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality(System.Collections.Generic.IDictionary? value) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.MaxBucketCardinality = value; + return this; } - public EstimateModelMemoryRequestDescriptor AnalysisConfig(Action configure) + /// + /// + /// Estimates of the highest cardinality in a single bucket that is observed + /// for influencer fields over the time period that the job analyzes data. + /// To produce a good answer, values must be provided for all influencer + /// fields. Providing values for fields that are not listed as influencers + /// has no effect on the estimation. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality() { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.MaxBucketCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(null); + return this; } /// @@ -284,10 +521,41 @@ public EstimateModelMemoryRequestDescriptor AnalysisConfig(Action /// - public EstimateModelMemoryRequestDescriptor MaxBucketCardinality(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor MaxBucketCardinality(System.Action>? action) + { + Instance.MaxBucketCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddMaxBucketCardinality(Elastic.Clients.Elasticsearch.Field key, long value) + { + Instance.MaxBucketCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.MaxBucketCardinality.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddMaxBucketCardinality(System.Linq.Expressions.Expression> key, long value) + { + Instance.MaxBucketCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.MaxBucketCardinality.Add(key, value); + return this; + } + + /// + /// + /// Estimates of the cardinality that is observed for fields over the whole + /// time period that the job analyzes data. To produce a good answer, values + /// must be provided for fields referenced in the by_field_name, + /// over_field_name and partition_field_name of any detectors. Providing + /// values for other fields has no effect on the estimation. It can be + /// omitted from the request if no detectors have a by_field_name, + /// over_field_name or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality(System.Collections.Generic.IDictionary? value) { - MaxBucketCardinalityValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.OverallCardinality = value; + return this; } /// @@ -301,43 +569,95 @@ public EstimateModelMemoryRequestDescriptor MaxBucketCardinality(Funcover_field_name or partition_field_name. /// /// - public EstimateModelMemoryRequestDescriptor OverallCardinality(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality() { - OverallCardinalityValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.OverallCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Estimates of the cardinality that is observed for fields over the whole + /// time period that the job analyzes data. To produce a good answer, values + /// must be provided for fields referenced in the by_field_name, + /// over_field_name and partition_field_name of any detectors. Providing + /// values for other fields has no effect on the estimation. It can be + /// omitted from the request if no detectors have a by_field_name, + /// over_field_name or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor OverallCardinality(System.Action>? action) { - writer.WriteStartObject(); - if (AnalysisConfigDescriptor is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else if (AnalysisConfigValue is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); - } + Instance.OverallCardinality = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong.Build(action); + return this; + } - if (MaxBucketCardinalityValue is not null) - { - writer.WritePropertyName("max_bucket_cardinality"); - JsonSerializer.Serialize(writer, MaxBucketCardinalityValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddOverallCardinality(Elastic.Clients.Elasticsearch.Field key, long value) + { + Instance.OverallCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.OverallCardinality.Add(key, value); + return this; + } - if (OverallCardinalityValue is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor AddOverallCardinality(System.Linq.Expressions.Expression> key, long value) + { + Instance.OverallCardinality ??= new System.Collections.Generic.Dictionary(); + Instance.OverallCardinality.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("overall_cardinality"); - JsonSerializer.Serialize(writer, OverallCardinalityValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryResponse.g.cs index c420b7ffc87..d625aee3e77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EstimateModelMemoryResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class EstimateModelMemoryResponse : ElasticsearchResponse +internal sealed partial class EstimateModelMemoryResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("model_memory_estimate")] - public string ModelMemoryEstimate { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryEstimate = System.Text.Json.JsonEncodedText.Encode("model_memory_estimate"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModelMemoryEstimate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModelMemoryEstimate.TryReadProperty(ref reader, options, PropModelMemoryEstimate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModelMemoryEstimate = propModelMemoryEstimate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModelMemoryEstimate, value.ModelMemoryEstimate, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponseConverter))] +public sealed partial class EstimateModelMemoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EstimateModelMemoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EstimateModelMemoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ModelMemoryEstimate { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameRequest.g.cs index 55715713750..738d57ecafc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameRequest.g.cs @@ -17,37 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class EvaluateDataFrameRequestParameters : RequestParameters +public sealed partial class EvaluateDataFrameRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class EvaluateDataFrameRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropEvaluation = System.Text.Json.JsonEncodedText.Encode("evaluation"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEvaluation = default; + LocalJsonValue propIndex = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvaluation.TryReadProperty(ref reader, options, PropEvaluation, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Evaluation = propEvaluation.Value, + Index = propIndex.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvaluation, value.Evaluation, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } } /// /// /// Evaluate data frame analytics. +/// +/// /// The API packages together commonly used evaluation metrics for various types /// of machine learning features. This has been designed for use on indexes /// created by data frame analytics. Evaluation requires both a ground truth /// field and an analytics result field to be present. /// /// -public sealed partial class EvaluateDataFrameRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestConverter))] +public sealed partial class EvaluateDataFrameRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEvaluateDataFrame; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation evaluation, Elastic.Clients.Elasticsearch.IndexName index) + { + Evaluation = evaluation; + Index = index; + } +#if NET7_0_OR_GREATER + public EvaluateDataFrameRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EvaluateDataFrameRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningEvaluateDataFrame; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -58,97 +134,124 @@ public sealed partial class EvaluateDataFrameRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("evaluation")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Evaluation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Evaluation { get; set; } /// /// /// Defines the index in which the evaluation will be performed. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// /// A query clause that retrieves a subset of data from the source index. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } /// /// /// Evaluate data frame analytics. +/// +/// /// The API packages together commonly used evaluation metrics for various types /// of machine learning features. This has been designed for use on indexes /// created by data frame analytics. Evaluation requires both a ground truth /// field and an analytics result field to be present. /// /// -public sealed partial class EvaluateDataFrameRequestDescriptor : RequestDescriptor, EvaluateDataFrameRequestParameters> +public readonly partial struct EvaluateDataFrameRequestDescriptor { - internal EvaluateDataFrameRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest Instance { get; init; } - public EvaluateDataFrameRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EvaluateDataFrameRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEvaluateDataFrame; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public EvaluateDataFrameRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.evaluate_data_frame"; + /// + /// + /// Defines the type of evaluation you want to perform. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation value) + { + Instance.Evaluation = value; + return this; + } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation EvaluationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor EvaluationDescriptor { get; set; } - private Action> EvaluationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } + /// + /// + /// Defines the type of evaluation you want to perform. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Evaluation(System.Action action) + { + Instance.Evaluation = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor.Build(action); + return this; + } /// /// /// Defines the type of evaluation you want to perform. /// /// - public EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation evaluation) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Evaluation(System.Action> action) { - EvaluationDescriptor = null; - EvaluationDescriptorAction = null; - EvaluationValue = evaluation; - return Self; + Instance.Evaluation = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor.Build(action); + return this; } - public EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor descriptor) + /// + /// + /// Defines the index in which the evaluation will be performed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - EvaluationValue = null; - EvaluationDescriptorAction = null; - EvaluationDescriptor = descriptor; - return Self; + Instance.Index = value; + return this; } - public EvaluateDataFrameRequestDescriptor Evaluation(Action> configure) + /// + /// + /// A query clause that retrieves a subset of data from the source index. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - EvaluationValue = null; - EvaluationDescriptor = null; - EvaluationDescriptorAction = configure; - return Self; + Instance.Query = value; + return this; } /// /// - /// Defines the index in which the evaluation will be performed. + /// A query clause that retrieves a subset of data from the source index. /// /// - public EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Query(System.Action action) { - IndexValue = index; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -156,142 +259,134 @@ public EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elast /// A query clause that retrieves a subset of data from the source index. /// /// - public EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest Build(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public EvaluateDataFrameRequestDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor ErrorTrace(bool? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (EvaluationDescriptor is not null) - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, EvaluationDescriptor, options); - } - else if (EvaluationDescriptorAction is not null) - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(EvaluationDescriptorAction), options); - } - else - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, EvaluationValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Evaluate data frame analytics. +/// +/// /// The API packages together commonly used evaluation metrics for various types /// of machine learning features. This has been designed for use on indexes /// created by data frame analytics. Evaluation requires both a ground truth /// field and an analytics result field to be present. /// /// -public sealed partial class EvaluateDataFrameRequestDescriptor : RequestDescriptor +public readonly partial struct EvaluateDataFrameRequestDescriptor { - internal EvaluateDataFrameRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest Instance { get; init; } - public EvaluateDataFrameRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EvaluateDataFrameRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningEvaluateDataFrame; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ml.evaluate_data_frame"; + public EvaluateDataFrameRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation EvaluationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor EvaluationDescriptor { get; set; } - private Action EvaluationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor descriptor) => descriptor.Instance; /// /// /// Defines the type of evaluation you want to perform. /// /// - public EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation evaluation) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation value) { - EvaluationDescriptor = null; - EvaluationDescriptorAction = null; - EvaluationValue = evaluation; - return Self; + Instance.Evaluation = value; + return this; } - public EvaluateDataFrameRequestDescriptor Evaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor descriptor) + /// + /// + /// Defines the type of evaluation you want to perform. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Evaluation(System.Action> action) { - EvaluationValue = null; - EvaluationDescriptorAction = null; - EvaluationDescriptor = descriptor; - return Self; + Instance.Evaluation = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor.Build(action); + return this; } - public EvaluateDataFrameRequestDescriptor Evaluation(Action configure) + /// + /// + /// Defines the index in which the evaluation will be performed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - EvaluationValue = null; - EvaluationDescriptor = null; - EvaluationDescriptorAction = configure; - return Self; + Instance.Index = value; + return this; } /// /// - /// Defines the index in which the evaluation will be performed. + /// A query clause that retrieves a subset of data from the source index. /// /// - public EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexValue = index; - return Self; + Instance.Query = value; + return this; } /// @@ -299,67 +394,59 @@ public EvaluateDataFrameRequestDescriptor Index(Elastic.Clients.Elasticsearch.In /// A query clause that retrieves a subset of data from the source index. /// /// - public EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public EvaluateDataFrameRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest Build(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public EvaluateDataFrameRequestDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor ErrorTrace(bool? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (EvaluationDescriptor is not null) - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, EvaluationDescriptor, options); - } - else if (EvaluationDescriptorAction is not null) - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(EvaluationDescriptorAction), options); - } - else - { - writer.WritePropertyName("evaluation"); - JsonSerializer.Serialize(writer, EvaluationValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameResponse.g.cs index 239a4585c7c..325f282423d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/EvaluateDataFrameResponse.g.cs @@ -17,25 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class EvaluateDataFrameResponse : ElasticsearchResponse +internal sealed partial class EvaluateDataFrameResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText PropOutlierDetection = System.Text.Json.JsonEncodedText.Encode("outlier_detection"); + private static readonly System.Text.Json.JsonEncodedText PropRegression = System.Text.Json.JsonEncodedText.Encode("regression"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassification = default; + LocalJsonValue propOutlierDetection = default; + LocalJsonValue propRegression = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassification.TryReadProperty(ref reader, options, PropClassification, null)) + { + continue; + } + + if (propOutlierDetection.TryReadProperty(ref reader, options, PropOutlierDetection, null)) + { + continue; + } + + if (propRegression.TryReadProperty(ref reader, options, PropRegression, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classification = propClassification.Value, + OutlierDetection = propOutlierDetection.Value, + Regression = propRegression.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassification, value.Classification, null, null); + writer.WriteProperty(options, PropOutlierDetection, value.OutlierDetection, null, null); + writer.WriteProperty(options, PropRegression, value.Regression, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponseConverter))] +public sealed partial class EvaluateDataFrameResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EvaluateDataFrameResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EvaluateDataFrameResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Evaluation results for a classification analysis. /// It outputs a prediction that identifies to which of the classes each document belongs. /// /// - [JsonInclude, JsonPropertyName("classification")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummary? Classification { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummary? Classification { get; set; } /// /// @@ -43,14 +108,12 @@ public sealed partial class EvaluateDataFrameResponse : ElasticsearchResponse /// It outputs the probability that each document is an outlier. /// /// - [JsonInclude, JsonPropertyName("outlier_detection")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummary? OutlierDetection { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummary? OutlierDetection { get; set; } /// /// /// Evaluation results for a regression analysis which outputs a prediction of values. /// /// - [JsonInclude, JsonPropertyName("regression")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummary? Regression { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummary? Regression { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsRequest.g.cs index 86ef39e34da..f1cb6cf3eb4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsRequest.g.cs @@ -17,26 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ExplainDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class ExplainDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ExplainDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + Description = propDescription.Value, + Dest = propDest.Value, + MaxNumThreads = propMaxNumThreads.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } } /// /// /// Explain data frame analytics config. +/// +/// /// This API provides explanations for a data frame analytics config that either /// exists already or one that has not been created yet. The following /// explanations are provided: @@ -55,31 +152,51 @@ public sealed partial class ExplainDataFrameAnalyticsRequestParameters : Request /// /// /// -public sealed partial class ExplainDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestConverter))] +public sealed partial class ExplainDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public ExplainDataFrameAnalyticsRequest() { } - - public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public ExplainDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningExplainDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningExplainDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.explain_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// Specifies whether this job can start when there is insufficient machine /// learning node capacity for it to be immediately assigned to a node. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_start")] public bool? AllowLazyStart { get; set; } /// @@ -89,7 +206,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// detection, or regression. /// /// - [JsonInclude, JsonPropertyName("analysis")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? Analysis { get; set; } /// @@ -101,7 +217,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// be included in the analysis. /// /// - [JsonInclude, JsonPropertyName("analyzed_fields")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } /// @@ -109,7 +224,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -118,7 +232,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// results_field (ml by default). /// /// - [JsonInclude, JsonPropertyName("dest")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? Dest { get; set; } /// @@ -129,7 +242,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// for operational functionality other than the analysis itself. /// /// - [JsonInclude, JsonPropertyName("max_num_threads")] public int? MaxNumThreads { get; set; } /// @@ -141,7 +253,6 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// greater than that setting. /// /// - [JsonInclude, JsonPropertyName("model_memory_limit")] public string? ModelMemoryLimit { get; set; } /// @@ -150,13 +261,14 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// index. Optionally, query and _source may be specified. /// /// - [JsonInclude, JsonPropertyName("source")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? Source { get; set; } } /// /// /// Explain data frame analytics config. +/// +/// /// This API provides explanations for a data frame analytics config that either /// exists already or one that has not been created yet. The following /// explanations are provided: @@ -175,59 +287,52 @@ public ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// /// /// -public sealed partial class ExplainDataFrameAnalyticsRequestDescriptor : RequestDescriptor, ExplainDataFrameAnalyticsRequestParameters> +public readonly partial struct ExplainDataFrameAnalyticsRequestDescriptor { - internal ExplainDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest Instance { get; init; } - public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest instance) { + Instance = instance; } - public ExplainDataFrameAnalyticsRequestDescriptor() + public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningExplainDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public ExplainDataFrameAnalyticsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.explain_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public ExplainDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action> AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor DestDescriptor { get; set; } - private Action> DestDescriptorAction { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - /// /// /// Specifies whether this job can start when there is insufficient machine /// learning node capacity for it to be immediately assigned to a node. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? value = true) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.AllowLazyStart = value; + return this; } /// @@ -237,28 +342,36 @@ public ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool /// detection, or regression. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? analysis) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? value) { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; + Instance.Analysis = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Analysis(System.Action action) { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Action> configure) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Analysis(System.Action> action) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } /// @@ -270,28 +383,40 @@ public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Action /// - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.AnalyzedFields = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + /// + /// + /// Specify includes and/or excludes patterns to select which fields will be + /// included in the analysis. The patterns specified in excludes are applied + /// last, therefore excludes takes precedence. In other words, if the same + /// field is specified in both includes and excludes, then the field will not + /// be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields() { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action configure) + /// + /// + /// Specify includes and/or excludes patterns to select which fields will be + /// included in the analysis. The patterns specified in excludes are applied + /// last, therefore excludes takes precedence. In other words, if the same + /// field is specified in both includes and excludes, then the field will not + /// be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(System.Action? action) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } /// @@ -299,10 +424,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Acti /// A description of the job. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -311,28 +436,34 @@ public ExplainDataFrameAnalyticsRequestDescriptor Description(string? /// results_field (ml by default). /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? dest) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) + /// + /// + /// The destination configuration, consisting of index and optionally + /// results_field (ml by default). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Dest(System.Action action) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Action> configure) + /// + /// + /// The destination configuration, consisting of index and optionally + /// results_field (ml by default). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Dest(System.Action> action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; } /// @@ -343,10 +474,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor Dest(Action /// - public ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? value) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.MaxNumThreads = value; + return this; } /// @@ -358,10 +489,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? /// greater than that setting. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } /// @@ -370,128 +501,97 @@ public ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(st /// index. Optionally, query and _source may be specified. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? source) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + /// + /// + /// The configuration of how to source the analysis data. It requires an + /// index. Optionally, query and _source may be specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Source(Action> configure) + /// + /// + /// The configuration of how to source the analysis data. It requires an + /// index. Optionally, query and _source may be specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) + if (action is null) { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else if (AnalysisValue is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Explain data frame analytics config. +/// +/// /// This API provides explanations for a data frame analytics config that either /// exists already or one that has not been created yet. The following /// explanations are provided: @@ -510,59 +610,52 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// /// /// -public sealed partial class ExplainDataFrameAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct ExplainDataFrameAnalyticsRequestDescriptor { - internal ExplainDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest Instance { get; init; } - public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest instance) { + Instance = instance; } - public ExplainDataFrameAnalyticsRequestDescriptor() + public ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningExplainDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public ExplainDataFrameAnalyticsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.explain_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public ExplainDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - /// /// /// Specifies whether this job can start when there is insufficient machine /// learning node capacity for it to be immediately assigned to a node. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? value = true) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.AllowLazyStart = value; + return this; } /// @@ -572,28 +665,23 @@ public ExplainDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazy /// detection, or regression. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? analysis) - { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; - } - - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis? value) { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; + Instance.Analysis = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Action configure) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Analysis(System.Action> action) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } /// @@ -605,28 +693,40 @@ public ExplainDataFrameAnalyticsRequestDescriptor Analysis(Action /// - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.AnalyzedFields = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + /// + /// + /// Specify includes and/or excludes patterns to select which fields will be + /// included in the analysis. The patterns specified in excludes are applied + /// last, therefore excludes takes precedence. In other words, if the same + /// field is specified in both includes and excludes, then the field will not + /// be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields() { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action configure) + /// + /// + /// Specify includes and/or excludes patterns to select which fields will be + /// included in the analysis. The patterns specified in excludes are applied + /// last, therefore excludes takes precedence. In other words, if the same + /// field is specified in both includes and excludes, then the field will not + /// be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(System.Action? action) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } /// @@ -634,10 +734,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action /// - public ExplainDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -646,28 +746,22 @@ public ExplainDataFrameAnalyticsRequestDescriptor Description(string? descriptio /// results_field (ml by default). /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? dest) - { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; - } - - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination? value) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Dest(Action configure) + /// + /// + /// The destination configuration, consisting of index and optionally + /// results_field (ml by default). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Dest(System.Action> action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; } /// @@ -678,10 +772,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor Dest(Action /// - public ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? value) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.MaxNumThreads = value; + return this; } /// @@ -693,10 +787,10 @@ public ExplainDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThrea /// greater than that setting. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } /// @@ -705,121 +799,76 @@ public ExplainDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? model /// index. Optionally, query and _source may be specified. /// /// - public ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? source) - { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; - } - - public ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource? value) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public ExplainDataFrameAnalyticsRequestDescriptor Source(Action configure) + /// + /// + /// The configuration of how to source the analysis data. It requires an + /// index. Optionally, query and _source may be specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) + if (action is null) { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else if (AnalysisValue is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsResponse.g.cs index 9538fde34a2..c8a6103398a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ExplainDataFrameAnalyticsResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ExplainDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class ExplainDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldSelection = System.Text.Json.JsonEncodedText.Encode("field_selection"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryEstimation = System.Text.Json.JsonEncodedText.Encode("memory_estimation"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFieldSelection = default; + LocalJsonValue propMemoryEstimation = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldSelection.TryReadProperty(ref reader, options, PropFieldSelection, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMemoryEstimation.TryReadProperty(ref reader, options, PropMemoryEstimation, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldSelection = propFieldSelection.Value, + MemoryEstimation = propMemoryEstimation.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldSelection, value.FieldSelection, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMemoryEstimation, value.MemoryEstimation, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponseConverter))] +public sealed partial class ExplainDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of objects that explain selection for each field, sorted by the field names. /// /// - [JsonInclude, JsonPropertyName("field_selection")] - public IReadOnlyCollection FieldSelection { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FieldSelection { get; set; } /// /// /// An array of objects that explain selection for each field, sorted by the field names. /// /// - [JsonInclude, JsonPropertyName("memory_estimation")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimation MemoryEstimation { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimation MemoryEstimation { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobRequest.g.cs index 7d2aad9a7b2..34bdf48e8b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobRequest.g.cs @@ -17,21 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class FlushJobRequestParameters : RequestParameters +public sealed partial class FlushJobRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class FlushJobRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAdvanceTime = System.Text.Json.JsonEncodedText.Encode("advance_time"); + private static readonly System.Text.Json.JsonEncodedText PropCalcInterim = System.Text.Json.JsonEncodedText.Encode("calc_interim"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropSkipTime = System.Text.Json.JsonEncodedText.Encode("skip_time"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdvanceTime = default; + LocalJsonValue propCalcInterim = default; + LocalJsonValue propEnd = default; + LocalJsonValue propSkipTime = default; + LocalJsonValue propStart = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdvanceTime.TryReadProperty(ref reader, options, PropAdvanceTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCalcInterim.TryReadProperty(ref reader, options, PropCalcInterim, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propSkipTime.TryReadProperty(ref reader, options, PropSkipTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdvanceTime = propAdvanceTime.Value, + CalcInterim = propCalcInterim.Value, + End = propEnd.Value, + SkipTime = propSkipTime.Value, + Start = propStart.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdvanceTime, value.AdvanceTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCalcInterim, value.CalcInterim, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropSkipTime, value.SkipTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } } /// @@ -47,34 +115,55 @@ public sealed partial class FlushJobRequestParameters : RequestParameters /// analyzing further data. /// /// -public sealed partial class FlushJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestConverter))] +public sealed partial class FlushJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public FlushJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public FlushJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlushJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningFlushJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningFlushJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.flush_job"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Refer to the description for the advance_time query parameter. /// /// - [JsonInclude, JsonPropertyName("advance_time")] - public DateTimeOffset? AdvanceTime { get; set; } + public System.DateTimeOffset? AdvanceTime { get; set; } /// /// /// Refer to the description for the calc_interim query parameter. /// /// - [JsonInclude, JsonPropertyName("calc_interim")] public bool? CalcInterim { get; set; } /// @@ -82,24 +171,21 @@ public FlushJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } + public System.DateTimeOffset? End { get; set; } /// /// /// Refer to the description for the skip_time query parameter. /// /// - [JsonInclude, JsonPropertyName("skip_time")] - public DateTimeOffset? SkipTime { get; set; } + public System.DateTimeOffset? SkipTime { get; set; } /// /// /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } } /// @@ -115,43 +201,50 @@ public FlushJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// analyzing further data. /// /// -public sealed partial class FlushJobRequestDescriptor : RequestDescriptor +public readonly partial struct FlushJobRequestDescriptor { - internal FlushJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest Instance { get; init; } - public FlushJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningFlushJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public FlushJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public FlushJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.flush_job"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor descriptor) => descriptor.Instance; - public FlushJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private DateTimeOffset? AdvanceTimeValue { get; set; } - private bool? CalcInterimValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private DateTimeOffset? SkipTimeValue { get; set; } - private DateTimeOffset? StartValue { get; set; } - /// /// /// Refer to the description for the advance_time query parameter. /// /// - public FlushJobRequestDescriptor AdvanceTime(DateTimeOffset? advanceTime) + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor AdvanceTime(System.DateTimeOffset? value) { - AdvanceTimeValue = advanceTime; - return Self; + Instance.AdvanceTime = value; + return this; } /// @@ -159,10 +252,10 @@ public FlushJobRequestDescriptor AdvanceTime(DateTimeOffset? advanceTime) /// Refer to the description for the calc_interim query parameter. /// /// - public FlushJobRequestDescriptor CalcInterim(bool? calcInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor CalcInterim(bool? value = true) { - CalcInterimValue = calcInterim; - return Self; + Instance.CalcInterim = value; + return this; } /// @@ -170,10 +263,10 @@ public FlushJobRequestDescriptor CalcInterim(bool? calcInterim = true) /// Refer to the description for the end query parameter. /// /// - public FlushJobRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -181,10 +274,10 @@ public FlushJobRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the skip_time query parameter. /// /// - public FlushJobRequestDescriptor SkipTime(DateTimeOffset? skipTime) + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor SkipTime(System.DateTimeOffset? value) { - SkipTimeValue = skipTime; - return Self; + Instance.SkipTime = value; + return this; } /// @@ -192,45 +285,59 @@ public FlushJobRequestDescriptor SkipTime(DateTimeOffset? skipTime) /// Refer to the description for the start query parameter. /// /// - public FlushJobRequestDescriptor Start(DateTimeOffset? start) + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor Start(System.DateTimeOffset? value) { - StartValue = start; - return Self; + Instance.Start = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AdvanceTimeValue is not null) - { - writer.WritePropertyName("advance_time"); - JsonSerializer.Serialize(writer, AdvanceTimeValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (CalcInterimValue.HasValue) - { - writer.WritePropertyName("calc_interim"); - writer.WriteBooleanValue(CalcInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SkipTimeValue is not null) - { - writer.WritePropertyName("skip_time"); - JsonSerializer.Serialize(writer, SkipTimeValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobResponse.g.cs index ad4776b1c49..24655c04dcf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/FlushJobResponse.g.cs @@ -17,19 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class FlushJobResponse : ElasticsearchResponse +internal sealed partial class FlushJobResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFlushed = System.Text.Json.JsonEncodedText.Encode("flushed"); + private static readonly System.Text.Json.JsonEncodedText PropLastFinalizedBucketEnd = System.Text.Json.JsonEncodedText.Encode("last_finalized_bucket_end"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFlushed = default; + LocalJsonValue propLastFinalizedBucketEnd = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFlushed.TryReadProperty(ref reader, options, PropFlushed, null)) + { + continue; + } + + if (propLastFinalizedBucketEnd.TryReadProperty(ref reader, options, PropLastFinalizedBucketEnd, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Flushed = propFlushed.Value, + LastFinalizedBucketEnd = propLastFinalizedBucketEnd.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFlushed, value.Flushed, null, null); + writer.WriteProperty(options, PropLastFinalizedBucketEnd, value.LastFinalizedBucketEnd, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponseConverter))] +public sealed partial class FlushJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("flushed")] - public bool Flushed { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlushJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Flushed { get; set; } /// /// @@ -37,6 +97,5 @@ public sealed partial class FlushJobResponse : ElasticsearchResponse /// the last bucket that was processed. /// /// - [JsonInclude, JsonPropertyName("last_finalized_bucket_end")] - public int? LastFinalizedBucketEnd { get; init; } + public int? LastFinalizedBucketEnd { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastRequest.g.cs index bfbd4285a3c..04215b6c07c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ForecastRequestParameters : RequestParameters +public sealed partial class ForecastRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ForecastRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDuration = System.Text.Json.JsonEncodedText.Encode("duration"); + private static readonly System.Text.Json.JsonEncodedText PropExpiresIn = System.Text.Json.JsonEncodedText.Encode("expires_in"); + private static readonly System.Text.Json.JsonEncodedText PropMaxModelMemory = System.Text.Json.JsonEncodedText.Encode("max_model_memory"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDuration = default; + LocalJsonValue propExpiresIn = default; + LocalJsonValue propMaxModelMemory = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDuration.TryReadProperty(ref reader, options, PropDuration, null)) + { + continue; + } + + if (propExpiresIn.TryReadProperty(ref reader, options, PropExpiresIn, null)) + { + continue; + } + + if (propMaxModelMemory.TryReadProperty(ref reader, options, PropMaxModelMemory, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Duration = propDuration.Value, + ExpiresIn = propExpiresIn.Value, + MaxModelMemory = propMaxModelMemory.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDuration, value.Duration, null, null); + writer.WriteProperty(options, PropExpiresIn, value.ExpiresIn, null, null); + writer.WriteProperty(options, PropMaxModelMemory, value.MaxModelMemory, null, null); + writer.WriteEndObject(); + } } /// @@ -45,26 +95,49 @@ public sealed partial class ForecastRequestParameters : RequestParameters /// based on historical data. /// /// -public sealed partial class ForecastRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestConverter))] +public sealed partial class ForecastRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ForecastRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public ForecastRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningForecast; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningForecast; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.forecast"; + /// + /// + /// Identifier for the anomaly detection job. The job must be open when you + /// create a forecast; otherwise, an error occurs. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Refer to the description for the duration query parameter. /// /// - [JsonInclude, JsonPropertyName("duration")] public Elastic.Clients.Elasticsearch.Duration? Duration { get; set; } /// @@ -72,7 +145,6 @@ public ForecastRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// Refer to the description for the expires_in query parameter. /// /// - [JsonInclude, JsonPropertyName("expires_in")] public Elastic.Clients.Elasticsearch.Duration? ExpiresIn { get; set; } /// @@ -80,7 +152,6 @@ public ForecastRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// Refer to the description for the max_model_memory query parameter. /// /// - [JsonInclude, JsonPropertyName("max_model_memory")] public string? MaxModelMemory { get; set; } } @@ -95,41 +166,51 @@ public ForecastRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// based on historical data. /// /// -public sealed partial class ForecastRequestDescriptor : RequestDescriptor +public readonly partial struct ForecastRequestDescriptor { - internal ForecastRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest Instance { get; init; } - public ForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForecastRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningForecast; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ForecastRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ForecastRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.forecast"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor descriptor) => descriptor.Instance; - public ForecastRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. The job must be open when you + /// create a forecast; otherwise, an error occurs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private Elastic.Clients.Elasticsearch.Duration? DurationValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ExpiresInValue { get; set; } - private string? MaxModelMemoryValue { get; set; } - /// /// /// Refer to the description for the duration query parameter. /// /// - public ForecastRequestDescriptor Duration(Elastic.Clients.Elasticsearch.Duration? duration) + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor Duration(Elastic.Clients.Elasticsearch.Duration? value) { - DurationValue = duration; - return Self; + Instance.Duration = value; + return this; } /// @@ -137,10 +218,10 @@ public ForecastRequestDescriptor Duration(Elastic.Clients.Elasticsearch.Duration /// Refer to the description for the expires_in query parameter. /// /// - public ForecastRequestDescriptor ExpiresIn(Elastic.Clients.Elasticsearch.Duration? expiresIn) + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor ExpiresIn(Elastic.Clients.Elasticsearch.Duration? value) { - ExpiresInValue = expiresIn; - return Self; + Instance.ExpiresIn = value; + return this; } /// @@ -148,33 +229,59 @@ public ForecastRequestDescriptor ExpiresIn(Elastic.Clients.Elasticsearch.Duratio /// Refer to the description for the max_model_memory query parameter. /// /// - public ForecastRequestDescriptor MaxModelMemory(string? maxModelMemory) + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor MaxModelMemory(string? value) { - MaxModelMemoryValue = maxModelMemory; - return Self; + Instance.MaxModelMemory = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest Build(System.Action action) { - writer.WriteStartObject(); - if (DurationValue is not null) - { - writer.WritePropertyName("duration"); - JsonSerializer.Serialize(writer, DurationValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ExpiresInValue is not null) - { - writer.WritePropertyName("expires_in"); - JsonSerializer.Serialize(writer, ExpiresInValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(MaxModelMemoryValue)) - { - writer.WritePropertyName("max_model_memory"); - writer.WriteStringValue(MaxModelMemoryValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastResponse.g.cs index 90c4b0f3cb0..88ed045de5e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ForecastResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ForecastResponse : ElasticsearchResponse +internal sealed partial class ForecastResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropForecastId = System.Text.Json.JsonEncodedText.Encode("forecast_id"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propForecastId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propForecastId.TryReadProperty(ref reader, options, PropForecastId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + ForecastId = propForecastId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropForecastId, value.ForecastId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponseConverter))] +public sealed partial class ForecastResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("forecast_id")] - public string ForecastId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForecastResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForecastResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ForecastId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsRequest.g.cs index e24e4432ff7..9874c668109 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetBucketsRequestParameters : RequestParameters +public sealed partial class GetBucketsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,36 +40,169 @@ public sealed partial class GetBucketsRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetBucketsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyScore = System.Text.Json.JsonEncodedText.Encode("anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropDesc = System.Text.Json.JsonEncodedText.Encode("desc"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeInterim = System.Text.Json.JsonEncodedText.Encode("exclude_interim"); + private static readonly System.Text.Json.JsonEncodedText PropExpand = System.Text.Json.JsonEncodedText.Encode("expand"); + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyScore = default; + LocalJsonValue propDesc = default; + LocalJsonValue propEnd = default; + LocalJsonValue propExcludeInterim = default; + LocalJsonValue propExpand = default; + LocalJsonValue propPage = default; + LocalJsonValue propSort = default; + LocalJsonValue propStart = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyScore.TryReadProperty(ref reader, options, PropAnomalyScore, null)) + { + continue; + } + + if (propDesc.TryReadProperty(ref reader, options, PropDesc, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExcludeInterim.TryReadProperty(ref reader, options, PropExcludeInterim, null)) + { + continue; + } + + if (propExpand.TryReadProperty(ref reader, options, PropExpand, null)) + { + continue; + } + + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyScore = propAnomalyScore.Value, + Desc = propDesc.Value, + End = propEnd.Value, + ExcludeInterim = propExcludeInterim.Value, + Expand = propExpand.Value, + Page = propPage.Value, + Sort = propSort.Value, + Start = propStart.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyScore, value.AnomalyScore, null, null); + writer.WriteProperty(options, PropDesc, value.Desc, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExcludeInterim, value.ExcludeInterim, null, null); + writer.WriteProperty(options, PropExpand, value.Expand, null, null); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly detection job results for buckets. /// The API presents a chronological view of the records, grouped by bucket. /// /// -public sealed partial class GetBucketsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestConverter))] +public sealed partial class GetBucketsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp) : base(r => r.Required("job_id", jobId).Optional("timestamp", timestamp)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp) : base(r => r.Required("job_id", jobId).Optional("timestamp", timestamp)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetBucketsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetBuckets; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetBuckets; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_buckets"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// The timestamp of a single bucket result. If you do not specify this + /// parameter, the API returns information about all buckets. + /// + /// + public System.DateTimeOffset? Timestamp { get => P("timestamp"); set => PO("timestamp", value); } + /// /// /// Skips the specified number of buckets. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -84,7 +210,6 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Specifies the maximum number of buckets to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -92,7 +217,6 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the anomaly_score query parameter. /// /// - [JsonInclude, JsonPropertyName("anomaly_score")] public double? AnomalyScore { get; set; } /// @@ -100,7 +224,6 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the desc query parameter. /// /// - [JsonInclude, JsonPropertyName("desc")] public bool? Desc { get; set; } /// @@ -108,15 +231,13 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } + public System.DateTimeOffset? End { get; set; } /// /// /// Refer to the description for the exclude_interim query parameter. /// /// - [JsonInclude, JsonPropertyName("exclude_interim")] public bool? ExcludeInterim { get; set; } /// @@ -124,9 +245,7 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the expand query parameter. /// /// - [JsonInclude, JsonPropertyName("expand")] public bool? Expand { get; set; } - [JsonInclude, JsonPropertyName("page")] public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } /// @@ -134,7 +253,6 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the desription for the sort query parameter. /// /// - [JsonInclude, JsonPropertyName("sort")] public Elastic.Clients.Elasticsearch.Field? Sort { get; set; } /// @@ -142,8 +260,7 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } } /// @@ -152,61 +269,89 @@ public GetBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// The API presents a chronological view of the records, grouped by bucket. /// /// -public sealed partial class GetBucketsRequestDescriptor : RequestDescriptor, GetBucketsRequestParameters> +public readonly partial struct GetBucketsRequestDescriptor { - internal GetBucketsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest Instance { get; init; } - public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp) : base(r => r.Required("job_id", jobId).Optional("timestamp", timestamp)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest instance) { + Instance = instance; } - public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(jobId, timestamp); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetBuckets; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetBucketsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_buckets"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor descriptor) => descriptor.Instance; - public GetBucketsRequestDescriptor From(int? from) => Qs("from", from); - public GetBucketsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// The timestamp of a single bucket result. If you do not specify this + /// parameter, the API returns information about all buckets. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Timestamp(System.DateTimeOffset? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.Timestamp = value; + return this; } - public GetBucketsRequestDescriptor Timestamp(DateTimeOffset? timestamp) + /// + /// + /// Skips the specified number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor From(int? value) { - RouteValues.Optional("timestamp", timestamp); - return Self; + Instance.From = value; + return this; } - private double? AnomalyScoreValue { get; set; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private bool? ExcludeInterimValue { get; set; } - private bool? ExpandValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of buckets to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the anomaly_score query parameter. /// /// - public GetBucketsRequestDescriptor AnomalyScore(double? anomalyScore) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor AnomalyScore(double? value) { - AnomalyScoreValue = anomalyScore; - return Self; + Instance.AnomalyScore = value; + return this; } /// @@ -214,10 +359,10 @@ public GetBucketsRequestDescriptor AnomalyScore(double? anomalyScore) /// Refer to the description for the desc query parameter. /// /// - public GetBucketsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -225,10 +370,10 @@ public GetBucketsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetBucketsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -236,10 +381,10 @@ public GetBucketsRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the exclude_interim query parameter. /// /// - public GetBucketsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor ExcludeInterim(bool? value = true) { - ExcludeInterimValue = excludeInterim; - return Self; + Instance.ExcludeInterim = value; + return this; } /// @@ -247,34 +392,28 @@ public GetBucketsRequestDescriptor ExcludeInterim(bool? excludeInteri /// Refer to the description for the expand query parameter. /// /// - public GetBucketsRequestDescriptor Expand(bool? expand = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Expand(bool? value = true) { - ExpandValue = expand; - return Self; + Instance.Expand = value; + return this; } - public GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetBucketsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -282,10 +421,10 @@ public GetBucketsRequestDescriptor Page(Actionsort query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -293,96 +432,71 @@ public GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch /// Refer to the desription for the sort query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the desription for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetBucketsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest Build(System.Action action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (AnomalyScoreValue.HasValue) - { - writer.WritePropertyName("anomaly_score"); - writer.WriteNumberValue(AnomalyScoreValue.Value); - } - - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } - - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (ExcludeInterimValue.HasValue) - { - writer.WritePropertyName("exclude_interim"); - writer.WriteBooleanValue(ExcludeInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ExpandValue.HasValue) - { - writer.WritePropertyName("expand"); - writer.WriteBooleanValue(ExpandValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -392,61 +506,89 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The API presents a chronological view of the records, grouped by bucket. /// /// -public sealed partial class GetBucketsRequestDescriptor : RequestDescriptor +public readonly partial struct GetBucketsRequestDescriptor { - internal GetBucketsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest Instance { get; init; } - public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp) : base(r => r.Required("job_id", jobId).Optional("timestamp", timestamp)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest instance) { + Instance = instance; } - public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(jobId, timestamp); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetBuckets; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetBucketsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_buckets"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor descriptor) => descriptor.Instance; - public GetBucketsRequestDescriptor From(int? from) => Qs("from", from); - public GetBucketsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// The timestamp of a single bucket result. If you do not specify this + /// parameter, the API returns information about all buckets. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Timestamp(System.DateTimeOffset? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.Timestamp = value; + return this; } - public GetBucketsRequestDescriptor Timestamp(DateTimeOffset? timestamp) + /// + /// + /// Skips the specified number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor From(int? value) { - RouteValues.Optional("timestamp", timestamp); - return Self; + Instance.From = value; + return this; } - private double? AnomalyScoreValue { get; set; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private bool? ExcludeInterimValue { get; set; } - private bool? ExpandValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of buckets to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the anomaly_score query parameter. /// /// - public GetBucketsRequestDescriptor AnomalyScore(double? anomalyScore) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor AnomalyScore(double? value) { - AnomalyScoreValue = anomalyScore; - return Self; + Instance.AnomalyScore = value; + return this; } /// @@ -454,10 +596,10 @@ public GetBucketsRequestDescriptor AnomalyScore(double? anomalyScore) /// Refer to the description for the desc query parameter. /// /// - public GetBucketsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -465,10 +607,10 @@ public GetBucketsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetBucketsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -476,10 +618,10 @@ public GetBucketsRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the exclude_interim query parameter. /// /// - public GetBucketsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor ExcludeInterim(bool? value = true) { - ExcludeInterimValue = excludeInterim; - return Self; + Instance.ExcludeInterim = value; + return this; } /// @@ -487,34 +629,28 @@ public GetBucketsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) /// Refer to the description for the expand query parameter. /// /// - public GetBucketsRequestDescriptor Expand(bool? expand = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Expand(bool? value = true) { - ExpandValue = expand; - return Self; + Instance.Expand = value; + return this; } - public GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetBucketsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetBucketsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -522,10 +658,10 @@ public GetBucketsRequestDescriptor Page(Actionsort query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -533,95 +669,70 @@ public GetBucketsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sor /// Refer to the desription for the sort query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the desription for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetBucketsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetBucketsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest Build(System.Action> action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (AnomalyScoreValue.HasValue) - { - writer.WritePropertyName("anomaly_score"); - writer.WriteNumberValue(AnomalyScoreValue.Value); - } - - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } - - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (ExcludeInterimValue.HasValue) - { - writer.WritePropertyName("exclude_interim"); - writer.WriteBooleanValue(ExcludeInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ExpandValue.HasValue) - { - writer.WritePropertyName("expand"); - writer.WriteBooleanValue(ExpandValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsResponse.g.cs index a4c60815b86..f8d2b8d63e1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetBucketsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetBucketsResponse : ElasticsearchResponse +internal sealed partial class GetBucketsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponseConverter))] +public sealed partial class GetBucketsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBucketsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBucketsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsRequest.g.cs index 66a32155f0d..45115aff81f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsRequest.g.cs @@ -17,27 +17,20 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCalendarEventsRequestParameters : RequestParameters +public sealed partial class GetCalendarEventsRequestParameters : Elastic.Transport.RequestParameters { /// /// /// Specifies to get events with timestamps earlier than this time. /// /// - public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + public System.DateTimeOffset? End { get => Q("end"); set => Q("end", value); } /// /// @@ -65,7 +58,36 @@ public sealed partial class GetCalendarEventsRequestParameters : RequestParamete /// Specifies to get events with timestamps after this time. /// /// - public DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } + public System.DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } +} + +internal sealed partial class GetCalendarEventsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -73,34 +95,55 @@ public sealed partial class GetCalendarEventsRequestParameters : RequestParamete /// Get info about events in calendars. /// /// -public sealed partial class GetCalendarEventsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestConverter))] +public sealed partial class GetCalendarEventsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) { } +#if NET7_0_OR_GREATER + public GetCalendarEventsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCalendarEvents; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetCalendarEvents; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_calendar_events"; + /// + /// + /// A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + /// /// /// Specifies to get events with timestamps earlier than this time. /// /// - [JsonIgnore] - public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + public System.DateTimeOffset? End { get => Q("end"); set => Q("end", value); } /// /// /// Skips the specified number of events. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -108,7 +151,6 @@ public GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : b /// Specifies to get events for a specific anomaly detection job identifier or job group. It must be used with a calendar identifier of _all or *. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Id? JobId { get => Q("job_id"); set => Q("job_id", value); } /// @@ -116,7 +158,6 @@ public GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : b /// Specifies the maximum number of events to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -124,8 +165,7 @@ public GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : b /// Specifies to get events with timestamps after this time. /// /// - [JsonIgnore] - public DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } + public System.DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } } /// @@ -133,35 +173,143 @@ public GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : b /// Get info about events in calendars. /// /// -public sealed partial class GetCalendarEventsRequestDescriptor : RequestDescriptor +public readonly partial struct GetCalendarEventsRequestDescriptor { - internal GetCalendarEventsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest Instance { get; init; } - public GetCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCalendarEvents; + public GetCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest(calendarId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetCalendarEventsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.get_calendar_events"; + /// + /// + /// A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } + + /// + /// + /// Specifies to get events with timestamps earlier than this time. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor End(System.DateTimeOffset? value) + { + Instance.End = value; + return this; + } + + /// + /// + /// Skips the specified number of events. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Specifies to get events for a specific anomaly detection job identifier or job group. It must be used with a calendar identifier of _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.JobId = value; + return this; + } - public GetCalendarEventsRequestDescriptor End(DateTimeOffset? end) => Qs("end", end); - public GetCalendarEventsRequestDescriptor From(int? from) => Qs("from", from); - public GetCalendarEventsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) => Qs("job_id", jobId); - public GetCalendarEventsRequestDescriptor Size(int? size) => Qs("size", size); - public GetCalendarEventsRequestDescriptor Start(DateTimeOffset? start) => Qs("start", start); + /// + /// + /// Specifies the maximum number of events to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Specifies to get events with timestamps after this time. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor Start(System.DateTimeOffset? value) + { + Instance.Start = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetCalendarEventsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsResponse.g.cs index a8e698977df..e828dad73f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarEventsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCalendarEventsResponse : ElasticsearchResponse +internal sealed partial class GetCalendarEventsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropEvents = System.Text.Json.JsonEncodedText.Encode("events"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propEvents = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propEvents.TryReadProperty(ref reader, options, PropEvents, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Events = propEvents.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropEvents, value.Events, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponseConverter))] +public sealed partial class GetCalendarEventsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("events")] - public IReadOnlyCollection Events { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCalendarEventsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCalendarEventsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Events { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsRequest.g.cs index a0ddc443b1e..4297d82e8e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCalendarsRequestParameters : RequestParameters +public sealed partial class GetCalendarsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,35 +40,92 @@ public sealed partial class GetCalendarsRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetCalendarsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Page = propPage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get calendar configuration info. /// /// -public sealed partial class GetCalendarsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestConverter))] +public sealed partial class GetCalendarsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetCalendarsRequest(Elastic.Clients.Elasticsearch.Id? calendarId) : base(r => r.Optional("calendar_id", calendarId)) + { + } +#if NET7_0_OR_GREATER public GetCalendarsRequest() { } - - public GetCalendarsRequest(Elastic.Clients.Elasticsearch.Id? calendarId) : base(r => r.Optional("calendar_id", calendarId)) +#endif +#if !NET7_0_OR_GREATER + public GetCalendarsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCalendarsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCalendars; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetCalendars; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_calendars"; + /// + /// + /// A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.Id? CalendarId { get => P("calendar_id"); set => PO("calendar_id", value); } + /// /// /// Skips the specified number of calendars. This parameter is supported only when you omit the calendar identifier. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -83,7 +133,6 @@ public GetCalendarsRequest(Elastic.Clients.Elasticsearch.Id? calendarId) : base( /// Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -91,7 +140,6 @@ public GetCalendarsRequest(Elastic.Clients.Elasticsearch.Id? calendarId) : base( /// This object is supported only when you omit the calendar identifier. /// /// - [JsonInclude, JsonPropertyName("page")] public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } } @@ -100,87 +148,147 @@ public GetCalendarsRequest(Elastic.Clients.Elasticsearch.Id? calendarId) : base( /// Get calendar configuration info. /// /// -public sealed partial class GetCalendarsRequestDescriptor : RequestDescriptor +public readonly partial struct GetCalendarsRequestDescriptor { - internal GetCalendarsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest Instance { get; init; } - public GetCalendarsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? calendarId) : base(r => r.Optional("calendar_id", calendarId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCalendarsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest instance) { + Instance = instance; } - public GetCalendarsRequestDescriptor() + public GetCalendarsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? calendarId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(calendarId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCalendars; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public GetCalendarsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.get_calendars"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor descriptor) => descriptor.Instance; - public GetCalendarsRequestDescriptor From(int? from) => Qs("from", from); - public GetCalendarsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.CalendarId = value; + return this; + } - public GetCalendarsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id? calendarId) + /// + /// + /// Skips the specified number of calendars. This parameter is supported only when you omit the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor From(int? value) { - RouteValues.Optional("calendar_id", calendarId); - return Self; + Instance.From = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } + /// + /// + /// Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// This object is supported only when you omit the calendar identifier. /// /// - public GetCalendarsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetCalendarsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + /// + /// + /// This object is supported only when you omit the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetCalendarsRequestDescriptor Page(Action configure) + /// + /// + /// This object is supported only when you omit the calendar identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (PageDescriptor is not null) + if (action is null) { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsResponse.g.cs index 4b098d1cd30..6009d887521 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCalendarsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCalendarsResponse : ElasticsearchResponse +internal sealed partial class GetCalendarsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendars = System.Text.Json.JsonEncodedText.Encode("calendars"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCalendars = default; + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendars.TryReadProperty(ref reader, options, PropCalendars, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Calendars = propCalendars.Value, + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendars, value.Calendars, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponseConverter))] +public sealed partial class GetCalendarsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("calendars")] - public IReadOnlyCollection Calendars { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCalendarsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCalendarsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Calendars { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesRequest.g.cs index 00006ea2873..dfdaa8fe6b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCategoriesRequestParameters : RequestParameters +public sealed partial class GetCategoriesRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -54,35 +47,108 @@ public sealed partial class GetCategoriesRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetCategoriesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Page = propPage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly detection job results for categories. /// /// -public sealed partial class GetCategoriesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestConverter))] +public sealed partial class GetCategoriesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId) : base(r => r.Required("job_id", jobId).Optional("category_id", categoryId)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetCategoriesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCategoriesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCategories; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetCategories; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_categories"; + /// + /// + /// Identifier for the category, which is unique in the job. If you specify + /// neither the category ID nor the partition_field_value, the API returns + /// information about all categories. If you specify only the + /// partition_field_value, it returns information about all categories for + /// the specified partition. + /// + /// + public string? CategoryId { get => P("category_id"); set => PO("category_id", value); } + + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Skips the specified number of categories. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -90,7 +156,6 @@ public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// Only return categories for the specified partition. /// /// - [JsonIgnore] public string? PartitionFieldValue { get => Q("partition_field_value"); set => Q("partition_field_value", value); } /// @@ -98,7 +163,6 @@ public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// Specifies the maximum number of categories to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -107,7 +171,6 @@ public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// This parameter has the from and size properties. /// /// - [JsonInclude, JsonPropertyName("page")] public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } } @@ -116,45 +179,117 @@ public GetCategoriesRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// Get anomaly detection job results for categories. /// /// -public sealed partial class GetCategoriesRequestDescriptor : RequestDescriptor +public readonly partial struct GetCategoriesRequestDescriptor { - internal GetCategoriesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest Instance { get; init; } - public GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId) : base(r => r.Required("job_id", jobId).Optional("category_id", categoryId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest instance) { + Instance = instance; } - public GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest(jobId, categoryId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetCategories; + public GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest(jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetCategoriesRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.get_categories"; + /// + /// + /// Identifier for the category, which is unique in the job. If you specify + /// neither the category ID nor the partition_field_value, the API returns + /// information about all categories. If you specify only the + /// partition_field_value, it returns information about all categories for + /// the specified partition. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor CategoryId(string? value) + { + Instance.CategoryId = value; + return this; + } + + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// Skips the specified number of categories. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - public GetCategoriesRequestDescriptor From(int? from) => Qs("from", from); - public GetCategoriesRequestDescriptor PartitionFieldValue(string? partitionFieldValue) => Qs("partition_field_value", partitionFieldValue); - public GetCategoriesRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Only return categories for the specified partition. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor PartitionFieldValue(string? value) + { + Instance.PartitionFieldValue = value; + return this; + } - public GetCategoriesRequestDescriptor CategoryId(string? categoryId) + /// + /// + /// Specifies the maximum number of categories to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Size(int? value) { - RouteValues.Optional("category_id", categoryId); - return Self; + Instance.Size = value; + return this; } - public GetCategoriesRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.Page = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Page() + { + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; + } /// /// @@ -162,49 +297,59 @@ public GetCategoriesRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id job /// This parameter has the from and size properties. /// /// - public GetCategoriesRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Page(System.Action? action) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } - public GetCategoriesRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest Build(System.Action action) { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public GetCategoriesRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor ErrorTrace(bool? value) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesResponse.g.cs index 0a9fef54aeb..1b92bc55fc0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetCategoriesResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetCategoriesResponse : ElasticsearchResponse +internal sealed partial class GetCategoriesResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCategories = System.Text.Json.JsonEncodedText.Encode("categories"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCategories = default; + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCategories.TryReadProperty(ref reader, options, PropCategories, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Categories = propCategories.Value, + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCategories, value.Categories, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponseConverter))] +public sealed partial class GetCategoriesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("categories")] - public IReadOnlyCollection Categories { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCategoriesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetCategoriesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Categories { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsRequest.g.cs index 0019cb46116..1e6101eb5a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class GetDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -87,6 +80,35 @@ public sealed partial class GetDataFrameAnalyticsRequestParameters : RequestPara public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get data frame analytics job configuration info. @@ -95,24 +117,45 @@ public sealed partial class GetDataFrameAnalyticsRequestParameters : RequestPara /// wildcard expression. /// /// -public sealed partial class GetDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestConverter))] +public sealed partial class GetDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetDataFrameAnalyticsRequest() { } - - public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. If you do not specify this + /// option, the API returns information for the first hundred data frame + /// analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// Specifies what to do when the request: @@ -142,7 +185,6 @@ public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base /// there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -152,7 +194,6 @@ public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base /// be retrieved and then added to another cluster. /// /// - [JsonIgnore] public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } /// @@ -160,7 +201,6 @@ public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base /// Skips the specified number of data frame analytics jobs. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -168,7 +208,6 @@ public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base /// Specifies the maximum number of data frame analytics jobs to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -180,82 +219,164 @@ public GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base /// wildcard expression. /// /// -public sealed partial class GetDataFrameAnalyticsRequestDescriptor : RequestDescriptor, GetDataFrameAnalyticsRequestParameters> +public readonly partial struct GetDataFrameAnalyticsRequestDescriptor { - internal GetDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest Instance { get; init; } - public GetDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest instance) { + Instance = instance; } - public GetDataFrameAnalyticsRequestDescriptor() + public GetDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public GetDataFrameAnalyticsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.get_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public GetDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetDataFrameAnalyticsRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); - public GetDataFrameAnalyticsRequestDescriptor From(int? from) => Qs("from", from); - public GetDataFrameAnalyticsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the data frame analytics job. If you do not specify this + /// option, the API returns information for the first hundred data frame + /// analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - public GetDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no data frame analytics + /// jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value returns an empty data_frame_analytics array when there + /// are no matches and the subset of results when there are partial matches. + /// If this parameter is false, the request returns a 404 status code when + /// there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? value = true) { - RouteValues.Optional("id", id); - return Self; + Instance.AllowNoMatch = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Indicates if certain fields should be removed from the configuration on + /// retrieval. This allows the configuration to be in an acceptable format to + /// be retrieved and then added to another cluster. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor ExcludeGenerated(bool? value = true) { + Instance.ExcludeGenerated = value; + return this; } -} -/// -/// -/// Get data frame analytics job configuration info. -/// You can get information for multiple data frame analytics jobs in a single -/// API request by using a comma-separated list of data frame analytics jobs or a -/// wildcard expression. -/// -/// -public sealed partial class GetDataFrameAnalyticsRequestDescriptor : RequestDescriptor -{ - internal GetDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Skips the specified number of data frame analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - public GetDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + /// + /// + /// Specifies the maximum number of data frame analytics jobs to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor Size(int? value) { + Instance.Size = value; + return this; } - public GetDataFrameAnalyticsRequestDescriptor() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalytics; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ml.get_data_frame_analytics"; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetDataFrameAnalyticsRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); - public GetDataFrameAnalyticsRequestDescriptor From(int? from) => Qs("from", from); - public GetDataFrameAnalyticsRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsResponse.g.cs index da8f94fc4cb..b3c73c76dfc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class GetDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrameAnalytics = System.Text.Json.JsonEncodedText.Encode("data_frame_analytics"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDataFrameAnalytics = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDataFrameAnalytics.TryReadProperty(ref reader, options, PropDataFrameAnalytics, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + DataFrameAnalytics = propDataFrameAnalytics.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDataFrameAnalytics, value.DataFrameAnalytics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponseConverter))] +public sealed partial class GetDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// An array of data frame analytics job resources, which are sorted by the id value in ascending order. /// /// - [JsonInclude, JsonPropertyName("data_frame_analytics")] - public IReadOnlyCollection DataFrameAnalytics { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataFrameAnalytics { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsRequest.g.cs index ee5420191c0..cbb432c5a53 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDataFrameAnalyticsStatsRequestParameters : RequestParameters +public sealed partial class GetDataFrameAnalyticsStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -85,29 +78,79 @@ public sealed partial class GetDataFrameAnalyticsStatsRequestParameters : Reques public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } +internal sealed partial class GetDataFrameAnalyticsStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get data frame analytics jobs usage info. /// /// -public sealed partial class GetDataFrameAnalyticsStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestConverter))] +public sealed partial class GetDataFrameAnalyticsStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetDataFrameAnalyticsStatsRequest() { } - - public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetDataFrameAnalyticsStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalyticsStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetDataFrameAnalyticsStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_data_frame_analytics_stats"; + /// + /// + /// Identifier for the data frame analytics job. If you do not specify this + /// option, the API returns information for the first hundred data frame + /// analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// Specifies what to do when the request: @@ -137,7 +180,6 @@ public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -145,7 +187,6 @@ public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// Skips the specified number of data frame analytics jobs. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -153,7 +194,6 @@ public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// Specifies the maximum number of data frame analytics jobs to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -161,7 +201,6 @@ public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// Defines whether the stats response should be verbose. /// /// - [JsonIgnore] public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } @@ -170,79 +209,162 @@ public GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// Get data frame analytics jobs usage info. /// /// -public sealed partial class GetDataFrameAnalyticsStatsRequestDescriptor : RequestDescriptor, GetDataFrameAnalyticsStatsRequestParameters> +public readonly partial struct GetDataFrameAnalyticsStatsRequestDescriptor { - internal GetDataFrameAnalyticsStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest Instance { get; init; } - public GetDataFrameAnalyticsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataFrameAnalyticsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest instance) { + Instance = instance; } - public GetDataFrameAnalyticsStatsRequestDescriptor() + public GetDataFrameAnalyticsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalyticsStats; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public GetDataFrameAnalyticsStatsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.get_data_frame_analytics_stats"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor descriptor) => descriptor.Instance; - public GetDataFrameAnalyticsStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetDataFrameAnalyticsStatsRequestDescriptor From(int? from) => Qs("from", from); - public GetDataFrameAnalyticsStatsRequestDescriptor Size(int? size) => Qs("size", size); - public GetDataFrameAnalyticsStatsRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + /// + /// + /// Identifier for the data frame analytics job. If you do not specify this + /// option, the API returns information for the first hundred data frame + /// analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - public GetDataFrameAnalyticsStatsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no data frame analytics + /// jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value returns an empty data_frame_analytics array when there + /// are no matches and the subset of results when there are partial matches. + /// If this parameter is false, the request returns a 404 status code when + /// there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor AllowNoMatch(bool? value = true) { - RouteValues.Optional("id", id); - return Self; + Instance.AllowNoMatch = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Skips the specified number of data frame analytics jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor From(int? value) { + Instance.From = value; + return this; } -} -/// -/// -/// Get data frame analytics jobs usage info. -/// -/// -public sealed partial class GetDataFrameAnalyticsStatsRequestDescriptor : RequestDescriptor -{ - internal GetDataFrameAnalyticsStatsRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Specifies the maximum number of data frame analytics jobs to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } - public GetDataFrameAnalyticsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + /// + /// + /// Defines whether the stats response should be verbose. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor Verbose(bool? value = true) { + Instance.Verbose = value; + return this; } - public GetDataFrameAnalyticsStatsRequestDescriptor() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDataFrameAnalyticsStats; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ml.get_data_frame_analytics_stats"; + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetDataFrameAnalyticsStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetDataFrameAnalyticsStatsRequestDescriptor From(int? from) => Qs("from", from); - public GetDataFrameAnalyticsStatsRequestDescriptor Size(int? size) => Qs("size", size); - public GetDataFrameAnalyticsStatsRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDataFrameAnalyticsStatsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsResponse.g.cs index fb6b005d405..9084d46d0a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDataFrameAnalyticsStatsResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDataFrameAnalyticsStatsResponse : ElasticsearchResponse +internal sealed partial class GetDataFrameAnalyticsStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrameAnalytics = System.Text.Json.JsonEncodedText.Encode("data_frame_analytics"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDataFrameAnalytics = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDataFrameAnalytics.TryReadProperty(ref reader, options, PropDataFrameAnalytics, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + DataFrameAnalytics = propDataFrameAnalytics.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDataFrameAnalytics, value.DataFrameAnalytics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponseConverter))] +public sealed partial class GetDataFrameAnalyticsStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDataFrameAnalyticsStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDataFrameAnalyticsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// An array of objects that contain usage information for data frame analytics jobs, which are sorted by the id value in ascending order. /// /// - [JsonInclude, JsonPropertyName("data_frame_analytics")] - public IReadOnlyCollection DataFrameAnalytics { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataFrameAnalytics { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsRequest.g.cs index 12d213290c1..df459b2b44c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDatafeedStatsRequestParameters : RequestParameters +public sealed partial class GetDatafeedStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -63,6 +56,35 @@ public sealed partial class GetDatafeedStatsRequestParameters : RequestParameter public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } +internal sealed partial class GetDatafeedStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get datafeeds usage info. @@ -74,24 +96,45 @@ public sealed partial class GetDatafeedStatsRequestParameters : RequestParameter /// This API returns a maximum of 10,000 datafeeds. /// /// -public sealed partial class GetDatafeedStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestConverter))] +public sealed partial class GetDatafeedStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) + { + } +#if NET7_0_OR_GREATER public GetDatafeedStatsRequest() { } - - public GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) +#endif +#if !NET7_0_OR_GREATER + public GetDatafeedStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDatafeedStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetDatafeedStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_datafeed_stats"; + /// + /// + /// Identifier for the datafeed. It can be a datafeed identifier or a + /// wildcard expression. If you do not specify one of these options, the API + /// returns information about all datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? DatafeedId { get => P("datafeed_id"); set => PO("datafeed_id", value); } + /// /// /// Specifies what to do when the request: @@ -120,7 +163,6 @@ public GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : /// 404 status code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } @@ -135,35 +177,128 @@ public GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : /// This API returns a maximum of 10,000 datafeeds. /// /// -public sealed partial class GetDatafeedStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetDatafeedStatsRequestDescriptor { - internal GetDatafeedStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest Instance { get; init; } - public GetDatafeedStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDatafeedStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest instance) { + Instance = instance; + } + + public GetDatafeedStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(datafeedId); } public GetDatafeedStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDatafeedStats; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the datafeed. It can be a datafeed identifier or a + /// wildcard expression. If you do not specify one of these options, the API + /// returns information about all datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.DatafeedId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no datafeeds that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value is true, which returns an empty datafeeds array + /// when there are no matches and the subset of results when there are + /// partial matches. If this parameter is false, the request returns a + /// 404 status code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_datafeed_stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public GetDatafeedStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDatafeedStatsRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Ids? datafeedId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("datafeed_id", datafeedId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsResponse.g.cs index 5b5b708f0f5..edf322328bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedStatsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDatafeedStatsResponse : ElasticsearchResponse +internal sealed partial class GetDatafeedStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeeds = System.Text.Json.JsonEncodedText.Encode("datafeeds"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDatafeeds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDatafeeds.TryReadProperty(ref reader, options, PropDatafeeds, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Datafeeds = propDatafeeds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDatafeeds, value.Datafeeds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponseConverter))] +public sealed partial class GetDatafeedStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("datafeeds")] - public IReadOnlyCollection Datafeeds { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDatafeedStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDatafeedStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Datafeeds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsRequest.g.cs index f4cef19baa3..8b09ed2cec8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDatafeedsRequestParameters : RequestParameters +public sealed partial class GetDatafeedsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -72,6 +65,35 @@ public sealed partial class GetDatafeedsRequestParameters : RequestParameters public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } } +internal sealed partial class GetDatafeedsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get datafeeds configuration info. @@ -82,24 +104,45 @@ public sealed partial class GetDatafeedsRequestParameters : RequestParameters /// This API returns a maximum of 10,000 datafeeds. /// /// -public sealed partial class GetDatafeedsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestConverter))] +public sealed partial class GetDatafeedsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) + { + } +#if NET7_0_OR_GREATER public GetDatafeedsRequest() { } - - public GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) +#endif +#if !NET7_0_OR_GREATER + public GetDatafeedsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDatafeeds; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetDatafeeds; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_datafeeds"; + /// + /// + /// Identifier for the datafeed. It can be a datafeed identifier or a + /// wildcard expression. If you do not specify one of these options, the API + /// returns information about all datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? DatafeedId { get => P("datafeed_id"); set => PO("datafeed_id", value); } + /// /// /// Specifies what to do when the request: @@ -128,7 +171,6 @@ public GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base /// 404 status code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -138,7 +180,6 @@ public GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base /// be retrieved and then added to another cluster. /// /// - [JsonIgnore] public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } } @@ -152,36 +193,141 @@ public GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base /// This API returns a maximum of 10,000 datafeeds. /// /// -public sealed partial class GetDatafeedsRequestDescriptor : RequestDescriptor +public readonly partial struct GetDatafeedsRequestDescriptor { - internal GetDatafeedsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDatafeedsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest instance) + { + Instance = instance; + } - public GetDatafeedsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? datafeedId) : base(r => r.Optional("datafeed_id", datafeedId)) + public GetDatafeedsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? datafeedId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(datafeedId); } public GetDatafeedsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetDatafeeds; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the datafeed. It can be a datafeed identifier or a + /// wildcard expression. If you do not specify one of these options, the API + /// returns information about all datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.DatafeedId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no datafeeds that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value is true, which returns an empty datafeeds array + /// when there are no matches and the subset of results when there are + /// partial matches. If this parameter is false, the request returns a + /// 404 status code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_datafeeds"; + /// + /// + /// Indicates if certain fields should be removed from the configuration on + /// retrieval. This allows the configuration to be in an acceptable format to + /// be retrieved and then added to another cluster. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor ExcludeGenerated(bool? value = true) + { + Instance.ExcludeGenerated = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public GetDatafeedsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetDatafeedsRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetDatafeedsRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Ids? datafeedId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("datafeed_id", datafeedId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsResponse.g.cs index 080ae74ef84..a56284729ba 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetDatafeedsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetDatafeedsResponse : ElasticsearchResponse +internal sealed partial class GetDatafeedsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeeds = System.Text.Json.JsonEncodedText.Encode("datafeeds"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDatafeeds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDatafeeds.TryReadProperty(ref reader, options, PropDatafeeds, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Datafeeds = propDatafeeds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDatafeeds, value.Datafeeds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponseConverter))] +public sealed partial class GetDatafeedsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("datafeeds")] - public IReadOnlyCollection Datafeeds { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetDatafeedsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetDatafeedsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Datafeeds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersRequest.g.cs index 0ae21abfdd6..727ae13df41 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetFiltersRequestParameters : RequestParameters +public sealed partial class GetFiltersRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,36 +40,83 @@ public sealed partial class GetFiltersRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetFiltersRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get filters. /// You can get a single filter or all filters. /// /// -public sealed partial class GetFiltersRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestConverter))] +public sealed partial class GetFiltersRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetFiltersRequest(Elastic.Clients.Elasticsearch.Ids? filterId) : base(r => r.Optional("filter_id", filterId)) + { + } +#if NET7_0_OR_GREATER public GetFiltersRequest() { } - - public GetFiltersRequest(Elastic.Clients.Elasticsearch.Ids? filterId) : base(r => r.Optional("filter_id", filterId)) +#endif +#if !NET7_0_OR_GREATER + public GetFiltersRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFiltersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetFilters; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetFilters; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_filters"; + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? FilterId { get => P("filter_id"); set => PO("filter_id", value); } + /// /// /// Skips the specified number of filters. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -84,7 +124,6 @@ public GetFiltersRequest(Elastic.Clients.Elasticsearch.Ids? filterId) : base(r = /// Specifies the maximum number of filters to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -94,36 +133,114 @@ public GetFiltersRequest(Elastic.Clients.Elasticsearch.Ids? filterId) : base(r = /// You can get a single filter or all filters. /// /// -public sealed partial class GetFiltersRequestDescriptor : RequestDescriptor +public readonly partial struct GetFiltersRequestDescriptor { - internal GetFiltersRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFiltersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest instance) + { + Instance = instance; + } - public GetFiltersRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? filterId) : base(r => r.Optional("filter_id", filterId)) + public GetFiltersRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? filterId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(filterId); } public GetFiltersRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetFilters; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.FilterId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Skips the specified number of filters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - internal override string OperationName => "ml.get_filters"; + /// + /// + /// Specifies the maximum number of filters to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetFiltersRequestDescriptor From(int? from) => Qs("from", from); - public GetFiltersRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetFiltersRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Ids? filterId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("filter_id", filterId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersResponse.g.cs index e7c60c8592c..8351c18f618 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetFiltersResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetFiltersResponse : ElasticsearchResponse +internal sealed partial class GetFiltersResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propFilters = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propFilters.TryReadProperty(ref reader, options, PropFilters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Filters = propFilters.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropFilters, value.Filters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponseConverter))] +public sealed partial class GetFiltersResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("filters")] - public IReadOnlyCollection Filters { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetFiltersResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetFiltersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Filters { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersRequest.g.cs index 5754873d0bd..e92a5f5ae28 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetInfluencersRequestParameters : RequestParameters +public sealed partial class GetInfluencersRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,7 +39,7 @@ public sealed partial class GetInfluencersRequestParameters : RequestParameters /// specific timestamps. /// /// - public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + public System.DateTimeOffset? End { get => Q("end"); set => Q("end", value); } /// /// @@ -92,7 +85,46 @@ public sealed partial class GetInfluencersRequestParameters : RequestParameters /// means it is unset and results are not limited to specific timestamps. /// /// - public DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } + public System.DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } +} + +internal sealed partial class GetInfluencersRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Page = propPage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteEndObject(); + } } /// @@ -103,26 +135,48 @@ public sealed partial class GetInfluencersRequestParameters : RequestParameters /// influencer_field_name is specified in the job configuration. /// /// -public sealed partial class GetInfluencersRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestConverter))] +public sealed partial class GetInfluencersRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetInfluencersRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetInfluencersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetInfluencers; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetInfluencers; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_influencers"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// If true, the results are sorted in descending order. /// /// - [JsonIgnore] public bool? Desc { get => Q("desc"); set => Q("desc", value); } /// @@ -132,8 +186,7 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// specific timestamps. /// /// - [JsonIgnore] - public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + public System.DateTimeOffset? End { get => Q("end"); set => Q("end", value); } /// /// @@ -141,7 +194,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// are included. /// /// - [JsonIgnore] public bool? ExcludeInterim { get => Q("exclude_interim"); set => Q("exclude_interim", value); } /// @@ -149,7 +201,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// Skips the specified number of influencers. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -158,7 +209,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// value. /// /// - [JsonIgnore] public double? InfluencerScore { get => Q("influencer_score"); set => Q("influencer_score", value); } /// @@ -166,7 +216,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// Specifies the maximum number of influencers to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -175,7 +224,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// influencers are sorted by the influencer_score value. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Field? Sort { get => Q("sort"); set => Q("sort", value); } /// @@ -184,8 +232,7 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// means it is unset and results are not limited to specific timestamps. /// /// - [JsonIgnore] - public DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } + public System.DateTimeOffset? Start { get => Q("start"); set => Q("start", value); } /// /// @@ -193,7 +240,6 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// This parameter has the from and size properties. /// /// - [JsonInclude, JsonPropertyName("page")] public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } } @@ -205,40 +251,170 @@ public GetInfluencersRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => /// influencer_field_name is specified in the job configuration. /// /// -public sealed partial class GetInfluencersRequestDescriptor : RequestDescriptor, GetInfluencersRequestParameters> +public readonly partial struct GetInfluencersRequestDescriptor { - internal GetInfluencersRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest Instance { get; init; } - public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetInfluencers; + public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetInfluencersRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.get_influencers"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetInfluencersRequestDescriptor Desc(bool? desc = true) => Qs("desc", desc); - public GetInfluencersRequestDescriptor End(DateTimeOffset? end) => Qs("end", end); - public GetInfluencersRequestDescriptor ExcludeInterim(bool? excludeInterim = true) => Qs("exclude_interim", excludeInterim); - public GetInfluencersRequestDescriptor From(int? from) => Qs("from", from); - public GetInfluencersRequestDescriptor InfluencerScore(double? influencerScore) => Qs("influencer_score", influencerScore); - public GetInfluencersRequestDescriptor Size(int? size) => Qs("size", size); - public GetInfluencersRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) => Qs("sort", sort); - public GetInfluencersRequestDescriptor Start(DateTimeOffset? start) => Qs("start", start); + /// + /// + /// If true, the results are sorted in descending order. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Desc(bool? value = true) + { + Instance.Desc = value; + return this; + } - public GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Returns influencers with timestamps earlier than this time. + /// The default value means it is unset and results are not limited to + /// specific timestamps. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor End(System.DateTimeOffset? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.End = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } + /// + /// + /// If true, the output excludes interim results. By default, interim results + /// are included. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor ExcludeInterim(bool? value = true) + { + Instance.ExcludeInterim = value; + return this; + } + + /// + /// + /// Skips the specified number of influencers. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Returns influencers with anomaly scores greater than or equal to this + /// value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor InfluencerScore(double? value) + { + Instance.InfluencerScore = value; + return this; + } + + /// + /// + /// Specifies the maximum number of influencers to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Specifies the sort field for the requested influencers. By default, the + /// influencers are sorted by the influencer_score value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Specifies the sort field for the requested influencers. By default, the + /// influencers are sorted by the influencer_score value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Sort(System.Linq.Expressions.Expression> value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Returns influencers with timestamps after this time. The default value + /// means it is unset and results are not limited to specific timestamps. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Start(System.DateTimeOffset? value) + { + Instance.Start = value; + return this; + } + + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) + { + Instance.Page = value; + return this; + } + + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page() + { + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; + } /// /// @@ -246,50 +422,60 @@ public GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elastics /// This parameter has the from and size properties. /// /// - public GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page(System.Action? action) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } - public GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest Build(System.Action action) { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public GetInfluencersRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor ErrorTrace(bool? value) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -301,40 +487,146 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// influencer_field_name is specified in the job configuration. /// /// -public sealed partial class GetInfluencersRequestDescriptor : RequestDescriptor +public readonly partial struct GetInfluencersRequestDescriptor { - internal GetInfluencersRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest Instance { get; init; } - public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetInfluencers; + public GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetInfluencersRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.get_influencers"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// If true, the results are sorted in descending order. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Desc(bool? value = true) + { + Instance.Desc = value; + return this; + } + + /// + /// + /// Returns influencers with timestamps earlier than this time. + /// The default value means it is unset and results are not limited to + /// specific timestamps. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor End(System.DateTimeOffset? value) + { + Instance.End = value; + return this; + } - public GetInfluencersRequestDescriptor Desc(bool? desc = true) => Qs("desc", desc); - public GetInfluencersRequestDescriptor End(DateTimeOffset? end) => Qs("end", end); - public GetInfluencersRequestDescriptor ExcludeInterim(bool? excludeInterim = true) => Qs("exclude_interim", excludeInterim); - public GetInfluencersRequestDescriptor From(int? from) => Qs("from", from); - public GetInfluencersRequestDescriptor InfluencerScore(double? influencerScore) => Qs("influencer_score", influencerScore); - public GetInfluencersRequestDescriptor Size(int? size) => Qs("size", size); - public GetInfluencersRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) => Qs("sort", sort); - public GetInfluencersRequestDescriptor Start(DateTimeOffset? start) => Qs("start", start); + /// + /// + /// If true, the output excludes interim results. By default, interim results + /// are included. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor ExcludeInterim(bool? value = true) + { + Instance.ExcludeInterim = value; + return this; + } - public GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Skips the specified number of influencers. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor From(int? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.From = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } + /// + /// + /// Returns influencers with anomaly scores greater than or equal to this + /// value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor InfluencerScore(double? value) + { + Instance.InfluencerScore = value; + return this; + } + + /// + /// + /// Specifies the maximum number of influencers to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Specifies the sort field for the requested influencers. By default, the + /// influencers are sorted by the influencer_score value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Specifies the sort field for the requested influencers. By default, the + /// influencers are sorted by the influencer_score value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Sort(System.Linq.Expressions.Expression> value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Returns influencers with timestamps after this time. The default value + /// means it is unset and results are not limited to specific timestamps. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Start(System.DateTimeOffset? value) + { + Instance.Start = value; + return this; + } /// /// @@ -342,49 +634,83 @@ public GetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jo /// This parameter has the from and size properties. /// /// - public GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetInfluencersRequestDescriptor Page(Action configure) + /// + /// + /// Configures pagination. + /// This parameter has the from and size properties. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersResponse.g.cs index 188949c02d9..6338d6ff72d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetInfluencersResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetInfluencersResponse : ElasticsearchResponse +internal sealed partial class GetInfluencersResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencers = System.Text.Json.JsonEncodedText.Encode("influencers"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propInfluencers = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propInfluencers.TryReadProperty(ref reader, options, PropInfluencers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Influencers = propInfluencers.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropInfluencers, value.Influencers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponseConverter))] +public sealed partial class GetInfluencersResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInfluencersResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetInfluencersResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// Array of influencer objects /// /// - [JsonInclude, JsonPropertyName("influencers")] - public IReadOnlyCollection Influencers { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Influencers { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsRequest.g.cs index bea2d642d87..020c43aa374 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetJobStatsRequestParameters : RequestParameters +public sealed partial class GetJobStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -63,29 +56,80 @@ public sealed partial class GetJobStatsRequestParameters : RequestParameters public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } +internal sealed partial class GetJobStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly detection jobs usage info. /// /// -public sealed partial class GetJobStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestConverter))] +public sealed partial class GetJobStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetJobStatsRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) + { + } +#if NET7_0_OR_GREATER public GetJobStatsRequest() { } - - public GetJobStatsRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) +#endif +#if !NET7_0_OR_GREATER + public GetJobStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetJobStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetJobStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_job_stats"; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, a comma-separated list of jobs, or a wildcard expression. If + /// you do not specify one of these options, the API returns information for + /// all anomaly detection jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Id? JobId { get => P("job_id"); set => PO("job_id", value); } + /// /// /// Specifies what to do when the request: @@ -114,7 +158,6 @@ public GetJobStatsRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r /// code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } @@ -123,35 +166,129 @@ public GetJobStatsRequest(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r /// Get anomaly detection jobs usage info. /// /// -public sealed partial class GetJobStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetJobStatsRequestDescriptor { - internal GetJobStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest Instance { get; init; } - public GetJobStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? jobId) : base(r => r.Optional("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest instance) { + Instance = instance; + } + + public GetJobStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(jobId); } public GetJobStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetJobStats; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, a comma-separated list of jobs, or a wildcard expression. If + /// you do not specify one of these options, the API returns information for + /// all anomaly detection jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.JobId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// If true, the API returns an empty jobs array when + /// there are no matches and the subset of results when there are partial + /// matches. If false, the API returns a 404 status + /// code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_job_stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public GetJobStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetJobStatsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsResponse.g.cs index 190a243cb18..831bcedacfc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobStatsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetJobStatsResponse : ElasticsearchResponse +internal sealed partial class GetJobStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropJobs = System.Text.Json.JsonEncodedText.Encode("jobs"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propJobs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propJobs.TryReadProperty(ref reader, options, PropJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Jobs = propJobs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropJobs, value.Jobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponseConverter))] +public sealed partial class GetJobStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("jobs")] - public IReadOnlyCollection Jobs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Jobs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsRequest.g.cs index 6d95ea6c52f..585992ebe54 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetJobsRequestParameters : RequestParameters +public sealed partial class GetJobsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -72,6 +65,35 @@ public sealed partial class GetJobsRequestParameters : RequestParameters public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } } +internal sealed partial class GetJobsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly detection jobs configuration info. @@ -81,24 +103,45 @@ public sealed partial class GetJobsRequestParameters : RequestParameters /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. /// /// -public sealed partial class GetJobsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestConverter))] +public sealed partial class GetJobsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetJobsRequest(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Optional("job_id", jobId)) + { + } +#if NET7_0_OR_GREATER public GetJobsRequest() { } - - public GetJobsRequest(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Optional("job_id", jobId)) +#endif +#if !NET7_0_OR_GREATER + public GetJobsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetJobs; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetJobs; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_jobs"; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, or a wildcard expression. If you do not specify one of these + /// options, the API returns information for all anomaly detection jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? JobId { get => P("job_id"); set => PO("job_id", value); } + /// /// /// Specifies what to do when the request: @@ -127,7 +170,6 @@ public GetJobsRequest(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Op /// code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -137,7 +179,6 @@ public GetJobsRequest(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Op /// be retrieved and then added to another cluster. /// /// - [JsonIgnore] public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } } @@ -150,36 +191,141 @@ public GetJobsRequest(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Op /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. /// /// -public sealed partial class GetJobsRequestDescriptor : RequestDescriptor +public readonly partial struct GetJobsRequestDescriptor { - internal GetJobsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest instance) + { + Instance = instance; + } - public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? jobId) : base(r => r.Optional("job_id", jobId)) + public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? jobId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(jobId); } public GetJobsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetJobs; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, or a wildcard expression. If you do not specify one of these + /// options, the API returns information for all anomaly detection jobs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.JobId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value is true, which returns an empty jobs array when + /// there are no matches and the subset of results when there are partial + /// matches. If this parameter is false, the request returns a 404 status + /// code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_jobs"; + /// + /// + /// Indicates if certain fields should be removed from the configuration on + /// retrieval. This allows the configuration to be in an acceptable format to + /// be retrieved and then added to another cluster. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor ExcludeGenerated(bool? value = true) + { + Instance.ExcludeGenerated = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public GetJobsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetJobsRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetJobsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsResponse.g.cs index 419693e599b..2c21091d747 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetJobsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetJobsResponse : ElasticsearchResponse +internal sealed partial class GetJobsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropJobs = System.Text.Json.JsonEncodedText.Encode("jobs"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propJobs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propJobs.TryReadProperty(ref reader, options, PropJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Jobs = propJobs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropJobs, value.Jobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponseConverter))] +public sealed partial class GetJobsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("jobs")] - public IReadOnlyCollection Jobs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Jobs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsRequest.g.cs index 7c8a3d1f22d..ef3b9e05933 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetMemoryStatsRequestParameters : RequestParameters +public sealed partial class GetMemoryStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class GetMemoryStatsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetMemoryStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get machine learning memory usage info. @@ -56,31 +78,50 @@ public sealed partial class GetMemoryStatsRequestParameters : RequestParameters /// on each node, both within the JVM heap, and natively, outside of the JVM. /// /// -public sealed partial class GetMemoryStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestConverter))] +public sealed partial class GetMemoryStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Id? nodeId) : base(r => r.Optional("node_id", nodeId)) + { + } +#if NET7_0_OR_GREATER public GetMemoryStatsRequest() { } - - public GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Id? nodeId) : base(r => r.Optional("node_id", nodeId)) +#endif +#if !NET7_0_OR_GREATER + public GetMemoryStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetMemoryStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetMemoryStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_memory_stats"; + /// + /// + /// The names of particular nodes in the cluster to target. For example, nodeId1,nodeId2 or + /// ml:true + /// + /// + public Elastic.Clients.Elasticsearch.Id? NodeId { get => P("node_id"); set => PO("node_id", value); } + /// /// /// Period to wait for a connection to the master node. If no response is received before the timeout /// expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -89,7 +130,6 @@ public GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Id? nodeId) : base(r /// fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -100,36 +140,117 @@ public GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Id? nodeId) : base(r /// on each node, both within the JVM heap, and natively, outside of the JVM. /// /// -public sealed partial class GetMemoryStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetMemoryStatsRequestDescriptor { - internal GetMemoryStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest Instance { get; init; } - public GetMemoryStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? nodeId) : base(r => r.Optional("node_id", nodeId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMemoryStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest instance) { + Instance = instance; + } + + public GetMemoryStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(nodeId); } public GetMemoryStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetMemoryStats; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The names of particular nodes in the cluster to target. For example, nodeId1,nodeId2 or + /// ml:true + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.NodeId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout + /// expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "ml.get_memory_stats"; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request + /// fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public GetMemoryStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetMemoryStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetMemoryStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.Id? nodeId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsResponse.g.cs index ebfed58ba91..0f3d45ebb3a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetMemoryStatsResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetMemoryStatsResponse : ElasticsearchResponse +internal sealed partial class GetMemoryStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStatistics { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStatistics = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStatistics = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStatistics.TryReadProperty(ref reader, options, PropNodeStatistics, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStatistics = propNodeStatistics.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStatistics, value.NodeStatistics, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponseConverter))] +public sealed partial class GetMemoryStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMemoryStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetMemoryStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStatistics { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsRequest.g.cs index 2d88a9b0287..9a967d95b79 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetModelSnapshotUpgradeStatsRequestParameters : RequestParameters +public sealed partial class GetModelSnapshotUpgradeStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -62,25 +55,90 @@ public sealed partial class GetModelSnapshotUpgradeStatsRequestParameters : Requ public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } +internal sealed partial class GetModelSnapshotUpgradeStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly detection job model snapshot upgrade usage info. /// /// -public sealed partial class GetModelSnapshotUpgradeStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestConverter))] +public sealed partial class GetModelSnapshotUpgradeStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) { } +#if NET7_0_OR_GREATER + public GetModelSnapshotUpgradeStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetModelSnapshotUpgradeStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetModelSnapshotUpgradeStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_model_snapshot_upgrade_stats"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. You can get information for multiple + /// snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, + /// by specifying * as the snapshot ID, or by omitting the snapshot ID. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SnapshotId { get => P("snapshot_id"); set => PR("snapshot_id", value); } + /// /// /// Specifies what to do when the request: @@ -108,7 +166,6 @@ public GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Id jobI /// no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } } @@ -117,37 +174,134 @@ public GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Id jobI /// Get anomaly detection job model snapshot upgrade usage info. /// /// -public sealed partial class GetModelSnapshotUpgradeStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetModelSnapshotUpgradeStatsRequestDescriptor { - internal GetModelSnapshotUpgradeStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest Instance { get; init; } - public GetModelSnapshotUpgradeStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetModelSnapshotUpgradeStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetModelSnapshotUpgradeStats; + public GetModelSnapshotUpgradeStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest(jobId, snapshotId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetModelSnapshotUpgradeStatsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.get_model_snapshot_upgrade_stats"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. You can get information for multiple + /// snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, + /// by specifying * as the snapshot ID, or by omitting the snapshot ID. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.SnapshotId = value; + return this; + } - public GetModelSnapshotUpgradeStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value is true, which returns an empty jobs array when there are no matches and the subset of results + /// when there are partial matches. If this parameter is false, the request returns a 404 status code when there are + /// no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetModelSnapshotUpgradeStatsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetModelSnapshotUpgradeStatsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("snapshot_id", snapshotId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsResponse.g.cs index 45fd57704ca..9a5c1b76036 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotUpgradeStatsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetModelSnapshotUpgradeStatsResponse : ElasticsearchResponse +internal sealed partial class GetModelSnapshotUpgradeStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotUpgrades = System.Text.Json.JsonEncodedText.Encode("model_snapshot_upgrades"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propModelSnapshotUpgrades = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propModelSnapshotUpgrades.TryReadProperty(ref reader, options, PropModelSnapshotUpgrades, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + ModelSnapshotUpgrades = propModelSnapshotUpgrades.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropModelSnapshotUpgrades, value.ModelSnapshotUpgrades, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponseConverter))] +public sealed partial class GetModelSnapshotUpgradeStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_upgrades")] - public IReadOnlyCollection ModelSnapshotUpgrades { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetModelSnapshotUpgradeStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetModelSnapshotUpgradeStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ModelSnapshotUpgrades { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsRequest.g.cs index 04ad8474205..4b73272b113 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetModelSnapshotsRequestParameters : RequestParameters +public sealed partial class GetModelSnapshotsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,35 +40,142 @@ public sealed partial class GetModelSnapshotsRequestParameters : RequestParamete public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetModelSnapshotsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDesc = System.Text.Json.JsonEncodedText.Encode("desc"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDesc = default; + LocalJsonValue propEnd = default; + LocalJsonValue propPage = default; + LocalJsonValue propSort = default; + LocalJsonValue propStart = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDesc.TryReadProperty(ref reader, options, PropDesc, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Desc = propDesc.Value, + End = propEnd.Value, + Page = propPage.Value, + Sort = propSort.Value, + Start = propStart.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDesc, value.Desc, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + /// /// /// Get model snapshots info. /// /// -public sealed partial class GetModelSnapshotsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestConverter))] +public sealed partial class GetModelSnapshotsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) : base(r => r.Required("job_id", jobId).Optional("snapshot_id", snapshotId)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetModelSnapshotsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetModelSnapshots; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetModelSnapshots; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_model_snapshots"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. You can get information for multiple + /// snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, + /// by specifying * as the snapshot ID, or by omitting the snapshot ID. + /// + /// + public Elastic.Clients.Elasticsearch.Id? SnapshotId { get => P("snapshot_id"); set => PO("snapshot_id", value); } + /// /// /// Skips the specified number of snapshots. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -83,7 +183,6 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Specifies the maximum number of snapshots to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -91,7 +190,6 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the desc query parameter. /// /// - [JsonInclude, JsonPropertyName("desc")] public bool? Desc { get; set; } /// @@ -99,9 +197,7 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } - [JsonInclude, JsonPropertyName("page")] + public System.DateTimeOffset? End { get; set; } public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } /// @@ -109,7 +205,6 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the sort query parameter. /// /// - [JsonInclude, JsonPropertyName("sort")] public Elastic.Clients.Elasticsearch.Field? Sort { get; set; } /// @@ -117,8 +212,7 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } } /// @@ -126,58 +220,90 @@ public GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Get model snapshots info. /// /// -public sealed partial class GetModelSnapshotsRequestDescriptor : RequestDescriptor, GetModelSnapshotsRequestParameters> +public readonly partial struct GetModelSnapshotsRequestDescriptor { - internal GetModelSnapshotsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest Instance { get; init; } - public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) : base(r => r.Required("job_id", jobId).Optional("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest instance) { + Instance = instance; } - public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(jobId, snapshotId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetModelSnapshots; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetModelSnapshotsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_model_snapshots"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor descriptor) => descriptor.Instance; - public GetModelSnapshotsRequestDescriptor From(int? from) => Qs("from", from); - public GetModelSnapshotsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetModelSnapshotsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. You can get information for multiple + /// snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, + /// by specifying * as the snapshot ID, or by omitting the snapshot ID. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.SnapshotId = value; + return this; } - public GetModelSnapshotsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id? snapshotId) + /// + /// + /// Skips the specified number of snapshots. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor From(int? value) { - RouteValues.Optional("snapshot_id", snapshotId); - return Self; + Instance.From = value; + return this; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of snapshots to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the desc query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -185,34 +311,28 @@ public GetModelSnapshotsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetModelSnapshotsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } - public GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetModelSnapshotsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -220,10 +340,10 @@ public GetModelSnapshotsRequestDescriptor Page(Actionsort query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -231,78 +351,71 @@ public GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasti /// Refer to the description for the sort query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the description for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetModelSnapshotsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest Build(System.Action action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } + Instance.ErrorTrace = value; + return this; + } - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -311,58 +424,90 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Get model snapshots info. /// /// -public sealed partial class GetModelSnapshotsRequestDescriptor : RequestDescriptor +public readonly partial struct GetModelSnapshotsRequestDescriptor { - internal GetModelSnapshotsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest Instance { get; init; } - public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) : base(r => r.Required("job_id", jobId).Optional("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest instance) { + Instance = instance; } - public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(jobId, snapshotId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetModelSnapshots; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetModelSnapshotsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_model_snapshots"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor descriptor) => descriptor.Instance; - public GetModelSnapshotsRequestDescriptor From(int? from) => Qs("from", from); - public GetModelSnapshotsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetModelSnapshotsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. You can get information for multiple + /// snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, + /// by specifying * as the snapshot ID, or by omitting the snapshot ID. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.SnapshotId = value; + return this; } - public GetModelSnapshotsRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id? snapshotId) + /// + /// + /// Skips the specified number of snapshots. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor From(int? value) { - RouteValues.Optional("snapshot_id", snapshotId); - return Self; + Instance.From = value; + return this; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of snapshots to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the desc query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -370,34 +515,28 @@ public GetModelSnapshotsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetModelSnapshotsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } - public GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetModelSnapshotsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetModelSnapshotsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -405,10 +544,10 @@ public GetModelSnapshotsRequestDescriptor Page(Actionsort query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -416,77 +555,70 @@ public GetModelSnapshotsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Fie /// Refer to the description for the sort query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the description for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetModelSnapshotsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetModelSnapshotsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest Build(System.Action> action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } + Instance.ErrorTrace = value; + return this; + } - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsResponse.g.cs index b56ff39f247..be1ef57e781 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetModelSnapshotsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetModelSnapshotsResponse : ElasticsearchResponse +internal sealed partial class GetModelSnapshotsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshots = System.Text.Json.JsonEncodedText.Encode("model_snapshots"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propModelSnapshots = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propModelSnapshots.TryReadProperty(ref reader, options, PropModelSnapshots, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + ModelSnapshots = propModelSnapshots.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropModelSnapshots, value.ModelSnapshots, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponseConverter))] +public sealed partial class GetModelSnapshotsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("model_snapshots")] - public IReadOnlyCollection ModelSnapshots { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetModelSnapshotsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetModelSnapshotsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ModelSnapshots { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsRequest.g.cs index 46d90e46696..c49129b12ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsRequest.g.cs @@ -17,21 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetOverallBucketsRequestParameters : RequestParameters +public sealed partial class GetOverallBucketsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetOverallBucketsRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAllowNoMatch = System.Text.Json.JsonEncodedText.Encode("allow_no_match"); + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeInterim = System.Text.Json.JsonEncodedText.Encode("exclude_interim"); + private static readonly System.Text.Json.JsonEncodedText PropOverallScore = System.Text.Json.JsonEncodedText.Encode("overall_score"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + private static readonly System.Text.Json.JsonEncodedText PropTopN = System.Text.Json.JsonEncodedText.Encode("top_n"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowNoMatch = default; + LocalJsonValue propBucketSpan = default; + LocalJsonValue propEnd = default; + LocalJsonValue propExcludeInterim = default; + LocalJsonValue?> propOverallScore = default; + LocalJsonValue propStart = default; + LocalJsonValue propTopN = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowNoMatch.TryReadProperty(ref reader, options, PropAllowNoMatch, null)) + { + continue; + } + + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExcludeInterim.TryReadProperty(ref reader, options, PropExcludeInterim, null)) + { + continue; + } + + if (propOverallScore.TryReadProperty(ref reader, options, PropOverallScore, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propTopN.TryReadProperty(ref reader, options, PropTopN, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowNoMatch = propAllowNoMatch.Value, + BucketSpan = propBucketSpan.Value, + End = propEnd.Value, + ExcludeInterim = propExcludeInterim.Value, + OverallScore = propOverallScore.Value, + Start = propStart.Value, + TopN = propTopN.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowNoMatch, value.AllowNoMatch, null, null); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExcludeInterim, value.ExcludeInterim, null, null); + writer.WriteProperty(options, PropOverallScore, value.OverallScore, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropTopN, value.TopN, null, null); + writer.WriteEndObject(); + } } /// @@ -59,26 +145,54 @@ public sealed partial class GetOverallBucketsRequestParameters : RequestParamete /// jobs' largest bucket span. /// /// -public sealed partial class GetOverallBucketsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestConverter))] +public sealed partial class GetOverallBucketsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetOverallBucketsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetOverallBuckets; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetOverallBuckets; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_overall_buckets"; + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, a comma-separated list of jobs or groups, or a wildcard + /// expression. + /// + /// + /// You can summarize the bucket results for all anomaly detection jobs by + /// using _all or by specifying * as the <job_id>. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - [JsonInclude, JsonPropertyName("allow_no_match")] public bool? AllowNoMatch { get; set; } /// @@ -86,7 +200,6 @@ public GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the bucket_span query parameter. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] public Elastic.Clients.Elasticsearch.Duration? BucketSpan { get; set; } /// @@ -94,15 +207,13 @@ public GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } + public System.DateTimeOffset? End { get; set; } /// /// /// Refer to the description for the exclude_interim query parameter. /// /// - [JsonInclude, JsonPropertyName("exclude_interim")] public bool? ExcludeInterim { get; set; } /// @@ -110,23 +221,20 @@ public GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// Refer to the description for the overall_score query parameter. /// /// - [JsonInclude, JsonPropertyName("overall_score")] - public object? OverallScore { get; set; } + public Elastic.Clients.Elasticsearch.Union? OverallScore { get; set; } /// /// /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } /// /// /// Refer to the description for the top_n query parameter. /// /// - [JsonInclude, JsonPropertyName("top_n")] public int? TopN { get; set; } } @@ -155,45 +263,56 @@ public GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r /// jobs' largest bucket span. /// /// -public sealed partial class GetOverallBucketsRequestDescriptor : RequestDescriptor +public readonly partial struct GetOverallBucketsRequestDescriptor { - internal GetOverallBucketsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest Instance { get; init; } - public GetOverallBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetOverallBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetOverallBuckets; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetOverallBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetOverallBucketsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_overall_buckets"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor descriptor) => descriptor.Instance; - public GetOverallBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. It can be a job identifier, a + /// group name, a comma-separated list of jobs or groups, or a wildcard + /// expression. + /// + /// + /// You can summarize the bucket results for all anomaly detection jobs by + /// using _all or by specifying * as the <job_id>. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private bool? AllowNoMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? BucketSpanValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private bool? ExcludeInterimValue { get; set; } - private object? OverallScoreValue { get; set; } - private DateTimeOffset? StartValue { get; set; } - private int? TopNValue { get; set; } - /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - public GetOverallBucketsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor AllowNoMatch(bool? value = true) { - AllowNoMatchValue = allowNoMatch; - return Self; + Instance.AllowNoMatch = value; + return this; } /// @@ -201,10 +320,10 @@ public GetOverallBucketsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true /// Refer to the description for the bucket_span query parameter. /// /// - public GetOverallBucketsRequestDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? bucketSpan) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? value) { - BucketSpanValue = bucketSpan; - return Self; + Instance.BucketSpan = value; + return this; } /// @@ -212,10 +331,10 @@ public GetOverallBucketsRequestDescriptor BucketSpan(Elastic.Clients.Elasticsear /// Refer to the description for the end query parameter. /// /// - public GetOverallBucketsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -223,10 +342,10 @@ public GetOverallBucketsRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the exclude_interim query parameter. /// /// - public GetOverallBucketsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor ExcludeInterim(bool? value = true) { - ExcludeInterimValue = excludeInterim; - return Self; + Instance.ExcludeInterim = value; + return this; } /// @@ -234,10 +353,10 @@ public GetOverallBucketsRequestDescriptor ExcludeInterim(bool? excludeInterim = /// Refer to the description for the overall_score query parameter. /// /// - public GetOverallBucketsRequestDescriptor OverallScore(object? overallScore) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor OverallScore(Elastic.Clients.Elasticsearch.Union? value) { - OverallScoreValue = overallScore; - return Self; + Instance.OverallScore = value; + return this; } /// @@ -245,10 +364,10 @@ public GetOverallBucketsRequestDescriptor OverallScore(object? overallScore) /// Refer to the description for the start query parameter. /// /// - public GetOverallBucketsRequestDescriptor Start(DateTimeOffset? start) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor Start(System.DateTimeOffset? value) { - StartValue = start; - return Self; + Instance.Start = value; + return this; } /// @@ -256,57 +375,59 @@ public GetOverallBucketsRequestDescriptor Start(DateTimeOffset? start) /// Refer to the description for the top_n query parameter. /// /// - public GetOverallBucketsRequestDescriptor TopN(int? topN) + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor TopN(int? value) { - TopNValue = topN; - return Self; + Instance.TopN = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowNoMatchValue.HasValue) - { - writer.WritePropertyName("allow_no_match"); - writer.WriteBooleanValue(AllowNoMatchValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (BucketSpanValue is not null) - { - writer.WritePropertyName("bucket_span"); - JsonSerializer.Serialize(writer, BucketSpanValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ExcludeInterimValue.HasValue) - { - writer.WritePropertyName("exclude_interim"); - writer.WriteBooleanValue(ExcludeInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (OverallScoreValue is not null) - { - writer.WritePropertyName("overall_score"); - JsonSerializer.Serialize(writer, OverallScoreValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TopNValue.HasValue) - { - writer.WritePropertyName("top_n"); - writer.WriteNumberValue(TopNValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsResponse.g.cs index 341db374b03..e41bb15d2d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetOverallBucketsResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetOverallBucketsResponse : ElasticsearchResponse +internal sealed partial class GetOverallBucketsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropOverallBuckets = System.Text.Json.JsonEncodedText.Encode("overall_buckets"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propOverallBuckets = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propOverallBuckets.TryReadProperty(ref reader, options, PropOverallBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + OverallBuckets = propOverallBuckets.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropOverallBuckets, value.OverallBuckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponseConverter))] +public sealed partial class GetOverallBucketsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetOverallBucketsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetOverallBucketsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// Array of overall bucket objects /// /// - [JsonInclude, JsonPropertyName("overall_buckets")] - public IReadOnlyCollection OverallBuckets { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection OverallBuckets { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsRequest.g.cs index 1fd0c64b61b..d289c9cb6eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetRecordsRequestParameters : RequestParameters +public sealed partial class GetRecordsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,6 +40,99 @@ public sealed partial class GetRecordsRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetRecordsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDesc = System.Text.Json.JsonEncodedText.Encode("desc"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeInterim = System.Text.Json.JsonEncodedText.Encode("exclude_interim"); + private static readonly System.Text.Json.JsonEncodedText PropPage = System.Text.Json.JsonEncodedText.Encode("page"); + private static readonly System.Text.Json.JsonEncodedText PropRecordScore = System.Text.Json.JsonEncodedText.Encode("record_score"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDesc = default; + LocalJsonValue propEnd = default; + LocalJsonValue propExcludeInterim = default; + LocalJsonValue propPage = default; + LocalJsonValue propRecordScore = default; + LocalJsonValue propSort = default; + LocalJsonValue propStart = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDesc.TryReadProperty(ref reader, options, PropDesc, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExcludeInterim.TryReadProperty(ref reader, options, PropExcludeInterim, null)) + { + continue; + } + + if (propPage.TryReadProperty(ref reader, options, PropPage, null)) + { + continue; + } + + if (propRecordScore.TryReadProperty(ref reader, options, PropRecordScore, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Desc = propDesc.Value, + End = propEnd.Value, + ExcludeInterim = propExcludeInterim.Value, + Page = propPage.Value, + RecordScore = propRecordScore.Value, + Sort = propSort.Value, + Start = propStart.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDesc, value.Desc, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExcludeInterim, value.ExcludeInterim, null, null); + writer.WriteProperty(options, PropPage, value.Page, null, null); + writer.WriteProperty(options, PropRecordScore, value.RecordScore, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + /// /// /// Get anomaly records for an anomaly detection job. @@ -62,26 +148,48 @@ public sealed partial class GetRecordsRequestParameters : RequestParameters /// number of detectors. /// /// -public sealed partial class GetRecordsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestConverter))] +public sealed partial class GetRecordsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public GetRecordsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRecordsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetRecords; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetRecords; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.get_records"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Skips the specified number of records. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -89,7 +197,6 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Specifies the maximum number of records to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -97,7 +204,6 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the desc query parameter. /// /// - [JsonInclude, JsonPropertyName("desc")] public bool? Desc { get; set; } /// @@ -105,17 +211,14 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } + public System.DateTimeOffset? End { get; set; } /// /// /// Refer to the description for the exclude_interim query parameter. /// /// - [JsonInclude, JsonPropertyName("exclude_interim")] public bool? ExcludeInterim { get; set; } - [JsonInclude, JsonPropertyName("page")] public Elastic.Clients.Elasticsearch.MachineLearning.Page? Page { get; set; } /// @@ -123,7 +226,6 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the record_score query parameter. /// /// - [JsonInclude, JsonPropertyName("record_score")] public double? RecordScore { get; set; } /// @@ -131,7 +233,6 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the sort query parameter. /// /// - [JsonInclude, JsonPropertyName("sort")] public Elastic.Clients.Elasticsearch.Field? Sort { get; set; } /// @@ -139,8 +240,7 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } } /// @@ -158,50 +258,72 @@ public GetRecordsRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.R /// number of detectors. /// /// -public sealed partial class GetRecordsRequestDescriptor : RequestDescriptor, GetRecordsRequestParameters> +public readonly partial struct GetRecordsRequestDescriptor { - internal GetRecordsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest Instance { get; init; } - public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetRecords; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRecordsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_records"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor descriptor) => descriptor.Instance; - public GetRecordsRequestDescriptor From(int? from) => Qs("from", from); - public GetRecordsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetRecordsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Skips the specified number of records. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor From(int? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.From = value; + return this; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private bool? ExcludeInterimValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private double? RecordScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of records to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the desc query parameter. /// /// - public GetRecordsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -209,10 +331,10 @@ public GetRecordsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetRecordsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -220,34 +342,28 @@ public GetRecordsRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the exclude_interim query parameter. /// /// - public GetRecordsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor ExcludeInterim(bool? value = true) { - ExcludeInterimValue = excludeInterim; - return Self; + Instance.ExcludeInterim = value; + return this; } - public GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetRecordsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -255,10 +371,10 @@ public GetRecordsRequestDescriptor Page(Actionrecord_score query parameter. /// /// - public GetRecordsRequestDescriptor RecordScore(double? recordScore) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RecordScore(double? value) { - RecordScoreValue = recordScore; - return Self; + Instance.RecordScore = value; + return this; } /// @@ -266,10 +382,10 @@ public GetRecordsRequestDescriptor RecordScore(double? recordScore) /// Refer to the description for the sort query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -277,90 +393,71 @@ public GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch /// Refer to the description for the sort query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the description for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetRecordsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest Build(System.Action action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } - - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (ExcludeInterimValue.HasValue) - { - writer.WritePropertyName("exclude_interim"); - writer.WriteBooleanValue(ExcludeInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RecordScoreValue.HasValue) - { - writer.WritePropertyName("record_score"); - writer.WriteNumberValue(RecordScoreValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -379,50 +476,72 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// number of detectors. /// /// -public sealed partial class GetRecordsRequestDescriptor : RequestDescriptor +public readonly partial struct GetRecordsRequestDescriptor { - internal GetRecordsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest Instance { get; init; } - public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetRecords; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRecordsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.get_records"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor descriptor) => descriptor.Instance; - public GetRecordsRequestDescriptor From(int? from) => Qs("from", from); - public GetRecordsRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public GetRecordsRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Skips the specified number of records. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor From(int? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.From = value; + return this; } - private bool? DescValue { get; set; } - private DateTimeOffset? EndValue { get; set; } - private bool? ExcludeInterimValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Page? PageValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor PageDescriptor { get; set; } - private Action PageDescriptorAction { get; set; } - private double? RecordScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SortValue { get; set; } - private DateTimeOffset? StartValue { get; set; } + /// + /// + /// Specifies the maximum number of records to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } /// /// /// Refer to the description for the desc query parameter. /// /// - public GetRecordsRequestDescriptor Desc(bool? desc = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Desc(bool? value = true) { - DescValue = desc; - return Self; + Instance.Desc = value; + return this; } /// @@ -430,10 +549,10 @@ public GetRecordsRequestDescriptor Desc(bool? desc = true) /// Refer to the description for the end query parameter. /// /// - public GetRecordsRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -441,34 +560,28 @@ public GetRecordsRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the exclude_interim query parameter. /// /// - public GetRecordsRequestDescriptor ExcludeInterim(bool? excludeInterim = true) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor ExcludeInterim(bool? value = true) { - ExcludeInterimValue = excludeInterim; - return Self; + Instance.ExcludeInterim = value; + return this; } - public GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? page) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.Page? value) { - PageDescriptor = null; - PageDescriptorAction = null; - PageValue = page; - return Self; + Instance.Page = value; + return this; } - public GetRecordsRequestDescriptor Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page() { - PageValue = null; - PageDescriptorAction = null; - PageDescriptor = descriptor; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(null); + return this; } - public GetRecordsRequestDescriptor Page(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Page(System.Action? action) { - PageValue = null; - PageDescriptor = null; - PageDescriptorAction = configure; - return Self; + Instance.Page = Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor.Build(action); + return this; } /// @@ -476,10 +589,10 @@ public GetRecordsRequestDescriptor Page(Actionrecord_score query parameter. /// /// - public GetRecordsRequestDescriptor RecordScore(double? recordScore) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RecordScore(double? value) { - RecordScoreValue = recordScore; - return Self; + Instance.RecordScore = value; + return this; } /// @@ -487,10 +600,10 @@ public GetRecordsRequestDescriptor RecordScore(double? recordScore) /// Refer to the description for the sort query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -498,89 +611,70 @@ public GetRecordsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sor /// Refer to the description for the sort query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Refer to the description for the sort query parameter. + /// Refer to the description for the start query parameter. /// /// - public GetRecordsRequestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Start(System.DateTimeOffset? value) { - SortValue = sort; - return Self; + Instance.Start = value; + return this; } - /// - /// - /// Refer to the description for the start query parameter. - /// - /// - public GetRecordsRequestDescriptor Start(DateTimeOffset? start) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest Build(System.Action> action) { - StartValue = start; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (DescValue.HasValue) - { - writer.WritePropertyName("desc"); - writer.WriteBooleanValue(DescValue.Value); - } - - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (ExcludeInterimValue.HasValue) - { - writer.WritePropertyName("exclude_interim"); - writer.WriteBooleanValue(ExcludeInterimValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (PageDescriptor is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageDescriptor, options); - } - else if (PageDescriptorAction is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(PageDescriptorAction), options); - } - else if (PageValue is not null) - { - writer.WritePropertyName("page"); - JsonSerializer.Serialize(writer, PageValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RecordScoreValue.HasValue) - { - writer.WritePropertyName("record_score"); - writer.WriteNumberValue(RecordScoreValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsResponse.g.cs index 10805cbe3fe..32c25f1e78a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetRecordsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetRecordsResponse : ElasticsearchResponse +internal sealed partial class GetRecordsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropRecords = System.Text.Json.JsonEncodedText.Encode("records"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propRecords = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propRecords.TryReadProperty(ref reader, options, PropRecords, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Records = propRecords.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropRecords, value.Records, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponseConverter))] +public sealed partial class GetRecordsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("records")] - public IReadOnlyCollection Records { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRecordsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRecordsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Records { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsRequest.g.cs index 3800d44371d..0e2b73612cb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetTrainedModelsRequestParameters : RequestParameters +public sealed partial class GetTrainedModelsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -106,7 +99,36 @@ public sealed partial class GetTrainedModelsRequestParameters : RequestParameter /// tags are returned. /// /// - public ICollection? Tags { get => Q?>("tags"); set => Q("tags", value); } + public System.Collections.Generic.ICollection? Tags { get => Q?>("tags"); set => Q("tags", value); } +} + +internal sealed partial class GetTrainedModelsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -114,24 +136,48 @@ public sealed partial class GetTrainedModelsRequestParameters : RequestParameter /// Get trained model configuration info. /// /// -public sealed partial class GetTrainedModelsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestConverter))] +public sealed partial class GetTrainedModelsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) + { + } +#if NET7_0_OR_GREATER public GetTrainedModelsRequest() { } - - public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) +#endif +#if !NET7_0_OR_GREATER + public GetTrainedModelsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetTrainedModels; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetTrainedModels; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_trained_models"; + /// + /// + /// The unique identifier of the trained model or a model alias. + /// + /// + /// You can get information for multiple trained models in a single API + /// request by using a comma-separated list of model IDs or a wildcard + /// expression. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? ModelId { get => P("model_id"); set => PO("model_id", value); } + /// /// /// Specifies what to do when the request: @@ -158,7 +204,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// subset of results when there are partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -167,7 +212,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// JSON map (true) or in a custom compressed format (false). /// /// - [JsonIgnore] public bool? DecompressDefinition { get => Q("decompress_definition"); set => Q("decompress_definition", value); } /// @@ -177,7 +221,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// be retrieved and then added to another cluster. /// /// - [JsonIgnore] public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } /// @@ -185,7 +228,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// Skips the specified number of models. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -194,7 +236,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// body. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.MachineLearning.Include? Include { get => Q("include"); set => Q("include", value); } /// @@ -202,7 +243,6 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// Specifies the maximum number of models to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// @@ -212,8 +252,7 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// tags are returned. /// /// - [JsonIgnore] - public ICollection? Tags { get => Q?>("tags"); set => Q("tags", value); } + public System.Collections.Generic.ICollection? Tags { get => Q?>("tags"); set => Q("tags", value); } } /// @@ -221,41 +260,214 @@ public GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : bas /// Get trained model configuration info. /// /// -public sealed partial class GetTrainedModelsRequestDescriptor : RequestDescriptor +public readonly partial struct GetTrainedModelsRequestDescriptor { - internal GetTrainedModelsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrainedModelsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest instance) + { + Instance = instance; + } - public GetTrainedModelsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) + public GetTrainedModelsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? modelId) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(modelId); } public GetTrainedModelsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetTrainedModels; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The unique identifier of the trained model or a model alias. + /// + /// + /// You can get information for multiple trained models in a single API + /// request by using a comma-separated list of model IDs or a wildcard + /// expression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.ModelId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no models that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// If true, it returns an empty array when there are no matches and the + /// subset of results when there are partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_trained_models"; + /// + /// + /// Specifies whether the included model definition should be returned as a + /// JSON map (true) or in a custom compressed format (false). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor DecompressDefinition(bool? value = true) + { + Instance.DecompressDefinition = value; + return this; + } + + /// + /// + /// Indicates if certain fields should be removed from the configuration on + /// retrieval. This allows the configuration to be in an acceptable format to + /// be retrieved and then added to another cluster. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor ExcludeGenerated(bool? value = true) + { + Instance.ExcludeGenerated = value; + return this; + } + + /// + /// + /// Skips the specified number of models. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - public GetTrainedModelsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetTrainedModelsRequestDescriptor DecompressDefinition(bool? decompressDefinition = true) => Qs("decompress_definition", decompressDefinition); - public GetTrainedModelsRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); - public GetTrainedModelsRequestDescriptor From(int? from) => Qs("from", from); - public GetTrainedModelsRequestDescriptor Include(Elastic.Clients.Elasticsearch.MachineLearning.Include? include) => Qs("include", include); - public GetTrainedModelsRequestDescriptor Size(int? size) => Qs("size", size); - public GetTrainedModelsRequestDescriptor Tags(ICollection? tags) => Qs("tags", tags); + /// + /// + /// A comma delimited string of optional fields to include in the response + /// body. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Include(Elastic.Clients.Elasticsearch.MachineLearning.Include? value) + { + Instance.Include = value; + return this; + } + + /// + /// + /// Specifies the maximum number of models to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// A comma delimited string of tags. A trained model can have many tags, or + /// none. When supplied, only trained models that contain all the supplied + /// tags are returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Tags(System.Collections.Generic.ICollection? value) + { + Instance.Tags = value; + return this; + } + + /// + /// + /// A comma delimited string of tags. A trained model can have many tags, or + /// none. When supplied, only trained models that contain all the supplied + /// tags are returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Tags(params string[] values) + { + Instance.Tags = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTrainedModelsRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Ids? modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsResponse.g.cs index ec971e39178..10c8b2e8614 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetTrainedModelsResponse : ElasticsearchResponse +internal sealed partial class GetTrainedModelsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTrainedModelConfigs = System.Text.Json.JsonEncodedText.Encode("trained_model_configs"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propTrainedModelConfigs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTrainedModelConfigs.TryReadProperty(ref reader, options, PropTrainedModelConfigs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + TrainedModelConfigs = propTrainedModelConfigs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTrainedModelConfigs, value.TrainedModelConfigs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponseConverter))] +public sealed partial class GetTrainedModelsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrainedModelsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrainedModelsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// An array of trained model resources, which are sorted by the model_id value in ascending order. /// /// - [JsonInclude, JsonPropertyName("trained_model_configs")] - public IReadOnlyCollection TrainedModelConfigs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection TrainedModelConfigs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsRequest.g.cs index a66c834864c..b116e69c430 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetTrainedModelsStatsRequestParameters : RequestParameters +public sealed partial class GetTrainedModelsStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -75,6 +68,35 @@ public sealed partial class GetTrainedModelsStatsRequestParameters : RequestPara public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetTrainedModelsStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get trained models usage info. @@ -82,24 +104,44 @@ public sealed partial class GetTrainedModelsStatsRequestParameters : RequestPara /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. /// /// -public sealed partial class GetTrainedModelsStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestConverter))] +public sealed partial class GetTrainedModelsStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) + { + } +#if NET7_0_OR_GREATER public GetTrainedModelsStatsRequest() { } - - public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) +#endif +#if !NET7_0_OR_GREATER + public GetTrainedModelsStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetTrainedModelsStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningGetTrainedModelsStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "ml.get_trained_models_stats"; + /// + /// + /// The unique identifier of the trained model or a model alias. It can be a + /// comma-separated list or a wildcard expression. + /// + /// + public Elastic.Clients.Elasticsearch.Ids? ModelId { get => P("model_id"); set => PO("model_id", value); } + /// /// /// Specifies what to do when the request: @@ -126,7 +168,6 @@ public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) /// subset of results when there are partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -134,7 +175,6 @@ public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) /// Skips the specified number of models. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -142,7 +182,6 @@ public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) /// Specifies the maximum number of models to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -153,37 +192,147 @@ public GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Ids? modelId) /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. /// /// -public sealed partial class GetTrainedModelsStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetTrainedModelsStatsRequestDescriptor { - internal GetTrainedModelsStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest Instance { get; init; } - public GetTrainedModelsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? modelId) : base(r => r.Optional("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrainedModelsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest instance) { + Instance = instance; + } + + public GetTrainedModelsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids? modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(modelId); } public GetTrainedModelsStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningGetTrainedModelsStats; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The unique identifier of the trained model or a model alias. It can be a + /// comma-separated list or a wildcard expression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.ModelId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no models that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// If true, it returns an empty array when there are no matches and the + /// subset of results when there are partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "ml.get_trained_models_stats"; + /// + /// + /// Skips the specified number of models. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Specifies the maximum number of models to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetTrainedModelsStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetTrainedModelsStatsRequestDescriptor From(int? from) => Qs("from", from); - public GetTrainedModelsStatsRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTrainedModelsStatsRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Ids? modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsResponse.g.cs index d49b5734363..46d3dd71c72 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/GetTrainedModelsStatsResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class GetTrainedModelsStatsResponse : ElasticsearchResponse +internal sealed partial class GetTrainedModelsStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTrainedModelStats = System.Text.Json.JsonEncodedText.Encode("trained_model_stats"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propTrainedModelStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTrainedModelStats.TryReadProperty(ref reader, options, PropTrainedModelStats, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + TrainedModelStats = propTrainedModelStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTrainedModelStats, value.TrainedModelStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponseConverter))] +public sealed partial class GetTrainedModelsStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTrainedModelsStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTrainedModelsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The total number of trained model statistics that matched the requested ID patterns. Could be higher than the number of items in the trained_model_stats array as the size of the array is restricted by the supplied size parameter. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// An array of trained model statistics, which are sorted by the model_id value in ascending order. /// /// - [JsonInclude, JsonPropertyName("trained_model_stats")] - public IReadOnlyCollection TrainedModelStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection TrainedModelStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelRequest.g.cs index 79cf334a50c..8816463c809 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class InferTrainedModelRequestParameters : RequestParameters +public sealed partial class InferTrainedModelRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,31 +33,108 @@ public sealed partial class InferTrainedModelRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class InferTrainedModelRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propDocs = default; + LocalJsonValue propInferenceConfig = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value, + InferenceConfig = propInferenceConfig.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Evaluate a trained model. /// /// -public sealed partial class InferTrainedModelRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestConverter))] +public sealed partial class InferTrainedModelRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningInferTrainedModel; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId, System.Collections.Generic.ICollection> docs) : base(r => r.Required("model_id", modelId)) + { + Docs = docs; + } +#if NET7_0_OR_GREATER + public InferTrainedModelRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningInferTrainedModel; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.infer_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// Controls the amount of time to wait for inference results. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -74,15 +144,17 @@ public InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base /// Currently, for NLP models, only a single value is allowed. /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection> Docs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection> Docs { get; set; } /// /// /// The inference configuration updates to apply on the API call /// /// - [JsonInclude, JsonPropertyName("inference_config")] public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? InferenceConfig { get; set; } } @@ -91,34 +163,79 @@ public InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base /// Evaluate a trained model. /// /// -public sealed partial class InferTrainedModelRequestDescriptor : RequestDescriptor, InferTrainedModelRequestParameters> +public readonly partial struct InferTrainedModelRequestDescriptor { - internal InferTrainedModelRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest Instance { get; init; } - public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningInferTrainedModel; + public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(modelId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public InferTrainedModelRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.infer_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - public InferTrainedModelRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Controls the amount of time to wait for inference results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// An array of objects to pass to the model for inference. The objects should contain a fields matching your + /// configured trained model input. Typically, for NLP models, the field name is text_field. + /// Currently, for NLP models, only a single value is allowed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(System.Collections.Generic.ICollection> value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.Docs = value; + return this; } - private ICollection> DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor InferenceConfigDescriptor { get; set; } - private Action> InferenceConfigDescriptorAction { get; set; } + /// + /// + /// An array of objects to pass to the model for inference. The objects should contain a fields matching your + /// configured trained model input. Typically, for NLP models, the field name is text_field. + /// Currently, for NLP models, only a single value is allowed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(params System.Collections.Generic.IDictionary[] values) + { + Instance.Docs = [.. values]; + return this; + } /// /// @@ -127,10 +244,16 @@ public InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Ela /// Currently, for NLP models, only a single value is allowed. /// /// - public InferTrainedModelRequestDescriptor Docs(ICollection> docs) + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(params System.Action?[] actions) { - DocsValue = docs; - return Self; + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action)); + } + + Instance.Docs = items; + return this; } /// @@ -138,52 +261,82 @@ public InferTrainedModelRequestDescriptor Docs(ICollection /// - public InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? inferenceConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.InferenceConfig = value; + return this; } - public InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor descriptor) + /// + /// + /// The inference configuration updates to apply on the API call + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor InferenceConfig(System.Action action) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor.Build(action); + return this; } - public InferTrainedModelRequestDescriptor InferenceConfig(Action> configure) + /// + /// + /// The inference configuration updates to apply on the API call + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -192,34 +345,79 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Evaluate a trained model. /// /// -public sealed partial class InferTrainedModelRequestDescriptor : RequestDescriptor +public readonly partial struct InferTrainedModelRequestDescriptor { - internal InferTrainedModelRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest Instance { get; init; } - public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningInferTrainedModel; + public InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(modelId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public InferTrainedModelRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.infer_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - public InferTrainedModelRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Controls the amount of time to wait for inference results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// An array of objects to pass to the model for inference. The objects should contain a fields matching your + /// configured trained model input. Typically, for NLP models, the field name is text_field. + /// Currently, for NLP models, only a single value is allowed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(System.Collections.Generic.ICollection> value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.Docs = value; + return this; } - private ICollection> DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } + /// + /// + /// An array of objects to pass to the model for inference. The objects should contain a fields matching your + /// configured trained model input. Typically, for NLP models, the field name is text_field. + /// Currently, for NLP models, only a single value is allowed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(params System.Collections.Generic.IDictionary[] values) + { + Instance.Docs = [.. values]; + return this; + } /// /// @@ -228,10 +426,16 @@ public InferTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch. /// Currently, for NLP models, only a single value is allowed. /// /// - public InferTrainedModelRequestDescriptor Docs(ICollection> docs) + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Docs(params System.Action?[] actions) { - DocsValue = docs; - return Self; + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action)); + } + + Instance.Docs = items; + return this; } /// @@ -239,51 +443,70 @@ public InferTrainedModelRequestDescriptor Docs(ICollection /// - public InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? inferenceConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.InferenceConfig = value; + return this; } - public InferTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor descriptor) + /// + /// + /// The inference configuration updates to apply on the API call + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor.Build(action); + return this; } - public InferTrainedModelRequestDescriptor InferenceConfig(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest Build(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelResponse.g.cs index b9edc44911f..6ea4adf5183 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/InferTrainedModelResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class InferTrainedModelResponse : ElasticsearchResponse +internal sealed partial class InferTrainedModelResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("inference_results")] - public IReadOnlyCollection InferenceResults { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropInferenceResults = System.Text.Json.JsonEncodedText.Encode("inference_results"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propInferenceResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInferenceResults.TryReadProperty(ref reader, options, PropInferenceResults, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InferenceResults = propInferenceResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInferenceResults, value.InferenceResults, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponseConverter))] +public sealed partial class InferTrainedModelResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferTrainedModelResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection InferenceResults { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoRequest.g.cs index a09c2cbfe9b..0d520f79b3d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class MlInfoRequestParameters : RequestParameters +public sealed partial class MlInfoRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class MlInfoRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -46,11 +68,28 @@ public sealed partial class MlInfoRequestParameters : RequestParameters /// cluster configuration. /// /// -public sealed partial class MlInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestConverter))] +public sealed partial class MlInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningInfo; +#if NET7_0_OR_GREATER + public MlInfoRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public MlInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -69,23 +108,76 @@ public sealed partial class MlInfoRequest : PlainRequest /// -public sealed partial class MlInfoRequestDescriptor : RequestDescriptor +public readonly partial struct MlInfoRequestDescriptor { - internal MlInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInfoRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest instance) + { + Instance = instance; + } public MlInfoRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningInfo; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "ml.info"; + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoResponse.g.cs index 7f86fd9da05..4115a3e11dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/MlInfoResponse.g.cs @@ -17,23 +17,110 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class MlInfoResponse : ElasticsearchResponse +internal sealed partial class MlInfoResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaults = System.Text.Json.JsonEncodedText.Encode("defaults"); + private static readonly System.Text.Json.JsonEncodedText PropLimits = System.Text.Json.JsonEncodedText.Encode("limits"); + private static readonly System.Text.Json.JsonEncodedText PropNativeCode = System.Text.Json.JsonEncodedText.Encode("native_code"); + private static readonly System.Text.Json.JsonEncodedText PropUpgradeMode = System.Text.Json.JsonEncodedText.Encode("upgrade_mode"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefaults = default; + LocalJsonValue propLimits = default; + LocalJsonValue propNativeCode = default; + LocalJsonValue propUpgradeMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaults.TryReadProperty(ref reader, options, PropDefaults, null)) + { + continue; + } + + if (propLimits.TryReadProperty(ref reader, options, PropLimits, null)) + { + continue; + } + + if (propNativeCode.TryReadProperty(ref reader, options, PropNativeCode, null)) + { + continue; + } + + if (propUpgradeMode.TryReadProperty(ref reader, options, PropUpgradeMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Defaults = propDefaults.Value, + Limits = propLimits.Value, + NativeCode = propNativeCode.Value, + UpgradeMode = propUpgradeMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaults, value.Defaults, null, null); + writer.WriteProperty(options, PropLimits, value.Limits, null, null); + writer.WriteProperty(options, PropNativeCode, value.NativeCode, null, null); + writer.WriteProperty(options, PropUpgradeMode, value.UpgradeMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponseConverter))] +public sealed partial class MlInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("defaults")] - public Elastic.Clients.Elasticsearch.MachineLearning.Defaults Defaults { get; init; } - [JsonInclude, JsonPropertyName("limits")] - public Elastic.Clients.Elasticsearch.MachineLearning.Limits Limits { get; init; } - [JsonInclude, JsonPropertyName("native_code")] - public Elastic.Clients.Elasticsearch.MachineLearning.NativeCode NativeCode { get; init; } - [JsonInclude, JsonPropertyName("upgrade_mode")] - public bool UpgradeMode { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Defaults Defaults { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Limits Limits { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.NativeCode NativeCode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool UpgradeMode { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobRequest.g.cs index b997be7d093..d266676d157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobRequest.g.cs @@ -17,26 +17,60 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class OpenJobRequestParameters : RequestParameters +public sealed partial class OpenJobRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class OpenJobRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } } /// /// /// Open anomaly detection jobs. +/// +/// /// An anomaly detection job must be opened to be ready to receive and analyze /// data. It can be opened and closed multiple times throughout its lifecycle. /// When you open a new job, it starts with an empty model. @@ -45,32 +79,56 @@ public sealed partial class OpenJobRequestParameters : RequestParameters /// new data is received. /// /// -public sealed partial class OpenJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestConverter))] +public sealed partial class OpenJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public OpenJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public OpenJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningOpenJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningOpenJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.open_job"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Refer to the description for the timeout query parameter. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } /// /// /// Open anomaly detection jobs. +/// +/// /// An anomaly detection job must be opened to be ready to receive and analyze /// data. It can be opened and closed multiple times throughout its lifecycle. /// When you open a new job, it starts with an empty model. @@ -79,50 +137,99 @@ public OpenJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requ /// new data is received. /// /// -public sealed partial class OpenJobRequestDescriptor : RequestDescriptor +public readonly partial struct OpenJobRequestDescriptor { - internal OpenJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest Instance { get; init; } - public OpenJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningOpenJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public OpenJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public OpenJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.open_job"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor descriptor) => descriptor.Instance; - public OpenJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// Refer to the description for the timeout query parameter. /// /// - public OpenJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest Build(System.Action action) { - writer.WriteStartObject(); - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobResponse.g.cs index af8427ee8e5..d8e0144ae85 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/OpenJobResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class OpenJobResponse : ElasticsearchResponse +internal sealed partial class OpenJobResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropOpened = System.Text.Json.JsonEncodedText.Encode("opened"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNode = default; + LocalJsonValue propOpened = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propOpened.TryReadProperty(ref reader, options, PropOpened, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Node = propNode.Value, + Opened = propOpened.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropOpened, value.Opened, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponseConverter))] +public sealed partial class OpenJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The ID of the node that the job was started on. In serverless this will be the "serverless". /// If the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string. /// /// - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("opened")] - public bool Opened { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Opened { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsRequest.g.cs index 254e2fb0204..7fb73de7334 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsRequest.g.cs @@ -17,21 +17,53 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PostCalendarEventsRequestParameters : RequestParameters +public sealed partial class PostCalendarEventsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PostCalendarEventsRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropEvents = System.Text.Json.JsonEncodedText.Encode("events"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEvents = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvents.TryReadProperty(ref reader, options, PropEvents, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Events = propEvents.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvents, value.Events, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } } /// @@ -39,27 +71,60 @@ public sealed partial class PostCalendarEventsRequestParameters : RequestParamet /// Add scheduled events to the calendar. /// /// -public sealed partial class PostCalendarEventsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestConverter))] +public sealed partial class PostCalendarEventsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPostCalendarEvents; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId, System.Collections.Generic.ICollection events) : base(r => r.Required("calendar_id", calendarId)) + { + Events = events; + } +#if NET7_0_OR_GREATER + public PostCalendarEventsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPostCalendarEvents; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.post_calendar_events"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + /// /// /// A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format. /// /// - [JsonInclude, JsonPropertyName("events")] - public ICollection Events { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Events { get; set; } } /// @@ -67,108 +132,129 @@ public PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Id calendarId) : /// Add scheduled events to the calendar. /// /// -public sealed partial class PostCalendarEventsRequestDescriptor : RequestDescriptor +public readonly partial struct PostCalendarEventsRequestDescriptor { - internal PostCalendarEventsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest Instance { get; init; } - public PostCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPostCalendarEvents; + public PostCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest(calendarId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PostCalendarEventsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.post_calendar_events"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } - public PostCalendarEventsRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + /// + /// + /// A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor Events(System.Collections.Generic.ICollection value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.Events = value; + return this; } - private ICollection EventsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor EventsDescriptor { get; set; } - private Action EventsDescriptorAction { get; set; } - private Action[] EventsDescriptorActions { get; set; } + /// + /// + /// A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor Events(params Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent[] values) + { + Instance.Events = [.. values]; + return this; + } /// /// /// A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format. /// /// - public PostCalendarEventsRequestDescriptor Events(ICollection events) + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor Events(params System.Action[] actions) { - EventsDescriptor = null; - EventsDescriptorAction = null; - EventsDescriptorActions = null; - EventsValue = events; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor.Build(action)); + } + + Instance.Events = items; + return this; } - public PostCalendarEventsRequestDescriptor Events(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest Build(System.Action action) { - EventsValue = null; - EventsDescriptorAction = null; - EventsDescriptorActions = null; - EventsDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PostCalendarEventsRequestDescriptor Events(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor ErrorTrace(bool? value) { - EventsValue = null; - EventsDescriptor = null; - EventsDescriptorActions = null; - EventsDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public PostCalendarEventsRequestDescriptor Events(params Action[] configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor FilterPath(params string[]? value) { - EventsValue = null; - EventsDescriptor = null; - EventsDescriptorAction = null; - EventsDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (EventsDescriptor is not null) - { - writer.WritePropertyName("events"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, EventsDescriptor, options); - writer.WriteEndArray(); - } - else if (EventsDescriptorAction is not null) - { - writer.WritePropertyName("events"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor(EventsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (EventsDescriptorActions is not null) - { - writer.WritePropertyName("events"); - writer.WriteStartArray(); - foreach (var action in EventsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor(action), options); - } + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("events"); - JsonSerializer.Serialize(writer, EventsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsResponse.g.cs index e8742653958..5f5975818b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PostCalendarEventsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PostCalendarEventsResponse : ElasticsearchResponse +internal sealed partial class PostCalendarEventsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("events")] - public IReadOnlyCollection Events { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropEvents = System.Text.Json.JsonEncodedText.Encode("events"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEvents = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvents.TryReadProperty(ref reader, options, PropEvents, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Events = propEvents.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvents, value.Events, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponseConverter))] +public sealed partial class PostCalendarEventsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostCalendarEventsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostCalendarEventsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Events { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsRequest.g.cs index c59ce728794..f281b92bfcd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsRequest.g.cs @@ -17,47 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PreviewDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class PreviewDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PreviewDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConfig = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Config = propConfig.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteEndObject(); + } } /// /// /// Preview features used by data frame analytics. -/// Previews the extracted features used by a data frame analytics config. +/// Preview the extracted features used by a data frame analytics config. /// /// -public sealed partial class PreviewDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestConverter))] +public sealed partial class PreviewDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public PreviewDataFrameAnalyticsRequest() { } - - public PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public PreviewDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPreviewDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPreviewDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.preview_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + /// /// /// A data frame analytics config as described in create data frame analytics @@ -65,46 +116,49 @@ public PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id? id) : /// this API. /// /// - [JsonInclude, JsonPropertyName("config")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? Config { get; set; } } /// /// /// Preview features used by data frame analytics. -/// Previews the extracted features used by a data frame analytics config. +/// Preview the extracted features used by a data frame analytics config. /// /// -public sealed partial class PreviewDataFrameAnalyticsRequestDescriptor : RequestDescriptor, PreviewDataFrameAnalyticsRequestParameters> +public readonly partial struct PreviewDataFrameAnalyticsRequestDescriptor { - internal PreviewDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest Instance { get; init; } - public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest instance) { + Instance = instance; } - public PreviewDataFrameAnalyticsRequestDescriptor() + public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPreviewDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public PreviewDataFrameAnalyticsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.preview_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Identifier for the data frame analytics job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor ConfigDescriptor { get; set; } - private Action> ConfigDescriptorAction { get; set; } - /// /// /// A data frame analytics config as described in create data frame analytics @@ -112,88 +166,146 @@ public PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients. /// this API. /// /// - public PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? config) + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? value) { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; + Instance.Config = value; + return this; } - public PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor descriptor) + /// + /// + /// A data frame analytics config as described in create data frame analytics + /// jobs. Note that id and dest don’t need to be provided in the context of + /// this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Config(System.Action action) { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor.Build(action); + return this; } - public PreviewDataFrameAnalyticsRequestDescriptor Config(Action> configure) + /// + /// + /// A data frame analytics config as described in create data frame analytics + /// jobs. Note that id and dest don’t need to be provided in the context of + /// this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Config(System.Action> action) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (ConfigDescriptor is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigDescriptor, options); - } - else if (ConfigDescriptorAction is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(ConfigDescriptorAction), options); - } - else if (ConfigValue is not null) + if (action is null) { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Preview features used by data frame analytics. -/// Previews the extracted features used by a data frame analytics config. +/// Preview the extracted features used by a data frame analytics config. /// /// -public sealed partial class PreviewDataFrameAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct PreviewDataFrameAnalyticsRequestDescriptor { - internal PreviewDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest Instance { get; init; } - public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest instance) { + Instance = instance; } - public PreviewDataFrameAnalyticsRequestDescriptor() + public PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPreviewDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public PreviewDataFrameAnalyticsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.preview_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Identifier for the data frame analytics job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor ConfigDescriptor { get; set; } - private Action ConfigDescriptorAction { get; set; } + /// + /// + /// A data frame analytics config as described in create data frame analytics + /// jobs. Note that id and dest don’t need to be provided in the context of + /// this API. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? value) + { + Instance.Config = value; + return this; + } /// /// @@ -202,49 +314,64 @@ public PreviewDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsear /// this API. /// /// - public PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig? config) + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Config(System.Action> action) { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor.Build(action); + return this; } - public PreviewDataFrameAnalyticsRequestDescriptor Config(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest Build(System.Action>? action) { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PreviewDataFrameAnalyticsRequestDescriptor Config(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (ConfigDescriptor is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigDescriptor, options); - } - else if (ConfigDescriptorAction is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(ConfigDescriptorAction), options); - } - else if (ConfigValue is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigValue, options); - } + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsResponse.g.cs index 3247772bece..b142d44fdcf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PreviewDataFrameAnalyticsResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PreviewDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class PreviewDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFeatureValues = System.Text.Json.JsonEncodedText.Encode("feature_values"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propFeatureValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureValues.TryReadProperty(ref reader, options, PropFeatureValues, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureValues = propFeatureValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureValues, value.FeatureValues, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponseConverter))] +public sealed partial class PreviewDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PreviewDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of objects that contain feature name and value pairs. The features have been processed and indicate what will be sent to the model for training. /// /// - [JsonInclude, JsonPropertyName("feature_values")] - public IReadOnlyCollection> FeatureValues { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> FeatureValues { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobRequest.g.cs index d8286ceaee4..7de2d339dbb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobRequest.g.cs @@ -17,41 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutCalendarJobRequestParameters : RequestParameters +public sealed partial class PutCalendarJobRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutCalendarJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Add anomaly detection job to calendar. /// /// -public sealed partial class PutCalendarJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestConverter))] +public sealed partial class PutCalendarJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutCalendarJobRequest(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) : base(r => r.Required("calendar_id", calendarId).Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public PutCalendarJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutCalendarJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutCalendarJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "ml.put_calendar_job"; + + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + + /// + /// + /// An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids JobId { get => P("job_id"); set => PR("job_id", value); } } /// @@ -59,35 +115,99 @@ public PutCalendarJobRequest(Elastic.Clients.Elasticsearch.Id calendarId, Elasti /// Add anomaly detection job to calendar. /// /// -public sealed partial class PutCalendarJobRequestDescriptor : RequestDescriptor +public readonly partial struct PutCalendarJobRequestDescriptor { - internal PutCalendarJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest Instance { get; init; } - public PutCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) : base(r => r.Required("calendar_id", calendarId).Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutCalendarJob; + public PutCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest(calendarId, jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutCalendarJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_calendar_job"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.CalendarId = value; + return this; + } + + /// + /// + /// An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids value) + { + Instance.JobId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public PutCalendarJobRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.SourceQueryString = value; + return this; } - public PutCalendarJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Ids jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobResponse.g.cs index 6c5d6e9ec7c..5ffe694185f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarJobResponse.g.cs @@ -17,39 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutCalendarJobResponse : ElasticsearchResponse +internal sealed partial class PutCalendarJobResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCalendarId = System.Text.Json.JsonEncodedText.Encode("calendar_id"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobIds = System.Text.Json.JsonEncodedText.Encode("job_ids"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarId = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propJobIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarId.TryReadProperty(ref reader, options, PropCalendarId, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobIds.TryReadProperty(ref reader, options, PropJobIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarId = propCalendarId.Value, + Description = propDescription.Value, + JobIds = propJobIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarId, value.CalendarId, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobIds, value.JobIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponseConverter))] +public sealed partial class PutCalendarJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCalendarJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCalendarJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that uniquely identifies a calendar. /// /// - [JsonInclude, JsonPropertyName("calendar_id")] - public string CalendarId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string CalendarId { get; set; } /// /// /// A description of the calendar. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// A list of anomaly detection job identifiers or group names. /// /// - [JsonInclude, JsonPropertyName("job_ids")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection JobIds { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection JobIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarRequest.g.cs index d475637ee75..3e8dd6d70d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarRequest.g.cs @@ -17,48 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutCalendarRequestParameters : RequestParameters +public sealed partial class PutCalendarRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutCalendarRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobIds = System.Text.Json.JsonEncodedText.Encode("job_ids"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue?> propJobIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobIds.TryReadProperty(ref reader, options, PropJobIds, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + JobIds = propJobIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobIds, value.JobIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create a calendar. /// /// -public sealed partial class PutCalendarRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestConverter))] +public sealed partial class PutCalendarRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutCalendarRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) { } +#if NET7_0_OR_GREATER + public PutCalendarRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutCalendar; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutCalendar; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_calendar"; + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id CalendarId { get => P("calendar_id"); set => PR("calendar_id", value); } + /// /// /// A description of the calendar. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -66,8 +129,7 @@ public PutCalendarRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r /// An array of anomaly detection job identifiers. /// /// - [JsonInclude, JsonPropertyName("job_ids")] - public ICollection? JobIds { get; set; } + public System.Collections.Generic.ICollection? JobIds { get; set; } } /// @@ -75,40 +137,50 @@ public PutCalendarRequest(Elastic.Clients.Elasticsearch.Id calendarId) : base(r /// Create a calendar. /// /// -public sealed partial class PutCalendarRequestDescriptor : RequestDescriptor +public readonly partial struct PutCalendarRequestDescriptor { - internal PutCalendarRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest Instance { get; init; } - public PutCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) : base(r => r.Required("calendar_id", calendarId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutCalendar; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.Id calendarId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest(calendarId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutCalendarRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_calendar"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor descriptor) => descriptor.Instance; - public PutCalendarRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id calendarId) + /// + /// + /// A string that uniquely identifies a calendar. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("calendar_id", calendarId); - return Self; + Instance.CalendarId = value; + return this; } - private string? DescriptionValue { get; set; } - private ICollection? JobIdsValue { get; set; } - /// /// /// A description of the calendar. /// /// - public PutCalendarRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -116,27 +188,70 @@ public PutCalendarRequestDescriptor Description(string? description) /// An array of anomaly detection job identifiers. /// /// - public PutCalendarRequestDescriptor JobIds(ICollection? jobIds) + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor JobIds(System.Collections.Generic.ICollection? value) { - JobIdsValue = jobIds; - return Self; + Instance.JobIds = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of anomaly detection job identifiers. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor JobIds(params Elastic.Clients.Elasticsearch.Id[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + Instance.JobIds = [.. values]; + return this; + } - if (JobIdsValue is not null) - { - writer.WritePropertyName("job_ids"); - JsonSerializer.Serialize(writer, JobIdsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarResponse.g.cs index 191a67ad6f5..c723735efc0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutCalendarResponse.g.cs @@ -17,39 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutCalendarResponse : ElasticsearchResponse +internal sealed partial class PutCalendarResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCalendarId = System.Text.Json.JsonEncodedText.Encode("calendar_id"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobIds = System.Text.Json.JsonEncodedText.Encode("job_ids"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarId = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propJobIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarId.TryReadProperty(ref reader, options, PropCalendarId, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobIds.TryReadProperty(ref reader, options, PropJobIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarId = propCalendarId.Value, + Description = propDescription.Value, + JobIds = propJobIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarId, value.CalendarId, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobIds, value.JobIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponseConverter))] +public sealed partial class PutCalendarResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutCalendarResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutCalendarResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that uniquely identifies a calendar. /// /// - [JsonInclude, JsonPropertyName("calendar_id")] - public string CalendarId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string CalendarId { get; set; } /// /// /// A description of the calendar. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// A list of anomaly detection job identifiers or group names. /// /// - [JsonInclude, JsonPropertyName("job_ids")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection JobIds { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection JobIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsRequest.g.cs index e135e76d45e..9b2a1656266 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsRequest.g.cs @@ -17,21 +17,143 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class PutDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue>?> propHeaders = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Headers = propHeaders.Value, + MaxNumThreads = propMaxNumThreads.Value, + Meta = propMeta.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } } /// @@ -48,20 +170,54 @@ public sealed partial class PutDataFrameAnalyticsRequestParameters : RequestPara /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. /// /// -public sealed partial class PutDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestConverter))] +public sealed partial class PutDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDataFrameAnalytics; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination dest, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) : base(r => r.Required("id", id)) + { + Analysis = analysis; + Dest = dest; + Source = source; + } +#if NET7_0_OR_GREATER + public PutDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Specifies whether this job can start when there is insufficient machine @@ -74,7 +230,6 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// xpack.ml.max_lazy_ml_nodes setting. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_start")] public bool? AllowLazyStart { get; set; } /// @@ -84,8 +239,11 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// detection, or regression. /// /// - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } /// /// @@ -119,7 +277,6 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. /// /// - [JsonInclude, JsonPropertyName("analyzed_fields")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } /// @@ -127,7 +284,6 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -135,10 +291,12 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// The destination configuration. /// /// - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; set; } - [JsonInclude, JsonPropertyName("headers")] - public IDictionary>>? Headers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; set; } + public System.Collections.Generic.IDictionary>? Headers { get; set; } /// /// @@ -148,10 +306,8 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// for operational functionality other than the analysis itself. /// /// - [JsonInclude, JsonPropertyName("max_num_threads")] public int? MaxNumThreads { get; set; } - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -162,7 +318,6 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// greater than that setting. /// /// - [JsonInclude, JsonPropertyName("model_memory_limit")] public string? ModelMemoryLimit { get; set; } /// @@ -170,9 +325,11 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// The configuration of how to source the analysis data. /// /// - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } - [JsonInclude, JsonPropertyName("version")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } public string? Version { get; set; } } @@ -190,48 +347,45 @@ public PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base( /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. /// /// -public sealed partial class PutDataFrameAnalyticsRequestDescriptor : RequestDescriptor, PutDataFrameAnalyticsRequestParameters> +public readonly partial struct PutDataFrameAnalyticsRequestDescriptor { - internal PutDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest Instance { get; init; } - public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(id); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action> AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor DestDescriptor { get; set; } - private Action> DestDescriptorAction { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private int? MaxNumThreadsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - private string? VersionValue { get; set; } - /// /// /// Specifies whether this job can start when there is insufficient machine @@ -244,10 +398,10 @@ public PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elas /// xpack.ml.max_lazy_ml_nodes setting. /// /// - public PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? value = true) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.AllowLazyStart = value; + return this; } /// @@ -257,28 +411,36 @@ public PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? al /// detection, or regression. /// /// - public PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis value) { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; + Instance.Analysis = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Analysis(System.Action action) { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Analysis(Action> configure) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Analysis(System.Action> action) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } /// @@ -313,28 +475,86 @@ public PutDataFrameAnalyticsRequestDescriptor Analysis(Action0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. /// /// - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.AnalyzedFields = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + /// + /// + /// Specifies includes and/or excludes patterns to select which fields + /// will be included in the analysis. The patterns specified in excludes + /// are applied last, therefore excludes takes precedence. In other words, + /// if the same field is specified in both includes and excludes, then + /// the field will not be included in the analysis. If analyzed_fields is + /// not set, only the relevant fields will be included. For example, all the + /// numeric fields for outlier detection. + /// The supported fields vary for each type of analysis. Outlier detection + /// requires numeric or boolean data to analyze. The algorithms don’t + /// support missing values therefore fields that have data types other than + /// numeric or boolean are ignored. Documents where included fields contain + /// missing values, null values, or an array are also ignored. Therefore the + /// dest index may contain documents that don’t have an outlier score. + /// Regression supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the regression analysis. + /// Classification supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the classification analysis. + /// Classification analysis can be improved by mapping ordinal variable + /// values to a single number. For example, in case of age ranges, you can + /// model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields() { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action configure) + /// + /// + /// Specifies includes and/or excludes patterns to select which fields + /// will be included in the analysis. The patterns specified in excludes + /// are applied last, therefore excludes takes precedence. In other words, + /// if the same field is specified in both includes and excludes, then + /// the field will not be included in the analysis. If analyzed_fields is + /// not set, only the relevant fields will be included. For example, all the + /// numeric fields for outlier detection. + /// The supported fields vary for each type of analysis. Outlier detection + /// requires numeric or boolean data to analyze. The algorithms don’t + /// support missing values therefore fields that have data types other than + /// numeric or boolean are ignored. Documents where included fields contain + /// missing values, null values, or an array are also ignored. Therefore the + /// dest index may contain documents that don’t have an outlier score. + /// Regression supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the regression analysis. + /// Classification supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the classification analysis. + /// Classification analysis can be improved by mapping ordinal variable + /// values to a single number. For example, in case of age ranges, you can + /// model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(System.Action? action) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } /// @@ -342,10 +562,32 @@ public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action /// - public PutDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// The destination configuration. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination value) + { + Instance.Dest = value; + return this; + } + + /// + /// + /// The destination configuration. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Dest(System.Action action) { - DescriptionValue = description; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; } /// @@ -353,34 +595,42 @@ public PutDataFrameAnalyticsRequestDescriptor Description(string? des /// The destination configuration. /// /// - public PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination dest) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Dest(System.Action> action) + { + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) + { + Instance.Headers = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers() { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers(System.Action? action) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Dest(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddHeader(string key, params string[] values) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -391,16 +641,35 @@ public PutDataFrameAnalyticsRequestDescriptor Headers(Func /// - public PutDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? value) + { + Instance.MaxNumThreads = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta(System.Action? action) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -412,10 +681,10 @@ public PutDataFrameAnalyticsRequestDescriptor Meta(Func /// - public PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } /// @@ -423,146 +692,88 @@ public PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string /// The configuration of how to source the analysis data. /// /// - public PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + /// + /// + /// The configuration of how to source the analysis data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Source(Action> configure) + /// + /// + /// The configuration of how to source the analysis data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) - { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); - } - - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } - - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -580,48 +791,45 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. /// /// -public sealed partial class PutDataFrameAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct PutDataFrameAnalyticsRequestDescriptor { - internal PutDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest Instance { get; init; } - public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(id); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private int? MaxNumThreadsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private string? VersionValue { get; set; } - /// /// /// Specifies whether this job can start when there is insufficient machine @@ -634,10 +842,10 @@ public PutDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.I /// xpack.ml.max_lazy_ml_nodes setting. /// /// - public PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? value = true) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.AllowLazyStart = value; + return this; } /// @@ -647,28 +855,61 @@ public PutDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStar /// detection, or regression. /// /// - public PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis value) { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; + Instance.Analysis = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) + /// + /// + /// The analysis configuration, which contains the information necessary to + /// perform one of the following types of analysis: classification, outlier + /// detection, or regression. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Analysis(System.Action> action) { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Analysis(Action configure) + /// + /// + /// Specifies includes and/or excludes patterns to select which fields + /// will be included in the analysis. The patterns specified in excludes + /// are applied last, therefore excludes takes precedence. In other words, + /// if the same field is specified in both includes and excludes, then + /// the field will not be included in the analysis. If analyzed_fields is + /// not set, only the relevant fields will be included. For example, all the + /// numeric fields for outlier detection. + /// The supported fields vary for each type of analysis. Outlier detection + /// requires numeric or boolean data to analyze. The algorithms don’t + /// support missing values therefore fields that have data types other than + /// numeric or boolean are ignored. Documents where included fields contain + /// missing values, null values, or an array are also ignored. Therefore the + /// dest index may contain documents that don’t have an outlier score. + /// Regression supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the regression analysis. + /// Classification supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the classification analysis. + /// Classification analysis can be improved by mapping ordinal variable + /// values to a single number. For example, in case of age ranges, you can + /// model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = value; + return this; } /// @@ -703,39 +944,70 @@ public PutDataFrameAnalyticsRequestDescriptor Analysis(Action0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. /// /// - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields() { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + /// + /// + /// Specifies includes and/or excludes patterns to select which fields + /// will be included in the analysis. The patterns specified in excludes + /// are applied last, therefore excludes takes precedence. In other words, + /// if the same field is specified in both includes and excludes, then + /// the field will not be included in the analysis. If analyzed_fields is + /// not set, only the relevant fields will be included. For example, all the + /// numeric fields for outlier detection. + /// The supported fields vary for each type of analysis. Outlier detection + /// requires numeric or boolean data to analyze. The algorithms don’t + /// support missing values therefore fields that have data types other than + /// numeric or boolean are ignored. Documents where included fields contain + /// missing values, null values, or an array are also ignored. Therefore the + /// dest index may contain documents that don’t have an outlier score. + /// Regression supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the regression analysis. + /// Classification supports fields that are numeric, boolean, text, + /// keyword, and ip data types. It is also tolerant of missing values. + /// Fields that are supported are included in the analysis, other fields are + /// ignored. Documents where included fields contain an array with two or + /// more values are also ignored. Documents in the dest index that don’t + /// contain a results field are not included in the classification analysis. + /// Classification analysis can be improved by mapping ordinal variable + /// values to a single number. For example, in case of age ranges, you can + /// model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(System.Action? action) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor AnalyzedFields(Action configure) + /// + /// + /// A description of the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Description(string? value) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.Description = value; + return this; } /// /// - /// A description of the job. + /// The destination configuration. /// /// - public PutDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination value) { - DescriptionValue = description; - return Self; + Instance.Dest = value; + return this; } /// @@ -743,34 +1015,42 @@ public PutDataFrameAnalyticsRequestDescriptor Description(string? description) /// The destination configuration. /// /// - public PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination dest) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Dest(System.Action> action) + { + Instance.Dest = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) + { + Instance.Headers = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers() { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Dest(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Headers(System.Action? action) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Dest(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddHeader(string key, params string[] values) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -781,16 +1061,35 @@ public PutDataFrameAnalyticsRequestDescriptor Headers(Func /// - public PutDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? value) + { + Instance.MaxNumThreads = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Meta(System.Action? action) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -802,10 +1101,10 @@ public PutDataFrameAnalyticsRequestDescriptor Meta(Func /// - public PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } /// @@ -813,145 +1112,76 @@ public PutDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemo /// The configuration of how to source the analysis data. /// /// - public PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + /// + /// + /// The configuration of how to source the analysis data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - public PutDataFrameAnalyticsRequestDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Version(string? value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Version = value; + return this; } - public PutDataFrameAnalyticsRequestDescriptor Version(string? version) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest Build(System.Action> action) { - VersionValue = version; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) - { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); - } - - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } - - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } - - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsResponse.g.cs index f09a4e42769..8378184efff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDataFrameAnalyticsResponse.g.cs @@ -17,41 +17,220 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class PutDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("allow_lazy_start")] - public bool AllowLazyStart { get; init; } - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; init; } - [JsonInclude, JsonPropertyName("analyzed_fields")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; init; } - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public long CreateTime { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("max_num_threads")] - public int MaxNumThreads { get; init; } - [JsonInclude, JsonPropertyName("_meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("model_memory_limit")] - public string ModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propId = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + Authorization = propAuthorization.Value, + CreateTime = propCreateTime.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Id = propId.Value, + MaxNumThreads = propMaxNumThreads.Value, + Meta = propMeta.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponseConverter))] +public sealed partial class PutDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowLazyStart { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset CreateTime { get; set; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxNumThreads { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelMemoryLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedRequest.g.cs index b6c1bf9569d..2747076cc86 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutDatafeedRequestParameters : RequestParameters +public sealed partial class PutDatafeedRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,7 +39,15 @@ public sealed partial class PutDatafeedRequestParameters : RequestParameters /// whether wildcard expressions match hidden data streams. Supports comma-separated values. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// @@ -56,194 +57,160 @@ public sealed partial class PutDatafeedRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } -internal sealed partial class PutDatafeedRequestConverter : JsonConverter +internal sealed partial class PutDatafeedRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override PutDatafeedRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("indexes"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new PutDatafeedRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue>?> propHeaders = default; + LocalJsonValue propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "chunking_config") - { - variant.ChunkingConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "delayed_data_check_config") - { - variant.DelayedDataCheckConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "frequency") - { - variant.Frequency = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "headers") - { - variant.Headers = JsonSerializer.Deserialize>>?>(ref reader, options); - continue; - } - - if (property == "indices" || property == "indexes") - { - variant.Indices = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices_options") - { - variant.IndicesOptions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "job_id") - { - variant.JobId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_empty_searches") - { - variant.MaxEmptySearches = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query_delay") - { - variant.QueryDelay = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "scroll_size") - { - variant.ScrollSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, PutDatafeedRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; + } - if (value.ChunkingConfig is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, value.ChunkingConfig, options); - } + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } - if (value.DelayedDataCheckConfig is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, value.DelayedDataCheckConfig, options); - } + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } - if (value.Frequency is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, value.Frequency, options); - } + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null) || propIndices.TryReadProperty(ref reader, options, PropIndices1, null)) + { + continue; + } - if (value.Headers is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, value.Headers, options); - } + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } - if (value.Indices is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, value.Indices, options); - } + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } - if (value.IndicesOptions is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, value.IndicesOptions, options); - } + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } - if (value.JobId is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, value.JobId, options); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.MaxEmptySearches.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(value.MaxEmptySearches.Value); - } + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.QueryDelay is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, value.QueryDelay, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ScrollSize.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(value.ScrollSize.Value); - } + Aggregations = propAggregations.Value, + ChunkingConfig = propChunkingConfig.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Headers = propHeaders.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); writer.WriteEndObject(); } } @@ -264,32 +231,51 @@ public override void Write(Utf8JsonWriter writer, PutDatafeedRequest value, Json /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. /// /// -[JsonConverter(typeof(PutDatafeedRequestConverter))] -public sealed partial class PutDatafeedRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestConverter))] +public sealed partial class PutDatafeedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) { } - +#if NET7_0_OR_GREATER public PutDatafeedRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDatafeed; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutDatafeed; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id DatafeedId { get => P("datafeed_id"); set => PR("datafeed_id", value); } + /// /// /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the _all /// string or when no indices are specified. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -298,15 +284,21 @@ public PutDatafeedRequest() /// whether wildcard expressions match hidden data streams. Supports comma-separated values. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// /// If true, unavailable indices (missing or closed) are ignored. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -315,8 +307,7 @@ public PutDatafeedRequest() /// Support for aggregations is limited and should be used only with low cardinality data. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// @@ -326,7 +317,6 @@ public PutDatafeedRequest() /// it is an advanced configuration option. /// /// - [JsonInclude, JsonPropertyName("chunking_config")] public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfig { get; set; } /// @@ -338,7 +328,6 @@ public PutDatafeedRequest() /// This check runs only on real-time datafeeds. /// /// - [JsonInclude, JsonPropertyName("delayed_data_check_config")] public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; set; } /// @@ -350,10 +339,8 @@ public PutDatafeedRequest() /// aggregations, this value must be divisible by the interval of the date histogram aggregation. /// /// - [JsonInclude, JsonPropertyName("frequency")] public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } - [JsonInclude, JsonPropertyName("headers")] - public IDictionary>>? Headers { get; set; } + public System.Collections.Generic.IDictionary>? Headers { get; set; } /// /// @@ -361,7 +348,6 @@ public PutDatafeedRequest() /// nodes and the machine learning nodes must have the remote_cluster_client role. /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// @@ -369,7 +355,6 @@ public PutDatafeedRequest() /// Specifies index expansion options that are used during search /// /// - [JsonInclude, JsonPropertyName("indices_options")] public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; set; } /// @@ -377,7 +362,6 @@ public PutDatafeedRequest() /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] public Elastic.Clients.Elasticsearch.Id? JobId { get; set; } /// @@ -388,7 +372,6 @@ public PutDatafeedRequest() /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. /// /// - [JsonInclude, JsonPropertyName("max_empty_searches")] public int? MaxEmptySearches { get; set; } /// @@ -398,7 +381,6 @@ public PutDatafeedRequest() /// object is passed verbatim to Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -409,7 +391,6 @@ public PutDatafeedRequest() /// when there are multiple jobs running on the same node. /// /// - [JsonInclude, JsonPropertyName("query_delay")] public Elastic.Clients.Elasticsearch.Duration? QueryDelay { get; set; } /// @@ -417,8 +398,7 @@ public PutDatafeedRequest() /// Specifies runtime fields for the datafeed search. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// @@ -426,8 +406,7 @@ public PutDatafeedRequest() /// The detector configuration objects in a job can contain functions that use these script fields. /// /// - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } /// /// @@ -435,7 +414,6 @@ public PutDatafeedRequest() /// The maximum value is the value of index.max_result_window, which is 10,000 by default. /// /// - [JsonInclude, JsonPropertyName("scroll_size")] public int? ScrollSize { get; set; } } @@ -455,54 +433,137 @@ public PutDatafeedRequest() /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. /// /// -public sealed partial class PutDatafeedRequestDescriptor : RequestDescriptor, PutDatafeedRequestParameters> +public readonly partial struct PutDatafeedRequestDescriptor { - internal PutDatafeedRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest Instance { get; init; } - public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDatafeed; + public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(datafeedId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.DatafeedId = value; + return this; + } + + /// + /// + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the _all + /// string or when no indices are specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } - public PutDatafeedRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutDatafeedRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutDatafeedRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - - public PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) - { - RouteValues.Required("datafeed_id", datafeedId); - return Self; - } - - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + /// + /// + /// If true, unavailable indices (missing or closed) are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. + /// Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. + /// Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. + /// Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } /// /// @@ -510,10 +571,31 @@ public PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasti /// Support for aggregations is limited and should be used only with low cardinality data. /// /// - public PutDatafeedRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddAggregation(string key, System.Action action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -524,28 +606,24 @@ public PutDatafeedRequestDescriptor Aggregations(Func /// - public PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) - { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; - } - - public PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; + Instance.ChunkingConfig = value; + return this; } - public PutDatafeedRequestDescriptor ChunkingConfig(Action configure) + /// + /// + /// Datafeeds might be required to search over long time periods, for several months or years. + /// This search is split into time chunks in order to ensure the load on Elasticsearch is managed. + /// Chunking configuration controls how the size of these time chunks are calculated; + /// it is an advanced configuration option. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ChunkingConfig(System.Action action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; } /// @@ -557,28 +635,25 @@ public PutDatafeedRequestDescriptor ChunkingConfig(Action /// - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) - { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; - } - - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; + Instance.DelayedDataCheckConfig = value; + return this; } - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. + /// The datafeed can optionally search over indices that have already been read in an effort to determine whether + /// any data has subsequently been added to the index. If missing data is found, it is a good indication that the + /// query_delay is set too low and the data is being indexed after the datafeed has passed that moment in time. + /// This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DelayedDataCheckConfig(System.Action action) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// @@ -590,16 +665,42 @@ public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Action /// - public PutDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Frequency = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) + { + Instance.Headers = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers() { - FrequencyValue = frequency; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; } - public PutDatafeedRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers(System.Action? action) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddHeader(string key, params string[] values) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -608,10 +709,10 @@ public PutDatafeedRequestDescriptor Headers(Funcremote_cluster_client role. /// /// - public PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -619,28 +720,32 @@ public PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticse /// Specifies index expansion options that are used during search /// /// - public PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.IndicesOptions = value; + return this; } - public PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + /// + /// + /// Specifies index expansion options that are used during search + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions() { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; } - public PutDatafeedRequestDescriptor IndicesOptions(Action configure) + /// + /// + /// Specifies index expansion options that are used during search + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions(System.Action? action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; } /// @@ -648,10 +753,10 @@ public PutDatafeedRequestDescriptor IndicesOptions(Action /// - public PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -662,10 +767,10 @@ public PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsear /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. /// /// - public PutDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor MaxEmptySearches(int? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.MaxEmptySearches = value; + return this; } /// @@ -675,28 +780,36 @@ public PutDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySea /// object is passed verbatim to Elasticsearch. /// /// - public PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public PutDatafeedRequestDescriptor Query(Action> configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -707,10 +820,10 @@ public PutDatafeedRequestDescriptor Query(Action /// - public PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.QueryDelay = value; + return this; } /// @@ -718,164 +831,197 @@ public PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasti /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. - /// The detector configuration objects in a job can contain functions that use these script fields. + /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. - /// The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings(System.Action? action) { - ScrollSizeValue = scrollSize; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings(System.Action>? action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } - if (QueryDelayValue is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. + /// The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } - if (ScrollSizeValue.HasValue) - { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -895,54 +1041,113 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. /// /// -public sealed partial class PutDatafeedRequestDescriptor : RequestDescriptor +public readonly partial struct PutDatafeedRequestDescriptor { - internal PutDatafeedRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest Instance { get; init; } - public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutDatafeed; + public PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(datafeedId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.DatafeedId = value; + return this; + } + + /// + /// + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the _all + /// string or when no indices are specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public PutDatafeedRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutDatafeedRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutDatafeedRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - - public PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) - { - RouteValues.Required("datafeed_id", datafeedId); - return Self; - } - - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded, or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If true, unavailable indices (missing or closed) are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. + /// Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } /// /// @@ -950,10 +1155,36 @@ public PutDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id /// Support for aggregations is limited and should be used only with low cardinality data. /// /// - public PutDatafeedRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. + /// Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddAggregation(string key, System.Action> action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -964,28 +1195,24 @@ public PutDatafeedRequestDescriptor Aggregations(Func /// - public PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; + Instance.ChunkingConfig = value; + return this; } - public PutDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) - { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; - } - - public PutDatafeedRequestDescriptor ChunkingConfig(Action configure) + /// + /// + /// Datafeeds might be required to search over long time periods, for several months or years. + /// This search is split into time chunks in order to ensure the load on Elasticsearch is managed. + /// Chunking configuration controls how the size of these time chunks are calculated; + /// it is an advanced configuration option. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ChunkingConfig(System.Action action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; } /// @@ -997,28 +1224,25 @@ public PutDatafeedRequestDescriptor ChunkingConfig(Action /// - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; + Instance.DelayedDataCheckConfig = value; + return this; } - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) - { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; - } - - public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. + /// The datafeed can optionally search over indices that have already been read in an effort to determine whether + /// any data has subsequently been added to the index. If missing data is found, it is a good indication that the + /// query_delay is set too low and the data is being indexed after the datafeed has passed that moment in time. + /// This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor DelayedDataCheckConfig(System.Action action) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// @@ -1030,16 +1254,42 @@ public PutDatafeedRequestDescriptor DelayedDataCheckConfig(Action /// - public PutDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Frequency = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) + { + Instance.Headers = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers() + { + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Headers(System.Action? action) { - FrequencyValue = frequency; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; } - public PutDatafeedRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddHeader(string key, params string[] values) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -1048,10 +1298,10 @@ public PutDatafeedRequestDescriptor Headers(Funcremote_cluster_client role. /// /// - public PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -1059,28 +1309,32 @@ public PutDatafeedRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indice /// Specifies index expansion options that are used during search /// /// - public PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.IndicesOptions = value; + return this; } - public PutDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + /// + /// + /// Specifies index expansion options that are used during search + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions() { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; } - public PutDatafeedRequestDescriptor IndicesOptions(Action configure) + /// + /// + /// Specifies index expansion options that are used during search + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor IndicesOptions(System.Action? action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; } /// @@ -1088,10 +1342,10 @@ public PutDatafeedRequestDescriptor IndicesOptions(Action /// - public PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -1102,10 +1356,10 @@ public PutDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobI /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. /// /// - public PutDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor MaxEmptySearches(int? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.MaxEmptySearches = value; + return this; } /// @@ -1115,28 +1369,23 @@ public PutDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) /// object is passed verbatim to Elasticsearch. /// /// - public PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public PutDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public PutDatafeedRequestDescriptor Query(Action configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -1147,10 +1396,10 @@ public PutDatafeedRequestDescriptor Query(Action /// - public PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.QueryDelay = value; + return this; } /// @@ -1158,163 +1407,171 @@ public PutDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Dur /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. - /// The detector configuration objects in a job can contain functions that use these script fields. + /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. - /// The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// Specifies runtime fields for the datafeed search. /// /// - public PutDatafeedRequestDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RuntimeMappings(System.Action>? action) { - ScrollSizeValue = scrollSize; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. + /// The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } - if (QueryDelayValue is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ScrollSizeValue.HasValue) - { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedResponse.g.cs index 0a02dd03b3c..41185acb78c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutDatafeedResponse.g.cs @@ -17,45 +17,232 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutDatafeedResponse : ElasticsearchResponse +internal sealed partial class PutDatafeedResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("chunking_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig ChunkingConfig { get; init; } - [JsonInclude, JsonPropertyName("datafeed_id")] - public string DatafeedId { get; init; } - [JsonInclude, JsonPropertyName("delayed_data_check_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; init; } - [JsonInclude, JsonPropertyName("frequency")] - public Elastic.Clients.Elasticsearch.Duration? Frequency { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("indices_options")] - public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("max_empty_searches")] - public int? MaxEmptySearches { get; init; } - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; init; } - [JsonInclude, JsonPropertyName("query_delay")] - public Elastic.Clients.Elasticsearch.Duration QueryDelay { get; init; } - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IReadOnlyDictionary? RuntimeMappings { get; init; } - [JsonInclude, JsonPropertyName("script_fields")] - public IReadOnlyDictionary? ScriptFields { get; init; } - [JsonInclude, JsonPropertyName("scroll_size")] - public int ScrollSize { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedId = System.Text.Json.JsonEncodedText.Encode("datafeed_id"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDatafeedId = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } + + if (propDatafeedId.TryReadProperty(ref reader, options, PropDatafeedId, null)) + { + continue; + } + + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Authorization = propAuthorization.Value, + ChunkingConfig = propChunkingConfig.Value, + DatafeedId = propDatafeedId.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDatafeedId, value.DatafeedId, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponseConverter))] +public sealed partial class PutDatafeedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutDatafeedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig ChunkingConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DatafeedId { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public int? MaxEmptySearches { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration QueryDelay { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ScriptFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ScrollSize { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterRequest.g.cs index 6e235f21ab1..501f9862a66 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutFilterRequestParameters : RequestParameters +public sealed partial class PutFilterRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutFilterRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropItems = System.Text.Json.JsonEncodedText.Encode("items"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue?> propItems = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propItems.TryReadProperty(ref reader, options, PropItems, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Items = propItems.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropItems, value.Items, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } } /// @@ -41,26 +82,48 @@ public sealed partial class PutFilterRequestParameters : RequestParameters /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. /// /// -public sealed partial class PutFilterRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestConverter))] +public sealed partial class PutFilterRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) { } +#if NET7_0_OR_GREATER + public PutFilterRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutFilter; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutFilter; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_filter"; + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id FilterId { get => P("filter_id"); set => PR("filter_id", value); } + /// /// /// A description of the filter. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -69,8 +132,7 @@ public PutFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r /// Up to 10000 items are allowed in each filter. /// /// - [JsonInclude, JsonPropertyName("items")] - public ICollection? Items { get; set; } + public System.Collections.Generic.ICollection? Items { get; set; } } /// @@ -80,40 +142,50 @@ public PutFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. /// /// -public sealed partial class PutFilterRequestDescriptor : RequestDescriptor +public readonly partial struct PutFilterRequestDescriptor { - internal PutFilterRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest Instance { get; init; } - public PutFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutFilter; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest(filterId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutFilterRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_filter"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor descriptor) => descriptor.Instance; - public PutFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id filterId) + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("filter_id", filterId); - return Self; + Instance.FilterId = value; + return this; } - private string? DescriptionValue { get; set; } - private ICollection? ItemsValue { get; set; } - /// /// /// A description of the filter. /// /// - public PutFilterRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -122,27 +194,71 @@ public PutFilterRequestDescriptor Description(string? description) /// Up to 10000 items are allowed in each filter. /// /// - public PutFilterRequestDescriptor Items(ICollection? items) + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor Items(System.Collections.Generic.ICollection? value) { - ItemsValue = items; - return Self; + Instance.Items = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The items of the filter. A wildcard * can be used at the beginning or the end of an item. + /// Up to 10000 items are allowed in each filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor Items(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + Instance.Items = [.. values]; + return this; + } - if (ItemsValue is not null) - { - writer.WritePropertyName("items"); - JsonSerializer.Serialize(writer, ItemsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterResponse.g.cs index 03d0bc4ab06..4586b500474 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutFilterResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutFilterResponse : ElasticsearchResponse +internal sealed partial class PutFilterResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("filter_id")] - public string FilterId { get; init; } - [JsonInclude, JsonPropertyName("items")] - public IReadOnlyCollection Items { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFilterId = System.Text.Json.JsonEncodedText.Encode("filter_id"); + private static readonly System.Text.Json.JsonEncodedText PropItems = System.Text.Json.JsonEncodedText.Encode("items"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propFilterId = default; + LocalJsonValue> propItems = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFilterId.TryReadProperty(ref reader, options, PropFilterId, null)) + { + continue; + } + + if (propItems.TryReadProperty(ref reader, options, PropItems, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + FilterId = propFilterId.Value, + Items = propItems.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFilterId, value.FilterId, null, null); + writer.WriteProperty(options, PropItems, value.Items, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponseConverter))] +public sealed partial class PutFilterResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutFilterResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FilterId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Items { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobRequest.g.cs index 6b657b25509..9c44893f119 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutJobRequestParameters : RequestParameters +public sealed partial class PutJobRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -73,7 +66,15 @@ public sealed partial class PutJobRequestParameters : RequestParameters /// /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// @@ -83,22 +84,218 @@ public sealed partial class PutJobRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } +internal sealed partial class PutJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyOpen = System.Text.Json.JsonEncodedText.Encode("allow_lazy_open"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropBackgroundPersistInterval = System.Text.Json.JsonEncodedText.Encode("background_persist_interval"); + private static readonly System.Text.Json.JsonEncodedText PropCustomSettings = System.Text.Json.JsonEncodedText.Encode("custom_settings"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropDataDescription = System.Text.Json.JsonEncodedText.Encode("data_description"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedConfig = System.Text.Json.JsonEncodedText.Encode("datafeed_config"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlotConfig = System.Text.Json.JsonEncodedText.Encode("model_plot_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropRenormalizationWindowDays = System.Text.Json.JsonEncodedText.Encode("renormalization_window_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsIndexName = System.Text.Json.JsonEncodedText.Encode("results_index_name"); + private static readonly System.Text.Json.JsonEncodedText PropResultsRetentionDays = System.Text.Json.JsonEncodedText.Encode("results_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyOpen = default; + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propBackgroundPersistInterval = default; + LocalJsonValue propCustomSettings = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propDataDescription = default; + LocalJsonValue propDatafeedConfig = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propJobId = default; + LocalJsonValue propModelPlotConfig = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propRenormalizationWindowDays = default; + LocalJsonValue propResultsIndexName = default; + LocalJsonValue propResultsRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyOpen.TryReadProperty(ref reader, options, PropAllowLazyOpen, null)) + { + continue; + } + + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propBackgroundPersistInterval.TryReadProperty(ref reader, options, PropBackgroundPersistInterval, null)) + { + continue; + } + + if (propCustomSettings.TryReadProperty(ref reader, options, PropCustomSettings, null)) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propDataDescription.TryReadProperty(ref reader, options, PropDataDescription, null)) + { + continue; + } + + if (propDatafeedConfig.TryReadProperty(ref reader, options, PropDatafeedConfig, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propModelPlotConfig.TryReadProperty(ref reader, options, PropModelPlotConfig, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propRenormalizationWindowDays.TryReadProperty(ref reader, options, PropRenormalizationWindowDays, null)) + { + continue; + } + + if (propResultsIndexName.TryReadProperty(ref reader, options, PropResultsIndexName, null)) + { + continue; + } + + if (propResultsRetentionDays.TryReadProperty(ref reader, options, PropResultsRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyOpen = propAllowLazyOpen.Value, + AnalysisConfig = propAnalysisConfig.Value, + AnalysisLimits = propAnalysisLimits.Value, + BackgroundPersistInterval = propBackgroundPersistInterval.Value, + CustomSettings = propCustomSettings.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + DataDescription = propDataDescription.Value, + DatafeedConfig = propDatafeedConfig.Value, + Description = propDescription.Value, + Groups = propGroups.Value, + JobId = propJobId.Value, + ModelPlotConfig = propModelPlotConfig.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + RenormalizationWindowDays = propRenormalizationWindowDays.Value, + ResultsIndexName = propResultsIndexName.Value, + ResultsRetentionDays = propResultsRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyOpen, value.AllowLazyOpen, null, null); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropBackgroundPersistInterval, value.BackgroundPersistInterval, null, null); + writer.WriteProperty(options, PropCustomSettings, value.CustomSettings, null, null); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropDataDescription, value.DataDescription, null, null); + writer.WriteProperty(options, PropDatafeedConfig, value.DatafeedConfig, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropModelPlotConfig, value.ModelPlotConfig, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropRenormalizationWindowDays, value.RenormalizationWindowDays, null, null); + writer.WriteProperty(options, PropResultsIndexName, value.ResultsIndexName, null, null); + writer.WriteProperty(options, PropResultsRetentionDays, value.ResultsRetentionDays, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create an anomaly detection job. +/// +/// /// If you include a datafeed_config, you must have read index privileges on the source index. /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. /// /// -public sealed partial class PutJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestConverter))] +public sealed partial class PutJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig analysisConfig, Elastic.Clients.Elasticsearch.MachineLearning.DataDescription dataDescription) + { + AnalysisConfig = analysisConfig; + DataDescription = dataDescription; + } +#if NET7_0_OR_GREATER + public PutJobRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PutJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -110,7 +307,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// _all string or when no indices are specified. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -146,15 +342,21 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// /// If true, unavailable indices (missing or closed) are ignored. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -162,7 +364,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_open")] public bool? AllowLazyOpen { get; set; } /// @@ -170,15 +371,17 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. /// /// - [JsonInclude, JsonPropertyName("analysis_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfig { get; set; } /// /// /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. /// /// - [JsonInclude, JsonPropertyName("analysis_limits")] public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimits { get; set; } /// @@ -186,7 +389,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the background_persist_interval value too low. /// /// - [JsonInclude, JsonPropertyName("background_persist_interval")] public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; set; } /// @@ -194,7 +396,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option. Contains custom meta data about the job. /// /// - [JsonInclude, JsonPropertyName("custom_settings")] public object? CustomSettings { get; set; } /// @@ -202,7 +403,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to model_snapshot_retention_days. /// /// - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] public long? DailyModelSnapshotRetentionAfterDays { get; set; } /// @@ -210,15 +410,17 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. /// /// - [JsonInclude, JsonPropertyName("data_description")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; set; } /// /// /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. /// /// - [JsonInclude, JsonPropertyName("datafeed_config")] public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? DatafeedConfig { get; set; } /// @@ -226,7 +428,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -234,15 +435,13 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// A list of job groups. A job can belong to no groups or many. /// /// - [JsonInclude, JsonPropertyName("groups")] - public ICollection? Groups { get; set; } + public System.Collections.Generic.ICollection? Groups { get; set; } /// /// /// The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. /// /// - [JsonInclude, JsonPropertyName("job_id")] public Elastic.Clients.Elasticsearch.Id? JobId { get; set; } /// @@ -250,7 +449,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. /// /// - [JsonInclude, JsonPropertyName("model_plot_config")] public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; set; } /// @@ -258,7 +456,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. By default, snapshots ten days older than the newest snapshot are deleted. /// /// - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] public long? ModelSnapshotRetentionDays { get; set; } /// @@ -266,7 +463,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans. /// /// - [JsonInclude, JsonPropertyName("renormalization_window_days")] public long? RenormalizationWindowDays { get; set; } /// @@ -274,7 +470,6 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// A text string that affects the name of the machine learning results index. By default, the job generates an index named .ml-anomalies-shared. /// /// - [JsonInclude, JsonPropertyName("results_index_name")] public Elastic.Clients.Elasticsearch.IndexName? ResultsIndexName { get; set; } /// @@ -282,69 +477,158 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Requi /// Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever. /// /// - [JsonInclude, JsonPropertyName("results_retention_days")] public long? ResultsRetentionDays { get; set; } } /// /// /// Create an anomaly detection job. +/// +/// /// If you include a datafeed_config, you must have read index privileges on the source index. /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. /// /// -public sealed partial class PutJobRequestDescriptor : RequestDescriptor, PutJobRequestParameters> +public readonly partial struct PutJobRequestDescriptor { - internal PutJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutJob; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutJobRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_job"; + /// + /// + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the + /// _all string or when no indices are specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } - public PutJobRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutJobRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutJobRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - - private bool? AllowLazyOpenValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action> AnalysisConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? BackgroundPersistIntervalValue { get; set; } - private object? CustomSettingsValue { get; set; } - private long? DailyModelSnapshotRetentionAfterDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor DataDescriptionDescriptor { get; set; } - private Action> DataDescriptionDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? DatafeedConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DatafeedConfigDescriptor { get; set; } - private Action> DatafeedConfigDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotConfigDescriptor { get; set; } - private Action> ModelPlotConfigDescriptorAction { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private long? RenormalizationWindowDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? ResultsIndexNameValue { get; set; } - private long? ResultsRetentionDaysValue { get; set; } + /// + /// + /// If true, unavailable indices (missing or closed) are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } /// /// /// Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. /// /// - public PutJobRequestDescriptor AllowLazyOpen(bool? allowLazyOpen = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AllowLazyOpen(bool? value = true) { - AllowLazyOpenValue = allowLazyOpen; - return Self; + Instance.AllowLazyOpen = value; + return this; } /// @@ -352,28 +636,32 @@ public PutJobRequestDescriptor AllowLazyOpen(bool? allowLazyOpen = tr /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. /// /// - public PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig analysisConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig value) { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance.AnalysisConfig = value; + return this; } - public PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + /// + /// + /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisConfig(System.Action action) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor AnalysisConfig(Action> configure) + /// + /// + /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } /// @@ -381,28 +669,32 @@ public PutJobRequestDescriptor AnalysisConfig(Action /// - public PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? value) { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AnalysisLimits = value; + return this; } - public PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor descriptor) + /// + /// + /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits() { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor AnalysisLimits(Action configure) + /// + /// + /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits(System.Action? action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(action); + return this; } /// @@ -410,10 +702,10 @@ public PutJobRequestDescriptor AnalysisLimits(Actionbackground_persist_interval value too low. /// /// - public PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? backgroundPersistInterval) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? value) { - BackgroundPersistIntervalValue = backgroundPersistInterval; - return Self; + Instance.BackgroundPersistInterval = value; + return this; } /// @@ -421,10 +713,10 @@ public PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clie /// Advanced configuration option. Contains custom meta data about the job. /// /// - public PutJobRequestDescriptor CustomSettings(object? customSettings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor CustomSettings(object? value) { - CustomSettingsValue = customSettings; - return Self; + Instance.CustomSettings = value; + return this; } /// @@ -432,10 +724,32 @@ public PutJobRequestDescriptor CustomSettings(object? customSettings) /// Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to model_snapshot_retention_days. /// /// - public PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? value) + { + Instance.DailyModelSnapshotRetentionAfterDays = value; + return this; + } + + /// + /// + /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription value) + { + Instance.DataDescription = value; + return this; + } + + /// + /// + /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription() { - DailyModelSnapshotRetentionAfterDaysValue = dailyModelSnapshotRetentionAfterDays; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(null); + return this; } /// @@ -443,28 +757,32 @@ public PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(l /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. /// /// - public PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription dataDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription(System.Action? action) { - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = null; - DataDescriptionValue = dataDescription; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) + /// + /// + /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription(System.Action>? action) { - DataDescriptionValue = null; - DataDescriptionDescriptorAction = null; - DataDescriptionDescriptor = descriptor; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor DataDescription(Action> configure) + /// + /// + /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? value) { - DataDescriptionValue = null; - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = configure; - return Self; + Instance.DatafeedConfig = value; + return this; } /// @@ -472,28 +790,32 @@ public PutJobRequestDescriptor DataDescription(Action /// - public PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? datafeedConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig() { - DatafeedConfigDescriptor = null; - DatafeedConfigDescriptorAction = null; - DatafeedConfigValue = datafeedConfig; - return Self; + Instance.DatafeedConfig = Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor descriptor) + /// + /// + /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig(System.Action? action) { - DatafeedConfigValue = null; - DatafeedConfigDescriptorAction = null; - DatafeedConfigDescriptor = descriptor; - return Self; + Instance.DatafeedConfig = Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor DatafeedConfig(Action> configure) + /// + /// + /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig(System.Action>? action) { - DatafeedConfigValue = null; - DatafeedConfigDescriptor = null; - DatafeedConfigDescriptorAction = configure; - return Self; + Instance.DatafeedConfig = Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor.Build(action); + return this; } /// @@ -501,10 +823,10 @@ public PutJobRequestDescriptor DatafeedConfig(Action /// - public PutJobRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -512,10 +834,21 @@ public PutJobRequestDescriptor Description(string? description) /// A list of job groups. A job can belong to no groups or many. /// /// - public PutJobRequestDescriptor Groups(ICollection? groups) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Groups(System.Collections.Generic.ICollection? value) { - GroupsValue = groups; - return Self; + Instance.Groups = value; + return this; + } + + /// + /// + /// A list of job groups. A job can belong to no groups or many. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Groups(params string[] values) + { + Instance.Groups = [.. values]; + return this; } /// @@ -523,10 +856,21 @@ public PutJobRequestDescriptor Groups(ICollection? groups) /// The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. /// /// - public PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.JobId = value; + return this; + } + + /// + /// + /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - JobIdValue = jobId; - return Self; + Instance.ModelPlotConfig = value; + return this; } /// @@ -534,28 +878,32 @@ public PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. /// /// - public PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlotConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig() { - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigValue = modelPlotConfig; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + /// + /// + /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig(System.Action? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigDescriptor = descriptor; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor ModelPlotConfig(Action> configure) + /// + /// + /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig(System.Action>? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = configure; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } /// @@ -563,10 +911,10 @@ public PutJobRequestDescriptor ModelPlotConfig(Action /// - public PutJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } /// @@ -574,10 +922,10 @@ public PutJobRequestDescriptor ModelSnapshotRetentionDays(long? model /// Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans. /// /// - public PutJobRequestDescriptor RenormalizationWindowDays(long? renormalizationWindowDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RenormalizationWindowDays(long? value) { - RenormalizationWindowDaysValue = renormalizationWindowDays; - return Self; + Instance.RenormalizationWindowDays = value; + return this; } /// @@ -585,10 +933,10 @@ public PutJobRequestDescriptor RenormalizationWindowDays(long? renorm /// A text string that affects the name of the machine learning results index. By default, the job generates an index named .ml-anomalies-shared. /// /// - public PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? resultsIndexName) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? value) { - ResultsIndexNameValue = resultsIndexName; - return Self; + Instance.ResultsIndexName = value; + return this; } /// @@ -596,253 +944,234 @@ public PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elast /// Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever. /// /// - public PutJobRequestDescriptor ResultsRetentionDays(long? resultsRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ResultsRetentionDays(long? value) { - ResultsRetentionDaysValue = resultsRetentionDays; - return Self; + Instance.ResultsRetentionDays = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowLazyOpenValue.HasValue) - { - writer.WritePropertyName("allow_lazy_open"); - writer.WriteBooleanValue(AllowLazyOpenValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (AnalysisConfigDescriptor is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (BackgroundPersistIntervalValue is not null) - { - writer.WritePropertyName("background_persist_interval"); - JsonSerializer.Serialize(writer, BackgroundPersistIntervalValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (CustomSettingsValue is not null) - { - writer.WritePropertyName("custom_settings"); - JsonSerializer.Serialize(writer, CustomSettingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (DailyModelSnapshotRetentionAfterDaysValue.HasValue) - { - writer.WritePropertyName("daily_model_snapshot_retention_after_days"); - writer.WriteNumberValue(DailyModelSnapshotRetentionAfterDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (DataDescriptionDescriptor is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionDescriptor, options); - } - else if (DataDescriptionDescriptorAction is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(DataDescriptionDescriptorAction), options); - } - else - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionValue, options); - } - - if (DatafeedConfigDescriptor is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, DatafeedConfigDescriptor, options); - } - else if (DatafeedConfigDescriptorAction is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(DatafeedConfigDescriptorAction), options); - } - else if (DatafeedConfigValue is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, DatafeedConfigValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GroupsValue is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } - - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } - - if (ModelPlotConfigDescriptor is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigDescriptor, options); - } - else if (ModelPlotConfigDescriptorAction is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotConfigDescriptorAction), options); - } - else if (ModelPlotConfigValue is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigValue, options); - } - - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } - - if (RenormalizationWindowDaysValue.HasValue) - { - writer.WritePropertyName("renormalization_window_days"); - writer.WriteNumberValue(RenormalizationWindowDaysValue.Value); - } - - if (ResultsIndexNameValue is not null) - { - writer.WritePropertyName("results_index_name"); - JsonSerializer.Serialize(writer, ResultsIndexNameValue, options); - } - - if (ResultsRetentionDaysValue.HasValue) - { - writer.WritePropertyName("results_retention_days"); - writer.WriteNumberValue(ResultsRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Create an anomaly detection job. +/// +/// /// If you include a datafeed_config, you must have read index privileges on the source index. /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. /// /// -public sealed partial class PutJobRequestDescriptor : RequestDescriptor +public readonly partial struct PutJobRequestDescriptor { - internal PutJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutJob; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutJobRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_job"; + /// + /// + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the + /// _all string or when no indices are specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public PutJobRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public PutJobRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public PutJobRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - - private bool? AllowLazyOpenValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action AnalysisConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? BackgroundPersistIntervalValue { get; set; } - private object? CustomSettingsValue { get; set; } - private long? DailyModelSnapshotRetentionAfterDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor DataDescriptionDescriptor { get; set; } - private Action DataDescriptionDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? DatafeedConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DatafeedConfigDescriptor { get; set; } - private Action DatafeedConfigDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotConfigDescriptor { get; set; } - private Action ModelPlotConfigDescriptorAction { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private long? RenormalizationWindowDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? ResultsIndexNameValue { get; set; } - private long? ResultsRetentionDaysValue { get; set; } + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } /// /// - /// Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. + /// If true, unavailable indices (missing or closed) are ignored. /// /// - public PutJobRequestDescriptor AllowLazyOpen(bool? allowLazyOpen = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor IgnoreUnavailable(bool? value = true) { - AllowLazyOpenValue = allowLazyOpen; - return Self; + Instance.IgnoreUnavailable = value; + return this; } /// /// - /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. + /// Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. /// /// - public PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig analysisConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AllowLazyOpen(bool? value = true) { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance.AllowLazyOpen = value; + return this; } - public PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + /// + /// + /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig value) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.AnalysisConfig = value; + return this; } - public PutJobRequestDescriptor AnalysisConfig(Action configure) + /// + /// + /// Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } /// @@ -850,28 +1179,32 @@ public PutJobRequestDescriptor AnalysisConfig(Action /// - public PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? value) { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AnalysisLimits = value; + return this; } - public PutJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor descriptor) + /// + /// + /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits() { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor AnalysisLimits(Action configure) + /// + /// + /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor AnalysisLimits(System.Action? action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(action); + return this; } /// @@ -879,10 +1212,10 @@ public PutJobRequestDescriptor AnalysisLimits(Actionbackground_persist_interval value too low. /// /// - public PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? backgroundPersistInterval) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? value) { - BackgroundPersistIntervalValue = backgroundPersistInterval; - return Self; + Instance.BackgroundPersistInterval = value; + return this; } /// @@ -890,10 +1223,10 @@ public PutJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elastic /// Advanced configuration option. Contains custom meta data about the job. /// /// - public PutJobRequestDescriptor CustomSettings(object? customSettings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor CustomSettings(object? value) { - CustomSettingsValue = customSettings; - return Self; + Instance.CustomSettings = value; + return this; } /// @@ -901,10 +1234,10 @@ public PutJobRequestDescriptor CustomSettings(object? customSettings) /// Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to model_snapshot_retention_days. /// /// - public PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? value) { - DailyModelSnapshotRetentionAfterDaysValue = dailyModelSnapshotRetentionAfterDays; - return Self; + Instance.DailyModelSnapshotRetentionAfterDays = value; + return this; } /// @@ -912,28 +1245,32 @@ public PutJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyM /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. /// /// - public PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription dataDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription value) { - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = null; - DataDescriptionValue = dataDescription; - return Self; + Instance.DataDescription = value; + return this; } - public PutJobRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) + /// + /// + /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription() { - DataDescriptionValue = null; - DataDescriptionDescriptorAction = null; - DataDescriptionDescriptor = descriptor; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor DataDescription(Action configure) + /// + /// + /// Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DataDescription(System.Action>? action) { - DataDescriptionValue = null; - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = configure; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } /// @@ -941,28 +1278,32 @@ public PutJobRequestDescriptor DataDescription(Action /// - public PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? datafeedConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig? value) { - DatafeedConfigDescriptor = null; - DatafeedConfigDescriptorAction = null; - DatafeedConfigValue = datafeedConfig; - return Self; + Instance.DatafeedConfig = value; + return this; } - public PutJobRequestDescriptor DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor descriptor) + /// + /// + /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig() { - DatafeedConfigValue = null; - DatafeedConfigDescriptorAction = null; - DatafeedConfigDescriptor = descriptor; - return Self; + Instance.DatafeedConfig = Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor DatafeedConfig(Action configure) + /// + /// + /// Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor DatafeedConfig(System.Action>? action) { - DatafeedConfigValue = null; - DatafeedConfigDescriptor = null; - DatafeedConfigDescriptorAction = configure; - return Self; + Instance.DatafeedConfig = Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor.Build(action); + return this; } /// @@ -970,10 +1311,10 @@ public PutJobRequestDescriptor DatafeedConfig(Action /// - public PutJobRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -981,10 +1322,21 @@ public PutJobRequestDescriptor Description(string? description) /// A list of job groups. A job can belong to no groups or many. /// /// - public PutJobRequestDescriptor Groups(ICollection? groups) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Groups(System.Collections.Generic.ICollection? value) { - GroupsValue = groups; - return Self; + Instance.Groups = value; + return this; + } + + /// + /// + /// A list of job groups. A job can belong to no groups or many. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Groups(params string[] values) + { + Instance.Groups = [.. values]; + return this; } /// @@ -992,10 +1344,10 @@ public PutJobRequestDescriptor Groups(ICollection? groups) /// The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. /// /// - public PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -1003,28 +1355,32 @@ public PutJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. /// /// - public PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlotConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigValue = modelPlotConfig; - return Self; + Instance.ModelPlotConfig = value; + return this; } - public PutJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + /// + /// + /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig() { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigDescriptor = descriptor; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor ModelPlotConfig(Action configure) + /// + /// + /// This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelPlotConfig(System.Action>? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = configure; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } /// @@ -1032,10 +1388,10 @@ public PutJobRequestDescriptor ModelPlotConfig(Action /// - public PutJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } /// @@ -1043,10 +1399,10 @@ public PutJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRet /// Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans. /// /// - public PutJobRequestDescriptor RenormalizationWindowDays(long? renormalizationWindowDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RenormalizationWindowDays(long? value) { - RenormalizationWindowDaysValue = renormalizationWindowDays; - return Self; + Instance.RenormalizationWindowDays = value; + return this; } /// @@ -1054,10 +1410,10 @@ public PutJobRequestDescriptor RenormalizationWindowDays(long? renormalizationWi /// A text string that affects the name of the machine learning results index. By default, the job generates an index named .ml-anomalies-shared. /// /// - public PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? resultsIndexName) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? value) { - ResultsIndexNameValue = resultsIndexName; - return Self; + Instance.ResultsIndexName = value; + return this; } /// @@ -1065,161 +1421,59 @@ public PutJobRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.In /// Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever. /// /// - public PutJobRequestDescriptor ResultsRetentionDays(long? resultsRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ResultsRetentionDays(long? value) { - ResultsRetentionDaysValue = resultsRetentionDays; - return Self; + Instance.ResultsRetentionDays = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AllowLazyOpenValue.HasValue) - { - writer.WritePropertyName("allow_lazy_open"); - writer.WriteBooleanValue(AllowLazyOpenValue.Value); - } - - if (AnalysisConfigDescriptor is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); - } - - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); - } - - if (BackgroundPersistIntervalValue is not null) - { - writer.WritePropertyName("background_persist_interval"); - JsonSerializer.Serialize(writer, BackgroundPersistIntervalValue, options); - } - - if (CustomSettingsValue is not null) - { - writer.WritePropertyName("custom_settings"); - JsonSerializer.Serialize(writer, CustomSettingsValue, options); - } - - if (DailyModelSnapshotRetentionAfterDaysValue.HasValue) - { - writer.WritePropertyName("daily_model_snapshot_retention_after_days"); - writer.WriteNumberValue(DailyModelSnapshotRetentionAfterDaysValue.Value); - } - - if (DataDescriptionDescriptor is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionDescriptor, options); - } - else if (DataDescriptionDescriptorAction is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(DataDescriptionDescriptorAction), options); - } - else - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionValue, options); - } - - if (DatafeedConfigDescriptor is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, DatafeedConfigDescriptor, options); - } - else if (DatafeedConfigDescriptorAction is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(DatafeedConfigDescriptorAction), options); - } - else if (DatafeedConfigValue is not null) - { - writer.WritePropertyName("datafeed_config"); - JsonSerializer.Serialize(writer, DatafeedConfigValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GroupsValue is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ModelPlotConfigDescriptor is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigDescriptor, options); - } - else if (ModelPlotConfigDescriptorAction is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotConfigDescriptorAction), options); - } - else if (ModelPlotConfigValue is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RenormalizationWindowDaysValue.HasValue) - { - writer.WritePropertyName("renormalization_window_days"); - writer.WriteNumberValue(RenormalizationWindowDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ResultsIndexNameValue is not null) - { - writer.WritePropertyName("results_index_name"); - JsonSerializer.Serialize(writer, ResultsIndexNameValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ResultsRetentionDaysValue.HasValue) - { - writer.WritePropertyName("results_retention_days"); - writer.WriteNumberValue(ResultsRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobResponse.g.cs index cd8cb1f1ccf..58e51bc043d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutJobResponse.g.cs @@ -17,55 +17,298 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutJobResponse : ElasticsearchResponse +internal sealed partial class PutJobResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyOpen = System.Text.Json.JsonEncodedText.Encode("allow_lazy_open"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropBackgroundPersistInterval = System.Text.Json.JsonEncodedText.Encode("background_persist_interval"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropCustomSettings = System.Text.Json.JsonEncodedText.Encode("custom_settings"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropDataDescription = System.Text.Json.JsonEncodedText.Encode("data_description"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedConfig = System.Text.Json.JsonEncodedText.Encode("datafeed_config"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropJobType = System.Text.Json.JsonEncodedText.Encode("job_type"); + private static readonly System.Text.Json.JsonEncodedText PropJobVersion = System.Text.Json.JsonEncodedText.Encode("job_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlotConfig = System.Text.Json.JsonEncodedText.Encode("model_plot_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotId = System.Text.Json.JsonEncodedText.Encode("model_snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropRenormalizationWindowDays = System.Text.Json.JsonEncodedText.Encode("renormalization_window_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsIndexName = System.Text.Json.JsonEncodedText.Encode("results_index_name"); + private static readonly System.Text.Json.JsonEncodedText PropResultsRetentionDays = System.Text.Json.JsonEncodedText.Encode("results_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyOpen = default; + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propBackgroundPersistInterval = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propCustomSettings = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propDataDescription = default; + LocalJsonValue propDatafeedConfig = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propJobId = default; + LocalJsonValue propJobType = default; + LocalJsonValue propJobVersion = default; + LocalJsonValue propModelPlotConfig = default; + LocalJsonValue propModelSnapshotId = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propRenormalizationWindowDays = default; + LocalJsonValue propResultsIndexName = default; + LocalJsonValue propResultsRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyOpen.TryReadProperty(ref reader, options, PropAllowLazyOpen, null)) + { + continue; + } + + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propBackgroundPersistInterval.TryReadProperty(ref reader, options, PropBackgroundPersistInterval, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCustomSettings.TryReadProperty(ref reader, options, PropCustomSettings, null)) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propDataDescription.TryReadProperty(ref reader, options, PropDataDescription, null)) + { + continue; + } + + if (propDatafeedConfig.TryReadProperty(ref reader, options, PropDatafeedConfig, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propJobType.TryReadProperty(ref reader, options, PropJobType, null)) + { + continue; + } + + if (propJobVersion.TryReadProperty(ref reader, options, PropJobVersion, null)) + { + continue; + } + + if (propModelPlotConfig.TryReadProperty(ref reader, options, PropModelPlotConfig, null)) + { + continue; + } + + if (propModelSnapshotId.TryReadProperty(ref reader, options, PropModelSnapshotId, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propRenormalizationWindowDays.TryReadProperty(ref reader, options, PropRenormalizationWindowDays, null)) + { + continue; + } + + if (propResultsIndexName.TryReadProperty(ref reader, options, PropResultsIndexName, null)) + { + continue; + } + + if (propResultsRetentionDays.TryReadProperty(ref reader, options, PropResultsRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyOpen = propAllowLazyOpen.Value, + AnalysisConfig = propAnalysisConfig.Value, + AnalysisLimits = propAnalysisLimits.Value, + BackgroundPersistInterval = propBackgroundPersistInterval.Value, + CreateTime = propCreateTime.Value, + CustomSettings = propCustomSettings.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + DataDescription = propDataDescription.Value, + DatafeedConfig = propDatafeedConfig.Value, + Description = propDescription.Value, + Groups = propGroups.Value, + JobId = propJobId.Value, + JobType = propJobType.Value, + JobVersion = propJobVersion.Value, + ModelPlotConfig = propModelPlotConfig.Value, + ModelSnapshotId = propModelSnapshotId.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + RenormalizationWindowDays = propRenormalizationWindowDays.Value, + ResultsIndexName = propResultsIndexName.Value, + ResultsRetentionDays = propResultsRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyOpen, value.AllowLazyOpen, null, null); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropBackgroundPersistInterval, value.BackgroundPersistInterval, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCustomSettings, value.CustomSettings, null, null); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropDataDescription, value.DataDescription, null, null); + writer.WriteProperty(options, PropDatafeedConfig, value.DatafeedConfig, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropJobType, value.JobType, null, null); + writer.WriteProperty(options, PropJobVersion, value.JobVersion, null, null); + writer.WriteProperty(options, PropModelPlotConfig, value.ModelPlotConfig, null, null); + writer.WriteProperty(options, PropModelSnapshotId, value.ModelSnapshotId, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropRenormalizationWindowDays, value.RenormalizationWindowDays, null, null); + writer.WriteProperty(options, PropResultsIndexName, value.ResultsIndexName, null, null); + writer.WriteProperty(options, PropResultsRetentionDays, value.ResultsRetentionDays, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponseConverter))] +public sealed partial class PutJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("allow_lazy_open")] - public bool AllowLazyOpen { get; init; } - [JsonInclude, JsonPropertyName("analysis_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead AnalysisConfig { get; init; } - [JsonInclude, JsonPropertyName("analysis_limits")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits AnalysisLimits { get; init; } - [JsonInclude, JsonPropertyName("background_persist_interval")] - public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public DateTimeOffset CreateTime { get; init; } - [JsonInclude, JsonPropertyName("custom_settings")] - public object? CustomSettings { get; init; } - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] - public long DailyModelSnapshotRetentionAfterDays { get; init; } - [JsonInclude, JsonPropertyName("data_description")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; init; } - [JsonInclude, JsonPropertyName("datafeed_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("groups")] - public IReadOnlyCollection? Groups { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("job_type")] - public string JobType { get; init; } - [JsonInclude, JsonPropertyName("job_version")] - public string JobVersion { get; init; } - [JsonInclude, JsonPropertyName("model_plot_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_id")] - public string? ModelSnapshotId { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] - public long ModelSnapshotRetentionDays { get; init; } - [JsonInclude, JsonPropertyName("renormalization_window_days")] - public long? RenormalizationWindowDays { get; init; } - [JsonInclude, JsonPropertyName("results_index_name")] - public string ResultsIndexName { get; init; } - [JsonInclude, JsonPropertyName("results_retention_days")] - public long? ResultsRetentionDays { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowLazyOpen { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead AnalysisConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits AnalysisLimits { get; set; } + public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset CreateTime { get; set; } + public object? CustomSettings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DailyModelSnapshotRetentionAfterDays { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; set; } + public string? Description { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Groups { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobVersion { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; set; } + public string? ModelSnapshotId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ModelSnapshotRetentionDays { get; set; } + public long? RenormalizationWindowDays { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultsIndexName { get; set; } + public long? ResultsRetentionDays { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasRequest.g.cs index c2a8fb886fc..23af5935a90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelAliasRequestParameters : RequestParameters +public sealed partial class PutTrainedModelAliasRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,6 +35,35 @@ public sealed partial class PutTrainedModelAliasRequestParameters : RequestParam public bool? Reassign { get => Q("reassign"); set => Q("reassign", value); } } +internal sealed partial class PutTrainedModelAliasRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a trained model alias. @@ -63,20 +85,54 @@ public sealed partial class PutTrainedModelAliasRequestParameters : RequestParam /// returns a warning. /// /// -public sealed partial class PutTrainedModelAliasRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestConverter))] +public sealed partial class PutTrainedModelAliasRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) : base(r => r.Required("model_id", modelId).Required("model_alias", modelAlias)) { } +#if NET7_0_OR_GREATER + public PutTrainedModelAliasRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelAlias; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutTrainedModelAlias; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "ml.put_trained_model_alias"; + /// + /// + /// The alias to create or update. This value cannot end in numbers. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name ModelAlias { get => P("model_alias"); set => PR("model_alias", value); } + + /// + /// + /// The identifier for the trained model that the alias refers to. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// Specifies whether the alias gets reassigned to the specified trained @@ -84,7 +140,6 @@ public PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Id modelId, Ela /// already assigned and this parameter is false, the API returns an error. /// /// - [JsonIgnore] public bool? Reassign { get => Q("reassign"); set => Q("reassign", value); } } @@ -109,37 +164,112 @@ public PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Id modelId, Ela /// returns a warning. /// /// -public sealed partial class PutTrainedModelAliasRequestDescriptor : RequestDescriptor +public readonly partial struct PutTrainedModelAliasRequestDescriptor { - internal PutTrainedModelAliasRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest Instance { get; init; } - public PutTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) : base(r => r.Required("model_id", modelId).Required("model_alias", modelAlias)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelAlias; + public PutTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest(modelId, modelAlias); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTrainedModelAliasRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.put_trained_model_alias"; + /// + /// + /// The alias to create or update. This value cannot end in numbers. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor ModelAlias(Elastic.Clients.Elasticsearch.Name value) + { + Instance.ModelAlias = value; + return this; + } + + /// + /// + /// The identifier for the trained model that the alias refers to. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// Specifies whether the alias gets reassigned to the specified trained + /// model if it is already assigned to a different model. If the alias is + /// already assigned and this parameter is false, the API returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor Reassign(bool? value = true) + { + Instance.Reassign = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public PutTrainedModelAliasRequestDescriptor Reassign(bool? reassign = true) => Qs("reassign", reassign); + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public PutTrainedModelAliasRequestDescriptor ModelAlias(Elastic.Clients.Elasticsearch.Name modelAlias) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("model_alias", modelAlias); - return Self; + Instance.SourceQueryString = value; + return this; } - public PutTrainedModelAliasRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasResponse.g.cs index 0e3e893281e..04608887c50 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelAliasResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelAliasResponse : ElasticsearchResponse +internal sealed partial class PutTrainedModelAliasResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponseConverter))] +public sealed partial class PutTrainedModelAliasResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelAliasResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelAliasResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartRequest.g.cs index 949f8e5915c..2dbe1357913 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartRequest.g.cs @@ -17,65 +17,168 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelDefinitionPartRequestParameters : RequestParameters +public sealed partial class PutTrainedModelDefinitionPartRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutTrainedModelDefinitionPartRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefinition = System.Text.Json.JsonEncodedText.Encode("definition"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDefinitionLength = System.Text.Json.JsonEncodedText.Encode("total_definition_length"); + private static readonly System.Text.Json.JsonEncodedText PropTotalParts = System.Text.Json.JsonEncodedText.Encode("total_parts"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefinition = default; + LocalJsonValue propTotalDefinitionLength = default; + LocalJsonValue propTotalParts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefinition.TryReadProperty(ref reader, options, PropDefinition, null)) + { + continue; + } + + if (propTotalDefinitionLength.TryReadProperty(ref reader, options, PropTotalDefinitionLength, null)) + { + continue; + } + + if (propTotalParts.TryReadProperty(ref reader, options, PropTotalParts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Definition = propDefinition.Value, + TotalDefinitionLength = propTotalDefinitionLength.Value, + TotalParts = propTotalParts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefinition, value.Definition, null, null); + writer.WriteProperty(options, PropTotalDefinitionLength, value.TotalDefinitionLength, null, null); + writer.WriteProperty(options, PropTotalParts, value.TotalParts, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create part of a trained model definition. /// /// -public sealed partial class PutTrainedModelDefinitionPartRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestConverter))] +public sealed partial class PutTrainedModelDefinitionPartRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Id modelId, int part) : base(r => r.Required("model_id", modelId).Required("part", part)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelDefinitionPart; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Id modelId, int part, string definition, long totalDefinitionLength, int totalParts) : base(r => r.Required("model_id", modelId).Required("part", part)) + { + Definition = definition; + TotalDefinitionLength = totalDefinitionLength; + TotalParts = totalParts; + } +#if NET7_0_OR_GREATER + public PutTrainedModelDefinitionPartRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutTrainedModelDefinitionPart; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_trained_model_definition_part"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + + /// + /// + /// The definition part number. When the definition is loaded for inference the definition parts are streamed in the + /// order of their part number. The first part must be 0 and the final part must be total_parts - 1. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int Part { get => P("part"); set => PR("part", value); } + /// /// /// The definition part for the model. Must be a base64 encoded string. /// /// - [JsonInclude, JsonPropertyName("definition")] - public string Definition { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Definition { get; set; } /// /// /// The total uncompressed definition length in bytes. Not base64 encoded. /// /// - [JsonInclude, JsonPropertyName("total_definition_length")] - public long TotalDefinitionLength { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalDefinitionLength { get; set; } /// /// /// The total number of parts that will be uploaded. Must be greater than 0. /// /// - [JsonInclude, JsonPropertyName("total_parts")] - public int TotalParts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalParts { get; set; } } /// @@ -83,47 +186,64 @@ public PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Id mod /// Create part of a trained model definition. /// /// -public sealed partial class PutTrainedModelDefinitionPartRequestDescriptor : RequestDescriptor +public readonly partial struct PutTrainedModelDefinitionPartRequestDescriptor { - internal PutTrainedModelDefinitionPartRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest Instance { get; init; } - public PutTrainedModelDefinitionPartRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, int part) : base(r => r.Required("model_id", modelId).Required("part", part)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelDefinitionPartRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelDefinitionPart; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutTrainedModelDefinitionPartRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId, int part) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest(modelId, part); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTrainedModelDefinitionPartRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_trained_model_definition_part"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor descriptor) => descriptor.Instance; - public PutTrainedModelDefinitionPartRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.ModelId = value; + return this; } - public PutTrainedModelDefinitionPartRequestDescriptor Part(int part) + /// + /// + /// The definition part number. When the definition is loaded for inference the definition parts are streamed in the + /// order of their part number. The first part must be 0 and the final part must be total_parts - 1. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor Part(int value) { - RouteValues.Required("part", part); - return Self; + Instance.Part = value; + return this; } - private string DefinitionValue { get; set; } - private long TotalDefinitionLengthValue { get; set; } - private int TotalPartsValue { get; set; } - /// /// /// The definition part for the model. Must be a base64 encoded string. /// /// - public PutTrainedModelDefinitionPartRequestDescriptor Definition(string definition) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor Definition(string value) { - DefinitionValue = definition; - return Self; + Instance.Definition = value; + return this; } /// @@ -131,10 +251,10 @@ public PutTrainedModelDefinitionPartRequestDescriptor Definition(string definiti /// The total uncompressed definition length in bytes. Not base64 encoded. /// /// - public PutTrainedModelDefinitionPartRequestDescriptor TotalDefinitionLength(long totalDefinitionLength) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor TotalDefinitionLength(long value) { - TotalDefinitionLengthValue = totalDefinitionLength; - return Self; + Instance.TotalDefinitionLength = value; + return this; } /// @@ -142,21 +262,59 @@ public PutTrainedModelDefinitionPartRequestDescriptor TotalDefinitionLength(long /// The total number of parts that will be uploaded. Must be greater than 0. /// /// - public PutTrainedModelDefinitionPartRequestDescriptor TotalParts(int totalParts) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor TotalParts(int value) { - TotalPartsValue = totalParts; - return Self; + Instance.TotalParts = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("definition"); - writer.WriteStringValue(DefinitionValue); - writer.WritePropertyName("total_definition_length"); - writer.WriteNumberValue(TotalDefinitionLengthValue); - writer.WritePropertyName("total_parts"); - writer.WriteNumberValue(TotalPartsValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartResponse.g.cs index 683d8780c23..347c1928fe6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelDefinitionPartResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelDefinitionPartResponse : ElasticsearchResponse +internal sealed partial class PutTrainedModelDefinitionPartResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponseConverter))] +public sealed partial class PutTrainedModelDefinitionPartResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelDefinitionPartResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelDefinitionPartResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelRequest.g.cs index d5c5f91da95..9592c96c54e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelRequestParameters : RequestParameters +public sealed partial class PutTrainedModelRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -50,26 +43,178 @@ public sealed partial class PutTrainedModelRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class PutTrainedModelRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompressedDefinition = System.Text.Json.JsonEncodedText.Encode("compressed_definition"); + private static readonly System.Text.Json.JsonEncodedText PropDefinition = System.Text.Json.JsonEncodedText.Encode("definition"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeBytes = System.Text.Json.JsonEncodedText.Encode("model_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropModelType = System.Text.Json.JsonEncodedText.Encode("model_type"); + private static readonly System.Text.Json.JsonEncodedText PropPlatformArchitecture = System.Text.Json.JsonEncodedText.Encode("platform_architecture"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixStrings = System.Text.Json.JsonEncodedText.Encode("prefix_strings"); + private static readonly System.Text.Json.JsonEncodedText PropTags = System.Text.Json.JsonEncodedText.Encode("tags"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompressedDefinition = default; + LocalJsonValue propDefinition = default; + LocalJsonValue propDescription = default; + LocalJsonValue propInferenceConfig = default; + LocalJsonValue propInput = default; + LocalJsonValue propMetadata = default; + LocalJsonValue propModelSizeBytes = default; + LocalJsonValue propModelType = default; + LocalJsonValue propPlatformArchitecture = default; + LocalJsonValue propPrefixStrings = default; + LocalJsonValue?> propTags = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompressedDefinition.TryReadProperty(ref reader, options, PropCompressedDefinition, null)) + { + continue; + } + + if (propDefinition.TryReadProperty(ref reader, options, PropDefinition, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (propInput.TryReadProperty(ref reader, options, PropInput, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (propModelSizeBytes.TryReadProperty(ref reader, options, PropModelSizeBytes, null)) + { + continue; + } + + if (propModelType.TryReadProperty(ref reader, options, PropModelType, null)) + { + continue; + } + + if (propPlatformArchitecture.TryReadProperty(ref reader, options, PropPlatformArchitecture, null)) + { + continue; + } + + if (propPrefixStrings.TryReadProperty(ref reader, options, PropPrefixStrings, null)) + { + continue; + } + + if (propTags.TryReadProperty(ref reader, options, PropTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompressedDefinition = propCompressedDefinition.Value, + Definition = propDefinition.Value, + Description = propDescription.Value, + InferenceConfig = propInferenceConfig.Value, + Input = propInput.Value, + Metadata = propMetadata.Value, + ModelSizeBytes = propModelSizeBytes.Value, + ModelType = propModelType.Value, + PlatformArchitecture = propPlatformArchitecture.Value, + PrefixStrings = propPrefixStrings.Value, + Tags = propTags.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompressedDefinition, value.CompressedDefinition, null, null); + writer.WriteProperty(options, PropDefinition, value.Definition, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteProperty(options, PropInput, value.Input, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteProperty(options, PropModelSizeBytes, value.ModelSizeBytes, null, null); + writer.WriteProperty(options, PropModelType, value.ModelType, null, null); + writer.WriteProperty(options, PropPlatformArchitecture, value.PlatformArchitecture, null, null); + writer.WriteProperty(options, PropPrefixStrings, value.PrefixStrings, null, null); + writer.WriteProperty(options, PropTags, value.Tags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create a trained model. /// Enable you to supply a trained model that is not created by data frame analytics. /// /// -public sealed partial class PutTrainedModelRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestConverter))] +public sealed partial class PutTrainedModelRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public PutTrainedModelRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModel; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutTrainedModel; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_trained_model"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// If set to true and a compressed_definition is provided, @@ -77,7 +222,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// validations. /// /// - [JsonIgnore] public bool? DeferDefinitionDecompression { get => Q("defer_definition_decompression"); set => Q("defer_definition_decompression", value); } /// @@ -86,7 +230,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// to complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// @@ -96,7 +239,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// specified. /// /// - [JsonInclude, JsonPropertyName("compressed_definition")] public string? CompressedDefinition { get; set; } /// @@ -105,7 +247,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// compressed_definition cannot be specified. /// /// - [JsonInclude, JsonPropertyName("definition")] public Elastic.Clients.Elasticsearch.MachineLearning.Definition? Definition { get; set; } /// @@ -113,7 +254,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// A human-readable description of the inference trained model. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -124,7 +264,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// ELSER the config is not required. /// /// - [JsonInclude, JsonPropertyName("inference_config")] public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfig { get; set; } /// @@ -132,7 +271,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// The input field names for the model definition. /// /// - [JsonInclude, JsonPropertyName("input")] public Elastic.Clients.Elasticsearch.MachineLearning.Input? Input { get; set; } /// @@ -140,7 +278,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// An object map that contains metadata about the model. /// /// - [JsonInclude, JsonPropertyName("metadata")] public object? Metadata { get; set; } /// @@ -150,7 +287,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// or the model definition is not supplied. /// /// - [JsonInclude, JsonPropertyName("model_size_bytes")] public long? ModelSizeBytes { get; set; } /// @@ -158,7 +294,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// The model type. /// /// - [JsonInclude, JsonPropertyName("model_type")] public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelType { get; set; } /// @@ -172,7 +307,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// architecture or OS features), leave this field unset. /// /// - [JsonInclude, JsonPropertyName("platform_architecture")] public string? PlatformArchitecture { get; set; } /// @@ -180,7 +314,6 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// Optional prefix strings applied at inference /// /// - [JsonInclude, JsonPropertyName("prefix_strings")] public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; set; } /// @@ -188,8 +321,7 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// An array of tags to organize the model. /// /// - [JsonInclude, JsonPropertyName("tags")] - public ICollection? Tags { get; set; } + public System.Collections.Generic.ICollection? Tags { get; set; } } /// @@ -198,50 +330,65 @@ public PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r /// Enable you to supply a trained model that is not created by data frame analytics. /// /// -public sealed partial class PutTrainedModelRequestDescriptor : RequestDescriptor, PutTrainedModelRequestParameters> +public readonly partial struct PutTrainedModelRequestDescriptor { - internal PutTrainedModelRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest Instance { get; init; } - public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModel; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(modelId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTrainedModelRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_trained_model"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor descriptor) => descriptor.Instance; - public PutTrainedModelRequestDescriptor DeferDefinitionDecompression(bool? deferDefinitionDecompression = true) => Qs("defer_definition_decompression", deferDefinitionDecompression); - public PutTrainedModelRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - public PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// If set to true and a compressed_definition is provided, + /// the request defers definition decompression and skips relevant + /// validations. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor DeferDefinitionDecompression(bool? value = true) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.DeferDefinitionDecompression = value; + return this; } - private string? CompressedDefinitionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Definition? DefinitionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor DefinitionDescriptor { get; set; } - private Action DefinitionDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor InferenceConfigDescriptor { get; set; } - private Action> InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Input? InputValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor InputDescriptor { get; set; } - private Action InputDescriptorAction { get; set; } - private object? MetadataValue { get; set; } - private long? ModelSizeBytesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelTypeValue { get; set; } - private string? PlatformArchitectureValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStringsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor PrefixStringsDescriptor { get; set; } - private Action PrefixStringsDescriptorAction { get; set; } - private ICollection? TagsValue { get; set; } + /// + /// + /// Whether to wait for all child operations (e.g. model download) + /// to complete. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } /// /// @@ -250,10 +397,10 @@ public PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elast /// specified. /// /// - public PutTrainedModelRequestDescriptor CompressedDefinition(string? compressedDefinition) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor CompressedDefinition(string? value) { - CompressedDefinitionValue = compressedDefinition; - return Self; + Instance.CompressedDefinition = value; + return this; } /// @@ -262,28 +409,22 @@ public PutTrainedModelRequestDescriptor CompressedDefinition(string? /// compressed_definition cannot be specified. /// /// - public PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.Definition? definition) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.Definition? value) { - DefinitionDescriptor = null; - DefinitionDescriptorAction = null; - DefinitionValue = definition; - return Self; + Instance.Definition = value; + return this; } - public PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor descriptor) - { - DefinitionValue = null; - DefinitionDescriptorAction = null; - DefinitionDescriptor = descriptor; - return Self; - } - - public PutTrainedModelRequestDescriptor Definition(Action configure) + /// + /// + /// The inference definition for the model. If definition is specified, then + /// compressed_definition cannot be specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Definition(System.Action action) { - DefinitionValue = null; - DefinitionDescriptor = null; - DefinitionDescriptorAction = configure; - return Self; + Instance.Definition = Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor.Build(action); + return this; } /// @@ -291,10 +432,10 @@ public PutTrainedModelRequestDescriptor Definition(Action /// - public PutTrainedModelRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -305,28 +446,38 @@ public PutTrainedModelRequestDescriptor Description(string? descripti /// ELSER the config is not required. /// /// - public PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? inferenceConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.InferenceConfig = value; + return this; } - public PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor descriptor) + /// + /// + /// The default configuration for inference. This can be either a regression + /// or classification configuration. It must match the underlying + /// definition.trained_model's target_type. For pre-packaged models such as + /// ELSER the config is not required. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor InferenceConfig(System.Action action) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor.Build(action); + return this; } - public PutTrainedModelRequestDescriptor InferenceConfig(Action> configure) + /// + /// + /// The default configuration for inference. This can be either a regression + /// or classification configuration. It must match the underlying + /// definition.trained_model's target_type. For pre-packaged models such as + /// ELSER the config is not required. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor.Build(action); + return this; } /// @@ -334,28 +485,21 @@ public PutTrainedModelRequestDescriptor InferenceConfig(Action /// - public PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.Input? input) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.Input? value) { - InputDescriptor = null; - InputDescriptorAction = null; - InputValue = input; - return Self; + Instance.Input = value; + return this; } - public PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor descriptor) - { - InputValue = null; - InputDescriptorAction = null; - InputDescriptor = descriptor; - return Self; - } - - public PutTrainedModelRequestDescriptor Input(Action configure) + /// + /// + /// The input field names for the model definition. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Input(System.Action action) { - InputValue = null; - InputDescriptor = null; - InputDescriptorAction = configure; - return Self; + Instance.Input = Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor.Build(action); + return this; } /// @@ -363,10 +507,10 @@ public PutTrainedModelRequestDescriptor Input(Action /// - public PutTrainedModelRequestDescriptor Metadata(object? metadata) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Metadata(object? value) { - MetadataValue = metadata; - return Self; + Instance.Metadata = value; + return this; } /// @@ -376,10 +520,10 @@ public PutTrainedModelRequestDescriptor Metadata(object? metadata) /// or the model definition is not supplied. /// /// - public PutTrainedModelRequestDescriptor ModelSizeBytes(long? modelSizeBytes) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelSizeBytes(long? value) { - ModelSizeBytesValue = modelSizeBytes; - return Self; + Instance.ModelSizeBytes = value; + return this; } /// @@ -387,10 +531,10 @@ public PutTrainedModelRequestDescriptor ModelSizeBytes(long? modelSiz /// The model type. /// /// - public PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? modelType) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? value) { - ModelTypeValue = modelType; - return Self; + Instance.ModelType = value; + return this; } /// @@ -404,10 +548,10 @@ public PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Ela /// architecture or OS features), leave this field unset. /// /// - public PutTrainedModelRequestDescriptor PlatformArchitecture(string? platformArchitecture) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PlatformArchitecture(string? value) { - PlatformArchitectureValue = platformArchitecture; - return Self; + Instance.PlatformArchitecture = value; + return this; } /// @@ -415,28 +559,32 @@ public PutTrainedModelRequestDescriptor PlatformArchitecture(string? /// Optional prefix strings applied at inference /// /// - public PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? prefixStrings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? value) { - PrefixStringsDescriptor = null; - PrefixStringsDescriptorAction = null; - PrefixStringsValue = prefixStrings; - return Self; + Instance.PrefixStrings = value; + return this; } - public PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor descriptor) + /// + /// + /// Optional prefix strings applied at inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings() { - PrefixStringsValue = null; - PrefixStringsDescriptorAction = null; - PrefixStringsDescriptor = descriptor; - return Self; + Instance.PrefixStrings = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor.Build(null); + return this; } - public PutTrainedModelRequestDescriptor PrefixStrings(Action configure) + /// + /// + /// Optional prefix strings applied at inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings(System.Action? action) { - PrefixStringsValue = null; - PrefixStringsDescriptor = null; - PrefixStringsDescriptorAction = configure; - return Self; + Instance.PrefixStrings = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor.Build(action); + return this; } /// @@ -444,122 +592,71 @@ public PutTrainedModelRequestDescriptor PrefixStrings(Action /// - public PutTrainedModelRequestDescriptor Tags(ICollection? tags) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Tags(System.Collections.Generic.ICollection? value) { - TagsValue = tags; - return Self; + Instance.Tags = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of tags to organize the model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Tags(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CompressedDefinitionValue)) - { - writer.WritePropertyName("compressed_definition"); - writer.WriteStringValue(CompressedDefinitionValue); - } - - if (DefinitionDescriptor is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, DefinitionDescriptor, options); - } - else if (DefinitionDescriptorAction is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor(DefinitionDescriptorAction), options); - } - else if (DefinitionValue is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, DefinitionValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } + Instance.Tags = [.. values]; + return this; + } - if (InputDescriptor is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, InputDescriptor, options); - } - else if (InputDescriptorAction is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor(InputDescriptorAction), options); - } - else if (InputValue is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, InputValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ModelSizeBytesValue.HasValue) - { - writer.WritePropertyName("model_size_bytes"); - writer.WriteNumberValue(ModelSizeBytesValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelTypeValue is not null) - { - writer.WritePropertyName("model_type"); - JsonSerializer.Serialize(writer, ModelTypeValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(PlatformArchitectureValue)) - { - writer.WritePropertyName("platform_architecture"); - writer.WriteStringValue(PlatformArchitectureValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (PrefixStringsDescriptor is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, PrefixStringsDescriptor, options); - } - else if (PrefixStringsDescriptorAction is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor(PrefixStringsDescriptorAction), options); - } - else if (PrefixStringsValue is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, PrefixStringsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TagsValue is not null) - { - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, TagsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -569,50 +666,65 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Enable you to supply a trained model that is not created by data frame analytics. /// /// -public sealed partial class PutTrainedModelRequestDescriptor : RequestDescriptor +public readonly partial struct PutTrainedModelRequestDescriptor { - internal PutTrainedModelRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest Instance { get; init; } - public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModel; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(modelId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTrainedModelRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_trained_model"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor descriptor) => descriptor.Instance; - public PutTrainedModelRequestDescriptor DeferDefinitionDecompression(bool? deferDefinitionDecompression = true) => Qs("defer_definition_decompression", deferDefinitionDecompression); - public PutTrainedModelRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - public PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// If set to true and a compressed_definition is provided, + /// the request defers definition decompression and skips relevant + /// validations. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor DeferDefinitionDecompression(bool? value = true) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.DeferDefinitionDecompression = value; + return this; } - private string? CompressedDefinitionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Definition? DefinitionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor DefinitionDescriptor { get; set; } - private Action DefinitionDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Input? InputValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor InputDescriptor { get; set; } - private Action InputDescriptorAction { get; set; } - private object? MetadataValue { get; set; } - private long? ModelSizeBytesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelTypeValue { get; set; } - private string? PlatformArchitectureValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStringsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor PrefixStringsDescriptor { get; set; } - private Action PrefixStringsDescriptorAction { get; set; } - private ICollection? TagsValue { get; set; } + /// + /// + /// Whether to wait for all child operations (e.g. model download) + /// to complete. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } /// /// @@ -621,10 +733,10 @@ public PutTrainedModelRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id /// specified. /// /// - public PutTrainedModelRequestDescriptor CompressedDefinition(string? compressedDefinition) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor CompressedDefinition(string? value) { - CompressedDefinitionValue = compressedDefinition; - return Self; + Instance.CompressedDefinition = value; + return this; } /// @@ -633,28 +745,22 @@ public PutTrainedModelRequestDescriptor CompressedDefinition(string? compressedD /// compressed_definition cannot be specified. /// /// - public PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.Definition? definition) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.Definition? value) { - DefinitionDescriptor = null; - DefinitionDescriptorAction = null; - DefinitionValue = definition; - return Self; + Instance.Definition = value; + return this; } - public PutTrainedModelRequestDescriptor Definition(Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor descriptor) - { - DefinitionValue = null; - DefinitionDescriptorAction = null; - DefinitionDescriptor = descriptor; - return Self; - } - - public PutTrainedModelRequestDescriptor Definition(Action configure) + /// + /// + /// The inference definition for the model. If definition is specified, then + /// compressed_definition cannot be specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Definition(System.Action action) { - DefinitionValue = null; - DefinitionDescriptor = null; - DefinitionDescriptorAction = configure; - return Self; + Instance.Definition = Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor.Build(action); + return this; } /// @@ -662,10 +768,10 @@ public PutTrainedModelRequestDescriptor Definition(Action /// - public PutTrainedModelRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -676,28 +782,24 @@ public PutTrainedModelRequestDescriptor Description(string? description) /// ELSER the config is not required. /// /// - public PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? inferenceConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.InferenceConfig = value; + return this; } - public PutTrainedModelRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor descriptor) - { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; - } - - public PutTrainedModelRequestDescriptor InferenceConfig(Action configure) + /// + /// + /// The default configuration for inference. This can be either a regression + /// or classification configuration. It must match the underlying + /// definition.trained_model's target_type. For pre-packaged models such as + /// ELSER the config is not required. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor.Build(action); + return this; } /// @@ -705,28 +807,21 @@ public PutTrainedModelRequestDescriptor InferenceConfig(Action /// - public PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.Input? input) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.Input? value) { - InputDescriptor = null; - InputDescriptorAction = null; - InputValue = input; - return Self; + Instance.Input = value; + return this; } - public PutTrainedModelRequestDescriptor Input(Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor descriptor) - { - InputValue = null; - InputDescriptorAction = null; - InputDescriptor = descriptor; - return Self; - } - - public PutTrainedModelRequestDescriptor Input(Action configure) + /// + /// + /// The input field names for the model definition. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Input(System.Action action) { - InputValue = null; - InputDescriptor = null; - InputDescriptorAction = configure; - return Self; + Instance.Input = Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor.Build(action); + return this; } /// @@ -734,10 +829,10 @@ public PutTrainedModelRequestDescriptor Input(Action /// - public PutTrainedModelRequestDescriptor Metadata(object? metadata) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Metadata(object? value) { - MetadataValue = metadata; - return Self; + Instance.Metadata = value; + return this; } /// @@ -747,10 +842,10 @@ public PutTrainedModelRequestDescriptor Metadata(object? metadata) /// or the model definition is not supplied. /// /// - public PutTrainedModelRequestDescriptor ModelSizeBytes(long? modelSizeBytes) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelSizeBytes(long? value) { - ModelSizeBytesValue = modelSizeBytes; - return Self; + Instance.ModelSizeBytes = value; + return this; } /// @@ -758,10 +853,10 @@ public PutTrainedModelRequestDescriptor ModelSizeBytes(long? modelSizeBytes) /// The model type. /// /// - public PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? modelType) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? value) { - ModelTypeValue = modelType; - return Self; + Instance.ModelType = value; + return this; } /// @@ -775,10 +870,10 @@ public PutTrainedModelRequestDescriptor ModelType(Elastic.Clients.Elasticsearch. /// architecture or OS features), leave this field unset. /// /// - public PutTrainedModelRequestDescriptor PlatformArchitecture(string? platformArchitecture) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PlatformArchitecture(string? value) { - PlatformArchitectureValue = platformArchitecture; - return Self; + Instance.PlatformArchitecture = value; + return this; } /// @@ -786,28 +881,32 @@ public PutTrainedModelRequestDescriptor PlatformArchitecture(string? platformArc /// Optional prefix strings applied at inference /// /// - public PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? prefixStrings) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? value) { - PrefixStringsDescriptor = null; - PrefixStringsDescriptorAction = null; - PrefixStringsValue = prefixStrings; - return Self; + Instance.PrefixStrings = value; + return this; } - public PutTrainedModelRequestDescriptor PrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor descriptor) + /// + /// + /// Optional prefix strings applied at inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings() { - PrefixStringsValue = null; - PrefixStringsDescriptorAction = null; - PrefixStringsDescriptor = descriptor; - return Self; + Instance.PrefixStrings = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor.Build(null); + return this; } - public PutTrainedModelRequestDescriptor PrefixStrings(Action configure) + /// + /// + /// Optional prefix strings applied at inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor PrefixStrings(System.Action? action) { - PrefixStringsValue = null; - PrefixStringsDescriptor = null; - PrefixStringsDescriptorAction = configure; - return Self; + Instance.PrefixStrings = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor.Build(action); + return this; } /// @@ -815,121 +914,70 @@ public PutTrainedModelRequestDescriptor PrefixStrings(Action /// - public PutTrainedModelRequestDescriptor Tags(ICollection? tags) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Tags(System.Collections.Generic.ICollection? value) { - TagsValue = tags; - return Self; + Instance.Tags = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of tags to organize the model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Tags(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CompressedDefinitionValue)) - { - writer.WritePropertyName("compressed_definition"); - writer.WriteStringValue(CompressedDefinitionValue); - } - - if (DefinitionDescriptor is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, DefinitionDescriptor, options); - } - else if (DefinitionDescriptorAction is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor(DefinitionDescriptorAction), options); - } - else if (DefinitionValue is not null) - { - writer.WritePropertyName("definition"); - JsonSerializer.Serialize(writer, DefinitionValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } + Instance.Tags = [.. values]; + return this; + } - if (InputDescriptor is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, InputDescriptor, options); - } - else if (InputDescriptorAction is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor(InputDescriptorAction), options); - } - else if (InputValue is not null) - { - writer.WritePropertyName("input"); - JsonSerializer.Serialize(writer, InputValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ModelSizeBytesValue.HasValue) - { - writer.WritePropertyName("model_size_bytes"); - writer.WriteNumberValue(ModelSizeBytesValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelTypeValue is not null) - { - writer.WritePropertyName("model_type"); - JsonSerializer.Serialize(writer, ModelTypeValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(PlatformArchitectureValue)) - { - writer.WritePropertyName("platform_architecture"); - writer.WriteStringValue(PlatformArchitectureValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (PrefixStringsDescriptor is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, PrefixStringsDescriptor, options); - } - else if (PrefixStringsDescriptorAction is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor(PrefixStringsDescriptorAction), options); - } - else if (PrefixStringsValue is not null) - { - writer.WritePropertyName("prefix_strings"); - JsonSerializer.Serialize(writer, PrefixStringsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TagsValue is not null) - { - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, TagsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelResponse.g.cs index cb1d77cd15a..a165262fac2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelResponse.g.cs @@ -17,145 +17,366 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelResponse : ElasticsearchResponse +internal sealed partial class PutTrainedModelResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("compressed_definition")] - public string? CompressedDefinition { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropCompressedDefinition = System.Text.Json.JsonEncodedText.Encode("compressed_definition"); + private static readonly System.Text.Json.JsonEncodedText PropCreatedBy = System.Text.Json.JsonEncodedText.Encode("created_by"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultFieldMap = System.Text.Json.JsonEncodedText.Encode("default_field_map"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedHeapMemoryUsageBytes = System.Text.Json.JsonEncodedText.Encode("estimated_heap_memory_usage_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedOperations = System.Text.Json.JsonEncodedText.Encode("estimated_operations"); + private static readonly System.Text.Json.JsonEncodedText PropFullyDefined = System.Text.Json.JsonEncodedText.Encode("fully_defined"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropLicenseLevel = System.Text.Json.JsonEncodedText.Encode("license_level"); + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelPackage = System.Text.Json.JsonEncodedText.Encode("model_package"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeBytes = System.Text.Json.JsonEncodedText.Encode("model_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropModelType = System.Text.Json.JsonEncodedText.Encode("model_type"); + private static readonly System.Text.Json.JsonEncodedText PropPlatformArchitecture = System.Text.Json.JsonEncodedText.Encode("platform_architecture"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixStrings = System.Text.Json.JsonEncodedText.Encode("prefix_strings"); + private static readonly System.Text.Json.JsonEncodedText PropTags = System.Text.Json.JsonEncodedText.Encode("tags"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompressedDefinition = default; + LocalJsonValue propCreatedBy = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue?> propDefaultFieldMap = default; + LocalJsonValue propDescription = default; + LocalJsonValue propEstimatedHeapMemoryUsageBytes = default; + LocalJsonValue propEstimatedOperations = default; + LocalJsonValue propFullyDefined = default; + LocalJsonValue propInferenceConfig = default; + LocalJsonValue propInput = default; + LocalJsonValue propLicenseLevel = default; + LocalJsonValue propLocation = default; + LocalJsonValue propMetadata = default; + LocalJsonValue propModelId = default; + LocalJsonValue propModelPackage = default; + LocalJsonValue propModelSizeBytes = default; + LocalJsonValue propModelType = default; + LocalJsonValue propPlatformArchitecture = default; + LocalJsonValue propPrefixStrings = default; + LocalJsonValue> propTags = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompressedDefinition.TryReadProperty(ref reader, options, PropCompressedDefinition, null)) + { + continue; + } + + if (propCreatedBy.TryReadProperty(ref reader, options, PropCreatedBy, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propDefaultFieldMap.TryReadProperty(ref reader, options, PropDefaultFieldMap, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEstimatedHeapMemoryUsageBytes.TryReadProperty(ref reader, options, PropEstimatedHeapMemoryUsageBytes, null)) + { + continue; + } + + if (propEstimatedOperations.TryReadProperty(ref reader, options, PropEstimatedOperations, null)) + { + continue; + } + + if (propFullyDefined.TryReadProperty(ref reader, options, PropFullyDefined, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (propInput.TryReadProperty(ref reader, options, PropInput, null)) + { + continue; + } + + if (propLicenseLevel.TryReadProperty(ref reader, options, PropLicenseLevel, null)) + { + continue; + } + + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propModelPackage.TryReadProperty(ref reader, options, PropModelPackage, null)) + { + continue; + } + + if (propModelSizeBytes.TryReadProperty(ref reader, options, PropModelSizeBytes, null)) + { + continue; + } + + if (propModelType.TryReadProperty(ref reader, options, PropModelType, null)) + { + continue; + } + + if (propPlatformArchitecture.TryReadProperty(ref reader, options, PropPlatformArchitecture, null)) + { + continue; + } + + if (propPrefixStrings.TryReadProperty(ref reader, options, PropPrefixStrings, null)) + { + continue; + } + + if (propTags.TryReadProperty(ref reader, options, PropTags, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompressedDefinition = propCompressedDefinition.Value, + CreatedBy = propCreatedBy.Value, + CreateTime = propCreateTime.Value, + DefaultFieldMap = propDefaultFieldMap.Value, + Description = propDescription.Value, + EstimatedHeapMemoryUsageBytes = propEstimatedHeapMemoryUsageBytes.Value, + EstimatedOperations = propEstimatedOperations.Value, + FullyDefined = propFullyDefined.Value, + InferenceConfig = propInferenceConfig.Value, + Input = propInput.Value, + LicenseLevel = propLicenseLevel.Value, + Location = propLocation.Value, + Metadata = propMetadata.Value, + ModelId = propModelId.Value, + ModelPackage = propModelPackage.Value, + ModelSizeBytes = propModelSizeBytes.Value, + ModelType = propModelType.Value, + PlatformArchitecture = propPlatformArchitecture.Value, + PrefixStrings = propPrefixStrings.Value, + Tags = propTags.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompressedDefinition, value.CompressedDefinition, null, null); + writer.WriteProperty(options, PropCreatedBy, value.CreatedBy, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropDefaultFieldMap, value.DefaultFieldMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEstimatedHeapMemoryUsageBytes, value.EstimatedHeapMemoryUsageBytes, null, null); + writer.WriteProperty(options, PropEstimatedOperations, value.EstimatedOperations, null, null); + writer.WriteProperty(options, PropFullyDefined, value.FullyDefined, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteProperty(options, PropInput, value.Input, null, null); + writer.WriteProperty(options, PropLicenseLevel, value.LicenseLevel, null, null); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropModelPackage, value.ModelPackage, null, null); + writer.WriteProperty(options, PropModelSizeBytes, value.ModelSizeBytes, null, null); + writer.WriteProperty(options, PropModelType, value.ModelType, null, null); + writer.WriteProperty(options, PropPlatformArchitecture, value.PlatformArchitecture, null, null); + writer.WriteProperty(options, PropPrefixStrings, value.PrefixStrings, null, null); + writer.WriteProperty(options, PropTags, value.Tags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponseConverter))] +public sealed partial class PutTrainedModelResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? CompressedDefinition { get; set; } /// /// /// Information on the creator of the trained model. /// /// - [JsonInclude, JsonPropertyName("created_by")] - public string? CreatedBy { get; init; } + public string? CreatedBy { get; set; } /// /// /// The time when the trained model was created. /// /// - [JsonInclude, JsonPropertyName("create_time")] - public DateTimeOffset? CreateTime { get; init; } + public System.DateTimeOffset? CreateTime { get; set; } /// /// /// Any field map described in the inference configuration takes precedence. /// /// - [JsonInclude, JsonPropertyName("default_field_map")] - public IReadOnlyDictionary? DefaultFieldMap { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? DefaultFieldMap { get; set; } /// /// /// The free-text description of the trained model. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// The estimated heap usage in bytes to keep the trained model in memory. /// /// - [JsonInclude, JsonPropertyName("estimated_heap_memory_usage_bytes")] - public int? EstimatedHeapMemoryUsageBytes { get; init; } + public int? EstimatedHeapMemoryUsageBytes { get; set; } /// /// /// The estimated number of operations to use the trained model. /// /// - [JsonInclude, JsonPropertyName("estimated_operations")] - public int? EstimatedOperations { get; init; } + public int? EstimatedOperations { get; set; } /// /// /// True if the full model definition is present. /// /// - [JsonInclude, JsonPropertyName("fully_defined")] - public bool? FullyDefined { get; init; } + public bool? FullyDefined { get; set; } /// /// /// The default configuration for inference. This can be either a regression, classification, or one of the many NLP focused configurations. It must match the underlying definition.trained_model's target_type. For pre-packaged models such as ELSER the config is not required. /// /// - [JsonInclude, JsonPropertyName("inference_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfig { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfig { get; set; } /// /// /// The input field names for the model definition. /// /// - [JsonInclude, JsonPropertyName("input")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput Input { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput Input { get; set; } /// /// /// The license level of the trained model. /// /// - [JsonInclude, JsonPropertyName("license_level")] - public string? LicenseLevel { get; init; } - [JsonInclude, JsonPropertyName("location")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation? Location { get; init; } + public string? LicenseLevel { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation? Location { get; set; } /// /// /// An object containing metadata about the trained model. For example, models created by data frame analytics contain analysis_config and input objects. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata? Metadata { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata? Metadata { get; set; } /// /// /// Identifier for the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } - [JsonInclude, JsonPropertyName("model_package")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig? ModelPackage { get; init; } - [JsonInclude, JsonPropertyName("model_size_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? ModelSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig? ModelPackage { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? ModelSizeBytes { get; set; } /// /// /// The model type /// /// - [JsonInclude, JsonPropertyName("model_type")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelType { get; init; } - [JsonInclude, JsonPropertyName("prefix_strings")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelType { get; set; } + public string? PlatformArchitecture { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; set; } /// /// /// A comma delimited string of tags. A trained model can have many tags, or none. /// /// - [JsonInclude, JsonPropertyName("tags")] - public IReadOnlyCollection Tags { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Tags { get; set; } /// /// /// The Elasticsearch version number in which the trained model was created. /// /// - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } + public string? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyRequest.g.cs index 410059d8e85..aabf9130a9c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyRequest.g.cs @@ -17,23 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelVocabularyRequestParameters : RequestParameters +public sealed partial class PutTrainedModelVocabularyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutTrainedModelVocabularyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMerges = System.Text.Json.JsonEncodedText.Encode("merges"); + private static readonly System.Text.Json.JsonEncodedText PropScores = System.Text.Json.JsonEncodedText.Encode("scores"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMerges = default; + LocalJsonValue?> propScores = default; + LocalJsonValue> propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMerges.TryReadProperty(ref reader, options, PropMerges, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propScores.TryReadProperty(ref reader, options, PropScores, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Merges = propMerges.Value, + Scores = propScores.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMerges, value.Merges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScores, value.Scores, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create a trained model vocabulary. @@ -41,43 +91,74 @@ public sealed partial class PutTrainedModelVocabularyRequestParameters : Request /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. /// /// -public sealed partial class PutTrainedModelVocabularyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestConverter))] +public sealed partial class PutTrainedModelVocabularyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelVocabulary; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Id modelId, System.Collections.Generic.ICollection vocabulary) : base(r => r.Required("model_id", modelId)) + { + Vocabulary = vocabulary; + } +#if NET7_0_OR_GREATER + public PutTrainedModelVocabularyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningPutTrainedModelVocabulary; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "ml.put_trained_model_vocabulary"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// The optional model merges if required by the tokenizer. /// /// - [JsonInclude, JsonPropertyName("merges")] - public ICollection? Merges { get; set; } + public System.Collections.Generic.ICollection? Merges { get; set; } /// /// /// The optional vocabulary value scores if required by the tokenizer. /// /// - [JsonInclude, JsonPropertyName("scores")] - public ICollection? Scores { get; set; } + public System.Collections.Generic.ICollection? Scores { get; set; } /// /// /// The model vocabulary, which must not be empty. /// /// - [JsonInclude, JsonPropertyName("vocabulary")] - public ICollection Vocabulary { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Vocabulary { get; set; } } /// @@ -87,41 +168,63 @@ public PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Id modelId /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. /// /// -public sealed partial class PutTrainedModelVocabularyRequestDescriptor : RequestDescriptor +public readonly partial struct PutTrainedModelVocabularyRequestDescriptor { - internal PutTrainedModelVocabularyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest Instance { get; init; } - public PutTrainedModelVocabularyRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelVocabularyRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningPutTrainedModelVocabulary; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutTrainedModelVocabularyRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest(modelId); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTrainedModelVocabularyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.put_trained_model_vocabulary"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor descriptor) => descriptor.Instance; - public PutTrainedModelVocabularyRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.ModelId = value; + return this; } - private ICollection? MergesValue { get; set; } - private ICollection? ScoresValue { get; set; } - private ICollection VocabularyValue { get; set; } + /// + /// + /// The optional model merges if required by the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Merges(System.Collections.Generic.ICollection? value) + { + Instance.Merges = value; + return this; + } /// /// /// The optional model merges if required by the tokenizer. /// /// - public PutTrainedModelVocabularyRequestDescriptor Merges(ICollection? merges) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Merges(params string[] values) { - MergesValue = merges; - return Self; + Instance.Merges = [.. values]; + return this; } /// @@ -129,10 +232,21 @@ public PutTrainedModelVocabularyRequestDescriptor Merges(ICollection? me /// The optional vocabulary value scores if required by the tokenizer. /// /// - public PutTrainedModelVocabularyRequestDescriptor Scores(ICollection? scores) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Scores(System.Collections.Generic.ICollection? value) { - ScoresValue = scores; - return Self; + Instance.Scores = value; + return this; + } + + /// + /// + /// The optional vocabulary value scores if required by the tokenizer. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Scores(params double[] values) + { + Instance.Scores = [.. values]; + return this; } /// @@ -140,29 +254,70 @@ public PutTrainedModelVocabularyRequestDescriptor Scores(ICollection? sc /// The model vocabulary, which must not be empty. /// /// - public PutTrainedModelVocabularyRequestDescriptor Vocabulary(ICollection vocabulary) + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Vocabulary(System.Collections.Generic.ICollection value) { - VocabularyValue = vocabulary; - return Self; + Instance.Vocabulary = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The model vocabulary, which must not be empty. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Vocabulary(params string[] values) { - writer.WriteStartObject(); - if (MergesValue is not null) - { - writer.WritePropertyName("merges"); - JsonSerializer.Serialize(writer, MergesValue, options); - } + Instance.Vocabulary = [.. values]; + return this; + } - if (ScoresValue is not null) - { - writer.WritePropertyName("scores"); - JsonSerializer.Serialize(writer, ScoresValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyResponse.g.cs index ad429dd3de8..27ff91887ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/PutTrainedModelVocabularyResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class PutTrainedModelVocabularyResponse : ElasticsearchResponse +internal sealed partial class PutTrainedModelVocabularyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponseConverter))] +public sealed partial class PutTrainedModelVocabularyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTrainedModelVocabularyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTrainedModelVocabularyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobRequest.g.cs index 22e01c4e863..e24e0e74813 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ResetJobRequestParameters : RequestParameters +public sealed partial class ResetJobRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -50,6 +43,35 @@ public sealed partial class ResetJobRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class ResetJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Reset an anomaly detection job. @@ -59,20 +81,43 @@ public sealed partial class ResetJobRequestParameters : RequestParameters /// comma separated list. /// /// -public sealed partial class ResetJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestConverter))] +public sealed partial class ResetJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ResetJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public ResetJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningResetJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningResetJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.reset_job"; + /// + /// + /// The ID of the job to reset. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Specifies whether annotations that have been added by the @@ -80,7 +125,6 @@ public ResetJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// reset. /// /// - [JsonIgnore] public bool? DeleteUserAnnotations { get => Q("delete_user_annotations"); set => Q("delete_user_annotations", value); } /// @@ -89,7 +133,6 @@ public ResetJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// returning. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -102,32 +145,113 @@ public ResetJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Req /// comma separated list. /// /// -public sealed partial class ResetJobRequestDescriptor : RequestDescriptor +public readonly partial struct ResetJobRequestDescriptor { - internal ResetJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest Instance { get; init; } - public ResetJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningResetJob; + public ResetJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest(jobId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ResetJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.reset_job"; + /// + /// + /// The ID of the job to reset. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public ResetJobRequestDescriptor DeleteUserAnnotations(bool? deleteUserAnnotations = true) => Qs("delete_user_annotations", deleteUserAnnotations); - public ResetJobRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// Specifies whether annotations that have been added by the + /// user should be deleted along with any auto-generated annotations when the job is + /// reset. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor DeleteUserAnnotations(bool? value = true) + { + Instance.DeleteUserAnnotations = value; + return this; + } + + /// + /// + /// Should this request wait until the operation has completed before + /// returning. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ResetJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobResponse.g.cs index 1376dc1be33..8add4557dcc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ResetJobResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ResetJobResponse : ElasticsearchResponse +internal sealed partial class ResetJobResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponseConverter))] +public sealed partial class ResetJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotRequest.g.cs index fd5a431f6bc..32d2b24ea0f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotRequest.g.cs @@ -17,21 +17,53 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class RevertModelSnapshotRequestParameters : RequestParameters +public sealed partial class RevertModelSnapshotRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class RevertModelSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDeleteInterveningResults = System.Text.Json.JsonEncodedText.Encode("delete_intervening_results"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeleteInterveningResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleteInterveningResults.TryReadProperty(ref reader, options, PropDeleteInterveningResults, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeleteInterveningResults = propDeleteInterveningResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleteInterveningResults, value.DeleteInterveningResults, null, null); + writer.WriteEndObject(); + } } /// @@ -46,26 +78,61 @@ public sealed partial class RevertModelSnapshotRequestParameters : RequestParame /// snapshot after Black Friday or a critical system failure. /// /// -public sealed partial class RevertModelSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestConverter))] +public sealed partial class RevertModelSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) { } +#if NET7_0_OR_GREATER + public RevertModelSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningRevertModelSnapshot; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningRevertModelSnapshot; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.revert_model_snapshot"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// You can specify empty as the <snapshot_id>. Reverting to the empty + /// snapshot means the anomaly detection job starts learning a new model from + /// scratch when it is started. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SnapshotId { get => P("snapshot_id"); set => PR("snapshot_id", value); } + /// /// /// Refer to the description for the delete_intervening_results query parameter. /// /// - [JsonInclude, JsonPropertyName("delete_intervening_results")] public bool? DeleteInterveningResults { get; set; } } @@ -81,56 +148,112 @@ public RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elasti /// snapshot after Black Friday or a critical system failure. /// /// -public sealed partial class RevertModelSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct RevertModelSnapshotRequestDescriptor { - internal RevertModelSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest Instance { get; init; } - public RevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningRevertModelSnapshot; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest(jobId, snapshotId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RevertModelSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.revert_model_snapshot"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor descriptor) => descriptor.Instance; - public RevertModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - public RevertModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId) + /// + /// + /// You can specify empty as the <snapshot_id>. Reverting to the empty + /// snapshot means the anomaly detection job starts learning a new model from + /// scratch when it is started. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("snapshot_id", snapshotId); - return Self; + Instance.SnapshotId = value; + return this; } - private bool? DeleteInterveningResultsValue { get; set; } - /// /// /// Refer to the description for the delete_intervening_results query parameter. /// /// - public RevertModelSnapshotRequestDescriptor DeleteInterveningResults(bool? deleteInterveningResults = true) + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor DeleteInterveningResults(bool? value = true) { - DeleteInterveningResultsValue = deleteInterveningResults; - return Self; + Instance.DeleteInterveningResults = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest Build(System.Action action) { - writer.WriteStartObject(); - if (DeleteInterveningResultsValue.HasValue) - { - writer.WritePropertyName("delete_intervening_results"); - writer.WriteBooleanValue(DeleteInterveningResultsValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotResponse.g.cs index 845e682de52..9312efaff6f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/RevertModelSnapshotResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class RevertModelSnapshotResponse : ElasticsearchResponse +internal sealed partial class RevertModelSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("model")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot Model { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModel = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Model = propModel.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponseConverter))] +public sealed partial class RevertModelSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RevertModelSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RevertModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot Model { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeRequest.g.cs index 59688096e0e..b73b8cdd924 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class SetUpgradeModeRequestParameters : RequestParameters +public sealed partial class SetUpgradeModeRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class SetUpgradeModeRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class SetUpgradeModeRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Set upgrade_mode for ML indices. @@ -66,11 +88,28 @@ public sealed partial class SetUpgradeModeRequestParameters : RequestParameters /// machine learning info API. /// /// -public sealed partial class SetUpgradeModeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestConverter))] +public sealed partial class SetUpgradeModeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningSetUpgradeMode; +#if NET7_0_OR_GREATER + public SetUpgradeModeRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public SetUpgradeModeRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningSetUpgradeMode; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -83,7 +122,6 @@ public sealed partial class SetUpgradeModeRequest : PlainRequest /// - [JsonIgnore] public bool? Enabled { get => Q("enabled"); set => Q("enabled", value); } /// @@ -91,7 +129,6 @@ public sealed partial class SetUpgradeModeRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -112,26 +149,100 @@ public sealed partial class SetUpgradeModeRequest : PlainRequest /// -public sealed partial class SetUpgradeModeRequestDescriptor : RequestDescriptor +public readonly partial struct SetUpgradeModeRequestDescriptor { - internal SetUpgradeModeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetUpgradeModeRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest instance) + { + Instance = instance; + } public SetUpgradeModeRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningSetUpgradeMode; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// When true, it enables upgrade_mode which temporarily halts all job + /// and datafeed tasks and prohibits new job and datafeed tasks from + /// starting. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor Enabled(bool? value = true) + { + Instance.Enabled = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The time to wait for the request to be completed. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "ml.set_upgrade_mode"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public SetUpgradeModeRequestDescriptor Enabled(bool? enabled = true) => Qs("enabled", enabled); - public SetUpgradeModeRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeResponse.g.cs index 2331ea78700..075e74293ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/SetUpgradeModeResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class SetUpgradeModeResponse : ElasticsearchResponse +internal sealed partial class SetUpgradeModeResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponseConverter))] +public sealed partial class SetUpgradeModeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetUpgradeModeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SetUpgradeModeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsRequest.g.cs index cd42cb41dfa..4495f5a1326 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class StartDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,35 @@ public sealed partial class StartDataFrameAnalyticsRequestParameters : RequestPa public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StartDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start a data frame analytics job. @@ -57,27 +79,51 @@ public sealed partial class StartDataFrameAnalyticsRequestParameters : RequestPa /// the destination index in advance with custom settings and mappings. /// /// -public sealed partial class StartDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestConverter))] +public sealed partial class StartDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public StartDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStartDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.start_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Controls the amount of time to wait until the data frame analytics job /// starts. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -97,76 +143,102 @@ public StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : bas /// the destination index in advance with custom settings and mappings. /// /// -public sealed partial class StartDataFrameAnalyticsRequestDescriptor : RequestDescriptor, StartDataFrameAnalyticsRequestParameters> +public readonly partial struct StartDataFrameAnalyticsRequestDescriptor { - internal StartDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest Instance { get; init; } - public StartDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => false; + public StartDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest(id); + } - internal override string OperationName => "ml.start_data_frame_analytics"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StartDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public StartDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public StartDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Controls the amount of time to wait until the data frame analytics job + /// starts. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.Timeout = value; + return this; } -} - -/// -/// -/// Start a data frame analytics job. -/// A data frame analytics job can be started and stopped multiple times -/// throughout its lifecycle. -/// If the destination index does not exist, it is created automatically the -/// first time you start the data frame analytics job. The -/// index.number_of_shards and index.number_of_replicas settings for the -/// destination index are copied from the source index. If there are multiple -/// source indices, the destination index copies the highest setting values. The -/// mappings for the destination index are also copied from the source indices. -/// If there are any mapping conflicts, the job fails to start. -/// If the destination index exists, it is used as is. You can therefore set up -/// the destination index in advance with custom settings and mappings. -/// -/// -public sealed partial class StartDataFrameAnalyticsRequestDescriptor : RequestDescriptor -{ - internal StartDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); - public StartDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartDataFrameAnalytics; + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ml.start_data_frame_analytics"; + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public StartDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StartDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsResponse.g.cs index 2285b69b809..5763df79669 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDataFrameAnalyticsResponse.g.cs @@ -17,19 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class StartDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propNode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Node = propNode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponseConverter))] +public sealed partial class StartDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } /// /// @@ -40,6 +100,9 @@ public sealed partial class StartDataFrameAnalyticsResponse : ElasticsearchRespo /// node ID will be "serverless". /// /// - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedRequest.g.cs index 443127894dc..363246da72b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartDatafeedRequestParameters : RequestParameters +public sealed partial class StartDatafeedRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class StartDatafeedRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnd = default; + LocalJsonValue propStart = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnd.TryReadProperty(ref reader, options, PropEnd, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + End = propEnd.Value, + Start = propStart.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnd, value.End, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStart, value.Start, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } } /// @@ -55,42 +105,64 @@ public sealed partial class StartDatafeedRequestParameters : RequestParameters /// authorization headers when you created or updated the datafeed, those credentials are used instead. /// /// -public sealed partial class StartDatafeedRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestConverter))] +public sealed partial class StartDatafeedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StartDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) { } +#if NET7_0_OR_GREATER + public StartDatafeedRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartDatafeed; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStartDatafeed; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.start_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase + /// alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric + /// characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id DatafeedId { get => P("datafeed_id"); set => PR("datafeed_id", value); } + /// /// /// Refer to the description for the end query parameter. /// /// - [JsonInclude, JsonPropertyName("end")] - public DateTimeOffset? End { get; set; } + public System.DateTimeOffset? End { get; set; } /// /// /// Refer to the description for the start query parameter. /// /// - [JsonInclude, JsonPropertyName("start")] - public DateTimeOffset? Start { get; set; } + public System.DateTimeOffset? Start { get; set; } /// /// /// Refer to the description for the timeout query parameter. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } @@ -115,41 +187,52 @@ public StartDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base( /// authorization headers when you created or updated the datafeed, those credentials are used instead. /// /// -public sealed partial class StartDatafeedRequestDescriptor : RequestDescriptor +public readonly partial struct StartDatafeedRequestDescriptor { - internal StartDatafeedRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest Instance { get; init; } - public StartDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartDatafeed; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public StartDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest(datafeedId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StartDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.start_datafeed"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor descriptor) => descriptor.Instance; - public StartDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase + /// alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric + /// characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("datafeed_id", datafeedId); - return Self; + Instance.DatafeedId = value; + return this; } - private DateTimeOffset? EndValue { get; set; } - private DateTimeOffset? StartValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// Refer to the description for the end query parameter. /// /// - public StartDatafeedRequestDescriptor End(DateTimeOffset? end) + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor End(System.DateTimeOffset? value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -157,10 +240,10 @@ public StartDatafeedRequestDescriptor End(DateTimeOffset? end) /// Refer to the description for the start query parameter. /// /// - public StartDatafeedRequestDescriptor Start(DateTimeOffset? start) + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor Start(System.DateTimeOffset? value) { - StartValue = start; - return Self; + Instance.Start = value; + return this; } /// @@ -168,33 +251,59 @@ public StartDatafeedRequestDescriptor Start(DateTimeOffset? start) /// Refer to the description for the timeout query parameter. /// /// - public StartDatafeedRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest Build(System.Action action) { - writer.WriteStartObject(); - if (EndValue is not null) - { - writer.WritePropertyName("end"); - JsonSerializer.Serialize(writer, EndValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (StartValue is not null) - { - writer.WritePropertyName("start"); - JsonSerializer.Serialize(writer, StartValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedResponse.g.cs index a8ff65cd2ea..f916b715d28 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartDatafeedResponse.g.cs @@ -17,32 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartDatafeedResponse : ElasticsearchResponse +internal sealed partial class StartDatafeedResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropStarted = System.Text.Json.JsonEncodedText.Encode("started"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNode = default; + LocalJsonValue propStarted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNode.TryReadProperty(ref reader, options, PropNode, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propStarted.TryReadProperty(ref reader, options, PropStarted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Node = propNode.Value, + Started = propStarted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNode, value.Node, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStarted, value.Started, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponseConverter))] +public sealed partial class StartDatafeedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartDatafeedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The ID of the node that the job was started on. In serverless this will be the "serverless". /// If the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string. /// /// - [JsonInclude, JsonPropertyName("node")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Node { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Node { get; set; } /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("started")] - public bool Started { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Started { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentRequest.g.cs index 81f77f7f92a..20cc0f9e6e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartTrainedModelDeploymentRequestParameters : RequestParameters +public sealed partial class StartTrainedModelDeploymentRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -56,6 +49,7 @@ public sealed partial class StartTrainedModelDeploymentRequestParameters : Reque /// Increasing this value generally increases the throughput. /// If this setting is greater than the number of hardware threads /// it will automatically be changed to a value less than the number of hardware threads. + /// If adaptive_allocations is enabled, do not set this value, because it’s automatically set. /// /// public int? NumberOfAllocations { get => Q("number_of_allocations"); set => Q("number_of_allocations", value); } @@ -101,26 +95,88 @@ public sealed partial class StartTrainedModelDeploymentRequestParameters : Reque public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState? WaitFor { get => Q("wait_for"); set => Q("wait_for", value); } } +internal sealed partial class StartTrainedModelDeploymentRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Start a trained model deployment. /// It allocates the model to every machine learning node. /// /// -public sealed partial class StartTrainedModelDeploymentRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestConverter))] +public sealed partial class StartTrainedModelDeploymentRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public StartTrainedModelDeploymentRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartTrainedModelDeployment; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStartTrainedModelDeployment; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; - internal override bool SupportsBody => false; + internal override bool SupportsBody => true; internal override string OperationName => "ml.start_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. Currently, only PyTorch models are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// The inference cache size (in memory outside the JVM heap) per node for the model. @@ -128,7 +184,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// 0b can be provided. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.ByteSize? CacheSize { get => Q("cache_size"); set => Q("cache_size", value); } /// @@ -136,7 +191,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// A unique identifier for the deployment of the model. /// /// - [JsonIgnore] public string? DeploymentId { get => Q("deployment_id"); set => Q("deployment_id", value); } /// @@ -147,9 +201,9 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// Increasing this value generally increases the throughput. /// If this setting is greater than the number of hardware threads /// it will automatically be changed to a value less than the number of hardware threads. + /// If adaptive_allocations is enabled, do not set this value, because it’s automatically set. /// /// - [JsonIgnore] public int? NumberOfAllocations { get => Q("number_of_allocations"); set => Q("number_of_allocations", value); } /// @@ -157,7 +211,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// The deployment priority. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority? Priority { get => Q("priority"); set => Q("priority", value); } /// @@ -166,7 +219,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// this value, new requests are rejected with a 429 error. /// /// - [JsonIgnore] public int? QueueCapacity { get => Q("queue_capacity"); set => Q("queue_capacity", value); } /// @@ -178,7 +230,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// it will automatically be changed to a value less than the number of hardware threads. /// /// - [JsonIgnore] public int? ThreadsPerAllocation { get => Q("threads_per_allocation"); set => Q("threads_per_allocation", value); } /// @@ -186,7 +237,6 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// Specifies the amount of time to wait for the model to deploy. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -194,8 +244,16 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// Specifies the allocation status to wait for before returning. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState? WaitFor { get => Q("wait_for"); set => Q("wait_for", value); } + + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; set; } } /// @@ -204,38 +262,228 @@ public StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id model /// It allocates the model to every machine learning node. /// /// -public sealed partial class StartTrainedModelDeploymentRequestDescriptor : RequestDescriptor +public readonly partial struct StartTrainedModelDeploymentRequestDescriptor { - internal StartTrainedModelDeploymentRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest Instance { get; init; } - public StartTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStartTrainedModelDeployment; + public StartTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest(modelId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StartTrainedModelDeploymentRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.start_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. Currently, only PyTorch models are supported. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The inference cache size (in memory outside the JVM heap) per node for the model. + /// The default value is the same size as the model_size_bytes. To disable the cache, + /// 0b can be provided. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor CacheSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.CacheSize = value; + return this; + } + + /// + /// + /// The inference cache size (in memory outside the JVM heap) per node for the model. + /// The default value is the same size as the model_size_bytes. To disable the cache, + /// 0b can be provided. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor CacheSize(System.Func action) + { + Instance.CacheSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } + + /// + /// + /// A unique identifier for the deployment of the model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor DeploymentId(string? value) + { + Instance.DeploymentId = value; + return this; + } + + /// + /// + /// The number of model allocations on each node where the model is deployed. + /// All allocations on a node share the same copy of the model in memory but use + /// a separate set of threads to evaluate the model. + /// Increasing this value generally increases the throughput. + /// If this setting is greater than the number of hardware threads + /// it will automatically be changed to a value less than the number of hardware threads. + /// If adaptive_allocations is enabled, do not set this value, because it’s automatically set. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor NumberOfAllocations(int? value) + { + Instance.NumberOfAllocations = value; + return this; + } - public StartTrainedModelDeploymentRequestDescriptor CacheSize(Elastic.Clients.Elasticsearch.ByteSize? cacheSize) => Qs("cache_size", cacheSize); - public StartTrainedModelDeploymentRequestDescriptor DeploymentId(string? deploymentId) => Qs("deployment_id", deploymentId); - public StartTrainedModelDeploymentRequestDescriptor NumberOfAllocations(int? numberOfAllocations) => Qs("number_of_allocations", numberOfAllocations); - public StartTrainedModelDeploymentRequestDescriptor Priority(Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority? priority) => Qs("priority", priority); - public StartTrainedModelDeploymentRequestDescriptor QueueCapacity(int? queueCapacity) => Qs("queue_capacity", queueCapacity); - public StartTrainedModelDeploymentRequestDescriptor ThreadsPerAllocation(int? threadsPerAllocation) => Qs("threads_per_allocation", threadsPerAllocation); - public StartTrainedModelDeploymentRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public StartTrainedModelDeploymentRequestDescriptor WaitFor(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState? waitFor) => Qs("wait_for", waitFor); + /// + /// + /// The deployment priority. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor Priority(Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority? value) + { + Instance.Priority = value; + return this; + } + + /// + /// + /// Specifies the number of inference requests that are allowed in the queue. After the number of requests exceeds + /// this value, new requests are rejected with a 429 error. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor QueueCapacity(int? value) + { + Instance.QueueCapacity = value; + return this; + } + + /// + /// + /// Sets the number of threads used by each model allocation during inference. This generally increases + /// the inference speed. The inference process is a compute-bound process; any number + /// greater than the number of available hardware threads on the machine does not increase the + /// inference speed. If this setting is greater than the number of hardware threads + /// it will automatically be changed to a value less than the number of hardware threads. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor ThreadsPerAllocation(int? value) + { + Instance.ThreadsPerAllocation = value; + return this; + } + + /// + /// + /// Specifies the amount of time to wait for the model to deploy. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// Specifies the allocation status to wait for before returning. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor WaitFor(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState? value) + { + Instance.WaitFor = value; + return this; + } + + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor AdaptiveAllocations(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? value) + { + Instance.AdaptiveAllocations = value; + return this; + } + + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor AdaptiveAllocations(System.Action action) + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StartTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentResponse.g.cs index de829f86d0b..446ce8498a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StartTrainedModelDeploymentResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StartTrainedModelDeploymentResponse : ElasticsearchResponse +internal sealed partial class StartTrainedModelDeploymentResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("assignment")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Assignment { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAssignment = System.Text.Json.JsonEncodedText.Encode("assignment"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignment = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignment.TryReadProperty(ref reader, options, PropAssignment, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Assignment = propAssignment.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignment, value.Assignment, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponseConverter))] +public sealed partial class StartTrainedModelDeploymentResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartTrainedModelDeploymentResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Assignment { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsRequest.g.cs index 86f9bcb4d1e..3d55b937f77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class StopDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -79,6 +72,35 @@ public sealed partial class StopDataFrameAnalyticsRequestParameters : RequestPar public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StopDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop data frame analytics jobs. @@ -86,20 +108,45 @@ public sealed partial class StopDataFrameAnalyticsRequestParameters : RequestPar /// throughout its lifecycle. /// /// -public sealed partial class StopDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestConverter))] +public sealed partial class StopDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public StopDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStopDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.stop_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Specifies what to do when the request: @@ -129,7 +176,6 @@ public StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base /// status code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -137,7 +183,6 @@ public StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base /// If true, the data frame analytics job is stopped forcefully. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -146,7 +191,6 @@ public StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base /// stops. Defaults to 20 seconds. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -157,71 +201,148 @@ public StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base /// throughout its lifecycle. /// /// -public sealed partial class StopDataFrameAnalyticsRequestDescriptor : RequestDescriptor, StopDataFrameAnalyticsRequestParameters> +public readonly partial struct StopDataFrameAnalyticsRequestDescriptor { - internal StopDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest Instance { get; init; } - public StopDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public StopDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StopDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.stop_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public StopDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public StopDataFrameAnalyticsRequestDescriptor Force(bool? force = true) => Qs("force", force); - public StopDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public StopDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no data frame analytics + /// jobs that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// The default value is true, which returns an empty data_frame_analytics + /// array when there are no matches and the subset of results when there are + /// partial matches. If this parameter is false, the request returns a 404 + /// status code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? value = true) { - RouteValues.Required("id", id); - return Self; + Instance.AllowNoMatch = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the data frame analytics job is stopped forcefully. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor Force(bool? value = true) { + Instance.Force = value; + return this; } -} -/// -/// -/// Stop data frame analytics jobs. -/// A data frame analytics job can be started and stopped multiple times -/// throughout its lifecycle. -/// -/// -public sealed partial class StopDataFrameAnalyticsRequestDescriptor : RequestDescriptor -{ - internal StopDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Controls the amount of time to wait until the data frame analytics job + /// stops. Defaults to 20 seconds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public StopDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopDataFrameAnalytics; + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "ml.stop_data_frame_analytics"; + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public StopDataFrameAnalyticsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public StopDataFrameAnalyticsRequestDescriptor Force(bool? force = true) => Qs("force", force); - public StopDataFrameAnalyticsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StopDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsResponse.g.cs index b367f3fd569..a05310d3eec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDataFrameAnalyticsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class StopDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopped")] - public bool Stopped { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStopped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopped.TryReadProperty(ref reader, options, PropStopped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopped = propStopped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopped, value.Stopped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponseConverter))] +public sealed partial class StopDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Stopped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedRequest.g.cs index 1d8fe87c595..621908a8803 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopDatafeedRequestParameters : RequestParameters +public sealed partial class StopDatafeedRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class StopDatafeedRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAllowNoMatch = System.Text.Json.JsonEncodedText.Encode("allow_no_match"); + private static readonly System.Text.Json.JsonEncodedText PropForce = System.Text.Json.JsonEncodedText.Encode("force"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowNoMatch = default; + LocalJsonValue propForce = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowNoMatch.TryReadProperty(ref reader, options, PropAllowNoMatch, null)) + { + continue; + } + + if (propForce.TryReadProperty(ref reader, options, PropForce, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowNoMatch = propAllowNoMatch.Value, + Force = propForce.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowNoMatch, value.AllowNoMatch, null, null); + writer.WriteProperty(options, PropForce, value.Force, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } } /// @@ -41,26 +91,50 @@ public sealed partial class StopDatafeedRequestParameters : RequestParameters /// multiple times throughout its lifecycle. /// /// -public sealed partial class StopDatafeedRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestConverter))] +public sealed partial class StopDatafeedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StopDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) { } +#if NET7_0_OR_GREATER + public StopDatafeedRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopDatafeed; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStopDatafeed; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.stop_datafeed"; + /// + /// + /// Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated + /// list of datafeeds or a wildcard expression. You can close all datafeeds by using _all or by specifying * as + /// the identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id DatafeedId { get => P("datafeed_id"); set => PR("datafeed_id", value); } + /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - [JsonInclude, JsonPropertyName("allow_no_match")] public bool? AllowNoMatch { get; set; } /// @@ -68,7 +142,6 @@ public StopDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r /// Refer to the description for the force query parameter. /// /// - [JsonInclude, JsonPropertyName("force")] public bool? Force { get; set; } /// @@ -76,7 +149,6 @@ public StopDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r /// Refer to the description for the timeout query parameter. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } @@ -87,41 +159,52 @@ public StopDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r /// multiple times throughout its lifecycle. /// /// -public sealed partial class StopDatafeedRequestDescriptor : RequestDescriptor +public readonly partial struct StopDatafeedRequestDescriptor { - internal StopDatafeedRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest Instance { get; init; } - public StopDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopDatafeed; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public StopDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest(datafeedId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StopDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.stop_datafeed"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor descriptor) => descriptor.Instance; - public StopDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) + /// + /// + /// Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated + /// list of datafeeds or a wildcard expression. You can close all datafeeds by using _all or by specifying * as + /// the identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("datafeed_id", datafeedId); - return Self; + Instance.DatafeedId = value; + return this; } - private bool? AllowNoMatchValue { get; set; } - private bool? ForceValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// Refer to the description for the allow_no_match query parameter. /// /// - public StopDatafeedRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor AllowNoMatch(bool? value = true) { - AllowNoMatchValue = allowNoMatch; - return Self; + Instance.AllowNoMatch = value; + return this; } /// @@ -129,10 +212,10 @@ public StopDatafeedRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) /// Refer to the description for the force query parameter. /// /// - public StopDatafeedRequestDescriptor Force(bool? force = true) + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor Force(bool? value = true) { - ForceValue = force; - return Self; + Instance.Force = value; + return this; } /// @@ -140,33 +223,59 @@ public StopDatafeedRequestDescriptor Force(bool? force = true) /// Refer to the description for the timeout query parameter. /// /// - public StopDatafeedRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowNoMatchValue.HasValue) - { - writer.WritePropertyName("allow_no_match"); - writer.WriteBooleanValue(AllowNoMatchValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ForceValue.HasValue) - { - writer.WritePropertyName("force"); - writer.WriteBooleanValue(ForceValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedResponse.g.cs index 984d91eafa8..0f1780e30f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopDatafeedResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopDatafeedResponse : ElasticsearchResponse +internal sealed partial class StopDatafeedResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopped")] - public bool Stopped { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStopped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopped.TryReadProperty(ref reader, options, PropStopped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopped = propStopped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopped, value.Stopped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponseConverter))] +public sealed partial class StopDatafeedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopDatafeedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Stopped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentRequest.g.cs index 998d7826948..6c3110a5c05 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopTrainedModelDeploymentRequestParameters : RequestParameters +public sealed partial class StopTrainedModelDeploymentRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,25 +44,77 @@ public sealed partial class StopTrainedModelDeploymentRequestParameters : Reques public bool? Force { get => Q("force"); set => Q("force", value); } } +internal sealed partial class StopTrainedModelDeploymentRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop a trained model deployment. /// /// -public sealed partial class StopTrainedModelDeploymentRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestConverter))] +public sealed partial class StopTrainedModelDeploymentRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public StopTrainedModelDeploymentRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopTrainedModelDeployment; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningStopTrainedModelDeployment; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.stop_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + /// /// /// Specifies what to do when the request: contains wildcard expressions and there are no deployments that match; @@ -78,7 +123,6 @@ public StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelI /// If false, the request returns a 404 status code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -87,7 +131,6 @@ public StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelI /// restart the model deployment. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } } @@ -96,32 +139,114 @@ public StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelI /// Stop a trained model deployment. /// /// -public sealed partial class StopTrainedModelDeploymentRequestDescriptor : RequestDescriptor +public readonly partial struct StopTrainedModelDeploymentRequestDescriptor { - internal StopTrainedModelDeploymentRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest Instance { get; init; } - public StopTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningStopTrainedModelDeployment; + public StopTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest(modelId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StopTrainedModelDeploymentRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.stop_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// Specifies what to do when the request: contains wildcard expressions and there are no deployments that match; + /// contains the _all string or no identifiers and there are no matches; or contains wildcard expressions and + /// there are only partial matches. By default, it returns an empty array when there are no matches and the subset of results when there are partial matches. + /// If false, the request returns a 404 status code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } + + /// + /// + /// Forcefully stops the deployment, even if it is used by ingest pipelines. You can't use these pipelines until you + /// restart the model deployment. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } - public StopTrainedModelDeploymentRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public StopTrainedModelDeploymentRequestDescriptor Force(bool? force = true) => Qs("force", force); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StopTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentResponse.g.cs index b7e839abf4f..1fd2973607b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/StopTrainedModelDeploymentResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class StopTrainedModelDeploymentResponse : ElasticsearchResponse +internal sealed partial class StopTrainedModelDeploymentResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopped")] - public bool Stopped { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStopped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopped.TryReadProperty(ref reader, options, PropStopped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopped = propStopped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopped, value.Stopped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponseConverter))] +public sealed partial class StopTrainedModelDeploymentResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTrainedModelDeploymentResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Stopped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsRequest.g.cs index 002350b9b66..2af12cef3c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsRequest.g.cs @@ -17,49 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateDataFrameAnalyticsRequestParameters : RequestParameters +public sealed partial class UpdateDataFrameAnalyticsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class UpdateDataFrameAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propDescription = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue propModelMemoryLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Description = propDescription.Value, + MaxNumThreads = propMaxNumThreads.Value, + ModelMemoryLimit = propModelMemoryLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update a data frame analytics job. /// /// -public sealed partial class UpdateDataFrameAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestConverter))] +public sealed partial class UpdateDataFrameAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public UpdateDataFrameAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDataFrameAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateDataFrameAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_data_frame_analytics"; + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// Specifies whether this job can start when there is insufficient machine /// learning node capacity for it to be immediately assigned to a node. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_start")] public bool? AllowLazyStart { get; set; } /// @@ -67,7 +150,6 @@ public UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -78,7 +160,6 @@ public UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// for operational functionality other than the analysis itself. /// /// - [JsonInclude, JsonPropertyName("max_num_threads")] public int? MaxNumThreads { get; set; } /// @@ -90,7 +171,6 @@ public UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// greater than that setting. /// /// - [JsonInclude, JsonPropertyName("model_memory_limit")] public string? ModelMemoryLimit { get; set; } } @@ -99,43 +179,53 @@ public UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// Update a data frame analytics job. /// /// -public sealed partial class UpdateDataFrameAnalyticsRequestDescriptor : RequestDescriptor, UpdateDataFrameAnalyticsRequestParameters> +public readonly partial struct UpdateDataFrameAnalyticsRequestDescriptor { - internal UpdateDataFrameAnalyticsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest Instance { get; init; } - public UpdateDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest(id); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateDataFrameAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.update_data_frame_analytics"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - public UpdateDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the data frame analytics job. This identifier can contain + /// lowercase alphanumeric characters (a-z and 0-9), hyphens, and + /// underscores. It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private string? DescriptionValue { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - /// /// /// Specifies whether this job can start when there is insufficient machine /// learning node capacity for it to be immediately assigned to a node. /// /// - public UpdateDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? value = true) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.AllowLazyStart = value; + return this; } /// @@ -143,10 +233,10 @@ public UpdateDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? /// A description of the job. /// /// - public UpdateDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -157,10 +247,10 @@ public UpdateDataFrameAnalyticsRequestDescriptor Description(string? /// for operational functionality other than the analysis itself. /// /// - public UpdateDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? value) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.MaxNumThreads = value; + return this; } /// @@ -172,154 +262,59 @@ public UpdateDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? m /// greater than that setting. /// /// - public UpdateDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) - { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } - - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Update a data frame analytics job. -/// -/// -public sealed partial class UpdateDataFrameAnalyticsRequestDescriptor : RequestDescriptor -{ - internal UpdateDataFrameAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); - - public UpdateDataFrameAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDataFrameAnalytics; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ml.update_data_frame_analytics"; - - public UpdateDataFrameAnalyticsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Required("id", id); - return Self; + Instance.FilterPath = value; + return this; } - private bool? AllowLazyStartValue { get; set; } - private string? DescriptionValue { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - - /// - /// - /// Specifies whether this job can start when there is insufficient machine - /// learning node capacity for it to be immediately assigned to a node. - /// - /// - public UpdateDataFrameAnalyticsRequestDescriptor AllowLazyStart(bool? allowLazyStart = true) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor Human(bool? value) { - AllowLazyStartValue = allowLazyStart; - return Self; + Instance.Human = value; + return this; } - /// - /// - /// A description of the job. - /// - /// - public UpdateDataFrameAnalyticsRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor Pretty(bool? value) { - DescriptionValue = description; - return Self; + Instance.Pretty = value; + return this; } - /// - /// - /// The maximum number of threads to be used by the analysis. Using more - /// threads may decrease the time necessary to complete the analysis at the - /// cost of using more CPU. Note that the process may use additional threads - /// for operational functionality other than the analysis itself. - /// - /// - public UpdateDataFrameAnalyticsRequestDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor SourceQueryString(string? value) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.SourceQueryString = value; + return this; } - /// - /// - /// The approximate maximum amount of memory resources that are permitted for - /// analytical processing. If your elasticsearch.yml file contains an - /// xpack.ml.max_model_memory_limit setting, an error occurs when you try - /// to create data frame analytics jobs that have model_memory_limit values - /// greater than that setting. - /// - /// - public UpdateDataFrameAnalyticsRequestDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - writer.WriteStartObject(); - if (AllowLazyStartValue.HasValue) - { - writer.WritePropertyName("allow_lazy_start"); - writer.WriteBooleanValue(AllowLazyStartValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } - - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } - - writer.WriteEndObject(); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsResponse.g.cs index b1c66fc047e..873acfeaec9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDataFrameAnalyticsResponse.g.cs @@ -17,39 +17,210 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateDataFrameAnalyticsResponse : ElasticsearchResponse +internal sealed partial class UpdateDataFrameAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propId = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + Authorization = propAuthorization.Value, + CreateTime = propCreateTime.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Id = propId.Value, + MaxNumThreads = propMaxNumThreads.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponseConverter))] +public sealed partial class UpdateDataFrameAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("allow_lazy_start")] - public bool AllowLazyStart { get; init; } - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; init; } - [JsonInclude, JsonPropertyName("analyzed_fields")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; init; } - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public long CreateTime { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("max_num_threads")] - public int MaxNumThreads { get; init; } - [JsonInclude, JsonPropertyName("model_memory_limit")] - public string ModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateDataFrameAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateDataFrameAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowLazyStart { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateTime { get; set; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxNumThreads { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelMemoryLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedRequest.g.cs index b7116b1731f..996fc46017f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateDatafeedRequestParameters : RequestParameters +public sealed partial class UpdateDatafeedRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -73,7 +66,15 @@ public sealed partial class UpdateDatafeedRequestParameters : RequestParameters /// /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// @@ -83,182 +84,150 @@ public sealed partial class UpdateDatafeedRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } -internal sealed partial class UpdateDatafeedRequestConverter : JsonConverter +internal sealed partial class UpdateDatafeedRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override UpdateDatafeedRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("indexes"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new UpdateDatafeedRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "chunking_config") - { - variant.ChunkingConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "delayed_data_check_config") - { - variant.DelayedDataCheckConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "frequency") - { - variant.Frequency = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices" || property == "indexes") - { - variant.Indices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "indices_options") - { - variant.IndicesOptions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "job_id") - { - variant.JobId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_empty_searches") - { - variant.MaxEmptySearches = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query_delay") - { - variant.QueryDelay = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "scroll_size") - { - variant.ScrollSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, UpdateDatafeedRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; + } - if (value.ChunkingConfig is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, value.ChunkingConfig, options); - } + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } - if (value.DelayedDataCheckConfig is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, value.DelayedDataCheckConfig, options); - } + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)) || propIndices.TryReadProperty(ref reader, options, PropIndices1, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Frequency is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, value.Frequency, options); - } + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } - if (value.Indices is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, value.Indices, options); - } + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } - if (value.IndicesOptions is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, value.IndicesOptions, options); - } + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } - if (value.JobId is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, value.JobId, options); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.MaxEmptySearches.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(value.MaxEmptySearches.Value); - } + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.QueryDelay is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, value.QueryDelay, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ScrollSize.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(value.ScrollSize.Value); - } + Aggregations = propAggregations.Value, + ChunkingConfig = propChunkingConfig.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); writer.WriteEndObject(); } } @@ -272,32 +241,51 @@ public override void Write(Utf8JsonWriter writer, UpdateDatafeedRequest value, J /// those credentials are used instead. /// /// -[JsonConverter(typeof(UpdateDatafeedRequestConverter))] -public sealed partial class UpdateDatafeedRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestConverter))] +public sealed partial class UpdateDatafeedRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) { } - +#if NET7_0_OR_GREATER public UpdateDatafeedRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDatafeed; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateDatafeed; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id DatafeedId { get => P("datafeed_id"); set => PR("datafeed_id", value); } + /// /// /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the /// _all string or when no indices are specified. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -333,15 +321,21 @@ public UpdateDatafeedRequest() /// /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// /// If true, unavailable indices (missing or closed) are ignored. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -350,8 +344,7 @@ public UpdateDatafeedRequest() /// with low cardinality data. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// @@ -360,7 +353,6 @@ public UpdateDatafeedRequest() /// these time chunks are calculated; it is an advanced configuration option. /// /// - [JsonInclude, JsonPropertyName("chunking_config")] public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfig { get; set; } /// @@ -372,7 +364,6 @@ public UpdateDatafeedRequest() /// datafeeds. /// /// - [JsonInclude, JsonPropertyName("delayed_data_check_config")] public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; set; } /// @@ -384,7 +375,6 @@ public UpdateDatafeedRequest() /// must be divisible by the interval of the date histogram aggregation. /// /// - [JsonInclude, JsonPropertyName("frequency")] public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } /// @@ -393,17 +383,14 @@ public UpdateDatafeedRequest() /// learning nodes must have the remote_cluster_client role. /// /// - [JsonInclude, JsonPropertyName("indices")] - public ICollection? Indices { get; set; } + public System.Collections.Generic.ICollection? Indices { get; set; } /// /// /// Specifies index expansion options that are used during search. /// /// - [JsonInclude, JsonPropertyName("indices_options")] public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; set; } - [JsonInclude, JsonPropertyName("job_id")] public Elastic.Clients.Elasticsearch.Id? JobId { get; set; } /// @@ -414,7 +401,6 @@ public UpdateDatafeedRequest() /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. /// /// - [JsonInclude, JsonPropertyName("max_empty_searches")] public int? MaxEmptySearches { get; set; } /// @@ -428,7 +414,6 @@ public UpdateDatafeedRequest() /// when you are satisfied with the results of the job. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -439,7 +424,6 @@ public UpdateDatafeedRequest() /// when there are multiple jobs running on the same node. /// /// - [JsonInclude, JsonPropertyName("query_delay")] public Elastic.Clients.Elasticsearch.Duration? QueryDelay { get; set; } /// @@ -447,8 +431,7 @@ public UpdateDatafeedRequest() /// Specifies runtime fields for the datafeed search. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// @@ -456,8 +439,7 @@ public UpdateDatafeedRequest() /// The detector configuration objects in a job can contain functions that use these script fields. /// /// - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } /// /// @@ -465,7 +447,6 @@ public UpdateDatafeedRequest() /// The maximum value is the value of index.max_result_window. /// /// - [JsonInclude, JsonPropertyName("scroll_size")] public int? ScrollSize { get; set; } } @@ -478,412 +459,634 @@ public UpdateDatafeedRequest() /// those credentials are used instead. /// /// -public sealed partial class UpdateDatafeedRequestDescriptor : RequestDescriptor, UpdateDatafeedRequestParameters> +public readonly partial struct UpdateDatafeedRequestDescriptor { - internal UpdateDatafeedRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest Instance { get; init; } - public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDatafeed; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ml.update_datafeed"; - - public UpdateDatafeedRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public UpdateDatafeedRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public UpdateDatafeedRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(datafeedId); + } - public UpdateDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateDatafeedRequestDescriptor() { - RouteValues.Required("datafeed_id", datafeedId); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only - /// with low cardinality data. + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. /// /// - public UpdateDatafeedRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.DatafeedId = value; + return this; } /// /// - /// Datafeeds might search over long time periods, for several months or years. This search is split into time - /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of - /// these time chunks are calculated; it is an advanced configuration option. + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the + /// _all string or when no indices are specified. /// /// - public UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AllowNoIndices(bool? value = true) { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; + Instance.AllowNoIndices = value; + return this; } - public UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; + Instance.ExpandWildcards = value; + return this; } - public UpdateDatafeedRequestDescriptor ChunkingConfig(Action configure) + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } + [System.Obsolete("Deprecated in '7.16.0'.")] /// /// - /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally - /// search over indices that have already been read in an effort to determine whether any data has subsequently been - /// added to the index. If missing data is found, it is a good indication that the query_delay is set too low and - /// the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time - /// datafeeds. + /// If true, concrete, expanded or aliased indices are ignored when frozen. /// /// - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IgnoreThrottled(bool? value = true) { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; + Instance.IgnoreThrottled = value; + return this; } - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) + /// + /// + /// If true, unavailable indices (missing or closed) are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IgnoreUnavailable(bool? value = true) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.Aggregations = value; + return this; } /// /// - /// The interval at which scheduled queries are made while the datafeed runs in real time. The default value is - /// either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket - /// span. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are - /// written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value - /// must be divisible by the interval of the date histogram aggregation. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. /// /// - public UpdateDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations() { - FrequencyValue = frequency; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } /// /// - /// An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine - /// learning nodes must have the remote_cluster_client role. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. /// /// - public UpdateDatafeedRequestDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations(System.Action? action) { - IndicesValue = indices; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } /// /// - /// Specifies index expansion options that are used during search. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. /// /// - public UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations(System.Action>? action) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } - public UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public UpdateDatafeedRequestDescriptor IndicesOptions(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddAggregation(string key, System.Action action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } - public UpdateDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddAggregation(string key, System.Action> action) { - JobIdValue = jobId; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// /// - /// If a real-time datafeed has never seen any data (including during any initial training period), it automatically - /// stops and closes the associated job after this many real-time searches return no documents. In other words, - /// it stops after frequency times max_empty_searches of real-time operation. If not set, a datafeed with no - /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. + /// Datafeeds might search over long time periods, for several months or years. This search is split into time + /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of + /// these time chunks are calculated; it is an advanced configuration option. /// /// - public UpdateDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.ChunkingConfig = value; + return this; } /// /// - /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an - /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this - /// object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also - /// changed. Therefore, the time required to learn might be long and the understandability of the results is - /// unpredictable. If you want to make significant changes to the source data, it is recommended that you - /// clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one - /// when you are satisfied with the results of the job. + /// Datafeeds might search over long time periods, for several months or years. This search is split into time + /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of + /// these time chunks are calculated; it is an advanced configuration option. /// /// - public UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ChunkingConfig(System.Action action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; } - public UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally + /// search over indices that have already been read in an effort to determine whether any data has subsequently been + /// added to the index. If missing data is found, it is a good indication that the query_delay is set too low and + /// the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time + /// datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.DelayedDataCheckConfig = value; + return this; } - public UpdateDatafeedRequestDescriptor Query(Action> configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally + /// search over indices that have already been read in an effort to determine whether any data has subsequently been + /// added to the index. If missing data is found, it is a good indication that the query_delay is set too low and + /// the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time + /// datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(System.Action action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// /// - /// The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might - /// not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default - /// value is randomly selected between 60s and 120s. This randomness improves the query performance - /// when there are multiple jobs running on the same node. + /// The interval at which scheduled queries are made while the datafeed runs in real time. The default value is + /// either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket + /// span. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are + /// written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value + /// must be divisible by the interval of the date histogram aggregation. /// /// - public UpdateDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.Frequency = value; + return this; } /// /// - /// Specifies runtime fields for the datafeed search. + /// An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine + /// learning nodes must have the remote_cluster_client role. /// /// - public UpdateDatafeedRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Indices(System.Collections.Generic.ICollection? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Indices = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. - /// The detector configuration objects in a job can contain functions that use these script fields. + /// An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine + /// learning nodes must have the remote_cluster_client role. /// /// - public UpdateDatafeedRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Indices(params string[] values) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Indices = [.. values]; + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. - /// The maximum value is the value of index.max_result_window. + /// Specifies index expansion options that are used during search. /// /// - public UpdateDatafeedRequestDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - ScrollSizeValue = scrollSize; - return Self; + Instance.IndicesOptions = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions() { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions(System.Action? action) + { + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.JobId = value; + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + /// + /// + /// If a real-time datafeed has never seen any data (including during any initial training period), it automatically + /// stops and closes the associated job after this many real-time searches return no documents. In other words, + /// it stops after frequency times max_empty_searches of real-time operation. If not set, a datafeed with no + /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor MaxEmptySearches(int? value) + { + Instance.MaxEmptySearches = value; + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also + /// changed. Therefore, the time required to learn might be long and the understandability of the results is + /// unpredictable. If you want to make significant changes to the source data, it is recommended that you + /// clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one + /// when you are satisfied with the results of the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also + /// changed. Therefore, the time required to learn might be long and the understandability of the results is + /// unpredictable. If you want to make significant changes to the source data, it is recommended that you + /// clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one + /// when you are satisfied with the results of the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also + /// changed. Therefore, the time required to learn might be long and the understandability of the results is + /// unpredictable. If you want to make significant changes to the source data, it is recommended that you + /// clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one + /// when you are satisfied with the results of the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + /// + /// + /// The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might + /// not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default + /// value is randomly selected between 60s and 120s. This randomness improves the query performance + /// when there are multiple jobs running on the same node. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.QueryDelay = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } - if (QueryDelayValue is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); - } + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (ScrollSizeValue.HasValue) - { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } + + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } + + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. + /// The maximum value is the value of index.max_result_window. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -896,53 +1099,155 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// those credentials are used instead. /// /// -public sealed partial class UpdateDatafeedRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateDatafeedRequestDescriptor { - internal UpdateDatafeedRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest Instance { get; init; } - public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) : base(r => r.Required("datafeed_id", datafeedId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateDatafeed; + public UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.Id datafeedId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(datafeedId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateDatafeedRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.update_datafeed"; + /// + /// + /// A numerical character string that uniquely identifies the datafeed. + /// This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. + /// It must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.DatafeedId = value; + return this; + } + + /// + /// + /// If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the + /// _all string or when no indices are specified. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public UpdateDatafeedRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public UpdateDatafeedRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public UpdateDatafeedRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument determines + /// whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: + /// + /// + /// + /// + /// all: Match any data stream or index, including hidden ones. + /// + /// + /// + /// + /// closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + /// + /// + /// hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + /// + /// + /// none: Wildcard patterns are not accepted. + /// + /// + /// + /// + /// open: Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public UpdateDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id datafeedId) + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IgnoreThrottled(bool? value = true) { - RouteValues.Required("datafeed_id", datafeedId); - return Self; + Instance.IgnoreThrottled = value; + return this; } - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + /// + /// + /// If true, unavailable indices (missing or closed) are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } /// /// @@ -950,41 +1255,74 @@ public UpdateDatafeedRequestDescriptor DatafeedId(Elastic.Clients.Elasticsearch. /// with low cardinality data. /// /// - public UpdateDatafeedRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations = value; + return this; } /// /// - /// Datafeeds might search over long time periods, for several months or years. This search is split into time - /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of - /// these time chunks are calculated; it is an advanced configuration option. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only + /// with low cardinality data. /// /// - public UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddAggregation(string key, System.Action> action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } - public UpdateDatafeedRequestDescriptor ChunkingConfig(Action configure) + /// + /// + /// Datafeeds might search over long time periods, for several months or years. This search is split into time + /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of + /// these time chunks are calculated; it is an advanced configuration option. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.ChunkingConfig = value; + return this; + } + + /// + /// + /// Datafeeds might search over long time periods, for several months or years. This search is split into time + /// chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of + /// these time chunks are calculated; it is an advanced configuration option. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ChunkingConfig(System.Action action) + { + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; } /// @@ -996,28 +1334,25 @@ public UpdateDatafeedRequestDescriptor ChunkingConfig(Action /// - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) - { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; - } - - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; + Instance.DelayedDataCheckConfig = value; + return this; } - public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally + /// search over indices that have already been read in an effort to determine whether any data has subsequently been + /// added to the index. If missing data is found, it is a good indication that the query_delay is set too low and + /// the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time + /// datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(System.Action action) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// @@ -1029,10 +1364,10 @@ public UpdateDatafeedRequestDescriptor DelayedDataCheckConfig(Action /// - public UpdateDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -1041,10 +1376,22 @@ public UpdateDatafeedRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.D /// learning nodes must have the remote_cluster_client role. /// /// - public UpdateDatafeedRequestDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Indices(System.Collections.Generic.ICollection? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; + } + + /// + /// + /// An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine + /// learning nodes must have the remote_cluster_client role. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Indices(params string[] values) + { + Instance.Indices = [.. values]; + return this; } /// @@ -1052,34 +1399,38 @@ public UpdateDatafeedRequestDescriptor Indices(ICollection? indices) /// Specifies index expansion options that are used during search. /// /// - public UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.IndicesOptions = value; + return this; } - public UpdateDatafeedRequestDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions() { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; } - public UpdateDatafeedRequestDescriptor IndicesOptions(Action configure) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor IndicesOptions(System.Action? action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; } - public UpdateDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -1090,10 +1441,10 @@ public UpdateDatafeedRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? j /// end time that sees no data remains started until it is explicitly stopped. By default, it is not set. /// /// - public UpdateDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor MaxEmptySearches(int? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.MaxEmptySearches = value; + return this; } /// @@ -1107,28 +1458,27 @@ public UpdateDatafeedRequestDescriptor MaxEmptySearches(int? maxEmptySearches) /// when you are satisfied with the results of the job. /// /// - public UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public UpdateDatafeedRequestDescriptor Query(Action configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an + /// Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this + /// object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also + /// changed. Therefore, the time required to learn might be long and the understandability of the results is + /// unpredictable. If you want to make significant changes to the source data, it is recommended that you + /// clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one + /// when you are satisfied with the results of the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -1139,10 +1489,10 @@ public UpdateDatafeedRequestDescriptor Query(Action /// - public UpdateDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.QueryDelay = value; + return this; } /// @@ -1150,157 +1500,171 @@ public UpdateDatafeedRequestDescriptor QueryDelay(Elastic.Clients.Elasticsearch. /// Specifies runtime fields for the datafeed search. /// /// - public UpdateDatafeedRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. - /// The detector configuration objects in a job can contain functions that use these script fields. + /// Specifies runtime fields for the datafeed search. /// /// - public UpdateDatafeedRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. - /// The maximum value is the value of index.max_result_window. + /// Specifies runtime fields for the datafeed search. /// /// - public UpdateDatafeedRequestDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RuntimeMappings(System.Action>? action) { - ScrollSizeValue = scrollSize; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. + /// The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } - if (QueryDelayValue is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); - } + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. + /// The maximum value is the value of index.max_result_window. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ScrollSizeValue.HasValue) - { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedResponse.g.cs index ebee97ee8e8..1914a21b5bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateDatafeedResponse.g.cs @@ -17,45 +17,232 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateDatafeedResponse : ElasticsearchResponse +internal sealed partial class UpdateDatafeedResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("chunking_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig ChunkingConfig { get; init; } - [JsonInclude, JsonPropertyName("datafeed_id")] - public string DatafeedId { get; init; } - [JsonInclude, JsonPropertyName("delayed_data_check_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; init; } - [JsonInclude, JsonPropertyName("frequency")] - public Elastic.Clients.Elasticsearch.Duration? Frequency { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("indices_options")] - public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("max_empty_searches")] - public int? MaxEmptySearches { get; init; } - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; init; } - [JsonInclude, JsonPropertyName("query_delay")] - public Elastic.Clients.Elasticsearch.Duration QueryDelay { get; init; } - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IReadOnlyDictionary? RuntimeMappings { get; init; } - [JsonInclude, JsonPropertyName("script_fields")] - public IReadOnlyDictionary? ScriptFields { get; init; } - [JsonInclude, JsonPropertyName("scroll_size")] - public int ScrollSize { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedId = System.Text.Json.JsonEncodedText.Encode("datafeed_id"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDatafeedId = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } + + if (propDatafeedId.TryReadProperty(ref reader, options, PropDatafeedId, null)) + { + continue; + } + + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Authorization = propAuthorization.Value, + ChunkingConfig = propChunkingConfig.Value, + DatafeedId = propDatafeedId.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDatafeedId, value.DatafeedId, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponseConverter))] +public sealed partial class UpdateDatafeedResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateDatafeedResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateDatafeedResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig ChunkingConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DatafeedId { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfig { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public int? MaxEmptySearches { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration QueryDelay { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ScriptFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ScrollSize { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterRequest.g.cs index 444d8a9d5a7..1719e860c6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateFilterRequestParameters : RequestParameters +public sealed partial class UpdateFilterRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class UpdateFilterRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAddItems = System.Text.Json.JsonEncodedText.Encode("add_items"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropRemoveItems = System.Text.Json.JsonEncodedText.Encode("remove_items"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAddItems = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propRemoveItems = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAddItems.TryReadProperty(ref reader, options, PropAddItems, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propRemoveItems.TryReadProperty(ref reader, options, PropRemoveItems, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AddItems = propAddItems.Value, + Description = propDescription.Value, + RemoveItems = propRemoveItems.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAddItems, value.AddItems, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropRemoveItems, value.RemoveItems, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } } /// @@ -40,34 +90,55 @@ public sealed partial class UpdateFilterRequestParameters : RequestParameters /// Updates the description of a filter, adds items, or removes items from the list. /// /// -public sealed partial class UpdateFilterRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestConverter))] +public sealed partial class UpdateFilterRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) { } +#if NET7_0_OR_GREATER + public UpdateFilterRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateFilter; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateFilter; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_filter"; + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id FilterId { get => P("filter_id"); set => PR("filter_id", value); } + /// /// /// The items to add to the filter. /// /// - [JsonInclude, JsonPropertyName("add_items")] - public ICollection? AddItems { get; set; } + public System.Collections.Generic.ICollection? AddItems { get; set; } /// /// /// A description for the filter. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -75,8 +146,7 @@ public UpdateFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r = /// The items to remove from the filter. /// /// - [JsonInclude, JsonPropertyName("remove_items")] - public ICollection? RemoveItems { get; set; } + public System.Collections.Generic.ICollection? RemoveItems { get; set; } } /// @@ -85,41 +155,61 @@ public UpdateFilterRequest(Elastic.Clients.Elasticsearch.Id filterId) : base(r = /// Updates the description of a filter, adds items, or removes items from the list. /// /// -public sealed partial class UpdateFilterRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateFilterRequestDescriptor { - internal UpdateFilterRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest Instance { get; init; } - public UpdateFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) : base(r => r.Required("filter_id", filterId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateFilter; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateFilterRequestDescriptor(Elastic.Clients.Elasticsearch.Id filterId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest(filterId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateFilterRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.update_filter"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor descriptor) => descriptor.Instance; - public UpdateFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id filterId) + /// + /// + /// A string that uniquely identifies a filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor FilterId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("filter_id", filterId); - return Self; + Instance.FilterId = value; + return this; } - private ICollection? AddItemsValue { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? RemoveItemsValue { get; set; } + /// + /// + /// The items to add to the filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor AddItems(System.Collections.Generic.ICollection? value) + { + Instance.AddItems = value; + return this; + } /// /// /// The items to add to the filter. /// /// - public UpdateFilterRequestDescriptor AddItems(ICollection? addItems) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor AddItems(params string[] values) { - AddItemsValue = addItems; - return Self; + Instance.AddItems = [.. values]; + return this; } /// @@ -127,10 +217,10 @@ public UpdateFilterRequestDescriptor AddItems(ICollection? addItems) /// A description for the filter. /// /// - public UpdateFilterRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -138,33 +228,70 @@ public UpdateFilterRequestDescriptor Description(string? description) /// The items to remove from the filter. /// /// - public UpdateFilterRequestDescriptor RemoveItems(ICollection? removeItems) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor RemoveItems(System.Collections.Generic.ICollection? value) { - RemoveItemsValue = removeItems; - return Self; + Instance.RemoveItems = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The items to remove from the filter. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor RemoveItems(params string[] values) { - writer.WriteStartObject(); - if (AddItemsValue is not null) - { - writer.WritePropertyName("add_items"); - JsonSerializer.Serialize(writer, AddItemsValue, options); - } + Instance.RemoveItems = [.. values]; + return this; + } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RemoveItemsValue is not null) - { - writer.WritePropertyName("remove_items"); - JsonSerializer.Serialize(writer, RemoveItemsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterResponse.g.cs index 7cbe0f06cbc..a74119a24c0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateFilterResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateFilterResponse : ElasticsearchResponse +internal sealed partial class UpdateFilterResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("filter_id")] - public string FilterId { get; init; } - [JsonInclude, JsonPropertyName("items")] - public IReadOnlyCollection Items { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFilterId = System.Text.Json.JsonEncodedText.Encode("filter_id"); + private static readonly System.Text.Json.JsonEncodedText PropItems = System.Text.Json.JsonEncodedText.Encode("items"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propFilterId = default; + LocalJsonValue> propItems = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFilterId.TryReadProperty(ref reader, options, PropFilterId, null)) + { + continue; + } + + if (propItems.TryReadProperty(ref reader, options, PropItems, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + FilterId = propFilterId.Value, + Items = propItems.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFilterId, value.FilterId, null, null); + writer.WriteProperty(options, PropItems, value.Items, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponseConverter))] +public sealed partial class UpdateFilterResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateFilterResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateFilterResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FilterId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Items { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobRequest.g.cs index 83f7061f442..2172625a44f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobRequest.g.cs @@ -17,43 +17,224 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateJobRequestParameters : RequestParameters +public sealed partial class UpdateJobRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class UpdateJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyOpen = System.Text.Json.JsonEncodedText.Encode("allow_lazy_open"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropBackgroundPersistInterval = System.Text.Json.JsonEncodedText.Encode("background_persist_interval"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFilters = System.Text.Json.JsonEncodedText.Encode("categorization_filters"); + private static readonly System.Text.Json.JsonEncodedText PropCustomSettings = System.Text.Json.JsonEncodedText.Encode("custom_settings"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDetectors = System.Text.Json.JsonEncodedText.Encode("detectors"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlotConfig = System.Text.Json.JsonEncodedText.Encode("model_plot_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelPruneWindow = System.Text.Json.JsonEncodedText.Encode("model_prune_window"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropPerPartitionCategorization = System.Text.Json.JsonEncodedText.Encode("per_partition_categorization"); + private static readonly System.Text.Json.JsonEncodedText PropRenormalizationWindowDays = System.Text.Json.JsonEncodedText.Encode("renormalization_window_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsRetentionDays = System.Text.Json.JsonEncodedText.Encode("results_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyOpen = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propBackgroundPersistInterval = default; + LocalJsonValue?> propCategorizationFilters = default; + LocalJsonValue?> propCustomSettings = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propDetectors = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propModelPlotConfig = default; + LocalJsonValue propModelPruneWindow = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propPerPartitionCategorization = default; + LocalJsonValue propRenormalizationWindowDays = default; + LocalJsonValue propResultsRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyOpen.TryReadProperty(ref reader, options, PropAllowLazyOpen, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propBackgroundPersistInterval.TryReadProperty(ref reader, options, PropBackgroundPersistInterval, null)) + { + continue; + } + + if (propCategorizationFilters.TryReadProperty(ref reader, options, PropCategorizationFilters, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCustomSettings.TryReadProperty(ref reader, options, PropCustomSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDetectors.TryReadProperty(ref reader, options, PropDetectors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propModelPlotConfig.TryReadProperty(ref reader, options, PropModelPlotConfig, null)) + { + continue; + } + + if (propModelPruneWindow.TryReadProperty(ref reader, options, PropModelPruneWindow, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propPerPartitionCategorization.TryReadProperty(ref reader, options, PropPerPartitionCategorization, null)) + { + continue; + } + + if (propRenormalizationWindowDays.TryReadProperty(ref reader, options, PropRenormalizationWindowDays, null)) + { + continue; + } + + if (propResultsRetentionDays.TryReadProperty(ref reader, options, PropResultsRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyOpen = propAllowLazyOpen.Value, + AnalysisLimits = propAnalysisLimits.Value, + BackgroundPersistInterval = propBackgroundPersistInterval.Value, + CategorizationFilters = propCategorizationFilters.Value, + CustomSettings = propCustomSettings.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + Description = propDescription.Value, + Detectors = propDetectors.Value, + Groups = propGroups.Value, + ModelPlotConfig = propModelPlotConfig.Value, + ModelPruneWindow = propModelPruneWindow.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + PerPartitionCategorization = propPerPartitionCategorization.Value, + RenormalizationWindowDays = propRenormalizationWindowDays.Value, + ResultsRetentionDays = propResultsRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyOpen, value.AllowLazyOpen, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropBackgroundPersistInterval, value.BackgroundPersistInterval, null, null); + writer.WriteProperty(options, PropCategorizationFilters, value.CategorizationFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCustomSettings, value.CustomSettings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDetectors, value.Detectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropModelPlotConfig, value.ModelPlotConfig, null, null); + writer.WriteProperty(options, PropModelPruneWindow, value.ModelPruneWindow, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropPerPartitionCategorization, value.PerPartitionCategorization, null, null); + writer.WriteProperty(options, PropRenormalizationWindowDays, value.RenormalizationWindowDays, null, null); + writer.WriteProperty(options, PropResultsRetentionDays, value.ResultsRetentionDays, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update an anomaly detection job. /// Updates certain properties of an anomaly detection job. /// /// -public sealed partial class UpdateJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestConverter))] +public sealed partial class UpdateJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) { } +#if NET7_0_OR_GREATER + public UpdateJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_job"; + /// + /// + /// Identifier for the job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + /// /// /// Advanced configuration option. Specifies whether this job can open when @@ -67,9 +248,7 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// machine learning node capacity is available. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_open")] public bool? AllowLazyOpen { get; set; } - [JsonInclude, JsonPropertyName("analysis_limits")] public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? AnalysisLimits { get; set; } /// @@ -86,10 +265,8 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// changes to take effect. /// /// - [JsonInclude, JsonPropertyName("background_persist_interval")] public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; set; } - [JsonInclude, JsonPropertyName("categorization_filters")] - public ICollection? CategorizationFilters { get; set; } + public System.Collections.Generic.ICollection? CategorizationFilters { get; set; } /// /// @@ -98,8 +275,7 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// custom URLs to machine learning results. /// /// - [JsonInclude, JsonPropertyName("custom_settings")] - public IDictionary? CustomSettings { get; set; } + public System.Collections.Generic.IDictionary? CustomSettings { get; set; } /// /// @@ -112,7 +288,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// model_snapshot_retention_days. /// /// - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] public long? DailyModelSnapshotRetentionAfterDays { get; set; } /// @@ -120,7 +295,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -128,19 +302,15 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// An array of detector update objects. /// /// - [JsonInclude, JsonPropertyName("detectors")] - public ICollection? Detectors { get; set; } + public System.Collections.Generic.ICollection? Detectors { get; set; } /// /// /// A list of job groups. A job can belong to no groups or many. /// /// - [JsonInclude, JsonPropertyName("groups")] - public ICollection? Groups { get; set; } - [JsonInclude, JsonPropertyName("model_plot_config")] + public System.Collections.Generic.ICollection? Groups { get; set; } public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; set; } - [JsonInclude, JsonPropertyName("model_prune_window")] public Elastic.Clients.Elasticsearch.Duration? ModelPruneWindow { get; set; } /// @@ -151,7 +321,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// timestamp of the most recent snapshot for this job. /// /// - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] public long? ModelSnapshotRetentionDays { get; set; } /// @@ -159,7 +328,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// Settings related to how categorization interacts with partition fields. /// /// - [JsonInclude, JsonPropertyName("per_partition_categorization")] public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorization { get; set; } /// @@ -168,7 +336,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// score are applied, as new data is seen. /// /// - [JsonInclude, JsonPropertyName("renormalization_window_days")] public long? RenormalizationWindowDays { get; set; } /// @@ -181,7 +348,6 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// value is null, which means all results are retained. /// /// - [JsonInclude, JsonPropertyName("results_retention_days")] public long? ResultsRetentionDays { get; set; } } @@ -191,52 +357,40 @@ public UpdateJobRequest(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Re /// Updates certain properties of an anomaly detection job. /// /// -public sealed partial class UpdateJobRequestDescriptor : RequestDescriptor, UpdateJobRequestParameters> +public readonly partial struct UpdateJobRequestDescriptor { - internal UpdateJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest Instance { get; init; } - public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.update_job"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor descriptor) => descriptor.Instance; - public UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) - { - RouteValues.Required("job_id", jobId); - return Self; - } - - private bool? AllowLazyOpenValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? BackgroundPersistIntervalValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private IDictionary? CustomSettingsValue { get; set; } - private long? DailyModelSnapshotRetentionAfterDaysValue { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? DetectorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor DetectorsDescriptor { get; set; } - private Action> DetectorsDescriptorAction { get; set; } - private Action>[] DetectorsDescriptorActions { get; set; } - private ICollection? GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotConfigDescriptor { get; set; } - private Action> ModelPlotConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ModelPruneWindowValue { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor PerPartitionCategorizationDescriptor { get; set; } - private Action PerPartitionCategorizationDescriptorAction { get; set; } - private long? RenormalizationWindowDaysValue { get; set; } - private long? ResultsRetentionDaysValue { get; set; } + /// + /// + /// Identifier for the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } /// /// @@ -251,34 +405,22 @@ public UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch /// machine learning node capacity is available. /// /// - public UpdateJobRequestDescriptor AllowLazyOpen(bool? allowLazyOpen = true) - { - AllowLazyOpenValue = allowLazyOpen; - return Self; - } - - public UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AllowLazyOpen(bool? value = true) { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AllowLazyOpen = value; + return this; } - public UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? value) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = value; + return this; } - public UpdateJobRequestDescriptor AnalysisLimits(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AnalysisLimits(System.Action action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor.Build(action); + return this; } /// @@ -295,16 +437,22 @@ public UpdateJobRequestDescriptor AnalysisLimits(Action /// - public UpdateJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? backgroundPersistInterval) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? value) { - BackgroundPersistIntervalValue = backgroundPersistInterval; - return Self; + Instance.BackgroundPersistInterval = value; + return this; } - public UpdateJobRequestDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CategorizationFilters(params string[] values) + { + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -314,10 +462,43 @@ public UpdateJobRequestDescriptor CategorizationFilters(ICollection /// - public UpdateJobRequestDescriptor CustomSettings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings(System.Collections.Generic.IDictionary? value) { - CustomSettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.CustomSettings = value; + return this; + } + + /// + /// + /// Advanced configuration option. Contains custom meta data about the job. + /// For example, it can contain custom URL information as shown in Adding + /// custom URLs to machine learning results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings() + { + Instance.CustomSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Advanced configuration option. Contains custom meta data about the job. + /// For example, it can contain custom URL information as shown in Adding + /// custom URLs to machine learning results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings(System.Action? action) + { + Instance.CustomSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AddCustomSetting(string key, object value) + { + Instance.CustomSettings ??= new System.Collections.Generic.Dictionary(); + Instance.CustomSettings.Add(key, value); + return this; } /// @@ -331,10 +512,10 @@ public UpdateJobRequestDescriptor CustomSettings(Funcmodel_snapshot_retention_days. /// /// - public UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? value) { - DailyModelSnapshotRetentionAfterDaysValue = dailyModelSnapshotRetentionAfterDays; - return Self; + Instance.DailyModelSnapshotRetentionAfterDays = value; + return this; } /// @@ -342,10 +523,10 @@ public UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDay /// A description of the job. /// /// - public UpdateJobRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -353,40 +534,66 @@ public UpdateJobRequestDescriptor Description(string? description) /// An array of detector update objects. /// /// - public UpdateJobRequestDescriptor Detectors(ICollection? detectors) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(System.Collections.Generic.ICollection? value) { - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsValue = detectors; - return Self; + Instance.Detectors = value; + return this; } - public UpdateJobRequestDescriptor Detectors(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor descriptor) + /// + /// + /// An array of detector update objects. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(params Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate[] values) { - DetectorsValue = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsDescriptor = descriptor; - return Self; + Instance.Detectors = [.. values]; + return this; } - public UpdateJobRequestDescriptor Detectors(Action> configure) + /// + /// + /// An array of detector update objects. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(params System.Action[] actions) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorActions = null; - DetectorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; } - public UpdateJobRequestDescriptor Detectors(params Action>[] configure) + /// + /// + /// An array of detector update objects. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; + } + + /// + /// + /// A list of job groups. A job can belong to no groups or many. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Groups(System.Collections.Generic.ICollection? value) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = configure; - return Self; + Instance.Groups = value; + return this; } /// @@ -394,40 +601,40 @@ public UpdateJobRequestDescriptor Detectors(params Action /// - public UpdateJobRequestDescriptor Groups(ICollection? groups) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Groups(params string[] values) + { + Instance.Groups = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - GroupsValue = groups; - return Self; + Instance.ModelPlotConfig = value; + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlotConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig() { - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigValue = modelPlotConfig; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig(System.Action? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigDescriptor = descriptor; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig(System.Action>? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = configure; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? modelPruneWindow) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? value) { - ModelPruneWindowValue = modelPruneWindow; - return Self; + Instance.ModelPruneWindow = value; + return this; } /// @@ -438,10 +645,10 @@ public UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.El /// timestamp of the most recent snapshot for this job. /// /// - public UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } /// @@ -449,28 +656,32 @@ public UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? mo /// Settings related to how categorization interacts with partition fields. /// /// - public UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? perPartitionCategorization) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? value) { - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationValue = perPartitionCategorization; - return Self; + Instance.PerPartitionCategorization = value; + return this; } - public UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor descriptor) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization() { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationDescriptor = descriptor; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(null); + return this; } - public UpdateJobRequestDescriptor PerPartitionCategorization(Action configure) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization(System.Action? action) { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = configure; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(action); + return this; } /// @@ -479,10 +690,10 @@ public UpdateJobRequestDescriptor PerPartitionCategorization(Action /// - public UpdateJobRequestDescriptor RenormalizationWindowDays(long? renormalizationWindowDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RenormalizationWindowDays(long? value) { - RenormalizationWindowDaysValue = renormalizationWindowDays; - return Self; + Instance.RenormalizationWindowDays = value; + return this; } /// @@ -495,161 +706,60 @@ public UpdateJobRequestDescriptor RenormalizationWindowDays(long? ren /// value is null, which means all results are retained. /// /// - public UpdateJobRequestDescriptor ResultsRetentionDays(long? resultsRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ResultsRetentionDays(long? value) { - ResultsRetentionDaysValue = resultsRetentionDays; - return Self; + Instance.ResultsRetentionDays = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AllowLazyOpenValue.HasValue) - { - writer.WritePropertyName("allow_lazy_open"); - writer.WriteBooleanValue(AllowLazyOpenValue.Value); - } - - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); - } - - if (BackgroundPersistIntervalValue is not null) - { - writer.WritePropertyName("background_persist_interval"); - JsonSerializer.Serialize(writer, BackgroundPersistIntervalValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - if (CustomSettingsValue is not null) - { - writer.WritePropertyName("custom_settings"); - JsonSerializer.Serialize(writer, CustomSettingsValue, options); - } - - if (DailyModelSnapshotRetentionAfterDaysValue.HasValue) - { - writer.WritePropertyName("daily_model_snapshot_retention_after_days"); - writer.WriteNumberValue(DailyModelSnapshotRetentionAfterDaysValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DetectorsDescriptor is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DetectorsDescriptor, options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorAction is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(DetectorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorActions is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - foreach (var action in DetectorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DetectorsValue is not null) - { - writer.WritePropertyName("detectors"); - JsonSerializer.Serialize(writer, DetectorsValue, options); - } - - if (GroupsValue is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ModelPlotConfigDescriptor is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigDescriptor, options); - } - else if (ModelPlotConfigDescriptorAction is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotConfigDescriptorAction), options); - } - else if (ModelPlotConfigValue is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ModelPruneWindowValue is not null) - { - writer.WritePropertyName("model_prune_window"); - JsonSerializer.Serialize(writer, ModelPruneWindowValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PerPartitionCategorizationDescriptor is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationDescriptor, options); - } - else if (PerPartitionCategorizationDescriptorAction is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(PerPartitionCategorizationDescriptorAction), options); - } - else if (PerPartitionCategorizationValue is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (RenormalizationWindowDaysValue.HasValue) - { - writer.WritePropertyName("renormalization_window_days"); - writer.WriteNumberValue(RenormalizationWindowDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ResultsRetentionDaysValue.HasValue) - { - writer.WritePropertyName("results_retention_days"); - writer.WriteNumberValue(ResultsRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -659,52 +769,40 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Updates certain properties of an anomaly detection job. /// /// -public sealed partial class UpdateJobRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateJobRequestDescriptor { - internal UpdateJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest Instance { get; init; } - public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) : base(r => r.Required("job_id", jobId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(jobId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.update_job"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor descriptor) => descriptor.Instance; - public UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) - { - RouteValues.Required("job_id", jobId); - return Self; - } - - private bool? AllowLazyOpenValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? BackgroundPersistIntervalValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private IDictionary? CustomSettingsValue { get; set; } - private long? DailyModelSnapshotRetentionAfterDaysValue { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? DetectorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor DetectorsDescriptor { get; set; } - private Action DetectorsDescriptorAction { get; set; } - private Action[] DetectorsDescriptorActions { get; set; } - private ICollection? GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotConfigDescriptor { get; set; } - private Action ModelPlotConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ModelPruneWindowValue { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor PerPartitionCategorizationDescriptor { get; set; } - private Action PerPartitionCategorizationDescriptorAction { get; set; } - private long? RenormalizationWindowDaysValue { get; set; } - private long? ResultsRetentionDaysValue { get; set; } + /// + /// + /// Identifier for the job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } /// /// @@ -719,34 +817,22 @@ public UpdateJobRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) /// machine learning node capacity is available. /// /// - public UpdateJobRequestDescriptor AllowLazyOpen(bool? allowLazyOpen = true) - { - AllowLazyOpenValue = allowLazyOpen; - return Self; - } - - public UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AllowLazyOpen(bool? value = true) { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AllowLazyOpen = value; + return this; } - public UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit? value) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = value; + return this; } - public UpdateJobRequestDescriptor AnalysisLimits(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AnalysisLimits(System.Action action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor.Build(action); + return this; } /// @@ -763,16 +849,22 @@ public UpdateJobRequestDescriptor AnalysisLimits(Action /// - public UpdateJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? backgroundPersistInterval) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor BackgroundPersistInterval(Elastic.Clients.Elasticsearch.Duration? value) { - BackgroundPersistIntervalValue = backgroundPersistInterval; - return Self; + Instance.BackgroundPersistInterval = value; + return this; } - public UpdateJobRequestDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CategorizationFilters(params string[] values) + { + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -782,10 +874,43 @@ public UpdateJobRequestDescriptor CategorizationFilters(ICollection? cat /// custom URLs to machine learning results. /// /// - public UpdateJobRequestDescriptor CustomSettings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings(System.Collections.Generic.IDictionary? value) { - CustomSettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.CustomSettings = value; + return this; + } + + /// + /// + /// Advanced configuration option. Contains custom meta data about the job. + /// For example, it can contain custom URL information as shown in Adding + /// custom URLs to machine learning results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings() + { + Instance.CustomSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Advanced configuration option. Contains custom meta data about the job. + /// For example, it can contain custom URL information as shown in Adding + /// custom URLs to machine learning results. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor CustomSettings(System.Action? action) + { + Instance.CustomSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor AddCustomSetting(string key, object value) + { + Instance.CustomSettings ??= new System.Collections.Generic.Dictionary(); + Instance.CustomSettings.Add(key, value); + return this; } /// @@ -799,10 +924,10 @@ public UpdateJobRequestDescriptor CustomSettings(Funcmodel_snapshot_retention_days. /// /// - public UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? value) { - DailyModelSnapshotRetentionAfterDaysValue = dailyModelSnapshotRetentionAfterDays; - return Self; + Instance.DailyModelSnapshotRetentionAfterDays = value; + return this; } /// @@ -810,10 +935,10 @@ public UpdateJobRequestDescriptor DailyModelSnapshotRetentionAfterDays(long? dai /// A description of the job. /// /// - public UpdateJobRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -821,40 +946,49 @@ public UpdateJobRequestDescriptor Description(string? description) /// An array of detector update objects. /// /// - public UpdateJobRequestDescriptor Detectors(ICollection? detectors) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(System.Collections.Generic.ICollection? value) { - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsValue = detectors; - return Self; + Instance.Detectors = value; + return this; } - public UpdateJobRequestDescriptor Detectors(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor descriptor) + /// + /// + /// An array of detector update objects. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(params Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate[] values) { - DetectorsValue = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsDescriptor = descriptor; - return Self; + Instance.Detectors = [.. values]; + return this; } - public UpdateJobRequestDescriptor Detectors(Action configure) + /// + /// + /// An array of detector update objects. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Detectors(params System.Action>[] actions) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorActions = null; - DetectorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; } - public UpdateJobRequestDescriptor Detectors(params Action[] configure) + /// + /// + /// A list of job groups. A job can belong to no groups or many. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Groups(System.Collections.Generic.ICollection? value) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = configure; - return Self; + Instance.Groups = value; + return this; } /// @@ -862,40 +996,34 @@ public UpdateJobRequestDescriptor Detectors(params Action /// - public UpdateJobRequestDescriptor Groups(ICollection? groups) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Groups(params string[] values) { - GroupsValue = groups; - return Self; + Instance.Groups = [.. values]; + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlotConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigValue = modelPlotConfig; - return Self; + Instance.ModelPlotConfig = value; + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig() { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptorAction = null; - ModelPlotConfigDescriptor = descriptor; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public UpdateJobRequestDescriptor ModelPlotConfig(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPlotConfig(System.Action>? action) { - ModelPlotConfigValue = null; - ModelPlotConfigDescriptor = null; - ModelPlotConfigDescriptorAction = configure; - return Self; + Instance.ModelPlotConfig = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? modelPruneWindow) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? value) { - ModelPruneWindowValue = modelPruneWindow; - return Self; + Instance.ModelPruneWindow = value; + return this; } /// @@ -906,10 +1034,10 @@ public UpdateJobRequestDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch /// timestamp of the most recent snapshot for this job. /// /// - public UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } /// @@ -917,28 +1045,32 @@ public UpdateJobRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshot /// Settings related to how categorization interacts with partition fields. /// /// - public UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? perPartitionCategorization) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? value) { - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationValue = perPartitionCategorization; - return Self; + Instance.PerPartitionCategorization = value; + return this; } - public UpdateJobRequestDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor descriptor) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization() { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationDescriptor = descriptor; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(null); + return this; } - public UpdateJobRequestDescriptor PerPartitionCategorization(Action configure) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor PerPartitionCategorization(System.Action? action) { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = configure; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(action); + return this; } /// @@ -947,10 +1079,10 @@ public UpdateJobRequestDescriptor PerPartitionCategorization(Action /// - public UpdateJobRequestDescriptor RenormalizationWindowDays(long? renormalizationWindowDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RenormalizationWindowDays(long? value) { - RenormalizationWindowDaysValue = renormalizationWindowDays; - return Self; + Instance.RenormalizationWindowDays = value; + return this; } /// @@ -963,160 +1095,59 @@ public UpdateJobRequestDescriptor RenormalizationWindowDays(long? renormalizatio /// value is null, which means all results are retained. /// /// - public UpdateJobRequestDescriptor ResultsRetentionDays(long? resultsRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ResultsRetentionDays(long? value) { - ResultsRetentionDaysValue = resultsRetentionDays; - return Self; + Instance.ResultsRetentionDays = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AllowLazyOpenValue.HasValue) - { - writer.WritePropertyName("allow_lazy_open"); - writer.WriteBooleanValue(AllowLazyOpenValue.Value); - } - - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); - } - - if (BackgroundPersistIntervalValue is not null) - { - writer.WritePropertyName("background_persist_interval"); - JsonSerializer.Serialize(writer, BackgroundPersistIntervalValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - if (CustomSettingsValue is not null) - { - writer.WritePropertyName("custom_settings"); - JsonSerializer.Serialize(writer, CustomSettingsValue, options); - } - - if (DailyModelSnapshotRetentionAfterDaysValue.HasValue) - { - writer.WritePropertyName("daily_model_snapshot_retention_after_days"); - writer.WriteNumberValue(DailyModelSnapshotRetentionAfterDaysValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DetectorsDescriptor is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DetectorsDescriptor, options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorAction is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(DetectorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorActions is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - foreach (var action in DetectorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DetectorsValue is not null) - { - writer.WritePropertyName("detectors"); - JsonSerializer.Serialize(writer, DetectorsValue, options); - } - - if (GroupsValue is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ModelPlotConfigDescriptor is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigDescriptor, options); - } - else if (ModelPlotConfigDescriptorAction is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotConfigDescriptorAction), options); - } - else if (ModelPlotConfigValue is not null) - { - writer.WritePropertyName("model_plot_config"); - JsonSerializer.Serialize(writer, ModelPlotConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ModelPruneWindowValue is not null) - { - writer.WritePropertyName("model_prune_window"); - JsonSerializer.Serialize(writer, ModelPruneWindowValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PerPartitionCategorizationDescriptor is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationDescriptor, options); - } - else if (PerPartitionCategorizationDescriptorAction is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(PerPartitionCategorizationDescriptorAction), options); - } - else if (PerPartitionCategorizationValue is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (RenormalizationWindowDaysValue.HasValue) - { - writer.WritePropertyName("renormalization_window_days"); - writer.WriteNumberValue(RenormalizationWindowDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ResultsRetentionDaysValue.HasValue) - { - writer.WritePropertyName("results_retention_days"); - writer.WriteNumberValue(ResultsRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobResponse.g.cs index 0fbf50d92cd..9779e6f0b75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateJobResponse.g.cs @@ -17,57 +17,308 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateJobResponse : ElasticsearchResponse +internal sealed partial class UpdateJobResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("allow_lazy_open")] - public bool AllowLazyOpen { get; init; } - [JsonInclude, JsonPropertyName("analysis_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead AnalysisConfig { get; init; } - [JsonInclude, JsonPropertyName("analysis_limits")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits AnalysisLimits { get; init; } - [JsonInclude, JsonPropertyName("background_persist_interval")] - public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public long CreateTime { get; init; } - [JsonInclude, JsonPropertyName("custom_settings")] - public IReadOnlyDictionary? CustomSettings { get; init; } - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] - public long DailyModelSnapshotRetentionAfterDays { get; init; } - [JsonInclude, JsonPropertyName("data_description")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; init; } - [JsonInclude, JsonPropertyName("datafeed_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("finished_time")] - public long? FinishedTime { get; init; } - [JsonInclude, JsonPropertyName("groups")] - public IReadOnlyCollection? Groups { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("job_type")] - public string JobType { get; init; } - [JsonInclude, JsonPropertyName("job_version")] - public string JobVersion { get; init; } - [JsonInclude, JsonPropertyName("model_plot_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_id")] - public string? ModelSnapshotId { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] - public long ModelSnapshotRetentionDays { get; init; } - [JsonInclude, JsonPropertyName("renormalization_window_days")] - public long? RenormalizationWindowDays { get; init; } - [JsonInclude, JsonPropertyName("results_index_name")] - public string ResultsIndexName { get; init; } - [JsonInclude, JsonPropertyName("results_retention_days")] - public long? ResultsRetentionDays { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyOpen = System.Text.Json.JsonEncodedText.Encode("allow_lazy_open"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropBackgroundPersistInterval = System.Text.Json.JsonEncodedText.Encode("background_persist_interval"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropCustomSettings = System.Text.Json.JsonEncodedText.Encode("custom_settings"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropDataDescription = System.Text.Json.JsonEncodedText.Encode("data_description"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedConfig = System.Text.Json.JsonEncodedText.Encode("datafeed_config"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFinishedTime = System.Text.Json.JsonEncodedText.Encode("finished_time"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropJobType = System.Text.Json.JsonEncodedText.Encode("job_type"); + private static readonly System.Text.Json.JsonEncodedText PropJobVersion = System.Text.Json.JsonEncodedText.Encode("job_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlotConfig = System.Text.Json.JsonEncodedText.Encode("model_plot_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotId = System.Text.Json.JsonEncodedText.Encode("model_snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropRenormalizationWindowDays = System.Text.Json.JsonEncodedText.Encode("renormalization_window_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsIndexName = System.Text.Json.JsonEncodedText.Encode("results_index_name"); + private static readonly System.Text.Json.JsonEncodedText PropResultsRetentionDays = System.Text.Json.JsonEncodedText.Encode("results_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyOpen = default; + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propBackgroundPersistInterval = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue?> propCustomSettings = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propDataDescription = default; + LocalJsonValue propDatafeedConfig = default; + LocalJsonValue propDescription = default; + LocalJsonValue propFinishedTime = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propJobId = default; + LocalJsonValue propJobType = default; + LocalJsonValue propJobVersion = default; + LocalJsonValue propModelPlotConfig = default; + LocalJsonValue propModelSnapshotId = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propRenormalizationWindowDays = default; + LocalJsonValue propResultsIndexName = default; + LocalJsonValue propResultsRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyOpen.TryReadProperty(ref reader, options, PropAllowLazyOpen, null)) + { + continue; + } + + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propBackgroundPersistInterval.TryReadProperty(ref reader, options, PropBackgroundPersistInterval, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propCustomSettings.TryReadProperty(ref reader, options, PropCustomSettings, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propDataDescription.TryReadProperty(ref reader, options, PropDataDescription, null)) + { + continue; + } + + if (propDatafeedConfig.TryReadProperty(ref reader, options, PropDatafeedConfig, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFinishedTime.TryReadProperty(ref reader, options, PropFinishedTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propJobType.TryReadProperty(ref reader, options, PropJobType, null)) + { + continue; + } + + if (propJobVersion.TryReadProperty(ref reader, options, PropJobVersion, null)) + { + continue; + } + + if (propModelPlotConfig.TryReadProperty(ref reader, options, PropModelPlotConfig, null)) + { + continue; + } + + if (propModelSnapshotId.TryReadProperty(ref reader, options, PropModelSnapshotId, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propRenormalizationWindowDays.TryReadProperty(ref reader, options, PropRenormalizationWindowDays, null)) + { + continue; + } + + if (propResultsIndexName.TryReadProperty(ref reader, options, PropResultsIndexName, null)) + { + continue; + } + + if (propResultsRetentionDays.TryReadProperty(ref reader, options, PropResultsRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyOpen = propAllowLazyOpen.Value, + AnalysisConfig = propAnalysisConfig.Value, + AnalysisLimits = propAnalysisLimits.Value, + BackgroundPersistInterval = propBackgroundPersistInterval.Value, + CreateTime = propCreateTime.Value, + CustomSettings = propCustomSettings.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + DataDescription = propDataDescription.Value, + DatafeedConfig = propDatafeedConfig.Value, + Description = propDescription.Value, + FinishedTime = propFinishedTime.Value, + Groups = propGroups.Value, + JobId = propJobId.Value, + JobType = propJobType.Value, + JobVersion = propJobVersion.Value, + ModelPlotConfig = propModelPlotConfig.Value, + ModelSnapshotId = propModelSnapshotId.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + RenormalizationWindowDays = propRenormalizationWindowDays.Value, + ResultsIndexName = propResultsIndexName.Value, + ResultsRetentionDays = propResultsRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyOpen, value.AllowLazyOpen, null, null); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropBackgroundPersistInterval, value.BackgroundPersistInterval, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropCustomSettings, value.CustomSettings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropDataDescription, value.DataDescription, null, null); + writer.WriteProperty(options, PropDatafeedConfig, value.DatafeedConfig, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFinishedTime, value.FinishedTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropJobType, value.JobType, null, null); + writer.WriteProperty(options, PropJobVersion, value.JobVersion, null, null); + writer.WriteProperty(options, PropModelPlotConfig, value.ModelPlotConfig, null, null); + writer.WriteProperty(options, PropModelSnapshotId, value.ModelSnapshotId, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropRenormalizationWindowDays, value.RenormalizationWindowDays, null, null); + writer.WriteProperty(options, PropResultsIndexName, value.ResultsIndexName, null, null); + writer.WriteProperty(options, PropResultsRetentionDays, value.ResultsRetentionDays, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponseConverter))] +public sealed partial class UpdateJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowLazyOpen { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead AnalysisConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits AnalysisLimits { get; set; } + public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset CreateTime { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? CustomSettings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DailyModelSnapshotRetentionAfterDays { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; set; } + public string? Description { get; set; } + public System.DateTimeOffset? FinishedTime { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Groups { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobVersion { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; set; } + public string? ModelSnapshotId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ModelSnapshotRetentionDays { get; set; } + public long? RenormalizationWindowDays { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultsIndexName { get; set; } + public long? ResultsRetentionDays { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotRequest.g.cs index d8c88bacb00..7e5649a3517 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateModelSnapshotRequestParameters : RequestParameters +public sealed partial class UpdateModelSnapshotRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class UpdateModelSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropRetain = System.Text.Json.JsonEncodedText.Encode("retain"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propRetain = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propRetain.TryReadProperty(ref reader, options, PropRetain, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Retain = propRetain.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropRetain, value.Retain, null, null); + writer.WriteEndObject(); + } } /// @@ -40,26 +81,59 @@ public sealed partial class UpdateModelSnapshotRequestParameters : RequestParame /// Updates certain properties of a snapshot. /// /// -public sealed partial class UpdateModelSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestConverter))] +public sealed partial class UpdateModelSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) { } +#if NET7_0_OR_GREATER + public UpdateModelSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateModelSnapshot; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateModelSnapshot; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_model_snapshot"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// Identifier for the model snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SnapshotId { get => P("snapshot_id"); set => PR("snapshot_id", value); } + /// /// /// A description of the model snapshot. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -69,7 +143,6 @@ public UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elasti /// snapshot will be deleted when the job is deleted. /// /// - [JsonInclude, JsonPropertyName("retain")] public bool? Retain { get; set; } } @@ -79,46 +152,61 @@ public UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elasti /// Updates certain properties of a snapshot. /// /// -public sealed partial class UpdateModelSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateModelSnapshotRequestDescriptor { - internal UpdateModelSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest Instance { get; init; } - public UpdateModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateModelSnapshot; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest(jobId, snapshotId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateModelSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "ml.update_model_snapshot"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor descriptor) => descriptor.Instance; - public UpdateModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.JobId = value; + return this; } - public UpdateModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId) + /// + /// + /// Identifier for the model snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("snapshot_id", snapshotId); - return Self; + Instance.SnapshotId = value; + return this; } - private string? DescriptionValue { get; set; } - private bool? RetainValue { get; set; } - /// /// /// A description of the model snapshot. /// /// - public UpdateModelSnapshotRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -128,27 +216,59 @@ public UpdateModelSnapshotRequestDescriptor Description(string? description) /// snapshot will be deleted when the job is deleted. /// /// - public UpdateModelSnapshotRequestDescriptor Retain(bool? retain = true) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor Retain(bool? value = true) { - RetainValue = retain; - return Self; + Instance.Retain = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RetainValue.HasValue) - { - writer.WritePropertyName("retain"); - writer.WriteBooleanValue(RetainValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotResponse.g.cs index c5fb4fc4670..4e3775db572 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateModelSnapshotResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateModelSnapshotResponse : ElasticsearchResponse +internal sealed partial class UpdateModelSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propModel = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Model = propModel.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponseConverter))] +public sealed partial class UpdateModelSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("model")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot Model { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateModelSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateModelSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot Model { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs index fbbf728cec4..3510350177d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateTrainedModelDeploymentRequestParameters : RequestParameters +public sealed partial class UpdateTrainedModelDeploymentRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class UpdateTrainedModelDeploymentRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("number_of_allocations"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + LocalJsonValue propNumberOfAllocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (propNumberOfAllocations.TryReadProperty(ref reader, options, PropNumberOfAllocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value, + NumberOfAllocations = propNumberOfAllocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteProperty(options, PropNumberOfAllocations, value.NumberOfAllocations, null, null); + writer.WriteEndObject(); + } } /// @@ -39,20 +80,52 @@ public sealed partial class UpdateTrainedModelDeploymentRequestParameters : Requ /// Update a trained model deployment. /// /// -public sealed partial class UpdateTrainedModelDeploymentRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestConverter))] +public sealed partial class UpdateTrainedModelDeploymentRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) { } +#if NET7_0_OR_GREATER + public UpdateTrainedModelDeploymentRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateTrainedModelDeployment; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpdateTrainedModelDeployment; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.update_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. Currently, only PyTorch models are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get => P("model_id"); set => PR("model_id", value); } + + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; set; } + /// /// /// The number of model allocations on each node where the model is deployed. @@ -61,9 +134,9 @@ public UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id mode /// Increasing this value generally increases the throughput. /// If this setting is greater than the number of hardware threads /// it will automatically be changed to a value less than the number of hardware threads. + /// If adaptive_allocations is enabled, do not set this value, because it’s automatically set. /// /// - [JsonInclude, JsonPropertyName("number_of_allocations")] public int? NumberOfAllocations { get; set; } } @@ -72,29 +145,66 @@ public UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id mode /// Update a trained model deployment. /// /// -public sealed partial class UpdateTrainedModelDeploymentRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateTrainedModelDeploymentRequestDescriptor { - internal UpdateTrainedModelDeploymentRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest Instance { get; init; } - public UpdateTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateTrainedModelDeployment; + public UpdateTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest(modelId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateTrainedModelDeploymentRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.update_trained_model_deployment"; + /// + /// + /// The unique identifier of the trained model. Currently, only PyTorch models are supported. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - public UpdateTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor AdaptiveAllocations(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? value) { - RouteValues.Required("model_id", modelId); - return Self; + Instance.AdaptiveAllocations = value; + return this; } - private int? NumberOfAllocationsValue { get; set; } + /// + /// + /// Adaptive allocations configuration. When enabled, the number of allocations + /// is set based on the current load. + /// If adaptive_allocations is enabled, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor AdaptiveAllocations(System.Action action) + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor.Build(action); + return this; + } /// /// @@ -104,23 +214,62 @@ public UpdateTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Ela /// Increasing this value generally increases the throughput. /// If this setting is greater than the number of hardware threads /// it will automatically be changed to a value less than the number of hardware threads. + /// If adaptive_allocations is enabled, do not set this value, because it’s automatically set. /// /// - public UpdateTrainedModelDeploymentRequestDescriptor NumberOfAllocations(int? numberOfAllocations) + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor NumberOfAllocations(int? value) { - NumberOfAllocationsValue = numberOfAllocations; - return Self; + Instance.NumberOfAllocations = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest Build(System.Action action) { - writer.WriteStartObject(); - if (NumberOfAllocationsValue.HasValue) - { - writer.WritePropertyName("number_of_allocations"); - writer.WriteNumberValue(NumberOfAllocationsValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs index 3ef93e48077..2fc9d92c54e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpdateTrainedModelDeploymentResponse : ElasticsearchResponse +internal sealed partial class UpdateTrainedModelDeploymentResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("assignment")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Assignment { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAssignment = System.Text.Json.JsonEncodedText.Encode("assignment"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignment = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignment.TryReadProperty(ref reader, options, PropAssignment, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Assignment = propAssignment.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignment, value.Assignment, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponseConverter))] +public sealed partial class UpdateTrainedModelDeploymentResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateTrainedModelDeploymentResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateTrainedModelDeploymentResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Assignment { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotRequest.g.cs index 07886ed234a..f84d7a98303 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpgradeJobSnapshotRequestParameters : RequestParameters +public sealed partial class UpgradeJobSnapshotRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,10 +41,39 @@ public sealed partial class UpgradeJobSnapshotRequestParameters : RequestParamet public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class UpgradeJobSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Upgrade a snapshot. -/// Upgrades an anomaly detection model snapshot to the latest major version. +/// Upgrade an anomaly detection model snapshot to the latest major version. /// Over time, older snapshot formats are deprecated and removed. Anomaly /// detection jobs support only snapshots that are from the current or previous /// major version. @@ -62,26 +84,59 @@ public sealed partial class UpgradeJobSnapshotRequestParameters : RequestParamet /// job. /// /// -public sealed partial class UpgradeJobSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestConverter))] +public sealed partial class UpgradeJobSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) { } +#if NET7_0_OR_GREATER + public UpgradeJobSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningUpgradeJobSnapshot; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "ml.upgrade_job_snapshot"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id JobId { get => P("job_id"); set => PR("job_id", value); } + + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SnapshotId { get => P("snapshot_id"); set => PR("snapshot_id", value); } + /// /// /// Controls the time to wait for the request to complete. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -90,14 +145,13 @@ public UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic /// Otherwise, it responds as soon as the upgrade task is assigned to a node. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } /// /// /// Upgrade a snapshot. -/// Upgrades an anomaly detection model snapshot to the latest major version. +/// Upgrade an anomaly detection model snapshot to the latest major version. /// Over time, older snapshot formats are deprecated and removed. Anomaly /// detection jobs support only snapshots that are from the current or previous /// major version. @@ -108,38 +162,122 @@ public UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic /// job. /// /// -public sealed partial class UpgradeJobSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct UpgradeJobSnapshotRequestDescriptor { - internal UpgradeJobSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest Instance { get; init; } - public UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot; + public UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest(jobId, snapshotId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpgradeJobSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.upgrade_job_snapshot"; + /// + /// + /// Identifier for the anomaly detection job. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.JobId = value; + return this; + } - public UpgradeJobSnapshotRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public UpgradeJobSnapshotRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// A numerical character string that uniquely identifies the model snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.SnapshotId = value; + return this; + } + + /// + /// + /// Controls the time to wait for the request to complete. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// When true, the API won’t respond until the upgrade is complete. + /// Otherwise, it responds as soon as the upgrade task is assigned to a node. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public UpgradeJobSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("job_id", jobId); - return Self; + Instance.SourceQueryString = value; + return this; } - public UpgradeJobSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId) + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("snapshot_id", snapshotId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotResponse.g.cs index 95e29dedea5..aafef6ef41d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpgradeJobSnapshotResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class UpgradeJobSnapshotResponse : ElasticsearchResponse +internal sealed partial class UpgradeJobSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompleted = System.Text.Json.JsonEncodedText.Encode("completed"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompleted = default; + LocalJsonValue propNode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompleted.TryReadProperty(ref reader, options, PropCompleted, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Completed = propCompleted.Value, + Node = propNode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompleted, value.Completed, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponseConverter))] +public sealed partial class UpgradeJobSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpgradeJobSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpgradeJobSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// When true, this means the task is complete. When false, it is still running. /// /// - [JsonInclude, JsonPropertyName("completed")] - public bool Completed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Completed { get; set; } /// /// /// The ID of the node that the upgrade task was started on if it is still running. In serverless this will be the "serverless". /// /// - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorRequest.g.cs index 0d1a079f90b..1181c7a333d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorRequest.g.cs @@ -17,21 +17,27 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ValidateDetectorRequestParameters : RequestParameters +public sealed partial class ValidateDetectorRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ValidateDetectorRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Detector = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Detector, null); + } } /// @@ -39,23 +45,44 @@ public sealed partial class ValidateDetectorRequestParameters : RequestParameter /// Validate an anomaly detection job. /// /// -public sealed partial class ValidateDetectorRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestConverter))] +public sealed partial class ValidateDetectorRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidateDetector; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateDetectorRequest(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) + { + Detector = detector; + } +#if NET7_0_OR_GREATER + public ValidateDetectorRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ValidateDetectorRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningValidateDetector; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.validate_detector"; - [JsonIgnore] - public Elastic.Clients.Elasticsearch.MachineLearning.Detector Detector { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Detector, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Detector Detector { get; set; } } /// @@ -63,50 +90,96 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Validate an anomaly detection job. /// /// -public sealed partial class ValidateDetectorRequestDescriptor : RequestDescriptor, ValidateDetectorRequestParameters> +public readonly partial struct ValidateDetectorRequestDescriptor { - internal ValidateDetectorRequestDescriptor(Action> configure) => configure.Invoke(this); - public ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) => DetectorValue = detector; + internal Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidateDetector; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ValidateDetectorRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.validate_detector"; + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.Detector value) + { + Instance.Detector = value; + return this; + } - private Elastic.Clients.Elasticsearch.MachineLearning.Detector DetectorValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorDescriptor { get; set; } - private Action> DetectorDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector() + { + Instance.Detector = Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector(System.Action? action) + { + Instance.Detector = Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector(System.Action>? action) + { + Instance.Detector = Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action); + return this; + } - public ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest Build(System.Action action) { - DetectorDescriptor = null; - DetectorDescriptorAction = null; - DetectorValue = detector; - return Self; + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor ErrorTrace(bool? value) { - DetectorValue = null; - DetectorDescriptorAction = null; - DetectorDescriptor = descriptor; - return Self; + Instance.ErrorTrace = value; + return this; } - public ValidateDetectorRequestDescriptor Detector(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor FilterPath(params string[]? value) { - DetectorValue = null; - DetectorDescriptor = null; - DetectorDescriptorAction = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Human(bool? value) { - JsonSerializer.Serialize(writer, DetectorValue, options); + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -115,49 +188,89 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Validate an anomaly detection job. /// /// -public sealed partial class ValidateDetectorRequestDescriptor : RequestDescriptor +public readonly partial struct ValidateDetectorRequestDescriptor { - internal ValidateDetectorRequestDescriptor(Action configure) => configure.Invoke(this); - public ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) => DetectorValue = detector; + internal Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidateDetector; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public ValidateDetectorRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "ml.validate_detector"; + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.Detector value) + { + Instance.Detector = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector() + { + Instance.Detector = Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Detector(System.Action>? action) + { + Instance.Detector = Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - private Elastic.Clients.Elasticsearch.MachineLearning.Detector DetectorValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorDescriptor { get; set; } - private Action DetectorDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor Pretty(bool? value) { - DetectorDescriptor = null; - DetectorDescriptorAction = null; - DetectorValue = detector; - return Self; + Instance.Pretty = value; + return this; } - public ValidateDetectorRequestDescriptor Detector(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor SourceQueryString(string? value) { - DetectorValue = null; - DetectorDescriptorAction = null; - DetectorDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public ValidateDetectorRequestDescriptor Detector(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - DetectorValue = null; - DetectorDescriptor = null; - DetectorDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, DetectorValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorResponse.g.cs index 3b016da7f28..4f8c69cc984 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateDetectorResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ValidateDetectorResponse : ElasticsearchResponse +internal sealed partial class ValidateDetectorResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponseConverter))] +public sealed partial class ValidateDetectorResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateDetectorResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateDetectorResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateRequest.g.cs index 9b5d2f7b8ec..9391628c814 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateRequest.g.cs @@ -17,21 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ValidateRequestParameters : RequestParameters +public sealed partial class ValidateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ValidateRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropDataDescription = System.Text.Json.JsonEncodedText.Encode("data_description"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlot = System.Text.Json.JsonEncodedText.Encode("model_plot"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotId = System.Text.Json.JsonEncodedText.Encode("model_snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsIndexName = System.Text.Json.JsonEncodedText.Encode("results_index_name"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propDataDescription = default; + LocalJsonValue propDescription = default; + LocalJsonValue propJobId = default; + LocalJsonValue propModelPlot = default; + LocalJsonValue propModelSnapshotId = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propResultsIndexName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propDataDescription.TryReadProperty(ref reader, options, PropDataDescription, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propModelPlot.TryReadProperty(ref reader, options, PropModelPlot, null)) + { + continue; + } + + if (propModelSnapshotId.TryReadProperty(ref reader, options, PropModelSnapshotId, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propResultsIndexName.TryReadProperty(ref reader, options, PropResultsIndexName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalysisConfig = propAnalysisConfig.Value, + AnalysisLimits = propAnalysisLimits.Value, + DataDescription = propDataDescription.Value, + Description = propDescription.Value, + JobId = propJobId.Value, + ModelPlot = propModelPlot.Value, + ModelSnapshotId = propModelSnapshotId.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + ResultsIndexName = propResultsIndexName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropDataDescription, value.DataDescription, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropModelPlot, value.ModelPlot, null, null); + writer.WriteProperty(options, PropModelSnapshotId, value.ModelSnapshotId, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropResultsIndexName, value.ResultsIndexName, null, null); + writer.WriteEndObject(); + } } /// @@ -39,33 +143,41 @@ public sealed partial class ValidateRequestParameters : RequestParameters /// Validate an anomaly detection job. /// /// -public sealed partial class ValidateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestConverter))] +public sealed partial class ValidateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidate; +#if NET7_0_OR_GREATER + public ValidateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ValidateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.MachineLearningValidate; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "ml.validate"; - [JsonInclude, JsonPropertyName("analysis_config")] public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfig { get; set; } - [JsonInclude, JsonPropertyName("analysis_limits")] public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimits { get; set; } - [JsonInclude, JsonPropertyName("data_description")] public Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? DataDescription { get; set; } - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } - [JsonInclude, JsonPropertyName("job_id")] public Elastic.Clients.Elasticsearch.Id? JobId { get; set; } - [JsonInclude, JsonPropertyName("model_plot")] public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlot { get; set; } - [JsonInclude, JsonPropertyName("model_snapshot_id")] public Elastic.Clients.Elasticsearch.Id? ModelSnapshotId { get; set; } - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] public long? ModelSnapshotRetentionDays { get; set; } - [JsonInclude, JsonPropertyName("results_index_name")] public Elastic.Clients.Elasticsearch.IndexName? ResultsIndexName { get; set; } } @@ -74,264 +186,191 @@ public sealed partial class ValidateRequest : PlainRequest /// -public sealed partial class ValidateRequestDescriptor : RequestDescriptor, ValidateRequestParameters> +public readonly partial struct ValidateRequestDescriptor { - internal ValidateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest Instance { get; init; } - public ValidateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public ValidateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "ml.validate"; + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action> AnalysisConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? DataDescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor DataDescriptionDescriptor { get; set; } - private Action> DataDescriptionDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotDescriptor { get; set; } - private Action> ModelPlotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? ModelSnapshotIdValue { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? ResultsIndexNameValue { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? value) + { + Instance.AnalysisConfig = value; + return this; + } - public ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? analysisConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisConfig(System.Action action) { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor AnalysisConfig(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? value) { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = value; + return this; } - public ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits() { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits(System.Action? action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor AnalysisLimits(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? value) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.DataDescription = value; + return this; } - public ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? dataDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription() { - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = null; - DataDescriptionValue = dataDescription; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription(System.Action? action) { - DataDescriptionValue = null; - DataDescriptionDescriptorAction = null; - DataDescriptionDescriptor = descriptor; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor DataDescription(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription(System.Action>? action) { - DataDescriptionValue = null; - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = configure; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } - public ValidateRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } - public ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlot) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - ModelPlotDescriptor = null; - ModelPlotDescriptorAction = null; - ModelPlotValue = modelPlot; - return Self; + Instance.ModelPlot = value; + return this; } - public ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot() { - ModelPlotValue = null; - ModelPlotDescriptorAction = null; - ModelPlotDescriptor = descriptor; - return Self; + Instance.ModelPlot = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor ModelPlot(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot(System.Action? action) { - ModelPlotValue = null; - ModelPlotDescriptor = null; - ModelPlotDescriptorAction = configure; - return Self; + Instance.ModelPlot = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor ModelSnapshotId(Elastic.Clients.Elasticsearch.Id? modelSnapshotId) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot(System.Action>? action) { - ModelSnapshotIdValue = modelSnapshotId; - return Self; + Instance.ModelPlot = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelSnapshotId(Elastic.Clients.Elasticsearch.Id? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotId = value; + return this; } - public ValidateRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? resultsIndexName) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ResultsIndexNameValue = resultsIndexName; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? value) { - writer.WriteStartObject(); - if (AnalysisConfigDescriptor is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else if (AnalysisConfigValue is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); - } + Instance.ResultsIndexName = value; + return this; + } - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DataDescriptionDescriptor is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionDescriptor, options); - } - else if (DataDescriptionDescriptorAction is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(DataDescriptionDescriptorAction), options); - } - else if (DataDescriptionValue is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelPlotDescriptor is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, ModelPlotDescriptor, options); - } - else if (ModelPlotDescriptorAction is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotDescriptorAction), options); - } - else if (ModelPlotValue is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, ModelPlotValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ModelSnapshotIdValue is not null) - { - writer.WritePropertyName("model_snapshot_id"); - JsonSerializer.Serialize(writer, ModelSnapshotIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ResultsIndexNameValue is not null) - { - writer.WritePropertyName("results_index_name"); - JsonSerializer.Serialize(writer, ResultsIndexNameValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -340,263 +379,172 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Validate an anomaly detection job. /// /// -public sealed partial class ValidateRequestDescriptor : RequestDescriptor +public readonly partial struct ValidateRequestDescriptor { - internal ValidateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest Instance { get; init; } - public ValidateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningValidate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "ml.validate"; - - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? AnalysisConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor AnalysisConfigDescriptor { get; set; } - private Action AnalysisConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimitsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor AnalysisLimitsDescriptor { get; set; } - private Action AnalysisLimitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? DataDescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor DataDescriptionDescriptor { get; set; } - private Action DataDescriptionDescriptorAction { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor ModelPlotDescriptor { get; set; } - private Action ModelPlotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? ModelSnapshotIdValue { get; set; } - private long? ModelSnapshotRetentionDaysValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? ResultsIndexNameValue { get; set; } - - public ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? analysisConfig) + public ValidateRequestDescriptor() { - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigValue = analysisConfig; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig? value) { - AnalysisConfigValue = null; - AnalysisConfigDescriptorAction = null; - AnalysisConfigDescriptor = descriptor; - return Self; + Instance.AnalysisConfig = value; + return this; } - public ValidateRequestDescriptor AnalysisConfig(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisConfig(System.Action> action) { - AnalysisConfigValue = null; - AnalysisConfigDescriptor = null; - AnalysisConfigDescriptorAction = configure; - return Self; + Instance.AnalysisConfig = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? analysisLimits) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? value) { - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsValue = analysisLimits; - return Self; + Instance.AnalysisLimits = value; + return this; } - public ValidateRequestDescriptor AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits() { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptorAction = null; - AnalysisLimitsDescriptor = descriptor; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor AnalysisLimits(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor AnalysisLimits(System.Action? action) { - AnalysisLimitsValue = null; - AnalysisLimitsDescriptor = null; - AnalysisLimitsDescriptorAction = configure; - return Self; + Instance.AnalysisLimits = Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? dataDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription? value) { - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = null; - DataDescriptionValue = dataDescription; - return Self; + Instance.DataDescription = value; + return this; } - public ValidateRequestDescriptor DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription() { - DataDescriptionValue = null; - DataDescriptionDescriptorAction = null; - DataDescriptionDescriptor = descriptor; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor DataDescription(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor DataDescription(System.Action>? action) { - DataDescriptionValue = null; - DataDescriptionDescriptor = null; - DataDescriptionDescriptorAction = configure; - return Self; + Instance.DataDescription = Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } - public ValidateRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } - public ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? modelPlot) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? value) { - ModelPlotDescriptor = null; - ModelPlotDescriptorAction = null; - ModelPlotValue = modelPlot; - return Self; + Instance.ModelPlot = value; + return this; } - public ValidateRequestDescriptor ModelPlot(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot() { - ModelPlotValue = null; - ModelPlotDescriptorAction = null; - ModelPlotDescriptor = descriptor; - return Self; + Instance.ModelPlot = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(null); + return this; } - public ValidateRequestDescriptor ModelPlot(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelPlot(System.Action>? action) { - ModelPlotValue = null; - ModelPlotDescriptor = null; - ModelPlotDescriptorAction = configure; - return Self; + Instance.ModelPlot = Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor.Build(action); + return this; } - public ValidateRequestDescriptor ModelSnapshotId(Elastic.Clients.Elasticsearch.Id? modelSnapshotId) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelSnapshotId(Elastic.Clients.Elasticsearch.Id? value) { - ModelSnapshotIdValue = modelSnapshotId; - return Self; + Instance.ModelSnapshotId = value; + return this; } - public ValidateRequestDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ModelSnapshotRetentionDays(long? value) { - ModelSnapshotRetentionDaysValue = modelSnapshotRetentionDays; - return Self; + Instance.ModelSnapshotRetentionDays = value; + return this; } - public ValidateRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? resultsIndexName) + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ResultsIndexName(Elastic.Clients.Elasticsearch.IndexName? value) { - ResultsIndexNameValue = resultsIndexName; - return Self; + Instance.ResultsIndexName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (AnalysisConfigDescriptor is not null) + if (action is null) { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigDescriptor, options); - } - else if (AnalysisConfigDescriptorAction is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(AnalysisConfigDescriptorAction), options); - } - else if (AnalysisConfigValue is not null) - { - writer.WritePropertyName("analysis_config"); - JsonSerializer.Serialize(writer, AnalysisConfigValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (AnalysisLimitsDescriptor is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsDescriptor, options); - } - else if (AnalysisLimitsDescriptorAction is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(AnalysisLimitsDescriptorAction), options); - } - else if (AnalysisLimitsValue is not null) - { - writer.WritePropertyName("analysis_limits"); - JsonSerializer.Serialize(writer, AnalysisLimitsValue, options); - } - - if (DataDescriptionDescriptor is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionDescriptor, options); - } - else if (DataDescriptionDescriptorAction is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(DataDescriptionDescriptorAction), options); - } - else if (DataDescriptionValue is not null) - { - writer.WritePropertyName("data_description"); - JsonSerializer.Serialize(writer, DataDescriptionValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ModelPlotDescriptor is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, ModelPlotDescriptor, options); - } - else if (ModelPlotDescriptorAction is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(ModelPlotDescriptorAction), options); - } - else if (ModelPlotValue is not null) - { - writer.WritePropertyName("model_plot"); - JsonSerializer.Serialize(writer, ModelPlotValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ModelSnapshotIdValue is not null) - { - writer.WritePropertyName("model_snapshot_id"); - JsonSerializer.Serialize(writer, ModelSnapshotIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ModelSnapshotRetentionDaysValue.HasValue) - { - writer.WritePropertyName("model_snapshot_retention_days"); - writer.WriteNumberValue(ModelSnapshotRetentionDaysValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (ResultsIndexNameValue is not null) - { - writer.WritePropertyName("results_index_name"); - JsonSerializer.Serialize(writer, ResultsIndexNameValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateResponse.g.cs index 09bd6cb03b7..c5a91537e47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/ValidateResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class ValidateResponse : ElasticsearchResponse +internal sealed partial class ValidateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponseConverter))] +public sealed partial class ValidateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValidateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValidateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetRequest.g.cs index 11041d3ecde..fb0410ae86e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiGetRequestParameters : RequestParameters +public sealed partial class MultiGetRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -101,6 +94,54 @@ public sealed partial class MultiGetRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } } +internal sealed partial class MultiGetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + + public override Elastic.Clients.Elasticsearch.MultiGetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDocs = default; + LocalJsonValue propIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value, + Ids = propIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiGetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIds, value.Ids, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get multiple documents. @@ -127,24 +168,43 @@ public sealed partial class MultiGetRequestParameters : RequestParameters /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. /// /// -public sealed partial class MultiGetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiGetRequestConverter))] +public sealed partial class MultiGetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + { + } +#if NET7_0_OR_GREATER public MultiGetRequest() { } - - public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) +#endif +#if !NET7_0_OR_GREATER + public MultiGetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceMultiGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "mget"; + /// + /// + /// Name of the index to retrieve documents from when ids are specified, or when a document in the docs array does not specify an index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Index { get => P("index"); set => PO("index", value); } + /// /// /// Should this request force synthetic _source? @@ -152,7 +212,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. /// /// - [JsonIgnore] public bool? ForceSyntheticSource { get => Q("force_synthetic_source"); set => Q("force_synthetic_source", value); } /// @@ -160,7 +219,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// Specifies the node or shard the operation should be performed on. Random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -168,7 +226,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -176,7 +233,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// If true, the request refreshes relevant shards before retrieving documents. /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -184,7 +240,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// Custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -192,7 +247,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// True or false to return the _source field or not, or a list of fields to return. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? Source { get => Q("_source"); set => Q("_source", value); } /// @@ -201,7 +255,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -211,7 +264,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -219,7 +271,6 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// If true, retrieves the document fields stored in the index rather than the document _source. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get => Q("stored_fields"); set => Q("stored_fields", value); } /// @@ -227,15 +278,13 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// The documents you want to retrieve. Required if no index is specified in the request URI. /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection? Docs { get; set; } + public System.Collections.Generic.ICollection? Docs { get; set; } /// /// /// The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. /// /// - [JsonInclude, JsonPropertyName("ids")] public Elastic.Clients.Elasticsearch.Ids? Ids { get; set; } } @@ -265,141 +314,322 @@ public MultiGetRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. /// /// -public sealed partial class MultiGetRequestDescriptor : RequestDescriptor, MultiGetRequestParameters> +public readonly partial struct MultiGetRequestDescriptor { - internal MultiGetRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiGetRequest Instance { get; init; } - public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.MultiGetRequest instance) { + Instance = instance; } - public MultiGetRequestDescriptor() : this(typeof(TDocument)) + public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.MultiGetRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiGet; + public MultiGetRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.MultiGetRequest instance) => new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// Name of the index to retrieve documents from when ids are specified, or when a document in the docs array does not specify an index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "mget"; + /// + /// + /// Should this request force synthetic _source? + /// Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor ForceSyntheticSource(bool? value = true) + { + Instance.ForceSyntheticSource = value; + return this; + } - public MultiGetRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public MultiGetRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public MultiGetRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public MultiGetRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public MultiGetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiGetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public MultiGetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public MultiGetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public MultiGetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); + /// + /// + /// Specifies the node or shard the operation should be performed on. Random by default. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - public MultiGetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Realtime(bool? value = true) { - RouteValues.Optional("index", index); - return Self; + Instance.Realtime = value; + return this; } - private ICollection? DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor DocsDescriptor { get; set; } - private Action> DocsDescriptorAction { get; set; } - private Action>[] DocsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ids? IdsValue { get; set; } + /// + /// + /// If true, the request refreshes relevant shards before retrieving documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } /// /// - /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// Custom value used to route operations to a specific shard. /// /// - public MultiGetRequestDescriptor Docs(ICollection? docs) + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Routing = value; + return this; } - public MultiGetRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor descriptor) + /// + /// + /// True or false to return the _source field or not, or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public MultiGetRequestDescriptor Docs(Action> configure) + /// + /// + /// True or false to return the _source field or not, or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Source(System.Func action) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } - public MultiGetRequestDescriptor Docs(params Action>[] configure) + /// + /// + /// True or false to return the _source field or not, or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; } /// /// - /// The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. /// /// - public MultiGetRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids? ids) + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) { - IdsValue = ids; - return Self; + Instance.SourceExcludes = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// If true, retrieves the document fields stored in the index rather than the document _source. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// If true, retrieves the document fields stored in the index rather than the document _source. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(System.Collections.Generic.ICollection? value) + { + Instance.Docs = value; + return this; + } + + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation[] values) + { + Instance.Docs = [.. values]; + return this; + } + + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor.Build(action)); } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (DocsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor.Build(action)); } - if (IdsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.Ids = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiGetRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); + return new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -429,140 +659,293 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. /// /// -public sealed partial class MultiGetRequestDescriptor : RequestDescriptor +public readonly partial struct MultiGetRequestDescriptor { - internal MultiGetRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiGetRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.MultiGetRequest instance) + { + Instance = instance; + } - public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + public MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.MultiGetRequest(index); } public MultiGetRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiGetRequest(typeof(TDocument)); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiGet; + public static explicit operator Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(Elastic.Clients.Elasticsearch.MultiGetRequest instance) => new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Name of the index to retrieve documents from when ids are specified, or when a document in the docs array does not specify an index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// Should this request force synthetic _source? + /// Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor ForceSyntheticSource(bool? value = true) + { + Instance.ForceSyntheticSource = value; + return this; + } - internal override string OperationName => "mget"; + /// + /// + /// Specifies the node or shard the operation should be performed on. Random by default. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } + + /// + /// + /// If true, the request refreshes relevant shards before retrieving documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - public MultiGetRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public MultiGetRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public MultiGetRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public MultiGetRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public MultiGetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiGetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? source) => Qs("_source", source); - public MultiGetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public MultiGetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public MultiGetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) => Qs("stored_fields", storedFields); + /// + /// + /// Custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - public MultiGetRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// True or false to return the _source field or not, or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam? value) { - RouteValues.Optional("index", index); - return Self; + Instance.Source = value; + return this; } - private ICollection? DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ids? IdsValue { get; set; } + /// + /// + /// True or false to return the _source field or not, or a list of fields to return. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory.Build(action); + return this; + } /// /// - /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. /// /// - public MultiGetRequestDescriptor Docs(ICollection? docs) + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.SourceExcludes = value; + return this; } - public MultiGetRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor descriptor) + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.SourceExcludes = value; + return this; } - public MultiGetRequestDescriptor Docs(Action configure) + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.SourceIncludes = value; + return this; } - public MultiGetRequestDescriptor Docs(params Action[] configure) + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.SourceIncludes = value; + return this; } /// /// - /// The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. + /// If true, retrieves the document fields stored in the index rather than the document _source. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// If true, retrieves the document fields stored in the index rather than the document _source. /// /// - public MultiGetRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids? ids) + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - IdsValue = ids; - return Self; + Instance.StoredFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(action), options); - } + Instance.Docs = value; + return this; + } - writer.WriteEndArray(); - } - else if (DocsValue is not null) + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation[] values) + { + Instance.Docs = [.. values]; + return this; + } + + /// + /// + /// The documents you want to retrieve. Required if no index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Docs(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor.Build(action)); } - if (IdsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. + /// + /// + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids? value) + { + Instance.Ids = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiGetRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); + return new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiGetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetResponse.g.cs index 1831e3c54b1..da836266902 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiGetResponse.g.cs @@ -17,17 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiGetResponse : ElasticsearchResponse +internal sealed partial class MultiGetResponseConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + + public override Elastic.Clients.Elasticsearch.MultiGetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiGetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiGetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteEndObject(); + } +} + +internal sealed partial class MultiGetResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory { + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiGetResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiGetResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiGetResponseConverterFactory))] +public sealed partial class MultiGetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiGetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The response includes a docs array that contains the documents in the order specified in the request. @@ -35,6 +100,9 @@ public sealed partial class MultiGetResponse : ElasticsearchResponse /// If there is a failure getting a particular document, the error is included in place of the document. /// /// - [JsonInclude, JsonPropertyName("docs")] - public IReadOnlyCollection> Docs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Docs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchRequest.g.cs index 526b27fa61e..806a161caaa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchRequest.g.cs @@ -17,22 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.IO; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiSearchRequestParameters : RequestParameters +public sealed partial class MultiSearchRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -53,7 +44,7 @@ public sealed partial class MultiSearchRequestParameters : RequestParameters /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -69,19 +60,32 @@ public sealed partial class MultiSearchRequestParameters : RequestParameters /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + /// + /// + /// Indicates whether hit.matched_queries should be rendered as a map that includes + /// the name of the matched query associated with its score (true) + /// or as an array containing the name of the matched queries (false) + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public bool? IncludeNamedQueriesScore { get => Q("include_named_queries_score"); set => Q("include_named_queries_score", value); } + /// /// /// Maximum number of concurrent searches the multi search API can execute. + /// Defaults to max(1, (# of data nodes * min(search thread pool size, 10))). /// /// - public long? MaxConcurrentSearches { get => Q("max_concurrent_searches"); set => Q("max_concurrent_searches", value); } + public int? MaxConcurrentSearches { get => Q("max_concurrent_searches"); set => Q("max_concurrent_searches", value); } /// /// /// Maximum number of concurrent shard requests that each sub-search request executes per node. /// /// - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// @@ -119,6 +123,19 @@ public sealed partial class MultiSearchRequestParameters : RequestParameters public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } +internal sealed partial class MultiSearchRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MultiSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Searches = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Searches, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + } +} + /// /// /// Run multiple searches. @@ -142,30 +159,63 @@ public sealed partial class MultiSearchRequestParameters : RequestParameters /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. /// /// -public sealed partial class MultiSearchRequest : PlainRequest, IStreamSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiSearchRequestConverter))] +public partial class MultiSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public MultiSearchRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } - public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices, System.Collections.Generic.ICollection searches) : base(r => r.Optional("index", indices)) { + Searches = searches; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearch; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchRequest(System.Collections.Generic.ICollection searches) + { + Searches = searches; + } +#if NET7_0_OR_GREATER + public MultiSearchRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceMultiSearch; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "msearch"; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases to search. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -173,7 +223,6 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. /// /// - [JsonIgnore] public bool? CcsMinimizeRoundtrips { get => Q("ccs_minimize_roundtrips"); set => Q("ccs_minimize_roundtrips", value); } /// @@ -181,15 +230,13 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, concrete, expanded or aliased indices are ignored when frozen. /// /// - [JsonIgnore] public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// @@ -197,31 +244,40 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } + /// + /// + /// Indicates whether hit.matched_queries should be rendered as a map that includes + /// the name of the matched query associated with its score (true) + /// or as an array containing the name of the matched queries (false) + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public bool? IncludeNamedQueriesScore { get => Q("include_named_queries_score"); set => Q("include_named_queries_score", value); } + /// /// /// Maximum number of concurrent searches the multi search API can execute. + /// Defaults to max(1, (# of data nodes * min(search thread pool size, 10))). /// /// - [JsonIgnore] - public long? MaxConcurrentSearches { get => Q("max_concurrent_searches"); set => Q("max_concurrent_searches", value); } + public int? MaxConcurrentSearches { get => Q("max_concurrent_searches"); set => Q("max_concurrent_searches", value); } /// /// /// Maximum number of concurrent shard requests that each sub-search request executes per node. /// /// - [JsonIgnore] - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// /// Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. /// /// - [JsonIgnore] public long? PreFilterShardSize { get => Q("pre_filter_shard_size"); set => Q("pre_filter_shard_size", value); } /// @@ -229,7 +285,6 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -237,7 +292,6 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// Custom routing value used to route search operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -245,7 +299,6 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// Indicates whether global term and document frequencies should be used when scoring returned documents. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -253,31 +306,12 @@ public MultiSearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base /// Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } - public List Searches { get; set; } - - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) - { - if (Searches is null) - return; - foreach (var item in Searches) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } - } - - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) - { - if (Searches is null) - return; - foreach (var item in Searches) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } - } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Searches { get; set; } } /// @@ -303,76 +337,261 @@ async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClien /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. /// /// -public sealed partial class MultiSearchRequestDescriptor : RequestDescriptor, MultiSearchRequestParameters>, IStreamSerializable +public readonly partial struct MultiSearchRequestDescriptor { - internal MultiSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiSearchRequest Instance { get; init; } - public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchRequest instance) { + Instance = instance; + } + + public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MultiSearchRequest(indices); +#pragma warning restore CS0618 } public MultiSearchRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearch; + public static explicit operator Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchRequest instance) => new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases to search. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "msearch"; + /// + /// + /// If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } - public MultiSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public MultiSearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public MultiSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public MultiSearchRequestDescriptor IgnoreThrottled(bool? ignoreThrottled = true) => Qs("ignore_throttled", ignoreThrottled); - public MultiSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public MultiSearchRequestDescriptor MaxConcurrentSearches(long? maxConcurrentSearches) => Qs("max_concurrent_searches", maxConcurrentSearches); - public MultiSearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public MultiSearchRequestDescriptor PreFilterShardSize(long? preFilterShardSize) => Qs("pre_filter_shard_size", preFilterShardSize); - public MultiSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public MultiSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public MultiSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public MultiSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - RouteValues.Optional("index", indices); - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IgnoreThrottled(bool? value = true) { + Instance.IgnoreThrottled = value; + return this; } - List _items = new(); + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + /// + /// + /// Indicates whether hit.matched_queries should be rendered as a map that includes + /// the name of the matched query associated with its score (true) + /// or as an array containing the name of the matched queries (false) + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IncludeNamedQueriesScore(bool? value = true) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } + Instance.IncludeNamedQueriesScore = value; + return this; } - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + /// + /// + /// Maximum number of concurrent searches the multi search API can execute. + /// Defaults to max(1, (# of data nodes * min(search thread pool size, 10))). + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor MaxConcurrentSearches(int? value) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } + Instance.MaxConcurrentSearches = value; + return this; } - public MultiSearchRequestDescriptor AddSearches(Elastic.Clients.Elasticsearch.Core.MSearch.SearchRequestItem searches) + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor MaxConcurrentShardRequests(int? value) + { + Instance.MaxConcurrentShardRequests = value; + return this; + } + + /// + /// + /// Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor PreFilterShardSize(long? value) + { + Instance.PreFilterShardSize = value; + return this; + } + + /// + /// + /// If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) { - _items.Add(searches); + Instance.RestTotalHitsAsInt = value; + return this; + } + + /// + /// + /// Custom routing value used to route search operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Indicates whether global term and document frequencies should be used when scoring returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Searches(System.Collections.Generic.ICollection value) + { + Instance.Searches = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Searches(params Elastic.Clients.Elasticsearch.Core.MSearch.SearchRequestItem[] values) + { + Instance.Searches = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiSearchRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; return this; } } @@ -400,76 +619,261 @@ public MultiSearchRequestDescriptor AddSearches(Elastic.Clients.Elast /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. /// /// -public sealed partial class MultiSearchRequestDescriptor : RequestDescriptor, IStreamSerializable +public readonly partial struct MultiSearchRequestDescriptor { - internal MultiSearchRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiSearchRequest Instance { get; init; } - public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchRequest instance) { + Instance = instance; + } + + public MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MultiSearchRequest(indices); +#pragma warning restore CS0618 } public MultiSearchRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearch; + public static explicit operator Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchRequest instance) => new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Comma-separated list of data streams, indices, and index aliases to search. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "msearch"; + /// + /// + /// If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } + + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If true, concrete, expanded or aliased indices are ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Indicates whether hit.matched_queries should be rendered as a map that includes + /// the name of the matched query associated with its score (true) + /// or as an array containing the name of the matched queries (false) + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor IncludeNamedQueriesScore(bool? value = true) + { + Instance.IncludeNamedQueriesScore = value; + return this; + } - public MultiSearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public MultiSearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public MultiSearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public MultiSearchRequestDescriptor IgnoreThrottled(bool? ignoreThrottled = true) => Qs("ignore_throttled", ignoreThrottled); - public MultiSearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public MultiSearchRequestDescriptor MaxConcurrentSearches(long? maxConcurrentSearches) => Qs("max_concurrent_searches", maxConcurrentSearches); - public MultiSearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public MultiSearchRequestDescriptor PreFilterShardSize(long? preFilterShardSize) => Qs("pre_filter_shard_size", preFilterShardSize); - public MultiSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public MultiSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public MultiSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// Maximum number of concurrent searches the multi search API can execute. + /// Defaults to max(1, (# of data nodes * min(search thread pool size, 10))). + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor MaxConcurrentSearches(int? value) + { + Instance.MaxConcurrentSearches = value; + return this; + } - public MultiSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor MaxConcurrentShardRequests(int? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.MaxConcurrentShardRequests = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor PreFilterShardSize(long? value) { + Instance.PreFilterShardSize = value; + return this; } - List _items = new(); + /// + /// + /// If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + /// + /// + /// Custom routing value used to route search operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } + Instance.Routing = value; + return this; } - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + /// + /// + /// Indicates whether global term and document frequencies should be used when scoring returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } + Instance.SearchType = value; + return this; + } + + /// + /// + /// Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Searches(System.Collections.Generic.ICollection value) + { + Instance.Searches = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Searches(params Elastic.Clients.Elasticsearch.Core.MSearch.SearchRequestItem[] values) + { + Instance.Searches = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiSearchRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; } - public MultiSearchRequestDescriptor AddSearches(Elastic.Clients.Elasticsearch.Core.MSearch.SearchRequestItem searches) + public Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - _items.Add(searches); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchResponse.g.cs index a942a757900..2465fd05245 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchResponse.g.cs @@ -17,19 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiSearchResponse : ElasticsearchResponse +internal sealed partial class MultiSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("responses")] - public IReadOnlyCollection> Responses { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropResponses = System.Text.Json.JsonEncodedText.Encode("responses"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.MultiSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propResponses = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResponses.TryReadProperty(ref reader, options, PropResponses, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Responses = propResponses.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResponses, value.Responses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class MultiSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiSearchResponseConverterFactory))] +public partial class MultiSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyCollection> Responses { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateRequest.g.cs index db526110c63..38b93d0e03d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateRequest.g.cs @@ -17,22 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.IO; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiSearchTemplateRequestParameters : RequestParameters +public sealed partial class MultiSearchTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -71,6 +62,19 @@ public sealed partial class MultiSearchTemplateRequestParameters : RequestParame public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } +internal sealed partial class MultiSearchTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { SearchTemplates = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.SearchTemplates, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + } +} + /// /// /// Run multiple templated searches. @@ -90,30 +94,65 @@ public sealed partial class MultiSearchTemplateRequestParameters : RequestParame /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo /// /// -public sealed partial class MultiSearchTemplateRequest : PlainRequest, IStreamSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestConverter))] +public partial class MultiSearchTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public MultiSearchTemplateRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } - public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices, System.Collections.Generic.ICollection searchTemplates) : base(r => r.Optional("index", indices)) + { + SearchTemplates = searchTemplates; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateRequest(System.Collections.Generic.ICollection searchTemplates) + { + SearchTemplates = searchTemplates; + } +#if NET7_0_OR_GREATER + public MultiSearchTemplateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiSearchTemplateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearchTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceMultiSearchTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "msearch_template"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If true, network round-trips are minimized for cross-cluster search requests. /// /// - [JsonIgnore] public bool? CcsMinimizeRoundtrips { get => Q("ccs_minimize_roundtrips"); set => Q("ccs_minimize_roundtrips", value); } /// @@ -121,7 +160,6 @@ public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices /// The maximum number of concurrent searches the API can run. /// /// - [JsonIgnore] public long? MaxConcurrentSearches { get => Q("max_concurrent_searches"); set => Q("max_concurrent_searches", value); } /// @@ -130,7 +168,6 @@ public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices /// If false, it returns hits.total as an object. /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -138,7 +175,6 @@ public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices /// The type of the search operation. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -146,31 +182,12 @@ public MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices /// If true, the response prefixes aggregation and suggester names with their respective types. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } - public List SearchTemplates { get; set; } - - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) - { - if (SearchTemplates is null) - return; - foreach (var item in SearchTemplates) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } - } - - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) - { - if (SearchTemplates is null) - return; - foreach (var item in SearchTemplates) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } - } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection SearchTemplates { get; set; } } /// @@ -192,69 +209,159 @@ async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClien /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo /// /// -public sealed partial class MultiSearchTemplateRequestDescriptor : RequestDescriptor, MultiSearchTemplateRequestParameters>, IStreamSerializable +public readonly partial struct MultiSearchTemplateRequestDescriptor { - internal MultiSearchTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest instance) + { + Instance = instance; + } - public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(indices); +#pragma warning restore CS0618 } public MultiSearchTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearchTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest instance) => new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If true, network round-trips are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } - internal override string OperationName => "msearch_template"; + /// + /// + /// The maximum number of concurrent searches the API can run. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor MaxConcurrentSearches(long? value) + { + Instance.MaxConcurrentSearches = value; + return this; + } - public MultiSearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public MultiSearchTemplateRequestDescriptor MaxConcurrentSearches(long? maxConcurrentSearches) => Qs("max_concurrent_searches", maxConcurrentSearches); - public MultiSearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public MultiSearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public MultiSearchTemplateRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// If true, the response returns hits.total as an integer. + /// If false, it returns hits.total as an object. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } - public MultiSearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// The type of the search operation. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SearchType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the response prefixes aggregation and suggester names with their respective types. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor TypedKeys(bool? value = true) { + Instance.TypedKeys = value; + return this; } - List _items = new(); + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchTemplates(System.Collections.Generic.ICollection value) + { + Instance.SearchTemplates = value; + return this; + } - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchTemplates(params Elastic.Clients.Elasticsearch.Core.MSearchTemplate.SearchTemplateRequestItem[] values) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } + Instance.SearchTemplates = [.. values]; + return this; } - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest Build(System.Action action) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public MultiSearchTemplateRequestDescriptor AddSearchTemplates(Elastic.Clients.Elasticsearch.Core.MSearchTemplate.SearchTemplateRequestItem searchTemplates) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor ErrorTrace(bool? value) { - _items.Add(searchTemplates); + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; return this; } } @@ -278,69 +385,159 @@ public MultiSearchTemplateRequestDescriptor AddSearchTemplates(Elasti /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo /// /// -public sealed partial class MultiSearchTemplateRequestDescriptor : RequestDescriptor, IStreamSerializable +public readonly partial struct MultiSearchTemplateRequestDescriptor { - internal MultiSearchTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest instance) + { + Instance = instance; + } - public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(indices); +#pragma warning restore CS0618 } public MultiSearchTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMultiSearchTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest instance) => new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use *. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If true, network round-trips are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } - internal override string OperationName => "msearch_template"; + /// + /// + /// The maximum number of concurrent searches the API can run. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor MaxConcurrentSearches(long? value) + { + Instance.MaxConcurrentSearches = value; + return this; + } + + /// + /// + /// If true, the response returns hits.total as an integer. + /// If false, it returns hits.total as an object. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } - public MultiSearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public MultiSearchTemplateRequestDescriptor MaxConcurrentSearches(long? maxConcurrentSearches) => Qs("max_concurrent_searches", maxConcurrentSearches); - public MultiSearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public MultiSearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public MultiSearchTemplateRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// The type of the search operation. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } - public MultiSearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If true, the response prefixes aggregation and suggester names with their respective types. + /// + /// + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor TypedKeys(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.TypedKeys = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchTemplates(System.Collections.Generic.ICollection value) { + Instance.SearchTemplates = value; + return this; } - List _items = new(); + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SearchTemplates(params Elastic.Clients.Elasticsearch.Core.MSearchTemplate.SearchTemplateRequestItem[] values) + { + Instance.SearchTemplates = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor FilterPath(params string[]? value) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - serializable.Serialize(stream, settings, formatting); - } + Instance.FilterPath = value; + return this; } - async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Human(bool? value) { - if (_items is null) - return; - foreach (var item in _items) - { - if (item is IStreamSerializable serializable) - await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); - } + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; } - public MultiSearchTemplateRequestDescriptor AddSearchTemplates(Elastic.Clients.Elasticsearch.Core.MSearchTemplate.SearchTemplateRequestItem searchTemplates) + public Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - _items.Add(searchTemplates); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateResponse.g.cs index 061ee312555..6db3e4c8d14 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiSearchTemplateResponse.g.cs @@ -17,19 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiSearchTemplateResponse : ElasticsearchResponse +internal sealed partial class MultiSearchTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("responses")] - public IReadOnlyCollection> Responses { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropResponses = System.Text.Json.JsonEncodedText.Encode("responses"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propResponses = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResponses.TryReadProperty(ref reader, options, PropResponses, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Responses = propResponses.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResponses, value.Responses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class MultiSearchTemplateResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiSearchTemplateResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiSearchTemplateResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiSearchTemplateResponseConverterFactory))] +public partial class MultiSearchTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiSearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyCollection> Responses { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsRequest.g.cs index 9005e71cdea..002e2d66cc9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiTermVectorsRequestParameters : RequestParameters +public sealed partial class MultiTermVectorsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -112,6 +105,54 @@ public sealed partial class MultiTermVectorsRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } } +internal sealed partial class MultiTermVectorsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + + public override Elastic.Clients.Elasticsearch.MultiTermVectorsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDocs = default; + LocalJsonValue?> propIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value, + Ids = propIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiTermVectorsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIds, value.Ids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Get multiple term vectors. @@ -131,31 +172,49 @@ public sealed partial class MultiTermVectorsRequestParameters : RequestParameter /// The mapping used is determined by the specified _index. /// /// -public sealed partial class MultiTermVectorsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiTermVectorsRequestConverter))] +public sealed partial class MultiTermVectorsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + { + } +#if NET7_0_OR_GREATER public MultiTermVectorsRequest() { } - - public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) +#endif +#if !NET7_0_OR_GREATER + public MultiTermVectorsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMtermvectors; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceMtermvectors; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "mtermvectors"; + /// + /// + /// The name of the index that contains the documents. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Index { get => P("index"); set => PO("index", value); } + /// /// /// A comma-separated list or wildcard expressions of fields to include in the statistics. /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } /// @@ -163,7 +222,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. /// /// - [JsonIgnore] public bool? FieldStatistics { get => Q("field_statistics"); set => Q("field_statistics", value); } /// @@ -171,7 +229,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the response includes term offsets. /// /// - [JsonIgnore] public bool? Offsets { get => Q("offsets"); set => Q("offsets", value); } /// @@ -179,7 +236,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the response includes term payloads. /// /// - [JsonIgnore] public bool? Payloads { get => Q("payloads"); set => Q("payloads", value); } /// @@ -187,7 +243,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the response includes term positions. /// /// - [JsonIgnore] public bool? Positions { get => Q("positions"); set => Q("positions", value); } /// @@ -196,7 +251,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -204,7 +258,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the request is real-time as opposed to near-real-time. /// /// - [JsonIgnore] public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } /// @@ -212,7 +265,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -220,7 +272,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, the response includes term frequency and document frequency. /// /// - [JsonIgnore] public bool? TermStatistics { get => Q("term_statistics"); set => Q("term_statistics", value); } /// @@ -228,7 +279,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// If true, returns the document version as part of a hit. /// /// - [JsonIgnore] public long? Version { get => Q("version"); set => Q("version", value); } /// @@ -236,7 +286,6 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// The version type. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } /// @@ -244,16 +293,14 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// An array of existing or artificial documents. /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection? Docs { get; set; } + public System.Collections.Generic.ICollection? Docs { get; set; } /// /// /// A simplified syntax to specify documents by their ID if they're in the same index. /// /// - [JsonInclude, JsonPropertyName("ids")] - public ICollection? Ids { get; set; } + public System.Collections.Generic.ICollection? Ids { get; set; } } /// @@ -275,143 +322,306 @@ public MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName? index) : /// The mapping used is determined by the specified _index. /// /// -public sealed partial class MultiTermVectorsRequestDescriptor : RequestDescriptor, MultiTermVectorsRequestParameters> +public readonly partial struct MultiTermVectorsRequestDescriptor { - internal MultiTermVectorsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiTermVectorsRequest Instance { get; init; } - public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest instance) { + Instance = instance; } - public MultiTermVectorsRequestDescriptor() : this(typeof(TDocument)) + public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(index); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMtermvectors; + public MultiTermVectorsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest instance) => new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The name of the index that contains the documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "mtermvectors"; + /// + /// + /// A comma-separated list or wildcard expressions of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// A comma-separated list or wildcard expressions of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } - public MultiTermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public MultiTermVectorsRequestDescriptor FieldStatistics(bool? fieldStatistics = true) => Qs("field_statistics", fieldStatistics); - public MultiTermVectorsRequestDescriptor Offsets(bool? offsets = true) => Qs("offsets", offsets); - public MultiTermVectorsRequestDescriptor Payloads(bool? payloads = true) => Qs("payloads", payloads); - public MultiTermVectorsRequestDescriptor Positions(bool? positions = true) => Qs("positions", positions); - public MultiTermVectorsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public MultiTermVectorsRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public MultiTermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiTermVectorsRequestDescriptor TermStatistics(bool? termStatistics = true) => Qs("term_statistics", termStatistics); - public MultiTermVectorsRequestDescriptor Version(long? version) => Qs("version", version); - public MultiTermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor FieldStatistics(bool? value = true) + { + Instance.FieldStatistics = value; + return this; + } - public MultiTermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// If true, the response includes term offsets. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Offsets(bool? value = true) { - RouteValues.Optional("index", index); - return Self; + Instance.Offsets = value; + return this; } - private ICollection? DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor DocsDescriptor { get; set; } - private Action> DocsDescriptorAction { get; set; } - private Action>[] DocsDescriptorActions { get; set; } - private ICollection? IdsValue { get; set; } + /// + /// + /// If true, the response includes term payloads. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Payloads(bool? value = true) + { + Instance.Payloads = value; + return this; + } /// /// - /// An array of existing or artificial documents. + /// If true, the response includes term positions. /// /// - public MultiTermVectorsRequestDescriptor Docs(ICollection? docs) + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Positions(bool? value = true) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Positions = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor descriptor) + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Preference(string? value) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.Preference = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(Action> configure) + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Realtime(bool? value = true) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.Realtime = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(params Action>[] configure) + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Routing = value; + return this; } /// /// - /// A simplified syntax to specify documents by their ID if they're in the same index. + /// If true, the response includes term frequency and document frequency. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor TermStatistics(bool? value = true) + { + Instance.TermStatistics = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. /// /// - public MultiTermVectorsRequestDescriptor Ids(ICollection? ids) + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Version(long? value) { - IdsValue = ids; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) + Instance.VersionType = value; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(System.Collections.Generic.ICollection? value) + { + Instance.Docs = value; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation[] values) + { + Instance.Docs = [.. values]; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(params System.Action?[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor.Build(action)); } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (DocsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor.Build(action)); } - if (IdsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// A simplified syntax to specify documents by their ID if they're in the same index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Ids(System.Collections.Generic.ICollection? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// A simplified syntax to specify documents by their ID if they're in the same index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) + { + Instance.Ids = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiTermVectorsRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); + return new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -434,142 +644,288 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The mapping used is determined by the specified _index. /// /// -public sealed partial class MultiTermVectorsRequestDescriptor : RequestDescriptor +public readonly partial struct MultiTermVectorsRequestDescriptor { - internal MultiTermVectorsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MultiTermVectorsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest instance) + { + Instance = instance; + } - public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + public MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { + Instance = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(index); } public MultiTermVectorsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(typeof(TDocument)); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceMtermvectors; + public static explicit operator Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest instance) => new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The name of the index that contains the documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// A comma-separated list or wildcard expressions of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } - internal override string OperationName => "mtermvectors"; + /// + /// + /// A comma-separated list or wildcard expressions of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } - public MultiTermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public MultiTermVectorsRequestDescriptor FieldStatistics(bool? fieldStatistics = true) => Qs("field_statistics", fieldStatistics); - public MultiTermVectorsRequestDescriptor Offsets(bool? offsets = true) => Qs("offsets", offsets); - public MultiTermVectorsRequestDescriptor Payloads(bool? payloads = true) => Qs("payloads", payloads); - public MultiTermVectorsRequestDescriptor Positions(bool? positions = true) => Qs("positions", positions); - public MultiTermVectorsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public MultiTermVectorsRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public MultiTermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public MultiTermVectorsRequestDescriptor TermStatistics(bool? termStatistics = true) => Qs("term_statistics", termStatistics); - public MultiTermVectorsRequestDescriptor Version(long? version) => Qs("version", version); - public MultiTermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor FieldStatistics(bool? value = true) + { + Instance.FieldStatistics = value; + return this; + } - public MultiTermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// If true, the response includes term offsets. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Offsets(bool? value = true) { - RouteValues.Optional("index", index); - return Self; + Instance.Offsets = value; + return this; } - private ICollection? DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private ICollection? IdsValue { get; set; } + /// + /// + /// If true, the response includes term payloads. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Payloads(bool? value = true) + { + Instance.Payloads = value; + return this; + } /// /// - /// An array of existing or artificial documents. + /// If true, the response includes term positions. /// /// - public MultiTermVectorsRequestDescriptor Docs(ICollection? docs) + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Positions(bool? value = true) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Positions = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor descriptor) + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Preference(string? value) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.Preference = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(Action configure) + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Realtime(bool? value = true) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.Realtime = value; + return this; } - public MultiTermVectorsRequestDescriptor Docs(params Action[] configure) + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Routing = value; + return this; } /// /// - /// A simplified syntax to specify documents by their ID if they're in the same index. + /// If true, the response includes term frequency and document frequency. /// /// - public MultiTermVectorsRequestDescriptor Ids(ICollection? ids) + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor TermStatistics(bool? value = true) { - IdsValue = ids; - return Self; + Instance.TermStatistics = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Version(long? value) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(action), options); - } + Instance.Version = value; + return this; + } - writer.WriteEndArray(); - } - else if (DocsValue is not null) + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(System.Collections.Generic.ICollection? value) + { + Instance.Docs = value; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation[] values) + { + Instance.Docs = [.. values]; + return this; + } + + /// + /// + /// An array of existing or artificial documents. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Docs(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor.Build(action)); } - if (IdsValue is not null) + Instance.Docs = items; + return this; + } + + /// + /// + /// A simplified syntax to specify documents by their ID if they're in the same index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Ids(System.Collections.Generic.ICollection? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// A simplified syntax to specify documents by their ID if they're in the same index. + /// + /// + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) + { + Instance.Ids = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MultiTermVectorsRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); + return new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(new Elastic.Clients.Elasticsearch.MultiTermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsResponse.g.cs index 36c309f3cab..c3a93faa391 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MultiTermVectorsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class MultiTermVectorsResponse : ElasticsearchResponse +internal sealed partial class MultiTermVectorsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("docs")] - public IReadOnlyCollection Docs { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + + public override Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MultiTermVectorsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MultiTermVectorsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MultiTermVectorsResponseConverter))] +public sealed partial class MultiTermVectorsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermVectorsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Docs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveRequest.g.cs index bd81ff113e0..36ba82da25d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveRequest.g.cs @@ -17,42 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class ClearRepositoriesMeteringArchiveRequestParameters : RequestParameters +public sealed partial class ClearRepositoriesMeteringArchiveRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ClearRepositoriesMeteringArchiveRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Clear the archived repositories metering. /// Clear the archived repositories metering information in the cluster. /// /// -public sealed partial class ClearRepositoriesMeteringArchiveRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestConverter))] +public sealed partial class ClearRepositoriesMeteringArchiveRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion) : base(r => r.Required("node_id", nodeId).Required("max_archive_version", maxArchiveVersion)) { } +#if NET7_0_OR_GREATER + public ClearRepositoriesMeteringArchiveRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesClearRepositoriesMeteringArchive; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesClearRepositoriesMeteringArchive; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "nodes.clear_repositories_metering_archive"; + + /// + /// + /// Specifies the maximum archive_version to be cleared from the archive. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long MaxArchiveVersion { get => P("max_archive_version"); set => PR("max_archive_version", value); } + + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeIds NodeId { get => P("node_id"); set => PR("node_id", value); } } /// @@ -61,35 +117,99 @@ public ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.Nod /// Clear the archived repositories metering information in the cluster. /// /// -public sealed partial class ClearRepositoriesMeteringArchiveRequestDescriptor : RequestDescriptor +public readonly partial struct ClearRepositoriesMeteringArchiveRequestDescriptor { - internal ClearRepositoriesMeteringArchiveRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest Instance { get; init; } - public ClearRepositoriesMeteringArchiveRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion) : base(r => r.Required("node_id", nodeId).Required("max_archive_version", maxArchiveVersion)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearRepositoriesMeteringArchiveRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesClearRepositoriesMeteringArchive; + public ClearRepositoriesMeteringArchiveRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest(nodeId, maxArchiveVersion); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearRepositoriesMeteringArchiveRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "nodes.clear_repositories_metering_archive"; + /// + /// + /// Specifies the maximum archive_version to be cleared from the archive. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor MaxArchiveVersion(long value) + { + Instance.MaxArchiveVersion = value; + return this; + } + + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds value) + { + Instance.NodeId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public ClearRepositoriesMeteringArchiveRequestDescriptor MaxArchiveVersion(long maxArchiveVersion) + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("max_archive_version", maxArchiveVersion); - return Self; + Instance.SourceQueryString = value; + return this; } - public ClearRepositoriesMeteringArchiveRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds nodeId) + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveResponse.g.cs index 7e786c95929..0a86abac97b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ClearRepositoriesMeteringArchiveResponse.g.cs @@ -17,38 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class ClearRepositoriesMeteringArchiveResponse : ElasticsearchResponse +internal sealed partial class ClearRepositoriesMeteringArchiveResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponseConverter))] +public sealed partial class ClearRepositoriesMeteringArchiveResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearRepositoriesMeteringArchiveResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearRepositoriesMeteringArchiveResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the cluster. Based on the cluster.name setting. /// /// - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } /// /// /// Contains repositories metering information for the nodes selected by the request. /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoRequest.g.cs index 58ce8fee68b..4aee0864f67 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class GetRepositoriesMeteringInfoRequestParameters : RequestParameters +public sealed partial class GetRepositoriesMeteringInfoRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRepositoriesMeteringInfoRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get cluster repositories metering. @@ -42,19 +64,43 @@ public sealed partial class GetRepositoriesMeteringInfoRequestParameters : Reque /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. /// /// -public sealed partial class GetRepositoriesMeteringInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestConverter))] +public sealed partial class GetRepositoriesMeteringInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.NodeIds nodeId) : base(r => r.Required("node_id", nodeId)) { } +#if NET7_0_OR_GREATER + public GetRepositoriesMeteringInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesGetRepositoriesMeteringInfo; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesGetRepositoriesMeteringInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "nodes.get_repositories_metering_info"; + + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// All the nodes selective options are explained here. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeIds NodeId { get => P("node_id"); set => PR("node_id", value); } } /// @@ -65,29 +111,89 @@ public GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.NodeIds /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. /// /// -public sealed partial class GetRepositoriesMeteringInfoRequestDescriptor : RequestDescriptor +public readonly partial struct GetRepositoriesMeteringInfoRequestDescriptor { - internal GetRepositoriesMeteringInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest Instance { get; init; } - public GetRepositoriesMeteringInfoRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds nodeId) : base(r => r.Required("node_id", nodeId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRepositoriesMeteringInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesGetRepositoriesMeteringInfo; + public GetRepositoriesMeteringInfoRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest(nodeId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRepositoriesMeteringInfoRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "nodes.get_repositories_metering_info"; + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// All the nodes selective options are explained here. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds value) + { + Instance.NodeId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRepositoriesMeteringInfoRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds nodeId) + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoResponse.g.cs index cc5ce41da4b..670f4de7a4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/GetRepositoriesMeteringInfoResponse.g.cs @@ -17,38 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class GetRepositoriesMeteringInfoResponse : ElasticsearchResponse +internal sealed partial class GetRepositoriesMeteringInfoResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponseConverter))] +public sealed partial class GetRepositoriesMeteringInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRepositoriesMeteringInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRepositoriesMeteringInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the cluster. Based on the cluster.name setting. /// /// - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } /// /// /// Contains repositories metering information for the nodes selected by the request. /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsRequest.g.cs index 0f6987065fc..3911f34705a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class HotThreadsRequestParameters : RequestParameters +public sealed partial class HotThreadsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,15 +40,6 @@ public sealed partial class HotThreadsRequestParameters : RequestParameters /// public Elastic.Clients.Elasticsearch.Duration? Interval { get => Q("interval"); set => Q("interval", value); } - /// - /// - /// Period to wait for a connection to the master node. If no response - /// is received before the timeout expires, the request fails and - /// returns an error. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// Number of samples of thread stacktrace. @@ -93,6 +77,35 @@ public sealed partial class HotThreadsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.ThreadType? Type { get => Q("type"); set => Q("type", value); } } +internal sealed partial class HotThreadsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the hot threads for nodes. @@ -100,19 +113,31 @@ public sealed partial class HotThreadsRequestParameters : RequestParameters /// The output is plain text with a breakdown of the top hot threads for each node. /// /// -public sealed partial class HotThreadsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestConverter))] +public sealed partial class HotThreadsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + { + } +#if NET7_0_OR_GREATER public HotThreadsRequest() { } - - public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) +#endif +#if !NET7_0_OR_GREATER + public HotThreadsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HotThreadsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesHotThreads; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesHotThreads; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -120,37 +145,31 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// /// - /// If true, known idle threads (e.g. waiting in a socket select, or to get - /// a task from an empty queue) are filtered out. + /// List of node IDs or names used to limit returned information. /// /// - [JsonIgnore] - public bool? IgnoreIdleThreads { get => Q("ignore_idle_threads"); set => Q("ignore_idle_threads", value); } + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } /// /// - /// The interval to do the second sampling of threads. + /// If true, known idle threads (e.g. waiting in a socket select, or to get + /// a task from an empty queue) are filtered out. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? Interval { get => Q("interval"); set => Q("interval", value); } + public bool? IgnoreIdleThreads { get => Q("ignore_idle_threads"); set => Q("ignore_idle_threads", value); } /// /// - /// Period to wait for a connection to the master node. If no response - /// is received before the timeout expires, the request fails and - /// returns an error. + /// The interval to do the second sampling of threads. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + public Elastic.Clients.Elasticsearch.Duration? Interval { get => Q("interval"); set => Q("interval", value); } /// /// /// Number of samples of thread stacktrace. /// /// - [JsonIgnore] public long? Snapshots { get => Q("snapshots"); set => Q("snapshots", value); } /// @@ -158,7 +177,6 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// The sort order for 'cpu' type (default: total) /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.ThreadType? Sort { get => Q("sort"); set => Q("sort", value); } /// @@ -166,7 +184,6 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// Specifies the number of hot threads to provide information for. /// /// - [JsonIgnore] public long? Threads { get => Q("threads"); set => Q("threads", value); } /// @@ -175,7 +192,6 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -183,7 +199,6 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// The type to sample. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.ThreadType? Type { get => Q("type"); set => Q("type", value); } } @@ -194,42 +209,171 @@ public HotThreadsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// The output is plain text with a breakdown of the top hot threads for each node. /// /// -public sealed partial class HotThreadsRequestDescriptor : RequestDescriptor +public readonly partial struct HotThreadsRequestDescriptor { - internal HotThreadsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HotThreadsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest instance) + { + Instance = instance; + } - public HotThreadsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + public HotThreadsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(nodeId); } public HotThreadsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesHotThreads; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// List of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If true, known idle threads (e.g. waiting in a socket select, or to get + /// a task from an empty queue) are filtered out. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor IgnoreIdleThreads(bool? value = true) + { + Instance.IgnoreIdleThreads = value; + return this; + } - internal override string OperationName => "nodes.hot_threads"; + /// + /// + /// The interval to do the second sampling of threads. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Interval = value; + return this; + } - public HotThreadsRequestDescriptor IgnoreIdleThreads(bool? ignoreIdleThreads = true) => Qs("ignore_idle_threads", ignoreIdleThreads); - public HotThreadsRequestDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? interval) => Qs("interval", interval); - public HotThreadsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public HotThreadsRequestDescriptor Snapshots(long? snapshots) => Qs("snapshots", snapshots); - public HotThreadsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.ThreadType? sort) => Qs("sort", sort); - public HotThreadsRequestDescriptor Threads(long? threads) => Qs("threads", threads); - public HotThreadsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public HotThreadsRequestDescriptor Type(Elastic.Clients.Elasticsearch.ThreadType? type) => Qs("type", type); + /// + /// + /// Number of samples of thread stacktrace. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Snapshots(long? value) + { + Instance.Snapshots = value; + return this; + } + + /// + /// + /// The sort order for 'cpu' type (default: total) + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Sort(Elastic.Clients.Elasticsearch.ThreadType? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Specifies the number of hot threads to provide information for. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Threads(long? value) + { + Instance.Threads = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received + /// before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The type to sample. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Type(Elastic.Clients.Elasticsearch.ThreadType? value) + { + Instance.Type = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public HotThreadsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsResponse.g.cs index f1677d7d5c5..ed9f4e9bc45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/HotThreadsResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class HotThreadsResponse : ElasticsearchResponse +internal sealed partial class HotThreadsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponseConverter))] +public sealed partial class HotThreadsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HotThreadsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HotThreadsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoRequest.g.cs index 104b1f5333f..e24f0db94a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesInfoRequestParameters : RequestParameters +public sealed partial class NodesInfoRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,13 +32,6 @@ public sealed partial class NodesInfoRequestParameters : RequestParameters /// public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } - /// - /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. @@ -54,18 +40,46 @@ public sealed partial class NodesInfoRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class NodesInfoRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get node information. +/// +/// /// By default, the API returns all attributes and core settings for cluster nodes. /// /// -public sealed partial class NodesInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestConverter))] +public sealed partial class NodesInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public NodesInfoRequest() - { - } - public NodesInfoRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) { } @@ -77,10 +91,25 @@ public NodesInfoRequest(Elastic.Clients.Elasticsearch.Metrics? metric) : base(r public NodesInfoRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) { } +#if NET7_0_OR_GREATER + public NodesInfoRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodesInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesInfo; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -88,72 +117,170 @@ public NodesInfoRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.C /// /// - /// If true, returns settings in flat format. + /// Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. /// /// - [JsonIgnore] - public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } + public Elastic.Clients.Elasticsearch.Metrics? Metric { get => P("metric"); set => PO("metric", value); } + + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } /// /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// If true, returns settings in flat format. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } /// /// /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Get node information. +/// +/// /// By default, the API returns all attributes and core settings for cluster nodes. /// /// -public sealed partial class NodesInfoRequestDescriptor : RequestDescriptor +public readonly partial struct NodesInfoRequestDescriptor { - internal NodesInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest instance) + { + Instance = instance; + } + + public NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(nodeId); + } - public NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) + public NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(metric); + } + + public NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(nodeId, metric); } public NodesInfoRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesInfo; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } - internal override string OperationName => "nodes.info"; + /// + /// + /// If true, returns settings in flat format. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } - public NodesInfoRequestDescriptor FlatSettings(bool? flatSettings = true) => Qs("flat_settings", flatSettings); - public NodesInfoRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public NodesInfoRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public NodesInfoRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.SourceQueryString = value; + return this; } - public NodesInfoRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoResponse.g.cs index 5ca252fad2f..18041011571 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesInfoResponse.g.cs @@ -17,27 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesInfoResponse : ElasticsearchResponse +internal sealed partial class NodesInfoResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponseConverter))] +public sealed partial class NodesInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsRequest.g.cs index 47a0483057f..09e4c28d374 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesStatsRequestParameters : RequestParameters +public sealed partial class NodesStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -81,13 +74,6 @@ public sealed partial class NodesStatsRequestParameters : RequestParameters /// public Elastic.Clients.Elasticsearch.Level? Level { get => Q("level"); set => Q("level", value); } - /// - /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. @@ -100,7 +86,36 @@ public sealed partial class NodesStatsRequestParameters : RequestParameters /// A comma-separated list of document types for the indexing index metric. /// /// - public ICollection? Types { get => Q?>("types"); set => Q("types", value); } + public System.Collections.Generic.ICollection? Types { get => Q?>("types"); set => Q("types", value); } +} + +internal sealed partial class NodesStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -110,12 +125,9 @@ public sealed partial class NodesStatsRequestParameters : RequestParameters /// By default, all stats are returned. You can limit the returned information by using metrics. /// /// -public sealed partial class NodesStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestConverter))] +public sealed partial class NodesStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public NodesStatsRequest() - { - } - public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) { } @@ -135,21 +147,56 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic. public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric).Optional("index_metric", indexMetric)) { } +#if NET7_0_OR_GREATER + public NodesStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodesStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "nodes.stats"; + /// + /// + /// Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Metrics? IndexMetric { get => P("index_metric"); set => PO("index_metric", value); } + + /// + /// + /// Limit the information returned to the specified metrics + /// + /// + public Elastic.Clients.Elasticsearch.Metrics? Metric { get => P("metric"); set => PO("metric", value); } + + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } + /// /// /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? CompletionFields { get => Q("completion_fields"); set => Q("completion_fields", value); } /// @@ -157,7 +204,6 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? FielddataFields { get => Q("fielddata_fields"); set => Q("fielddata_fields", value); } /// @@ -165,7 +211,6 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// Comma-separated list or wildcard expressions of fields to include in the statistics. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } /// @@ -173,7 +218,6 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// Comma-separated list of search groups to include in the search statistics. /// /// - [JsonIgnore] public bool? Groups { get => Q("groups"); set => Q("groups", value); } /// @@ -181,7 +225,6 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). /// /// - [JsonIgnore] public bool? IncludeSegmentFileSizes { get => Q("include_segment_file_sizes"); set => Q("include_segment_file_sizes", value); } /// @@ -189,7 +232,6 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// If true, the response includes information from segments that are not loaded into memory. /// /// - [JsonIgnore] public bool? IncludeUnloadedSegments { get => Q("include_unloaded_segments"); set => Q("include_unloaded_segments", value); } /// @@ -197,23 +239,13 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// Indicates whether statistics are aggregated at the cluster, index, or shard level. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Level? Level { get => Q("level"); set => Q("level", value); } - /// - /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -221,8 +253,7 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// A comma-separated list of document types for the indexing index metric. /// /// - [JsonIgnore] - public ICollection? Types { get => Q?>("types"); set => Q("types", value); } + public System.Collections.Generic.ICollection? Types { get => Q?>("types"); set => Q("types", value); } } /// @@ -232,57 +263,278 @@ public NodesStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// By default, all stats are returned. You can limit the returned information by using metrics. /// /// -public sealed partial class NodesStatsRequestDescriptor : RequestDescriptor, NodesStatsRequestParameters> +public readonly partial struct NodesStatsRequestDescriptor { - internal NodesStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest instance) + { + Instance = instance; + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(metric); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId, metric); + } - public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric).Optional("index_metric", indexMetric)) + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(metric, indexMetric); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId, metric, indexMetric); } public NodesStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesStats; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IndexMetric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.IndexMetric = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Limit the information returned to the specified metrics + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - internal override string OperationName => "nodes.stats"; + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CompletionFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor CompletionFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.CompletionFields = value; + return this; + } - public NodesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? completionFields) => Qs("completion_fields", completionFields); - public NodesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? fielddataFields) => Qs("fielddata_fields", fielddataFields); - public NodesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public NodesStatsRequestDescriptor Groups(bool? groups = true) => Qs("groups", groups); - public NodesStatsRequestDescriptor IncludeSegmentFileSizes(bool? includeSegmentFileSizes = true) => Qs("include_segment_file_sizes", includeSegmentFileSizes); - public NodesStatsRequestDescriptor IncludeUnloadedSegments(bool? includeUnloadedSegments = true) => Qs("include_unloaded_segments", includeUnloadedSegments); - public NodesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); - public NodesStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public NodesStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public NodesStatsRequestDescriptor Types(ICollection? types) => Qs("types", types); + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.FielddataFields = value; + return this; + } - public NodesStatsRequestDescriptor IndexMetric(Elastic.Clients.Elasticsearch.Metrics? indexMetric) + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FielddataFields(params System.Linq.Expressions.Expression>[] value) { - RouteValues.Optional("index_metric", indexMetric); - return Self; + Instance.FielddataFields = value; + return this; } - public NodesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.Fields = value; + return this; } - public NodesStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.Fields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Groups(bool? value = true) { + Instance.Groups = value; + return this; + } + + /// + /// + /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IncludeSegmentFileSizes(bool? value = true) + { + Instance.IncludeSegmentFileSizes = value; + return this; + } + + /// + /// + /// If true, the response includes information from segments that are not loaded into memory. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IncludeUnloadedSegments(bool? value = true) + { + Instance.IncludeUnloadedSegments = value; + return this; + } + + /// + /// + /// Indicates whether statistics are aggregated at the cluster, index, or shard level. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// A comma-separated list of document types for the indexing index metric. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Types(System.Collections.Generic.ICollection? value) + { + Instance.Types = value; + return this; + } + + /// + /// + /// A comma-separated list of document types for the indexing index metric. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Types(params string[] values) + { + Instance.Types = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -293,56 +545,277 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// By default, all stats are returned. You can limit the returned information by using metrics. /// /// -public sealed partial class NodesStatsRequestDescriptor : RequestDescriptor +public readonly partial struct NodesStatsRequestDescriptor { - internal NodesStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest instance) + { + Instance = instance; + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(metric); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId, metric); + } + + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(metric, indexMetric); + } - public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric).Optional("index_metric", indexMetric)) + public NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(nodeId, metric, indexMetric); } public NodesStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesStats; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IndexMetric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.IndexMetric = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Limit the information returned to the specified metrics + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - internal override string OperationName => "nodes.stats"; + /// + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CompletionFields = value; + return this; + } - public NodesStatsRequestDescriptor CompletionFields(Elastic.Clients.Elasticsearch.Fields? completionFields) => Qs("completion_fields", completionFields); - public NodesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? fielddataFields) => Qs("fielddata_fields", fielddataFields); - public NodesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public NodesStatsRequestDescriptor Groups(bool? groups = true) => Qs("groups", groups); - public NodesStatsRequestDescriptor IncludeSegmentFileSizes(bool? includeSegmentFileSizes = true) => Qs("include_segment_file_sizes", includeSegmentFileSizes); - public NodesStatsRequestDescriptor IncludeUnloadedSegments(bool? includeUnloadedSegments = true) => Qs("include_unloaded_segments", includeUnloadedSegments); - public NodesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? level) => Qs("level", level); - public NodesStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public NodesStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public NodesStatsRequestDescriptor Types(ICollection? types) => Qs("types", types); + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor CompletionFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.CompletionFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FielddataFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in fielddata statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FielddataFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.FielddataFields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list of search groups to include in the search statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Groups(bool? value = true) + { + Instance.Groups = value; + return this; + } + + /// + /// + /// If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IncludeSegmentFileSizes(bool? value = true) + { + Instance.IncludeSegmentFileSizes = value; + return this; + } + + /// + /// + /// If true, the response includes information from segments that are not loaded into memory. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor IncludeUnloadedSegments(bool? value = true) + { + Instance.IncludeUnloadedSegments = value; + return this; + } + + /// + /// + /// Indicates whether statistics are aggregated at the cluster, index, or shard level. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.Level? value) + { + Instance.Level = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// A comma-separated list of document types for the indexing index metric. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Types(System.Collections.Generic.ICollection? value) + { + Instance.Types = value; + return this; + } + + /// + /// + /// A comma-separated list of document types for the indexing index metric. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Types(params string[] values) + { + Instance.Types = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public NodesStatsRequestDescriptor IndexMetric(Elastic.Clients.Elasticsearch.Metrics? indexMetric) + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor Pretty(bool? value) { - RouteValues.Optional("index_metric", indexMetric); - return Self; + Instance.Pretty = value; + return this; } - public NodesStatsRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.SourceQueryString = value; + return this; } - public NodesStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsResponse.g.cs index cb917ccc1c0..54f4f4fb051 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesStatsResponse.g.cs @@ -17,27 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesStatsResponse : ElasticsearchResponse +internal sealed partial class NodesStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string? ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponseConverter))] +public sealed partial class NodesStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageRequest.g.cs index 28adaf7a654..f73b514d323 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesUsageRequestParameters : RequestParameters +public sealed partial class NodesUsageRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,17 +34,43 @@ public sealed partial class NodesUsageRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class NodesUsageRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get feature usage information. /// /// -public sealed partial class NodesUsageRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestConverter))] +public sealed partial class NodesUsageRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public NodesUsageRequest() - { - } - public NodesUsageRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) { } @@ -63,22 +82,51 @@ public NodesUsageRequest(Elastic.Clients.Elasticsearch.Metrics? metric) : base(r public NodesUsageRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) { } +#if NET7_0_OR_GREATER + public NodesUsageRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodesUsageRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesUsage; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesUsage; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "nodes.usage"; + /// + /// + /// Limits the information returned to the specific metrics. + /// A comma-separated list of the following options: _all, rest_actions. + /// + /// + public Elastic.Clients.Elasticsearch.Metrics? Metric { get => P("metric"); set => PO("metric", value); } + + /// + /// + /// A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you're connecting to, leave empty to get information from all nodes + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } + /// /// /// Period to wait for a response. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -87,41 +135,126 @@ public NodesUsageRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic. /// Get feature usage information. /// /// -public sealed partial class NodesUsageRequestDescriptor : RequestDescriptor +public readonly partial struct NodesUsageRequestDescriptor { - internal NodesUsageRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest instance) + { + Instance = instance; + } + + public NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(nodeId); + } - public NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) : base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) + public NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Metrics? metric) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(metric); + } + + public NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(nodeId, metric); } public NodesUsageRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesUsage; + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Limits the information returned to the specific metrics. + /// A comma-separated list of the following options: _all, rest_actions. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? value) + { + Instance.Metric = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you're connecting to, leave empty to get information from all nodes + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } - internal override string OperationName => "nodes.usage"; + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public NodesUsageRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public NodesUsageRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Metrics? metric) + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("metric", metric); - return Self; + Instance.SourceQueryString = value; + return this; } - public NodesUsageRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageResponse.g.cs index daaa410f471..d42c26ec25a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/NodesUsageResponse.g.cs @@ -17,27 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class NodesUsageResponse : ElasticsearchResponse +internal sealed partial class NodesUsageResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponseConverter))] +public sealed partial class NodesUsageResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesUsageResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsRequest.g.cs index 5e944e764a9..4bdbbc53ca0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class ReloadSecureSettingsRequestParameters : RequestParameters +public sealed partial class ReloadSecureSettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,45 @@ public sealed partial class ReloadSecureSettingsRequestParameters : RequestParam public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ReloadSecureSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSecureSettingsPassword = System.Text.Json.JsonEncodedText.Encode("secure_settings_password"); + + public override Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSecureSettingsPassword = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSecureSettingsPassword.TryReadProperty(ref reader, options, PropSecureSettingsPassword, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SecureSettingsPassword = propSecureSettingsPassword.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSecureSettingsPassword, value.SecureSettingsPassword, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Reload the keystore on nodes in the cluster. @@ -56,31 +88,49 @@ public sealed partial class ReloadSecureSettingsRequestParameters : RequestParam /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. /// /// -public sealed partial class ReloadSecureSettingsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestConverter))] +public sealed partial class ReloadSecureSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + { + } +#if NET7_0_OR_GREATER public ReloadSecureSettingsRequest() { } - - public ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) +#endif +#if !NET7_0_OR_GREATER + public ReloadSecureSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesReloadSecureSettings; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NodesReloadSecureSettings; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "nodes.reload_secure_settings"; + /// + /// + /// The names of particular nodes in the cluster to target. + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } + /// /// /// Period to wait for a response. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -88,7 +138,6 @@ public ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId /// The password for the Elasticsearch keystore. /// /// - [JsonInclude, JsonPropertyName("secure_settings_password")] public string? SecureSettingsPassword { get; set; } } @@ -107,56 +156,115 @@ public ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. /// /// -public sealed partial class ReloadSecureSettingsRequestDescriptor : RequestDescriptor +public readonly partial struct ReloadSecureSettingsRequestDescriptor { - internal ReloadSecureSettingsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest Instance { get; init; } - public ReloadSecureSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadSecureSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest instance) { + Instance = instance; } - public ReloadSecureSettingsRequestDescriptor() + public ReloadSecureSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + Instance = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(nodeId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NodesReloadSecureSettings; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "nodes.reload_secure_settings"; + public ReloadSecureSettingsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ReloadSecureSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest instance) => new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor descriptor) => descriptor.Instance; - public ReloadSecureSettingsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + /// + /// + /// The names of particular nodes in the cluster to target. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.NodeId = value; + return this; } - private string? SecureSettingsPasswordValue { get; set; } + /// + /// + /// Period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// The password for the Elasticsearch keystore. /// /// - public ReloadSecureSettingsRequestDescriptor SecureSettingsPassword(string? secureSettingsPassword) + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor SecureSettingsPassword(string? value) { - SecureSettingsPasswordValue = secureSettingsPassword; - return Self; + Instance.SecureSettingsPassword = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(SecureSettingsPasswordValue)) + if (action is null) { - writer.WritePropertyName("secure_settings_password"); - writer.WriteStringValue(SecureSettingsPasswordValue); + return new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsResponse.g.cs index 0ad2ae88554..668c8184d76 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Nodes/ReloadSecureSettingsResponse.g.cs @@ -17,27 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public sealed partial class ReloadSecureSettingsResponse : ElasticsearchResponse +internal sealed partial class ReloadSecureSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponseConverter))] +public sealed partial class ReloadSecureSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadSecureSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadSecureSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } /// /// /// Contains statistics about the number of nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; init; } + public Elastic.Clients.Elasticsearch.NodeStatistics? NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeRequest.g.cs index 8a6b6acbb11..6b1d503ad5d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class OpenPointInTimeRequestParameters : RequestParameters +public sealed partial class OpenPointInTimeRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,7 +41,7 @@ public sealed partial class OpenPointInTimeRequestParameters : RequestParameters /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -62,7 +55,14 @@ public sealed partial class OpenPointInTimeRequestParameters : RequestParameters /// Extend the length of time that the point in time persists. /// /// - public Elastic.Clients.Elasticsearch.Duration KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } + public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } + + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// @@ -80,6 +80,45 @@ public sealed partial class OpenPointInTimeRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } } +internal sealed partial class OpenPointInTimeRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexFilter = System.Text.Json.JsonEncodedText.Encode("index_filter"); + + public override Elastic.Clients.Elasticsearch.OpenPointInTimeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexFilter = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexFilter.TryReadProperty(ref reader, options, PropIndexFilter, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexFilter = propIndexFilter.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.OpenPointInTimeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexFilter, value.IndexFilter, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Open a point in time. @@ -132,20 +171,43 @@ public sealed partial class OpenPointInTimeRequestParameters : RequestParameters /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. /// /// -public sealed partial class OpenPointInTimeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.OpenPointInTimeRequestConverter))] +public sealed partial class OpenPointInTimeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public OpenPointInTimeRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceOpenPointInTime; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceOpenPointInTime; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "open_point_in_time"; + /// + /// + /// A comma-separated list of index names to open point in time; use _all or empty string to perform the operation on all indices + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. @@ -153,7 +215,6 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// If true, the point in time will contain all the shards that are available at the time of the request. /// /// - [JsonIgnore] public bool? AllowPartialSearchResults { get => Q("allow_partial_search_results"); set => Q("allow_partial_search_results", value); } /// @@ -163,15 +224,13 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -179,8 +238,14 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// Extend the length of time that the point in time persists. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } + public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } + + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// @@ -188,7 +253,6 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// By default, it is random. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -196,7 +260,6 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -204,7 +267,6 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// Filter indices if the provided query rewrites to match_none on every shard. /// /// - [JsonInclude, JsonPropertyName("index_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilter { get; set; } } @@ -260,92 +322,217 @@ public OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Indices indices) : b /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. /// /// -public sealed partial class OpenPointInTimeRequestDescriptor : RequestDescriptor, OpenPointInTimeRequestParameters> +public readonly partial struct OpenPointInTimeRequestDescriptor { - internal OpenPointInTimeRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.OpenPointInTimeRequest Instance { get; init; } - public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest instance) { + Instance = instance; } - public OpenPointInTimeRequestDescriptor() : this(typeof(TDocument)) + public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceOpenPointInTime; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public OpenPointInTimeRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest instance) => new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// A comma-separated list of index names to open point in time; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "open_point_in_time"; + /// + /// + /// Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. + /// If false, creating a point in time request when a shard is missing or unavailable will throw an exception. + /// If true, the point in time will contain all the shards that are available at the time of the request. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor AllowPartialSearchResults(bool? value = true) + { + Instance.AllowPartialSearchResults = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Extend the length of time that the point in time persists. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.KeepAlive = value; + return this; + } - public OpenPointInTimeRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public OpenPointInTimeRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public OpenPointInTimeRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public OpenPointInTimeRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration keepAlive) => Qs("keep_alive", keepAlive); - public OpenPointInTimeRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public OpenPointInTimeRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor MaxConcurrentShardRequests(int? value) + { + Instance.MaxConcurrentShardRequests = value; + return this; + } - public OpenPointInTimeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// The node or shard the operation should be performed on. + /// By default, it is random. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Preference(string? value) { - RouteValues.Required("index", indices); - return Self; + Instance.Preference = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action> IndexFilterDescriptorAction { get; set; } + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } /// /// /// Filter indices if the provided query rewrites to match_none on every shard. /// /// - public OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; + Instance.IndexFilter = value; + return this; } - public OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IndexFilter(System.Action action) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public OpenPointInTimeRequestDescriptor IndexFilter(Action> configure) + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.OpenPointInTimeRequest Build(System.Action action) { - writer.WriteStartObject(); - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -401,87 +588,204 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. /// /// -public sealed partial class OpenPointInTimeRequestDescriptor : RequestDescriptor +public readonly partial struct OpenPointInTimeRequestDescriptor { - internal OpenPointInTimeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.OpenPointInTimeRequest Instance { get; init; } - public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceOpenPointInTime; + public OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public OpenPointInTimeRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(typeof(TDocument)); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest instance) => new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "open_point_in_time"; + /// + /// + /// A comma-separated list of index names to open point in time; use _all or empty string to perform the operation on all indices + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public OpenPointInTimeRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public OpenPointInTimeRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public OpenPointInTimeRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public OpenPointInTimeRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration keepAlive) => Qs("keep_alive", keepAlive); - public OpenPointInTimeRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public OpenPointInTimeRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); + /// + /// + /// Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT. + /// If false, creating a point in time request when a shard is missing or unavailable will throw an exception. + /// If true, the point in time will contain all the shards that are available at the time of the request. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor AllowPartialSearchResults(bool? value = true) + { + Instance.AllowPartialSearchResults = value; + return this; + } - public OpenPointInTimeRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - RouteValues.Required("index", indices); - return Self; + Instance.ExpandWildcards = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action IndexFilterDescriptorAction { get; set; } + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// Extend the length of time that the point in time persists. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.KeepAlive = value; + return this; + } + + /// + /// + /// Maximum number of concurrent shard requests that each sub-search request executes per node. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor MaxConcurrentShardRequests(int? value) + { + Instance.MaxConcurrentShardRequests = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// By default, it is random. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } /// /// /// Filter indices if the provided query rewrites to match_none on every shard. /// /// - public OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; + Instance.IndexFilter = value; + return this; } - public OpenPointInTimeRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter indices if the provided query rewrites to match_none on every shard. + /// + /// + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public OpenPointInTimeRequestDescriptor IndexFilter(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.OpenPointInTimeRequest Build(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(new Elastic.Clients.Elasticsearch.OpenPointInTimeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeResponse.g.cs index 1dd4dd1105d..1f51ac9a1f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/OpenPointInTimeResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class OpenPointInTimeResponse : ElasticsearchResponse +internal sealed partial class OpenPointInTimeResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.OpenPointInTimeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.OpenPointInTimeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.OpenPointInTimeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.OpenPointInTimeResponseConverter))] +public sealed partial class OpenPointInTimeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenPointInTimeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenPointInTimeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Shards used to create the PIT /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingRequest.g.cs index 34182e1e3e2..20fe0e8050d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class PingRequestParameters : RequestParameters +public sealed partial class PingRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PingRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.PingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.PingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.PingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -40,11 +62,28 @@ public sealed partial class PingRequestParameters : RequestParameters /// Get information about whether the cluster is running. /// /// -public sealed partial class PingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PingRequestConverter))] +public sealed partial class PingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespacePing; +#if NET7_0_OR_GREATER + public PingRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespacePing; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.HEAD; internal override bool SupportsBody => false; @@ -57,23 +96,76 @@ public sealed partial class PingRequest : PlainRequest /// Get information about whether the cluster is running. /// /// -public sealed partial class PingRequestDescriptor : RequestDescriptor +public readonly partial struct PingRequestDescriptor { - internal PingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.PingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PingRequestDescriptor(Elastic.Clients.Elasticsearch.PingRequest instance) + { + Instance = instance; + } public PingRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.PingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespacePing; + public static explicit operator Elastic.Clients.Elasticsearch.PingRequestDescriptor(Elastic.Clients.Elasticsearch.PingRequest instance) => new Elastic.Clients.Elasticsearch.PingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.PingRequest(Elastic.Clients.Elasticsearch.PingRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.HEAD; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.PingRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.PingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.PingRequestDescriptor(new Elastic.Clients.Elasticsearch.PingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "ping"; + public Elastic.Clients.Elasticsearch.PingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.PingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.PingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.PingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.PingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.PingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.PingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingResponse.g.cs index 55a9d57329a..aeb7fb227e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PingResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class PingResponse : ElasticsearchResponse +internal sealed partial class PingResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.PingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.PingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.PingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PingResponseConverter))] +public sealed partial class PingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptRequest.g.cs index 30a9ae556c2..1dfac2cfb8b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class PutScriptRequestParameters : RequestParameters +public sealed partial class PutScriptRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,30 +44,116 @@ public sealed partial class PutScriptRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutScriptRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.PutScriptRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.PutScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.PutScriptRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a script or search template. /// Creates or updates a stored script or search template. /// /// -public sealed partial class PutScriptRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PutScriptRequestConverter))] +public sealed partial class PutScriptRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) : base(r => r.Required("id", id).Optional("context", context)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespacePutScript; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.StoredScript script) : base(r => r.Required("id", id)) + { + Script = script; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, Elastic.Clients.Elasticsearch.StoredScript script) : base(r => r.Required("id", id).Optional("context", context)) + { + Script = script; + } +#if NET7_0_OR_GREATER + public PutScriptRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespacePutScript; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "put_script"; + /// + /// + /// The context in which the script or search template should run. + /// To prevent errors, the API immediately compiles the script or template in this context. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Context { get => P("context"); set => PO("context", value); } + + /// + /// + /// The identifier for the stored script or search template. + /// It must be unique within the cluster. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -82,7 +161,6 @@ public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Ela /// It can also be set to -1 to indicate that the request should never timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -92,7 +170,6 @@ public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Ela /// It can also be set to -1 to indicate that the request should never timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -100,8 +177,11 @@ public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Ela /// The script or search template, its parameters, and its language. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.StoredScript Script { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.StoredScript Script { get; set; } } /// @@ -110,190 +190,158 @@ public PutScriptRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Ela /// Creates or updates a stored script or search template. /// /// -public sealed partial class PutScriptRequestDescriptor : RequestDescriptor, PutScriptRequestParameters> +public readonly partial struct PutScriptRequestDescriptor { - internal PutScriptRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.PutScriptRequest Instance { get; init; } - public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) : base(r => r.Required("id", id).Optional("context", context)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.PutScriptRequest instance) { + Instance = instance; } - public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.PutScriptRequest(id); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespacePutScript; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "put_script"; - - public PutScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public PutScriptRequestDescriptor Context(Elastic.Clients.Elasticsearch.Name? context) + public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) { - RouteValues.Optional("context", context); - return Self; +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.PutScriptRequest(id, context); +#pragma warning restore CS0618 } - public PutScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutScriptRequestDescriptor() { - RouteValues.Required("id", id); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private Elastic.Clients.Elasticsearch.StoredScript ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.StoredScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.PutScriptRequest instance) => new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.PutScriptRequest(Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// The script or search template, its parameters, and its language. + /// The context in which the script or search template should run. + /// To prevent errors, the API immediately compiles the script or template in this context. /// /// - public PutScriptRequestDescriptor Script(Elastic.Clients.Elasticsearch.StoredScript script) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Context(Elastic.Clients.Elasticsearch.Name? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Context = value; + return this; } - public PutScriptRequestDescriptor Script(Elastic.Clients.Elasticsearch.StoredScriptDescriptor descriptor) + /// + /// + /// The identifier for the stored script or search template. + /// It must be unique within the cluster. + /// + /// + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Id = value; + return this; } - public PutScriptRequestDescriptor Script(Action configure) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.MasterTimeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// It can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.StoredScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + Instance.Timeout = value; + return this; } -} -/// -/// -/// Create or update a script or search template. -/// Creates or updates a stored script or search template. -/// -/// -public sealed partial class PutScriptRequestDescriptor : RequestDescriptor -{ - internal PutScriptRequestDescriptor(Action configure) => configure.Invoke(this); - - public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) : base(r => r.Required("id", id).Optional("context", context)) + /// + /// + /// The script or search template, its parameters, and its language. + /// + /// + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Script(Elastic.Clients.Elasticsearch.StoredScript value) { + Instance.Script = value; + return this; } - public PutScriptRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + /// + /// + /// The script or search template, its parameters, and its language. + /// + /// + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Script(System.Action action) { + Instance.Script = Elastic.Clients.Elasticsearch.StoredScriptDescriptor.Build(action); + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespacePutScript; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "put_script"; - - public PutScriptRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutScriptRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public PutScriptRequestDescriptor Context(Elastic.Clients.Elasticsearch.Name? context) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.PutScriptRequest Build(System.Action action) { - RouteValues.Optional("context", context); - return Self; + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(new Elastic.Clients.Elasticsearch.PutScriptRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PutScriptRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Required("id", id); - return Self; + Instance.ErrorTrace = value; + return this; } - private Elastic.Clients.Elasticsearch.StoredScript ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.StoredScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - /// - /// - /// The script or search template, its parameters, and its language. - /// - /// - public PutScriptRequestDescriptor Script(Elastic.Clients.Elasticsearch.StoredScript script) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Human(bool? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Human = value; + return this; } - public PutScriptRequestDescriptor Script(Elastic.Clients.Elasticsearch.StoredScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor Pretty(bool? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Pretty = value; + return this; } - public PutScriptRequestDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor SourceQueryString(string? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.SourceQueryString = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.StoredScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptResponse.g.cs index 7b863a48caa..72b92c4e846 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/PutScriptResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class PutScriptResponse : ElasticsearchResponse +internal sealed partial class PutScriptResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.PutScriptResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.PutScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.PutScriptResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PutScriptResponseConverter))] +public sealed partial class PutScriptResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutScriptResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutScriptResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleRequest.g.cs index 4ee5638c217..5d6550abbae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class DeleteRuleRequestParameters : RequestParameters +public sealed partial class DeleteRuleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteRuleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a query rule. @@ -41,19 +63,53 @@ public sealed partial class DeleteRuleRequestParameters : RequestParameters /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. /// /// -public sealed partial class DeleteRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestConverter))] +public sealed partial class DeleteRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) { } +#if NET7_0_OR_GREATER + public DeleteRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesDeleteRule; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesDeleteRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "query_rules.delete_rule"; + + /// + /// + /// The unique identifier of the query rule within the specified ruleset to delete + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The unique identifier of the query ruleset containing the rule to delete + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } } /// @@ -63,35 +119,99 @@ public DeleteRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Cli /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. /// /// -public sealed partial class DeleteRuleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRuleRequestDescriptor { - internal DeleteRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest Instance { get; init; } - public DeleteRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesDeleteRule; + public DeleteRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) + { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest(rulesetId, ruleId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.delete_rule"; + /// + /// + /// The unique identifier of the query rule within the specified ruleset to delete + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RuleId = value; + return this; + } + + /// + /// + /// The unique identifier of the query ruleset containing the rule to delete + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleResponse.g.cs index cd36153036e..f081db96de0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRuleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class DeleteRuleResponse : ElasticsearchResponse +internal sealed partial class DeleteRuleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponseConverter))] +public sealed partial class DeleteRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetRequest.g.cs index 138ef634f74..42d1a43a663 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class DeleteRulesetRequestParameters : RequestParameters +public sealed partial class DeleteRulesetRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteRulesetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a query ruleset. @@ -41,19 +63,42 @@ public sealed partial class DeleteRulesetRequestParameters : RequestParameters /// This is a destructive action that is not recoverable. /// /// -public sealed partial class DeleteRulesetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestConverter))] +public sealed partial class DeleteRulesetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) { } +#if NET7_0_OR_GREATER + public DeleteRulesetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesDeleteRuleset; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesDeleteRuleset; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "query_rules.delete_ruleset"; + + /// + /// + /// The unique identifier of the query ruleset to delete + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } } /// @@ -63,29 +108,88 @@ public DeleteRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r /// This is a destructive action that is not recoverable. /// /// -public sealed partial class DeleteRulesetRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRulesetRequestDescriptor { - internal DeleteRulesetRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest Instance { get; init; } - public DeleteRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesDeleteRuleset; + public DeleteRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) + { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest(rulesetId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRulesetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.delete_ruleset"; + /// + /// + /// The unique identifier of the query ruleset to delete + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetResponse.g.cs index eb6ccc13ee9..05f20e1a435 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/DeleteRulesetResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class DeleteRulesetResponse : ElasticsearchResponse +internal sealed partial class DeleteRulesetResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponseConverter))] +public sealed partial class DeleteRulesetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRulesetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleRequest.g.cs index 947016c599d..8b941cedd83 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleRequest.g.cs @@ -17,42 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class GetRuleRequestParameters : RequestParameters +public sealed partial class GetRuleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRuleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a query rule. /// Get details about a query rule within a query ruleset. /// /// -public sealed partial class GetRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestConverter))] +public sealed partial class GetRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) { } +#if NET7_0_OR_GREATER + public GetRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesGetRule; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesGetRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "query_rules.get_rule"; + + /// + /// + /// The unique identifier of the query rule within the specified ruleset to retrieve + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The unique identifier of the query ruleset containing the rule to retrieve + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } } /// @@ -61,35 +117,99 @@ public GetRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Client /// Get details about a query rule within a query ruleset. /// /// -public sealed partial class GetRuleRequestDescriptor : RequestDescriptor +public readonly partial struct GetRuleRequestDescriptor { - internal GetRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest Instance { get; init; } - public GetRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesGetRule; + public GetRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) + { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest(rulesetId, ruleId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.get_rule"; + /// + /// + /// The unique identifier of the query rule within the specified ruleset to retrieve + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RuleId = value; + return this; + } + + /// + /// + /// The unique identifier of the query ruleset containing the rule to retrieve + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleResponse.g.cs index b66e024dbbf..32b3fd7e520 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRuleResponse.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class GetRuleResponse : ElasticsearchResponse +internal sealed partial class GetRuleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropCriteria = System.Text.Json.JsonEncodedText.Encode("criteria"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropRuleId = System.Text.Json.JsonEncodedText.Encode("rule_id"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActions = default; + LocalJsonValue> propCriteria = default; + LocalJsonValue propPriority = default; + LocalJsonValue propRuleId = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, null)) + { + continue; + } + + if (propCriteria.TryReadProperty(ref reader, options, PropCriteria, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propRuleId.TryReadProperty(ref reader, options, PropRuleId, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + Criteria = propCriteria.Value, + Priority = propPriority.Value, + RuleId = propRuleId.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, null); + writer.WriteProperty(options, PropCriteria, value.Criteria, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropRuleId, value.RuleId, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponseConverter))] +public sealed partial class GetRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The actions to take when the rule is matched. /// The format of this action depends on the rule type. /// /// - [JsonInclude, JsonPropertyName("actions")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; set; } /// /// @@ -43,19 +130,23 @@ public sealed partial class GetRuleResponse : ElasticsearchResponse /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. /// /// - [JsonInclude, JsonPropertyName("criteria")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria))] - public IReadOnlyCollection Criteria { get; init; } - [JsonInclude, JsonPropertyName("priority")] - public int? Priority { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Criteria { get; set; } + public int? Priority { get; set; } /// /// /// A unique identifier for the rule. /// /// - [JsonInclude, JsonPropertyName("rule_id")] - public string RuleId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RuleId { get; set; } /// /// @@ -64,6 +155,9 @@ public sealed partial class GetRuleResponse : ElasticsearchResponse /// exclude will exclude specific documents from search results. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetRequest.g.cs index 2241fbfbab8..76dd473357e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetRequest.g.cs @@ -17,42 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class GetRulesetRequestParameters : RequestParameters +public sealed partial class GetRulesetRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRulesetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a query ruleset. /// Get details about a query ruleset. /// /// -public sealed partial class GetRulesetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestConverter))] +public sealed partial class GetRulesetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) { } +#if NET7_0_OR_GREATER + public GetRulesetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesGetRuleset; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesGetRuleset; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "query_rules.get_ruleset"; + + /// + /// + /// The unique identifier of the query ruleset + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } } /// @@ -61,29 +106,88 @@ public GetRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => /// Get details about a query ruleset. /// /// -public sealed partial class GetRulesetRequestDescriptor : RequestDescriptor +public readonly partial struct GetRulesetRequestDescriptor { - internal GetRulesetRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest Instance { get; init; } - public GetRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesGetRuleset; + public GetRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) + { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest(rulesetId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRulesetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.get_ruleset"; + /// + /// + /// The unique identifier of the query ruleset + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetResponse.g.cs index d4cef289e17..0b90cd2c3f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/GetRulesetResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class GetRulesetResponse : ElasticsearchResponse +internal sealed partial class GetRulesetResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + private static readonly System.Text.Json.JsonEncodedText PropRulesetId = System.Text.Json.JsonEncodedText.Encode("ruleset_id"); + + public override Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRules = default; + LocalJsonValue propRulesetId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRules.TryReadProperty(ref reader, options, PropRules, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRulesetId.TryReadProperty(ref reader, options, PropRulesetId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Rules = propRules.Value, + RulesetId = propRulesetId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRules, value.Rules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRulesetId, value.RulesetId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponseConverter))] +public sealed partial class GetRulesetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRulesetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Rules associated with the query ruleset. /// /// - [JsonInclude, JsonPropertyName("rules")] - public IReadOnlyCollection Rules { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Rules { get; set; } /// /// /// A unique identifier for the ruleset. /// /// - [JsonInclude, JsonPropertyName("ruleset_id")] - public string RulesetId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RulesetId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsRequest.g.cs index 3073fd3f1fa..63cff0dabb6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class ListRulesetsRequestParameters : RequestParameters +public sealed partial class ListRulesetsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,17 +40,63 @@ public sealed partial class ListRulesetsRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class ListRulesetsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get all query rulesets. /// Get summarized information about the query rulesets. /// /// -public sealed partial class ListRulesetsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestConverter))] +public sealed partial class ListRulesetsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesListRulesets; +#if NET7_0_OR_GREATER + public ListRulesetsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ListRulesetsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListRulesetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesListRulesets; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -68,7 +107,6 @@ public sealed partial class ListRulesetsRequest : PlainRequest /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -76,7 +114,6 @@ public sealed partial class ListRulesetsRequest : PlainRequest /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -86,26 +123,98 @@ public sealed partial class ListRulesetsRequest : PlainRequest /// -public sealed partial class ListRulesetsRequestDescriptor : RequestDescriptor +public readonly partial struct ListRulesetsRequestDescriptor { - internal ListRulesetsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListRulesetsRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest instance) + { + Instance = instance; + } public ListRulesetsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesListRulesets; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The offset from the first result to fetch. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The maximum number of results to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } - internal override string OperationName => "query_rules.list_rulesets"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ListRulesetsRequestDescriptor From(int? from) => Qs("from", from); - public ListRulesetsRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsResponse.g.cs index dc7e677080a..48d5abcaa57 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/ListRulesetsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class ListRulesetsResponse : ElasticsearchResponse +internal sealed partial class ListRulesetsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropResults = System.Text.Json.JsonEncodedText.Encode("results"); + + public override Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propResults.TryReadProperty(ref reader, options, PropResults, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Results = propResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropResults, value.Results, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponseConverter))] +public sealed partial class ListRulesetsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("results")] - public IReadOnlyCollection Results { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListRulesetsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListRulesetsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Results { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleRequest.g.cs index 0fd2174e097..070e04c600d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class PutRuleRequestParameters : RequestParameters +public sealed partial class PutRuleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutRuleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropCriteria = System.Text.Json.JsonEncodedText.Encode("criteria"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActions = default; + LocalJsonValue> propCriteria = default; + LocalJsonValue propPriority = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, null)) + { + continue; + } + + if (propCriteria.TryReadProperty(ref reader, options, PropCriteria, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + Criteria = propCriteria.Value, + Priority = propPriority.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, null); + writer.WriteProperty(options, PropCriteria, value.Criteria, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a query rule. @@ -46,28 +105,74 @@ public sealed partial class PutRuleRequestParameters : RequestParameters /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. /// /// -public sealed partial class PutRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestConverter))] +public sealed partial class PutRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesPutRule; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions actions, System.Collections.Generic.ICollection criteria, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType type) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) + { + Actions = actions; + Criteria = criteria; + Type = type; + } +#if NET7_0_OR_GREATER + public PutRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesPutRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "query_rules.put_rule"; + /// + /// + /// The unique identifier of the query rule within the specified ruleset to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The unique identifier of the query ruleset containing the rule to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } + /// /// /// The actions to take when the rule is matched. /// The format of this action depends on the rule type. /// /// - [JsonInclude, JsonPropertyName("actions")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; set; } /// /// @@ -75,10 +180,11 @@ public PutRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Client /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. /// /// - [JsonInclude, JsonPropertyName("criteria")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria))] - public ICollection Criteria { get; set; } - [JsonInclude, JsonPropertyName("priority")] + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Criteria { get; set; } public int? Priority { get; set; } /// @@ -86,8 +192,11 @@ public PutRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Client /// The type of rule. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; set; } } /// @@ -102,72 +211,88 @@ public PutRuleRequest(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Client /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. /// /// -public sealed partial class PutRuleRequestDescriptor : RequestDescriptor +public readonly partial struct PutRuleRequestDescriptor { - internal PutRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest Instance { get; init; } - public PutRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("ruleset_id", rulesetId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesPutRule; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest(rulesetId, ruleId); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "query_rules.put_rule"; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor descriptor) => descriptor.Instance; - public PutRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + /// + /// + /// The unique identifier of the query rule within the specified ruleset to be created or updated. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.RuleId = value; + return this; } - public PutRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + /// + /// + /// The unique identifier of the query ruleset containing the rule to be created or updated. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.RulesetId = value; + return this; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor ActionsDescriptor { get; set; } - private Action ActionsDescriptorAction { get; set; } - private ICollection CriteriaValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor CriteriaDescriptor { get; set; } - private Action CriteriaDescriptorAction { get; set; } - private Action[] CriteriaDescriptorActions { get; set; } - private int? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType TypeValue { get; set; } - /// /// /// The actions to take when the rule is matched. /// The format of this action depends on the rule type. /// /// - public PutRuleRequestDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions actions) + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions value) { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsValue = actions; - return Self; + Instance.Actions = value; + return this; } - public PutRuleRequestDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor descriptor) + /// + /// + /// The actions to take when the rule is matched. + /// The format of this action depends on the rule type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Actions() { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptor = descriptor; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor.Build(null); + return this; } - public PutRuleRequestDescriptor Actions(Action configure) + /// + /// + /// The actions to take when the rule is matched. + /// The format of this action depends on the rule type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Actions(System.Action? action) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = configure; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor.Build(action); + return this; } /// @@ -176,46 +301,46 @@ public PutRuleRequestDescriptor Actions(Action /// - public PutRuleRequestDescriptor Criteria(ICollection criteria) + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Criteria(System.Collections.Generic.ICollection value) { - CriteriaDescriptor = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = null; - CriteriaValue = criteria; - return Self; + Instance.Criteria = value; + return this; } - public PutRuleRequestDescriptor Criteria(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor descriptor) + /// + /// + /// The criteria that must be met for the rule to be applied. + /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Criteria(params Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria[] values) { - CriteriaValue = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = null; - CriteriaDescriptor = descriptor; - return Self; + Instance.Criteria = [.. values]; + return this; } - public PutRuleRequestDescriptor Criteria(Action configure) + /// + /// + /// The criteria that must be met for the rule to be applied. + /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Criteria(params System.Action[] actions) { - CriteriaValue = null; - CriteriaDescriptor = null; - CriteriaDescriptorActions = null; - CriteriaDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor.Build(action)); + } - public PutRuleRequestDescriptor Criteria(params Action[] configure) - { - CriteriaValue = null; - CriteriaDescriptor = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = configure; - return Self; + Instance.Criteria = items; + return this; } - public PutRuleRequestDescriptor Priority(int? priority) + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Priority(int? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -223,68 +348,59 @@ public PutRuleRequestDescriptor Priority(int? priority) /// The type of rule. /// /// - public PutRuleRequestDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType type) + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest Build(System.Action action) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - } - else if (ActionsDescriptorAction is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor(ActionsDescriptorAction), options); - } - else - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (CriteriaDescriptor is not null) - { - writer.WritePropertyName("criteria"); - JsonSerializer.Serialize(writer, CriteriaDescriptor, options); - } - else if (CriteriaDescriptorAction is not null) - { - writer.WritePropertyName("criteria"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(CriteriaDescriptorAction), options); - } - else if (CriteriaDescriptorActions is not null) - { - writer.WritePropertyName("criteria"); - if (CriteriaDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in CriteriaDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (CriteriaDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("criteria"); - SingleOrManySerializationHelper.Serialize(CriteriaValue, writer, options); - } + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleResponse.g.cs index b0df637361d..cf9546aa0de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRuleResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class PutRuleResponse : ElasticsearchResponse +internal sealed partial class PutRuleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponseConverter))] +public sealed partial class PutRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetRequest.g.cs index 86ddbaede4e..9a2d2503d84 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetRequest.g.cs @@ -17,23 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class PutRulesetRequestParameters : RequestParameters +public sealed partial class PutRulesetRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutRulesetRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + + public override Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRules = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRules.TryReadProperty(ref reader, options, PropRules, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Rules = propRules.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRules, value.Rules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a query ruleset. @@ -47,23 +79,54 @@ public sealed partial class PutRulesetRequestParameters : RequestParameters /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. /// /// -public sealed partial class PutRulesetRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestConverter))] +public sealed partial class PutRulesetRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesPutRuleset; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId, System.Collections.Generic.ICollection rules) : base(r => r.Required("ruleset_id", rulesetId)) + { + Rules = rules; + } +#if NET7_0_OR_GREATER + public PutRulesetRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesPutRuleset; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "query_rules.put_ruleset"; - [JsonInclude, JsonPropertyName("rules")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRule))] - public ICollection Rules { get; set; } + /// + /// + /// The unique identifier of the query ruleset to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Rules { get; set; } } /// @@ -79,101 +142,114 @@ public PutRulesetRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. /// /// -public sealed partial class PutRulesetRequestDescriptor : RequestDescriptor +public readonly partial struct PutRulesetRequestDescriptor { - internal PutRulesetRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest Instance { get; init; } - public PutRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesPutRuleset; + public PutRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest(rulesetId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRulesetRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.put_ruleset"; + /// + /// + /// The unique identifier of the query ruleset to be created or updated. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } - public PutRulesetRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor Rules(System.Collections.Generic.ICollection value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.Rules = value; + return this; } - private ICollection RulesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor RulesDescriptor { get; set; } - private Action RulesDescriptorAction { get; set; } - private Action[] RulesDescriptorActions { get; set; } + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor Rules(params Elastic.Clients.Elasticsearch.QueryRules.QueryRule[] values) + { + Instance.Rules = [.. values]; + return this; + } - public PutRulesetRequestDescriptor Rules(ICollection rules) + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor Rules(params System.Action[] actions) { - RulesDescriptor = null; - RulesDescriptorAction = null; - RulesDescriptorActions = null; - RulesValue = rules; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor.Build(action)); + } + + Instance.Rules = items; + return this; } - public PutRulesetRequestDescriptor Rules(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest Build(System.Action action) { - RulesValue = null; - RulesDescriptorAction = null; - RulesDescriptorActions = null; - RulesDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PutRulesetRequestDescriptor Rules(Action configure) + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor ErrorTrace(bool? value) { - RulesValue = null; - RulesDescriptor = null; - RulesDescriptorActions = null; - RulesDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public PutRulesetRequestDescriptor Rules(params Action[] configure) + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor FilterPath(params string[]? value) { - RulesValue = null; - RulesDescriptor = null; - RulesDescriptorAction = null; - RulesDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (RulesDescriptor is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, RulesDescriptor, options); - } - else if (RulesDescriptorAction is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor(RulesDescriptorAction), options); - } - else if (RulesDescriptorActions is not null) - { - writer.WritePropertyName("rules"); - if (RulesDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RulesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor(action), options); - } + Instance.Human = value; + return this; + } - if (RulesDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("rules"); - SingleOrManySerializationHelper.Serialize(RulesValue, writer, options); - } + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetResponse.g.cs index 23c35068711..627d3cbf625 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/PutRulesetResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class PutRulesetResponse : ElasticsearchResponse +internal sealed partial class PutRulesetResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponseConverter))] +public sealed partial class PutRulesetResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRulesetResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRulesetResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestRequest.g.cs index 04d3da58199..b4e637bafc4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestRequest.g.cs @@ -17,21 +17,53 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class TestRequestParameters : RequestParameters +public sealed partial class TestRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class TestRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropMatchCriteria = System.Text.Json.JsonEncodedText.Encode("match_criteria"); + + public override Elastic.Clients.Elasticsearch.QueryRules.TestRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMatchCriteria = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMatchCriteria.TryReadProperty(ref reader, options, PropMatchCriteria, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.TestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MatchCriteria = propMatchCriteria.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.TestRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMatchCriteria, value.MatchCriteria, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } } /// @@ -40,28 +72,61 @@ public sealed partial class TestRequestParameters : RequestParameters /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. /// /// -public sealed partial class TestRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.TestRequestConverter))] +public sealed partial class TestRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public TestRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesTest; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestRequest(Elastic.Clients.Elasticsearch.Id rulesetId, System.Collections.Generic.IDictionary matchCriteria) : base(r => r.Required("ruleset_id", rulesetId)) + { + MatchCriteria = matchCriteria; + } +#if NET7_0_OR_GREATER + public TestRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.QueryRulesTest; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "query_rules.test"; + /// + /// + /// The unique identifier of the query ruleset to be created or updated + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RulesetId { get => P("ruleset_id"); set => PR("ruleset_id", value); } + /// /// /// The match criteria to apply to rules in the given query ruleset. /// Match criteria should match the keys defined in the criteria.metadata field of the rule. /// /// - [JsonInclude, JsonPropertyName("match_criteria")] - public IDictionary MatchCriteria { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary MatchCriteria { get; set; } } /// @@ -70,29 +135,66 @@ public TestRequest(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Req /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. /// /// -public sealed partial class TestRequestDescriptor : RequestDescriptor +public readonly partial struct TestRequestDescriptor { - internal TestRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.TestRequest Instance { get; init; } - public TestRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) : base(r => r.Required("ruleset_id", rulesetId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.TestRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.QueryRulesTest; + public TestRequestDescriptor(Elastic.Clients.Elasticsearch.Id rulesetId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.QueryRules.TestRequest(rulesetId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public TestRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(Elastic.Clients.Elasticsearch.QueryRules.TestRequest instance) => new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.TestRequest(Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "query_rules.test"; + /// + /// + /// The unique identifier of the query ruleset to be created or updated + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RulesetId = value; + return this; + } - public TestRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetId) + /// + /// + /// The match criteria to apply to rules in the given query ruleset. + /// Match criteria should match the keys defined in the criteria.metadata field of the rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor MatchCriteria(System.Collections.Generic.IDictionary value) { - RouteValues.Required("ruleset_id", rulesetId); - return Self; + Instance.MatchCriteria = value; + return this; } - private IDictionary MatchCriteriaValue { get; set; } + /// + /// + /// The match criteria to apply to rules in the given query ruleset. + /// Match criteria should match the keys defined in the criteria.metadata field of the rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor MatchCriteria() + { + Instance.MatchCriteria = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } /// /// @@ -100,17 +202,66 @@ public TestRequestDescriptor RulesetId(Elastic.Clients.Elasticsearch.Id rulesetI /// Match criteria should match the keys defined in the criteria.metadata field of the rule. /// /// - public TestRequestDescriptor MatchCriteria(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor MatchCriteria(System.Action? action) { - MatchCriteriaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.MatchCriteria = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor AddMatchCriterion(string key, object value) { - writer.WriteStartObject(); - writer.WritePropertyName("match_criteria"); - JsonSerializer.Serialize(writer, MatchCriteriaValue, options); - writer.WriteEndObject(); + Instance.MatchCriteria ??= new System.Collections.Generic.Dictionary(); + Instance.MatchCriteria.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.TestRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.TestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestResponse.g.cs index 6afa8a862e7..a50231afe34 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/QueryRules/TestResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public sealed partial class TestResponse : ElasticsearchResponse +internal sealed partial class TestResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMatchedRules = System.Text.Json.JsonEncodedText.Encode("matched_rules"); + private static readonly System.Text.Json.JsonEncodedText PropTotalMatchedRules = System.Text.Json.JsonEncodedText.Encode("total_matched_rules"); + + public override Elastic.Clients.Elasticsearch.QueryRules.TestResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMatchedRules = default; + LocalJsonValue propTotalMatchedRules = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMatchedRules.TryReadProperty(ref reader, options, PropMatchedRules, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTotalMatchedRules.TryReadProperty(ref reader, options, PropTotalMatchedRules, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.TestResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MatchedRules = propMatchedRules.Value, + TotalMatchedRules = propTotalMatchedRules.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.TestResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMatchedRules, value.MatchedRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotalMatchedRules, value.TotalMatchedRules, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.TestResponseConverter))] +public sealed partial class TestResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("matched_rules")] - public IReadOnlyCollection MatchedRules { get; init; } - [JsonInclude, JsonPropertyName("total_matched_rules")] - public int TotalMatchedRules { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TestResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MatchedRules { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalMatchedRules { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalRequest.g.cs index c42ede2ec90..fe60f7dec46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class RankEvalRequestParameters : RequestParameters +public sealed partial class RankEvalRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -44,7 +37,7 @@ public sealed partial class RankEvalRequestParameters : RequestParameters /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -61,6 +54,54 @@ public sealed partial class RankEvalRequestParameters : RequestParameters public string? SearchType { get => Q("search_type"); set => Q("search_type", value); } } +internal sealed partial class RankEvalRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMetric = System.Text.Json.JsonEncodedText.Encode("metric"); + private static readonly System.Text.Json.JsonEncodedText PropRequests = System.Text.Json.JsonEncodedText.Encode("requests"); + + public override Elastic.Clients.Elasticsearch.RankEvalRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMetric = default; + LocalJsonValue> propRequests = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMetric.TryReadProperty(ref reader, options, PropMetric, null)) + { + continue; + } + + if (propRequests.TryReadProperty(ref reader, options, PropRequests, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Metric = propMetric.Value, + Requests = propRequests.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RankEvalRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMetric, value.Metric, null, null); + writer.WriteProperty(options, PropRequests, value.Requests, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Evaluate ranked search results. @@ -69,30 +110,65 @@ public sealed partial class RankEvalRequestParameters : RequestParameters /// Evaluate the quality of ranked search results over a set of typical search queries. /// /// -public sealed partial class RankEvalRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RankEvalRequestConverter))] +public sealed partial class RankEvalRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public RankEvalRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) { } - public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices, System.Collections.Generic.ICollection requests) : base(r => r.Optional("index", indices)) + { + Requests = requests; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequest(System.Collections.Generic.ICollection requests) { + Requests = requests; + } +#if NET7_0_OR_GREATER + public RankEvalRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRankEval; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceRankEval; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "rank_eval"; + /// + /// + /// A comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard (*) expressions are supported. + /// To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -100,15 +176,13 @@ public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If true, missing or closed indices are not included in the response. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -116,7 +190,6 @@ public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Search operation type /// /// - [JsonIgnore] public string? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -124,7 +197,6 @@ public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Definition of the evaluation metric to calculate. /// /// - [JsonInclude, JsonPropertyName("metric")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? Metric { get; set; } /// @@ -132,8 +204,11 @@ public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// A set of typical search requests, together with their provided ratings. /// /// - [JsonInclude, JsonPropertyName("requests")] - public ICollection Requests { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Requests { get; set; } } /// @@ -144,166 +219,236 @@ public RankEvalRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r /// Evaluate the quality of ranked search results over a set of typical search queries. /// /// -public sealed partial class RankEvalRequestDescriptor : RequestDescriptor, RankEvalRequestParameters> +public readonly partial struct RankEvalRequestDescriptor { - internal RankEvalRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RankEvalRequest Instance { get; init; } - public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.RankEvalRequest instance) { + Instance = instance; } - public RankEvalRequestDescriptor() + public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.RankEvalRequest(indices); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRankEval; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RankEvalRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.RankEvalRequest instance) => new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rank_eval"; + /// + /// + /// A comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard (*) expressions are supported. + /// To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - public RankEvalRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public RankEvalRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public RankEvalRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public RankEvalRequestDescriptor SearchType(string? searchType) => Qs("search_type", searchType); + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public RankEvalRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.ExpandWildcards = value; + return this; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? MetricValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MetricDescriptor { get; set; } - private Action MetricDescriptorAction { get; set; } - private ICollection RequestsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor RequestsDescriptor { get; set; } - private Action> RequestsDescriptorAction { get; set; } - private Action>[] RequestsDescriptorActions { get; set; } + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } /// /// - /// Definition of the evaluation metric to calculate. + /// If true, missing or closed indices are not included in the response. /// /// - public RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? metric) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor IgnoreUnavailable(bool? value = true) { - MetricDescriptor = null; - MetricDescriptorAction = null; - MetricValue = metric; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor descriptor) + /// + /// + /// Search operation type + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor SearchType(string? value) { - MetricValue = null; - MetricDescriptorAction = null; - MetricDescriptor = descriptor; - return Self; + Instance.SearchType = value; + return this; } - public RankEvalRequestDescriptor Metric(Action configure) + /// + /// + /// Definition of the evaluation metric to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? value) { - MetricValue = null; - MetricDescriptor = null; - MetricDescriptorAction = configure; - return Self; + Instance.Metric = value; + return this; } /// /// - /// A set of typical search requests, together with their provided ratings. + /// Definition of the evaluation metric to calculate. /// /// - public RankEvalRequestDescriptor Requests(ICollection requests) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric() { - RequestsDescriptor = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = null; - RequestsValue = requests; - return Self; + Instance.Metric = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor.Build(null); + return this; } - public RankEvalRequestDescriptor Requests(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor descriptor) + /// + /// + /// Definition of the evaluation metric to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric(System.Action? action) { - RequestsValue = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = null; - RequestsDescriptor = descriptor; - return Self; + Instance.Metric = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor.Build(action); + return this; } - public RankEvalRequestDescriptor Requests(Action> configure) + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(System.Collections.Generic.ICollection value) { - RequestsValue = null; - RequestsDescriptor = null; - RequestsDescriptorActions = null; - RequestsDescriptorAction = configure; - return Self; + Instance.Requests = value; + return this; } - public RankEvalRequestDescriptor Requests(params Action>[] configure) + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(params Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem[] values) { - RequestsValue = null; - RequestsDescriptor = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = configure; - return Self; + Instance.Requests = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(params System.Action[] actions) { - writer.WriteStartObject(); - if (MetricDescriptor is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, MetricDescriptor, options); - } - else if (MetricDescriptorAction is not null) - { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(MetricDescriptorAction), options); - } - else if (MetricValue is not null) - { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, MetricValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor.Build(action)); } - if (RequestsDescriptor is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RequestsDescriptor, options); - writer.WriteEndArray(); - } - else if (RequestsDescriptorAction is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(RequestsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RequestsDescriptorActions is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - foreach (var action in RequestsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(action), options); - } + Instance.Requests = items; + return this; + } - writer.WriteEndArray(); - } - else + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("requests"); - JsonSerializer.Serialize(writer, RequestsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.Requests = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RankEvalRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(new Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -315,72 +460,152 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Evaluate the quality of ranked search results over a set of typical search queries. /// /// -public sealed partial class RankEvalRequestDescriptor : RequestDescriptor +public readonly partial struct RankEvalRequestDescriptor { - internal RankEvalRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RankEvalRequest Instance { get; init; } - public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.RankEvalRequest instance) { + Instance = instance; + } + + public RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.RankEvalRequest(indices); +#pragma warning restore CS0618 } public RankEvalRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(Elastic.Clients.Elasticsearch.RankEvalRequest instance) => new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of data streams, indices, and index aliases used to limit the request. + /// Wildcard (*) expressions are supported. + /// To target all data streams and indices in a cluster, omit this parameter or use _all or *. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRankEval; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - internal override string OperationName => "rank_eval"; + /// + /// + /// If true, missing or closed indices are not included in the response. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public RankEvalRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public RankEvalRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public RankEvalRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public RankEvalRequestDescriptor SearchType(string? searchType) => Qs("search_type", searchType); + /// + /// + /// Search operation type + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor SearchType(string? value) + { + Instance.SearchType = value; + return this; + } - public RankEvalRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Definition of the evaluation metric to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.Metric = value; + return this; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? MetricValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MetricDescriptor { get; set; } - private Action MetricDescriptorAction { get; set; } - private ICollection RequestsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor RequestsDescriptor { get; set; } - private Action RequestsDescriptorAction { get; set; } - private Action[] RequestsDescriptorActions { get; set; } + /// + /// + /// Definition of the evaluation metric to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric() + { + Instance.Metric = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor.Build(null); + return this; + } /// /// /// Definition of the evaluation metric to calculate. /// /// - public RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric? metric) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Metric(System.Action? action) { - MetricDescriptor = null; - MetricDescriptorAction = null; - MetricValue = metric; - return Self; + Instance.Metric = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor.Build(action); + return this; } - public RankEvalRequestDescriptor Metric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor descriptor) + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(System.Collections.Generic.ICollection value) { - MetricValue = null; - MetricDescriptorAction = null; - MetricDescriptor = descriptor; - return Self; + Instance.Requests = value; + return this; } - public RankEvalRequestDescriptor Metric(Action configure) + /// + /// + /// A set of typical search requests, together with their provided ratings. + /// + /// + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(params Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem[] values) { - MetricValue = null; - MetricDescriptor = null; - MetricDescriptorAction = configure; - return Self; + Instance.Requests = [.. values]; + return this; } /// @@ -388,92 +613,65 @@ public RankEvalRequestDescriptor Metric(Action /// - public RankEvalRequestDescriptor Requests(ICollection requests) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Requests(params System.Action>[] actions) { - RequestsDescriptor = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = null; - RequestsValue = requests; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor.Build(action)); + } + + Instance.Requests = items; + return this; } - public RankEvalRequestDescriptor Requests(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RankEvalRequest Build(System.Action> action) { - RequestsValue = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = null; - RequestsDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(new Elastic.Clients.Elasticsearch.RankEvalRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public RankEvalRequestDescriptor Requests(Action configure) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor ErrorTrace(bool? value) { - RequestsValue = null; - RequestsDescriptor = null; - RequestsDescriptorActions = null; - RequestsDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - public RankEvalRequestDescriptor Requests(params Action[] configure) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor FilterPath(params string[]? value) { - RequestsValue = null; - RequestsDescriptor = null; - RequestsDescriptorAction = null; - RequestsDescriptorActions = configure; - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Human(bool? value) { - writer.WriteStartObject(); - if (MetricDescriptor is not null) - { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, MetricDescriptor, options); - } - else if (MetricDescriptorAction is not null) - { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(MetricDescriptorAction), options); - } - else if (MetricValue is not null) - { - writer.WritePropertyName("metric"); - JsonSerializer.Serialize(writer, MetricValue, options); - } + Instance.Human = value; + return this; + } - if (RequestsDescriptor is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RequestsDescriptor, options); - writer.WriteEndArray(); - } - else if (RequestsDescriptorAction is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(RequestsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RequestsDescriptorActions is not null) - { - writer.WritePropertyName("requests"); - writer.WriteStartArray(); - foreach (var action in RequestsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("requests"); - JsonSerializer.Serialize(writer, RequestsValue, options); - } + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalResponse.g.cs index c8fffdd414c..26edbd66850 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RankEvalResponse.g.cs @@ -17,32 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class RankEvalResponse : ElasticsearchResponse +internal sealed partial class RankEvalResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropMetricScore = System.Text.Json.JsonEncodedText.Encode("metric_score"); + + public override Elastic.Clients.Elasticsearch.RankEvalResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDetails = default; + LocalJsonValue> propFailures = default; + LocalJsonValue propMetricScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propMetricScore.TryReadProperty(ref reader, options, PropMetricScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RankEvalResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Failures = propFailures.Value, + MetricScore = propMetricScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RankEvalResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMetricScore, value.MetricScore, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RankEvalResponseConverter))] +public sealed partial class RankEvalResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The details section contains one entry for every query in the original requests section, keyed by the search request id /// /// - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyDictionary Details { get; init; } - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyDictionary Failures { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Details { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Failures { get; set; } /// /// /// The overall evaluation quality calculated by the defined metric /// /// - [JsonInclude, JsonPropertyName("metric_score")] - public double MetricScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double MetricScore { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRequest.g.cs index 428503821c2..86e6d769933 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ReindexRequestParameters : RequestParameters +public sealed partial class ReindexRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -107,6 +100,90 @@ public sealed partial class ReindexRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class ReindexRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConflicts = System.Text.Json.JsonEncodedText.Encode("conflicts"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.ReindexRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConflicts = default; + LocalJsonValue propDest = default; + LocalJsonValue propMaxDocs = default; + LocalJsonValue propScript = default; + LocalJsonValue propSize = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConflicts.TryReadProperty(ref reader, options, PropConflicts, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Conflicts = propConflicts.Value, + Dest = propDest.Value, + MaxDocs = propMaxDocs.Value, + Script = propScript.Value, + Size = propSize.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ReindexRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConflicts, value.Conflicts, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Reindex documents. @@ -212,7 +289,7 @@ public sealed partial class ReindexRequestParameters : RequestParameters /// done /// /// -/// ** Throttling** +/// Throttling /// /// /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. @@ -400,11 +477,35 @@ public sealed partial class ReindexRequestParameters : RequestParameters /// It is not possible to configure SSL in the body of the reindex request. /// /// -public sealed partial class ReindexRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ReindexRequestConverter))] +public sealed partial class ReindexRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceReindex; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexRequest(Elastic.Clients.Elasticsearch.Core.Reindex.Destination dest, Elastic.Clients.Elasticsearch.Core.Reindex.Source source) + { + Dest = dest; + Source = source; + } +#if NET7_0_OR_GREATER + public ReindexRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReindexRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceReindex; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -415,7 +516,6 @@ public sealed partial class ReindexRequest : PlainRequesttrue, the request refreshes affected shards to make this operation visible to search. /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -424,7 +524,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } /// @@ -432,7 +531,6 @@ public sealed partial class ReindexRequest : PlainRequesttrue, the destination must be an index alias. /// /// - [JsonIgnore] public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } /// @@ -440,7 +538,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Scroll { get => Q("scroll"); set => Q("scroll", value); } /// @@ -461,7 +558,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Slices? Slices { get => Q("slices"); set => Q("slices", value); } /// @@ -471,7 +567,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -481,7 +576,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -489,7 +583,6 @@ public sealed partial class ReindexRequest : PlainRequesttrue, the request blocks until the operation is complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// @@ -497,7 +590,6 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("conflicts")] public Elastic.Clients.Elasticsearch.Conflicts? Conflicts { get; set; } /// @@ -505,8 +597,11 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; set; } /// /// @@ -518,7 +613,6 @@ public sealed partial class ReindexRequest : PlainRequestconflicts is set to proceed, the reindex operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. /// /// - [JsonInclude, JsonPropertyName("max_docs")] public long? MaxDocs { get; set; } /// @@ -526,9 +620,7 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("size")] public long? Size { get; set; } /// @@ -536,8 +628,11 @@ public sealed partial class ReindexRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.Core.Reindex.Source Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Reindex.Source Source { get; set; } } /// @@ -645,7 +740,7 @@ public sealed partial class ReindexRequest : PlainRequest /// -/// ** Throttling** +/// Throttling /// /// /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. @@ -833,82 +928,185 @@ public sealed partial class ReindexRequest : PlainRequest /// -public sealed partial class ReindexRequestDescriptor : RequestDescriptor, ReindexRequestParameters> +public readonly partial struct ReindexRequestDescriptor { - internal ReindexRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ReindexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRequest instance) + { + Instance = instance; + } public ReindexRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceReindex; + public static explicit operator Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRequest instance) => new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.ReindexRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true, the request refreshes affected shards to make this operation visible to search. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The throttle for this request in sub-requests per second. + /// By default, there is no throttle. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } - internal override string OperationName => "reindex"; + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequireAlias(bool? value = true) + { + Instance.RequireAlias = value; + return this; + } - public ReindexRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ReindexRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public ReindexRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public ReindexRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public ReindexRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public ReindexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public ReindexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public ReindexRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - private Elastic.Clients.Elasticsearch.Conflicts? ConflictsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.Destination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private long? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.Source SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } + /// + /// + /// The period of time that a consistent view of the index should be maintained for scrolled search. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } /// /// - /// Indicates whether to continue reindexing even when there are conflicts. + /// The number of slices this task should be divided into. + /// It defaults to one slice, which means the task isn't sliced into subtasks. + /// + /// + /// Reindex supports sliced scroll to parallelize the reindexing process. + /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + /// + /// + /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + /// + /// + /// If set to auto, Elasticsearch chooses the number of slices to use. + /// This setting will use one slice per shard, up to a certain limit. + /// If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. /// /// - public ReindexRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) { - ConflictsValue = conflicts; - return Self; + Instance.Slices = value; + return this; } /// /// - /// The destination you are copying to. + /// The number of slices this task should be divided into. + /// It defaults to one slice, which means the task isn't sliced into subtasks. + /// + /// + /// Reindex supports sliced scroll to parallelize the reindexing process. + /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + /// + /// + /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + /// + /// + /// If set to auto, Elasticsearch chooses the number of slices to use. + /// This setting will use one slice per shard, up to a certain limit. + /// If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Slices(System.Func action) + { + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; + } + + /// + /// + /// The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. + /// By default, Elasticsearch waits for at least one minute before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - public ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.Destination dest) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Timeout = value; + return this; } - public ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor descriptor) + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value is one, which means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.WaitForActiveShards = value; + return this; } - public ReindexRequestDescriptor Dest(Action configure) + /// + /// + /// If true, the request blocks until the operation is complete. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + /// + /// + /// Indicates whether to continue reindexing even when there are conflicts. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) + { + Instance.Conflicts = value; + return this; + } + + /// + /// + /// The destination you are copying to. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.Destination value) + { + Instance.Dest = value; + return this; + } + + /// + /// + /// The destination you are copying to. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Dest(System.Action action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor.Build(action); + return this; } /// @@ -921,10 +1119,10 @@ public ReindexRequestDescriptor Dest(Actionconflicts is set to proceed, the reindex operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. /// /// - public ReindexRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor MaxDocs(long? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxDocs = value; + return this; } /// @@ -932,34 +1130,38 @@ public ReindexRequestDescriptor MaxDocs(long? maxDocs) /// The script to run to update the document source or metadata when reindexing. /// /// - public ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run to update the document source or metadata when reindexing. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ReindexRequestDescriptor Script(Action configure) + /// + /// + /// The script to run to update the document source or metadata when reindexing. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ReindexRequestDescriptor Size(long? size) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Size(long? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -967,100 +1169,82 @@ public ReindexRequestDescriptor Size(long? size) /// The source you are copying from. /// /// - public ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.Source source) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.Source value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor descriptor) + /// + /// + /// The source you are copying from. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor.Build(action); + return this; } - public ReindexRequestDescriptor Source(Action> configure) + /// + /// + /// The source you are copying from. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ReindexRequest Build(System.Action action) { - writer.WriteStartObject(); - if (ConflictsValue is not null) - { - writer.WritePropertyName("conflicts"); - JsonSerializer.Serialize(writer, ConflictsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(new Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -1169,7 +1353,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// done /// /// -/// ** Throttling** +/// Throttling /// /// /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. @@ -1357,82 +1541,185 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// It is not possible to configure SSL in the body of the reindex request. /// /// -public sealed partial class ReindexRequestDescriptor : RequestDescriptor +public readonly partial struct ReindexRequestDescriptor { - internal ReindexRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ReindexRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRequest instance) + { + Instance = instance; + } public ReindexRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceReindex; + public static explicit operator Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRequest instance) => new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.ReindexRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true, the request refreshes affected shards to make this operation visible to search. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The throttle for this request in sub-requests per second. + /// By default, there is no throttle. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } - internal override string OperationName => "reindex"; + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequireAlias(bool? value = true) + { + Instance.RequireAlias = value; + return this; + } - public ReindexRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public ReindexRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public ReindexRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public ReindexRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public ReindexRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public ReindexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public ReindexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public ReindexRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - private Elastic.Clients.Elasticsearch.Conflicts? ConflictsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.Destination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private long? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.Source SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } + /// + /// + /// The period of time that a consistent view of the index should be maintained for scrolled search. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } /// /// - /// Indicates whether to continue reindexing even when there are conflicts. + /// The number of slices this task should be divided into. + /// It defaults to one slice, which means the task isn't sliced into subtasks. + /// + /// + /// Reindex supports sliced scroll to parallelize the reindexing process. + /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + /// + /// + /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + /// + /// + /// If set to auto, Elasticsearch chooses the number of slices to use. + /// This setting will use one slice per shard, up to a certain limit. + /// If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. /// /// - public ReindexRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) { - ConflictsValue = conflicts; - return Self; + Instance.Slices = value; + return this; } /// /// - /// The destination you are copying to. + /// The number of slices this task should be divided into. + /// It defaults to one slice, which means the task isn't sliced into subtasks. + /// + /// + /// Reindex supports sliced scroll to parallelize the reindexing process. + /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. + /// + /// + /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. + /// + /// + /// If set to auto, Elasticsearch chooses the number of slices to use. + /// This setting will use one slice per shard, up to a certain limit. + /// If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards. /// /// - public ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.Destination dest) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Slices(System.Func action) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; } - public ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor descriptor) + /// + /// + /// The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. + /// By default, Elasticsearch waits for at least one minute before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Timeout = value; + return this; } - public ReindexRequestDescriptor Dest(Action configure) + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set it to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value is one, which means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// If true, the request blocks until the operation is complete. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor WaitForCompletion(bool? value = true) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.WaitForCompletion = value; + return this; + } + + /// + /// + /// Indicates whether to continue reindexing even when there are conflicts. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) + { + Instance.Conflicts = value; + return this; + } + + /// + /// + /// The destination you are copying to. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Dest(Elastic.Clients.Elasticsearch.Core.Reindex.Destination value) + { + Instance.Dest = value; + return this; + } + + /// + /// + /// The destination you are copying to. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Dest(System.Action action) + { + Instance.Dest = Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor.Build(action); + return this; } /// @@ -1445,10 +1732,10 @@ public ReindexRequestDescriptor Dest(Actionconflicts is set to proceed, the reindex operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. /// /// - public ReindexRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor MaxDocs(long? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxDocs = value; + return this; } /// @@ -1456,34 +1743,38 @@ public ReindexRequestDescriptor MaxDocs(long? maxDocs) /// The script to run to update the document source or metadata when reindexing. /// /// - public ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ReindexRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run to update the document source or metadata when reindexing. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ReindexRequestDescriptor Script(Action configure) + /// + /// + /// The script to run to update the document source or metadata when reindexing. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ReindexRequestDescriptor Size(long? size) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Size(long? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -1491,99 +1782,70 @@ public ReindexRequestDescriptor Size(long? size) /// The source you are copying from. /// /// - public ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.Source source) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.Source value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public ReindexRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor descriptor) + /// + /// + /// The source you are copying from. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor.Build(action); + return this; } - public ReindexRequestDescriptor Source(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ReindexRequest Build(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(new Elastic.Clients.Elasticsearch.ReindexRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (ConflictsValue is not null) - { - writer.WritePropertyName("conflicts"); - JsonSerializer.Serialize(writer, ConflictsValue, options); - } + Instance.ErrorTrace = value; + return this; + } - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ReindexRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexResponse.g.cs index 57fafdd818b..b0f5b8dd4f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexResponse.g.cs @@ -17,40 +17,220 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ReindexResponse : ElasticsearchResponse +internal sealed partial class ReindexResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBatches = System.Text.Json.JsonEncodedText.Encode("batches"); + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropNoops = System.Text.Json.JsonEncodedText.Encode("noops"); + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerSecond = System.Text.Json.JsonEncodedText.Encode("requests_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropRetries = System.Text.Json.JsonEncodedText.Encode("retries"); + private static readonly System.Text.Json.JsonEncodedText PropSliceId = System.Text.Json.JsonEncodedText.Encode("slice_id"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledMillis = System.Text.Json.JsonEncodedText.Encode("throttled_millis"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntilMillis = System.Text.Json.JsonEncodedText.Encode("throttled_until_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + private static readonly System.Text.Json.JsonEncodedText PropVersionConflicts = System.Text.Json.JsonEncodedText.Encode("version_conflicts"); + + public override Elastic.Clients.Elasticsearch.ReindexResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBatches = default; + LocalJsonValue propCreated = default; + LocalJsonValue propDeleted = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue propNoops = default; + LocalJsonValue propRequestsPerSecond = default; + LocalJsonValue propRetries = default; + LocalJsonValue propSliceId = default; + LocalJsonValue propTask = default; + LocalJsonValue propThrottledMillis = default; + LocalJsonValue propThrottledUntilMillis = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + LocalJsonValue propTotal = default; + LocalJsonValue propUpdated = default; + LocalJsonValue propVersionConflicts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBatches.TryReadProperty(ref reader, options, PropBatches, null)) + { + continue; + } + + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNoops.TryReadProperty(ref reader, options, PropNoops, null)) + { + continue; + } + + if (propRequestsPerSecond.TryReadProperty(ref reader, options, PropRequestsPerSecond, null)) + { + continue; + } + + if (propRetries.TryReadProperty(ref reader, options, PropRetries, null)) + { + continue; + } + + if (propSliceId.TryReadProperty(ref reader, options, PropSliceId, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (propThrottledMillis.TryReadProperty(ref reader, options, PropThrottledMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propThrottledUntilMillis.TryReadProperty(ref reader, options, PropThrottledUntilMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (propVersionConflicts.TryReadProperty(ref reader, options, PropVersionConflicts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Batches = propBatches.Value, + Created = propCreated.Value, + Deleted = propDeleted.Value, + Failures = propFailures.Value, + Noops = propNoops.Value, + RequestsPerSecond = propRequestsPerSecond.Value, + Retries = propRetries.Value, + SliceId = propSliceId.Value, + Task = propTask.Value, + ThrottledMillis = propThrottledMillis.Value, + ThrottledUntilMillis = propThrottledUntilMillis.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value, + Total = propTotal.Value, + Updated = propUpdated.Value, + VersionConflicts = propVersionConflicts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ReindexResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBatches, value.Batches, null, null); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNoops, value.Noops, null, null); + writer.WriteProperty(options, PropRequestsPerSecond, value.RequestsPerSecond, null, null); + writer.WriteProperty(options, PropRetries, value.Retries, null, null); + writer.WriteProperty(options, PropSliceId, value.SliceId, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteProperty(options, PropThrottledMillis, value.ThrottledMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropThrottledUntilMillis, value.ThrottledUntilMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteProperty(options, PropVersionConflicts, value.VersionConflicts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ReindexResponseConverter))] +public sealed partial class ReindexResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of scroll responses that were pulled back by the reindex. /// /// - [JsonInclude, JsonPropertyName("batches")] - public long? Batches { get; init; } + public long? Batches { get; set; } /// /// /// The number of documents that were successfully created. /// /// - [JsonInclude, JsonPropertyName("created")] - public long? Created { get; init; } + public long? Created { get; set; } /// /// /// The number of documents that were successfully deleted. /// /// - [JsonInclude, JsonPropertyName("deleted")] - public long? Deleted { get; init; } + public long? Deleted { get; set; } /// /// @@ -60,44 +240,37 @@ public sealed partial class ReindexResponse : ElasticsearchResponse /// You can use the conflicts option to prevent the reindex from ending on version conflicts. /// /// - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } /// /// /// The number of documents that were ignored because the script used for the reindex returned a noop value for ctx.op. /// /// - [JsonInclude, JsonPropertyName("noops")] - public long? Noops { get; init; } + public long? Noops { get; set; } /// /// /// The number of requests per second effectively run during the reindex. /// /// - [JsonInclude, JsonPropertyName("requests_per_second")] - public float? RequestsPerSecond { get; init; } + public float? RequestsPerSecond { get; set; } /// /// /// The number of retries attempted by reindex. /// /// - [JsonInclude, JsonPropertyName("retries")] - public Elastic.Clients.Elasticsearch.Retries? Retries { get; init; } - [JsonInclude, JsonPropertyName("slice_id")] - public int? SliceId { get; init; } - [JsonInclude, JsonPropertyName("task")] - public Elastic.Clients.Elasticsearch.TaskId? Task { get; init; } + public Elastic.Clients.Elasticsearch.Retries? Retries { get; set; } + public int? SliceId { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? Task { get; set; } /// /// /// The number of milliseconds the request slept to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_millis")] - public long? ThrottledMillis { get; init; } + public System.DateTimeOffset? ThrottledMillis { get; set; } /// /// @@ -105,32 +278,28 @@ public sealed partial class ReindexResponse : ElasticsearchResponse /// It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) that a throttled request will be run again in order to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_until_millis")] - public long? ThrottledUntilMillis { get; init; } + public System.DateTimeOffset? ThrottledUntilMillis { get; set; } /// /// /// If any of the requests that ran during the reindex timed out, it is true. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool? TimedOut { get; init; } + public bool? TimedOut { get; set; } /// /// /// The total milliseconds the entire operation took. /// /// - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + public System.TimeSpan? Took { get; set; } /// /// /// The number of documents that were successfully processed. /// /// - [JsonInclude, JsonPropertyName("total")] - public long? Total { get; init; } + public long? Total { get; set; } /// /// @@ -138,14 +307,12 @@ public sealed partial class ReindexResponse : ElasticsearchResponse /// That is to say, a document with the same ID already existed before the reindex updated it. /// /// - [JsonInclude, JsonPropertyName("updated")] - public long? Updated { get; init; } + public long? Updated { get; set; } /// /// /// The number of version conflicts that occurred. /// /// - [JsonInclude, JsonPropertyName("version_conflicts")] - public long? VersionConflicts { get; init; } + public long? VersionConflicts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleRequest.g.cs index bc01acf7030..8abc86fe847 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ReindexRethrottleRequestParameters : RequestParameters +public sealed partial class ReindexRethrottleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,35 @@ public sealed partial class ReindexRethrottleRequestParameters : RequestParamete public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } +internal sealed partial class ReindexRethrottleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ReindexRethrottleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ReindexRethrottleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Throttle a reindex operation. @@ -58,27 +80,49 @@ public sealed partial class ReindexRethrottleRequestParameters : RequestParamete /// This behavior prevents scroll timeouts. /// /// -public sealed partial class ReindexRethrottleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ReindexRethrottleRequestConverter))] +public sealed partial class ReindexRethrottleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) { } +#if NET7_0_OR_GREATER + public ReindexRethrottleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceReindexRethrottle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceReindexRethrottle; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "reindex_rethrottle"; + /// + /// + /// The task identifier, which can be found by using the tasks API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TaskId { get => P("task_id"); set => PR("task_id", value); } + /// /// /// The throttle for this request in sub-requests per second. /// It can be either -1 to turn off throttling or any decimal number like 1.7 or 12 to throttle to that level. /// /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } @@ -99,31 +143,100 @@ public ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.Id taskId) : base( /// This behavior prevents scroll timeouts. /// /// -public sealed partial class ReindexRethrottleRequestDescriptor : RequestDescriptor +public readonly partial struct ReindexRethrottleRequestDescriptor { - internal ReindexRethrottleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ReindexRethrottleRequest Instance { get; init; } - public ReindexRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRethrottleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceReindexRethrottle; + public ReindexRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) + { + Instance = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequest(taskId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ReindexRethrottleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.ReindexRethrottleRequest instance) => new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "reindex_rethrottle"; + /// + /// + /// The task identifier, which can be found by using the tasks API. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TaskId = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// It can be either -1 to turn off throttling or any decimal number like 1.7 or 12 to throttle to that level. + /// + /// + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ReindexRethrottleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(new Elastic.Clients.Elasticsearch.ReindexRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ReindexRethrottleRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ReindexRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id taskId) + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("task_id", taskId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleResponse.g.cs index eb0a0d689a5..191a852ccb1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ReindexRethrottleResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ReindexRethrottleResponse : ElasticsearchResponse +internal sealed partial class ReindexRethrottleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + + public override Elastic.Clients.Elasticsearch.ReindexRethrottleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ReindexRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ReindexRethrottleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ReindexRethrottleResponseConverter))] +public sealed partial class ReindexRethrottleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexRethrottleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateRequest.g.cs index 7e7a6a4d21b..2fd8a25dfcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateRequest.g.cs @@ -17,21 +17,80 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class RenderSearchTemplateRequestParameters : RequestParameters +public sealed partial class RenderSearchTemplateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class RenderSearchTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFile = System.Text.Json.JsonEncodedText.Encode("file"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFile = default; + LocalJsonValue propId = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFile.TryReadProperty(ref reader, options, PropFile, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + File = propFile.Value, + Id = propId.Value, + Params = propParams.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFile, value.File, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } } /// @@ -42,25 +101,33 @@ public sealed partial class RenderSearchTemplateRequestParameters : RequestParam /// Render a search template as a search request body. /// /// -public sealed partial class RenderSearchTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestConverter))] +public sealed partial class RenderSearchTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { +#if NET7_0_OR_GREATER public RenderSearchTemplateRequest() { } - - public RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public RenderSearchTemplateRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRenderSearchTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceRenderSearchTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "render_search_template"; - [JsonInclude, JsonPropertyName("file")] public string? File { get; set; } /// @@ -70,7 +137,6 @@ public RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Id? id) : base( /// If you specify both this parameter and the <template-id> parameter, the API uses only <template-id>. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -80,8 +146,7 @@ public RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Id? id) : base( /// The value is the variable value. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// @@ -91,7 +156,6 @@ public RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Id? id) : base( /// If no id or <templated-id> is specified, this parameter is required. /// /// - [JsonInclude, JsonPropertyName("source")] public string? Source { get; set; } } @@ -103,31 +167,28 @@ public RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Id? id) : base( /// Render a search template as a search request body. /// /// -public sealed partial class RenderSearchTemplateRequestDescriptor : RequestDescriptor, RenderSearchTemplateRequestParameters> +public readonly partial struct RenderSearchTemplateRequestDescriptor { - internal RenderSearchTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest Instance { get; init; } - public RenderSearchTemplateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenderSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRenderSearchTemplate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "render_search_template"; + public RenderSearchTemplateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? FileValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? SourceValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest instance) => new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor descriptor) => descriptor.Instance; - public RenderSearchTemplateRequestDescriptor File(string? file) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor File(string? value) { - FileValue = file; - return Self; + Instance.File = value; + return this; } /// @@ -137,10 +198,10 @@ public RenderSearchTemplateRequestDescriptor File(string? file) /// If you specify both this parameter and the <template-id> parameter, the API uses only <template-id>. /// /// - public RenderSearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -150,103 +211,23 @@ public RenderSearchTemplateRequestDescriptor Id(Elastic.Clients.Elast /// The value is the variable value. /// /// - public RenderSearchTemplateRequestDescriptor Params(Func, FluentDictionary> selector) - { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; - } - - /// - /// - /// An inline search template. - /// It supports the same parameters as the search API's request body. - /// These parameters also support Mustache variables. - /// If no id or <templated-id> is specified, this parameter is required. - /// - /// - public RenderSearchTemplateRequestDescriptor Source(string? source) - { - SourceValue = source; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FileValue)) - { - writer.WritePropertyName("file"); - writer.WriteStringValue(FileValue); - } - - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } - - writer.WriteEndObject(); - } -} - -/// -/// -/// Render a search template. -/// -/// -/// Render a search template as a search request body. -/// -/// -public sealed partial class RenderSearchTemplateRequestDescriptor : RequestDescriptor -{ - internal RenderSearchTemplateRequestDescriptor(Action configure) => configure.Invoke(this); - - public RenderSearchTemplateRequestDescriptor() - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceRenderSearchTemplate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "render_search_template"; - - private string? FileValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? SourceValue { get; set; } - - public RenderSearchTemplateRequestDescriptor File(string? file) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - FileValue = file; - return Self; + Instance.Params = value; + return this; } /// /// - /// The ID of the search template to render. - /// If no source is specified, this or the <template-id> request path parameter is required. - /// If you specify both this parameter and the <template-id> parameter, the API uses only <template-id>. + /// Key-value pairs used to replace Mustache variables in the template. + /// The key is the variable name. + /// The value is the variable value. /// /// - public RenderSearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Params() { - IdValue = id; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -256,10 +237,17 @@ public RenderSearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id /// The value is the variable value. /// /// - public RenderSearchTemplateRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Params(System.Action? action) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -270,39 +258,64 @@ public RenderSearchTemplateRequestDescriptor Params(Funcid or <templated-id> is specified, this parameter is required. /// /// - public RenderSearchTemplateRequestDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FileValue)) + if (action is null) { - writer.WritePropertyName("file"); - writer.WriteStringValue(FileValue); + return new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateResponse.g.cs index 9fba7ed830c..f5b1121ee1b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/RenderSearchTemplateResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class RenderSearchTemplateResponse : ElasticsearchResponse +internal sealed partial class RenderSearchTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("template_output")] - public IReadOnlyDictionary TemplateOutput { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropTemplateOutput = System.Text.Json.JsonEncodedText.Encode("template_output"); + + public override Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propTemplateOutput = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTemplateOutput.TryReadProperty(ref reader, options, PropTemplateOutput, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + TemplateOutput = propTemplateOutput.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTemplateOutput, value.TemplateOutput, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RenderSearchTemplateResponseConverter))] +public sealed partial class RenderSearchTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenderSearchTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RenderSearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary TemplateOutput { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobRequest.g.cs index aa025a5e23b..dbc668dac78 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class DeleteJobRequestParameters : RequestParameters +public sealed partial class DeleteJobRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteJobRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -63,19 +85,42 @@ public sealed partial class DeleteJobRequestParameters : RequestParameters /// } /// /// -public sealed partial class DeleteJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestConverter))] +public sealed partial class DeleteJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupDeleteJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupDeleteJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "rollup.delete_job"; + + /// + /// + /// Identifier for the job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -107,85 +152,88 @@ public DeleteJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requi /// } /// /// -public sealed partial class DeleteJobRequestDescriptor : RequestDescriptor, DeleteJobRequestParameters> +public readonly partial struct DeleteJobRequestDescriptor { - internal DeleteJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest Instance { get; init; } - public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupDeleteJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "rollup.delete_job"; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor descriptor) => descriptor.Instance; - public DeleteJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the job. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Delete a rollup job. -/// -/// -/// A job must be stopped before it can be deleted. -/// If you attempt to delete a started job, an error occurs. -/// Similarly, if you attempt to delete a nonexistent job, an exception occurs. -/// -/// -/// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. -/// The API does not delete any previously rolled up data. -/// This is by design; a user may wish to roll up a static data set. -/// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). -/// Thus the job can be deleted, leaving behind the rolled up data for analysis. -/// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. -/// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: -/// -/// -/// POST my_rollup_index/_delete_by_query -/// { -/// "query": { -/// "term": { -/// "_rollup.id": "the_rollup_job_id" -/// } -/// } -/// } -/// -/// -public sealed partial class DeleteJobRequestDescriptor : RequestDescriptor -{ - internal DeleteJobRequestDescriptor(Action configure) => configure.Invoke(this); - public DeleteJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupDeleteJob; + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "rollup.delete_job"; + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobResponse.g.cs index ecf093b6b08..92eabdd06f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/DeleteJobResponse.g.cs @@ -17,19 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class DeleteJobResponse : ElasticsearchResponse +internal sealed partial class DeleteJobResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropTaskFailures = System.Text.Json.JsonEncodedText.Encode("task_failures"); + + public override Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue?> propTaskFailures = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propTaskFailures.TryReadProperty(ref reader, options, PropTaskFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + TaskFailures = propTaskFailures.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropTaskFailures, value.TaskFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponseConverter))] +public sealed partial class DeleteJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } - [JsonInclude, JsonPropertyName("task_failures")] - public IReadOnlyCollection? TaskFailures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } + public System.Collections.Generic.IReadOnlyCollection? TaskFailures { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsRequest.g.cs index fdf23d38c7e..b11c4618365 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetJobsRequestParameters : RequestParameters +public sealed partial class GetJobsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetJobsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get rollup job information. @@ -45,23 +67,43 @@ public sealed partial class GetJobsRequestParameters : RequestParameters /// For details about a historical rollup job, the rollup capabilities API may be more useful. /// /// -public sealed partial class GetJobsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestConverter))] +public sealed partial class GetJobsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetJobsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetJobsRequest() { } - - public GetJobsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetJobsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetJobs; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupGetJobs; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "rollup.get_jobs"; + + /// + /// + /// Identifier for the rollup job. + /// If it is _all or omitted, the API returns all rollup jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } } /// @@ -75,75 +117,93 @@ public GetJobsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Option /// For details about a historical rollup job, the rollup capabilities API may be more useful. /// /// -public sealed partial class GetJobsRequestDescriptor : RequestDescriptor, GetJobsRequestParameters> +public readonly partial struct GetJobsRequestDescriptor { - internal GetJobsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest Instance { get; init; } - public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest instance) { + Instance = instance; } - public GetJobsRequestDescriptor() + public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetJobs; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public GetJobsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rollup.get_jobs"; - - public GetJobsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Identifier for the rollup job. + /// If it is _all or omitted, the API returns all rollup jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Get rollup job information. -/// Get the configuration, stats, and status of rollup jobs. -/// -/// -/// NOTE: This API returns only active (both STARTED and STOPPED) jobs. -/// If a job was created, ran for a while, then was deleted, the API does not return any details about it. -/// For details about a historical rollup job, the rollup capabilities API may be more useful. -/// -/// -public sealed partial class GetJobsRequestDescriptor : RequestDescriptor -{ - internal GetJobsRequestDescriptor(Action configure) => configure.Invoke(this); - - public GetJobsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - public GetJobsRequestDescriptor() + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetJobs; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "rollup.get_jobs"; + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetJobsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsResponse.g.cs index 94884fe565a..75f70561780 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetJobsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetJobsResponse : ElasticsearchResponse +internal sealed partial class GetJobsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("jobs")] - public IReadOnlyCollection Jobs { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropJobs = System.Text.Json.JsonEncodedText.Encode("jobs"); + + public override Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propJobs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propJobs.TryReadProperty(ref reader, options, PropJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Jobs = propJobs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropJobs, value.Jobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetJobsResponseConverter))] +public sealed partial class GetJobsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetJobsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetJobsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Jobs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsRequest.g.cs index 7da32db36d5..7a7a58d7bbd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetRollupCapsRequestParameters : RequestParameters +public sealed partial class GetRollupCapsRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetRollupCapsRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -57,23 +79,43 @@ public sealed partial class GetRollupCapsRequestParameters : RequestParameters /// /// /// -public sealed partial class GetRollupCapsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestConverter))] +public sealed partial class GetRollupCapsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + { + } +#if NET7_0_OR_GREATER public GetRollupCapsRequest() { } - - public GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) +#endif +#if !NET7_0_OR_GREATER + public GetRollupCapsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupCaps; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupGetRollupCaps; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "rollup.get_rollup_caps"; + + /// + /// + /// Index, indices or index-pattern to return rollup capabilities for. + /// _all may be used to fetch rollup capabilities from all jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } } /// @@ -99,87 +141,93 @@ public GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r. /// /// /// -public sealed partial class GetRollupCapsRequestDescriptor : RequestDescriptor, GetRollupCapsRequestParameters> +public readonly partial struct GetRollupCapsRequestDescriptor { - internal GetRollupCapsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest Instance { get; init; } - public GetRollupCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRollupCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest instance) { + Instance = instance; } - public GetRollupCapsRequestDescriptor() + public GetRollupCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(id); } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupCaps; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public GetRollupCapsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "rollup.get_rollup_caps"; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor descriptor) => descriptor.Instance; - public GetRollupCapsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// Index, indices or index-pattern to return rollup capabilities for. + /// _all may be used to fetch rollup capabilities from all jobs. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Get the rollup job capabilities. -/// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. -/// -/// -/// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. -/// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. -/// This API enables you to inspect an index and determine: -/// -/// -/// -/// -/// Does this index have associated rollup data somewhere in the cluster? -/// -/// -/// -/// -/// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? -/// -/// -/// -/// -public sealed partial class GetRollupCapsRequestDescriptor : RequestDescriptor -{ - internal GetRollupCapsRequestDescriptor(Action configure) => configure.Invoke(this); - - public GetRollupCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id)) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - public GetRollupCapsRequestDescriptor() + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor FilterPath(params string[]? value) { + Instance.FilterPath = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupCaps; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "rollup.get_rollup_caps"; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRollupCapsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsResponse.g.cs index 1e293a90e10..5bae50396f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupCapsResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetRollupCapsResponse : DictionaryResponse +internal sealed partial class GetRollupCapsResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetRollupCapsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Capabilities = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetRollupCapsResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Capabilities, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponseConverter))] +public sealed partial class GetRollupCapsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRollupCapsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRollupCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Capabilities { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsRequest.g.cs index f9e818a1e27..a4c30f191db 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetRollupIndexCapsRequestParameters : RequestParameters +public sealed partial class GetRollupIndexCapsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRollupIndexCapsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the rollup index capabilities. @@ -53,19 +75,43 @@ public sealed partial class GetRollupIndexCapsRequestParameters : RequestParamet /// /// /// -public sealed partial class GetRollupIndexCapsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestConverter))] +public sealed partial class GetRollupIndexCapsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Ids index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public GetRollupIndexCapsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupIndexCaps; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupGetRollupIndexCaps; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "rollup.get_rollup_index_caps"; + + /// + /// + /// Data stream or index to check for rollup capabilities. + /// Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Index { get => P("index"); set => PR("index", value); } } /// @@ -87,75 +133,89 @@ public GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Ids index) : base /// /// /// -public sealed partial class GetRollupIndexCapsRequestDescriptor : RequestDescriptor, GetRollupIndexCapsRequestParameters> +public readonly partial struct GetRollupIndexCapsRequestDescriptor { - internal GetRollupIndexCapsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest Instance { get; init; } - public GetRollupIndexCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRollupIndexCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupIndexCaps; + public GetRollupIndexCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids index) + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest(index); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetRollupIndexCapsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rollup.get_rollup_index_caps"; - - public GetRollupIndexCapsRequestDescriptor Index(Elastic.Clients.Elasticsearch.Ids index) + /// + /// + /// Data stream or index to check for rollup capabilities. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor Index(Elastic.Clients.Elasticsearch.Ids value) { - RouteValues.Required("index", index); - return Self; + Instance.Index = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Get the rollup index capabilities. -/// Get the rollup capabilities of all jobs inside of a rollup index. -/// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: -/// -/// -/// -/// -/// What jobs are stored in an index (or indices specified via a pattern)? -/// -/// -/// -/// -/// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? -/// -/// -/// -/// -public sealed partial class GetRollupIndexCapsRequestDescriptor : RequestDescriptor -{ - internal GetRollupIndexCapsRequestDescriptor(Action configure) => configure.Invoke(this); - public GetRollupIndexCapsRequestDescriptor(Elastic.Clients.Elasticsearch.Ids index) : base(r => r.Required("index", index)) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupGetRollupIndexCaps; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "rollup.get_rollup_index_caps"; + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRollupIndexCapsRequestDescriptor Index(Elastic.Clients.Elasticsearch.Ids index) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("index", index); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsResponse.g.cs index f333279bdc4..3f5336c51c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/GetRollupIndexCapsResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class GetRollupIndexCapsResponse : DictionaryResponse +internal sealed partial class GetRollupIndexCapsResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetRollupIndexCapsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Capabilities = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetRollupIndexCapsResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Capabilities, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponseConverter))] +public sealed partial class GetRollupIndexCapsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRollupIndexCapsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRollupIndexCapsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Capabilities { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobRequest.g.cs index 32ac6dc9b6b..0291901e458 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobRequest.g.cs @@ -17,21 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class PutJobRequestParameters : RequestParameters +public sealed partial class PutJobRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutJobRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCron = System.Text.Json.JsonEncodedText.Encode("cron"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPattern = System.Text.Json.JsonEncodedText.Encode("index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropPageSize = System.Text.Json.JsonEncodedText.Encode("page_size"); + private static readonly System.Text.Json.JsonEncodedText PropRollupIndex = System.Text.Json.JsonEncodedText.Encode("rollup_index"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.Rollup.PutJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCron = default; + LocalJsonValue propGroups = default; + LocalJsonValue>?> propHeaders = default; + LocalJsonValue propIndexPattern = default; + LocalJsonValue?> propMetrics = default; + LocalJsonValue propPageSize = default; + LocalJsonValue propRollupIndex = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCron.TryReadProperty(ref reader, options, PropCron, null)) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propIndexPattern.TryReadProperty(ref reader, options, PropIndexPattern, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPageSize.TryReadProperty(ref reader, options, PropPageSize, null)) + { + continue; + } + + if (propRollupIndex.TryReadProperty(ref reader, options, PropRollupIndex, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cron = propCron.Value, + Groups = propGroups.Value, + Headers = propHeaders.Value, + IndexPattern = propIndexPattern.Value, + Metrics = propMetrics.Value, + PageSize = propPageSize.Value, + RollupIndex = propRollupIndex.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.PutJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCron, value.Cron, null, null); + writer.WriteProperty(options, PropGroups, value.Groups, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropIndexPattern, value.IndexPattern, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPageSize, value.PageSize, null, null); + writer.WriteProperty(options, PropRollupIndex, value.RollupIndex, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } } /// @@ -51,20 +146,58 @@ public sealed partial class PutJobRequestParameters : RequestParameters /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. /// /// -public sealed partial class PutJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.PutJobRequestConverter))] +public sealed partial class PutJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupPutJob; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequest(Elastic.Clients.Elasticsearch.Id id, string cron, Elastic.Clients.Elasticsearch.Rollup.Groupings groups, string indexPattern, int pageSize, Elastic.Clients.Elasticsearch.IndexName rollupIndex) : base(r => r.Required("id", id)) + { + Cron = cron; + Groups = groups; + IndexPattern = indexPattern; + PageSize = pageSize; + RollupIndex = rollupIndex; + } +#if NET7_0_OR_GREATER + public PutJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupPutJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "rollup.put_job"; + /// + /// + /// Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the + /// data that is associated with the rollup job. The ID is persistent; it is stored with the rolled + /// up data. If you create a job, let it run for a while, then delete the job, the data that the job + /// rolled up is still be associated with this job ID. You cannot create a new job with the same ID + /// since that could lead to problems with mismatched job configurations. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// A cron string which defines the intervals when the rollup job should be executed. When the interval @@ -74,8 +207,11 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// cron pattern is defined just like a Watcher cron schedule. /// /// - [JsonInclude, JsonPropertyName("cron")] - public string Cron { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Cron { get; set; } /// /// @@ -86,10 +222,12 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. /// /// - [JsonInclude, JsonPropertyName("groups")] - public Elastic.Clients.Elasticsearch.Rollup.Groupings Groups { get; set; } - [JsonInclude, JsonPropertyName("headers")] - public IDictionary>>? Headers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.Groupings Groups { get; set; } + public System.Collections.Generic.IDictionary>? Headers { get; set; } /// /// @@ -97,8 +235,11 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// rollup the entire index or index-pattern. /// /// - [JsonInclude, JsonPropertyName("index_pattern")] - public string IndexPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexPattern { get; set; } /// /// @@ -107,8 +248,7 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// on a per-field basis and for each field you configure which metric should be collected. /// /// - [JsonInclude, JsonPropertyName("metrics")] - public ICollection? Metrics { get; set; } + public System.Collections.Generic.ICollection? Metrics { get; set; } /// /// @@ -117,23 +257,28 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// rolled up; it is merely used for tweaking the speed or memory cost of the indexer. /// /// - [JsonInclude, JsonPropertyName("page_size")] - public int PageSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int PageSize { get; set; } /// /// /// The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs. /// /// - [JsonInclude, JsonPropertyName("rollup_index")] - public Elastic.Clients.Elasticsearch.IndexName RollupIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName RollupIndex { get; set; } /// /// /// Time to wait for the request to complete. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } @@ -154,42 +299,47 @@ public PutJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. /// /// -public sealed partial class PutJobRequestDescriptor : RequestDescriptor, PutJobRequestParameters> +public readonly partial struct PutJobRequestDescriptor { - internal PutJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.PutJobRequest Instance { get; init; } - public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupPutJob; + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(id); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rollup.put_job"; - - public PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the + /// data that is associated with the rollup job. The ID is persistent; it is stored with the rolled + /// up data. If you create a job, let it run for a while, then delete the job, the data that the job + /// rolled up is still be associated with this job ID. You cannot create a new job with the same ID + /// since that could lead to problems with mismatched job configurations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private string CronValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.Groupings GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor GroupsDescriptor { get; set; } - private Action> GroupsDescriptorAction { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private string IndexPatternValue { get; set; } - private ICollection? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor MetricsDescriptor { get; set; } - private Action> MetricsDescriptorAction { get; set; } - private Action>[] MetricsDescriptorActions { get; set; } - private int PageSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName RollupIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// A cron string which defines the intervals when the rollup job should be executed. When the interval @@ -199,10 +349,55 @@ public PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id /// cron pattern is defined just like a Watcher cron schedule. /// /// - public PutJobRequestDescriptor Cron(string cron) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Cron(string value) + { + Instance.Cron = value; + return this; + } + + /// + /// + /// Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be + /// available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of + /// the groups configuration as defining a set of tools that can later be used in aggregations to partition the + /// data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide + /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.Groupings value) + { + Instance.Groups = value; + return this; + } + + /// + /// + /// Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be + /// available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of + /// the groups configuration as defining a set of tools that can later be used in aggregations to partition the + /// data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide + /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups() + { + Instance.Groups = Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be + /// available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of + /// the groups configuration as defining a set of tools that can later be used in aggregations to partition the + /// data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide + /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups(System.Action? action) { - CronValue = cron; - return Self; + Instance.Groups = Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor.Build(action); + return this; } /// @@ -214,34 +409,42 @@ public PutJobRequestDescriptor Cron(string cron) /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. /// /// - public PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.Groupings groups) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups(System.Action>? action) { - GroupsDescriptor = null; - GroupsDescriptorAction = null; - GroupsValue = groups; - return Self; + Instance.Groups = Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) { - GroupsValue = null; - GroupsDescriptorAction = null; - GroupsDescriptor = descriptor; - return Self; + Instance.Headers = value; + return this; } - public PutJobRequestDescriptor Groups(Action> configure) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers() { - GroupsValue = null; - GroupsDescriptor = null; - GroupsDescriptorAction = configure; - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; } - public PutJobRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers(System.Action? action) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor AddHeader(string key, params string[] values) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -250,10 +453,10 @@ public PutJobRequestDescriptor Headers(Func /// - public PutJobRequestDescriptor IndexPattern(string indexPattern) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor IndexPattern(string value) { - IndexPatternValue = indexPattern; - return Self; + Instance.IndexPattern = value; + return this; } /// @@ -263,40 +466,61 @@ public PutJobRequestDescriptor IndexPattern(string indexPattern) /// on a per-field basis and for each field you configure which metric should be collected. /// /// - public PutJobRequestDescriptor Metrics(ICollection? metrics) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(System.Collections.Generic.ICollection? value) { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsValue = metrics; - return Self; + Instance.Metrics = value; + return this; } - public PutJobRequestDescriptor Metrics(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor descriptor) + /// + /// + /// Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each + /// group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined + /// on a per-field basis and for each field you configure which metric should be collected. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(params Elastic.Clients.Elasticsearch.Rollup.FieldMetric[] values) { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsDescriptor = descriptor; - return Self; + Instance.Metrics = [.. values]; + return this; } - public PutJobRequestDescriptor Metrics(Action> configure) + /// + /// + /// Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each + /// group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined + /// on a per-field basis and for each field you configure which metric should be collected. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(params System.Action[] actions) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorActions = null; - MetricsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor.Build(action)); + } + + Instance.Metrics = items; + return this; } - public PutJobRequestDescriptor Metrics(params Action>[] configure) + /// + /// + /// Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each + /// group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined + /// on a per-field basis and for each field you configure which metric should be collected. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(params System.Action>[] actions) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor.Build(action)); + } + + Instance.Metrics = items; + return this; } /// @@ -306,10 +530,10 @@ public PutJobRequestDescriptor Metrics(params Action /// - public PutJobRequestDescriptor PageSize(int pageSize) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor PageSize(int value) { - PageSizeValue = pageSize; - return Self; + Instance.PageSize = value; + return this; } /// @@ -317,10 +541,10 @@ public PutJobRequestDescriptor PageSize(int pageSize) /// The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs. /// /// - public PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsearch.IndexName rollupIndex) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsearch.IndexName value) { - RollupIndexValue = rollupIndex; - return Self; + Instance.RollupIndex = value; + return this; } /// @@ -328,83 +552,60 @@ public PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsea /// Time to wait for the request to complete. /// /// - public PutJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.PutJobRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("cron"); - writer.WriteStringValue(CronValue); - if (GroupsDescriptor is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsDescriptor, options); - } - else if (GroupsDescriptorAction is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(GroupsDescriptorAction), options); - } - else - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("index_pattern"); - writer.WriteStringValue(IndexPatternValue); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - writer.WriteEndArray(); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(MetricsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (MetricsDescriptorActions is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - foreach (var action in MetricsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WritePropertyName("page_size"); - writer.WriteNumberValue(PageSizeValue); - writer.WritePropertyName("rollup_index"); - JsonSerializer.Serialize(writer, RollupIndexValue, options); - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -425,42 +626,47 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. /// /// -public sealed partial class PutJobRequestDescriptor : RequestDescriptor +public readonly partial struct PutJobRequestDescriptor { - internal PutJobRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.PutJobRequest Instance { get; init; } - public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupPutJob; + public PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(id); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rollup.put_job"; - - public PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the + /// data that is associated with the rollup job. The ID is persistent; it is stored with the rolled + /// up data. If you create a job, let it run for a while, then delete the job, the data that the job + /// rolled up is still be associated with this job ID. You cannot create a new job with the same ID + /// since that could lead to problems with mismatched job configurations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private string CronValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.Groupings GroupsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor GroupsDescriptor { get; set; } - private Action GroupsDescriptorAction { get; set; } - private IDictionary>>? HeadersValue { get; set; } - private string IndexPatternValue { get; set; } - private ICollection? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Action[] MetricsDescriptorActions { get; set; } - private int PageSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName RollupIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - /// /// /// A cron string which defines the intervals when the rollup job should be executed. When the interval @@ -470,10 +676,10 @@ public PutJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// cron pattern is defined just like a Watcher cron schedule. /// /// - public PutJobRequestDescriptor Cron(string cron) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Cron(string value) { - CronValue = cron; - return Self; + Instance.Cron = value; + return this; } /// @@ -485,34 +691,72 @@ public PutJobRequestDescriptor Cron(string cron) /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. /// /// - public PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.Groupings groups) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.Groupings value) { - GroupsDescriptor = null; - GroupsDescriptorAction = null; - GroupsValue = groups; - return Self; + Instance.Groups = value; + return this; } - public PutJobRequestDescriptor Groups(Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor descriptor) + /// + /// + /// Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be + /// available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of + /// the groups configuration as defining a set of tools that can later be used in aggregations to partition the + /// data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide + /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups() { - GroupsValue = null; - GroupsDescriptorAction = null; - GroupsDescriptor = descriptor; - return Self; + Instance.Groups = Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor.Build(null); + return this; } - public PutJobRequestDescriptor Groups(Action configure) + /// + /// + /// Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be + /// available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of + /// the groups configuration as defining a set of tools that can later be used in aggregations to partition the + /// data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide + /// enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Groups(System.Action>? action) { - GroupsValue = null; - GroupsDescriptor = null; - GroupsDescriptorAction = configure; - return Self; + Instance.Groups = Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor.Build(action); + return this; } - public PutJobRequestDescriptor Headers(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers(System.Collections.Generic.IDictionary>? value) { - HeadersValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Headers = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers() + { + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Headers(System.Action? action) + { + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor AddHeader(string key, System.Collections.Generic.ICollection value) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor AddHeader(string key, params string[] values) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary>(); + Instance.Headers.Add(key, [.. values]); + return this; } /// @@ -521,10 +765,10 @@ public PutJobRequestDescriptor Headers(Func /// - public PutJobRequestDescriptor IndexPattern(string indexPattern) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor IndexPattern(string value) { - IndexPatternValue = indexPattern; - return Self; + Instance.IndexPattern = value; + return this; } /// @@ -534,40 +778,42 @@ public PutJobRequestDescriptor IndexPattern(string indexPattern) /// on a per-field basis and for each field you configure which metric should be collected. /// /// - public PutJobRequestDescriptor Metrics(ICollection? metrics) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(System.Collections.Generic.ICollection? value) { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsValue = metrics; - return Self; + Instance.Metrics = value; + return this; } - public PutJobRequestDescriptor Metrics(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor descriptor) + /// + /// + /// Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each + /// group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined + /// on a per-field basis and for each field you configure which metric should be collected. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(params Elastic.Clients.Elasticsearch.Rollup.FieldMetric[] values) { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsDescriptor = descriptor; - return Self; + Instance.Metrics = [.. values]; + return this; } - public PutJobRequestDescriptor Metrics(Action configure) + /// + /// + /// Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each + /// group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined + /// on a per-field basis and for each field you configure which metric should be collected. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Metrics(params System.Action>[] actions) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorActions = null; - MetricsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor.Build(action)); + } - public PutJobRequestDescriptor Metrics(params Action[] configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = configure; - return Self; + Instance.Metrics = items; + return this; } /// @@ -577,10 +823,10 @@ public PutJobRequestDescriptor Metrics(params Action /// - public PutJobRequestDescriptor PageSize(int pageSize) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor PageSize(int value) { - PageSizeValue = pageSize; - return Self; + Instance.PageSize = value; + return this; } /// @@ -588,10 +834,10 @@ public PutJobRequestDescriptor PageSize(int pageSize) /// The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs. /// /// - public PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsearch.IndexName rollupIndex) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsearch.IndexName value) { - RollupIndexValue = rollupIndex; - return Self; + Instance.RollupIndex = value; + return this; } /// @@ -599,82 +845,59 @@ public PutJobRequestDescriptor RollupIndex(Elastic.Clients.Elasticsearch.IndexNa /// Time to wait for the request to complete. /// /// - public PutJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.PutJobRequest Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("cron"); - writer.WriteStringValue(CronValue); - if (GroupsDescriptor is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsDescriptor, options); - } - else if (GroupsDescriptorAction is not null) - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(GroupsDescriptorAction), options); - } - else - { - writer.WritePropertyName("groups"); - JsonSerializer.Serialize(writer, GroupsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.PutJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("index_pattern"); - writer.WriteStringValue(IndexPatternValue); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - writer.WriteEndArray(); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(MetricsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (MetricsDescriptorActions is not null) - { - writer.WritePropertyName("metrics"); - writer.WriteStartArray(); - foreach (var action in MetricsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WritePropertyName("page_size"); - writer.WriteNumberValue(PageSizeValue); - writer.WritePropertyName("rollup_index"); - JsonSerializer.Serialize(writer, RollupIndexValue, options); - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobResponse.g.cs index 4182c776136..b092088cab0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/PutJobResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class PutJobResponse : ElasticsearchResponse +internal sealed partial class PutJobResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Rollup.PutJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.PutJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.PutJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.PutJobResponseConverter))] +public sealed partial class PutJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchRequest.g.cs index e81b3267e9e..905105bc74f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class RollupSearchRequestParameters : RequestParameters +public sealed partial class RollupSearchRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,62 +40,60 @@ public sealed partial class RollupSearchRequestParameters : RequestParameters public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } -internal sealed partial class RollupSearchRequestConverter : JsonConverter +internal sealed partial class RollupSearchRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override RollupSearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new RollupSearchRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propQuery = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "size") - { - variant.Size = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, RollupSearchRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Size.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(value.Size.Value); - } + Aggregations = propAggregations.Value, + Query = propQuery.Value, + Size = propSize.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); writer.WriteEndObject(); } } @@ -161,31 +152,71 @@ public override void Write(Utf8JsonWriter writer, RollupSearchRequest value, Jso /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. /// /// -[JsonConverter(typeof(RollupSearchRequestConverter))] -public sealed partial class RollupSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestConverter))] +public sealed partial class RollupSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RollupSearchRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } - +#if NET7_0_OR_GREATER public RollupSearchRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupRollupSearch; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupRollupSearch; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "rollup.rollup_search"; + /// + /// + /// A comma-separated list of data streams and indices used to limit the request. + /// This parameter has the following rules: + /// + /// + /// + /// + /// At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using _all are not permitted. + /// + /// + /// + /// + /// Multiple non-rollup indices may be specified. + /// + /// + /// + /// + /// Only one rollup index may be specified. If more than one are supplied, an exception occurs. + /// + /// + /// + /// + /// Wildcard expressions (*) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams. + /// + /// + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -193,7 +224,6 @@ public RollupSearchRequest() /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -201,15 +231,13 @@ public RollupSearchRequest() /// Specifies aggregations. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// /// Specifies a DSL query that is subject to some limitations. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -217,7 +245,6 @@ public RollupSearchRequest() /// Must be zero if set, as rollups work on pre-aggregated data. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } } @@ -275,50 +302,149 @@ public RollupSearchRequest() /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. /// /// -public sealed partial class RollupSearchRequestDescriptor : RequestDescriptor, RollupSearchRequestParameters> +public readonly partial struct RollupSearchRequestDescriptor { - internal RollupSearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest Instance { get; init; } - public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest instance) { + Instance = instance; } - public RollupSearchRequestDescriptor() : this(typeof(TDocument)) + public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupRollupSearch; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RollupSearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// A comma-separated list of data streams and indices used to limit the request. + /// This parameter has the following rules: + /// + /// + /// + /// + /// At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using _all are not permitted. + /// + /// + /// + /// + /// Multiple non-rollup indices may be specified. + /// + /// + /// + /// + /// Only one rollup index may be specified. If more than one are supplied, an exception occurs. + /// + /// + /// + /// + /// Wildcard expressions (*) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "rollup.rollup_search"; + /// + /// + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } + + /// + /// + /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - public RollupSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public RollupSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// Specifies aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } - public RollupSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Specifies aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations() { - RouteValues.Required("index", indices); - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private int? SizeValue { get; set; } + /// + /// + /// Specifies aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } /// /// /// Specifies aggregations. /// /// - public RollupSearchRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -326,28 +452,32 @@ public RollupSearchRequestDescriptor Aggregations(Func /// - public RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies a DSL query that is subject to some limitations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RollupSearchRequestDescriptor Query(Action> configure) + /// + /// + /// Specifies a DSL query that is subject to some limitations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -355,44 +485,60 @@ public RollupSearchRequestDescriptor Query(Action /// - public RollupSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -450,75 +596,152 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. /// /// -public sealed partial class RollupSearchRequestDescriptor : RequestDescriptor +public readonly partial struct RollupSearchRequestDescriptor { - internal RollupSearchRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest Instance { get; init; } - public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupRollupSearch; + public RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(indices); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RollupSearchRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(typeof(TDocument)); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "rollup.rollup_search"; + /// + /// + /// A comma-separated list of data streams and indices used to limit the request. + /// This parameter has the following rules: + /// + /// + /// + /// + /// At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using _all are not permitted. + /// + /// + /// + /// + /// Multiple non-rollup indices may be specified. + /// + /// + /// + /// + /// Only one rollup index may be specified. If more than one are supplied, an exception occurs. + /// + /// + /// + /// + /// Wildcard expressions (*) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - public RollupSearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public RollupSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } - public RollupSearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Specify whether aggregation and suggester names should be prefixed by their respective types in the response + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor TypedKeys(bool? value = true) { - RouteValues.Required("index", indices); - return Self; + Instance.TypedKeys = value; + return this; } - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private int? SizeValue { get; set; } + /// + /// + /// Specifies aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } /// /// /// Specifies aggregations. /// /// - public RollupSearchRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations() { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } /// /// - /// Specifies a DSL query that is subject to some limitations. + /// Specifies aggregations. /// /// - public RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor AddAggregation(string key, System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } - public RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies a DSL query that is subject to some limitations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public RollupSearchRequestDescriptor Query(Action configure) + /// + /// + /// Specifies a DSL query that is subject to some limitations. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -526,43 +749,59 @@ public RollupSearchRequestDescriptor Query(Action /// - public RollupSearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchResponse.g.cs index 16d3e49bdad..b814d9d470e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/RollupSearchResponse.g.cs @@ -17,27 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class RollupSearchResponse : ElasticsearchResponse +internal sealed partial class RollupSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue> propHits = default; + LocalJsonValue propShards = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Hits = propHits.Value, + Shards = propShards.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class RollupSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(RollupSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(RollupSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponseConverterFactory))] +public sealed partial class RollupSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public bool? TerminatedEarly { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +bool TimedOut { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobRequest.g.cs index d5cfcc92559..877d09d1a95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class StartJobRequestParameters : RequestParameters +public sealed partial class StartJobRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class StartJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Rollup.StartJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.StartJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.StartJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start rollup jobs. @@ -41,19 +63,42 @@ public sealed partial class StartJobRequestParameters : RequestParameters /// If you try to start a job that is already started, nothing happens. /// /// -public sealed partial class StartJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.StartJobRequestConverter))] +public sealed partial class StartJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StartJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public StartJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStartJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupStartJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "rollup.start_job"; + + /// + /// + /// Identifier for the rollup job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -63,63 +108,88 @@ public StartJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requir /// If you try to start a job that is already started, nothing happens. /// /// -public sealed partial class StartJobRequestDescriptor : RequestDescriptor, StartJobRequestParameters> +public readonly partial struct StartJobRequestDescriptor { - internal StartJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.StartJobRequest Instance { get; init; } - public StartJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.StartJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStartJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public StartJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StartJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "rollup.start_job"; + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.StartJobRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.StartJobRequest(Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor descriptor) => descriptor.Instance; - public StartJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the rollup job. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.StartJobRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.StartJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Start rollup jobs. -/// If you try to start a job that does not exist, an exception occurs. -/// If you try to start a job that is already started, nothing happens. -/// -/// -public sealed partial class StartJobRequestDescriptor : RequestDescriptor -{ - internal StartJobRequestDescriptor(Action configure) => configure.Invoke(this); - public StartJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStartJob; + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "rollup.start_job"; + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StartJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobResponse.g.cs index 1d6d05f4ff7..d57989297ea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StartJobResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class StartJobResponse : ElasticsearchResponse +internal sealed partial class StartJobResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("started")] - public bool Started { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropStarted = System.Text.Json.JsonEncodedText.Encode("started"); + + public override Elastic.Clients.Elasticsearch.Rollup.StartJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStarted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStarted.TryReadProperty(ref reader, options, PropStarted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.StartJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Started = propStarted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.StartJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStarted, value.Started, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.StartJobResponseConverter))] +public sealed partial class StartJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Started { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobRequest.g.cs index ae55889760a..e88fd70c382 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class StopJobRequestParameters : RequestParameters +public sealed partial class StopJobRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,6 +44,35 @@ public sealed partial class StopJobRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class StopJobRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Rollup.StopJobRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.StopJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.StopJobRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop rollup jobs. @@ -69,20 +91,43 @@ public sealed partial class StopJobRequestParameters : RequestParameters /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. /// /// -public sealed partial class StopJobRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.StopJobRequestConverter))] +public sealed partial class StopJobRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StopJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public StopJobRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStopJob; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.RollupStopJob; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "rollup.stop_job"; + /// + /// + /// Identifier for the rollup job. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// If wait_for_completion is true, the API blocks for (at maximum) the specified duration while waiting for the job to stop. @@ -91,7 +136,6 @@ public StopJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Require /// The timeout simply means the API call itself timed out while waiting for the status change. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -100,7 +144,6 @@ public StopJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Require /// If set to false, the API returns immediately and the indexer is stopped asynchronously in the background. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -122,80 +165,114 @@ public StopJobRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Require /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. /// /// -public sealed partial class StopJobRequestDescriptor : RequestDescriptor, StopJobRequestParameters> +public readonly partial struct StopJobRequestDescriptor { - internal StopJobRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.StopJobRequest Instance { get; init; } - public StopJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.StopJobRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStopJob; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => false; + public StopJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequest(id); + } - internal override string OperationName => "rollup.stop_job"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StopJobRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public StopJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public StopJobRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(Elastic.Clients.Elasticsearch.Rollup.StopJobRequest instance) => new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.StopJobRequest(Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor descriptor) => descriptor.Instance; - public StopJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// Identifier for the rollup job. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If wait_for_completion is true, the API blocks for (at maximum) the specified duration while waiting for the job to stop. + /// If more than timeout time has passed, the API throws a timeout exception. + /// NOTE: Even if a timeout occurs, the stop request is still processing and eventually moves the job to STOPPED. + /// The timeout simply means the API call itself timed out while waiting for the status change. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.Timeout = value; + return this; } -} -/// -/// -/// Stop rollup jobs. -/// If you try to stop a job that does not exist, an exception occurs. -/// If you try to stop a job that is already stopped, nothing happens. -/// -/// -/// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. -/// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: -/// -/// -/// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s -/// -/// -/// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. -/// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. -/// -/// -public sealed partial class StopJobRequestDescriptor : RequestDescriptor -{ - internal StopJobRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// If set to true, causes the API to block until the indexer state completely stops. + /// If set to false, the API returns immediately and the indexer is stopped asynchronously in the background. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } - public StopJobRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.StopJobRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(new Elastic.Clients.Elasticsearch.Rollup.StopJobRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.RollupStopJob; + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "rollup.stop_job"; + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public StopJobRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public StopJobRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StopJobRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobResponse.g.cs index 9f696d586bc..7ac4c3b3384 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Rollup/StopJobResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public sealed partial class StopJobResponse : ElasticsearchResponse +internal sealed partial class StopJobResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopped")] - public bool Stopped { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.Rollup.StopJobResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStopped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopped.TryReadProperty(ref reader, options, PropStopped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.StopJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopped = propStopped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.StopJobResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopped, value.Stopped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.StopJobResponseConverter))] +public sealed partial class StopJobResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopJobResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopJobResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Stopped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteRequest.g.cs index ddf8dbfa7ec..ef7eda61322 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteRequest.g.cs @@ -17,34 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ScriptsPainlessExecuteRequestParameters : RequestParameters +public sealed partial class ScriptsPainlessExecuteRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ScriptsPainlessExecuteRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropContext = System.Text.Json.JsonEncodedText.Encode("context"); + private static readonly System.Text.Json.JsonEncodedText PropContextSetup = System.Text.Json.JsonEncodedText.Encode("context_setup"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propContext = default; + LocalJsonValue propContextSetup = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContext.TryReadProperty(ref reader, options, PropContext, null)) + { + continue; + } + + if (propContextSetup.TryReadProperty(ref reader, options, PropContextSetup, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Context = propContext.Value, + ContextSetup = propContextSetup.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContext, value.Context, null, null); + writer.WriteProperty(options, PropContextSetup, value.ContextSetup, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } } /// /// /// Run a script. +/// +/// /// Runs a script and returns a result. +/// Use this API to build and test scripts, such as when defining a script for a runtime field. +/// This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. +/// +/// +/// The API uses several contexts, which control how scripts are run, what variables are available at runtime, and what the return type is. +/// +/// +/// Each context requires a script, but additional parameters depend on the context you're using for that script. /// /// -public sealed partial class ScriptsPainlessExecuteRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestConverter))] +public sealed partial class ScriptsPainlessExecuteRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceScriptsPainlessExecute; +#if NET7_0_OR_GREATER + public ScriptsPainlessExecuteRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScriptsPainlessExecuteRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceScriptsPainlessExecute; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -53,312 +130,353 @@ public sealed partial class ScriptsPainlessExecuteRequest : PlainRequest /// /// The context that the script should run in. + /// NOTE: Result ordering in the field contexts is not guaranteed. /// /// - [JsonInclude, JsonPropertyName("context")] - public string? Context { get; set; } + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext? Context { get; set; } /// /// /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. /// /// - [JsonInclude, JsonPropertyName("context_setup")] public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? ContextSetup { get; set; } /// /// - /// The Painless script to execute. + /// The Painless script to run. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } } /// /// /// Run a script. +/// +/// /// Runs a script and returns a result. +/// Use this API to build and test scripts, such as when defining a script for a runtime field. +/// This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. +/// +/// +/// The API uses several contexts, which control how scripts are run, what variables are available at runtime, and what the return type is. +/// +/// +/// Each context requires a script, but additional parameters depend on the context you're using for that script. /// /// -public sealed partial class ScriptsPainlessExecuteRequestDescriptor : RequestDescriptor, ScriptsPainlessExecuteRequestParameters> +public readonly partial struct ScriptsPainlessExecuteRequestDescriptor { - internal ScriptsPainlessExecuteRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest Instance { get; init; } - public ScriptsPainlessExecuteRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptsPainlessExecuteRequestDescriptor(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceScriptsPainlessExecute; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "scripts_painless_execute"; + public ScriptsPainlessExecuteRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? ContextValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? ContextSetupValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor ContextSetupDescriptor { get; set; } - private Action> ContextSetupDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest instance) => new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The context that the script should run in. + /// NOTE: Result ordering in the field contexts is not guaranteed. /// /// - public ScriptsPainlessExecuteRequestDescriptor Context(string? context) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Context(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext? value) { - ContextValue = context; - return Self; + Instance.Context = value; + return this; } /// /// /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. /// /// - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? contextSetup) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? value) { - ContextSetupDescriptor = null; - ContextSetupDescriptorAction = null; - ContextSetupValue = contextSetup; - return Self; + Instance.ContextSetup = value; + return this; } - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor descriptor) + /// + /// + /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ContextSetup(System.Action action) { - ContextSetupValue = null; - ContextSetupDescriptorAction = null; - ContextSetupDescriptor = descriptor; - return Self; + Instance.ContextSetup = Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor.Build(action); + return this; } - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Action> configure) + /// + /// + /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ContextSetup(System.Action> action) { - ContextSetupValue = null; - ContextSetupDescriptor = null; - ContextSetupDescriptorAction = configure; - return Self; + Instance.ContextSetup = Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor.Build(action); + return this; } /// /// - /// The Painless script to execute. + /// The Painless script to run. /// /// - public ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The Painless script to run. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptsPainlessExecuteRequestDescriptor Script(Action configure) + /// + /// + /// The Painless script to run. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContextValue)) + if (action is null) { - writer.WritePropertyName("context"); - writer.WriteStringValue(ContextValue); + return new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ContextSetupDescriptor is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, ContextSetupDescriptor, options); - } - else if (ContextSetupDescriptorAction is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(ContextSetupDescriptorAction), options); - } - else if (ContextSetupValue is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, ContextSetupValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } /// /// /// Run a script. +/// +/// /// Runs a script and returns a result. +/// Use this API to build and test scripts, such as when defining a script for a runtime field. +/// This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster. +/// +/// +/// The API uses several contexts, which control how scripts are run, what variables are available at runtime, and what the return type is. +/// +/// +/// Each context requires a script, but additional parameters depend on the context you're using for that script. /// /// -public sealed partial class ScriptsPainlessExecuteRequestDescriptor : RequestDescriptor +public readonly partial struct ScriptsPainlessExecuteRequestDescriptor { - internal ScriptsPainlessExecuteRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest Instance { get; init; } - public ScriptsPainlessExecuteRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptsPainlessExecuteRequestDescriptor(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceScriptsPainlessExecute; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "scripts_painless_execute"; + public ScriptsPainlessExecuteRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? ContextValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? ContextSetupValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor ContextSetupDescriptor { get; set; } - private Action ContextSetupDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest instance) => new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The context that the script should run in. + /// NOTE: Result ordering in the field contexts is not guaranteed. /// /// - public ScriptsPainlessExecuteRequestDescriptor Context(string? context) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Context(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext? value) { - ContextValue = context; - return Self; + Instance.Context = value; + return this; } /// /// /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. /// /// - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? contextSetup) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup? value) { - ContextSetupDescriptor = null; - ContextSetupDescriptorAction = null; - ContextSetupValue = contextSetup; - return Self; + Instance.ContextSetup = value; + return this; } - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor descriptor) + /// + /// + /// Additional parameters for the context. + /// NOTE: This parameter is required for all contexts except painless_test, which is the default if no value is provided for context. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ContextSetup(System.Action> action) { - ContextSetupValue = null; - ContextSetupDescriptorAction = null; - ContextSetupDescriptor = descriptor; - return Self; + Instance.ContextSetup = Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor.Build(action); + return this; } - public ScriptsPainlessExecuteRequestDescriptor ContextSetup(Action configure) + /// + /// + /// The Painless script to run. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ContextSetupValue = null; - ContextSetupDescriptor = null; - ContextSetupDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } /// /// - /// The Painless script to execute. + /// The Painless script to run. /// /// - public ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptsPainlessExecuteRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The Painless script to run. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ScriptsPainlessExecuteRequestDescriptor Script(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest Build(System.Action>? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor ErrorTrace(bool? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContextValue)) - { - writer.WritePropertyName("context"); - writer.WriteStringValue(ContextValue); - } + Instance.ErrorTrace = value; + return this; + } - if (ContextSetupDescriptor is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, ContextSetupDescriptor, options); - } - else if (ContextSetupDescriptorAction is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(ContextSetupDescriptorAction), options); - } - else if (ContextSetupValue is not null) - { - writer.WritePropertyName("context_setup"); - JsonSerializer.Serialize(writer, ContextSetupValue, options); - } + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteResponse.g.cs index d2c5569f64c..91addfef83c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScriptsPainlessExecuteResponse.g.cs @@ -17,18 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ScriptsPainlessExecuteResponse : ElasticsearchResponse +internal sealed partial class ScriptsPainlessExecuteResponseConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResult.TryReadProperty(ref reader, options, PropResult, static TResult (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResult, value.Result, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TResult v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class ScriptsPainlessExecuteResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory { - [JsonInclude, JsonPropertyName("result")] - [SourceConverter] - public TResult Result { get; init; } + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(ScriptsPainlessExecuteResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(ScriptsPainlessExecuteResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponseConverterFactory))] +public sealed partial class ScriptsPainlessExecuteResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptsPainlessExecuteResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptsPainlessExecuteResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +TResult Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollRequest.g.cs index a2a70d0c5cd..b60a5508145 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ScrollRequestParameters : RequestParameters +public sealed partial class ScrollRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,54 @@ public sealed partial class ScrollRequestParameters : RequestParameters public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } } +internal sealed partial class ScrollRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScroll = System.Text.Json.JsonEncodedText.Encode("scroll"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("scroll_id"); + + public override Elastic.Clients.Elasticsearch.ScrollRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScroll = default; + LocalJsonValue propScrollId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScroll.TryReadProperty(ref reader, options, PropScroll, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Scroll = propScroll.Value, + ScrollId = propScrollId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScrollRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScroll, value.Scroll, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Run a scrolling search. @@ -62,11 +103,34 @@ public sealed partial class ScrollRequestParameters : RequestParameters /// IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests. /// /// -public sealed partial class ScrollRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScrollRequestConverter))] +public sealed partial class ScrollRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceScroll; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScrollRequest(Elastic.Clients.Elasticsearch.ScrollId scrollId) + { + ScrollId = scrollId; + } +#if NET7_0_OR_GREATER + public ScrollRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScrollRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceScroll; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -77,7 +141,6 @@ public sealed partial class ScrollRequest : PlainRequest /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -85,7 +148,6 @@ public sealed partial class ScrollRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("scroll")] public Elastic.Clients.Elasticsearch.Duration? Scroll { get; set; } /// @@ -93,8 +155,11 @@ public sealed partial class ScrollRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId ScrollId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ScrollId ScrollId { get; set; } } /// @@ -119,36 +184,44 @@ public sealed partial class ScrollRequest : PlainRequest /// -public sealed partial class ScrollRequestDescriptor : RequestDescriptor +public readonly partial struct ScrollRequestDescriptor { - internal ScrollRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScrollRequest Instance { get; init; } - public ScrollRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScrollRequestDescriptor(Elastic.Clients.Elasticsearch.ScrollRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceScroll; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "scroll"; + public ScrollRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ScrollRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); + public static explicit operator Elastic.Clients.Elasticsearch.ScrollRequestDescriptor(Elastic.Clients.Elasticsearch.ScrollRequest instance) => new Elastic.Clients.Elasticsearch.ScrollRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScrollRequest(Elastic.Clients.Elasticsearch.ScrollRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.Duration? ScrollValue { get; set; } - private Elastic.Clients.Elasticsearch.ScrollId ScrollIdValue { get; set; } + /// + /// + /// If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. + /// + /// + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } /// /// /// The period to retain the search context for scrolling. /// /// - public ScrollRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) { - ScrollValue = scroll; - return Self; + Instance.Scroll = value; + return this; } /// @@ -156,23 +229,59 @@ public ScrollRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? sc /// The scroll ID of the search. /// /// - public ScrollRequestDescriptor ScrollId(Elastic.Clients.Elasticsearch.ScrollId scrollId) + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor ScrollId(Elastic.Clients.Elasticsearch.ScrollId value) { - ScrollIdValue = scrollId; - return Self; + Instance.ScrollId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScrollRequest Build(System.Action action) { - writer.WriteStartObject(); - if (ScrollValue is not null) - { - writer.WritePropertyName("scroll"); - JsonSerializer.Serialize(writer, ScrollValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.ScrollRequestDescriptor(new Elastic.Clients.Elasticsearch.ScrollRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("scroll_id"); - JsonSerializer.Serialize(writer, ScrollIdValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScrollRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollResponse.g.cs index 9c67203c91f..0fca15c87ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ScrollResponse.g.cs @@ -17,39 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class ScrollResponse : ElasticsearchResponse +internal sealed partial class ScrollResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHitsMetadata = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.ScrollResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHitsMetadata = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHitsMetadata.TryReadProperty(ref reader, options, PropHitsMetadata, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScrollResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + HitsMetadata = propHitsMetadata.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScrollResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHitsMetadata, value.HitsMetadata, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class ScrollResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(ScrollResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(ScrollResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScrollResponseConverterFactory))] +public partial class ScrollResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScrollResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScrollResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// The returned documents and metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; set; } + public double? MaxScore { get; set; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } /// /// @@ -58,28 +236,31 @@ public sealed partial class ScrollResponse : ElasticsearchResponse /// This property is returned only if the scroll query parameter is specified in the request. /// /// - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } /// /// /// A count of shards used for the request. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } /// /// /// If true, the request timed out before completion; returned results may be partial or empty. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } /// /// @@ -125,6 +306,9 @@ public sealed partial class ScrollResponse : ElasticsearchResponse /// /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsRequest.g.cs index 0821769f39a..fdf18c5d431 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsRequest.g.cs @@ -17,42 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class DeleteBehavioralAnalyticsRequestParameters : RequestParameters +public sealed partial class DeleteBehavioralAnalyticsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteBehavioralAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a behavioral analytics collection. /// The associated data stream is also deleted. /// /// -public sealed partial class DeleteBehavioralAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestConverter))] +public sealed partial class DeleteBehavioralAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteBehavioralAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationDeleteBehavioralAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationDeleteBehavioralAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "search_application.delete_behavioral_analytics"; + + /// + /// + /// The name of the analytics collection to be deleted + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } } /// @@ -61,29 +106,88 @@ public DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Name name) /// The associated data stream is also deleted. /// /// -public sealed partial class DeleteBehavioralAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteBehavioralAnalyticsRequestDescriptor { - internal DeleteBehavioralAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest Instance { get; init; } - public DeleteBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationDeleteBehavioralAnalytics; + public DeleteBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteBehavioralAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.delete_behavioral_analytics"; + /// + /// + /// The name of the analytics collection to be deleted + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteBehavioralAnalyticsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsResponse.g.cs index 815097e6f70..d29b663848f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteBehavioralAnalyticsResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class DeleteBehavioralAnalyticsResponse : ElasticsearchResponse +internal sealed partial class DeleteBehavioralAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponseConverter))] +public sealed partial class DeleteBehavioralAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteBehavioralAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationRequest.g.cs index 3683272e428..bec17e58ad7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationRequest.g.cs @@ -17,73 +17,181 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class DeleteSearchApplicationRequestParameters : RequestParameters +public sealed partial class DeleteSearchApplicationRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteSearchApplicationRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Delete a search application. +/// +/// /// Remove a search application and its associated alias. Indices attached to the search application are not removed. /// /// -public sealed partial class DeleteSearchApplicationRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestConverter))] +public sealed partial class DeleteSearchApplicationRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteSearchApplicationRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteSearchApplicationRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "search_application.delete"; + + /// + /// + /// The name of the search application to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } } /// /// /// Delete a search application. +/// +/// /// Remove a search application and its associated alias. Indices attached to the search application are not removed. /// /// -public sealed partial class DeleteSearchApplicationRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteSearchApplicationRequestDescriptor { - internal DeleteSearchApplicationRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest Instance { get; init; } - public DeleteSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationDelete; + public DeleteSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteSearchApplicationRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.delete"; + /// + /// + /// The name of the search application to delete. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationResponse.g.cs index 25ab747e186..f6e50a1eddf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/DeleteSearchApplicationResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class DeleteSearchApplicationResponse : ElasticsearchResponse +internal sealed partial class DeleteSearchApplicationResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponseConverter))] +public sealed partial class DeleteSearchApplicationResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSearchApplicationResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsRequest.g.cs index 3032d656690..fe2e8d58ba9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsRequest.g.cs @@ -17,45 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class GetBehavioralAnalyticsRequestParameters : RequestParameters +public sealed partial class GetBehavioralAnalyticsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetBehavioralAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get behavioral analytics collections. /// /// -public sealed partial class GetBehavioralAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestConverter))] +public sealed partial class GetBehavioralAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetBehavioralAnalyticsRequest(System.Collections.Generic.ICollection? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetBehavioralAnalyticsRequest() { } - - public GetBehavioralAnalyticsRequest(IReadOnlyCollection? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetBehavioralAnalyticsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationGetBehavioralAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationGetBehavioralAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "search_application.get_behavioral_analytics"; + + /// + /// + /// A list of analytics collections to limit the returned information + /// + /// + public System.Collections.Generic.ICollection? Name { get => P?>("name"); set => PO("name", value); } } /// @@ -63,33 +104,103 @@ public GetBehavioralAnalyticsRequest(IReadOnlyCollection /// -public sealed partial class GetBehavioralAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct GetBehavioralAnalyticsRequestDescriptor { - internal GetBehavioralAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest Instance { get; init; } - public GetBehavioralAnalyticsRequestDescriptor(IReadOnlyCollection? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest instance) { + Instance = instance; + } + + public GetBehavioralAnalyticsRequestDescriptor(System.Collections.Generic.ICollection? name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(name); } public GetBehavioralAnalyticsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationGetBehavioralAnalytics; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A list of analytics collections to limit the returned information + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor Name(System.Collections.Generic.ICollection? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A list of analytics collections to limit the returned information + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor Name(params Elastic.Clients.Elasticsearch.Name[] values) + { + Instance.Name = [.. values]; + return this; + } - internal override string OperationName => "search_application.get_behavioral_analytics"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetBehavioralAnalyticsRequestDescriptor Name(IReadOnlyCollection? name) + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsResponse.g.cs index c6ce8351ec0..8915534a97e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetBehavioralAnalyticsResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class GetBehavioralAnalyticsResponse : DictionaryResponse +internal sealed partial class GetBehavioralAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetBehavioralAnalyticsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Analytics = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetBehavioralAnalyticsResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Analytics, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponseConverter))] +public sealed partial class GetBehavioralAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBehavioralAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Analytics { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationRequest.g.cs index e7342f567b8..dc9227780cc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationRequest.g.cs @@ -17,41 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class GetSearchApplicationRequestParameters : RequestParameters +public sealed partial class GetSearchApplicationRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetSearchApplicationRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get search application details. /// /// -public sealed partial class GetSearchApplicationRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestConverter))] +public sealed partial class GetSearchApplicationRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public GetSearchApplicationRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "search_application.get"; + + /// + /// + /// The name of the search application + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } } /// @@ -59,29 +104,88 @@ public GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.Name name) : ba /// Get search application details. /// /// -public sealed partial class GetSearchApplicationRequestDescriptor : RequestDescriptor +public readonly partial struct GetSearchApplicationRequestDescriptor { - internal GetSearchApplicationRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest Instance { get; init; } - public GetSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationGet; + public GetSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSearchApplicationRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.get"; + /// + /// + /// The name of the search application + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationResponse.g.cs index 13bcb8d5841..7cceb19d4de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/GetSearchApplicationResponse.g.cs @@ -17,54 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class GetSearchApplicationResponse : ElasticsearchResponse +internal sealed partial class GetSearchApplicationResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAnalyticsCollectionName = System.Text.Json.JsonEncodedText.Encode("analytics_collection_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropUpdatedAtMillis = System.Text.Json.JsonEncodedText.Encode("updated_at_millis"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyticsCollectionName = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propName = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propUpdatedAtMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyticsCollectionName.TryReadProperty(ref reader, options, PropAnalyticsCollectionName, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propUpdatedAtMillis.TryReadProperty(ref reader, options, PropUpdatedAtMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalyticsCollectionName = propAnalyticsCollectionName.Value, + Indices = propIndices.Value, + Name = propName.Value, + Template = propTemplate.Value, + UpdatedAtMillis = propUpdatedAtMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyticsCollectionName, value.AnalyticsCollectionName, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropUpdatedAtMillis, value.UpdatedAtMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponseConverter))] +public sealed partial class GetSearchApplicationResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSearchApplicationResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analytics collection associated to the Search Application. /// /// - [JsonInclude, JsonPropertyName("analytics_collection_name")] - public string? AnalyticsCollectionName { get; init; } + public string? AnalyticsCollectionName { get; set; } /// /// /// Indices that are part of the Search Application. /// /// - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } /// /// - /// Search Application name. + /// Search Application name /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// Search template to use on search operations. /// /// - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? Template { get; init; } + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? Template { get; set; } /// /// /// Last time the Search Application was updated. /// /// - [JsonInclude, JsonPropertyName("updated_at_millis")] - public long UpdatedAtMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset UpdatedAtMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListRequest.g.cs index b34b4602f13..2043562c720 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class ListRequestParameters : RequestParameters +public sealed partial class ListRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -54,17 +47,63 @@ public sealed partial class ListRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class ListRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.ListRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.ListRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get search applications. /// Get information about search applications. /// /// -public sealed partial class ListRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.ListRequestConverter))] +public sealed partial class ListRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationList; +#if NET7_0_OR_GREATER + public ListRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ListRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationList; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -75,7 +114,6 @@ public sealed partial class ListRequest : PlainRequest /// Starting offset. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -83,7 +121,6 @@ public sealed partial class ListRequest : PlainRequest /// Query in the Lucene query string syntax. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -91,7 +128,6 @@ public sealed partial class ListRequest : PlainRequest /// Specifies a max number of results to get. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -101,27 +137,109 @@ public sealed partial class ListRequest : PlainRequest /// Get information about search applications. /// /// -public sealed partial class ListRequestDescriptor : RequestDescriptor +public readonly partial struct ListRequestDescriptor { - internal ListRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.ListRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.ListRequest instance) + { + Instance = instance; + } public ListRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationList; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.ListRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.ListRequest(Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Starting offset. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } - internal override string OperationName => "search_application.list"; + /// + /// + /// Specifies a max number of results to get. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.ListRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchApplication.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ListRequestDescriptor From(int? from) => Qs("from", from); - public ListRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public ListRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListResponse.g.cs index 634f03fc463..d04b250717b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/ListResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class ListResponse : ElasticsearchResponse +internal sealed partial class ListResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropResults = System.Text.Json.JsonEncodedText.Encode("results"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.ListResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propResults.TryReadProperty(ref reader, options, PropResults, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.ListResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Results = propResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.ListResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropResults, value.Results, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.ListResponseConverter))] +public sealed partial class ListResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("results")] - public IReadOnlyCollection Results { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Results { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventRequest.g.cs index 7dc60d7ed16..3febbefd3b4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PostBehavioralAnalyticsEventRequestParameters : RequestParameters +public sealed partial class PostBehavioralAnalyticsEventRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,39 +33,90 @@ public sealed partial class PostBehavioralAnalyticsEventRequestParameters : Requ public bool? Debug { get => Q("debug"); set => Q("debug", value); } } +internal sealed partial class PostBehavioralAnalyticsEventRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Payload = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Payload, null); + } +} + /// /// /// Create a behavioral analytics collection event. /// /// -public sealed partial class PostBehavioralAnalyticsEventRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestConverter))] +public sealed partial class PostBehavioralAnalyticsEventRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) : base(r => r.Required("collection_name", collectionName).Required("event_type", eventType)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPostBehavioralAnalyticsEvent; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, object payload) : base(r => r.Required("collection_name", collectionName).Required("event_type", eventType)) + { + Payload = payload; + } +#if NET7_0_OR_GREATER + public PostBehavioralAnalyticsEventRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationPostBehavioralAnalyticsEvent; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search_application.post_behavioral_analytics_event"; + /// + /// + /// The name of the behavioral analytics collection. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name CollectionName { get => P("collection_name"); set => PR("collection_name", value); } + + /// + /// + /// The analytics event type. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SearchApplication.EventType EventType { get => P("event_type"); set => PR("event_type", value); } + /// /// /// Whether the response type has to include more details /// /// - [JsonIgnore] public bool? Debug { get => Q("debug"); set => Q("debug", value); } - [JsonIgnore] - public object Payload { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Payload, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + object Payload { get; set; } } /// @@ -80,46 +124,118 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Create a behavioral analytics collection event. /// /// -public sealed partial class PostBehavioralAnalyticsEventRequestDescriptor : RequestDescriptor +public readonly partial struct PostBehavioralAnalyticsEventRequestDescriptor { - internal PostBehavioralAnalyticsEventRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest Instance { get; init; } - public PostBehavioralAnalyticsEventRequestDescriptor(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) : base(r => r.Required("collection_name", collectionName).Required("event_type", eventType)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostBehavioralAnalyticsEventRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPostBehavioralAnalyticsEvent; + public PostBehavioralAnalyticsEventRequestDescriptor(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest(collectionName, eventType); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PostBehavioralAnalyticsEventRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.post_behavioral_analytics_event"; + /// + /// + /// The name of the behavioral analytics collection. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor CollectionName(Elastic.Clients.Elasticsearch.Name value) + { + Instance.CollectionName = value; + return this; + } - public PostBehavioralAnalyticsEventRequestDescriptor Debug(bool? debug = true) => Qs("debug", debug); + /// + /// + /// The analytics event type. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor EventType(Elastic.Clients.Elasticsearch.SearchApplication.EventType value) + { + Instance.EventType = value; + return this; + } - public PostBehavioralAnalyticsEventRequestDescriptor CollectionName(Elastic.Clients.Elasticsearch.Name collectionName) + /// + /// + /// Whether the response type has to include more details + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor Debug(bool? value = true) { - RouteValues.Required("collection_name", collectionName); - return Self; + Instance.Debug = value; + return this; } - public PostBehavioralAnalyticsEventRequestDescriptor EventType(Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor Payload(object value) { - RouteValues.Required("event_type", eventType); - return Self; + Instance.Payload = value; + return this; } - private object PayloadValue { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public PostBehavioralAnalyticsEventRequestDescriptor Payload(object payload) + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - PayloadValue = payload; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, PayloadValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventResponse.g.cs index c9fbc6dc44e..3c371328745 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PostBehavioralAnalyticsEventResponse.g.cs @@ -17,19 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PostBehavioralAnalyticsEventResponse : ElasticsearchResponse +internal sealed partial class PostBehavioralAnalyticsEventResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccepted = System.Text.Json.JsonEncodedText.Encode("accepted"); + private static readonly System.Text.Json.JsonEncodedText PropEvent = System.Text.Json.JsonEncodedText.Encode("event"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccepted = default; + LocalJsonValue propEvent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccepted.TryReadProperty(ref reader, options, PropAccepted, null)) + { + continue; + } + + if (propEvent.TryReadProperty(ref reader, options, PropEvent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Accepted = propAccepted.Value, + Event = propEvent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccepted, value.Accepted, null, null); + writer.WriteProperty(options, PropEvent, value.Event, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponseConverter))] +public sealed partial class PostBehavioralAnalyticsEventResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("accepted")] - public bool Accepted { get; init; } - [JsonInclude, JsonPropertyName("event")] - public object? Event { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PostBehavioralAnalyticsEventResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PostBehavioralAnalyticsEventResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Accepted { get; set; } + public object? Event { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsRequest.g.cs index 9b13e1d8a6a..cd394455219 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsRequest.g.cs @@ -17,41 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PutBehavioralAnalyticsRequestParameters : RequestParameters +public sealed partial class PutBehavioralAnalyticsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutBehavioralAnalyticsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Create a behavioral analytics collection. /// /// -public sealed partial class PutBehavioralAnalyticsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestConverter))] +public sealed partial class PutBehavioralAnalyticsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutBehavioralAnalyticsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPutBehavioralAnalytics; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationPutBehavioralAnalytics; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "search_application.put_behavioral_analytics"; + + /// + /// + /// The name of the analytics collection to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } } /// @@ -59,29 +104,88 @@ public PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Name name) : /// Create a behavioral analytics collection. /// /// -public sealed partial class PutBehavioralAnalyticsRequestDescriptor : RequestDescriptor +public readonly partial struct PutBehavioralAnalyticsRequestDescriptor { - internal PutBehavioralAnalyticsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest Instance { get; init; } - public PutBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPutBehavioralAnalytics; + public PutBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutBehavioralAnalyticsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.put_behavioral_analytics"; + /// + /// + /// The name of the analytics collection to be created or updated. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public PutBehavioralAnalyticsRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsResponse.g.cs index 9ef176986b8..5b8753c2e8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutBehavioralAnalyticsResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PutBehavioralAnalyticsResponse : ElasticsearchResponse +internal sealed partial class PutBehavioralAnalyticsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponseConverter))] +public sealed partial class PutBehavioralAnalyticsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutBehavioralAnalyticsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutBehavioralAnalyticsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } /// /// /// The name of the analytics collection created or updated /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationRequest.g.cs index 30d3c434500..458906d5292 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PutSearchApplicationRequestParameters : RequestParameters +public sealed partial class PutSearchApplicationRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,39 +33,79 @@ public sealed partial class PutSearchApplicationRequestParameters : RequestParam public bool? Create { get => Q("create"); set => Q("create", value); } } +internal sealed partial class PutSearchApplicationRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { SearchApplication = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.SearchApplication, null); + } +} + /// /// /// Create or update a search application. /// /// -public sealed partial class PutSearchApplicationRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestConverter))] +public sealed partial class PutSearchApplicationRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPut; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.Name name, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters searchApplication) : base(r => r.Required("name", name)) + { + SearchApplication = searchApplication; + } +#if NET7_0_OR_GREATER + public PutSearchApplicationRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationPut; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "search_application.put"; + /// + /// + /// The name of the search application to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true, this request cannot replace or update existing Search Applications. /// /// - [JsonIgnore] public bool? Create { get => Q("create"); set => Q("create", value); } - [JsonIgnore] - public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication SearchApplication { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, SearchApplication, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters SearchApplication { get; set; } } /// @@ -80,57 +113,113 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Create or update a search application. /// /// -public sealed partial class PutSearchApplicationRequestDescriptor : RequestDescriptor +public readonly partial struct PutSearchApplicationRequestDescriptor { - internal PutSearchApplicationRequestDescriptor(Action configure) => configure.Invoke(this); - public PutSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) => SearchApplicationValue = searchApplication; + internal Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationPut; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest(name); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutSearchApplicationRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "search_application.put"; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the search application to be created or updated. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If true, this request cannot replace or update existing Search Applications. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor Create(bool? value = true) + { + Instance.Create = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor SearchApplication(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters value) + { + Instance.SearchApplication = value; + return this; + } - public PutSearchApplicationRequestDescriptor Create(bool? create = true) => Qs("create", create); + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor SearchApplication(System.Action action) + { + Instance.SearchApplication = Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor.Build(action); + return this; + } - public PutSearchApplicationRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest Build(System.Action action) { - RouteValues.Required("name", name); - return Self; + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - private Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication SearchApplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationDescriptor SearchApplicationDescriptor { get; set; } - private Action SearchApplicationDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public PutSearchApplicationRequestDescriptor SearchApplication(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication) + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor Pretty(bool? value) { - SearchApplicationDescriptor = null; - SearchApplicationDescriptorAction = null; - SearchApplicationValue = searchApplication; - return Self; + Instance.Pretty = value; + return this; } - public PutSearchApplicationRequestDescriptor SearchApplication(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor SourceQueryString(string? value) { - SearchApplicationValue = null; - SearchApplicationDescriptorAction = null; - SearchApplicationDescriptor = descriptor; - return Self; + Instance.SourceQueryString = value; + return this; } - public PutSearchApplicationRequestDescriptor SearchApplication(Action configure) + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - SearchApplicationValue = null; - SearchApplicationDescriptor = null; - SearchApplicationDescriptorAction = configure; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, SearchApplicationValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationResponse.g.cs index 142ce716eb0..1e65066d2b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/PutSearchApplicationResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class PutSearchApplicationResponse : ElasticsearchResponse +internal sealed partial class PutSearchApplicationResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponseConverter))] +public sealed partial class PutSearchApplicationResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSearchApplicationResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSearchApplicationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryRequest.g.cs index da8e0779a89..3d992a0e79b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryRequest.g.cs @@ -17,23 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class RenderQueryRequestParameters : RequestParameters +public sealed partial class RenderQueryRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class RenderQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propParams = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Params = propParams.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Render a search application query. @@ -45,22 +77,43 @@ public sealed partial class RenderQueryRequestParameters : RequestParameters /// You must have read privileges on the backing alias of the search application. /// /// -public sealed partial class RenderQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestConverter))] +public sealed partial class RenderQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RenderQueryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public RenderQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RenderQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationRenderQuery; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationRenderQuery; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search_application.render_query"; - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + /// + /// + /// The name of the search application to render teh query for. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + public System.Collections.Generic.IDictionary? Params { get; set; } } /// @@ -74,45 +127,113 @@ public RenderQueryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// You must have read privileges on the backing alias of the search application. /// /// -public sealed partial class RenderQueryRequestDescriptor : RequestDescriptor +public readonly partial struct RenderQueryRequestDescriptor { - internal RenderQueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest Instance { get; init; } - public RenderQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenderQueryRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationRenderQuery; + public RenderQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RenderQueryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.render_query"; + /// + /// + /// The name of the search application to render teh query for. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public RenderQueryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - RouteValues.Required("name", name); - return Self; + Instance.Params = value; + return this; } - private IDictionary? ParamsValue { get; set; } + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - public RenderQueryRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Params(System.Action? action) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor AddParam(string key, object value) { - writer.WriteStartObject(); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryResponse.g.cs index 1e3ecd37ae6..fffaf238704 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/RenderQueryResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class RenderQueryResponse : ElasticsearchResponse +internal sealed partial class RenderQueryResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponseConverter))] +public sealed partial class RenderQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenderQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RenderQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchRequest.g.cs index 173d6962b99..441cedc5d03 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class SearchApplicationSearchRequestParameters : RequestParameters +public sealed partial class SearchApplicationSearchRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,45 @@ public sealed partial class SearchApplicationSearchRequestParameters : RequestPa public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } +internal sealed partial class SearchApplicationSearchRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propParams = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Params = propParams.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Run a search application search. @@ -47,26 +79,48 @@ public sealed partial class SearchApplicationSearchRequestParameters : RequestPa /// Unspecified template parameters are assigned their default values if applicable. /// /// -public sealed partial class SearchApplicationSearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestConverter))] +public sealed partial class SearchApplicationSearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public SearchApplicationSearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationSearch; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchApplicationSearch; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search_application.search"; + /// + /// + /// The name of the search application to be searched. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// Determines whether aggregation names are prefixed by their respective types in the response. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -74,8 +128,7 @@ public SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Name name) : /// Query parameters specific to this request, which will override any defaults specified in the template. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } } /// @@ -85,52 +138,139 @@ public SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Name name) : /// Unspecified template parameters are assigned their default values if applicable. /// /// -public sealed partial class SearchApplicationSearchRequestDescriptor : RequestDescriptor +public readonly partial struct SearchApplicationSearchRequestDescriptor { - internal SearchApplicationSearchRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest Instance { get; init; } - public SearchApplicationSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationSearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchApplicationSearch; + public SearchApplicationSearchRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SearchApplicationSearchRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest instance) => new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_application.search"; + /// + /// + /// The name of the search application to be searched. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public SearchApplicationSearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - public SearchApplicationSearchRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Query parameters specific to this request, which will override any defaults specified in the template. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - RouteValues.Required("name", name); - return Self; + Instance.Params = value; + return this; } - private IDictionary? ParamsValue { get; set; } + /// + /// + /// Query parameters specific to this request, which will override any defaults specified in the template. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } /// /// /// Query parameters specific to this request, which will override any defaults specified in the template. /// /// - public SearchApplicationSearchRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Params(System.Action? action) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor AddParam(string key, object value) { - writer.WriteStartObject(); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchResponse.g.cs index 3a656edaf6f..dfb6b116cf8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchApplication/SearchApplicationSearchResponse.g.cs @@ -17,39 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class SearchApplicationSearchResponse : ElasticsearchResponse +internal sealed partial class SearchApplicationSearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHitsMetadata = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHitsMetadata = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHitsMetadata.TryReadProperty(ref reader, options, PropHitsMetadata, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + HitsMetadata = propHitsMetadata.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHitsMetadata, value.HitsMetadata, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class SearchApplicationSearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SearchApplicationSearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(SearchApplicationSearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponseConverterFactory))] +public sealed partial class SearchApplicationSearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationSearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchApplicationSearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// The returned documents and metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; set; } + public double? MaxScore { get; set; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } /// /// @@ -58,28 +236,31 @@ public sealed partial class SearchApplicationSearchResponse : Elastic /// This property is returned only if the scroll query parameter is specified in the request. /// /// - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } /// /// /// A count of shards used for the request. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } /// /// /// If true, the request timed out before completion; returned results may be partial or empty. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } /// /// @@ -125,6 +306,9 @@ public sealed partial class SearchApplicationSearchResponse : Elastic /// /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtRequest.g.cs index b42cdd1bb4b..a6b51fbf99e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtRequest.g.cs @@ -17,21 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchMvtRequestParameters : RequestParameters +public sealed partial class SearchMvtRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class SearchMvtRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAggs = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropBuffer = System.Text.Json.JsonEncodedText.Encode("buffer"); + private static readonly System.Text.Json.JsonEncodedText PropExactBounds = System.Text.Json.JsonEncodedText.Encode("exact_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropExtent = System.Text.Json.JsonEncodedText.Encode("extent"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropGridAgg = System.Text.Json.JsonEncodedText.Encode("grid_agg"); + private static readonly System.Text.Json.JsonEncodedText PropGridPrecision = System.Text.Json.JsonEncodedText.Encode("grid_precision"); + private static readonly System.Text.Json.JsonEncodedText PropGridType = System.Text.Json.JsonEncodedText.Encode("grid_type"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropTrackTotalHits = System.Text.Json.JsonEncodedText.Encode("track_total_hits"); + private static readonly System.Text.Json.JsonEncodedText PropWithLabels = System.Text.Json.JsonEncodedText.Encode("with_labels"); + + public override Elastic.Clients.Elasticsearch.SearchMvtRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggs = default; + LocalJsonValue propBuffer = default; + LocalJsonValue propExactBounds = default; + LocalJsonValue propExtent = default; + LocalJsonValue propFields = default; + LocalJsonValue propGridAgg = default; + LocalJsonValue propGridPrecision = default; + LocalJsonValue propGridType = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propTrackTotalHits = default; + LocalJsonValue propWithLabels = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggs.TryReadProperty(ref reader, options, PropAggs, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propBuffer.TryReadProperty(ref reader, options, PropBuffer, null)) + { + continue; + } + + if (propExactBounds.TryReadProperty(ref reader, options, PropExactBounds, null)) + { + continue; + } + + if (propExtent.TryReadProperty(ref reader, options, PropExtent, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propGridAgg.TryReadProperty(ref reader, options, PropGridAgg, null)) + { + continue; + } + + if (propGridPrecision.TryReadProperty(ref reader, options, PropGridPrecision, null)) + { + continue; + } + + if (propGridType.TryReadProperty(ref reader, options, PropGridType, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propTrackTotalHits.TryReadProperty(ref reader, options, PropTrackTotalHits, null)) + { + continue; + } + + if (propWithLabels.TryReadProperty(ref reader, options, PropWithLabels, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchMvtRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggs = propAggs.Value, + Buffer = propBuffer.Value, + ExactBounds = propExactBounds.Value, + Extent = propExtent.Value, + Fields = propFields.Value, + GridAgg = propGridAgg.Value, + GridPrecision = propGridPrecision.Value, + GridType = propGridType.Value, + Query = propQuery.Value, + RuntimeMappings = propRuntimeMappings.Value, + Size = propSize.Value, + Sort = propSort.Value, + TrackTotalHits = propTrackTotalHits.Value, + WithLabels = propWithLabels.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchMvtRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggs, value.Aggs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropBuffer, value.Buffer, null, null); + writer.WriteProperty(options, PropExactBounds, value.ExactBounds, null, null); + writer.WriteProperty(options, PropExtent, value.Extent, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropGridAgg, value.GridAgg, null, null); + writer.WriteProperty(options, PropGridPrecision, value.GridPrecision, null, null); + writer.WriteProperty(options, PropGridType, value.GridType, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTrackTotalHits, value.TrackTotalHits, null, null); + writer.WriteProperty(options, PropWithLabels, value.WithLabels, null, null); + writer.WriteEndObject(); + } } /// @@ -229,20 +378,87 @@ public sealed partial class SearchMvtRequestParameters : RequestParameters /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. /// /// -public sealed partial class SearchMvtRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchMvtRequestConverter))] +public sealed partial class SearchMvtRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) : base(r => r.Required("index", indices).Required("field", field).Required("zoom", zoom).Required("x", x).Required("y", y)) { } +#if NET7_0_OR_GREATER + public SearchMvtRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchMvtRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchMvt; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceSearchMvt; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search_mvt"; + /// + /// + /// Field containing geospatial data to return + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get => P("field"); set => PR("field", value); } + + /// + /// + /// Comma-separated list of data streams, indices, or aliases to search + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + + /// + /// + /// X coordinate for the vector tile to search + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int X { get => P("x"); set => PR("x", value); } + + /// + /// + /// Y coordinate for the vector tile to search + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int Y { get => P("y"); set => PR("y", value); } + + /// + /// + /// Zoom level for the vector tile to search + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int Zoom { get => P("zoom"); set => PR("zoom", value); } + /// /// /// Sub-aggregations for the geotile_grid. @@ -316,8 +532,7 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. /// /// - [JsonInclude, JsonPropertyName("aggs")] - public IDictionary? Aggs { get; set; } + public System.Collections.Generic.IDictionary? Aggs { get; set; } /// /// @@ -325,7 +540,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// to avoid outline artifacts from geometries that extend past the extent of the tile. /// /// - [JsonInclude, JsonPropertyName("buffer")] public int? Buffer { get; set; } /// @@ -337,7 +551,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// bounding box may be larger than the vector tile. /// /// - [JsonInclude, JsonPropertyName("exact_bounds")] public bool? ExactBounds { get; set; } /// @@ -345,7 +558,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. /// /// - [JsonInclude, JsonPropertyName("extent")] public int? Extent { get; set; } /// @@ -356,8 +568,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// values may return inconsistent results. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -365,7 +575,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// The aggregation used to create a grid for the field. /// /// - [JsonInclude, JsonPropertyName("grid_agg")] public Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? GridAgg { get; set; } /// @@ -375,7 +584,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// don't include the aggs layer. /// /// - [JsonInclude, JsonPropertyName("grid_precision")] public int? GridPrecision { get; set; } /// @@ -385,7 +593,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// of the cell. /// /// - [JsonInclude, JsonPropertyName("grid_type")] public Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? GridType { get; set; } /// @@ -393,7 +600,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// The query DSL used to filter documents for the search. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -402,8 +608,7 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// precedence over mapped fields with the same name. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// @@ -411,7 +616,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// If 0, results don't include the hits layer. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -421,9 +625,7 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// from longest to shortest. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } /// /// @@ -432,7 +634,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// not include the total number of hits matching the query. /// /// - [JsonInclude, JsonPropertyName("track_total_hits")] public Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHits { get; set; } /// @@ -467,7 +668,6 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// In addition, the new features will be distinguishable using the tag _mvt_label_position. /// /// - [JsonInclude, JsonPropertyName("with_labels")] public bool? WithLabels { get; set; } } @@ -666,75 +866,95 @@ public SearchMvtRequest(Elastic.Clients.Elasticsearch.Indices indices, Elastic.C /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. /// /// -public sealed partial class SearchMvtRequestDescriptor : RequestDescriptor, SearchMvtRequestParameters> +public readonly partial struct SearchMvtRequestDescriptor { - internal SearchMvtRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchMvtRequest Instance { get; init; } - public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) : base(r => r.Required("index", indices).Required("field", field).Required("zoom", zoom).Required("x", x).Required("y", y)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.SearchMvtRequest instance) { + Instance = instance; } - public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) : this(typeof(TDocument), field, zoom, x, y) + public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) { + Instance = new Elastic.Clients.Elasticsearch.SearchMvtRequest(indices, field, zoom, x, y); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchMvt; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SearchMvtRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "search_mvt"; + public static explicit operator Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.SearchMvtRequest instance) => new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchMvtRequest(Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor descriptor) => descriptor.Instance; - public SearchMvtRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + /// + /// + /// Field containing geospatial data to return + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - RouteValues.Required("field", field); - return Self; + Instance.Field = value; + return this; } - public SearchMvtRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Field containing geospatial data to return + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - RouteValues.Required("index", indices); - return Self; + Instance.Field = value; + return this; } - public SearchMvtRequestDescriptor x(int x) + /// + /// + /// Comma-separated list of data streams, indices, or aliases to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - RouteValues.Required("x", x); - return Self; + Instance.Indices = value; + return this; } - public SearchMvtRequestDescriptor y(int y) + /// + /// + /// X coordinate for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor X(int value) { - RouteValues.Required("y", y); - return Self; + Instance.X = value; + return this; } - public SearchMvtRequestDescriptor Zoom(int zoom) + /// + /// + /// Y coordinate for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Y(int value) { - RouteValues.Required("zoom", zoom); - return Self; + Instance.Y = value; + return this; } - private IDictionary> AggsValue { get; set; } - private int? BufferValue { get; set; } - private bool? ExactBoundsValue { get; set; } - private int? ExtentValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? GridAggValue { get; set; } - private int? GridPrecisionValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? GridTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? WithLabelsValue { get; set; } + /// + /// + /// Zoom level for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Zoom(int value) + { + Instance.Zoom = value; + return this; + } /// /// @@ -809,195 +1029,570 @@ public SearchMvtRequestDescriptor Zoom(int zoom) /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. /// /// - public SearchMvtRequestDescriptor Aggs(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs(System.Collections.Generic.IDictionary? value) { - AggsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggs = value; + return this; } /// /// - /// The size, in pixels, of a clipping buffer outside the tile. This allows renderers - /// to avoid outline artifacts from geometries that extend past the extent of the tile. + /// Sub-aggregations for the geotile_grid. /// - /// - public SearchMvtRequestDescriptor Buffer(int? buffer) - { - BufferValue = buffer; - return Self; - } - - /// /// - /// If false, the meta layer's feature is the bounding box of the tile. - /// If true, the meta layer's feature is a bounding box resulting from a - /// geo_bounds aggregation. The aggregation runs on <field> values that intersect - /// the <zoom>/<x>/<y> tile with wrap_longitude set to false. The resulting - /// bounding box may be larger than the vector tile. + /// It supports the following aggregation types: /// - /// - public SearchMvtRequestDescriptor ExactBounds(bool? exactBounds = true) - { - ExactBoundsValue = exactBounds; - return Self; - } - - /// + /// + /// /// - /// The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. + /// avg /// - /// - public SearchMvtRequestDescriptor Extent(int? extent) - { - ExtentValue = extent; - return Self; - } - - /// + /// + /// /// - /// The fields to return in the hits layer. - /// It supports wildcards (*). - /// This parameter does not support fields with array values. Fields with array - /// values may return inconsistent results. + /// boxplot /// - /// - public SearchMvtRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) - { - FieldsValue = fields; - return Self; - } - - /// + /// + /// /// - /// The aggregation used to create a grid for the field. + /// cardinality /// - /// - public SearchMvtRequestDescriptor GridAgg(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? gridAgg) - { - GridAggValue = gridAgg; - return Self; - } - - /// + /// + /// /// - /// Additional zoom levels available through the aggs layer. For example, if <zoom> is 7 - /// and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results - /// don't include the aggs layer. + /// extended stats /// - /// - public SearchMvtRequestDescriptor GridPrecision(int? gridPrecision) - { - GridPrecisionValue = gridPrecision; - return Self; - } - - /// + /// + /// /// - /// Determines the geometry type for features in the aggs layer. In the aggs layer, - /// each feature represents a geotile_grid cell. If grid, each feature is a polygon of the cells bounding box. If point`, each feature is a Point that is the centroid - /// of the cell. + /// max /// - /// - public SearchMvtRequestDescriptor GridType(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? gridType) - { - GridTypeValue = gridType; - return Self; - } - - /// + /// + /// /// - /// The query DSL used to filter documents for the search. + /// median absolute deviation /// - /// - public SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public SearchMvtRequestDescriptor Query(Action> configure) - { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; - } - - /// + /// + /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// min /// - /// - public SearchMvtRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) - { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; - } - - /// + /// + /// /// - /// The maximum number of features to return in the hits layer. Accepts 0-10000. - /// If 0, results don't include the hits layer. + /// percentile + /// + /// + /// + /// + /// percentile-rank + /// + /// + /// + /// + /// stats + /// + /// + /// + /// + /// sum + /// + /// + /// + /// + /// value count + /// + /// + /// + /// + /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. /// /// - public SearchMvtRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs() { - SizeValue = size; - return Self; + Instance.Aggs = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } /// /// - /// Sort the features in the hits layer. By default, the API calculates a bounding - /// box for each feature. It sorts features based on this box's diagonal length, - /// from longest to shortest. + /// Sub-aggregations for the geotile_grid. /// - /// - public SearchMvtRequestDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public SearchMvtRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// It supports the following aggregation types: + /// + /// + /// + /// + /// avg + /// + /// + /// + /// + /// boxplot + /// + /// + /// + /// + /// cardinality + /// + /// + /// + /// + /// extended stats + /// + /// + /// + /// + /// max + /// + /// + /// + /// + /// median absolute deviation + /// + /// + /// + /// + /// min + /// + /// + /// + /// + /// percentile + /// + /// + /// + /// + /// percentile-rank + /// + /// + /// + /// + /// stats + /// + /// + /// + /// + /// sum + /// + /// + /// + /// + /// value count + /// + /// + /// + /// + /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs(System.Action? action) + { + Instance.Aggs = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for the geotile_grid. + /// + /// + /// It supports the following aggregation types: + /// + /// + /// + /// + /// avg + /// + /// + /// + /// + /// boxplot + /// + /// + /// + /// + /// cardinality + /// + /// + /// + /// + /// extended stats + /// + /// + /// + /// + /// max + /// + /// + /// + /// + /// median absolute deviation + /// + /// + /// + /// + /// min + /// + /// + /// + /// + /// percentile + /// + /// + /// + /// + /// percentile-rank + /// + /// + /// + /// + /// stats + /// + /// + /// + /// + /// sum + /// + /// + /// + /// + /// value count + /// + /// + /// + /// + /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs(System.Action>? action) + { + Instance.Aggs = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddAgg(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggs ??= new System.Collections.Generic.Dictionary(); + Instance.Aggs.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddAgg(string key, System.Action action) + { + Instance.Aggs ??= new System.Collections.Generic.Dictionary(); + Instance.Aggs.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddAgg(string key, System.Action> action) + { + Instance.Aggs ??= new System.Collections.Generic.Dictionary(); + Instance.Aggs.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + /// + /// + /// The size, in pixels, of a clipping buffer outside the tile. This allows renderers + /// to avoid outline artifacts from geometries that extend past the extent of the tile. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Buffer(int? value) + { + Instance.Buffer = value; + return this; + } + + /// + /// + /// If false, the meta layer's feature is the bounding box of the tile. + /// If true, the meta layer's feature is a bounding box resulting from a + /// geo_bounds aggregation. The aggregation runs on <field> values that intersect + /// the <zoom>/<x>/<y> tile with wrap_longitude set to false. The resulting + /// bounding box may be larger than the vector tile. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor ExactBounds(bool? value = true) + { + Instance.ExactBounds = value; + return this; + } + + /// + /// + /// The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Extent(int? value) + { + Instance.Extent = value; + return this; + } + + /// + /// + /// The fields to return in the hits layer. + /// It supports wildcards (*). + /// This parameter does not support fields with array values. Fields with array + /// values may return inconsistent results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// The fields to return in the hits layer. + /// It supports wildcards (*). + /// This parameter does not support fields with array values. Fields with array + /// values may return inconsistent results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// The aggregation used to create a grid for the field. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridAgg(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? value) + { + Instance.GridAgg = value; + return this; + } + + /// + /// + /// Additional zoom levels available through the aggs layer. For example, if <zoom> is 7 + /// and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results + /// don't include the aggs layer. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridPrecision(int? value) + { + Instance.GridPrecision = value; + return this; + } + + /// + /// + /// Determines the geometry type for features in the aggs layer. In the aggs layer, + /// each feature represents a geotile_grid cell. If grid, each feature is a polygon of the cells bounding box. If point`, each feature is a Point that is the centroid + /// of the cell. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridType(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? value) + { + Instance.GridType = value; + return this; + } + + /// + /// + /// The query DSL used to filter documents for the search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// The query DSL used to filter documents for the search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The query DSL used to filter documents for the search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = value; + return this; } - public SearchMvtRequestDescriptor Sort(Action> configure) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings() { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } - public SearchMvtRequestDescriptor Sort(params Action>[] configure) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings(System.Action? action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// The maximum number of features to return in the hits layer. Accepts 0-10000. + /// If 0, results don't include the hits layer. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; + } + + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } /// @@ -1007,10 +1602,23 @@ public SearchMvtRequestDescriptor Sort(params Action /// - public SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.TrackTotalHits = value; + return this; + } + + /// + /// + /// The number of hits matching the query to count accurately. If true, the exact number + /// of hits is returned at the cost of some performance. If false, the response does + /// not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor TrackTotalHits(System.Func action) + { + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; } /// @@ -1045,133 +1653,60 @@ public SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elas /// In addition, the new features will be distinguishable using the tag _mvt_label_position. /// /// - public SearchMvtRequestDescriptor WithLabels(bool? withLabels = true) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor WithLabels(bool? value = true) { - WithLabelsValue = withLabels; - return Self; + Instance.WithLabels = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchMvtRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AggsValue is not null) - { - writer.WritePropertyName("aggs"); - JsonSerializer.Serialize(writer, AggsValue, options); - } - - if (BufferValue.HasValue) - { - writer.WritePropertyName("buffer"); - writer.WriteNumberValue(BufferValue.Value); - } - - if (ExactBoundsValue.HasValue) - { - writer.WritePropertyName("exact_bounds"); - writer.WriteBooleanValue(ExactBoundsValue.Value); - } - - if (ExtentValue.HasValue) - { - writer.WritePropertyName("extent"); - writer.WriteNumberValue(ExtentValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (GridAggValue is not null) - { - writer.WritePropertyName("grid_agg"); - JsonSerializer.Serialize(writer, GridAggValue, options); - } - - if (GridPrecisionValue.HasValue) - { - writer.WritePropertyName("grid_precision"); - writer.WriteNumberValue(GridPrecisionValue.Value); - } - - if (GridTypeValue is not null) - { - writer.WritePropertyName("grid_type"); - JsonSerializer.Serialize(writer, GridTypeValue, options); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchMvtRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WithLabelsValue.HasValue) - { - writer.WritePropertyName("with_labels"); - writer.WriteBooleanValue(WithLabelsValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -1370,72 +1905,254 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. /// /// -public sealed partial class SearchMvtRequestDescriptor : RequestDescriptor +public readonly partial struct SearchMvtRequestDescriptor { - internal SearchMvtRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchMvtRequest Instance { get; init; } - public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) : base(r => r.Required("index", indices).Required("field", field).Required("zoom", zoom).Required("x", x).Required("y", y)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.SearchMvtRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchMvt; + public SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) + { + Instance = new Elastic.Clients.Elasticsearch.SearchMvtRequest(indices, field, zoom, x, y); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SearchMvtRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(Elastic.Clients.Elasticsearch.SearchMvtRequest instance) => new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchMvtRequest(Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "search_mvt"; + /// + /// + /// Field containing geospatial data to return + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } - public SearchMvtRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + /// + /// + /// Field containing geospatial data to return + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - RouteValues.Required("field", field); - return Self; + Instance.Field = value; + return this; } - public SearchMvtRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + /// + /// + /// Comma-separated list of data streams, indices, or aliases to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - RouteValues.Required("index", indices); - return Self; + Instance.Indices = value; + return this; } - public SearchMvtRequestDescriptor x(int x) + /// + /// + /// X coordinate for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor X(int value) + { + Instance.X = value; + return this; + } + + /// + /// + /// Y coordinate for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Y(int value) + { + Instance.Y = value; + return this; + } + + /// + /// + /// Zoom level for the vector tile to search + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Zoom(int value) { - RouteValues.Required("x", x); - return Self; + Instance.Zoom = value; + return this; } - public SearchMvtRequestDescriptor y(int y) + /// + /// + /// Sub-aggregations for the geotile_grid. + /// + /// + /// It supports the following aggregation types: + /// + /// + /// + /// + /// avg + /// + /// + /// + /// + /// boxplot + /// + /// + /// + /// + /// cardinality + /// + /// + /// + /// + /// extended stats + /// + /// + /// + /// + /// max + /// + /// + /// + /// + /// median absolute deviation + /// + /// + /// + /// + /// min + /// + /// + /// + /// + /// percentile + /// + /// + /// + /// + /// percentile-rank + /// + /// + /// + /// + /// stats + /// + /// + /// + /// + /// sum + /// + /// + /// + /// + /// value count + /// + /// + /// + /// + /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs(System.Collections.Generic.IDictionary? value) { - RouteValues.Required("y", y); - return Self; + Instance.Aggs = value; + return this; } - public SearchMvtRequestDescriptor Zoom(int zoom) + /// + /// + /// Sub-aggregations for the geotile_grid. + /// + /// + /// It supports the following aggregation types: + /// + /// + /// + /// + /// avg + /// + /// + /// + /// + /// boxplot + /// + /// + /// + /// + /// cardinality + /// + /// + /// + /// + /// extended stats + /// + /// + /// + /// + /// max + /// + /// + /// + /// + /// median absolute deviation + /// + /// + /// + /// + /// min + /// + /// + /// + /// + /// percentile + /// + /// + /// + /// + /// percentile-rank + /// + /// + /// + /// + /// stats + /// + /// + /// + /// + /// sum + /// + /// + /// + /// + /// value count + /// + /// + /// + /// + /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs() { - RouteValues.Required("zoom", zoom); - return Self; + Instance.Aggs = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } - private IDictionary AggsValue { get; set; } - private int? BufferValue { get; set; } - private bool? ExactBoundsValue { get; set; } - private int? ExtentValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? GridAggValue { get; set; } - private int? GridPrecisionValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? GridTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? WithLabelsValue { get; set; } - /// /// /// Sub-aggregations for the geotile_grid. @@ -1509,10 +2226,24 @@ public SearchMvtRequestDescriptor Zoom(int zoom) /// The aggregation names can't start with _mvt_. The _mvt_ prefix is reserved for internal aggregations. /// /// - public SearchMvtRequestDescriptor Aggs(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Aggs(System.Action>? action) + { + Instance.Aggs = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddAgg(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggs ??= new System.Collections.Generic.Dictionary(); + Instance.Aggs.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddAgg(string key, System.Action> action) { - AggsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggs ??= new System.Collections.Generic.Dictionary(); + Instance.Aggs.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -1521,10 +2252,10 @@ public SearchMvtRequestDescriptor Aggs(Func /// - public SearchMvtRequestDescriptor Buffer(int? buffer) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Buffer(int? value) { - BufferValue = buffer; - return Self; + Instance.Buffer = value; + return this; } /// @@ -1536,10 +2267,10 @@ public SearchMvtRequestDescriptor Buffer(int? buffer) /// bounding box may be larger than the vector tile. /// /// - public SearchMvtRequestDescriptor ExactBounds(bool? exactBounds = true) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor ExactBounds(bool? value = true) { - ExactBoundsValue = exactBounds; - return Self; + Instance.ExactBounds = value; + return this; } /// @@ -1547,10 +2278,24 @@ public SearchMvtRequestDescriptor ExactBounds(bool? exactBounds = true) /// The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. /// /// - public SearchMvtRequestDescriptor Extent(int? extent) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Extent(int? value) + { + Instance.Extent = value; + return this; + } + + /// + /// + /// The fields to return in the hits layer. + /// It supports wildcards (*). + /// This parameter does not support fields with array values. Fields with array + /// values may return inconsistent results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - ExtentValue = extent; - return Self; + Instance.Fields = value; + return this; } /// @@ -1561,10 +2306,10 @@ public SearchMvtRequestDescriptor Extent(int? extent) /// values may return inconsistent results. /// /// - public SearchMvtRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -1572,10 +2317,10 @@ public SearchMvtRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? f /// The aggregation used to create a grid for the field. /// /// - public SearchMvtRequestDescriptor GridAgg(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? gridAgg) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridAgg(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType? value) { - GridAggValue = gridAgg; - return Self; + Instance.GridAgg = value; + return this; } /// @@ -1585,10 +2330,10 @@ public SearchMvtRequestDescriptor GridAgg(Elastic.Clients.Elasticsearch.Core.Sea /// don't include the aggs layer. /// /// - public SearchMvtRequestDescriptor GridPrecision(int? gridPrecision) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridPrecision(int? value) { - GridPrecisionValue = gridPrecision; - return Self; + Instance.GridPrecision = value; + return this; } /// @@ -1598,10 +2343,21 @@ public SearchMvtRequestDescriptor GridPrecision(int? gridPrecision) /// of the cell. /// /// - public SearchMvtRequestDescriptor GridType(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? gridType) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor GridType(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType? value) + { + Instance.GridType = value; + return this; + } + + /// + /// + /// The query DSL used to filter documents for the search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - GridTypeValue = gridType; - return Self; + Instance.Query = value; + return this; } /// @@ -1609,28 +2365,34 @@ public SearchMvtRequestDescriptor GridType(Elastic.Clients.Elasticsearch.Core.Se /// The query DSL used to filter documents for the search. /// /// - public SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SearchMvtRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = value; + return this; } - public SearchMvtRequestDescriptor Query(Action configure) + /// + /// + /// Defines one or more runtime fields in the search request. These fields take + /// precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings() { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// @@ -1639,10 +2401,38 @@ public SearchMvtRequestDescriptor Query(Action /// - public SearchMvtRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// @@ -1651,10 +2441,10 @@ public SearchMvtRequestDescriptor RuntimeMappings(Func /// - public SearchMvtRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -1664,40 +2454,55 @@ public SearchMvtRequestDescriptor Size(int? size) /// from longest to shortest. /// /// - public SearchMvtRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public SearchMvtRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public SearchMvtRequestDescriptor Sort(Action configure) + /// + /// + /// Sort the features in the hits layer. By default, the API calculates a bounding + /// box for each feature. It sorts features based on this box's diagonal length, + /// from longest to shortest. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } - public SearchMvtRequestDescriptor Sort(params Action[] configure) + /// + /// + /// The number of hits matching the query to count accurately. If true, the exact number + /// of hits is returned at the cost of some performance. If false, the response does + /// not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.TrackTotalHits = value; + return this; } /// @@ -1707,10 +2512,10 @@ public SearchMvtRequestDescriptor Sort(params Action /// - public SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor TrackTotalHits(System.Func action) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; } /// @@ -1745,132 +2550,59 @@ public SearchMvtRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.C /// In addition, the new features will be distinguishable using the tag _mvt_label_position. /// /// - public SearchMvtRequestDescriptor WithLabels(bool? withLabels = true) + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor WithLabels(bool? value = true) { - WithLabelsValue = withLabels; - return Self; + Instance.WithLabels = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchMvtRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AggsValue is not null) - { - writer.WritePropertyName("aggs"); - JsonSerializer.Serialize(writer, AggsValue, options); - } - - if (BufferValue.HasValue) - { - writer.WritePropertyName("buffer"); - writer.WriteNumberValue(BufferValue.Value); - } - - if (ExactBoundsValue.HasValue) - { - writer.WritePropertyName("exact_bounds"); - writer.WriteBooleanValue(ExactBoundsValue.Value); - } - - if (ExtentValue.HasValue) - { - writer.WritePropertyName("extent"); - writer.WriteNumberValue(ExtentValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (GridAggValue is not null) - { - writer.WritePropertyName("grid_agg"); - JsonSerializer.Serialize(writer, GridAggValue, options); - } - - if (GridPrecisionValue.HasValue) - { - writer.WritePropertyName("grid_precision"); - writer.WriteNumberValue(GridPrecisionValue.Value); - } - - if (GridTypeValue is not null) - { - writer.WritePropertyName("grid_type"); - JsonSerializer.Serialize(writer, GridTypeValue, options); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchMvtRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WithLabelsValue.HasValue) - { - writer.WritePropertyName("with_labels"); - writer.WriteBooleanValue(WithLabelsValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtResponse.g.cs index 54056188e26..77c798b8090 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchMvtResponse.g.cs @@ -17,15 +17,22 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchMvtResponse : ElasticsearchResponse +public sealed partial class SearchMvtResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchMvtResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchMvtResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs index 1ce4a5ef0d8..0a17899fd68 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchRequestParameters : RequestParameters +public sealed partial class SearchRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -106,7 +99,7 @@ public sealed partial class SearchRequestParameters : RequestParameters /// It supports comma-separated values such as open,hidden. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -117,6 +110,14 @@ public sealed partial class SearchRequestParameters : RequestParameters /// public bool? ForceSyntheticSource { get => Q("force_synthetic_source"); set => Q("force_synthetic_source", value); } + /// + /// + /// If true, concrete, expanded or aliased indices will be ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } + /// /// /// If false, the request returns an error if it targets a missing or closed index. @@ -126,61 +127,58 @@ public sealed partial class SearchRequestParameters : RequestParameters /// /// - /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. - /// This parameter can be used only when the q query string parameter is specified. + /// If true, the response includes the score contribution from any named queries. + /// + /// + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. /// /// - public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } + public bool? IncludeNamedQueriesScore { get => Q("include_named_queries_score"); set => Q("include_named_queries_score", value); } /// /// - /// The number of concurrent shard requests per node that the search runs concurrently. - /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } + public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// /// - /// The minimum version of the node that can handle the request. - /// Any handling node with a lower version will fail the request. + /// The number of concurrent shard requests per node that the search runs concurrently. + /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. /// /// - public string? MinCompatibleShardNode { get => Q("min_compatible_shard_node"); set => Q("min_compatible_shard_node", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// /// The nodes and shards used for the search. - /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: + /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. + /// Valid values are: /// /// /// /// - /// _only_local to run the search only on shards on the local node; - /// - /// - /// - /// - /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method; - /// - /// - /// - /// - /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; + /// _only_local to run the search only on shards on the local node. /// /// /// /// - /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; + /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method. /// /// /// /// - /// _shards:<shard>,<shard> to run the search only on the specified shards; + /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. /// /// /// /// + /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. + /// _shards:<shard>,<shard> to run the search only on the specified shards. You can combine this value with other preference values. However, the _shards value must come first. For example: _shards:2,3|_local. /// <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order. /// /// @@ -322,434 +320,339 @@ public sealed partial class SearchRequestParameters : RequestParameters public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } -internal sealed partial class SearchRequestConverter : JsonConverter +internal sealed partial class SearchRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override SearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new SearchRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropDocvalueFields = System.Text.Json.JsonEncodedText.Encode("docvalue_fields"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropExt = System.Text.Json.JsonEncodedText.Encode("ext"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesBoost = System.Text.Json.JsonEncodedText.Encode("indices_boost"); + private static readonly System.Text.Json.JsonEncodedText PropKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropPit = System.Text.Json.JsonEncodedText.Encode("pit"); + private static readonly System.Text.Json.JsonEncodedText PropPostFilter = System.Text.Json.JsonEncodedText.Encode("post_filter"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRank = System.Text.Json.JsonEncodedText.Encode("rank"); + private static readonly System.Text.Json.JsonEncodedText PropRescore = System.Text.Json.JsonEncodedText.Encode("rescore"); + private static readonly System.Text.Json.JsonEncodedText PropRetriever = System.Text.Json.JsonEncodedText.Encode("retriever"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNoPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("seq_no_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminateAfter = System.Text.Json.JsonEncodedText.Encode("terminate_after"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + private static readonly System.Text.Json.JsonEncodedText PropTrackScores = System.Text.Json.JsonEncodedText.Encode("track_scores"); + private static readonly System.Text.Json.JsonEncodedText PropTrackTotalHits = System.Text.Json.JsonEncodedText.Encode("track_total_hits"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.SearchRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propCollapse = default; + LocalJsonValue?> propDocvalueFields = default; + LocalJsonValue propExplain = default; + LocalJsonValue?> propExt = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propFrom = default; + LocalJsonValue propHighlight = default; + LocalJsonValue>?> propIndicesBoost = default; + LocalJsonValue?> propKnn = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propPit = default; + LocalJsonValue propPostFilter = default; + LocalJsonValue propProfile = default; + LocalJsonValue propQuery = default; + LocalJsonValue propRank = default; + LocalJsonValue?> propRescore = default; + LocalJsonValue propRetriever = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSeqNoPrimaryTerm = default; + LocalJsonValue propSize = default; + LocalJsonValue propSlice = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue?> propStats = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propSuggest = default; + LocalJsonValue propTerminateAfter = default; + LocalJsonValue propTimeout = default; + LocalJsonValue propTrackScores = default; + LocalJsonValue propTrackTotalHits = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "collapse") - { - variant.Collapse = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "docvalue_fields") - { - variant.DocvalueFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "explain") - { - variant.Explain = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ext") - { - variant.Ext = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "fields") - { - variant.Fields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "from") - { - variant.From = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "highlight") - { - variant.Highlight = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices_boost") - { - variant.IndicesBoost = JsonSerializer.Deserialize>?>(ref reader, options); - continue; - } - - if (property == "knn") - { - variant.Knn = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "min_score") - { - variant.MinScore = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "pit") - { - variant.Pit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "post_filter") - { - variant.PostFilter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "profile") - { - variant.Profile = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rank") - { - variant.Rank = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rescore") - { - variant.Rescore = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "retriever") - { - variant.Retriever = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "search_after") - { - variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "seq_no_primary_term") - { - variant.SeqNoPrimaryTerm = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "size") - { - variant.Size = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "slice") - { - variant.Slice = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "sort") - { - variant.Sort = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "_source") - { - variant.Source = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "stats") - { - variant.Stats = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "stored_fields") - { - variant.StoredFields = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "suggest") - { - variant.Suggest = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "terminate_after") - { - variant.TerminateAfter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "timeout") - { - variant.Timeout = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_scores") - { - variant.TrackScores = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_total_hits") - { - variant.TrackTotalHits = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - variant.Version = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - - return variant; - } - public override void Write(Utf8JsonWriter writer, SearchRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } - if (value.Collapse is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, value.Collapse, options); - } + if (propDocvalueFields.TryReadProperty(ref reader, options, PropDocvalueFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.DocvalueFields is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, value.DocvalueFields, options); - } + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } - if (value.Explain.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(value.Explain.Value); - } + if (propExt.TryReadProperty(ref reader, options, PropExt, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.Ext is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, value.Ext, options); - } + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Fields is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, value.Fields, options); - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (value.From.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(value.From.Value); - } + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } - if (value.Highlight is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, value.Highlight, options); - } + if (propIndicesBoost.TryReadProperty(ref reader, options, PropIndicesBoost, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } - if (value.IndicesBoost is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, value.IndicesBoost, options); - } + if (propKnn.TryReadProperty(ref reader, options, PropKnn, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Knn is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, value.Knn, options); - } + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } - if (value.MinScore.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(value.MinScore.Value); - } + if (propPit.TryReadProperty(ref reader, options, PropPit, null)) + { + continue; + } - if (value.Pit is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, value.Pit, options); - } + if (propPostFilter.TryReadProperty(ref reader, options, PropPostFilter, null)) + { + continue; + } - if (value.PostFilter is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, value.PostFilter, options); - } + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } - if (value.Profile.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(value.Profile.Value); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRank.TryReadProperty(ref reader, options, PropRank, null)) + { + continue; + } - if (value.Rank is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, value.Rank, options); - } + if (propRescore.TryReadProperty(ref reader, options, PropRescore, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Rescore is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, value.Rescore, options); - } + if (propRetriever.TryReadProperty(ref reader, options, PropRetriever, null)) + { + continue; + } - if (value.Retriever is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, value.Retriever, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); - } + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.SearchAfter is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, value.SearchAfter, options); - } + if (propSeqNoPrimaryTerm.TryReadProperty(ref reader, options, PropSeqNoPrimaryTerm, null)) + { + continue; + } - if (value.SeqNoPrimaryTerm.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(value.SeqNoPrimaryTerm.Value); - } + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } - if (value.Size.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(value.Size.Value); - } + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } - if (value.Slice is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, value.Slice, options); - } + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Sort is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, value.Sort, options); - } + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } - if (value.Source is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, value.Source, options); - } + if (propStats.TryReadProperty(ref reader, options, PropStats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Stats is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, value.Stats, options); - } + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } - if (value.StoredFields is not null) - { - writer.WritePropertyName("stored_fields"); - new FieldsConverter().Write(writer, value.StoredFields, options); - } + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } - if (value.Suggest is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, value.Suggest, options); - } + if (propTerminateAfter.TryReadProperty(ref reader, options, PropTerminateAfter, null)) + { + continue; + } - if (value.TerminateAfter.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(value.TerminateAfter.Value); - } + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Timeout)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(value.Timeout); - } + if (propTrackScores.TryReadProperty(ref reader, options, PropTrackScores, null)) + { + continue; + } - if (value.TrackScores.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(value.TrackScores.Value); - } + if (propTrackTotalHits.TryReadProperty(ref reader, options, PropTrackTotalHits, null)) + { + continue; + } - if (value.TrackTotalHits is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, value.TrackTotalHits, options); - } + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } - if (value.Version.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(value.Version.Value); - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Collapse = propCollapse.Value, + DocvalueFields = propDocvalueFields.Value, + Explain = propExplain.Value, + Ext = propExt.Value, + Fields = propFields.Value, + From = propFrom.Value, + Highlight = propHighlight.Value, + IndicesBoost = propIndicesBoost.Value, + Knn = propKnn.Value, + MinScore = propMinScore.Value, + Pit = propPit.Value, + PostFilter = propPostFilter.Value, + Profile = propProfile.Value, + Query = propQuery.Value, + Rank = propRank.Value, + Rescore = propRescore.Value, + Retriever = propRetriever.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + SearchAfter = propSearchAfter.Value, + SeqNoPrimaryTerm = propSeqNoPrimaryTerm.Value, + Size = propSize.Value, + Slice = propSlice.Value, + Sort = propSort.Value, + Source = propSource.Value, + Stats = propStats.Value, + StoredFields = propStoredFields.Value, + Suggest = propSuggest.Value, + TerminateAfter = propTerminateAfter.Value, + Timeout = propTimeout.Value, + TrackScores = propTrackScores.Value, + TrackTotalHits = propTrackTotalHits.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropDocvalueFields, value.DocvalueFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropExt, value.Ext, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropIndicesBoost, value.IndicesBoost, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropKnn, value.Knn, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropPit, value.Pit, null, null); + writer.WriteProperty(options, PropPostFilter, value.PostFilter, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRank, value.Rank, null, null); + writer.WriteProperty(options, PropRescore, value.Rescore, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRetriever, value.Retriever, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeqNoPrimaryTerm, value.SeqNoPrimaryTerm, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminateAfter, value.TerminateAfter, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteProperty(options, PropTrackScores, value.TrackScores, null, null); + writer.WriteProperty(options, PropTrackTotalHits, value.TrackTotalHits, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); writer.WriteEndObject(); } } @@ -784,25 +687,45 @@ public override void Write(Utf8JsonWriter writer, SearchRequest value, JsonSeria /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. /// /// -[JsonConverter(typeof(SearchRequestConverter))] -public partial class SearchRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchRequestConverter))] +public partial class SearchRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SearchRequest() { } - - public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SearchRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearch; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceSearch; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -810,7 +733,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -822,7 +744,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// To override the default behavior, you can set the search.default_allow_partial_results cluster setting to false. /// /// - [JsonIgnore] public bool? AllowPartialSearchResults { get => Q("allow_partial_search_results"); set => Q("allow_partial_search_results", value); } /// @@ -831,7 +752,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -840,7 +760,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -849,7 +768,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. /// /// - [JsonIgnore] public long? BatchedReduceSize { get => Q("batched_reduce_size"); set => Q("batched_reduce_size", value); } /// @@ -857,7 +775,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If true, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. /// /// - [JsonIgnore] public bool? CcsMinimizeRoundtrips { get => Q("ccs_minimize_roundtrips"); set => Q("ccs_minimize_roundtrips", value); } /// @@ -866,7 +783,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -875,7 +791,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -885,8 +800,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// It supports comma-separated values such as open,hidden. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -895,83 +809,82 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. /// /// - [JsonIgnore] public bool? ForceSyntheticSource { get => Q("force_synthetic_source"); set => Q("force_synthetic_source", value); } + /// + /// + /// If true, concrete, expanded or aliased indices will be ignored when frozen. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } + /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// /// - /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. - /// This parameter can be used only when the q query string parameter is specified. + /// If true, the response includes the score contribution from any named queries. + /// + /// + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. /// /// - [JsonIgnore] - public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } + public bool? IncludeNamedQueriesScore { get => Q("include_named_queries_score"); set => Q("include_named_queries_score", value); } /// /// - /// The number of concurrent shard requests per node that the search runs concurrently. - /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] - public long? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } + public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// /// - /// The minimum version of the node that can handle the request. - /// Any handling node with a lower version will fail the request. + /// The number of concurrent shard requests per node that the search runs concurrently. + /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. /// /// - [JsonIgnore] - public string? MinCompatibleShardNode { get => Q("min_compatible_shard_node"); set => Q("min_compatible_shard_node", value); } + public int? MaxConcurrentShardRequests { get => Q("max_concurrent_shard_requests"); set => Q("max_concurrent_shard_requests", value); } /// /// /// The nodes and shards used for the search. - /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: + /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. + /// Valid values are: /// /// /// /// - /// _only_local to run the search only on shards on the local node; - /// - /// - /// - /// - /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method; - /// - /// - /// - /// - /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; + /// _only_local to run the search only on shards on the local node. /// /// /// /// - /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; + /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method. /// /// /// /// - /// _shards:<shard>,<shard> to run the search only on the specified shards; + /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. /// /// /// /// + /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. + /// _shards:<shard>,<shard> to run the search only on the specified shards. You can combine this value with other preference values. However, the _shards value must come first. For example: _shards:2,3|_local. /// <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order. /// /// /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -998,7 +911,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// /// /// - [JsonIgnore] public long? PreFilterShardSize { get => Q("pre_filter_shard_size"); set => Q("pre_filter_shard_size", value); } /// @@ -1011,7 +923,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If both parameters are specified, documents matching the query request body parameter are not returned. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -1020,7 +931,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// It defaults to index level settings. /// /// - [JsonIgnore] public bool? RequestCache { get => Q("request_cache"); set => Q("request_cache", value); } /// @@ -1028,7 +938,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response. /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -1036,7 +945,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -1046,7 +954,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// You can change this limit by using the search.max_keep_alive cluster-level setting. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Scroll { get => Q("scroll"); set => Q("scroll", value); } /// @@ -1054,7 +961,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Indicates how distributed term frequencies are calculated for relevance scoring. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -1064,7 +970,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -1075,7 +980,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If the _source parameter is false, this parameter is ignored. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -1083,7 +987,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The field to use for suggestions. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Field? SuggestField { get => Q("suggest_field"); set => Q("suggest_field", value); } /// @@ -1092,7 +995,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get => Q("suggest_mode"); set => Q("suggest_mode", value); } /// @@ -1101,7 +1003,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - [JsonIgnore] public long? SuggestSize { get => Q("suggest_size"); set => Q("suggest_size", value); } /// @@ -1110,7 +1011,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - [JsonIgnore] public string? SuggestText { get => Q("suggest_text"); set => Q("suggest_text", value); } /// @@ -1118,7 +1018,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If true, aggregation and suggester names are be prefixed by their respective types in the response. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -1126,15 +1025,13 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Defines the aggregations that are run as part of the search request. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// /// Collapses search results the values of the specified field. /// /// - [JsonInclude, JsonPropertyName("collapse")] public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } /// @@ -1143,15 +1040,13 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - [JsonInclude, JsonPropertyName("docvalue_fields")] - public ICollection? DocvalueFields { get; set; } + public System.Collections.Generic.ICollection? DocvalueFields { get; set; } /// /// /// If true, the request returns detailed information about score computation as part of a hit. /// /// - [JsonInclude, JsonPropertyName("explain")] public bool? Explain { get; set; } /// @@ -1159,8 +1054,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - [JsonInclude, JsonPropertyName("ext")] - public IDictionary? Ext { get; set; } + public System.Collections.Generic.IDictionary? Ext { get; set; } /// /// @@ -1168,8 +1062,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The request returns values for field names matching these patterns in the hits.fields property of the response. /// /// - [JsonInclude, JsonPropertyName("fields")] - public ICollection? Fields { get; set; } + public System.Collections.Generic.ICollection? Fields { get; set; } /// /// @@ -1178,7 +1071,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// To page through more hits, use the search_after parameter. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -1186,7 +1078,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. /// /// - [JsonInclude, JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Core.Search.Highlight? Highlight { get; set; } /// @@ -1197,25 +1088,21 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A boost value between 0 and 1.0 decreases the score. /// /// - [JsonInclude, JsonPropertyName("indices_boost")] - public ICollection>? IndicesBoost { get; set; } + public System.Collections.Generic.ICollection>? IndicesBoost { get; set; } /// /// /// The approximate kNN search to run. /// /// - [JsonInclude, JsonPropertyName("knn")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.KnnSearch))] - public ICollection? Knn { get; set; } + public System.Collections.Generic.ICollection? Knn { get; set; } /// /// /// The minimum _score for matching documents. - /// Documents with a lower _score are not included in the search results. + /// Documents with a lower _score are not included in search results and results collected by aggregations. /// /// - [JsonInclude, JsonPropertyName("min_score")] public double? MinScore { get; set; } /// @@ -1224,7 +1111,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If you provide a PIT, you cannot specify an <index> in the request path. /// /// - [JsonInclude, JsonPropertyName("pit")] public Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? Pit { get; set; } /// @@ -1234,7 +1120,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A post filter has no impact on the aggregation results. /// /// - [JsonInclude, JsonPropertyName("post_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilter { get; set; } /// @@ -1243,7 +1128,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// NOTE: This is a debugging tool and adds significant overhead to search execution. /// /// - [JsonInclude, JsonPropertyName("profile")] public bool? Profile { get; set; } /// @@ -1251,7 +1135,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The search definition using the Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -1259,7 +1142,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// The Reciprocal Rank Fusion (RRF) to use. /// /// - [JsonInclude, JsonPropertyName("rank")] public Elastic.Clients.Elasticsearch.Rank? Rank { get; set; } /// @@ -1267,9 +1149,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. /// /// - [JsonInclude, JsonPropertyName("rescore")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.Rescore))] - public ICollection? Rescore { get; set; } + public System.Collections.Generic.ICollection? Rescore { get; set; } /// /// @@ -1277,7 +1157,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A retriever replaces other elements of the search API that also return top documents such as query and knn. /// /// - [JsonInclude, JsonPropertyName("retriever")] public Elastic.Clients.Elasticsearch.Retriever? Retriever { get; set; } /// @@ -1286,31 +1165,27 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// These fields take precedence over mapped fields with the same name. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } /// /// /// Used to retrieve the next page of hits using a set of sort values from the previous page. /// /// - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// /// If true, the request returns sequence number and primary term of the last modification of each hit. /// /// - [JsonInclude, JsonPropertyName("seq_no_primary_term")] public bool? SeqNoPrimaryTerm { get; set; } /// @@ -1320,7 +1195,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// To page through more hits, use the search_after property. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -1328,7 +1202,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Split a scrolled search into multiple slices that can be consumed independently. /// /// - [JsonInclude, JsonPropertyName("slice")] public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } /// @@ -1336,9 +1209,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// A comma-separated list of <field>:<direction> pairs. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } /// /// @@ -1348,7 +1219,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Otherwise, it defaults to true. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// @@ -1358,8 +1228,7 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// You can retrieve these stats using the indices stats API. /// /// - [JsonInclude, JsonPropertyName("stats")] - public ICollection? Stats { get; set; } + public System.Collections.Generic.ICollection? Stats { get; set; } /// /// @@ -1369,8 +1238,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// You can pass _source: true to return both source fields and stored fields in the search response. /// /// - [JsonInclude, JsonPropertyName("stored_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } /// @@ -1378,7 +1245,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Defines a suggester that provides similar looking terms based on a provided text. /// /// - [JsonInclude, JsonPropertyName("suggest")] public Elastic.Clients.Elasticsearch.Core.Search.Suggester? Suggest { get; set; } /// @@ -1397,7 +1263,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If set to 0 (default), the query does not terminate early. /// /// - [JsonInclude, JsonPropertyName("terminate_after")] public long? TerminateAfter { get; set; } /// @@ -1407,7 +1272,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// Defaults to no timeout. /// /// - [JsonInclude, JsonPropertyName("timeout")] public string? Timeout { get; set; } /// @@ -1415,7 +1279,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// - [JsonInclude, JsonPropertyName("track_scores")] public bool? TrackScores { get; set; } /// @@ -1425,7 +1288,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If false, the response does not include the total number of hits matching the query. /// /// - [JsonInclude, JsonPropertyName("track_total_hits")] public Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHits { get; set; } /// @@ -1433,7 +1295,6 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// If true, the request returns the document version as part of a hit. /// /// - [JsonInclude, JsonPropertyName("version")] public bool? Version { get; set; } } @@ -1467,1438 +1328,2288 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. /// /// -public sealed partial class SearchRequestDescriptor : RequestDescriptor, SearchRequestParameters> +public readonly partial struct SearchRequestDescriptor { - internal SearchRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchRequest Instance { get; init; } - public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchRequest instance) { + Instance = instance; } - public SearchRequestDescriptor() + public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.SearchRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearch; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "search"; + public SearchRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public SearchRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public SearchRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public SearchRequestDescriptor BatchedReduceSize(long? batchedReduceSize) => Qs("batched_reduce_size", batchedReduceSize); - public SearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public SearchRequestDescriptor Df(string? df) => Qs("df", df); - public SearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public SearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public SearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public SearchRequestDescriptor MinCompatibleShardNode(string? minCompatibleShardNode) => Qs("min_compatible_shard_node", minCompatibleShardNode); - public SearchRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchRequestDescriptor PreFilterShardSize(long? preFilterShardSize) => Qs("pre_filter_shard_size", preFilterShardSize); - public SearchRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public SearchRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public SearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SearchRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public SearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public SearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public SearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? suggestField) => Qs("suggest_field", suggestField); - public SearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) => Qs("suggest_mode", suggestMode); - public SearchRequestDescriptor SuggestSize(long? suggestSize) => Qs("suggest_size", suggestSize); - public SearchRequestDescriptor SuggestText(string? suggestText) => Qs("suggest_text", suggestText); - public SearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - - public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) - { - RouteValues.Optional("index", indices); - return Self; - } - - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action> DocvalueFieldsDescriptorAction { get; set; } - private Action>[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action> HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action> KnnDescriptorAction { get; set; } - private Action>[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action> PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rank? RankValue { get; set; } - private Elastic.Clients.Elasticsearch.RankDescriptor RankDescriptor { get; set; } - private Action RankDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action> RescoreDescriptorAction { get; set; } - private Action>[] RescoreDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Retriever? RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action> RetrieverDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action> SliceDescriptorAction { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action> SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.SearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchRequest instance) => new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.SearchRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// Defines the aggregations that are run as part of the search request. + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. /// /// - public SearchRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Indices = value; + return this; } /// /// - /// Collapses search results the values of the specified field. + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - public SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AllowNoIndices(bool? value = true) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; - } - - public SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) - { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor Collapse(Action> configure) - { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.AllowNoIndices = value; + return this; } /// /// - /// An array of wildcard (*) field patterns. - /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// If true and there are shard request timeouts or shard failures, the request returns partial results. + /// If false, it returns an error with no partial results. + /// + /// + /// To override the default behavior, you can set the search.default_allow_partial_results cluster setting to false. /// /// - public SearchRequestDescriptor DocvalueFields(ICollection? docvalueFields) - { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; - } - - public SearchRequestDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AllowPartialSearchResults(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor DocvalueFields(Action> configure) - { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; - } - - public SearchRequestDescriptor DocvalueFields(params Action>[] configure) - { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } /// /// - /// If true, the request returns detailed information about score computation as part of a hit. + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public SearchRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Analyzer(string? value) { - ExplainValue = explain; - return Self; + Instance.Analyzer = value; + return this; } /// /// - /// Configuration of search extensions defined by Elasticsearch plugins. + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public SearchRequestDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AnalyzeWildcard(bool? value = true) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// /// - /// An array of wildcard (*) field patterns. - /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// The number of shard results that should be reduced at once on the coordinating node. + /// If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. /// /// - public SearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor BatchedReduceSize(long? value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; - } - - public SearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) - { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor Fields(Action> configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } - - public SearchRequestDescriptor Fields(params Action>[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.BatchedReduceSize = value; + return this; } /// /// - /// The starting document offset, which must be non-negative. - /// By default, you cannot page through more than 10,000 hits using the from and size parameters. - /// To page through more hits, use the search_after parameter. + /// If true, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. /// /// - public SearchRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) { - FromValue = from; - return Self; + Instance.CcsMinimizeRoundtrips = value; + return this; } /// /// - /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// The default operator for the query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; - } - - public SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) - { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor Highlight(Action> configure) - { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.DefaultOperator = value; + return this; } /// /// - /// Boost the _score of documents from specified indices. - /// The boost value is the factor by which scores are multiplied. - /// A boost value greater than 1.0 increases the score. - /// A boost value between 0 and 1.0 decreases the score. + /// The field to use as a default when no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public SearchRequestDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Df(string? value) { - IndicesBoostValue = indicesBoost; - return Self; + Instance.Df = value; + return this; } /// /// - /// The approximate kNN search to run. + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values such as open,hidden. /// /// - public SearchRequestDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; - } - - public SearchRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) - { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor Knn(Action> configure) - { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; - } - - public SearchRequestDescriptor Knn(params Action>[] configure) - { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + Instance.ExpandWildcards = value; + return this; } /// /// - /// The minimum _score for matching documents. - /// Documents with a lower _score are not included in the search results. + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values such as open,hidden. /// /// - public SearchRequestDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - MinScoreValue = minScore; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } /// /// - /// Limit the search to a point in time (PIT). - /// If you provide a PIT, you cannot specify an <index> in the request path. + /// Should this request force synthetic _source? + /// Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. /// /// - public SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) - { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; - } - - public SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ForceSyntheticSource(bool? value = true) { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; + Instance.ForceSyntheticSource = value; + return this; } - public SearchRequestDescriptor Pit(Action configure) + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded or aliased indices will be ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IgnoreThrottled(bool? value = true) { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; + Instance.IgnoreThrottled = value; + return this; } /// /// - /// Use the post_filter parameter to filter search results. - /// The search hits are filtered after the aggregations are calculated. - /// A post filter has no impact on the aggregation results. + /// If false, the request returns an error if it targets a missing or closed index. /// /// - public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IgnoreUnavailable(bool? value = true) { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// If true, the response includes the score contribution from any named queries. + /// + /// + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IncludeNamedQueriesScore(bool? value = true) { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; + Instance.IncludeNamedQueriesScore = value; + return this; } - public SearchRequestDescriptor PostFilter(Action> configure) + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Lenient(bool? value = true) { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.Lenient = value; + return this; } /// /// - /// Set to true to return detailed timing information about the execution of individual components in a search request. - /// NOTE: This is a debugging tool and adds significant overhead to search execution. + /// The number of concurrent shard requests per node that the search runs concurrently. + /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. /// /// - public SearchRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor MaxConcurrentShardRequests(int? value) { - ProfileValue = profile; - return Self; + Instance.MaxConcurrentShardRequests = value; + return this; } /// /// - /// The search definition using the Query DSL. + /// The nodes and shards used for the search. + /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. + /// Valid values are: + /// + /// + /// + /// + /// _only_local to run the search only on shards on the local node. + /// + /// + /// + /// + /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method. + /// + /// + /// + /// + /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. + /// + /// + /// + /// + /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. + /// _shards:<shard>,<shard> to run the search only on the specified shards. You can combine this value with other preference values. However, the _shards value must come first. For example: _shards:2,3|_local. + /// <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order. /// + /// + /// /// - public SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Preference(string? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Preference = value; + return this; } - public SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. + /// This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). + /// When unspecified, the pre-filter phase is executed if any of these conditions is met: + /// + /// + /// + /// + /// The request targets more than 128 shards. + /// + /// + /// + /// + /// The request targets one or more read-only index. + /// + /// + /// + /// + /// The primary sort of the query targets an indexed field. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PreFilterShardSize(long? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.PreFilterShardSize = value; + return this; } - public SearchRequestDescriptor Query(Action> configure) + /// + /// + /// A query in the Lucene query string syntax. + /// Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. + /// + /// + /// IMPORTANT: This parameter overrides the query parameter in the request body. + /// If both parameters are specified, documents matching the query request body parameter are not returned. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor QueryLuceneSyntax(string? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.QueryLuceneSyntax = value; + return this; } /// /// - /// The Reciprocal Rank Fusion (RRF) to use. + /// If true, the caching of search results is enabled for requests where size is 0. + /// It defaults to index level settings. /// /// - public SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? rank) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestCache(bool? value = true) { - RankDescriptor = null; - RankDescriptorAction = null; - RankValue = rank; - return Self; + Instance.RequestCache = value; + return this; } - public SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.RankDescriptor descriptor) + /// + /// + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) { - RankValue = null; - RankDescriptorAction = null; - RankDescriptor = descriptor; - return Self; + Instance.RestTotalHitsAsInt = value; + return this; } - public SearchRequestDescriptor Rank(Action configure) + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RankValue = null; - RankDescriptor = null; - RankDescriptorAction = configure; - return Self; + Instance.Routing = value; + return this; } /// /// - /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// The period to retain the search context for scrolling. + /// By default, this value cannot exceed 1d (24 hours). + /// You can change this limit by using the search.max_keep_alive cluster-level setting. /// /// - public SearchRequestDescriptor Rescore(ICollection? rescore) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; + Instance.Scroll = value; + return this; } - public SearchRequestDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) + /// + /// + /// Indicates how distributed term frequencies are calculated for relevance scoring. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.SearchType = value; + return this; } - public SearchRequestDescriptor Rescore(Action> configure) + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; + Instance.SourceExcludes = value; + return this; } - public SearchRequestDescriptor Rescore(params Action>[] configure) + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.SourceExcludes = value; + return this; } /// /// - /// A retriever is a specification to describe top documents returned from a search. - /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. /// /// - public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? retriever) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.SourceIncludes = value; + return this; } - public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.SourceIncludes = value; + return this; } - public SearchRequestDescriptor Retriever(Action> configure) + /// + /// + /// The field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? value) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; + Instance.SuggestField = value; + return this; } /// /// - /// One or more runtime fields in the search request. - /// These fields take precedence over mapped fields with the same name. + /// The field to use for suggestions. /// /// - public SearchRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestField(System.Linq.Expressions.Expression> value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.SuggestField = value; + return this; } /// /// - /// Retrieve a script evaluation (based on different fields) for each hit. + /// The suggest mode. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - public SearchRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.SuggestMode = value; + return this; } /// /// - /// Used to retrieve the next page of hits using a set of sort values from the previous page. + /// The number of suggestions to return. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - public SearchRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestSize(long? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.SuggestSize = value; + return this; } /// /// - /// If true, the request returns sequence number and primary term of the last modification of each hit. + /// The source text for which the suggestions should be returned. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. /// /// - public SearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestText(string? value) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SuggestText = value; + return this; } /// /// - /// The number of hits to return, which must not be negative. - /// By default, you cannot page through more than 10,000 hits using the from and size parameters. - /// To page through more hits, use the search_after property. + /// If true, aggregation and suggester names are be prefixed by their respective types in the response. /// /// - public SearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TypedKeys(bool? value = true) { - SizeValue = size; - return Self; + Instance.TypedKeys = value; + return this; } /// /// - /// Split a scrolled search into multiple slices that can be consumed independently. + /// Defines the aggregations that are run as part of the search request. /// /// - public SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Aggregations = value; + return this; } - public SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations() { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } - public SearchRequestDescriptor Slice(Action> configure) + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations(System.Action? action) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } /// /// - /// A comma-separated list of <field>:<direction> pairs. + /// Defines the aggregations that are run as part of the search request. /// /// - public SearchRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations(System.Action>? action) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } - public SearchRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public SearchRequestDescriptor Sort(Action> configure) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddAggregation(string key, System.Action action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } - public SearchRequestDescriptor Sort(params Action>[] configure) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddAggregation(string key, System.Action> action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// /// - /// The source fields that are returned for matching documents. - /// These fields are returned in the hits._source property of the search response. - /// If the stored_fields property is specified, the _source property defaults to false. - /// Otherwise, it defaults to true. + /// Collapses search results the values of the specified field. /// /// - public SearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - SourceValue = source; - return Self; + Instance.Collapse = value; + return this; } /// /// - /// The stats groups to associate with the search. - /// Each group maintains a statistics aggregation for its associated searches. - /// You can retrieve these stats using the indices stats API. + /// Collapses search results the values of the specified field. /// /// - public SearchRequestDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Collapse(System.Action action) { - StatsValue = stats; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// /// - /// A comma-separated list of stored fields to return as part of a hit. - /// If no fields are specified, no stored fields are included in the response. - /// If this field is specified, the _source property defaults to false. - /// You can pass _source: true to return both source fields and stored fields in the search response. + /// Collapses search results the values of the specified field. /// /// - public SearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Collapse(System.Action> action) { - StoredFieldsValue = storedFields; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// /// - /// Defines a suggester that provides similar looking terms based on a provided text. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) - { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; - } - - public SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) - { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; - } - - public SearchRequestDescriptor Suggest(Action> configure) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.DocvalueFields = value; + return this; } /// /// - /// The maximum number of documents to collect for each shard. - /// If a query reaches this limit, Elasticsearch terminates the query early. - /// Elasticsearch collects documents before sorting. - /// - /// - /// IMPORTANT: Use with caution. - /// Elasticsearch applies this property to each shard handling the request. - /// When possible, let Elasticsearch perform early termination automatically. - /// Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. - /// - /// - /// If set to 0 (default), the query does not terminate early. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public SearchRequestDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } /// /// - /// The period of time to wait for a response from each shard. - /// If no response is received before the timeout expires, the request fails and returns an error. - /// Defaults to no timeout. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public SearchRequestDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(params System.Action[] actions) { - TimeoutValue = timeout; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } /// /// - /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public SearchRequestDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(params System.Action>[] actions) { - TrackScoresValue = trackScores; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } /// /// - /// Number of hits matching the query to count accurately. - /// If true, the exact number of hits is returned at the cost of some performance. - /// If false, the response does not include the total number of hits matching the query. + /// If true, the request returns detailed information about score computation as part of a hit. /// /// - public SearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Explain(bool? value = true) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.Explain = value; + return this; } /// /// - /// If true, the request returns the document version as part of a hit. + /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public SearchRequestDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext(System.Collections.Generic.IDictionary? value) { - VersionValue = version; - return Self; + Instance.Ext = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext() { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext(System.Action? action) + { + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddExt(string key, object value) + { + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; + } - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) + { + Instance.Fields = value; + return this; + } - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) + { + Instance.Fields = [.. values]; + return this; + } - if (ExtValue is not null) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); } - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } + Instance.Fields = items; + return this; + } - writer.WriteEndArray(); - } - else if (FieldsValue is not null) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); } - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } + Instance.Fields = items; + return this; + } - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } + /// + /// + /// The starting document offset, which must be non-negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) + { + Instance.Highlight = value; + return this; + } - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Highlight(System.Action action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; + } - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Highlight(System.Action> action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; + } - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) + { + Instance.IndicesBoost = value; + return this; + } - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost() + { + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; + } - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost(System.Action? action) + { + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) + { + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(System.Collections.Generic.ICollection? value) + { + Instance.Knn = value; + return this; + } - if (RankDescriptor is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, RankDescriptor, options); - } - else if (RankDescriptorAction is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RankDescriptor(RankDescriptorAction), options); - } - else if (RankValue is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, RankValue, options); - } + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) + { + Instance.Knn = [.. values]; + return this; + } - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } + Instance.Knn = items; + return this; + } - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else if (RetrieverValue is not null) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + Instance.Knn = items; + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + /// + /// + /// The minimum _score for matching documents. + /// Documents with a lower _score are not included in search results and results collected by aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + /// + /// + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) + { + Instance.Pit = value; + return this; + } - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } + /// + /// + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pit(System.Action action) + { + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.PostFilter = value; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PostFilter(System.Action action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PostFilter(System.Action> action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + /// + /// + /// Set to true to return detailed timing information about the execution of individual components in a search request. + /// NOTE: This is a debugging tool and adds significant overhead to search execution. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Profile(bool? value = true) + { + Instance.Profile = value; + return this; + } - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } - if (StatsValue is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); - } + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } + /// + /// + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? value) + { + Instance.Rank = value; + return this; + } - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } + /// + /// + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rank(System.Action action) + { + Instance.Rank = Elastic.Clients.Elasticsearch.RankDescriptor.Build(action); + return this; + } - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(System.Collections.Generic.ICollection? value) + { + Instance.Rescore = value; + return this; + } - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) + { + Instance.Rescore = [.. values]; + return this; + } - if (TrackTotalHitsValue is not null) + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); } - if (VersionValue.HasValue) + Instance.Rescore = items; + return this; + } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.Rescore = items; + return this; } -} -/// -/// -/// Run a search. -/// -/// -/// Get search hits that match the query defined in the request. -/// You can provide search queries using the q query string parameter or the request body. -/// If both are specified, only the query parameter is used. -/// -/// -/// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. -/// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. -/// -/// -/// Search slicing -/// -/// -/// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. -/// By default the splitting is done first on the shards, then locally on each shard. -/// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. -/// -/// -/// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. -/// -/// -/// IMPORTANT: The same point-in-time ID should be used for all slices. -/// If different PIT IDs are used, slices can overlap and miss documents. -/// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. -/// -/// -public sealed partial class SearchRequestDescriptor : RequestDescriptor -{ - internal SearchRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? value) + { + Instance.Retriever = value; + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Retriever(System.Action action) + { + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Retriever(System.Action> action) + { + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Used to retrieve the next page of hits using a set of sort values from the previous page. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) + { + Instance.SearchAfter = value; + return this; + } + + /// + /// + /// Used to retrieve the next page of hits using a set of sort values from the previous page. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.SearchAfter = [.. values]; + return this; + } + + /// + /// + /// If true, the request returns sequence number and primary term of the last modification of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SeqNoPrimaryTerm(bool? value = true) + { + Instance.SeqNoPrimaryTerm = value; + return this; + } + + /// + /// + /// The number of hits to return, which must not be negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after property. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) + { + Instance.Slice = value; + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Slice(System.Action action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Slice(System.Action> action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; + } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Source(System.Func action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) + { + Instance.Suggest = value; + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest() + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest(System.Action? action) + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest(System.Action>? action) + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this property to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. + /// + /// + /// If set to 0 (default), the query does not terminate early. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Timeout(string? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackScores(bool? value = true) + { + Instance.TrackScores = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) + { + Instance.TrackTotalHits = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackTotalHits(System.Func action) + { + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; + } + + /// + /// + /// If true, the request returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Run a search. +/// +/// +/// Get search hits that match the query defined in the request. +/// You can provide search queries using the q query string parameter or the request body. +/// If both are specified, only the query parameter is used. +/// +/// +/// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. +/// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. +/// +/// +/// Search slicing +/// +/// +/// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. +/// By default the splitting is done first on the shards, then locally on each shard. +/// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. +/// +/// +/// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. +/// +/// +/// IMPORTANT: The same point-in-time ID should be used for all slices. +/// If different PIT IDs are used, slices can overlap and miss documents. +/// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. +/// +/// +public readonly partial struct SearchRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.SearchRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchRequest instance) + { + Instance = instance; + } + + public SearchRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.SearchRequest(indices); + } + + public SearchRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.SearchRequestDescriptor(Elastic.Clients.Elasticsearch.SearchRequest instance) => new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.SearchRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// If true and there are shard request timeouts or shard failures, the request returns partial results. + /// If false, it returns an error with no partial results. + /// + /// + /// To override the default behavior, you can set the search.default_allow_partial_results cluster setting to false. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AllowPartialSearchResults(bool? value = true) + { + Instance.AllowPartialSearchResults = value; + return this; + } + + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// The number of shard results that should be reduced at once on the coordinating node. + /// If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor BatchedReduceSize(long? value) + { + Instance.BatchedReduceSize = value; + return this; + } + + /// + /// + /// If true, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } + + /// + /// + /// The default operator for the query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// The field to use as a default when no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Should this request force synthetic _source? + /// Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. + /// Fetches with this enabled will be slower the enabling synthetic source natively in the index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ForceSyntheticSource(bool? value = true) + { + Instance.ForceSyntheticSource = value; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, concrete, expanded or aliased indices will be ignored when frozen. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, the response includes the score contribution from any named queries. + /// + /// + /// This functionality reruns each named query on every hit in a search response. + /// Typically, this adds a small overhead to a request. + /// However, using computationally expensive named queries on a large number of hits may add significant overhead. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IncludeNamedQueriesScore(bool? value = true) + { + Instance.IncludeNamedQueriesScore = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } + + /// + /// + /// The number of concurrent shard requests per node that the search runs concurrently. + /// This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor MaxConcurrentShardRequests(int? value) + { + Instance.MaxConcurrentShardRequests = value; + return this; + } + + /// + /// + /// The nodes and shards used for the search. + /// By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. + /// Valid values are: + /// + /// + /// + /// + /// _only_local to run the search only on shards on the local node. + /// + /// + /// + /// + /// _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method. + /// + /// + /// + /// + /// _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. + /// + /// + /// + /// + /// _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. + /// _shards:<shard>,<shard> to run the search only on the specified shards. You can combine this value with other preference values. However, the _shards value must come first. For example: _shards:2,3|_local. + /// <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. + /// This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). + /// When unspecified, the pre-filter phase is executed if any of these conditions is met: + /// + /// + /// + /// + /// The request targets more than 128 shards. + /// + /// + /// + /// + /// The request targets one or more read-only index. + /// + /// + /// + /// + /// The primary sort of the query targets an indexed field. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PreFilterShardSize(long? value) + { + Instance.PreFilterShardSize = value; + return this; + } + + /// + /// + /// A query in the Lucene query string syntax. + /// Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. + /// + /// + /// IMPORTANT: This parameter overrides the query parameter in the request body. + /// If both parameters are specified, documents matching the query request body parameter are not returned. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } + + /// + /// + /// If true, the caching of search results is enabled for requests where size is 0. + /// It defaults to index level settings. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } + + /// + /// + /// Indicates whether hits.total should be rendered as an integer or an object in the rest search response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period to retain the search context for scrolling. + /// By default, this value cannot exceed 1d (24 hours). + /// You can change this limit by using the search.max_keep_alive cluster-level setting. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } + + /// + /// + /// Indicates how distributed term frequencies are calculated for relevance scoring. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to exclude from the response. + /// You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// A comma-separated list of source fields to include in the response. + /// If this parameter is specified, only these source fields are returned. + /// You can exclude fields from this subset using the _source_excludes query parameter. + /// If the _source parameter is false, this parameter is ignored. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.SuggestField = value; + return this; + } + + /// + /// + /// The field to use for suggestions. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestField(System.Linq.Expressions.Expression> value) { + Instance.SuggestField = value; + return this; } - public SearchRequestDescriptor() + /// + /// + /// The suggest mode. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { + Instance.SuggestMode = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearch; + /// + /// + /// The number of suggestions to return. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestSize(long? value) + { + Instance.SuggestSize = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The source text for which the suggestions should be returned. + /// This parameter can be used only when the suggest_field and suggest_text query string parameters are specified. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SuggestText(string? value) + { + Instance.SuggestText = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If true, aggregation and suggester names are be prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - internal override string OperationName => "search"; + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } - public SearchRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) => Qs("allow_partial_search_results", allowPartialSearchResults); - public SearchRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public SearchRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public SearchRequestDescriptor BatchedReduceSize(long? batchedReduceSize) => Qs("batched_reduce_size", batchedReduceSize); - public SearchRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SearchRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public SearchRequestDescriptor Df(string? df) => Qs("df", df); - public SearchRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchRequestDescriptor ForceSyntheticSource(bool? forceSyntheticSource = true) => Qs("force_synthetic_source", forceSyntheticSource); - public SearchRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public SearchRequestDescriptor MaxConcurrentShardRequests(long? maxConcurrentShardRequests) => Qs("max_concurrent_shard_requests", maxConcurrentShardRequests); - public SearchRequestDescriptor MinCompatibleShardNode(string? minCompatibleShardNode) => Qs("min_compatible_shard_node", minCompatibleShardNode); - public SearchRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchRequestDescriptor PreFilterShardSize(long? preFilterShardSize) => Qs("pre_filter_shard_size", preFilterShardSize); - public SearchRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public SearchRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public SearchRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SearchRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SearchRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public SearchRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SearchRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public SearchRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public SearchRequestDescriptor SuggestField(Elastic.Clients.Elasticsearch.Field? suggestField) => Qs("suggest_field", suggestField); - public SearchRequestDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) => Qs("suggest_mode", suggestMode); - public SearchRequestDescriptor SuggestSize(long? suggestSize) => Qs("suggest_size", suggestSize); - public SearchRequestDescriptor SuggestText(string? suggestText) => Qs("suggest_text", suggestText); - public SearchRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - - public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) - { - RouteValues.Optional("index", indices); - return Self; - } - - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action DocvalueFieldsDescriptorAction { get; set; } - private Action[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action KnnDescriptorAction { get; set; } - private Action[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rank? RankValue { get; set; } - private Elastic.Clients.Elasticsearch.RankDescriptor RankDescriptor { get; set; } - private Action RankDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action RescoreDescriptorAction { get; set; } - private Action[] RescoreDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Retriever? RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action RetrieverDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action SliceDescriptorAction { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } /// /// /// Defines the aggregations that are run as part of the search request. /// /// - public SearchRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -2906,28 +3617,33 @@ public SearchRequestDescriptor Aggregations(Func /// - public SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance.Collapse = value; + return this; } - public SearchRequestDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + /// + /// + /// Collapses search results the values of the specified field. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Collapse(Action configure) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.DocvalueFields = value; + return this; } /// @@ -2936,51 +3652,61 @@ public SearchRequestDescriptor Collapse(Actionhits.fields property of the response. /// /// - public SearchRequestDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public SearchRequestDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor DocvalueFields(params System.Action>[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } - public SearchRequestDescriptor DocvalueFields(Action configure) + /// + /// + /// If true, the request returns detailed information about score computation as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Explain(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.Explain = value; + return this; } - public SearchRequestDescriptor DocvalueFields(params Action[] configure) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext(System.Collections.Generic.IDictionary? value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.Ext = value; + return this; } /// /// - /// If true, the request returns detailed information about score computation as part of a hit. + /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public SearchRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext() { - ExplainValue = explain; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -2988,10 +3714,17 @@ public SearchRequestDescriptor Explain(bool? explain = true) /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public SearchRequestDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Ext(System.Action? action) + { + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddExt(string key, object value) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; } /// @@ -3000,40 +3733,40 @@ public SearchRequestDescriptor Ext(Func, Fluent /// The request returns values for field names matching these patterns in the hits.fields property of the response. /// /// - public SearchRequestDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public SearchRequestDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public SearchRequestDescriptor Fields(Action configure) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public SearchRequestDescriptor Fields(params Action[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// @@ -3043,10 +3776,10 @@ public SearchRequestDescriptor Fields(params Actionsearch_after parameter. /// /// - public SearchRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -3054,28 +3787,35 @@ public SearchRequestDescriptor From(int? from) /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. /// /// - public SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.Highlight = value; + return this; } - public SearchRequestDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Highlight(System.Action> action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Highlight(Action configure) + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.IndicesBoost = value; + return this; } /// @@ -3086,63 +3826,82 @@ public SearchRequestDescriptor Highlight(Action0 and 1.0 decreases the score. /// /// - public SearchRequestDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost() { - IndicesBoostValue = indicesBoost; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; } /// /// - /// The approximate kNN search to run. + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. /// /// - public SearchRequestDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor IndicesBoost(System.Action? action) { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; } - public SearchRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) + { + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(System.Collections.Generic.ICollection? value) { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; + Instance.Knn = value; + return this; } - public SearchRequestDescriptor Knn(Action configure) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; + Instance.Knn = [.. values]; + return this; } - public SearchRequestDescriptor Knn(params Action[] configure) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Knn(params System.Action>[] actions) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); + } + + Instance.Knn = items; + return this; } /// /// /// The minimum _score for matching documents. - /// Documents with a lower _score are not included in the search results. + /// Documents with a lower _score are not included in search results and results collected by aggregations. /// /// - public SearchRequestDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor MinScore(double? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -3151,28 +3910,22 @@ public SearchRequestDescriptor MinScore(double? minScore) /// If you provide a PIT, you cannot specify an <index> in the request path. /// /// - public SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) - { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; - } - - public SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; + Instance.Pit = value; + return this; } - public SearchRequestDescriptor Pit(Action configure) + /// + /// + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pit(System.Action action) { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; } /// @@ -3182,28 +3935,23 @@ public SearchRequestDescriptor Pit(Action /// - public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) - { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; - } - - public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; + Instance.PostFilter = value; + return this; } - public SearchRequestDescriptor PostFilter(Action configure) + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor PostFilter(System.Action> action) { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -3212,10 +3960,10 @@ public SearchRequestDescriptor PostFilter(Action /// - public SearchRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -3223,28 +3971,32 @@ public SearchRequestDescriptor Profile(bool? profile = true) /// The search definition using the Query DSL. /// /// - public SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SearchRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Query(Action configure) + /// + /// + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Rank = value; + return this; } /// @@ -3252,28 +4004,32 @@ public SearchRequestDescriptor Query(Action /// - public SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? rank) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rank(System.Action action) { - RankDescriptor = null; - RankDescriptorAction = null; - RankValue = rank; - return Self; + Instance.Rank = Elastic.Clients.Elasticsearch.RankDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Rank(Elastic.Clients.Elasticsearch.RankDescriptor descriptor) + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(System.Collections.Generic.ICollection? value) { - RankValue = null; - RankDescriptorAction = null; - RankDescriptor = descriptor; - return Self; + Instance.Rescore = value; + return this; } - public SearchRequestDescriptor Rank(Action configure) + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) { - RankValue = null; - RankDescriptor = null; - RankDescriptorAction = configure; - return Self; + Instance.Rescore = [.. values]; + return this; } /// @@ -3281,82 +4037,126 @@ public SearchRequestDescriptor Rank(Actionquery and post_filter phases. /// /// - public SearchRequestDescriptor Rescore(ICollection? rescore) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Rescore(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); + } + + Instance.Rescore = items; + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? value) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; + Instance.Retriever = value; + return this; } - public SearchRequestDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Retriever(System.Action> action) { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Rescore(Action configure) + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = value; + return this; } - public SearchRequestDescriptor Rescore(params Action[] configure) + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings() { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// A retriever is a specification to describe top documents returned from a search. - /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? retriever) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public SearchRequestDescriptor Retriever(Action configure) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// /// - /// One or more runtime fields in the search request. - /// These fields take precedence over mapped fields with the same name. + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } + + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public SearchRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields() { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; } /// @@ -3364,10 +4164,35 @@ public SearchRequestDescriptor RuntimeMappings(Func /// - public SearchRequestDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Used to retrieve the next page of hits using a set of sort values from the previous page. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -3375,10 +4200,10 @@ public SearchRequestDescriptor ScriptFields(Func /// - public SearchRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -3386,10 +4211,10 @@ public SearchRequestDescriptor SearchAfter(ICollectiontrue, the request returns sequence number and primary term of the last modification of each hit. /// /// - public SearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SeqNoPrimaryTerm(bool? value = true) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// @@ -3399,10 +4224,21 @@ public SearchRequestDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) /// To page through more hits, use the search_after property. /// /// - public SearchRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - SizeValue = size; - return Self; + Instance.Slice = value; + return this; } /// @@ -3410,28 +4246,21 @@ public SearchRequestDescriptor Size(int? size) /// Split a scrolled search into multiple slices that can be consumed independently. /// /// - public SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) - { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; - } - - public SearchRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Slice(System.Action> action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public SearchRequestDescriptor Slice(Action configure) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } /// @@ -3439,40 +4268,41 @@ public SearchRequestDescriptor Slice(Action:<direction> pairs. /// /// - public SearchRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = [.. values]; + return this; } - public SearchRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public SearchRequestDescriptor Sort(Action configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = items; + return this; } - public SearchRequestDescriptor Sort(params Action[] configure) + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Source = value; + return this; } /// @@ -3483,10 +4313,23 @@ public SearchRequestDescriptor Sort(params Actiontrue. /// /// - public SearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Stats(System.Collections.Generic.ICollection? value) { - SourceValue = source; - return Self; + Instance.Stats = value; + return this; } /// @@ -3496,10 +4339,24 @@ public SearchRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search. /// You can retrieve these stats using the indices stats API. /// /// - public SearchRequestDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - StatsValue = stats; - return Self; + Instance.StoredFields = value; + return this; } /// @@ -3510,10 +4367,10 @@ public SearchRequestDescriptor Stats(ICollection? stats) /// You can pass _source: true to return both source fields and stored fields in the search response. /// /// - public SearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - StoredFieldsValue = storedFields; - return Self; + Instance.StoredFields = value; + return this; } /// @@ -3521,28 +4378,32 @@ public SearchRequestDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields /// Defines a suggester that provides similar looking terms based on a provided text. /// /// - public SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; + Instance.Suggest = value; + return this; } - public SearchRequestDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest() { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; } - public SearchRequestDescriptor Suggest(Action configure) + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Suggest(System.Action>? action) { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; } /// @@ -3561,10 +4422,10 @@ public SearchRequestDescriptor Suggest(Action0 (default), the query does not terminate early. /// /// - public SearchRequestDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TerminateAfter(long? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.TerminateAfter = value; + return this; } /// @@ -3574,10 +4435,10 @@ public SearchRequestDescriptor TerminateAfter(long? terminateAfter) /// Defaults to no timeout. /// /// - public SearchRequestDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Timeout(string? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } /// @@ -3585,10 +4446,10 @@ public SearchRequestDescriptor Timeout(string? timeout) /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// - public SearchRequestDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackScores(bool? value = true) { - TrackScoresValue = trackScores; - return Self; + Instance.TrackScores = value; + return this; } /// @@ -3598,439 +4459,88 @@ public SearchRequestDescriptor TrackScores(bool? trackScores = true) /// If false, the response does not include the total number of hits matching the query. /// /// - public SearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.TrackTotalHits = value; + return this; } /// /// - /// If true, the request returns the document version as part of a hit. + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. /// /// - public SearchRequestDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor TrackTotalHits(System.Func action) { - VersionValue = version; - return Self; + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the request returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Version(bool? value = true) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } - - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (ExtValue is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } - - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } - - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } - - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } - - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (RankDescriptor is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, RankDescriptor, options); - } - else if (RankDescriptorAction is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RankDescriptor(RankDescriptorAction), options); - } - else if (RankValue is not null) - { - writer.WritePropertyName("rank"); - JsonSerializer.Serialize(writer, RankValue, options); - } - - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); - } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } - - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else if (RetrieverValue is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); - } - - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + Instance.Version = value; + return this; + } - if (StatsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); + return new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchResponse.g.cs index bb1afb949ed..2f08a074a48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchResponse.g.cs @@ -17,39 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchResponse : ElasticsearchResponse +internal sealed partial class SearchResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHitsMetadata = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.SearchResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHitsMetadata = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHitsMetadata.TryReadProperty(ref reader, options, PropHitsMetadata, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + HitsMetadata = propHitsMetadata.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHitsMetadata, value.HitsMetadata, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class SearchResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SearchResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(SearchResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchResponseConverterFactory))] +public partial class SearchResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// The returned documents and metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; set; } + public double? MaxScore { get; set; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } /// /// @@ -58,28 +236,31 @@ public sealed partial class SearchResponse : ElasticsearchResponse /// This property is returned only if the scroll query parameter is specified in the request. /// /// - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } /// /// /// A count of shards used for the request. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } /// /// /// If true, the request timed out before completion; returned results may be partial or empty. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } /// /// @@ -125,6 +306,9 @@ public sealed partial class SearchResponse : ElasticsearchResponse /// /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsRequest.g.cs index ca5f0caf3ea..6227c9ba8f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchShardsRequestParameters : RequestParameters +public sealed partial class SearchShardsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,7 +42,7 @@ public sealed partial class SearchShardsRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -65,6 +58,15 @@ public sealed partial class SearchShardsRequestParameters : RequestParameters /// public bool? Local { get => Q("local"); set => Q("local", value); } + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// IT can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// The node or shard the operation should be performed on. @@ -81,6 +83,35 @@ public sealed partial class SearchShardsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } } +internal sealed partial class SearchShardsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchShardsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchShardsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the search shards. @@ -94,24 +125,45 @@ public sealed partial class SearchShardsRequestParameters : RequestParameters /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. /// /// -public sealed partial class SearchShardsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchShardsRequestConverter))] +public sealed partial class SearchShardsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SearchShardsRequest() { } - - public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SearchShardsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchShards; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceSearchShards; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "search_shards"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -119,7 +171,6 @@ public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -130,15 +181,13 @@ public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -146,16 +195,23 @@ public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas /// If true, the request retrieves information from the local node only. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// IT can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + /// /// /// The node or shard the operation should be performed on. /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -163,7 +219,6 @@ public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } } @@ -180,41 +235,194 @@ public SearchShardsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : bas /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. /// /// -public sealed partial class SearchShardsRequestDescriptor : RequestDescriptor, SearchShardsRequestParameters> +public readonly partial struct SearchShardsRequestDescriptor { - internal SearchShardsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchShardsRequest Instance { get; init; } - public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchShardsRequest instance) { + Instance = instance; + } + + public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.SearchShardsRequest(indices); } public SearchShardsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchShards; + public static explicit operator Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchShardsRequest instance) => new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "search_shards"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public SearchShardsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchShardsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchShardsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchShardsRequestDescriptor Local(bool? local = true) => Qs("local", local); - public SearchShardsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchShardsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public SearchShardsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor IgnoreUnavailable(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Local(bool? value = true) { + Instance.Local = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// IT can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchShardsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -231,40 +439,193 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. /// /// -public sealed partial class SearchShardsRequestDescriptor : RequestDescriptor +public readonly partial struct SearchShardsRequestDescriptor { - internal SearchShardsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchShardsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchShardsRequest instance) + { + Instance = instance; + } - public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.SearchShardsRequest(indices); } public SearchShardsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchShards; + public static explicit operator Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchShardsRequest instance) => new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams and indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "search_shards"; + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public SearchShardsRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchShardsRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchShardsRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchShardsRequestDescriptor Local(bool? local = true) => Qs("local", local); - public SearchShardsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchShardsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, the request retrieves information from the local node only. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// IT can also be set to -1 to indicate that the request should never timeout. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchShardsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchShardsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public SearchShardsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsResponse.g.cs index 2914a6a88f7..91af040722c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchShardsResponse.g.cs @@ -17,22 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchShardsResponse : ElasticsearchResponse +internal sealed partial class SearchShardsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("indices")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Core.SearchShards.ShardStoreIndex))] - public IReadOnlyDictionary Indices { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyCollection> Shards { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.SearchShardsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + LocalJsonValue> propNodes = default; + LocalJsonValue>> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchShardsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Nodes = propNodes.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchShardsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchShardsResponseConverter))] +public sealed partial class SearchShardsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchShardsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchShardsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateRequest.g.cs index e72ff281349..ba0e0286c88 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchTemplateRequestParameters : RequestParameters +public sealed partial class SearchTemplateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -56,7 +49,15 @@ public sealed partial class SearchTemplateRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, specified concrete, expanded, or aliased indices are not included in the response when throttled. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// @@ -111,29 +112,124 @@ public sealed partial class SearchTemplateRequestParameters : RequestParameters public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } } +internal sealed partial class SearchTemplateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.SearchTemplateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExplain = default; + LocalJsonValue propId = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propProfile = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Explain = propExplain.Value, + Id = propId.Value, + Params = propParams.Value, + Profile = propProfile.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchTemplateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Run a search with a search template. /// /// -public sealed partial class SearchTemplateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchTemplateRequestConverter))] +public sealed partial class SearchTemplateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SearchTemplateRequest() { } - - public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SearchTemplateRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchTemplate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceSearchTemplate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "search_template"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -141,7 +237,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -149,7 +244,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// If true, network round-trips are minimized for cross-cluster search requests. /// /// - [JsonIgnore] public bool? CcsMinimizeRoundtrips { get => Q("ccs_minimize_roundtrips"); set => Q("ccs_minimize_roundtrips", value); } /// @@ -160,15 +254,21 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + + /// + /// + /// If true, specified concrete, expanded, or aliased indices are not included in the response when throttled. + /// + /// + [System.Obsolete("Deprecated in '7.16.0'.")] + public bool? IgnoreThrottled { get => Q("ignore_throttled"); set => Q("ignore_throttled", value); } /// /// /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -177,7 +277,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -186,7 +285,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// If false, it is rendered as an object. /// /// - [JsonIgnore] public bool? RestTotalHitsAsInt { get => Q("rest_total_hits_as_int"); set => Q("rest_total_hits_as_int", value); } /// @@ -194,7 +292,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -203,7 +300,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// should be maintained for scrolled search. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Scroll { get => Q("scroll"); set => Q("scroll", value); } /// @@ -211,7 +307,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// The type of the search operation. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -219,7 +314,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// If true, the response prefixes aggregation and suggester names with their respective types. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -228,7 +322,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// If you specify both this and the explain query parameter, the API uses only the query parameter. /// /// - [JsonInclude, JsonPropertyName("explain")] public bool? Explain { get; set; } /// @@ -237,7 +330,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// this parameter is required. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -247,15 +339,13 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// The value is the variable value. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// If true, the query execution is profiled. /// /// - [JsonInclude, JsonPropertyName("profile")] public bool? Profile { get; set; } /// @@ -265,7 +355,6 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// parameter is required. /// /// - [JsonInclude, JsonPropertyName("source")] public string? Source { get; set; } } @@ -274,48 +363,184 @@ public SearchTemplateRequest(Elastic.Clients.Elasticsearch.Indices? indices) : b /// Run a search with a search template. /// /// -public sealed partial class SearchTemplateRequestDescriptor : RequestDescriptor, SearchTemplateRequestParameters> +public readonly partial struct SearchTemplateRequestDescriptor { - internal SearchTemplateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchTemplateRequest Instance { get; init; } - public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.SearchTemplateRequest instance) { + Instance = instance; + } + + public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.SearchTemplateRequest(indices); } public SearchTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.SearchTemplateRequest instance) => new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchTemplate; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true, network round-trips are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - internal override string OperationName => "search_template"; + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, specified concrete, expanded, or aliased indices are not included in the response when throttled. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - public SearchTemplateRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SearchTemplateRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchTemplateRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchTemplateRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SearchTemplateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SearchTemplateRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public SearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SearchTemplateRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// If true, hits.total is rendered as an integer in the response. + /// If false, it is rendered as an object. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// Specifies how long a consistent view of the index + /// should be maintained for scrolled search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } - public SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// The type of the search operation. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.SearchType = value; + return this; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string? SourceValue { get; set; } + /// + /// + /// If true, the response prefixes aggregation and suggester names with their respective types. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } /// /// @@ -323,10 +548,10 @@ public SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasti /// If you specify both this and the explain query parameter, the API uses only the query parameter. /// /// - public SearchTemplateRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -335,10 +560,10 @@ public SearchTemplateRequestDescriptor Explain(bool? explain = true) /// this parameter is required. /// /// - public SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -348,10 +573,43 @@ public SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsear /// The value is the variable value. /// /// - public SearchTemplateRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; + } + + /// + /// + /// Key-value pairs used to replace Mustache variables in the template. + /// The key is the variable name. + /// The value is the variable value. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Key-value pairs used to replace Mustache variables in the template. + /// The key is the variable name. + /// The value is the variable value. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -359,10 +617,10 @@ public SearchTemplateRequestDescriptor Params(Functrue, the query execution is profiled. /// /// - public SearchTemplateRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -372,46 +630,65 @@ public SearchTemplateRequestDescriptor Profile(bool? profile = true) /// parameter is required. /// /// - public SearchTemplateRequestDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchTemplateRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (ExplainValue.HasValue) + if (action is null) { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); + return new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -420,48 +697,184 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Run a search with a search template. /// /// -public sealed partial class SearchTemplateRequestDescriptor : RequestDescriptor +public readonly partial struct SearchTemplateRequestDescriptor { - internal SearchTemplateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchTemplateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.SearchTemplateRequest instance) + { + Instance = instance; + } - public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.SearchTemplateRequest(indices); } public SearchTemplateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceSearchTemplate; + public static explicit operator Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.SearchTemplateRequest instance) => new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "search_template"; + /// + /// + /// If true, network round-trips are minimized for cross-cluster search requests. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? value = true) + { + Instance.CcsMinimizeRoundtrips = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// Supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + [System.Obsolete("Deprecated in '7.16.0'.")] + /// + /// + /// If true, specified concrete, expanded, or aliased indices are not included in the response when throttled. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor IgnoreThrottled(bool? value = true) + { + Instance.IgnoreThrottled = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - public SearchTemplateRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public SearchTemplateRequestDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) => Qs("ccs_minimize_roundtrips", ccsMinimizeRoundtrips); - public SearchTemplateRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public SearchTemplateRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SearchTemplateRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public SearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? restTotalHitsAsInt = true) => Qs("rest_total_hits_as_int", restTotalHitsAsInt); - public SearchTemplateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public SearchTemplateRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public SearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public SearchTemplateRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + /// + /// + /// If true, hits.total is rendered as an integer in the response. + /// If false, it is rendered as an object. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RestTotalHitsAsInt(bool? value = true) + { + Instance.RestTotalHitsAsInt = value; + return this; + } - public SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.Routing = value; + return this; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private bool? ProfileValue { get; set; } - private string? SourceValue { get; set; } + /// + /// + /// Specifies how long a consistent view of the index + /// should be maintained for scrolled search. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } + + /// + /// + /// The type of the search operation. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// If true, the response prefixes aggregation and suggester names with their respective types. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } /// /// @@ -469,10 +882,10 @@ public SearchTemplateRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Ind /// If you specify both this and the explain query parameter, the API uses only the query parameter. /// /// - public SearchTemplateRequestDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -481,10 +894,23 @@ public SearchTemplateRequestDescriptor Explain(bool? explain = true) /// this parameter is required. /// /// - public SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// Key-value pairs used to replace Mustache variables in the template. + /// The key is the variable name. + /// The value is the variable value. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - IdValue = id; - return Self; + Instance.Params = value; + return this; } /// @@ -494,10 +920,30 @@ public SearchTemplateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// The value is the variable value. /// /// - public SearchTemplateRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params() { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Key-value pairs used to replace Mustache variables in the template. + /// The key is the variable name. + /// The value is the variable value. + /// + /// + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -505,10 +951,10 @@ public SearchTemplateRequestDescriptor Params(Functrue, the query execution is profiled. /// /// - public SearchTemplateRequestDescriptor Profile(bool? profile = true) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Profile(bool? value = true) { - ProfileValue = profile; - return Self; + Instance.Profile = value; + return this; } /// @@ -518,45 +964,64 @@ public SearchTemplateRequestDescriptor Profile(bool? profile = true) /// parameter is required. /// /// - public SearchTemplateRequestDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchTemplateRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (ExplainValue.HasValue) + if (action is null) { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); + return new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchTemplateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateResponse.g.cs index 051c600694e..c7b3cbad976 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchTemplateResponse.g.cs @@ -17,43 +17,227 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class SearchTemplateResponse : ElasticsearchResponse +internal sealed partial class SearchTemplateResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.SearchTemplateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHits = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + Hits = propHits.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchTemplateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class SearchTemplateResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SearchTemplateResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(SearchTemplateResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchTemplateResponseConverterFactory))] +public sealed partial class SearchTemplateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchTemplateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchTemplateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; set; } + public double? MaxScore { get; set; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +bool TimedOut { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsRequest.g.cs index e7abfbbbe1c..1403872f7e1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsRequest.g.cs @@ -17,49 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class CacheStatsRequestParameters : RequestParameters +public sealed partial class CacheStatsRequestParameters : Elastic.Transport.RequestParameters { public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class CacheStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get cache statistics. /// Get statistics about the shared cache for partially mounted indices. /// /// -public sealed partial class CacheStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestConverter))] +public sealed partial class CacheStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public CacheStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + { + } +#if NET7_0_OR_GREATER public CacheStatsRequest() { } - - public CacheStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) +#endif +#if !NET7_0_OR_GREATER + public CacheStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CacheStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsCacheStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchableSnapshotsCacheStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "searchable_snapshots.cache_stats"; - [JsonIgnore] + /// + /// + /// The names of the nodes in the cluster to target. + /// + /// + public Elastic.Clients.Elasticsearch.NodeIds? NodeId { get => P("node_id"); set => PO("node_id", value); } public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -69,35 +108,98 @@ public CacheStatsRequest(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r /// Get statistics about the shared cache for partially mounted indices. /// /// -public sealed partial class CacheStatsRequestDescriptor : RequestDescriptor +public readonly partial struct CacheStatsRequestDescriptor { - internal CacheStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest Instance { get; init; } - public CacheStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) : base(r => r.Optional("node_id", nodeId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest instance) { + Instance = instance; + } + + public CacheStatsRequestDescriptor(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(nodeId); } public CacheStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsCacheStats; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The names of the nodes in the cluster to target. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.NodeId = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "searchable_snapshots.cache_stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public CacheStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CacheStatsRequestDescriptor NodeId(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("node_id", nodeId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsResponse.g.cs index 6b810e01d41..17aeeaed6ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/CacheStatsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class CacheStatsResponse : ElasticsearchResponse +internal sealed partial class CacheStatsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponseConverter))] +public sealed partial class CacheStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CacheStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheRequest.g.cs index 92a8547f9d3..03a400a896a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class ClearCacheRequestParameters : RequestParameters +public sealed partial class ClearCacheRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -44,7 +37,7 @@ public sealed partial class ClearCacheRequestParameters : RequestParameters /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// @@ -54,36 +47,84 @@ public sealed partial class ClearCacheRequestParameters : RequestParameters public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } +internal sealed partial class ClearCacheRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Clear the cache. /// Clear indices and data streams from the shared cache for partially mounted indices. /// /// -public sealed partial class ClearCacheRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestConverter))] +public sealed partial class ClearCacheRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public ClearCacheRequest() { } - - public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public ClearCacheRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsClearCache; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchableSnapshotsClearCache; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "searchable_snapshots.clear_cache"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to clear from the cache. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -91,15 +132,13 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Whether to expand wildcard expression to concrete indices that are open, closed or both. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// /// Whether specified concrete indices should be ignored when unavailable (missing or closed) /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } } @@ -109,38 +148,138 @@ public ClearCacheRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base( /// Clear indices and data streams from the shared cache for partially mounted indices. /// /// -public sealed partial class ClearCacheRequestDescriptor : RequestDescriptor, ClearCacheRequestParameters> +public readonly partial struct ClearCacheRequestDescriptor { - internal ClearCacheRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest Instance { get; init; } - public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest instance) { + Instance = instance; + } + + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(indices); } public ClearCacheRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsClearCache; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to clear from the cache. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "searchable_snapshots.clear_cache"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } - public ClearCacheRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ClearCacheRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ClearCacheRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } - public ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor IgnoreUnavailable(bool? value = true) { - RouteValues.Optional("index", indices); - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -150,37 +289,137 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Clear indices and data streams from the shared cache for partially mounted indices. /// /// -public sealed partial class ClearCacheRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCacheRequestDescriptor { - internal ClearCacheRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest instance) + { + Instance = instance; + } - public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(indices); } public ClearCacheRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsClearCache; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to clear from the cache. + /// It supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified) + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - internal override string OperationName => "searchable_snapshots.clear_cache"; + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Whether specified concrete indices should be ignored when unavailable (missing or closed) + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public ClearCacheRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public ClearCacheRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public ClearCacheRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearCacheRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheResponse.g.cs index 7f383fe82ad..dbfcc8a5d5f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/ClearCacheResponse.g.cs @@ -17,15 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class ClearCacheResponse : ElasticsearchResponse +internal sealed partial class ClearCacheResponseConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Result, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponseConverter))] +public sealed partial class ClearCacheResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCacheResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +object Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountRequest.g.cs index 1a5e655ea4c..39dd661a7ea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class MountRequestParameters : RequestParameters +public sealed partial class MountRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -56,6 +49,72 @@ public sealed partial class MountRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class MountRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreIndexSettings = System.Text.Json.JsonEncodedText.Encode("ignore_index_settings"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexSettings = System.Text.Json.JsonEncodedText.Encode("index_settings"); + private static readonly System.Text.Json.JsonEncodedText PropRenamedIndex = System.Text.Json.JsonEncodedText.Encode("renamed_index"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propIgnoreIndexSettings = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propIndexSettings = default; + LocalJsonValue propRenamedIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreIndexSettings.TryReadProperty(ref reader, options, PropIgnoreIndexSettings, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexSettings.TryReadProperty(ref reader, options, PropIndexSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRenamedIndex.TryReadProperty(ref reader, options, PropRenamedIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreIndexSettings = propIgnoreIndexSettings.Value, + Index = propIndex.Value, + IndexSettings = propIndexSettings.Value, + RenamedIndex = propRenamedIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreIndexSettings, value.IgnoreIndexSettings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexSettings, value.IndexSettings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRenamedIndex, value.RenamedIndex, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Mount a snapshot. @@ -64,20 +123,61 @@ public sealed partial class MountRequestParameters : RequestParameters /// Manually mounting ILM-managed snapshots can interfere with ILM processes. /// /// -public sealed partial class MountRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestConverter))] +public sealed partial class MountRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsMount; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + { + Index = index; + } +#if NET7_0_OR_GREATER + public MountRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchableSnapshotsMount; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "searchable_snapshots.mount"; + /// + /// + /// The name of the repository containing the snapshot of the index to mount. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The name of the snapshot of the index to mount. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + /// /// /// The period to wait for the master node. @@ -85,7 +185,6 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -93,7 +192,6 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// The mount option for the searchable snapshot index. /// /// - [JsonIgnore] public string? Storage { get => Q("storage"); set => Q("storage", value); } /// @@ -101,7 +199,6 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// If true, the request blocks until the operation is complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// @@ -109,8 +206,7 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// The names of settings that should be removed from the index when it is mounted. /// /// - [JsonInclude, JsonPropertyName("ignore_index_settings")] - public ICollection? IgnoreIndexSettings { get; set; } + public System.Collections.Generic.ICollection? IgnoreIndexSettings { get; set; } /// /// @@ -118,23 +214,24 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// If no renamed_index is specified, this name will also be used to create the new index. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// /// The settings that should be added to the index when it is mounted. /// /// - [JsonInclude, JsonPropertyName("index_settings")] - public IDictionary? IndexSettings { get; set; } + public System.Collections.Generic.IDictionary? IndexSettings { get; set; } /// /// /// The name of the index that will be created. /// /// - [JsonInclude, JsonPropertyName("renamed_index")] public Elastic.Clients.Elasticsearch.IndexName? RenamedIndex { get; set; } } @@ -146,52 +243,109 @@ public MountRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clien /// Manually mounting ILM-managed snapshots can interfere with ILM processes. /// /// -public sealed partial class MountRequestDescriptor : RequestDescriptor +public readonly partial struct MountRequestDescriptor { - internal MountRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest Instance { get; init; } - public MountRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MountRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsMount; + public MountRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest(repository, snapshot); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public MountRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "searchable_snapshots.mount"; + /// + /// + /// The name of the repository containing the snapshot of the index to mount. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } - public MountRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public MountRequestDescriptor Storage(string? storage) => Qs("storage", storage); - public MountRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The name of the snapshot of the index to mount. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Snapshot = value; + return this; + } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public MountRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + /// + /// + /// The mount option for the searchable snapshot index. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Storage(string? value) { - RouteValues.Required("repository", repository); - return Self; + Instance.Storage = value; + return this; } - public MountRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + /// + /// + /// If true, the request blocks until the operation is complete. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor WaitForCompletion(bool? value = true) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.WaitForCompletion = value; + return this; } - private ICollection? IgnoreIndexSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private IDictionary? IndexSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? RenamedIndexValue { get; set; } + /// + /// + /// The names of settings that should be removed from the index when it is mounted. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor IgnoreIndexSettings(System.Collections.Generic.ICollection? value) + { + Instance.IgnoreIndexSettings = value; + return this; + } /// /// /// The names of settings that should be removed from the index when it is mounted. /// /// - public MountRequestDescriptor IgnoreIndexSettings(ICollection? ignoreIndexSettings) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor IgnoreIndexSettings(params string[] values) { - IgnoreIndexSettingsValue = ignoreIndexSettings; - return Self; + Instance.IgnoreIndexSettings = [.. values]; + return this; } /// @@ -200,10 +354,32 @@ public MountRequestDescriptor IgnoreIndexSettings(ICollection? ignoreInd /// If no renamed_index is specified, this name will also be used to create the new index. /// /// - public MountRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// The settings that should be added to the index when it is mounted. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor IndexSettings(System.Collections.Generic.IDictionary? value) + { + Instance.IndexSettings = value; + return this; + } + + /// + /// + /// The settings that should be added to the index when it is mounted. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor IndexSettings() { - IndexValue = index; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -211,10 +387,17 @@ public MountRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName inde /// The settings that should be added to the index when it is mounted. /// /// - public MountRequestDescriptor IndexSettings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor IndexSettings(System.Action? action) + { + Instance.IndexSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor AddIndexSetting(string key, object value) { - IndexSettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.IndexSettings ??= new System.Collections.Generic.Dictionary(); + Instance.IndexSettings.Add(key, value); + return this; } /// @@ -222,35 +405,59 @@ public MountRequestDescriptor IndexSettings(Func /// - public MountRequestDescriptor RenamedIndex(Elastic.Clients.Elasticsearch.IndexName? renamedIndex) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor RenamedIndex(Elastic.Clients.Elasticsearch.IndexName? value) { - RenamedIndexValue = renamedIndex; - return Self; + Instance.RenamedIndex = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest Build(System.Action action) { - writer.WriteStartObject(); - if (IgnoreIndexSettingsValue is not null) - { - writer.WritePropertyName("ignore_index_settings"); - JsonSerializer.Serialize(writer, IgnoreIndexSettingsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (IndexSettingsValue is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, IndexSettingsValue, options); - } + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (RenamedIndexValue is not null) - { - writer.WritePropertyName("renamed_index"); - JsonSerializer.Serialize(writer, RenamedIndexValue, options); - } + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountResponse.g.cs index 9ae28a8c3cf..a67806a640b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/MountResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class MountResponse : ElasticsearchResponse +internal sealed partial class MountResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("snapshot")] - public Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshot Snapshot { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Snapshot = propSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponseConverter))] +public sealed partial class MountResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MountResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MountResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshot Snapshot { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsRequest.g.cs index 24db2126902..13ac704e662 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class SearchableSnapshotsStatsRequestParameters : RequestParameters +public sealed partial class SearchableSnapshotsStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,35 +33,82 @@ public sealed partial class SearchableSnapshotsStatsRequestParameters : RequestP public Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? Level { get => Q("level"); set => Q("level", value); } } +internal sealed partial class SearchableSnapshotsStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get searchable snapshot statistics. /// /// -public sealed partial class SearchableSnapshotsStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestConverter))] +public sealed partial class SearchableSnapshotsStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + { + } +#if NET7_0_OR_GREATER public SearchableSnapshotsStatsRequest() { } - - public SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) +#endif +#if !NET7_0_OR_GREATER + public SearchableSnapshotsStatsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SearchableSnapshotsStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "searchable_snapshots.stats"; + /// + /// + /// A comma-separated list of data streams and indices to retrieve statistics for. + /// + /// + public Elastic.Clients.Elasticsearch.Indices? Indices { get => P("index"); set => PO("index", value); } + /// /// /// Return stats aggregated at cluster, index or shard level /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? Level { get => Q("level"); set => Q("level", value); } } @@ -77,36 +117,104 @@ public SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Indices? in /// Get searchable snapshot statistics. /// /// -public sealed partial class SearchableSnapshotsStatsRequestDescriptor : RequestDescriptor, SearchableSnapshotsStatsRequestParameters> +public readonly partial struct SearchableSnapshotsStatsRequestDescriptor { - internal SearchableSnapshotsStatsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest instance) + { + Instance = instance; + } - public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(indices); } public SearchableSnapshotsStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsStats; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A comma-separated list of data streams and indices to retrieve statistics for. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Return stats aggregated at cluster, index or shard level + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? value) + { + Instance.Level = value; + return this; + } - internal override string OperationName => "searchable_snapshots.stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public SearchableSnapshotsStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? level) => Qs("level", level); + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public SearchableSnapshotsStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor FilterPath(params string[]? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.FilterPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Human(bool? value) { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -115,35 +223,103 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Get searchable snapshot statistics. /// /// -public sealed partial class SearchableSnapshotsStatsRequestDescriptor : RequestDescriptor +public readonly partial struct SearchableSnapshotsStatsRequestDescriptor { - internal SearchableSnapshotsStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest Instance { get; init; } - public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => r.Optional("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest instance) { + Instance = instance; + } + + public SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Indices? indices) + { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(indices); } public SearchableSnapshotsStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SearchableSnapshotsStats; + public static explicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest instance) => new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A comma-separated list of data streams and indices to retrieve statistics for. + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) + { + Instance.Indices = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Return stats aggregated at cluster, index or shard level + /// + /// + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? value) + { + Instance.Level = value; + return this; + } - internal override string OperationName => "searchable_snapshots.stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public SearchableSnapshotsStatsRequestDescriptor Level(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel? level) => Qs("level", level); + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public SearchableSnapshotsStatsRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("index", indices); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsResponse.g.cs index fc66cfe509e..0e47829487b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchableSnapshots/SearchableSnapshotsStatsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public sealed partial class SearchableSnapshotsStatsResponse : ElasticsearchResponse +internal sealed partial class SearchableSnapshotsStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStats = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stats = propStats.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponseConverter))] +public sealed partial class SearchableSnapshotsStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("stats")] - public object Stats { get; init; } - [JsonInclude, JsonPropertyName("total")] - public object Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotsStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchableSnapshotsStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + object Stats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs index 9ffd640adb8..9a433b7354a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ActivateUserProfileRequestParameters : RequestParameters +public sealed partial class ActivateUserProfileRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ActivateUserProfileRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropGrantType = System.Text.Json.JsonEncodedText.Encode("grant_type"); + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propGrantType = default; + LocalJsonValue propPassword = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propGrantType.TryReadProperty(ref reader, options, PropGrantType, null)) + { + continue; + } + + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + GrantType = propGrantType.Value, + Password = propPassword.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropGrantType, value.GrantType, null, null); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Activate a user profile. @@ -56,11 +115,34 @@ public sealed partial class ActivateUserProfileRequestParameters : RequestParame /// Any updates do not change existing content for either the labels or data fields. /// /// -public sealed partial class ActivateUserProfileRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestConverter))] +public sealed partial class ActivateUserProfileRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Security.GrantType grantType) + { + GrantType = grantType; + } +#if NET7_0_OR_GREATER + public ActivateUserProfileRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ActivateUserProfileRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityActivateUserProfile; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -74,7 +156,6 @@ public sealed partial class ActivateUserProfileRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("access_token")] public string? AccessToken { get; set; } /// @@ -82,8 +163,11 @@ public sealed partial class ActivateUserProfileRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("grant_type")] - public Elastic.Clients.Elasticsearch.Security.GrantType GrantType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.GrantType GrantType { get; set; } /// /// @@ -92,7 +176,6 @@ public sealed partial class ActivateUserProfileRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -102,7 +185,6 @@ public sealed partial class ActivateUserProfileRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("username")] public string? Username { get; set; } } @@ -128,26 +210,23 @@ public sealed partial class ActivateUserProfileRequest : PlainRequestlabels or data fields. /// /// -public sealed partial class ActivateUserProfileRequestDescriptor : RequestDescriptor +public readonly partial struct ActivateUserProfileRequestDescriptor { - internal ActivateUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest Instance { get; init; } - public ActivateUserProfileRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ActivateUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.activate_user_profile"; + public ActivateUserProfileRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? AccessTokenValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GrantType GrantTypeValue { get; set; } - private string? PasswordValue { get; set; } - private string? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest instance) => new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -157,10 +236,10 @@ public ActivateUserProfileRequestDescriptor() /// It is not valid with other grant types. /// /// - public ActivateUserProfileRequestDescriptor AccessToken(string? accessToken) + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor AccessToken(string? value) { - AccessTokenValue = accessToken; - return Self; + Instance.AccessToken = value; + return this; } /// @@ -168,10 +247,10 @@ public ActivateUserProfileRequestDescriptor AccessToken(string? accessToken) /// The type of grant. /// /// - public ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.GrantType grantType) + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.GrantType value) { - GrantTypeValue = grantType; - return Self; + Instance.GrantType = value; + return this; } /// @@ -181,10 +260,10 @@ public ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsea /// It is not valid with other grant types. /// /// - public ActivateUserProfileRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -194,35 +273,59 @@ public ActivateUserProfileRequestDescriptor Password(string? password) /// It is not valid with other grant types. /// /// - public ActivateUserProfileRequestDescriptor Username(string? username) + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor Username(string? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AccessTokenValue)) - { - writer.WritePropertyName("access_token"); - writer.WriteStringValue(AccessTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("grant_type"); - JsonSerializer.Serialize(writer, GrantTypeValue, options); - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(UsernameValue)) - { - writer.WritePropertyName("username"); - writer.WriteStringValue(UsernameValue); - } + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs index e3935e35022..4da626075f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs @@ -17,29 +17,148 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ActivateUserProfileResponse : ElasticsearchResponse +internal sealed partial class ActivateUserProfileResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("data")] - public IReadOnlyDictionary Data { get; init; } - [JsonInclude, JsonPropertyName("_doc")] - public Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool? Enabled { get; init; } - [JsonInclude, JsonPropertyName("labels")] - public IReadOnlyDictionary Labels { get; init; } - [JsonInclude, JsonPropertyName("last_synchronized")] - public long LastSynchronized { get; init; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; init; } - [JsonInclude, JsonPropertyName("user")] - public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("_doc"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropLastSynchronized = System.Text.Json.JsonEncodedText.Encode("last_synchronized"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propData = default; + LocalJsonValue propDoc = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propLabels = default; + LocalJsonValue propLastSynchronized = default; + LocalJsonValue propUid = default; + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propLastSynchronized.TryReadProperty(ref reader, options, PropLastSynchronized, null)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Doc = propDoc.Value, + Enabled = propEnabled.Value, + Labels = propLabels.Value, + LastSynchronized = propLastSynchronized.Value, + Uid = propUid.Value, + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLastSynchronized, value.LastSynchronized, null, null); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponseConverter))] +public sealed partial class ActivateUserProfileResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ActivateUserProfileResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ActivateUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Data { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; set; } + public bool? Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Labels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LastSynchronized { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs index e070e72ef85..c900f045095 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class AuthenticateRequestParameters : RequestParameters +public sealed partial class AuthenticateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class AuthenticateRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.AuthenticateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -45,11 +67,28 @@ public sealed partial class AuthenticateRequestParameters : RequestParameters /// If the user cannot be authenticated, this API returns a 401 status code. /// /// -public sealed partial class AuthenticateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticateRequestConverter))] +public sealed partial class AuthenticateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; +#if NET7_0_OR_GREATER + public AuthenticateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public AuthenticateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityAuthenticate; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -67,23 +106,76 @@ public sealed partial class AuthenticateRequest : PlainRequest /// -public sealed partial class AuthenticateRequestDescriptor : RequestDescriptor +public readonly partial struct AuthenticateRequestDescriptor { - internal AuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.AuthenticateRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.AuthenticateRequest instance) + { + Instance = instance; + } public AuthenticateRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; + public static explicit operator Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.AuthenticateRequest instance) => new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.AuthenticateRequest(Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.AuthenticateRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.AuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.AuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.authenticate"; + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs index 0ce01ead1df..02e75cb179e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs @@ -17,37 +17,192 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class AuthenticateResponse : ElasticsearchResponse +internal sealed partial class AuthenticateResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("api_key")] - public Elastic.Clients.Elasticsearch.Security.AuthenticateApiKey? ApiKey { get; init; } - [JsonInclude, JsonPropertyName("authentication_realm")] - public Elastic.Clients.Elasticsearch.Security.RealmInfo AuthenticationRealm { get; init; } - [JsonInclude, JsonPropertyName("authentication_type")] - public string AuthenticationType { get; init; } - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("lookup_realm")] - public Elastic.Clients.Elasticsearch.Security.RealmInfo LookupRealm { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("token")] - public Elastic.Clients.Elasticsearch.Security.AuthenticateToken? Token { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationRealm = System.Text.Json.JsonEncodedText.Encode("authentication_realm"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationType = System.Text.Json.JsonEncodedText.Encode("authentication_type"); + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropLookupRealm = System.Text.Json.JsonEncodedText.Encode("lookup_realm"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propAuthenticationRealm = default; + LocalJsonValue propAuthenticationType = default; + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue propLookupRealm = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propToken = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propAuthenticationRealm.TryReadProperty(ref reader, options, PropAuthenticationRealm, null)) + { + continue; + } + + if (propAuthenticationType.TryReadProperty(ref reader, options, PropAuthenticationType, null)) + { + continue; + } + + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propLookupRealm.TryReadProperty(ref reader, options, PropLookupRealm, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + AuthenticationRealm = propAuthenticationRealm.Value, + AuthenticationType = propAuthenticationType.Value, + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + LookupRealm = propLookupRealm.Value, + Metadata = propMetadata.Value, + Roles = propRoles.Value, + Token = propToken.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropAuthenticationRealm, value.AuthenticationRealm, null, null); + writer.WriteProperty(options, PropAuthenticationType, value.AuthenticationType, null, null); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropLookupRealm, value.LookupRealm, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticateResponseConverter))] +public sealed partial class AuthenticateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticateApiKey? ApiKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.RealmInfo AuthenticationRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string AuthenticationType { get; set; } + public string? Email { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public string? FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.RealmInfo LookupRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public Elastic.Clients.Elasticsearch.Security.AuthenticateToken? Token { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs index c078ddfd772..c0fb4e82f41 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkDeleteRoleRequestParameters : RequestParameters +public sealed partial class BulkDeleteRoleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,45 @@ public sealed partial class BulkDeleteRoleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class BulkDeleteRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + + public override Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNames = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Names = propNames.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Bulk delete roles. @@ -49,11 +81,34 @@ public sealed partial class BulkDeleteRoleRequestParameters : RequestParameters /// The bulk delete roles API cannot delete roles that are defined in roles files. /// /// -public sealed partial class BulkDeleteRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestConverter))] +public sealed partial class BulkDeleteRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkDeleteRole; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkDeleteRoleRequest(System.Collections.Generic.ICollection names) + { + Names = names; + } +#if NET7_0_OR_GREATER + public BulkDeleteRoleRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkDeleteRoleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkDeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityBulkDeleteRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; @@ -64,7 +119,6 @@ public sealed partial class BulkDeleteRoleRequest : PlainRequesttrue (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -72,8 +126,11 @@ public sealed partial class BulkDeleteRoleRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("names")] - public ICollection Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } } /// @@ -85,42 +142,104 @@ public sealed partial class BulkDeleteRoleRequest : PlainRequest /// -public sealed partial class BulkDeleteRoleRequestDescriptor : RequestDescriptor +public readonly partial struct BulkDeleteRoleRequestDescriptor { - internal BulkDeleteRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest Instance { get; init; } - public BulkDeleteRoleRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkDeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkDeleteRole; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; + public BulkDeleteRoleRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.bulk_delete_role"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor descriptor) => descriptor.Instance; - public BulkDeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - private ICollection NamesValue { get; set; } + /// + /// + /// An array of role names to delete + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor Names(System.Collections.Generic.ICollection value) + { + Instance.Names = value; + return this; + } /// /// /// An array of role names to delete /// /// - public BulkDeleteRoleRequestDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor Names(params string[] values) { - NamesValue = names; - return Self; + Instance.Names = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("names"); - JsonSerializer.Serialize(writer, NamesValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs index c09c14e8c35..d0df3a3ec71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs @@ -17,38 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkDeleteRoleResponse : ElasticsearchResponse +internal sealed partial class BulkDeleteRoleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropNotFound = System.Text.Json.JsonEncodedText.Encode("not_found"); + + public override Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDeleted = default; + LocalJsonValue propErrors = default; + LocalJsonValue?> propNotFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propNotFound.TryReadProperty(ref reader, options, PropNotFound, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deleted = propDeleted.Value, + Errors = propErrors.Value, + NotFound = propNotFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropNotFound, value.NotFound, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponseConverter))] +public sealed partial class BulkDeleteRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkDeleteRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkDeleteRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Array of deleted roles /// /// - [JsonInclude, JsonPropertyName("deleted")] - public IReadOnlyCollection? Deleted { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Deleted { get; set; } /// /// /// Present if any deletes resulted in errors /// /// - [JsonInclude, JsonPropertyName("errors")] - public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; init; } + public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; set; } /// /// /// Array of roles that could not be found /// /// - [JsonInclude, JsonPropertyName("not_found")] - public IReadOnlyCollection? NotFound { get; init; } + public System.Collections.Generic.IReadOnlyCollection? NotFound { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleRequest.g.cs index 15cd7c44396..369f4e686a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkPutRoleRequestParameters : RequestParameters +public sealed partial class BulkPutRoleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,45 @@ public sealed partial class BulkPutRoleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class BulkPutRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + + public override Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRoles = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Roles = propRoles.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Bulk create or update roles. @@ -49,11 +81,34 @@ public sealed partial class BulkPutRoleRequestParameters : RequestParameters /// The bulk create or update roles API cannot update roles that are defined in roles files. /// /// -public sealed partial class BulkPutRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestConverter))] +public sealed partial class BulkPutRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkPutRoleRequest(System.Collections.Generic.IDictionary roles) + { + Roles = roles; + } +#if NET7_0_OR_GREATER + public BulkPutRoleRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkPutRoleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityBulkPutRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -64,7 +119,6 @@ public sealed partial class BulkPutRoleRequest : PlainRequesttrue (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -72,8 +126,11 @@ public sealed partial class BulkPutRoleRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("roles")] - public IDictionary Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary Roles { get; set; } } /// @@ -85,43 +142,183 @@ public sealed partial class BulkPutRoleRequest : PlainRequest /// -public sealed partial class BulkPutRoleRequestDescriptor : RequestDescriptor, BulkPutRoleRequestParameters> +public readonly partial struct BulkPutRoleRequestDescriptor { - internal BulkPutRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkPutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest instance) + { + Instance = instance; + } public BulkPutRoleRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + public static explicit operator Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(System.Collections.Generic.IDictionary value) + { + Instance.Roles = value; + return this; + } - internal override string OperationName => "security.bulk_put_role"; + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles() + { + Instance.Roles = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - public BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(System.Action? action) + { + Instance.Roles = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } - private IDictionary> RolesValue { get; set; } + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(System.Action>? action) + { + Instance.Roles = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, value); + return this; + } /// /// /// A dictionary of role name to RoleDescriptor objects to add or update /// /// - public BulkPutRoleRequestDescriptor Roles(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(string key) { - RolesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Roles = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(params string[] keys) { - writer.WriteStartObject(); - writer.WritePropertyName("roles"); - JsonSerializer.Serialize(writer, RolesValue, options); - writer.WriteEndObject(); + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + } + + Instance.Roles = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key, System.Action? action) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key, System.Action>? action) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -134,42 +331,164 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The bulk create or update roles API cannot update roles that are defined in roles files. /// /// -public sealed partial class BulkPutRoleRequestDescriptor : RequestDescriptor +public readonly partial struct BulkPutRoleRequestDescriptor { - internal BulkPutRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkPutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest instance) + { + Instance = instance; + } public BulkPutRoleRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + public static explicit operator Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(System.Collections.Generic.IDictionary value) + { + Instance.Roles = value; + return this; + } - internal override string OperationName => "security.bulk_put_role"; + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles() + { + Instance.Roles = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - public BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(System.Action>? action) + { + Instance.Roles = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } - private IDictionary RolesValue { get; set; } + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, value); + return this; + } /// /// /// A dictionary of role name to RoleDescriptor objects to add or update /// /// - public BulkPutRoleRequestDescriptor Roles(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(string key) { - RolesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Roles = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Roles(params string[] keys) { - writer.WriteStartObject(); - writer.WritePropertyName("roles"); - JsonSerializer.Serialize(writer, RolesValue, options); - writer.WriteEndObject(); + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + } + + Instance.Roles = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor AddRole(string key, System.Action>? action) + { + Instance.Roles ??= new System.Collections.Generic.Dictionary(); + Instance.Roles.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleResponse.g.cs index 82e4e4312b5..3699e740c18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkPutRoleResponse.g.cs @@ -17,46 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkPutRoleResponse : ElasticsearchResponse +internal sealed partial class BulkPutRoleResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropNoop = System.Text.Json.JsonEncodedText.Encode("noop"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + + public override Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCreated = default; + LocalJsonValue propErrors = default; + LocalJsonValue?> propNoop = default; + LocalJsonValue?> propUpdated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propNoop.TryReadProperty(ref reader, options, PropNoop, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value, + Errors = propErrors.Value, + Noop = propNoop.Value, + Updated = propUpdated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropNoop, value.Noop, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUpdated, value.Updated, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponseConverter))] +public sealed partial class BulkPutRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkPutRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkPutRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Array of created roles /// /// - [JsonInclude, JsonPropertyName("created")] - public IReadOnlyCollection? Created { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Created { get; set; } /// /// /// Present if any updates resulted in errors /// /// - [JsonInclude, JsonPropertyName("errors")] - public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; init; } + public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; set; } /// /// /// Array of role names without any changes /// /// - [JsonInclude, JsonPropertyName("noop")] - public IReadOnlyCollection? Noop { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Noop { get; set; } /// /// /// Array of updated roles /// /// - [JsonInclude, JsonPropertyName("updated")] - public IReadOnlyCollection? Updated { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Updated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysRequest.g.cs index c0d3ded7557..648849c7bf1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkUpdateApiKeysRequestParameters : RequestParameters +public sealed partial class BulkUpdateApiKeysRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class BulkUpdateApiKeysRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptors = System.Text.Json.JsonEncodedText.Encode("role_descriptors"); + + public override Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiration = default; + LocalJsonValue> propIds = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRoleDescriptors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRoleDescriptors.TryReadProperty(ref reader, options, PropRoleDescriptors, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expiration = propExpiration.Value, + Ids = propIds.Value, + Metadata = propMetadata.Value, + RoleDescriptors = propRoleDescriptors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropIds, value.Ids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoleDescriptors, value.RoleDescriptors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Bulk update API keys. @@ -60,11 +119,34 @@ public sealed partial class BulkUpdateApiKeysRequestParameters : RequestParamete /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. /// /// -public sealed partial class BulkUpdateApiKeysRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestConverter))] +public sealed partial class BulkUpdateApiKeysRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkUpdateApiKeys; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkUpdateApiKeysRequest(System.Collections.Generic.ICollection ids) + { + Ids = ids; + } +#if NET7_0_OR_GREATER + public BulkUpdateApiKeysRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkUpdateApiKeysRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityBulkUpdateApiKeys; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -77,7 +159,6 @@ public sealed partial class BulkUpdateApiKeysRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("expiration")] public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } /// @@ -85,9 +166,11 @@ public sealed partial class BulkUpdateApiKeysRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("ids")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection Ids { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Ids { get; set; } /// /// @@ -96,8 +179,7 @@ public sealed partial class BulkUpdateApiKeysRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// @@ -110,8 +192,7 @@ public sealed partial class BulkUpdateApiKeysRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("role_descriptors")] - public IDictionary? RoleDescriptors { get; set; } + public System.Collections.Generic.IDictionary? RoleDescriptors { get; set; } } /// @@ -140,26 +221,23 @@ public sealed partial class BulkUpdateApiKeysRequest : PlainRequest /// -public sealed partial class BulkUpdateApiKeysRequestDescriptor : RequestDescriptor, BulkUpdateApiKeysRequestParameters> +public readonly partial struct BulkUpdateApiKeysRequestDescriptor { - internal BulkUpdateApiKeysRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest Instance { get; init; } - public BulkUpdateApiKeysRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkUpdateApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkUpdateApiKeys; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.bulk_update_api_keys"; + public BulkUpdateApiKeysRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private ICollection IdsValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private IDictionary> RoleDescriptorsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest instance) => new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -168,10 +246,21 @@ public BulkUpdateApiKeysRequestDescriptor() /// This property can be omitted to leave the value unchanged. /// /// - public BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// The API key identifiers. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Ids(System.Collections.Generic.ICollection value) { - ExpirationValue = expiration; - return Self; + Instance.Ids = value; + return this; } /// @@ -179,10 +268,36 @@ public BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients. /// The API key identifiers. /// /// - public BulkUpdateApiKeysRequestDescriptor Ids(ICollection ids) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Ids(params string[] values) + { + Instance.Ids = [.. values]; + return this; + } + + /// + /// + /// Arbitrary nested metadata to associate with the API keys. + /// Within the metadata object, top-level keys beginning with an underscore (_) are reserved for system usage. + /// Any information specified with this parameter fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) + { + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary nested metadata to associate with the API keys. + /// Within the metadata object, top-level keys beginning with an underscore (_) are reserved for system usage. + /// Any information specified with this parameter fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata() { - IdsValue = ids; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -192,10 +307,34 @@ public BulkUpdateApiKeysRequestDescriptor Ids(ICollection ids /// Any information specified with this parameter fully replaces metadata previously associated with the API key. /// /// - public BulkUpdateApiKeysRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } + + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.RoleDescriptors = value; + return this; } /// @@ -209,36 +348,162 @@ public BulkUpdateApiKeysRequestDescriptor Metadata(Func /// - public BulkUpdateApiKeysRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors() { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(System.Action? action) { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } - writer.WritePropertyName("ids"); - SingleOrManySerializationHelper.Serialize(IdsValue, writer, options); - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } + + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } - if (RoleDescriptorsValue is not null) + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key, System.Action? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -268,26 +533,23 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. /// /// -public sealed partial class BulkUpdateApiKeysRequestDescriptor : RequestDescriptor +public readonly partial struct BulkUpdateApiKeysRequestDescriptor { - internal BulkUpdateApiKeysRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest Instance { get; init; } - public BulkUpdateApiKeysRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkUpdateApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkUpdateApiKeys; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.bulk_update_api_keys"; + public BulkUpdateApiKeysRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private ICollection IdsValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private IDictionary RoleDescriptorsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest instance) => new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -296,10 +558,21 @@ public BulkUpdateApiKeysRequestDescriptor() /// This property can be omitted to leave the value unchanged. /// /// - public BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// The API key identifiers. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Ids(System.Collections.Generic.ICollection value) { - ExpirationValue = expiration; - return Self; + Instance.Ids = value; + return this; } /// @@ -307,10 +580,10 @@ public BulkUpdateApiKeysRequestDescriptor Expiration(Elastic.Clients.Elasticsear /// The API key identifiers. /// /// - public BulkUpdateApiKeysRequestDescriptor Ids(ICollection ids) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Ids(params string[] values) { - IdsValue = ids; - return Self; + Instance.Ids = [.. values]; + return this; } /// @@ -320,10 +593,43 @@ public BulkUpdateApiKeysRequestDescriptor Ids(ICollection ids) /// Any information specified with this parameter fully replaces metadata previously associated with the API key. /// /// - public BulkUpdateApiKeysRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary nested metadata to associate with the API keys. + /// Within the metadata object, top-level keys beginning with an underscore (_) are reserved for system usage. + /// Any information specified with this parameter fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary nested metadata to associate with the API keys. + /// Within the metadata object, top-level keys beginning with an underscore (_) are reserved for system usage. + /// Any information specified with this parameter fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -337,35 +643,154 @@ public BulkUpdateApiKeysRequestDescriptor Metadata(Func /// - public BulkUpdateApiKeysRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors() { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - writer.WritePropertyName("ids"); - SingleOrManySerializationHelper.Serialize(IdsValue, writer, options); - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } + + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } - if (RoleDescriptorsValue is not null) + /// + /// + /// The role descriptors to assign to the API keys. + /// An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, supply the role_descriptors parameter as an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysResponse.g.cs index 2cd808cde1d..4a614d087c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/BulkUpdateApiKeysResponse.g.cs @@ -17,21 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class BulkUpdateApiKeysResponse : ElasticsearchResponse +internal sealed partial class BulkUpdateApiKeysResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("errors")] - public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; init; } - [JsonInclude, JsonPropertyName("noops")] - public IReadOnlyCollection Noops { get; init; } - [JsonInclude, JsonPropertyName("updated")] - public IReadOnlyCollection Updated { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropNoops = System.Text.Json.JsonEncodedText.Encode("noops"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + + public override Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrors = default; + LocalJsonValue> propNoops = default; + LocalJsonValue> propUpdated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propNoops.TryReadProperty(ref reader, options, PropNoops, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Errors = propErrors.Value, + Noops = propNoops.Value, + Updated = propUpdated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropNoops, value.Noops, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUpdated, value.Updated, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponseConverter))] +public sealed partial class BulkUpdateApiKeysResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkUpdateApiKeysResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkUpdateApiKeysResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Security.BulkError? Errors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Noops { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Updated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs index 4c483138389..9f681973de9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ChangePasswordRequestParameters : RequestParameters +public sealed partial class ChangePasswordRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,54 @@ public sealed partial class ChangePasswordRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class ChangePasswordRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropPasswordHash = System.Text.Json.JsonEncodedText.Encode("password_hash"); + + public override Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPassword = default; + LocalJsonValue propPasswordHash = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propPasswordHash.TryReadProperty(ref reader, options, PropPasswordHash, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Password = propPassword.Value, + PasswordHash = propPasswordHash.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropPasswordHash, value.PasswordHash, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Change passwords. @@ -48,30 +89,49 @@ public sealed partial class ChangePasswordRequestParameters : RequestParameters /// Change the passwords of users in the native realm and built-in users. /// /// -public sealed partial class ChangePasswordRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestConverter))] +public sealed partial class ChangePasswordRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : base(r => r.Optional("username", username)) + { + } +#if NET7_0_OR_GREATER public ChangePasswordRequest() { } - - public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : base(r => r.Optional("username", username)) +#endif +#if !NET7_0_OR_GREATER + public ChangePasswordRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChangePasswordRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityChangePassword; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityChangePassword; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.change_password"; + /// + /// + /// The user whose password you want to change. If you do not specify this + /// parameter, the password is changed for the current user. + /// + /// + public Elastic.Clients.Elasticsearch.Username? Username { get => P("username"); set => PO("username", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -79,7 +139,6 @@ public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : /// The new password value. Passwords must be at least 6 characters long. /// /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -90,7 +149,6 @@ public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : /// setting. /// /// - [JsonInclude, JsonPropertyName("password_hash")] public string? PasswordHash { get; set; } } @@ -102,46 +160,61 @@ public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : /// Change the passwords of users in the native realm and built-in users. /// /// -public sealed partial class ChangePasswordRequestDescriptor : RequestDescriptor +public readonly partial struct ChangePasswordRequestDescriptor { - internal ChangePasswordRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest Instance { get; init; } - public ChangePasswordRequestDescriptor(Elastic.Clients.Elasticsearch.Username? username) : base(r => r.Optional("username", username)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChangePasswordRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest instance) { + Instance = instance; } - public ChangePasswordRequestDescriptor() + public ChangePasswordRequestDescriptor(Elastic.Clients.Elasticsearch.Username? username) { + Instance = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(username); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityChangePassword; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.change_password"; + public ChangePasswordRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ChangePasswordRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest instance) => new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor descriptor) => descriptor.Instance; - public ChangePasswordRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + /// + /// + /// The user whose password you want to change. If you do not specify this + /// parameter, the password is changed for the current user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - RouteValues.Optional("username", username); - return Self; + Instance.Username = value; + return this; } - private string? PasswordValue { get; set; } - private string? PasswordHashValue { get; set; } + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// /// The new password value. Passwords must be at least 6 characters long. /// /// - public ChangePasswordRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -152,27 +225,64 @@ public ChangePasswordRequestDescriptor Password(string? password) /// setting. /// /// - public ChangePasswordRequestDescriptor PasswordHash(string? passwordHash) + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor PasswordHash(string? value) { - PasswordHashValue = passwordHash; - return Self; + Instance.PasswordHash = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(PasswordValue)) + if (action is null) { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); + return new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(PasswordHashValue)) - { - writer.WritePropertyName("password_hash"); - writer.WriteStringValue(PasswordHashValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs index 00c66d00ff6..8bfaee55f6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ChangePasswordResponse : ElasticsearchResponse +internal sealed partial class ChangePasswordResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ChangePasswordResponseConverter))] +public sealed partial class ChangePasswordResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChangePasswordResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChangePasswordResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs index 48b0f598878..9ff0160f8b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearApiKeyCacheRequestParameters : RequestParameters +public sealed partial class ClearApiKeyCacheRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ClearApiKeyCacheRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -43,19 +65,44 @@ public sealed partial class ClearApiKeyCacheRequestParameters : RequestParameter /// The cache is also automatically cleared on state changes of the security index. /// /// -public sealed partial class ClearApiKeyCacheRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestConverter))] +public sealed partial class ClearApiKeyCacheRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Ids ids) : base(r => r.Required("ids", ids)) { } +#if NET7_0_OR_GREATER + public ClearApiKeyCacheRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityClearApiKeyCache; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "security.clear_api_key_cache"; + + /// + /// + /// Comma-separated list of API key IDs to evict from the API key cache. + /// To evict all API keys, use *. + /// Does not support other wildcard patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Ids { get => P("ids"); set => PR("ids", value); } } /// @@ -67,29 +114,90 @@ public ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Ids ids) : base(r = /// The cache is also automatically cleared on state changes of the security index. /// /// -public sealed partial class ClearApiKeyCacheRequestDescriptor : RequestDescriptor +public readonly partial struct ClearApiKeyCacheRequestDescriptor { - internal ClearApiKeyCacheRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest Instance { get; init; } - public ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Ids ids) : base(r => r.Required("ids", ids)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + public ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Ids ids) + { + Instance = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest(ids); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearApiKeyCacheRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest instance) => new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Comma-separated list of API key IDs to evict from the API key cache. + /// To evict all API keys, use *. + /// Does not support other wildcard patterns. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids value) + { + Instance.Ids = value; + return this; + } - internal override string OperationName => "security.clear_api_key_cache"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearApiKeyCacheRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("ids", ids); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs index 65cdf04e9b0..01a7c8451c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearApiKeyCacheResponse : ElasticsearchResponse +internal sealed partial class ClearApiKeyCacheResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponseConverter))] +public sealed partial class ClearApiKeyCacheResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearApiKeyCacheResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearApiKeyCacheResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs index 19bedb531d5..a8f218424ef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedPrivilegesRequestParameters : RequestParameters +public sealed partial class ClearCachedPrivilegesRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ClearCachedPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -43,19 +65,44 @@ public sealed partial class ClearCachedPrivilegesRequestParameters : RequestPara /// The cache is also automatically cleared for applications that have their privileges updated. /// /// -public sealed partial class ClearCachedPrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestConverter))] +public sealed partial class ClearCachedPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Name application) : base(r => r.Required("application", application)) { } +#if NET7_0_OR_GREATER + public ClearCachedPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityClearCachedPrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "security.clear_cached_privileges"; + + /// + /// + /// A comma-separated list of applications. + /// To clear all applications, use an asterism (*). + /// It does not support other wildcard patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Application { get => P("application"); set => PR("application", value); } } /// @@ -67,29 +114,90 @@ public ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Name applicati /// The cache is also automatically cleared for applications that have their privileges updated. /// /// -public sealed partial class ClearCachedPrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCachedPrivilegesRequestDescriptor { - internal ClearCachedPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest Instance { get; init; } - public ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application) : base(r => r.Required("application", application)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + public ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application) + { + Instance = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest(application); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearCachedPrivilegesRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of applications. + /// To clear all applications, use an asterism (*). + /// It does not support other wildcard patterns. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Application = value; + return this; + } - internal override string OperationName => "security.clear_cached_privileges"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearCachedPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name application) + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("application", application); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs index d912eaa3cfd..56bf89abf8f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedPrivilegesResponse : ElasticsearchResponse +internal sealed partial class ClearCachedPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponseConverter))] +public sealed partial class ClearCachedPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs index f5be66489ca..ead0d71ed78 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedRealmsRequestParameters : RequestParameters +public sealed partial class ClearCachedRealmsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,7 +31,36 @@ public sealed partial class ClearCachedRealmsRequestParameters : RequestParamete /// If you do not specify this parameter, the API evicts all users from the user cache. /// /// - public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } + public System.Collections.Generic.ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } +} + +internal sealed partial class ClearCachedRealmsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -55,28 +77,52 @@ public sealed partial class ClearCachedRealmsRequestParameters : RequestParamete /// For more information, refer to the documentation about controlling the user cache. /// /// -public sealed partial class ClearCachedRealmsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestConverter))] +public sealed partial class ClearCachedRealmsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Names realms) : base(r => r.Required("realms", realms)) { } +#if NET7_0_OR_GREATER + public ClearCachedRealmsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityClearCachedRealms; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "security.clear_cached_realms"; + /// + /// + /// A comma-separated list of realms. + /// To clear all realms, use an asterisk (*). + /// It does not support other wildcard patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Realms { get => P("realms"); set => PR("realms", value); } + /// /// /// A comma-separated list of the users to clear from the cache. /// If you do not specify this parameter, the API evicts all users from the user cache. /// /// - [JsonIgnore] - public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } + public System.Collections.Generic.ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } } /// @@ -93,31 +139,114 @@ public ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Names realms) : ba /// For more information, refer to the documentation about controlling the user cache. /// /// -public sealed partial class ClearCachedRealmsRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCachedRealmsRequestDescriptor { - internal ClearCachedRealmsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest Instance { get; init; } - public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Names realms) : base(r => r.Required("realms", realms)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Names realms) + { + Instance = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest(realms); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearCachedRealmsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest instance) => new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.clear_cached_realms"; + /// + /// + /// A comma-separated list of realms. + /// To clear all realms, use an asterisk (*). + /// It does not support other wildcard patterns. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor Realms(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Realms = value; + return this; + } + + /// + /// + /// A comma-separated list of the users to clear from the cache. + /// If you do not specify this parameter, the API evicts all users from the user cache. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor Usernames(System.Collections.Generic.ICollection? value) + { + Instance.Usernames = value; + return this; + } - public ClearCachedRealmsRequestDescriptor Usernames(ICollection? usernames) => Qs("usernames", usernames); + /// + /// + /// A comma-separated list of the users to clear from the cache. + /// If you do not specify this parameter, the API evicts all users from the user cache. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor Usernames(params string[] values) + { + Instance.Usernames = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearCachedRealmsRequestDescriptor Realms(Elastic.Clients.Elasticsearch.Names realms) + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("realms", realms); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs index 7f2e195891e..51de076cd1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedRealmsResponse : ElasticsearchResponse +internal sealed partial class ClearCachedRealmsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponseConverter))] +public sealed partial class ClearCachedRealmsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedRealmsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedRealmsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs index 1b630f2adff..35717fb726c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedRolesRequestParameters : RequestParameters +public sealed partial class ClearCachedRolesRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ClearCachedRolesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -42,19 +64,44 @@ public sealed partial class ClearCachedRolesRequestParameters : RequestParameter /// Evict roles from the native role cache. /// /// -public sealed partial class ClearCachedRolesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestConverter))] +public sealed partial class ClearCachedRolesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public ClearCachedRolesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityClearCachedRoles; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "security.clear_cached_roles"; + + /// + /// + /// A comma-separated list of roles to evict from the role cache. + /// To evict all roles, use an asterisk (*). + /// It does not support other wildcard patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } } /// @@ -65,29 +112,90 @@ public ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Names name) : base( /// Evict roles from the native role cache. /// /// -public sealed partial class ClearCachedRolesRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCachedRolesRequestDescriptor { - internal ClearCachedRolesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest Instance { get; init; } - public ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + public ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearCachedRolesRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest instance) => new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of roles to evict from the role cache. + /// To evict all roles, use an asterisk (*). + /// It does not support other wildcard patterns. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "security.clear_cached_roles"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ClearCachedRolesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs index 5257f5d7b69..8689f7289b3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedRolesResponse : ElasticsearchResponse +internal sealed partial class ClearCachedRolesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponseConverter))] +public sealed partial class ClearCachedRolesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedRolesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedRolesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs index 9619c6c7428..b3a245c0aec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedServiceTokensRequestParameters : RequestParameters +public sealed partial class ClearCachedServiceTokensRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class ClearCachedServiceTokensRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -48,19 +70,66 @@ public sealed partial class ClearCachedServiceTokensRequestParameters : RequestP /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. /// /// -public sealed partial class ClearCachedServiceTokensRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestConverter))] +public sealed partial class ClearCachedServiceTokensRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public ClearCachedServiceTokensRequest(string ns, string service, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedServiceTokensRequest(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("namespace", @namespace).Required("service", service).Required("name", name)) { } +#if NET7_0_OR_GREATER + public ClearCachedServiceTokensRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedServiceTokensRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityClearCachedServiceTokens; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "security.clear_cached_service_tokens"; + + /// + /// + /// A comma-separated list of token names to evict from the service account token caches. + /// Use a wildcard (*) to evict all tokens that belong to a service account. + /// It does not support other wildcard patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// The namespace, which is a top-level grouping of service accounts. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Namespace { get => P("namespace"); set => PR("namespace", value); } + + /// + /// + /// The name of the service, which must be unique within its namespace. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get => P("service"); set => PR("service", value); } } /// @@ -77,41 +146,112 @@ public ClearCachedServiceTokensRequest(string ns, string service, Elastic.Client /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. /// /// -public sealed partial class ClearCachedServiceTokensRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCachedServiceTokensRequestDescriptor { - internal ClearCachedServiceTokensRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest Instance { get; init; } - public ClearCachedServiceTokensRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedServiceTokensRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + public ClearCachedServiceTokensRequestDescriptor(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest(@namespace, service, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ClearCachedServiceTokensRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest instance) => new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.clear_cached_service_tokens"; + /// + /// + /// A comma-separated list of token names to evict from the service account token caches. + /// Use a wildcard (*) to evict all tokens that belong to a service account. + /// It does not support other wildcard patterns. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The namespace, which is a top-level grouping of service accounts. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor Namespace(string value) + { + Instance.Namespace = value; + return this; + } + + /// + /// + /// The name of the service, which must be unique within its namespace. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor Service(string value) + { + Instance.Service = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public ClearCachedServiceTokensRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor Pretty(bool? value) { - RouteValues.Required("name", name); - return Self; + Instance.Pretty = value; + return this; } - public ClearCachedServiceTokensRequestDescriptor Namespace(string ns) + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("namespace", ns); - return Self; + Instance.SourceQueryString = value; + return this; } - public ClearCachedServiceTokensRequestDescriptor Service(string service) + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("service", service); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs index b1b33e09cf9..71b4431cdb2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs @@ -17,21 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ClearCachedServiceTokensResponse : ElasticsearchResponse +internal sealed partial class ClearCachedServiceTokensResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeStats = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNodeStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeStats.TryReadProperty(ref reader, options, PropNodeStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + Nodes = propNodes.Value, + NodeStats = propNodeStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeStats, value.NodeStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponseConverter))] +public sealed partial class ClearCachedServiceTokensResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCachedServiceTokensResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCachedServiceTokensResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs index 5aea492a048..d464e857499 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateApiKeyRequestParameters : RequestParameters +public sealed partial class CreateApiKeyRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,72 @@ public sealed partial class CreateApiKeyRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class CreateApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptors = System.Text.Json.JsonEncodedText.Encode("role_descriptors"); + + public override Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiration = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propName = default; + LocalJsonValue?> propRoleDescriptors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoleDescriptors.TryReadProperty(ref reader, options, PropRoleDescriptors, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expiration = propExpiration.Value, + Metadata = propMetadata.Value, + Name = propName.Value, + RoleDescriptors = propRoleDescriptors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoleDescriptors, value.RoleDescriptors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create an API key. @@ -63,11 +122,28 @@ public sealed partial class CreateApiKeyRequestParameters : RequestParameters /// To configure or turn off the API key service, refer to API key service setting documentation. /// /// -public sealed partial class CreateApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestConverter))] +public sealed partial class CreateApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; +#if NET7_0_OR_GREATER + public CreateApiKeyRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public CreateApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityCreateApiKey; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -78,7 +154,6 @@ public sealed partial class CreateApiKeyRequest : PlainRequesttrue (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -87,7 +162,6 @@ public sealed partial class CreateApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("expiration")] public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } /// @@ -95,15 +169,13 @@ public sealed partial class CreateApiKeyRequest : PlainRequest_ are reserved for system usage. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// /// A name for the API key. /// /// - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Name? Name { get; set; } /// @@ -120,8 +192,7 @@ public sealed partial class CreateApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("role_descriptors")] - public IDictionary? RoleDescriptors { get; set; } + public System.Collections.Generic.IDictionary? RoleDescriptors { get; set; } } /// @@ -147,28 +218,34 @@ public sealed partial class CreateApiKeyRequest : PlainRequest /// -public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor, CreateApiKeyRequestParameters> +public readonly partial struct CreateApiKeyRequestDescriptor { - internal CreateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest Instance { get; init; } - public CreateApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.create_api_key"; + public CreateApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private IDictionary> RoleDescriptorsValue { get; set; } + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// @@ -176,10 +253,10 @@ public CreateApiKeyRequestDescriptor() /// By default, API keys never expire. /// /// - public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -187,10 +264,39 @@ public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elast /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -198,10 +304,10 @@ public CreateApiKeyRequestDescriptor Metadata(Func /// - public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -218,40 +324,199 @@ public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsear /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. /// /// - public CreateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors() { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(System.Action? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } - if (NameValue is not null) + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - if (RoleDescriptorsValue is not null) + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + return new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -278,28 +543,34 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// To configure or turn off the API key service, refer to API key service setting documentation. /// /// -public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct CreateApiKeyRequestDescriptor { - internal CreateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest Instance { get; init; } - public CreateApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.create_api_key"; + public CreateApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private IDictionary RoleDescriptorsValue { get; set; } + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// @@ -307,10 +578,32 @@ public CreateApiKeyRequestDescriptor() /// By default, API keys never expire. /// /// - public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) + { + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata() { - ExpirationValue = expiration; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -318,10 +611,17 @@ public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Du /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddMetadatum(string key, object value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -329,10 +629,10 @@ public CreateApiKeyRequestDescriptor Metadata(Func /// - public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -349,39 +649,171 @@ public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? na /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. /// /// - public CreateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors() { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } + + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } - if (NameValue is not null) + /// + /// + /// An array of role descriptors for this API key. + /// When it is not specified or it is an empty array, the API key will have a point in time snapshot of permissions of the authenticated user. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the authenticated user's permissions thereby limiting the access scope for API keys. + /// The structure of role descriptor is the same as the request for the create role API. + /// For more details, refer to the create or update roles API. + /// + /// + /// NOTE: Due to the way in which this permission intersection is calculated, it is not possible to create an API key that is a child of another API key, unless the derived key is created without any privileges. + /// In this case, you must explicitly specify a role descriptor with no privileges. + /// The derived API key can be used for authentication; it will not have authority to call Elasticsearch APIs. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - if (RoleDescriptorsValue is not null) + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + return new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs index 440179df1b5..ebabbdda924 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateApiKeyResponse : ElasticsearchResponse +internal sealed partial class CreateApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropEncoded = System.Text.Json.JsonEncodedText.Encode("encoded"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propEncoded = default; + LocalJsonValue propExpiration = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propEncoded.TryReadProperty(ref reader, options, PropEncoded, null)) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Encoded = propEncoded.Value, + Expiration = propExpiration.Value, + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropEncoded, value.Encoded, null, null); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponseConverter))] +public sealed partial class CreateApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Generated API key. /// /// - [JsonInclude, JsonPropertyName("api_key")] - public string ApiKey { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } /// /// @@ -43,30 +130,38 @@ public sealed partial class CreateApiKeyResponse : ElasticsearchResponse /// by a colon (:). /// /// - [JsonInclude, JsonPropertyName("encoded")] - public string Encoded { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Encoded { get; set; } /// /// /// Expiration in milliseconds for the API key. /// /// - [JsonInclude, JsonPropertyName("expiration")] - public long? Expiration { get; init; } + public long? Expiration { get; set; } /// /// /// Unique ID for this API key. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Specifies the name for this API key. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyRequest.g.cs index 2ca3d9d6e10..a33d974440c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateCrossClusterApiKeyRequestParameters : RequestParameters +public sealed partial class CreateCrossClusterApiKeyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class CreateCrossClusterApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccess = System.Text.Json.JsonEncodedText.Encode("access"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccess = default; + LocalJsonValue propExpiration = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccess.TryReadProperty(ref reader, options, PropAccess, null)) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Access = propAccess.Value, + Expiration = propExpiration.Value, + Metadata = propMetadata.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccess, value.Access, null, null); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create a cross-cluster API key. @@ -62,11 +121,35 @@ public sealed partial class CreateCrossClusterApiKeyRequestParameters : RequestP /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. /// /// -public sealed partial class CreateCrossClusterApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestConverter))] +public sealed partial class CreateCrossClusterApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateCrossClusterApiKey; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Security.Access access, Elastic.Clients.Elasticsearch.Name name) + { + Access = access; + Name = name; + } +#if NET7_0_OR_GREATER + public CreateCrossClusterApiKeyRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CreateCrossClusterApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityCreateCrossClusterApiKey; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -83,8 +166,11 @@ public sealed partial class CreateCrossClusterApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("access")] - public Elastic.Clients.Elasticsearch.Security.Access Access { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.Access Access { get; set; } /// /// @@ -92,7 +178,6 @@ public sealed partial class CreateCrossClusterApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("expiration")] public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } /// @@ -102,16 +187,18 @@ public sealed partial class CreateCrossClusterApiKeyRequest : PlainRequest_ are reserved for system usage. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// /// Specifies the name for this API key. /// /// - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } } /// @@ -142,28 +229,40 @@ public sealed partial class CreateCrossClusterApiKeyRequest : PlainRequest /// -public sealed partial class CreateCrossClusterApiKeyRequestDescriptor : RequestDescriptor, CreateCrossClusterApiKeyRequestParameters> +public readonly partial struct CreateCrossClusterApiKeyRequestDescriptor { - internal CreateCrossClusterApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest Instance { get; init; } - public CreateCrossClusterApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateCrossClusterApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public CreateCrossClusterApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.create_cross_cluster_api_key"; - - private Elastic.Clients.Elasticsearch.Security.Access AccessValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.AccessDescriptor AccessDescriptor { get; set; } - private Action> AccessDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross-cluster search and cross-cluster replication. + /// At least one of them must be specified. + /// + /// + /// NOTE: No explicit privileges should be specified for either search or replication access. + /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access value) + { + Instance.Access = value; + return this; + } /// /// @@ -176,28 +275,44 @@ public CreateCrossClusterApiKeyRequestDescriptor() /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. /// /// - public CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access access) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access() { - AccessDescriptor = null; - AccessDescriptorAction = null; - AccessValue = access; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(null); + return this; } - public CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross-cluster search and cross-cluster replication. + /// At least one of them must be specified. + /// + /// + /// NOTE: No explicit privileges should be specified for either search or replication access. + /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access(System.Action? action) { - AccessValue = null; - AccessDescriptorAction = null; - AccessDescriptor = descriptor; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } - public CreateCrossClusterApiKeyRequestDescriptor Access(Action> configure) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross-cluster search and cross-cluster replication. + /// At least one of them must be specified. + /// + /// + /// NOTE: No explicit privileges should be specified for either search or replication access. + /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access(System.Action>? action) { - AccessValue = null; - AccessDescriptor = null; - AccessDescriptorAction = configure; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } /// @@ -206,10 +321,10 @@ public CreateCrossClusterApiKeyRequestDescriptor Access(Action /// - public CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -219,10 +334,43 @@ public CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.C /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public CreateCrossClusterApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -230,46 +378,60 @@ public CreateCrossClusterApiKeyRequestDescriptor Metadata(Func /// - public CreateCrossClusterApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest Build(System.Action action) { - writer.WriteStartObject(); - if (AccessDescriptor is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessDescriptor, options); - } - else if (AccessDescriptorAction is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(AccessDescriptorAction), options); - } - else - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -301,28 +463,23 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. /// /// -public sealed partial class CreateCrossClusterApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct CreateCrossClusterApiKeyRequestDescriptor { - internal CreateCrossClusterApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest Instance { get; init; } - public CreateCrossClusterApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateCrossClusterApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.create_cross_cluster_api_key"; + public CreateCrossClusterApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Security.Access AccessValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.AccessDescriptor AccessDescriptor { get; set; } - private Action AccessDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -335,28 +492,44 @@ public CreateCrossClusterApiKeyRequestDescriptor() /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. /// /// - public CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access access) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access value) { - AccessDescriptor = null; - AccessDescriptorAction = null; - AccessValue = access; - return Self; + Instance.Access = value; + return this; } - public CreateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross-cluster search and cross-cluster replication. + /// At least one of them must be specified. + /// + /// + /// NOTE: No explicit privileges should be specified for either search or replication access. + /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access() { - AccessValue = null; - AccessDescriptorAction = null; - AccessDescriptor = descriptor; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(null); + return this; } - public CreateCrossClusterApiKeyRequestDescriptor Access(Action configure) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross-cluster search and cross-cluster replication. + /// At least one of them must be specified. + /// + /// + /// NOTE: No explicit privileges should be specified for either search or replication access. + /// The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Access(System.Action>? action) { - AccessValue = null; - AccessDescriptor = null; - AccessDescriptorAction = configure; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } /// @@ -365,10 +538,10 @@ public CreateCrossClusterApiKeyRequestDescriptor Access(Action /// - public CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -378,10 +551,43 @@ public CreateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elas /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public CreateCrossClusterApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -389,45 +595,59 @@ public CreateCrossClusterApiKeyRequestDescriptor Metadata(Func /// - public CreateCrossClusterApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (AccessDescriptor is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessDescriptor, options); - } - else if (AccessDescriptorAction is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(AccessDescriptorAction), options); - } - else - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyResponse.g.cs index 3dcac6531a1..6ab82acc145 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateCrossClusterApiKeyResponse.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateCrossClusterApiKeyResponse : ElasticsearchResponse +internal sealed partial class CreateCrossClusterApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropEncoded = System.Text.Json.JsonEncodedText.Encode("encoded"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propEncoded = default; + LocalJsonValue propExpiration = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propEncoded.TryReadProperty(ref reader, options, PropEncoded, null)) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Encoded = propEncoded.Value, + Expiration = propExpiration.Value, + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropEncoded, value.Encoded, null, null); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponseConverter))] +public sealed partial class CreateCrossClusterApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateCrossClusterApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateCrossClusterApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Generated API key. /// /// - [JsonInclude, JsonPropertyName("api_key")] - public string ApiKey { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } /// /// @@ -43,30 +130,38 @@ public sealed partial class CreateCrossClusterApiKeyResponse : ElasticsearchResp /// by a colon (:). /// /// - [JsonInclude, JsonPropertyName("encoded")] - public string Encoded { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Encoded { get; set; } /// /// /// Expiration in milliseconds for the API key. /// /// - [JsonInclude, JsonPropertyName("expiration")] - public long? Expiration { get; init; } + public System.TimeSpan? Expiration { get; set; } /// /// /// Unique ID for this API key. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Specifies the name for this API key. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs index 7bab67cf459..24f6f265328 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateServiceTokenRequestParameters : RequestParameters +public sealed partial class CreateServiceTokenRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class CreateServiceTokenRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class CreateServiceTokenRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Create a service account token. @@ -52,30 +74,80 @@ public sealed partial class CreateServiceTokenRequestParameters : RequestParamet /// You must actively delete them if they are no longer needed. /// /// -public sealed partial class CreateServiceTokenRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestConverter))] +public sealed partial class CreateServiceTokenRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public CreateServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateServiceTokenRequest(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Required("namespace", @namespace).Required("service", service).Optional("name", name)) { } - public CreateServiceTokenRequest(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateServiceTokenRequest(string @namespace, string service) : base(r => r.Required("namespace", @namespace).Required("service", service)) + { + } +#if NET7_0_OR_GREATER + public CreateServiceTokenRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityCreateServiceToken; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "security.create_service_token"; + /// + /// + /// The name for the service account token. + /// If omitted, a random name will be generated. + /// + /// + /// Token names must be at least one and no more than 256 characters. + /// They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (-), and underscores (_), but cannot begin with an underscore. + /// + /// + /// NOTE: Token names must be unique in the context of the associated service account. + /// They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as <namespace>/<service>/<token-name>. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => P("name"); set => PO("name", value); } + + /// + /// + /// The name of the namespace, which is a top-level grouping of service accounts. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Namespace { get => P("namespace"); set => PR("namespace", value); } + + /// + /// + /// The name of the service. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get => P("service"); set => PR("service", value); } + /// /// /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -91,47 +163,135 @@ public CreateServiceTokenRequest(string ns, string service) : base(r => r.Requir /// You must actively delete them if they are no longer needed. /// /// -public sealed partial class CreateServiceTokenRequestDescriptor : RequestDescriptor +public readonly partial struct CreateServiceTokenRequestDescriptor { - internal CreateServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest Instance { get; init; } - public CreateServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateServiceTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest instance) { + Instance = instance; } - public CreateServiceTokenRequestDescriptor(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + public CreateServiceTokenRequestDescriptor(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name) { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest(@namespace, service, name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + public CreateServiceTokenRequestDescriptor(string @namespace, string service) + { + Instance = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest(@namespace, service); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateServiceTokenRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest instance) => new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.create_service_token"; + /// + /// + /// The name for the service account token. + /// If omitted, a random name will be generated. + /// + /// + /// Token names must be at least one and no more than 256 characters. + /// They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes (-), and underscores (_), but cannot begin with an underscore. + /// + /// + /// NOTE: Token names must be unique in the context of the associated service account. + /// They must also be globally unique with their fully qualified names, which are comprised of the service account principal and token name, such as <namespace>/<service>/<token-name>. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The name of the namespace, which is a top-level grouping of service accounts. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Namespace(string value) + { + Instance.Namespace = value; + return this; + } + + /// + /// + /// The name of the service. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Service(string value) + { + Instance.Service = value; + return this; + } - public CreateServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public CreateServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor Pretty(bool? value) { - RouteValues.Optional("name", name); - return Self; + Instance.Pretty = value; + return this; } - public CreateServiceTokenRequestDescriptor Namespace(string ns) + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("namespace", ns); - return Self; + Instance.SourceQueryString = value; + return this; } - public CreateServiceTokenRequestDescriptor Service(string service) + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("service", service); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs index 925204e9e00..62cc6e0ad33 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class CreateServiceTokenResponse : ElasticsearchResponse +internal sealed partial class CreateServiceTokenResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + + public override Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreated = default; + LocalJsonValue propToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value, + Token = propToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponseConverter))] +public sealed partial class CreateServiceTokenResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("created")] - public bool Created { get; init; } - [JsonInclude, JsonPropertyName("token")] - public Elastic.Clients.Elasticsearch.Security.ServiceToken Token { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateServiceTokenResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateServiceTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Created { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.ServiceToken Token { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiRequest.g.cs index c94ab0015e3..87ce9e4ad56 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiRequest.g.cs @@ -17,23 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DelegatePkiRequestParameters : RequestParameters +public sealed partial class DelegatePkiRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DelegatePkiRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropX509CertificateChain = System.Text.Json.JsonEncodedText.Encode("x509_certificate_chain"); + + public override Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propX509CertificateChain = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propX509CertificateChain.TryReadProperty(ref reader, options, PropX509CertificateChain, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + X509CertificateChain = propX509CertificateChain.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropX509CertificateChain, value.X509CertificateChain, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Delegate PKI authentication. @@ -52,11 +84,34 @@ public sealed partial class DelegatePkiRequestParameters : RequestParameters /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. /// /// -public sealed partial class DelegatePkiRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestConverter))] +public sealed partial class DelegatePkiRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDelegatePki; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelegatePkiRequest(System.Collections.Generic.ICollection x509CertificateChain) + { + X509CertificateChain = x509CertificateChain; + } +#if NET7_0_OR_GREATER + public DelegatePkiRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DelegatePkiRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DelegatePkiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDelegatePki; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -72,8 +127,11 @@ public sealed partial class DelegatePkiRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("x509_certificate_chain")] - public ICollection X509CertificateChain { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection X509CertificateChain { get; set; } } /// @@ -94,23 +152,39 @@ public sealed partial class DelegatePkiRequest : PlainRequest /// -public sealed partial class DelegatePkiRequestDescriptor : RequestDescriptor +public readonly partial struct DelegatePkiRequestDescriptor { - internal DelegatePkiRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest Instance { get; init; } - public DelegatePkiRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelegatePkiRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDelegatePki; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public DelegatePkiRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.delegate_pki"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest instance) => new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor descriptor) => descriptor.Instance; - private ICollection X509CertificateChainValue { get; set; } + /// + /// + /// The X509Certificate chain, which is represented as an ordered string array. + /// Each string in the array is a base64-encoded (Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding. + /// + /// + /// The first element is the target certificate that contains the subject distinguished name that is requesting access. + /// This may be followed by additional certificates; each subsequent certificate is used to certify the previous one. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor X509CertificateChain(System.Collections.Generic.ICollection value) + { + Instance.X509CertificateChain = value; + return this; + } /// /// @@ -122,17 +196,59 @@ public DelegatePkiRequestDescriptor() /// This may be followed by additional certificates; each subsequent certificate is used to certify the previous one. /// /// - public DelegatePkiRequestDescriptor X509CertificateChain(ICollection x509CertificateChain) + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor X509CertificateChain(params string[] values) { - X509CertificateChainValue = x509CertificateChain; - return Self; + Instance.X509CertificateChain = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("x509_certificate_chain"); - JsonSerializer.Serialize(writer, X509CertificateChainValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiResponse.g.cs index c92c3b2f2ea..0ed7e2a42fa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DelegatePkiResponse.g.cs @@ -17,40 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DelegatePkiResponse : ElasticsearchResponse +internal sealed partial class DelegatePkiResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropAuthentication = System.Text.Json.JsonEncodedText.Encode("authentication"); + private static readonly System.Text.Json.JsonEncodedText PropExpiresIn = System.Text.Json.JsonEncodedText.Encode("expires_in"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.DelegatePkiResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propAuthentication = default; + LocalJsonValue propExpiresIn = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propAuthentication.TryReadProperty(ref reader, options, PropAuthentication, null)) + { + continue; + } + + if (propExpiresIn.TryReadProperty(ref reader, options, PropExpiresIn, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DelegatePkiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + Authentication = propAuthentication.Value, + ExpiresIn = propExpiresIn.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DelegatePkiResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropAuthentication, value.Authentication, null, null); + writer.WriteProperty(options, PropExpiresIn, value.ExpiresIn, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DelegatePkiResponseConverter))] +public sealed partial class DelegatePkiResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelegatePkiResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DelegatePkiResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An access token associated with the subject distinguished name of the client's certificate. /// /// - [JsonInclude, JsonPropertyName("access_token")] - public string AccessToken { get; init; } - [JsonInclude, JsonPropertyName("authentication")] - public Elastic.Clients.Elasticsearch.Security.Authentication? Authentication { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string AccessToken { get; set; } + public Elastic.Clients.Elasticsearch.Security.Authentication? Authentication { get; set; } /// /// /// The amount of time (in seconds) before the token expires. /// /// - [JsonInclude, JsonPropertyName("expires_in")] - public long ExpiresIn { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ExpiresIn { get; set; } /// /// /// The type of token. /// /// - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs index a90646696de..c613fa130a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeletePrivilegesRequestParameters : RequestParameters +public sealed partial class DeletePrivilegesRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DeletePrivilegesRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DeletePrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete application privileges. @@ -60,26 +82,60 @@ public sealed partial class DeletePrivilegesRequestParameters : RequestParameter /// /// /// -public sealed partial class DeletePrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestConverter))] +public sealed partial class DeletePrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("application", application).Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeletePrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDeletePrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "security.delete_privileges"; + /// + /// + /// The name of the application. + /// Application privileges are always associated with exactly one application. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Application { get => P("application"); set => PR("application", value); } + + /// + /// + /// The name of the privilege. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("name"); set => PR("name", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -103,37 +159,111 @@ public DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Name application, E /// /// /// -public sealed partial class DeletePrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct DeletePrivilegesRequestDescriptor { - internal DeletePrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest Instance { get; init; } - public DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("application", application).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + public DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest(application, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeletePrivilegesRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.delete_privileges"; + /// + /// + /// The name of the application. + /// Application privileges are always associated with exactly one application. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Application = value; + return this; + } - public DeletePrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// The name of the privilege. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeletePrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name application) + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("application", application); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeletePrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs index 53deacbb7d4..0f98e2e795b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeletePrivilegesResponse : DictionaryResponse> +internal sealed partial class DeletePrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - public DeletePrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue>>(options, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!) }; } - public DeletePrivilegesResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Result, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponseConverter))] +public sealed partial class DeletePrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeletePrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeletePrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary> Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs index a749b8bb662..aa9b6ab267f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteRoleMappingRequestParameters : RequestParameters +public sealed partial class DeleteRoleMappingRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DeleteRoleMappingRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DeleteRoleMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete role mappings. @@ -50,26 +72,49 @@ public sealed partial class DeleteRoleMappingRequestParameters : RequestParamete /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. /// /// -public sealed partial class DeleteRoleMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestConverter))] +public sealed partial class DeleteRoleMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteRoleMappingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDeleteRoleMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "security.delete_role_mapping"; + /// + /// + /// The distinct name that identifies the role mapping. + /// The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -83,31 +128,100 @@ public DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. /// /// -public sealed partial class DeleteRoleMappingRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRoleMappingRequestDescriptor { - internal DeleteRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest Instance { get; init; } - public DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + public DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRoleMappingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest instance) => new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.delete_role_mapping"; + /// + /// + /// The distinct name that identifies the role mapping. + /// The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs index f35ccfb53bd..f237e8a9206 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteRoleMappingResponse : ElasticsearchResponse +internal sealed partial class DeleteRoleMappingResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + + public override Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponseConverter))] +public sealed partial class DeleteRoleMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRoleMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the mapping is successfully deleted, found is true. /// Otherwise, found is false. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs index f968e565be8..edae4b44b2c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteRoleRequestParameters : RequestParameters +public sealed partial class DeleteRoleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DeleteRoleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DeleteRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete roles. @@ -50,26 +72,48 @@ public sealed partial class DeleteRoleRequestParameters : RequestParameters /// The delete roles API cannot remove roles that are defined in roles files. /// /// -public sealed partial class DeleteRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestConverter))] +public sealed partial class DeleteRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteRoleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDeleteRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "security.delete_role"; + /// + /// + /// The name of the role. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -83,31 +127,99 @@ public DeleteRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r. /// The delete roles API cannot remove roles that are defined in roles files. /// /// -public sealed partial class DeleteRoleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRoleRequestDescriptor { - internal DeleteRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest Instance { get; init; } - public DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + public DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRoleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.delete_role"; + /// + /// + /// The name of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs index 6e29da67b58..e6f74230d85 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteRoleResponse : ElasticsearchResponse +internal sealed partial class DeleteRoleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + + public override Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteRoleResponseConverter))] +public sealed partial class DeleteRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the role is successfully deleted, found is true. /// Otherwise, found is false. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs index 94441f708bb..2de344743d1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteServiceTokenRequestParameters : RequestParameters +public sealed partial class DeleteServiceTokenRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DeleteServiceTokenRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DeleteServiceTokenRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete service account tokens. @@ -48,26 +70,70 @@ public sealed partial class DeleteServiceTokenRequestParameters : RequestParamet /// Delete service account tokens for a service in a specified namespace. /// /// -public sealed partial class DeleteServiceTokenRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestConverter))] +public sealed partial class DeleteServiceTokenRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public DeleteServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteServiceTokenRequest(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("namespace", @namespace).Required("service", service).Required("name", name)) { } +#if NET7_0_OR_GREATER + public DeleteServiceTokenRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDeleteServiceToken; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "security.delete_service_token"; + /// + /// + /// The name of the service account token. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + + /// + /// + /// The namespace, which is a top-level grouping of service accounts. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Namespace { get => P("namespace"); set => PR("namespace", value); } + + /// + /// + /// The service name. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get => P("service"); set => PR("service", value); } + /// /// /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -79,43 +145,121 @@ public DeleteServiceTokenRequest(string ns, string service, Elastic.Clients.Elas /// Delete service account tokens for a service in a specified namespace. /// /// -public sealed partial class DeleteServiceTokenRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteServiceTokenRequestDescriptor { - internal DeleteServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest Instance { get; init; } - public DeleteServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteServiceTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + public DeleteServiceTokenRequestDescriptor(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest(@namespace, service, name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteServiceTokenRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest instance) => new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.delete_service_token"; + /// + /// + /// The name of the service account token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The namespace, which is a top-level grouping of service accounts. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Namespace(string value) + { + Instance.Namespace = value; + return this; + } + + /// + /// + /// The service name. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Service(string value) + { + Instance.Service = value; + return this; + } - public DeleteServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - public DeleteServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor Pretty(bool? value) { - RouteValues.Required("name", name); - return Self; + Instance.Pretty = value; + return this; } - public DeleteServiceTokenRequestDescriptor Namespace(string ns) + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("namespace", ns); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteServiceTokenRequestDescriptor Service(string service) + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("service", service); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs index f0957cc140a..4e7f372441a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteServiceTokenResponse : ElasticsearchResponse +internal sealed partial class DeleteServiceTokenResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + + public override Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponseConverter))] +public sealed partial class DeleteServiceTokenResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteServiceTokenResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteServiceTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the service account token is successfully deleted, the request returns {"found": true}. /// Otherwise, the response will have status code 404 and found is set to false. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs index 90e38b47654..b60fb6f3655 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteUserRequestParameters : RequestParameters +public sealed partial class DeleteUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DeleteUserRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DeleteUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DeleteUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete users. @@ -48,26 +70,48 @@ public sealed partial class DeleteUserRequestParameters : RequestParameters /// Delete users from the native realm. /// /// -public sealed partial class DeleteUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteUserRequestConverter))] +public sealed partial class DeleteUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) { } +#if NET7_0_OR_GREATER + public DeleteUserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteUser; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDeleteUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "security.delete_user"; + /// + /// + /// An identifier for the user. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Username Username { get => P("username"); set => PR("username", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -79,31 +123,99 @@ public DeleteUserRequest(Elastic.Clients.Elasticsearch.Username username) : base /// Delete users from the native realm. /// /// -public sealed partial class DeleteUserRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteUserRequestDescriptor { - internal DeleteUserRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DeleteUserRequest Instance { get; init; } - public DeleteUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteUserRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteUser; + public DeleteUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequest(username); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteUserRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DeleteUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DeleteUserRequest(Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.delete_user"; + /// + /// + /// An identifier for the user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username value) + { + Instance.Username = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DeleteUserRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DeleteUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("username", username); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs index 702edc36c8a..74c3db7fe46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DeleteUserResponse : ElasticsearchResponse +internal sealed partial class DeleteUserResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + + public override Elastic.Clients.Elasticsearch.Security.DeleteUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DeleteUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DeleteUserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DeleteUserResponseConverter))] +public sealed partial class DeleteUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the user is successfully deleted, the request returns {"found": true}. /// Otherwise, found is set to false. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs index f7ebc6d77e7..a62a53e1a47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DisableUserProfileRequestParameters : RequestParameters +public sealed partial class DisableUserProfileRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,6 +35,35 @@ public sealed partial class DisableUserProfileRequestParameters : RequestParamet public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DisableUserProfileRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Disable a user profile. @@ -59,20 +81,43 @@ public sealed partial class DisableUserProfileRequestParameters : RequestParamet /// To re-enable a disabled user profile, use the enable user profile API . /// /// -public sealed partial class DisableUserProfileRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestConverter))] +public sealed partial class DisableUserProfileRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DisableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) { } +#if NET7_0_OR_GREATER + public DisableUserProfileRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DisableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDisableUserProfile; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "security.disable_user_profile"; + /// + /// + /// Unique identifier for the user profile. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get => P("uid"); set => PR("uid", value); } + /// /// /// If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. @@ -80,7 +125,6 @@ public DisableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) /// If 'false', it does nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -101,31 +145,101 @@ public DisableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) /// To re-enable a disabled user profile, use the enable user profile API . /// /// -public sealed partial class DisableUserProfileRequestDescriptor : RequestDescriptor +public readonly partial struct DisableUserProfileRequestDescriptor { - internal DisableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest Instance { get; init; } - public DisableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisableUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + public DisableUserProfileRequestDescriptor(string uid) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest(uid); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DisableUserProfileRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest instance) => new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.disable_user_profile"; + /// + /// + /// Unique identifier for the user profile. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor Uid(string value) + { + Instance.Uid = value; + return this; + } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If 'wait_for', it waits for a refresh to make this operation visible to search. + /// If 'false', it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DisableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DisableUserProfileRequestDescriptor Uid(string uid) + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("uid", uid); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs index b6a983cec33..01fffeb5de7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DisableUserProfileResponse : ElasticsearchResponse +internal sealed partial class DisableUserProfileResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponseConverter))] +public sealed partial class DisableUserProfileResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisableUserProfileResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DisableUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs index f8344afb71d..4e6b4a8abee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DisableUserRequestParameters : RequestParameters +public sealed partial class DisableUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class DisableUserRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class DisableUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DisableUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DisableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DisableUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Disable users. @@ -50,26 +72,48 @@ public sealed partial class DisableUserRequestParameters : RequestParameters /// You can use this API to revoke a user's access to Elasticsearch. /// /// -public sealed partial class DisableUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DisableUserRequestConverter))] +public sealed partial class DisableUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DisableUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) { } +#if NET7_0_OR_GREATER + public DisableUserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DisableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUser; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityDisableUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "security.disable_user"; + /// + /// + /// An identifier for the user. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Username Username { get => P("username"); set => PR("username", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -83,31 +127,99 @@ public DisableUserRequest(Elastic.Clients.Elasticsearch.Username username) : bas /// You can use this API to revoke a user's access to Elasticsearch. /// /// -public sealed partial class DisableUserRequestDescriptor : RequestDescriptor +public readonly partial struct DisableUserRequestDescriptor { - internal DisableUserRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.DisableUserRequest Instance { get; init; } - public DisableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DisableUserRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUser; + public DisableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) + { + Instance = new Elastic.Clients.Elasticsearch.Security.DisableUserRequest(username); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DisableUserRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.DisableUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.DisableUserRequest(Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.disable_user"; + /// + /// + /// An identifier for the user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username value) + { + Instance.Username = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.DisableUserRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.DisableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DisableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DisableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("username", username); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs index 91cd0736f94..c60fceb4e52 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class DisableUserResponse : ElasticsearchResponse +internal sealed partial class DisableUserResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.DisableUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.DisableUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.DisableUserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.DisableUserResponseConverter))] +public sealed partial class DisableUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisableUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DisableUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs index 07d530d791a..e42734ec25b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnableUserProfileRequestParameters : RequestParameters +public sealed partial class EnableUserProfileRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -43,6 +36,35 @@ public sealed partial class EnableUserProfileRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class EnableUserProfileRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Enable a user profile. @@ -60,20 +82,43 @@ public sealed partial class EnableUserProfileRequestParameters : RequestParamete /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. /// /// -public sealed partial class EnableUserProfileRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestConverter))] +public sealed partial class EnableUserProfileRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public EnableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) { } +#if NET7_0_OR_GREATER + public EnableUserProfileRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityEnableUserProfile; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "security.enable_user_profile"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get => P("uid"); set => PR("uid", value); } + /// /// /// If 'true', Elasticsearch refreshes the affected shards to make this operation @@ -82,7 +127,6 @@ public EnableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) /// If 'false', nothing is done with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -103,31 +147,102 @@ public EnableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. /// /// -public sealed partial class EnableUserProfileRequestDescriptor : RequestDescriptor +public readonly partial struct EnableUserProfileRequestDescriptor { - internal EnableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest Instance { get; init; } - public EnableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnableUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + public EnableUserProfileRequestDescriptor(string uid) + { + Instance = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest(uid); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public EnableUserProfileRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest instance) => new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.enable_user_profile"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor Uid(string value) + { + Instance.Uid = value; + return this; + } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search. + /// If 'wait_for', it waits for a refresh to make this operation visible to search. + /// If 'false', nothing is done with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public EnableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public EnableUserProfileRequestDescriptor Uid(string uid) + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("uid", uid); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs index 01d90498655..2b5b6c64710 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnableUserProfileResponse : ElasticsearchResponse +internal sealed partial class EnableUserProfileResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponseConverter))] +public sealed partial class EnableUserProfileResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnableUserProfileResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnableUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs index 87c16d465bf..af3410534f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnableUserRequestParameters : RequestParameters +public sealed partial class EnableUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class EnableUserRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class EnableUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.EnableUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnableUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Enable users. @@ -49,26 +71,48 @@ public sealed partial class EnableUserRequestParameters : RequestParameters /// By default, when you create users, they are enabled. /// /// -public sealed partial class EnableUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnableUserRequestConverter))] +public sealed partial class EnableUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public EnableUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) { } +#if NET7_0_OR_GREATER + public EnableUserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUser; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityEnableUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "security.enable_user"; + /// + /// + /// An identifier for the user. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Username Username { get => P("username"); set => PR("username", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } @@ -81,31 +125,99 @@ public EnableUserRequest(Elastic.Clients.Elasticsearch.Username username) : base /// By default, when you create users, they are enabled. /// /// -public sealed partial class EnableUserRequestDescriptor : RequestDescriptor +public readonly partial struct EnableUserRequestDescriptor { - internal EnableUserRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.EnableUserRequest Instance { get; init; } - public EnableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnableUserRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUser; + public EnableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) + { + Instance = new Elastic.Clients.Elasticsearch.Security.EnableUserRequest(username); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public EnableUserRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnableUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.EnableUserRequest(Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.enable_user"; + /// + /// + /// An identifier for the user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username value) + { + Instance.Username = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.EnableUserRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.EnableUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public EnableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public EnableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("username", username); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs index e839c5abf6f..fbb460aa564 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnableUserResponse : ElasticsearchResponse +internal sealed partial class EnableUserResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.EnableUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnableUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnableUserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnableUserResponseConverter))] +public sealed partial class EnableUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnableUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnableUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs index 78485cf7df6..613da170790 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnrollKibanaRequestParameters : RequestParameters +public sealed partial class EnrollKibanaRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class EnrollKibanaRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -46,11 +68,28 @@ public sealed partial class EnrollKibanaRequestParameters : RequestParameters /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. /// /// -public sealed partial class EnrollKibanaRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestConverter))] +public sealed partial class EnrollKibanaRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollKibana; +#if NET7_0_OR_GREATER + public EnrollKibanaRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public EnrollKibanaRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityEnrollKibana; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -69,23 +108,76 @@ public sealed partial class EnrollKibanaRequest : PlainRequest /// -public sealed partial class EnrollKibanaRequestDescriptor : RequestDescriptor +public readonly partial struct EnrollKibanaRequestDescriptor { - internal EnrollKibanaRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrollKibanaRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest instance) + { + Instance = instance; + } public EnrollKibanaRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollKibana; + public static explicit operator Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest instance) => new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.enroll_kibana"; + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs index 6e2c48b581e..b97dc2ba19c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs @@ -17,25 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnrollKibanaResponse : ElasticsearchResponse +internal sealed partial class EnrollKibanaResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHttpCa = System.Text.Json.JsonEncodedText.Encode("http_ca"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + + public override Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHttpCa = default; + LocalJsonValue propToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHttpCa.TryReadProperty(ref reader, options, PropHttpCa, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HttpCa = propHttpCa.Value, + Token = propToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHttpCa, value.HttpCa, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponseConverter))] +public sealed partial class EnrollKibanaResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrollKibanaResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrollKibanaResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The CA certificate used to sign the node certificates that Elasticsearch uses for TLS on the HTTP layer. /// The certificate is returned as a Base64 encoded string of the ASN.1 DER encoding of the certificate. /// /// - [JsonInclude, JsonPropertyName("http_ca")] - public string HttpCa { get; init; } - [JsonInclude, JsonPropertyName("token")] - public Elastic.Clients.Elasticsearch.Security.KibanaToken Token { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string HttpCa { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.KibanaToken Token { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs index 28c88d40096..5363e5c22c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnrollNodeRequestParameters : RequestParameters +public sealed partial class EnrollNodeRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class EnrollNodeRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -46,11 +68,28 @@ public sealed partial class EnrollNodeRequestParameters : RequestParameters /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. /// /// -public sealed partial class EnrollNodeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestConverter))] +public sealed partial class EnrollNodeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollNode; +#if NET7_0_OR_GREATER + public EnrollNodeRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public EnrollNodeRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrollNodeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityEnrollNode; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -69,23 +108,76 @@ public sealed partial class EnrollNodeRequest : PlainRequest /// -public sealed partial class EnrollNodeRequestDescriptor : RequestDescriptor +public readonly partial struct EnrollNodeRequestDescriptor { - internal EnrollNodeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrollNodeRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest instance) + { + Instance = instance; + } public EnrollNodeRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollNode; + public static explicit operator Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest instance) => new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.enroll_node"; + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs index 230e2e4cf6c..561a5a242b4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs @@ -17,62 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class EnrollNodeResponse : ElasticsearchResponse +internal sealed partial class EnrollNodeResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHttpCaCert = System.Text.Json.JsonEncodedText.Encode("http_ca_cert"); + private static readonly System.Text.Json.JsonEncodedText PropHttpCaKey = System.Text.Json.JsonEncodedText.Encode("http_ca_key"); + private static readonly System.Text.Json.JsonEncodedText PropNodesAddresses = System.Text.Json.JsonEncodedText.Encode("nodes_addresses"); + private static readonly System.Text.Json.JsonEncodedText PropTransportCaCert = System.Text.Json.JsonEncodedText.Encode("transport_ca_cert"); + private static readonly System.Text.Json.JsonEncodedText PropTransportCert = System.Text.Json.JsonEncodedText.Encode("transport_cert"); + private static readonly System.Text.Json.JsonEncodedText PropTransportKey = System.Text.Json.JsonEncodedText.Encode("transport_key"); + + public override Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHttpCaCert = default; + LocalJsonValue propHttpCaKey = default; + LocalJsonValue> propNodesAddresses = default; + LocalJsonValue propTransportCaCert = default; + LocalJsonValue propTransportCert = default; + LocalJsonValue propTransportKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHttpCaCert.TryReadProperty(ref reader, options, PropHttpCaCert, null)) + { + continue; + } + + if (propHttpCaKey.TryReadProperty(ref reader, options, PropHttpCaKey, null)) + { + continue; + } + + if (propNodesAddresses.TryReadProperty(ref reader, options, PropNodesAddresses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportCaCert.TryReadProperty(ref reader, options, PropTransportCaCert, null)) + { + continue; + } + + if (propTransportCert.TryReadProperty(ref reader, options, PropTransportCert, null)) + { + continue; + } + + if (propTransportKey.TryReadProperty(ref reader, options, PropTransportKey, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HttpCaCert = propHttpCaCert.Value, + HttpCaKey = propHttpCaKey.Value, + NodesAddresses = propNodesAddresses.Value, + TransportCaCert = propTransportCaCert.Value, + TransportCert = propTransportCert.Value, + TransportKey = propTransportKey.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHttpCaCert, value.HttpCaCert, null, null); + writer.WriteProperty(options, PropHttpCaKey, value.HttpCaKey, null, null); + writer.WriteProperty(options, PropNodesAddresses, value.NodesAddresses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportCaCert, value.TransportCaCert, null, null); + writer.WriteProperty(options, PropTransportCert, value.TransportCert, null, null); + writer.WriteProperty(options, PropTransportKey, value.TransportKey, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.EnrollNodeResponseConverter))] +public sealed partial class EnrollNodeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrollNodeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrollNodeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The CA certificate that can be used by the new node in order to sign its certificate for the HTTP layer, as a Base64 encoded string of the ASN.1 DER encoding of the certificate. /// /// - [JsonInclude, JsonPropertyName("http_ca_cert")] - public string HttpCaCert { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string HttpCaCert { get; set; } /// /// /// The CA private key that can be used by the new node in order to sign its certificate for the HTTP layer, as a Base64 encoded string of the ASN.1 DER encoding of the key. /// /// - [JsonInclude, JsonPropertyName("http_ca_key")] - public string HttpCaKey { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string HttpCaKey { get; set; } /// /// /// A list of transport addresses in the form of host:port for the nodes that are already members of the cluster. /// /// - [JsonInclude, JsonPropertyName("nodes_addresses")] - public IReadOnlyCollection NodesAddresses { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection NodesAddresses { get; set; } /// /// /// The CA certificate that is used to sign the TLS certificate for the transport layer, as a Base64 encoded string of the ASN.1 DER encoding of the certificate. /// /// - [JsonInclude, JsonPropertyName("transport_ca_cert")] - public string TransportCaCert { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportCaCert { get; set; } /// /// /// The certificate that the node can use for TLS for its transport layer, as a Base64 encoded string of the ASN.1 DER encoding of the certificate. /// /// - [JsonInclude, JsonPropertyName("transport_cert")] - public string TransportCert { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportCert { get; set; } /// /// /// The private key that the node can use for TLS for its transport layer, as a Base64 encoded string of the ASN.1 DER encoding of the key. /// /// - [JsonInclude, JsonPropertyName("transport_key")] - public string TransportKey { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportKey { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs index 57ce8199ac0..ff69d328175 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetApiKeyRequestParameters : RequestParameters +public sealed partial class GetApiKeyRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -98,6 +91,35 @@ public sealed partial class GetApiKeyRequestParameters : RequestParameters public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } +internal sealed partial class GetApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get API key information. @@ -108,11 +130,28 @@ public sealed partial class GetApiKeyRequestParameters : RequestParameters /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. /// /// -public sealed partial class GetApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestConverter))] +public sealed partial class GetApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; +#if NET7_0_OR_GREATER + public GetApiKeyRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetApiKey; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -123,7 +162,6 @@ public sealed partial class GetApiKeyRequest : PlainRequestowner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. /// /// - [JsonIgnore] public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } /// @@ -132,7 +170,6 @@ public sealed partial class GetApiKeyRequest : PlainRequestname, realm_name or username. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Id? Id { get => Q("id"); set => Q("id", value); } /// @@ -142,7 +179,6 @@ public sealed partial class GetApiKeyRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? Name { get => Q("name"); set => Q("name", value); } /// @@ -151,7 +187,6 @@ public sealed partial class GetApiKeyRequest : PlainRequestrealm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. /// /// - [JsonIgnore] public bool? Owner { get => Q("owner"); set => Q("owner", value); } /// @@ -160,7 +195,6 @@ public sealed partial class GetApiKeyRequest : PlainRequestid or name or when owner flag is set to true. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? RealmName { get => Q("realm_name"); set => Q("realm_name", value); } /// @@ -169,7 +203,6 @@ public sealed partial class GetApiKeyRequest : PlainRequestid or name or when owner flag is set to true. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Username? Username { get => Q("username"); set => Q("username", value); } /// @@ -180,7 +213,6 @@ public sealed partial class GetApiKeyRequest : PlainRequest /// - [JsonIgnore] public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } /// @@ -188,7 +220,6 @@ public sealed partial class GetApiKeyRequest : PlainRequest /// - [JsonIgnore] public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } @@ -202,32 +233,173 @@ public sealed partial class GetApiKeyRequest : PlainRequestread_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. /// /// -public sealed partial class GetApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct GetApiKeyRequestDescriptor { - internal GetApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest instance) + { + Instance = instance; + } public GetApiKeyRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as owner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor ActiveOnly(bool? value = true) + { + Instance.ActiveOnly = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// An API key id. + /// This parameter cannot be used with any of name, realm_name or username. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// An API key name. + /// This parameter cannot be used with any of id, realm_name or username. + /// It supports prefix search with wildcard. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "security.get_api_key"; + /// + /// + /// A boolean flag that can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Owner(bool? value = true) + { + Instance.Owner = value; + return this; + } - public GetApiKeyRequestDescriptor ActiveOnly(bool? activeOnly = true) => Qs("active_only", activeOnly); - public GetApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) => Qs("id", id); - public GetApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) => Qs("name", name); - public GetApiKeyRequestDescriptor Owner(bool? owner = true) => Qs("owner", owner); - public GetApiKeyRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? realmName) => Qs("realm_name", realmName); - public GetApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) => Qs("username", username); - public GetApiKeyRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); - public GetApiKeyRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.RealmName = value; + return this; + } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) + { + Instance.Username = value; + return this; + } + + /// + /// + /// Return the snapshot of the owner user's role descriptors + /// associated with the API key. An API key's actual + /// permission is the intersection of its assigned role + /// descriptors and the owner user's role descriptors. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor WithLimitedBy(bool? value = true) + { + Instance.WithLimitedBy = value; + return this; + } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs index 39e7a09e307..7d5cd465f6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetApiKeyResponse : ElasticsearchResponse +internal sealed partial class GetApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("api_keys")] - public IReadOnlyCollection ApiKeys { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropApiKeys = System.Text.Json.JsonEncodedText.Encode("api_keys"); + + public override Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propApiKeys = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKeys.TryReadProperty(ref reader, options, PropApiKeys, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKeys = propApiKeys.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKeys, value.ApiKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetApiKeyResponseConverter))] +public sealed partial class GetApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ApiKeys { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs index 218da5b567b..cf59ec9a857 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetBuiltinPrivilegesRequestParameters : RequestParameters +public sealed partial class GetBuiltinPrivilegesRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetBuiltinPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -42,11 +64,28 @@ public sealed partial class GetBuiltinPrivilegesRequestParameters : RequestParam /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. /// /// -public sealed partial class GetBuiltinPrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestConverter))] +public sealed partial class GetBuiltinPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; +#if NET7_0_OR_GREATER + public GetBuiltinPrivilegesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetBuiltinPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetBuiltinPrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -61,23 +100,76 @@ public sealed partial class GetBuiltinPrivilegesRequest : PlainRequest /// -public sealed partial class GetBuiltinPrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct GetBuiltinPrivilegesRequestDescriptor { - internal GetBuiltinPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBuiltinPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest instance) + { + Instance = instance; + } public GetBuiltinPrivilegesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override bool SupportsBody => false; + var builder = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.get_builtin_privileges"; + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs index 1884ff7bccf..7eaaf243ad3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs @@ -17,39 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetBuiltinPrivilegesResponse : ElasticsearchResponse +internal sealed partial class GetBuiltinPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + + public override Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCluster = default; + LocalJsonValue> propIndex = default; + LocalJsonValue> propRemoteCluster = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cluster = propCluster.Value, + Index = propIndex.Value, + RemoteCluster = propRemoteCluster.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponseConverter))] +public sealed partial class GetBuiltinPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetBuiltinPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetBuiltinPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The list of cluster privileges that are understood by this version of Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("cluster")] - public IReadOnlyCollection Cluster { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Cluster { get; set; } /// /// /// The list of index privileges that are understood by this version of Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("index")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Index { get; set; } /// /// /// The list of remote_cluster privileges that are understood by this version of Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("remote_cluster")] - public IReadOnlyCollection RemoteCluster { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RemoteCluster { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs index b336fdc83e1..b5365a53bff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetPrivilegesRequestParameters : RequestParameters +public sealed partial class GetPrivilegesRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get application privileges. @@ -54,12 +76,9 @@ public sealed partial class GetPrivilegesRequestParameters : RequestParameters /// /// /// -public sealed partial class GetPrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestConverter))] +public sealed partial class GetPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetPrivilegesRequest() - { - } - public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application) : base(r => r.Optional("application", application)) { } @@ -67,14 +86,46 @@ public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application) : b public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) { } +#if NET7_0_OR_GREATER + public GetPrivilegesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetPrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_privileges"; + + /// + /// + /// The name of the application. + /// Application privileges are always associated with exactly one application. + /// If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Application { get => P("application"); set => PO("application", value); } + + /// + /// + /// The name of the privilege. + /// If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } } /// @@ -97,39 +148,111 @@ public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application, Ela /// /// /// -public sealed partial class GetPrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct GetPrivilegesRequestDescriptor { - internal GetPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest Instance { get; init; } - public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest instance) { + Instance = instance; + } + + public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? application) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(application); + } + + public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(application, name); } public GetPrivilegesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The name of the application. + /// Application privileges are always associated with exactly one application. + /// If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Application = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The name of the privilege. + /// If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "security.get_privileges"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? application) + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("application", application); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetPrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs index c9440766cdc..8b9b60ed4d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetPrivilegesResponse : DictionaryResponse> +internal sealed partial class GetPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Privileges = reader.ReadValue>>(options, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!) }; } - public GetPrivilegesResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Privileges, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponseConverter))] +public sealed partial class GetPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary> Privileges { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs index 8a4c6a97c43..ac33f650f65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetRoleMappingRequestParameters : RequestParameters +public sealed partial class GetRoleMappingRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRoleMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get role mappings. @@ -44,23 +66,42 @@ public sealed partial class GetRoleMappingRequestParameters : RequestParameters /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. /// /// -public sealed partial class GetRoleMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestConverter))] +public sealed partial class GetRoleMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetRoleMappingRequest() { } - - public GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetRoleMappingRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetRoleMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_role_mapping"; + + /// + /// + /// The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. You can specify multiple mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } } /// @@ -73,33 +114,92 @@ public GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. /// /// -public sealed partial class GetRoleMappingRequestDescriptor : RequestDescriptor +public readonly partial struct GetRoleMappingRequestDescriptor { - internal GetRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest instance) + { + Instance = instance; + } - public GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + public GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) { + Instance = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(name); } public GetRoleMappingRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. You can specify multiple mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.get_role_mapping"; + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs index 58fa5183eff..5535cb646a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetRoleMappingResponse : DictionaryResponse +internal sealed partial class GetRoleMappingResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetRoleMappingResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { RoleMappings = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetRoleMappingResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.RoleMappings, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponseConverter))] +public sealed partial class GetRoleMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRoleMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary RoleMappings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs index a065e28fd89..3f770d5f942 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetRoleRequestParameters : RequestParameters +public sealed partial class GetRoleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get roles. @@ -44,23 +66,44 @@ public sealed partial class GetRoleRequestParameters : RequestParameters /// The get roles API cannot retrieve roles that are defined in roles files. /// /// -public sealed partial class GetRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetRoleRequestConverter))] +public sealed partial class GetRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetRoleRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } +#if NET7_0_OR_GREATER public GetRoleRequest() { } - - public GetRoleRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) +#endif +#if !NET7_0_OR_GREATER + public GetRoleRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_role"; + + /// + /// + /// The name of the role. + /// You can specify multiple roles as a comma-separated list. + /// If you do not specify this parameter, the API returns information about all roles. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("name"); set => PO("name", value); } } /// @@ -73,33 +116,94 @@ public GetRoleRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.O /// The get roles API cannot retrieve roles that are defined in roles files. /// /// -public sealed partial class GetRoleRequestDescriptor : RequestDescriptor +public readonly partial struct GetRoleRequestDescriptor { - internal GetRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetRoleRequest Instance { get; init; } - public GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetRoleRequest instance) { + Instance = instance; + } + + public GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetRoleRequest(name); } public GetRoleRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetRoleRequest(Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the role. + /// You can specify multiple roles as a comma-separated list. + /// If you do not specify this parameter, the API returns information about all roles. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetRoleRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - internal override string OperationName => "security.get_role"; + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("name", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs index 3ed23466f8d..ead5afce2a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetRoleResponse : DictionaryResponse +internal sealed partial class GetRoleResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetRoleResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.GetRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.GetRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Roles = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetRoleResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetRoleResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Roles, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetRoleResponseConverter))] +public sealed partial class GetRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Roles { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsRequest.g.cs index d86243a72d9..b2839cc1dd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetSecuritySettingsRequestParameters : RequestParameters +public sealed partial class GetSecuritySettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,35 @@ public sealed partial class GetSecuritySettingsRequestParameters : RequestParame public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetSecuritySettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get security index settings. @@ -63,11 +85,28 @@ public sealed partial class GetSecuritySettingsRequestParameters : RequestParame /// /// /// -public sealed partial class GetSecuritySettingsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestConverter))] +public sealed partial class GetSecuritySettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetSettings; +#if NET7_0_OR_GREATER + public GetSecuritySettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetSecuritySettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetSettings; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -79,7 +118,6 @@ public sealed partial class GetSecuritySettingsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -105,25 +143,88 @@ public sealed partial class GetSecuritySettingsRequest : PlainRequest /// /// -public sealed partial class GetSecuritySettingsRequestDescriptor : RequestDescriptor +public readonly partial struct GetSecuritySettingsRequestDescriptor { - internal GetSecuritySettingsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSecuritySettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest instance) + { + Instance = instance; + } public GetSecuritySettingsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetSettings; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override string OperationName => "security.get_settings"; + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetSecuritySettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsResponse.g.cs index 971087523dd..1f68956e422 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetSecuritySettingsResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetSecuritySettingsResponse : ElasticsearchResponse +internal sealed partial class GetSecuritySettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropSecurity = System.Text.Json.JsonEncodedText.Encode("security"); + private static readonly System.Text.Json.JsonEncodedText PropSecurityProfile = System.Text.Json.JsonEncodedText.Encode("security-profile"); + private static readonly System.Text.Json.JsonEncodedText PropSecurityTokens = System.Text.Json.JsonEncodedText.Encode("security-tokens"); + + public override Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSecurity = default; + LocalJsonValue propSecurityProfile = default; + LocalJsonValue propSecurityTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSecurity.TryReadProperty(ref reader, options, PropSecurity, null)) + { + continue; + } + + if (propSecurityProfile.TryReadProperty(ref reader, options, PropSecurityProfile, null)) + { + continue; + } + + if (propSecurityTokens.TryReadProperty(ref reader, options, PropSecurityTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Security = propSecurity.Value, + SecurityProfile = propSecurityProfile.Value, + SecurityTokens = propSecurityTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSecurity, value.Security, null, null); + writer.WriteProperty(options, PropSecurityProfile, value.SecurityProfile, null, null); + writer.WriteProperty(options, PropSecurityTokens, value.SecurityTokens, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponseConverter))] +public sealed partial class GetSecuritySettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSecuritySettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSecuritySettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. /// /// - [JsonInclude, JsonPropertyName("security")] - public Elastic.Clients.Elasticsearch.Security.SecuritySettings Security { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.SecuritySettings Security { get; set; } /// /// /// Settings for the index used to store profile information. /// /// - [JsonInclude, JsonPropertyName("security-profile")] - public Elastic.Clients.Elasticsearch.Security.SecuritySettings SecurityProfile { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.SecuritySettings SecurityProfile { get; set; } /// /// /// Settings for the index used to store tokens. /// /// - [JsonInclude, JsonPropertyName("security-tokens")] - public Elastic.Clients.Elasticsearch.Security.SecuritySettings SecurityTokens { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.SecuritySettings SecurityTokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs index 7da44006569..f808de6bb74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetServiceAccountsRequestParameters : RequestParameters +public sealed partial class GetServiceAccountsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetServiceAccountsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get service accounts. @@ -45,27 +67,56 @@ public sealed partial class GetServiceAccountsRequestParameters : RequestParamet /// NOTE: Currently, only the elastic/fleet-server service account is available. /// /// -public sealed partial class GetServiceAccountsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestConverter))] +public sealed partial class GetServiceAccountsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetServiceAccountsRequest() + public GetServiceAccountsRequest(string? @namespace, string? service) : base(r => r.Optional("namespace", @namespace).Optional("service", service)) { } - public GetServiceAccountsRequest(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + public GetServiceAccountsRequest(string? @namespace) : base(r => r.Optional("namespace", @namespace)) { } - - public GetServiceAccountsRequest(string? ns) : base(r => r.Optional("namespace", ns)) +#if NET7_0_OR_GREATER + public GetServiceAccountsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetServiceAccountsRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetServiceAccounts; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_service_accounts"; + + /// + /// + /// The name of the namespace. + /// Omit this parameter to retrieve information about all service accounts. + /// If you omit this parameter, you must also omit the service parameter. + /// + /// + public string? Namespace { get => P("namespace"); set => PO("namespace", value); } + + /// + /// + /// The service name. + /// Omit this parameter to retrieve information about all service accounts that belong to the specified namespace. + /// + /// + public string? Service { get => P("service"); set => PO("service", value); } } /// @@ -79,39 +130,111 @@ public GetServiceAccountsRequest(string? ns) : base(r => r.Optional("namespace", /// NOTE: Currently, only the elastic/fleet-server service account is available. /// /// -public sealed partial class GetServiceAccountsRequestDescriptor : RequestDescriptor +public readonly partial struct GetServiceAccountsRequestDescriptor { - internal GetServiceAccountsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetServiceAccountsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest instance) + { + Instance = instance; + } - public GetServiceAccountsRequestDescriptor(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + public GetServiceAccountsRequestDescriptor(string? @namespace, string? service) { + Instance = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(@namespace, service); + } + + public GetServiceAccountsRequestDescriptor(string? @namespace) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(@namespace); } public GetServiceAccountsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the namespace. + /// Omit this parameter to retrieve information about all service accounts. + /// If you omit this parameter, you must also omit the service parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor Namespace(string? value) + { + Instance.Namespace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The service name. + /// Omit this parameter to retrieve information about all service accounts that belong to the specified namespace. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor Service(string? value) + { + Instance.Service = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "security.get_service_accounts"; + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetServiceAccountsRequestDescriptor Namespace(string? ns) + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("namespace", ns); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetServiceAccountsRequestDescriptor Service(string? service) + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("service", service); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs index a9dc12e37ea..e5215ea21fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetServiceAccountsResponse : DictionaryResponse +internal sealed partial class GetServiceAccountsResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetServiceAccountsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { ServiceAccoutns = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetServiceAccountsResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.ServiceAccoutns, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponseConverter))] +public sealed partial class GetServiceAccountsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetServiceAccountsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetServiceAccountsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary ServiceAccoutns { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs index 3524da47732..423d5ec791c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetServiceCredentialsRequestParameters : RequestParameters +public sealed partial class GetServiceCredentialsRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetServiceCredentialsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get service account credentials. @@ -49,19 +71,53 @@ public sealed partial class GetServiceCredentialsRequestParameters : RequestPara /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. /// /// -public sealed partial class GetServiceCredentialsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestConverter))] +public sealed partial class GetServiceCredentialsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetServiceCredentialsRequest(string ns, Elastic.Clients.Elasticsearch.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetServiceCredentialsRequest(string @namespace, Elastic.Clients.Elasticsearch.Name service) : base(r => r.Required("namespace", @namespace).Required("service", service)) { } +#if NET7_0_OR_GREATER + public GetServiceCredentialsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetServiceCredentialsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetServiceCredentials; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_service_credentials"; + + /// + /// + /// The name of the namespace. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Namespace { get => P("namespace"); set => PR("namespace", value); } + + /// + /// + /// The service name. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Service { get => P("service"); set => PR("service", value); } } /// @@ -79,35 +135,99 @@ public GetServiceCredentialsRequest(string ns, Elastic.Clients.Elasticsearch.Nam /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. /// /// -public sealed partial class GetServiceCredentialsRequestDescriptor : RequestDescriptor +public readonly partial struct GetServiceCredentialsRequestDescriptor { - internal GetServiceCredentialsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest Instance { get; init; } - public GetServiceCredentialsRequestDescriptor(string ns, Elastic.Clients.Elasticsearch.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetServiceCredentialsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + public GetServiceCredentialsRequestDescriptor(string @namespace, Elastic.Clients.Elasticsearch.Name service) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest(@namespace, service); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetServiceCredentialsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.get_service_credentials"; + /// + /// + /// The name of the namespace. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor Namespace(string value) + { + Instance.Namespace = value; + return this; + } + + /// + /// + /// The service name. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor Service(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Service = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetServiceCredentialsRequestDescriptor Namespace(string ns) + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("namespace", ns); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetServiceCredentialsRequestDescriptor Service(Elastic.Clients.Elasticsearch.Name service) + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("service", service); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs index c4ffbf06f64..616576c6410 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetServiceCredentialsResponse : ElasticsearchResponse +internal sealed partial class GetServiceCredentialsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropNodesCredentials = System.Text.Json.JsonEncodedText.Encode("nodes_credentials"); + private static readonly System.Text.Json.JsonEncodedText PropServiceAccount = System.Text.Json.JsonEncodedText.Encode("service_account"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + + public override Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propNodesCredentials = default; + LocalJsonValue propServiceAccount = default; + LocalJsonValue>> propTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propNodesCredentials.TryReadProperty(ref reader, options, PropNodesCredentials, null)) + { + continue; + } + + if (propServiceAccount.TryReadProperty(ref reader, options, PropServiceAccount, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + NodesCredentials = propNodesCredentials.Value, + ServiceAccount = propServiceAccount.Value, + Tokens = propTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropNodesCredentials, value.NodesCredentials, null, null); + writer.WriteProperty(options, PropServiceAccount, value.ServiceAccount, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponseConverter))] +public sealed partial class GetServiceCredentialsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetServiceCredentialsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetServiceCredentialsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Service account credentials collected from all nodes of the cluster. /// /// - [JsonInclude, JsonPropertyName("nodes_credentials")] - public Elastic.Clients.Elasticsearch.Security.NodesCredentials NodesCredentials { get; init; } - [JsonInclude, JsonPropertyName("service_account")] - public string ServiceAccount { get; init; } - [JsonInclude, JsonPropertyName("tokens")] - public IReadOnlyDictionary> Tokens { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.NodesCredentials NodesCredentials { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ServiceAccount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Tokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs index bbe54f8bd35..e246fcb3db7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs @@ -17,21 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetTokenRequestParameters : RequestParameters +public sealed partial class GetTokenRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GetTokenRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropGrantType = System.Text.Json.JsonEncodedText.Encode("grant_type"); + private static readonly System.Text.Json.JsonEncodedText PropKerberosTicket = System.Text.Json.JsonEncodedText.Encode("kerberos_ticket"); + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropScope = System.Text.Json.JsonEncodedText.Encode("scope"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.GetTokenRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGrantType = default; + LocalJsonValue propKerberosTicket = default; + LocalJsonValue propPassword = default; + LocalJsonValue propRefreshToken = default; + LocalJsonValue propScope = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGrantType.TryReadProperty(ref reader, options, PropGrantType, null)) + { + continue; + } + + if (propKerberosTicket.TryReadProperty(ref reader, options, PropKerberosTicket, null)) + { + continue; + } + + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propScope.TryReadProperty(ref reader, options, PropScope, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GrantType = propGrantType.Value, + KerberosTicket = propKerberosTicket.Value, + Password = propPassword.Value, + RefreshToken = propRefreshToken.Value, + Scope = propScope.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetTokenRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGrantType, value.GrantType, null, null); + writer.WriteProperty(options, PropKerberosTicket, value.KerberosTicket, null, null); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropScope, value.Scope, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } } /// @@ -56,11 +133,28 @@ public sealed partial class GetTokenRequestParameters : RequestParameters /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. /// /// -public sealed partial class GetTokenRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetTokenRequestConverter))] +public sealed partial class GetTokenRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; +#if NET7_0_OR_GREATER + public GetTokenRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetTokenRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetToken; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -72,7 +166,6 @@ public sealed partial class GetTokenRequest : PlainRequestpassword, _kerberos, client_credentials, and refresh_token. /// /// - [JsonInclude, JsonPropertyName("grant_type")] public Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? GrantType { get; set; } /// @@ -82,7 +175,6 @@ public sealed partial class GetTokenRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("kerberos_ticket")] public string? KerberosTicket { get; set; } /// @@ -92,7 +184,6 @@ public sealed partial class GetTokenRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -102,7 +193,6 @@ public sealed partial class GetTokenRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("refresh_token")] public string? RefreshToken { get; set; } /// @@ -111,7 +201,6 @@ public sealed partial class GetTokenRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("scope")] public string? Scope { get; set; } /// @@ -121,7 +210,6 @@ public sealed partial class GetTokenRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("username")] public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } @@ -147,28 +235,23 @@ public sealed partial class GetTokenRequest : PlainRequest /// -public sealed partial class GetTokenRequestDescriptor : RequestDescriptor +public readonly partial struct GetTokenRequestDescriptor { - internal GetTokenRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetTokenRequest Instance { get; init; } - public GetTokenRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetTokenRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.get_token"; + public GetTokenRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? GrantTypeValue { get; set; } - private string? KerberosTicketValue { get; set; } - private string? PasswordValue { get; set; } - private string? RefreshTokenValue { get; set; } - private string? ScopeValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetTokenRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetTokenRequest(Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -176,10 +259,10 @@ public GetTokenRequestDescriptor() /// Supported grant types are: password, _kerberos, client_credentials, and refresh_token. /// /// - public GetTokenRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? grantType) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? value) { - GrantTypeValue = grantType; - return Self; + Instance.GrantType = value; + return this; } /// @@ -189,10 +272,10 @@ public GetTokenRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Securit /// This parameter is not valid with any other supported grant type. /// /// - public GetTokenRequestDescriptor KerberosTicket(string? kerberosTicket) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor KerberosTicket(string? value) { - KerberosTicketValue = kerberosTicket; - return Self; + Instance.KerberosTicket = value; + return this; } /// @@ -202,10 +285,10 @@ public GetTokenRequestDescriptor KerberosTicket(string? kerberosTicket) /// This parameter is not valid with any other supported grant type. /// /// - public GetTokenRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -215,10 +298,10 @@ public GetTokenRequestDescriptor Password(string? password) /// This parameter is not valid with any other supported grant type. /// /// - public GetTokenRequestDescriptor RefreshToken(string? refreshToken) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor RefreshToken(string? value) { - RefreshTokenValue = refreshToken; - return Self; + Instance.RefreshToken = value; + return this; } /// @@ -227,10 +310,10 @@ public GetTokenRequestDescriptor RefreshToken(string? refreshToken) /// Currently tokens are only issued for a scope of FULL regardless of the value sent with the request. /// /// - public GetTokenRequestDescriptor Scope(string? scope) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor Scope(string? value) { - ScopeValue = scope; - return Self; + Instance.Scope = value; + return this; } /// @@ -240,51 +323,64 @@ public GetTokenRequestDescriptor Scope(string? scope) /// This parameter is not valid with any other supported grant type. /// /// - public GetTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetTokenRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (GrantTypeValue is not null) + if (action is null) { - writer.WritePropertyName("grant_type"); - JsonSerializer.Serialize(writer, GrantTypeValue, options); + return new Elastic.Clients.Elasticsearch.Security.GetTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(KerberosTicketValue)) - { - writer.WritePropertyName("kerberos_ticket"); - writer.WriteStringValue(KerberosTicketValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(RefreshTokenValue)) - { - writer.WritePropertyName("refresh_token"); - writer.WriteStringValue(RefreshTokenValue); - } + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(ScopeValue)) - { - writer.WritePropertyName("scope"); - writer.WriteStringValue(ScopeValue); - } + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs index 07fd75ec184..937be964ce6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs @@ -17,29 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetTokenResponse : ElasticsearchResponse +internal sealed partial class GetTokenResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("access_token")] - public string AccessToken { get; init; } - [JsonInclude, JsonPropertyName("authentication")] - public Elastic.Clients.Elasticsearch.Security.AuthenticatedUser Authentication { get; init; } - [JsonInclude, JsonPropertyName("expires_in")] - public long ExpiresIn { get; init; } - [JsonInclude, JsonPropertyName("kerberos_authentication_response_token")] - public string? KerberosAuthenticationResponseToken { get; init; } - [JsonInclude, JsonPropertyName("refresh_token")] - public string? RefreshToken { get; init; } - [JsonInclude, JsonPropertyName("scope")] - public string? Scope { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropAuthentication = System.Text.Json.JsonEncodedText.Encode("authentication"); + private static readonly System.Text.Json.JsonEncodedText PropExpiresIn = System.Text.Json.JsonEncodedText.Encode("expires_in"); + private static readonly System.Text.Json.JsonEncodedText PropKerberosAuthenticationResponseToken = System.Text.Json.JsonEncodedText.Encode("kerberos_authentication_response_token"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropScope = System.Text.Json.JsonEncodedText.Encode("scope"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.GetTokenResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propAuthentication = default; + LocalJsonValue propExpiresIn = default; + LocalJsonValue propKerberosAuthenticationResponseToken = default; + LocalJsonValue propRefreshToken = default; + LocalJsonValue propScope = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propAuthentication.TryReadProperty(ref reader, options, PropAuthentication, null)) + { + continue; + } + + if (propExpiresIn.TryReadProperty(ref reader, options, PropExpiresIn, null)) + { + continue; + } + + if (propKerberosAuthenticationResponseToken.TryReadProperty(ref reader, options, PropKerberosAuthenticationResponseToken, null)) + { + continue; + } + + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propScope.TryReadProperty(ref reader, options, PropScope, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + Authentication = propAuthentication.Value, + ExpiresIn = propExpiresIn.Value, + KerberosAuthenticationResponseToken = propKerberosAuthenticationResponseToken.Value, + RefreshToken = propRefreshToken.Value, + Scope = propScope.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetTokenResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropAuthentication, value.Authentication, null, null); + writer.WriteProperty(options, PropExpiresIn, value.ExpiresIn, null, null); + writer.WriteProperty(options, PropKerberosAuthenticationResponseToken, value.KerberosAuthenticationResponseToken, null, null); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropScope, value.Scope, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetTokenResponseConverter))] +public sealed partial class GetTokenResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTokenResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string AccessToken { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.AuthenticatedUser Authentication { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ExpiresIn { get; set; } + public string? KerberosAuthenticationResponseToken { get; set; } + public string? RefreshToken { get; set; } + public string? Scope { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs index 0f6204998bc..df2711f0050 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserPrivilegesRequestParameters : RequestParameters +public sealed partial class GetUserPrivilegesRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,6 +41,35 @@ public sealed partial class GetUserPrivilegesRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Name? Username { get => Q("username"); set => Q("username", value); } } +internal sealed partial class GetUserPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get user privileges. @@ -59,11 +81,28 @@ public sealed partial class GetUserPrivilegesRequestParameters : RequestParamete /// To check whether a user has a specific list of privileges, use the has privileges API. /// /// -public sealed partial class GetUserPrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestConverter))] +public sealed partial class GetUserPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; +#if NET7_0_OR_GREATER + public GetUserPrivilegesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetUserPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetUserPrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -74,7 +113,6 @@ public sealed partial class GetUserPrivilegesRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? Application { get => Q("application"); set => Q("application", value); } /// @@ -82,9 +120,7 @@ public sealed partial class GetUserPrivilegesRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? Priviledge { get => Q("priviledge"); set => Q("priviledge", value); } - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? Username { get => Q("username"); set => Q("username", value); } } @@ -99,27 +135,104 @@ public sealed partial class GetUserPrivilegesRequest : PlainRequest /// -public sealed partial class GetUserPrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct GetUserPrivilegesRequestDescriptor { - internal GetUserPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest instance) + { + Instance = instance; + } public GetUserPrivilegesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Application = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor Priviledge(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Priviledge = value; + return this; + } - internal override string OperationName => "security.get_user_privileges"; + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor Username(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Username = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public GetUserPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? application) => Qs("application", application); - public GetUserPrivilegesRequestDescriptor Priviledge(Elastic.Clients.Elasticsearch.Name? priviledge) => Qs("priviledge", priviledge); - public GetUserPrivilegesRequestDescriptor Username(Elastic.Clients.Elasticsearch.Name? username) => Qs("username", username); + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs index fad2cdfadbb..542909a3d95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs @@ -17,29 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserPrivilegesResponse : ElasticsearchResponse +internal sealed partial class GetUserPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("applications")] - public IReadOnlyCollection Applications { get; init; } - [JsonInclude, JsonPropertyName("cluster")] - public IReadOnlyCollection Cluster { get; init; } - [JsonInclude, JsonPropertyName("global")] - public IReadOnlyCollection Global { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("remote_cluster")] - public IReadOnlyCollection? RemoteCluster { get; init; } - [JsonInclude, JsonPropertyName("remote_indices")] - public IReadOnlyCollection? RemoteIndices { get; init; } - [JsonInclude, JsonPropertyName("run_as")] - public IReadOnlyCollection RunAs { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + + public override Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propApplications = default; + LocalJsonValue> propCluster = default; + LocalJsonValue> propGlobal = default; + LocalJsonValue> propIndices = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue> propRunAs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value, + Cluster = propCluster.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + RunAs = propRunAs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponseConverter))] +public sealed partial class GetUserPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Applications { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Cluster { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Global { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RemoteCluster { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RemoteIndices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RunAs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs index 0775822ceb4..1aa13116033 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserProfileRequestParameters : RequestParameters +public sealed partial class GetUserProfileRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,7 +33,36 @@ public sealed partial class GetUserProfileRequestParameters : RequestParameters /// By default returns no data content. /// /// - public ICollection? Data { get => Q?>("data"); set => Q("data", value); } + public System.Collections.Generic.ICollection? Data { get => Q?>("data"); set => Q("data", value); } +} + +internal sealed partial class GetUserProfileRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -56,20 +78,43 @@ public sealed partial class GetUserProfileRequestParameters : RequestParameters /// Elastic reserves the right to change or remove this feature in future releases without prior notice. /// /// -public sealed partial class GetUserProfileRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestConverter))] +public sealed partial class GetUserProfileRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public GetUserProfileRequest(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserProfileRequest(System.Collections.Generic.ICollection uid) : base(r => r.Required("uid", uid)) + { + } +#if NET7_0_OR_GREATER + public GetUserProfileRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetUserProfile; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_user_profile"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Uid { get => P>("uid"); set => PR("uid", value); } + /// /// /// A comma-separated list of filters for the data field of the profile document. @@ -78,8 +123,7 @@ public GetUserProfileRequest(IReadOnlyCollection uid) : base(r => r.Requ /// By default returns no data content. /// /// - [JsonIgnore] - public ICollection? Data { get => Q?>("data"); set => Q("data", value); } + public System.Collections.Generic.ICollection? Data { get => Q?>("data"); set => Q("data", value); } } /// @@ -95,31 +139,127 @@ public GetUserProfileRequest(IReadOnlyCollection uid) : base(r => r.Requ /// Elastic reserves the right to change or remove this feature in future releases without prior notice. /// /// -public sealed partial class GetUserProfileRequestDescriptor : RequestDescriptor +public readonly partial struct GetUserProfileRequestDescriptor { - internal GetUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest Instance { get; init; } - public GetUserProfileRequestDescriptor(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + public GetUserProfileRequestDescriptor(System.Collections.Generic.ICollection uid) + { + Instance = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest(uid); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetUserProfileRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.get_user_profile"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Uid(System.Collections.Generic.ICollection value) + { + Instance.Uid = value; + return this; + } + + /// + /// + /// A unique identifier for the user profile. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Uid(params string[] values) + { + Instance.Uid = [.. values]; + return this; + } - public GetUserProfileRequestDescriptor Data(ICollection? data) => Qs("data", data); + /// + /// + /// A comma-separated list of filters for the data field of the profile document. + /// To return all content use data=*. + /// To return a subset of content use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Data(System.Collections.Generic.ICollection? value) + { + Instance.Data = value; + return this; + } + + /// + /// + /// A comma-separated list of filters for the data field of the profile document. + /// To return all content use data=*. + /// To return a subset of content use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Data(params string[] values) + { + Instance.Data = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetUserProfileRequestDescriptor Uid(IReadOnlyCollection uid) + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("uid", uid); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs index 1fb42115499..f1d065ddfad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs @@ -17,19 +17,75 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserProfileResponse : ElasticsearchResponse +internal sealed partial class GetUserProfileResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropProfiles = System.Text.Json.JsonEncodedText.Encode("profiles"); + + public override Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrors = default; + LocalJsonValue> propProfiles = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propProfiles.TryReadProperty(ref reader, options, PropProfiles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Errors = propErrors.Value, + Profiles = propProfiles.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropProfiles, value.Profiles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserProfileResponseConverter))] +public sealed partial class GetUserProfileResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("errors")] - public Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors? Errors { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserProfileResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors? Errors { get; set; } /// /// @@ -38,6 +94,9 @@ public sealed partial class GetUserProfileResponse : ElasticsearchResponse /// The content of the data field is not returned by default to avoid deserializing a potential large payload. /// /// - [JsonInclude, JsonPropertyName("profiles")] - public IReadOnlyCollection Profiles { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Profiles { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs index b10ec69b601..97f8c00722b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserRequestParameters : RequestParameters +public sealed partial class GetUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,35 @@ public sealed partial class GetUserRequestParameters : RequestParameters public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } +internal sealed partial class GetUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.GetUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get users. @@ -48,30 +70,48 @@ public sealed partial class GetUserRequestParameters : RequestParameters /// Get information about users in the native realm and built-in users. /// /// -public sealed partial class GetUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserRequestConverter))] +public sealed partial class GetUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetUserRequest(System.Collections.Generic.ICollection? username) : base(r => r.Optional("username", username)) + { + } +#if NET7_0_OR_GREATER public GetUserRequest() { } - - public GetUserRequest(IReadOnlyCollection? username) : base(r => r.Optional("username", username)) +#endif +#if !NET7_0_OR_GREATER + public GetUserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUser; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGetUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.get_user"; + /// + /// + /// An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. + /// + /// + public System.Collections.Generic.ICollection? Username { get => P?>("username"); set => PO("username", value); } + /// /// /// Determines whether to retrieve the user profile UID, if it exists, for the users. /// /// - [JsonIgnore] public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } @@ -83,35 +123,114 @@ public GetUserRequest(IReadOnlyCollection /// -public sealed partial class GetUserRequestDescriptor : RequestDescriptor +public readonly partial struct GetUserRequestDescriptor { - internal GetUserRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GetUserRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserRequest instance) + { + Instance = instance; + } - public GetUserRequestDescriptor(IReadOnlyCollection? username) : base(r => r.Optional("username", username)) + public GetUserRequestDescriptor(System.Collections.Generic.ICollection? username) { + Instance = new Elastic.Clients.Elasticsearch.Security.GetUserRequest(username); } public GetUserRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GetUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUser; + public static explicit operator Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GetUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GetUserRequest(Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor Username(System.Collections.Generic.ICollection? value) + { + Instance.Username = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor Username(params Elastic.Clients.Elasticsearch.Username[] values) + { + Instance.Username = [.. values]; + return this; + } - internal override string OperationName => "security.get_user"; + /// + /// + /// Determines whether to retrieve the user profile UID, if it exists, for the users. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } - public GetUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GetUserRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Security.GetUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GetUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetUserRequestDescriptor Username(IReadOnlyCollection? username) + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("username", username); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs index 3b694bc7c42..44737da4592 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GetUserResponse : DictionaryResponse +internal sealed partial class GetUserResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetUserResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.GetUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.GetUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Users = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetUserResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Users, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserResponseConverter))] +public sealed partial class GetUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Users { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs index 21fc73fc0db..c2876e6a0c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs @@ -17,21 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GrantApiKeyRequestParameters : RequestParameters +public sealed partial class GrantApiKeyRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class GrantApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropGrantType = System.Text.Json.JsonEncodedText.Encode("grant_type"); + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propApiKey = default; + LocalJsonValue propGrantType = default; + LocalJsonValue propPassword = default; + LocalJsonValue propRunAs = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propGrantType.TryReadProperty(ref reader, options, PropGrantType, null)) + { + continue; + } + + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + ApiKey = propApiKey.Value, + GrantType = propGrantType.Value, + Password = propPassword.Value, + RunAs = propRunAs.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropGrantType, value.GrantType, null, null); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } } /// @@ -78,11 +155,35 @@ public sealed partial class GrantApiKeyRequestParameters : RequestParameters /// By default, API keys never expire. You can specify expiration information when you create the API keys. /// /// -public sealed partial class GrantApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestConverter))] +public sealed partial class GrantApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Security.GrantApiKey apiKey, Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType grantType) + { + ApiKey = apiKey; + GrantType = grantType; + } +#if NET7_0_OR_GREATER + public GrantApiKeyRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GrantApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityGrantApiKey; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -95,7 +196,6 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("access_token")] public string? AccessToken { get; set; } /// @@ -103,16 +203,22 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("api_key")] - public Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKey { get; set; } /// /// /// The type of grant. Supported grant types are: access_token, password. /// /// - [JsonInclude, JsonPropertyName("grant_type")] - public Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantType { get; set; } /// /// @@ -121,7 +227,6 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -129,7 +234,6 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("run_as")] public Elastic.Clients.Elasticsearch.Username? RunAs { get; set; } /// @@ -139,7 +243,6 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("username")] public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } @@ -187,30 +290,23 @@ public sealed partial class GrantApiKeyRequest : PlainRequest /// -public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor, GrantApiKeyRequestParameters> +public readonly partial struct GrantApiKeyRequestDescriptor { - internal GrantApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest Instance { get; init; } - public GrantApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.grant_api_key"; + public GrantApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? AccessTokenValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKeyValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } - private Action> ApiKeyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantTypeValue { get; set; } - private string? PasswordValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? RunAsValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -219,10 +315,10 @@ public GrantApiKeyRequestDescriptor() /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor AccessToken(string? value) { - AccessTokenValue = accessToken; - return Self; + Instance.AccessToken = value; + return this; } /// @@ -230,28 +326,32 @@ public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) /// The API key. /// /// - public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey apiKey) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey value) { - ApiKeyDescriptor = null; - ApiKeyDescriptorAction = null; - ApiKeyValue = apiKey; - return Self; + Instance.ApiKey = value; + return this; } - public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) + /// + /// + /// The API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ApiKey(System.Action action) { - ApiKeyValue = null; - ApiKeyDescriptorAction = null; - ApiKeyDescriptor = descriptor; - return Self; + Instance.ApiKey = Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor.Build(action); + return this; } - public GrantApiKeyRequestDescriptor ApiKey(Action> configure) + /// + /// + /// The API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ApiKey(System.Action> action) { - ApiKeyValue = null; - ApiKeyDescriptor = null; - ApiKeyDescriptorAction = configure; - return Self; + Instance.ApiKey = Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor.Build(action); + return this; } /// @@ -259,10 +359,10 @@ public GrantApiKeyRequestDescriptor ApiKey(Actionaccess_token, password. /// /// - public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType grantType) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType value) { - GrantTypeValue = grantType; - return Self; + Instance.GrantType = value; + return this; } /// @@ -272,10 +372,10 @@ public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elastic /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -283,10 +383,10 @@ public GrantApiKeyRequestDescriptor Password(string? password) /// The name of the user to be impersonated. /// /// - public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? runAs) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? value) { - RunAsValue = runAs; - return Self; + Instance.RunAs = value; + return this; } /// @@ -296,58 +396,60 @@ public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsear /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AccessTokenValue)) - { - writer.WritePropertyName("access_token"); - writer.WriteStringValue(AccessTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ApiKeyDescriptor is not null) - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); - } - else if (ApiKeyDescriptorAction is not null) - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); - } - else - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, ApiKeyValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("grant_type"); - JsonSerializer.Serialize(writer, GrantTypeValue, options); - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -395,30 +497,23 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// By default, API keys never expire. You can specify expiration information when you create the API keys. /// /// -public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct GrantApiKeyRequestDescriptor { - internal GrantApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest Instance { get; init; } - public GrantApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.grant_api_key"; + public GrantApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? AccessTokenValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKeyValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } - private Action ApiKeyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantTypeValue { get; set; } - private string? PasswordValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? RunAsValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -427,10 +522,10 @@ public GrantApiKeyRequestDescriptor() /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor AccessToken(string? value) { - AccessTokenValue = accessToken; - return Self; + Instance.AccessToken = value; + return this; } /// @@ -438,28 +533,21 @@ public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) /// The API key. /// /// - public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey apiKey) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey value) { - ApiKeyDescriptor = null; - ApiKeyDescriptorAction = null; - ApiKeyValue = apiKey; - return Self; + Instance.ApiKey = value; + return this; } - public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) - { - ApiKeyValue = null; - ApiKeyDescriptorAction = null; - ApiKeyDescriptor = descriptor; - return Self; - } - - public GrantApiKeyRequestDescriptor ApiKey(Action configure) + /// + /// + /// The API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ApiKey(System.Action> action) { - ApiKeyValue = null; - ApiKeyDescriptor = null; - ApiKeyDescriptorAction = configure; - return Self; + Instance.ApiKey = Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor.Build(action); + return this; } /// @@ -467,10 +555,10 @@ public GrantApiKeyRequestDescriptor ApiKey(Actionaccess_token, password. /// /// - public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType grantType) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType value) { - GrantTypeValue = grantType; - return Self; + Instance.GrantType = value; + return this; } /// @@ -480,10 +568,10 @@ public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Secu /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -491,10 +579,10 @@ public GrantApiKeyRequestDescriptor Password(string? password) /// The name of the user to be impersonated. /// /// - public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? runAs) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? value) { - RunAsValue = runAs; - return Self; + Instance.RunAs = value; + return this; } /// @@ -504,57 +592,59 @@ public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username /// It is not valid with other grant types. /// /// - public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AccessTokenValue)) - { - writer.WritePropertyName("access_token"); - writer.WriteStringValue(AccessTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ApiKeyDescriptor is not null) - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); - } - else if (ApiKeyDescriptorAction is not null) - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); - } - else - { - writer.WritePropertyName("api_key"); - JsonSerializer.Serialize(writer, ApiKeyValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("grant_type"); - JsonSerializer.Serialize(writer, GrantTypeValue, options); - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs index 9644b9b2a5a..0522fde5072 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs @@ -17,25 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GrantApiKeyResponse : ElasticsearchResponse +internal sealed partial class GrantApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("api_key")] - public string ApiKey { get; init; } - [JsonInclude, JsonPropertyName("encoded")] - public string Encoded { get; init; } - [JsonInclude, JsonPropertyName("expiration")] - public long? Expiration { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropEncoded = System.Text.Json.JsonEncodedText.Encode("encoded"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propEncoded = default; + LocalJsonValue propExpiration = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propEncoded.TryReadProperty(ref reader, options, PropEncoded, null)) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Encoded = propEncoded.Value, + Expiration = propExpiration.Value, + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropEncoded, value.Encoded, null, null); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponseConverter))] +public sealed partial class GrantApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GrantApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Encoded { get; set; } + public System.DateTimeOffset? Expiration { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs index 4806f948b7d..790e44033bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs @@ -17,23 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class HasPrivilegesRequestParameters : RequestParameters +public sealed partial class HasPrivilegesRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class HasPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplication = default; + LocalJsonValue?> propCluster = default; + LocalJsonValue?> propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value, + Cluster = propCluster.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Check user privileges. @@ -44,36 +94,51 @@ public sealed partial class HasPrivilegesRequestParameters : RequestParameters /// To check the privileges of other users, you must use the run as feature. /// /// -public sealed partial class HasPrivilegesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestConverter))] +public sealed partial class HasPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? user) : base(r => r.Optional("user", user)) + { + } +#if NET7_0_OR_GREATER public HasPrivilegesRequest() { } - - public HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? user) : base(r => r.Optional("user", user)) +#endif +#if !NET7_0_OR_GREATER + public HasPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityHasPrivileges; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "security.has_privileges"; - [JsonInclude, JsonPropertyName("application")] - public ICollection? Application { get; set; } + /// + /// + /// Username + /// + /// + public Elastic.Clients.Elasticsearch.Name? User { get => P("user"); set => PO("user", value); } + public System.Collections.Generic.ICollection? Application { get; set; } /// /// /// A list of the cluster privileges that you want to check. /// /// - [JsonInclude, JsonPropertyName("cluster")] - public ICollection? Cluster { get; set; } - [JsonInclude, JsonPropertyName("index")] - public ICollection? Index { get; set; } + public System.Collections.Generic.ICollection? Cluster { get; set; } + public System.Collections.Generic.ICollection? Index { get; set; } } /// @@ -86,76 +151,62 @@ public HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? user) : base(r = /// To check the privileges of other users, you must use the run as feature. /// /// -public sealed partial class HasPrivilegesRequestDescriptor : RequestDescriptor +public readonly partial struct HasPrivilegesRequestDescriptor { - internal HasPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest Instance { get; init; } - public HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? user) : base(r => r.Optional("user", user)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest instance) { + Instance = instance; } - public HasPrivilegesRequestDescriptor() + public HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? user) { + Instance = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(user); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.has_privileges"; - - public HasPrivilegesRequestDescriptor User(Elastic.Clients.Elasticsearch.Name? user) + public HasPrivilegesRequestDescriptor() { - RouteValues.Optional("user", user); - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ApplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } - private Action ApplicationDescriptorAction { get; set; } - private Action[] ApplicationDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private ICollection? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } - private Action IndexDescriptorAction { get; set; } - private Action[] IndexDescriptorActions { get; set; } - - public HasPrivilegesRequestDescriptor Application(ICollection? application) + public static explicit operator Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Username + /// + /// + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor User(Elastic.Clients.Elasticsearch.Name? value) { - ApplicationDescriptor = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = null; - ApplicationValue = application; - return Self; + Instance.User = value; + return this; } - public HasPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Application(System.Collections.Generic.ICollection? value) { - ApplicationValue = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = null; - ApplicationDescriptor = descriptor; - return Self; + Instance.Application = value; + return this; } - public HasPrivilegesRequestDescriptor Application(Action configure) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Application(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck[] values) { - ApplicationValue = null; - ApplicationDescriptor = null; - ApplicationDescriptorActions = null; - ApplicationDescriptorAction = configure; - return Self; + Instance.Application = [.. values]; + return this; } - public HasPrivilegesRequestDescriptor Application(params Action[] configure) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Application(params System.Action[] actions) { - ApplicationValue = null; - ApplicationDescriptor = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor.Build(action)); + } + + Instance.Application = items; + return this; } /// @@ -163,119 +214,99 @@ public HasPrivilegesRequestDescriptor Application(params Action /// - public HasPrivilegesRequestDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ClusterValue = cluster; - return Self; + Instance.Cluster = value; + return this; } - public HasPrivilegesRequestDescriptor Index(ICollection? index) + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexDescriptorActions = null; - IndexValue = index; - return Self; + Instance.Cluster = [.. values]; + return this; } - public HasPrivilegesRequestDescriptor Index(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Index(System.Collections.Generic.ICollection? value) { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptorActions = null; - IndexDescriptor = descriptor; - return Self; + Instance.Index = value; + return this; } - public HasPrivilegesRequestDescriptor Index(Action configure) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Index(params Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck[] values) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorActions = null; - IndexDescriptorAction = configure; - return Self; + Instance.Index = [.. values]; + return this; } - public HasPrivilegesRequestDescriptor Index(params Action[] configure) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Index(params System.Action[] actions) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor.Build(action)); + } + + Instance.Index = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (ApplicationDescriptor is not null) - { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); - writer.WriteEndArray(); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - else if (ApplicationDescriptorActions is not null) - { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - foreach (var action in ApplicationDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (ApplicationValue is not null) - { - writer.WritePropertyName("application"); - JsonSerializer.Serialize(writer, ApplicationValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexDescriptor is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - writer.WriteEndArray(); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndexDescriptorActions is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - foreach (var action in IndexDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndArray(); - } - else if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs index 024488da85d..7ef6f3c5ff3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs @@ -17,26 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class HasPrivilegesResponse : ElasticsearchResponse +internal sealed partial class HasPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("application")] - public IReadOnlyDictionary>> Application { get; init; } - [JsonInclude, JsonPropertyName("cluster")] - public IReadOnlyDictionary Cluster { get; init; } - [JsonInclude, JsonPropertyName("has_all_requested")] - public bool HasAllRequested { get; init; } - [JsonInclude, JsonPropertyName("index")] - [ReadOnlyIndexNameDictionaryConverter(typeof(IReadOnlyDictionary))] - public IReadOnlyDictionary> Index { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropHasAllRequested = System.Text.Json.JsonEncodedText.Encode("has_all_requested"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>>> propApplication = default; + LocalJsonValue> propCluster = default; + LocalJsonValue propHasAllRequested = default; + LocalJsonValue>> propIndex = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, static System.Collections.Generic.IReadOnlyDictionary>> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>>(o, null, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)!)) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propHasAllRequested.TryReadProperty(ref reader, options, PropHasAllRequested, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value, + Cluster = propCluster.Value, + HasAllRequested = propHasAllRequested.Value, + Index = propIndex.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>> v) => w.WriteDictionaryValue>>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)))); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHasAllRequested, value.HasAllRequested, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponseConverter))] +public sealed partial class HasPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary>> Application { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Cluster { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool HasAllRequested { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs index d0932e39510..e6671aa6f65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs @@ -17,23 +17,64 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class HasPrivilegesUserProfileRequestParameters : RequestParameters +public sealed partial class HasPrivilegesUserProfileRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class HasPrivilegesUserProfileRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropUids = System.Text.Json.JsonEncodedText.Encode("uids"); + + public override Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPrivileges = default; + LocalJsonValue> propUids = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, null)) + { + continue; + } + + if (propUids.TryReadProperty(ref reader, options, PropUids, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Privileges = propPrivileges.Value, + Uids = propUids.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, null); + writer.WriteProperty(options, PropUids, value.Uids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Check user profile privileges. @@ -46,11 +87,35 @@ public sealed partial class HasPrivilegesUserProfileRequestParameters : RequestP /// Elastic reserves the right to change or remove this feature in future releases without prior notice. /// /// -public sealed partial class HasPrivilegesUserProfileRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestConverter))] +public sealed partial class HasPrivilegesUserProfileRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck privileges, System.Collections.Generic.ICollection uids) + { + Privileges = privileges; + Uids = uids; + } +#if NET7_0_OR_GREATER + public HasPrivilegesUserProfileRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HasPrivilegesUserProfileRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityHasPrivilegesUserProfile; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -61,16 +126,22 @@ public sealed partial class HasPrivilegesUserProfileRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("privileges")] - public Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Privileges { get; set; } /// /// /// A list of profile IDs. The privileges are checked for associated users of the profiles. /// /// - [JsonInclude, JsonPropertyName("uids")] - public ICollection Uids { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Uids { get; set; } } /// @@ -85,54 +156,66 @@ public sealed partial class HasPrivilegesUserProfileRequest : PlainRequest /// -public sealed partial class HasPrivilegesUserProfileRequestDescriptor : RequestDescriptor +public readonly partial struct HasPrivilegesUserProfileRequestDescriptor { - internal HasPrivilegesUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest Instance { get; init; } - public HasPrivilegesUserProfileRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public HasPrivilegesUserProfileRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.has_privileges_user_profile"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest instance) => new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.Security.PrivilegesCheck PrivilegesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor PrivilegesDescriptor { get; set; } - private Action PrivilegesDescriptorAction { get; set; } - private ICollection UidsValue { get; set; } + /// + /// + /// An object containing all the privileges to be checked. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck value) + { + Instance.Privileges = value; + return this; + } /// /// /// An object containing all the privileges to be checked. /// /// - public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck privileges) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Privileges() { - PrivilegesDescriptor = null; - PrivilegesDescriptorAction = null; - PrivilegesValue = privileges; - return Self; + Instance.Privileges = Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor.Build(null); + return this; } - public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor descriptor) + /// + /// + /// An object containing all the privileges to be checked. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Privileges(System.Action? action) { - PrivilegesValue = null; - PrivilegesDescriptorAction = null; - PrivilegesDescriptor = descriptor; - return Self; + Instance.Privileges = Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor.Build(action); + return this; } - public HasPrivilegesUserProfileRequestDescriptor Privileges(Action configure) + /// + /// + /// A list of profile IDs. The privileges are checked for associated users of the profiles. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Uids(System.Collections.Generic.ICollection value) { - PrivilegesValue = null; - PrivilegesDescriptor = null; - PrivilegesDescriptorAction = configure; - return Self; + Instance.Uids = value; + return this; } /// @@ -140,33 +223,59 @@ public HasPrivilegesUserProfileRequestDescriptor Privileges(Action /// - public HasPrivilegesUserProfileRequestDescriptor Uids(ICollection uids) + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Uids(params string[] values) { - UidsValue = uids; - return Self; + Instance.Uids = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest Build(System.Action action) { - writer.WriteStartObject(); - if (PrivilegesDescriptor is not null) - { - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesDescriptor, options); - } - else if (PrivilegesDescriptorAction is not null) - { - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor(PrivilegesDescriptorAction), options); - } - else - { - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("uids"); - JsonSerializer.Serialize(writer, UidsValue, options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs index 04b7b2fd847..3bab88dc062 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs @@ -17,17 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class HasPrivilegesUserProfileResponse : ElasticsearchResponse +internal sealed partial class HasPrivilegesUserProfileResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropErrors = System.Text.Json.JsonEncodedText.Encode("errors"); + private static readonly System.Text.Json.JsonEncodedText PropHasPrivilegeUids = System.Text.Json.JsonEncodedText.Encode("has_privilege_uids"); + + public override Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrors = default; + LocalJsonValue> propHasPrivilegeUids = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrors.TryReadProperty(ref reader, options, PropErrors, null)) + { + continue; + } + + if (propHasPrivilegeUids.TryReadProperty(ref reader, options, PropHasPrivilegeUids, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Errors = propErrors.Value, + HasPrivilegeUids = propHasPrivilegeUids.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrors, value.Errors, null, null); + writer.WriteProperty(options, PropHasPrivilegeUids, value.HasPrivilegeUids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponseConverter))] +public sealed partial class HasPrivilegesUserProfileResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesUserProfileResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasPrivilegesUserProfileResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The subset of the requested profile IDs for which an error @@ -36,8 +93,7 @@ public sealed partial class HasPrivilegesUserProfileResponse : ElasticsearchResp /// requested privileges. This field is absent if empty. /// /// - [JsonInclude, JsonPropertyName("errors")] - public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors? Errors { get; init; } + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors? Errors { get; set; } /// /// @@ -45,6 +101,9 @@ public sealed partial class HasPrivilegesUserProfileResponse : ElasticsearchResp /// have all the requested privileges. /// /// - [JsonInclude, JsonPropertyName("has_privilege_uids")] - public IReadOnlyCollection HasPrivilegeUids { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection HasPrivilegeUids { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs index 3764e2f5164..c14d2ee4dc8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs @@ -17,23 +17,100 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class InvalidateApiKeyRequestParameters : RequestParameters +public sealed partial class InvalidateApiKeyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class InvalidateApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOwner = System.Text.Json.JsonEncodedText.Encode("owner"); + private static readonly System.Text.Json.JsonEncodedText PropRealmName = System.Text.Json.JsonEncodedText.Encode("realm_name"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue?> propIds = default; + LocalJsonValue propName = default; + LocalJsonValue propOwner = default; + LocalJsonValue propRealmName = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propOwner.TryReadProperty(ref reader, options, PropOwner, null)) + { + continue; + } + + if (propRealmName.TryReadProperty(ref reader, options, PropRealmName, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Ids = propIds.Value, + Name = propName.Value, + Owner = propOwner.Value, + RealmName = propRealmName.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIds, value.Ids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropOwner, value.Owner, null, null); + writer.WriteProperty(options, PropRealmName, value.RealmName, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Invalidate API keys. @@ -67,17 +144,33 @@ public sealed partial class InvalidateApiKeyRequestParameters : RequestParameter /// /// /// -public sealed partial class InvalidateApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestConverter))] +public sealed partial class InvalidateApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; +#if NET7_0_OR_GREATER + public InvalidateApiKeyRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public InvalidateApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityInvalidateApiKey; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; internal override string OperationName => "security.invalidate_api_key"; - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -86,8 +179,7 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequestname, realm_name, or username. /// /// - [JsonInclude, JsonPropertyName("ids")] - public ICollection? Ids { get; set; } + public System.Collections.Generic.ICollection? Ids { get; set; } /// /// @@ -95,7 +187,6 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequestids, realm_name or username. /// /// - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Name? Name { get; set; } /// @@ -107,7 +198,6 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequestids, name, username, and realm_name must be specified if owner is false. /// /// - [JsonInclude, JsonPropertyName("owner")] public bool? Owner { get; set; } /// @@ -116,7 +206,6 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequestids or name, or when owner flag is set to true. /// /// - [JsonInclude, JsonPropertyName("realm_name")] public string? RealmName { get; set; } /// @@ -125,7 +214,6 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequestids or name or when owner flag is set to true. /// /// - [JsonInclude, JsonPropertyName("username")] public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } @@ -162,33 +250,40 @@ public sealed partial class InvalidateApiKeyRequest : PlainRequest /// /// -public sealed partial class InvalidateApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct InvalidateApiKeyRequestDescriptor { - internal InvalidateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest Instance { get; init; } - public InvalidateApiKeyRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvalidateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; + public InvalidateApiKeyRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.invalidate_api_key"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor descriptor) => descriptor.Instance; - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private ICollection? IdsValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private bool? OwnerValue { get; set; } - private string? RealmNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } - public InvalidateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// A list of API key ids. + /// This parameter cannot be used with any of name, realm_name, or username. + /// + /// + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Ids(System.Collections.Generic.ICollection? value) { - IdValue = id; - return Self; + Instance.Ids = value; + return this; } /// @@ -197,10 +292,10 @@ public InvalidateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id /// This parameter cannot be used with any of name, realm_name, or username. /// /// - public InvalidateApiKeyRequestDescriptor Ids(ICollection? ids) + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) { - IdsValue = ids; - return Self; + Instance.Ids = [.. values]; + return this; } /// @@ -209,10 +304,10 @@ public InvalidateApiKeyRequestDescriptor Ids(ICollectionids, realm_name or username. /// /// - public InvalidateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -224,10 +319,10 @@ public InvalidateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name /// NOTE: At least one of ids, name, username, and realm_name must be specified if owner is false. /// /// - public InvalidateApiKeyRequestDescriptor Owner(bool? owner = true) + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Owner(bool? value = true) { - OwnerValue = owner; - return Self; + Instance.Owner = value; + return this; } /// @@ -236,10 +331,10 @@ public InvalidateApiKeyRequestDescriptor Owner(bool? owner = true) /// This parameter cannot be used with either ids or name, or when owner flag is set to true. /// /// - public InvalidateApiKeyRequestDescriptor RealmName(string? realmName) + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor RealmName(string? value) { - RealmNameValue = realmName; - return Self; + Instance.RealmName = value; + return this; } /// @@ -248,51 +343,64 @@ public InvalidateApiKeyRequestDescriptor RealmName(string? realmName) /// This parameter cannot be used with either ids or name or when owner flag is set to true. /// /// - public InvalidateApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (IdValue is not null) + if (action is null) { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); + return new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IdsValue is not null) - { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (OwnerValue.HasValue) - { - writer.WritePropertyName("owner"); - writer.WriteBooleanValue(OwnerValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(RealmNameValue)) - { - writer.WritePropertyName("realm_name"); - writer.WriteStringValue(RealmNameValue); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs index 9b3a5dc8f50..247d8efe9ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class InvalidateApiKeyResponse : ElasticsearchResponse +internal sealed partial class InvalidateApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropErrorCount = System.Text.Json.JsonEncodedText.Encode("error_count"); + private static readonly System.Text.Json.JsonEncodedText PropErrorDetails = System.Text.Json.JsonEncodedText.Encode("error_details"); + private static readonly System.Text.Json.JsonEncodedText PropInvalidatedApiKeys = System.Text.Json.JsonEncodedText.Encode("invalidated_api_keys"); + private static readonly System.Text.Json.JsonEncodedText PropPreviouslyInvalidatedApiKeys = System.Text.Json.JsonEncodedText.Encode("previously_invalidated_api_keys"); + + public override Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrorCount = default; + LocalJsonValue?> propErrorDetails = default; + LocalJsonValue> propInvalidatedApiKeys = default; + LocalJsonValue> propPreviouslyInvalidatedApiKeys = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrorCount.TryReadProperty(ref reader, options, PropErrorCount, null)) + { + continue; + } + + if (propErrorDetails.TryReadProperty(ref reader, options, PropErrorDetails, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propInvalidatedApiKeys.TryReadProperty(ref reader, options, PropInvalidatedApiKeys, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPreviouslyInvalidatedApiKeys.TryReadProperty(ref reader, options, PropPreviouslyInvalidatedApiKeys, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ErrorCount = propErrorCount.Value, + ErrorDetails = propErrorDetails.Value, + InvalidatedApiKeys = propInvalidatedApiKeys.Value, + PreviouslyInvalidatedApiKeys = propPreviouslyInvalidatedApiKeys.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrorCount, value.ErrorCount, null, null); + writer.WriteProperty(options, PropErrorDetails, value.ErrorDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInvalidatedApiKeys, value.InvalidatedApiKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreviouslyInvalidatedApiKeys, value.PreviouslyInvalidatedApiKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponseConverter))] +public sealed partial class InvalidateApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvalidateApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InvalidateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of errors that were encountered when invalidating the API keys. /// /// - [JsonInclude, JsonPropertyName("error_count")] - public int ErrorCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ErrorCount { get; set; } /// /// @@ -42,22 +120,27 @@ public sealed partial class InvalidateApiKeyResponse : ElasticsearchResponse /// This field is not present in the response when error_count is 0. /// /// - [JsonInclude, JsonPropertyName("error_details")] - public IReadOnlyCollection? ErrorDetails { get; init; } + public System.Collections.Generic.IReadOnlyCollection? ErrorDetails { get; set; } /// /// /// The IDs of the API keys that were invalidated as part of this request. /// /// - [JsonInclude, JsonPropertyName("invalidated_api_keys")] - public IReadOnlyCollection InvalidatedApiKeys { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection InvalidatedApiKeys { get; set; } /// /// /// The IDs of the API keys that were already invalidated. /// /// - [JsonInclude, JsonPropertyName("previously_invalidated_api_keys")] - public IReadOnlyCollection PreviouslyInvalidatedApiKeys { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PreviouslyInvalidatedApiKeys { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs index b3c54fd862f..ad6f73cfeec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs @@ -17,21 +17,80 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class InvalidateTokenRequestParameters : RequestParameters +public sealed partial class InvalidateTokenRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class InvalidateTokenRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRealmName = System.Text.Json.JsonEncodedText.Encode("realm_name"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRealmName = default; + LocalJsonValue propRefreshToken = default; + LocalJsonValue propToken = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRealmName.TryReadProperty(ref reader, options, PropRealmName, null)) + { + continue; + } + + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RealmName = propRealmName.Value, + RefreshToken = propRefreshToken.Value, + Token = propToken.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRealmName, value.RealmName, null, null); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } } /// @@ -54,11 +113,28 @@ public sealed partial class InvalidateTokenRequestParameters : RequestParameters /// If none of these two are specified, then realm_name and/or username need to be specified. /// /// -public sealed partial class InvalidateTokenRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestConverter))] +public sealed partial class InvalidateTokenRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; +#if NET7_0_OR_GREATER + public InvalidateTokenRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public InvalidateTokenRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityInvalidateToken; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => true; @@ -70,7 +146,6 @@ public sealed partial class InvalidateTokenRequest : PlainRequestrefresh_token or token. /// /// - [JsonInclude, JsonPropertyName("realm_name")] public Elastic.Clients.Elasticsearch.Name? RealmName { get; set; } /// @@ -79,7 +154,6 @@ public sealed partial class InvalidateTokenRequest : PlainRequestrefresh_token, realm_name, or username are used. /// /// - [JsonInclude, JsonPropertyName("refresh_token")] public string? RefreshToken { get; set; } /// @@ -88,7 +162,6 @@ public sealed partial class InvalidateTokenRequest : PlainRequestrefresh_token, realm_name, or username are used. /// /// - [JsonInclude, JsonPropertyName("token")] public string? Token { get; set; } /// @@ -97,7 +170,6 @@ public sealed partial class InvalidateTokenRequest : PlainRequestrefresh_token or token. /// /// - [JsonInclude, JsonPropertyName("username")] public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } @@ -121,26 +193,23 @@ public sealed partial class InvalidateTokenRequest : PlainRequestrealm_name and/or username need to be specified. /// /// -public sealed partial class InvalidateTokenRequestDescriptor : RequestDescriptor +public readonly partial struct InvalidateTokenRequestDescriptor { - internal InvalidateTokenRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest Instance { get; init; } - public InvalidateTokenRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvalidateTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.invalidate_token"; + public InvalidateTokenRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private Elastic.Clients.Elasticsearch.Name? RealmNameValue { get; set; } - private string? RefreshTokenValue { get; set; } - private string? TokenValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest instance) => new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -148,10 +217,10 @@ public InvalidateTokenRequestDescriptor() /// This parameter cannot be used with either refresh_token or token. /// /// - public InvalidateTokenRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? realmName) + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? value) { - RealmNameValue = realmName; - return Self; + Instance.RealmName = value; + return this; } /// @@ -160,10 +229,10 @@ public InvalidateTokenRequestDescriptor RealmName(Elastic.Clients.Elasticsearch. /// This parameter cannot be used if any of refresh_token, realm_name, or username are used. /// /// - public InvalidateTokenRequestDescriptor RefreshToken(string? refreshToken) + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor RefreshToken(string? value) { - RefreshTokenValue = refreshToken; - return Self; + Instance.RefreshToken = value; + return this; } /// @@ -172,10 +241,10 @@ public InvalidateTokenRequestDescriptor RefreshToken(string? refreshToken) /// This parameter cannot be used if any of refresh_token, realm_name, or username are used. /// /// - public InvalidateTokenRequestDescriptor Token(string? token) + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor Token(string? value) { - TokenValue = token; - return Self; + Instance.Token = value; + return this; } /// @@ -184,39 +253,64 @@ public InvalidateTokenRequestDescriptor Token(string? token) /// This parameter cannot be used with either refresh_token or token. /// /// - public InvalidateTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (RealmNameValue is not null) + if (action is null) { - writer.WritePropertyName("realm_name"); - JsonSerializer.Serialize(writer, RealmNameValue, options); + return new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(RefreshTokenValue)) - { - writer.WritePropertyName("refresh_token"); - writer.WriteStringValue(RefreshTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(TokenValue)) - { - writer.WritePropertyName("token"); - writer.WriteStringValue(TokenValue); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs index 7710fd3bb20..d926e286819 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class InvalidateTokenResponse : ElasticsearchResponse +internal sealed partial class InvalidateTokenResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropErrorCount = System.Text.Json.JsonEncodedText.Encode("error_count"); + private static readonly System.Text.Json.JsonEncodedText PropErrorDetails = System.Text.Json.JsonEncodedText.Encode("error_details"); + private static readonly System.Text.Json.JsonEncodedText PropInvalidatedTokens = System.Text.Json.JsonEncodedText.Encode("invalidated_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropPreviouslyInvalidatedTokens = System.Text.Json.JsonEncodedText.Encode("previously_invalidated_tokens"); + + public override Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propErrorCount = default; + LocalJsonValue?> propErrorDetails = default; + LocalJsonValue propInvalidatedTokens = default; + LocalJsonValue propPreviouslyInvalidatedTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propErrorCount.TryReadProperty(ref reader, options, PropErrorCount, null)) + { + continue; + } + + if (propErrorDetails.TryReadProperty(ref reader, options, PropErrorDetails, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propInvalidatedTokens.TryReadProperty(ref reader, options, PropInvalidatedTokens, null)) + { + continue; + } + + if (propPreviouslyInvalidatedTokens.TryReadProperty(ref reader, options, PropPreviouslyInvalidatedTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ErrorCount = propErrorCount.Value, + ErrorDetails = propErrorDetails.Value, + InvalidatedTokens = propInvalidatedTokens.Value, + PreviouslyInvalidatedTokens = propPreviouslyInvalidatedTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropErrorCount, value.ErrorCount, null, null); + writer.WriteProperty(options, PropErrorDetails, value.ErrorDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInvalidatedTokens, value.InvalidatedTokens, null, null); + writer.WriteProperty(options, PropPreviouslyInvalidatedTokens, value.PreviouslyInvalidatedTokens, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponseConverter))] +public sealed partial class InvalidateTokenResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvalidateTokenResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InvalidateTokenResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of errors that were encountered when invalidating the tokens. /// /// - [JsonInclude, JsonPropertyName("error_count")] - public long ErrorCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ErrorCount { get; set; } /// /// @@ -42,22 +120,27 @@ public sealed partial class InvalidateTokenResponse : ElasticsearchResponse /// This field is not present in the response when error_count is 0. /// /// - [JsonInclude, JsonPropertyName("error_details")] - public IReadOnlyCollection? ErrorDetails { get; init; } + public System.Collections.Generic.IReadOnlyCollection? ErrorDetails { get; set; } /// /// /// The number of the tokens that were invalidated as part of this request. /// /// - [JsonInclude, JsonPropertyName("invalidated_tokens")] - public long InvalidatedTokens { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long InvalidatedTokens { get; set; } /// /// /// The number of tokens that were already invalidated. /// /// - [JsonInclude, JsonPropertyName("previously_invalidated_tokens")] - public long PreviouslyInvalidatedTokens { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long PreviouslyInvalidatedTokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateRequest.g.cs index 638ae1a9671..43a39b9620d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateRequest.g.cs @@ -17,21 +17,80 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcAuthenticateRequestParameters : RequestParameters +public sealed partial class OidcAuthenticateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class OidcAuthenticateRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropNonce = System.Text.Json.JsonEncodedText.Encode("nonce"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRedirectUri = System.Text.Json.JsonEncodedText.Encode("redirect_uri"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNonce = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRedirectUri = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNonce.TryReadProperty(ref reader, options, PropNonce, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRedirectUri.TryReadProperty(ref reader, options, PropRedirectUri, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nonce = propNonce.Value, + Realm = propRealm.Value, + RedirectUri = propRedirectUri.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNonce, value.Nonce, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRedirectUri, value.RedirectUri, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } } /// @@ -46,11 +105,36 @@ public sealed partial class OidcAuthenticateRequestParameters : RequestParameter /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. /// /// -public sealed partial class OidcAuthenticateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestConverter))] +public sealed partial class OidcAuthenticateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcAuthenticate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcAuthenticateRequest(string nonce, string redirectUri, string state) + { + Nonce = nonce; + RedirectUri = redirectUri; + State = state; + } +#if NET7_0_OR_GREATER + public OidcAuthenticateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OidcAuthenticateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityOidcAuthenticate; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -62,8 +146,11 @@ public sealed partial class OidcAuthenticateRequest : PlainRequest/_security/oidc/prepare API or the one that was generated by Elasticsearch and included in the response to that call. /// /// - [JsonInclude, JsonPropertyName("nonce")] - public string Nonce { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Nonce { get; set; } /// /// @@ -71,7 +158,6 @@ public sealed partial class OidcAuthenticateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("realm")] public string? Realm { get; set; } /// @@ -80,8 +166,11 @@ public sealed partial class OidcAuthenticateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("redirect_uri")] - public string RedirectUri { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RedirectUri { get; set; } /// /// @@ -89,8 +178,11 @@ public sealed partial class OidcAuthenticateRequest : PlainRequest/_security/oidc/prepare API or the one that was generated by Elasticsearch and included in the response to that call. /// /// - [JsonInclude, JsonPropertyName("state")] - public string State { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } } /// @@ -105,26 +197,23 @@ public sealed partial class OidcAuthenticateRequest : PlainRequest /// -public sealed partial class OidcAuthenticateRequestDescriptor : RequestDescriptor +public readonly partial struct OidcAuthenticateRequestDescriptor { - internal OidcAuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest Instance { get; init; } - public OidcAuthenticateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcAuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcAuthenticate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.oidc_authenticate"; + public OidcAuthenticateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string NonceValue { get; set; } - private string? RealmValue { get; set; } - private string RedirectUriValue { get; set; } - private string StateValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest instance) => new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -132,10 +221,10 @@ public OidcAuthenticateRequestDescriptor() /// This value needs to be the same as the one that was provided to the /_security/oidc/prepare API or the one that was generated by Elasticsearch and included in the response to that call. /// /// - public OidcAuthenticateRequestDescriptor Nonce(string nonce) + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor Nonce(string value) { - NonceValue = nonce; - return Self; + Instance.Nonce = value; + return this; } /// @@ -144,10 +233,10 @@ public OidcAuthenticateRequestDescriptor Nonce(string nonce) /// This property is useful in cases where multiple realms are defined. /// /// - public OidcAuthenticateRequestDescriptor Realm(string? realm) + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor Realm(string? value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } /// @@ -156,10 +245,10 @@ public OidcAuthenticateRequestDescriptor Realm(string? realm) /// This URL must be provided as-is (URL encoded), taken from the body of the response or as the value of a location header in the response from the OpenID Connect Provider. /// /// - public OidcAuthenticateRequestDescriptor RedirectUri(string redirectUri) + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor RedirectUri(string value) { - RedirectUriValue = redirectUri; - return Self; + Instance.RedirectUri = value; + return this; } /// @@ -168,27 +257,59 @@ public OidcAuthenticateRequestDescriptor RedirectUri(string redirectUri) /// This value needs to be the same as the one that was provided to the /_security/oidc/prepare API or the one that was generated by Elasticsearch and included in the response to that call. /// /// - public OidcAuthenticateRequestDescriptor State(string state) + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor State(string value) { - StateValue = state; - return Self; + Instance.State = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("nonce"); - writer.WriteStringValue(NonceValue); - if (!string.IsNullOrEmpty(RealmValue)) - { - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("redirect_uri"); - writer.WriteStringValue(RedirectUriValue); - writer.WritePropertyName("state"); - writer.WriteStringValue(StateValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateResponse.g.cs index 3e2363e1ca6..1e6c2d16320 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcAuthenticateResponse.g.cs @@ -17,46 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcAuthenticateResponse : ElasticsearchResponse +internal sealed partial class OidcAuthenticateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropExpiresIn = System.Text.Json.JsonEncodedText.Encode("expires_in"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propExpiresIn = default; + LocalJsonValue propRefreshToken = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propExpiresIn.TryReadProperty(ref reader, options, PropExpiresIn, null)) + { + continue; + } + + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + ExpiresIn = propExpiresIn.Value, + RefreshToken = propRefreshToken.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropExpiresIn, value.ExpiresIn, null, null); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponseConverter))] +public sealed partial class OidcAuthenticateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcAuthenticateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcAuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The Elasticsearch access token. /// /// - [JsonInclude, JsonPropertyName("access_token")] - public string AccessToken { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string AccessToken { get; set; } /// /// /// The duration (in seconds) of the tokens. /// /// - [JsonInclude, JsonPropertyName("expires_in")] - public int ExpiresIn { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ExpiresIn { get; set; } /// /// /// The Elasticsearch refresh token. /// /// - [JsonInclude, JsonPropertyName("refresh_token")] - public string RefreshToken { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RefreshToken { get; set; } /// /// /// The type of token. /// /// - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutRequest.g.cs index 30273c570ae..ac02a74eb53 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcLogoutRequestParameters : RequestParameters +public sealed partial class OidcLogoutRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class OidcLogoutRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + + public override Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRefreshToken = default; + LocalJsonValue propToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RefreshToken = propRefreshToken.Value, + Token = propToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteEndObject(); + } } /// @@ -49,11 +90,34 @@ public sealed partial class OidcLogoutRequestParameters : RequestParameters /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. /// /// -public sealed partial class OidcLogoutRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestConverter))] +public sealed partial class OidcLogoutRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcLogout; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcLogoutRequest(string token) + { + Token = token; + } +#if NET7_0_OR_GREATER + public OidcLogoutRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OidcLogoutRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityOidcLogout; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -61,19 +125,21 @@ public sealed partial class OidcLogoutRequest : PlainRequest /// - /// The access token to be invalidated. + /// The refresh token to be invalidated. /// /// - [JsonInclude, JsonPropertyName("access_token")] - public string AccessToken { get; set; } + public string? RefreshToken { get; set; } /// /// - /// The refresh token to be invalidated. + /// The access token to be invalidated. /// /// - [JsonInclude, JsonPropertyName("refresh_token")] - public string? RefreshToken { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Token { get; set; } } /// @@ -91,58 +157,93 @@ public sealed partial class OidcLogoutRequest : PlainRequest /// -public sealed partial class OidcLogoutRequestDescriptor : RequestDescriptor +public readonly partial struct OidcLogoutRequestDescriptor { - internal OidcLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest Instance { get; init; } - public OidcLogoutRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcLogout; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.oidc_logout"; + public OidcLogoutRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string AccessTokenValue { get; set; } - private string? RefreshTokenValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest instance) => new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// The access token to be invalidated. + /// The refresh token to be invalidated. /// /// - public OidcLogoutRequestDescriptor AccessToken(string accessToken) + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor RefreshToken(string? value) { - AccessTokenValue = accessToken; - return Self; + Instance.RefreshToken = value; + return this; } /// /// - /// The refresh token to be invalidated. + /// The access token to be invalidated. /// /// - public OidcLogoutRequestDescriptor RefreshToken(string? refreshToken) + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor Token(string value) { - RefreshTokenValue = refreshToken; - return Self; + Instance.Token = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("access_token"); - writer.WriteStringValue(AccessTokenValue); - if (!string.IsNullOrEmpty(RefreshTokenValue)) - { - writer.WritePropertyName("refresh_token"); - writer.WriteStringValue(RefreshTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutResponse.g.cs index a0952e506fb..49fece09abe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcLogoutResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcLogoutResponse : ElasticsearchResponse +internal sealed partial class OidcLogoutResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRedirect = System.Text.Json.JsonEncodedText.Encode("redirect"); + + public override Elastic.Clients.Elasticsearch.Security.OidcLogoutResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRedirect = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRedirect.TryReadProperty(ref reader, options, PropRedirect, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Redirect = propRedirect.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcLogoutResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRedirect, value.Redirect, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcLogoutResponseConverter))] +public sealed partial class OidcLogoutResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcLogoutResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A URI that points to the end session endpoint of the OpenID Connect Provider with all the parameters of the logout request as HTTP GET parameters. /// /// - [JsonInclude, JsonPropertyName("redirect")] - public string Redirect { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Redirect { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationRequest.g.cs index 5c4cff8f89a..0de22af37e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationRequest.g.cs @@ -17,23 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcPrepareAuthenticationRequestParameters : RequestParameters +public sealed partial class OidcPrepareAuthenticationRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class OidcPrepareAuthenticationRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIss = System.Text.Json.JsonEncodedText.Encode("iss"); + private static readonly System.Text.Json.JsonEncodedText PropLoginHint = System.Text.Json.JsonEncodedText.Encode("login_hint"); + private static readonly System.Text.Json.JsonEncodedText PropNonce = System.Text.Json.JsonEncodedText.Encode("nonce"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIss = default; + LocalJsonValue propLoginHint = default; + LocalJsonValue propNonce = default; + LocalJsonValue propRealm = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIss.TryReadProperty(ref reader, options, PropIss, null)) + { + continue; + } + + if (propLoginHint.TryReadProperty(ref reader, options, PropLoginHint, null)) + { + continue; + } + + if (propNonce.TryReadProperty(ref reader, options, PropNonce, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Iss = propIss.Value, + LoginHint = propLoginHint.Value, + Nonce = propNonce.Value, + Realm = propRealm.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIss, value.Iss, null, null); + writer.WriteProperty(options, PropLoginHint, value.LoginHint, null, null); + writer.WriteProperty(options, PropNonce, value.Nonce, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Prepare OpenID connect authentication. @@ -49,11 +117,28 @@ public sealed partial class OidcPrepareAuthenticationRequestParameters : Request /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. /// /// -public sealed partial class OidcPrepareAuthenticationRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestConverter))] +public sealed partial class OidcPrepareAuthenticationRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcPrepareAuthentication; +#if NET7_0_OR_GREATER + public OidcPrepareAuthenticationRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public OidcPrepareAuthenticationRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityOidcPrepareAuthentication; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -66,7 +151,6 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequestrealm or iss is required. /// /// - [JsonInclude, JsonPropertyName("iss")] public string? Iss { get; set; } /// @@ -75,7 +159,6 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequestrealm is specified. /// /// - [JsonInclude, JsonPropertyName("login_hint")] public string? LoginHint { get; set; } /// @@ -84,7 +167,6 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("nonce")] public string? Nonce { get; set; } /// @@ -94,7 +176,6 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequestrealm or iss is required. /// /// - [JsonInclude, JsonPropertyName("realm")] public string? Realm { get; set; } /// @@ -103,7 +184,6 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("state")] public string? State { get; set; } } @@ -122,27 +202,23 @@ public sealed partial class OidcPrepareAuthenticationRequest : PlainRequest /// -public sealed partial class OidcPrepareAuthenticationRequestDescriptor : RequestDescriptor +public readonly partial struct OidcPrepareAuthenticationRequestDescriptor { - internal OidcPrepareAuthenticationRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest Instance { get; init; } - public OidcPrepareAuthenticationRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcPrepareAuthenticationRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityOidcPrepareAuthentication; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.oidc_prepare_authentication"; + public OidcPrepareAuthenticationRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? IssValue { get; set; } - private string? LoginHintValue { get; set; } - private string? NonceValue { get; set; } - private string? RealmValue { get; set; } - private string? StateValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest instance) => new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -151,10 +227,10 @@ public OidcPrepareAuthenticationRequestDescriptor() /// One of realm or iss is required. /// /// - public OidcPrepareAuthenticationRequestDescriptor Iss(string? iss) + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor Iss(string? value) { - IssValue = iss; - return Self; + Instance.Iss = value; + return this; } /// @@ -163,10 +239,10 @@ public OidcPrepareAuthenticationRequestDescriptor Iss(string? iss) /// This parameter is not valid when realm is specified. /// /// - public OidcPrepareAuthenticationRequestDescriptor LoginHint(string? loginHint) + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor LoginHint(string? value) { - LoginHintValue = loginHint; - return Self; + Instance.LoginHint = value; + return this; } /// @@ -175,10 +251,10 @@ public OidcPrepareAuthenticationRequestDescriptor LoginHint(string? loginHint) /// If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. /// /// - public OidcPrepareAuthenticationRequestDescriptor Nonce(string? nonce) + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor Nonce(string? value) { - NonceValue = nonce; - return Self; + Instance.Nonce = value; + return this; } /// @@ -188,10 +264,10 @@ public OidcPrepareAuthenticationRequestDescriptor Nonce(string? nonce) /// One of realm or iss is required. /// /// - public OidcPrepareAuthenticationRequestDescriptor Realm(string? realm) + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor Realm(string? value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } /// @@ -200,45 +276,64 @@ public OidcPrepareAuthenticationRequestDescriptor Realm(string? realm) /// If the caller of the API does not provide a value, Elasticsearch will generate one with sufficient entropy and return it in the response. /// /// - public OidcPrepareAuthenticationRequestDescriptor State(string? state) + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor State(string? value) { - StateValue = state; - return Self; + Instance.State = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(IssValue)) + if (action is null) { - writer.WritePropertyName("iss"); - writer.WriteStringValue(IssValue); + return new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(LoginHintValue)) - { - writer.WritePropertyName("login_hint"); - writer.WriteStringValue(LoginHintValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(NonceValue)) - { - writer.WritePropertyName("nonce"); - writer.WriteStringValue(NonceValue); - } + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(RealmValue)) - { - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - } + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(StateValue)) - { - writer.WritePropertyName("state"); - writer.WriteStringValue(StateValue); - } + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationResponse.g.cs index 39e1e97d39e..661c9bef0e9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/OidcPrepareAuthenticationResponse.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class OidcPrepareAuthenticationResponse : ElasticsearchResponse +internal sealed partial class OidcPrepareAuthenticationResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNonce = System.Text.Json.JsonEncodedText.Encode("nonce"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRedirect = System.Text.Json.JsonEncodedText.Encode("redirect"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNonce = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRedirect = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNonce.TryReadProperty(ref reader, options, PropNonce, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRedirect.TryReadProperty(ref reader, options, PropRedirect, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nonce = propNonce.Value, + Realm = propRealm.Value, + Redirect = propRedirect.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNonce, value.Nonce, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRedirect, value.Redirect, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponseConverter))] +public sealed partial class OidcPrepareAuthenticationResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("nonce")] - public string Nonce { get; init; } - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OidcPrepareAuthenticationResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OidcPrepareAuthenticationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Nonce { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } /// /// /// A URI that points to the authorization endpoint of the OpenID Connect Provider with all the parameters of the authentication request as HTTP GET parameters. /// /// - [JsonInclude, JsonPropertyName("redirect")] - public string Redirect { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string State { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Redirect { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs index 5d886651927..edd96fc9ec0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs @@ -17,22 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.IO; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutPrivilegesRequestParameters : RequestParameters +public sealed partial class PutPrivilegesRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,6 +33,19 @@ public sealed partial class PutPrivilegesRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class PutPrivilegesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Privileges = reader.ReadValue>>(options, static System.Collections.Generic.IDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Privileges, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + } +} + /// /// /// Create or update application privileges. @@ -103,11 +107,34 @@ public sealed partial class PutPrivilegesRequestParameters : RequestParameters /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. /// /// -public sealed partial class PutPrivilegesRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestConverter))] +public sealed partial class PutPrivilegesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPrivilegesRequest(System.Collections.Generic.IDictionary> privileges) + { + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public PutPrivilegesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PutPrivilegesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityPutPrivileges; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -118,14 +145,12 @@ public sealed partial class PutPrivilegesRequest : PlainRequesttrue (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } - public Dictionary> Privileges { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Privileges, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary> Privileges { get; set; } } /// @@ -189,34 +214,121 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. /// /// -public sealed partial class PutPrivilegesRequestDescriptor : RequestDescriptor, ISelfSerializable +public readonly partial struct PutPrivilegesRequestDescriptor { - internal PutPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest instance) + { + Instance = instance; + } public PutPrivilegesRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - internal override bool SupportsBody => true; + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Privileges(System.Collections.Generic.IDictionary> value) + { + Instance.Privileges = value; + return this; + } - internal override string OperationName => "security.put_privileges"; + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Privileges() + { + Instance.Privileges = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Privileges(System.Action? action) + { + Instance.Privileges = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor AddPrivilege(string key, System.Collections.Generic.IDictionary value) + { + Instance.Privileges ??= new System.Collections.Generic.Dictionary>(); + Instance.Privileges.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor AddPrivilege(string key) + { + Instance.Privileges ??= new System.Collections.Generic.Dictionary>(); + Instance.Privileges.Add(key, Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor AddPrivilege(string key, System.Action? action) + { + Instance.Privileges ??= new System.Collections.Generic.Dictionary>(); + Instance.Privileges.Add(key, Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions.Build(action)); + return this; + } - public PutPrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor ErrorTrace(bool? value) { - JsonSerializer.Serialize(writer, _items, options); + Instance.ErrorTrace = value; + return this; } - Dictionary> _items = new(); + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - public PutPrivilegesRequestDescriptor AddPrivileges(string key, Dictionary value) + public Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - _items.Add(key, value); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs index a5656b6d3a8..7f74f2a6212 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutPrivilegesResponse : DictionaryResponse> +internal sealed partial class PutPrivilegesResponseConverter : System.Text.Json.Serialization.JsonConverter { - public PutPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue>>(options, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!) }; } - public PutPrivilegesResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Result, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponseConverter))] +public sealed partial class PutPrivilegesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutPrivilegesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutPrivilegesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary> Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs index 3a335fae9cc..b3742d58d37 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutRoleMappingRequestParameters : RequestParameters +public sealed partial class PutRoleMappingRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,90 @@ public sealed partial class PutRoleMappingRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class PutRoleMappingRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropRoleTemplates = System.Text.Json.JsonEncodedText.Encode("role_templates"); + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + + public override Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue?> propRoleTemplates = default; + LocalJsonValue propRules = default; + LocalJsonValue?> propRunAs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRoleTemplates.TryReadProperty(ref reader, options, PropRoleTemplates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRules.TryReadProperty(ref reader, options, PropRules, null)) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Metadata = propMetadata.Value, + Roles = propRoles.Value, + RoleTemplates = propRoleTemplates.Value, + Rules = propRules.Value, + RunAs = propRunAs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRoleTemplates, value.RoleTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRules, value.Rules, null, null); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create or update role mappings. @@ -78,26 +155,49 @@ public sealed partial class PutRoleMappingRequestParameters : RequestParameters /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. /// /// -public sealed partial class PutRoleMappingRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestConverter))] +public sealed partial class PutRoleMappingRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutRoleMappingRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityPutRoleMapping; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.put_role_mapping"; + /// + /// + /// The distinct name that identifies the role mapping. + /// The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -105,7 +205,6 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// Mappings that have enabled set to false are ignored when role mapping is performed. /// /// - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } /// @@ -114,8 +213,7 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// @@ -123,8 +221,7 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// Exactly one of roles or role_templates must be specified. /// /// - [JsonInclude, JsonPropertyName("roles")] - public ICollection? Roles { get; set; } + public System.Collections.Generic.ICollection? Roles { get; set; } /// /// @@ -132,8 +229,7 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// Exactly one of roles or role_templates must be specified. /// /// - [JsonInclude, JsonPropertyName("role_templates")] - public ICollection? RoleTemplates { get; set; } + public System.Collections.Generic.ICollection? RoleTemplates { get; set; } /// /// @@ -141,10 +237,8 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// A rule is a logical condition that is expressed by using a JSON DSL. /// /// - [JsonInclude, JsonPropertyName("rules")] public Elastic.Clients.Elasticsearch.Security.RoleMappingRule? Rules { get; set; } - [JsonInclude, JsonPropertyName("run_as")] - public ICollection? RunAs { get; set; } + public System.Collections.Generic.ICollection? RunAs { get; set; } } /// @@ -185,51 +279,86 @@ public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r = /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. /// /// -public sealed partial class PutRoleMappingRequestDescriptor : RequestDescriptor +public readonly partial struct PutRoleMappingRequestDescriptor { - internal PutRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest Instance { get; init; } - public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRoleMappingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.put_role_mapping"; + /// + /// + /// The distinct name that identifies the role mapping. + /// The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public PutRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - public PutRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Mappings that have enabled set to false are ignored when role mapping is performed. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Enabled(bool? value = true) { - RouteValues.Required("name", name); - return Self; + Instance.Enabled = value; + return this; } - private bool? EnabledValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private ICollection? RolesValue { get; set; } - private ICollection? RoleTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor RoleTemplatesDescriptor { get; set; } - private Action RoleTemplatesDescriptorAction { get; set; } - private Action[] RoleTemplatesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleMappingRule? RulesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor RulesDescriptor { get; set; } - private Action RulesDescriptorAction { get; set; } - private ICollection? RunAsValue { get; set; } + /// + /// + /// Additional metadata that helps define which roles are assigned to each user. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) + { + Instance.Metadata = value; + return this; + } /// /// - /// Mappings that have enabled set to false are ignored when role mapping is performed. + /// Additional metadata that helps define which roles are assigned to each user. + /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public PutRoleMappingRequestDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata() { - EnabledValue = enabled; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -238,10 +367,29 @@ public PutRoleMappingRequestDescriptor Enabled(bool? enabled = true) /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public PutRoleMappingRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } + + /// + /// + /// A list of role names that are granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Roles(System.Collections.Generic.ICollection? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Roles = value; + return this; } /// @@ -250,10 +398,10 @@ public PutRoleMappingRequestDescriptor Metadata(Funcroles or role_templates must be specified. /// /// - public PutRoleMappingRequestDescriptor Roles(ICollection? roles) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Roles(params string[] values) { - RolesValue = roles; - return Self; + Instance.Roles = [.. values]; + return this; } /// @@ -262,40 +410,52 @@ public PutRoleMappingRequestDescriptor Roles(ICollection? roles) /// Exactly one of roles or role_templates must be specified. /// /// - public PutRoleMappingRequestDescriptor RoleTemplates(ICollection? roleTemplates) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(System.Collections.Generic.ICollection? value) { - RoleTemplatesDescriptor = null; - RoleTemplatesDescriptorAction = null; - RoleTemplatesDescriptorActions = null; - RoleTemplatesValue = roleTemplates; - return Self; + Instance.RoleTemplates = value; + return this; } - public PutRoleMappingRequestDescriptor RoleTemplates(Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor descriptor) + /// + /// + /// A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(params Elastic.Clients.Elasticsearch.Security.RoleTemplate[] values) { - RoleTemplatesValue = null; - RoleTemplatesDescriptorAction = null; - RoleTemplatesDescriptorActions = null; - RoleTemplatesDescriptor = descriptor; - return Self; + Instance.RoleTemplates = [.. values]; + return this; } - public PutRoleMappingRequestDescriptor RoleTemplates(Action configure) + /// + /// + /// A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(params System.Action[] actions) { - RoleTemplatesValue = null; - RoleTemplatesDescriptor = null; - RoleTemplatesDescriptorActions = null; - RoleTemplatesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor.Build(action)); + } + + Instance.RoleTemplates = items; + return this; } - public PutRoleMappingRequestDescriptor RoleTemplates(params Action[] configure) + /// + /// + /// The rules that determine which users should be matched by the mapping. + /// A rule is a logical condition that is expressed by using a JSON DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? value) { - RoleTemplatesValue = null; - RoleTemplatesDescriptor = null; - RoleTemplatesDescriptorAction = null; - RoleTemplatesDescriptorActions = configure; - return Self; + Instance.Rules = value; + return this; } /// @@ -304,110 +464,375 @@ public PutRoleMappingRequestDescriptor RoleTemplates(params Action /// - public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? rules) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Rules(System.Action action) { - RulesDescriptor = null; - RulesDescriptorAction = null; - RulesValue = rules; - return Self; + Instance.Rules = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; } - public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor descriptor) + /// + /// + /// The rules that determine which users should be matched by the mapping. + /// A rule is a logical condition that is expressed by using a JSON DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Rules(System.Action> action) { - RulesValue = null; - RulesDescriptorAction = null; - RulesDescriptor = descriptor; - return Self; + Instance.Rules = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; } - public PutRoleMappingRequestDescriptor Rules(Action configure) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RunAs(System.Collections.Generic.ICollection? value) { - RulesValue = null; - RulesDescriptor = null; - RulesDescriptorAction = configure; - return Self; + Instance.RunAs = value; + return this; } - public PutRoleMappingRequestDescriptor RunAs(ICollection? runAs) + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RunAs(params string[] values) { - RunAsValue = runAs; - return Self; + Instance.RunAs = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest Build(System.Action action) { - writer.WriteStartObject(); - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (RolesValue is not null) - { - writer.WritePropertyName("roles"); - JsonSerializer.Serialize(writer, RolesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RoleTemplatesDescriptor is not null) - { - writer.WritePropertyName("role_templates"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RoleTemplatesDescriptor, options); - writer.WriteEndArray(); - } - else if (RoleTemplatesDescriptorAction is not null) - { - writer.WritePropertyName("role_templates"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(RoleTemplatesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RoleTemplatesDescriptorActions is not null) - { - writer.WritePropertyName("role_templates"); - writer.WriteStartArray(); - foreach (var action in RoleTemplatesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else if (RoleTemplatesValue is not null) - { - writer.WritePropertyName("role_templates"); - JsonSerializer.Serialize(writer, RoleTemplatesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (RulesDescriptor is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, RulesDescriptor, options); - } - else if (RulesDescriptorAction is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(RulesDescriptorAction), options); - } - else if (RulesValue is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, RulesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Create or update role mappings. +/// +/// +/// Role mappings define which roles are assigned to each user. +/// Each mapping has rules that identify users and a list of roles that are granted to those users. +/// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. +/// +/// +/// NOTE: This API does not create roles. Rather, it maps users to existing roles. +/// Roles can be created by using the create or update roles API or roles files. +/// +/// +/// Role templates +/// +/// +/// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. +/// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. +/// The roles field is used for this purpose. +/// +/// +/// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. +/// The role_templates field is used for this purpose. +/// +/// +/// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. +/// Otherwise, all attempts to create a role mapping with role templates fail. +/// +/// +/// All of the user fields that are available in the role mapping rules are also available in the role templates. +/// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. +/// +/// +/// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. +/// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. +/// +/// +public readonly partial struct PutRoleMappingRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest instance) + { + Instance = instance; + } + + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(name); + } + + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRoleMappingRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The distinct name that identifies the role mapping. + /// The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } + + /// + /// + /// Mappings that have enabled set to false are ignored when role mapping is performed. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Enabled(bool? value = true) + { + Instance.Enabled = value; + return this; + } + + /// + /// + /// Additional metadata that helps define which roles are assigned to each user. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) + { + Instance.Metadata = value; + return this; + } + + /// + /// + /// Additional metadata that helps define which roles are assigned to each user. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Additional metadata that helps define which roles are assigned to each user. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } + + /// + /// + /// A list of role names that are granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Roles(System.Collections.Generic.ICollection? value) + { + Instance.Roles = value; + return this; + } - if (RunAsValue is not null) + /// + /// + /// A list of role names that are granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Roles(params string[] values) + { + Instance.Roles = [.. values]; + return this; + } + + /// + /// + /// A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(System.Collections.Generic.ICollection? value) + { + Instance.RoleTemplates = value; + return this; + } + + /// + /// + /// A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(params Elastic.Clients.Elasticsearch.Security.RoleTemplate[] values) + { + Instance.RoleTemplates = [.. values]; + return this; + } + + /// + /// + /// A list of Mustache templates that will be evaluated to determine the roles names that should granted to the users that match the role mapping rules. + /// Exactly one of roles or role_templates must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RoleTemplates(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.RoleTemplates = items; + return this; + } + + /// + /// + /// The rules that determine which users should be matched by the mapping. + /// A rule is a logical condition that is expressed by using a JSON DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? value) + { + Instance.Rules = value; + return this; + } + + /// + /// + /// The rules that determine which users should be matched by the mapping. + /// A rule is a logical condition that is expressed by using a JSON DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Rules(System.Action> action) + { + Instance.Rules = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RunAs(System.Collections.Generic.ICollection? value) + { + Instance.RunAs = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RunAs(params string[] values) + { + Instance.RunAs = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs index c3a0d4a12ce..c3f73a4631e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs @@ -17,19 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutRoleMappingResponse : ElasticsearchResponse +internal sealed partial class PutRoleMappingResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropRoleMapping = System.Text.Json.JsonEncodedText.Encode("role_mapping"); + + public override Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreated = default; + LocalJsonValue propRoleMapping = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (propRoleMapping.TryReadProperty(ref reader, options, PropRoleMapping, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value, + RoleMapping = propRoleMapping.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteProperty(options, PropRoleMapping, value.RoleMapping, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponseConverter))] +public sealed partial class PutRoleMappingResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("created")] - public bool? Created { get; init; } - [JsonInclude, JsonPropertyName("role_mapping")] - public Elastic.Clients.Elasticsearch.Security.CreatedStatus RoleMapping { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleMappingResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRoleMappingResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? Created { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.CreatedStatus RoleMapping { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs index 01e434d9717..72cb89142ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutRoleRequestParameters : RequestParameters +public sealed partial class PutRoleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,126 @@ public sealed partial class PutRoleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class PutRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropTransientMetadata = System.Text.Json.JsonEncodedText.Encode("transient_metadata"); + + public override Elastic.Clients.Elasticsearch.Security.PutRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplications = default; + LocalJsonValue?> propCluster = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGlobal = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue?> propRunAs = default; + LocalJsonValue?> propTransientMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTransientMetadata.TryReadProperty(ref reader, options, PropTransientMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value, + Cluster = propCluster.Value, + Description = propDescription.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + RunAs = propRunAs.Value, + TransientMetadata = propTransientMetadata.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransientMetadata, value.TransientMetadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create or update roles. @@ -50,26 +163,48 @@ public sealed partial class PutRoleRequestParameters : RequestParameters /// File-based role management is not available in Elastic Serverless. /// /// -public sealed partial class PutRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutRoleRequestConverter))] +public sealed partial class PutRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) { } +#if NET7_0_OR_GREATER + public PutRoleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityPutRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.put_role"; + /// + /// + /// The name of the role that is being created or updated. On Elasticsearch Serverless, the role name must begin with a letter or digit and can only contain letters, digits and the characters '_', '-', and '.'. Each role must have a unique name, as this will serve as the identifier for that role. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("name"); set => PR("name", value); } + /// /// /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -77,23 +212,20 @@ public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Req /// A list of application privilege entries. /// /// - [JsonInclude, JsonPropertyName("applications")] - public ICollection? Applications { get; set; } + public System.Collections.Generic.ICollection? Applications { get; set; } /// /// /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. /// /// - [JsonInclude, JsonPropertyName("cluster")] - public ICollection? Cluster { get; set; } + public System.Collections.Generic.ICollection? Cluster { get; set; } /// /// /// Optional description of the role descriptor /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -101,32 +233,28 @@ public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Req /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - [JsonInclude, JsonPropertyName("global")] - public IDictionary? Global { get; set; } + public System.Collections.Generic.IDictionary? Global { get; set; } /// /// /// A list of indices permissions entries. /// /// - [JsonInclude, JsonPropertyName("indices")] - public ICollection? Indices { get; set; } + public System.Collections.Generic.ICollection? Indices { get; set; } /// /// /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// /// A list of remote cluster permissions entries. /// /// - [JsonInclude, JsonPropertyName("remote_cluster")] - public ICollection? RemoteCluster { get; set; } + public System.Collections.Generic.ICollection? RemoteCluster { get; set; } /// /// @@ -137,24 +265,21 @@ public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Req /// They have no effect for remote clusters configured with the certificate based model. /// /// - [JsonInclude, JsonPropertyName("remote_indices")] - public ICollection? RemoteIndices { get; set; } + public System.Collections.Generic.ICollection? RemoteIndices { get; set; } /// /// /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. /// /// - [JsonInclude, JsonPropertyName("run_as")] - public ICollection? RunAs { get; set; } + public System.Collections.Generic.ICollection? RunAs { get; set; } /// /// /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. /// /// - [JsonInclude, JsonPropertyName("transient_metadata")] - public IDictionary? TransientMetadata { get; set; } + public System.Collections.Generic.IDictionary? TransientMetadata { get; set; } } /// @@ -167,92 +292,100 @@ public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Req /// File-based role management is not available in Elastic Serverless. /// /// -public sealed partial class PutRoleRequestDescriptor : RequestDescriptor, PutRoleRequestParameters> +public readonly partial struct PutRoleRequestDescriptor { - internal PutRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PutRoleRequest Instance { get; init; } - public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.PutRoleRequest(name); + } - internal override string OperationName => "security.put_role"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRoleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutRoleRequest(Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor descriptor) => descriptor.Instance; - public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// The name of the role that is being created or updated. On Elasticsearch Serverless, the role name must begin with a letter or digit and can only contain letters, digits and the characters '_', '-', and '.'. Each role must have a unique name, as this will serve as the identifier for that role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("name", name); - return Self; + Instance.Name = value; + return this; } - private ICollection? ApplicationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } - private Action ApplicationsDescriptorAction { get; set; } - private Action[] ApplicationsDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? GlobalValue { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } - private Action> IndicesDescriptorAction { get; set; } - private Action>[] IndicesDescriptorActions { get; set; } - private IDictionary? MetadataValue { get; set; } - private ICollection? RemoteClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor RemoteClusterDescriptor { get; set; } - private Action RemoteClusterDescriptorAction { get; set; } - private Action[] RemoteClusterDescriptorActions { get; set; } - private ICollection? RemoteIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor RemoteIndicesDescriptor { get; set; } - private Action> RemoteIndicesDescriptorAction { get; set; } - private Action>[] RemoteIndicesDescriptorActions { get; set; } - private ICollection? RunAsValue { get; set; } - private IDictionary? TransientMetadataValue { get; set; } + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// /// A list of application privilege entries. /// /// - public PutRoleRequestDescriptor Applications(ICollection? applications) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(System.Collections.Generic.ICollection? value) { - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsValue = applications; - return Self; + Instance.Applications = value; + return this; } - public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + /// + /// + /// A list of application privilege entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges[] values) { - ApplicationsValue = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptor = descriptor; - return Self; + Instance.Applications = [.. values]; + return this; } - public PutRoleRequestDescriptor Applications(Action configure) + /// + /// + /// A list of application privilege entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(params System.Action[] actions) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor.Build(action)); + } + + Instance.Applications = items; + return this; } - public PutRoleRequestDescriptor Applications(params Action[] configure) + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = configure; - return Self; + Instance.Cluster = value; + return this; } /// @@ -260,10 +393,10 @@ public PutRoleRequestDescriptor Applications(params Action /// - public PutRoleRequestDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - ClusterValue = cluster; - return Self; + Instance.Cluster = [.. values]; + return this; } /// @@ -271,10 +404,10 @@ public PutRoleRequestDescriptor Cluster(ICollection /// - public PutRoleRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -282,10 +415,61 @@ public PutRoleRequestDescriptor Description(string? description) /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public PutRoleRequestDescriptor Global(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global(System.Collections.Generic.IDictionary? value) + { + Instance.Global = value; + return this; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global() + { + Instance.Global = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global(System.Action? action) + { + Instance.Global = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddGlobal(string key, object value) + { + Instance.Global ??= new System.Collections.Generic.Dictionary(); + Instance.Global.Add(key, value); + return this; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(System.Collections.Generic.ICollection? value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(params Elastic.Clients.Elasticsearch.Security.IndicesPrivileges[] values) { - GlobalValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Indices = [.. values]; + return this; } /// @@ -293,40 +477,55 @@ public PutRoleRequestDescriptor Global(Func /// - public PutRoleRequestDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(params System.Action[] actions) { - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesValue = indices; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(params System.Action>[] actions) { - IndicesValue = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public PutRoleRequestDescriptor Indices(Action> configure) + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorActions = null; - IndicesDescriptorAction = configure; - return Self; + Instance.Metadata = value; + return this; } - public PutRoleRequestDescriptor Indices(params Action>[] configure) + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata() { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = configure; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -334,10 +533,17 @@ public PutRoleRequestDescriptor Indices(params Action_) are reserved for system use. /// /// - public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddMetadatum(string key, object value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -345,40 +551,53 @@ public PutRoleRequestDescriptor Metadata(Func /// - public PutRoleRequestDescriptor RemoteCluster(ICollection? remoteCluster) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(System.Collections.Generic.ICollection? value) { - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterValue = remoteCluster; - return Self; + Instance.RemoteCluster = value; + return this; } - public PutRoleRequestDescriptor RemoteCluster(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor descriptor) + /// + /// + /// A list of remote cluster permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(params Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges[] values) { - RemoteClusterValue = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptor = descriptor; - return Self; + Instance.RemoteCluster = [.. values]; + return this; } - public PutRoleRequestDescriptor RemoteCluster(Action configure) + /// + /// + /// A list of remote cluster permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(params System.Action[] actions) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteCluster = items; + return this; } - public PutRoleRequestDescriptor RemoteCluster(params Action[] configure) + /// + /// + /// A list of remote indices permissions entries. + /// + /// + /// NOTE: Remote indices are effective for remote clusters configured with the API key based model. + /// They have no effect for remote clusters configured with the certificate based model. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(System.Collections.Generic.ICollection? value) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = configure; - return Self; + Instance.RemoteIndices = value; + return this; } /// @@ -390,40 +609,63 @@ public PutRoleRequestDescriptor RemoteCluster(params Action /// - public PutRoleRequestDescriptor RemoteIndices(ICollection? remoteIndices) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(params Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges[] values) { - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesValue = remoteIndices; - return Self; + Instance.RemoteIndices = [.. values]; + return this; } - public PutRoleRequestDescriptor RemoteIndices(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of remote indices permissions entries. + /// + /// + /// NOTE: Remote indices are effective for remote clusters configured with the API key based model. + /// They have no effect for remote clusters configured with the certificate based model. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(params System.Action[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteIndices = items; + return this; } - public PutRoleRequestDescriptor RemoteIndices(Action> configure) + /// + /// + /// A list of remote indices permissions entries. + /// + /// + /// NOTE: Remote indices are effective for remote clusters configured with the API key based model. + /// They have no effect for remote clusters configured with the certificate based model. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(params System.Action>[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteIndices = items; + return this; } - public PutRoleRequestDescriptor RemoteIndices(params Action>[] configure) + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RunAs(System.Collections.Generic.ICollection? value) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = configure; - return Self; + Instance.RunAs = value; + return this; } /// @@ -431,10 +673,10 @@ public PutRoleRequestDescriptor RemoteIndices(params ActionNote: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. /// /// - public PutRoleRequestDescriptor RunAs(ICollection? runAs) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RunAs(params string[] values) { - RunAsValue = runAs; - return Self; + Instance.RunAs = [.. values]; + return this; } /// @@ -442,176 +684,89 @@ public PutRoleRequestDescriptor RunAs(ICollection? runAs) /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. /// /// - public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata(System.Collections.Generic.IDictionary? value) { - TransientMetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TransientMetadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata() { - writer.WriteStartObject(); - if (ApplicationsDescriptor is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorAction is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorActions is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - foreach (var action in ApplicationsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ApplicationsValue is not null) - { - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, ApplicationsValue, options); - } - - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GlobalValue is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, GlobalValue, options); - } + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (IndicesDescriptor is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorAction is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorActions is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - foreach (var action in IndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); - } + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata(System.Action? action) + { + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - writer.WriteEndArray(); - } - else if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddTransientMetadatum(string key, object value) + { + Instance.TransientMetadata ??= new System.Collections.Generic.Dictionary(); + Instance.TransientMetadata.Add(key, value); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutRoleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RemoteClusterDescriptor is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteClusterDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorAction is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(RemoteClusterDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorActions is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - foreach (var action in RemoteClusterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndArray(); - } - else if (RemoteClusterValue is not null) - { - writer.WritePropertyName("remote_cluster"); - JsonSerializer.Serialize(writer, RemoteClusterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RemoteIndicesDescriptor is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteIndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorAction is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(RemoteIndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorActions is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - foreach (var action in RemoteIndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else if (RemoteIndicesValue is not null) - { - writer.WritePropertyName("remote_indices"); - JsonSerializer.Serialize(writer, RemoteIndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TransientMetadataValue is not null) - { - writer.WritePropertyName("transient_metadata"); - JsonSerializer.Serialize(writer, TransientMetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -625,92 +780,100 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// File-based role management is not available in Elastic Serverless. /// /// -public sealed partial class PutRoleRequestDescriptor : RequestDescriptor +public readonly partial struct PutRoleRequestDescriptor { - internal PutRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PutRoleRequest Instance { get; init; } - public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Security.PutRoleRequest(name); + } - internal override string OperationName => "security.put_role"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutRoleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutRoleRequest(Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor descriptor) => descriptor.Instance; - public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// The name of the role that is being created or updated. On Elasticsearch Serverless, the role name must begin with a letter or digit and can only contain letters, digits and the characters '_', '-', and '.'. Each role must have a unique name, as this will serve as the identifier for that role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("name", name); - return Self; + Instance.Name = value; + return this; } - private ICollection? ApplicationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } - private Action ApplicationsDescriptorAction { get; set; } - private Action[] ApplicationsDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? GlobalValue { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } - private Action IndicesDescriptorAction { get; set; } - private Action[] IndicesDescriptorActions { get; set; } - private IDictionary? MetadataValue { get; set; } - private ICollection? RemoteClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor RemoteClusterDescriptor { get; set; } - private Action RemoteClusterDescriptorAction { get; set; } - private Action[] RemoteClusterDescriptorActions { get; set; } - private ICollection? RemoteIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor RemoteIndicesDescriptor { get; set; } - private Action RemoteIndicesDescriptorAction { get; set; } - private Action[] RemoteIndicesDescriptorActions { get; set; } - private ICollection? RunAsValue { get; set; } - private IDictionary? TransientMetadataValue { get; set; } + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// /// A list of application privilege entries. /// /// - public PutRoleRequestDescriptor Applications(ICollection? applications) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(System.Collections.Generic.ICollection? value) { - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsValue = applications; - return Self; + Instance.Applications = value; + return this; } - public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + /// + /// + /// A list of application privilege entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges[] values) { - ApplicationsValue = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptor = descriptor; - return Self; + Instance.Applications = [.. values]; + return this; } - public PutRoleRequestDescriptor Applications(Action configure) + /// + /// + /// A list of application privilege entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Applications(params System.Action[] actions) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor.Build(action)); + } + + Instance.Applications = items; + return this; } - public PutRoleRequestDescriptor Applications(params Action[] configure) + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = configure; - return Self; + Instance.Cluster = value; + return this; } /// @@ -718,10 +881,10 @@ public PutRoleRequestDescriptor Applications(params Action /// - public PutRoleRequestDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - ClusterValue = cluster; - return Self; + Instance.Cluster = [.. values]; + return this; } /// @@ -729,10 +892,21 @@ public PutRoleRequestDescriptor Cluster(ICollection /// - public PutRoleRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global(System.Collections.Generic.IDictionary? value) { - DescriptionValue = description; - return Self; + Instance.Global = value; + return this; } /// @@ -740,10 +914,28 @@ public PutRoleRequestDescriptor Description(string? description) /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public PutRoleRequestDescriptor Global(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global() { - GlobalValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Global = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Global(System.Action? action) + { + Instance.Global = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddGlobal(string key, object value) + { + Instance.Global ??= new System.Collections.Generic.Dictionary(); + Instance.Global.Add(key, value); + return this; } /// @@ -751,40 +943,49 @@ public PutRoleRequestDescriptor Global(Func, Fl /// A list of indices permissions entries. /// /// - public PutRoleRequestDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(System.Collections.Generic.ICollection? value) { - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } - public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(params Elastic.Clients.Elasticsearch.Security.IndicesPrivileges[] values) { - IndicesValue = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesDescriptor = descriptor; - return Self; + Instance.Indices = [.. values]; + return this; } - public PutRoleRequestDescriptor Indices(Action configure) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Indices(params System.Action>[] actions) { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorActions = null; - IndicesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public PutRoleRequestDescriptor Indices(params Action[] configure) + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = configure; - return Self; + Instance.Metadata = value; + return this; } /// @@ -792,51 +993,67 @@ public PutRoleRequestDescriptor Indices(params Action_) are reserved for system use. /// /// - public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata() { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// /// - /// A list of remote cluster permissions entries. + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. /// /// - public PutRoleRequestDescriptor RemoteCluster(ICollection? remoteCluster) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Metadata(System.Action? action) { - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterValue = remoteCluster; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PutRoleRequestDescriptor RemoteCluster(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddMetadatum(string key, object value) { - RemoteClusterValue = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptor = descriptor; - return Self; + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } - public PutRoleRequestDescriptor RemoteCluster(Action configure) + /// + /// + /// A list of remote cluster permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(System.Collections.Generic.ICollection? value) + { + Instance.RemoteCluster = value; + return this; + } + + /// + /// + /// A list of remote cluster permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(params Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges[] values) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptorAction = configure; - return Self; + Instance.RemoteCluster = [.. values]; + return this; } - public PutRoleRequestDescriptor RemoteCluster(params Action[] configure) + /// + /// + /// A list of remote cluster permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteCluster(params System.Action[] actions) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteCluster = items; + return this; } /// @@ -848,40 +1065,57 @@ public PutRoleRequestDescriptor RemoteCluster(params Action /// - public PutRoleRequestDescriptor RemoteIndices(ICollection? remoteIndices) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(System.Collections.Generic.ICollection? value) { - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesValue = remoteIndices; - return Self; + Instance.RemoteIndices = value; + return this; } - public PutRoleRequestDescriptor RemoteIndices(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of remote indices permissions entries. + /// + /// + /// NOTE: Remote indices are effective for remote clusters configured with the API key based model. + /// They have no effect for remote clusters configured with the certificate based model. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(params Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges[] values) { - RemoteIndicesValue = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptor = descriptor; - return Self; + Instance.RemoteIndices = [.. values]; + return this; } - public PutRoleRequestDescriptor RemoteIndices(Action configure) + /// + /// + /// A list of remote indices permissions entries. + /// + /// + /// NOTE: Remote indices are effective for remote clusters configured with the API key based model. + /// They have no effect for remote clusters configured with the certificate based model. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RemoteIndices(params System.Action>[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteIndices = items; + return this; } - public PutRoleRequestDescriptor RemoteIndices(params Action[] configure) + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RunAs(System.Collections.Generic.ICollection? value) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = configure; - return Self; + Instance.RunAs = value; + return this; } /// @@ -889,10 +1123,10 @@ public PutRoleRequestDescriptor RemoteIndices(params ActionNote: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. /// /// - public PutRoleRequestDescriptor RunAs(ICollection? runAs) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RunAs(params string[] values) { - RunAsValue = runAs; - return Self; + Instance.RunAs = [.. values]; + return this; } /// @@ -900,175 +1134,88 @@ public PutRoleRequestDescriptor RunAs(ICollection? runAs) /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. /// /// - public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata(System.Collections.Generic.IDictionary? value) { - TransientMetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TransientMetadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata() { - writer.WriteStartObject(); - if (ApplicationsDescriptor is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorAction is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorActions is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - foreach (var action in ApplicationsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ApplicationsValue is not null) - { - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, ApplicationsValue, options); - } - - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GlobalValue is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, GlobalValue, options); - } + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (IndicesDescriptor is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorAction is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorActions is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - foreach (var action in IndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); - } + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor TransientMetadata(System.Action? action) + { + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - writer.WriteEndArray(); - } - else if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor AddTransientMetadatum(string key, object value) + { + Instance.TransientMetadata ??= new System.Collections.Generic.Dictionary(); + Instance.TransientMetadata.Add(key, value); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutRoleRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (RemoteClusterDescriptor is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteClusterDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorAction is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(RemoteClusterDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorActions is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - foreach (var action in RemoteClusterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndArray(); - } - else if (RemoteClusterValue is not null) - { - writer.WritePropertyName("remote_cluster"); - JsonSerializer.Serialize(writer, RemoteClusterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RemoteIndicesDescriptor is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteIndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorAction is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(RemoteIndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorActions is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - foreach (var action in RemoteIndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndArray(); - } - else if (RemoteIndicesValue is not null) - { - writer.WritePropertyName("remote_indices"); - JsonSerializer.Serialize(writer, RemoteIndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (TransientMetadataValue is not null) - { - writer.WritePropertyName("transient_metadata"); - JsonSerializer.Serialize(writer, TransientMetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs index bd63075fa2d..6f0d6eb864e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutRoleResponse : ElasticsearchResponse +internal sealed partial class PutRoleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRole = System.Text.Json.JsonEncodedText.Encode("role"); + + public override Elastic.Clients.Elasticsearch.Security.PutRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRole = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRole.TryReadProperty(ref reader, options, PropRole, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Role = propRole.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutRoleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRole, value.Role, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutRoleResponseConverter))] +public sealed partial class PutRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// When an existing role is updated, created is set to false. /// /// - [JsonInclude, JsonPropertyName("role")] - public Elastic.Clients.Elasticsearch.Security.CreatedStatus Role { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.CreatedStatus Role { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs index 91245e22493..e9284ae9399 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutUserRequestParameters : RequestParameters +public sealed partial class PutUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,108 @@ public sealed partial class PutUserRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class PutUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropPasswordHash = System.Text.Json.JsonEncodedText.Encode("password_hash"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.PutUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propPassword = default; + LocalJsonValue propPasswordHash = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propPasswordHash.TryReadProperty(ref reader, options, PropPasswordHash, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + Metadata = propMetadata.Value, + Password = propPassword.Value, + PasswordHash = propPasswordHash.Value, + Roles = propRoles.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropPasswordHash, value.PasswordHash, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update users. @@ -51,15 +146,28 @@ public sealed partial class PutUserRequestParameters : RequestParameters /// To change a user's password without updating any other fields, use the change password API. /// /// -public sealed partial class PutUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutUserRequestConverter))] +public sealed partial class PutUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) +#if NET7_0_OR_GREATER + public PutUserRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PutUserRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutUser; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityPutUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -71,7 +179,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// These values have the same meaning as in the index API, but the default value for this API is true. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -79,7 +186,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// The email of the user. /// /// - [JsonInclude, JsonPropertyName("email")] public string? Email { get; set; } /// @@ -87,7 +193,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// Specifies whether the user is enabled. /// /// - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } /// @@ -95,7 +200,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// The full name of the user. /// /// - [JsonInclude, JsonPropertyName("full_name")] public string? FullName { get; set; } /// @@ -103,8 +207,7 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// Arbitrary metadata that you want to associate with the user. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// @@ -114,7 +217,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// When updating an existing user, the password is optional, so that other fields on the user (such as their roles) may be updated without modifying the user's password /// /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -126,7 +228,6 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// The password parameter and the password_hash parameter cannot be used in the same request. /// /// - [JsonInclude, JsonPropertyName("password_hash")] public string? PasswordHash { get; set; } /// @@ -136,9 +237,7 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// To create a user without any roles, specify an empty list ([]). /// /// - [JsonInclude, JsonPropertyName("roles")] - public ICollection? Roles { get; set; } - [JsonInclude, JsonPropertyName("username")] + public System.Collections.Generic.ICollection? Roles { get; set; } public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } @@ -152,38 +251,45 @@ public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r /// To change a user's password without updating any other fields, use the change password API. /// /// -public sealed partial class PutUserRequestDescriptor : RequestDescriptor +public readonly partial struct PutUserRequestDescriptor { - internal PutUserRequestDescriptor(Action configure) => configure.Invoke(this); - - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutUser; + internal Elastic.Clients.Elasticsearch.Security.PutUserRequest Instance { get; init; } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutUserRequest instance) + { + Instance = instance; + } - internal override string OperationName => "security.put_user"; + public PutUserRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.PutUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PutUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + public static explicit operator Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.PutUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PutUserRequest(Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor descriptor) => descriptor.Instance; - private string? EmailValue { get; set; } - private bool? EnabledValue { get; set; } - private string? FullNameValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private string? PasswordValue { get; set; } - private string? PasswordHashValue { get; set; } - private ICollection? RolesValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + /// + /// + /// Valid values are true, false, and wait_for. + /// These values have the same meaning as in the index API, but the default value for this API is true. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } /// /// /// The email of the user. /// /// - public PutUserRequestDescriptor Email(string? email) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Email(string? value) { - EmailValue = email; - return Self; + Instance.Email = value; + return this; } /// @@ -191,10 +297,10 @@ public PutUserRequestDescriptor Email(string? email) /// Specifies whether the user is enabled. /// /// - public PutUserRequestDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } /// @@ -202,10 +308,10 @@ public PutUserRequestDescriptor Enabled(bool? enabled = true) /// The full name of the user. /// /// - public PutUserRequestDescriptor FullName(string? fullName) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor FullName(string? value) { - FullNameValue = fullName; - return Self; + Instance.FullName = value; + return this; } /// @@ -213,10 +319,39 @@ public PutUserRequestDescriptor FullName(string? fullName) /// Arbitrary metadata that you want to associate with the user. /// /// - public PutUserRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the user. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -227,10 +362,10 @@ public PutUserRequestDescriptor Metadata(Func, /// When updating an existing user, the password is optional, so that other fields on the user (such as their roles) may be updated without modifying the user's password /// /// - public PutUserRequestDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -242,10 +377,10 @@ public PutUserRequestDescriptor Password(string? password) /// The password parameter and the password_hash parameter cannot be used in the same request. /// /// - public PutUserRequestDescriptor PasswordHash(string? passwordHash) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor PasswordHash(string? value) { - PasswordHashValue = passwordHash; - return Self; + Instance.PasswordHash = value; + return this; } /// @@ -255,69 +390,83 @@ public PutUserRequestDescriptor PasswordHash(string? passwordHash) /// To create a user without any roles, specify an empty list ([]). /// /// - public PutUserRequestDescriptor Roles(ICollection? roles) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Roles(System.Collections.Generic.ICollection? value) { - RolesValue = roles; - return Self; + Instance.Roles = value; + return this; } - public PutUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + /// + /// + /// A set of roles the user has. + /// The roles determine the user's access permissions. + /// To create a user without any roles, specify an empty list ([]). + /// + /// + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Roles(params string[] values) { - UsernameValue = username; - return Self; + Instance.Roles = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(EmailValue)) - { - writer.WritePropertyName("email"); - writer.WriteStringValue(EmailValue); - } + Instance.Username = value; + return this; + } - if (EnabledValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PutUserRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); + return new Elastic.Clients.Elasticsearch.Security.PutUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FullNameValue)) - { - writer.WritePropertyName("full_name"); - writer.WriteStringValue(FullNameValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.PutUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (!string.IsNullOrEmpty(PasswordHashValue)) - { - writer.WritePropertyName("password_hash"); - writer.WriteStringValue(PasswordHashValue); - } + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RolesValue is not null) - { - writer.WritePropertyName("roles"); - JsonSerializer.Serialize(writer, RolesValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs index 83f742893a9..838152e9f5d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class PutUserResponse : ElasticsearchResponse +internal sealed partial class PutUserResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + + public override Elastic.Clients.Elasticsearch.Security.PutUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PutUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PutUserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PutUserResponseConverter))] +public sealed partial class PutUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A successful call returns a JSON structure that shows whether the user has been created or updated. /// When an existing user is updated, created is set to false. /// /// - [JsonInclude, JsonPropertyName("created")] - public bool Created { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Created { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs index 73bab3d943d..59d0944e0e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryApiKeysRequestParameters : RequestParameters +public sealed partial class QueryApiKeysRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,98 +50,87 @@ public sealed partial class QueryApiKeysRequestParameters : RequestParameters public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } -internal sealed partial class QueryApiKeysRequestConverter : JsonConverter +internal sealed partial class QueryApiKeysRequestConverter : System.Text.Json.Serialization.JsonConverter { - public override QueryApiKeysRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new QueryApiKeysRequest(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propFrom = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "from") - { - variant.From = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "search_after") - { - variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "size") - { - variant.Size = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "sort") - { - variant.Sort = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, QueryApiKeysRequest value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.From.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(value.From.Value); - } + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } - if (value.SearchAfter is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, value.SearchAfter, options); - } + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Size.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(value.Size.Value); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Sort is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, value.Sort, options); - } + Aggregations = propAggregations.Value, + From = propFrom.Value, + Query = propQuery.Value, + SearchAfter = propSearchAfter.Value, + Size = propSize.Value, + Sort = propSort.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); writer.WriteEndObject(); } } @@ -167,16 +149,28 @@ public override void Write(Utf8JsonWriter writer, QueryApiKeysRequest value, Jso /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. /// /// -[JsonConverter(typeof(QueryApiKeysRequestConverter))] -public sealed partial class QueryApiKeysRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestConverter))] +public sealed partial class QueryApiKeysRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { +#if NET7_0_OR_GREATER + public QueryApiKeysRequest() + { + } +#endif +#if !NET7_0_OR_GREATER public QueryApiKeysRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityQueryApiKeys; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -187,7 +181,6 @@ public QueryApiKeysRequest() /// Determines whether aggregation names are prefixed by their respective types in the response. /// /// - [JsonIgnore] public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } /// @@ -197,7 +190,6 @@ public QueryApiKeysRequest() /// An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has manage_api_key or higher privileges. /// /// - [JsonIgnore] public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } /// @@ -206,7 +198,6 @@ public QueryApiKeysRequest() /// If it exists, the profile UID is returned under the profile_uid response field for each API key. /// /// - [JsonIgnore] public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } /// @@ -218,8 +209,7 @@ public QueryApiKeysRequest() /// Additionally, aggregations only run over the same subset of fields that query works with. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// @@ -229,7 +219,6 @@ public QueryApiKeysRequest() /// To page through more hits, use the search_after parameter. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -247,7 +236,6 @@ public QueryApiKeysRequest() /// Such a match query is hence equivalent to a term query. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? Query { get; set; } /// @@ -255,8 +243,7 @@ public QueryApiKeysRequest() /// The search after definition. /// /// - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// @@ -267,7 +254,6 @@ public QueryApiKeysRequest() /// To page through more hits, use the search_after parameter. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -277,9 +263,7 @@ public QueryApiKeysRequest() /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } } /// @@ -296,37 +280,104 @@ public QueryApiKeysRequest() /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. /// /// -public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor, QueryApiKeysRequestParameters> +public readonly partial struct QueryApiKeysRequestDescriptor { - internal QueryApiKeysRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest instance) + { + Instance = instance; + } public QueryApiKeysRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors (effectively limited by it). + /// An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has manage_api_key or higher privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor WithLimitedBy(bool? value = true) + { + Instance.WithLimitedBy = value; + return this; + } - internal override string OperationName => "security.query_api_keys"; + /// + /// + /// Determines whether to also retrieve the profile UID for the API key owner principal. + /// If it exists, the profile UID is returned under the profile_uid response field for each API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } - public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); - public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(null); + return this; + } - private IDictionary> AggregationsValue { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } /// /// @@ -337,10 +388,31 @@ public QueryApiKeysRequestDescriptor() /// Additionally, aggregations only run over the same subset of fields that query works with. /// /// - public QueryApiKeysRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor AddAggregation(string key, System.Action> action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; } /// @@ -351,10 +423,10 @@ public QueryApiKeysRequestDescriptor Aggregations(Funcsearch_after parameter. /// /// - public QueryApiKeysRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -372,28 +444,63 @@ public QueryApiKeysRequestDescriptor From(int? from) /// Such a match query is hence equivalent to a term query. /// /// - public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + /// NOTE: The queryable string values associated with API keys are internally mapped as keywords. + /// Consequently, if no analyzer parameter is specified for a match query, then the provided match query string is interpreted as a single keyword value. + /// Such a match query is hence equivalent to a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; } - public QueryApiKeysRequestDescriptor Query(Action> configure) + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + /// NOTE: The queryable string values associated with API keys are internally mapped as keywords. + /// Consequently, if no analyzer parameter is specified for a match query, then the provided match query string is interpreted as a single keyword value. + /// Such a match query is hence equivalent to a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The search after definition. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -401,10 +508,10 @@ public QueryApiKeysRequestDescriptor Query(Action /// - public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -416,10 +523,10 @@ public QueryApiKeysRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryApiKeysRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -429,115 +536,116 @@ public QueryApiKeysRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryApiKeysRequestDescriptor Sort(Action> configure) + /// + /// + /// The sort definition. + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(params System.Action[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryApiKeysRequestDescriptor Sort(params Action>[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The sort definition. + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - if (AggregationsValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } + Instance.Sort = items; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -555,37 +663,89 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. /// /// -public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor +public readonly partial struct QueryApiKeysRequestDescriptor { - internal QueryApiKeysRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest instance) + { + Instance = instance; + } public QueryApiKeysRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor TypedKeys(bool? value = true) + { + Instance.TypedKeys = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors (effectively limited by it). + /// An API key cannot retrieve any API key’s limited-by role descriptors (including itself) unless it has manage_api_key or higher privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor WithLimitedBy(bool? value = true) + { + Instance.WithLimitedBy = value; + return this; + } - internal override string OperationName => "security.query_api_keys"; + /// + /// + /// Determines whether to also retrieve the profile UID for the API key owner principal. + /// If it exists, the profile UID is returned under the profile_uid response field for each API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } - public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); - public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); - public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } - private IDictionary AggregationsValue { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(null); + return this; + } /// /// @@ -596,10 +756,24 @@ public QueryApiKeysRequestDescriptor() /// Additionally, aggregations only run over the same subset of fields that query works with. /// /// - public QueryApiKeysRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; } /// @@ -610,10 +784,10 @@ public QueryApiKeysRequestDescriptor Aggregations(Funcsearch_after parameter. /// /// - public QueryApiKeysRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -631,28 +805,42 @@ public QueryApiKeysRequestDescriptor From(int? from) /// Such a match query is hence equivalent to a term query. /// /// - public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + /// NOTE: The queryable string values associated with API keys are internally mapped as keywords. + /// Consequently, if no analyzer parameter is specified for a match query, then the provided match query string is interpreted as a single keyword value. + /// Such a match query is hence equivalent to a term query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; } - public QueryApiKeysRequestDescriptor Query(Action configure) + /// + /// + /// The search after definition. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -660,10 +848,10 @@ public QueryApiKeysRequestDescriptor Query(Action /// - public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -675,10 +863,10 @@ public QueryApiKeysRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryApiKeysRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -688,114 +876,96 @@ public QueryApiKeysRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryApiKeysRequestDescriptor Sort(Action configure) + /// + /// + /// The sort definition. + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryApiKeysRequestDescriptor Sort(params Action[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) + if (action is null) { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); + return new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs index 89b4746dbc8..ae65a4eb5a8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs @@ -17,46 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryApiKeysResponse : ElasticsearchResponse +internal sealed partial class QueryApiKeysResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropApiKeys = System.Text.Json.JsonEncodedText.Encode("api_keys"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue> propApiKeys = default; + LocalJsonValue propCount = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propApiKeys.TryReadProperty(ref reader, options, PropApiKeys, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + ApiKeys = propApiKeys.Value, + Count = propCount.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropApiKeys, value.ApiKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponseConverter))] +public sealed partial class QueryApiKeysResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryApiKeysResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryApiKeysResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The aggregations result, if requested. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } /// /// /// A list of API key information. /// /// - [JsonInclude, JsonPropertyName("api_keys")] - public IReadOnlyCollection ApiKeys { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ApiKeys { get; set; } /// /// /// The number of API keys returned in the response. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The total number of API keys found. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs index f5f97c5ab6e..933af11ae4d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleRequest.g.cs @@ -17,23 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryRoleRequestParameters : RequestParameters +public sealed partial class QueryRoleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class QueryRoleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Security.QueryRoleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Query = propQuery.Value, + SearchAfter = propSearchAfter.Value, + Size = propSize.Value, + Sort = propSort.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryRoleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Find roles with a query. @@ -46,11 +114,28 @@ public sealed partial class QueryRoleRequestParameters : RequestParameters /// Also, the results can be paginated and sorted. /// /// -public sealed partial class QueryRoleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryRoleRequestConverter))] +public sealed partial class QueryRoleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; +#if NET7_0_OR_GREATER + public QueryRoleRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public QueryRoleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityQueryRole; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -64,7 +149,6 @@ public sealed partial class QueryRoleRequest : PlainRequestsearch_after parameter. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -77,7 +161,6 @@ public sealed partial class QueryRoleRequest : PlainRequestapplications.application, applications.privileges, and applications.resources. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.Security.RoleQuery? Query { get; set; } /// @@ -85,8 +168,7 @@ public sealed partial class QueryRoleRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// @@ -96,7 +178,6 @@ public sealed partial class QueryRoleRequest : PlainRequestsearch_after parameter. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -106,9 +187,7 @@ public sealed partial class QueryRoleRequest : PlainRequest_doc field to sort by index order. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } } /// @@ -123,32 +202,23 @@ public sealed partial class QueryRoleRequest : PlainRequest /// -public sealed partial class QueryRoleRequestDescriptor : RequestDescriptor, QueryRoleRequestParameters> +public readonly partial struct QueryRoleRequestDescriptor { - internal QueryRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryRoleRequest Instance { get; init; } - public QueryRoleRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.query_role"; + public QueryRoleRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -158,10 +228,26 @@ public QueryRoleRequestDescriptor() /// To page through more hits, use the search_after parameter. /// /// - public QueryRoleRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, and applications.resources. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQuery? value) { - FromValue = from; - return Self; + Instance.Query = value; + return this; } /// @@ -174,28 +260,37 @@ public QueryRoleRequestDescriptor From(int? from) /// applications.application, applications.privileges, and applications.resources. /// /// - public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Query(System.Action action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor.Build(action); + return this; } - public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor descriptor) + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, and applications.resources. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor.Build(action); + return this; } - public QueryRoleRequestDescriptor Query(Action> configure) + /// + /// + /// The search after definition. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -203,10 +298,10 @@ public QueryRoleRequestDescriptor Query(Action /// - public QueryRoleRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -217,10 +312,10 @@ public QueryRoleRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryRoleRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -230,109 +325,116 @@ public QueryRoleRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryRoleRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryRoleRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// You can sort on username, roles, or enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryRoleRequestDescriptor Sort(Action> configure) + /// + /// + /// The sort definition. + /// You can sort on username, roles, or enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(params System.Action[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryRoleRequestDescriptor Sort(params Action>[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The sort definition. + /// You can sort on username, roles, or enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FromValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Sort = items; + return this; + } - if (SearchAfterValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryRoleRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); + return new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -348,32 +450,23 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Also, the results can be paginated and sorted. /// /// -public sealed partial class QueryRoleRequestDescriptor : RequestDescriptor +public readonly partial struct QueryRoleRequestDescriptor { - internal QueryRoleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryRoleRequest Instance { get; init; } - public QueryRoleRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.query_role"; + public QueryRoleRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -383,10 +476,10 @@ public QueryRoleRequestDescriptor() /// To page through more hits, use the search_after parameter. /// /// - public QueryRoleRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -399,28 +492,37 @@ public QueryRoleRequestDescriptor From(int? from) /// applications.application, applications.privileges, and applications.resources. /// /// - public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQuery? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor descriptor) + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, and applications.resources. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor.Build(action); + return this; } - public QueryRoleRequestDescriptor Query(Action configure) + /// + /// + /// The search after definition. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -428,10 +530,10 @@ public QueryRoleRequestDescriptor Query(Action /// - public QueryRoleRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -442,10 +544,10 @@ public QueryRoleRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryRoleRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -455,108 +557,96 @@ public QueryRoleRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryRoleRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryRoleRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// You can sort on username, roles, or enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryRoleRequestDescriptor Sort(Action configure) + /// + /// + /// The sort definition. + /// You can sort on username, roles, or enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryRoleRequestDescriptor Sort(params Action[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryRoleRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (FromValue.HasValue) + if (action is null) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + return new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryRoleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleResponse.g.cs index 56a0deeb981..deb4155b862 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryRoleResponse.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryRoleResponse : ElasticsearchResponse +internal sealed partial class QueryRoleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Security.QueryRoleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Roles = propRoles.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryRoleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryRoleResponseConverter))] +public sealed partial class QueryRoleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRoleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRoleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of roles returned in the response. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// @@ -46,14 +115,20 @@ public sealed partial class QueryRoleResponse : ElasticsearchResponse /// It contains the array of values that have been used for sorting. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } /// /// /// The total number of roles found. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs index eca270c307e..43a85232afd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryUserRequestParameters : RequestParameters +public sealed partial class QueryUserRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,6 +33,81 @@ public sealed partial class QueryUserRequestParameters : RequestParameters public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } } +internal sealed partial class QueryUserRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Security.QueryUserRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Query = propQuery.Value, + SearchAfter = propSearchAfter.Value, + Size = propSize.Value, + Sort = propSort.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryUserRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Find users with a query. @@ -53,11 +121,28 @@ public sealed partial class QueryUserRequestParameters : RequestParameters /// This API is only for native users. /// /// -public sealed partial class QueryUserRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryUserRequestConverter))] +public sealed partial class QueryUserRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; +#if NET7_0_OR_GREATER + public QueryUserRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public QueryUserRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityQueryUser; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -68,7 +153,6 @@ public sealed partial class QueryUserRequest : PlainRequest /// - [JsonIgnore] public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } /// @@ -79,7 +163,6 @@ public sealed partial class QueryUserRequest : PlainRequestsearch_after parameter. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -91,7 +174,6 @@ public sealed partial class QueryUserRequest : PlainRequestusername, roles, enabled, full_name, and email. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.Security.UserQuery? Query { get; set; } /// @@ -99,8 +181,7 @@ public sealed partial class QueryUserRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// @@ -110,7 +191,6 @@ public sealed partial class QueryUserRequest : PlainRequestsearch_after parameter. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -120,9 +200,7 @@ public sealed partial class QueryUserRequest : PlainRequest_doc field to sort by index order. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } } /// @@ -138,34 +216,34 @@ public sealed partial class QueryUserRequest : PlainRequest /// -public sealed partial class QueryUserRequestDescriptor : RequestDescriptor, QueryUserRequestParameters> +public readonly partial struct QueryUserRequestDescriptor { - internal QueryUserRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryUserRequest Instance { get; init; } - public QueryUserRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryUserRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.query_user"; + public QueryUserRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor descriptor) => descriptor.Instance; - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.UserQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } + /// + /// + /// Determines whether to retrieve the user profile UID, if it exists, for the users. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } /// /// @@ -175,10 +253,25 @@ public QueryUserRequestDescriptor() /// To page through more hits, use the search_after parameter. /// /// - public QueryUserRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled, full_name, and email. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? value) { - FromValue = from; - return Self; + Instance.Query = value; + return this; } /// @@ -190,28 +283,36 @@ public QueryUserRequestDescriptor From(int? from) /// You can query the following information associated with user: username, roles, enabled, full_name, and email. /// /// - public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Query(System.Action action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor.Build(action); + return this; } - public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled, full_name, and email. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor.Build(action); + return this; } - public QueryUserRequestDescriptor Query(Action> configure) + /// + /// + /// The search after definition + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -219,10 +320,10 @@ public QueryUserRequestDescriptor Query(Action /// - public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -233,10 +334,10 @@ public QueryUserRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryUserRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -246,109 +347,116 @@ public QueryUserRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryUserRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// Fields eligible for sorting are: username, roles, enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryUserRequestDescriptor Sort(Action> configure) + /// + /// + /// The sort definition. + /// Fields eligible for sorting are: username, roles, enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(params System.Action[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryUserRequestDescriptor Sort(params Action>[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The sort definition. + /// Fields eligible for sorting are: username, roles, enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FromValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Sort = items; + return this; + } - if (SearchAfterValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryUserRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); + return new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -365,34 +473,34 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This API is only for native users. /// /// -public sealed partial class QueryUserRequestDescriptor : RequestDescriptor +public readonly partial struct QueryUserRequestDescriptor { - internal QueryUserRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.QueryUserRequest Instance { get; init; } - public QueryUserRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryUserRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.query_user"; + public QueryUserRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + public static explicit operator Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(Elastic.Clients.Elasticsearch.Security.QueryUserRequest instance) => new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor descriptor) => descriptor.Instance; - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.UserQuery? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } + /// + /// + /// Determines whether to retrieve the user profile UID, if it exists, for the users. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor WithProfileUid(bool? value = true) + { + Instance.WithProfileUid = value; + return this; + } /// /// @@ -402,10 +510,10 @@ public QueryUserRequestDescriptor() /// To page through more hits, use the search_after parameter. /// /// - public QueryUserRequestDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -417,28 +525,36 @@ public QueryUserRequestDescriptor From(int? from) /// You can query the following information associated with user: username, roles, enabled, full_name, and email. /// /// - public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? query) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled, full_name, and email. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor.Build(action); + return this; } - public QueryUserRequestDescriptor Query(Action configure) + /// + /// + /// The search after definition + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -446,10 +562,10 @@ public QueryUserRequestDescriptor Query(Action /// - public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -460,10 +576,10 @@ public QueryUserRequestDescriptor SearchAfter(ICollectionsearch_after parameter. /// /// - public QueryUserRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -473,108 +589,96 @@ public QueryUserRequestDescriptor Size(int? size) /// In addition, sort can also be applied to the _doc field to sort by index order. /// /// - public QueryUserRequestDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// The sort definition. + /// Fields eligible for sorting are: username, roles, enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public QueryUserRequestDescriptor Sort(Action configure) + /// + /// + /// The sort definition. + /// Fields eligible for sorting are: username, roles, enabled. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public QueryUserRequestDescriptor Sort(params Action[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.QueryUserRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (FromValue.HasValue) + if (action is null) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + return new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.QueryUserRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs index bdadd02bb4b..2f5d81b6cad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class QueryUserResponse : ElasticsearchResponse +internal sealed partial class QueryUserResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropUsers = System.Text.Json.JsonEncodedText.Encode("users"); + + public override Elastic.Clients.Elasticsearch.Security.QueryUserResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propTotal = default; + LocalJsonValue> propUsers = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propUsers.TryReadProperty(ref reader, options, PropUsers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Total = propTotal.Value, + Users = propUsers.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryUserResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropUsers, value.Users, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryUserResponseConverter))] +public sealed partial class QueryUserResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryUserResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryUserResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of users returned in the response. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The total number of users found. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } /// /// /// A list of users that match the query. /// /// - [JsonInclude, JsonPropertyName("users")] - public IReadOnlyCollection Users { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Users { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs index ee1e858e3d4..5726218b1a7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlAuthenticateRequestParameters : RequestParameters +public sealed partial class SamlAuthenticateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class SamlAuthenticateRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropContent = System.Text.Json.JsonEncodedText.Encode("content"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + + public override Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propContent = default; + LocalJsonValue propIds = default; + LocalJsonValue propRealm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContent.TryReadProperty(ref reader, options, PropContent, null)) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Content = propContent.Value, + Ids = propIds.Value, + Realm = propRealm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContent, value.Content, null, null); + writer.WriteProperty(options, PropIds, value.Ids, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteEndObject(); + } } /// @@ -68,11 +118,35 @@ public sealed partial class SamlAuthenticateRequestParameters : RequestParameter /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. /// /// -public sealed partial class SamlAuthenticateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestConverter))] +public sealed partial class SamlAuthenticateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlAuthenticateRequest(string content, Elastic.Clients.Elasticsearch.Ids ids) + { + Content = content; + Ids = ids; + } +#if NET7_0_OR_GREATER + public SamlAuthenticateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SamlAuthenticateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlAuthenticate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -83,23 +157,28 @@ public sealed partial class SamlAuthenticateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("content")] - public string Content { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Content { get; set; } /// /// /// A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. /// /// - [JsonInclude, JsonPropertyName("ids")] - public Elastic.Clients.Elasticsearch.Ids Ids { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Ids { get; set; } /// /// /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. /// /// - [JsonInclude, JsonPropertyName("realm")] public string? Realm { get; set; } } @@ -137,35 +216,33 @@ public sealed partial class SamlAuthenticateRequest : PlainRequest /// -public sealed partial class SamlAuthenticateRequestDescriptor : RequestDescriptor +public readonly partial struct SamlAuthenticateRequestDescriptor { - internal SamlAuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest Instance { get; init; } - public SamlAuthenticateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlAuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.saml_authenticate"; + public SamlAuthenticateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string ContentValue { get; set; } - private Elastic.Clients.Elasticsearch.Ids IdsValue { get; set; } - private string? RealmValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. /// /// - public SamlAuthenticateRequestDescriptor Content(string content) + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor Content(string value) { - ContentValue = content; - return Self; + Instance.Content = value; + return this; } /// @@ -173,10 +250,10 @@ public SamlAuthenticateRequestDescriptor Content(string content) /// A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. /// /// - public SamlAuthenticateRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids value) { - IdsValue = ids; - return Self; + Instance.Ids = value; + return this; } /// @@ -184,25 +261,59 @@ public SamlAuthenticateRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids i /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. /// /// - public SamlAuthenticateRequestDescriptor Realm(string? realm) + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor Realm(string? value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("content"); - writer.WriteStringValue(ContentValue); - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); - if (!string.IsNullOrEmpty(RealmValue)) - { - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs index c79371c6f6a..f608570d123 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs @@ -17,54 +17,153 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlAuthenticateResponse : ElasticsearchResponse +internal sealed partial class SamlAuthenticateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText PropExpiresIn = System.Text.Json.JsonEncodedText.Encode("expires_in"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessToken = default; + LocalJsonValue propExpiresIn = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRefreshToken = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessToken.TryReadProperty(ref reader, options, PropAccessToken, null)) + { + continue; + } + + if (propExpiresIn.TryReadProperty(ref reader, options, PropExpiresIn, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessToken = propAccessToken.Value, + ExpiresIn = propExpiresIn.Value, + Realm = propRealm.Value, + RefreshToken = propRefreshToken.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessToken, value.AccessToken, null, null); + writer.WriteProperty(options, PropExpiresIn, value.ExpiresIn, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponseConverter))] +public sealed partial class SamlAuthenticateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlAuthenticateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlAuthenticateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The access token that was generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("access_token")] - public string AccessToken { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string AccessToken { get; set; } /// /// /// The amount of time (in seconds) left until the token expires. /// /// - [JsonInclude, JsonPropertyName("expires_in")] - public int ExpiresIn { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ExpiresIn { get; set; } /// /// /// The name of the realm where the user was authenticated. /// /// - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } /// /// /// The refresh token that was generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("refresh_token")] - public string RefreshToken { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RefreshToken { get; set; } /// /// /// The authenticated user's name. /// /// - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs index 1783bafce95..ac292317dee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlCompleteLogoutRequestParameters : RequestParameters +public sealed partial class SamlCompleteLogoutRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class SamlCompleteLogoutRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropContent = System.Text.Json.JsonEncodedText.Encode("content"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText PropQueryString = System.Text.Json.JsonEncodedText.Encode("query_string"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + + public override Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propContent = default; + LocalJsonValue propIds = default; + LocalJsonValue propQueryString = default; + LocalJsonValue propRealm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContent.TryReadProperty(ref reader, options, PropContent, null)) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, null)) + { + continue; + } + + if (propQueryString.TryReadProperty(ref reader, options, PropQueryString, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Content = propContent.Value, + Ids = propIds.Value, + QueryString = propQueryString.Value, + Realm = propRealm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContent, value.Content, null, null); + writer.WriteProperty(options, PropIds, value.Ids, null, null); + writer.WriteProperty(options, PropQueryString, value.QueryString, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Logout of SAML completely. @@ -53,11 +112,35 @@ public sealed partial class SamlCompleteLogoutRequestParameters : RequestParamet /// The caller of this API must prepare the request accordingly so that this API can handle either of them. /// /// -public sealed partial class SamlCompleteLogoutRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestConverter))] +public sealed partial class SamlCompleteLogoutRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Ids ids, string realm) + { + Ids = ids; + Realm = realm; + } +#if NET7_0_OR_GREATER + public SamlCompleteLogoutRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SamlCompleteLogoutRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlCompleteLogout; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -68,7 +151,6 @@ public sealed partial class SamlCompleteLogoutRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("content")] public string? Content { get; set; } /// @@ -76,15 +158,17 @@ public sealed partial class SamlCompleteLogoutRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("ids")] - public Elastic.Clients.Elasticsearch.Ids Ids { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ids Ids { get; set; } /// /// /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. /// /// - [JsonInclude, JsonPropertyName("query_string")] public string? QueryString { get; set; } /// @@ -92,8 +176,11 @@ public sealed partial class SamlCompleteLogoutRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } } /// @@ -115,36 +202,33 @@ public sealed partial class SamlCompleteLogoutRequest : PlainRequest /// -public sealed partial class SamlCompleteLogoutRequestDescriptor : RequestDescriptor +public readonly partial struct SamlCompleteLogoutRequestDescriptor { - internal SamlCompleteLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest Instance { get; init; } - public SamlCompleteLogoutRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlCompleteLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.saml_complete_logout"; + public SamlCompleteLogoutRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? ContentValue { get; set; } - private Elastic.Clients.Elasticsearch.Ids IdsValue { get; set; } - private string? QueryStringValue { get; set; } - private string RealmValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor descriptor) => descriptor.Instance; /// /// /// If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. /// /// - public SamlCompleteLogoutRequestDescriptor Content(string? content) + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor Content(string? value) { - ContentValue = content; - return Self; + Instance.Content = value; + return this; } /// @@ -152,10 +236,10 @@ public SamlCompleteLogoutRequestDescriptor Content(string? content) /// A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. /// /// - public SamlCompleteLogoutRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids value) { - IdsValue = ids; - return Self; + Instance.Ids = value; + return this; } /// @@ -163,10 +247,10 @@ public SamlCompleteLogoutRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. /// /// - public SamlCompleteLogoutRequestDescriptor QueryString(string? queryString) + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor QueryString(string? value) { - QueryStringValue = queryString; - return Self; + Instance.QueryString = value; + return this; } /// @@ -174,31 +258,59 @@ public SamlCompleteLogoutRequestDescriptor QueryString(string? queryString) /// The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. /// /// - public SamlCompleteLogoutRequestDescriptor Realm(string realm) + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor Realm(string value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContentValue)) - { - writer.WritePropertyName("content"); - writer.WriteStringValue(ContentValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); - if (!string.IsNullOrEmpty(QueryStringValue)) - { - writer.WritePropertyName("query_string"); - writer.WriteStringValue(QueryStringValue); - } + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs index e9b3fb8a04d..7b364ca92cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs @@ -17,15 +17,52 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlCompleteLogoutResponse : ElasticsearchResponse +internal sealed partial class SamlCompleteLogoutResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponseConverter))] +public sealed partial class SamlCompleteLogoutResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlCompleteLogoutResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlCompleteLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs index f428cb87bcf..f9692d34724 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs @@ -17,21 +17,71 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlInvalidateRequestParameters : RequestParameters +public sealed partial class SamlInvalidateRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class SamlInvalidateRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcs = System.Text.Json.JsonEncodedText.Encode("acs"); + private static readonly System.Text.Json.JsonEncodedText PropQueryString = System.Text.Json.JsonEncodedText.Encode("query_string"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + + public override Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcs = default; + LocalJsonValue propQueryString = default; + LocalJsonValue propRealm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcs.TryReadProperty(ref reader, options, PropAcs, null)) + { + continue; + } + + if (propQueryString.TryReadProperty(ref reader, options, PropQueryString, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acs = propAcs.Value, + QueryString = propQueryString.Value, + Realm = propRealm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcs, value.Acs, null, null); + writer.WriteProperty(options, PropQueryString, value.QueryString, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteEndObject(); + } } /// @@ -52,11 +102,34 @@ public sealed partial class SamlInvalidateRequestParameters : RequestParameters /// Thus the user can be redirected back to their IdP. /// /// -public sealed partial class SamlInvalidateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestConverter))] +public sealed partial class SamlInvalidateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlInvalidateRequest(string queryString) + { + QueryString = queryString; + } +#if NET7_0_OR_GREATER + public SamlInvalidateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SamlInvalidateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlInvalidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlInvalidate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -67,7 +140,6 @@ public sealed partial class SamlInvalidateRequest : PlainRequestrealm parameter. /// /// - [JsonInclude, JsonPropertyName("acs")] public string? Acs { get; set; } /// @@ -79,15 +151,17 @@ public sealed partial class SamlInvalidateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("query_string")] - public string QueryString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string QueryString { get; set; } /// /// /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. /// /// - [JsonInclude, JsonPropertyName("realm")] public string? Realm { get; set; } } @@ -109,35 +183,33 @@ public sealed partial class SamlInvalidateRequest : PlainRequest /// -public sealed partial class SamlInvalidateRequestDescriptor : RequestDescriptor +public readonly partial struct SamlInvalidateRequestDescriptor { - internal SamlInvalidateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest Instance { get; init; } - public SamlInvalidateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlInvalidateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.saml_invalidate"; + public SamlInvalidateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? AcsValue { get; set; } - private string QueryStringValue { get; set; } - private string? RealmValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. /// /// - public SamlInvalidateRequestDescriptor Acs(string? acs) + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor Acs(string? value) { - AcsValue = acs; - return Self; + Instance.Acs = value; + return this; } /// @@ -149,10 +221,10 @@ public SamlInvalidateRequestDescriptor Acs(string? acs) /// The client application must not attempt to parse or process the string in any way. /// /// - public SamlInvalidateRequestDescriptor QueryString(string queryString) + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor QueryString(string value) { - QueryStringValue = queryString; - return Self; + Instance.QueryString = value; + return this; } /// @@ -160,29 +232,59 @@ public SamlInvalidateRequestDescriptor QueryString(string queryString) /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. /// /// - public SamlInvalidateRequestDescriptor Realm(string? realm) + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor Realm(string? value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AcsValue)) - { - writer.WritePropertyName("acs"); - writer.WriteStringValue(AcsValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("query_string"); - writer.WriteStringValue(QueryStringValue); - if (!string.IsNullOrEmpty(RealmValue)) - { - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - } + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs index d905cc45799..f57b244528f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlInvalidateResponse : ElasticsearchResponse +internal sealed partial class SamlInvalidateResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropInvalidated = System.Text.Json.JsonEncodedText.Encode("invalidated"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRedirect = System.Text.Json.JsonEncodedText.Encode("redirect"); + + public override Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInvalidated = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRedirect = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInvalidated.TryReadProperty(ref reader, options, PropInvalidated, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRedirect.TryReadProperty(ref reader, options, PropRedirect, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Invalidated = propInvalidated.Value, + Realm = propRealm.Value, + Redirect = propRedirect.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInvalidated, value.Invalidated, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRedirect, value.Redirect, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponseConverter))] +public sealed partial class SamlInvalidateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlInvalidateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlInvalidateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of tokens that were invalidated as part of this logout. /// /// - [JsonInclude, JsonPropertyName("invalidated")] - public int Invalidated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Invalidated { get; set; } /// /// /// The realm name of the SAML realm in Elasticsearch that authenticated the user. /// /// - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } /// /// /// A SAML logout response as a parameter so that the user can be redirected back to the SAML IdP. /// /// - [JsonInclude, JsonPropertyName("redirect")] - public string Redirect { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Redirect { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs index 3da82e55162..ea99f411c14 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs @@ -17,21 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlLogoutRequestParameters : RequestParameters +public sealed partial class SamlLogoutRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class SamlLogoutRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + + public override Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRefreshToken = default; + LocalJsonValue propToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRefreshToken.TryReadProperty(ref reader, options, PropRefreshToken, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RefreshToken = propRefreshToken.Value, + Token = propToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRefreshToken, value.RefreshToken, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteEndObject(); + } } /// @@ -50,11 +91,34 @@ public sealed partial class SamlLogoutRequestParameters : RequestParameters /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). /// /// -public sealed partial class SamlLogoutRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestConverter))] +public sealed partial class SamlLogoutRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlLogoutRequest(string token) + { + Token = token; + } +#if NET7_0_OR_GREATER + public SamlLogoutRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SamlLogoutRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlLogout; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -66,7 +130,6 @@ public sealed partial class SamlLogoutRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("refresh_token")] public string? RefreshToken { get; set; } /// @@ -75,8 +138,11 @@ public sealed partial class SamlLogoutRequest : PlainRequestrefresh_token. /// /// - [JsonInclude, JsonPropertyName("token")] - public string Token { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Token { get; set; } } /// @@ -95,24 +161,23 @@ public sealed partial class SamlLogoutRequest : PlainRequest /// -public sealed partial class SamlLogoutRequestDescriptor : RequestDescriptor +public readonly partial struct SamlLogoutRequestDescriptor { - internal SamlLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest Instance { get; init; } - public SamlLogoutRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.saml_logout"; + public SamlLogoutRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? RefreshTokenValue { get; set; } - private string TokenValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -120,10 +185,10 @@ public SamlLogoutRequestDescriptor() /// Alternatively, the most recent refresh token that was received after refreshing the original access token. /// /// - public SamlLogoutRequestDescriptor RefreshToken(string? refreshToken) + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor RefreshToken(string? value) { - RefreshTokenValue = refreshToken; - return Self; + Instance.RefreshToken = value; + return this; } /// @@ -132,23 +197,59 @@ public SamlLogoutRequestDescriptor RefreshToken(string? refreshToken) /// Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. /// /// - public SamlLogoutRequestDescriptor Token(string token) + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor Token(string value) { - TokenValue = token; - return Self; + Instance.Token = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(RefreshTokenValue)) - { - writer.WritePropertyName("refresh_token"); - writer.WriteStringValue(RefreshTokenValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("token"); - writer.WriteStringValue(TokenValue); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs index 865d73829e5..8885b6ed1fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlLogoutResponse : ElasticsearchResponse +internal sealed partial class SamlLogoutResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropRedirect = System.Text.Json.JsonEncodedText.Encode("redirect"); + + public override Elastic.Clients.Elasticsearch.Security.SamlLogoutResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRedirect = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRedirect.TryReadProperty(ref reader, options, PropRedirect, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Redirect = propRedirect.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlLogoutResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRedirect, value.Redirect, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlLogoutResponseConverter))] +public sealed partial class SamlLogoutResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlLogoutResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlLogoutResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A URL that contains a SAML logout request as a parameter. /// You can use this URL to be redirected back to the SAML IdP and to initiate Single Logout. /// /// - [JsonInclude, JsonPropertyName("redirect")] - public string Redirect { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Redirect { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs index 6184b009bdc..d5cf82e51ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs @@ -17,23 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlPrepareAuthenticationRequestParameters : RequestParameters +public sealed partial class SamlPrepareAuthenticationRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class SamlPrepareAuthenticationRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcs = System.Text.Json.JsonEncodedText.Encode("acs"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRelayState = System.Text.Json.JsonEncodedText.Encode("relay_state"); + + public override Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcs = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRelayState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcs.TryReadProperty(ref reader, options, PropAcs, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRelayState.TryReadProperty(ref reader, options, PropRelayState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acs = propAcs.Value, + Realm = propRealm.Value, + RelayState = propRelayState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcs, value.Acs, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRelayState, value.RelayState, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Prepare SAML authentication. @@ -55,11 +105,28 @@ public sealed partial class SamlPrepareAuthenticationRequestParameters : Request /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. /// /// -public sealed partial class SamlPrepareAuthenticationRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestConverter))] +public sealed partial class SamlPrepareAuthenticationRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; +#if NET7_0_OR_GREATER + public SamlPrepareAuthenticationRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public SamlPrepareAuthenticationRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlPrepareAuthentication; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -71,7 +138,6 @@ public sealed partial class SamlPrepareAuthenticationRequest : PlainRequestrealm parameter. /// /// - [JsonInclude, JsonPropertyName("acs")] public string? Acs { get; set; } /// @@ -80,7 +146,6 @@ public sealed partial class SamlPrepareAuthenticationRequest : PlainRequestacs parameter. /// /// - [JsonInclude, JsonPropertyName("realm")] public string? Realm { get; set; } /// @@ -89,7 +154,6 @@ public sealed partial class SamlPrepareAuthenticationRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("relay_state")] public string? RelayState { get; set; } } @@ -114,25 +178,23 @@ public sealed partial class SamlPrepareAuthenticationRequest : PlainRequest /// -public sealed partial class SamlPrepareAuthenticationRequestDescriptor : RequestDescriptor +public readonly partial struct SamlPrepareAuthenticationRequestDescriptor { - internal SamlPrepareAuthenticationRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest Instance { get; init; } - public SamlPrepareAuthenticationRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlPrepareAuthenticationRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "security.saml_prepare_authentication"; + public SamlPrepareAuthenticationRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string? AcsValue { get; set; } - private string? RealmValue { get; set; } - private string? RelayStateValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor descriptor) => descriptor.Instance; /// /// @@ -140,10 +202,10 @@ public SamlPrepareAuthenticationRequestDescriptor() /// The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. /// /// - public SamlPrepareAuthenticationRequestDescriptor Acs(string? acs) + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor Acs(string? value) { - AcsValue = acs; - return Self; + Instance.Acs = value; + return this; } /// @@ -152,10 +214,10 @@ public SamlPrepareAuthenticationRequestDescriptor Acs(string? acs) /// You must specify either this parameter or the acs parameter. /// /// - public SamlPrepareAuthenticationRequestDescriptor Realm(string? realm) + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor Realm(string? value) { - RealmValue = realm; - return Self; + Instance.Realm = value; + return this; } /// @@ -164,33 +226,64 @@ public SamlPrepareAuthenticationRequestDescriptor Realm(string? realm) /// If the Authentication Request is signed, this value is used as part of the signature computation. /// /// - public SamlPrepareAuthenticationRequestDescriptor RelayState(string? relayState) + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor RelayState(string? value) { - RelayStateValue = relayState; - return Self; + Instance.RelayState = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AcsValue)) + if (action is null) { - writer.WritePropertyName("acs"); - writer.WriteStringValue(AcsValue); + return new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(RealmValue)) - { - writer.WritePropertyName("realm"); - writer.WriteStringValue(RealmValue); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(RelayStateValue)) - { - writer.WritePropertyName("relay_state"); - writer.WriteStringValue(RelayStateValue); - } + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs index 898d103b4ec..31c58e65ec1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlPrepareAuthenticationResponse : ElasticsearchResponse +internal sealed partial class SamlPrepareAuthenticationResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRedirect = System.Text.Json.JsonEncodedText.Encode("redirect"); + + public override Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRedirect = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRedirect.TryReadProperty(ref reader, options, PropRedirect, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Realm = propRealm.Value, + Redirect = propRedirect.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRedirect, value.Redirect, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponseConverter))] +public sealed partial class SamlPrepareAuthenticationResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlPrepareAuthenticationResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlPrepareAuthenticationResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A unique identifier for the SAML Request to be stored by the caller of the API. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the Elasticsearch realm that was used to construct the authentication request. /// /// - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } /// /// /// The URL to redirect the user to. /// /// - [JsonInclude, JsonPropertyName("redirect")] - public string Redirect { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Redirect { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs index cfc267d2636..75a88cd885e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlServiceProviderMetadataRequestParameters : RequestParameters +public sealed partial class SamlServiceProviderMetadataRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class SamlServiceProviderMetadataRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Create SAML service provider metadata. @@ -46,19 +68,42 @@ public sealed partial class SamlServiceProviderMetadataRequestParameters : Reque /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. /// /// -public sealed partial class SamlServiceProviderMetadataRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestConverter))] +public sealed partial class SamlServiceProviderMetadataRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Name realmName) : base(r => r.Required("realm_name", realmName)) { } +#if NET7_0_OR_GREATER + public SamlServiceProviderMetadataRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySamlServiceProviderMetadata; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "security.saml_service_provider_metadata"; + + /// + /// + /// The name of the SAML realm in Elasticsearch. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name RealmName { get => P("realm_name"); set => PR("realm_name", value); } } /// @@ -73,29 +118,88 @@ public SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Name rea /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. /// /// -public sealed partial class SamlServiceProviderMetadataRequestDescriptor : RequestDescriptor +public readonly partial struct SamlServiceProviderMetadataRequestDescriptor { - internal SamlServiceProviderMetadataRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest Instance { get; init; } - public SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Name realmName) : base(r => r.Required("realm_name", realmName)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + public SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Name realmName) + { + Instance = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest(realmName); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public SamlServiceProviderMetadataRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest instance) => new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.saml_service_provider_metadata"; + /// + /// + /// The name of the SAML realm in Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name value) + { + Instance.RealmName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public SamlServiceProviderMetadataRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name realmName) + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("realm_name", realmName); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs index 6535cf400cf..1c5c08822ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SamlServiceProviderMetadataResponse : ElasticsearchResponse +internal sealed partial class SamlServiceProviderMetadataResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + + public override Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Metadata = propMetadata.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponseConverter))] +public sealed partial class SamlServiceProviderMetadataResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamlServiceProviderMetadataResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamlServiceProviderMetadataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An XML string that contains a SAML Service Provider's metadata for the realm. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public string Metadata { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Metadata { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs index 26583a14faf..f3668953670 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SuggestUserProfilesRequestParameters : RequestParameters +public sealed partial class SuggestUserProfilesRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class SuggestUserProfilesRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropHint = System.Text.Json.JsonEncodedText.Encode("hint"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propData = default; + LocalJsonValue propHint = default; + LocalJsonValue propName = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propHint.TryReadProperty(ref reader, options, PropHint, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Hint = propHint.Value, + Name = propName.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHint, value.Hint, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Suggest a user profile. @@ -47,11 +106,28 @@ public sealed partial class SuggestUserProfilesRequestParameters : RequestParame /// Elastic reserves the right to change or remove this feature in future releases without prior notice. /// /// -public sealed partial class SuggestUserProfilesRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestConverter))] +public sealed partial class SuggestUserProfilesRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; +#if NET7_0_OR_GREATER + public SuggestUserProfilesRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public SuggestUserProfilesRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecuritySuggestUserProfiles; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -66,9 +142,7 @@ public sealed partial class SuggestUserProfilesRequest : PlainRequestdata as both the query parameter and the request body field. /// /// - [JsonInclude, JsonPropertyName("data")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Data { get; set; } + public System.Collections.Generic.ICollection? Data { get; set; } /// /// @@ -77,7 +151,6 @@ public sealed partial class SuggestUserProfilesRequest : PlainRequestname field query. /// /// - [JsonInclude, JsonPropertyName("hint")] public Elastic.Clients.Elasticsearch.Security.Hint? Hint { get; set; } /// @@ -86,7 +159,6 @@ public sealed partial class SuggestUserProfilesRequest : PlainRequestusername, full_name, and email. /// /// - [JsonInclude, JsonPropertyName("name")] public string? Name { get; set; } /// @@ -94,7 +166,6 @@ public sealed partial class SuggestUserProfilesRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("size")] public long? Size { get; set; } } @@ -111,28 +182,38 @@ public sealed partial class SuggestUserProfilesRequest : PlainRequest /// -public sealed partial class SuggestUserProfilesRequestDescriptor : RequestDescriptor +public readonly partial struct SuggestUserProfilesRequestDescriptor { - internal SuggestUserProfilesRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest Instance { get; init; } - public SuggestUserProfilesRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestUserProfilesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public SuggestUserProfilesRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.suggest_user_profiles"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest instance) => new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor descriptor) => descriptor.Instance; - private ICollection? DataValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.Hint? HintValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.HintDescriptor HintDescriptor { get; set; } - private Action HintDescriptorAction { get; set; } - private string? NameValue { get; set; } - private long? SizeValue { get; set; } + /// + /// + /// A comma-separated list of filters for the data field of the profile document. + /// To return all content use data=*. + /// To return a subset of content, use data=<key> to retrieve content nested under the specified <key>. + /// By default, the API returns no data content. + /// It is an error to specify data as both the query parameter and the request body field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Data(System.Collections.Generic.ICollection? value) + { + Instance.Data = value; + return this; + } /// /// @@ -143,10 +224,10 @@ public SuggestUserProfilesRequestDescriptor() /// It is an error to specify data as both the query parameter and the request body field. /// /// - public SuggestUserProfilesRequestDescriptor Data(ICollection? data) + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Data(params string[] values) { - DataValue = data; - return Self; + Instance.Data = [.. values]; + return this; } /// @@ -156,28 +237,36 @@ public SuggestUserProfilesRequestDescriptor Data(ICollection? data) /// Profiles not matching the hint aren't excluded from the response as long as the profile matches the name field query. /// /// - public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Security.Hint? hint) + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Security.Hint? value) { - HintDescriptor = null; - HintDescriptorAction = null; - HintValue = hint; - return Self; + Instance.Hint = value; + return this; } - public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Security.HintDescriptor descriptor) + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint aren't excluded from the response as long as the profile matches the name field query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Hint() { - HintValue = null; - HintDescriptorAction = null; - HintDescriptor = descriptor; - return Self; + Instance.Hint = Elastic.Clients.Elasticsearch.Security.HintDescriptor.Build(null); + return this; } - public SuggestUserProfilesRequestDescriptor Hint(Action configure) + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint aren't excluded from the response as long as the profile matches the name field query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Hint(System.Action? action) { - HintValue = null; - HintDescriptor = null; - HintDescriptorAction = configure; - return Self; + Instance.Hint = Elastic.Clients.Elasticsearch.Security.HintDescriptor.Build(action); + return this; } /// @@ -186,10 +275,10 @@ public SuggestUserProfilesRequestDescriptor Hint(Actionusername, full_name, and email. /// /// - public SuggestUserProfilesRequestDescriptor Name(string? name) + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Name(string? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -197,49 +286,64 @@ public SuggestUserProfilesRequestDescriptor Name(string? name) /// The number of profiles to return. /// /// - public SuggestUserProfilesRequestDescriptor Size(long? size) + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Size(long? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (DataValue is not null) + if (action is null) { - writer.WritePropertyName("data"); - SingleOrManySerializationHelper.Serialize(DataValue, writer, options); + return new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (HintDescriptor is not null) - { - writer.WritePropertyName("hint"); - JsonSerializer.Serialize(writer, HintDescriptor, options); - } - else if (HintDescriptorAction is not null) - { - writer.WritePropertyName("hint"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.HintDescriptor(HintDescriptorAction), options); - } - else if (HintValue is not null) - { - writer.WritePropertyName("hint"); - JsonSerializer.Serialize(writer, HintValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (!string.IsNullOrEmpty(NameValue)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); - } + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs index 442800a1a8a..9041e8363c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class SuggestUserProfilesResponse : ElasticsearchResponse +internal sealed partial class SuggestUserProfilesResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropProfiles = System.Text.Json.JsonEncodedText.Encode("profiles"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propProfiles = default; + LocalJsonValue propTook = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propProfiles.TryReadProperty(ref reader, options, PropProfiles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Profiles = propProfiles.Value, + Took = propTook.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropProfiles, value.Profiles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponseConverter))] +public sealed partial class SuggestUserProfilesResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestUserProfilesResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SuggestUserProfilesResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of profile documents, ordered by relevance, that match the search criteria. /// /// - [JsonInclude, JsonPropertyName("profiles")] - public IReadOnlyCollection Profiles { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Profiles { get; set; } /// /// /// The number of milliseconds it took Elasticsearch to run the request. /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } /// /// /// Metadata about the number of matching profiles. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Security.TotalUserProfiles Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.TotalUserProfiles Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs index 0c219cdf8c7..171929f6308 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs @@ -17,23 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateApiKeyRequestParameters : RequestParameters +public sealed partial class UpdateApiKeyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class UpdateApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptors = System.Text.Json.JsonEncodedText.Encode("role_descriptors"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiration = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRoleDescriptors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRoleDescriptors.TryReadProperty(ref reader, options, PropRoleDescriptors, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expiration = propExpiration.Value, + Metadata = propMetadata.Value, + RoleDescriptors = propRoleDescriptors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoleDescriptors, value.RoleDescriptors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Update an API key. @@ -64,20 +114,43 @@ public sealed partial class UpdateApiKeyRequestParameters : RequestParameters /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. /// /// -public sealed partial class UpdateApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestConverter))] +public sealed partial class UpdateApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public UpdateApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityUpdateApiKey; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.update_api_key"; + /// + /// + /// The ID of the API key to update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The expiration time for the API key. @@ -85,7 +158,6 @@ public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// This property can be omitted to leave the expiration unchanged. /// /// - [JsonInclude, JsonPropertyName("expiration")] public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } /// @@ -96,8 +168,7 @@ public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// When specified, this value fully replaces the metadata previously associated with the API key. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// @@ -110,8 +181,7 @@ public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// The structure of a role descriptor is the same as the request for the create API keys API. /// /// - [JsonInclude, JsonPropertyName("role_descriptors")] - public IDictionary? RoleDescriptors { get; set; } + public System.Collections.Generic.IDictionary? RoleDescriptors { get; set; } } /// @@ -144,32 +214,41 @@ public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Re /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. /// /// -public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor, UpdateApiKeyRequestParameters> +public readonly partial struct UpdateApiKeyRequestDescriptor { - internal UpdateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest Instance { get; init; } - public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(id); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateApiKeyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "security.update_api_key"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor descriptor) => descriptor.Instance; - public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The ID of the API key to update. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private IDictionary> RoleDescriptorsValue { get; set; } - /// /// /// The expiration time for the API key. @@ -177,10 +256,10 @@ public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch /// This property can be omitted to leave the expiration unchanged. /// /// - public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -191,10 +270,45 @@ public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elast /// When specified, this value fully replaces the metadata previously associated with the API key. /// /// - public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports a nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this value fully replaces the metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports a nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this value fully replaces the metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -208,34 +322,179 @@ public UpdateApiKeyRequestDescriptor Metadata(Func /// - public UpdateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors() { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(System.Action? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } + + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } - if (RoleDescriptorsValue is not null) + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -269,32 +528,41 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. /// /// -public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateApiKeyRequestDescriptor { - internal UpdateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest Instance { get; init; } - public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(id); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateApiKeyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "security.update_api_key"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor descriptor) => descriptor.Instance; - public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The ID of the API key to update. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private IDictionary RoleDescriptorsValue { get; set; } - /// /// /// The expiration time for the API key. @@ -302,10 +570,24 @@ public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// This property can be omitted to leave the expiration unchanged. /// /// - public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports a nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this value fully replaces the metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - ExpirationValue = expiration; - return Self; + Instance.Metadata = value; + return this; } /// @@ -316,10 +598,31 @@ public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Du /// When specified, this value fully replaces the metadata previously associated with the API key. /// /// - public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata() { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports a nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this value fully replaces the metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -333,33 +636,154 @@ public UpdateApiKeyRequestDescriptor Metadata(Func /// - public UpdateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(System.Collections.Generic.IDictionary? value) { - RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors() { - writer.WriteStartObject(); - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(null); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(System.Action>? action) + { + Instance.RoleDescriptors = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action); + return this; + } - if (RoleDescriptorsValue is not null) + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, value); + return this; + } + + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(string key) + { + Instance.RoleDescriptors = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// The role descriptors to assign to this API key. + /// The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. + /// You can assign new privileges by specifying them in this parameter. + /// To remove assigned privileges, you can supply an empty role_descriptors parameter, that is to say, an empty object {}. + /// If an API key has no assigned privileges, it inherits the owner user's full permissions. + /// The snapshot of the owner's permissions is always updated, whether you supply the role_descriptors parameter or not. + /// The structure of a role descriptor is the same as the request for the create API keys API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RoleDescriptors(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("role_descriptors"); - JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.RoleDescriptors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor AddRoleDescriptor(string key, System.Action>? action) + { + Instance.RoleDescriptors ??= new System.Collections.Generic.Dictionary(); + Instance.RoleDescriptors.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs index 601c40bae2e..ffb15fd2cae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateApiKeyResponse : ElasticsearchResponse +internal sealed partial class UpdateApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUpdated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Updated = propUpdated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponseConverter))] +public sealed partial class UpdateApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, the API key was updated. /// If false, the API key didn't change because no change was detected. /// /// - [JsonInclude, JsonPropertyName("updated")] - public bool Updated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Updated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyRequest.g.cs index ddb44dbad2a..9281275a1ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyRequest.g.cs @@ -17,23 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateCrossClusterApiKeyRequestParameters : RequestParameters +public sealed partial class UpdateCrossClusterApiKeyRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class UpdateCrossClusterApiKeyRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccess = System.Text.Json.JsonEncodedText.Encode("access"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccess = default; + LocalJsonValue propExpiration = default; + LocalJsonValue?> propMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccess.TryReadProperty(ref reader, options, PropAccess, null)) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Access = propAccess.Value, + Expiration = propExpiration.Value, + Metadata = propMetadata.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccess, value.Access, null, null); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Update a cross-cluster API key. @@ -61,20 +111,50 @@ public sealed partial class UpdateCrossClusterApiKeyRequestParameters : RequestP /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. /// /// -public sealed partial class UpdateCrossClusterApiKeyRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestConverter))] +public sealed partial class UpdateCrossClusterApiKeyRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateCrossClusterApiKey; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Security.Access access) : base(r => r.Required("id", id)) + { + Access = access; + } +#if NET7_0_OR_GREATER + public UpdateCrossClusterApiKeyRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityUpdateCrossClusterApiKey; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.update_cross_cluster_api_key"; + /// + /// + /// The ID of the cross-cluster API key to update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The access to be granted to this API key. @@ -83,8 +163,11 @@ public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// When specified, the new access assignment fully replaces the previously assigned access. /// /// - [JsonInclude, JsonPropertyName("access")] - public Elastic.Clients.Elasticsearch.Security.Access Access { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.Access Access { get; set; } /// /// @@ -92,7 +175,6 @@ public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// By default, API keys never expire. This property can be omitted to leave the value unchanged. /// /// - [JsonInclude, JsonPropertyName("expiration")] public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } /// @@ -103,8 +185,7 @@ public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// When specified, this information fully replaces metadata previously associated with the API key. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } } /// @@ -134,33 +215,56 @@ public UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : ba /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. /// /// -public sealed partial class UpdateCrossClusterApiKeyRequestDescriptor : RequestDescriptor, UpdateCrossClusterApiKeyRequestParameters> +public readonly partial struct UpdateCrossClusterApiKeyRequestDescriptor { - internal UpdateCrossClusterApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest Instance { get; init; } - public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateCrossClusterApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(id); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateCrossClusterApiKeyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "security.update_cross_cluster_api_key"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor descriptor) => descriptor.Instance; - public UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The ID of the cross-cluster API key to update. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.Security.Access AccessValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.AccessDescriptor AccessDescriptor { get; set; } - private Action> AccessDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross cluster search and cross cluster replication. + /// At least one of them must be specified. + /// When specified, the new access assignment fully replaces the previously assigned access. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access value) + { + Instance.Access = value; + return this; + } /// /// @@ -170,28 +274,38 @@ public UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.E /// When specified, the new access assignment fully replaces the previously assigned access. /// /// - public UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access access) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access() { - AccessDescriptor = null; - AccessDescriptorAction = null; - AccessValue = access; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(null); + return this; } - public UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross cluster search and cross cluster replication. + /// At least one of them must be specified. + /// When specified, the new access assignment fully replaces the previously assigned access. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access(System.Action? action) { - AccessValue = null; - AccessDescriptorAction = null; - AccessDescriptor = descriptor; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } - public UpdateCrossClusterApiKeyRequestDescriptor Access(Action> configure) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross cluster search and cross cluster replication. + /// At least one of them must be specified. + /// When specified, the new access assignment fully replaces the previously assigned access. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access(System.Action>? action) { - AccessValue = null; - AccessDescriptor = null; - AccessDescriptorAction = configure; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } /// @@ -200,10 +314,10 @@ public UpdateCrossClusterApiKeyRequestDescriptor Access(Action /// - public UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -214,44 +328,95 @@ public UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.C /// When specified, this information fully replaces metadata previously associated with the API key. /// /// - public UpdateCrossClusterApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this information fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata() { - writer.WriteStartObject(); - if (AccessDescriptor is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessDescriptor, options); - } - else if (AccessDescriptorAction is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(AccessDescriptorAction), options); - } - else - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessValue, options); - } + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this information fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -282,34 +447,43 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. /// /// -public sealed partial class UpdateCrossClusterApiKeyRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateCrossClusterApiKeyRequestDescriptor { - internal UpdateCrossClusterApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest Instance { get; init; } - public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateCrossClusterApiKey; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(id); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateCrossClusterApiKeyRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "security.update_cross_cluster_api_key"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor descriptor) => descriptor.Instance; - public UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The ID of the cross-cluster API key to update. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - private Elastic.Clients.Elasticsearch.Security.Access AccessValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.AccessDescriptor AccessDescriptor { get; set; } - private Action AccessDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - /// /// /// The access to be granted to this API key. @@ -318,28 +492,38 @@ public UpdateCrossClusterApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearc /// When specified, the new access assignment fully replaces the previously assigned access. /// /// - public UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access access) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.Access value) { - AccessDescriptor = null; - AccessDescriptorAction = null; - AccessValue = access; - return Self; + Instance.Access = value; + return this; } - public UpdateCrossClusterApiKeyRequestDescriptor Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross cluster search and cross cluster replication. + /// At least one of them must be specified. + /// When specified, the new access assignment fully replaces the previously assigned access. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access() { - AccessValue = null; - AccessDescriptorAction = null; - AccessDescriptor = descriptor; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(null); + return this; } - public UpdateCrossClusterApiKeyRequestDescriptor Access(Action configure) + /// + /// + /// The access to be granted to this API key. + /// The access is composed of permissions for cross cluster search and cross cluster replication. + /// At least one of them must be specified. + /// When specified, the new access assignment fully replaces the previously assigned access. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Access(System.Action>? action) { - AccessValue = null; - AccessDescriptor = null; - AccessDescriptorAction = configure; - return Self; + Instance.Access = Elastic.Clients.Elasticsearch.Security.AccessDescriptor.Build(action); + return this; } /// @@ -348,10 +532,24 @@ public UpdateCrossClusterApiKeyRequestDescriptor Access(Action /// - public UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this information fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - ExpirationValue = expiration; - return Self; + Instance.Metadata = value; + return this; } /// @@ -362,43 +560,80 @@ public UpdateCrossClusterApiKeyRequestDescriptor Expiration(Elastic.Clients.Elas /// When specified, this information fully replaces metadata previously associated with the API key. /// /// - public UpdateCrossClusterApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata() { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// When specified, this information fully replaces metadata previously associated with the API key. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Metadata(System.Action? action) { - writer.WriteStartObject(); - if (AccessDescriptor is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessDescriptor, options); - } - else if (AccessDescriptorAction is not null) - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(AccessDescriptorAction), options); - } - else - { - writer.WritePropertyName("access"); - JsonSerializer.Serialize(writer, AccessValue, options); - } + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (ExpirationValue is not null) - { - writer.WritePropertyName("expiration"); - JsonSerializer.Serialize(writer, ExpirationValue, options); - } + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyResponse.g.cs index d884f62166e..b6cbb297917 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateCrossClusterApiKeyResponse.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateCrossClusterApiKeyResponse : ElasticsearchResponse +internal sealed partial class UpdateCrossClusterApiKeyResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUpdated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Updated = propUpdated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponseConverter))] +public sealed partial class UpdateCrossClusterApiKeyResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateCrossClusterApiKeyResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateCrossClusterApiKeyResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, the API key was updated. /// If false, the API key didn’t change because no change was detected. /// /// - [JsonInclude, JsonPropertyName("updated")] - public bool Updated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Updated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsRequest.g.cs index 2564ff8cc9e..93fa32204f6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateSettingsRequestParameters : RequestParameters +public sealed partial class UpdateSettingsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,63 @@ public sealed partial class UpdateSettingsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class UpdateSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSecurity = System.Text.Json.JsonEncodedText.Encode("security"); + private static readonly System.Text.Json.JsonEncodedText PropSecurityProfile = System.Text.Json.JsonEncodedText.Encode("security-profile"); + private static readonly System.Text.Json.JsonEncodedText PropSecurityTokens = System.Text.Json.JsonEncodedText.Encode("security-tokens"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSecurity = default; + LocalJsonValue propSecurityProfile = default; + LocalJsonValue propSecurityTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSecurity.TryReadProperty(ref reader, options, PropSecurity, null)) + { + continue; + } + + if (propSecurityProfile.TryReadProperty(ref reader, options, PropSecurityProfile, null)) + { + continue; + } + + if (propSecurityTokens.TryReadProperty(ref reader, options, PropSecurityTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Security = propSecurity.Value, + SecurityProfile = propSecurityProfile.Value, + SecurityTokens = propSecurityTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSecurity, value.Security, null, null); + writer.WriteProperty(options, PropSecurityProfile, value.SecurityProfile, null, null); + writer.WriteProperty(options, PropSecurityTokens, value.SecurityTokens, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update security index settings. @@ -64,11 +114,28 @@ public sealed partial class UpdateSettingsRequestParameters : RequestParameters /// This API does not yet support configuring the settings for indices before they are in use. /// /// -public sealed partial class UpdateSettingsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestConverter))] +public sealed partial class UpdateSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateSettings; +#if NET7_0_OR_GREATER + public UpdateSettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public UpdateSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityUpdateSettings; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -80,7 +147,6 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -89,7 +155,6 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -97,7 +162,6 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("security")] public Elastic.Clients.Elasticsearch.Security.SecuritySettings? Security { get; set; } /// @@ -105,7 +169,6 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("security-profile")] public Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityProfile { get; set; } /// @@ -113,7 +176,6 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("security-tokens")] public Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityTokens { get; set; } } @@ -132,62 +194,112 @@ public sealed partial class UpdateSettingsRequest : PlainRequest /// -public sealed partial class UpdateSettingsRequestDescriptor : RequestDescriptor, UpdateSettingsRequestParameters> +public readonly partial struct UpdateSettingsRequestDescriptor { - internal UpdateSettingsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest instance) + { + Instance = instance; + } public UpdateSettingsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateSettings; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "security.update_settings"; + /// + /// + /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) + { + Instance.Security = value; + return this; + } - public UpdateSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public UpdateSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security() + { + Instance.Security = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; + } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityDescriptor { get; set; } - private Action> SecurityDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityProfileDescriptor { get; set; } - private Action> SecurityProfileDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityTokensValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityTokensDescriptor { get; set; } - private Action> SecurityTokensDescriptorAction { get; set; } + /// + /// + /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security(System.Action? action) + { + Instance.Security = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; + } /// /// /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. /// /// - public UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettings? security) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security(System.Action>? action) { - SecurityDescriptor = null; - SecurityDescriptorAction = null; - SecurityValue = security; - return Self; + Instance.Security = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - public UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used to store profile information. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) { - SecurityValue = null; - SecurityDescriptorAction = null; - SecurityDescriptor = descriptor; - return Self; + Instance.SecurityProfile = value; + return this; } - public UpdateSettingsRequestDescriptor Security(Action> configure) + /// + /// + /// Settings for the index used to store profile information. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile() { - SecurityValue = null; - SecurityDescriptor = null; - SecurityDescriptorAction = configure; - return Self; + Instance.SecurityProfile = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; } /// @@ -195,28 +307,32 @@ public UpdateSettingsRequestDescriptor Security(Action /// - public UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettings? securityProfile) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile(System.Action? action) { - SecurityProfileDescriptor = null; - SecurityProfileDescriptorAction = null; - SecurityProfileValue = securityProfile; - return Self; + Instance.SecurityProfile = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - public UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used to store profile information. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile(System.Action>? action) { - SecurityProfileValue = null; - SecurityProfileDescriptorAction = null; - SecurityProfileDescriptor = descriptor; - return Self; + Instance.SecurityProfile = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - public UpdateSettingsRequestDescriptor SecurityProfile(Action> configure) + /// + /// + /// Settings for the index used to store tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) { - SecurityProfileValue = null; - SecurityProfileDescriptor = null; - SecurityProfileDescriptorAction = configure; - return Self; + Instance.SecurityTokens = value; + return this; } /// @@ -224,82 +340,87 @@ public UpdateSettingsRequestDescriptor SecurityProfile(Action /// - public UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettings? securityTokens) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens() { - SecurityTokensDescriptor = null; - SecurityTokensDescriptorAction = null; - SecurityTokensValue = securityTokens; - return Self; + Instance.SecurityTokens = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; } - public UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used to store tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens(System.Action? action) { - SecurityTokensValue = null; - SecurityTokensDescriptorAction = null; - SecurityTokensDescriptor = descriptor; - return Self; + Instance.SecurityTokens = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - public UpdateSettingsRequestDescriptor SecurityTokens(Action> configure) + /// + /// + /// Settings for the index used to store tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens(System.Action>? action) { - SecurityTokensValue = null; - SecurityTokensDescriptor = null; - SecurityTokensDescriptorAction = configure; - return Self; + Instance.SecurityTokens = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (SecurityDescriptor is not null) - { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, SecurityDescriptor, options); - } - else if (SecurityDescriptorAction is not null) - { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityDescriptorAction), options); - } - else if (SecurityValue is not null) + if (action is null) { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, SecurityValue, options); + return new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SecurityProfileDescriptor is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, SecurityProfileDescriptor, options); - } - else if (SecurityProfileDescriptorAction is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityProfileDescriptorAction), options); - } - else if (SecurityProfileValue is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, SecurityProfileValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SecurityTokensDescriptor is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, SecurityTokensDescriptor, options); - } - else if (SecurityTokensDescriptorAction is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityTokensDescriptorAction), options); - } - else if (SecurityTokensValue is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, SecurityTokensValue, options); - } + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -318,62 +439,79 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This API does not yet support configuring the settings for indices before they are in use. /// /// -public sealed partial class UpdateSettingsRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateSettingsRequestDescriptor { - internal UpdateSettingsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest Instance { get; init; } - public UpdateSettingsRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateSettings; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; + public UpdateSettingsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "security.update_settings"; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor descriptor) => descriptor.Instance; - public UpdateSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public UpdateSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityDescriptor { get; set; } - private Action SecurityDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityProfileDescriptor { get; set; } - private Action SecurityProfileDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettings? SecurityTokensValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor SecurityTokensDescriptor { get; set; } - private Action SecurityTokensDescriptorAction { get; set; } + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. /// /// - public UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettings? security) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) { - SecurityDescriptor = null; - SecurityDescriptorAction = null; - SecurityValue = security; - return Self; + Instance.Security = value; + return this; } - public UpdateSettingsRequestDescriptor Security(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security() { - SecurityValue = null; - SecurityDescriptorAction = null; - SecurityDescriptor = descriptor; - return Self; + Instance.Security = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; } - public UpdateSettingsRequestDescriptor Security(Action configure) + /// + /// + /// Settings for the index used for most security configuration, including native realm users and roles configured with the API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Security(System.Action>? action) { - SecurityValue = null; - SecurityDescriptor = null; - SecurityDescriptorAction = configure; - return Self; + Instance.Security = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } /// @@ -381,28 +519,32 @@ public UpdateSettingsRequestDescriptor Security(Action /// - public UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettings? securityProfile) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) { - SecurityProfileDescriptor = null; - SecurityProfileDescriptorAction = null; - SecurityProfileValue = securityProfile; - return Self; + Instance.SecurityProfile = value; + return this; } - public UpdateSettingsRequestDescriptor SecurityProfile(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used to store profile information. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile() { - SecurityProfileValue = null; - SecurityProfileDescriptorAction = null; - SecurityProfileDescriptor = descriptor; - return Self; + Instance.SecurityProfile = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; } - public UpdateSettingsRequestDescriptor SecurityProfile(Action configure) + /// + /// + /// Settings for the index used to store profile information. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityProfile(System.Action>? action) { - SecurityProfileValue = null; - SecurityProfileDescriptor = null; - SecurityProfileDescriptorAction = configure; - return Self; + Instance.SecurityProfile = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } /// @@ -410,81 +552,86 @@ public UpdateSettingsRequestDescriptor SecurityProfile(Action /// - public UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettings? securityTokens) + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettings? value) { - SecurityTokensDescriptor = null; - SecurityTokensDescriptorAction = null; - SecurityTokensValue = securityTokens; - return Self; + Instance.SecurityTokens = value; + return this; } - public UpdateSettingsRequestDescriptor SecurityTokens(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) + /// + /// + /// Settings for the index used to store tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens() { - SecurityTokensValue = null; - SecurityTokensDescriptorAction = null; - SecurityTokensDescriptor = descriptor; - return Self; + Instance.SecurityTokens = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(null); + return this; } - public UpdateSettingsRequestDescriptor SecurityTokens(Action configure) + /// + /// + /// Settings for the index used to store tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SecurityTokens(System.Action>? action) { - SecurityTokensValue = null; - SecurityTokensDescriptor = null; - SecurityTokensDescriptorAction = configure; - return Self; + Instance.SecurityTokens = Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (SecurityDescriptor is not null) - { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, SecurityDescriptor, options); - } - else if (SecurityDescriptorAction is not null) - { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityDescriptorAction), options); - } - else if (SecurityValue is not null) + if (action is null) { - writer.WritePropertyName("security"); - JsonSerializer.Serialize(writer, SecurityValue, options); + return new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SecurityProfileDescriptor is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, SecurityProfileDescriptor, options); - } - else if (SecurityProfileDescriptorAction is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityProfileDescriptorAction), options); - } - else if (SecurityProfileValue is not null) - { - writer.WritePropertyName("security-profile"); - JsonSerializer.Serialize(writer, SecurityProfileValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (SecurityTokensDescriptor is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, SecurityTokensDescriptor, options); - } - else if (SecurityTokensDescriptorAction is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(SecurityTokensDescriptorAction), options); - } - else if (SecurityTokensValue is not null) - { - writer.WritePropertyName("security-tokens"); - JsonSerializer.Serialize(writer, SecurityTokensValue, options); - } + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsResponse.g.cs index 0aeb2aa7ab6..97bcf534560 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateSettingsResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateSettingsResponse : ElasticsearchResponse +internal sealed partial class UpdateSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponseConverter))] +public sealed partial class UpdateSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs index 1b23f342c53..648ac89626a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateUserProfileDataRequestParameters : RequestParameters +public sealed partial class UpdateUserProfileDataRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -57,6 +50,54 @@ public sealed partial class UpdateUserProfileDataRequestParameters : RequestPara public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } } +internal sealed partial class UpdateUserProfileDataRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propData = default; + LocalJsonValue?> propLabels = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Labels = propLabels.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Update user profile data. @@ -93,26 +134,48 @@ public sealed partial class UpdateUserProfileDataRequestParameters : RequestPara /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. /// /// -public sealed partial class UpdateUserProfileDataRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestConverter))] +public sealed partial class UpdateUserProfileDataRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", uid)) { } +#if NET7_0_OR_GREATER + public UpdateUserProfileDataRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateUserProfileDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SecurityUpdateUserProfileData; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "security.update_user_profile_data"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get => P("uid"); set => PR("uid", value); } + /// /// /// Only perform the operation if the document has this primary term. /// /// - [JsonIgnore] public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } /// @@ -120,7 +183,6 @@ public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", ui /// Only perform the operation if the document has this sequence number. /// /// - [JsonIgnore] public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } /// @@ -131,7 +193,6 @@ public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", ui /// If 'false', nothing is done with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -142,8 +203,7 @@ public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", ui /// The data object is not searchable, but can be retrieved with the get user profile API. /// /// - [JsonInclude, JsonPropertyName("data")] - public IDictionary? Data { get; set; } + public System.Collections.Generic.IDictionary? Data { get; set; } /// /// @@ -152,8 +212,7 @@ public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", ui /// Within the labels object, top-level keys cannot begin with an underscore (_) or contain a period (.). /// /// - [JsonInclude, JsonPropertyName("labels")] - public IDictionary? Labels { get; set; } + public System.Collections.Generic.IDictionary? Labels { get; set; } } /// @@ -192,34 +251,104 @@ public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", ui /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. /// /// -public sealed partial class UpdateUserProfileDataRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateUserProfileDataRequestDescriptor { - internal UpdateUserProfileDataRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest Instance { get; init; } - public UpdateUserProfileDataRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateUserProfileDataRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + public UpdateUserProfileDataRequestDescriptor(string uid) + { + Instance = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest(uid); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateUserProfileDataRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest instance) => new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "security.update_user_profile_data"; + /// + /// + /// A unique identifier for the user profile. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Uid(string value) + { + Instance.Uid = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor IfSeqNo(long? value) + { + Instance.IfSeqNo = value; + return this; + } - public UpdateUserProfileDataRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); - public UpdateUserProfileDataRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); - public UpdateUserProfileDataRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search. + /// If 'wait_for', it waits for a refresh to make this operation visible to search. + /// If 'false', nothing is done with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - public UpdateUserProfileDataRequestDescriptor Uid(string uid) + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// Within the data object, top-level keys cannot begin with an underscore (_) or contain a period (.). + /// The data object is not searchable, but can be retrieved with the get user profile API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Data(System.Collections.Generic.IDictionary? value) { - RouteValues.Required("uid", uid); - return Self; + Instance.Data = value; + return this; } - private IDictionary? DataValue { get; set; } - private IDictionary? LabelsValue { get; set; } + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// Within the data object, top-level keys cannot begin with an underscore (_) or contain a period (.). + /// The data object is not searchable, but can be retrieved with the get user profile API. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Data() + { + Instance.Data = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } /// /// @@ -229,10 +358,17 @@ public UpdateUserProfileDataRequestDescriptor Uid(string uid) /// The data object is not searchable, but can be retrieved with the get user profile API. /// /// - public UpdateUserProfileDataRequestDescriptor Data(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Data(System.Action? action) { - DataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Data = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor AddDatum(string key, object value) + { + Instance.Data ??= new System.Collections.Generic.Dictionary(); + Instance.Data.Add(key, value); + return this; } /// @@ -242,27 +378,92 @@ public UpdateUserProfileDataRequestDescriptor Data(Func_) or contain a period (.). /// /// - public UpdateUserProfileDataRequestDescriptor Labels(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Labels(System.Collections.Generic.IDictionary? value) { - LabelsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Labels = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// Within the labels object, top-level keys cannot begin with an underscore (_) or contain a period (.). + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Labels() { - writer.WriteStartObject(); - if (DataValue is not null) - { - writer.WritePropertyName("data"); - JsonSerializer.Serialize(writer, DataValue, options); - } + Instance.Labels = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (LabelsValue is not null) - { - writer.WritePropertyName("labels"); - JsonSerializer.Serialize(writer, LabelsValue, options); - } + /// + /// + /// Searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// Within the labels object, top-level keys cannot begin with an underscore (_) or contain a period (.). + /// + /// + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Labels(System.Action? action) + { + Instance.Labels = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor AddLabel(string key, object value) + { + Instance.Labels ??= new System.Collections.Generic.Dictionary(); + Instance.Labels.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs index 1d47f41e31d..3e1262969e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class UpdateUserProfileDataResponse : ElasticsearchResponse +internal sealed partial class UpdateUserProfileDataResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponseConverter))] +public sealed partial class UpdateUserProfileDataResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateUserProfileDataResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateUserProfileDataResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestRequest.g.cs index 6f70593e752..06a55cf1ada 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Simulate; -public sealed partial class IngestRequestParameters : RequestParameters +public sealed partial class IngestRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,81 @@ public sealed partial class IngestRequestParameters : RequestParameters public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } } +internal sealed partial class IngestRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropComponentTemplateSubstitutions = System.Text.Json.JsonEncodedText.Encode("component_template_substitutions"); + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTemplateSubstitutions = System.Text.Json.JsonEncodedText.Encode("index_template_substitutions"); + private static readonly System.Text.Json.JsonEncodedText PropMappingAddition = System.Text.Json.JsonEncodedText.Encode("mapping_addition"); + private static readonly System.Text.Json.JsonEncodedText PropPipelineSubstitutions = System.Text.Json.JsonEncodedText.Encode("pipeline_substitutions"); + + public override Elastic.Clients.Elasticsearch.Simulate.IngestRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propComponentTemplateSubstitutions = default; + LocalJsonValue> propDocs = default; + LocalJsonValue?> propIndexTemplateSubstitutions = default; + LocalJsonValue propMappingAddition = default; + LocalJsonValue?> propPipelineSubstitutions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComponentTemplateSubstitutions.TryReadProperty(ref reader, options, PropComponentTemplateSubstitutions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndexTemplateSubstitutions.TryReadProperty(ref reader, options, PropIndexTemplateSubstitutions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMappingAddition.TryReadProperty(ref reader, options, PropMappingAddition, null)) + { + continue; + } + + if (propPipelineSubstitutions.TryReadProperty(ref reader, options, PropPipelineSubstitutions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ComponentTemplateSubstitutions = propComponentTemplateSubstitutions.Value, + Docs = propDocs.Value, + IndexTemplateSubstitutions = propIndexTemplateSubstitutions.Value, + MappingAddition = propMappingAddition.Value, + PipelineSubstitutions = propPipelineSubstitutions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Simulate.IngestRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComponentTemplateSubstitutions, value.ComponentTemplateSubstitutions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndexTemplateSubstitutions, value.IndexTemplateSubstitutions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMappingAddition, value.MappingAddition, null, null); + writer.WriteProperty(options, PropPipelineSubstitutions, value.PipelineSubstitutions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Simulate data ingestion. @@ -66,31 +134,66 @@ public sealed partial class IngestRequestParameters : RequestParameters /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. /// /// -public sealed partial class IngestRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Simulate.IngestRequestConverter))] +public sealed partial class IngestRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public IngestRequest() + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) { } - public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index, System.Collections.Generic.ICollection docs) : base(r => r.Optional("index", index)) { + Docs = docs; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SimulateIngest; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestRequest(System.Collections.Generic.ICollection docs) + { + Docs = docs; + } +#if NET7_0_OR_GREATER + public IngestRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IngestRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IngestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SimulateIngest; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "simulate.ingest"; + /// + /// + /// The index to simulate ingesting into. + /// This value can be overridden by specifying an index on each document. + /// If you specify this parameter in the request path, it is used for any documents that do not explicitly specify an index argument. + /// + /// + public Elastic.Clients.Elasticsearch.IndexName? Index { get => P("index"); set => PO("index", value); } + /// /// /// The pipeline to use as the default pipeline. /// This value can be used to override the default pipeline of the index. /// /// - [JsonIgnore] public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } /// @@ -98,25 +201,25 @@ public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => /// A map of component template names to substitute component template definition objects. /// /// - [JsonInclude, JsonPropertyName("component_template_substitutions")] - public IDictionary? ComponentTemplateSubstitutions { get; set; } + public System.Collections.Generic.IDictionary? ComponentTemplateSubstitutions { get; set; } /// /// /// Sample documents to test in the pipeline. /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection Docs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Docs { get; set; } /// /// /// A map of index template names to substitute index template definition objects. /// /// - [JsonInclude, JsonPropertyName("index_template_substitutions")] - public IDictionary? IndexTemplateSubstitutions { get; set; } - [JsonInclude, JsonPropertyName("mapping_addition")] + public System.Collections.Generic.IDictionary? IndexTemplateSubstitutions { get; set; } public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingAddition { get; set; } /// @@ -126,8 +229,7 @@ public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => /// If you specify both this and the request path parameter, the API only uses the request path parameter. /// /// - [JsonInclude, JsonPropertyName("pipeline_substitutions")] - public IDictionary? PipelineSubstitutions { get; set; } + public System.Collections.Generic.IDictionary? PipelineSubstitutions { get; set; } } /// @@ -155,54 +257,130 @@ public IngestRequest(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. /// /// -public sealed partial class IngestRequestDescriptor : RequestDescriptor, IngestRequestParameters> +public readonly partial struct IngestRequestDescriptor { - internal IngestRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Simulate.IngestRequest Instance { get; init; } - public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.Simulate.IngestRequest instance) { + Instance = instance; } - public IngestRequestDescriptor() : this(typeof(TDocument)) + public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(index); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.SimulateIngest; + public IngestRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(Elastic.Clients.Elasticsearch.Simulate.IngestRequest instance) => new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The index to simulate ingesting into. + /// This value can be overridden by specifying an index on each document. + /// If you specify this parameter in the request path, it is used for any documents that do not explicitly specify an index argument. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override string OperationName => "simulate.ingest"; + /// + /// + /// The pipeline to use as the default pipeline. + /// This value can be used to override the default pipeline of the index. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Pipeline(string? value) + { + Instance.Pipeline = value; + return this; + } - public IngestRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions(System.Collections.Generic.IDictionary? value) + { + Instance.ComponentTemplateSubstitutions = value; + return this; + } - public IngestRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions() { - RouteValues.Optional("index", index); - return Self; + Instance.ComponentTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode.Build(null); + return this; } - private IDictionary> ComponentTemplateSubstitutionsValue { get; set; } - private ICollection DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private IDictionary> IndexTemplateSubstitutionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingAdditionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingAdditionDescriptor { get; set; } - private Action> MappingAdditionDescriptorAction { get; set; } - private IDictionary> PipelineSubstitutionsValue { get; set; } + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions(System.Action? action) + { + Instance.ComponentTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode.Build(action); + return this; + } /// /// /// A map of component template names to substitute component template definition objects. /// /// - public IngestRequestDescriptor ComponentTemplateSubstitutions(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions(System.Action>? action) + { + Instance.ComponentTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddComponentTemplateSubstitution(string key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode value) + { + Instance.ComponentTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.ComponentTemplateSubstitutions.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddComponentTemplateSubstitution(string key, System.Action action) + { + Instance.ComponentTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.ComponentTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddComponentTemplateSubstitution(string key, System.Action> action) + { + Instance.ComponentTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.ComponentTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } + + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(System.Collections.Generic.ICollection value) { - ComponentTemplateSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Docs = value; + return this; } /// @@ -210,40 +388,49 @@ public IngestRequestDescriptor ComponentTemplateSubstitutions(Func /// - public IngestRequestDescriptor Docs(ICollection docs) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Ingest.Document[] values) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Docs = [.. values]; + return this; } - public IngestRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor descriptor) + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(params System.Action[] actions) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - public IngestRequestDescriptor Docs(Action configure) + /// + /// + /// A map of index template names to substitute index template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions(System.Collections.Generic.IDictionary? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.IndexTemplateSubstitutions = value; + return this; } - public IngestRequestDescriptor Docs(params Action[] configure) + /// + /// + /// A map of index template names to substitute index template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions() { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.IndexTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate.Build(null); + return this; } /// @@ -251,34 +438,66 @@ public IngestRequestDescriptor Docs(params Action /// - public IngestRequestDescriptor IndexTemplateSubstitutions(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions(System.Action? action) { - IndexTemplateSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.IndexTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate.Build(action); + return this; } - public IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappingAddition) + /// + /// + /// A map of index template names to substitute index template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions(System.Action>? action) { - MappingAdditionDescriptor = null; - MappingAdditionDescriptorAction = null; - MappingAdditionValue = mappingAddition; - return Self; + Instance.IndexTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate.Build(action); + return this; } - public IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddIndexTemplateSubstitution(string key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate value) { - MappingAdditionValue = null; - MappingAdditionDescriptorAction = null; - MappingAdditionDescriptor = descriptor; - return Self; + Instance.IndexTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.IndexTemplateSubstitutions.Add(key, value); + return this; } - public IngestRequestDescriptor MappingAddition(Action> configure) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddIndexTemplateSubstitution(string key, System.Action action) { - MappingAdditionValue = null; - MappingAdditionDescriptor = null; - MappingAdditionDescriptorAction = configure; - return Self; + Instance.IndexTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.IndexTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddIndexTemplateSubstitution(string key, System.Action> action) + { + Instance.IndexTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.IndexTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.MappingAddition = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition() + { + Instance.MappingAddition = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition(System.Action? action) + { + Instance.MappingAddition = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition(System.Action>? action) + { + Instance.MappingAddition = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -288,81 +507,159 @@ public IngestRequestDescriptor MappingAddition(Action /// - public IngestRequestDescriptor PipelineSubstitutions(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(System.Collections.Generic.IDictionary? value) { - PipelineSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.PipelineSubstitutions = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions() { - writer.WriteStartObject(); - if (ComponentTemplateSubstitutionsValue is not null) - { - writer.WritePropertyName("component_template_substitutions"); - JsonSerializer.Serialize(writer, ComponentTemplateSubstitutionsValue, options); - } + Instance.PipelineSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline.Build(null); + return this; + } - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(action), options); - } + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(System.Action? action) + { + Instance.PipelineSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline.Build(action); + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - } + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(System.Action>? action) + { + Instance.PipelineSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline.Build(action); + return this; + } - if (IndexTemplateSubstitutionsValue is not null) - { - writer.WritePropertyName("index_template_substitutions"); - JsonSerializer.Serialize(writer, IndexTemplateSubstitutionsValue, options); - } + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key, Elastic.Clients.Elasticsearch.Ingest.Pipeline value) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, value); + return this; + } - if (MappingAdditionDescriptor is not null) - { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, MappingAdditionDescriptor, options); - } - else if (MappingAdditionDescriptorAction is not null) - { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingAdditionDescriptorAction), options); - } - else if (MappingAdditionValue is not null) - { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, MappingAdditionValue, options); - } + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(string key) + { + Instance.PipelineSubstitutions = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null) } }; + return this; + } - if (PipelineSubstitutionsValue is not null) + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("pipeline_substitutions"); - JsonSerializer.Serialize(writer, PipelineSubstitutionsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.PipelineSubstitutions = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key, System.Action? action) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key, System.Action>? action) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Simulate.IngestRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -391,54 +688,114 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. /// /// -public sealed partial class IngestRequestDescriptor : RequestDescriptor +public readonly partial struct IngestRequestDescriptor { - internal IngestRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Simulate.IngestRequest Instance { get; init; } - public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) : base(r => r.Optional("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.Simulate.IngestRequest instance) { + Instance = instance; + } + + public IngestRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName? index) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(index); +#pragma warning restore CS0618 } public IngestRequestDescriptor() { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(typeof(TDocument)); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.SimulateIngest; + public static explicit operator Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(Elastic.Clients.Elasticsearch.Simulate.IngestRequest instance) => new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The index to simulate ingesting into. + /// This value can be overridden by specifying an index on each document. + /// If you specify this parameter in the request path, it is used for any documents that do not explicitly specify an index argument. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// The pipeline to use as the default pipeline. + /// This value can be used to override the default pipeline of the index. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Pipeline(string? value) + { + Instance.Pipeline = value; + return this; + } - internal override string OperationName => "simulate.ingest"; + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions(System.Collections.Generic.IDictionary? value) + { + Instance.ComponentTemplateSubstitutions = value; + return this; + } + + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions() + { + Instance.ComponentTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode.Build(null); + return this; + } - public IngestRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); + /// + /// + /// A map of component template names to substitute component template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ComponentTemplateSubstitutions(System.Action>? action) + { + Instance.ComponentTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode.Build(action); + return this; + } - public IngestRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddComponentTemplateSubstitution(string key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode value) { - RouteValues.Optional("index", index); - return Self; + Instance.ComponentTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.ComponentTemplateSubstitutions.Add(key, value); + return this; } - private IDictionary ComponentTemplateSubstitutionsValue { get; set; } - private ICollection DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private IDictionary IndexTemplateSubstitutionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingAdditionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingAdditionDescriptor { get; set; } - private Action MappingAdditionDescriptorAction { get; set; } - private IDictionary PipelineSubstitutionsValue { get; set; } + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddComponentTemplateSubstitution(string key, System.Action> action) + { + Instance.ComponentTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.ComponentTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } /// /// - /// A map of component template names to substitute component template definition objects. + /// Sample documents to test in the pipeline. /// /// - public IngestRequestDescriptor ComponentTemplateSubstitutions(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(System.Collections.Generic.ICollection value) { - ComponentTemplateSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Docs = value; + return this; } /// @@ -446,40 +803,49 @@ public IngestRequestDescriptor ComponentTemplateSubstitutions(Func /// - public IngestRequestDescriptor Docs(ICollection docs) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(params Elastic.Clients.Elasticsearch.Ingest.Document[] values) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Docs = [.. values]; + return this; } - public IngestRequestDescriptor Docs(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor descriptor) + /// + /// + /// Sample documents to test in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Docs(params System.Action[] actions) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - public IngestRequestDescriptor Docs(Action configure) + /// + /// + /// A map of index template names to substitute index template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions(System.Collections.Generic.IDictionary? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + Instance.IndexTemplateSubstitutions = value; + return this; } - public IngestRequestDescriptor Docs(params Action[] configure) + /// + /// + /// A map of index template names to substitute index template definition objects. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions() { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.IndexTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate.Build(null); + return this; } /// @@ -487,34 +853,42 @@ public IngestRequestDescriptor Docs(params Action /// - public IngestRequestDescriptor IndexTemplateSubstitutions(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor IndexTemplateSubstitutions(System.Action>? action) + { + Instance.IndexTemplateSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddIndexTemplateSubstitution(string key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate value) + { + Instance.IndexTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.IndexTemplateSubstitutions.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddIndexTemplateSubstitution(string key, System.Action> action) { - IndexTemplateSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.IndexTemplateSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.IndexTemplateSubstitutions.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; } - public IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappingAddition) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingAdditionDescriptor = null; - MappingAdditionDescriptorAction = null; - MappingAdditionValue = mappingAddition; - return Self; + Instance.MappingAddition = value; + return this; } - public IngestRequestDescriptor MappingAddition(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition() { - MappingAdditionValue = null; - MappingAdditionDescriptorAction = null; - MappingAdditionDescriptor = descriptor; - return Self; + Instance.MappingAddition = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IngestRequestDescriptor MappingAddition(Action configure) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor MappingAddition(System.Action>? action) { - MappingAdditionValue = null; - MappingAdditionDescriptor = null; - MappingAdditionDescriptorAction = configure; - return Self; + Instance.MappingAddition = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -524,80 +898,138 @@ public IngestRequestDescriptor MappingAddition(Action /// - public IngestRequestDescriptor PipelineSubstitutions(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(System.Collections.Generic.IDictionary? value) { - PipelineSubstitutionsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.PipelineSubstitutions = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions() { - writer.WriteStartObject(); - if (ComponentTemplateSubstitutionsValue is not null) - { - writer.WritePropertyName("component_template_substitutions"); - JsonSerializer.Serialize(writer, ComponentTemplateSubstitutionsValue, options); - } + Instance.PipelineSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline.Build(null); + return this; + } - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(action), options); - } + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(System.Action>? action) + { + Instance.PipelineSubstitutions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline.Build(action); + return this; + } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - } + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key, Elastic.Clients.Elasticsearch.Ingest.Pipeline value) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, value); + return this; + } - if (IndexTemplateSubstitutionsValue is not null) - { - writer.WritePropertyName("index_template_substitutions"); - JsonSerializer.Serialize(writer, IndexTemplateSubstitutionsValue, options); - } + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(string key) + { + Instance.PipelineSubstitutions = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null) } }; + return this; + } - if (MappingAdditionDescriptor is not null) - { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, MappingAdditionDescriptor, options); - } - else if (MappingAdditionDescriptorAction is not null) - { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingAdditionDescriptorAction), options); - } - else if (MappingAdditionValue is not null) + /// + /// + /// Pipelines to test. + /// If you don’t specify the pipeline request path parameter, this parameter is required. + /// If you specify both this and the request path parameter, the API only uses the request path parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor PipelineSubstitutions(params string[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("mapping_addition"); - JsonSerializer.Serialize(writer, MappingAdditionValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); } - if (PipelineSubstitutionsValue is not null) - { - writer.WritePropertyName("pipeline_substitutions"); - JsonSerializer.Serialize(writer, PipelineSubstitutionsValue, options); - } + Instance.PipelineSubstitutions = items; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor AddPipelineSubstitution(string key, System.Action>? action) + { + Instance.PipelineSubstitutions ??= new System.Collections.Generic.Dictionary(); + Instance.PipelineSubstitutions.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Simulate.IngestRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(new Elastic.Clients.Elasticsearch.Simulate.IngestRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestResponse.g.cs index dbf42007b2a..771544287aa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Simulate/IngestResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Simulate; -public sealed partial class IngestResponse : ElasticsearchResponse +internal sealed partial class IngestResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("docs")] - public IReadOnlyCollection Docs { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + + public override Elastic.Clients.Elasticsearch.Simulate.IngestResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Simulate.IngestResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Simulate.IngestResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Simulate.IngestResponseConverter))] +public sealed partial class IngestResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IngestResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Docs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryRequest.g.cs index 3f7be7b5baa..f0d61779324 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryRequest.g.cs @@ -17,51 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CleanupRepositoryRequestParameters : RequestParameters +public sealed partial class CleanupRepositoryRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Period to wait for a connection to the master node. + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1 /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Period to wait for a response. + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class CleanupRepositoryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Clean up the snapshot repository. /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. /// /// -public sealed partial class CleanupRepositoryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestConverter))] +public sealed partial class CleanupRepositoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) { } +#if NET7_0_OR_GREATER + public CleanupRepositoryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCleanupRepository; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotCleanupRepository; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -69,18 +107,31 @@ public CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// /// - /// Period to wait for a connection to the master node. + /// The name of the snapshot repository to clean up. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1 /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Period to wait for a response. + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -90,32 +141,114 @@ public CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. /// /// -public sealed partial class CleanupRepositoryRequestDescriptor : RequestDescriptor +public readonly partial struct CleanupRepositoryRequestDescriptor { - internal CleanupRepositoryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest Instance { get; init; } - public CleanupRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CleanupRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCleanupRepository; + public CleanupRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CleanupRepositoryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.cleanup_repository"; + /// + /// + /// The name of the snapshot repository to clean up. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public CleanupRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CleanupRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for a connection to the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1 + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CleanupRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryResponse.g.cs index 7a5a0dd0e26..832a07dbe99 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CleanupRepositoryResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CleanupRepositoryResponse : ElasticsearchResponse +internal sealed partial class CleanupRepositoryResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropResults = System.Text.Json.JsonEncodedText.Encode("results"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResults.TryReadProperty(ref reader, options, PropResults, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Results = propResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResults, value.Results, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponseConverter))] +public sealed partial class CleanupRepositoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CleanupRepositoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CleanupRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Statistics for cleanup operations. /// /// - [JsonInclude, JsonPropertyName("results")] - public Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResults Results { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResults Results { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotRequest.g.cs index 69c10ac78c7..a233ae0251c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotRequest.g.cs @@ -17,28 +17,61 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CloneSnapshotRequestParameters : RequestParameters +public sealed partial class CloneSnapshotRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class CloneSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteEndObject(); + } } /// @@ -47,15 +80,34 @@ public sealed partial class CloneSnapshotRequestParameters : RequestParameters /// Clone part of all of a snapshot into another snapshot in the same repository. /// /// -public sealed partial class CloneSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestConverter))] +public sealed partial class CloneSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot).Required("target_snapshot", targetSnapshot)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotClone; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, string indices) : base(r => r.Required("repository", repository).Required("snapshot", snapshot).Required("target_snapshot", targetSnapshot)) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public CloneSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotClone; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -63,15 +115,57 @@ public CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elast /// /// - /// Explicit operation timeout for connection to master node + /// The name of the snapshot repository that both source and target snapshot belong to. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The source snapshot name. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + + /// + /// + /// The target snapshot name. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name TargetSnapshot { get => P("target_snapshot"); set => PR("target_snapshot", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } - [JsonInclude, JsonPropertyName("indices")] - public string Indices { get; set; } + + /// + /// + /// A comma-separated list of indices to include in the snapshot. + /// Multi-target syntax is supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Indices { get; set; } } /// @@ -80,56 +174,137 @@ public CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elast /// Clone part of all of a snapshot into another snapshot in the same repository. /// /// -public sealed partial class CloneSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct CloneSnapshotRequestDescriptor { - internal CloneSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest instance) + { + Instance = instance; + } - public CloneSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot).Required("target_snapshot", targetSnapshot)) + public CloneSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest(repository, snapshot, targetSnapshot); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotClone; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CloneSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// The name of the snapshot repository that both source and target snapshot belong to. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } - internal override string OperationName => "snapshot.clone"; + /// + /// + /// The source snapshot name. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Snapshot = value; + return this; + } + + /// + /// + /// The target snapshot name. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor TargetSnapshot(Elastic.Clients.Elasticsearch.Name value) + { + Instance.TargetSnapshot = value; + return this; + } - public CloneSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CloneSnapshotRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public CloneSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + /// + /// + /// A comma-separated list of indices to include in the snapshot. + /// Multi-target syntax is supported. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor Indices(string value) { - RouteValues.Required("repository", repository); - return Self; + Instance.Indices = value; + return this; } - public CloneSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest Build(System.Action action) { - RouteValues.Required("snapshot", snapshot); - return Self; + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public CloneSnapshotRequestDescriptor TargetSnapshot(Elastic.Clients.Elasticsearch.Name targetSnapshot) + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Required("target_snapshot", targetSnapshot); - return Self; + Instance.ErrorTrace = value; + return this; } - private string IndicesValue { get; set; } + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public CloneSnapshotRequestDescriptor Indices(string indices) + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor Human(bool? value) { - IndicesValue = indices; - return Self; + Instance.Human = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor Pretty(bool? value) { - writer.WriteStartObject(); - writer.WritePropertyName("indices"); - writer.WriteStringValue(IndicesValue); - writer.WriteEndObject(); + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotResponse.g.cs index 28a6abe2a04..4a82edf220d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CloneSnapshotResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CloneSnapshotResponse : ElasticsearchResponse +internal sealed partial class CloneSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponseConverter))] +public sealed partial class CloneSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloneSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloneSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryRequest.g.cs index bba5de0492f..d6c38ee0690 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryRequest.g.cs @@ -17,43 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CreateRepositoryRequestParameters : RequestParameters +public sealed partial class CreateRepositoryRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// /// - /// Whether to verify the repository after creation + /// If true, the request verifies the repository is functional on all master and data nodes in the cluster. + /// If false, this verification is skipped. + /// You can also perform this verification with the verify snapshot repository API. /// /// public bool? Verify { get => Q("verify"); set => Q("verify", value); } } +internal sealed partial class CreateRepositoryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Repository = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Repository, null); + } +} + /// /// /// Create or update a snapshot repository. @@ -61,16 +73,39 @@ public sealed partial class CreateRepositoryRequestParameters : RequestParameter /// To register a snapshot repository, the cluster's global metadata must be writeable. /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. /// +/// +/// Several options for this API can be specified using a query parameter or a request body parameter. +/// If both parameters are specified, only the query parameter is used. +/// /// -public sealed partial class CreateRepositoryRequest : PlainRequest, ISelfSerializable +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestConverter))] +public sealed partial class CreateRepositoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCreateRepository; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Name name, Elastic.Clients.Elasticsearch.Snapshot.IRepository repository) : base(r => r.Required("repository", name)) + { + Repository = repository; + } +#if NET7_0_OR_GREATER + public CreateRepositoryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotCreateRepository; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -78,34 +113,46 @@ public CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// /// - /// Explicit operation timeout for connection to master node + /// The name of the snapshot repository to register or update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// /// - /// Whether to verify the repository after creation + /// If true, the request verifies the repository is functional on all master and data nodes in the cluster. + /// If false, this verification is skipped. + /// You can also perform this verification with the verify snapshot repository API. /// /// - [JsonIgnore] public bool? Verify { get => Q("verify"); set => Q("verify", value); } - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Snapshot.IRepository Repository { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, Repository, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.IRepository Repository { get; set; } } /// @@ -115,40 +162,146 @@ void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions op /// To register a snapshot repository, the cluster's global metadata must be writeable. /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. /// +/// +/// Several options for this API can be specified using a query parameter or a request body parameter. +/// If both parameters are specified, only the query parameter is used. +/// /// -public sealed partial class CreateRepositoryRequestDescriptor : RequestDescriptor +public readonly partial struct CreateRepositoryRequestDescriptor { - internal CreateRepositoryRequestDescriptor(Action configure) => configure.Invoke(this); - public CreateRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) => RepositoryValue = repository; + internal Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest Instance { get; init; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCreateRepository; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest instance) + { + Instance = instance; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public CreateRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest(name); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateRepositoryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "snapshot.create_repository"; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the snapshot repository to register or update. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, the request verifies the repository is functional on all master and data nodes in the cluster. + /// If false, this verification is skipped. + /// You can also perform this verification with the verify snapshot repository API. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Verify(bool? value = true) + { + Instance.Verify = value; + return this; + } - public CreateRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CreateRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public CreateRepositoryRequestDescriptor Verify(bool? verify = true) => Qs("verify", verify); + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Snapshot.IRepository value) + { + Instance.Repository = value; + return this; + } - public CreateRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Repository(System.Func action) { - RouteValues.Required("repository", name); - return Self; + Instance.Repository = Elastic.Clients.Elasticsearch.Snapshot.RepositoryFactory.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.Snapshot.IRepository RepositoryValue { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CreateRepositoryRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository) + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RepositoryValue = repository; - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { - JsonSerializer.Serialize(writer, RepositoryValue, options); + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryResponse.g.cs index cfe979a738f..81832fea679 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateRepositoryResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CreateRepositoryResponse : ElasticsearchResponse +internal sealed partial class CreateRepositoryResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponseConverter))] +public sealed partial class CreateRepositoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateRepositoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotRequest.g.cs index 974b6350300..ccd1c8aa349 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotRequest.g.cs @@ -17,51 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CreateSnapshotRequestParameters : RequestParameters +public sealed partial class CreateSnapshotRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// If true, the request returns a response when the snapshot is complete. If false, the request returns a response when the snapshot initializes. + /// If true, the request returns a response when the snapshot is complete. + /// If false, the request returns a response when the snapshot initializes. /// /// public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class CreateSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpandWildcards = System.Text.Json.JsonEncodedText.Encode("expand_wildcards"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureStates = System.Text.Json.JsonEncodedText.Encode("feature_states"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnavailable = System.Text.Json.JsonEncodedText.Encode("ignore_unavailable"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeGlobalState = System.Text.Json.JsonEncodedText.Encode("include_global_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropPartial = System.Text.Json.JsonEncodedText.Encode("partial"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propExpandWildcards = default; + LocalJsonValue?> propFeatureStates = default; + LocalJsonValue propIgnoreUnavailable = default; + LocalJsonValue propIncludeGlobalState = default; + LocalJsonValue propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propPartial = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpandWildcards.TryReadProperty(ref reader, options, PropExpandWildcards, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propFeatureStates.TryReadProperty(ref reader, options, PropFeatureStates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreUnavailable.TryReadProperty(ref reader, options, PropIgnoreUnavailable, null)) + { + continue; + } + + if (propIncludeGlobalState.TryReadProperty(ref reader, options, PropIncludeGlobalState, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPartial.TryReadProperty(ref reader, options, PropPartial, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpandWildcards = propExpandWildcards.Value, + FeatureStates = propFeatureStates.Value, + IgnoreUnavailable = propIgnoreUnavailable.Value, + IncludeGlobalState = propIncludeGlobalState.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + Partial = propPartial.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpandWildcards, value.ExpandWildcards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureStates, value.FeatureStates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreUnavailable, value.IgnoreUnavailable, null, null); + writer.WriteProperty(options, PropIncludeGlobalState, value.IncludeGlobalState, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPartial, value.Partial, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create a snapshot. /// Take a snapshot of a cluster or of data streams and indices. /// /// -public sealed partial class CreateSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestConverter))] +public sealed partial class CreateSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } +#if NET7_0_OR_GREATER + public CreateSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCreate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotCreate; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; @@ -69,66 +169,119 @@ public CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elas /// /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// The name of the repository for the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The name of the snapshot. + /// It supportes date math. + /// It must be unique in the repository. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// If true, the request returns a response when the snapshot is complete. If false, the request returns a response when the snapshot initializes. + /// If true, the request returns a response when the snapshot is complete. + /// If false, the request returns a response when the snapshot initializes. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// /// - /// Feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If include_global_state is true, all current feature states are included by default. If include_global_state is false, no feature states are included by default. + /// Determines how wildcard patterns in the indices parameter match data streams and indices. + /// It supports comma-separated values such as open,hidden. + /// + /// + public System.Collections.Generic.ICollection? ExpandWildcards { get; set; } + + /// + /// + /// The feature states to include in the snapshot. + /// Each feature state includes one or more system indices containing related data. + /// You can view a list of eligible features using the get features API. + /// + /// + /// If include_global_state is true, all current feature states are included by default. + /// If include_global_state is false, no feature states are included by default. + /// + /// + /// Note that specifying an empty array will result in the default behavior. + /// To exclude all feature states, regardless of the include_global_state value, specify an array with only the value none (["none"]). /// /// - [JsonInclude, JsonPropertyName("feature_states")] - public ICollection? FeatureStates { get; set; } + public System.Collections.Generic.ICollection? FeatureStates { get; set; } /// /// - /// If true, the request ignores data streams and indices in indices that are missing or closed. If false, the request returns an error for any data stream or index that is missing or closed. + /// If true, the request ignores data streams and indices in indices that are missing or closed. + /// If false, the request returns an error for any data stream or index that is missing or closed. /// /// - [JsonInclude, JsonPropertyName("ignore_unavailable")] public bool? IgnoreUnavailable { get; set; } /// /// - /// If true, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via feature_states). + /// If true, the current cluster state is included in the snapshot. + /// The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. + /// It also includes data stored in system indices, such as Watches and task records (configurable via feature_states). /// /// - [JsonInclude, JsonPropertyName("include_global_state")] public bool? IncludeGlobalState { get; set; } /// /// - /// Data streams and indices to include in the snapshot. Supports multi-target syntax. Includes all data streams and indices by default. + /// A comma-separated list of data streams and indices to include in the snapshot. + /// It supports a multi-target syntax. + /// The default is an empty array ([]), which includes all regular data streams and regular indices. + /// To exclude all data streams and indices, use -*. + /// + /// + /// You can't use this parameter to include or exclude system indices or system data streams from a snapshot. + /// Use feature_states instead. /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// /// - /// Optional metadata for the snapshot. May have any contents. Must be less than 1024 bytes. This map is not automatically generated by Elasticsearch. + /// Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. + /// It can have any contents but it must be less than 1024 bytes. + /// This information is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// - /// If true, allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// If true, it enables you to restore a partial snapshot of indices with unavailable shards. + /// Only shards that were successfully included in the snapshot will be restored. + /// All missing shards will be recreated as empty. + /// + /// + /// If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. /// /// - [JsonInclude, JsonPropertyName("partial")] public bool? Partial { get; set; } } @@ -138,149 +291,296 @@ public CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elas /// Take a snapshot of a cluster or of data streams and indices. /// /// -public sealed partial class CreateSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct CreateSnapshotRequestDescriptor { - internal CreateSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest Instance { get; init; } - public CreateSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotCreate; + public CreateSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest(repository, snapshot); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public CreateSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.create"; + /// + /// + /// The name of the repository for the snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } - public CreateSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public CreateSnapshotRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The name of the snapshot. + /// It supportes date math. + /// It must be unique in the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Snapshot = value; + return this; + } - public CreateSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("repository", repository); - return Self; + Instance.MasterTimeout = value; + return this; } - public CreateSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + /// + /// + /// If true, the request returns a response when the snapshot is complete. + /// If false, the request returns a response when the snapshot initializes. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor WaitForCompletion(bool? value = true) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.WaitForCompletion = value; + return this; } - private ICollection? FeatureStatesValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } - private bool? IncludeGlobalStateValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private bool? PartialValue { get; set; } + /// + /// + /// Determines how wildcard patterns in the indices parameter match data streams and indices. + /// It supports comma-separated values such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } /// /// - /// Feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If include_global_state is true, all current feature states are included by default. If include_global_state is false, no feature states are included by default. + /// Determines how wildcard patterns in the indices parameter match data streams and indices. + /// It supports comma-separated values such as open,hidden. /// /// - public CreateSnapshotRequestDescriptor FeatureStates(ICollection? featureStates) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - FeatureStatesValue = featureStates; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } /// /// - /// If true, the request ignores data streams and indices in indices that are missing or closed. If false, the request returns an error for any data stream or index that is missing or closed. + /// The feature states to include in the snapshot. + /// Each feature state includes one or more system indices containing related data. + /// You can view a list of eligible features using the get features API. + /// + /// + /// If include_global_state is true, all current feature states are included by default. + /// If include_global_state is false, no feature states are included by default. + /// + /// + /// Note that specifying an empty array will result in the default behavior. + /// To exclude all feature states, regardless of the include_global_state value, specify an array with only the value none (["none"]). /// /// - public CreateSnapshotRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor FeatureStates(System.Collections.Generic.ICollection? value) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.FeatureStates = value; + return this; } /// /// - /// If true, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via feature_states). + /// The feature states to include in the snapshot. + /// Each feature state includes one or more system indices containing related data. + /// You can view a list of eligible features using the get features API. + /// + /// + /// If include_global_state is true, all current feature states are included by default. + /// If include_global_state is false, no feature states are included by default. + /// + /// + /// Note that specifying an empty array will result in the default behavior. + /// To exclude all feature states, regardless of the include_global_state value, specify an array with only the value none (["none"]). /// /// - public CreateSnapshotRequestDescriptor IncludeGlobalState(bool? includeGlobalState = true) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor FeatureStates(params string[] values) { - IncludeGlobalStateValue = includeGlobalState; - return Self; + Instance.FeatureStates = [.. values]; + return this; } /// /// - /// Data streams and indices to include in the snapshot. Supports multi-target syntax. Includes all data streams and indices by default. + /// If true, the request ignores data streams and indices in indices that are missing or closed. + /// If false, the request returns an error for any data stream or index that is missing or closed. /// /// - public CreateSnapshotRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor IgnoreUnavailable(bool? value = true) { - IndicesValue = indices; - return Self; + Instance.IgnoreUnavailable = value; + return this; } /// /// - /// Optional metadata for the snapshot. May have any contents. Must be less than 1024 bytes. This map is not automatically generated by Elasticsearch. + /// If true, the current cluster state is included in the snapshot. + /// The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. + /// It also includes data stored in system indices, such as Watches and task records (configurable via feature_states). /// /// - public CreateSnapshotRequestDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor IncludeGlobalState(bool? value = true) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.IncludeGlobalState = value; + return this; } /// /// - /// If true, allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// A comma-separated list of data streams and indices to include in the snapshot. + /// It supports a multi-target syntax. + /// The default is an empty array ([]), which includes all regular data streams and regular indices. + /// To exclude all data streams and indices, use -*. + /// + /// + /// You can't use this parameter to include or exclude system indices or system data streams from a snapshot. + /// Use feature_states instead. /// /// - public CreateSnapshotRequestDescriptor Partial(bool? partial = true) + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - PartialValue = partial; - return Self; + Instance.Indices = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. + /// It can have any contents but it must be less than 1024 bytes. + /// This information is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - writer.WriteStartObject(); - if (FeatureStatesValue is not null) - { - writer.WritePropertyName("feature_states"); - JsonSerializer.Serialize(writer, FeatureStatesValue, options); - } + Instance.Metadata = value; + return this; + } - if (IgnoreUnavailableValue.HasValue) - { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); - } + /// + /// + /// Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. + /// It can have any contents but it must be less than 1024 bytes. + /// This information is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (IncludeGlobalStateValue.HasValue) - { - writer.WritePropertyName("include_global_state"); - writer.WriteBooleanValue(IncludeGlobalStateValue.Value); - } + /// + /// + /// Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. + /// It can have any contents but it must be less than 1024 bytes. + /// This information is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// If true, it enables you to restore a partial snapshot of indices with unavailable shards. + /// Only shards that were successfully included in the snapshot will be restored. + /// All missing shards will be recreated as empty. + /// + /// + /// If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Partial(bool? value = true) + { + Instance.Partial = value; + return this; + } - if (PartialValue.HasValue) - { - writer.WritePropertyName("partial"); - writer.WriteBooleanValue(PartialValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotResponse.g.cs index 3afcb6e1a68..dcf3179cbbd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/CreateSnapshotResponse.g.cs @@ -17,30 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class CreateSnapshotResponse : ElasticsearchResponse +internal sealed partial class CreateSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccepted = System.Text.Json.JsonEncodedText.Encode("accepted"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccepted = default; + LocalJsonValue propSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccepted.TryReadProperty(ref reader, options, PropAccepted, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Accepted = propAccepted.Value, + Snapshot = propSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccepted, value.Accepted, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponseConverter))] +public sealed partial class CreateSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Equals true if the snapshot was accepted. Present when the request had wait_for_completion set to false /// /// - [JsonInclude, JsonPropertyName("accepted")] - public bool? Accepted { get; init; } + public bool? Accepted { get; set; } /// /// /// Snapshot information. Present when the request had wait_for_completion set to true /// /// - [JsonInclude, JsonPropertyName("snapshot")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfo? Snapshot { get; init; } + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfo? Snapshot { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryRequest.g.cs index bda787380fe..f08c12b81a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryRequest.g.cs @@ -17,36 +17,62 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class DeleteRepositoryRequestParameters : RequestParameters +public sealed partial class DeleteRepositoryRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteRepositoryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete snapshot repositories. @@ -54,15 +80,27 @@ public sealed partial class DeleteRepositoryRequestParameters : RequestParameter /// The snapshots themselves are left untouched and in place. /// /// -public sealed partial class DeleteRepositoryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestConverter))] +public sealed partial class DeleteRepositoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("repository", name)) { } +#if NET7_0_OR_GREATER + public DeleteRepositoryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotDeleteRepository; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotDeleteRepository; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; @@ -70,18 +108,32 @@ public DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Names name) : base( /// /// - /// Explicit operation timeout for connection to master node + /// The ame of the snapshot repositories to unregister. + /// Wildcard (*) patterns are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -92,32 +144,115 @@ public DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Names name) : base( /// The snapshots themselves are left untouched and in place. /// /// -public sealed partial class DeleteRepositoryRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteRepositoryRequestDescriptor { - internal DeleteRepositoryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest Instance { get; init; } - public DeleteRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("repository", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotDeleteRepository; + public DeleteRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteRepositoryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.delete_repository"; + /// + /// + /// The ame of the snapshot repositories to unregister. + /// Wildcard (*) patterns are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public DeleteRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryResponse.g.cs index 0c043369220..f079ff9078e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteRepositoryResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class DeleteRepositoryResponse : ElasticsearchResponse +internal sealed partial class DeleteRepositoryResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponseConverter))] +public sealed partial class DeleteRepositoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteRepositoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotRequest.g.cs index 6b478e4cbff..17b6bbdb543 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotRequest.g.cs @@ -17,43 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class DeleteSnapshotRequestParameters : RequestParameters +public sealed partial class DeleteSnapshotRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class DeleteSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete snapshots. /// /// -public sealed partial class DeleteSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestConverter))] +public sealed partial class DeleteSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } +#if NET7_0_OR_GREATER + public DeleteSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotDelete; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotDelete; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; @@ -61,10 +97,34 @@ public DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elas /// /// - /// Explicit operation timeout for connection to master node + /// The name of the repository to delete a snapshot from. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// A comma-separated list of snapshot names to delete. + /// It also accepts wildcards (*). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -73,37 +133,113 @@ public DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elas /// Delete snapshots. /// /// -public sealed partial class DeleteSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteSnapshotRequestDescriptor { - internal DeleteSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest Instance { get; init; } - public DeleteSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotDelete; + public DeleteSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest(repository, snapshot); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.delete"; + /// + /// + /// The name of the repository to delete a snapshot from. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } + + /// + /// + /// A comma-separated list of snapshot names to delete. + /// It also accepts wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Snapshot = value; + return this; + } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public DeleteSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("repository", repository); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotResponse.g.cs index e1a69227318..0c961154280 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/DeleteSnapshotResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class DeleteSnapshotResponse : ElasticsearchResponse +internal sealed partial class DeleteSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponseConverter))] +public sealed partial class DeleteSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryRequest.g.cs index a6279cf9d40..dd3a91c2b9f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryRequest.g.cs @@ -17,54 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class GetRepositoryRequestParameters : RequestParameters +public sealed partial class GetRepositoryRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Return local information, do not retrieve the state from master node (default: false) + /// If true, the request gets information from the local node only. + /// If false, the request gets information from the master node. /// /// public bool? Local { get => Q("local"); set => Q("local", value); } /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class GetRepositoryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get snapshot repository information. /// /// -public sealed partial class GetRepositoryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestConverter))] +public sealed partial class GetRepositoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetRepositoryRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("repository", name)) + { + } +#if NET7_0_OR_GREATER public GetRepositoryRequest() { } - - public GetRepositoryRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("repository", name)) +#endif +#if !NET7_0_OR_GREATER + public GetRepositoryRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotGetRepository; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotGetRepository; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -72,18 +109,30 @@ public GetRepositoryRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r /// /// - /// Return local information, do not retrieve the state from master node (default: false) + /// A comma-separated list of snapshot repository names used to limit the request. + /// Wildcard (*) expressions are supported including combining wildcards with exclude patterns starting with -. + /// + /// + /// To get information about all snapshot repositories registered in the cluster, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Name { get => P("repository"); set => PO("repository", value); } + + /// + /// + /// If true, the request gets information from the local node only. + /// If false, the request gets information from the master node. /// /// - [JsonIgnore] public bool? Local { get => Q("local"); set => Q("local", value); } /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -92,36 +141,121 @@ public GetRepositoryRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r /// Get snapshot repository information. /// /// -public sealed partial class GetRepositoryRequestDescriptor : RequestDescriptor +public readonly partial struct GetRepositoryRequestDescriptor { - internal GetRepositoryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest Instance { get; init; } - public GetRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("repository", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest instance) { + Instance = instance; + } + + public GetRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(name); } public GetRepositoryRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of snapshot repository names used to limit the request. + /// Wildcard (*) expressions are supported including combining wildcards with exclude patterns starting with -. + /// + /// + /// To get information about all snapshot repositories registered in the cluster, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Name = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotGetRepository; + /// + /// + /// If true, the request gets information from the local node only. + /// If false, the request gets information from the master node. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor Local(bool? value = true) + { + Instance.Local = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "snapshot.get_repository"; + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public GetRepositoryRequestDescriptor Local(bool? local = true) => Qs("local", local); - public GetRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryResponse.g.cs index 56a33d8b994..d905bdabc2c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetRepositoryResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class GetRepositoryResponse : DictionaryResponse +internal sealed partial class GetRepositoryResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetRepositoryResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Repositories = reader.ReadValue(options, null) }; } - public GetRepositoryResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Repositories, null); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponseConverter))] +public sealed partial class GetRepositoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRepositoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.Snapshot.Repositories Repositories { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotRequest.g.cs index a920c821cac..798a4877fdd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotRequest.g.cs @@ -17,66 +17,63 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class GetSnapshotRequestParameters : RequestParameters +public sealed partial class GetSnapshotRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Offset identifier to start pagination from as returned by the next field in the response body. + /// An offset identifier to start pagination from as returned by the next field in the response body. /// /// public string? After { get => Q("after"); set => Q("after", value); } /// /// - /// Value of the current sort column at which to start retrieval. Can either be a string snapshot- or repository name when sorting by snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count. + /// The value of the current sort column at which to start retrieval. + /// It can be a string snapshot- or a repository name when sorting by snapshot or repository name. + /// It can be a millisecond time value or a number when sorting by index- or shard count. /// /// public string? FromSortValue { get => Q("from_sort_value"); set => Q("from_sort_value", value); } /// /// - /// If false, the request returns an error for any snapshots that are unavailable. + /// If false, the request returns an error for any snapshots that are unavailable. /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// /// - /// If true, returns the repository name in each snapshot. + /// If true, the response includes the repository name in each snapshot. /// /// public bool? IncludeRepository { get => Q("include_repository"); set => Q("include_repository", value); } /// /// - /// If true, returns additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. Defaults to false, meaning that this information is omitted. + /// If true, the response includes additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. + /// The default is false, meaning that this information is omitted. /// /// public bool? IndexDetails { get => Q("index_details"); set => Q("index_details", value); } /// /// - /// If true, returns the name of each index in each snapshot. + /// If true, the response includes the name of each index in each snapshot. /// /// public bool? IndexNames { get => Q("index_names"); set => Q("index_names", value); } /// /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } @@ -90,54 +87,113 @@ public sealed partial class GetSnapshotRequestParameters : RequestParameters /// /// - /// Sort order. Valid values are asc for ascending and desc for descending order. Defaults to asc, meaning ascending order. + /// The sort order. + /// Valid values are asc for ascending and desc for descending order. + /// The default behavior is ascending order. /// /// public Elastic.Clients.Elasticsearch.SortOrder? Order { get => Q("order"); set => Q("order", value); } /// /// - /// Maximum number of snapshots to return. Defaults to 0 which means return all that match the request without limit. + /// The maximum number of snapshots to return. + /// The default is 0, which means to return all that match the request without limit. /// /// public int? Size { get => Q("size"); set => Q("size", value); } /// /// - /// Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Also accepts wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. To include snapshots not created by an SLM policy you can use the special pattern _none that will match all snapshots without an SLM policy. + /// Filter snapshots by a comma-separated list of snapshot lifecycle management (SLM) policy names that snapshots belong to. + /// + /// + /// You can use wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. + /// For example, the pattern *,-policy-a-\* will return all snapshots except for those that were created by an SLM policy with a name starting with policy-a-. + /// Note that the wildcard pattern * matches all snapshots created by an SLM policy but not those snapshots that were not created by an SLM policy. + /// To include snapshots that were not created by an SLM policy, you can use the special pattern _none that will match all snapshots without an SLM policy. /// /// public Elastic.Clients.Elasticsearch.Name? SlmPolicyFilter { get => Q("slm_policy_filter"); set => Q("slm_policy_filter", value); } /// /// - /// Allows setting a sort order for the result. Defaults to start_time, i.e. sorting by snapshot start time stamp. + /// The sort order for the result. + /// The default behavior is sorting by snapshot start time stamp. /// /// public Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort? Sort { get => Q("sort"); set => Q("sort", value); } /// /// - /// If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. + /// If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. + /// + /// + /// NOTE: The parameters size, order, after, from_sort_value, offset, slm_policy_filter, and sort are not supported when you set verbose=false and the sort order for requests with verbose=false is undefined. /// /// public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } +internal sealed partial class GetSnapshotRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get snapshot information. /// +/// +/// NOTE: The after parameter and next field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. +/// It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. +/// Snapshots concurrently created may be seen during an iteration. +/// /// -public sealed partial class GetSnapshotRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestConverter))] +public sealed partial class GetSnapshotRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } +#if NET7_0_OR_GREATER + public GetSnapshotRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -145,58 +201,91 @@ public GetSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic /// /// - /// Offset identifier to start pagination from as returned by the next field in the response body. + /// A comma-separated list of snapshot repository names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// A comma-separated list of snapshot names to retrieve + /// Wildcards (*) are supported. + /// + /// + /// + /// + /// To get information about all snapshots in a registered repository, use a wildcard (*) or _all. + /// + /// + /// + /// + /// To get information about any snapshots that are currently running, use _current. + /// + /// + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + + /// + /// + /// An offset identifier to start pagination from as returned by the next field in the response body. /// /// - [JsonIgnore] public string? After { get => Q("after"); set => Q("after", value); } /// /// - /// Value of the current sort column at which to start retrieval. Can either be a string snapshot- or repository name when sorting by snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count. + /// The value of the current sort column at which to start retrieval. + /// It can be a string snapshot- or a repository name when sorting by snapshot or repository name. + /// It can be a millisecond time value or a number when sorting by index- or shard count. /// /// - [JsonIgnore] public string? FromSortValue { get => Q("from_sort_value"); set => Q("from_sort_value", value); } /// /// - /// If false, the request returns an error for any snapshots that are unavailable. + /// If false, the request returns an error for any snapshots that are unavailable. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// /// - /// If true, returns the repository name in each snapshot. + /// If true, the response includes the repository name in each snapshot. /// /// - [JsonIgnore] public bool? IncludeRepository { get => Q("include_repository"); set => Q("include_repository", value); } /// /// - /// If true, returns additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. Defaults to false, meaning that this information is omitted. + /// If true, the response includes additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. + /// The default is false, meaning that this information is omitted. /// /// - [JsonIgnore] public bool? IndexDetails { get => Q("index_details"); set => Q("index_details", value); } /// /// - /// If true, returns the name of each index in each snapshot. + /// If true, the response includes the name of each index in each snapshot. /// /// - [JsonIgnore] public bool? IndexNames { get => Q("index_names"); set => Q("index_names", value); } /// /// - /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -204,47 +293,54 @@ public GetSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic /// Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0. /// /// - [JsonIgnore] public int? Offset { get => Q("offset"); set => Q("offset", value); } /// /// - /// Sort order. Valid values are asc for ascending and desc for descending order. Defaults to asc, meaning ascending order. + /// The sort order. + /// Valid values are asc for ascending and desc for descending order. + /// The default behavior is ascending order. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SortOrder? Order { get => Q("order"); set => Q("order", value); } /// /// - /// Maximum number of snapshots to return. Defaults to 0 which means return all that match the request without limit. + /// The maximum number of snapshots to return. + /// The default is 0, which means to return all that match the request without limit. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } /// /// - /// Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Also accepts wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. To include snapshots not created by an SLM policy you can use the special pattern _none that will match all snapshots without an SLM policy. + /// Filter snapshots by a comma-separated list of snapshot lifecycle management (SLM) policy names that snapshots belong to. + /// + /// + /// You can use wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. + /// For example, the pattern *,-policy-a-\* will return all snapshots except for those that were created by an SLM policy with a name starting with policy-a-. + /// Note that the wildcard pattern * matches all snapshots created by an SLM policy but not those snapshots that were not created by an SLM policy. + /// To include snapshots that were not created by an SLM policy, you can use the special pattern _none that will match all snapshots without an SLM policy. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Name? SlmPolicyFilter { get => Q("slm_policy_filter"); set => Q("slm_policy_filter", value); } /// /// - /// Allows setting a sort order for the result. Defaults to start_time, i.e. sorting by snapshot start time stamp. + /// The sort order for the result. + /// The default behavior is sorting by snapshot start time stamp. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort? Sort { get => Q("sort"); set => Q("sort", value); } /// /// - /// If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. + /// If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. + /// + /// + /// NOTE: The parameters size, order, after, from_sort_value, offset, slm_policy_filter, and sort are not supported when you set verbose=false and the sort order for requests with verbose=false is undefined. /// /// - [JsonIgnore] public bool? Verbose { get => Q("verbose"); set => Q("verbose", value); } } @@ -252,50 +348,279 @@ public GetSnapshotRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic /// /// Get snapshot information. /// +/// +/// NOTE: The after parameter and next field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots. +/// It is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration. +/// Snapshots concurrently created may be seen during an iteration. +/// /// -public sealed partial class GetSnapshotRequestDescriptor : RequestDescriptor +public readonly partial struct GetSnapshotRequestDescriptor { - internal GetSnapshotRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest Instance { get; init; } - public GetSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotGet; + public GetSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest(repository, snapshot); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSnapshotRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.get"; + /// + /// + /// A comma-separated list of snapshot repository names used to limit the request. + /// Wildcard (*) expressions are supported. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } + + /// + /// + /// A comma-separated list of snapshot names to retrieve + /// Wildcards (*) are supported. + /// + /// + /// + /// + /// To get information about all snapshots in a registered repository, use a wildcard (*) or _all. + /// + /// + /// + /// + /// To get information about any snapshots that are currently running, use _current. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Snapshot = value; + return this; + } + + /// + /// + /// An offset identifier to start pagination from as returned by the next field in the response body. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor After(string? value) + { + Instance.After = value; + return this; + } + + /// + /// + /// The value of the current sort column at which to start retrieval. + /// It can be a string snapshot- or a repository name when sorting by snapshot or repository name. + /// It can be a millisecond time value or a number when sorting by index- or shard count. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor FromSortValue(string? value) + { + Instance.FromSortValue = value; + return this; + } + + /// + /// + /// If false, the request returns an error for any snapshots that are unavailable. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, the response includes the repository name in each snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor IncludeRepository(bool? value = true) + { + Instance.IncludeRepository = value; + return this; + } + + /// + /// + /// If true, the response includes additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. + /// The default is false, meaning that this information is omitted. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor IndexDetails(bool? value = true) + { + Instance.IndexDetails = value; + return this; + } + + /// + /// + /// If true, the response includes the name of each index in each snapshot. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor IndexNames(bool? value = true) + { + Instance.IndexNames = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Offset(int? value) + { + Instance.Offset = value; + return this; + } + + /// + /// + /// The sort order. + /// Valid values are asc for ascending and desc for descending order. + /// The default behavior is ascending order. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) + { + Instance.Order = value; + return this; + } + + /// + /// + /// The maximum number of snapshots to return. + /// The default is 0, which means to return all that match the request without limit. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Filter snapshots by a comma-separated list of snapshot lifecycle management (SLM) policy names that snapshots belong to. + /// + /// + /// You can use wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. + /// For example, the pattern *,-policy-a-\* will return all snapshots except for those that were created by an SLM policy with a name starting with policy-a-. + /// Note that the wildcard pattern * matches all snapshots created by an SLM policy but not those snapshots that were not created by an SLM policy. + /// To include snapshots that were not created by an SLM policy, you can use the special pattern _none that will match all snapshots without an SLM policy. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor SlmPolicyFilter(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.SlmPolicyFilter = value; + return this; + } + + /// + /// + /// The sort order for the result. + /// The default behavior is sorting by snapshot start time stamp. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted. + /// + /// + /// NOTE: The parameters size, order, after, from_sort_value, offset, slm_policy_filter, and sort are not supported when you set verbose=false and the sort order for requests with verbose=false is undefined. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Verbose(bool? value = true) + { + Instance.Verbose = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetSnapshotRequestDescriptor After(string? after) => Qs("after", after); - public GetSnapshotRequestDescriptor FromSortValue(string? fromSortValue) => Qs("from_sort_value", fromSortValue); - public GetSnapshotRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public GetSnapshotRequestDescriptor IncludeRepository(bool? includeRepository = true) => Qs("include_repository", includeRepository); - public GetSnapshotRequestDescriptor IndexDetails(bool? indexDetails = true) => Qs("index_details", indexDetails); - public GetSnapshotRequestDescriptor IndexNames(bool? indexNames = true) => Qs("index_names", indexNames); - public GetSnapshotRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetSnapshotRequestDescriptor Offset(int? offset) => Qs("offset", offset); - public GetSnapshotRequestDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) => Qs("order", order); - public GetSnapshotRequestDescriptor Size(int? size) => Qs("size", size); - public GetSnapshotRequestDescriptor SlmPolicyFilter(Elastic.Clients.Elasticsearch.Name? slmPolicyFilter) => Qs("slm_policy_filter", slmPolicyFilter); - public GetSnapshotRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort? sort) => Qs("sort", sort); - public GetSnapshotRequestDescriptor Verbose(bool? verbose = true) => Qs("verbose", verbose); - - public GetSnapshotRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("repository", repository); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetSnapshotRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Names snapshot) + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotResponse.g.cs index 929c06311cc..c9e57a752f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/GetSnapshotResponse.g.cs @@ -17,34 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class GetSnapshotResponse : ElasticsearchResponse +internal sealed partial class GetSnapshotResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNext = System.Text.Json.JsonEncodedText.Encode("next"); + private static readonly System.Text.Json.JsonEncodedText PropRemaining = System.Text.Json.JsonEncodedText.Encode("remaining"); + private static readonly System.Text.Json.JsonEncodedText PropResponses = System.Text.Json.JsonEncodedText.Encode("responses"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshots = System.Text.Json.JsonEncodedText.Encode("snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNext = default; + LocalJsonValue propRemaining = default; + LocalJsonValue?> propResponses = default; + LocalJsonValue?> propSnapshots = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNext.TryReadProperty(ref reader, options, PropNext, null)) + { + continue; + } + + if (propRemaining.TryReadProperty(ref reader, options, PropRemaining, null)) + { + continue; + } + + if (propResponses.TryReadProperty(ref reader, options, PropResponses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSnapshots.TryReadProperty(ref reader, options, PropSnapshots, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Next = propNext.Value, + Remaining = propRemaining.Value, + Responses = propResponses.Value, + Snapshots = propSnapshots.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNext, value.Next, null, null); + writer.WriteProperty(options, PropRemaining, value.Remaining, null, null); + writer.WriteProperty(options, PropResponses, value.Responses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSnapshots, value.Snapshots, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponseConverter))] +public sealed partial class GetSnapshotResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSnapshotResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSnapshotResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// If the request contained a size limit and there might be more results, a next field will be added to the response. + /// It can be used as the after query parameter to fetch additional results. + /// + /// + public string? Next { get; set; } + /// /// - /// The number of remaining snapshots that were not returned due to size limits and that can be fetched by additional requests using the next field value. + /// The number of remaining snapshots that were not returned due to size limits and that can be fetched by additional requests using the next field value. /// /// - [JsonInclude, JsonPropertyName("remaining")] - public int Remaining { get; init; } - [JsonInclude, JsonPropertyName("responses")] - public IReadOnlyCollection? Responses { get; init; } - [JsonInclude, JsonPropertyName("snapshots")] - public IReadOnlyCollection? Snapshots { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Remaining { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Responses { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Snapshots { get; set; } /// /// - /// The total number of snapshots that match the request when ignoring size limit or after query parameter. + /// The total number of snapshots that match the request when ignoring the size limit or after query parameter. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeRequest.g.cs index c433c15e4f4..afa9a9104ef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RepositoryAnalyzeRequestParameters : RequestParameters +public sealed partial class RepositoryAnalyzeRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -126,6 +119,35 @@ public sealed partial class RepositoryAnalyzeRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class RepositoryAnalyzeRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Analyze a snapshot repository. @@ -256,27 +278,49 @@ public sealed partial class RepositoryAnalyzeRequestParameters : RequestParamete /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. /// /// -public sealed partial class RepositoryAnalyzeRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestConverter))] +public sealed partial class RepositoryAnalyzeRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) { } +#if NET7_0_OR_GREATER + public RepositoryAnalyzeRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRepositoryAnalyze; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotRepositoryAnalyze; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "snapshot.repository_analyze"; + /// + /// + /// The name of the repository. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("repository"); set => PR("repository", value); } + /// /// /// The total number of blobs to write to the repository during the test. /// For realistic experiments, you should set it to at least 2000. /// /// - [JsonIgnore] public int? BlobCount { get => Q("blob_count"); set => Q("blob_count", value); } /// @@ -284,7 +328,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// The number of operations to run concurrently during the test. /// /// - [JsonIgnore] public int? Concurrency { get => Q("concurrency"); set => Q("concurrency", value); } /// @@ -293,7 +336,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// If false, it returns only a summary of the analysis. /// /// - [JsonIgnore] public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } /// @@ -302,7 +344,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// Early read operations are only rarely performed. /// /// - [JsonIgnore] public int? EarlyReadNodeCount { get => Q("early_read_node_count"); set => Q("early_read_node_count", value); } /// @@ -311,7 +352,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// For realistic experiments, you should set it to at least 2gb. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.ByteSize? MaxBlobSize { get => Q("max_blob_size"); set => Q("max_blob_size", value); } /// @@ -320,7 +360,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// For realistic experiments, you should set it to at least 1tb. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.ByteSize? MaxTotalDataSize { get => Q("max_total_data_size"); set => Q("max_total_data_size", value); } /// @@ -328,7 +367,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// The probability of performing a rare action such as an early read, an overwrite, or an aborted write on each blob. /// /// - [JsonIgnore] public double? RareActionProbability { get => Q("rare_action_probability"); set => Q("rare_action_probability", value); } /// @@ -336,7 +374,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// Indicates whether to rarely cancel writes before they complete. /// /// - [JsonIgnore] public bool? RarelyAbortWrites { get => Q("rarely_abort_writes"); set => Q("rarely_abort_writes", value); } /// @@ -344,7 +381,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// The number of nodes on which to read a blob after writing. /// /// - [JsonIgnore] public int? ReadNodeCount { get => Q("read_node_count"); set => Q("read_node_count", value); } /// @@ -353,7 +389,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// For realistic experiments, you should set it to at least 100. /// /// - [JsonIgnore] public int? RegisterOperationCount { get => Q("register_operation_count"); set => Q("register_operation_count", value); } /// @@ -363,7 +398,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// Note that the operations are performed concurrently so might not always happen in the same order on each run. /// /// - [JsonIgnore] public int? Seed { get => Q("seed"); set => Q("seed", value); } /// @@ -372,7 +406,6 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// If no response is received before the timeout expires, the test is cancelled and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -506,42 +539,253 @@ public RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Name name) : base( /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. /// /// -public sealed partial class RepositoryAnalyzeRequestDescriptor : RequestDescriptor +public readonly partial struct RepositoryAnalyzeRequestDescriptor { - internal RepositoryAnalyzeRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest Instance { get; init; } - public RepositoryAnalyzeRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryAnalyzeRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRepositoryAnalyze; + public RepositoryAnalyzeRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RepositoryAnalyzeRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.repository_analyze"; + /// + /// + /// The name of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The total number of blobs to write to the repository during the test. + /// For realistic experiments, you should set it to at least 2000. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor BlobCount(int? value) + { + Instance.BlobCount = value; + return this; + } + + /// + /// + /// The number of operations to run concurrently during the test. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Concurrency(int? value) + { + Instance.Concurrency = value; + return this; + } + + /// + /// + /// Indicates whether to return detailed results, including timing information for every operation performed during the analysis. + /// If false, it returns only a summary of the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Detailed(bool? value = true) + { + Instance.Detailed = value; + return this; + } + + /// + /// + /// The number of nodes on which to perform an early read operation while writing each blob. + /// Early read operations are only rarely performed. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor EarlyReadNodeCount(int? value) + { + Instance.EarlyReadNodeCount = value; + return this; + } + + /// + /// + /// The maximum size of a blob to be written during the test. + /// For realistic experiments, you should set it to at least 2gb. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor MaxBlobSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxBlobSize = value; + return this; + } + + /// + /// + /// The maximum size of a blob to be written during the test. + /// For realistic experiments, you should set it to at least 2gb. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor MaxBlobSize(System.Func action) + { + Instance.MaxBlobSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } + + /// + /// + /// An upper limit on the total size of all the blobs written during the test. + /// For realistic experiments, you should set it to at least 1tb. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor MaxTotalDataSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxTotalDataSize = value; + return this; + } + + /// + /// + /// An upper limit on the total size of all the blobs written during the test. + /// For realistic experiments, you should set it to at least 1tb. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor MaxTotalDataSize(System.Func action) + { + Instance.MaxTotalDataSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } + + /// + /// + /// The probability of performing a rare action such as an early read, an overwrite, or an aborted write on each blob. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor RareActionProbability(double? value) + { + Instance.RareActionProbability = value; + return this; + } + + /// + /// + /// Indicates whether to rarely cancel writes before they complete. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor RarelyAbortWrites(bool? value = true) + { + Instance.RarelyAbortWrites = value; + return this; + } + + /// + /// + /// The number of nodes on which to read a blob after writing. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor ReadNodeCount(int? value) + { + Instance.ReadNodeCount = value; + return this; + } + + /// + /// + /// The minimum number of linearizable register operations to perform in total. + /// For realistic experiments, you should set it to at least 100. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor RegisterOperationCount(int? value) + { + Instance.RegisterOperationCount = value; + return this; + } + + /// + /// + /// The seed for the pseudo-random number generator used to generate the list of operations performed during the test. + /// To repeat the same set of operations in multiple experiments, use the same seed in each experiment. + /// Note that the operations are performed concurrently so might not always happen in the same order on each run. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Seed(int? value) + { + Instance.Seed = value; + return this; + } + + /// + /// + /// The period of time to wait for the test to complete. + /// If no response is received before the timeout expires, the test is cancelled and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RepositoryAnalyzeRequestDescriptor BlobCount(int? blobCount) => Qs("blob_count", blobCount); - public RepositoryAnalyzeRequestDescriptor Concurrency(int? concurrency) => Qs("concurrency", concurrency); - public RepositoryAnalyzeRequestDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed); - public RepositoryAnalyzeRequestDescriptor EarlyReadNodeCount(int? earlyReadNodeCount) => Qs("early_read_node_count", earlyReadNodeCount); - public RepositoryAnalyzeRequestDescriptor MaxBlobSize(Elastic.Clients.Elasticsearch.ByteSize? maxBlobSize) => Qs("max_blob_size", maxBlobSize); - public RepositoryAnalyzeRequestDescriptor MaxTotalDataSize(Elastic.Clients.Elasticsearch.ByteSize? maxTotalDataSize) => Qs("max_total_data_size", maxTotalDataSize); - public RepositoryAnalyzeRequestDescriptor RareActionProbability(double? rareActionProbability) => Qs("rare_action_probability", rareActionProbability); - public RepositoryAnalyzeRequestDescriptor RarelyAbortWrites(bool? rarelyAbortWrites = true) => Qs("rarely_abort_writes", rarelyAbortWrites); - public RepositoryAnalyzeRequestDescriptor ReadNodeCount(int? readNodeCount) => Qs("read_node_count", readNodeCount); - public RepositoryAnalyzeRequestDescriptor RegisterOperationCount(int? registerOperationCount) => Qs("register_operation_count", registerOperationCount); - public RepositoryAnalyzeRequestDescriptor Seed(int? seed) => Qs("seed", seed); - public RepositoryAnalyzeRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public RepositoryAnalyzeRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeResponse.g.cs index 0ed58394662..c8129ecc32e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryAnalyzeResponse.g.cs @@ -17,80 +17,323 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RepositoryAnalyzeResponse : ElasticsearchResponse +internal sealed partial class RepositoryAnalyzeResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBlobCount = System.Text.Json.JsonEncodedText.Encode("blob_count"); + private static readonly System.Text.Json.JsonEncodedText PropBlobPath = System.Text.Json.JsonEncodedText.Encode("blob_path"); + private static readonly System.Text.Json.JsonEncodedText PropConcurrency = System.Text.Json.JsonEncodedText.Encode("concurrency"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingNode = System.Text.Json.JsonEncodedText.Encode("coordinating_node"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteElapsed = System.Text.Json.JsonEncodedText.Encode("delete_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteElapsedNanos = System.Text.Json.JsonEncodedText.Encode("delete_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropEarlyReadNodeCount = System.Text.Json.JsonEncodedText.Encode("early_read_node_count"); + private static readonly System.Text.Json.JsonEncodedText PropIssuesDetected = System.Text.Json.JsonEncodedText.Encode("issues_detected"); + private static readonly System.Text.Json.JsonEncodedText PropListingElapsed = System.Text.Json.JsonEncodedText.Encode("listing_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropListingElapsedNanos = System.Text.Json.JsonEncodedText.Encode("listing_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropMaxBlobSize = System.Text.Json.JsonEncodedText.Encode("max_blob_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxBlobSizeBytes = System.Text.Json.JsonEncodedText.Encode("max_blob_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTotalDataSize = System.Text.Json.JsonEncodedText.Encode("max_total_data_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTotalDataSizeBytes = System.Text.Json.JsonEncodedText.Encode("max_total_data_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropRareActionProbability = System.Text.Json.JsonEncodedText.Encode("rare_action_probability"); + private static readonly System.Text.Json.JsonEncodedText PropReadNodeCount = System.Text.Json.JsonEncodedText.Encode("read_node_count"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropSeed = System.Text.Json.JsonEncodedText.Encode("seed"); + private static readonly System.Text.Json.JsonEncodedText PropSummary = System.Text.Json.JsonEncodedText.Encode("summary"); + + public override Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBlobCount = default; + LocalJsonValue propBlobPath = default; + LocalJsonValue propConcurrency = default; + LocalJsonValue propCoordinatingNode = default; + LocalJsonValue propDeleteElapsed = default; + LocalJsonValue propDeleteElapsedNanos = default; + LocalJsonValue propDetails = default; + LocalJsonValue propEarlyReadNodeCount = default; + LocalJsonValue> propIssuesDetected = default; + LocalJsonValue propListingElapsed = default; + LocalJsonValue propListingElapsedNanos = default; + LocalJsonValue propMaxBlobSize = default; + LocalJsonValue propMaxBlobSizeBytes = default; + LocalJsonValue propMaxTotalDataSize = default; + LocalJsonValue propMaxTotalDataSizeBytes = default; + LocalJsonValue propRareActionProbability = default; + LocalJsonValue propReadNodeCount = default; + LocalJsonValue propRepository = default; + LocalJsonValue propSeed = default; + LocalJsonValue propSummary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBlobCount.TryReadProperty(ref reader, options, PropBlobCount, null)) + { + continue; + } + + if (propBlobPath.TryReadProperty(ref reader, options, PropBlobPath, null)) + { + continue; + } + + if (propConcurrency.TryReadProperty(ref reader, options, PropConcurrency, null)) + { + continue; + } + + if (propCoordinatingNode.TryReadProperty(ref reader, options, PropCoordinatingNode, null)) + { + continue; + } + + if (propDeleteElapsed.TryReadProperty(ref reader, options, PropDeleteElapsed, null)) + { + continue; + } + + if (propDeleteElapsedNanos.TryReadProperty(ref reader, options, PropDeleteElapsedNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propEarlyReadNodeCount.TryReadProperty(ref reader, options, PropEarlyReadNodeCount, null)) + { + continue; + } + + if (propIssuesDetected.TryReadProperty(ref reader, options, PropIssuesDetected, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propListingElapsed.TryReadProperty(ref reader, options, PropListingElapsed, null)) + { + continue; + } + + if (propListingElapsedNanos.TryReadProperty(ref reader, options, PropListingElapsedNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propMaxBlobSize.TryReadProperty(ref reader, options, PropMaxBlobSize, null)) + { + continue; + } + + if (propMaxBlobSizeBytes.TryReadProperty(ref reader, options, PropMaxBlobSizeBytes, null)) + { + continue; + } + + if (propMaxTotalDataSize.TryReadProperty(ref reader, options, PropMaxTotalDataSize, null)) + { + continue; + } + + if (propMaxTotalDataSizeBytes.TryReadProperty(ref reader, options, PropMaxTotalDataSizeBytes, null)) + { + continue; + } + + if (propRareActionProbability.TryReadProperty(ref reader, options, PropRareActionProbability, null)) + { + continue; + } + + if (propReadNodeCount.TryReadProperty(ref reader, options, PropReadNodeCount, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propSeed.TryReadProperty(ref reader, options, PropSeed, null)) + { + continue; + } + + if (propSummary.TryReadProperty(ref reader, options, PropSummary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BlobCount = propBlobCount.Value, + BlobPath = propBlobPath.Value, + Concurrency = propConcurrency.Value, + CoordinatingNode = propCoordinatingNode.Value, + DeleteElapsed = propDeleteElapsed.Value, + DeleteElapsedNanos = propDeleteElapsedNanos.Value, + Details = propDetails.Value, + EarlyReadNodeCount = propEarlyReadNodeCount.Value, + IssuesDetected = propIssuesDetected.Value, + ListingElapsed = propListingElapsed.Value, + ListingElapsedNanos = propListingElapsedNanos.Value, + MaxBlobSize = propMaxBlobSize.Value, + MaxBlobSizeBytes = propMaxBlobSizeBytes.Value, + MaxTotalDataSize = propMaxTotalDataSize.Value, + MaxTotalDataSizeBytes = propMaxTotalDataSizeBytes.Value, + RareActionProbability = propRareActionProbability.Value, + ReadNodeCount = propReadNodeCount.Value, + Repository = propRepository.Value, + Seed = propSeed.Value, + Summary = propSummary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBlobCount, value.BlobCount, null, null); + writer.WriteProperty(options, PropBlobPath, value.BlobPath, null, null); + writer.WriteProperty(options, PropConcurrency, value.Concurrency, null, null); + writer.WriteProperty(options, PropCoordinatingNode, value.CoordinatingNode, null, null); + writer.WriteProperty(options, PropDeleteElapsed, value.DeleteElapsed, null, null); + writer.WriteProperty(options, PropDeleteElapsedNanos, value.DeleteElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropEarlyReadNodeCount, value.EarlyReadNodeCount, null, null); + writer.WriteProperty(options, PropIssuesDetected, value.IssuesDetected, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropListingElapsed, value.ListingElapsed, null, null); + writer.WriteProperty(options, PropListingElapsedNanos, value.ListingElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropMaxBlobSize, value.MaxBlobSize, null, null); + writer.WriteProperty(options, PropMaxBlobSizeBytes, value.MaxBlobSizeBytes, null, null); + writer.WriteProperty(options, PropMaxTotalDataSize, value.MaxTotalDataSize, null, null); + writer.WriteProperty(options, PropMaxTotalDataSizeBytes, value.MaxTotalDataSizeBytes, null, null); + writer.WriteProperty(options, PropRareActionProbability, value.RareActionProbability, null, null); + writer.WriteProperty(options, PropReadNodeCount, value.ReadNodeCount, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropSeed, value.Seed, null, null); + writer.WriteProperty(options, PropSummary, value.Summary, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponseConverter))] +public sealed partial class RepositoryAnalyzeResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryAnalyzeResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryAnalyzeResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of blobs written to the repository during the test. /// /// - [JsonInclude, JsonPropertyName("blob_count")] - public int BlobCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int BlobCount { get; set; } /// /// /// The path in the repository under which all the blobs were written during the test. /// /// - [JsonInclude, JsonPropertyName("blob_path")] - public string BlobPath { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string BlobPath { get; set; } /// /// /// The number of write operations performed concurrently during the test. /// /// - [JsonInclude, JsonPropertyName("concurrency")] - public int Concurrency { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Concurrency { get; set; } /// /// /// The node that coordinated the analysis and performed the final cleanup. /// /// - [JsonInclude, JsonPropertyName("coordinating_node")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo CoordinatingNode { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo CoordinatingNode { get; set; } /// /// /// The time it took to delete all the blobs in the container. /// /// - [JsonInclude, JsonPropertyName("delete_elapsed")] - public Elastic.Clients.Elasticsearch.Duration DeleteElapsed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration DeleteElapsed { get; set; } /// /// /// The time it took to delete all the blobs in the container, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("delete_elapsed_nanos")] - public long DeleteElapsedNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan DeleteElapsedNanos { get; set; } /// /// /// A description of every read and write operation performed during the test. /// /// - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Snapshot.DetailsInfo Details { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.DetailsInfo Details { get; set; } /// /// /// The limit on the number of nodes on which early read operations were performed after writing each blob. /// /// - [JsonInclude, JsonPropertyName("early_read_node_count")] - public int EarlyReadNodeCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int EarlyReadNodeCount { get; set; } /// /// @@ -98,94 +341,130 @@ public sealed partial class RepositoryAnalyzeResponse : ElasticsearchResponse /// It is included to emphasize that a successful response does not guarantee correct behaviour in future. /// /// - [JsonInclude, JsonPropertyName("issues_detected")] - public IReadOnlyCollection IssuesDetected { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection IssuesDetected { get; set; } /// /// /// The time it took to retrieve a list of all the blobs in the container. /// /// - [JsonInclude, JsonPropertyName("listing_elapsed")] - public Elastic.Clients.Elasticsearch.Duration ListingElapsed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration ListingElapsed { get; set; } /// /// /// The time it took to retrieve a list of all the blobs in the container, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("listing_elapsed_nanos")] - public long ListingElapsedNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ListingElapsedNanos { get; set; } /// /// /// The limit on the size of a blob written during the test. /// /// - [JsonInclude, JsonPropertyName("max_blob_size")] - public Elastic.Clients.Elasticsearch.ByteSize MaxBlobSize { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize MaxBlobSize { get; set; } /// /// /// The limit, in bytes, on the size of a blob written during the test. /// /// - [JsonInclude, JsonPropertyName("max_blob_size_bytes")] - public long MaxBlobSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxBlobSizeBytes { get; set; } /// /// /// The limit on the total size of all blob written during the test. /// /// - [JsonInclude, JsonPropertyName("max_total_data_size")] - public Elastic.Clients.Elasticsearch.ByteSize MaxTotalDataSize { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize MaxTotalDataSize { get; set; } /// /// /// The limit, in bytes, on the total size of all blob written during the test. /// /// - [JsonInclude, JsonPropertyName("max_total_data_size_bytes")] - public long MaxTotalDataSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxTotalDataSizeBytes { get; set; } /// /// /// The probability of performing rare actions during the test. /// /// - [JsonInclude, JsonPropertyName("rare_action_probability")] - public double RareActionProbability { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double RareActionProbability { get; set; } /// /// /// The limit on the number of nodes on which read operations were performed after writing each blob. /// /// - [JsonInclude, JsonPropertyName("read_node_count")] - public int ReadNodeCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ReadNodeCount { get; set; } /// /// /// The name of the repository that was the subject of the analysis. /// /// - [JsonInclude, JsonPropertyName("repository")] - public string Repository { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Repository { get; set; } /// /// /// The seed for the pseudo-random number generator used to generate the operations used during the test. /// /// - [JsonInclude, JsonPropertyName("seed")] - public long Seed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Seed { get; set; } /// /// /// A collection of statistics that summarize the results of the test. /// /// - [JsonInclude, JsonPropertyName("summary")] - public Elastic.Clients.Elasticsearch.Snapshot.SummaryInfo Summary { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SummaryInfo Summary { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityRequest.g.cs index f48895454de..c9ed0d9ba55 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityRequest.g.cs @@ -17,78 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RepositoryVerifyIntegrityRequestParameters : RequestParameters +public sealed partial class RepositoryVerifyIntegrityRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Number of threads to use for reading blob contents + /// If verify_blob_contents is true, this parameter specifies how many blobs to verify at once. /// /// public int? BlobThreadPoolConcurrency { get => Q("blob_thread_pool_concurrency"); set => Q("blob_thread_pool_concurrency", value); } /// /// - /// Number of snapshots to verify concurrently within each index + /// The maximum number of index snapshots to verify concurrently within each index verification. /// /// public int? IndexSnapshotVerificationConcurrency { get => Q("index_snapshot_verification_concurrency"); set => Q("index_snapshot_verification_concurrency", value); } /// /// - /// Number of indices to verify concurrently + /// The number of indices to verify concurrently. + /// The default behavior is to use the entire snapshot_meta thread pool. /// /// public int? IndexVerificationConcurrency { get => Q("index_verification_concurrency"); set => Q("index_verification_concurrency", value); } /// /// - /// Rate limit for individual blob verification + /// If verify_blob_contents is true, this parameter specifies the maximum amount of data that Elasticsearch will read from the repository every second. /// /// public string? MaxBytesPerSec { get => Q("max_bytes_per_sec"); set => Q("max_bytes_per_sec", value); } /// /// - /// Maximum permitted number of failed shard snapshots + /// The number of shard snapshot failures to track during integrity verification, in order to avoid excessive resource usage. + /// If your repository contains more than this number of shard snapshot failures, the verification will fail. /// /// public int? MaxFailedShardSnapshots { get => Q("max_failed_shard_snapshots"); set => Q("max_failed_shard_snapshots", value); } /// /// - /// Number of threads to use for reading metadata + /// The maximum number of snapshot metadata operations to run concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. /// /// public int? MetaThreadPoolConcurrency { get => Q("meta_thread_pool_concurrency"); set => Q("meta_thread_pool_concurrency", value); } /// /// - /// Number of snapshots to verify concurrently + /// The number of snapshots to verify concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. /// /// public int? SnapshotVerificationConcurrency { get => Q("snapshot_verification_concurrency"); set => Q("snapshot_verification_concurrency", value); } /// /// - /// Whether to verify the contents of individual blobs + /// Indicates whether to verify the checksum of every data blob in the repository. + /// If this feature is enabled, Elasticsearch will read the entire repository contents, which may be extremely slow and expensive. /// /// public bool? VerifyBlobContents { get => Q("verify_blob_contents"); set => Q("verify_blob_contents", value); } } +internal sealed partial class RepositoryVerifyIntegrityRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Verify the repository integrity. @@ -148,16 +175,38 @@ public sealed partial class RepositoryVerifyIntegrityRequestParameters : Request /// /// NOTE: This API may not work correctly in a mixed-version cluster. /// +/// +/// The default values for the parameters of this API are designed to limit the impact of the integrity verification on other activities in your cluster. +/// For instance, by default it will only use at most half of the snapshot_meta threads to verify the integrity of each snapshot, allowing other snapshot operations to use the other half of this thread pool. +/// If you modify these parameters to speed up the verification process, you risk disrupting other snapshot-related operations in your cluster. +/// For large repositories, consider setting up a separate single-node Elasticsearch cluster just for running the integrity verification API. +/// +/// +/// The response exposes implementation details of the analysis which may change from version to version. +/// The response body format is therefore not considered stable and may be different in newer versions. +/// /// -public sealed partial class RepositoryVerifyIntegrityRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestConverter))] +public sealed partial class RepositoryVerifyIntegrityRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("repository", name)) { } +#if NET7_0_OR_GREATER + public RepositoryVerifyIntegrityRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRepositoryVerifyIntegrity; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotRepositoryVerifyIntegrity; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -165,66 +214,74 @@ public RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Names name /// /// - /// Number of threads to use for reading blob contents + /// The name of the snapshot repository. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Name { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// If verify_blob_contents is true, this parameter specifies how many blobs to verify at once. /// /// - [JsonIgnore] public int? BlobThreadPoolConcurrency { get => Q("blob_thread_pool_concurrency"); set => Q("blob_thread_pool_concurrency", value); } /// /// - /// Number of snapshots to verify concurrently within each index + /// The maximum number of index snapshots to verify concurrently within each index verification. /// /// - [JsonIgnore] public int? IndexSnapshotVerificationConcurrency { get => Q("index_snapshot_verification_concurrency"); set => Q("index_snapshot_verification_concurrency", value); } /// /// - /// Number of indices to verify concurrently + /// The number of indices to verify concurrently. + /// The default behavior is to use the entire snapshot_meta thread pool. /// /// - [JsonIgnore] public int? IndexVerificationConcurrency { get => Q("index_verification_concurrency"); set => Q("index_verification_concurrency", value); } /// /// - /// Rate limit for individual blob verification + /// If verify_blob_contents is true, this parameter specifies the maximum amount of data that Elasticsearch will read from the repository every second. /// /// - [JsonIgnore] public string? MaxBytesPerSec { get => Q("max_bytes_per_sec"); set => Q("max_bytes_per_sec", value); } /// /// - /// Maximum permitted number of failed shard snapshots + /// The number of shard snapshot failures to track during integrity verification, in order to avoid excessive resource usage. + /// If your repository contains more than this number of shard snapshot failures, the verification will fail. /// /// - [JsonIgnore] public int? MaxFailedShardSnapshots { get => Q("max_failed_shard_snapshots"); set => Q("max_failed_shard_snapshots", value); } /// /// - /// Number of threads to use for reading metadata + /// The maximum number of snapshot metadata operations to run concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. /// /// - [JsonIgnore] public int? MetaThreadPoolConcurrency { get => Q("meta_thread_pool_concurrency"); set => Q("meta_thread_pool_concurrency", value); } /// /// - /// Number of snapshots to verify concurrently + /// The number of snapshots to verify concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. /// /// - [JsonIgnore] public int? SnapshotVerificationConcurrency { get => Q("snapshot_verification_concurrency"); set => Q("snapshot_verification_concurrency", value); } /// /// - /// Whether to verify the contents of individual blobs + /// Indicates whether to verify the checksum of every data blob in the repository. + /// If this feature is enabled, Elasticsearch will read the entire repository contents, which may be extremely slow and expensive. /// /// - [JsonIgnore] public bool? VerifyBlobContents { get => Q("verify_blob_contents"); set => Q("verify_blob_contents", value); } } @@ -287,39 +344,192 @@ public RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Names name /// /// NOTE: This API may not work correctly in a mixed-version cluster. /// +/// +/// The default values for the parameters of this API are designed to limit the impact of the integrity verification on other activities in your cluster. +/// For instance, by default it will only use at most half of the snapshot_meta threads to verify the integrity of each snapshot, allowing other snapshot operations to use the other half of this thread pool. +/// If you modify these parameters to speed up the verification process, you risk disrupting other snapshot-related operations in your cluster. +/// For large repositories, consider setting up a separate single-node Elasticsearch cluster just for running the integrity verification API. +/// +/// +/// The response exposes implementation details of the analysis which may change from version to version. +/// The response body format is therefore not considered stable and may be different in newer versions. +/// /// -public sealed partial class RepositoryVerifyIntegrityRequestDescriptor : RequestDescriptor +public readonly partial struct RepositoryVerifyIntegrityRequestDescriptor { - internal RepositoryVerifyIntegrityRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryVerifyIntegrityRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest instance) + { + Instance = instance; + } - public RepositoryVerifyIntegrityRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("repository", name)) + public RepositoryVerifyIntegrityRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest(name); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRepositoryVerifyIntegrity; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RepositoryVerifyIntegrityRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => false; + /// + /// + /// The name of the snapshot repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names value) + { + Instance.Name = value; + return this; + } - internal override string OperationName => "snapshot.repository_verify_integrity"; + /// + /// + /// If verify_blob_contents is true, this parameter specifies how many blobs to verify at once. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor BlobThreadPoolConcurrency(int? value) + { + Instance.BlobThreadPoolConcurrency = value; + return this; + } + + /// + /// + /// The maximum number of index snapshots to verify concurrently within each index verification. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor IndexSnapshotVerificationConcurrency(int? value) + { + Instance.IndexSnapshotVerificationConcurrency = value; + return this; + } + + /// + /// + /// The number of indices to verify concurrently. + /// The default behavior is to use the entire snapshot_meta thread pool. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor IndexVerificationConcurrency(int? value) + { + Instance.IndexVerificationConcurrency = value; + return this; + } + + /// + /// + /// If verify_blob_contents is true, this parameter specifies the maximum amount of data that Elasticsearch will read from the repository every second. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor MaxBytesPerSec(string? value) + { + Instance.MaxBytesPerSec = value; + return this; + } + + /// + /// + /// The number of shard snapshot failures to track during integrity verification, in order to avoid excessive resource usage. + /// If your repository contains more than this number of shard snapshot failures, the verification will fail. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor MaxFailedShardSnapshots(int? value) + { + Instance.MaxFailedShardSnapshots = value; + return this; + } + + /// + /// + /// The maximum number of snapshot metadata operations to run concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor MetaThreadPoolConcurrency(int? value) + { + Instance.MetaThreadPoolConcurrency = value; + return this; + } + + /// + /// + /// The number of snapshots to verify concurrently. + /// The default behavior is to use at most half of the snapshot_meta thread pool at once. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor SnapshotVerificationConcurrency(int? value) + { + Instance.SnapshotVerificationConcurrency = value; + return this; + } + + /// + /// + /// Indicates whether to verify the checksum of every data blob in the repository. + /// If this feature is enabled, Elasticsearch will read the entire repository contents, which may be extremely slow and expensive. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor VerifyBlobContents(bool? value = true) + { + Instance.VerifyBlobContents = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public RepositoryVerifyIntegrityRequestDescriptor BlobThreadPoolConcurrency(int? blobThreadPoolConcurrency) => Qs("blob_thread_pool_concurrency", blobThreadPoolConcurrency); - public RepositoryVerifyIntegrityRequestDescriptor IndexSnapshotVerificationConcurrency(int? indexSnapshotVerificationConcurrency) => Qs("index_snapshot_verification_concurrency", indexSnapshotVerificationConcurrency); - public RepositoryVerifyIntegrityRequestDescriptor IndexVerificationConcurrency(int? indexVerificationConcurrency) => Qs("index_verification_concurrency", indexVerificationConcurrency); - public RepositoryVerifyIntegrityRequestDescriptor MaxBytesPerSec(string? maxBytesPerSec) => Qs("max_bytes_per_sec", maxBytesPerSec); - public RepositoryVerifyIntegrityRequestDescriptor MaxFailedShardSnapshots(int? maxFailedShardSnapshots) => Qs("max_failed_shard_snapshots", maxFailedShardSnapshots); - public RepositoryVerifyIntegrityRequestDescriptor MetaThreadPoolConcurrency(int? metaThreadPoolConcurrency) => Qs("meta_thread_pool_concurrency", metaThreadPoolConcurrency); - public RepositoryVerifyIntegrityRequestDescriptor SnapshotVerificationConcurrency(int? snapshotVerificationConcurrency) => Qs("snapshot_verification_concurrency", snapshotVerificationConcurrency); - public RepositoryVerifyIntegrityRequestDescriptor VerifyBlobContents(bool? verifyBlobContents = true) => Qs("verify_blob_contents", verifyBlobContents); + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public RepositoryVerifyIntegrityRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityResponse.g.cs index 15a2250ef7f..abeb6c2c325 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RepositoryVerifyIntegrityResponse.g.cs @@ -17,15 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RepositoryVerifyIntegrityResponse : ElasticsearchResponse +internal sealed partial class RepositoryVerifyIntegrityResponseConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Result = reader.ReadValue(options, null) }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Result, null); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponseConverter))] +public sealed partial class RepositoryVerifyIntegrityResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryVerifyIntegrityResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryVerifyIntegrityResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +object Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreRequest.g.cs index 73de6d5abec..41ff80d2630 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreRequest.g.cs @@ -17,36 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RestoreRequestParameters : RequestParameters +public sealed partial class RestoreRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Should this request wait until the operation has completed before returning + /// If true, the request returns a response when the restore operation completes. + /// The operation is complete when it finishes all attempts to recover primary shards for restored indices. + /// This applies even if one or more of the recovery attempts fail. + /// + /// + /// If false, the request returns a response when the restore operation initializes. /// /// public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class RestoreRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureStates = System.Text.Json.JsonEncodedText.Encode("feature_states"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreIndexSettings = System.Text.Json.JsonEncodedText.Encode("ignore_index_settings"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnavailable = System.Text.Json.JsonEncodedText.Encode("ignore_unavailable"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeAliases = System.Text.Json.JsonEncodedText.Encode("include_aliases"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeGlobalState = System.Text.Json.JsonEncodedText.Encode("include_global_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndexSettings = System.Text.Json.JsonEncodedText.Encode("index_settings"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropPartial = System.Text.Json.JsonEncodedText.Encode("partial"); + private static readonly System.Text.Json.JsonEncodedText PropRenamePattern = System.Text.Json.JsonEncodedText.Encode("rename_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropRenameReplacement = System.Text.Json.JsonEncodedText.Encode("rename_replacement"); + + public override Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFeatureStates = default; + LocalJsonValue?> propIgnoreIndexSettings = default; + LocalJsonValue propIgnoreUnavailable = default; + LocalJsonValue propIncludeAliases = default; + LocalJsonValue propIncludeGlobalState = default; + LocalJsonValue propIndexSettings = default; + LocalJsonValue propIndices = default; + LocalJsonValue propPartial = default; + LocalJsonValue propRenamePattern = default; + LocalJsonValue propRenameReplacement = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureStates.TryReadProperty(ref reader, options, PropFeatureStates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreIndexSettings.TryReadProperty(ref reader, options, PropIgnoreIndexSettings, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreUnavailable.TryReadProperty(ref reader, options, PropIgnoreUnavailable, null)) + { + continue; + } + + if (propIncludeAliases.TryReadProperty(ref reader, options, PropIncludeAliases, null)) + { + continue; + } + + if (propIncludeGlobalState.TryReadProperty(ref reader, options, PropIncludeGlobalState, null)) + { + continue; + } + + if (propIndexSettings.TryReadProperty(ref reader, options, PropIndexSettings, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propPartial.TryReadProperty(ref reader, options, PropPartial, null)) + { + continue; + } + + if (propRenamePattern.TryReadProperty(ref reader, options, PropRenamePattern, null)) + { + continue; + } + + if (propRenameReplacement.TryReadProperty(ref reader, options, PropRenameReplacement, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureStates = propFeatureStates.Value, + IgnoreIndexSettings = propIgnoreIndexSettings.Value, + IgnoreUnavailable = propIgnoreUnavailable.Value, + IncludeAliases = propIncludeAliases.Value, + IncludeGlobalState = propIncludeGlobalState.Value, + IndexSettings = propIndexSettings.Value, + Indices = propIndices.Value, + Partial = propPartial.Value, + RenamePattern = propRenamePattern.Value, + RenameReplacement = propRenameReplacement.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureStates, value.FeatureStates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreIndexSettings, value.IgnoreIndexSettings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreUnavailable, value.IgnoreUnavailable, null, null); + writer.WriteProperty(options, PropIncludeAliases, value.IncludeAliases, null, null); + writer.WriteProperty(options, PropIncludeGlobalState, value.IncludeGlobalState, null, null); + writer.WriteProperty(options, PropIndexSettings, value.IndexSettings, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropPartial, value.Partial, null, null); + writer.WriteProperty(options, PropRenamePattern, value.RenamePattern, null, null); + writer.WriteProperty(options, PropRenameReplacement, value.RenameReplacement, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Restore a snapshot. @@ -73,15 +193,27 @@ public sealed partial class RestoreRequestParameters : RequestParameters /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. /// /// -public sealed partial class RestoreRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestConverter))] +public sealed partial class RestoreRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public RestoreRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) { } +#if NET7_0_OR_GREATER + public RestoreRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RestoreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRestore; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotRestore; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -89,38 +221,193 @@ public RestoreRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Cli /// /// - /// Explicit operation timeout for connection to master node + /// The name of the repository to restore a snapshot from. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Repository { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The name of the snapshot to restore. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Snapshot { get => P("snapshot"); set => PR("snapshot", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Should this request wait until the operation has completed before returning + /// If true, the request returns a response when the restore operation completes. + /// The operation is complete when it finishes all attempts to recover primary shards for restored indices. + /// This applies even if one or more of the recovery attempts fail. + /// + /// + /// If false, the request returns a response when the restore operation initializes. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } - [JsonInclude, JsonPropertyName("feature_states")] - public ICollection? FeatureStates { get; set; } - [JsonInclude, JsonPropertyName("ignore_index_settings")] - public ICollection? IgnoreIndexSettings { get; set; } - [JsonInclude, JsonPropertyName("ignore_unavailable")] + + /// + /// + /// The feature states to restore. + /// If include_global_state is true, the request restores all feature states in the snapshot by default. + /// If include_global_state is false, the request restores no feature states by default. + /// Note that specifying an empty array will result in the default behavior. + /// To restore no feature states, regardless of the include_global_state value, specify an array containing only the value none (["none"]). + /// + /// + public System.Collections.Generic.ICollection? FeatureStates { get; set; } + + /// + /// + /// The index settings to not restore from the snapshot. + /// You can't use this option to ignore index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public System.Collections.Generic.ICollection? IgnoreIndexSettings { get; set; } + + /// + /// + /// If true, the request ignores any index or data stream in indices that's missing from the snapshot. + /// If false, the request returns an error for any missing index or data stream. + /// + /// public bool? IgnoreUnavailable { get; set; } - [JsonInclude, JsonPropertyName("include_aliases")] + + /// + /// + /// If true, the request restores aliases for any restored data streams and indices. + /// If false, the request doesn’t restore aliases. + /// + /// public bool? IncludeAliases { get; set; } - [JsonInclude, JsonPropertyName("include_global_state")] + + /// + /// + /// If true, restore the cluster state. The cluster state includes: + /// + /// + /// + /// + /// Persistent cluster settings + /// + /// + /// + /// + /// Index templates + /// + /// + /// + /// + /// Legacy index templates + /// + /// + /// + /// + /// Ingest pipelines + /// + /// + /// + /// + /// Index lifecycle management (ILM) policies + /// + /// + /// + /// + /// Stored scripts + /// + /// + /// + /// + /// For snapshots taken after 7.12.0, feature states + /// + /// + /// + /// + /// If include_global_state is true, the restore operation merges the legacy index templates in your cluster with the templates contained in the snapshot, replacing any existing ones whose name matches one in the snapshot. + /// It completely removes all persistent settings, non-legacy index templates, ingest pipelines, and ILM lifecycle policies that exist in your cluster and replaces them with the corresponding items from the snapshot. + /// + /// + /// Use the feature_states parameter to configure how feature states are restored. + /// + /// + /// If include_global_state is true and a snapshot was created without a global state then the restore request will fail. + /// + /// public bool? IncludeGlobalState { get; set; } - [JsonInclude, JsonPropertyName("index_settings")] + + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexSettings { get; set; } - [JsonInclude, JsonPropertyName("indices")] + + /// + /// + /// A comma-separated list of indices and data streams to restore. + /// It supports a multi-target syntax. + /// The default behavior is all regular indices and regular data streams in the snapshot. + /// + /// + /// You can't use this parameter to restore system indices or system data streams. + /// Use feature_states instead. + /// + /// public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } - [JsonInclude, JsonPropertyName("partial")] + + /// + /// + /// If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// + /// + /// If true, it allows restoring a partial snapshot of indices with unavailable shards. + /// Only shards that were successfully included in the snapshot will be restored. + /// All missing shards will be recreated as empty. + /// + /// public bool? Partial { get; set; } - [JsonInclude, JsonPropertyName("rename_pattern")] + + /// + /// + /// A rename pattern to apply to restored data streams and indices. + /// Data streams and indices matching the rename pattern will be renamed according to rename_replacement. + /// + /// + /// The rename pattern is applied as defined by the regular expression that supports referencing the original text, according to the appendReplacement logic. + /// + /// public string? RenamePattern { get; set; } - [JsonInclude, JsonPropertyName("rename_replacement")] + + /// + /// + /// The rename replacement string that is used with the rename_pattern. + /// + /// public string? RenameReplacement { get; set; } } @@ -150,202 +437,396 @@ public RestoreRequest(Elastic.Clients.Elasticsearch.Name repository, Elastic.Cli /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. /// /// -public sealed partial class RestoreRequestDescriptor : RequestDescriptor, RestoreRequestParameters> +public readonly partial struct RestoreRequestDescriptor { - internal RestoreRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest Instance { get; init; } - public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRestore; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(repository, snapshot); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RestoreRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "snapshot.restore"; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor descriptor) => descriptor.Instance; - public RestoreRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public RestoreRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The name of the repository to restore a snapshot from. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Repository = value; + return this; + } - public RestoreRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + /// + /// + /// The name of the snapshot to restore. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("repository", repository); - return Self; + Instance.Snapshot = value; + return this; } - public RestoreRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.MasterTimeout = value; + return this; } - private ICollection? FeatureStatesValue { get; set; } - private ICollection? IgnoreIndexSettingsValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } - private bool? IncludeAliasesValue { get; set; } - private bool? IncludeGlobalStateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexSettingsDescriptor { get; set; } - private Action> IndexSettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? PartialValue { get; set; } - private string? RenamePatternValue { get; set; } - private string? RenameReplacementValue { get; set; } + /// + /// + /// If true, the request returns a response when the restore operation completes. + /// The operation is complete when it finishes all attempts to recover primary shards for restored indices. + /// This applies even if one or more of the recovery attempts fail. + /// + /// + /// If false, the request returns a response when the restore operation initializes. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } - public RestoreRequestDescriptor FeatureStates(ICollection? featureStates) + /// + /// + /// The feature states to restore. + /// If include_global_state is true, the request restores all feature states in the snapshot by default. + /// If include_global_state is false, the request restores no feature states by default. + /// Note that specifying an empty array will result in the default behavior. + /// To restore no feature states, regardless of the include_global_state value, specify an array containing only the value none (["none"]). + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FeatureStates(System.Collections.Generic.ICollection? value) { - FeatureStatesValue = featureStates; - return Self; + Instance.FeatureStates = value; + return this; } - public RestoreRequestDescriptor IgnoreIndexSettings(ICollection? ignoreIndexSettings) + /// + /// + /// The feature states to restore. + /// If include_global_state is true, the request restores all feature states in the snapshot by default. + /// If include_global_state is false, the request restores no feature states by default. + /// Note that specifying an empty array will result in the default behavior. + /// To restore no feature states, regardless of the include_global_state value, specify an array containing only the value none (["none"]). + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FeatureStates(params string[] values) { - IgnoreIndexSettingsValue = ignoreIndexSettings; - return Self; + Instance.FeatureStates = [.. values]; + return this; } - public RestoreRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + /// + /// + /// The index settings to not restore from the snapshot. + /// You can't use this option to ignore index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreIndexSettings(System.Collections.Generic.ICollection? value) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.IgnoreIndexSettings = value; + return this; } - public RestoreRequestDescriptor IncludeAliases(bool? includeAliases = true) + /// + /// + /// The index settings to not restore from the snapshot. + /// You can't use this option to ignore index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreIndexSettings(params string[] values) { - IncludeAliasesValue = includeAliases; - return Self; + Instance.IgnoreIndexSettings = [.. values]; + return this; } - public RestoreRequestDescriptor IncludeGlobalState(bool? includeGlobalState = true) + /// + /// + /// If true, the request ignores any index or data stream in indices that's missing from the snapshot. + /// If false, the request returns an error for any missing index or data stream. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreUnavailable(bool? value = true) { - IncludeGlobalStateValue = includeGlobalState; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? indexSettings) + /// + /// + /// If true, the request restores aliases for any restored data streams and indices. + /// If false, the request doesn’t restore aliases. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IncludeAliases(bool? value = true) { - IndexSettingsDescriptor = null; - IndexSettingsDescriptorAction = null; - IndexSettingsValue = indexSettings; - return Self; + Instance.IncludeAliases = value; + return this; } - public RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// If true, restore the cluster state. The cluster state includes: + /// + /// + /// + /// + /// Persistent cluster settings + /// + /// + /// + /// + /// Index templates + /// + /// + /// + /// + /// Legacy index templates + /// + /// + /// + /// + /// Ingest pipelines + /// + /// + /// + /// + /// Index lifecycle management (ILM) policies + /// + /// + /// + /// + /// Stored scripts + /// + /// + /// + /// + /// For snapshots taken after 7.12.0, feature states + /// + /// + /// + /// + /// If include_global_state is true, the restore operation merges the legacy index templates in your cluster with the templates contained in the snapshot, replacing any existing ones whose name matches one in the snapshot. + /// It completely removes all persistent settings, non-legacy index templates, ingest pipelines, and ILM lifecycle policies that exist in your cluster and replaces them with the corresponding items from the snapshot. + /// + /// + /// Use the feature_states parameter to configure how feature states are restored. + /// + /// + /// If include_global_state is true and a snapshot was created without a global state then the restore request will fail. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IncludeGlobalState(bool? value = true) { - IndexSettingsValue = null; - IndexSettingsDescriptorAction = null; - IndexSettingsDescriptor = descriptor; - return Self; + Instance.IncludeGlobalState = value; + return this; } - public RestoreRequestDescriptor IndexSettings(Action> configure) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - IndexSettingsValue = null; - IndexSettingsDescriptor = null; - IndexSettingsDescriptorAction = configure; - return Self; + Instance.IndexSettings = value; + return this; } - public RestoreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings() { - IndicesValue = indices; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public RestoreRequestDescriptor Partial(bool? partial = true) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings(System.Action? action) { - PartialValue = partial; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public RestoreRequestDescriptor RenamePattern(string? renamePattern) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings(System.Action>? action) { - RenamePatternValue = renamePattern; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public RestoreRequestDescriptor RenameReplacement(string? renameReplacement) + /// + /// + /// A comma-separated list of indices and data streams to restore. + /// It supports a multi-target syntax. + /// The default behavior is all regular indices and regular data streams in the snapshot. + /// + /// + /// You can't use this parameter to restore system indices or system data streams. + /// Use feature_states instead. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - RenameReplacementValue = renameReplacement; - return Self; + Instance.Indices = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// + /// + /// If true, it allows restoring a partial snapshot of indices with unavailable shards. + /// Only shards that were successfully included in the snapshot will be restored. + /// All missing shards will be recreated as empty. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Partial(bool? value = true) { - writer.WriteStartObject(); - if (FeatureStatesValue is not null) - { - writer.WritePropertyName("feature_states"); - JsonSerializer.Serialize(writer, FeatureStatesValue, options); - } + Instance.Partial = value; + return this; + } - if (IgnoreIndexSettingsValue is not null) - { - writer.WritePropertyName("ignore_index_settings"); - JsonSerializer.Serialize(writer, IgnoreIndexSettingsValue, options); - } + /// + /// + /// A rename pattern to apply to restored data streams and indices. + /// Data streams and indices matching the rename pattern will be renamed according to rename_replacement. + /// + /// + /// The rename pattern is applied as defined by the regular expression that supports referencing the original text, according to the appendReplacement logic. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RenamePattern(string? value) + { + Instance.RenamePattern = value; + return this; + } - if (IgnoreUnavailableValue.HasValue) - { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); - } + /// + /// + /// The rename replacement string that is used with the rename_pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RenameReplacement(string? value) + { + Instance.RenameReplacement = value; + return this; + } - if (IncludeAliasesValue.HasValue) - { - writer.WritePropertyName("include_aliases"); - writer.WriteBooleanValue(IncludeAliasesValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IncludeGlobalStateValue.HasValue) - { - writer.WritePropertyName("include_global_state"); - writer.WriteBooleanValue(IncludeGlobalStateValue.Value); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexSettingsDescriptor is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, IndexSettingsDescriptor, options); - } - else if (IndexSettingsDescriptorAction is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexSettingsDescriptorAction), options); - } - else if (IndexSettingsValue is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, IndexSettingsValue, options); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PartialValue.HasValue) - { - writer.WritePropertyName("partial"); - writer.WriteBooleanValue(PartialValue.Value); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(RenamePatternValue)) - { - writer.WritePropertyName("rename_pattern"); - writer.WriteStringValue(RenamePatternValue); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (!string.IsNullOrEmpty(RenameReplacementValue)) - { - writer.WritePropertyName("rename_replacement"); - writer.WriteStringValue(RenameReplacementValue); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -375,201 +856,379 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. /// /// -public sealed partial class RestoreRequestDescriptor : RequestDescriptor +public readonly partial struct RestoreRequestDescriptor { - internal RestoreRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest Instance { get; init; } - public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) : base(r => r.Required("repository", repository).Required("snapshot", snapshot)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotRestore; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(repository, snapshot); + } - internal override string OperationName => "snapshot.restore"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public RestoreRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public RestoreRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public RestoreRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor descriptor) => descriptor.Instance; - public RestoreRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name repository) + /// + /// + /// The name of the repository to restore a snapshot from. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("repository", repository); - return Self; + Instance.Repository = value; + return this; } - public RestoreRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name snapshot) + /// + /// + /// The name of the snapshot to restore. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Name value) { - RouteValues.Required("snapshot", snapshot); - return Self; + Instance.Snapshot = value; + return this; } - private ICollection? FeatureStatesValue { get; set; } - private ICollection? IgnoreIndexSettingsValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } - private bool? IncludeAliasesValue { get; set; } - private bool? IncludeGlobalStateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexSettingsDescriptor { get; set; } - private Action IndexSettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? PartialValue { get; set; } - private string? RenamePatternValue { get; set; } - private string? RenameReplacementValue { get; set; } + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public RestoreRequestDescriptor FeatureStates(ICollection? featureStates) + /// + /// + /// If true, the request returns a response when the restore operation completes. + /// The operation is complete when it finishes all attempts to recover primary shards for restored indices. + /// This applies even if one or more of the recovery attempts fail. + /// + /// + /// If false, the request returns a response when the restore operation initializes. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor WaitForCompletion(bool? value = true) { - FeatureStatesValue = featureStates; - return Self; + Instance.WaitForCompletion = value; + return this; } - public RestoreRequestDescriptor IgnoreIndexSettings(ICollection? ignoreIndexSettings) + /// + /// + /// The feature states to restore. + /// If include_global_state is true, the request restores all feature states in the snapshot by default. + /// If include_global_state is false, the request restores no feature states by default. + /// Note that specifying an empty array will result in the default behavior. + /// To restore no feature states, regardless of the include_global_state value, specify an array containing only the value none (["none"]). + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FeatureStates(System.Collections.Generic.ICollection? value) { - IgnoreIndexSettingsValue = ignoreIndexSettings; - return Self; + Instance.FeatureStates = value; + return this; } - public RestoreRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + /// + /// + /// The feature states to restore. + /// If include_global_state is true, the request restores all feature states in the snapshot by default. + /// If include_global_state is false, the request restores no feature states by default. + /// Note that specifying an empty array will result in the default behavior. + /// To restore no feature states, regardless of the include_global_state value, specify an array containing only the value none (["none"]). + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FeatureStates(params string[] values) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.FeatureStates = [.. values]; + return this; } - public RestoreRequestDescriptor IncludeAliases(bool? includeAliases = true) + /// + /// + /// The index settings to not restore from the snapshot. + /// You can't use this option to ignore index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreIndexSettings(System.Collections.Generic.ICollection? value) { - IncludeAliasesValue = includeAliases; - return Self; + Instance.IgnoreIndexSettings = value; + return this; } - public RestoreRequestDescriptor IncludeGlobalState(bool? includeGlobalState = true) + /// + /// + /// The index settings to not restore from the snapshot. + /// You can't use this option to ignore index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreIndexSettings(params string[] values) { - IncludeGlobalStateValue = includeGlobalState; - return Self; + Instance.IgnoreIndexSettings = [.. values]; + return this; } - public RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? indexSettings) + /// + /// + /// If true, the request ignores any index or data stream in indices that's missing from the snapshot. + /// If false, the request returns an error for any missing index or data stream. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IgnoreUnavailable(bool? value = true) { - IndexSettingsDescriptor = null; - IndexSettingsDescriptorAction = null; - IndexSettingsValue = indexSettings; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// If true, the request restores aliases for any restored data streams and indices. + /// If false, the request doesn’t restore aliases. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IncludeAliases(bool? value = true) { - IndexSettingsValue = null; - IndexSettingsDescriptorAction = null; - IndexSettingsDescriptor = descriptor; - return Self; + Instance.IncludeAliases = value; + return this; } - public RestoreRequestDescriptor IndexSettings(Action configure) + /// + /// + /// If true, restore the cluster state. The cluster state includes: + /// + /// + /// + /// + /// Persistent cluster settings + /// + /// + /// + /// + /// Index templates + /// + /// + /// + /// + /// Legacy index templates + /// + /// + /// + /// + /// Ingest pipelines + /// + /// + /// + /// + /// Index lifecycle management (ILM) policies + /// + /// + /// + /// + /// Stored scripts + /// + /// + /// + /// + /// For snapshots taken after 7.12.0, feature states + /// + /// + /// + /// + /// If include_global_state is true, the restore operation merges the legacy index templates in your cluster with the templates contained in the snapshot, replacing any existing ones whose name matches one in the snapshot. + /// It completely removes all persistent settings, non-legacy index templates, ingest pipelines, and ILM lifecycle policies that exist in your cluster and replaces them with the corresponding items from the snapshot. + /// + /// + /// Use the feature_states parameter to configure how feature states are restored. + /// + /// + /// If include_global_state is true and a snapshot was created without a global state then the restore request will fail. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IncludeGlobalState(bool? value = true) { - IndexSettingsValue = null; - IndexSettingsDescriptor = null; - IndexSettingsDescriptorAction = configure; - return Self; + Instance.IncludeGlobalState = value; + return this; } - public RestoreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - IndicesValue = indices; - return Self; + Instance.IndexSettings = value; + return this; } - public RestoreRequestDescriptor Partial(bool? partial = true) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings() { - PartialValue = partial; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public RestoreRequestDescriptor RenamePattern(string? renamePattern) + /// + /// + /// Index settings to add or change in restored indices, including backing indices. + /// You can't use this option to change index.number_of_shards. + /// + /// + /// For data streams, this option applies only to restored backing indices. + /// New backing indices are configured using the data stream's matching index template. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor IndexSettings(System.Action>? action) { - RenamePatternValue = renamePattern; - return Self; + Instance.IndexSettings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public RestoreRequestDescriptor RenameReplacement(string? renameReplacement) + /// + /// + /// A comma-separated list of indices and data streams to restore. + /// It supports a multi-target syntax. + /// The default behavior is all regular indices and regular data streams in the snapshot. + /// + /// + /// You can't use this parameter to restore system indices or system data streams. + /// Use feature_states instead. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - RenameReplacementValue = renameReplacement; - return Self; + Instance.Indices = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. + /// + /// + /// If true, it allows restoring a partial snapshot of indices with unavailable shards. + /// Only shards that were successfully included in the snapshot will be restored. + /// All missing shards will be recreated as empty. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Partial(bool? value = true) { - writer.WriteStartObject(); - if (FeatureStatesValue is not null) - { - writer.WritePropertyName("feature_states"); - JsonSerializer.Serialize(writer, FeatureStatesValue, options); - } + Instance.Partial = value; + return this; + } - if (IgnoreIndexSettingsValue is not null) - { - writer.WritePropertyName("ignore_index_settings"); - JsonSerializer.Serialize(writer, IgnoreIndexSettingsValue, options); - } + /// + /// + /// A rename pattern to apply to restored data streams and indices. + /// Data streams and indices matching the rename pattern will be renamed according to rename_replacement. + /// + /// + /// The rename pattern is applied as defined by the regular expression that supports referencing the original text, according to the appendReplacement logic. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RenamePattern(string? value) + { + Instance.RenamePattern = value; + return this; + } - if (IgnoreUnavailableValue.HasValue) - { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); - } + /// + /// + /// The rename replacement string that is used with the rename_pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RenameReplacement(string? value) + { + Instance.RenameReplacement = value; + return this; + } - if (IncludeAliasesValue.HasValue) - { - writer.WritePropertyName("include_aliases"); - writer.WriteBooleanValue(IncludeAliasesValue.Value); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (IncludeGlobalStateValue.HasValue) - { - writer.WritePropertyName("include_global_state"); - writer.WriteBooleanValue(IncludeGlobalStateValue.Value); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (IndexSettingsDescriptor is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, IndexSettingsDescriptor, options); - } - else if (IndexSettingsDescriptorAction is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexSettingsDescriptorAction), options); - } - else if (IndexSettingsValue is not null) - { - writer.WritePropertyName("index_settings"); - JsonSerializer.Serialize(writer, IndexSettingsValue, options); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (PartialValue.HasValue) - { - writer.WritePropertyName("partial"); - writer.WriteBooleanValue(PartialValue.Value); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(RenamePatternValue)) - { - writer.WritePropertyName("rename_pattern"); - writer.WriteStringValue(RenamePatternValue); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (!string.IsNullOrEmpty(RenameReplacementValue)) - { - writer.WritePropertyName("rename_replacement"); - writer.WriteStringValue(RenameReplacementValue); - } + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreResponse.g.cs index 1bf5db7079d..c38e4cd15e3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/RestoreResponse.g.cs @@ -17,19 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class RestoreResponse : ElasticsearchResponse +internal sealed partial class RestoreResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccepted = System.Text.Json.JsonEncodedText.Encode("accepted"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + + public override Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccepted = default; + LocalJsonValue propSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccepted.TryReadProperty(ref reader, options, PropAccepted, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Accepted = propAccepted.Value, + Snapshot = propSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccepted, value.Accepted, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RestoreResponseConverter))] +public sealed partial class RestoreResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("accepted")] - public bool? Accepted { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestore? Snapshot { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RestoreResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RestoreResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? Accepted { get; set; } + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestore? Snapshot { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusRequest.g.cs index 11e6df51119..392a7167536 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusRequest.g.cs @@ -17,44 +17,76 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class SnapshotStatusRequestParameters : RequestParameters +public sealed partial class SnapshotStatusRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + /// If false, the request returns an error for any snapshots that are unavailable. + /// If true, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned. /// /// public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class SnapshotStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the snapshot status. /// Get a detailed description of the current state for each shard participating in the snapshot. +/// +/// /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. /// /// +/// If you omit the <snapshot> request path parameter, the request retrieves information only for currently running snapshots. +/// This usage is preferred. +/// If needed, you can specify <repository> and <snapshot> to retrieve information for specific snapshots, even if they're not currently running. +/// +/// /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. /// The API requires a read from the repository for each shard in each snapshot. /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). @@ -64,12 +96,9 @@ public sealed partial class SnapshotStatusRequestParameters : RequestParameters /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. /// /// -public sealed partial class SnapshotStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestConverter))] +public sealed partial class SnapshotStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - public SnapshotStatusRequest() - { - } - public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository) : base(r => r.Optional("repository", repository)) { } @@ -77,10 +106,25 @@ public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository) : b public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot) : base(r => r.Optional("repository", repository).Optional("snapshot", snapshot)) { } +#if NET7_0_OR_GREATER + public SnapshotStatusRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public SnapshotStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotStatus; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -88,18 +132,36 @@ public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository, Ela /// /// - /// Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + /// The snapshot repository name used to limit the request. + /// It supports wildcards (*) if <snapshot> isn't specified. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Repository { get => P("repository"); set => PO("repository", value); } + + /// + /// + /// A comma-separated list of snapshots to retrieve status for. + /// The default is currently running snapshots. + /// Wildcards (*) are not supported. + /// + /// + public Elastic.Clients.Elasticsearch.Names? Snapshot { get => P("snapshot"); set => PO("snapshot", value); } + + /// + /// + /// If false, the request returns an error for any snapshots that are unavailable. + /// If true, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -107,10 +169,17 @@ public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository, Ela /// /// Get the snapshot status. /// Get a detailed description of the current state for each shard participating in the snapshot. +/// +/// /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. /// /// +/// If you omit the <snapshot> request path parameter, the request retrieves information only for currently running snapshots. +/// This usage is preferred. +/// If needed, you can specify <repository> and <snapshot> to retrieve information for specific snapshots, even if they're not currently running. +/// +/// /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. /// The API requires a read from the repository for each shard in each snapshot. /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). @@ -120,42 +189,136 @@ public SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Name? repository, Ela /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. /// /// -public sealed partial class SnapshotStatusRequestDescriptor : RequestDescriptor +public readonly partial struct SnapshotStatusRequestDescriptor { - internal SnapshotStatusRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest instance) + { + Instance = instance; + } - public SnapshotStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot) : base(r => r.Optional("repository", repository).Optional("snapshot", snapshot)) + public SnapshotStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Name? repository) { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(repository); + } + + public SnapshotStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(repository, snapshot); } public SnapshotStatusRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotStatus; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The snapshot repository name used to limit the request. + /// It supports wildcards (*) if <snapshot> isn't specified. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Repository = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list of snapshots to retrieve status for. + /// The default is currently running snapshots. + /// Wildcards (*) are not supported. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.Snapshot = value; + return this; + } - internal override string OperationName => "snapshot.status"; + /// + /// + /// If false, the request returns an error for any snapshots that are unavailable. + /// If true, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } - public SnapshotStatusRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public SnapshotStatusRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public SnapshotStatusRequestDescriptor Repository(Elastic.Clients.Elasticsearch.Name? repository) + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor SourceQueryString(string? value) { - RouteValues.Optional("repository", repository); - return Self; + Instance.SourceQueryString = value; + return this; } - public SnapshotStatusRequestDescriptor Snapshot(Elastic.Clients.Elasticsearch.Names? snapshot) + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("snapshot", snapshot); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusResponse.g.cs index e77aa967106..c9bb650ff41 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/SnapshotStatusResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class SnapshotStatusResponse : ElasticsearchResponse +internal sealed partial class SnapshotStatusResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("snapshots")] - public IReadOnlyCollection Snapshots { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropSnapshots = System.Text.Json.JsonEncodedText.Encode("snapshots"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propSnapshots = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSnapshots.TryReadProperty(ref reader, options, PropSnapshots, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Snapshots = propSnapshots.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSnapshots, value.Snapshots, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponseConverter))] +public sealed partial class SnapshotStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Snapshots { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryRequest.g.cs index e6100f9e2f9..5a7fdeede4c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryRequest.g.cs @@ -17,51 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class VerifyRepositoryRequestParameters : RequestParameters +public sealed partial class VerifyRepositoryRequestParameters : Elastic.Transport.RequestParameters { /// /// - /// Explicit operation timeout for connection to master node + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class VerifyRepositoryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Verify a snapshot repository. /// Check for common misconfigurations in a snapshot repository. /// /// -public sealed partial class VerifyRepositoryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestConverter))] +public sealed partial class VerifyRepositoryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) { } +#if NET7_0_OR_GREATER + public VerifyRepositoryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotVerifyRepository; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotVerifyRepository; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -69,18 +107,31 @@ public VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// /// - /// Explicit operation timeout for connection to master node + /// The name of the snapshot repository to verify. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get => P("repository"); set => PR("repository", value); } + + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// /// - /// Explicit operation timeout + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -90,32 +141,114 @@ public VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Name name) : base(r /// Check for common misconfigurations in a snapshot repository. /// /// -public sealed partial class VerifyRepositoryRequestDescriptor : RequestDescriptor +public readonly partial struct VerifyRepositoryRequestDescriptor { - internal VerifyRepositoryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest Instance { get; init; } - public VerifyRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("repository", name)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VerifyRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotVerifyRepository; + public VerifyRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest(name); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public VerifyRepositoryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest instance) => new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "snapshot.verify_repository"; + /// + /// + /// The name of the snapshot repository to verify. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; + } - public VerifyRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public VerifyRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for the master node. + /// If the master node is not available before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + /// If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public VerifyRepositoryRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("repository", name); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryResponse.g.cs index 8ebe48523d7..66540df4d6c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Snapshot/VerifyRepositoryResponse.g.cs @@ -17,17 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class VerifyRepositoryResponse : ElasticsearchResponse +internal sealed partial class VerifyRepositoryResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponseConverter))] +public sealed partial class VerifyRepositoryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VerifyRepositoryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VerifyRepositoryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Information about the nodes connected to the snapshot repository. + /// The key is the ID of the node. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleRequest.g.cs index 73128b67ad4..79c3b54d7a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class DeleteLifecycleRequestParameters : RequestParameters +public sealed partial class DeleteLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class DeleteLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a policy. @@ -56,27 +78,49 @@ public sealed partial class DeleteLifecycleRequestParameters : RequestParameters /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. /// /// -public sealed partial class DeleteLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestConverter))] +public sealed partial class DeleteLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) { } +#if NET7_0_OR_GREATER + public DeleteLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementDeleteLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementDeleteLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "slm.delete_lifecycle"; + /// + /// + /// The id of the snapshot lifecycle policy to remove + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name PolicyId { get => P("policy_id"); set => PR("policy_id", value); } + /// /// /// The period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -85,7 +129,6 @@ public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : bas /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -96,32 +139,112 @@ public DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : bas /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. /// /// -public sealed partial class DeleteLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteLifecycleRequestDescriptor { - internal DeleteLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest Instance { get; init; } - public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementDeleteLifecycle; + public DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) + { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest(policyId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "slm.delete_lifecycle"; + /// + /// + /// The id of the snapshot lifecycle policy to remove + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name value) + { + Instance.PolicyId = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public DeleteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public DeleteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name policyId) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("policy_id", policyId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleResponse.g.cs index ca9286d517a..5a77c30c0d4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/DeleteLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class DeleteLifecycleResponse : ElasticsearchResponse +internal sealed partial class DeleteLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponseConverter))] +public sealed partial class DeleteLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleRequest.g.cs index c16b8ed0aae..ba68d566853 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class ExecuteLifecycleRequestParameters : RequestParameters +public sealed partial class ExecuteLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class ExecuteLifecycleRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ExecuteLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Run a policy. @@ -56,27 +78,49 @@ public sealed partial class ExecuteLifecycleRequestParameters : RequestParameter /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. /// /// -public sealed partial class ExecuteLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestConverter))] +public sealed partial class ExecuteLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) { } +#if NET7_0_OR_GREATER + public ExecuteLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementExecuteLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementExecuteLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => false; internal override string OperationName => "slm.execute_lifecycle"; + /// + /// + /// The id of the snapshot lifecycle policy to be executed + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name PolicyId { get => P("policy_id"); set => PR("policy_id", value); } + /// /// /// The period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -85,7 +129,6 @@ public ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : ba /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -96,32 +139,112 @@ public ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : ba /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. /// /// -public sealed partial class ExecuteLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct ExecuteLifecycleRequestDescriptor { - internal ExecuteLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest Instance { get; init; } - public ExecuteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecuteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementExecuteLifecycle; + public ExecuteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) + { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest(policyId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ExecuteLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "slm.execute_lifecycle"; + /// + /// + /// The id of the snapshot lifecycle policy to be executed + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name value) + { + Instance.PolicyId = value; + return this; + } + + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - public ExecuteLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public ExecuteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ExecuteLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name policyId) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("policy_id", policyId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleResponse.g.cs index ef39b567457..dcd05c99a8a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteLifecycleResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class ExecuteLifecycleResponse : ElasticsearchResponse +internal sealed partial class ExecuteLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("snapshot_name")] - public string SnapshotName { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropSnapshotName = System.Text.Json.JsonEncodedText.Encode("snapshot_name"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSnapshotName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSnapshotName.TryReadProperty(ref reader, options, PropSnapshotName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SnapshotName = propSnapshotName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSnapshotName, value.SnapshotName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponseConverter))] +public sealed partial class ExecuteLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecuteLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecuteLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string SnapshotName { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionRequest.g.cs index c4e9c78952a..289a8205ae7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class ExecuteRetentionRequestParameters : RequestParameters +public sealed partial class ExecuteRetentionRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,6 +42,35 @@ public sealed partial class ExecuteRetentionRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ExecuteRetentionRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Run a retention policy. @@ -56,11 +78,28 @@ public sealed partial class ExecuteRetentionRequestParameters : RequestParameter /// The retention policy is normally applied according to its schedule. /// /// -public sealed partial class ExecuteRetentionRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestConverter))] +public sealed partial class ExecuteRetentionRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementExecuteRetention; +#if NET7_0_OR_GREATER + public ExecuteRetentionRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ExecuteRetentionRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementExecuteRetention; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -72,7 +111,6 @@ public sealed partial class ExecuteRetentionRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -81,7 +119,6 @@ public sealed partial class ExecuteRetentionRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -92,26 +129,100 @@ public sealed partial class ExecuteRetentionRequest : PlainRequest /// -public sealed partial class ExecuteRetentionRequestDescriptor : RequestDescriptor +public readonly partial struct ExecuteRetentionRequestDescriptor { - internal ExecuteRetentionRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecuteRetentionRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest instance) + { + Instance = instance; + } public ExecuteRetentionRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementExecuteRetention; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "slm.execute_retention"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public ExecuteRetentionRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public ExecuteRetentionRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionResponse.g.cs index 42e6e3e5727..f7c8142ffff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/ExecuteRetentionResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class ExecuteRetentionResponse : ElasticsearchResponse +internal sealed partial class ExecuteRetentionResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponseConverter))] +public sealed partial class ExecuteRetentionResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecuteRetentionResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecuteRetentionResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleRequest.g.cs index 94b96f6bd9d..0242913bbe3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetLifecycleRequestParameters : RequestParameters +public sealed partial class GetLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -49,37 +42,84 @@ public sealed partial class GetLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get policy information. /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. /// /// -public sealed partial class GetLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestConverter))] +public sealed partial class GetLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Names? policyId) : base(r => r.Optional("policy_id", policyId)) + { + } +#if NET7_0_OR_GREATER public GetLifecycleRequest() { } - - public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Names? policyId) : base(r => r.Optional("policy_id", policyId)) +#endif +#if !NET7_0_OR_GREATER + public GetLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementGetLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "slm.get_lifecycle"; + /// + /// + /// Comma-separated list of snapshot lifecycle policies to retrieve + /// + /// + public Elastic.Clients.Elasticsearch.Names? PolicyId { get => P("policy_id"); set => PO("policy_id", value); } + /// /// /// The period to wait for a connection to the master node. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -88,7 +128,6 @@ public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Names? policyId) : base /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -98,36 +137,116 @@ public GetLifecycleRequest(Elastic.Clients.Elasticsearch.Names? policyId) : base /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. /// /// -public sealed partial class GetLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct GetLifecycleRequestDescriptor { - internal GetLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest instance) + { + Instance = instance; + } - public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Names? policyId) : base(r => r.Optional("policy_id", policyId)) + public GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Names? policyId) { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(policyId); } public GetLifecycleRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetLifecycle; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Comma-separated list of snapshot lifecycle policies to retrieve + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.PolicyId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override string OperationName => "slm.get_lifecycle"; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - public GetLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Names? policyId) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("policy_id", policyId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleResponse.g.cs index 12cd808484b..3144b29fc1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetLifecycleResponse.g.cs @@ -17,21 +17,42 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; +using System; +using System.Linq; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; -using System.Collections.Generic; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetLifecycleResponse : DictionaryResponse +internal sealed partial class GetLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { - public GetLifecycleResponse(IReadOnlyDictionary dictionary) : base(dictionary) + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { Lifecycles = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!) }; } - public GetLifecycleResponse() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteValue(options, value.Lifecycles, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponseConverter))] +public sealed partial class GetLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Lifecycles { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusRequest.g.cs index cca9b56579b..586d2c920e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetSlmStatusRequestParameters : RequestParameters +public sealed partial class GetSlmStatusRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,16 +44,62 @@ public sealed partial class GetSlmStatusRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetSlmStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the snapshot lifecycle management status. /// /// -public sealed partial class GetSlmStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestConverter))] +public sealed partial class GetSlmStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetStatus; +#if NET7_0_OR_GREATER + public GetSlmStatusRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetSlmStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementGetStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -73,7 +112,6 @@ public sealed partial class GetSlmStatusRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -83,7 +121,6 @@ public sealed partial class GetSlmStatusRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -92,26 +129,102 @@ public sealed partial class GetSlmStatusRequest : PlainRequest /// -public sealed partial class GetSlmStatusRequestDescriptor : RequestDescriptor +public readonly partial struct GetSlmStatusRequestDescriptor { - internal GetSlmStatusRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSlmStatusRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest instance) + { + Instance = instance; + } public GetSlmStatusRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetStatus; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "slm.get_status"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public GetSlmStatusRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetSlmStatusRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusResponse.g.cs index c2cc6418284..46c8b04fe60 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetSlmStatusResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetSlmStatusResponse : ElasticsearchResponse +internal sealed partial class GetSlmStatusResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("operation_mode")] - public Elastic.Clients.Elasticsearch.LifecycleOperationMode OperationMode { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropOperationMode = System.Text.Json.JsonEncodedText.Encode("operation_mode"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOperationMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOperationMode.TryReadProperty(ref reader, options, PropOperationMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + OperationMode = propOperationMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOperationMode, value.OperationMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponseConverter))] +public sealed partial class GetSlmStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSlmStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSlmStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LifecycleOperationMode OperationMode { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsRequest.g.cs index 32d4b1a5b6d..3599893c7cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetStatsRequestParameters : RequestParameters +public sealed partial class GetStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,17 +40,63 @@ public sealed partial class GetStatsRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get snapshot lifecycle management statistics. /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. /// /// -public sealed partial class GetStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestConverter))] +public sealed partial class GetStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetStats; +#if NET7_0_OR_GREATER + public GetStatsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementGetStats; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -68,7 +107,6 @@ public sealed partial class GetStatsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -76,7 +114,6 @@ public sealed partial class GetStatsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -86,26 +123,98 @@ public sealed partial class GetStatsRequest : PlainRequest /// -public sealed partial class GetStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetStatsRequestDescriptor { - internal GetStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest instance) + { + Instance = instance; + } public GetStatsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementGetStats; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "slm.get_stats"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public GetStatsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public GetStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsResponse.g.cs index 7174da48a8a..ce49c9f0a80 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/GetStatsResponse.g.cs @@ -17,35 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class GetStatsResponse : ElasticsearchResponse +internal sealed partial class GetStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPolicyStats = System.Text.Json.JsonEncodedText.Encode("policy_stats"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionDeletionTime = System.Text.Json.JsonEncodedText.Encode("retention_deletion_time"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionDeletionTimeMillis = System.Text.Json.JsonEncodedText.Encode("retention_deletion_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionFailed = System.Text.Json.JsonEncodedText.Encode("retention_failed"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionRuns = System.Text.Json.JsonEncodedText.Encode("retention_runs"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionTimedOut = System.Text.Json.JsonEncodedText.Encode("retention_timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotDeletionFailures = System.Text.Json.JsonEncodedText.Encode("total_snapshot_deletion_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsDeleted = System.Text.Json.JsonEncodedText.Encode("total_snapshots_deleted"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsFailed = System.Text.Json.JsonEncodedText.Encode("total_snapshots_failed"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsTaken = System.Text.Json.JsonEncodedText.Encode("total_snapshots_taken"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPolicyStats = default; + LocalJsonValue propRetentionDeletionTime = default; + LocalJsonValue propRetentionDeletionTimeMillis = default; + LocalJsonValue propRetentionFailed = default; + LocalJsonValue propRetentionRuns = default; + LocalJsonValue propRetentionTimedOut = default; + LocalJsonValue propTotalSnapshotDeletionFailures = default; + LocalJsonValue propTotalSnapshotsDeleted = default; + LocalJsonValue propTotalSnapshotsFailed = default; + LocalJsonValue propTotalSnapshotsTaken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicyStats.TryReadProperty(ref reader, options, PropPolicyStats, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRetentionDeletionTime.TryReadProperty(ref reader, options, PropRetentionDeletionTime, null)) + { + continue; + } + + if (propRetentionDeletionTimeMillis.TryReadProperty(ref reader, options, PropRetentionDeletionTimeMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propRetentionFailed.TryReadProperty(ref reader, options, PropRetentionFailed, null)) + { + continue; + } + + if (propRetentionRuns.TryReadProperty(ref reader, options, PropRetentionRuns, null)) + { + continue; + } + + if (propRetentionTimedOut.TryReadProperty(ref reader, options, PropRetentionTimedOut, null)) + { + continue; + } + + if (propTotalSnapshotDeletionFailures.TryReadProperty(ref reader, options, PropTotalSnapshotDeletionFailures, null)) + { + continue; + } + + if (propTotalSnapshotsDeleted.TryReadProperty(ref reader, options, PropTotalSnapshotsDeleted, null)) + { + continue; + } + + if (propTotalSnapshotsFailed.TryReadProperty(ref reader, options, PropTotalSnapshotsFailed, null)) + { + continue; + } + + if (propTotalSnapshotsTaken.TryReadProperty(ref reader, options, PropTotalSnapshotsTaken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PolicyStats = propPolicyStats.Value, + RetentionDeletionTime = propRetentionDeletionTime.Value, + RetentionDeletionTimeMillis = propRetentionDeletionTimeMillis.Value, + RetentionFailed = propRetentionFailed.Value, + RetentionRuns = propRetentionRuns.Value, + RetentionTimedOut = propRetentionTimedOut.Value, + TotalSnapshotDeletionFailures = propTotalSnapshotDeletionFailures.Value, + TotalSnapshotsDeleted = propTotalSnapshotsDeleted.Value, + TotalSnapshotsFailed = propTotalSnapshotsFailed.Value, + TotalSnapshotsTaken = propTotalSnapshotsTaken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicyStats, value.PolicyStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRetentionDeletionTime, value.RetentionDeletionTime, null, null); + writer.WriteProperty(options, PropRetentionDeletionTimeMillis, value.RetentionDeletionTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropRetentionFailed, value.RetentionFailed, null, null); + writer.WriteProperty(options, PropRetentionRuns, value.RetentionRuns, null, null); + writer.WriteProperty(options, PropRetentionTimedOut, value.RetentionTimedOut, null, null); + writer.WriteProperty(options, PropTotalSnapshotDeletionFailures, value.TotalSnapshotDeletionFailures, null, null); + writer.WriteProperty(options, PropTotalSnapshotsDeleted, value.TotalSnapshotsDeleted, null, null); + writer.WriteProperty(options, PropTotalSnapshotsFailed, value.TotalSnapshotsFailed, null, null); + writer.WriteProperty(options, PropTotalSnapshotsTaken, value.TotalSnapshotsTaken, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponseConverter))] +public sealed partial class GetStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("policy_stats")] - public IReadOnlyCollection PolicyStats { get; init; } - [JsonInclude, JsonPropertyName("retention_deletion_time")] - public Elastic.Clients.Elasticsearch.Duration RetentionDeletionTime { get; init; } - [JsonInclude, JsonPropertyName("retention_deletion_time_millis")] - public long RetentionDeletionTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("retention_failed")] - public long RetentionFailed { get; init; } - [JsonInclude, JsonPropertyName("retention_runs")] - public long RetentionRuns { get; init; } - [JsonInclude, JsonPropertyName("retention_timed_out")] - public long RetentionTimedOut { get; init; } - [JsonInclude, JsonPropertyName("total_snapshot_deletion_failures")] - public long TotalSnapshotDeletionFailures { get; init; } - [JsonInclude, JsonPropertyName("total_snapshots_deleted")] - public long TotalSnapshotsDeleted { get; init; } - [JsonInclude, JsonPropertyName("total_snapshots_failed")] - public long TotalSnapshotsFailed { get; init; } - [JsonInclude, JsonPropertyName("total_snapshots_taken")] - public long TotalSnapshotsTaken { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PolicyStats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration RetentionDeletionTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RetentionDeletionTimeMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RetentionFailed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RetentionRuns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RetentionTimedOut { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSnapshotDeletionFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSnapshotsDeleted { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSnapshotsFailed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSnapshotsTaken { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleRequest.g.cs index a474b64957a..0fa8b7000ea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class PutLifecycleRequestParameters : RequestParameters +public sealed partial class PutLifecycleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,6 +44,81 @@ public sealed partial class PutLifecycleRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutLifecycleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropRetention = System.Text.Json.JsonEncodedText.Encode("retention"); + private static readonly System.Text.Json.JsonEncodedText PropSchedule = System.Text.Json.JsonEncodedText.Encode("schedule"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConfig = default; + LocalJsonValue propName = default; + LocalJsonValue propRepository = default; + LocalJsonValue propRetention = default; + LocalJsonValue propSchedule = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propRetention.TryReadProperty(ref reader, options, PropRetention, null)) + { + continue; + } + + if (propSchedule.TryReadProperty(ref reader, options, PropSchedule, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Config = propConfig.Value, + Name = propName.Value, + Repository = propRepository.Value, + Retention = propRetention.Value, + Schedule = propSchedule.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropRetention, value.Retention, null, null); + writer.WriteProperty(options, PropSchedule, value.Schedule, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a policy. @@ -59,20 +127,43 @@ public sealed partial class PutLifecycleRequestParameters : RequestParameters /// Only the latest version of a policy is stored. /// /// -public sealed partial class PutLifecycleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestConverter))] +public sealed partial class PutLifecycleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) { } +#if NET7_0_OR_GREATER + public PutLifecycleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementPutLifecycle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementPutLifecycle; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "slm.put_lifecycle"; + /// + /// + /// The identifier for the snapshot lifecycle policy you want to create or update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name PolicyId { get => P("policy_id"); set => PR("policy_id", value); } + /// /// /// The period to wait for a connection to the master node. @@ -80,7 +171,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -90,7 +180,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// To indicate that the request should never timeout, set it to -1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -98,7 +187,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Configuration for each snapshot created by the policy. /// /// - [JsonInclude, JsonPropertyName("config")] public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? Config { get; set; } /// @@ -106,7 +194,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name. /// /// - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Name? Name { get; set; } /// @@ -114,7 +201,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Repository used to store snapshots created by this policy. This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API. /// /// - [JsonInclude, JsonPropertyName("repository")] public string? Repository { get; set; } /// @@ -122,7 +208,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Retention rules used to retain and delete snapshots created by the policy. /// /// - [JsonInclude, JsonPropertyName("retention")] public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? Retention { get; set; } /// @@ -130,7 +215,6 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately. /// /// - [JsonInclude, JsonPropertyName("schedule")] public string? Schedule { get; set; } } @@ -142,68 +226,98 @@ public PutLifecycleRequest(Elastic.Clients.Elasticsearch.Name policyId) : base(r /// Only the latest version of a policy is stored. /// /// -public sealed partial class PutLifecycleRequestDescriptor : RequestDescriptor +public readonly partial struct PutLifecycleRequestDescriptor { - internal PutLifecycleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest Instance { get; init; } - public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) : base(r => r.Required("policy_id", policyId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementPutLifecycle; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.Name policyId) + { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest(policyId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutLifecycleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "slm.put_lifecycle"; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor descriptor) => descriptor.Instance; - public PutLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public PutLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// The identifier for the snapshot lifecycle policy you want to create or update. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name value) + { + Instance.PolicyId = value; + return this; + } - public PutLifecycleRequestDescriptor PolicyId(Elastic.Clients.Elasticsearch.Name policyId) + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RouteValues.Required("policy_id", policyId); - return Self; + Instance.MasterTimeout = value; + return this; } - private Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor ConfigDescriptor { get; set; } - private Action ConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private string? RepositoryValue { get; set; } - private Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? RetentionValue { get; set; } - private Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor RetentionDescriptor { get; set; } - private Action RetentionDescriptorAction { get; set; } - private string? ScheduleValue { get; set; } + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Configuration for each snapshot created by the policy. /// /// - public PutLifecycleRequestDescriptor Config(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? config) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Config(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? value) { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; + Instance.Config = value; + return this; } - public PutLifecycleRequestDescriptor Config(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor descriptor) + /// + /// + /// Configuration for each snapshot created by the policy. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Config() { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor.Build(null); + return this; } - public PutLifecycleRequestDescriptor Config(Action configure) + /// + /// + /// Configuration for each snapshot created by the policy. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Config(System.Action? action) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor.Build(action); + return this; } /// @@ -211,10 +325,10 @@ public PutLifecycleRequestDescriptor Config(Action /// - public PutLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -222,10 +336,10 @@ public PutLifecycleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? na /// Repository used to store snapshots created by this policy. This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API. /// /// - public PutLifecycleRequestDescriptor Repository(string? repository) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Repository(string? value) { - RepositoryValue = repository; - return Self; + Instance.Repository = value; + return this; } /// @@ -233,28 +347,21 @@ public PutLifecycleRequestDescriptor Repository(string? repository) /// Retention rules used to retain and delete snapshots created by the policy. /// /// - public PutLifecycleRequestDescriptor Retention(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? retention) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Retention(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? value) { - RetentionDescriptor = null; - RetentionDescriptorAction = null; - RetentionValue = retention; - return Self; + Instance.Retention = value; + return this; } - public PutLifecycleRequestDescriptor Retention(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor descriptor) - { - RetentionValue = null; - RetentionDescriptorAction = null; - RetentionDescriptor = descriptor; - return Self; - } - - public PutLifecycleRequestDescriptor Retention(Action configure) + /// + /// + /// Retention rules used to retain and delete snapshots created by the policy. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Retention(System.Action action) { - RetentionValue = null; - RetentionDescriptor = null; - RetentionDescriptorAction = configure; - return Self; + Instance.Retention = Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor.Build(action); + return this; } /// @@ -262,65 +369,59 @@ public PutLifecycleRequestDescriptor Retention(Action /// - public PutLifecycleRequestDescriptor Schedule(string? schedule) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Schedule(string? value) { - ScheduleValue = schedule; - return Self; + Instance.Schedule = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest Build(System.Action action) { - writer.WriteStartObject(); - if (ConfigDescriptor is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigDescriptor, options); - } - else if (ConfigDescriptorAction is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor(ConfigDescriptorAction), options); - } - else if (ConfigValue is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(RepositoryValue)) - { - writer.WritePropertyName("repository"); - writer.WriteStringValue(RepositoryValue); - } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RetentionDescriptor is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, RetentionDescriptor, options); - } - else if (RetentionDescriptorAction is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor(RetentionDescriptorAction), options); - } - else if (RetentionValue is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, RetentionValue, options); - } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(ScheduleValue)) - { - writer.WritePropertyName("schedule"); - writer.WriteStringValue(ScheduleValue); - } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleResponse.g.cs index e9eaecf826f..f7241586056 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/PutLifecycleResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class PutLifecycleResponse : ElasticsearchResponse +internal sealed partial class PutLifecycleResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponseConverter))] +public sealed partial class PutLifecycleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutLifecycleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutLifecycleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmRequest.g.cs index a11234ab25c..d510f5a2828 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class StartSlmRequestParameters : RequestParameters +public sealed partial class StartSlmRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,6 +44,35 @@ public sealed partial class StartSlmRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StartSlmRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start snapshot lifecycle management. @@ -58,11 +80,28 @@ public sealed partial class StartSlmRequestParameters : RequestParameters /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. /// /// -public sealed partial class StartSlmRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestConverter))] +public sealed partial class StartSlmRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementStart; +#if NET7_0_OR_GREATER + public StartSlmRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public StartSlmRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementStart; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -75,7 +114,6 @@ public sealed partial class StartSlmRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -85,7 +123,6 @@ public sealed partial class StartSlmRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -96,26 +133,102 @@ public sealed partial class StartSlmRequest : PlainRequest /// -public sealed partial class StartSlmRequestDescriptor : RequestDescriptor +public readonly partial struct StartSlmRequestDescriptor { - internal StartSlmRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartSlmRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest instance) + { + Instance = instance; + } public StartSlmRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementStart; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "slm.start"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public StartSlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public StartSlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmResponse.g.cs index 8ebc963e7ac..b9940ff5f1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StartSlmResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class StartSlmResponse : ElasticsearchResponse +internal sealed partial class StartSlmResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponseConverter))] +public sealed partial class StartSlmResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartSlmResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartSlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmRequest.g.cs index e3d150b7356..a9bb241cf16 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class StopSlmRequestParameters : RequestParameters +public sealed partial class StopSlmRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,6 +44,35 @@ public sealed partial class StopSlmRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StopSlmRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop snapshot lifecycle management. @@ -64,11 +86,28 @@ public sealed partial class StopSlmRequestParameters : RequestParameters /// Use the get snapshot lifecycle management status API to see if SLM is running. /// /// -public sealed partial class StopSlmRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestConverter))] +public sealed partial class StopSlmRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementStop; +#if NET7_0_OR_GREATER + public StopSlmRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public StopSlmRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SnapshotLifecycleManagementStop; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -81,7 +120,6 @@ public sealed partial class StopSlmRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } /// @@ -91,7 +129,6 @@ public sealed partial class StopSlmRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } @@ -108,26 +145,102 @@ public sealed partial class StopSlmRequest : PlainRequest /// -public sealed partial class StopSlmRequestDescriptor : RequestDescriptor +public readonly partial struct StopSlmRequestDescriptor { - internal StopSlmRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopSlmRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest instance) + { + Instance = instance; + } public StopSlmRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SnapshotLifecycleManagementStop; + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - internal override string OperationName => "slm.stop"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - public StopSlmRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public StopSlmRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmResponse.g.cs index c7f3fd2cc66..3eb12056a4c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SnapshotLifecycleManagement/StopSlmResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public sealed partial class StopSlmResponse : ElasticsearchResponse +internal sealed partial class StopSlmResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponseConverter))] +public sealed partial class StopSlmResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopSlmResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopSlmResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorRequest.g.cs index 3f9c11570d2..281ed6bb096 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorRequest.g.cs @@ -17,33 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class ClearCursorRequestParameters : RequestParameters +public sealed partial class ClearCursorRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class ClearCursorRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCursor = System.Text.Json.JsonEncodedText.Encode("cursor"); + + public override Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCursor = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCursor.TryReadProperty(ref reader, options, PropCursor, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cursor = propCursor.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCursor, value.Cursor, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Clear an SQL search cursor. /// /// -public sealed partial class ClearCursorRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestConverter))] +public sealed partial class ClearCursorRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlClearCursor; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCursorRequest(string cursor) + { + Cursor = cursor; + } +#if NET7_0_OR_GREATER + public ClearCursorRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClearCursorRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCursorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlClearCursor; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -54,8 +109,11 @@ public sealed partial class ClearCursorRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("cursor")] - public string Cursor { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Cursor { get; set; } } /// @@ -63,40 +121,82 @@ public sealed partial class ClearCursorRequest : PlainRequest /// -public sealed partial class ClearCursorRequestDescriptor : RequestDescriptor +public readonly partial struct ClearCursorRequestDescriptor { - internal ClearCursorRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest Instance { get; init; } - public ClearCursorRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCursorRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlClearCursor; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "sql.clear_cursor"; + public ClearCursorRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private string CursorValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest instance) => new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor descriptor) => descriptor.Instance; /// /// /// Cursor to clear. /// /// - public ClearCursorRequestDescriptor Cursor(string cursor) + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor Cursor(string value) { - CursorValue = cursor; - return Self; + Instance.Cursor = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("cursor"); - writer.WriteStringValue(CursorValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorResponse.g.cs index a57592eeeb5..0107fd85643 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/ClearCursorResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class ClearCursorResponse : ElasticsearchResponse +internal sealed partial class ClearCursorResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("succeeded")] - public bool Succeeded { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropSucceeded = System.Text.Json.JsonEncodedText.Encode("succeeded"); + + public override Elastic.Clients.Elasticsearch.Sql.ClearCursorResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSucceeded = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSucceeded.TryReadProperty(ref reader, options, PropSucceeded, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.ClearCursorResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Succeeded = propSucceeded.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.ClearCursorResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSucceeded, value.Succeeded, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.ClearCursorResponseConverter))] +public sealed partial class ClearCursorResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClearCursorResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClearCursorResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Succeeded { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncRequest.g.cs index 126cfaca0cc..b0f4ea17a1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncRequest.g.cs @@ -17,23 +17,45 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class DeleteAsyncRequestParameters : RequestParameters +public sealed partial class DeleteAsyncRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteAsyncRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete an async SQL search. @@ -56,19 +78,42 @@ public sealed partial class DeleteAsyncRequestParameters : RequestParameters /// /// /// -public sealed partial class DeleteAsyncRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestConverter))] +public sealed partial class DeleteAsyncRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteAsyncRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlDeleteAsync; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlDeleteAsync; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "sql.delete_async"; + + /// + /// + /// The identifier for the search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -93,78 +138,88 @@ public DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Req /// /// /// -public sealed partial class DeleteAsyncRequestDescriptor : RequestDescriptor, DeleteAsyncRequestParameters> +public readonly partial struct DeleteAsyncRequestDescriptor { - internal DeleteAsyncRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest Instance { get; init; } - public DeleteAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlDeleteAsync; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public DeleteAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteAsyncRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "sql.delete_async"; + public static explicit operator Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest instance) => new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor descriptor) => descriptor.Instance; - public DeleteAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The identifier for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} -/// -/// -/// Delete an async SQL search. -/// Delete an async SQL search or a stored synchronous SQL search. -/// If the search is still running, the API cancels it. -/// -/// -/// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: -/// -/// -/// -/// -/// Users with the cancel_task cluster privilege. -/// -/// -/// -/// -/// The user who first submitted the search. -/// -/// -/// -/// -public sealed partial class DeleteAsyncRequestDescriptor : RequestDescriptor -{ - internal DeleteAsyncRequestDescriptor(Action configure) => configure.Invoke(this); - - public DeleteAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlDeleteAsync; + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "sql.delete_async"; + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncResponse.g.cs index 29fa3e3e14d..fe8b6e8980f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/DeleteAsyncResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class DeleteAsyncResponse : ElasticsearchResponse +internal sealed partial class DeleteAsyncResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponseConverter))] +public sealed partial class DeleteAsyncResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteAsyncResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAsyncResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncRequest.g.cs index c4808c31240..2bf3d8beecc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class GetAsyncRequestParameters : RequestParameters +public sealed partial class GetAsyncRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -66,6 +59,35 @@ public sealed partial class GetAsyncRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } +internal sealed partial class GetAsyncRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get async SQL search results. @@ -75,27 +97,49 @@ public sealed partial class GetAsyncRequestParameters : RequestParameters /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. /// /// -public sealed partial class GetAsyncRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestConverter))] +public sealed partial class GetAsyncRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetAsyncRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsync; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlGetAsync; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "sql.get_async"; + /// + /// + /// The identifier for the search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The separator for CSV results. /// The API supports this parameter only for CSV responses. /// /// - [JsonIgnore] public string? Delimiter { get => Q("delimiter"); set => Q("delimiter", value); } /// @@ -105,7 +149,6 @@ public GetAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requir /// If you specify both, the API uses this parameter. /// /// - [JsonIgnore] public string? Format { get => Q("format"); set => Q("format", value); } /// @@ -114,7 +157,6 @@ public GetAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requir /// It defaults to the keep_alive period for the original SQL search. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get => Q("keep_alive"); set => Q("keep_alive", value); } /// @@ -123,7 +165,6 @@ public GetAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requir /// It defaults to no timeout, meaning the request waits for complete search results. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get => Q("wait_for_completion_timeout"); set => Q("wait_for_completion_timeout", value); } } @@ -136,75 +177,137 @@ public GetAsyncRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requir /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. /// /// -public sealed partial class GetAsyncRequestDescriptor : RequestDescriptor, GetAsyncRequestParameters> +public readonly partial struct GetAsyncRequestDescriptor { - internal GetAsyncRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest Instance { get; init; } - public GetAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsync; + public GetAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest(id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetAsyncRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest instance) => new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "sql.get_async"; + /// + /// + /// The identifier for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } - public GetAsyncRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public GetAsyncRequestDescriptor Format(string? format) => Qs("format", format); - public GetAsyncRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public GetAsyncRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + /// + /// + /// The separator for CSV results. + /// The API supports this parameter only for CSV responses. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - public GetAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The format for the response. + /// You must specify a format using this parameter or the Accept HTTP header. + /// If you specify both, the API uses this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor Format(string? value) { - RouteValues.Required("id", id); - return Self; + Instance.Format = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The retention period for the search and its results. + /// It defaults to the keep_alive period for the original SQL search. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { + Instance.KeepAlive = value; + return this; } -} -/// -/// -/// Get async SQL search results. -/// Get the current status and available results for an async SQL search or stored synchronous SQL search. -/// -/// -/// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. -/// -/// -public sealed partial class GetAsyncRequestDescriptor : RequestDescriptor -{ - internal GetAsyncRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The period to wait for complete results. + /// It defaults to no timeout, meaning the request waits for complete search results. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } - public GetAsyncRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsync; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "sql.get_async"; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetAsyncRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public GetAsyncRequestDescriptor Format(string? format) => Qs("format", format); - public GetAsyncRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) => Qs("keep_alive", keepAlive); - public GetAsyncRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) => Qs("wait_for_completion_timeout", waitForCompletionTimeout); + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetAsyncRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs index 77feb20b3d2..0b8414c0753 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncResponse.g.cs @@ -17,24 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class GetAsyncResponse : ElasticsearchResponse +internal sealed partial class GetAsyncResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropColumns = System.Text.Json.JsonEncodedText.Encode("columns"); + private static readonly System.Text.Json.JsonEncodedText PropCursor = System.Text.Json.JsonEncodedText.Encode("cursor"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + + public override Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propColumns = default; + LocalJsonValue propCursor = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propColumns.TryReadProperty(ref reader, options, PropColumns, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCursor.TryReadProperty(ref reader, options, PropCursor, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Columns = propColumns.Value, + Cursor = propCursor.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropColumns, value.Columns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCursor, value.Cursor, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.GetAsyncResponseConverter))] +public partial class GetAsyncResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Column headings for the search results. Each object is a column. /// /// - [JsonInclude, JsonPropertyName("columns")] - public IReadOnlyCollection? Columns { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Columns { get; set; } /// /// @@ -42,8 +125,7 @@ public sealed partial class GetAsyncResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Cursor HTTP header. /// /// - [JsonInclude, JsonPropertyName("cursor")] - public string? Cursor { get; init; } + public string? Cursor { get; set; } /// /// @@ -52,8 +134,11 @@ public sealed partial class GetAsyncResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-ID HTTP header. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// @@ -64,8 +149,11 @@ public sealed partial class GetAsyncResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-partial HTTP header. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// @@ -75,6 +163,9 @@ public sealed partial class GetAsyncResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-partial HTTP header. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusRequest.g.cs index cd754c0e812..ddca4c93c32 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusRequest.g.cs @@ -17,42 +17,87 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class GetAsyncStatusRequestParameters : RequestParameters +public sealed partial class GetAsyncStatusRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetAsyncStatusRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get the async SQL search status. /// Get the current status of an async SQL search or a stored synchronous SQL search. /// /// -public sealed partial class GetAsyncStatusRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestConverter))] +public sealed partial class GetAsyncStatusRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetAsyncStatusRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsyncStatus; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlGetAsyncStatus; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "sql.get_async_status"; + + /// + /// + /// The identifier for the search. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -61,62 +106,88 @@ public GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r. /// Get the current status of an async SQL search or a stored synchronous SQL search. /// /// -public sealed partial class GetAsyncStatusRequestDescriptor : RequestDescriptor, GetAsyncStatusRequestParameters> +public readonly partial struct GetAsyncStatusRequestDescriptor { - internal GetAsyncStatusRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest Instance { get; init; } - public GetAsyncStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsyncStatus; + public GetAsyncStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest(id); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetAsyncStatusRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest instance) => new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "sql.get_async_status"; - - public GetAsyncStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The identifier for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Get the async SQL search status. -/// Get the current status of an async SQL search or a stored synchronous SQL search. -/// -/// -public sealed partial class GetAsyncStatusRequestDescriptor : RequestDescriptor -{ - internal GetAsyncStatusRequestDescriptor(Action configure) => configure.Invoke(this); - public GetAsyncStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlGetAsyncStatus; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "sql.get_async_status"; + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetAsyncStatusRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusResponse.g.cs index 10d924dfbdd..cc232f6c44e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/GetAsyncStatusResponse.g.cs @@ -17,41 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class GetAsyncStatusResponse : ElasticsearchResponse +internal sealed partial class GetAsyncStatusResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompletionStatus = System.Text.Json.JsonEncodedText.Encode("completion_status"); + private static readonly System.Text.Json.JsonEncodedText PropExpirationTimeInMillis = System.Text.Json.JsonEncodedText.Encode("expiration_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompletionStatus = default; + LocalJsonValue propExpirationTimeInMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + LocalJsonValue propStartTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompletionStatus.TryReadProperty(ref reader, options, PropCompletionStatus, null)) + { + continue; + } + + if (propExpirationTimeInMillis.TryReadProperty(ref reader, options, PropExpirationTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompletionStatus = propCompletionStatus.Value, + ExpirationTimeInMillis = propExpirationTimeInMillis.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value, + StartTimeInMillis = propStartTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompletionStatus, value.CompletionStatus, null, null); + writer.WriteProperty(options, PropExpirationTimeInMillis, value.ExpirationTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponseConverter))] +public sealed partial class GetAsyncStatusResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetAsyncStatusResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetAsyncStatusResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The HTTP status code for the search. /// The API returns this property only for completed searches. /// /// - [JsonInclude, JsonPropertyName("completion_status")] - public int? CompletionStatus { get; init; } + public int? CompletionStatus { get; set; } /// /// /// The timestamp, in milliseconds since the Unix epoch, when Elasticsearch will delete the search and its results, even if the search is still running. /// /// - [JsonInclude, JsonPropertyName("expiration_time_in_millis")] - public long ExpirationTimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpirationTimeInMillis { get; set; } /// /// /// The identifier for the search. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// @@ -60,8 +158,11 @@ public sealed partial class GetAsyncStatusResponse : ElasticsearchResponse /// If is_partial is true but is_running is false, the results are partial due to a failure or timeout. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool IsPartial { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsPartial { get; set; } /// /// @@ -69,8 +170,11 @@ public sealed partial class GetAsyncStatusResponse : ElasticsearchResponse /// If false, the search has finished. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool IsRunning { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRunning { get; set; } /// /// @@ -78,6 +182,9 @@ public sealed partial class GetAsyncStatusResponse : ElasticsearchResponse /// The API returns this property only for running searches. /// /// - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryRequest.g.cs index 247b732a256..d259001539d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class QueryRequestParameters : RequestParameters +public sealed partial class QueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,17 +35,217 @@ public sealed partial class QueryRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Sql.SqlFormat? Format { get => Q("format"); set => Q("format", value); } } +internal sealed partial class QueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowPartialSearchResults = System.Text.Json.JsonEncodedText.Encode("allow_partial_search_results"); + private static readonly System.Text.Json.JsonEncodedText PropCatalog = System.Text.Json.JsonEncodedText.Encode("catalog"); + private static readonly System.Text.Json.JsonEncodedText PropColumnar = System.Text.Json.JsonEncodedText.Encode("columnar"); + private static readonly System.Text.Json.JsonEncodedText PropCursor = System.Text.Json.JsonEncodedText.Encode("cursor"); + private static readonly System.Text.Json.JsonEncodedText PropFetchSize = System.Text.Json.JsonEncodedText.Encode("fetch_size"); + private static readonly System.Text.Json.JsonEncodedText PropFieldMultiValueLeniency = System.Text.Json.JsonEncodedText.Encode("field_multi_value_leniency"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIndexUsingFrozen = System.Text.Json.JsonEncodedText.Encode("index_using_frozen"); + private static readonly System.Text.Json.JsonEncodedText PropKeepAlive = System.Text.Json.JsonEncodedText.Encode("keep_alive"); + private static readonly System.Text.Json.JsonEncodedText PropKeepOnCompletion = System.Text.Json.JsonEncodedText.Encode("keep_on_completion"); + private static readonly System.Text.Json.JsonEncodedText PropPageTimeout = System.Text.Json.JsonEncodedText.Encode("page_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRequestTimeout = System.Text.Json.JsonEncodedText.Encode("request_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + private static readonly System.Text.Json.JsonEncodedText PropWaitForCompletionTimeout = System.Text.Json.JsonEncodedText.Encode("wait_for_completion_timeout"); + + public override Elastic.Clients.Elasticsearch.Sql.QueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowPartialSearchResults = default; + LocalJsonValue propCatalog = default; + LocalJsonValue propColumnar = default; + LocalJsonValue propCursor = default; + LocalJsonValue propFetchSize = default; + LocalJsonValue propFieldMultiValueLeniency = default; + LocalJsonValue propFilter = default; + LocalJsonValue propIndexUsingFrozen = default; + LocalJsonValue propKeepAlive = default; + LocalJsonValue propKeepOnCompletion = default; + LocalJsonValue propPageTimeout = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propQuery = default; + LocalJsonValue propRequestTimeout = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue propTimeZone = default; + LocalJsonValue propWaitForCompletionTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowPartialSearchResults.TryReadProperty(ref reader, options, PropAllowPartialSearchResults, null)) + { + continue; + } + + if (propCatalog.TryReadProperty(ref reader, options, PropCatalog, null)) + { + continue; + } + + if (propColumnar.TryReadProperty(ref reader, options, PropColumnar, null)) + { + continue; + } + + if (propCursor.TryReadProperty(ref reader, options, PropCursor, null)) + { + continue; + } + + if (propFetchSize.TryReadProperty(ref reader, options, PropFetchSize, null)) + { + continue; + } + + if (propFieldMultiValueLeniency.TryReadProperty(ref reader, options, PropFieldMultiValueLeniency, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIndexUsingFrozen.TryReadProperty(ref reader, options, PropIndexUsingFrozen, null)) + { + continue; + } + + if (propKeepAlive.TryReadProperty(ref reader, options, PropKeepAlive, null)) + { + continue; + } + + if (propKeepOnCompletion.TryReadProperty(ref reader, options, PropKeepOnCompletion, null)) + { + continue; + } + + if (propPageTimeout.TryReadProperty(ref reader, options, PropPageTimeout, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propRequestTimeout.TryReadProperty(ref reader, options, PropRequestTimeout, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (propWaitForCompletionTimeout.TryReadProperty(ref reader, options, PropWaitForCompletionTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowPartialSearchResults = propAllowPartialSearchResults.Value, + Catalog = propCatalog.Value, + Columnar = propColumnar.Value, + Cursor = propCursor.Value, + FetchSize = propFetchSize.Value, + FieldMultiValueLeniency = propFieldMultiValueLeniency.Value, + Filter = propFilter.Value, + IndexUsingFrozen = propIndexUsingFrozen.Value, + KeepAlive = propKeepAlive.Value, + KeepOnCompletion = propKeepOnCompletion.Value, + PageTimeout = propPageTimeout.Value, + Params = propParams.Value, + Query = propQuery.Value, + RequestTimeout = propRequestTimeout.Value, + RuntimeMappings = propRuntimeMappings.Value, + TimeZone = propTimeZone.Value, + WaitForCompletionTimeout = propWaitForCompletionTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.QueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowPartialSearchResults, value.AllowPartialSearchResults, null, null); + writer.WriteProperty(options, PropCatalog, value.Catalog, null, null); + writer.WriteProperty(options, PropColumnar, value.Columnar, null, null); + writer.WriteProperty(options, PropCursor, value.Cursor, null, null); + writer.WriteProperty(options, PropFetchSize, value.FetchSize, null, null); + writer.WriteProperty(options, PropFieldMultiValueLeniency, value.FieldMultiValueLeniency, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIndexUsingFrozen, value.IndexUsingFrozen, null, null); + writer.WriteProperty(options, PropKeepAlive, value.KeepAlive, null, null); + writer.WriteProperty(options, PropKeepOnCompletion, value.KeepOnCompletion, null, null); + writer.WriteProperty(options, PropPageTimeout, value.PageTimeout, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRequestTimeout, value.RequestTimeout, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteProperty(options, PropWaitForCompletionTimeout, value.WaitForCompletionTimeout, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get SQL search results. /// Run an SQL request. /// /// -public sealed partial class QueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.QueryRequestConverter))] +public sealed partial class QueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlQuery; +#if NET7_0_OR_GREATER + public QueryRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public QueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlQuery; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -65,7 +258,6 @@ public sealed partial class QueryRequest : PlainRequest /// If you specify both this parameter and the Accept HTTP header, this parameter takes precedence. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Sql.SqlFormat? Format { get => Q("format"); set => Q("format", value); } /// @@ -74,7 +266,6 @@ public sealed partial class QueryRequest : PlainRequest /// If false, the API returns an error with no partial results. /// /// - [JsonInclude, JsonPropertyName("allow_partial_search_results")] public bool? AllowPartialSearchResults { get; set; } /// @@ -83,7 +274,6 @@ public sealed partial class QueryRequest : PlainRequest /// If unspecified, the queries execute on the data in the local cluster only. /// /// - [JsonInclude, JsonPropertyName("catalog")] public string? Catalog { get; set; } /// @@ -92,7 +282,6 @@ public sealed partial class QueryRequest : PlainRequest /// The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. /// /// - [JsonInclude, JsonPropertyName("columnar")] public bool? Columnar { get; set; } /// @@ -102,7 +291,6 @@ public sealed partial class QueryRequest : PlainRequest /// It ignores other request body parameters. /// /// - [JsonInclude, JsonPropertyName("cursor")] public string? Cursor { get; set; } /// @@ -110,7 +298,6 @@ public sealed partial class QueryRequest : PlainRequest /// The maximum number of rows (or entries) to return in one response. /// /// - [JsonInclude, JsonPropertyName("fetch_size")] public int? FetchSize { get; set; } /// @@ -119,7 +306,6 @@ public sealed partial class QueryRequest : PlainRequest /// If true, the API is lenient and returns the first value from the array with no guarantee of consistent results. /// /// - [JsonInclude, JsonPropertyName("field_multi_value_leniency")] public bool? FieldMultiValueLeniency { get; set; } /// @@ -127,7 +313,6 @@ public sealed partial class QueryRequest : PlainRequest /// The Elasticsearch query DSL for additional filtering. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -135,7 +320,6 @@ public sealed partial class QueryRequest : PlainRequest /// If true, the search can run on frozen indices. /// /// - [JsonInclude, JsonPropertyName("index_using_frozen")] public bool? IndexUsingFrozen { get; set; } /// @@ -143,7 +327,6 @@ public sealed partial class QueryRequest : PlainRequest /// The retention period for an async or saved synchronous search. /// /// - [JsonInclude, JsonPropertyName("keep_alive")] public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get; set; } /// @@ -152,7 +335,6 @@ public sealed partial class QueryRequest : PlainRequest /// If false, Elasticsearch only stores async searches that don't finish before the wait_for_completion_timeout. /// /// - [JsonInclude, JsonPropertyName("keep_on_completion")] public bool? KeepOnCompletion { get; set; } /// @@ -162,7 +344,6 @@ public sealed partial class QueryRequest : PlainRequest /// Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of page_timeout in the scroll request. /// /// - [JsonInclude, JsonPropertyName("page_timeout")] public Elastic.Clients.Elasticsearch.Duration? PageTimeout { get; set; } /// @@ -170,15 +351,13 @@ public sealed partial class QueryRequest : PlainRequest /// The values for parameters in the query. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// The SQL query to run. /// /// - [JsonInclude, JsonPropertyName("query")] public string? Query { get; set; } /// @@ -186,7 +365,6 @@ public sealed partial class QueryRequest : PlainRequest /// The timeout before the request fails. /// /// - [JsonInclude, JsonPropertyName("request_timeout")] public Elastic.Clients.Elasticsearch.Duration? RequestTimeout { get; set; } /// @@ -195,15 +373,13 @@ public sealed partial class QueryRequest : PlainRequest /// These fields take precedence over mapped fields with the same name. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// The ISO-8601 time zone ID for the search. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } /// @@ -216,7 +392,6 @@ public sealed partial class QueryRequest : PlainRequest /// To save a synchronous search, you must specify this parameter and the keep_on_completion parameter. /// /// - [JsonInclude, JsonPropertyName("wait_for_completion_timeout")] public Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeout { get; set; } } @@ -226,43 +401,36 @@ public sealed partial class QueryRequest : PlainRequest /// Run an SQL request. /// /// -public sealed partial class QueryRequestDescriptor : RequestDescriptor, QueryRequestParameters> +public readonly partial struct QueryRequestDescriptor { - internal QueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.QueryRequest Instance { get; init; } - public QueryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.QueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public QueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "sql.query"; + public static explicit operator Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.QueryRequest instance) => new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor descriptor) => descriptor.Instance; - public QueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Sql.SqlFormat? format) => Qs("format", format); - - private bool? AllowPartialSearchResultsValue { get; set; } - private string? CatalogValue { get; set; } - private bool? ColumnarValue { get; set; } - private string? CursorValue { get; set; } - private int? FetchSizeValue { get; set; } - private bool? FieldMultiValueLeniencyValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private bool? IndexUsingFrozenValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? KeepAliveValue { get; set; } - private bool? KeepOnCompletionValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? PageTimeoutValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? RequestTimeoutValue { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeoutValue { get; set; } + /// + /// + /// The format for the response. + /// You can also specify a format using the Accept HTTP header. + /// If you specify both this parameter and the Accept HTTP header, this parameter takes precedence. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Sql.SqlFormat? value) + { + Instance.Format = value; + return this; + } /// /// @@ -270,10 +438,10 @@ public QueryRequestDescriptor() /// If false, the API returns an error with no partial results. /// /// - public QueryRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AllowPartialSearchResults(bool? value = true) { - AllowPartialSearchResultsValue = allowPartialSearchResults; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } /// @@ -282,10 +450,10 @@ public QueryRequestDescriptor AllowPartialSearchResults(bool? allowPa /// If unspecified, the queries execute on the data in the local cluster only. /// /// - public QueryRequestDescriptor Catalog(string? catalog) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Catalog(string? value) { - CatalogValue = catalog; - return Self; + Instance.Catalog = value; + return this; } /// @@ -294,10 +462,10 @@ public QueryRequestDescriptor Catalog(string? catalog) /// The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. /// /// - public QueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Columnar(bool? value = true) { - ColumnarValue = columnar; - return Self; + Instance.Columnar = value; + return this; } /// @@ -307,10 +475,10 @@ public QueryRequestDescriptor Columnar(bool? columnar = true) /// It ignores other request body parameters. /// /// - public QueryRequestDescriptor Cursor(string? cursor) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Cursor(string? value) { - CursorValue = cursor; - return Self; + Instance.Cursor = value; + return this; } /// @@ -318,10 +486,10 @@ public QueryRequestDescriptor Cursor(string? cursor) /// The maximum number of rows (or entries) to return in one response. /// /// - public QueryRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -330,10 +498,10 @@ public QueryRequestDescriptor FetchSize(int? fetchSize) /// If true, the API is lenient and returns the first value from the array with no guarantee of consistent results. /// /// - public QueryRequestDescriptor FieldMultiValueLeniency(bool? fieldMultiValueLeniency = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FieldMultiValueLeniency(bool? value = true) { - FieldMultiValueLeniencyValue = fieldMultiValueLeniency; - return Self; + Instance.FieldMultiValueLeniency = value; + return this; } /// @@ -341,28 +509,32 @@ public QueryRequestDescriptor FieldMultiValueLeniency(bool? fieldMult /// The Elasticsearch query DSL for additional filtering. /// /// - public QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public QueryRequestDescriptor Filter(Action> configure) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -370,10 +542,10 @@ public QueryRequestDescriptor Filter(Actiontrue, the search can run on frozen indices. /// /// - public QueryRequestDescriptor IndexUsingFrozen(bool? indexUsingFrozen = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor IndexUsingFrozen(bool? value = true) { - IndexUsingFrozenValue = indexUsingFrozen; - return Self; + Instance.IndexUsingFrozen = value; + return this; } /// @@ -381,10 +553,10 @@ public QueryRequestDescriptor IndexUsingFrozen(bool? indexUsingFrozen /// The retention period for an async or saved synchronous search. /// /// - public QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - KeepAliveValue = keepAlive; - return Self; + Instance.KeepAlive = value; + return this; } /// @@ -393,10 +565,10 @@ public QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch /// If false, Elasticsearch only stores async searches that don't finish before the wait_for_completion_timeout. /// /// - public QueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor KeepOnCompletion(bool? value = true) { - KeepOnCompletionValue = keepOnCompletion; - return Self; + Instance.KeepOnCompletion = value; + return this; } /// @@ -406,10 +578,21 @@ public QueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion /// Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of page_timeout in the scroll request. /// /// - public QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsearch.Duration? pageTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.PageTimeout = value; + return this; + } + + /// + /// + /// The values for parameters in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params(System.Collections.Generic.IDictionary? value) { - PageTimeoutValue = pageTimeout; - return Self; + Instance.Params = value; + return this; } /// @@ -417,10 +600,28 @@ public QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsear /// The values for parameters in the query. /// /// - public QueryRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params() { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// The values for parameters in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -428,10 +629,10 @@ public QueryRequestDescriptor Params(Func /// - public QueryRequestDescriptor Query(string? query) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Query(string? value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } /// @@ -439,10 +640,10 @@ public QueryRequestDescriptor Query(string? query) /// The timeout before the request fails. /// /// - public QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elasticsearch.Duration? requestTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - RequestTimeoutValue = requestTimeout; - return Self; + Instance.RequestTimeout = value; + return this; } /// @@ -451,155 +652,170 @@ public QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elastics /// These fields take precedence over mapped fields with the same name. /// /// - public QueryRequestDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// The ISO-8601 time zone ID for the search. + /// One or more runtime fields for the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public QueryRequestDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings() { - TimeZoneValue = timeZone; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The period to wait for complete results. - /// It defaults to no timeout, meaning the request waits for complete search results. - /// If the search doesn't finish within this period, the search becomes async. + /// One or more runtime fields for the search request. + /// These fields take precedence over mapped fields with the same name. /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + /// /// - /// To save a synchronous search, you must specify this parameter and the keep_on_completion parameter. + /// One or more runtime fields for the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public QueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings(System.Action>? action) { - WaitForCompletionTimeoutValue = waitForCompletionTimeout; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (AllowPartialSearchResultsValue.HasValue) - { - writer.WritePropertyName("allow_partial_search_results"); - writer.WriteBooleanValue(AllowPartialSearchResultsValue.Value); - } - - if (!string.IsNullOrEmpty(CatalogValue)) - { - writer.WritePropertyName("catalog"); - writer.WriteStringValue(CatalogValue); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (!string.IsNullOrEmpty(CursorValue)) - { - writer.WritePropertyName("cursor"); - writer.WriteStringValue(CursorValue); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FieldMultiValueLeniencyValue.HasValue) - { - writer.WritePropertyName("field_multi_value_leniency"); - writer.WriteBooleanValue(FieldMultiValueLeniencyValue.Value); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndexUsingFrozenValue.HasValue) - { - writer.WritePropertyName("index_using_frozen"); - writer.WriteBooleanValue(IndexUsingFrozenValue.Value); - } + /// + /// + /// The ISO-8601 time zone ID for the search. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor TimeZone(string? value) + { + Instance.TimeZone = value; + return this; + } - if (KeepAliveValue is not null) - { - writer.WritePropertyName("keep_alive"); - JsonSerializer.Serialize(writer, KeepAliveValue, options); - } + /// + /// + /// The period to wait for complete results. + /// It defaults to no timeout, meaning the request waits for complete search results. + /// If the search doesn't finish within this period, the search becomes async. + /// + /// + /// To save a synchronous search, you must specify this parameter and the keep_on_completion parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.WaitForCompletionTimeout = value; + return this; + } - if (KeepOnCompletionValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.QueryRequest Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("keep_on_completion"); - writer.WriteBooleanValue(KeepOnCompletionValue.Value); + return new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (PageTimeoutValue is not null) - { - writer.WritePropertyName("page_timeout"); - JsonSerializer.Serialize(writer, PageTimeoutValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(QueryValue)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RequestTimeoutValue is not null) - { - writer.WritePropertyName("request_timeout"); - JsonSerializer.Serialize(writer, RequestTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WaitForCompletionTimeoutValue is not null) - { - writer.WritePropertyName("wait_for_completion_timeout"); - JsonSerializer.Serialize(writer, WaitForCompletionTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -609,43 +825,36 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// Run an SQL request. /// /// -public sealed partial class QueryRequestDescriptor : RequestDescriptor +public readonly partial struct QueryRequestDescriptor { - internal QueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.QueryRequest Instance { get; init; } - public QueryRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.QueryRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlQuery; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; + public QueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - internal override string OperationName => "sql.query"; + public static explicit operator Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.QueryRequest instance) => new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor descriptor) => descriptor.Instance; - public QueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Sql.SqlFormat? format) => Qs("format", format); - - private bool? AllowPartialSearchResultsValue { get; set; } - private string? CatalogValue { get; set; } - private bool? ColumnarValue { get; set; } - private string? CursorValue { get; set; } - private int? FetchSizeValue { get; set; } - private bool? FieldMultiValueLeniencyValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private bool? IndexUsingFrozenValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? KeepAliveValue { get; set; } - private bool? KeepOnCompletionValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? PageTimeoutValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? RequestTimeoutValue { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WaitForCompletionTimeoutValue { get; set; } + /// + /// + /// The format for the response. + /// You can also specify a format using the Accept HTTP header. + /// If you specify both this parameter and the Accept HTTP header, this parameter takes precedence. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Format(Elastic.Clients.Elasticsearch.Sql.SqlFormat? value) + { + Instance.Format = value; + return this; + } /// /// @@ -653,10 +862,10 @@ public QueryRequestDescriptor() /// If false, the API returns an error with no partial results. /// /// - public QueryRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AllowPartialSearchResults(bool? value = true) { - AllowPartialSearchResultsValue = allowPartialSearchResults; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } /// @@ -665,10 +874,10 @@ public QueryRequestDescriptor AllowPartialSearchResults(bool? allowPartialSearch /// If unspecified, the queries execute on the data in the local cluster only. /// /// - public QueryRequestDescriptor Catalog(string? catalog) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Catalog(string? value) { - CatalogValue = catalog; - return Self; + Instance.Catalog = value; + return this; } /// @@ -677,10 +886,10 @@ public QueryRequestDescriptor Catalog(string? catalog) /// The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. /// /// - public QueryRequestDescriptor Columnar(bool? columnar = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Columnar(bool? value = true) { - ColumnarValue = columnar; - return Self; + Instance.Columnar = value; + return this; } /// @@ -690,10 +899,10 @@ public QueryRequestDescriptor Columnar(bool? columnar = true) /// It ignores other request body parameters. /// /// - public QueryRequestDescriptor Cursor(string? cursor) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Cursor(string? value) { - CursorValue = cursor; - return Self; + Instance.Cursor = value; + return this; } /// @@ -701,10 +910,10 @@ public QueryRequestDescriptor Cursor(string? cursor) /// The maximum number of rows (or entries) to return in one response. /// /// - public QueryRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -713,10 +922,10 @@ public QueryRequestDescriptor FetchSize(int? fetchSize) /// If true, the API is lenient and returns the first value from the array with no guarantee of consistent results. /// /// - public QueryRequestDescriptor FieldMultiValueLeniency(bool? fieldMultiValueLeniency = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FieldMultiValueLeniency(bool? value = true) { - FieldMultiValueLeniencyValue = fieldMultiValueLeniency; - return Self; + Instance.FieldMultiValueLeniency = value; + return this; } /// @@ -724,28 +933,21 @@ public QueryRequestDescriptor FieldMultiValueLeniency(bool? fieldMultiValueLenie /// The Elasticsearch query DSL for additional filtering. /// /// - public QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public QueryRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public QueryRequestDescriptor Filter(Action configure) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -753,10 +955,10 @@ public QueryRequestDescriptor Filter(Actiontrue, the search can run on frozen indices. /// /// - public QueryRequestDescriptor IndexUsingFrozen(bool? indexUsingFrozen = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor IndexUsingFrozen(bool? value = true) { - IndexUsingFrozenValue = indexUsingFrozen; - return Self; + Instance.IndexUsingFrozen = value; + return this; } /// @@ -764,10 +966,10 @@ public QueryRequestDescriptor IndexUsingFrozen(bool? indexUsingFrozen = true) /// The retention period for an async or saved synchronous search. /// /// - public QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - KeepAliveValue = keepAlive; - return Self; + Instance.KeepAlive = value; + return this; } /// @@ -776,10 +978,10 @@ public QueryRequestDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? /// If false, Elasticsearch only stores async searches that don't finish before the wait_for_completion_timeout. /// /// - public QueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor KeepOnCompletion(bool? value = true) { - KeepOnCompletionValue = keepOnCompletion; - return Self; + Instance.KeepOnCompletion = value; + return this; } /// @@ -789,10 +991,32 @@ public QueryRequestDescriptor KeepOnCompletion(bool? keepOnCompletion = true) /// Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of page_timeout in the scroll request. /// /// - public QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsearch.Duration? pageTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.PageTimeout = value; + return this; + } + + /// + /// + /// The values for parameters in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params(System.Collections.Generic.IDictionary? value) + { + Instance.Params = value; + return this; + } + + /// + /// + /// The values for parameters in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params() { - PageTimeoutValue = pageTimeout; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -800,10 +1024,17 @@ public QueryRequestDescriptor PageTimeout(Elastic.Clients.Elasticsearch.Duration /// The values for parameters in the query. /// /// - public QueryRequestDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Params(System.Action? action) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -811,10 +1042,10 @@ public QueryRequestDescriptor Params(Func, Flue /// The SQL query to run. /// /// - public QueryRequestDescriptor Query(string? query) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Query(string? value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } /// @@ -822,10 +1053,34 @@ public QueryRequestDescriptor Query(string? query) /// The timeout before the request fails. /// /// - public QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elasticsearch.Duration? requestTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.RequestTimeout = value; + return this; + } + + /// + /// + /// One or more runtime fields for the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + /// + /// + /// One or more runtime fields for the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings() { - RequestTimeoutValue = requestTimeout; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// @@ -834,10 +1089,38 @@ public QueryRequestDescriptor RequestTimeout(Elastic.Clients.Elasticsearch.Durat /// These fields take precedence over mapped fields with the same name. /// /// - public QueryRequestDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// @@ -845,10 +1128,10 @@ public QueryRequestDescriptor RuntimeMappings(Func /// - public QueryRequestDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } /// @@ -861,127 +1144,64 @@ public QueryRequestDescriptor TimeZone(string? timeZone) /// To save a synchronous search, you must specify this parameter and the keep_on_completion parameter. /// /// - public QueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? waitForCompletionTimeout) + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor WaitForCompletionTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - WaitForCompletionTimeoutValue = waitForCompletionTimeout; - return Self; + Instance.WaitForCompletionTimeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.QueryRequest Build(System.Action>? action) { - writer.WriteStartObject(); - if (AllowPartialSearchResultsValue.HasValue) - { - writer.WritePropertyName("allow_partial_search_results"); - writer.WriteBooleanValue(AllowPartialSearchResultsValue.Value); - } - - if (!string.IsNullOrEmpty(CatalogValue)) - { - writer.WritePropertyName("catalog"); - writer.WriteStringValue(CatalogValue); - } - - if (ColumnarValue.HasValue) - { - writer.WritePropertyName("columnar"); - writer.WriteBooleanValue(ColumnarValue.Value); - } - - if (!string.IsNullOrEmpty(CursorValue)) - { - writer.WritePropertyName("cursor"); - writer.WriteStringValue(CursorValue); - } - - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } - - if (FieldMultiValueLeniencyValue.HasValue) - { - writer.WritePropertyName("field_multi_value_leniency"); - writer.WriteBooleanValue(FieldMultiValueLeniencyValue.Value); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) + if (action is null) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); + return new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexUsingFrozenValue.HasValue) - { - writer.WritePropertyName("index_using_frozen"); - writer.WriteBooleanValue(IndexUsingFrozenValue.Value); - } - - if (KeepAliveValue is not null) - { - writer.WritePropertyName("keep_alive"); - JsonSerializer.Serialize(writer, KeepAliveValue, options); - } - - if (KeepOnCompletionValue.HasValue) - { - writer.WritePropertyName("keep_on_completion"); - writer.WriteBooleanValue(KeepOnCompletionValue.Value); - } - - if (PageTimeoutValue is not null) - { - writer.WritePropertyName("page_timeout"); - JsonSerializer.Serialize(writer, PageTimeoutValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.QueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(QueryValue)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RequestTimeoutValue is not null) - { - writer.WritePropertyName("request_timeout"); - JsonSerializer.Serialize(writer, RequestTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (WaitForCompletionTimeoutValue is not null) - { - writer.WritePropertyName("wait_for_completion_timeout"); - JsonSerializer.Serialize(writer, WaitForCompletionTimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs index 30bb2dceda4..62aff016a21 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/QueryResponse.g.cs @@ -17,24 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class QueryResponse : ElasticsearchResponse +internal sealed partial class QueryResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropColumns = System.Text.Json.JsonEncodedText.Encode("columns"); + private static readonly System.Text.Json.JsonEncodedText PropCursor = System.Text.Json.JsonEncodedText.Encode("cursor"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIsPartial = System.Text.Json.JsonEncodedText.Encode("is_partial"); + private static readonly System.Text.Json.JsonEncodedText PropIsRunning = System.Text.Json.JsonEncodedText.Encode("is_running"); + + public override Elastic.Clients.Elasticsearch.Sql.QueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propColumns = default; + LocalJsonValue propCursor = default; + LocalJsonValue propId = default; + LocalJsonValue propIsPartial = default; + LocalJsonValue propIsRunning = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propColumns.TryReadProperty(ref reader, options, PropColumns, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCursor.TryReadProperty(ref reader, options, PropCursor, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIsPartial.TryReadProperty(ref reader, options, PropIsPartial, null)) + { + continue; + } + + if (propIsRunning.TryReadProperty(ref reader, options, PropIsRunning, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.QueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Columns = propColumns.Value, + Cursor = propCursor.Value, + Id = propId.Value, + IsPartial = propIsPartial.Value, + IsRunning = propIsRunning.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.QueryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropColumns, value.Columns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCursor, value.Cursor, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIsPartial, value.IsPartial, null, null); + writer.WriteProperty(options, PropIsRunning, value.IsRunning, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.QueryResponseConverter))] +public partial class QueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Column headings for the search results. Each object is a column. /// /// - [JsonInclude, JsonPropertyName("columns")] - public IReadOnlyCollection? Columns { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Columns { get; set; } /// /// @@ -42,8 +125,7 @@ public sealed partial class QueryResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Cursor HTTP header. /// /// - [JsonInclude, JsonPropertyName("cursor")] - public string? Cursor { get; init; } + public string? Cursor { get; set; } /// /// @@ -52,8 +134,7 @@ public sealed partial class QueryResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-ID HTTP header. /// /// - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public string? Id { get; set; } /// /// @@ -64,8 +145,7 @@ public sealed partial class QueryResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-partial HTTP header. /// /// - [JsonInclude, JsonPropertyName("is_partial")] - public bool? IsPartial { get; init; } + public bool? IsPartial { get; set; } /// /// @@ -75,6 +155,5 @@ public sealed partial class QueryResponse : ElasticsearchResponse /// For CSV, TSV, and TXT responses, this value is returned in the Async-partial HTTP header. /// /// - [JsonInclude, JsonPropertyName("is_running")] - public bool? IsRunning { get; init; } + public bool? IsRunning { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateRequest.g.cs index 072b4acbd93..9f65c235269 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateRequest.g.cs @@ -17,23 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class TranslateRequestParameters : RequestParameters +public sealed partial class TranslateRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class TranslateRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFetchSize = System.Text.Json.JsonEncodedText.Encode("fetch_size"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Sql.TranslateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFetchSize = default; + LocalJsonValue propFilter = default; + LocalJsonValue propQuery = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFetchSize.TryReadProperty(ref reader, options, PropFetchSize, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FetchSize = propFetchSize.Value, + Filter = propFilter.Value, + Query = propQuery.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.TranslateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFetchSize, value.FetchSize, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Translate SQL into Elasticsearch queries. @@ -41,11 +100,34 @@ public sealed partial class TranslateRequestParameters : RequestParameters /// It accepts the same request body parameters as the SQL search API, excluding cursor. /// /// -public sealed partial class TranslateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.TranslateRequestConverter))] +public sealed partial class TranslateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlTranslate; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslateRequest(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public TranslateRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TranslateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SqlTranslate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -56,7 +138,6 @@ public sealed partial class TranslateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("fetch_size")] public int? FetchSize { get; set; } /// @@ -64,7 +145,6 @@ public sealed partial class TranslateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -72,15 +152,17 @@ public sealed partial class TranslateRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } /// /// /// The ISO-8601 time zone ID for the search. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } } @@ -91,38 +173,33 @@ public sealed partial class TranslateRequest : PlainRequestcursor. /// /// -public sealed partial class TranslateRequestDescriptor : RequestDescriptor, TranslateRequestParameters> +public readonly partial struct TranslateRequestDescriptor { - internal TranslateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.TranslateRequest Instance { get; init; } - public TranslateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslateRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.TranslateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlTranslate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "sql.translate"; + public TranslateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private int? FetchSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private string QueryValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.TranslateRequest instance) => new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The maximum number of rows (or entries) to return in one response. /// /// - public TranslateRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -130,28 +207,32 @@ public TranslateRequestDescriptor FetchSize(int? fetchSize) /// The Elasticsearch query DSL for additional filtering. /// /// - public TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public TranslateRequestDescriptor Filter(Action> configure) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -159,10 +240,10 @@ public TranslateRequestDescriptor Filter(Action /// - public TranslateRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } /// @@ -170,46 +251,60 @@ public TranslateRequestDescriptor Query(string query) /// The ISO-8601 time zone ID for the search. /// /// - public TranslateRequestDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.TranslateRequest Build(System.Action action) { - writer.WriteStartObject(); - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -220,38 +315,33 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// It accepts the same request body parameters as the SQL search API, excluding cursor. /// /// -public sealed partial class TranslateRequestDescriptor : RequestDescriptor +public readonly partial struct TranslateRequestDescriptor { - internal TranslateRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Sql.TranslateRequest Instance { get; init; } - public TranslateRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslateRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.TranslateRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SqlTranslate; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "sql.translate"; + public TranslateRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private int? FetchSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private string QueryValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(Elastic.Clients.Elasticsearch.Sql.TranslateRequest instance) => new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor descriptor) => descriptor.Instance; /// /// /// The maximum number of rows (or entries) to return in one response. /// /// - public TranslateRequestDescriptor FetchSize(int? fetchSize) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor FetchSize(int? value) { - FetchSizeValue = fetchSize; - return Self; + Instance.FetchSize = value; + return this; } /// @@ -259,28 +349,21 @@ public TranslateRequestDescriptor FetchSize(int? fetchSize) /// The Elasticsearch query DSL for additional filtering. /// /// - public TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public TranslateRequestDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public TranslateRequestDescriptor Filter(Action configure) + /// + /// + /// The Elasticsearch query DSL for additional filtering. + /// + /// + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -288,10 +371,10 @@ public TranslateRequestDescriptor Filter(Action /// - public TranslateRequestDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } /// @@ -299,45 +382,59 @@ public TranslateRequestDescriptor Query(string query) /// The ISO-8601 time zone ID for the search. /// /// - public TranslateRequestDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Sql.TranslateRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (FetchSizeValue.HasValue) - { - writer.WritePropertyName("fetch_size"); - writer.WriteNumberValue(FetchSizeValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(new Elastic.Clients.Elasticsearch.Sql.TranslateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateResponse.g.cs index 583441e33fb..49a6f6631da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Sql/TranslateResponse.g.cs @@ -17,28 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public sealed partial class TranslateResponse : ElasticsearchResponse +internal sealed partial class TranslateResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.Sql.TranslateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propQuery = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.TranslateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Fields = propFields.Value, + Query = propQuery.Value, + Size = propSize.Value, + Sort = propSort.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.TranslateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.TranslateResponseConverter))] +public sealed partial class TranslateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyCollection? Fields { get; init; } - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; init; } - [JsonInclude, JsonPropertyName("size")] - public long? Size { get; init; } - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public IReadOnlyCollection? Sort { get; init; } - [JsonInclude, JsonPropertyName("_source")] - public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TranslateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Aggregations { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Fields { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } + public long? Size { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRequest.g.cs index 387db94bba7..2448794ca57 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRequest.g.cs @@ -17,21 +17,43 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class DeleteSynonymRequestParameters : RequestParameters +public sealed partial class DeleteSynonymRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class DeleteSynonymRequestConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -61,19 +83,42 @@ public sealed partial class DeleteSynonymRequestParameters : RequestParameters /// When the synonyms set is not used in analyzers, you will be able to delete it. /// /// -public sealed partial class DeleteSynonymRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestConverter))] +public sealed partial class DeleteSynonymRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public DeleteSynonymRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsDeleteSynonym; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsDeleteSynonym; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "synonyms.delete_synonym"; + + /// + /// + /// The synonyms set identifier to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } } /// @@ -103,83 +148,88 @@ public DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.R /// When the synonyms set is not used in analyzers, you will be able to delete it. /// /// -public sealed partial class DeleteSynonymRequestDescriptor : RequestDescriptor, DeleteSynonymRequestParameters> +public readonly partial struct DeleteSynonymRequestDescriptor { - internal DeleteSynonymRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest Instance { get; init; } - public DeleteSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsDeleteSynonym; - - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public DeleteSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest(id); + } - internal override bool SupportsBody => false; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteSynonymRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "synonyms.delete_synonym"; + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor descriptor) => descriptor.Instance; - public DeleteSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The synonyms set identifier to delete. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} - -/// -/// -/// Delete a synonym set. -/// -/// -/// You can only delete a synonyms set that is not in use by any index analyzer. -/// -/// -/// Synonyms sets can be used in synonym graph token filters and synonym token filters. -/// These synonym filters can be used as part of search analyzers. -/// -/// -/// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). -/// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. -/// -/// -/// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. -/// To prevent that, synonyms sets that are used in analyzers can't be deleted. -/// A delete request in this case will return a 400 response code. -/// -/// -/// To remove a synonyms set, you must first remove all indices that contain analyzers using it. -/// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. -/// Once finished, you can delete the index. -/// When the synonyms set is not used in analyzers, you will be able to delete it. -/// -/// -public sealed partial class DeleteSynonymRequestDescriptor : RequestDescriptor -{ - internal DeleteSynonymRequestDescriptor(Action configure) => configure.Invoke(this); - public DeleteSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor ErrorTrace(bool? value) { + Instance.ErrorTrace = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsDeleteSynonym; + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - internal override string OperationName => "synonyms.delete_synonym"; + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymResponse.g.cs index 484ef271a05..89781208d65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class DeleteSynonymResponse : ElasticsearchResponse +internal sealed partial class DeleteSynonymResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponseConverter))] +public sealed partial class DeleteSynonymResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSynonymResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleRequest.g.cs index 9bc1264b7ef..d0bd1d5dac7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleRequest.g.cs @@ -17,42 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class DeleteSynonymRuleRequestParameters : RequestParameters +public sealed partial class DeleteSynonymRuleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class DeleteSynonymRuleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a synonym rule. /// Delete a synonym rule from a synonym set. /// /// -public sealed partial class DeleteSynonymRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestConverter))] +public sealed partial class DeleteSynonymRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) { } +#if NET7_0_OR_GREATER + public DeleteSynonymRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsDeleteSynonymRule; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsDeleteSynonymRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "synonyms.delete_synonym_rule"; + + /// + /// + /// The ID of the synonym rule to delete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The ID of the synonym set to update. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SetId { get => P("set_id"); set => PR("set_id", value); } } /// @@ -61,35 +117,99 @@ public DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic. /// Delete a synonym rule from a synonym set. /// /// -public sealed partial class DeleteSynonymRuleRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteSynonymRuleRequestDescriptor { - internal DeleteSynonymRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest Instance { get; init; } - public DeleteSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsDeleteSynonymRule; + public DeleteSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) + { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest(setId, ruleId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteSynonymRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "synonyms.delete_synonym_rule"; + /// + /// + /// The ID of the synonym rule to delete. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RuleId = value; + return this; + } + + /// + /// + /// The ID of the synonym set to update. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.SetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public DeleteSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.SourceQueryString = value; + return this; } - public DeleteSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id setId) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("set_id", setId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleResponse.g.cs index 433948244ec..789cf4ef812 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/DeleteSynonymRuleResponse.g.cs @@ -17,31 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class DeleteSynonymRuleResponse : ElasticsearchResponse +internal sealed partial class DeleteSynonymRuleResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReloadAnalyzersDetails = System.Text.Json.JsonEncodedText.Encode("reload_analyzers_details"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReloadAnalyzersDetails = default; + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReloadAnalyzersDetails.TryReadProperty(ref reader, options, PropReloadAnalyzersDetails, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReloadAnalyzersDetails = propReloadAnalyzersDetails.Value, + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReloadAnalyzersDetails, value.ReloadAnalyzersDetails, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponseConverter))] +public sealed partial class DeleteSynonymRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteSynonymRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Updating synonyms in a synonym set reloads the associated analyzers. /// This information is the analyzers reloading result. /// /// - [JsonInclude, JsonPropertyName("reload_analyzers_details")] - public Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; set; } /// /// /// The update operation result. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRequest.g.cs index 1a1c2913a29..e2f4edbcdf0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymRequestParameters : RequestParameters +public sealed partial class GetSynonymRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,31 +40,82 @@ public sealed partial class GetSynonymRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetSynonymRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a synonym set. /// /// -public sealed partial class GetSynonymRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestConverter))] +public sealed partial class GetSynonymRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } +#if NET7_0_OR_GREATER + public GetSynonymRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonym; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsGetSynonym; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "synonyms.get_synonym"; + /// + /// + /// The synonyms set identifier to retrieve. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The starting offset for query rules to retrieve. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -79,7 +123,6 @@ public GetSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requ /// The max number of query rules to retrieve. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -88,67 +131,110 @@ public GetSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requ /// Get a synonym set. /// /// -public sealed partial class GetSynonymRequestDescriptor : RequestDescriptor, GetSynonymRequestParameters> +public readonly partial struct GetSynonymRequestDescriptor { - internal GetSynonymRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest Instance { get; init; } - public GetSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonym; - - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; - - internal override bool SupportsBody => false; + public GetSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest(id); + } - internal override string OperationName => "synonyms.get_synonym"; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSynonymRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - public GetSynonymRequestDescriptor From(int? from) => Qs("from", from); - public GetSynonymRequestDescriptor Size(int? size) => Qs("size", size); + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor descriptor) => descriptor.Instance; - public GetSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// The synonyms set identifier to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("id", id); - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The starting offset for query rules to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor From(int? value) { + Instance.From = value; + return this; } -} -/// -/// -/// Get a synonym set. -/// -/// -public sealed partial class GetSynonymRequestDescriptor : RequestDescriptor -{ - internal GetSynonymRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The max number of query rules to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } - public GetSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonym; + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - internal override string OperationName => "synonyms.get_synonym"; + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetSynonymRequestDescriptor From(int? from) => Qs("from", from); - public GetSynonymRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("id", id); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymResponse.g.cs index b60eca5b7fc..34e00c3d73c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymResponse : ElasticsearchResponse +internal sealed partial class GetSynonymResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsSet = System.Text.Json.JsonEncodedText.Encode("synonyms_set"); + + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propSynonymsSet = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propSynonymsSet.TryReadProperty(ref reader, options, PropSynonymsSet, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + SynonymsSet = propSynonymsSet.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropSynonymsSet, value.SynonymsSet, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponseConverter))] +public sealed partial class GetSynonymResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The total number of synonyms rules that the synonyms set contains. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Synonym rule details. /// /// - [JsonInclude, JsonPropertyName("synonyms_set")] - public IReadOnlyCollection SynonymsSet { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection SynonymsSet { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleRequest.g.cs index 55894c24e13..c3d09de42fa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleRequest.g.cs @@ -17,42 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymRuleRequestParameters : RequestParameters +public sealed partial class GetSynonymRuleRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class GetSynonymRuleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get a synonym rule. /// Get a synonym rule from a synonym set. /// /// -public sealed partial class GetSynonymRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestConverter))] +public sealed partial class GetSynonymRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) { } +#if NET7_0_OR_GREATER + public GetSynonymRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonymRule; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsGetSynonymRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "synonyms.get_synonym_rule"; + + /// + /// + /// The ID of the synonym rule to retrieve. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The ID of the synonym set to retrieve the synonym rule from. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SetId { get => P("set_id"); set => PR("set_id", value); } } /// @@ -61,35 +117,99 @@ public GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Cli /// Get a synonym rule from a synonym set. /// /// -public sealed partial class GetSynonymRuleRequestDescriptor : RequestDescriptor +public readonly partial struct GetSynonymRuleRequestDescriptor { - internal GetSynonymRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest Instance { get; init; } - public GetSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonymRule; + public GetSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) + { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest(setId, ruleId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetSynonymRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "synonyms.get_synonym_rule"; + /// + /// + /// The ID of the synonym rule to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.RuleId = value; + return this; + } + + /// + /// + /// The ID of the synonym set to retrieve the synonym rule from. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.SetId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - public GetSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor SourceQueryString(string? value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.SourceQueryString = value; + return this; } - public GetSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id setId) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("set_id", setId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleResponse.g.cs index a6fc0854ce0..705c6f224de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymRuleResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymRuleResponse : ElasticsearchResponse +internal sealed partial class GetSynonymRuleResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propSynonyms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Synonyms = propSynonyms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponseConverter))] +public sealed partial class GetSynonymRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Synonym Rule identifier /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Synonyms, in Solr format, that conform the synonym rule. See https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2 /// /// - [JsonInclude, JsonPropertyName("synonyms")] - public string Synonyms { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Synonyms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsRequest.g.cs index 0904230c63f..78b5f3e546b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymsSetsRequestParameters : RequestParameters +public sealed partial class GetSynonymsSetsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,17 +40,63 @@ public sealed partial class GetSynonymsSetsRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetSynonymsSetsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get all synonym sets. /// Get a summary of all defined synonym sets. /// /// -public sealed partial class GetSynonymsSetsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestConverter))] +public sealed partial class GetSynonymsSetsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonymsSets; +#if NET7_0_OR_GREATER + public GetSynonymsSetsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public GetSynonymsSetsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsGetSynonymsSets; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -68,7 +107,6 @@ public sealed partial class GetSynonymsSetsRequest : PlainRequest /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -76,7 +114,6 @@ public sealed partial class GetSynonymsSetsRequest : PlainRequest /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } @@ -86,26 +123,98 @@ public sealed partial class GetSynonymsSetsRequest : PlainRequest /// -public sealed partial class GetSynonymsSetsRequestDescriptor : RequestDescriptor +public readonly partial struct GetSynonymsSetsRequestDescriptor { - internal GetSynonymsSetsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymsSetsRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest instance) + { + Instance = instance; + } public GetSynonymsSetsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsGetSynonymsSets; + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The starting offset for synonyms sets to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// The maximum number of synonyms sets to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } - internal override string OperationName => "synonyms.get_synonyms_sets"; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public GetSynonymsSetsRequestDescriptor From(int? from) => Qs("from", from); - public GetSynonymsSetsRequestDescriptor Size(int? size) => Qs("size", size); + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsResponse.g.cs index a076a0a397c..025d54cfb48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/GetSynonymsSetsResponse.g.cs @@ -17,30 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class GetSynonymsSetsResponse : ElasticsearchResponse +internal sealed partial class GetSynonymsSetsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropResults = System.Text.Json.JsonEncodedText.Encode("results"); + + public override Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propResults.TryReadProperty(ref reader, options, PropResults, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Results = propResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropResults, value.Results, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponseConverter))] +public sealed partial class GetSynonymsSetsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSynonymsSetsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetSynonymsSetsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The total number of synonyms sets defined. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The identifier and total number of defined synonym rules for each synonyms set. /// /// - [JsonInclude, JsonPropertyName("results")] - public IReadOnlyCollection Results { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Results { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRequest.g.cs index ce973aee8d6..a3e8a6c5128 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRequest.g.cs @@ -17,23 +17,55 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class PutSynonymRequestParameters : RequestParameters +public sealed partial class PutSynonymRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class PutSynonymRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSynonymsSet = System.Text.Json.JsonEncodedText.Encode("synonyms_set"); + + public override Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propSynonymsSet = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSynonymsSet.TryReadProperty(ref reader, options, PropSynonymsSet, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SynonymsSet = propSynonymsSet.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSynonymsSet, value.SynonymsSet, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Create or update a synonym set. @@ -45,28 +77,60 @@ public sealed partial class PutSynonymRequestParameters : RequestParameters /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. /// /// -public sealed partial class PutSynonymRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestConverter))] +public sealed partial class PutSynonymRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsPutSynonym; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymRequest(Elastic.Clients.Elasticsearch.Id id, System.Collections.Generic.ICollection synonymsSet) : base(r => r.Required("id", id)) + { + SynonymsSet = synonymsSet; + } +#if NET7_0_OR_GREATER + public PutSynonymRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsPutSynonym; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "synonyms.put_synonym"; + /// + /// + /// The ID of the synonyms set to be created or updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + /// /// /// The synonym rules definitions for the synonyms set. /// /// - [JsonInclude, JsonPropertyName("synonyms_set")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.SynonymRule))] - public ICollection SynonymsSet { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection SynonymsSet { get; set; } } /// @@ -80,221 +144,129 @@ public PutSynonymRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Requ /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. /// /// -public sealed partial class PutSynonymRequestDescriptor : RequestDescriptor, PutSynonymRequestParameters> +public readonly partial struct PutSynonymRequestDescriptor { - internal PutSynonymRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest Instance { get; init; } - public PutSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsPutSynonym; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "synonyms.put_synonym"; + public PutSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest(id); +#pragma warning restore CS0618 + } - public PutSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutSynonymRequestDescriptor() { - RouteValues.Required("id", id); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private ICollection SynonymsSetValue { get; set; } - private Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor SynonymsSetDescriptor { get; set; } - private Action SynonymsSetDescriptorAction { get; set; } - private Action[] SynonymsSetDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// The synonym rules definitions for the synonyms set. + /// The ID of the synonyms set to be created or updated. /// /// - public PutSynonymRequestDescriptor SynonymsSet(ICollection synonymsSet) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - SynonymsSetDescriptor = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = null; - SynonymsSetValue = synonymsSet; - return Self; + Instance.Id = value; + return this; } - public PutSynonymRequestDescriptor SynonymsSet(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor descriptor) - { - SynonymsSetValue = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = null; - SynonymsSetDescriptor = descriptor; - return Self; - } - - public PutSynonymRequestDescriptor SynonymsSet(Action configure) + /// + /// + /// The synonym rules definitions for the synonyms set. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor SynonymsSet(System.Collections.Generic.ICollection value) { - SynonymsSetValue = null; - SynonymsSetDescriptor = null; - SynonymsSetDescriptorActions = null; - SynonymsSetDescriptorAction = configure; - return Self; + Instance.SynonymsSet = value; + return this; } - public PutSynonymRequestDescriptor SynonymsSet(params Action[] configure) + /// + /// + /// The synonym rules definitions for the synonyms set. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor SynonymsSet(params Elastic.Clients.Elasticsearch.Synonyms.SynonymRule[] values) { - SynonymsSetValue = null; - SynonymsSetDescriptor = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = configure; - return Self; + Instance.SynonymsSet = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The synonym rules definitions for the synonyms set. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor SynonymsSet(params System.Action[] actions) { - writer.WriteStartObject(); - if (SynonymsSetDescriptor is not null) - { - writer.WritePropertyName("synonyms_set"); - JsonSerializer.Serialize(writer, SynonymsSetDescriptor, options); - } - else if (SynonymsSetDescriptorAction is not null) - { - writer.WritePropertyName("synonyms_set"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(SynonymsSetDescriptorAction), options); - } - else if (SynonymsSetDescriptorActions is not null) - { - writer.WritePropertyName("synonyms_set"); - if (SynonymsSetDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SynonymsSetDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(action), options); - } - - if (SynonymsSetDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("synonyms_set"); - SingleOrManySerializationHelper.Serialize(SynonymsSetValue, writer, options); + items.Add(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.SynonymsSet = items; + return this; } -} - -/// -/// -/// Create or update a synonym set. -/// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. -/// If you need to manage more synonym rules, you can create multiple synonym sets. -/// -/// -/// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. -/// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. -/// -/// -public sealed partial class PutSynonymRequestDescriptor : RequestDescriptor -{ - internal PutSynonymRequestDescriptor(Action configure) => configure.Invoke(this); - public PutSynonymRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest Build(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsPutSynonym; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "synonyms.put_synonym"; - - public PutSynonymRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor ErrorTrace(bool? value) { - RouteValues.Required("id", id); - return Self; + Instance.ErrorTrace = value; + return this; } - private ICollection SynonymsSetValue { get; set; } - private Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor SynonymsSetDescriptor { get; set; } - private Action SynonymsSetDescriptorAction { get; set; } - private Action[] SynonymsSetDescriptorActions { get; set; } - - /// - /// - /// The synonym rules definitions for the synonyms set. - /// - /// - public PutSynonymRequestDescriptor SynonymsSet(ICollection synonymsSet) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor FilterPath(params string[]? value) { - SynonymsSetDescriptor = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = null; - SynonymsSetValue = synonymsSet; - return Self; + Instance.FilterPath = value; + return this; } - public PutSynonymRequestDescriptor SynonymsSet(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor Human(bool? value) { - SynonymsSetValue = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = null; - SynonymsSetDescriptor = descriptor; - return Self; + Instance.Human = value; + return this; } - public PutSynonymRequestDescriptor SynonymsSet(Action configure) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor Pretty(bool? value) { - SynonymsSetValue = null; - SynonymsSetDescriptor = null; - SynonymsSetDescriptorActions = null; - SynonymsSetDescriptorAction = configure; - return Self; + Instance.Pretty = value; + return this; } - public PutSynonymRequestDescriptor SynonymsSet(params Action[] configure) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor SourceQueryString(string? value) { - SynonymsSetValue = null; - SynonymsSetDescriptor = null; - SynonymsSetDescriptorAction = null; - SynonymsSetDescriptorActions = configure; - return Self; + Instance.SourceQueryString = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - writer.WriteStartObject(); - if (SynonymsSetDescriptor is not null) - { - writer.WritePropertyName("synonyms_set"); - JsonSerializer.Serialize(writer, SynonymsSetDescriptor, options); - } - else if (SynonymsSetDescriptorAction is not null) - { - writer.WritePropertyName("synonyms_set"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(SynonymsSetDescriptorAction), options); - } - else if (SynonymsSetDescriptorActions is not null) - { - writer.WritePropertyName("synonyms_set"); - if (SynonymsSetDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SynonymsSetDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(action), options); - } - - if (SynonymsSetDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("synonyms_set"); - SingleOrManySerializationHelper.Serialize(SynonymsSetValue, writer, options); - } + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs index 21b5b6c1093..1cbc5158e10 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class PutSynonymResponse : ElasticsearchResponse +internal sealed partial class PutSynonymResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReloadAnalyzersDetails = System.Text.Json.JsonEncodedText.Encode("reload_analyzers_details"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReloadAnalyzersDetails = default; + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReloadAnalyzersDetails.TryReadProperty(ref reader, options, PropReloadAnalyzersDetails, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReloadAnalyzersDetails = propReloadAnalyzersDetails.Value, + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReloadAnalyzersDetails, value.ReloadAnalyzersDetails, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponseConverter))] +public sealed partial class PutSynonymResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("reload_analyzers_details")] - public Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; init; } - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSynonymResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleRequest.g.cs index 21e739027ad..3c99323971a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleRequest.g.cs @@ -17,21 +17,53 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class PutSynonymRuleRequestParameters : RequestParameters +public sealed partial class PutSynonymRuleRequestParameters : Elastic.Transport.RequestParameters +{ +} + +internal sealed partial class PutSynonymRuleRequestConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + + public override Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSynonyms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Synonyms = propSynonyms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, null); + writer.WriteEndObject(); + } } /// @@ -46,27 +78,71 @@ public sealed partial class PutSynonymRuleRequestParameters : RequestParameters /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. /// /// -public sealed partial class PutSynonymRuleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestConverter))] +public sealed partial class PutSynonymRuleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsPutSynonymRule; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, string synonyms) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) + { + Synonyms = synonyms; + } +#if NET7_0_OR_GREATER + public PutSynonymRuleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.SynonymsPutSynonymRule; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "synonyms.put_synonym_rule"; + /// + /// + /// The ID of the synonym rule to be updated or created. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get => P("rule_id"); set => PR("rule_id", value); } + + /// + /// + /// The ID of the synonym set. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id SetId { get => P("set_id"); set => PR("set_id", value); } + /// /// /// The synonym rule information definition, which must be in Solr format. /// /// - [JsonInclude, JsonPropertyName("synonyms")] - public string Synonyms { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Synonyms { get; set; } } /// @@ -81,52 +157,112 @@ public PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Id setId, Elastic.Cli /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. /// /// -public sealed partial class PutSynonymRuleRequestDescriptor : RequestDescriptor +public readonly partial struct PutSynonymRuleRequestDescriptor { - internal PutSynonymRuleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest Instance { get; init; } - public PutSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) : base(r => r.Required("set_id", setId).Required("rule_id", ruleId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.SynonymsPutSynonymRule; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + public PutSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest(setId, ruleId); +#pragma warning restore CS0618 + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutSynonymRuleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "synonyms.put_synonym_rule"; + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest instance) => new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor descriptor) => descriptor.Instance; - public PutSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + /// + /// + /// The ID of the synonym rule to be updated or created. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("rule_id", ruleId); - return Self; + Instance.RuleId = value; + return this; } - public PutSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id setId) + /// + /// + /// The ID of the synonym set. + /// + /// + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor SetId(Elastic.Clients.Elasticsearch.Id value) { - RouteValues.Required("set_id", setId); - return Self; + Instance.SetId = value; + return this; } - private string SynonymsValue { get; set; } - /// /// /// The synonym rule information definition, which must be in Solr format. /// /// - public PutSynonymRuleRequestDescriptor Synonyms(string synonyms) + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor Synonyms(string value) { - SynonymsValue = synonyms; - return Self; + Instance.Synonyms = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("synonyms"); - writer.WriteStringValue(SynonymsValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleResponse.g.cs index f539cd6fe61..ce45ef90927 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymRuleResponse.g.cs @@ -17,31 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public sealed partial class PutSynonymRuleResponse : ElasticsearchResponse +internal sealed partial class PutSynonymRuleResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReloadAnalyzersDetails = System.Text.Json.JsonEncodedText.Encode("reload_analyzers_details"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReloadAnalyzersDetails = default; + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReloadAnalyzersDetails.TryReadProperty(ref reader, options, PropReloadAnalyzersDetails, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReloadAnalyzersDetails = propReloadAnalyzersDetails.Value, + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReloadAnalyzersDetails, value.ReloadAnalyzersDetails, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponseConverter))] +public sealed partial class PutSynonymRuleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutSynonymRuleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutSynonymRuleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Updating synonyms in a synonym set reloads the associated analyzers. /// This information is the analyzers reloading result. /// /// - [JsonInclude, JsonPropertyName("reload_analyzers_details")] - public Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; set; } /// /// /// The update operation result. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs index efeb0a68d20..c45d75145ef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs @@ -17,34 +17,27 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class CancelRequestParameters : RequestParameters +public sealed partial class CancelRequestParameters : Elastic.Transport.RequestParameters { /// /// /// A comma-separated list or wildcard expression of actions that is used to limit the request. /// /// - public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + public System.Collections.Generic.ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } /// /// /// A comma-separated list of node IDs or names that is used to limit the request. /// /// - public ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } + public System.Collections.Generic.ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } /// /// @@ -61,6 +54,35 @@ public sealed partial class CancelRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class CancelRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Tasks.CancelRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.CancelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.CancelRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Cancel a task. @@ -80,46 +102,62 @@ public sealed partial class CancelRequestParameters : RequestParameters /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. /// /// -public sealed partial class CancelRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.CancelRequestConverter))] +public sealed partial class CancelRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? taskId) : base(r => r.Optional("task_id", taskId)) + { + } +#if NET7_0_OR_GREATER public CancelRequest() { } - - public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? taskId) : base(r => r.Optional("task_id", taskId)) +#endif +#if !NET7_0_OR_GREATER + public CancelRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CancelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TasksCancel; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "tasks.cancel"; + /// + /// + /// The task identifier. + /// + /// + public Elastic.Clients.Elasticsearch.TaskId? TaskId { get => P("task_id"); set => PO("task_id", value); } + /// /// /// A comma-separated list or wildcard expression of actions that is used to limit the request. /// /// - [JsonIgnore] - public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + public System.Collections.Generic.ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } /// /// /// A comma-separated list of node IDs or names that is used to limit the request. /// /// - [JsonIgnore] - public ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } + public System.Collections.Generic.ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } /// /// /// A parent task ID that is used to limit the tasks. /// /// - [JsonIgnore] public string? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } /// @@ -127,7 +165,6 @@ public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? taskId) : base(r => r /// If true, the request blocks until all found tasks are complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -150,38 +187,158 @@ public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? taskId) : base(r => r /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. /// /// -public sealed partial class CancelRequestDescriptor : RequestDescriptor +public readonly partial struct CancelRequestDescriptor { - internal CancelRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Tasks.CancelRequest Instance { get; init; } - public CancelRequestDescriptor(Elastic.Clients.Elasticsearch.TaskId? taskId) : base(r => r.Optional("task_id", taskId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.CancelRequest instance) { + Instance = instance; + } + + public CancelRequestDescriptor(Elastic.Clients.Elasticsearch.TaskId? taskId) + { + Instance = new Elastic.Clients.Elasticsearch.Tasks.CancelRequest(taskId); } public CancelRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Tasks.CancelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel; + public static explicit operator Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.CancelRequest instance) => new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Tasks.CancelRequest(Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The task identifier. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId? value) + { + Instance.TaskId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list or wildcard expression of actions that is used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Actions(System.Collections.Generic.ICollection? value) + { + Instance.Actions = value; + return this; + } - internal override string OperationName => "tasks.cancel"; + /// + /// + /// A comma-separated list or wildcard expression of actions that is used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Actions(params string[] values) + { + Instance.Actions = [.. values]; + return this; + } - public CancelRequestDescriptor Actions(ICollection? actions) => Qs("actions", actions); - public CancelRequestDescriptor Nodes(ICollection? nodes) => Qs("nodes", nodes); - public CancelRequestDescriptor ParentTaskId(string? parentTaskId) => Qs("parent_task_id", parentTaskId); - public CancelRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// A comma-separated list of node IDs or names that is used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Nodes(System.Collections.Generic.ICollection? value) + { + Instance.Nodes = value; + return this; + } + + /// + /// + /// A comma-separated list of node IDs or names that is used to limit the request. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Nodes(params string[] values) + { + Instance.Nodes = [.. values]; + return this; + } + + /// + /// + /// A parent task ID that is used to limit the tasks. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor ParentTaskId(string? value) + { + Instance.ParentTaskId = value; + return this; + } + + /// + /// + /// If true, the request blocks until all found tasks are complete. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Tasks.CancelRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Tasks.CancelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(new Elastic.Clients.Elasticsearch.Tasks.CancelRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public CancelRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId? taskId) + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("task_id", taskId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs index 42734dac9ee..91ff24bb706 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs @@ -17,29 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class CancelResponse : ElasticsearchResponse +internal sealed partial class CancelResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodeFailures = System.Text.Json.JsonEncodedText.Encode("node_failures"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropTaskFailures = System.Text.Json.JsonEncodedText.Encode("task_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + + public override Elastic.Clients.Elasticsearch.Tasks.CancelResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propNodeFailures = default; + LocalJsonValue?> propNodes = default; + LocalJsonValue?> propTaskFailures = default; + LocalJsonValue propTasks = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodeFailures.TryReadProperty(ref reader, options, PropNodeFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTaskFailures.TryReadProperty(ref reader, options, PropTaskFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.CancelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NodeFailures = propNodeFailures.Value, + Nodes = propNodes.Value, + TaskFailures = propTaskFailures.Value, + Tasks = propTasks.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.CancelResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodeFailures, value.NodeFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTaskFailures, value.TaskFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.CancelResponseConverter))] +public sealed partial class CancelResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("node_failures")] - public IReadOnlyCollection? NodeFailures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CancelResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CancelResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? NodeFailures { get; set; } /// /// /// Task information grouped by node, if group_by was set to node (the default). /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary? Nodes { get; init; } - [JsonInclude, JsonPropertyName("task_failures")] - public IReadOnlyCollection? TaskFailures { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Nodes { get; set; } + public System.Collections.Generic.IReadOnlyCollection? TaskFailures { get; set; } /// /// @@ -47,6 +119,5 @@ public sealed partial class CancelResponse : ElasticsearchResponse /// group_by was set to parents. /// /// - [JsonInclude, JsonPropertyName("tasks")] - public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; } + public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs index b3f67333a91..0b553cc0440 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class GetTasksRequestParameters : RequestParameters +public sealed partial class GetTasksRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,6 +41,35 @@ public sealed partial class GetTasksRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class GetTasksRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get task information. @@ -61,27 +83,49 @@ public sealed partial class GetTasksRequestParameters : RequestParameters /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. /// /// -public sealed partial class GetTasksRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestConverter))] +public sealed partial class GetTasksRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetTasksRequest(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) { } +#if NET7_0_OR_GREATER + public GetTasksRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TasksGet; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "tasks.get"; + /// + /// + /// The task identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TaskId { get => P("task_id"); set => PR("task_id", value); } + /// /// /// The period to wait for a response. /// If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -89,7 +133,6 @@ public GetTasksRequest(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Re /// If true, the request blocks until the task has completed. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -106,32 +149,111 @@ public GetTasksRequest(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Re /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. /// /// -public sealed partial class GetTasksRequestDescriptor : RequestDescriptor +public readonly partial struct GetTasksRequestDescriptor { - internal GetTasksRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest Instance { get; init; } - public GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet; + public GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) + { + Instance = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest(taskId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetTasksRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest instance) => new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "tasks.get"; + /// + /// + /// The task identifier. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TaskId = value; + return this; + } - public GetTasksRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public GetTasksRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// The period to wait for a response. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, the request blocks until the task has completed. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTasksRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id taskId) + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("task_id", taskId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs index cd9c953e47f..f8ce0055707 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs @@ -17,23 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class GetTasksResponse : ElasticsearchResponse +internal sealed partial class GetTasksResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompleted = System.Text.Json.JsonEncodedText.Encode("completed"); + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropResponse = System.Text.Json.JsonEncodedText.Encode("response"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + + public override Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompleted = default; + LocalJsonValue propError = default; + LocalJsonValue propResponse = default; + LocalJsonValue propTask = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompleted.TryReadProperty(ref reader, options, PropCompleted, null)) + { + continue; + } + + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propResponse.TryReadProperty(ref reader, options, PropResponse, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Completed = propCompleted.Value, + Error = propError.Value, + Response = propResponse.Value, + Task = propTask.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompleted, value.Completed, null, null); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropResponse, value.Response, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.GetTasksResponseConverter))] +public sealed partial class GetTasksResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("completed")] - public bool Completed { get; init; } - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("response")] - public object? Response { get; init; } - [JsonInclude, JsonPropertyName("task")] - public Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTasksResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTasksResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Completed { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public object? Response { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs index 257c676096f..26389b33fbb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class ListRequestParameters : RequestParameters +public sealed partial class ListRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -38,7 +31,7 @@ public sealed partial class ListRequestParameters : RequestParameters /// For example, you can use cluser:* to retrieve all cluster-related tasks. /// /// - public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + public System.Collections.Generic.ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } /// /// @@ -56,14 +49,6 @@ public sealed partial class ListRequestParameters : RequestParameters /// public Elastic.Clients.Elasticsearch.Tasks.GroupBy? GroupBy { get => Q("group_by"); set => Q("group_by", value); } - /// - /// - /// The period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// A comma-separated list of node IDs or names that is used to limit the returned information. @@ -97,6 +82,35 @@ public sealed partial class ListRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class ListRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Tasks.ListRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.ListRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get all tasks. @@ -164,11 +178,28 @@ public sealed partial class ListRequestParameters : RequestParameters /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. /// /// -public sealed partial class ListRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.ListRequestConverter))] +public sealed partial class ListRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksList; +#if NET7_0_OR_GREATER + public ListRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public ListRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TasksList; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -180,8 +211,7 @@ public sealed partial class ListRequest : PlainRequest /// For example, you can use cluser:* to retrieve all cluster-related tasks. /// /// - [JsonIgnore] - public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + public System.Collections.Generic.ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } /// /// @@ -189,7 +219,6 @@ public sealed partial class ListRequest : PlainRequest /// This information is useful to distinguish tasks from each other but is more costly to run. /// /// - [JsonIgnore] public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } /// @@ -198,24 +227,13 @@ public sealed partial class ListRequest : PlainRequest /// The task lists can be grouped either by nodes or by parent tasks. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Tasks.GroupBy? GroupBy { get => Q("group_by"); set => Q("group_by", value); } - /// - /// - /// The period to wait for a connection to the master node. - /// If no response is received before the timeout expires, the request fails and returns an error. - /// - /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } - /// /// /// A comma-separated list of node IDs or names that is used to limit the returned information. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.NodeIds? Nodes { get => Q("nodes"); set => Q("nodes", value); } /// @@ -225,7 +243,6 @@ public sealed partial class ListRequest : PlainRequest /// If the parent task is not found, the API does not return a 404 response code. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Id? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } /// @@ -235,7 +252,6 @@ public sealed partial class ListRequest : PlainRequest /// However, timed out nodes are included in the node_failures property. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -243,7 +259,6 @@ public sealed partial class ListRequest : PlainRequest /// If true, the request blocks until the operation is complete. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -314,32 +329,172 @@ public sealed partial class ListRequest : PlainRequest /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. /// /// -public sealed partial class ListRequestDescriptor : RequestDescriptor +public readonly partial struct ListRequestDescriptor { - internal ListRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Tasks.ListRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.ListRequest instance) + { + Instance = instance; + } public ListRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Tasks.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TasksList; + public static explicit operator Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(Elastic.Clients.Elasticsearch.Tasks.ListRequest instance) => new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Tasks.ListRequest(Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// A comma-separated list or wildcard expression of actions used to limit the request. + /// For example, you can use cluser:* to retrieve all cluster-related tasks. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Actions(System.Collections.Generic.ICollection? value) + { + Instance.Actions = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list or wildcard expression of actions used to limit the request. + /// For example, you can use cluser:* to retrieve all cluster-related tasks. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Actions(params string[] values) + { + Instance.Actions = [.. values]; + return this; + } - internal override string OperationName => "tasks.list"; + /// + /// + /// If true, the response includes detailed information about the running tasks. + /// This information is useful to distinguish tasks from each other but is more costly to run. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Detailed(bool? value = true) + { + Instance.Detailed = value; + return this; + } + + /// + /// + /// A key that is used to group tasks in the response. + /// The task lists can be grouped either by nodes or by parent tasks. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor GroupBy(Elastic.Clients.Elasticsearch.Tasks.GroupBy? value) + { + Instance.GroupBy = value; + return this; + } + + /// + /// + /// A comma-separated list of node IDs or names that is used to limit the returned information. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Nodes(Elastic.Clients.Elasticsearch.NodeIds? value) + { + Instance.Nodes = value; + return this; + } + + /// + /// + /// A parent task identifier that is used to limit returned information. + /// To return all tasks, omit this parameter or use a value of -1. + /// If the parent task is not found, the API does not return a 404 response code. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor ParentTaskId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.ParentTaskId = value; + return this; + } + + /// + /// + /// The period to wait for each node to respond. + /// If a node does not respond before its timeout expires, the response does not include its information. + /// However, timed out nodes are included in the node_failures property. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, the request blocks until the operation is complete. + /// + /// + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Tasks.ListRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Tasks.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ListRequestDescriptor Actions(ICollection? actions) => Qs("actions", actions); - public ListRequestDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed); - public ListRequestDescriptor GroupBy(Elastic.Clients.Elasticsearch.Tasks.GroupBy? groupBy) => Qs("group_by", groupBy); - public ListRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); - public ListRequestDescriptor Nodes(Elastic.Clients.Elasticsearch.NodeIds? nodes) => Qs("nodes", nodes); - public ListRequestDescriptor ParentTaskId(Elastic.Clients.Elasticsearch.Id? parentTaskId) => Qs("parent_task_id", parentTaskId); - public ListRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public ListRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + var builder = new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(new Elastic.Clients.Elasticsearch.Tasks.ListRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs index 6eec10fe844..5e6e0bd8489 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs @@ -17,29 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class ListResponse : ElasticsearchResponse +internal sealed partial class ListResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodeFailures = System.Text.Json.JsonEncodedText.Encode("node_failures"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropTaskFailures = System.Text.Json.JsonEncodedText.Encode("task_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + + public override Elastic.Clients.Elasticsearch.Tasks.ListResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propNodeFailures = default; + LocalJsonValue?> propNodes = default; + LocalJsonValue?> propTaskFailures = default; + LocalJsonValue propTasks = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodeFailures.TryReadProperty(ref reader, options, PropNodeFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTaskFailures.TryReadProperty(ref reader, options, PropTaskFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.ListResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NodeFailures = propNodeFailures.Value, + Nodes = propNodes.Value, + TaskFailures = propTaskFailures.Value, + Tasks = propTasks.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.ListResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodeFailures, value.NodeFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTaskFailures, value.TaskFailures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.ListResponseConverter))] +public sealed partial class ListResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("node_failures")] - public IReadOnlyCollection? NodeFailures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ListResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? NodeFailures { get; set; } /// /// /// Task information grouped by node, if group_by was set to node (the default). /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary? Nodes { get; init; } - [JsonInclude, JsonPropertyName("task_failures")] - public IReadOnlyCollection? TaskFailures { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Nodes { get; set; } + public System.Collections.Generic.IReadOnlyCollection? TaskFailures { get; set; } /// /// @@ -47,6 +119,5 @@ public sealed partial class ListResponse : ElasticsearchResponse /// group_by was set to parents. /// /// - [JsonInclude, JsonPropertyName("tasks")] - public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; } + public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsRequest.g.cs index 9b7d2037c92..095bde8f418 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsRequest.g.cs @@ -17,74 +17,14 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class TermVectorsRequestParameters : RequestParameters +public sealed partial class TermVectorsRequestParameters : Elastic.Transport.RequestParameters { - /// - /// - /// A comma-separated list or wildcard expressions of fields to include in the statistics. - /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. - /// - /// - public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } - - /// - /// - /// If true, the response includes: - /// - /// - /// - /// - /// The document count (how many documents contain this field). - /// - /// - /// - /// - /// The sum of document frequencies (the sum of document frequencies for all terms in this field). - /// - /// - /// - /// - /// The sum of total term frequencies (the sum of total term frequencies of each term in this field). - /// - /// - /// - /// - public bool? FieldStatistics { get => Q("field_statistics"); set => Q("field_statistics", value); } - - /// - /// - /// If true, the response includes term offsets. - /// - /// - public bool? Offsets { get => Q("offsets"); set => Q("offsets", value); } - - /// - /// - /// If true, the response includes term payloads. - /// - /// - public bool? Payloads { get => Q("payloads"); set => Q("payloads", value); } - - /// - /// - /// If true, the response includes term positions. - /// - /// - public bool? Positions { get => Q("positions"); set => Q("positions", value); } - /// /// /// The node or shard the operation should be performed on. @@ -99,49 +39,161 @@ public sealed partial class TermVectorsRequestParameters : RequestParameters /// /// public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } +} - /// - /// - /// A custom value that is used to route operations to a specific shard. - /// - /// - public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } +internal sealed partial class TermVectorsRequestConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFieldStatistics = System.Text.Json.JsonEncodedText.Encode("field_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropOffsets = System.Text.Json.JsonEncodedText.Encode("offsets"); + private static readonly System.Text.Json.JsonEncodedText PropPayloads = System.Text.Json.JsonEncodedText.Encode("payloads"); + private static readonly System.Text.Json.JsonEncodedText PropPerFieldAnalyzer = System.Text.Json.JsonEncodedText.Encode("per_field_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropPositions = System.Text.Json.JsonEncodedText.Encode("positions"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropTermStatistics = System.Text.Json.JsonEncodedText.Encode("term_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.TermVectorsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoc = default; + LocalJsonValue propFields = default; + LocalJsonValue propFieldStatistics = default; + LocalJsonValue propFilter = default; + LocalJsonValue propOffsets = default; + LocalJsonValue propPayloads = default; + LocalJsonValue?> propPerFieldAnalyzer = default; + LocalJsonValue propPositions = default; + LocalJsonValue propRouting = default; + LocalJsonValue propTermStatistics = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoc.TryReadProperty(ref reader, options, PropDoc, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propFieldStatistics.TryReadProperty(ref reader, options, PropFieldStatistics, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propOffsets.TryReadProperty(ref reader, options, PropOffsets, null)) + { + continue; + } + + if (propPayloads.TryReadProperty(ref reader, options, PropPayloads, null)) + { + continue; + } + + if (propPerFieldAnalyzer.TryReadProperty(ref reader, options, PropPerFieldAnalyzer, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPositions.TryReadProperty(ref reader, options, PropPositions, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propTermStatistics.TryReadProperty(ref reader, options, PropTermStatistics, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - /// - /// - /// If true, the response includes: - /// - /// - /// - /// - /// The total term frequency (how often a term occurs in all documents). - /// - /// - /// - /// - /// The document frequency (the number of documents containing the current term). - /// - /// - /// - /// - /// By default these values are not returned since term statistics can have a serious performance impact. - /// - /// - public bool? TermStatistics { get => Q("term_statistics"); set => Q("term_statistics", value); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Doc = propDoc.Value, + Fields = propFields.Value, + FieldStatistics = propFieldStatistics.Value, + Filter = propFilter.Value, + Offsets = propOffsets.Value, + Payloads = propPayloads.Value, + PerFieldAnalyzer = propPerFieldAnalyzer.Value, + Positions = propPositions.Value, + Routing = propRouting.Value, + TermStatistics = propTermStatistics.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; + } - /// - /// - /// If true, returns the document version as part of a hit. - /// - /// - public long? Version { get => Q("version"); set => Q("version", value); } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TermVectorsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoc, value.Doc, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropFieldStatistics, value.FieldStatistics, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropOffsets, value.Offsets, null, null); + writer.WriteProperty(options, PropPayloads, value.Payloads, null, null); + writer.WriteProperty(options, PropPerFieldAnalyzer, value.PerFieldAnalyzer, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPositions, value.Positions, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropTermStatistics, value.TermStatistics, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} - /// - /// - /// The version type. - /// - /// - public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } +internal sealed partial class TermVectorsRequestConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(TermVectorsRequest<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(TermVectorsRequestConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } } /// @@ -215,19 +267,32 @@ public sealed partial class TermVectorsRequestParameters : RequestParameters /// Use routing only to hit a particular shard. /// /// -public sealed partial class TermVectorsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TermVectorsRequestConverterFactory))] +public sealed partial class TermVectorsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", index).Optional("id", id)) { } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } +#if NET7_0_OR_GREATER + public TermVectorsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceTermvectors; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceTermvectors; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -235,12 +300,51 @@ public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// /// - /// A comma-separated list or wildcard expressions of fields to include in the statistics. + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => P("id"); set => PO("id", value); } + + /// + /// + /// The name of the index that contains the document. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public string? Preference { get => Q("preference"); set => Q("preference", value); } + + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } + + /// + /// + /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. + /// + /// + public TDocument? Doc { get; set; } + + /// + /// + /// A list of fields to include in the statistics. /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Fields? Fields { get => Q("fields"); set => Q("fields", value); } + public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// /// @@ -264,57 +368,53 @@ public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// /// /// - [JsonIgnore] - public bool? FieldStatistics { get => Q("field_statistics"); set => Q("field_statistics", value); } + public bool? FieldStatistics { get; set; } /// /// - /// If true, the response includes term offsets. + /// Filter terms based on their tf-idf scores. + /// This could be useful in order find out a good characteristic vector of a document. + /// This feature works in a similar manner to the second phase of the More Like This Query. /// /// - [JsonIgnore] - public bool? Offsets { get => Q("offsets"); set => Q("offsets", value); } + public Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? Filter { get; set; } /// /// - /// If true, the response includes term payloads. + /// If true, the response includes term offsets. /// /// - [JsonIgnore] - public bool? Payloads { get => Q("payloads"); set => Q("payloads", value); } + public bool? Offsets { get; set; } /// /// - /// If true, the response includes term positions. + /// If true, the response includes term payloads. /// /// - [JsonIgnore] - public bool? Positions { get => Q("positions"); set => Q("positions", value); } + public bool? Payloads { get; set; } /// /// - /// The node or shard the operation should be performed on. - /// It is random by default. + /// Override the default per-field analyzer. + /// This is useful in order to generate term vectors in any fashion, especially when using artificial documents. + /// When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. /// /// - [JsonIgnore] - public string? Preference { get => Q("preference"); set => Q("preference", value); } + public System.Collections.Generic.IDictionary? PerFieldAnalyzer { get; set; } /// /// - /// If true, the request is real-time as opposed to near-real-time. + /// If true, the response includes term positions. /// /// - [JsonIgnore] - public bool? Realtime { get => Q("realtime"); set => Q("realtime", value); } + public bool? Positions { get; set; } /// /// /// A custom value that is used to route operations to a specific shard. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } + public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// /// @@ -336,53 +436,21 @@ public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// By default these values are not returned since term statistics can have a serious performance impact. /// /// - [JsonIgnore] - public bool? TermStatistics { get => Q("term_statistics"); set => Q("term_statistics", value); } + public bool? TermStatistics { get; set; } /// /// /// If true, returns the document version as part of a hit. /// /// - [JsonIgnore] - public long? Version { get => Q("version"); set => Q("version", value); } + public long? Version { get; set; } /// /// /// The version type. /// /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.VersionType? VersionType { get => Q("version_type"); set => Q("version_type", value); } - - /// - /// - /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. - /// - /// - [JsonInclude, JsonPropertyName("doc")] - [SourceConverter] - public TDocument? Doc { get; set; } - - /// - /// - /// Filter terms based on their tf-idf scores. - /// This could be useful in order find out a good characteristic vector of a document. - /// This feature works in a similar manner to the second phase of the More Like This Query. - /// - /// - [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? Filter { get; set; } - - /// - /// - /// Override the default per-field analyzer. - /// This is useful in order to generate term vectors in any fashion, especially when using artificial documents. - /// When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. - /// - /// - [JsonInclude, JsonPropertyName("per_field_analyzer")] - public IDictionary? PerFieldAnalyzer { get; set; } + public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } /// @@ -456,81 +524,166 @@ public TermVectorsRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( /// Use routing only to hit a particular shard. /// /// -public sealed partial class TermVectorsRequestDescriptor : RequestDescriptor, TermVectorsRequestParameters> +public readonly partial struct TermVectorsRequestDescriptor { - internal TermVectorsRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TermVectorsRequest Instance { get; init; } - public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Required("index", index).Optional("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.TermVectorsRequest instance) { + Instance = instance; } - public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) { + Instance = new Elastic.Clients.Elasticsearch.TermVectorsRequest(index, id); } - public TermVectorsRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { + Instance = new Elastic.Clients.Elasticsearch.TermVectorsRequest(index); } - public TermVectorsRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + public TermVectorsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TermVectorsRequest(typeof(TDocument)); } - public TermVectorsRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id? id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.TermVectorsRequest instance) => new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TermVectorsRequest(Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique identifier for the document. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { + Instance.Id = value; + return this; } - public TermVectorsRequestDescriptor(Elastic.Clients.Elasticsearch.Id? id) : this(typeof(TDocument), id) + /// + /// + /// The name of the index that contains the document. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceTermvectors; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If true, the request is real-time as opposed to near-real-time. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Realtime(bool? value = true) + { + Instance.Realtime = value; + return this; + } - internal override string OperationName => "termvectors"; + /// + /// + /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Doc(TDocument? value) + { + Instance.Doc = value; + return this; + } - public TermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) => Qs("fields", fields); - public TermVectorsRequestDescriptor FieldStatistics(bool? fieldStatistics = true) => Qs("field_statistics", fieldStatistics); - public TermVectorsRequestDescriptor Offsets(bool? offsets = true) => Qs("offsets", offsets); - public TermVectorsRequestDescriptor Payloads(bool? payloads = true) => Qs("payloads", payloads); - public TermVectorsRequestDescriptor Positions(bool? positions = true) => Qs("positions", positions); - public TermVectorsRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public TermVectorsRequestDescriptor Realtime(bool? realtime = true) => Qs("realtime", realtime); - public TermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public TermVectorsRequestDescriptor TermStatistics(bool? termStatistics = true) => Qs("term_statistics", termStatistics); - public TermVectorsRequestDescriptor Version(long? version) => Qs("version", version); - public TermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) => Qs("version_type", versionType); + /// + /// + /// A list of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } - public TermVectorsRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + /// + /// + /// A list of fields to include in the statistics. + /// It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - RouteValues.Optional("id", id); - return Self; + Instance.Fields = value; + return this; } - public TermVectorsRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// If true, the response includes: + /// + /// + /// + /// + /// The document count (how many documents contain this field). + /// + /// + /// + /// + /// The sum of document frequencies (the sum of document frequencies for all terms in this field). + /// + /// + /// + /// + /// The sum of total term frequencies (the sum of total term frequencies of each term in this field). + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor FieldStatistics(bool? value = true) { - RouteValues.Required("index", index); - return Self; + Instance.FieldStatistics = value; + return this; } - private TDocument? DocValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private IDictionary? PerFieldAnalyzerValue { get; set; } + /// + /// + /// Filter terms based on their tf-idf scores. + /// This could be useful in order find out a good characteristic vector of a document. + /// This feature works in a similar manner to the second phase of the More Like This Query. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? value) + { + Instance.Filter = value; + return this; + } /// /// - /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. + /// Filter terms based on their tf-idf scores. + /// This could be useful in order find out a good characteristic vector of a document. + /// This feature works in a similar manner to the second phase of the More Like This Query. /// /// - public TermVectorsRequestDescriptor Doc(TDocument? doc) + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Filter() { - DocValue = doc; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(null); + return this; } /// @@ -540,28 +693,32 @@ public TermVectorsRequestDescriptor Doc(TDocument? doc) /// This feature works in a similar manner to the second phase of the More Like This Query. /// /// - public TermVectorsRequestDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? filter) + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Filter(System.Action? action) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(action); + return this; } - public TermVectorsRequestDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor descriptor) + /// + /// + /// If true, the response includes term offsets. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Offsets(bool? value = true) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Offsets = value; + return this; } - public TermVectorsRequestDescriptor Filter(Action configure) + /// + /// + /// If true, the response includes term payloads. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Payloads(bool? value = true) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Payloads = value; + return this; } /// @@ -571,43 +728,169 @@ public TermVectorsRequestDescriptor Filter(Action /// - public TermVectorsRequestDescriptor PerFieldAnalyzer(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor PerFieldAnalyzer(System.Collections.Generic.IDictionary? value) { - PerFieldAnalyzerValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PerFieldAnalyzer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Override the default per-field analyzer. + /// This is useful in order to generate term vectors in any fashion, especially when using artificial documents. + /// When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor PerFieldAnalyzer() { - writer.WriteStartObject(); - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - settings.SourceSerializer.Serialize(DocValue, writer); - } + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(null); + return this; + } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + /// + /// + /// Override the default per-field analyzer. + /// This is useful in order to generate term vectors in any fashion, especially when using artificial documents. + /// When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor PerFieldAnalyzer(System.Action>? action) + { + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(action); + return this; + } - if (PerFieldAnalyzerValue is not null) - { - writer.WritePropertyName("per_field_analyzer"); - JsonSerializer.Serialize(writer, PerFieldAnalyzerValue, options); - } + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor AddPerFieldAnalyzer(Elastic.Clients.Elasticsearch.Field key, string value) + { + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor AddPerFieldAnalyzer(System.Linq.Expressions.Expression> key, string value) + { + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; + } + + /// + /// + /// If true, the response includes term positions. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Positions(bool? value = true) + { + Instance.Positions = value; + return this; + } + + /// + /// + /// A custom value that is used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// If true, the response includes: + /// + /// + /// + /// + /// The total term frequency (how often a term occurs in all documents). + /// + /// + /// + /// + /// The document frequency (the number of documents containing the current term). + /// + /// + /// + /// + /// By default these values are not returned since term statistics can have a serious performance impact. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor TermStatistics(bool? value = true) + { + Instance.TermStatistics = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + /// + /// + /// The version type. + /// + /// + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TermVectorsRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(new Elastic.Clients.Elasticsearch.TermVectorsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsResponse.g.cs index 530b3a6d741..ddb9be969c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermVectorsResponse.g.cs @@ -17,28 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class TermVectorsResponse : ElasticsearchResponse +internal sealed partial class TermVectorsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropTermVectors = System.Text.Json.JsonEncodedText.Encode("term_vectors"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.TermVectorsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propTermVectors = default; + LocalJsonValue propTook = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propTermVectors.TryReadProperty(ref reader, options, PropTermVectors, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TermVectorsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value, + Id = propId.Value, + Index = propIndex.Value, + TermVectors = propTermVectors.Value, + Took = propTook.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TermVectorsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropTermVectors, value.TermVectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TermVectorsResponseConverter))] +public sealed partial class TermVectorsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string? Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("term_vectors")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.TermVector))] - public IReadOnlyDictionary? TermVectors { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } - [JsonInclude, JsonPropertyName("_version")] - public long Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermVectorsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermVectorsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } + public string? Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? TermVectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumRequest.g.cs index 6e0014e722a..d38bf955c4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumRequest.g.cs @@ -17,23 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class TermsEnumRequestParameters : RequestParameters +public sealed partial class TermsEnumRequestParameters : Elastic.Transport.RequestParameters { } +internal sealed partial class TermsEnumRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCaseInsensitive = System.Text.Json.JsonEncodedText.Encode("case_insensitive"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFilter = System.Text.Json.JsonEncodedText.Encode("index_filter"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropString = System.Text.Json.JsonEncodedText.Encode("string"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.TermsEnumRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCaseInsensitive = default; + LocalJsonValue propField = default; + LocalJsonValue propIndexFilter = default; + LocalJsonValue propSearchAfter = default; + LocalJsonValue propSize = default; + LocalJsonValue propString = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCaseInsensitive.TryReadProperty(ref reader, options, PropCaseInsensitive, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIndexFilter.TryReadProperty(ref reader, options, PropIndexFilter, null)) + { + continue; + } + + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propString.TryReadProperty(ref reader, options, PropString, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TermsEnumRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CaseInsensitive = propCaseInsensitive.Value, + Field = propField.Value, + IndexFilter = propIndexFilter.Value, + SearchAfter = propSearchAfter.Value, + Size = propSize.Value, + String = propString.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TermsEnumRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCaseInsensitive, value.CaseInsensitive, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIndexFilter, value.IndexFilter, null, null); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropString, value.String, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Get terms in an index. @@ -47,26 +133,57 @@ public sealed partial class TermsEnumRequestParameters : RequestParameters /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. /// /// -public sealed partial class TermsEnumRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TermsEnumRequestConverter))] +public sealed partial class TermsEnumRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceTermsEnum; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Field field) : base(r => r.Required("index", index)) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TermsEnumRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsEnumRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceTermsEnum; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "terms_enum"; + /// + /// + /// A comma-separated list of data streams, indices, and index aliases to search. + /// Wildcard (*) expressions are supported. + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// When true, the provided search string is matched against index terms without case sensitivity. /// /// - [JsonInclude, JsonPropertyName("case_insensitive")] public bool? CaseInsensitive { get; set; } /// @@ -74,15 +191,17 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// The string to match at the start of indexed terms. If not provided, all terms in the field are considered. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Filter an index shard if the provided query rewrites to match_none. /// /// - [JsonInclude, JsonPropertyName("index_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilter { get; set; } /// @@ -91,7 +210,6 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// It allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request. /// /// - [JsonInclude, JsonPropertyName("search_after")] public string? SearchAfter { get; set; } /// @@ -99,7 +217,6 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// The number of matching terms to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -112,7 +229,6 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766. /// /// - [JsonInclude, JsonPropertyName("string")] public string? String { get; set; } /// @@ -121,7 +237,6 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } } @@ -138,62 +253,54 @@ public TermsEnumRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. /// /// -public sealed partial class TermsEnumRequestDescriptor : RequestDescriptor, TermsEnumRequestParameters> +public readonly partial struct TermsEnumRequestDescriptor { - internal TermsEnumRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TermsEnumRequest Instance { get; init; } - public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.TermsEnumRequest instance) { + Instance = instance; } - public TermsEnumRequestDescriptor() : this(typeof(TDocument)) + public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.TermsEnumRequest(index); +#pragma warning restore CS0618 } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceTermsEnum; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "terms_enum"; - - public TermsEnumRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public TermsEnumRequestDescriptor() { - RouteValues.Required("index", index); - return Self; + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action> IndexFilterDescriptorAction { get; set; } - private string? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private string? StringValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.TermsEnumRequest instance) => new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TermsEnumRequest(Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// When true, the provided search string is matched against index terms without case sensitivity. + /// A comma-separated list of data streams, indices, and index aliases to search. + /// Wildcard (*) expressions are supported. + /// To search all data streams or indices, omit this parameter or use * or _all. /// /// - public TermsEnumRequestDescriptor CaseInsensitive(bool? caseInsensitive = true) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - CaseInsensitiveValue = caseInsensitive; - return Self; + Instance.Index = value; + return this; } /// /// - /// The string to match at the start of indexed terms. If not provided, all terms in the field are considered. + /// When true, the provided search string is matched against index terms without case sensitivity. /// /// - public TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } /// @@ -201,10 +308,10 @@ public TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch /// The string to match at the start of indexed terms. If not provided, all terms in the field are considered. /// /// - public TermsEnumRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -212,10 +319,10 @@ public TermsEnumRequestDescriptor Field(Expression /// - public TermsEnumRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -223,28 +330,32 @@ public TermsEnumRequestDescriptor Field(Expressionmatch_none. /// /// - public TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; + Instance.IndexFilter = value; + return this; } - public TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter an index shard if the provided query rewrites to match_none. + /// + /// + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor IndexFilter(System.Action action) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public TermsEnumRequestDescriptor IndexFilter(Action> configure) + /// + /// + /// Filter an index shard if the provided query rewrites to match_none. + /// + /// + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -253,10 +364,10 @@ public TermsEnumRequestDescriptor IndexFilter(Actionsearch_after parameter for a subsequent request. /// /// - public TermsEnumRequestDescriptor SearchAfter(string? searchAfter) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor SearchAfter(string? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -264,10 +375,10 @@ public TermsEnumRequestDescriptor SearchAfter(string? searchAfter) /// The number of matching terms to return. /// /// - public TermsEnumRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -280,10 +391,10 @@ public TermsEnumRequestDescriptor Size(int? size) /// The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766. /// /// - public TermsEnumRequestDescriptor String(string? value) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor String(string? value) { - StringValue = value; - return Self; + Instance.String = value; + return this; } /// @@ -292,64 +403,60 @@ public TermsEnumRequestDescriptor String(string? value) /// If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. /// /// - public TermsEnumRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TermsEnumRequest Build(System.Action action) { - writer.WriteStartObject(); - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(new Elastic.Clients.Elasticsearch.TermsEnumRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(SearchAfterValue)) - { - writer.WritePropertyName("search_after"); - writer.WriteStringValue(SearchAfterValue); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(StringValue)) - { - writer.WritePropertyName("string"); - writer.WriteStringValue(StringValue); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -366,58 +473,55 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. /// /// -public sealed partial class TermsEnumRequestDescriptor : RequestDescriptor +public readonly partial struct TermsEnumRequestDescriptor { - internal TermsEnumRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TermsEnumRequest Instance { get; init; } - public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.TermsEnumRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceTermsEnum; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "terms_enum"; + public TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.TermsEnumRequest(index); +#pragma warning restore CS0618 + } - public TermsEnumRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public TermsEnumRequestDescriptor() { - RouteValues.Required("index", index); - return Self; +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.TermsEnumRequest(typeof(TDocument)); +#pragma warning restore CS0618 } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? IndexFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor IndexFilterDescriptor { get; set; } - private Action IndexFilterDescriptorAction { get; set; } - private string? SearchAfterValue { get; set; } - private int? SizeValue { get; set; } - private string? StringValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(Elastic.Clients.Elasticsearch.TermsEnumRequest instance) => new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TermsEnumRequest(Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// When true, the provided search string is matched against index terms without case sensitivity. + /// A comma-separated list of data streams, indices, and index aliases to search. + /// Wildcard (*) expressions are supported. + /// To search all data streams or indices, omit this parameter or use * or _all. /// /// - public TermsEnumRequestDescriptor CaseInsensitive(bool? caseInsensitive = true) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - CaseInsensitiveValue = caseInsensitive; - return Self; + Instance.Index = value; + return this; } /// /// - /// The string to match at the start of indexed terms. If not provided, all terms in the field are considered. + /// When true, the provided search string is matched against index terms without case sensitivity. /// /// - public TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } /// @@ -425,10 +529,10 @@ public TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// The string to match at the start of indexed terms. If not provided, all terms in the field are considered. /// /// - public TermsEnumRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -436,10 +540,10 @@ public TermsEnumRequestDescriptor Field(Expression /// - public TermsEnumRequestDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -447,28 +551,21 @@ public TermsEnumRequestDescriptor Field(Expressionmatch_none. /// /// - public TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? indexFilter) - { - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = null; - IndexFilterValue = indexFilter; - return Self; - } - - public TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor IndexFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndexFilterValue = null; - IndexFilterDescriptorAction = null; - IndexFilterDescriptor = descriptor; - return Self; + Instance.IndexFilter = value; + return this; } - public TermsEnumRequestDescriptor IndexFilter(Action configure) + /// + /// + /// Filter an index shard if the provided query rewrites to match_none. + /// + /// + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor IndexFilter(System.Action> action) { - IndexFilterValue = null; - IndexFilterDescriptor = null; - IndexFilterDescriptorAction = configure; - return Self; + Instance.IndexFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -477,10 +574,10 @@ public TermsEnumRequestDescriptor IndexFilter(Actionsearch_after parameter for a subsequent request. /// /// - public TermsEnumRequestDescriptor SearchAfter(string? searchAfter) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor SearchAfter(string? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -488,10 +585,10 @@ public TermsEnumRequestDescriptor SearchAfter(string? searchAfter) /// The number of matching terms to return. /// /// - public TermsEnumRequestDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -504,10 +601,10 @@ public TermsEnumRequestDescriptor Size(int? size) /// The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766. /// /// - public TermsEnumRequestDescriptor String(string? value) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor String(string? value) { - StringValue = value; - return Self; + Instance.String = value; + return this; } /// @@ -516,63 +613,59 @@ public TermsEnumRequestDescriptor String(string? value) /// If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. /// /// - public TermsEnumRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TermsEnumRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(new Elastic.Clients.Elasticsearch.TermsEnumRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IndexFilterDescriptor is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterDescriptor, options); - } - else if (IndexFilterDescriptorAction is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(IndexFilterDescriptorAction), options); - } - else if (IndexFilterValue is not null) - { - writer.WritePropertyName("index_filter"); - JsonSerializer.Serialize(writer, IndexFilterValue, options); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (!string.IsNullOrEmpty(SearchAfterValue)) - { - writer.WritePropertyName("search_after"); - writer.WriteStringValue(SearchAfterValue); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (!string.IsNullOrEmpty(StringValue)) - { - writer.WritePropertyName("string"); - writer.WriteStringValue(StringValue); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumResponse.g.cs index f09e804b78d..239edfcd47c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TermsEnumResponse.g.cs @@ -17,27 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class TermsEnumResponse : ElasticsearchResponse +internal sealed partial class TermsEnumResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropComplete = System.Text.Json.JsonEncodedText.Encode("complete"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.TermsEnumResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propComplete = default; + LocalJsonValue propShards = default; + LocalJsonValue> propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComplete.TryReadProperty(ref reader, options, PropComplete, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TermsEnumResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Complete = propComplete.Value, + Shards = propShards.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TermsEnumResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComplete, value.Complete, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TermsEnumResponseConverter))] +public sealed partial class TermsEnumResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsEnumResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsEnumResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If false, the returned terms set may be incomplete and should be treated as approximate. /// This can occur due to a few reasons, such as a request timeout or a node error. /// /// - [JsonInclude, JsonPropertyName("complete")] - public bool Complete { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("terms")] - public IReadOnlyCollection Terms { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Complete { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Terms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureRequest.g.cs index 2fa590ddda5..6eb514c5440 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class FindFieldStructureRequestParameters : RequestParameters +public sealed partial class FindFieldStructureRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -83,7 +76,7 @@ public sealed partial class FindFieldStructureRequestParameters : RequestParamet /// The field that should be analyzed. /// /// - public Elastic.Clients.Elasticsearch.Field Field { get => Q("field"); set => Q("field", value); } + public Elastic.Clients.Elasticsearch.Field? Field { get => Q("field"); set => Q("field", value); } /// /// @@ -110,7 +103,7 @@ public sealed partial class FindFieldStructureRequestParameters : RequestParamet /// The name of the index that contains the analyzed field. /// /// - public Elastic.Clients.Elasticsearch.IndexName Index { get => Q("index"); set => Q("index", value); } + public Elastic.Clients.Elasticsearch.IndexName? Index { get => Q("index"); set => Q("index", value); } /// /// @@ -280,6 +273,35 @@ public sealed partial class FindFieldStructureRequestParameters : RequestParamet public string? TimestampFormat { get => Q("timestamp_format"); set => Q("timestamp_format", value); } } +internal sealed partial class FindFieldStructureRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Find the structure of a text field. @@ -323,11 +345,28 @@ public sealed partial class FindFieldStructureRequestParameters : RequestParamet /// It helps determine why the returned structure was chosen. /// /// -public sealed partial class FindFieldStructureRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestConverter))] +public sealed partial class FindFieldStructureRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindFieldStructure; +#if NET7_0_OR_GREATER + public FindFieldStructureRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public FindFieldStructureRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TextStructureFindFieldStructure; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -340,7 +379,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public string? ColumnNames { get => Q("column_names"); set => Q("column_names", value); } /// @@ -352,7 +390,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public string? Delimiter { get => Q("delimiter"); set => Q("delimiter", value); } /// @@ -361,7 +398,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public int? DocumentsToSample { get => Q("documents_to_sample"); set => Q("documents_to_sample", value); } /// @@ -373,7 +409,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get => Q("ecs_compatibility"); set => Q("ecs_compatibility", value); } /// @@ -381,7 +416,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequesttrue, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. /// /// - [JsonIgnore] public bool? Explain { get => Q("explain"); set => Q("explain", value); } /// @@ -389,8 +423,7 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Field Field { get => Q("field"); set => Q("field", value); } + public Elastic.Clients.Elasticsearch.Field? Field { get => Q("field"); set => Q("field", value); } /// /// @@ -400,7 +433,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.TextStructure.FormatType? Format { get => Q("format"); set => Q("format", value); } /// @@ -411,7 +443,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequestgrok_pattern is not specified, the structure finder creates a Grok pattern. /// /// - [JsonIgnore] public string? GrokPattern { get => Q("grok_pattern"); set => Q("grok_pattern", value); } /// @@ -419,8 +450,7 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] - public Elastic.Clients.Elasticsearch.IndexName Index { get => Q("index"); set => Q("index", value); } + public Elastic.Clients.Elasticsearch.IndexName? Index { get => Q("index"); set => Q("index", value); } /// /// @@ -430,7 +460,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public string? Quote { get => Q("quote"); set => Q("quote", value); } /// @@ -440,7 +469,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequestfalse. /// /// - [JsonIgnore] public bool? ShouldTrimFields { get => Q("should_trim_fields"); set => Q("should_trim_fields", value); } /// @@ -449,7 +477,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -469,7 +496,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Field? TimestampField { get => Q("timestamp_field"); set => Q("timestamp_field", value); } /// @@ -591,7 +617,6 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// - [JsonIgnore] public string? TimestampFormat { get => Q("timestamp_format"); set => Q("timestamp_format", value); } } @@ -638,117 +663,867 @@ public sealed partial class FindFieldStructureRequest : PlainRequest /// -public sealed partial class FindFieldStructureRequestDescriptor : RequestDescriptor, FindFieldStructureRequestParameters> +public readonly partial struct FindFieldStructureRequestDescriptor { - internal FindFieldStructureRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindFieldStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest instance) + { + Instance = instance; + } public FindFieldStructureRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindFieldStructure; + public static explicit operator Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest instance) => new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If format is set to delimited, you can specify the column names in a comma-separated list. + /// If this parameter is not specified, the structure finder uses the column names from the header row of the text. + /// If the text does not have a header row, columns are named "column1", "column2", "column3", for example. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ColumnNames(string? value) + { + Instance.ColumnNames = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If you have set format to delimited, you can specify the character used to delimit the values in each row. + /// Only a single character is supported; the delimiter cannot have multiple characters. + /// By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). + /// In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + /// If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } - internal override string OperationName => "text_structure.find_field_structure"; + /// + /// + /// The number of documents to include in the structural analysis. + /// The minimum value is 2. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor DocumentsToSample(int? value) + { + Instance.DocumentsToSample = value; + return this; + } - public FindFieldStructureRequestDescriptor ColumnNames(string? columnNames) => Qs("column_names", columnNames); - public FindFieldStructureRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public FindFieldStructureRequestDescriptor DocumentsToSample(int? documentsToSample) => Qs("documents_to_sample", documentsToSample); - public FindFieldStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? ecsCompatibility) => Qs("ecs_compatibility", ecsCompatibility); - public FindFieldStructureRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public FindFieldStructureRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) => Qs("field", field); - public FindFieldStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? format) => Qs("format", format); - public FindFieldStructureRequestDescriptor GrokPattern(string? grokPattern) => Qs("grok_pattern", grokPattern); - public FindFieldStructureRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) => Qs("index", index); - public FindFieldStructureRequestDescriptor Quote(string? quote) => Qs("quote", quote); - public FindFieldStructureRequestDescriptor ShouldTrimFields(bool? shouldTrimFields = true) => Qs("should_trim_fields", shouldTrimFields); - public FindFieldStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FindFieldStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) => Qs("timestamp_field", timestampField); - public FindFieldStructureRequestDescriptor TimestampFormat(string? timestampFormat) => Qs("timestamp_format", timestampFormat); + /// + /// + /// The mode of compatibility with ECS compliant Grok patterns. + /// Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + /// This setting primarily has an impact when a whole message Grok pattern such as %{CATALINALOG} matches the input. + /// If the structure finder identifies a common structure but has no idea of the meaning then generic field names such as path, ipaddress, field1, and field2 are used in the grok_pattern output. + /// The intention in that situation is that a user who knows the meanings will rename the fields before using them. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? value) + { + Instance.EcsCompatibility = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Explain(bool? value = true) { + Instance.Explain = value; + return this; } -} -/// -/// -/// Find the structure of a text field. -/// Find the structure of a text field in an Elasticsearch index. -/// -/// -/// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. -/// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. -/// -/// -/// The response from the API contains: -/// -/// -/// -/// -/// Sample messages. -/// -/// -/// -/// -/// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. -/// -/// -/// -/// -/// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. -/// -/// -/// -/// -/// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. -/// -/// -/// -/// -/// All this information can be calculated by the structure finder with no guidance. -/// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. -/// -/// -/// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. -/// It helps determine why the returned structure was chosen. -/// -/// -public sealed partial class FindFieldStructureRequestDescriptor : RequestDescriptor -{ - internal FindFieldStructureRequestDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// The field that should be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.Field = value; + return this; + } - public FindFieldStructureRequestDescriptor() + /// + /// + /// The field that should be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The high level structure of the text. + /// By default, the API chooses the format. + /// In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + /// If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? value) { + Instance.Format = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindFieldStructure; + /// + /// + /// If the format is semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. + /// The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. + /// If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + /// If grok_pattern is not specified, the structure finder creates a Grok pattern. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor GrokPattern(string? value) + { + Instance.GrokPattern = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The name of the index that contains the analyzed field. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// If the format is delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + /// Only a single character is supported. + /// If this parameter is not specified, the default value is a double quote ("). + /// If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Quote(string? value) + { + Instance.Quote = value; + return this; + } - internal override string OperationName => "text_structure.find_field_structure"; + /// + /// + /// If the format is delimited, you can specify whether values between delimiters should have whitespace trimmed from them. + /// If this parameter is not specified and the delimiter is pipe (|), the default value is true. + /// Otherwise, the default value is false. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ShouldTrimFields(bool? value = true) + { + Instance.ShouldTrimFields = value; + return this; + } + + /// + /// + /// The maximum amount of time that the structure analysis can take. + /// If the analysis is still running when the timeout expires, it will be stopped. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The Java time format of the timestamp field in the text. + /// Only a subset of Java time format letter groups are supported: + /// + /// + /// + /// + /// a + /// + /// + /// + /// + /// d + /// + /// + /// + /// + /// dd + /// + /// + /// + /// + /// EEE + /// + /// + /// + /// + /// EEEE + /// + /// + /// + /// + /// H + /// + /// + /// + /// + /// HH + /// + /// + /// + /// + /// h + /// + /// + /// + /// + /// M + /// + /// + /// + /// + /// MM + /// + /// + /// + /// + /// MMM + /// + /// + /// + /// + /// MMMM + /// + /// + /// + /// + /// mm + /// + /// + /// + /// + /// ss + /// + /// + /// + /// + /// XX + /// + /// + /// + /// + /// XXX + /// + /// + /// + /// + /// yy + /// + /// + /// + /// + /// yyyy + /// + /// + /// + /// + /// zzz + /// + /// + /// + /// + /// Additionally S letter groups (fractional seconds) of length one to nine are supported providing they occur after ss and are separated from the ss by a period (.), comma (,), or colon (:). + /// Spacing and punctuation is also permitted with the exception a question mark (?), newline, and carriage return, together with literal text enclosed in single quotes. + /// For example, MM/dd HH.mm.ss,SSSSSS 'in' yyyy is a valid override format. + /// + /// + /// One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full grok_pattern. + /// Another is when the timestamp format is one that the structure finder does not consider by default. + /// + /// + /// If this parameter is not specified, the structure finder chooses the best format from a built-in set. + /// + /// + /// If the special value null is specified, the structure finder will not look for a primary timestamp in the text. + /// When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampFormat(string? value) + { + Instance.TimestampFormat = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Find the structure of a text field. +/// Find the structure of a text field in an Elasticsearch index. +/// +/// +/// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. +/// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. +/// +/// +/// The response from the API contains: +/// +/// +/// +/// +/// Sample messages. +/// +/// +/// +/// +/// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. +/// +/// +/// +/// +/// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. +/// +/// +/// +/// +/// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. +/// +/// +/// +/// +/// All this information can be calculated by the structure finder with no guidance. +/// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. +/// +/// +/// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. +/// It helps determine why the returned structure was chosen. +/// +/// +public readonly partial struct FindFieldStructureRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindFieldStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest instance) + { + Instance = instance; + } + + public FindFieldStructureRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest instance) => new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// If format is set to delimited, you can specify the column names in a comma-separated list. + /// If this parameter is not specified, the structure finder uses the column names from the header row of the text. + /// If the text does not have a header row, columns are named "column1", "column2", "column3", for example. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ColumnNames(string? value) + { + Instance.ColumnNames = value; + return this; + } + + /// + /// + /// If you have set format to delimited, you can specify the character used to delimit the values in each row. + /// Only a single character is supported; the delimiter cannot have multiple characters. + /// By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). + /// In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + /// If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } + + /// + /// + /// The number of documents to include in the structural analysis. + /// The minimum value is 2. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor DocumentsToSample(int? value) + { + Instance.DocumentsToSample = value; + return this; + } + + /// + /// + /// The mode of compatibility with ECS compliant Grok patterns. + /// Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + /// This setting primarily has an impact when a whole message Grok pattern such as %{CATALINALOG} matches the input. + /// If the structure finder identifies a common structure but has no idea of the meaning then generic field names such as path, ipaddress, field1, and field2 are used in the grok_pattern output. + /// The intention in that situation is that a user who knows the meanings will rename the fields before using them. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? value) + { + Instance.EcsCompatibility = value; + return this; + } + + /// + /// + /// If true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } + + /// + /// + /// The field that should be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The field that should be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The high level structure of the text. + /// By default, the API chooses the format. + /// In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + /// If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? value) + { + Instance.Format = value; + return this; + } + + /// + /// + /// If the format is semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. + /// The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. + /// If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + /// If grok_pattern is not specified, the structure finder creates a Grok pattern. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor GrokPattern(string? value) + { + Instance.GrokPattern = value; + return this; + } + + /// + /// + /// The name of the index that contains the analyzed field. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) + { + Instance.Index = value; + return this; + } + + /// + /// + /// If the format is delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + /// Only a single character is supported. + /// If this parameter is not specified, the default value is a double quote ("). + /// If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Quote(string? value) + { + Instance.Quote = value; + return this; + } + + /// + /// + /// If the format is delimited, you can specify whether values between delimiters should have whitespace trimmed from them. + /// If this parameter is not specified and the delimiter is pipe (|), the default value is true. + /// Otherwise, the default value is false. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ShouldTrimFields(bool? value = true) + { + Instance.ShouldTrimFields = value; + return this; + } + + /// + /// + /// The maximum amount of time that the structure analysis can take. + /// If the analysis is still running when the timeout expires, it will be stopped. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The Java time format of the timestamp field in the text. + /// Only a subset of Java time format letter groups are supported: + /// + /// + /// + /// + /// a + /// + /// + /// + /// + /// d + /// + /// + /// + /// + /// dd + /// + /// + /// + /// + /// EEE + /// + /// + /// + /// + /// EEEE + /// + /// + /// + /// + /// H + /// + /// + /// + /// + /// HH + /// + /// + /// + /// + /// h + /// + /// + /// + /// + /// M + /// + /// + /// + /// + /// MM + /// + /// + /// + /// + /// MMM + /// + /// + /// + /// + /// MMMM + /// + /// + /// + /// + /// mm + /// + /// + /// + /// + /// ss + /// + /// + /// + /// + /// XX + /// + /// + /// + /// + /// XXX + /// + /// + /// + /// + /// yy + /// + /// + /// + /// + /// yyyy + /// + /// + /// + /// + /// zzz + /// + /// + /// + /// + /// Additionally S letter groups (fractional seconds) of length one to nine are supported providing they occur after ss and are separated from the ss by a period (.), comma (,), or colon (:). + /// Spacing and punctuation is also permitted with the exception a question mark (?), newline, and carriage return, together with literal text enclosed in single quotes. + /// For example, MM/dd HH.mm.ss,SSSSSS 'in' yyyy is a valid override format. + /// + /// + /// One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full grok_pattern. + /// Another is when the timestamp format is one that the structure finder does not consider by default. + /// + /// + /// If this parameter is not specified, the structure finder chooses the best format from a built-in set. + /// + /// + /// If the special value null is specified, the structure finder will not look for a primary timestamp in the text. + /// When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor TimestampFormat(string? value) + { + Instance.TimestampFormat = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - public FindFieldStructureRequestDescriptor ColumnNames(string? columnNames) => Qs("column_names", columnNames); - public FindFieldStructureRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public FindFieldStructureRequestDescriptor DocumentsToSample(int? documentsToSample) => Qs("documents_to_sample", documentsToSample); - public FindFieldStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? ecsCompatibility) => Qs("ecs_compatibility", ecsCompatibility); - public FindFieldStructureRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public FindFieldStructureRequestDescriptor Field(Elastic.Clients.Elasticsearch.Field field) => Qs("field", field); - public FindFieldStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? format) => Qs("format", format); - public FindFieldStructureRequestDescriptor GrokPattern(string? grokPattern) => Qs("grok_pattern", grokPattern); - public FindFieldStructureRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) => Qs("index", index); - public FindFieldStructureRequestDescriptor Quote(string? quote) => Qs("quote", quote); - public FindFieldStructureRequestDescriptor ShouldTrimFields(bool? shouldTrimFields = true) => Qs("should_trim_fields", shouldTrimFields); - public FindFieldStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FindFieldStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) => Qs("timestamp_field", timestampField); - public FindFieldStructureRequestDescriptor TimestampFormat(string? timestampFormat) => Qs("timestamp_format", timestampFormat); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureResponse.g.cs index 432ca254f96..490c05e8a19 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindFieldStructureResponse.g.cs @@ -17,46 +17,240 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class FindFieldStructureResponse : ElasticsearchResponse +internal sealed partial class FindFieldStructureResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("charset")] - public string Charset { get; init; } - [JsonInclude, JsonPropertyName("ecs_compatibility")] - public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get; init; } - [JsonInclude, JsonPropertyName("field_stats")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FieldStat))] - public IReadOnlyDictionary FieldStats { get; init; } - [JsonInclude, JsonPropertyName("format")] - public Elastic.Clients.Elasticsearch.TextStructure.FormatType Format { get; init; } - [JsonInclude, JsonPropertyName("grok_pattern")] - public string? GrokPattern { get; init; } - [JsonInclude, JsonPropertyName("ingest_pipeline")] - public Elastic.Clients.Elasticsearch.Ingest.PipelineConfig IngestPipeline { get; init; } - [JsonInclude, JsonPropertyName("java_timestamp_formats")] - public IReadOnlyCollection? JavaTimestampFormats { get; init; } - [JsonInclude, JsonPropertyName("joda_timestamp_formats")] - public IReadOnlyCollection? JodaTimestampFormats { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; init; } - [JsonInclude, JsonPropertyName("multiline_start_pattern")] - public string? MultilineStartPattern { get; init; } - [JsonInclude, JsonPropertyName("need_client_timezone")] - public bool NeedClientTimezone { get; init; } - [JsonInclude, JsonPropertyName("num_lines_analyzed")] - public int NumLinesAnalyzed { get; init; } - [JsonInclude, JsonPropertyName("num_messages_analyzed")] - public int NumMessagesAnalyzed { get; init; } - [JsonInclude, JsonPropertyName("sample_start")] - public string SampleStart { get; init; } - [JsonInclude, JsonPropertyName("timestamp_field")] - public string? TimestampField { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropCharset = System.Text.Json.JsonEncodedText.Encode("charset"); + private static readonly System.Text.Json.JsonEncodedText PropEcsCompatibility = System.Text.Json.JsonEncodedText.Encode("ecs_compatibility"); + private static readonly System.Text.Json.JsonEncodedText PropFieldStats = System.Text.Json.JsonEncodedText.Encode("field_stats"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGrokPattern = System.Text.Json.JsonEncodedText.Encode("grok_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropIngestPipeline = System.Text.Json.JsonEncodedText.Encode("ingest_pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropJavaTimestampFormats = System.Text.Json.JsonEncodedText.Encode("java_timestamp_formats"); + private static readonly System.Text.Json.JsonEncodedText PropJodaTimestampFormats = System.Text.Json.JsonEncodedText.Encode("joda_timestamp_formats"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropMultilineStartPattern = System.Text.Json.JsonEncodedText.Encode("multiline_start_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropNeedClientTimezone = System.Text.Json.JsonEncodedText.Encode("need_client_timezone"); + private static readonly System.Text.Json.JsonEncodedText PropNumLinesAnalyzed = System.Text.Json.JsonEncodedText.Encode("num_lines_analyzed"); + private static readonly System.Text.Json.JsonEncodedText PropNumMessagesAnalyzed = System.Text.Json.JsonEncodedText.Encode("num_messages_analyzed"); + private static readonly System.Text.Json.JsonEncodedText PropSampleStart = System.Text.Json.JsonEncodedText.Encode("sample_start"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampField = System.Text.Json.JsonEncodedText.Encode("timestamp_field"); + + public override Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCharset = default; + LocalJsonValue propEcsCompatibility = default; + LocalJsonValue> propFieldStats = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGrokPattern = default; + LocalJsonValue propIngestPipeline = default; + LocalJsonValue?> propJavaTimestampFormats = default; + LocalJsonValue?> propJodaTimestampFormats = default; + LocalJsonValue propMappings = default; + LocalJsonValue propMultilineStartPattern = default; + LocalJsonValue propNeedClientTimezone = default; + LocalJsonValue propNumLinesAnalyzed = default; + LocalJsonValue propNumMessagesAnalyzed = default; + LocalJsonValue propSampleStart = default; + LocalJsonValue propTimestampField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharset.TryReadProperty(ref reader, options, PropCharset, null)) + { + continue; + } + + if (propEcsCompatibility.TryReadProperty(ref reader, options, PropEcsCompatibility, null)) + { + continue; + } + + if (propFieldStats.TryReadProperty(ref reader, options, PropFieldStats, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGrokPattern.TryReadProperty(ref reader, options, PropGrokPattern, null)) + { + continue; + } + + if (propIngestPipeline.TryReadProperty(ref reader, options, PropIngestPipeline, null)) + { + continue; + } + + if (propJavaTimestampFormats.TryReadProperty(ref reader, options, PropJavaTimestampFormats, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJodaTimestampFormats.TryReadProperty(ref reader, options, PropJodaTimestampFormats, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propMultilineStartPattern.TryReadProperty(ref reader, options, PropMultilineStartPattern, null)) + { + continue; + } + + if (propNeedClientTimezone.TryReadProperty(ref reader, options, PropNeedClientTimezone, null)) + { + continue; + } + + if (propNumLinesAnalyzed.TryReadProperty(ref reader, options, PropNumLinesAnalyzed, null)) + { + continue; + } + + if (propNumMessagesAnalyzed.TryReadProperty(ref reader, options, PropNumMessagesAnalyzed, null)) + { + continue; + } + + if (propSampleStart.TryReadProperty(ref reader, options, PropSampleStart, null)) + { + continue; + } + + if (propTimestampField.TryReadProperty(ref reader, options, PropTimestampField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Charset = propCharset.Value, + EcsCompatibility = propEcsCompatibility.Value, + FieldStats = propFieldStats.Value, + Format = propFormat.Value, + GrokPattern = propGrokPattern.Value, + IngestPipeline = propIngestPipeline.Value, + JavaTimestampFormats = propJavaTimestampFormats.Value, + JodaTimestampFormats = propJodaTimestampFormats.Value, + Mappings = propMappings.Value, + MultilineStartPattern = propMultilineStartPattern.Value, + NeedClientTimezone = propNeedClientTimezone.Value, + NumLinesAnalyzed = propNumLinesAnalyzed.Value, + NumMessagesAnalyzed = propNumMessagesAnalyzed.Value, + SampleStart = propSampleStart.Value, + TimestampField = propTimestampField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharset, value.Charset, null, null); + writer.WriteProperty(options, PropEcsCompatibility, value.EcsCompatibility, null, null); + writer.WriteProperty(options, PropFieldStats, value.FieldStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGrokPattern, value.GrokPattern, null, null); + writer.WriteProperty(options, PropIngestPipeline, value.IngestPipeline, null, null); + writer.WriteProperty(options, PropJavaTimestampFormats, value.JavaTimestampFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJodaTimestampFormats, value.JodaTimestampFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropMultilineStartPattern, value.MultilineStartPattern, null, null); + writer.WriteProperty(options, PropNeedClientTimezone, value.NeedClientTimezone, null, null); + writer.WriteProperty(options, PropNumLinesAnalyzed, value.NumLinesAnalyzed, null, null); + writer.WriteProperty(options, PropNumMessagesAnalyzed, value.NumMessagesAnalyzed, null, null); + writer.WriteProperty(options, PropSampleStart, value.SampleStart, null, null); + writer.WriteProperty(options, PropTimestampField, value.TimestampField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponseConverter))] +public sealed partial class FindFieldStructureResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindFieldStructureResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FindFieldStructureResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Charset { get; set; } + public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary FieldStats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TextStructure.FormatType Format { get; set; } + public string? GrokPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.PipelineConfig IngestPipeline { get; set; } + public System.Collections.Generic.IReadOnlyCollection? JavaTimestampFormats { get; set; } + public System.Collections.Generic.IReadOnlyCollection? JodaTimestampFormats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; set; } + public string? MultilineStartPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool NeedClientTimezone { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumLinesAnalyzed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumMessagesAnalyzed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string SampleStart { get; set; } + public string? TimestampField { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureRequest.g.cs index 598446e4b63..101d5e99872 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class FindMessageStructureRequestParameters : RequestParameters +public sealed partial class FindMessageStructureRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -257,6 +250,45 @@ public sealed partial class FindMessageStructureRequestParameters : RequestParam public string? TimestampFormat { get => Q("timestamp_format"); set => Q("timestamp_format", value); } } +internal sealed partial class FindMessageStructureRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMessages = System.Text.Json.JsonEncodedText.Encode("messages"); + + public override Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMessages = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMessages.TryReadProperty(ref reader, options, PropMessages, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Messages = propMessages.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMessages, value.Messages, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Find the structure of text messages. @@ -297,11 +329,34 @@ public sealed partial class FindMessageStructureRequestParameters : RequestParam /// It helps determine why the returned structure was chosen. /// /// -public sealed partial class FindMessageStructureRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestConverter))] +public sealed partial class FindMessageStructureRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindMessageStructure; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindMessageStructureRequest(System.Collections.Generic.ICollection messages) + { + Messages = messages; + } +#if NET7_0_OR_GREATER + public FindMessageStructureRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FindMessageStructureRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TextStructureFindMessageStructure; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -314,7 +369,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public string? ColumnNames { get => Q("column_names"); set => Q("column_names", value); } /// @@ -326,7 +380,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public string? Delimiter { get => Q("delimiter"); set => Q("delimiter", value); } /// @@ -337,7 +390,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequestpath, ipaddress, field1, and field2 are used in the grok_pattern output, with the intention that a user who knows the meanings rename these fields before using it. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get => Q("ecs_compatibility"); set => Q("ecs_compatibility", value); } /// @@ -345,7 +397,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequestexplanation, which is an array of strings that indicate how the structure finder produced its result. /// /// - [JsonIgnore] public bool? Explain { get => Q("explain"); set => Q("explain", value); } /// @@ -356,7 +407,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequestdelimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.TextStructure.FormatType? Format { get => Q("format"); set => Q("format", value); } /// @@ -367,7 +417,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequestgrok_pattern is not specified, the structure finder creates a Grok pattern. /// /// - [JsonIgnore] public string? GrokPattern { get => Q("grok_pattern"); set => Q("grok_pattern", value); } /// @@ -378,7 +427,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public string? Quote { get => Q("quote"); set => Q("quote", value); } /// @@ -388,7 +436,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequestfalse. /// /// - [JsonIgnore] public bool? ShouldTrimFields { get => Q("should_trim_fields"); set => Q("should_trim_fields", value); } /// @@ -397,7 +444,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -417,7 +463,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Field? TimestampField { get => Q("timestamp_field"); set => Q("timestamp_field", value); } /// @@ -539,7 +584,6 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonIgnore] public string? TimestampFormat { get => Q("timestamp_format"); set => Q("timestamp_format", value); } /// @@ -547,8 +591,11 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("messages")] - public ICollection Messages { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Messages { get; set; } } /// @@ -591,142 +638,806 @@ public sealed partial class FindMessageStructureRequest : PlainRequest /// -public sealed partial class FindMessageStructureRequestDescriptor : RequestDescriptor, FindMessageStructureRequestParameters> +public readonly partial struct FindMessageStructureRequestDescriptor { - internal FindMessageStructureRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest Instance { get; init; } - public FindMessageStructureRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindMessageStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindMessageStructure; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "text_structure.find_message_structure"; - - public FindMessageStructureRequestDescriptor ColumnNames(string? columnNames) => Qs("column_names", columnNames); - public FindMessageStructureRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public FindMessageStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? ecsCompatibility) => Qs("ecs_compatibility", ecsCompatibility); - public FindMessageStructureRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public FindMessageStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? format) => Qs("format", format); - public FindMessageStructureRequestDescriptor GrokPattern(string? grokPattern) => Qs("grok_pattern", grokPattern); - public FindMessageStructureRequestDescriptor Quote(string? quote) => Qs("quote", quote); - public FindMessageStructureRequestDescriptor ShouldTrimFields(bool? shouldTrimFields = true) => Qs("should_trim_fields", shouldTrimFields); - public FindMessageStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FindMessageStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) => Qs("timestamp_field", timestampField); - public FindMessageStructureRequestDescriptor TimestampFormat(string? timestampFormat) => Qs("timestamp_format", timestampFormat); + public FindMessageStructureRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private ICollection MessagesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest instance) => new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor descriptor) => descriptor.Instance; /// /// - /// The list of messages you want to analyze. + /// If the format is delimited, you can specify the column names in a comma-separated list. + /// If this parameter is not specified, the structure finder uses the column names from the header row of the text. + /// If the text does not have a header role, columns are named "column1", "column2", "column3", for example. /// /// - public FindMessageStructureRequestDescriptor Messages(ICollection messages) + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ColumnNames(string? value) { - MessagesValue = messages; - return Self; + Instance.ColumnNames = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If you the format is delimited, you can specify the character used to delimit the values in each row. + /// Only a single character is supported; the delimiter cannot have multiple characters. + /// By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). + /// In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + /// If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Delimiter(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("messages"); - JsonSerializer.Serialize(writer, MessagesValue, options); - writer.WriteEndObject(); + Instance.Delimiter = value; + return this; } -} - -/// -/// -/// Find the structure of text messages. -/// Find the structure of a list of text messages. -/// The messages must contain data that is suitable to be ingested into Elasticsearch. -/// -/// -/// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. -/// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. -/// -/// -/// The response from the API contains: -/// -/// -/// -/// -/// Sample messages. -/// -/// -/// -/// -/// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. -/// -/// -/// -/// -/// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. -/// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. -/// -/// -/// -/// -/// All this information can be calculated by the structure finder with no guidance. -/// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. -/// -/// -/// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. -/// It helps determine why the returned structure was chosen. -/// -/// -public sealed partial class FindMessageStructureRequestDescriptor : RequestDescriptor -{ - internal FindMessageStructureRequestDescriptor(Action configure) => configure.Invoke(this); - public FindMessageStructureRequestDescriptor() + /// + /// + /// The mode of compatibility with ECS compliant Grok patterns. + /// Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + /// This setting primarily has an impact when a whole message Grok pattern such as %{CATALINALOG} matches the input. + /// If the structure finder identifies a common structure but has no idea of meaning then generic field names such as path, ipaddress, field1, and field2 are used in the grok_pattern output, with the intention that a user who knows the meanings rename these fields before using it. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? value) { + Instance.EcsCompatibility = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureFindMessageStructure; + /// + /// + /// If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// The high level structure of the text. + /// By default, the API chooses the format. + /// In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + /// If the format is delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? value) + { + Instance.Format = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If the format is semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. + /// The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. + /// If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + /// If grok_pattern is not specified, the structure finder creates a Grok pattern. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor GrokPattern(string? value) + { + Instance.GrokPattern = value; + return this; + } - internal override string OperationName => "text_structure.find_message_structure"; + /// + /// + /// If the format is delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + /// Only a single character is supported. + /// If this parameter is not specified, the default value is a double quote ("). + /// If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Quote(string? value) + { + Instance.Quote = value; + return this; + } - public FindMessageStructureRequestDescriptor ColumnNames(string? columnNames) => Qs("column_names", columnNames); - public FindMessageStructureRequestDescriptor Delimiter(string? delimiter) => Qs("delimiter", delimiter); - public FindMessageStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? ecsCompatibility) => Qs("ecs_compatibility", ecsCompatibility); - public FindMessageStructureRequestDescriptor Explain(bool? explain = true) => Qs("explain", explain); - public FindMessageStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? format) => Qs("format", format); - public FindMessageStructureRequestDescriptor GrokPattern(string? grokPattern) => Qs("grok_pattern", grokPattern); - public FindMessageStructureRequestDescriptor Quote(string? quote) => Qs("quote", quote); - public FindMessageStructureRequestDescriptor ShouldTrimFields(bool? shouldTrimFields = true) => Qs("should_trim_fields", shouldTrimFields); - public FindMessageStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public FindMessageStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? timestampField) => Qs("timestamp_field", timestampField); - public FindMessageStructureRequestDescriptor TimestampFormat(string? timestampFormat) => Qs("timestamp_format", timestampFormat); + /// + /// + /// If the format is delimited, you can specify whether values between delimiters should have whitespace trimmed from them. + /// If this parameter is not specified and the delimiter is pipe (|), the default value is true. + /// Otherwise, the default value is false. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ShouldTrimFields(bool? value = true) + { + Instance.ShouldTrimFields = value; + return this; + } - private ICollection MessagesValue { get; set; } + /// + /// + /// The maximum amount of time that the structure analysis can take. + /// If the analysis is still running when the timeout expires, it will be stopped. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// - /// The list of messages you want to analyze. + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. /// /// - public FindMessageStructureRequestDescriptor Messages(ICollection messages) + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) { - MessagesValue = messages; - return Self; + Instance.TimestampField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) { - writer.WriteStartObject(); - writer.WritePropertyName("messages"); - JsonSerializer.Serialize(writer, MessagesValue, options); - writer.WriteEndObject(); + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The Java time format of the timestamp field in the text. + /// Only a subset of Java time format letter groups are supported: + /// + /// + /// + /// + /// a + /// + /// + /// + /// + /// d + /// + /// + /// + /// + /// dd + /// + /// + /// + /// + /// EEE + /// + /// + /// + /// + /// EEEE + /// + /// + /// + /// + /// H + /// + /// + /// + /// + /// HH + /// + /// + /// + /// + /// h + /// + /// + /// + /// + /// M + /// + /// + /// + /// + /// MM + /// + /// + /// + /// + /// MMM + /// + /// + /// + /// + /// MMMM + /// + /// + /// + /// + /// mm + /// + /// + /// + /// + /// ss + /// + /// + /// + /// + /// XX + /// + /// + /// + /// + /// XXX + /// + /// + /// + /// + /// yy + /// + /// + /// + /// + /// yyyy + /// + /// + /// + /// + /// zzz + /// + /// + /// + /// + /// Additionally S letter groups (fractional seconds) of length one to nine are supported providing they occur after ss and are separated from the ss by a period (.), comma (,), or colon (:). + /// Spacing and punctuation is also permitted with the exception a question mark (?), newline, and carriage return, together with literal text enclosed in single quotes. + /// For example, MM/dd HH.mm.ss,SSSSSS 'in' yyyy is a valid override format. + /// + /// + /// One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full grok_pattern. + /// Another is when the timestamp format is one that the structure finder does not consider by default. + /// + /// + /// If this parameter is not specified, the structure finder chooses the best format from a built-in set. + /// + /// + /// If the special value null is specified, the structure finder will not look for a primary timestamp in the text. + /// When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampFormat(string? value) + { + Instance.TimestampFormat = value; + return this; + } + + /// + /// + /// The list of messages you want to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Messages(System.Collections.Generic.ICollection value) + { + Instance.Messages = value; + return this; + } + + /// + /// + /// The list of messages you want to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Messages(params string[] values) + { + Instance.Messages = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Find the structure of text messages. +/// Find the structure of a list of text messages. +/// The messages must contain data that is suitable to be ingested into Elasticsearch. +/// +/// +/// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. +/// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. +/// +/// +/// The response from the API contains: +/// +/// +/// +/// +/// Sample messages. +/// +/// +/// +/// +/// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. +/// +/// +/// +/// +/// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. +/// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. +/// +/// +/// +/// +/// All this information can be calculated by the structure finder with no guidance. +/// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. +/// +/// +/// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. +/// It helps determine why the returned structure was chosen. +/// +/// +public readonly partial struct FindMessageStructureRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindMessageStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest instance) + { + Instance = instance; + } + + public FindMessageStructureRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest instance) => new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// If the format is delimited, you can specify the column names in a comma-separated list. + /// If this parameter is not specified, the structure finder uses the column names from the header row of the text. + /// If the text does not have a header role, columns are named "column1", "column2", "column3", for example. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ColumnNames(string? value) + { + Instance.ColumnNames = value; + return this; + } + + /// + /// + /// If you the format is delimited, you can specify the character used to delimit the values in each row. + /// Only a single character is supported; the delimiter cannot have multiple characters. + /// By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). + /// In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + /// If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Delimiter(string? value) + { + Instance.Delimiter = value; + return this; + } + + /// + /// + /// The mode of compatibility with ECS compliant Grok patterns. + /// Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + /// This setting primarily has an impact when a whole message Grok pattern such as %{CATALINALOG} matches the input. + /// If the structure finder identifies a common structure but has no idea of meaning then generic field names such as path, ipaddress, field1, and field2 are used in the grok_pattern output, with the intention that a user who knows the meanings rename these fields before using it. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor EcsCompatibility(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? value) + { + Instance.EcsCompatibility = value; + return this; + } + + /// + /// + /// If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } + + /// + /// + /// The high level structure of the text. + /// By default, the API chooses the format. + /// In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + /// If the format is delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Format(Elastic.Clients.Elasticsearch.TextStructure.FormatType? value) + { + Instance.Format = value; + return this; + } + + /// + /// + /// If the format is semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. + /// The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. + /// If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + /// If grok_pattern is not specified, the structure finder creates a Grok pattern. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor GrokPattern(string? value) + { + Instance.GrokPattern = value; + return this; + } + + /// + /// + /// If the format is delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + /// Only a single character is supported. + /// If this parameter is not specified, the default value is a double quote ("). + /// If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Quote(string? value) + { + Instance.Quote = value; + return this; + } + + /// + /// + /// If the format is delimited, you can specify whether values between delimiters should have whitespace trimmed from them. + /// If this parameter is not specified and the delimiter is pipe (|), the default value is true. + /// Otherwise, the default value is false. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ShouldTrimFields(bool? value = true) + { + Instance.ShouldTrimFields = value; + return this; + } + + /// + /// + /// The maximum amount of time that the structure analysis can take. + /// If the analysis is still running when the timeout expires, it will be stopped. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The name of the field that contains the primary timestamp of each record in the text. + /// In particular, if the text was ingested into an index, this is the field that would be used to populate the @timestamp field. + /// + /// + /// If the format is semi_structured_text, this field must match the name of the appropriate extraction in the grok_pattern. + /// Therefore, for semi-structured text, it is best not to specify this parameter unless grok_pattern is also specified. + /// + /// + /// For structured text, if you specify this parameter, the field must exist within the text. + /// + /// + /// If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + /// For structured text, it is not compulsory to have a timestamp in the text. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampField(System.Linq.Expressions.Expression> value) + { + Instance.TimestampField = value; + return this; + } + + /// + /// + /// The Java time format of the timestamp field in the text. + /// Only a subset of Java time format letter groups are supported: + /// + /// + /// + /// + /// a + /// + /// + /// + /// + /// d + /// + /// + /// + /// + /// dd + /// + /// + /// + /// + /// EEE + /// + /// + /// + /// + /// EEEE + /// + /// + /// + /// + /// H + /// + /// + /// + /// + /// HH + /// + /// + /// + /// + /// h + /// + /// + /// + /// + /// M + /// + /// + /// + /// + /// MM + /// + /// + /// + /// + /// MMM + /// + /// + /// + /// + /// MMMM + /// + /// + /// + /// + /// mm + /// + /// + /// + /// + /// ss + /// + /// + /// + /// + /// XX + /// + /// + /// + /// + /// XXX + /// + /// + /// + /// + /// yy + /// + /// + /// + /// + /// yyyy + /// + /// + /// + /// + /// zzz + /// + /// + /// + /// + /// Additionally S letter groups (fractional seconds) of length one to nine are supported providing they occur after ss and are separated from the ss by a period (.), comma (,), or colon (:). + /// Spacing and punctuation is also permitted with the exception a question mark (?), newline, and carriage return, together with literal text enclosed in single quotes. + /// For example, MM/dd HH.mm.ss,SSSSSS 'in' yyyy is a valid override format. + /// + /// + /// One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full grok_pattern. + /// Another is when the timestamp format is one that the structure finder does not consider by default. + /// + /// + /// If this parameter is not specified, the structure finder chooses the best format from a built-in set. + /// + /// + /// If the special value null is specified, the structure finder will not look for a primary timestamp in the text. + /// When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor TimestampFormat(string? value) + { + Instance.TimestampFormat = value; + return this; + } + + /// + /// + /// The list of messages you want to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Messages(System.Collections.Generic.ICollection value) + { + Instance.Messages = value; + return this; + } + + /// + /// + /// The list of messages you want to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Messages(params string[] values) + { + Instance.Messages = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureResponse.g.cs index 922ef596371..638e3913804 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/FindMessageStructureResponse.g.cs @@ -17,46 +17,240 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class FindMessageStructureResponse : ElasticsearchResponse +internal sealed partial class FindMessageStructureResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("charset")] - public string Charset { get; init; } - [JsonInclude, JsonPropertyName("ecs_compatibility")] - public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get; init; } - [JsonInclude, JsonPropertyName("field_stats")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FieldStat))] - public IReadOnlyDictionary FieldStats { get; init; } - [JsonInclude, JsonPropertyName("format")] - public Elastic.Clients.Elasticsearch.TextStructure.FormatType Format { get; init; } - [JsonInclude, JsonPropertyName("grok_pattern")] - public string? GrokPattern { get; init; } - [JsonInclude, JsonPropertyName("ingest_pipeline")] - public Elastic.Clients.Elasticsearch.Ingest.PipelineConfig IngestPipeline { get; init; } - [JsonInclude, JsonPropertyName("java_timestamp_formats")] - public IReadOnlyCollection? JavaTimestampFormats { get; init; } - [JsonInclude, JsonPropertyName("joda_timestamp_formats")] - public IReadOnlyCollection? JodaTimestampFormats { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; init; } - [JsonInclude, JsonPropertyName("multiline_start_pattern")] - public string? MultilineStartPattern { get; init; } - [JsonInclude, JsonPropertyName("need_client_timezone")] - public bool NeedClientTimezone { get; init; } - [JsonInclude, JsonPropertyName("num_lines_analyzed")] - public int NumLinesAnalyzed { get; init; } - [JsonInclude, JsonPropertyName("num_messages_analyzed")] - public int NumMessagesAnalyzed { get; init; } - [JsonInclude, JsonPropertyName("sample_start")] - public string SampleStart { get; init; } - [JsonInclude, JsonPropertyName("timestamp_field")] - public string? TimestampField { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropCharset = System.Text.Json.JsonEncodedText.Encode("charset"); + private static readonly System.Text.Json.JsonEncodedText PropEcsCompatibility = System.Text.Json.JsonEncodedText.Encode("ecs_compatibility"); + private static readonly System.Text.Json.JsonEncodedText PropFieldStats = System.Text.Json.JsonEncodedText.Encode("field_stats"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGrokPattern = System.Text.Json.JsonEncodedText.Encode("grok_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropIngestPipeline = System.Text.Json.JsonEncodedText.Encode("ingest_pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropJavaTimestampFormats = System.Text.Json.JsonEncodedText.Encode("java_timestamp_formats"); + private static readonly System.Text.Json.JsonEncodedText PropJodaTimestampFormats = System.Text.Json.JsonEncodedText.Encode("joda_timestamp_formats"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropMultilineStartPattern = System.Text.Json.JsonEncodedText.Encode("multiline_start_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropNeedClientTimezone = System.Text.Json.JsonEncodedText.Encode("need_client_timezone"); + private static readonly System.Text.Json.JsonEncodedText PropNumLinesAnalyzed = System.Text.Json.JsonEncodedText.Encode("num_lines_analyzed"); + private static readonly System.Text.Json.JsonEncodedText PropNumMessagesAnalyzed = System.Text.Json.JsonEncodedText.Encode("num_messages_analyzed"); + private static readonly System.Text.Json.JsonEncodedText PropSampleStart = System.Text.Json.JsonEncodedText.Encode("sample_start"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampField = System.Text.Json.JsonEncodedText.Encode("timestamp_field"); + + public override Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCharset = default; + LocalJsonValue propEcsCompatibility = default; + LocalJsonValue> propFieldStats = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGrokPattern = default; + LocalJsonValue propIngestPipeline = default; + LocalJsonValue?> propJavaTimestampFormats = default; + LocalJsonValue?> propJodaTimestampFormats = default; + LocalJsonValue propMappings = default; + LocalJsonValue propMultilineStartPattern = default; + LocalJsonValue propNeedClientTimezone = default; + LocalJsonValue propNumLinesAnalyzed = default; + LocalJsonValue propNumMessagesAnalyzed = default; + LocalJsonValue propSampleStart = default; + LocalJsonValue propTimestampField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharset.TryReadProperty(ref reader, options, PropCharset, null)) + { + continue; + } + + if (propEcsCompatibility.TryReadProperty(ref reader, options, PropEcsCompatibility, null)) + { + continue; + } + + if (propFieldStats.TryReadProperty(ref reader, options, PropFieldStats, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGrokPattern.TryReadProperty(ref reader, options, PropGrokPattern, null)) + { + continue; + } + + if (propIngestPipeline.TryReadProperty(ref reader, options, PropIngestPipeline, null)) + { + continue; + } + + if (propJavaTimestampFormats.TryReadProperty(ref reader, options, PropJavaTimestampFormats, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJodaTimestampFormats.TryReadProperty(ref reader, options, PropJodaTimestampFormats, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propMultilineStartPattern.TryReadProperty(ref reader, options, PropMultilineStartPattern, null)) + { + continue; + } + + if (propNeedClientTimezone.TryReadProperty(ref reader, options, PropNeedClientTimezone, null)) + { + continue; + } + + if (propNumLinesAnalyzed.TryReadProperty(ref reader, options, PropNumLinesAnalyzed, null)) + { + continue; + } + + if (propNumMessagesAnalyzed.TryReadProperty(ref reader, options, PropNumMessagesAnalyzed, null)) + { + continue; + } + + if (propSampleStart.TryReadProperty(ref reader, options, PropSampleStart, null)) + { + continue; + } + + if (propTimestampField.TryReadProperty(ref reader, options, PropTimestampField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Charset = propCharset.Value, + EcsCompatibility = propEcsCompatibility.Value, + FieldStats = propFieldStats.Value, + Format = propFormat.Value, + GrokPattern = propGrokPattern.Value, + IngestPipeline = propIngestPipeline.Value, + JavaTimestampFormats = propJavaTimestampFormats.Value, + JodaTimestampFormats = propJodaTimestampFormats.Value, + Mappings = propMappings.Value, + MultilineStartPattern = propMultilineStartPattern.Value, + NeedClientTimezone = propNeedClientTimezone.Value, + NumLinesAnalyzed = propNumLinesAnalyzed.Value, + NumMessagesAnalyzed = propNumMessagesAnalyzed.Value, + SampleStart = propSampleStart.Value, + TimestampField = propTimestampField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharset, value.Charset, null, null); + writer.WriteProperty(options, PropEcsCompatibility, value.EcsCompatibility, null, null); + writer.WriteProperty(options, PropFieldStats, value.FieldStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGrokPattern, value.GrokPattern, null, null); + writer.WriteProperty(options, PropIngestPipeline, value.IngestPipeline, null, null); + writer.WriteProperty(options, PropJavaTimestampFormats, value.JavaTimestampFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJodaTimestampFormats, value.JodaTimestampFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropMultilineStartPattern, value.MultilineStartPattern, null, null); + writer.WriteProperty(options, PropNeedClientTimezone, value.NeedClientTimezone, null, null); + writer.WriteProperty(options, PropNumLinesAnalyzed, value.NumLinesAnalyzed, null, null); + writer.WriteProperty(options, PropNumMessagesAnalyzed, value.NumMessagesAnalyzed, null, null); + writer.WriteProperty(options, PropSampleStart, value.SampleStart, null, null); + writer.WriteProperty(options, PropTimestampField, value.TimestampField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponseConverter))] +public sealed partial class FindMessageStructureResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FindMessageStructureResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FindMessageStructureResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Charset { get; set; } + public Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType? EcsCompatibility { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary FieldStats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TextStructure.FormatType Format { get; set; } + public string? GrokPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.PipelineConfig IngestPipeline { get; set; } + public System.Collections.Generic.IReadOnlyCollection? JavaTimestampFormats { get; set; } + public System.Collections.Generic.IReadOnlyCollection? JodaTimestampFormats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; set; } + public string? MultilineStartPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool NeedClientTimezone { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumLinesAnalyzed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumMessagesAnalyzed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string SampleStart { get; set; } + public string? TimestampField { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternRequest.g.cs index a5739c82910..0d0bfd4a876 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class TestGrokPatternRequestParameters : RequestParameters +public sealed partial class TestGrokPatternRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,6 +35,54 @@ public sealed partial class TestGrokPatternRequestParameters : RequestParameters public string? EcsCompatibility { get => Q("ecs_compatibility"); set => Q("ecs_compatibility", value); } } +internal sealed partial class TestGrokPatternRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGrokPattern = System.Text.Json.JsonEncodedText.Encode("grok_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGrokPattern = default; + LocalJsonValue> propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGrokPattern.TryReadProperty(ref reader, options, PropGrokPattern, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GrokPattern = propGrokPattern.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGrokPattern, value.GrokPattern, null, null); + writer.WriteProperty(options, PropText, value.Text, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Test a Grok pattern. @@ -49,11 +90,35 @@ public sealed partial class TestGrokPatternRequestParameters : RequestParameters /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. /// /// -public sealed partial class TestGrokPatternRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestConverter))] +public sealed partial class TestGrokPatternRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureTestGrokPattern; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestGrokPatternRequest(string grokPattern, System.Collections.Generic.ICollection text) + { + GrokPattern = grokPattern; + Text = text; + } +#if NET7_0_OR_GREATER + public TestGrokPatternRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The request contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TestGrokPatternRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TestGrokPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TextStructureTestGrokPattern; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; @@ -66,7 +131,6 @@ public sealed partial class TestGrokPatternRequest : PlainRequestdisabled and v1. /// /// - [JsonIgnore] public string? EcsCompatibility { get => Q("ecs_compatibility"); set => Q("ecs_compatibility", value); } /// @@ -74,16 +138,22 @@ public sealed partial class TestGrokPatternRequest : PlainRequest /// - [JsonInclude, JsonPropertyName("grok_pattern")] - public string GrokPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string GrokPattern { get; set; } /// /// /// The lines of text to run the Grok pattern on. /// /// - [JsonInclude, JsonPropertyName("text")] - public ICollection Text { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Text { get; set; } } /// @@ -93,36 +163,46 @@ public sealed partial class TestGrokPatternRequest : PlainRequest /// -public sealed partial class TestGrokPatternRequestDescriptor : RequestDescriptor +public readonly partial struct TestGrokPatternRequestDescriptor { - internal TestGrokPatternRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest Instance { get; init; } - public TestGrokPatternRequestDescriptor() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestGrokPatternRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TextStructureTestGrokPattern; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "text_structure.test_grok_pattern"; + public TestGrokPatternRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public TestGrokPatternRequestDescriptor EcsCompatibility(string? ecsCompatibility) => Qs("ecs_compatibility", ecsCompatibility); + public static explicit operator Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest instance) => new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor descriptor) => descriptor.Instance; - private string GrokPatternValue { get; set; } - private ICollection TextValue { get; set; } + /// + /// + /// The mode of compatibility with ECS compliant Grok patterns. + /// Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + /// Valid values are disabled and v1. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor EcsCompatibility(string? value) + { + Instance.EcsCompatibility = value; + return this; + } /// /// /// The Grok pattern to run on the text. /// /// - public TestGrokPatternRequestDescriptor GrokPattern(string grokPattern) + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor GrokPattern(string value) { - GrokPatternValue = grokPattern; - return Self; + Instance.GrokPattern = value; + return this; } /// @@ -130,19 +210,70 @@ public TestGrokPatternRequestDescriptor GrokPattern(string grokPattern) /// The lines of text to run the Grok pattern on. /// /// - public TestGrokPatternRequestDescriptor Text(ICollection text) + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor Text(System.Collections.Generic.ICollection value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The lines of text to run the Grok pattern on. + /// + /// + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor Text(params string[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("grok_pattern"); - writer.WriteStringValue(GrokPatternValue); - writer.WritePropertyName("text"); - JsonSerializer.Serialize(writer, TextValue, options); - writer.WriteEndObject(); + Instance.Text = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor(new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternResponse.g.cs index 50646b97f83..92268ff43f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TextStructure/TestGrokPatternResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public sealed partial class TestGrokPatternResponse : ElasticsearchResponse +internal sealed partial class TestGrokPatternResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("matches")] - public IReadOnlyCollection Matches { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMatches = System.Text.Json.JsonEncodedText.Encode("matches"); + + public override Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMatches = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMatches.TryReadProperty(ref reader, options, PropMatches, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Matches = propMatches.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMatches, value.Matches, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponseConverter))] +public sealed partial class TestGrokPatternResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestGrokPatternResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TestGrokPatternResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Matches { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformRequest.g.cs index 4c99c8484f9..53a8137c420 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class DeleteTransformRequestParameters : RequestParameters +public sealed partial class DeleteTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -56,33 +49,83 @@ public sealed partial class DeleteTransformRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class DeleteTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Delete a transform. -/// Deletes a transform. /// /// -public sealed partial class DeleteTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestConverter))] +public sealed partial class DeleteTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DeleteTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public DeleteTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementDeleteTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementDeleteTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.DELETE; internal override bool SupportsBody => false; internal override string OperationName => "transform.delete_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// If this value is true, the destination index is deleted together with the transform. If false, the destination /// index will not be deleted /// /// - [JsonIgnore] public bool? DeleteDestIndex { get => Q("delete_dest_index"); set => Q("delete_dest_index", value); } /// @@ -91,7 +134,6 @@ public DeleteTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// deleted regardless of its current state. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -99,43 +141,131 @@ public DeleteTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Delete a transform. -/// Deletes a transform. /// /// -public sealed partial class DeleteTransformRequestDescriptor : RequestDescriptor +public readonly partial struct DeleteTransformRequestDescriptor { - internal DeleteTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest Instance { get; init; } - public DeleteTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementDeleteTransform; + public DeleteTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public DeleteTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.delete_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } + + /// + /// + /// If this value is true, the destination index is deleted together with the transform. If false, the destination + /// index will not be deleted + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor DeleteDestIndex(bool? value = true) + { + Instance.DeleteDestIndex = value; + return this; + } + + /// + /// + /// If this value is false, the transform must be stopped before it can be deleted. If true, the transform is + /// deleted regardless of its current state. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public DeleteTransformRequestDescriptor DeleteDestIndex(bool? deleteDestIndex = true) => Qs("delete_dest_index", deleteDestIndex); - public DeleteTransformRequestDescriptor Force(bool? force = true) => Qs("force", force); - public DeleteTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public DeleteTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformResponse.g.cs index afcb0daed68..1b38704cf39 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/DeleteTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class DeleteTransformResponse : ElasticsearchResponse +internal sealed partial class DeleteTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponseConverter))] +public sealed partial class DeleteTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformRequest.g.cs index c5d4152ca6b..bad0ff5a59f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class GetTransformRequestParameters : RequestParameters +public sealed partial class GetTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -84,30 +77,81 @@ public sealed partial class GetTransformRequestParameters : RequestParameters public int? Size { get => Q("size"); set => Q("size", value); } } +internal sealed partial class GetTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get transforms. -/// Retrieves configuration information for transforms. +/// Get configuration information for transforms. /// /// -public sealed partial class GetTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestConverter))] +public sealed partial class GetTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : base(r => r.Optional("transform_id", transformId)) + { + } +#if NET7_0_OR_GREATER public GetTransformRequest() { } - - public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : base(r => r.Optional("transform_id", transformId)) +#endif +#if !NET7_0_OR_GREATER + public GetTransformRequest() { } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementGetTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementGetTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "transform.get_transform"; + /// + /// + /// Identifier for the transform. It can be a transform identifier or a + /// wildcard expression. You can get information for all transforms by using + /// _all, by specifying * as the <transform_id>, or by omitting the + /// <transform_id>. + /// + /// + public Elastic.Clients.Elasticsearch.Names? TransformId { get => P("transform_id"); set => PO("transform_id", value); } + /// /// /// Specifies what to do when the request: @@ -134,7 +178,6 @@ public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : b /// there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -144,7 +187,6 @@ public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : b /// be retrieved and then added to another cluster. /// /// - [JsonIgnore] public bool? ExcludeGenerated { get => Q("exclude_generated"); set => Q("exclude_generated", value); } /// @@ -152,7 +194,6 @@ public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : b /// Skips the specified number of transforms. /// /// - [JsonIgnore] public int? From { get => Q("from"); set => Q("from", value); } /// @@ -160,48 +201,171 @@ public GetTransformRequest(Elastic.Clients.Elasticsearch.Names? transformId) : b /// Specifies the maximum number of transforms to obtain. /// /// - [JsonIgnore] public int? Size { get => Q("size"); set => Q("size", value); } } /// /// /// Get transforms. -/// Retrieves configuration information for transforms. +/// Get configuration information for transforms. /// /// -public sealed partial class GetTransformRequestDescriptor : RequestDescriptor +public readonly partial struct GetTransformRequestDescriptor { - internal GetTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest instance) + { + Instance = instance; + } - public GetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Names? transformId) : base(r => r.Optional("transform_id", transformId)) + public GetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Names? transformId) { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(transformId); } public GetTransformRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementGetTransform; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// Identifier for the transform. It can be a transform identifier or a + /// wildcard expression. You can get information for all transforms by using + /// _all, by specifying * as the <transform_id>, or by omitting the + /// <transform_id>. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Names? value) + { + Instance.TransformId = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no transforms that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// If this parameter is false, the request returns a 404 status code when + /// there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - internal override string OperationName => "transform.get_transform"; + /// + /// + /// Excludes fields that were automatically added when creating the + /// transform. This allows the configuration to be in an acceptable format to + /// be retrieved and then added to another cluster. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor ExcludeGenerated(bool? value = true) + { + Instance.ExcludeGenerated = value; + return this; + } + + /// + /// + /// Skips the specified number of transforms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor From(int? value) + { + Instance.From = value; + return this; + } - public GetTransformRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetTransformRequestDescriptor ExcludeGenerated(bool? excludeGenerated = true) => Qs("exclude_generated", excludeGenerated); - public GetTransformRequestDescriptor From(int? from) => Qs("from", from); - public GetTransformRequestDescriptor Size(int? size) => Qs("size", size); + /// + /// + /// Specifies the maximum number of transforms to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Names? transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Optional("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformResponse.g.cs index a9ade3c0e06..405f610a4a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class GetTransformResponse : ElasticsearchResponse +internal sealed partial class GetTransformResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTransforms = System.Text.Json.JsonEncodedText.Encode("transforms"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propTransforms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTransforms.TryReadProperty(ref reader, options, PropTransforms, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Transforms = propTransforms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTransforms, value.Transforms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponseConverter))] +public sealed partial class GetTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("transforms")] - public IReadOnlyCollection Transforms { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Transforms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsRequest.g.cs index bfd538ede2c..5732e0aa256 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class GetTransformStatsRequestParameters : RequestParameters +public sealed partial class GetTransformStatsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -82,26 +75,83 @@ public sealed partial class GetTransformStatsRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class GetTransformStatsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get transform stats. -/// Retrieves usage information for transforms. +/// +/// +/// Get usage information for transforms. /// /// -public sealed partial class GetTransformStatsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestConverter))] +public sealed partial class GetTransformStatsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Names transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public GetTransformStatsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementGetTransformStats; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementGetTransformStats; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; internal override string OperationName => "transform.get_transform_stats"; + /// + /// + /// Identifier for the transform. It can be a transform identifier or a + /// wildcard expression. You can get information for all transforms by using + /// _all, by specifying * as the <transform_id>, or by omitting the + /// <transform_id>. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// Specifies what to do when the request: @@ -128,7 +178,6 @@ public GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Names transformId) /// there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -136,7 +185,6 @@ public GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Names transformId) /// Skips the specified number of transforms. /// /// - [JsonIgnore] public long? From { get => Q("from"); set => Q("from", value); } /// @@ -144,7 +192,6 @@ public GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Names transformId) /// Specifies the maximum number of transforms to obtain. /// /// - [JsonIgnore] public long? Size { get => Q("size"); set => Q("size", value); } /// @@ -152,44 +199,167 @@ public GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Names transformId) /// Controls the time to wait for the stats /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Get transform stats. -/// Retrieves usage information for transforms. +/// +/// +/// Get usage information for transforms. /// /// -public sealed partial class GetTransformStatsRequestDescriptor : RequestDescriptor +public readonly partial struct GetTransformStatsRequestDescriptor { - internal GetTransformStatsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest Instance { get; init; } - public GetTransformStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Names transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTransformStatsRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementGetTransformStats; + public GetTransformStatsRequestDescriptor(Elastic.Clients.Elasticsearch.Names transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public GetTransformStatsRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.get_transform_stats"; + /// + /// + /// Identifier for the transform. It can be a transform identifier or a + /// wildcard expression. You can get information for all transforms by using + /// _all, by specifying * as the <transform_id>, or by omitting the + /// <transform_id>. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Names value) + { + Instance.TransformId = value; + return this; + } - public GetTransformStatsRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public GetTransformStatsRequestDescriptor From(long? from) => Qs("from", from); - public GetTransformStatsRequestDescriptor Size(long? size) => Qs("size", size); - public GetTransformStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Specifies what to do when the request: + /// + /// + /// + /// + /// Contains wildcard expressions and there are no transforms that match. + /// + /// + /// + /// + /// Contains the _all string or no identifiers and there are no matches. + /// + /// + /// + /// + /// Contains wildcard expressions and there are only partial matches. + /// + /// + /// + /// + /// If this parameter is false, the request returns a 404 status code when + /// there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } + + /// + /// + /// Skips the specified number of transforms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor From(long? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Specifies the maximum number of transforms to obtain. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor Size(long? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Controls the time to wait for the stats + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public GetTransformStatsRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Names transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsResponse.g.cs index 463e3808c08..dbf3a81c86d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/GetTransformStatsResponse.g.cs @@ -17,19 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class GetTransformStatsResponse : ElasticsearchResponse +internal sealed partial class GetTransformStatsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTransforms = System.Text.Json.JsonEncodedText.Encode("transforms"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propTransforms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTransforms.TryReadProperty(ref reader, options, PropTransforms, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Transforms = propTransforms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTransforms, value.Transforms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponseConverter))] +public sealed partial class GetTransformStatsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("transforms")] - public IReadOnlyCollection Transforms { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetTransformStatsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetTransformStatsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Transforms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformRequest.g.cs index c9dd9773b16..af7d06b2c2e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class PreviewTransformRequestParameters : RequestParameters +public sealed partial class PreviewTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,117 @@ public sealed partial class PreviewTransformRequestParameters : RequestParameter public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PreviewTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropLatest = System.Text.Json.JsonEncodedText.Encode("latest"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionPolicy = System.Text.Json.JsonEncodedText.Encode("retention_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropSync = System.Text.Json.JsonEncodedText.Encode("sync"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propFrequency = default; + LocalJsonValue propLatest = default; + LocalJsonValue propPivot = default; + LocalJsonValue propRetentionPolicy = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSource = default; + LocalJsonValue propSync = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propLatest.TryReadProperty(ref reader, options, PropLatest, null)) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propRetentionPolicy.TryReadProperty(ref reader, options, PropRetentionPolicy, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSync.TryReadProperty(ref reader, options, PropSync, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Dest = propDest.Value, + Frequency = propFrequency.Value, + Latest = propLatest.Value, + Pivot = propPivot.Value, + RetentionPolicy = propRetentionPolicy.Value, + Settings = propSettings.Value, + Source = propSource.Value, + Sync = propSync.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropLatest, value.Latest, null, null); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropRetentionPolicy, value.RetentionPolicy, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSync, value.Sync, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Preview a transform. @@ -52,31 +156,50 @@ public sealed partial class PreviewTransformRequestParameters : RequestParameter /// types of the source index and the transform aggregations. /// /// -public sealed partial class PreviewTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestConverter))] +public sealed partial class PreviewTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : base(r => r.Optional("transform_id", transformId)) + { + } +#if NET7_0_OR_GREATER public PreviewTransformRequest() { } - - public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : base(r => r.Optional("transform_id", transformId)) +#endif +#if !NET7_0_OR_GREATER + public PreviewTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { + _ = sentinel; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPreviewTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementPreviewTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "transform.preview_transform"; + /// + /// + /// Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform + /// configuration details in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.Id? TransformId { get => P("transform_id"); set => PO("transform_id", value); } + /// /// /// Period to wait for a response. If no response is received before the /// timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -84,7 +207,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// Free text description of the transform. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -92,7 +214,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// The destination for the transform. /// /// - [JsonInclude, JsonPropertyName("dest")] public Elastic.Clients.Elasticsearch.TransformManagement.Destination? Dest { get; set; } /// @@ -103,7 +224,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// indexing. The minimum value is 1s and the maximum is 1h. /// /// - [JsonInclude, JsonPropertyName("frequency")] public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } /// @@ -112,7 +232,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// each unique key. /// /// - [JsonInclude, JsonPropertyName("latest")] public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; set; } /// @@ -122,7 +241,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// the data. /// /// - [JsonInclude, JsonPropertyName("pivot")] public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; set; } /// @@ -131,7 +249,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// criteria is deleted from the destination index. /// /// - [JsonInclude, JsonPropertyName("retention_policy")] public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; set; } /// @@ -139,7 +256,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// Defines optional transform settings. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.TransformManagement.Settings? Settings { get; set; } /// @@ -147,7 +263,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// The source of the data for the transform. /// /// - [JsonInclude, JsonPropertyName("source")] public Elastic.Clients.Elasticsearch.TransformManagement.Source? Source { get; set; } /// @@ -155,7 +270,6 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// Defines the properties transforms require to run continuously. /// /// - [JsonInclude, JsonPropertyName("sync")] public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; set; } } @@ -170,67 +284,62 @@ public PreviewTransformRequest(Elastic.Clients.Elasticsearch.Id? transformId) : /// types of the source index and the transform aggregations. /// /// -public sealed partial class PreviewTransformRequestDescriptor : RequestDescriptor, PreviewTransformRequestParameters> +public readonly partial struct PreviewTransformRequestDescriptor { - internal PreviewTransformRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest Instance { get; init; } - public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id? transformId) : base(r => r.Optional("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest instance) { + Instance = instance; } - public PreviewTransformRequestDescriptor() + public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id? transformId) { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(transformId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPreviewTransform; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "transform.preview_transform"; + public PreviewTransformRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PreviewTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor descriptor) => descriptor.Instance; - public PreviewTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id? transformId) + /// + /// + /// Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform + /// configuration details in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("transform_id", transformId); - return Self; + Instance.TransformId = value; + return this; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Latest? LatestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor LatestDescriptor { get; set; } - private Action> LatestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Pivot? PivotValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor PivotDescriptor { get; set; } - private Action> PivotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action> RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action> SyncDescriptorAction { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public PreviewTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -238,28 +347,32 @@ public PreviewTransformRequestDescriptor Description(string? descript /// The destination for the transform. /// /// - public PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? dest) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -270,10 +383,10 @@ public PreviewTransformRequestDescriptor Dest(Action /// - public PreviewTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -282,28 +395,47 @@ public PreviewTransformRequestDescriptor Frequency(Elastic.Clients.El /// each unique key. /// /// - public PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? latest) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? value) { - LatestDescriptor = null; - LatestDescriptorAction = null; - LatestValue = latest; - return Self; + Instance.Latest = value; + return this; } - public PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) + /// + /// + /// The latest method transforms the data by finding the latest document for + /// each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Latest(System.Action action) + { + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; + } + + /// + /// + /// The latest method transforms the data by finding the latest document for + /// each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Latest(System.Action> action) { - LatestValue = null; - LatestDescriptorAction = null; - LatestDescriptor = descriptor; - return Self; + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Latest(Action> configure) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. + /// These objects define the group by fields and the aggregation to reduce + /// the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? value) { - LatestValue = null; - LatestDescriptor = null; - LatestDescriptorAction = configure; - return Self; + Instance.Pivot = value; + return this; } /// @@ -313,28 +445,36 @@ public PreviewTransformRequestDescriptor Latest(Action /// - public PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? pivot) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot() { - PivotDescriptor = null; - PivotDescriptorAction = null; - PivotValue = pivot; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. + /// These objects define the group by fields and the aggregation to reduce + /// the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot(System.Action? action) { - PivotValue = null; - PivotDescriptorAction = null; - PivotDescriptor = descriptor; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Pivot(Action> configure) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. + /// These objects define the group by fields and the aggregation to reduce + /// the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot(System.Action>? action) { - PivotValue = null; - PivotDescriptor = null; - PivotDescriptorAction = configure; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } /// @@ -343,28 +483,34 @@ public PreviewTransformRequestDescriptor Pivot(Action /// - public PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = value; + return this; } - public PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RetentionPolicy(System.Action action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor RetentionPolicy(Action> configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RetentionPolicy(System.Action> action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -372,28 +518,32 @@ public PreviewTransformRequestDescriptor RetentionPolicy(Action /// - public PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -401,28 +551,32 @@ public PreviewTransformRequestDescriptor Settings(Action /// - public PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? source) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Source(Action> configure) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } /// @@ -430,158 +584,87 @@ public PreviewTransformRequestDescriptor Source(Action /// - public PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = value; + return this; } - public PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Sync(System.Action action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Sync(Action> configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Sync(System.Action> action) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) + if (action is null) { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); + return new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (LatestDescriptor is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestDescriptor, options); - } - else if (LatestDescriptorAction is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(LatestDescriptorAction), options); - } - else if (LatestValue is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (PivotDescriptor is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotDescriptor, options); - } - else if (PivotDescriptorAction is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(PivotDescriptorAction), options); - } - else if (PivotValue is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -596,67 +679,62 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// types of the source index and the transform aggregations. /// /// -public sealed partial class PreviewTransformRequestDescriptor : RequestDescriptor +public readonly partial struct PreviewTransformRequestDescriptor { - internal PreviewTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest Instance { get; init; } - public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id? transformId) : base(r => r.Optional("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest instance) { + Instance = instance; } - public PreviewTransformRequestDescriptor() + public PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id? transformId) { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(transformId); } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPreviewTransform; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; - - internal override bool SupportsBody => true; - - internal override string OperationName => "transform.preview_transform"; + public PreviewTransformRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PreviewTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor descriptor) => descriptor.Instance; - public PreviewTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id? transformId) + /// + /// + /// Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform + /// configuration details in the request body. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id? value) { - RouteValues.Optional("transform_id", transformId); - return Self; + Instance.TransformId = value; + return this; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Latest? LatestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor LatestDescriptor { get; set; } - private Action LatestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Pivot? PivotValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor PivotDescriptor { get; set; } - private Action PivotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action SyncDescriptorAction { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public PreviewTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -664,28 +742,32 @@ public PreviewTransformRequestDescriptor Description(string? description) /// The destination for the transform. /// /// - public PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? dest) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public PreviewTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -696,10 +778,10 @@ public PreviewTransformRequestDescriptor Dest(Action /// - public PreviewTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -708,28 +790,22 @@ public PreviewTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch /// each unique key. /// /// - public PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? latest) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? value) { - LatestDescriptor = null; - LatestDescriptorAction = null; - LatestValue = latest; - return Self; + Instance.Latest = value; + return this; } - public PreviewTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) - { - LatestValue = null; - LatestDescriptorAction = null; - LatestDescriptor = descriptor; - return Self; - } - - public PreviewTransformRequestDescriptor Latest(Action configure) + /// + /// + /// The latest method transforms the data by finding the latest document for + /// each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Latest(System.Action> action) { - LatestValue = null; - LatestDescriptor = null; - LatestDescriptorAction = configure; - return Self; + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; } /// @@ -739,28 +815,36 @@ public PreviewTransformRequestDescriptor Latest(Action /// - public PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? pivot) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? value) { - PivotDescriptor = null; - PivotDescriptorAction = null; - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public PreviewTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. + /// These objects define the group by fields and the aggregation to reduce + /// the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot() { - PivotValue = null; - PivotDescriptorAction = null; - PivotDescriptor = descriptor; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Pivot(Action configure) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. + /// These objects define the group by fields and the aggregation to reduce + /// the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pivot(System.Action>? action) { - PivotValue = null; - PivotDescriptor = null; - PivotDescriptorAction = configure; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } /// @@ -769,28 +853,22 @@ public PreviewTransformRequestDescriptor Pivot(Action /// - public PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = value; + return this; } - public PreviewTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) - { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; - } - - public PreviewTransformRequestDescriptor RetentionPolicy(Action configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RetentionPolicy(System.Action> action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -798,28 +876,32 @@ public PreviewTransformRequestDescriptor RetentionPolicy(Action /// - public PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public PreviewTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public PreviewTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -827,28 +909,32 @@ public PreviewTransformRequestDescriptor Settings(Action /// - public PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? source) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PreviewTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Source(Action configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Sync = value; + return this; } /// @@ -856,157 +942,64 @@ public PreviewTransformRequestDescriptor Source(Action /// - public PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Sync(System.Action> action) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public PreviewTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest Build(System.Action>? action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PreviewTransformRequestDescriptor Sync(Action configure) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor ErrorTrace(bool? value) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } - - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } - - if (LatestDescriptor is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestDescriptor, options); - } - else if (LatestDescriptorAction is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(LatestDescriptorAction), options); - } - else if (LatestValue is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestValue, options); - } - - if (PivotDescriptor is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotDescriptor, options); - } - else if (PivotDescriptorAction is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(PivotDescriptorAction), options); - } - else if (PivotValue is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - } + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformResponse.g.cs index 3deeb3c40ce..c2ae26f58e1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PreviewTransformResponse.g.cs @@ -17,19 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class PreviewTransformResponse : ElasticsearchResponse +internal sealed partial class PreviewTransformResponseConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("generated_dest_index")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexState GeneratedDestIndex { get; init; } - [JsonInclude, JsonPropertyName("preview")] - public IReadOnlyCollection Preview { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropGeneratedDestIndex = System.Text.Json.JsonEncodedText.Encode("generated_dest_index"); + private static readonly System.Text.Json.JsonEncodedText PropPreview = System.Text.Json.JsonEncodedText.Encode("preview"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGeneratedDestIndex = default; + LocalJsonValue> propPreview = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGeneratedDestIndex.TryReadProperty(ref reader, options, PropGeneratedDestIndex, null)) + { + continue; + } + + if (propPreview.TryReadProperty(ref reader, options, PropPreview, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, static TTransform (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GeneratedDestIndex = propGeneratedDestIndex.Value, + Preview = propPreview.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGeneratedDestIndex, value.GeneratedDestIndex, null, null); + writer.WriteProperty(options, PropPreview, value.Preview, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TTransform v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))); + writer.WriteEndObject(); + } +} + +internal sealed partial class PreviewTransformResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(PreviewTransformResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(PreviewTransformResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponseConverterFactory))] +public sealed partial class PreviewTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreviewTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PreviewTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +Elastic.Clients.Elasticsearch.IndexManagement.IndexState GeneratedDestIndex { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyCollection Preview { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformRequest.g.cs index 7572393a22f..d469f4cd0dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class PutTransformRequestParameters : RequestParameters +public sealed partial class PutTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -51,6 +44,126 @@ public sealed partial class PutTransformRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class PutTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropLatest = System.Text.Json.JsonEncodedText.Encode("latest"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionPolicy = System.Text.Json.JsonEncodedText.Encode("retention_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropSync = System.Text.Json.JsonEncodedText.Encode("sync"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propFrequency = default; + LocalJsonValue propLatest = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPivot = default; + LocalJsonValue propRetentionPolicy = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSource = default; + LocalJsonValue propSync = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propLatest.TryReadProperty(ref reader, options, PropLatest, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propRetentionPolicy.TryReadProperty(ref reader, options, PropRetentionPolicy, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSync.TryReadProperty(ref reader, options, PropSync, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Dest = propDest.Value, + Frequency = propFrequency.Value, + Latest = propLatest.Value, + Meta = propMeta.Value, + Pivot = propPivot.Value, + RetentionPolicy = propRetentionPolicy.Value, + Settings = propSettings.Value, + Source = propSource.Value, + Sync = propSync.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropLatest, value.Latest, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropRetentionPolicy, value.RetentionPolicy, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSync, value.Sync, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Create a transform. @@ -81,20 +194,52 @@ public sealed partial class PutTransformRequestParameters : RequestParameters /// give users any privileges on .data-frame-internal* indices. /// /// -public sealed partial class PutTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestConverter))] +public sealed partial class PutTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Obsolete("The request contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPutTransform; + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId, Elastic.Clients.Elasticsearch.TransformManagement.Destination dest, Elastic.Clients.Elasticsearch.TransformManagement.Source source) : base(r => r.Required("transform_id", transformId)) + { + Dest = dest; + Source = source; + } +#if NET7_0_OR_GREATER + public PutTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementPutTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; internal override bool SupportsBody => true; internal override string OperationName => "transform.put_transform"; + /// + /// + /// Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// When the transform is created, a series of validations occur to ensure its success. For example, there is a @@ -104,7 +249,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// the exception of privilege checks. /// /// - [JsonIgnore] public bool? DeferValidation { get => Q("defer_validation"); set => Q("defer_validation", value); } /// @@ -112,7 +256,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -120,7 +263,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// Free text description of the transform. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -128,8 +270,11 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// The destination for the transform. /// /// - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.TransformManagement.Destination Dest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.Destination Dest { get; set; } /// /// @@ -138,7 +283,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// The minimum value is 1s and the maximum is 1h. /// /// - [JsonInclude, JsonPropertyName("frequency")] public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } /// @@ -146,7 +290,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// The latest method transforms the data by finding the latest document for each unique key. /// /// - [JsonInclude, JsonPropertyName("latest")] public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; set; } /// @@ -154,8 +297,7 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// Defines optional transform metadata. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -163,7 +305,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// and the aggregation to reduce the data. /// /// - [JsonInclude, JsonPropertyName("pivot")] public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; set; } /// @@ -172,7 +313,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// destination index. /// /// - [JsonInclude, JsonPropertyName("retention_policy")] public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; set; } /// @@ -180,7 +320,6 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// Defines optional transform settings. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.TransformManagement.Settings? Settings { get; set; } /// @@ -188,15 +327,17 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// The source of the data for the transform. /// /// - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.TransformManagement.Source Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.Source Source { get; set; } /// /// /// Defines the properties transforms require to run continuously. /// /// - [JsonInclude, JsonPropertyName("sync")] public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; set; } } @@ -230,65 +371,79 @@ public PutTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base( /// give users any privileges on .data-frame-internal* indices. /// /// -public sealed partial class PutTransformRequestDescriptor : RequestDescriptor, PutTransformRequestParameters> +public readonly partial struct PutTransformRequestDescriptor { - internal PutTransformRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest Instance { get; init; } - public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPutTransform; + public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(transformId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.put_transform"; + /// + /// + /// Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } - public PutTransformRequestDescriptor DeferValidation(bool? deferValidation = true) => Qs("defer_validation", deferValidation); - public PutTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public PutTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) - { - RouteValues.Required("transform_id", transformId); - return Self; - } - - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Latest? LatestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor LatestDescriptor { get; set; } - private Action> LatestDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Pivot? PivotValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor PivotDescriptor { get; set; } - private Action> PivotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action> RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action> SyncDescriptorAction { get; set; } + /// + /// + /// When the transform is created, a series of validations occur to ensure its success. For example, there is a + /// check for the existence of the source indices and a check that the destination index is not part of the source + /// index pattern. You can use this parameter to skip the checks, for example when the source index does not exist + /// until after the transform is created. The validations are always run when you start the transform, however, with + /// the exception of privilege checks. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor DeferValidation(bool? value = true) + { + Instance.DeferValidation = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public PutTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -296,28 +451,32 @@ public PutTransformRequestDescriptor Description(string? description) /// The destination for the transform. /// /// - public PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination dest) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -327,10 +486,10 @@ public PutTransformRequestDescriptor Dest(Action1s and the maximum is 1h. /// /// - public PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -338,28 +497,43 @@ public PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasti /// The latest method transforms the data by finding the latest document for each unique key. /// /// - public PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? latest) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? value) { - LatestDescriptor = null; - LatestDescriptorAction = null; - LatestValue = latest; - return Self; + Instance.Latest = value; + return this; } - public PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) + /// + /// + /// The latest method transforms the data by finding the latest document for each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Latest(System.Action action) { - LatestValue = null; - LatestDescriptorAction = null; - LatestDescriptor = descriptor; - return Self; + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Latest(Action> configure) + /// + /// + /// The latest method transforms the data by finding the latest document for each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Latest(System.Action> action) + { + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - LatestValue = null; - LatestDescriptor = null; - LatestDescriptorAction = configure; - return Self; + Instance.Meta = value; + return this; } /// @@ -367,10 +541,40 @@ public PutTransformRequestDescriptor Latest(Action /// - public PutTransformRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields + /// and the aggregation to reduce the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Pivot = value; + return this; } /// @@ -379,28 +583,34 @@ public PutTransformRequestDescriptor Meta(Func /// - public PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? pivot) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot() { - PivotDescriptor = null; - PivotDescriptorAction = null; - PivotValue = pivot; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields + /// and the aggregation to reduce the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot(System.Action? action) { - PivotValue = null; - PivotDescriptorAction = null; - PivotDescriptor = descriptor; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Pivot(Action> configure) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields + /// and the aggregation to reduce the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot(System.Action>? action) { - PivotValue = null; - PivotDescriptor = null; - PivotDescriptorAction = configure; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } /// @@ -409,28 +619,34 @@ public PutTransformRequestDescriptor Pivot(Action /// - public PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = value; + return this; } - public PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the + /// destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RetentionPolicy(System.Action action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor RetentionPolicy(Action> configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the + /// destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RetentionPolicy(System.Action> action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -438,28 +654,32 @@ public PutTransformRequestDescriptor RetentionPolicy(Action /// - public PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -467,28 +687,32 @@ public PutTransformRequestDescriptor Settings(Action /// - public PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source source) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Source(Action> configure) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } /// @@ -496,164 +720,82 @@ public PutTransformRequestDescriptor Source(Action /// - public PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = value; + return this; } - public PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Sync(System.Action action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Sync(Action> configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Sync(System.Action> action) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } - - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } - - if (LatestDescriptor is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestDescriptor, options); - } - else if (LatestDescriptorAction is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(LatestDescriptorAction), options); - } - else if (LatestValue is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (PivotDescriptor is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotDescriptor, options); - } - else if (PivotDescriptorAction is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(PivotDescriptorAction), options); - } - else if (PivotValue is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -687,65 +829,79 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// give users any privileges on .data-frame-internal* indices. /// /// -public sealed partial class PutTransformRequestDescriptor : RequestDescriptor +public readonly partial struct PutTransformRequestDescriptor { - internal PutTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest Instance { get; init; } - public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementPutTransform; + public PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { +#pragma warning disable CS0618 + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(transformId); +#pragma warning restore CS0618 + } - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public PutTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => true; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.put_transform"; + /// + /// + /// Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } - public PutTransformRequestDescriptor DeferValidation(bool? deferValidation = true) => Qs("defer_validation", deferValidation); - public PutTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - - public PutTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) - { - RouteValues.Required("transform_id", transformId); - return Self; - } - - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Latest? LatestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor LatestDescriptor { get; set; } - private Action LatestDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Pivot? PivotValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor PivotDescriptor { get; set; } - private Action PivotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action SyncDescriptorAction { get; set; } + /// + /// + /// When the transform is created, a series of validations occur to ensure its success. For example, there is a + /// check for the existence of the source indices and a check that the destination index is not part of the source + /// index pattern. You can use this parameter to skip the checks, for example when the source index does not exist + /// until after the transform is created. The validations are always run when you start the transform, however, with + /// the exception of privilege checks. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor DeferValidation(bool? value = true) + { + Instance.DeferValidation = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public PutTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -753,28 +909,32 @@ public PutTransformRequestDescriptor Description(string? description) /// The destination for the transform. /// /// - public PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination dest) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public PutTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -784,10 +944,10 @@ public PutTransformRequestDescriptor Dest(Action1s and the maximum is 1h. /// /// - public PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -795,28 +955,43 @@ public PutTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Dur /// The latest method transforms the data by finding the latest document for each unique key. /// /// - public PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? latest) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.Latest? value) { - LatestDescriptor = null; - LatestDescriptorAction = null; - LatestValue = latest; - return Self; + Instance.Latest = value; + return this; } - public PutTransformRequestDescriptor Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) + /// + /// + /// The latest method transforms the data by finding the latest document for each unique key. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Latest(System.Action> action) + { + Instance.Latest = Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) { - LatestValue = null; - LatestDescriptorAction = null; - LatestDescriptor = descriptor; - return Self; + Instance.Meta = value; + return this; } - public PutTransformRequestDescriptor Latest(Action configure) + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta() { - LatestValue = null; - LatestDescriptor = null; - LatestDescriptorAction = configure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -824,10 +999,17 @@ public PutTransformRequestDescriptor Latest(Action /// - public PutTransformRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -836,28 +1018,34 @@ public PutTransformRequestDescriptor Meta(Func, /// and the aggregation to reduce the data. /// /// - public PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? pivot) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.Pivot? value) { - PivotDescriptor = null; - PivotDescriptorAction = null; - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public PutTransformRequestDescriptor Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields + /// and the aggregation to reduce the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot() { - PivotValue = null; - PivotDescriptorAction = null; - PivotDescriptor = descriptor; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Pivot(Action configure) + /// + /// + /// The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields + /// and the aggregation to reduce the data. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pivot(System.Action>? action) { - PivotValue = null; - PivotDescriptor = null; - PivotDescriptorAction = configure; - return Self; + Instance.Pivot = Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor.Build(action); + return this; } /// @@ -866,28 +1054,22 @@ public PutTransformRequestDescriptor Pivot(Action /// - public PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = value; + return this; } - public PutTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) - { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; - } - - public PutTransformRequestDescriptor RetentionPolicy(Action configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the + /// destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RetentionPolicy(System.Action> action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -895,28 +1077,32 @@ public PutTransformRequestDescriptor RetentionPolicy(Action /// - public PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public PutTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public PutTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -924,28 +1110,32 @@ public PutTransformRequestDescriptor Settings(Action /// - public PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source source) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public PutTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Source(Action configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Sync = value; + return this; } /// @@ -953,163 +1143,59 @@ public PutTransformRequestDescriptor Source(Action /// - public PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Sync(System.Action> action) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public PutTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest Build(System.Action> action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public PutTransformRequestDescriptor Sync(Action configure) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor ErrorTrace(bool? value) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } - - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } - - if (LatestDescriptor is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestDescriptor, options); - } - else if (LatestDescriptorAction is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(LatestDescriptorAction), options); - } - else if (LatestValue is not null) - { - writer.WritePropertyName("latest"); - JsonSerializer.Serialize(writer, LatestValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PivotDescriptor is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotDescriptor, options); - } - else if (PivotDescriptorAction is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(PivotDescriptorAction), options); - } - else if (PivotValue is not null) - { - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - } + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformResponse.g.cs index 10f7f7ec4f7..a5e2c870c98 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/PutTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class PutTransformResponse : ElasticsearchResponse +internal sealed partial class PutTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponseConverter))] +public sealed partial class PutTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformRequest.g.cs index bbe3236f756..644c692d2c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class ResetTransformRequestParameters : RequestParameters +public sealed partial class ResetTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -39,73 +32,222 @@ public sealed partial class ResetTransformRequestParameters : RequestParameters /// /// public bool? Force { get => Q("force"); set => Q("force", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +internal sealed partial class ResetTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// /// /// Reset a transform. -/// Resets a transform. +/// +/// /// Before you can reset it, you must stop it; alternatively, use the force query parameter. /// If the destination index was created by the transform, it is deleted. /// /// -public sealed partial class ResetTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestConverter))] +public sealed partial class ResetTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ResetTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public ResetTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementResetTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementResetTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "transform.reset_transform"; + /// + /// + /// Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// If this value is true, the transform is reset regardless of its current state. If it's false, the transform /// must be stopped before it can be reset. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Reset a transform. -/// Resets a transform. +/// +/// /// Before you can reset it, you must stop it; alternatively, use the force query parameter. /// If the destination index was created by the transform, it is deleted. /// /// -public sealed partial class ResetTransformRequestDescriptor : RequestDescriptor +public readonly partial struct ResetTransformRequestDescriptor { - internal ResetTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest Instance { get; init; } - public ResetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementResetTransform; + public ResetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ResetTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.reset_transform"; + /// + /// + /// Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), + /// hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } + + /// + /// + /// If this value is true, the transform is reset regardless of its current state. If it's false, the transform + /// must be stopped before it can be reset. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } - public ResetTransformRequestDescriptor Force(bool? force = true) => Qs("force", force); + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ResetTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformResponse.g.cs index fa10ee989c7..e76075c7525 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ResetTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class ResetTransformResponse : ElasticsearchResponse +internal sealed partial class ResetTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponseConverter))] +public sealed partial class ResetTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResetTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResetTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformRequest.g.cs index b77da029d31..4e61885952a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class ScheduleNowTransformRequestParameters : RequestParameters +public sealed partial class ScheduleNowTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -40,78 +33,197 @@ public sealed partial class ScheduleNowTransformRequestParameters : RequestParam public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class ScheduleNowTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Schedule a transform to start now. -/// Instantly runs a transform to process data. /// /// -/// If you _schedule_now a transform, it will process the new data instantly, -/// without waiting for the configured frequency interval. After _schedule_now API is called, -/// the transform will be processed again at now + frequency unless _schedule_now API +/// Instantly run a transform to process data. +/// If you run this API, the transform will process the new data instantly, +/// without waiting for the configured frequency interval. After the API is called, +/// the transform will be processed again at now + frequency unless the API /// is called again in the meantime. /// /// -public sealed partial class ScheduleNowTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestConverter))] +public sealed partial class ScheduleNowTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public ScheduleNowTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public ScheduleNowTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScheduleNowTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementScheduleNowTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementScheduleNowTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "transform.schedule_now_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// Controls the time to wait for the scheduling to take place /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Schedule a transform to start now. -/// Instantly runs a transform to process data. /// /// -/// If you _schedule_now a transform, it will process the new data instantly, -/// without waiting for the configured frequency interval. After _schedule_now API is called, -/// the transform will be processed again at now + frequency unless _schedule_now API +/// Instantly run a transform to process data. +/// If you run this API, the transform will process the new data instantly, +/// without waiting for the configured frequency interval. After the API is called, +/// the transform will be processed again at now + frequency unless the API /// is called again in the meantime. /// /// -public sealed partial class ScheduleNowTransformRequestDescriptor : RequestDescriptor +public readonly partial struct ScheduleNowTransformRequestDescriptor { - internal ScheduleNowTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest Instance { get; init; } - public ScheduleNowTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScheduleNowTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementScheduleNowTransform; + public ScheduleNowTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public ScheduleNowTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.schedule_now_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } + + /// + /// + /// Controls the time to wait for the scheduling to take place + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public ScheduleNowTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public ScheduleNowTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformResponse.g.cs index 93f527a6b0c..fa22907703e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/ScheduleNowTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class ScheduleNowTransformResponse : ElasticsearchResponse +internal sealed partial class ScheduleNowTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponseConverter))] +public sealed partial class ScheduleNowTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScheduleNowTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScheduleNowTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformRequest.g.cs index c13718c4ae6..6828a9f40dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class StartTransformRequestParameters : RequestParameters +public sealed partial class StartTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -47,10 +40,38 @@ public sealed partial class StartTransformRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class StartTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Start a transform. -/// Starts a transform. /// /// /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is @@ -70,26 +91,48 @@ public sealed partial class StartTransformRequestParameters : RequestParameters /// destination indices, the transform fails when it attempts unauthorized operations. /// /// -public sealed partial class StartTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestConverter))] +public sealed partial class StartTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StartTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public StartTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementStartTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementStartTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "transform.start_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// Restricts the set of transformed entities to those changed after this time. Relative times like now-30d are supported. Only applicable for continuous transforms. /// /// - [JsonIgnore] public string? From { get => Q("from"); set => Q("from", value); } /// @@ -97,14 +140,12 @@ public StartTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : bas /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Start a transform. -/// Starts a transform. /// /// /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is @@ -124,32 +165,110 @@ public StartTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : bas /// destination indices, the transform fails when it attempts unauthorized operations. /// /// -public sealed partial class StartTransformRequestDescriptor : RequestDescriptor +public readonly partial struct StartTransformRequestDescriptor { - internal StartTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest Instance { get; init; } - public StartTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementStartTransform; + public StartTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StartTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.start_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } - public StartTransformRequestDescriptor From(string? from) => Qs("from", from); - public StartTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Restricts the set of transformed entities to those changed after this time. Relative times like now-30d are supported. Only applicable for continuous transforms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor From(string? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StartTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformResponse.g.cs index 04f75c1be41..a7a108b034d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StartTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class StartTransformResponse : ElasticsearchResponse +internal sealed partial class StartTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponseConverter))] +public sealed partial class StartTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StartTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformRequest.g.cs index 83c77465a31..b083d95a629 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class StopTransformRequestParameters : RequestParameters +public sealed partial class StopTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -81,26 +74,79 @@ public sealed partial class StopTransformRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class StopTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Stop transforms. /// Stops one or more transforms. /// /// -public sealed partial class StopTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestConverter))] +public sealed partial class StopTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public StopTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementStopTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementStopTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "transform.stop_transform"; + /// + /// + /// Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. + /// To stop all transforms, use _all or * as the identifier. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; @@ -115,7 +161,6 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// If it is false, the request returns a 404 status code when there are no matches or only partial matches. /// /// - [JsonIgnore] public bool? AllowNoMatch { get => Q("allow_no_match"); set => Q("allow_no_match", value); } /// @@ -123,7 +168,6 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// If it is true, the API forcefully stops the transforms. /// /// - [JsonIgnore] public bool? Force { get => Q("force"); set => Q("force", value); } /// @@ -133,7 +177,6 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// eventually moves the transform to a STOPPED state. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -142,7 +185,6 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// the transform stops as soon as possible. /// /// - [JsonIgnore] public bool? WaitForCheckpoint { get => Q("wait_for_checkpoint"); set => Q("wait_for_checkpoint", value); } /// @@ -151,7 +193,6 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// immediately and the indexer is stopped asynchronously in the background. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } @@ -161,35 +202,157 @@ public StopTransformRequest(Elastic.Clients.Elasticsearch.Name transformId) : ba /// Stops one or more transforms. /// /// -public sealed partial class StopTransformRequestDescriptor : RequestDescriptor +public readonly partial struct StopTransformRequestDescriptor { - internal StopTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest Instance { get; init; } - public StopTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Name transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementStopTransform; + public StopTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Name transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest(transformId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public StopTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "transform.stop_transform"; + /// + /// + /// Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. + /// To stop all transforms, use _all or * as the identifier. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Name value) + { + Instance.TransformId = value; + return this; + } + + /// + /// + /// Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; + /// contains the _all string or no identifiers and there are no matches; contains wildcard expressions and there + /// are only partial matches. + /// + /// + /// If it is true, the API returns a successful acknowledgement message when there are no matches. When there are + /// only partial matches, the API stops the appropriate transforms. + /// + /// + /// If it is false, the request returns a 404 status code when there are no matches or only partial matches. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor AllowNoMatch(bool? value = true) + { + Instance.AllowNoMatch = value; + return this; + } - public StopTransformRequestDescriptor AllowNoMatch(bool? allowNoMatch = true) => Qs("allow_no_match", allowNoMatch); - public StopTransformRequestDescriptor Force(bool? force = true) => Qs("force", force); - public StopTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public StopTransformRequestDescriptor WaitForCheckpoint(bool? waitForCheckpoint = true) => Qs("wait_for_checkpoint", waitForCheckpoint); - public StopTransformRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + /// + /// + /// If it is true, the API forcefully stops the transforms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor Force(bool? value = true) + { + Instance.Force = value; + return this; + } + + /// + /// + /// Period to wait for a response when wait_for_completion is true. If no response is received before the + /// timeout expires, the request returns a timeout exception. However, the request continues processing and + /// eventually moves the transform to a STOPPED state. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If it is true, the transform does not completely stop until the current checkpoint is completed. If it is false, + /// the transform stops as soon as possible. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor WaitForCheckpoint(bool? value = true) + { + Instance.WaitForCheckpoint = value; + return this; + } + + /// + /// + /// If it is true, the API blocks until the indexer state completely stops. If it is false, the API returns + /// immediately and the indexer is stopped asynchronously in the background. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public StopTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Name transformId) + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformResponse.g.cs index 05fbc4e6609..9b1aff372ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/StopTransformResponse.g.cs @@ -17,22 +17,73 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class StopTransformResponse : ElasticsearchResponse +internal sealed partial class StopTransformResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponseConverter))] +public sealed partial class StopTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For a successful response, this value is always true. On failure, an exception is returned instead. /// /// - [JsonInclude, JsonPropertyName("acknowledged")] - public bool Acknowledged { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Acknowledged { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformRequest.g.cs index bc612418057..1ba08f1e33c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class UpdateTransformRequestParameters : RequestParameters +public sealed partial class UpdateTransformRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -50,6 +43,108 @@ public sealed partial class UpdateTransformRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class UpdateTransformRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionPolicy = System.Text.Json.JsonEncodedText.Encode("retention_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropSync = System.Text.Json.JsonEncodedText.Encode("sync"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propFrequency = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propRetentionPolicy = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSource = default; + LocalJsonValue propSync = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRetentionPolicy.TryReadProperty(ref reader, options, PropRetentionPolicy, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSync.TryReadProperty(ref reader, options, PropSync, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Dest = propDest.Value, + Frequency = propFrequency.Value, + Meta = propMeta.Value, + RetentionPolicy = propRetentionPolicy.Value, + Settings = propSettings.Value, + Source = propSource.Value, + Sync = propSync.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRetentionPolicy, value.RetentionPolicy, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSync, value.Sync, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update a transform. @@ -63,20 +158,43 @@ public sealed partial class UpdateTransformRequestParameters : RequestParameters /// time of update and runs with those privileges. /// /// -public sealed partial class UpdateTransformRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestConverter))] +public sealed partial class UpdateTransformRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) { } +#if NET7_0_OR_GREATER + public UpdateTransformRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementUpdateTransform; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementUpdateTransform; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "transform.update_transform"; + /// + /// + /// Identifier for the transform. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TransformId { get => P("transform_id"); set => PR("transform_id", value); } + /// /// /// When true, deferrable validations are not run. This behavior may be @@ -84,7 +202,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// created. /// /// - [JsonIgnore] public bool? DeferValidation { get => Q("defer_validation"); set => Q("defer_validation", value); } /// @@ -93,7 +210,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// timeout expires, the request fails and returns an error. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -101,7 +217,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// Free text description of the transform. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -109,7 +224,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// The destination for the transform. /// /// - [JsonInclude, JsonPropertyName("dest")] public Elastic.Clients.Elasticsearch.TransformManagement.Destination? Dest { get; set; } /// @@ -120,7 +234,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// indexing. The minimum value is 1s and the maximum is 1h. /// /// - [JsonInclude, JsonPropertyName("frequency")] public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } /// @@ -128,8 +241,7 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// Defines optional transform metadata. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -137,7 +249,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// criteria is deleted from the destination index. /// /// - [JsonInclude, JsonPropertyName("retention_policy")] public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; set; } /// @@ -145,7 +256,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// Defines optional transform settings. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.TransformManagement.Settings? Settings { get; set; } /// @@ -153,7 +263,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// The source of the data for the transform. /// /// - [JsonInclude, JsonPropertyName("source")] public Elastic.Clients.Elasticsearch.TransformManagement.Source? Source { get; set; } /// @@ -161,7 +270,6 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// Defines the properties transforms require to run continuously. /// /// - [JsonInclude, JsonPropertyName("sync")] public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; set; } } @@ -178,59 +286,75 @@ public UpdateTransformRequest(Elastic.Clients.Elasticsearch.Id transformId) : ba /// time of update and runs with those privileges. /// /// -public sealed partial class UpdateTransformRequestDescriptor : RequestDescriptor, UpdateTransformRequestParameters> +public readonly partial struct UpdateTransformRequestDescriptor { - internal UpdateTransformRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest Instance { get; init; } - public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementUpdateTransform; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(transformId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "transform.update_transform"; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor descriptor) => descriptor.Instance; - public UpdateTransformRequestDescriptor DeferValidation(bool? deferValidation = true) => Qs("defer_validation", deferValidation); - public UpdateTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Identifier for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } - public UpdateTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + /// + /// + /// When true, deferrable validations are not run. This behavior may be + /// desired if the source index does not exist until after the transform is + /// created. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor DeferValidation(bool? value = true) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.DeferValidation = value; + return this; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action> RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action> SyncDescriptorAction { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public UpdateTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -238,28 +362,32 @@ public UpdateTransformRequestDescriptor Description(string? descripti /// The destination for the transform. /// /// - public UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? dest) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -270,10 +398,32 @@ public UpdateTransformRequestDescriptor Dest(Action /// - public UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Frequency = value; + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta() { - FrequencyValue = frequency; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -281,10 +431,29 @@ public UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Ela /// Defines optional transform metadata. /// /// - public UpdateTransformRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.RetentionPolicy = value; + return this; } /// @@ -293,28 +462,34 @@ public UpdateTransformRequestDescriptor Meta(Func /// - public UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy() { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy(System.Action? action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } - public UpdateTransformRequestDescriptor RetentionPolicy(Action> configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy(System.Action>? action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -322,28 +497,32 @@ public UpdateTransformRequestDescriptor RetentionPolicy(Action /// - public UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -351,28 +530,32 @@ public UpdateTransformRequestDescriptor Settings(Action /// - public UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? source) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public UpdateTransformRequestDescriptor Source(Action> configure) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } /// @@ -380,132 +563,82 @@ public UpdateTransformRequestDescriptor Source(Action /// - public UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = value; + return this; } - public UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Sync(System.Action action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public UpdateTransformRequestDescriptor Sync(Action> configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Sync(System.Action> action) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } @@ -522,59 +655,75 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// time of update and runs with those privileges. /// /// -public sealed partial class UpdateTransformRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateTransformRequestDescriptor { - internal UpdateTransformRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest Instance { get; init; } - public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) : base(r => r.Required("transform_id", transformId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementUpdateTransform; - - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.Id transformId) + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(transformId); + } - internal override bool SupportsBody => true; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateTransformRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override string OperationName => "transform.update_transform"; + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor descriptor) => descriptor.Instance; - public UpdateTransformRequestDescriptor DeferValidation(bool? deferValidation = true) => Qs("defer_validation", deferValidation); - public UpdateTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + /// + /// + /// Identifier for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TransformId = value; + return this; + } - public UpdateTransformRequestDescriptor TransformId(Elastic.Clients.Elasticsearch.Id transformId) + /// + /// + /// When true, deferrable validations are not run. This behavior may be + /// desired if the source index does not exist until after the transform is + /// created. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor DeferValidation(bool? value = true) { - RouteValues.Required("transform_id", transformId); - return Self; + Instance.DeferValidation = value; + return this; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Destination? DestValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor DestDescriptor { get; set; } - private Action DestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor RetentionPolicyDescriptor { get; set; } - private Action RetentionPolicyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Settings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Source? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.Sync? SyncValue { get; set; } - private Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor SyncDescriptor { get; set; } - private Action SyncDescriptorAction { get; set; } + /// + /// + /// Period to wait for a response. If no response is received before the + /// timeout expires, the request fails and returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } /// /// /// Free text description of the transform. /// /// - public UpdateTransformRequestDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -582,28 +731,32 @@ public UpdateTransformRequestDescriptor Description(string? description) /// The destination for the transform. /// /// - public UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? dest) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.Destination? value) { - DestDescriptor = null; - DestDescriptorAction = null; - DestValue = dest; - return Self; + Instance.Dest = value; + return this; } - public UpdateTransformRequestDescriptor Dest(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest() { - DestValue = null; - DestDescriptorAction = null; - DestDescriptor = descriptor; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor Dest(Action configure) + /// + /// + /// The destination for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Dest(System.Action? action) { - DestValue = null; - DestDescriptor = null; - DestDescriptorAction = configure; - return Self; + Instance.Dest = Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor.Build(action); + return this; } /// @@ -614,10 +767,32 @@ public UpdateTransformRequestDescriptor Dest(Action /// - public UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Frequency = value; + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Defines optional transform metadata. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta() { - FrequencyValue = frequency; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -625,10 +800,17 @@ public UpdateTransformRequestDescriptor Frequency(Elastic.Clients.Elasticsearch. /// Defines optional transform metadata. /// /// - public UpdateTransformRequestDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -637,28 +819,34 @@ public UpdateTransformRequestDescriptor Meta(Func /// - public UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? retentionPolicy) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? value) { - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyValue = retentionPolicy; - return Self; + Instance.RetentionPolicy = value; + return this; } - public UpdateTransformRequestDescriptor RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy() { - RetentionPolicyValue = null; - RetentionPolicyDescriptorAction = null; - RetentionPolicyDescriptor = descriptor; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor RetentionPolicy(Action configure) + /// + /// + /// Defines a retention policy for the transform. Data that meets the defined + /// criteria is deleted from the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RetentionPolicy(System.Action>? action) { - RetentionPolicyValue = null; - RetentionPolicyDescriptor = null; - RetentionPolicyDescriptorAction = configure; - return Self; + Instance.RetentionPolicy = Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor.Build(action); + return this; } /// @@ -666,28 +854,32 @@ public UpdateTransformRequestDescriptor RetentionPolicy(Action /// - public UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? settings) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.Settings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public UpdateTransformRequestDescriptor Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(null); + return this; } - public UpdateTransformRequestDescriptor Settings(Action configure) + /// + /// + /// Defines optional transform settings. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor.Build(action); + return this; } /// @@ -695,28 +887,32 @@ public UpdateTransformRequestDescriptor Settings(Action /// - public UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? source) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.Source? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - public UpdateTransformRequestDescriptor Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) + /// + /// + /// The source of the data for the transform. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor.Build(action); + return this; } - public UpdateTransformRequestDescriptor Source(Action configure) + /// + /// + /// Defines the properties transforms require to run continuously. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Sync = value; + return this; } /// @@ -724,131 +920,59 @@ public UpdateTransformRequestDescriptor Source(Action /// - public UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.Sync? sync) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Sync(System.Action> action) { - SyncDescriptor = null; - SyncDescriptorAction = null; - SyncValue = sync; - return Self; + Instance.Sync = Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor.Build(action); + return this; } - public UpdateTransformRequestDescriptor Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest Build(System.Action> action) { - SyncValue = null; - SyncDescriptorAction = null; - SyncDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public UpdateTransformRequestDescriptor Sync(Action configure) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor ErrorTrace(bool? value) { - SyncValue = null; - SyncDescriptor = null; - SyncDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestDescriptor is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestDescriptor, options); - } - else if (DestDescriptorAction is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(DestDescriptorAction), options); - } - else if (DestValue is not null) - { - writer.WritePropertyName("dest"); - JsonSerializer.Serialize(writer, DestValue, options); - } - - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.FilterPath = value; + return this; + } - if (RetentionPolicyDescriptor is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyDescriptor, options); - } - else if (RetentionPolicyDescriptorAction is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(RetentionPolicyDescriptorAction), options); - } - else if (RetentionPolicyValue is not null) - { - writer.WritePropertyName("retention_policy"); - JsonSerializer.Serialize(writer, RetentionPolicyValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SyncDescriptor is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncDescriptor, options); - } - else if (SyncDescriptorAction is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(SyncDescriptorAction), options); - } - else if (SyncValue is not null) - { - writer.WritePropertyName("sync"); - JsonSerializer.Serialize(writer, SyncValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformResponse.g.cs index 0dda6e4d96f..a40685bda65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpdateTransformResponse.g.cs @@ -17,43 +17,222 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class UpdateTransformResponse : ElasticsearchResponse +internal sealed partial class UpdateTransformResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropLatest = System.Text.Json.JsonEncodedText.Encode("latest"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionPolicy = System.Text.Json.JsonEncodedText.Encode("retention_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropSync = System.Text.Json.JsonEncodedText.Encode("sync"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAuthorization = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propFrequency = default; + LocalJsonValue propId = default; + LocalJsonValue propLatest = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPivot = default; + LocalJsonValue propRetentionPolicy = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSource = default; + LocalJsonValue propSync = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propLatest.TryReadProperty(ref reader, options, PropLatest, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propRetentionPolicy.TryReadProperty(ref reader, options, PropRetentionPolicy, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSync.TryReadProperty(ref reader, options, PropSync, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Authorization = propAuthorization.Value, + CreateTime = propCreateTime.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Frequency = propFrequency.Value, + Id = propId.Value, + Latest = propLatest.Value, + Meta = propMeta.Value, + Pivot = propPivot.Value, + RetentionPolicy = propRetentionPolicy.Value, + Settings = propSettings.Value, + Source = propSource.Value, + Sync = propSync.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropLatest, value.Latest, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropRetentionPolicy, value.RetentionPolicy, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSync, value.Sync, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponseConverter))] +public sealed partial class UpdateTransformResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public long CreateTime { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; init; } - [JsonInclude, JsonPropertyName("frequency")] - public Elastic.Clients.Elasticsearch.Duration? Frequency { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("latest")] - public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; init; } - [JsonInclude, JsonPropertyName("_meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("pivot")] - public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; init; } - [JsonInclude, JsonPropertyName("retention_policy")] - public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; init; } - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.TransformManagement.Settings Settings { get; init; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.Core.Reindex.Source Source { get; init; } - [JsonInclude, JsonPropertyName("sync")] - public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateTransformResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateTransformResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization? Authorization { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.Settings Settings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Reindex.Source Source { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsRequest.g.cs index 50bfb0a2008..554102ffd62 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class UpgradeTransformsRequestParameters : RequestParameters +public sealed partial class UpgradeTransformsRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -48,9 +41,40 @@ public sealed partial class UpgradeTransformsRequestParameters : RequestParamete public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } +internal sealed partial class UpgradeTransformsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Upgrade all transforms. +/// +/// /// Transforms are compatible across minor versions and between supported major versions. /// However, over time, the format of transform configuration information may change. /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. @@ -68,11 +92,28 @@ public sealed partial class UpgradeTransformsRequestParameters : RequestParamete /// You may want to perform a recent cluster backup prior to the upgrade. /// /// -public sealed partial class UpgradeTransformsRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestConverter))] +public sealed partial class UpgradeTransformsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementUpgradeTransforms; +#if NET7_0_OR_GREATER + public UpgradeTransformsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public UpgradeTransformsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.TransformManagementUpgradeTransforms; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; @@ -83,7 +124,6 @@ public sealed partial class UpgradeTransformsRequest : PlainRequest /// - [JsonIgnore] public bool? DryRun { get => Q("dry_run"); set => Q("dry_run", value); } /// @@ -92,13 +132,14 @@ public sealed partial class UpgradeTransformsRequest : PlainRequest /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } } /// /// /// Upgrade all transforms. +/// +/// /// Transforms are compatible across minor versions and between supported major versions. /// However, over time, the format of transform configuration information may change. /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. @@ -116,26 +157,99 @@ public sealed partial class UpgradeTransformsRequest : PlainRequest /// -public sealed partial class UpgradeTransformsRequestDescriptor : RequestDescriptor +public readonly partial struct UpgradeTransformsRequestDescriptor { - internal UpgradeTransformsRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpgradeTransformsRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest instance) + { + Instance = instance; + } public UpgradeTransformsRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// When true, the request checks for updates but does not run them. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor DryRun(bool? value = true) + { + Instance.DryRun = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.TransformManagementUpgradeTransforms; + /// + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and + /// returns an error. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override bool SupportsBody => false; + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - internal override string OperationName => "transform.upgrade_transforms"; + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - public UpgradeTransformsRequestDescriptor DryRun(bool? dryRun = true) => Qs("dry_run", dryRun); - public UpgradeTransformsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsResponse.g.cs index d2e39135530..4966611dfac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/TransformManagement/UpgradeTransformsResponse.g.cs @@ -17,38 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public sealed partial class UpgradeTransformsResponse : ElasticsearchResponse +internal sealed partial class UpgradeTransformsResponseConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropNeedsUpdate = System.Text.Json.JsonEncodedText.Encode("needs_update"); + private static readonly System.Text.Json.JsonEncodedText PropNoAction = System.Text.Json.JsonEncodedText.Encode("no_action"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNeedsUpdate = default; + LocalJsonValue propNoAction = default; + LocalJsonValue propUpdated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNeedsUpdate.TryReadProperty(ref reader, options, PropNeedsUpdate, null)) + { + continue; + } + + if (propNoAction.TryReadProperty(ref reader, options, PropNoAction, null)) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NeedsUpdate = propNeedsUpdate.Value, + NoAction = propNoAction.Value, + Updated = propUpdated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNeedsUpdate, value.NeedsUpdate, null, null); + writer.WriteProperty(options, PropNoAction, value.NoAction, null, null); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponseConverter))] +public sealed partial class UpgradeTransformsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpgradeTransformsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpgradeTransformsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of transforms that need to be upgraded. /// /// - [JsonInclude, JsonPropertyName("needs_update")] - public int NeedsUpdate { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NeedsUpdate { get; set; } /// /// /// The number of transforms that don’t require upgrading. /// /// - [JsonInclude, JsonPropertyName("no_action")] - public int NoAction { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NoAction { get; set; } /// /// /// The number of transforms that have been upgraded. /// /// - [JsonInclude, JsonPropertyName("updated")] - public int Updated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Updated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRequest.g.cs index 62ddddb5ae9..c4d57cf50b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateByQueryRequestParameters : RequestParameters +public sealed partial class UpdateByQueryRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -81,11 +74,11 @@ public sealed partial class UpdateByQueryRequestParameters : RequestParameters /// Valid values are: all, open, closed, hidden, none. /// /// - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// Starting offset (default: 0) + /// Skips the specified number of documents. /// /// public long? From { get => Q("from"); set => Q("from", value); } @@ -200,14 +193,14 @@ public sealed partial class UpdateByQueryRequestParameters : RequestParameters /// A comma-separated list of <field>:<direction> pairs. /// /// - public ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } + public System.Collections.Generic.ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } /// /// /// The specific tag of the request for logging and statistical purposes. /// /// - public ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } + public System.Collections.Generic.ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } /// /// @@ -268,6 +261,81 @@ public sealed partial class UpdateByQueryRequestParameters : RequestParameters public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } } +internal sealed partial class UpdateByQueryRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConflicts = System.Text.Json.JsonEncodedText.Encode("conflicts"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + + public override Elastic.Clients.Elasticsearch.UpdateByQueryRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConflicts = default; + LocalJsonValue propMaxDocs = default; + LocalJsonValue propQuery = default; + LocalJsonValue propScript = default; + LocalJsonValue propSlice = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConflicts.TryReadProperty(ref reader, options, PropConflicts, null)) + { + continue; + } + + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Conflicts = propConflicts.Value, + MaxDocs = propMaxDocs.Value, + Query = propQuery.Value, + Script = propScript.Value, + Slice = propSlice.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateByQueryRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConflicts, value.Conflicts, null, null); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Update documents. @@ -426,20 +494,45 @@ public sealed partial class UpdateByQueryRequestParameters : RequestParameters /// This API enables you to only modify the source of matching documents; you cannot move them. /// /// -public sealed partial class UpdateByQueryRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateByQueryRequestConverter))] +public sealed partial class UpdateByQueryRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) { } +#if NET7_0_OR_GREATER + public UpdateByQueryRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdateByQuery; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceUpdateByQuery; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "update_by_query"; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get => P("index"); set => PR("index", value); } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. @@ -447,7 +540,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonIgnore] public bool? AllowNoIndices { get => Q("allow_no_indices"); set => Q("allow_no_indices", value); } /// @@ -456,7 +548,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Analyzer { get => Q("analyzer"); set => Q("analyzer", value); } /// @@ -465,7 +556,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? AnalyzeWildcard { get => Q("analyze_wildcard"); set => Q("analyze_wildcard", value); } /// @@ -474,7 +564,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get => Q("default_operator"); set => Q("default_operator", value); } /// @@ -483,7 +572,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public string? Df { get => Q("df"); set => Q("df", value); } /// @@ -494,15 +582,13 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Valid values are: all, open, closed, hidden, none. /// /// - [JsonIgnore] - public ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } + public System.Collections.Generic.ICollection? ExpandWildcards { get => Q?>("expand_wildcards"); set => Q("expand_wildcards", value); } /// /// - /// Starting offset (default: 0) + /// Skips the specified number of documents. /// /// - [JsonIgnore] public long? From { get => Q("from"); set => Q("from", value); } /// @@ -510,7 +596,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If false, the request returns an error if it targets a missing or closed index. /// /// - [JsonIgnore] public bool? IgnoreUnavailable { get => Q("ignore_unavailable"); set => Q("ignore_unavailable", value); } /// @@ -519,7 +604,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This parameter can be used only when the q query string parameter is specified. /// /// - [JsonIgnore] public bool? Lenient { get => Q("lenient"); set => Q("lenient", value); } /// @@ -529,7 +613,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If a final pipeline is configured it will always run, regardless of the value of this parameter. /// /// - [JsonIgnore] public string? Pipeline { get => Q("pipeline"); set => Q("pipeline", value); } /// @@ -538,7 +621,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// It is random by default. /// /// - [JsonIgnore] public string? Preference { get => Q("preference"); set => Q("preference", value); } /// @@ -546,7 +628,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A query in the Lucene query string syntax. /// /// - [JsonIgnore] public string? QueryLuceneSyntax { get => Q("q"); set => Q("q", value); } /// @@ -555,7 +636,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This is different than the update API's refresh parameter, which causes just the shard that received the request to be refreshed. /// /// - [JsonIgnore] public bool? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -564,7 +644,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// It defaults to the index-level setting. /// /// - [JsonIgnore] public bool? RequestCache { get => Q("request_cache"); set => Q("request_cache", value); } /// @@ -572,7 +651,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The throttle for this request in sub-requests per second. /// /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } /// @@ -580,7 +658,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -588,7 +665,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The period to retain the search context for scrolling. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Scroll { get => Q("scroll"); set => Q("scroll", value); } /// @@ -596,7 +672,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The size of the scroll request that powers the operation. /// /// - [JsonIgnore] public long? ScrollSize { get => Q("scroll_size"); set => Q("scroll_size", value); } /// @@ -605,7 +680,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// By default, there is no timeout. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? SearchTimeout { get => Q("search_timeout"); set => Q("search_timeout", value); } /// @@ -613,7 +687,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The type of the search operation. Available options include query_then_fetch and dfs_query_then_fetch. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get => Q("search_type"); set => Q("search_type", value); } /// @@ -621,7 +694,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The number of slices this task should be divided into. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Slices? Slices { get => Q("slices"); set => Q("slices", value); } /// @@ -629,16 +701,14 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// A comma-separated list of <field>:<direction> pairs. /// /// - [JsonIgnore] - public ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } + public System.Collections.Generic.ICollection? Sort { get => Q?>("sort"); set => Q("sort", value); } /// /// /// The specific tag of the request for logging and statistical purposes. /// /// - [JsonIgnore] - public ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } + public System.Collections.Generic.ICollection? Stats { get => Q?>("stats"); set => Q("stats", value); } /// /// @@ -653,7 +723,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. /// /// - [JsonIgnore] public long? TerminateAfter { get => Q("terminate_after"); set => Q("terminate_after", value); } /// @@ -664,7 +733,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -672,7 +740,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// If true, returns the document version as part of a hit. /// /// - [JsonIgnore] public bool? Version { get => Q("version"); set => Q("version", value); } /// @@ -680,7 +747,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Should the document increment the version number (internal) on hit or not (reindex) /// /// - [JsonIgnore] public bool? VersionType { get => Q("version_type"); set => Q("version_type", value); } /// @@ -691,7 +757,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Both work exactly the way they work in the bulk API. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -701,7 +766,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. /// /// - [JsonIgnore] public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } /// @@ -709,7 +773,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The preferred behavior when update by query hits version conflicts: abort or proceed. /// /// - [JsonInclude, JsonPropertyName("conflicts")] public Elastic.Clients.Elasticsearch.Conflicts? Conflicts { get; set; } /// @@ -717,7 +780,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The maximum number of documents to update. /// /// - [JsonInclude, JsonPropertyName("max_docs")] public long? MaxDocs { get; set; } /// @@ -725,7 +787,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The documents to update using the Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -733,7 +794,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// The script to run to update the document source or metadata when updating. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -741,7 +801,6 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// Slice the request manually using the provided slice ID and total number of slices. /// /// - [JsonInclude, JsonPropertyName("slice")] public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } } @@ -903,334 +962,697 @@ public UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Indices indices) : bas /// This API enables you to only modify the source of matching documents; you cannot move them. /// /// -public sealed partial class UpdateByQueryRequestDescriptor : RequestDescriptor, UpdateByQueryRequestParameters> +public readonly partial struct UpdateByQueryRequestDescriptor { - internal UpdateByQueryRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.UpdateByQueryRequest Instance { get; init; } - public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRequest instance) { + Instance = instance; } - public UpdateByQueryRequestDescriptor() : this(typeof(TDocument)) + public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) { + Instance = new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(indices); } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdateByQuery; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateByQueryRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + public static explicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRequest instance) => new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRequest(Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor descriptor) => descriptor.Instance; - internal override bool SupportsBody => true; + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } - internal override string OperationName => "update_by_query"; + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } - public UpdateByQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public UpdateByQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public UpdateByQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public UpdateByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public UpdateByQueryRequestDescriptor Df(string? df) => Qs("df", df); - public UpdateByQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public UpdateByQueryRequestDescriptor From(long? from) => Qs("from", from); - public UpdateByQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public UpdateByQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public UpdateByQueryRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public UpdateByQueryRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public UpdateByQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public UpdateByQueryRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public UpdateByQueryRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public UpdateByQueryRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public UpdateByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public UpdateByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public UpdateByQueryRequestDescriptor ScrollSize(long? scrollSize) => Qs("scroll_size", scrollSize); - public UpdateByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? searchTimeout) => Qs("search_timeout", searchTimeout); - public UpdateByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public UpdateByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public UpdateByQueryRequestDescriptor Sort(ICollection? sort) => Qs("sort", sort); - public UpdateByQueryRequestDescriptor Stats(ICollection? stats) => Qs("stats", stats); - public UpdateByQueryRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); - public UpdateByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public UpdateByQueryRequestDescriptor Version(bool? version = true) => Qs("version", version); - public UpdateByQueryRequestDescriptor VersionType(bool? versionType = true) => Qs("version_type", versionType); - public UpdateByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public UpdateByQueryRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - public UpdateByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) - { - RouteValues.Required("index", indices); - return Self; - } - - private Elastic.Clients.Elasticsearch.Conflicts? ConflictsValue { get; set; } - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action> SliceDescriptorAction { get; set; } + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } /// /// - /// The preferred behavior when update by query hits version conflicts: abort or proceed. + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public UpdateByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor AnalyzeWildcard(bool? value = true) { - ConflictsValue = conflicts; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// /// - /// The maximum number of documents to update. + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public UpdateByQueryRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.DefaultOperator = value; + return this; } /// /// - /// The documents to update using the Query DSL. + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. /// /// - public UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Df(string? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Df = value; + return this; } - public UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.ExpandWildcards = value; + return this; } - public UpdateByQueryRequestDescriptor Query(Action> configure) + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } /// /// - /// The script to run to update the document source or metadata when updating. + /// Skips the specified number of documents. /// /// - public UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor From(long? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.From = value; + return this; } - public UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor IgnoreUnavailable(bool? value = true) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public UpdateByQueryRequestDescriptor Script(Action configure) + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Lenient(bool? value = true) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Lenient = value; + return this; } /// /// - /// Slice the request manually using the provided slice ID and total number of slices. + /// The ID of the pipeline to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, then setting the value to _none disables the default ingest pipeline for this request. + /// If a final pipeline is configured it will always run, regardless of the value of this parameter. /// /// - public UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Pipeline(string? value) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Pipeline = value; + return this; } - public UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Preference(string? value) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Preference = value; + return this; } - public UpdateByQueryRequestDescriptor Slice(Action> configure) + /// + /// + /// A query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor QueryLuceneSyntax(string? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.QueryLuceneSyntax = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If true, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes. + /// This is different than the update API's refresh parameter, which causes just the shard that received the request to be refreshed. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Refresh(bool? value = true) { - writer.WriteStartObject(); - if (ConflictsValue is not null) - { - writer.WritePropertyName("conflicts"); - JsonSerializer.Serialize(writer, ConflictsValue, options); - } + Instance.Refresh = value; + return this; + } - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } + /// + /// + /// If true, the request cache is used for this request. + /// It defaults to the index-level setting. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// The throttle for this request in sub-requests per second. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + /// + /// + /// The period to retain the search context for scrolling. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// The size of the scroll request that powers the operation. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ScrollSize(long? value) + { + Instance.ScrollSize = value; + return this; } -} -/// -/// -/// Update documents. -/// Updates documents that match the specified query. -/// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. -/// -/// -/// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: -/// -/// -/// -/// -/// read -/// -/// -/// -/// -/// index or write -/// -/// -/// -/// -/// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. -/// -/// -/// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. -/// When the versions match, the document is updated and the version number is incremented. -/// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. -/// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. -/// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. -/// -/// -/// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. -/// -/// -/// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. -/// A bulk update request is performed for each batch of matching documents. -/// Any query or update failures cause the update by query request to fail and the failures are shown in the response. -/// Any update requests that completed successfully still stick, they are not rolled back. -/// -/// -/// Throttling update requests -/// -/// -/// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. -/// This pads each batch with a wait time to throttle the rate. -/// Set requests_per_second to -1 to turn off throttling. -/// -/// -/// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. -/// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. -/// By default the batch size is 1000, so if requests_per_second is set to 500: -/// -/// -/// target_time = 1000 / 500 per second = 2 seconds -/// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds -/// -/// -/// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. -/// This is "bursty" instead of "smooth". -/// -/// -/// Slicing -/// -/// -/// Update by query supports sliced scroll to parallelize the update process. -/// This can improve efficiency and provide a convenient way to break the request down into smaller parts. -/// -/// -/// Setting slices to auto chooses a reasonable number for most data streams and indices. -/// This setting will use one slice per shard, up to a certain limit. -/// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. -/// -/// -/// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: -/// -/// -/// -/// -/// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. -/// -/// -/// -/// + /// + /// + /// An explicit timeout for each search request. + /// By default, there is no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.SearchTimeout = value; + return this; + } + + /// + /// + /// The type of the search operation. Available options include query_then_fetch and dfs_query_then_fetch. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) + { + Instance.Slices = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slices(System.Func action) + { + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Sort(params string[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. + /// By default, it is one minute. + /// This guarantees Elasticsearch waits for at least the timeout before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + /// + /// + /// Should the document increment the version number (internal) on hit or not (reindex) + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor VersionType(bool? value = true) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The timeout parameter controls how long each write request waits for unavailable shards to become available. + /// Both work exactly the way they work in the bulk API. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } + + /// + /// + /// If true, the request blocks until the operation is complete. + /// If false, Elasticsearch performs some preflight checks, launches the request, and returns a task ID that you can use to cancel or get the status of the task. + /// Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } + + /// + /// + /// The preferred behavior when update by query hits version conflicts: abort or proceed. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) + { + Instance.Conflicts = value; + return this; + } + + /// + /// + /// The maximum number of documents to update. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor MaxDocs(long? value) + { + Instance.MaxDocs = value; + return this; + } + + /// + /// + /// The documents to update using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// The documents to update using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The documents to update using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The script to run to update the document source or metadata when updating. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// The script to run to update the document source or metadata when updating. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// The script to run to update the document source or metadata when updating. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) + { + Instance.Slice = value; + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slice(System.Action action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slice(System.Action> action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.UpdateByQueryRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} + +/// +/// +/// Update documents. +/// Updates documents that match the specified query. +/// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. +/// +/// +/// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: +/// +/// +/// +/// +/// read +/// +/// +/// +/// +/// index or write +/// +/// +/// +/// +/// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. +/// +/// +/// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. +/// When the versions match, the document is updated and the version number is incremented. +/// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. +/// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. +/// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. +/// +/// +/// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. +/// +/// +/// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. +/// A bulk update request is performed for each batch of matching documents. +/// Any query or update failures cause the update by query request to fail and the failures are shown in the response. +/// Any update requests that completed successfully still stick, they are not rolled back. +/// +/// +/// Throttling update requests +/// +/// +/// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. +/// This pads each batch with a wait time to throttle the rate. +/// Set requests_per_second to -1 to turn off throttling. +/// +/// +/// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. +/// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. +/// By default the batch size is 1000, so if requests_per_second is set to 500: +/// +/// +/// target_time = 1000 / 500 per second = 2 seconds +/// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds +/// +/// +/// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. +/// This is "bursty" instead of "smooth". +/// +/// +/// Slicing +/// +/// +/// Update by query supports sliced scroll to parallelize the update process. +/// This can improve efficiency and provide a convenient way to break the request down into smaller parts. +/// +/// +/// Setting slices to auto chooses a reasonable number for most data streams and indices. +/// This setting will use one slice per shard, up to a certain limit. +/// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. +/// +/// +/// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: +/// +/// +/// +/// +/// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. +/// +/// +/// +/// /// Fetching the status of the task for the request with slices only contains the status of completed slices. /// /// @@ -1305,79 +1727,449 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// This API enables you to only modify the source of matching documents; you cannot move them. /// /// -public sealed partial class UpdateByQueryRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateByQueryRequestDescriptor { - internal UpdateByQueryRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.UpdateByQueryRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRequest instance) + { + Instance = instance; + } + + public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) + { + Instance = new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(indices); + } + + public UpdateByQueryRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(typeof(TDocument)); + } + + public static explicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRequest instance) => new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRequest(Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A comma-separated list of data streams, indices, and aliases to search. + /// It supports wildcards (*). + /// To search all data streams or indices, omit this parameter or use * or _all. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. + /// This behavior applies even if the request targets other open indices. + /// For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// The analyzer to use for the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// If true, wildcard and prefix queries are analyzed. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor AnalyzeWildcard(bool? value = true) + { + Instance.AnalyzeWildcard = value; + return this; + } + + /// + /// + /// The default operator for query string query: AND or OR. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// The field to use as default where no field prefix is given in the query string. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Df(string? value) + { + Instance.Df = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) + { + Instance.ExpandWildcards = value; + return this; + } + + /// + /// + /// The type of index that wildcard patterns can match. + /// If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + /// It supports comma-separated values, such as open,hidden. + /// Valid values are: all, open, closed, hidden, none. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) + { + Instance.ExpandWildcards = [.. values]; + return this; + } + + /// + /// + /// Skips the specified number of documents. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor From(long? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// If false, the request returns an error if it targets a missing or closed index. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor IgnoreUnavailable(bool? value = true) + { + Instance.IgnoreUnavailable = value; + return this; + } + + /// + /// + /// If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + /// This parameter can be used only when the q query string parameter is specified. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Lenient(bool? value = true) + { + Instance.Lenient = value; + return this; + } - public UpdateByQueryRequestDescriptor(Elastic.Clients.Elasticsearch.Indices indices) : base(r => r.Required("index", indices)) + /// + /// + /// The ID of the pipeline to use to preprocess incoming documents. + /// If the index has a default ingest pipeline specified, then setting the value to _none disables the default ingest pipeline for this request. + /// If a final pipeline is configured it will always run, regardless of the value of this parameter. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Pipeline(string? value) { + Instance.Pipeline = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdateByQuery; + /// + /// + /// The node or shard the operation should be performed on. + /// It is random by default. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Preference(string? value) + { + Instance.Preference = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// A query in the Lucene query string syntax. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor QueryLuceneSyntax(string? value) + { + Instance.QueryLuceneSyntax = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// If true, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes. + /// This is different than the update API's refresh parameter, which causes just the shard that received the request to be refreshed. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Refresh(bool? value = true) + { + Instance.Refresh = value; + return this; + } - internal override string OperationName => "update_by_query"; + /// + /// + /// If true, the request cache is used for this request. + /// It defaults to the index-level setting. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestCache(bool? value = true) + { + Instance.RequestCache = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The period to retain the search context for scrolling. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scroll = value; + return this; + } + + /// + /// + /// The size of the scroll request that powers the operation. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ScrollSize(long? value) + { + Instance.ScrollSize = value; + return this; + } + + /// + /// + /// An explicit timeout for each search request. + /// By default, there is no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.SearchTimeout = value; + return this; + } + + /// + /// + /// The type of the search operation. Available options include query_then_fetch and dfs_query_then_fetch. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? value) + { + Instance.Slices = value; + return this; + } + + /// + /// + /// The number of slices this task should be divided into. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slices(System.Func action) + { + Instance.Slices = Elastic.Clients.Elasticsearch.SlicesFactory.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Sort(params string[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The specific tag of the request for logging and statistical purposes. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this parameter to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. + /// By default, it is one minute. + /// This guarantees Elasticsearch waits for at least the timeout before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + /// + /// + /// Should the document increment the version number (internal) on hit or not (reindex) + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor VersionType(bool? value = true) + { + Instance.VersionType = value; + return this; + } + + /// + /// + /// The number of shard copies that must be active before proceeding with the operation. + /// Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The timeout parameter controls how long each write request waits for unavailable shards to become available. + /// Both work exactly the way they work in the bulk API. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } - public UpdateByQueryRequestDescriptor AllowNoIndices(bool? allowNoIndices = true) => Qs("allow_no_indices", allowNoIndices); - public UpdateByQueryRequestDescriptor Analyzer(string? analyzer) => Qs("analyzer", analyzer); - public UpdateByQueryRequestDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Qs("analyze_wildcard", analyzeWildcard); - public UpdateByQueryRequestDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) => Qs("default_operator", defaultOperator); - public UpdateByQueryRequestDescriptor Df(string? df) => Qs("df", df); - public UpdateByQueryRequestDescriptor ExpandWildcards(ICollection? expandWildcards) => Qs("expand_wildcards", expandWildcards); - public UpdateByQueryRequestDescriptor From(long? from) => Qs("from", from); - public UpdateByQueryRequestDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Qs("ignore_unavailable", ignoreUnavailable); - public UpdateByQueryRequestDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); - public UpdateByQueryRequestDescriptor Pipeline(string? pipeline) => Qs("pipeline", pipeline); - public UpdateByQueryRequestDescriptor Preference(string? preference) => Qs("preference", preference); - public UpdateByQueryRequestDescriptor QueryLuceneSyntax(string? queryLuceneSyntax) => Qs("q", queryLuceneSyntax); - public UpdateByQueryRequestDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh); - public UpdateByQueryRequestDescriptor RequestCache(bool? requestCache = true) => Qs("request_cache", requestCache); - public UpdateByQueryRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); - public UpdateByQueryRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public UpdateByQueryRequestDescriptor Scroll(Elastic.Clients.Elasticsearch.Duration? scroll) => Qs("scroll", scroll); - public UpdateByQueryRequestDescriptor ScrollSize(long? scrollSize) => Qs("scroll_size", scrollSize); - public UpdateByQueryRequestDescriptor SearchTimeout(Elastic.Clients.Elasticsearch.Duration? searchTimeout) => Qs("search_timeout", searchTimeout); - public UpdateByQueryRequestDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) => Qs("search_type", searchType); - public UpdateByQueryRequestDescriptor Slices(Elastic.Clients.Elasticsearch.Slices? slices) => Qs("slices", slices); - public UpdateByQueryRequestDescriptor Sort(ICollection? sort) => Qs("sort", sort); - public UpdateByQueryRequestDescriptor Stats(ICollection? stats) => Qs("stats", stats); - public UpdateByQueryRequestDescriptor TerminateAfter(long? terminateAfter) => Qs("terminate_after", terminateAfter); - public UpdateByQueryRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public UpdateByQueryRequestDescriptor Version(bool? version = true) => Qs("version", version); - public UpdateByQueryRequestDescriptor VersionType(bool? versionType = true) => Qs("version_type", versionType); - public UpdateByQueryRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); - public UpdateByQueryRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); - - public UpdateByQueryRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) - { - RouteValues.Required("index", indices); - return Self; - } - - private Elastic.Clients.Elasticsearch.Conflicts? ConflictsValue { get; set; } - private long? MaxDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action SliceDescriptorAction { get; set; } + /// + /// + /// If true, the request blocks until the operation is complete. + /// If false, Elasticsearch performs some preflight checks, launches the request, and returns a task ID that you can use to cancel or get the status of the task. + /// Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor WaitForCompletion(bool? value = true) + { + Instance.WaitForCompletion = value; + return this; + } /// /// /// The preferred behavior when update by query hits version conflicts: abort or proceed. /// /// - public UpdateByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? conflicts) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Conflicts? value) { - ConflictsValue = conflicts; - return Self; + Instance.Conflicts = value; + return this; } /// @@ -1385,10 +2177,10 @@ public UpdateByQueryRequestDescriptor Conflicts(Elastic.Clients.Elasticsearch.Co /// The maximum number of documents to update. /// /// - public UpdateByQueryRequestDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor MaxDocs(long? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxDocs = value; + return this; } /// @@ -1396,28 +2188,32 @@ public UpdateByQueryRequestDescriptor MaxDocs(long? maxDocs) /// The documents to update using the Query DSL. /// /// - public UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public UpdateByQueryRequestDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The documents to update using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public UpdateByQueryRequestDescriptor Query(Action configure) + /// + /// + /// The script to run to update the document source or metadata when updating. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } /// @@ -1425,28 +2221,32 @@ public UpdateByQueryRequestDescriptor Query(Action /// - public UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public UpdateByQueryRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run to update the document source or metadata when updating. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public UpdateByQueryRequestDescriptor Script(Action configure) + /// + /// + /// Slice the request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Slice = value; + return this; } /// @@ -1454,93 +2254,59 @@ public UpdateByQueryRequestDescriptor Script(Action /// - public UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Slice(System.Action> action) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public UpdateByQueryRequestDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.UpdateByQueryRequest Build(System.Action> action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(new Elastic.Clients.Elasticsearch.UpdateByQueryRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - public UpdateByQueryRequestDescriptor Slice(Action configure) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor ErrorTrace(bool? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.ErrorTrace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor FilterPath(params string[]? value) { - writer.WriteStartObject(); - if (ConflictsValue is not null) - { - writer.WritePropertyName("conflicts"); - JsonSerializer.Serialize(writer, ConflictsValue, options); - } + Instance.FilterPath = value; + return this; + } - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryResponse.g.cs index 6fe3e3fca59..495969e4c2b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryResponse.g.cs @@ -17,32 +17,213 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateByQueryResponse : ElasticsearchResponse +internal sealed partial class UpdateByQueryResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBatches = System.Text.Json.JsonEncodedText.Encode("batches"); + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropNoops = System.Text.Json.JsonEncodedText.Encode("noops"); + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerSecond = System.Text.Json.JsonEncodedText.Encode("requests_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropRetries = System.Text.Json.JsonEncodedText.Encode("retries"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + private static readonly System.Text.Json.JsonEncodedText PropThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledMillis = System.Text.Json.JsonEncodedText.Encode("throttled_millis"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntil = System.Text.Json.JsonEncodedText.Encode("throttled_until"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntilMillis = System.Text.Json.JsonEncodedText.Encode("throttled_until_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + private static readonly System.Text.Json.JsonEncodedText PropVersionConflicts = System.Text.Json.JsonEncodedText.Encode("version_conflicts"); + + public override Elastic.Clients.Elasticsearch.UpdateByQueryResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBatches = default; + LocalJsonValue propDeleted = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue propNoops = default; + LocalJsonValue propRequestsPerSecond = default; + LocalJsonValue propRetries = default; + LocalJsonValue propTask = default; + LocalJsonValue propThrottled = default; + LocalJsonValue propThrottledMillis = default; + LocalJsonValue propThrottledUntil = default; + LocalJsonValue propThrottledUntilMillis = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + LocalJsonValue propTotal = default; + LocalJsonValue propUpdated = default; + LocalJsonValue propVersionConflicts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBatches.TryReadProperty(ref reader, options, PropBatches, null)) + { + continue; + } + + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNoops.TryReadProperty(ref reader, options, PropNoops, null)) + { + continue; + } + + if (propRequestsPerSecond.TryReadProperty(ref reader, options, PropRequestsPerSecond, null)) + { + continue; + } + + if (propRetries.TryReadProperty(ref reader, options, PropRetries, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (propThrottled.TryReadProperty(ref reader, options, PropThrottled, null)) + { + continue; + } + + if (propThrottledMillis.TryReadProperty(ref reader, options, PropThrottledMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propThrottledUntil.TryReadProperty(ref reader, options, PropThrottledUntil, null)) + { + continue; + } + + if (propThrottledUntilMillis.TryReadProperty(ref reader, options, PropThrottledUntilMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (propVersionConflicts.TryReadProperty(ref reader, options, PropVersionConflicts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateByQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Batches = propBatches.Value, + Deleted = propDeleted.Value, + Failures = propFailures.Value, + Noops = propNoops.Value, + RequestsPerSecond = propRequestsPerSecond.Value, + Retries = propRetries.Value, + Task = propTask.Value, + Throttled = propThrottled.Value, + ThrottledMillis = propThrottledMillis.Value, + ThrottledUntil = propThrottledUntil.Value, + ThrottledUntilMillis = propThrottledUntilMillis.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value, + Total = propTotal.Value, + Updated = propUpdated.Value, + VersionConflicts = propVersionConflicts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateByQueryResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBatches, value.Batches, null, null); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNoops, value.Noops, null, null); + writer.WriteProperty(options, PropRequestsPerSecond, value.RequestsPerSecond, null, null); + writer.WriteProperty(options, PropRetries, value.Retries, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteProperty(options, PropThrottled, value.Throttled, null, null); + writer.WriteProperty(options, PropThrottledMillis, value.ThrottledMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropThrottledUntil, value.ThrottledUntil, null, null); + writer.WriteProperty(options, PropThrottledUntilMillis, value.ThrottledUntilMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteProperty(options, PropVersionConflicts, value.VersionConflicts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateByQueryResponseConverter))] +public sealed partial class UpdateByQueryResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateByQueryResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of scroll responses pulled back by the update by query. /// /// - [JsonInclude, JsonPropertyName("batches")] - public long? Batches { get; init; } + public long? Batches { get; set; } /// /// /// The number of documents that were successfully deleted. /// /// - [JsonInclude, JsonPropertyName("deleted")] - public long? Deleted { get; init; } + public long? Deleted { get; set; } /// /// @@ -53,24 +234,21 @@ public sealed partial class UpdateByQueryResponse : ElasticsearchResponse /// You can use the conflicts option to prevent reindex from ending when version conflicts occur. /// /// - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } /// /// /// The number of documents that were ignored because the script used for the update by query returned a noop value for ctx.op. /// /// - [JsonInclude, JsonPropertyName("noops")] - public long? Noops { get; init; } + public long? Noops { get; set; } /// /// /// The number of requests per second effectively run during the update by query. /// /// - [JsonInclude, JsonPropertyName("requests_per_second")] - public float? RequestsPerSecond { get; init; } + public float? RequestsPerSecond { get; set; } /// /// @@ -79,22 +257,17 @@ public sealed partial class UpdateByQueryResponse : ElasticsearchResponse /// search is the number of search actions retried. /// /// - [JsonInclude, JsonPropertyName("retries")] - public Elastic.Clients.Elasticsearch.Retries? Retries { get; init; } - [JsonInclude, JsonPropertyName("task")] - public Elastic.Clients.Elasticsearch.TaskId? Task { get; init; } - [JsonInclude, JsonPropertyName("throttled")] - public Elastic.Clients.Elasticsearch.Duration? Throttled { get; init; } + public Elastic.Clients.Elasticsearch.Retries? Retries { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? Task { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Throttled { get; set; } /// /// /// The number of milliseconds the request slept to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_millis")] - public long? ThrottledMillis { get; init; } - [JsonInclude, JsonPropertyName("throttled_until")] - public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; init; } + public System.TimeSpan? ThrottledMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; set; } /// /// @@ -102,46 +275,40 @@ public sealed partial class UpdateByQueryResponse : ElasticsearchResponse /// It only has meaning when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_until_millis")] - public long? ThrottledUntilMillis { get; init; } + public System.TimeSpan? ThrottledUntilMillis { get; set; } /// /// /// If true, some requests timed out during the update by query. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool? TimedOut { get; init; } + public bool? TimedOut { get; set; } /// /// /// The number of milliseconds from start to end of the whole operation. /// /// - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + public System.TimeSpan? Took { get; set; } /// /// /// The number of documents that were successfully processed. /// /// - [JsonInclude, JsonPropertyName("total")] - public long? Total { get; init; } + public long? Total { get; set; } /// /// /// The number of documents that were successfully updated. /// /// - [JsonInclude, JsonPropertyName("updated")] - public long? Updated { get; init; } + public long? Updated { get; set; } /// /// /// The number of version conflicts that the update by query hit. /// /// - [JsonInclude, JsonPropertyName("version_conflicts")] - public long? VersionConflicts { get; init; } + public long? VersionConflicts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleRequest.g.cs index 0444bab4be6..2c0b1b2f9c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateByQueryRethrottleRequestParameters : RequestParameters +public sealed partial class UpdateByQueryRethrottleRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -41,6 +34,35 @@ public sealed partial class UpdateByQueryRethrottleRequestParameters : RequestPa public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } +internal sealed partial class UpdateByQueryRethrottleRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Throttle an update by query operation. @@ -50,27 +72,49 @@ public sealed partial class UpdateByQueryRethrottleRequestParameters : RequestPa /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. /// /// -public sealed partial class UpdateByQueryRethrottleRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestConverter))] +public sealed partial class UpdateByQueryRethrottleRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) { } +#if NET7_0_OR_GREATER + public UpdateByQueryRethrottleRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdateByQueryRethrottle; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceUpdateByQueryRethrottle; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => false; internal override string OperationName => "update_by_query_rethrottle"; + /// + /// + /// The ID for the task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id TaskId { get => P("task_id"); set => PR("task_id", value); } + /// /// /// The throttle for this request in sub-requests per second. /// To turn off throttling, set it to -1. /// /// - [JsonIgnore] public float? RequestsPerSecond { get => Q("requests_per_second"); set => Q("requests_per_second", value); } } @@ -83,31 +127,100 @@ public UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Id taskId) : /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. /// /// -public sealed partial class UpdateByQueryRethrottleRequestDescriptor : RequestDescriptor +public readonly partial struct UpdateByQueryRethrottleRequestDescriptor { - internal UpdateByQueryRethrottleRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest Instance { get; init; } - public UpdateByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) : base(r => r.Required("task_id", taskId)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest instance) { + Instance = instance; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdateByQueryRethrottle; + public UpdateByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.Id taskId) + { + Instance = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest(taskId); + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateByQueryRethrottleRequestDescriptor() + { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); + } - internal override bool SupportsBody => false; + public static explicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest instance) => new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor descriptor) => descriptor.Instance; - internal override string OperationName => "update_by_query_rethrottle"; + /// + /// + /// The ID for the task. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.TaskId = value; + return this; + } + + /// + /// + /// The throttle for this request in sub-requests per second. + /// To turn off throttling, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor RequestsPerSecond(float? value) + { + Instance.RequestsPerSecond = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public UpdateByQueryRethrottleRequestDescriptor RequestsPerSecond(float? requestsPerSecond) => Qs("requests_per_second", requestsPerSecond); + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public UpdateByQueryRethrottleRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id taskId) + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) { - RouteValues.Required("task_id", taskId); - return Self; + Instance.RequestConfiguration = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleResponse.g.cs index ed940ed3d73..dd35a2f0f4c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateByQueryRethrottleResponse.g.cs @@ -17,17 +17,68 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateByQueryRethrottleResponse : ElasticsearchResponse +internal sealed partial class UpdateByQueryRethrottleResponseConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + + public override Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponseConverter))] +public sealed partial class UpdateByQueryRethrottleResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryRethrottleResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateByQueryRethrottleResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateRequest.g.cs index 04e8cf18581..fddf0253f30 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateRequestParameters : RequestParameters +public sealed partial class UpdateRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -46,6 +39,13 @@ public sealed partial class UpdateRequestParameters : RequestParameters /// public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// The script language. @@ -116,6 +116,116 @@ public sealed partial class UpdateRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } +internal sealed partial class UpdateRequestConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropDetectNoop = System.Text.Json.JsonEncodedText.Encode("detect_noop"); + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropDocAsUpsert = System.Text.Json.JsonEncodedText.Encode("doc_as_upsert"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropScriptedUpsert = System.Text.Json.JsonEncodedText.Encode("scripted_upsert"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropUpsert = System.Text.Json.JsonEncodedText.Encode("upsert"); + + public override Elastic.Clients.Elasticsearch.UpdateRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetectNoop = default; + LocalJsonValue propDoc = default; + LocalJsonValue propDocAsUpsert = default; + LocalJsonValue propScript = default; + LocalJsonValue propScriptedUpsert = default; + LocalJsonValue propSource = default; + LocalJsonValue propUpsert = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetectNoop.TryReadProperty(ref reader, options, PropDetectNoop, null)) + { + continue; + } + + if (propDoc.TryReadProperty(ref reader, options, PropDoc, static TPartialDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propDocAsUpsert.TryReadProperty(ref reader, options, PropDocAsUpsert, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propScriptedUpsert.TryReadProperty(ref reader, options, PropScriptedUpsert, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propUpsert.TryReadProperty(ref reader, options, PropUpsert, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DetectNoop = propDetectNoop.Value, + Doc = propDoc.Value, + DocAsUpsert = propDocAsUpsert.Value, + Script = propScript.Value, + ScriptedUpsert = propScriptedUpsert.Value, + Source = propSource.Value, + Upsert = propUpsert.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetectNoop, value.DetectNoop, null, null); + writer.WriteProperty(options, PropDoc, value.Doc, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TPartialDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropDocAsUpsert, value.DocAsUpsert, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropScriptedUpsert, value.ScriptedUpsert, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropUpsert, value.Upsert, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class UpdateRequestConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(UpdateRequest<,>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(UpdateRequestConverter<,>).MakeGenericType(args[0], args[1]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + /// /// /// Update a document. @@ -157,26 +267,60 @@ public sealed partial class UpdateRequestParameters : RequestParameters /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). /// /// -public sealed partial class UpdateRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateRequestConverterFactory))] +public sealed partial class UpdateRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) { } +#if NET7_0_OR_GREATER + public UpdateRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdate; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.NoNamespaceUpdate; - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.POST; internal override bool SupportsBody => true; internal override string OperationName => "update"; + /// + /// + /// A unique identifier for the document to be updated. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get => P("id"); set => PR("id", value); } + + /// + /// + /// The name of the target index. + /// By default, the index is created automatically if it doesn't exist. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get => P("index"); set => PR("index", value); } + /// /// /// Only perform the operation if the document has this primary term. /// /// - [JsonIgnore] public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } /// @@ -184,15 +328,20 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// Only perform the operation if the document has this sequence number. /// /// - [JsonIgnore] public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public bool? IncludeSourceOnError { get => Q("include_source_on_error"); set => Q("include_source_on_error", value); } + /// /// /// The script language. /// /// - [JsonIgnore] public string? Lang { get => Q("lang"); set => Q("lang", value); } /// @@ -202,7 +351,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If 'false', it does nothing with refreshes. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } /// @@ -210,7 +358,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If true, the destination must be an index alias. /// /// - [JsonIgnore] public bool? RequireAlias { get => Q("require_alias"); set => Q("require_alias", value); } /// @@ -218,7 +365,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The number of times the operation should be retried when a conflict occurs. /// /// - [JsonIgnore] public int? RetryOnConflict { get => Q("retry_on_conflict"); set => Q("retry_on_conflict", value); } /// @@ -226,7 +372,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// A custom value used to route operations to a specific shard. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Routing? Routing { get => Q("routing"); set => Q("routing", value); } /// @@ -234,7 +379,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The source fields you want to exclude. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceExcludes { get => Q("_source_excludes"); set => Q("_source_excludes", value); } /// @@ -242,7 +386,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The source fields you want to retrieve. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Fields? SourceIncludes { get => Q("_source_includes"); set => Q("_source_includes", value); } /// @@ -252,7 +395,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The actual wait time could be longer, particularly when multiple waits occur. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// @@ -262,7 +404,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The default value of 1 means it waits for each primary shard to be active. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } /// @@ -270,7 +411,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If true, the result in the response is set to noop (no operation) when there are no changes to the document. /// /// - [JsonInclude, JsonPropertyName("detect_noop")] public bool? DetectNoop { get; set; } /// @@ -279,8 +419,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If both doc and script are specified, doc is ignored. /// /// - [JsonInclude, JsonPropertyName("doc")] - [SourceConverter] public TPartialDocument? Doc { get; set; } /// @@ -289,7 +427,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// NOTE: Using ingest pipelines with doc_as_upsert is not supported. /// /// - [JsonInclude, JsonPropertyName("doc_as_upsert")] public bool? DocAsUpsert { get; set; } /// @@ -297,7 +434,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// The script to run to update the document. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -305,7 +441,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If true, run the script whether or not the document exists. /// /// - [JsonInclude, JsonPropertyName("scripted_upsert")] public bool? ScriptedUpsert { get; set; } /// @@ -314,7 +449,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// You can also specify a comma-separated list of the fields you want to retrieve. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// @@ -323,8 +457,6 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// If the document exists, the 'script' is run. /// /// - [JsonInclude, JsonPropertyName("upsert")] - [SourceConverter] public TDocument? Upsert { get; set; } } @@ -369,81 +501,222 @@ public UpdateRequest(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clie /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). /// /// -public sealed partial class UpdateRequestDescriptor : RequestDescriptor, UpdateRequestParameters> +public readonly partial struct UpdateRequestDescriptor { - internal UpdateRequestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.UpdateRequest Instance { get; init; } - public UpdateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("index", index).Required("id", id)) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateRequest instance) { + Instance = instance; } - public UpdateRequestDescriptor(TDocument document) : this(typeof(TDocument), Elastic.Clients.Elasticsearch.Id.From(document)) + public UpdateRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) { + Instance = new Elastic.Clients.Elasticsearch.UpdateRequest(index, id); } - public UpdateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) : this(index, Elastic.Clients.Elasticsearch.Id.From(document)) + [System.Obsolete("The use of the parameterless constructor is not permitted for this type.")] + public UpdateRequestDescriptor() { + throw new System.InvalidOperationException("The use of the parameterless constructor is not permitted for this type."); } - public UpdateRequestDescriptor(TDocument document, Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + public static explicit operator Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(Elastic.Clients.Elasticsearch.UpdateRequest instance) => new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.UpdateRequest(Elastic.Clients.Elasticsearch.UpdateRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A unique identifier for the document to be updated. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { + Instance.Id = value; + return this; } - public UpdateRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : this(typeof(TDocument), id) + /// + /// + /// The name of the target index. + /// By default, the index is created automatically if it doesn't exist. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { + Instance.Index = value; + return this; } - internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceUpdate; + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor IfPrimaryTerm(long? value) + { + Instance.IfPrimaryTerm = value; + return this; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor IfSeqNo(long? value) + { + Instance.IfSeqNo = value; + return this; + } - internal override bool SupportsBody => true; + /// + /// + /// True or false if to include the document source in the error message in case of parsing errors. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor IncludeSourceOnError(bool? value = true) + { + Instance.IncludeSourceOnError = value; + return this; + } - internal override string OperationName => "update"; + /// + /// + /// The script language. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Lang(string? value) + { + Instance.Lang = value; + return this; + } - public UpdateRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); - public UpdateRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); - public UpdateRequestDescriptor Lang(string? lang) => Qs("lang", lang); - public UpdateRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); - public UpdateRequestDescriptor RequireAlias(bool? requireAlias = true) => Qs("require_alias", requireAlias); - public UpdateRequestDescriptor RetryOnConflict(int? retryOnConflict) => Qs("retry_on_conflict", retryOnConflict); - public UpdateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) => Qs("routing", routing); - public UpdateRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? sourceExcludes) => Qs("_source_excludes", sourceExcludes); - public UpdateRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? sourceIncludes) => Qs("_source_includes", sourceIncludes); - public UpdateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); - public UpdateRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? waitForActiveShards) => Qs("wait_for_active_shards", waitForActiveShards); + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. + /// If 'wait_for', it waits for a refresh to make this operation visible to search. + /// If 'false', it does nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? value) + { + Instance.Refresh = value; + return this; + } - public UpdateRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + /// + /// + /// If true, the destination must be an index alias. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor RequireAlias(bool? value = true) { - RouteValues.Required("id", id); - return Self; + Instance.RequireAlias = value; + return this; } - public UpdateRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + /// + /// + /// The number of times the operation should be retried when a conflict occurs. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor RetryOnConflict(int? value) { - RouteValues.Required("index", index); - return Self; + Instance.RetryOnConflict = value; + return this; } - private bool? DetectNoopValue { get; set; } - private TPartialDocument? DocValue { get; set; } - private bool? DocAsUpsertValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? ScriptedUpsertValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private TDocument? UpsertValue { get; set; } + /// + /// + /// A custom value used to route operations to a specific shard. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } + + /// + /// + /// The source fields you want to exclude. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor SourceExcludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// The source fields you want to exclude. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor SourceExcludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceExcludes = value; + return this; + } + + /// + /// + /// The source fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor SourceIncludes(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The source fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor SourceIncludes(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceIncludes = value; + return this; + } + + /// + /// + /// The period to wait for the following operations: dynamic mapping updates and waiting for active shards. + /// Elasticsearch waits for at least the timeout period before failing. + /// The actual wait time could be longer, particularly when multiple waits occur. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The number of copies of each shard that must be active before proceeding with the operation. + /// Set to 'all' or any positive integer up to the total number of shards in the index (number_of_replicas+1). + /// The default value of 1 means it waits for each primary shard to be active. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor WaitForActiveShards(Elastic.Clients.Elasticsearch.WaitForActiveShards? value) + { + Instance.WaitForActiveShards = value; + return this; + } /// /// /// If true, the result in the response is set to noop (no operation) when there are no changes to the document. /// /// - public UpdateRequestDescriptor DetectNoop(bool? detectNoop = true) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor DetectNoop(bool? value = true) { - DetectNoopValue = detectNoop; - return Self; + Instance.DetectNoop = value; + return this; } /// @@ -452,10 +725,10 @@ public UpdateRequestDescriptor DetectNoop(bool? det /// If both doc and script are specified, doc is ignored. /// /// - public UpdateRequestDescriptor Doc(TPartialDocument? doc) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Doc(TPartialDocument? value) { - DocValue = doc; - return Self; + Instance.Doc = value; + return this; } /// @@ -464,10 +737,10 @@ public UpdateRequestDescriptor Doc(TPartialDocument /// NOTE: Using ingest pipelines with doc_as_upsert is not supported. /// /// - public UpdateRequestDescriptor DocAsUpsert(bool? docAsUpsert = true) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor DocAsUpsert(bool? value = true) { - DocAsUpsertValue = docAsUpsert; - return Self; + Instance.DocAsUpsert = value; + return this; } /// @@ -475,28 +748,32 @@ public UpdateRequestDescriptor DocAsUpsert(bool? do /// The script to run to update the document. /// /// - public UpdateRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public UpdateRequestDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run to update the document. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public UpdateRequestDescriptor Script(Action configure) + /// + /// + /// The script to run to update the document. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -504,10 +781,10 @@ public UpdateRequestDescriptor Script(Actiontrue, run the script whether or not the document exists. /// /// - public UpdateRequestDescriptor ScriptedUpsert(bool? scriptedUpsert = true) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor ScriptedUpsert(bool? value = true) { - ScriptedUpsertValue = scriptedUpsert; - return Self; + Instance.ScriptedUpsert = value; + return this; } /// @@ -516,10 +793,22 @@ public UpdateRequestDescriptor ScriptedUpsert(bool? /// You can also specify a comma-separated list of the fields you want to retrieve. /// /// - public UpdateRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; + } + + /// + /// + /// If false, turn off source retrieval. + /// You can also specify a comma-separated list of the fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// @@ -528,67 +817,59 @@ public UpdateRequestDescriptor Source(Elastic.Clien /// If the document exists, the 'script' is run. /// /// - public UpdateRequestDescriptor Upsert(TDocument? upsert) + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Upsert(TDocument? value) { - UpsertValue = upsert; - return Self; + Instance.Upsert = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.UpdateRequest Build(System.Action> action) { - writer.WriteStartObject(); - if (DetectNoopValue.HasValue) - { - writer.WritePropertyName("detect_noop"); - writer.WriteBooleanValue(DetectNoopValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(new Elastic.Clients.Elasticsearch.UpdateRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - settings.SourceSerializer.Serialize(DocValue, writer); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } - if (DocAsUpsertValue.HasValue) - { - writer.WritePropertyName("doc_as_upsert"); - writer.WriteBooleanValue(DocAsUpsertValue.Value); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } - if (ScriptedUpsertValue.HasValue) - { - writer.WritePropertyName("scripted_upsert"); - writer.WriteBooleanValue(ScriptedUpsertValue.Value); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - if (UpsertValue is not null) - { - writer.WritePropertyName("upsert"); - settings.SourceSerializer.Serialize(UpsertValue, writer); - } + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.UpdateRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs index 5a2685e9bdf..ef7df1634d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs @@ -17,53 +17,196 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -public sealed partial class UpdateResponse : ElasticsearchResponse +internal sealed partial class UpdateResponseConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropForcedRefresh = System.Text.Json.JsonEncodedText.Encode("forced_refresh"); + private static readonly System.Text.Json.JsonEncodedText PropGet = System.Text.Json.JsonEncodedText.Encode("get"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.UpdateResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForcedRefresh = default; + LocalJsonValue?> propGet = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propResult = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShards = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForcedRefresh.TryReadProperty(ref reader, options, PropForcedRefresh, null)) + { + continue; + } + + if (propGet.TryReadProperty(ref reader, options, PropGet, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.UpdateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForcedRefresh = propForcedRefresh.Value, + Get = propGet.Value, + Id = propId.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Result = propResult.Value, + SeqNo = propSeqNo.Value, + Shards = propShards.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.UpdateResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForcedRefresh, value.ForcedRefresh, null, null); + writer.WriteProperty(options, PropGet, value.Get, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class UpdateResponseConverterFactory : System.Text.Json.Serialization.JsonConverterFactory { - [JsonInclude, JsonPropertyName("forced_refresh")] - public bool? ForcedRefresh { get; init; } - [JsonInclude, JsonPropertyName("get")] - public Elastic.Clients.Elasticsearch.InlineGet? Get { get; init; } + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(UpdateResponse<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(UpdateResponseConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.UpdateResponseConverterFactory))] +public sealed partial class UpdateResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? ForcedRefresh { get; set; } + public Elastic.Clients.Elasticsearch.InlineGet? Get { get; set; } /// /// /// The unique identifier for the added document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the index the document was added to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The result of the indexing operation: created or updated. /// /// - [JsonInclude, JsonPropertyName("result")] - public Elastic.Clients.Elasticsearch.Result Result { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Result Result { get; set; } /// /// @@ -71,22 +214,27 @@ public sealed partial class UpdateResponse : ElasticsearchResponse /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// /// Information about the replication process of the operation. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } /// /// /// The document version, which is incremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoRequest.g.cs index 770c668527f..fca20cf01ce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -public sealed partial class XpackInfoRequestParameters : RequestParameters +public sealed partial class XpackInfoRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -45,7 +38,36 @@ public sealed partial class XpackInfoRequestParameters : RequestParameters /// For example, build,license,features. /// /// - public ICollection? Categories { get => Q?>("categories"); set => Q("categories", value); } + public System.Collections.Generic.ICollection? Categories { get => Q?>("categories"); set => Q("categories", value); } +} + +internal sealed partial class XpackInfoRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } } /// @@ -71,11 +93,28 @@ public sealed partial class XpackInfoRequestParameters : RequestParameters /// /// /// -public sealed partial class XpackInfoRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestConverter))] +public sealed partial class XpackInfoRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.XpackInfo; +#if NET7_0_OR_GREATER + public XpackInfoRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public XpackInfoRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XpackInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.XpackInfo; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -86,7 +125,6 @@ public sealed partial class XpackInfoRequest : PlainRequest /// - [JsonIgnore] public bool? AcceptEnterprise { get => Q("accept_enterprise"); set => Q("accept_enterprise", value); } /// @@ -95,8 +133,7 @@ public sealed partial class XpackInfoRequest : PlainRequestbuild,license,features. /// /// - [JsonIgnore] - public ICollection? Categories { get => Q?>("categories"); set => Q("categories", value); } + public System.Collections.Generic.ICollection? Categories { get => Q?>("categories"); set => Q("categories", value); } } /// @@ -122,26 +159,111 @@ public sealed partial class XpackInfoRequest : PlainRequest /// /// -public sealed partial class XpackInfoRequestDescriptor : RequestDescriptor +public readonly partial struct XpackInfoRequestDescriptor { - internal XpackInfoRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XpackInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest instance) + { + Instance = instance; + } public XpackInfoRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.XpackInfo; + public static explicit operator Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest instance) => new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// If this param is used it must be set to true + /// + /// + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor AcceptEnterprise(bool? value = true) + { + Instance.AcceptEnterprise = value; + return this; + } - internal override bool SupportsBody => false; + /// + /// + /// A comma-separated list of the information categories to include in the response. + /// For example, build,license,features. + /// + /// + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor Categories(System.Collections.Generic.ICollection? value) + { + Instance.Categories = value; + return this; + } - internal override string OperationName => "xpack.info"; + /// + /// + /// A comma-separated list of the information categories to include in the response. + /// For example, build,license,features. + /// + /// + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor Categories(params Elastic.Clients.Elasticsearch.Xpack.XPackCategory[] values) + { + Instance.Categories = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - public XpackInfoRequestDescriptor AcceptEnterprise(bool? acceptEnterprise = true) => Qs("accept_enterprise", acceptEnterprise); - public XpackInfoRequestDescriptor Categories(ICollection? categories) => Qs("categories", categories); + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoResponse.g.cs index 6b636e1191f..515cadc9022 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackInfoResponse.g.cs @@ -17,23 +17,110 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -public sealed partial class XpackInfoResponse : ElasticsearchResponse +internal sealed partial class XpackInfoResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuild = System.Text.Json.JsonEncodedText.Encode("build"); + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + private static readonly System.Text.Json.JsonEncodedText PropLicense = System.Text.Json.JsonEncodedText.Encode("license"); + private static readonly System.Text.Json.JsonEncodedText PropTagline = System.Text.Json.JsonEncodedText.Encode("tagline"); + + public override Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuild = default; + LocalJsonValue propFeatures = default; + LocalJsonValue propLicense = default; + LocalJsonValue propTagline = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuild.TryReadProperty(ref reader, options, PropBuild, null)) + { + continue; + } + + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, null)) + { + continue; + } + + if (propLicense.TryReadProperty(ref reader, options, PropLicense, null)) + { + continue; + } + + if (propTagline.TryReadProperty(ref reader, options, PropTagline, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Build = propBuild.Value, + Features = propFeatures.Value, + License = propLicense.Value, + Tagline = propTagline.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuild, value.Build, null, null); + writer.WriteProperty(options, PropFeatures, value.Features, null, null); + writer.WriteProperty(options, PropLicense, value.License, null, null); + writer.WriteProperty(options, PropTagline, value.Tagline, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponseConverter))] +public sealed partial class XpackInfoResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("build")] - public Elastic.Clients.Elasticsearch.Xpack.BuildInformation Build { get; init; } - [JsonInclude, JsonPropertyName("features")] - public Elastic.Clients.Elasticsearch.Xpack.Features Features { get; init; } - [JsonInclude, JsonPropertyName("license")] - public Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformation License { get; init; } - [JsonInclude, JsonPropertyName("tagline")] - public string Tagline { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XpackInfoResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XpackInfoResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.BuildInformation Build { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Features Features { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformation License { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Tagline { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageRequest.g.cs index 206d8f11788..613eb851282 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageRequest.g.cs @@ -17,20 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -public sealed partial class XpackUsageRequestParameters : RequestParameters +public sealed partial class XpackUsageRequestParameters : Elastic.Transport.RequestParameters { /// /// @@ -42,6 +35,35 @@ public sealed partial class XpackUsageRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } +internal sealed partial class XpackUsageRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// Get usage information. @@ -49,11 +71,28 @@ public sealed partial class XpackUsageRequestParameters : RequestParameters /// The API also provides some usage statistics. /// /// -public sealed partial class XpackUsageRequest : PlainRequest +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestConverter))] +public sealed partial class XpackUsageRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest { - internal override ApiUrls ApiUrls => ApiUrlLookup.XpackUsage; +#if NET7_0_OR_GREATER + public XpackUsageRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public XpackUsageRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XpackUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.XpackUsage; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.GET; internal override bool SupportsBody => false; @@ -66,7 +105,6 @@ public sealed partial class XpackUsageRequest : PlainRequest-1. /// /// - [JsonIgnore] public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } } @@ -77,25 +115,89 @@ public sealed partial class XpackUsageRequest : PlainRequest /// -public sealed partial class XpackUsageRequestDescriptor : RequestDescriptor +public readonly partial struct XpackUsageRequestDescriptor { - internal XpackUsageRequestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XpackUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest instance) + { + Instance = instance; + } public XpackUsageRequestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - internal override ApiUrls ApiUrls => ApiUrlLookup.XpackUsage; + public static explicit operator Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest instance) => new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor descriptor) => descriptor.Instance; - protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + /// + /// + /// The period to wait for a connection to the master node. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// To indicate that the request should never timeout, set it to -1. + /// + /// + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } - internal override bool SupportsBody => false; + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } - internal override string OperationName => "xpack.usage"; + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } - public XpackUsageRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor RequestConfiguration(System.Func? configurationSelector) { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageResponse.g.cs index 347789ed115..8d340e38601 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Xpack/XpackUsageResponse.g.cs @@ -17,73 +17,414 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -public sealed partial class XpackUsageResponse : ElasticsearchResponse +internal sealed partial class XpackUsageResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregateMetric = System.Text.Json.JsonEncodedText.Encode("aggregate_metric"); + private static readonly System.Text.Json.JsonEncodedText PropAnalytics = System.Text.Json.JsonEncodedText.Encode("analytics"); + private static readonly System.Text.Json.JsonEncodedText PropArchive = System.Text.Json.JsonEncodedText.Encode("archive"); + private static readonly System.Text.Json.JsonEncodedText PropCcr = System.Text.Json.JsonEncodedText.Encode("ccr"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrame = System.Text.Json.JsonEncodedText.Encode("data_frame"); + private static readonly System.Text.Json.JsonEncodedText PropDataScience = System.Text.Json.JsonEncodedText.Encode("data_science"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropDataTiers = System.Text.Json.JsonEncodedText.Encode("data_tiers"); + private static readonly System.Text.Json.JsonEncodedText PropEnrich = System.Text.Json.JsonEncodedText.Encode("enrich"); + private static readonly System.Text.Json.JsonEncodedText PropEql = System.Text.Json.JsonEncodedText.Encode("eql"); + private static readonly System.Text.Json.JsonEncodedText PropFlattened = System.Text.Json.JsonEncodedText.Encode("flattened"); + private static readonly System.Text.Json.JsonEncodedText PropGraph = System.Text.Json.JsonEncodedText.Encode("graph"); + private static readonly System.Text.Json.JsonEncodedText PropHealthApi = System.Text.Json.JsonEncodedText.Encode("health_api"); + private static readonly System.Text.Json.JsonEncodedText PropIlm = System.Text.Json.JsonEncodedText.Encode("ilm"); + private static readonly System.Text.Json.JsonEncodedText PropLogstash = System.Text.Json.JsonEncodedText.Encode("logstash"); + private static readonly System.Text.Json.JsonEncodedText PropMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText PropMonitoring = System.Text.Json.JsonEncodedText.Encode("monitoring"); + private static readonly System.Text.Json.JsonEncodedText PropRollup = System.Text.Json.JsonEncodedText.Encode("rollup"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeFields = System.Text.Json.JsonEncodedText.Encode("runtime_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSearchableSnapshots = System.Text.Json.JsonEncodedText.Encode("searchable_snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropSecurity = System.Text.Json.JsonEncodedText.Encode("security"); + private static readonly System.Text.Json.JsonEncodedText PropSlm = System.Text.Json.JsonEncodedText.Encode("slm"); + private static readonly System.Text.Json.JsonEncodedText PropSpatial = System.Text.Json.JsonEncodedText.Encode("spatial"); + private static readonly System.Text.Json.JsonEncodedText PropSql = System.Text.Json.JsonEncodedText.Encode("sql"); + private static readonly System.Text.Json.JsonEncodedText PropTransform = System.Text.Json.JsonEncodedText.Encode("transform"); + private static readonly System.Text.Json.JsonEncodedText PropVectors = System.Text.Json.JsonEncodedText.Encode("vectors"); + private static readonly System.Text.Json.JsonEncodedText PropVotingOnly = System.Text.Json.JsonEncodedText.Encode("voting_only"); + private static readonly System.Text.Json.JsonEncodedText PropWatcher = System.Text.Json.JsonEncodedText.Encode("watcher"); + + public override Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregateMetric = default; + LocalJsonValue propAnalytics = default; + LocalJsonValue propArchive = default; + LocalJsonValue propCcr = default; + LocalJsonValue propDataFrame = default; + LocalJsonValue propDataScience = default; + LocalJsonValue propDataStreams = default; + LocalJsonValue propDataTiers = default; + LocalJsonValue propEnrich = default; + LocalJsonValue propEql = default; + LocalJsonValue propFlattened = default; + LocalJsonValue propGraph = default; + LocalJsonValue propHealthApi = default; + LocalJsonValue propIlm = default; + LocalJsonValue propLogstash = default; + LocalJsonValue propMl = default; + LocalJsonValue propMonitoring = default; + LocalJsonValue propRollup = default; + LocalJsonValue propRuntimeFields = default; + LocalJsonValue propSearchableSnapshots = default; + LocalJsonValue propSecurity = default; + LocalJsonValue propSlm = default; + LocalJsonValue propSpatial = default; + LocalJsonValue propSql = default; + LocalJsonValue propTransform = default; + LocalJsonValue propVectors = default; + LocalJsonValue propVotingOnly = default; + LocalJsonValue propWatcher = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregateMetric.TryReadProperty(ref reader, options, PropAggregateMetric, null)) + { + continue; + } + + if (propAnalytics.TryReadProperty(ref reader, options, PropAnalytics, null)) + { + continue; + } + + if (propArchive.TryReadProperty(ref reader, options, PropArchive, null)) + { + continue; + } + + if (propCcr.TryReadProperty(ref reader, options, PropCcr, null)) + { + continue; + } + + if (propDataFrame.TryReadProperty(ref reader, options, PropDataFrame, null)) + { + continue; + } + + if (propDataScience.TryReadProperty(ref reader, options, PropDataScience, null)) + { + continue; + } + + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, null)) + { + continue; + } + + if (propDataTiers.TryReadProperty(ref reader, options, PropDataTiers, null)) + { + continue; + } + + if (propEnrich.TryReadProperty(ref reader, options, PropEnrich, null)) + { + continue; + } + + if (propEql.TryReadProperty(ref reader, options, PropEql, null)) + { + continue; + } + + if (propFlattened.TryReadProperty(ref reader, options, PropFlattened, null)) + { + continue; + } + + if (propGraph.TryReadProperty(ref reader, options, PropGraph, null)) + { + continue; + } + + if (propHealthApi.TryReadProperty(ref reader, options, PropHealthApi, null)) + { + continue; + } + + if (propIlm.TryReadProperty(ref reader, options, PropIlm, null)) + { + continue; + } + + if (propLogstash.TryReadProperty(ref reader, options, PropLogstash, null)) + { + continue; + } + + if (propMl.TryReadProperty(ref reader, options, PropMl, null)) + { + continue; + } + + if (propMonitoring.TryReadProperty(ref reader, options, PropMonitoring, null)) + { + continue; + } + + if (propRollup.TryReadProperty(ref reader, options, PropRollup, null)) + { + continue; + } + + if (propRuntimeFields.TryReadProperty(ref reader, options, PropRuntimeFields, null)) + { + continue; + } + + if (propSearchableSnapshots.TryReadProperty(ref reader, options, PropSearchableSnapshots, null)) + { + continue; + } + + if (propSecurity.TryReadProperty(ref reader, options, PropSecurity, null)) + { + continue; + } + + if (propSlm.TryReadProperty(ref reader, options, PropSlm, null)) + { + continue; + } + + if (propSpatial.TryReadProperty(ref reader, options, PropSpatial, null)) + { + continue; + } + + if (propSql.TryReadProperty(ref reader, options, PropSql, null)) + { + continue; + } + + if (propTransform.TryReadProperty(ref reader, options, PropTransform, null)) + { + continue; + } + + if (propVectors.TryReadProperty(ref reader, options, PropVectors, null)) + { + continue; + } + + if (propVotingOnly.TryReadProperty(ref reader, options, PropVotingOnly, null)) + { + continue; + } + + if (propWatcher.TryReadProperty(ref reader, options, PropWatcher, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AggregateMetric = propAggregateMetric.Value, + Analytics = propAnalytics.Value, + Archive = propArchive.Value, + Ccr = propCcr.Value, + DataFrame = propDataFrame.Value, + DataScience = propDataScience.Value, + DataStreams = propDataStreams.Value, + DataTiers = propDataTiers.Value, + Enrich = propEnrich.Value, + Eql = propEql.Value, + Flattened = propFlattened.Value, + Graph = propGraph.Value, + HealthApi = propHealthApi.Value, + Ilm = propIlm.Value, + Logstash = propLogstash.Value, + Ml = propMl.Value, + Monitoring = propMonitoring.Value, + Rollup = propRollup.Value, + RuntimeFields = propRuntimeFields.Value, + SearchableSnapshots = propSearchableSnapshots.Value, + Security = propSecurity.Value, + Slm = propSlm.Value, + Spatial = propSpatial.Value, + Sql = propSql.Value, + Transform = propTransform.Value, + Vectors = propVectors.Value, + VotingOnly = propVotingOnly.Value, + Watcher = propWatcher.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregateMetric, value.AggregateMetric, null, null); + writer.WriteProperty(options, PropAnalytics, value.Analytics, null, null); + writer.WriteProperty(options, PropArchive, value.Archive, null, null); + writer.WriteProperty(options, PropCcr, value.Ccr, null, null); + writer.WriteProperty(options, PropDataFrame, value.DataFrame, null, null); + writer.WriteProperty(options, PropDataScience, value.DataScience, null, null); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, null); + writer.WriteProperty(options, PropDataTiers, value.DataTiers, null, null); + writer.WriteProperty(options, PropEnrich, value.Enrich, null, null); + writer.WriteProperty(options, PropEql, value.Eql, null, null); + writer.WriteProperty(options, PropFlattened, value.Flattened, null, null); + writer.WriteProperty(options, PropGraph, value.Graph, null, null); + writer.WriteProperty(options, PropHealthApi, value.HealthApi, null, null); + writer.WriteProperty(options, PropIlm, value.Ilm, null, null); + writer.WriteProperty(options, PropLogstash, value.Logstash, null, null); + writer.WriteProperty(options, PropMl, value.Ml, null, null); + writer.WriteProperty(options, PropMonitoring, value.Monitoring, null, null); + writer.WriteProperty(options, PropRollup, value.Rollup, null, null); + writer.WriteProperty(options, PropRuntimeFields, value.RuntimeFields, null, null); + writer.WriteProperty(options, PropSearchableSnapshots, value.SearchableSnapshots, null, null); + writer.WriteProperty(options, PropSecurity, value.Security, null, null); + writer.WriteProperty(options, PropSlm, value.Slm, null, null); + writer.WriteProperty(options, PropSpatial, value.Spatial, null, null); + writer.WriteProperty(options, PropSql, value.Sql, null, null); + writer.WriteProperty(options, PropTransform, value.Transform, null, null); + writer.WriteProperty(options, PropVectors, value.Vectors, null, null); + writer.WriteProperty(options, PropVotingOnly, value.VotingOnly, null, null); + writer.WriteProperty(options, PropWatcher, value.Watcher, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponseConverter))] +public sealed partial class XpackUsageResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse { - [JsonInclude, JsonPropertyName("aggregate_metric")] - public Elastic.Clients.Elasticsearch.Xpack.Base AggregateMetric { get; init; } - [JsonInclude, JsonPropertyName("analytics")] - public Elastic.Clients.Elasticsearch.Xpack.Analytics Analytics { get; init; } - [JsonInclude, JsonPropertyName("archive")] - public Elastic.Clients.Elasticsearch.Xpack.Archive Archive { get; init; } - [JsonInclude, JsonPropertyName("ccr")] - public Elastic.Clients.Elasticsearch.Xpack.Ccr Ccr { get; init; } - [JsonInclude, JsonPropertyName("data_frame")] - public Elastic.Clients.Elasticsearch.Xpack.Base? DataFrame { get; init; } - [JsonInclude, JsonPropertyName("data_science")] - public Elastic.Clients.Elasticsearch.Xpack.Base? DataScience { get; init; } - [JsonInclude, JsonPropertyName("data_streams")] - public Elastic.Clients.Elasticsearch.Xpack.DataStreams? DataStreams { get; init; } - [JsonInclude, JsonPropertyName("data_tiers")] - public Elastic.Clients.Elasticsearch.Xpack.DataTiers DataTiers { get; init; } - [JsonInclude, JsonPropertyName("enrich")] - public Elastic.Clients.Elasticsearch.Xpack.Base? Enrich { get; init; } - [JsonInclude, JsonPropertyName("eql")] - public Elastic.Clients.Elasticsearch.Xpack.Eql Eql { get; init; } - [JsonInclude, JsonPropertyName("flattened")] - public Elastic.Clients.Elasticsearch.Xpack.Flattened? Flattened { get; init; } - [JsonInclude, JsonPropertyName("frozen_indices")] - public Elastic.Clients.Elasticsearch.Xpack.FrozenIndices FrozenIndices { get; init; } - [JsonInclude, JsonPropertyName("graph")] - public Elastic.Clients.Elasticsearch.Xpack.Base Graph { get; init; } - [JsonInclude, JsonPropertyName("health_api")] - public Elastic.Clients.Elasticsearch.Xpack.HealthStatistics? HealthApi { get; init; } - [JsonInclude, JsonPropertyName("ilm")] - public Elastic.Clients.Elasticsearch.Xpack.Ilm Ilm { get; init; } - [JsonInclude, JsonPropertyName("logstash")] - public Elastic.Clients.Elasticsearch.Xpack.Base Logstash { get; init; } - [JsonInclude, JsonPropertyName("ml")] - public Elastic.Clients.Elasticsearch.Xpack.MachineLearning Ml { get; init; } - [JsonInclude, JsonPropertyName("monitoring")] - public Elastic.Clients.Elasticsearch.Xpack.Monitoring Monitoring { get; init; } - [JsonInclude, JsonPropertyName("rollup")] - public Elastic.Clients.Elasticsearch.Xpack.Base Rollup { get; init; } - [JsonInclude, JsonPropertyName("runtime_fields")] - public Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypes? RuntimeFields { get; init; } - [JsonInclude, JsonPropertyName("searchable_snapshots")] - public Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshots SearchableSnapshots { get; init; } - [JsonInclude, JsonPropertyName("security")] - public Elastic.Clients.Elasticsearch.Xpack.Security Security { get; init; } - [JsonInclude, JsonPropertyName("slm")] - public Elastic.Clients.Elasticsearch.Xpack.Slm Slm { get; init; } - [JsonInclude, JsonPropertyName("spatial")] - public Elastic.Clients.Elasticsearch.Xpack.Base Spatial { get; init; } - [JsonInclude, JsonPropertyName("sql")] - public Elastic.Clients.Elasticsearch.Xpack.Sql Sql { get; init; } - [JsonInclude, JsonPropertyName("transform")] - public Elastic.Clients.Elasticsearch.Xpack.Base Transform { get; init; } - [JsonInclude, JsonPropertyName("vectors")] - public Elastic.Clients.Elasticsearch.Xpack.Vector? Vectors { get; init; } - [JsonInclude, JsonPropertyName("voting_only")] - public Elastic.Clients.Elasticsearch.Xpack.Base VotingOnly { get; init; } - [JsonInclude, JsonPropertyName("watcher")] - public Elastic.Clients.Elasticsearch.Xpack.Watcher Watcher { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XpackUsageResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XpackUsageResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base AggregateMetric { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Analytics Analytics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Archive Archive { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Ccr Ccr { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Base? DataFrame { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Base? DataScience { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.DataStreams? DataStreams { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.DataTiers DataTiers { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Base? Enrich { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Eql Eql { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Flattened? Flattened { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base Graph { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.HealthStatistics? HealthApi { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Ilm Ilm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base Logstash { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MachineLearning Ml { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Monitoring Monitoring { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base Rollup { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypes? RuntimeFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshots SearchableSnapshots { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Security Security { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Slm Slm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base Spatial { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Sql Sql { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base Transform { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Vector? Vectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base VotingOnly { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Watcher Watcher { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs index 6cdf90cffa7..9a03f8987f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs @@ -18,944 +18,309 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public partial class AsyncSearchNamespacedClient : NamespacedClientProxy +public partial class AsyncSearchNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected AsyncSearchNamespacedClient() : base() { } - internal AsyncSearchNamespacedClient(ElasticsearchClient client) : base(client) + internal AsyncSearchNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(DeleteAsyncSearchRequest request) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteAsyncSearchRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(DeleteAsyncSearchRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(DeleteAsyncSearchRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteAsyncSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncSearchResponse, DeleteAsyncSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteAsyncSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async search. - /// - /// - /// If the asynchronous search is still running, it is cancelled. - /// Otherwise, the saved search results are deleted. - /// If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncSearchResponse Get(GetAsyncSearchRequest request) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchResponse Delete(Elastic.Clients.Elasticsearch.Id id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, GetAsyncSearchRequestParameters>(request); + return DoRequest(request); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(GetAsyncSearchRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync, GetAsyncSearchRequestParameters>(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncSearchResponse Get(GetAsyncSearchRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncSearchResponse Get(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.DeleteAsyncSearchRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncSearchResponse Get(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse Get(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest request) { - var descriptor = new GetAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(GetAsyncSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse Get(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchResponse Get(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new GetAsyncSearchRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request); } - /// - /// - /// Get async search results. - /// - /// - /// Retrieve the results of a previously submitted asynchronous search request. - /// If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAsyncSearchRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncSearchResponse, GetAsyncSearchRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(AsyncSearchStatusRequest request) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(AsyncSearchStatusRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.GetAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(AsyncSearchStatusRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest request) { - descriptor.BeforeRequest(); - return DoRequest, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(AsyncSearchStatusRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncSearchStatusResponse Status(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(AsyncSearchStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit() { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(System.Action> action) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncSearchStatusResponse, AsyncSearchStatusRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(AsyncSearchStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Get the async search status. - /// - /// - /// Get the status of a previously submitted async search request given its identifier, without retrieving search results. - /// If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit() { - var descriptor = new AsyncSearchStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit(SubmitAsyncSearchRequest request) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, SubmitAsyncSearchRequestParameters>(request); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(SubmitAsyncSearchRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices) { + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchRequestParameters>(request, cancellationToken); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit(SubmitAsyncSearchRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task> SubmitAsync(Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task> SubmitAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit() + public virtual System.Threading.Tasks.Task> SubmitAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SubmitAsyncSearchResponse Submit(Action> configureRequest) + public virtual System.Threading.Tasks.Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(SubmitAsyncSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SubmitAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SubmitAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run an async search. - /// - /// - /// When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested. - /// - /// - /// Warning: Asynchronous search does not support scroll or search requests that include only the suggest section. - /// - /// - /// By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. - /// The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SubmitAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SubmitAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SubmitAsyncSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SubmitAsyncSearchResponse, SubmitAsyncSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.AsyncSearch.SubmitAsyncSearchRequestParameters>(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ccr.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ccr.g.cs index 410d8d118fe..3c63805d760 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ccr.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ccr.g.cs @@ -18,3183 +18,1019 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -public partial class CrossClusterReplicationNamespacedClient : NamespacedClientProxy +public partial class CrossClusterReplicationNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected CrossClusterReplicationNamespacedClient() : base() { } - internal CrossClusterReplicationNamespacedClient(ElasticsearchClient client) : base(client) + internal CrossClusterReplicationNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(DeleteAutoFollowPatternRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAutoFollowPatternAsync(DeleteAutoFollowPatternRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(DeleteAutoFollowPatternRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task DeleteAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAutoFollowPatternResponse DeleteAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAutoFollowPatternAsync(DeleteAutoFollowPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.DeleteAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest request) { - var descriptor = new DeleteAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete auto-follow patterns. - /// Delete a collection of cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new DeleteAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(FollowRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(FollowRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow() { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(FollowRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, FollowResponse, FollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new FollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, FollowResponse, FollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) + public virtual System.Threading.Tasks.Task FollowAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowResponse, FollowRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow() + public virtual System.Threading.Tasks.Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FollowResponse, FollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(Action> configureRequest) + public virtual System.Threading.Tasks.Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowResponse, FollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(FollowRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task FollowAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual System.Threading.Tasks.Task FollowAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowResponse Follow(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) + public virtual System.Threading.Tasks.Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(FollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, FollowResponse, FollowRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new FollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowResponse, FollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new FollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowResponse, FollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo() { - var descriptor = new FollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowResponse, FollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo(System.Action> action) { - var descriptor = new FollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowResponse, FollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(FollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowInfoAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a follower. - /// Create a cross-cluster replication follower index that follows a specific leader index. - /// When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(FollowInfoRequest request) + public virtual System.Threading.Tasks.Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(FollowInfoRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowInfoAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(FollowInfoRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task FollowInfoAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, FollowInfoResponse, FollowInfoRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices) + public virtual System.Threading.Tasks.Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowInfoRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, FollowInfoResponse, FollowInfoRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowInfoRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest request) { - var descriptor = new FollowInfoRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowInfoResponse, FollowInfoRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo() + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new FollowInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FollowInfoResponse, FollowInfoRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new FollowInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowInfoResponse, FollowInfoRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(FollowInfoRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats(System.Action> action) { - var descriptor = new FollowInfoRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowInfoResponse FollowInfo(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new FollowInfoRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(FollowInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, FollowInfoResponse, FollowInfoRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowInfoRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowInfoResponse, FollowInfoRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowInfoRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowInfoResponse, FollowInfoRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowInfoResponse, FollowInfoRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowInfoResponse, FollowInfoRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(FollowInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest request) { - var descriptor = new FollowInfoRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower information. - /// Get information about all cross-cluster replication follower indices. - /// For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowInfoAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new FollowInfoRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(FollowStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(FollowStatsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower() { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(FollowStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, FollowStatsResponse, FollowStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new FollowStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, FollowStatsResponse, FollowStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowStatsResponse, FollowStatsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats() + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FollowStatsResponse, FollowStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(Action> configureRequest) + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FollowStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FollowStatsResponse, FollowStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(FollowStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FollowStatsResponse FollowStats(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(FollowStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, FollowStatsResponse, FollowStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowStatsResponse, FollowStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowStatsResponse, FollowStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowStatsResponse, FollowStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FollowStatsResponse, FollowStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(FollowStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get follower stats. - /// Get cross-cluster replication follower stats. - /// The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FollowStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FollowStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(ForgetFollowerRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(ForgetFollowerRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(ForgetFollowerRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower() - { - var descriptor = new ForgetFollowerRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(Action> configureRequest) - { - var descriptor = new ForgetFollowerRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(ForgetFollowerRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForgetFollowerResponse ForgetFollower(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(ForgetFollowerRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ForgetFollowerResponse, ForgetFollowerRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(ForgetFollowerRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Forget a follower. - /// Remove the cross-cluster replication follower retention leases from the leader. - /// - /// - /// A following index takes out retention leases on its leader index. - /// These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. - /// When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. - /// However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. - /// While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. - /// This API exists to enable manually removing the leases when the unfollow API is unable to do so. - /// - /// - /// NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. - /// The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForgetFollowerRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern(GetAutoFollowPatternRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(GetAutoFollowPatternRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern(GetAutoFollowPatternRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern(Elastic.Clients.Elasticsearch.Name? name) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern() - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAutoFollowPatternResponse GetAutoFollowPattern(Action configureRequest) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(GetAutoFollowPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get auto-follow patterns. - /// Get cross-cluster replication auto-follow patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAutoFollowPatternAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetAutoFollowPatternRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseAutoFollowPatternResponse PauseAutoFollowPattern(PauseAutoFollowPatternRequest request) + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseAutoFollowPatternAsync(PauseAutoFollowPatternRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ForgetFollowerAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ForgetFollowerRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseAutoFollowPatternResponse PauseAutoFollowPattern(PauseAutoFollowPatternRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseAutoFollowPatternResponse PauseAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new PauseAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseAutoFollowPatternResponse PauseAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new PauseAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseAutoFollowPatternAsync(PauseAutoFollowPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new PauseAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Pause an auto-follow pattern. - /// Pause a cross-cluster replication auto-follow pattern. - /// When the API returns, the auto-follow pattern is inactive. - /// New indices that are created on the remote cluster and match the auto-follow patterns are ignored. - /// - /// - /// You can resume auto-following with the resume auto-follow pattern API. - /// When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. - /// Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PauseAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(PauseFollowRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse GetAutoFollowPattern(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(PauseFollowRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse GetAutoFollowPattern() { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(PauseFollowRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PauseFollowResponse, PauseFollowRequestParameters>(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new PauseFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, PauseFollowResponse, PauseFollowRequestParameters>(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new PauseFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PauseFollowResponse, PauseFollowRequestParameters>(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow() - { - var descriptor = new PauseFollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, PauseFollowResponse, PauseFollowRequestParameters>(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(Action> configureRequest) - { - var descriptor = new PauseFollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PauseFollowResponse, PauseFollowRequestParameters>(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(PauseFollowRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new PauseFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) - { - var descriptor = new PauseFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(PauseFollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse GetAutoFollowPattern(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PauseFollowResponse, PauseFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse GetAutoFollowPattern(Elastic.Clients.Elasticsearch.Name? name) { - var descriptor = new PauseFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, PauseFollowResponse, PauseFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternResponse GetAutoFollowPattern(Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - var descriptor = new PauseFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PauseFollowResponse, PauseFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PauseFollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, PauseFollowResponse, PauseFollowRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAutoFollowPatternAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PauseFollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PauseFollowResponse, PauseFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(PauseFollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAutoFollowPatternAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PauseFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Pause a follower. - /// Pause a cross-cluster replication follower index. - /// The follower index will not fetch any additional operations from the leader index. - /// You can resume following with the resume follower API. - /// You can pause and resume a follower index to change the configuration of the following task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PauseFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.GetAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAutoFollowPatternResponse PutAutoFollowPattern(PutAutoFollowPatternRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse PauseAutoFollowPattern(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAutoFollowPatternAsync(PutAutoFollowPatternRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse PauseAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAutoFollowPatternResponse PutAutoFollowPattern(PutAutoFollowPatternRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternResponse PauseAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAutoFollowPatternResponse PutAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task PauseAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAutoFollowPatternResponse PutAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task PauseAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAutoFollowPatternAsync(PutAutoFollowPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PauseAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest request) { - var descriptor = new PutAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update auto-follow patterns. - /// Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. - /// Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. - /// Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern. - /// - /// - /// This API can also be used to update auto-follow patterns. - /// NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new PutAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(ResumeAutoFollowPatternRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeAutoFollowPatternAsync(ResumeAutoFollowPatternRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow() { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(ResumeAutoFollowPatternRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowResponse PauseFollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new ResumeAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task PauseFollowAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeAutoFollowPatternAsync(ResumeAutoFollowPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeAutoFollowPatternRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume an auto-follow pattern. - /// Resume a cross-cluster replication auto-follow pattern that was paused. - /// The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. - /// Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PauseFollowAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeAutoFollowPatternRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(ResumeFollowRequest request) + public virtual System.Threading.Tasks.Task PauseFollowAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(ResumeFollowRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PauseFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PauseFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(ResumeFollowRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse PutAutoFollowPattern(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest request) { - descriptor.BeforeRequest(); - return DoRequest, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse PutAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new ResumeFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternResponse PutAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new ResumeFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow() + public virtual System.Threading.Tasks.Task PutAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeFollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(Action> configureRequest) + public virtual System.Threading.Tasks.Task PutAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeFollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(ResumeFollowRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.PutAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest request) { - var descriptor = new ResumeFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new ResumeFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(ResumeFollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternResponse ResumeAutoFollowPattern(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeAutoFollowPatternAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResumeFollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeAutoFollowPatternRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest request) { - var descriptor = new ResumeFollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ResumeFollowResponse, ResumeFollowRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(ResumeFollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { - var descriptor = new ResumeFollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resume a follower. - /// Resume a cross-cluster replication follower index that was paused. - /// The follower index could have been paused with the pause follower API. - /// Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. - /// When this API returns, the follower index will resume fetching operations from the leader index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow() { - var descriptor = new ResumeFollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CcrStatsResponse Stats(CcrStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CcrStatsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowResponse ResumeFollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CcrStatsResponse Stats(CcrStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CcrStatsResponse Stats() + public virtual System.Threading.Tasks.Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CcrStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CcrStatsResponse Stats(Action configureRequest) + public virtual System.Threading.Tasks.Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CcrStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CcrStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeFollowAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeFollowAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CcrStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cross-cluster replication stats. - /// This API returns stats about auto-following and the same shard-level stats as the get follower stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResumeFollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CcrStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.ResumeFollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(UnfollowRequest request) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse Stats(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(UnfollowRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse Stats() { + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(UnfollowRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsResponse Stats(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, UnfollowResponse, UnfollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, UnfollowResponse, UnfollowRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UnfollowResponse, UnfollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow() + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, UnfollowResponse, UnfollowRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CcrStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest request) { - var descriptor = new UnfollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UnfollowResponse, UnfollowRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(UnfollowRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { - var descriptor = new UnfollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow() { - var descriptor = new UnfollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(UnfollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync, UnfollowResponse, UnfollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowResponse Unfollow(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new UnfollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, UnfollowResponse, UnfollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UnfollowResponse, UnfollowRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, UnfollowResponse, UnfollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UnfollowResponse, UnfollowRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(UnfollowRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Unfollow an index. - /// Convert a cross-cluster replication follower index to a regular index. - /// The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. - /// The follower index must be paused and closed before you call the unfollow API. - /// - /// - /// NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UnfollowAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UnfollowRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.CrossClusterReplication.UnfollowRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs index 64dc90ee161..8ec7dc47664 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs @@ -18,2578 +18,731 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -public partial class ClusterNamespacedClient : NamespacedClientProxy +public partial class ClusterNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected ClusterNamespacedClient() : base() { } - internal ClusterNamespacedClient(ElasticsearchClient client) : base(client) + internal ClusterNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AllocationExplainResponse AllocationExplain(AllocationExplainRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse AllocationExplain(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AllocationExplainAsync(AllocationExplainRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse AllocationExplain() { + var builder = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AllocationExplainResponse AllocationExplain(AllocationExplainRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.AllocationExplainResponse AllocationExplain(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AllocationExplainResponse AllocationExplain() + public virtual System.Threading.Tasks.Task AllocationExplainAsync(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AllocationExplainRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AllocationExplainResponse AllocationExplain(Action configureRequest) + public virtual System.Threading.Tasks.Task AllocationExplainAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AllocationExplainRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AllocationExplainAsync(AllocationExplainRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AllocationExplainAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.AllocationExplainRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AllocationExplainAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse DeleteComponentTemplate(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest request) { - var descriptor = new AllocationExplainRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explain the shard allocations. - /// Get explanations for shard allocations in the cluster. - /// For unassigned shards, it provides an explanation for why the shard is unassigned. - /// For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. - /// This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AllocationExplainAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse DeleteComponentTemplate(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new AllocationExplainRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteComponentTemplateResponse DeleteComponentTemplate(DeleteComponentTemplateRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateResponse DeleteComponentTemplate(Elastic.Clients.Elasticsearch.Names name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteComponentTemplateAsync(DeleteComponentTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteComponentTemplateResponse DeleteComponentTemplate(DeleteComponentTemplateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteComponentTemplateResponse DeleteComponentTemplate(Elastic.Clients.Elasticsearch.Names name) + public virtual System.Threading.Tasks.Task DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteComponentTemplateResponse DeleteComponentTemplate(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest request) { - var descriptor = new DeleteComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteComponentTemplateAsync(DeleteComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(System.Action action) { - var descriptor = new DeleteComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete component templates. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteVotingConfigExclusionsAsync(Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequest request) + public virtual System.Threading.Tasks.Task DeleteVotingConfigExclusionsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteVotingConfigExclusionsAsync(DeleteVotingConfigExclusionsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteVotingConfigExclusionsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.DeleteVotingConfigExclusionsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse ExistsComponentTemplate(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions() + public virtual Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse ExistsComponentTemplate(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new DeleteVotingConfigExclusionsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateResponse ExistsComponentTemplate(Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new DeleteVotingConfigExclusionsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteVotingConfigExclusionsAsync(DeleteVotingConfigExclusionsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteVotingConfigExclusionsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteVotingConfigExclusionsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear cluster voting config exclusions. - /// Remove master-eligible nodes from the voting configuration exclusion list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteVotingConfigExclusionsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteVotingConfigExclusionsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ExistsComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsComponentTemplateResponse ExistsComponentTemplate(ExistsComponentTemplateRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse GetComponentTemplate(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsComponentTemplateAsync(ExistsComponentTemplateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse GetComponentTemplate() { + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsComponentTemplateResponse ExistsComponentTemplate(ExistsComponentTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse GetComponentTemplate(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsComponentTemplateResponse ExistsComponentTemplate(Elastic.Clients.Elasticsearch.Names name) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse GetComponentTemplate(Elastic.Clients.Elasticsearch.Name? name) { - var descriptor = new ExistsComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsComponentTemplateResponse ExistsComponentTemplate(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateResponse GetComponentTemplate(Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - var descriptor = new ExistsComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsComponentTemplateAsync(ExistsComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetComponentTemplateAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExistsComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Check component templates. - /// Returns information about whether a particular component template exists. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsComponentTemplateAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetComponentTemplateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExistsComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate(GetComponentTemplateRequest request) + public virtual System.Threading.Tasks.Task GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(GetComponentTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate(GetComponentTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate(Elastic.Clients.Elasticsearch.Name? name) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse GetSettings() { - var descriptor = new GetComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsResponse GetSettings(System.Action action) { - var descriptor = new GetComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate() + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetComponentTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetComponentTemplateResponse GetComponentTemplate(Action configureRequest) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetComponentTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(GetComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.GetClusterSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(Elastic.Clients.Elasticsearch.Cluster.HealthRequest request) { - var descriptor = new GetComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health() { - var descriptor = new GetComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(System.Action action) { - var descriptor = new GetComponentTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get component templates. - /// Get information about component templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetComponentTemplateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new GetComponentTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetClusterSettingsResponse GetSettings(GetClusterSettingsRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetClusterSettingsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetClusterSettingsResponse GetSettings(GetClusterSettingsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetClusterSettingsResponse GetSettings() + public virtual System.Threading.Tasks.Task HealthAsync(Elastic.Clients.Elasticsearch.Cluster.HealthRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetClusterSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetClusterSettingsResponse GetSettings(Action configureRequest) + public virtual System.Threading.Tasks.Task HealthAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetClusterSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetClusterSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HealthAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetClusterSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster-wide settings. - /// By default, it returns only settings that have been explicitly defined. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetClusterSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(HealthRequest request) + public virtual System.Threading.Tasks.Task HealthAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(HealthRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.HealthRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(HealthRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse Info(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest request) { - descriptor.BeforeRequest(); - return DoRequest, HealthResponse, HealthRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse Info(System.Collections.Generic.ICollection target) { - var descriptor = new HealthRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, HealthResponse, HealthRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterInfoResponse Info(System.Collections.Generic.ICollection target, System.Action action) { - var descriptor = new HealthRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, HealthResponse, HealthRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health() + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, HealthResponse, HealthRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Action> configureRequest) + public virtual System.Threading.Tasks.Task InfoAsync(System.Collections.Generic.ICollection target, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, HealthResponse, HealthRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(HealthRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task InfoAsync(System.Collections.Generic.ICollection target, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterInfoRequestDescriptor(target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse PendingTasks(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest request) { - var descriptor = new HealthRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse PendingTasks() { - var descriptor = new HealthRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health() + public virtual Elastic.Clients.Elasticsearch.Cluster.PendingTasksResponse PendingTasks(System.Action action) { - var descriptor = new HealthRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthResponse Health(Action configureRequest) + public virtual System.Threading.Tasks.Task PendingTasksAsync(Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(HealthRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PendingTasksAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PendingTasksAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PendingTasksRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse PostVotingConfigExclusions(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest request) { - var descriptor = new HealthRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse PostVotingConfigExclusions() { - var descriptor = new HealthRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsResponse PostVotingConfigExclusions(System.Action action) { - var descriptor = new HealthRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, HealthResponse, HealthRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(HealthRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostVotingConfigExclusionsAsync(Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostVotingConfigExclusionsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostVotingConfigExclusionsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HealthRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PostVotingConfigExclusionsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest request) { - var descriptor = new HealthRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the cluster health status. - /// You can also use the API to get the health status of only specified data streams and indices. - /// For data streams, the API retrieves the health status of the stream’s backing indices. - /// - /// - /// The cluster health status is: green, yellow or red. - /// On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. - /// The index level status is controlled by the worst shard status. - /// - /// - /// One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. - /// The cluster status is controlled by the worst index status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new HealthRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterInfoResponse Info(ClusterInfoRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(ClusterInfoRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterInfoResponse Info(ClusterInfoRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterInfoResponse Info(IReadOnlyCollection target) + public virtual System.Threading.Tasks.Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClusterInfoRequestDescriptor(target); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterInfoResponse Info(IReadOnlyCollection target, Action configureRequest) + public virtual System.Threading.Tasks.Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClusterInfoRequestDescriptor(target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(ClusterInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(IReadOnlyCollection target, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest request) { - var descriptor = new ClusterInfoRequestDescriptor(target); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster info. - /// Returns basic information about the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(IReadOnlyCollection target, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats() { - var descriptor = new ClusterInfoRequestDescriptor(target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PendingTasksResponse PendingTasks(PendingTasksRequest request) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PendingTasksAsync(PendingTasksRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(nodeId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PendingTasksResponse PendingTasks(PendingTasksRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PendingTasksResponse PendingTasks() + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PendingTasksRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PendingTasksResponse PendingTasks(Action configureRequest) - { - var descriptor = new PendingTasksRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PendingTasksAsync(PendingTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PendingTasksAsync(CancellationToken cancellationToken = default) - { - var descriptor = new PendingTasksRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the pending cluster tasks. - /// Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect. - /// - /// - /// NOTE: This API returns a list of any pending updates to the cluster state. - /// These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. - /// However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PendingTasksAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PendingTasksRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostVotingConfigExclusionsResponse PostVotingConfigExclusions(PostVotingConfigExclusionsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostVotingConfigExclusionsAsync(PostVotingConfigExclusionsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostVotingConfigExclusionsResponse PostVotingConfigExclusions(PostVotingConfigExclusionsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostVotingConfigExclusionsResponse PostVotingConfigExclusions() - { - var descriptor = new PostVotingConfigExclusionsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostVotingConfigExclusionsResponse PostVotingConfigExclusions(Action configureRequest) - { - var descriptor = new PostVotingConfigExclusionsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostVotingConfigExclusionsAsync(PostVotingConfigExclusionsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostVotingConfigExclusionsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new PostVotingConfigExclusionsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Update voting configuration exclusions. - /// Update the cluster voting config exclusions by node IDs or node names. - /// By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. - /// If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. - /// The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. - /// It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes. - /// - /// - /// Clusters should have no voting configuration exclusions in normal operation. - /// Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. - /// This API waits for the nodes to be fully removed from the cluster before it returns. - /// If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster. - /// - /// - /// A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. - /// If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. - /// In that case, you may safely retry the call. - /// - /// - /// NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. - /// They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostVotingConfigExclusionsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PostVotingConfigExclusionsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(PutComponentTemplateRequest request) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(PutComponentTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(PutComponentTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(PutComponentTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutComponentTemplateResponse PutComponentTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(PutComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutComponentTemplateResponse, PutComponentTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(PutComponentTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a component template. - /// Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. - /// - /// - /// An index template can be composed of multiple component templates. - /// To use a component template, specify it in an index template’s composed_of list. - /// Component templates are only applied to new data streams and indices as part of a matching index template. - /// - /// - /// Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template. - /// - /// - /// Component templates are only used during index creation. - /// For data streams, this includes data stream creation and the creation of a stream’s backing indices. - /// Changes to component templates do not affect existing indices, including a stream’s backing indices. - /// - /// - /// You can use C-style /* *\/ block comments in component templates. - /// You can include comments anywhere in the request body except before the opening curly bracket. - /// - /// - /// Applying component templates - /// - /// - /// You cannot directly apply a component template to a data stream or index. - /// To be applied, a component template must be included in an index template's composed_of list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutComponentTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutComponentTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats(ClusterStatsRequest request) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(nodeId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(ClusterStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats(ClusterStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId) - { - var descriptor = new ClusterStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest) - { - var descriptor = new ClusterStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats() - { - var descriptor = new ClusterStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClusterStatsResponse Stats(Action configureRequest) - { - var descriptor = new ClusterStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(ClusterStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, CancellationToken cancellationToken = default) - { - var descriptor = new ClusterStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ClusterStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ClusterStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster statistics. - /// Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ClusterStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.DanglingIndices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.DanglingIndices.g.cs index f35e1605024..362b41a9e23 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.DanglingIndices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.DanglingIndices.g.cs @@ -18,186 +18,69 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.DanglingIndices; -public partial class DanglingIndicesNamespacedClient : NamespacedClientProxy +public partial class DanglingIndicesNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected DanglingIndicesNamespacedClient() : base() { } - internal DanglingIndicesNamespacedClient(ElasticsearchClient client) : base(client) + internal DanglingIndicesNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListDanglingIndicesResponse ListDanglingIndices(ListDanglingIndicesRequest request) + public virtual Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse ListDanglingIndices(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListDanglingIndicesAsync(ListDanglingIndicesRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse ListDanglingIndices() { + var builder = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListDanglingIndicesResponse ListDanglingIndices(ListDanglingIndicesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListDanglingIndicesResponse ListDanglingIndices() - { - var descriptor = new ListDanglingIndicesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListDanglingIndicesResponse ListDanglingIndices(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesResponse ListDanglingIndices(System.Action action) { - var descriptor = new ListDanglingIndicesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListDanglingIndicesAsync(ListDanglingIndicesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListDanglingIndicesAsync(Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListDanglingIndicesAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListDanglingIndicesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListDanglingIndicesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the dangling indices. - /// - /// - /// If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. - /// For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline. - /// - /// - /// Use this API to list dangling indices, which you can then import or delete. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListDanglingIndicesAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListDanglingIndicesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListDanglingIndicesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.DanglingIndices.ListDanglingIndicesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Enrich.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Enrich.g.cs index 7884181a8ee..dc9a5879cda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Enrich.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Enrich.g.cs @@ -18,741 +18,305 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -public partial class EnrichNamespacedClient : NamespacedClientProxy +public partial class EnrichNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected EnrichNamespacedClient() : base() { } - internal EnrichNamespacedClient(ElasticsearchClient client) : base(client) + internal EnrichNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePolicyResponse DeletePolicy(DeletePolicyRequest request) + public virtual Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse DeletePolicy(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePolicyAsync(DeletePolicyRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse DeletePolicy(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePolicyResponse DeletePolicy(DeletePolicyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePolicyResponse DeletePolicy(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new DeletePolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePolicyResponse DeletePolicy(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new DeletePolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePolicyAsync(DeletePolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePolicyAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new DeletePolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an enrich policy. - /// Deletes an existing enrich policy and its enrich index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePolicyAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeletePolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecutePolicyResponse ExecutePolicy(ExecutePolicyRequest request) + public virtual Elastic.Clients.Elasticsearch.Enrich.DeletePolicyResponse DeletePolicy(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecutePolicyAsync(ExecutePolicyRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeletePolicyAsync(Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecutePolicyResponse ExecutePolicy(ExecutePolicyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecutePolicyResponse ExecutePolicy(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new ExecutePolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecutePolicyResponse ExecutePolicy(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new ExecutePolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecutePolicyAsync(ExecutePolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecutePolicyAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new ExecutePolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run an enrich policy. - /// Create the enrich index for an existing enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecutePolicyAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExecutePolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy(GetPolicyRequest request) + public virtual System.Threading.Tasks.Task DeletePolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(GetPolicyRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeletePolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.DeletePolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy(GetPolicyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse ExecutePolicy(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy(Elastic.Clients.Elasticsearch.Names? name) - { - var descriptor = new GetPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) - { - var descriptor = new GetPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy() + public virtual Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse ExecutePolicy(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new GetPolicyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPolicyResponse GetPolicy(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyResponse ExecutePolicy(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new GetPolicyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(GetPolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecutePolicyAsync(Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecutePolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecutePolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.ExecutePolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse GetPolicy(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest request) { - var descriptor = new GetPolicyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an enrich policy. - /// Returns information about an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPolicyAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse GetPolicy() { - var descriptor = new GetPolicyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(PutPolicyRequest request) + public virtual Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse GetPolicy(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(PutPolicyRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse GetPolicy(Elastic.Clients.Elasticsearch.Names? name) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(PutPolicyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Enrich.GetPolicyResponse GetPolicy(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, PutPolicyResponse, PutPolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetPolicyAsync(Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutPolicyResponse, PutPolicyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetPolicyAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutPolicyResponse, PutPolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(PutPolicyRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetPolicyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetPolicyAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetPolicyAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.GetPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(PutPolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutPolicyResponse, PutPolicyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new PutPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutPolicyResponse, PutPolicyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new PutPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutPolicyResponse, PutPolicyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(PutPolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Enrich.PutPolicyResponse PutPolicy(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an enrich policy. - /// Creates an enrich policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPolicyRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrichStatsResponse Stats(EnrichStatsRequest request) + public virtual System.Threading.Tasks.Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(EnrichStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutPolicyAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Enrich.PutPolicyRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrichStatsResponse Stats(EnrichStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse Stats(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrichStatsResponse Stats() + public virtual Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse Stats() { - var descriptor = new EnrichStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrichStatsResponse Stats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Enrich.EnrichStatsResponse Stats(System.Action action) { - var descriptor = new EnrichStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(EnrichStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrichStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get enrich stats. - /// Returns enrich coordinator statistics and information about enrich policies that are currently executing. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrichStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs index 22475255bd0..6a070c7c552 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs @@ -18,740 +18,241 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -public partial class EqlNamespacedClient : NamespacedClientProxy +public partial class EqlNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected EqlNamespacedClient() : base() { } - internal EqlNamespacedClient(ElasticsearchClient client) : base(client) + internal EqlNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(EqlDeleteRequest request) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(EqlDeleteRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(EqlDeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(EqlDeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(EqlDeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlDeleteResponse, EqlDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(EqlDeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an async EQL search. - /// Delete an async EQL search or a stored synchronous EQL search. - /// The API also deletes results for the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new EqlDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlGetResponse Get(EqlGetRequest request) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlDeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, EqlGetRequestParameters>(request); + return DoRequest(request); } - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(EqlGetRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync, EqlGetRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlGetResponse Get(EqlGetRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, EqlGetResponse, EqlGetRequestParameters>(descriptor); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlGetResponse Get(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new EqlGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, EqlGetResponse, EqlGetRequestParameters>(descriptor); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlGetResponse Get(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new EqlGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EqlGetResponse, EqlGetRequestParameters>(descriptor); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(EqlGetRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, EqlGetResponse, EqlGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new EqlGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlGetResponse, EqlGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get async EQL search results. - /// Get the current status and available results for an async EQL search or a stored synchronous EQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new EqlGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlGetResponse, EqlGetRequestParameters>(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(GetEqlStatusRequest request) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetEqlStatusRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlDeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(GetEqlStatusRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlGetResponse Get(Elastic.Clients.Elasticsearch.Eql.EqlGetRequest request) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor); - } - - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetEqlStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(GetEqlStatusRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlGetResponse Get(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlGetResponse Get(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Eql.EqlGetRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetEqlStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlGetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlGetRequestParameters>(request, cancellationToken); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest request) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetEqlStatusResponse, GetEqlStatusRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetEqlStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Eql.GetEqlStatusResponse GetStatus(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async EQL status. - /// Get the current status for an async EQL search or a stored synchronous EQL search without returning results. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatusAsync(Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetEqlStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search(EqlSearchRequest request) + public virtual System.Threading.Tasks.Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, EqlSearchRequestParameters>(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(EqlSearchRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Eql.GetEqlStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync, EqlSearchRequestParameters>(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search(EqlSearchRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Search(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest request) { - descriptor.BeforeRequest(); - return DoRequest, EqlSearchResponse, EqlSearchRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Search() { - var descriptor = new EqlSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, EqlSearchResponse, EqlSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Search(System.Action> action) { - var descriptor = new EqlSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EqlSearchResponse, EqlSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search() + public virtual Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Search(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new EqlSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, EqlSearchResponse, EqlSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EqlSearchResponse Search(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Eql.EqlSearchResponse Search(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new EqlSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EqlSearchResponse, EqlSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(EqlSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Eql.EqlSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, EqlSearchResponse, EqlSearchRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EqlSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlSearchResponse, EqlSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EqlSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlSearchResponse, EqlSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EqlSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlSearchResponse, EqlSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Get EQL search results. - /// Returns search results for an Event Query Language (EQL) query. - /// EQL assumes each document in a data stream or index corresponds to an event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EqlSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EqlSearchResponse, EqlSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Eql.EqlSearchRequestParameters>(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Esql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Esql.g.cs index 3a425ae05b8..1f987a9634f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Esql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Esql.g.cs @@ -18,1108 +18,257 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -public partial class EsqlNamespacedClient : NamespacedClientProxy +public partial class EsqlNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected EsqlNamespacedClient() : base() { } - internal EsqlNamespacedClient(ElasticsearchClient client) : base(client) + internal EsqlNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery(AsyncQueryRequest request) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryResponse AsyncQuery(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(AsyncQueryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryResponse AsyncQuery(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery(AsyncQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery() - { - var descriptor = new AsyncQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery(Action> configureRequest) - { - var descriptor = new AsyncQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery(AsyncQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery() - { - var descriptor = new AsyncQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryResponse AsyncQuery(Action configureRequest) - { - var descriptor = new AsyncQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(AsyncQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryResponse, AsyncQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(AsyncQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run an async ES|QL query. - /// Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available. - /// - /// - /// The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(AsyncQueryDeleteRequest request) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryResponse AsyncQuery(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(AsyncQueryDeleteRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryAsync(Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(AsyncQueryDeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(AsyncQueryDeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(AsyncQueryDeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryDeleteResponse, AsyncQueryDeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(AsyncQueryDeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async ES|QL query. - /// If the query is still running, it is cancelled. - /// Otherwise, the stored results are deleted. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a query: - /// - /// - /// - /// - /// The authenticated user that submitted the original query request - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new AsyncQueryDeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(AsyncQueryGetRequest request) + public virtual System.Threading.Tasks.Task AsyncQueryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(AsyncQueryGetRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(AsyncQueryGetRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest request) { - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor); - } - - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor); - } - - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(AsyncQueryGetRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteResponse AsyncQueryDelete(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(AsyncQueryGetRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryDeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryDeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest request) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AsyncQueryGetResponse, AsyncQueryGetRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(AsyncQueryGetRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetResponse AsyncQueryGet(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get async ES|QL query results. - /// Get the current status and available results or stored results for an ES|QL asynchronous query. - /// If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AsyncQueryGetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query(EsqlQueryRequest request) + public virtual System.Threading.Tasks.Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(EsqlQueryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AsyncQueryGetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryGetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query(EsqlQueryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopResponse AsyncQueryStop(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest request) { - descriptor.BeforeRequest(); - return DoRequest, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query() + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopResponse AsyncQueryStop(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new EsqlQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopResponse AsyncQueryStop(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new EsqlQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query(EsqlQueryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task AsyncQueryStopAsync(Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query() + public virtual System.Threading.Tasks.Task AsyncQueryStopAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EsqlQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EsqlQueryResponse Query(Action configureRequest) + public virtual System.Threading.Tasks.Task AsyncQueryStopAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EsqlQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Esql.AsyncQueryStopRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(EsqlQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.EsqlQueryResponse Query(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.EsqlQueryResponse Query(System.Action action) { - var descriptor = new EsqlQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Esql.EsqlQueryResponse Query(System.Action> action) { - var descriptor = new EsqlQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EsqlQueryResponse, EsqlQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(EsqlQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryAsync(Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EsqlQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run an ES|QL query. - /// Get search results for an ES|QL (Elasticsearch query language) query. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EsqlQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Esql.EsqlQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Features.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Features.g.cs index 03bfacd5777..0f5397b9f9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Features.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Features.g.cs @@ -18,500 +18,115 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; -public partial class FeaturesNamespacedClient : NamespacedClientProxy +public partial class FeaturesNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected FeaturesNamespacedClient() : base() { } - internal FeaturesNamespacedClient(ElasticsearchClient client) : base(client) + internal FeaturesNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFeaturesResponse GetFeatures(GetFeaturesRequest request) + public virtual Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse GetFeatures(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFeaturesAsync(GetFeaturesRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse GetFeatures() { + var builder = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFeaturesResponse GetFeatures(GetFeaturesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFeaturesResponse GetFeatures() - { - var descriptor = new GetFeaturesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFeaturesResponse GetFeatures(Action configureRequest) - { - var descriptor = new GetFeaturesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFeaturesAsync(GetFeaturesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFeaturesAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Features.GetFeaturesResponse GetFeatures(System.Action action) { - var descriptor = new GetFeaturesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the features. - /// Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. - /// You can use this API to determine which feature states to include when taking a snapshot. - /// By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not. - /// - /// - /// A feature state includes one or more system indices necessary for a given feature to function. - /// In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together. - /// - /// - /// The features listed by this API are a combination of built-in features and features defined by plugins. - /// In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFeaturesAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFeaturesAsync(Elastic.Clients.Elasticsearch.Features.GetFeaturesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFeaturesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetFeaturesResponse ResetFeatures(ResetFeaturesRequest request) + public virtual System.Threading.Tasks.Task GetFeaturesAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetFeaturesAsync(ResetFeaturesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFeaturesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Features.GetFeaturesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetFeaturesResponse ResetFeatures(ResetFeaturesRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse ResetFeatures(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetFeaturesResponse ResetFeatures() + public virtual Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse ResetFeatures() { - var descriptor = new ResetFeaturesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetFeaturesResponse ResetFeatures(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Features.ResetFeaturesResponse ResetFeatures(System.Action action) { - var descriptor = new ResetFeaturesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetFeaturesAsync(ResetFeaturesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetFeaturesAsync(Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetFeaturesAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetFeaturesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResetFeaturesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset the features. - /// Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices. - /// - /// - /// WARNING: Intended for development and testing use only. Do not reset features on a production cluster. - /// - /// - /// Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. - /// This deletes all state information stored in system indices. - /// - /// - /// The response code is HTTP 200 if the state is successfully reset for all features. - /// It is HTTP 500 if the reset operation failed for any feature. - /// - /// - /// Note that select features might provide a way to reset particular system indices. - /// Using this API resets all features, both those that are built-in and implemented as plugins. - /// - /// - /// To list the features that will be affected, use the get features API. - /// - /// - /// IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetFeaturesAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetFeaturesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResetFeaturesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Features.ResetFeaturesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Graph.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Graph.g.cs index 39ec68a30d6..c26d670f779 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Graph.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Graph.g.cs @@ -18,357 +18,121 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; -public partial class GraphNamespacedClient : NamespacedClientProxy +public partial class GraphNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected GraphNamespacedClient() : base() { } - internal GraphNamespacedClient(ElasticsearchClient client) : base(client) + internal GraphNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(ExploreRequest request) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore(Elastic.Clients.Elasticsearch.Graph.ExploreRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(ExploreRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices) { + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(ExploreRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExploreResponse, ExploreRequestParameters>(descriptor); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new ExploreRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ExploreResponse, ExploreRequestParameters>(descriptor); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new ExploreRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExploreResponse, ExploreRequestParameters>(descriptor); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore() - { - var descriptor = new ExploreRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ExploreResponse, ExploreRequestParameters>(descriptor); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(Action> configureRequest) - { - var descriptor = new ExploreRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExploreResponse, ExploreRequestParameters>(descriptor); - } - - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(ExploreRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new ExploreRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore() { - var descriptor = new ExploreRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(ExploreRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync, ExploreResponse, ExploreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Graph.ExploreResponse Explore(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new ExploreRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ExploreResponse, ExploreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(Elastic.Clients.Elasticsearch.Graph.ExploreRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExploreRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExploreResponse, ExploreRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExploreRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ExploreResponse, ExploreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExploreRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExploreResponse, ExploreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(ExploreRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExploreRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Explore graph analytics. - /// Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. - /// The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. - /// An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. - /// Subsequent requests enable you to spider out from one more vertices of interest. - /// You can exclude vertices that have already been returned. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExploreAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ExploreRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ilm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ilm.g.cs index 0b4267d04ba..d97275e9bf7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ilm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ilm.g.cs @@ -18,2273 +18,673 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -public partial class IndexLifecycleManagementNamespacedClient : NamespacedClientProxy +public partial class IndexLifecycleManagementNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected IndexLifecycleManagementNamespacedClient() : base() { } - internal IndexLifecycleManagementNamespacedClient(ElasticsearchClient client) : base(client) + internal IndexLifecycleManagementNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(DeleteLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(DeleteLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(DeleteLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new DeleteLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new DeleteLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(DeleteLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a lifecycle policy. - /// You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(GetLifecycleRequest request) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(GetLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(GetLifecycleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse GetLifecycle() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Name? name) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse GetLifecycle(System.Action action) { - var descriptor = new GetLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Name? name) { - var descriptor = new GetLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle() + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - var descriptor = new GetLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Action configureRequest) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(GetLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get lifecycle policies. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse GetStatus(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest request) { - var descriptor = new GetLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIlmStatusResponse GetStatus(GetIlmStatusRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse GetStatus() { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetIlmStatusRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusResponse GetStatus(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIlmStatusResponse GetStatus(GetIlmStatusRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetStatusAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIlmStatusResponse GetStatus() + public virtual System.Threading.Tasks.Task GetStatusAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIlmStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIlmStatusResponse GetStatus(Action configureRequest) + public virtual System.Threading.Tasks.Task GetStatusAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIlmStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.GetIlmStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetIlmStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse MigrateToDataTiers(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse MigrateToDataTiers() { - var descriptor = new GetIlmStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the ILM status. - /// Get the current index lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersResponse MigrateToDataTiers(System.Action action) { - var descriptor = new GetIlmStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataTiersResponse MigrateToDataTiers(MigrateToDataTiersRequest request) + public virtual System.Threading.Tasks.Task MigrateToDataTiersAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataTiersAsync(MigrateToDataTiersRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task MigrateToDataTiersAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataTiersResponse MigrateToDataTiers(MigrateToDataTiersRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task MigrateToDataTiersAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateToDataTiersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataTiersResponse MigrateToDataTiers() + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest request) { - var descriptor = new MigrateToDataTiersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataTiersResponse MigrateToDataTiers(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new MigrateToDataTiersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataTiersAsync(MigrateToDataTiersRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataTiersAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep() { - var descriptor = new MigrateToDataTiersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Migrate to data tiers routing. - /// Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. - /// Optionally, delete one legacy index template. - /// Using node roles enables ILM to automatically move the indices between data tiers. - /// - /// - /// Migrating away from custom node attributes routing can be manually performed. - /// This API provides an automated way of performing three out of the four manual steps listed in the migration guide: - /// - /// - /// - /// - /// Stop setting the custom hot attribute on new indices. - /// - /// - /// - /// - /// Remove custom allocation settings from existing ILM policies. - /// - /// - /// - /// - /// Replace custom allocation settings from existing indices with the corresponding tier preference. - /// - /// - /// - /// - /// ILM must be stopped before performing the migration. - /// Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataTiersAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MigrateToDataTiersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(MoveToStepRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(MoveToStepRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(MoveToStepRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, MoveToStepResponse, MoveToStepRequestParameters>(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new MoveToStepRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, MoveToStepResponse, MoveToStepRequestParameters>(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new MoveToStepRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MoveToStepResponse, MoveToStepRequestParameters>(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep() - { - var descriptor = new MoveToStepRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, MoveToStepResponse, MoveToStepRequestParameters>(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(Action> configureRequest) - { - var descriptor = new MoveToStepRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MoveToStepResponse, MoveToStepRequestParameters>(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(MoveToStepRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new MoveToStepRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) - { - var descriptor = new MoveToStepRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(MoveToStepRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, MoveToStepResponse, MoveToStepRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, MoveToStepResponse, MoveToStepRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MoveToStepResponse, MoveToStepRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, MoveToStepResponse, MoveToStepRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MoveToStepResponse, MoveToStepRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(MoveToStepRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Move to a lifecycle step. - /// Manually move an index into a specific step in the lifecycle policy and run that step. - /// - /// - /// WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API. - /// - /// - /// You must specify both the current step and the step to be executed in the body of the request. - /// The request will fail if the current step does not match the step currently running for the index - /// This is to prevent the index from being moved from an unexpected step into the next step. - /// - /// - /// When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. - /// If only the phase is specified, the index will move to the first step of the first action in the target phase. - /// If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. - /// Only actions specified in the ILM policy are considered valid. - /// An index cannot move to a step that is not part of its policy. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MoveToStepRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(PutLifecycleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(PutLifecycleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(PutLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new PutLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new PutLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(PutLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new PutLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a lifecycle policy. - /// If the specified policy exists, it is replaced and the policy version is incremented. - /// - /// - /// NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(RemovePolicyRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(RemovePolicyRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(RemovePolicyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepResponse MoveToStep(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new RemovePolicyRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) + public virtual System.Threading.Tasks.Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy() + public virtual System.Threading.Tasks.Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(Action> configureRequest) + public virtual System.Threading.Tasks.Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(RemovePolicyRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task MoveToStepAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index) + public virtual System.Threading.Tasks.Task MoveToStepAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) + public virtual System.Threading.Tasks.Task MoveToStepAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MoveToStepRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(RemovePolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new RemovePolicyRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new RemovePolicyRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RemovePolicyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RemovePolicyResponse, RemovePolicyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(RemovePolicyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PutLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest request) { - var descriptor = new RemovePolicyRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Remove policies from an index. - /// Remove the assigned lifecycle policies from an index or a data stream's backing indices. - /// It also stops managing the indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new RemovePolicyRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(RetryRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(RetryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy() { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(RetryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, RetryResponse, RetryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyResponse RemovePolicy(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new RetryRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, RetryResponse, RetryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) + public virtual System.Threading.Tasks.Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RetryResponse, RetryRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry() + public virtual System.Threading.Tasks.Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RetryResponse, RetryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(Action> configureRequest) + public virtual System.Threading.Tasks.Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RetryResponse, RetryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(RetryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RemovePolicyAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index) + public virtual System.Threading.Tasks.Task RemovePolicyAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) + public virtual System.Threading.Tasks.Task RemovePolicyAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RemovePolicyRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(RetryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, RetryResponse, RetryRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new RetryRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, RetryResponse, RetryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { - var descriptor = new RetryRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RetryResponse, RetryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry() { - var descriptor = new RetryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RetryResponse, RetryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry(System.Action> action) { - var descriptor = new RetryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RetryResponse, RetryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(RetryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryResponse Retry(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RetryAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Retry a policy. - /// Retry running the lifecycle policy for an index that is in the ERROR step. - /// The API sets the policy back to the step where the error occurred and runs the step. - /// Use the explain lifecycle state API to determine whether an index is in the ERROR step. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RetryRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartIlmResponse Start(StartIlmRequest request) + public virtual System.Threading.Tasks.Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(StartIlmRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RetryAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartIlmResponse Start(StartIlmRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RetryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartIlmResponse Start() + public virtual System.Threading.Tasks.Task RetryAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartIlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RetryRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartIlmResponse Start(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse Start(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest request) { - var descriptor = new StartIlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(StartIlmRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse Start() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmResponse Start(System.Action action) { - var descriptor = new StartIlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start the ILM plugin. - /// Start the index lifecycle management plugin if it is currently stopped. - /// ILM is started automatically when the cluster is formed. - /// Restarting ILM is necessary only when it has been stopped using the stop ILM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartIlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopIlmResponse Stop(StopIlmRequest request) + public virtual System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(StopIlmRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StartIlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopIlmResponse Stop(StopIlmRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse Stop(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopIlmResponse Stop() + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse Stop() { - var descriptor = new StopIlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopIlmResponse Stop(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmResponse Stop(System.Action action) { - var descriptor = new StopIlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(StopIlmRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopIlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop the ILM plugin. - /// Halt all lifecycle management operations and stop the index lifecycle management plugin. - /// This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices. - /// - /// - /// The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. - /// Use the get ILM status API to check whether ILM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopIlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StopIlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs index 7eee58bcd92..b174b4c30dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs @@ -18,27640 +18,5565 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public partial class IndicesNamespacedClient : NamespacedClientProxy +public partial class IndicesNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected IndicesNamespacedClient() : base() { } - internal IndicesNamespacedClient(ElasticsearchClient client) : base(client) + internal IndicesNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(AnalyzeIndexRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(AnalyzeIndexRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze() { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(AnalyzeIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(System.Action> action) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(AnalyzeIndexRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index) + public virtual System.Threading.Tasks.Task AnalyzeAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest) + public virtual System.Threading.Tasks.Task AnalyzeAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze() + public virtual System.Threading.Tasks.Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AnalyzeIndexResponse Analyze(Action configureRequest) + public virtual System.Threading.Tasks.Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(AnalyzeIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AnalyzeAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest request) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, AnalyzeIndexResponse, AnalyzeIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(AnalyzeIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex(System.Action> action) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexResponse CancelMigrateReindex(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new AnalyzeIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get tokens from text analysis. - /// The analyze API performs analysis on a text string and returns the resulting tokens. - /// - /// - /// Generating excessive amount of tokens may cause a node to run out of memory. - /// The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. - /// If more than this limit of tokens gets generated, an error occurs. - /// The _analyze endpoint without a specified index will always use 10000 as its limit. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AnalyzeAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AnalyzeIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequest request) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task CancelMigrateReindexAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CancelMigrateReindexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest request) { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache() { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(System.Action action) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(System.Action> action) { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Action configureRequest) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest request) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, System.Action action) { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear the cache of one or more indices. - /// For data streams, the API clears the caches of the stream's backing indices. - /// - /// - /// By default, the clear cache API clears all caches. - /// To clear only specific caches, use the fielddata, query, or request parameters. - /// To clear the cache only of specific fields, use the fields parameter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, System.Action> action) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(CloneIndexRequest request) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(CloneIndexRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(CloneIndexRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, CloneIndexResponse, CloneIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CloneIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest, CloneIndexResponse, CloneIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloneIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, Action> configureRequest) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CloneIndexResponse, CloneIndexRequestParameters>(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.Name target) - { - var descriptor = new CloneIndexRequestDescriptor(target); - descriptor.BeforeRequest(); - return DoRequest, CloneIndexResponse, CloneIndexRequestParameters>(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.Name target, Action> configureRequest) - { - var descriptor = new CloneIndexRequestDescriptor(target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CloneIndexResponse, CloneIndexRequestParameters>(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(CloneIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneIndexResponse Clone(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, Action configureRequest) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(CloneIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, CloneIndexResponse, CloneIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync, CloneIndexResponse, CloneIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CloneIndexResponse, CloneIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.Name target, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(target); - descriptor.BeforeRequest(); - return DoRequestAsync, CloneIndexResponse, CloneIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.Name target, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CloneIndexResponse, CloneIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(CloneIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clone an index. - /// Clone an existing index into a new index. - /// Each original primary shard is cloned into a new primary shard in the new index. - /// - /// - /// IMPORTANT: Elasticsearch does not apply index templates to the resulting index. - /// The API also does not copy index metadata from the original index. - /// Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. - /// For example, if you clone a CCR follower index, the resulting clone will not be a follower index. - /// - /// - /// The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. - /// To set the number of replicas in the resulting index, configure these settings in the clone request. - /// - /// - /// Cloning works as follows: - /// - /// - /// - /// - /// First, it creates a new target index with the same definition as the source index. - /// - /// - /// - /// - /// Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Finally, it recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be cloned if they meet the following requirements: - /// - /// - /// - /// - /// The index must be marked as read-only and have a cluster health status of green. - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have the same number of primary shards as the target index. - /// - /// - /// - /// - /// The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// - /// The current write index on a data stream cannot be cloned. - /// In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned. - /// - /// - /// NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index. - /// - /// - /// Monitor the cloning process - /// - /// - /// The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow. - /// - /// - /// The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. - /// At this point, all shards are in the state unassigned. - /// If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node. - /// - /// - /// Once the primary shard is allocated, it moves to state initializing, and the clone process begins. - /// When the clone operation completes, the shard will become active. - /// At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node. - /// - /// - /// Wait for active shards - /// - /// - /// Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Name target, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloneIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(CloseIndexRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(CloseIndexRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(CloseIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, CloseIndexResponse, CloseIndexRequestParameters>(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, CloseIndexResponse, CloseIndexRequestParameters>(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CloseIndexResponse, CloseIndexRequestParameters>(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close() - { - var descriptor = new CloseIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, CloseIndexResponse, CloseIndexRequestParameters>(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(Action> configureRequest) - { - var descriptor = new CloseIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CloseIndexResponse, CloseIndexRequestParameters>(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(CloseIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(CloseIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, CloseIndexResponse, CloseIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, CloseIndexResponse, CloseIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CloseIndexResponse, CloseIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, CloseIndexResponse, CloseIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CloseIndexResponse, CloseIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(CloseIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close an index. - /// A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behaviour can be turned off using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CloseIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(CreateIndexRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateIndexRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(CreateIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, CreateIndexResponse, CreateIndexRequestParameters>(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new CreateIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, CreateIndexResponse, CreateIndexRequestParameters>(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new CreateIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateIndexResponse, CreateIndexRequestParameters>(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create() - { - var descriptor = new CreateIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, CreateIndexResponse, CreateIndexRequestParameters>(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(Action> configureRequest) - { - var descriptor = new CreateIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateIndexResponse, CreateIndexRequestParameters>(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(CreateIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new CreateIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) - { - var descriptor = new CreateIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, CreateIndexResponse, CreateIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateIndexResponse, CreateIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateIndexResponse, CreateIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateIndexResponse, CreateIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateIndexResponse, CreateIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create an index. - /// You can use the create index API to add a new index to an Elasticsearch cluster. - /// When creating an index, you can specify the following: - /// - /// - /// - /// - /// Settings for the index. - /// - /// - /// - /// - /// Mappings for fields in the index. - /// - /// - /// - /// - /// Index aliases - /// - /// - /// - /// - /// Wait for active shards - /// - /// - /// By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. - /// The index creation response will indicate what happened. - /// For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. - /// Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. - /// These values simply indicate whether the operation completed before the timeout. - /// If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. - /// If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true). - /// - /// - /// You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. - /// Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateIndexRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateDataStreamResponse CreateDataStream(CreateDataStreamRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateDataStreamAsync(CreateDataStreamRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateDataStreamResponse CreateDataStream(CreateDataStreamRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateDataStreamResponse CreateDataStream(Elastic.Clients.Elasticsearch.DataStreamName name) - { - var descriptor = new CreateDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateDataStreamResponse CreateDataStream(Elastic.Clients.Elasticsearch.DataStreamName name, Action configureRequest) - { - var descriptor = new CreateDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateDataStreamAsync(CreateDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamName name, CancellationToken cancellationToken = default) - { - var descriptor = new CreateDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a data stream. - /// Creates a data stream. - /// You must have a matching index template with data stream enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamName name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats(DataStreamsStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(DataStreamsStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats(DataStreamsStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexName? name) - { - var descriptor = new DataStreamsStatsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexName? name, Action configureRequest) - { - var descriptor = new DataStreamsStatsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats() - { - var descriptor = new DataStreamsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DataStreamsStatsResponse DataStreamsStats(Action configureRequest) - { - var descriptor = new DataStreamsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(DataStreamsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexName? name, CancellationToken cancellationToken = default) - { - var descriptor = new DataStreamsStatsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexName? name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DataStreamsStatsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new DataStreamsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data stream stats. - /// Retrieves statistics for one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DataStreamsStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DataStreamsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(DeleteIndexRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteIndexRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(DeleteIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete() - { - var descriptor = new DeleteIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(Action> configureRequest) - { - var descriptor = new DeleteIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(DeleteIndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIndexResponse, DeleteIndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete indices. - /// Deleting an index deletes its documents, shards, and metadata. - /// It does not delete related Kibana components, such as data views, visualizations, or dashboards. - /// - /// - /// You cannot delete the current write index of a data stream. - /// To delete the index, you must roll over the data stream so a new write index is created. - /// You can then use the delete index API to delete the previous write index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(DeleteAliasRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(DeleteAliasRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(DeleteAliasRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, Action> configureRequest) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new DeleteAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Names name, Action> configureRequest) - { - var descriptor = new DeleteAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(DeleteAliasRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(DeleteAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Names name, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAliasResponse, DeleteAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(DeleteAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an alias. - /// Removes a data stream or index from an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataLifecycleResponse DeleteDataLifecycle(DeleteDataLifecycleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataLifecycleAsync(DeleteDataLifecycleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataLifecycleResponse DeleteDataLifecycle(DeleteDataLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataLifecycleResponse DeleteDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) - { - var descriptor = new DeleteDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataLifecycleResponse DeleteDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest) - { - var descriptor = new DeleteDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataLifecycleAsync(DeleteDataLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data stream lifecycles. - /// Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataStreamResponse DeleteDataStream(DeleteDataStreamRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataStreamAsync(DeleteDataStreamRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataStreamResponse DeleteDataStream(DeleteDataStreamRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataStreamResponse DeleteDataStream(Elastic.Clients.Elasticsearch.DataStreamNames name) - { - var descriptor = new DeleteDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataStreamResponse DeleteDataStream(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest) - { - var descriptor = new DeleteDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataStreamAsync(DeleteDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete data streams. - /// Deletes one or more data streams and their backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexTemplateResponse DeleteIndexTemplate(DeleteIndexTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIndexTemplateAsync(DeleteIndexTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexTemplateResponse DeleteIndexTemplate(DeleteIndexTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexTemplateResponse DeleteIndexTemplate(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new DeleteIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIndexTemplateResponse DeleteIndexTemplate(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new DeleteIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIndexTemplateAsync(DeleteIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIndexTemplateAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an index template. - /// The provided <index-template> may contain multiple template names separated by a comma. If multiple template - /// names are specified then there is no wildcard support and the provided names should match completely with - /// existing templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIndexTemplateAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTemplateResponse DeleteTemplate(DeleteTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTemplateAsync(DeleteTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTemplateResponse DeleteTemplate(DeleteTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTemplateResponse DeleteTemplate(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new DeleteTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTemplateResponse DeleteTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new DeleteTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTemplateAsync(DeleteTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a legacy index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(DiskUsageRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(DiskUsageRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(DiskUsageRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DiskUsageResponse, DiskUsageRequestParameters>(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, DiskUsageResponse, DiskUsageRequestParameters>(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DiskUsageResponse, DiskUsageRequestParameters>(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage() - { - var descriptor = new DiskUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, DiskUsageResponse, DiskUsageRequestParameters>(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(Action> configureRequest) - { - var descriptor = new DiskUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DiskUsageResponse, DiskUsageRequestParameters>(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(DiskUsageRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(DiskUsageRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DiskUsageResponse, DiskUsageRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, DiskUsageResponse, DiskUsageRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DiskUsageResponse, DiskUsageRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, DiskUsageResponse, DiskUsageRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DiskUsageResponse, DiskUsageRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(DiskUsageRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Analyze the index disk usage. - /// Analyze the disk usage of each field of an index or data stream. - /// This API might not support indices created in previous Elasticsearch versions. - /// The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API. - /// - /// - /// NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. - /// Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. - /// The stored size of the _id field is likely underestimated while the _source field is overestimated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DiskUsageRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(DownsampleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(DownsampleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(DownsampleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DownsampleResponse, DownsampleRequestParameters>(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - descriptor.BeforeRequest(); - return DoRequest, DownsampleResponse, DownsampleRequestParameters>(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, Action> configureRequest) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DownsampleResponse, DownsampleRequestParameters>(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(DownsampleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, Action configureRequest) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(DownsampleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DownsampleResponse, DownsampleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, CancellationToken cancellationToken = default) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - descriptor.BeforeRequest(); - return DoRequestAsync, DownsampleResponse, DownsampleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DownsampleResponse, DownsampleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(DownsampleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, CancellationToken cancellationToken = default) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Downsample an index. - /// Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. - /// For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. - /// All documents within an hour interval are summarized and stored as a single document in the downsample index. - /// - /// - /// NOTE: Only indices in a time series data stream are supported. - /// Neither field nor document level security can be defined on the source index. - /// The source index must be read only (index.blocks.write: true). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DownsampleRequestDescriptor(config, index, targetIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new ExistsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists() - { - var descriptor = new ExistsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new ExistsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new ExistsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check indices. - /// Check if one or more indices, index aliases, or data streams exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(ExistsAliasRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(ExistsAliasRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(ExistsAliasRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, Action> configureRequest) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name, Action> configureRequest) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(ExistsAliasRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(ExistsAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsAliasResponse, ExistsAliasRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(ExistsAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check aliases. - /// Checks if one or more data stream or index aliases exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsIndexTemplateResponse ExistsIndexTemplate(ExistsIndexTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsIndexTemplateAsync(ExistsIndexTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsIndexTemplateResponse ExistsIndexTemplate(ExistsIndexTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsIndexTemplateResponse ExistsIndexTemplate(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new ExistsIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsIndexTemplateResponse ExistsIndexTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new ExistsIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsIndexTemplateAsync(ExistsIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check index templates. - /// Check whether index templates exist. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsTemplateResponse ExistsTemplate(ExistsTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsTemplateAsync(ExistsTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsTemplateResponse ExistsTemplate(ExistsTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsTemplateResponse ExistsTemplate(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new ExistsTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsTemplateResponse ExistsTemplate(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new ExistsTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsTemplateAsync(ExistsTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsTemplateAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check existence of index templates. - /// Get information about whether index templates exist. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsTemplateAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(ExplainDataLifecycleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(ExplainDataLifecycleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(ExplainDataLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle() - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(Action> configureRequest) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(ExplainDataLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(ExplainDataLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataLifecycleResponse, ExplainDataLifecycleRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(ExplainDataLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the status for a data stream lifecycle. - /// Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataLifecycleRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(FieldUsageStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(FieldUsageStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(FieldUsageStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats() - { - var descriptor = new FieldUsageStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(Action> configureRequest) - { - var descriptor = new FieldUsageStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(FieldUsageStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(FieldUsageStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldUsageStatsResponse, FieldUsageStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(FieldUsageStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get field usage stats. - /// Get field usage information for each shard and field of an index. - /// Field usage statistics are automatically captured when queries are running on a cluster. - /// A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use. - /// - /// - /// The response body reports the per-shard usage count of the data structures that back the fields in the index. - /// A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldUsageStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(FlushRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(FlushRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(FlushRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, FlushResponse, FlushRequestParameters>(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new FlushRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, FlushResponse, FlushRequestParameters>(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new FlushRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FlushResponse, FlushRequestParameters>(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush() - { - var descriptor = new FlushRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FlushResponse, FlushRequestParameters>(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Action> configureRequest) - { - var descriptor = new FlushRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FlushResponse, FlushRequestParameters>(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(FlushRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new FlushRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new FlushRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush() - { - var descriptor = new FlushRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushResponse Flush(Action configureRequest) - { - var descriptor = new FlushRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(FlushRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, FlushResponse, FlushRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, FlushResponse, FlushRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FlushResponse, FlushRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FlushResponse, FlushRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FlushResponse, FlushRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(FlushRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Flush data streams or indices. - /// Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. - /// When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. - /// Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush. - /// - /// - /// After each operation has been flushed it is permanently stored in the Lucene index. - /// This may mean that there is no need to maintain an additional copy of it in the transaction log. - /// The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space. - /// - /// - /// It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. - /// If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FlushRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(ForcemergeRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(ForcemergeRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(ForcemergeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ForcemergeResponse, ForcemergeRequestParameters>(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ForcemergeResponse, ForcemergeRequestParameters>(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ForcemergeResponse, ForcemergeRequestParameters>(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge() - { - var descriptor = new ForcemergeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ForcemergeResponse, ForcemergeRequestParameters>(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Action> configureRequest) - { - var descriptor = new ForcemergeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ForcemergeResponse, ForcemergeRequestParameters>(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(ForcemergeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge() - { - var descriptor = new ForcemergeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForcemergeResponse Forcemerge(Action configureRequest) - { - var descriptor = new ForcemergeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(ForcemergeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ForcemergeResponse, ForcemergeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ForcemergeResponse, ForcemergeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ForcemergeResponse, ForcemergeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ForcemergeResponse, ForcemergeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ForcemergeResponse, ForcemergeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(ForcemergeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force a merge. - /// Perform the force merge operation on the shards of one or more indices. - /// For data streams, the API forces a merge on the shards of the stream's backing indices. - /// - /// - /// Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. - /// Merging normally happens automatically, but sometimes it is useful to trigger a merge manually. - /// - /// - /// WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). - /// When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". - /// These soft-deleted documents are automatically cleaned up during regular segment merges. - /// But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. - /// So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. - /// If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally. - /// - /// - /// Blocks during a force merge - /// - /// - /// Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). - /// If the client connection is lost before completion then the force merge process will continue in the background. - /// Any new requests to force merge the same indices will also block until the ongoing force merge is complete. - /// - /// - /// Running force merge asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. - /// However, you can not cancel this task as the force merge task is not cancelable. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. - /// - /// - /// Force merging multiple indices - /// - /// - /// You can force merge multiple indices with a single request by targeting: - /// - /// - /// - /// - /// One or more data streams that contain multiple backing indices - /// - /// - /// - /// - /// Multiple indices - /// - /// - /// - /// - /// One or more aliases - /// - /// - /// - /// - /// All data streams and indices in a cluster - /// - /// - /// - /// - /// Each targeted shard is force-merged separately using the force_merge threadpool. - /// By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. - /// If you expand the force_merge threadpool on a node then it will force merge its shards in parallel - /// - /// - /// Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one. - /// - /// - /// Data streams and time-based indices - /// - /// - /// Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. - /// In these cases, each index only receives indexing traffic for a certain period of time. - /// Once an index receive no more writes, its shards can be force-merged to a single segment. - /// This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. - /// For example: - /// - /// - /// POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1 - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForcemergeAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForcemergeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(GetIndexRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetIndexRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(GetIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, GetIndexResponse, GetIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close() { - var descriptor = new GetIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, GetIndexResponse, GetIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close(System.Action> action) { - var descriptor = new GetIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIndexResponse, GetIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResponse Close(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new GetIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetIndexResponse, GetIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(Action> configureRequest) + public virtual System.Threading.Tasks.Task CloseAsync(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIndexResponse, GetIndexRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(GetIndexRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices) + public virtual System.Threading.Tasks.Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual System.Threading.Tasks.Task CloseAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CloseAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndexResponse, GetIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CloseAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndexResponse, GetIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest request) { - var descriptor = new GetIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndexResponse, GetIndexRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index) { - var descriptor = new GetIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndexResponse, GetIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) { - var descriptor = new GetIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndexResponse, GetIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create(System.Action> action) { - var descriptor = new GetIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index information. - /// Get information about one or more indices. For data streams, the API returns information about the - /// stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexResponse Create(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) { - var descriptor = new GetIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(GetAliasRequest request) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(GetAliasRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(GetAliasRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, GetAliasResponse, GetAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + public virtual System.Threading.Tasks.Task CreateAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest, GetAliasResponse, GetAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action> configureRequest) + public virtual System.Threading.Tasks.Task CreateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetAliasResponse, GetAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias() + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetAliasResponse, GetAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse CreateDataStream(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest request) { - var descriptor = new GetAliasRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetAliasResponse, GetAliasRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(GetAliasRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse CreateDataStream(Elastic.Clients.Elasticsearch.DataStreamName name) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamResponse CreateDataStream(Elastic.Clients.Elasticsearch.DataStreamName name, System.Action action) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + public virtual System.Threading.Tasks.Task CreateDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias() + public virtual System.Threading.Tasks.Task CreateDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamName name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAliasResponse GetAlias(Action configureRequest) + public virtual System.Threading.Tasks.Task CreateDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamName name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(GetAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse CreateFrom(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse CreateFrom(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse CreateFrom(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, System.Action action) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.CreateFromResponse CreateFrom(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, System.Action> action) { - var descriptor = new GetAliasRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateFromAsync(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(GetAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateFromAsync(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateFromAsync(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateFromAsync(Elastic.Clients.Elasticsearch.IndexName source, Elastic.Clients.Elasticsearch.IndexName dest, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromRequestDescriptor(source, dest); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest request) { - var descriptor = new GetAliasRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get aliases. - /// Retrieves information for one or more data stream or index aliases. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAliasAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats() { - var descriptor = new GetAliasRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleResponse GetDataLifecycle(GetDataLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleAsync(GetDataLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexName? name) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleResponse GetDataLifecycle(GetDataLifecycleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexName? name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleResponse GetDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(System.Action> action) { - var descriptor = new GetDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleResponse GetDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsResponse DataStreamsStats(Elastic.Clients.Elasticsearch.IndexName? name, System.Action> action) { - var descriptor = new GetDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleAsync(GetDataLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycles. - /// Retrieves the data stream lifecycle configuration of one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleStatsResponse GetDataLifecycleStats(GetDataLifecycleStatsRequest request) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexName? name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleStatsAsync(GetDataLifecycleStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexName? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleStatsResponse GetDataLifecycleStats(GetDataLifecycleStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleStatsResponse GetDataLifecycleStats() + public virtual System.Threading.Tasks.Task DataStreamsStatsAsync(Elastic.Clients.Elasticsearch.IndexName? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataLifecycleStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataLifecycleStatsResponse GetDataLifecycleStats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest request) { - var descriptor = new GetDataLifecycleStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleStatsAsync(GetDataLifecycleStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleStatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new GetDataLifecycleStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data stream lifecycle stats. - /// Get statistics about the data streams that are managed by a data stream lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataLifecycleStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete() { - var descriptor = new GetDataLifecycleStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream(GetDataStreamRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(GetDataStreamRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexResponse Delete(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream(GetDataStreamRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream(Elastic.Clients.Elasticsearch.DataStreamNames? name) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream(Elastic.Clients.Elasticsearch.DataStreamNames? name, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream() + public virtual System.Threading.Tasks.Task DeleteAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataStreamRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataStreamResponse GetDataStream(Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataStreamRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(GetDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new GetDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new GetDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasResponse DeleteAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, System.Action> action) { - var descriptor = new GetDataStreamRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get data streams. - /// Retrieves information about one or more data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataStreamAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetDataStreamRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(GetFieldMappingRequest request) + public virtual System.Threading.Tasks.Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(GetFieldMappingRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(GetFieldMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Names name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse DeleteDataLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest request) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - descriptor.BeforeRequest(); - return DoRequest, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse DeleteDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleResponse DeleteDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - descriptor.BeforeRequest(); - return DoRequest, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields, Action> configureRequest) + public virtual System.Threading.Tasks.Task DeleteDataLifecycleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(GetFieldMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) + public virtual System.Threading.Tasks.Task DeleteDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse DeleteDataStream(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest request) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse DeleteDataStream(Elastic.Clients.Elasticsearch.DataStreamNames name) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamResponse DeleteDataStream(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(GetFieldMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - descriptor.BeforeRequest(); - return DoRequestAsync, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse DeleteIndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest request) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - descriptor.BeforeRequest(); - return DoRequestAsync, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse DeleteIndexTemplate(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetFieldMappingResponse, GetFieldMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(GetFieldMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateResponse DeleteIndexTemplate(Elastic.Clients.Elasticsearch.Names name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIndexTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIndexTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(indices, fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIndexTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// Retrieves mapping definitions for one or more fields. - /// For data streams, the API retrieves field mappings for the stream’s backing indices. - /// - /// - /// This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse DeleteTemplate(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest request) { - var descriptor = new GetFieldMappingRequestDescriptor(fields); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate(GetIndexTemplateRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse DeleteTemplate(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(GetIndexTemplateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateResponse DeleteTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate(GetIndexTemplateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate(Elastic.Clients.Elasticsearch.Name? name) + public virtual System.Threading.Tasks.Task DeleteTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DeleteTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest request) { - var descriptor = new GetIndexTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndexTemplateResponse GetIndexTemplate(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new GetIndexTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(GetIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage() { - var descriptor = new GetIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage(System.Action> action) { - var descriptor = new GetIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageResponse DiskUsage(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new GetIndexTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIndexTemplateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DiskUsageAsync(Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndexTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(GetMappingRequest request) + public virtual System.Threading.Tasks.Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(GetMappingRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(GetMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DiskUsageAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, GetMappingResponse, GetMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task DiskUsageAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DiskUsageAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, GetMappingResponse, GetMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DiskUsageRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest request) { - var descriptor = new GetMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetMappingResponse, GetMappingRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex) { - var descriptor = new GetMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetMappingResponse, GetMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, System.Action action) { - var descriptor = new GetMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetMappingResponse, GetMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(GetMappingRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.DownsampleResponse Downsample(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping() + public virtual System.Threading.Tasks.Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMappingResponse GetMapping(Action configureRequest) + public virtual System.Threading.Tasks.Task DownsampleAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName targetIndex, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleRequestDescriptor(index, targetIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(GetMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetMappingResponse, GetMappingRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new GetMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, GetMappingResponse, GetMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new GetMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetMappingResponse, GetMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists() { - var descriptor = new GetMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetMappingResponse, GetMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists(System.Action> action) { - var descriptor = new GetMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetMappingResponse, GetMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(GetMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsResponse Exists(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get mapping definitions. - /// For data streams, the API retrieves mappings for the stream’s backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMappingAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(GetIndicesSettingsRequest request) + public virtual System.Threading.Tasks.Task ExistsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetIndicesSettingsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(GetIndicesSettingsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest request) { - descriptor.BeforeRequest(); - return DoRequest, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(GetIndicesSettingsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Names name, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasResponse ExistsAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, System.Action> action) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings() + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIndicesSettingsResponse GetSettings(Action configureRequest) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetIndicesSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Names name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse ExistsIndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest request) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIndicesSettingsResponse, GetIndicesSettingsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetIndicesSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse ExistsIndexTemplate(Elastic.Clients.Elasticsearch.Name name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateResponse ExistsIndexTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsIndexTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index settings. - /// Get setting information for one or more indices. - /// For data streams, it returns setting information for the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExistsIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetIndicesSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate(GetTemplateRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse ExistsTemplate(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(GetTemplateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse ExistsTemplate(Elastic.Clients.Elasticsearch.Names name) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate(GetTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateResponse ExistsTemplate(Elastic.Clients.Elasticsearch.Names name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate(Elastic.Clients.Elasticsearch.Names? name) + public virtual System.Threading.Tasks.Task ExistsTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + public virtual System.Threading.Tasks.Task ExistsTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate() + public virtual System.Threading.Tasks.Task ExistsTemplateAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExistsTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTemplateResponse GetTemplate(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest request) { - var descriptor = new GetTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(GetTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new GetTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle() { - var descriptor = new GetTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle(System.Action> action) { - var descriptor = new GetTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index templates. - /// Get information about one or more index templates. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTemplateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleResponse ExplainDataLifecycle(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new GetTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataStreamResponse MigrateToDataStream(MigrateToDataStreamRequest request) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataStreamAsync(MigrateToDataStreamRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataStreamResponse MigrateToDataStream(MigrateToDataStreamRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexName name) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MigrateToDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexName name, Action configureRequest) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MigrateToDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataStreamAsync(MigrateToDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataLifecycleAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ExplainDataLifecycleRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest request) { - var descriptor = new MigrateToDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Convert an index alias to a data stream. - /// Converts an index alias to a data stream. - /// You must have a matching index template that is data stream enabled. - /// The alias must meet the following criteria: - /// The alias must have a write index; - /// All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; - /// The alias must not have any filters; - /// The alias must not use custom routing. - /// If successful, the request removes the alias and creates a data stream with the same name. - /// The indices for the alias become hidden backing indices for the stream. - /// The write index for the alias becomes the write index for the stream. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new MigrateToDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ModifyDataStreamResponse ModifyDataStream(ModifyDataStreamRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ModifyDataStreamAsync(ModifyDataStreamRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats() { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ModifyDataStreamResponse ModifyDataStream(ModifyDataStreamRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ModifyDataStreamResponse ModifyDataStream() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsResponse FieldUsageStats(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new ModifyDataStreamRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ModifyDataStreamResponse ModifyDataStream(Action configureRequest) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ModifyDataStreamRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ModifyDataStreamAsync(ModifyDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ModifyDataStreamAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ModifyDataStreamRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update data streams. - /// Performs one or more data stream modification actions in a single atomic operation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ModifyDataStreamAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ModifyDataStreamRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(OpenIndexRequest request) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(OpenIndexRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FieldUsageStatsAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FieldUsageStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(OpenIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest request) { - descriptor.BeforeRequest(); - return DoRequest, OpenIndexResponse, OpenIndexRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush() { - var descriptor = new OpenIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, OpenIndexResponse, OpenIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(System.Action action) { - var descriptor = new OpenIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, OpenIndexResponse, OpenIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new OpenIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, OpenIndexResponse, OpenIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new OpenIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, OpenIndexResponse, OpenIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(OpenIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.FlushResponse Flush(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task FlushAsync(Elastic.Clients.Elasticsearch.IndexManagement.FlushRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(OpenIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, OpenIndexResponse, OpenIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenIndexResponse, OpenIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenIndexResponse, OpenIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenIndexResponse, OpenIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenIndexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenIndexResponse, OpenIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FlushRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(OpenIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge() { - var descriptor = new OpenIndexRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open a closed index. - /// For data streams, the API opens any closed backing indices. - /// - /// - /// A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. - /// It is not possible to index documents or to search for documents in a closed index. - /// This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster. - /// - /// - /// When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. - /// The shards will then go through the normal recovery process. - /// The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times. - /// - /// - /// You can open and close multiple indices. - /// An error is thrown if the request explicitly refers to a missing index. - /// This behavior can be turned off by using the ignore_unavailable=true parameter. - /// - /// - /// By default, you must explicitly name the indices you are opening or closing. - /// To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. - /// This setting can also be changed with the cluster update settings API. - /// - /// - /// Closed indices consume a significant amount of disk-space which can cause problems in managed environments. - /// Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false. - /// - /// - /// Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(System.Action action) { - var descriptor = new OpenIndexRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PromoteDataStreamResponse PromoteDataStream(PromoteDataStreamRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PromoteDataStreamAsync(PromoteDataStreamRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PromoteDataStreamResponse PromoteDataStream(PromoteDataStreamRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexName name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeResponse Forcemerge(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new PromoteDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexName name, Action configureRequest) + public virtual System.Threading.Tasks.Task ForcemergeAsync(Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PromoteDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PromoteDataStreamAsync(PromoteDataStreamRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ForcemergeAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ForcemergeAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PromoteDataStreamRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Promote a data stream. - /// Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream. - /// - /// - /// With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. - /// These data streams can't be rolled over in the local cluster. - /// These replicated data streams roll over only if the upstream data stream rolls over. - /// In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster. - /// - /// - /// NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. - /// If this is missing, the data stream will not be able to roll over until a matching index template is created. - /// This will affect the lifecycle management of the data stream and interfere with the data stream size and retention. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PromoteDataStreamRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(PutAliasRequest request) + public virtual System.Threading.Tasks.Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(PutAliasRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ForcemergeAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(PutAliasRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ForcemergeAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutAliasResponse, PutAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ForcemergeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest request) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest, PutAliasResponse, PutAliasRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get() { - var descriptor = new PutAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutAliasResponse, PutAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get(System.Action> action) { - var descriptor = new PutAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutAliasResponse, PutAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexResponse Get(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new PutAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutAliasResponse, PutAliasRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(PutAliasRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(PutAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutAliasResponse, PutAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutAliasResponse, PutAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutAliasResponse, PutAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest request) { - var descriptor = new PutAliasRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutAliasResponse, PutAliasRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias() { - var descriptor = new PutAliasRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutAliasResponse, PutAliasRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(PutAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Names? name) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - var descriptor = new PutAliasRequestDescriptor(indices, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataLifecycleResponse PutDataLifecycle(PutDataLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataLifecycleAsync(PutDataLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataLifecycleResponse PutDataLifecycle(PutDataLifecycleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataLifecycleResponse PutDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new PutDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataLifecycleResponse PutDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(System.Action> action) { - var descriptor = new PutDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataLifecycleAsync(PutDataLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Names? name, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action> action) { - var descriptor = new PutDataLifecycleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update data stream lifecycles. - /// Update the data stream lifecycle of the specified data streams. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetAliasResponse GetAlias(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new PutDataLifecycleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(PutIndexTemplateRequest request) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(PutIndexTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAliasAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(PutIndexTemplateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetAliasAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(PutIndexTemplateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(PutIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAliasAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndexTemplateResponse, PutIndexTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(PutIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAliasAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetAliasRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse GetDataLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest request) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// - /// - /// Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. - /// Index templates are applied during data stream or index creation. - /// For data streams, these settings and mappings are applied when the stream's backing indices are created. - /// Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. - /// Changes to index templates do not affect existing indices, including the existing backing indices of a data stream. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Multiple matching templates - /// - /// - /// If multiple index templates match the name of a new index or data stream, the template with the highest priority is used. - /// - /// - /// Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities. - /// - /// - /// Composing aliases, mappings, and settings - /// - /// - /// When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. - /// Any mappings, settings, or aliases from the parent index template are merged in next. - /// Finally, any configuration on the index request itself is merged. - /// Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. - /// If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. - /// This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. - /// If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. - /// If an entry already exists with the same key, then it is overwritten by the new definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse GetDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) { - var descriptor = new PutIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(PutMappingRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleResponse GetDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(PutMappingRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataLifecycleAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(PutMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutMappingResponse, PutMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices) + public virtual System.Threading.Tasks.Task GetDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, PutMappingResponse, PutMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse GetDataLifecycleStats(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest request) { - var descriptor = new PutMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutMappingResponse, PutMappingRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse GetDataLifecycleStats() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsResponse GetDataLifecycleStats(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetDataLifecycleStatsAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, PutMappingResponse, PutMappingRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(Action> configureRequest) + public virtual System.Threading.Tasks.Task GetDataLifecycleStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutMappingResponse, PutMappingRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(PutMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetDataLifecycleStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataLifecycleStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse GetDataStream(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest request) { - var descriptor = new PutMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse GetDataStream() { - var descriptor = new PutMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(PutMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse GetDataStream(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutMappingResponse, PutMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse GetDataStream(Elastic.Clients.Elasticsearch.DataStreamNames? name) { - var descriptor = new PutMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, PutMappingResponse, PutMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamResponse GetDataStream(Elastic.Clients.Elasticsearch.DataStreamNames? name, System.Action action) { - var descriptor = new PutMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutMappingResponse, PutMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, PutMappingResponse, PutMappingRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataStreamAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutMappingResponse, PutMappingRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(PutMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataStreamAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update field mappings. - /// Add new fields to an existing data stream or index. - /// You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - /// For data streams, these changes are applied to all backing indices by default. - /// - /// - /// Add multi-fields to an existing field - /// - /// - /// Multi-fields let you index the same field in different ways. - /// You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - /// WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - /// You can populate the new multi-field with the update by query API. - /// - /// - /// Change supported mapping parameters for an existing field - /// - /// - /// The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - /// For example, you can use the update mapping API to update the ignore_above parameter. - /// - /// - /// Change the mapping of an existing field - /// - /// - /// Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - /// Changing an existing field could invalidate data that's already indexed. - /// - /// - /// If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - /// If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - /// - /// - /// Rename a field - /// - /// - /// Renaming a field would invalidate data already indexed under the old field name. - /// Instead, add an alias field to create an alternate field name. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataStreamAsync(Elastic.Clients.Elasticsearch.DataStreamNames? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutMappingRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(PutIndicesSettingsRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(PutIndicesSettingsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(PutIndicesSettingsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - descriptor.BeforeRequest(); - return DoRequest, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, System.Action action) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Fields fields, System.Action> action) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - descriptor.BeforeRequest(); - return DoRequest, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingResponse GetFieldMapping(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, System.Action> action) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(PutIndicesSettingsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Action configureRequest) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(PutIndicesSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Fields fields, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFieldMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Fields fields, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetFieldMappingRequestDescriptor(indices, fields); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse GetIndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest request) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse GetIndexTemplate() { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse GetIndexTemplate(System.Action action) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIndicesSettingsResponse, PutIndicesSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(PutIndicesSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse GetIndexTemplate(Elastic.Clients.Elasticsearch.Name? name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateResponse GetIndexTemplate(Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIndexTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings, indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIndexTemplateAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update index settings. - /// Changes dynamic index settings in real time. - /// For data streams, index setting changes are applied to all backing indices by default. - /// - /// - /// To revert a setting to the default value, use a null value. - /// The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. - /// To preserve existing settings from being updated, set the preserve_existing parameter to true. - /// - /// - /// NOTE: You can only define new analyzers on closed indices. - /// To add an analyzer, you must close the index, define the analyzer, and reopen the index. - /// You cannot close the write index of a data stream. - /// To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. - /// Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. - /// This affects searches and any new data added to the stream after the rollover. - /// However, it does not affect the data stream's backing indices or their existing data. - /// To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIndexTemplateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutIndicesSettingsRequestDescriptor(settings); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(PutTemplateRequest request) + public virtual System.Threading.Tasks.Task GetIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(PutTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(PutTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping() { - descriptor.BeforeRequest(); - return DoRequest, PutTemplateResponse, PutTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(System.Action action) { - var descriptor = new PutTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutTemplateResponse, PutTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new PutTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutTemplateResponse, PutTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(PutTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(System.Action> action) { - var descriptor = new PutTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMappingResponse GetMapping(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new PutTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(PutTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutTemplateResponse, PutTemplateRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTemplateResponse, PutTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTemplateResponse, PutTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(PutTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an index template. - /// Index templates define settings, mappings, and aliases that can be applied automatically to new indices. - /// Elasticsearch applies templates to new indices based on an index pattern that matches the index name. - /// - /// - /// IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8. - /// - /// - /// Composable templates always take precedence over legacy templates. - /// If no composable template matches a new index, matching legacy templates are applied according to their order. - /// - /// - /// Index templates are only applied during index creation. - /// Changes to index templates do not affect existing indices. - /// Settings and mappings specified in create index API requests override any settings or mappings specified in an index template. - /// - /// - /// You can use C-style /* *\/ block comments in index templates. - /// You can include comments anywhere in the request body, except before the opening curly bracket. - /// - /// - /// Indices matching multiple templates - /// - /// - /// Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. - /// The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. - /// NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMappingAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(RecoveryRequest request) + public virtual System.Threading.Tasks.Task GetMappingAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(RecoveryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(RecoveryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus(Elastic.Clients.Elasticsearch.Indices indices) { - descriptor.BeforeRequest(); - return DoRequest, RecoveryResponse, RecoveryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new RecoveryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, RecoveryResponse, RecoveryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus() { - var descriptor = new RecoveryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RecoveryResponse, RecoveryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus(System.Action> action) { - var descriptor = new RecoveryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RecoveryResponse, RecoveryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusResponse GetMigrateReindexStatus(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new RecoveryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RecoveryResponse, RecoveryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(RecoveryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RecoveryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RecoveryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery() + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetMigrateReindexStatusAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetMigrateReindexStatusRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings() { - var descriptor = new RecoveryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RecoveryResponse Recovery(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(System.Action action) { - var descriptor = new RecoveryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(RecoveryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices) { - descriptor.BeforeRequest(); - return DoRequestAsync, RecoveryResponse, RecoveryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new RecoveryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, RecoveryResponse, RecoveryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name) { - var descriptor = new RecoveryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RecoveryResponse, RecoveryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - var descriptor = new RecoveryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RecoveryResponse, RecoveryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Names? name) { - var descriptor = new RecoveryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RecoveryResponse, RecoveryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(RecoveryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Names? name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new RecoveryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Names? name, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RecoveryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RecoveryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index recovery information. - /// Get information about ongoing and completed shard recoveries for one or more indices. - /// For data streams, the API returns information for the stream's backing indices. - /// - /// - /// All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time. - /// - /// - /// Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. - /// When a shard recovery completes, the recovered shard is available for search and indexing. - /// - /// - /// Recovery automatically occurs during the following processes: - /// - /// - /// - /// - /// When creating an index for the first time. - /// - /// - /// - /// - /// When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path. - /// - /// - /// - /// - /// Creation of new replica shard copies from the primary. - /// - /// - /// - /// - /// Relocation of a shard copy to a different node in the same cluster. - /// - /// - /// - /// - /// A snapshot restore operation. - /// - /// - /// - /// - /// A clone, shrink, or split operation. - /// - /// - /// - /// - /// You can determine the cause of a shard recovery using the recovery or cat recovery APIs. - /// - /// - /// The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. - /// It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. - /// This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RecoveryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RecoveryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(RefreshRequest request) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(RefreshRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(RefreshRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, RefreshResponse, RefreshRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, RefreshResponse, RefreshRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RefreshResponse, RefreshRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh() + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RefreshResponse, RefreshRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Action> configureRequest) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RefreshResponse, RefreshRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(RefreshRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Names? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetIndicesSettingsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse GetTemplate(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest request) { - var descriptor = new RefreshRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RefreshResponse Refresh(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse GetTemplate() { - var descriptor = new RefreshRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(RefreshRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse GetTemplate(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, RefreshResponse, RefreshRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse GetTemplate(Elastic.Clients.Elasticsearch.Names? name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateResponse GetTemplate(Elastic.Clients.Elasticsearch.Names? name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetTemplateAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetTemplateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetTemplateAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, RefreshResponse, RefreshRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTemplateAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RefreshResponse, RefreshRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.GetTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponse MigrateReindex(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest request) { - var descriptor = new RefreshRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RefreshResponse, RefreshRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexResponse MigrateReindex(System.Action action) { - var descriptor = new RefreshRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RefreshResponse, RefreshRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(RefreshRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task MigrateReindexAsync(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task MigrateReindexAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RefreshRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest request) { - var descriptor = new RefreshRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexName name) { - var descriptor = new RefreshRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Refresh an index. - /// A refresh makes recent operations performed on one or more indices available for search. - /// For data streams, the API runs the refresh operation on the stream’s backing indices. - /// - /// - /// By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. - /// You can change this default interval with the index.refresh_interval setting. - /// - /// - /// Refresh requests are synchronous and do not return a response until the refresh operation completes. - /// - /// - /// Refreshes are resource-intensive. - /// To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible. - /// - /// - /// If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. - /// This option ensures the indexing operation waits for a periodic refresh before running the search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RefreshAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexName name, System.Action action) { - var descriptor = new RefreshRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(ReloadSearchAnalyzersRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream() { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(ReloadSearchAnalyzersRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(ReloadSearchAnalyzersRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamResponse MigrateToDataStream(Elastic.Clients.Elasticsearch.IndexName name, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices) + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers() + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Action> configureRequest) + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(ReloadSearchAnalyzersRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices) + public virtual System.Threading.Tasks.Task MigrateToDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateToDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponse ModifyDataStream(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest request) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(ReloadSearchAnalyzersRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamResponse ModifyDataStream(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ModifyDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ModifyDataStreamAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ModifyDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(CancellationToken cancellationToken = default) + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest request) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ReloadSearchAnalyzersResponse, ReloadSearchAnalyzersRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(ReloadSearchAnalyzersRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open() { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload search analyzers. - /// Reload an index's search analyzers and their resources. - /// For data streams, the API reloads search analyzers and resources for the stream's backing indices. - /// - /// - /// IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer. - /// - /// - /// You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. - /// To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers. - /// - /// - /// NOTE: This API does not perform a reload for each shard of an index. - /// Instead, it performs a reload for each node containing index shards. - /// As a result, the total shard count returned by the API can differ from the number of index shards. - /// Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. - /// This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open(System.Action> action) { - var descriptor = new ReloadSearchAnalyzersRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveClusterResponse ResolveCluster(ResolveClusterRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexResponse Open(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveClusterAsync(ResolveClusterRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OpenAsync(Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveClusterResponse ResolveCluster(ResolveClusterRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveClusterResponse ResolveCluster(Elastic.Clients.Elasticsearch.Names name) + public virtual System.Threading.Tasks.Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResolveClusterRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveClusterResponse ResolveCluster(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual System.Threading.Tasks.Task OpenAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResolveClusterRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveClusterAsync(ResolveClusterRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OpenAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.OpenIndexRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveClusterAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest request) { - var descriptor = new ResolveClusterRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resolve the cluster. - /// Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. - /// Multiple patterns and remote clusters are supported. - /// - /// - /// This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search. - /// - /// - /// You use the same index expression with this endpoint as you would for cross-cluster search. - /// Index and cluster exclusions are also supported with this endpoint. - /// - /// - /// For each cluster in the index expression, information is returned about: - /// - /// - /// - /// - /// Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope. - /// - /// - /// - /// - /// Whether each remote cluster is configured with skip_unavailable as true or false. - /// - /// - /// - /// - /// Whether there are any indices, aliases, or data streams on that cluster that match the index expression. - /// - /// - /// - /// - /// Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index). - /// - /// - /// - /// - /// Cluster version information, including the Elasticsearch server version. - /// - /// - /// - /// - /// For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. - /// Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*. - /// - /// - /// Advantages of using this endpoint before a cross-cluster search - /// - /// - /// You may want to exclude a cluster or index from a search when: - /// - /// - /// - /// - /// A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail. - /// - /// - /// - /// - /// A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search. - /// - /// - /// - /// - /// The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.) - /// - /// - /// - /// - /// A remote cluster is an older version that does not support the feature you want to use in your search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveClusterAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexName name) { - var descriptor = new ResolveClusterRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveIndexResponse ResolveIndex(ResolveIndexRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexName name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveIndexAsync(ResolveIndexRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream() { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveIndexResponse ResolveIndex(ResolveIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveIndexResponse ResolveIndex(Elastic.Clients.Elasticsearch.Names name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamResponse PromoteDataStream(Elastic.Clients.Elasticsearch.IndexName name, System.Action> action) { - var descriptor = new ResolveIndexRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResolveIndexResponse ResolveIndex(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResolveIndexRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveIndexAsync(ResolveIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveIndexAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResolveIndexRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Resolve indices. - /// Resolve the names and/or index patterns for indices, aliases, and data streams. - /// Multiple patterns and remote clusters are supported. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResolveIndexAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResolveIndexRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(RolloverRequest request) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(RolloverRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PromoteDataStreamAsync(Elastic.Clients.Elasticsearch.IndexName name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PromoteDataStreamRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(RolloverRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest request) { - descriptor.BeforeRequest(); - return DoRequest, RolloverResponse, RolloverRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutAliasResponse PutAlias(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAliasAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAliasAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutAliasRequestDescriptor(indices, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse PutDataLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse PutDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleResponse PutDataLifecycle(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - descriptor.BeforeRequest(); - return DoRequest, RolloverResponse, RolloverRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, Action> configureRequest) + public virtual System.Threading.Tasks.Task PutDataLifecycleAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RolloverResponse, RolloverRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias) + public virtual System.Threading.Tasks.Task PutDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias); - descriptor.BeforeRequest(); - return DoRequest, RolloverResponse, RolloverRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Action> configureRequest) + public virtual System.Threading.Tasks.Task PutDataLifecycleAsync(Elastic.Clients.Elasticsearch.DataStreamNames name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RolloverResponse, RolloverRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutDataLifecycleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(RolloverRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateResponse PutIndexTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { - var descriptor = new RolloverRequestDescriptor(alias); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Action configureRequest) + public virtual System.Threading.Tasks.Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new RolloverRequestDescriptor(alias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(RolloverRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping() { - descriptor.BeforeRequest(); - return DoRequestAsync, RolloverResponse, RolloverRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping(System.Action> action) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - descriptor.BeforeRequest(); - return DoRequestAsync, RolloverResponse, RolloverRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutMappingResponse PutMapping(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RolloverResponse, RolloverRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutMappingAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias); - descriptor.BeforeRequest(); - return DoRequestAsync, RolloverResponse, RolloverRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RolloverResponse, RolloverRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(RolloverRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutMappingAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutMappingAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutMappingAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutMappingRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(System.Action> action) { - var descriptor = new RolloverRequestDescriptor(alias, newIndex); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new RolloverRequestDescriptor(alias); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Roll over to a new index. - /// TIP: It is recommended to use the index lifecycle rollover action to automate rollovers. - /// - /// - /// The rollover API creates a new index for a data stream or index alias. - /// The API behavior depends on the rollover target. - /// - /// - /// Roll over a data stream - /// - /// - /// If you roll over a data stream, the API creates a new write index for the stream. - /// The stream's previous write index becomes a regular backing index. - /// A rollover also increments the data stream's generation. - /// - /// - /// Roll over an index alias with a write index - /// - /// - /// TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. - /// Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers. - /// - /// - /// If an index alias points to multiple indices, one of the indices must be a write index. - /// The rollover API creates a new write index for the alias with is_write_index set to true. - /// The API also sets is_write_index to false for the previous write index. - /// - /// - /// Roll over an index alias with one index - /// - /// - /// If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias. - /// - /// - /// NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting. - /// - /// - /// Increment index names for an alias - /// - /// - /// When you roll over an index alias, you can specify a name for the new index. - /// If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. - /// For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. - /// This number is always six characters and zero-padded, regardless of the previous index's name. - /// - /// - /// If you use an index alias for time series data, you can use date math in the index name to track the rollover date. - /// For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. - /// If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. - /// If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSettingsAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RolloverRequestDescriptor(alias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(SegmentsRequest request) + public virtual System.Threading.Tasks.Task PutSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(SegmentsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(SegmentsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, SegmentsResponse, SegmentsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task PutSettingsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SegmentsResponse, SegmentsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task PutSettingsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SegmentsResponse, SegmentsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutIndicesSettingsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest request) { - var descriptor = new SegmentsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SegmentsResponse, SegmentsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new SegmentsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SegmentsResponse, SegmentsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(SegmentsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateResponse PutTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { - var descriptor = new SegmentsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task PutTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments() + public virtual System.Threading.Tasks.Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SegmentsResponse Segments(Action configureRequest) + public virtual System.Threading.Tasks.Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(SegmentsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, SegmentsResponse, SegmentsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.PutTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest request) { - var descriptor = new SegmentsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SegmentsResponse, SegmentsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery() { - var descriptor = new SegmentsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SegmentsResponse, SegmentsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(System.Action action) { - var descriptor = new SegmentsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SegmentsResponse, SegmentsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new SegmentsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SegmentsResponse, SegmentsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(SegmentsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(System.Action> action) { - var descriptor = new SegmentsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RecoveryResponse Recovery(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new SegmentsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RecoveryAsync(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index segments. - /// Get low-level information about the Lucene segments in index shards. - /// For data streams, the API returns information about the stream's backing indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SegmentsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RecoveryAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SegmentsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(ShardStoresRequest request) + public virtual System.Threading.Tasks.Task RecoveryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(ShardStoresRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(ShardStoresRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, ShardStoresResponse, ShardStoresRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task RecoveryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RecoveryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new ShardStoresRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ShardStoresResponse, ShardStoresRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new ShardStoresRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ShardStoresResponse, ShardStoresRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(System.Action> action) { - var descriptor = new ShardStoresRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ShardStoresResponse, ShardStoresRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RefreshResponse Refresh(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new ShardStoresRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ShardStoresResponse, ShardStoresRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(ShardStoresRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RefreshAsync(Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual System.Threading.Tasks.Task RefreshAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual System.Threading.Tasks.Task RefreshAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores() + public virtual System.Threading.Tasks.Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShardStoresResponse ShardStores(Action configureRequest) + public virtual System.Threading.Tasks.Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(ShardStoresRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RefreshAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, ShardStoresResponse, ShardStoresRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RefreshAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ShardStoresResponse, ShardStoresRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RefreshRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest request) { - var descriptor = new ShardStoresRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ShardStoresResponse, ShardStoresRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices) { - var descriptor = new ShardStoresRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ShardStoresResponse, ShardStoresRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) { - var descriptor = new ShardStoresRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ShardStoresResponse, ShardStoresRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(ShardStoresRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersResponse ReloadSearchAnalyzers(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new ShardStoresRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index shard stores. - /// Get store information about replica shards in one or more indices. - /// For data streams, the API retrieves store information for the stream's backing indices. - /// - /// - /// The index shard stores API returns the following information: - /// - /// - /// - /// - /// The node on which each replica shard exists. - /// - /// - /// - /// - /// The allocation ID for each replica shard. - /// - /// - /// - /// - /// A unique ID for each replica shard. - /// - /// - /// - /// - /// Any errors encountered while opening the shard index or from an earlier failure. - /// - /// - /// - /// - /// By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShardStoresAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShardStoresRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(ShrinkIndexRequest request) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(ShrinkIndexRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(ShrinkIndexRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ReloadSearchAnalyzersAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ReloadSearchAnalyzersRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse ResolveCluster(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest request) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse ResolveCluster() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse ResolveCluster(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse ResolveCluster(Elastic.Clients.Elasticsearch.Names? name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterResponse ResolveCluster(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(ShrinkIndexRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ResolveClusterAsync(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + public virtual System.Threading.Tasks.Task ResolveClusterAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action configureRequest) + public virtual System.Threading.Tasks.Task ResolveClusterAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(ShrinkIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResolveClusterAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResolveClusterAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse ResolveIndex(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse ResolveIndex(Elastic.Clients.Elasticsearch.Names name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexResponse ResolveIndex(Elastic.Clients.Elasticsearch.Names name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ResolveIndexAsync(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ResolveIndexAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ResolveIndexAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ShrinkIndexResponse, ShrinkIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(ShrinkIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Shrink an index. - /// Shrink an index into a new index with fewer primary shards. - /// - /// - /// Before you can shrink an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// A copy of every shard in the index must reside on the same node. - /// - /// - /// - /// - /// The index must have a green health status. - /// - /// - /// - /// - /// To make shard allocation easier, we recommend you also remove the index's replica shards. - /// You can later re-add replica shards as part of the shrink operation. - /// - /// - /// The requested number of primary shards in the target index must be a factor of the number of shards in the source index. - /// For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. - /// If the number of shards in the index is a prime number it can only be shrunk into a single primary shard - /// Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node. - /// - /// - /// The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk. - /// - /// - /// A shrink operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a smaller number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be shrunk if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index. - /// - /// - /// - /// - /// The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard. - /// - /// - /// - /// - /// The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, System.Action action) { - var descriptor = new ShrinkIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateIndexTemplateResponse SimulateIndexTemplate(SimulateIndexTemplateRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateIndexTemplateAsync(SimulateIndexTemplateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateIndexTemplateResponse SimulateIndexTemplate(SimulateIndexTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateIndexTemplateResponse SimulateIndexTemplate(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.RolloverResponse Rollover(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, System.Action> action) { - var descriptor = new SimulateIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateIndexTemplateResponse SimulateIndexTemplate(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateIndexTemplateAsync(SimulateIndexTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateIndexTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index. - /// Get the index configuration that would be applied to the specified index from an existing index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateIndexTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(SimulateTemplateRequest request) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(SimulateTemplateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(SimulateTemplateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RolloverAsync(Elastic.Clients.Elasticsearch.IndexAlias alias, Elastic.Clients.Elasticsearch.IndexName? newIndex, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverRequestDescriptor(alias, newIndex); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest request) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments() { - var descriptor = new SimulateTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(System.Action action) { - var descriptor = new SimulateTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new SimulateTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(SimulateTemplateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(System.Action> action) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SegmentsResponse Segments(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate() + public virtual System.Threading.Tasks.Task SegmentsAsync(Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateTemplateResponse SimulateTemplate(Action configureRequest) + public virtual System.Threading.Tasks.Task SegmentsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(SimulateTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SegmentsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SegmentsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SegmentsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SegmentsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(System.Action> action) { - var descriptor = new SimulateTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresResponse ShardStores(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new SimulateTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateTemplateResponse, SimulateTemplateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(SimulateTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate an index template. - /// Get the index configuration that would be applied by a particular index template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateTemplateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(SplitIndexRequest request) + public virtual System.Threading.Tasks.Task ShardStoresAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(SplitIndexRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShardStoresAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoresRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(SplitIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest request) { - descriptor.BeforeRequest(); - return DoRequest, SplitIndexResponse, SplitIndexRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest, SplitIndexResponse, SplitIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action action) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SplitIndexResponse, SplitIndexRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(SplitIndexRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexResponse Shrink(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) + public virtual System.Threading.Tasks.Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action configureRequest) + public virtual System.Threading.Tasks.Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(SplitIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ShrinkAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, SplitIndexResponse, SplitIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ShrinkIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse SimulateIndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest request) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync, SplitIndexResponse, SplitIndexRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse SimulateIndexTemplate(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SplitIndexResponse, SplitIndexRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(SplitIndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateResponse SimulateIndexTemplate(Elastic.Clients.Elasticsearch.Name name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task SimulateIndexTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SimulateIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SimulateIndexTemplateAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateIndexTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(System.Action> action) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Split an index. - /// Split an index into a new index with more primary shards. - /// - /// - /// - /// - /// Before you can split an index: - /// - /// - /// - /// - /// The index must be read-only. - /// - /// - /// - /// - /// The cluster health status must be green. - /// - /// - /// - /// - /// You can do make an index read-only with the following request using the add index block API: - /// - /// - /// PUT /my_source_index/_block/write - /// - /// - /// The current write index on a data stream cannot be split. - /// In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split. - /// - /// - /// The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. - /// The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. - /// For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3. - /// - /// - /// A split operation: - /// - /// - /// - /// - /// Creates a new target index with the same definition as the source index, but with a larger number of primary shards. - /// - /// - /// - /// - /// Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process. - /// - /// - /// - /// - /// Hashes all documents again, after low level files are created, to delete documents that belong to a different shard. - /// - /// - /// - /// - /// Recovers the target index as though it were a closed index which had just been re-opened. - /// - /// - /// - /// - /// IMPORTANT: Indices can only be split if they satisfy the following requirements: - /// - /// - /// - /// - /// The target index must not exist. - /// - /// - /// - /// - /// The source index must have fewer primary shards than the target index. - /// - /// - /// - /// - /// The number of primary shards in the target index must be a multiple of the number of primary shards in the source index. - /// - /// - /// - /// - /// The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateResponse SimulateTemplate(Elastic.Clients.Elasticsearch.Name? name, System.Action> action) { - var descriptor = new SplitIndexRequestDescriptor(index, target); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(IndicesStatsRequest request) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(IndicesStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(IndicesStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - descriptor.BeforeRequest(); - return DoRequest, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, Action> configureRequest) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats() + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Action> configureRequest) + public virtual System.Threading.Tasks.Task SimulateTemplateAsync(Elastic.Clients.Elasticsearch.Name? name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SimulateTemplateRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(IndicesStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action action) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexResponse Split(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action> action) { - var descriptor = new IndicesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndicesStatsResponse Stats(Action configureRequest) + public virtual System.Threading.Tasks.Task SplitAsync(Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(IndicesStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - descriptor.BeforeRequest(); - return DoRequestAsync, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SplitAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.IndexName target, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SplitIndexRequestDescriptor(index, target); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats() + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new IndicesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - var descriptor = new IndicesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndicesStatsResponse, IndicesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(IndicesStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(System.Action> action) { - var descriptor = new IndicesStatsRequestDescriptor(indices, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action) { - var descriptor = new IndicesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get index statistics. - /// For data streams, the API retrieves statistics for the stream's backing indices. - /// - /// - /// By default, the returned statistics are index-level with primaries and total aggregations. - /// primaries are the values for only the primary shards. - /// total are the accumulated values for both primary and replica shards. - /// - /// - /// To get shard-level statistics, set the level parameter to shards. - /// - /// - /// NOTE: When moving to another node, the shard-level statistics for a shard are cleared. - /// Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new IndicesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases(UpdateAliasesRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(UpdateAliasesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases(UpdateAliasesRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases() + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases(Action> configureRequest) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases(UpdateAliasesRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases() + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateAliasesResponse UpdateAliases(Action configureRequest) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(UpdateAliasesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateAliasesResponse, UpdateAliasesRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(UpdateAliasesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an alias. - /// Adds a data stream or index to an alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAliasesAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateAliasesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsRequestDescriptor(indices, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(ValidateQueryRequest request) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse UpdateAliases(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(ValidateQueryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse UpdateAliases() { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(ValidateQueryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse UpdateAliases(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesResponse UpdateAliases(System.Action> action) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual System.Threading.Tasks.Task UpdateAliasesAsync(Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery() + public virtual System.Threading.Tasks.Task UpdateAliasesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Action> configureRequest) + public virtual System.Threading.Tasks.Task UpdateAliasesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(ValidateQueryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateAliasesAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.UpdateAliasesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest request) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery() { - var descriptor = new ValidateQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery() + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(System.Action action) { - var descriptor = new ValidateQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateQueryResponse ValidateQuery(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new ValidateQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(ValidateQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(System.Action> action) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryResponse ValidateQuery(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateQueryResponse, ValidateQueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(ValidateQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate a query. - /// Validates a query without running it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateQueryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateQueryAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.ValidateQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs index 0da706e74f5..0f949645e5b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs @@ -18,1308 +18,1393 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -public partial class InferenceNamespacedClient : NamespacedClientProxy +public partial class InferenceNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected InferenceNamespacedClient() : base() { } - internal InferenceNamespacedClient(ElasticsearchClient client) : base(client) + internal InferenceNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(DeleteInferenceRequest request) + public virtual Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedResponse ChatCompletionUnified(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteInferenceRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedResponse ChatCompletionUnified(Elastic.Clients.Elasticsearch.Id inferenceId) { + var builder = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(inferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(DeleteInferenceRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedResponse ChatCompletionUnified(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual System.Threading.Tasks.Task ChatCompletionUnifiedAsync(Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual System.Threading.Tasks.Task ChatCompletionUnifiedAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual System.Threading.Tasks.Task ChatCompletionUnifiedAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.ChatCompletionUnifiedRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.CompletionResponse Completion(Elastic.Clients.Elasticsearch.Inference.CompletionRequest request) { - var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.CompletionResponse Completion(Elastic.Clients.Elasticsearch.Id inferenceId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.CompletionResponse Completion(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CompletionAsync(Elastic.Clients.Elasticsearch.Inference.CompletionRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CompletionAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CompletionAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get(GetInferenceRequest request) + public virtual Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetInferenceRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId) { + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get(GetInferenceRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get() + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetInferenceRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInferenceResponse Get(Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetInferenceRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.DeleteInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest request) { - var descriptor = new GetInferenceRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get an inference endpoint - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get() { - var descriptor = new GetInferenceRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(InferenceRequest request) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(InferenceRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Id? inferenceId) { + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(InferenceRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Id? inferenceId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) { - var descriptor = new InferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, System.Action action) { - var descriptor = new InferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Inference.GetInferenceRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(InferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Id? inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Id? inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform inference on the service - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.GetInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(PutInferenceRequest request) + public virtual Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(PutInferenceRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Id inferenceId) { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(PutInferenceRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Inference.PutInferenceRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(PutInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse PutAlibabacloud(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest request) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an inference endpoint. - /// When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. - /// After creating the endpoint, wait for the model deployment to complete before using it. - /// To verify the deployment status, use the get trained model statistics API. - /// Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". - /// Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse PutAlibabacloud(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId) { - var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(taskType, alibabacloudInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(StreamInferenceRequest request) + public virtual Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudResponse PutAlibabacloud(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(taskType, alibabacloudInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAlibabacloudAsync(Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAlibabacloudAsync(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(taskType, alibabacloudInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAlibabacloudAsync(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType taskType, Elastic.Clients.Elasticsearch.Id alibabacloudInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAlibabacloudRequestDescriptor(taskType, alibabacloudInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse PutAmazonbedrock(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse PutAmazonbedrock(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(taskType, amazonbedrockInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockResponse PutAmazonbedrock(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(taskType, amazonbedrockInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAmazonbedrockAsync(Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAmazonbedrockAsync(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(taskType, amazonbedrockInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAmazonbedrockAsync(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType taskType, Elastic.Clients.Elasticsearch.Id amazonbedrockInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAmazonbedrockRequestDescriptor(taskType, amazonbedrockInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse PutAnthropic(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse PutAnthropic(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(taskType, anthropicInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAnthropicResponse PutAnthropic(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(taskType, anthropicInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAnthropicAsync(Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAnthropicAsync(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(taskType, anthropicInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAnthropicAsync(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType taskType, Elastic.Clients.Elasticsearch.Id anthropicInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAnthropicRequestDescriptor(taskType, anthropicInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse PutAzureaistudio(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse PutAzureaistudio(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(taskType, azureaistudioInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioResponse PutAzureaistudio(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(taskType, azureaistudioInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAzureaistudioAsync(Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAzureaistudioAsync(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(taskType, azureaistudioInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAzureaistudioAsync(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id azureaistudioInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureaistudioRequestDescriptor(taskType, azureaistudioInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse PutAzureopenai(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse PutAzureopenai(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(taskType, azureopenaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiResponse PutAzureopenai(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(taskType, azureopenaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutAzureopenaiAsync(Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAzureopenaiAsync(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(taskType, azureopenaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutAzureopenaiAsync(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id azureopenaiInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutAzureopenaiRequestDescriptor(taskType, azureopenaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutCohereResponse PutCohere(Elastic.Clients.Elasticsearch.Inference.PutCohereRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutCohereResponse PutCohere(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(taskType, cohereInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutCohereResponse PutCohere(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(taskType, cohereInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutCohereAsync(Elastic.Clients.Elasticsearch.Inference.PutCohereRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutCohereAsync(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(taskType, cohereInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutCohereAsync(Elastic.Clients.Elasticsearch.Inference.CohereTaskType taskType, Elastic.Clients.Elasticsearch.Id cohereInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutCohereRequestDescriptor(taskType, cohereInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse PutElasticsearch(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse PutElasticsearch(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(taskType, elasticsearchInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutElasticsearchResponse PutElasticsearch(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(taskType, elasticsearchInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutElasticsearchAsync(Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutElasticsearchAsync(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(taskType, elasticsearchInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutElasticsearchAsync(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType taskType, Elastic.Clients.Elasticsearch.Id elasticsearchInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElasticsearchRequestDescriptor(taskType, elasticsearchInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutElserResponse PutElser(Elastic.Clients.Elasticsearch.Inference.PutElserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + [System.Obsolete("Deprecated in '8.16.0'. The elser service is deprecated and will be removed in a future release. Use the Elasticsearch inference integration instead, with model_id included in the service_settings.")] + public virtual Elastic.Clients.Elasticsearch.Inference.PutElserResponse PutElser(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(taskType, elserInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + [System.Obsolete("Deprecated in '8.16.0'. The elser service is deprecated and will be removed in a future release. Use the Elasticsearch inference integration instead, with model_id included in the service_settings.")] + public virtual Elastic.Clients.Elasticsearch.Inference.PutElserResponse PutElser(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(taskType, elserInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutElserAsync(Elastic.Clients.Elasticsearch.Inference.PutElserRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + [System.Obsolete("Deprecated in '8.16.0'. The elser service is deprecated and will be removed in a future release. Use the Elasticsearch inference integration instead, with model_id included in the service_settings.")] + public virtual System.Threading.Tasks.Task PutElserAsync(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(taskType, elserInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + [System.Obsolete("Deprecated in '8.16.0'. The elser service is deprecated and will be removed in a future release. Use the Elasticsearch inference integration instead, with model_id included in the service_settings.")] + public virtual System.Threading.Tasks.Task PutElserAsync(Elastic.Clients.Elasticsearch.Inference.ElserTaskType taskType, Elastic.Clients.Elasticsearch.Id elserInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutElserRequestDescriptor(taskType, elserInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse PutGoogleaistudio(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse PutGoogleaistudio(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(taskType, googleaistudioInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioResponse PutGoogleaistudio(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(taskType, googleaistudioInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutGoogleaistudioAsync(Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutGoogleaistudioAsync(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(taskType, googleaistudioInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutGoogleaistudioAsync(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType taskType, Elastic.Clients.Elasticsearch.Id googleaistudioInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGoogleaistudioRequestDescriptor(taskType, googleaistudioInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse PutGooglevertexai(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse PutGooglevertexai(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(taskType, googlevertexaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiResponse PutGooglevertexai(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(taskType, googlevertexaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutGooglevertexaiAsync(Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutGooglevertexaiAsync(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(taskType, googlevertexaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutGooglevertexaiAsync(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType taskType, Elastic.Clients.Elasticsearch.Id googlevertexaiInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutGooglevertexaiRequestDescriptor(taskType, googlevertexaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse PutHuggingFace(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse PutHuggingFace(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(taskType, huggingfaceInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceResponse PutHuggingFace(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(taskType, huggingfaceInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutHuggingFaceAsync(Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutHuggingFaceAsync(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(taskType, huggingfaceInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutHuggingFaceAsync(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType taskType, Elastic.Clients.Elasticsearch.Id huggingfaceInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutHuggingFaceRequestDescriptor(taskType, huggingfaceInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse PutJinaai(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse PutJinaai(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(taskType, jinaaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutJinaaiResponse PutJinaai(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(taskType, jinaaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutJinaaiAsync(Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutJinaaiAsync(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(taskType, jinaaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutJinaaiAsync(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType taskType, Elastic.Clients.Elasticsearch.Id jinaaiInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutJinaaiRequestDescriptor(taskType, jinaaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutMistralResponse PutMistral(Elastic.Clients.Elasticsearch.Inference.PutMistralRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutMistralResponse PutMistral(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(taskType, mistralInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutMistralResponse PutMistral(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(taskType, mistralInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutMistralAsync(Elastic.Clients.Elasticsearch.Inference.PutMistralRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutMistralAsync(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(taskType, mistralInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutMistralAsync(Elastic.Clients.Elasticsearch.Inference.MistralTaskType taskType, Elastic.Clients.Elasticsearch.Id mistralInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutMistralRequestDescriptor(taskType, mistralInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse PutOpenai(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse PutOpenai(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(taskType, openaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutOpenaiResponse PutOpenai(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(taskType, openaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutOpenaiAsync(Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutOpenaiAsync(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(taskType, openaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutOpenaiAsync(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType taskType, Elastic.Clients.Elasticsearch.Id openaiInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutOpenaiRequestDescriptor(taskType, openaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse PutVoyageai(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse PutVoyageai(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(taskType, voyageaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutVoyageaiResponse PutVoyageai(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(taskType, voyageaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutVoyageaiAsync(Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutVoyageaiAsync(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(taskType, voyageaiInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutVoyageaiAsync(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType taskType, Elastic.Clients.Elasticsearch.Id voyageaiInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutVoyageaiRequestDescriptor(taskType, voyageaiInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse PutWatsonx(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse PutWatsonx(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(taskType, watsonxInferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.PutWatsonxResponse PutWatsonx(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(taskType, watsonxInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutWatsonxAsync(Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(StreamInferenceRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutWatsonxAsync(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(taskType, watsonxInferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(StreamInferenceRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutWatsonxAsync(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType taskType, Elastic.Clients.Elasticsearch.Id watsonxInferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.PutWatsonxRequestDescriptor(taskType, watsonxInferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.RerankResponse Rerank(Elastic.Clients.Elasticsearch.Inference.RerankRequest request) { - var descriptor = new StreamInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.RerankResponse Rerank(Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new StreamInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.RerankResponse Rerank(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new StreamInferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StreamInferenceResponse StreamInference(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual System.Threading.Tasks.Task RerankAsync(Elastic.Clients.Elasticsearch.Inference.RerankRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StreamInferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(StreamInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RerankAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RerankAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StreamInferenceRequestDescriptor(taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.RerankRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse SparseEmbedding(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest request) { - var descriptor = new StreamInferenceRequestDescriptor(taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse SparseEmbedding(Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new StreamInferenceRequestDescriptor(inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Perform streaming inference. - /// Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. - /// This API works only with the completion task type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// - /// This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege). You must use a client that supports streaming. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StreamInferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResponse SparseEmbedding(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new StreamInferenceRequestDescriptor(inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(UpdateInferenceRequest request) + public virtual System.Threading.Tasks.Task SparseEmbeddingAsync(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(UpdateInferenceRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SparseEmbeddingAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(inferenceId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(UpdateInferenceRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task SparseEmbeddingAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.StreamCompletionResponse StreamCompletion(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest request) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Inference.StreamCompletionResponse StreamCompletion(Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual Elastic.Clients.Elasticsearch.Inference.StreamCompletionResponse StreamCompletion(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, inferenceId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual System.Threading.Tasks.Task StreamCompletionAsync(Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(UpdateInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StreamCompletionAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StreamCompletionAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.StreamCompletionRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse TextEmbedding(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest request) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse TextEmbedding(Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, inferenceId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an inference endpoint. - /// - /// - /// Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type. - /// - /// - /// IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. - /// For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. - /// However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResponse TextEmbedding(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task TextEmbeddingAsync(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TextEmbeddingAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TextEmbeddingAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Id inferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Inference.UpdateInferenceResponse Update(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateAsync(Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(taskType, inferenceId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateInferenceRequestDescriptor(inferenceConfig, inferenceId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Inference.UpdateInferenceRequestDescriptor(taskType, inferenceId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ingest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ingest.g.cs index dd4bc32e2a3..236473d2b0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ingest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ingest.g.cs @@ -18,2752 +18,749 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public partial class IngestNamespacedClient : NamespacedClientProxy +public partial class IngestNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected IngestNamespacedClient() : base() { } - internal IngestNamespacedClient(ElasticsearchClient client) : base(client) + internal IngestNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(DeleteGeoipDatabaseRequest request) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(DeleteGeoipDatabaseRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(DeleteGeoipDatabaseRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id) + public virtual System.Threading.Tasks.Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id, Action> configureRequest) + public virtual System.Threading.Tasks.Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(DeleteGeoipDatabaseRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest request) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteGeoipDatabaseResponse DeleteGeoipDatabase(Elastic.Clients.Elasticsearch.Ids id, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(DeleteGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteGeoipDatabaseResponse, DeleteGeoipDatabaseRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(DeleteGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeleteIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest request) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete GeoIP database configurations. - /// Delete one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new DeleteGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(DeleteIpLocationDatabaseRequest request) + public virtual Elastic.Clients.Elasticsearch.Ingest.DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(DeleteIpLocationDatabaseRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(DeleteIpLocationDatabaseRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id) + public virtual System.Threading.Tasks.Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DeletePipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse GeoIpStats(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest request) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(DeleteIpLocationDatabaseRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse GeoIpStats() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id) + public virtual Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsResponse GeoIpStats(System.Action action) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteIpLocationDatabaseResponse DeleteIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids id, Action configureRequest) + public virtual System.Threading.Tasks.Task GeoIpStatsAsync(Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(DeleteIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GeoIpStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GeoIpStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest request) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteIpLocationDatabaseResponse, DeleteIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(DeleteIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse GetGeoipDatabase() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse GetGeoipDatabase(System.Action action) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id) { - var descriptor = new DeleteIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(DeletePipelineRequest request) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(DeletePipelineRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(DeletePipelineRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetGeoipDatabaseAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task GetGeoipDatabaseAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(DeletePipelineRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest request) { - var descriptor = new DeletePipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePipelineResponse DeletePipeline(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse GetIpLocationDatabase() { - var descriptor = new DeletePipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(DeletePipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse GetIpLocationDatabase(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id) { - var descriptor = new DeletePipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id, System.Action action) { - var descriptor = new DeletePipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeletePipelineResponse, DeletePipelineRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(DeletePipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIpLocationDatabaseAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete pipelines. - /// Delete one or more ingest pipelines. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePipelineAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIpLocationDatabaseAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GeoIpStatsResponse GeoIpStats(GeoIpStatsRequest request) + public virtual System.Threading.Tasks.Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GeoIpStatsAsync(GeoIpStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GeoIpStatsResponse GeoIpStats(GeoIpStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GeoIpStatsResponse GeoIpStats() + public virtual Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse GetPipeline() { - var descriptor = new GeoIpStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GeoIpStatsResponse GeoIpStats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse GetPipeline(System.Action action) { - var descriptor = new GeoIpStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GeoIpStatsAsync(GeoIpStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GeoIpStatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new GeoIpStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get GeoIP statistics. - /// Get download statistics for GeoIP2 databases that are used with the GeoIP processor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GeoIpStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GeoIpStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(GetGeoipDatabaseRequest request) + public virtual System.Threading.Tasks.Task GetPipelineAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(GetGeoipDatabaseRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPipelineAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(GetGeoipDatabaseRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id, Action> configureRequest) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase() - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Action> configureRequest) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(GetGeoipDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Elastic.Clients.Elasticsearch.Ids? id, Action configureRequest) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase() - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetGeoipDatabaseResponse GetGeoipDatabase(Action configureRequest) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(GetGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetGeoipDatabaseResponse, GetGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(GetGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get GeoIP database configurations. - /// Get information about one or more IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetGeoipDatabaseAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetGeoipDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(GetIpLocationDatabaseRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(GetIpLocationDatabaseRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(GetIpLocationDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id, Action> configureRequest) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase() - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Action> configureRequest) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(GetIpLocationDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Elastic.Clients.Elasticsearch.Ids? id, Action configureRequest) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase() - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetIpLocationDatabaseResponse GetIpLocationDatabase(Action configureRequest) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(GetIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetIpLocationDatabaseResponse, GetIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(GetIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ids? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get IP geolocation database configurations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetIpLocationDatabaseAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetIpLocationDatabaseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(GetPipelineRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(GetPipelineRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(GetPipelineRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetPipelineResponse, GetPipelineRequestParameters>(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetPipelineResponse, GetPipelineRequestParameters>(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new GetPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetPipelineResponse, GetPipelineRequestParameters>(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline() - { - var descriptor = new GetPipelineRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetPipelineResponse, GetPipelineRequestParameters>(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Action> configureRequest) - { - var descriptor = new GetPipelineRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetPipelineResponse, GetPipelineRequestParameters>(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(GetPipelineRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) - { - var descriptor = new GetPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline() - { - var descriptor = new GetPipelineRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPipelineResponse GetPipeline(Action configureRequest) - { - var descriptor = new GetPipelineRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(GetPipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetPipelineResponse, GetPipelineRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetPipelineResponse, GetPipelineRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetPipelineResponse, GetPipelineRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetPipelineResponse, GetPipelineRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetPipelineResponse, GetPipelineRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(GetPipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get pipelines. - /// Get information about one or more ingest pipelines. - /// This API returns a local reference of the pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPipelineAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPipelineRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ProcessorGrokResponse ProcessorGrok(ProcessorGrokRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ProcessorGrokAsync(ProcessorGrokRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ProcessorGrokResponse ProcessorGrok(ProcessorGrokRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ProcessorGrokResponse ProcessorGrok() - { - var descriptor = new ProcessorGrokRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ProcessorGrokResponse ProcessorGrok(Action configureRequest) - { - var descriptor = new ProcessorGrokRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ProcessorGrokAsync(ProcessorGrokRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ProcessorGrokAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ProcessorGrokRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a grok processor. - /// Extract structured fields out of a single text field within a document. - /// You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. - /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ProcessorGrokAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ProcessorGrokRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(PutGeoipDatabaseRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(PutGeoipDatabaseRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(PutGeoipDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(PutGeoipDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(PutGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutGeoipDatabaseResponse, PutGeoipDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(PutGeoipDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a GeoIP database configuration. - /// Refer to the create or update IP geolocation database configuration API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutGeoipDatabaseRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(PutIpLocationDatabaseRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(PutIpLocationDatabaseRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPipelineAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.GetPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(PutIpLocationDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - descriptor.BeforeRequest(); - return DoRequest, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(PutIpLocationDatabaseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(PutIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutIpLocationDatabaseResponse, PutIpLocationDatabaseRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(PutIpLocationDatabaseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse ProcessorGrok(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest request) { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update an IP geolocation database configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration configuration, Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse ProcessorGrok() { - var descriptor = new PutIpLocationDatabaseRequestDescriptor(configuration, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(PutPipelineRequest request) + public virtual Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokResponse ProcessorGrok(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(PutPipelineRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ProcessorGrokAsync(Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(PutPipelineRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ProcessorGrokAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutPipelineResponse, PutPipelineRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task ProcessorGrokAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutPipelineResponse, PutPipelineRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorGrokRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest request) { - var descriptor = new PutPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutPipelineResponse, PutPipelineRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(PutPipelineRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseResponse PutGeoipDatabase(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new PutPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(PutPipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutPipelineResponse, PutPipelineRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutGeoipDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutPipelineResponse, PutPipelineRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutGeoipDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest request) { - var descriptor = new PutPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutPipelineResponse, PutPipelineRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(PutPipelineRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseResponse PutIpLocationDatabase(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new PutPipelineRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a pipeline. - /// Changes made using this API take effect immediately. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutPipelineRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(SimulateRequest request) + public virtual System.Threading.Tasks.Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(SimulateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutIpLocationDatabaseAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutIpLocationDatabaseRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(SimulateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest request) { - descriptor.BeforeRequest(); - return DoRequest, SimulateResponse, SimulateRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new SimulateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, SimulateResponse, SimulateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new SimulateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SimulateResponse, SimulateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate() + public virtual Elastic.Clients.Elasticsearch.Ingest.PutPipelineResponse PutPipeline(Elastic.Clients.Elasticsearch.Id id, System.Action> action) { - var descriptor = new SimulateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SimulateResponse, SimulateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Action> configureRequest) + public virtual System.Threading.Tasks.Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SimulateResponse, SimulateRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(SimulateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id) + public virtual System.Threading.Tasks.Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) + public virtual System.Threading.Tasks.Task PutPipelineAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PutPipelineRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate() + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest request) { - var descriptor = new SimulateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SimulateResponse Simulate(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(System.Action action) { - var descriptor = new SimulateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(SimulateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id) { - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateResponse, SimulateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new SimulateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateResponse, SimulateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(System.Action> action) { - var descriptor = new SimulateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateResponse, SimulateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Ingest.SimulateResponse Simulate(Elastic.Clients.Elasticsearch.Id? id, System.Action> action) { - var descriptor = new SimulateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateResponse, SimulateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(Elastic.Clients.Elasticsearch.Ingest.SimulateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SimulateResponse, SimulateRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(SimulateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate a pipeline. - /// Run an ingest pipeline against a set of provided documents. - /// You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SimulateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SimulateAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SimulateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SimulateRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.License.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.License.g.cs index 2de10d980ed..63f96d77700 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.License.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.License.g.cs @@ -18,1054 +18,345 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -public partial class LicenseManagementNamespacedClient : NamespacedClientProxy +public partial class LicenseManagementNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected LicenseManagementNamespacedClient() : base() { } - internal LicenseManagementNamespacedClient(ElasticsearchClient client) : base(client) + internal LicenseManagementNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLicenseResponse Delete(DeleteLicenseRequest request) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse Delete(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteLicenseRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse Delete() { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLicenseResponse Delete(DeleteLicenseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLicenseResponse Delete() - { - var descriptor = new DeleteLicenseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLicenseResponse Delete(Action configureRequest) - { - var descriptor = new DeleteLicenseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteLicenseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(CancellationToken cancellationToken = default) - { - var descriptor = new DeleteLicenseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete the license. - /// When the license expires, your subscription level reverts to Basic. - /// - /// - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteLicenseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLicenseResponse Get(GetLicenseRequest request) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseResponse Delete(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetLicenseRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLicenseResponse Get(GetLicenseRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLicenseResponse Get() - { - var descriptor = new GetLicenseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLicenseResponse Get(Action configureRequest) - { - var descriptor = new GetLicenseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetLicenseRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetLicenseRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get license information. - /// Get information about your Elastic license including its type, its status, when it was issued, and when it expires. - /// - /// - /// NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. - /// If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetLicenseRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBasicStatusResponse GetBasicStatus(GetBasicStatusRequest request) + public virtual System.Threading.Tasks.Task DeleteAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBasicStatusAsync(GetBasicStatusRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.DeleteLicenseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBasicStatusResponse GetBasicStatus(GetBasicStatusRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBasicStatusResponse GetBasicStatus() + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse Get(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest request) { - var descriptor = new GetBasicStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBasicStatusResponse GetBasicStatus(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse Get() { - var descriptor = new GetBasicStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBasicStatusAsync(GetBasicStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBasicStatusAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseResponse Get(System.Action action) { - var descriptor = new GetBasicStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the basic license status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBasicStatusAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetBasicStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrialStatusResponse GetTrialStatus(GetTrialStatusRequest request) + public virtual System.Threading.Tasks.Task GetAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrialStatusAsync(GetTrialStatusRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetLicenseRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrialStatusResponse GetTrialStatus(GetTrialStatusRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse GetBasicStatus(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrialStatusResponse GetTrialStatus() + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse GetBasicStatus() { - var descriptor = new GetTrialStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrialStatusResponse GetTrialStatus(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusResponse GetBasicStatus(System.Action action) { - var descriptor = new GetTrialStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrialStatusAsync(GetTrialStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBasicStatusAsync(Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrialStatusAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBasicStatusAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrialStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the trial status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrialStatusAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBasicStatusAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrialStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetBasicStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostResponse Post(PostRequest request) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse GetTrialStatus(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostAsync(PostRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse GetTrialStatus() { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostResponse Post(PostRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusResponse GetTrialStatus(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostResponse Post() + public virtual System.Threading.Tasks.Task GetTrialStatusAsync(Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostResponse Post(Action configureRequest) + public virtual System.Threading.Tasks.Task GetTrialStatusAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostAsync(PostRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrialStatusAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.GetTrialStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse Post(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest request) { - var descriptor = new PostRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update the license. - /// You can update your license at runtime without shutting down your nodes. - /// License updates take effect immediately. - /// If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. - /// If the operator privileges feature is enabled, only operator users can use this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse Post() { - var descriptor = new PostRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartBasicResponse PostStartBasic(PostStartBasicRequest request) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostResponse Post(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartBasicAsync(PostStartBasicRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostAsync(Elastic.Clients.Elasticsearch.LicenseManagement.PostRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartBasicResponse PostStartBasic(PostStartBasicRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PostAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartBasicResponse PostStartBasic() + public virtual System.Threading.Tasks.Task PostAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostStartBasicRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartBasicResponse PostStartBasic(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse PostStartBasic(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest request) { - var descriptor = new PostStartBasicRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartBasicAsync(PostStartBasicRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse PostStartBasic() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartBasicAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicResponse PostStartBasic(System.Action action) { - var descriptor = new PostStartBasicRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a basic license. - /// Start an indefinite basic license, which gives access to all the basic features. - /// - /// - /// NOTE: In order to start a basic license, you must not currently have a basic license. - /// - /// - /// If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. - /// You must then re-submit the API request with the acknowledge parameter set to true. - /// - /// - /// To check the status of your basic license, use the get basic license API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartBasicAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostStartBasicAsync(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostStartBasicRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartTrialResponse PostStartTrial(PostStartTrialRequest request) + public virtual System.Threading.Tasks.Task PostStartBasicAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartTrialAsync(PostStartTrialRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostStartBasicAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartBasicRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartTrialResponse PostStartTrial(PostStartTrialRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse PostStartTrial(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartTrialResponse PostStartTrial() + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse PostStartTrial() { - var descriptor = new PostStartTrialRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostStartTrialResponse PostStartTrial(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialResponse PostStartTrial(System.Action action) { - var descriptor = new PostStartTrialRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartTrialAsync(PostStartTrialRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostStartTrialAsync(Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartTrialAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostStartTrialAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostStartTrialRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trial. - /// Start a 30-day trial, which gives access to all subscription features. - /// - /// - /// NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. - /// For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension. - /// - /// - /// To check the status of your trial, use the get trial status API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostStartTrialAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostStartTrialAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostStartTrialRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.PostStartTrialRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs index 9dc7d86eab9..2c3fb6a91bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs @@ -18,13481 +18,4231 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public partial class MachineLearningNamespacedClient : NamespacedClientProxy +public partial class MachineLearningNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected MachineLearningNamespacedClient() : base() { } - internal MachineLearningNamespacedClient(ElasticsearchClient client) : base(client) + internal MachineLearningNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(ClearTrainedModelDeploymentCacheRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearTrainedModelDeploymentCacheAsync(ClearTrainedModelDeploymentCacheRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(Elastic.Clients.Elasticsearch.Id modelId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(ClearTrainedModelDeploymentCacheRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(Elastic.Clients.Elasticsearch.Id modelId) + public virtual System.Threading.Tasks.Task ClearTrainedModelDeploymentCacheAsync(Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearTrainedModelDeploymentCacheResponse ClearTrainedModelDeploymentCache(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual System.Threading.Tasks.Task ClearTrainedModelDeploymentCacheAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearTrainedModelDeploymentCacheAsync(ClearTrainedModelDeploymentCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearTrainedModelDeploymentCacheAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearTrainedModelDeploymentCacheAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse CloseJob(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest request) { - var descriptor = new ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear trained model deployment cache. - /// Cache will be cleared on all nodes where the trained model is assigned. - /// A trained model deployment may have an inference cache enabled. - /// As requests are handled by each allocated node, their responses may be cached on that individual node. - /// Calling this API clears the caches without restarting the deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearTrainedModelDeploymentCacheAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse CloseJob(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new ClearTrainedModelDeploymentCacheRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseJobResponse CloseJob(CloseJobRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.CloseJobResponse CloseJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseJobAsync(CloseJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CloseJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseJobResponse CloseJob(CloseJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CloseJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseJobResponse CloseJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual System.Threading.Tasks.Task CloseJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CloseJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CloseJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloseJobResponse CloseJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse DeleteCalendar(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest request) { - var descriptor = new CloseJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseJobAsync(CloseJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse DeleteCalendar(Elastic.Clients.Elasticsearch.Id calendarId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarResponse DeleteCalendar(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action) { - var descriptor = new CloseJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Close anomaly detection jobs. - /// A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. - /// When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. - /// If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. - /// When a datafeed that has a specified end date stops, it automatically closes its associated job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloseJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CloseJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarResponse DeleteCalendar(DeleteCalendarRequest request) + public virtual System.Threading.Tasks.Task DeleteCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(calendarId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarAsync(DeleteCalendarRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarResponse DeleteCalendar(DeleteCalendarRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse DeleteCalendarEvent(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarResponse DeleteCalendar(Elastic.Clients.Elasticsearch.Id calendarId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse DeleteCalendarEvent(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId) { - var descriptor = new DeleteCalendarRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(calendarId, eventId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarResponse DeleteCalendar(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventResponse DeleteCalendarEvent(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, System.Action action) { - var descriptor = new DeleteCalendarRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(calendarId, eventId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarAsync(DeleteCalendarRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarEventAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarEventAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(calendarId, eventId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a calendar. - /// Removes all scheduled events from a calendar, then deletes it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarEventAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarEventRequestDescriptor(calendarId, eventId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarEventResponse DeleteCalendarEvent(DeleteCalendarEventRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse DeleteCalendarJob(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarEventAsync(DeleteCalendarEventRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse DeleteCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(calendarId, jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarEventResponse DeleteCalendarEvent(DeleteCalendarEventRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobResponse DeleteCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(calendarId, jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarEventResponse DeleteCalendarEvent(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId) + public virtual System.Threading.Tasks.Task DeleteCalendarJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarEventRequestDescriptor(calendarId, eventId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarEventResponse DeleteCalendarEvent(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarEventRequestDescriptor(calendarId, eventId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(calendarId, jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarEventAsync(DeleteCalendarEventRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteCalendarJobRequestDescriptor(calendarId, jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarEventAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse DeleteDatafeed(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest request) { - var descriptor = new DeleteCalendarEventRequestDescriptor(calendarId, eventId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete events from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarEventAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Id eventId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse DeleteDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) { - var descriptor = new DeleteCalendarEventRequestDescriptor(calendarId, eventId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarJobResponse DeleteCalendarJob(DeleteCalendarJobRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedResponse DeleteDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarJobAsync(DeleteCalendarJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDatafeedAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarJobResponse DeleteCalendarJob(DeleteCalendarJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarJobResponse DeleteCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) + public virtual System.Threading.Tasks.Task DeleteDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarJobRequestDescriptor(calendarId, jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteCalendarJobResponse DeleteCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest request) { - var descriptor = new DeleteCalendarJobRequestDescriptor(calendarId, jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarJobAsync(DeleteCalendarJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new DeleteCalendarJobRequestDescriptor(calendarId, jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete anomaly jobs from a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteCalendarJobRequestDescriptor(calendarId, jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDatafeedResponse DeleteDatafeed(DeleteDatafeedRequest request) + public virtual System.Threading.Tasks.Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDatafeedAsync(DeleteDatafeedRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDatafeedResponse DeleteDatafeed(DeleteDatafeedRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse DeleteExpiredData(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDatafeedResponse DeleteDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse DeleteExpiredData() { - var descriptor = new DeleteDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDatafeedResponse DeleteDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse DeleteExpiredData(System.Action action) { - var descriptor = new DeleteDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDatafeedAsync(DeleteDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse DeleteExpiredData(Elastic.Clients.Elasticsearch.Id? jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataResponse DeleteExpiredData(Elastic.Clients.Elasticsearch.Id? jobId, System.Action action) { - var descriptor = new DeleteDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a datafeed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteExpiredDataAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(DeleteDataFrameAnalyticsRequest request) + public virtual System.Threading.Tasks.Task DeleteExpiredDataAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(DeleteDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteExpiredDataAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(DeleteDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteExpiredDataAsync(Elastic.Clients.Elasticsearch.Id? jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task DeleteExpiredDataAsync(Elastic.Clients.Elasticsearch.Id? jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteExpiredDataRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse DeleteFilter(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest request) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(DeleteDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse DeleteFilter(Elastic.Clients.Elasticsearch.Id filterId) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterResponse DeleteFilter(Elastic.Clients.Elasticsearch.Id filterId, System.Action action) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteDataFrameAnalyticsResponse DeleteDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteFilterAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(DeleteDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest request) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteDataFrameAnalyticsResponse, DeleteDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(DeleteDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId) { - var descriptor = new DeleteDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId, forecastId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData(DeleteExpiredDataRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId, forecastId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(DeleteExpiredDataRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData(DeleteExpiredDataRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData(Elastic.Clients.Elasticsearch.Id? jobId) + public virtual System.Threading.Tasks.Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData(Elastic.Clients.Elasticsearch.Id? jobId, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId, forecastId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData() + public virtual System.Threading.Tasks.Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteForecastRequestDescriptor(jobId, forecastId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteExpiredDataResponse DeleteExpiredData(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest request) { - var descriptor = new DeleteExpiredDataRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(DeleteExpiredDataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(Elastic.Clients.Elasticsearch.Id? jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new DeleteExpiredDataRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(Elastic.Clients.Elasticsearch.Id? jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete expired ML data. - /// Deletes all job results, model snapshots and forecast data that have exceeded - /// their retention days period. Machine learning state documents that are not - /// associated with any job are also deleted. - /// You can limit the request to a single or set of anomaly detection jobs by - /// using a job identifier, a group name, a comma-separated list of jobs, or a - /// wildcard expression. You can delete expired data for all anomaly detection - /// jobs by using _all, by specifying * as the <job_id>, or by omitting the - /// <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteExpiredDataAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteExpiredDataRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteFilterResponse DeleteFilter(DeleteFilterRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse DeleteModelSnapshot(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteFilterAsync(DeleteFilterRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse DeleteModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteFilterResponse DeleteFilter(DeleteFilterRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotResponse DeleteModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteFilterResponse DeleteFilter(Elastic.Clients.Elasticsearch.Id filterId) + public virtual System.Threading.Tasks.Task DeleteModelSnapshotAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteFilterResponse DeleteFilter(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteFilterAsync(DeleteFilterRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse DeleteTrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest request) { - var descriptor = new DeleteFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a filter. - /// If an anomaly detection job references the filter, you cannot delete the - /// filter. You must update or delete the job before you can delete the filter. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse DeleteTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) { - var descriptor = new DeleteFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(DeleteForecastRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelResponse DeleteTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(DeleteForecastRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(DeleteForecastRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteForecastRequestDescriptor(jobId, forecastId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest request) { - var descriptor = new DeleteForecastRequestDescriptor(jobId, forecastId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) { - var descriptor = new DeleteForecastRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteForecastResponse DeleteForecast(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Action action) { - var descriptor = new DeleteForecastRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(DeleteForecastRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteForecastRequestDescriptor(jobId, forecastId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? forecastId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteForecastRequestDescriptor(jobId, forecastId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse EstimateModelMemory(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest request) { - var descriptor = new DeleteForecastRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete forecasts from a job. - /// By default, forecasts are retained for 14 days. You can specify a - /// different retention period with the expires_in parameter in the forecast - /// jobs API. The delete forecast API enables you to delete one or more - /// forecasts before they expire. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse EstimateModelMemory() { - var descriptor = new DeleteForecastRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(DeleteJobRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse EstimateModelMemory(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(DeleteJobRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryResponse EstimateModelMemory(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(DeleteJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task EstimateModelMemoryAsync(Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual System.Threading.Tasks.Task EstimateModelMemoryAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual System.Threading.Tasks.Task EstimateModelMemoryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(DeleteJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EstimateModelMemoryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EstimateModelMemoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse EvaluateDataFrame(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest request) { - var descriptor = new DeleteJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an anomaly detection job. - /// All job configuration, model state and results are deleted. - /// It is not currently possible to delete multiple jobs using wildcards or a - /// comma separated list. If you delete a job that has a datafeed, the request - /// first tries to delete the datafeed. This behavior is equivalent to calling - /// the delete datafeed API with the same timeout and force parameters as the - /// delete job request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse EvaluateDataFrame(System.Action action) { - var descriptor = new DeleteJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelSnapshotResponse DeleteModelSnapshot(DeleteModelSnapshotRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameResponse EvaluateDataFrame(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteModelSnapshotAsync(DeleteModelSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EvaluateDataFrameAsync(Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelSnapshotResponse DeleteModelSnapshot(DeleteModelSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task EvaluateDataFrameAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelSnapshotResponse DeleteModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + public virtual System.Threading.Tasks.Task EvaluateDataFrameAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EvaluateDataFrameRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelSnapshotResponse DeleteModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest request) { - var descriptor = new DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteModelSnapshotAsync(DeleteModelSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(System.Action action) { - var descriptor = new DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a model snapshot. - /// You cannot delete the active model snapshot. To delete that snapshot, first - /// revert to a different one. To identify the active model snapshot, refer to - /// the model_snapshot_id in the results from the get jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new DeleteModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelResponse DeleteTrainedModel(DeleteTrainedModelRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAsync(DeleteTrainedModelRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelResponse DeleteTrainedModel(DeleteTrainedModelRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelResponse DeleteTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelResponse DeleteTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAsync(DeleteTrainedModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete an unreferenced trained model. - /// The request deletes a trained inference model that is not referenced by an ingest pipeline. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(DeleteTrainedModelAliasRequest request) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAliasAsync(DeleteTrainedModelAliasRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ExplainDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(DeleteTrainedModelAliasRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse FlushJob(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse FlushJob(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTrainedModelAliasResponse DeleteTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.FlushJobResponse FlushJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAliasAsync(DeleteTrainedModelAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a trained model alias. - /// This API deletes an existing model alias that refers to a trained model. If - /// the model alias is missing or refers to a model other than the one identified - /// by the model_id, this API returns an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FlushJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTrainedModelAliasRequestDescriptor(modelId, modelAlias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FlushJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory(EstimateModelMemoryRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse Forecast(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(EstimateModelMemoryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse Forecast(Elastic.Clients.Elasticsearch.Id jobId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory(EstimateModelMemoryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ForecastResponse Forecast(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory() + public virtual System.Threading.Tasks.Task ForecastAsync(Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory(Action> configureRequest) + public virtual System.Threading.Tasks.Task ForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory(EstimateModelMemoryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ForecastRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest request) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EstimateModelMemoryResponse EstimateModelMemory(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(EstimateModelMemoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EstimateModelMemoryResponse, EstimateModelMemoryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(EstimateModelMemoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Estimate job model memory usage. - /// Makes an estimation of the memory usage for an anomaly detection job model. - /// It is based on analysis configuration details for the job and cardinality - /// estimates for the fields it references. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EstimateModelMemoryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EstimateModelMemoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame(EvaluateDataFrameRequest request) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(EvaluateDataFrameRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame(EvaluateDataFrameRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame() + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame(Action> configureRequest) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.DateTimeOffset? timestamp, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId, timestamp); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame(EvaluateDataFrameRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse GetCalendarEvents(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest request) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EvaluateDataFrameResponse EvaluateDataFrame(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse GetCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(EvaluateDataFrameRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsResponse GetCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarEventsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, EvaluateDataFrameResponse, EvaluateDataFrameRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(EvaluateDataFrameRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarEventsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse GetCalendars(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest request) { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate data frame analytics. - /// The API packages together commonly used evaluation metrics for various types - /// of machine learning features. This has been designed for use on indexes - /// created by data frame analytics. Evaluation requires both a ground truth - /// field and an analytics result field to be present. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EvaluateDataFrameAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse GetCalendars() { - var descriptor = new EvaluateDataFrameRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(ExplainDataFrameAnalyticsRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse GetCalendars(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(ExplainDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse GetCalendars(Elastic.Clients.Elasticsearch.Id? calendarId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(calendarId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(ExplainDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsResponse GetCalendars(Elastic.Clients.Elasticsearch.Id? calendarId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics() - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Action> configureRequest) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(ExplainDataFrameAnalyticsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics() - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainDataFrameAnalyticsResponse ExplainDataFrameAnalytics(Action configureRequest) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(ExplainDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainDataFrameAnalyticsResponse, ExplainDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(ExplainDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Explain data frame analytics config. - /// This API provides explanations for a data frame analytics config that either - /// exists already or one that has not been created yet. The following - /// explanations are provided: - /// - /// - /// - /// - /// which fields are included or not in the analysis and why, - /// - /// - /// - /// - /// how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. - /// If you have object fields or fields that are excluded via source filtering, they are not included in the explanation. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExplainDataFrameAnalyticsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushJobResponse FlushJob(FlushJobRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushJobAsync(FlushJobRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushJobResponse FlushJob(FlushJobRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushJobResponse FlushJob(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new FlushJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FlushJobResponse FlushJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new FlushJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushJobAsync(FlushJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new FlushJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Force buffered data to be processed. - /// The flush jobs API is only applicable when sending data for analysis using - /// the post data API. Depending on the content of the buffer, then it might - /// additionally calculate new results. Both flush and close operations are - /// similar, however the flush is more efficient if you are expecting to send - /// more data for analysis. When flushing, the job remains open and is available - /// to continue analyzing data. A close operation additionally prunes and - /// persists the model state to disk and the job must be opened again before - /// analyzing further data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FlushJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FlushJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForecastResponse Forecast(ForecastRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForecastAsync(ForecastRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForecastResponse Forecast(ForecastRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForecastResponse Forecast(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new ForecastRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ForecastResponse Forecast(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new ForecastRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForecastAsync(ForecastRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new ForecastRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Predict future behavior of a time series. - /// - /// - /// Forecasts are not supported for jobs that perform population analysis; an - /// error occurs if you try to create a forecast for a job that has an - /// over_field_name in its configuration. Forcasts predict future behavior - /// based on historical data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ForecastAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ForecastRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(GetBucketsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(GetBucketsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(GetBucketsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetBucketsResponse, GetBucketsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - descriptor.BeforeRequest(); - return DoRequest, GetBucketsResponse, GetBucketsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, Action> configureRequest) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetBucketsResponse, GetBucketsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest, GetBucketsResponse, GetBucketsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetBucketsResponse, GetBucketsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(GetBucketsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, Action configureRequest) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBucketsResponse GetBuckets(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(GetBucketsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetBucketsResponse, GetBucketsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - descriptor.BeforeRequest(); - return DoRequestAsync, GetBucketsResponse, GetBucketsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetBucketsResponse, GetBucketsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync, GetBucketsResponse, GetBucketsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetBucketsResponse, GetBucketsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(GetBucketsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, DateTimeOffset? timestamp, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId, timestamp); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for buckets. - /// The API presents a chronological view of the records, grouped by bucket. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarEventsResponse GetCalendarEvents(GetCalendarEventsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarEventsAsync(GetCalendarEventsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarEventsResponse GetCalendarEvents(GetCalendarEventsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarEventsResponse GetCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId) - { - var descriptor = new GetCalendarEventsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarEventsResponse GetCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest) - { - var descriptor = new GetCalendarEventsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarEventsAsync(GetCalendarEventsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarEventsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get info about events in calendars. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarEventsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars(GetCalendarsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(GetCalendarsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars(GetCalendarsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars(Elastic.Clients.Elasticsearch.Id? calendarId) - { - var descriptor = new GetCalendarsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars(Elastic.Clients.Elasticsearch.Id? calendarId, Action configureRequest) - { - var descriptor = new GetCalendarsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars() - { - var descriptor = new GetCalendarsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCalendarsResponse GetCalendars(Action configureRequest) - { - var descriptor = new GetCalendarsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(GetCalendarsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(Elastic.Clients.Elasticsearch.Id? calendarId, CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(Elastic.Clients.Elasticsearch.Id? calendarId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get calendar configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCalendarsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetCalendarsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(GetCategoriesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(GetCategoriesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(GetCategoriesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId, categoryId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, Action configureRequest) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId, categoryId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(GetCategoriesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, CancellationToken cancellationToken = default) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId, categoryId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId, categoryId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for categories. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetCategoriesRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds(GetDatafeedsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(GetDatafeedsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds(GetDatafeedsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds(Elastic.Clients.Elasticsearch.Ids? datafeedId) - { - var descriptor = new GetDatafeedsRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds(Elastic.Clients.Elasticsearch.Ids? datafeedId, Action configureRequest) - { - var descriptor = new GetDatafeedsRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds() - { - var descriptor = new GetDatafeedsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedsResponse GetDatafeeds(Action configureRequest) - { - var descriptor = new GetDatafeedsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(GetDatafeedsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedsRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedsRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds configuration info. - /// You can get information for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get information for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats(GetDatafeedStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(GetDatafeedStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats(GetDatafeedStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats(Elastic.Clients.Elasticsearch.Ids? datafeedId) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats(Elastic.Clients.Elasticsearch.Ids? datafeedId, Action configureRequest) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats() - { - var descriptor = new GetDatafeedStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDatafeedStatsResponse GetDatafeedStats(Action configureRequest) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(GetDatafeedStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get datafeeds usage info. - /// You can get statistics for multiple datafeeds in a single API request by - /// using a comma-separated list of datafeeds or a wildcard expression. You can - /// get statistics for all datafeeds by using _all, by specifying * as the - /// <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the - /// only information you receive is the datafeed_id and the state. - /// This API returns a maximum of 10,000 datafeeds. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDatafeedStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDatafeedStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(GetDataFrameAnalyticsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(GetDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(GetDataFrameAnalyticsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics() - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Action> configureRequest) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(GetDataFrameAnalyticsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics() - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Action configureRequest) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(GetDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsResponse, GetDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(GetDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics job configuration info. - /// You can get information for multiple data frame analytics jobs in a single - /// API request by using a comma-separated list of data frame analytics jobs or a - /// wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(GetDataFrameAnalyticsStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(GetDataFrameAnalyticsStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(GetDataFrameAnalyticsStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats() - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Action> configureRequest) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(GetDataFrameAnalyticsStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats() - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Action configureRequest) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(GetDataFrameAnalyticsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetDataFrameAnalyticsStatsResponse, GetDataFrameAnalyticsStatsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(GetDataFrameAnalyticsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get data frame analytics jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetDataFrameAnalyticsStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetDataFrameAnalyticsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters(GetFiltersRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(GetFiltersRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters(GetFiltersRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters(Elastic.Clients.Elasticsearch.Ids? filterId) - { - var descriptor = new GetFiltersRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters(Elastic.Clients.Elasticsearch.Ids? filterId, Action configureRequest) - { - var descriptor = new GetFiltersRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters() - { - var descriptor = new GetFiltersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetFiltersResponse GetFilters(Action configureRequest) - { - var descriptor = new GetFiltersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(GetFiltersRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(Elastic.Clients.Elasticsearch.Ids? filterId, CancellationToken cancellationToken = default) - { - var descriptor = new GetFiltersRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(Elastic.Clients.Elasticsearch.Ids? filterId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetFiltersRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetFiltersRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get filters. - /// You can get a single filter or all filters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetFiltersAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetFiltersRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(GetInfluencersRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(GetInfluencersRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(GetInfluencersRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(GetInfluencersRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(GetInfluencersRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetInfluencersResponse, GetInfluencersRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(GetInfluencersRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job results for influencers. - /// Influencers are the entities that have contributed to, or are to blame for, - /// the anomalies. Influencer results are available only if an - /// influencer_field_name is specified in the job configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetInfluencersRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(GetJobsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(GetJobsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(GetJobsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Ids? jobId) - { - var descriptor = new GetJobsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Ids? jobId, Action configureRequest) - { - var descriptor = new GetJobsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs() - { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Action configureRequest) - { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(GetJobsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Ids? jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Ids? jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs configuration info. - /// You can get information for multiple anomaly detection jobs in a single API - /// request by using a group name, a comma-separated list of jobs, or a wildcard - /// expression. You can get information for all anomaly detection jobs by using - /// _all, by specifying * as the <job_id>, or by omitting the <job_id>. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats(GetJobStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(GetJobStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats(GetJobStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats(Elastic.Clients.Elasticsearch.Id? jobId) - { - var descriptor = new GetJobStatsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats(Elastic.Clients.Elasticsearch.Id? jobId, Action configureRequest) - { - var descriptor = new GetJobStatsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats() - { - var descriptor = new GetJobStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobStatsResponse GetJobStats(Action configureRequest) - { - var descriptor = new GetJobStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(GetJobStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(Elastic.Clients.Elasticsearch.Id? jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobStatsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(Elastic.Clients.Elasticsearch.Id? jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobStatsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetJobStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection jobs usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats(GetMemoryStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(GetMemoryStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats(GetMemoryStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats(Elastic.Clients.Elasticsearch.Id? nodeId) - { - var descriptor = new GetMemoryStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats(Elastic.Clients.Elasticsearch.Id? nodeId, Action configureRequest) - { - var descriptor = new GetMemoryStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats() - { - var descriptor = new GetMemoryStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetMemoryStatsResponse GetMemoryStats(Action configureRequest) - { - var descriptor = new GetMemoryStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(GetMemoryStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(Elastic.Clients.Elasticsearch.Id? nodeId, CancellationToken cancellationToken = default) - { - var descriptor = new GetMemoryStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(Elastic.Clients.Elasticsearch.Id? nodeId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetMemoryStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetMemoryStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get machine learning memory usage info. - /// Get information about how machine learning jobs and trained models are using memory, - /// on each node, both within the JVM heap, and natively, outside of the JVM. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetMemoryStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetMemoryStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(GetModelSnapshotsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(GetModelSnapshotsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(GetModelSnapshotsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, Action> configureRequest) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(GetModelSnapshotsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, Action configureRequest) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(GetModelSnapshotsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetModelSnapshotsResponse, GetModelSnapshotsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(GetModelSnapshotsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get model snapshots info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(GetModelSnapshotUpgradeStatsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotUpgradeStatsAsync(GetModelSnapshotUpgradeStatsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(GetModelSnapshotUpgradeStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) - { - var descriptor = new GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest) - { - var descriptor = new GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotUpgradeStatsAsync(GetModelSnapshotUpgradeStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotUpgradeStatsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly detection job model snapshot upgrade usage info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetModelSnapshotUpgradeStatsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetOverallBucketsResponse GetOverallBuckets(GetOverallBucketsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetOverallBucketsAsync(GetOverallBucketsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetOverallBucketsResponse GetOverallBuckets(GetOverallBucketsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetOverallBucketsResponse GetOverallBuckets(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetOverallBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetOverallBucketsResponse GetOverallBuckets(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetOverallBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetOverallBucketsAsync(GetOverallBucketsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetOverallBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) - { - var descriptor = new GetOverallBucketsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get overall bucket results. - /// - /// - /// Retrievs overall bucket results that summarize the bucket results of - /// multiple anomaly detection jobs. - /// - /// - /// The overall_score is calculated by combining the scores of all the - /// buckets within the overall bucket span. First, the maximum - /// anomaly_score per anomaly detection job in the overall bucket is - /// calculated. Then the top_n of those scores are averaged to result in - /// the overall_score. This means that you can fine-tune the - /// overall_score so that it is more or less sensitive to the number of - /// jobs that detect an anomaly at the same time. For example, if you set - /// top_n to 1, the overall_score is the maximum bucket score in the - /// overall bucket. Alternatively, if you set top_n to the number of jobs, - /// the overall_score is high only when all jobs detect anomalies in that - /// overall bucket. If you set the bucket_span parameter (to a value - /// greater than its default), the overall_score is the maximum - /// overall_score of the overall buckets that have a span equal to the - /// jobs' largest bucket span. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetOverallBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetOverallBucketsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(GetRecordsRequest request) + public virtual System.Threading.Tasks.Task GetCalendarsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(GetRecordsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(GetRecordsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetRecordsResponse, GetRecordsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetRecordsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest, GetRecordsResponse, GetRecordsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest) - { - var descriptor = new GetRecordsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetRecordsResponse, GetRecordsRequestParameters>(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(GetRecordsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId) - { - var descriptor = new GetRecordsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) - { - var descriptor = new GetRecordsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(GetRecordsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetRecordsResponse, GetRecordsRequestParameters>(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRecordsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRecordsResponse, GetRecordsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarsAsync(Elastic.Clients.Elasticsearch.Id? calendarId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRecordsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRecordsResponse, GetRecordsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(GetRecordsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCalendarsAsync(Elastic.Clients.Elasticsearch.Id? calendarId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCalendarsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest request) { - var descriptor = new GetRecordsRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get anomaly records for an anomaly detection job. - /// Records contain the detailed analytical results. They describe the anomalous - /// activity that has been identified in the input data based on the detector - /// configuration. - /// There can be many anomaly records depending on the characteristics and size - /// of the input data. In practice, there are often too many to be able to - /// manually process them. The machine learning features therefore perform a - /// sophisticated aggregation of the anomaly records into buckets. - /// The number of record results depends on the number of anomalies found in each - /// bucket, which relates to the number of time series being modeled and the - /// number of detectors. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId) { - var descriptor = new GetRecordsRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId, categoryId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels(GetTrainedModelsRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId, categoryId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(GetTrainedModelsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels(GetTrainedModelsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesResponse GetCategories(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels(Elastic.Clients.Elasticsearch.Ids? modelId) + public virtual System.Threading.Tasks.Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels(Elastic.Clients.Elasticsearch.Ids? modelId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId, categoryId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels() + public virtual System.Threading.Tasks.Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, string? categoryId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId, categoryId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsResponse GetTrainedModels(Action configureRequest) + public virtual System.Threading.Tasks.Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(GetTrainedModelsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetCategoriesAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetCategoriesRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse GetDatafeeds(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest request) { - var descriptor = new GetTrainedModelsRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse GetDatafeeds() { - var descriptor = new GetTrainedModelsRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse GetDatafeeds(System.Action action) { - var descriptor = new GetTrainedModelsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained model configuration info. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse GetDatafeeds(Elastic.Clients.Elasticsearch.Ids? datafeedId) { - var descriptor = new GetTrainedModelsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats(GetTrainedModelsStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsResponse GetDatafeeds(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(GetTrainedModelsStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDatafeedsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats(GetTrainedModelsStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetDatafeedsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats(Elastic.Clients.Elasticsearch.Ids? modelId) + public virtual System.Threading.Tasks.Task GetDatafeedsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats(Elastic.Clients.Elasticsearch.Ids? modelId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetDatafeedsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats() + public virtual System.Threading.Tasks.Task GetDatafeedsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedsRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTrainedModelsStatsResponse GetTrainedModelsStats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse GetDatafeedStats(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest request) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(GetTrainedModelsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse GetDatafeedStats() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse GetDatafeedStats(System.Action action) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse GetDatafeedStats(Elastic.Clients.Elasticsearch.Ids? datafeedId) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsResponse GetDatafeedStats(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Action action) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get trained models usage info. - /// You can get usage information for multiple trained - /// models in a single API request by using a comma-separated list of model IDs or a wildcard expression. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTrainedModelsStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDatafeedStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTrainedModelsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(InferTrainedModelRequest request) + public virtual System.Threading.Tasks.Task GetDatafeedStatsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(InferTrainedModelRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDatafeedStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(InferTrainedModelRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetDatafeedStatsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) + + public virtual System.Threading.Tasks.Task GetDatafeedStatsAsync(Elastic.Clients.Elasticsearch.Ids? datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDatafeedStatsRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest request) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(InferTrainedModelRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse GetDataFrameAnalytics() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse GetDataFrameAnalytics(System.Action action) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(InferTrainedModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsResponse GetDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, InferTrainedModelResponse, InferTrainedModelRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(InferTrainedModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Evaluate a trained model. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new InferTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MlInfoResponse Info(MlInfoRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(MlInfoRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MlInfoResponse Info(MlInfoRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MlInfoResponse Info() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new MlInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MlInfoResponse Info(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsResponse GetDataFrameAnalyticsStats(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new MlInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(MlInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MlInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get machine learning information. - /// Get defaults and limits used by machine learning. - /// This endpoint is designed to be used by a user interface that needs to fully - /// understand machine learning configurations where some options are not - /// specified, meaning that the defaults should be used. This endpoint may be - /// used to find out what those defaults are. It also provides information about - /// the maximum size of machine learning jobs that could run in the current - /// cluster configuration. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MlInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenJobResponse OpenJob(OpenJobRequest request) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenJobAsync(OpenJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetDataFrameAnalyticsStatsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetDataFrameAnalyticsStatsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenJobResponse OpenJob(OpenJobRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse GetFilters(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenJobResponse OpenJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse GetFilters() { - var descriptor = new OpenJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenJobResponse OpenJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse GetFilters(System.Action action) { - var descriptor = new OpenJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenJobAsync(OpenJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse GetFilters(Elastic.Clients.Elasticsearch.Ids? filterId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersResponse GetFilters(Elastic.Clients.Elasticsearch.Ids? filterId, System.Action action) { - var descriptor = new OpenJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Open anomaly detection jobs. - /// An anomaly detection job must be opened to be ready to receive and analyze - /// data. It can be opened and closed multiple times throughout its lifecycle. - /// When you open a new job, it starts with an empty model. - /// When you open an existing job, the most recent model state is automatically - /// loaded. The job is ready to resume its analysis from where it left off, once - /// new data is received. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFiltersAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new OpenJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostCalendarEventsResponse PostCalendarEvents(PostCalendarEventsRequest request) + public virtual System.Threading.Tasks.Task GetFiltersAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostCalendarEventsAsync(PostCalendarEventsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetFiltersAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostCalendarEventsResponse PostCalendarEvents(PostCalendarEventsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetFiltersAsync(Elastic.Clients.Elasticsearch.Ids? filterId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostCalendarEventsResponse PostCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId) + public virtual System.Threading.Tasks.Task GetFiltersAsync(Elastic.Clients.Elasticsearch.Ids? filterId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostCalendarEventsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetFiltersRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostCalendarEventsResponse PostCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest request) { - var descriptor = new PostCalendarEventsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostCalendarEventsAsync(PostCalendarEventsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new PostCalendarEventsRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add scheduled events to the calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersResponse GetInfluencers(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action) { - var descriptor = new PostCalendarEventsRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(PreviewDataFrameAnalyticsRequest request) + public virtual System.Threading.Tasks.Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(PreviewDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(PreviewDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) + public virtual System.Threading.Tasks.Task GetInfluencersAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetInfluencersRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest request) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse GetJobs() { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse GetJobs(System.Action action) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(PreviewDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Ids? jobId) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Ids? jobId, System.Action action) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics() + public virtual System.Threading.Tasks.Task GetJobsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Action configureRequest) + public virtual System.Threading.Tasks.Task GetJobsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(PreviewDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.Ids? jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.Ids? jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse GetJobStats(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest request) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse GetJobStats() { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse GetJobStats(System.Action action) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewDataFrameAnalyticsResponse, PreviewDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(PreviewDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse GetJobStats(Elastic.Clients.Elasticsearch.Id? jobId) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsResponse GetJobStats(Elastic.Clients.Elasticsearch.Id? jobId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview features used by data frame analytics. - /// Previews the extracted features used by a data frame analytics config. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PreviewDataFrameAnalyticsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobStatsAsync(Elastic.Clients.Elasticsearch.Id? jobId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewDataFrameAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarResponse PutCalendar(PutCalendarRequest request) + public virtual System.Threading.Tasks.Task GetJobStatsAsync(Elastic.Clients.Elasticsearch.Id? jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetJobStatsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarAsync(PutCalendarRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse GetMemoryStats(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarResponse PutCalendar(PutCalendarRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse GetMemoryStats() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarResponse PutCalendar(Elastic.Clients.Elasticsearch.Id calendarId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse GetMemoryStats(System.Action action) { - var descriptor = new PutCalendarRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarResponse PutCalendar(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse GetMemoryStats(Elastic.Clients.Elasticsearch.Id? nodeId) { - var descriptor = new PutCalendarRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarAsync(PutCalendarRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsResponse GetMemoryStats(Elastic.Clients.Elasticsearch.Id? nodeId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMemoryStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutCalendarRequestDescriptor(calendarId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMemoryStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutCalendarRequestDescriptor(calendarId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarJobResponse PutCalendarJob(PutCalendarJobRequest request) + public virtual System.Threading.Tasks.Task GetMemoryStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarJobAsync(PutCalendarJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetMemoryStatsAsync(Elastic.Clients.Elasticsearch.Id? nodeId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(nodeId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarJobResponse PutCalendarJob(PutCalendarJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetMemoryStatsAsync(Elastic.Clients.Elasticsearch.Id? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetMemoryStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarJobResponse PutCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest request) { - var descriptor = new PutCalendarJobRequestDescriptor(calendarId, jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutCalendarJobResponse PutCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId) { - var descriptor = new PutCalendarJobRequestDescriptor(calendarId, jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarJobAsync(PutCalendarJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new PutCalendarJobRequestDescriptor(calendarId, jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Add anomaly detection job to calendar. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new PutCalendarJobRequestDescriptor(calendarId, jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(PutDatafeedRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(PutDatafeedRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsResponse GetModelSnapshots(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(PutDatafeedRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(PutDatafeedRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id? snapshotId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(PutDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetModelSnapshotsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest request) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutDatafeedResponse, PutDatafeedRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(PutDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsResponse GetModelSnapshotUpgradeStats(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetModelSnapshotUpgradeStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a datafeed. - /// Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. - /// You can associate only one datafeed with each anomaly detection job. - /// The datafeed contains a query that runs at a defined interval (frequency). - /// If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had - /// at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - /// directly to the .ml-config index. Do not give users write privileges on the .ml-config index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetModelSnapshotUpgradeStatsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(PutDataFrameAnalyticsRequest request) + public virtual System.Threading.Tasks.Task GetModelSnapshotUpgradeStatsAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetModelSnapshotUpgradeStatsRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(PutDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse GetOverallBuckets(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(PutDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse GetOverallBuckets(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequest, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsResponse GetOverallBuckets(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetOverallBucketsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(PutDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetOverallBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task GetOverallBucketsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetOverallBucketsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest request) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(PutDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsResponse GetRecords(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRecordsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutDataFrameAnalyticsResponse, PutDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(PutDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a data frame analytics job. - /// This API creates a data frame analytics job that performs an analysis on the - /// source indices and stores the outcome in a destination index. - /// By default, the query used in the source configuration is {"match_all": {}}. - /// - /// - /// If the destination index does not exist, it is created automatically when you start the job. - /// - /// - /// If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRecordsAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetRecordsRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutFilterResponse PutFilter(PutFilterRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse GetTrainedModels(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutFilterAsync(PutFilterRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse GetTrainedModels() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutFilterResponse PutFilter(PutFilterRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse GetTrainedModels(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutFilterResponse PutFilter(Elastic.Clients.Elasticsearch.Id filterId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse GetTrainedModels(Elastic.Clients.Elasticsearch.Ids? modelId) { - var descriptor = new PutFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutFilterResponse PutFilter(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsResponse GetTrainedModels(Elastic.Clients.Elasticsearch.Ids? modelId, System.Action action) { - var descriptor = new PutFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutFilterAsync(PutFilterRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrainedModelsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrainedModelsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a filter. - /// A filter contains a list of strings. It can be used by one or more anomaly detection jobs. - /// Specifically, filters are referenced in the custom_rules property of detector configuration objects. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrainedModelsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequest request) + public virtual System.Threading.Tasks.Task GetTrainedModelsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(modelId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrainedModelsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse GetTrainedModelsStats(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest request) { - descriptor.BeforeRequest(); - return DoRequest, PutJobResponse, PutJobRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse GetTrainedModelsStats() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse GetTrainedModelsStats(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutJobResponse, PutJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an anomaly detection job. - /// If you include a datafeed_config, you must have read index privileges on the source index. - /// If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse GetTrainedModelsStats(Elastic.Clients.Elasticsearch.Ids? modelId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(PutTrainedModelRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsResponse GetTrainedModelsStats(Elastic.Clients.Elasticsearch.Ids? modelId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(PutTrainedModelRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTrainedModelsStatsAsync(Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(PutTrainedModelRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetTrainedModelsStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) + public virtual System.Threading.Tasks.Task GetTrainedModelsStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, Action> configureRequest) + public virtual System.Threading.Tasks.Task GetTrainedModelsStatsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(PutTrainedModelRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetTrainedModelsStatsAsync(Elastic.Clients.Elasticsearch.Ids? modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.GetTrainedModelsStatsRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest request) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(PutTrainedModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelResponse InferTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, System.Action> action) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTrainedModelResponse, PutTrainedModelRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(PutTrainedModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model. - /// Enable you to supply a trained model that is not created by data frame analytics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InferTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelAliasResponse PutTrainedModelAlias(PutTrainedModelAliasRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse Info(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAliasAsync(PutTrainedModelAliasRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse Info() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelAliasResponse PutTrainedModelAlias(PutTrainedModelAliasRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.MlInfoResponse Info(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelAliasResponse PutTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelAliasResponse PutTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, Action configureRequest) + public virtual System.Threading.Tasks.Task InfoAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAliasAsync(PutTrainedModelAliasRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.MlInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse OpenJob(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest request) { - var descriptor = new PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a trained model alias. - /// A trained model alias is a logical name used to reference a single trained - /// model. - /// You can use aliases instead of trained model identifiers to make it easier to - /// reference your models. For example, you can use aliases in inference - /// aggregations and processors. - /// An alias must be unique and refer to only a single trained model. However, - /// you can have multiple aliases for each trained model. - /// If you use this API to update an alias such that it references a different - /// trained model ID and the model uses a different type of data frame analytics, - /// an error occurs. For example, this situation occurs if you have a trained - /// model for regression analysis and a trained model for classification - /// analysis; you cannot reassign an alias from one type of trained model to - /// another. - /// If you use this API to update an alias and there are very few input fields in - /// common between the old and new trained models for the model alias, the API - /// returns a warning. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse OpenJob(Elastic.Clients.Elasticsearch.Id jobId) { - var descriptor = new PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(PutTrainedModelDefinitionPartRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.OpenJobResponse OpenJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelDefinitionPartAsync(PutTrainedModelDefinitionPartRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OpenJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(PutTrainedModelDefinitionPartRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task OpenJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OpenJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse PostCalendarEvents(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(Elastic.Clients.Elasticsearch.Id modelId, int part) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse PostCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId) { - var descriptor = new PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(Elastic.Clients.Elasticsearch.Id modelId, int part, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsResponse PostCalendarEvents(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action) { - var descriptor = new PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelDefinitionPartAsync(PutTrainedModelDefinitionPartRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostCalendarEventsAsync(Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelDefinitionPartAsync(Elastic.Clients.Elasticsearch.Id modelId, int part, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create part of a trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelDefinitionPartAsync(Elastic.Clients.Elasticsearch.Id modelId, int part, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostCalendarEventsAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PostCalendarEventsRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(PutTrainedModelVocabularyRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelVocabularyAsync(PutTrainedModelVocabularyRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(PutTrainedModelVocabularyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(Elastic.Clients.Elasticsearch.Id modelId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new PutTrainedModelVocabularyRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new PutTrainedModelVocabularyRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelVocabularyAsync(PutTrainedModelVocabularyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelVocabularyAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsResponse PreviewDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id? id, System.Action> action) { - var descriptor = new PutTrainedModelVocabularyRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a trained model vocabulary. - /// This API is supported only for natural language processing (NLP) models. - /// The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTrainedModelVocabularyAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutTrainedModelVocabularyRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetJobResponse ResetJob(ResetJobRequest request) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetJobAsync(ResetJobRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetJobResponse ResetJob(ResetJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetJobResponse ResetJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResetJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetJobResponse ResetJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ResetJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetJobAsync(ResetJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PreviewDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreviewDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse PutCalendar(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest request) { - var descriptor = new ResetJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reset an anomaly detection job. - /// All model state and results are deleted. The job is ready to start over as if - /// it had just been created. - /// It is not currently possible to reset multiple jobs using wildcards or a - /// comma separated list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse PutCalendar(Elastic.Clients.Elasticsearch.Id calendarId) { - var descriptor = new ResetJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RevertModelSnapshotResponse RevertModelSnapshot(RevertModelSnapshotRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarResponse PutCalendar(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RevertModelSnapshotAsync(RevertModelSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutCalendarAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RevertModelSnapshotResponse RevertModelSnapshot(RevertModelSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(calendarId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RevertModelSnapshotResponse RevertModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + public virtual System.Threading.Tasks.Task PutCalendarAsync(Elastic.Clients.Elasticsearch.Id calendarId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RevertModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarRequestDescriptor(calendarId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RevertModelSnapshotResponse RevertModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse PutCalendarJob(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest request) { - var descriptor = new RevertModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RevertModelSnapshotAsync(RevertModelSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse PutCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(calendarId, jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RevertModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobResponse PutCalendarJob(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Action action) { - var descriptor = new RevertModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(calendarId, jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Revert to a snapshot. - /// The machine learning features react quickly to anomalous input, learning new - /// behaviors in data. Highly anomalous input increases the variance in the - /// models whilst the system learns whether this is a new step-change in behavior - /// or a one-off event. In the case where this anomalous input is known to be a - /// one-off, then it might be appropriate to reset the model state to a time - /// before this event. For example, you might consider reverting to a saved - /// snapshot after Black Friday or a critical system failure. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RevertModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutCalendarJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RevertModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SetUpgradeModeResponse SetUpgradeMode(SetUpgradeModeRequest request) + public virtual System.Threading.Tasks.Task PutCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(calendarId, jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SetUpgradeModeAsync(SetUpgradeModeRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutCalendarJobAsync(Elastic.Clients.Elasticsearch.Id calendarId, Elastic.Clients.Elasticsearch.Ids jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutCalendarJobRequestDescriptor(calendarId, jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SetUpgradeModeResponse SetUpgradeMode(SetUpgradeModeRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SetUpgradeModeResponse SetUpgradeMode() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) { - var descriptor = new SetUpgradeModeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SetUpgradeModeResponse SetUpgradeMode(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action) { - var descriptor = new SetUpgradeModeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SetUpgradeModeAsync(SetUpgradeModeRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedResponse PutDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SetUpgradeModeAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SetUpgradeModeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Set upgrade_mode for ML indices. - /// Sets a cluster wide upgrade_mode setting that prepares machine learning - /// indices for an upgrade. - /// When upgrading your cluster, in some circumstances you must restart your - /// nodes and reindex your machine learning indices. In those circumstances, - /// there must be no machine learning jobs running. You can close the machine - /// learning jobs, do the upgrade, then open all the jobs again. Alternatively, - /// you can use this API to temporarily halt tasks associated with the jobs and - /// datafeeds and prevent new jobs from opening. You can also use this API - /// during upgrades that do not require you to reindex your machine learning - /// indices, though stopping jobs is not a requirement in that case. - /// You can see the current value for the upgrade_mode setting by using the get - /// machine learning info API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SetUpgradeModeAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SetUpgradeModeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDatafeedResponse StartDatafeed(StartDatafeedRequest request) + public virtual System.Threading.Tasks.Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDatafeedAsync(StartDatafeedRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDatafeedResponse StartDatafeed(StartDatafeedRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDatafeedResponse StartDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new StartDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDatafeedResponse StartDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new StartDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDatafeedAsync(StartDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsResponse PutDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start datafeeds. - /// - /// - /// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// - /// Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs. - /// - /// - /// If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. - /// If new data was indexed for that exact millisecond between stopping and starting, it will be ignored. - /// - /// - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or - /// update it had at the time of creation or update and runs the query using those same roles. If you provided secondary - /// authorization headers when you created or updated the datafeed, those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(StartDataFrameAnalyticsRequest request) + public virtual System.Threading.Tasks.Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(StartDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(StartDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse PutFilter(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest request) { - descriptor.BeforeRequest(); - return DoRequest, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse PutFilter(Elastic.Clients.Elasticsearch.Id filterId) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutFilterResponse PutFilter(Elastic.Clients.Elasticsearch.Id filterId, System.Action action) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(StartDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutFilterAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task PutFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task PutFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(StartDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse PutJob(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse PutJob(System.Action action) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutJobResponse PutJob(System.Action> action) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, StartDataFrameAnalyticsResponse, StartDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(StartDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutJobAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a data frame analytics job. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// If the destination index does not exist, it is created automatically the - /// first time you start the data frame analytics job. The - /// index.number_of_shards and index.number_of_replicas settings for the - /// destination index are copied from the source index. If there are multiple - /// source indices, the destination index copies the highest setting values. The - /// mappings for the destination index are also copied from the source indices. - /// If there are any mapping conflicts, the job fails to start. - /// If the destination index exists, it is used as is. You can therefore set up - /// the destination index in advance with custom settings and mappings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutJobAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutJobRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTrainedModelDeploymentResponse StartTrainedModelDeployment(StartTrainedModelDeploymentRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTrainedModelDeploymentAsync(StartTrainedModelDeploymentRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTrainedModelDeploymentResponse StartTrainedModelDeployment(StartTrainedModelDeploymentRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTrainedModelDeploymentResponse StartTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelResponse PutTrainedModel(Elastic.Clients.Elasticsearch.Id modelId, System.Action> action) { - var descriptor = new StartTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTrainedModelDeploymentResponse StartTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual System.Threading.Tasks.Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTrainedModelDeploymentAsync(StartTrainedModelDeploymentRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a trained model deployment. - /// It allocates the model to every machine learning node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDatafeedResponse StopDatafeed(StopDatafeedRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse PutTrainedModelAlias(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDatafeedAsync(StopDatafeedRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse PutTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDatafeedResponse StopDatafeed(StopDatafeedRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasResponse PutTrainedModelAlias(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDatafeedResponse StopDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual System.Threading.Tasks.Task PutTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDatafeedResponse StopDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest) + public virtual System.Threading.Tasks.Task PutTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDatafeedAsync(StopDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelAliasAsync(Elastic.Clients.Elasticsearch.Id modelId, Elastic.Clients.Elasticsearch.Name modelAlias, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelAliasRequestDescriptor(modelId, modelAlias); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest request) { - var descriptor = new StopDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop datafeeds. - /// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped - /// multiple times throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(Elastic.Clients.Elasticsearch.Id modelId, int part) { - var descriptor = new StopDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(StopDataFrameAnalyticsRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartResponse PutTrainedModelDefinitionPart(Elastic.Clients.Elasticsearch.Id modelId, int part, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(StopDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelDefinitionPartAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(StopDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutTrainedModelDefinitionPartAsync(Elastic.Clients.Elasticsearch.Id modelId, int part, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task PutTrainedModelDefinitionPartAsync(Elastic.Clients.Elasticsearch.Id modelId, int part, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelDefinitionPartRequestDescriptor(modelId, part); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest request) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(StopDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(Elastic.Clients.Elasticsearch.Id modelId) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyResponse PutTrainedModelVocabulary(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task PutTrainedModelVocabularyAsync(Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(StopDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelVocabularyAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTrainedModelVocabularyAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PutTrainedModelVocabularyRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse ResetJob(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest request) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, StopDataFrameAnalyticsResponse, StopDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(StopDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse ResetJob(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ResetJobResponse ResetJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop data frame analytics jobs. - /// A data frame analytics job can be started and stopped multiple times - /// throughout its lifecycle. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTrainedModelDeploymentResponse StopTrainedModelDeployment(StopTrainedModelDeploymentRequest request) + public virtual System.Threading.Tasks.Task ResetJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTrainedModelDeploymentAsync(StopTrainedModelDeploymentRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ResetJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTrainedModelDeploymentResponse StopTrainedModelDeployment(StopTrainedModelDeploymentRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse RevertModelSnapshot(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTrainedModelDeploymentResponse StopTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse RevertModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) { - var descriptor = new StopTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTrainedModelDeploymentResponse StopTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotResponse RevertModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action) { - var descriptor = new StopTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTrainedModelDeploymentAsync(StopTrainedModelDeploymentRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RevertModelSnapshotAsync(Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RevertModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RevertModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RevertModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(UpdateDatafeedRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse SetUpgradeMode(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(UpdateDatafeedRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse SetUpgradeMode() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(UpdateDatafeedRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeResponse SetUpgradeMode(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual System.Threading.Tasks.Task SetUpgradeModeAsync(Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action> configureRequest) + public virtual System.Threading.Tasks.Task SetUpgradeModeAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(UpdateDatafeedRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task SetUpgradeModeAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.SetUpgradeModeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse StartDatafeed(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest request) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse StartDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(UpdateDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedResponse StartDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartDatafeedAsync(Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDatafeedResponse, UpdateDatafeedRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(UpdateDatafeedRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest request) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a datafeed. - /// You must stop and start the datafeed for the changes to be applied. - /// When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at - /// the time of the update and runs the query using those same roles. If you provide secondary authorization headers, - /// those credentials are used instead. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new UpdateDatafeedRequestDescriptor(datafeedId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(UpdateDataFrameAnalyticsRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsResponse StartDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(UpdateDataFrameAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(UpdateDataFrameAnalyticsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task StartDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse StartTrainedModelDeployment(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest request) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(UpdateDataFrameAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse StartTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentResponse StartTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task StartTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(UpdateDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StartTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse StopDatafeed(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest request) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateDataFrameAnalyticsResponse, UpdateDataFrameAnalyticsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(UpdateDataFrameAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse StopDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedResponse StopDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a data frame analytics job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopDatafeedAsync(Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateDataFrameAnalyticsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateFilterResponse UpdateFilter(UpdateFilterRequest request) + public virtual System.Threading.Tasks.Task StopDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateFilterAsync(UpdateFilterRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateFilterResponse UpdateFilter(UpdateFilterRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateFilterResponse UpdateFilter(Elastic.Clients.Elasticsearch.Id filterId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new UpdateFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateFilterResponse UpdateFilter(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsResponse StopDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new UpdateFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateFilterAsync(UpdateFilterRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateFilterRequestDescriptor(filterId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a filter. - /// Updates the description of a filter, adds items, or removes items from the list. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateFilterRequestDescriptor(filterId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(UpdateJobRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse StopTrainedModelDeployment(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(UpdateJobRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse StopTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(UpdateJobRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentResponse StopTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, UpdateJobResponse, UpdateJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual System.Threading.Tasks.Task StopTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest, UpdateJobResponse, UpdateJobRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest) + public virtual System.Threading.Tasks.Task StopTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateJobResponse, UpdateJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(UpdateJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StopTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.StopTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest request) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(UpdateJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateJobResponse, UpdateJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedResponse UpdateDatafeed(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action> action) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateJobResponse, UpdateJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateJobResponse, UpdateJobRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(UpdateJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an anomaly detection job. - /// Updates certain properties of an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateDatafeedAsync(Elastic.Clients.Elasticsearch.Id datafeedId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateJobRequestDescriptor(jobId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDatafeedRequestDescriptor(datafeedId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateModelSnapshotResponse UpdateModelSnapshot(UpdateModelSnapshotRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateModelSnapshotAsync(UpdateModelSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateModelSnapshotResponse UpdateModelSnapshot(UpdateModelSnapshotRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsResponse UpdateDataFrameAnalytics(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateModelSnapshotResponse UpdateModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + public virtual System.Threading.Tasks.Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateModelSnapshotResponse UpdateModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest) + public virtual System.Threading.Tasks.Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateModelSnapshotAsync(UpdateModelSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateDataFrameAnalyticsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateDataFrameAnalyticsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse UpdateFilter(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest request) { - var descriptor = new UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a snapshot. - /// Updates certain properties of a snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse UpdateFilter(Elastic.Clients.Elasticsearch.Id filterId) { - var descriptor = new UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(UpdateTrainedModelDeploymentRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterResponse UpdateFilter(Elastic.Clients.Elasticsearch.Id filterId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTrainedModelDeploymentAsync(UpdateTrainedModelDeploymentRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateFilterAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(UpdateTrainedModelDeploymentRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(filterId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) + public virtual System.Threading.Tasks.Task UpdateFilterAsync(Elastic.Clients.Elasticsearch.Id filterId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateFilterRequestDescriptor(filterId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest request) { - var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTrainedModelDeploymentAsync(UpdateTrainedModelDeploymentRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action action) { - var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a trained model deployment. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobResponse UpdateJob(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action) { - var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeJobSnapshotResponse UpgradeJobSnapshot(UpgradeJobSnapshotRequest request) + public virtual System.Threading.Tasks.Task UpdateJobAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeJobSnapshotAsync(UpgradeJobSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeJobSnapshotResponse UpgradeJobSnapshot(UpgradeJobSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeJobSnapshotResponse UpgradeJobSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) + public virtual System.Threading.Tasks.Task UpdateJobAsync(Elastic.Clients.Elasticsearch.Id jobId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateJobRequestDescriptor(jobId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeJobSnapshotResponse UpgradeJobSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse UpdateModelSnapshot(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest request) { - var descriptor = new UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeJobSnapshotAsync(UpgradeJobSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse UpdateModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeJobSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotResponse UpdateModelSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action) { - var descriptor = new UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade a snapshot. - /// Upgrades an anomaly detection model snapshot to the latest major version. - /// Over time, older snapshot formats are deprecated and removed. Anomaly - /// detection jobs support only snapshots that are from the current or previous - /// major version. - /// This API provides a means to upgrade a snapshot to the current major version. - /// This aids in preparing the cluster for an upgrade to the next major version. - /// Only one snapshot per anomaly detection job can be upgraded at a time and the - /// upgraded snapshot cannot be the current snapshot of the anomaly detection - /// job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeJobSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateModelSnapshotAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate(ValidateRequest request) + public virtual System.Threading.Tasks.Task UpdateModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(ValidateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateModelSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateModelSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate(ValidateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest request) { - descriptor.BeforeRequest(); - return DoRequest, ValidateResponse, ValidateRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate() + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) { - var descriptor = new ValidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ValidateResponse, ValidateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, System.Action action) { - var descriptor = new ValidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ValidateResponse, ValidateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate(ValidateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate() + public virtual System.Threading.Tasks.Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(modelId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateResponse Validate(Action configureRequest) + public virtual System.Threading.Tasks.Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpdateTrainedModelDeploymentRequestDescriptor(modelId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(ValidateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse UpgradeJobSnapshot(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateResponse, ValidateRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse UpgradeJobSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) { - var descriptor = new ValidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateResponse, ValidateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotResponse UpgradeJobSnapshot(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action) { - var descriptor = new ValidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateResponse, ValidateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(ValidateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeJobSnapshotAsync(Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeJobSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeJobSnapshotAsync(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.UpgradeJobSnapshotRequestDescriptor(jobId, snapshotId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(ValidateDetectorRequest request) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse Validate(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(ValidateDetectorRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse Validate() { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(ValidateDetectorRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse Validate(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateResponse Validate(System.Action> action) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - descriptor.BeforeRequest(); - return DoRequest, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, Action> configureRequest) + public virtual System.Threading.Tasks.Task ValidateAsync(Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(ValidateDetectorRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ValidateAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector) + public virtual System.Threading.Tasks.Task ValidateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ValidateDetectorResponse ValidateDetector(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, Action configureRequest) + public virtual System.Threading.Tasks.Task ValidateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(ValidateDetectorRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse ValidateDetector(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse ValidateDetector(System.Action action) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorResponse ValidateDetector(System.Action> action) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ValidateDetectorResponse, ValidateDetectorRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(ValidateDetectorRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateDetectorAsync(Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateDetectorAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Validate an anomaly detection job. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ValidateDetectorAsync(Elastic.Clients.Elasticsearch.MachineLearning.Detector detector, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ValidateDetectorAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ValidateDetectorRequestDescriptor(detector); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ValidateDetectorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Nodes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Nodes.g.cs index 5a814aaae77..c2719795d95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Nodes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Nodes.g.cs @@ -18,1415 +18,895 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -public partial class NodesNamespacedClient : NamespacedClientProxy +public partial class NodesNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected NodesNamespacedClient() : base() { } - internal NodesNamespacedClient(ElasticsearchClient client) : base(client) + internal NodesNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(ClearRepositoriesMeteringArchiveRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearRepositoriesMeteringArchiveAsync(ClearRepositoriesMeteringArchiveRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(ClearRepositoriesMeteringArchiveRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion) + public virtual System.Threading.Tasks.Task ClearRepositoriesMeteringArchiveAsync(Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearRepositoriesMeteringArchiveResponse ClearRepositoriesMeteringArchive(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, Action configureRequest) + public virtual System.Threading.Tasks.Task ClearRepositoriesMeteringArchiveAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearRepositoriesMeteringArchiveAsync(ClearRepositoriesMeteringArchiveRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearRepositoriesMeteringArchiveAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearRepositoriesMeteringArchiveAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest request) { - var descriptor = new ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the archived repositories metering. - /// Clear the archived repositories metering information in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearRepositoriesMeteringArchiveAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, long maxArchiveVersion, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(Elastic.Clients.Elasticsearch.NodeIds nodeId) { - var descriptor = new ClearRepositoriesMeteringArchiveRequestDescriptor(nodeId, maxArchiveVersion); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(GetRepositoriesMeteringInfoRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(Elastic.Clients.Elasticsearch.NodeIds nodeId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoriesMeteringInfoAsync(GetRepositoriesMeteringInfoRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRepositoriesMeteringInfoAsync(Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(GetRepositoriesMeteringInfoRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetRepositoriesMeteringInfoAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(Elastic.Clients.Elasticsearch.NodeIds nodeId) + public virtual System.Threading.Tasks.Task GetRepositoriesMeteringInfoAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRepositoriesMeteringInfoRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.GetRepositoriesMeteringInfoRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoriesMeteringInfoResponse GetRepositoriesMeteringInfo(Elastic.Clients.Elasticsearch.NodeIds nodeId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse HotThreads(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest request) { - var descriptor = new GetRepositoriesMeteringInfoRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoriesMeteringInfoAsync(GetRepositoriesMeteringInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse HotThreads() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoriesMeteringInfoAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse HotThreads(System.Action action) { - var descriptor = new GetRepositoriesMeteringInfoRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get cluster repositories metering. - /// Get repositories metering information for a cluster. - /// This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. - /// Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoriesMeteringInfoAsync(Elastic.Clients.Elasticsearch.NodeIds nodeId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse HotThreads(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { - var descriptor = new GetRepositoriesMeteringInfoRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads(HotThreadsRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.HotThreadsResponse HotThreads(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(HotThreadsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HotThreadsAsync(Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads(HotThreadsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task HotThreadsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public virtual System.Threading.Tasks.Task HotThreadsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HotThreadsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest) + public virtual System.Threading.Tasks.Task HotThreadsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HotThreadsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads() + public virtual System.Threading.Tasks.Task HotThreadsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new HotThreadsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.HotThreadsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HotThreadsResponse HotThreads(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest request) { - var descriptor = new HotThreadsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(HotThreadsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(System.Action action) { - var descriptor = new HotThreadsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { - var descriptor = new HotThreadsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { - var descriptor = new HotThreadsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the hot threads for nodes. - /// Get a breakdown of the hot threads on each selected node in the cluster. - /// The output is plain text with a breakdown of the top hot threads for each node. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HotThreadsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.Metrics? metric) { - var descriptor = new HotThreadsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info(NodesInfoRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(NodesInfoRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId, metric); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info(NodesInfoRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(nodeId, metric); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest) + public virtual System.Threading.Tasks.Task InfoAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(nodeId, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info() + public virtual System.Threading.Tasks.Task InfoAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesInfoResponse Info(Action configureRequest) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(NodesInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(nodeId, metric); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(nodeId, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node information. - /// By default, the API returns all attributes and core settings for cluster nodes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesInfoRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings(ReloadSecureSettingsRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse ReloadSecureSettings(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(ReloadSecureSettingsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse ReloadSecureSettings() { + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings(ReloadSecureSettingsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse ReloadSecureSettings(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + public virtual Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse ReloadSecureSettings(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsResponse ReloadSecureSettings(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings() + public virtual System.Threading.Tasks.Task ReloadSecureSettingsAsync(Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReloadSecureSettingsResponse ReloadSecureSettings(Action configureRequest) + public virtual System.Threading.Tasks.Task ReloadSecureSettingsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(ReloadSecureSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSecureSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSecureSettingsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ReloadSecureSettingsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.ReloadSecureSettingsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest request) { - var descriptor = new ReloadSecureSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Reload the keystore on nodes in the cluster. - /// - /// - /// Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. - /// That is, you can change them on disk and reload them without restarting any nodes in the cluster. - /// When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node. - /// - /// - /// When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. - /// Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. - /// Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReloadSecureSettingsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats() { - var descriptor = new ReloadSecureSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(NodesStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(NodesStatsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(NodesStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, NodesStatsResponse, NodesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - descriptor.BeforeRequest(); - return DoRequest, NodesStatsResponse, NodesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, NodesStatsResponse, NodesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats() + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) { - var descriptor = new NodesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, NodesStatsResponse, NodesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) { - var descriptor = new NodesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, NodesStatsResponse, NodesStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(NodesStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action action) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats() + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action action) { - var descriptor = new NodesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesStatsResponse Stats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(System.Action> action) { - var descriptor = new NodesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(NodesStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync, NodesStatsResponse, NodesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - descriptor.BeforeRequest(); - return DoRequestAsync, NodesStatsResponse, NodesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, NodesStatsResponse, NodesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action> action) { - var descriptor = new NodesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, NodesStatsResponse, NodesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesStatsResponse Stats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action> action) { - var descriptor = new NodesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, NodesStatsResponse, NodesStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(NodesStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesStatsRequestDescriptor(nodeId, metric, indexMetric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get node statistics. - /// Get statistics for nodes in a cluster. - /// By default, all stats are returned. You can limit the returned information by using metrics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage(NodesUsageRequest request) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(NodesUsageRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage(NodesUsageRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(nodeId, metric); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(nodeId, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage() + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual NodesUsageResponse Usage(Action configureRequest) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(NodesUsageRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(nodeId, metric); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(nodeId, metric); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get feature usage information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, Elastic.Clients.Elasticsearch.Metrics? indexMetric, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesStatsRequestDescriptor(nodeId, metric, indexMetric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage() + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.Metrics? metric) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesUsageResponse Usage(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new NodesUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId, metric); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Elastic.Clients.Elasticsearch.Metrics? metric, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Nodes.NodesUsageRequestDescriptor(nodeId, metric); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.QueryRules.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.QueryRules.g.cs index d53f20e8501..b1d32afc9c2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.QueryRules.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.QueryRules.g.cs @@ -18,1056 +18,391 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -public partial class QueryRulesNamespacedClient : NamespacedClientProxy +public partial class QueryRulesNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected QueryRulesNamespacedClient() : base() { } - internal QueryRulesNamespacedClient(ElasticsearchClient client) : base(client) + internal QueryRulesNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRuleResponse DeleteRule(DeleteRuleRequest request) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse DeleteRule(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRuleAsync(DeleteRuleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse DeleteRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRuleResponse DeleteRule(DeleteRuleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRuleResponse DeleteRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) - { - var descriptor = new DeleteRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRuleResponse DeleteRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) - { - var descriptor = new DeleteRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRuleAsync(DeleteRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a query rule. - /// Delete a query rule within a query ruleset. - /// This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRulesetResponse DeleteRuleset(DeleteRulesetRequest request) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleResponse DeleteRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRulesetAsync(DeleteRulesetRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRuleAsync(Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRulesetResponse DeleteRuleset(DeleteRulesetRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRulesetResponse DeleteRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) - { - var descriptor = new DeleteRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRulesetResponse DeleteRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest) - { - var descriptor = new DeleteRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRulesetAsync(DeleteRulesetRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a query ruleset. - /// Remove a query ruleset and its associated data. - /// This is a destructive action that is not recoverable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRuleResponse GetRule(GetRuleRequest request) + public virtual System.Threading.Tasks.Task DeleteRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRuleAsync(GetRuleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRuleResponse GetRule(GetRuleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRuleResponse GetRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) - { - var descriptor = new GetRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRuleResponse GetRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) - { - var descriptor = new GetRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRuleAsync(GetRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse DeleteRuleset(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest request) { - var descriptor = new GetRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a query rule. - /// Get details about a query rule within a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse DeleteRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) { - var descriptor = new GetRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRulesetResponse GetRuleset(GetRulesetRequest request) + public virtual Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetResponse DeleteRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRulesetAsync(GetRulesetRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRulesetAsync(Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRulesetResponse GetRuleset(GetRulesetRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRulesetResponse GetRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) + public virtual System.Threading.Tasks.Task DeleteRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.DeleteRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRulesetResponse GetRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse GetRule(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest request) { - var descriptor = new GetRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRulesetAsync(GetRulesetRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse GetRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRuleResponse GetRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { - var descriptor = new GetRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a query ruleset. - /// Get details about a query ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRuleAsync(Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListRulesetsResponse ListRulesets(ListRulesetsRequest request) + public virtual System.Threading.Tasks.Task GetRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListRulesetsAsync(ListRulesetsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListRulesetsResponse ListRulesets(ListRulesetsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse GetRuleset(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListRulesetsResponse ListRulesets() + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse GetRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) { - var descriptor = new ListRulesetsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListRulesetsResponse ListRulesets(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.QueryRules.GetRulesetResponse GetRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action) { - var descriptor = new ListRulesetsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListRulesetsAsync(ListRulesetsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRulesetAsync(Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListRulesetsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRulesetsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all query rulesets. - /// Get summarized information about the query rulesets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListRulesetsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRulesetsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.GetRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRuleResponse PutRule(PutRuleRequest request) + public virtual Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse ListRulesets(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRuleAsync(PutRuleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse ListRulesets() { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRuleResponse PutRule(PutRuleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsResponse ListRulesets(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRuleResponse PutRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) + public virtual System.Threading.Tasks.Task ListRulesetsAsync(Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRuleResponse PutRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) + public virtual System.Threading.Tasks.Task ListRulesetsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRuleAsync(PutRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListRulesetsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.ListRulesetsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse PutRule(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest request) { - var descriptor = new PutRuleRequestDescriptor(rulesetId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query rule. - /// Create or update a query rule within a query ruleset. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse PutRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId) { - var descriptor = new PutRuleRequestDescriptor(rulesetId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRulesetResponse PutRuleset(PutRulesetRequest request) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRuleResponse PutRule(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRulesetAsync(PutRulesetRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutRuleAsync(Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRulesetResponse PutRuleset(PutRulesetRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(rulesetId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRulesetResponse PutRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) + public virtual System.Threading.Tasks.Task PutRuleAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRuleRequestDescriptor(rulesetId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRulesetResponse PutRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse PutRuleset(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest request) { - var descriptor = new PutRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRulesetAsync(PutRulesetRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse PutRuleset(Elastic.Clients.Elasticsearch.Id rulesetId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.QueryRules.PutRulesetResponse PutRuleset(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action) { - var descriptor = new PutRulesetRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a query ruleset. - /// There is a limit of 100 rules per ruleset. - /// This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting. - /// - /// - /// IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. - /// It is advised to use one or the other in query rulesets, to avoid errors. - /// Additionally, pinned queries have a maximum limit of 100 pinned hits. - /// If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutRulesetAsync(Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRulesetRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestResponse Test(TestRequest request) + public virtual System.Threading.Tasks.Task PutRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(rulesetId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestAsync(TestRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutRulesetAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.PutRulesetRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestResponse Test(TestRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.QueryRules.TestResponse Test(Elastic.Clients.Elasticsearch.QueryRules.TestRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestResponse Test(Elastic.Clients.Elasticsearch.Id rulesetId) + public virtual Elastic.Clients.Elasticsearch.QueryRules.TestResponse Test(Elastic.Clients.Elasticsearch.Id rulesetId) { - var descriptor = new TestRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestResponse Test(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.QueryRules.TestResponse Test(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action) { - var descriptor = new TestRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestAsync(TestRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TestAsync(Elastic.Clients.Elasticsearch.QueryRules.TestRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestAsync(Elastic.Clients.Elasticsearch.Id rulesetId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TestAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TestRequestDescriptor(rulesetId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(rulesetId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a query ruleset. - /// Evaluate match criteria against a query ruleset to identify the rules that would match that criteria. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestAsync(Elastic.Clients.Elasticsearch.Id rulesetId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TestAsync(Elastic.Clients.Elasticsearch.Id rulesetId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TestRequestDescriptor(rulesetId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.TestRequestDescriptor(rulesetId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Rollup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Rollup.g.cs index 2a967dba092..222ba047086 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Rollup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Rollup.g.cs @@ -18,3745 +18,633 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -public partial class RollupNamespacedClient : NamespacedClientProxy +public partial class RollupNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected RollupNamespacedClient() : base() { } - internal RollupNamespacedClient(ElasticsearchClient client) : base(client) + internal RollupNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(DeleteJobRequest request) + public virtual Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(DeleteJobRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(DeleteJobRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, DeleteJobResponse, DeleteJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteJobResponse, DeleteJobRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteJobResponse, DeleteJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(DeleteJobRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.DeleteJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest request) { - var descriptor = new DeleteJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteJobResponse DeleteJob(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse GetJobs() { - var descriptor = new DeleteJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(DeleteJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse GetJobs(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteJobResponse, DeleteJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new DeleteJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteJobResponse, DeleteJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new DeleteJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteJobResponse, DeleteJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(DeleteJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.Rollup.GetJobsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetJobsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a rollup job. - /// - /// - /// A job must be stopped before it can be deleted. - /// If you attempt to delete a started job, an error occurs. - /// Similarly, if you attempt to delete a nonexistent job, an exception occurs. - /// - /// - /// IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. - /// The API does not delete any previously rolled up data. - /// This is by design; a user may wish to roll up a static data set. - /// Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). - /// Thus the job can be deleted, leaving behind the rolled up data for analysis. - /// If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. - /// If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example: - /// - /// - /// POST my_rollup_index/_delete_by_query - /// { - /// "query": { - /// "term": { - /// "_rollup.id": "the_rollup_job_id" - /// } - /// } - /// } - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteJobAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetJobsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(GetJobsRequest request) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(GetJobsRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetJobsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(GetJobsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest request) { - descriptor.BeforeRequest(); - return DoRequest, GetJobsResponse, GetJobsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse GetRollupCaps() { - var descriptor = new GetJobsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetJobsResponse, GetJobsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse GetRollupCaps(System.Action action) { - var descriptor = new GetJobsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetJobsResponse, GetJobsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs() + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id) { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetJobsResponse, GetJobsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Action> configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id, System.Action action) { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetJobsResponse, GetJobsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(GetJobsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupCapsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupCapsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs() + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetJobsResponse GetJobs(Action configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupCapsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(GetJobsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetJobsResponse, GetJobsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index) { - var descriptor = new GetJobsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetJobsResponse, GetJobsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index, System.Action action) { - var descriptor = new GetJobsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetJobsResponse, GetJobsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetJobsResponse, GetJobsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetJobsResponse, GetJobsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(GetJobsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GetRollupIndexCapsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Rollup.PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest request) { - var descriptor = new GetJobsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get rollup job information. - /// Get the configuration, stats, and status of rollup jobs. - /// - /// - /// NOTE: This API returns only active (both STARTED and STOPPED) jobs. - /// If a job was created, ran for a while, then was deleted, the API does not return any details about it. - /// For details about a historical rollup job, the rollup capabilities API may be more useful. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetJobsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetJobsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(GetRollupCapsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(GetRollupCapsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(GetRollupCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps() - { - var descriptor = new GetRollupCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Action> configureRequest) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(GetRollupCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps() - { - var descriptor = new GetRollupCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupCapsResponse GetRollupCaps(Action configureRequest) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(GetRollupCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupCapsResponse, GetRollupCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(GetRollupCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Elastic.Clients.Elasticsearch.Id? id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup job capabilities. - /// Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern. - /// - /// - /// This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. - /// Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. - /// This API enables you to inspect an index and determine: - /// - /// - /// - /// - /// Does this index have associated rollup data somewhere in the cluster? - /// - /// - /// - /// - /// If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupCapsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(GetRollupIndexCapsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(GetRollupIndexCapsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(GetRollupIndexCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index, Action> configureRequest) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(GetRollupIndexCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRollupIndexCapsResponse GetRollupIndexCaps(Elastic.Clients.Elasticsearch.Ids index, Action configureRequest) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(GetRollupIndexCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetRollupIndexCapsResponse, GetRollupIndexCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(GetRollupIndexCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the rollup index capabilities. - /// Get the rollup capabilities of all jobs inside of a rollup index. - /// A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine: - /// - /// - /// - /// - /// What jobs are stored in an index (or indices specified via a pattern)? - /// - /// - /// - /// - /// What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job? - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRollupIndexCapsAsync(Elastic.Clients.Elasticsearch.Ids index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRollupIndexCapsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutJobResponse, PutJobRequestParameters>(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutJobResponse, PutJobRequestParameters>(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new PutJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutJobResponse, PutJobRequestParameters>(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(PutJobRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new PutJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutJobResponse, PutJobRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutJobResponse, PutJobRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutJobResponse, PutJobRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(PutJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a rollup job. - /// - /// - /// WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run. - /// - /// - /// The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index. - /// - /// - /// There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group. - /// - /// - /// Jobs are created in a STOPPED state. You can start them with the start rollup jobs API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch(RollupSearchRequest request) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, RollupSearchRequestParameters>(request); + return DoRequest(request); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(RollupSearchRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync, RollupSearchRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch(RollupSearchRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, RollupSearchResponse, RollupSearchRequestParameters>(descriptor); - } - - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new RollupSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, RollupSearchResponse, RollupSearchRequestParameters>(descriptor); - } - - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new RollupSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RollupSearchResponse, RollupSearchRequestParameters>(descriptor); + return DoRequest(request); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch() + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.PutJobResponse PutJob(Elastic.Clients.Elasticsearch.Id id, System.Action> action) { - var descriptor = new RollupSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RollupSearchResponse, RollupSearchRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RollupSearchResponse RollupSearch(Action> configureRequest) + public virtual System.Threading.Tasks.Task PutJobAsync(Elastic.Clients.Elasticsearch.Rollup.PutJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RollupSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RollupSearchResponse, RollupSearchRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(RollupSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, RollupSearchResponse, RollupSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RollupSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, RollupSearchResponse, RollupSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task PutJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RollupSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RollupSearchResponse, RollupSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.PutJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest request) { - var descriptor = new RollupSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RollupSearchResponse, RollupSearchRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Search rolled-up data. - /// The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. - /// It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query. - /// - /// - /// The request body supports a subset of features from the regular search API. - /// The following functionality is not available: - /// - /// - /// size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. - /// highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed. - /// - /// - /// Searching both historical rollup and non-rollup data - /// - /// - /// The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. - /// This is done by simply adding the live indices to the URI. For example: - /// - /// - /// GET sensor-1,sensor_rollup/_rollup_search - /// { - /// "size": 0, - /// "aggregations": { - /// "max_temperature": { - /// "max": { - /// "field": "temperature" - /// } - /// } - /// } - /// } - /// - /// - /// The rollup search endpoint does two things when the search runs: - /// - /// - /// - /// - /// The original request is sent to the non-rollup index unaltered. - /// - /// - /// - /// - /// A rewritten version of the original request is sent to the rollup index. - /// - /// - /// - /// - /// When the two responses are received, the endpoint rewrites the rollup response and merges the two together. - /// During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> RollupSearchAsync(Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch() { - var descriptor = new RollupSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RollupSearchResponse, RollupSearchRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(StartJobRequest request) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(StartJobRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(StartJobRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, StartJobResponse, StartJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch() { - var descriptor = new StartJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, StartJobResponse, StartJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(System.Action> action) { - var descriptor = new StartJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, StartJobResponse, StartJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(StartJobRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupSearchResponse RollupSearch(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) { - var descriptor = new StartJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(StartJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, StartJobResponse, StartJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, StartJobResponse, StartJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, StartJobResponse, StartJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(StartJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Start rollup jobs. - /// If you try to start a job that does not exist, an exception occurs. - /// If you try to start a job that is already started, nothing happens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(StopJobRequest request) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(StopJobRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task> RollupSearchAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync, Elastic.Clients.Elasticsearch.Rollup.RollupSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(StopJobRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Rollup.StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Rollup.StartJobRequest request) { - descriptor.BeforeRequest(); - return DoRequest, StopJobResponse, StopJobRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new StopJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, StopJobResponse, StopJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.StartJobResponse StartJob(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new StopJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, StopJobResponse, StopJobRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(StopJobRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StartJobAsync(Elastic.Clients.Elasticsearch.Rollup.StartJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task StartJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StartJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(StopJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Rollup.StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Rollup.StopJobRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, StopJobResponse, StopJobRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new StopJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, StopJobResponse, StopJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual Elastic.Clients.Elasticsearch.Rollup.StopJobResponse StopJob(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new StopJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, StopJobResponse, StopJobRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(StopJobRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopJobAsync(Elastic.Clients.Elasticsearch.Rollup.StopJobRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopJobRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop rollup jobs. - /// If you try to stop a job that does not exist, an exception occurs. - /// If you try to stop a job that is already stopped, nothing happens. - /// - /// - /// Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. - /// This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example: - /// - /// - /// POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s - /// - /// - /// The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. - /// If the specified time elapses without the job moving to STOPPED, a timeout exception occurs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '8.11.0'.")] + public virtual System.Threading.Tasks.Task StopJobAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopJobRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Rollup.StopJobRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchApplication.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchApplication.g.cs index 12a5aac252b..8b67b7ef108 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchApplication.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchApplication.g.cs @@ -18,1135 +18,537 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public partial class SearchApplicationNamespacedClient : NamespacedClientProxy +public partial class SearchApplicationNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SearchApplicationNamespacedClient() : base() { } - internal SearchApplicationNamespacedClient(ElasticsearchClient client) : base(client) + internal SearchApplicationNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSearchApplicationResponse Delete(DeleteSearchApplicationRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse Delete(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteSearchApplicationRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse Delete(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSearchApplicationResponse Delete(DeleteSearchApplicationRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSearchApplicationResponse Delete(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new DeleteSearchApplicationRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSearchApplicationResponse Delete(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new DeleteSearchApplicationRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteSearchApplicationRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSearchApplicationRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a search application. - /// Remove a search application and its associated alias. Indices attached to the search application are not removed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSearchApplicationRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(DeleteBehavioralAnalyticsRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationResponse Delete(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteBehavioralAnalyticsAsync(DeleteBehavioralAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(DeleteBehavioralAnalyticsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new DeleteBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new DeleteBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteBehavioralAnalyticsAsync(DeleteBehavioralAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a behavioral analytics collection. - /// The associated data stream is also deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSearchApplicationResponse Get(GetSearchApplicationRequest request) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetSearchApplicationRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSearchApplicationResponse Get(GetSearchApplicationRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSearchApplicationResponse Get(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest request) { - var descriptor = new GetSearchApplicationRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSearchApplicationResponse Get(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new GetSearchApplicationRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetSearchApplicationRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsResponse DeleteBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSearchApplicationRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search application details. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task DeleteBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSearchApplicationRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics(GetBehavioralAnalyticsRequest request) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task DeleteBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.DeleteBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(GetBehavioralAnalyticsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse Get(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics(GetBehavioralAnalyticsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse Get(Elastic.Clients.Elasticsearch.Name name) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics(IReadOnlyCollection? name) - { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics(IReadOnlyCollection? name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationResponse Get(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics() + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBehavioralAnalyticsResponse GetBehavioralAnalytics(Action configureRequest) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(GetBehavioralAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(IReadOnlyCollection? name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse GetBehavioralAnalytics(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest request) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(IReadOnlyCollection? name, Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse GetBehavioralAnalytics() { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse GetBehavioralAnalytics(System.Action action) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get behavioral analytics collections. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBehavioralAnalyticsAsync(Action configureRequest, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse GetBehavioralAnalytics(System.Collections.Generic.ICollection? name) { - var descriptor = new GetBehavioralAnalyticsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(ListRequest request) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsResponse GetBehavioralAnalytics(System.Collections.Generic.ICollection? name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(ListRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(ListRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task GetBehavioralAnalyticsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List() + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task GetBehavioralAnalyticsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(Action configureRequest) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task GetBehavioralAnalyticsAsync(System.Collections.Generic.ICollection? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(ListRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task GetBehavioralAnalyticsAsync(System.Collections.Generic.ICollection? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.GetBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.ListResponse List(Elastic.Clients.Elasticsearch.SearchApplication.ListRequest request) { - var descriptor = new ListRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get search applications. - /// Get information about search applications. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.ListResponse List() { - var descriptor = new ListRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(PostBehavioralAnalyticsEventRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.ListResponse List(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostBehavioralAnalyticsEventAsync(PostBehavioralAnalyticsEventRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListAsync(Elastic.Clients.Elasticsearch.SearchApplication.ListRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(PostBehavioralAnalyticsEventRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ListAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) + public virtual System.Threading.Tasks.Task ListAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.ListRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest request) { - var descriptor = new PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostBehavioralAnalyticsEventAsync(PostBehavioralAnalyticsEventRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostBehavioralAnalyticsEventAsync(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventResponse PostBehavioralAnalyticsEvent(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, System.Action action) { - var descriptor = new PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection event. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PostBehavioralAnalyticsEventAsync(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PostBehavioralAnalyticsEventAsync(Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSearchApplicationResponse Put(PutSearchApplicationRequest request) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task PostBehavioralAnalyticsEventAsync(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(PutSearchApplicationRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task PostBehavioralAnalyticsEventAsync(Elastic.Clients.Elasticsearch.Name collectionName, Elastic.Clients.Elasticsearch.SearchApplication.EventType eventType, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PostBehavioralAnalyticsEventRequestDescriptor(collectionName, eventType); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSearchApplicationResponse Put(PutSearchApplicationRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse Put(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSearchApplicationResponse Put(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication, Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse Put(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new PutSearchApplicationRequestDescriptor(searchApplication, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSearchApplicationResponse Put(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication, Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationResponse Put(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new PutSearchApplicationRequestDescriptor(searchApplication, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(PutSearchApplicationRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSearchApplicationRequestDescriptor(searchApplication, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutAsync(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication searchApplication, Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSearchApplicationRequestDescriptor(searchApplication, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutSearchApplicationRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutBehavioralAnalyticsResponse PutBehavioralAnalytics(PutBehavioralAnalyticsRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse PutBehavioralAnalytics(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutBehavioralAnalyticsAsync(PutBehavioralAnalyticsRequest request, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse PutBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutBehavioralAnalyticsResponse PutBehavioralAnalytics(PutBehavioralAnalyticsRequestDescriptor descriptor) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsResponse PutBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutBehavioralAnalyticsResponse PutBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task PutBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutBehavioralAnalyticsResponse PutBehavioralAnalytics(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task PutBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutBehavioralAnalyticsAsync(PutBehavioralAnalyticsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + [System.Obsolete("Deprecated in '9.0.0'.")] + public virtual System.Threading.Tasks.Task PutBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.PutBehavioralAnalyticsRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse RenderQuery(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest request) { - var descriptor = new PutBehavioralAnalyticsRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a behavioral analytics collection. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutBehavioralAnalyticsAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse RenderQuery(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new PutBehavioralAnalyticsRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderQueryResponse RenderQuery(RenderQueryRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryResponse RenderQuery(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderQueryAsync(RenderQueryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RenderQueryAsync(Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderQueryResponse RenderQuery(RenderQueryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task RenderQueryAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderQueryResponse RenderQuery(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task RenderQueryAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RenderQueryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.RenderQueryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderQueryResponse RenderQuery(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse Search(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest request) { - var descriptor = new RenderQueryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderQueryAsync(RenderQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse Search(Elastic.Clients.Elasticsearch.Name name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderQueryAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchResponse Search(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new RenderQueryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request); } - /// - /// - /// Render a search application query. - /// Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. - /// If a parameter used in the search template is not specified in params, the parameter's default value will be used. - /// The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. - /// - /// - /// You must have read privileges on the backing alias of the search application. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderQueryAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RenderQueryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run a search application search. - /// Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. - /// Unspecified template parameters are assigned their default values if applicable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchApplicationSearchResponse Search(SearchApplicationSearchRequest request) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, SearchApplicationSearchRequestParameters>(request); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request, cancellationToken); } - /// - /// - /// Run a search application search. - /// Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. - /// Unspecified template parameters are assigned their default values if applicable. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(SearchApplicationSearchRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync, SearchApplicationSearchRequestParameters>(request, cancellationToken); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationSearchRequestParameters>(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchableSnapshots.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchableSnapshots.g.cs index e94cd8a7a21..020f8ba41d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchableSnapshots.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.SearchableSnapshots.g.cs @@ -18,948 +18,381 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -public partial class SearchableSnapshotsNamespacedClient : NamespacedClientProxy +public partial class SearchableSnapshotsNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SearchableSnapshotsNamespacedClient() : base() { } - internal SearchableSnapshotsNamespacedClient(ElasticsearchClient client) : base(client) + internal SearchableSnapshotsNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats(CacheStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse CacheStats(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(CacheStatsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse CacheStats() { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats(CacheStatsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats(Elastic.Clients.Elasticsearch.NodeIds? nodeId) - { - var descriptor = new CacheStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest) - { - var descriptor = new CacheStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats() - { - var descriptor = new CacheStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CacheStatsResponse CacheStats(Action configureRequest) - { - var descriptor = new CacheStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(CacheStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, CancellationToken cancellationToken = default) - { - var descriptor = new CacheStatsRequestDescriptor(nodeId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CacheStatsRequestDescriptor(nodeId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new CacheStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cache statistics. - /// Get statistics about the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CacheStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CacheStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse CacheStats(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse CacheStats(Elastic.Clients.Elasticsearch.NodeIds? nodeId) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(nodeId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache() - { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Action> configureRequest) - { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ClearCacheResponse, ClearCacheRequestParameters>(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(ClearCacheRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache() - { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCacheResponse ClearCache(Action configureRequest) - { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsResponse CacheStats(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CacheStatsAsync(Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CacheStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CacheStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CacheStatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ClearCacheResponse, ClearCacheRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(nodeId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(ClearCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CacheStatsAsync(Elastic.Clients.Elasticsearch.NodeIds? nodeId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.CacheStatsRequestDescriptor(nodeId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest request) { - var descriptor = new ClearCacheRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache() { - var descriptor = new ClearCacheRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(System.Action action) { - var descriptor = new ClearCacheRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the cache. - /// Clear indices and data streams from the shared cache for partially mounted indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCacheAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new ClearCacheRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MountResponse Mount(MountRequest request) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MountAsync(MountRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MountResponse Mount(MountRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheResponse ClearCache(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MountResponse Mount(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MountRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MountResponse Mount(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MountRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MountAsync(MountRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MountAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MountRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Mount a snapshot. - /// Mount a snapshot as a searchable snapshot index. - /// Do not use this API for snapshots managed by index lifecycle management (ILM). - /// Manually mounting ILM-managed snapshots can interfere with ILM processes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MountAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new MountRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(SearchableSnapshotsStatsRequest request) + public virtual System.Threading.Tasks.Task ClearCacheAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(SearchableSnapshotsStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCacheAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.ClearCacheRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(SearchableSnapshotsStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse Mount(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest request) { - descriptor.BeforeRequest(); - return DoRequest, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse Mount(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.MountResponse Mount(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats() + public virtual System.Threading.Tasks.Task MountAsync(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Action> configureRequest) + public virtual System.Threading.Tasks.Task MountAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(SearchableSnapshotsStatsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task MountAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest request) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats() { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats() + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(System.Action action) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchableSnapshotsStatsResponse Stats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(SearchableSnapshotsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(System.Action> action) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsResponse Stats(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchableSnapshotsStatsResponse, SearchableSnapshotsStatsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(SearchableSnapshotsStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get searchable snapshot statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SearchableSnapshotsStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsStatsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs index 5c8a9861956..1effd01839b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs @@ -18,15518 +18,3301 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public partial class SecurityNamespacedClient : NamespacedClientProxy +public partial class SecurityNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SecurityNamespacedClient() : base() { } - internal SecurityNamespacedClient(ElasticsearchClient client) : base(client) + internal SecurityNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ActivateUserProfileResponse ActivateUserProfile(ActivateUserProfileRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponse ActivateUserProfile(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ActivateUserProfileResponse ActivateUserProfile(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ActivateUserProfileResponse ActivateUserProfile(ActivateUserProfileRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ActivateUserProfileAsync(Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ActivateUserProfileResponse ActivateUserProfile() + public virtual System.Threading.Tasks.Task ActivateUserProfileAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ActivateUserProfileRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ActivateUserProfileRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ActivateUserProfileResponse ActivateUserProfile(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.AuthenticateResponse Authenticate(Elastic.Clients.Elasticsearch.Security.AuthenticateRequest request) { - var descriptor = new ActivateUserProfileRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.AuthenticateResponse Authenticate() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ActivateUserProfileAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.AuthenticateResponse Authenticate(System.Action action) { - var descriptor = new ActivateUserProfileRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Activate a user profile. - /// - /// - /// Create or update a user profile on behalf of another user. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. - /// For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token. - /// - /// - /// When updating a profile document, the API enables the document if it was disabled. - /// Any updates do not change existing content for either the labels or data fields. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ActivateUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AuthenticateAsync(Elastic.Clients.Elasticsearch.Security.AuthenticateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ActivateUserProfileRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AuthenticateResponse Authenticate(AuthenticateRequest request) + public virtual System.Threading.Tasks.Task AuthenticateAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AuthenticateAsync(AuthenticateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task AuthenticateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.AuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AuthenticateResponse Authenticate(AuthenticateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponse BulkDeleteRole(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AuthenticateResponse Authenticate() + public virtual Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleResponse BulkDeleteRole(System.Action action) { - var descriptor = new AuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual AuthenticateResponse Authenticate(Action configureRequest) + public virtual System.Threading.Tasks.Task BulkDeleteRoleAsync(Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new AuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AuthenticateAsync(AuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task BulkDeleteRoleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkDeleteRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AuthenticateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse BulkPutRole(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest request) { - var descriptor = new AuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate a user. - /// - /// - /// Authenticates a user and returns information about the authenticated user. - /// Include the user information in a basic auth header. - /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. - /// If the user cannot be authenticated, this API returns a 401 status code. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task AuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse BulkPutRole(System.Action action) { - var descriptor = new AuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkDeleteRoleResponse BulkDeleteRole(BulkDeleteRoleRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.BulkPutRoleResponse BulkPutRole(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkDeleteRoleAsync(BulkDeleteRoleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task BulkPutRoleAsync(Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkDeleteRoleResponse BulkDeleteRole(BulkDeleteRoleRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task BulkPutRoleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkDeleteRoleResponse BulkDeleteRole() + public virtual System.Threading.Tasks.Task BulkPutRoleAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkDeleteRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkPutRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkDeleteRoleResponse BulkDeleteRole(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse BulkUpdateApiKeys(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest request) { - var descriptor = new BulkDeleteRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkDeleteRoleAsync(BulkDeleteRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse BulkUpdateApiKeys(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkDeleteRoleAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysResponse BulkUpdateApiKeys(System.Action> action) { - var descriptor = new BulkDeleteRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk delete roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk delete roles API cannot delete roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkDeleteRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task BulkUpdateApiKeysAsync(Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkDeleteRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole(BulkPutRoleRequest request) + public virtual System.Threading.Tasks.Task BulkUpdateApiKeysAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(BulkPutRoleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task BulkUpdateApiKeysAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.BulkUpdateApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole(BulkPutRoleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest request) { - descriptor.BeforeRequest(); - return DoRequest, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole() + public virtual Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse ChangePassword() { - var descriptor = new BulkPutRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse ChangePassword(System.Action action) { - var descriptor = new BulkPutRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole(BulkPutRoleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole() + public virtual Elastic.Clients.Elasticsearch.Security.ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username, System.Action action) { - var descriptor = new BulkPutRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkPutRoleResponse BulkPutRole(Action configureRequest) + public virtual System.Threading.Tasks.Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Security.ChangePasswordRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkPutRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(BulkPutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ChangePasswordAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ChangePasswordAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkPutRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkPutRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(BulkPutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ChangePasswordRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest request) { - var descriptor = new BulkPutRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The bulk create or update roles API cannot update roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkPutRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids) { - var descriptor = new BulkPutRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(ids); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys(BulkUpdateApiKeysRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(ids); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(BulkUpdateApiKeysRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys(BulkUpdateApiKeysRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(ids); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys() + public virtual System.Threading.Tasks.Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearApiKeyCacheRequestDescriptor(ids); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest request) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys(BulkUpdateApiKeysRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(application); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys() + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application, System.Action action) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(application); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkUpdateApiKeysResponse BulkUpdateApiKeys(Action configureRequest) + public virtual System.Threading.Tasks.Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(BulkUpdateApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(application); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedPrivilegesRequestDescriptor(application); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest request) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkUpdateApiKeysResponse, BulkUpdateApiKeysRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(BulkUpdateApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(realms); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms, System.Action action) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(realms); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Bulk update API keys. - /// Update the attributes for multiple API keys. - /// - /// - /// IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required. - /// - /// - /// This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates. - /// - /// - /// It is not possible to update expired or invalidated API keys. - /// - /// - /// This API supports updates to API key access scope, metadata and expiration. - /// The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// - /// A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkUpdateApiKeysAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new BulkUpdateApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword(ChangePasswordRequest request) + public virtual System.Threading.Tasks.Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(realms); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(ChangePasswordRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRealmsRequestDescriptor(realms); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword(ChangePasswordRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new ChangePasswordRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new ChangePasswordRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword() + public virtual System.Threading.Tasks.Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ChangePasswordRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ChangePasswordResponse ChangePassword(Action configureRequest) + public virtual System.Threading.Tasks.Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ChangePasswordRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(ChangePasswordRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedRolesRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse ClearCachedServiceTokens(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest request) { - var descriptor = new ChangePasswordRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse ClearCachedServiceTokens(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new ChangePasswordRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(@namespace, service, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensResponse ClearCachedServiceTokens(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name, System.Action action) { - var descriptor = new ChangePasswordRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Change passwords. - /// - /// - /// Change the passwords of users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ChangePasswordAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedServiceTokensAsync(Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ChangePasswordRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearApiKeyCacheResponse ClearApiKeyCache(ClearApiKeyCacheRequest request) + public virtual System.Threading.Tasks.Task ClearCachedServiceTokensAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(@namespace, service, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCachedServiceTokensAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.ClearCachedServiceTokensRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearApiKeyCacheResponse ClearApiKeyCache(ClearApiKeyCacheRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse CreateApiKey(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids) + public virtual Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse CreateApiKey() { - var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse CreateApiKey(System.Action action) { - var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.CreateApiKeyResponse CreateApiKey(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateApiKeyAsync(Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the API key cache. - /// - /// - /// Evict a subset of all entries from the API key cache. - /// The cache is also automatically cleared on state changes of the security index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateApiKeyAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(ClearCachedPrivilegesRequest request) + public virtual System.Threading.Tasks.Task CreateApiKeyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateApiKeyAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(ClearCachedPrivilegesRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application) + public virtual Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(System.Action action) { - var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(System.Action> action) { - var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateCrossClusterApiKeyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the privileges cache. - /// - /// - /// Evict privileges from the native application privilege cache. - /// The cache is also automatically cleared for applications that have their privileges updated. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateCrossClusterApiKeyAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateCrossClusterApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRealmsResponse ClearCachedRealms(ClearCachedRealmsRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse CreateServiceToken(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse CreateServiceToken(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name) { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRealmsResponse ClearCachedRealms(ClearCachedRealmsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse CreateServiceToken(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms) + public virtual Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse CreateServiceToken(string @namespace, string service) { - var descriptor = new ClearCachedRealmsRequestDescriptor(realms); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.CreateServiceTokenResponse CreateServiceToken(string @namespace, string service, System.Action action) { - var descriptor = new ClearCachedRealmsRequestDescriptor(realms); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateServiceTokenAsync(Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateServiceTokenAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedRealmsRequestDescriptor(realms); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the user cache. - /// - /// - /// Evict users from the user cache. - /// You can completely clear the cache or evict specific users. - /// - /// - /// User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. - /// There are realm settings that you can use to configure the user cache. - /// For more information, refer to the documentation about controlling the user cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateServiceTokenAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Name? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedRealmsRequestDescriptor(realms); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRolesResponse ClearCachedRoles(ClearCachedRolesRequest request) + public virtual System.Threading.Tasks.Task CreateServiceTokenAsync(string @namespace, string service, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateServiceTokenAsync(string @namespace, string service, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.CreateServiceTokenRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRolesResponse ClearCachedRoles(ClearCachedRolesRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.DelegatePkiResponse DelegatePki(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name) + public virtual Elastic.Clients.Elasticsearch.Security.DelegatePkiResponse DelegatePki(System.Action action) { - var descriptor = new ClearCachedRolesRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual System.Threading.Tasks.Task DelegatePkiAsync(Elastic.Clients.Elasticsearch.Security.DelegatePkiRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedRolesRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DelegatePkiAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DelegatePkiRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest request) { - var descriptor = new ClearCachedRolesRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear the roles cache. - /// - /// - /// Evict roles from the native role cache. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new ClearCachedRolesRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(application, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(ClearCachedServiceTokensRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(application, name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(ClearCachedServiceTokensRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(application, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(string ns, string service, Elastic.Clients.Elasticsearch.Names name) + public virtual System.Threading.Tasks.Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeletePrivilegesRequestDescriptor(application, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(string ns, string service, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest request) { - var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clear service account token caches. - /// - /// - /// Evict a subset of all entries from the service account token caches. - /// Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. - /// This API clears matching entries from both caches. - /// - /// - /// The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. - /// The cache for tokens backed by the service_tokens file is cleared automatically on file changes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Security.DeleteRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequest request) + public virtual System.Threading.Tasks.Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(CreateApiKeyRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest request) { - descriptor.BeforeRequest(); - return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey() + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new CreateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new CreateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey() + public virtual System.Threading.Tasks.Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateApiKeyResponse CreateApiKey(Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse DeleteServiceToken(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse DeleteServiceToken(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new CreateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(@namespace, service, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenResponse DeleteServiceToken(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new CreateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteServiceTokenAsync(Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteServiceTokenAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(@namespace, service, name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create an API key. - /// - /// - /// Create an API key for access without requiring basic authentication. - /// - /// - /// IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. - /// If you specify privileges, the API returns an error. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// To configure or turn off the API key service, refer to API key service setting documentation. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteServiceTokenAsync(string @namespace, string service, Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteServiceTokenRequestDescriptor(@namespace, service, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(CreateCrossClusterApiKeyRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Security.DeleteUserRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(CreateCrossClusterApiKeyRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username) { + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(username); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(CreateCrossClusterApiKeyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey() + public virtual System.Threading.Tasks.Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Security.DeleteUserRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(Action> configureRequest) + public virtual System.Threading.Tasks.Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(CreateCrossClusterApiKeyRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DeleteUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey() + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Security.DisableUserRequest request) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateCrossClusterApiKeyResponse CreateCrossClusterApiKey(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(CreateCrossClusterApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DisableUserAsync(Elastic.Clients.Elasticsearch.Security.DisableUserRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateCrossClusterApiKeyResponse, CreateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(CreateCrossClusterApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse DisableUserProfile(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest request) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a cross-cluster API key. - /// - /// - /// Create an API key of the cross_cluster type for the API key based remote cluster access. - /// A cross_cluster API key cannot be used to authenticate through the REST interface. - /// - /// - /// IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error. - /// - /// - /// Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property. - /// - /// - /// A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// - /// Cross-cluster API keys can only be updated with the update cross-cluster API key API. - /// Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateCrossClusterApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse DisableUserProfile(string uid) { - var descriptor = new CreateCrossClusterApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(CreateServiceTokenRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.DisableUserProfileResponse DisableUserProfile(string uid, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DisableUserProfileAsync(Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(CreateServiceTokenRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DisableUserProfileAsync(string uid, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) + public virtual System.Threading.Tasks.Task DisableUserProfileAsync(string uid, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.DisableUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Security.EnableUserRequest request) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username, System.Action action) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnableUserAsync(Elastic.Clients.Elasticsearch.Security.EnableUserRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(string ns, string service, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse EnableUserProfile(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest request) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a service account token. - /// - /// - /// Create a service accounts token for access without requiring basic authentication. - /// - /// - /// NOTE: Service account tokens never expire. - /// You must actively delete them if they are no longer needed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateServiceTokenAsync(string ns, string service, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse EnableUserProfile(string uid) { - var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DelegatePkiResponse DelegatePki(DelegatePkiRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.EnableUserProfileResponse EnableUserProfile(string uid, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DelegatePkiAsync(DelegatePkiRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnableUserProfileAsync(Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DelegatePkiResponse DelegatePki(DelegatePkiRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task EnableUserProfileAsync(string uid, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DelegatePkiResponse DelegatePki() + public virtual System.Threading.Tasks.Task EnableUserProfileAsync(string uid, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DelegatePkiRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnableUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DelegatePkiResponse DelegatePki(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse EnrollKibana(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest request) { - var descriptor = new DelegatePkiRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DelegatePkiAsync(DelegatePkiRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse EnrollKibana() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DelegatePkiAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollKibanaResponse EnrollKibana(System.Action action) { - var descriptor = new DelegatePkiRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delegate PKI authentication. - /// - /// - /// This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. - /// The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. - /// A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm. - /// - /// - /// This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch. - /// - /// - /// IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. - /// This is part of the TLS authentication process and it is delegated to the proxy that calls this API. - /// The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DelegatePkiAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnrollKibanaAsync(Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DelegatePkiRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePrivilegesResponse DeletePrivileges(DeletePrivilegesRequest request) + public virtual System.Threading.Tasks.Task EnrollKibanaAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnrollKibanaAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollKibanaRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePrivilegesResponse DeletePrivileges(DeletePrivilegesRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse EnrollNode(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse EnrollNode() { - var descriptor = new DeletePrivilegesRequestDescriptor(application, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.EnrollNodeResponse EnrollNode(System.Action action) { - var descriptor = new DeletePrivilegesRequestDescriptor(application, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnrollNodeAsync(Elastic.Clients.Elasticsearch.Security.EnrollNodeRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnrollNodeAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePrivilegesRequestDescriptor(application, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task EnrollNodeAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeletePrivilegesRequestDescriptor(application, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.EnrollNodeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleResponse DeleteRole(DeleteRoleRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse GetApiKey(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleAsync(DeleteRoleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse GetApiKey() { + var builder = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleResponse DeleteRole(DeleteRoleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetApiKeyResponse GetApiKey(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetApiKeyAsync(Elastic.Clients.Elasticsearch.Security.GetApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetApiKeyAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleAsync(DeleteRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetApiKeyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse GetBuiltinPrivileges(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest request) { - var descriptor = new DeleteRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete roles. - /// - /// - /// Delete roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The delete roles API cannot remove roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse GetBuiltinPrivileges() { - var descriptor = new DeleteRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleMappingResponse DeleteRoleMapping(DeleteRoleMappingRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesResponse GetBuiltinPrivileges(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetBuiltinPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleMappingResponse DeleteRoleMapping(DeleteRoleMappingRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetBuiltinPrivilegesAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetBuiltinPrivilegesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetBuiltinPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest request) { - var descriptor = new DeleteRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(System.Action action) { - var descriptor = new DeleteRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The delete role mappings API cannot remove role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application) { - var descriptor = new DeleteRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteServiceTokenResponse DeleteServiceToken(DeleteServiceTokenRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteServiceTokenResponse DeleteServiceToken(DeleteServiceTokenRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application, name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteServiceTokenResponse DeleteServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteServiceTokenResponse DeleteServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete service account tokens. - /// - /// - /// Delete service account tokens for a service in a specified namespace. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteUserResponse DeleteUser(DeleteUserRequest request) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application, name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteUserAsync(DeleteUserRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetPrivilegesRequestDescriptor(application, name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteUserResponse DeleteUser(DeleteUserRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Security.GetRoleRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleResponse GetRole() { - var descriptor = new DeleteUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleResponse GetRole(System.Action action) { - var descriptor = new DeleteUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteUserAsync(DeleteUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - var descriptor = new DeleteUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete users. - /// - /// - /// Delete users from the native realm. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRoleAsync(Elastic.Clients.Elasticsearch.Security.GetRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserResponse DisableUser(DisableUserRequest request) + public virtual System.Threading.Tasks.Task GetRoleAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserAsync(DisableUserRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRoleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserResponse DisableUser(DisableUserRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username) + public virtual System.Threading.Tasks.Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DisableUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest request) { - var descriptor = new DisableUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserAsync(DisableUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse GetRoleMapping() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse GetRoleMapping(System.Action action) { - var descriptor = new DisableUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Disable users. - /// - /// - /// Disable users in the native realm. - /// By default, when you create users, they are enabled. - /// You can use this API to revoke a user's access to Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name) { - var descriptor = new DisableUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserProfileResponse DisableUserProfile(DisableUserProfileRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserProfileAsync(DisableUserProfileRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserProfileResponse DisableUserProfile(DisableUserProfileRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetRoleMappingAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserProfileResponse DisableUserProfile(string uid) + public virtual System.Threading.Tasks.Task GetRoleMappingAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DisableUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DisableUserProfileResponse DisableUserProfile(string uid, Action configureRequest) + public virtual System.Threading.Tasks.Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DisableUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserProfileAsync(DisableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest request) { - var descriptor = new DisableUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Disable a user profile. - /// - /// - /// Disable user profiles so that they are not visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. - /// To re-enable a disabled user profile, use the enable user profile API . - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DisableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts() { - var descriptor = new DisableUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserResponse EnableUser(EnableUserRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserAsync(EnableUserRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(string? @namespace, string? service) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace, service); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserResponse EnableUser(EnableUserRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(string? @namespace, string? service, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(string? @namespace) { - var descriptor = new EnableUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceAccountsResponse GetServiceAccounts(string? @namespace, System.Action action) { - var descriptor = new EnableUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserAsync(EnableUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnableUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable users. - /// - /// - /// Enable users in the native realm. - /// By default, when you create users, they are enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnableUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserProfileResponse EnableUserProfile(EnableUserProfileRequest request) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(string? @namespace, string? service, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace, service); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserProfileAsync(EnableUserProfileRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(string? @namespace, string? service, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserProfileResponse EnableUserProfile(EnableUserProfileRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(string? @namespace, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserProfileResponse EnableUserProfile(string uid) + public virtual System.Threading.Tasks.Task GetServiceAccountsAsync(string? @namespace, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnableUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceAccountsRequestDescriptor(@namespace); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnableUserProfileResponse EnableUserProfile(string uid, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse GetServiceCredentials(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest request) { - var descriptor = new EnableUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserProfileAsync(EnableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse GetServiceCredentials(string @namespace, Elastic.Clients.Elasticsearch.Name service) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(@namespace, service); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsResponse GetServiceCredentials(string @namespace, Elastic.Clients.Elasticsearch.Name service, System.Action action) { - var descriptor = new EnableUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enable a user profile. - /// - /// - /// Enable user profiles to make them visible in user profile searches. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// When you activate a user profile, it's automatically enabled and visible in user profile searches. - /// If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceCredentialsAsync(Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnableUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollKibanaResponse EnrollKibana(EnrollKibanaRequest request) + public virtual System.Threading.Tasks.Task GetServiceCredentialsAsync(string @namespace, Elastic.Clients.Elasticsearch.Name service, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(@namespace, service); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollKibanaAsync(EnrollKibanaRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetServiceCredentialsAsync(string @namespace, Elastic.Clients.Elasticsearch.Name service, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetServiceCredentialsRequestDescriptor(@namespace, service); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollKibanaResponse EnrollKibana(EnrollKibanaRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse GetSettings(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollKibanaResponse EnrollKibana() + public virtual Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse GetSettings() { - var descriptor = new EnrollKibanaRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollKibanaResponse EnrollKibana(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsResponse GetSettings(System.Action action) { - var descriptor = new EnrollKibanaRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollKibanaAsync(EnrollKibanaRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollKibanaAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrollKibanaRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll Kibana. - /// - /// - /// Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. - /// - /// - /// NOTE: This API is currently intended for internal use only by Kibana. - /// Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollKibanaAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrollKibanaRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetSecuritySettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollNodeResponse EnrollNode(EnrollNodeRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetTokenResponse GetToken(Elastic.Clients.Elasticsearch.Security.GetTokenRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollNodeAsync(EnrollNodeRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetTokenResponse GetToken() { + var builder = new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollNodeResponse EnrollNode(EnrollNodeRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetTokenResponse GetToken(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollNodeResponse EnrollNode() + public virtual System.Threading.Tasks.Task GetTokenAsync(Elastic.Clients.Elasticsearch.Security.GetTokenRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrollNodeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual EnrollNodeResponse EnrollNode(Action configureRequest) + public virtual System.Threading.Tasks.Task GetTokenAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new EnrollNodeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollNodeAsync(EnrollNodeRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTokenAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetTokenRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollNodeAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserResponse GetUser(Elastic.Clients.Elasticsearch.Security.GetUserRequest request) { - var descriptor = new EnrollNodeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Enroll a node. - /// - /// - /// Enroll a new node to allow it to join an existing cluster with security features enabled. - /// - /// - /// The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. - /// The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task EnrollNodeAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new EnrollNodeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetApiKeyResponse GetApiKey(GetApiKeyRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetApiKeyAsync(GetApiKeyRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetApiKeyResponse GetApiKey(GetApiKeyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetApiKeyResponse GetApiKey() - { - var descriptor = new GetApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetApiKeyResponse GetApiKey(Action configureRequest) - { - var descriptor = new GetApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetApiKeyAsync(GetApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetApiKeyAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get API key information. - /// - /// - /// Retrieves information for one or more API keys. - /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(GetBuiltinPrivilegesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(GetBuiltinPrivilegesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges() - { - var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(Action configureRequest) - { - var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBuiltinPrivilegesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get builtin privileges. - /// - /// - /// Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetBuiltinPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges(GetPrivilegesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(GetPrivilegesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges(GetPrivilegesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) - { - var descriptor = new GetPrivilegesRequestDescriptor(application, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) - { - var descriptor = new GetPrivilegesRequestDescriptor(application, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges() - { - var descriptor = new GetPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetPrivilegesResponse GetPrivileges(Action configureRequest) - { - var descriptor = new GetPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(GetPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) - { - var descriptor = new GetPrivilegesRequestDescriptor(application, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPrivilegesRequestDescriptor(application, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The read_security cluster privilege (or a greater privilege such as manage_security or all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole(GetRoleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(GetRoleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole(GetRoleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name) - { - var descriptor = new GetRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) - { - var descriptor = new GetRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole() - { - var descriptor = new GetRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleResponse GetRole(Action configureRequest) - { - var descriptor = new GetRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(GetRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get roles. - /// - /// - /// Get roles in the native realm. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The get roles API cannot retrieve roles that are defined in roles files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping(GetRoleMappingRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(GetRoleMappingRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping(GetRoleMappingRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name) - { - var descriptor = new GetRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) - { - var descriptor = new GetRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping() - { - var descriptor = new GetRoleMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRoleMappingResponse GetRoleMapping(Action configureRequest) - { - var descriptor = new GetRoleMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(GetRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleMappingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. - /// The get role mappings API cannot retrieve role mappings that are defined in role mapping files. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRoleMappingAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRoleMappingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts(GetServiceAccountsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts(GetServiceAccountsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts(string? ns, string? service) - { - var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts(string? ns, string? service, Action configureRequest) - { - var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts() - { - var descriptor = new GetServiceAccountsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceAccountsResponse GetServiceAccounts(Action configureRequest) - { - var descriptor = new GetServiceAccountsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(string? ns, string? service, CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(string? ns, string? service, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceAccountsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service accounts. - /// - /// - /// Get a list of service accounts that match the provided path parameters. - /// - /// - /// NOTE: Currently, only the elastic/fleet-server service account is available. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceAccountsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceAccountsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceCredentialsResponse GetServiceCredentials(GetServiceCredentialsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceCredentialsResponse GetServiceCredentials(GetServiceCredentialsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceCredentialsResponse GetServiceCredentials(string ns, Elastic.Clients.Elasticsearch.Name service) - { - var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetServiceCredentialsResponse GetServiceCredentials(string ns, Elastic.Clients.Elasticsearch.Name service, Action configureRequest) - { - var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Name service, CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get service account credentials. - /// - /// - /// To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security). - /// - /// - /// The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster. - /// - /// - /// NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. - /// Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Name service, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSecuritySettingsResponse GetSettings(GetSecuritySettingsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetSecuritySettingsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSecuritySettingsResponse GetSettings(GetSecuritySettingsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSecuritySettingsResponse GetSettings() - { - var descriptor = new GetSecuritySettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSecuritySettingsResponse GetSettings(Action configureRequest) - { - var descriptor = new GetSecuritySettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(GetSecuritySettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetSecuritySettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get security index settings. - /// - /// - /// Get the user-configurable settings for the security internal index (.security and associated indices). - /// Only a subset of the index settings — those that are user-configurable—will be shown. - /// This includes: - /// - /// - /// - /// - /// index.auto_expand_replicas - /// - /// - /// - /// - /// index.number_of_replicas - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSettingsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSecuritySettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTokenResponse GetToken(GetTokenRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTokenAsync(GetTokenRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTokenResponse GetToken(GetTokenRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTokenResponse GetToken() - { - var descriptor = new GetTokenRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTokenResponse GetToken(Action configureRequest) - { - var descriptor = new GetTokenRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTokenAsync(GetTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTokenAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetTokenRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a token. - /// - /// - /// Create a bearer token for access without requiring basic authentication. - /// The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. - /// Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. - /// When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface. - /// - /// - /// The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body. - /// - /// - /// A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available. - /// - /// - /// The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. - /// That time period is defined by the xpack.security.authc.token.timeout setting. - /// If you want to invalidate a token immediately, you can do so by using the invalidate token API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetTokenRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser(GetUserRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(GetUserRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser(GetUserRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser(IReadOnlyCollection? username) - { - var descriptor = new GetUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser(IReadOnlyCollection? username, Action configureRequest) - { - var descriptor = new GetUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser() - { - var descriptor = new GetUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserResponse GetUser(Action configureRequest) - { - var descriptor = new GetUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(GetUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(IReadOnlyCollection? username, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserRequestDescriptor(username); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(IReadOnlyCollection? username, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserRequestDescriptor(username); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get users. - /// - /// - /// Get information about users in the native realm and built-in users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserPrivilegesResponse GetUserPrivileges(GetUserPrivilegesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserPrivilegesResponse GetUserPrivileges(GetUserPrivilegesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserPrivilegesResponse GetUserPrivileges() - { - var descriptor = new GetUserPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserPrivilegesResponse GetUserPrivileges(Action configureRequest) - { - var descriptor = new GetUserPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserPrivilegesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetUserPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get user privileges. - /// - /// - /// Get the security privileges for the logged in user. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// To check whether a user has a specific list of privileges, use the has privileges API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserProfileResponse GetUserProfile(GetUserProfileRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserProfileAsync(GetUserProfileRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserProfileResponse GetUserProfile(GetUserProfileRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserProfileResponse GetUserProfile(IReadOnlyCollection uid) - { - var descriptor = new GetUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetUserProfileResponse GetUserProfile(IReadOnlyCollection uid, Action configureRequest) - { - var descriptor = new GetUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserProfileAsync(GetUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserProfileRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a user profile. - /// - /// - /// Get a user's profile using the unique profile ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetUserProfileRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(GrantApiKeyRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey() - { - var descriptor = new GrantApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey(Action> configureRequest) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey() - { - var descriptor = new GrantApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GrantApiKeyResponse GrantApiKey(Action configureRequest) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Grant an API key. - /// - /// - /// Create an API key on behalf of another user. - /// This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. - /// The caller must have authentication credentials for the user on whose behalf the API key will be created. - /// It is not possible to use this API to create an API key without that user's credentials. - /// The supported user authentication credential types are: - /// - /// - /// - /// - /// username and password - /// - /// - /// - /// - /// Elasticsearch access tokens - /// - /// - /// - /// - /// JWTs - /// - /// - /// - /// - /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. - /// In this case, the API key will be created on behalf of the impersonated user. - /// - /// - /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. - /// The API keys are created by the Elasticsearch API key service, which is automatically enabled. - /// - /// - /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. - /// If applicable, it also returns expiration information for the API key in milliseconds. - /// - /// - /// By default, API keys never expire. You can specify expiration information when you create the API keys. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GrantApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GrantApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges(HasPrivilegesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(HasPrivilegesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges(HasPrivilegesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user) - { - var descriptor = new HasPrivilegesRequestDescriptor(user); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user, Action configureRequest) - { - var descriptor = new HasPrivilegesRequestDescriptor(user); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges() - { - var descriptor = new HasPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesResponse HasPrivileges(Action configureRequest) - { - var descriptor = new HasPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(HasPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesRequestDescriptor(user); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesRequestDescriptor(user); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user privileges. - /// - /// - /// Determine whether the specified user has a specified list of privileges. - /// All users can use this API, but only to determine their own privileges. - /// To check the privileges of other users, you must use the run as feature. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(HasPrivilegesUserProfileRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(HasPrivilegesUserProfileRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile() - { - var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(Action configureRequest) - { - var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesUserProfileAsync(CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check user profile privileges. - /// - /// - /// Determine whether the users associated with the specified user profile IDs have all the requested privileges. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HasPrivilegesUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateApiKeyResponse InvalidateApiKey(InvalidateApiKeyRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateApiKeyResponse InvalidateApiKey(InvalidateApiKeyRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateApiKeyResponse InvalidateApiKey() - { - var descriptor = new InvalidateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateApiKeyResponse InvalidateApiKey(Action configureRequest) - { - var descriptor = new InvalidateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateApiKeyAsync(CancellationToken cancellationToken = default) - { - var descriptor = new InvalidateApiKeyRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate API keys. - /// - /// - /// This API invalidates API keys created by the create API key or grant API key APIs. - /// Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. - /// - /// - /// To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. - /// The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. - /// The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. - /// The manage_own_api_key only allows deleting REST API keys that are owned by the user. - /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: - /// - /// - /// - /// - /// Set the parameter owner=true. - /// - /// - /// - /// - /// Or, set both username and realm_name to match the user's identity. - /// - /// - /// - /// - /// Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new InvalidateApiKeyRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateTokenResponse InvalidateToken(InvalidateTokenRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateTokenAsync(InvalidateTokenRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateTokenResponse InvalidateToken(InvalidateTokenRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateTokenResponse InvalidateToken() - { - var descriptor = new InvalidateTokenRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InvalidateTokenResponse InvalidateToken(Action configureRequest) - { - var descriptor = new InvalidateTokenRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateTokenAsync(InvalidateTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateTokenAsync(CancellationToken cancellationToken = default) - { - var descriptor = new InvalidateTokenRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Invalidate a token. - /// - /// - /// The access tokens returned by the get token API have a finite period of time for which they are valid. - /// After that time period, they can no longer be used. - /// The time period is defined by the xpack.security.authc.token.timeout setting. - /// - /// - /// The refresh tokens returned by the get token API are only valid for 24 hours. - /// They can also be used exactly once. - /// If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API. - /// - /// - /// NOTE: While all parameters are optional, at least one of them is required. - /// More specifically, either one of token or refresh_token parameters is required. - /// If none of these two are specified, then realm_name and/or username need to be specified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InvalidateTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new InvalidateTokenRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcAuthenticateResponse OidcAuthenticate(OidcAuthenticateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcAuthenticateAsync(OidcAuthenticateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcAuthenticateResponse OidcAuthenticate(OidcAuthenticateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcAuthenticateResponse OidcAuthenticate() - { - var descriptor = new OidcAuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcAuthenticateResponse OidcAuthenticate(Action configureRequest) - { - var descriptor = new OidcAuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcAuthenticateAsync(OidcAuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcAuthenticateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new OidcAuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Authenticate OpenID Connect. - /// - /// - /// Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcAuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OidcAuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcLogoutResponse OidcLogout(OidcLogoutRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcLogoutAsync(OidcLogoutRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcLogoutResponse OidcLogout(OidcLogoutRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcLogoutResponse OidcLogout() - { - var descriptor = new OidcLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcLogoutResponse OidcLogout(Action configureRequest) - { - var descriptor = new OidcLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcLogoutAsync(OidcLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcLogoutAsync(CancellationToken cancellationToken = default) - { - var descriptor = new OidcLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Logout of OpenID Connect. - /// - /// - /// Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API. - /// - /// - /// If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OidcLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcPrepareAuthenticationResponse OidcPrepareAuthentication(OidcPrepareAuthenticationRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcPrepareAuthenticationAsync(OidcPrepareAuthenticationRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcPrepareAuthenticationResponse OidcPrepareAuthentication(OidcPrepareAuthenticationRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcPrepareAuthenticationResponse OidcPrepareAuthentication() - { - var descriptor = new OidcPrepareAuthenticationRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OidcPrepareAuthenticationResponse OidcPrepareAuthentication(Action configureRequest) - { - var descriptor = new OidcPrepareAuthenticationRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcPrepareAuthenticationAsync(OidcPrepareAuthenticationRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcPrepareAuthenticationAsync(CancellationToken cancellationToken = default) - { - var descriptor = new OidcPrepareAuthenticationRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Prepare OpenID connect authentication. - /// - /// - /// Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch. - /// - /// - /// The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process. - /// - /// - /// Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. - /// These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OidcPrepareAuthenticationAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OidcPrepareAuthenticationRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPrivilegesResponse PutPrivileges(PutPrivilegesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPrivilegesAsync(PutPrivilegesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPrivilegesResponse PutPrivileges(PutPrivilegesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPrivilegesResponse PutPrivileges() - { - var descriptor = new PutPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutPrivilegesResponse PutPrivileges(Action configureRequest) - { - var descriptor = new PutPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPrivilegesAsync(PutPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPrivilegesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new PutPrivilegesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update application privileges. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_security cluster privilege (or a greater privilege such as all). - /// - /// - /// - /// - /// The "Manage Application Privileges" global privilege for the application being referenced in the request. - /// - /// - /// - /// - /// Application names are formed from a prefix, with an optional suffix that conform to the following rules: - /// - /// - /// - /// - /// The prefix must begin with a lowercase ASCII letter. - /// - /// - /// - /// - /// The prefix must contain only ASCII letters or digits. - /// - /// - /// - /// - /// The prefix must be at least 3 characters long. - /// - /// - /// - /// - /// If the suffix exists, it must begin with either a dash - or _. - /// - /// - /// - /// - /// The suffix cannot contain any of the following characters: \, /, *, ?, ", <, >, |, ,, *. - /// - /// - /// - /// - /// No part of the name can contain whitespace. - /// - /// - /// - /// - /// Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and .. - /// - /// - /// Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutPrivilegesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(PutRoleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(PutRoleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserResponse GetUser() { + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(PutRoleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new PutRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) - { - var descriptor = new PutRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); - } - - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(PutRoleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserResponse GetUser(System.Action action) { - var descriptor = new PutRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserResponse GetUser(System.Collections.Generic.ICollection? username) { - var descriptor = new PutRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserResponse GetUser(System.Collections.Generic.ICollection? username, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserAsync(Elastic.Clients.Elasticsearch.Security.GetUserRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserAsync(System.Collections.Generic.ICollection? username, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(username); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update roles. - /// - /// - /// The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. - /// The create or update roles API cannot update roles that are defined in roles files. - /// File-based role management is not available in Elastic Serverless. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserAsync(System.Collections.Generic.ICollection? username, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserRequestDescriptor(username); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleMappingResponse PutRoleMapping(PutRoleMappingRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse GetUserPrivileges(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleMappingAsync(PutRoleMappingRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse GetUserPrivileges() { + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleMappingResponse PutRoleMapping(PutRoleMappingRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesResponse GetUserPrivileges(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task GetUserPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task GetUserPrivilegesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleMappingAsync(PutRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserPrivilegesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse GetUserProfile(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest request) { - var descriptor = new PutRoleMappingRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update role mappings. - /// - /// - /// Role mappings define which roles are assigned to each user. - /// Each mapping has rules that identify users and a list of roles that are granted to those users. - /// The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files. - /// - /// - /// NOTE: This API does not create roles. Rather, it maps users to existing roles. - /// Roles can be created by using the create or update roles API or roles files. - /// - /// - /// Role templates - /// - /// - /// The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. - /// For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. - /// The roles field is used for this purpose. - /// - /// - /// For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. - /// The role_templates field is used for this purpose. - /// - /// - /// NOTE: To use role templates successfully, the relevant scripting feature must be enabled. - /// Otherwise, all attempts to create a role mapping with role templates fail. - /// - /// - /// All of the user fields that are available in the role mapping rules are also available in the role templates. - /// Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated. - /// - /// - /// By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. - /// If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse GetUserProfile(System.Collections.Generic.ICollection uid) { - var descriptor = new PutRoleMappingRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update users. - /// - /// - /// Add and update users in the native realm. - /// A password is required for adding a new user but is optional when updating an existing user. - /// To change a user's password without updating any other fields, use the change password API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutUserResponse PutUser(PutUserRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GetUserProfileResponse GetUserProfile(System.Collections.Generic.ICollection uid, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update users. - /// - /// - /// Add and update users in the native realm. - /// A password is required for adding a new user but is optional when updating an existing user. - /// To change a user's password without updating any other fields, use the change password API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutUserAsync(PutUserRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserProfileAsync(Elastic.Clients.Elasticsearch.Security.GetUserProfileRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update users. - /// - /// - /// Add and update users in the native realm. - /// A password is required for adding a new user but is optional when updating an existing user. - /// To change a user's password without updating any other fields, use the change password API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutUserResponse PutUser(PutUserRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetUserProfileAsync(System.Collections.Generic.ICollection uid, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update users. - /// - /// - /// Add and update users in the native realm. - /// A password is required for adding a new user but is optional when updating an existing user. - /// To change a user's password without updating any other fields, use the change password API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutUserAsync(PutUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetUserProfileAsync(System.Collections.Generic.ICollection uid, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.GetUserProfileRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse GrantApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(QueryApiKeysRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse GrantApiKey(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.GrantApiKeyResponse GrantApiKey(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys() + public virtual System.Threading.Tasks.Task GrantApiKeyAsync(Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys(Action> configureRequest) + public virtual System.Threading.Tasks.Task GrantApiKeyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GrantApiKeyAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys() + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest request) { - var descriptor = new QueryApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryApiKeysResponse QueryApiKeys(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse HasPrivileges() { - var descriptor = new QueryApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse HasPrivileges(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user) { - var descriptor = new QueryApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(user); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user, System.Action action) { - var descriptor = new QueryApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(user); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HasPrivilegesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryApiKeysRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find API keys with a query. - /// - /// - /// Get a paginated list of API keys and their information. - /// You can optionally filter the results with a query. - /// - /// - /// To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. - /// If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. - /// If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryApiKeysAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HasPrivilegesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryApiKeysRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole(QueryRoleRequest request) + public virtual System.Threading.Tasks.Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(user); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(QueryRoleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesRequestDescriptor(user); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole(QueryRoleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest request) { - descriptor.BeforeRequest(); - return DoRequest, QueryRoleResponse, QueryRoleRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole() + public virtual Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(System.Action action) { - var descriptor = new QueryRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, QueryRoleResponse, QueryRoleRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole(Action> configureRequest) + public virtual System.Threading.Tasks.Task HasPrivilegesUserProfileAsync(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, QueryRoleResponse, QueryRoleRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole(QueryRoleRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task HasPrivilegesUserProfileAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole() + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse InvalidateApiKey(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest request) { - var descriptor = new QueryRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryRoleResponse QueryRole(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse InvalidateApiKey() { - var descriptor = new QueryRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(QueryRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyResponse InvalidateApiKey(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InvalidateApiKeyAsync(Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InvalidateApiKeyAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(QueryRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InvalidateApiKeyAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateApiKeyRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse InvalidateToken(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest request) { - var descriptor = new QueryRoleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find roles with a query. - /// - /// - /// Get roles in a paginated manner. - /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. - /// The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. - /// You can optionally filter the results with a query. - /// Also, the results can be paginated and sorted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse InvalidateToken() { - var descriptor = new QueryRoleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser(QueryUserRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.InvalidateTokenResponse InvalidateToken(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(QueryUserRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InvalidateTokenAsync(Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser(QueryUserRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task InvalidateTokenAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser() + public virtual System.Threading.Tasks.Task InvalidateTokenAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.InvalidateTokenRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponse OidcAuthenticate(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.OidcAuthenticateResponse OidcAuthenticate(System.Action action) { - var descriptor = new QueryUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser(QueryUserRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task OidcAuthenticateAsync(Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser() + public virtual System.Threading.Tasks.Task OidcAuthenticateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcAuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryUserResponse QueryUser(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.OidcLogoutResponse OidcLogout(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest request) { - var descriptor = new QueryUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.OidcLogoutResponse OidcLogout(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OidcLogoutAsync(Elastic.Clients.Elasticsearch.Security.OidcLogoutRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OidcLogoutAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse OidcPrepareAuthentication(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse OidcPrepareAuthentication() { - var descriptor = new QueryUserRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find users with a query. - /// - /// - /// Get information for users in a paginated manner. - /// You can optionally filter the results with a query. - /// - /// - /// NOTE: As opposed to the get user API, built-in users are excluded from the result. - /// This API is only for native users. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryUserAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationResponse OidcPrepareAuthentication(System.Action action) { - var descriptor = new QueryUserRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlAuthenticateResponse SamlAuthenticate(SamlAuthenticateRequest request) + public virtual System.Threading.Tasks.Task OidcPrepareAuthenticationAsync(Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task OidcPrepareAuthenticationAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlAuthenticateResponse SamlAuthenticate(SamlAuthenticateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task OidcPrepareAuthenticationAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.OidcPrepareAuthenticationRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlAuthenticateResponse SamlAuthenticate() + public virtual Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponse PutPrivileges(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest request) { - var descriptor = new SamlAuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlAuthenticateResponse SamlAuthenticate(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.PutPrivilegesResponse PutPrivileges(System.Action action) { - var descriptor = new SamlAuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutPrivilegesAsync(Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlAuthenticateAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutPrivilegesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlAuthenticateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.PutPrivilegesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Authenticate SAML. - /// - /// - /// Submit a SAML response message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML message that is submitted can be: - /// - /// - /// - /// - /// A response to a SAML authentication request that was previously created using the SAML prepare authentication API. - /// - /// - /// - /// - /// An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow. - /// - /// - /// - /// - /// In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>. - /// - /// - /// After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. - /// This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlAuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Security.PutRoleRequest request) { - var descriptor = new SamlAuthenticateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlCompleteLogoutResponse SamlCompleteLogout(SamlCompleteLogoutRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlCompleteLogoutResponse SamlCompleteLogout(SamlCompleteLogoutRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutRoleAsync(Elastic.Clients.Elasticsearch.Security.PutRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlCompleteLogoutResponse SamlCompleteLogout() + public virtual System.Threading.Tasks.Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlCompleteLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlCompleteLogoutResponse SamlCompleteLogout(Action configureRequest) + public virtual System.Threading.Tasks.Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlCompleteLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlCompleteLogoutAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest request) { - var descriptor = new SamlCompleteLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML completely. - /// - /// - /// Verifies the logout response sent from the SAML IdP. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. - /// This API verifies the response by ensuring the content is relevant and validating its signature. - /// An empty response is returned if the verification process is successful. - /// The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. - /// The caller of this API must prepare the request accordingly so that this API can handle either of them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlCompleteLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new SamlCompleteLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlInvalidateResponse SamlInvalidate(SamlInvalidateRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlInvalidateAsync(SamlInvalidateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlInvalidateResponse SamlInvalidate(SamlInvalidateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlInvalidateResponse SamlInvalidate() + public virtual System.Threading.Tasks.Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlInvalidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlInvalidateResponse SamlInvalidate(Action configureRequest) + public virtual System.Threading.Tasks.Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlInvalidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlInvalidateAsync(SamlInvalidateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.PutRoleMappingRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlInvalidateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutUserResponse PutUser(Elastic.Clients.Elasticsearch.Security.PutUserRequest request) { - var descriptor = new SamlInvalidateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Invalidate SAML. - /// - /// - /// Submit a SAML LogoutRequest message to Elasticsearch for consumption. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// The logout request comes from the SAML IdP during an IdP initiated Single Logout. - /// The custom web application can use this API to have Elasticsearch process the LogoutRequest. - /// After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. - /// Thus the user can be redirected back to their IdP. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlInvalidateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.PutUserResponse PutUser() { - var descriptor = new SamlInvalidateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlLogoutResponse SamlLogout(SamlLogoutRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.PutUserResponse PutUser(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlLogoutAsync(SamlLogoutRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutUserAsync(Elastic.Clients.Elasticsearch.Security.PutUserRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlLogoutResponse SamlLogout(SamlLogoutRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutUserAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlLogoutResponse SamlLogout() + public virtual System.Threading.Tasks.Task PutUserAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.PutUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlLogoutResponse SamlLogout(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse QueryApiKeys(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest request) { - var descriptor = new SamlLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlLogoutAsync(SamlLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse QueryApiKeys() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlLogoutAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse QueryApiKeys(System.Action action) { - var descriptor = new SamlLogoutRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Logout of SAML. - /// - /// - /// Submits a request to invalidate an access token and refresh token. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API invalidates the tokens that were generated for a user by the SAML authenticate API. - /// If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.QueryApiKeysResponse QueryApiKeys(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task QueryApiKeysAsync(Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlLogoutRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(SamlPrepareAuthenticationRequest request) + public virtual System.Threading.Tasks.Task QueryApiKeysAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task QueryApiKeysAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryApiKeysAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryApiKeysRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(SamlPrepareAuthenticationRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.QueryRoleResponse QueryRole(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication() + public virtual Elastic.Clients.Elasticsearch.Security.QueryRoleResponse QueryRole() { - var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.QueryRoleResponse QueryRole(System.Action action) { - var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.QueryRoleResponse QueryRole(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlPrepareAuthenticationAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryRoleAsync(Elastic.Clients.Elasticsearch.Security.QueryRoleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Prepare SAML authentication. - /// - /// - /// Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch. - /// - /// - /// NOTE: This API is intended for use by custom web applications other than Kibana. - /// If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack. - /// - /// - /// This API returns a URL pointing to the SAML Identity Provider. - /// You can use the URL to redirect the browser of the user in order to continue the authentication process. - /// The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. - /// If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. - /// These parameters contain the algorithm used for the signature and the signature value itself. - /// It also returns a random string that uniquely identifies this SAML Authentication request. - /// The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlPrepareAuthenticationAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryRoleAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(SamlServiceProviderMetadataRequest request) + public virtual System.Threading.Tasks.Task QueryRoleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryRoleAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryRoleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(SamlServiceProviderMetadataRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.QueryUserResponse QueryUser(Elastic.Clients.Elasticsearch.Security.QueryUserRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName) + public virtual Elastic.Clients.Elasticsearch.Security.QueryUserResponse QueryUser() { - var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.QueryUserResponse QueryUser(System.Action action) { - var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.QueryUserResponse QueryUser(System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryUserAsync(Elastic.Clients.Elasticsearch.Security.QueryUserRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create SAML service provider metadata. - /// - /// - /// Generate SAML metadata for a SAML 2.0 Service Provider. - /// - /// - /// The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. - /// This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryUserAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SuggestUserProfilesResponse SuggestUserProfiles(SuggestUserProfilesRequest request) + public virtual System.Threading.Tasks.Task QueryUserAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task QueryUserAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.QueryUserRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SuggestUserProfilesResponse SuggestUserProfiles(SuggestUserProfilesRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponse SamlAuthenticate(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SuggestUserProfilesResponse SuggestUserProfiles() + public virtual Elastic.Clients.Elasticsearch.Security.SamlAuthenticateResponse SamlAuthenticate(System.Action action) { - var descriptor = new SuggestUserProfilesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SuggestUserProfilesResponse SuggestUserProfiles(Action configureRequest) + public virtual System.Threading.Tasks.Task SamlAuthenticateAsync(Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SuggestUserProfilesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SamlAuthenticateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlAuthenticateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SuggestUserProfilesAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponse SamlCompleteLogout(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest request) { - var descriptor = new SuggestUserProfilesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Suggest a user profile. - /// - /// - /// Get suggestions for user profiles that match specified search criteria. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SuggestUserProfilesAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutResponse SamlCompleteLogout(System.Action action) { - var descriptor = new SuggestUserProfilesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequest request) + public virtual System.Threading.Tasks.Task SamlCompleteLogoutAsync(Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SamlCompleteLogoutAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Security.SamlCompleteLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponse SamlInvalidate(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.SamlInvalidateResponse SamlInvalidate(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task SamlInvalidateAsync(Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task SamlInvalidateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlInvalidateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.SamlLogoutResponse SamlLogout(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest request) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.SamlLogoutResponse SamlLogout(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task SamlLogoutAsync(Elastic.Clients.Elasticsearch.Security.SamlLogoutRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task SamlLogoutAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlLogoutRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse SamlPrepareAuthentication(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse SamlPrepareAuthentication() { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationResponse SamlPrepareAuthentication(System.Action action) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SamlPrepareAuthenticationAsync(Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SamlPrepareAuthenticationAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update an API key. - /// - /// - /// Update attributes of an existing API key. - /// This API supports updates to an API key's access scope, expiration, and metadata. - /// - /// - /// To use this API, you must have at least the manage_own_api_key cluster privilege. - /// Users can only update API keys that they created or that were granted to them. - /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required. - /// - /// - /// Use this API to update API keys created by the create API key or grant API Key APIs. - /// If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. - /// It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. - /// The snapshot of the owner's permissions is updated automatically on every call. - /// - /// - /// IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. - /// This change can occur if the owner user's permissions have changed since the API key was created or last modified. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SamlPrepareAuthenticationAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlPrepareAuthenticationRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(UpdateCrossClusterApiKeyRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(UpdateCrossClusterApiKeyRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName) { + var builder = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(realmName); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(UpdateCrossClusterApiKeyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(realmName); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(realmName); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual System.Threading.Tasks.Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SamlServiceProviderMetadataRequestDescriptor(realmName); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(UpdateCrossClusterApiKeyRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse SuggestUserProfiles(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse SuggestUserProfiles() { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesResponse SuggestUserProfiles(System.Action action) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(UpdateCrossClusterApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SuggestUserProfilesAsync(Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SuggestUserProfilesAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task SuggestUserProfilesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateCrossClusterApiKeyResponse, UpdateCrossClusterApiKeyRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.SuggestUserProfilesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(UpdateCrossClusterApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a cross-cluster API key. - /// - /// - /// Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access. - /// - /// - /// To use this API, you must have at least the manage_security cluster privilege. - /// Users can only update API keys that they created. - /// To update another user's API key, use the run_as feature to submit a request on behalf of another user. - /// - /// - /// IMPORTANT: It's not possible to use an API key as the authentication credential for this API. - /// To update an API key, the owner user's credentials are required. - /// - /// - /// It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API. - /// - /// - /// This API supports updates to an API key's access scope, metadata, and expiration. - /// The owner user's information, such as the username and realm, is also updated automatically on every call. - /// - /// - /// NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new UpdateCrossClusterApiKeyRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings(UpdateSettingsRequest request) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(UpdateSettingsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings(UpdateSettingsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings() + public virtual System.Threading.Tasks.Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings(Action> configureRequest) + public virtual System.Threading.Tasks.Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyResponse UpdateCrossClusterApiKey(Elastic.Clients.Elasticsearch.Id id, System.Action> action) { - var descriptor = new UpdateSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings(UpdateSettingsRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings() + public virtual System.Threading.Tasks.Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateSettingsResponse UpdateSettings(Action configureRequest) + public virtual System.Threading.Tasks.Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(UpdateSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateCrossClusterApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateCrossClusterApiKeyRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse UpdateSettings(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest request) { - var descriptor = new UpdateSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse UpdateSettings() { - var descriptor = new UpdateSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateSettingsResponse, UpdateSettingsRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(UpdateSettingsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse UpdateSettings(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateSettingsResponse UpdateSettings(System.Action> action) { - var descriptor = new UpdateSettingsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update security index settings. - /// - /// - /// Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas. - /// - /// - /// NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates. - /// - /// - /// If a specific index is not in use on the system and settings are provided for it, the request will be rejected. - /// This API does not yet support configuring the settings for indices before they are in use. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateSettingsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateSettingsAsync(Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateSettingsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateUserProfileDataResponse UpdateUserProfileData(UpdateUserProfileDataRequest request) + public virtual System.Threading.Tasks.Task UpdateSettingsAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateUserProfileDataResponse UpdateUserProfileData(UpdateUserProfileDataRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task UpdateSettingsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateUserProfileDataResponse UpdateUserProfileData(string uid) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse UpdateUserProfileData(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest request) { - var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateUserProfileDataResponse UpdateUserProfileData(string uid, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse UpdateUserProfileData(string uid) { - var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataResponse UpdateUserProfileData(string uid, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateUserProfileDataAsync(string uid, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateUserProfileDataAsync(Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update user profile data. - /// - /// - /// Update specific data for the user profile that is associated with a unique ID. - /// - /// - /// NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. - /// Individual users and external applications should not call this API directly. - /// Elastic reserves the right to change or remove this feature in future releases without prior notice. - /// - /// - /// To use this API, you must have one of the following privileges: - /// - /// - /// - /// - /// The manage_user_profile cluster privilege. - /// - /// - /// - /// - /// The update_profile_data global privilege for the namespaces that are referenced in the request. - /// - /// - /// - /// - /// This API updates the labels and data fields of an existing user profile document with JSON objects. - /// New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request. - /// - /// - /// For both labels and data, content is namespaced by the top-level fields. - /// The update_profile_data global privilege grants privileges for updating only the allowed namespaces. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateUserProfileDataAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateUserProfileDataAsync(string uid, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(uid); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateUserProfileDataAsync(string uid, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Security.UpdateUserProfileDataRequestDescriptor(uid); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Simulate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Simulate.g.cs index ac004dcf4c8..831da82c208 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Simulate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Simulate.g.cs @@ -18,763 +18,139 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Simulate; -public partial class SimulateNamespacedClient : NamespacedClientProxy +public partial class SimulateNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SimulateNamespacedClient() : base() { } - internal SimulateNamespacedClient(ElasticsearchClient client) : base(client) + internal SimulateNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(IngestRequest request) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(Elastic.Clients.Elasticsearch.Simulate.IngestRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(IngestRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(IngestRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, IngestResponse, IngestRequestParameters>(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new IngestRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, IngestResponse, IngestRequestParameters>(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest) - { - var descriptor = new IngestRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IngestResponse, IngestRequestParameters>(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest() - { - var descriptor = new IngestRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, IngestResponse, IngestRequestParameters>(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Action> configureRequest) - { - var descriptor = new IngestRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IngestResponse, IngestRequestParameters>(descriptor); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(IngestRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new IngestRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest) - { - var descriptor = new IngestRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest() + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index) { - var descriptor = new IngestRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IngestResponse Ingest(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action) { - var descriptor = new IngestRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(IngestRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest() { - descriptor.BeforeRequest(); - return DoRequestAsync, IngestResponse, IngestRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(System.Action> action) { - var descriptor = new IngestRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, IngestResponse, IngestRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Simulate.IngestResponse Ingest(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) { - var descriptor = new IngestRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IngestResponse, IngestRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(Elastic.Clients.Elasticsearch.Simulate.IngestRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, IngestResponse, IngestRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IngestResponse, IngestRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(IngestRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Simulate data ingestion. - /// Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index. - /// - /// - /// This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch. - /// - /// - /// The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. - /// If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. - /// No data is indexed into Elasticsearch. - /// Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. - /// The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result. - /// - /// - /// This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. - /// The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index. - /// - /// - /// By default, the pipeline definitions that are currently in the system are used. - /// However, you can supply substitute pipeline definitions in the body of the request. - /// These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IngestAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task IngestAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new IngestRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Simulate.IngestRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Slm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Slm.g.cs index 0155e78e786..a53d08247a0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Slm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Slm.g.cs @@ -18,1206 +18,471 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -public partial class SnapshotLifecycleManagementNamespacedClient : NamespacedClientProxy +public partial class SnapshotLifecycleManagementNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SnapshotLifecycleManagementNamespacedClient() : base() { } - internal SnapshotLifecycleManagementNamespacedClient(ElasticsearchClient client) : base(client) + internal SnapshotLifecycleManagementNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(DeleteLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(DeleteLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name policyId) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(policyId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(DeleteLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name policyId) - { - var descriptor = new DeleteLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest) - { - var descriptor = new DeleteLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(DeleteLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a policy. - /// Delete a snapshot lifecycle policy definition. - /// This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteLifecycleResponse ExecuteLifecycle(ExecuteLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleResponse DeleteLifecycle(Elastic.Clients.Elasticsearch.Name policyId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteLifecycleAsync(ExecuteLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteLifecycleResponse ExecuteLifecycle(ExecuteLifecycleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteLifecycleResponse ExecuteLifecycle(Elastic.Clients.Elasticsearch.Name policyId) - { - var descriptor = new ExecuteLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteLifecycleResponse ExecuteLifecycle(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest) - { - var descriptor = new ExecuteLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteLifecycleAsync(ExecuteLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, CancellationToken cancellationToken = default) - { - var descriptor = new ExecuteLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run a policy. - /// Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. - /// The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExecuteLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteRetentionResponse ExecuteRetention(ExecuteRetentionRequest request) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(policyId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteRetentionAsync(ExecuteRetentionRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.DeleteLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteRetentionResponse ExecuteRetention(ExecuteRetentionRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteRetentionResponse ExecuteRetention() - { - var descriptor = new ExecuteRetentionRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExecuteRetentionResponse ExecuteRetention(Action configureRequest) - { - var descriptor = new ExecuteRetentionRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteRetentionAsync(ExecuteRetentionRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteRetentionAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ExecuteRetentionRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Run a retention policy. - /// Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. - /// The retention policy is normally applied according to its schedule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExecuteRetentionAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExecuteRetentionRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(GetLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse ExecuteLifecycle(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(GetLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse ExecuteLifecycle(Elastic.Clients.Elasticsearch.Name policyId) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(policyId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(GetLifecycleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleResponse ExecuteLifecycle(Elastic.Clients.Elasticsearch.Name policyId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Names? policyId) + public virtual System.Threading.Tasks.Task ExecuteLifecycleAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Names? policyId, Action configureRequest) + public virtual System.Threading.Tasks.Task ExecuteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(policyId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle() + public virtual System.Threading.Tasks.Task ExecuteLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetLifecycleResponse GetLifecycle(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse ExecuteRetention(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest request) { - var descriptor = new GetLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(GetLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse ExecuteRetention() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Names? policyId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionResponse ExecuteRetention(System.Action action) { - var descriptor = new GetLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Names? policyId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecuteRetentionAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecuteRetentionAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get policy information. - /// Get snapshot lifecycle policy definitions and information about the latest snapshot attempts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetLifecycleAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ExecuteRetentionAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetLifecycleRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.ExecuteRetentionRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetStatsResponse GetStats(GetStatsRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatsAsync(GetStatsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse GetLifecycle() { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetStatsResponse GetStats(GetStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse GetLifecycle(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetStatsResponse GetStats() + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Names? policyId) { - var descriptor = new GetStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(policyId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetStatsResponse GetStats(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleResponse GetLifecycle(Elastic.Clients.Elasticsearch.Names? policyId, System.Action action) { - var descriptor = new GetStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatsAsync(GetStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetStatsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot lifecycle management statistics. - /// Get global and policy-level statistics about actions taken by snapshot lifecycle management. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetStatsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSlmStatusResponse GetStatus(GetSlmStatusRequest request) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Names? policyId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(policyId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetSlmStatusRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetLifecycleAsync(Elastic.Clients.Elasticsearch.Names? policyId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSlmStatusResponse GetStatus(GetSlmStatusRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse GetStats(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSlmStatusResponse GetStatus() + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse GetStats() { - var descriptor = new GetSlmStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSlmStatusResponse GetStatus(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsResponse GetStats(System.Action action) { - var descriptor = new GetSlmStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(GetSlmStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatsAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSlmStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot lifecycle management status. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetStatusAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSlmStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetStatsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(PutLifecycleRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse GetStatus(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(PutLifecycleRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse GetStatus() { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(PutLifecycleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusResponse GetStatus(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name policyId) + public virtual System.Threading.Tasks.Task GetStatusAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetStatusAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(PutLifecycleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetStatusAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.GetSlmStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest request) { - var descriptor = new PutLifecycleRequestDescriptor(policyId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a policy. - /// Create or update a snapshot lifecycle policy. - /// If the policy already exists, this request increments the policy version. - /// Only the latest version of a policy is stored. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name policyId) { - var descriptor = new PutLifecycleRequestDescriptor(policyId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(policyId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartSlmResponse Start(StartSlmRequest request) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleResponse PutLifecycle(Elastic.Clients.Elasticsearch.Name policyId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(StartSlmRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartSlmResponse Start(StartSlmRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(policyId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartSlmResponse Start() + public virtual System.Threading.Tasks.Task PutLifecycleAsync(Elastic.Clients.Elasticsearch.Name policyId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartSlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.PutLifecycleRequestDescriptor(policyId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartSlmResponse Start(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse Start(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest request) { - var descriptor = new StartSlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(StartSlmRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse Start() { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmResponse Start(System.Action action) { - var descriptor = new StartSlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start snapshot lifecycle management. - /// Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. - /// Manually starting SLM is necessary only if it has been stopped using the stop SLM API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartSlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopSlmResponse Stop(StopSlmRequest request) + public virtual System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(StopSlmRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StartSlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopSlmResponse Stop(StopSlmRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse Stop(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopSlmResponse Stop() + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse Stop() { - var descriptor = new StopSlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopSlmResponse Stop(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmResponse Stop(System.Action action) { - var descriptor = new StopSlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(StopSlmRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopSlmRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop snapshot lifecycle management. - /// Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. - /// This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. - /// Stopping SLM does not stop any snapshots that are in progress. - /// You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. - /// - /// - /// The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. - /// Use the get snapshot lifecycle management status API to see if SLM is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StopAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopSlmRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StopSlmRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Snapshot.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Snapshot.g.cs index d696321c120..a06ae7228a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Snapshot.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Snapshot.g.cs @@ -18,3545 +18,741 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public partial class SnapshotNamespacedClient : NamespacedClientProxy +public partial class SnapshotNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SnapshotNamespacedClient() : base() { } - internal SnapshotNamespacedClient(ElasticsearchClient client) : base(client) + internal SnapshotNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CleanupRepositoryResponse CleanupRepository(CleanupRepositoryRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse CleanupRepository(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CleanupRepositoryAsync(CleanupRepositoryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse CleanupRepository(Elastic.Clients.Elasticsearch.Name name) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CleanupRepositoryResponse CleanupRepository(CleanupRepositoryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResponse CleanupRepository(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CleanupRepositoryResponse CleanupRepository(Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task CleanupRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CleanupRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CleanupRepositoryResponse CleanupRepository(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task CleanupRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CleanupRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CleanupRepositoryAsync(CleanupRepositoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CleanupRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CleanupRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse Clone(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest request) { - var descriptor = new CleanupRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clean up the snapshot repository. - /// Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CleanupRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse Clone(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot) { - var descriptor = new CleanupRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneSnapshotResponse Clone(CloneSnapshotRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotResponse Clone(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(CloneSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneSnapshotResponse Clone(CloneSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneSnapshotResponse Clone(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot) + public virtual System.Threading.Tasks.Task CloneAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CloneSnapshotResponse Clone(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse Create(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest request) { - var descriptor = new CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(CloneSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse Create(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotResponse Create(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action) { - var descriptor = new CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Clone a snapshot. - /// Clone part of all of a snapshot into another snapshot in the same repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CloneAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Elastic.Clients.Elasticsearch.Name targetSnapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CloneSnapshotRequestDescriptor(repository, snapshot, targetSnapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateSnapshotResponse Create(CreateSnapshotRequest request) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateSnapshotResponse Create(CreateSnapshotRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse CreateRepository(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateSnapshotResponse Create(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse CreateRepository(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new CreateSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateSnapshotResponse Create(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryResponse CreateRepository(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - var descriptor = new CreateSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a snapshot. - /// Take a snapshot of a cluster or of data streams and indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CreateRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.CreateRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateRepositoryResponse CreateRepository(CreateRepositoryRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse Delete(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateRepositoryAsync(CreateRepositoryRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse Delete(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateRepositoryResponse CreateRepository(CreateRepositoryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotResponse Delete(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateRepositoryResponse CreateRepository(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository, Elastic.Clients.Elasticsearch.Name name) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateRepositoryRequestDescriptor(repository, name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateRepositoryResponse CreateRepository(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository, Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CreateRepositoryRequestDescriptor(repository, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateRepositoryAsync(CreateRepositoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse DeleteRepository(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest request) { - var descriptor = new CreateRepositoryRequestDescriptor(repository, name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a snapshot repository. - /// IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. - /// To register a snapshot repository, the cluster's global metadata must be writeable. - /// Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.IRepository repository, Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse DeleteRepository(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new CreateRepositoryRequestDescriptor(repository, name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSnapshotResponse Delete(DeleteSnapshotRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryResponse DeleteRepository(Elastic.Clients.Elasticsearch.Names name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSnapshotResponse Delete(DeleteSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task DeleteRepositoryAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSnapshotResponse Delete(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + public virtual System.Threading.Tasks.Task DeleteRepositoryAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.DeleteRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSnapshotResponse Delete(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse Get(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest request) { - var descriptor = new DeleteSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse Get(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotResponse Get(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, System.Action action) { - var descriptor = new DeleteSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshots. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRepositoryResponse DeleteRepository(DeleteRepositoryRequest request) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(repository, snapshot); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRepositoryAsync(DeleteRepositoryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetSnapshotRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRepositoryResponse DeleteRepository(DeleteRepositoryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse GetRepository(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRepositoryResponse DeleteRepository(Elastic.Clients.Elasticsearch.Names name) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse GetRepository() { - var descriptor = new DeleteRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteRepositoryResponse DeleteRepository(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse GetRepository(System.Action action) { - var descriptor = new DeleteRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRepositoryAsync(DeleteRepositoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse GetRepository(Elastic.Clients.Elasticsearch.Names? name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRepositoryAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryResponse GetRepository(Elastic.Clients.Elasticsearch.Names? name, System.Action action) { - var descriptor = new DeleteRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete snapshot repositories. - /// When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. - /// The snapshots themselves are left untouched and in place. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteRepositoryAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSnapshotResponse Get(GetSnapshotRequest request) + public virtual System.Threading.Tasks.Task GetRepositoryAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetSnapshotRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetRepositoryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSnapshotResponse Get(GetSnapshotRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetRepositoryAsync(Elastic.Clients.Elasticsearch.Names? name, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSnapshotResponse Get(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot) + public virtual System.Threading.Tasks.Task GetRepositoryAsync(Elastic.Clients.Elasticsearch.Names? name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GetRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSnapshotResponse Get(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse RepositoryAnalyze(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest request) { - var descriptor = new GetSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetSnapshotRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse RepositoryAnalyze(Elastic.Clients.Elasticsearch.Name name) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, CancellationToken cancellationToken = default) - { - var descriptor = new GetSnapshotRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get snapshot information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Names snapshot, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSnapshotRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository(GetRepositoryRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeResponse RepositoryAnalyze(Elastic.Clients.Elasticsearch.Name name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(GetRepositoryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RepositoryAnalyzeAsync(Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository(GetRepositoryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository(Elastic.Clients.Elasticsearch.Names? name) - { - var descriptor = new GetRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) - { - var descriptor = new GetRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository() - { - var descriptor = new GetRepositoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetRepositoryResponse GetRepository(Action configureRequest) - { - var descriptor = new GetRepositoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(GetRepositoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RepositoryAnalyzeAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RepositoryAnalyzeAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryAnalyzeRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest request) { - var descriptor = new GetRepositoryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get snapshot repository information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetRepositoryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(Elastic.Clients.Elasticsearch.Names name) { - var descriptor = new GetRepositoryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryAnalyzeResponse RepositoryAnalyze(RepositoryAnalyzeRequest request) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(Elastic.Clients.Elasticsearch.Names name, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryAnalyzeAsync(RepositoryAnalyzeRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RepositoryVerifyIntegrityAsync(Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryAnalyzeResponse RepositoryAnalyze(RepositoryAnalyzeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryAnalyzeResponse RepositoryAnalyze(Elastic.Clients.Elasticsearch.Name name) - { - var descriptor = new RepositoryAnalyzeRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryAnalyzeResponse RepositoryAnalyze(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) - { - var descriptor = new RepositoryAnalyzeRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryAnalyzeAsync(RepositoryAnalyzeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryAnalyzeAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) - { - var descriptor = new RepositoryAnalyzeRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Analyze a snapshot repository. - /// Analyze the performance characteristics and any incorrect behaviour found in a repository. - /// - /// - /// The response exposes implementation details of the analysis which may change from version to version. - /// The response body format is therefore not considered stable and may be different in newer versions. - /// - /// - /// There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. - /// Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system. - /// - /// - /// The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. - /// Run your first analysis with the default parameter values to check for simple problems. - /// If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. - /// Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. - /// Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once. - /// - /// - /// If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. - /// This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. - /// If so, this storage system is not suitable for use as a snapshot repository. - /// You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects. - /// - /// - /// If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. - /// You can use this information to determine the performance of your storage system. - /// If any operation fails or returns an incorrect result, the API returns an error. - /// If the API returns an error, it may not have removed all the data it wrote to the repository. - /// The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. - /// Some clients are configured to close their connection if no response is received within a certain timeout. - /// An analysis takes a long time to complete so you might need to relax any such client-side timeouts. - /// On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. - /// The path to the leftover data is recorded in the Elasticsearch logs. - /// You should verify that this location has been cleaned up correctly. - /// If there is still leftover data at the specified location, you should manually remove it. - /// - /// - /// If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. - /// The analysis attempts to detect common bugs but it does not offer 100% coverage. - /// Additionally, it does not test the following: - /// - /// - /// - /// - /// Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster. - /// - /// - /// - /// - /// Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted. - /// - /// - /// - /// - /// Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results. - /// - /// - /// - /// - /// IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. - /// This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. - /// You must ensure this load does not affect other users of these systems. - /// Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. - /// A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. - /// This indicates it behaves incorrectly in ways that the former version did not detect. - /// You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// - /// Implementation details - /// - /// - /// NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions. - /// - /// - /// The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. - /// These tasks are distributed over the data and master-eligible nodes in the cluster for execution. - /// - /// - /// For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. - /// The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. - /// If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. - /// These reads are permitted to fail, but must not return partial data. - /// If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires. - /// - /// - /// For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. - /// In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. - /// If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites. - /// - /// - /// The executing node will use a variety of different methods to write the blob. - /// For instance, where applicable, it will use both single-part and multi-part uploads. - /// Similarly, the reading nodes will use a variety of different methods to read the data back again. - /// For instance they may read the entire blob from start to end or may read only a subset of the data. - /// - /// - /// For some blob-level tasks, the executing node will cancel the write before it is complete. - /// In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob. - /// - /// - /// Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. - /// This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. - /// The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. - /// Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. - /// Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. - /// If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. - /// Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. - /// Some operations also verify the behavior on small blobs with sizes other than 8 bytes. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryAnalyzeAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RepositoryAnalyzeRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(RepositoryVerifyIntegrityRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryVerifyIntegrityAsync(RepositoryVerifyIntegrityRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(RepositoryVerifyIntegrityRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(Elastic.Clients.Elasticsearch.Names name) - { - var descriptor = new RepositoryVerifyIntegrityRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RepositoryVerifyIntegrityResponse RepositoryVerifyIntegrity(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) - { - var descriptor = new RepositoryVerifyIntegrityRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryVerifyIntegrityAsync(RepositoryVerifyIntegrityRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryVerifyIntegrityAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) - { - var descriptor = new RepositoryVerifyIntegrityRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Verify the repository integrity. - /// Verify the integrity of the contents of a snapshot repository. - /// - /// - /// This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail. - /// - /// - /// If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. - /// Until you do so: - /// - /// - /// - /// - /// It may not be possible to restore some snapshots from this repository. - /// - /// - /// - /// - /// Searchable snapshots may report errors when searched or may have unassigned shards. - /// - /// - /// - /// - /// Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored. - /// - /// - /// - /// - /// Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk. - /// - /// - /// - /// - /// Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents. - /// - /// - /// - /// - /// If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. - /// The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. - /// You must also identify what caused the damage and take action to prevent it from happening again. - /// - /// - /// If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. - /// In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository. - /// - /// - /// Avoid all operations which write to the repository while the verify repository integrity API is running. - /// If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. - /// It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting. - /// - /// - /// NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions. - /// - /// - /// NOTE: This API may not work correctly in a mixed-version cluster. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RepositoryVerifyIntegrityAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RepositoryVerifyIntegrityRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(RestoreRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(RestoreRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RepositoryVerifyIntegrityAsync(Elastic.Clients.Elasticsearch.Names name, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(name); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(RestoreRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, RestoreResponse, RestoreRequestParameters>(descriptor); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) - { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest, RestoreResponse, RestoreRequestParameters>(descriptor); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action> configureRequest) - { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RestoreResponse, RestoreRequestParameters>(descriptor); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(RestoreRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RepositoryVerifyIntegrityAsync(Elastic.Clients.Elasticsearch.Names name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryVerifyIntegrityRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse Restore(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest request) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(RestoreRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot) { - descriptor.BeforeRequest(); - return DoRequestAsync, RestoreResponse, RestoreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync, RestoreResponse, RestoreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.RestoreResponse Restore(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action> action) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RestoreResponse, RestoreRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(RestoreRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RestoreAsync(Elastic.Clients.Elasticsearch.Snapshot.RestoreRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Restore a snapshot. - /// Restore a snapshot of a cluster or data streams and indices. - /// - /// - /// You can restore a snapshot only to a running cluster with an elected master node. - /// The snapshot repository must be registered and available to the cluster. - /// The snapshot and cluster versions must be compatible. - /// - /// - /// To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks. - /// - /// - /// Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API: - /// - /// - /// GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream - /// - /// - /// If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices. - /// - /// - /// If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new RestoreRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status(SnapshotStatusRequest request) + public virtual System.Threading.Tasks.Task RestoreAsync(Elastic.Clients.Elasticsearch.Name repository, Elastic.Clients.Elasticsearch.Name snapshot, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RestoreRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(SnapshotStatusRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest request) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status(SnapshotStatusRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(System.Action action) { - var descriptor = new SnapshotStatusRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository) { - var descriptor = new SnapshotStatusRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status() + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository, System.Action action) { - var descriptor = new SnapshotStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SnapshotStatusResponse Status(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot) { - var descriptor = new SnapshotStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository, snapshot); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(SnapshotStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusResponse Status(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SnapshotStatusRequestDescriptor(repository, snapshot); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatusAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SnapshotStatusRequestDescriptor(repository, snapshot); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatusAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SnapshotStatusRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the snapshot status. - /// Get a detailed description of the current state for each shard participating in the snapshot. - /// Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. - /// If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API. - /// - /// - /// WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. - /// The API requires a read from the repository for each shard in each snapshot. - /// For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards). - /// - /// - /// Depending on the latency of your storage, such requests can take an extremely long time to return results. - /// These requests can also tax machine resources and, when using cloud storage, incur high processing costs. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StatusAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new SnapshotStatusRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual VerifyRepositoryResponse VerifyRepository(VerifyRepositoryRequest request) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task VerifyRepositoryAsync(VerifyRepositoryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository, snapshot); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual VerifyRepositoryResponse VerifyRepository(VerifyRepositoryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StatusAsync(Elastic.Clients.Elasticsearch.Name? repository, Elastic.Clients.Elasticsearch.Names? snapshot, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatusRequestDescriptor(repository, snapshot); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual VerifyRepositoryResponse VerifyRepository(Elastic.Clients.Elasticsearch.Name name) + public virtual Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse VerifyRepository(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest request) { - var descriptor = new VerifyRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual VerifyRepositoryResponse VerifyRepository(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse VerifyRepository(Elastic.Clients.Elasticsearch.Name name) { - var descriptor = new VerifyRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task VerifyRepositoryAsync(VerifyRepositoryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryResponse VerifyRepository(Elastic.Clients.Elasticsearch.Name name, System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task VerifyRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task VerifyRepositoryAsync(Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new VerifyRepositoryRequestDescriptor(name); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Verify a snapshot repository. - /// Check for common misconfigurations in a snapshot repository. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task VerifyRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task VerifyRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(name); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task VerifyRepositoryAsync(Elastic.Clients.Elasticsearch.Name name, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new VerifyRepositoryRequestDescriptor(name); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.VerifyRepositoryRequestDescriptor(name); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs index 8f72a0423c4..8f7b179bb31 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs @@ -18,1415 +18,303 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -public partial class SqlNamespacedClient : NamespacedClientProxy +public partial class SqlNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SqlNamespacedClient() : base() { } - internal SqlNamespacedClient(ElasticsearchClient client) : base(client) + internal SqlNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCursorResponse ClearCursor(ClearCursorRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCursorAsync(ClearCursorRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCursorResponse ClearCursor(ClearCursorRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCursorResponse ClearCursor() - { - var descriptor = new ClearCursorRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearCursorResponse ClearCursor(Action configureRequest) - { - var descriptor = new ClearCursorRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCursorAsync(ClearCursorRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCursorAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ClearCursorRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clear an SQL search cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearCursorAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ClearCursorRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(DeleteAsyncRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(DeleteAsyncRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(DeleteAsyncRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(DeleteAsyncRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(DeleteAsyncRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteAsyncResponse, DeleteAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(DeleteAsyncRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete an async SQL search. - /// Delete an async SQL search or a stored synchronous SQL search. - /// If the search is still running, the API cancels it. - /// - /// - /// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search: - /// - /// - /// - /// - /// Users with the cancel_task cluster privilege. - /// - /// - /// - /// - /// The user who first submitted the search. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(GetAsyncRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(GetAsyncRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(GetAsyncRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetAsyncResponse, GetAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncResponse, GetAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncResponse, GetAsyncRequestParameters>(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(GetAsyncRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new GetAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(GetAsyncRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncResponse, GetAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncResponse, GetAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncResponse, GetAsyncRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(GetAsyncRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetAsyncRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get async SQL search results. - /// Get the current status and available results for an async SQL search or stored synchronous SQL search. - /// - /// - /// If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetAsyncRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(GetAsyncStatusRequest request) + public virtual Elastic.Clients.Elasticsearch.Sql.ClearCursorResponse ClearCursor(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(GetAsyncStatusRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.ClearCursorResponse ClearCursor(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(GetAsyncStatusRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(GetAsyncStatusRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(request); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(GetAsyncStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCursorAsync(Elastic.Clients.Elasticsearch.Sql.ClearCursorRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ClearCursorAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.ClearCursorRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest request) { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetAsyncStatusResponse, GetAsyncStatusRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(GetAsyncStatusRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.DeleteAsyncResponse DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get the async SQL search status. - /// Get the current status of an async SQL search or a stored synchronous SQL search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetAsyncStatusRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query(QueryRequest request) + public virtual System.Threading.Tasks.Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(QueryRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteAsyncAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Sql.DeleteAsyncRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query(QueryRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest request) { - descriptor.BeforeRequest(); - return DoRequest, QueryResponse, QueryRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query() + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new QueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, QueryResponse, QueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncResponse GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new QueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, QueryResponse, QueryRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query(QueryRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Sql.GetAsyncRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query() + public virtual System.Threading.Tasks.Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual QueryResponse Query(Action configureRequest) + public virtual System.Threading.Tasks.Task GetAsyncAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(QueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, QueryResponse, QueryRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id) { - var descriptor = new QueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryResponse, QueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusResponse GetAsyncStatus(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new QueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, QueryResponse, QueryRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(QueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get SQL search results. - /// Run an SQL request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task QueryAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsyncStatusAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new QueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.GetAsyncStatusRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate(TranslateRequest request) + public virtual Elastic.Clients.Elasticsearch.Sql.QueryResponse Query(Elastic.Clients.Elasticsearch.Sql.QueryRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(TranslateRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.QueryResponse Query() { + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate(TranslateRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Sql.QueryResponse Query(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, TranslateResponse, TranslateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate() + public virtual Elastic.Clients.Elasticsearch.Sql.QueryResponse Query(System.Action> action) { - var descriptor = new TranslateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, TranslateResponse, TranslateRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate(Action> configureRequest) + public virtual System.Threading.Tasks.Task QueryAsync(Elastic.Clients.Elasticsearch.Sql.QueryRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TranslateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TranslateResponse, TranslateRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate(TranslateRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task QueryAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate() + public virtual System.Threading.Tasks.Task QueryAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TranslateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TranslateResponse Translate(Action configureRequest) + public virtual System.Threading.Tasks.Task QueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TranslateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Sql.QueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(TranslateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.TranslateResponse Translate(Elastic.Clients.Elasticsearch.Sql.TranslateRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, TranslateResponse, TranslateRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.TranslateResponse Translate(System.Action action) { - var descriptor = new TranslateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, TranslateResponse, TranslateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Sql.TranslateResponse Translate(System.Action> action) { - var descriptor = new TranslateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TranslateResponse, TranslateRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(TranslateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TranslateAsync(Elastic.Clients.Elasticsearch.Sql.TranslateRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TranslateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TranslateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Translate SQL into Elasticsearch queries. - /// Translate an SQL search into a search API request containing Query DSL. - /// It accepts the same request body parameters as the SQL search API, excluding cursor. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TranslateAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TranslateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TranslateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Sql.TranslateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Synonyms.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Synonyms.g.cs index 09db9e200fc..0ced739fe15 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Synonyms.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Synonyms.g.cs @@ -18,1481 +18,345 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; -public partial class SynonymsNamespacedClient : NamespacedClientProxy +public partial class SynonymsNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected SynonymsNamespacedClient() : base() { } - internal SynonymsNamespacedClient(ElasticsearchClient client) : base(client) + internal SynonymsNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(DeleteSynonymRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(DeleteSynonymRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(DeleteSynonymRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(DeleteSynonymRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(DeleteSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteSynonymResponse, DeleteSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(DeleteSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym set. - /// - /// - /// You can only delete a synonyms set that is not in use by any index analyzer. - /// - /// - /// Synonyms sets can be used in synonym graph token filters and synonym token filters. - /// These synonym filters can be used as part of search analyzers. - /// - /// - /// Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). - /// Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase. - /// - /// - /// If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. - /// To prevent that, synonyms sets that are used in analyzers can't be deleted. - /// A delete request in this case will return a 400 response code. - /// - /// - /// To remove a synonyms set, you must first remove all indices that contain analyzers using it. - /// You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. - /// Once finished, you can delete the index. - /// When the synonyms set is not used in analyzers, you will be able to delete it. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymRuleResponse DeleteSynonymRule(DeleteSynonymRuleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymRuleAsync(DeleteSynonymRuleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymRuleResponse DeleteSynonymRule(DeleteSynonymRuleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymRuleResponse DeleteSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) - { - var descriptor = new DeleteSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteSynonymRuleResponse DeleteSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) - { - var descriptor = new DeleteSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymRuleAsync(DeleteSynonymRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a synonym rule. - /// Delete a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(GetSynonymRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(GetSynonymRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(GetSynonymRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetSynonymResponse, GetSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetSynonymResponse, GetSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest request) { - var descriptor = new GetSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSynonymResponse, GetSynonymRequestParameters>(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(GetSynonymRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new GetSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(GetSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetSynonymResponse, GetSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSynonymResponse, GetSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSynonymResponse, GetSynonymRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(GetSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymResponse DeleteSynonym(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new GetSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymRuleResponse GetSynonymRule(GetSynonymRuleRequest request) + public virtual System.Threading.Tasks.Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymRuleAsync(GetSynonymRuleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymRuleResponse GetSynonymRule(GetSynonymRuleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse DeleteSynonymRule(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymRuleResponse GetSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse DeleteSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) { - var descriptor = new GetSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymRuleResponse GetSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleResponse DeleteSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { - var descriptor = new GetSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymRuleAsync(GetSynonymRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteSynonymRuleAsync(Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get a synonym rule. - /// Get a synonym rule from a synonym set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.DeleteSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymsSetsResponse GetSynonymsSets(GetSynonymsSetsRequest request) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymsSetsAsync(GetSynonymsSetsRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymsSetsResponse GetSynonymsSets(GetSynonymsSetsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymResponse GetSynonym(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymsSetsResponse GetSynonymsSets() + public virtual System.Threading.Tasks.Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSynonymsSetsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSynonymsSetsResponse GetSynonymsSets(Action configureRequest) + public virtual System.Threading.Tasks.Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetSynonymsSetsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymsSetsAsync(GetSynonymsSetsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymsSetsAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse GetSynonymRule(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest request) { - var descriptor = new GetSynonymsSetsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all synonym sets. - /// Get a summary of all defined synonym sets. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetSynonymsSetsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse GetSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) { - var descriptor = new GetSynonymsSetsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(PutSynonymRequest request) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleResponse GetSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(PutSynonymRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSynonymRuleAsync(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(PutSynonymRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task GetSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PutSynonymResponse, PutSynonymRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id) + public virtual System.Threading.Tasks.Task GetSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutSynonymResponse, PutSynonymRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse GetSynonymsSets(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest request) { - var descriptor = new PutSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutSynonymResponse, PutSynonymRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(PutSynonymRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse GetSynonymsSets() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id) + public virtual Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsResponse GetSynonymsSets(System.Action action) { - var descriptor = new PutSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + public virtual System.Threading.Tasks.Task GetSynonymsSetsAsync(Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(PutSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSynonymsSetsAsync(System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, PutSynonymResponse, PutSynonymRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetSynonymsSetsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutSynonymResponse, PutSynonymRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.GetSynonymsSetsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest request) { - var descriptor = new PutSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutSynonymResponse, PutSynonymRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(PutSynonymRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymResponse PutSynonym(Elastic.Clients.Elasticsearch.Id id, System.Action action) { - var descriptor = new PutSynonymRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym set. - /// Synonyms sets are limited to a maximum of 10,000 synonym rules per set. - /// If you need to manage more synonym rules, you can create multiple synonym sets. - /// - /// - /// When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. - /// This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymRuleResponse PutSynonymRule(PutSynonymRuleRequest request) + public virtual System.Threading.Tasks.Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(id); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymRuleAsync(PutSynonymRuleRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSynonymAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymRuleResponse PutSynonymRule(PutSynonymRuleRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse PutSynonymRule(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymRuleResponse PutSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse PutSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId) { - var descriptor = new PutSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutSynonymRuleResponse PutSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleResponse PutSynonymRule(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action) { - var descriptor = new PutSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymRuleAsync(PutSynonymRuleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSynonymRuleAsync(Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRuleRequestDescriptor(setId, ruleId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(setId, ruleId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create or update a synonym rule. - /// Create or update a synonym rule in a synonym set. - /// - /// - /// If any of the synonym rules included is invalid, the API returns an error. - /// - /// - /// When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutSynonymRuleAsync(Elastic.Clients.Elasticsearch.Id setId, Elastic.Clients.Elasticsearch.Id ruleId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PutSynonymRuleRequestDescriptor(setId, ruleId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.PutSynonymRuleRequestDescriptor(setId, ruleId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs index 30dbb5969b0..c13c764e18f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs @@ -18,1126 +18,195 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public partial class TasksNamespacedClient : NamespacedClientProxy +public partial class TasksNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected TasksNamespacedClient() : base() { } - internal TasksNamespacedClient(ElasticsearchClient client) : base(client) + internal TasksNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel(CancelRequest request) + public virtual Elastic.Clients.Elasticsearch.Tasks.CancelResponse Cancel(Elastic.Clients.Elasticsearch.Tasks.CancelRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(CancelRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Tasks.CancelResponse Cancel() { + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel(CancelRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Tasks.CancelResponse Cancel(System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId) - { - var descriptor = new CancelRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId, Action configureRequest) - { - var descriptor = new CancelRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel() - { - var descriptor = new CancelRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CancelResponse Cancel(Action configureRequest) - { - var descriptor = new CancelRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(CancelRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, CancellationToken cancellationToken = default) - { - var descriptor = new CancelRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Tasks.CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId) { - var descriptor = new CancelRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Tasks.CancelResponse Cancel(Elastic.Clients.Elasticsearch.TaskId? taskId, System.Action action) { - var descriptor = new CancelRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Cancel a task. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. - /// It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. - /// The get task information API will continue to list these cancelled tasks until they complete. - /// The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible. - /// - /// - /// To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. - /// You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CancelAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CancelAsync(Elastic.Clients.Elasticsearch.Tasks.CancelRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new CancelRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTasksResponse Get(GetTasksRequest request) + public virtual System.Threading.Tasks.Task CancelAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetTasksRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task CancelAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTasksResponse Get(GetTasksRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId) + public virtual System.Threading.Tasks.Task CancelAsync(Elastic.Clients.Elasticsearch.TaskId? taskId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTasksRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Tasks.CancelRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse Get(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest request) { - var descriptor = new GetTasksRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(GetTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Id taskId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Tasks.GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id taskId, System.Action action) { - var descriptor = new GetTasksRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get task information. - /// Get information about a task currently running in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// If the task identifier is not found, a 404 response code indicates that there are no resources that match the request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Tasks.GetTasksRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTasksRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(ListRequest request) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(taskId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(ListRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Tasks.GetTasksRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(ListRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Tasks.ListResponse List(Elastic.Clients.Elasticsearch.Tasks.ListRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List() + public virtual Elastic.Clients.Elasticsearch.Tasks.ListResponse List() { - var descriptor = new ListRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ListResponse List(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Tasks.ListResponse List(System.Action action) { - var descriptor = new ListRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(ListRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListAsync(Elastic.Clients.Elasticsearch.Tasks.ListRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get all tasks. - /// Get information about the tasks currently running on one or more nodes in the cluster. - /// - /// - /// WARNING: The task management API is new and should still be considered a beta feature. - /// The API may change in ways that are not backwards compatible. - /// - /// - /// Identifying running tasks - /// - /// - /// The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. - /// This enables you to track certain calls or associate certain tasks with the client that started them. - /// For example: - /// - /// - /// curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents" - /// - /// - /// The API returns the following result: - /// - /// - /// HTTP/1.1 200 OK - /// X-Opaque-Id: 123456 - /// content-type: application/json; charset=UTF-8 - /// content-length: 831 - /// - /// { - /// "tasks" : { - /// "u5lcZHqcQhu-rUoFaqDphA:45" : { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 45, - /// "type" : "transport", - /// "action" : "cluster:monitor/tasks/lists", - /// "start_time_in_millis" : 1513823752749, - /// "running_time_in_nanos" : 293139, - /// "cancellable" : false, - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// }, - /// "children" : [ - /// { - /// "node" : "u5lcZHqcQhu-rUoFaqDphA", - /// "id" : 46, - /// "type" : "direct", - /// "action" : "cluster:monitor/tasks/lists[n]", - /// "start_time_in_millis" : 1513823752750, - /// "running_time_in_nanos" : 92133, - /// "cancellable" : false, - /// "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", - /// "headers" : { - /// "X-Opaque-Id" : "123456" - /// } - /// } - /// ] - /// } - /// } - /// } - /// - /// - /// In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. - /// The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. - /// The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ListAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ListAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new ListRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Tasks.ListRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.TextStructure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.TextStructure.g.cs index 3b1721dce1b..c26acd01d71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.TextStructure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.TextStructure.g.cs @@ -18,1542 +18,165 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -public partial class TextStructureNamespacedClient : NamespacedClientProxy +public partial class TextStructureNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected TextStructureNamespacedClient() : base() { } - internal TextStructureNamespacedClient(ElasticsearchClient client) : base(client) + internal TextStructureNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure(FindFieldStructureRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(FindFieldStructureRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure(FindFieldStructureRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure() - { - var descriptor = new FindFieldStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure(Action> configureRequest) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure(FindFieldStructureRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure() - { - var descriptor = new FindFieldStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindFieldStructureResponse FindFieldStructure(Action configureRequest) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(FindFieldStructureRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FindFieldStructureResponse, FindFieldStructureRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(FindFieldStructureRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of a text field. - /// Find the structure of a text field in an Elasticsearch index. - /// - /// - /// This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. - /// For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// - /// - /// - /// - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindFieldStructureAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FindFieldStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure(FindMessageStructureRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(FindMessageStructureRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure(FindMessageStructureRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor); - } - - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure() - { - var descriptor = new FindMessageStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor); - } - - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse FindFieldStructure(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest request) { - var descriptor = new FindMessageStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure(FindMessageStructureRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse FindFieldStructure() { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure() + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse FindFieldStructure(System.Action action) { - var descriptor = new FindMessageStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FindMessageStructureResponse FindMessageStructure(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureResponse FindFieldStructure(System.Action> action) { - var descriptor = new FindMessageStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(FindMessageStructureRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FindFieldStructureAsync(Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FindFieldStructureAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FindMessageStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FindFieldStructureAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new FindMessageStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FindMessageStructureResponse, FindMessageStructureRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(FindMessageStructureRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FindFieldStructureAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindFieldStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse FindMessageStructure(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest request) { - var descriptor = new FindMessageStructureRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Find the structure of text messages. - /// Find the structure of a list of text messages. - /// The messages must contain data that is suitable to be ingested into Elasticsearch. - /// - /// - /// This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. - /// Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. - /// - /// - /// The response from the API contains: - /// - /// - /// - /// - /// Sample messages. - /// - /// - /// - /// - /// Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. - /// - /// - /// - /// - /// Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. - /// Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. - /// - /// - /// - /// - /// All this information can be calculated by the structure finder with no guidance. - /// However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. - /// - /// - /// If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. - /// It helps determine why the returned structure was chosen. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FindMessageStructureAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse FindMessageStructure(System.Action action) { - var descriptor = new FindMessageStructureRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestGrokPatternResponse TestGrokPattern(TestGrokPatternRequest request) + public virtual Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureResponse FindMessageStructure(System.Action> action) { + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestGrokPatternAsync(TestGrokPatternRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task FindMessageStructureAsync(Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestGrokPatternResponse TestGrokPattern(TestGrokPatternRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task FindMessageStructureAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestGrokPatternResponse TestGrokPattern() + public virtual System.Threading.Tasks.Task FindMessageStructureAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TestGrokPatternRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.FindMessageStructureRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TestGrokPatternResponse TestGrokPattern(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponse TestGrokPattern(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest request) { - var descriptor = new TestGrokPatternRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestGrokPatternAsync(TestGrokPatternRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternResponse TestGrokPattern(System.Action action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestGrokPatternAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TestGrokPatternAsync(Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TestGrokPatternRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Test a Grok pattern. - /// Test a Grok pattern on one or more lines of text. - /// The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TestGrokPatternAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task TestGrokPatternAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new TestGrokPatternRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TextStructure.TestGrokPatternRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Transform.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Transform.g.cs index 383aa2450e9..265d90ffea4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Transform.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Transform.g.cs @@ -18,2378 +18,633 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -public partial class TransformManagementNamespacedClient : NamespacedClientProxy +public partial class TransformManagementNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected TransformManagementNamespacedClient() : base() { } - internal TransformManagementNamespacedClient(ElasticsearchClient client) : base(client) + internal TransformManagementNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTransformResponse DeleteTransform(DeleteTransformRequest request) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse DeleteTransform(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTransformAsync(DeleteTransformRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse DeleteTransform(Elastic.Clients.Elasticsearch.Id transformId) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(transformId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTransformResponse DeleteTransform(DeleteTransformRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformResponse DeleteTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTransformResponse DeleteTransform(Elastic.Clients.Elasticsearch.Id transformId) + public virtual System.Threading.Tasks.Task DeleteTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteTransformResponse DeleteTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) + public virtual System.Threading.Tasks.Task DeleteTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new DeleteTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTransformAsync(DeleteTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task DeleteTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DeleteTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse GetTransform(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest request) { - var descriptor = new DeleteTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Delete a transform. - /// Deletes a transform. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse GetTransform() { - var descriptor = new DeleteTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform(GetTransformRequest request) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse GetTransform(System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(GetTransformRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse GetTransform(Elastic.Clients.Elasticsearch.Names? transformId) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(transformId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform(GetTransformRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformResponse GetTransform(Elastic.Clients.Elasticsearch.Names? transformId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform(Elastic.Clients.Elasticsearch.Names? transformId) + public virtual System.Threading.Tasks.Task GetTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform(Elastic.Clients.Elasticsearch.Names? transformId, Action configureRequest) + public virtual System.Threading.Tasks.Task GetTransformAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform() + public virtual System.Threading.Tasks.Task GetTransformAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformResponse GetTransform(Action configureRequest) + public virtual System.Threading.Tasks.Task GetTransformAsync(Elastic.Clients.Elasticsearch.Names? transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(GetTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTransformAsync(Elastic.Clients.Elasticsearch.Names? transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(Elastic.Clients.Elasticsearch.Names? transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse GetTransformStats(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest request) { - var descriptor = new GetTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(Elastic.Clients.Elasticsearch.Names? transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse GetTransformStats(Elastic.Clients.Elasticsearch.Names transformId) { - var descriptor = new GetTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsResponse GetTransformStats(Elastic.Clients.Elasticsearch.Names transformId, System.Action action) { - var descriptor = new GetTransformRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get transforms. - /// Retrieves configuration information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTransformStatsAsync(Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformStatsResponse GetTransformStats(GetTransformStatsRequest request) + public virtual System.Threading.Tasks.Task GetTransformStatsAsync(Elastic.Clients.Elasticsearch.Names transformId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(transformId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformStatsAsync(GetTransformStatsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task GetTransformStatsAsync(Elastic.Clients.Elasticsearch.Names transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.GetTransformStatsRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformStatsResponse GetTransformStats(GetTransformStatsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse PreviewTransform(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformStatsResponse GetTransformStats(Elastic.Clients.Elasticsearch.Names transformId) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse PreviewTransform() { - var descriptor = new GetTransformStatsRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetTransformStatsResponse GetTransformStats(Elastic.Clients.Elasticsearch.Names transformId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse PreviewTransform(System.Action> action) { - var descriptor = new GetTransformStatsRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformStatsAsync(GetTransformStatsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse PreviewTransform(Elastic.Clients.Elasticsearch.Id? transformId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformStatsAsync(Elastic.Clients.Elasticsearch.Names transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformResponse PreviewTransform(Elastic.Clients.Elasticsearch.Id? transformId, System.Action> action) { - var descriptor = new GetTransformStatsRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request); } - /// - /// - /// Get transform stats. - /// Retrieves usage information for transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetTransformStatsAsync(Elastic.Clients.Elasticsearch.Names transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> PreviewTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new GetTransformStatsRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform(PreviewTransformRequest request) + public virtual System.Threading.Tasks.Task> PreviewTransformAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest, PreviewTransformRequestParameters>(request); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(PreviewTransformRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task> PreviewTransformAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync, PreviewTransformRequestParameters>(request, cancellationToken); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform(PreviewTransformRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task> PreviewTransformAsync(Elastic.Clients.Elasticsearch.Id? transformId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform(Elastic.Clients.Elasticsearch.Id? transformId) + public virtual System.Threading.Tasks.Task> PreviewTransformAsync(Elastic.Clients.Elasticsearch.Id? transformId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TransformManagement.PreviewTransformRequestParameters>(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform(Elastic.Clients.Elasticsearch.Id? transformId, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest request) { - var descriptor = new PreviewTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform() + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId) { - var descriptor = new PreviewTransformRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PreviewTransformResponse PreviewTransform(Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { - var descriptor = new PreviewTransformRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(PreviewTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(Elastic.Clients.Elasticsearch.Id? transformId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(Elastic.Clients.Elasticsearch.Id? transformId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewTransformRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Preview a transform. - /// Generates a preview of the results that you will get when you create a transform with the same configuration. - /// - /// - /// It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also - /// generates a list of mappings and settings for the destination index. These values are determined based on the field - /// types of the source index and the transform aggregations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> PreviewTransformAsync(Action> configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new PreviewTransformRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PreviewTransformResponse, PreviewTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PutTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(PutTransformRequest request) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse ResetTransform(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(PutTransformRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse ResetTransform(Elastic.Clients.Elasticsearch.Id transformId) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(transformId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequest(request); } - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(PutTransformRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformResponse ResetTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { - descriptor.BeforeRequest(); - return DoRequest, PutTransformResponse, PutTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest, PutTransformResponse, PutTransformRequestParameters>(descriptor); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId, Action> configureRequest) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutTransformResponse, PutTransformRequestParameters>(descriptor); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(PutTransformRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutTransformResponse PutTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(PutTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutTransformResponse, PutTransformRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTransformResponse, PutTransformRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutTransformResponse, PutTransformRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(PutTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a transform. - /// Creates a transform. - /// - /// - /// A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as - /// a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a - /// unique row per entity. - /// - /// - /// You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If - /// you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in - /// the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values - /// in the latest object. - /// - /// - /// You must have create_index, index, and read privileges on the destination index and read and - /// view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the - /// transform remembers which roles the user that created it had at the time of creation and uses those same roles. If - /// those roles do not have the required privileges on the source and destination indices, the transform fails when it - /// attempts unauthorized operations. - /// - /// - /// NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any - /// .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do - /// not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not - /// give users any privileges on .data-frame-internal* indices. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetTransformResponse ResetTransform(ResetTransformRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetTransformAsync(ResetTransformRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetTransformResponse ResetTransform(ResetTransformRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetTransformResponse ResetTransform(Elastic.Clients.Elasticsearch.Id transformId) - { - var descriptor = new ResetTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ResetTransformResponse ResetTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) - { - var descriptor = new ResetTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetTransformAsync(ResetTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) - { - var descriptor = new ResetTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reset a transform. - /// Resets a transform. - /// Before you can reset it, you must stop it; alternatively, use the force query parameter. - /// If the destination index was created by the transform, it is deleted. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ResetTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ResetTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScheduleNowTransformResponse ScheduleNowTransform(ScheduleNowTransformRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ScheduleNowTransformAsync(ScheduleNowTransformRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScheduleNowTransformResponse ScheduleNowTransform(ScheduleNowTransformRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScheduleNowTransformResponse ScheduleNowTransform(Elastic.Clients.Elasticsearch.Id transformId) - { - var descriptor = new ScheduleNowTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScheduleNowTransformResponse ScheduleNowTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) - { - var descriptor = new ScheduleNowTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ScheduleNowTransformAsync(ScheduleNowTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ScheduleNowTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) - { - var descriptor = new ScheduleNowTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Schedule a transform to start now. - /// Instantly runs a transform to process data. - /// - /// - /// If you _schedule_now a transform, it will process the new data instantly, - /// without waiting for the configured frequency interval. After _schedule_now API is called, - /// the transform will be processed again at now + frequency unless _schedule_now API - /// is called again in the meantime. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ScheduleNowTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ScheduleNowTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTransformResponse StartTransform(StartTransformRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTransformAsync(StartTransformRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTransformResponse StartTransform(StartTransformRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTransformResponse StartTransform(Elastic.Clients.Elasticsearch.Id transformId) + public virtual System.Threading.Tasks.Task ResetTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StartTransformResponse StartTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) + public virtual System.Threading.Tasks.Task ResetTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StartTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTransformAsync(StartTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ResetTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ResetTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse ScheduleNowTransform(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest request) { - var descriptor = new StartTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Start a transform. - /// Starts a transform. - /// - /// - /// When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is - /// set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping - /// definitions for the destination index from the source indices and the transform aggregations. If fields in the - /// destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), - /// the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce - /// mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you - /// start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings - /// in a pivot transform. - /// - /// - /// When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you - /// created the transform, they occur when you start the transform—​with the exception of privilege checks. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the - /// time of creation and uses those same roles. If those roles do not have the required privileges on the source and - /// destination indices, the transform fails when it attempts unauthorized operations. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StartTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse ScheduleNowTransform(Elastic.Clients.Elasticsearch.Id transformId) { - var descriptor = new StartTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTransformResponse StopTransform(StopTransformRequest request) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformResponse ScheduleNowTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTransformAsync(StopTransformRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task ScheduleNowTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTransformResponse StopTransform(StopTransformRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task ScheduleNowTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTransformResponse StopTransform(Elastic.Clients.Elasticsearch.Name transformId) + public virtual System.Threading.Tasks.Task ScheduleNowTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.ScheduleNowTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual StopTransformResponse StopTransform(Elastic.Clients.Elasticsearch.Name transformId, Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse StartTransform(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest request) { - var descriptor = new StopTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTransformAsync(StopTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse StartTransform(Elastic.Clients.Elasticsearch.Id transformId) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTransformAsync(Elastic.Clients.Elasticsearch.Name transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StartTransformResponse StartTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { - var descriptor = new StopTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Stop transforms. - /// Stops one or more transforms. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task StopTransformAsync(Elastic.Clients.Elasticsearch.Name transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new StopTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(UpdateTransformRequest request) + public virtual System.Threading.Tasks.Task StartTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(transformId); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(UpdateTransformRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task StartTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StartTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(UpdateTransformRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse StopTransform(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest request) { - descriptor.BeforeRequest(); - return DoRequest, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse StopTransform(Elastic.Clients.Elasticsearch.Name transformId) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId, Action> configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.StopTransformResponse StopTransform(Elastic.Clients.Elasticsearch.Name transformId, System.Action action) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(UpdateTransformRequestDescriptor descriptor) + public virtual System.Threading.Tasks.Task StopTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId) + public virtual System.Threading.Tasks.Task StopTransformAsync(Elastic.Clients.Elasticsearch.Name transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest) + public virtual System.Threading.Tasks.Task StopTransformAsync(Elastic.Clients.Elasticsearch.Name transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.StopTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(UpdateTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest request) { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action> configureRequest, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action action) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateTransformResponse, UpdateTransformRequestParameters>(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(UpdateTransformRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformResponse UpdateTransform(Elastic.Clients.Elasticsearch.Id transformId, System.Action> action) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Update a transform. - /// Updates certain properties of a transform. - /// - /// - /// All updated properties except description do not take effect until after the transform starts the next checkpoint, - /// thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata - /// privileges for the source indices. You must also have index and read privileges for the destination index. When - /// Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the - /// time of update and runs with those privileges. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpdateTransformRequestDescriptor(transformId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeTransformsResponse UpgradeTransforms(UpgradeTransformsRequest request) + public virtual System.Threading.Tasks.Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeTransformsAsync(UpgradeTransformsRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpdateTransformAsync(Elastic.Clients.Elasticsearch.Id transformId, System.Action> action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpdateTransformRequestDescriptor(transformId); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeTransformsResponse UpgradeTransforms(UpgradeTransformsRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse UpgradeTransforms(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeTransformsResponse UpgradeTransforms() + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse UpgradeTransforms() { - var descriptor = new UpgradeTransformsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpgradeTransformsResponse UpgradeTransforms(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsResponse UpgradeTransforms(System.Action action) { - var descriptor = new UpgradeTransformsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeTransformsAsync(UpgradeTransformsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeTransformsAsync(Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeTransformsAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeTransformsAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpgradeTransformsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Upgrade all transforms. - /// Transforms are compatible across minor versions and between supported major versions. - /// However, over time, the format of transform configuration information may change. - /// This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. - /// It also cleans up the internal data structures that store the transform state and checkpoints. - /// The upgrade does not affect the source and destination indices. - /// The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged. - /// - /// - /// If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. - /// Resolve the issue then re-run the process again. - /// A summary is returned when the upgrade is finished. - /// - /// - /// To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. - /// You may want to perform a recent cluster backup prior to the upgrade. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpgradeTransformsAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UpgradeTransformsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new UpgradeTransformsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.UpgradeTransformsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Xpack.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Xpack.g.cs index 6ba1065a617..39538620b1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Xpack.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Xpack.g.cs @@ -18,396 +18,115 @@ #nullable restore using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -public partial class XpackNamespacedClient : NamespacedClientProxy +public partial class XpackNamespacedClient : Elastic.Clients.Elasticsearch.NamespacedClientProxy { /// /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// /// protected XpackNamespacedClient() : base() { } - internal XpackNamespacedClient(ElasticsearchClient client) : base(client) + internal XpackNamespacedClient(Elastic.Clients.Elasticsearch.ElasticsearchClient client) : base(client) { } - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackInfoResponse Info(XpackInfoRequest request) + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse Info(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(XpackInfoRequest request, CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse Info() { + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackInfoResponse Info(XpackInfoRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackInfoResponse Info() - { - var descriptor = new XpackInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackInfoResponse Info(Action configureRequest) - { - var descriptor = new XpackInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(XpackInfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequest(request); } - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(CancellationToken cancellationToken = default) + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackInfoResponse Info(System.Action action) { - var descriptor = new XpackInfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get information. - /// The information provided by the API includes: - /// - /// - /// - /// - /// Build information including the build number and timestamp. - /// - /// - /// - /// - /// License information about the currently installed license. - /// - /// - /// - /// - /// Feature information for the features that are currently enabled and available under the current license. - /// - /// - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequest request, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new XpackInfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackUsageResponse Usage(XpackUsageRequest request) + public virtual System.Threading.Tasks.Task InfoAsync(System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(); + var request = builder.Instance; request.BeforeRequest(); - return DoRequest(request); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(XpackUsageRequest request, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task InfoAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackInfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackUsageResponse Usage(XpackUsageRequestDescriptor descriptor) + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse Usage(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest request) { - descriptor.BeforeRequest(); - return DoRequest(descriptor); + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackUsageResponse Usage() + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse Usage() { - var descriptor = new XpackUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual XpackUsageResponse Usage(Action configureRequest) + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackUsageResponse Usage(System.Action action) { - var descriptor = new XpackUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(XpackUsageRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UsageAsync(Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequest request, System.Threading.CancellationToken cancellationToken = default) { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UsageAsync(System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new XpackUsageRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } - /// - /// - /// Get usage information. - /// Get information about the features that are currently enabled and available under the current license. - /// The API also provides some usage statistics. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UsageAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual System.Threading.Tasks.Task UsageAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) { - var descriptor = new XpackUsageRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var builder = new Elastic.Clients.Elasticsearch.Xpack.XpackUsageRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs index 01649feef83..05241e662d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs @@ -17,42729 +17,4458 @@ #nullable restore -using Elastic.Clients.Elasticsearch.AsyncSearch; -using Elastic.Clients.Elasticsearch.Cluster; -using Elastic.Clients.Elasticsearch.CrossClusterReplication; -using Elastic.Clients.Elasticsearch.DanglingIndices; -using Elastic.Clients.Elasticsearch.Enrich; -using Elastic.Clients.Elasticsearch.Eql; -using Elastic.Clients.Elasticsearch.Esql; -using Elastic.Clients.Elasticsearch.Features; -using Elastic.Clients.Elasticsearch.Graph; -using Elastic.Clients.Elasticsearch.IndexLifecycleManagement; -using Elastic.Clients.Elasticsearch.IndexManagement; -using Elastic.Clients.Elasticsearch.Inference; -using Elastic.Clients.Elasticsearch.Ingest; -using Elastic.Clients.Elasticsearch.LicenseManagement; -using Elastic.Clients.Elasticsearch.MachineLearning; -using Elastic.Clients.Elasticsearch.Nodes; -using Elastic.Clients.Elasticsearch.QueryRules; -using Elastic.Clients.Elasticsearch.Rollup; -using Elastic.Clients.Elasticsearch.SearchableSnapshots; -using Elastic.Clients.Elasticsearch.SearchApplication; -using Elastic.Clients.Elasticsearch.Security; -using Elastic.Clients.Elasticsearch.Simulate; -using Elastic.Clients.Elasticsearch.Snapshot; -using Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -using Elastic.Clients.Elasticsearch.Sql; -using Elastic.Clients.Elasticsearch.Synonyms; -using Elastic.Clients.Elasticsearch.Tasks; -using Elastic.Clients.Elasticsearch.TextStructure; -using Elastic.Clients.Elasticsearch.TransformManagement; -using Elastic.Clients.Elasticsearch.Xpack; using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; public partial class ElasticsearchClient { - public virtual AsyncSearchNamespacedClient AsyncSearch { get; private set; } - public virtual ClusterNamespacedClient Cluster { get; private set; } - public virtual CrossClusterReplicationNamespacedClient CrossClusterReplication { get; private set; } - public virtual DanglingIndicesNamespacedClient DanglingIndices { get; private set; } - public virtual EnrichNamespacedClient Enrich { get; private set; } - public virtual EqlNamespacedClient Eql { get; private set; } - public virtual EsqlNamespacedClient Esql { get; private set; } - public virtual FeaturesNamespacedClient Features { get; private set; } - public virtual GraphNamespacedClient Graph { get; private set; } - public virtual IndexLifecycleManagementNamespacedClient IndexLifecycleManagement { get; private set; } - public virtual IndicesNamespacedClient Indices { get; private set; } - public virtual InferenceNamespacedClient Inference { get; private set; } - public virtual IngestNamespacedClient Ingest { get; private set; } - public virtual LicenseManagementNamespacedClient LicenseManagement { get; private set; } - public virtual MachineLearningNamespacedClient MachineLearning { get; private set; } - public virtual NodesNamespacedClient Nodes { get; private set; } - public virtual QueryRulesNamespacedClient QueryRules { get; private set; } - public virtual RollupNamespacedClient Rollup { get; private set; } - public virtual SearchableSnapshotsNamespacedClient SearchableSnapshots { get; private set; } - public virtual SearchApplicationNamespacedClient SearchApplication { get; private set; } - public virtual SecurityNamespacedClient Security { get; private set; } - public virtual SimulateNamespacedClient Simulate { get; private set; } - public virtual SnapshotNamespacedClient Snapshot { get; private set; } - public virtual SnapshotLifecycleManagementNamespacedClient SnapshotLifecycleManagement { get; private set; } - public virtual SqlNamespacedClient Sql { get; private set; } - public virtual SynonymsNamespacedClient Synonyms { get; private set; } - public virtual TasksNamespacedClient Tasks { get; private set; } - public virtual TextStructureNamespacedClient TextStructure { get; private set; } - public virtual TransformManagementNamespacedClient TransformManagement { get; private set; } - public virtual XpackNamespacedClient Xpack { get; private set; } + public virtual Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchNamespacedClient AsyncSearch { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterNamespacedClient Cluster { get; private set; } + public virtual Elastic.Clients.Elasticsearch.CrossClusterReplication.CrossClusterReplicationNamespacedClient CrossClusterReplication { get; private set; } + public virtual Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndicesNamespacedClient DanglingIndices { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Enrich.EnrichNamespacedClient Enrich { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Eql.EqlNamespacedClient Eql { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Esql.EsqlNamespacedClient Esql { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Features.FeaturesNamespacedClient Features { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Graph.GraphNamespacedClient Graph { get; private set; } + public virtual Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IndexLifecycleManagementNamespacedClient IndexLifecycleManagement { get; private set; } + public virtual Elastic.Clients.Elasticsearch.IndexManagement.IndicesNamespacedClient Indices { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Inference.InferenceNamespacedClient Inference { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Ingest.IngestNamespacedClient Ingest { get; private set; } + public virtual Elastic.Clients.Elasticsearch.LicenseManagement.LicenseManagementNamespacedClient LicenseManagement { get; private set; } + public virtual Elastic.Clients.Elasticsearch.MachineLearning.MachineLearningNamespacedClient MachineLearning { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Nodes.NodesNamespacedClient Nodes { get; private set; } + public virtual Elastic.Clients.Elasticsearch.QueryRules.QueryRulesNamespacedClient QueryRules { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Rollup.RollupNamespacedClient Rollup { get; private set; } + public virtual Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsNamespacedClient SearchableSnapshots { get; private set; } + public virtual Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationNamespacedClient SearchApplication { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Security.SecurityNamespacedClient Security { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Simulate.SimulateNamespacedClient Simulate { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Snapshot.SnapshotNamespacedClient Snapshot { get; private set; } + public virtual Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycleManagementNamespacedClient SnapshotLifecycleManagement { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Sql.SqlNamespacedClient Sql { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Synonyms.SynonymsNamespacedClient Synonyms { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Tasks.TasksNamespacedClient Tasks { get; private set; } + public virtual Elastic.Clients.Elasticsearch.TextStructure.TextStructureNamespacedClient TextStructure { get; private set; } + public virtual Elastic.Clients.Elasticsearch.TransformManagement.TransformManagementNamespacedClient TransformManagement { get; private set; } + public virtual Elastic.Clients.Elasticsearch.Xpack.XpackNamespacedClient Xpack { get; private set; } private partial void SetupNamespaces() { - AsyncSearch = new AsyncSearchNamespacedClient(this); - Cluster = new ClusterNamespacedClient(this); - CrossClusterReplication = new CrossClusterReplicationNamespacedClient(this); - DanglingIndices = new DanglingIndicesNamespacedClient(this); - Enrich = new EnrichNamespacedClient(this); - Eql = new EqlNamespacedClient(this); - Esql = new EsqlNamespacedClient(this); - Features = new FeaturesNamespacedClient(this); - Graph = new GraphNamespacedClient(this); - IndexLifecycleManagement = new IndexLifecycleManagementNamespacedClient(this); - Indices = new IndicesNamespacedClient(this); - Inference = new InferenceNamespacedClient(this); - Ingest = new IngestNamespacedClient(this); - LicenseManagement = new LicenseManagementNamespacedClient(this); - MachineLearning = new MachineLearningNamespacedClient(this); - Nodes = new NodesNamespacedClient(this); - QueryRules = new QueryRulesNamespacedClient(this); - Rollup = new RollupNamespacedClient(this); - SearchableSnapshots = new SearchableSnapshotsNamespacedClient(this); - SearchApplication = new SearchApplicationNamespacedClient(this); - Security = new SecurityNamespacedClient(this); - Simulate = new SimulateNamespacedClient(this); - Snapshot = new SnapshotNamespacedClient(this); - SnapshotLifecycleManagement = new SnapshotLifecycleManagementNamespacedClient(this); - Sql = new SqlNamespacedClient(this); - Synonyms = new SynonymsNamespacedClient(this); - Tasks = new TasksNamespacedClient(this); - TextStructure = new TextStructureNamespacedClient(this); - TransformManagement = new TransformManagementNamespacedClient(this); - Xpack = new XpackNamespacedClient(this); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(BulkRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(BulkRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(BulkRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, BulkResponse, BulkRequestParameters>(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new BulkRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, BulkResponse, BulkRequestParameters>(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest) - { - var descriptor = new BulkRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, BulkResponse, BulkRequestParameters>(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk() - { - var descriptor = new BulkRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, BulkResponse, BulkRequestParameters>(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Action> configureRequest) - { - var descriptor = new BulkRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, BulkResponse, BulkRequestParameters>(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(BulkRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new BulkRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest) - { - var descriptor = new BulkRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk() - { - var descriptor = new BulkRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual BulkResponse Bulk(Action configureRequest) - { - var descriptor = new BulkRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(BulkRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, BulkResponse, BulkRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkResponse, BulkRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkResponse, BulkRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkResponse, BulkRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, BulkResponse, BulkRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(BulkRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Bulk index or delete documents. - /// Perform multiple index, create, delete, and update actions in a single request. - /// This reduces overhead and can greatly increase indexing speed. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action. - /// - /// - /// - /// - /// To use the index action, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To use the delete action, you must have the delete or write index privilege. - /// - /// - /// - /// - /// To use the update action, you must have the index or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The actions are specified in the request body using a newline delimited JSON (NDJSON) structure: - /// - /// - /// action_and_meta_data\n - /// optional_source\n - /// action_and_meta_data\n - /// optional_source\n - /// .... - /// action_and_meta_data\n - /// optional_source\n - /// - /// - /// The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. - /// A create action fails if a document with the same ID already exists in the target - /// An index action adds or replaces a document as necessary. - /// - /// - /// NOTE: Data streams support only the create action. - /// To update or delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// An update action expects that the partial doc, upsert, and script and its options are specified on the next line. - /// - /// - /// A delete action does not expect a source on the next line and has the same semantics as the standard delete API. - /// - /// - /// NOTE: The final line of data must end with a newline character (\n). - /// Each newline character may be preceded by a carriage return (\r). - /// When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. - /// Because this format uses literal newline characters (\n) as delimiters, make sure that the JSON actions and sources are not pretty printed. - /// - /// - /// If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument. - /// - /// - /// A note on the format: the idea here is to make processing as fast as possible. - /// As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side. - /// - /// - /// Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible. - /// - /// - /// There is no "correct" number of actions to perform in a single bulk request. - /// Experiment with different settings to find the optimal size for your particular workload. - /// Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. - /// It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. - /// For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch. - /// - /// - /// Client suppport for bulk requests - /// - /// - /// Some of the officially supported clients provide helpers to assist with bulk requests and reindexing: - /// - /// - /// - /// - /// Go: Check out esutil.BulkIndexer - /// - /// - /// - /// - /// Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll - /// - /// - /// - /// - /// Python: Check out elasticsearch.helpers.* - /// - /// - /// - /// - /// JavaScript: Check out client.helpers.* - /// - /// - /// - /// - /// .NET: Check out BulkAllObservable - /// - /// - /// - /// - /// PHP: Check out bulk indexing. - /// - /// - /// - /// - /// Submitting bulk requests with cURL - /// - /// - /// If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. - /// The latter doesn't preserve newlines. For example: - /// - /// - /// $ cat requests - /// { "index" : { "_index" : "test", "_id" : "1" } } - /// { "field1" : "value1" } - /// $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo - /// {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]} - /// - /// - /// Optimistic concurrency control - /// - /// - /// Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. - /// The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details. - /// - /// - /// Versioning - /// - /// - /// Each bulk item can include the version value using the version field. - /// It automatically follows the behavior of the index or delete operation based on the _version mapping. - /// It also support the version_type. - /// - /// - /// Routing - /// - /// - /// Each bulk item can include the routing value using the routing field. - /// It automatically follows the behavior of the index or delete operation based on the _routing mapping. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// Wait for active shards - /// - /// - /// When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request. - /// - /// - /// Refresh - /// - /// - /// Control when the changes made by this request are visible to search. - /// - /// - /// NOTE: Only the shards that receive the bulk request will be affected by refresh. - /// Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. - /// The request will only wait for those three shards to refresh. - /// The other two shards that make up the index do not participate in the _bulk request at all. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task BulkAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new BulkRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearScrollResponse ClearScroll(ClearScrollRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearScrollAsync(ClearScrollRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearScrollResponse ClearScroll(ClearScrollRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearScrollResponse ClearScroll() - { - var descriptor = new ClearScrollRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClearScrollResponse ClearScroll(Action configureRequest) - { - var descriptor = new ClearScrollRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearScrollAsync(ClearScrollRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearScrollAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ClearScrollRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Clear a scrolling search. - /// Clear the search context and results for a scrolling search. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClearScrollAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ClearScrollRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClosePointInTimeResponse ClosePointInTime(ClosePointInTimeRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClosePointInTimeAsync(ClosePointInTimeRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClosePointInTimeResponse ClosePointInTime(ClosePointInTimeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClosePointInTimeResponse ClosePointInTime() - { - var descriptor = new ClosePointInTimeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ClosePointInTimeResponse ClosePointInTime(Action configureRequest) - { - var descriptor = new ClosePointInTimeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClosePointInTimeAsync(ClosePointInTimeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClosePointInTimeAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ClosePointInTimeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Close a point in time. - /// A point in time must be opened explicitly before being used in search requests. - /// The keep_alive parameter tells Elasticsearch how long it should persist. - /// A point in time is automatically closed when the keep_alive period has elapsed. - /// However, keeping points in time has a cost; close them as soon as they are no longer required for search requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ClosePointInTimeAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ClosePointInTimeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(CountRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(CountRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(CountRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, CountResponse, CountRequestParameters>(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new CountRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, CountResponse, CountRequestParameters>(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new CountRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CountResponse, CountRequestParameters>(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count() - { - var descriptor = new CountRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, CountResponse, CountRequestParameters>(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Action> configureRequest) - { - var descriptor = new CountRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CountResponse, CountRequestParameters>(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(CountRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new CountRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new CountRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count() - { - var descriptor = new CountRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CountResponse Count(Action configureRequest) - { - var descriptor = new CountRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(CountRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, CountResponse, CountRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, CountResponse, CountRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CountResponse, CountRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, CountResponse, CountRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CountResponse, CountRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(CountRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Count search results. - /// Get the number of documents matching a query. - /// - /// - /// The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. - /// The query is optional. When no query is provided, the API uses match_all to count all the documents. - /// - /// - /// The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices. - /// - /// - /// The operation is broadcast across all shards. - /// For each shard ID group, a replica is chosen and the search is run against it. - /// This means that replicas increase the scalability of the count. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CountAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CountRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(CreateRequest request) - { - request.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(request); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(CreateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new CreateRequestDescriptor(document, index, id); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new CreateRequestDescriptor(document, index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document) - { - var descriptor = new CreateRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Action> configureRequest) - { - var descriptor = new CreateRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new CreateRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new CreateRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new CreateRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new CreateRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, CreateResponse, CreateRequestParameters>(descriptor); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(CreateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create a new document in the index. - /// - /// - /// You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs - /// Using _create guarantees that the document is indexed only if it does not already exist. - /// It returns a 409 response when a document with a same ID already exists in the index. - /// To update an existing document, you must use the /<target>/_doc/ API. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// ** Distributed** - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new CreateRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, CreateResponse, CreateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(DeleteRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(DeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document) - { - var descriptor = new DeleteRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document, Action> configureRequest) - { - var descriptor = new DeleteRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new DeleteRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new DeleteRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteResponse, DeleteRequestParameters>(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(DeleteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new DeleteRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteResponse, DeleteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(DeleteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a document. - /// - /// - /// Remove a JSON document from the specified index. - /// - /// - /// NOTE: You cannot send deletion requests directly to a data stream. - /// To delete a document in a data stream, you must target the backing index containing the document. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Versioning - /// - /// - /// Each document indexed is versioned. - /// When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. - /// Every write operation run on a document, deletes included, causes its version to be incremented. - /// The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. - /// The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting. - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to delete a document. - /// - /// - /// If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request. - /// - /// - /// For example: - /// - /// - /// DELETE /my-index-000001/_doc/1?routing=shard-1 - /// - /// - /// This request deletes the document with ID 1, but it is routed based on the user. - /// The document is not deleted if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The delete operation gets hashed into a specific shard ID. - /// It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(DeleteByQueryRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(DeleteByQueryRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(DeleteByQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery() - { - var descriptor = new DeleteByQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(Action> configureRequest) - { - var descriptor = new DeleteByQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(DeleteByQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(DeleteByQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteByQueryResponse, DeleteByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(DeleteByQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete documents. - /// - /// - /// Deletes documents that match the specified query. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// delete or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. - /// If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. - /// A bulk delete request is performed for each batch of matching documents. - /// If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. - /// If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. - /// Any delete requests that completed successfully still stick, they are not rolled back. - /// - /// - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query. - /// - /// - /// Throttling delete requests - /// - /// - /// To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to disable throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Delete by query supports sliced scroll to parallelize the delete process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto lets Elasticsearch choose the number of slices to use. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// Adding slices to the delete by query operation creates sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Delete performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Cancel a delete by query operation - /// - /// - /// Any delete by query can be canceled using the task cancel API. For example: - /// - /// - /// POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel - /// - /// - /// The task ID can be found by using the get tasks API. - /// - /// - /// Cancellation should happen quickly but might take a few seconds. - /// The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryRethrottleAsync(DeleteByQueryRethrottleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(DeleteByQueryRethrottleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(Elastic.Clients.Elasticsearch.TaskId taskId) - { - var descriptor = new DeleteByQueryRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(Elastic.Clients.Elasticsearch.TaskId taskId, Action configureRequest) - { - var descriptor = new DeleteByQueryRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryRethrottleAsync(DeleteByQueryRethrottleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.TaskId taskId, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a delete by query operation. - /// - /// - /// Change the number of requests per second for a particular delete by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.TaskId taskId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteByQueryRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(DeleteScriptRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(DeleteScriptRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(DeleteScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(DeleteScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(DeleteScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, DeleteScriptResponse, DeleteScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(DeleteScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Delete a script or search template. - /// Deletes a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new DeleteScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document) - { - var descriptor = new ExistsRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new ExistsRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsResponse, ExistsRequestParameters>(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(ExistsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new ExistsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsResponse, ExistsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(ExistsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check a document. - /// - /// - /// Verify that a document exists. - /// For example, check to see if a document with the _id 0 exists: - /// - /// - /// HEAD my-index-000001/_doc/0 - /// - /// - /// If the document exists, the API returns a status code of 200 - OK. - /// If the document doesn’t exist, the API returns 404 - Not Found. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to check the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(ExistsSourceRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(ExistsSourceRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(ExistsSourceRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document) - { - var descriptor = new ExistsSourceRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document, Action> configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new ExistsSourceRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsSourceRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsSourceRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(ExistsSourceRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(ExistsSourceRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExistsSourceResponse, ExistsSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(ExistsSourceRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Check for a document source. - /// - /// - /// Check whether a document source exists in an index. - /// For example: - /// - /// - /// HEAD my-index-000001/_source/1 - /// - /// - /// A document's source is not available if it is disabled in the mapping. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExistsSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(ExplainRequest request) - { - request.BeforeRequest(); - return DoRequest, ExplainRequestParameters>(request); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(ExplainRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, ExplainRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(ExplainRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExplainRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExplainRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document) - { - var descriptor = new ExplainRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document, Action> configureRequest) - { - var descriptor = new ExplainRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new ExplainRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new ExplainRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExplainRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExplainRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new ExplainRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new ExplainRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ExplainResponse, ExplainRequestParameters>(descriptor); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(ExplainRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Explain a document match result. - /// Get information about why a specific document matches, or doesn't match, a query. - /// It computes a score explanation for a query and a specific document. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ExplainRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ExplainResponse, ExplainRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(FieldCapsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(FieldCapsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(FieldCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, FieldCapsResponse, FieldCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, FieldCapsResponse, FieldCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FieldCapsResponse, FieldCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps() - { - var descriptor = new FieldCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, FieldCapsResponse, FieldCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Action> configureRequest) - { - var descriptor = new FieldCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, FieldCapsResponse, FieldCapsRequestParameters>(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(FieldCapsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps() - { - var descriptor = new FieldCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual FieldCapsResponse FieldCaps(Action configureRequest) - { - var descriptor = new FieldCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(FieldCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, FieldCapsResponse, FieldCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldCapsResponse, FieldCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldCapsResponse, FieldCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldCapsResponse, FieldCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, FieldCapsResponse, FieldCapsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(FieldCapsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the field capabilities. - /// - /// - /// Get information about the capabilities of fields among multiple indices. - /// - /// - /// For data streams, the API returns field capabilities among the stream’s backing indices. - /// It returns runtime fields like any other field. - /// For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task FieldCapsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new FieldCapsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(GetRequest request) - { - request.BeforeRequest(); - return DoRequest, GetRequestParameters>(request); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(GetRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, GetRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(GetRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document) - { - var descriptor = new GetRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document, Action> configureRequest) - { - var descriptor = new GetRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new GetRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new GetRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetResponse Get(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetResponse, GetRequestParameters>(descriptor); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(GetRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document by its ID. - /// - /// - /// Get a document and its source or stored fields from an index. - /// - /// - /// By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). - /// In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. - /// To turn off realtime behavior, set the realtime parameter to false. - /// - /// - /// Source filtering - /// - /// - /// By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. - /// You can turn off _source retrieval by using the _source parameter: - /// - /// - /// GET my-index-000001/_doc/0?_source=false - /// - /// - /// If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. - /// This can be helpful with large documents where partial retrieval can save on network overhead - /// Both parameters take a comma separated list of fields or wildcard expressions. - /// For example: - /// - /// - /// GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities - /// - /// - /// If you only want to specify includes, you can use a shorter notation: - /// - /// - /// GET my-index-000001/_doc/0?_source=*.id - /// - /// - /// Routing - /// - /// - /// If routing is used during indexing, the routing value also needs to be specified to retrieve a document. - /// For example: - /// - /// - /// GET my-index-000001/_doc/2?routing=user1 - /// - /// - /// This request gets the document with ID 2, but it is routed based on the user. - /// The document is not fetched if the correct routing is not specified. - /// - /// - /// Distributed - /// - /// - /// The GET operation is hashed into a specific shard ID. - /// It is then redirected to one of the replicas within that shard ID and returns the result. - /// The replicas are the primary shard and its replicas within that shard ID group. - /// This means that the more replicas you have, the better your GET scaling will be. - /// - /// - /// Versioning support - /// - /// - /// You can use the version parameter to retrieve the document only if its current version is equal to the specified one. - /// - /// - /// Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. - /// The old version of the document doesn't disappear immediately, although you won't be able to access it. - /// Elasticsearch cleans up deleted documents in the background as you continue to index more data. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetResponse, GetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(GetScriptRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(GetScriptRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(GetScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetScriptResponse, GetScriptRequestParameters>(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetScriptResponse, GetScriptRequestParameters>(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetScriptResponse, GetScriptRequestParameters>(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(GetScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new GetScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(GetScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetScriptResponse, GetScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetScriptResponse, GetScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetScriptResponse, GetScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(GetScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a script or search template. - /// Retrieves a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptContextResponse GetScriptContext(GetScriptContextRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptContextAsync(GetScriptContextRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptContextResponse GetScriptContext(GetScriptContextRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptContextResponse GetScriptContext() - { - var descriptor = new GetScriptContextRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptContextResponse GetScriptContext(Action configureRequest) - { - var descriptor = new GetScriptContextRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptContextAsync(GetScriptContextRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptContextAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptContextRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script contexts. - /// - /// - /// Get a list of supported script contexts and their methods. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptContextAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptContextRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptLanguagesResponse GetScriptLanguages(GetScriptLanguagesRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptLanguagesAsync(GetScriptLanguagesRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptLanguagesResponse GetScriptLanguages(GetScriptLanguagesRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptLanguagesResponse GetScriptLanguages() - { - var descriptor = new GetScriptLanguagesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetScriptLanguagesResponse GetScriptLanguages(Action configureRequest) - { - var descriptor = new GetScriptLanguagesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptLanguagesAsync(GetScriptLanguagesRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptLanguagesAsync(CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptLanguagesRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get script languages. - /// - /// - /// Get a list of available script types, languages, and contexts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task GetScriptLanguagesAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetScriptLanguagesRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(GetSourceRequest request) - { - request.BeforeRequest(); - return DoRequest, GetSourceRequestParameters>(request); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(GetSourceRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, GetSourceRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(GetSourceRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document) - { - var descriptor = new GetSourceRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document, Action> configureRequest) - { - var descriptor = new GetSourceRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new GetSourceRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new GetSourceRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetSourceRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetSourceRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new GetSourceRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new GetSourceRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, GetSourceResponse, GetSourceRequestParameters>(descriptor); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(GetSourceRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get a document's source. - /// - /// - /// Get the source of a document. - /// For example: - /// - /// - /// GET my-index-000001/_source/1 - /// - /// - /// You can use the source filtering parameters to control which parts of the _source are returned: - /// - /// - /// GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetSourceRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, GetSourceResponse, GetSourceRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport(HealthReportRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(HealthReportRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport(HealthReportRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport(IReadOnlyCollection? feature) - { - var descriptor = new HealthReportRequestDescriptor(feature); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport(IReadOnlyCollection? feature, Action configureRequest) - { - var descriptor = new HealthReportRequestDescriptor(feature); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport() - { - var descriptor = new HealthReportRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual HealthReportResponse HealthReport(Action configureRequest) - { - var descriptor = new HealthReportRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(HealthReportRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(IReadOnlyCollection? feature, CancellationToken cancellationToken = default) - { - var descriptor = new HealthReportRequestDescriptor(feature); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(IReadOnlyCollection? feature, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new HealthReportRequestDescriptor(feature); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(CancellationToken cancellationToken = default) - { - var descriptor = new HealthReportRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the cluster health. - /// Get a report with the health status of an Elasticsearch cluster. - /// The report contains a list of indicators that compose Elasticsearch functionality. - /// - /// - /// Each indicator has a health status of: green, unknown, yellow or red. - /// The indicator will provide an explanation and metadata describing the reason for its current health status. - /// - /// - /// The cluster’s status is controlled by the worst indicator status. - /// - /// - /// In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. - /// Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system. - /// - /// - /// Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. - /// The root cause and remediation steps are encapsulated in a diagnosis. - /// A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem. - /// - /// - /// NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. - /// When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task HealthReportAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new HealthReportRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(IndexRequest request) - { - request.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(request); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(IndexRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(IndexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new IndexRequestDescriptor(document, index, id); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new IndexRequestDescriptor(document, index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document) - { - var descriptor = new IndexRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Action> configureRequest) - { - var descriptor = new IndexRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new IndexRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new IndexRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new IndexRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new IndexRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, IndexResponse, IndexRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(IndexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a document in an index. - /// - /// - /// Add a JSON document to the specified data stream or index and make it searchable. - /// If the target is an index and the document already exists, the request updates the document and increments its version. - /// - /// - /// NOTE: You cannot use this API to send update requests for existing documents in a data stream. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias: - /// - /// - /// - /// - /// To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege. - /// - /// - /// - /// - /// To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege. - /// - /// - /// - /// - /// To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege. - /// - /// - /// - /// - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// NOTE: Replica shards might not all be started when an indexing operation returns successfully. - /// By default, only the primary is required. Set wait_for_active_shards to change this default behavior. - /// - /// - /// Automatically create data streams and indices - /// - /// - /// If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream. - /// - /// - /// If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates. - /// - /// - /// NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation. - /// - /// - /// If no mapping exists, the index operation creates a dynamic mapping. - /// By default, new fields and objects are automatically added to the mapping if needed. - /// - /// - /// Automatic index creation is controlled by the action.auto_create_index setting. - /// If it is true, any index can be created automatically. - /// You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. - /// Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. - /// When a list is specified, the default behaviour is to disallow. - /// - /// - /// NOTE: The action.auto_create_index setting affects the automatic creation of indices only. - /// It does not affect the creation of data streams. - /// - /// - /// Optimistic concurrency control - /// - /// - /// Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. - /// If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409. - /// - /// - /// Routing - /// - /// - /// By default, shard placement — or routing — is controlled by using a hash of the document's ID value. - /// For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter. - /// - /// - /// When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. - /// This does come at the (very minimal) cost of an additional document parsing pass. - /// If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted. - /// - /// - /// NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template. - /// - /// - /// - /// - /// ** Distributed** - /// - /// - /// - /// - /// The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. - /// After the primary shard completes the operation, if needed, the update is distributed to applicable replicas. - /// - /// - /// Active shards - /// - /// - /// To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. - /// If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. - /// By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). - /// This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. - /// To alter this behavior per operation, use the wait_for_active_shards request parameter. - /// - /// - /// Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). - /// Specifying a negative value or a number greater than the number of shard copies will throw an error. - /// - /// - /// For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). - /// If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. - /// This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. - /// If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. - /// This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. - /// However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. - /// The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard. - /// - /// - /// It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. - /// After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. - /// The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed. - /// - /// - /// No operation (noop) updates - /// - /// - /// When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. - /// If this isn't acceptable use the _update API with detect_noop set to true. - /// The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source. - /// - /// - /// There isn't a definitive rule for when noop updates aren't acceptable. - /// It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates. - /// - /// - /// Versioning - /// - /// - /// Each indexed document is given a version number. - /// By default, internal versioning is used that starts at 1 and increments with each update, deletes included. - /// Optionally, the version number can be set to an external value (for example, if maintained in a database). - /// To enable this functionality, version_type should be set to external. - /// The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18. - /// - /// - /// NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. - /// If no version is provided, the operation runs without any version checks. - /// - /// - /// When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. - /// If true, the document will be indexed and the new version number used. - /// If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example: - /// - /// - /// PUT my-index-000001/_doc/1?version=2&version_type=external - /// { - /// "user": { - /// "id": "elkbee" - /// } - /// } - /// - /// In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1. - /// If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code). - /// - /// A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used. - /// Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new IndexRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, IndexResponse, IndexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InfoResponse Info(InfoRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(InfoRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InfoResponse Info(InfoRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InfoResponse Info() - { - var descriptor = new InfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual InfoResponse Info(Action configureRequest) - { - var descriptor = new InfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(InfoRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(CancellationToken cancellationToken = default) - { - var descriptor = new InfoRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get cluster info. - /// Get basic build, version, and cluster information. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task InfoAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new InfoRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(MultiTermVectorsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(MultiTermVectorsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(MultiTermVectorsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors() - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Action> configureRequest) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(MultiTermVectorsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors() - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiTermVectorsResponse Mtermvectors(Action configureRequest) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(MultiTermVectorsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiTermVectorsResponse, MultiTermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(MultiTermVectorsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple term vectors. - /// - /// - /// Get multiple term vectors with a single request. - /// You can specify existing documents by index and ID or provide artificial documents in the body of the request. - /// You can specify the index in the request body or request URI. - /// The response contains a docs array with all the fetched termvectors. - /// Each element has the structure provided by the termvectors API. - /// - /// - /// Artificial documents - /// - /// - /// You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. - /// The mapping used is determined by the specified _index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task MtermvectorsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiTermVectorsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet(MultiGetRequest request) - { - request.BeforeRequest(); - return DoRequest, MultiGetRequestParameters>(request); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(MultiGetRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, MultiGetRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet(MultiGetRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, MultiGetResponse, MultiGetRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index) - { - var descriptor = new MultiGetRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, MultiGetResponse, MultiGetRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest) - { - var descriptor = new MultiGetRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiGetResponse, MultiGetRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet() - { - var descriptor = new MultiGetRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, MultiGetResponse, MultiGetRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiGetResponse MultiGet(Action> configureRequest) - { - var descriptor = new MultiGetRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiGetResponse, MultiGetRequestParameters>(descriptor); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(MultiGetRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, MultiGetResponse, MultiGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, CancellationToken cancellationToken = default) - { - var descriptor = new MultiGetRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiGetResponse, MultiGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiGetRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiGetResponse, MultiGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MultiGetRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiGetResponse, MultiGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get multiple documents. - /// - /// - /// Get multiple JSON documents by ID from one or more indices. - /// If you specify an index in the request URI, you only need to specify the document IDs in the request body. - /// To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail. - /// - /// - /// Filter source fields - /// - /// - /// By default, the _source field is returned for every document (if stored). - /// Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. - /// You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// - /// Get stored fields - /// - /// - /// Use the stored_fields attribute to specify the set of stored fields you want to retrieve. - /// Any requested fields that are not stored are ignored. - /// You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiGetAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiGetRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiGetResponse, MultiGetRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch(MultiSearchRequest request) - { - request.BeforeRequest(); - return DoRequest, MultiSearchRequestParameters>(request); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(MultiSearchRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, MultiSearchRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch(MultiSearchRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, MultiSearchResponse, MultiSearchRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new MultiSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchResponse, MultiSearchRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new MultiSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchResponse, MultiSearchRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch() - { - var descriptor = new MultiSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchResponse, MultiSearchRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchResponse MultiSearch(Action> configureRequest) - { - var descriptor = new MultiSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchResponse, MultiSearchRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(MultiSearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchResponse, MultiSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchResponse, MultiSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchResponse, MultiSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchResponse, MultiSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple searches. - /// - /// - /// The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. - /// The structure is as follows: - /// - /// - /// header\n - /// body\n - /// header\n - /// body\n - /// - /// - /// This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node. - /// - /// - /// IMPORTANT: The final line of data must end with a newline character \n. - /// Each newline character may be preceded by a carriage return \r. - /// When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchResponse, MultiSearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate(MultiSearchTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest, MultiSearchTemplateRequestParameters>(request); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(MultiSearchTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate(MultiSearchTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate() - { - var descriptor = new MultiSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual MultiSearchTemplateResponse MultiSearchTemplate(Action> configureRequest) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(MultiSearchTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run multiple templated searches. - /// - /// - /// Run multiple templated searches with a single request. - /// If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. - /// For example: - /// - /// - /// $ cat requests - /// { "index": "my-index" } - /// { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} - /// { "index": "my-other-index" } - /// { "id": "my-other-search-template", "params": { "query_type": "match_all" }} - /// - /// $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> MultiSearchTemplateAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new MultiSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, MultiSearchTemplateResponse, MultiSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(OpenPointInTimeRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(OpenPointInTimeRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(OpenPointInTimeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime() - { - var descriptor = new OpenPointInTimeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(Action> configureRequest) - { - var descriptor = new OpenPointInTimeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(OpenPointInTimeRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(OpenPointInTimeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, OpenPointInTimeResponse, OpenPointInTimeRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(OpenPointInTimeRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Open a point in time. - /// - /// - /// A search request by default runs against the most recent visible data of the target indices, - /// which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the - /// state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple - /// search requests using the same point in time. For example, if refreshes happen between - /// search_after requests, then the results of those requests might not be consistent as changes happening - /// between searches are only visible to the more recent point in time. - /// - /// - /// A point in time must be opened explicitly before being used in search requests. - /// - /// - /// A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time. - /// - /// - /// Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. - /// If you want to retrieve more hits, use PIT with search_after. - /// - /// - /// IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request. - /// - /// - /// When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. - /// To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime. - /// - /// - /// Keeping point in time alive - /// - /// - /// The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. - /// The value does not need to be long enough to process all data — it just needs to be long enough for the next request. - /// - /// - /// Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. - /// Once the smaller segments are no longer needed they are deleted. - /// However, open point-in-times prevent the old segments from being deleted since they are still in use. - /// - /// - /// TIP: Keeping older segments alive means that more disk space and file handles are needed. - /// Ensure that you have configured your nodes to have ample free file handles. - /// - /// - /// Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. - /// Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. - /// Note that a point-in-time doesn't prevent its associated indices from being deleted. - /// You can check how many point-in-times (that is, search contexts) are open with the nodes stats API. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new OpenPointInTimeRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PingResponse Ping(PingRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PingAsync(PingRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PingResponse Ping(PingRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PingResponse Ping() - { - var descriptor = new PingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PingResponse Ping(Action configureRequest) - { - var descriptor = new PingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PingAsync(PingRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PingAsync(CancellationToken cancellationToken = default) - { - var descriptor = new PingRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Ping the cluster. - /// Get information about whether the cluster is running. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PingAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PingRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(PutScriptRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(PutScriptRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(PutScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, PutScriptResponse, PutScriptRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - descriptor.BeforeRequest(); - return DoRequest, PutScriptResponse, PutScriptRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, Action> configureRequest) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutScriptResponse, PutScriptRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, PutScriptResponse, PutScriptRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new PutScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, PutScriptResponse, PutScriptRequestParameters>(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(PutScriptRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, Action configureRequest) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new PutScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) - { - var descriptor = new PutScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(PutScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, PutScriptResponse, PutScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - descriptor.BeforeRequest(); - return DoRequestAsync, PutScriptResponse, PutScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutScriptResponse, PutScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, PutScriptResponse, PutScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, PutScriptResponse, PutScriptRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(PutScriptRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id, context); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Create or update a script or search template. - /// Creates or updates a stored script or search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new PutScriptRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(RankEvalRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(RankEvalRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(RankEvalRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, RankEvalResponse, RankEvalRequestParameters>(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new RankEvalRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, RankEvalResponse, RankEvalRequestParameters>(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new RankEvalRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RankEvalResponse, RankEvalRequestParameters>(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval() - { - var descriptor = new RankEvalRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RankEvalResponse, RankEvalRequestParameters>(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Action> configureRequest) - { - var descriptor = new RankEvalRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RankEvalResponse, RankEvalRequestParameters>(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(RankEvalRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new RankEvalRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new RankEvalRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval() - { - var descriptor = new RankEvalRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RankEvalResponse RankEval(Action configureRequest) - { - var descriptor = new RankEvalRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(RankEvalRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, RankEvalResponse, RankEvalRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, RankEvalResponse, RankEvalRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RankEvalResponse, RankEvalRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RankEvalResponse, RankEvalRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RankEvalResponse, RankEvalRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(RankEvalRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Evaluate ranked search results. - /// - /// - /// Evaluate the quality of ranked search results over a set of typical search queries. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RankEvalAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RankEvalRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex(ReindexRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(ReindexRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex(ReindexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ReindexResponse, ReindexRequestParameters>(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex() - { - var descriptor = new ReindexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ReindexResponse, ReindexRequestParameters>(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex(Action> configureRequest) - { - var descriptor = new ReindexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ReindexResponse, ReindexRequestParameters>(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex(ReindexRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex() - { - var descriptor = new ReindexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexResponse Reindex(Action configureRequest) - { - var descriptor = new ReindexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(ReindexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ReindexResponse, ReindexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ReindexResponse, ReindexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ReindexResponse, ReindexRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(ReindexRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Reindex documents. - /// - /// - /// Copy documents from a source to a destination. - /// You can copy all documents to the destination index or reindex a subset of the documents. - /// The source can be any existing index, alias, or data stream. - /// The destination must differ from the source. - /// For example, you cannot reindex a data stream into itself. - /// - /// - /// IMPORTANT: Reindex requires _source to be enabled for all documents in the source. - /// The destination should be configured as wanted before calling the reindex API. - /// Reindex does not copy the settings from the source or its associated template. - /// Mappings, shard counts, and replicas, for example, must be configured ahead of time. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following security privileges: - /// - /// - /// - /// - /// The read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// The write index privilege for the destination data stream, index, or index alias. - /// - /// - /// - /// - /// To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias. - /// - /// - /// - /// - /// If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. - /// Automatic data stream creation requires a matching index template with data stream enabled. - /// - /// - /// The dest element can be configured like the index API to control optimistic concurrency control. - /// Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID. - /// - /// - /// Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source. - /// - /// - /// Setting op_type to create causes the reindex API to create only missing documents in the destination. - /// All existing documents will cause a version conflict. - /// - /// - /// IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. - /// A reindex can only add new documents to a destination data stream. - /// It cannot update existing documents in a destination data stream. - /// - /// - /// By default, version conflicts abort the reindex process. - /// To continue reindexing if there are conflicts, set the conflicts request body property to proceed. - /// In this case, the response includes a count of the version conflicts that were encountered. - /// Note that the handling of other error types is unaffected by the conflicts property. - /// Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query. - /// - /// - /// NOTE: The reindex API makes no effort to handle ID collisions. - /// The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. - /// Instead, make sure that IDs are unique by using a script. - /// - /// - /// Running reindex asynchronously - /// - /// - /// If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. - /// Elasticsearch creates a record of this task as a document at _tasks/<task_id>. - /// - /// - /// Reindex from multiple sources - /// - /// - /// If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. - /// That way you can resume the process if there are any errors by removing the partially completed source and starting over. - /// It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel. - /// - /// - /// For example, you can use a bash script like this: - /// - /// - /// for index in i1 i2 i3 i4 i5; do - /// curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{ - /// "source": { - /// "index": "'$index'" - /// }, - /// "dest": { - /// "index": "'$index'-reindexed" - /// } - /// }' - /// done - /// - /// - /// ** Throttling** - /// - /// - /// Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. - /// Requests are throttled by padding each batch with a wait time. - /// To turn off throttling, set requests_per_second to -1. - /// - /// - /// The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Reindex supports sliced scroll to parallelize the reindexing process. - /// This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// You can slice a reindex request manually by providing a slice ID and total number of slices to each request. - /// You can also let reindex automatically parallelize by using sliced scroll to slice on _id. - /// The slices parameter specifies the number of slices to use. - /// - /// - /// Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If slicing automatically, setting slices to auto will choose a reasonable number for most indices. - /// If slicing manually or otherwise tuning automatic slicing, use the following guidelines. - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index. - /// If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. - /// Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// Indexing performance scales linearly across available resources with the number of slices. - /// - /// - /// Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Modify documents during reindexing - /// - /// - /// Like _update_by_query, reindex operations support a script that modifies the document. - /// Unlike _update_by_query, the script is allowed to modify the document's metadata. - /// - /// - /// Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. - /// For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. - /// Set ctx.op to delete if your script decides that the document must be deleted from the destination. - /// The deletion will be reported in the deleted counter in the response body. - /// Setting ctx.op to anything else will return an error, as will setting any other field in ctx. - /// - /// - /// Think of the possibilities! Just be careful; you are able to change: - /// - /// - /// - /// - /// _id - /// - /// - /// - /// - /// _index - /// - /// - /// - /// - /// _version - /// - /// - /// - /// - /// _routing - /// - /// - /// - /// - /// Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. - /// It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API. - /// - /// - /// Reindex from remote - /// - /// - /// Reindex supports reindexing from a remote Elasticsearch cluster. - /// The host parameter must contain a scheme, host, port, and optional path. - /// The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. - /// Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. - /// There are a range of settings available to configure the behavior of the HTTPS connection. - /// - /// - /// When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. - /// Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. - /// It can be set to a comma delimited list of allowed remote host and port combinations. - /// Scheme is ignored; only the host and port are used. - /// For example: - /// - /// - /// reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"] - /// - /// - /// The list of allowed hosts must be configured on any nodes that will coordinate the reindex. - /// This feature should work with remote clusters of any version of Elasticsearch. - /// This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version. - /// - /// - /// WARNING: Elasticsearch does not support forward compatibility across major versions. - /// For example, you cannot reindex from a 7.x cluster into a 6.x cluster. - /// - /// - /// To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification. - /// - /// - /// NOTE: Reindexing from remote clusters does not support manual or automatic slicing. - /// - /// - /// Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. - /// If the remote index includes very large documents you'll need to use a smaller batch size. - /// It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. - /// Both default to 30 seconds. - /// - /// - /// Configuring SSL parameters - /// - /// - /// Reindex from remote supports configurable SSL settings. - /// These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. - /// It is not possible to configure SSL in the body of the reindex request. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexRethrottleResponse ReindexRethrottle(ReindexRethrottleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexRethrottleAsync(ReindexRethrottleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexRethrottleResponse ReindexRethrottle(ReindexRethrottleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexRethrottleResponse ReindexRethrottle(Elastic.Clients.Elasticsearch.Id taskId) - { - var descriptor = new ReindexRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ReindexRethrottleResponse ReindexRethrottle(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest) - { - var descriptor = new ReindexRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexRethrottleAsync(ReindexRethrottleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle a reindex operation. - /// - /// - /// Change the number of requests per second for a particular reindex operation. - /// For example: - /// - /// - /// POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 - /// - /// - /// Rethrottling that speeds up the query takes effect immediately. - /// Rethrottling that slows down the query will take effect after completing the current batch. - /// This behavior prevents scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task ReindexRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ReindexRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate(RenderSearchTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(RenderSearchTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate(RenderSearchTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate() - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate(Action> configureRequest) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate(RenderSearchTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate() - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual RenderSearchTemplateResponse RenderSearchTemplate(Action configureRequest) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(RenderSearchTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, RenderSearchTemplateResponse, RenderSearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(RenderSearchTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Render a search template. - /// - /// - /// Render a search template as a search request body. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task RenderSearchTemplateAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new RenderSearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScriptsPainlessExecuteResponse ScriptsPainlessExecute(ScriptsPainlessExecuteRequest request) - { - request.BeforeRequest(); - return DoRequest, ScriptsPainlessExecuteRequestParameters>(request); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ScriptsPainlessExecuteAsync(ScriptsPainlessExecuteRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, ScriptsPainlessExecuteRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScriptsPainlessExecuteResponse ScriptsPainlessExecute(ScriptsPainlessExecuteRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScriptsPainlessExecuteResponse ScriptsPainlessExecute() - { - var descriptor = new ScriptsPainlessExecuteRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScriptsPainlessExecuteResponse ScriptsPainlessExecute(Action> configureRequest) - { - var descriptor = new ScriptsPainlessExecuteRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ScriptsPainlessExecuteAsync(ScriptsPainlessExecuteRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ScriptsPainlessExecuteAsync(CancellationToken cancellationToken = default) - { - var descriptor = new ScriptsPainlessExecuteRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a script. - /// Runs a script and returns a result. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ScriptsPainlessExecuteAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new ScriptsPainlessExecuteRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, ScriptsPainlessExecuteResponse, ScriptsPainlessExecuteRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a scrolling search. - /// - /// - /// IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT). - /// - /// - /// The scroll API gets large sets of results from a single scrolling search request. - /// To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. - /// The scroll parameter indicates how long Elasticsearch should retain the search context for the request. - /// The search response returns a scroll ID in the _scroll_id response body parameter. - /// You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. - /// If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search. - /// - /// - /// You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context. - /// - /// - /// IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual ScrollResponse Scroll(ScrollRequest request) - { - request.BeforeRequest(); - return DoRequest, ScrollRequestParameters>(request); - } - - /// - /// - /// Run a scrolling search. - /// - /// - /// IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT). - /// - /// - /// The scroll API gets large sets of results from a single scrolling search request. - /// To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. - /// The scroll parameter indicates how long Elasticsearch should retain the search context for the request. - /// The search response returns a scroll ID in the _scroll_id response body parameter. - /// You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. - /// If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search. - /// - /// - /// You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context. - /// - /// - /// IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> ScrollAsync(ScrollRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, ScrollRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search(SearchRequest request) - { - request.BeforeRequest(); - return DoRequest, SearchRequestParameters>(request); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(SearchRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, SearchRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search(SearchRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, SearchResponse, SearchRequestParameters>(descriptor); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new SearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SearchResponse, SearchRequestParameters>(descriptor); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new SearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchResponse, SearchRequestParameters>(descriptor); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search() - { - var descriptor = new SearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SearchResponse, SearchRequestParameters>(descriptor); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchResponse Search(Action> configureRequest) - { - var descriptor = new SearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchResponse, SearchRequestParameters>(descriptor); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(SearchRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, SearchResponse, SearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new SearchRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchResponse, SearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchResponse, SearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(CancellationToken cancellationToken = default) - { - var descriptor = new SearchRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchResponse, SearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search. - /// - /// - /// Get search hits that match the query defined in the request. - /// You can provide search queries using the q query string parameter or the request body. - /// If both are specified, only the query parameter is used. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. - /// To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices. - /// - /// - /// Search slicing - /// - /// - /// When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. - /// By default the splitting is done first on the shards, then locally on each shard. - /// The local splitting partitions the shard into contiguous ranges based on Lucene document IDs. - /// - /// - /// For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. - /// - /// - /// IMPORTANT: The same point-in-time ID should be used for all slices. - /// If different PIT IDs are used, slices can overlap and miss documents. - /// This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchResponse, SearchRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(SearchMvtRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(SearchMvtRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(SearchMvtRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, SearchMvtResponse, SearchMvtRequestParameters>(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequest, SearchMvtResponse, SearchMvtRequestParameters>(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action> configureRequest) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchMvtResponse, SearchMvtRequestParameters>(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) - { - var descriptor = new SearchMvtRequestDescriptor(field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequest, SearchMvtResponse, SearchMvtRequestParameters>(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action> configureRequest) - { - var descriptor = new SearchMvtRequestDescriptor(field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchMvtResponse, SearchMvtRequestParameters>(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(SearchMvtRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action configureRequest) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(SearchMvtRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, SearchMvtResponse, SearchMvtRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchMvtResponse, SearchMvtRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchMvtResponse, SearchMvtRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchMvtResponse, SearchMvtRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchMvtResponse, SearchMvtRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(SearchMvtRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Search a vector tile. - /// - /// - /// Search a vector tile for geospatial values. - /// Before using this API, you should be familiar with the Mapbox vector tile specification. - /// The API returns results as a binary mapbox vector tile. - /// - /// - /// Internally, Elasticsearch translates a vector tile search API request into a search containing: - /// - /// - /// - /// - /// A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box. - /// - /// - /// - /// - /// Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true. - /// - /// - /// - /// - /// If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label. - /// - /// - /// - /// - /// For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search - /// - /// - /// GET my-index/_search - /// { - /// "size": 10000, - /// "query": { - /// "geo_bounding_box": { - /// "my-geo-field": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "aggregations": { - /// "grid": { - /// "geotile_grid": { - /// "field": "my-geo-field", - /// "precision": 11, - /// "size": 65536, - /// "bounds": { - /// "top_left": { - /// "lat": -40.979898069620134, - /// "lon": -45 - /// }, - /// "bottom_right": { - /// "lat": -66.51326044311186, - /// "lon": 0 - /// } - /// } - /// } - /// }, - /// "bounds": { - /// "geo_bounds": { - /// "field": "my-geo-field", - /// "wrap_longitude": false - /// } - /// } - /// } - /// } - /// - /// - /// The API returns results as a binary Mapbox vector tile. - /// Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers: - /// - /// - /// - /// - /// A hits layer containing a feature for each <field> value matching the geo_bounding_box query. - /// - /// - /// - /// - /// An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data. - /// - /// - /// - /// - /// A meta layer containing: - /// - /// - /// - /// - /// A feature containing a bounding box. By default, this is the bounding box of the tile. - /// - /// - /// - /// - /// Value ranges for any sub-aggregations on the geotile_grid or geohex_grid. - /// - /// - /// - /// - /// Metadata for the search. - /// - /// - /// - /// - /// - /// - /// The API only returns features that can display at its zoom level. - /// For example, if a polygon feature has no area at its zoom level, the API omits it. - /// The API returns errors as UTF-8 encoded JSON. - /// - /// - /// IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. - /// If you specify both parameters, the query parameter takes precedence. - /// - /// - /// Grid precision for geotile - /// - /// - /// For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. - /// grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. - /// For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. - /// The maximum final precision is 29. - /// The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). - /// For example, a value of 8 divides the tile into a grid of 256 x 256 cells. - /// The aggs layer only contains features for cells with matching data. - /// - /// - /// Grid precision for geohex - /// - /// - /// For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision. - /// - /// - /// This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. - /// The following table maps the H3 resolution for each precision. - /// For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. - /// At a precision of 6, hexagonal cells have an H3 resolution of 2. - /// If <zoom> is 3 and grid_precision is 4, the precision is 7. - /// At a precision of 7, hexagonal cells have an H3 resolution of 3. - /// - /// - /// | Precision | Unique tile bins | H3 resolution | Unique hex bins | Ratio | - /// | --------- | ---------------- | ------------- | ----------------| ----- | - /// | 1 | 4 | 0 | 122 | 30.5 | - /// | 2 | 16 | 0 | 122 | 7.625 | - /// | 3 | 64 | 1 | 842 | 13.15625 | - /// | 4 | 256 | 1 | 842 | 3.2890625 | - /// | 5 | 1024 | 2 | 5882 | 5.744140625 | - /// | 6 | 4096 | 2 | 5882 | 1.436035156 | - /// | 7 | 16384 | 3 | 41162 | 2.512329102 | - /// | 8 | 65536 | 3 | 41162 | 0.6280822754 | - /// | 9 | 262144 | 4 | 288122 | 1.099098206 | - /// | 10 | 1048576 | 4 | 288122 | 0.2747745514 | - /// | 11 | 4194304 | 5 | 2016842 | 0.4808526039 | - /// | 12 | 16777216 | 6 | 14117882 | 0.8414913416 | - /// | 13 | 67108864 | 6 | 14117882 | 0.2103728354 | - /// | 14 | 268435456 | 7 | 98825162 | 0.3681524172 | - /// | 15 | 1073741824 | 8 | 691776122 | 0.644266719 | - /// | 16 | 4294967296 | 8 | 691776122 | 0.1610666797 | - /// | 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 | - /// | 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 | - /// | 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 | - /// | 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 | - /// | 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 | - /// | 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 | - /// | 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 | - /// | 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 | - /// | 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 | - /// | 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 | - /// | 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 | - /// | 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 | - /// | 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 | - /// - /// - /// Hexagonal cells don't align perfectly on a vector tile. - /// Some cells may intersect more than one vector tile. - /// To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. - /// Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchMvtRequestDescriptor(indices, field, zoom, x, y); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(SearchShardsRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(SearchShardsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(SearchShardsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, SearchShardsResponse, SearchShardsRequestParameters>(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SearchShardsResponse, SearchShardsRequestParameters>(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchShardsResponse, SearchShardsRequestParameters>(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards() - { - var descriptor = new SearchShardsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SearchShardsResponse, SearchShardsRequestParameters>(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Action> configureRequest) - { - var descriptor = new SearchShardsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchShardsResponse, SearchShardsRequestParameters>(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(SearchShardsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards() - { - var descriptor = new SearchShardsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchShardsResponse SearchShards(Action configureRequest) - { - var descriptor = new SearchShardsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(SearchShardsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, SearchShardsResponse, SearchShardsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchShardsResponse, SearchShardsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchShardsResponse, SearchShardsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchShardsResponse, SearchShardsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchShardsResponse, SearchShardsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(SearchShardsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get the search shards. - /// - /// - /// Get the indices and shards that a search request would be run against. - /// This information can be useful for working out issues or planning optimizations with routing and shard preferences. - /// When filtered aliases are used, the filter is returned as part of the indices section. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task SearchShardsAsync(Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchShardsRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate(SearchTemplateRequest request) - { - request.BeforeRequest(); - return DoRequest, SearchTemplateRequestParameters>(request); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(SearchTemplateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, SearchTemplateRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate(SearchTemplateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) - { - var descriptor = new SearchTemplateRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest) - { - var descriptor = new SearchTemplateRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate() - { - var descriptor = new SearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual SearchTemplateResponse SearchTemplate(Action> configureRequest) - { - var descriptor = new SearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(SearchTemplateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, CancellationToken cancellationToken = default) - { - var descriptor = new SearchTemplateRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchTemplateRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(CancellationToken cancellationToken = default) - { - var descriptor = new SearchTemplateRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Run a search with a search template. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> SearchTemplateAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new SearchTemplateRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, SearchTemplateResponse, SearchTemplateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(TermsEnumRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(TermsEnumRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(TermsEnumRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, TermsEnumResponse, TermsEnumRequestParameters>(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new TermsEnumRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, TermsEnumResponse, TermsEnumRequestParameters>(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new TermsEnumRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermsEnumResponse, TermsEnumRequestParameters>(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum() - { - var descriptor = new TermsEnumRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, TermsEnumResponse, TermsEnumRequestParameters>(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(Action> configureRequest) - { - var descriptor = new TermsEnumRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermsEnumResponse, TermsEnumRequestParameters>(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(TermsEnumRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new TermsEnumRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest) - { - var descriptor = new TermsEnumRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(TermsEnumRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, TermsEnumResponse, TermsEnumRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, TermsEnumResponse, TermsEnumRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermsEnumResponse, TermsEnumRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, TermsEnumResponse, TermsEnumRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermsEnumResponse, TermsEnumRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(TermsEnumRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get terms in an index. - /// - /// - /// Discover terms that match a partial string in an index. - /// This API is designed for low-latency look-ups used in auto-complete scenarios. - /// - /// - /// info - /// The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermsEnumRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TermVectorsRequest request) - { - request.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(request); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TermVectorsRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TermVectorsRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new TermVectorsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new TermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document) - { - var descriptor = new TermVectorsRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new TermVectorsRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document, Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new TermVectorsRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(TDocument document, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.Id? id) - { - var descriptor = new TermVectorsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest) - { - var descriptor = new TermVectorsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, TermVectorsResponse, TermVectorsRequestParameters>(descriptor); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TermVectorsRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(index); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.Id? id, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Get term vector information. - /// - /// - /// Get information and statistics about terms in the fields of a particular document. - /// - /// - /// You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. - /// You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. - /// For example: - /// - /// - /// GET /my-index-000001/_termvectors/1?fields=message - /// - /// - /// Fields can be specified using wildcards, similar to the multi match query. - /// - /// - /// Term vectors are real-time by default, not near real-time. - /// This can be changed by setting realtime parameter to false. - /// - /// - /// You can request three types of values: term information, term statistics, and field statistics. - /// By default, all term information and field statistics are returned for all fields but term statistics are excluded. - /// - /// - /// Term information - /// - /// - /// - /// - /// term frequency in the field (always returned) - /// - /// - /// - /// - /// term positions (positions: true) - /// - /// - /// - /// - /// start and end offsets (offsets: true) - /// - /// - /// - /// - /// term payloads (payloads: true), as base64 encoded bytes - /// - /// - /// - /// - /// If the requested information wasn't stored in the index, it will be computed on the fly if possible. - /// Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user. - /// - /// - /// warn - /// Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16. - /// - /// - /// Behaviour - /// - /// - /// The term and field statistics are not accurate. - /// Deleted documents are not taken into account. - /// The information is only retrieved for the shard the requested document resides in. - /// The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. - /// By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. - /// Use routing only to hit a particular shard. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task TermvectorsAsync(Elastic.Clients.Elasticsearch.Id? id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new TermVectorsRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, TermVectorsResponse, TermVectorsRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(UpdateRequest request) - { - request.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(request); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(UpdateRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(request, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(UpdateRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new UpdateRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new UpdateRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document) - { - var descriptor = new UpdateRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document, Action> configureRequest) - { - var descriptor = new UpdateRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document, Elastic.Clients.Elasticsearch.IndexName index) - { - var descriptor = new UpdateRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest) - { - var descriptor = new UpdateRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document, Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new UpdateRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new UpdateRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(Elastic.Clients.Elasticsearch.Id id) - { - var descriptor = new UpdateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateResponse Update(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) - { - var descriptor = new UpdateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(UpdateRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(index, id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(index, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document, index); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document, index); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document, id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(document, id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(id); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update a document. - /// - /// - /// Update a document by running a script or passing a partial document. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias. - /// - /// - /// The script can update, delete, or skip modifying the document. - /// The API also supports passing a partial document, which is merged into the existing document. - /// To fully replace an existing document, use the index API. - /// This operation: - /// - /// - /// - /// - /// Gets the document (collocated with the shard) from the index. - /// - /// - /// - /// - /// Runs the specified script. - /// - /// - /// - /// - /// Indexes the result. - /// - /// - /// - /// - /// The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. - /// - /// - /// The _source field must be enabled to use this API. - /// In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp). - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task> UpdateAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateRequestDescriptor(id); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(UpdateByQueryRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(UpdateByQueryRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(UpdateByQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery() - { - var descriptor = new UpdateByQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequest, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(Action> configureRequest) - { - var descriptor = new UpdateByQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(UpdateByQueryRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(UpdateByQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(Action> configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateByQueryResponse, UpdateByQueryRequestParameters>(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(UpdateByQueryRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Update documents. - /// Updates documents that match the specified query. - /// If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes. - /// - /// - /// If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias: - /// - /// - /// - /// - /// read - /// - /// - /// - /// - /// index or write - /// - /// - /// - /// - /// You can specify the query criteria in the request URI or the request body using the same syntax as the search API. - /// - /// - /// When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. - /// When the versions match, the document is updated and the version number is incremented. - /// If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. - /// You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. - /// Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query. - /// - /// - /// NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number. - /// - /// - /// While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. - /// A bulk update request is performed for each batch of matching documents. - /// Any query or update failures cause the update by query request to fail and the failures are shown in the response. - /// Any update requests that completed successfully still stick, they are not rolled back. - /// - /// - /// Throttling update requests - /// - /// - /// To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. - /// This pads each batch with a wait time to throttle the rate. - /// Set requests_per_second to -1 to turn off throttling. - /// - /// - /// Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. - /// The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. - /// By default the batch size is 1000, so if requests_per_second is set to 500: - /// - /// - /// target_time = 1000 / 500 per second = 2 seconds - /// wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds - /// - /// - /// Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. - /// This is "bursty" instead of "smooth". - /// - /// - /// Slicing - /// - /// - /// Update by query supports sliced scroll to parallelize the update process. - /// This can improve efficiency and provide a convenient way to break the request down into smaller parts. - /// - /// - /// Setting slices to auto chooses a reasonable number for most data streams and indices. - /// This setting will use one slice per shard, up to a certain limit. - /// If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. - /// - /// - /// Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks: - /// - /// - /// - /// - /// You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices. - /// - /// - /// - /// - /// Fetching the status of the task for the request with slices only contains the status of completed slices. - /// - /// - /// - /// - /// These sub-requests are individually addressable for things like cancellation and rethrottling. - /// - /// - /// - /// - /// Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally. - /// - /// - /// - /// - /// Canceling the request with slices will cancel each sub-request. - /// - /// - /// - /// - /// Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution. - /// - /// - /// - /// - /// Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated. - /// - /// - /// - /// - /// Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time. - /// - /// - /// - /// - /// If you're slicing manually or otherwise tuning automatic slicing, keep in mind that: - /// - /// - /// - /// - /// Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. - /// - /// - /// - /// - /// Update performance scales linearly across available resources with the number of slices. - /// - /// - /// - /// - /// Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - /// - /// - /// Update the document source - /// - /// - /// Update by query supports scripts to update the document source. - /// As with the update API, you can set ctx.op to change the operation that is performed. - /// - /// - /// Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. - /// The update by query operation skips updating the document and increments the noop counter. - /// - /// - /// Set ctx.op = "delete" if your script decides that the document should be deleted. - /// The update by query operation deletes the document and increments the deleted counter. - /// - /// - /// Update by query supports only index, noop, and delete. - /// Setting ctx.op to anything else is an error. - /// Setting any other field in ctx is an error. - /// This API enables you to only modify the source of matching documents; you cannot move them. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRequestDescriptor(indices); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(UpdateByQueryRethrottleRequest request) - { - request.BeforeRequest(); - return DoRequest(request); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryRethrottleAsync(UpdateByQueryRethrottleRequest request, CancellationToken cancellationToken = default) - { - request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(UpdateByQueryRethrottleRequestDescriptor descriptor) - { - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(Elastic.Clients.Elasticsearch.Id taskId) - { - var descriptor = new UpdateByQueryRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest) - { - var descriptor = new UpdateByQueryRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryRethrottleAsync(UpdateByQueryRethrottleRequestDescriptor descriptor, CancellationToken cancellationToken = default) - { - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRethrottleRequestDescriptor(taskId); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } - - /// - /// - /// Throttle an update by query operation. - /// - /// - /// Change the number of requests per second for a particular update by query operation. - /// Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts. - /// - /// Learn more about this API in the Elasticsearch documentation. - /// - public virtual Task UpdateByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new UpdateByQueryRethrottleRequestDescriptor(taskId); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + AsyncSearch = new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchNamespacedClient(this); + Cluster = new Elastic.Clients.Elasticsearch.Cluster.ClusterNamespacedClient(this); + CrossClusterReplication = new Elastic.Clients.Elasticsearch.CrossClusterReplication.CrossClusterReplicationNamespacedClient(this); + DanglingIndices = new Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndicesNamespacedClient(this); + Enrich = new Elastic.Clients.Elasticsearch.Enrich.EnrichNamespacedClient(this); + Eql = new Elastic.Clients.Elasticsearch.Eql.EqlNamespacedClient(this); + Esql = new Elastic.Clients.Elasticsearch.Esql.EsqlNamespacedClient(this); + Features = new Elastic.Clients.Elasticsearch.Features.FeaturesNamespacedClient(this); + Graph = new Elastic.Clients.Elasticsearch.Graph.GraphNamespacedClient(this); + IndexLifecycleManagement = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IndexLifecycleManagementNamespacedClient(this); + Indices = new Elastic.Clients.Elasticsearch.IndexManagement.IndicesNamespacedClient(this); + Inference = new Elastic.Clients.Elasticsearch.Inference.InferenceNamespacedClient(this); + Ingest = new Elastic.Clients.Elasticsearch.Ingest.IngestNamespacedClient(this); + LicenseManagement = new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseManagementNamespacedClient(this); + MachineLearning = new Elastic.Clients.Elasticsearch.MachineLearning.MachineLearningNamespacedClient(this); + Nodes = new Elastic.Clients.Elasticsearch.Nodes.NodesNamespacedClient(this); + QueryRules = new Elastic.Clients.Elasticsearch.QueryRules.QueryRulesNamespacedClient(this); + Rollup = new Elastic.Clients.Elasticsearch.Rollup.RollupNamespacedClient(this); + SearchableSnapshots = new Elastic.Clients.Elasticsearch.SearchableSnapshots.SearchableSnapshotsNamespacedClient(this); + SearchApplication = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationNamespacedClient(this); + Security = new Elastic.Clients.Elasticsearch.Security.SecurityNamespacedClient(this); + Simulate = new Elastic.Clients.Elasticsearch.Simulate.SimulateNamespacedClient(this); + Snapshot = new Elastic.Clients.Elasticsearch.Snapshot.SnapshotNamespacedClient(this); + SnapshotLifecycleManagement = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycleManagementNamespacedClient(this); + Sql = new Elastic.Clients.Elasticsearch.Sql.SqlNamespacedClient(this); + Synonyms = new Elastic.Clients.Elasticsearch.Synonyms.SynonymsNamespacedClient(this); + Tasks = new Elastic.Clients.Elasticsearch.Tasks.TasksNamespacedClient(this); + TextStructure = new Elastic.Clients.Elasticsearch.TextStructure.TextStructureNamespacedClient(this); + TransformManagement = new Elastic.Clients.Elasticsearch.TransformManagement.TransformManagementNamespacedClient(this); + Xpack = new Elastic.Clients.Elasticsearch.Xpack.XpackNamespacedClient(this); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(Elastic.Clients.Elasticsearch.BulkRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk() + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.BulkResponse Bulk(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task BulkAsync(Elastic.Clients.Elasticsearch.BulkRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task BulkAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.BulkRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ClearScrollResponse ClearScroll(Elastic.Clients.Elasticsearch.ClearScrollRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ClearScrollResponse ClearScroll() + { + var builder = new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ClearScrollResponse ClearScroll(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ClearScrollAsync(Elastic.Clients.Elasticsearch.ClearScrollRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ClearScrollAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ClearScrollAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ClearScrollRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ClosePointInTimeResponse ClosePointInTime(Elastic.Clients.Elasticsearch.ClosePointInTimeRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ClosePointInTimeResponse ClosePointInTime(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ClosePointInTimeAsync(Elastic.Clients.Elasticsearch.ClosePointInTimeRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ClosePointInTimeAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ClosePointInTimeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(Elastic.Clients.Elasticsearch.CountRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count() + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.CountResponse Count(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task CountAsync(Elastic.Clients.Elasticsearch.CountRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CountAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CountRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(Elastic.Clients.Elasticsearch.CreateRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.CreateResponse Create(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task CreateAsync(Elastic.Clients.Elasticsearch.CreateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task CreateAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.CreateRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.CreateResponse, Elastic.Clients.Elasticsearch.CreateRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.DeleteRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteResponse Delete(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.DeleteRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.DeleteByQueryRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery() + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryResponse DeleteByQuery(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.DeleteByQueryRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(Elastic.Clients.Elasticsearch.TaskId taskId) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleResponse DeleteByQueryRethrottle(Elastic.Clients.Elasticsearch.TaskId taskId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.TaskId taskId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.TaskId taskId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteByQueryRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.DeleteScriptRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.DeleteScriptResponse DeleteScript(Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.DeleteScriptRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task DeleteScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.DeleteScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.ExistsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsResponse Exists(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.ExistsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.ExistsSourceRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExistsSourceResponse ExistsSource(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.ExistsSourceRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ExistsSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExistsSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.ExplainRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ExplainResponse Explain(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.ExplainRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ExplainAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ExplainRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ExplainRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.FieldCapsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps() + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.FieldCapsResponse FieldCaps(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(Elastic.Clients.Elasticsearch.FieldCapsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task FieldCapsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.FieldCapsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.GetRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetResponse Get(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.GetRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.GetScriptRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptResponse GetScript(Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetScriptAsync(Elastic.Clients.Elasticsearch.GetScriptRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptContextResponse GetScriptContext(Elastic.Clients.Elasticsearch.GetScriptContextRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptContextResponse GetScriptContext() + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptContextResponse GetScriptContext(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetScriptContextAsync(Elastic.Clients.Elasticsearch.GetScriptContextRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptContextAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptContextAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptContextRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse GetScriptLanguages(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse GetScriptLanguages() + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetScriptLanguagesResponse GetScriptLanguages(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task GetScriptLanguagesAsync(Elastic.Clients.Elasticsearch.GetScriptLanguagesRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptLanguagesAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task GetScriptLanguagesAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetScriptLanguagesRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.GetSourceRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.GetSourceResponse GetSource(Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.GetSourceRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(TDocument document, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> GetSourceAsync(Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.GetSourceRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.GetSourceRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.HealthReportResponse HealthReport(Elastic.Clients.Elasticsearch.HealthReportRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.HealthReportResponse HealthReport() + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.HealthReportResponse HealthReport(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.HealthReportResponse HealthReport(System.Collections.Generic.ICollection? feature) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(feature); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.HealthReportResponse HealthReport(System.Collections.Generic.ICollection? feature, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(feature); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task HealthReportAsync(Elastic.Clients.Elasticsearch.HealthReportRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task HealthReportAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task HealthReportAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task HealthReportAsync(System.Collections.Generic.ICollection? feature, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(feature); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task HealthReportAsync(System.Collections.Generic.ICollection? feature, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.HealthReportRequestDescriptor(feature); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(Elastic.Clients.Elasticsearch.IndexRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.Id? id) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document, Elastic.Clients.Elasticsearch.Id? id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.IndexResponse Index(TDocument document, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task IndexAsync(Elastic.Clients.Elasticsearch.IndexRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task IndexAsync(TDocument document, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.IndexRequestDescriptor(document); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.IndexResponse, Elastic.Clients.Elasticsearch.IndexRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.InfoResponse Info(Elastic.Clients.Elasticsearch.InfoRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.InfoResponse Info() + { + var builder = new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.InfoResponse Info(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task InfoAsync(Elastic.Clients.Elasticsearch.InfoRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task InfoAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task InfoAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.InfoRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors() + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiTermVectorsResponse Mtermvectors(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.MultiTermVectorsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task MtermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiTermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.MultiGetRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet() + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet() + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiGetResponse MultiGet(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(Elastic.Clients.Elasticsearch.MultiGetRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiGetAsync(Elastic.Clients.Elasticsearch.IndexName? index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiGetRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiGetRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.MultiSearchRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchResponse MultiSearch(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.MultiSearchRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.MultiSearchTemplateResponse MultiSearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.MultiSearchTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> MultiSearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.MultiSearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime() + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.OpenPointInTimeResponse OpenPointInTime(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.OpenPointInTimeRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task OpenPointInTimeAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.OpenPointInTimeRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.PingResponse Ping(Elastic.Clients.Elasticsearch.PingRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PingResponse Ping() + { + var builder = new Elastic.Clients.Elasticsearch.PingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PingResponse Ping(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.PingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PingAsync(Elastic.Clients.Elasticsearch.PingRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PingAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PingRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PingAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PingRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.PutScriptRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id, context); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.PutScriptResponse PutScript(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id, context); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutScriptAsync(Elastic.Clients.Elasticsearch.PutScriptRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id, context); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutScriptAsync(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.Name? context, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.PutScriptRequestDescriptor(id, context); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.RankEvalRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RankEvalResponse RankEval(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(Elastic.Clients.Elasticsearch.RankEvalRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RankEvalAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RankEvalRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexResponse Reindex(Elastic.Clients.Elasticsearch.ReindexRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexResponse Reindex(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexResponse Reindex(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ReindexAsync(Elastic.Clients.Elasticsearch.ReindexRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ReindexAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ReindexAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexRethrottleResponse ReindexRethrottle(Elastic.Clients.Elasticsearch.ReindexRethrottleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexRethrottleResponse ReindexRethrottle(Elastic.Clients.Elasticsearch.Id taskId) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.ReindexRethrottleResponse ReindexRethrottle(Elastic.Clients.Elasticsearch.Id taskId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task ReindexRethrottleAsync(Elastic.Clients.Elasticsearch.ReindexRethrottleRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ReindexRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task ReindexRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ReindexRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse RenderSearchTemplate(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse RenderSearchTemplate() + { + var builder = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.RenderSearchTemplateResponse RenderSearchTemplate(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task RenderSearchTemplateAsync(Elastic.Clients.Elasticsearch.RenderSearchTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RenderSearchTemplateAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task RenderSearchTemplateAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.RenderSearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse ScriptsPainlessExecute(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse ScriptsPainlessExecute() + { + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteResponse ScriptsPainlessExecute(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> ScriptsPainlessExecuteAsync(Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ScriptsPainlessExecuteAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ScriptsPainlessExecuteAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ScriptsPainlessExecuteRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.ScrollResponse Scroll(Elastic.Clients.Elasticsearch.ScrollRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ScrollRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.ScrollResponse Scroll(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ScrollRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.ScrollRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> ScrollAsync(Elastic.Clients.Elasticsearch.ScrollRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ScrollRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> ScrollAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.ScrollRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.ScrollRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(Elastic.Clients.Elasticsearch.SearchRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search() + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search() + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchResponse Search(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.SearchRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.SearchMvtRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchMvtResponse SearchMvt(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task SearchMvtAsync(Elastic.Clients.Elasticsearch.SearchMvtRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchMvtAsync(Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field field, int zoom, int x, int y, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchMvtRequestDescriptor(indices, field, zoom, x, y); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.SearchShardsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards() + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchShardsResponse SearchShards(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(Elastic.Clients.Elasticsearch.SearchShardsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task SearchShardsAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchShardsRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.SearchTemplateRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate() + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate() + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.SearchTemplateResponse SearchTemplate(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.SearchTemplateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> SearchTemplateAsync(Elastic.Clients.Elasticsearch.Indices? indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.SearchTemplateRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.SearchTemplateRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.TermsEnumRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum() + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermsEnumResponse TermsEnum(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(Elastic.Clients.Elasticsearch.TermsEnumRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermsEnumAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermsEnumRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.TermVectorsRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.TermVectorsResponse Termvectors(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task TermvectorsAsync(Elastic.Clients.Elasticsearch.TermVectorsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id? id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task TermvectorsAsync(Elastic.Clients.Elasticsearch.IndexName index, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.TermVectorsRequestDescriptor(index); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.TermVectorsResponse, Elastic.Clients.Elasticsearch.TermVectorsRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.UpdateRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.UpdateRequest request) + { + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateResponse Update(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.UpdateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.UpdateRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task> UpdateAsync(Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Id id, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateRequestDescriptor(index, id); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync, Elastic.Clients.Elasticsearch.UpdateResponse, Elastic.Clients.Elasticsearch.UpdateRequestParameters>(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.UpdateByQueryRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery() + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryResponse UpdateByQuery(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.UpdateByQueryRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryAsync(Elastic.Clients.Elasticsearch.Indices indices, System.Action> action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRequestDescriptor(indices); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(Elastic.Clients.Elasticsearch.Id taskId) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleResponse UpdateByQueryRethrottle(Elastic.Clients.Elasticsearch.Id taskId, System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(taskId); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task UpdateByQueryRethrottleAsync(Elastic.Clients.Elasticsearch.Id taskId, System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.UpdateByQueryRethrottleRequestDescriptor(taskId); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfFieldSortOrder.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfFieldSortOrder.g.cs new file mode 100644 index 00000000000..8b67dac0511 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfFieldSortOrder.g.cs @@ -0,0 +1,120 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentCollectionOfKeyValuePairOfFieldSortOrder +{ + private readonly System.Collections.Generic.List> _items = new(); + + private System.Collections.Generic.ICollection> Value => _items; + + public FluentCollectionOfKeyValuePairOfFieldSortOrder() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(System.Collections.Generic.KeyValuePair value) + { + _items.Add(value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(params System.Collections.Generic.KeyValuePair[] values) + { + _items.AddRange(values); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.ICollection> Build(System.Action>? action) + { + if (action is null) + { + return []; + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentCollectionOfKeyValuePairOfFieldSortOrder +{ + private readonly System.Collections.Generic.List> _items = new(); + + private System.Collections.Generic.ICollection> Value => _items; + + public FluentCollectionOfKeyValuePairOfFieldSortOrder() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(System.Collections.Generic.KeyValuePair value) + { + _items.Add(value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(params System.Collections.Generic.KeyValuePair[] values) + { + _items.AddRange(values); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.ICollection> Build(System.Action? action) + { + if (action is null) + { + return []; + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfIndexNameDouble.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfIndexNameDouble.g.cs new file mode 100644 index 00000000000..1b6f8538add --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfIndexNameDouble.g.cs @@ -0,0 +1,66 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentCollectionOfKeyValuePairOfIndexNameDouble +{ + private readonly System.Collections.Generic.List> _items = new(); + + private System.Collections.Generic.ICollection> Value => _items; + + public FluentCollectionOfKeyValuePairOfIndexNameDouble() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble Add(System.Collections.Generic.KeyValuePair value) + { + _items.Add(value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble Add(params System.Collections.Generic.KeyValuePair[] values) + { + _items.AddRange(values); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble Add(Elastic.Clients.Elasticsearch.IndexName key, double value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.ICollection> Build(System.Action? action) + { + if (action is null) + { + return []; + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfStringDynamicTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfStringDynamicTemplate.g.cs new file mode 100644 index 00000000000..35c95215f06 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentCollectionOfKeyValuePairOfStringDynamicTemplate.g.cs @@ -0,0 +1,126 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentCollectionOfKeyValuePairOfStringDynamicTemplate +{ + private readonly System.Collections.Generic.List> _items = new(); + + private System.Collections.Generic.ICollection> Value => _items; + + public FluentCollectionOfKeyValuePairOfStringDynamicTemplate() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(System.Collections.Generic.KeyValuePair value) + { + _items.Add(value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(params System.Collections.Generic.KeyValuePair[] values) + { + _items.AddRange(values); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(string key, System.Action> action) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.ICollection> Build(System.Action>? action) + { + if (action is null) + { + return []; + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentCollectionOfKeyValuePairOfStringDynamicTemplate +{ + private readonly System.Collections.Generic.List> _items = new(); + + private System.Collections.Generic.ICollection> Value => _items; + + public FluentCollectionOfKeyValuePairOfStringDynamicTemplate() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(System.Collections.Generic.KeyValuePair value) + { + _items.Add(value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(params System.Collections.Generic.KeyValuePair[] values) + { + _items.AddRange(values); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(string key, System.Action action) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate Add(string key, System.Action> action) + { + _items.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.ICollection> Build(System.Action? action) + { + if (action is null) + { + return []; + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldCollectionOfCompletionContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldCollectionOfCompletionContext.g.cs new file mode 100644 index 00000000000..01c6c903322 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldCollectionOfCompletionContext.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldCollectionOfCompletionContext +{ + private readonly System.Collections.Generic.Dictionary> _items = new(); + + private System.Collections.Generic.IDictionary> Value => _items; + + public FluentDictionaryOfFieldCollectionOfCompletionContext() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext Add(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext Add(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary> Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary>(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldCollectionOfCompletionContext +{ + private readonly System.Collections.Generic.Dictionary> _items = new(); + + private System.Collections.Generic.IDictionary> Value => _items; + + public FluentDictionaryOfFieldCollectionOfCompletionContext() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext Add(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext Add(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary> Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary>(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldDouble.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldDouble.g.cs new file mode 100644 index 00000000000..d3cdf1bdb4a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldDouble.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldDouble +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldDouble() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble Add(Elastic.Clients.Elasticsearch.Field key, double value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble Add(System.Linq.Expressions.Expression> key, double value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldDouble +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldDouble() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble Add(Elastic.Clients.Elasticsearch.Field key, double value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble Add(System.Linq.Expressions.Expression> key, double value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFieldValue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFieldValue.g.cs new file mode 100644 index 00000000000..b4c5b505829 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFieldValue.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldFieldValue +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldFieldValue() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.FieldValue value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.FieldValue value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldFieldValue +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldFieldValue() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.FieldValue value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.FieldValue value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFilterRef.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFilterRef.g.cs new file mode 100644 index 00000000000..5f906f3f9d7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldFilterRef.g.cs @@ -0,0 +1,120 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldFilterRef +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldFilterRef() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldFilterRef +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldFilterRef() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef Add(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldHighlightField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldHighlightField.g.cs new file mode 100644 index 00000000000..80556c2f920 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldHighlightField.g.cs @@ -0,0 +1,156 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldHighlightField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldHighlightField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldHighlightField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldHighlightField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(Elastic.Clients.Elasticsearch.Field key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField Add(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldLong.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldLong.g.cs new file mode 100644 index 00000000000..bbeaad12d91 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldLong.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldLong +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldLong() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong Add(Elastic.Clients.Elasticsearch.Field key, long value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong Add(System.Linq.Expressions.Expression> key, long value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldLong +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldLong() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong Add(Elastic.Clients.Elasticsearch.Field key, long value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong Add(System.Linq.Expressions.Expression> key, long value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldLong(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldObject.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldObject.g.cs new file mode 100644 index 00000000000..39c7934a456 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldObject.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldObject +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldObject() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject Add(Elastic.Clients.Elasticsearch.Field key, object value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject Add(System.Linq.Expressions.Expression> key, object value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldObject +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldObject() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject Add(Elastic.Clients.Elasticsearch.Field key, object value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject Add(System.Linq.Expressions.Expression> key, object value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldRuntimeField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldRuntimeField.g.cs new file mode 100644 index 00000000000..92d88a7fb78 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldRuntimeField.g.cs @@ -0,0 +1,132 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldRuntimeField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldRuntimeField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(System.Linq.Expressions.Expression> key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldRuntimeField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldRuntimeField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField Add(System.Linq.Expressions.Expression> key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldScriptField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldScriptField.g.cs new file mode 100644 index 00000000000..55c6121c844 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldScriptField.g.cs @@ -0,0 +1,120 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldScriptField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldScriptField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.ScriptField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.ScriptField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldScriptField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldScriptField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.ScriptField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.ScriptField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField Add(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldString.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldString.g.cs new file mode 100644 index 00000000000..2efa07bb859 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfFieldString.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfFieldString +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldString() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString Add(Elastic.Clients.Elasticsearch.Field key, string value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString Add(System.Linq.Expressions.Expression> key, string value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfFieldString +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfFieldString() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString Add(Elastic.Clients.Elasticsearch.Field key, string value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString Add(System.Linq.Expressions.Expression> key, string value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameAlias.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameAlias.g.cs new file mode 100644 index 00000000000..6c047334173 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameAlias.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfIndexNameAlias +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfIndexNameAlias() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfIndexNameAlias +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfIndexNameAlias() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameIndexSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameIndexSettings.g.cs new file mode 100644 index 00000000000..1c5e9a03e95 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfIndexNameIndexSettings.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfIndexNameIndexSettings +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfIndexNameIndexSettings() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfIndexNameIndexSettings +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfIndexNameIndexSettings() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings Add(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfNameAlias.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfNameAlias.g.cs new file mode 100644 index 00000000000..6dbaa077c56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfNameAlias.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfNameAlias +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfNameAlias() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfNameAlias +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfNameAlias() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias Add(Elastic.Clients.Elasticsearch.Name key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfNameAlias(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAggregation.g.cs new file mode 100644 index 00000000000..3acc5625eb7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAggregation.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringAggregation +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation Add(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringAggregation +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation Add(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAliasDefinition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAliasDefinition.g.cs new file mode 100644 index 00000000000..3073ba8e512 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringAliasDefinition.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringAliasDefinition +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringAliasDefinition() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringAliasDefinition +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringAliasDefinition() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyAggregation.g.cs new file mode 100644 index 00000000000..45d1dd06024 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyAggregation.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringApiKeyAggregation +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringApiKeyAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation Add(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringApiKeyAggregation +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringApiKeyAggregation() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation Add(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyQuery.g.cs new file mode 100644 index 00000000000..1ce8481765c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringApiKeyQuery.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringApiKeyQuery +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringApiKeyQuery() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery Add(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyQuery value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringApiKeyQuery +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringApiKeyQuery() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery Add(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyQuery value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCollectionOfString.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCollectionOfString.g.cs new file mode 100644 index 00000000000..ad5211ee331 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCollectionOfString.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringCollectionOfString +{ + private readonly System.Collections.Generic.Dictionary> _items = new(); + + private System.Collections.Generic.IDictionary> Value => _items; + + public FluentDictionaryOfStringCollectionOfString() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString Add(string key, System.Collections.Generic.ICollection value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary> Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary>(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringComponentTemplateNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringComponentTemplateNode.g.cs new file mode 100644 index 00000000000..1fa6af6fed1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringComponentTemplateNode.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringComponentTemplateNode +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringComponentTemplateNode() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode Add(string key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringComponentTemplateNode +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringComponentTemplateNode() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode Add(string key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringComponentTemplateNode(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeAggregationSource.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeAggregationSource.g.cs new file mode 100644 index 00000000000..17c81c90a6b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeAggregationSource.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringCompositeAggregationSource +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringCompositeAggregationSource() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringCompositeAggregationSource +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringCompositeAggregationSource() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeSubField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeSubField.g.cs new file mode 100644 index 00000000000..3c9c2163cb9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringCompositeSubField.g.cs @@ -0,0 +1,60 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringCompositeSubField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringCompositeSubField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField Add(string key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDictionaryOfStringPrivilegeActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDictionaryOfStringPrivilegeActions.g.cs new file mode 100644 index 00000000000..3169e0a5891 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDictionaryOfStringPrivilegeActions.g.cs @@ -0,0 +1,66 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringDictionaryOfStringPrivilegeActions +{ + private readonly System.Collections.Generic.Dictionary> _items = new(); + + private System.Collections.Generic.IDictionary> Value => _items; + + public FluentDictionaryOfStringDictionaryOfStringPrivilegeActions() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions Add(string key, System.Collections.Generic.IDictionary value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions Add(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary> Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary>(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDictionaryOfStringPrivilegeActions(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDouble.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDouble.g.cs new file mode 100644 index 00000000000..dc3e299bbb2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringDouble.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringDouble +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringDouble() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble Add(string key, double value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFieldSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFieldSuggester.g.cs new file mode 100644 index 00000000000..3ed5bfa0024 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFieldSuggester.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringFieldSuggester +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringFieldSuggester() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester Add(string key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringFieldSuggester +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringFieldSuggester() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester Add(string key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFloat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFloat.g.cs new file mode 100644 index 00000000000..da640b0ef23 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringFloat.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringFloat +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringFloat() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat Add(string key, float value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringIndexTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringIndexTemplate.g.cs new file mode 100644 index 00000000000..8c087520e7e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringIndexTemplate.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringIndexTemplate +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringIndexTemplate() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate Add(string key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringIndexTemplate +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringIndexTemplate() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate Add(string key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringIndexTemplate(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringObject.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringObject.g.cs new file mode 100644 index 00000000000..fe28e460f92 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringObject.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringObject +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringObject() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject Add(string key, object value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPipeline.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPipeline.g.cs new file mode 100644 index 00000000000..228935d1ada --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPipeline.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringPipeline +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringPipeline() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key, Elastic.Clients.Elasticsearch.Ingest.Pipeline value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringPipeline +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringPipeline() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key, Elastic.Clients.Elasticsearch.Ingest.Pipeline value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPipeline(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPivotGroupBy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPivotGroupBy.g.cs new file mode 100644 index 00000000000..5f341769744 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPivotGroupBy.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringPivotGroupBy +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringPivotGroupBy() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy Add(string key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringPivotGroupBy +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringPivotGroupBy() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy Add(string key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPrivilegeActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPrivilegeActions.g.cs new file mode 100644 index 00000000000..79d8fcf5989 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringPrivilegeActions.g.cs @@ -0,0 +1,60 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringPrivilegeActions +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringPrivilegeActions() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions Add(string key, Elastic.Clients.Elasticsearch.Security.PrivilegeActions value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPrivilegeActions(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQuery.g.cs new file mode 100644 index 00000000000..5df4ad2daad --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQuery.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringQuery +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringQuery() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery Add(string key, Elastic.Clients.Elasticsearch.QueryDsl.Query value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringQuery +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringQuery() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery Add(string key, Elastic.Clients.Elasticsearch.QueryDsl.Query value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQueryFeatureExtractor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQueryFeatureExtractor.g.cs new file mode 100644 index 00000000000..f7b43486487 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringQueryFeatureExtractor.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringQueryFeatureExtractor +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringQueryFeatureExtractor() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor Add(string key, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringQueryFeatureExtractor +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringQueryFeatureExtractor() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor Add(string key, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRoleDescriptorx.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRoleDescriptorx.g.cs new file mode 100644 index 00000000000..6a8b7d8e8a5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRoleDescriptorx.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringRoleDescriptorx +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringRoleDescriptorx() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringRoleDescriptorx +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringRoleDescriptorx() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx Add(string key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRuntimeField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRuntimeField.g.cs new file mode 100644 index 00000000000..b99fbe6b83f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringRuntimeField.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringRuntimeField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringRuntimeField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField Add(string key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action>? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct FluentDictionaryOfStringRuntimeField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringRuntimeField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField Add(string key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField Add(string key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringScriptField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringScriptField.g.cs new file mode 100644 index 00000000000..5426027bc69 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringScriptField.g.cs @@ -0,0 +1,60 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringScriptField +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringScriptField() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField Add(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField Add(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringString.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringString.g.cs new file mode 100644 index 00000000000..4f5385dd47e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Fluent/FluentDictionaryOfStringString.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Fluent; + +public readonly partial struct FluentDictionaryOfStringString +{ + private readonly System.Collections.Generic.Dictionary _items = new(); + + private System.Collections.Generic.IDictionary Value => _items; + + public FluentDictionaryOfStringString() + { + } + + public Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString Add(string key, string value) + { + _items.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static System.Collections.Generic.IDictionary Build(System.Action? action) + { + if (action is null) + { + return new System.Collections.Generic.Dictionary(); + } + + var builder = new Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString(); + action.Invoke(builder); + return builder.Value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregate.g.cs index 5b0e0007e35..df17feb1770 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class AdjacencyMatrixAggregate : IAggregate +internal sealed partial class AdjacencyMatrixAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregateConverter))] +public sealed partial class AdjacencyMatrixAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public AdjacencyMatrixAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AdjacencyMatrixAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdjacencyMatrixAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "adjacency_matrix"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs index b4eb14cefbe..30a38c20564 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs @@ -17,48 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class AdjacencyMatrixAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFilters = default; + LocalJsonValue propSeparator = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilters.TryReadProperty(ref reader, options, PropFilters, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filters = propFilters.Value, + Separator = propSeparator.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilters, value.Filters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationConverter))] public sealed partial class AdjacencyMatrixAggregation { +#if NET7_0_OR_GREATER + public AdjacencyMatrixAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public AdjacencyMatrixAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Filters used to create buckets. /// At least one filter is required. /// /// - [JsonInclude, JsonPropertyName("filters")] - public IDictionary? Filters { get; set; } + public System.Collections.Generic.IDictionary? Filters { get; set; } /// /// /// Separator used to concatenate filter names. Defaults to &. /// /// - [JsonInclude, JsonPropertyName("separator")] public string? Separator { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(AdjacencyMatrixAggregation adjacencyMatrixAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.AdjacencyMatrix(adjacencyMatrixAggregation); } -public sealed partial class AdjacencyMatrixAggregationDescriptor : SerializableDescriptor> +public readonly partial struct AdjacencyMatrixAggregationDescriptor { - internal AdjacencyMatrixAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation Instance { get; init; } - public AdjacencyMatrixAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation instance) { + Instance = instance; } - private IDictionary> FiltersValue { get; set; } - private string? SeparatorValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -66,52 +131,93 @@ public AdjacencyMatrixAggregationDescriptor() : base() /// At least one filter is required. /// /// - public AdjacencyMatrixAggregationDescriptor Filters(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters(System.Collections.Generic.IDictionary? value) { - FiltersValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Filters = value; + return this; } /// /// - /// Separator used to concatenate filter names. Defaults to &. + /// Filters used to create buckets. + /// At least one filter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters() + { + Instance.Filters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(null); + return this; + } + + /// + /// + /// Filters used to create buckets. + /// At least one filter is required. /// /// - public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters(System.Action>? action) { - SeparatorValue = separator; - return Self; + Instance.Filters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor AddFilter(string key, Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - writer.WriteStartObject(); - if (FiltersValue is not null) - { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - } + Instance.Filters ??= new System.Collections.Generic.Dictionary(); + Instance.Filters.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor AddFilter(string key, System.Action> action) + { + Instance.Filters ??= new System.Collections.Generic.Dictionary(); + Instance.Filters.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } + + /// + /// + /// Separator used to concatenate filter names. Defaults to &. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Separator(string? value) + { + Instance.Separator = value; + return this; + } - if (!string.IsNullOrEmpty(SeparatorValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); + return new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AdjacencyMatrixAggregationDescriptor : SerializableDescriptor +public readonly partial struct AdjacencyMatrixAggregationDescriptor { - internal AdjacencyMatrixAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation instance) + { + Instance = instance; + } - public AdjacencyMatrixAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary FiltersValue { get; set; } - private string? SeparatorValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -119,38 +225,90 @@ public AdjacencyMatrixAggregationDescriptor() : base() /// At least one filter is required. /// /// - public AdjacencyMatrixAggregationDescriptor Filters(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters(System.Collections.Generic.IDictionary? value) { - FiltersValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Filters = value; + return this; } /// /// - /// Separator used to concatenate filter names. Defaults to &. + /// Filters used to create buckets. + /// At least one filter is required. /// /// - public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters() { - SeparatorValue = separator; - return Self; + Instance.Filters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Filters used to create buckets. + /// At least one filter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters(System.Action? action) { - writer.WriteStartObject(); - if (FiltersValue is not null) - { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - } + Instance.Filters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action); + return this; + } + + /// + /// + /// Filters used to create buckets. + /// At least one filter is required. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Filters(System.Action>? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor AddFilter(string key, Elastic.Clients.Elasticsearch.QueryDsl.Query value) + { + Instance.Filters ??= new System.Collections.Generic.Dictionary(); + Instance.Filters.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor AddFilter(string key, System.Action action) + { + Instance.Filters ??= new System.Collections.Generic.Dictionary(); + Instance.Filters.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } - if (!string.IsNullOrEmpty(SeparatorValue)) + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor AddFilter(string key, System.Action> action) + { + Instance.Filters ??= new System.Collections.Generic.Dictionary(); + Instance.Filters.Add(key, Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + return this; + } + + /// + /// + /// Separator used to concatenate filter names. Defaults to &. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor Separator(string? value) + { + Instance.Separator = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); + return new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixBucket.g.cs index f238c0e248c..971fffd56ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class AdjacencyMatrixBucketConverter : JsonConverter +internal sealed partial class AdjacencyMatrixBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override AdjacencyMatrixBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new AdjacencyMatrixBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, AdjacencyMatrixBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'AdjacencyMatrixBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(AdjacencyMatrixBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixBucketConverter))] public sealed partial class AdjacencyMatrixBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdjacencyMatrixBucket(long docCount, string key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public AdjacencyMatrixBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AdjacencyMatrixBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdjacencyMatrixBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregate.g.cs similarity index 81% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceResponse.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregate.g.cs index fb55c4afc55..62f0eb1f9a0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregate.g.cs @@ -17,15 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; -namespace Elastic.Clients.Elasticsearch.Inference; +namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class InferenceResponse : ElasticsearchResponse +public partial interface IAggregate { + public string Type { get; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs index 6198ae808d5..cbf2701dee0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs @@ -17,29 +17,367 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public partial interface IAggregate +internal sealed partial class AggregateDictionaryConverter : System.Text.Json.Serialization.JsonConverter { + public override Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var dictionary = new System.Collections.Generic.Dictionary(); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + ReadItem(ref reader, options, out string name, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + dictionary[name] = value; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(dictionary); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + foreach (var pair in value) + { + WriteItem(writer, options, pair.Key, pair.Value); + } + + writer.WriteEndObject(); + } + + internal static void ReadItem(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, out string name, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value) + { + var key = reader.ReadPropertyName(options, null); + reader.Read(); + var parts = key.Split('#'); + if (parts.Length != 2) + { + throw new System.Text.Json.JsonException($"Unable to parse typed-key '{key}' for variant '{nameof(Elastic.Clients.Elasticsearch.Aggregations.IAggregate)}'."); + } + + var discriminator = parts[0]; + name = parts[1]; + value = discriminator switch + { + "adjacency_matrix" => reader.ReadValue(options, null), + "auto_date_histogram" => reader.ReadValue(options, null), + "avg" => reader.ReadValue(options, null), + "boxplot" => reader.ReadValue(options, null), + "bucket_metric_value" => reader.ReadValue(options, null), + "cardinality" => reader.ReadValue(options, null), + "children" => reader.ReadValue(options, null), + "composite" => reader.ReadValue(options, null), + "date_histogram" => reader.ReadValue(options, null), + "date_range" => reader.ReadValue(options, null), + "derivative" => reader.ReadValue(options, null), + "dterms" => reader.ReadValue(options, null), + "extended_stats" => reader.ReadValue(options, null), + "extended_stats_bucket" => reader.ReadValue(options, null), + "filter" => reader.ReadValue(options, null), + "filters" => reader.ReadValue(options, null), + "frequent_item_sets" => reader.ReadValue(options, null), + "geo_bounds" => reader.ReadValue(options, null), + "geo_centroid" => reader.ReadValue(options, null), + "geo_distance" => reader.ReadValue(options, null), + "geo_line" => reader.ReadValue(options, null), + "geohash_grid" => reader.ReadValue(options, null), + "geohex_grid" => reader.ReadValue(options, null), + "geotile_grid" => reader.ReadValue(options, null), + "global" => reader.ReadValue(options, null), + "hdr_percentile_ranks" => reader.ReadValue(options, null), + "hdr_percentiles" => reader.ReadValue(options, null), + "histogram" => reader.ReadValue(options, null), + "inference" => reader.ReadValue(options, null), + "ip_prefix" => reader.ReadValue(options, null), + "ip_range" => reader.ReadValue(options, null), + "lrareterms" => reader.ReadValue(options, null), + "lterms" => reader.ReadValue(options, null), + "matrix_stats" => reader.ReadValue(options, null), + "max" => reader.ReadValue(options, null), + "median_absolute_deviation" => reader.ReadValue(options, null), + "min" => reader.ReadValue(options, null), + "missing" => reader.ReadValue(options, null), + "multi_terms" => reader.ReadValue(options, null), + "nested" => reader.ReadValue(options, null), + "parent" => reader.ReadValue(options, null), + "percentiles_bucket" => reader.ReadValue(options, null), + "range" => reader.ReadValue(options, null), + "rate" => reader.ReadValue(options, null), + "reverse_nested" => reader.ReadValue(options, null), + "sampler" => reader.ReadValue(options, null), + "scripted_metric" => reader.ReadValue(options, null), + "siglterms" => reader.ReadValue(options, null), + "sigsterms" => reader.ReadValue(options, null), + "simple_long_value" => reader.ReadValue(options, null), + "simple_value" => reader.ReadValue(options, null), + "srareterms" => reader.ReadValue(options, null), + "stats" => reader.ReadValue(options, null), + "stats_bucket" => reader.ReadValue(options, null), + "sterms" => reader.ReadValue(options, null), + "string_stats" => reader.ReadValue(options, null), + "sum" => reader.ReadValue(options, null), + "t_test" => reader.ReadValue(options, null), + "tdigest_percentile_ranks" => reader.ReadValue(options, null), + "tdigest_percentiles" => reader.ReadValue(options, null), + "time_series" => reader.ReadValue(options, null), + "top_hits" => reader.ReadValue(options, null), + "top_metrics" => reader.ReadValue(options, null), + "umrareterms" => reader.ReadValue(options, null), + "umsigterms" => reader.ReadValue(options, null), + "umterms" => reader.ReadValue(options, null), + "unmapped_sampler" => reader.ReadValue(options, null), + "value_count" => reader.ReadValue(options, null), + "variable_width_histogram" => reader.ReadValue(options, null), + "weighted_avg" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.IAggregate)}'.") + }; + } + + internal static void WriteItem(System.Text.Json.Utf8JsonWriter writer, System.Text.Json.JsonSerializerOptions options, string name, Elastic.Clients.Elasticsearch.Aggregations.IAggregate value) + { + var key = value.Type + '#' + name; + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.AverageAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.BucketMetricValueAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.FilterAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.HdrPercentilesAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MaxAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MissingAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NestedAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ParentAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.RangeAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.RateAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SumAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + case Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate v: + writer.WriteProperty(options, key, v, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{0}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.IAggregate)}'."); + } + } } -[JsonConverter(typeof(AggregateDictionaryConverter))] -public partial class AggregateDictionary : IsAReadOnlyDictionary +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter))] +public sealed partial class AggregateDictionary : Elastic.Clients.Elasticsearch.IsAReadOnlyDictionary { - public AggregateDictionary(IReadOnlyDictionary backingDictionary) : base(backingDictionary) + public AggregateDictionary(System.Collections.Generic.IReadOnlyDictionary backingDictionary) : base(backingDictionary) + { + } + + public bool TryGetAggregate(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value) => BackingDictionary.TryGetValue(Sanitize(key), out value); + + public bool TryGetAggregate(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, IAggregate { + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) + { + value = finalValue; + return true; + } + + value = null; + return false; } public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregate? GetAdjacencyMatrix(string key) => TryGet(key); @@ -50,7 +388,6 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregate? GetCardinality(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate? GetChildren(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate? GetComposite(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate? GetCumulativeCardinality(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregate? GetDateHistogram(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate? GetDateRange(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate? GetDerivative(string key) => TryGet(key); @@ -63,9 +400,9 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregate? GetGeoBounds(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregate? GetGeoCentroid(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate? GetGeoDistance(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate? GetGeoLine(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate? GetGeohashGrid(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate? GetGeohexGrid(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate? GetGeoLine(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate? GetGeotileGrid(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregate? GetGlobal(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregate? GetHdrPercentileRanks(string key) => TryGet(key); @@ -92,553 +429,26 @@ public AggregateDictionary(IReadOnlyDictionary backingDictio public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate? GetScriptedMetric(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregate? GetSignificantLongTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate? GetSignificantStringTerms(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate? GetCumulativeCardinality(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregate? GetSimpleValue(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate? GetStringRareTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate? GetStats(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregate? GetStatsBucket(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate? GetStringRareTerms(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate? GetStringStats(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate? GetStringTerms(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate? GetStringStats(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.SumAggregate? GetSum(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate? GetTTest(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregate? GetTDigestPercentileRanks(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregate? GetTDigestPercentiles(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregate? GetTimeSeries(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate? GetTopHits(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate? GetTopMetrics(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate? GetTTest(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregate? GetUnmappedRareTerms(string key) => TryGet(key); - public Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate? GetUnmappedSampler(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregate? GetUnmappedSignificantTerms(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregate? GetUnmappedTerms(string key) => TryGet(key); + public Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate? GetUnmappedSampler(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate? GetValueCount(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregate? GetVariableWidthHistogram(string key) => TryGet(key); public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate? GetWeightedAverage(string key) => TryGet(key); - private T? TryGet(string key) where T : class, IAggregate => BackingDictionary.TryGetValue(key, out var value) ? value as T : null; -} - -internal sealed partial class AggregateDictionaryConverter : JsonConverter -{ - public override AggregateDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var dictionary = new Dictionary(); - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); - var name = reader.GetString(); - reader.Read(); - ReadItem(ref reader, options, dictionary, name); - } - - return new AggregateDictionary(dictionary); - } - - public override void Write(Utf8JsonWriter writer, AggregateDictionary value, JsonSerializerOptions options) - { - throw new NotImplementedException("'AggregateDictionary' is a readonly type, used only on responses and does not support being written to JSON."); - } - - public static void ReadItem(ref Utf8JsonReader reader, JsonSerializerOptions options, Dictionary dictionary, string name) - { - var nameParts = name.Split('#'); - if (nameParts.Length != 2) - throw new JsonException($"Unable to parse typed-key '{name}'."); - var type = nameParts[0]; - switch (type) - { - case "adjacency_matrix": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "auto_date_histogram": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "avg": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "boxplot": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "bucket_metric_value": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "cardinality": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "children": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "composite": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "simple_long_value": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "date_histogram": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "date_range": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "derivative": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "dterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "extended_stats": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "extended_stats_bucket": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "filter": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "filters": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "frequent_item_sets": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geo_bounds": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geo_centroid": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geo_distance": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geohash_grid": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geohex_grid": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geo_line": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "geotile_grid": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "global": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "hdr_percentile_ranks": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "hdr_percentiles": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "histogram": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "inference": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "ip_prefix": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "ip_range": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "lrareterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "lterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "matrix_stats": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "max": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "median_absolute_deviation": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "min": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "missing": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "multi_terms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "nested": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "parent": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "percentiles_bucket": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "range": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "rate": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "reverse_nested": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "sampler": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "scripted_metric": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "siglterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "sigsterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "simple_value": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "stats": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "stats_bucket": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "srareterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "string_stats": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "sterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "sum": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "tdigest_percentile_ranks": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "tdigest_percentiles": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "time_series": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "top_hits": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "top_metrics": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "t_test": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "umrareterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "unmapped_sampler": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "umsigterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "umterms": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "value_count": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "variable_width_histogram": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "weighted_avg": - { - var item = JsonSerializer.Deserialize(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - default: - throw new NotSupportedException($"The tagged variant '{type}' is currently not supported."); - } - } + private T? TryGet(string key) where T : class, IAggregate => BackingDictionary.TryGetValue(Sanitize(key), out var value) ? value as T : null; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs index 3ce7c7ac1d7..3e3375d2409 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Aggregation.g.cs @@ -17,1456 +17,7401 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -[JsonConverter(typeof(AggregationConverter))] -public sealed partial class Aggregation +internal sealed partial class AggregationConverter : System.Text.Json.Serialization.JsonConverter { - internal Aggregation(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Aggregation AdjacencyMatrix(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation adjacencyMatrixAggregation) => new Aggregation("adjacency_matrix", adjacencyMatrixAggregation); - public static Aggregation AutoDateHistogram(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation autoDateHistogramAggregation) => new Aggregation("auto_date_histogram", autoDateHistogramAggregation); - public static Aggregation Avg(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation averageAggregation) => new Aggregation("avg", averageAggregation); - public static Aggregation AvgBucket(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation averageBucketAggregation) => new Aggregation("avg_bucket", averageBucketAggregation); - public static Aggregation Boxplot(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation boxplotAggregation) => new Aggregation("boxplot", boxplotAggregation); - public static Aggregation BucketCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation bucketCorrelationAggregation) => new Aggregation("bucket_correlation", bucketCorrelationAggregation); - public static Aggregation BucketCountKsTest(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation bucketKsAggregation) => new Aggregation("bucket_count_ks_test", bucketKsAggregation); - public static Aggregation BucketScript(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation bucketScriptAggregation) => new Aggregation("bucket_script", bucketScriptAggregation); - public static Aggregation BucketSelector(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation bucketSelectorAggregation) => new Aggregation("bucket_selector", bucketSelectorAggregation); - public static Aggregation BucketSort(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation bucketSortAggregation) => new Aggregation("bucket_sort", bucketSortAggregation); - public static Aggregation Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => new Aggregation("cardinality", cardinalityAggregation); - public static Aggregation CategorizeText(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation categorizeTextAggregation) => new Aggregation("categorize_text", categorizeTextAggregation); - public static Aggregation Children(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation childrenAggregation) => new Aggregation("children", childrenAggregation); - public static Aggregation Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => new Aggregation("composite", compositeAggregation); - public static Aggregation CumulativeCardinality(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation cumulativeCardinalityAggregation) => new Aggregation("cumulative_cardinality", cumulativeCardinalityAggregation); - public static Aggregation CumulativeSum(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation cumulativeSumAggregation) => new Aggregation("cumulative_sum", cumulativeSumAggregation); - public static Aggregation DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => new Aggregation("date_histogram", dateHistogramAggregation); - public static Aggregation DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => new Aggregation("date_range", dateRangeAggregation); - public static Aggregation Derivative(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation derivativeAggregation) => new Aggregation("derivative", derivativeAggregation); - public static Aggregation DiversifiedSampler(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation diversifiedSamplerAggregation) => new Aggregation("diversified_sampler", diversifiedSamplerAggregation); - public static Aggregation ExtendedStats(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation extendedStatsAggregation) => new Aggregation("extended_stats", extendedStatsAggregation); - public static Aggregation ExtendedStatsBucket(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation extendedStatsBucketAggregation) => new Aggregation("extended_stats_bucket", extendedStatsBucketAggregation); - public static Aggregation Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query queryContainer) => new Aggregation("filter", queryContainer); - public static Aggregation Filters(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation filtersAggregation) => new Aggregation("filters", filtersAggregation); - public static Aggregation FrequentItemSets(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation frequentItemSetsAggregation) => new Aggregation("frequent_item_sets", frequentItemSetsAggregation); - public static Aggregation GeoBounds(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation geoBoundsAggregation) => new Aggregation("geo_bounds", geoBoundsAggregation); - public static Aggregation GeoCentroid(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation geoCentroidAggregation) => new Aggregation("geo_centroid", geoCentroidAggregation); - public static Aggregation GeoDistance(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation geoDistanceAggregation) => new Aggregation("geo_distance", geoDistanceAggregation); - public static Aggregation GeohashGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation geohashGridAggregation) => new Aggregation("geohash_grid", geohashGridAggregation); - public static Aggregation GeohexGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation geohexGridAggregation) => new Aggregation("geohex_grid", geohexGridAggregation); - public static Aggregation GeoLine(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => new Aggregation("geo_line", geoLineAggregation); - public static Aggregation GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => new Aggregation("geotile_grid", geotileGridAggregation); - public static Aggregation Global(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation globalAggregation) => new Aggregation("global", globalAggregation); - public static Aggregation Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => new Aggregation("histogram", histogramAggregation); - public static Aggregation Inference(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation inferenceAggregation) => new Aggregation("inference", inferenceAggregation); - public static Aggregation IpPrefix(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation ipPrefixAggregation) => new Aggregation("ip_prefix", ipPrefixAggregation); - public static Aggregation IpRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation ipRangeAggregation) => new Aggregation("ip_range", ipRangeAggregation); - public static Aggregation Line(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => new Aggregation("line", geoLineAggregation); - public static Aggregation MatrixStats(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation matrixStatsAggregation) => new Aggregation("matrix_stats", matrixStatsAggregation); - public static Aggregation Max(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation maxAggregation) => new Aggregation("max", maxAggregation); - public static Aggregation MaxBucket(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation maxBucketAggregation) => new Aggregation("max_bucket", maxBucketAggregation); - public static Aggregation MedianAbsoluteDeviation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation medianAbsoluteDeviationAggregation) => new Aggregation("median_absolute_deviation", medianAbsoluteDeviationAggregation); - public static Aggregation Min(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation minAggregation) => new Aggregation("min", minAggregation); - public static Aggregation MinBucket(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation minBucketAggregation) => new Aggregation("min_bucket", minBucketAggregation); - public static Aggregation Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => new Aggregation("missing", missingAggregation); - public static Aggregation MovingFn(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation movingFunctionAggregation) => new Aggregation("moving_fn", movingFunctionAggregation); - public static Aggregation MovingPercentiles(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation movingPercentilesAggregation) => new Aggregation("moving_percentiles", movingPercentilesAggregation); - public static Aggregation MultiTerms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation multiTermsAggregation) => new Aggregation("multi_terms", multiTermsAggregation); - public static Aggregation Nested(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation nestedAggregation) => new Aggregation("nested", nestedAggregation); - public static Aggregation Normalize(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation normalizeAggregation) => new Aggregation("normalize", normalizeAggregation); - public static Aggregation Parent(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation parentAggregation) => new Aggregation("parent", parentAggregation); - public static Aggregation PercentileRanks(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation percentileRanksAggregation) => new Aggregation("percentile_ranks", percentileRanksAggregation); - public static Aggregation Percentiles(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation percentilesAggregation) => new Aggregation("percentiles", percentilesAggregation); - public static Aggregation PercentilesBucket(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation percentilesBucketAggregation) => new Aggregation("percentiles_bucket", percentilesBucketAggregation); - public static Aggregation RandomSampler(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation randomSamplerAggregation) => new Aggregation("random_sampler", randomSamplerAggregation); - public static Aggregation Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => new Aggregation("range", rangeAggregation); - public static Aggregation RareTerms(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation rareTermsAggregation) => new Aggregation("rare_terms", rareTermsAggregation); - public static Aggregation Rate(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation rateAggregation) => new Aggregation("rate", rateAggregation); - public static Aggregation ReverseNested(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation reverseNestedAggregation) => new Aggregation("reverse_nested", reverseNestedAggregation); - public static Aggregation Sampler(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation samplerAggregation) => new Aggregation("sampler", samplerAggregation); - public static Aggregation ScriptedMetric(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation scriptedMetricAggregation) => new Aggregation("scripted_metric", scriptedMetricAggregation); - public static Aggregation SerialDiff(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation serialDifferencingAggregation) => new Aggregation("serial_diff", serialDifferencingAggregation); - public static Aggregation SignificantTerms(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation significantTermsAggregation) => new Aggregation("significant_terms", significantTermsAggregation); - public static Aggregation SignificantText(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation significantTextAggregation) => new Aggregation("significant_text", significantTextAggregation); - public static Aggregation Stats(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation statsAggregation) => new Aggregation("stats", statsAggregation); - public static Aggregation StatsBucket(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation statsBucketAggregation) => new Aggregation("stats_bucket", statsBucketAggregation); - public static Aggregation StringStats(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation stringStatsAggregation) => new Aggregation("string_stats", stringStatsAggregation); - public static Aggregation Sum(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation sumAggregation) => new Aggregation("sum", sumAggregation); - public static Aggregation SumBucket(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation sumBucketAggregation) => new Aggregation("sum_bucket", sumBucketAggregation); - public static Aggregation Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => new Aggregation("terms", termsAggregation); - public static Aggregation TimeSeries(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation timeSeriesAggregation) => new Aggregation("time_series", timeSeriesAggregation); - public static Aggregation TopHits(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation topHitsAggregation) => new Aggregation("top_hits", topHitsAggregation); - public static Aggregation TopMetrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation topMetricsAggregation) => new Aggregation("top_metrics", topMetricsAggregation); - public static Aggregation TTest(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation tTestAggregation) => new Aggregation("t_test", tTestAggregation); - public static Aggregation ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => new Aggregation("value_count", valueCountAggregation); - public static Aggregation VariableWidthHistogram(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation variableWidthHistogramAggregation) => new Aggregation("variable_width_histogram", variableWidthHistogramAggregation); - public static Aggregation WeightedAvg(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation weightedAverageAggregation) => new Aggregation("weighted_avg", weightedAverageAggregation); - - /// - /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. - /// - /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText VariantAdjacencyMatrix = System.Text.Json.JsonEncodedText.Encode("adjacency_matrix"); + private static readonly System.Text.Json.JsonEncodedText VariantAutoDateHistogram = System.Text.Json.JsonEncodedText.Encode("auto_date_histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText VariantAvgBucket = System.Text.Json.JsonEncodedText.Encode("avg_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantBoxplot = System.Text.Json.JsonEncodedText.Encode("boxplot"); + private static readonly System.Text.Json.JsonEncodedText VariantBucketCorrelation = System.Text.Json.JsonEncodedText.Encode("bucket_correlation"); + private static readonly System.Text.Json.JsonEncodedText VariantBucketCountKsTest = System.Text.Json.JsonEncodedText.Encode("bucket_count_ks_test"); + private static readonly System.Text.Json.JsonEncodedText VariantBucketScript = System.Text.Json.JsonEncodedText.Encode("bucket_script"); + private static readonly System.Text.Json.JsonEncodedText VariantBucketSelector = System.Text.Json.JsonEncodedText.Encode("bucket_selector"); + private static readonly System.Text.Json.JsonEncodedText VariantBucketSort = System.Text.Json.JsonEncodedText.Encode("bucket_sort"); + private static readonly System.Text.Json.JsonEncodedText VariantCardinality = System.Text.Json.JsonEncodedText.Encode("cardinality"); + private static readonly System.Text.Json.JsonEncodedText VariantCategorizeText = System.Text.Json.JsonEncodedText.Encode("categorize_text"); + private static readonly System.Text.Json.JsonEncodedText VariantChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText VariantComposite = System.Text.Json.JsonEncodedText.Encode("composite"); + private static readonly System.Text.Json.JsonEncodedText VariantCumulativeCardinality = System.Text.Json.JsonEncodedText.Encode("cumulative_cardinality"); + private static readonly System.Text.Json.JsonEncodedText VariantCumulativeSum = System.Text.Json.JsonEncodedText.Encode("cumulative_sum"); + private static readonly System.Text.Json.JsonEncodedText VariantDateHistogram = System.Text.Json.JsonEncodedText.Encode("date_histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantDateRange = System.Text.Json.JsonEncodedText.Encode("date_range"); + private static readonly System.Text.Json.JsonEncodedText VariantDerivative = System.Text.Json.JsonEncodedText.Encode("derivative"); + private static readonly System.Text.Json.JsonEncodedText VariantDiversifiedSampler = System.Text.Json.JsonEncodedText.Encode("diversified_sampler"); + private static readonly System.Text.Json.JsonEncodedText VariantExtendedStats = System.Text.Json.JsonEncodedText.Encode("extended_stats"); + private static readonly System.Text.Json.JsonEncodedText VariantExtendedStatsBucket = System.Text.Json.JsonEncodedText.Encode("extended_stats_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText VariantFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText VariantFrequentItemSets = System.Text.Json.JsonEncodedText.Encode("frequent_item_sets"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoBounds = System.Text.Json.JsonEncodedText.Encode("geo_bounds"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoCentroid = System.Text.Json.JsonEncodedText.Encode("geo_centroid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoDistance = System.Text.Json.JsonEncodedText.Encode("geo_distance"); + private static readonly System.Text.Json.JsonEncodedText VariantGeohashGrid = System.Text.Json.JsonEncodedText.Encode("geohash_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeohexGrid = System.Text.Json.JsonEncodedText.Encode("geohex_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoLine = System.Text.Json.JsonEncodedText.Encode("geo_line"); + private static readonly System.Text.Json.JsonEncodedText VariantGeotileGrid = System.Text.Json.JsonEncodedText.Encode("geotile_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText VariantHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantInference = System.Text.Json.JsonEncodedText.Encode("inference"); + private static readonly System.Text.Json.JsonEncodedText VariantIpPrefix = System.Text.Json.JsonEncodedText.Encode("ip_prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantIpRange = System.Text.Json.JsonEncodedText.Encode("ip_range"); + private static readonly System.Text.Json.JsonEncodedText VariantLine = System.Text.Json.JsonEncodedText.Encode("line"); + private static readonly System.Text.Json.JsonEncodedText VariantMatrixStats = System.Text.Json.JsonEncodedText.Encode("matrix_stats"); + private static readonly System.Text.Json.JsonEncodedText VariantMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText VariantMaxBucket = System.Text.Json.JsonEncodedText.Encode("max_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantMedianAbsoluteDeviation = System.Text.Json.JsonEncodedText.Encode("median_absolute_deviation"); + private static readonly System.Text.Json.JsonEncodedText VariantMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText VariantMinBucket = System.Text.Json.JsonEncodedText.Encode("min_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText VariantMovingFn = System.Text.Json.JsonEncodedText.Encode("moving_fn"); + private static readonly System.Text.Json.JsonEncodedText VariantMovingPercentiles = System.Text.Json.JsonEncodedText.Encode("moving_percentiles"); + private static readonly System.Text.Json.JsonEncodedText VariantMultiTerms = System.Text.Json.JsonEncodedText.Encode("multi_terms"); + private static readonly System.Text.Json.JsonEncodedText VariantNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText VariantNormalize = System.Text.Json.JsonEncodedText.Encode("normalize"); + private static readonly System.Text.Json.JsonEncodedText VariantParent = System.Text.Json.JsonEncodedText.Encode("parent"); + private static readonly System.Text.Json.JsonEncodedText VariantPercentileRanks = System.Text.Json.JsonEncodedText.Encode("percentile_ranks"); + private static readonly System.Text.Json.JsonEncodedText VariantPercentiles = System.Text.Json.JsonEncodedText.Encode("percentiles"); + private static readonly System.Text.Json.JsonEncodedText VariantPercentilesBucket = System.Text.Json.JsonEncodedText.Encode("percentiles_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantRandomSampler = System.Text.Json.JsonEncodedText.Encode("random_sampler"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantRareTerms = System.Text.Json.JsonEncodedText.Encode("rare_terms"); + private static readonly System.Text.Json.JsonEncodedText VariantRate = System.Text.Json.JsonEncodedText.Encode("rate"); + private static readonly System.Text.Json.JsonEncodedText VariantReverseNested = System.Text.Json.JsonEncodedText.Encode("reverse_nested"); + private static readonly System.Text.Json.JsonEncodedText VariantSampler = System.Text.Json.JsonEncodedText.Encode("sampler"); + private static readonly System.Text.Json.JsonEncodedText VariantScriptedMetric = System.Text.Json.JsonEncodedText.Encode("scripted_metric"); + private static readonly System.Text.Json.JsonEncodedText VariantSerialDiff = System.Text.Json.JsonEncodedText.Encode("serial_diff"); + private static readonly System.Text.Json.JsonEncodedText VariantSignificantTerms = System.Text.Json.JsonEncodedText.Encode("significant_terms"); + private static readonly System.Text.Json.JsonEncodedText VariantSignificantText = System.Text.Json.JsonEncodedText.Encode("significant_text"); + private static readonly System.Text.Json.JsonEncodedText VariantStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText VariantStatsBucket = System.Text.Json.JsonEncodedText.Encode("stats_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantStringStats = System.Text.Json.JsonEncodedText.Encode("string_stats"); + private static readonly System.Text.Json.JsonEncodedText VariantSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText VariantSumBucket = System.Text.Json.JsonEncodedText.Encode("sum_bucket"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantTimeSeries = System.Text.Json.JsonEncodedText.Encode("time_series"); + private static readonly System.Text.Json.JsonEncodedText VariantTopHits = System.Text.Json.JsonEncodedText.Encode("top_hits"); + private static readonly System.Text.Json.JsonEncodedText VariantTopMetrics = System.Text.Json.JsonEncodedText.Encode("top_metrics"); + private static readonly System.Text.Json.JsonEncodedText VariantTTest = System.Text.Json.JsonEncodedText.Encode("t_test"); + private static readonly System.Text.Json.JsonEncodedText VariantValueCount = System.Text.Json.JsonEncodedText.Encode("value_count"); + private static readonly System.Text.Json.JsonEncodedText VariantVariableWidthHistogram = System.Text.Json.JsonEncodedText.Encode("variable_width_histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantWeightedAvg = System.Text.Json.JsonEncodedText.Encode("weighted_avg"); -internal sealed partial class AggregationConverter : JsonConverter -{ - public override Aggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Aggregations.Aggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - IDictionary? aggregationsValue = default; - IDictionary? metaValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue?> propMeta = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "aggregations") + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - aggregationsValue = JsonSerializer.Deserialize?>(ref reader, options); continue; } - if (propertyName == "meta") + if (reader.ValueTextEquals(VariantAdjacencyMatrix)) { - metaValue = JsonSerializer.Deserialize?>(ref reader, options); + variantType = VariantAdjacencyMatrix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "adjacency_matrix") + if (reader.ValueTextEquals(VariantAutoDateHistogram)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAutoDateHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "auto_date_histogram") + if (reader.ValueTextEquals(VariantAvg)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAvg.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "avg") + if (reader.ValueTextEquals(VariantAvgBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAvgBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "avg_bucket") + if (reader.ValueTextEquals(VariantBoxplot)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBoxplot.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "boxplot") + if (reader.ValueTextEquals(VariantBucketCorrelation)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBucketCorrelation.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bucket_correlation") + if (reader.ValueTextEquals(VariantBucketCountKsTest)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBucketCountKsTest.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bucket_count_ks_test") + if (reader.ValueTextEquals(VariantBucketScript)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBucketScript.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bucket_script") + if (reader.ValueTextEquals(VariantBucketSelector)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBucketSelector.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bucket_selector") + if (reader.ValueTextEquals(VariantBucketSort)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBucketSort.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bucket_sort") + if (reader.ValueTextEquals(VariantCardinality)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCardinality.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "cardinality") + if (reader.ValueTextEquals(VariantCategorizeText)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCategorizeText.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "categorize_text") + if (reader.ValueTextEquals(VariantChildren)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantChildren.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "children") + if (reader.ValueTextEquals(VariantComposite)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantComposite.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "composite") + if (reader.ValueTextEquals(VariantCumulativeCardinality)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCumulativeCardinality.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "cumulative_cardinality") + if (reader.ValueTextEquals(VariantCumulativeSum)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCumulativeSum.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "cumulative_sum") + if (reader.ValueTextEquals(VariantDateHistogram)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDateHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "date_histogram") + if (reader.ValueTextEquals(VariantDateRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDateRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "date_range") + if (reader.ValueTextEquals(VariantDerivative)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDerivative.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "derivative") + if (reader.ValueTextEquals(VariantDiversifiedSampler)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDiversifiedSampler.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "diversified_sampler") + if (reader.ValueTextEquals(VariantExtendedStats)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExtendedStats.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "extended_stats") + if (reader.ValueTextEquals(VariantExtendedStatsBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExtendedStatsBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "extended_stats_bucket") + if (reader.ValueTextEquals(VariantFilter)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFilter.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "filter") + if (reader.ValueTextEquals(VariantFilters)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFilters.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "filters") + if (reader.ValueTextEquals(VariantFrequentItemSets)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFrequentItemSets.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "frequent_item_sets") + if (reader.ValueTextEquals(VariantGeoBounds)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoBounds.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_bounds") + if (reader.ValueTextEquals(VariantGeoCentroid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoCentroid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_centroid") + if (reader.ValueTextEquals(VariantGeoDistance)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoDistance.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_distance") + if (reader.ValueTextEquals(VariantGeohashGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeohashGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geohash_grid") + if (reader.ValueTextEquals(VariantGeohexGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeohexGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geohex_grid") + if (reader.ValueTextEquals(VariantGeoLine)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoLine.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_line") + if (reader.ValueTextEquals(VariantGeotileGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeotileGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geotile_grid") + if (reader.ValueTextEquals(VariantGlobal)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGlobal.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "global") + if (reader.ValueTextEquals(VariantHistogram)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "histogram") + if (reader.ValueTextEquals(VariantInference)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantInference.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "inference") + if (reader.ValueTextEquals(VariantIpPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIpPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ip_prefix") + if (reader.ValueTextEquals(VariantIpRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIpRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ip_range") + if (reader.ValueTextEquals(VariantLine)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLine.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "line") + if (reader.ValueTextEquals(VariantMatrixStats)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatrixStats.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "matrix_stats") + if (reader.ValueTextEquals(VariantMax)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMax.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "max") + if (reader.ValueTextEquals(VariantMaxBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMaxBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "max_bucket") + if (reader.ValueTextEquals(VariantMedianAbsoluteDeviation)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMedianAbsoluteDeviation.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "median_absolute_deviation") + if (reader.ValueTextEquals(VariantMin)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMin.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "min") + if (reader.ValueTextEquals(VariantMinBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMinBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "min_bucket") + if (reader.ValueTextEquals(VariantMissing)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMissing.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "missing") + if (reader.ValueTextEquals(VariantMovingFn)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMovingFn.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "moving_fn") + if (reader.ValueTextEquals(VariantMovingPercentiles)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMovingPercentiles.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "moving_percentiles") + if (reader.ValueTextEquals(VariantMultiTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMultiTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "multi_terms") + if (reader.ValueTextEquals(VariantNested)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNested.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "nested") + if (reader.ValueTextEquals(VariantNormalize)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNormalize.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "normalize") + if (reader.ValueTextEquals(VariantParent)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantParent.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "parent") + if (reader.ValueTextEquals(VariantPercentileRanks)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPercentileRanks.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "percentile_ranks") + if (reader.ValueTextEquals(VariantPercentiles)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPercentiles.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "percentiles") + if (reader.ValueTextEquals(VariantPercentilesBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPercentilesBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "percentiles_bucket") + if (reader.ValueTextEquals(VariantRandomSampler)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRandomSampler.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "random_sampler") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantRareTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRareTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rare_terms") + if (reader.ValueTextEquals(VariantRate)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRate.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rate") + if (reader.ValueTextEquals(VariantReverseNested)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantReverseNested.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "reverse_nested") + if (reader.ValueTextEquals(VariantSampler)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSampler.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "sampler") + if (reader.ValueTextEquals(VariantScriptedMetric)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScriptedMetric.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "scripted_metric") + if (reader.ValueTextEquals(VariantSerialDiff)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSerialDiff.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "serial_diff") + if (reader.ValueTextEquals(VariantSignificantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSignificantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "significant_terms") + if (reader.ValueTextEquals(VariantSignificantText)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSignificantText.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "significant_text") + if (reader.ValueTextEquals(VariantStats)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantStats.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "stats") + if (reader.ValueTextEquals(VariantStatsBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantStatsBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "stats_bucket") + if (reader.ValueTextEquals(VariantStringStats)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantStringStats.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "string_stats") + if (reader.ValueTextEquals(VariantSum)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSum.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "sum") + if (reader.ValueTextEquals(VariantSumBucket)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSumBucket.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "sum_bucket") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantTimeSeries)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTimeSeries.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "time_series") + if (reader.ValueTextEquals(VariantTopHits)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTopHits.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "top_hits") + if (reader.ValueTextEquals(VariantTopMetrics)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTopMetrics.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "top_metrics") + if (reader.ValueTextEquals(VariantTTest)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTTest.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "t_test") + if (reader.ValueTextEquals(VariantValueCount)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantValueCount.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "value_count") + if (reader.ValueTextEquals(VariantVariableWidthHistogram)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantVariableWidthHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "variable_width_histogram") + if (reader.ValueTextEquals(VariantWeightedAvg)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWeightedAvg.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "weighted_avg") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Aggregation' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Aggregation(variantNameValue, variantValue); - result.Aggregations = aggregationsValue; - result.Meta = metaValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Aggregations = propAggregations.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, Aggregation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } - - if (value.Meta is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, value.Meta, options); - } - - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "adjacency_matrix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation)value.Variant, options); - break; - case "auto_date_histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation)value.Variant, options); - break; - case "avg": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation)value.Variant, options); - break; - case "avg_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation)value.Variant, options); - break; - case "boxplot": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation)value.Variant, options); - break; - case "bucket_correlation": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation)value.Variant, options); - break; - case "bucket_count_ks_test": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation)value.Variant, options); - break; - case "bucket_script": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation)value.Variant, options); - break; - case "bucket_selector": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation)value.Variant, options); - break; - case "bucket_sort": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation)value.Variant, options); - break; - case "cardinality": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation)value.Variant, options); - break; - case "categorize_text": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation)value.Variant, options); - break; - case "children": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation)value.Variant, options); - break; - case "composite": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation)value.Variant, options); - break; - case "cumulative_cardinality": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation)value.Variant, options); - break; - case "cumulative_sum": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation)value.Variant, options); - break; - case "date_histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation)value.Variant, options); - break; - case "date_range": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation)value.Variant, options); - break; - case "derivative": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation)value.Variant, options); - break; - case "diversified_sampler": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation)value.Variant, options); - break; - case "extended_stats": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation)value.Variant, options); - break; - case "extended_stats_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation)value.Variant, options); - break; - case "filter": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Query)value.Variant, options); - break; - case "filters": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation)value.Variant, options); - break; - case "frequent_item_sets": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation)value.Variant, options); - break; - case "geo_bounds": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation)value.Variant, options); - break; - case "geo_centroid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation)value.Variant, options); - break; - case "geo_distance": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation)value.Variant, options); - break; - case "geohash_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation)value.Variant, options); - break; - case "geohex_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation)value.Variant, options); - break; - case "geo_line": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation)value.Variant, options); - break; - case "geotile_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation)value.Variant, options); - break; - case "global": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation)value.Variant, options); - break; - case "histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation)value.Variant, options); - break; - case "inference": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation)value.Variant, options); - break; - case "ip_prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation)value.Variant, options); - break; - case "ip_range": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation)value.Variant, options); - break; - case "line": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation)value.Variant, options); - break; - case "matrix_stats": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation)value.Variant, options); - break; - case "max": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation)value.Variant, options); - break; - case "max_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation)value.Variant, options); - break; - case "median_absolute_deviation": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation)value.Variant, options); - break; - case "min": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MinAggregation)value.Variant, options); - break; - case "min_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation)value.Variant, options); - break; - case "missing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation)value.Variant, options); - break; - case "moving_fn": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation)value.Variant, options); - break; - case "moving_percentiles": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation)value.Variant, options); - break; - case "multi_terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation)value.Variant, options); - break; - case "nested": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation)value.Variant, options); - break; - case "normalize": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation)value.Variant, options); - break; - case "parent": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation)value.Variant, options); - break; - case "percentile_ranks": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation)value.Variant, options); - break; - case "percentiles": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation)value.Variant, options); - break; - case "percentiles_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation)value.Variant, options); - break; - case "random_sampler": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation)value.Variant, options); - break; - case "rare_terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation)value.Variant, options); - break; - case "rate": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RateAggregation)value.Variant, options); - break; - case "reverse_nested": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation)value.Variant, options); - break; - case "sampler": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation)value.Variant, options); - break; - case "scripted_metric": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation)value.Variant, options); - break; - case "serial_diff": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation)value.Variant, options); - break; - case "significant_terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation)value.Variant, options); - break; - case "significant_text": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation)value.Variant, options); - break; - case "stats": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation)value.Variant, options); - break; - case "stats_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation)value.Variant, options); - break; - case "string_stats": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation)value.Variant, options); - break; - case "sum": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SumAggregation)value.Variant, options); - break; - case "sum_bucket": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, options); - break; - case "time_series": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation)value.Variant, options); - break; - case "top_hits": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation)value.Variant, options); - break; - case "top_metrics": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation)value.Variant, options); - break; - case "t_test": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation)value.Variant, options); - break; - case "value_count": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation)value.Variant, options); - break; - case "variable_width_histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation)value.Variant, options); - break; - case "weighted_avg": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation)value.Variant, options); - break; - } + case null: + break; + case "adjacency_matrix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation)value.Variant, null, null); + break; + case "auto_date_histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation)value.Variant, null, null); + break; + case "avg": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation)value.Variant, null, null); + break; + case "avg_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation)value.Variant, null, null); + break; + case "boxplot": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation)value.Variant, null, null); + break; + case "bucket_correlation": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation)value.Variant, null, null); + break; + case "bucket_count_ks_test": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation)value.Variant, null, null); + break; + case "bucket_script": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation)value.Variant, null, null); + break; + case "bucket_selector": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation)value.Variant, null, null); + break; + case "bucket_sort": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation)value.Variant, null, null); + break; + case "cardinality": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation)value.Variant, null, null); + break; + case "categorize_text": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation)value.Variant, null, null); + break; + case "children": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation)value.Variant, null, null); + break; + case "composite": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation)value.Variant, null, null); + break; + case "cumulative_cardinality": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation)value.Variant, null, null); + break; + case "cumulative_sum": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation)value.Variant, null, null); + break; + case "date_histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation)value.Variant, null, null); + break; + case "date_range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation)value.Variant, null, null); + break; + case "derivative": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation)value.Variant, null, null); + break; + case "diversified_sampler": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation)value.Variant, null, null); + break; + case "extended_stats": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation)value.Variant, null, null); + break; + case "extended_stats_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation)value.Variant, null, null); + break; + case "filter": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Query)value.Variant, null, null); + break; + case "filters": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation)value.Variant, null, null); + break; + case "frequent_item_sets": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation)value.Variant, null, null); + break; + case "geo_bounds": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation)value.Variant, null, null); + break; + case "geo_centroid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation)value.Variant, null, null); + break; + case "geo_distance": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation)value.Variant, null, null); + break; + case "geohash_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation)value.Variant, null, null); + break; + case "geohex_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation)value.Variant, null, null); + break; + case "geo_line": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation)value.Variant, null, null); + break; + case "geotile_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation)value.Variant, null, null); + break; + case "global": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation)value.Variant, null, null); + break; + case "histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation)value.Variant, null, null); + break; + case "inference": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation)value.Variant, null, null); + break; + case "ip_prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation)value.Variant, null, null); + break; + case "ip_range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation)value.Variant, null, null); + break; + case "line": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation)value.Variant, null, null); + break; + case "matrix_stats": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation)value.Variant, null, null); + break; + case "max": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation)value.Variant, null, null); + break; + case "max_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation)value.Variant, null, null); + break; + case "median_absolute_deviation": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation)value.Variant, null, null); + break; + case "min": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MinAggregation)value.Variant, null, null); + break; + case "min_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation)value.Variant, null, null); + break; + case "missing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation)value.Variant, null, null); + break; + case "moving_fn": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation)value.Variant, null, null); + break; + case "moving_percentiles": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation)value.Variant, null, null); + break; + case "multi_terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation)value.Variant, null, null); + break; + case "nested": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation)value.Variant, null, null); + break; + case "normalize": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation)value.Variant, null, null); + break; + case "parent": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation)value.Variant, null, null); + break; + case "percentile_ranks": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation)value.Variant, null, null); + break; + case "percentiles": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation)value.Variant, null, null); + break; + case "percentiles_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation)value.Variant, null, null); + break; + case "random_sampler": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation)value.Variant, null, null); + break; + case "rare_terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation)value.Variant, null, null); + break; + case "rate": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.RateAggregation)value.Variant, null, null); + break; + case "reverse_nested": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation)value.Variant, null, null); + break; + case "sampler": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation)value.Variant, null, null); + break; + case "scripted_metric": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation)value.Variant, null, null); + break; + case "serial_diff": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation)value.Variant, null, null); + break; + case "significant_terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation)value.Variant, null, null); + break; + case "significant_text": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation)value.Variant, null, null); + break; + case "stats": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation)value.Variant, null, null); + break; + case "stats_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation)value.Variant, null, null); + break; + case "string_stats": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation)value.Variant, null, null); + break; + case "sum": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SumAggregation)value.Variant, null, null); + break; + case "sum_bucket": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, null, null); + break; + case "time_series": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation)value.Variant, null, null); + break; + case "top_hits": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation)value.Variant, null, null); + break; + case "top_metrics": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation)value.Variant, null, null); + break; + case "t_test": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation)value.Variant, null, null); + break; + case "value_count": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation)value.Variant, null, null); + break; + case "variable_width_histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation)value.Variant, null, null); + break; + case "weighted_avg": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.Aggregation)}'."); } + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); writer.WriteEndObject(); } } -public sealed partial class AggregationDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AggregationConverter))] +public sealed partial class Aggregation { - internal AggregationDescriptor(Action> configure) => configure.Invoke(this); - - public AggregationDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Aggregation() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private AggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public Aggregation() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private AggregationDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - private IDictionary> AggregationsValue { get; set; } - private IDictionary? MetaValue { get; set; } + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation? AdjacencyMatrix { get => GetVariant("adjacency_matrix"); set => SetVariant("adjacency_matrix", value); } /// /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. /// /// - public AggregationDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) - { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; - } - - public AggregationDescriptor Meta(Func, FluentDictionary> selector) - { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; - } - - public AggregationDescriptor AdjacencyMatrix(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation adjacencyMatrixAggregation) => Set(adjacencyMatrixAggregation, "adjacency_matrix"); - public AggregationDescriptor AdjacencyMatrix(Action> configure) => Set(configure, "adjacency_matrix"); - public AggregationDescriptor AutoDateHistogram(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation autoDateHistogramAggregation) => Set(autoDateHistogramAggregation, "auto_date_histogram"); - public AggregationDescriptor AutoDateHistogram(Action> configure) => Set(configure, "auto_date_histogram"); - public AggregationDescriptor Avg(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation averageAggregation) => Set(averageAggregation, "avg"); - public AggregationDescriptor Avg(Action> configure) => Set(configure, "avg"); - public AggregationDescriptor AvgBucket(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation averageBucketAggregation) => Set(averageBucketAggregation, "avg_bucket"); - public AggregationDescriptor AvgBucket(Action configure) => Set(configure, "avg_bucket"); - public AggregationDescriptor Boxplot(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation boxplotAggregation) => Set(boxplotAggregation, "boxplot"); - public AggregationDescriptor Boxplot(Action> configure) => Set(configure, "boxplot"); - public AggregationDescriptor BucketCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation bucketCorrelationAggregation) => Set(bucketCorrelationAggregation, "bucket_correlation"); - public AggregationDescriptor BucketCorrelation(Action configure) => Set(configure, "bucket_correlation"); - public AggregationDescriptor BucketCountKsTest(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation bucketKsAggregation) => Set(bucketKsAggregation, "bucket_count_ks_test"); - public AggregationDescriptor BucketCountKsTest(Action configure) => Set(configure, "bucket_count_ks_test"); - public AggregationDescriptor BucketScript(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation bucketScriptAggregation) => Set(bucketScriptAggregation, "bucket_script"); - public AggregationDescriptor BucketScript(Action configure) => Set(configure, "bucket_script"); - public AggregationDescriptor BucketSelector(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation bucketSelectorAggregation) => Set(bucketSelectorAggregation, "bucket_selector"); - public AggregationDescriptor BucketSelector(Action configure) => Set(configure, "bucket_selector"); - public AggregationDescriptor BucketSort(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation bucketSortAggregation) => Set(bucketSortAggregation, "bucket_sort"); - public AggregationDescriptor BucketSort(Action> configure) => Set(configure, "bucket_sort"); - public AggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); - public AggregationDescriptor Cardinality(Action> configure) => Set(configure, "cardinality"); - public AggregationDescriptor CategorizeText(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation categorizeTextAggregation) => Set(categorizeTextAggregation, "categorize_text"); - public AggregationDescriptor CategorizeText(Action> configure) => Set(configure, "categorize_text"); - public AggregationDescriptor Children(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation childrenAggregation) => Set(childrenAggregation, "children"); - public AggregationDescriptor Children(Action configure) => Set(configure, "children"); - public AggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); - public AggregationDescriptor Composite(Action> configure) => Set(configure, "composite"); - public AggregationDescriptor CumulativeCardinality(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation cumulativeCardinalityAggregation) => Set(cumulativeCardinalityAggregation, "cumulative_cardinality"); - public AggregationDescriptor CumulativeCardinality(Action configure) => Set(configure, "cumulative_cardinality"); - public AggregationDescriptor CumulativeSum(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation cumulativeSumAggregation) => Set(cumulativeSumAggregation, "cumulative_sum"); - public AggregationDescriptor CumulativeSum(Action configure) => Set(configure, "cumulative_sum"); - public AggregationDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); - public AggregationDescriptor DateHistogram(Action> configure) => Set(configure, "date_histogram"); - public AggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); - public AggregationDescriptor DateRange(Action> configure) => Set(configure, "date_range"); - public AggregationDescriptor Derivative(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation derivativeAggregation) => Set(derivativeAggregation, "derivative"); - public AggregationDescriptor Derivative(Action configure) => Set(configure, "derivative"); - public AggregationDescriptor DiversifiedSampler(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation diversifiedSamplerAggregation) => Set(diversifiedSamplerAggregation, "diversified_sampler"); - public AggregationDescriptor DiversifiedSampler(Action> configure) => Set(configure, "diversified_sampler"); - public AggregationDescriptor ExtendedStats(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation extendedStatsAggregation) => Set(extendedStatsAggregation, "extended_stats"); - public AggregationDescriptor ExtendedStats(Action> configure) => Set(configure, "extended_stats"); - public AggregationDescriptor ExtendedStatsBucket(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation extendedStatsBucketAggregation) => Set(extendedStatsBucketAggregation, "extended_stats_bucket"); - public AggregationDescriptor ExtendedStatsBucket(Action configure) => Set(configure, "extended_stats_bucket"); - public AggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query queryContainer) => Set(queryContainer, "filter"); - public AggregationDescriptor Filter(Action> configure) => Set(configure, "filter"); - public AggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation filtersAggregation) => Set(filtersAggregation, "filters"); - public AggregationDescriptor Filters(Action> configure) => Set(configure, "filters"); - public AggregationDescriptor FrequentItemSets(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation frequentItemSetsAggregation) => Set(frequentItemSetsAggregation, "frequent_item_sets"); - public AggregationDescriptor FrequentItemSets(Action> configure) => Set(configure, "frequent_item_sets"); - public AggregationDescriptor GeoBounds(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation geoBoundsAggregation) => Set(geoBoundsAggregation, "geo_bounds"); - public AggregationDescriptor GeoBounds(Action> configure) => Set(configure, "geo_bounds"); - public AggregationDescriptor GeoCentroid(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation geoCentroidAggregation) => Set(geoCentroidAggregation, "geo_centroid"); - public AggregationDescriptor GeoCentroid(Action> configure) => Set(configure, "geo_centroid"); - public AggregationDescriptor GeoDistance(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation geoDistanceAggregation) => Set(geoDistanceAggregation, "geo_distance"); - public AggregationDescriptor GeoDistance(Action> configure) => Set(configure, "geo_distance"); - public AggregationDescriptor GeohashGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation geohashGridAggregation) => Set(geohashGridAggregation, "geohash_grid"); - public AggregationDescriptor GeohashGrid(Action> configure) => Set(configure, "geohash_grid"); - public AggregationDescriptor GeohexGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation geohexGridAggregation) => Set(geohexGridAggregation, "geohex_grid"); - public AggregationDescriptor GeohexGrid(Action> configure) => Set(configure, "geohex_grid"); - public AggregationDescriptor GeoLine(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => Set(geoLineAggregation, "geo_line"); - public AggregationDescriptor GeoLine(Action> configure) => Set(configure, "geo_line"); - public AggregationDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); - public AggregationDescriptor GeotileGrid(Action> configure) => Set(configure, "geotile_grid"); - public AggregationDescriptor Global(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation globalAggregation) => Set(globalAggregation, "global"); - public AggregationDescriptor Global(Action configure) => Set(configure, "global"); - public AggregationDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); - public AggregationDescriptor Histogram(Action> configure) => Set(configure, "histogram"); - public AggregationDescriptor Inference(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation inferenceAggregation) => Set(inferenceAggregation, "inference"); - public AggregationDescriptor Inference(Action> configure) => Set(configure, "inference"); - public AggregationDescriptor IpPrefix(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation ipPrefixAggregation) => Set(ipPrefixAggregation, "ip_prefix"); - public AggregationDescriptor IpPrefix(Action> configure) => Set(configure, "ip_prefix"); - public AggregationDescriptor IpRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation ipRangeAggregation) => Set(ipRangeAggregation, "ip_range"); - public AggregationDescriptor IpRange(Action> configure) => Set(configure, "ip_range"); - public AggregationDescriptor Line(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => Set(geoLineAggregation, "line"); - public AggregationDescriptor Line(Action> configure) => Set(configure, "line"); - public AggregationDescriptor MatrixStats(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation matrixStatsAggregation) => Set(matrixStatsAggregation, "matrix_stats"); - public AggregationDescriptor MatrixStats(Action> configure) => Set(configure, "matrix_stats"); - public AggregationDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation maxAggregation) => Set(maxAggregation, "max"); - public AggregationDescriptor Max(Action> configure) => Set(configure, "max"); - public AggregationDescriptor MaxBucket(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation maxBucketAggregation) => Set(maxBucketAggregation, "max_bucket"); - public AggregationDescriptor MaxBucket(Action configure) => Set(configure, "max_bucket"); - public AggregationDescriptor MedianAbsoluteDeviation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation medianAbsoluteDeviationAggregation) => Set(medianAbsoluteDeviationAggregation, "median_absolute_deviation"); - public AggregationDescriptor MedianAbsoluteDeviation(Action> configure) => Set(configure, "median_absolute_deviation"); - public AggregationDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation minAggregation) => Set(minAggregation, "min"); - public AggregationDescriptor Min(Action> configure) => Set(configure, "min"); - public AggregationDescriptor MinBucket(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation minBucketAggregation) => Set(minBucketAggregation, "min_bucket"); - public AggregationDescriptor MinBucket(Action configure) => Set(configure, "min_bucket"); - public AggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); - public AggregationDescriptor Missing(Action> configure) => Set(configure, "missing"); - public AggregationDescriptor MovingFn(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation movingFunctionAggregation) => Set(movingFunctionAggregation, "moving_fn"); - public AggregationDescriptor MovingFn(Action configure) => Set(configure, "moving_fn"); - public AggregationDescriptor MovingPercentiles(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation movingPercentilesAggregation) => Set(movingPercentilesAggregation, "moving_percentiles"); - public AggregationDescriptor MovingPercentiles(Action configure) => Set(configure, "moving_percentiles"); - public AggregationDescriptor MultiTerms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation multiTermsAggregation) => Set(multiTermsAggregation, "multi_terms"); - public AggregationDescriptor MultiTerms(Action> configure) => Set(configure, "multi_terms"); - public AggregationDescriptor Nested(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation nestedAggregation) => Set(nestedAggregation, "nested"); - public AggregationDescriptor Nested(Action> configure) => Set(configure, "nested"); - public AggregationDescriptor Normalize(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation normalizeAggregation) => Set(normalizeAggregation, "normalize"); - public AggregationDescriptor Normalize(Action configure) => Set(configure, "normalize"); - public AggregationDescriptor Parent(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation parentAggregation) => Set(parentAggregation, "parent"); - public AggregationDescriptor Parent(Action configure) => Set(configure, "parent"); - public AggregationDescriptor PercentileRanks(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation percentileRanksAggregation) => Set(percentileRanksAggregation, "percentile_ranks"); - public AggregationDescriptor PercentileRanks(Action> configure) => Set(configure, "percentile_ranks"); - public AggregationDescriptor Percentiles(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation percentilesAggregation) => Set(percentilesAggregation, "percentiles"); - public AggregationDescriptor Percentiles(Action> configure) => Set(configure, "percentiles"); - public AggregationDescriptor PercentilesBucket(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation percentilesBucketAggregation) => Set(percentilesBucketAggregation, "percentiles_bucket"); - public AggregationDescriptor PercentilesBucket(Action configure) => Set(configure, "percentiles_bucket"); - public AggregationDescriptor RandomSampler(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation randomSamplerAggregation) => Set(randomSamplerAggregation, "random_sampler"); - public AggregationDescriptor RandomSampler(Action configure) => Set(configure, "random_sampler"); - public AggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); - public AggregationDescriptor Range(Action> configure) => Set(configure, "range"); - public AggregationDescriptor RareTerms(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation rareTermsAggregation) => Set(rareTermsAggregation, "rare_terms"); - public AggregationDescriptor RareTerms(Action> configure) => Set(configure, "rare_terms"); - public AggregationDescriptor Rate(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation rateAggregation) => Set(rateAggregation, "rate"); - public AggregationDescriptor Rate(Action> configure) => Set(configure, "rate"); - public AggregationDescriptor ReverseNested(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation reverseNestedAggregation) => Set(reverseNestedAggregation, "reverse_nested"); - public AggregationDescriptor ReverseNested(Action> configure) => Set(configure, "reverse_nested"); - public AggregationDescriptor Sampler(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation samplerAggregation) => Set(samplerAggregation, "sampler"); - public AggregationDescriptor Sampler(Action configure) => Set(configure, "sampler"); - public AggregationDescriptor ScriptedMetric(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation scriptedMetricAggregation) => Set(scriptedMetricAggregation, "scripted_metric"); - public AggregationDescriptor ScriptedMetric(Action> configure) => Set(configure, "scripted_metric"); - public AggregationDescriptor SerialDiff(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation serialDifferencingAggregation) => Set(serialDifferencingAggregation, "serial_diff"); - public AggregationDescriptor SerialDiff(Action configure) => Set(configure, "serial_diff"); - public AggregationDescriptor SignificantTerms(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation significantTermsAggregation) => Set(significantTermsAggregation, "significant_terms"); - public AggregationDescriptor SignificantTerms(Action> configure) => Set(configure, "significant_terms"); - public AggregationDescriptor SignificantText(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation significantTextAggregation) => Set(significantTextAggregation, "significant_text"); - public AggregationDescriptor SignificantText(Action> configure) => Set(configure, "significant_text"); - public AggregationDescriptor Stats(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation statsAggregation) => Set(statsAggregation, "stats"); - public AggregationDescriptor Stats(Action> configure) => Set(configure, "stats"); - public AggregationDescriptor StatsBucket(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation statsBucketAggregation) => Set(statsBucketAggregation, "stats_bucket"); - public AggregationDescriptor StatsBucket(Action configure) => Set(configure, "stats_bucket"); - public AggregationDescriptor StringStats(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation stringStatsAggregation) => Set(stringStatsAggregation, "string_stats"); - public AggregationDescriptor StringStats(Action> configure) => Set(configure, "string_stats"); - public AggregationDescriptor Sum(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation sumAggregation) => Set(sumAggregation, "sum"); - public AggregationDescriptor Sum(Action> configure) => Set(configure, "sum"); - public AggregationDescriptor SumBucket(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation sumBucketAggregation) => Set(sumBucketAggregation, "sum_bucket"); - public AggregationDescriptor SumBucket(Action configure) => Set(configure, "sum_bucket"); - public AggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public AggregationDescriptor Terms(Action> configure) => Set(configure, "terms"); - public AggregationDescriptor TimeSeries(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation timeSeriesAggregation) => Set(timeSeriesAggregation, "time_series"); - public AggregationDescriptor TimeSeries(Action configure) => Set(configure, "time_series"); - public AggregationDescriptor TopHits(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation topHitsAggregation) => Set(topHitsAggregation, "top_hits"); - public AggregationDescriptor TopHits(Action> configure) => Set(configure, "top_hits"); - public AggregationDescriptor TopMetrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation topMetricsAggregation) => Set(topMetricsAggregation, "top_metrics"); - public AggregationDescriptor TopMetrics(Action> configure) => Set(configure, "top_metrics"); - public AggregationDescriptor TTest(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation tTestAggregation) => Set(tTestAggregation, "t_test"); - public AggregationDescriptor TTest(Action> configure) => Set(configure, "t_test"); - public AggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); - public AggregationDescriptor ValueCount(Action> configure) => Set(configure, "value_count"); - public AggregationDescriptor VariableWidthHistogram(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation variableWidthHistogramAggregation) => Set(variableWidthHistogramAggregation, "variable_width_histogram"); - public AggregationDescriptor VariableWidthHistogram(Action> configure) => Set(configure, "variable_width_histogram"); - public AggregationDescriptor WeightedAvg(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation weightedAverageAggregation) => Set(weightedAverageAggregation, "weighted_avg"); - public AggregationDescriptor WeightedAvg(Action> configure) => Set(configure, "weighted_avg"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation? AutoDateHistogram { get => GetVariant("auto_date_histogram"); set => SetVariant("auto_date_histogram", value); } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation? Avg { get => GetVariant("avg"); set => SetVariant("avg", value); } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation? AvgBucket { get => GetVariant("avg_bucket"); set => SetVariant("avg_bucket", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation? Boxplot { get => GetVariant("boxplot"); set => SetVariant("boxplot", value); } - writer.WriteEndObject(); - } -} + /// + /// + /// A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation? BucketCorrelation { get => GetVariant("bucket_correlation"); set => SetVariant("bucket_correlation", value); } -public sealed partial class AggregationDescriptor : SerializableDescriptor -{ - internal AggregationDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation? BucketCountKsTest { get => GetVariant("bucket_count_ks_test"); set => SetVariant("bucket_count_ks_test", value); } - public AggregationDescriptor() : base() - { - } + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation? BucketScript { get => GetVariant("bucket_script"); set => SetVariant("bucket_script", value); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation? BucketSelector { get => GetVariant("bucket_selector"); set => SetVariant("bucket_selector", value); } - private AggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation? BucketSort { get => GetVariant("bucket_sort"); set => SetVariant("bucket_sort", value); } - private AggregationDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? Cardinality { get => GetVariant("cardinality"); set => SetVariant("cardinality", value); } - private IDictionary AggregationsValue { get; set; } - private IDictionary? MetaValue { get; set; } + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation? CategorizeText { get => GetVariant("categorize_text"); set => SetVariant("categorize_text", value); } /// /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. /// /// - public AggregationDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) - { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; - } - - public AggregationDescriptor Meta(Func, FluentDictionary> selector) - { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; - } - - public AggregationDescriptor AdjacencyMatrix(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation adjacencyMatrixAggregation) => Set(adjacencyMatrixAggregation, "adjacency_matrix"); - public AggregationDescriptor AdjacencyMatrix(Action configure) => Set(configure, "adjacency_matrix"); - public AggregationDescriptor AutoDateHistogram(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation autoDateHistogramAggregation) => Set(autoDateHistogramAggregation, "auto_date_histogram"); - public AggregationDescriptor AutoDateHistogram(Action configure) => Set(configure, "auto_date_histogram"); - public AggregationDescriptor Avg(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation averageAggregation) => Set(averageAggregation, "avg"); - public AggregationDescriptor Avg(Action configure) => Set(configure, "avg"); - public AggregationDescriptor AvgBucket(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation averageBucketAggregation) => Set(averageBucketAggregation, "avg_bucket"); - public AggregationDescriptor AvgBucket(Action configure) => Set(configure, "avg_bucket"); - public AggregationDescriptor Boxplot(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation boxplotAggregation) => Set(boxplotAggregation, "boxplot"); - public AggregationDescriptor Boxplot(Action configure) => Set(configure, "boxplot"); - public AggregationDescriptor BucketCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation bucketCorrelationAggregation) => Set(bucketCorrelationAggregation, "bucket_correlation"); - public AggregationDescriptor BucketCorrelation(Action configure) => Set(configure, "bucket_correlation"); - public AggregationDescriptor BucketCountKsTest(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation bucketKsAggregation) => Set(bucketKsAggregation, "bucket_count_ks_test"); - public AggregationDescriptor BucketCountKsTest(Action configure) => Set(configure, "bucket_count_ks_test"); - public AggregationDescriptor BucketScript(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation bucketScriptAggregation) => Set(bucketScriptAggregation, "bucket_script"); - public AggregationDescriptor BucketScript(Action configure) => Set(configure, "bucket_script"); - public AggregationDescriptor BucketSelector(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation bucketSelectorAggregation) => Set(bucketSelectorAggregation, "bucket_selector"); - public AggregationDescriptor BucketSelector(Action configure) => Set(configure, "bucket_selector"); - public AggregationDescriptor BucketSort(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation bucketSortAggregation) => Set(bucketSortAggregation, "bucket_sort"); - public AggregationDescriptor BucketSort(Action configure) => Set(configure, "bucket_sort"); - public AggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); - public AggregationDescriptor Cardinality(Action configure) => Set(configure, "cardinality"); - public AggregationDescriptor CategorizeText(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation categorizeTextAggregation) => Set(categorizeTextAggregation, "categorize_text"); - public AggregationDescriptor CategorizeText(Action configure) => Set(configure, "categorize_text"); - public AggregationDescriptor Children(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation childrenAggregation) => Set(childrenAggregation, "children"); - public AggregationDescriptor Children(Action configure) => Set(configure, "children"); - public AggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); - public AggregationDescriptor Composite(Action configure) => Set(configure, "composite"); - public AggregationDescriptor CumulativeCardinality(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation cumulativeCardinalityAggregation) => Set(cumulativeCardinalityAggregation, "cumulative_cardinality"); - public AggregationDescriptor CumulativeCardinality(Action configure) => Set(configure, "cumulative_cardinality"); - public AggregationDescriptor CumulativeSum(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation cumulativeSumAggregation) => Set(cumulativeSumAggregation, "cumulative_sum"); - public AggregationDescriptor CumulativeSum(Action configure) => Set(configure, "cumulative_sum"); - public AggregationDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); - public AggregationDescriptor DateHistogram(Action configure) => Set(configure, "date_histogram"); - public AggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); - public AggregationDescriptor DateRange(Action configure) => Set(configure, "date_range"); - public AggregationDescriptor Derivative(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation derivativeAggregation) => Set(derivativeAggregation, "derivative"); - public AggregationDescriptor Derivative(Action configure) => Set(configure, "derivative"); - public AggregationDescriptor DiversifiedSampler(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation diversifiedSamplerAggregation) => Set(diversifiedSamplerAggregation, "diversified_sampler"); - public AggregationDescriptor DiversifiedSampler(Action configure) => Set(configure, "diversified_sampler"); - public AggregationDescriptor ExtendedStats(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation extendedStatsAggregation) => Set(extendedStatsAggregation, "extended_stats"); - public AggregationDescriptor ExtendedStats(Action configure) => Set(configure, "extended_stats"); - public AggregationDescriptor ExtendedStatsBucket(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation extendedStatsBucketAggregation) => Set(extendedStatsBucketAggregation, "extended_stats_bucket"); - public AggregationDescriptor ExtendedStatsBucket(Action configure) => Set(configure, "extended_stats_bucket"); - public AggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query queryContainer) => Set(queryContainer, "filter"); - public AggregationDescriptor Filter(Action configure) => Set(configure, "filter"); - public AggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation filtersAggregation) => Set(filtersAggregation, "filters"); - public AggregationDescriptor Filters(Action configure) => Set(configure, "filters"); - public AggregationDescriptor FrequentItemSets(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation frequentItemSetsAggregation) => Set(frequentItemSetsAggregation, "frequent_item_sets"); - public AggregationDescriptor FrequentItemSets(Action configure) => Set(configure, "frequent_item_sets"); - public AggregationDescriptor GeoBounds(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation geoBoundsAggregation) => Set(geoBoundsAggregation, "geo_bounds"); - public AggregationDescriptor GeoBounds(Action configure) => Set(configure, "geo_bounds"); - public AggregationDescriptor GeoCentroid(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation geoCentroidAggregation) => Set(geoCentroidAggregation, "geo_centroid"); - public AggregationDescriptor GeoCentroid(Action configure) => Set(configure, "geo_centroid"); - public AggregationDescriptor GeoDistance(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation geoDistanceAggregation) => Set(geoDistanceAggregation, "geo_distance"); - public AggregationDescriptor GeoDistance(Action configure) => Set(configure, "geo_distance"); - public AggregationDescriptor GeohashGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation geohashGridAggregation) => Set(geohashGridAggregation, "geohash_grid"); - public AggregationDescriptor GeohashGrid(Action configure) => Set(configure, "geohash_grid"); - public AggregationDescriptor GeohexGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation geohexGridAggregation) => Set(geohexGridAggregation, "geohex_grid"); - public AggregationDescriptor GeohexGrid(Action configure) => Set(configure, "geohex_grid"); - public AggregationDescriptor GeoLine(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => Set(geoLineAggregation, "geo_line"); - public AggregationDescriptor GeoLine(Action configure) => Set(configure, "geo_line"); - public AggregationDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); - public AggregationDescriptor GeotileGrid(Action configure) => Set(configure, "geotile_grid"); - public AggregationDescriptor Global(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation globalAggregation) => Set(globalAggregation, "global"); - public AggregationDescriptor Global(Action configure) => Set(configure, "global"); - public AggregationDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); - public AggregationDescriptor Histogram(Action configure) => Set(configure, "histogram"); - public AggregationDescriptor Inference(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation inferenceAggregation) => Set(inferenceAggregation, "inference"); - public AggregationDescriptor Inference(Action configure) => Set(configure, "inference"); - public AggregationDescriptor IpPrefix(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation ipPrefixAggregation) => Set(ipPrefixAggregation, "ip_prefix"); - public AggregationDescriptor IpPrefix(Action configure) => Set(configure, "ip_prefix"); - public AggregationDescriptor IpRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation ipRangeAggregation) => Set(ipRangeAggregation, "ip_range"); - public AggregationDescriptor IpRange(Action configure) => Set(configure, "ip_range"); - public AggregationDescriptor Line(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation geoLineAggregation) => Set(geoLineAggregation, "line"); - public AggregationDescriptor Line(Action configure) => Set(configure, "line"); - public AggregationDescriptor MatrixStats(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation matrixStatsAggregation) => Set(matrixStatsAggregation, "matrix_stats"); - public AggregationDescriptor MatrixStats(Action configure) => Set(configure, "matrix_stats"); - public AggregationDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation maxAggregation) => Set(maxAggregation, "max"); - public AggregationDescriptor Max(Action configure) => Set(configure, "max"); - public AggregationDescriptor MaxBucket(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation maxBucketAggregation) => Set(maxBucketAggregation, "max_bucket"); - public AggregationDescriptor MaxBucket(Action configure) => Set(configure, "max_bucket"); - public AggregationDescriptor MedianAbsoluteDeviation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation medianAbsoluteDeviationAggregation) => Set(medianAbsoluteDeviationAggregation, "median_absolute_deviation"); - public AggregationDescriptor MedianAbsoluteDeviation(Action configure) => Set(configure, "median_absolute_deviation"); - public AggregationDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation minAggregation) => Set(minAggregation, "min"); - public AggregationDescriptor Min(Action configure) => Set(configure, "min"); - public AggregationDescriptor MinBucket(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation minBucketAggregation) => Set(minBucketAggregation, "min_bucket"); - public AggregationDescriptor MinBucket(Action configure) => Set(configure, "min_bucket"); - public AggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); - public AggregationDescriptor Missing(Action configure) => Set(configure, "missing"); - public AggregationDescriptor MovingFn(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation movingFunctionAggregation) => Set(movingFunctionAggregation, "moving_fn"); - public AggregationDescriptor MovingFn(Action configure) => Set(configure, "moving_fn"); - public AggregationDescriptor MovingPercentiles(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation movingPercentilesAggregation) => Set(movingPercentilesAggregation, "moving_percentiles"); - public AggregationDescriptor MovingPercentiles(Action configure) => Set(configure, "moving_percentiles"); - public AggregationDescriptor MultiTerms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation multiTermsAggregation) => Set(multiTermsAggregation, "multi_terms"); - public AggregationDescriptor MultiTerms(Action configure) => Set(configure, "multi_terms"); - public AggregationDescriptor Nested(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation nestedAggregation) => Set(nestedAggregation, "nested"); - public AggregationDescriptor Nested(Action configure) => Set(configure, "nested"); - public AggregationDescriptor Normalize(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation normalizeAggregation) => Set(normalizeAggregation, "normalize"); - public AggregationDescriptor Normalize(Action configure) => Set(configure, "normalize"); - public AggregationDescriptor Parent(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation parentAggregation) => Set(parentAggregation, "parent"); - public AggregationDescriptor Parent(Action configure) => Set(configure, "parent"); - public AggregationDescriptor PercentileRanks(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation percentileRanksAggregation) => Set(percentileRanksAggregation, "percentile_ranks"); - public AggregationDescriptor PercentileRanks(Action configure) => Set(configure, "percentile_ranks"); - public AggregationDescriptor Percentiles(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation percentilesAggregation) => Set(percentilesAggregation, "percentiles"); - public AggregationDescriptor Percentiles(Action configure) => Set(configure, "percentiles"); - public AggregationDescriptor PercentilesBucket(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation percentilesBucketAggregation) => Set(percentilesBucketAggregation, "percentiles_bucket"); - public AggregationDescriptor PercentilesBucket(Action configure) => Set(configure, "percentiles_bucket"); - public AggregationDescriptor RandomSampler(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation randomSamplerAggregation) => Set(randomSamplerAggregation, "random_sampler"); - public AggregationDescriptor RandomSampler(Action configure) => Set(configure, "random_sampler"); - public AggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); - public AggregationDescriptor Range(Action configure) => Set(configure, "range"); - public AggregationDescriptor RareTerms(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation rareTermsAggregation) => Set(rareTermsAggregation, "rare_terms"); - public AggregationDescriptor RareTerms(Action configure) => Set(configure, "rare_terms"); - public AggregationDescriptor Rate(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation rateAggregation) => Set(rateAggregation, "rate"); - public AggregationDescriptor Rate(Action configure) => Set(configure, "rate"); - public AggregationDescriptor ReverseNested(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation reverseNestedAggregation) => Set(reverseNestedAggregation, "reverse_nested"); - public AggregationDescriptor ReverseNested(Action configure) => Set(configure, "reverse_nested"); - public AggregationDescriptor Sampler(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation samplerAggregation) => Set(samplerAggregation, "sampler"); - public AggregationDescriptor Sampler(Action configure) => Set(configure, "sampler"); - public AggregationDescriptor ScriptedMetric(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation scriptedMetricAggregation) => Set(scriptedMetricAggregation, "scripted_metric"); - public AggregationDescriptor ScriptedMetric(Action configure) => Set(configure, "scripted_metric"); - public AggregationDescriptor SerialDiff(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation serialDifferencingAggregation) => Set(serialDifferencingAggregation, "serial_diff"); - public AggregationDescriptor SerialDiff(Action configure) => Set(configure, "serial_diff"); - public AggregationDescriptor SignificantTerms(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation significantTermsAggregation) => Set(significantTermsAggregation, "significant_terms"); - public AggregationDescriptor SignificantTerms(Action configure) => Set(configure, "significant_terms"); - public AggregationDescriptor SignificantText(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation significantTextAggregation) => Set(significantTextAggregation, "significant_text"); - public AggregationDescriptor SignificantText(Action configure) => Set(configure, "significant_text"); - public AggregationDescriptor Stats(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation statsAggregation) => Set(statsAggregation, "stats"); - public AggregationDescriptor Stats(Action configure) => Set(configure, "stats"); - public AggregationDescriptor StatsBucket(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation statsBucketAggregation) => Set(statsBucketAggregation, "stats_bucket"); - public AggregationDescriptor StatsBucket(Action configure) => Set(configure, "stats_bucket"); - public AggregationDescriptor StringStats(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation stringStatsAggregation) => Set(stringStatsAggregation, "string_stats"); - public AggregationDescriptor StringStats(Action configure) => Set(configure, "string_stats"); - public AggregationDescriptor Sum(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation sumAggregation) => Set(sumAggregation, "sum"); - public AggregationDescriptor Sum(Action configure) => Set(configure, "sum"); - public AggregationDescriptor SumBucket(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation sumBucketAggregation) => Set(sumBucketAggregation, "sum_bucket"); - public AggregationDescriptor SumBucket(Action configure) => Set(configure, "sum_bucket"); - public AggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public AggregationDescriptor Terms(Action configure) => Set(configure, "terms"); - public AggregationDescriptor TimeSeries(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation timeSeriesAggregation) => Set(timeSeriesAggregation, "time_series"); - public AggregationDescriptor TimeSeries(Action configure) => Set(configure, "time_series"); - public AggregationDescriptor TopHits(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation topHitsAggregation) => Set(topHitsAggregation, "top_hits"); - public AggregationDescriptor TopHits(Action configure) => Set(configure, "top_hits"); - public AggregationDescriptor TopMetrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation topMetricsAggregation) => Set(topMetricsAggregation, "top_metrics"); - public AggregationDescriptor TopMetrics(Action configure) => Set(configure, "top_metrics"); - public AggregationDescriptor TTest(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation tTestAggregation) => Set(tTestAggregation, "t_test"); - public AggregationDescriptor TTest(Action configure) => Set(configure, "t_test"); - public AggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); - public AggregationDescriptor ValueCount(Action configure) => Set(configure, "value_count"); - public AggregationDescriptor VariableWidthHistogram(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation variableWidthHistogramAggregation) => Set(variableWidthHistogramAggregation, "variable_width_histogram"); - public AggregationDescriptor VariableWidthHistogram(Action configure) => Set(configure, "variable_width_histogram"); - public AggregationDescriptor WeightedAvg(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation weightedAverageAggregation) => Set(weightedAverageAggregation, "weighted_avg"); - public AggregationDescriptor WeightedAvg(Action configure) => Set(configure, "weighted_avg"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation? Children { get => GetVariant("children"); set => SetVariant("children", value); } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? Composite { get => GetVariant("composite"); set => SetVariant("composite", value); } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation? CumulativeCardinality { get => GetVariant("cumulative_cardinality"); set => SetVariant("cumulative_cardinality", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation? CumulativeSum { get => GetVariant("cumulative_sum"); set => SetVariant("cumulative_sum", value); } - writer.WriteEndObject(); + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? DateHistogram { get => GetVariant("date_histogram"); set => SetVariant("date_histogram", value); } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? DateRange { get => GetVariant("date_range"); set => SetVariant("date_range", value); } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation? Derivative { get => GetVariant("derivative"); set => SetVariant("derivative", value); } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation? DiversifiedSampler { get => GetVariant("diversified_sampler"); set => SetVariant("diversified_sampler", value); } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation? ExtendedStats { get => GetVariant("extended_stats"); set => SetVariant("extended_stats", value); } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation? ExtendedStatsBucket { get => GetVariant("extended_stats_bucket"); set => SetVariant("extended_stats_bucket", value); } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get => GetVariant("filter"); set => SetVariant("filter", value); } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation? Filters { get => GetVariant("filters"); set => SetVariant("filters", value); } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation? FrequentItemSets { get => GetVariant("frequent_item_sets"); set => SetVariant("frequent_item_sets", value); } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation? GeoBounds { get => GetVariant("geo_bounds"); set => SetVariant("geo_bounds", value); } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation? GeoCentroid { get => GetVariant("geo_centroid"); set => SetVariant("geo_centroid", value); } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation? GeoDistance { get => GetVariant("geo_distance"); set => SetVariant("geo_distance", value); } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation? GeohashGrid { get => GetVariant("geohash_grid"); set => SetVariant("geohash_grid", value); } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation? GeohexGrid { get => GetVariant("geohex_grid"); set => SetVariant("geohex_grid", value); } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? GeoLine { get => GetVariant("geo_line"); set => SetVariant("geo_line", value); } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? GeotileGrid { get => GetVariant("geotile_grid"); set => SetVariant("geotile_grid", value); } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation? Global { get => GetVariant("global"); set => SetVariant("global", value); } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? Histogram { get => GetVariant("histogram"); set => SetVariant("histogram", value); } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation? Inference { get => GetVariant("inference"); set => SetVariant("inference", value); } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation? IpPrefix { get => GetVariant("ip_prefix"); set => SetVariant("ip_prefix", value); } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation? IpRange { get => GetVariant("ip_range"); set => SetVariant("ip_range", value); } + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? Line { get => GetVariant("line"); set => SetVariant("line", value); } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation? MatrixStats { get => GetVariant("matrix_stats"); set => SetVariant("matrix_stats", value); } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation? Max { get => GetVariant("max"); set => SetVariant("max", value); } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation? MaxBucket { get => GetVariant("max_bucket"); set => SetVariant("max_bucket", value); } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation? MedianAbsoluteDeviation { get => GetVariant("median_absolute_deviation"); set => SetVariant("median_absolute_deviation", value); } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregation? Min { get => GetVariant("min"); set => SetVariant("min", value); } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation? MinBucket { get => GetVariant("min_bucket"); set => SetVariant("min_bucket", value); } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? Missing { get => GetVariant("missing"); set => SetVariant("missing", value); } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation? MovingFn { get => GetVariant("moving_fn"); set => SetVariant("moving_fn", value); } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation? MovingPercentiles { get => GetVariant("moving_percentiles"); set => SetVariant("moving_percentiles", value); } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation? MultiTerms { get => GetVariant("multi_terms"); set => SetVariant("multi_terms", value); } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation? Nested { get => GetVariant("nested"); set => SetVariant("nested", value); } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation? Normalize { get => GetVariant("normalize"); set => SetVariant("normalize", value); } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation? Parent { get => GetVariant("parent"); set => SetVariant("parent", value); } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation? PercentileRanks { get => GetVariant("percentile_ranks"); set => SetVariant("percentile_ranks", value); } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation? Percentiles { get => GetVariant("percentiles"); set => SetVariant("percentiles", value); } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation? PercentilesBucket { get => GetVariant("percentiles_bucket"); set => SetVariant("percentiles_bucket", value); } + + /// + /// + /// A single bucket aggregation that randomly includes documents in the aggregated results. + /// Sampling provides significant speed improvement at the cost of accuracy. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation? RandomSampler { get => GetVariant("random_sampler"); set => SetVariant("random_sampler", value); } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation? RareTerms { get => GetVariant("rare_terms"); set => SetVariant("rare_terms", value); } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregation? Rate { get => GetVariant("rate"); set => SetVariant("rate", value); } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation? ReverseNested { get => GetVariant("reverse_nested"); set => SetVariant("reverse_nested", value); } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation? Sampler { get => GetVariant("sampler"); set => SetVariant("sampler", value); } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation? ScriptedMetric { get => GetVariant("scripted_metric"); set => SetVariant("scripted_metric", value); } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation? SerialDiff { get => GetVariant("serial_diff"); set => SetVariant("serial_diff", value); } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation? SignificantTerms { get => GetVariant("significant_terms"); set => SetVariant("significant_terms", value); } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation? SignificantText { get => GetVariant("significant_text"); set => SetVariant("significant_text", value); } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation? Stats { get => GetVariant("stats"); set => SetVariant("stats", value); } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation? StatsBucket { get => GetVariant("stats_bucket"); set => SetVariant("stats_bucket", value); } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation? StringStats { get => GetVariant("string_stats"); set => SetVariant("string_stats", value); } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregation? Sum { get => GetVariant("sum"); set => SetVariant("sum", value); } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation? SumBucket { get => GetVariant("sum_bucket"); set => SetVariant("sum_bucket", value); } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation? TimeSeries { get => GetVariant("time_series"); set => SetVariant("time_series", value); } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation? TopHits { get => GetVariant("top_hits"); set => SetVariant("top_hits", value); } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation? TopMetrics { get => GetVariant("top_metrics"); set => SetVariant("top_metrics", value); } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation? TTest { get => GetVariant("t_test"); set => SetVariant("t_test", value); } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? ValueCount { get => GetVariant("value_count"); set => SetVariant("value_count", value); } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation? VariableWidthHistogram { get => GetVariant("variable_width_histogram"); set => SetVariant("variable_width_histogram", value); } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation? WeightedAvg { get => GetVariant("weighted_avg"); set => SetVariant("weighted_avg", value); } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public System.Collections.Generic.IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { AdjacencyMatrix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { AutoDateHistogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Avg = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { AvgBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Boxplot = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { BucketCorrelation = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { BucketCountKsTest = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { BucketScript = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { BucketSelector = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { BucketSort = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Cardinality = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { CategorizeText = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Children = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Composite = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { CumulativeCardinality = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { CumulativeSum = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { DateHistogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { DateRange = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Derivative = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { DiversifiedSampler = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { ExtendedStats = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { ExtendedStatsBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.QueryDsl.Query value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Filter = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Filters = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { FrequentItemSets = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeoBounds = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeoCentroid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeoDistance = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeohashGrid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeohexGrid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { GeotileGrid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Global = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Histogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Inference = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { IpPrefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { IpRange = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MatrixStats = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Max = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MaxBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MedianAbsoluteDeviation = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Min = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MinBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Missing = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MovingFn = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MovingPercentiles = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { MultiTerms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Nested = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Normalize = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Parent = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { PercentileRanks = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Percentiles = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { PercentilesBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { RandomSampler = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { RareTerms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Rate = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { ReverseNested = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Sampler = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { ScriptedMetric = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { SerialDiff = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { SignificantTerms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { SignificantText = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Stats = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { StatsBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { StringStats = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Sum = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { SumBucket = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { TimeSeries = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { TopHits = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { TopMetrics = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { TTest = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { ValueCount = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { VariableWidthHistogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation value) => new Elastic.Clients.Elasticsearch.Aggregations.Aggregation { WeightedAvg = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} + +public readonly partial struct AggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.Aggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.Aggregation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.Aggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation? value) + { + Instance.AdjacencyMatrix = value; + return this; + } + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix() + { + Instance.AdjacencyMatrix = Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix(System.Action>? action) + { + Instance.AdjacencyMatrix = Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation? value) + { + Instance.AutoDateHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram() + { + Instance.AutoDateHistogram = Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram(System.Action>? action) + { + Instance.AutoDateHistogram = Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation? value) + { + Instance.Avg = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg() + { + Instance.Avg = Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg(System.Action>? action) + { + Instance.Avg = Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation? value) + { + Instance.AvgBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket() + { + Instance.AvgBucket = Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket(System.Action? action) + { + Instance.AvgBucket = Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation? value) + { + Instance.Boxplot = value; + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot() + { + Instance.Boxplot = Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot(System.Action>? action) + { + Instance.Boxplot = Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation? value) + { + Instance.BucketCorrelation = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCorrelation(System.Action action) + { + Instance.BucketCorrelation = Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation? value) + { + Instance.BucketCountKsTest = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest() + { + Instance.BucketCountKsTest = Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest(System.Action? action) + { + Instance.BucketCountKsTest = Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation? value) + { + Instance.BucketScript = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript() + { + Instance.BucketScript = Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript(System.Action? action) + { + Instance.BucketScript = Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation? value) + { + Instance.BucketSelector = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector() + { + Instance.BucketSelector = Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector(System.Action? action) + { + Instance.BucketSelector = Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation? value) + { + Instance.BucketSort = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort() + { + Instance.BucketSort = Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort(System.Action>? action) + { + Instance.BucketSort = Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? value) + { + Instance.Cardinality = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality() + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality(System.Action>? action) + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CategorizeText(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation? value) + { + Instance.CategorizeText = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CategorizeText(System.Action> action) + { + Instance.CategorizeText = Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation? value) + { + Instance.Children = value; + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children() + { + Instance.Children = Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children(System.Action? action) + { + Instance.Children = Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? value) + { + Instance.Composite = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite() + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite(System.Action>? action) + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation? value) + { + Instance.CumulativeCardinality = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality() + { + Instance.CumulativeCardinality = Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality(System.Action? action) + { + Instance.CumulativeCardinality = Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation? value) + { + Instance.CumulativeSum = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum() + { + Instance.CumulativeSum = Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum(System.Action? action) + { + Instance.CumulativeSum = Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? value) + { + Instance.DateHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram() + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram(System.Action>? action) + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? value) + { + Instance.DateRange = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange() + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange(System.Action>? action) + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation? value) + { + Instance.Derivative = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative() + { + Instance.Derivative = Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative(System.Action? action) + { + Instance.Derivative = Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation? value) + { + Instance.DiversifiedSampler = value; + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler() + { + Instance.DiversifiedSampler = Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler(System.Action>? action) + { + Instance.DiversifiedSampler = Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation? value) + { + Instance.ExtendedStats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats() + { + Instance.ExtendedStats = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats(System.Action>? action) + { + Instance.ExtendedStats = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation? value) + { + Instance.ExtendedStatsBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket() + { + Instance.ExtendedStatsBucket = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket(System.Action? action) + { + Instance.ExtendedStatsBucket = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Filter = value; + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation? value) + { + Instance.Filters = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters() + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters(System.Action>? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor FrequentItemSets(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation? value) + { + Instance.FrequentItemSets = value; + return this; + } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor FrequentItemSets(System.Action> action) + { + Instance.FrequentItemSets = Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation? value) + { + Instance.GeoBounds = value; + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds() + { + Instance.GeoBounds = Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds(System.Action>? action) + { + Instance.GeoBounds = Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation? value) + { + Instance.GeoCentroid = value; + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid() + { + Instance.GeoCentroid = Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid(System.Action>? action) + { + Instance.GeoCentroid = Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation? value) + { + Instance.GeoDistance = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance() + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance(System.Action>? action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation? value) + { + Instance.GeohashGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid() + { + Instance.GeohashGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid(System.Action>? action) + { + Instance.GeohashGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohexGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation? value) + { + Instance.GeohexGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohexGrid(System.Action> action) + { + Instance.GeohexGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoLine(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? value) + { + Instance.GeoLine = value; + return this; + } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoLine(System.Action> action) + { + Instance.GeoLine = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? value) + { + Instance.GeotileGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid() + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid(System.Action>? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation? value) + { + Instance.Global = value; + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global() + { + Instance.Global = Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global(System.Action? action) + { + Instance.Global = Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? value) + { + Instance.Histogram = value; + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram() + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram(System.Action>? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Inference(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation? value) + { + Instance.Inference = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Inference(System.Action> action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpPrefix(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation? value) + { + Instance.IpPrefix = value; + return this; + } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpPrefix(System.Action> action) + { + Instance.IpPrefix = Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation? value) + { + Instance.IpRange = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange() + { + Instance.IpRange = Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange(System.Action>? action) + { + Instance.IpRange = Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Line(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? value) + { + Instance.Line = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Line(System.Action> action) + { + Instance.Line = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation? value) + { + Instance.MatrixStats = value; + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats() + { + Instance.MatrixStats = Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats(System.Action>? action) + { + Instance.MatrixStats = Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation? value) + { + Instance.Max = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max() + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max(System.Action>? action) + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation? value) + { + Instance.MaxBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket() + { + Instance.MaxBucket = Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket(System.Action? action) + { + Instance.MaxBucket = Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation? value) + { + Instance.MedianAbsoluteDeviation = value; + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation() + { + Instance.MedianAbsoluteDeviation = Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation(System.Action>? action) + { + Instance.MedianAbsoluteDeviation = Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation? value) + { + Instance.Min = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min() + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min(System.Action>? action) + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation? value) + { + Instance.MinBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket() + { + Instance.MinBucket = Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket(System.Action? action) + { + Instance.MinBucket = Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? value) + { + Instance.Missing = value; + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing(System.Action>? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation? value) + { + Instance.MovingFn = value; + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn() + { + Instance.MovingFn = Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn(System.Action? action) + { + Instance.MovingFn = Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation? value) + { + Instance.MovingPercentiles = value; + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles() + { + Instance.MovingPercentiles = Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles(System.Action? action) + { + Instance.MovingPercentiles = Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MultiTerms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation? value) + { + Instance.MultiTerms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MultiTerms(System.Action> action) + { + Instance.MultiTerms = Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation? value) + { + Instance.Nested = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested() + { + Instance.Nested = Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested(System.Action>? action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation? value) + { + Instance.Normalize = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize() + { + Instance.Normalize = Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize(System.Action? action) + { + Instance.Normalize = Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation? value) + { + Instance.Parent = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent() + { + Instance.Parent = Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent(System.Action? action) + { + Instance.Parent = Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation? value) + { + Instance.PercentileRanks = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks() + { + Instance.PercentileRanks = Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks(System.Action>? action) + { + Instance.PercentileRanks = Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation? value) + { + Instance.Percentiles = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles() + { + Instance.Percentiles = Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles(System.Action>? action) + { + Instance.Percentiles = Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation? value) + { + Instance.PercentilesBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket() + { + Instance.PercentilesBucket = Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket(System.Action? action) + { + Instance.PercentilesBucket = Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that randomly includes documents in the aggregated results. + /// Sampling provides significant speed improvement at the cost of accuracy. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RandomSampler(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation? value) + { + Instance.RandomSampler = value; + return this; + } + + /// + /// + /// A single bucket aggregation that randomly includes documents in the aggregated results. + /// Sampling provides significant speed improvement at the cost of accuracy. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RandomSampler(System.Action action) + { + Instance.RandomSampler = Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range() + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range(System.Action>? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation? value) + { + Instance.RareTerms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms() + { + Instance.RareTerms = Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms(System.Action>? action) + { + Instance.RareTerms = Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation? value) + { + Instance.Rate = value; + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate() + { + Instance.Rate = Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate(System.Action>? action) + { + Instance.Rate = Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation? value) + { + Instance.ReverseNested = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested() + { + Instance.ReverseNested = Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested(System.Action>? action) + { + Instance.ReverseNested = Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation? value) + { + Instance.Sampler = value; + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler() + { + Instance.Sampler = Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler(System.Action? action) + { + Instance.Sampler = Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation? value) + { + Instance.ScriptedMetric = value; + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric() + { + Instance.ScriptedMetric = Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric(System.Action>? action) + { + Instance.ScriptedMetric = Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation? value) + { + Instance.SerialDiff = value; + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff() + { + Instance.SerialDiff = Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff(System.Action? action) + { + Instance.SerialDiff = Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation? value) + { + Instance.SignificantTerms = value; + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms() + { + Instance.SignificantTerms = Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms(System.Action>? action) + { + Instance.SignificantTerms = Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation? value) + { + Instance.SignificantText = value; + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText() + { + Instance.SignificantText = Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText(System.Action>? action) + { + Instance.SignificantText = Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats() + { + Instance.Stats = Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats(System.Action>? action) + { + Instance.Stats = Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation? value) + { + Instance.StatsBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket() + { + Instance.StatsBucket = Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket(System.Action? action) + { + Instance.StatsBucket = Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation? value) + { + Instance.StringStats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats() + { + Instance.StringStats = Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats(System.Action>? action) + { + Instance.StringStats = Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation? value) + { + Instance.Sum = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum() + { + Instance.Sum = Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum(System.Action>? action) + { + Instance.Sum = Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation? value) + { + Instance.SumBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket() + { + Instance.SumBucket = Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket(System.Action? action) + { + Instance.SumBucket = Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms() + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation? value) + { + Instance.TimeSeries = value; + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries() + { + Instance.TimeSeries = Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries(System.Action? action) + { + Instance.TimeSeries = Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation? value) + { + Instance.TopHits = value; + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits() + { + Instance.TopHits = Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits(System.Action>? action) + { + Instance.TopHits = Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation? value) + { + Instance.TopMetrics = value; + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics() + { + Instance.TopMetrics = Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics(System.Action>? action) + { + Instance.TopMetrics = Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation? value) + { + Instance.TTest = value; + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest() + { + Instance.TTest = Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest(System.Action>? action) + { + Instance.TTest = Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? value) + { + Instance.ValueCount = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount() + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount(System.Action>? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation? value) + { + Instance.VariableWidthHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram() + { + Instance.VariableWidthHistogram = Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram(System.Action>? action) + { + Instance.VariableWidthHistogram = Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation? value) + { + Instance.WeightedAvg = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg() + { + Instance.WeightedAvg = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg(System.Action>? action) + { + Instance.WeightedAvg = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Aggregation Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct AggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.Aggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.Aggregation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.Aggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix(Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregation? value) + { + Instance.AdjacencyMatrix = value; + return this; + } + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix() + { + Instance.AdjacencyMatrix = Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix(System.Action? action) + { + Instance.AdjacencyMatrix = Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation returning a form of adjacency matrix. + /// The request provides a collection of named filter expressions, similar to the filters aggregation. + /// Each bucket in the response represents a non-empty cell in the matrix of intersecting filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AdjacencyMatrix(System.Action>? action) + { + Instance.AdjacencyMatrix = Elastic.Clients.Elasticsearch.Aggregations.AdjacencyMatrixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation? value) + { + Instance.AutoDateHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram() + { + Instance.AutoDateHistogram = Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram(System.Action? action) + { + Instance.AutoDateHistogram = Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AutoDateHistogram(System.Action>? action) + { + Instance.AutoDateHistogram = Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation? value) + { + Instance.Avg = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg() + { + Instance.Avg = Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg(System.Action? action) + { + Instance.Avg = Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Avg(System.Action>? action) + { + Instance.Avg = Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation? value) + { + Instance.AvgBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket() + { + Instance.AvgBucket = Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation. + /// The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AvgBucket(System.Action? action) + { + Instance.AvgBucket = Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation? value) + { + Instance.Boxplot = value; + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot() + { + Instance.Boxplot = Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot(System.Action? action) + { + Instance.Boxplot = Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Boxplot(System.Action>? action) + { + Instance.Boxplot = Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation? value) + { + Instance.BucketCorrelation = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCorrelation(System.Action action) + { + Instance.BucketCorrelation = Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation? value) + { + Instance.BucketCountKsTest = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest() + { + Instance.BucketCountKsTest = Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketCountKsTest(System.Action? action) + { + Instance.BucketCountKsTest = Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation? value) + { + Instance.BucketScript = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript() + { + Instance.BucketScript = Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketScript(System.Action? action) + { + Instance.BucketScript = Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation? value) + { + Instance.BucketSelector = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector() + { + Instance.BucketSelector = Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSelector(System.Action? action) + { + Instance.BucketSelector = Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation? value) + { + Instance.BucketSort = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort() + { + Instance.BucketSort = Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort(System.Action? action) + { + Instance.BucketSort = Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor BucketSort(System.Action>? action) + { + Instance.BucketSort = Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? value) + { + Instance.Cardinality = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality() + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality(System.Action? action) + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Cardinality(System.Action>? action) + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CategorizeText(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation? value) + { + Instance.CategorizeText = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CategorizeText(System.Action action) + { + Instance.CategorizeText = Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups semi-structured text into buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CategorizeText(System.Action> action) + { + Instance.CategorizeText = Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation? value) + { + Instance.Children = value; + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children() + { + Instance.Children = Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single bucket aggregation that selects child documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Children(System.Action? action) + { + Instance.Children = Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? value) + { + Instance.Composite = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite() + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite(System.Action? action) + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Composite(System.Action>? action) + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation? value) + { + Instance.CumulativeCardinality = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality() + { + Instance.CumulativeCardinality = Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative cardinality in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeCardinality(System.Action? action) + { + Instance.CumulativeCardinality = Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation? value) + { + Instance.CumulativeSum = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum() + { + Instance.CumulativeSum = Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor CumulativeSum(System.Action? action) + { + Instance.CumulativeSum = Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? value) + { + Instance.DateHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram() + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram(System.Action? action) + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateHistogram(System.Action>? action) + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? value) + { + Instance.DateRange = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange() + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange(System.Action? action) + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DateRange(System.Action>? action) + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation? value) + { + Instance.Derivative = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative() + { + Instance.Derivative = Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the derivative of a specified metric in a parent histogram or date_histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Derivative(System.Action? action) + { + Instance.Derivative = Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation? value) + { + Instance.DiversifiedSampler = value; + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler() + { + Instance.DiversifiedSampler = Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler(System.Action? action) + { + Instance.DiversifiedSampler = Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// Similar to the sampler aggregation, but adds the ability to limit the number of matches that share a common value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor DiversifiedSampler(System.Action>? action) + { + Instance.DiversifiedSampler = Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation? value) + { + Instance.ExtendedStats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats() + { + Instance.ExtendedStats = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats(System.Action? action) + { + Instance.ExtendedStats = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStats(System.Action>? action) + { + Instance.ExtendedStats = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation? value) + { + Instance.ExtendedStatsBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket() + { + Instance.ExtendedStatsBucket = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ExtendedStatsBucket(System.Action? action) + { + Instance.ExtendedStatsBucket = Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Filter = value; + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filter(System.Action action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation? value) + { + Instance.Filters = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters() + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters(System.Action? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Filters(System.Action>? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor FrequentItemSets(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation? value) + { + Instance.FrequentItemSets = value; + return this; + } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor FrequentItemSets(System.Action action) + { + Instance.FrequentItemSets = Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor FrequentItemSets(System.Action> action) + { + Instance.FrequentItemSets = Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation? value) + { + Instance.GeoBounds = value; + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds() + { + Instance.GeoBounds = Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds(System.Action? action) + { + Instance.GeoBounds = Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoBounds(System.Action>? action) + { + Instance.GeoBounds = Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation? value) + { + Instance.GeoCentroid = value; + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid() + { + Instance.GeoCentroid = Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid(System.Action? action) + { + Instance.GeoCentroid = Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that computes the weighted centroid from all coordinate values for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoCentroid(System.Action>? action) + { + Instance.GeoCentroid = Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation? value) + { + Instance.GeoDistance = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance() + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance(System.Action? action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that works on geo_point fields. + /// Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoDistance(System.Action>? action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation? value) + { + Instance.GeohashGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid() + { + Instance.GeohashGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid(System.Action? action) + { + Instance.GeohashGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell is labeled using a geohash which is of user-definable precision. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohashGrid(System.Action>? action) + { + Instance.GeohashGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohexGrid(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation? value) + { + Instance.GeohexGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohexGrid(System.Action action) + { + Instance.GeohexGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a H3 cell index and is labeled using the H3Index representation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeohexGrid(System.Action> action) + { + Instance.GeohexGrid = Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoLine(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? value) + { + Instance.GeoLine = value; + return this; + } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoLine(System.Action action) + { + Instance.GeoLine = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeoLine(System.Action> action) + { + Instance.GeoLine = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? value) + { + Instance.GeotileGrid = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid() + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid(System.Action? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that groups geo_point and geo_shape values into buckets that represent a grid. + /// Each cell corresponds to a map tile as used by many online map sites. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor GeotileGrid(System.Action>? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation? value) + { + Instance.Global = value; + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global() + { + Instance.Global = Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Defines a single bucket of all the documents within the search execution context. + /// This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Global(System.Action? action) + { + Instance.Global = Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? value) + { + Instance.Histogram = value; + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram() + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram(System.Action? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents. + /// It dynamically builds fixed size (interval) buckets over the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Histogram(System.Action>? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Inference(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation? value) + { + Instance.Inference = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Inference(System.Action action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Inference(System.Action> action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpPrefix(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation? value) + { + Instance.IpPrefix = value; + return this; + } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpPrefix(System.Action action) + { + Instance.IpPrefix = Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A bucket aggregation that groups documents based on the network or sub-network of an IP address. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpPrefix(System.Action> action) + { + Instance.IpPrefix = Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation? value) + { + Instance.IpRange = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange() + { + Instance.IpRange = Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange(System.Action? action) + { + Instance.IpRange = Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor IpRange(System.Action>? action) + { + Instance.IpRange = Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Line(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation? value) + { + Instance.Line = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Line(System.Action action) + { + Instance.Line = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Line(System.Action> action) + { + Instance.Line = Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation? value) + { + Instance.MatrixStats = value; + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats() + { + Instance.MatrixStats = Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats(System.Action? action) + { + Instance.MatrixStats = Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A numeric aggregation that computes the following statistics over a set of document fields: count, mean, variance, skewness, kurtosis, covariance, and covariance. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MatrixStats(System.Action>? action) + { + Instance.MatrixStats = Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation? value) + { + Instance.Max = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max() + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max(System.Action? action) + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Max(System.Action>? action) + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation? value) + { + Instance.MaxBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket() + { + Instance.MaxBucket = Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MaxBucket(System.Action? action) + { + Instance.MaxBucket = Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation? value) + { + Instance.MedianAbsoluteDeviation = value; + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation() + { + Instance.MedianAbsoluteDeviation = Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation(System.Action? action) + { + Instance.MedianAbsoluteDeviation = Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value aggregation that approximates the median absolute deviation of its search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MedianAbsoluteDeviation(System.Action>? action) + { + Instance.MedianAbsoluteDeviation = Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation? value) + { + Instance.Min = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min() + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min(System.Action? action) + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Min(System.Action>? action) + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation? value) + { + Instance.MinBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket() + { + Instance.MinBucket = Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MinBucket(System.Action? action) + { + Instance.MinBucket = Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? value) + { + Instance.Missing = value; + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing(System.Action? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Missing(System.Action>? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation? value) + { + Instance.MovingFn = value; + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn() + { + Instance.MovingFn = Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data. + /// For convenience, a number of common functions are predefined such as min, max, and moving averages. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingFn(System.Action? action) + { + Instance.MovingFn = Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation? value) + { + Instance.MovingPercentiles = value; + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles() + { + Instance.MovingPercentiles = Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MovingPercentiles(System.Action? action) + { + Instance.MovingPercentiles = Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MultiTerms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation? value) + { + Instance.MultiTerms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MultiTerms(System.Action action) + { + Instance.MultiTerms = Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor MultiTerms(System.Action> action) + { + Instance.MultiTerms = Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation? value) + { + Instance.Nested = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested() + { + Instance.Nested = Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested(System.Action? action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating nested documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Nested(System.Action>? action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation? value) + { + Instance.Normalize = value; + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize() + { + Instance.Normalize = Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Normalize(System.Action? action) + { + Instance.Normalize = Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation? value) + { + Instance.Parent = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent() + { + Instance.Parent = Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that selects parent documents that have the specified type, as defined in a join field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Parent(System.Action? action) + { + Instance.Parent = Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation? value) + { + Instance.PercentileRanks = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks() + { + Instance.PercentileRanks = Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks(System.Action? action) + { + Instance.PercentileRanks = Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentileRanks(System.Action>? action) + { + Instance.PercentileRanks = Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation? value) + { + Instance.Percentiles = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles() + { + Instance.Percentiles = Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles(System.Action? action) + { + Instance.Percentiles = Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Percentiles(System.Action>? action) + { + Instance.Percentiles = Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation? value) + { + Instance.PercentilesBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket() + { + Instance.PercentilesBucket = Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor PercentilesBucket(System.Action? action) + { + Instance.PercentilesBucket = Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that randomly includes documents in the aggregated results. + /// Sampling provides significant speed improvement at the cost of accuracy. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RandomSampler(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation? value) + { + Instance.RandomSampler = value; + return this; + } + + /// + /// + /// A single bucket aggregation that randomly includes documents in the aggregated results. + /// Sampling provides significant speed improvement at the cost of accuracy. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RandomSampler(System.Action action) + { + Instance.RandomSampler = Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range() + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range(System.Action? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Range(System.Action>? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation? value) + { + Instance.RareTerms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms() + { + Instance.RareTerms = Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms(System.Action? action) + { + Instance.RareTerms = Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor RareTerms(System.Action>? action) + { + Instance.RareTerms = Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation? value) + { + Instance.Rate = value; + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate() + { + Instance.Rate = Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate(System.Action? action) + { + Instance.Rate = Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates a rate of documents or a field in each bucket. + /// Can only be used inside a date_histogram or composite aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Rate(System.Action>? action) + { + Instance.Rate = Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation? value) + { + Instance.ReverseNested = value; + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested() + { + Instance.ReverseNested = Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested(System.Action? action) + { + Instance.ReverseNested = Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A special single bucket aggregation that enables aggregating on parent documents from nested documents. + /// Should only be defined inside a nested aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ReverseNested(System.Action>? action) + { + Instance.ReverseNested = Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation? value) + { + Instance.Sampler = value; + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler() + { + Instance.Sampler = Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sampler(System.Action? action) + { + Instance.Sampler = Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation? value) + { + Instance.ScriptedMetric = value; + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric() + { + Instance.ScriptedMetric = Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric(System.Action? action) + { + Instance.ScriptedMetric = Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that uses scripts to provide a metric output. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ScriptedMetric(System.Action>? action) + { + Instance.ScriptedMetric = Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation? value) + { + Instance.SerialDiff = value; + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff() + { + Instance.SerialDiff = Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// An aggregation that subtracts values in a time series from themselves at different time lags or periods. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SerialDiff(System.Action? action) + { + Instance.SerialDiff = Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation? value) + { + Instance.SignificantTerms = value; + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms() + { + Instance.SignificantTerms = Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms(System.Action? action) + { + Instance.SignificantTerms = Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantTerms(System.Action>? action) + { + Instance.SignificantTerms = Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation? value) + { + Instance.SignificantText = value; + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText() + { + Instance.SignificantText = Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText(System.Action? action) + { + Instance.SignificantText = Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns interesting or unusual occurrences of free-text terms in a set. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SignificantText(System.Action>? action) + { + Instance.SignificantText = Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats() + { + Instance.Stats = Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats(System.Action? action) + { + Instance.Stats = Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Stats(System.Action>? action) + { + Instance.Stats = Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation? value) + { + Instance.StatsBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket() + { + Instance.StatsBucket = Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StatsBucket(System.Action? action) + { + Instance.StatsBucket = Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation? value) + { + Instance.StringStats = value; + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats() + { + Instance.StringStats = Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats(System.Action? action) + { + Instance.StringStats = Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor StringStats(System.Action>? action) + { + Instance.StringStats = Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation? value) + { + Instance.Sum = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum() + { + Instance.Sum = Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum(System.Action? action) + { + Instance.Sum = Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Sum(System.Action>? action) + { + Instance.Sum = Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation? value) + { + Instance.SumBucket = value; + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket() + { + Instance.SumBucket = Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor SumBucket(System.Action? action) + { + Instance.SumBucket = Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms() + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms(System.Action? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation? value) + { + Instance.TimeSeries = value; + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries() + { + Instance.TimeSeries = Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// The time series aggregation queries data created using a time series index. + /// This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TimeSeries(System.Action? action) + { + Instance.TimeSeries = Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation? value) + { + Instance.TopHits = value; + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits() + { + Instance.TopHits = Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits(System.Action? action) + { + Instance.TopHits = Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that returns the top matching documents per bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopHits(System.Action>? action) + { + Instance.TopHits = Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation? value) + { + Instance.TopMetrics = value; + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics() + { + Instance.TopMetrics = Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics(System.Action? action) + { + Instance.TopMetrics = Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metric aggregation that selects metrics from the document with the largest or smallest sort value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TopMetrics(System.Action>? action) + { + Instance.TopMetrics = Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation? value) + { + Instance.TTest = value; + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest() + { + Instance.TTest = Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest(System.Action? action) + { + Instance.TTest = Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor TTest(System.Action>? action) + { + Instance.TTest = Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? value) + { + Instance.ValueCount = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount() + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount(System.Action? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor ValueCount(System.Action>? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation? value) + { + Instance.VariableWidthHistogram = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram() + { + Instance.VariableWidthHistogram = Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram(System.Action? action) + { + Instance.VariableWidthHistogram = Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor VariableWidthHistogram(System.Action>? action) + { + Instance.VariableWidthHistogram = Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation? value) + { + Instance.WeightedAvg = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg() + { + Instance.WeightedAvg = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg(System.Action? action) + { + Instance.WeightedAvg = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor WeightedAvg(System.Action>? action) + { + Instance.WeightedAvg = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Aggregation Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.Aggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs index 7ecc60c320f..3929c3332d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class AggregationRangeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AggregationRange Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propKey = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Key = propKey.Value, + To = propTo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AggregationRange value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeConverter))] public sealed partial class AggregationRange { +#if NET7_0_OR_GREATER + public AggregationRange() + { + } +#endif +#if !NET7_0_OR_GREATER + public AggregationRange() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Start of the range (inclusive). /// /// - [JsonInclude, JsonPropertyName("from")] public double? From { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class AggregationRange /// Custom key to return the range with. /// /// - [JsonInclude, JsonPropertyName("key")] public string? Key { get; set; } /// @@ -50,31 +118,37 @@ public sealed partial class AggregationRange /// End of the range (exclusive). /// /// - [JsonInclude, JsonPropertyName("to")] public double? To { get; set; } } -public sealed partial class AggregationRangeDescriptor : SerializableDescriptor +public readonly partial struct AggregationRangeDescriptor { - internal AggregationRangeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AggregationRange Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationRangeDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AggregationRange instance) + { + Instance = instance; + } - public AggregationRangeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationRangeDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? FromValue { get; set; } - private string? KeyValue { get; set; } - private double? ToValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AggregationRange instance) => new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AggregationRange(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor descriptor) => descriptor.Instance; /// /// /// Start of the range (inclusive). /// /// - public AggregationRangeDescriptor From(double? from) + public Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor From(double? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -82,10 +156,10 @@ public AggregationRangeDescriptor From(double? from) /// Custom key to return the range with. /// /// - public AggregationRangeDescriptor Key(string? key) + public Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor Key(string? value) { - KeyValue = key; - return Self; + Instance.Key = value; + return this; } /// @@ -93,33 +167,22 @@ public AggregationRangeDescriptor Key(string? key) /// End of the range (exclusive). /// /// - public AggregationRangeDescriptor To(double? to) + public Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor To(double? value) { - ToValue = to; - return Self; + Instance.To = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AggregationRange Build(System.Action? action) { - writer.WriteStartObject(); - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (!string.IsNullOrEmpty(KeyValue)) + if (action is null) { - writer.WritePropertyName("key"); - writer.WriteStringValue(KeyValue); + return new Elastic.Clients.Elasticsearch.Aggregations.AggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ToValue.HasValue) - { - writer.WritePropertyName("to"); - writer.WriteNumberValue(ToValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ArrayPercentilesItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ArrayPercentilesItem.g.cs index 2962cc1560e..9f32ee6be43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ArrayPercentilesItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ArrayPercentilesItem.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ArrayPercentilesItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propKey = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Key = propKey.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItemConverter))] public sealed partial class ArrayPercentilesItem { - [JsonInclude, JsonPropertyName("key")] - public string Key { get; init; } - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ArrayPercentilesItem(string key, double? value) + { + Key = key; + Value = value; + } +#if NET7_0_OR_GREATER + public ArrayPercentilesItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ArrayPercentilesItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ArrayPercentilesItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregate.g.cs index 3119d139dbc..1b33334ae11 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregate.g.cs @@ -17,22 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class AutoDateHistogramAggregate : IAggregate +internal sealed partial class AutoDateHistogramAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("interval")] - public string Interval { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propInterval = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Interval = propInterval.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInterval, value.Interval, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregateConverter))] +public sealed partial class AutoDateHistogramAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoDateHistogramAggregate(System.Collections.Generic.IReadOnlyCollection buckets, string interval) + { + Buckets = buckets; + Interval = interval; + } +#if NET7_0_OR_GREATER + public AutoDateHistogramAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AutoDateHistogramAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoDateHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Interval { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "auto_date_histogram"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs index 75840287e84..ad9a573549a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AutoDateHistogramAggregation.g.cs @@ -17,24 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class AutoDateHistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumInterval = System.Text.Json.JsonEncodedText.Encode("minimum_interval"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuckets = default; + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMinimumInterval = default; + LocalJsonValue propMissing = default; + LocalJsonValue propOffset = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propScript = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMinimumInterval.TryReadProperty(ref reader, options, PropMinimumInterval, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Field = propField.Value, + Format = propFormat.Value, + MinimumInterval = propMinimumInterval.Value, + Missing = propMissing.Value, + Offset = propOffset.Value, + Params = propParams.Value, + Script = propScript.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMinimumInterval, value.MinimumInterval, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationConverter))] public sealed partial class AutoDateHistogramAggregation { +#if NET7_0_OR_GREATER + public AutoDateHistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public AutoDateHistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The target number of buckets. /// /// - [JsonInclude, JsonPropertyName("buckets")] public int? Buckets { get; set; } /// @@ -42,7 +165,6 @@ public sealed partial class AutoDateHistogramAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -51,7 +173,6 @@ public sealed partial class AutoDateHistogramAggregation /// If no format is specified, the first date format specified in the field mapping is used. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -60,7 +181,6 @@ public sealed partial class AutoDateHistogramAggregation /// This can make the collection process more efficient, as the aggregation will not attempt to round at any interval lower than minimum_interval. /// /// - [JsonInclude, JsonPropertyName("minimum_interval")] public Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? MinimumInterval { get; set; } /// @@ -69,19 +189,15 @@ public sealed partial class AutoDateHistogramAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public DateTimeOffset? Missing { get; set; } + public System.DateTimeOffset? Missing { get; set; } /// /// /// Time zone specified as a ISO 8601 UTC offset. /// /// - [JsonInclude, JsonPropertyName("offset")] public string? Offset { get; set; } - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.IDictionary? Params { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -89,52 +205,37 @@ public sealed partial class AutoDateHistogramAggregation /// Time zone ID. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(AutoDateHistogramAggregation autoDateHistogramAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.AutoDateHistogram(autoDateHistogramAggregation); } -public sealed partial class AutoDateHistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct AutoDateHistogramAggregationDescriptor { - internal AutoDateHistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation Instance { get; init; } - public AutoDateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation instance) { + Instance = instance; } - private int? BucketsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? MinimumIntervalValue { get; set; } - private DateTimeOffset? MissingValue { get; set; } - private string? OffsetValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } - - /// - /// - /// The target number of buckets. - /// - /// - public AutoDateHistogramAggregationDescriptor Buckets(int? buckets) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoDateHistogramAggregationDescriptor() { - BucketsValue = buckets; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// The target number of buckets. /// /// - public AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Buckets(int? value) { - FieldValue = field; - return Self; + Instance.Buckets = value; + return this; } /// @@ -142,10 +243,10 @@ public AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.E /// The field on which to run the aggregation. /// /// - public AutoDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -153,10 +254,10 @@ public AutoDateHistogramAggregationDescriptor Field(Expressio /// The field on which to run the aggregation. /// /// - public AutoDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -165,10 +266,10 @@ public AutoDateHistogramAggregationDescriptor Field(Expressionformat is specified, the first date format specified in the field mapping is used. /// /// - public AutoDateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -177,10 +278,10 @@ public AutoDateHistogramAggregationDescriptor Format(string? format) /// This can make the collection process more efficient, as the aggregation will not attempt to round at any interval lower than minimum_interval. /// /// - public AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? minimumInterval) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? value) { - MinimumIntervalValue = minimumInterval; - return Self; + Instance.MinimumInterval = value; + return this; } /// @@ -189,10 +290,10 @@ public AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic /// By default, documents without a value are ignored. /// /// - public AutoDateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Missing(System.DateTimeOffset? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -200,40 +301,53 @@ public AutoDateHistogramAggregationDescriptor Missing(DateTimeOffset? /// Time zone specified as a ISO 8601 UTC offset. /// /// - public AutoDateHistogramAggregationDescriptor Offset(string? offset) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Offset(string? value) + { + Instance.Offset = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) { - OffsetValue = offset; - return Self; + Instance.Params = value; + return this; } - public AutoDateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params() { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params(System.Action? action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor AddParam(string key, object value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public AutoDateHistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -241,123 +355,54 @@ public AutoDateHistogramAggregationDescriptor Script(Action /// - public AutoDateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BucketsValue.HasValue) - { - writer.WritePropertyName("buckets"); - writer.WriteNumberValue(BucketsValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MinimumIntervalValue is not null) - { - writer.WritePropertyName("minimum_interval"); - JsonSerializer.Serialize(writer, MinimumIntervalValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (!string.IsNullOrEmpty(OffsetValue)) - { - writer.WritePropertyName("offset"); - writer.WriteStringValue(OffsetValue); - } - - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AutoDateHistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct AutoDateHistogramAggregationDescriptor { - internal AutoDateHistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation Instance { get; init; } - public AutoDateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation instance) { + Instance = instance; } - private int? BucketsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? MinimumIntervalValue { get; set; } - private DateTimeOffset? MissingValue { get; set; } - private string? OffsetValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } - - /// - /// - /// The target number of buckets. - /// - /// - public AutoDateHistogramAggregationDescriptor Buckets(int? buckets) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoDateHistogramAggregationDescriptor() { - BucketsValue = buckets; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// The target number of buckets. /// /// - public AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Buckets(int? value) { - FieldValue = field; - return Self; + Instance.Buckets = value; + return this; } /// @@ -365,10 +410,10 @@ public AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearc /// The field on which to run the aggregation. /// /// - public AutoDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -376,10 +421,10 @@ public AutoDateHistogramAggregationDescriptor Field(Expressio /// The field on which to run the aggregation. /// /// - public AutoDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -388,10 +433,10 @@ public AutoDateHistogramAggregationDescriptor Field(Expressionformat is specified, the first date format specified in the field mapping is used. /// /// - public AutoDateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -400,10 +445,10 @@ public AutoDateHistogramAggregationDescriptor Format(string? format) /// This can make the collection process more efficient, as the aggregation will not attempt to round at any interval lower than minimum_interval. /// /// - public AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? minimumInterval) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval? value) { - MinimumIntervalValue = minimumInterval; - return Self; + Instance.MinimumInterval = value; + return this; } /// @@ -412,10 +457,10 @@ public AutoDateHistogramAggregationDescriptor MinimumInterval(Elastic.Clients.El /// By default, documents without a value are ignored. /// /// - public AutoDateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Missing(System.DateTimeOffset? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -423,40 +468,53 @@ public AutoDateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) /// Time zone specified as a ISO 8601 UTC offset. /// /// - public AutoDateHistogramAggregationDescriptor Offset(string? offset) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Offset(string? value) + { + Instance.Offset = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) + { + Instance.Params = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Params(System.Action? action) { - OffsetValue = offset; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public AutoDateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor AddParam(string key, object value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public AutoDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public AutoDateHistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -464,79 +522,22 @@ public AutoDateHistogramAggregationDescriptor Script(Action /// - public AutoDateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsValue.HasValue) - { - writer.WritePropertyName("buckets"); - writer.WriteNumberValue(BucketsValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MinimumIntervalValue is not null) - { - writer.WritePropertyName("minimum_interval"); - JsonSerializer.Serialize(writer, MinimumIntervalValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (!string.IsNullOrEmpty(OffsetValue)) - { - writer.WritePropertyName("offset"); - writer.WriteStringValue(OffsetValue); - } - - if (ParamsValue is not null) + if (action is null) { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AutoDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs index c143e3b2a1b..f0ab2b896e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregate.g.cs @@ -17,20 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class AverageAggregate : IAggregate +internal sealed partial class AverageAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AverageAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AverageAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregateConverter))] +public sealed partial class AverageAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public AverageAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AverageAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AverageAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "avg"; /// /// @@ -38,8 +115,10 @@ public sealed partial class AverageAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs index a07651b4526..e57bcab8904 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class AverageAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationConverter))] public sealed partial class AverageAggregation { +#if NET7_0_OR_GREATER + public AverageAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public AverageAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,49 +122,38 @@ public sealed partial class AverageAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(AverageAggregation averageAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Avg(averageAggregation); } -public sealed partial class AverageAggregationDescriptor : SerializableDescriptor> +public readonly partial struct AverageAggregationDescriptor { - internal AverageAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation Instance { get; init; } - public AverageAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public AverageAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public AverageAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -95,16 +161,16 @@ public AverageAggregationDescriptor Field(Expression /// - public AverageAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public AverageAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -113,112 +179,72 @@ public AverageAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public AverageAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public AverageAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AverageAggregationDescriptor : SerializableDescriptor +public readonly partial struct AverageAggregationDescriptor { - internal AverageAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation Instance { get; init; } - public AverageAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public AverageAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public AverageAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -226,16 +252,16 @@ public AverageAggregationDescriptor Field(Expression /// - public AverageAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public AverageAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -244,73 +270,40 @@ public AverageAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public AverageAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public AverageAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public AverageAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageBucketAggregation.g.cs index 452c11ba9cf..e8b8325c251 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AverageBucketAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class AverageBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationConverter))] public sealed partial class AverageBucketAggregation { +#if NET7_0_OR_GREATER + public AverageBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public AverageBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AverageBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class AverageBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class AverageBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(AverageBucketAggregation averageBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.AvgBucket(averageBucketAggregation); } -public sealed partial class AverageBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct AverageBucketAggregationDescriptor { - internal AverageBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation instance) + { + Instance = instance; + } - public AverageBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AverageBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public AverageBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public AverageBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsea /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public AverageBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public AverageBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public AverageBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.AverageBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs index 66c8eb6edfa..ac6a5ca5cd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregate.g.cs @@ -17,46 +17,252 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class BoxplotAggregate : IAggregate +internal sealed partial class BoxplotAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLower = System.Text.Json.JsonEncodedText.Encode("lower"); + private static readonly System.Text.Json.JsonEncodedText PropLowerAsString = System.Text.Json.JsonEncodedText.Encode("lower_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropQ1 = System.Text.Json.JsonEncodedText.Encode("q1"); + private static readonly System.Text.Json.JsonEncodedText PropQ1AsString = System.Text.Json.JsonEncodedText.Encode("q1_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropQ2 = System.Text.Json.JsonEncodedText.Encode("q2"); + private static readonly System.Text.Json.JsonEncodedText PropQ2AsString = System.Text.Json.JsonEncodedText.Encode("q2_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropQ3 = System.Text.Json.JsonEncodedText.Encode("q3"); + private static readonly System.Text.Json.JsonEncodedText PropQ3AsString = System.Text.Json.JsonEncodedText.Encode("q3_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropUpper = System.Text.Json.JsonEncodedText.Encode("upper"); + private static readonly System.Text.Json.JsonEncodedText PropUpperAsString = System.Text.Json.JsonEncodedText.Encode("upper_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLower = default; + LocalJsonValue propLowerAsString = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + LocalJsonValue propQ1 = default; + LocalJsonValue propQ1AsString = default; + LocalJsonValue propQ2 = default; + LocalJsonValue propQ2AsString = default; + LocalJsonValue propQ3 = default; + LocalJsonValue propQ3AsString = default; + LocalJsonValue propUpper = default; + LocalJsonValue propUpperAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLower.TryReadProperty(ref reader, options, PropLower, null)) + { + continue; + } + + if (propLowerAsString.TryReadProperty(ref reader, options, PropLowerAsString, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + if (propQ1.TryReadProperty(ref reader, options, PropQ1, null)) + { + continue; + } + + if (propQ1AsString.TryReadProperty(ref reader, options, PropQ1AsString, null)) + { + continue; + } + + if (propQ2.TryReadProperty(ref reader, options, PropQ2, null)) + { + continue; + } + + if (propQ2AsString.TryReadProperty(ref reader, options, PropQ2AsString, null)) + { + continue; + } + + if (propQ3.TryReadProperty(ref reader, options, PropQ3, null)) + { + continue; + } + + if (propQ3AsString.TryReadProperty(ref reader, options, PropQ3AsString, null)) + { + continue; + } + + if (propUpper.TryReadProperty(ref reader, options, PropUpper, null)) + { + continue; + } + + if (propUpperAsString.TryReadProperty(ref reader, options, PropUpperAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lower = propLower.Value, + LowerAsString = propLowerAsString.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Meta = propMeta.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value, + Q1 = propQ1.Value, + Q1AsString = propQ1AsString.Value, + Q2 = propQ2.Value, + Q2AsString = propQ2AsString.Value, + Q3 = propQ3.Value, + Q3AsString = propQ3AsString.Value, + Upper = propUpper.Value, + UpperAsString = propUpperAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLower, value.Lower, null, null); + writer.WriteProperty(options, PropLowerAsString, value.LowerAsString, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + writer.WriteProperty(options, PropQ1, value.Q1, null, null); + writer.WriteProperty(options, PropQ1AsString, value.Q1AsString, null, null); + writer.WriteProperty(options, PropQ2, value.Q2, null, null); + writer.WriteProperty(options, PropQ2AsString, value.Q2AsString, null, null); + writer.WriteProperty(options, PropQ3, value.Q3, null, null); + writer.WriteProperty(options, PropQ3AsString, value.Q3AsString, null, null); + writer.WriteProperty(options, PropUpper, value.Upper, null, null); + writer.WriteProperty(options, PropUpperAsString, value.UpperAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregateConverter))] +public sealed partial class BoxplotAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("lower")] - public double Lower { get; init; } - [JsonInclude, JsonPropertyName("lower_as_string")] - public string? LowerAsString { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double Max { get; init; } - [JsonInclude, JsonPropertyName("max_as_string")] - public string? MaxAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double Min { get; init; } - [JsonInclude, JsonPropertyName("min_as_string")] - public string? MinAsString { get; init; } - [JsonInclude, JsonPropertyName("q1")] - public double Q1 { get; init; } - [JsonInclude, JsonPropertyName("q1_as_string")] - public string? Q1AsString { get; init; } - [JsonInclude, JsonPropertyName("q2")] - public double Q2 { get; init; } - [JsonInclude, JsonPropertyName("q2_as_string")] - public string? Q2AsString { get; init; } - [JsonInclude, JsonPropertyName("q3")] - public double Q3 { get; init; } - [JsonInclude, JsonPropertyName("q3_as_string")] - public string? Q3AsString { get; init; } - [JsonInclude, JsonPropertyName("upper")] - public double Upper { get; init; } - [JsonInclude, JsonPropertyName("upper_as_string")] - public string? UpperAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoxplotAggregate(double lower, double max, double min, double q1, double q2, double q3, double upper) + { + Lower = lower; + Max = max; + Min = min; + Q1 = q1; + Q2 = q2; + Q3 = q3; + Upper = upper; + } +#if NET7_0_OR_GREATER + public BoxplotAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BoxplotAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BoxplotAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Lower { get; set; } + public string? LowerAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Max { get; set; } + public string? MaxAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Min { get; set; } + public string? MinAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Q1 { get; set; } + public string? Q1AsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Q2 { get; set; } + public string? Q2AsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Q3 { get; set; } + public string? Q3AsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "boxplot"; + + public +#if NET7_0_OR_GREATER + required +#endif + double Upper { get; set; } + public string? UpperAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs index b2d25b27e62..6d30c06e26b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BoxplotAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BoxplotAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompression = System.Text.Json.JsonEncodedText.Encode("compression"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompression = default; + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompression.TryReadProperty(ref reader, options, PropCompression, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Compression = propCompression.Value, + Field = propField.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompression, value.Compression, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationConverter))] public sealed partial class BoxplotAggregation { +#if NET7_0_OR_GREATER + public BoxplotAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public BoxplotAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - [JsonInclude, JsonPropertyName("compression")] public double? Compression { get; set; } /// @@ -42,7 +120,6 @@ public sealed partial class BoxplotAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -51,49 +128,38 @@ public sealed partial class BoxplotAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BoxplotAggregation boxplotAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Boxplot(boxplotAggregation); } -public sealed partial class BoxplotAggregationDescriptor : SerializableDescriptor> +public readonly partial struct BoxplotAggregationDescriptor { - internal BoxplotAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation Instance { get; init; } - public BoxplotAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoxplotAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation instance) { + Instance = instance; } - private double? CompressionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. - /// - /// - public BoxplotAggregationDescriptor Compression(double? compression) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoxplotAggregationDescriptor() { - CompressionValue = compression; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - public BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Compression(double? value) { - FieldValue = field; - return Self; + Instance.Compression = value; + return this; } /// @@ -101,10 +167,10 @@ public BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsear /// The field on which to run the aggregation. /// /// - public BoxplotAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -112,10 +178,10 @@ public BoxplotAggregationDescriptor Field(Expression /// - public BoxplotAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -124,112 +190,72 @@ public BoxplotAggregationDescriptor Field(Expression /// - public BoxplotAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public BoxplotAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (CompressionValue.HasValue) + if (action is null) { - writer.WritePropertyName("compression"); - writer.WriteNumberValue(CompressionValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class BoxplotAggregationDescriptor : SerializableDescriptor +public readonly partial struct BoxplotAggregationDescriptor { - internal BoxplotAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation Instance { get; init; } - public BoxplotAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoxplotAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation instance) { + Instance = instance; } - private double? CompressionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. - /// - /// - public BoxplotAggregationDescriptor Compression(double? compression) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoxplotAggregationDescriptor() { - CompressionValue = compression; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - public BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Compression(double? value) { - FieldValue = field; - return Self; + Instance.Compression = value; + return this; } /// @@ -237,10 +263,10 @@ public BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? f /// The field on which to run the aggregation. /// /// - public BoxplotAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -248,10 +274,10 @@ public BoxplotAggregationDescriptor Field(Expression /// - public BoxplotAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -260,73 +286,40 @@ public BoxplotAggregationDescriptor Field(Expression /// - public BoxplotAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public BoxplotAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public BoxplotAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (CompressionValue.HasValue) - { - writer.WritePropertyName("compression"); - writer.WriteNumberValue(CompressionValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BoxplotAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationAggregation.g.cs index 0a76c59d32a..1d49f101c3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationAggregation.g.cs @@ -17,40 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketCorrelationAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFunction = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Function = propFunction.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A sibling pipeline aggregation which executes a correlation function on the configured sibling multi-bucket aggregation. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationConverter))] public sealed partial class BucketCorrelationAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction function) + { + Function = function; + } +#if NET7_0_OR_GREATER + public BucketCorrelationAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketCorrelationAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// /// The correlation function to execute. /// /// - [JsonInclude, JsonPropertyName("function")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction Function { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BucketCorrelationAggregation bucketCorrelationAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.BucketCorrelation(bucketCorrelationAggregation); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction Function { get; set; } } /// @@ -58,28 +125,34 @@ public sealed partial class BucketCorrelationAggregation /// A sibling pipeline aggregation which executes a correlation function on the configured sibling multi-bucket aggregation. /// /// -public sealed partial class BucketCorrelationAggregationDescriptor : SerializableDescriptor +public readonly partial struct BucketCorrelationAggregationDescriptor { - internal BucketCorrelationAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation Instance { get; init; } - public BucketCorrelationAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction FunctionValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor FunctionDescriptor { get; set; } - private Action FunctionDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public BucketCorrelationAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -87,55 +160,28 @@ public BucketCorrelationAggregationDescriptor BucketsPath(Elastic.Clients.Elasti /// The correlation function to execute. /// /// - public BucketCorrelationAggregationDescriptor Function(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction function) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor Function(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction value) { - FunctionDescriptor = null; - FunctionDescriptorAction = null; - FunctionValue = function; - return Self; + Instance.Function = value; + return this; } - public BucketCorrelationAggregationDescriptor Function(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor descriptor) - { - FunctionValue = null; - FunctionDescriptorAction = null; - FunctionDescriptor = descriptor; - return Self; - } - - public BucketCorrelationAggregationDescriptor Function(Action configure) + /// + /// + /// The correlation function to execute. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor Function(System.Action action) { - FunctionValue = null; - FunctionDescriptor = null; - FunctionDescriptorAction = configure; - return Self; + Instance.Function = Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (FunctionDescriptor is not null) - { - writer.WritePropertyName("function"); - JsonSerializer.Serialize(writer, FunctionDescriptor, options); - } - else if (FunctionDescriptorAction is not null) - { - writer.WritePropertyName("function"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor(FunctionDescriptorAction), options); - } - else - { - writer.WritePropertyName("function"); - JsonSerializer.Serialize(writer, FunctionValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunction.g.cs index a27215a8c96..89f298991c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunction.g.cs @@ -17,87 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketCorrelationFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCountCorrelation = System.Text.Json.JsonEncodedText.Encode("count_correlation"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCountCorrelation = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCountCorrelation.TryReadProperty(ref reader, options, PropCountCorrelation, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CountCorrelation = propCountCorrelation.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCountCorrelation, value.CountCorrelation, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionConverter))] public sealed partial class BucketCorrelationFunction { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation countCorrelation) + { + CountCorrelation = countCorrelation; + } +#if NET7_0_OR_GREATER + public BucketCorrelationFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketCorrelationFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The configuration to calculate a count correlation. This function is designed for determining the correlation of a term value and a given metric. /// /// - [JsonInclude, JsonPropertyName("count_correlation")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation CountCorrelation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation CountCorrelation { get; set; } } -public sealed partial class BucketCorrelationFunctionDescriptor : SerializableDescriptor +public readonly partial struct BucketCorrelationFunctionDescriptor { - internal BucketCorrelationFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction instance) + { + Instance = instance; + } - public BucketCorrelationFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation CountCorrelationValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor CountCorrelationDescriptor { get; set; } - private Action CountCorrelationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor descriptor) => descriptor.Instance; /// /// /// The configuration to calculate a count correlation. This function is designed for determining the correlation of a term value and a given metric. /// /// - public BucketCorrelationFunctionDescriptor CountCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation countCorrelation) - { - CountCorrelationDescriptor = null; - CountCorrelationDescriptorAction = null; - CountCorrelationValue = countCorrelation; - return Self; - } - - public BucketCorrelationFunctionDescriptor CountCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor CountCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation value) { - CountCorrelationValue = null; - CountCorrelationDescriptorAction = null; - CountCorrelationDescriptor = descriptor; - return Self; + Instance.CountCorrelation = value; + return this; } - public BucketCorrelationFunctionDescriptor CountCorrelation(Action configure) + /// + /// + /// The configuration to calculate a count correlation. This function is designed for determining the correlation of a term value and a given metric. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor CountCorrelation(System.Action action) { - CountCorrelationValue = null; - CountCorrelationDescriptor = null; - CountCorrelationDescriptorAction = configure; - return Self; + Instance.CountCorrelation = Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction Build(System.Action action) { - writer.WriteStartObject(); - if (CountCorrelationDescriptor is not null) - { - writer.WritePropertyName("count_correlation"); - JsonSerializer.Serialize(writer, CountCorrelationDescriptor, options); - } - else if (CountCorrelationDescriptorAction is not null) - { - writer.WritePropertyName("count_correlation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor(CountCorrelationDescriptorAction), options); - } - else - { - writer.WritePropertyName("count_correlation"); - JsonSerializer.Serialize(writer, CountCorrelationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelation.g.cs index 951c1099ce3..16daedaa8f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelation.g.cs @@ -17,87 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketCorrelationFunctionCountCorrelationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndicator = System.Text.Json.JsonEncodedText.Encode("indicator"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndicator = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndicator.TryReadProperty(ref reader, options, PropIndicator, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indicator = propIndicator.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndicator, value.Indicator, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationConverter))] public sealed partial class BucketCorrelationFunctionCountCorrelation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator indicator) + { + Indicator = indicator; + } +#if NET7_0_OR_GREATER + public BucketCorrelationFunctionCountCorrelation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketCorrelationFunctionCountCorrelation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The indicator with which to correlate the configured bucket_path values. /// /// - [JsonInclude, JsonPropertyName("indicator")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator Indicator { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator Indicator { get; set; } } -public sealed partial class BucketCorrelationFunctionCountCorrelationDescriptor : SerializableDescriptor +public readonly partial struct BucketCorrelationFunctionCountCorrelationDescriptor { - internal BucketCorrelationFunctionCountCorrelationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation instance) + { + Instance = instance; + } - public BucketCorrelationFunctionCountCorrelationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator IndicatorValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor IndicatorDescriptor { get; set; } - private Action IndicatorDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor descriptor) => descriptor.Instance; /// /// /// The indicator with which to correlate the configured bucket_path values. /// /// - public BucketCorrelationFunctionCountCorrelationDescriptor Indicator(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator indicator) - { - IndicatorDescriptor = null; - IndicatorDescriptorAction = null; - IndicatorValue = indicator; - return Self; - } - - public BucketCorrelationFunctionCountCorrelationDescriptor Indicator(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor Indicator(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator value) { - IndicatorValue = null; - IndicatorDescriptorAction = null; - IndicatorDescriptor = descriptor; - return Self; + Instance.Indicator = value; + return this; } - public BucketCorrelationFunctionCountCorrelationDescriptor Indicator(Action configure) + /// + /// + /// The indicator with which to correlate the configured bucket_path values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor Indicator(System.Action action) { - IndicatorValue = null; - IndicatorDescriptor = null; - IndicatorDescriptorAction = configure; - return Self; + Instance.Indicator = Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation Build(System.Action action) { - writer.WriteStartObject(); - if (IndicatorDescriptor is not null) - { - writer.WritePropertyName("indicator"); - JsonSerializer.Serialize(writer, IndicatorDescriptor, options); - } - else if (IndicatorDescriptorAction is not null) - { - writer.WritePropertyName("indicator"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(IndicatorDescriptorAction), options); - } - else - { - writer.WritePropertyName("indicator"); - JsonSerializer.Serialize(writer, IndicatorValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelationIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelationIndicator.g.cs index 2f006df7bb8..a07a4a07667 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelationIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketCorrelationFunctionCountCorrelationIndicator.g.cs @@ -17,18 +17,95 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketCorrelationFunctionCountCorrelationIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropExpectations = System.Text.Json.JsonEncodedText.Encode("expectations"); + private static readonly System.Text.Json.JsonEncodedText PropFractions = System.Text.Json.JsonEncodedText.Encode("fractions"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocCount = default; + LocalJsonValue> propExpectations = default; + LocalJsonValue?> propFractions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propExpectations.TryReadProperty(ref reader, options, PropExpectations, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFractions.TryReadProperty(ref reader, options, PropFractions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocCount = propDocCount.Value, + Expectations = propExpectations.Value, + Fractions = propFractions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropExpectations, value.Expectations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFractions, value.Fractions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorConverter))] public sealed partial class BucketCorrelationFunctionCountCorrelationIndicator { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelationIndicator(int docCount, System.Collections.Generic.ICollection expectations) + { + DocCount = docCount; + Expectations = expectations; + } +#if NET7_0_OR_GREATER + public BucketCorrelationFunctionCountCorrelationIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketCorrelationFunctionCountCorrelationIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketCorrelationFunctionCountCorrelationIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The total number of documents that initially created the expectations. It’s required to be greater @@ -36,8 +113,11 @@ public sealed partial class BucketCorrelationFunctionCountCorrelationIndicator /// to which the term values are correlated. /// /// - [JsonInclude, JsonPropertyName("doc_count")] - public int DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DocCount { get; set; } /// /// @@ -45,8 +125,11 @@ public sealed partial class BucketCorrelationFunctionCountCorrelationIndicator /// The length of this value must always equal the number of buckets returned by the bucket_path. /// /// - [JsonInclude, JsonPropertyName("expectations")] - public ICollection Expectations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Expectations { get; set; } /// /// @@ -55,21 +138,27 @@ public sealed partial class BucketCorrelationFunctionCountCorrelationIndicator /// must equal expectations. /// /// - [JsonInclude, JsonPropertyName("fractions")] - public ICollection? Fractions { get; set; } + public System.Collections.Generic.ICollection? Fractions { get; set; } } -public sealed partial class BucketCorrelationFunctionCountCorrelationIndicatorDescriptor : SerializableDescriptor +public readonly partial struct BucketCorrelationFunctionCountCorrelationIndicatorDescriptor { - internal BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator Instance { get; init; } - public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator instance) { + Instance = instance; } - private int DocCountValue { get; set; } - private ICollection ExpectationsValue { get; set; } - private ICollection? FractionsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator(Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor descriptor) => descriptor.Instance; /// /// @@ -78,10 +167,22 @@ public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor() : base() /// to which the term values are correlated. /// /// - public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor DocCount(int docCount) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor DocCount(int value) + { + Instance.DocCount = value; + return this; + } + + /// + /// + /// An array of numbers with which to correlate the configured bucket_path values. + /// The length of this value must always equal the number of buckets returned by the bucket_path. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Expectations(System.Collections.Generic.ICollection value) { - DocCountValue = docCount; - return Self; + Instance.Expectations = value; + return this; } /// @@ -90,10 +191,10 @@ public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor DocCount(int /// The length of this value must always equal the number of buckets returned by the bucket_path. /// /// - public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Expectations(ICollection expectations) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Expectations(params double[] values) { - ExpectationsValue = expectations; - return Self; + Instance.Expectations = [.. values]; + return this; } /// @@ -103,25 +204,30 @@ public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Expectations /// must equal expectations. /// /// - public BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Fractions(ICollection? fractions) + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Fractions(System.Collections.Generic.ICollection? value) { - FractionsValue = fractions; - return Self; + Instance.Fractions = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of fractions to use when averaging and calculating variance. This should be used if + /// the pre-calculated data and the buckets_path have known gaps. The length of fractions, if provided, + /// must equal expectations. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor Fractions(params double[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("doc_count"); - writer.WriteNumberValue(DocCountValue); - writer.WritePropertyName("expectations"); - JsonSerializer.Serialize(writer, ExpectationsValue, options); - if (FractionsValue is not null) - { - writer.WritePropertyName("fractions"); - JsonSerializer.Serialize(writer, FractionsValue, options); - } + Instance.Fractions = [.. values]; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicatorDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketCorrelationFunctionCountCorrelationIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketKsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketKsAggregation.g.cs index c7b09fb91d9..ee4fc75c001 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketKsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketKsAggregation.g.cs @@ -17,16 +17,78 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketKsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAlternative = System.Text.Json.JsonEncodedText.Encode("alternative"); + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFractions = System.Text.Json.JsonEncodedText.Encode("fractions"); + private static readonly System.Text.Json.JsonEncodedText PropSamplingMethod = System.Text.Json.JsonEncodedText.Encode("sampling_method"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAlternative = default; + LocalJsonValue propBucketsPath = default; + LocalJsonValue?> propFractions = default; + LocalJsonValue propSamplingMethod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlternative.TryReadProperty(ref reader, options, PropAlternative, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFractions.TryReadProperty(ref reader, options, PropFractions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSamplingMethod.TryReadProperty(ref reader, options, PropSamplingMethod, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alternative = propAlternative.Value, + BucketsPath = propBucketsPath.Value, + Fractions = propFractions.Value, + SamplingMethod = propSamplingMethod.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlternative, value.Alternative, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFractions, value.Fractions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSamplingMethod, value.SamplingMethod, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A sibling pipeline aggregation which executes a two sample Kolmogorov–Smirnov test (referred @@ -40,8 +102,25 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; /// to each term. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationConverter))] public sealed partial class BucketKsAggregation { +#if NET7_0_OR_GREATER + public BucketKsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public BucketKsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketKsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of string values indicating which K-S test alternative to calculate. The valid values @@ -49,16 +128,14 @@ public sealed partial class BucketKsAggregation /// when calculating the K-S test. Default value is all possible alternative hypotheses. /// /// - [JsonInclude, JsonPropertyName("alternative")] - public ICollection? Alternative { get; set; } + public System.Collections.Generic.ICollection? Alternative { get; set; } /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -69,8 +146,7 @@ public sealed partial class BucketKsAggregation /// metric to define the bucket end points. /// /// - [JsonInclude, JsonPropertyName("fractions")] - public ICollection? Fractions { get; set; } + public System.Collections.Generic.ICollection? Fractions { get; set; } /// /// @@ -80,10 +156,7 @@ public sealed partial class BucketKsAggregation /// and lower_tail. /// /// - [JsonInclude, JsonPropertyName("sampling_method")] public string? SamplingMethod { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BucketKsAggregation bucketKsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.BucketCountKsTest(bucketKsAggregation); } /// @@ -99,18 +172,24 @@ public sealed partial class BucketKsAggregation /// to each term. /// /// -public sealed partial class BucketKsAggregationDescriptor : SerializableDescriptor +public readonly partial struct BucketKsAggregationDescriptor { - internal BucketKsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketKsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation instance) + { + Instance = instance; + } - public BucketKsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketKsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? AlternativeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private ICollection? FractionsValue { get; set; } - private string? SamplingMethodValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -119,10 +198,23 @@ public BucketKsAggregationDescriptor() : base() /// when calculating the K-S test. Default value is all possible alternative hypotheses. /// /// - public BucketKsAggregationDescriptor Alternative(ICollection? alternative) + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor Alternative(System.Collections.Generic.ICollection? value) { - AlternativeValue = alternative; - return Self; + Instance.Alternative = value; + return this; + } + + /// + /// + /// A list of string values indicating which K-S test alternative to calculate. The valid values + /// are: "greater", "less", "two_sided". This parameter is key for determining the K-S statistic used + /// when calculating the K-S test. Default value is all possible alternative hypotheses. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor Alternative(params string[] values) + { + Instance.Alternative = [.. values]; + return this; } /// @@ -130,10 +222,10 @@ public BucketKsAggregationDescriptor Alternative(ICollection? alternativ /// Path to the buckets that contain one set of values to correlate. /// /// - public BucketKsAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -145,10 +237,25 @@ public BucketKsAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.A /// metric to define the bucket end points. /// /// - public BucketKsAggregationDescriptor Fractions(ICollection? fractions) + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor Fractions(System.Collections.Generic.ICollection? value) { - FractionsValue = fractions; - return Self; + Instance.Fractions = value; + return this; + } + + /// + /// + /// A list of doubles indicating the distribution of the samples with which to compare to the buckets_path results. + /// In typical usage this is the overall proportion of documents in each bucket, which is compared with the actual + /// document proportions in each bucket from the sibling aggregation counts. The default is to assume that overall + /// documents are uniformly distributed on these buckets, which they would be if one used equal percentiles of a + /// metric to define the bucket end points. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor Fractions(params double[] values) + { + Instance.Fractions = [.. values]; + return this; } /// @@ -159,39 +266,22 @@ public BucketKsAggregationDescriptor Fractions(ICollection? fractions) /// and lower_tail. /// /// - public BucketKsAggregationDescriptor SamplingMethod(string? samplingMethod) + public Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor SamplingMethod(string? value) { - SamplingMethodValue = samplingMethod; - return Self; + Instance.SamplingMethod = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (AlternativeValue is not null) - { - writer.WritePropertyName("alternative"); - JsonSerializer.Serialize(writer, AlternativeValue, options); - } - - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (FractionsValue is not null) + if (action is null) { - writer.WritePropertyName("fractions"); - JsonSerializer.Serialize(writer, FractionsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(SamplingMethodValue)) - { - writer.WritePropertyName("sampling_method"); - writer.WriteStringValue(SamplingMethodValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketKsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketMetricValueAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketMetricValueAggregate.g.cs index 1a32f623f8b..bb08fda0587 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketMetricValueAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketMetricValueAggregate.g.cs @@ -17,22 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class BucketMetricValueAggregate : IAggregate +internal sealed partial class BucketMetricValueAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropKeys = System.Text.Json.JsonEncodedText.Encode("keys"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketMetricValueAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propKeys = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propKeys.TryReadProperty(ref reader, options, PropKeys, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketMetricValueAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Keys = propKeys.Value, + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketMetricValueAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropKeys, value.Keys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketMetricValueAggregateConverter))] +public sealed partial class BucketMetricValueAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("keys")] - public IReadOnlyCollection Keys { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketMetricValueAggregate(System.Collections.Generic.IReadOnlyCollection keys, double? value) + { + Keys = keys; + Value = value; + } +#if NET7_0_OR_GREATER + public BucketMetricValueAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketMetricValueAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketMetricValueAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Keys { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "bucket_metric_value"; /// /// @@ -40,8 +130,10 @@ public sealed partial class BucketMetricValueAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketScriptAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketScriptAggregation.g.cs index 8ed84cf8630..1710fb3031a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketScriptAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketScriptAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketScriptAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationConverter))] public sealed partial class BucketScriptAggregation { +#if NET7_0_OR_GREATER + public BucketScriptAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public BucketScriptAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketScriptAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class BucketScriptAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class BucketScriptAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,36 +135,37 @@ public sealed partial class BucketScriptAggregation /// The script to run for this aggregation. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BucketScriptAggregation bucketScriptAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.BucketScript(bucketScriptAggregation); } -public sealed partial class BucketScriptAggregationDescriptor : SerializableDescriptor +public readonly partial struct BucketScriptAggregationDescriptor { - internal BucketScriptAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation Instance { get; init; } - public BucketScriptAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketScriptAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketScriptAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public BucketScriptAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -97,10 +174,10 @@ public BucketScriptAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsear /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public BucketScriptAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -108,10 +185,10 @@ public BucketScriptAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public BucketScriptAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -119,67 +196,44 @@ public BucketScriptAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch /// The script to run for this aggregation. /// /// - public BucketScriptAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public BucketScriptAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run for this aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public BucketScriptAggregationDescriptor Script(Action configure) + /// + /// + /// The script to run for this aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketScriptAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSelectorAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSelectorAggregation.g.cs index 7fcaa48e287..3ddde26218a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSelectorAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSelectorAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketSelectorAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationConverter))] public sealed partial class BucketSelectorAggregation { +#if NET7_0_OR_GREATER + public BucketSelectorAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public BucketSelectorAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class BucketSelectorAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class BucketSelectorAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,36 +135,37 @@ public sealed partial class BucketSelectorAggregation /// The script to run for this aggregation. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BucketSelectorAggregation bucketSelectorAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.BucketSelector(bucketSelectorAggregation); } -public sealed partial class BucketSelectorAggregationDescriptor : SerializableDescriptor +public readonly partial struct BucketSelectorAggregationDescriptor { - internal BucketSelectorAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation Instance { get; init; } - public BucketSelectorAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSelectorAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSelectorAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public BucketSelectorAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -97,10 +174,10 @@ public BucketSelectorAggregationDescriptor BucketsPath(Elastic.Clients.Elasticse /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public BucketSelectorAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -108,10 +185,10 @@ public BucketSelectorAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public BucketSelectorAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -119,67 +196,44 @@ public BucketSelectorAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsear /// The script to run for this aggregation. /// /// - public BucketSelectorAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public BucketSelectorAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The script to run for this aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public BucketSelectorAggregationDescriptor Script(Action configure) + /// + /// + /// The script to run for this aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketSelectorAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSortAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSortAggregation.g.cs index 85b70e68f2b..9cbe5dac0a9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSortAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/BucketSortAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketSortAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + GapPolicy = propGapPolicy.Value, + Size = propSize.Value, + Sort = propSort.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationConverter))] public sealed partial class BucketSortAggregation { +#if NET7_0_OR_GREATER + public BucketSortAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public BucketSortAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Buckets in positions prior to from will be truncated. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -42,7 +120,6 @@ public sealed partial class BucketSortAggregation /// The policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class BucketSortAggregation /// Defaults to all buckets of the parent aggregation. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -59,38 +135,37 @@ public sealed partial class BucketSortAggregation /// The list of fields to sort on. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(BucketSortAggregation bucketSortAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.BucketSort(bucketSortAggregation); + public System.Collections.Generic.ICollection? Sort { get; set; } } -public sealed partial class BucketSortAggregationDescriptor : SerializableDescriptor> +public readonly partial struct BucketSortAggregationDescriptor { - internal BucketSortAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation Instance { get; init; } - public BucketSortAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSortAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation instance) { + Instance = instance; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSortAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Buckets in positions prior to from will be truncated. /// /// - public BucketSortAggregationDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -98,10 +173,10 @@ public BucketSortAggregationDescriptor From(int? from) /// The policy to apply when gaps are found in the data. /// /// - public BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -110,10 +185,10 @@ public BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elas /// Defaults to all buckets of the parent aggregation. /// /// - public BucketSortAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -121,121 +196,82 @@ public BucketSortAggregationDescriptor Size(int? size) /// The list of fields to sort on. /// /// - public BucketSortAggregationDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public BucketSortAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) - { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; - } - - public BucketSortAggregationDescriptor Sort(Action> configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } - - public BucketSortAggregationDescriptor Sort(params Action>[] configure) + /// + /// + /// The list of fields to sort on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The list of fields to sort on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (GapPolicyValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class BucketSortAggregationDescriptor : SerializableDescriptor +public readonly partial struct BucketSortAggregationDescriptor { - internal BucketSortAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation Instance { get; init; } - public BucketSortAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSortAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation instance) { + Instance = instance; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSortAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Buckets in positions prior to from will be truncated. /// /// - public BucketSortAggregationDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -243,10 +279,10 @@ public BucketSortAggregationDescriptor From(int? from) /// The policy to apply when gaps are found in the data. /// /// - public BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -255,10 +291,10 @@ public BucketSortAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.A /// Defaults to all buckets of the parent aggregation. /// /// - public BucketSortAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -266,92 +302,67 @@ public BucketSortAggregationDescriptor Size(int? size) /// The list of fields to sort on. /// /// - public BucketSortAggregationDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public BucketSortAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = value; + return this; } - public BucketSortAggregationDescriptor Sort(Action configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } - - public BucketSortAggregationDescriptor Sort(params Action[] configure) + /// + /// + /// The list of fields to sort on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The list of fields to sort on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(params System.Action[] actions) { - writer.WriteStartObject(); - if (FromValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } + Instance.Sort = items; + return this; + } - if (SizeValue.HasValue) + /// + /// + /// The list of fields to sort on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + return new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.BucketSortAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs index f1357abc016..f2370484779 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs @@ -17,32 +17,297 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class BucketsConverter : System.Text.Json.Serialization.JsonConverter> +{ + public override Elastic.Clients.Elasticsearch.Aggregations.Buckets Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Aggregations.Buckets(reader.ReadValue>(options, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Aggregations.Buckets(reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.Buckets)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.Buckets value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +internal sealed partial class BucketsConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(Buckets<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(BucketsConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + /// /// /// Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for /// the different buckets, the result is a dictionary. /// /// -public sealed partial class Buckets : Union, IReadOnlyCollection> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.BucketsConverterFactory))] +public sealed partial class Buckets : Elastic.Clients.Elasticsearch.Union, System.Collections.Generic.ICollection> +{ + public Buckets(System.Collections.Generic.IDictionary value) : base(value) + { + } + + public Buckets(System.Collections.Generic.ICollection value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Buckets(System.Collections.Generic.Dictionary value) => new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Buckets(TBucket[] value) => new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); +} + +public readonly partial struct BucketsOfQueryFactory { - public Buckets(IReadOnlyDictionary Keyed) : base(Keyed) + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Collections.Generic.IDictionary value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed() + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action>? action) { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets([.. values]); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Buckets Build(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketsOfQueryFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct BucketsOfQueryFactory +{ + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Collections.Generic.IDictionary value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed() + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action? action) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action>? action) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets([.. values]); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Buckets Build(System.Func> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketsOfQueryFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct BucketsOfApiKeyQueryFactory +{ + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Collections.Generic.IDictionary value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed() + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action>? action) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params Elastic.Clients.Elasticsearch.Security.ApiKeyQuery[] values) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets([.. values]); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Buckets Build(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketsOfApiKeyQueryFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct BucketsOfApiKeyQueryFactory +{ + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Collections.Generic.IDictionary value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed() + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action? action) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Keyed(System.Action>? action) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyQuery.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params Elastic.Clients.Elasticsearch.Security.ApiKeyQuery[] values) + { + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets([.. values]); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); + } + + public Elastic.Clients.Elasticsearch.Aggregations.Buckets Array(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action)); + } + + return new Elastic.Clients.Elasticsearch.Aggregations.Buckets(items); } - public Buckets(IReadOnlyCollection Array) : base(Array) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.Buckets Build(System.Func> action) { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.BucketsOfApiKeyQueryFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregate.g.cs index 945b2e1ae39..21b872512b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class CardinalityAggregate : IAggregate +internal sealed partial class CardinalityAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("value")] - public long Value { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregateConverter))] +public sealed partial class CardinalityAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CardinalityAggregate(long value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public CardinalityAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CardinalityAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CardinalityAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "cardinality"; + + public +#if NET7_0_OR_GREATER + required +#endif + long Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs index 3d7bb42a6de..2df42a5f795 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CardinalityAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExecutionHint = System.Text.Json.JsonEncodedText.Encode("execution_hint"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropPrecisionThreshold = System.Text.Json.JsonEncodedText.Encode("precision_threshold"); + private static readonly System.Text.Json.JsonEncodedText PropRehash = System.Text.Json.JsonEncodedText.Encode("rehash"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExecutionHint = default; + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propPrecisionThreshold = default; + LocalJsonValue propRehash = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExecutionHint.TryReadProperty(ref reader, options, PropExecutionHint, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propPrecisionThreshold.TryReadProperty(ref reader, options, PropPrecisionThreshold, null)) + { + continue; + } + + if (propRehash.TryReadProperty(ref reader, options, PropRehash, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExecutionHint = propExecutionHint.Value, + Field = propField.Value, + Missing = propMissing.Value, + PrecisionThreshold = propPrecisionThreshold.Value, + Rehash = propRehash.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExecutionHint, value.ExecutionHint, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropPrecisionThreshold, value.PrecisionThreshold, null, null); + writer.WriteProperty(options, PropRehash, value.Rehash, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationConverter))] public sealed partial class CardinalityAggregation { +#if NET7_0_OR_GREATER + public CardinalityAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CardinalityAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Mechanism by which cardinality aggregations is run. /// /// - [JsonInclude, JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? ExecutionHint { get; set; } /// @@ -42,7 +138,6 @@ public sealed partial class CardinalityAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -51,8 +146,7 @@ public sealed partial class CardinalityAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// @@ -60,54 +154,39 @@ public sealed partial class CardinalityAggregation /// This allows to trade memory for accuracy. /// /// - [JsonInclude, JsonPropertyName("precision_threshold")] public int? PrecisionThreshold { get; set; } - [JsonInclude, JsonPropertyName("rehash")] public bool? Rehash { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Cardinality(cardinalityAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Cardinality(cardinalityAggregation); } -public sealed partial class CardinalityAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CardinalityAggregationDescriptor { - internal CardinalityAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation Instance { get; init; } - public CardinalityAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private int? PrecisionThresholdValue { get; set; } - private bool? RehashValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Mechanism by which cardinality aggregations is run. - /// - /// - public CardinalityAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? executionHint) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CardinalityAggregationDescriptor() { - ExecutionHintValue = executionHint; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Mechanism by which cardinality aggregations is run. /// /// - public CardinalityAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -115,10 +194,10 @@ public CardinalityAggregationDescriptor Field(Elastic.Clients.Elastic /// The field on which to run the aggregation. /// /// - public CardinalityAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -126,10 +205,10 @@ public CardinalityAggregationDescriptor Field(Expression /// - public CardinalityAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -138,10 +217,10 @@ public CardinalityAggregationDescriptor Field(Expression /// - public CardinalityAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -150,132 +229,78 @@ public CardinalityAggregationDescriptor Missing(Elastic.Clients.Elast /// This allows to trade memory for accuracy. /// /// - public CardinalityAggregationDescriptor PrecisionThreshold(int? precisionThreshold) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor PrecisionThreshold(int? value) { - PrecisionThresholdValue = precisionThreshold; - return Self; + Instance.PrecisionThreshold = value; + return this; } - public CardinalityAggregationDescriptor Rehash(bool? rehash = true) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Rehash(bool? value = true) { - RehashValue = rehash; - return Self; + Instance.Rehash = value; + return this; } - public CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CardinalityAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PrecisionThresholdValue.HasValue) - { - writer.WritePropertyName("precision_threshold"); - writer.WriteNumberValue(PrecisionThresholdValue.Value); - } - - if (RehashValue.HasValue) - { - writer.WritePropertyName("rehash"); - writer.WriteBooleanValue(RehashValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CardinalityAggregationDescriptor : SerializableDescriptor +public readonly partial struct CardinalityAggregationDescriptor { - internal CardinalityAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation Instance { get; init; } - public CardinalityAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private int? PrecisionThresholdValue { get; set; } - private bool? RehashValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Mechanism by which cardinality aggregations is run. - /// - /// - public CardinalityAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? executionHint) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CardinalityAggregationDescriptor() { - ExecutionHintValue = executionHint; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Mechanism by which cardinality aggregations is run. /// /// - public CardinalityAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -283,10 +308,10 @@ public CardinalityAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// The field on which to run the aggregation. /// /// - public CardinalityAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -294,10 +319,10 @@ public CardinalityAggregationDescriptor Field(Expression /// - public CardinalityAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -306,10 +331,10 @@ public CardinalityAggregationDescriptor Field(Expression /// - public CardinalityAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -318,91 +343,46 @@ public CardinalityAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Fi /// This allows to trade memory for accuracy. /// /// - public CardinalityAggregationDescriptor PrecisionThreshold(int? precisionThreshold) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor PrecisionThreshold(int? value) { - PrecisionThresholdValue = precisionThreshold; - return Self; + Instance.PrecisionThreshold = value; + return this; } - public CardinalityAggregationDescriptor Rehash(bool? rehash = true) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Rehash(bool? value = true) { - RehashValue = rehash; - return Self; + Instance.Rehash = value; + return this; } - public CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CardinalityAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CardinalityAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PrecisionThresholdValue.HasValue) - { - writer.WritePropertyName("precision_threshold"); - writer.WriteNumberValue(PrecisionThresholdValue.Value); - } - - if (RehashValue.HasValue) - { - writer.WritePropertyName("rehash"); - writer.WriteBooleanValue(RehashValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAggregation.g.cs index a5e2dd5fc50..53270d68ce2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAggregation.g.cs @@ -17,16 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CategorizeTextAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCategorizationAnalyzer = System.Text.Json.JsonEncodedText.Encode("categorization_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFilters = System.Text.Json.JsonEncodedText.Encode("categorization_filters"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMaxMatchedTokens = System.Text.Json.JsonEncodedText.Encode("max_matched_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropMaxUniqueTokens = System.Text.Json.JsonEncodedText.Encode("max_unique_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarityThreshold = System.Text.Json.JsonEncodedText.Encode("similarity_threshold"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCategorizationAnalyzer = default; + LocalJsonValue?> propCategorizationFilters = default; + LocalJsonValue propField = default; + LocalJsonValue propMaxMatchedTokens = default; + LocalJsonValue propMaxUniqueTokens = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSimilarityThreshold = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCategorizationAnalyzer.TryReadProperty(ref reader, options, PropCategorizationAnalyzer, null)) + { + continue; + } + + if (propCategorizationFilters.TryReadProperty(ref reader, options, PropCategorizationFilters, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMaxMatchedTokens.TryReadProperty(ref reader, options, PropMaxMatchedTokens, null)) + { + continue; + } + + if (propMaxUniqueTokens.TryReadProperty(ref reader, options, PropMaxUniqueTokens, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSimilarityThreshold.TryReadProperty(ref reader, options, PropSimilarityThreshold, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CategorizationAnalyzer = propCategorizationAnalyzer.Value, + CategorizationFilters = propCategorizationFilters.Value, + Field = propField.Value, + MaxMatchedTokens = propMaxMatchedTokens.Value, + MaxUniqueTokens = propMaxUniqueTokens.Value, + MinDocCount = propMinDocCount.Value, + ShardMinDocCount = propShardMinDocCount.Value, + ShardSize = propShardSize.Value, + SimilarityThreshold = propSimilarityThreshold.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCategorizationAnalyzer, value.CategorizationAnalyzer, null, null); + writer.WriteProperty(options, PropCategorizationFilters, value.CategorizationFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMaxMatchedTokens, value.MaxMatchedTokens, null, null); + writer.WriteProperty(options, PropMaxUniqueTokens, value.MaxUniqueTokens, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSimilarityThreshold, value.SimilarityThreshold, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A multi-bucket aggregation that groups semi-structured text into buckets. Each text @@ -35,8 +151,31 @@ namespace Elastic.Clients.Elasticsearch.Aggregations; /// generated text like system logs. Only the first 100 analyzed tokens are used to categorize the text. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationConverter))] public sealed partial class CategorizeTextAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public CategorizeTextAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CategorizeTextAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The categorization analyzer specifies how the text is analyzed and tokenized before being categorized. @@ -44,7 +183,6 @@ public sealed partial class CategorizeTextAggregation /// cannot be used at the same time as categorization_filters. /// /// - [JsonInclude, JsonPropertyName("categorization_analyzer")] public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? CategorizationAnalyzer { get; set; } /// @@ -58,16 +196,18 @@ public sealed partial class CategorizeTextAggregation /// use the categorization_analyzer property instead and include the filters as pattern_replace character filters. /// /// - [JsonInclude, JsonPropertyName("categorization_filters")] - public ICollection? CategorizationFilters { get; set; } + public System.Collections.Generic.ICollection? CategorizationFilters { get; set; } /// /// /// The semi-structured text field to categorize. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -75,7 +215,6 @@ public sealed partial class CategorizeTextAggregation /// values will use more memory and create narrower categories. Max allowed value is 100. /// /// - [JsonInclude, JsonPropertyName("max_matched_tokens")] public int? MaxMatchedTokens { get; set; } /// @@ -85,7 +224,6 @@ public sealed partial class CategorizeTextAggregation /// create narrower categories. Max allowed value is 100. /// /// - [JsonInclude, JsonPropertyName("max_unique_tokens")] public int? MaxUniqueTokens { get; set; } /// @@ -93,7 +231,6 @@ public sealed partial class CategorizeTextAggregation /// The minimum number of documents in a bucket to be returned to the results. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } /// @@ -101,7 +238,6 @@ public sealed partial class CategorizeTextAggregation /// The minimum number of documents in a bucket to be returned from the shard before merging. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public int? ShardMinDocCount { get; set; } /// @@ -109,7 +245,6 @@ public sealed partial class CategorizeTextAggregation /// The number of categorization buckets to return from each shard before merging all the results. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -119,7 +254,6 @@ public sealed partial class CategorizeTextAggregation /// usage and create narrower categories. /// /// - [JsonInclude, JsonPropertyName("similarity_threshold")] public int? SimilarityThreshold { get; set; } /// @@ -127,10 +261,7 @@ public sealed partial class CategorizeTextAggregation /// The number of buckets to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CategorizeTextAggregation categorizeTextAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.CategorizeText(categorizeTextAggregation); } /// @@ -141,24 +272,24 @@ public sealed partial class CategorizeTextAggregation /// generated text like system logs. Only the first 100 analyzed tokens are used to categorize the text. /// /// -public sealed partial class CategorizeTextAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CategorizeTextAggregationDescriptor { - internal CategorizeTextAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizeTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation instance) + { + Instance = instance; + } - public CategorizeTextAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizeTextAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? CategorizationAnalyzerValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxMatchedTokensValue { get; set; } - private int? MaxUniqueTokensValue { get; set; } - private int? MinDocCountValue { get; set; } - private int? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SimilarityThresholdValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -167,10 +298,23 @@ public CategorizeTextAggregationDescriptor() : base() /// cannot be used at the same time as categorization_filters. /// /// - public CategorizeTextAggregationDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? categorizationAnalyzer) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? value) { - CategorizationAnalyzerValue = categorizationAnalyzer; - return Self; + Instance.CategorizationAnalyzer = value; + return this; + } + + /// + /// + /// The categorization analyzer specifies how the text is analyzed and tokenized before being categorized. + /// The syntax is very similar to that used to define the analyzer in the Analyze endpoint. This property + /// cannot be used at the same time as categorization_filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationAnalyzer(System.Func action) + { + Instance.CategorizationAnalyzer = Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzerFactory.Build(action); + return this; } /// @@ -184,21 +328,27 @@ public CategorizeTextAggregationDescriptor CategorizationAnalyzer(Ela /// use the categorization_analyzer property instead and include the filters as pattern_replace character filters. /// /// - public CategorizeTextAggregationDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = value; + return this; } /// /// - /// The semi-structured text field to categorize. + /// This property expects an array of regular expressions. The expressions are used to filter out matching + /// sequences from the categorization field values. You can use this functionality to fine tune the categorization + /// by excluding sequences from consideration when categories are defined. For example, you can exclude SQL + /// statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. + /// If you only want to define simple regular expression filters that are applied prior to tokenization, setting + /// this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, + /// use the categorization_analyzer property instead and include the filters as pattern_replace character filters. /// /// - public CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationFilters(params string[] values) { - FieldValue = field; - return Self; + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -206,10 +356,10 @@ public CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elas /// The semi-structured text field to categorize. /// /// - public CategorizeTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -217,10 +367,10 @@ public CategorizeTextAggregationDescriptor Field(Expression /// - public CategorizeTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -229,10 +379,10 @@ public CategorizeTextAggregationDescriptor Field(Expression /// - public CategorizeTextAggregationDescriptor MaxMatchedTokens(int? maxMatchedTokens) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MaxMatchedTokens(int? value) { - MaxMatchedTokensValue = maxMatchedTokens; - return Self; + Instance.MaxMatchedTokens = value; + return this; } /// @@ -242,10 +392,10 @@ public CategorizeTextAggregationDescriptor MaxMatchedTokens(int? maxM /// create narrower categories. Max allowed value is 100. /// /// - public CategorizeTextAggregationDescriptor MaxUniqueTokens(int? maxUniqueTokens) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MaxUniqueTokens(int? value) { - MaxUniqueTokensValue = maxUniqueTokens; - return Self; + Instance.MaxUniqueTokens = value; + return this; } /// @@ -253,10 +403,10 @@ public CategorizeTextAggregationDescriptor MaxUniqueTokens(int? maxUn /// The minimum number of documents in a bucket to be returned to the results. /// /// - public CategorizeTextAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -264,10 +414,10 @@ public CategorizeTextAggregationDescriptor MinDocCount(int? minDocCou /// The minimum number of documents in a bucket to be returned from the shard before merging. /// /// - public CategorizeTextAggregationDescriptor ShardMinDocCount(int? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor ShardMinDocCount(int? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -275,10 +425,10 @@ public CategorizeTextAggregationDescriptor ShardMinDocCount(int? shar /// The number of categorization buckets to return from each shard before merging all the results. /// /// - public CategorizeTextAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -288,10 +438,10 @@ public CategorizeTextAggregationDescriptor ShardSize(int? shardSize) /// usage and create narrower categories. /// /// - public CategorizeTextAggregationDescriptor SimilarityThreshold(int? similarityThreshold) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor SimilarityThreshold(int? value) { - SimilarityThresholdValue = similarityThreshold; - return Self; + Instance.SimilarityThreshold = value; + return this; } /// @@ -299,72 +449,18 @@ public CategorizeTextAggregationDescriptor SimilarityThreshold(int? s /// The number of buckets to return. /// /// - public CategorizeTextAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (CategorizationAnalyzerValue is not null) - { - writer.WritePropertyName("categorization_analyzer"); - JsonSerializer.Serialize(writer, CategorizationAnalyzerValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MaxMatchedTokensValue.HasValue) - { - writer.WritePropertyName("max_matched_tokens"); - writer.WriteNumberValue(MaxMatchedTokensValue.Value); - } - - if (MaxUniqueTokensValue.HasValue) - { - writer.WritePropertyName("max_unique_tokens"); - writer.WriteNumberValue(MaxUniqueTokensValue.Value); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SimilarityThresholdValue.HasValue) - { - writer.WritePropertyName("similarity_threshold"); - writer.WriteNumberValue(SimilarityThresholdValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } @@ -376,24 +472,24 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// generated text like system logs. Only the first 100 analyzed tokens are used to categorize the text. /// /// -public sealed partial class CategorizeTextAggregationDescriptor : SerializableDescriptor +public readonly partial struct CategorizeTextAggregationDescriptor { - internal CategorizeTextAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizeTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation instance) + { + Instance = instance; + } - public CategorizeTextAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizeTextAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? CategorizationAnalyzerValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxMatchedTokensValue { get; set; } - private int? MaxUniqueTokensValue { get; set; } - private int? MinDocCountValue { get; set; } - private int? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SimilarityThresholdValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -402,10 +498,23 @@ public CategorizeTextAggregationDescriptor() : base() /// cannot be used at the same time as categorization_filters. /// /// - public CategorizeTextAggregationDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? categorizationAnalyzer) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer? value) { - CategorizationAnalyzerValue = categorizationAnalyzer; - return Self; + Instance.CategorizationAnalyzer = value; + return this; + } + + /// + /// + /// The categorization analyzer specifies how the text is analyzed and tokenized before being categorized. + /// The syntax is very similar to that used to define the analyzer in the Analyze endpoint. This property + /// cannot be used at the same time as categorization_filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationAnalyzer(System.Func action) + { + Instance.CategorizationAnalyzer = Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzerFactory.Build(action); + return this; } /// @@ -419,21 +528,27 @@ public CategorizeTextAggregationDescriptor CategorizationAnalyzer(Elastic.Client /// use the categorization_analyzer property instead and include the filters as pattern_replace character filters. /// /// - public CategorizeTextAggregationDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = value; + return this; } /// /// - /// The semi-structured text field to categorize. + /// This property expects an array of regular expressions. The expressions are used to filter out matching + /// sequences from the categorization field values. You can use this functionality to fine tune the categorization + /// by excluding sequences from consideration when categories are defined. For example, you can exclude SQL + /// statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. + /// If you only want to define simple regular expression filters that are applied prior to tokenization, setting + /// this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, + /// use the categorization_analyzer property instead and include the filters as pattern_replace character filters. /// /// - public CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor CategorizationFilters(params string[] values) { - FieldValue = field; - return Self; + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -441,10 +556,10 @@ public CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.F /// The semi-structured text field to categorize. /// /// - public CategorizeTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -452,10 +567,10 @@ public CategorizeTextAggregationDescriptor Field(Expression /// - public CategorizeTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -464,10 +579,10 @@ public CategorizeTextAggregationDescriptor Field(Expression /// - public CategorizeTextAggregationDescriptor MaxMatchedTokens(int? maxMatchedTokens) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MaxMatchedTokens(int? value) { - MaxMatchedTokensValue = maxMatchedTokens; - return Self; + Instance.MaxMatchedTokens = value; + return this; } /// @@ -477,10 +592,10 @@ public CategorizeTextAggregationDescriptor MaxMatchedTokens(int? maxMatchedToken /// create narrower categories. Max allowed value is 100. /// /// - public CategorizeTextAggregationDescriptor MaxUniqueTokens(int? maxUniqueTokens) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MaxUniqueTokens(int? value) { - MaxUniqueTokensValue = maxUniqueTokens; - return Self; + Instance.MaxUniqueTokens = value; + return this; } /// @@ -488,10 +603,10 @@ public CategorizeTextAggregationDescriptor MaxUniqueTokens(int? maxUniqueTokens) /// The minimum number of documents in a bucket to be returned to the results. /// /// - public CategorizeTextAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -499,10 +614,10 @@ public CategorizeTextAggregationDescriptor MinDocCount(int? minDocCount) /// The minimum number of documents in a bucket to be returned from the shard before merging. /// /// - public CategorizeTextAggregationDescriptor ShardMinDocCount(int? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor ShardMinDocCount(int? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -510,10 +625,10 @@ public CategorizeTextAggregationDescriptor ShardMinDocCount(int? shardMinDocCoun /// The number of categorization buckets to return from each shard before merging all the results. /// /// - public CategorizeTextAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -523,10 +638,10 @@ public CategorizeTextAggregationDescriptor ShardSize(int? shardSize) /// usage and create narrower categories. /// /// - public CategorizeTextAggregationDescriptor SimilarityThreshold(int? similarityThreshold) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor SimilarityThreshold(int? value) { - SimilarityThresholdValue = similarityThreshold; - return Self; + Instance.SimilarityThreshold = value; + return this; } /// @@ -534,71 +649,17 @@ public CategorizeTextAggregationDescriptor SimilarityThreshold(int? similarityTh /// The number of buckets to return. /// /// - public CategorizeTextAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (CategorizationAnalyzerValue is not null) - { - writer.WritePropertyName("categorization_analyzer"); - JsonSerializer.Serialize(writer, CategorizationAnalyzerValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MaxMatchedTokensValue.HasValue) - { - writer.WritePropertyName("max_matched_tokens"); - writer.WriteNumberValue(MaxMatchedTokensValue.Value); - } - - if (MaxUniqueTokensValue.HasValue) - { - writer.WritePropertyName("max_unique_tokens"); - writer.WriteNumberValue(MaxUniqueTokensValue.Value); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SimilarityThresholdValue.HasValue) - { - writer.WritePropertyName("similarity_threshold"); - writer.WriteNumberValue(SimilarityThresholdValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAnalyzer.g.cs index 8cba621b3b1..791c320f240 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CategorizeTextAnalyzer.g.cs @@ -17,26 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class CategorizeTextAnalyzer : Union +internal sealed partial class CategorizeTextAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzerConverter))] +public sealed partial class CategorizeTextAnalyzer : Elastic.Clients.Elasticsearch.Union +{ + public CategorizeTextAnalyzer(string value) : base(value) + { + } + + public CategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(string value) => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(value); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer value) => new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(value); +} + +public readonly partial struct CategorizeTextAnalyzerFactory { - public CategorizeTextAnalyzer(string Builtin) : base(Builtin) + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Builtin(string value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Custom(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Custom() + { + return new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Custom(System.Action? action) { + return new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor.Build(action)); } - public CategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer Custom) : base(Custom) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzer Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CategorizeTextAnalyzerFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs index c26d8eb168e..4f6be03a106 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChiSquareHeuristic.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ChiSquareHeuristicConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackgroundIsSuperset = System.Text.Json.JsonEncodedText.Encode("background_is_superset"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeNegatives = System.Text.Json.JsonEncodedText.Encode("include_negatives"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackgroundIsSuperset = default; + LocalJsonValue propIncludeNegatives = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackgroundIsSuperset.TryReadProperty(ref reader, options, PropBackgroundIsSuperset, null)) + { + continue; + } + + if (propIncludeNegatives.TryReadProperty(ref reader, options, PropIncludeNegatives, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackgroundIsSuperset = propBackgroundIsSuperset.Value, + IncludeNegatives = propIncludeNegatives.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackgroundIsSuperset, value.BackgroundIsSuperset, null, null); + writer.WriteProperty(options, PropIncludeNegatives, value.IncludeNegatives, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicConverter))] public sealed partial class ChiSquareHeuristic { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChiSquareHeuristic(bool backgroundIsSuperset, bool includeNegatives) + { + BackgroundIsSuperset = backgroundIsSuperset; + IncludeNegatives = includeNegatives; + } +#if NET7_0_OR_GREATER + public ChiSquareHeuristic() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ChiSquareHeuristic() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChiSquareHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - [JsonInclude, JsonPropertyName("background_is_superset")] - public bool BackgroundIsSuperset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool BackgroundIsSuperset { get; set; } /// /// /// Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. /// /// - [JsonInclude, JsonPropertyName("include_negatives")] - public bool IncludeNegatives { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IncludeNegatives { get; set; } } -public sealed partial class ChiSquareHeuristicDescriptor : SerializableDescriptor +public readonly partial struct ChiSquareHeuristicDescriptor { - internal ChiSquareHeuristicDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic Instance { get; init; } - public ChiSquareHeuristicDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChiSquareHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic instance) { + Instance = instance; } - private bool BackgroundIsSupersetValue { get; set; } - private bool IncludeNegativesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChiSquareHeuristicDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic instance) => new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor descriptor) => descriptor.Instance; /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - public ChiSquareHeuristicDescriptor BackgroundIsSuperset(bool backgroundIsSuperset = true) + public Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor BackgroundIsSuperset(bool value = true) { - BackgroundIsSupersetValue = backgroundIsSuperset; - return Self; + Instance.BackgroundIsSuperset = value; + return this; } /// @@ -73,19 +155,17 @@ public ChiSquareHeuristicDescriptor BackgroundIsSuperset(bool backgroundIsSupers /// Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. /// /// - public ChiSquareHeuristicDescriptor IncludeNegatives(bool includeNegatives = true) + public Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor IncludeNegatives(bool value = true) { - IncludeNegativesValue = includeNegatives; - return Self; + Instance.IncludeNegatives = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("background_is_superset"); - writer.WriteBooleanValue(BackgroundIsSupersetValue); - writer.WritePropertyName("include_negatives"); - writer.WriteBooleanValue(IncludeNegativesValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregate.g.cs index 072e2c3f5ca..1be4762cc27 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class ChildrenAggregateConverter : JsonConverter +internal sealed partial class ChildrenAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override ChildrenAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new ChildrenAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, ChildrenAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ChildrenAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(ChildrenAggregateConverter))] -public sealed partial class ChildrenAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregateConverter))] +public sealed partial class ChildrenAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChildrenAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public ChildrenAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ChildrenAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChildrenAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "children"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs index 422d80fff3e..526fd385fc2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ChildrenAggregation.g.cs @@ -17,59 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ChildrenAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationConverter))] public sealed partial class ChildrenAggregation { +#if NET7_0_OR_GREATER + public ChildrenAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ChildrenAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChildrenAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The child type that should be selected. /// /// - [JsonInclude, JsonPropertyName("type")] public string? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ChildrenAggregation childrenAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Children(childrenAggregation); } -public sealed partial class ChildrenAggregationDescriptor : SerializableDescriptor +public readonly partial struct ChildrenAggregationDescriptor { - internal ChildrenAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChildrenAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation instance) + { + Instance = instance; + } - public ChildrenAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChildrenAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation(Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The child type that should be selected. /// /// - public ChildrenAggregationDescriptor Type(string? type) + public Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor Type(string? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(TypeValue)) + if (action is null) { - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); + return new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ChildrenAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregate.g.cs index 600426a0e04..89b8165edfb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregate.g.cs @@ -17,22 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class CompositeAggregate : IAggregate +internal sealed partial class CompositeAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("after_key")] - public IReadOnlyDictionary? AfterKey { get; init; } - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAfterKey = System.Text.Json.JsonEncodedText.Encode("after_key"); + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAfterKey = default; + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAfterKey.TryReadProperty(ref reader, options, PropAfterKey, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AfterKey = propAfterKey.Value, + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAfterKey, value.AfterKey, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregateConverter))] +public sealed partial class CompositeAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public CompositeAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompositeAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? AfterKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "composite"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs index 0c26808c4b1..5e09f2a9319 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs @@ -17,32 +17,100 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAfter = System.Text.Json.JsonEncodedText.Encode("after"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSources = System.Text.Json.JsonEncodedText.Encode("sources"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAfter = default; + LocalJsonValue propSize = default; + LocalJsonValue>?> propSources = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAfter.TryReadProperty(ref reader, options, PropAfter, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSources.TryReadProperty(ref reader, options, PropSources, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + After = propAfter.Value, + Size = propSize.Value, + Sources = propSources.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAfter, value.After, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSources, value.Sources, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationConverter))] public sealed partial class CompositeAggregation { +#if NET7_0_OR_GREATER + public CompositeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompositeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// When paginating, use the after_key value returned in the previous response to retrieve the next page. /// /// - [JsonInclude, JsonPropertyName("after")] - public IDictionary? After { get; set; } + public System.Collections.Generic.IDictionary? After { get; set; } /// /// /// The number of composite buckets that should be returned. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -51,34 +119,73 @@ public sealed partial class CompositeAggregation /// Keys are returned in the order of the sources definition. /// /// - [JsonInclude, JsonPropertyName("sources")] - public ICollection>? Sources { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Composite(compositeAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Composite(compositeAggregation); + public System.Collections.Generic.ICollection>? Sources { get; set; } } -public sealed partial class CompositeAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CompositeAggregationDescriptor { - internal CompositeAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation instance) + { + Instance = instance; + } - public CompositeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary? AfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection>? SourcesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// When paginating, use the after_key value returned in the previous response to retrieve the next page. /// /// - public CompositeAggregationDescriptor After(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After(System.Collections.Generic.IDictionary? value) { - AfterValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.After = value; + return this; + } + + /// + /// + /// When paginating, use the after_key value returned in the previous response to retrieve the next page. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After() + { + Instance.After = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue.Build(null); + return this; + } + + /// + /// + /// When paginating, use the after_key value returned in the previous response to retrieve the next page. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After(System.Action>? action) + { + Instance.After = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor AddAfter(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.FieldValue value) + { + Instance.After ??= new System.Collections.Generic.Dictionary(); + Instance.After.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor AddAfter(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.FieldValue value) + { + Instance.After ??= new System.Collections.Generic.Dictionary(); + Instance.After.Add(key, value); + return this; } /// @@ -86,10 +193,10 @@ public CompositeAggregationDescriptor After(Func /// - public CompositeAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -98,58 +205,131 @@ public CompositeAggregationDescriptor Size(int? size) /// Keys are returned in the order of the sources definition. /// /// - public CompositeAggregationDescriptor Sources(ICollection>? sources) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(System.Collections.Generic.ICollection>? value) { - SourcesValue = sources; - return Self; + Instance.Sources = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The value sources used to build composite buckets. + /// Keys are returned in the order of the sources definition. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(params System.Collections.Generic.IDictionary[] values) { - writer.WriteStartObject(); - if (AfterValue is not null) - { - writer.WritePropertyName("after"); - JsonSerializer.Serialize(writer, AfterValue, options); - } + Instance.Sources = [.. values]; + return this; + } - if (SizeValue.HasValue) + /// + /// + /// The value sources used to build composite buckets. + /// Keys are returned in the order of the sources definition. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource.Build(action)); } - if (SourcesValue is not null) + Instance.Sources = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("sources"); - JsonSerializer.Serialize(writer, SourcesValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompositeAggregationDescriptor : SerializableDescriptor +public readonly partial struct CompositeAggregationDescriptor { - internal CompositeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// When paginating, use the after_key value returned in the previous response to retrieve the next page. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After(System.Collections.Generic.IDictionary? value) + { + Instance.After = value; + return this; + } - public CompositeAggregationDescriptor() : base() + /// + /// + /// When paginating, use the after_key value returned in the previous response to retrieve the next page. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After() { + Instance.After = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue.Build(null); + return this; } - private IDictionary? AfterValue { get; set; } - private int? SizeValue { get; set; } - private ICollection>? SourcesValue { get; set; } + /// + /// + /// When paginating, use the after_key value returned in the previous response to retrieve the next page. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After(System.Action? action) + { + Instance.After = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue.Build(action); + return this; + } /// /// /// When paginating, use the after_key value returned in the previous response to retrieve the next page. /// /// - public CompositeAggregationDescriptor After(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor After(System.Action>? action) + { + Instance.After = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFieldValue.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor AddAfter(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.FieldValue value) + { + Instance.After ??= new System.Collections.Generic.Dictionary(); + Instance.After.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor AddAfter(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.FieldValue value) { - AfterValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.After ??= new System.Collections.Generic.Dictionary(); + Instance.After.Add(key, value); + return this; } /// @@ -157,10 +337,10 @@ public CompositeAggregationDescriptor After(Func /// - public CompositeAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -169,33 +349,70 @@ public CompositeAggregationDescriptor Size(int? size) /// Keys are returned in the order of the sources definition. /// /// - public CompositeAggregationDescriptor Sources(ICollection>? sources) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(System.Collections.Generic.ICollection>? value) { - SourcesValue = sources; - return Self; + Instance.Sources = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The value sources used to build composite buckets. + /// Keys are returned in the order of the sources definition. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(params System.Collections.Generic.IDictionary[] values) { - writer.WriteStartObject(); - if (AfterValue is not null) + Instance.Sources = [.. values]; + return this; + } + + /// + /// + /// The value sources used to build composite buckets. + /// Keys are returned in the order of the sources definition. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(params System.Action?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("after"); - JsonSerializer.Serialize(writer, AfterValue, options); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource.Build(action)); } - if (SizeValue.HasValue) + Instance.Sources = items; + return this; + } + + /// + /// + /// The value sources used to build composite buckets. + /// Keys are returned in the order of the sources definition. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor Sources(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeAggregationSource.Build(action)); } - if (SourcesValue is not null) + Instance.Sources = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("sources"); - JsonSerializer.Serialize(writer, SourcesValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs index 7febc6ed01e..0ed504c8942 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregationSource.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeAggregationSourceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDateHistogram = System.Text.Json.JsonEncodedText.Encode("date_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropGeotileGrid = System.Text.Json.JsonEncodedText.Encode("geotile_grid"); + private static readonly System.Text.Json.JsonEncodedText PropHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDateHistogram = default; + LocalJsonValue propGeotileGrid = default; + LocalJsonValue propHistogram = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDateHistogram.TryReadProperty(ref reader, options, PropDateHistogram, null)) + { + continue; + } + + if (propGeotileGrid.TryReadProperty(ref reader, options, PropGeotileGrid, null)) + { + continue; + } + + if (propHistogram.TryReadProperty(ref reader, options, PropHistogram, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DateHistogram = propDateHistogram.Value, + GeotileGrid = propGeotileGrid.Value, + Histogram = propHistogram.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDateHistogram, value.DateHistogram, null, null); + writer.WriteProperty(options, PropGeotileGrid, value.GeotileGrid, null, null); + writer.WriteProperty(options, PropHistogram, value.Histogram, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceConverter))] public sealed partial class CompositeAggregationSource { +#if NET7_0_OR_GREATER + public CompositeAggregationSource() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompositeAggregationSource() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A date histogram aggregation. /// /// - [JsonInclude, JsonPropertyName("date_histogram")] public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? DateHistogram { get; set; } /// @@ -42,7 +120,6 @@ public sealed partial class CompositeAggregationSource /// A geotile grid aggregation. /// /// - [JsonInclude, JsonPropertyName("geotile_grid")] public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? GeotileGrid { get; set; } /// @@ -50,7 +127,6 @@ public sealed partial class CompositeAggregationSource /// A histogram aggregation. /// /// - [JsonInclude, JsonPropertyName("histogram")] public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? Histogram { get; set; } /// @@ -58,58 +134,59 @@ public sealed partial class CompositeAggregationSource /// A terms aggregation. /// /// - [JsonInclude, JsonPropertyName("terms")] public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? Terms { get; set; } } -public sealed partial class CompositeAggregationSourceDescriptor : SerializableDescriptor> +public readonly partial struct CompositeAggregationSourceDescriptor { - internal CompositeAggregationSourceDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationSourceDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource instance) + { + Instance = instance; + } - public CompositeAggregationSourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationSourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? DateHistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor DateHistogramDescriptor { get; set; } - private Action> DateHistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? GeotileGridValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor GeotileGridDescriptor { get; set; } - private Action> GeotileGridDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? HistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor HistogramDescriptor { get; set; } - private Action> HistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor TermsDescriptor { get; set; } - private Action> TermsDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor descriptor) => descriptor.Instance; /// /// /// A date histogram aggregation. /// /// - public CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? dateHistogram) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? value) { - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = null; - DateHistogramValue = dateHistogram; - return Self; + Instance.DateHistogram = value; + return this; } - public CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor descriptor) + /// + /// + /// A date histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram() { - DateHistogramValue = null; - DateHistogramDescriptorAction = null; - DateHistogramDescriptor = descriptor; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor.Build(null); + return this; } - public CompositeAggregationSourceDescriptor DateHistogram(Action> configure) + /// + /// + /// A date histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram(System.Action>? action) { - DateHistogramValue = null; - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = configure; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor.Build(action); + return this; } /// @@ -117,28 +194,32 @@ public CompositeAggregationSourceDescriptor DateHistogram(Action /// - public CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? geotileGrid) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? value) { - GeotileGridDescriptor = null; - GeotileGridDescriptorAction = null; - GeotileGridValue = geotileGrid; - return Self; + Instance.GeotileGrid = value; + return this; } - public CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor descriptor) + /// + /// + /// A geotile grid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid() { - GeotileGridValue = null; - GeotileGridDescriptorAction = null; - GeotileGridDescriptor = descriptor; - return Self; + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor.Build(null); + return this; } - public CompositeAggregationSourceDescriptor GeotileGrid(Action> configure) + /// + /// + /// A geotile grid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid(System.Action>? action) { - GeotileGridValue = null; - GeotileGridDescriptor = null; - GeotileGridDescriptorAction = configure; - return Self; + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor.Build(action); + return this; } /// @@ -146,28 +227,21 @@ public CompositeAggregationSourceDescriptor GeotileGrid(Action /// - public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? histogram) - { - HistogramDescriptor = null; - HistogramDescriptorAction = null; - HistogramValue = histogram; - return Self; - } - - public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? value) { - HistogramValue = null; - HistogramDescriptorAction = null; - HistogramDescriptor = descriptor; - return Self; + Instance.Histogram = value; + return this; } - public CompositeAggregationSourceDescriptor Histogram(Action> configure) + /// + /// + /// A histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Histogram(System.Action> action) { - HistogramValue = null; - HistogramDescriptor = null; - HistogramDescriptorAction = configure; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor.Build(action); + return this; } /// @@ -175,149 +249,120 @@ public CompositeAggregationSourceDescriptor Histogram(Action /// - public CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? terms) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? value) { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } - public CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor descriptor) + /// + /// + /// A terms aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms() { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptor = descriptor; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor.Build(null); + return this; } - public CompositeAggregationSourceDescriptor Terms(Action> configure) + /// + /// + /// A terms aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms(System.Action>? action) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = configure; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource Build(System.Action>? action) { - writer.WriteStartObject(); - if (DateHistogramDescriptor is not null) + if (action is null) { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramDescriptor, options); - } - else if (DateHistogramDescriptorAction is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(DateHistogramDescriptorAction), options); - } - else if (DateHistogramValue is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GeotileGridDescriptor is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, GeotileGridDescriptor, options); - } - else if (GeotileGridDescriptorAction is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(GeotileGridDescriptorAction), options); - } - else if (GeotileGridValue is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, GeotileGridValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (HistogramDescriptor is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramDescriptor, options); - } - else if (HistogramDescriptorAction is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(HistogramDescriptorAction), options); - } - else if (HistogramValue is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramValue, options); - } +public readonly partial struct CompositeAggregationSourceDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource Instance { get; init; } - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - } - else if (TermsDescriptorAction is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(TermsDescriptorAction), options); - } - else if (TermsValue is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationSourceDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeAggregationSourceDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class CompositeAggregationSourceDescriptor : SerializableDescriptor -{ - internal CompositeAggregationSourceDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor descriptor) => descriptor.Instance; - public CompositeAggregationSourceDescriptor() : base() + /// + /// + /// A date histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? value) { + Instance.DateHistogram = value; + return this; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? DateHistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor DateHistogramDescriptor { get; set; } - private Action DateHistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? GeotileGridValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor GeotileGridDescriptor { get; set; } - private Action GeotileGridDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? HistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor HistogramDescriptor { get; set; } - private Action HistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor TermsDescriptor { get; set; } - private Action TermsDescriptorAction { get; set; } + /// + /// + /// A date histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram() + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor.Build(null); + return this; + } /// /// /// A date histogram aggregation. /// /// - public CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation? dateHistogram) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram(System.Action? action) { - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = null; - DateHistogramValue = dateHistogram; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor.Build(action); + return this; } - public CompositeAggregationSourceDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor descriptor) + /// + /// + /// A date histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor DateHistogram(System.Action>? action) { - DateHistogramValue = null; - DateHistogramDescriptorAction = null; - DateHistogramDescriptor = descriptor; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor.Build(action); + return this; } - public CompositeAggregationSourceDescriptor DateHistogram(Action configure) + /// + /// + /// A geotile grid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? value) { - DateHistogramValue = null; - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = configure; - return Self; + Instance.GeotileGrid = value; + return this; } /// @@ -325,28 +370,32 @@ public CompositeAggregationSourceDescriptor DateHistogram(Action /// - public CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation? geotileGrid) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid() { - GeotileGridDescriptor = null; - GeotileGridDescriptorAction = null; - GeotileGridValue = geotileGrid; - return Self; + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor.Build(null); + return this; } - public CompositeAggregationSourceDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor descriptor) + /// + /// + /// A geotile grid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid(System.Action? action) { - GeotileGridValue = null; - GeotileGridDescriptorAction = null; - GeotileGridDescriptor = descriptor; - return Self; + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor.Build(action); + return this; } - public CompositeAggregationSourceDescriptor GeotileGrid(Action configure) + /// + /// + /// A geotile grid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor GeotileGrid(System.Action>? action) { - GeotileGridValue = null; - GeotileGridDescriptor = null; - GeotileGridDescriptorAction = configure; - return Self; + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor.Build(action); + return this; } /// @@ -354,28 +403,32 @@ public CompositeAggregationSourceDescriptor GeotileGrid(Action /// - public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? histogram) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation? value) { - HistogramDescriptor = null; - HistogramDescriptorAction = null; - HistogramValue = histogram; - return Self; + Instance.Histogram = value; + return this; } - public CompositeAggregationSourceDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor descriptor) + /// + /// + /// A histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Histogram(System.Action action) { - HistogramValue = null; - HistogramDescriptorAction = null; - HistogramDescriptor = descriptor; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor.Build(action); + return this; } - public CompositeAggregationSourceDescriptor Histogram(Action configure) + /// + /// + /// A histogram aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Histogram(System.Action> action) { - HistogramValue = null; - HistogramDescriptor = null; - HistogramDescriptorAction = configure; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor.Build(action); + return this; } /// @@ -383,97 +436,55 @@ public CompositeAggregationSourceDescriptor Histogram(Action /// - public CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? terms) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation? value) { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } - public CompositeAggregationSourceDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor descriptor) + /// + /// + /// A terms aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms() { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptor = descriptor; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor.Build(null); + return this; } - public CompositeAggregationSourceDescriptor Terms(Action configure) + /// + /// + /// A terms aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms(System.Action? action) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = configure; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A terms aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor Terms(System.Action>? action) { - writer.WriteStartObject(); - if (DateHistogramDescriptor is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramDescriptor, options); - } - else if (DateHistogramDescriptorAction is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(DateHistogramDescriptorAction), options); - } - else if (DateHistogramValue is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramValue, options); - } - - if (GeotileGridDescriptor is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, GeotileGridDescriptor, options); - } - else if (GeotileGridDescriptorAction is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(GeotileGridDescriptorAction), options); - } - else if (GeotileGridValue is not null) - { - writer.WritePropertyName("geotile_grid"); - JsonSerializer.Serialize(writer, GeotileGridValue, options); - } - - if (HistogramDescriptor is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramDescriptor, options); - } - else if (HistogramDescriptorAction is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(HistogramDescriptorAction), options); - } - else if (HistogramValue is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramValue, options); - } + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor.Build(action); + return this; + } - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - } - else if (TermsDescriptorAction is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(TermsDescriptorAction), options); - } - else if (TermsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSourceDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeBucket.g.cs index 42e67f51da3..12feb26687f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class CompositeBucketConverter : JsonConverter +internal sealed partial class CompositeBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override CompositeBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue> propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new CompositeBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, CompositeBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'CompositeBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(CompositeBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeBucketConverter))] public sealed partial class CompositeBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeBucket(long docCount, System.Collections.Generic.IReadOnlyDictionary key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public CompositeBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompositeBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeDateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeDateHistogramAggregation.g.cs index 9cd68283ed9..ac41b509ee0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeDateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeDateHistogramAggregation.g.cs @@ -17,24 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeDateHistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendarInterval = System.Text.Json.JsonEncodedText.Encode("calendar_interval"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissingBucket = System.Text.Json.JsonEncodedText.Encode("missing_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropMissingOrder = System.Text.Json.JsonEncodedText.Encode("missing_order"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarInterval = default; + LocalJsonValue propField = default; + LocalJsonValue propFixedInterval = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissingBucket = default; + LocalJsonValue propMissingOrder = default; + LocalJsonValue propOffset = default; + LocalJsonValue propOrder = default; + LocalJsonValue propScript = default; + LocalJsonValue propTimeZone = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarInterval.TryReadProperty(ref reader, options, PropCalendarInterval, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissingBucket.TryReadProperty(ref reader, options, PropMissingBucket, null)) + { + continue; + } + + if (propMissingOrder.TryReadProperty(ref reader, options, PropMissingOrder, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarInterval = propCalendarInterval.Value, + Field = propField.Value, + FixedInterval = propFixedInterval.Value, + Format = propFormat.Value, + MissingBucket = propMissingBucket.Value, + MissingOrder = propMissingOrder.Value, + Offset = propOffset.Value, + Order = propOrder.Value, + Script = propScript.Value, + TimeZone = propTimeZone.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarInterval, value.CalendarInterval, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissingBucket, value.MissingBucket, null, null); + writer.WriteProperty(options, PropMissingOrder, value.MissingOrder, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationConverter))] public sealed partial class CompositeDateHistogramAggregation { +#if NET7_0_OR_GREATER + public CompositeDateHistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompositeDateHistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Either calendar_interval or fixed_interval must be present /// /// - [JsonInclude, JsonPropertyName("calendar_interval")] public string? CalendarInterval { get; set; } /// @@ -42,7 +183,6 @@ public sealed partial class CompositeDateHistogramAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -50,17 +190,11 @@ public sealed partial class CompositeDateHistogramAggregation /// Either calendar_interval or fixed_interval must be present /// /// - [JsonInclude, JsonPropertyName("fixed_interval")] public string? FixedInterval { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("missing_bucket")] public bool? MissingBucket { get; set; } - [JsonInclude, JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } - [JsonInclude, JsonPropertyName("offset")] public Elastic.Clients.Elasticsearch.Duration? Offset { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } /// @@ -68,56 +202,39 @@ public sealed partial class CompositeDateHistogramAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } } -public sealed partial class CompositeDateHistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CompositeDateHistogramAggregationDescriptor { - internal CompositeDateHistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation Instance { get; init; } - public CompositeDateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation instance) { + Instance = instance; } - private string? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either calendar_interval or fixed_interval must be present - /// - /// - public CompositeDateHistogramAggregationDescriptor CalendarInterval(string? calendarInterval) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeDateHistogramAggregationDescriptor() { - CalendarIntervalValue = calendarInterval; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// Either field or script must be present + /// Either calendar_interval or fixed_interval must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor CalendarInterval(string? value) { - FieldValue = field; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -125,10 +242,10 @@ public CompositeDateHistogramAggregationDescriptor Field(Elastic.Clie /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -136,10 +253,10 @@ public CompositeDateHistogramAggregationDescriptor Field(Expr /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,40 +264,40 @@ public CompositeDateHistogramAggregationDescriptor Field(Expressioncalendar_interval or fixed_interval must be present /// /// - public CompositeDateHistogramAggregationDescriptor FixedInterval(string? fixedInterval) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor FixedInterval(string? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public CompositeDateHistogramAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeDateHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? offset) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -188,167 +305,88 @@ public CompositeDateHistogramAggregationDescriptor Order(Elastic.Clie /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeDateHistogramAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeDateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - public CompositeDateHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CalendarIntervalValue)) - { - writer.WritePropertyName("calendar_interval"); - writer.WriteStringValue(CalendarIntervalValue); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FixedIntervalValue)) - { - writer.WritePropertyName("fixed_interval"); - writer.WriteStringValue(FixedIntervalValue); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OffsetValue is not null) - { - writer.WritePropertyName("offset"); - JsonSerializer.Serialize(writer, OffsetValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - if (ValueTypeValue is not null) + if (action is null) { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompositeDateHistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct CompositeDateHistogramAggregationDescriptor { - internal CompositeDateHistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation Instance { get; init; } - public CompositeDateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation instance) { + Instance = instance; } - private string? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either calendar_interval or fixed_interval must be present - /// - /// - public CompositeDateHistogramAggregationDescriptor CalendarInterval(string? calendarInterval) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeDateHistogramAggregationDescriptor() { - CalendarIntervalValue = calendarInterval; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// Either field or script must be present + /// Either calendar_interval or fixed_interval must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor CalendarInterval(string? value) { - FieldValue = field; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -356,10 +394,10 @@ public CompositeDateHistogramAggregationDescriptor Field(Elastic.Clients.Elastic /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -367,10 +405,10 @@ public CompositeDateHistogramAggregationDescriptor Field(Expr /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -378,40 +416,40 @@ public CompositeDateHistogramAggregationDescriptor Field(Expressioncalendar_interval or fixed_interval must be present /// /// - public CompositeDateHistogramAggregationDescriptor FixedInterval(string? fixedInterval) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor FixedInterval(string? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public CompositeDateHistogramAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeDateHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? offset) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -419,121 +457,56 @@ public CompositeDateHistogramAggregationDescriptor Order(Elastic.Clients.Elastic /// Either field or script must be present /// /// - public CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeDateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeDateHistogramAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeDateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - public CompositeDateHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CalendarIntervalValue)) - { - writer.WritePropertyName("calendar_interval"); - writer.WriteStringValue(CalendarIntervalValue); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FixedIntervalValue)) - { - writer.WritePropertyName("fixed_interval"); - writer.WriteStringValue(FixedIntervalValue); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OffsetValue is not null) - { - writer.WritePropertyName("offset"); - JsonSerializer.Serialize(writer, OffsetValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeDateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeGeoTileGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeGeoTileGridAggregation.g.cs index c1c56cea1c8..f9dd876de95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeGeoTileGridAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeGeoTileGridAggregation.g.cs @@ -17,19 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeGeoTileGridAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBounds = System.Text.Json.JsonEncodedText.Encode("bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissingBucket = System.Text.Json.JsonEncodedText.Encode("missing_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropMissingOrder = System.Text.Json.JsonEncodedText.Encode("missing_order"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propMissingBucket = default; + LocalJsonValue propMissingOrder = default; + LocalJsonValue propOrder = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propScript = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBounds.TryReadProperty(ref reader, options, PropBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissingBucket.TryReadProperty(ref reader, options, PropMissingBucket, null)) + { + continue; + } + + if (propMissingOrder.TryReadProperty(ref reader, options, PropMissingOrder, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bounds = propBounds.Value, + Field = propField.Value, + MissingBucket = propMissingBucket.Value, + MissingOrder = propMissingOrder.Value, + Order = propOrder.Value, + Precision = propPrecision.Value, + Script = propScript.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBounds, value.Bounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissingBucket, value.MissingBucket, null, null); + writer.WriteProperty(options, PropMissingOrder, value.MissingOrder, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationConverter))] public sealed partial class CompositeGeoTileGridAggregation { - [JsonInclude, JsonPropertyName("bounds")] +#if NET7_0_OR_GREATER + public CompositeGeoTileGridAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompositeGeoTileGridAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } /// @@ -37,15 +151,10 @@ public sealed partial class CompositeGeoTileGridAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("missing_bucket")] public bool? MissingBucket { get; set; } - [JsonInclude, JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } - [JsonInclude, JsonPropertyName("precision")] public int? Precision { get; set; } /// @@ -53,46 +162,39 @@ public sealed partial class CompositeGeoTileGridAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } } -public sealed partial class CompositeGeoTileGridAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CompositeGeoTileGridAggregationDescriptor { - internal CompositeGeoTileGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeGeoTileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation instance) + { + Instance = instance; + } - public CompositeGeoTileGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeGeoTileGridAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private int? PrecisionValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor descriptor) => descriptor.Instance; - public CompositeGeoTileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } - /// - /// - /// Either field or script must be present - /// - /// - public CompositeGeoTileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -100,10 +202,10 @@ public CompositeGeoTileGridAggregationDescriptor Field(Elastic.Client /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -111,34 +213,34 @@ public CompositeGeoTileGridAggregationDescriptor Field(Expres /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Precision(int? precision) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Precision(int? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -146,135 +248,83 @@ public CompositeGeoTileGridAggregationDescriptor Precision(int? preci /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeGeoTileGridAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeGeoTileGridAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (PrecisionValue.HasValue) + if (action is null) { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompositeGeoTileGridAggregationDescriptor : SerializableDescriptor +public readonly partial struct CompositeGeoTileGridAggregationDescriptor { - internal CompositeGeoTileGridAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeGeoTileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation instance) + { + Instance = instance; + } - public CompositeGeoTileGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeGeoTileGridAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private int? PrecisionValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor descriptor) => descriptor.Instance; - public CompositeGeoTileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } - /// - /// - /// Either field or script must be present - /// - /// - public CompositeGeoTileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -282,10 +332,10 @@ public CompositeGeoTileGridAggregationDescriptor Field(Elastic.Clients.Elasticse /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -293,34 +343,34 @@ public CompositeGeoTileGridAggregationDescriptor Field(Expres /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Precision(int? precision) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Precision(int? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -328,97 +378,50 @@ public CompositeGeoTileGridAggregationDescriptor Precision(int? precision) /// Either field or script must be present /// /// - public CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeGeoTileGridAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeGeoTileGridAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeGeoTileGridAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) + if (action is null) { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeGeoTileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeHistogramAggregation.g.cs index e6d78a571bd..a0f4882607a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeHistogramAggregation.g.cs @@ -17,32 +17,143 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeHistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + private static readonly System.Text.Json.JsonEncodedText PropMissingBucket = System.Text.Json.JsonEncodedText.Encode("missing_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropMissingOrder = System.Text.Json.JsonEncodedText.Encode("missing_order"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propInterval = default; + LocalJsonValue propMissingBucket = default; + LocalJsonValue propMissingOrder = default; + LocalJsonValue propOrder = default; + LocalJsonValue propScript = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (propMissingBucket.TryReadProperty(ref reader, options, PropMissingBucket, null)) + { + continue; + } + + if (propMissingOrder.TryReadProperty(ref reader, options, PropMissingOrder, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Interval = propInterval.Value, + MissingBucket = propMissingBucket.Value, + MissingOrder = propMissingOrder.Value, + Order = propOrder.Value, + Script = propScript.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInterval, value.Interval, null, null); + writer.WriteProperty(options, PropMissingBucket, value.MissingBucket, null, null); + writer.WriteProperty(options, PropMissingOrder, value.MissingOrder, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationConverter))] public sealed partial class CompositeHistogramAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeHistogramAggregation(double interval) + { + Interval = interval; + } +#if NET7_0_OR_GREATER + public CompositeHistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompositeHistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("interval")] - public double Interval { get; set; } - [JsonInclude, JsonPropertyName("missing_bucket")] + public +#if NET7_0_OR_GREATER + required +#endif + double Interval { get; set; } public bool? MissingBucket { get; set; } - [JsonInclude, JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } /// @@ -50,50 +161,38 @@ public sealed partial class CompositeHistogramAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } } -public sealed partial class CompositeHistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CompositeHistogramAggregationDescriptor { - internal CompositeHistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation Instance { get; init; } - public CompositeHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double IntervalValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either field or script must be present - /// - /// - public CompositeHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeHistogramAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -101,34 +200,34 @@ public CompositeHistogramAggregationDescriptor Field(Expressi /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeHistogramAggregationDescriptor Interval(double interval) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Interval(double value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } - public CompositeHistogramAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -136,129 +235,77 @@ public CompositeHistogramAggregationDescriptor Order(Elastic.Clients. /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeHistogramAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue); - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompositeHistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct CompositeHistogramAggregationDescriptor { - internal CompositeHistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation Instance { get; init; } - public CompositeHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double IntervalValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either field or script must be present - /// - /// - public CompositeHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeHistogramAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -266,34 +313,34 @@ public CompositeHistogramAggregationDescriptor Field(Expressi /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeHistogramAggregationDescriptor Interval(double interval) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Interval(double value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } - public CompositeHistogramAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -301,87 +348,45 @@ public CompositeHistogramAggregationDescriptor Order(Elastic.Clients.Elasticsear /// Either field or script must be present /// /// - public CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeHistogramAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue); - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeTermsAggregation.g.cs index eb18ae41998..ba53d180cae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeTermsAggregation.g.cs @@ -17,30 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CompositeTermsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissingBucket = System.Text.Json.JsonEncodedText.Encode("missing_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropMissingOrder = System.Text.Json.JsonEncodedText.Encode("missing_order"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissingBucket = default; + LocalJsonValue propMissingOrder = default; + LocalJsonValue propOrder = default; + LocalJsonValue propScript = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissingBucket.TryReadProperty(ref reader, options, PropMissingBucket, null)) + { + continue; + } + + if (propMissingOrder.TryReadProperty(ref reader, options, PropMissingOrder, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + MissingBucket = propMissingBucket.Value, + MissingOrder = propMissingOrder.Value, + Order = propOrder.Value, + Script = propScript.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissingBucket, value.MissingBucket, null, null); + writer.WriteProperty(options, PropMissingOrder, value.MissingOrder, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationConverter))] public sealed partial class CompositeTermsAggregation { +#if NET7_0_OR_GREATER + public CompositeTermsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompositeTermsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("missing_bucket")] public bool? MissingBucket { get; set; } - [JsonInclude, JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } /// @@ -48,49 +141,38 @@ public sealed partial class CompositeTermsAggregation /// Either field or script must be present /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } } -public sealed partial class CompositeTermsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct CompositeTermsAggregationDescriptor { - internal CompositeTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation Instance { get; init; } - public CompositeTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either field or script must be present - /// - /// - public CompositeTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeTermsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Either field or script must be present /// /// - public CompositeTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -98,28 +180,28 @@ public CompositeTermsAggregationDescriptor Field(Expressionfield or script must be present /// /// - public CompositeTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeTermsAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeTermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -127,126 +209,82 @@ public CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elas /// Either field or script must be present /// /// - public CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeTermsAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeTermsAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) + if (action is null) { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompositeTermsAggregationDescriptor : SerializableDescriptor +public readonly partial struct CompositeTermsAggregationDescriptor { - internal CompositeTermsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation Instance { get; init; } - public CompositeTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - - /// - /// - /// Either field or script must be present - /// - /// - public CompositeTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeTermsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Either field or script must be present /// /// - public CompositeTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -254,28 +292,28 @@ public CompositeTermsAggregationDescriptor Field(Expressionfield or script must be present /// /// - public CompositeTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public CompositeTermsAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public CompositeTermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } - public CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -283,85 +321,50 @@ public CompositeTermsAggregationDescriptor Order(Elastic.Clients.Elasticsearch.S /// Either field or script must be present /// /// - public CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public CompositeTermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public CompositeTermsAggregationDescriptor Script(Action configure) + /// + /// + /// Either field or script must be present + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public CompositeTermsAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CompositeTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregate.g.cs index 5c0dcba229a..e8363b6a8e4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregate.g.cs @@ -17,27 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CumulativeCardinalityAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Result of the cumulative_cardinality aggregation /// /// -public sealed partial class CumulativeCardinalityAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregateConverter))] +public sealed partial class CumulativeCardinalityAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("value")] - public long Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CumulativeCardinalityAggregate(long value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public CumulativeCardinalityAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CumulativeCardinalityAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CumulativeCardinalityAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "simple_long_value"; + + public +#if NET7_0_OR_GREATER + required +#endif + long Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs index e9372ff0f6c..0ab62d50197 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeCardinalityAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CumulativeCardinalityAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationConverter))] public sealed partial class CumulativeCardinalityAggregation { +#if NET7_0_OR_GREATER + public CumulativeCardinalityAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CumulativeCardinalityAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class CumulativeCardinalityAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class CumulativeCardinalityAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CumulativeCardinalityAggregation cumulativeCardinalityAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.CumulativeCardinality(cumulativeCardinalityAggregation); } -public sealed partial class CumulativeCardinalityAggregationDescriptor : SerializableDescriptor +public readonly partial struct CumulativeCardinalityAggregationDescriptor { - internal CumulativeCardinalityAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CumulativeCardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation instance) + { + Instance = instance; + } - public CumulativeCardinalityAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CumulativeCardinalityAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public CumulativeCardinalityAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public CumulativeCardinalityAggregationDescriptor BucketsPath(Elastic.Clients.El /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public CumulativeCardinalityAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public CumulativeCardinalityAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public CumulativeCardinalityAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CumulativeCardinalityAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs index a9f64699c3e..fad254c7c5f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CumulativeSumAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CumulativeSumAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationConverter))] public sealed partial class CumulativeSumAggregation { +#if NET7_0_OR_GREATER + public CumulativeSumAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public CumulativeSumAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class CumulativeSumAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class CumulativeSumAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CumulativeSumAggregation cumulativeSumAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.CumulativeSum(cumulativeSumAggregation); } -public sealed partial class CumulativeSumAggregationDescriptor : SerializableDescriptor +public readonly partial struct CumulativeSumAggregationDescriptor { - internal CumulativeSumAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CumulativeSumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation instance) + { + Instance = instance; + } - public CumulativeSumAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CumulativeSumAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public CumulativeSumAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public CumulativeSumAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsea /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public CumulativeSumAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public CumulativeSumAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public CumulativeSumAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CumulativeSumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CustomCategorizeTextAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CustomCategorizeTextAnalyzer.g.cs index 40ae3e78257..33cdff91c76 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CustomCategorizeTextAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CustomCategorizeTextAnalyzer.g.cs @@ -17,77 +17,152 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class CustomCategorizeTextAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharFilter = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCharFilter = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propTokenizer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharFilter.TryReadProperty(ref reader, options, PropCharFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharFilter = propCharFilter.Value, + Filter = propFilter.Value, + Tokenizer = propTokenizer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharFilter, value.CharFilter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerConverter))] public sealed partial class CustomCategorizeTextAnalyzer { - [JsonInclude, JsonPropertyName("char_filter")] - public ICollection? CharFilter { get; set; } - [JsonInclude, JsonPropertyName("filter")] - public ICollection? Filter { get; set; } - [JsonInclude, JsonPropertyName("tokenizer")] +#if NET7_0_OR_GREATER + public CustomCategorizeTextAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public CustomCategorizeTextAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? CharFilter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } public string? Tokenizer { get; set; } } -public sealed partial class CustomCategorizeTextAnalyzerDescriptor : SerializableDescriptor +public readonly partial struct CustomCategorizeTextAnalyzerDescriptor { - internal CustomCategorizeTextAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomCategorizeTextAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer instance) + { + Instance = instance; + } - public CustomCategorizeTextAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomCategorizeTextAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? CharFilterValue { get; set; } - private ICollection? FilterValue { get; set; } - private string? TokenizerValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer instance) => new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor descriptor) => descriptor.Instance; - public CustomCategorizeTextAnalyzerDescriptor CharFilter(ICollection? charFilter) + public Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor CharFilter(System.Collections.Generic.ICollection? value) { - CharFilterValue = charFilter; - return Self; + Instance.CharFilter = value; + return this; } - public CustomCategorizeTextAnalyzerDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor CharFilter(params string[] values) { - FilterValue = filter; - return Self; + Instance.CharFilter = [.. values]; + return this; } - public CustomCategorizeTextAnalyzerDescriptor Tokenizer(string? tokenizer) + public Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor Filter(System.Collections.Generic.ICollection? value) { - TokenizerValue = tokenizer; - return Self; + Instance.Filter = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor Filter(params string[] values) { - writer.WriteStartObject(); - if (CharFilterValue is not null) - { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFilterValue, options); - } + Instance.Filter = [.. values]; + return this; + } - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor Tokenizer(string? value) + { + Instance.Tokenizer = value; + return this; + } - if (!string.IsNullOrEmpty(TokenizerValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tokenizer"); - writer.WriteStringValue(TokenizerValue); + return new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.CustomCategorizeTextAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregate.g.cs index f1e0896cdb3..b0d3c576abf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class DateHistogramAggregate : IAggregate +internal sealed partial class DateHistogramAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregateConverter))] +public sealed partial class DateHistogramAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public DateHistogramAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateHistogramAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "date_histogram"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs index a42bd78fdb7..e9ae813e335 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramAggregation.g.cs @@ -17,25 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DateHistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendarInterval = System.Text.Json.JsonEncodedText.Encode("calendar_interval"); + private static readonly System.Text.Json.JsonEncodedText PropExtendedBounds = System.Text.Json.JsonEncodedText.Encode("extended_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropHardBounds = System.Text.Json.JsonEncodedText.Encode("hard_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarInterval = default; + LocalJsonValue?> propExtendedBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propFixedInterval = default; + LocalJsonValue propFormat = default; + LocalJsonValue?> propHardBounds = default; + LocalJsonValue propInterval = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propMissing = default; + LocalJsonValue propOffset = default; + LocalJsonValue>?> propOrder = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propScript = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarInterval.TryReadProperty(ref reader, options, PropCalendarInterval, null)) + { + continue; + } + + if (propExtendedBounds.TryReadProperty(ref reader, options, PropExtendedBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propHardBounds.TryReadProperty(ref reader, options, PropHardBounds, null)) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarInterval = propCalendarInterval.Value, + ExtendedBounds = propExtendedBounds.Value, + Field = propField.Value, + FixedInterval = propFixedInterval.Value, + Format = propFormat.Value, + HardBounds = propHardBounds.Value, +#pragma warning disable CS0618 + Interval = propInterval.Value +#pragma warning restore CS0618 +, + MinDocCount = propMinDocCount.Value, + Missing = propMissing.Value, + Offset = propOffset.Value, + Order = propOrder.Value, + Params = propParams.Value, + Script = propScript.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarInterval, value.CalendarInterval, null, null); + writer.WriteProperty(options, PropExtendedBounds, value.ExtendedBounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropHardBounds, value.HardBounds, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropInterval, value.Interval, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationConverter))] public sealed partial class DateHistogramAggregation { +#if NET7_0_OR_GREATER + public DateHistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateHistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Calendar-aware interval. /// Can be specified using the unit name, such as month, or as a single unit quantity, such as 1M. /// /// - [JsonInclude, JsonPropertyName("calendar_interval")] public Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarInterval { get; set; } /// @@ -43,15 +217,13 @@ public sealed partial class DateHistogramAggregation /// Enables extending the bounds of the histogram beyond the data itself. /// /// - [JsonInclude, JsonPropertyName("extended_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? ExtendedBounds { get; set; } /// /// /// The date field whose values are use to build a histogram. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -59,7 +231,6 @@ public sealed partial class DateHistogramAggregation /// Fixed intervals: a fixed number of SI units and never deviate, regardless of where they fall on the calendar. /// /// - [JsonInclude, JsonPropertyName("fixed_interval")] public Elastic.Clients.Elasticsearch.Duration? FixedInterval { get; set; } /// @@ -68,7 +239,6 @@ public sealed partial class DateHistogramAggregation /// If no format is specified, the first date format specified in the field mapping is used. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -76,8 +246,9 @@ public sealed partial class DateHistogramAggregation /// Limits the histogram to specified bounds. /// /// - [JsonInclude, JsonPropertyName("hard_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? HardBounds { get; set; } + [System.Obsolete("Deprecated in '7.2.0'. use `fixed_interval` or `calendar_interval`")] + public Elastic.Clients.Elasticsearch.Duration? Interval { get; set; } /// /// @@ -85,7 +256,6 @@ public sealed partial class DateHistogramAggregation /// By default, all buckets between the first bucket that matches documents and the last one are returned. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } /// @@ -94,15 +264,13 @@ public sealed partial class DateHistogramAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public DateTimeOffset? Missing { get; set; } + public System.DateTimeOffset? Missing { get; set; } /// /// /// Changes the start value of each bucket by the specified positive (+) or negative offset (-) duration. /// /// - [JsonInclude, JsonPropertyName("offset")] public Elastic.Clients.Elasticsearch.Duration? Offset { get; set; } /// @@ -110,12 +278,8 @@ public sealed partial class DateHistogramAggregation /// The sort order of the returned buckets. /// /// - [JsonInclude, JsonPropertyName("order")] - [SingleOrManyCollectionConverter(typeof(KeyValuePair))] - public ICollection>? Order { get; set; } - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.ICollection>? Order { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -124,40 +288,27 @@ public sealed partial class DateHistogramAggregation /// Defaults to Coordinated Universal Time (UTC). /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(DateHistogramAggregation dateHistogramAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.DateHistogram(dateHistogramAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(DateHistogramAggregation dateHistogramAggregation) => Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy.DateHistogram(dateHistogramAggregation); } -public sealed partial class DateHistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct DateHistogramAggregationDescriptor { - internal DateHistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation instance) + { + Instance = instance; + } - public DateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } - private Action ExtendedBoundsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } - private Action HardBoundsDescriptorAction { get; set; } - private int? MinDocCountValue { get; set; } - private DateTimeOffset? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private ICollection>? OrderValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -165,10 +316,10 @@ public DateHistogramAggregationDescriptor() : base() /// Can be specified using the unit name, such as month, or as a single unit quantity, such as 1M. /// /// - public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? calendarInterval) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? value) { - CalendarIntervalValue = calendarInterval; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -176,39 +327,32 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Cl /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? extendedBounds) - { - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsValue = extendedBounds; - return Self; - } - - public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsDescriptor = descriptor; - return Self; + Instance.ExtendedBounds = value; + return this; } - public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + /// + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds() { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = configure; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(null); + return this; } /// /// - /// The date field whose values are use to build a histogram. + /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public DateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds(System.Action? action) { - FieldValue = field; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(action); + return this; } /// @@ -216,10 +360,10 @@ public DateHistogramAggregationDescriptor Field(Elastic.Clients.Elast /// The date field whose values are use to build a histogram. /// /// - public DateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -227,10 +371,10 @@ public DateHistogramAggregationDescriptor Field(Expression /// - public DateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -238,10 +382,10 @@ public DateHistogramAggregationDescriptor Field(Expression /// - public DateHistogramAggregationDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? fixedInterval) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } /// @@ -250,10 +394,10 @@ public DateHistogramAggregationDescriptor FixedInterval(Elastic.Clien /// If no format is specified, the first date format specified in the field mapping is used. /// /// - public DateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -261,28 +405,39 @@ public DateHistogramAggregationDescriptor Format(string? format) /// Limits the histogram to specified bounds. /// /// - public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? hardBounds) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = null; - HardBoundsValue = hardBounds; - return Self; + Instance.HardBounds = value; + return this; } - public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + /// + /// + /// Limits the histogram to specified bounds. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds() { - HardBoundsValue = null; - HardBoundsDescriptorAction = null; - HardBoundsDescriptor = descriptor; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(null); + return this; } - public DateHistogramAggregationDescriptor HardBounds(Action configure) + /// + /// + /// Limits the histogram to specified bounds. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds(System.Action? action) { - HardBoundsValue = null; - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = configure; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.2.0'. use `fixed_interval` or `calendar_interval`")] + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Interval = value; + return this; } /// @@ -291,10 +446,10 @@ public DateHistogramAggregationDescriptor HardBounds(Action /// - public DateHistogramAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -303,10 +458,10 @@ public DateHistogramAggregationDescriptor MinDocCount(int? minDocCoun /// By default, documents without a value are ignored. /// /// - public DateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Missing(System.DateTimeOffset? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -314,10 +469,10 @@ public DateHistogramAggregationDescriptor Missing(DateTimeOffset? mis /// Changes the start value of each bucket by the specified positive (+) or negative offset (-) duration. /// /// - public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? offset) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } /// @@ -325,196 +480,135 @@ public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elas /// The sort order of the returned buckets. /// /// - public DateHistogramAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public DateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) + /// + /// + /// The sort order of the returned buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order() { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } - public DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// The sort order of the returned buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order(System.Action>? action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } - public DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public DateHistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - /// - /// - /// Time zone used for bucketing and rounding. - /// Defaults to Coordinated Universal Time (UTC). - /// - /// - public DateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) { - TimeZoneValue = timeZone; - return Self; + Instance.Params = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params() { - writer.WriteStartObject(); - if (CalendarIntervalValue is not null) - { - writer.WritePropertyName("calendar_interval"); - JsonSerializer.Serialize(writer, CalendarIntervalValue, options); - } - - if (ExtendedBoundsDescriptor is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); - } - else if (ExtendedBoundsDescriptorAction is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); - } - else if (ExtendedBoundsValue is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (FixedIntervalValue is not null) - { - writer.WritePropertyName("fixed_interval"); - JsonSerializer.Serialize(writer, FixedIntervalValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HardBoundsDescriptor is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); - } - else if (HardBoundsDescriptorAction is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); - } - else if (HardBoundsValue is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsValue, options); - } + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } - if (OffsetValue is not null) - { - writer.WritePropertyName("offset"); - JsonSerializer.Serialize(writer, OffsetValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + /// + /// + /// Time zone used for bucketing and rounding. + /// Defaults to Coordinated Universal Time (UTC). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor TimeZone(string? value) + { + Instance.TimeZone = value; + return this; + } - if (!string.IsNullOrEmpty(TimeZoneValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); + return new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateHistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct DateHistogramAggregationDescriptor { - internal DateHistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation instance) + { + Instance = instance; + } - public DateHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? ExtendedBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor ExtendedBoundsDescriptor { get; set; } - private Action ExtendedBoundsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? HardBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor HardBoundsDescriptor { get; set; } - private Action HardBoundsDescriptorAction { get; set; } - private int? MinDocCountValue { get; set; } - private DateTimeOffset? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? OffsetValue { get; set; } - private ICollection>? OrderValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -522,10 +616,10 @@ public DateHistogramAggregationDescriptor() : base() /// Can be specified using the unit name, such as month, or as a single unit quantity, such as 1M. /// /// - public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? calendarInterval) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? value) { - CalendarIntervalValue = calendarInterval; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -533,39 +627,32 @@ public DateHistogramAggregationDescriptor CalendarInterval(Elastic.Clients.Elast /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? extendedBounds) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsValue = extendedBounds; - return Self; + Instance.ExtendedBounds = value; + return this; } - public DateHistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) - { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsDescriptor = descriptor; - return Self; - } - - public DateHistogramAggregationDescriptor ExtendedBounds(Action configure) + /// + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds() { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = configure; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(null); + return this; } /// /// - /// The date field whose values are use to build a histogram. + /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public DateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor ExtendedBounds(System.Action? action) { - FieldValue = field; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(action); + return this; } /// @@ -573,10 +660,10 @@ public DateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The date field whose values are use to build a histogram. /// /// - public DateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -584,10 +671,10 @@ public DateHistogramAggregationDescriptor Field(Expression /// - public DateHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -595,10 +682,10 @@ public DateHistogramAggregationDescriptor Field(Expression /// - public DateHistogramAggregationDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? fixedInterval) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } /// @@ -607,10 +694,21 @@ public DateHistogramAggregationDescriptor FixedInterval(Elastic.Clients.Elastics /// If no format is specified, the first date format specified in the field mapping is used. /// /// - public DateHistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Format(string? value) + { + Instance.Format = value; + return this; + } + + /// + /// + /// Limits the histogram to specified bounds. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - FormatValue = format; - return Self; + Instance.HardBounds = value; + return this; } /// @@ -618,28 +716,28 @@ public DateHistogramAggregationDescriptor Format(string? format) /// Limits the histogram to specified bounds. /// /// - public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDate? hardBounds) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds() { - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = null; - HardBoundsValue = hardBounds; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(null); + return this; } - public DateHistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor descriptor) + /// + /// + /// Limits the histogram to specified bounds. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor HardBounds(System.Action? action) { - HardBoundsValue = null; - HardBoundsDescriptorAction = null; - HardBoundsDescriptor = descriptor; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor.Build(action); + return this; } - public DateHistogramAggregationDescriptor HardBounds(Action configure) + [System.Obsolete("Deprecated in '7.2.0'. use `fixed_interval` or `calendar_interval`")] + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? value) { - HardBoundsValue = null; - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = configure; - return Self; + Instance.Interval = value; + return this; } /// @@ -648,10 +746,10 @@ public DateHistogramAggregationDescriptor HardBounds(Action /// - public DateHistogramAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -660,10 +758,10 @@ public DateHistogramAggregationDescriptor MinDocCount(int? minDocCount) /// By default, documents without a value are ignored. /// /// - public DateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Missing(System.DateTimeOffset? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -671,10 +769,10 @@ public DateHistogramAggregationDescriptor Missing(DateTimeOffset? missing) /// Changes the start value of each bucket by the specified positive (+) or negative offset (-) duration. /// /// - public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? offset) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } /// @@ -682,165 +780,124 @@ public DateHistogramAggregationDescriptor Offset(Elastic.Clients.Elasticsearch.D /// The sort order of the returned buckets. /// /// - public DateHistogramAggregationDescriptor Order(ICollection>? order) - { - OrderValue = order; - return Self; - } - - public DateHistogramAggregationDescriptor Params(Func, FluentDictionary> selector) - { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; - } - - public DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = value; + return this; } - public DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The sort order of the returned buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } - public DateHistogramAggregationDescriptor Script(Action configure) + /// + /// + /// The sort order of the returned buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } /// /// - /// Time zone used for bucketing and rounding. - /// Defaults to Coordinated Universal Time (UTC). + /// The sort order of the returned buckets. /// /// - public DateHistogramAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Order(System.Action>? action) { - TimeZoneValue = timeZone; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) { - writer.WriteStartObject(); - if (CalendarIntervalValue is not null) - { - writer.WritePropertyName("calendar_interval"); - JsonSerializer.Serialize(writer, CalendarIntervalValue, options); - } - - if (ExtendedBoundsDescriptor is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); - } - else if (ExtendedBoundsDescriptorAction is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(ExtendedBoundsDescriptorAction), options); - } - else if (ExtendedBoundsValue is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (FixedIntervalValue is not null) - { - writer.WritePropertyName("fixed_interval"); - JsonSerializer.Serialize(writer, FixedIntervalValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) + { + Instance.Params = value; + return this; + } - if (HardBoundsDescriptor is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); - } - else if (HardBoundsDescriptorAction is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsDateDescriptor(HardBoundsDescriptorAction), options); - } - else if (HardBoundsValue is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } - if (OffsetValue is not null) - { - writer.WritePropertyName("offset"); - JsonSerializer.Serialize(writer, OffsetValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + /// + /// + /// Time zone used for bucketing and rounding. + /// Defaults to Coordinated Universal Time (UTC). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor TimeZone(string? value) + { + Instance.TimeZone = value; + return this; + } - if (!string.IsNullOrEmpty(TimeZoneValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); + return new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramBucket.g.cs index 1c4587a37dd..f14d08425ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateHistogramBucket.g.cs @@ -17,79 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class DateHistogramBucketConverter : JsonConverter +internal sealed partial class DateHistogramBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override DateHistogramBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateHistogramBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new DateHistogramBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateHistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, DateHistogramBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateHistogramBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'DateHistogramBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(DateHistogramBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramBucketConverter))] public sealed partial class DateHistogramBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramBucket(long docCount, System.DateTimeOffset key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public DateHistogramBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateHistogramBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateHistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregate.g.cs index 7c01bcdd83e..73c86c50056 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregate.g.cs @@ -17,26 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DateRangeAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of a date_range aggregation. Same format as a for a range aggregation: from and to /// in buckets are milliseconds since the Epoch, represented as a floating point number. /// /// -public sealed partial class DateRangeAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregateConverter))] +public sealed partial class DateRangeAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public DateRangeAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateRangeAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateRangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "date_range"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs index 50816038dd7..71c1e59c207 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DateRangeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropRanges = System.Text.Json.JsonEncodedText.Encode("ranges"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue?> propRanges = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propRanges.TryReadProperty(ref reader, options, PropRanges, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Ranges = propRanges.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropRanges, value.Ranges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationConverter))] public sealed partial class DateRangeAggregation { +#if NET7_0_OR_GREATER + public DateRangeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateRangeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The date field whose values are use to build ranges. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class DateRangeAggregation /// The date format used to format from and to in the response. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,66 +137,51 @@ public sealed partial class DateRangeAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// /// Array of date ranges. /// /// - [JsonInclude, JsonPropertyName("ranges")] - public ICollection? Ranges { get; set; } + public System.Collections.Generic.ICollection? Ranges { get; set; } /// /// /// Time zone used to convert dates from another time zone to UTC. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.DateRange(dateRangeAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.DateRange(dateRangeAggregation); } -public sealed partial class DateRangeAggregationDescriptor : SerializableDescriptor> +public readonly partial struct DateRangeAggregationDescriptor { - internal DateRangeAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation Instance { get; init; } - public DateRangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private string? TimeZoneValue { get; set; } - - /// - /// - /// The date field whose values are use to build ranges. - /// - /// - public DateRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field whose values are use to build ranges. /// /// - public DateRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -118,10 +189,10 @@ public DateRangeAggregationDescriptor Field(Expression /// - public DateRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -129,10 +200,10 @@ public DateRangeAggregationDescriptor Field(Expressionfrom and to in the response. /// /// - public DateRangeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -141,10 +212,10 @@ public DateRangeAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public DateRangeAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -152,40 +223,38 @@ public DateRangeAggregationDescriptor Missing(Elastic.Clients.Elastic /// Array of date ranges. /// /// - public DateRangeAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public DateRangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor descriptor) + /// + /// + /// Array of date ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public DateRangeAggregationDescriptor Ranges(Action configure) + /// + /// + /// Array of date ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor.Build(action)); + } - public DateRangeAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } /// @@ -193,111 +262,54 @@ public DateRangeAggregationDescriptor Ranges(params Action /// - public DateRangeAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateRangeAggregationDescriptor : SerializableDescriptor +public readonly partial struct DateRangeAggregationDescriptor { - internal DateRangeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation Instance { get; init; } - public DateRangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private string? TimeZoneValue { get; set; } - - /// - /// - /// The date field whose values are use to build ranges. - /// - /// - public DateRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field whose values are use to build ranges. /// /// - public DateRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -305,10 +317,10 @@ public DateRangeAggregationDescriptor Field(Expression /// - public DateRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -316,10 +328,10 @@ public DateRangeAggregationDescriptor Field(Expressionfrom and to in the response. /// /// - public DateRangeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -328,10 +340,10 @@ public DateRangeAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public DateRangeAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -339,40 +351,38 @@ public DateRangeAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Fiel /// Array of date ranges. /// /// - public DateRangeAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public DateRangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor descriptor) + /// + /// + /// Array of date ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public DateRangeAggregationDescriptor Ranges(Action configure) + /// + /// + /// Array of date ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor.Build(action)); + } - public DateRangeAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } /// @@ -380,70 +390,22 @@ public DateRangeAggregationDescriptor Ranges(params Action /// - public DateRangeAggregationDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeExpression.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeExpression.g.cs index 08a25bf89b4..b0c9400a3c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeExpression.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeExpression.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DateRangeExpressionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propKey = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Key = propKey.Value, + To = propTo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionConverter))] public sealed partial class DateRangeExpression { +#if NET7_0_OR_GREATER + public DateRangeExpression() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateRangeExpression() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateRangeExpression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Start of the range (inclusive). /// /// - [JsonInclude, JsonPropertyName("from")] public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? From { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class DateRangeExpression /// Custom key to return the range with. /// /// - [JsonInclude, JsonPropertyName("key")] public string? Key { get; set; } /// @@ -50,31 +118,48 @@ public sealed partial class DateRangeExpression /// End of the range (exclusive). /// /// - [JsonInclude, JsonPropertyName("to")] public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? To { get; set; } } -public sealed partial class DateRangeExpressionDescriptor : SerializableDescriptor +public readonly partial struct DateRangeExpressionDescriptor { - internal DateRangeExpressionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression Instance { get; init; } - public DateRangeExpressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeExpressionDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? FromValue { get; set; } - private string? KeyValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? ToValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeExpressionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression instance) => new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression(Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Start of the range (inclusive). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor From(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? value) + { + Instance.From = value; + return this; + } /// /// /// Start of the range (inclusive). /// /// - public DateRangeExpressionDescriptor From(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? from) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor From(System.Func action) { - FromValue = from; - return Self; + Instance.From = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(action); + return this; } /// @@ -82,10 +167,10 @@ public DateRangeExpressionDescriptor From(Elastic.Clients.Elasticsearch.Aggregat /// Custom key to return the range with. /// /// - public DateRangeExpressionDescriptor Key(string? key) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor Key(string? value) { - KeyValue = key; - return Self; + Instance.Key = value; + return this; } /// @@ -93,33 +178,33 @@ public DateRangeExpressionDescriptor Key(string? key) /// End of the range (exclusive). /// /// - public DateRangeExpressionDescriptor To(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? to) + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor To(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? value) { - ToValue = to; - return Self; + Instance.To = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// End of the range (exclusive). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor To(System.Func action) { - writer.WriteStartObject(); - if (FromValue is not null) - { - writer.WritePropertyName("from"); - JsonSerializer.Serialize(writer, FromValue, options); - } - - if (!string.IsNullOrEmpty(KeyValue)) - { - writer.WritePropertyName("key"); - writer.WriteStringValue(KeyValue); - } + Instance.To = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(action); + return this; + } - if (ToValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("to"); - JsonSerializer.Serialize(writer, ToValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpressionDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DateRangeExpression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregate.g.cs index 6773162c7ea..fdba37882fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregate.g.cs @@ -17,24 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class DerivativeAggregate : IAggregate +internal sealed partial class DerivativeAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("normalized_value")] - public double? NormalizedValue { get; init; } - [JsonInclude, JsonPropertyName("normalized_value_as_string")] - public string? NormalizedValueAsString { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizedValue = System.Text.Json.JsonEncodedText.Encode("normalized_value"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizedValueAsString = System.Text.Json.JsonEncodedText.Encode("normalized_value_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propNormalizedValue = default; + LocalJsonValue propNormalizedValueAsString = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNormalizedValue.TryReadProperty(ref reader, options, PropNormalizedValue, null)) + { + continue; + } + + if (propNormalizedValueAsString.TryReadProperty(ref reader, options, PropNormalizedValueAsString, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + NormalizedValue = propNormalizedValue.Value, + NormalizedValueAsString = propNormalizedValueAsString.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNormalizedValue, value.NormalizedValue, null, null); + writer.WriteProperty(options, PropNormalizedValueAsString, value.NormalizedValueAsString, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregateConverter))] +public sealed partial class DerivativeAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DerivativeAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public DerivativeAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DerivativeAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DerivativeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public double? NormalizedValue { get; set; } + public string? NormalizedValueAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "derivative"; /// /// @@ -42,8 +135,10 @@ public sealed partial class DerivativeAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs index 60adc0b08dd..4b0b1058c34 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DerivativeAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DerivativeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationConverter))] public sealed partial class DerivativeAggregation { +#if NET7_0_OR_GREATER + public DerivativeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public DerivativeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DerivativeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class DerivativeAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class DerivativeAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(DerivativeAggregation derivativeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Derivative(derivativeAggregation); } -public sealed partial class DerivativeAggregationDescriptor : SerializableDescriptor +public readonly partial struct DerivativeAggregationDescriptor { - internal DerivativeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DerivativeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation instance) + { + Instance = instance; + } - public DerivativeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DerivativeAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation(Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public DerivativeAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public DerivativeAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public DerivativeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public DerivativeAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public DerivativeAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DerivativeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs index 8c4d8a5b40e..b61c7ddbf0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DiversifiedSamplerAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DiversifiedSamplerAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExecutionHint = System.Text.Json.JsonEncodedText.Encode("execution_hint"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocsPerValue = System.Text.Json.JsonEncodedText.Encode("max_docs_per_value"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExecutionHint = default; + LocalJsonValue propField = default; + LocalJsonValue propMaxDocsPerValue = default; + LocalJsonValue propScript = default; + LocalJsonValue propShardSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExecutionHint.TryReadProperty(ref reader, options, PropExecutionHint, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMaxDocsPerValue.TryReadProperty(ref reader, options, PropMaxDocsPerValue, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExecutionHint = propExecutionHint.Value, + Field = propField.Value, + MaxDocsPerValue = propMaxDocsPerValue.Value, + Script = propScript.Value, + ShardSize = propShardSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExecutionHint, value.ExecutionHint, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMaxDocsPerValue, value.MaxDocsPerValue, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationConverter))] public sealed partial class DiversifiedSamplerAggregation { +#if NET7_0_OR_GREATER + public DiversifiedSamplerAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public DiversifiedSamplerAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The type of value used for de-duplication. /// /// - [JsonInclude, JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHint { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class DiversifiedSamplerAggregation /// The field used to provide values used for de-duplication. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -50,9 +136,7 @@ public sealed partial class DiversifiedSamplerAggregation /// Limits how many documents are permitted per choice of de-duplicating value. /// /// - [JsonInclude, JsonPropertyName("max_docs_per_value")] public int? MaxDocsPerValue { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -60,48 +144,37 @@ public sealed partial class DiversifiedSamplerAggregation /// Limits how many top-scoring documents are collected in the sample processed on each shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(DiversifiedSamplerAggregation diversifiedSamplerAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.DiversifiedSampler(diversifiedSamplerAggregation); } -public sealed partial class DiversifiedSamplerAggregationDescriptor : SerializableDescriptor> +public readonly partial struct DiversifiedSamplerAggregationDescriptor { - internal DiversifiedSamplerAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation Instance { get; init; } - public DiversifiedSamplerAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiversifiedSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private int? MaxDocsPerValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? ShardSizeValue { get; set; } - - /// - /// - /// The type of value used for de-duplication. - /// - /// - public DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? executionHint) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiversifiedSamplerAggregationDescriptor() { - ExecutionHintValue = executionHint; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field used to provide values used for de-duplication. + /// The type of value used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -109,10 +182,10 @@ public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients. /// The field used to provide values used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -120,10 +193,10 @@ public DiversifiedSamplerAggregationDescriptor Field(Expressi /// The field used to provide values used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -131,34 +204,28 @@ public DiversifiedSamplerAggregationDescriptor Field(Expression /// - public DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? maxDocsPerValue) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? value) { - MaxDocsPerValueValue = maxDocsPerValue; - return Self; + Instance.MaxDocsPerValue = value; + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -166,95 +233,54 @@ public DiversifiedSamplerAggregationDescriptor Script(Action /// - public DiversifiedSamplerAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (ExecutionHintValue is not null) + if (action is null) { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MaxDocsPerValueValue.HasValue) - { - writer.WritePropertyName("max_docs_per_value"); - writer.WriteNumberValue(MaxDocsPerValueValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DiversifiedSamplerAggregationDescriptor : SerializableDescriptor +public readonly partial struct DiversifiedSamplerAggregationDescriptor { - internal DiversifiedSamplerAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation Instance { get; init; } - public DiversifiedSamplerAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiversifiedSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private int? MaxDocsPerValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? ShardSizeValue { get; set; } - - /// - /// - /// The type of value used for de-duplication. - /// - /// - public DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? executionHint) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiversifiedSamplerAggregationDescriptor() { - ExecutionHintValue = executionHint; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field used to provide values used for de-duplication. + /// The type of value used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -262,10 +288,10 @@ public DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsear /// The field used to provide values used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -273,10 +299,10 @@ public DiversifiedSamplerAggregationDescriptor Field(Expressi /// The field used to provide values used for de-duplication. /// /// - public DiversifiedSamplerAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -284,34 +310,28 @@ public DiversifiedSamplerAggregationDescriptor Field(Expression /// - public DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? maxDocsPerValue) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor MaxDocsPerValue(int? value) { - MaxDocsPerValueValue = maxDocsPerValue; - return Self; + Instance.MaxDocsPerValue = value; + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DiversifiedSamplerAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -319,55 +339,22 @@ public DiversifiedSamplerAggregationDescriptor Script(Action /// - public DiversifiedSamplerAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MaxDocsPerValueValue.HasValue) - { - writer.WritePropertyName("max_docs_per_value"); - writer.WriteNumberValue(MaxDocsPerValueValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.DiversifiedSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsAggregate.g.cs index cab1c43b3f6..15c411095f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsAggregate.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class DoubleTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSumOtherDocCount = System.Text.Json.JsonEncodedText.Encode("sum_other_doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSumOtherDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSumOtherDocCount.TryReadProperty(ref reader, options, PropSumOtherDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Meta = propMeta.Value, + SumOtherDocCount = propSumOtherDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSumOtherDocCount, value.SumOtherDocCount, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Result of a terms aggregation when the field is some kind of decimal number like a float, double, or distance. /// /// -public sealed partial class DoubleTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsAggregateConverter))] +public sealed partial class DoubleTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count_error_upper_bound")] - public long? DocCountErrorUpperBound { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("sum_other_doc_count")] - public long? SumOtherDocCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public DoubleTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DoubleTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DoubleTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public long? SumOtherDocCount { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "dterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsBucket.g.cs index 7b41be3afc5..7dcc6fbbd1e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DoubleTermsBucket.g.cs @@ -17,87 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class DoubleTermsBucketConverter : JsonConverter +internal sealed partial class DoubleTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override DoubleTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long? docCountErrorUpperBound = default; - double key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count_error_upper_bound") - { - docCountErrorUpperBound = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new DoubleTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, DocCountErrorUpperBound = docCountErrorUpperBound, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, DoubleTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'DoubleTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(DoubleTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.DoubleTermsBucketConverter))] public sealed partial class DoubleTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleTermsBucket(long docCount, double key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public DoubleTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DoubleTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DoubleTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long? DocCountErrorUpperBound { get; init; } - public double Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBounds.g.cs new file mode 100644 index 00000000000..372b28a1e7f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBounds.g.cs @@ -0,0 +1,277 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +internal sealed partial class ExtendedBoundsConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Max = propMax.Value, + Min = propMin.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class ExtendedBoundsConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(ExtendedBounds<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(ExtendedBoundsConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsConverterFactory))] +public sealed partial class ExtendedBounds +{ +#if NET7_0_OR_GREATER + public ExtendedBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + public ExtendedBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Maximum value for the bound. + /// + /// + public T? Max { get; set; } + + /// + /// + /// Minimum value for the bound. + /// + /// + public T? Min { get; set; } +} + +public readonly partial struct ExtendedBoundsOfFieldDateMathDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedBoundsOfFieldDateMathDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedBoundsOfFieldDateMathDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds instance) => new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Maximum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? value) + { + Instance.Max = value; + return this; + } + + /// + /// + /// Maximum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Max() + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(null); + return this; + } + + /// + /// + /// Maximum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Max(System.Func? action) + { + Instance.Max = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(action); + return this; + } + + /// + /// + /// Minimum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? value) + { + Instance.Min = value; + return this; + } + + /// + /// + /// Minimum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Min() + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(null); + return this; + } + + /// + /// + /// Minimum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor Min(System.Func? action) + { + Instance.Min = Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfFieldDateMathDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct ExtendedBoundsOfDoubleDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedBoundsOfDoubleDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedBoundsOfDoubleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds instance) => new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Maximum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor Max(double? value) + { + Instance.Max = value; + return this; + } + + /// + /// + /// Minimum value for the bound. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor Min(double? value) + { + Instance.Min = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs deleted file mode 100644 index 52f80df3091..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsDate.g.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Aggregations; - -public sealed partial class ExtendedBoundsDate -{ - /// - /// - /// Maximum value for the bound. - /// - /// - [JsonInclude, JsonPropertyName("max")] - public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? Max { get; set; } - - /// - /// - /// Minimum value for the bound. - /// - /// - [JsonInclude, JsonPropertyName("min")] - public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? Min { get; set; } -} - -public sealed partial class ExtendedBoundsDateDescriptor : SerializableDescriptor -{ - internal ExtendedBoundsDateDescriptor(Action configure) => configure.Invoke(this); - - public ExtendedBoundsDateDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? MaxValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? MinValue { get; set; } - - /// - /// - /// Maximum value for the bound. - /// - /// - public ExtendedBoundsDateDescriptor Max(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? max) - { - MaxValue = max; - return Self; - } - - /// - /// - /// Minimum value for the bound. - /// - /// - public ExtendedBoundsDateDescriptor Min(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath? min) - { - MinValue = min; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (MaxValue is not null) - { - writer.WritePropertyName("max"); - JsonSerializer.Serialize(writer, MaxValue, options); - } - - if (MinValue is not null) - { - writer.WritePropertyName("min"); - JsonSerializer.Serialize(writer, MinValue, options); - } - - writer.WriteEndObject(); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs deleted file mode 100644 index 8d642caa723..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedBoundsFloat.g.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Aggregations; - -public sealed partial class ExtendedBoundsFloat -{ - /// - /// - /// Maximum value for the bound. - /// - /// - [JsonInclude, JsonPropertyName("max")] - public float? Max { get; set; } - - /// - /// - /// Minimum value for the bound. - /// - /// - [JsonInclude, JsonPropertyName("min")] - public float? Min { get; set; } -} - -public sealed partial class ExtendedBoundsFloatDescriptor : SerializableDescriptor -{ - internal ExtendedBoundsFloatDescriptor(Action configure) => configure.Invoke(this); - - public ExtendedBoundsFloatDescriptor() : base() - { - } - - private float? MaxValue { get; set; } - private float? MinValue { get; set; } - - /// - /// - /// Maximum value for the bound. - /// - /// - public ExtendedBoundsFloatDescriptor Max(float? max) - { - MaxValue = max; - return Self; - } - - /// - /// - /// Minimum value for the bound. - /// - /// - public ExtendedBoundsFloatDescriptor Min(float? min) - { - MinValue = min; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (MaxValue.HasValue) - { - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue.Value); - } - - if (MinValue.HasValue) - { - writer.WritePropertyName("min"); - writer.WriteNumberValue(MinValue.Value); - } - - writer.WriteEndObject(); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregate.g.cs index bac3a657435..b6f058b9b1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregate.g.cs @@ -17,64 +17,367 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class ExtendedStatsAggregate : IAggregate +internal sealed partial class ExtendedStatsAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("avg")] - public double? Avg { get; init; } - [JsonInclude, JsonPropertyName("avg_as_string")] - public string? AvgAsString { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double? Max { get; init; } - [JsonInclude, JsonPropertyName("max_as_string")] - public string? MaxAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double? Min { get; init; } - [JsonInclude, JsonPropertyName("min_as_string")] - public string? MinAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation")] - public double? StdDeviation { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_as_string")] - public string? StdDeviationAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds? StdDeviationBounds { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_bounds_as_string")] - public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString? StdDeviationBoundsAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_population")] - public double? StdDeviationPopulation { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_sampling")] - public double? StdDeviationSampling { get; init; } - [JsonInclude, JsonPropertyName("sum")] - public double Sum { get; init; } - [JsonInclude, JsonPropertyName("sum_as_string")] - public string? SumAsString { get; init; } - [JsonInclude, JsonPropertyName("sum_of_squares")] - public double? SumOfSquares { get; init; } - [JsonInclude, JsonPropertyName("sum_of_squares_as_string")] - public string? SumOfSquaresAsString { get; init; } - [JsonInclude, JsonPropertyName("variance")] - public double? Variance { get; init; } - [JsonInclude, JsonPropertyName("variance_as_string")] - public string? VarianceAsString { get; init; } - [JsonInclude, JsonPropertyName("variance_population")] - public double? VariancePopulation { get; init; } - [JsonInclude, JsonPropertyName("variance_population_as_string")] - public string? VariancePopulationAsString { get; init; } - [JsonInclude, JsonPropertyName("variance_sampling")] - public double? VarianceSampling { get; init; } - [JsonInclude, JsonPropertyName("variance_sampling_as_string")] - public string? VarianceSamplingAsString { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropAvgAsString = System.Text.Json.JsonEncodedText.Encode("avg_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviation = System.Text.Json.JsonEncodedText.Encode("std_deviation"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationAsString = System.Text.Json.JsonEncodedText.Encode("std_deviation_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationBounds = System.Text.Json.JsonEncodedText.Encode("std_deviation_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationBoundsAsString = System.Text.Json.JsonEncodedText.Encode("std_deviation_bounds_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationPopulation = System.Text.Json.JsonEncodedText.Encode("std_deviation_population"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationSampling = System.Text.Json.JsonEncodedText.Encode("std_deviation_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText PropSumAsString = System.Text.Json.JsonEncodedText.Encode("sum_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropSumOfSquares = System.Text.Json.JsonEncodedText.Encode("sum_of_squares"); + private static readonly System.Text.Json.JsonEncodedText PropSumOfSquaresAsString = System.Text.Json.JsonEncodedText.Encode("sum_of_squares_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVariance = System.Text.Json.JsonEncodedText.Encode("variance"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceAsString = System.Text.Json.JsonEncodedText.Encode("variance_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVariancePopulation = System.Text.Json.JsonEncodedText.Encode("variance_population"); + private static readonly System.Text.Json.JsonEncodedText PropVariancePopulationAsString = System.Text.Json.JsonEncodedText.Encode("variance_population_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceSampling = System.Text.Json.JsonEncodedText.Encode("variance_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceSamplingAsString = System.Text.Json.JsonEncodedText.Encode("variance_sampling_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propAvgAsString = default; + LocalJsonValue propCount = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + LocalJsonValue propStdDeviation = default; + LocalJsonValue propStdDeviationAsString = default; + LocalJsonValue propStdDeviationBounds = default; + LocalJsonValue propStdDeviationBoundsAsString = default; + LocalJsonValue propStdDeviationPopulation = default; + LocalJsonValue propStdDeviationSampling = default; + LocalJsonValue propSum = default; + LocalJsonValue propSumAsString = default; + LocalJsonValue propSumOfSquares = default; + LocalJsonValue propSumOfSquaresAsString = default; + LocalJsonValue propVariance = default; + LocalJsonValue propVarianceAsString = default; + LocalJsonValue propVariancePopulation = default; + LocalJsonValue propVariancePopulationAsString = default; + LocalJsonValue propVarianceSampling = default; + LocalJsonValue propVarianceSamplingAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propAvgAsString.TryReadProperty(ref reader, options, PropAvgAsString, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + if (propStdDeviation.TryReadProperty(ref reader, options, PropStdDeviation, null)) + { + continue; + } + + if (propStdDeviationAsString.TryReadProperty(ref reader, options, PropStdDeviationAsString, null)) + { + continue; + } + + if (propStdDeviationBounds.TryReadProperty(ref reader, options, PropStdDeviationBounds, null)) + { + continue; + } + + if (propStdDeviationBoundsAsString.TryReadProperty(ref reader, options, PropStdDeviationBoundsAsString, null)) + { + continue; + } + + if (propStdDeviationPopulation.TryReadProperty(ref reader, options, PropStdDeviationPopulation, null)) + { + continue; + } + + if (propStdDeviationSampling.TryReadProperty(ref reader, options, PropStdDeviationSampling, null)) + { + continue; + } + + if (propSum.TryReadProperty(ref reader, options, PropSum, null)) + { + continue; + } + + if (propSumAsString.TryReadProperty(ref reader, options, PropSumAsString, null)) + { + continue; + } + + if (propSumOfSquares.TryReadProperty(ref reader, options, PropSumOfSquares, null)) + { + continue; + } + + if (propSumOfSquaresAsString.TryReadProperty(ref reader, options, PropSumOfSquaresAsString, null)) + { + continue; + } + + if (propVariance.TryReadProperty(ref reader, options, PropVariance, null)) + { + continue; + } + + if (propVarianceAsString.TryReadProperty(ref reader, options, PropVarianceAsString, null)) + { + continue; + } + + if (propVariancePopulation.TryReadProperty(ref reader, options, PropVariancePopulation, null)) + { + continue; + } + + if (propVariancePopulationAsString.TryReadProperty(ref reader, options, PropVariancePopulationAsString, null)) + { + continue; + } + + if (propVarianceSampling.TryReadProperty(ref reader, options, PropVarianceSampling, null)) + { + continue; + } + + if (propVarianceSamplingAsString.TryReadProperty(ref reader, options, PropVarianceSamplingAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + AvgAsString = propAvgAsString.Value, + Count = propCount.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Meta = propMeta.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value, + StdDeviation = propStdDeviation.Value, + StdDeviationAsString = propStdDeviationAsString.Value, + StdDeviationBounds = propStdDeviationBounds.Value, + StdDeviationBoundsAsString = propStdDeviationBoundsAsString.Value, + StdDeviationPopulation = propStdDeviationPopulation.Value, + StdDeviationSampling = propStdDeviationSampling.Value, + Sum = propSum.Value, + SumAsString = propSumAsString.Value, + SumOfSquares = propSumOfSquares.Value, + SumOfSquaresAsString = propSumOfSquaresAsString.Value, + Variance = propVariance.Value, + VarianceAsString = propVarianceAsString.Value, + VariancePopulation = propVariancePopulation.Value, + VariancePopulationAsString = propVariancePopulationAsString.Value, + VarianceSampling = propVarianceSampling.Value, + VarianceSamplingAsString = propVarianceSamplingAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropAvgAsString, value.AvgAsString, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + writer.WriteProperty(options, PropStdDeviation, value.StdDeviation, null, null); + writer.WriteProperty(options, PropStdDeviationAsString, value.StdDeviationAsString, null, null); + writer.WriteProperty(options, PropStdDeviationBounds, value.StdDeviationBounds, null, null); + writer.WriteProperty(options, PropStdDeviationBoundsAsString, value.StdDeviationBoundsAsString, null, null); + writer.WriteProperty(options, PropStdDeviationPopulation, value.StdDeviationPopulation, null, null); + writer.WriteProperty(options, PropStdDeviationSampling, value.StdDeviationSampling, null, null); + writer.WriteProperty(options, PropSum, value.Sum, null, null); + writer.WriteProperty(options, PropSumAsString, value.SumAsString, null, null); + writer.WriteProperty(options, PropSumOfSquares, value.SumOfSquares, null, null); + writer.WriteProperty(options, PropSumOfSquaresAsString, value.SumOfSquaresAsString, null, null); + writer.WriteProperty(options, PropVariance, value.Variance, null, null); + writer.WriteProperty(options, PropVarianceAsString, value.VarianceAsString, null, null); + writer.WriteProperty(options, PropVariancePopulation, value.VariancePopulation, null, null); + writer.WriteProperty(options, PropVariancePopulationAsString, value.VariancePopulationAsString, null, null); + writer.WriteProperty(options, PropVarianceSampling, value.VarianceSampling, null, null); + writer.WriteProperty(options, PropVarianceSamplingAsString, value.VarianceSamplingAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregateConverter))] +public sealed partial class ExtendedStatsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsAggregate(double? avg, long count, double? max, double? min, double? stdDeviation, double? stdDeviationPopulation, double? stdDeviationSampling, double sum, double? sumOfSquares, double? variance, double? variancePopulation, double? varianceSampling) + { + Avg = avg; + Count = count; + Max = max; + Min = min; + StdDeviation = stdDeviation; + StdDeviationPopulation = stdDeviationPopulation; + StdDeviationSampling = stdDeviationSampling; + Sum = sum; + SumOfSquares = sumOfSquares; + Variance = variance; + VariancePopulation = variancePopulation; + VarianceSampling = varianceSampling; + } +#if NET7_0_OR_GREATER + public ExtendedStatsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExtendedStatsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? Avg { get; set; } + public string? AvgAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Max { get; set; } + public string? MaxAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Min { get; set; } + public string? MinAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviation { get; set; } + public string? StdDeviationAsString { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds? StdDeviationBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString? StdDeviationBoundsAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviationPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviationSampling { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Sum { get; set; } + public string? SumAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? SumOfSquares { get; set; } + public string? SumOfSquaresAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "extended_stats"; + + public +#if NET7_0_OR_GREATER + required +#endif + double? Variance { get; set; } + public string? VarianceAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? VariancePopulation { get; set; } + public string? VariancePopulationAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? VarianceSampling { get; set; } + public string? VarianceSamplingAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs index 05ce54ab37d..c60d93451e4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsAggregation.g.cs @@ -17,26 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ExtendedStatsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSigma = System.Text.Json.JsonEncodedText.Encode("sigma"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue propSigma = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSigma.TryReadProperty(ref reader, options, PropSigma, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value, + Sigma = propSigma.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSigma, value.Sigma, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationConverter))] public sealed partial class ExtendedStatsAggregation { +#if NET7_0_OR_GREATER + public ExtendedStatsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ExtendedStatsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,9 +131,7 @@ public sealed partial class ExtendedStatsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -55,48 +139,37 @@ public sealed partial class ExtendedStatsAggregation /// The number of standard deviations above/below the mean to display. /// /// - [JsonInclude, JsonPropertyName("sigma")] public double? Sigma { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ExtendedStatsAggregation extendedStatsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ExtendedStats(extendedStatsAggregation); } -public sealed partial class ExtendedStatsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ExtendedStatsAggregationDescriptor { - internal ExtendedStatsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation Instance { get; init; } - public ExtendedStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private double? SigmaValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public ExtendedStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public ExtendedStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -104,16 +177,16 @@ public ExtendedStatsAggregationDescriptor Field(Expression /// - public ExtendedStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ExtendedStatsAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -122,34 +195,28 @@ public ExtendedStatsAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public ExtendedStatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ExtendedStatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -157,95 +224,54 @@ public ExtendedStatsAggregationDescriptor Script(Action /// - public ExtendedStatsAggregationDescriptor Sigma(double? sigma) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Sigma(double? value) { - SigmaValue = sigma; - return Self; + Instance.Sigma = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (SigmaValue.HasValue) - { - writer.WritePropertyName("sigma"); - writer.WriteNumberValue(SigmaValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ExtendedStatsAggregationDescriptor : SerializableDescriptor +public readonly partial struct ExtendedStatsAggregationDescriptor { - internal ExtendedStatsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation Instance { get; init; } - public ExtendedStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private double? SigmaValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public ExtendedStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public ExtendedStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -253,16 +279,16 @@ public ExtendedStatsAggregationDescriptor Field(Expression /// - public ExtendedStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ExtendedStatsAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -271,34 +297,28 @@ public ExtendedStatsAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public ExtendedStatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ExtendedStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ExtendedStatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -306,55 +326,22 @@ public ExtendedStatsAggregationDescriptor Script(Action /// - public ExtendedStatsAggregationDescriptor Sigma(double? sigma) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor Sigma(double? value) { - SigmaValue = sigma; - return Self; + Instance.Sigma = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SigmaValue.HasValue) - { - writer.WritePropertyName("sigma"); - writer.WriteNumberValue(SigmaValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregate.g.cs index 745361506c4..bd13ebfb7af 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregate.g.cs @@ -17,64 +17,367 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class ExtendedStatsBucketAggregate : IAggregate +internal sealed partial class ExtendedStatsBucketAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("avg")] - public double? Avg { get; init; } - [JsonInclude, JsonPropertyName("avg_as_string")] - public string? AvgAsString { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double? Max { get; init; } - [JsonInclude, JsonPropertyName("max_as_string")] - public string? MaxAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double? Min { get; init; } - [JsonInclude, JsonPropertyName("min_as_string")] - public string? MinAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation")] - public double? StdDeviation { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_as_string")] - public string? StdDeviationAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds? StdDeviationBounds { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_bounds_as_string")] - public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString? StdDeviationBoundsAsString { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_population")] - public double? StdDeviationPopulation { get; init; } - [JsonInclude, JsonPropertyName("std_deviation_sampling")] - public double? StdDeviationSampling { get; init; } - [JsonInclude, JsonPropertyName("sum")] - public double Sum { get; init; } - [JsonInclude, JsonPropertyName("sum_as_string")] - public string? SumAsString { get; init; } - [JsonInclude, JsonPropertyName("sum_of_squares")] - public double? SumOfSquares { get; init; } - [JsonInclude, JsonPropertyName("sum_of_squares_as_string")] - public string? SumOfSquaresAsString { get; init; } - [JsonInclude, JsonPropertyName("variance")] - public double? Variance { get; init; } - [JsonInclude, JsonPropertyName("variance_as_string")] - public string? VarianceAsString { get; init; } - [JsonInclude, JsonPropertyName("variance_population")] - public double? VariancePopulation { get; init; } - [JsonInclude, JsonPropertyName("variance_population_as_string")] - public string? VariancePopulationAsString { get; init; } - [JsonInclude, JsonPropertyName("variance_sampling")] - public double? VarianceSampling { get; init; } - [JsonInclude, JsonPropertyName("variance_sampling_as_string")] - public string? VarianceSamplingAsString { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropAvgAsString = System.Text.Json.JsonEncodedText.Encode("avg_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviation = System.Text.Json.JsonEncodedText.Encode("std_deviation"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationAsString = System.Text.Json.JsonEncodedText.Encode("std_deviation_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationBounds = System.Text.Json.JsonEncodedText.Encode("std_deviation_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationBoundsAsString = System.Text.Json.JsonEncodedText.Encode("std_deviation_bounds_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationPopulation = System.Text.Json.JsonEncodedText.Encode("std_deviation_population"); + private static readonly System.Text.Json.JsonEncodedText PropStdDeviationSampling = System.Text.Json.JsonEncodedText.Encode("std_deviation_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText PropSumAsString = System.Text.Json.JsonEncodedText.Encode("sum_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropSumOfSquares = System.Text.Json.JsonEncodedText.Encode("sum_of_squares"); + private static readonly System.Text.Json.JsonEncodedText PropSumOfSquaresAsString = System.Text.Json.JsonEncodedText.Encode("sum_of_squares_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVariance = System.Text.Json.JsonEncodedText.Encode("variance"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceAsString = System.Text.Json.JsonEncodedText.Encode("variance_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVariancePopulation = System.Text.Json.JsonEncodedText.Encode("variance_population"); + private static readonly System.Text.Json.JsonEncodedText PropVariancePopulationAsString = System.Text.Json.JsonEncodedText.Encode("variance_population_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceSampling = System.Text.Json.JsonEncodedText.Encode("variance_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropVarianceSamplingAsString = System.Text.Json.JsonEncodedText.Encode("variance_sampling_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propAvgAsString = default; + LocalJsonValue propCount = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + LocalJsonValue propStdDeviation = default; + LocalJsonValue propStdDeviationAsString = default; + LocalJsonValue propStdDeviationBounds = default; + LocalJsonValue propStdDeviationBoundsAsString = default; + LocalJsonValue propStdDeviationPopulation = default; + LocalJsonValue propStdDeviationSampling = default; + LocalJsonValue propSum = default; + LocalJsonValue propSumAsString = default; + LocalJsonValue propSumOfSquares = default; + LocalJsonValue propSumOfSquaresAsString = default; + LocalJsonValue propVariance = default; + LocalJsonValue propVarianceAsString = default; + LocalJsonValue propVariancePopulation = default; + LocalJsonValue propVariancePopulationAsString = default; + LocalJsonValue propVarianceSampling = default; + LocalJsonValue propVarianceSamplingAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propAvgAsString.TryReadProperty(ref reader, options, PropAvgAsString, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + if (propStdDeviation.TryReadProperty(ref reader, options, PropStdDeviation, null)) + { + continue; + } + + if (propStdDeviationAsString.TryReadProperty(ref reader, options, PropStdDeviationAsString, null)) + { + continue; + } + + if (propStdDeviationBounds.TryReadProperty(ref reader, options, PropStdDeviationBounds, null)) + { + continue; + } + + if (propStdDeviationBoundsAsString.TryReadProperty(ref reader, options, PropStdDeviationBoundsAsString, null)) + { + continue; + } + + if (propStdDeviationPopulation.TryReadProperty(ref reader, options, PropStdDeviationPopulation, null)) + { + continue; + } + + if (propStdDeviationSampling.TryReadProperty(ref reader, options, PropStdDeviationSampling, null)) + { + continue; + } + + if (propSum.TryReadProperty(ref reader, options, PropSum, null)) + { + continue; + } + + if (propSumAsString.TryReadProperty(ref reader, options, PropSumAsString, null)) + { + continue; + } + + if (propSumOfSquares.TryReadProperty(ref reader, options, PropSumOfSquares, null)) + { + continue; + } + + if (propSumOfSquaresAsString.TryReadProperty(ref reader, options, PropSumOfSquaresAsString, null)) + { + continue; + } + + if (propVariance.TryReadProperty(ref reader, options, PropVariance, null)) + { + continue; + } + + if (propVarianceAsString.TryReadProperty(ref reader, options, PropVarianceAsString, null)) + { + continue; + } + + if (propVariancePopulation.TryReadProperty(ref reader, options, PropVariancePopulation, null)) + { + continue; + } + + if (propVariancePopulationAsString.TryReadProperty(ref reader, options, PropVariancePopulationAsString, null)) + { + continue; + } + + if (propVarianceSampling.TryReadProperty(ref reader, options, PropVarianceSampling, null)) + { + continue; + } + + if (propVarianceSamplingAsString.TryReadProperty(ref reader, options, PropVarianceSamplingAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + AvgAsString = propAvgAsString.Value, + Count = propCount.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Meta = propMeta.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value, + StdDeviation = propStdDeviation.Value, + StdDeviationAsString = propStdDeviationAsString.Value, + StdDeviationBounds = propStdDeviationBounds.Value, + StdDeviationBoundsAsString = propStdDeviationBoundsAsString.Value, + StdDeviationPopulation = propStdDeviationPopulation.Value, + StdDeviationSampling = propStdDeviationSampling.Value, + Sum = propSum.Value, + SumAsString = propSumAsString.Value, + SumOfSquares = propSumOfSquares.Value, + SumOfSquaresAsString = propSumOfSquaresAsString.Value, + Variance = propVariance.Value, + VarianceAsString = propVarianceAsString.Value, + VariancePopulation = propVariancePopulation.Value, + VariancePopulationAsString = propVariancePopulationAsString.Value, + VarianceSampling = propVarianceSampling.Value, + VarianceSamplingAsString = propVarianceSamplingAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropAvgAsString, value.AvgAsString, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + writer.WriteProperty(options, PropStdDeviation, value.StdDeviation, null, null); + writer.WriteProperty(options, PropStdDeviationAsString, value.StdDeviationAsString, null, null); + writer.WriteProperty(options, PropStdDeviationBounds, value.StdDeviationBounds, null, null); + writer.WriteProperty(options, PropStdDeviationBoundsAsString, value.StdDeviationBoundsAsString, null, null); + writer.WriteProperty(options, PropStdDeviationPopulation, value.StdDeviationPopulation, null, null); + writer.WriteProperty(options, PropStdDeviationSampling, value.StdDeviationSampling, null, null); + writer.WriteProperty(options, PropSum, value.Sum, null, null); + writer.WriteProperty(options, PropSumAsString, value.SumAsString, null, null); + writer.WriteProperty(options, PropSumOfSquares, value.SumOfSquares, null, null); + writer.WriteProperty(options, PropSumOfSquaresAsString, value.SumOfSquaresAsString, null, null); + writer.WriteProperty(options, PropVariance, value.Variance, null, null); + writer.WriteProperty(options, PropVarianceAsString, value.VarianceAsString, null, null); + writer.WriteProperty(options, PropVariancePopulation, value.VariancePopulation, null, null); + writer.WriteProperty(options, PropVariancePopulationAsString, value.VariancePopulationAsString, null, null); + writer.WriteProperty(options, PropVarianceSampling, value.VarianceSampling, null, null); + writer.WriteProperty(options, PropVarianceSamplingAsString, value.VarianceSamplingAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregateConverter))] +public sealed partial class ExtendedStatsBucketAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsBucketAggregate(double? avg, long count, double? max, double? min, double? stdDeviation, double? stdDeviationPopulation, double? stdDeviationSampling, double sum, double? sumOfSquares, double? variance, double? variancePopulation, double? varianceSampling) + { + Avg = avg; + Count = count; + Max = max; + Min = min; + StdDeviation = stdDeviation; + StdDeviationPopulation = stdDeviationPopulation; + StdDeviationSampling = stdDeviationSampling; + Sum = sum; + SumOfSquares = sumOfSquares; + Variance = variance; + VariancePopulation = variancePopulation; + VarianceSampling = varianceSampling; + } +#if NET7_0_OR_GREATER + public ExtendedStatsBucketAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExtendedStatsBucketAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedStatsBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? Avg { get; set; } + public string? AvgAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Max { get; set; } + public string? MaxAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Min { get; set; } + public string? MinAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviation { get; set; } + public string? StdDeviationAsString { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds? StdDeviationBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString? StdDeviationBoundsAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviationPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? StdDeviationSampling { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Sum { get; set; } + public string? SumAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? SumOfSquares { get; set; } + public string? SumOfSquaresAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "extended_stats_bucket"; + + public +#if NET7_0_OR_GREATER + required +#endif + double? Variance { get; set; } + public string? VarianceAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? VariancePopulation { get; set; } + public string? VariancePopulationAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? VarianceSampling { get; set; } + public string? VarianceSamplingAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs index c4e7f55711a..5dfd076bdd2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ExtendedStatsBucketAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ExtendedStatsBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSigma = System.Text.Json.JsonEncodedText.Encode("sigma"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propSigma = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propSigma.TryReadProperty(ref reader, options, PropSigma, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Sigma = propSigma.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropSigma, value.Sigma, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationConverter))] public sealed partial class ExtendedStatsBucketAggregation { +#if NET7_0_OR_GREATER + public ExtendedStatsBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ExtendedStatsBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class ExtendedStatsBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class ExtendedStatsBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,34 +135,37 @@ public sealed partial class ExtendedStatsBucketAggregation /// The number of standard deviations above/below the mean to display. /// /// - [JsonInclude, JsonPropertyName("sigma")] public double? Sigma { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ExtendedStatsBucketAggregation extendedStatsBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ExtendedStatsBucket(extendedStatsBucketAggregation); } -public sealed partial class ExtendedStatsBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct ExtendedStatsBucketAggregationDescriptor { - internal ExtendedStatsBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation Instance { get; init; } - public ExtendedStatsBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private double? SigmaValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExtendedStatsBucketAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public ExtendedStatsBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -95,10 +174,10 @@ public ExtendedStatsBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elas /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public ExtendedStatsBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -106,10 +185,10 @@ public ExtendedStatsBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public ExtendedStatsBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -117,39 +196,22 @@ public ExtendedStatsBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasti /// The number of standard deviations above/below the mean to display. /// /// - public ExtendedStatsBucketAggregationDescriptor Sigma(double? sigma) + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor Sigma(double? value) { - SigmaValue = sigma; - return Self; + Instance.Sigma = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) + if (action is null) { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (SigmaValue.HasValue) - { - writer.WritePropertyName("sigma"); - writer.WriteNumberValue(SigmaValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ExtendedStatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs index 1d37920bad0..60495285dc7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs @@ -17,32 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class FieldDateMathConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// A date range limit, represented either as a DateMath expression or a number expressed /// according to the target field's precision. /// /// -public sealed partial class FieldDateMath : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathConverter))] +public sealed partial class FieldDateMath : Elastic.Clients.Elasticsearch.Union { - public FieldDateMath(string Expr) : base(Expr) + public FieldDateMath(Elastic.Clients.Elasticsearch.DateMath value) : base(value) + { + } + + public FieldDateMath(double value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(Elastic.Clients.Elasticsearch.DateMath value) => new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(value); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(double value) => new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(value); +} + +public readonly partial struct FieldDateMathFactory +{ + public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath Expr(Elastic.Clients.Elasticsearch.DateMath value) + { + return new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(value); + } + + public Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath Value(double value) { + return new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath(value); } - public FieldDateMath(double Value) : base(Value) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FieldDateMath Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FieldDateMathFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FilterAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FilterAggregate.g.cs index 20dac2acc0f..b91761e535d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FilterAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FilterAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class FilterAggregateConverter : JsonConverter +internal sealed partial class FilterAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override FilterAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FilterAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new FilterAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FilterAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, FilterAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FilterAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'FilterAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(FilterAggregateConverter))] -public sealed partial class FilterAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FilterAggregateConverter))] +public sealed partial class FilterAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public FilterAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FilterAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FilterAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "filter"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregate.g.cs index 7dcc5086217..b819d96e065 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class FiltersAggregate : IAggregate +internal sealed partial class FiltersAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregateConverter))] +public sealed partial class FiltersAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public FiltersAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FiltersAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FiltersAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "filters"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs index 0f257ca25b2..fe35f4aa215 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersAggregation.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class FiltersAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText PropOtherBucket = System.Text.Json.JsonEncodedText.Encode("other_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropOtherBucketKey = System.Text.Json.JsonEncodedText.Encode("other_bucket_key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFilters = default; + LocalJsonValue propOtherBucket = default; + LocalJsonValue propOtherBucketKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilters.TryReadProperty(ref reader, options, PropFilters, null)) + { + continue; + } + + if (propOtherBucket.TryReadProperty(ref reader, options, PropOtherBucket, null)) + { + continue; + } + + if (propOtherBucketKey.TryReadProperty(ref reader, options, PropOtherBucketKey, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filters = propFilters.Value, + OtherBucket = propOtherBucket.Value, + OtherBucketKey = propOtherBucketKey.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilters, value.Filters, null, null); + writer.WriteProperty(options, PropOtherBucket, value.OtherBucket, null, null); + writer.WriteProperty(options, PropOtherBucketKey, value.OtherBucketKey, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationConverter))] public sealed partial class FiltersAggregation { +#if NET7_0_OR_GREATER + public FiltersAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public FiltersAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Collection of queries from which to build buckets. /// /// - [JsonInclude, JsonPropertyName("filters")] public Elastic.Clients.Elasticsearch.Aggregations.Buckets? Filters { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class FiltersAggregation /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. /// /// - [JsonInclude, JsonPropertyName("other_bucket")] public bool? OtherBucket { get; set; } /// @@ -50,33 +118,48 @@ public sealed partial class FiltersAggregation /// The key with which the other bucket is returned. /// /// - [JsonInclude, JsonPropertyName("other_bucket_key")] public string? OtherBucketKey { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(FiltersAggregation filtersAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Filters(filtersAggregation); } -public sealed partial class FiltersAggregationDescriptor : SerializableDescriptor> +public readonly partial struct FiltersAggregationDescriptor { - internal FiltersAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation Instance { get; init; } - public FiltersAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } - private bool? OtherBucketValue { get; set; } - private string? OtherBucketKeyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Collection of queries from which to build buckets. /// /// - public FiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? value) { - FiltersValue = filters; - return Self; + Instance.Filters = value; + return this; + } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor Filters(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfQueryFactory.Build(action); + return this; } /// @@ -84,10 +167,10 @@ public FiltersAggregationDescriptor Filters(Elastic.Clients.Elasticse /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. /// /// - public FiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor OtherBucket(bool? value = true) { - OtherBucketValue = otherBucket; - return Self; + Instance.OtherBucket = value; + return this; } /// @@ -95,103 +178,110 @@ public FiltersAggregationDescriptor OtherBucket(bool? otherBucket = t /// The key with which the other bucket is returned. /// /// - public FiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor OtherBucketKey(string? value) { - OtherBucketKeyValue = otherBucketKey; - return Self; + Instance.OtherBucketKey = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FiltersValue is not null) - { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - } - - if (OtherBucketValue.HasValue) + if (action is null) { - writer.WritePropertyName("other_bucket"); - writer.WriteBooleanValue(OtherBucketValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(OtherBucketKeyValue)) - { - writer.WritePropertyName("other_bucket_key"); - writer.WriteStringValue(OtherBucketKeyValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FiltersAggregationDescriptor : SerializableDescriptor +public readonly partial struct FiltersAggregationDescriptor { - internal FiltersAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation Instance { get; init; } - public FiltersAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } - private bool? OtherBucketValue { get; set; } - private string? OtherBucketKeyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Collection of queries from which to build buckets. /// /// - public FiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? value) { - FiltersValue = filters; - return Self; + Instance.Filters = value; + return this; } /// /// - /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// Collection of queries from which to build buckets. /// /// - public FiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor Filters(System.Func> action) { - OtherBucketValue = otherBucket; - return Self; + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfQueryFactory.Build(action); + return this; } /// /// - /// The key with which the other bucket is returned. + /// Collection of queries from which to build buckets. /// /// - public FiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor Filters(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) { - OtherBucketKeyValue = otherBucketKey; - return Self; + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfQueryFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor OtherBucket(bool? value = true) { - writer.WriteStartObject(); - if (FiltersValue is not null) - { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - } + Instance.OtherBucket = value; + return this; + } - if (OtherBucketValue.HasValue) - { - writer.WritePropertyName("other_bucket"); - writer.WriteBooleanValue(OtherBucketValue.Value); - } + /// + /// + /// The key with which the other bucket is returned. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor OtherBucketKey(string? value) + { + Instance.OtherBucketKey = value; + return this; + } - if (!string.IsNullOrEmpty(OtherBucketKeyValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("other_bucket_key"); - writer.WriteStringValue(OtherBucketKeyValue); + return new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersBucket.g.cs index 3551b48bfdb..3729ac72160 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FiltersBucket.g.cs @@ -17,63 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class FiltersBucketConverter : JsonConverter +internal sealed partial class FiltersBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override FiltersBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FiltersBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } - - throw new JsonException("Unknown property read from JSON."); + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new FiltersBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FiltersBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value + }; } - public override void Write(Utf8JsonWriter writer, FiltersBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FiltersBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'FiltersBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(FiltersBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FiltersBucketConverter))] public sealed partial class FiltersBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FiltersBucket(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public FiltersBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FiltersBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FiltersBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregate.g.cs index 10bd279d590..1a52fbd74d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class FrequentItemSetsAggregate : IAggregate +internal sealed partial class FrequentItemSetsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregateConverter))] +public sealed partial class FrequentItemSetsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public FrequentItemSetsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FrequentItemSetsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrequentItemSetsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "frequent_item_sets"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregation.g.cs index 7e90a6ceca1..8f9f9b0960a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsAggregation.g.cs @@ -17,32 +17,128 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class FrequentItemSetsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumSetSize = System.Text.Json.JsonEncodedText.Encode("minimum_set_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumSupport = System.Text.Json.JsonEncodedText.Encode("minimum_support"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFields = default; + LocalJsonValue propFilter = default; + LocalJsonValue propMinimumSetSize = default; + LocalJsonValue propMinimumSupport = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propMinimumSetSize.TryReadProperty(ref reader, options, PropMinimumSetSize, null)) + { + continue; + } + + if (propMinimumSupport.TryReadProperty(ref reader, options, PropMinimumSupport, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Filter = propFilter.Value, + MinimumSetSize = propMinimumSetSize.Value, + MinimumSupport = propMinimumSupport.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropMinimumSetSize, value.MinimumSetSize, null, null); + writer.WriteProperty(options, PropMinimumSupport, value.MinimumSupport, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationConverter))] public sealed partial class FrequentItemSetsAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregation(System.Collections.Generic.ICollection fields) + { + Fields = fields; + } +#if NET7_0_OR_GREATER + public FrequentItemSetsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FrequentItemSetsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Fields to analyze. /// /// - [JsonInclude, JsonPropertyName("fields")] - public ICollection Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Fields { get; set; } /// /// /// Query that filters documents from analysis. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -50,7 +146,6 @@ public sealed partial class FrequentItemSetsAggregation /// The minimum size of one item set. /// /// - [JsonInclude, JsonPropertyName("minimum_set_size")] public int? MinimumSetSize { get; set; } /// @@ -58,7 +153,6 @@ public sealed partial class FrequentItemSetsAggregation /// The minimum support of one item set. /// /// - [JsonInclude, JsonPropertyName("minimum_support")] public double? MinimumSupport { get; set; } /// @@ -66,70 +160,65 @@ public sealed partial class FrequentItemSetsAggregation /// The number of top item sets to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(FrequentItemSetsAggregation frequentItemSetsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.FrequentItemSets(frequentItemSetsAggregation); } -public sealed partial class FrequentItemSetsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct FrequentItemSetsAggregationDescriptor { - internal FrequentItemSetsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation Instance { get; init; } - public FrequentItemSetsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation instance) { + Instance = instance; } - private ICollection FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private int? MinimumSetSizeValue { get; set; } - private double? MinimumSupportValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Fields to analyze. /// /// - public FrequentItemSetsAggregationDescriptor Fields(ICollection fields) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(System.Collections.Generic.ICollection value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FrequentItemSetsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor descriptor) + /// + /// + /// Fields to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(params Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public FrequentItemSetsAggregationDescriptor Fields(Action> configure) + /// + /// + /// Fields to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor.Build(action)); + } - public FrequentItemSetsAggregationDescriptor Fields(params Action>[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// @@ -137,28 +226,21 @@ public FrequentItemSetsAggregationDescriptor Fields(params Action /// - public FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public FrequentItemSetsAggregationDescriptor Filter(Action> configure) + /// + /// + /// Query that filters documents from analysis. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -166,10 +248,10 @@ public FrequentItemSetsAggregationDescriptor Filter(Action /// - public FrequentItemSetsAggregationDescriptor MinimumSetSize(int? minimumSetSize) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor MinimumSetSize(int? value) { - MinimumSetSizeValue = minimumSetSize; - return Self; + Instance.MinimumSetSize = value; + return this; } /// @@ -177,10 +259,10 @@ public FrequentItemSetsAggregationDescriptor MinimumSetSize(int? mini /// The minimum support of one item set. /// /// - public FrequentItemSetsAggregationDescriptor MinimumSupport(double? minimumSupport) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor MinimumSupport(double? value) { - MinimumSupportValue = minimumSupport; - return Self; + Instance.MinimumSupport = value; + return this; } /// @@ -188,142 +270,94 @@ public FrequentItemSetsAggregationDescriptor MinimumSupport(double? m /// The number of top item sets to return. /// /// - public FrequentItemSetsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MinimumSetSizeValue.HasValue) - { - writer.WritePropertyName("minimum_set_size"); - writer.WriteNumberValue(MinimumSetSizeValue.Value); - } - - if (MinimumSupportValue.HasValue) - { - writer.WritePropertyName("minimum_support"); - writer.WriteNumberValue(MinimumSupportValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FrequentItemSetsAggregationDescriptor : SerializableDescriptor +public readonly partial struct FrequentItemSetsAggregationDescriptor { - internal FrequentItemSetsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation instance) + { + Instance = instance; + } - public FrequentItemSetsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private int? MinimumSetSizeValue { get; set; } - private double? MinimumSupportValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Fields to analyze. /// /// - public FrequentItemSetsAggregationDescriptor Fields(ICollection fields) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(System.Collections.Generic.ICollection value) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FrequentItemSetsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor descriptor) + /// + /// + /// Fields to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(params Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField[] values) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.Fields = [.. values]; + return this; } - public FrequentItemSetsAggregationDescriptor Fields(Action configure) + /// + /// + /// Fields to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(params System.Action[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; } - public FrequentItemSetsAggregationDescriptor Fields(params Action[] configure) + /// + /// + /// Fields to analyze. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; } /// @@ -331,28 +365,32 @@ public FrequentItemSetsAggregationDescriptor Fields(params Action /// - public FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public FrequentItemSetsAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query that filters documents from analysis. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FrequentItemSetsAggregationDescriptor Filter(Action configure) + /// + /// + /// Query that filters documents from analysis. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -360,10 +398,10 @@ public FrequentItemSetsAggregationDescriptor Filter(Action /// - public FrequentItemSetsAggregationDescriptor MinimumSetSize(int? minimumSetSize) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor MinimumSetSize(int? value) { - MinimumSetSizeValue = minimumSetSize; - return Self; + Instance.MinimumSetSize = value; + return this; } /// @@ -371,10 +409,10 @@ public FrequentItemSetsAggregationDescriptor MinimumSetSize(int? minimumSetSize) /// The minimum support of one item set. /// /// - public FrequentItemSetsAggregationDescriptor MinimumSupport(double? minimumSupport) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor MinimumSupport(double? value) { - MinimumSupportValue = minimumSupport; - return Self; + Instance.MinimumSupport = value; + return this; } /// @@ -382,80 +420,17 @@ public FrequentItemSetsAggregationDescriptor MinimumSupport(double? minimumSuppo /// The number of top item sets to return. /// /// - public FrequentItemSetsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MinimumSetSizeValue.HasValue) - { - writer.WritePropertyName("minimum_set_size"); - writer.WriteNumberValue(MinimumSetSizeValue.Value); - } - - if (MinimumSupportValue.HasValue) - { - writer.WritePropertyName("minimum_support"); - writer.WriteNumberValue(MinimumSupportValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsBucket.g.cs index 88ff41a35f0..61db1257b76 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsBucket.g.cs @@ -17,79 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class FrequentItemSetsBucketConverter : JsonConverter +internal sealed partial class FrequentItemSetsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override FrequentItemSetsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropSupport = System.Text.Json.JsonEncodedText.Encode("support"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary> key = default; - double support = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue>> propKey = default; + LocalJsonValue propSupport = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize>>(ref reader, options); - continue; - } - - if (property == "support") - { - support = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propSupport.TryReadProperty(ref reader, options, PropSupport, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new FrequentItemSetsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key, Support = support }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value, + Support = propSupport.Value + }; } - public override void Write(Utf8JsonWriter writer, FrequentItemSetsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'FrequentItemSetsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropSupport, value.Support, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(FrequentItemSetsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsBucketConverter))] public sealed partial class FrequentItemSetsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsBucket(long docCount, System.Collections.Generic.IReadOnlyDictionary> key, double support) + { + DocCount = docCount; + Key = key; + Support = support; + } +#if NET7_0_OR_GREATER + public FrequentItemSetsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FrequentItemSetsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrequentItemSetsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary> Key { get; init; } - public double Support { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Key { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Support { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsField.g.cs index 82bfc4b407b..41084151230 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FrequentItemSetsField.g.cs @@ -17,28 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class FrequentItemSetsFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + + public override Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExclude = default; + LocalJsonValue propField = default; + LocalJsonValue propInclude = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exclude = propExclude.Value, + Field = propField.Value, + Include = propInclude.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldConverter))] public sealed partial class FrequentItemSetsField { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsField(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public FrequentItemSetsField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FrequentItemSetsField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Values to exclude. /// Can be regular expression strings or arrays of strings of exact terms. /// /// - [JsonInclude, JsonPropertyName("exclude")] public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -46,21 +124,27 @@ public sealed partial class FrequentItemSetsField /// Can be regular expression strings or arrays of strings of exact terms. /// /// - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } } -public sealed partial class FrequentItemSetsFieldDescriptor : SerializableDescriptor> +public readonly partial struct FrequentItemSetsFieldDescriptor { - internal FrequentItemSetsFieldDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsFieldDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField instance) + { + Instance = instance; + } - public FrequentItemSetsFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsFieldDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField instance) => new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor descriptor) => descriptor.Instance; /// /// @@ -68,28 +152,22 @@ public FrequentItemSetsFieldDescriptor() : base() /// Can be regular expression strings or arrays of strings of exact terms. /// /// - public FrequentItemSetsFieldDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } - public FrequentItemSetsFieldDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FrequentItemSetsFieldDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public FrequentItemSetsFieldDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -98,44 +176,39 @@ public FrequentItemSetsFieldDescriptor Field(Expression /// - public FrequentItemSetsFieldDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField Build(System.Action> action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FrequentItemSetsFieldDescriptor : SerializableDescriptor +public readonly partial struct FrequentItemSetsFieldDescriptor { - internal FrequentItemSetsFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField Instance { get; init; } - public FrequentItemSetsFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsFieldDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequentItemSetsFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField instance) => new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor descriptor) => descriptor.Instance; /// /// @@ -143,28 +216,22 @@ public FrequentItemSetsFieldDescriptor() : base() /// Can be regular expression strings or arrays of strings of exact terms. /// /// - public FrequentItemSetsFieldDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } - public FrequentItemSetsFieldDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FrequentItemSetsFieldDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public FrequentItemSetsFieldDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -173,29 +240,17 @@ public FrequentItemSetsFieldDescriptor Field(Expression /// - public FrequentItemSetsFieldDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField Build(System.Action action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsFieldDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.FrequentItemSetsField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregate.g.cs index ddc34a2eb4e..a1a5dcfe8a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregate.g.cs @@ -17,20 +17,81 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeoBoundsAggregate : IAggregate +internal sealed partial class GeoBoundsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBounds = System.Text.Json.JsonEncodedText.Encode("bounds"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBounds = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBounds.TryReadProperty(ref reader, options, PropBounds, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bounds = propBounds.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBounds, value.Bounds, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregateConverter))] +public sealed partial class GeoBoundsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("bounds")] - public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } +#if NET7_0_OR_GREATER + public GeoBoundsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoBoundsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoBoundsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geo_bounds"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregation.g.cs index 1c51951de0e..703d4b29abd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoBoundsAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoBoundsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropWrapLongitude = System.Text.Json.JsonEncodedText.Encode("wrap_longitude"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue propWrapLongitude = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propWrapLongitude.TryReadProperty(ref reader, options, PropWrapLongitude, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value, + Script = propScript.Value, + WrapLongitude = propWrapLongitude.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropWrapLongitude, value.WrapLongitude, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationConverter))] public sealed partial class GeoBoundsAggregation { +#if NET7_0_OR_GREATER + public GeoBoundsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoBoundsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -43,9 +121,7 @@ public sealed partial class GeoBoundsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -53,47 +129,37 @@ public sealed partial class GeoBoundsAggregation /// Specifies whether the bounding box should be allowed to overlap the international date line. /// /// - [JsonInclude, JsonPropertyName("wrap_longitude")] public bool? WrapLongitude { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeoBoundsAggregation geoBoundsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeoBounds(geoBoundsAggregation); } -public sealed partial class GeoBoundsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeoBoundsAggregationDescriptor { - internal GeoBoundsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation Instance { get; init; } - public GeoBoundsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? WrapLongitudeValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public GeoBoundsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public GeoBoundsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -101,10 +167,10 @@ public GeoBoundsAggregationDescriptor Field(Expression /// - public GeoBoundsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -113,34 +179,28 @@ public GeoBoundsAggregationDescriptor Field(Expression /// - public GeoBoundsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public GeoBoundsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -148,88 +208,54 @@ public GeoBoundsAggregationDescriptor Script(Action /// - public GeoBoundsAggregationDescriptor WrapLongitude(bool? wrapLongitude = true) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor WrapLongitude(bool? value = true) { - WrapLongitudeValue = wrapLongitude; - return Self; + Instance.WrapLongitude = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (WrapLongitudeValue.HasValue) - { - writer.WritePropertyName("wrap_longitude"); - writer.WriteBooleanValue(WrapLongitudeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoBoundsAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeoBoundsAggregationDescriptor { - internal GeoBoundsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation Instance { get; init; } - public GeoBoundsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? WrapLongitudeValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public GeoBoundsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public GeoBoundsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -237,10 +263,10 @@ public GeoBoundsAggregationDescriptor Field(Expression /// - public GeoBoundsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -249,34 +275,28 @@ public GeoBoundsAggregationDescriptor Field(Expression /// - public GeoBoundsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public GeoBoundsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public GeoBoundsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -284,49 +304,22 @@ public GeoBoundsAggregationDescriptor Script(Action /// - public GeoBoundsAggregationDescriptor WrapLongitude(bool? wrapLongitude = true) + public Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor WrapLongitude(bool? value = true) { - WrapLongitudeValue = wrapLongitude; - return Self; + Instance.WrapLongitude = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (WrapLongitudeValue.HasValue) - { - writer.WritePropertyName("wrap_longitude"); - writer.WriteBooleanValue(WrapLongitudeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoBoundsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregate.g.cs index 4be076472e7..b5117963b3f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregate.g.cs @@ -17,22 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeoCentroidAggregate : IAggregate +internal sealed partial class GeoCentroidAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("location")] - public Elastic.Clients.Elasticsearch.GeoLocation? Location { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propLocation = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Location = propLocation.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregateConverter))] +public sealed partial class GeoCentroidAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoCentroidAggregate(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public GeoCentroidAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoCentroidAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoCentroidAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public Elastic.Clients.Elasticsearch.GeoLocation? Location { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geo_centroid"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregation.g.cs index 4f7ccf8b05b..d42e4e4e785 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoCentroidAggregation.g.cs @@ -17,19 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoCentroidAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propField = default; + LocalJsonValue propLocation = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Field = propField.Value, + Location = propLocation.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationConverter))] public sealed partial class GeoCentroidAggregation { - [JsonInclude, JsonPropertyName("count")] +#if NET7_0_OR_GREATER + public GeoCentroidAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoCentroidAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public long? Count { get; set; } /// @@ -37,9 +124,7 @@ public sealed partial class GeoCentroidAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("location")] public Elastic.Clients.Elasticsearch.GeoLocation? Location { get; set; } /// @@ -48,34 +133,33 @@ public sealed partial class GeoCentroidAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeoCentroidAggregation geoCentroidAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeoCentroid(geoCentroidAggregation); } -public sealed partial class GeoCentroidAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeoCentroidAggregationDescriptor { - internal GeoCentroidAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation Instance { get; init; } - public GeoCentroidAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoCentroidAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation instance) { + Instance = instance; } - private long? CountValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? LocationValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoCentroidAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor descriptor) => descriptor.Instance; - public GeoCentroidAggregationDescriptor Count(long? count) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Count(long? value) { - CountValue = count; - return Self; + Instance.Count = value; + return this; } /// @@ -83,10 +167,10 @@ public GeoCentroidAggregationDescriptor Count(long? count) /// The field on which to run the aggregation. /// /// - public GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -94,27 +178,22 @@ public GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elastic /// The field on which to run the aggregation. /// /// - public GeoCentroidAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - /// - /// - /// The field on which to run the aggregation. - /// - /// - public GeoCentroidAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation? value) { - FieldValue = field; - return Self; + Instance.Location = value; + return this; } - public GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation? location) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Location(System.Func action) { - LocationValue = location; - return Self; + Instance.Location = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -123,103 +202,67 @@ public GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elas /// By default, documents without a value are ignored. /// /// - public GeoCentroidAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public GeoCentroidAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (CountValue.HasValue) + if (action is null) { - writer.WritePropertyName("count"); - writer.WriteNumberValue(CountValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (LocationValue is not null) - { - writer.WritePropertyName("location"); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoCentroidAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeoCentroidAggregationDescriptor { - internal GeoCentroidAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoCentroidAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation instance) + { + Instance = instance; + } - public GeoCentroidAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoCentroidAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private long? CountValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? LocationValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor descriptor) => descriptor.Instance; - public GeoCentroidAggregationDescriptor Count(long? count) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Count(long? value) { - CountValue = count; - return Self; + Instance.Count = value; + return this; } /// @@ -227,10 +270,10 @@ public GeoCentroidAggregationDescriptor Count(long? count) /// The field on which to run the aggregation. /// /// - public GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -238,27 +281,22 @@ public GeoCentroidAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// The field on which to run the aggregation. /// /// - public GeoCentroidAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - /// - /// - /// The field on which to run the aggregation. - /// - /// - public GeoCentroidAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation? value) { - FieldValue = field; - return Self; + Instance.Location = value; + return this; } - public GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation? location) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Location(System.Func action) { - LocationValue = location; - return Self; + Instance.Location = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -267,79 +305,40 @@ public GeoCentroidAggregationDescriptor Location(Elastic.Clients.Elasticsearch.G /// By default, documents without a value are ignored. /// /// - public GeoCentroidAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public GeoCentroidAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public GeoCentroidAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (CountValue.HasValue) - { - writer.WritePropertyName("count"); - writer.WriteNumberValue(CountValue.Value); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (LocationValue is not null) - { - writer.WritePropertyName("location"); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoCentroidAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs index b3d316f4f5e..ba18d35f129 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregate.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoDistanceAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of a geo_distance aggregation. The unit for from and to is meters by default. /// /// -public sealed partial class GeoDistanceAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregateConverter))] +public sealed partial class GeoDistanceAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public GeoDistanceAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoDistanceAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDistanceAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geo_distance"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs index 42cb774003a..165a495ee95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoDistanceAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoDistanceAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDistanceType = System.Text.Json.JsonEncodedText.Encode("distance_type"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropOrigin = System.Text.Json.JsonEncodedText.Encode("origin"); + private static readonly System.Text.Json.JsonEncodedText PropRanges = System.Text.Json.JsonEncodedText.Encode("ranges"); + private static readonly System.Text.Json.JsonEncodedText PropUnit = System.Text.Json.JsonEncodedText.Encode("unit"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDistanceType = default; + LocalJsonValue propField = default; + LocalJsonValue propOrigin = default; + LocalJsonValue?> propRanges = default; + LocalJsonValue propUnit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDistanceType.TryReadProperty(ref reader, options, PropDistanceType, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propOrigin.TryReadProperty(ref reader, options, PropOrigin, null)) + { + continue; + } + + if (propRanges.TryReadProperty(ref reader, options, PropRanges, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propUnit.TryReadProperty(ref reader, options, PropUnit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DistanceType = propDistanceType.Value, + Field = propField.Value, + Origin = propOrigin.Value, + Ranges = propRanges.Value, + Unit = propUnit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDistanceType, value.DistanceType, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropOrigin, value.Origin, null, null); + writer.WriteProperty(options, PropRanges, value.Ranges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUnit, value.Unit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationConverter))] public sealed partial class GeoDistanceAggregation { +#if NET7_0_OR_GREATER + public GeoDistanceAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoDistanceAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The distance calculation type. /// /// - [JsonInclude, JsonPropertyName("distance_type")] public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class GeoDistanceAggregation /// A field of type geo_point used to evaluate the distance. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -50,7 +136,6 @@ public sealed partial class GeoDistanceAggregation /// The origin used to evaluate the distance. /// /// - [JsonInclude, JsonPropertyName("origin")] public Elastic.Clients.Elasticsearch.GeoLocation? Origin { get; set; } /// @@ -58,46 +143,44 @@ public sealed partial class GeoDistanceAggregation /// An array of ranges used to bucket documents. /// /// - [JsonInclude, JsonPropertyName("ranges")] - public ICollection? Ranges { get; set; } + public System.Collections.Generic.ICollection? Ranges { get; set; } /// /// /// The distance unit. /// /// - [JsonInclude, JsonPropertyName("unit")] public Elastic.Clients.Elasticsearch.DistanceUnit? Unit { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeoDistanceAggregation geoDistanceAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeoDistance(geoDistanceAggregation); } -public sealed partial class GeoDistanceAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeoDistanceAggregationDescriptor { - internal GeoDistanceAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation instance) + { + Instance = instance; + } - public GeoDistanceAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? OriginValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The distance calculation type. /// /// - public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - DistanceTypeValue = distanceType; - return Self; + Instance.DistanceType = value; + return this; } /// @@ -105,10 +188,10 @@ public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients. /// A field of type geo_point used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -116,21 +199,21 @@ public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elastic /// A field of type geo_point used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// A field of type geo_point used to evaluate the distance. + /// The origin used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? value) { - FieldValue = field; - return Self; + Instance.Origin = value; + return this; } /// @@ -138,10 +221,10 @@ public GeoDistanceAggregationDescriptor Field(Expression /// - public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? origin) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Origin(System.Func action) { - OriginValue = origin; - return Self; + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -149,40 +232,38 @@ public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasti /// An array of ranges used to bucket documents. /// /// - public GeoDistanceAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public GeoDistanceAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor descriptor) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.AggregationRange[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public GeoDistanceAggregationDescriptor Ranges(Action configure) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor.Build(action)); + } - public GeoDistanceAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } /// @@ -190,100 +271,54 @@ public GeoDistanceAggregationDescriptor Ranges(params Action /// - public GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? value) { - UnitValue = unit; - return Self; + Instance.Unit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (DistanceTypeValue is not null) + if (action is null) { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (OriginValue is not null) - { - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - } - - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); - } - - if (UnitValue is not null) - { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoDistanceAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeoDistanceAggregationDescriptor { - internal GeoDistanceAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation instance) + { + Instance = instance; + } - public GeoDistanceAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? OriginValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The distance calculation type. /// /// - public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - DistanceTypeValue = distanceType; - return Self; + Instance.DistanceType = value; + return this; } /// @@ -291,10 +326,10 @@ public GeoDistanceAggregationDescriptor DistanceType(Elastic.Clients.Elasticsear /// A field of type geo_point used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -302,21 +337,21 @@ public GeoDistanceAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// A field of type geo_point used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// A field of type geo_point used to evaluate the distance. + /// The origin used to evaluate the distance. /// /// - public GeoDistanceAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? value) { - FieldValue = field; - return Self; + Instance.Origin = value; + return this; } /// @@ -324,10 +359,10 @@ public GeoDistanceAggregationDescriptor Field(Expression /// - public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? origin) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Origin(System.Func action) { - OriginValue = origin; - return Self; + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -335,40 +370,38 @@ public GeoDistanceAggregationDescriptor Origin(Elastic.Clients.Elasticsearch.Geo /// An array of ranges used to bucket documents. /// /// - public GeoDistanceAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public GeoDistanceAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor descriptor) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.AggregationRange[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public GeoDistanceAggregationDescriptor Ranges(Action configure) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor.Build(action)); + } - public GeoDistanceAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } /// @@ -376,70 +409,22 @@ public GeoDistanceAggregationDescriptor Ranges(params Action /// - public GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + public Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? value) { - UnitValue = unit; - return Self; + Instance.Unit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (DistanceTypeValue is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (OriginValue is not null) - { - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - } - - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); - } - - if (UnitValue is not null) - { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoDistanceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregate.g.cs index 5191273fae9..2b1db204234 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregate.g.cs @@ -17,24 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeoLineAggregate : IAggregate +internal sealed partial class GeoLineAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGeometry = System.Text.Json.JsonEncodedText.Encode("geometry"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGeometry = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGeometry.TryReadProperty(ref reader, options, PropGeometry, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Geometry = propGeometry.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGeometry, value.Geometry, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregateConverter))] +public sealed partial class GeoLineAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("geometry")] - public Elastic.Clients.Elasticsearch.GeoLine Geometry { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("properties")] - public object Properties { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregate(Elastic.Clients.Elasticsearch.GeoLine geometry, object properties, string type) + { + Geometry = geometry; + Properties = properties; + Type = type; + } +#if NET7_0_OR_GREATER + public GeoLineAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoLineAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoLineAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLine Geometry { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Properties { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geo_line"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs index 2c70354932b..b59c3273dcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineAggregation.g.cs @@ -17,24 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoLineAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIncludeSort = System.Text.Json.JsonEncodedText.Encode("include_sort"); + private static readonly System.Text.Json.JsonEncodedText PropPoint = System.Text.Json.JsonEncodedText.Encode("point"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSortOrder = System.Text.Json.JsonEncodedText.Encode("sort_order"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIncludeSort = default; + LocalJsonValue propPoint = default; + LocalJsonValue propSize = default; + LocalJsonValue propSort = default; + LocalJsonValue propSortOrder = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIncludeSort.TryReadProperty(ref reader, options, PropIncludeSort, null)) + { + continue; + } + + if (propPoint.TryReadProperty(ref reader, options, PropPoint, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propSortOrder.TryReadProperty(ref reader, options, PropSortOrder, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IncludeSort = propIncludeSort.Value, + Point = propPoint.Value, + Size = propSize.Value, + Sort = propSort.Value, + SortOrder = propSortOrder.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIncludeSort, value.IncludeSort, null, null); + writer.WriteProperty(options, PropPoint, value.Point, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropSortOrder, value.SortOrder, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationConverter))] public sealed partial class GeoLineAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint point, Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort sort) + { + Point = point; + Sort = sort; + } +#if NET7_0_OR_GREATER + public GeoLineAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoLineAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// When true, returns an additional array of the sort values in the feature properties. /// /// - [JsonInclude, JsonPropertyName("include_sort")] public bool? IncludeSort { get; set; } /// @@ -42,8 +136,11 @@ public sealed partial class GeoLineAggregation /// The name of the geo_point field. /// /// - [JsonInclude, JsonPropertyName("point")] - public Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Point { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Point { get; set; } /// /// @@ -51,7 +148,6 @@ public sealed partial class GeoLineAggregation /// Valid sizes are between 1 and 10000. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -60,45 +156,48 @@ public sealed partial class GeoLineAggregation /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - [JsonInclude, JsonPropertyName("sort")] - public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Sort { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Sort { get; set; } /// /// /// The order in which the line is sorted (ascending or descending). /// /// - [JsonInclude, JsonPropertyName("sort_order")] public Elastic.Clients.Elasticsearch.SortOrder? SortOrder { get; set; } } -public sealed partial class GeoLineAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeoLineAggregationDescriptor { - internal GeoLineAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Instance { get; init; } - public GeoLineAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation instance) { + Instance = instance; } - private bool? IncludeSortValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint PointValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor PointDescriptor { get; set; } - private Action> PointDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? SortOrderValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// When true, returns an additional array of the sort values in the feature properties. /// /// - public GeoLineAggregationDescriptor IncludeSort(bool? includeSort = true) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor IncludeSort(bool? value = true) { - IncludeSortValue = includeSort; - return Self; + Instance.IncludeSort = value; + return this; } /// @@ -106,28 +205,21 @@ public GeoLineAggregationDescriptor IncludeSort(bool? includeSort = t /// The name of the geo_point field. /// /// - public GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint point) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint value) { - PointDescriptor = null; - PointDescriptorAction = null; - PointValue = point; - return Self; + Instance.Point = value; + return this; } - public GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor descriptor) - { - PointValue = null; - PointDescriptorAction = null; - PointDescriptor = descriptor; - return Self; - } - - public GeoLineAggregationDescriptor Point(Action> configure) + /// + /// + /// The name of the geo_point field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Point(System.Action> action) { - PointValue = null; - PointDescriptor = null; - PointDescriptorAction = configure; - return Self; + Instance.Point = Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor.Build(action); + return this; } /// @@ -136,10 +228,10 @@ public GeoLineAggregationDescriptor Point(Action /// - public GeoLineAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -148,28 +240,22 @@ public GeoLineAggregationDescriptor Size(int? size) /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - public GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort sort) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor descriptor) - { - SortValue = null; - SortDescriptorAction = null; - SortDescriptor = descriptor; - return Self; - } - - public GeoLineAggregationDescriptor Sort(Action> configure) + /// + /// + /// The name of the numeric field to use as the sort key for ordering the points. + /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(System.Action> action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor.Build(action); + return this; } /// @@ -177,96 +263,49 @@ public GeoLineAggregationDescriptor Sort(Action /// - public GeoLineAggregationDescriptor SortOrder(Elastic.Clients.Elasticsearch.SortOrder? sortOrder) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor SortOrder(Elastic.Clients.Elasticsearch.SortOrder? value) { - SortOrderValue = sortOrder; - return Self; + Instance.SortOrder = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (IncludeSortValue.HasValue) - { - writer.WritePropertyName("include_sort"); - writer.WriteBooleanValue(IncludeSortValue.Value); - } - - if (PointDescriptor is not null) - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, PointDescriptor, options); - } - else if (PointDescriptorAction is not null) - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(PointDescriptorAction), options); - } - else - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, PointValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(SortDescriptorAction), options); - } - else - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (SortOrderValue is not null) - { - writer.WritePropertyName("sort_order"); - JsonSerializer.Serialize(writer, SortOrderValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoLineAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeoLineAggregationDescriptor { - internal GeoLineAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Instance { get; init; } - public GeoLineAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation instance) { + Instance = instance; } - private bool? IncludeSortValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint PointValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor PointDescriptor { get; set; } - private Action PointDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? SortOrderValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// When true, returns an additional array of the sort values in the feature properties. /// /// - public GeoLineAggregationDescriptor IncludeSort(bool? includeSort = true) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor IncludeSort(bool? value = true) { - IncludeSortValue = includeSort; - return Self; + Instance.IncludeSort = value; + return this; } /// @@ -274,28 +313,32 @@ public GeoLineAggregationDescriptor IncludeSort(bool? includeSort = true) /// The name of the geo_point field. /// /// - public GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint point) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint value) { - PointDescriptor = null; - PointDescriptorAction = null; - PointValue = point; - return Self; + Instance.Point = value; + return this; } - public GeoLineAggregationDescriptor Point(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor descriptor) + /// + /// + /// The name of the geo_point field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Point(System.Action action) { - PointValue = null; - PointDescriptorAction = null; - PointDescriptor = descriptor; - return Self; + Instance.Point = Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor.Build(action); + return this; } - public GeoLineAggregationDescriptor Point(Action configure) + /// + /// + /// The name of the geo_point field. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Point(System.Action> action) { - PointValue = null; - PointDescriptor = null; - PointDescriptorAction = configure; - return Self; + Instance.Point = Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor.Build(action); + return this; } /// @@ -304,10 +347,10 @@ public GeoLineAggregationDescriptor Point(Action /// - public GeoLineAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -316,28 +359,34 @@ public GeoLineAggregationDescriptor Size(int? size) /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. /// /// - public GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort sort) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public GeoLineAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor descriptor) + /// + /// + /// The name of the numeric field to use as the sort key for ordering the points. + /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(System.Action action) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor.Build(action); + return this; } - public GeoLineAggregationDescriptor Sort(Action configure) + /// + /// + /// The name of the numeric field to use as the sort key for ordering the points. + /// When the geo_line aggregation is nested inside a time_series aggregation, this field defaults to @timestamp, and any other value will result in error. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor Sort(System.Action> action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor.Build(action); + return this; } /// @@ -345,65 +394,17 @@ public GeoLineAggregationDescriptor Sort(Action /// - public GeoLineAggregationDescriptor SortOrder(Elastic.Clients.Elasticsearch.SortOrder? sortOrder) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor SortOrder(Elastic.Clients.Elasticsearch.SortOrder? value) { - SortOrderValue = sortOrder; - return Self; + Instance.SortOrder = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (IncludeSortValue.HasValue) - { - writer.WritePropertyName("include_sort"); - writer.WriteBooleanValue(IncludeSortValue.Value); - } - - if (PointDescriptor is not null) - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, PointDescriptor, options); - } - else if (PointDescriptorAction is not null) - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(PointDescriptorAction), options); - } - else - { - writer.WritePropertyName("point"); - JsonSerializer.Serialize(writer, PointValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(SortDescriptorAction), options); - } - else - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (SortOrderValue is not null) - { - writer.WritePropertyName("sort_order"); - JsonSerializer.Serialize(writer, SortOrderValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLineAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLinePoint.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLinePoint.g.cs index 3800c0f8963..474d13c6e0f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLinePoint.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLinePoint.g.cs @@ -17,57 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoLinePointConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointConverter))] public sealed partial class GeoLinePoint { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLinePoint(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public GeoLinePoint() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoLinePoint() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the geo_point field. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } } -public sealed partial class GeoLinePointDescriptor : SerializableDescriptor> +public readonly partial struct GeoLinePointDescriptor { - internal GeoLinePointDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Instance { get; init; } - public GeoLinePointDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLinePointDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The name of the geo_point field. - /// - /// - public GeoLinePointDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLinePointDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the geo_point field. /// /// - public GeoLinePointDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -75,51 +134,49 @@ public GeoLinePointDescriptor Field(Expression /// - public GeoLinePointDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoLinePointDescriptor : SerializableDescriptor +public readonly partial struct GeoLinePointDescriptor { - internal GeoLinePointDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Instance { get; init; } - public GeoLinePointDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLinePointDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The name of the geo_point field. - /// - /// - public GeoLinePointDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLinePointDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the geo_point field. /// /// - public GeoLinePointDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -127,17 +184,17 @@ public GeoLinePointDescriptor Field(Expression /// - public GeoLinePointDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePointDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLinePoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineSort.g.cs index 6cccb6934e7..f4d22eeb20a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeoLineSort.g.cs @@ -17,57 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeoLineSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortConverter))] public sealed partial class GeoLineSort { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineSort(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public GeoLineSort() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoLineSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the numeric field to use as the sort key for ordering the points. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } } -public sealed partial class GeoLineSortDescriptor : SerializableDescriptor> +public readonly partial struct GeoLineSortDescriptor { - internal GeoLineSortDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Instance { get; init; } - public GeoLineSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineSortDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The name of the numeric field to use as the sort key for ordering the points. - /// - /// - public GeoLineSortDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineSortDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the numeric field to use as the sort key for ordering the points. /// /// - public GeoLineSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -75,51 +134,49 @@ public GeoLineSortDescriptor Field(Expression /// - public GeoLineSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoLineSortDescriptor : SerializableDescriptor +public readonly partial struct GeoLineSortDescriptor { - internal GeoLineSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Instance { get; init; } - public GeoLineSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineSortDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The name of the numeric field to use as the sort key for ordering the points. - /// - /// - public GeoLineSortDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLineSortDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the numeric field to use as the sort key for ordering the points. /// /// - public GeoLineSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -127,17 +184,17 @@ public GeoLineSortDescriptor Field(Expression /// - public GeoLineSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSortDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeoLineSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs index 5b7c3c64f79..a9a4f266d65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeohashGridAggregate : IAggregate +internal sealed partial class GeohashGridAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregateConverter))] +public sealed partial class GeohashGridAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public GeohashGridAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeohashGridAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohashGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geohash_grid"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs index 964185a3020..61d2b52be47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeohashGridAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBounds = System.Text.Json.JsonEncodedText.Encode("bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBounds.TryReadProperty(ref reader, options, PropBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bounds = propBounds.Value, + Field = propField.Value, + Precision = propPrecision.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBounds, value.Bounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationConverter))] public sealed partial class GeohashGridAggregation { +#if NET7_0_OR_GREATER + public GeohashGridAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeohashGridAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The bounding box to filter the points in each bucket. /// /// - [JsonInclude, JsonPropertyName("bounds")] public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } /// @@ -43,7 +130,6 @@ public sealed partial class GeohashGridAggregation /// If the field contains an array, geohash_grid aggregates all array values. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -51,7 +137,6 @@ public sealed partial class GeohashGridAggregation /// The string length of the geohashes used to define cells/buckets in the results. /// /// - [JsonInclude, JsonPropertyName("precision")] public Elastic.Clients.Elasticsearch.GeohashPrecision? Precision { get; set; } /// @@ -60,7 +145,6 @@ public sealed partial class GeohashGridAggregation /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -68,47 +152,48 @@ public sealed partial class GeohashGridAggregation /// The maximum number of geohash buckets to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeohashGridAggregation geohashGridAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeohashGrid(geohashGridAggregation); } -public sealed partial class GeohashGridAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeohashGridAggregationDescriptor { - internal GeohashGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation instance) + { + Instance = instance; + } - public GeohashGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The bounding box to filter the points in each bucket. /// /// - public GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geohash_grid aggregates all array values. + /// The bounding box to filter the points in each bucket. /// /// - public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -117,10 +202,10 @@ public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elastic /// If the field contains an array, geohash_grid aggregates all array values. /// /// - public GeohashGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -129,10 +214,10 @@ public GeohashGridAggregationDescriptor Field(Expressiongeohash_grid aggregates all array values. /// /// - public GeohashGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -140,10 +225,21 @@ public GeohashGridAggregationDescriptor Field(Expression /// - public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; + } + + /// + /// + /// The string length of the geohashes used to define cells/buckets in the results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Precision(System.Func action) + { + Instance.Precision = Elastic.Clients.Elasticsearch.GeohashPrecisionFactory.Build(action); + return this; } /// @@ -152,10 +248,10 @@ public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Ela /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - public GeohashGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -163,84 +259,65 @@ public GeohashGridAggregationDescriptor ShardSize(int? shardSize) /// The maximum number of geohash buckets to return. /// /// - public GeohashGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) + if (action is null) { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeohashGridAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeohashGridAggregationDescriptor { - internal GeohashGridAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation instance) + { + Instance = instance; + } - public GeohashGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The bounding box to filter the points in each bucket. /// /// - public GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geohash_grid aggregates all array values. + /// The bounding box to filter the points in each bucket. /// /// - public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -249,10 +326,10 @@ public GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// If the field contains an array, geohash_grid aggregates all array values. /// /// - public GeohashGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -261,10 +338,21 @@ public GeohashGridAggregationDescriptor Field(Expressiongeohash_grid aggregates all array values. /// /// - public GeohashGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The string length of the geohashes used to define cells/buckets in the results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? value) { - FieldValue = field; - return Self; + Instance.Precision = value; + return this; } /// @@ -272,10 +360,10 @@ public GeohashGridAggregationDescriptor Field(Expression /// - public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Precision(System.Func action) { - PrecisionValue = precision; - return Self; + Instance.Precision = Elastic.Clients.Elasticsearch.GeohashPrecisionFactory.Build(action); + return this; } /// @@ -284,10 +372,10 @@ public GeohashGridAggregationDescriptor Precision(Elastic.Clients.Elasticsearch. /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - public GeohashGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -295,45 +383,22 @@ public GeohashGridAggregationDescriptor ShardSize(int? shardSize) /// The maximum number of geohash buckets to return. /// /// - public GeohashGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs index 8a8a6bc482c..a144a6f66ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohashGridBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class GeohashGridBucketConverter : JsonConverter +internal sealed partial class GeohashGridBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override GeohashGridBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohashGridBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new GeohashGridBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohashGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, GeohashGridBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohashGridBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'GeohashGridBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(GeohashGridBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohashGridBucketConverter))] public sealed partial class GeohashGridBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohashGridBucket(long docCount, string key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public GeohashGridBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeohashGridBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohashGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs index b70f968b98f..dfea035e296 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeohexGridAggregate : IAggregate +internal sealed partial class GeohexGridAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregateConverter))] +public sealed partial class GeohexGridAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public GeohexGridAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeohexGridAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohexGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geohex_grid"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs index 658aeeb8cdb..dc2e8ba8b11 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridAggregation.g.cs @@ -17,24 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeohexGridAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBounds = System.Text.Json.JsonEncodedText.Encode("bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBounds.TryReadProperty(ref reader, options, PropBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bounds = propBounds.Value, + Field = propField.Value, + Precision = propPrecision.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBounds, value.Bounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationConverter))] public sealed partial class GeohexGridAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregation(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public GeohexGridAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeohexGridAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Bounding box used to filter the geo-points in each bucket. /// /// - [JsonInclude, JsonPropertyName("bounds")] public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } /// @@ -43,8 +136,11 @@ public sealed partial class GeohexGridAggregation /// If the field contains an array, geohex_grid aggregates all array values. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -52,7 +148,6 @@ public sealed partial class GeohexGridAggregation /// in the results. Value should be between 0-15. /// /// - [JsonInclude, JsonPropertyName("precision")] public int? Precision { get; set; } /// @@ -60,7 +155,6 @@ public sealed partial class GeohexGridAggregation /// Number of buckets returned from each shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -68,47 +162,48 @@ public sealed partial class GeohexGridAggregation /// Maximum number of buckets to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeohexGridAggregation geohexGridAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeohexGrid(geohexGridAggregation); } -public sealed partial class GeohexGridAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeohexGridAggregationDescriptor { - internal GeohexGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation instance) + { + Instance = instance; + } - public GeohexGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Bounding box used to filter the geo-points in each bucket. /// /// - public GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geohex_grid aggregates all array values. + /// Bounding box used to filter the geo-points in each bucket. /// /// - public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -117,10 +212,10 @@ public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elastics /// If the field contains an array, geohex_grid aggregates all array values. /// /// - public GeohexGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -129,10 +224,10 @@ public GeohexGridAggregationDescriptor Field(Expressiongeohex_grid aggregates all array values. /// /// - public GeohexGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -141,10 +236,10 @@ public GeohexGridAggregationDescriptor Field(Expression /// - public GeohexGridAggregationDescriptor Precision(int? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Precision(int? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -152,10 +247,10 @@ public GeohexGridAggregationDescriptor Precision(int? precision) /// Number of buckets returned from each shard. /// /// - public GeohexGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -163,80 +258,60 @@ public GeohexGridAggregationDescriptor ShardSize(int? shardSize) /// Maximum number of buckets to return. /// /// - public GeohexGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeohexGridAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeohexGridAggregationDescriptor { - internal GeohexGridAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation Instance { get; init; } - public GeohexGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Bounding box used to filter the geo-points in each bucket. /// /// - public GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geohex_grid aggregates all array values. + /// Bounding box used to filter the geo-points in each bucket. /// /// - public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -245,10 +320,10 @@ public GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field /// If the field contains an array, geohex_grid aggregates all array values. /// /// - public GeohexGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -257,10 +332,10 @@ public GeohexGridAggregationDescriptor Field(Expressiongeohex_grid aggregates all array values. /// /// - public GeohexGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -269,10 +344,10 @@ public GeohexGridAggregationDescriptor Field(Expression /// - public GeohexGridAggregationDescriptor Precision(int? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Precision(int? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -280,10 +355,10 @@ public GeohexGridAggregationDescriptor Precision(int? precision) /// Number of buckets returned from each shard. /// /// - public GeohexGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -291,41 +366,17 @@ public GeohexGridAggregationDescriptor ShardSize(int? shardSize) /// Maximum number of buckets to return. /// /// - public GeohexGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs index 4863f027671..3e0f128d904 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeohexGridBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class GeohexGridBucketConverter : JsonConverter +internal sealed partial class GeohexGridBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override GeohexGridBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeohexGridBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new GeohexGridBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeohexGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, GeohexGridBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeohexGridBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'GeohexGridBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(GeohexGridBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeohexGridBucketConverter))] public sealed partial class GeohexGridBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeohexGridBucket(long docCount, string key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public GeohexGridBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeohexGridBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeohexGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs index ff2bbda7bd4..b7de1adee48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class GeotileGridAggregate : IAggregate +internal sealed partial class GeotileGridAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregateConverter))] +public sealed partial class GeotileGridAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public GeotileGridAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeotileGridAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeotileGridAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "geotile_grid"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs index 3c76309dae2..881857a6e3f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GeotileGridAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBounds = System.Text.Json.JsonEncodedText.Encode("bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBounds.TryReadProperty(ref reader, options, PropBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bounds = propBounds.Value, + Field = propField.Value, + Precision = propPrecision.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBounds, value.Bounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationConverter))] public sealed partial class GeotileGridAggregation { +#if NET7_0_OR_GREATER + public GeotileGridAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeotileGridAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A bounding box to filter the geo-points or geo-shapes in each bucket. /// /// - [JsonInclude, JsonPropertyName("bounds")] public Elastic.Clients.Elasticsearch.GeoBounds? Bounds { get; set; } /// @@ -43,7 +130,6 @@ public sealed partial class GeotileGridAggregation /// If the field contains an array, geotile_grid aggregates all array values. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -52,8 +138,7 @@ public sealed partial class GeotileGridAggregation /// Values outside of the range [0,29] will be rejected. /// /// - [JsonInclude, JsonPropertyName("precision")] - public double? Precision { get; set; } + public long? Precision { get; set; } /// /// @@ -61,7 +146,6 @@ public sealed partial class GeotileGridAggregation /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -69,48 +153,48 @@ public sealed partial class GeotileGridAggregation /// The maximum number of buckets to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(GeotileGridAggregation geotileGridAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.GeotileGrid(geotileGridAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(GeotileGridAggregation geotileGridAggregation) => Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy.GeotileGrid(geotileGridAggregation); } -public sealed partial class GeotileGridAggregationDescriptor : SerializableDescriptor> +public readonly partial struct GeotileGridAggregationDescriptor { - internal GeotileGridAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation Instance { get; init; } - public GeotileGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A bounding box to filter the geo-points or geo-shapes in each bucket. /// /// - public GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geotile_grid aggregates all array values. + /// A bounding box to filter the geo-points or geo-shapes in each bucket. /// /// - public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -119,10 +203,10 @@ public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elastic /// If the field contains an array, geotile_grid aggregates all array values. /// /// - public GeotileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -131,10 +215,10 @@ public GeotileGridAggregationDescriptor Field(Expressiongeotile_grid aggregates all array values. /// /// - public GeotileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -143,10 +227,10 @@ public GeotileGridAggregationDescriptor Field(Expression /// - public GeotileGridAggregationDescriptor Precision(double? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Precision(long? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -155,10 +239,10 @@ public GeotileGridAggregationDescriptor Precision(double? precision) /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - public GeotileGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -166,84 +250,65 @@ public GeotileGridAggregationDescriptor ShardSize(int? shardSize) /// The maximum number of buckets to return. /// /// - public GeotileGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) + if (action is null) { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeotileGridAggregationDescriptor : SerializableDescriptor +public readonly partial struct GeotileGridAggregationDescriptor { - internal GeotileGridAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation Instance { get; init; } - public GeotileGridAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.GeoBounds? BoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double? PrecisionValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A bounding box to filter the geo-points or geo-shapes in each bucket. /// /// - public GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? bounds) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Bounds(Elastic.Clients.Elasticsearch.GeoBounds? value) { - BoundsValue = bounds; - return Self; + Instance.Bounds = value; + return this; } /// /// - /// Field containing indexed geo_point or geo_shape values. - /// If the field contains an array, geotile_grid aggregates all array values. + /// A bounding box to filter the geo-points or geo-shapes in each bucket. /// /// - public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Bounds(System.Func action) { - FieldValue = field; - return Self; + Instance.Bounds = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } /// @@ -252,10 +317,10 @@ public GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// If the field contains an array, geotile_grid aggregates all array values. /// /// - public GeotileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -264,10 +329,10 @@ public GeotileGridAggregationDescriptor Field(Expressiongeotile_grid aggregates all array values. /// /// - public GeotileGridAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -276,10 +341,10 @@ public GeotileGridAggregationDescriptor Field(Expression /// - public GeotileGridAggregationDescriptor Precision(double? precision) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Precision(long? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// @@ -288,10 +353,10 @@ public GeotileGridAggregationDescriptor Precision(double? precision) /// Defaults to returning max(10,(size x number-of-shards)) buckets from each shard. /// /// - public GeotileGridAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -299,45 +364,22 @@ public GeotileGridAggregationDescriptor ShardSize(int? shardSize) /// The maximum number of buckets to return. /// /// - public GeotileGridAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BoundsValue is not null) - { - writer.WritePropertyName("bounds"); - JsonSerializer.Serialize(writer, BoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (ShardSizeValue.HasValue) + if (action is null) { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs index 8c03fbf568d..56fc98b6504 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GeotileGridBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class GeotileGridBucketConverter : JsonConverter +internal sealed partial class GeotileGridBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override GeotileGridBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GeotileGridBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new GeotileGridBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GeotileGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, GeotileGridBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GeotileGridBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'GeotileGridBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(GeotileGridBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridBucketConverter))] public sealed partial class GeotileGridBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeotileGridBucket(long docCount, string key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public GeotileGridBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeotileGridBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeotileGridBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregate.g.cs index 6ba1c78191d..f81e13094c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class GlobalAggregateConverter : JsonConverter +internal sealed partial class GlobalAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override GlobalAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new GlobalAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, GlobalAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'GlobalAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(GlobalAggregateConverter))] -public sealed partial class GlobalAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregateConverter))] +public sealed partial class GlobalAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public GlobalAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GlobalAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GlobalAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "global"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs index f509238c586..d344c6d50b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GlobalAggregation.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GlobalAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationConverter))] public sealed partial class GlobalAggregation { +#if NET7_0_OR_GREATER + public GlobalAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public GlobalAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GlobalAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } -public sealed partial class GlobalAggregationDescriptor : SerializableDescriptor +public readonly partial struct GlobalAggregationDescriptor { - internal GlobalAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation Instance { get; init; } - public GlobalAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalAggregationDescriptor() { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation(Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GlobalAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs index 725f20b364a..ea67b4e4ec0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/GoogleNormalizedDistanceHeuristic.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class GoogleNormalizedDistanceHeuristicConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackgroundIsSuperset = System.Text.Json.JsonEncodedText.Encode("background_is_superset"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackgroundIsSuperset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackgroundIsSuperset.TryReadProperty(ref reader, options, PropBackgroundIsSuperset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackgroundIsSuperset = propBackgroundIsSuperset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackgroundIsSuperset, value.BackgroundIsSuperset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicConverter))] public sealed partial class GoogleNormalizedDistanceHeuristic { +#if NET7_0_OR_GREATER + public GoogleNormalizedDistanceHeuristic() + { + } +#endif +#if !NET7_0_OR_GREATER + public GoogleNormalizedDistanceHeuristic() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - [JsonInclude, JsonPropertyName("background_is_superset")] public bool? BackgroundIsSuperset { get; set; } } -public sealed partial class GoogleNormalizedDistanceHeuristicDescriptor : SerializableDescriptor +public readonly partial struct GoogleNormalizedDistanceHeuristicDescriptor { - internal GoogleNormalizedDistanceHeuristicDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic Instance { get; init; } - public GoogleNormalizedDistanceHeuristicDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleNormalizedDistanceHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic instance) { + Instance = instance; } - private bool? BackgroundIsSupersetValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleNormalizedDistanceHeuristicDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic instance) => new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor descriptor) => descriptor.Instance; /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - public GoogleNormalizedDistanceHeuristicDescriptor BackgroundIsSuperset(bool? backgroundIsSuperset = true) + public Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor BackgroundIsSuperset(bool? value = true) { - BackgroundIsSupersetValue = backgroundIsSuperset; - return Self; + Instance.BackgroundIsSuperset = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic Build(System.Action? action) { - writer.WriteStartObject(); - if (BackgroundIsSupersetValue.HasValue) + if (action is null) { - writer.WritePropertyName("background_is_superset"); - writer.WriteBooleanValue(BackgroundIsSupersetValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrMethod.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrMethod.g.cs index b52e346f43e..7fff3e6df6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrMethod.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrMethod.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class HdrMethodConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumberOfSignificantValueDigits = System.Text.Json.JsonEncodedText.Encode("number_of_significant_value_digits"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HdrMethod Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumberOfSignificantValueDigits = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumberOfSignificantValueDigits.TryReadProperty(ref reader, options, PropNumberOfSignificantValueDigits, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HdrMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumberOfSignificantValueDigits = propNumberOfSignificantValueDigits.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HdrMethod value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumberOfSignificantValueDigits, value.NumberOfSignificantValueDigits, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodConverter))] public sealed partial class HdrMethod { +#if NET7_0_OR_GREATER + public HdrMethod() + { + } +#endif +#if !NET7_0_OR_GREATER + public HdrMethod() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HdrMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the resolution of values for the histogram in number of significant digits. /// /// - [JsonInclude, JsonPropertyName("number_of_significant_value_digits")] public int? NumberOfSignificantValueDigits { get; set; } } -public sealed partial class HdrMethodDescriptor : SerializableDescriptor +public readonly partial struct HdrMethodDescriptor { - internal HdrMethodDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.HdrMethod Instance { get; init; } - public HdrMethodDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HdrMethodDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod instance) { + Instance = instance; } - private int? NumberOfSignificantValueDigitsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HdrMethodDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.HdrMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod instance) => new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.HdrMethod(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the resolution of values for the histogram in number of significant digits. /// /// - public HdrMethodDescriptor NumberOfSignificantValueDigits(int? numberOfSignificantValueDigits) + public Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor NumberOfSignificantValueDigits(int? value) { - NumberOfSignificantValueDigitsValue = numberOfSignificantValueDigits; - return Self; + Instance.NumberOfSignificantValueDigits = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.HdrMethod Build(System.Action? action) { - writer.WriteStartObject(); - if (NumberOfSignificantValueDigitsValue.HasValue) + if (action is null) { - writer.WritePropertyName("number_of_significant_value_digits"); - writer.WriteNumberValue(NumberOfSignificantValueDigitsValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.HdrMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.HdrMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentileRanksAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentileRanksAggregate.g.cs index dcf051f90b2..bcfb52316ce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentileRanksAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentileRanksAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class HdrPercentileRanksAggregate : IAggregate +internal sealed partial class HdrPercentileRanksAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("values")] - public Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HdrPercentileRanksAggregateConverter))] +public sealed partial class HdrPercentileRanksAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HdrPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Aggregations.Percentiles values) + { + Values = values; + } +#if NET7_0_OR_GREATER + public HdrPercentileRanksAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HdrPercentileRanksAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HdrPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "hdr_percentile_ranks"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentilesAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentilesAggregate.g.cs index f82bc12e77d..4b45107edc3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentilesAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HdrPercentilesAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class HdrPercentilesAggregate : IAggregate +internal sealed partial class HdrPercentilesAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("values")] - public Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HdrPercentilesAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HdrPercentilesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HdrPercentilesAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HdrPercentilesAggregateConverter))] +public sealed partial class HdrPercentilesAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HdrPercentilesAggregate(Elastic.Clients.Elasticsearch.Aggregations.Percentiles values) + { + Values = values; + } +#if NET7_0_OR_GREATER + public HdrPercentilesAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HdrPercentilesAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HdrPercentilesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "hdr_percentiles"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregate.g.cs index e96f1a21eda..6ee06a878bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class HistogramAggregate : IAggregate +internal sealed partial class HistogramAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregateConverter))] +public sealed partial class HistogramAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public HistogramAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HistogramAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "histogram"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs index cd3c90e0d08..c59456e93fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramAggregation.g.cs @@ -17,34 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class HistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExtendedBounds = System.Text.Json.JsonEncodedText.Encode("extended_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropHardBounds = System.Text.Json.JsonEncodedText.Encode("hard_bounds"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propExtendedBounds = default; + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue?> propHardBounds = default; + LocalJsonValue propInterval = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propMissing = default; + LocalJsonValue propOffset = default; + LocalJsonValue>?> propOrder = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExtendedBounds.TryReadProperty(ref reader, options, PropExtendedBounds, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propHardBounds.TryReadProperty(ref reader, options, PropHardBounds, null)) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExtendedBounds = propExtendedBounds.Value, + Field = propField.Value, + Format = propFormat.Value, + HardBounds = propHardBounds.Value, + Interval = propInterval.Value, + MinDocCount = propMinDocCount.Value, + Missing = propMissing.Value, + Offset = propOffset.Value, + Order = propOrder.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExtendedBounds, value.ExtendedBounds, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropHardBounds, value.HardBounds, null, null); + writer.WriteProperty(options, PropInterval, value.Interval, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationConverter))] public sealed partial class HistogramAggregation { +#if NET7_0_OR_GREATER + public HistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public HistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Enables extending the bounds of the histogram beyond the data itself. /// /// - [JsonInclude, JsonPropertyName("extended_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? ExtendedBounds { get; set; } /// /// /// The name of the field to aggregate on. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -53,8 +183,7 @@ public sealed partial class HistogramAggregation /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. /// /// - [JsonInclude, JsonPropertyName("hard_bounds")] - public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBounds { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? HardBounds { get; set; } /// /// @@ -62,7 +191,6 @@ public sealed partial class HistogramAggregation /// Must be a positive decimal. /// /// - [JsonInclude, JsonPropertyName("interval")] public double? Interval { get; set; } /// @@ -71,7 +199,6 @@ public sealed partial class HistogramAggregation /// By default, the response will fill gaps in the histogram with empty buckets. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } /// @@ -80,7 +207,6 @@ public sealed partial class HistogramAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] public double? Missing { get; set; } /// @@ -89,7 +215,6 @@ public sealed partial class HistogramAggregation /// The bucket boundaries can be shifted by using the offset option. /// /// - [JsonInclude, JsonPropertyName("offset")] public double? Offset { get; set; } /// @@ -98,79 +223,60 @@ public sealed partial class HistogramAggregation /// By default, the returned buckets are sorted by their key ascending. /// /// - [JsonInclude, JsonPropertyName("order")] - [SingleOrManyCollectionConverter(typeof(KeyValuePair))] - public ICollection>? Order { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.ICollection>? Order { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(HistogramAggregation histogramAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Histogram(histogramAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(HistogramAggregation histogramAggregation) => Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy.Histogram(histogramAggregation); } -public sealed partial class HistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct HistogramAggregationDescriptor { - internal HistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation instance) + { + Instance = instance; + } - public HistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } - private Action ExtendedBoundsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } - private Action HardBoundsDescriptorAction { get; set; } - private double? IntervalValue { get; set; } - private int? MinDocCountValue { get; set; } - private double? MissingValue { get; set; } - private double? OffsetValue { get; set; } - private ICollection>? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? extendedBounds) - { - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsValue = extendedBounds; - return Self; - } - - public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsDescriptor = descriptor; - return Self; + Instance.ExtendedBounds = value; + return this; } - public HistogramAggregationDescriptor ExtendedBounds(Action configure) + /// + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds() { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = configure; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(null); + return this; } /// /// - /// The name of the field to aggregate on. + /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public HistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds(System.Action? action) { - FieldValue = field; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(action); + return this; } /// @@ -178,10 +284,10 @@ public HistogramAggregationDescriptor Field(Elastic.Clients.Elasticse /// The name of the field to aggregate on. /// /// - public HistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -189,16 +295,16 @@ public HistogramAggregationDescriptor Field(Expression /// - public HistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public HistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -207,28 +313,34 @@ public HistogramAggregationDescriptor Format(string? format) /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. /// /// - public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? hardBounds) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = null; - HardBoundsValue = hardBounds; - return Self; + Instance.HardBounds = value; + return this; } - public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + /// + /// + /// Limits the range of buckets in the histogram. + /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds() { - HardBoundsValue = null; - HardBoundsDescriptorAction = null; - HardBoundsDescriptor = descriptor; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(null); + return this; } - public HistogramAggregationDescriptor HardBounds(Action configure) + /// + /// + /// Limits the range of buckets in the histogram. + /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds(System.Action? action) { - HardBoundsValue = null; - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = configure; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(action); + return this; } /// @@ -237,10 +349,10 @@ public HistogramAggregationDescriptor HardBounds(Action /// - public HistogramAggregationDescriptor Interval(double? interval) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Interval(double? value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } /// @@ -249,10 +361,10 @@ public HistogramAggregationDescriptor Interval(double? interval) /// By default, the response will fill gaps in the histogram with empty buckets. /// /// - public HistogramAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -261,10 +373,10 @@ public HistogramAggregationDescriptor MinDocCount(int? minDocCount) /// By default, documents without a value are ignored. /// /// - public HistogramAggregationDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -273,10 +385,10 @@ public HistogramAggregationDescriptor Missing(double? missing) /// The bucket boundaries can be shifted by using the offset option. /// /// - public HistogramAggregationDescriptor Offset(double? offset) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Offset(double? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } /// @@ -285,196 +397,132 @@ public HistogramAggregationDescriptor Offset(double? offset) /// By default, the returned buckets are sorted by their key ascending. /// /// - public HistogramAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// The sort order of the returned buckets. + /// By default, the returned buckets are sorted by their key ascending. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } - public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The sort order of the returned buckets. + /// By default, the returned buckets are sorted by their key ascending. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order(System.Action>? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } - public HistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) { - writer.WriteStartObject(); - if (ExtendedBoundsDescriptor is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); - } - else if (ExtendedBoundsDescriptorAction is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); - } - else if (ExtendedBoundsValue is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HardBoundsDescriptor is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); - } - else if (HardBoundsDescriptorAction is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); - } - else if (HardBoundsValue is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsValue, options); - } - - if (IntervalValue.HasValue) - { - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue.Value); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (OffsetValue.HasValue) - { - writer.WritePropertyName("offset"); - writer.WriteNumberValue(OffsetValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class HistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct HistogramAggregationDescriptor { - internal HistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation instance) + { + Instance = instance; + } - public HistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? ExtendedBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor ExtendedBoundsDescriptor { get; set; } - private Action ExtendedBoundsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? HardBoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor HardBoundsDescriptor { get; set; } - private Action HardBoundsDescriptorAction { get; set; } - private double? IntervalValue { get; set; } - private int? MinDocCountValue { get; set; } - private double? MissingValue { get; set; } - private double? OffsetValue { get; set; } - private ICollection>? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? extendedBounds) - { - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsValue = extendedBounds; - return Self; - } - - public HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptorAction = null; - ExtendedBoundsDescriptor = descriptor; - return Self; + Instance.ExtendedBounds = value; + return this; } - public HistogramAggregationDescriptor ExtendedBounds(Action configure) + /// + /// + /// Enables extending the bounds of the histogram beyond the data itself. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds() { - ExtendedBoundsValue = null; - ExtendedBoundsDescriptor = null; - ExtendedBoundsDescriptorAction = configure; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(null); + return this; } /// /// - /// The name of the field to aggregate on. + /// Enables extending the bounds of the histogram beyond the data itself. /// /// - public HistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor ExtendedBounds(System.Action? action) { - FieldValue = field; - return Self; + Instance.ExtendedBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(action); + return this; } /// @@ -482,10 +530,10 @@ public HistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? /// The name of the field to aggregate on. /// /// - public HistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -493,16 +541,16 @@ public HistogramAggregationDescriptor Field(Expression /// - public HistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public HistogramAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -511,28 +559,34 @@ public HistogramAggregationDescriptor Format(string? format) /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. /// /// - public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloat? hardBounds) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBounds? value) { - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = null; - HardBoundsValue = hardBounds; - return Self; + Instance.HardBounds = value; + return this; } - public HistogramAggregationDescriptor HardBounds(Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor descriptor) + /// + /// + /// Limits the range of buckets in the histogram. + /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds() { - HardBoundsValue = null; - HardBoundsDescriptorAction = null; - HardBoundsDescriptor = descriptor; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(null); + return this; } - public HistogramAggregationDescriptor HardBounds(Action configure) + /// + /// + /// Limits the range of buckets in the histogram. + /// It is particularly useful in the case of open data ranges that can result in a very large number of buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor HardBounds(System.Action? action) { - HardBoundsValue = null; - HardBoundsDescriptor = null; - HardBoundsDescriptorAction = configure; - return Self; + Instance.HardBounds = Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsOfDoubleDescriptor.Build(action); + return this; } /// @@ -541,10 +595,10 @@ public HistogramAggregationDescriptor HardBounds(Action /// - public HistogramAggregationDescriptor Interval(double? interval) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Interval(double? value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } /// @@ -553,10 +607,10 @@ public HistogramAggregationDescriptor Interval(double? interval) /// By default, the response will fill gaps in the histogram with empty buckets. /// /// - public HistogramAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -565,10 +619,10 @@ public HistogramAggregationDescriptor MinDocCount(int? minDocCount) /// By default, documents without a value are ignored. /// /// - public HistogramAggregationDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -577,10 +631,10 @@ public HistogramAggregationDescriptor Missing(double? missing) /// The bucket boundaries can be shifted by using the offset option. /// /// - public HistogramAggregationDescriptor Offset(double? offset) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Offset(double? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } /// @@ -589,129 +643,90 @@ public HistogramAggregationDescriptor Offset(double? offset) /// By default, the returned buckets are sorted by their key ascending. /// /// - public HistogramAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// The sort order of the returned buckets. + /// By default, the returned buckets are sorted by their key ascending. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } - public HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The sort order of the returned buckets. + /// By default, the returned buckets are sorted by their key ascending. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order(System.Action? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } - public HistogramAggregationDescriptor Script(Action configure) + /// + /// + /// The sort order of the returned buckets. + /// By default, the returned buckets are sorted by their key ascending. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Order(System.Action>? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) { - writer.WriteStartObject(); - if (ExtendedBoundsDescriptor is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsDescriptor, options); - } - else if (ExtendedBoundsDescriptorAction is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(ExtendedBoundsDescriptorAction), options); - } - else if (ExtendedBoundsValue is not null) - { - writer.WritePropertyName("extended_bounds"); - JsonSerializer.Serialize(writer, ExtendedBoundsValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HardBoundsDescriptor is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsDescriptor, options); - } - else if (HardBoundsDescriptorAction is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ExtendedBoundsFloatDescriptor(HardBoundsDescriptorAction), options); - } - else if (HardBoundsValue is not null) - { - writer.WritePropertyName("hard_bounds"); - JsonSerializer.Serialize(writer, HardBoundsValue, options); - } - - if (IntervalValue.HasValue) - { - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue.Value); - } + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (OffsetValue.HasValue) - { - writer.WritePropertyName("offset"); - writer.WriteNumberValue(OffsetValue.Value); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramBucket.g.cs index e1641587177..99a84ea60e2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/HistogramBucket.g.cs @@ -17,79 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class HistogramBucketConverter : JsonConverter +internal sealed partial class HistogramBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override HistogramBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.HistogramBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - double key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new HistogramBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.HistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, HistogramBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.HistogramBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'HistogramBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(HistogramBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.HistogramBucketConverter))] public sealed partial class HistogramBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramBucket(long docCount, double key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public HistogramBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HistogramBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public double Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs index 19e7421f99a..fd97ac81cfb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregate.g.cs @@ -17,90 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class InferenceAggregateConverter : JsonConverter +internal sealed partial class InferenceAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override InferenceAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropFeatureImportance = System.Text.Json.JsonEncodedText.Encode("feature_importance"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropTopClasses = System.Text.Json.JsonEncodedText.Encode("top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropWarning = System.Text.Json.JsonEncodedText.Encode("warning"); + + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyCollection? featureImportance = default; - IReadOnlyDictionary? meta = default; - IReadOnlyCollection? topClasses = default; - Elastic.Clients.Elasticsearch.FieldValue? value = default; - string? warning = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propData = default; + LocalJsonValue?> propFeatureImportance = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue?> propTopClasses = default; + LocalJsonValue propValue = default; + LocalJsonValue propWarning = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propFeatureImportance.TryReadProperty(ref reader, options, PropFeatureImportance, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTopClasses.TryReadProperty(ref reader, options, PropTopClasses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) { - var property = reader.GetString(); - if (property == "feature_importance") - { - featureImportance = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "top_classes") - { - topClasses = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "value") - { - value = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "warning") - { - warning = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + if (propWarning.TryReadProperty(ref reader, options, PropWarning, null)) + { + continue; + } + + propData ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propData[key] = value; } - return new InferenceAggregate { Data = additionalProperties, FeatureImportance = featureImportance, Meta = meta, TopClasses = topClasses, Value = value, Warning = warning }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData, + FeatureImportance = propFeatureImportance.Value, + Meta = propMeta.Value, + TopClasses = propTopClasses.Value, + Value = propValue.Value, + Warning = propWarning.Value + }; } - public override void Write(Utf8JsonWriter writer, InferenceAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'InferenceAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureImportance, value.FeatureImportance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTopClasses, value.TopClasses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropWarning, value.Warning, null, null); + if (value.Data is not null) + { + foreach (var item in value.Data) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(InferenceAggregateConverter))] -public sealed partial class InferenceAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregateConverter))] +public sealed partial class InferenceAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { +#if NET7_0_OR_GREATER + public InferenceAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Additional data /// /// - public IReadOnlyDictionary Data { get; init; } - public IReadOnlyCollection? FeatureImportance { get; init; } - public IReadOnlyDictionary? Meta { get; init; } - public IReadOnlyCollection? TopClasses { get; init; } - public Elastic.Clients.Elasticsearch.FieldValue? Value { get; init; } - public string? Warning { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Data { get; set; } + public System.Collections.Generic.IReadOnlyCollection? FeatureImportance { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public System.Collections.Generic.IReadOnlyCollection? TopClasses { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "inference"; + + public Elastic.Clients.Elasticsearch.FieldValue? Value { get; set; } + public string? Warning { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs index f1c1f7af2de..0c3b9ec1430 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceAggregation.g.cs @@ -17,25 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class InferenceAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propInferenceConfig = default; + LocalJsonValue propModelId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + InferenceConfig = propInferenceConfig.Value, + ModelId = propModelId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationConverter))] public sealed partial class InferenceAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceAggregation(Elastic.Clients.Elasticsearch.Name modelId) + { + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public InferenceAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +136,6 @@ public sealed partial class InferenceAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +143,6 @@ public sealed partial class InferenceAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,7 +150,6 @@ public sealed partial class InferenceAggregation /// Contains the inference type and its options. /// /// - [JsonInclude, JsonPropertyName("inference_config")] public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? InferenceConfig { get; set; } /// @@ -67,37 +157,41 @@ public sealed partial class InferenceAggregation /// The ID or alias for the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public Elastic.Clients.Elasticsearch.Name ModelId { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(InferenceAggregation inferenceAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Inference(inferenceAggregation); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name ModelId { get; set; } } -public sealed partial class InferenceAggregationDescriptor : SerializableDescriptor> +public readonly partial struct InferenceAggregationDescriptor { - internal InferenceAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation Instance { get; init; } - public InferenceAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor InferenceConfigDescriptor { get; set; } - private Action> InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Name ModelIdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public InferenceAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -106,10 +200,10 @@ public InferenceAggregationDescriptor BucketsPath(Elastic.Clients.Ela /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public InferenceAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -117,10 +211,10 @@ public InferenceAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -128,28 +222,21 @@ public InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elast /// Contains the inference type and its options. /// /// - public InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? inferenceConfig) - { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; - } - - public InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? value) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.InferenceConfig = value; + return this; } - public InferenceAggregationDescriptor InferenceConfig(Action> configure) + /// + /// + /// Contains the inference type and its options. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor.Build(action); + return this; } /// @@ -157,80 +244,49 @@ public InferenceAggregationDescriptor InferenceConfig(Action /// - public InferenceAggregationDescriptor ModelId(Elastic.Clients.Elasticsearch.Name modelId) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor ModelId(Elastic.Clients.Elasticsearch.Name value) { - ModelIdValue = modelId; - return Self; + Instance.ModelId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } - - writer.WritePropertyName("model_id"); - JsonSerializer.Serialize(writer, ModelIdValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceAggregationDescriptor : SerializableDescriptor +public readonly partial struct InferenceAggregationDescriptor { - internal InferenceAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation instance) + { + Instance = instance; + } - public InferenceAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Name ModelIdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public InferenceAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -239,10 +295,10 @@ public InferenceAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch. /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public InferenceAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -250,10 +306,10 @@ public InferenceAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -261,28 +317,32 @@ public InferenceAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Ag /// Contains the inference type and its options. /// /// - public InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? inferenceConfig) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.InferenceConfig = value; + return this; } - public InferenceAggregationDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor descriptor) + /// + /// + /// Contains the inference type and its options. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor InferenceConfig(System.Action action) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor.Build(action); + return this; } - public InferenceAggregationDescriptor InferenceConfig(Action configure) + /// + /// + /// Contains the inference type and its options. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor InferenceConfig(System.Action> action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor.Build(action); + return this; } /// @@ -290,51 +350,17 @@ public InferenceAggregationDescriptor InferenceConfig(Action /// - public InferenceAggregationDescriptor ModelId(Elastic.Clients.Elasticsearch.Name modelId) + public Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor ModelId(Elastic.Clients.Elasticsearch.Name value) { - ModelIdValue = modelId; - return Self; + Instance.ModelId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } - - writer.WritePropertyName("model_id"); - JsonSerializer.Serialize(writer, ModelIdValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.InferenceAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceClassImportance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceClassImportance.g.cs index 9c4a5079fb7..36ac476f7b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceClassImportance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceClassImportance.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class InferenceClassImportanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceClassImportance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceClassImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceClassImportance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceClassImportanceConverter))] public sealed partial class InferenceClassImportance { - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } - [JsonInclude, JsonPropertyName("importance")] - public double Importance { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceClassImportance(string className, double importance) + { + ClassName = className; + Importance = importance; + } +#if NET7_0_OR_GREATER + public InferenceClassImportance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceClassImportance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceClassImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceConfig.g.cs index 431c4cac795..a17fae69236 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceConfig.g.cs @@ -17,226 +17,330 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -[JsonConverter(typeof(InferenceConfigConverter))] -public sealed partial class InferenceConfig +internal sealed partial class InferenceConfigConverter : System.Text.Json.Serialization.JsonConverter { - internal InferenceConfig(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); - public static InferenceConfig Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => new InferenceConfig("classification", classificationInferenceOptions); - public static InferenceConfig Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => new InferenceConfig("regression", regressionInferenceOptions); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class InferenceConfigConverter : JsonConverter -{ - public override InferenceConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'InferenceConfig' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new InferenceConfig(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, InferenceConfig value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig)}'."); } writer.WriteEndObject(); } } -public sealed partial class InferenceConfigDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigConverter))] +public sealed partial class InferenceConfig { - internal InferenceConfigDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public InferenceConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public InferenceConfigDescriptor() : base() + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions value) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions value) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig { Regression = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct InferenceConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig Instance { get; init; } - private InferenceConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private InferenceConfigDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigDescriptor Regression(Action> configure) => Set(configure, "regression"); + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig instance) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification() + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigDescriptor { - internal InferenceConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig Instance { get; init; } - public InferenceConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig instance) => new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor descriptor) => descriptor.Instance; - private InferenceConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = value; + return this; } - private InferenceConfigDescriptor Set(object variant, string variantName) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; } - public InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigDescriptor Regression(Action configure) => Set(configure, "regression"); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Regression = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression(System.Action? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfigDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceFeatureImportance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceFeatureImportance.g.cs index 98b53963ced..4da7a1ee62e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceFeatureImportance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceFeatureImportance.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class InferenceFeatureImportanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceFeatureImportance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClasses = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classes = propClasses.Value, + FeatureName = propFeatureName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceFeatureImportance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceFeatureImportanceConverter))] public sealed partial class InferenceFeatureImportance { - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection? Classes { get; init; } - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; init; } - [JsonInclude, JsonPropertyName("importance")] - public double? Importance { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceFeatureImportance(string featureName) + { + FeatureName = featureName; + } +#if NET7_0_OR_GREATER + public InferenceFeatureImportance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceFeatureImportance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Classes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public double? Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceTopClassEntry.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceTopClassEntry.g.cs index 1bf5a622b72..3cede6ead3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceTopClassEntry.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/InferenceTopClassEntry.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class InferenceTopClassEntryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropClassProbability = System.Text.Json.JsonEncodedText.Encode("class_probability"); + private static readonly System.Text.Json.JsonEncodedText PropClassScore = System.Text.Json.JsonEncodedText.Encode("class_score"); + + public override Elastic.Clients.Elasticsearch.Aggregations.InferenceTopClassEntry Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propClassProbability = default; + LocalJsonValue propClassScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propClassProbability.TryReadProperty(ref reader, options, PropClassProbability, null)) + { + continue; + } + + if (propClassScore.TryReadProperty(ref reader, options, PropClassScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.InferenceTopClassEntry(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + ClassProbability = propClassProbability.Value, + ClassScore = propClassScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.InferenceTopClassEntry value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropClassProbability, value.ClassProbability, null, null); + writer.WriteProperty(options, PropClassScore, value.ClassScore, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.InferenceTopClassEntryConverter))] public sealed partial class InferenceTopClassEntry { - [JsonInclude, JsonPropertyName("class_name")] - public Elastic.Clients.Elasticsearch.FieldValue ClassName { get; init; } - [JsonInclude, JsonPropertyName("class_probability")] - public double ClassProbability { get; init; } - [JsonInclude, JsonPropertyName("class_score")] - public double ClassScore { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceTopClassEntry(Elastic.Clients.Elasticsearch.FieldValue className, double classProbability, double classScore) + { + ClassName = className; + ClassProbability = classProbability; + ClassScore = classScore; + } +#if NET7_0_OR_GREATER + public InferenceTopClassEntry() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceTopClassEntry() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceTopClassEntry(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.FieldValue ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ClassProbability { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ClassScore { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs index ecd1258985b..1f60ce9ba56 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class IpPrefixAggregate : IAggregate +internal sealed partial class IpPrefixAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregateConverter))] +public sealed partial class IpPrefixAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public IpPrefixAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpPrefixAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpPrefixAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "ip_prefix"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs index 4ef58f528ef..cbda2f9e72b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixAggregation.g.cs @@ -17,24 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class IpPrefixAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAppendPrefixLength = System.Text.Json.JsonEncodedText.Encode("append_prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIsIpv6 = System.Text.Json.JsonEncodedText.Encode("is_ipv6"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAppendPrefixLength = default; + LocalJsonValue propField = default; + LocalJsonValue propIsIpv6 = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propPrefixLength = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAppendPrefixLength.TryReadProperty(ref reader, options, PropAppendPrefixLength, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIsIpv6.TryReadProperty(ref reader, options, PropIsIpv6, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AppendPrefixLength = propAppendPrefixLength.Value, + Field = propField.Value, + IsIpv6 = propIsIpv6.Value, + MinDocCount = propMinDocCount.Value, + PrefixLength = propPrefixLength.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAppendPrefixLength, value.AppendPrefixLength, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIsIpv6, value.IsIpv6, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationConverter))] public sealed partial class IpPrefixAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregation(Elastic.Clients.Elasticsearch.Field field, int prefixLength) + { + Field = field; + PrefixLength = prefixLength; + } +#if NET7_0_OR_GREATER + public IpPrefixAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpPrefixAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines whether the prefix length is appended to IP address keys in the response. /// /// - [JsonInclude, JsonPropertyName("append_prefix_length")] public bool? AppendPrefixLength { get; set; } /// @@ -42,15 +136,17 @@ public sealed partial class IpPrefixAggregation /// The IP address field to aggregation on. The field mapping type must be ip. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Defines whether the prefix applies to IPv6 addresses. /// /// - [JsonInclude, JsonPropertyName("is_ipv6")] public bool? IsIpv6 { get; set; } /// @@ -58,7 +154,6 @@ public sealed partial class IpPrefixAggregation /// Minimum number of documents in a bucket for it to be included in the response. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public long? MinDocCount { get; set; } /// @@ -67,46 +162,41 @@ public sealed partial class IpPrefixAggregation /// For IPv6 addresses the accepted range is [0, 128]. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] - public int PrefixLength { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(IpPrefixAggregation ipPrefixAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.IpPrefix(ipPrefixAggregation); + public +#if NET7_0_OR_GREATER + required +#endif + int PrefixLength { get; set; } } -public sealed partial class IpPrefixAggregationDescriptor : SerializableDescriptor> +public readonly partial struct IpPrefixAggregationDescriptor { - internal IpPrefixAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation Instance { get; init; } - public IpPrefixAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation instance) { + Instance = instance; } - private bool? AppendPrefixLengthValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IsIpv6Value { get; set; } - private long? MinDocCountValue { get; set; } - private int PrefixLengthValue { get; set; } - - /// - /// - /// Defines whether the prefix length is appended to IP address keys in the response. - /// - /// - public IpPrefixAggregationDescriptor AppendPrefixLength(bool? appendPrefixLength = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregationDescriptor() { - AppendPrefixLengthValue = appendPrefixLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The IP address field to aggregation on. The field mapping type must be ip. + /// Defines whether the prefix length is appended to IP address keys in the response. /// /// - public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor AppendPrefixLength(bool? value = true) { - FieldValue = field; - return Self; + Instance.AppendPrefixLength = value; + return this; } /// @@ -114,10 +204,10 @@ public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsea /// The IP address field to aggregation on. The field mapping type must be ip. /// /// - public IpPrefixAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -125,10 +215,10 @@ public IpPrefixAggregationDescriptor Field(Expressionip. /// /// - public IpPrefixAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -136,10 +226,10 @@ public IpPrefixAggregationDescriptor Field(Expression /// - public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor IsIpv6(bool? value = true) { - IsIpv6Value = isIpv6; - return Self; + Instance.IsIpv6 = value; + return this; } /// @@ -147,10 +237,10 @@ public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) /// Minimum number of documents in a bucket for it to be included in the response. /// /// - public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -159,75 +249,49 @@ public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) /// For IPv6 addresses the accepted range is [0, 128]. /// /// - public IpPrefixAggregationDescriptor PrefixLength(int prefixLength) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor PrefixLength(int value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation Build(System.Action> action) { - writer.WriteStartObject(); - if (AppendPrefixLengthValue.HasValue) - { - writer.WritePropertyName("append_prefix_length"); - writer.WriteBooleanValue(AppendPrefixLengthValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IsIpv6Value.HasValue) - { - writer.WritePropertyName("is_ipv6"); - writer.WriteBooleanValue(IsIpv6Value.Value); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IpPrefixAggregationDescriptor : SerializableDescriptor +public readonly partial struct IpPrefixAggregationDescriptor { - internal IpPrefixAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation Instance { get; init; } - public IpPrefixAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation instance) { + Instance = instance; } - private bool? AppendPrefixLengthValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IsIpv6Value { get; set; } - private long? MinDocCountValue { get; set; } - private int PrefixLengthValue { get; set; } - - /// - /// - /// Defines whether the prefix length is appended to IP address keys in the response. - /// - /// - public IpPrefixAggregationDescriptor AppendPrefixLength(bool? appendPrefixLength = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixAggregationDescriptor() { - AppendPrefixLengthValue = appendPrefixLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The IP address field to aggregation on. The field mapping type must be ip. + /// Defines whether the prefix length is appended to IP address keys in the response. /// /// - public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor AppendPrefixLength(bool? value = true) { - FieldValue = field; - return Self; + Instance.AppendPrefixLength = value; + return this; } /// @@ -235,10 +299,10 @@ public IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// The IP address field to aggregation on. The field mapping type must be ip. /// /// - public IpPrefixAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -246,10 +310,10 @@ public IpPrefixAggregationDescriptor Field(Expressionip. /// /// - public IpPrefixAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -257,10 +321,10 @@ public IpPrefixAggregationDescriptor Field(Expression /// - public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor IsIpv6(bool? value = true) { - IsIpv6Value = isIpv6; - return Self; + Instance.IsIpv6 = value; + return this; } /// @@ -268,10 +332,10 @@ public IpPrefixAggregationDescriptor IsIpv6(bool? isIpv6 = true) /// Minimum number of documents in a bucket for it to be included in the response. /// /// - public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -280,37 +344,17 @@ public IpPrefixAggregationDescriptor MinDocCount(long? minDocCount) /// For IPv6 addresses the accepted range is [0, 128]. /// /// - public IpPrefixAggregationDescriptor PrefixLength(int prefixLength) + public Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor PrefixLength(int value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation Build(System.Action action) { - writer.WriteStartObject(); - if (AppendPrefixLengthValue.HasValue) - { - writer.WritePropertyName("append_prefix_length"); - writer.WriteBooleanValue(AppendPrefixLengthValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IsIpv6Value.HasValue) - { - writer.WritePropertyName("is_ipv6"); - writer.WriteBooleanValue(IsIpv6Value.Value); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs index e03c5122173..b4a40bb59ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpPrefixBucket.g.cs @@ -17,95 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class IpPrefixBucketConverter : JsonConverter +internal sealed partial class IpPrefixBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override IpPrefixBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropIsIpv6 = System.Text.Json.JsonEncodedText.Encode("is_ipv6"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropNetmask = System.Text.Json.JsonEncodedText.Encode("netmask"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpPrefixBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - bool isIpv6 = default; - string key = default; - string? netmask = default; - int prefixLength = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propIsIpv6 = default; + LocalJsonValue propKey = default; + LocalJsonValue propNetmask = default; + LocalJsonValue propPrefixLength = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "is_ipv6") - { - isIpv6 = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "netmask") - { - netmask = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propIsIpv6.TryReadProperty(ref reader, options, PropIsIpv6, null)) + { + continue; + } - if (property == "prefix_length") - { - prefixLength = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propNetmask.TryReadProperty(ref reader, options, PropNetmask, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new IpPrefixBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, IsIpv6 = isIpv6, Key = key, Netmask = netmask, PrefixLength = prefixLength }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpPrefixBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + IsIpv6 = propIsIpv6.Value, + Key = propKey.Value, + Netmask = propNetmask.Value, + PrefixLength = propPrefixLength.Value + }; } - public override void Write(Utf8JsonWriter writer, IpPrefixBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpPrefixBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'IpPrefixBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropIsIpv6, value.IsIpv6, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropNetmask, value.Netmask, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(IpPrefixBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpPrefixBucketConverter))] public sealed partial class IpPrefixBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPrefixBucket(long docCount, bool isIpv6, string key, int prefixLength) + { + DocCount = docCount; + IsIpv6 = isIpv6; + Key = key; + PrefixLength = prefixLength; + } +#if NET7_0_OR_GREATER + public IpPrefixBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpPrefixBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpPrefixBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public bool IsIpv6 { get; init; } - public string Key { get; init; } - public string? Netmask { get; init; } - public int PrefixLength { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsIpv6 { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } + public string? Netmask { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int PrefixLength { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregate.g.cs index b29a4b1c35b..3f30e3ae8e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class IpRangeAggregate : IAggregate +internal sealed partial class IpRangeAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregateConverter))] +public sealed partial class IpRangeAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public IpRangeAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpRangeAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpRangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "ip_range"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs index c00cc402c45..bf36469b27b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregation.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class IpRangeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropRanges = System.Text.Json.JsonEncodedText.Encode("ranges"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propRanges = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propRanges.TryReadProperty(ref reader, options, PropRanges, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Ranges = propRanges.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropRanges, value.Ranges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationConverter))] public sealed partial class IpRangeAggregation { +#if NET7_0_OR_GREATER + public IpRangeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public IpRangeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The date field whose values are used to build ranges. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -42,35 +102,37 @@ public sealed partial class IpRangeAggregation /// Array of IP ranges. /// /// - [JsonInclude, JsonPropertyName("ranges")] - public ICollection? Ranges { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(IpRangeAggregation ipRangeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.IpRange(ipRangeAggregation); + public System.Collections.Generic.ICollection? Ranges { get; set; } } -public sealed partial class IpRangeAggregationDescriptor : SerializableDescriptor> +public readonly partial struct IpRangeAggregationDescriptor { - internal IpRangeAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation instance) + { + Instance = instance; + } - public IpRangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The date field whose values are used to build ranges. /// /// - public IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -78,21 +140,21 @@ public IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsear /// The date field whose values are used to build ranges. /// /// - public IpRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The date field whose values are used to build ranges. + /// Array of IP ranges. /// /// - public IpRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Ranges = value; + return this; } /// @@ -100,109 +162,71 @@ public IpRangeAggregationDescriptor Field(Expression /// - public IpRangeAggregationDescriptor Ranges(ICollection? ranges) - { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor descriptor) - { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(Action configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(params Action[] configure) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange[] values) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Array of IP ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(params System.Action?[] actions) { - writer.WriteStartObject(); - if (FieldValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + items.Add(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor.Build(action)); } - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(action), options); - } + Instance.Ranges = items; + return this; + } - writer.WriteEndArray(); - } - else if (RangesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IpRangeAggregationDescriptor : SerializableDescriptor +public readonly partial struct IpRangeAggregationDescriptor { - internal IpRangeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation instance) + { + Instance = instance; + } - public IpRangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The date field whose values are used to build ranges. /// /// - public IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -210,21 +234,21 @@ public IpRangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? f /// The date field whose values are used to build ranges. /// /// - public IpRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The date field whose values are used to build ranges. + /// Array of IP ranges. /// /// - public IpRangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Ranges = value; + return this; } /// @@ -232,82 +256,39 @@ public IpRangeAggregationDescriptor Field(Expression /// - public IpRangeAggregationDescriptor Ranges(ICollection? ranges) - { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor descriptor) - { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(Action configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } - - public IpRangeAggregationDescriptor Ranges(params Action[] configure) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange[] values) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Array of IP ranges. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor Ranges(params System.Action?[] actions) { - writer.WriteStartObject(); - if (FieldValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + items.Add(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor.Build(action)); } - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(action), options); - } + Instance.Ranges = items; + return this; + } - writer.WriteEndArray(); - } - else if (RangesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregationRange.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregationRange.g.cs index e54995c1ddc..cc7069d33dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregationRange.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeAggregationRange.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class IpRangeAggregationRangeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropMask = System.Text.Json.JsonEncodedText.Encode("mask"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propMask = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propMask.TryReadProperty(ref reader, options, PropMask, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Mask = propMask.Value, + To = propTo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropMask, value.Mask, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeConverter))] public sealed partial class IpRangeAggregationRange { +#if NET7_0_OR_GREATER + public IpRangeAggregationRange() + { + } +#endif +#if !NET7_0_OR_GREATER + public IpRangeAggregationRange() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Start of the range. /// /// - [JsonInclude, JsonPropertyName("from")] public string? From { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class IpRangeAggregationRange /// IP range defined as a CIDR mask. /// /// - [JsonInclude, JsonPropertyName("mask")] public string? Mask { get; set; } /// @@ -50,31 +118,37 @@ public sealed partial class IpRangeAggregationRange /// End of the range. /// /// - [JsonInclude, JsonPropertyName("to")] public string? To { get; set; } } -public sealed partial class IpRangeAggregationRangeDescriptor : SerializableDescriptor +public readonly partial struct IpRangeAggregationRangeDescriptor { - internal IpRangeAggregationRangeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationRangeDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange instance) + { + Instance = instance; + } - public IpRangeAggregationRangeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeAggregationRangeDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? FromValue { get; set; } - private string? MaskValue { get; set; } - private string? ToValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange instance) => new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor descriptor) => descriptor.Instance; /// /// /// Start of the range. /// /// - public IpRangeAggregationRangeDescriptor From(string? from) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor From(string? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -82,10 +156,10 @@ public IpRangeAggregationRangeDescriptor From(string? from) /// IP range defined as a CIDR mask. /// /// - public IpRangeAggregationRangeDescriptor Mask(string? mask) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor Mask(string? value) { - MaskValue = mask; - return Self; + Instance.Mask = value; + return this; } /// @@ -93,33 +167,22 @@ public IpRangeAggregationRangeDescriptor Mask(string? mask) /// End of the range. /// /// - public IpRangeAggregationRangeDescriptor To(string? to) + public Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor To(string? value) { - ToValue = to; - return Self; + Instance.To = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FromValue)) - { - writer.WritePropertyName("from"); - writer.WriteStringValue(FromValue); - } - - if (!string.IsNullOrEmpty(MaskValue)) + if (action is null) { - writer.WritePropertyName("mask"); - writer.WriteStringValue(MaskValue); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(ToValue)) - { - writer.WritePropertyName("to"); - writer.WriteStringValue(ToValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRangeDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.IpRangeAggregationRange(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeBucket.g.cs index ea2b231722d..448479ac7b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/IpRangeBucket.g.cs @@ -17,87 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class IpRangeBucketConverter : JsonConverter +internal sealed partial class IpRangeBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override IpRangeBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.Aggregations.IpRangeBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string? from = default; - string? key = default; - string? to = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propFrom = default; + LocalJsonValue propKey = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "from") - { - from = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "to") - { - to = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new IpRangeBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, From = from, Key = key, To = to }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.IpRangeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + From = propFrom.Value, + Key = propKey.Value, + To = propTo.Value + }; } - public override void Write(Utf8JsonWriter writer, IpRangeBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.IpRangeBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'IpRangeBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(IpRangeBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.IpRangeBucketConverter))] public sealed partial class IpRangeBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangeBucket(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public IpRangeBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpRangeBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpRangeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string? From { get; init; } - public string? Key { get; init; } - public string? To { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public string? From { get; set; } + public string? Key { get; set; } + public string? To { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsAggregate.g.cs index 13fa685df54..d91847dd642 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsAggregate.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class LongRareTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of the rare_terms aggregation when the field is some kind of whole number like a integer, long, or a date. /// /// -public sealed partial class LongRareTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsAggregateConverter))] +public sealed partial class LongRareTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRareTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public LongRareTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LongRareTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "lrareterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsBucket.g.cs index 11dc48330e5..0a7ae421481 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongRareTermsBucket.g.cs @@ -17,79 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class LongRareTermsBucketConverter : JsonConverter +internal sealed partial class LongRareTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override LongRareTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new LongRareTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, LongRareTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'LongRareTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(LongRareTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.LongRareTermsBucketConverter))] public sealed partial class LongRareTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRareTermsBucket(long docCount, long key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public LongRareTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LongRareTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongRareTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsAggregate.g.cs index 11c3ad82fae..313a9b91b87 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsAggregate.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class LongTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSumOtherDocCount = System.Text.Json.JsonEncodedText.Encode("sum_other_doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSumOtherDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSumOtherDocCount.TryReadProperty(ref reader, options, PropSumOtherDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Meta = propMeta.Value, + SumOtherDocCount = propSumOtherDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSumOtherDocCount, value.SumOtherDocCount, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Result of a terms aggregation when the field is some kind of whole number like a integer, long, or a date. /// /// -public sealed partial class LongTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.LongTermsAggregateConverter))] +public sealed partial class LongTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count_error_upper_bound")] - public long? DocCountErrorUpperBound { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("sum_other_doc_count")] - public long? SumOtherDocCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public LongTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LongTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public long? SumOtherDocCount { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "lterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsBucket.g.cs index e6e6265dbfa..8836b49b422 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/LongTermsBucket.g.cs @@ -17,87 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class LongTermsBucketConverter : JsonConverter +internal sealed partial class LongTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override LongTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.LongTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long? docCountErrorUpperBound = default; - long key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count_error_upper_bound") - { - docCountErrorUpperBound = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new LongTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, DocCountErrorUpperBound = docCountErrorUpperBound, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.LongTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, LongTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.LongTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'LongTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(LongTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.LongTermsBucketConverter))] public sealed partial class LongTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongTermsBucket(long docCount, long key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public LongTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LongTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long? DocCountErrorUpperBound { get; init; } - public long Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregate.g.cs index 6b941174faf..ba7ef63a273 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregate.g.cs @@ -17,22 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class MatrixStatsAggregate : IAggregate +internal sealed partial class MatrixStatsAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("doc_count")] - public long DocCount { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyCollection? Fields { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocCount = default; + LocalJsonValue?> propFields = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocCount = propDocCount.Value, + Fields = propFields.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregateConverter))] +public sealed partial class MatrixStatsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public MatrixStatsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MatrixStatsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatrixStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Fields { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "matrix_stats"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs index db56e60d7af..0624629e879 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsAggregation.g.cs @@ -17,25 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MatrixStatsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFields = default; + LocalJsonValue?> propMissing = default; + LocalJsonValue propMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Missing = propMissing.Value, + Mode = propMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropMissing, value.Missing, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationConverter))] public sealed partial class MatrixStatsAggregation { +#if NET7_0_OR_GREATER + public MatrixStatsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MatrixStatsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of fields for computing the statistics. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -44,41 +112,55 @@ public sealed partial class MatrixStatsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public IDictionary? Missing { get; set; } + public System.Collections.Generic.IDictionary? Missing { get; set; } /// /// /// Array value the aggregation will use for array or multi-valued fields. /// /// - [JsonInclude, JsonPropertyName("mode")] public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MatrixStatsAggregation matrixStatsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MatrixStats(matrixStatsAggregation); } -public sealed partial class MatrixStatsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MatrixStatsAggregationDescriptor { - internal MatrixStatsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation instance) + { + Instance = instance; + } - public MatrixStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private IDictionary? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// An array of fields for computing the statistics. /// /// - public MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// An array of fields for computing the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; } /// @@ -87,69 +169,114 @@ public MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasti /// By default, documents without a value are ignored. /// /// - public MatrixStatsAggregationDescriptor Missing(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing(System.Collections.Generic.IDictionary? value) { - MissingValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Missing = value; + return this; } /// /// - /// Array value the aggregation will use for array or multi-valued fields. + /// The value to apply to documents that do not have a value. + /// By default, documents without a value are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble.Build(null); + return this; + } + + /// + /// + /// The value to apply to documents that do not have a value. + /// By default, documents without a value are ignored. /// /// - public MatrixStatsAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing(System.Action>? action) { - ModeValue = mode; - return Self; + Instance.Missing = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor AddMissing(Elastic.Clients.Elasticsearch.Field key, double value) { - writer.WriteStartObject(); - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + Instance.Missing ??= new System.Collections.Generic.Dictionary(); + Instance.Missing.Add(key, value); + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor AddMissing(System.Linq.Expressions.Expression> key, double value) + { + Instance.Missing ??= new System.Collections.Generic.Dictionary(); + Instance.Missing.Add(key, value); + return this; + } - if (ModeValue is not null) + /// + /// + /// Array value the aggregation will use for array or multi-valued fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) + { + Instance.Mode = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MatrixStatsAggregationDescriptor : SerializableDescriptor +public readonly partial struct MatrixStatsAggregationDescriptor { - internal MatrixStatsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation Instance { get; init; } - public MatrixStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private IDictionary? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// An array of fields for computing the statistics. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } /// /// /// An array of fields for computing the statistics. /// /// - public MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -158,44 +285,83 @@ public MatrixStatsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.Fie /// By default, documents without a value are ignored. /// /// - public MatrixStatsAggregationDescriptor Missing(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing(System.Collections.Generic.IDictionary? value) { - MissingValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Missing = value; + return this; } /// /// - /// Array value the aggregation will use for array or multi-valued fields. + /// The value to apply to documents that do not have a value. + /// By default, documents without a value are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble.Build(null); + return this; + } + + /// + /// + /// The value to apply to documents that do not have a value. + /// By default, documents without a value are ignored. /// /// - public MatrixStatsAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing(System.Action? action) { - ModeValue = mode; - return Self; + Instance.Missing = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The value to apply to documents that do not have a value. + /// By default, documents without a value are ignored. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Missing(System.Action>? action) { - writer.WriteStartObject(); - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + Instance.Missing = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldDouble.Build(action); + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor AddMissing(Elastic.Clients.Elasticsearch.Field key, double value) + { + Instance.Missing ??= new System.Collections.Generic.Dictionary(); + Instance.Missing.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor AddMissing(System.Linq.Expressions.Expression> key, double value) + { + Instance.Missing ??= new System.Collections.Generic.Dictionary(); + Instance.Missing.Add(key, value); + return this; + } - if (ModeValue is not null) + /// + /// + /// Array value the aggregation will use for array or multi-valued fields. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) + { + Instance.Mode = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsFields.g.cs index f1b01e2dbb5..202857599a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MatrixStatsFields.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MatrixStatsFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCorrelation = System.Text.Json.JsonEncodedText.Encode("correlation"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCovariance = System.Text.Json.JsonEncodedText.Encode("covariance"); + private static readonly System.Text.Json.JsonEncodedText PropKurtosis = System.Text.Json.JsonEncodedText.Encode("kurtosis"); + private static readonly System.Text.Json.JsonEncodedText PropMean = System.Text.Json.JsonEncodedText.Encode("mean"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropSkewness = System.Text.Json.JsonEncodedText.Encode("skewness"); + private static readonly System.Text.Json.JsonEncodedText PropVariance = System.Text.Json.JsonEncodedText.Encode("variance"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCorrelation = default; + LocalJsonValue propCount = default; + LocalJsonValue> propCovariance = default; + LocalJsonValue propKurtosis = default; + LocalJsonValue propMean = default; + LocalJsonValue propName = default; + LocalJsonValue propSkewness = default; + LocalJsonValue propVariance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCorrelation.TryReadProperty(ref reader, options, PropCorrelation, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCovariance.TryReadProperty(ref reader, options, PropCovariance, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propKurtosis.TryReadProperty(ref reader, options, PropKurtosis, null)) + { + continue; + } + + if (propMean.TryReadProperty(ref reader, options, PropMean, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propSkewness.TryReadProperty(ref reader, options, PropSkewness, null)) + { + continue; + } + + if (propVariance.TryReadProperty(ref reader, options, PropVariance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Correlation = propCorrelation.Value, + Count = propCount.Value, + Covariance = propCovariance.Value, + Kurtosis = propKurtosis.Value, + Mean = propMean.Value, + Name = propName.Value, + Skewness = propSkewness.Value, + Variance = propVariance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCorrelation, value.Correlation, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCovariance, value.Covariance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropKurtosis, value.Kurtosis, null, null); + writer.WriteProperty(options, PropMean, value.Mean, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropSkewness, value.Skewness, null, null); + writer.WriteProperty(options, PropVariance, value.Variance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MatrixStatsFieldsConverter))] public sealed partial class MatrixStatsFields { - [JsonInclude, JsonPropertyName("correlation")] - [ReadOnlyFieldDictionaryConverter(typeof(double))] - public IReadOnlyDictionary Correlation { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("covariance")] - [ReadOnlyFieldDictionaryConverter(typeof(double))] - public IReadOnlyDictionary Covariance { get; init; } - [JsonInclude, JsonPropertyName("kurtosis")] - public double Kurtosis { get; init; } - [JsonInclude, JsonPropertyName("mean")] - public double Mean { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("skewness")] - public double Skewness { get; init; } - [JsonInclude, JsonPropertyName("variance")] - public double Variance { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatrixStatsFields(System.Collections.Generic.IReadOnlyDictionary correlation, long count, System.Collections.Generic.IReadOnlyDictionary covariance, double kurtosis, double mean, string name, double skewness, double variance) + { + Correlation = correlation; + Count = count; + Covariance = covariance; + Kurtosis = kurtosis; + Mean = mean; + Name = name; + Skewness = skewness; + Variance = variance; + } +#if NET7_0_OR_GREATER + public MatrixStatsFields() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MatrixStatsFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatrixStatsFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Correlation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Covariance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Kurtosis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Mean { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Skewness { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Variance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregate.g.cs index cddda334221..9ca7a864512 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregate.g.cs @@ -17,20 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class MaxAggregate : IAggregate +internal sealed partial class MaxAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MaxAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MaxAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregateConverter))] +public sealed partial class MaxAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public MaxAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MaxAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MaxAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "max"; /// /// @@ -38,8 +115,10 @@ public sealed partial class MaxAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs index 1d145ce30ef..5a9f459e1f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MaxAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationConverter))] public sealed partial class MaxAggregation { +#if NET7_0_OR_GREATER + public MaxAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MaxAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,49 +122,38 @@ public sealed partial class MaxAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MaxAggregation maxAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Max(maxAggregation); } -public sealed partial class MaxAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MaxAggregationDescriptor { - internal MaxAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation Instance { get; init; } - public MaxAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public MaxAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public MaxAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -95,16 +161,16 @@ public MaxAggregationDescriptor Field(Expression /// - public MaxAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MaxAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -113,112 +179,72 @@ public MaxAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public MaxAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MaxAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MaxAggregationDescriptor : SerializableDescriptor +public readonly partial struct MaxAggregationDescriptor { - internal MaxAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation Instance { get; init; } - public MaxAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public MaxAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public MaxAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -226,16 +252,16 @@ public MaxAggregationDescriptor Field(Expression /// - public MaxAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MaxAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -244,73 +270,40 @@ public MaxAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public MaxAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MaxAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MaxAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MaxAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxBucketAggregation.g.cs index e5e62b7dfac..b3c8d5d2853 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MaxBucketAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MaxBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationConverter))] public sealed partial class MaxBucketAggregation { +#if NET7_0_OR_GREATER + public MaxBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MaxBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MaxBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class MaxBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class MaxBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MaxBucketAggregation maxBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MaxBucket(maxBucketAggregation); } -public sealed partial class MaxBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct MaxBucketAggregationDescriptor { - internal MaxBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation instance) + { + Instance = instance; + } - public MaxBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public MaxBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public MaxBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch. /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public MaxBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public MaxBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public MaxBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MaxBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregate.g.cs index 4d868eea1db..1ddd002069f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregate.g.cs @@ -17,20 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class MedianAbsoluteDeviationAggregate : IAggregate +internal sealed partial class MedianAbsoluteDeviationAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregateConverter))] +public sealed partial class MedianAbsoluteDeviationAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MedianAbsoluteDeviationAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public MedianAbsoluteDeviationAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MedianAbsoluteDeviationAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MedianAbsoluteDeviationAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "median_absolute_deviation"; /// /// @@ -38,8 +115,10 @@ public sealed partial class MedianAbsoluteDeviationAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs index 1ec93f86afe..6e68108980c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MedianAbsoluteDeviationAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MedianAbsoluteDeviationAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompression = System.Text.Json.JsonEncodedText.Encode("compression"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompression = default; + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompression.TryReadProperty(ref reader, options, PropCompression, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Compression = propCompression.Value, + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompression, value.Compression, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationConverter))] public sealed partial class MedianAbsoluteDeviationAggregation { +#if NET7_0_OR_GREATER + public MedianAbsoluteDeviationAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MedianAbsoluteDeviationAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - [JsonInclude, JsonPropertyName("compression")] public double? Compression { get; set; } /// @@ -42,9 +129,7 @@ public sealed partial class MedianAbsoluteDeviationAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -53,50 +138,38 @@ public sealed partial class MedianAbsoluteDeviationAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MedianAbsoluteDeviationAggregation medianAbsoluteDeviationAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MedianAbsoluteDeviation(medianAbsoluteDeviationAggregation); } -public sealed partial class MedianAbsoluteDeviationAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MedianAbsoluteDeviationAggregationDescriptor { - internal MedianAbsoluteDeviationAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation Instance { get; init; } - public MedianAbsoluteDeviationAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MedianAbsoluteDeviationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation instance) { + Instance = instance; } - private double? CompressionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. - /// - /// - public MedianAbsoluteDeviationAggregationDescriptor Compression(double? compression) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MedianAbsoluteDeviationAggregationDescriptor() { - CompressionValue = compression; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Compression(double? value) { - FieldValue = field; - return Self; + Instance.Compression = value; + return this; } /// @@ -104,10 +177,10 @@ public MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Cli /// The field on which to run the aggregation. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -115,16 +188,16 @@ public MedianAbsoluteDeviationAggregationDescriptor Field(Exp /// The field on which to run the aggregation. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -133,119 +206,72 @@ public MedianAbsoluteDeviationAggregationDescriptor Format(string? fo /// By default, documents without a value are ignored. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (CompressionValue.HasValue) + if (action is null) { - writer.WritePropertyName("compression"); - writer.WriteNumberValue(CompressionValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MedianAbsoluteDeviationAggregationDescriptor : SerializableDescriptor +public readonly partial struct MedianAbsoluteDeviationAggregationDescriptor { - internal MedianAbsoluteDeviationAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation Instance { get; init; } - public MedianAbsoluteDeviationAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MedianAbsoluteDeviationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation instance) { + Instance = instance; } - private double? CompressionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. - /// - /// - public MedianAbsoluteDeviationAggregationDescriptor Compression(double? compression) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MedianAbsoluteDeviationAggregationDescriptor() { - CompressionValue = compression; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field on which to run the aggregation. + /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Compression(double? value) { - FieldValue = field; - return Self; + Instance.Compression = value; + return this; } /// @@ -253,10 +279,10 @@ public MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Clients.Elasti /// The field on which to run the aggregation. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -264,16 +290,16 @@ public MedianAbsoluteDeviationAggregationDescriptor Field(Exp /// The field on which to run the aggregation. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -282,79 +308,40 @@ public MedianAbsoluteDeviationAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public MedianAbsoluteDeviationAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MedianAbsoluteDeviationAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (CompressionValue.HasValue) - { - writer.WritePropertyName("compression"); - writer.WriteNumberValue(CompressionValue.Value); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MedianAbsoluteDeviationAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregate.g.cs index 08ab4f8d939..3d595003d2b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregate.g.cs @@ -17,20 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class MinAggregate : IAggregate +internal sealed partial class MinAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MinAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MinAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MinAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MinAggregateConverter))] +public sealed partial class MinAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public MinAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MinAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MinAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "min"; /// /// @@ -38,8 +115,10 @@ public sealed partial class MinAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs index 6cd439a0fc9..e815b21b449 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MinAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MinAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MinAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MinAggregationConverter))] public sealed partial class MinAggregation { +#if NET7_0_OR_GREATER + public MinAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MinAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,49 +122,38 @@ public sealed partial class MinAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MinAggregation minAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Min(minAggregation); } -public sealed partial class MinAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MinAggregationDescriptor { - internal MinAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MinAggregation Instance { get; init; } - public MinAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public MinAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public MinAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -95,16 +161,16 @@ public MinAggregationDescriptor Field(Expression /// - public MinAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MinAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -113,112 +179,72 @@ public MinAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public MinAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MinAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MinAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MinAggregationDescriptor : SerializableDescriptor +public readonly partial struct MinAggregationDescriptor { - internal MinAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MinAggregation Instance { get; init; } - public MinAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public MinAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public MinAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -226,16 +252,16 @@ public MinAggregationDescriptor Field(Expression /// - public MinAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MinAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -244,73 +270,40 @@ public MinAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public MinAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public MinAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public MinAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MinAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MinAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MinAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinBucketAggregation.g.cs index 4b85cf978ee..d0f72b4a683 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MinBucketAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MinBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationConverter))] public sealed partial class MinBucketAggregation { +#if NET7_0_OR_GREATER + public MinBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MinBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MinBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class MinBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class MinBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MinBucketAggregation minBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MinBucket(minBucketAggregation); } -public sealed partial class MinBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct MinBucketAggregationDescriptor { - internal MinBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation instance) + { + Instance = instance; + } - public MinBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public MinBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public MinBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch. /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public MinBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public MinBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public MinBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MinBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregate.g.cs index 230547ba313..f7ba0328c78 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class MissingAggregateConverter : JsonConverter +internal sealed partial class MissingAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override MissingAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MissingAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new MissingAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, MissingAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MissingAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'MissingAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(MissingAggregateConverter))] -public sealed partial class MissingAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregateConverter))] +public sealed partial class MissingAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MissingAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public MissingAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MissingAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MissingAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "missing"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs index a710b92bc9b..4009bb4b421 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs @@ -17,63 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MissingAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationConverter))] public sealed partial class MissingAggregation { +#if NET7_0_OR_GREATER + public MissingAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MissingAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the field. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Missing(missingAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Missing(missingAggregation); + public object? Missing { get; set; } } -public sealed partial class MissingAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MissingAggregationDescriptor { - internal MissingAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation Instance { get; init; } - public MissingAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MissingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - - /// - /// - /// The name of the field. - /// - /// - public MissingAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MissingAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the field. /// /// - public MissingAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -81,68 +134,60 @@ public MissingAggregationDescriptor Field(Expression /// - public MissingAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MissingAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MissingAggregationDescriptor : SerializableDescriptor +public readonly partial struct MissingAggregationDescriptor { - internal MissingAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation Instance { get; init; } - public MissingAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MissingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - - /// - /// - /// The name of the field. - /// - /// - public MissingAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MissingAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the field. /// /// - public MissingAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -150,33 +195,28 @@ public MissingAggregationDescriptor Field(Expression /// - public MissingAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MissingAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingFunctionAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingFunctionAggregation.g.cs index 92a3f7483c3..324449678c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingFunctionAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingFunctionAggregation.g.cs @@ -17,25 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MovingFunctionAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropShift = System.Text.Json.JsonEncodedText.Encode("shift"); + private static readonly System.Text.Json.JsonEncodedText PropWindow = System.Text.Json.JsonEncodedText.Encode("window"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propScript = default; + LocalJsonValue propShift = default; + LocalJsonValue propWindow = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propShift.TryReadProperty(ref reader, options, PropShift, null)) + { + continue; + } + + if (propWindow.TryReadProperty(ref reader, options, PropWindow, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Script = propScript.Value, + Shift = propShift.Value, + Window = propWindow.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropShift, value.Shift, null, null); + writer.WriteProperty(options, PropWindow, value.Window, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationConverter))] public sealed partial class MovingFunctionAggregation { +#if NET7_0_OR_GREATER + public MovingFunctionAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MovingFunctionAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +139,6 @@ public sealed partial class MovingFunctionAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +146,6 @@ public sealed partial class MovingFunctionAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,7 +153,6 @@ public sealed partial class MovingFunctionAggregation /// The script that should be executed on each window of data. /// /// - [JsonInclude, JsonPropertyName("script")] public string? Script { get; set; } /// @@ -68,7 +161,6 @@ public sealed partial class MovingFunctionAggregation /// Increasing shift by 1, moves the starting window position by 1 to the right. /// /// - [JsonInclude, JsonPropertyName("shift")] public int? Shift { get; set; } /// @@ -76,36 +168,37 @@ public sealed partial class MovingFunctionAggregation /// The size of window to "slide" across the histogram. /// /// - [JsonInclude, JsonPropertyName("window")] public int? Window { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MovingFunctionAggregation movingFunctionAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MovingFn(movingFunctionAggregation); } -public sealed partial class MovingFunctionAggregationDescriptor : SerializableDescriptor +public readonly partial struct MovingFunctionAggregationDescriptor { - internal MovingFunctionAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation Instance { get; init; } - public MovingFunctionAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MovingFunctionAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private string? ScriptValue { get; set; } - private int? ShiftValue { get; set; } - private int? WindowValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MovingFunctionAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public MovingFunctionAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -114,10 +207,10 @@ public MovingFunctionAggregationDescriptor BucketsPath(Elastic.Clients.Elasticse /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public MovingFunctionAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -125,10 +218,10 @@ public MovingFunctionAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public MovingFunctionAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -136,10 +229,10 @@ public MovingFunctionAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsear /// The script that should be executed on each window of data. /// /// - public MovingFunctionAggregationDescriptor Script(string? script) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor Script(string? value) { - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } /// @@ -148,10 +241,10 @@ public MovingFunctionAggregationDescriptor Script(string? script) /// Increasing shift by 1, moves the starting window position by 1 to the right. /// /// - public MovingFunctionAggregationDescriptor Shift(int? shift) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor Shift(int? value) { - ShiftValue = shift; - return Self; + Instance.Shift = value; + return this; } /// @@ -159,51 +252,22 @@ public MovingFunctionAggregationDescriptor Shift(int? shift) /// The size of window to "slide" across the histogram. /// /// - public MovingFunctionAggregationDescriptor Window(int? window) + public Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor Window(int? value) { - WindowValue = window; - return Self; + Instance.Window = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (!string.IsNullOrEmpty(ScriptValue)) - { - writer.WritePropertyName("script"); - writer.WriteStringValue(ScriptValue); - } - - if (ShiftValue.HasValue) - { - writer.WritePropertyName("shift"); - writer.WriteNumberValue(ShiftValue.Value); - } - - if (WindowValue.HasValue) - { - writer.WritePropertyName("window"); - writer.WriteNumberValue(WindowValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MovingFunctionAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingPercentilesAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingPercentilesAggregation.g.cs index d6b9038ef83..3772feb36de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingPercentilesAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MovingPercentilesAggregation.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MovingPercentilesAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropShift = System.Text.Json.JsonEncodedText.Encode("shift"); + private static readonly System.Text.Json.JsonEncodedText PropWindow = System.Text.Json.JsonEncodedText.Encode("window"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propShift = default; + LocalJsonValue propWindow = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propShift.TryReadProperty(ref reader, options, PropShift, null)) + { + continue; + } + + if (propWindow.TryReadProperty(ref reader, options, PropWindow, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Shift = propShift.Value, + Window = propWindow.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropShift, value.Shift, null, null); + writer.WriteProperty(options, PropWindow, value.Window, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationConverter))] public sealed partial class MovingPercentilesAggregation { +#if NET7_0_OR_GREATER + public MovingPercentilesAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MovingPercentilesAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +130,6 @@ public sealed partial class MovingPercentilesAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +137,6 @@ public sealed partial class MovingPercentilesAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -60,7 +145,6 @@ public sealed partial class MovingPercentilesAggregation /// Increasing shift by 1, moves the starting window position by 1 to the right. /// /// - [JsonInclude, JsonPropertyName("shift")] public int? Shift { get; set; } /// @@ -68,35 +152,37 @@ public sealed partial class MovingPercentilesAggregation /// The size of window to "slide" across the histogram. /// /// - [JsonInclude, JsonPropertyName("window")] public int? Window { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MovingPercentilesAggregation movingPercentilesAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MovingPercentiles(movingPercentilesAggregation); } -public sealed partial class MovingPercentilesAggregationDescriptor : SerializableDescriptor +public readonly partial struct MovingPercentilesAggregationDescriptor { - internal MovingPercentilesAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation Instance { get; init; } - public MovingPercentilesAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MovingPercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private int? ShiftValue { get; set; } - private int? WindowValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MovingPercentilesAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public MovingPercentilesAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -105,10 +191,10 @@ public MovingPercentilesAggregationDescriptor BucketsPath(Elastic.Clients.Elasti /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public MovingPercentilesAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -116,10 +202,10 @@ public MovingPercentilesAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public MovingPercentilesAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -128,10 +214,10 @@ public MovingPercentilesAggregationDescriptor GapPolicy(Elastic.Clients.Elastics /// Increasing shift by 1, moves the starting window position by 1 to the right. /// /// - public MovingPercentilesAggregationDescriptor Shift(int? shift) + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor Shift(int? value) { - ShiftValue = shift; - return Self; + Instance.Shift = value; + return this; } /// @@ -139,45 +225,22 @@ public MovingPercentilesAggregationDescriptor Shift(int? shift) /// The size of window to "slide" across the histogram. /// /// - public MovingPercentilesAggregationDescriptor Window(int? window) + public Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor Window(int? value) { - WindowValue = window; - return Self; + Instance.Window = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (ShiftValue.HasValue) - { - writer.WritePropertyName("shift"); - writer.WriteNumberValue(ShiftValue.Value); - } - - if (WindowValue.HasValue) - { - writer.WritePropertyName("window"); - writer.WriteNumberValue(WindowValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MovingPercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermLookup.g.cs index c803a21b918..ac4c9538efc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermLookup.g.cs @@ -17,25 +17,95 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MultiTermLookupConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupConverter))] public sealed partial class MultiTermLookup { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermLookup(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public MultiTermLookup() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiTermLookup() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A fields from which to retrieve terms. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -43,41 +113,37 @@ public sealed partial class MultiTermLookup /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } } -public sealed partial class MultiTermLookupDescriptor : SerializableDescriptor> +public readonly partial struct MultiTermLookupDescriptor { - internal MultiTermLookupDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup Instance { get; init; } - public MultiTermLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermLookupDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - - /// - /// - /// A fields from which to retrieve terms. - /// - /// - public MultiTermLookupDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermLookupDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup instance) => new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor descriptor) => descriptor.Instance; + /// /// /// A fields from which to retrieve terms. /// /// - public MultiTermLookupDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -85,10 +151,10 @@ public MultiTermLookupDescriptor Field(Expression /// - public MultiTermLookupDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -97,58 +163,49 @@ public MultiTermLookupDescriptor Field(Expression /// - public MultiTermLookupDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MultiTermLookupDescriptor : SerializableDescriptor +public readonly partial struct MultiTermLookupDescriptor { - internal MultiTermLookupDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup Instance { get; init; } - public MultiTermLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermLookupDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - - /// - /// - /// A fields from which to retrieve terms. - /// - /// - public MultiTermLookupDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermLookupDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup instance) => new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor descriptor) => descriptor.Instance; + /// /// /// A fields from which to retrieve terms. /// /// - public MultiTermLookupDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -156,10 +213,10 @@ public MultiTermLookupDescriptor Field(Expression /// - public MultiTermLookupDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -168,23 +225,17 @@ public MultiTermLookupDescriptor Field(Expression /// - public MultiTermLookupDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregate.g.cs index 8b9a14cd9a2..0ff2c7d649d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregate.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class MultiTermsAggregate : IAggregate +internal sealed partial class MultiTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSumOtherDocCount = System.Text.Json.JsonEncodedText.Encode("sum_other_doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSumOtherDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSumOtherDocCount.TryReadProperty(ref reader, options, PropSumOtherDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Meta = propMeta.Value, + SumOtherDocCount = propSumOtherDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSumOtherDocCount, value.SumOtherDocCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregateConverter))] +public sealed partial class MultiTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count_error_upper_bound")] - public long? DocCountErrorUpperBound { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("sum_other_doc_count")] - public long? SumOtherDocCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public MultiTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public long? SumOtherDocCount { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "multi_terms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs index 962a8a079e2..6b96880d778 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsAggregation.g.cs @@ -17,24 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MultiTermsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollectMode = System.Text.Json.JsonEncodedText.Encode("collect_mode"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropShowTermDocCountError = System.Text.Json.JsonEncodedText.Encode("show_term_doc_count_error"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollectMode = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue>?> propOrder = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propShowTermDocCountError = default; + LocalJsonValue propSize = default; + LocalJsonValue> propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollectMode.TryReadProperty(ref reader, options, PropCollectMode, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propShowTermDocCountError.TryReadProperty(ref reader, options, PropShowTermDocCountError, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollectMode = propCollectMode.Value, + MinDocCount = propMinDocCount.Value, + Order = propOrder.Value, + ShardMinDocCount = propShardMinDocCount.Value, + ShardSize = propShardSize.Value, + ShowTermDocCountError = propShowTermDocCountError.Value, + Size = propSize.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollectMode, value.CollectMode, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropShowTermDocCountError, value.ShowTermDocCountError, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationConverter))] public sealed partial class MultiTermsAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregation(System.Collections.Generic.ICollection terms) + { + Terms = terms; + } +#if NET7_0_OR_GREATER + public MultiTermsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiTermsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the strategy for data collection. /// /// - [JsonInclude, JsonPropertyName("collect_mode")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectMode { get; set; } /// @@ -42,7 +162,6 @@ public sealed partial class MultiTermsAggregation /// The minimum number of documents in a bucket for it to be returned. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public long? MinDocCount { get; set; } /// @@ -51,16 +170,13 @@ public sealed partial class MultiTermsAggregation /// Defaults to sorting by descending document count. /// /// - [JsonInclude, JsonPropertyName("order")] - [SingleOrManyCollectionConverter(typeof(KeyValuePair))] - public ICollection>? Order { get; set; } + public System.Collections.Generic.ICollection>? Order { get; set; } /// /// /// The minimum number of documents in a bucket on each shard for it to be returned. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public long? ShardMinDocCount { get; set; } /// @@ -69,7 +185,6 @@ public sealed partial class MultiTermsAggregation /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -77,7 +192,6 @@ public sealed partial class MultiTermsAggregation /// Calculates the doc count error on per term basis. /// /// - [JsonInclude, JsonPropertyName("show_term_doc_count_error")] public bool? ShowTermDocCountError { get; set; } /// @@ -85,7 +199,6 @@ public sealed partial class MultiTermsAggregation /// The number of term buckets should be returned out of the overall terms list. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -93,41 +206,41 @@ public sealed partial class MultiTermsAggregation /// The field from which to generate sets of terms. /// /// - [JsonInclude, JsonPropertyName("terms")] - public ICollection Terms { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MultiTermsAggregation multiTermsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.MultiTerms(multiTermsAggregation); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Terms { get; set; } } -public sealed partial class MultiTermsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct MultiTermsAggregationDescriptor { - internal MultiTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation instance) + { + Instance = instance; + } - public MultiTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } - private long? MinDocCountValue { get; set; } - private ICollection>? OrderValue { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private bool? ShowTermDocCountErrorValue { get; set; } - private int? SizeValue { get; set; } - private ICollection TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor TermsDescriptor { get; set; } - private Action> TermsDescriptorAction { get; set; } - private Action>[] TermsDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the strategy for data collection. /// /// - public MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? collectMode) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? value) { - CollectModeValue = collectMode; - return Self; + Instance.CollectMode = value; + return this; } /// @@ -135,10 +248,10 @@ public MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.El /// The minimum number of documents in a bucket for it to be returned. /// /// - public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -147,207 +260,171 @@ public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// /// - /// The minimum number of documents in a bucket on each shard for it to be returned. + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order() { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } /// /// - /// The number of candidate terms produced by each shard. - /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order(System.Action>? action) { - ShardSizeValue = shardSize; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } /// /// - /// Calculates the doc count error on per term basis. + /// The minimum number of documents in a bucket on each shard for it to be returned. /// /// - public MultiTermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShardMinDocCount(long? value) { - ShowTermDocCountErrorValue = showTermDocCountError; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// /// - /// The number of term buckets should be returned out of the overall terms list. + /// The number of candidate terms produced by each shard. + /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public MultiTermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShardSize(int? value) { - SizeValue = size; - return Self; + Instance.ShardSize = value; + return this; } /// /// - /// The field from which to generate sets of terms. + /// Calculates the doc count error on per term basis. /// /// - public MultiTermsAggregationDescriptor Terms(ICollection terms) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShowTermDocCountError(bool? value = true) { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsDescriptorActions = null; - TermsValue = terms; - return Self; + Instance.ShowTermDocCountError = value; + return this; } - public MultiTermsAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor descriptor) + /// + /// + /// The number of term buckets should be returned out of the overall terms list. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Size(int? value) { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptorActions = null; - TermsDescriptor = descriptor; - return Self; + Instance.Size = value; + return this; } - public MultiTermsAggregationDescriptor Terms(Action> configure) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(System.Collections.Generic.ICollection value) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorActions = null; - TermsDescriptorAction = configure; - return Self; + Instance.Terms = value; + return this; } - public MultiTermsAggregationDescriptor Terms(params Action>[] configure) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(params Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup[] values) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsDescriptorActions = configure; - return Self; + Instance.Terms = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(params System.Action>[] actions) { - writer.WriteStartObject(); - if (CollectModeValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("collect_mode"); - JsonSerializer.Serialize(writer, CollectModeValue, options); + items.Add(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor.Build(action)); } - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (ShowTermDocCountErrorValue.HasValue) - { - writer.WritePropertyName("show_term_doc_count_error"); - writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - writer.WriteEndArray(); - } - else if (TermsDescriptorAction is not null) - { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(TermsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (TermsDescriptorActions is not null) - { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - foreach (var action in TermsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } + Instance.Terms = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MultiTermsAggregationDescriptor : SerializableDescriptor +public readonly partial struct MultiTermsAggregationDescriptor { - internal MultiTermsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation Instance { get; init; } - public MultiTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } - private long? MinDocCountValue { get; set; } - private ICollection>? OrderValue { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private bool? ShowTermDocCountErrorValue { get; set; } - private int? SizeValue { get; set; } - private ICollection TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor TermsDescriptor { get; set; } - private Action TermsDescriptorAction { get; set; } - private Action[] TermsDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the strategy for data collection. /// /// - public MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? collectMode) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? value) { - CollectModeValue = collectMode; - return Self; + Instance.CollectMode = value; + return this; } /// @@ -355,10 +432,10 @@ public MultiTermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch /// The minimum number of documents in a bucket for it to be returned. /// /// - public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -367,174 +444,168 @@ public MultiTermsAggregationDescriptor MinDocCount(long? minDocCount) /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// /// - /// The minimum number of documents in a bucket on each shard for it to be returned. + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order() { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } /// /// - /// The number of candidate terms produced by each shard. - /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order(System.Action? action) { - ShardSizeValue = shardSize; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; } /// /// - /// Calculates the doc count error on per term basis. + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. /// /// - public MultiTermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Order(System.Action>? action) { - ShowTermDocCountErrorValue = showTermDocCountError; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } /// /// - /// The number of term buckets should be returned out of the overall terms list. + /// The minimum number of documents in a bucket on each shard for it to be returned. /// /// - public MultiTermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShardMinDocCount(long? value) { - SizeValue = size; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// /// - /// The field from which to generate sets of terms. + /// The number of candidate terms produced by each shard. + /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public MultiTermsAggregationDescriptor Terms(ICollection terms) + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShardSize(int? value) { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsDescriptorActions = null; - TermsValue = terms; - return Self; + Instance.ShardSize = value; + return this; } - public MultiTermsAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor descriptor) + /// + /// + /// Calculates the doc count error on per term basis. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor ShowTermDocCountError(bool? value = true) { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptorActions = null; - TermsDescriptor = descriptor; - return Self; + Instance.ShowTermDocCountError = value; + return this; } - public MultiTermsAggregationDescriptor Terms(Action configure) + /// + /// + /// The number of term buckets should be returned out of the overall terms list. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Size(int? value) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorActions = null; - TermsDescriptorAction = configure; - return Self; + Instance.Size = value; + return this; } - public MultiTermsAggregationDescriptor Terms(params Action[] configure) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(System.Collections.Generic.ICollection value) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsDescriptorActions = configure; - return Self; + Instance.Terms = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(params Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookup[] values) { - writer.WriteStartObject(); - if (CollectModeValue is not null) - { - writer.WritePropertyName("collect_mode"); - JsonSerializer.Serialize(writer, CollectModeValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } + Instance.Terms = [.. values]; + return this; + } - if (ShowTermDocCountErrorValue.HasValue) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("show_term_doc_count_error"); - writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor.Build(action)); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + Instance.Terms = items; + return this; + } - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - writer.WriteEndArray(); - } - else if (TermsDescriptorAction is not null) + /// + /// + /// The field from which to generate sets of terms. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor Terms(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(TermsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor.Build(action)); } - else if (TermsDescriptorActions is not null) - { - writer.WritePropertyName("terms"); - writer.WriteStartArray(); - foreach (var action in TermsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MultiTermLookupDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } + Instance.Terms = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsBucket.g.cs index 003b8283ea2..28a6415e5c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MultiTermsBucket.g.cs @@ -17,87 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class MultiTermsBucketConverter : JsonConverter +internal sealed partial class MultiTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override MultiTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MultiTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long? docCountErrorUpperBound = default; - IReadOnlyCollection key = default; - string? keyAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue> propKey = default; + LocalJsonValue propKeyAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count_error_upper_bound") - { - docCountErrorUpperBound = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize>(ref reader, options); - continue; - } + continue; + } - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new MultiTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, DocCountErrorUpperBound = docCountErrorUpperBound, Key = key, KeyAsString = keyAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MultiTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, MultiTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MultiTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'MultiTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(MultiTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MultiTermsBucketConverter))] public sealed partial class MultiTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermsBucket(long docCount, System.Collections.Generic.IReadOnlyCollection key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public MultiTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long? DocCountErrorUpperBound { get; init; } - public IReadOnlyCollection Key { get; init; } - public string? KeyAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Key { get; set; } + public string? KeyAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs index 56c66c3e276..187ef56cf89 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MutualInformationHeuristic.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class MutualInformationHeuristicConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackgroundIsSuperset = System.Text.Json.JsonEncodedText.Encode("background_is_superset"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeNegatives = System.Text.Json.JsonEncodedText.Encode("include_negatives"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackgroundIsSuperset = default; + LocalJsonValue propIncludeNegatives = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackgroundIsSuperset.TryReadProperty(ref reader, options, PropBackgroundIsSuperset, null)) + { + continue; + } + + if (propIncludeNegatives.TryReadProperty(ref reader, options, PropIncludeNegatives, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackgroundIsSuperset = propBackgroundIsSuperset.Value, + IncludeNegatives = propIncludeNegatives.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackgroundIsSuperset, value.BackgroundIsSuperset, null, null); + writer.WriteProperty(options, PropIncludeNegatives, value.IncludeNegatives, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicConverter))] public sealed partial class MutualInformationHeuristic { +#if NET7_0_OR_GREATER + public MutualInformationHeuristic() + { + } +#endif +#if !NET7_0_OR_GREATER + public MutualInformationHeuristic() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - [JsonInclude, JsonPropertyName("background_is_superset")] public bool? BackgroundIsSuperset { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class MutualInformationHeuristic /// Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. /// /// - [JsonInclude, JsonPropertyName("include_negatives")] public bool? IncludeNegatives { get; set; } } -public sealed partial class MutualInformationHeuristicDescriptor : SerializableDescriptor +public readonly partial struct MutualInformationHeuristicDescriptor { - internal MutualInformationHeuristicDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic Instance { get; init; } - public MutualInformationHeuristicDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MutualInformationHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic instance) { + Instance = instance; } - private bool? BackgroundIsSupersetValue { get; set; } - private bool? IncludeNegativesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MutualInformationHeuristicDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic instance) => new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor descriptor) => descriptor.Instance; /// /// /// Set to false if you defined a custom background filter that represents a different set of documents that you want to compare to. /// /// - public MutualInformationHeuristicDescriptor BackgroundIsSuperset(bool? backgroundIsSuperset = true) + public Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor BackgroundIsSuperset(bool? value = true) { - BackgroundIsSupersetValue = backgroundIsSuperset; - return Self; + Instance.BackgroundIsSuperset = value; + return this; } /// @@ -73,27 +140,22 @@ public MutualInformationHeuristicDescriptor BackgroundIsSuperset(bool? backgroun /// Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. /// /// - public MutualInformationHeuristicDescriptor IncludeNegatives(bool? includeNegatives = true) + public Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor IncludeNegatives(bool? value = true) { - IncludeNegativesValue = includeNegatives; - return Self; + Instance.IncludeNegatives = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic Build(System.Action? action) { - writer.WriteStartObject(); - if (BackgroundIsSupersetValue.HasValue) + if (action is null) { - writer.WritePropertyName("background_is_superset"); - writer.WriteBooleanValue(BackgroundIsSupersetValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IncludeNegativesValue.HasValue) - { - writer.WritePropertyName("include_negatives"); - writer.WriteBooleanValue(IncludeNegativesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregate.g.cs index e38814bec14..ab80ee670f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class NestedAggregateConverter : JsonConverter +internal sealed partial class NestedAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override NestedAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.NestedAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new NestedAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, NestedAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.NestedAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'NestedAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(NestedAggregateConverter))] -public sealed partial class NestedAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregateConverter))] +public sealed partial class NestedAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public NestedAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NestedAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "nested"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs index 1ff452ee03b..cd41d2cd53c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NestedAggregation.g.cs @@ -17,59 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class NestedAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + + public override Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Path = propPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationConverter))] public sealed partial class NestedAggregation { +#if NET7_0_OR_GREATER + public NestedAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public NestedAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The path to the field of type nested. /// /// - [JsonInclude, JsonPropertyName("path")] public Elastic.Clients.Elasticsearch.Field? Path { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(NestedAggregation nestedAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Nested(nestedAggregation); } -public sealed partial class NestedAggregationDescriptor : SerializableDescriptor> +public readonly partial struct NestedAggregationDescriptor { - internal NestedAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation Instance { get; init; } - public NestedAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - - /// - /// - /// The path to the field of type nested. - /// - /// - public NestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedAggregationDescriptor() { - PathValue = path; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The path to the field of type nested. /// /// - public NestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -77,55 +124,54 @@ public NestedAggregationDescriptor Path(Expressionnested. /// /// - public NestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (PathValue is not null) + if (action is null) { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NestedAggregationDescriptor : SerializableDescriptor +public readonly partial struct NestedAggregationDescriptor { - internal NestedAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation Instance { get; init; } - public NestedAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - - /// - /// - /// The path to the field of type nested. - /// - /// - public NestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedAggregationDescriptor() { - PathValue = path; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The path to the field of type nested. /// /// - public NestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -133,21 +179,22 @@ public NestedAggregationDescriptor Path(Expressionnested. /// /// - public NestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (PathValue is not null) + if (action is null) { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.NestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NormalizeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NormalizeAggregation.g.cs index 59aabd2e38f..c68734fa656 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NormalizeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/NormalizeAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class NormalizeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropMethod = System.Text.Json.JsonEncodedText.Encode("method"); + + public override Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propMethod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propMethod.TryReadProperty(ref reader, options, PropMethod, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Method = propMethod.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropMethod, value.Method, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationConverter))] public sealed partial class NormalizeAggregation { +#if NET7_0_OR_GREATER + public NormalizeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public NormalizeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NormalizeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class NormalizeAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class NormalizeAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,34 +135,37 @@ public sealed partial class NormalizeAggregation /// The specific method to apply. /// /// - [JsonInclude, JsonPropertyName("method")] public Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod? Method { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(NormalizeAggregation normalizeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Normalize(normalizeAggregation); } -public sealed partial class NormalizeAggregationDescriptor : SerializableDescriptor +public readonly partial struct NormalizeAggregationDescriptor { - internal NormalizeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation Instance { get; init; } - public NormalizeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NormalizeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod? MethodValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NormalizeAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation(Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public NormalizeAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -95,10 +174,10 @@ public NormalizeAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch. /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public NormalizeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -106,10 +185,10 @@ public NormalizeAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public NormalizeAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -117,39 +196,22 @@ public NormalizeAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Ag /// The specific method to apply. /// /// - public NormalizeAggregationDescriptor Method(Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod? method) + public Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor Method(Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod? value) { - MethodValue = method; - return Self; + Instance.Method = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) + if (action is null) { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (MethodValue is not null) - { - writer.WritePropertyName("method"); - JsonSerializer.Serialize(writer, MethodValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.NormalizeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregate.g.cs index 33739b8289d..17418364ec1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class ParentAggregateConverter : JsonConverter +internal sealed partial class ParentAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override ParentAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ParentAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new ParentAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, ParentAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ParentAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ParentAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(ParentAggregateConverter))] -public sealed partial class ParentAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregateConverter))] +public sealed partial class ParentAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public ParentAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ParentAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ParentAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "parent"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs index 86ea1f4cc6b..fc5bb0e7386 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ParentAggregation.g.cs @@ -17,59 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ParentAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationConverter))] public sealed partial class ParentAggregation { +#if NET7_0_OR_GREATER + public ParentAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ParentAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ParentAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The child type that should be selected. /// /// - [JsonInclude, JsonPropertyName("type")] public string? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ParentAggregation parentAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Parent(parentAggregation); } -public sealed partial class ParentAggregationDescriptor : SerializableDescriptor +public readonly partial struct ParentAggregationDescriptor { - internal ParentAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation instance) + { + Instance = instance; + } - public ParentAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation(Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The child type that should be selected. /// /// - public ParentAggregationDescriptor Type(string? type) + public Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor Type(string? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(TypeValue)) + if (action is null) { - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); + return new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ParentAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs index b25b58fbc19..11e55ab31fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentageScoreHeuristic.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class PercentageScoreHeuristicConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicConverter))] public sealed partial class PercentageScoreHeuristic { +#if NET7_0_OR_GREATER + public PercentageScoreHeuristic() + { + } +#endif +#if !NET7_0_OR_GREATER + public PercentageScoreHeuristic() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } -public sealed partial class PercentageScoreHeuristicDescriptor : SerializableDescriptor +public readonly partial struct PercentageScoreHeuristicDescriptor { - internal PercentageScoreHeuristicDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic Instance { get; init; } - public PercentageScoreHeuristicDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentageScoreHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentageScoreHeuristicDescriptor() { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentileRanksAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentileRanksAggregation.g.cs index e16896f0edb..3bc12958dcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentileRanksAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentileRanksAggregation.g.cs @@ -17,26 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class PercentileRanksAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropHdr = System.Text.Json.JsonEncodedText.Encode("hdr"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTDigest = System.Text.Json.JsonEncodedText.Encode("tdigest"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propHdr = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue propTDigest = default; + LocalJsonValue?> propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propHdr.TryReadProperty(ref reader, options, PropHdr, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTDigest.TryReadProperty(ref reader, options, PropTDigest, null)) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Hdr = propHdr.Value, + Missing = propMissing.Value, + Script = propScript.Value, + TDigest = propTDigest.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropHdr, value.Hdr, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTDigest, value.TDigest, null, null); + writer.WriteProperty(options, PropValues, value.Values, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationConverter))] public sealed partial class PercentileRanksAggregation { +#if NET7_0_OR_GREATER + public PercentileRanksAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public PercentileRanksAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -44,7 +148,6 @@ public sealed partial class PercentileRanksAggregation /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. /// /// - [JsonInclude, JsonPropertyName("hdr")] public Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? Hdr { get; set; } /// @@ -53,9 +156,7 @@ public sealed partial class PercentileRanksAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -63,7 +164,6 @@ public sealed partial class PercentileRanksAggregation /// Sets parameters for the default TDigest algorithm used to calculate percentile ranks. /// /// - [JsonInclude, JsonPropertyName("tdigest")] public Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigest { get; set; } /// @@ -71,54 +171,37 @@ public sealed partial class PercentileRanksAggregation /// An array of values for which to calculate the percentile ranks. /// /// - [JsonInclude, JsonPropertyName("values")] - public ICollection? Values { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(PercentileRanksAggregation percentileRanksAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.PercentileRanks(percentileRanksAggregation); + public System.Collections.Generic.ICollection? Values { get; set; } } -public sealed partial class PercentileRanksAggregationDescriptor : SerializableDescriptor> +public readonly partial struct PercentileRanksAggregationDescriptor { - internal PercentileRanksAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation Instance { get; init; } - public PercentileRanksAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentileRanksAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? HdrValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor HdrDescriptor { get; set; } - private Action HdrDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigestValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor TDigestDescriptor { get; set; } - private Action TDigestDescriptorAction { get; set; } - private ICollection? ValuesValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public PercentileRanksAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentileRanksAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public PercentileRanksAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -126,16 +209,16 @@ public PercentileRanksAggregationDescriptor Field(Expression< /// The field on which to run the aggregation. /// /// - public PercentileRanksAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PercentileRanksAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -143,28 +226,32 @@ public PercentileRanksAggregationDescriptor Format(string? format) /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. /// /// - public PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? hdr) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? value) { - HdrDescriptor = null; - HdrDescriptorAction = null; - HdrValue = hdr; - return Self; + Instance.Hdr = value; + return this; } - public PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor descriptor) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr() { - HdrValue = null; - HdrDescriptorAction = null; - HdrDescriptor = descriptor; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor Hdr(Action configure) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr(System.Action? action) { - HdrValue = null; - HdrDescriptor = null; - HdrDescriptorAction = configure; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(action); + return this; } /// @@ -173,34 +260,28 @@ public PercentileRanksAggregationDescriptor Hdr(Action /// - public PercentileRanksAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -208,28 +289,32 @@ public PercentileRanksAggregationDescriptor Script(Action /// - public PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? tDigest) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? value) { - TDigestDescriptor = null; - TDigestDescriptorAction = null; - TDigestValue = tDigest; - return Self; + Instance.TDigest = value; + return this; } - public PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor descriptor) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest() { - TDigestValue = null; - TDigestDescriptorAction = null; - TDigestDescriptor = descriptor; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor TDigest(Action configure) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest(System.Action? action) { - TDigestValue = null; - TDigestDescriptor = null; - TDigestDescriptorAction = configure; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(action); + return this; } /// @@ -237,133 +322,54 @@ public PercentileRanksAggregationDescriptor TDigest(Action /// - public PercentileRanksAggregationDescriptor Values(ICollection? values) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Values(System.Collections.Generic.ICollection? value) { - ValuesValue = values; - return Self; + Instance.Values = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HdrDescriptor is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrDescriptor, options); - } - else if (HdrDescriptorAction is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(HdrDescriptorAction), options); - } - else if (HdrValue is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TDigestDescriptor is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestDescriptor, options); - } - else if (TDigestDescriptorAction is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(TDigestDescriptorAction), options); - } - else if (TDigestValue is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestValue, options); - } - - if (ValuesValue is not null) - { - writer.WritePropertyName("values"); - JsonSerializer.Serialize(writer, ValuesValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PercentileRanksAggregationDescriptor : SerializableDescriptor +public readonly partial struct PercentileRanksAggregationDescriptor { - internal PercentileRanksAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation Instance { get; init; } - public PercentileRanksAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentileRanksAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? HdrValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor HdrDescriptor { get; set; } - private Action HdrDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigestValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor TDigestDescriptor { get; set; } - private Action TDigestDescriptorAction { get; set; } - private ICollection? ValuesValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public PercentileRanksAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentileRanksAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public PercentileRanksAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -371,16 +377,16 @@ public PercentileRanksAggregationDescriptor Field(Expression< /// The field on which to run the aggregation. /// /// - public PercentileRanksAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PercentileRanksAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -388,28 +394,32 @@ public PercentileRanksAggregationDescriptor Format(string? format) /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. /// /// - public PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? hdr) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? value) { - HdrDescriptor = null; - HdrDescriptorAction = null; - HdrValue = hdr; - return Self; + Instance.Hdr = value; + return this; } - public PercentileRanksAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor descriptor) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr() { - HdrValue = null; - HdrDescriptorAction = null; - HdrDescriptor = descriptor; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor Hdr(Action configure) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Hdr(System.Action? action) { - HdrValue = null; - HdrDescriptor = null; - HdrDescriptorAction = configure; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(action); + return this; } /// @@ -418,34 +428,28 @@ public PercentileRanksAggregationDescriptor Hdr(Action /// - public PercentileRanksAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public PercentileRanksAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -453,28 +457,32 @@ public PercentileRanksAggregationDescriptor Script(Action /// - public PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? tDigest) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? value) { - TDigestDescriptor = null; - TDigestDescriptorAction = null; - TDigestValue = tDigest; - return Self; + Instance.TDigest = value; + return this; } - public PercentileRanksAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor descriptor) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest() { - TDigestValue = null; - TDigestDescriptorAction = null; - TDigestDescriptor = descriptor; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(null); + return this; } - public PercentileRanksAggregationDescriptor TDigest(Action configure) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentile ranks. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor TDigest(System.Action? action) { - TDigestValue = null; - TDigestDescriptor = null; - TDigestDescriptorAction = configure; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(action); + return this; } /// @@ -482,87 +490,22 @@ public PercentileRanksAggregationDescriptor TDigest(Action /// - public PercentileRanksAggregationDescriptor Values(ICollection? values) + public Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor Values(System.Collections.Generic.ICollection? value) { - ValuesValue = values; - return Self; + Instance.Values = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HdrDescriptor is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrDescriptor, options); - } - else if (HdrDescriptorAction is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(HdrDescriptorAction), options); - } - else if (HdrValue is not null) + if (action is null) { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TDigestDescriptor is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestDescriptor, options); - } - else if (TDigestDescriptorAction is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(TDigestDescriptorAction), options); - } - else if (TDigestValue is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestValue, options); - } - - if (ValuesValue is not null) - { - writer.WritePropertyName("values"); - JsonSerializer.Serialize(writer, ValuesValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentileRanksAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs index f74611a4c27..0f531d00cba 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs @@ -17,26 +17,58 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class Percentiles : Union, IReadOnlyCollection> +internal sealed partial class PercentilesConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Aggregations.Percentiles Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Aggregations.Percentiles(reader.ReadValue>>(options, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static Elastic.Clients.Elasticsearch.Union (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number), null, null)!)!)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Aggregations.Percentiles(reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Aggregations.Percentiles)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.Percentiles value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union v) => w.WriteUnionValue(o, v, null, null))); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentilesConverter))] +public sealed partial class Percentiles : Elastic.Clients.Elasticsearch.Union>, System.Collections.Generic.IReadOnlyCollection> { - public Percentiles(IReadOnlyDictionary Keyed) : base(Keyed) + public Percentiles(System.Collections.Generic.IReadOnlyDictionary> value) : base(value) { } - public Percentiles(IReadOnlyCollection Array) : base(Array) + public Percentiles(System.Collections.Generic.IReadOnlyCollection value) : base(value) { } + + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Percentiles(System.Collections.Generic.Dictionary> value) => new Elastic.Clients.Elasticsearch.Aggregations.Percentiles(value); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Percentiles(Elastic.Clients.Elasticsearch.Aggregations.ArrayPercentilesItem[] value) => new Elastic.Clients.Elasticsearch.Aggregations.Percentiles(value); } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.g.cs index e7cc08f5b56..8b0c954f50b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesAggregation.g.cs @@ -17,26 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class PercentilesAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropHdr = System.Text.Json.JsonEncodedText.Encode("hdr"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropPercents = System.Text.Json.JsonEncodedText.Encode("percents"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTDigest = System.Text.Json.JsonEncodedText.Encode("tdigest"); + + public override Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propHdr = default; + LocalJsonValue propMissing = default; + LocalJsonValue?> propPercents = default; + LocalJsonValue propScript = default; + LocalJsonValue propTDigest = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propHdr.TryReadProperty(ref reader, options, PropHdr, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propPercents.TryReadProperty(ref reader, options, PropPercents, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTDigest.TryReadProperty(ref reader, options, PropTDigest, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Hdr = propHdr.Value, + Missing = propMissing.Value, + Percents = propPercents.Value, + Script = propScript.Value, + TDigest = propTDigest.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropHdr, value.Hdr, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropPercents, value.Percents, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTDigest, value.TDigest, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationConverter))] public sealed partial class PercentilesAggregation { +#if NET7_0_OR_GREATER + public PercentilesAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public PercentilesAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -44,7 +148,6 @@ public sealed partial class PercentilesAggregation /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. /// /// - [JsonInclude, JsonPropertyName("hdr")] public Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? Hdr { get; set; } /// @@ -53,17 +156,14 @@ public sealed partial class PercentilesAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// /// The percentiles to calculate. /// /// - [JsonInclude, JsonPropertyName("percents")] - public ICollection? Percents { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.ICollection? Percents { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -71,54 +171,37 @@ public sealed partial class PercentilesAggregation /// Sets parameters for the default TDigest algorithm used to calculate percentiles. /// /// - [JsonInclude, JsonPropertyName("tdigest")] public Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigest { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(PercentilesAggregation percentilesAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Percentiles(percentilesAggregation); } -public sealed partial class PercentilesAggregationDescriptor : SerializableDescriptor> +public readonly partial struct PercentilesAggregationDescriptor { - internal PercentilesAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation Instance { get; init; } - public PercentilesAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? HdrValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor HdrDescriptor { get; set; } - private Action HdrDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private ICollection? PercentsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigestValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor TDigestDescriptor { get; set; } - private Action TDigestDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public PercentilesAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public PercentilesAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -126,16 +209,16 @@ public PercentilesAggregationDescriptor Field(Expression /// - public PercentilesAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PercentilesAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -143,28 +226,32 @@ public PercentilesAggregationDescriptor Format(string? format) /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. /// /// - public PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? hdr) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? value) { - HdrDescriptor = null; - HdrDescriptorAction = null; - HdrValue = hdr; - return Self; + Instance.Hdr = value; + return this; } - public PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor descriptor) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr() { - HdrValue = null; - HdrDescriptorAction = null; - HdrDescriptor = descriptor; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(null); + return this; } - public PercentilesAggregationDescriptor Hdr(Action configure) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr(System.Action? action) { - HdrValue = null; - HdrDescriptor = null; - HdrDescriptorAction = configure; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(action); + return this; } /// @@ -173,10 +260,10 @@ public PercentilesAggregationDescriptor Hdr(Action /// - public PercentilesAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -184,34 +271,39 @@ public PercentilesAggregationDescriptor Missing(Elastic.Clients.Elast /// The percentiles to calculate. /// /// - public PercentilesAggregationDescriptor Percents(ICollection? percents) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Percents(System.Collections.Generic.ICollection? value) { - PercentsValue = percents; - return Self; + Instance.Percents = value; + return this; } - public PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// The percentiles to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Percents(params double[] values) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Percents = [.. values]; + return this; } - public PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public PercentilesAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -219,151 +311,76 @@ public PercentilesAggregationDescriptor Script(Action /// - public PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? tDigest) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? value) { - TDigestDescriptor = null; - TDigestDescriptorAction = null; - TDigestValue = tDigest; - return Self; + Instance.TDigest = value; + return this; } - public PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor descriptor) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest() { - TDigestValue = null; - TDigestDescriptorAction = null; - TDigestDescriptor = descriptor; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(null); + return this; } - public PercentilesAggregationDescriptor TDigest(Action configure) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest(System.Action? action) { - TDigestValue = null; - TDigestDescriptor = null; - TDigestDescriptorAction = configure; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HdrDescriptor is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrDescriptor, options); - } - else if (HdrDescriptorAction is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(HdrDescriptorAction), options); - } - else if (HdrValue is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PercentsValue is not null) - { - writer.WritePropertyName("percents"); - JsonSerializer.Serialize(writer, PercentsValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TDigestDescriptor is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestDescriptor, options); - } - else if (TDigestDescriptorAction is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(TDigestDescriptorAction), options); - } - else if (TDigestValue is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PercentilesAggregationDescriptor : SerializableDescriptor +public readonly partial struct PercentilesAggregationDescriptor { - internal PercentilesAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation Instance { get; init; } - public PercentilesAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? HdrValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor HdrDescriptor { get; set; } - private Action HdrDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private ICollection? PercentsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigest? TDigestValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor TDigestDescriptor { get; set; } - private Action TDigestDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public PercentilesAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public PercentilesAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -371,16 +388,16 @@ public PercentilesAggregationDescriptor Field(Expression /// - public PercentilesAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PercentilesAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -388,28 +405,32 @@ public PercentilesAggregationDescriptor Format(string? format) /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. /// /// - public PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? hdr) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethod? value) { - HdrDescriptor = null; - HdrDescriptorAction = null; - HdrValue = hdr; - return Self; + Instance.Hdr = value; + return this; } - public PercentilesAggregationDescriptor Hdr(Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor descriptor) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr() { - HdrValue = null; - HdrDescriptorAction = null; - HdrDescriptor = descriptor; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(null); + return this; } - public PercentilesAggregationDescriptor Hdr(Action configure) + /// + /// + /// Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Hdr(System.Action? action) { - HdrValue = null; - HdrDescriptor = null; - HdrDescriptorAction = configure; - return Self; + Instance.Hdr = Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor.Build(action); + return this; } /// @@ -418,10 +439,10 @@ public PercentilesAggregationDescriptor Hdr(Action /// - public PercentilesAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -429,34 +450,39 @@ public PercentilesAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Fi /// The percentiles to calculate. /// /// - public PercentilesAggregationDescriptor Percents(ICollection? percents) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Percents(System.Collections.Generic.ICollection? value) { - PercentsValue = percents; - return Self; + Instance.Percents = value; + return this; } - public PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// The percentiles to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Percents(params double[] values) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Percents = [.. values]; + return this; } - public PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public PercentilesAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -464,105 +490,44 @@ public PercentilesAggregationDescriptor Script(Action /// - public PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? tDigest) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigest? value) { - TDigestDescriptor = null; - TDigestDescriptorAction = null; - TDigestValue = tDigest; - return Self; + Instance.TDigest = value; + return this; } - public PercentilesAggregationDescriptor TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor descriptor) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest() { - TDigestValue = null; - TDigestDescriptorAction = null; - TDigestDescriptor = descriptor; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(null); + return this; } - public PercentilesAggregationDescriptor TDigest(Action configure) + /// + /// + /// Sets parameters for the default TDigest algorithm used to calculate percentiles. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor TDigest(System.Action? action) { - TDigestValue = null; - TDigestDescriptor = null; - TDigestDescriptorAction = configure; - return Self; + Instance.TDigest = Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (HdrDescriptor is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrDescriptor, options); - } - else if (HdrDescriptorAction is not null) - { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.HdrMethodDescriptor(HdrDescriptorAction), options); - } - else if (HdrValue is not null) + if (action is null) { - writer.WritePropertyName("hdr"); - JsonSerializer.Serialize(writer, HdrValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PercentsValue is not null) - { - writer.WritePropertyName("percents"); - JsonSerializer.Serialize(writer, PercentsValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TDigestDescriptor is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestDescriptor, options); - } - else if (TDigestDescriptorAction is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(TDigestDescriptorAction), options); - } - else if (TDigestValue is not null) - { - writer.WritePropertyName("tdigest"); - JsonSerializer.Serialize(writer, TDigestValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentilesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregate.g.cs index bed01ff53b2..66e527e0bee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class PercentilesBucketAggregate : IAggregate +internal sealed partial class PercentilesBucketAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("values")] - public Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregateConverter))] +public sealed partial class PercentilesBucketAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesBucketAggregate(Elastic.Clients.Elasticsearch.Aggregations.Percentiles values) + { + Values = values; + } +#if NET7_0_OR_GREATER + public PercentilesBucketAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PercentilesBucketAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercentilesBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "percentiles_bucket"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs index 330062d26a0..42531e3ec0e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/PercentilesBucketAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class PercentilesBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropPercents = System.Text.Json.JsonEncodedText.Encode("percents"); + + public override Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue?> propPercents = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propPercents.TryReadProperty(ref reader, options, PropPercents, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Percents = propPercents.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropPercents, value.Percents, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationConverter))] public sealed partial class PercentilesBucketAggregation { +#if NET7_0_OR_GREATER + public PercentilesBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public PercentilesBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class PercentilesBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class PercentilesBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -59,34 +135,37 @@ public sealed partial class PercentilesBucketAggregation /// The list of percentiles to calculate. /// /// - [JsonInclude, JsonPropertyName("percents")] - public ICollection? Percents { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(PercentilesBucketAggregation percentilesBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.PercentilesBucket(percentilesBucketAggregation); + public System.Collections.Generic.ICollection? Percents { get; set; } } -public sealed partial class PercentilesBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct PercentilesBucketAggregationDescriptor { - internal PercentilesBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation instance) + { + Instance = instance; + } - public PercentilesBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercentilesBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private ICollection? PercentsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public PercentilesBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -95,10 +174,10 @@ public PercentilesBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasti /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public PercentilesBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -106,10 +185,10 @@ public PercentilesBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public PercentilesBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -117,39 +196,33 @@ public PercentilesBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elastics /// The list of percentiles to calculate. /// /// - public PercentilesBucketAggregationDescriptor Percents(ICollection? percents) + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor Percents(System.Collections.Generic.ICollection? value) { - PercentsValue = percents; - return Self; + Instance.Percents = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The list of percentiles to calculate. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor Percents(params double[] values) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } + Instance.Percents = [.. values]; + return this; + } - if (PercentsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("percents"); - JsonSerializer.Serialize(writer, PercentsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.PercentilesBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RandomSamplerAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RandomSamplerAggregation.g.cs index 520b9aca721..8a56f7b2540 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RandomSamplerAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RandomSamplerAggregation.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class RandomSamplerAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropProbability = System.Text.Json.JsonEncodedText.Encode("probability"); + private static readonly System.Text.Json.JsonEncodedText PropSeed = System.Text.Json.JsonEncodedText.Encode("seed"); + private static readonly System.Text.Json.JsonEncodedText PropShardSeed = System.Text.Json.JsonEncodedText.Encode("shard_seed"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propProbability = default; + LocalJsonValue propSeed = default; + LocalJsonValue propShardSeed = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propProbability.TryReadProperty(ref reader, options, PropProbability, null)) + { + continue; + } + + if (propSeed.TryReadProperty(ref reader, options, PropSeed, null)) + { + continue; + } + + if (propShardSeed.TryReadProperty(ref reader, options, PropShardSeed, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Probability = propProbability.Value, + Seed = propSeed.Value, + ShardSeed = propShardSeed.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropProbability, value.Probability, null, null); + writer.WriteProperty(options, PropSeed, value.Seed, null, null); + writer.WriteProperty(options, PropShardSeed, value.ShardSeed, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationConverter))] public sealed partial class RandomSamplerAggregation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomSamplerAggregation(double probability) + { + Probability = probability; + } +#if NET7_0_OR_GREATER + public RandomSamplerAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RandomSamplerAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RandomSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The probability that a document will be included in the aggregated data. @@ -36,8 +112,11 @@ public sealed partial class RandomSamplerAggregation /// The lower the probability, the fewer documents are matched. /// /// - [JsonInclude, JsonPropertyName("probability")] - public double Probability { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Probability { get; set; } /// /// @@ -45,7 +124,6 @@ public sealed partial class RandomSamplerAggregation /// When a seed is provided, the random subset of documents is the same between calls. /// /// - [JsonInclude, JsonPropertyName("seed")] public int? Seed { get; set; } /// @@ -53,23 +131,27 @@ public sealed partial class RandomSamplerAggregation /// When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same. /// /// - [JsonInclude, JsonPropertyName("shard_seed")] public int? ShardSeed { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(RandomSamplerAggregation randomSamplerAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.RandomSampler(randomSamplerAggregation); } -public sealed partial class RandomSamplerAggregationDescriptor : SerializableDescriptor +public readonly partial struct RandomSamplerAggregationDescriptor { - internal RandomSamplerAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation Instance { get; init; } - public RandomSamplerAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation instance) { + Instance = instance; } - private double ProbabilityValue { get; set; } - private int? SeedValue { get; set; } - private int? ShardSeedValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomSamplerAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation(Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -78,10 +160,10 @@ public RandomSamplerAggregationDescriptor() : base() /// The lower the probability, the fewer documents are matched. /// /// - public RandomSamplerAggregationDescriptor Probability(double probability) + public Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor Probability(double value) { - ProbabilityValue = probability; - return Self; + Instance.Probability = value; + return this; } /// @@ -90,10 +172,10 @@ public RandomSamplerAggregationDescriptor Probability(double probability) /// When a seed is provided, the random subset of documents is the same between calls. /// /// - public RandomSamplerAggregationDescriptor Seed(int? seed) + public Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor Seed(int? value) { - SeedValue = seed; - return Self; + Instance.Seed = value; + return this; } /// @@ -101,29 +183,17 @@ public RandomSamplerAggregationDescriptor Seed(int? seed) /// When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same. /// /// - public RandomSamplerAggregationDescriptor ShardSeed(int? shardSeed) + public Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor ShardSeed(int? value) { - ShardSeedValue = shardSeed; - return Self; + Instance.ShardSeed = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("probability"); - writer.WriteNumberValue(ProbabilityValue); - if (SeedValue.HasValue) - { - writer.WritePropertyName("seed"); - writer.WriteNumberValue(SeedValue.Value); - } - - if (ShardSeedValue.HasValue) - { - writer.WritePropertyName("shard_seed"); - writer.WriteNumberValue(ShardSeedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RandomSamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregate.g.cs index e9df9b37862..15795b50eda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class RangeAggregate : IAggregate +internal sealed partial class RangeAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RangeAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RangeAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregateConverter))] +public sealed partial class RangeAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public RangeAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RangeAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RangeAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "range"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs index ea23eb6da79..eb03127a930 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs @@ -17,26 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class RangeAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropRanges = System.Text.Json.JsonEncodedText.Encode("ranges"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue?> propRanges = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propRanges.TryReadProperty(ref reader, options, PropRanges, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Ranges = propRanges.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropRanges, value.Ranges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationConverter))] public sealed partial class RangeAggregation { +#if NET7_0_OR_GREATER + public RangeAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public RangeAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The date field whose values are use to build ranges. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,7 +131,6 @@ public sealed partial class RangeAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] public int? Missing { get; set; } /// @@ -53,54 +138,38 @@ public sealed partial class RangeAggregation /// An array of ranges used to bucket documents. /// /// - [JsonInclude, JsonPropertyName("ranges")] - public ICollection? Ranges { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.ICollection? Ranges { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Range(rangeAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Range(rangeAggregation); } -public sealed partial class RangeAggregationDescriptor : SerializableDescriptor> +public readonly partial struct RangeAggregationDescriptor { - internal RangeAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation Instance { get; init; } - public RangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private int? MissingValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The date field whose values are use to build ranges. - /// - /// - public RangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field whose values are use to build ranges. /// /// - public RangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -108,16 +177,16 @@ public RangeAggregationDescriptor Field(Expression /// - public RangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RangeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -126,10 +195,10 @@ public RangeAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public RangeAggregationDescriptor Missing(int? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Missing(int? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -137,177 +206,100 @@ public RangeAggregationDescriptor Missing(int? missing) /// An array of ranges used to bucket documents. /// /// - public RangeAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public RangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor descriptor) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.AggregationRange[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public RangeAggregationDescriptor Ranges(Action configure) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor.Build(action)); + } - public RangeAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } - public RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public RangeAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (RangesDescriptor is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RangeAggregationDescriptor : SerializableDescriptor +public readonly partial struct RangeAggregationDescriptor { - internal RangeAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation Instance { get; init; } - public RangeAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private int? MissingValue { get; set; } - private ICollection? RangesValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor RangesDescriptor { get; set; } - private Action RangesDescriptorAction { get; set; } - private Action[] RangesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The date field whose values are use to build ranges. - /// - /// - public RangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field whose values are use to build ranges. /// /// - public RangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -315,16 +307,16 @@ public RangeAggregationDescriptor Field(Expression /// - public RangeAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RangeAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -333,10 +325,10 @@ public RangeAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public RangeAggregationDescriptor Missing(int? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Missing(int? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -344,134 +336,68 @@ public RangeAggregationDescriptor Missing(int? missing) /// An array of ranges used to bucket documents. /// /// - public RangeAggregationDescriptor Ranges(ICollection? ranges) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(System.Collections.Generic.ICollection? value) { - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesValue = ranges; - return Self; + Instance.Ranges = value; + return this; } - public RangeAggregationDescriptor Ranges(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor descriptor) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(params Elastic.Clients.Elasticsearch.Aggregations.AggregationRange[] values) { - RangesValue = null; - RangesDescriptorAction = null; - RangesDescriptorActions = null; - RangesDescriptor = descriptor; - return Self; + Instance.Ranges = [.. values]; + return this; } - public RangeAggregationDescriptor Ranges(Action configure) + /// + /// + /// An array of ranges used to bucket documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Ranges(params System.Action?[] actions) { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorActions = null; - RangesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor.Build(action)); + } - public RangeAggregationDescriptor Ranges(params Action[] configure) - { - RangesValue = null; - RangesDescriptor = null; - RangesDescriptorAction = null; - RangesDescriptorActions = configure; - return Self; + Instance.Ranges = items; + return this; } - public RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public RangeAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public RangeAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (RangesDescriptor is not null) + if (action is null) { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RangesDescriptor, options); - writer.WriteEndArray(); - } - else if (RangesDescriptorAction is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(RangesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RangesDescriptorActions is not null) - { - writer.WritePropertyName("ranges"); - writer.WriteStartArray(); - foreach (var action in RangesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.AggregationRangeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RangesValue is not null) - { - writer.WritePropertyName("ranges"); - JsonSerializer.Serialize(writer, RangesValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeBucket.g.cs index b8079e6ad04..5136e060324 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeBucket.g.cs @@ -17,109 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class RangeBucketConverter : JsonConverter +internal sealed partial class RangeBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override RangeBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropFromAsString = System.Text.Json.JsonEncodedText.Encode("from_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + private static readonly System.Text.Json.JsonEncodedText PropToAsString = System.Text.Json.JsonEncodedText.Encode("to_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RangeBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - double? from = default; - string? fromAsString = default; - string? key = default; - double? to = default; - string? toAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propFrom = default; + LocalJsonValue propFromAsString = default; + LocalJsonValue propKey = default; + LocalJsonValue propTo = default; + LocalJsonValue propToAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propFromAsString.TryReadProperty(ref reader, options, PropFromAsString, null)) + { + continue; + } + + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (propToAsString.TryReadProperty(ref reader, options, PropToAsString, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "from") - { - from = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "from_as_string") - { - fromAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "to") - { - to = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "to_as_string") - { - toAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } - - throw new JsonException("Unknown property read from JSON."); + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new RangeBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, From = from, FromAsString = fromAsString, Key = key, To = to, ToAsString = toAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RangeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + From = propFrom.Value, + FromAsString = propFromAsString.Value, + Key = propKey.Value, + To = propTo.Value, + ToAsString = propToAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, RangeBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RangeBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'RangeBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropFromAsString, value.FromAsString, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); + writer.WriteProperty(options, PropToAsString, value.ToAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(RangeBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RangeBucketConverter))] public sealed partial class RangeBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RangeBucket(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public RangeBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RangeBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RangeBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public double? From { get; init; } - public string? FromAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public double? From { get; set; } + public string? FromAsString { get; set; } /// /// /// The bucket key. Present if the aggregation is not keyed /// /// - public string? Key { get; init; } - public double? To { get; init; } - public string? ToAsString { get; init; } + public string? Key { get; set; } + public double? To { get; set; } + public string? ToAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs index f5d82496329..ee863e37828 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RareTermsAggregation.g.cs @@ -17,24 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class RareTermsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocCount = System.Text.Json.JsonEncodedText.Encode("max_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExclude = default; + LocalJsonValue propField = default; + LocalJsonValue propInclude = default; + LocalJsonValue propMaxDocCount = default; + LocalJsonValue propMissing = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propMaxDocCount.TryReadProperty(ref reader, options, PropMaxDocCount, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exclude = propExclude.Value, + Field = propField.Value, + Include = propInclude.Value, + MaxDocCount = propMaxDocCount.Value, + Missing = propMissing.Value, + Precision = propPrecision.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropMaxDocCount, value.MaxDocCount, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationConverter))] public sealed partial class RareTermsAggregation { +#if NET7_0_OR_GREATER + public RareTermsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public RareTermsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Terms that should be excluded from the aggregation. /// /// - [JsonInclude, JsonPropertyName("exclude")] public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } /// @@ -42,7 +147,6 @@ public sealed partial class RareTermsAggregation /// The field from which to return rare terms. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -50,7 +154,6 @@ public sealed partial class RareTermsAggregation /// Terms that should be included in the aggregation. /// /// - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } /// @@ -58,7 +161,6 @@ public sealed partial class RareTermsAggregation /// The maximum number of documents a term should appear in. /// /// - [JsonInclude, JsonPropertyName("max_doc_count")] public long? MaxDocCount { get; set; } /// @@ -67,8 +169,7 @@ public sealed partial class RareTermsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// @@ -76,50 +177,38 @@ public sealed partial class RareTermsAggregation /// Smaller precision leads to better approximation, but higher memory usage. /// /// - [JsonInclude, JsonPropertyName("precision")] public double? Precision { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public string? ValueType { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(RareTermsAggregation rareTermsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.RareTerms(rareTermsAggregation); } -public sealed partial class RareTermsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct RareTermsAggregationDescriptor { - internal RareTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation Instance { get; init; } - public RareTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RareTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private long? MaxDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private double? PrecisionValue { get; set; } - private string? ValueTypeValue { get; set; } - - /// - /// - /// Terms that should be excluded from the aggregation. - /// - /// - public RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RareTermsAggregationDescriptor() { - ExcludeValue = exclude; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field from which to return rare terms. + /// Terms that should be excluded from the aggregation. /// /// - public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - FieldValue = field; - return Self; + Instance.Exclude = value; + return this; } /// @@ -127,10 +216,10 @@ public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticse /// The field from which to return rare terms. /// /// - public RareTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -138,10 +227,10 @@ public RareTermsAggregationDescriptor Field(Expression /// - public RareTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -149,10 +238,10 @@ public RareTermsAggregationDescriptor Field(Expression /// - public RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -160,10 +249,10 @@ public RareTermsAggregationDescriptor Include(Elastic.Clients.Elastic /// The maximum number of documents a term should appear in. /// /// - public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor MaxDocCount(long? value) { - MaxDocCountValue = maxDocCount; - return Self; + Instance.MaxDocCount = value; + return this; } /// @@ -172,10 +261,10 @@ public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) /// By default, documents without a value are ignored. /// /// - public RareTermsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -184,103 +273,60 @@ public RareTermsAggregationDescriptor Missing(Elastic.Clients.Elastic /// Smaller precision leads to better approximation, but higher memory usage. /// /// - public RareTermsAggregationDescriptor Precision(double? precision) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Precision(double? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } - public RareTermsAggregationDescriptor ValueType(string? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor ValueType(string? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (MaxDocCountValue.HasValue) - { - writer.WritePropertyName("max_doc_count"); - writer.WriteNumberValue(MaxDocCountValue.Value); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (!string.IsNullOrEmpty(ValueTypeValue)) + if (action is null) { - writer.WritePropertyName("value_type"); - writer.WriteStringValue(ValueTypeValue); + return new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RareTermsAggregationDescriptor : SerializableDescriptor +public readonly partial struct RareTermsAggregationDescriptor { - internal RareTermsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation Instance { get; init; } - public RareTermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RareTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private long? MaxDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private double? PrecisionValue { get; set; } - private string? ValueTypeValue { get; set; } - - /// - /// - /// Terms that should be excluded from the aggregation. - /// - /// - public RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RareTermsAggregationDescriptor() { - ExcludeValue = exclude; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field from which to return rare terms. + /// Terms that should be excluded from the aggregation. /// /// - public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - FieldValue = field; - return Self; + Instance.Exclude = value; + return this; } /// @@ -288,10 +334,10 @@ public RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? /// The field from which to return rare terms. /// /// - public RareTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -299,10 +345,10 @@ public RareTermsAggregationDescriptor Field(Expression /// - public RareTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -310,10 +356,10 @@ public RareTermsAggregationDescriptor Field(Expression /// - public RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -321,10 +367,10 @@ public RareTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggr /// The maximum number of documents a term should appear in. /// /// - public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor MaxDocCount(long? value) { - MaxDocCountValue = maxDocCount; - return Self; + Instance.MaxDocCount = value; + return this; } /// @@ -333,10 +379,10 @@ public RareTermsAggregationDescriptor MaxDocCount(long? maxDocCount) /// By default, documents without a value are ignored. /// /// - public RareTermsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -345,63 +391,28 @@ public RareTermsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Fiel /// Smaller precision leads to better approximation, but higher memory usage. /// /// - public RareTermsAggregationDescriptor Precision(double? precision) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor Precision(double? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } - public RareTermsAggregationDescriptor ValueType(string? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor ValueType(string? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (MaxDocCountValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_doc_count"); - writer.WriteNumberValue(MaxDocCountValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (PrecisionValue.HasValue) - { - writer.WritePropertyName("precision"); - writer.WriteNumberValue(PrecisionValue.Value); - } - - if (!string.IsNullOrEmpty(ValueTypeValue)) - { - writer.WritePropertyName("value_type"); - writer.WriteStringValue(ValueTypeValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RareTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregate.g.cs index 4718e6f1823..b0262a1f9ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregate.g.cs @@ -17,22 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class RateAggregate : IAggregate +internal sealed partial class RateAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RateAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RateAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RateAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RateAggregateConverter))] +public sealed partial class RateAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("value")] - public double Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateAggregate(double value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public RateAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RateAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RateAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "rate"; + + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs index b2523611ade..3cfa8419e4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RateAggregation.g.cs @@ -17,26 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class RateAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropUnit = System.Text.Json.JsonEncodedText.Encode("unit"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RateAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propMode = default; + LocalJsonValue propScript = default; + LocalJsonValue propUnit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propUnit.TryReadProperty(ref reader, options, PropUnit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Mode = propMode.Value, + Script = propScript.Value, + Unit = propUnit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RateAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropUnit, value.Unit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RateAggregationConverter))] public sealed partial class RateAggregation { +#if NET7_0_OR_GREATER + public RateAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public RateAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,17 +140,14 @@ public sealed partial class RateAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// /// How the rate is calculated. /// /// - [JsonInclude, JsonPropertyName("mode")] public Elastic.Clients.Elasticsearch.Aggregations.RateMode? Mode { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -64,49 +156,37 @@ public sealed partial class RateAggregation /// By default, the interval of the date_histogram is used. /// /// - [JsonInclude, JsonPropertyName("unit")] public Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? Unit { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(RateAggregation rateAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Rate(rateAggregation); } -public sealed partial class RateAggregationDescriptor : SerializableDescriptor> +public readonly partial struct RateAggregationDescriptor { - internal RateAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RateAggregation Instance { get; init; } - public RateAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.RateMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? UnitValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public RateAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public RateAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -114,16 +194,16 @@ public RateAggregationDescriptor Field(Expression /// - public RateAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RateAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -132,10 +212,10 @@ public RateAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public RateAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -143,34 +223,28 @@ public RateAggregationDescriptor Missing(Elastic.Clients.Elasticsearc /// How the rate is calculated. /// /// - public RateAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.Aggregations.RateMode? mode) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.Aggregations.RateMode? value) { - ModeValue = mode; - return Self; + Instance.Mode = value; + return this; } - public RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public RateAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -179,102 +253,54 @@ public RateAggregationDescriptor Script(Actiondate_histogram is used. /// /// - public RateAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? unit) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? value) { - UnitValue = unit; - return Self; + Instance.Unit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RateAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (UnitValue is not null) + if (action is null) { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RateAggregationDescriptor : SerializableDescriptor +public readonly partial struct RateAggregationDescriptor { - internal RateAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.RateAggregation Instance { get; init; } - public RateAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.RateMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? UnitValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public RateAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.RateAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public RateAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -282,16 +308,16 @@ public RateAggregationDescriptor Field(Expression /// - public RateAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RateAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -300,10 +326,10 @@ public RateAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public RateAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -311,34 +337,28 @@ public RateAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValu /// How the rate is calculated. /// /// - public RateAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.Aggregations.RateMode? mode) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Mode(Elastic.Clients.Elasticsearch.Aggregations.RateMode? value) { - ModeValue = mode; - return Self; + Instance.Mode = value; + return this; } - public RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public RateAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public RateAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -347,61 +367,22 @@ public RateAggregationDescriptor Script(Actiondate_histogram is used. /// /// - public RateAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? unit) + public Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor Unit(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval? value) { - UnitValue = unit; - return Self; + Instance.Unit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.RateAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (UnitValue is not null) - { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.RateAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.RateAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregate.g.cs index ec6aff078dd..5ff0264a2df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class ReverseNestedAggregateConverter : JsonConverter +internal sealed partial class ReverseNestedAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override ReverseNestedAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new ReverseNestedAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, ReverseNestedAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ReverseNestedAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(ReverseNestedAggregateConverter))] -public sealed partial class ReverseNestedAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregateConverter))] +public sealed partial class ReverseNestedAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseNestedAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public ReverseNestedAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReverseNestedAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReverseNestedAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "reverse_nested"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs index 3f9755d0878..0e4a027ed2e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ReverseNestedAggregation.g.cs @@ -17,62 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ReverseNestedAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Path = propPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationConverter))] public sealed partial class ReverseNestedAggregation { +#if NET7_0_OR_GREATER + public ReverseNestedAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ReverseNestedAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines the nested object field that should be joined back to. /// The default is empty, which means that it joins back to the root/main document level. /// /// - [JsonInclude, JsonPropertyName("path")] public Elastic.Clients.Elasticsearch.Field? Path { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ReverseNestedAggregation reverseNestedAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ReverseNested(reverseNestedAggregation); } -public sealed partial class ReverseNestedAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ReverseNestedAggregationDescriptor { - internal ReverseNestedAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation Instance { get; init; } - public ReverseNestedAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseNestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - - /// - /// - /// Defines the nested object field that should be joined back to. - /// The default is empty, which means that it joins back to the root/main document level. - /// - /// - public ReverseNestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseNestedAggregationDescriptor() { - PathValue = path; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Defines the nested object field that should be joined back to. /// The default is empty, which means that it joins back to the root/main document level. /// /// - public ReverseNestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -81,57 +127,55 @@ public ReverseNestedAggregationDescriptor Path(Expression /// - public ReverseNestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (PathValue is not null) + if (action is null) { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ReverseNestedAggregationDescriptor : SerializableDescriptor +public readonly partial struct ReverseNestedAggregationDescriptor { - internal ReverseNestedAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation Instance { get; init; } - public ReverseNestedAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseNestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - - /// - /// - /// Defines the nested object field that should be joined back to. - /// The default is empty, which means that it joins back to the root/main document level. - /// - /// - public ReverseNestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseNestedAggregationDescriptor() { - PathValue = path; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// Defines the nested object field that should be joined back to. /// The default is empty, which means that it joins back to the root/main document level. /// /// - public ReverseNestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -140,21 +184,22 @@ public ReverseNestedAggregationDescriptor Path(Expression /// - public ReverseNestedAggregationDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (PathValue is not null) + if (action is null) { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ReverseNestedAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregate.g.cs index 422f7d9a8df..17360a67ea0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class SamplerAggregateConverter : JsonConverter +internal sealed partial class SamplerAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override SamplerAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new SamplerAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, SamplerAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'SamplerAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(SamplerAggregateConverter))] -public sealed partial class SamplerAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregateConverter))] +public sealed partial class SamplerAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamplerAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public SamplerAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SamplerAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamplerAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "sampler"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs index 3b92cce5ee1..b500b619b60 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SamplerAggregation.g.cs @@ -17,59 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SamplerAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propShardSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ShardSize = propShardSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationConverter))] public sealed partial class SamplerAggregation { +#if NET7_0_OR_GREATER + public SamplerAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SamplerAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Limits how many top-scoring documents are collected in the sample processed on each shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SamplerAggregation samplerAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Sampler(samplerAggregation); } -public sealed partial class SamplerAggregationDescriptor : SerializableDescriptor +public readonly partial struct SamplerAggregationDescriptor { - internal SamplerAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation instance) + { + Instance = instance; + } - public SamplerAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SamplerAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? ShardSizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Limits how many top-scoring documents are collected in the sample processed on each shard. /// /// - public SamplerAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (ShardSizeValue.HasValue) + if (action is null) { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs index 13f6b118172..a39deb092f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedHeuristic.g.cs @@ -17,77 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ScriptedHeuristicConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicConverter))] public sealed partial class ScriptedHeuristic { - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedHeuristic(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptedHeuristic() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptedHeuristic() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptedHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class ScriptedHeuristicDescriptor : SerializableDescriptor +public readonly partial struct ScriptedHeuristicDescriptor { - internal ScriptedHeuristicDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic Instance { get; init; } - public ScriptedHeuristicDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - public ScriptedHeuristicDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedHeuristicDescriptor() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ScriptedHeuristicDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic instance) => new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public ScriptedHeuristicDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor Script(System.Action? action) { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregate.g.cs index 64ca2bf26ce..c0ae4d8aa0a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class ScriptedMetricAggregate : IAggregate +internal sealed partial class ScriptedMetricAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("value")] - public object Value { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregateConverter))] +public sealed partial class ScriptedMetricAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedMetricAggregate(object value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public ScriptedMetricAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptedMetricAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptedMetricAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "scripted_metric"; + + public +#if NET7_0_OR_GREATER + required +#endif + object Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs index ef63f9aebf7..0bdcde4cb59 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ScriptedMetricAggregation.g.cs @@ -17,25 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ScriptedMetricAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCombineScript = System.Text.Json.JsonEncodedText.Encode("combine_script"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInitScript = System.Text.Json.JsonEncodedText.Encode("init_script"); + private static readonly System.Text.Json.JsonEncodedText PropMapScript = System.Text.Json.JsonEncodedText.Encode("map_script"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropReduceScript = System.Text.Json.JsonEncodedText.Encode("reduce_script"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCombineScript = default; + LocalJsonValue propField = default; + LocalJsonValue propInitScript = default; + LocalJsonValue propMapScript = default; + LocalJsonValue propMissing = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propReduceScript = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCombineScript.TryReadProperty(ref reader, options, PropCombineScript, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInitScript.TryReadProperty(ref reader, options, PropInitScript, null)) + { + continue; + } + + if (propMapScript.TryReadProperty(ref reader, options, PropMapScript, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propReduceScript.TryReadProperty(ref reader, options, PropReduceScript, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CombineScript = propCombineScript.Value, + Field = propField.Value, + InitScript = propInitScript.Value, + MapScript = propMapScript.Value, + Missing = propMissing.Value, + Params = propParams.Value, + ReduceScript = propReduceScript.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCombineScript, value.CombineScript, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInitScript, value.InitScript, null, null); + writer.WriteProperty(options, PropMapScript, value.MapScript, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropReduceScript, value.ReduceScript, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationConverter))] public sealed partial class ScriptedMetricAggregation { +#if NET7_0_OR_GREATER + public ScriptedMetricAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScriptedMetricAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Runs once on each shard after document collection is complete. /// Allows the aggregation to consolidate the state returned from each shard. /// /// - [JsonInclude, JsonPropertyName("combine_script")] public Elastic.Clients.Elasticsearch.Script? CombineScript { get; set; } /// @@ -43,7 +157,6 @@ public sealed partial class ScriptedMetricAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -52,7 +165,6 @@ public sealed partial class ScriptedMetricAggregation /// Allows the aggregation to set up any initial state. /// /// - [JsonInclude, JsonPropertyName("init_script")] public Elastic.Clients.Elasticsearch.Script? InitScript { get; set; } /// @@ -61,7 +173,6 @@ public sealed partial class ScriptedMetricAggregation /// If no combine_script is specified, the resulting state needs to be stored in the state object. /// /// - [JsonInclude, JsonPropertyName("map_script")] public Elastic.Clients.Elasticsearch.Script? MapScript { get; set; } /// @@ -70,8 +181,7 @@ public sealed partial class ScriptedMetricAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } + public object? Missing { get; set; } /// /// @@ -79,8 +189,7 @@ public sealed partial class ScriptedMetricAggregation /// It is shared between the scripts. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// @@ -88,40 +197,28 @@ public sealed partial class ScriptedMetricAggregation /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. /// /// - [JsonInclude, JsonPropertyName("reduce_script")] public Elastic.Clients.Elasticsearch.Script? ReduceScript { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ScriptedMetricAggregation scriptedMetricAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ScriptedMetric(scriptedMetricAggregation); } -public sealed partial class ScriptedMetricAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ScriptedMetricAggregationDescriptor { - internal ScriptedMetricAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedMetricAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation instance) + { + Instance = instance; + } - public ScriptedMetricAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedMetricAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Script? CombineScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor CombineScriptDescriptor { get; set; } - private Action CombineScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? InitScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor InitScriptDescriptor { get; set; } - private Action InitScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? MapScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor MapScriptDescriptor { get; set; } - private Action MapScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ReduceScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ReduceScriptDescriptor { get; set; } - private Action ReduceScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -129,39 +226,34 @@ public ScriptedMetricAggregationDescriptor() : base() /// Allows the aggregation to consolidate the state returned from each shard. /// /// - public ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.Script? combineScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.Script? value) { - CombineScriptDescriptor = null; - CombineScriptDescriptorAction = null; - CombineScriptValue = combineScript; - return Self; + Instance.CombineScript = value; + return this; } - public ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) - { - CombineScriptValue = null; - CombineScriptDescriptorAction = null; - CombineScriptDescriptor = descriptor; - return Self; - } - - public ScriptedMetricAggregationDescriptor CombineScript(Action configure) + /// + /// + /// Runs once on each shard after document collection is complete. + /// Allows the aggregation to consolidate the state returned from each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript() { - CombineScriptValue = null; - CombineScriptDescriptor = null; - CombineScriptDescriptorAction = configure; - return Self; + Instance.CombineScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// The field on which to run the aggregation. + /// Runs once on each shard after document collection is complete. + /// Allows the aggregation to consolidate the state returned from each shard. /// /// - public ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript(System.Action? action) { - FieldValue = field; - return Self; + Instance.CombineScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -169,10 +261,10 @@ public ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elas /// The field on which to run the aggregation. /// /// - public ScriptedMetricAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -180,10 +272,10 @@ public ScriptedMetricAggregationDescriptor Field(Expression /// - public ScriptedMetricAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -192,28 +284,34 @@ public ScriptedMetricAggregationDescriptor Field(Expression /// - public ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.Script? initScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.Script? value) { - InitScriptDescriptor = null; - InitScriptDescriptorAction = null; - InitScriptValue = initScript; - return Self; + Instance.InitScript = value; + return this; } - public ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Runs prior to any collection of documents. + /// Allows the aggregation to set up any initial state. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript() { - InitScriptValue = null; - InitScriptDescriptorAction = null; - InitScriptDescriptor = descriptor; - return Self; + Instance.InitScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor InitScript(Action configure) + /// + /// + /// Runs prior to any collection of documents. + /// Allows the aggregation to set up any initial state. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript(System.Action? action) { - InitScriptValue = null; - InitScriptDescriptor = null; - InitScriptDescriptorAction = configure; - return Self; + Instance.InitScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -222,28 +320,34 @@ public ScriptedMetricAggregationDescriptor InitScript(Actioncombine_script is specified, the resulting state needs to be stored in the state object. /// /// - public ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.Script? mapScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.Script? value) { - MapScriptDescriptor = null; - MapScriptDescriptorAction = null; - MapScriptValue = mapScript; - return Self; + Instance.MapScript = value; + return this; } - public ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Run once per document collected. + /// If no combine_script is specified, the resulting state needs to be stored in the state object. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript() { - MapScriptValue = null; - MapScriptDescriptorAction = null; - MapScriptDescriptor = descriptor; - return Self; + Instance.MapScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor MapScript(Action configure) + /// + /// + /// Run once per document collected. + /// If no combine_script is specified, the resulting state needs to be stored in the state object. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript(System.Action? action) { - MapScriptValue = null; - MapScriptDescriptor = null; - MapScriptDescriptorAction = configure; - return Self; + Instance.MapScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -252,10 +356,10 @@ public ScriptedMetricAggregationDescriptor MapScript(Action /// - public ScriptedMetricAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -264,197 +368,129 @@ public ScriptedMetricAggregationDescriptor Missing(Elastic.Clients.El /// It is shared between the scripts. /// /// - public ScriptedMetricAggregationDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// Runs once on the coordinating node after all shards have returned their results. - /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// A global object with script parameters for init, map and combine scripts. + /// It is shared between the scripts. /// /// - public ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.Script? reduceScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params() { - ReduceScriptDescriptor = null; - ReduceScriptDescriptorAction = null; - ReduceScriptValue = reduceScript; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// A global object with script parameters for init, map and combine scripts. + /// It is shared between the scripts. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params(System.Action? action) { - ReduceScriptValue = null; - ReduceScriptDescriptorAction = null; - ReduceScriptDescriptor = descriptor; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public ScriptedMetricAggregationDescriptor ReduceScript(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor AddParam(string key, object value) { - ReduceScriptValue = null; - ReduceScriptDescriptor = null; - ReduceScriptDescriptorAction = configure; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.ReduceScript = value; + return this; } - public ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.ReduceScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor Script(Action configure) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.ReduceScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - writer.WriteStartObject(); - if (CombineScriptDescriptor is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, CombineScriptDescriptor, options); - } - else if (CombineScriptDescriptorAction is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(CombineScriptDescriptorAction), options); - } - else if (CombineScriptValue is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, CombineScriptValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (InitScriptDescriptor is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, InitScriptDescriptor, options); - } - else if (InitScriptDescriptorAction is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(InitScriptDescriptorAction), options); - } - else if (InitScriptValue is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, InitScriptValue, options); - } - - if (MapScriptDescriptor is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, MapScriptDescriptor, options); - } - else if (MapScriptDescriptorAction is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(MapScriptDescriptorAction), options); - } - else if (MapScriptValue is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, MapScriptValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + Instance.Script = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (ReduceScriptDescriptor is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, ReduceScriptDescriptor, options); - } - else if (ReduceScriptDescriptorAction is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ReduceScriptDescriptorAction), options); - } - else if (ReduceScriptValue is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, ReduceScriptValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ScriptedMetricAggregationDescriptor : SerializableDescriptor +public readonly partial struct ScriptedMetricAggregationDescriptor { - internal ScriptedMetricAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation Instance { get; init; } - public ScriptedMetricAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedMetricAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? CombineScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor CombineScriptDescriptor { get; set; } - private Action CombineScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? InitScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor InitScriptDescriptor { get; set; } - private Action InitScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? MapScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor MapScriptDescriptor { get; set; } - private Action MapScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ReduceScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ReduceScriptDescriptor { get; set; } - private Action ReduceScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptedMetricAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor descriptor) => descriptor.Instance; /// /// @@ -462,39 +498,34 @@ public ScriptedMetricAggregationDescriptor() : base() /// Allows the aggregation to consolidate the state returned from each shard. /// /// - public ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.Script? combineScript) - { - CombineScriptDescriptor = null; - CombineScriptDescriptorAction = null; - CombineScriptValue = combineScript; - return Self; - } - - public ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript(Elastic.Clients.Elasticsearch.Script? value) { - CombineScriptValue = null; - CombineScriptDescriptorAction = null; - CombineScriptDescriptor = descriptor; - return Self; + Instance.CombineScript = value; + return this; } - public ScriptedMetricAggregationDescriptor CombineScript(Action configure) + /// + /// + /// Runs once on each shard after document collection is complete. + /// Allows the aggregation to consolidate the state returned from each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript() { - CombineScriptValue = null; - CombineScriptDescriptor = null; - CombineScriptDescriptorAction = configure; - return Self; + Instance.CombineScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// The field on which to run the aggregation. + /// Runs once on each shard after document collection is complete. + /// Allows the aggregation to consolidate the state returned from each shard. /// /// - public ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor CombineScript(System.Action? action) { - FieldValue = field; - return Self; + Instance.CombineScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -502,10 +533,10 @@ public ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elasticsearch.F /// The field on which to run the aggregation. /// /// - public ScriptedMetricAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -513,10 +544,10 @@ public ScriptedMetricAggregationDescriptor Field(Expression /// - public ScriptedMetricAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -525,28 +556,34 @@ public ScriptedMetricAggregationDescriptor Field(Expression /// - public ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.Script? initScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.Script? value) { - InitScriptDescriptor = null; - InitScriptDescriptorAction = null; - InitScriptValue = initScript; - return Self; + Instance.InitScript = value; + return this; } - public ScriptedMetricAggregationDescriptor InitScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Runs prior to any collection of documents. + /// Allows the aggregation to set up any initial state. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript() { - InitScriptValue = null; - InitScriptDescriptorAction = null; - InitScriptDescriptor = descriptor; - return Self; + Instance.InitScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor InitScript(Action configure) + /// + /// + /// Runs prior to any collection of documents. + /// Allows the aggregation to set up any initial state. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor InitScript(System.Action? action) { - InitScriptValue = null; - InitScriptDescriptor = null; - InitScriptDescriptorAction = configure; - return Self; + Instance.InitScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -555,28 +592,34 @@ public ScriptedMetricAggregationDescriptor InitScript(Actioncombine_script is specified, the resulting state needs to be stored in the state object. /// /// - public ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.Script? mapScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.Script? value) { - MapScriptDescriptor = null; - MapScriptDescriptorAction = null; - MapScriptValue = mapScript; - return Self; + Instance.MapScript = value; + return this; } - public ScriptedMetricAggregationDescriptor MapScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Run once per document collected. + /// If no combine_script is specified, the resulting state needs to be stored in the state object. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript() { - MapScriptValue = null; - MapScriptDescriptorAction = null; - MapScriptDescriptor = descriptor; - return Self; + Instance.MapScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor MapScript(Action configure) + /// + /// + /// Run once per document collected. + /// If no combine_script is specified, the resulting state needs to be stored in the state object. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor MapScript(System.Action? action) { - MapScriptValue = null; - MapScriptDescriptor = null; - MapScriptDescriptorAction = configure; - return Self; + Instance.MapScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -585,10 +628,10 @@ public ScriptedMetricAggregationDescriptor MapScript(Action /// - public ScriptedMetricAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -597,167 +640,107 @@ public ScriptedMetricAggregationDescriptor Missing(Elastic.Clients.Elasticsearch /// It is shared between the scripts. /// /// - public ScriptedMetricAggregationDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// Runs once on the coordinating node after all shards have returned their results. - /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// A global object with script parameters for init, map and combine scripts. + /// It is shared between the scripts. /// /// - public ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.Script? reduceScript) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params() { - ReduceScriptDescriptor = null; - ReduceScriptDescriptorAction = null; - ReduceScriptValue = reduceScript; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// A global object with script parameters for init, map and combine scripts. + /// It is shared between the scripts. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Params(System.Action? action) { - ReduceScriptValue = null; - ReduceScriptDescriptorAction = null; - ReduceScriptDescriptor = descriptor; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public ScriptedMetricAggregationDescriptor ReduceScript(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor AddParam(string key, object value) { - ReduceScriptValue = null; - ReduceScriptDescriptor = null; - ReduceScriptDescriptorAction = configure; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.ReduceScript = value; + return this; } - public ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.ReduceScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptedMetricAggregationDescriptor Script(Action configure) + /// + /// + /// Runs once on the coordinating node after all shards have returned their results. + /// The script is provided with access to a variable states, which is an array of the result of the combine_script on each shard. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor ReduceScript(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.ReduceScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - writer.WriteStartObject(); - if (CombineScriptDescriptor is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, CombineScriptDescriptor, options); - } - else if (CombineScriptDescriptorAction is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(CombineScriptDescriptorAction), options); - } - else if (CombineScriptValue is not null) - { - writer.WritePropertyName("combine_script"); - JsonSerializer.Serialize(writer, CombineScriptValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (InitScriptDescriptor is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, InitScriptDescriptor, options); - } - else if (InitScriptDescriptorAction is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(InitScriptDescriptorAction), options); - } - else if (InitScriptValue is not null) - { - writer.WritePropertyName("init_script"); - JsonSerializer.Serialize(writer, InitScriptValue, options); - } - - if (MapScriptDescriptor is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, MapScriptDescriptor, options); - } - else if (MapScriptDescriptorAction is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(MapScriptDescriptorAction), options); - } - else if (MapScriptValue is not null) - { - writer.WritePropertyName("map_script"); - JsonSerializer.Serialize(writer, MapScriptValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } + Instance.Script = value; + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (ReduceScriptDescriptor is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, ReduceScriptDescriptor, options); - } - else if (ReduceScriptDescriptorAction is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ReduceScriptDescriptorAction), options); - } - else if (ReduceScriptValue is not null) - { - writer.WritePropertyName("reduce_script"); - JsonSerializer.Serialize(writer, ReduceScriptValue, options); - } + public Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ScriptedMetricAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SerialDifferencingAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SerialDifferencingAggregation.g.cs index 1d825be30c2..d1efae4908b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SerialDifferencingAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SerialDifferencingAggregation.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SerialDifferencingAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + private static readonly System.Text.Json.JsonEncodedText PropLag = System.Text.Json.JsonEncodedText.Encode("lag"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + LocalJsonValue propLag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (propLag.TryReadProperty(ref reader, options, PropLag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value, + Lag = propLag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteProperty(options, PropLag, value.Lag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationConverter))] public sealed partial class SerialDifferencingAggregation { +#if NET7_0_OR_GREATER + public SerialDifferencingAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SerialDifferencingAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +121,6 @@ public sealed partial class SerialDifferencingAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class SerialDifferencingAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } /// @@ -60,34 +136,37 @@ public sealed partial class SerialDifferencingAggregation /// Must be a positive, non-zero integer. /// /// - [JsonInclude, JsonPropertyName("lag")] public int? Lag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SerialDifferencingAggregation serialDifferencingAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.SerialDiff(serialDifferencingAggregation); } -public sealed partial class SerialDifferencingAggregationDescriptor : SerializableDescriptor +public readonly partial struct SerialDifferencingAggregationDescriptor { - internal SerialDifferencingAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation Instance { get; init; } - public SerialDifferencingAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SerialDifferencingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } - private int? LagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SerialDifferencingAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public SerialDifferencingAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -96,10 +175,10 @@ public SerialDifferencingAggregationDescriptor BucketsPath(Elastic.Clients.Elast /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public SerialDifferencingAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -107,10 +186,10 @@ public SerialDifferencingAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public SerialDifferencingAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } /// @@ -119,39 +198,22 @@ public SerialDifferencingAggregationDescriptor GapPolicy(Elastic.Clients.Elastic /// Must be a positive, non-zero integer. /// /// - public SerialDifferencingAggregationDescriptor Lag(int? lag) + public Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor Lag(int? value) { - LagValue = lag; - return Self; + Instance.Lag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) + if (action is null) { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - if (LagValue.HasValue) - { - writer.WritePropertyName("lag"); - writer.WriteNumberValue(LagValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SerialDifferencingAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsAggregate.g.cs index 04c561fc339..f768fc35906 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsAggregate.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class SignificantLongTermsAggregate : IAggregate +internal sealed partial class SignificantLongTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBgCount = System.Text.Json.JsonEncodedText.Encode("bg_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBgCount = default; + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBgCount.TryReadProperty(ref reader, options, PropBgCount, null)) + { + continue; + } + + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BgCount = propBgCount.Value, + Buckets = propBuckets.Value, + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBgCount, value.BgCount, null, null); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsAggregateConverter))] +public sealed partial class SignificantLongTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("bg_count")] - public long? BgCount { get; init; } - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count")] - public long? DocCount { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantLongTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public SignificantLongTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SignificantLongTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantLongTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? BgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "siglterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsBucket.g.cs index bc249c8d098..08f79c017bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantLongTermsBucket.g.cs @@ -17,95 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class SignificantLongTermsBucketConverter : JsonConverter +internal sealed partial class SignificantLongTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override SignificantLongTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBgCount = System.Text.Json.JsonEncodedText.Encode("bg_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long bgCount = default; - long docCount = default; - long key = default; - string? keyAsString = default; - double score = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propBgCount = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + LocalJsonValue propScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBgCount.TryReadProperty(ref reader, options, PropBgCount, null)) { - var property = reader.GetString(); - if (property == "bg_count") - { - bgCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } - if (property == "score") - { - score = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new SignificantLongTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), BgCount = bgCount, DocCount = docCount, Key = key, KeyAsString = keyAsString, Score = score }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + BgCount = propBgCount.Value, + DocCount = propDocCount.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value, + Score = propScore.Value + }; } - public override void Write(Utf8JsonWriter writer, SignificantLongTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'SignificantLongTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBgCount, value.BgCount, null, null); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(SignificantLongTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantLongTermsBucketConverter))] public sealed partial class SignificantLongTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantLongTermsBucket(long bgCount, long docCount, long key, double score) + { + BgCount = bgCount; + DocCount = docCount; + Key = key; + Score = score; + } +#if NET7_0_OR_GREATER + public SignificantLongTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SignificantLongTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantLongTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long BgCount { get; init; } - public long DocCount { get; init; } - public long Key { get; init; } - public string? KeyAsString { get; init; } - public double Score { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Key { get; set; } + public string? KeyAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Score { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs index e2e799a941e..9b3cd774d6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsAggregate.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class SignificantStringTermsAggregate : IAggregate +internal sealed partial class SignificantStringTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBgCount = System.Text.Json.JsonEncodedText.Encode("bg_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBgCount = default; + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBgCount.TryReadProperty(ref reader, options, PropBgCount, null)) + { + continue; + } + + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BgCount = propBgCount.Value, + Buckets = propBuckets.Value, + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBgCount, value.BgCount, null, null); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsAggregateConverter))] +public sealed partial class SignificantStringTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("bg_count")] - public long? BgCount { get; init; } - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count")] - public long? DocCount { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantStringTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public SignificantStringTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SignificantStringTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantStringTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? BgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "sigsterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs index 557a647c326..38877eda609 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantStringTermsBucket.g.cs @@ -17,87 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class SignificantStringTermsBucketConverter : JsonConverter +internal sealed partial class SignificantStringTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override SignificantStringTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBgCount = System.Text.Json.JsonEncodedText.Encode("bg_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long bgCount = default; - long docCount = default; - string key = default; - double score = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propBgCount = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBgCount.TryReadProperty(ref reader, options, PropBgCount, null)) { - var property = reader.GetString(); - if (property == "bg_count") - { - bgCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "score") - { - score = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new SignificantStringTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), BgCount = bgCount, DocCount = docCount, Key = key, Score = score }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + BgCount = propBgCount.Value, + DocCount = propDocCount.Value, + Key = propKey.Value, + Score = propScore.Value + }; } - public override void Write(Utf8JsonWriter writer, SignificantStringTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'SignificantStringTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBgCount, value.BgCount, null, null); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(SignificantStringTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantStringTermsBucketConverter))] public sealed partial class SignificantStringTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantStringTermsBucket(long bgCount, long docCount, string key, double score) + { + BgCount = bgCount; + DocCount = docCount; + Key = key; + Score = score; + } +#if NET7_0_OR_GREATER + public SignificantStringTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SignificantStringTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantStringTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long BgCount { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } - public double Score { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Score { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs index 5f4223ea8a1..edb944fbeaa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTermsAggregation.g.cs @@ -17,24 +17,201 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SignificantTermsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackgroundFilter = System.Text.Json.JsonEncodedText.Encode("background_filter"); + private static readonly System.Text.Json.JsonEncodedText PropChiSquare = System.Text.Json.JsonEncodedText.Encode("chi_square"); + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropExecutionHint = System.Text.Json.JsonEncodedText.Encode("execution_hint"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropGnd = System.Text.Json.JsonEncodedText.Encode("gnd"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropJlh = System.Text.Json.JsonEncodedText.Encode("jlh"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMutualInformation = System.Text.Json.JsonEncodedText.Encode("mutual_information"); + private static readonly System.Text.Json.JsonEncodedText PropPercentage = System.Text.Json.JsonEncodedText.Encode("percentage"); + private static readonly System.Text.Json.JsonEncodedText PropScriptHeuristic = System.Text.Json.JsonEncodedText.Encode("script_heuristic"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackgroundFilter = default; + LocalJsonValue propChiSquare = default; + LocalJsonValue propExclude = default; + LocalJsonValue propExecutionHint = default; + LocalJsonValue propField = default; + LocalJsonValue propGnd = default; + LocalJsonValue propInclude = default; + LocalJsonValue propJlh = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propMutualInformation = default; + LocalJsonValue propPercentage = default; + LocalJsonValue propScriptHeuristic = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackgroundFilter.TryReadProperty(ref reader, options, PropBackgroundFilter, null)) + { + continue; + } + + if (propChiSquare.TryReadProperty(ref reader, options, PropChiSquare, null)) + { + continue; + } + + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propExecutionHint.TryReadProperty(ref reader, options, PropExecutionHint, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propGnd.TryReadProperty(ref reader, options, PropGnd, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propJlh.TryReadProperty(ref reader, options, PropJlh, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propMutualInformation.TryReadProperty(ref reader, options, PropMutualInformation, null)) + { + continue; + } + + if (propPercentage.TryReadProperty(ref reader, options, PropPercentage, null)) + { + continue; + } + + if (propScriptHeuristic.TryReadProperty(ref reader, options, PropScriptHeuristic, null)) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackgroundFilter = propBackgroundFilter.Value, + ChiSquare = propChiSquare.Value, + Exclude = propExclude.Value, + ExecutionHint = propExecutionHint.Value, + Field = propField.Value, + Gnd = propGnd.Value, + Include = propInclude.Value, + Jlh = propJlh.Value, + MinDocCount = propMinDocCount.Value, + MutualInformation = propMutualInformation.Value, + Percentage = propPercentage.Value, + ScriptHeuristic = propScriptHeuristic.Value, + ShardMinDocCount = propShardMinDocCount.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackgroundFilter, value.BackgroundFilter, null, null); + writer.WriteProperty(options, PropChiSquare, value.ChiSquare, null, null); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropExecutionHint, value.ExecutionHint, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropGnd, value.Gnd, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropJlh, value.Jlh, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropMutualInformation, value.MutualInformation, null, null); + writer.WriteProperty(options, PropPercentage, value.Percentage, null, null); + writer.WriteProperty(options, PropScriptHeuristic, value.ScriptHeuristic, null, null); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationConverter))] public sealed partial class SignificantTermsAggregation { +#if NET7_0_OR_GREATER + public SignificantTermsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SignificantTermsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - [JsonInclude, JsonPropertyName("background_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilter { get; set; } /// @@ -42,7 +219,6 @@ public sealed partial class SignificantTermsAggregation /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. /// /// - [JsonInclude, JsonPropertyName("chi_square")] public Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquare { get; set; } /// @@ -50,7 +226,6 @@ public sealed partial class SignificantTermsAggregation /// Terms to exclude. /// /// - [JsonInclude, JsonPropertyName("exclude")] public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } /// @@ -58,7 +233,6 @@ public sealed partial class SignificantTermsAggregation /// Mechanism by which the aggregation should be executed: using field values directly or using global ordinals. /// /// - [JsonInclude, JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHint { get; set; } /// @@ -66,7 +240,6 @@ public sealed partial class SignificantTermsAggregation /// The field from which to return significant terms. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -74,7 +247,6 @@ public sealed partial class SignificantTermsAggregation /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - [JsonInclude, JsonPropertyName("gnd")] public Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? Gnd { get; set; } /// @@ -82,7 +254,6 @@ public sealed partial class SignificantTermsAggregation /// Terms to include. /// /// - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } /// @@ -90,7 +261,6 @@ public sealed partial class SignificantTermsAggregation /// Use JLH score as the significance score. /// /// - [JsonInclude, JsonPropertyName("jlh")] public Elastic.Clients.Elasticsearch.EmptyObject? Jlh { get; set; } /// @@ -98,7 +268,6 @@ public sealed partial class SignificantTermsAggregation /// Only return terms that are found in more than min_doc_count hits. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public long? MinDocCount { get; set; } /// @@ -106,7 +275,6 @@ public sealed partial class SignificantTermsAggregation /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - [JsonInclude, JsonPropertyName("mutual_information")] public Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformation { get; set; } /// @@ -114,7 +282,6 @@ public sealed partial class SignificantTermsAggregation /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. /// /// - [JsonInclude, JsonPropertyName("percentage")] public Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? Percentage { get; set; } /// @@ -122,7 +289,6 @@ public sealed partial class SignificantTermsAggregation /// Customized score, implemented via a script. /// /// - [JsonInclude, JsonPropertyName("script_heuristic")] public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristic { get; set; } /// @@ -131,7 +297,6 @@ public sealed partial class SignificantTermsAggregation /// Terms will only be considered if their local shard frequency within the set is higher than the shard_min_doc_count. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public long? ShardMinDocCount { get; set; } /// @@ -140,7 +305,6 @@ public sealed partial class SignificantTermsAggregation /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -148,106 +312,70 @@ public sealed partial class SignificantTermsAggregation /// The number of buckets returned out of the overall terms list. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SignificantTermsAggregation significantTermsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.SignificantTerms(significantTermsAggregation); } -public sealed partial class SignificantTermsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct SignificantTermsAggregationDescriptor { - internal SignificantTermsAggregationDescriptor(Action> configure) => configure.Invoke(this); - - public SignificantTermsAggregationDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } - private Action> BackgroundFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } - private Action ChiSquareDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } - private Action GndDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor JlhDescriptor { get; set; } - private Action JlhDescriptorAction { get; set; } - private long? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } - private Action MutualInformationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } - private Action PercentageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } - private Action ScriptHeuristicDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + internal Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation Instance { get; init; } - /// - /// - /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. - /// - /// - public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation instance) { - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterValue = backgroundFilter; - return Self; + Instance = instance; } - public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTermsAggregationDescriptor() { - BackgroundFilterValue = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SignificantTermsAggregationDescriptor BackgroundFilter(Action> configure) + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - BackgroundFilterValue = null; - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = configure; - return Self; + Instance.BackgroundFilter = value; + return this; } /// /// - /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor BackgroundFilter(System.Action> action) { - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = null; - ChiSquareValue = chiSquare; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor descriptor) + /// + /// + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? value) { - ChiSquareValue = null; - ChiSquareDescriptorAction = null; - ChiSquareDescriptor = descriptor; - return Self; + Instance.ChiSquare = value; + return this; } - public SignificantTermsAggregationDescriptor ChiSquare(Action configure) + /// + /// + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ChiSquare(System.Action action) { - ChiSquareValue = null; - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = configure; - return Self; + Instance.ChiSquare = Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor.Build(action); + return this; } /// @@ -255,10 +383,10 @@ public SignificantTermsAggregationDescriptor ChiSquare(Action /// - public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// @@ -266,10 +394,10 @@ public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients. /// Mechanism by which the aggregation should be executed: using field values directly or using global ordinals. /// /// - public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - ExecutionHintValue = executionHint; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -277,10 +405,10 @@ public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Cl /// The field from which to return significant terms. /// /// - public SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -288,21 +416,21 @@ public SignificantTermsAggregationDescriptor Field(Elastic.Clients.El /// The field from which to return significant terms. /// /// - public SignificantTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field from which to return significant terms. + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - public SignificantTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? value) { - FieldValue = field; - return Self; + Instance.Gnd = value; + return this; } /// @@ -310,28 +438,21 @@ public SignificantTermsAggregationDescriptor Field(Expression /// - public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) - { - GndDescriptor = null; - GndDescriptorAction = null; - GndValue = gnd; - return Self; - } - - public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd() { - GndValue = null; - GndDescriptorAction = null; - GndDescriptor = descriptor; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Gnd(Action configure) + /// + /// + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd(System.Action? action) { - GndValue = null; - GndDescriptor = null; - GndDescriptorAction = configure; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(action); + return this; } /// @@ -339,10 +460,10 @@ public SignificantTermsAggregationDescriptor Gnd(Action /// - public SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -350,28 +471,32 @@ public SignificantTermsAggregationDescriptor Include(Elastic.Clients. /// Use JLH score as the significance score. /// /// - public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? value) { - JlhDescriptor = null; - JlhDescriptorAction = null; - JlhValue = jlh; - return Self; + Instance.Jlh = value; + return this; } - public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh() { - JlhValue = null; - JlhDescriptorAction = null; - JlhDescriptor = descriptor; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Jlh(Action configure) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh(System.Action? action) { - JlhValue = null; - JlhDescriptor = null; - JlhDescriptorAction = configure; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -379,10 +504,10 @@ public SignificantTermsAggregationDescriptor Jlh(Actionmin_doc_count hits. /// /// - public SignificantTermsAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -390,28 +515,32 @@ public SignificantTermsAggregationDescriptor MinDocCount(long? minDoc /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? value) { - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = null; - MutualInformationValue = mutualInformation; - return Self; + Instance.MutualInformation = value; + return this; } - public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor descriptor) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation() { - MutualInformationValue = null; - MutualInformationDescriptorAction = null; - MutualInformationDescriptor = descriptor; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor MutualInformation(Action configure) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation(System.Action? action) { - MutualInformationValue = null; - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = configure; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(action); + return this; } /// @@ -419,28 +548,32 @@ public SignificantTermsAggregationDescriptor MutualInformation(Action /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. /// /// - public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? value) { - PercentageDescriptor = null; - PercentageDescriptorAction = null; - PercentageValue = percentage; - return Self; + Instance.Percentage = value; + return this; } - public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor descriptor) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage() { - PercentageValue = null; - PercentageDescriptorAction = null; - PercentageDescriptor = descriptor; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Percentage(Action configure) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage(System.Action? action) { - PercentageValue = null; - PercentageDescriptor = null; - PercentageDescriptorAction = configure; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(action); + return this; } /// @@ -448,28 +581,21 @@ public SignificantTermsAggregationDescriptor Percentage(Action /// - public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) - { - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicValue = scriptHeuristic; - return Self; - } - - public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? value) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicDescriptor = descriptor; - return Self; + Instance.ScriptHeuristic = value; + return this; } - public SignificantTermsAggregationDescriptor ScriptHeuristic(Action configure) + /// + /// + /// Customized score, implemented via a script. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ScriptHeuristic(System.Action action) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = configure; - return Self; + Instance.ScriptHeuristic = Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor.Build(action); + return this; } /// @@ -478,10 +604,10 @@ public SignificantTermsAggregationDescriptor ScriptHeuristic(Actionshard_min_doc_count. /// /// - public SignificantTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -490,10 +616,10 @@ public SignificantTermsAggregationDescriptor ShardMinDocCount(long? s /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public SignificantTermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -501,244 +627,76 @@ public SignificantTermsAggregationDescriptor ShardSize(int? shardSize /// The number of buckets returned out of the overall terms list. /// /// - public SignificantTermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BackgroundFilterDescriptor is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); - } - else if (BackgroundFilterDescriptorAction is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); - } - else if (BackgroundFilterValue is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterValue, options); - } - - if (ChiSquareDescriptor is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); - } - else if (ChiSquareDescriptorAction is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); - } - else if (ChiSquareValue is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (GndDescriptor is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndDescriptor, options); - } - else if (GndDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); - } - else if (GndValue is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (JlhDescriptor is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhDescriptor, options); - } - else if (JlhDescriptorAction is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(JlhDescriptorAction), options); - } - else if (JlhValue is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MutualInformationDescriptor is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); - } - else if (MutualInformationDescriptorAction is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); - } - else if (MutualInformationValue is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationValue, options); - } - - if (PercentageDescriptor is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageDescriptor, options); - } - else if (PercentageDescriptorAction is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); - } - else if (PercentageValue is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptHeuristicDescriptor is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); - } - else if (ScriptHeuristicDescriptorAction is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); - } - else if (ScriptHeuristicValue is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } +public readonly partial struct SignificantTermsAggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation Instance { get; init; } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTermsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class SignificantTermsAggregationDescriptor : SerializableDescriptor -{ - internal SignificantTermsAggregationDescriptor(Action configure) => configure.Invoke(this); - - public SignificantTermsAggregationDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } - private Action BackgroundFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } - private Action ChiSquareDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } - private Action GndDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor JlhDescriptor { get; set; } - private Action JlhDescriptorAction { get; set; } - private long? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } - private Action MutualInformationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } - private Action PercentageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } - private Action ScriptHeuristicDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterValue = backgroundFilter; - return Self; + Instance.BackgroundFilter = value; + return this; } - public SignificantTermsAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor BackgroundFilter(System.Action action) { - BackgroundFilterValue = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterDescriptor = descriptor; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SignificantTermsAggregationDescriptor BackgroundFilter(Action configure) + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor BackgroundFilter(System.Action> action) { - BackgroundFilterValue = null; - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = configure; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -746,28 +704,21 @@ public SignificantTermsAggregationDescriptor BackgroundFilter(Action /// - public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) - { - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = null; - ChiSquareValue = chiSquare; - return Self; - } - - public SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? value) { - ChiSquareValue = null; - ChiSquareDescriptorAction = null; - ChiSquareDescriptor = descriptor; - return Self; + Instance.ChiSquare = value; + return this; } - public SignificantTermsAggregationDescriptor ChiSquare(Action configure) + /// + /// + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ChiSquare(System.Action action) { - ChiSquareValue = null; - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = configure; - return Self; + Instance.ChiSquare = Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor.Build(action); + return this; } /// @@ -775,10 +726,10 @@ public SignificantTermsAggregationDescriptor ChiSquare(Action /// - public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// @@ -786,10 +737,10 @@ public SignificantTermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsear /// Mechanism by which the aggregation should be executed: using field values directly or using global ordinals. /// /// - public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - ExecutionHintValue = executionHint; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -797,10 +748,10 @@ public SignificantTermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elast /// The field from which to return significant terms. /// /// - public SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -808,21 +759,21 @@ public SignificantTermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch /// The field from which to return significant terms. /// /// - public SignificantTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field from which to return significant terms. + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - public SignificantTermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? value) { - FieldValue = field; - return Self; + Instance.Gnd = value; + return this; } /// @@ -830,28 +781,21 @@ public SignificantTermsAggregationDescriptor Field(Expression /// - public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd() { - GndDescriptor = null; - GndDescriptorAction = null; - GndValue = gnd; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor descriptor) - { - GndValue = null; - GndDescriptorAction = null; - GndDescriptor = descriptor; - return Self; - } - - public SignificantTermsAggregationDescriptor Gnd(Action configure) + /// + /// + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Gnd(System.Action? action) { - GndValue = null; - GndDescriptor = null; - GndDescriptorAction = configure; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(action); + return this; } /// @@ -859,10 +803,10 @@ public SignificantTermsAggregationDescriptor Gnd(Action /// - public SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -870,28 +814,32 @@ public SignificantTermsAggregationDescriptor Include(Elastic.Clients.Elasticsear /// Use JLH score as the significance score. /// /// - public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? value) { - JlhDescriptor = null; - JlhDescriptorAction = null; - JlhValue = jlh; - return Self; + Instance.Jlh = value; + return this; } - public SignificantTermsAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh() { - JlhValue = null; - JlhDescriptorAction = null; - JlhDescriptor = descriptor; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Jlh(Action configure) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Jlh(System.Action? action) { - JlhValue = null; - JlhDescriptor = null; - JlhDescriptorAction = configure; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -899,10 +847,10 @@ public SignificantTermsAggregationDescriptor Jlh(Actionmin_doc_count hits. /// /// - public SignificantTermsAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -910,28 +858,32 @@ public SignificantTermsAggregationDescriptor MinDocCount(long? minDocCount) /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? value) { - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = null; - MutualInformationValue = mutualInformation; - return Self; + Instance.MutualInformation = value; + return this; } - public SignificantTermsAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor descriptor) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation() { - MutualInformationValue = null; - MutualInformationDescriptorAction = null; - MutualInformationDescriptor = descriptor; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor MutualInformation(Action configure) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor MutualInformation(System.Action? action) { - MutualInformationValue = null; - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = configure; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(action); + return this; } /// @@ -939,28 +891,32 @@ public SignificantTermsAggregationDescriptor MutualInformation(Action /// - public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? value) { - PercentageDescriptor = null; - PercentageDescriptorAction = null; - PercentageValue = percentage; - return Self; + Instance.Percentage = value; + return this; } - public SignificantTermsAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor descriptor) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage() { - PercentageValue = null; - PercentageDescriptorAction = null; - PercentageDescriptor = descriptor; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(null); + return this; } - public SignificantTermsAggregationDescriptor Percentage(Action configure) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Percentage(System.Action? action) { - PercentageValue = null; - PercentageDescriptor = null; - PercentageDescriptorAction = configure; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(action); + return this; } /// @@ -968,28 +924,21 @@ public SignificantTermsAggregationDescriptor Percentage(Action /// - public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? value) { - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicValue = scriptHeuristic; - return Self; + Instance.ScriptHeuristic = value; + return this; } - public SignificantTermsAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor descriptor) - { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicDescriptor = descriptor; - return Self; - } - - public SignificantTermsAggregationDescriptor ScriptHeuristic(Action configure) + /// + /// + /// Customized score, implemented via a script. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ScriptHeuristic(System.Action action) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = configure; - return Self; + Instance.ScriptHeuristic = Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor.Build(action); + return this; } /// @@ -998,10 +947,10 @@ public SignificantTermsAggregationDescriptor ScriptHeuristic(Actionshard_min_doc_count. /// /// - public SignificantTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -1010,10 +959,10 @@ public SignificantTermsAggregationDescriptor ShardMinDocCount(long? shardMinDocC /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public SignificantTermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -1021,175 +970,22 @@ public SignificantTermsAggregationDescriptor ShardSize(int? shardSize) /// The number of buckets returned out of the overall terms list. /// /// - public SignificantTermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BackgroundFilterDescriptor is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); - } - else if (BackgroundFilterDescriptorAction is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); - } - else if (BackgroundFilterValue is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterValue, options); - } - - if (ChiSquareDescriptor is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); - } - else if (ChiSquareDescriptorAction is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); - } - else if (ChiSquareValue is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GndDescriptor is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndDescriptor, options); - } - else if (GndDescriptorAction is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); - } - else if (GndValue is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (JlhDescriptor is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhDescriptor, options); - } - else if (JlhDescriptorAction is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(JlhDescriptorAction), options); - } - else if (JlhValue is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MutualInformationDescriptor is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); - } - else if (MutualInformationDescriptorAction is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); - } - else if (MutualInformationValue is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationValue, options); - } - - if (PercentageDescriptor is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageDescriptor, options); - } - else if (PercentageDescriptorAction is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); - } - else if (PercentageValue is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageValue, options); - } - - if (ScriptHeuristicDescriptor is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); - } - else if (ScriptHeuristicDescriptorAction is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); - } - else if (ScriptHeuristicValue is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SignificantTermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTextAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTextAggregation.g.cs index 09fa408e2cf..153ea9b2791 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTextAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SignificantTextAggregation.g.cs @@ -17,24 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SignificantTextAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackgroundFilter = System.Text.Json.JsonEncodedText.Encode("background_filter"); + private static readonly System.Text.Json.JsonEncodedText PropChiSquare = System.Text.Json.JsonEncodedText.Encode("chi_square"); + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropExecutionHint = System.Text.Json.JsonEncodedText.Encode("execution_hint"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilterDuplicateText = System.Text.Json.JsonEncodedText.Encode("filter_duplicate_text"); + private static readonly System.Text.Json.JsonEncodedText PropGnd = System.Text.Json.JsonEncodedText.Encode("gnd"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropJlh = System.Text.Json.JsonEncodedText.Encode("jlh"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMutualInformation = System.Text.Json.JsonEncodedText.Encode("mutual_information"); + private static readonly System.Text.Json.JsonEncodedText PropPercentage = System.Text.Json.JsonEncodedText.Encode("percentage"); + private static readonly System.Text.Json.JsonEncodedText PropScriptHeuristic = System.Text.Json.JsonEncodedText.Encode("script_heuristic"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSourceFields = System.Text.Json.JsonEncodedText.Encode("source_fields"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackgroundFilter = default; + LocalJsonValue propChiSquare = default; + LocalJsonValue propExclude = default; + LocalJsonValue propExecutionHint = default; + LocalJsonValue propField = default; + LocalJsonValue propFilterDuplicateText = default; + LocalJsonValue propGnd = default; + LocalJsonValue propInclude = default; + LocalJsonValue propJlh = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propMutualInformation = default; + LocalJsonValue propPercentage = default; + LocalJsonValue propScriptHeuristic = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + LocalJsonValue propSourceFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackgroundFilter.TryReadProperty(ref reader, options, PropBackgroundFilter, null)) + { + continue; + } + + if (propChiSquare.TryReadProperty(ref reader, options, PropChiSquare, null)) + { + continue; + } + + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propExecutionHint.TryReadProperty(ref reader, options, PropExecutionHint, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilterDuplicateText.TryReadProperty(ref reader, options, PropFilterDuplicateText, null)) + { + continue; + } + + if (propGnd.TryReadProperty(ref reader, options, PropGnd, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propJlh.TryReadProperty(ref reader, options, PropJlh, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propMutualInformation.TryReadProperty(ref reader, options, PropMutualInformation, null)) + { + continue; + } + + if (propPercentage.TryReadProperty(ref reader, options, PropPercentage, null)) + { + continue; + } + + if (propScriptHeuristic.TryReadProperty(ref reader, options, PropScriptHeuristic, null)) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSourceFields.TryReadProperty(ref reader, options, PropSourceFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackgroundFilter = propBackgroundFilter.Value, + ChiSquare = propChiSquare.Value, + Exclude = propExclude.Value, + ExecutionHint = propExecutionHint.Value, + Field = propField.Value, + FilterDuplicateText = propFilterDuplicateText.Value, + Gnd = propGnd.Value, + Include = propInclude.Value, + Jlh = propJlh.Value, + MinDocCount = propMinDocCount.Value, + MutualInformation = propMutualInformation.Value, + Percentage = propPercentage.Value, + ScriptHeuristic = propScriptHeuristic.Value, + ShardMinDocCount = propShardMinDocCount.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value, + SourceFields = propSourceFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackgroundFilter, value.BackgroundFilter, null, null); + writer.WriteProperty(options, PropChiSquare, value.ChiSquare, null, null); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropExecutionHint, value.ExecutionHint, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilterDuplicateText, value.FilterDuplicateText, null, null); + writer.WriteProperty(options, PropGnd, value.Gnd, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropJlh, value.Jlh, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropMutualInformation, value.MutualInformation, null, null); + writer.WriteProperty(options, PropPercentage, value.Percentage, null, null); + writer.WriteProperty(options, PropScriptHeuristic, value.ScriptHeuristic, null, null); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSourceFields, value.SourceFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationConverter))] public sealed partial class SignificantTextAggregation { +#if NET7_0_OR_GREATER + public SignificantTextAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SignificantTextAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - [JsonInclude, JsonPropertyName("background_filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilter { get; set; } /// @@ -42,7 +237,6 @@ public sealed partial class SignificantTextAggregation /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. /// /// - [JsonInclude, JsonPropertyName("chi_square")] public Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquare { get; set; } /// @@ -50,7 +244,6 @@ public sealed partial class SignificantTextAggregation /// Values to exclude. /// /// - [JsonInclude, JsonPropertyName("exclude")] public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } /// @@ -58,7 +251,6 @@ public sealed partial class SignificantTextAggregation /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - [JsonInclude, JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHint { get; set; } /// @@ -66,7 +258,6 @@ public sealed partial class SignificantTextAggregation /// The field from which to return significant text. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -74,7 +265,6 @@ public sealed partial class SignificantTextAggregation /// Whether to out duplicate text to deal with noisy data. /// /// - [JsonInclude, JsonPropertyName("filter_duplicate_text")] public bool? FilterDuplicateText { get; set; } /// @@ -82,7 +272,6 @@ public sealed partial class SignificantTextAggregation /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - [JsonInclude, JsonPropertyName("gnd")] public Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? Gnd { get; set; } /// @@ -90,7 +279,6 @@ public sealed partial class SignificantTextAggregation /// Values to include. /// /// - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } /// @@ -98,7 +286,6 @@ public sealed partial class SignificantTextAggregation /// Use JLH score as the significance score. /// /// - [JsonInclude, JsonPropertyName("jlh")] public Elastic.Clients.Elasticsearch.EmptyObject? Jlh { get; set; } /// @@ -106,7 +293,6 @@ public sealed partial class SignificantTextAggregation /// Only return values that are found in more than min_doc_count hits. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public long? MinDocCount { get; set; } /// @@ -114,7 +300,6 @@ public sealed partial class SignificantTextAggregation /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - [JsonInclude, JsonPropertyName("mutual_information")] public Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformation { get; set; } /// @@ -122,7 +307,6 @@ public sealed partial class SignificantTextAggregation /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. /// /// - [JsonInclude, JsonPropertyName("percentage")] public Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? Percentage { get; set; } /// @@ -130,7 +314,6 @@ public sealed partial class SignificantTextAggregation /// Customized score, implemented via a script. /// /// - [JsonInclude, JsonPropertyName("script_heuristic")] public Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristic { get; set; } /// @@ -139,7 +322,6 @@ public sealed partial class SignificantTextAggregation /// Values will only be considered if their local shard frequency within the set is higher than the shard_min_doc_count. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public long? ShardMinDocCount { get; set; } /// @@ -148,7 +330,6 @@ public sealed partial class SignificantTextAggregation /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -156,7 +337,6 @@ public sealed partial class SignificantTextAggregation /// The number of buckets returned out of the overall terms list. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -164,142 +344,92 @@ public sealed partial class SignificantTextAggregation /// Overrides the JSON _source fields from which text will be analyzed. /// /// - [JsonInclude, JsonPropertyName("source_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? SourceFields { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SignificantTextAggregation significantTextAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.SignificantText(significantTextAggregation); } -public sealed partial class SignificantTextAggregationDescriptor : SerializableDescriptor> +public readonly partial struct SignificantTextAggregationDescriptor { - internal SignificantTextAggregationDescriptor(Action> configure) => configure.Invoke(this); - - public SignificantTextAggregationDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } - private Action> BackgroundFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } - private Action ChiSquareDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? FilterDuplicateTextValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } - private Action GndDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor JlhDescriptor { get; set; } - private Action JlhDescriptorAction { get; set; } - private long? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } - private Action MutualInformationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } - private Action PercentageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } - private Action ScriptHeuristicDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? SourceFieldsValue { get; set; } + internal Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation Instance { get; init; } - /// - /// - /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. - /// - /// - public SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation instance) { - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterValue = backgroundFilter; - return Self; + Instance = instance; } - public SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTextAggregationDescriptor() { - BackgroundFilterValue = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SignificantTextAggregationDescriptor BackgroundFilter(Action> configure) - { - BackgroundFilterValue = null; - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = configure; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor descriptor) => descriptor.Instance; /// /// - /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - public SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = null; - ChiSquareValue = chiSquare; - return Self; + Instance.BackgroundFilter = value; + return this; } - public SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor descriptor) + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor BackgroundFilter(System.Action> action) { - ChiSquareValue = null; - ChiSquareDescriptorAction = null; - ChiSquareDescriptor = descriptor; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SignificantTextAggregationDescriptor ChiSquare(Action configure) + /// + /// + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? value) { - ChiSquareValue = null; - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = configure; - return Self; + Instance.ChiSquare = value; + return this; } /// /// - /// Values to exclude. + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. /// /// - public SignificantTextAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ChiSquare(System.Action action) { - ExcludeValue = exclude; - return Self; + Instance.ChiSquare = Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor.Build(action); + return this; } /// /// - /// Determines whether the aggregation will use field values directly or global ordinals. + /// Values to exclude. /// /// - public SignificantTextAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExecutionHintValue = executionHint; - return Self; + Instance.Exclude = value; + return this; } /// /// - /// The field from which to return significant text. + /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - public SignificantTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -307,10 +437,10 @@ public SignificantTextAggregationDescriptor Field(Elastic.Clients.Ela /// The field from which to return significant text. /// /// - public SignificantTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -318,10 +448,10 @@ public SignificantTextAggregationDescriptor Field(Expression< /// The field from which to return significant text. /// /// - public SignificantTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -329,10 +459,10 @@ public SignificantTextAggregationDescriptor Field(Expression /// - public SignificantTextAggregationDescriptor FilterDuplicateText(bool? filterDuplicateText = true) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor FilterDuplicateText(bool? value = true) { - FilterDuplicateTextValue = filterDuplicateText; - return Self; + Instance.FilterDuplicateText = value; + return this; } /// @@ -340,28 +470,32 @@ public SignificantTextAggregationDescriptor FilterDuplicateText(bool? /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - public SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? value) { - GndDescriptor = null; - GndDescriptorAction = null; - GndValue = gnd; - return Self; + Instance.Gnd = value; + return this; } - public SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor descriptor) + /// + /// + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd() { - GndValue = null; - GndDescriptorAction = null; - GndDescriptor = descriptor; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Gnd(Action configure) + /// + /// + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd(System.Action? action) { - GndValue = null; - GndDescriptor = null; - GndDescriptorAction = configure; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(action); + return this; } /// @@ -369,10 +503,10 @@ public SignificantTextAggregationDescriptor Gnd(Action /// - public SignificantTextAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -380,28 +514,32 @@ public SignificantTextAggregationDescriptor Include(Elastic.Clients.E /// Use JLH score as the significance score. /// /// - public SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? value) { - JlhDescriptor = null; - JlhDescriptorAction = null; - JlhValue = jlh; - return Self; + Instance.Jlh = value; + return this; } - public SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh() { - JlhValue = null; - JlhDescriptorAction = null; - JlhDescriptor = descriptor; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Jlh(Action configure) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh(System.Action? action) { - JlhValue = null; - JlhDescriptor = null; - JlhDescriptorAction = configure; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -409,10 +547,10 @@ public SignificantTextAggregationDescriptor Jlh(Actionmin_doc_count hits. /// /// - public SignificantTextAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -420,28 +558,32 @@ public SignificantTextAggregationDescriptor MinDocCount(long? minDocC /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - public SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? value) { - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = null; - MutualInformationValue = mutualInformation; - return Self; + Instance.MutualInformation = value; + return this; } - public SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor descriptor) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation() { - MutualInformationValue = null; - MutualInformationDescriptorAction = null; - MutualInformationDescriptor = descriptor; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor MutualInformation(Action configure) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation(System.Action? action) { - MutualInformationValue = null; - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = configure; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(action); + return this; } /// @@ -449,28 +591,32 @@ public SignificantTextAggregationDescriptor MutualInformation(Action< /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. /// /// - public SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? value) { - PercentageDescriptor = null; - PercentageDescriptorAction = null; - PercentageValue = percentage; - return Self; + Instance.Percentage = value; + return this; } - public SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor descriptor) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage() { - PercentageValue = null; - PercentageDescriptorAction = null; - PercentageDescriptor = descriptor; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Percentage(Action configure) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage(System.Action? action) { - PercentageValue = null; - PercentageDescriptor = null; - PercentageDescriptorAction = configure; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(action); + return this; } /// @@ -478,28 +624,21 @@ public SignificantTextAggregationDescriptor Percentage(Action /// - public SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) - { - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicValue = scriptHeuristic; - return Self; - } - - public SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? value) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicDescriptor = descriptor; - return Self; + Instance.ScriptHeuristic = value; + return this; } - public SignificantTextAggregationDescriptor ScriptHeuristic(Action configure) + /// + /// + /// Customized score, implemented via a script. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ScriptHeuristic(System.Action action) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = configure; - return Self; + Instance.ScriptHeuristic = Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor.Build(action); + return this; } /// @@ -508,10 +647,10 @@ public SignificantTextAggregationDescriptor ScriptHeuristic(Actionshard_min_doc_count. /// /// - public SignificantTextAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -520,10 +659,10 @@ public SignificantTextAggregationDescriptor ShardMinDocCount(long? sh /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public SignificantTextAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -531,10 +670,10 @@ public SignificantTextAggregationDescriptor ShardSize(int? shardSize) /// The number of buckets returned out of the overall terms list. /// /// - public SignificantTextAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -542,258 +681,87 @@ public SignificantTextAggregationDescriptor Size(int? size) /// Overrides the JSON _source fields from which text will be analyzed. /// /// - public SignificantTextAggregationDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? sourceFields) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? value) { - SourceFieldsValue = sourceFields; - return Self; + Instance.SourceFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Overrides the JSON _source fields from which text will be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor SourceFields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - if (BackgroundFilterDescriptor is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); - } - else if (BackgroundFilterDescriptorAction is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); - } - else if (BackgroundFilterValue is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterValue, options); - } - - if (ChiSquareDescriptor is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); - } - else if (ChiSquareDescriptorAction is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); - } - else if (ChiSquareValue is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (FilterDuplicateTextValue.HasValue) - { - writer.WritePropertyName("filter_duplicate_text"); - writer.WriteBooleanValue(FilterDuplicateTextValue.Value); - } - - if (GndDescriptor is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndDescriptor, options); - } - else if (GndDescriptorAction is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); - } - else if (GndValue is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (JlhDescriptor is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhDescriptor, options); - } - else if (JlhDescriptorAction is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(JlhDescriptorAction), options); - } - else if (JlhValue is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MutualInformationDescriptor is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); - } - else if (MutualInformationDescriptorAction is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); - } - else if (MutualInformationValue is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationValue, options); - } - - if (PercentageDescriptor is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageDescriptor, options); - } - else if (PercentageDescriptorAction is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); - } - else if (PercentageValue is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageValue, options); - } - - if (ScriptHeuristicDescriptor is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); - } - else if (ScriptHeuristicDescriptorAction is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); - } - else if (ScriptHeuristicValue is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); - } + Instance.SourceFields = value; + return this; + } - if (ShardMinDocCountValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } +public readonly partial struct SignificantTextAggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation Instance { get; init; } - if (SourceFieldsValue is not null) - { - writer.WritePropertyName("source_fields"); - JsonSerializer.Serialize(writer, SourceFieldsValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SignificantTextAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class SignificantTextAggregationDescriptor : SerializableDescriptor -{ - internal SignificantTextAggregationDescriptor(Action configure) => configure.Invoke(this); - - public SignificantTextAggregationDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? BackgroundFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor BackgroundFilterDescriptor { get; set; } - private Action BackgroundFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? ChiSquareValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor ChiSquareDescriptor { get; set; } - private Action ChiSquareDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private bool? FilterDuplicateTextValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? GndValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor GndDescriptor { get; set; } - private Action GndDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? JlhValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor JlhDescriptor { get; set; } - private Action JlhDescriptorAction { get; set; } - private long? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? MutualInformationValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor MutualInformationDescriptor { get; set; } - private Action MutualInformationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? PercentageValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor PercentageDescriptor { get; set; } - private Action PercentageDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? ScriptHeuristicValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor ScriptHeuristicDescriptor { get; set; } - private Action ScriptHeuristicDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? SourceFieldsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. /// /// - public SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? backgroundFilter) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterValue = backgroundFilter; - return Self; + Instance.BackgroundFilter = value; + return this; } - public SignificantTextAggregationDescriptor BackgroundFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor BackgroundFilter(System.Action action) { - BackgroundFilterValue = null; - BackgroundFilterDescriptorAction = null; - BackgroundFilterDescriptor = descriptor; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SignificantTextAggregationDescriptor BackgroundFilter(Action configure) + /// + /// + /// A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor BackgroundFilter(System.Action> action) { - BackgroundFilterValue = null; - BackgroundFilterDescriptor = null; - BackgroundFilterDescriptorAction = configure; - return Self; + Instance.BackgroundFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -801,28 +769,21 @@ public SignificantTextAggregationDescriptor BackgroundFilter(Action /// - public SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? chiSquare) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristic? value) { - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = null; - ChiSquareValue = chiSquare; - return Self; + Instance.ChiSquare = value; + return this; } - public SignificantTextAggregationDescriptor ChiSquare(Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor descriptor) - { - ChiSquareValue = null; - ChiSquareDescriptorAction = null; - ChiSquareDescriptor = descriptor; - return Self; - } - - public SignificantTextAggregationDescriptor ChiSquare(Action configure) + /// + /// + /// Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ChiSquare(System.Action action) { - ChiSquareValue = null; - ChiSquareDescriptor = null; - ChiSquareDescriptorAction = configure; - return Self; + Instance.ChiSquare = Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor.Build(action); + return this; } /// @@ -830,10 +791,10 @@ public SignificantTextAggregationDescriptor ChiSquare(Action /// - public SignificantTextAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// @@ -841,10 +802,10 @@ public SignificantTextAggregationDescriptor Exclude(Elastic.Clients.Elasticsearc /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - public SignificantTextAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - ExecutionHintValue = executionHint; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -852,10 +813,10 @@ public SignificantTextAggregationDescriptor ExecutionHint(Elastic.Clients.Elasti /// The field from which to return significant text. /// /// - public SignificantTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -863,32 +824,32 @@ public SignificantTextAggregationDescriptor Field(Elastic.Clients.Elasticsearch. /// The field from which to return significant text. /// /// - public SignificantTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field from which to return significant text. + /// Whether to out duplicate text to deal with noisy data. /// /// - public SignificantTextAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor FilterDuplicateText(bool? value = true) { - FieldValue = field; - return Self; + Instance.FilterDuplicateText = value; + return this; } /// /// - /// Whether to out duplicate text to deal with noisy data. + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - public SignificantTextAggregationDescriptor FilterDuplicateText(bool? filterDuplicateText = true) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? value) { - FilterDuplicateTextValue = filterDuplicateText; - return Self; + Instance.Gnd = value; + return this; } /// @@ -896,28 +857,21 @@ public SignificantTextAggregationDescriptor FilterDuplicateText(bool? filterDupl /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. /// /// - public SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristic? gnd) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd() { - GndDescriptor = null; - GndDescriptorAction = null; - GndValue = gnd; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Gnd(Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor descriptor) - { - GndValue = null; - GndDescriptorAction = null; - GndDescriptor = descriptor; - return Self; - } - - public SignificantTextAggregationDescriptor Gnd(Action configure) + /// + /// + /// Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Gnd(System.Action? action) { - GndValue = null; - GndDescriptor = null; - GndDescriptorAction = configure; - return Self; + Instance.Gnd = Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor.Build(action); + return this; } /// @@ -925,10 +879,10 @@ public SignificantTextAggregationDescriptor Gnd(Action /// - public SignificantTextAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -936,28 +890,32 @@ public SignificantTextAggregationDescriptor Include(Elastic.Clients.Elasticsearc /// Use JLH score as the significance score. /// /// - public SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? jlh) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObject? value) { - JlhDescriptor = null; - JlhDescriptorAction = null; - JlhValue = jlh; - return Self; + Instance.Jlh = value; + return this; } - public SignificantTextAggregationDescriptor Jlh(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh() { - JlhValue = null; - JlhDescriptorAction = null; - JlhDescriptor = descriptor; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Jlh(Action configure) + /// + /// + /// Use JLH score as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Jlh(System.Action? action) { - JlhValue = null; - JlhDescriptor = null; - JlhDescriptorAction = configure; - return Self; + Instance.Jlh = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -965,10 +923,10 @@ public SignificantTextAggregationDescriptor Jlh(Actionmin_doc_count hits. /// /// - public SignificantTextAggregationDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -976,28 +934,32 @@ public SignificantTextAggregationDescriptor MinDocCount(long? minDocCount) /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. /// /// - public SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? mutualInformation) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristic? value) { - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = null; - MutualInformationValue = mutualInformation; - return Self; + Instance.MutualInformation = value; + return this; } - public SignificantTextAggregationDescriptor MutualInformation(Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor descriptor) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation() { - MutualInformationValue = null; - MutualInformationDescriptorAction = null; - MutualInformationDescriptor = descriptor; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor MutualInformation(Action configure) + /// + /// + /// Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor MutualInformation(System.Action? action) { - MutualInformationValue = null; - MutualInformationDescriptor = null; - MutualInformationDescriptorAction = configure; - return Self; + Instance.MutualInformation = Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor.Build(action); + return this; } /// @@ -1005,28 +967,32 @@ public SignificantTextAggregationDescriptor MutualInformation(Action /// - public SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? percentage) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristic? value) { - PercentageDescriptor = null; - PercentageDescriptorAction = null; - PercentageValue = percentage; - return Self; + Instance.Percentage = value; + return this; } - public SignificantTextAggregationDescriptor Percentage(Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor descriptor) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage() { - PercentageValue = null; - PercentageDescriptorAction = null; - PercentageDescriptor = descriptor; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(null); + return this; } - public SignificantTextAggregationDescriptor Percentage(Action configure) + /// + /// + /// A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Percentage(System.Action? action) { - PercentageValue = null; - PercentageDescriptor = null; - PercentageDescriptorAction = configure; - return Self; + Instance.Percentage = Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor.Build(action); + return this; } /// @@ -1034,28 +1000,21 @@ public SignificantTextAggregationDescriptor Percentage(Action /// - public SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? scriptHeuristic) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristic? value) { - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicValue = scriptHeuristic; - return Self; + Instance.ScriptHeuristic = value; + return this; } - public SignificantTextAggregationDescriptor ScriptHeuristic(Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor descriptor) - { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptorAction = null; - ScriptHeuristicDescriptor = descriptor; - return Self; - } - - public SignificantTextAggregationDescriptor ScriptHeuristic(Action configure) + /// + /// + /// Customized score, implemented via a script. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ScriptHeuristic(System.Action action) { - ScriptHeuristicValue = null; - ScriptHeuristicDescriptor = null; - ScriptHeuristicDescriptorAction = configure; - return Self; + Instance.ScriptHeuristic = Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor.Build(action); + return this; } /// @@ -1064,10 +1023,10 @@ public SignificantTextAggregationDescriptor ScriptHeuristic(Actionshard_min_doc_count. /// /// - public SignificantTextAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -1076,10 +1035,10 @@ public SignificantTextAggregationDescriptor ShardMinDocCount(long? shardMinDocCo /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public SignificantTextAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -1087,10 +1046,10 @@ public SignificantTextAggregationDescriptor ShardSize(int? shardSize) /// The number of buckets returned out of the overall terms list. /// /// - public SignificantTextAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -1098,187 +1057,33 @@ public SignificantTextAggregationDescriptor Size(int? size) /// Overrides the JSON _source fields from which text will be analyzed. /// /// - public SignificantTextAggregationDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? sourceFields) + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? value) { - SourceFieldsValue = sourceFields; - return Self; + Instance.SourceFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Overrides the JSON _source fields from which text will be analyzed. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor SourceFields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - if (BackgroundFilterDescriptor is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterDescriptor, options); - } - else if (BackgroundFilterDescriptorAction is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(BackgroundFilterDescriptorAction), options); - } - else if (BackgroundFilterValue is not null) - { - writer.WritePropertyName("background_filter"); - JsonSerializer.Serialize(writer, BackgroundFilterValue, options); - } - - if (ChiSquareDescriptor is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareDescriptor, options); - } - else if (ChiSquareDescriptorAction is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ChiSquareHeuristicDescriptor(ChiSquareDescriptorAction), options); - } - else if (ChiSquareValue is not null) - { - writer.WritePropertyName("chi_square"); - JsonSerializer.Serialize(writer, ChiSquareValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (FilterDuplicateTextValue.HasValue) - { - writer.WritePropertyName("filter_duplicate_text"); - writer.WriteBooleanValue(FilterDuplicateTextValue.Value); - } - - if (GndDescriptor is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndDescriptor, options); - } - else if (GndDescriptorAction is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.GoogleNormalizedDistanceHeuristicDescriptor(GndDescriptorAction), options); - } - else if (GndValue is not null) - { - writer.WritePropertyName("gnd"); - JsonSerializer.Serialize(writer, GndValue, options); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (JlhDescriptor is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhDescriptor, options); - } - else if (JlhDescriptorAction is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(JlhDescriptorAction), options); - } - else if (JlhValue is not null) - { - writer.WritePropertyName("jlh"); - JsonSerializer.Serialize(writer, JlhValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MutualInformationDescriptor is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationDescriptor, options); - } - else if (MutualInformationDescriptorAction is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.MutualInformationHeuristicDescriptor(MutualInformationDescriptorAction), options); - } - else if (MutualInformationValue is not null) - { - writer.WritePropertyName("mutual_information"); - JsonSerializer.Serialize(writer, MutualInformationValue, options); - } - - if (PercentageDescriptor is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageDescriptor, options); - } - else if (PercentageDescriptorAction is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.PercentageScoreHeuristicDescriptor(PercentageDescriptorAction), options); - } - else if (PercentageValue is not null) - { - writer.WritePropertyName("percentage"); - JsonSerializer.Serialize(writer, PercentageValue, options); - } - - if (ScriptHeuristicDescriptor is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicDescriptor, options); - } - else if (ScriptHeuristicDescriptorAction is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.ScriptedHeuristicDescriptor(ScriptHeuristicDescriptorAction), options); - } - else if (ScriptHeuristicValue is not null) - { - writer.WritePropertyName("script_heuristic"); - JsonSerializer.Serialize(writer, ScriptHeuristicValue, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + Instance.SourceFields = value; + return this; + } - if (SourceFieldsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("source_fields"); - JsonSerializer.Serialize(writer, SourceFieldsValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SignificantTextAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SimpleValueAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SimpleValueAggregate.g.cs index 00e7be7375c..c8e7c1f45bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SimpleValueAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SimpleValueAggregate.g.cs @@ -17,20 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class SimpleValueAggregate : IAggregate +internal sealed partial class SimpleValueAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SimpleValueAggregateConverter))] +public sealed partial class SimpleValueAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleValueAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public SimpleValueAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SimpleValueAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimpleValueAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "simple_value"; /// /// @@ -38,8 +115,10 @@ public sealed partial class SimpleValueAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBounds.g.cs index a1b67ca3ba7..b4d8a6a8451 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBounds.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StandardDeviationBoundsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLower = System.Text.Json.JsonEncodedText.Encode("lower"); + private static readonly System.Text.Json.JsonEncodedText PropLowerPopulation = System.Text.Json.JsonEncodedText.Encode("lower_population"); + private static readonly System.Text.Json.JsonEncodedText PropLowerSampling = System.Text.Json.JsonEncodedText.Encode("lower_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropUpper = System.Text.Json.JsonEncodedText.Encode("upper"); + private static readonly System.Text.Json.JsonEncodedText PropUpperPopulation = System.Text.Json.JsonEncodedText.Encode("upper_population"); + private static readonly System.Text.Json.JsonEncodedText PropUpperSampling = System.Text.Json.JsonEncodedText.Encode("upper_sampling"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLower = default; + LocalJsonValue propLowerPopulation = default; + LocalJsonValue propLowerSampling = default; + LocalJsonValue propUpper = default; + LocalJsonValue propUpperPopulation = default; + LocalJsonValue propUpperSampling = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLower.TryReadProperty(ref reader, options, PropLower, null)) + { + continue; + } + + if (propLowerPopulation.TryReadProperty(ref reader, options, PropLowerPopulation, null)) + { + continue; + } + + if (propLowerSampling.TryReadProperty(ref reader, options, PropLowerSampling, null)) + { + continue; + } + + if (propUpper.TryReadProperty(ref reader, options, PropUpper, null)) + { + continue; + } + + if (propUpperPopulation.TryReadProperty(ref reader, options, PropUpperPopulation, null)) + { + continue; + } + + if (propUpperSampling.TryReadProperty(ref reader, options, PropUpperSampling, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lower = propLower.Value, + LowerPopulation = propLowerPopulation.Value, + LowerSampling = propLowerSampling.Value, + Upper = propUpper.Value, + UpperPopulation = propUpperPopulation.Value, + UpperSampling = propUpperSampling.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLower, value.Lower, null, null); + writer.WriteProperty(options, PropLowerPopulation, value.LowerPopulation, null, null); + writer.WriteProperty(options, PropLowerSampling, value.LowerSampling, null, null); + writer.WriteProperty(options, PropUpper, value.Upper, null, null); + writer.WriteProperty(options, PropUpperPopulation, value.UpperPopulation, null, null); + writer.WriteProperty(options, PropUpperSampling, value.UpperSampling, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsConverter))] public sealed partial class StandardDeviationBounds { - [JsonInclude, JsonPropertyName("lower")] - public double? Lower { get; init; } - [JsonInclude, JsonPropertyName("lower_population")] - public double? LowerPopulation { get; init; } - [JsonInclude, JsonPropertyName("lower_sampling")] - public double? LowerSampling { get; init; } - [JsonInclude, JsonPropertyName("upper")] - public double? Upper { get; init; } - [JsonInclude, JsonPropertyName("upper_population")] - public double? UpperPopulation { get; init; } - [JsonInclude, JsonPropertyName("upper_sampling")] - public double? UpperSampling { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardDeviationBounds(double? lower, double? lowerPopulation, double? lowerSampling, double? upper, double? upperPopulation, double? upperSampling) + { + Lower = lower; + LowerPopulation = lowerPopulation; + LowerSampling = lowerSampling; + Upper = upper; + UpperPopulation = upperPopulation; + UpperSampling = upperSampling; + } +#if NET7_0_OR_GREATER + public StandardDeviationBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StandardDeviationBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StandardDeviationBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? Lower { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? LowerPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? LowerSampling { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Upper { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? UpperPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? UpperSampling { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBoundsAsString.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBoundsAsString.g.cs index 333a651bd7d..1a9721540b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBoundsAsString.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StandardDeviationBoundsAsString.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StandardDeviationBoundsAsStringConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLower = System.Text.Json.JsonEncodedText.Encode("lower"); + private static readonly System.Text.Json.JsonEncodedText PropLowerPopulation = System.Text.Json.JsonEncodedText.Encode("lower_population"); + private static readonly System.Text.Json.JsonEncodedText PropLowerSampling = System.Text.Json.JsonEncodedText.Encode("lower_sampling"); + private static readonly System.Text.Json.JsonEncodedText PropUpper = System.Text.Json.JsonEncodedText.Encode("upper"); + private static readonly System.Text.Json.JsonEncodedText PropUpperPopulation = System.Text.Json.JsonEncodedText.Encode("upper_population"); + private static readonly System.Text.Json.JsonEncodedText PropUpperSampling = System.Text.Json.JsonEncodedText.Encode("upper_sampling"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLower = default; + LocalJsonValue propLowerPopulation = default; + LocalJsonValue propLowerSampling = default; + LocalJsonValue propUpper = default; + LocalJsonValue propUpperPopulation = default; + LocalJsonValue propUpperSampling = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLower.TryReadProperty(ref reader, options, PropLower, null)) + { + continue; + } + + if (propLowerPopulation.TryReadProperty(ref reader, options, PropLowerPopulation, null)) + { + continue; + } + + if (propLowerSampling.TryReadProperty(ref reader, options, PropLowerSampling, null)) + { + continue; + } + + if (propUpper.TryReadProperty(ref reader, options, PropUpper, null)) + { + continue; + } + + if (propUpperPopulation.TryReadProperty(ref reader, options, PropUpperPopulation, null)) + { + continue; + } + + if (propUpperSampling.TryReadProperty(ref reader, options, PropUpperSampling, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lower = propLower.Value, + LowerPopulation = propLowerPopulation.Value, + LowerSampling = propLowerSampling.Value, + Upper = propUpper.Value, + UpperPopulation = propUpperPopulation.Value, + UpperSampling = propUpperSampling.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsString value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLower, value.Lower, null, null); + writer.WriteProperty(options, PropLowerPopulation, value.LowerPopulation, null, null); + writer.WriteProperty(options, PropLowerSampling, value.LowerSampling, null, null); + writer.WriteProperty(options, PropUpper, value.Upper, null, null); + writer.WriteProperty(options, PropUpperPopulation, value.UpperPopulation, null, null); + writer.WriteProperty(options, PropUpperSampling, value.UpperSampling, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StandardDeviationBoundsAsStringConverter))] public sealed partial class StandardDeviationBoundsAsString { - [JsonInclude, JsonPropertyName("lower")] - public string Lower { get; init; } - [JsonInclude, JsonPropertyName("lower_population")] - public string LowerPopulation { get; init; } - [JsonInclude, JsonPropertyName("lower_sampling")] - public string LowerSampling { get; init; } - [JsonInclude, JsonPropertyName("upper")] - public string Upper { get; init; } - [JsonInclude, JsonPropertyName("upper_population")] - public string UpperPopulation { get; init; } - [JsonInclude, JsonPropertyName("upper_sampling")] - public string UpperSampling { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardDeviationBoundsAsString(string lower, string lowerPopulation, string lowerSampling, string upper, string upperPopulation, string upperSampling) + { + Lower = lower; + LowerPopulation = lowerPopulation; + LowerSampling = lowerSampling; + Upper = upper; + UpperPopulation = upperPopulation; + UpperSampling = upperSampling; + } +#if NET7_0_OR_GREATER + public StandardDeviationBoundsAsString() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StandardDeviationBoundsAsString() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StandardDeviationBoundsAsString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Lower { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string LowerPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string LowerSampling { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Upper { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string UpperPopulation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string UpperSampling { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregate.g.cs index 35562889db5..1d649b3fc0d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregate.g.cs @@ -17,42 +17,197 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StatsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropAvgAsString = System.Text.Json.JsonEncodedText.Encode("avg_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText PropSumAsString = System.Text.Json.JsonEncodedText.Encode("sum_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propAvgAsString = default; + LocalJsonValue propCount = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + LocalJsonValue propSum = default; + LocalJsonValue propSumAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propAvgAsString.TryReadProperty(ref reader, options, PropAvgAsString, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + if (propSum.TryReadProperty(ref reader, options, PropSum, null)) + { + continue; + } + + if (propSumAsString.TryReadProperty(ref reader, options, PropSumAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + AvgAsString = propAvgAsString.Value, + Count = propCount.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Meta = propMeta.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value, + Sum = propSum.Value, + SumAsString = propSumAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StatsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropAvgAsString, value.AvgAsString, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + writer.WriteProperty(options, PropSum, value.Sum, null, null); + writer.WriteProperty(options, PropSumAsString, value.SumAsString, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Statistics aggregation result. min, max and avg are missing if there were no values to process /// (count is zero). /// /// -public sealed partial class StatsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregateConverter))] +public sealed partial class StatsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("avg")] - public double? Avg { get; init; } - [JsonInclude, JsonPropertyName("avg_as_string")] - public string? AvgAsString { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double? Max { get; init; } - [JsonInclude, JsonPropertyName("max_as_string")] - public string? MaxAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double? Min { get; init; } - [JsonInclude, JsonPropertyName("min_as_string")] - public string? MinAsString { get; init; } - [JsonInclude, JsonPropertyName("sum")] - public double Sum { get; init; } - [JsonInclude, JsonPropertyName("sum_as_string")] - public string? SumAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsAggregate(double? avg, long count, double? max, double? min, double sum) + { + Avg = avg; + Count = count; + Max = max; + Min = min; + Sum = sum; + } +#if NET7_0_OR_GREATER + public StatsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StatsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? Avg { get; set; } + public string? AvgAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Max { get; set; } + public string? MaxAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Min { get; set; } + public string? MinAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Sum { get; set; } + public string? SumAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "stats"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs index 6d8b229d3e0..624492983f7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StatsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationConverter))] public sealed partial class StatsAggregation { +#if NET7_0_OR_GREATER + public StatsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public StatsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,49 +122,38 @@ public sealed partial class StatsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(StatsAggregation statsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Stats(statsAggregation); } -public sealed partial class StatsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct StatsAggregationDescriptor { - internal StatsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation Instance { get; init; } - public StatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public StatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public StatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -95,16 +161,16 @@ public StatsAggregationDescriptor Field(Expression /// - public StatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public StatsAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -113,112 +179,72 @@ public StatsAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public StatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public StatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class StatsAggregationDescriptor : SerializableDescriptor +public readonly partial struct StatsAggregationDescriptor { - internal StatsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation Instance { get; init; } - public StatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public StatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public StatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -226,16 +252,16 @@ public StatsAggregationDescriptor Field(Expression /// - public StatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public StatsAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -244,73 +270,40 @@ public StatsAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public StatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public StatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public StatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.StatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregate.g.cs index ec9d642824d..348e97fbe28 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregate.g.cs @@ -17,36 +17,191 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class StatsBucketAggregate : IAggregate +internal sealed partial class StatsBucketAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropAvgAsString = System.Text.Json.JsonEncodedText.Encode("avg_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText PropSumAsString = System.Text.Json.JsonEncodedText.Encode("sum_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propAvgAsString = default; + LocalJsonValue propCount = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + LocalJsonValue propSum = default; + LocalJsonValue propSumAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propAvgAsString.TryReadProperty(ref reader, options, PropAvgAsString, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + if (propSum.TryReadProperty(ref reader, options, PropSum, null)) + { + continue; + } + + if (propSumAsString.TryReadProperty(ref reader, options, PropSumAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + AvgAsString = propAvgAsString.Value, + Count = propCount.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Meta = propMeta.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value, + Sum = propSum.Value, + SumAsString = propSumAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropAvgAsString, value.AvgAsString, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + writer.WriteProperty(options, PropSum, value.Sum, null, null); + writer.WriteProperty(options, PropSumAsString, value.SumAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregateConverter))] +public sealed partial class StatsBucketAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("avg")] - public double? Avg { get; init; } - [JsonInclude, JsonPropertyName("avg_as_string")] - public string? AvgAsString { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double? Max { get; init; } - [JsonInclude, JsonPropertyName("max_as_string")] - public string? MaxAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double? Min { get; init; } - [JsonInclude, JsonPropertyName("min_as_string")] - public string? MinAsString { get; init; } - [JsonInclude, JsonPropertyName("sum")] - public double Sum { get; init; } - [JsonInclude, JsonPropertyName("sum_as_string")] - public string? SumAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsBucketAggregate(double? avg, long count, double? max, double? min, double sum) + { + Avg = avg; + Count = count; + Max = max; + Min = min; + Sum = sum; + } +#if NET7_0_OR_GREATER + public StatsBucketAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StatsBucketAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatsBucketAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? Avg { get; set; } + public string? AvgAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Max { get; set; } + public string? MaxAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Min { get; set; } + public string? MinAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Sum { get; set; } + public string? SumAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "stats_bucket"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs index b49f6b54603..9541dc640e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StatsBucketAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StatsBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationConverter))] public sealed partial class StatsBucketAggregation { +#if NET7_0_OR_GREATER + public StatsBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public StatsBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class StatsBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class StatsBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(StatsBucketAggregation statsBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.StatsBucket(statsBucketAggregation); } -public sealed partial class StatsBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct StatsBucketAggregationDescriptor { - internal StatsBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation instance) + { + Instance = instance; + } - public StatsBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatsBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public StatsBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public StatsBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearc /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public StatsBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public StatsBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public StatsBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.StatsBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs index 405760fb953..9f33795ac75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsAggregate.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StringRareTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of the rare_terms aggregation when the field is a string. /// /// -public sealed partial class StringRareTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsAggregateConverter))] +public sealed partial class StringRareTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringRareTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public StringRareTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StringRareTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "srareterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs index f704ddde80d..7678b689572 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringRareTermsBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class StringRareTermsBucketConverter : JsonConverter +internal sealed partial class StringRareTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override StringRareTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - string key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new StringRareTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, StringRareTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'StringRareTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(StringRareTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringRareTermsBucketConverter))] public sealed partial class StringRareTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringRareTermsBucket(long docCount, string key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public StringRareTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StringRareTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringRareTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public string Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregate.g.cs index 2bcd1cd10f5..c1c01b94717 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregate.g.cs @@ -17,36 +17,191 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class StringStatsAggregate : IAggregate +internal sealed partial class StringStatsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvgLength = System.Text.Json.JsonEncodedText.Encode("avg_length"); + private static readonly System.Text.Json.JsonEncodedText PropAvgLengthAsString = System.Text.Json.JsonEncodedText.Encode("avg_length_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDistribution = System.Text.Json.JsonEncodedText.Encode("distribution"); + private static readonly System.Text.Json.JsonEncodedText PropEntropy = System.Text.Json.JsonEncodedText.Encode("entropy"); + private static readonly System.Text.Json.JsonEncodedText PropMaxLength = System.Text.Json.JsonEncodedText.Encode("max_length"); + private static readonly System.Text.Json.JsonEncodedText PropMaxLengthAsString = System.Text.Json.JsonEncodedText.Encode("max_length_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMinLength = System.Text.Json.JsonEncodedText.Encode("min_length"); + private static readonly System.Text.Json.JsonEncodedText PropMinLengthAsString = System.Text.Json.JsonEncodedText.Encode("min_length_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvgLength = default; + LocalJsonValue propAvgLengthAsString = default; + LocalJsonValue propCount = default; + LocalJsonValue?> propDistribution = default; + LocalJsonValue propEntropy = default; + LocalJsonValue propMaxLength = default; + LocalJsonValue propMaxLengthAsString = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMinLength = default; + LocalJsonValue propMinLengthAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvgLength.TryReadProperty(ref reader, options, PropAvgLength, null)) + { + continue; + } + + if (propAvgLengthAsString.TryReadProperty(ref reader, options, PropAvgLengthAsString, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDistribution.TryReadProperty(ref reader, options, PropDistribution, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propEntropy.TryReadProperty(ref reader, options, PropEntropy, null)) + { + continue; + } + + if (propMaxLength.TryReadProperty(ref reader, options, PropMaxLength, null)) + { + continue; + } + + if (propMaxLengthAsString.TryReadProperty(ref reader, options, PropMaxLengthAsString, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMinLength.TryReadProperty(ref reader, options, PropMinLength, null)) + { + continue; + } + + if (propMinLengthAsString.TryReadProperty(ref reader, options, PropMinLengthAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvgLength = propAvgLength.Value, + AvgLengthAsString = propAvgLengthAsString.Value, + Count = propCount.Value, + Distribution = propDistribution.Value, + Entropy = propEntropy.Value, + MaxLength = propMaxLength.Value, + MaxLengthAsString = propMaxLengthAsString.Value, + Meta = propMeta.Value, + MinLength = propMinLength.Value, + MinLengthAsString = propMinLengthAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvgLength, value.AvgLength, null, null); + writer.WriteProperty(options, PropAvgLengthAsString, value.AvgLengthAsString, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDistribution, value.Distribution, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEntropy, value.Entropy, null, null); + writer.WriteProperty(options, PropMaxLength, value.MaxLength, null, null); + writer.WriteProperty(options, PropMaxLengthAsString, value.MaxLengthAsString, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMinLength, value.MinLength, null, null); + writer.WriteProperty(options, PropMinLengthAsString, value.MinLengthAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregateConverter))] +public sealed partial class StringStatsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("avg_length")] - public double? AvgLength { get; init; } - [JsonInclude, JsonPropertyName("avg_length_as_string")] - public string? AvgLengthAsString { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("distribution")] - public IReadOnlyDictionary? Distribution { get; init; } - [JsonInclude, JsonPropertyName("entropy")] - public double? Entropy { get; init; } - [JsonInclude, JsonPropertyName("max_length")] - public int? MaxLength { get; init; } - [JsonInclude, JsonPropertyName("max_length_as_string")] - public string? MaxLengthAsString { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("min_length")] - public int? MinLength { get; init; } - [JsonInclude, JsonPropertyName("min_length_as_string")] - public string? MinLengthAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringStatsAggregate(double? avgLength, long count, double? entropy, int? maxLength, int? minLength) + { + AvgLength = avgLength; + Count = count; + Entropy = entropy; + MaxLength = maxLength; + MinLength = minLength; + } +#if NET7_0_OR_GREATER + public StringStatsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StringStatsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringStatsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double? AvgLength { get; set; } + public string? AvgLengthAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Distribution { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Entropy { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int? MaxLength { get; set; } + public string? MaxLengthAsString { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int? MinLength { get; set; } + public string? MinLengthAsString { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "string_stats"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs index 5a449e0b8c7..58f76c3c612 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringStatsAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StringStatsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropShowDistribution = System.Text.Json.JsonEncodedText.Encode("show_distribution"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue propShowDistribution = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propShowDistribution.TryReadProperty(ref reader, options, PropShowDistribution, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value, + Script = propScript.Value, + ShowDistribution = propShowDistribution.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropShowDistribution, value.ShowDistribution, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationConverter))] public sealed partial class StringStatsAggregation { +#if NET7_0_OR_GREATER + public StringStatsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public StringStatsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -43,9 +121,7 @@ public sealed partial class StringStatsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -53,47 +129,37 @@ public sealed partial class StringStatsAggregation /// Shows the probability distribution for all characters. /// /// - [JsonInclude, JsonPropertyName("show_distribution")] public bool? ShowDistribution { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(StringStatsAggregation stringStatsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.StringStats(stringStatsAggregation); } -public sealed partial class StringStatsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct StringStatsAggregationDescriptor { - internal StringStatsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation Instance { get; init; } - public StringStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? ShowDistributionValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public StringStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringStatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public StringStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -101,10 +167,10 @@ public StringStatsAggregationDescriptor Field(Expression /// - public StringStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -113,34 +179,28 @@ public StringStatsAggregationDescriptor Field(Expression /// - public StringStatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public StringStatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -148,88 +208,54 @@ public StringStatsAggregationDescriptor Script(Action /// - public StringStatsAggregationDescriptor ShowDistribution(bool? showDistribution = true) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor ShowDistribution(bool? value = true) { - ShowDistributionValue = showDistribution; - return Self; + Instance.ShowDistribution = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShowDistributionValue.HasValue) - { - writer.WritePropertyName("show_distribution"); - writer.WriteBooleanValue(ShowDistributionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class StringStatsAggregationDescriptor : SerializableDescriptor +public readonly partial struct StringStatsAggregationDescriptor { - internal StringStatsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation Instance { get; init; } - public StringStatsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? ShowDistributionValue { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public StringStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringStatsAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public StringStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -237,10 +263,10 @@ public StringStatsAggregationDescriptor Field(Expression /// - public StringStatsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -249,34 +275,28 @@ public StringStatsAggregationDescriptor Field(Expression /// - public StringStatsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public StringStatsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public StringStatsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -284,49 +304,22 @@ public StringStatsAggregationDescriptor Script(Action /// - public StringStatsAggregationDescriptor ShowDistribution(bool? showDistribution = true) + public Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor ShowDistribution(bool? value = true) { - ShowDistributionValue = showDistribution; - return Self; + Instance.ShowDistribution = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShowDistributionValue.HasValue) - { - writer.WritePropertyName("show_distribution"); - writer.WriteBooleanValue(ShowDistributionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.StringStatsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsAggregate.g.cs index 91cc63038f0..9934bbdd068 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsAggregate.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class StringTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSumOtherDocCount = System.Text.Json.JsonEncodedText.Encode("sum_other_doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSumOtherDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSumOtherDocCount.TryReadProperty(ref reader, options, PropSumOtherDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Meta = propMeta.Value, + SumOtherDocCount = propSumOtherDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSumOtherDocCount, value.SumOtherDocCount, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Result of a terms aggregation when the field is a string. /// /// -public sealed partial class StringTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringTermsAggregateConverter))] +public sealed partial class StringTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count_error_upper_bound")] - public long? DocCountErrorUpperBound { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("sum_other_doc_count")] - public long? SumOtherDocCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public StringTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StringTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public long? SumOtherDocCount { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "sterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsBucket.g.cs index 72ce873ca08..6a0f92a8364 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/StringTermsBucket.g.cs @@ -17,79 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class StringTermsBucketConverter : JsonConverter +internal sealed partial class StringTermsBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override StringTermsBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.StringTermsBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - long? docCountErrorUpperBound = default; - Elastic.Clients.Elasticsearch.FieldValue key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "doc_count_error_upper_bound") - { - docCountErrorUpperBound = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new StringTermsBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, DocCountErrorUpperBound = docCountErrorUpperBound, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.StringTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, StringTermsBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.StringTermsBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'StringTermsBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(StringTermsBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.StringTermsBucketConverter))] public sealed partial class StringTermsBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StringTermsBucket(long docCount, Elastic.Clients.Elasticsearch.FieldValue key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public StringTermsBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StringTermsBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StringTermsBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public long? DocCountErrorUpperBound { get; init; } - public Elastic.Clients.Elasticsearch.FieldValue Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.FieldValue Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregate.g.cs index 23cb1250502..750014f9735 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregate.g.cs @@ -17,25 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SumAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SumAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SumAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SumAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Sum aggregation result. value is always present and is zero if there were no values to process. /// /// -public sealed partial class SumAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SumAggregateConverter))] +public sealed partial class SumAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public SumAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SumAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SumAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "sum"; /// /// @@ -43,8 +120,10 @@ public sealed partial class SumAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs index cd574e0104a..7ae8a5328df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SumAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SumAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SumAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SumAggregationConverter))] public sealed partial class SumAggregation { +#if NET7_0_OR_GREATER + public SumAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SumAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,49 +122,38 @@ public sealed partial class SumAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SumAggregation sumAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Sum(sumAggregation); } -public sealed partial class SumAggregationDescriptor : SerializableDescriptor> +public readonly partial struct SumAggregationDescriptor { - internal SumAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.SumAggregation Instance { get; init; } - public SumAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public SumAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public SumAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -95,16 +161,16 @@ public SumAggregationDescriptor Field(Expression /// - public SumAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SumAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -113,112 +179,72 @@ public SumAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public SumAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public SumAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SumAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SumAggregationDescriptor : SerializableDescriptor +public readonly partial struct SumAggregationDescriptor { - internal SumAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.SumAggregation Instance { get; init; } - public SumAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public SumAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public SumAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -226,16 +252,16 @@ public SumAggregationDescriptor Field(Expression /// - public SumAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SumAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -244,73 +270,40 @@ public SumAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public SumAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public SumAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public SumAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SumAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SumAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SumAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumBucketAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumBucketAggregation.g.cs index 62d742e21e0..fc7136321e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumBucketAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/SumBucketAggregation.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class SumBucketAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketsPath = System.Text.Json.JsonEncodedText.Encode("buckets_path"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGapPolicy = System.Text.Json.JsonEncodedText.Encode("gap_policy"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketsPath = default; + LocalJsonValue propFormat = default; + LocalJsonValue propGapPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketsPath.TryReadProperty(ref reader, options, PropBucketsPath, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propGapPolicy.TryReadProperty(ref reader, options, PropGapPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketsPath = propBucketsPath.Value, + Format = propFormat.Value, + GapPolicy = propGapPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketsPath, value.BucketsPath, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropGapPolicy, value.GapPolicy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationConverter))] public sealed partial class SumBucketAggregation { +#if NET7_0_OR_GREATER + public SumBucketAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public SumBucketAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SumBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - [JsonInclude, JsonPropertyName("buckets_path")] - public Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPath { get; set; } + public object? BucketsPath { get; set; } /// /// @@ -43,7 +112,6 @@ public sealed partial class SumBucketAggregation /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -51,33 +119,37 @@ public sealed partial class SumBucketAggregation /// Policy to apply when gaps are found in the data. /// /// - [JsonInclude, JsonPropertyName("gap_policy")] public Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicy { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(SumBucketAggregation sumBucketAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.SumBucket(sumBucketAggregation); } -public sealed partial class SumBucketAggregationDescriptor : SerializableDescriptor +public readonly partial struct SumBucketAggregationDescriptor { - internal SumBucketAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation instance) + { + Instance = instance; + } - public SumBucketAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SumBucketAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? BucketsPathValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? GapPolicyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation(Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Path to the buckets that contain one set of values to correlate. /// /// - public SumBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch.Aggregations.BucketsPath? bucketsPath) + public Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor BucketsPath(object? value) { - BucketsPathValue = bucketsPath; - return Self; + Instance.BucketsPath = value; + return this; } /// @@ -86,10 +158,10 @@ public SumBucketAggregationDescriptor BucketsPath(Elastic.Clients.Elasticsearch. /// If specified, the formatted value is returned in the aggregation’s value_as_string property. /// /// - public SumBucketAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -97,33 +169,22 @@ public SumBucketAggregationDescriptor Format(string? format) /// Policy to apply when gaps are found in the data. /// /// - public SumBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? gapPolicy) + public Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor GapPolicy(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy? value) { - GapPolicyValue = gapPolicy; - return Self; + Instance.GapPolicy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsPathValue is not null) - { - writer.WritePropertyName("buckets_path"); - JsonSerializer.Serialize(writer, BucketsPathValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (GapPolicyValue is not null) - { - writer.WritePropertyName("gap_policy"); - JsonSerializer.Serialize(writer, GapPolicyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.SumBucketAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigest.g.cs index cacf562c892..fbe7dbe1e69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigest.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TDigestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompression = System.Text.Json.JsonEncodedText.Encode("compression"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TDigest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompression = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompression.TryReadProperty(ref reader, options, PropCompression, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TDigest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Compression = propCompression.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TDigest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompression, value.Compression, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TDigestConverter))] public sealed partial class TDigest { +#if NET7_0_OR_GREATER + public TDigest() + { + } +#endif +#if !NET7_0_OR_GREATER + public TDigest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TDigest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - [JsonInclude, JsonPropertyName("compression")] public int? Compression { get; set; } } -public sealed partial class TDigestDescriptor : SerializableDescriptor +public readonly partial struct TDigestDescriptor { - internal TDigestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TDigest Instance { get; init; } - public TDigestDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TDigestDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TDigest instance) { + Instance = instance; } - private int? CompressionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TDigestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TDigest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TDigest instance) => new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TDigest(Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor descriptor) => descriptor.Instance; /// /// /// Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of memory usage and approximation error. /// /// - public TDigestDescriptor Compression(int? compression) + public Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor Compression(int? value) { - CompressionValue = compression; - return Self; + Instance.Compression = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TDigest Build(System.Action? action) { - writer.WriteStartObject(); - if (CompressionValue.HasValue) + if (action is null) { - writer.WritePropertyName("compression"); - writer.WriteNumberValue(CompressionValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.TDigest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TDigestDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TDigest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentileRanksAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentileRanksAggregate.g.cs index b38f73b6d5a..09441ba8409 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentileRanksAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentileRanksAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TDigestPercentileRanksAggregate : IAggregate +internal sealed partial class TDigestPercentileRanksAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("values")] - public Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentileRanksAggregateConverter))] +public sealed partial class TDigestPercentileRanksAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TDigestPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Aggregations.Percentiles values) + { + Values = values; + } +#if NET7_0_OR_GREATER + public TDigestPercentileRanksAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TDigestPercentileRanksAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TDigestPercentileRanksAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "tdigest_percentile_ranks"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentilesAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentilesAggregate.g.cs index 4a7003596af..c5e6cbeee95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentilesAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TDigestPercentilesAggregate.g.cs @@ -17,20 +17,92 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TDigestPercentilesAggregate : IAggregate +internal sealed partial class TDigestPercentilesAggregateConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("values")] - public Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TDigestPercentilesAggregateConverter))] +public sealed partial class TDigestPercentilesAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TDigestPercentilesAggregate(Elastic.Clients.Elasticsearch.Aggregations.Percentiles values) + { + Values = values; + } +#if NET7_0_OR_GREATER + public TDigestPercentilesAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TDigestPercentilesAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TDigestPercentilesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "tdigest_percentiles"; + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Aggregations.Percentiles Values { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregate.g.cs index a152f0c5218..0b2b1099dab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregate.g.cs @@ -17,22 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TTestAggregate : IAggregate +internal sealed partial class TTestAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TTestAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregateConverter))] +public sealed partial class TTestAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TTestAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public TTestAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TTestAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TTestAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "t_test"; + + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs index 7ef4ebb1ed1..ea0938c82e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TTestAggregation.g.cs @@ -17,88 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TTestAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropA = System.Text.Json.JsonEncodedText.Encode("a"); + private static readonly System.Text.Json.JsonEncodedText PropB = System.Text.Json.JsonEncodedText.Encode("b"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propA = default; + LocalJsonValue propB = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propA.TryReadProperty(ref reader, options, PropA, null)) + { + continue; + } + + if (propB.TryReadProperty(ref reader, options, PropB, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + A = propA.Value, + B = propB.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropA, value.A, null, null); + writer.WriteProperty(options, PropB, value.B, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationConverter))] public sealed partial class TTestAggregation { +#if NET7_0_OR_GREATER + public TTestAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public TTestAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Test population A. /// /// - [JsonInclude, JsonPropertyName("a")] - public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? a { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? A { get; set; } /// /// /// Test population B. /// /// - [JsonInclude, JsonPropertyName("b")] - public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? b { get; set; } + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? B { get; set; } /// /// /// The type of test. /// /// - [JsonInclude, JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.Aggregations.TTestType? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TTestAggregation tTestAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.TTest(tTestAggregation); } -public sealed partial class TTestAggregationDescriptor : SerializableDescriptor> +public readonly partial struct TTestAggregationDescriptor { - internal TTestAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation Instance { get; init; } - public TTestAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TTestAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? aValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor aDescriptor { get; set; } - private Action> aDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? bValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor bDescriptor { get; set; } - private Action> bDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TTestType? TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TTestAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Test population A. /// /// - public TTestAggregationDescriptor a(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? a) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor A(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? value) { - aDescriptor = null; - aDescriptorAction = null; - aValue = a; - return Self; + Instance.A = value; + return this; } - public TTestAggregationDescriptor a(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) - { - aValue = null; - aDescriptorAction = null; - aDescriptor = descriptor; - return Self; - } - - public TTestAggregationDescriptor a(Action> configure) + /// + /// + /// Test population A. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor A(System.Action> action) { - aValue = null; - aDescriptor = null; - aDescriptorAction = configure; - return Self; + Instance.A = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } /// @@ -106,28 +167,21 @@ public TTestAggregationDescriptor a(Action /// - public TTestAggregationDescriptor b(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? b) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor B(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? value) { - bDescriptor = null; - bDescriptorAction = null; - bValue = b; - return Self; + Instance.B = value; + return this; } - public TTestAggregationDescriptor b(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) - { - bValue = null; - bDescriptorAction = null; - bDescriptor = descriptor; - return Self; - } - - public TTestAggregationDescriptor b(Action> configure) + /// + /// + /// Test population B. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor B(System.Action> action) { - bValue = null; - bDescriptor = null; - bDescriptorAction = configure; - return Self; + Instance.B = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } /// @@ -135,100 +189,76 @@ public TTestAggregationDescriptor b(Action /// - public TTestAggregationDescriptor Type(Elastic.Clients.Elasticsearch.Aggregations.TTestType? type) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor Type(Elastic.Clients.Elasticsearch.Aggregations.TTestType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (aDescriptor is not null) - { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, aDescriptor, options); - } - else if (aDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(aDescriptorAction), options); - } - else if (aValue is not null) - { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, aValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (bDescriptor is not null) - { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, bDescriptor, options); - } - else if (bDescriptorAction is not null) - { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(bDescriptorAction), options); - } - else if (bValue is not null) - { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, bValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TTestAggregationDescriptor : SerializableDescriptor +public readonly partial struct TTestAggregationDescriptor { - internal TTestAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TTestAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation instance) + { + Instance = instance; + } - public TTestAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TTestAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? aValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor aDescriptor { get; set; } - private Action aDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? bValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor bDescriptor { get; set; } - private Action bDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TTestType? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Test population A. /// /// - public TTestAggregationDescriptor a(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? a) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor A(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? value) { - aDescriptor = null; - aDescriptorAction = null; - aValue = a; - return Self; + Instance.A = value; + return this; } - public TTestAggregationDescriptor a(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) + /// + /// + /// Test population A. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor A(System.Action action) { - aValue = null; - aDescriptorAction = null; - aDescriptor = descriptor; - return Self; + Instance.A = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } - public TTestAggregationDescriptor a(Action configure) + /// + /// + /// Test population A. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor A(System.Action> action) { - aValue = null; - aDescriptor = null; - aDescriptorAction = configure; - return Self; + Instance.A = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } /// @@ -236,28 +266,32 @@ public TTestAggregationDescriptor a(Action /// - public TTestAggregationDescriptor b(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? b) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor B(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation? value) { - bDescriptor = null; - bDescriptorAction = null; - bValue = b; - return Self; + Instance.B = value; + return this; } - public TTestAggregationDescriptor b(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) + /// + /// + /// Test population B. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor B(System.Action action) { - bValue = null; - bDescriptorAction = null; - bDescriptor = descriptor; - return Self; + Instance.B = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } - public TTestAggregationDescriptor b(Action configure) + /// + /// + /// Test population B. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor B(System.Action> action) { - bValue = null; - bDescriptor = null; - bDescriptorAction = configure; - return Self; + Instance.B = Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor.Build(action); + return this; } /// @@ -265,53 +299,22 @@ public TTestAggregationDescriptor b(Action /// - public TTestAggregationDescriptor Type(Elastic.Clients.Elasticsearch.Aggregations.TTestType? type) + public Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor Type(Elastic.Clients.Elasticsearch.Aggregations.TTestType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (aDescriptor is not null) - { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, aDescriptor, options); - } - else if (aDescriptorAction is not null) - { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(aDescriptorAction), options); - } - else if (aValue is not null) - { - writer.WritePropertyName("a"); - JsonSerializer.Serialize(writer, aValue, options); - } - - if (bDescriptor is not null) - { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, bDescriptor, options); - } - else if (bDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(bDescriptorAction), options); - } - else if (bValue is not null) - { - writer.WritePropertyName("b"); - JsonSerializer.Serialize(writer, bValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TTestAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs index f49f740db06..8983bba4649 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs @@ -17,24 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TermsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollectMode = System.Text.Json.JsonEncodedText.Encode("collect_mode"); + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropExecutionHint = System.Text.Json.JsonEncodedText.Encode("execution_hint"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropMissingBucket = System.Text.Json.JsonEncodedText.Encode("missing_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropMissingOrder = System.Text.Json.JsonEncodedText.Encode("missing_order"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropShowTermDocCountError = System.Text.Json.JsonEncodedText.Encode("show_term_doc_count_error"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollectMode = default; + LocalJsonValue propExclude = default; + LocalJsonValue propExecutionHint = default; + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propInclude = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propMissing = default; + LocalJsonValue propMissingBucket = default; + LocalJsonValue propMissingOrder = default; + LocalJsonValue>?> propOrder = default; + LocalJsonValue propScript = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propShowTermDocCountError = default; + LocalJsonValue propSize = default; + LocalJsonValue propValueType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollectMode.TryReadProperty(ref reader, options, PropCollectMode, null)) + { + continue; + } + + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propExecutionHint.TryReadProperty(ref reader, options, PropExecutionHint, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propMissingBucket.TryReadProperty(ref reader, options, PropMissingBucket, null)) + { + continue; + } + + if (propMissingOrder.TryReadProperty(ref reader, options, PropMissingOrder, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propShowTermDocCountError.TryReadProperty(ref reader, options, PropShowTermDocCountError, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollectMode = propCollectMode.Value, + Exclude = propExclude.Value, + ExecutionHint = propExecutionHint.Value, + Field = propField.Value, + Format = propFormat.Value, + Include = propInclude.Value, + MinDocCount = propMinDocCount.Value, + Missing = propMissing.Value, + MissingBucket = propMissingBucket.Value, + MissingOrder = propMissingOrder.Value, + Order = propOrder.Value, + Script = propScript.Value, + ShardMinDocCount = propShardMinDocCount.Value, + ShardSize = propShardSize.Value, + ShowTermDocCountError = propShowTermDocCountError.Value, + Size = propSize.Value, + ValueType = propValueType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollectMode, value.CollectMode, null, null); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropExecutionHint, value.ExecutionHint, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropMissingBucket, value.MissingBucket, null, null); + writer.WriteProperty(options, PropMissingOrder, value.MissingOrder, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropShowTermDocCountError, value.ShowTermDocCountError, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationConverter))] public sealed partial class TermsAggregation { +#if NET7_0_OR_GREATER + public TermsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public TermsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Determines how child aggregations should be calculated: breadth-first or depth-first. /// /// - [JsonInclude, JsonPropertyName("collect_mode")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectMode { get; set; } /// @@ -43,7 +238,6 @@ public sealed partial class TermsAggregation /// Accepts regular expressions and partitions. /// /// - [JsonInclude, JsonPropertyName("exclude")] public Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? Exclude { get; set; } /// @@ -51,7 +245,6 @@ public sealed partial class TermsAggregation /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - [JsonInclude, JsonPropertyName("execution_hint")] public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHint { get; set; } /// @@ -59,9 +252,7 @@ public sealed partial class TermsAggregation /// The field from which to return terms. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -70,7 +261,6 @@ public sealed partial class TermsAggregation /// Accepts regular expressions and partitions. /// /// - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? Include { get; set; } /// @@ -78,7 +268,6 @@ public sealed partial class TermsAggregation /// Only return values that are found in more than min_doc_count hits. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public int? MinDocCount { get; set; } /// @@ -87,11 +276,8 @@ public sealed partial class TermsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("missing_bucket")] + public object? Missing { get; set; } public bool? MissingBucket { get; set; } - [JsonInclude, JsonPropertyName("missing_order")] public Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrder { get; set; } /// @@ -100,10 +286,7 @@ public sealed partial class TermsAggregation /// Defaults to sorting by descending document count. /// /// - [JsonInclude, JsonPropertyName("order")] - [SingleOrManyCollectionConverter(typeof(KeyValuePair))] - public ICollection>? Order { get; set; } - [JsonInclude, JsonPropertyName("script")] + public System.Collections.Generic.ICollection>? Order { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -112,7 +295,6 @@ public sealed partial class TermsAggregation /// Terms will only be considered if their local shard frequency within the set is higher than the shard_min_doc_count. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public long? ShardMinDocCount { get; set; } /// @@ -121,7 +303,6 @@ public sealed partial class TermsAggregation /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -129,7 +310,6 @@ public sealed partial class TermsAggregation /// Set to true to return the doc_count_error_upper_bound, which is an upper bound to the error on the doc_count returned by each shard. /// /// - [JsonInclude, JsonPropertyName("show_term_doc_count_error")] public bool? ShowTermDocCountError { get; set; } /// @@ -137,7 +317,6 @@ public sealed partial class TermsAggregation /// The number of buckets returned out of the overall terms list. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -145,51 +324,37 @@ public sealed partial class TermsAggregation /// Coerced unmapped fields into the specified type. /// /// - [JsonInclude, JsonPropertyName("value_type")] public string? ValueType { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Terms(termsAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Terms(termsAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy.Terms(termsAggregation); } -public sealed partial class TermsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct TermsAggregationDescriptor { - internal TermsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation instance) + { + Instance = instance; + } - public TermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private int? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private ICollection>? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private bool? ShowTermDocCountErrorValue { get; set; } - private int? SizeValue { get; set; } - private string? ValueTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Determines how child aggregations should be calculated: breadth-first or depth-first. /// /// - public TermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? collectMode) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? value) { - CollectModeValue = collectMode; - return Self; + Instance.CollectMode = value; + return this; } /// @@ -198,10 +363,10 @@ public TermsAggregationDescriptor CollectMode(Elastic.Clients.Elastic /// Accepts regular expressions and partitions. /// /// - public TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// @@ -209,10 +374,10 @@ public TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsear /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - public TermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - ExecutionHintValue = executionHint; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -220,10 +385,10 @@ public TermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elast /// The field from which to return terms. /// /// - public TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -231,27 +396,16 @@ public TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch /// The field from which to return terms. /// /// - public TermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - /// - /// - /// The field from which to return terms. - /// - /// - public TermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Format(string? value) { - FieldValue = field; - return Self; - } - - public TermsAggregationDescriptor Format(string? format) - { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -260,10 +414,10 @@ public TermsAggregationDescriptor Format(string? format) /// Accepts regular expressions and partitions. /// /// - public TermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -271,10 +425,10 @@ public TermsAggregationDescriptor Include(Elastic.Clients.Elasticsear /// Only return values that are found in more than min_doc_count hits. /// /// - public TermsAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -283,22 +437,22 @@ public TermsAggregationDescriptor MinDocCount(int? minDocCount) /// By default, documents without a value are ignored. /// /// - public TermsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public TermsAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } /// @@ -307,34 +461,66 @@ public TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasti /// Defaults to sorting by descending document count. /// /// - public TermsAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) + { + Instance.Order = value; + return this; + } + + /// + /// + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order() + { + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; + } + + /// + /// + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order(System.Action>? action) + { + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) + { + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) { - OrderValue = order; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TermsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -343,10 +529,10 @@ public TermsAggregationDescriptor Script(Actionshard_min_doc_count. /// /// - public TermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -355,10 +541,10 @@ public TermsAggregationDescriptor ShardMinDocCount(long? shardMinDocC /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public TermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -366,10 +552,10 @@ public TermsAggregationDescriptor ShardSize(int? shardSize) /// Set to true to return the doc_count_error_upper_bound, which is an upper bound to the error on the doc_count returned by each shard. /// /// - public TermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShowTermDocCountError(bool? value = true) { - ShowTermDocCountErrorValue = showTermDocCountError; - return Self; + Instance.ShowTermDocCountError = value; + return this; } /// @@ -377,10 +563,10 @@ public TermsAggregationDescriptor ShowTermDocCountError(bool? showTer /// The number of buckets returned out of the overall terms list. /// /// - public TermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -388,168 +574,54 @@ public TermsAggregationDescriptor Size(int? size) /// Coerced unmapped fields into the specified type. /// /// - public TermsAggregationDescriptor ValueType(string? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ValueType(string? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (CollectModeValue is not null) - { - writer.WritePropertyName("collect_mode"); - JsonSerializer.Serialize(writer, CollectModeValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (ShowTermDocCountErrorValue.HasValue) - { - writer.WritePropertyName("show_term_doc_count_error"); - writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); - } - - if (SizeValue.HasValue) + if (action is null) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(ValueTypeValue)) - { - writer.WritePropertyName("value_type"); - writer.WriteStringValue(ValueTypeValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermsAggregationDescriptor : SerializableDescriptor +public readonly partial struct TermsAggregationDescriptor { - internal TermsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation instance) + { + Instance = instance; + } - public TermsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? CollectModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? ExecutionHintValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? IncludeValue { get; set; } - private int? MinDocCountValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private bool? MissingBucketValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? MissingOrderValue { get; set; } - private ICollection>? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? ShardSizeValue { get; set; } - private bool? ShowTermDocCountErrorValue { get; set; } - private int? SizeValue { get; set; } - private string? ValueTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Determines how child aggregations should be calculated: breadth-first or depth-first. /// /// - public TermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? collectMode) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode? value) { - CollectModeValue = collectMode; - return Self; + Instance.CollectMode = value; + return this; } /// @@ -558,10 +630,10 @@ public TermsAggregationDescriptor CollectMode(Elastic.Clients.Elasticsearch.Aggr /// Accepts regular expressions and partitions. /// /// - public TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? exclude) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregations.TermsExclude? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// @@ -569,21 +641,10 @@ public TermsAggregationDescriptor Exclude(Elastic.Clients.Elasticsearch.Aggregat /// Determines whether the aggregation will use field values directly or global ordinals. /// /// - public TermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? executionHint) - { - ExecutionHintValue = executionHint; - return Self; - } - - /// - /// - /// The field from which to return terms. - /// - /// - public TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ExecutionHint(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint? value) { - FieldValue = field; - return Self; + Instance.ExecutionHint = value; + return this; } /// @@ -591,10 +652,10 @@ public TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? fie /// The field from which to return terms. /// /// - public TermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -602,16 +663,16 @@ public TermsAggregationDescriptor Field(Expression /// - public TermsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -620,10 +681,10 @@ public TermsAggregationDescriptor Format(string? format) /// Accepts regular expressions and partitions. /// /// - public TermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? include) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregations.TermsInclude? value) { - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } /// @@ -631,10 +692,10 @@ public TermsAggregationDescriptor Include(Elastic.Clients.Elasticsearch.Aggregat /// Only return values that are found in more than min_doc_count hits. /// /// - public TermsAggregationDescriptor MinDocCount(int? minDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MinDocCount(int? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -643,22 +704,22 @@ public TermsAggregationDescriptor MinDocCount(int? minDocCount) /// By default, documents without a value are ignored. /// /// - public TermsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public TermsAggregationDescriptor MissingBucket(bool? missingBucket = true) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MissingBucket(bool? value = true) { - MissingBucketValue = missingBucket; - return Self; + Instance.MissingBucket = value; + return this; } - public TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? missingOrder) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder? value) { - MissingOrderValue = missingOrder; - return Self; + Instance.MissingOrder = value; + return this; } /// @@ -667,34 +728,78 @@ public TermsAggregationDescriptor MissingOrder(Elastic.Clients.Elasticsearch.Agg /// Defaults to sorting by descending document count. /// /// - public TermsAggregationDescriptor Order(ICollection>? order) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order(System.Collections.Generic.ICollection>? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + /// + /// + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(null); + return this; } - public TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order(System.Action? action) + { + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; + } + + /// + /// + /// Specifies the sort order of the buckets. + /// Defaults to sorting by descending document count. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Order(System.Action>? action) + { + Instance.Order = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfFieldSortOrder.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor AddOrder(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.SortOrder value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public TermsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor AddOrder(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.SortOrder value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Order ??= new System.Collections.Generic.List>(); + Instance.Order.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -703,10 +808,10 @@ public TermsAggregationDescriptor Script(Actionshard_min_doc_count. /// /// - public TermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -715,10 +820,10 @@ public TermsAggregationDescriptor ShardMinDocCount(long? shardMinDocCount) /// By default, shard_size will be automatically estimated based on the number of shards and the size parameter. /// /// - public TermsAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -726,10 +831,10 @@ public TermsAggregationDescriptor ShardSize(int? shardSize) /// Set to true to return the doc_count_error_upper_bound, which is an upper bound to the error on the doc_count returned by each shard. /// /// - public TermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountError = true) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ShowTermDocCountError(bool? value = true) { - ShowTermDocCountErrorValue = showTermDocCountError; - return Self; + Instance.ShowTermDocCountError = value; + return this; } /// @@ -737,10 +842,10 @@ public TermsAggregationDescriptor ShowTermDocCountError(bool? showTermDocCountEr /// The number of buckets returned out of the overall terms list. /// /// - public TermsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -748,127 +853,22 @@ public TermsAggregationDescriptor Size(int? size) /// Coerced unmapped fields into the specified type. /// /// - public TermsAggregationDescriptor ValueType(string? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor ValueType(string? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (CollectModeValue is not null) - { - writer.WritePropertyName("collect_mode"); - JsonSerializer.Serialize(writer, CollectModeValue, options); - } - - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (ExecutionHintValue is not null) - { - writer.WritePropertyName("execution_hint"); - JsonSerializer.Serialize(writer, ExecutionHintValue, options); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IncludeValue is not null) + if (action is null) { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (MissingBucketValue.HasValue) - { - writer.WritePropertyName("missing_bucket"); - writer.WriteBooleanValue(MissingBucketValue.Value); - } - - if (MissingOrderValue is not null) - { - writer.WritePropertyName("missing_order"); - JsonSerializer.Serialize(writer, MissingOrderValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize>(OrderValue, writer, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (ShowTermDocCountErrorValue.HasValue) - { - writer.WritePropertyName("show_term_doc_count_error"); - writer.WriteBooleanValue(ShowTermDocCountErrorValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (!string.IsNullOrEmpty(ValueTypeValue)) - { - writer.WritePropertyName("value_type"); - writer.WriteStringValue(ValueTypeValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsPartition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsPartition.g.cs new file mode 100644 index 00000000000..c6e71b9673f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsPartition.g.cs @@ -0,0 +1,121 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +internal sealed partial class TermsPartitionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumPartitions = System.Text.Json.JsonEncodedText.Encode("num_partitions"); + private static readonly System.Text.Json.JsonEncodedText PropPartition = System.Text.Json.JsonEncodedText.Encode("partition"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsPartition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumPartitions = default; + LocalJsonValue propPartition = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumPartitions.TryReadProperty(ref reader, options, PropNumPartitions, null)) + { + continue; + } + + if (propPartition.TryReadProperty(ref reader, options, PropPartition, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TermsPartition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumPartitions = propNumPartitions.Value, + Partition = propPartition.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsPartition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumPartitions, value.NumPartitions, null, null); + writer.WriteProperty(options, PropPartition, value.Partition, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TermsPartitionConverter))] +public sealed partial class TermsPartition +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsPartition(long numPartitions, long partition) + { + NumPartitions = numPartitions; + Partition = partition; + } +#if NET7_0_OR_GREATER + public TermsPartition() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermsPartition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsPartition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The number of partitions. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long NumPartitions { get; set; } + + /// + /// + /// The partition number for this request. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Partition { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TestPopulation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TestPopulation.g.cs index dd0b83b9cac..53f5f7987de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TestPopulation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TestPopulation.g.cs @@ -17,62 +17,142 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TestPopulationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TestPopulation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFilter = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Filter = propFilter.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TestPopulation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationConverter))] public sealed partial class TestPopulation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestPopulation(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TestPopulation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TestPopulation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field to aggregate. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// A filter used to define a set of records to run unpaired t-test on. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } } -public sealed partial class TestPopulationDescriptor : SerializableDescriptor> +public readonly partial struct TestPopulationDescriptor { - internal TestPopulationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TestPopulation Instance { get; init; } - public TestPopulationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestPopulationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestPopulationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) => descriptor.Instance; /// /// /// The field to aggregate. /// /// - public TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -80,21 +160,21 @@ public TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.F /// The field to aggregate. /// /// - public TestPopulationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to aggregate. + /// A filter used to define a set of records to run unpaired t-test on. /// /// - public TestPopulationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -102,120 +182,67 @@ public TestPopulationDescriptor Field(Expression /// - public TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Filter(System.Action> action) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public TestPopulationDescriptor Filter(Action> configure) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script() { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script(System.Action? action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TestPopulation Build(System.Action> action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public TestPopulationDescriptor Script(Action configure) - { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; - } +public readonly partial struct TestPopulationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.TestPopulation Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestPopulationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation instance) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + Instance = instance; } -} -public sealed partial class TestPopulationDescriptor : SerializableDescriptor -{ - internal TestPopulationDescriptor(Action configure) => configure.Invoke(this); - - public TestPopulationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TestPopulationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TestPopulation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor descriptor) => descriptor.Instance; /// /// /// The field to aggregate. /// /// - public TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -223,21 +250,21 @@ public TestPopulationDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to aggregate. /// /// - public TestPopulationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to aggregate. + /// A filter used to define a set of records to run unpaired t-test on. /// /// - public TestPopulationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -245,91 +272,46 @@ public TestPopulationDescriptor Field(Expression /// - public TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Filter(System.Action action) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public TestPopulationDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public TestPopulationDescriptor Filter(Action configure) + /// + /// + /// A filter used to define a set of records to run unpaired t-test on. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public TestPopulationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TestPopulationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TestPopulation Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TestPopulationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TestPopulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregate.g.cs index bd927b7576c..72fd05ab0b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TimeSeriesAggregate : IAggregate +internal sealed partial class TimeSeriesAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregateConverter))] +public sealed partial class TimeSeriesAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSeriesAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public TimeSeriesAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TimeSeriesAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeSeriesAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "time_series"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregation.g.cs index 9e17f41186b..f3928f4f05a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesAggregation.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TimeSeriesAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropKeyed = System.Text.Json.JsonEncodedText.Encode("keyed"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propKeyed = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propKeyed.TryReadProperty(ref reader, options, PropKeyed, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Keyed = propKeyed.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropKeyed, value.Keyed, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationConverter))] public sealed partial class TimeSeriesAggregation { +#if NET7_0_OR_GREATER + public TimeSeriesAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public TimeSeriesAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true to associate a unique string key with each bucket and returns the ranges as a hash rather than an array. /// /// - [JsonInclude, JsonPropertyName("keyed")] public bool? Keyed { get; set; } /// @@ -42,32 +102,37 @@ public sealed partial class TimeSeriesAggregation /// The maximum number of results to return. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TimeSeriesAggregation timeSeriesAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.TimeSeries(timeSeriesAggregation); } -public sealed partial class TimeSeriesAggregationDescriptor : SerializableDescriptor +public readonly partial struct TimeSeriesAggregationDescriptor { - internal TimeSeriesAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation Instance { get; init; } - public TimeSeriesAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSeriesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation instance) { + Instance = instance; } - private bool? KeyedValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSeriesAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true to associate a unique string key with each bucket and returns the ranges as a hash rather than an array. /// /// - public TimeSeriesAggregationDescriptor Keyed(bool? keyed = true) + public Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor Keyed(bool? value = true) { - KeyedValue = keyed; - return Self; + Instance.Keyed = value; + return this; } /// @@ -75,27 +140,22 @@ public TimeSeriesAggregationDescriptor Keyed(bool? keyed = true) /// The maximum number of results to return. /// /// - public TimeSeriesAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (KeyedValue.HasValue) + if (action is null) { - writer.WritePropertyName("keyed"); - writer.WriteBooleanValue(KeyedValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesBucket.g.cs index 3b391a5494c..f18116bb2b3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TimeSeriesBucket.g.cs @@ -17,71 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class TimeSeriesBucketConverter : JsonConverter +internal sealed partial class TimeSeriesBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override TimeSeriesBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary key = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue> propKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propKey.TryReadProperty(ref reader, options, PropKey, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new TimeSeriesBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value + }; } - public override void Write(Utf8JsonWriter writer, TimeSeriesBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'TimeSeriesBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(TimeSeriesBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TimeSeriesBucketConverter))] public sealed partial class TimeSeriesBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSeriesBucket(long docCount, System.Collections.Generic.IReadOnlyDictionary key) + { + DocCount = docCount; + Key = key; + } +#if NET7_0_OR_GREATER + public TimeSeriesBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TimeSeriesBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeSeriesBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary Key { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Key { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregate.g.cs index 5a7011780ff..108a2ceafc2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TopHitsAggregate : IAggregate +internal sealed partial class TopHitsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHits = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregateConverter))] +public sealed partial class TopHitsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHitsAggregate(Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata hits) + { + Hits = hits; + } +#if NET7_0_OR_GREATER + public TopHitsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopHitsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopHitsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "top_hits"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs index 60bdfb33f43..7f7e03ee0f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopHitsAggregation.g.cs @@ -17,32 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TopHitsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocvalueFields = System.Text.Json.JsonEncodedText.Encode("docvalue_fields"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNoPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("seq_no_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropTrackScores = System.Text.Json.JsonEncodedText.Encode("track_scores"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDocvalueFields = default; + LocalJsonValue propExplain = default; + LocalJsonValue propField = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propFrom = default; + LocalJsonValue propHighlight = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propSeqNoPrimaryTerm = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propTrackScores = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocvalueFields.TryReadProperty(ref reader, options, PropDocvalueFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSeqNoPrimaryTerm.TryReadProperty(ref reader, options, PropSeqNoPrimaryTerm, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propTrackScores.TryReadProperty(ref reader, options, PropTrackScores, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocvalueFields = propDocvalueFields.Value, + Explain = propExplain.Value, + Field = propField.Value, + Fields = propFields.Value, + From = propFrom.Value, + Highlight = propHighlight.Value, + Missing = propMissing.Value, + Script = propScript.Value, + ScriptFields = propScriptFields.Value, + SeqNoPrimaryTerm = propSeqNoPrimaryTerm.Value, + Size = propSize.Value, + Sort = propSort.Value, + Source = propSource.Value, + StoredFields = propStoredFields.Value, + TrackScores = propTrackScores.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocvalueFields, value.DocvalueFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSeqNoPrimaryTerm, value.SeqNoPrimaryTerm, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropTrackScores, value.TrackScores, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationConverter))] public sealed partial class TopHitsAggregation { +#if NET7_0_OR_GREATER + public TopHitsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public TopHitsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Fields for which to return doc values. /// /// - [JsonInclude, JsonPropertyName("docvalue_fields")] - public ICollection? DocvalueFields { get; set; } + public System.Collections.Generic.ICollection? DocvalueFields { get; set; } /// /// /// If true, returns detailed information about score computation as part of a hit. /// /// - [JsonInclude, JsonPropertyName("explain")] public bool? Explain { get; set; } /// @@ -50,7 +235,6 @@ public sealed partial class TopHitsAggregation /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -59,15 +243,13 @@ public sealed partial class TopHitsAggregation /// matching these patterns in the hits.fields property of the response. /// /// - [JsonInclude, JsonPropertyName("fields")] - public ICollection? Fields { get; set; } + public System.Collections.Generic.ICollection? Fields { get; set; } /// /// /// Starting document offset. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -75,7 +257,6 @@ public sealed partial class TopHitsAggregation /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. /// /// - [JsonInclude, JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Core.Search.Highlight? Highlight { get; set; } /// @@ -84,9 +265,7 @@ public sealed partial class TopHitsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -94,15 +273,13 @@ public sealed partial class TopHitsAggregation /// Returns the result of one or more script evaluations for each hit. /// /// - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } /// /// /// If true, returns sequence number and primary term of the last modification of each hit. /// /// - [JsonInclude, JsonPropertyName("seq_no_primary_term")] public bool? SeqNoPrimaryTerm { get; set; } /// @@ -110,7 +287,6 @@ public sealed partial class TopHitsAggregation /// The maximum number of top matching hits to return per bucket. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -119,16 +295,13 @@ public sealed partial class TopHitsAggregation /// By default, the hits are sorted by the score of the main query. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } /// /// /// Selects the fields of the source that are returned. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// @@ -136,8 +309,6 @@ public sealed partial class TopHitsAggregation /// Returns values for the specified stored fields (fields that use the store mapping option). /// /// - [JsonInclude, JsonPropertyName("stored_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } /// @@ -145,7 +316,6 @@ public sealed partial class TopHitsAggregation /// If true, calculates and returns document scores, even if the scores are not used for sorting. /// /// - [JsonInclude, JsonPropertyName("track_scores")] public bool? TrackScores { get; set; } /// @@ -153,89 +323,65 @@ public sealed partial class TopHitsAggregation /// If true, returns document version as part of a hit. /// /// - [JsonInclude, JsonPropertyName("version")] public bool? Version { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TopHitsAggregation topHitsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.TopHits(topHitsAggregation); } -public sealed partial class TopHitsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct TopHitsAggregationDescriptor { - internal TopHitsAggregationDescriptor(Action> configure) => configure.Invoke(this); - - public TopHitsAggregationDescriptor() : base() - { - } - - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action> DocvalueFieldsDescriptorAction { get; set; } - private Action>[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action> HighlightDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private bool? TrackScoresValue { get; set; } - private bool? VersionValue { get; set; } + internal Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHitsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHitsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Fields for which to return doc values. /// /// - public TopHitsAggregationDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.DocvalueFields = value; + return this; } - public TopHitsAggregationDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Fields for which to return doc values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public TopHitsAggregationDescriptor DocvalueFields(Action> configure) + /// + /// + /// Fields for which to return doc values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(params System.Action>[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public TopHitsAggregationDescriptor DocvalueFields(params Action>[] configure) - { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.DocvalueFields = items; + return this; } /// @@ -243,10 +389,10 @@ public TopHitsAggregationDescriptor DocvalueFields(params Actiontrue, returns detailed information about score computation as part of a hit. /// /// - public TopHitsAggregationDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -254,10 +400,10 @@ public TopHitsAggregationDescriptor Explain(bool? explain = true) /// The field on which to run the aggregation. /// /// - public TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -265,21 +411,22 @@ public TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsear /// The field on which to run the aggregation. /// /// - public TopHitsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field on which to run the aggregation. + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. /// /// - public TopHitsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Fields = value; + return this; } /// @@ -288,40 +435,28 @@ public TopHitsAggregationDescriptor Field(Expression /// - public TopHitsAggregationDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = [.. values]; + return this; } - public TopHitsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) - { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; - } - - public TopHitsAggregationDescriptor Fields(Action> configure) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public TopHitsAggregationDescriptor Fields(params Action>[] configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.Fields = items; + return this; } /// @@ -329,10 +464,10 @@ public TopHitsAggregationDescriptor Fields(params Action /// - public TopHitsAggregationDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -340,28 +475,21 @@ public TopHitsAggregationDescriptor From(int? from) /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. /// /// - public TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) - { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; - } - - public TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = value; + return this; } - public TopHitsAggregationDescriptor Highlight(Action> configure) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Highlight(System.Action> action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } /// @@ -370,34 +498,28 @@ public TopHitsAggregationDescriptor Highlight(Action /// - public TopHitsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TopHitsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -405,10 +527,46 @@ public TopHitsAggregationDescriptor Script(Action /// - public TopHitsAggregationDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields = value; + return this; + } + + /// + /// + /// Returns the result of one or more script evaluations for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } + + /// + /// + /// Returns the result of one or more script evaluations for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } /// @@ -416,10 +574,10 @@ public TopHitsAggregationDescriptor ScriptFields(Functrue, returns sequence number and primary term of the last modification of each hit. /// /// - public TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? value = true) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// @@ -427,10 +585,10 @@ public TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? seqNoPrima /// The maximum number of top matching hits to return per bucket. /// /// - public TopHitsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -439,40 +597,51 @@ public TopHitsAggregationDescriptor Size(int? size) /// By default, the hits are sorted by the score of the main query. /// /// - public TopHitsAggregationDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public TopHitsAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// Sort order of the top matching hits. + /// By default, the hits are sorted by the score of the main query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public TopHitsAggregationDescriptor Sort(Action> configure) + /// + /// + /// Sort order of the top matching hits. + /// By default, the hits are sorted by the score of the main query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } - public TopHitsAggregationDescriptor Sort(params Action>[] configure) + /// + /// + /// Selects the fields of the source that are returned. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Source = value; + return this; } /// @@ -480,10 +649,10 @@ public TopHitsAggregationDescriptor Sort(params Action /// - public TopHitsAggregationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - SourceValue = source; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// @@ -491,10 +660,21 @@ public TopHitsAggregationDescriptor Source(Elastic.Clients.Elasticsea /// Returns values for the specified stored fields (fields that use the store mapping option). /// /// - public TopHitsAggregationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - StoredFieldsValue = storedFields; - return Self; + Instance.StoredFields = value; + return this; + } + + /// + /// + /// Returns values for the specified stored fields (fields that use the store mapping option). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; } /// @@ -502,10 +682,10 @@ public TopHitsAggregationDescriptor StoredFields(Elastic.Clients.Elas /// If true, calculates and returns document scores, even if the scores are not used for sorting. /// /// - public TopHitsAggregationDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor TrackScores(bool? value = true) { - TrackScoresValue = trackScores; - return Self; + Instance.TrackScores = value; + return this; } /// @@ -513,285 +693,99 @@ public TopHitsAggregationDescriptor TrackScores(bool? trackScores = t /// If true, returns document version as part of a hit. /// /// - public TopHitsAggregationDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Version(bool? value = true) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); + return new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } +public readonly partial struct TopHitsAggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation Instance { get; init; } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHitsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHitsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class TopHitsAggregationDescriptor : SerializableDescriptor -{ - internal TopHitsAggregationDescriptor(Action configure) => configure.Invoke(this); - - public TopHitsAggregationDescriptor() : base() - { - } - - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action DocvalueFieldsDescriptorAction { get; set; } - private Action[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private bool? TrackScoresValue { get; set; } - private bool? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Fields for which to return doc values. /// /// - public TopHitsAggregationDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.DocvalueFields = value; + return this; } - public TopHitsAggregationDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Fields for which to return doc values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public TopHitsAggregationDescriptor DocvalueFields(Action configure) + /// + /// + /// Fields for which to return doc values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(params System.Action[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } - public TopHitsAggregationDescriptor DocvalueFields(params Action[] configure) + /// + /// + /// Fields for which to return doc values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor DocvalueFields(params System.Action>[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } /// @@ -799,10 +793,10 @@ public TopHitsAggregationDescriptor DocvalueFields(params Actiontrue, returns detailed information about score computation as part of a hit. /// /// - public TopHitsAggregationDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Explain(bool? value = true) { - ExplainValue = explain; - return Self; + Instance.Explain = value; + return this; } /// @@ -810,10 +804,10 @@ public TopHitsAggregationDescriptor Explain(bool? explain = true) /// The field on which to run the aggregation. /// /// - public TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -821,21 +815,22 @@ public TopHitsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? f /// The field on which to run the aggregation. /// /// - public TopHitsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field on which to run the aggregation. + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. /// /// - public TopHitsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Fields = value; + return this; } /// @@ -844,40 +839,46 @@ public TopHitsAggregationDescriptor Field(Expression /// - public TopHitsAggregationDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.Fields = [.. values]; + return this; } - public TopHitsAggregationDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(params System.Action[] actions) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public TopHitsAggregationDescriptor Fields(Action configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; + Instance.Fields = items; + return this; } - public TopHitsAggregationDescriptor Fields(params Action[] configure) + /// + /// + /// Array of wildcard (*) patterns. The request returns values for field names + /// matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Fields(params System.Action>[] actions) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; } /// @@ -885,10 +886,10 @@ public TopHitsAggregationDescriptor Fields(params Action /// - public TopHitsAggregationDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -896,28 +897,32 @@ public TopHitsAggregationDescriptor From(int? from) /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. /// /// - public TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.Highlight = value; + return this; } - public TopHitsAggregationDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Highlight(System.Action action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public TopHitsAggregationDescriptor Highlight(Action configure) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Highlight(System.Action> action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } /// @@ -926,34 +931,39 @@ public TopHitsAggregationDescriptor Highlight(Action /// - public TopHitsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Missing(object? value) + { + Instance.Missing = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - MissingValue = missing; - return Self; + Instance.Script = value; + return this; } - public TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TopHitsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TopHitsAggregationDescriptor Script(Action configure) + /// + /// + /// Returns the result of one or more script evaluations for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.ScriptFields = value; + return this; } /// @@ -961,10 +971,35 @@ public TopHitsAggregationDescriptor Script(Action /// - public TopHitsAggregationDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } + + /// + /// + /// Returns the result of one or more script evaluations for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } /// @@ -972,10 +1007,10 @@ public TopHitsAggregationDescriptor ScriptFields(Functrue, returns sequence number and primary term of the last modification of each hit. /// /// - public TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? value = true) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// @@ -983,10 +1018,10 @@ public TopHitsAggregationDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = tr /// The maximum number of top matching hits to return per bucket. /// /// - public TopHitsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -995,40 +1030,58 @@ public TopHitsAggregationDescriptor Size(int? size) /// By default, the hits are sorted by the score of the main query. /// /// - public TopHitsAggregationDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public TopHitsAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// Sort order of the top matching hits. + /// By default, the hits are sorted by the score of the main query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public TopHitsAggregationDescriptor Sort(Action configure) + /// + /// + /// Sort order of the top matching hits. + /// By default, the hits are sorted by the score of the main query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(params System.Action[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } - public TopHitsAggregationDescriptor Sort(params Action[] configure) + /// + /// + /// Sort order of the top matching hits. + /// By default, the hits are sorted by the score of the main query. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } /// @@ -1036,237 +1089,88 @@ public TopHitsAggregationDescriptor Sort(params Action /// - public TopHitsAggregationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } /// /// - /// Returns values for the specified stored fields (fields that use the store mapping option). + /// Selects the fields of the source that are returned. /// /// - public TopHitsAggregationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Source(System.Func action) { - StoredFieldsValue = storedFields; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// /// - /// If true, calculates and returns document scores, even if the scores are not used for sorting. + /// Selects the fields of the source that are returned. /// /// - public TopHitsAggregationDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - TrackScoresValue = trackScores; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// /// - /// If true, returns document version as part of a hit. + /// Returns values for the specified stored fields (fields that use the store mapping option). /// /// - public TopHitsAggregationDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - VersionValue = version; - return Self; + Instance.StoredFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Returns values for the specified stored fields (fields that use the store mapping option). + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + Instance.StoredFields = value; + return this; + } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + /// + /// + /// If true, calculates and returns document scores, even if the scores are not used for sorting. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor TrackScores(bool? value = true) + { + Instance.TrackScores = value; + return this; + } - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } + /// + /// + /// If true, returns document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } - if (VersionValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopHitsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetrics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetrics.g.cs index 13fa03ba28f..aca57615f22 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetrics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetrics.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TopMetricsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopMetrics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMetrics = default; + LocalJsonValue> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Metrics = propMetrics.Value, + Sort = propSort.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopMetrics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsConverter))] public sealed partial class TopMetrics { - [JsonInclude, JsonPropertyName("metrics")] - public IReadOnlyDictionary Metrics { get; init; } - [JsonInclude, JsonPropertyName("sort")] - public IReadOnlyCollection Sort { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetrics(System.Collections.Generic.IReadOnlyDictionary metrics, System.Collections.Generic.IReadOnlyCollection sort) + { + Metrics = metrics; + Sort = sort; + } +#if NET7_0_OR_GREATER + public TopMetrics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopMetrics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metrics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Sort { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregate.g.cs index 3675a8b9148..f6ffed0e7f1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class TopMetricsAggregate : IAggregate +internal sealed partial class TopMetricsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropTop = System.Text.Json.JsonEncodedText.Encode("top"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue> propTop = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTop.TryReadProperty(ref reader, options, PropTop, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Top = propTop.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTop, value.Top, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregateConverter))] +public sealed partial class TopMetricsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("top")] - public IReadOnlyCollection Top { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsAggregate(System.Collections.Generic.IReadOnlyCollection top) + { + Top = top; + } +#if NET7_0_OR_GREATER + public TopMetricsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopMetricsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopMetricsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Top { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "top_metrics"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs index d063b3c1be9..4a01cbeb7b4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsAggregation.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TopMetricsAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propMetrics = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Metrics = propMetrics.Value, + Missing = propMissing.Value, + Script = propScript.Value, + Size = propSize.Value, + Sort = propSort.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationConverter))] public sealed partial class TopMetricsAggregation { +#if NET7_0_OR_GREATER + public TopMetricsAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public TopMetricsAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -42,9 +138,7 @@ public sealed partial class TopMetricsAggregation /// The fields of the top document to return. /// /// - [JsonInclude, JsonPropertyName("metrics")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue))] - public ICollection? Metrics { get; set; } + public System.Collections.Generic.ICollection? Metrics { get; set; } /// /// @@ -52,9 +146,7 @@ public sealed partial class TopMetricsAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -62,7 +154,6 @@ public sealed partial class TopMetricsAggregation /// The number of top documents from which to return metrics. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -70,45 +161,37 @@ public sealed partial class TopMetricsAggregation /// The sort order of the documents. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TopMetricsAggregation topMetricsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.TopMetrics(topMetricsAggregation); + public System.Collections.Generic.ICollection? Sort { get; set; } } -public sealed partial class TopMetricsAggregationDescriptor : SerializableDescriptor> +public readonly partial struct TopMetricsAggregationDescriptor { - internal TopMetricsAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation instance) + { + Instance = instance; + } - public TopMetricsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor MetricsDescriptor { get; set; } - private Action> MetricsDescriptorAction { get; set; } - private Action>[] MetricsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The field on which to run the aggregation. /// /// - public TopMetricsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -116,21 +199,21 @@ public TopMetricsAggregationDescriptor Field(Elastic.Clients.Elastics /// The field on which to run the aggregation. /// /// - public TopMetricsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field on which to run the aggregation. + /// The fields of the top document to return. /// /// - public TopMetricsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Metrics = value; + return this; } /// @@ -138,40 +221,27 @@ public TopMetricsAggregationDescriptor Field(Expression /// - public TopMetricsAggregationDescriptor Metrics(ICollection? metrics) - { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsValue = metrics; - return Self; - } - - public TopMetricsAggregationDescriptor Metrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(params Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue[] values) { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsDescriptor = descriptor; - return Self; + Instance.Metrics = [.. values]; + return this; } - public TopMetricsAggregationDescriptor Metrics(Action> configure) + /// + /// + /// The fields of the top document to return. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(params System.Action>[] actions) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorActions = null; - MetricsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor.Build(action)); + } - public TopMetricsAggregationDescriptor Metrics(params Action>[] configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = configure; - return Self; + Instance.Metrics = items; + return this; } /// @@ -180,34 +250,28 @@ public TopMetricsAggregationDescriptor Metrics(params Action /// - public TopMetricsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TopMetricsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -215,10 +279,10 @@ public TopMetricsAggregationDescriptor Script(Action /// - public TopMetricsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -226,173 +290,82 @@ public TopMetricsAggregationDescriptor Size(int? size) /// The sort order of the documents. /// /// - public TopMetricsAggregationDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public TopMetricsAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) - { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; - } - - public TopMetricsAggregationDescriptor Sort(Action> configure) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } - public TopMetricsAggregationDescriptor Sort(params Action>[] configure) + /// + /// + /// The sort order of the documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The sort order of the documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsDescriptorActions is not null) - { - writer.WritePropertyName("metrics"); - if (MetricsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MetricsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(action), options); - } - - if (MetricsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - SingleOrManySerializationHelper.Serialize(MetricsValue, writer, options); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TopMetricsAggregationDescriptor : SerializableDescriptor +public readonly partial struct TopMetricsAggregationDescriptor { - internal TopMetricsAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation Instance { get; init; } - public TopMetricsAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private ICollection? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Action[] MetricsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// The field on which to run the aggregation. /// /// - public TopMetricsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -400,21 +373,21 @@ public TopMetricsAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field /// The field on which to run the aggregation. /// /// - public TopMetricsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field on which to run the aggregation. + /// The fields of the top document to return. /// /// - public TopMetricsAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Metrics = value; + return this; } /// @@ -422,40 +395,44 @@ public TopMetricsAggregationDescriptor Field(Expression /// - public TopMetricsAggregationDescriptor Metrics(ICollection? metrics) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(params Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue[] values) { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsValue = metrics; - return Self; + Instance.Metrics = [.. values]; + return this; } - public TopMetricsAggregationDescriptor Metrics(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor descriptor) + /// + /// + /// The fields of the top document to return. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(params System.Action[] actions) { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = null; - MetricsDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor.Build(action)); + } - public TopMetricsAggregationDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorActions = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = items; + return this; } - public TopMetricsAggregationDescriptor Metrics(params Action[] configure) + /// + /// + /// The fields of the top document to return. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Metrics(params System.Action>[] actions) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor.Build(action)); + } + + Instance.Metrics = items; + return this; } /// @@ -464,34 +441,28 @@ public TopMetricsAggregationDescriptor Metrics(params Action /// - public TopMetricsAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public TopMetricsAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TopMetricsAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -499,10 +470,10 @@ public TopMetricsAggregationDescriptor Script(Action /// - public TopMetricsAggregationDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -510,137 +481,67 @@ public TopMetricsAggregationDescriptor Size(int? size) /// The sort order of the documents. /// /// - public TopMetricsAggregationDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public TopMetricsAggregationDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) - { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; - } - - public TopMetricsAggregationDescriptor Sort(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } - public TopMetricsAggregationDescriptor Sort(params Action[] configure) + /// + /// + /// The sort order of the documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The sort order of the documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(params System.Action[] actions) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsDescriptorActions is not null) - { - writer.WritePropertyName("metrics"); - if (MetricsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MetricsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(action), options); - } - - if (MetricsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - SingleOrManySerializationHelper.Serialize(MetricsValue, writer, options); - } - - if (MissingValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + Instance.Sort = items; + return this; + } - if (SizeValue.HasValue) + /// + /// + /// The sort order of the documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsValue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsValue.g.cs index 134fa12ce8c..02f207ecb9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsValue.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TopMetricsValue.g.cs @@ -17,57 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class TopMetricsValueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueConverter))] public sealed partial class TopMetricsValue { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsValue(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TopMetricsValue() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopMetricsValue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A field to return as a metric. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } } -public sealed partial class TopMetricsValueDescriptor : SerializableDescriptor> +public readonly partial struct TopMetricsValueDescriptor { - internal TopMetricsValueDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue Instance { get; init; } - public TopMetricsValueDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// A field to return as a metric. - /// - /// - public TopMetricsValueDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsValueDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor descriptor) => descriptor.Instance; + /// /// /// A field to return as a metric. /// /// - public TopMetricsValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -75,51 +134,49 @@ public TopMetricsValueDescriptor Field(Expression /// - public TopMetricsValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TopMetricsValueDescriptor : SerializableDescriptor +public readonly partial struct TopMetricsValueDescriptor { - internal TopMetricsValueDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue Instance { get; init; } - public TopMetricsValueDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// A field to return as a metric. - /// - /// - public TopMetricsValueDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopMetricsValueDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue instance) => new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor descriptor) => descriptor.Instance; + /// /// /// A field to return as a metric. /// /// - public TopMetricsValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -127,17 +184,17 @@ public TopMetricsValueDescriptor Field(Expression /// - public TopMetricsValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValueDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.TopMetricsValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedRareTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedRareTermsAggregate.g.cs index 65f49279fe6..fb529ab7f77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedRareTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedRareTermsAggregate.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class UnmappedRareTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of a rare_terms aggregation when the field is unmapped. buckets is always empty. /// /// -public sealed partial class UnmappedRareTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.UnmappedRareTermsAggregateConverter))] +public sealed partial class UnmappedRareTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnmappedRareTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public UnmappedRareTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnmappedRareTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnmappedRareTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "umrareterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSamplerAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSamplerAggregate.g.cs index 49e77c3a953..a561cda6e1b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSamplerAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSamplerAggregate.g.cs @@ -17,71 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class UnmappedSamplerAggregateConverter : JsonConverter +internal sealed partial class UnmappedSamplerAggregateConverter : System.Text.Json.Serialization.JsonConverter { - public override UnmappedSamplerAggregate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - IReadOnlyDictionary? meta = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "meta") - { - meta = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } + continue; + } - throw new JsonException("Unknown property read from JSON."); + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new UnmappedSamplerAggregate { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Meta = meta }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, UnmappedSamplerAggregate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregate value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'UnmappedSamplerAggregate' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(UnmappedSamplerAggregateConverter))] -public sealed partial class UnmappedSamplerAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.UnmappedSamplerAggregateConverter))] +public sealed partial class UnmappedSamplerAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnmappedSamplerAggregate(long docCount) + { + DocCount = docCount; + } +#if NET7_0_OR_GREATER + public UnmappedSamplerAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnmappedSamplerAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnmappedSamplerAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public IReadOnlyDictionary? Meta { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "unmapped_sampler"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSignificantTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSignificantTermsAggregate.g.cs index 61265ed8a92..c059d2a9f39 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSignificantTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedSignificantTermsAggregate.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class UnmappedSignificantTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBgCount = System.Text.Json.JsonEncodedText.Encode("bg_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBgCount = default; + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCount = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBgCount.TryReadProperty(ref reader, options, PropBgCount, null)) + { + continue; + } + + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BgCount = propBgCount.Value, + Buckets = propBuckets.Value, + DocCount = propDocCount.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBgCount, value.BgCount, null, null); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + /// /// /// Result of the significant_terms aggregation on an unmapped field. buckets is always empty. /// /// -public sealed partial class UnmappedSignificantTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.UnmappedSignificantTermsAggregateConverter))] +public sealed partial class UnmappedSignificantTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("bg_count")] - public long? BgCount { get; init; } - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count")] - public long? DocCount { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnmappedSignificantTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public UnmappedSignificantTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnmappedSignificantTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnmappedSignificantTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? BgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCount { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "umsigterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedTermsAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedTermsAggregate.g.cs index 58914563b27..f6079f61c85 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedTermsAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/UnmappedTermsAggregate.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class UnmappedTermsAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropDocCountErrorUpperBound = System.Text.Json.JsonEncodedText.Encode("doc_count_error_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSumOtherDocCount = System.Text.Json.JsonEncodedText.Encode("sum_other_doc_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue propDocCountErrorUpperBound = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSumOtherDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDocCountErrorUpperBound.TryReadProperty(ref reader, options, PropDocCountErrorUpperBound, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSumOtherDocCount.TryReadProperty(ref reader, options, PropSumOtherDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + DocCountErrorUpperBound = propDocCountErrorUpperBound.Value, + Meta = propMeta.Value, + SumOtherDocCount = propSumOtherDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDocCountErrorUpperBound, value.DocCountErrorUpperBound, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSumOtherDocCount, value.SumOtherDocCount, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Result of a terms aggregation when the field is unmapped. buckets is always empty. /// /// -public sealed partial class UnmappedTermsAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.UnmappedTermsAggregateConverter))] +public sealed partial class UnmappedTermsAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("doc_count_error_upper_bound")] - public long? DocCountErrorUpperBound { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("sum_other_doc_count")] - public long? SumOtherDocCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnmappedTermsAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public UnmappedTermsAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnmappedTermsAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnmappedTermsAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public long? DocCountErrorUpperBound { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public long? SumOtherDocCount { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "umterms"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregate.g.cs index 697e951c703..5cacebd5205 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregate.g.cs @@ -17,25 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ValueCountAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Value count aggregation result. value is always present. /// /// -public sealed partial class ValueCountAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregateConverter))] +public sealed partial class ValueCountAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValueCountAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public ValueCountAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ValueCountAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValueCountAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "value_count"; /// /// @@ -43,8 +120,10 @@ public sealed partial class ValueCountAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs index 6e0a16f85d7..938a94b1ec6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs @@ -17,26 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class ValueCountAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationConverter))] public sealed partial class ValueCountAggregation { +#if NET7_0_OR_GREATER + public ValueCountAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ValueCountAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field on which to run the aggregation. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,50 +122,38 @@ public sealed partial class ValueCountAggregation /// By default, documents without a value are ignored. /// /// - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ValueCount(valueCountAggregation); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.ValueCount(valueCountAggregation); } -public sealed partial class ValueCountAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ValueCountAggregationDescriptor { - internal ValueCountAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation Instance { get; init; } - public ValueCountAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValueCountAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public ValueCountAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValueCountAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public ValueCountAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -96,16 +161,16 @@ public ValueCountAggregationDescriptor Field(Expression /// - public ValueCountAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ValueCountAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -114,112 +179,72 @@ public ValueCountAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public ValueCountAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ValueCountAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ValueCountAggregationDescriptor : SerializableDescriptor +public readonly partial struct ValueCountAggregationDescriptor { - internal ValueCountAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation Instance { get; init; } - public ValueCountAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValueCountAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field on which to run the aggregation. - /// - /// - public ValueCountAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ValueCountAggregationDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field on which to run the aggregation. /// /// - public ValueCountAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -227,16 +252,16 @@ public ValueCountAggregationDescriptor Field(Expression /// - public ValueCountAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ValueCountAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -245,73 +270,40 @@ public ValueCountAggregationDescriptor Format(string? format) /// By default, documents without a value are ignored. /// /// - public ValueCountAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Missing(object? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ValueCountAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ValueCountAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) + if (action is null) { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregate.g.cs index 5501a87a5b2..19a177c89fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregate.g.cs @@ -17,20 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -public sealed partial class VariableWidthHistogramAggregate : IAggregate +internal sealed partial class VariableWidthHistogramAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + + public override Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBuckets = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregateConverter))] +public sealed partial class VariableWidthHistogramAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("buckets")] - public IReadOnlyCollection Buckets { get; init; } - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramAggregate(System.Collections.Generic.IReadOnlyCollection buckets) + { + Buckets = buckets; + } +#if NET7_0_OR_GREATER + public VariableWidthHistogramAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VariableWidthHistogramAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VariableWidthHistogramAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Buckets { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "variable_width_histogram"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs index 1181ffd16fc..0f96e0ebdd5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramAggregation.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class VariableWidthHistogramAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuckets = System.Text.Json.JsonEncodedText.Encode("buckets"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInitialBuffer = System.Text.Json.JsonEncodedText.Encode("initial_buffer"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + + public override Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuckets = default; + LocalJsonValue propField = default; + LocalJsonValue propInitialBuffer = default; + LocalJsonValue propScript = default; + LocalJsonValue propShardSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuckets.TryReadProperty(ref reader, options, PropBuckets, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInitialBuffer.TryReadProperty(ref reader, options, PropInitialBuffer, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Buckets = propBuckets.Value, + Field = propField.Value, + InitialBuffer = propInitialBuffer.Value, + Script = propScript.Value, + ShardSize = propShardSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuckets, value.Buckets, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInitialBuffer, value.InitialBuffer, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationConverter))] public sealed partial class VariableWidthHistogramAggregation { +#if NET7_0_OR_GREATER + public VariableWidthHistogramAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public VariableWidthHistogramAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The target number of buckets. /// /// - [JsonInclude, JsonPropertyName("buckets")] public int? Buckets { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class VariableWidthHistogramAggregation /// The name of the field. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -51,9 +137,7 @@ public sealed partial class VariableWidthHistogramAggregation /// Defaults to min(10 * shard_size, 50000). /// /// - [JsonInclude, JsonPropertyName("initial_buffer")] public int? InitialBuffer { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -62,48 +146,37 @@ public sealed partial class VariableWidthHistogramAggregation /// Defaults to buckets * 50. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(VariableWidthHistogramAggregation variableWidthHistogramAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.VariableWidthHistogram(variableWidthHistogramAggregation); } -public sealed partial class VariableWidthHistogramAggregationDescriptor : SerializableDescriptor> +public readonly partial struct VariableWidthHistogramAggregationDescriptor { - internal VariableWidthHistogramAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation Instance { get; init; } - public VariableWidthHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation instance) { + Instance = instance; } - private int? BucketsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private int? InitialBufferValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? ShardSizeValue { get; set; } - - /// - /// - /// The target number of buckets. - /// - /// - public VariableWidthHistogramAggregationDescriptor Buckets(int? buckets) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramAggregationDescriptor() { - BucketsValue = buckets; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The name of the field. + /// The target number of buckets. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Buckets(int? value) { - FieldValue = field; - return Self; + Instance.Buckets = value; + return this; } /// @@ -111,10 +184,10 @@ public VariableWidthHistogramAggregationDescriptor Field(Elastic.Clie /// The name of the field. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -122,10 +195,10 @@ public VariableWidthHistogramAggregationDescriptor Field(Expr /// The name of the field. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -134,34 +207,28 @@ public VariableWidthHistogramAggregationDescriptor Field(Expressionmin(10 * shard_size, 50000). /// /// - public VariableWidthHistogramAggregationDescriptor InitialBuffer(int? initialBuffer) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor InitialBuffer(int? value) { - InitialBufferValue = initialBuffer; - return Self; + Instance.InitialBuffer = value; + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -170,95 +237,54 @@ public VariableWidthHistogramAggregationDescriptor Script(Actionbuckets * 50. /// /// - public VariableWidthHistogramAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (BucketsValue.HasValue) + if (action is null) { - writer.WritePropertyName("buckets"); - writer.WriteNumberValue(BucketsValue.Value); + return new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (InitialBufferValue.HasValue) - { - writer.WritePropertyName("initial_buffer"); - writer.WriteNumberValue(InitialBufferValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class VariableWidthHistogramAggregationDescriptor : SerializableDescriptor +public readonly partial struct VariableWidthHistogramAggregationDescriptor { - internal VariableWidthHistogramAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation Instance { get; init; } - public VariableWidthHistogramAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation instance) { + Instance = instance; } - private int? BucketsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private int? InitialBufferValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private int? ShardSizeValue { get; set; } - - /// - /// - /// The target number of buckets. - /// - /// - public VariableWidthHistogramAggregationDescriptor Buckets(int? buckets) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramAggregationDescriptor() { - BucketsValue = buckets; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor descriptor) => descriptor.Instance; + /// /// - /// The name of the field. + /// The target number of buckets. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Buckets(int? value) { - FieldValue = field; - return Self; + Instance.Buckets = value; + return this; } /// @@ -266,10 +292,10 @@ public VariableWidthHistogramAggregationDescriptor Field(Elastic.Clients.Elastic /// The name of the field. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -277,10 +303,10 @@ public VariableWidthHistogramAggregationDescriptor Field(Expr /// The name of the field. /// /// - public VariableWidthHistogramAggregationDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -289,34 +315,28 @@ public VariableWidthHistogramAggregationDescriptor Field(Expressionmin(10 * shard_size, 50000). /// /// - public VariableWidthHistogramAggregationDescriptor InitialBuffer(int? initialBuffer) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor InitialBuffer(int? value) { - InitialBufferValue = initialBuffer; - return Self; + Instance.InitialBuffer = value; + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public VariableWidthHistogramAggregationDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -325,55 +345,22 @@ public VariableWidthHistogramAggregationDescriptor Script(Actionbuckets * 50. /// /// - public VariableWidthHistogramAggregationDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (BucketsValue.HasValue) - { - writer.WritePropertyName("buckets"); - writer.WriteNumberValue(BucketsValue.Value); - } - - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (InitialBufferValue.HasValue) - { - writer.WritePropertyName("initial_buffer"); - writer.WriteNumberValue(InitialBufferValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramBucket.g.cs index 4d1f82516da..20d89a89113 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/VariableWidthHistogramBucket.g.cs @@ -17,111 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -internal sealed partial class VariableWidthHistogramBucketConverter : JsonConverter +internal sealed partial class VariableWidthHistogramBucketConverter : System.Text.Json.Serialization.JsonConverter { - public override VariableWidthHistogramBucket Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropKey = System.Text.Json.JsonEncodedText.Encode("key"); + private static readonly System.Text.Json.JsonEncodedText PropKeyAsString = System.Text.Json.JsonEncodedText.Encode("key_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAsString = System.Text.Json.JsonEncodedText.Encode("max_as_string"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinAsString = System.Text.Json.JsonEncodedText.Encode("min_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - long docCount = default; - double key = default; - string? keyAsString = default; - double max = default; - string? maxAsString = default; - double min = default; - string? minAsString = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAggregations = default; + LocalJsonValue propDocCount = default; + LocalJsonValue propKey = default; + LocalJsonValue propKeyAsString = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxAsString = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propKey.TryReadProperty(ref reader, options, PropKey, null)) { - var property = reader.GetString(); - if (property == "doc_count") - { - docCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key") - { - key = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "key_as_string") - { - keyAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max") - { - max = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_as_string") - { - maxAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "min") - { - min = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "min_as_string") - { - minAsString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property.Contains("#")) - { - additionalProperties ??= new Dictionary(); - AggregateDictionaryConverter.ReadItem(ref reader, options, additionalProperties, property); - continue; - } - - throw new JsonException("Unknown property read from JSON."); + continue; } + + if (propKeyAsString.TryReadProperty(ref reader, options, PropKeyAsString, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxAsString.TryReadProperty(ref reader, options, PropMaxAsString, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinAsString.TryReadProperty(ref reader, options, PropMinAsString, null)) + { + continue; + } + + propAggregations ??= new System.Collections.Generic.Dictionary(); + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.ReadItem(ref reader, options, out string key, out Elastic.Clients.Elasticsearch.Aggregations.IAggregate value); + propAggregations[key] = value; } - return new VariableWidthHistogramBucket { Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(additionalProperties), DocCount = docCount, Key = key, KeyAsString = keyAsString, Max = max, MaxAsString = maxAsString, Min = min, MinAsString = minAsString }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = new Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary(propAggregations), + DocCount = propDocCount.Value, + Key = propKey.Value, + KeyAsString = propKeyAsString.Value, + Max = propMax.Value, + MaxAsString = propMaxAsString.Value, + Min = propMin.Value, + MinAsString = propMinAsString.Value + }; } - public override void Write(Utf8JsonWriter writer, VariableWidthHistogramBucket value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramBucket value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'VariableWidthHistogramBucket' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropKey, value.Key, null, null); + writer.WriteProperty(options, PropKeyAsString, value.KeyAsString, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxAsString, value.MaxAsString, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinAsString, value.MinAsString, null, null); + if (value.Aggregations is not null) + { + foreach (var item in value.Aggregations) + { + Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionaryConverter.WriteItem(writer, options, item.Key, item.Value); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(VariableWidthHistogramBucketConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.VariableWidthHistogramBucketConverter))] public sealed partial class VariableWidthHistogramBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VariableWidthHistogramBucket(long docCount, double key, double max, double min) + { + DocCount = docCount; + Key = key; + Max = max; + Min = min; + } +#if NET7_0_OR_GREATER + public VariableWidthHistogramBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VariableWidthHistogramBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VariableWidthHistogramBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Nested aggregations /// /// - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary Aggregations { get; init; } - public long DocCount { get; init; } - public double Key { get; init; } - public string? KeyAsString { get; init; } - public double Max { get; init; } - public string? MaxAsString { get; init; } - public double Min { get; init; } - public string? MinAsString { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Key { get; set; } + public string? KeyAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Max { get; set; } + public string? MaxAsString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Min { get; set; } + public string? MinAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs index 673773b6806..90fb45ef393 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregate.g.cs @@ -17,25 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class WeightedAverageAggregateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueAsString = System.Text.Json.JsonEncodedText.Encode("value_as_string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueAsString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueAsString.TryReadProperty(ref reader, options, PropValueAsString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Value = propValue.Value, + ValueAsString = propValueAsString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueAsString, value.ValueAsString, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Weighted average aggregation result. value is missing if the weight was set to zero. /// /// -public sealed partial class WeightedAverageAggregate : IAggregate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregateConverter))] +public sealed partial class WeightedAverageAggregate : Elastic.Clients.Elasticsearch.Aggregations.IAggregate { - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageAggregate(double? value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public WeightedAverageAggregate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WeightedAverageAggregate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WeightedAverageAggregate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + + string Elastic.Clients.Elasticsearch.Aggregations.IAggregate.Type => "weighted_avg"; /// /// @@ -43,8 +120,10 @@ public sealed partial class WeightedAverageAggregate : IAggregate /// unless specified otherwise. /// /// - [JsonInclude, JsonPropertyName("value")] - public double? Value { get; init; } - [JsonInclude, JsonPropertyName("value_as_string")] - public string? ValueAsString { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double? Value { get; set; } + public string? ValueAsString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs index b7c6a2d1923..c2c0fbcbbf6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class WeightedAverageAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValueType = System.Text.Json.JsonEncodedText.Encode("value_type"); + private static readonly System.Text.Json.JsonEncodedText PropWeight = System.Text.Json.JsonEncodedText.Encode("weight"); + + public override Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFormat = default; + LocalJsonValue propValue = default; + LocalJsonValue propValueType = default; + LocalJsonValue propWeight = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propValueType.TryReadProperty(ref reader, options, PropValueType, null)) + { + continue; + } + + if (propWeight.TryReadProperty(ref reader, options, PropWeight, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Format = propFormat.Value, + Value = propValue.Value, + ValueType = propValueType.Value, + Weight = propWeight.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropValueType, value.ValueType, null, null); + writer.WriteProperty(options, PropWeight, value.Weight, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationConverter))] public sealed partial class WeightedAverageAggregation { +#if NET7_0_OR_GREATER + public WeightedAverageAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public WeightedAverageAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A numeric response formatter. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -42,9 +120,7 @@ public sealed partial class WeightedAverageAggregation /// Configuration for the field that provides the values. /// /// - [JsonInclude, JsonPropertyName("value")] public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? Value { get; set; } - [JsonInclude, JsonPropertyName("value_type")] public Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueType { get; set; } /// @@ -52,38 +128,37 @@ public sealed partial class WeightedAverageAggregation /// Configuration for the field or script that provides the weights. /// /// - [JsonInclude, JsonPropertyName("weight")] public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? Weight { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(WeightedAverageAggregation weightedAverageAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.WeightedAvg(weightedAverageAggregation); } -public sealed partial class WeightedAverageAggregationDescriptor : SerializableDescriptor> +public readonly partial struct WeightedAverageAggregationDescriptor { - internal WeightedAverageAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation instance) + { + Instance = instance; + } - public WeightedAverageAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? ValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor ValueDescriptor { get; set; } - private Action> ValueDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? WeightValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor WeightDescriptor { get; set; } - private Action> WeightDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A numeric response formatter. /// /// - public WeightedAverageAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -91,34 +166,38 @@ public WeightedAverageAggregationDescriptor Format(string? format) /// Configuration for the field that provides the values. /// /// - public WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) { - ValueDescriptor = null; - ValueDescriptorAction = null; - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - public WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) + /// + /// + /// Configuration for the field that provides the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value() { - ValueValue = null; - ValueDescriptorAction = null; - ValueDescriptor = descriptor; - return Self; + Instance.Value = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(null); + return this; } - public WeightedAverageAggregationDescriptor Value(Action> configure) + /// + /// + /// Configuration for the field that provides the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value(System.Action>? action) { - ValueValue = null; - ValueDescriptor = null; - ValueDescriptorAction = configure; - return Self; + Instance.Value = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; } - public WeightedAverageAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) { - ValueTypeValue = valueType; - return Self; + Instance.ValueType = value; + return this; } /// @@ -126,107 +205,76 @@ public WeightedAverageAggregationDescriptor ValueType(Elastic.Clients /// Configuration for the field or script that provides the weights. /// /// - public WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? weight) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) { - WeightDescriptor = null; - WeightDescriptorAction = null; - WeightValue = weight; - return Self; + Instance.Weight = value; + return this; } - public WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) + /// + /// + /// Configuration for the field or script that provides the weights. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight() { - WeightValue = null; - WeightDescriptorAction = null; - WeightDescriptor = descriptor; - return Self; + Instance.Weight = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(null); + return this; } - public WeightedAverageAggregationDescriptor Weight(Action> configure) + /// + /// + /// Configuration for the field or script that provides the weights. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight(System.Action>? action) { - WeightValue = null; - WeightDescriptor = null; - WeightDescriptorAction = configure; - return Self; + Instance.Weight = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FormatValue)) + if (action is null) { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ValueDescriptor is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueDescriptor, options); - } - else if (ValueDescriptorAction is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(ValueDescriptorAction), options); - } - else if (ValueValue is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } - - if (WeightDescriptor is not null) - { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, WeightDescriptor, options); - } - else if (WeightDescriptorAction is not null) - { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(WeightDescriptorAction), options); - } - else if (WeightValue is not null) - { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, WeightValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class WeightedAverageAggregationDescriptor : SerializableDescriptor +public readonly partial struct WeightedAverageAggregationDescriptor { - internal WeightedAverageAggregationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation instance) + { + Instance = instance; + } - public WeightedAverageAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? ValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor ValueDescriptor { get; set; } - private Action ValueDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.ValueType? ValueTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? WeightValue { get; set; } - private Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor WeightDescriptor { get; set; } - private Action WeightDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation instance) => new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// A numeric response formatter. /// /// - public WeightedAverageAggregationDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } /// @@ -234,34 +282,49 @@ public WeightedAverageAggregationDescriptor Format(string? format) /// Configuration for the field that provides the values. /// /// - public WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) { - ValueDescriptor = null; - ValueDescriptorAction = null; - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - public WeightedAverageAggregationDescriptor Value(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) + /// + /// + /// Configuration for the field that provides the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value() { - ValueValue = null; - ValueDescriptorAction = null; - ValueDescriptor = descriptor; - return Self; + Instance.Value = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(null); + return this; } - public WeightedAverageAggregationDescriptor Value(Action configure) + /// + /// + /// Configuration for the field that provides the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value(System.Action? action) { - ValueValue = null; - ValueDescriptor = null; - ValueDescriptorAction = configure; - return Self; + Instance.Value = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; } - public WeightedAverageAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? valueType) + /// + /// + /// Configuration for the field that provides the values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Value(System.Action>? action) { - ValueTypeValue = valueType; - return Self; + Instance.Value = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor ValueType(Elastic.Clients.Elasticsearch.Aggregations.ValueType? value) + { + Instance.ValueType = value; + return this; } /// @@ -269,77 +332,55 @@ public WeightedAverageAggregationDescriptor ValueType(Elastic.Clients.Elasticsea /// Configuration for the field or script that provides the weights. /// /// - public WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? weight) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue? value) { - WeightDescriptor = null; - WeightDescriptorAction = null; - WeightValue = weight; - return Self; + Instance.Weight = value; + return this; } - public WeightedAverageAggregationDescriptor Weight(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) + /// + /// + /// Configuration for the field or script that provides the weights. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight() { - WeightValue = null; - WeightDescriptorAction = null; - WeightDescriptor = descriptor; - return Self; + Instance.Weight = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(null); + return this; } - public WeightedAverageAggregationDescriptor Weight(Action configure) + /// + /// + /// Configuration for the field or script that provides the weights. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight(System.Action? action) { - WeightValue = null; - WeightDescriptor = null; - WeightDescriptorAction = configure; - return Self; + Instance.Weight = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration for the field or script that provides the weights. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor Weight(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (ValueDescriptor is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueDescriptor, options); - } - else if (ValueDescriptorAction is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(ValueDescriptorAction), options); - } - else if (ValueValue is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - } - - if (ValueTypeValue is not null) - { - writer.WritePropertyName("value_type"); - JsonSerializer.Serialize(writer, ValueTypeValue, options); - } + Instance.Weight = Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor.Build(action); + return this; + } - if (WeightDescriptor is not null) - { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, WeightDescriptor, options); - } - else if (WeightDescriptorAction is not null) - { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(WeightDescriptorAction), options); - } - else if (WeightValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("weight"); - JsonSerializer.Serialize(writer, WeightValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregationDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageValue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageValue.g.cs index 23d3bf02096..deec4500073 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageValue.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/WeightedAverageValue.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; +internal sealed partial class WeightedAverageValueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueConverter))] public sealed partial class WeightedAverageValue { +#if NET7_0_OR_GREATER + public WeightedAverageValue() + { + } +#endif +#if !NET7_0_OR_GREATER + public WeightedAverageValue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field from which to extract the values or weights. /// /// - [JsonInclude, JsonPropertyName("field")] public Elastic.Clients.Elasticsearch.Field? Field { get; set; } /// @@ -42,46 +111,38 @@ public sealed partial class WeightedAverageValue /// A value or weight to use if the field is missing. /// /// - [JsonInclude, JsonPropertyName("missing")] public double? Missing { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } } -public sealed partial class WeightedAverageValueDescriptor : SerializableDescriptor> +public readonly partial struct WeightedAverageValueDescriptor { - internal WeightedAverageValueDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue Instance { get; init; } - public WeightedAverageValueDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field from which to extract the values or weights. - /// - /// - public WeightedAverageValueDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageValueDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue instance) => new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) => descriptor.Instance; + /// /// /// The field from which to extract the values or weights. /// /// - public WeightedAverageValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -89,10 +150,10 @@ public WeightedAverageValueDescriptor Field(Expression /// - public WeightedAverageValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -100,105 +161,72 @@ public WeightedAverageValueDescriptor Field(Expression /// - public WeightedAverageValueDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public WeightedAverageValueDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue Build(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) + if (action is null) { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class WeightedAverageValueDescriptor : SerializableDescriptor +public readonly partial struct WeightedAverageValueDescriptor { - internal WeightedAverageValueDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue Instance { get; init; } - public WeightedAverageValueDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private double? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - /// - /// - /// The field from which to extract the values or weights. - /// - /// - public WeightedAverageValueDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedAverageValueDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue instance) => new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor descriptor) => descriptor.Instance; + /// /// /// The field from which to extract the values or weights. /// /// - public WeightedAverageValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -206,10 +234,10 @@ public WeightedAverageValueDescriptor Field(Expression /// - public WeightedAverageValueDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -217,67 +245,40 @@ public WeightedAverageValueDescriptor Field(Expression /// - public WeightedAverageValueDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } - public WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public WeightedAverageValueDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public WeightedAverageValueDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValueDescriptor(new Elastic.Clients.Elasticsearch.Aggregations.WeightedAverageValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzer.g.cs new file mode 100644 index 00000000000..e22f01ff982 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzer.g.cs @@ -0,0 +1,262 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Analysis; + +internal sealed partial class IAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.IAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = "custom"; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "arabic" => reader.ReadValue(options, null), + "armenian" => reader.ReadValue(options, null), + "basque" => reader.ReadValue(options, null), + "bengali" => reader.ReadValue(options, null), + "brazilian" => reader.ReadValue(options, null), + "bulgarian" => reader.ReadValue(options, null), + "catalan" => reader.ReadValue(options, null), + "chinese" => reader.ReadValue(options, null), + "cjk" => reader.ReadValue(options, null), + "custom" => reader.ReadValue(options, null), + "czech" => reader.ReadValue(options, null), + "danish" => reader.ReadValue(options, null), + "dutch" => reader.ReadValue(options, null), + "english" => reader.ReadValue(options, null), + "estonian" => reader.ReadValue(options, null), + "fingerprint" => reader.ReadValue(options, null), + "finnish" => reader.ReadValue(options, null), + "french" => reader.ReadValue(options, null), + "galician" => reader.ReadValue(options, null), + "german" => reader.ReadValue(options, null), + "greek" => reader.ReadValue(options, null), + "hindi" => reader.ReadValue(options, null), + "hungarian" => reader.ReadValue(options, null), + "icu_analyzer" => reader.ReadValue(options, null), + "indonesian" => reader.ReadValue(options, null), + "irish" => reader.ReadValue(options, null), + "italian" => reader.ReadValue(options, null), + "keyword" => reader.ReadValue(options, null), + "kuromoji" => reader.ReadValue(options, null), + "latvian" => reader.ReadValue(options, null), + "lithuanian" => reader.ReadValue(options, null), + "nori" => reader.ReadValue(options, null), + "norwegian" => reader.ReadValue(options, null), + "pattern" => reader.ReadValue(options, null), + "persian" => reader.ReadValue(options, null), + "portuguese" => reader.ReadValue(options, null), + "romanian" => reader.ReadValue(options, null), + "russian" => reader.ReadValue(options, null), + "serbian" => reader.ReadValue(options, null), + "simple" => reader.ReadValue(options, null), + "snowball" => reader.ReadValue(options, null), + "sorani" => reader.ReadValue(options, null), + "spanish" => reader.ReadValue(options, null), + "standard" => reader.ReadValue(options, null), + "stop" => reader.ReadValue(options, null), + "swedish" => reader.ReadValue(options, null), + "thai" => reader.ReadValue(options, null), + "turkish" => reader.ReadValue(options, null), + "whitespace" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.IAnalyzer)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "arabic": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer)value, null); + break; + case "armenian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer)value, null); + break; + case "basque": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer)value, null); + break; + case "bengali": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer)value, null); + break; + case "brazilian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer)value, null); + break; + case "bulgarian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer)value, null); + break; + case "catalan": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer)value, null); + break; + case "chinese": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer)value, null); + break; + case "cjk": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer)value, null); + break; + case "custom": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer)value, null); + break; + case "czech": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer)value, null); + break; + case "danish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer)value, null); + break; + case "dutch": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer)value, null); + break; + case "english": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer)value, null); + break; + case "estonian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer)value, null); + break; + case "fingerprint": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer)value, null); + break; + case "finnish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer)value, null); + break; + case "french": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer)value, null); + break; + case "galician": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer)value, null); + break; + case "german": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer)value, null); + break; + case "greek": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer)value, null); + break; + case "hindi": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer)value, null); + break; + case "hungarian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer)value, null); + break; + case "icu_analyzer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer)value, null); + break; + case "indonesian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer)value, null); + break; + case "irish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer)value, null); + break; + case "italian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer)value, null); + break; + case "keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer)value, null); + break; + case "kuromoji": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer)value, null); + break; + case "latvian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer)value, null); + break; + case "lithuanian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer)value, null); + break; + case "nori": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer)value, null); + break; + case "norwegian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer)value, null); + break; + case "pattern": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer)value, null); + break; + case "persian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer)value, null); + break; + case "portuguese": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer)value, null); + break; + case "romanian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer)value, null); + break; + case "russian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer)value, null); + break; + case "serbian": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer)value, null); + break; + case "simple": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer)value, null); + break; + case "snowball": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer)value, null); + break; + case "sorani": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer)value, null); + break; + case "spanish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer)value, null); + break; + case "standard": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer)value, null); + break; + case "stop": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer)value, null); + break; + case "swedish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer)value, null); + break; + case "thai": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer)value, null); + break; + case "turkish": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer)value, null); + break; + case "whitespace": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.IAnalyzer)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IAnalyzerConverter))] +public partial interface IAnalyzer +{ + public string Type { get; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs index aaec84a9912..db904fdeee7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs @@ -17,496 +17,930 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public partial class Analyzers : IsADictionary +internal sealed partial class AnalyzersConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Analysis.Analyzers Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Analysis.Analyzers(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.Analyzers value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.AnalyzersConverter))] +public sealed partial class Analyzers : Elastic.Clients.Elasticsearch.IsADictionary { public Analyzers() { } - public Analyzers(IDictionary container) : base(container) + public Analyzers(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, IAnalyzer analyzer) => BackingDictionary.Add(Sanitize(name), analyzer); - public bool TryGetAnalyzer(string name, [NotNullWhen(returnValue: true)] out IAnalyzer analyzer) => BackingDictionary.TryGetValue(Sanitize(name), out analyzer); + public void Add(string key, Elastic.Clients.Elasticsearch.Analysis.IAnalyzer value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetAnalyzer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Analysis.IAnalyzer value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetAnalyzer(string name, [NotNullWhen(returnValue: true)] out T? analyzer) where T : class, IAnalyzer + public bool TryGetAnalyzer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, IAnalyzer { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - analyzer = finalValue; + value = finalValue; return true; } - analyzer = null; + value = null; return false; } } -public sealed partial class AnalyzersDescriptor : IsADictionaryDescriptor +public readonly partial struct AnalyzersDescriptor { - public AnalyzersDescriptor() : base(new Analyzers()) - { - } - - public AnalyzersDescriptor(Analyzers analyzers) : base(analyzers ?? new Analyzers()) - { - } - - public AnalyzersDescriptor Arabic(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Arabic(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Arabic(string analyzerName, ArabicAnalyzer arabicAnalyzer) => AssignVariant(analyzerName, arabicAnalyzer); - public AnalyzersDescriptor Armenian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Armenian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Armenian(string analyzerName, ArmenianAnalyzer armenianAnalyzer) => AssignVariant(analyzerName, armenianAnalyzer); - public AnalyzersDescriptor Basque(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Basque(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Basque(string analyzerName, BasqueAnalyzer basqueAnalyzer) => AssignVariant(analyzerName, basqueAnalyzer); - public AnalyzersDescriptor Bengali(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Bengali(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Bengali(string analyzerName, BengaliAnalyzer bengaliAnalyzer) => AssignVariant(analyzerName, bengaliAnalyzer); - public AnalyzersDescriptor Brazilian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Brazilian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Brazilian(string analyzerName, BrazilianAnalyzer brazilianAnalyzer) => AssignVariant(analyzerName, brazilianAnalyzer); - public AnalyzersDescriptor Bulgarian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Bulgarian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Bulgarian(string analyzerName, BulgarianAnalyzer bulgarianAnalyzer) => AssignVariant(analyzerName, bulgarianAnalyzer); - public AnalyzersDescriptor Catalan(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Catalan(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Catalan(string analyzerName, CatalanAnalyzer catalanAnalyzer) => AssignVariant(analyzerName, catalanAnalyzer); - public AnalyzersDescriptor Chinese(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Chinese(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Chinese(string analyzerName, ChineseAnalyzer chineseAnalyzer) => AssignVariant(analyzerName, chineseAnalyzer); - public AnalyzersDescriptor Cjk(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Cjk(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Cjk(string analyzerName, CjkAnalyzer cjkAnalyzer) => AssignVariant(analyzerName, cjkAnalyzer); - public AnalyzersDescriptor Custom(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Custom(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Custom(string analyzerName, CustomAnalyzer customAnalyzer) => AssignVariant(analyzerName, customAnalyzer); - public AnalyzersDescriptor Czech(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Czech(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Czech(string analyzerName, CzechAnalyzer czechAnalyzer) => AssignVariant(analyzerName, czechAnalyzer); - public AnalyzersDescriptor Danish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Danish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Danish(string analyzerName, DanishAnalyzer danishAnalyzer) => AssignVariant(analyzerName, danishAnalyzer); - public AnalyzersDescriptor Dutch(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Dutch(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Dutch(string analyzerName, DutchAnalyzer dutchAnalyzer) => AssignVariant(analyzerName, dutchAnalyzer); - public AnalyzersDescriptor English(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor English(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor English(string analyzerName, EnglishAnalyzer englishAnalyzer) => AssignVariant(analyzerName, englishAnalyzer); - public AnalyzersDescriptor Estonian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Estonian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Estonian(string analyzerName, EstonianAnalyzer estonianAnalyzer) => AssignVariant(analyzerName, estonianAnalyzer); - public AnalyzersDescriptor Fingerprint(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Fingerprint(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Fingerprint(string analyzerName, FingerprintAnalyzer fingerprintAnalyzer) => AssignVariant(analyzerName, fingerprintAnalyzer); - public AnalyzersDescriptor Finnish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Finnish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Finnish(string analyzerName, FinnishAnalyzer finnishAnalyzer) => AssignVariant(analyzerName, finnishAnalyzer); - public AnalyzersDescriptor French(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor French(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor French(string analyzerName, FrenchAnalyzer frenchAnalyzer) => AssignVariant(analyzerName, frenchAnalyzer); - public AnalyzersDescriptor Galician(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Galician(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Galician(string analyzerName, GalicianAnalyzer galicianAnalyzer) => AssignVariant(analyzerName, galicianAnalyzer); - public AnalyzersDescriptor German(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor German(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor German(string analyzerName, GermanAnalyzer germanAnalyzer) => AssignVariant(analyzerName, germanAnalyzer); - public AnalyzersDescriptor Greek(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Greek(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Greek(string analyzerName, GreekAnalyzer greekAnalyzer) => AssignVariant(analyzerName, greekAnalyzer); - public AnalyzersDescriptor Hindi(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Hindi(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Hindi(string analyzerName, HindiAnalyzer hindiAnalyzer) => AssignVariant(analyzerName, hindiAnalyzer); - public AnalyzersDescriptor Hungarian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Hungarian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Hungarian(string analyzerName, HungarianAnalyzer hungarianAnalyzer) => AssignVariant(analyzerName, hungarianAnalyzer); - public AnalyzersDescriptor Icu(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Icu(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Icu(string analyzerName, IcuAnalyzer icuAnalyzer) => AssignVariant(analyzerName, icuAnalyzer); - public AnalyzersDescriptor Indonesian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Indonesian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Indonesian(string analyzerName, IndonesianAnalyzer indonesianAnalyzer) => AssignVariant(analyzerName, indonesianAnalyzer); - public AnalyzersDescriptor Irish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Irish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Irish(string analyzerName, IrishAnalyzer irishAnalyzer) => AssignVariant(analyzerName, irishAnalyzer); - public AnalyzersDescriptor Italian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Italian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Italian(string analyzerName, ItalianAnalyzer italianAnalyzer) => AssignVariant(analyzerName, italianAnalyzer); - public AnalyzersDescriptor Keyword(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Keyword(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Keyword(string analyzerName, KeywordAnalyzer keywordAnalyzer) => AssignVariant(analyzerName, keywordAnalyzer); - public AnalyzersDescriptor Kuromoji(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Kuromoji(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Kuromoji(string analyzerName, KuromojiAnalyzer kuromojiAnalyzer) => AssignVariant(analyzerName, kuromojiAnalyzer); - public AnalyzersDescriptor Language(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Language(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Language(string analyzerName, LanguageAnalyzer languageAnalyzer) => AssignVariant(analyzerName, languageAnalyzer); - public AnalyzersDescriptor Latvian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Latvian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Latvian(string analyzerName, LatvianAnalyzer latvianAnalyzer) => AssignVariant(analyzerName, latvianAnalyzer); - public AnalyzersDescriptor Lithuanian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Lithuanian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Lithuanian(string analyzerName, LithuanianAnalyzer lithuanianAnalyzer) => AssignVariant(analyzerName, lithuanianAnalyzer); - public AnalyzersDescriptor Nori(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Nori(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Nori(string analyzerName, NoriAnalyzer noriAnalyzer) => AssignVariant(analyzerName, noriAnalyzer); - public AnalyzersDescriptor Norwegian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Norwegian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Norwegian(string analyzerName, NorwegianAnalyzer norwegianAnalyzer) => AssignVariant(analyzerName, norwegianAnalyzer); - public AnalyzersDescriptor Pattern(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Pattern(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Pattern(string analyzerName, PatternAnalyzer patternAnalyzer) => AssignVariant(analyzerName, patternAnalyzer); - public AnalyzersDescriptor Persian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Persian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Persian(string analyzerName, PersianAnalyzer persianAnalyzer) => AssignVariant(analyzerName, persianAnalyzer); - public AnalyzersDescriptor Portuguese(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Portuguese(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Portuguese(string analyzerName, PortugueseAnalyzer portugueseAnalyzer) => AssignVariant(analyzerName, portugueseAnalyzer); - public AnalyzersDescriptor Romanian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Romanian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Romanian(string analyzerName, RomanianAnalyzer romanianAnalyzer) => AssignVariant(analyzerName, romanianAnalyzer); - public AnalyzersDescriptor Russian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Russian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Russian(string analyzerName, RussianAnalyzer russianAnalyzer) => AssignVariant(analyzerName, russianAnalyzer); - public AnalyzersDescriptor Serbian(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Serbian(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Serbian(string analyzerName, SerbianAnalyzer serbianAnalyzer) => AssignVariant(analyzerName, serbianAnalyzer); - public AnalyzersDescriptor Simple(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Simple(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Simple(string analyzerName, SimpleAnalyzer simpleAnalyzer) => AssignVariant(analyzerName, simpleAnalyzer); - public AnalyzersDescriptor Snowball(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Snowball(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Snowball(string analyzerName, SnowballAnalyzer snowballAnalyzer) => AssignVariant(analyzerName, snowballAnalyzer); - public AnalyzersDescriptor Sorani(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Sorani(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Sorani(string analyzerName, SoraniAnalyzer soraniAnalyzer) => AssignVariant(analyzerName, soraniAnalyzer); - public AnalyzersDescriptor Spanish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Spanish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Spanish(string analyzerName, SpanishAnalyzer spanishAnalyzer) => AssignVariant(analyzerName, spanishAnalyzer); - public AnalyzersDescriptor Standard(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Standard(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Standard(string analyzerName, StandardAnalyzer standardAnalyzer) => AssignVariant(analyzerName, standardAnalyzer); - public AnalyzersDescriptor Stop(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Stop(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Stop(string analyzerName, StopAnalyzer stopAnalyzer) => AssignVariant(analyzerName, stopAnalyzer); - public AnalyzersDescriptor Swedish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Swedish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Swedish(string analyzerName, SwedishAnalyzer swedishAnalyzer) => AssignVariant(analyzerName, swedishAnalyzer); - public AnalyzersDescriptor Thai(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Thai(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Thai(string analyzerName, ThaiAnalyzer thaiAnalyzer) => AssignVariant(analyzerName, thaiAnalyzer); - public AnalyzersDescriptor Turkish(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Turkish(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Turkish(string analyzerName, TurkishAnalyzer turkishAnalyzer) => AssignVariant(analyzerName, turkishAnalyzer); - public AnalyzersDescriptor Whitespace(string analyzerName) => AssignVariant(analyzerName, null); - public AnalyzersDescriptor Whitespace(string analyzerName, Action configure) => AssignVariant(analyzerName, configure); - public AnalyzersDescriptor Whitespace(string analyzerName, WhitespaceAnalyzer whitespaceAnalyzer) => AssignVariant(analyzerName, whitespaceAnalyzer); -} + private readonly Elastic.Clients.Elasticsearch.Analysis.Analyzers _items = new(); -internal sealed partial class AnalyzerInterfaceConverter : JsonConverter -{ - public override IAnalyzer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private Elastic.Clients.Elasticsearch.Analysis.Analyzers Value => _items; + + public AnalyzersDescriptor() { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + } - switch (type) - { - case "arabic": - return JsonSerializer.Deserialize(ref reader, options); - case "armenian": - return JsonSerializer.Deserialize(ref reader, options); - case "basque": - return JsonSerializer.Deserialize(ref reader, options); - case "bengali": - return JsonSerializer.Deserialize(ref reader, options); - case "brazilian": - return JsonSerializer.Deserialize(ref reader, options); - case "bulgarian": - return JsonSerializer.Deserialize(ref reader, options); - case "catalan": - return JsonSerializer.Deserialize(ref reader, options); - case "chinese": - return JsonSerializer.Deserialize(ref reader, options); - case "cjk": - return JsonSerializer.Deserialize(ref reader, options); - case "custom": - return JsonSerializer.Deserialize(ref reader, options); - case "czech": - return JsonSerializer.Deserialize(ref reader, options); - case "danish": - return JsonSerializer.Deserialize(ref reader, options); - case "dutch": - return JsonSerializer.Deserialize(ref reader, options); - case "english": - return JsonSerializer.Deserialize(ref reader, options); - case "estonian": - return JsonSerializer.Deserialize(ref reader, options); - case "fingerprint": - return JsonSerializer.Deserialize(ref reader, options); - case "finnish": - return JsonSerializer.Deserialize(ref reader, options); - case "french": - return JsonSerializer.Deserialize(ref reader, options); - case "galician": - return JsonSerializer.Deserialize(ref reader, options); - case "german": - return JsonSerializer.Deserialize(ref reader, options); - case "greek": - return JsonSerializer.Deserialize(ref reader, options); - case "hindi": - return JsonSerializer.Deserialize(ref reader, options); - case "hungarian": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_analyzer": - return JsonSerializer.Deserialize(ref reader, options); - case "indonesian": - return JsonSerializer.Deserialize(ref reader, options); - case "irish": - return JsonSerializer.Deserialize(ref reader, options); - case "italian": - return JsonSerializer.Deserialize(ref reader, options); - case "keyword": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji": - return JsonSerializer.Deserialize(ref reader, options); - case "language": - return JsonSerializer.Deserialize(ref reader, options); - case "latvian": - return JsonSerializer.Deserialize(ref reader, options); - case "lithuanian": - return JsonSerializer.Deserialize(ref reader, options); - case "nori": - return JsonSerializer.Deserialize(ref reader, options); - case "norwegian": - return JsonSerializer.Deserialize(ref reader, options); - case "pattern": - return JsonSerializer.Deserialize(ref reader, options); - case "persian": - return JsonSerializer.Deserialize(ref reader, options); - case "portuguese": - return JsonSerializer.Deserialize(ref reader, options); - case "romanian": - return JsonSerializer.Deserialize(ref reader, options); - case "russian": - return JsonSerializer.Deserialize(ref reader, options); - case "serbian": - return JsonSerializer.Deserialize(ref reader, options); - case "simple": - return JsonSerializer.Deserialize(ref reader, options); - case "snowball": - return JsonSerializer.Deserialize(ref reader, options); - case "sorani": - return JsonSerializer.Deserialize(ref reader, options); - case "spanish": - return JsonSerializer.Deserialize(ref reader, options); - case "standard": - return JsonSerializer.Deserialize(ref reader, options); - case "stop": - return JsonSerializer.Deserialize(ref reader, options); - case "swedish": - return JsonSerializer.Deserialize(ref reader, options); - case "thai": - return JsonSerializer.Deserialize(ref reader, options); - case "turkish": - return JsonSerializer.Deserialize(ref reader, options); - case "whitespace": - return JsonSerializer.Deserialize(ref reader, options); - default: - return JsonSerializer.Deserialize(ref reader, options); - } + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Arabic(string key, Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, IAnalyzer value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Arabic(string key) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Arabic(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Armenian(string key, Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Armenian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Armenian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Basque(string key, Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Basque(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Basque(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bengali(string key, Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bengali(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bengali(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Brazilian(string key, Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Brazilian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Brazilian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bulgarian(string key, Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bulgarian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Bulgarian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Catalan(string key, Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Catalan(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Catalan(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Chinese(string key, Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Chinese(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Chinese(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Cjk(string key, Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Cjk(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Cjk(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Custom(string key, Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Custom(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Czech(string key, Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Czech(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Czech(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Danish(string key, Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Danish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Danish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Dutch(string key, Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Dutch(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Dutch(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor English(string key, Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor English(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor English(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Estonian(string key, Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Estonian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Estonian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Fingerprint(string key, Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Fingerprint(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Fingerprint(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Finnish(string key, Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Finnish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Finnish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor French(string key, Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor French(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor French(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Galician(string key, Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Galician(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Galician(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor German(string key, Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor German(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor German(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Greek(string key, Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Greek(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Greek(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hindi(string key, Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hindi(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hindi(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hungarian(string key, Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hungarian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Hungarian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Icu(string key, Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Icu(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Indonesian(string key, Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer value) + { + _items.Add(key, value); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Indonesian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Indonesian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Irish(string key, Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Irish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Irish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Italian(string key, Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Italian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Italian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Keyword(string key, Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Keyword(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Keyword(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Latvian(string key, Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Latvian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Latvian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Lithuanian(string key, Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Lithuanian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Lithuanian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Nori(string key, Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Nori(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Nori(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Norwegian(string key, Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Norwegian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Norwegian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Pattern(string key, Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Pattern(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Pattern(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Persian(string key, Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Persian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Persian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Portuguese(string key, Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Portuguese(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Portuguese(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Romanian(string key, Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Romanian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Romanian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Russian(string key, Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Russian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Russian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Serbian(string key, Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Serbian(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Serbian(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Simple(string key, Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Simple(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Simple(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Snowball(string key, Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Snowball(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Sorani(string key, Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Sorani(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Sorani(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Spanish(string key, Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Spanish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Spanish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Standard(string key, Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Standard(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Standard(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Stop(string key, Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Stop(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Stop(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Swedish(string key, Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Swedish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Swedish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Thai(string key, Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Thai(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Thai(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Turkish(string key, Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Turkish(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Turkish(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Whitespace(string key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Whitespace(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Whitespace(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.Analyzers Build(System.Action? action) + { + if (action is null) { - case "arabic": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer), options); - return; - case "armenian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer), options); - return; - case "basque": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer), options); - return; - case "bengali": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer), options); - return; - case "brazilian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer), options); - return; - case "bulgarian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer), options); - return; - case "catalan": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer), options); - return; - case "chinese": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer), options); - return; - case "cjk": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer), options); - return; - case "custom": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer), options); - return; - case "czech": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer), options); - return; - case "danish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer), options); - return; - case "dutch": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer), options); - return; - case "english": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer), options); - return; - case "estonian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer), options); - return; - case "fingerprint": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer), options); - return; - case "finnish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer), options); - return; - case "french": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer), options); - return; - case "galician": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer), options); - return; - case "german": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer), options); - return; - case "greek": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer), options); - return; - case "hindi": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer), options); - return; - case "hungarian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer), options); - return; - case "icu_analyzer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer), options); - return; - case "indonesian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer), options); - return; - case "irish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer), options); - return; - case "italian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer), options); - return; - case "keyword": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer), options); - return; - case "kuromoji": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer), options); - return; - case "language": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LanguageAnalyzer), options); - return; - case "latvian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer), options); - return; - case "lithuanian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer), options); - return; - case "nori": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer), options); - return; - case "norwegian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer), options); - return; - case "pattern": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer), options); - return; - case "persian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer), options); - return; - case "portuguese": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer), options); - return; - case "romanian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer), options); - return; - case "russian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer), options); - return; - case "serbian": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer), options); - return; - case "simple": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer), options); - return; - case "snowball": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer), options); - return; - case "sorani": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer), options); - return; - case "spanish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer), options); - return; - case "standard": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer), options); - return; - case "stop": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer), options); - return; - case "swedish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer), options); - return; - case "thai": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer), options); - return; - case "turkish": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer), options); - return; - case "whitespace": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.Analysis.Analyzers(); } - } -} -[JsonConverter(typeof(AnalyzerInterfaceConverter))] -public partial interface IAnalyzer -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArabicAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArabicAnalyzer.g.cs index 64f5991c499..31667cb6508 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArabicAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArabicAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ArabicAnalyzer : IAnalyzer +internal sealed partial class ArabicAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerConverter))] +public sealed partial class ArabicAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public ArabicAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ArabicAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ArabicAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "arabic"; } -public sealed partial class ArabicAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ArabicAnalyzerDescriptor { - internal ArabicAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ArabicAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer instance) + { + Instance = instance; + } - public ArabicAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ArabicAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer(Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor descriptor) => descriptor.Instance; - public ArabicAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public ArabicAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public ArabicAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("arabic"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ArabicAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ArabicAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArmenianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArmenianAnalyzer.g.cs index 3641734436a..c92bf3c6384 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArmenianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ArmenianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ArmenianAnalyzer : IAnalyzer +internal sealed partial class ArmenianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerConverter))] +public sealed partial class ArmenianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public ArmenianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ArmenianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "armenian"; } -public sealed partial class ArmenianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ArmenianAnalyzerDescriptor { - internal ArmenianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ArmenianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer instance) + { + Instance = instance; + } - public ArmenianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ArmenianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor descriptor) => descriptor.Instance; - public ArmenianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public ArmenianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public ArmenianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("armenian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ArmenianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ArmenianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs index cc96201fc6b..c9c691cd4e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/AsciiFoldingTokenFilter.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class AsciiFoldingTokenFilter : ITokenFilter +internal sealed partial class AsciiFoldingTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PreserveOriginal = propPreserveOriginal.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterConverter))] +public sealed partial class AsciiFoldingTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("preserve_original")] +#if NET7_0_OR_GREATER + public AsciiFoldingTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public AsciiFoldingTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "asciifolding"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class AsciiFoldingTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct AsciiFoldingTokenFilterDescriptor { - internal AsciiFoldingTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter Instance { get; init; } - public AsciiFoldingTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsciiFoldingTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter instance) { + Instance = instance; } - private bool? PreserveOriginalValue { get; set; } - private string? VersionValue { get; set; } - - public AsciiFoldingTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsciiFoldingTokenFilterDescriptor() { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public AsciiFoldingTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor PreserveOriginal(bool? value = true) { - VersionValue = version; - return Self; + Instance.PreserveOriginal = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("asciifolding"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - AsciiFoldingTokenFilter IBuildableDescriptor.Build() => new() - { - PreserveOriginal = PreserveOriginalValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BasqueAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BasqueAnalyzer.g.cs index 9bdabb5b6ef..d3b5ff166d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BasqueAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BasqueAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class BasqueAnalyzer : IAnalyzer +internal sealed partial class BasqueAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerConverter))] +public sealed partial class BasqueAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public BasqueAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public BasqueAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BasqueAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "basque"; } -public sealed partial class BasqueAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct BasqueAnalyzerDescriptor { - internal BasqueAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BasqueAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer instance) + { + Instance = instance; + } - public BasqueAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BasqueAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer(Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor descriptor) => descriptor.Instance; - public BasqueAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public BasqueAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public BasqueAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("basque"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.BasqueAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - BasqueAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BengaliAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BengaliAnalyzer.g.cs index a9393e534cc..82da3aa4331 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BengaliAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BengaliAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class BengaliAnalyzer : IAnalyzer +internal sealed partial class BengaliAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerConverter))] +public sealed partial class BengaliAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public BengaliAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public BengaliAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BengaliAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "bengali"; } -public sealed partial class BengaliAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct BengaliAnalyzerDescriptor { - internal BengaliAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BengaliAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer instance) + { + Instance = instance; + } - public BengaliAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BengaliAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer(Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor descriptor) => descriptor.Instance; - public BengaliAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public BengaliAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public BengaliAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("bengali"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.BengaliAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - BengaliAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BrazilianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BrazilianAnalyzer.g.cs index edb89e4c735..2a1c278a401 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BrazilianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BrazilianAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class BrazilianAnalyzer : IAnalyzer +internal sealed partial class BrazilianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerConverter))] +public sealed partial class BrazilianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public BrazilianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public BrazilianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "brazilian"; } -public sealed partial class BrazilianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct BrazilianAnalyzerDescriptor { - internal BrazilianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer Instance { get; init; } - public BrazilianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BrazilianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BrazilianAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public BrazilianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public BrazilianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("brazilian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.BrazilianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - BrazilianAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BulgarianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BulgarianAnalyzer.g.cs index 7d08a972858..2a68aea1e05 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BulgarianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/BulgarianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class BulgarianAnalyzer : IAnalyzer +internal sealed partial class BulgarianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerConverter))] +public sealed partial class BulgarianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public BulgarianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public BulgarianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "bulgarian"; } -public sealed partial class BulgarianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct BulgarianAnalyzerDescriptor { - internal BulgarianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulgarianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer instance) + { + Instance = instance; + } - public BulgarianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulgarianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor descriptor) => descriptor.Instance; - public BulgarianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public BulgarianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public BulgarianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("bulgarian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.BulgarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - BulgarianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CatalanAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CatalanAnalyzer.g.cs index d6215912130..40e61b61e95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CatalanAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CatalanAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CatalanAnalyzer : IAnalyzer +internal sealed partial class CatalanAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerConverter))] +public sealed partial class CatalanAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public CatalanAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public CatalanAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CatalanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "catalan"; } -public sealed partial class CatalanAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CatalanAnalyzerDescriptor { - internal CatalanAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CatalanAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer instance) + { + Instance = instance; + } - public CatalanAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CatalanAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer(Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor descriptor) => descriptor.Instance; - public CatalanAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public CatalanAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public CatalanAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("catalan"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CatalanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - CatalanAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilter.g.cs new file mode 100644 index 00000000000..730e1c86b9b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilter.g.cs @@ -0,0 +1,161 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Analysis; + +internal sealed partial class ICharFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ICharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "html_strip" => reader.ReadValue(options, null), + "icu_normalizer" => reader.ReadValue(options, null), + "kuromoji_iteration_mark" => reader.ReadValue(options, null), + "mapping" => reader.ReadValue(options, null), + "pattern_replace" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ICharFilter)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ICharFilter value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "html_strip": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter)value, null); + break; + case "icu_normalizer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter)value, null); + break; + case "kuromoji_iteration_mark": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter)value, null); + break; + case "mapping": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter)value, null); + break; + case "pattern_replace": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ICharFilter)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ICharFilterConverter))] +public partial interface ICharFilter +{ + public string Type { get; } +} + +public readonly partial struct CharFilterFactory +{ + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter HtmlStrip(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter HtmlStrip() + { + return Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter HtmlStrip(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter IcuNormalization(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter IcuNormalization() + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter IcuNormalization(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter KuromojiIterationMark(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter KuromojiIterationMark(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter Mapping(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter Mapping() + { + return Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter Mapping(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter PatternReplace(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ICharFilter PatternReplace(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ICharFilter Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.Analysis.CharFilterFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilters.g.cs index 893e7f01f76..2f2bd2daf19 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharFilters.g.cs @@ -17,137 +17,150 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public partial class CharFilters : IsADictionary +internal sealed partial class CharFiltersConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Analysis.CharFilters Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Analysis.CharFilters(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CharFilters value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CharFiltersConverter))] +public sealed partial class CharFilters : Elastic.Clients.Elasticsearch.IsADictionary { public CharFilters() { } - public CharFilters(IDictionary container) : base(container) + public CharFilters(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, ICharFilter charFilter) => BackingDictionary.Add(Sanitize(name), charFilter); - public bool TryGetCharFilter(string name, [NotNullWhen(returnValue: true)] out ICharFilter charFilter) => BackingDictionary.TryGetValue(Sanitize(name), out charFilter); + public void Add(string key, Elastic.Clients.Elasticsearch.Analysis.ICharFilter value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetCharFilter(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Analysis.ICharFilter value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetCharFilter(string name, [NotNullWhen(returnValue: true)] out T? charFilter) where T : class, ICharFilter + public bool TryGetCharFilter(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, ICharFilter { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - charFilter = finalValue; + value = finalValue; return true; } - charFilter = null; + value = null; return false; } } -public sealed partial class CharFiltersDescriptor : IsADictionaryDescriptor +public readonly partial struct CharFiltersDescriptor { - public CharFiltersDescriptor() : base(new CharFilters()) + private readonly Elastic.Clients.Elasticsearch.Analysis.CharFilters _items = new(); + + private Elastic.Clients.Elasticsearch.Analysis.CharFilters Value => _items; + + public CharFiltersDescriptor() { } - public CharFiltersDescriptor(CharFilters charFilters) : base(charFilters ?? new CharFilters()) + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor HtmlStrip(string key, Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter value) { + _items.Add(key, value); + return this; } - public CharFiltersDescriptor HtmlStrip(string charFilterName) => AssignVariant(charFilterName, null); - public CharFiltersDescriptor HtmlStrip(string charFilterName, Action configure) => AssignVariant(charFilterName, configure); - public CharFiltersDescriptor HtmlStrip(string charFilterName, HtmlStripCharFilter htmlStripCharFilter) => AssignVariant(charFilterName, htmlStripCharFilter); - public CharFiltersDescriptor IcuNormalization(string charFilterName) => AssignVariant(charFilterName, null); - public CharFiltersDescriptor IcuNormalization(string charFilterName, Action configure) => AssignVariant(charFilterName, configure); - public CharFiltersDescriptor IcuNormalization(string charFilterName, IcuNormalizationCharFilter icuNormalizationCharFilter) => AssignVariant(charFilterName, icuNormalizationCharFilter); - public CharFiltersDescriptor KuromojiIterationMark(string charFilterName) => AssignVariant(charFilterName, null); - public CharFiltersDescriptor KuromojiIterationMark(string charFilterName, Action configure) => AssignVariant(charFilterName, configure); - public CharFiltersDescriptor KuromojiIterationMark(string charFilterName, KuromojiIterationMarkCharFilter kuromojiIterationMarkCharFilter) => AssignVariant(charFilterName, kuromojiIterationMarkCharFilter); - public CharFiltersDescriptor Mapping(string charFilterName) => AssignVariant(charFilterName, null); - public CharFiltersDescriptor Mapping(string charFilterName, Action configure) => AssignVariant(charFilterName, configure); - public CharFiltersDescriptor Mapping(string charFilterName, MappingCharFilter mappingCharFilter) => AssignVariant(charFilterName, mappingCharFilter); - public CharFiltersDescriptor PatternReplace(string charFilterName) => AssignVariant(charFilterName, null); - public CharFiltersDescriptor PatternReplace(string charFilterName, Action configure) => AssignVariant(charFilterName, configure); - public CharFiltersDescriptor PatternReplace(string charFilterName, PatternReplaceCharFilter patternReplaceCharFilter) => AssignVariant(charFilterName, patternReplaceCharFilter); -} + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor HtmlStrip(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor.Build(null)); + return this; + } -internal sealed partial class CharFilterInterfaceConverter : JsonConverter -{ - public override ICharFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor HtmlStrip(string key, System.Action? action) { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor.Build(action)); + return this; + } - switch (type) - { - case "html_strip": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_normalizer": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji_iteration_mark": - return JsonSerializer.Deserialize(ref reader, options); - case "mapping": - return JsonSerializer.Deserialize(ref reader, options); - case "pattern_replace": - return JsonSerializer.Deserialize(ref reader, options); - default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(ICharFilter)); - return null; - } + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor IcuNormalization(string key, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, ICharFilter value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor IcuNormalization(string key) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor IcuNormalization(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor KuromojiIterationMark(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor KuromojiIterationMark(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor.Build(action)); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor Mapping(string key, Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor Mapping(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor Mapping(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor PatternReplace(string key, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor PatternReplace(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CharFilters Build(System.Action? action) + { + if (action is null) { - case "html_strip": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter), options); - return; - case "icu_normalizer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter), options); - return; - case "kuromoji_iteration_mark": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter), options); - return; - case "mapping": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter), options); - return; - case "pattern_replace": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.Analysis.CharFilters(); } - } -} -[JsonConverter(typeof(CharFilterInterfaceConverter))] -public partial interface ICharFilter -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharGroupTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharGroupTokenizer.g.cs index 867b2d1ca8a..aab19049dda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharGroupTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CharGroupTokenizer.g.cs @@ -17,86 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CharGroupTokenizer : ITokenizer +internal sealed partial class CharGroupTokenizerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("max_token_length")] + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizeOnChars = System.Text.Json.JsonEncodedText.Encode("tokenize_on_chars"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue> propTokenizeOnChars = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (propTokenizeOnChars.TryReadProperty(ref reader, options, PropTokenizeOnChars, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + TokenizeOnChars = propTokenizeOnChars.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropTokenizeOnChars, value.TokenizeOnChars, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerConverter))] +public sealed partial class CharGroupTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CharGroupTokenizer(System.Collections.Generic.ICollection tokenizeOnChars) + { + TokenizeOnChars = tokenizeOnChars; + } +#if NET7_0_OR_GREATER + public CharGroupTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CharGroupTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CharGroupTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("tokenize_on_chars")] - public ICollection TokenizeOnChars { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection TokenizeOnChars { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "char_group"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class CharGroupTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CharGroupTokenizerDescriptor { - internal CharGroupTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer Instance { get; init; } - public CharGroupTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CharGroupTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer instance) { + Instance = instance; } - private int? MaxTokenLengthValue { get; set; } - private ICollection TokenizeOnCharsValue { get; set; } - private string? VersionValue { get; set; } - - public CharGroupTokenizerDescriptor MaxTokenLength(int? maxTokenLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CharGroupTokenizerDescriptor() { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public CharGroupTokenizerDescriptor TokenizeOnChars(ICollection tokenizeOnChars) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor MaxTokenLength(int? value) { - TokenizeOnCharsValue = tokenizeOnChars; - return Self; + Instance.MaxTokenLength = value; + return this; } - public CharGroupTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor TokenizeOnChars(System.Collections.Generic.ICollection value) { - VersionValue = version; - return Self; + Instance.TokenizeOnChars = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor TokenizeOnChars(params string[] values) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } - - writer.WritePropertyName("tokenize_on_chars"); - JsonSerializer.Serialize(writer, TokenizeOnCharsValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("char_group"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.TokenizeOnChars = [.. values]; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - CharGroupTokenizer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer Build(System.Action action) { - MaxTokenLength = MaxTokenLengthValue, - TokenizeOnChars = TokenizeOnCharsValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ChineseAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ChineseAnalyzer.g.cs index 8a70c33dd66..e250960c782 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ChineseAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ChineseAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ChineseAnalyzer : IAnalyzer +internal sealed partial class ChineseAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerConverter))] +public sealed partial class ChineseAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public ChineseAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ChineseAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChineseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "chinese"; } -public sealed partial class ChineseAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ChineseAnalyzerDescriptor { - internal ChineseAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer Instance { get; init; } - public ChineseAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChineseAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChineseAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ChineseAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer(Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public ChineseAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("chinese"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ChineseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ChineseAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CjkAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CjkAnalyzer.g.cs index 3fb380874ff..ff34f87b8fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CjkAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CjkAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CjkAnalyzer : IAnalyzer +internal sealed partial class CjkAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerConverter))] +public sealed partial class CjkAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public CjkAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public CjkAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CjkAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "cjk"; } -public sealed partial class CjkAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CjkAnalyzerDescriptor { - internal CjkAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer Instance { get; init; } - public CjkAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CjkAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CjkAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CjkAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer(Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public CjkAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("cjk"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CjkAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - CjkAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ClassicTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ClassicTokenizer.g.cs index 769294fda99..218c6e26ca8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ClassicTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ClassicTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ClassicTokenizer : ITokenizer +internal sealed partial class ClassicTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerConverter))] +public sealed partial class ClassicTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("max_token_length")] +#if NET7_0_OR_GREATER + public ClassicTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClassicTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClassicTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "classic"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ClassicTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ClassicTokenizerDescriptor { - internal ClassicTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer Instance { get; init; } - public ClassicTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClassicTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer instance) { + Instance = instance; } - private int? MaxTokenLengthValue { get; set; } - private string? VersionValue { get; set; } - - public ClassicTokenizerDescriptor MaxTokenLength(int? maxTokenLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClassicTokenizerDescriptor() { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ClassicTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor MaxTokenLength(int? value) { - VersionValue = version; - return Self; + Instance.MaxTokenLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("classic"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ClassicTokenizer IBuildableDescriptor.Build() => new() - { - MaxTokenLength = MaxTokenLengthValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CommonGramsTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CommonGramsTokenFilter.g.cs index 4f45e01e10e..4f3573feb45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CommonGramsTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CommonGramsTokenFilter.g.cs @@ -17,122 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CommonGramsTokenFilter : ITokenFilter +internal sealed partial class CommonGramsTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCommonWords = System.Text.Json.JsonEncodedText.Encode("common_words"); + private static readonly System.Text.Json.JsonEncodedText PropCommonWordsPath = System.Text.Json.JsonEncodedText.Encode("common_words_path"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreCase = System.Text.Json.JsonEncodedText.Encode("ignore_case"); + private static readonly System.Text.Json.JsonEncodedText PropQueryMode = System.Text.Json.JsonEncodedText.Encode("query_mode"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCommonWords = default; + LocalJsonValue propCommonWordsPath = default; + LocalJsonValue propIgnoreCase = default; + LocalJsonValue propQueryMode = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCommonWords.TryReadProperty(ref reader, options, PropCommonWords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCommonWordsPath.TryReadProperty(ref reader, options, PropCommonWordsPath, null)) + { + continue; + } + + if (propIgnoreCase.TryReadProperty(ref reader, options, PropIgnoreCase, null)) + { + continue; + } + + if (propQueryMode.TryReadProperty(ref reader, options, PropQueryMode, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CommonWords = propCommonWords.Value, + CommonWordsPath = propCommonWordsPath.Value, + IgnoreCase = propIgnoreCase.Value, + QueryMode = propQueryMode.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCommonWords, value.CommonWords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCommonWordsPath, value.CommonWordsPath, null, null); + writer.WriteProperty(options, PropIgnoreCase, value.IgnoreCase, null, null); + writer.WriteProperty(options, PropQueryMode, value.QueryMode, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterConverter))] +public sealed partial class CommonGramsTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("common_words")] - public ICollection? CommonWords { get; set; } - [JsonInclude, JsonPropertyName("common_words_path")] +#if NET7_0_OR_GREATER + public CommonGramsTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public CommonGramsTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? CommonWords { get; set; } public string? CommonWordsPath { get; set; } - [JsonInclude, JsonPropertyName("ignore_case")] public bool? IgnoreCase { get; set; } - [JsonInclude, JsonPropertyName("query_mode")] public bool? QueryMode { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "common_grams"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class CommonGramsTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CommonGramsTokenFilterDescriptor { - internal CommonGramsTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter Instance { get; init; } - public CommonGramsTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonGramsTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter instance) { + Instance = instance; } - private ICollection? CommonWordsValue { get; set; } - private string? CommonWordsPathValue { get; set; } - private bool? IgnoreCaseValue { get; set; } - private bool? QueryModeValue { get; set; } - private string? VersionValue { get; set; } - - public CommonGramsTokenFilterDescriptor CommonWords(ICollection? commonWords) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonGramsTokenFilterDescriptor() { - CommonWordsValue = commonWords; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public CommonGramsTokenFilterDescriptor CommonWordsPath(string? commonWordsPath) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor CommonWords(System.Collections.Generic.ICollection? value) { - CommonWordsPathValue = commonWordsPath; - return Self; + Instance.CommonWords = value; + return this; } - public CommonGramsTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor CommonWords(params string[] values) { - IgnoreCaseValue = ignoreCase; - return Self; + Instance.CommonWords = [.. values]; + return this; } - public CommonGramsTokenFilterDescriptor QueryMode(bool? queryMode = true) + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor CommonWordsPath(string? value) { - QueryModeValue = queryMode; - return Self; + Instance.CommonWordsPath = value; + return this; } - public CommonGramsTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor IgnoreCase(bool? value = true) { - VersionValue = version; - return Self; + Instance.IgnoreCase = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor QueryMode(bool? value = true) { - writer.WriteStartObject(); - if (CommonWordsValue is not null) - { - writer.WritePropertyName("common_words"); - JsonSerializer.Serialize(writer, CommonWordsValue, options); - } - - if (!string.IsNullOrEmpty(CommonWordsPathValue)) - { - writer.WritePropertyName("common_words_path"); - writer.WriteStringValue(CommonWordsPathValue); - } - - if (IgnoreCaseValue.HasValue) - { - writer.WritePropertyName("ignore_case"); - writer.WriteBooleanValue(IgnoreCaseValue.Value); - } + Instance.QueryMode = value; + return this; + } - if (QueryModeValue.HasValue) - { - writer.WritePropertyName("query_mode"); - writer.WriteBooleanValue(QueryModeValue.Value); - } + public Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("common_grams"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - CommonGramsTokenFilter IBuildableDescriptor.Build() => new() - { - CommonWords = CommonWordsValue, - CommonWordsPath = CommonWordsPathValue, - IgnoreCase = IgnoreCaseValue, - QueryMode = QueryModeValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ConditionTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ConditionTokenFilter.g.cs index b681db39789..10bb963a3d1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ConditionTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ConditionTokenFilter.g.cs @@ -17,140 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ConditionTokenFilter : ITokenFilter +internal sealed partial class ConditionTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("filter")] - public ICollection Filter { get; set; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFilter = default; + LocalJsonValue propScript = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + Script = propScript.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterConverter))] +public sealed partial class ConditionTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConditionTokenFilter(System.Collections.Generic.ICollection filter, Elastic.Clients.Elasticsearch.Script script) + { + Filter = filter; + Script = script; + } +#if NET7_0_OR_GREATER + public ConditionTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConditionTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConditionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Filter { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "condition"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ConditionTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ConditionTokenFilterDescriptor { - internal ConditionTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter Instance { get; init; } - public ConditionTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConditionTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter instance) { + Instance = instance; } - private ICollection FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? VersionValue { get; set; } - - public ConditionTokenFilterDescriptor Filter(ICollection filter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConditionTokenFilterDescriptor() { - FilterValue = filter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ConditionTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Filter(System.Collections.Generic.ICollection value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Filter = value; + return this; } - public ConditionTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Filter(params string[] values) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public ConditionTokenFilterDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } - public ConditionTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Script() { - VersionValue = version; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Script(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("condition"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.Script BuildScript() + public Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor Version(string? value) { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + Instance.Version = value; + return this; } - ConditionTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter Build(System.Action action) { - Filter = FilterValue, - Script = BuildScript(), - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomAnalyzer.g.cs index ba1549ff6a7..372ce00bf71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomAnalyzer.g.cs @@ -17,119 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CustomAnalyzer : IAnalyzer +internal sealed partial class CustomAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharFilter = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropPositionIncrementGap = System.Text.Json.JsonEncodedText.Encode("position_increment_gap"); + private static readonly System.Text.Json.JsonEncodedText PropPositionOffsetGap = System.Text.Json.JsonEncodedText.Encode("position_offset_gap"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCharFilter = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propPositionIncrementGap = default; + LocalJsonValue propPositionOffsetGap = default; + LocalJsonValue propTokenizer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharFilter.TryReadProperty(ref reader, options, PropCharFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propPositionIncrementGap.TryReadProperty(ref reader, options, PropPositionIncrementGap, null)) + { + continue; + } + + if (propPositionOffsetGap.TryReadProperty(ref reader, options, PropPositionOffsetGap, null)) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharFilter = propCharFilter.Value, + Filter = propFilter.Value, + PositionIncrementGap = propPositionIncrementGap.Value, + PositionOffsetGap = propPositionOffsetGap.Value, + Tokenizer = propTokenizer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharFilter, value.CharFilter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPositionIncrementGap, value.PositionIncrementGap, null, null); + writer.WriteProperty(options, PropPositionOffsetGap, value.PositionOffsetGap, null, null); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerConverter))] +public sealed partial class CustomAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("char_filter")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? CharFilter { get; set; } - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Filter { get; set; } - [JsonInclude, JsonPropertyName("position_increment_gap")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomAnalyzer(string tokenizer) + { + Tokenizer = tokenizer; + } +#if NET7_0_OR_GREATER + public CustomAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CustomAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CustomAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? CharFilter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } public int? PositionIncrementGap { get; set; } - [JsonInclude, JsonPropertyName("position_offset_gap")] public int? PositionOffsetGap { get; set; } - [JsonInclude, JsonPropertyName("tokenizer")] - public string Tokenizer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Tokenizer { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "custom"; } -public sealed partial class CustomAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CustomAnalyzerDescriptor { - internal CustomAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer Instance { get; init; } - public CustomAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer instance) { + Instance = instance; } - private ICollection? CharFilterValue { get; set; } - private ICollection? FilterValue { get; set; } - private int? PositionIncrementGapValue { get; set; } - private int? PositionOffsetGapValue { get; set; } - private string TokenizerValue { get; set; } - - public CustomAnalyzerDescriptor CharFilter(ICollection? charFilter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomAnalyzerDescriptor() { - CharFilterValue = charFilter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public CustomAnalyzerDescriptor Filter(ICollection? filter) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer(Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor CharFilter(System.Collections.Generic.ICollection? value) { - FilterValue = filter; - return Self; + Instance.CharFilter = value; + return this; } - public CustomAnalyzerDescriptor PositionIncrementGap(int? positionIncrementGap) + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor CharFilter(params string[] values) { - PositionIncrementGapValue = positionIncrementGap; - return Self; + Instance.CharFilter = [.. values]; + return this; } - public CustomAnalyzerDescriptor PositionOffsetGap(int? positionOffsetGap) + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor Filter(System.Collections.Generic.ICollection? value) { - PositionOffsetGapValue = positionOffsetGap; - return Self; + Instance.Filter = value; + return this; } - public CustomAnalyzerDescriptor Tokenizer(string tokenizer) + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor Filter(params string[] values) { - TokenizerValue = tokenizer; - return Self; + Instance.Filter = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor PositionIncrementGap(int? value) { - writer.WriteStartObject(); - if (CharFilterValue is not null) - { - writer.WritePropertyName("char_filter"); - SingleOrManySerializationHelper.Serialize(CharFilterValue, writer, options); - } - - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (PositionIncrementGapValue.HasValue) - { - writer.WritePropertyName("position_increment_gap"); - writer.WriteNumberValue(PositionIncrementGapValue.Value); - } + Instance.PositionIncrementGap = value; + return this; + } - if (PositionOffsetGapValue.HasValue) - { - writer.WritePropertyName("position_offset_gap"); - writer.WriteNumberValue(PositionOffsetGapValue.Value); - } + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor PositionOffsetGap(int? value) + { + Instance.PositionOffsetGap = value; + return this; + } - writer.WritePropertyName("tokenizer"); - writer.WriteStringValue(TokenizerValue); - writer.WritePropertyName("type"); - writer.WriteStringValue("custom"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor Tokenizer(string value) + { + Instance.Tokenizer = value; + return this; } - CustomAnalyzer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer Build(System.Action action) { - CharFilter = CharFilterValue, - Filter = FilterValue, - PositionIncrementGap = PositionIncrementGapValue, - PositionOffsetGap = PositionOffsetGapValue, - Tokenizer = TokenizerValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CustomAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomNormalizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomNormalizer.g.cs index 6c94b671494..6029c630f6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomNormalizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CustomNormalizer.g.cs @@ -17,73 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CustomNormalizer : INormalizer +internal sealed partial class CustomNormalizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharFilter = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCharFilter = default; + LocalJsonValue?> propFilter = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharFilter.TryReadProperty(ref reader, options, PropCharFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharFilter = propCharFilter.Value, + Filter = propFilter.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharFilter, value.CharFilter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerConverter))] +public sealed partial class CustomNormalizer : Elastic.Clients.Elasticsearch.Analysis.INormalizer { - [JsonInclude, JsonPropertyName("char_filter")] - public ICollection? CharFilter { get; set; } - [JsonInclude, JsonPropertyName("filter")] - public ICollection? Filter { get; set; } +#if NET7_0_OR_GREATER + public CustomNormalizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public CustomNormalizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CustomNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? CharFilter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "custom"; } -public sealed partial class CustomNormalizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CustomNormalizerDescriptor { - internal CustomNormalizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer Instance { get; init; } - public CustomNormalizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomNormalizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer instance) { + Instance = instance; } - private ICollection? CharFilterValue { get; set; } - private ICollection? FilterValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CustomNormalizerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CustomNormalizerDescriptor CharFilter(ICollection? charFilter) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer instance) => new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer(Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor CharFilter(System.Collections.Generic.ICollection? value) { - CharFilterValue = charFilter; - return Self; + Instance.CharFilter = value; + return this; } - public CustomNormalizerDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor CharFilter(params string[] values) { - FilterValue = filter; - return Self; + Instance.CharFilter = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor Filter(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (CharFilterValue is not null) - { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFilterValue, options); - } + Instance.Filter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor Filter(params string[] values) + { + Instance.Filter = [.. values]; + return this; + } - if (FilterValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); + return new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("custom"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - CustomNormalizer IBuildableDescriptor.Build() => new() - { - CharFilter = CharFilterValue, - Filter = FilterValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CzechAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CzechAnalyzer.g.cs index 85203810347..f37029f4c4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CzechAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/CzechAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class CzechAnalyzer : IAnalyzer +internal sealed partial class CzechAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerConverter))] +public sealed partial class CzechAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public CzechAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public CzechAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CzechAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "czech"; } -public sealed partial class CzechAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct CzechAnalyzerDescriptor { - internal CzechAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CzechAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer instance) + { + Instance = instance; + } - public CzechAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CzechAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer(Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor descriptor) => descriptor.Instance; - public CzechAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public CzechAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public CzechAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("czech"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.CzechAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - CzechAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DanishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DanishAnalyzer.g.cs index 96f1845395b..43243e14841 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DanishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DanishAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class DanishAnalyzer : IAnalyzer +internal sealed partial class DanishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerConverter))] +public sealed partial class DanishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public DanishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public DanishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "danish"; } -public sealed partial class DanishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DanishAnalyzerDescriptor { - internal DanishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer Instance { get; init; } - public DanishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DanishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DanishAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DanishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public DanishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("danish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.DanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DanishAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs index 37a5f56a30b..ea2c847921c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DelimitedPayloadTokenFilter.g.cs @@ -17,90 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class DelimitedPayloadTokenFilter : ITokenFilter +internal sealed partial class DelimitedPayloadTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("delimiter")] + private static readonly System.Text.Json.JsonEncodedText PropDelimiter = System.Text.Json.JsonEncodedText.Encode("delimiter"); + private static readonly System.Text.Json.JsonEncodedText PropEncoding = System.Text.Json.JsonEncodedText.Encode("encoding"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDelimiter = default; + LocalJsonValue propEncoding = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDelimiter.TryReadProperty(ref reader, options, PropDelimiter, null)) + { + continue; + } + + if (propEncoding.TryReadProperty(ref reader, options, PropEncoding, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Delimiter = propDelimiter.Value, + Encoding = propEncoding.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDelimiter, value.Delimiter, null, null); + writer.WriteProperty(options, PropEncoding, value.Encoding, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterConverter))] +public sealed partial class DelimitedPayloadTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public DelimitedPayloadTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public DelimitedPayloadTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Delimiter { get; set; } - [JsonInclude, JsonPropertyName("encoding")] public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? Encoding { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "delimited_payload"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class DelimitedPayloadTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DelimitedPayloadTokenFilterDescriptor { - internal DelimitedPayloadTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter Instance { get; init; } - public DelimitedPayloadTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelimitedPayloadTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter instance) { + Instance = instance; } - private string? DelimiterValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? EncodingValue { get; set; } - private string? VersionValue { get; set; } - - public DelimitedPayloadTokenFilterDescriptor Delimiter(string? delimiter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelimitedPayloadTokenFilterDescriptor() { - DelimiterValue = delimiter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DelimitedPayloadTokenFilterDescriptor Encoding(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? encoding) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor Delimiter(string? value) { - EncodingValue = encoding; - return Self; + Instance.Delimiter = value; + return this; } - public DelimitedPayloadTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor Encoding(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding? value) { - VersionValue = version; - return Self; + Instance.Encoding = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DelimiterValue)) - { - writer.WritePropertyName("delimiter"); - writer.WriteStringValue(DelimiterValue); - } - - if (EncodingValue is not null) - { - writer.WritePropertyName("encoding"); - JsonSerializer.Serialize(writer, EncodingValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("delimited_payload"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DelimitedPayloadTokenFilter IBuildableDescriptor.Build() => new() - { - Delimiter = DelimiterValue, - Encoding = EncodingValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DictionaryDecompounderTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DictionaryDecompounderTokenFilter.g.cs index a1cead6976f..59df54ef3a8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DictionaryDecompounderTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DictionaryDecompounderTokenFilter.g.cs @@ -17,170 +17,237 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class DictionaryDecompounderTokenFilter : ITokenFilter +internal sealed partial class DictionaryDecompounderTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHyphenationPatternsPath = System.Text.Json.JsonEncodedText.Encode("hyphenation_patterns_path"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSubwordSize = System.Text.Json.JsonEncodedText.Encode("max_subword_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinSubwordSize = System.Text.Json.JsonEncodedText.Encode("min_subword_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordSize = System.Text.Json.JsonEncodedText.Encode("min_word_size"); + private static readonly System.Text.Json.JsonEncodedText PropOnlyLongestMatch = System.Text.Json.JsonEncodedText.Encode("only_longest_match"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropWordList = System.Text.Json.JsonEncodedText.Encode("word_list"); + private static readonly System.Text.Json.JsonEncodedText PropWordListPath = System.Text.Json.JsonEncodedText.Encode("word_list_path"); + + public override Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHyphenationPatternsPath = default; + LocalJsonValue propMaxSubwordSize = default; + LocalJsonValue propMinSubwordSize = default; + LocalJsonValue propMinWordSize = default; + LocalJsonValue propOnlyLongestMatch = default; + LocalJsonValue propVersion = default; + LocalJsonValue?> propWordList = default; + LocalJsonValue propWordListPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHyphenationPatternsPath.TryReadProperty(ref reader, options, PropHyphenationPatternsPath, null)) + { + continue; + } + + if (propMaxSubwordSize.TryReadProperty(ref reader, options, PropMaxSubwordSize, null)) + { + continue; + } + + if (propMinSubwordSize.TryReadProperty(ref reader, options, PropMinSubwordSize, null)) + { + continue; + } + + if (propMinWordSize.TryReadProperty(ref reader, options, PropMinWordSize, null)) + { + continue; + } + + if (propOnlyLongestMatch.TryReadProperty(ref reader, options, PropOnlyLongestMatch, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propWordList.TryReadProperty(ref reader, options, PropWordList, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propWordListPath.TryReadProperty(ref reader, options, PropWordListPath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HyphenationPatternsPath = propHyphenationPatternsPath.Value, + MaxSubwordSize = propMaxSubwordSize.Value, + MinSubwordSize = propMinSubwordSize.Value, + MinWordSize = propMinWordSize.Value, + OnlyLongestMatch = propOnlyLongestMatch.Value, + Version = propVersion.Value, + WordList = propWordList.Value, + WordListPath = propWordListPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHyphenationPatternsPath, value.HyphenationPatternsPath, null, null); + writer.WriteProperty(options, PropMaxSubwordSize, value.MaxSubwordSize, null, null); + writer.WriteProperty(options, PropMinSubwordSize, value.MinSubwordSize, null, null); + writer.WriteProperty(options, PropMinWordSize, value.MinWordSize, null, null); + writer.WriteProperty(options, PropOnlyLongestMatch, value.OnlyLongestMatch, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropWordList, value.WordList, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropWordListPath, value.WordListPath, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterConverter))] +public sealed partial class DictionaryDecompounderTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("hyphenation_patterns_path")] +#if NET7_0_OR_GREATER + public DictionaryDecompounderTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public DictionaryDecompounderTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? HyphenationPatternsPath { get; set; } - [JsonInclude, JsonPropertyName("max_subword_size")] public int? MaxSubwordSize { get; set; } - [JsonInclude, JsonPropertyName("min_subword_size")] public int? MinSubwordSize { get; set; } - [JsonInclude, JsonPropertyName("min_word_size")] public int? MinWordSize { get; set; } - [JsonInclude, JsonPropertyName("only_longest_match")] public bool? OnlyLongestMatch { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "dictionary_decompounder"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } - [JsonInclude, JsonPropertyName("word_list")] - public ICollection? WordList { get; set; } - [JsonInclude, JsonPropertyName("word_list_path")] + public System.Collections.Generic.ICollection? WordList { get; set; } public string? WordListPath { get; set; } } -public sealed partial class DictionaryDecompounderTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DictionaryDecompounderTokenFilterDescriptor { - internal DictionaryDecompounderTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter Instance { get; init; } - public DictionaryDecompounderTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DictionaryDecompounderTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter instance) { + Instance = instance; } - private string? HyphenationPatternsPathValue { get; set; } - private int? MaxSubwordSizeValue { get; set; } - private int? MinSubwordSizeValue { get; set; } - private int? MinWordSizeValue { get; set; } - private bool? OnlyLongestMatchValue { get; set; } - private string? VersionValue { get; set; } - private ICollection? WordListValue { get; set; } - private string? WordListPathValue { get; set; } - - public DictionaryDecompounderTokenFilterDescriptor HyphenationPatternsPath(string? hyphenationPatternsPath) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DictionaryDecompounderTokenFilterDescriptor() { - HyphenationPatternsPathValue = hyphenationPatternsPath; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DictionaryDecompounderTokenFilterDescriptor MaxSubwordSize(int? maxSubwordSize) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor HyphenationPatternsPath(string? value) { - MaxSubwordSizeValue = maxSubwordSize; - return Self; + Instance.HyphenationPatternsPath = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor MinSubwordSize(int? minSubwordSize) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor MaxSubwordSize(int? value) { - MinSubwordSizeValue = minSubwordSize; - return Self; + Instance.MaxSubwordSize = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor MinWordSize(int? minWordSize) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor MinSubwordSize(int? value) { - MinWordSizeValue = minWordSize; - return Self; + Instance.MinSubwordSize = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor OnlyLongestMatch(bool? onlyLongestMatch = true) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor MinWordSize(int? value) { - OnlyLongestMatchValue = onlyLongestMatch; - return Self; + Instance.MinWordSize = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor OnlyLongestMatch(bool? value = true) { - VersionValue = version; - return Self; + Instance.OnlyLongestMatch = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor WordList(ICollection? wordList) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor Version(string? value) { - WordListValue = wordList; - return Self; + Instance.Version = value; + return this; } - public DictionaryDecompounderTokenFilterDescriptor WordListPath(string? wordListPath) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor WordList(System.Collections.Generic.ICollection? value) { - WordListPathValue = wordListPath; - return Self; + Instance.WordList = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor WordList(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(HyphenationPatternsPathValue)) - { - writer.WritePropertyName("hyphenation_patterns_path"); - writer.WriteStringValue(HyphenationPatternsPathValue); - } - - if (MaxSubwordSizeValue.HasValue) - { - writer.WritePropertyName("max_subword_size"); - writer.WriteNumberValue(MaxSubwordSizeValue.Value); - } - - if (MinSubwordSizeValue.HasValue) - { - writer.WritePropertyName("min_subword_size"); - writer.WriteNumberValue(MinSubwordSizeValue.Value); - } - - if (MinWordSizeValue.HasValue) - { - writer.WritePropertyName("min_word_size"); - writer.WriteNumberValue(MinWordSizeValue.Value); - } - - if (OnlyLongestMatchValue.HasValue) - { - writer.WritePropertyName("only_longest_match"); - writer.WriteBooleanValue(OnlyLongestMatchValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("dictionary_decompounder"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.WordList = [.. values]; + return this; + } - if (WordListValue is not null) - { - writer.WritePropertyName("word_list"); - JsonSerializer.Serialize(writer, WordListValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor WordListPath(string? value) + { + Instance.WordListPath = value; + return this; + } - if (!string.IsNullOrEmpty(WordListPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("word_list_path"); - writer.WriteStringValue(WordListPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DictionaryDecompounderTokenFilter IBuildableDescriptor.Build() => new() - { - HyphenationPatternsPath = HyphenationPatternsPathValue, - MaxSubwordSize = MaxSubwordSizeValue, - MinSubwordSize = MinSubwordSizeValue, - MinWordSize = MinWordSizeValue, - OnlyLongestMatch = OnlyLongestMatchValue, - Version = VersionValue, - WordList = WordListValue, - WordListPath = WordListPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DutchAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DutchAnalyzer.g.cs index 7fdbe496526..fbc02381d8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DutchAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/DutchAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class DutchAnalyzer : IAnalyzer +internal sealed partial class DutchAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerConverter))] +public sealed partial class DutchAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public DutchAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public DutchAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DutchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "dutch"; } -public sealed partial class DutchAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DutchAnalyzerDescriptor { - internal DutchAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DutchAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer instance) + { + Instance = instance; + } - public DutchAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DutchAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer(Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor descriptor) => descriptor.Instance; - public DutchAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public DutchAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public DutchAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("dutch"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.DutchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DutchAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs index 0d2f7137290..a3bc3ffc7d4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenFilter.g.cs @@ -17,122 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class EdgeNGramTokenFilter : ITokenFilter +internal sealed partial class EdgeNGramTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("max_gram")] + private static readonly System.Text.Json.JsonEncodedText PropMaxGram = System.Text.Json.JsonEncodedText.Encode("max_gram"); + private static readonly System.Text.Json.JsonEncodedText PropMinGram = System.Text.Json.JsonEncodedText.Encode("min_gram"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropSide = System.Text.Json.JsonEncodedText.Encode("side"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxGram = default; + LocalJsonValue propMinGram = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue propSide = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxGram.TryReadProperty(ref reader, options, PropMaxGram, null)) + { + continue; + } + + if (propMinGram.TryReadProperty(ref reader, options, PropMinGram, null)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (propSide.TryReadProperty(ref reader, options, PropSide, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxGram = propMaxGram.Value, + MinGram = propMinGram.Value, + PreserveOriginal = propPreserveOriginal.Value, + Side = propSide.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxGram, value.MaxGram, null, null); + writer.WriteProperty(options, PropMinGram, value.MinGram, null, null); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropSide, value.Side, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterConverter))] +public sealed partial class EdgeNGramTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public EdgeNGramTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public EdgeNGramTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxGram { get; set; } - [JsonInclude, JsonPropertyName("min_gram")] public int? MinGram { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("side")] public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide? Side { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "edge_ngram"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class EdgeNGramTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct EdgeNGramTokenFilterDescriptor { - internal EdgeNGramTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter Instance { get; init; } - public EdgeNGramTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EdgeNGramTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter instance) { + Instance = instance; } - private int? MaxGramValue { get; set; } - private int? MinGramValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide? SideValue { get; set; } - private string? VersionValue { get; set; } - - public EdgeNGramTokenFilterDescriptor MaxGram(int? maxGram) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EdgeNGramTokenFilterDescriptor() { - MaxGramValue = maxGram; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public EdgeNGramTokenFilterDescriptor MinGram(int? minGram) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor MaxGram(int? value) { - MinGramValue = minGram; - return Self; + Instance.MaxGram = value; + return this; } - public EdgeNGramTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor MinGram(int? value) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.MinGram = value; + return this; } - public EdgeNGramTokenFilterDescriptor Side(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide? side) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor PreserveOriginal(bool? value = true) { - SideValue = side; - return Self; + Instance.PreserveOriginal = value; + return this; } - public EdgeNGramTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor Side(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide? value) { - VersionValue = version; - return Self; + Instance.Side = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxGramValue.HasValue) - { - writer.WritePropertyName("max_gram"); - writer.WriteNumberValue(MaxGramValue.Value); - } - - if (MinGramValue.HasValue) - { - writer.WritePropertyName("min_gram"); - writer.WriteNumberValue(MinGramValue.Value); - } - - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } - - if (SideValue is not null) - { - writer.WritePropertyName("side"); - JsonSerializer.Serialize(writer, SideValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("edge_ngram"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - EdgeNGramTokenFilter IBuildableDescriptor.Build() => new() - { - MaxGram = MaxGramValue, - MinGram = MinGramValue, - PreserveOriginal = PreserveOriginalValue, - Side = SideValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenizer.g.cs index 64fa62a915a..376950e13b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EdgeNGramTokenizer.g.cs @@ -17,122 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class EdgeNGramTokenizer : ITokenizer +internal sealed partial class EdgeNGramTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCustomTokenChars = System.Text.Json.JsonEncodedText.Encode("custom_token_chars"); + private static readonly System.Text.Json.JsonEncodedText PropMaxGram = System.Text.Json.JsonEncodedText.Encode("max_gram"); + private static readonly System.Text.Json.JsonEncodedText PropMinGram = System.Text.Json.JsonEncodedText.Encode("min_gram"); + private static readonly System.Text.Json.JsonEncodedText PropTokenChars = System.Text.Json.JsonEncodedText.Encode("token_chars"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCustomTokenChars = default; + LocalJsonValue propMaxGram = default; + LocalJsonValue propMinGram = default; + LocalJsonValue?> propTokenChars = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCustomTokenChars.TryReadProperty(ref reader, options, PropCustomTokenChars, null)) + { + continue; + } + + if (propMaxGram.TryReadProperty(ref reader, options, PropMaxGram, null)) + { + continue; + } + + if (propMinGram.TryReadProperty(ref reader, options, PropMinGram, null)) + { + continue; + } + + if (propTokenChars.TryReadProperty(ref reader, options, PropTokenChars, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CustomTokenChars = propCustomTokenChars.Value, + MaxGram = propMaxGram.Value, + MinGram = propMinGram.Value, + TokenChars = propTokenChars.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCustomTokenChars, value.CustomTokenChars, null, null); + writer.WriteProperty(options, PropMaxGram, value.MaxGram, null, null); + writer.WriteProperty(options, PropMinGram, value.MinGram, null, null); + writer.WriteProperty(options, PropTokenChars, value.TokenChars, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerConverter))] +public sealed partial class EdgeNGramTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("custom_token_chars")] +#if NET7_0_OR_GREATER + public EdgeNGramTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public EdgeNGramTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? CustomTokenChars { get; set; } - [JsonInclude, JsonPropertyName("max_gram")] public int? MaxGram { get; set; } - [JsonInclude, JsonPropertyName("min_gram")] public int? MinGram { get; set; } - [JsonInclude, JsonPropertyName("token_chars")] - public ICollection? TokenChars { get; set; } + public System.Collections.Generic.ICollection? TokenChars { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "edge_ngram"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class EdgeNGramTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct EdgeNGramTokenizerDescriptor { - internal EdgeNGramTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer Instance { get; init; } - public EdgeNGramTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EdgeNGramTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer instance) { + Instance = instance; } - private string? CustomTokenCharsValue { get; set; } - private int? MaxGramValue { get; set; } - private int? MinGramValue { get; set; } - private ICollection? TokenCharsValue { get; set; } - private string? VersionValue { get; set; } - - public EdgeNGramTokenizerDescriptor CustomTokenChars(string? customTokenChars) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EdgeNGramTokenizerDescriptor() { - CustomTokenCharsValue = customTokenChars; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public EdgeNGramTokenizerDescriptor MaxGram(int? maxGram) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor CustomTokenChars(string? value) { - MaxGramValue = maxGram; - return Self; + Instance.CustomTokenChars = value; + return this; } - public EdgeNGramTokenizerDescriptor MinGram(int? minGram) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor MaxGram(int? value) { - MinGramValue = minGram; - return Self; + Instance.MaxGram = value; + return this; } - public EdgeNGramTokenizerDescriptor TokenChars(ICollection? tokenChars) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor MinGram(int? value) { - TokenCharsValue = tokenChars; - return Self; + Instance.MinGram = value; + return this; } - public EdgeNGramTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor TokenChars(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.TokenChars = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor TokenChars(params Elastic.Clients.Elasticsearch.Analysis.TokenChar[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CustomTokenCharsValue)) - { - writer.WritePropertyName("custom_token_chars"); - writer.WriteStringValue(CustomTokenCharsValue); - } - - if (MaxGramValue.HasValue) - { - writer.WritePropertyName("max_gram"); - writer.WriteNumberValue(MaxGramValue.Value); - } - - if (MinGramValue.HasValue) - { - writer.WritePropertyName("min_gram"); - writer.WriteNumberValue(MinGramValue.Value); - } + Instance.TokenChars = [.. values]; + return this; + } - if (TokenCharsValue is not null) - { - writer.WritePropertyName("token_chars"); - JsonSerializer.Serialize(writer, TokenCharsValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("edge_ngram"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - EdgeNGramTokenizer IBuildableDescriptor.Build() => new() - { - CustomTokenChars = CustomTokenCharsValue, - MaxGram = MaxGramValue, - MinGram = MinGramValue, - TokenChars = TokenCharsValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs index 746bae05f3f..3d186d38f52 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ElisionTokenFilter.g.cs @@ -17,106 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ElisionTokenFilter : ITokenFilter +internal sealed partial class ElisionTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("articles")] - public ICollection? Articles { get; set; } - [JsonInclude, JsonPropertyName("articles_case")] + private static readonly System.Text.Json.JsonEncodedText PropArticles = System.Text.Json.JsonEncodedText.Encode("articles"); + private static readonly System.Text.Json.JsonEncodedText PropArticlesCase = System.Text.Json.JsonEncodedText.Encode("articles_case"); + private static readonly System.Text.Json.JsonEncodedText PropArticlesPath = System.Text.Json.JsonEncodedText.Encode("articles_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propArticles = default; + LocalJsonValue propArticlesCase = default; + LocalJsonValue propArticlesPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propArticles.TryReadProperty(ref reader, options, PropArticles, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propArticlesCase.TryReadProperty(ref reader, options, PropArticlesCase, null)) + { + continue; + } + + if (propArticlesPath.TryReadProperty(ref reader, options, PropArticlesPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Articles = propArticles.Value, + ArticlesCase = propArticlesCase.Value, + ArticlesPath = propArticlesPath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropArticles, value.Articles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropArticlesCase, value.ArticlesCase, null, null); + writer.WriteProperty(options, PropArticlesPath, value.ArticlesPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterConverter))] +public sealed partial class ElisionTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public ElisionTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public ElisionTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElisionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Articles { get; set; } public bool? ArticlesCase { get; set; } - [JsonInclude, JsonPropertyName("articles_path")] public string? ArticlesPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "elision"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ElisionTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ElisionTokenFilterDescriptor { - internal ElisionTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter Instance { get; init; } - public ElisionTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElisionTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter instance) { + Instance = instance; } - private ICollection? ArticlesValue { get; set; } - private bool? ArticlesCaseValue { get; set; } - private string? ArticlesPathValue { get; set; } - private string? VersionValue { get; set; } - - public ElisionTokenFilterDescriptor Articles(ICollection? articles) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElisionTokenFilterDescriptor() { - ArticlesValue = articles; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ElisionTokenFilterDescriptor ArticlesCase(bool? articlesCase = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor Articles(System.Collections.Generic.ICollection? value) { - ArticlesCaseValue = articlesCase; - return Self; + Instance.Articles = value; + return this; } - public ElisionTokenFilterDescriptor ArticlesPath(string? articlesPath) + public Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor Articles(params string[] values) { - ArticlesPathValue = articlesPath; - return Self; + Instance.Articles = [.. values]; + return this; } - public ElisionTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor ArticlesCase(bool? value = true) { - VersionValue = version; - return Self; + Instance.ArticlesCase = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor ArticlesPath(string? value) { - writer.WriteStartObject(); - if (ArticlesValue is not null) - { - writer.WritePropertyName("articles"); - JsonSerializer.Serialize(writer, ArticlesValue, options); - } - - if (ArticlesCaseValue.HasValue) - { - writer.WritePropertyName("articles_case"); - writer.WriteBooleanValue(ArticlesCaseValue.Value); - } + Instance.ArticlesPath = value; + return this; + } - if (!string.IsNullOrEmpty(ArticlesPathValue)) - { - writer.WritePropertyName("articles_path"); - writer.WriteStringValue(ArticlesPathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("elision"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ElisionTokenFilter IBuildableDescriptor.Build() => new() - { - Articles = ArticlesValue, - ArticlesCase = ArticlesCaseValue, - ArticlesPath = ArticlesPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EnglishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EnglishAnalyzer.g.cs index bf63091004e..747c47462d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EnglishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EnglishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class EnglishAnalyzer : IAnalyzer +internal sealed partial class EnglishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerConverter))] +public sealed partial class EnglishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public EnglishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public EnglishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnglishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "english"; } -public sealed partial class EnglishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct EnglishAnalyzerDescriptor { - internal EnglishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnglishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer instance) + { + Instance = instance; + } - public EnglishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnglishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor descriptor) => descriptor.Instance; - public EnglishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public EnglishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public EnglishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("english"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.EnglishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - EnglishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EstonianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EstonianAnalyzer.g.cs index a1e4374a3f5..d60d66e6f7a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EstonianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/EstonianAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class EstonianAnalyzer : IAnalyzer +internal sealed partial class EstonianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerConverter))] +public sealed partial class EstonianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public EstonianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public EstonianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EstonianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "estonian"; } -public sealed partial class EstonianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct EstonianAnalyzerDescriptor { - internal EstonianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer Instance { get; init; } - public EstonianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EstonianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EstonianAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public EstonianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public EstonianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("estonian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.EstonianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - EstonianAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintAnalyzer.g.cs index f91086db2f4..baaf1d4d66b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintAnalyzer.g.cs @@ -17,127 +17,251 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class FingerprintAnalyzer : IAnalyzer +internal sealed partial class FingerprintAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxOutputSize = System.Text.Json.JsonEncodedText.Encode("max_output_size"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxOutputSize = default; + LocalJsonValue propSeparator = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxOutputSize.TryReadProperty(ref reader, options, PropMaxOutputSize, null)) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxOutputSize = propMaxOutputSize.Value, + Separator = propSeparator.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value, +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxOutputSize, value.MaxOutputSize, null, null); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerConverter))] +public sealed partial class FingerprintAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("max_output_size")] - public int MaxOutputSize { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] - public bool PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("separator")] - public string Separator { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public FingerprintAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public FingerprintAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The maximum token size to emit. Tokens larger than this size will be discarded. + /// Defaults to 255 + /// + /// + public int? MaxOutputSize { get; set; } + + /// + /// + /// The character to use to concatenate the terms. + /// Defaults to a space. + /// + /// + public string? Separator { get; set; } + + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public System.Collections.Generic.ICollection? Stopwords { get; set; } + + /// + /// + /// The path to a file containing stop words. + /// + /// public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "fingerprint"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class FingerprintAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FingerprintAnalyzerDescriptor { - internal FingerprintAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer Instance { get; init; } - public FingerprintAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer instance) { + Instance = instance; } - private int MaxOutputSizeValue { get; set; } - private bool PreserveOriginalValue { get; set; } - private string SeparatorValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } - private string? VersionValue { get; set; } - - public FingerprintAnalyzerDescriptor MaxOutputSize(int maxOutputSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintAnalyzerDescriptor() { - MaxOutputSizeValue = maxOutputSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FingerprintAnalyzerDescriptor PreserveOriginal(bool preserveOriginal = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The maximum token size to emit. Tokens larger than this size will be discarded. + /// Defaults to 255 + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor MaxOutputSize(int? value) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.MaxOutputSize = value; + return this; } - public FingerprintAnalyzerDescriptor Separator(string separator) + /// + /// + /// The character to use to concatenate the terms. + /// Defaults to a space. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor Separator(string? value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } - public FingerprintAnalyzerDescriptor Stopwords(ICollection? stopwords) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public FingerprintAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - public FingerprintAnalyzerDescriptor Version(string? version) + /// + /// + /// The path to a file containing stop words. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor StopwordsPath(string? value) { - VersionValue = version; - return Self; + Instance.StopwordsPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("max_output_size"); - writer.WriteNumberValue(MaxOutputSizeValue); - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue); - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } - - if (!string.IsNullOrEmpty(StopwordsPathValue)) - { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("fingerprint"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.FingerprintAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FingerprintAnalyzer IBuildableDescriptor.Build() => new() - { - MaxOutputSize = MaxOutputSizeValue, - PreserveOriginal = PreserveOriginalValue, - Separator = SeparatorValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs index 15b0a8f5f96..e205e5d8804 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FingerprintTokenFilter.g.cs @@ -17,90 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class FingerprintTokenFilter : ITokenFilter +internal sealed partial class FingerprintTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("max_output_size")] + private static readonly System.Text.Json.JsonEncodedText PropMaxOutputSize = System.Text.Json.JsonEncodedText.Encode("max_output_size"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxOutputSize = default; + LocalJsonValue propSeparator = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxOutputSize.TryReadProperty(ref reader, options, PropMaxOutputSize, null)) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxOutputSize = propMaxOutputSize.Value, + Separator = propSeparator.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxOutputSize, value.MaxOutputSize, null, null); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterConverter))] +public sealed partial class FingerprintTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public FingerprintTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public FingerprintTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxOutputSize { get; set; } - [JsonInclude, JsonPropertyName("separator")] public string? Separator { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "fingerprint"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class FingerprintTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FingerprintTokenFilterDescriptor { - internal FingerprintTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter Instance { get; init; } - public FingerprintTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter instance) { + Instance = instance; } - private int? MaxOutputSizeValue { get; set; } - private string? SeparatorValue { get; set; } - private string? VersionValue { get; set; } - - public FingerprintTokenFilterDescriptor MaxOutputSize(int? maxOutputSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintTokenFilterDescriptor() { - MaxOutputSizeValue = maxOutputSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FingerprintTokenFilterDescriptor Separator(string? separator) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor MaxOutputSize(int? value) { - SeparatorValue = separator; - return Self; + Instance.MaxOutputSize = value; + return this; } - public FingerprintTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor Separator(string? value) { - VersionValue = version; - return Self; + Instance.Separator = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxOutputSizeValue.HasValue) - { - writer.WritePropertyName("max_output_size"); - writer.WriteNumberValue(MaxOutputSizeValue.Value); - } - - if (!string.IsNullOrEmpty(SeparatorValue)) - { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("fingerprint"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FingerprintTokenFilter IBuildableDescriptor.Build() => new() - { - MaxOutputSize = MaxOutputSizeValue, - Separator = SeparatorValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FinnishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FinnishAnalyzer.g.cs index 26daf3595db..6ac71741bbc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FinnishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FinnishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class FinnishAnalyzer : IAnalyzer +internal sealed partial class FinnishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerConverter))] +public sealed partial class FinnishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public FinnishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public FinnishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FinnishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "finnish"; } -public sealed partial class FinnishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FinnishAnalyzerDescriptor { - internal FinnishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FinnishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer instance) + { + Instance = instance; + } - public FinnishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FinnishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor descriptor) => descriptor.Instance; - public FinnishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public FinnishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public FinnishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("finnish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.FinnishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FinnishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FrenchAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FrenchAnalyzer.g.cs index 71a3152f6f5..9bd942805cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FrenchAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/FrenchAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class FrenchAnalyzer : IAnalyzer +internal sealed partial class FrenchAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerConverter))] +public sealed partial class FrenchAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public FrenchAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public FrenchAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrenchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "french"; } -public sealed partial class FrenchAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FrenchAnalyzerDescriptor { - internal FrenchAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrenchAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer instance) + { + Instance = instance; + } - public FrenchAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrenchAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer(Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor descriptor) => descriptor.Instance; - public FrenchAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public FrenchAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public FrenchAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("french"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.FrenchAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FrenchAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GalicianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GalicianAnalyzer.g.cs index f1ddff66f9b..9f8ab1904d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GalicianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GalicianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class GalicianAnalyzer : IAnalyzer +internal sealed partial class GalicianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerConverter))] +public sealed partial class GalicianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public GalicianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public GalicianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GalicianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "galician"; } -public sealed partial class GalicianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct GalicianAnalyzerDescriptor { - internal GalicianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GalicianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer instance) + { + Instance = instance; + } - public GalicianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GalicianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor descriptor) => descriptor.Instance; - public GalicianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public GalicianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public GalicianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("galician"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.GalicianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - GalicianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GermanAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GermanAnalyzer.g.cs index bd0b04a470f..1c753fb9036 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GermanAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GermanAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class GermanAnalyzer : IAnalyzer +internal sealed partial class GermanAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerConverter))] +public sealed partial class GermanAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public GermanAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public GermanAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GermanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "german"; } -public sealed partial class GermanAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct GermanAnalyzerDescriptor { - internal GermanAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GermanAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer instance) + { + Instance = instance; + } - public GermanAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GermanAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer(Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor descriptor) => descriptor.Instance; - public GermanAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public GermanAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public GermanAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("german"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.GermanAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - GermanAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GreekAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GreekAnalyzer.g.cs index 89b4442eddd..ffa883163ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GreekAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/GreekAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class GreekAnalyzer : IAnalyzer +internal sealed partial class GreekAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerConverter))] +public sealed partial class GreekAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public GreekAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public GreekAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GreekAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "greek"; } -public sealed partial class GreekAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct GreekAnalyzerDescriptor { - internal GreekAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer Instance { get; init; } - public GreekAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GreekAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GreekAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GreekAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer(Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public GreekAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("greek"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.GreekAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - GreekAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HindiAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HindiAnalyzer.g.cs index c3142b0a785..f917dc97c42 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HindiAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HindiAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class HindiAnalyzer : IAnalyzer +internal sealed partial class HindiAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerConverter))] +public sealed partial class HindiAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public HindiAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public HindiAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HindiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "hindi"; } -public sealed partial class HindiAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HindiAnalyzerDescriptor { - internal HindiAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HindiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer instance) + { + Instance = instance; + } - public HindiAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HindiAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor descriptor) => descriptor.Instance; - public HindiAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public HindiAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public HindiAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("hindi"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.HindiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HindiAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HtmlStripCharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HtmlStripCharFilter.g.cs index 2b8bafd5a23..13d78139f75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HtmlStripCharFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HtmlStripCharFilter.g.cs @@ -17,74 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class HtmlStripCharFilter : ICharFilter +internal sealed partial class HtmlStripCharFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("escaped_tags")] - public ICollection? EscapedTags { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropEscapedTags = System.Text.Json.JsonEncodedText.Encode("escaped_tags"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propEscapedTags = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEscapedTags.TryReadProperty(ref reader, options, PropEscapedTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EscapedTags = propEscapedTags.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEscapedTags, value.EscapedTags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterConverter))] +public sealed partial class HtmlStripCharFilter : Elastic.Clients.Elasticsearch.Analysis.ICharFilter +{ +#if NET7_0_OR_GREATER + public HtmlStripCharFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public HtmlStripCharFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? EscapedTags { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "html_strip"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class HtmlStripCharFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HtmlStripCharFilterDescriptor { - internal HtmlStripCharFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter Instance { get; init; } - public HtmlStripCharFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter instance) { + Instance = instance; } - private ICollection? EscapedTagsValue { get; set; } - private string? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripCharFilterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public HtmlStripCharFilterDescriptor EscapedTags(ICollection? escapedTags) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor EscapedTags(System.Collections.Generic.ICollection? value) { - EscapedTagsValue = escapedTags; - return Self; + Instance.EscapedTags = value; + return this; } - public HtmlStripCharFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor EscapedTags(params string[] values) { - VersionValue = version; - return Self; + Instance.EscapedTags = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (EscapedTagsValue is not null) - { - writer.WritePropertyName("escaped_tags"); - JsonSerializer.Serialize(writer, EscapedTagsValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("html_strip"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.HtmlStripCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HtmlStripCharFilter IBuildableDescriptor.Build() => new() - { - EscapedTags = EscapedTagsValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HungarianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HungarianAnalyzer.g.cs index 1df50363051..1d30fd2766a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HungarianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HungarianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class HungarianAnalyzer : IAnalyzer +internal sealed partial class HungarianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerConverter))] +public sealed partial class HungarianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public HungarianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public HungarianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HungarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "hungarian"; } -public sealed partial class HungarianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HungarianAnalyzerDescriptor { - internal HungarianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HungarianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer instance) + { + Instance = instance; + } - public HungarianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HungarianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor descriptor) => descriptor.Instance; - public HungarianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public HungarianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public HungarianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("hungarian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.HungarianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HungarianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs index 5e65fa055e8..963a48f8da7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HunspellTokenFilter.g.cs @@ -17,118 +17,188 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class HunspellTokenFilter : ITokenFilter +internal sealed partial class HunspellTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dedup")] + private static readonly System.Text.Json.JsonEncodedText PropDedup = System.Text.Json.JsonEncodedText.Encode("dedup"); + private static readonly System.Text.Json.JsonEncodedText PropDictionary = System.Text.Json.JsonEncodedText.Encode("dictionary"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropLongestOnly = System.Text.Json.JsonEncodedText.Encode("longest_only"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDedup = default; + LocalJsonValue propDictionary = default; + LocalJsonValue propLocale = default; + LocalJsonValue propLongestOnly = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDedup.TryReadProperty(ref reader, options, PropDedup, null)) + { + continue; + } + + if (propDictionary.TryReadProperty(ref reader, options, PropDictionary, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propLongestOnly.TryReadProperty(ref reader, options, PropLongestOnly, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dedup = propDedup.Value, + Dictionary = propDictionary.Value, + Locale = propLocale.Value, + LongestOnly = propLongestOnly.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDedup, value.Dedup, null, null); + writer.WriteProperty(options, PropDictionary, value.Dictionary, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropLongestOnly, value.LongestOnly, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterConverter))] +public sealed partial class HunspellTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HunspellTokenFilter(string locale) + { + Locale = locale; + } +#if NET7_0_OR_GREATER + public HunspellTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HunspellTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HunspellTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Dedup { get; set; } - [JsonInclude, JsonPropertyName("dictionary")] public string? Dictionary { get; set; } - [JsonInclude, JsonPropertyName("locale")] - public string Locale { get; set; } - [JsonInclude, JsonPropertyName("longest_only")] + public +#if NET7_0_OR_GREATER + required +#endif + string Locale { get; set; } public bool? LongestOnly { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "hunspell"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class HunspellTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HunspellTokenFilterDescriptor { - internal HunspellTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter Instance { get; init; } - public HunspellTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HunspellTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter instance) { + Instance = instance; } - private bool? DedupValue { get; set; } - private string? DictionaryValue { get; set; } - private string LocaleValue { get; set; } - private bool? LongestOnlyValue { get; set; } - private string? VersionValue { get; set; } - - public HunspellTokenFilterDescriptor Dedup(bool? dedup = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HunspellTokenFilterDescriptor() { - DedupValue = dedup; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public HunspellTokenFilterDescriptor Dictionary(string? dictionary) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor Dedup(bool? value = true) { - DictionaryValue = dictionary; - return Self; + Instance.Dedup = value; + return this; } - public HunspellTokenFilterDescriptor Locale(string locale) + public Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor Dictionary(string? value) { - LocaleValue = locale; - return Self; + Instance.Dictionary = value; + return this; } - public HunspellTokenFilterDescriptor LongestOnly(bool? longestOnly = true) + public Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor Locale(string value) { - LongestOnlyValue = longestOnly; - return Self; + Instance.Locale = value; + return this; } - public HunspellTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor LongestOnly(bool? value = true) { - VersionValue = version; - return Self; + Instance.LongestOnly = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (DedupValue.HasValue) - { - writer.WritePropertyName("dedup"); - writer.WriteBooleanValue(DedupValue.Value); - } - - if (!string.IsNullOrEmpty(DictionaryValue)) - { - writer.WritePropertyName("dictionary"); - writer.WriteStringValue(DictionaryValue); - } - - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - if (LongestOnlyValue.HasValue) - { - writer.WritePropertyName("longest_only"); - writer.WriteBooleanValue(LongestOnlyValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("hunspell"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - HunspellTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter Build(System.Action action) { - Dedup = DedupValue, - Dictionary = DictionaryValue, - Locale = LocaleValue, - LongestOnly = LongestOnlyValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HyphenationDecompounderTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HyphenationDecompounderTokenFilter.g.cs index 1c225a17a4d..5f94c93716f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HyphenationDecompounderTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/HyphenationDecompounderTokenFilter.g.cs @@ -17,170 +17,237 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class HyphenationDecompounderTokenFilter : ITokenFilter +internal sealed partial class HyphenationDecompounderTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHyphenationPatternsPath = System.Text.Json.JsonEncodedText.Encode("hyphenation_patterns_path"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSubwordSize = System.Text.Json.JsonEncodedText.Encode("max_subword_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinSubwordSize = System.Text.Json.JsonEncodedText.Encode("min_subword_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordSize = System.Text.Json.JsonEncodedText.Encode("min_word_size"); + private static readonly System.Text.Json.JsonEncodedText PropOnlyLongestMatch = System.Text.Json.JsonEncodedText.Encode("only_longest_match"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropWordList = System.Text.Json.JsonEncodedText.Encode("word_list"); + private static readonly System.Text.Json.JsonEncodedText PropWordListPath = System.Text.Json.JsonEncodedText.Encode("word_list_path"); + + public override Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHyphenationPatternsPath = default; + LocalJsonValue propMaxSubwordSize = default; + LocalJsonValue propMinSubwordSize = default; + LocalJsonValue propMinWordSize = default; + LocalJsonValue propOnlyLongestMatch = default; + LocalJsonValue propVersion = default; + LocalJsonValue?> propWordList = default; + LocalJsonValue propWordListPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHyphenationPatternsPath.TryReadProperty(ref reader, options, PropHyphenationPatternsPath, null)) + { + continue; + } + + if (propMaxSubwordSize.TryReadProperty(ref reader, options, PropMaxSubwordSize, null)) + { + continue; + } + + if (propMinSubwordSize.TryReadProperty(ref reader, options, PropMinSubwordSize, null)) + { + continue; + } + + if (propMinWordSize.TryReadProperty(ref reader, options, PropMinWordSize, null)) + { + continue; + } + + if (propOnlyLongestMatch.TryReadProperty(ref reader, options, PropOnlyLongestMatch, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propWordList.TryReadProperty(ref reader, options, PropWordList, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propWordListPath.TryReadProperty(ref reader, options, PropWordListPath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HyphenationPatternsPath = propHyphenationPatternsPath.Value, + MaxSubwordSize = propMaxSubwordSize.Value, + MinSubwordSize = propMinSubwordSize.Value, + MinWordSize = propMinWordSize.Value, + OnlyLongestMatch = propOnlyLongestMatch.Value, + Version = propVersion.Value, + WordList = propWordList.Value, + WordListPath = propWordListPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHyphenationPatternsPath, value.HyphenationPatternsPath, null, null); + writer.WriteProperty(options, PropMaxSubwordSize, value.MaxSubwordSize, null, null); + writer.WriteProperty(options, PropMinSubwordSize, value.MinSubwordSize, null, null); + writer.WriteProperty(options, PropMinWordSize, value.MinWordSize, null, null); + writer.WriteProperty(options, PropOnlyLongestMatch, value.OnlyLongestMatch, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropWordList, value.WordList, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropWordListPath, value.WordListPath, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterConverter))] +public sealed partial class HyphenationDecompounderTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("hyphenation_patterns_path")] +#if NET7_0_OR_GREATER + public HyphenationDecompounderTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public HyphenationDecompounderTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? HyphenationPatternsPath { get; set; } - [JsonInclude, JsonPropertyName("max_subword_size")] public int? MaxSubwordSize { get; set; } - [JsonInclude, JsonPropertyName("min_subword_size")] public int? MinSubwordSize { get; set; } - [JsonInclude, JsonPropertyName("min_word_size")] public int? MinWordSize { get; set; } - [JsonInclude, JsonPropertyName("only_longest_match")] public bool? OnlyLongestMatch { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "hyphenation_decompounder"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } - [JsonInclude, JsonPropertyName("word_list")] - public ICollection? WordList { get; set; } - [JsonInclude, JsonPropertyName("word_list_path")] + public System.Collections.Generic.ICollection? WordList { get; set; } public string? WordListPath { get; set; } } -public sealed partial class HyphenationDecompounderTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HyphenationDecompounderTokenFilterDescriptor { - internal HyphenationDecompounderTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter Instance { get; init; } - public HyphenationDecompounderTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HyphenationDecompounderTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter instance) { + Instance = instance; } - private string? HyphenationPatternsPathValue { get; set; } - private int? MaxSubwordSizeValue { get; set; } - private int? MinSubwordSizeValue { get; set; } - private int? MinWordSizeValue { get; set; } - private bool? OnlyLongestMatchValue { get; set; } - private string? VersionValue { get; set; } - private ICollection? WordListValue { get; set; } - private string? WordListPathValue { get; set; } - - public HyphenationDecompounderTokenFilterDescriptor HyphenationPatternsPath(string? hyphenationPatternsPath) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HyphenationDecompounderTokenFilterDescriptor() { - HyphenationPatternsPathValue = hyphenationPatternsPath; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public HyphenationDecompounderTokenFilterDescriptor MaxSubwordSize(int? maxSubwordSize) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor HyphenationPatternsPath(string? value) { - MaxSubwordSizeValue = maxSubwordSize; - return Self; + Instance.HyphenationPatternsPath = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor MinSubwordSize(int? minSubwordSize) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor MaxSubwordSize(int? value) { - MinSubwordSizeValue = minSubwordSize; - return Self; + Instance.MaxSubwordSize = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor MinWordSize(int? minWordSize) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor MinSubwordSize(int? value) { - MinWordSizeValue = minWordSize; - return Self; + Instance.MinSubwordSize = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor OnlyLongestMatch(bool? onlyLongestMatch = true) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor MinWordSize(int? value) { - OnlyLongestMatchValue = onlyLongestMatch; - return Self; + Instance.MinWordSize = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor OnlyLongestMatch(bool? value = true) { - VersionValue = version; - return Self; + Instance.OnlyLongestMatch = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor WordList(ICollection? wordList) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor Version(string? value) { - WordListValue = wordList; - return Self; + Instance.Version = value; + return this; } - public HyphenationDecompounderTokenFilterDescriptor WordListPath(string? wordListPath) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor WordList(System.Collections.Generic.ICollection? value) { - WordListPathValue = wordListPath; - return Self; + Instance.WordList = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor WordList(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(HyphenationPatternsPathValue)) - { - writer.WritePropertyName("hyphenation_patterns_path"); - writer.WriteStringValue(HyphenationPatternsPathValue); - } - - if (MaxSubwordSizeValue.HasValue) - { - writer.WritePropertyName("max_subword_size"); - writer.WriteNumberValue(MaxSubwordSizeValue.Value); - } - - if (MinSubwordSizeValue.HasValue) - { - writer.WritePropertyName("min_subword_size"); - writer.WriteNumberValue(MinSubwordSizeValue.Value); - } - - if (MinWordSizeValue.HasValue) - { - writer.WritePropertyName("min_word_size"); - writer.WriteNumberValue(MinWordSizeValue.Value); - } - - if (OnlyLongestMatchValue.HasValue) - { - writer.WritePropertyName("only_longest_match"); - writer.WriteBooleanValue(OnlyLongestMatchValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("hyphenation_decompounder"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.WordList = [.. values]; + return this; + } - if (WordListValue is not null) - { - writer.WritePropertyName("word_list"); - JsonSerializer.Serialize(writer, WordListValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor WordListPath(string? value) + { + Instance.WordListPath = value; + return this; + } - if (!string.IsNullOrEmpty(WordListPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("word_list_path"); - writer.WriteStringValue(WordListPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HyphenationDecompounderTokenFilter IBuildableDescriptor.Build() => new() - { - HyphenationPatternsPath = HyphenationPatternsPathValue, - MaxSubwordSize = MaxSubwordSizeValue, - MinSubwordSize = MinSubwordSizeValue, - MinWordSize = MinWordSizeValue, - OnlyLongestMatch = OnlyLongestMatchValue, - Version = VersionValue, - WordList = WordListValue, - WordListPath = WordListPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuAnalyzer.g.cs index 067eae10a7b..8dc4ab5afbc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuAnalyzer.g.cs @@ -17,65 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuAnalyzer : IAnalyzer +internal sealed partial class IcuAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMethod = System.Text.Json.JsonEncodedText.Encode("method"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMethod = default; + LocalJsonValue propMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMethod.TryReadProperty(ref reader, options, PropMethod, null)) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Method = propMethod.Value, + Mode = propMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMethod, value.Method, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerConverter))] +public sealed partial class IcuAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("method")] - public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType Method { get; set; } - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode Mode { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuAnalyzer(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType method, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode mode) + { + Method = method; + Mode = mode; + } +#if NET7_0_OR_GREATER + public IcuAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IcuAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType Method { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode Mode { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_analyzer"; } -public sealed partial class IcuAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuAnalyzerDescriptor { - internal IcuAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer Instance { get; init; } - public IcuAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType MethodValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode ModeValue { get; set; } - - public IcuAnalyzerDescriptor Method(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType method) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuAnalyzerDescriptor() { - MethodValue = method; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode mode) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer(Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor Method(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType value) { - ModeValue = mode; - return Self; + Instance.Method = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode value) { - writer.WriteStartObject(); - writer.WritePropertyName("method"); - JsonSerializer.Serialize(writer, MethodValue, options); - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_analyzer"); - writer.WriteEndObject(); + Instance.Mode = value; + return this; } - IcuAnalyzer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer Build(System.Action action) { - Method = MethodValue, - Mode = ModeValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuCollationTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuCollationTokenFilter.g.cs index c6e23129368..41b7f039ca1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuCollationTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuCollationTokenFilter.g.cs @@ -17,250 +17,311 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuCollationTokenFilter : ITokenFilter +internal sealed partial class IcuCollationTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("alternate")] + private static readonly System.Text.Json.JsonEncodedText PropAlternate = System.Text.Json.JsonEncodedText.Encode("alternate"); + private static readonly System.Text.Json.JsonEncodedText PropCaseFirst = System.Text.Json.JsonEncodedText.Encode("case_first"); + private static readonly System.Text.Json.JsonEncodedText PropCaseLevel = System.Text.Json.JsonEncodedText.Encode("case_level"); + private static readonly System.Text.Json.JsonEncodedText PropCountry = System.Text.Json.JsonEncodedText.Encode("country"); + private static readonly System.Text.Json.JsonEncodedText PropDecomposition = System.Text.Json.JsonEncodedText.Encode("decomposition"); + private static readonly System.Text.Json.JsonEncodedText PropHiraganaQuaternaryMode = System.Text.Json.JsonEncodedText.Encode("hiragana_quaternary_mode"); + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropNumeric = System.Text.Json.JsonEncodedText.Encode("numeric"); + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + private static readonly System.Text.Json.JsonEncodedText PropStrength = System.Text.Json.JsonEncodedText.Encode("strength"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVariableTop = System.Text.Json.JsonEncodedText.Encode("variable_top"); + private static readonly System.Text.Json.JsonEncodedText PropVariant = System.Text.Json.JsonEncodedText.Encode("variant"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlternate = default; + LocalJsonValue propCaseFirst = default; + LocalJsonValue propCaseLevel = default; + LocalJsonValue propCountry = default; + LocalJsonValue propDecomposition = default; + LocalJsonValue propHiraganaQuaternaryMode = default; + LocalJsonValue propLanguage = default; + LocalJsonValue propNumeric = default; + LocalJsonValue propRules = default; + LocalJsonValue propStrength = default; + LocalJsonValue propVariableTop = default; + LocalJsonValue propVariant = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlternate.TryReadProperty(ref reader, options, PropAlternate, null)) + { + continue; + } + + if (propCaseFirst.TryReadProperty(ref reader, options, PropCaseFirst, null)) + { + continue; + } + + if (propCaseLevel.TryReadProperty(ref reader, options, PropCaseLevel, null)) + { + continue; + } + + if (propCountry.TryReadProperty(ref reader, options, PropCountry, null)) + { + continue; + } + + if (propDecomposition.TryReadProperty(ref reader, options, PropDecomposition, null)) + { + continue; + } + + if (propHiraganaQuaternaryMode.TryReadProperty(ref reader, options, PropHiraganaQuaternaryMode, null)) + { + continue; + } + + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (propNumeric.TryReadProperty(ref reader, options, PropNumeric, null)) + { + continue; + } + + if (propRules.TryReadProperty(ref reader, options, PropRules, null)) + { + continue; + } + + if (propStrength.TryReadProperty(ref reader, options, PropStrength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVariableTop.TryReadProperty(ref reader, options, PropVariableTop, null)) + { + continue; + } + + if (propVariant.TryReadProperty(ref reader, options, PropVariant, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alternate = propAlternate.Value, + CaseFirst = propCaseFirst.Value, + CaseLevel = propCaseLevel.Value, + Country = propCountry.Value, + Decomposition = propDecomposition.Value, + HiraganaQuaternaryMode = propHiraganaQuaternaryMode.Value, + Language = propLanguage.Value, + Numeric = propNumeric.Value, + Rules = propRules.Value, + Strength = propStrength.Value, + VariableTop = propVariableTop.Value, + Variant = propVariant.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlternate, value.Alternate, null, null); + writer.WriteProperty(options, PropCaseFirst, value.CaseFirst, null, null); + writer.WriteProperty(options, PropCaseLevel, value.CaseLevel, null, null); + writer.WriteProperty(options, PropCountry, value.Country, null, null); + writer.WriteProperty(options, PropDecomposition, value.Decomposition, null, null); + writer.WriteProperty(options, PropHiraganaQuaternaryMode, value.HiraganaQuaternaryMode, null, null); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropNumeric, value.Numeric, null, null); + writer.WriteProperty(options, PropRules, value.Rules, null, null); + writer.WriteProperty(options, PropStrength, value.Strength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVariableTop, value.VariableTop, null, null); + writer.WriteProperty(options, PropVariant, value.Variant, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterConverter))] +public sealed partial class IcuCollationTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public IcuCollationTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public IcuCollationTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? Alternate { get; set; } - [JsonInclude, JsonPropertyName("case_first")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirst { get; set; } - [JsonInclude, JsonPropertyName("case_level")] public bool? CaseLevel { get; set; } - [JsonInclude, JsonPropertyName("country")] public string? Country { get; set; } - [JsonInclude, JsonPropertyName("decomposition")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? Decomposition { get; set; } - [JsonInclude, JsonPropertyName("hiragana_quaternary_mode")] public bool? HiraganaQuaternaryMode { get; set; } - [JsonInclude, JsonPropertyName("language")] public string? Language { get; set; } - [JsonInclude, JsonPropertyName("numeric")] public bool? Numeric { get; set; } - [JsonInclude, JsonPropertyName("rules")] public string? Rules { get; set; } - [JsonInclude, JsonPropertyName("strength")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? Strength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_collation"; - [JsonInclude, JsonPropertyName("variable_top")] public string? VariableTop { get; set; } - [JsonInclude, JsonPropertyName("variant")] public string? Variant { get; set; } - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class IcuCollationTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuCollationTokenFilterDescriptor { - internal IcuCollationTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter Instance { get; init; } - public IcuCollationTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? AlternateValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirstValue { get; set; } - private bool? CaseLevelValue { get; set; } - private string? CountryValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? DecompositionValue { get; set; } - private bool? HiraganaQuaternaryModeValue { get; set; } - private string? LanguageValue { get; set; } - private bool? NumericValue { get; set; } - private string? RulesValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? StrengthValue { get; set; } - private string? VariableTopValue { get; set; } - private string? VariantValue { get; set; } - private string? VersionValue { get; set; } - - public IcuCollationTokenFilterDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? alternate) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationTokenFilterDescriptor() { - AlternateValue = alternate; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuCollationTokenFilterDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? caseFirst) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? value) { - CaseFirstValue = caseFirst; - return Self; + Instance.Alternate = value; + return this; } - public IcuCollationTokenFilterDescriptor CaseLevel(bool? caseLevel = true) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? value) { - CaseLevelValue = caseLevel; - return Self; + Instance.CaseFirst = value; + return this; } - public IcuCollationTokenFilterDescriptor Country(string? country) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor CaseLevel(bool? value = true) { - CountryValue = country; - return Self; + Instance.CaseLevel = value; + return this; } - public IcuCollationTokenFilterDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? decomposition) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Country(string? value) { - DecompositionValue = decomposition; - return Self; + Instance.Country = value; + return this; } - public IcuCollationTokenFilterDescriptor HiraganaQuaternaryMode(bool? hiraganaQuaternaryMode = true) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? value) { - HiraganaQuaternaryModeValue = hiraganaQuaternaryMode; - return Self; + Instance.Decomposition = value; + return this; } - public IcuCollationTokenFilterDescriptor Language(string? language) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor HiraganaQuaternaryMode(bool? value = true) { - LanguageValue = language; - return Self; + Instance.HiraganaQuaternaryMode = value; + return this; } - public IcuCollationTokenFilterDescriptor Numeric(bool? numeric = true) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Language(string? value) { - NumericValue = numeric; - return Self; + Instance.Language = value; + return this; } - public IcuCollationTokenFilterDescriptor Rules(string? rules) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Numeric(bool? value = true) { - RulesValue = rules; - return Self; + Instance.Numeric = value; + return this; } - public IcuCollationTokenFilterDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? strength) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Rules(string? value) { - StrengthValue = strength; - return Self; + Instance.Rules = value; + return this; } - public IcuCollationTokenFilterDescriptor VariableTop(string? variableTop) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? value) { - VariableTopValue = variableTop; - return Self; + Instance.Strength = value; + return this; } - public IcuCollationTokenFilterDescriptor Variant(string? variant) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor VariableTop(string? value) { - VariantValue = variant; - return Self; + Instance.VariableTop = value; + return this; } - public IcuCollationTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Variant(string? value) { - VersionValue = version; - return Self; + Instance.Variant = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (AlternateValue is not null) - { - writer.WritePropertyName("alternate"); - JsonSerializer.Serialize(writer, AlternateValue, options); - } - - if (CaseFirstValue is not null) - { - writer.WritePropertyName("case_first"); - JsonSerializer.Serialize(writer, CaseFirstValue, options); - } - - if (CaseLevelValue.HasValue) - { - writer.WritePropertyName("case_level"); - writer.WriteBooleanValue(CaseLevelValue.Value); - } - - if (!string.IsNullOrEmpty(CountryValue)) - { - writer.WritePropertyName("country"); - writer.WriteStringValue(CountryValue); - } - - if (DecompositionValue is not null) - { - writer.WritePropertyName("decomposition"); - JsonSerializer.Serialize(writer, DecompositionValue, options); - } - - if (HiraganaQuaternaryModeValue.HasValue) - { - writer.WritePropertyName("hiragana_quaternary_mode"); - writer.WriteBooleanValue(HiraganaQuaternaryModeValue.Value); - } - - if (!string.IsNullOrEmpty(LanguageValue)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(LanguageValue); - } - - if (NumericValue.HasValue) - { - writer.WritePropertyName("numeric"); - writer.WriteBooleanValue(NumericValue.Value); - } - - if (!string.IsNullOrEmpty(RulesValue)) - { - writer.WritePropertyName("rules"); - writer.WriteStringValue(RulesValue); - } - - if (StrengthValue is not null) - { - writer.WritePropertyName("strength"); - JsonSerializer.Serialize(writer, StrengthValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_collation"); - if (!string.IsNullOrEmpty(VariableTopValue)) - { - writer.WritePropertyName("variable_top"); - writer.WriteStringValue(VariableTopValue); - } - - if (!string.IsNullOrEmpty(VariantValue)) - { - writer.WritePropertyName("variant"); - writer.WriteStringValue(VariantValue); - } + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IcuCollationTokenFilter IBuildableDescriptor.Build() => new() - { - Alternate = AlternateValue, - CaseFirst = CaseFirstValue, - CaseLevel = CaseLevelValue, - Country = CountryValue, - Decomposition = DecompositionValue, - HiraganaQuaternaryMode = HiraganaQuaternaryModeValue, - Language = LanguageValue, - Numeric = NumericValue, - Rules = RulesValue, - Strength = StrengthValue, - VariableTop = VariableTopValue, - Variant = VariantValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuFoldingTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuFoldingTokenFilter.g.cs index 1d561c06279..331241ae28f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuFoldingTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuFoldingTokenFilter.g.cs @@ -17,69 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuFoldingTokenFilter : ITokenFilter +internal sealed partial class IcuFoldingTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUnicodeSetFilter = System.Text.Json.JsonEncodedText.Encode("unicode_set_filter"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUnicodeSetFilter = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUnicodeSetFilter.TryReadProperty(ref reader, options, PropUnicodeSetFilter, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + UnicodeSetFilter = propUnicodeSetFilter.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUnicodeSetFilter, value.UnicodeSetFilter, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterConverter))] +public sealed partial class IcuFoldingTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuFoldingTokenFilter(string unicodeSetFilter) + { + UnicodeSetFilter = unicodeSetFilter; + } +#if NET7_0_OR_GREATER + public IcuFoldingTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IcuFoldingTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "icu_folding"; - [JsonInclude, JsonPropertyName("unicode_set_filter")] - public string UnicodeSetFilter { get; set; } - [JsonInclude, JsonPropertyName("version")] + public +#if NET7_0_OR_GREATER + required +#endif + string UnicodeSetFilter { get; set; } public string? Version { get; set; } } -public sealed partial class IcuFoldingTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuFoldingTokenFilterDescriptor { - internal IcuFoldingTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter Instance { get; init; } - public IcuFoldingTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuFoldingTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter instance) { + Instance = instance; } - private string UnicodeSetFilterValue { get; set; } - private string? VersionValue { get; set; } - - public IcuFoldingTokenFilterDescriptor UnicodeSetFilter(string unicodeSetFilter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuFoldingTokenFilterDescriptor() { - UnicodeSetFilterValue = unicodeSetFilter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuFoldingTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor UnicodeSetFilter(string value) { - VersionValue = version; - return Self; + Instance.UnicodeSetFilter = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_folding"); - writer.WritePropertyName("unicode_set_filter"); - writer.WriteStringValue(UnicodeSetFilterValue); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - IcuFoldingTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter Build(System.Action action) { - UnicodeSetFilter = UnicodeSetFilterValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationCharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationCharFilter.g.cs index c1e72a28c51..aac66211509 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationCharFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationCharFilter.g.cs @@ -17,90 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuNormalizationCharFilter : ICharFilter +internal sealed partial class IcuNormalizationCharFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("mode")] + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue propName = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + Name = propName.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterConverter))] +public sealed partial class IcuNormalizationCharFilter : Elastic.Clients.Elasticsearch.Analysis.ICharFilter +{ +#if NET7_0_OR_GREATER + public IcuNormalizationCharFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public IcuNormalizationCharFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode? Mode { get; set; } - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType? Name { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_normalizer"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class IcuNormalizationCharFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuNormalizationCharFilterDescriptor { - internal IcuNormalizationCharFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter Instance { get; init; } - public IcuNormalizationCharFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuNormalizationCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType? NameValue { get; set; } - private string? VersionValue { get; set; } - - public IcuNormalizationCharFilterDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode? mode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuNormalizationCharFilterDescriptor() { - ModeValue = mode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuNormalizationCharFilterDescriptor Name(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType? name) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode? value) { - NameValue = name; - return Self; + Instance.Mode = value; + return this; } - public IcuNormalizationCharFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor Name(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType? value) { - VersionValue = version; - return Self; + Instance.Name = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_normalizer"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IcuNormalizationCharFilter IBuildableDescriptor.Build() => new() - { - Mode = ModeValue, - Name = NameValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationTokenFilter.g.cs index 49213f5fffb..1929ff2a0a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuNormalizationTokenFilter.g.cs @@ -17,70 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuNormalizationTokenFilter : ITokenFilter +internal sealed partial class IcuNormalizationTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterConverter))] +public sealed partial class IcuNormalizationTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType Name { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public IcuNormalizationTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IcuNormalizationTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType Name { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_normalizer"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class IcuNormalizationTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuNormalizationTokenFilterDescriptor { - internal IcuNormalizationTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter Instance { get; init; } - public IcuNormalizationTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuNormalizationTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType NameValue { get; set; } - private string? VersionValue { get; set; } - - public IcuNormalizationTokenFilterDescriptor Name(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType name) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuNormalizationTokenFilterDescriptor() { - NameValue = name; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuNormalizationTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor Name(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType value) { - VersionValue = version; - return Self; + Instance.Name = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_normalizer"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - IcuNormalizationTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter Build(System.Action action) { - Name = NameValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTokenizer.g.cs index effb1655fba..390331362b3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTokenizer.g.cs @@ -17,70 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuTokenizer : ITokenizer +internal sealed partial class IcuTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRuleFiles = System.Text.Json.JsonEncodedText.Encode("rule_files"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRuleFiles = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRuleFiles.TryReadProperty(ref reader, options, PropRuleFiles, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RuleFiles = propRuleFiles.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRuleFiles, value.RuleFiles, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerConverter))] +public sealed partial class IcuTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("rule_files")] - public string RuleFiles { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTokenizer(string ruleFiles) + { + RuleFiles = ruleFiles; + } +#if NET7_0_OR_GREATER + public IcuTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IcuTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string RuleFiles { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_tokenizer"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class IcuTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuTokenizerDescriptor { - internal IcuTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer Instance { get; init; } - public IcuTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer instance) { + Instance = instance; } - private string RuleFilesValue { get; set; } - private string? VersionValue { get; set; } - - public IcuTokenizerDescriptor RuleFiles(string ruleFiles) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTokenizerDescriptor() { - RuleFilesValue = ruleFiles; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor RuleFiles(string value) { - VersionValue = version; - return Self; + Instance.RuleFiles = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("rule_files"); - writer.WriteStringValue(RuleFilesValue); - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_tokenizer"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - IcuTokenizer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer Build(System.Action action) { - RuleFiles = RuleFilesValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTransformTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTransformTokenFilter.g.cs index 3d0a701aeda..daef0565872 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTransformTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IcuTransformTokenFilter.g.cs @@ -17,86 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IcuTransformTokenFilter : ITokenFilter +internal sealed partial class IcuTransformTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dir")] + private static readonly System.Text.Json.JsonEncodedText PropDir = System.Text.Json.JsonEncodedText.Encode("dir"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDir = default; + LocalJsonValue propId = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDir.TryReadProperty(ref reader, options, PropDir, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dir = propDir.Value, + Id = propId.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDir, value.Dir, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterConverter))] +public sealed partial class IcuTransformTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTransformTokenFilter(string id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public IcuTransformTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IcuTransformTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuTransformTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection? Dir { get; set; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_transform"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class IcuTransformTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuTransformTokenFilterDescriptor { - internal IcuTransformTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter Instance { get; init; } - public IcuTransformTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTransformTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection? DirValue { get; set; } - private string IdValue { get; set; } - private string? VersionValue { get; set; } - - public IcuTransformTokenFilterDescriptor Dir(Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection? dir) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuTransformTokenFilterDescriptor() { - DirValue = dir; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IcuTransformTokenFilterDescriptor Id(string id) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor Dir(Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection? value) { - IdValue = id; - return Self; + Instance.Dir = value; + return this; } - public IcuTransformTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor Id(string value) { - VersionValue = version; - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (DirValue is not null) - { - writer.WritePropertyName("dir"); - JsonSerializer.Serialize(writer, DirValue, options); - } - - writer.WritePropertyName("id"); - writer.WriteStringValue(IdValue); - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_transform"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - IcuTransformTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter Build(System.Action action) { - Dir = DirValue, - Id = IdValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IndonesianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IndonesianAnalyzer.g.cs index a970bc92251..8834a70a12a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IndonesianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IndonesianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IndonesianAnalyzer : IAnalyzer +internal sealed partial class IndonesianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerConverter))] +public sealed partial class IndonesianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public IndonesianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndonesianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "indonesian"; } -public sealed partial class IndonesianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IndonesianAnalyzerDescriptor { - internal IndonesianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndonesianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer instance) + { + Instance = instance; + } - public IndonesianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndonesianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor descriptor) => descriptor.Instance; - public IndonesianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public IndonesianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public IndonesianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("indonesian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IndonesianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IndonesianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IrishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IrishAnalyzer.g.cs index eb1d2959527..fe4512ebb8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IrishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/IrishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class IrishAnalyzer : IAnalyzer +internal sealed partial class IrishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerConverter))] +public sealed partial class IrishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public IrishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public IrishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IrishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "irish"; } -public sealed partial class IrishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IrishAnalyzerDescriptor { - internal IrishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IrishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer instance) + { + Instance = instance; + } - public IrishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IrishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor descriptor) => descriptor.Instance; - public IrishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public IrishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public IrishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("irish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.IrishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IrishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ItalianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ItalianAnalyzer.g.cs index f3c6ac186c8..cc6799a3689 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ItalianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ItalianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ItalianAnalyzer : IAnalyzer +internal sealed partial class ItalianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerConverter))] +public sealed partial class ItalianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public ItalianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ItalianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ItalianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "italian"; } -public sealed partial class ItalianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ItalianAnalyzerDescriptor { - internal ItalianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ItalianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer instance) + { + Instance = instance; + } - public ItalianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ItalianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor descriptor) => descriptor.Instance; - public ItalianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public ItalianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public ItalianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("italian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ItalianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ItalianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KStemTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KStemTokenFilter.g.cs index 266bcb06e2c..53b18170f8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KStemTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KStemTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KStemTokenFilter : ITokenFilter +internal sealed partial class KStemTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterConverter))] +public sealed partial class KStemTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public KStemTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public KStemTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "kstem"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KStemTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KStemTokenFilterDescriptor { - internal KStemTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KStemTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter instance) + { + Instance = instance; + } - public KStemTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KStemTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor descriptor) => descriptor.Instance; - public KStemTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("kstem"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KStemTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepTypesTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepTypesTokenFilter.g.cs index 3f92d59e42c..1c05f497a7f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepTypesTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepTypesTokenFilter.g.cs @@ -17,90 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KeepTypesTokenFilter : ITokenFilter +internal sealed partial class KeepTypesTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("mode")] + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropTypes = System.Text.Json.JsonEncodedText.Encode("types"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue?> propTypes = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propTypes.TryReadProperty(ref reader, options, PropTypes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + Types = propTypes.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropTypes, value.Types, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterConverter))] +public sealed partial class KeepTypesTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public KeepTypesTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeepTypesTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode? Mode { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "keep_types"; - [JsonInclude, JsonPropertyName("types")] - public ICollection? Types { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.ICollection? Types { get; set; } public string? Version { get; set; } } -public sealed partial class KeepTypesTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KeepTypesTokenFilterDescriptor { - internal KeepTypesTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter Instance { get; init; } - public KeepTypesTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeepTypesTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode? ModeValue { get; set; } - private ICollection? TypesValue { get; set; } - private string? VersionValue { get; set; } - - public KeepTypesTokenFilterDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode? mode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeepTypesTokenFilterDescriptor() { - ModeValue = mode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KeepTypesTokenFilterDescriptor Types(ICollection? types) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode? value) { - TypesValue = types; - return Self; + Instance.Mode = value; + return this; } - public KeepTypesTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor Types(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.Types = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor Types(params string[] values) { - writer.WriteStartObject(); - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } + Instance.Types = [.. values]; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("keep_types"); - if (TypesValue is not null) - { - writer.WritePropertyName("types"); - JsonSerializer.Serialize(writer, TypesValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KeepTypesTokenFilter IBuildableDescriptor.Build() => new() - { - Mode = ModeValue, - Types = TypesValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepWordsTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepWordsTokenFilter.g.cs index 6e78e056980..9869f9335c0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepWordsTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeepWordsTokenFilter.g.cs @@ -17,106 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KeepWordsTokenFilter : ITokenFilter +internal sealed partial class KeepWordsTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("keep_words")] - public ICollection? KeepWords { get; set; } - [JsonInclude, JsonPropertyName("keep_words_case")] + private static readonly System.Text.Json.JsonEncodedText PropKeepWords = System.Text.Json.JsonEncodedText.Encode("keep_words"); + private static readonly System.Text.Json.JsonEncodedText PropKeepWordsCase = System.Text.Json.JsonEncodedText.Encode("keep_words_case"); + private static readonly System.Text.Json.JsonEncodedText PropKeepWordsPath = System.Text.Json.JsonEncodedText.Encode("keep_words_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propKeepWords = default; + LocalJsonValue propKeepWordsCase = default; + LocalJsonValue propKeepWordsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propKeepWords.TryReadProperty(ref reader, options, PropKeepWords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propKeepWordsCase.TryReadProperty(ref reader, options, PropKeepWordsCase, null)) + { + continue; + } + + if (propKeepWordsPath.TryReadProperty(ref reader, options, PropKeepWordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + KeepWords = propKeepWords.Value, + KeepWordsCase = propKeepWordsCase.Value, + KeepWordsPath = propKeepWordsPath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropKeepWords, value.KeepWords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropKeepWordsCase, value.KeepWordsCase, null, null); + writer.WriteProperty(options, PropKeepWordsPath, value.KeepWordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterConverter))] +public sealed partial class KeepWordsTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public KeepWordsTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeepWordsTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? KeepWords { get; set; } public bool? KeepWordsCase { get; set; } - [JsonInclude, JsonPropertyName("keep_words_path")] public string? KeepWordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "keep"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KeepWordsTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KeepWordsTokenFilterDescriptor { - internal KeepWordsTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter Instance { get; init; } - public KeepWordsTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeepWordsTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter instance) { + Instance = instance; } - private ICollection? KeepWordsValue { get; set; } - private bool? KeepWordsCaseValue { get; set; } - private string? KeepWordsPathValue { get; set; } - private string? VersionValue { get; set; } - - public KeepWordsTokenFilterDescriptor KeepWords(ICollection? keepWords) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeepWordsTokenFilterDescriptor() { - KeepWordsValue = keepWords; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KeepWordsTokenFilterDescriptor KeepWordsCase(bool? keepWordsCase = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor KeepWords(System.Collections.Generic.ICollection? value) { - KeepWordsCaseValue = keepWordsCase; - return Self; + Instance.KeepWords = value; + return this; } - public KeepWordsTokenFilterDescriptor KeepWordsPath(string? keepWordsPath) + public Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor KeepWords(params string[] values) { - KeepWordsPathValue = keepWordsPath; - return Self; + Instance.KeepWords = [.. values]; + return this; } - public KeepWordsTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor KeepWordsCase(bool? value = true) { - VersionValue = version; - return Self; + Instance.KeepWordsCase = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor KeepWordsPath(string? value) { - writer.WriteStartObject(); - if (KeepWordsValue is not null) - { - writer.WritePropertyName("keep_words"); - JsonSerializer.Serialize(writer, KeepWordsValue, options); - } - - if (KeepWordsCaseValue.HasValue) - { - writer.WritePropertyName("keep_words_case"); - writer.WriteBooleanValue(KeepWordsCaseValue.Value); - } + Instance.KeepWordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(KeepWordsPathValue)) - { - writer.WritePropertyName("keep_words_path"); - writer.WriteStringValue(KeepWordsPathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("keep"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KeepWordsTokenFilter IBuildableDescriptor.Build() => new() - { - KeepWords = KeepWordsValue, - KeepWordsCase = KeepWordsCaseValue, - KeepWordsPath = KeepWordsPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordAnalyzer.g.cs index e2c5077e950..24c4a82743c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordAnalyzer.g.cs @@ -17,57 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KeywordAnalyzer : IAnalyzer +internal sealed partial class KeywordAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerConverter))] +public sealed partial class KeywordAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public KeywordAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeywordAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeywordAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "keyword"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class KeywordAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KeywordAnalyzerDescriptor { - internal KeywordAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer instance) + { + Instance = instance; + } - public KeywordAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer(Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor descriptor) => descriptor.Instance; - public KeywordAnalyzerDescriptor Version(string? version) + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("keyword"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KeywordAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KeywordAnalyzer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordMarkerTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordMarkerTokenFilter.g.cs index 91a70863b7f..a70b3ffcef7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordMarkerTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordMarkerTokenFilter.g.cs @@ -17,123 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KeywordMarkerTokenFilter : ITokenFilter +internal sealed partial class KeywordMarkerTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreCase = System.Text.Json.JsonEncodedText.Encode("ignore_case"); + private static readonly System.Text.Json.JsonEncodedText PropKeywords = System.Text.Json.JsonEncodedText.Encode("keywords"); + private static readonly System.Text.Json.JsonEncodedText PropKeywordsPath = System.Text.Json.JsonEncodedText.Encode("keywords_path"); + private static readonly System.Text.Json.JsonEncodedText PropKeywordsPattern = System.Text.Json.JsonEncodedText.Encode("keywords_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIgnoreCase = default; + LocalJsonValue?> propKeywords = default; + LocalJsonValue propKeywordsPath = default; + LocalJsonValue propKeywordsPattern = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreCase.TryReadProperty(ref reader, options, PropIgnoreCase, null)) + { + continue; + } + + if (propKeywords.TryReadProperty(ref reader, options, PropKeywords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propKeywordsPath.TryReadProperty(ref reader, options, PropKeywordsPath, null)) + { + continue; + } + + if (propKeywordsPattern.TryReadProperty(ref reader, options, PropKeywordsPattern, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreCase = propIgnoreCase.Value, + Keywords = propKeywords.Value, + KeywordsPath = propKeywordsPath.Value, + KeywordsPattern = propKeywordsPattern.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreCase, value.IgnoreCase, null, null); + writer.WriteProperty(options, PropKeywords, value.Keywords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropKeywordsPath, value.KeywordsPath, null, null); + writer.WriteProperty(options, PropKeywordsPattern, value.KeywordsPattern, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterConverter))] +public sealed partial class KeywordMarkerTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("ignore_case")] +#if NET7_0_OR_GREATER + public KeywordMarkerTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeywordMarkerTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? IgnoreCase { get; set; } - [JsonInclude, JsonPropertyName("keywords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Keywords { get; set; } - [JsonInclude, JsonPropertyName("keywords_path")] + public System.Collections.Generic.ICollection? Keywords { get; set; } public string? KeywordsPath { get; set; } - [JsonInclude, JsonPropertyName("keywords_pattern")] public string? KeywordsPattern { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "keyword_marker"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KeywordMarkerTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KeywordMarkerTokenFilterDescriptor { - internal KeywordMarkerTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter Instance { get; init; } - public KeywordMarkerTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordMarkerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter instance) { + Instance = instance; } - private bool? IgnoreCaseValue { get; set; } - private ICollection? KeywordsValue { get; set; } - private string? KeywordsPathValue { get; set; } - private string? KeywordsPatternValue { get; set; } - private string? VersionValue { get; set; } - - public KeywordMarkerTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordMarkerTokenFilterDescriptor() { - IgnoreCaseValue = ignoreCase; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KeywordMarkerTokenFilterDescriptor Keywords(ICollection? keywords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor IgnoreCase(bool? value = true) { - KeywordsValue = keywords; - return Self; + Instance.IgnoreCase = value; + return this; } - public KeywordMarkerTokenFilterDescriptor KeywordsPath(string? keywordsPath) + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor Keywords(System.Collections.Generic.ICollection? value) { - KeywordsPathValue = keywordsPath; - return Self; + Instance.Keywords = value; + return this; } - public KeywordMarkerTokenFilterDescriptor KeywordsPattern(string? keywordsPattern) + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor Keywords(params string[] values) { - KeywordsPatternValue = keywordsPattern; - return Self; + Instance.Keywords = [.. values]; + return this; } - public KeywordMarkerTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor KeywordsPath(string? value) { - VersionValue = version; - return Self; + Instance.KeywordsPath = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor KeywordsPattern(string? value) { - writer.WriteStartObject(); - if (IgnoreCaseValue.HasValue) - { - writer.WritePropertyName("ignore_case"); - writer.WriteBooleanValue(IgnoreCaseValue.Value); - } - - if (KeywordsValue is not null) - { - writer.WritePropertyName("keywords"); - SingleOrManySerializationHelper.Serialize(KeywordsValue, writer, options); - } - - if (!string.IsNullOrEmpty(KeywordsPathValue)) - { - writer.WritePropertyName("keywords_path"); - writer.WriteStringValue(KeywordsPathValue); - } + Instance.KeywordsPattern = value; + return this; + } - if (!string.IsNullOrEmpty(KeywordsPatternValue)) - { - writer.WritePropertyName("keywords_pattern"); - writer.WriteStringValue(KeywordsPatternValue); - } + public Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("keyword_marker"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KeywordMarkerTokenFilter IBuildableDescriptor.Build() => new() - { - IgnoreCase = IgnoreCaseValue, - Keywords = KeywordsValue, - KeywordsPath = KeywordsPathValue, - KeywordsPattern = KeywordsPatternValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordTokenizer.g.cs index 23daf00166f..f954091da8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KeywordTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KeywordTokenizer : ITokenizer +internal sealed partial class KeywordTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBufferSize = System.Text.Json.JsonEncodedText.Encode("buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBufferSize = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBufferSize.TryReadProperty(ref reader, options, PropBufferSize, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BufferSize = propBufferSize.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBufferSize, value.BufferSize, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerConverter))] +public sealed partial class KeywordTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("buffer_size")] +#if NET7_0_OR_GREATER + public KeywordTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeywordTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeywordTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? BufferSize { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "keyword"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KeywordTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KeywordTokenizerDescriptor { - internal KeywordTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer Instance { get; init; } - public KeywordTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer instance) { + Instance = instance; } - private int? BufferSizeValue { get; set; } - private string? VersionValue { get; set; } - - public KeywordTokenizerDescriptor BufferSize(int? bufferSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordTokenizerDescriptor() { - BufferSizeValue = bufferSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KeywordTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor BufferSize(int? value) { - VersionValue = version; - return Self; + Instance.BufferSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (BufferSizeValue.HasValue) - { - writer.WritePropertyName("buffer_size"); - writer.WriteNumberValue(BufferSizeValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("keyword"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - KeywordTokenizer IBuildableDescriptor.Build() => new() - { - BufferSize = BufferSizeValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs index ff705e275ce..495eb4a511a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs @@ -17,70 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiAnalyzer : IAnalyzer +internal sealed partial class KuromojiAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionary = System.Text.Json.JsonEncodedText.Encode("user_dictionary"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue propUserDictionary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUserDictionary.TryReadProperty(ref reader, options, PropUserDictionary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + UserDictionary = propUserDictionary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUserDictionary, value.UserDictionary, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerConverter))] +public sealed partial class KuromojiAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Mode { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode mode) + { + Mode = mode; + } +#if NET7_0_OR_GREATER + public KuromojiAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Mode { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "kuromoji"; - [JsonInclude, JsonPropertyName("user_dictionary")] public string? UserDictionary { get; set; } } -public sealed partial class KuromojiAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiAnalyzerDescriptor { - internal KuromojiAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Instance { get; init; } - public KuromojiAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode ModeValue { get; set; } - private string? UserDictionaryValue { get; set; } - - public KuromojiAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode mode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiAnalyzerDescriptor() { - ModeValue = mode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiAnalyzerDescriptor UserDictionary(string? userDictionary) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode value) { - UserDictionaryValue = userDictionary; - return Self; + Instance.Mode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor UserDictionary(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji"); - if (!string.IsNullOrEmpty(UserDictionaryValue)) - { - writer.WritePropertyName("user_dictionary"); - writer.WriteStringValue(UserDictionaryValue); - } - - writer.WriteEndObject(); + Instance.UserDictionary = value; + return this; } - KuromojiAnalyzer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Build(System.Action action) { - Mode = ModeValue, - UserDictionary = UserDictionaryValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiIterationMarkCharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiIterationMarkCharFilter.g.cs index 7f6240c8258..e0e102222db 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiIterationMarkCharFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiIterationMarkCharFilter.g.cs @@ -17,82 +17,161 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiIterationMarkCharFilter : ICharFilter +internal sealed partial class KuromojiIterationMarkCharFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("normalize_kana")] - public bool NormalizeKana { get; set; } - [JsonInclude, JsonPropertyName("normalize_kanji")] - public bool NormalizeKanji { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropNormalizeKana = System.Text.Json.JsonEncodedText.Encode("normalize_kana"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizeKanji = System.Text.Json.JsonEncodedText.Encode("normalize_kanji"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNormalizeKana = default; + LocalJsonValue propNormalizeKanji = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNormalizeKana.TryReadProperty(ref reader, options, PropNormalizeKana, null)) + { + continue; + } + + if (propNormalizeKanji.TryReadProperty(ref reader, options, PropNormalizeKanji, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NormalizeKana = propNormalizeKana.Value, + NormalizeKanji = propNormalizeKanji.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNormalizeKana, value.NormalizeKana, null, null); + writer.WriteProperty(options, PropNormalizeKanji, value.NormalizeKanji, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterConverter))] +public sealed partial class KuromojiIterationMarkCharFilter : Elastic.Clients.Elasticsearch.Analysis.ICharFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiIterationMarkCharFilter(bool normalizeKana, bool normalizeKanji) + { + NormalizeKana = normalizeKana; + NormalizeKanji = normalizeKanji; + } +#if NET7_0_OR_GREATER + public KuromojiIterationMarkCharFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiIterationMarkCharFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiIterationMarkCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool NormalizeKana { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool NormalizeKanji { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "kuromoji_iteration_mark"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KuromojiIterationMarkCharFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiIterationMarkCharFilterDescriptor { - internal KuromojiIterationMarkCharFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter Instance { get; init; } - public KuromojiIterationMarkCharFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiIterationMarkCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter instance) { + Instance = instance; } - private bool NormalizeKanaValue { get; set; } - private bool NormalizeKanjiValue { get; set; } - private string? VersionValue { get; set; } - - public KuromojiIterationMarkCharFilterDescriptor NormalizeKana(bool normalizeKana = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiIterationMarkCharFilterDescriptor() { - NormalizeKanaValue = normalizeKana; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiIterationMarkCharFilterDescriptor NormalizeKanji(bool normalizeKanji = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter(Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor NormalizeKana(bool value = true) { - NormalizeKanjiValue = normalizeKanji; - return Self; + Instance.NormalizeKana = value; + return this; } - public KuromojiIterationMarkCharFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor NormalizeKanji(bool value = true) { - VersionValue = version; - return Self; + Instance.NormalizeKanji = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("normalize_kana"); - writer.WriteBooleanValue(NormalizeKanaValue); - writer.WritePropertyName("normalize_kanji"); - writer.WriteBooleanValue(NormalizeKanjiValue); - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji_iteration_mark"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - KuromojiIterationMarkCharFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter Build(System.Action action) { - NormalizeKana = NormalizeKanaValue, - NormalizeKanji = NormalizeKanjiValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiIterationMarkCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiPartOfSpeechTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiPartOfSpeechTokenFilter.g.cs index 3566825f88d..4376c893f3f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiPartOfSpeechTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiPartOfSpeechTokenFilter.g.cs @@ -17,70 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiPartOfSpeechTokenFilter : ITokenFilter +internal sealed partial class KuromojiPartOfSpeechTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stoptags")] - public ICollection Stoptags { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropStoptags = System.Text.Json.JsonEncodedText.Encode("stoptags"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propStoptags = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStoptags.TryReadProperty(ref reader, options, PropStoptags, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stoptags = propStoptags.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStoptags, value.Stoptags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterConverter))] +public sealed partial class KuromojiPartOfSpeechTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiPartOfSpeechTokenFilter(System.Collections.Generic.ICollection stoptags) + { + Stoptags = stoptags; + } +#if NET7_0_OR_GREATER + public KuromojiPartOfSpeechTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiPartOfSpeechTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Stoptags { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "kuromoji_part_of_speech"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KuromojiPartOfSpeechTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiPartOfSpeechTokenFilterDescriptor { - internal KuromojiPartOfSpeechTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter Instance { get; init; } - public KuromojiPartOfSpeechTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiPartOfSpeechTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter instance) { + Instance = instance; } - private ICollection StoptagsValue { get; set; } - private string? VersionValue { get; set; } - - public KuromojiPartOfSpeechTokenFilterDescriptor Stoptags(ICollection stoptags) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiPartOfSpeechTokenFilterDescriptor() { - StoptagsValue = stoptags; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiPartOfSpeechTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor Stoptags(System.Collections.Generic.ICollection value) { - VersionValue = version; - return Self; + Instance.Stoptags = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor Stoptags(params string[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("stoptags"); - JsonSerializer.Serialize(writer, StoptagsValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji_part_of_speech"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.Stoptags = [.. values]; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - KuromojiPartOfSpeechTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter Build(System.Action action) { - Stoptags = StoptagsValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiReadingFormTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiReadingFormTokenFilter.g.cs index eb34f202699..e466a487e82 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiReadingFormTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiReadingFormTokenFilter.g.cs @@ -17,69 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiReadingFormTokenFilter : ITokenFilter +internal sealed partial class KuromojiReadingFormTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUseRomaji = System.Text.Json.JsonEncodedText.Encode("use_romaji"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUseRomaji = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUseRomaji.TryReadProperty(ref reader, options, PropUseRomaji, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + UseRomaji = propUseRomaji.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUseRomaji, value.UseRomaji, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterConverter))] +public sealed partial class KuromojiReadingFormTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiReadingFormTokenFilter(bool useRomaji) + { + UseRomaji = useRomaji; + } +#if NET7_0_OR_GREATER + public KuromojiReadingFormTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiReadingFormTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiReadingFormTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "kuromoji_readingform"; - [JsonInclude, JsonPropertyName("use_romaji")] - public bool UseRomaji { get; set; } - [JsonInclude, JsonPropertyName("version")] + public +#if NET7_0_OR_GREATER + required +#endif + bool UseRomaji { get; set; } public string? Version { get; set; } } -public sealed partial class KuromojiReadingFormTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiReadingFormTokenFilterDescriptor { - internal KuromojiReadingFormTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter Instance { get; init; } - public KuromojiReadingFormTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiReadingFormTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter instance) { + Instance = instance; } - private bool UseRomajiValue { get; set; } - private string? VersionValue { get; set; } - - public KuromojiReadingFormTokenFilterDescriptor UseRomaji(bool useRomaji = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiReadingFormTokenFilterDescriptor() { - UseRomajiValue = useRomaji; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiReadingFormTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor UseRomaji(bool value = true) { - VersionValue = version; - return Self; + Instance.UseRomaji = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji_readingform"); - writer.WritePropertyName("use_romaji"); - writer.WriteBooleanValue(UseRomajiValue); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - KuromojiReadingFormTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter Build(System.Action action) { - UseRomaji = UseRomajiValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiStemmerTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiStemmerTokenFilter.g.cs index d98994983f6..e4dad723398 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiStemmerTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiStemmerTokenFilter.g.cs @@ -17,70 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiStemmerTokenFilter : ITokenFilter +internal sealed partial class KuromojiStemmerTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMinimumLength = System.Text.Json.JsonEncodedText.Encode("minimum_length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMinimumLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMinimumLength.TryReadProperty(ref reader, options, PropMinimumLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MinimumLength = propMinimumLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMinimumLength, value.MinimumLength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterConverter))] +public sealed partial class KuromojiStemmerTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("minimum_length")] - public int MinimumLength { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiStemmerTokenFilter(int minimumLength) + { + MinimumLength = minimumLength; + } +#if NET7_0_OR_GREATER + public KuromojiStemmerTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiStemmerTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiStemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int MinimumLength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "kuromoji_stemmer"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class KuromojiStemmerTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiStemmerTokenFilterDescriptor { - internal KuromojiStemmerTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter Instance { get; init; } - public KuromojiStemmerTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiStemmerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter instance) { + Instance = instance; } - private int MinimumLengthValue { get; set; } - private string? VersionValue { get; set; } - - public KuromojiStemmerTokenFilterDescriptor MinimumLength(int minimumLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiStemmerTokenFilterDescriptor() { - MinimumLengthValue = minimumLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiStemmerTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor MinimumLength(int value) { - VersionValue = version; - return Self; + Instance.MinimumLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - writer.WritePropertyName("minimum_length"); - writer.WriteNumberValue(MinimumLengthValue); - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji_stemmer"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - KuromojiStemmerTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter Build(System.Action action) { - MinimumLength = MinimumLengthValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiTokenizer.g.cs index 9e35cca0299..fac6adad29b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiTokenizer.g.cs @@ -17,166 +17,242 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class KuromojiTokenizer : ITokenizer +internal sealed partial class KuromojiTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscardCompoundToken = System.Text.Json.JsonEncodedText.Encode("discard_compound_token"); + private static readonly System.Text.Json.JsonEncodedText PropDiscardPunctuation = System.Text.Json.JsonEncodedText.Encode("discard_punctuation"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropNbestCost = System.Text.Json.JsonEncodedText.Encode("nbest_cost"); + private static readonly System.Text.Json.JsonEncodedText PropNbestExamples = System.Text.Json.JsonEncodedText.Encode("nbest_examples"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionary = System.Text.Json.JsonEncodedText.Encode("user_dictionary"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionaryRules = System.Text.Json.JsonEncodedText.Encode("user_dictionary_rules"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDiscardCompoundToken = default; + LocalJsonValue propDiscardPunctuation = default; + LocalJsonValue propMode = default; + LocalJsonValue propNbestCost = default; + LocalJsonValue propNbestExamples = default; + LocalJsonValue propUserDictionary = default; + LocalJsonValue?> propUserDictionaryRules = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDiscardCompoundToken.TryReadProperty(ref reader, options, PropDiscardCompoundToken, null)) + { + continue; + } + + if (propDiscardPunctuation.TryReadProperty(ref reader, options, PropDiscardPunctuation, null)) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propNbestCost.TryReadProperty(ref reader, options, PropNbestCost, null)) + { + continue; + } + + if (propNbestExamples.TryReadProperty(ref reader, options, PropNbestExamples, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUserDictionary.TryReadProperty(ref reader, options, PropUserDictionary, null)) + { + continue; + } + + if (propUserDictionaryRules.TryReadProperty(ref reader, options, PropUserDictionaryRules, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DiscardCompoundToken = propDiscardCompoundToken.Value, + DiscardPunctuation = propDiscardPunctuation.Value, + Mode = propMode.Value, + NbestCost = propNbestCost.Value, + NbestExamples = propNbestExamples.Value, + UserDictionary = propUserDictionary.Value, + UserDictionaryRules = propUserDictionaryRules.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDiscardCompoundToken, value.DiscardCompoundToken, null, null); + writer.WriteProperty(options, PropDiscardPunctuation, value.DiscardPunctuation, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropNbestCost, value.NbestCost, null, null); + writer.WriteProperty(options, PropNbestExamples, value.NbestExamples, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUserDictionary, value.UserDictionary, null, null); + writer.WriteProperty(options, PropUserDictionaryRules, value.UserDictionaryRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerConverter))] +public sealed partial class KuromojiTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("discard_compound_token")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiTokenizer(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode mode) + { + Mode = mode; + } +#if NET7_0_OR_GREATER + public KuromojiTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KuromojiTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KuromojiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? DiscardCompoundToken { get; set; } - [JsonInclude, JsonPropertyName("discard_punctuation")] public bool? DiscardPunctuation { get; set; } - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Mode { get; set; } - [JsonInclude, JsonPropertyName("nbest_cost")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Mode { get; set; } public int? NbestCost { get; set; } - [JsonInclude, JsonPropertyName("nbest_examples")] public string? NbestExamples { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "kuromoji_tokenizer"; - [JsonInclude, JsonPropertyName("user_dictionary")] public string? UserDictionary { get; set; } - [JsonInclude, JsonPropertyName("user_dictionary_rules")] - public ICollection? UserDictionaryRules { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.ICollection? UserDictionaryRules { get; set; } public string? Version { get; set; } } -public sealed partial class KuromojiTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct KuromojiTokenizerDescriptor { - internal KuromojiTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer Instance { get; init; } - public KuromojiTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer instance) { + Instance = instance; } - private bool? DiscardCompoundTokenValue { get; set; } - private bool? DiscardPunctuationValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode ModeValue { get; set; } - private int? NbestCostValue { get; set; } - private string? NbestExamplesValue { get; set; } - private string? UserDictionaryValue { get; set; } - private ICollection? UserDictionaryRulesValue { get; set; } - private string? VersionValue { get; set; } - - public KuromojiTokenizerDescriptor DiscardCompoundToken(bool? discardCompoundToken = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KuromojiTokenizerDescriptor() { - DiscardCompoundTokenValue = discardCompoundToken; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public KuromojiTokenizerDescriptor DiscardPunctuation(bool? discardPunctuation = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor DiscardCompoundToken(bool? value = true) { - DiscardPunctuationValue = discardPunctuation; - return Self; + Instance.DiscardCompoundToken = value; + return this; } - public KuromojiTokenizerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode mode) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor DiscardPunctuation(bool? value = true) { - ModeValue = mode; - return Self; + Instance.DiscardPunctuation = value; + return this; } - public KuromojiTokenizerDescriptor NbestCost(int? nbestCost) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode value) { - NbestCostValue = nbestCost; - return Self; + Instance.Mode = value; + return this; } - public KuromojiTokenizerDescriptor NbestExamples(string? nbestExamples) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor NbestCost(int? value) { - NbestExamplesValue = nbestExamples; - return Self; + Instance.NbestCost = value; + return this; } - public KuromojiTokenizerDescriptor UserDictionary(string? userDictionary) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor NbestExamples(string? value) { - UserDictionaryValue = userDictionary; - return Self; + Instance.NbestExamples = value; + return this; } - public KuromojiTokenizerDescriptor UserDictionaryRules(ICollection? userDictionaryRules) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor UserDictionary(string? value) { - UserDictionaryRulesValue = userDictionaryRules; - return Self; + Instance.UserDictionary = value; + return this; } - public KuromojiTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor UserDictionaryRules(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.UserDictionaryRules = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor UserDictionaryRules(params string[] values) { - writer.WriteStartObject(); - if (DiscardCompoundTokenValue.HasValue) - { - writer.WritePropertyName("discard_compound_token"); - writer.WriteBooleanValue(DiscardCompoundTokenValue.Value); - } - - if (DiscardPunctuationValue.HasValue) - { - writer.WritePropertyName("discard_punctuation"); - writer.WriteBooleanValue(DiscardPunctuationValue.Value); - } - - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - if (NbestCostValue.HasValue) - { - writer.WritePropertyName("nbest_cost"); - writer.WriteNumberValue(NbestCostValue.Value); - } - - if (!string.IsNullOrEmpty(NbestExamplesValue)) - { - writer.WritePropertyName("nbest_examples"); - writer.WriteStringValue(NbestExamplesValue); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("kuromoji_tokenizer"); - if (!string.IsNullOrEmpty(UserDictionaryValue)) - { - writer.WritePropertyName("user_dictionary"); - writer.WriteStringValue(UserDictionaryValue); - } - - if (UserDictionaryRulesValue is not null) - { - writer.WritePropertyName("user_dictionary_rules"); - JsonSerializer.Serialize(writer, UserDictionaryRulesValue, options); - } - - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.UserDictionaryRules = [.. values]; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - KuromojiTokenizer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer Build(System.Action action) { - DiscardCompoundToken = DiscardCompoundTokenValue, - DiscardPunctuation = DiscardPunctuationValue, - Mode = ModeValue, - NbestCost = NbestCostValue, - NbestExamples = NbestExamplesValue, - UserDictionary = UserDictionaryValue, - UserDictionaryRules = UserDictionaryRulesValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LanguageAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LanguageAnalyzer.g.cs deleted file mode 100644 index 00a6d5a7171..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LanguageAnalyzer.g.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Analysis; - -public sealed partial class LanguageAnalyzer : IAnalyzer -{ - [JsonInclude, JsonPropertyName("language")] - public Elastic.Clients.Elasticsearch.Analysis.Language Language { get; set; } - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] - public string? StopwordsPath { get; set; } - - [JsonInclude, JsonPropertyName("type")] - public string Type => "language"; - - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; set; } -} - -public sealed partial class LanguageAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal LanguageAnalyzerDescriptor(Action configure) => configure.Invoke(this); - - public LanguageAnalyzerDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.Analysis.Language LanguageValue { get; set; } - private ICollection StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } - private string? VersionValue { get; set; } - - public LanguageAnalyzerDescriptor Language(Elastic.Clients.Elasticsearch.Analysis.Language language) - { - LanguageValue = language; - return Self; - } - - public LanguageAnalyzerDescriptor StemExclusion(ICollection stemExclusion) - { - StemExclusionValue = stemExclusion; - return Self; - } - - public LanguageAnalyzerDescriptor Stopwords(ICollection? stopwords) - { - StopwordsValue = stopwords; - return Self; - } - - public LanguageAnalyzerDescriptor StopwordsPath(string? stopwordsPath) - { - StopwordsPathValue = stopwordsPath; - return Self; - } - - public LanguageAnalyzerDescriptor Version(string? version) - { - VersionValue = version; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - writer.WritePropertyName("language"); - JsonSerializer.Serialize(writer, LanguageValue, options); - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } - - if (!string.IsNullOrEmpty(StopwordsPathValue)) - { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("language"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); - } - - LanguageAnalyzer IBuildableDescriptor.Build() => new() - { - Language = LanguageValue, - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue, - Version = VersionValue - }; -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LatvianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LatvianAnalyzer.g.cs index 760fd6484b5..8a442a5fef3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LatvianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LatvianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LatvianAnalyzer : IAnalyzer +internal sealed partial class LatvianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerConverter))] +public sealed partial class LatvianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public LatvianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public LatvianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LatvianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "latvian"; } -public sealed partial class LatvianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LatvianAnalyzerDescriptor { - internal LatvianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatvianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer instance) + { + Instance = instance; + } - public LatvianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatvianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor descriptor) => descriptor.Instance; - public LatvianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public LatvianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public LatvianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("latvian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LatvianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LatvianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs index c17c99012b9..acaa31a2192 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LengthTokenFilter.g.cs @@ -17,90 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LengthTokenFilter : ITokenFilter +internal sealed partial class LengthTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("max")] + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Max = propMax.Value, + Min = propMin.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterConverter))] +public sealed partial class LengthTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public LengthTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public LengthTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LengthTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? Max { get; set; } - [JsonInclude, JsonPropertyName("min")] public int? Min { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "length"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class LengthTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LengthTokenFilterDescriptor { - internal LengthTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter Instance { get; init; } - public LengthTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LengthTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter instance) { + Instance = instance; } - private int? MaxValue { get; set; } - private int? MinValue { get; set; } - private string? VersionValue { get; set; } - - public LengthTokenFilterDescriptor Max(int? max) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LengthTokenFilterDescriptor() { - MaxValue = max; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public LengthTokenFilterDescriptor Min(int? min) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor Max(int? value) { - MinValue = min; - return Self; + Instance.Max = value; + return this; } - public LengthTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor Min(int? value) { - VersionValue = version; - return Self; + Instance.Min = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxValue.HasValue) - { - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue.Value); - } - - if (MinValue.HasValue) - { - writer.WritePropertyName("min"); - writer.WriteNumberValue(MinValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("length"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LengthTokenFilter IBuildableDescriptor.Build() => new() - { - Max = MaxValue, - Min = MinValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LetterTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LetterTokenizer.g.cs index 252b705fd7d..2dcf2358c38 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LetterTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LetterTokenizer.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LetterTokenizer : ITokenizer +internal sealed partial class LetterTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerConverter))] +public sealed partial class LetterTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public LetterTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public LetterTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LetterTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "letter"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class LetterTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LetterTokenizerDescriptor { - internal LetterTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LetterTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer instance) + { + Instance = instance; + } - public LetterTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LetterTokenizerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor descriptor) => descriptor.Instance; - public LetterTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("letter"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LetterTokenizer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs index 3f1cce4ecc5..e5217c43d40 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LimitTokenCountTokenFilter.g.cs @@ -17,90 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LimitTokenCountTokenFilter : ITokenFilter +internal sealed partial class LimitTokenCountTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("consume_all_tokens")] + private static readonly System.Text.Json.JsonEncodedText PropConsumeAllTokens = System.Text.Json.JsonEncodedText.Encode("consume_all_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenCount = System.Text.Json.JsonEncodedText.Encode("max_token_count"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConsumeAllTokens = default; + LocalJsonValue propMaxTokenCount = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConsumeAllTokens.TryReadProperty(ref reader, options, PropConsumeAllTokens, null)) + { + continue; + } + + if (propMaxTokenCount.TryReadProperty(ref reader, options, PropMaxTokenCount, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ConsumeAllTokens = propConsumeAllTokens.Value, + MaxTokenCount = propMaxTokenCount.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConsumeAllTokens, value.ConsumeAllTokens, null, null); + writer.WriteProperty(options, PropMaxTokenCount, value.MaxTokenCount, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterConverter))] +public sealed partial class LimitTokenCountTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public LimitTokenCountTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public LimitTokenCountTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? ConsumeAllTokens { get; set; } - [JsonInclude, JsonPropertyName("max_token_count")] public int? MaxTokenCount { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "limit"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class LimitTokenCountTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LimitTokenCountTokenFilterDescriptor { - internal LimitTokenCountTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter Instance { get; init; } - public LimitTokenCountTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LimitTokenCountTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter instance) { + Instance = instance; } - private bool? ConsumeAllTokensValue { get; set; } - private int? MaxTokenCountValue { get; set; } - private string? VersionValue { get; set; } - - public LimitTokenCountTokenFilterDescriptor ConsumeAllTokens(bool? consumeAllTokens = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LimitTokenCountTokenFilterDescriptor() { - ConsumeAllTokensValue = consumeAllTokens; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public LimitTokenCountTokenFilterDescriptor MaxTokenCount(int? maxTokenCount) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor ConsumeAllTokens(bool? value = true) { - MaxTokenCountValue = maxTokenCount; - return Self; + Instance.ConsumeAllTokens = value; + return this; } - public LimitTokenCountTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor MaxTokenCount(int? value) { - VersionValue = version; - return Self; + Instance.MaxTokenCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (ConsumeAllTokensValue.HasValue) - { - writer.WritePropertyName("consume_all_tokens"); - writer.WriteBooleanValue(ConsumeAllTokensValue.Value); - } - - if (MaxTokenCountValue.HasValue) - { - writer.WritePropertyName("max_token_count"); - writer.WriteNumberValue(MaxTokenCountValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("limit"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LimitTokenCountTokenFilter IBuildableDescriptor.Build() => new() - { - ConsumeAllTokens = ConsumeAllTokensValue, - MaxTokenCount = MaxTokenCountValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LithuanianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LithuanianAnalyzer.g.cs index 4a5f774ff5d..5285aa6d1aa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LithuanianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LithuanianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LithuanianAnalyzer : IAnalyzer +internal sealed partial class LithuanianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerConverter))] +public sealed partial class LithuanianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public LithuanianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public LithuanianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "lithuanian"; } -public sealed partial class LithuanianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LithuanianAnalyzerDescriptor { - internal LithuanianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LithuanianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer instance) + { + Instance = instance; + } - public LithuanianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LithuanianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor descriptor) => descriptor.Instance; - public LithuanianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public LithuanianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public LithuanianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("lithuanian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LithuanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LithuanianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseNormalizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseNormalizer.g.cs index 7ef6a2cf841..e27b218e23f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseNormalizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseNormalizer.g.cs @@ -17,39 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LowercaseNormalizer : INormalizer +internal sealed partial class LowercaseNormalizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerConverter))] +public sealed partial class LowercaseNormalizer : Elastic.Clients.Elasticsearch.Analysis.INormalizer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public LowercaseNormalizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public LowercaseNormalizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LowercaseNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "lowercase"; } -public sealed partial class LowercaseNormalizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LowercaseNormalizerDescriptor { - internal LowercaseNormalizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer Instance { get; init; } - public LowercaseNormalizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseNormalizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseNormalizerDescriptor() { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("lowercase"); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - LowercaseNormalizer IBuildableDescriptor.Build() => new() + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer instance) => new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer(Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer Build(System.Action? action) { - }; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenFilter.g.cs index cdf9aff0505..786b166ab98 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenFilter.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LowercaseTokenFilter : ITokenFilter +internal sealed partial class LowercaseTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLanguage = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Language = propLanguage.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterConverter))] +public sealed partial class LowercaseTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("language")] +#if NET7_0_OR_GREATER + public LowercaseTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public LowercaseTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Language { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "lowercase"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class LowercaseTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LowercaseTokenFilterDescriptor { - internal LowercaseTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter Instance { get; init; } - public LowercaseTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter instance) { + Instance = instance; } - private string? LanguageValue { get; set; } - private string? VersionValue { get; set; } - - public LowercaseTokenFilterDescriptor Language(string? language) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseTokenFilterDescriptor() { - LanguageValue = language; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public LowercaseTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor Language(string? value) { - VersionValue = version; - return Self; + Instance.Language = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(LanguageValue)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(LanguageValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("lowercase"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LowercaseTokenFilter IBuildableDescriptor.Build() => new() - { - Language = LanguageValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenizer.g.cs index 832e7dbb24f..661bfed7104 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/LowercaseTokenizer.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class LowercaseTokenizer : ITokenizer +internal sealed partial class LowercaseTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerConverter))] +public sealed partial class LowercaseTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public LowercaseTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public LowercaseTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LowercaseTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "lowercase"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class LowercaseTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LowercaseTokenizerDescriptor { - internal LowercaseTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer instance) + { + Instance = instance; + } - public LowercaseTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseTokenizerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor descriptor) => descriptor.Instance; - public LowercaseTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("lowercase"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LowercaseTokenizer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MappingCharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MappingCharFilter.g.cs index d99840f9ae0..c4d62e44b00 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MappingCharFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MappingCharFilter.g.cs @@ -17,90 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class MappingCharFilter : ICharFilter +internal sealed partial class MappingCharFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("mappings")] - public ICollection? Mappings { get; set; } - [JsonInclude, JsonPropertyName("mappings_path")] + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropMappingsPath = System.Text.Json.JsonEncodedText.Encode("mappings_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMappings = default; + LocalJsonValue propMappingsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMappings.TryReadProperty(ref reader, options, PropMappings, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMappingsPath.TryReadProperty(ref reader, options, PropMappingsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mappings = propMappings.Value, + MappingsPath = propMappingsPath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMappings, value.Mappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMappingsPath, value.MappingsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterConverter))] +public sealed partial class MappingCharFilter : Elastic.Clients.Elasticsearch.Analysis.ICharFilter +{ +#if NET7_0_OR_GREATER + public MappingCharFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingCharFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Mappings { get; set; } public string? MappingsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "mapping"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class MappingCharFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct MappingCharFilterDescriptor { - internal MappingCharFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter Instance { get; init; } - public MappingCharFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter instance) { + Instance = instance; } - private ICollection? MappingsValue { get; set; } - private string? MappingsPathValue { get; set; } - private string? VersionValue { get; set; } - - public MappingCharFilterDescriptor Mappings(ICollection? mappings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingCharFilterDescriptor() { - MappingsValue = mappings; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MappingCharFilterDescriptor MappingsPath(string? mappingsPath) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter(Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor Mappings(System.Collections.Generic.ICollection? value) { - MappingsPathValue = mappingsPath; - return Self; + Instance.Mappings = value; + return this; } - public MappingCharFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor Mappings(params string[] values) { - VersionValue = version; - return Self; + Instance.Mappings = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor MappingsPath(string? value) { - writer.WriteStartObject(); - if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + Instance.MappingsPath = value; + return this; + } - if (!string.IsNullOrEmpty(MappingsPathValue)) - { - writer.WritePropertyName("mappings_path"); - writer.WriteStringValue(MappingsPathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("mapping"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.MappingCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - MappingCharFilter IBuildableDescriptor.Build() => new() - { - Mappings = MappingsValue, - MappingsPath = MappingsPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs index db6a3e2173d..c0ba2f72c76 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/MultiplexerTokenFilter.g.cs @@ -17,86 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class MultiplexerTokenFilter : ITokenFilter +internal sealed partial class MultiplexerTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("filters")] - public ICollection Filters { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFilters = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilters.TryReadProperty(ref reader, options, PropFilters, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filters = propFilters.Value, + PreserveOriginal = propPreserveOriginal.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilters, value.Filters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterConverter))] +public sealed partial class MultiplexerTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiplexerTokenFilter(System.Collections.Generic.ICollection filters) + { + Filters = filters; + } +#if NET7_0_OR_GREATER + public MultiplexerTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiplexerTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiplexerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Filters { get; set; } public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "multiplexer"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class MultiplexerTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct MultiplexerTokenFilterDescriptor { - internal MultiplexerTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter Instance { get; init; } - public MultiplexerTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiplexerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter instance) { + Instance = instance; } - private ICollection FiltersValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private string? VersionValue { get; set; } - - public MultiplexerTokenFilterDescriptor Filters(ICollection filters) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiplexerTokenFilterDescriptor() { - FiltersValue = filters; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MultiplexerTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor Filters(System.Collections.Generic.ICollection value) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.Filters = value; + return this; } - public MultiplexerTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor Filters(params string[] values) { - VersionValue = version; - return Self; + Instance.Filters = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor PreserveOriginal(bool? value = true) { - writer.WriteStartObject(); - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("multiplexer"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.PreserveOriginal = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - MultiplexerTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter Build(System.Action action) { - Filters = FiltersValue, - PreserveOriginal = PreserveOriginalValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenFilter.g.cs index 1748bca3edd..0b397424eb5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenFilter.g.cs @@ -17,106 +17,167 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NGramTokenFilter : ITokenFilter +internal sealed partial class NGramTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxGram = System.Text.Json.JsonEncodedText.Encode("max_gram"); + private static readonly System.Text.Json.JsonEncodedText PropMinGram = System.Text.Json.JsonEncodedText.Encode("min_gram"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxGram = default; + LocalJsonValue propMinGram = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxGram.TryReadProperty(ref reader, options, PropMaxGram, null)) + { + continue; + } + + if (propMinGram.TryReadProperty(ref reader, options, PropMinGram, null)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxGram = propMaxGram.Value, + MinGram = propMinGram.Value, + PreserveOriginal = propPreserveOriginal.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxGram, value.MaxGram, null, null); + writer.WriteProperty(options, PropMinGram, value.MinGram, null, null); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterConverter))] +public sealed partial class NGramTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("max_gram")] +#if NET7_0_OR_GREATER + public NGramTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public NGramTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxGram { get; set; } - [JsonInclude, JsonPropertyName("min_gram")] public int? MinGram { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "ngram"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class NGramTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NGramTokenFilterDescriptor { - internal NGramTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter Instance { get; init; } - public NGramTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NGramTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter instance) { + Instance = instance; } - private int? MaxGramValue { get; set; } - private int? MinGramValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private string? VersionValue { get; set; } - - public NGramTokenFilterDescriptor MaxGram(int? maxGram) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NGramTokenFilterDescriptor() { - MaxGramValue = maxGram; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NGramTokenFilterDescriptor MinGram(int? minGram) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor MaxGram(int? value) { - MinGramValue = minGram; - return Self; + Instance.MaxGram = value; + return this; } - public NGramTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor MinGram(int? value) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.MinGram = value; + return this; } - public NGramTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor PreserveOriginal(bool? value = true) { - VersionValue = version; - return Self; + Instance.PreserveOriginal = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxGramValue.HasValue) - { - writer.WritePropertyName("max_gram"); - writer.WriteNumberValue(MaxGramValue.Value); - } - - if (MinGramValue.HasValue) - { - writer.WritePropertyName("min_gram"); - writer.WriteNumberValue(MinGramValue.Value); - } - - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("ngram"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NGramTokenFilter IBuildableDescriptor.Build() => new() - { - MaxGram = MaxGramValue, - MinGram = MinGramValue, - PreserveOriginal = PreserveOriginalValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenizer.g.cs index c4cfb90b1fe..d70b4232e69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NGramTokenizer.g.cs @@ -17,122 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NGramTokenizer : ITokenizer +internal sealed partial class NGramTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCustomTokenChars = System.Text.Json.JsonEncodedText.Encode("custom_token_chars"); + private static readonly System.Text.Json.JsonEncodedText PropMaxGram = System.Text.Json.JsonEncodedText.Encode("max_gram"); + private static readonly System.Text.Json.JsonEncodedText PropMinGram = System.Text.Json.JsonEncodedText.Encode("min_gram"); + private static readonly System.Text.Json.JsonEncodedText PropTokenChars = System.Text.Json.JsonEncodedText.Encode("token_chars"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCustomTokenChars = default; + LocalJsonValue propMaxGram = default; + LocalJsonValue propMinGram = default; + LocalJsonValue?> propTokenChars = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCustomTokenChars.TryReadProperty(ref reader, options, PropCustomTokenChars, null)) + { + continue; + } + + if (propMaxGram.TryReadProperty(ref reader, options, PropMaxGram, null)) + { + continue; + } + + if (propMinGram.TryReadProperty(ref reader, options, PropMinGram, null)) + { + continue; + } + + if (propTokenChars.TryReadProperty(ref reader, options, PropTokenChars, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CustomTokenChars = propCustomTokenChars.Value, + MaxGram = propMaxGram.Value, + MinGram = propMinGram.Value, + TokenChars = propTokenChars.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCustomTokenChars, value.CustomTokenChars, null, null); + writer.WriteProperty(options, PropMaxGram, value.MaxGram, null, null); + writer.WriteProperty(options, PropMinGram, value.MinGram, null, null); + writer.WriteProperty(options, PropTokenChars, value.TokenChars, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerConverter))] +public sealed partial class NGramTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("custom_token_chars")] +#if NET7_0_OR_GREATER + public NGramTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public NGramTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? CustomTokenChars { get; set; } - [JsonInclude, JsonPropertyName("max_gram")] public int? MaxGram { get; set; } - [JsonInclude, JsonPropertyName("min_gram")] public int? MinGram { get; set; } - [JsonInclude, JsonPropertyName("token_chars")] - public ICollection? TokenChars { get; set; } + public System.Collections.Generic.ICollection? TokenChars { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "ngram"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class NGramTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NGramTokenizerDescriptor { - internal NGramTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer Instance { get; init; } - public NGramTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NGramTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer instance) { + Instance = instance; } - private string? CustomTokenCharsValue { get; set; } - private int? MaxGramValue { get; set; } - private int? MinGramValue { get; set; } - private ICollection? TokenCharsValue { get; set; } - private string? VersionValue { get; set; } - - public NGramTokenizerDescriptor CustomTokenChars(string? customTokenChars) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NGramTokenizerDescriptor() { - CustomTokenCharsValue = customTokenChars; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NGramTokenizerDescriptor MaxGram(int? maxGram) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor CustomTokenChars(string? value) { - MaxGramValue = maxGram; - return Self; + Instance.CustomTokenChars = value; + return this; } - public NGramTokenizerDescriptor MinGram(int? minGram) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor MaxGram(int? value) { - MinGramValue = minGram; - return Self; + Instance.MaxGram = value; + return this; } - public NGramTokenizerDescriptor TokenChars(ICollection? tokenChars) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor MinGram(int? value) { - TokenCharsValue = tokenChars; - return Self; + Instance.MinGram = value; + return this; } - public NGramTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor TokenChars(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.TokenChars = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor TokenChars(params Elastic.Clients.Elasticsearch.Analysis.TokenChar[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CustomTokenCharsValue)) - { - writer.WritePropertyName("custom_token_chars"); - writer.WriteStringValue(CustomTokenCharsValue); - } - - if (MaxGramValue.HasValue) - { - writer.WritePropertyName("max_gram"); - writer.WriteNumberValue(MaxGramValue.Value); - } - - if (MinGramValue.HasValue) - { - writer.WritePropertyName("min_gram"); - writer.WriteNumberValue(MinGramValue.Value); - } + Instance.TokenChars = [.. values]; + return this; + } - if (TokenCharsValue is not null) - { - writer.WritePropertyName("token_chars"); - JsonSerializer.Serialize(writer, TokenCharsValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("ngram"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NGramTokenizer IBuildableDescriptor.Build() => new() - { - CustomTokenChars = CustomTokenCharsValue, - MaxGram = MaxGramValue, - MinGram = MinGramValue, - TokenChars = TokenCharsValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriAnalyzer.g.cs index 424a7e42934..81c4aae682e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriAnalyzer.g.cs @@ -17,106 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NoriAnalyzer : IAnalyzer +internal sealed partial class NoriAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("decompound_mode")] + private static readonly System.Text.Json.JsonEncodedText PropDecompoundMode = System.Text.Json.JsonEncodedText.Encode("decompound_mode"); + private static readonly System.Text.Json.JsonEncodedText PropStoptags = System.Text.Json.JsonEncodedText.Encode("stoptags"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionary = System.Text.Json.JsonEncodedText.Encode("user_dictionary"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDecompoundMode = default; + LocalJsonValue?> propStoptags = default; + LocalJsonValue propUserDictionary = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDecompoundMode.TryReadProperty(ref reader, options, PropDecompoundMode, null)) + { + continue; + } + + if (propStoptags.TryReadProperty(ref reader, options, PropStoptags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUserDictionary.TryReadProperty(ref reader, options, PropUserDictionary, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DecompoundMode = propDecompoundMode.Value, + Stoptags = propStoptags.Value, + UserDictionary = propUserDictionary.Value, +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDecompoundMode, value.DecompoundMode, null, null); + writer.WriteProperty(options, PropStoptags, value.Stoptags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUserDictionary, value.UserDictionary, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerConverter))] +public sealed partial class NoriAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public NoriAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public NoriAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NoriAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? DecompoundMode { get; set; } - [JsonInclude, JsonPropertyName("stoptags")] - public ICollection? Stoptags { get; set; } + public System.Collections.Generic.ICollection? Stoptags { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "nori"; - [JsonInclude, JsonPropertyName("user_dictionary")] public string? UserDictionary { get; set; } - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class NoriAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NoriAnalyzerDescriptor { - internal NoriAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer Instance { get; init; } - public NoriAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? DecompoundModeValue { get; set; } - private ICollection? StoptagsValue { get; set; } - private string? UserDictionaryValue { get; set; } - private string? VersionValue { get; set; } - - public NoriAnalyzerDescriptor DecompoundMode(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? decompoundMode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriAnalyzerDescriptor() { - DecompoundModeValue = decompoundMode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NoriAnalyzerDescriptor Stoptags(ICollection? stoptags) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer(Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor DecompoundMode(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? value) { - StoptagsValue = stoptags; - return Self; + Instance.DecompoundMode = value; + return this; } - public NoriAnalyzerDescriptor UserDictionary(string? userDictionary) + public Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor Stoptags(System.Collections.Generic.ICollection? value) { - UserDictionaryValue = userDictionary; - return Self; + Instance.Stoptags = value; + return this; } - public NoriAnalyzerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor Stoptags(params string[] values) { - VersionValue = version; - return Self; + Instance.Stoptags = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor UserDictionary(string? value) { - writer.WriteStartObject(); - if (DecompoundModeValue is not null) - { - writer.WritePropertyName("decompound_mode"); - JsonSerializer.Serialize(writer, DecompoundModeValue, options); - } - - if (StoptagsValue is not null) - { - writer.WritePropertyName("stoptags"); - JsonSerializer.Serialize(writer, StoptagsValue, options); - } + Instance.UserDictionary = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("nori"); - if (!string.IsNullOrEmpty(UserDictionaryValue)) - { - writer.WritePropertyName("user_dictionary"); - writer.WriteStringValue(UserDictionaryValue); - } + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NoriAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NoriAnalyzer IBuildableDescriptor.Build() => new() - { - DecompoundMode = DecompoundModeValue, - Stoptags = StoptagsValue, - UserDictionary = UserDictionaryValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs index f0fed1794fc..77948affb89 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriPartOfSpeechTokenFilter.g.cs @@ -17,74 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NoriPartOfSpeechTokenFilter : ITokenFilter +internal sealed partial class NoriPartOfSpeechTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stoptags")] - public ICollection? Stoptags { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropStoptags = System.Text.Json.JsonEncodedText.Encode("stoptags"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStoptags = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStoptags.TryReadProperty(ref reader, options, PropStoptags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stoptags = propStoptags.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStoptags, value.Stoptags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterConverter))] +public sealed partial class NoriPartOfSpeechTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public NoriPartOfSpeechTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public NoriPartOfSpeechTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stoptags { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "nori_part_of_speech"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class NoriPartOfSpeechTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NoriPartOfSpeechTokenFilterDescriptor { - internal NoriPartOfSpeechTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter Instance { get; init; } - public NoriPartOfSpeechTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriPartOfSpeechTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter instance) { + Instance = instance; } - private ICollection? StoptagsValue { get; set; } - private string? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriPartOfSpeechTokenFilterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public NoriPartOfSpeechTokenFilterDescriptor Stoptags(ICollection? stoptags) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor Stoptags(System.Collections.Generic.ICollection? value) { - StoptagsValue = stoptags; - return Self; + Instance.Stoptags = value; + return this; } - public NoriPartOfSpeechTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor Stoptags(params string[] values) { - VersionValue = version; - return Self; + Instance.Stoptags = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (StoptagsValue is not null) - { - writer.WritePropertyName("stoptags"); - JsonSerializer.Serialize(writer, StoptagsValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("nori_part_of_speech"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NoriPartOfSpeechTokenFilter IBuildableDescriptor.Build() => new() - { - Stoptags = StoptagsValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriTokenizer.g.cs index 0199a815584..57a94474a3b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NoriTokenizer.g.cs @@ -17,122 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NoriTokenizer : ITokenizer +internal sealed partial class NoriTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDecompoundMode = System.Text.Json.JsonEncodedText.Encode("decompound_mode"); + private static readonly System.Text.Json.JsonEncodedText PropDiscardPunctuation = System.Text.Json.JsonEncodedText.Encode("discard_punctuation"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionary = System.Text.Json.JsonEncodedText.Encode("user_dictionary"); + private static readonly System.Text.Json.JsonEncodedText PropUserDictionaryRules = System.Text.Json.JsonEncodedText.Encode("user_dictionary_rules"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDecompoundMode = default; + LocalJsonValue propDiscardPunctuation = default; + LocalJsonValue propUserDictionary = default; + LocalJsonValue?> propUserDictionaryRules = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDecompoundMode.TryReadProperty(ref reader, options, PropDecompoundMode, null)) + { + continue; + } + + if (propDiscardPunctuation.TryReadProperty(ref reader, options, PropDiscardPunctuation, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUserDictionary.TryReadProperty(ref reader, options, PropUserDictionary, null)) + { + continue; + } + + if (propUserDictionaryRules.TryReadProperty(ref reader, options, PropUserDictionaryRules, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DecompoundMode = propDecompoundMode.Value, + DiscardPunctuation = propDiscardPunctuation.Value, + UserDictionary = propUserDictionary.Value, + UserDictionaryRules = propUserDictionaryRules.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDecompoundMode, value.DecompoundMode, null, null); + writer.WriteProperty(options, PropDiscardPunctuation, value.DiscardPunctuation, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUserDictionary, value.UserDictionary, null, null); + writer.WriteProperty(options, PropUserDictionaryRules, value.UserDictionaryRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerConverter))] +public sealed partial class NoriTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("decompound_mode")] +#if NET7_0_OR_GREATER + public NoriTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public NoriTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NoriTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? DecompoundMode { get; set; } - [JsonInclude, JsonPropertyName("discard_punctuation")] public bool? DiscardPunctuation { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "nori_tokenizer"; - [JsonInclude, JsonPropertyName("user_dictionary")] public string? UserDictionary { get; set; } - [JsonInclude, JsonPropertyName("user_dictionary_rules")] - public ICollection? UserDictionaryRules { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.ICollection? UserDictionaryRules { get; set; } public string? Version { get; set; } } -public sealed partial class NoriTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NoriTokenizerDescriptor { - internal NoriTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer Instance { get; init; } - public NoriTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? DecompoundModeValue { get; set; } - private bool? DiscardPunctuationValue { get; set; } - private string? UserDictionaryValue { get; set; } - private ICollection? UserDictionaryRulesValue { get; set; } - private string? VersionValue { get; set; } - - public NoriTokenizerDescriptor DecompoundMode(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? decompoundMode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NoriTokenizerDescriptor() { - DecompoundModeValue = decompoundMode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NoriTokenizerDescriptor DiscardPunctuation(bool? discardPunctuation = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor DecompoundMode(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode? value) { - DiscardPunctuationValue = discardPunctuation; - return Self; + Instance.DecompoundMode = value; + return this; } - public NoriTokenizerDescriptor UserDictionary(string? userDictionary) + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor DiscardPunctuation(bool? value = true) { - UserDictionaryValue = userDictionary; - return Self; + Instance.DiscardPunctuation = value; + return this; } - public NoriTokenizerDescriptor UserDictionaryRules(ICollection? userDictionaryRules) + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor UserDictionary(string? value) { - UserDictionaryRulesValue = userDictionaryRules; - return Self; + Instance.UserDictionary = value; + return this; } - public NoriTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor UserDictionaryRules(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.UserDictionaryRules = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor UserDictionaryRules(params string[] values) { - writer.WriteStartObject(); - if (DecompoundModeValue is not null) - { - writer.WritePropertyName("decompound_mode"); - JsonSerializer.Serialize(writer, DecompoundModeValue, options); - } - - if (DiscardPunctuationValue.HasValue) - { - writer.WritePropertyName("discard_punctuation"); - writer.WriteBooleanValue(DiscardPunctuationValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("nori_tokenizer"); - if (!string.IsNullOrEmpty(UserDictionaryValue)) - { - writer.WritePropertyName("user_dictionary"); - writer.WriteStringValue(UserDictionaryValue); - } + Instance.UserDictionaryRules = [.. values]; + return this; + } - if (UserDictionaryRulesValue is not null) - { - writer.WritePropertyName("user_dictionary_rules"); - JsonSerializer.Serialize(writer, UserDictionaryRulesValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NoriTokenizer IBuildableDescriptor.Build() => new() - { - DecompoundMode = DecompoundModeValue, - DiscardPunctuation = DiscardPunctuationValue, - UserDictionary = UserDictionaryValue, - UserDictionaryRules = UserDictionaryRulesValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizer.g.cs new file mode 100644 index 00000000000..9cfc5af48be --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizer.g.cs @@ -0,0 +1,74 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Analysis; + +internal sealed partial class INormalizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.INormalizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = "custom"; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "custom" => reader.ReadValue(options, null), + "lowercase" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.INormalizer)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.INormalizer value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "custom": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer)value, null); + break; + case "lowercase": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.INormalizer)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.INormalizerConverter))] +public partial interface INormalizer +{ + public string Type { get; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs index e32a1cbe1ac..f35486224fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs @@ -17,115 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public partial class Normalizers : IsADictionary +internal sealed partial class NormalizersConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Analysis.Normalizers Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Analysis.Normalizers(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.Normalizers value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NormalizersConverter))] +public sealed partial class Normalizers : Elastic.Clients.Elasticsearch.IsADictionary { public Normalizers() { } - public Normalizers(IDictionary container) : base(container) + public Normalizers(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, INormalizer normalizer) => BackingDictionary.Add(Sanitize(name), normalizer); - public bool TryGetNormalizer(string name, [NotNullWhen(returnValue: true)] out INormalizer normalizer) => BackingDictionary.TryGetValue(Sanitize(name), out normalizer); + public void Add(string key, Elastic.Clients.Elasticsearch.Analysis.INormalizer value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetNormalizer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Analysis.INormalizer value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetNormalizer(string name, [NotNullWhen(returnValue: true)] out T? normalizer) where T : class, INormalizer + public bool TryGetNormalizer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, INormalizer { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - normalizer = finalValue; + value = finalValue; return true; } - normalizer = null; + value = null; return false; } } -public sealed partial class NormalizersDescriptor : IsADictionaryDescriptor +public readonly partial struct NormalizersDescriptor { - public NormalizersDescriptor() : base(new Normalizers()) + private readonly Elastic.Clients.Elasticsearch.Analysis.Normalizers _items = new(); + + private Elastic.Clients.Elasticsearch.Analysis.Normalizers Value => _items; + + public NormalizersDescriptor() { } - public NormalizersDescriptor(Normalizers normalizers) : base(normalizers ?? new Normalizers()) + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Custom(string key, Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer value) { + _items.Add(key, value); + return this; } - public NormalizersDescriptor Custom(string normalizerName) => AssignVariant(normalizerName, null); - public NormalizersDescriptor Custom(string normalizerName, Action configure) => AssignVariant(normalizerName, configure); - public NormalizersDescriptor Custom(string normalizerName, CustomNormalizer customNormalizer) => AssignVariant(normalizerName, customNormalizer); - public NormalizersDescriptor Lowercase(string normalizerName) => AssignVariant(normalizerName, null); - public NormalizersDescriptor Lowercase(string normalizerName, Action configure) => AssignVariant(normalizerName, configure); - public NormalizersDescriptor Lowercase(string normalizerName, LowercaseNormalizer lowercaseNormalizer) => AssignVariant(normalizerName, lowercaseNormalizer); -} + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Custom(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor.Build(null)); + return this; + } -internal sealed partial class NormalizerInterfaceConverter : JsonConverter -{ - public override INormalizer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Custom(string key, System.Action? action) { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CustomNormalizerDescriptor.Build(action)); + return this; + } - switch (type) - { - case "custom": - return JsonSerializer.Deserialize(ref reader, options); - case "lowercase": - return JsonSerializer.Deserialize(ref reader, options); - default: - return JsonSerializer.Deserialize(ref reader, options); - } + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Lowercase(string key, Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, INormalizer value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Lowercase(string key) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor.Build(null)); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor Lowercase(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizerDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.Normalizers Build(System.Action? action) + { + if (action is null) { - case "custom": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CustomNormalizer), options); - return; - case "lowercase": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseNormalizer), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.Analysis.Normalizers(); } - } -} -/// -/// Learn more about this API in the Elasticsearch documentation. -/// -[JsonConverter(typeof(NormalizerInterfaceConverter))] -public partial interface INormalizer -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NorwegianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NorwegianAnalyzer.g.cs index 873ae454f84..795524fcea7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NorwegianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/NorwegianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class NorwegianAnalyzer : IAnalyzer +internal sealed partial class NorwegianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerConverter))] +public sealed partial class NorwegianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public NorwegianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public NorwegianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "norwegian"; } -public sealed partial class NorwegianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NorwegianAnalyzerDescriptor { - internal NorwegianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NorwegianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer instance) + { + Instance = instance; + } - public NorwegianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NorwegianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor descriptor) => descriptor.Instance; - public NorwegianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public NorwegianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public NorwegianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("norwegian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.NorwegianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NorwegianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PathHierarchyTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PathHierarchyTokenizer.g.cs index 7101ee9d5a4..2c714b37347 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PathHierarchyTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PathHierarchyTokenizer.g.cs @@ -17,138 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PathHierarchyTokenizer : ITokenizer +internal sealed partial class PathHierarchyTokenizerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("buffer_size")] + private static readonly System.Text.Json.JsonEncodedText PropBufferSize = System.Text.Json.JsonEncodedText.Encode("buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropDelimiter = System.Text.Json.JsonEncodedText.Encode("delimiter"); + private static readonly System.Text.Json.JsonEncodedText PropReplacement = System.Text.Json.JsonEncodedText.Encode("replacement"); + private static readonly System.Text.Json.JsonEncodedText PropReverse = System.Text.Json.JsonEncodedText.Encode("reverse"); + private static readonly System.Text.Json.JsonEncodedText PropSkip = System.Text.Json.JsonEncodedText.Encode("skip"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBufferSize = default; + LocalJsonValue propDelimiter = default; + LocalJsonValue propReplacement = default; + LocalJsonValue propReverse = default; + LocalJsonValue propSkip = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBufferSize.TryReadProperty(ref reader, options, PropBufferSize, null)) + { + continue; + } + + if (propDelimiter.TryReadProperty(ref reader, options, PropDelimiter, null)) + { + continue; + } + + if (propReplacement.TryReadProperty(ref reader, options, PropReplacement, null)) + { + continue; + } + + if (propReverse.TryReadProperty(ref reader, options, PropReverse, null)) + { + continue; + } + + if (propSkip.TryReadProperty(ref reader, options, PropSkip, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BufferSize = propBufferSize.Value, + Delimiter = propDelimiter.Value, + Replacement = propReplacement.Value, + Reverse = propReverse.Value, + Skip = propSkip.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBufferSize, value.BufferSize, null, null); + writer.WriteProperty(options, PropDelimiter, value.Delimiter, null, null); + writer.WriteProperty(options, PropReplacement, value.Replacement, null, null); + writer.WriteProperty(options, PropReverse, value.Reverse, null, null); + writer.WriteProperty(options, PropSkip, value.Skip, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerConverter))] +public sealed partial class PathHierarchyTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer +{ +#if NET7_0_OR_GREATER + public PathHierarchyTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public PathHierarchyTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? BufferSize { get; set; } - [JsonInclude, JsonPropertyName("delimiter")] public string? Delimiter { get; set; } - [JsonInclude, JsonPropertyName("replacement")] public string? Replacement { get; set; } - [JsonInclude, JsonPropertyName("reverse")] public bool? Reverse { get; set; } - [JsonInclude, JsonPropertyName("skip")] public int? Skip { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "path_hierarchy"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PathHierarchyTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PathHierarchyTokenizerDescriptor { - internal PathHierarchyTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer Instance { get; init; } - public PathHierarchyTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PathHierarchyTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer instance) { + Instance = instance; } - private int? BufferSizeValue { get; set; } - private string? DelimiterValue { get; set; } - private string? ReplacementValue { get; set; } - private bool? ReverseValue { get; set; } - private int? SkipValue { get; set; } - private string? VersionValue { get; set; } - - public PathHierarchyTokenizerDescriptor BufferSize(int? bufferSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PathHierarchyTokenizerDescriptor() { - BufferSizeValue = bufferSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PathHierarchyTokenizerDescriptor Delimiter(string? delimiter) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor BufferSize(int? value) { - DelimiterValue = delimiter; - return Self; + Instance.BufferSize = value; + return this; } - public PathHierarchyTokenizerDescriptor Replacement(string? replacement) + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor Delimiter(string? value) { - ReplacementValue = replacement; - return Self; + Instance.Delimiter = value; + return this; } - public PathHierarchyTokenizerDescriptor Reverse(bool? reverse = true) + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor Replacement(string? value) { - ReverseValue = reverse; - return Self; + Instance.Replacement = value; + return this; } - public PathHierarchyTokenizerDescriptor Skip(int? skip) + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor Reverse(bool? value = true) { - SkipValue = skip; - return Self; + Instance.Reverse = value; + return this; } - public PathHierarchyTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor Skip(int? value) { - VersionValue = version; - return Self; + Instance.Skip = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (BufferSizeValue.HasValue) - { - writer.WritePropertyName("buffer_size"); - writer.WriteNumberValue(BufferSizeValue.Value); - } - - if (!string.IsNullOrEmpty(DelimiterValue)) - { - writer.WritePropertyName("delimiter"); - writer.WriteStringValue(DelimiterValue); - } - - if (!string.IsNullOrEmpty(ReplacementValue)) - { - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); - } - - if (ReverseValue.HasValue) - { - writer.WritePropertyName("reverse"); - writer.WriteBooleanValue(ReverseValue.Value); - } - - if (SkipValue.HasValue) - { - writer.WritePropertyName("skip"); - writer.WriteNumberValue(SkipValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("path_hierarchy"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PathHierarchyTokenizer IBuildableDescriptor.Build() => new() - { - BufferSize = BufferSizeValue, - Delimiter = DelimiterValue, - Replacement = ReplacementValue, - Reverse = ReverseValue, - Skip = SkipValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternAnalyzer.g.cs index 90b4f9f3e43..07e94ec3ae3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternAnalyzer.g.cs @@ -17,119 +17,278 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PatternAnalyzer : IAnalyzer +internal sealed partial class PatternAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("flags")] + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropLowercase = System.Text.Json.JsonEncodedText.Encode("lowercase"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFlags = default; + LocalJsonValue propLowercase = default; + LocalJsonValue propPattern = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } + + if (propLowercase.TryReadProperty(ref reader, options, PropLowercase, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Flags = propFlags.Value, + Lowercase = propLowercase.Value, + Pattern = propPattern.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value, +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropLowercase, value.Lowercase, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerConverter))] +public sealed partial class PatternAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public PatternAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public PatternAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PatternAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Java regular expression flags. Flags should be pipe-separated, eg "CASE_INSENSITIVE|COMMENTS". + /// + /// public string? Flags { get; set; } - [JsonInclude, JsonPropertyName("lowercase")] + + /// + /// + /// Should terms be lowercased or not. + /// Defaults to true. + /// + /// public bool? Lowercase { get; set; } - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("type")] + /// + /// + /// A Java regular expression. + /// Defaults to \W+. + /// + /// + public string? Pattern { get; set; } + + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public System.Collections.Generic.ICollection? Stopwords { get; set; } + + /// + /// + /// The path to a file containing stop words. + /// + /// + public string? StopwordsPath { get; set; } + public string Type => "pattern"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class PatternAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PatternAnalyzerDescriptor { - internal PatternAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer Instance { get; init; } - public PatternAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer instance) { + Instance = instance; } - private string? FlagsValue { get; set; } - private bool? LowercaseValue { get; set; } - private string PatternValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? VersionValue { get; set; } - - public PatternAnalyzerDescriptor Flags(string? flags) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternAnalyzerDescriptor() { - FlagsValue = flags; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PatternAnalyzerDescriptor Lowercase(bool? lowercase = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer(Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Java regular expression flags. Flags should be pipe-separated, eg "CASE_INSENSITIVE|COMMENTS". + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Flags(string? value) { - LowercaseValue = lowercase; - return Self; + Instance.Flags = value; + return this; } - public PatternAnalyzerDescriptor Pattern(string pattern) + /// + /// + /// Should terms be lowercased or not. + /// Defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Lowercase(bool? value = true) { - PatternValue = pattern; - return Self; + Instance.Lowercase = value; + return this; } - public PatternAnalyzerDescriptor Stopwords(ICollection? stopwords) + /// + /// + /// A Java regular expression. + /// Defaults to \W+. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Pattern(string? value) { - StopwordsValue = stopwords; - return Self; + Instance.Pattern = value; + return this; } - public PatternAnalyzerDescriptor Version(string? version) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } + Instance.Stopwords = [.. values]; + return this; + } - if (LowercaseValue.HasValue) - { - writer.WritePropertyName("lowercase"); - writer.WriteBooleanValue(LowercaseValue.Value); - } + /// + /// + /// The path to a file containing stop words. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("pattern"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PatternAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PatternAnalyzer IBuildableDescriptor.Build() => new() - { - Flags = FlagsValue, - Lowercase = LowercaseValue, - Pattern = PatternValue, - Stopwords = StopwordsValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs index 67f82afb636..000e014bc92 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternCaptureTokenFilter.g.cs @@ -17,86 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PatternCaptureTokenFilter : ITokenFilter +internal sealed partial class PatternCaptureTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("patterns")] - public ICollection Patterns { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] + private static readonly System.Text.Json.JsonEncodedText PropPatterns = System.Text.Json.JsonEncodedText.Encode("patterns"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPatterns = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPatterns.TryReadProperty(ref reader, options, PropPatterns, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Patterns = propPatterns.Value, + PreserveOriginal = propPreserveOriginal.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPatterns, value.Patterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterConverter))] +public sealed partial class PatternCaptureTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternCaptureTokenFilter(System.Collections.Generic.ICollection patterns) + { + Patterns = patterns; + } +#if NET7_0_OR_GREATER + public PatternCaptureTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PatternCaptureTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PatternCaptureTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Patterns { get; set; } public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "pattern_capture"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PatternCaptureTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PatternCaptureTokenFilterDescriptor { - internal PatternCaptureTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter Instance { get; init; } - public PatternCaptureTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternCaptureTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter instance) { + Instance = instance; } - private ICollection PatternsValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private string? VersionValue { get; set; } - - public PatternCaptureTokenFilterDescriptor Patterns(ICollection patterns) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternCaptureTokenFilterDescriptor() { - PatternsValue = patterns; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PatternCaptureTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor Patterns(System.Collections.Generic.ICollection value) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.Patterns = value; + return this; } - public PatternCaptureTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor Patterns(params string[] values) { - VersionValue = version; - return Self; + Instance.Patterns = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor PreserveOriginal(bool? value = true) { - writer.WriteStartObject(); - writer.WritePropertyName("patterns"); - JsonSerializer.Serialize(writer, PatternsValue, options); - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("pattern_capture"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.PreserveOriginal = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - PatternCaptureTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter Build(System.Action action) { - Patterns = PatternsValue, - PreserveOriginal = PreserveOriginalValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceCharFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceCharFilter.g.cs index cee6b17e03a..4a280b0615c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceCharFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceCharFilter.g.cs @@ -17,102 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PatternReplaceCharFilter : ICharFilter +internal sealed partial class PatternReplaceCharFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropReplacement = System.Text.Json.JsonEncodedText.Encode("replacement"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFlags = default; + LocalJsonValue propPattern = default; + LocalJsonValue propReplacement = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propReplacement.TryReadProperty(ref reader, options, PropReplacement, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Flags = propFlags.Value, + Pattern = propPattern.Value, + Replacement = propReplacement.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropReplacement, value.Replacement, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterConverter))] +public sealed partial class PatternReplaceCharFilter : Elastic.Clients.Elasticsearch.Analysis.ICharFilter { - [JsonInclude, JsonPropertyName("flags")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceCharFilter(string pattern) + { + Pattern = pattern; + } +#if NET7_0_OR_GREATER + public PatternReplaceCharFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PatternReplaceCharFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PatternReplaceCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Flags { get; set; } - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } - [JsonInclude, JsonPropertyName("replacement")] + public +#if NET7_0_OR_GREATER + required +#endif + string Pattern { get; set; } public string? Replacement { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "pattern_replace"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PatternReplaceCharFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PatternReplaceCharFilterDescriptor { - internal PatternReplaceCharFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter Instance { get; init; } - public PatternReplaceCharFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter instance) { + Instance = instance; } - private string? FlagsValue { get; set; } - private string PatternValue { get; set; } - private string? ReplacementValue { get; set; } - private string? VersionValue { get; set; } - - public PatternReplaceCharFilterDescriptor Flags(string? flags) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceCharFilterDescriptor() { - FlagsValue = flags; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PatternReplaceCharFilterDescriptor Pattern(string pattern) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor Flags(string? value) { - PatternValue = pattern; - return Self; + Instance.Flags = value; + return this; } - public PatternReplaceCharFilterDescriptor Replacement(string? replacement) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor Pattern(string value) { - ReplacementValue = replacement; - return Self; + Instance.Pattern = value; + return this; } - public PatternReplaceCharFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor Replacement(string? value) { - VersionValue = version; - return Self; + Instance.Replacement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (!string.IsNullOrEmpty(ReplacementValue)) - { - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("pattern_replace"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - PatternReplaceCharFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter Build(System.Action action) { - Flags = FlagsValue, - Pattern = PatternValue, - Replacement = ReplacementValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceCharFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs index 91d325d6ee8..9b0a47320e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternReplaceTokenFilter.g.cs @@ -17,118 +17,188 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PatternReplaceTokenFilter : ITokenFilter +internal sealed partial class PatternReplaceTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("all")] + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropReplacement = System.Text.Json.JsonEncodedText.Encode("replacement"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue propFlags = default; + LocalJsonValue propPattern = default; + LocalJsonValue propReplacement = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propReplacement.TryReadProperty(ref reader, options, PropReplacement, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + Flags = propFlags.Value, + Pattern = propPattern.Value, + Replacement = propReplacement.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropReplacement, value.Replacement, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterConverter))] +public sealed partial class PatternReplaceTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceTokenFilter(string pattern) + { + Pattern = pattern; + } +#if NET7_0_OR_GREATER + public PatternReplaceTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PatternReplaceTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PatternReplaceTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? All { get; set; } - [JsonInclude, JsonPropertyName("flags")] public string? Flags { get; set; } - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } - [JsonInclude, JsonPropertyName("replacement")] + public +#if NET7_0_OR_GREATER + required +#endif + string Pattern { get; set; } public string? Replacement { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "pattern_replace"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PatternReplaceTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PatternReplaceTokenFilterDescriptor { - internal PatternReplaceTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter Instance { get; init; } - public PatternReplaceTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter instance) { + Instance = instance; } - private bool? AllValue { get; set; } - private string? FlagsValue { get; set; } - private string PatternValue { get; set; } - private string? ReplacementValue { get; set; } - private string? VersionValue { get; set; } - - public PatternReplaceTokenFilterDescriptor All(bool? all = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternReplaceTokenFilterDescriptor() { - AllValue = all; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PatternReplaceTokenFilterDescriptor Flags(string? flags) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor All(bool? value = true) { - FlagsValue = flags; - return Self; + Instance.All = value; + return this; } - public PatternReplaceTokenFilterDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor Flags(string? value) { - PatternValue = pattern; - return Self; + Instance.Flags = value; + return this; } - public PatternReplaceTokenFilterDescriptor Replacement(string? replacement) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor Pattern(string value) { - ReplacementValue = replacement; - return Self; + Instance.Pattern = value; + return this; } - public PatternReplaceTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor Replacement(string? value) { - VersionValue = version; - return Self; + Instance.Replacement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (AllValue.HasValue) - { - writer.WritePropertyName("all"); - writer.WriteBooleanValue(AllValue.Value); - } - - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (!string.IsNullOrEmpty(ReplacementValue)) - { - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("pattern_replace"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } - - writer.WriteEndObject(); + Instance.Version = value; + return this; } - PatternReplaceTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter Build(System.Action action) { - All = AllValue, - Flags = FlagsValue, - Pattern = PatternValue, - Replacement = ReplacementValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternTokenizer.g.cs index 2f456ab9bfc..4a0d0254b00 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PatternTokenizer.g.cs @@ -17,106 +17,167 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PatternTokenizer : ITokenizer +internal sealed partial class PatternTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropGroup = System.Text.Json.JsonEncodedText.Encode("group"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFlags = default; + LocalJsonValue propGroup = default; + LocalJsonValue propPattern = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } + + if (propGroup.TryReadProperty(ref reader, options, PropGroup, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Flags = propFlags.Value, + Group = propGroup.Value, + Pattern = propPattern.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropGroup, value.Group, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerConverter))] +public sealed partial class PatternTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("flags")] +#if NET7_0_OR_GREATER + public PatternTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public PatternTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Flags { get; set; } - [JsonInclude, JsonPropertyName("group")] public int? Group { get; set; } - [JsonInclude, JsonPropertyName("pattern")] public string? Pattern { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "pattern"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PatternTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PatternTokenizerDescriptor { - internal PatternTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer Instance { get; init; } - public PatternTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer instance) { + Instance = instance; } - private string? FlagsValue { get; set; } - private int? GroupValue { get; set; } - private string? PatternValue { get; set; } - private string? VersionValue { get; set; } - - public PatternTokenizerDescriptor Flags(string? flags) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PatternTokenizerDescriptor() { - FlagsValue = flags; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PatternTokenizerDescriptor Group(int? group) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor Flags(string? value) { - GroupValue = group; - return Self; + Instance.Flags = value; + return this; } - public PatternTokenizerDescriptor Pattern(string? pattern) + public Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor Group(int? value) { - PatternValue = pattern; - return Self; + Instance.Group = value; + return this; } - public PatternTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor Pattern(string? value) { - VersionValue = version; - return Self; + Instance.Pattern = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } - - if (GroupValue.HasValue) - { - writer.WritePropertyName("group"); - writer.WriteNumberValue(GroupValue.Value); - } - - if (!string.IsNullOrEmpty(PatternValue)) - { - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("pattern"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PatternTokenizer IBuildableDescriptor.Build() => new() - { - Flags = FlagsValue, - Group = GroupValue, - Pattern = PatternValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PersianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PersianAnalyzer.g.cs index f889fe2782e..cefa2000670 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PersianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PersianAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PersianAnalyzer : IAnalyzer +internal sealed partial class PersianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerConverter))] +public sealed partial class PersianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public PersianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public PersianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PersianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "persian"; } -public sealed partial class PersianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PersianAnalyzerDescriptor { - internal PersianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer Instance { get; init; } - public PersianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PersianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PersianAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PersianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public PersianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("persian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PersianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PersianAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs index edc88d5e128..e46faac9f54 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs @@ -17,151 +17,226 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PhoneticTokenFilter : ITokenFilter +internal sealed partial class PhoneticTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("encoder")] - public Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder Encoder { get; set; } - [JsonInclude, JsonPropertyName("languageset")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage))] - public ICollection? Languageset { get; set; } - [JsonInclude, JsonPropertyName("max_code_len")] + private static readonly System.Text.Json.JsonEncodedText PropEncoder = System.Text.Json.JsonEncodedText.Encode("encoder"); + private static readonly System.Text.Json.JsonEncodedText PropLanguageset = System.Text.Json.JsonEncodedText.Encode("languageset"); + private static readonly System.Text.Json.JsonEncodedText PropMaxCodeLen = System.Text.Json.JsonEncodedText.Encode("max_code_len"); + private static readonly System.Text.Json.JsonEncodedText PropNameType = System.Text.Json.JsonEncodedText.Encode("name_type"); + private static readonly System.Text.Json.JsonEncodedText PropReplace = System.Text.Json.JsonEncodedText.Encode("replace"); + private static readonly System.Text.Json.JsonEncodedText PropRuleType = System.Text.Json.JsonEncodedText.Encode("rule_type"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEncoder = default; + LocalJsonValue?> propLanguageset = default; + LocalJsonValue propMaxCodeLen = default; + LocalJsonValue propNameType = default; + LocalJsonValue propReplace = default; + LocalJsonValue propRuleType = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEncoder.TryReadProperty(ref reader, options, PropEncoder, null)) + { + continue; + } + + if (propLanguageset.TryReadProperty(ref reader, options, PropLanguageset, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMaxCodeLen.TryReadProperty(ref reader, options, PropMaxCodeLen, null)) + { + continue; + } + + if (propNameType.TryReadProperty(ref reader, options, PropNameType, null)) + { + continue; + } + + if (propReplace.TryReadProperty(ref reader, options, PropReplace, null)) + { + continue; + } + + if (propRuleType.TryReadProperty(ref reader, options, PropRuleType, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Encoder = propEncoder.Value, + Languageset = propLanguageset.Value, + MaxCodeLen = propMaxCodeLen.Value, + NameType = propNameType.Value, + Replace = propReplace.Value, + RuleType = propRuleType.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEncoder, value.Encoder, null, null); + writer.WriteProperty(options, PropLanguageset, value.Languageset, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxCodeLen, value.MaxCodeLen, null, null); + writer.WriteProperty(options, PropNameType, value.NameType, null, null); + writer.WriteProperty(options, PropReplace, value.Replace, null, null); + writer.WriteProperty(options, PropRuleType, value.RuleType, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterConverter))] +public sealed partial class PhoneticTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder encoder) + { + Encoder = encoder; + } +#if NET7_0_OR_GREATER + public PhoneticTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhoneticTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder Encoder { get; set; } + public System.Collections.Generic.ICollection? Languageset { get; set; } public int? MaxCodeLen { get; set; } - [JsonInclude, JsonPropertyName("name_type")] public Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType? NameType { get; set; } - [JsonInclude, JsonPropertyName("replace")] public bool? Replace { get; set; } - [JsonInclude, JsonPropertyName("rule_type")] public Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType? RuleType { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "phonetic"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PhoneticTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PhoneticTokenFilterDescriptor { - internal PhoneticTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter Instance { get; init; } - public PhoneticTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhoneticTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder EncoderValue { get; set; } - private ICollection? LanguagesetValue { get; set; } - private int? MaxCodeLenValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType? NameTypeValue { get; set; } - private bool? ReplaceValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType? RuleTypeValue { get; set; } - private string? VersionValue { get; set; } - - public PhoneticTokenFilterDescriptor Encoder(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder encoder) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhoneticTokenFilterDescriptor() { - EncoderValue = encoder; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PhoneticTokenFilterDescriptor Languageset(ICollection? languageset) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor Encoder(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder value) { - LanguagesetValue = languageset; - return Self; + Instance.Encoder = value; + return this; } - public PhoneticTokenFilterDescriptor MaxCodeLen(int? maxCodeLen) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor Languageset(System.Collections.Generic.ICollection? value) { - MaxCodeLenValue = maxCodeLen; - return Self; + Instance.Languageset = value; + return this; } - public PhoneticTokenFilterDescriptor NameType(Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType? nameType) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor Languageset(params Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage[] values) { - NameTypeValue = nameType; - return Self; + Instance.Languageset = [.. values]; + return this; } - public PhoneticTokenFilterDescriptor Replace(bool? replace = true) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor MaxCodeLen(int? value) { - ReplaceValue = replace; - return Self; + Instance.MaxCodeLen = value; + return this; } - public PhoneticTokenFilterDescriptor RuleType(Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType? ruleType) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor NameType(Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType? value) { - RuleTypeValue = ruleType; - return Self; + Instance.NameType = value; + return this; } - public PhoneticTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor Replace(bool? value = true) { - VersionValue = version; - return Self; + Instance.Replace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor RuleType(Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType? value) { - writer.WriteStartObject(); - writer.WritePropertyName("encoder"); - JsonSerializer.Serialize(writer, EncoderValue, options); - if (LanguagesetValue is not null) - { - writer.WritePropertyName("languageset"); - SingleOrManySerializationHelper.Serialize(LanguagesetValue, writer, options); - } - - if (MaxCodeLenValue.HasValue) - { - writer.WritePropertyName("max_code_len"); - writer.WriteNumberValue(MaxCodeLenValue.Value); - } - - if (NameTypeValue is not null) - { - writer.WritePropertyName("name_type"); - JsonSerializer.Serialize(writer, NameTypeValue, options); - } - - if (ReplaceValue.HasValue) - { - writer.WritePropertyName("replace"); - writer.WriteBooleanValue(ReplaceValue.Value); - } - - if (RuleTypeValue is not null) - { - writer.WritePropertyName("rule_type"); - JsonSerializer.Serialize(writer, RuleTypeValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("phonetic"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.RuleType = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - PhoneticTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter Build(System.Action action) { - Encoder = EncoderValue, - Languageset = LanguagesetValue, - MaxCodeLen = MaxCodeLenValue, - NameType = NameTypeValue, - Replace = ReplaceValue, - RuleType = RuleTypeValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PorterStemTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PorterStemTokenFilter.g.cs index ed6517dd305..f5c3f3c3972 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PorterStemTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PorterStemTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PorterStemTokenFilter : ITokenFilter +internal sealed partial class PorterStemTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterConverter))] +public sealed partial class PorterStemTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public PorterStemTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public PorterStemTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "porter_stem"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class PorterStemTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PorterStemTokenFilterDescriptor { - internal PorterStemTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PorterStemTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter instance) + { + Instance = instance; + } - public PorterStemTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PorterStemTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor descriptor) => descriptor.Instance; - public PorterStemTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("porter_stem"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PorterStemTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PortugueseAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PortugueseAnalyzer.g.cs index 871b8aefa64..9e6ddac52d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PortugueseAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PortugueseAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PortugueseAnalyzer : IAnalyzer +internal sealed partial class PortugueseAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerConverter))] +public sealed partial class PortugueseAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public PortugueseAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public PortugueseAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "portuguese"; } -public sealed partial class PortugueseAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PortugueseAnalyzerDescriptor { - internal PortugueseAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PortugueseAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer instance) + { + Instance = instance; + } - public PortugueseAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PortugueseAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor descriptor) => descriptor.Instance; - public PortugueseAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public PortugueseAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public PortugueseAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("portuguese"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PortugueseAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PortugueseAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PredicateTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PredicateTokenFilter.g.cs index c00bb8ff94f..0459fff7e5e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PredicateTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PredicateTokenFilter.g.cs @@ -17,128 +17,152 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class PredicateTokenFilter : ITokenFilter +internal sealed partial class PredicateTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "predicate_token_filter"; + public override Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class PredicateTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal PredicateTokenFilterDescriptor(Action configure) => configure.Invoke(this); + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } - public PredicateTokenFilterDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? VersionValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public PredicateTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script script) - { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value, + Version = propVersion.Value + }; } - public PredicateTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter value, System.Text.Json.JsonSerializerOptions options) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); } +} - public PredicateTokenFilterDescriptor Script(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterConverter))] +public sealed partial class PredicateTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PredicateTokenFilter(Elastic.Clients.Elasticsearch.Script script) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Script = script; + } +#if NET7_0_OR_GREATER + public PredicateTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PredicateTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PredicateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - public PredicateTokenFilterDescriptor Version(string? version) + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } + + public string Type => "predicate_token_filter"; + + public string? Version { get; set; } +} + +public readonly partial struct PredicateTokenFilterDescriptor +{ + internal Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PredicateTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter instance) { - VersionValue = version; - return Self; + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PredicateTokenFilterDescriptor() { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + Instance = new Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WritePropertyName("type"); - writer.WriteStringValue("predicate_token_filter"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor descriptor) => descriptor.Instance; - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script value) + { + Instance.Script = value; + return this; } - private Elastic.Clients.Elasticsearch.Script BuildScript() + public Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor Script() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + public Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - return null; + public Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - PredicateTokenFilter IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter Build(System.Action action) { - Script = BuildScript(), - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RemoveDuplicatesTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RemoveDuplicatesTokenFilter.g.cs index e36c4de5ebc..2e58bf1d107 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RemoveDuplicatesTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RemoveDuplicatesTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class RemoveDuplicatesTokenFilter : ITokenFilter +internal sealed partial class RemoveDuplicatesTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterConverter))] +public sealed partial class RemoveDuplicatesTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public RemoveDuplicatesTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public RemoveDuplicatesTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "remove_duplicates"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class RemoveDuplicatesTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct RemoveDuplicatesTokenFilterDescriptor { - internal RemoveDuplicatesTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveDuplicatesTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter instance) + { + Instance = instance; + } - public RemoveDuplicatesTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveDuplicatesTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor descriptor) => descriptor.Instance; - public RemoveDuplicatesTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("remove_duplicates"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RemoveDuplicatesTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ReverseTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ReverseTokenFilter.g.cs index 75aebacd6ff..338ae854100 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ReverseTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ReverseTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ReverseTokenFilter : ITokenFilter +internal sealed partial class ReverseTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterConverter))] +public sealed partial class ReverseTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public ReverseTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public ReverseTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReverseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "reverse"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ReverseTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ReverseTokenFilterDescriptor { - internal ReverseTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter instance) + { + Instance = instance; + } - public ReverseTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReverseTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor descriptor) => descriptor.Instance; - public ReverseTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("reverse"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ReverseTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RomanianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RomanianAnalyzer.g.cs index b7b3a587660..17ec6eb815b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RomanianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RomanianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class RomanianAnalyzer : IAnalyzer +internal sealed partial class RomanianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerConverter))] +public sealed partial class RomanianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public RomanianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public RomanianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RomanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "romanian"; } -public sealed partial class RomanianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct RomanianAnalyzerDescriptor { - internal RomanianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RomanianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer instance) + { + Instance = instance; + } - public RomanianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RomanianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor descriptor) => descriptor.Instance; - public RomanianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public RomanianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public RomanianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("romanian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.RomanianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RomanianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RussianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RussianAnalyzer.g.cs index b1c60d62fb8..fdd1df6f189 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RussianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/RussianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class RussianAnalyzer : IAnalyzer +internal sealed partial class RussianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerConverter))] +public sealed partial class RussianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public RussianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public RussianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RussianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "russian"; } -public sealed partial class RussianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct RussianAnalyzerDescriptor { - internal RussianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RussianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer instance) + { + Instance = instance; + } - public RussianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RussianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor descriptor) => descriptor.Instance; - public RussianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public RussianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public RussianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("russian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.RussianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RussianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SerbianAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SerbianAnalyzer.g.cs index 26cfb2729d5..7c5943913c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SerbianAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SerbianAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SerbianAnalyzer : IAnalyzer +internal sealed partial class SerbianAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerConverter))] +public sealed partial class SerbianAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public SerbianAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SerbianAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SerbianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "serbian"; } -public sealed partial class SerbianAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SerbianAnalyzerDescriptor { - internal SerbianAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SerbianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer instance) + { + Instance = instance; + } - public SerbianAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SerbianAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor descriptor) => descriptor.Instance; - public SerbianAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public SerbianAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public SerbianAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("serbian"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SerbianAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SerbianAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ShingleTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ShingleTokenFilter.g.cs index 5ed8c0b8ff2..eb70093e574 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ShingleTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ShingleTokenFilter.g.cs @@ -17,154 +17,215 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ShingleTokenFilter : ITokenFilter +internal sealed partial class ShingleTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFillerToken = System.Text.Json.JsonEncodedText.Encode("filler_token"); + private static readonly System.Text.Json.JsonEncodedText PropMaxShingleSize = System.Text.Json.JsonEncodedText.Encode("max_shingle_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinShingleSize = System.Text.Json.JsonEncodedText.Encode("min_shingle_size"); + private static readonly System.Text.Json.JsonEncodedText PropOutputUnigrams = System.Text.Json.JsonEncodedText.Encode("output_unigrams"); + private static readonly System.Text.Json.JsonEncodedText PropOutputUnigramsIfNoShingles = System.Text.Json.JsonEncodedText.Encode("output_unigrams_if_no_shingles"); + private static readonly System.Text.Json.JsonEncodedText PropTokenSeparator = System.Text.Json.JsonEncodedText.Encode("token_separator"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFillerToken = default; + LocalJsonValue?> propMaxShingleSize = default; + LocalJsonValue?> propMinShingleSize = default; + LocalJsonValue propOutputUnigrams = default; + LocalJsonValue propOutputUnigramsIfNoShingles = default; + LocalJsonValue propTokenSeparator = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFillerToken.TryReadProperty(ref reader, options, PropFillerToken, null)) + { + continue; + } + + if (propMaxShingleSize.TryReadProperty(ref reader, options, PropMaxShingleSize, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propMinShingleSize.TryReadProperty(ref reader, options, PropMinShingleSize, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propOutputUnigrams.TryReadProperty(ref reader, options, PropOutputUnigrams, null)) + { + continue; + } + + if (propOutputUnigramsIfNoShingles.TryReadProperty(ref reader, options, PropOutputUnigramsIfNoShingles, null)) + { + continue; + } + + if (propTokenSeparator.TryReadProperty(ref reader, options, PropTokenSeparator, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FillerToken = propFillerToken.Value, + MaxShingleSize = propMaxShingleSize.Value, + MinShingleSize = propMinShingleSize.Value, + OutputUnigrams = propOutputUnigrams.Value, + OutputUnigramsIfNoShingles = propOutputUnigramsIfNoShingles.Value, + TokenSeparator = propTokenSeparator.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFillerToken, value.FillerToken, null, null); + writer.WriteProperty(options, PropMaxShingleSize, value.MaxShingleSize, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropMinShingleSize, value.MinShingleSize, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropOutputUnigrams, value.OutputUnigrams, null, null); + writer.WriteProperty(options, PropOutputUnigramsIfNoShingles, value.OutputUnigramsIfNoShingles, null, null); + writer.WriteProperty(options, PropTokenSeparator, value.TokenSeparator, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterConverter))] +public sealed partial class ShingleTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("filler_token")] +#if NET7_0_OR_GREATER + public ShingleTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShingleTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShingleTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? FillerToken { get; set; } - [JsonInclude, JsonPropertyName("max_shingle_size")] - public object? MaxShingleSize { get; set; } - [JsonInclude, JsonPropertyName("min_shingle_size")] - public object? MinShingleSize { get; set; } - [JsonInclude, JsonPropertyName("output_unigrams")] + public Elastic.Clients.Elasticsearch.Union? MaxShingleSize { get; set; } + public Elastic.Clients.Elasticsearch.Union? MinShingleSize { get; set; } public bool? OutputUnigrams { get; set; } - [JsonInclude, JsonPropertyName("output_unigrams_if_no_shingles")] public bool? OutputUnigramsIfNoShingles { get; set; } - [JsonInclude, JsonPropertyName("token_separator")] public string? TokenSeparator { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "shingle"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ShingleTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ShingleTokenFilterDescriptor { - internal ShingleTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter Instance { get; init; } - public ShingleTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShingleTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter instance) { + Instance = instance; } - private string? FillerTokenValue { get; set; } - private object? MaxShingleSizeValue { get; set; } - private object? MinShingleSizeValue { get; set; } - private bool? OutputUnigramsValue { get; set; } - private bool? OutputUnigramsIfNoShinglesValue { get; set; } - private string? TokenSeparatorValue { get; set; } - private string? VersionValue { get; set; } - - public ShingleTokenFilterDescriptor FillerToken(string? fillerToken) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShingleTokenFilterDescriptor() { - FillerTokenValue = fillerToken; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ShingleTokenFilterDescriptor MaxShingleSize(object? maxShingleSize) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor FillerToken(string? value) { - MaxShingleSizeValue = maxShingleSize; - return Self; + Instance.FillerToken = value; + return this; } - public ShingleTokenFilterDescriptor MinShingleSize(object? minShingleSize) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor MaxShingleSize(Elastic.Clients.Elasticsearch.Union? value) { - MinShingleSizeValue = minShingleSize; - return Self; + Instance.MaxShingleSize = value; + return this; } - public ShingleTokenFilterDescriptor OutputUnigrams(bool? outputUnigrams = true) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor MinShingleSize(Elastic.Clients.Elasticsearch.Union? value) { - OutputUnigramsValue = outputUnigrams; - return Self; + Instance.MinShingleSize = value; + return this; } - public ShingleTokenFilterDescriptor OutputUnigramsIfNoShingles(bool? outputUnigramsIfNoShingles = true) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor OutputUnigrams(bool? value = true) { - OutputUnigramsIfNoShinglesValue = outputUnigramsIfNoShingles; - return Self; + Instance.OutputUnigrams = value; + return this; } - public ShingleTokenFilterDescriptor TokenSeparator(string? tokenSeparator) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor OutputUnigramsIfNoShingles(bool? value = true) { - TokenSeparatorValue = tokenSeparator; - return Self; + Instance.OutputUnigramsIfNoShingles = value; + return this; } - public ShingleTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor TokenSeparator(string? value) { - VersionValue = version; - return Self; + Instance.TokenSeparator = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FillerTokenValue)) - { - writer.WritePropertyName("filler_token"); - writer.WriteStringValue(FillerTokenValue); - } - - if (MaxShingleSizeValue is not null) - { - writer.WritePropertyName("max_shingle_size"); - JsonSerializer.Serialize(writer, MaxShingleSizeValue, options); - } - - if (MinShingleSizeValue is not null) - { - writer.WritePropertyName("min_shingle_size"); - JsonSerializer.Serialize(writer, MinShingleSizeValue, options); - } - - if (OutputUnigramsValue.HasValue) - { - writer.WritePropertyName("output_unigrams"); - writer.WriteBooleanValue(OutputUnigramsValue.Value); - } - - if (OutputUnigramsIfNoShinglesValue.HasValue) - { - writer.WritePropertyName("output_unigrams_if_no_shingles"); - writer.WriteBooleanValue(OutputUnigramsIfNoShinglesValue.Value); - } - - if (!string.IsNullOrEmpty(TokenSeparatorValue)) - { - writer.WritePropertyName("token_separator"); - writer.WriteStringValue(TokenSeparatorValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("shingle"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ShingleTokenFilter IBuildableDescriptor.Build() => new() - { - FillerToken = FillerTokenValue, - MaxShingleSize = MaxShingleSizeValue, - MinShingleSize = MinShingleSizeValue, - OutputUnigrams = OutputUnigramsValue, - OutputUnigramsIfNoShingles = OutputUnigramsIfNoShinglesValue, - TokenSeparator = TokenSeparatorValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimpleAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimpleAnalyzer.g.cs index fc512489019..a6db86ae336 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimpleAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimpleAnalyzer.g.cs @@ -17,57 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SimpleAnalyzer : IAnalyzer +internal sealed partial class SimpleAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerConverter))] +public sealed partial class SimpleAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public SimpleAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SimpleAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimpleAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "simple"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class SimpleAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SimpleAnalyzerDescriptor { - internal SimpleAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer instance) + { + Instance = instance; + } - public SimpleAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor descriptor) => descriptor.Instance; - public SimpleAnalyzerDescriptor Version(string? version) + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("simple"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SimpleAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SimpleAnalyzer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternSplitTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternSplitTokenizer.g.cs index efb69c647af..b8e6780e346 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternSplitTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternSplitTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SimplePatternSplitTokenizer : ITokenizer +internal sealed partial class SimplePatternSplitTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPattern = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Pattern = propPattern.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerConverter))] +public sealed partial class SimplePatternSplitTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("pattern")] +#if NET7_0_OR_GREATER + public SimplePatternSplitTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SimplePatternSplitTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Pattern { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "simple_pattern_split"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class SimplePatternSplitTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SimplePatternSplitTokenizerDescriptor { - internal SimplePatternSplitTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer Instance { get; init; } - public SimplePatternSplitTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimplePatternSplitTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer instance) { + Instance = instance; } - private string? PatternValue { get; set; } - private string? VersionValue { get; set; } - - public SimplePatternSplitTokenizerDescriptor Pattern(string? pattern) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimplePatternSplitTokenizerDescriptor() { - PatternValue = pattern; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SimplePatternSplitTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor Pattern(string? value) { - VersionValue = version; - return Self; + Instance.Pattern = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(PatternValue)) - { - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("simple_pattern_split"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SimplePatternSplitTokenizer IBuildableDescriptor.Build() => new() - { - Pattern = PatternValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternTokenizer.g.cs index 164e4c4ffe3..8b5f067d5e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SimplePatternTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SimplePatternTokenizer : ITokenizer +internal sealed partial class SimplePatternTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPattern = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Pattern = propPattern.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerConverter))] +public sealed partial class SimplePatternTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("pattern")] +#if NET7_0_OR_GREATER + public SimplePatternTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SimplePatternTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Pattern { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "simple_pattern"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class SimplePatternTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SimplePatternTokenizerDescriptor { - internal SimplePatternTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer Instance { get; init; } - public SimplePatternTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimplePatternTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer instance) { + Instance = instance; } - private string? PatternValue { get; set; } - private string? VersionValue { get; set; } - - public SimplePatternTokenizerDescriptor Pattern(string? pattern) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimplePatternTokenizerDescriptor() { - PatternValue = pattern; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SimplePatternTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor Pattern(string? value) { - VersionValue = version; - return Self; + Instance.Pattern = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(PatternValue)) - { - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("simple_pattern"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SimplePatternTokenizer IBuildableDescriptor.Build() => new() - { - Pattern = PatternValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballAnalyzer.g.cs index f816558cc40..498f4096223 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballAnalyzer.g.cs @@ -17,87 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SnowballAnalyzer : IAnalyzer +internal sealed partial class SnowballAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("language")] - public Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage Language { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLanguage = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Language = propLanguage.Value, + Stopwords = propStopwords.Value, +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerConverter))] +public sealed partial class SnowballAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnowballAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage language) + { + Language = language; + } +#if NET7_0_OR_GREATER + public SnowballAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnowballAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnowballAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage Language { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "snowball"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class SnowballAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SnowballAnalyzerDescriptor { - internal SnowballAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer Instance { get; init; } - public SnowballAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnowballAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage LanguageValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? VersionValue { get; set; } - - public SnowballAnalyzerDescriptor Language(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage language) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnowballAnalyzerDescriptor() { - LanguageValue = language; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SnowballAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor Language(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage value) { - StopwordsValue = stopwords; - return Self; + Instance.Language = value; + return this; } - public SnowballAnalyzerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("language"); - JsonSerializer.Serialize(writer, LanguageValue, options); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("snowball"); - if (!string.IsNullOrEmpty(VersionValue)) - { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); - } + Instance.Stopwords = [.. values]; + return this; + } - writer.WriteEndObject(); + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor Version(string? value) + { + Instance.Version = value; + return this; } - SnowballAnalyzer IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer Build(System.Action action) { - Language = LanguageValue, - Stopwords = StopwordsValue, - Version = VersionValue - }; + var builder = new Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SnowballAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballTokenFilter.g.cs index 7c4107eeac3..02de5966157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SnowballTokenFilter.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SnowballTokenFilter : ITokenFilter +internal sealed partial class SnowballTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLanguage = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Language = propLanguage.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterConverter))] +public sealed partial class SnowballTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("language")] +#if NET7_0_OR_GREATER + public SnowballTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public SnowballTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnowballTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage? Language { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "snowball"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class SnowballTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SnowballTokenFilterDescriptor { - internal SnowballTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter Instance { get; init; } - public SnowballTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnowballTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage? LanguageValue { get; set; } - private string? VersionValue { get; set; } - - public SnowballTokenFilterDescriptor Language(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage? language) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnowballTokenFilterDescriptor() { - LanguageValue = language; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SnowballTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor Language(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage? value) { - VersionValue = version; - return Self; + Instance.Language = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (LanguageValue is not null) - { - writer.WritePropertyName("language"); - JsonSerializer.Serialize(writer, LanguageValue, options); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("snowball"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SnowballTokenFilter IBuildableDescriptor.Build() => new() - { - Language = LanguageValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SoraniAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SoraniAnalyzer.g.cs index af879465e82..b6e3369756b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SoraniAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SoraniAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SoraniAnalyzer : IAnalyzer +internal sealed partial class SoraniAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerConverter))] +public sealed partial class SoraniAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public SoraniAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SoraniAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SoraniAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "sorani"; } -public sealed partial class SoraniAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SoraniAnalyzerDescriptor { - internal SoraniAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SoraniAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer instance) + { + Instance = instance; + } - public SoraniAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SoraniAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor descriptor) => descriptor.Instance; - public SoraniAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public SoraniAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public SoraniAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("sorani"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SoraniAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SoraniAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SpanishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SpanishAnalyzer.g.cs index bba23e77175..8c0100ea2cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SpanishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SpanishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SpanishAnalyzer : IAnalyzer +internal sealed partial class SpanishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerConverter))] +public sealed partial class SpanishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public SpanishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SpanishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "spanish"; } -public sealed partial class SpanishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SpanishAnalyzerDescriptor { - internal SpanishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer instance) + { + Instance = instance; + } - public SpanishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor descriptor) => descriptor.Instance; - public SpanishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public SpanishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public SpanishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("spanish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SpanishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SpanishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardAnalyzer.g.cs index f89bcc5f1ec..46977284cb2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardAnalyzer.g.cs @@ -17,74 +17,198 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class StandardAnalyzer : IAnalyzer +internal sealed partial class StandardAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("max_token_length")] + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerConverter))] +public sealed partial class StandardAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public StandardAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public StandardAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StandardAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The maximum token length. If a token is seen that exceeds this length then it is split at max_token_length intervals. + /// Defaults to 255. + /// + /// public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("type")] + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public System.Collections.Generic.ICollection? Stopwords { get; set; } + + /// + /// + /// The path to a file containing stop words. + /// + /// + public string? StopwordsPath { get; set; } + public string Type => "standard"; } -public sealed partial class StandardAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StandardAnalyzerDescriptor { - internal StandardAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer instance) + { + Instance = instance; + } - public StandardAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? MaxTokenLengthValue { get; set; } - private ICollection? StopwordsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer(Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor descriptor) => descriptor.Instance; - public StandardAnalyzerDescriptor MaxTokenLength(int? maxTokenLength) + /// + /// + /// The maximum token length. If a token is seen that exceeds this length then it is split at max_token_length intervals. + /// Defaults to 255. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor MaxTokenLength(int? value) { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance.MaxTokenLength = value; + return this; } - public StandardAnalyzerDescriptor Stopwords(ICollection? stopwords) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) + /// + /// + /// The path to a file containing stop words. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); + return new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("standard"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StandardAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StandardAnalyzer IBuildableDescriptor.Build() => new() - { - MaxTokenLength = MaxTokenLengthValue, - Stopwords = StopwordsValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardTokenizer.g.cs index b7ef3635a6c..383d253a829 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StandardTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class StandardTokenizer : ITokenizer +internal sealed partial class StandardTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerConverter))] +public sealed partial class StandardTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("max_token_length")] +#if NET7_0_OR_GREATER + public StandardTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public StandardTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StandardTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "standard"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class StandardTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StandardTokenizerDescriptor { - internal StandardTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer Instance { get; init; } - public StandardTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer instance) { + Instance = instance; } - private int? MaxTokenLengthValue { get; set; } - private string? VersionValue { get; set; } - - public StandardTokenizerDescriptor MaxTokenLength(int? maxTokenLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardTokenizerDescriptor() { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public StandardTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor MaxTokenLength(int? value) { - VersionValue = version; - return Self; + Instance.MaxTokenLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("standard"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StandardTokenizer IBuildableDescriptor.Build() => new() - { - MaxTokenLength = MaxTokenLengthValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerOverrideTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerOverrideTokenFilter.g.cs index 51898a85c7d..bb1ac0733fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerOverrideTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerOverrideTokenFilter.g.cs @@ -17,90 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class StemmerOverrideTokenFilter : ITokenFilter +internal sealed partial class StemmerOverrideTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("rules")] - public ICollection? Rules { get; set; } - [JsonInclude, JsonPropertyName("rules_path")] + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + private static readonly System.Text.Json.JsonEncodedText PropRulesPath = System.Text.Json.JsonEncodedText.Encode("rules_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propRules = default; + LocalJsonValue propRulesPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRules.TryReadProperty(ref reader, options, PropRules, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRulesPath.TryReadProperty(ref reader, options, PropRulesPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Rules = propRules.Value, + RulesPath = propRulesPath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRules, value.Rules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRulesPath, value.RulesPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterConverter))] +public sealed partial class StemmerOverrideTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public StemmerOverrideTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public StemmerOverrideTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Rules { get; set; } public string? RulesPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "stemmer_override"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class StemmerOverrideTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StemmerOverrideTokenFilterDescriptor { - internal StemmerOverrideTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter Instance { get; init; } - public StemmerOverrideTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StemmerOverrideTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter instance) { + Instance = instance; } - private ICollection? RulesValue { get; set; } - private string? RulesPathValue { get; set; } - private string? VersionValue { get; set; } - - public StemmerOverrideTokenFilterDescriptor Rules(ICollection? rules) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StemmerOverrideTokenFilterDescriptor() { - RulesValue = rules; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public StemmerOverrideTokenFilterDescriptor RulesPath(string? rulesPath) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor Rules(System.Collections.Generic.ICollection? value) { - RulesPathValue = rulesPath; - return Self; + Instance.Rules = value; + return this; } - public StemmerOverrideTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor Rules(params string[] values) { - VersionValue = version; - return Self; + Instance.Rules = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor RulesPath(string? value) { - writer.WriteStartObject(); - if (RulesValue is not null) - { - writer.WritePropertyName("rules"); - JsonSerializer.Serialize(writer, RulesValue, options); - } + Instance.RulesPath = value; + return this; + } - if (!string.IsNullOrEmpty(RulesPathValue)) - { - writer.WritePropertyName("rules_path"); - writer.WriteStringValue(RulesPathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("stemmer_override"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StemmerOverrideTokenFilter IBuildableDescriptor.Build() => new() - { - Rules = RulesValue, - RulesPath = RulesPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerTokenFilter.g.cs index b92fc84576f..ac1c19813d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StemmerTokenFilter.g.cs @@ -17,69 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -internal sealed partial class StemmerTokenFilterConverter : JsonConverter +internal sealed partial class StemmerTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - public override StemmerTokenFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropLanguage1 = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new StemmerTokenFilter(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLanguage = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null) || propLanguage.TryReadProperty(ref reader, options, PropLanguage1, null)) { - var property = reader.GetString(); - if (property == "language" || property == "name") - { - variant.Language = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - variant.Version = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } - public override void Write(Utf8JsonWriter writer, StemmerTokenFilter value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Language)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(value.Language); + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - writer.WritePropertyName("type"); - writer.WriteStringValue("stemmer"); - if (!string.IsNullOrEmpty(value.Version)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("version"); - writer.WriteStringValue(value.Version); - } + Language = propLanguage.Value, + Version = propVersion.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(StemmerTokenFilterConverter))] -public sealed partial class StemmerTokenFilter : ITokenFilter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterConverter))] +public sealed partial class StemmerTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { +#if NET7_0_OR_GREATER + public StemmerTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public StemmerTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Language { get; set; } public string Type => "stemmer"; @@ -87,52 +106,47 @@ public sealed partial class StemmerTokenFilter : ITokenFilter public string? Version { get; set; } } -public sealed partial class StemmerTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StemmerTokenFilterDescriptor { - internal StemmerTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter Instance { get; init; } - public StemmerTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StemmerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter instance) { + Instance = instance; } - private string? LanguageValue { get; set; } - private string? VersionValue { get; set; } - - public StemmerTokenFilterDescriptor Language(string? language) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StemmerTokenFilterDescriptor() { - LanguageValue = language; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public StemmerTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor Language(string? value) { - VersionValue = version; - return Self; + Instance.Language = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(LanguageValue)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(LanguageValue); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("stemmer"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StemmerTokenFilter IBuildableDescriptor.Build() => new() - { - Language = LanguageValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopAnalyzer.g.cs index 9467b26a75b..a6f8832d796 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopAnalyzer.g.cs @@ -17,91 +17,193 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class StopAnalyzer : IAnalyzer +internal sealed partial class StopAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value, +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerConverter))] +public sealed partial class StopAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public StopAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public StopAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public System.Collections.Generic.ICollection? Stopwords { get; set; } + + /// + /// + /// The path to a file containing stop words. + /// + /// public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "stop"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class StopAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StopAnalyzerDescriptor { - internal StopAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer Instance { get; init; } - public StopAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } - private string? VersionValue { get; set; } - - public StopAnalyzerDescriptor Stopwords(ICollection? stopwords) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopAnalyzerDescriptor() { - StopwordsValue = stopwords; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public StopAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer(Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - public StopAnalyzerDescriptor Version(string? version) + /// + /// + /// A pre-defined stop words list like _english_ or an array containing a list of stop words. + /// Defaults to _none_. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor Stopwords(params string[] values) { - VersionValue = version; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The path to a file containing stop words. + /// + /// + public Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) - { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); - } + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("stop"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StopAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StopAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs index d1093f2ebef..80e715ac6f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/StopTokenFilter.g.cs @@ -17,123 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class StopTokenFilter : ITokenFilter +internal sealed partial class StopTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreCase = System.Text.Json.JsonEncodedText.Encode("ignore_case"); + private static readonly System.Text.Json.JsonEncodedText PropRemoveTrailing = System.Text.Json.JsonEncodedText.Encode("remove_trailing"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIgnoreCase = default; + LocalJsonValue propRemoveTrailing = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreCase.TryReadProperty(ref reader, options, PropIgnoreCase, null)) + { + continue; + } + + if (propRemoveTrailing.TryReadProperty(ref reader, options, PropRemoveTrailing, null)) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreCase = propIgnoreCase.Value, + RemoveTrailing = propRemoveTrailing.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreCase, value.IgnoreCase, null, null); + writer.WriteProperty(options, PropRemoveTrailing, value.RemoveTrailing, null, null); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterConverter))] +public sealed partial class StopTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("ignore_case")] +#if NET7_0_OR_GREATER + public StopTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public StopTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StopTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? IgnoreCase { get; set; } - [JsonInclude, JsonPropertyName("remove_trailing")] public bool? RemoveTrailing { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "stop"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class StopTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct StopTokenFilterDescriptor { - internal StopTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter Instance { get; init; } - public StopTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter instance) { + Instance = instance; } - private bool? IgnoreCaseValue { get; set; } - private bool? RemoveTrailingValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } - private string? VersionValue { get; set; } - - public StopTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopTokenFilterDescriptor() { - IgnoreCaseValue = ignoreCase; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public StopTokenFilterDescriptor RemoveTrailing(bool? removeTrailing = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor IgnoreCase(bool? value = true) { - RemoveTrailingValue = removeTrailing; - return Self; + Instance.IgnoreCase = value; + return this; } - public StopTokenFilterDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor RemoveTrailing(bool? value = true) { - StopwordsValue = stopwords; - return Self; + Instance.RemoveTrailing = value; + return this; } - public StopTokenFilterDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - public StopTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor Stopwords(params string[] values) { - VersionValue = version; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (IgnoreCaseValue.HasValue) - { - writer.WritePropertyName("ignore_case"); - writer.WriteBooleanValue(IgnoreCaseValue.Value); - } - - if (RemoveTrailingValue.HasValue) - { - writer.WritePropertyName("remove_trailing"); - writer.WriteBooleanValue(RemoveTrailingValue.Value); - } - - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) - { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("stop"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - StopTokenFilter IBuildableDescriptor.Build() => new() - { - IgnoreCase = IgnoreCaseValue, - RemoveTrailing = RemoveTrailingValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SwedishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SwedishAnalyzer.g.cs index 1158c84638a..722ce090351 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SwedishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SwedishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SwedishAnalyzer : IAnalyzer +internal sealed partial class SwedishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerConverter))] +public sealed partial class SwedishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public SwedishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public SwedishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SwedishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "swedish"; } -public sealed partial class SwedishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SwedishAnalyzerDescriptor { - internal SwedishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SwedishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer instance) + { + Instance = instance; + } - public SwedishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SwedishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor descriptor) => descriptor.Instance; - public SwedishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public SwedishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public SwedishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("swedish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SwedishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SwedishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymGraphTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymGraphTokenFilter.g.cs index 551835d00fa..3a1295e8449 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymGraphTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymGraphTokenFilter.g.cs @@ -17,186 +17,253 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SynonymGraphTokenFilter : ITokenFilter +internal sealed partial class SynonymGraphTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpand = System.Text.Json.JsonEncodedText.Encode("expand"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsPath = System.Text.Json.JsonEncodedText.Encode("synonyms_path"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsSet = System.Text.Json.JsonEncodedText.Encode("synonyms_set"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUpdateable = System.Text.Json.JsonEncodedText.Encode("updateable"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpand = default; + LocalJsonValue propFormat = default; + LocalJsonValue propLenient = default; + LocalJsonValue?> propSynonyms = default; + LocalJsonValue propSynonymsPath = default; + LocalJsonValue propSynonymsSet = default; + LocalJsonValue propTokenizer = default; + LocalJsonValue propUpdateable = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpand.TryReadProperty(ref reader, options, PropExpand, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSynonymsPath.TryReadProperty(ref reader, options, PropSynonymsPath, null)) + { + continue; + } + + if (propSynonymsSet.TryReadProperty(ref reader, options, PropSynonymsSet, null)) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUpdateable.TryReadProperty(ref reader, options, PropUpdateable, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expand = propExpand.Value, + Format = propFormat.Value, + Lenient = propLenient.Value, + Synonyms = propSynonyms.Value, + SynonymsPath = propSynonymsPath.Value, + SynonymsSet = propSynonymsSet.Value, + Tokenizer = propTokenizer.Value, + Updateable = propUpdateable.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpand, value.Expand, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSynonymsPath, value.SynonymsPath, null, null); + writer.WriteProperty(options, PropSynonymsSet, value.SynonymsSet, null, null); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUpdateable, value.Updateable, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterConverter))] +public sealed partial class SynonymGraphTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("expand")] +#if NET7_0_OR_GREATER + public SynonymGraphTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public SynonymGraphTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Expand { get; set; } - [JsonInclude, JsonPropertyName("format")] public Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? Format { get; set; } - [JsonInclude, JsonPropertyName("lenient")] public bool? Lenient { get; set; } - [JsonInclude, JsonPropertyName("synonyms")] - public ICollection? Synonyms { get; set; } - [JsonInclude, JsonPropertyName("synonyms_path")] + public System.Collections.Generic.ICollection? Synonyms { get; set; } public string? SynonymsPath { get; set; } - [JsonInclude, JsonPropertyName("synonyms_set")] public string? SynonymsSet { get; set; } - [JsonInclude, JsonPropertyName("tokenizer")] public string? Tokenizer { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "synonym_graph"; - [JsonInclude, JsonPropertyName("updateable")] public bool? Updateable { get; set; } - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class SynonymGraphTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SynonymGraphTokenFilterDescriptor { - internal SynonymGraphTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter Instance { get; init; } - public SynonymGraphTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymGraphTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter instance) { + Instance = instance; } - private bool? ExpandValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? FormatValue { get; set; } - private bool? LenientValue { get; set; } - private ICollection? SynonymsValue { get; set; } - private string? SynonymsPathValue { get; set; } - private string? SynonymsSetValue { get; set; } - private string? TokenizerValue { get; set; } - private bool? UpdateableValue { get; set; } - private string? VersionValue { get; set; } - - public SynonymGraphTokenFilterDescriptor Expand(bool? expand = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymGraphTokenFilterDescriptor() { - ExpandValue = expand; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SynonymGraphTokenFilterDescriptor Format(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? format) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Expand(bool? value = true) { - FormatValue = format; - return Self; + Instance.Expand = value; + return this; } - public SynonymGraphTokenFilterDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Format(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? value) { - LenientValue = lenient; - return Self; + Instance.Format = value; + return this; } - public SynonymGraphTokenFilterDescriptor Synonyms(ICollection? synonyms) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Lenient(bool? value = true) { - SynonymsValue = synonyms; - return Self; + Instance.Lenient = value; + return this; } - public SynonymGraphTokenFilterDescriptor SynonymsPath(string? synonymsPath) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Synonyms(System.Collections.Generic.ICollection? value) { - SynonymsPathValue = synonymsPath; - return Self; + Instance.Synonyms = value; + return this; } - public SynonymGraphTokenFilterDescriptor SynonymsSet(string? synonymsSet) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Synonyms(params string[] values) { - SynonymsSetValue = synonymsSet; - return Self; + Instance.Synonyms = [.. values]; + return this; } - public SynonymGraphTokenFilterDescriptor Tokenizer(string? tokenizer) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor SynonymsPath(string? value) { - TokenizerValue = tokenizer; - return Self; + Instance.SynonymsPath = value; + return this; } - public SynonymGraphTokenFilterDescriptor Updateable(bool? updateable = true) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor SynonymsSet(string? value) { - UpdateableValue = updateable; - return Self; + Instance.SynonymsSet = value; + return this; } - public SynonymGraphTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Tokenizer(string? value) { - VersionValue = version; - return Self; + Instance.Tokenizer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Updateable(bool? value = true) { - writer.WriteStartObject(); - if (ExpandValue.HasValue) - { - writer.WritePropertyName("expand"); - writer.WriteBooleanValue(ExpandValue.Value); - } - - if (FormatValue is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (SynonymsValue is not null) - { - writer.WritePropertyName("synonyms"); - JsonSerializer.Serialize(writer, SynonymsValue, options); - } - - if (!string.IsNullOrEmpty(SynonymsPathValue)) - { - writer.WritePropertyName("synonyms_path"); - writer.WriteStringValue(SynonymsPathValue); - } - - if (!string.IsNullOrEmpty(SynonymsSetValue)) - { - writer.WritePropertyName("synonyms_set"); - writer.WriteStringValue(SynonymsSetValue); - } - - if (!string.IsNullOrEmpty(TokenizerValue)) - { - writer.WritePropertyName("tokenizer"); - writer.WriteStringValue(TokenizerValue); - } + Instance.Updateable = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("synonym_graph"); - if (UpdateableValue.HasValue) - { - writer.WritePropertyName("updateable"); - writer.WriteBooleanValue(UpdateableValue.Value); - } + public Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SynonymGraphTokenFilter IBuildableDescriptor.Build() => new() - { - Expand = ExpandValue, - Format = FormatValue, - Lenient = LenientValue, - Synonyms = SynonymsValue, - SynonymsPath = SynonymsPathValue, - SynonymsSet = SynonymsSetValue, - Tokenizer = TokenizerValue, - Updateable = UpdateableValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymTokenFilter.g.cs index daf926adadd..20dfc4a649b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/SynonymTokenFilter.g.cs @@ -17,186 +17,253 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class SynonymTokenFilter : ITokenFilter +internal sealed partial class SynonymTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpand = System.Text.Json.JsonEncodedText.Encode("expand"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsPath = System.Text.Json.JsonEncodedText.Encode("synonyms_path"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsSet = System.Text.Json.JsonEncodedText.Encode("synonyms_set"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUpdateable = System.Text.Json.JsonEncodedText.Encode("updateable"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpand = default; + LocalJsonValue propFormat = default; + LocalJsonValue propLenient = default; + LocalJsonValue?> propSynonyms = default; + LocalJsonValue propSynonymsPath = default; + LocalJsonValue propSynonymsSet = default; + LocalJsonValue propTokenizer = default; + LocalJsonValue propUpdateable = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpand.TryReadProperty(ref reader, options, PropExpand, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSynonymsPath.TryReadProperty(ref reader, options, PropSynonymsPath, null)) + { + continue; + } + + if (propSynonymsSet.TryReadProperty(ref reader, options, PropSynonymsSet, null)) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUpdateable.TryReadProperty(ref reader, options, PropUpdateable, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expand = propExpand.Value, + Format = propFormat.Value, + Lenient = propLenient.Value, + Synonyms = propSynonyms.Value, + SynonymsPath = propSynonymsPath.Value, + SynonymsSet = propSynonymsSet.Value, + Tokenizer = propTokenizer.Value, + Updateable = propUpdateable.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpand, value.Expand, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSynonymsPath, value.SynonymsPath, null, null); + writer.WriteProperty(options, PropSynonymsSet, value.SynonymsSet, null, null); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUpdateable, value.Updateable, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterConverter))] +public sealed partial class SynonymTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("expand")] +#if NET7_0_OR_GREATER + public SynonymTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public SynonymTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SynonymTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Expand { get; set; } - [JsonInclude, JsonPropertyName("format")] public Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? Format { get; set; } - [JsonInclude, JsonPropertyName("lenient")] public bool? Lenient { get; set; } - [JsonInclude, JsonPropertyName("synonyms")] - public ICollection? Synonyms { get; set; } - [JsonInclude, JsonPropertyName("synonyms_path")] + public System.Collections.Generic.ICollection? Synonyms { get; set; } public string? SynonymsPath { get; set; } - [JsonInclude, JsonPropertyName("synonyms_set")] public string? SynonymsSet { get; set; } - [JsonInclude, JsonPropertyName("tokenizer")] public string? Tokenizer { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "synonym"; - [JsonInclude, JsonPropertyName("updateable")] public bool? Updateable { get; set; } - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class SynonymTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SynonymTokenFilterDescriptor { - internal SynonymTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter Instance { get; init; } - public SynonymTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter instance) { + Instance = instance; } - private bool? ExpandValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? FormatValue { get; set; } - private bool? LenientValue { get; set; } - private ICollection? SynonymsValue { get; set; } - private string? SynonymsPathValue { get; set; } - private string? SynonymsSetValue { get; set; } - private string? TokenizerValue { get; set; } - private bool? UpdateableValue { get; set; } - private string? VersionValue { get; set; } - - public SynonymTokenFilterDescriptor Expand(bool? expand = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymTokenFilterDescriptor() { - ExpandValue = expand; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SynonymTokenFilterDescriptor Format(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? format) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Expand(bool? value = true) { - FormatValue = format; - return Self; + Instance.Expand = value; + return this; } - public SynonymTokenFilterDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Format(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat? value) { - LenientValue = lenient; - return Self; + Instance.Format = value; + return this; } - public SynonymTokenFilterDescriptor Synonyms(ICollection? synonyms) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Lenient(bool? value = true) { - SynonymsValue = synonyms; - return Self; + Instance.Lenient = value; + return this; } - public SynonymTokenFilterDescriptor SynonymsPath(string? synonymsPath) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Synonyms(System.Collections.Generic.ICollection? value) { - SynonymsPathValue = synonymsPath; - return Self; + Instance.Synonyms = value; + return this; } - public SynonymTokenFilterDescriptor SynonymsSet(string? synonymsSet) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Synonyms(params string[] values) { - SynonymsSetValue = synonymsSet; - return Self; + Instance.Synonyms = [.. values]; + return this; } - public SynonymTokenFilterDescriptor Tokenizer(string? tokenizer) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor SynonymsPath(string? value) { - TokenizerValue = tokenizer; - return Self; + Instance.SynonymsPath = value; + return this; } - public SynonymTokenFilterDescriptor Updateable(bool? updateable = true) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor SynonymsSet(string? value) { - UpdateableValue = updateable; - return Self; + Instance.SynonymsSet = value; + return this; } - public SynonymTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Tokenizer(string? value) { - VersionValue = version; - return Self; + Instance.Tokenizer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Updateable(bool? value = true) { - writer.WriteStartObject(); - if (ExpandValue.HasValue) - { - writer.WritePropertyName("expand"); - writer.WriteBooleanValue(ExpandValue.Value); - } - - if (FormatValue is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (SynonymsValue is not null) - { - writer.WritePropertyName("synonyms"); - JsonSerializer.Serialize(writer, SynonymsValue, options); - } - - if (!string.IsNullOrEmpty(SynonymsPathValue)) - { - writer.WritePropertyName("synonyms_path"); - writer.WriteStringValue(SynonymsPathValue); - } - - if (!string.IsNullOrEmpty(SynonymsSetValue)) - { - writer.WritePropertyName("synonyms_set"); - writer.WriteStringValue(SynonymsSetValue); - } - - if (!string.IsNullOrEmpty(TokenizerValue)) - { - writer.WritePropertyName("tokenizer"); - writer.WriteStringValue(TokenizerValue); - } + Instance.Updateable = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("synonym"); - if (UpdateableValue.HasValue) - { - writer.WritePropertyName("updateable"); - writer.WriteBooleanValue(UpdateableValue.Value); - } + public Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SynonymTokenFilter IBuildableDescriptor.Build() => new() - { - Expand = ExpandValue, - Format = FormatValue, - Lenient = LenientValue, - Synonyms = SynonymsValue, - SynonymsPath = SynonymsPathValue, - SynonymsSet = SynonymsSetValue, - Tokenizer = TokenizerValue, - Updateable = UpdateableValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiAnalyzer.g.cs index 6ce5aceb322..f35191c1dce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiAnalyzer.g.cs @@ -17,74 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ThaiAnalyzer : IAnalyzer +internal sealed partial class ThaiAnalyzerConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerConverter))] +public sealed partial class ThaiAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer +{ +#if NET7_0_OR_GREATER + public ThaiAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ThaiAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ThaiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "thai"; } -public sealed partial class ThaiAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ThaiAnalyzerDescriptor { - internal ThaiAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer Instance { get; init; } - public ThaiAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ThaiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer instance) { + Instance = instance; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ThaiAnalyzerDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ThaiAnalyzerDescriptor Stopwords(ICollection? stopwords) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsValue = stopwords; - return Self; + Instance.Stopwords = value; + return this; } - public ThaiAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor Stopwords(params string[] values) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor StopwordsPath(string? value) { - writer.WriteStartObject(); - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("thai"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ThaiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ThaiAnalyzer IBuildableDescriptor.Build() => new() - { - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiTokenizer.g.cs index 5ed31691456..d4dfab85713 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/ThaiTokenizer.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class ThaiTokenizer : ITokenizer +internal sealed partial class ThaiTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerConverter))] +public sealed partial class ThaiTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public ThaiTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public ThaiTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ThaiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "thai"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class ThaiTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ThaiTokenizerDescriptor { - internal ThaiTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ThaiTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer instance) + { + Instance = instance; + } - public ThaiTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ThaiTokenizerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor descriptor) => descriptor.Instance; - public ThaiTokenizerDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("thai"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ThaiTokenizer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilter.g.cs new file mode 100644 index 00000000000..31b3e07b0df --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilter.g.cs @@ -0,0 +1,904 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Analysis; + +internal sealed partial class ITokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "asciifolding" => reader.ReadValue(options, null), + "common_grams" => reader.ReadValue(options, null), + "condition" => reader.ReadValue(options, null), + "delimited_payload" => reader.ReadValue(options, null), + "dictionary_decompounder" => reader.ReadValue(options, null), + "edge_ngram" => reader.ReadValue(options, null), + "elision" => reader.ReadValue(options, null), + "fingerprint" => reader.ReadValue(options, null), + "hunspell" => reader.ReadValue(options, null), + "hyphenation_decompounder" => reader.ReadValue(options, null), + "icu_collation" => reader.ReadValue(options, null), + "icu_folding" => reader.ReadValue(options, null), + "icu_normalizer" => reader.ReadValue(options, null), + "icu_transform" => reader.ReadValue(options, null), + "keep" => reader.ReadValue(options, null), + "keep_types" => reader.ReadValue(options, null), + "keyword_marker" => reader.ReadValue(options, null), + "kstem" => reader.ReadValue(options, null), + "kuromoji_part_of_speech" => reader.ReadValue(options, null), + "kuromoji_readingform" => reader.ReadValue(options, null), + "kuromoji_stemmer" => reader.ReadValue(options, null), + "length" => reader.ReadValue(options, null), + "limit" => reader.ReadValue(options, null), + "lowercase" => reader.ReadValue(options, null), + "multiplexer" => reader.ReadValue(options, null), + "ngram" => reader.ReadValue(options, null), + "nori_part_of_speech" => reader.ReadValue(options, null), + "pattern_capture" => reader.ReadValue(options, null), + "pattern_replace" => reader.ReadValue(options, null), + "phonetic" => reader.ReadValue(options, null), + "porter_stem" => reader.ReadValue(options, null), + "predicate_token_filter" => reader.ReadValue(options, null), + "remove_duplicates" => reader.ReadValue(options, null), + "reverse" => reader.ReadValue(options, null), + "shingle" => reader.ReadValue(options, null), + "snowball" => reader.ReadValue(options, null), + "stemmer" => reader.ReadValue(options, null), + "stemmer_override" => reader.ReadValue(options, null), + "stop" => reader.ReadValue(options, null), + "synonym" => reader.ReadValue(options, null), + "synonym_graph" => reader.ReadValue(options, null), + "trim" => reader.ReadValue(options, null), + "truncate" => reader.ReadValue(options, null), + "unique" => reader.ReadValue(options, null), + "uppercase" => reader.ReadValue(options, null), + "word_delimiter" => reader.ReadValue(options, null), + "word_delimiter_graph" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ITokenFilter)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ITokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "asciifolding": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter)value, null); + break; + case "common_grams": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter)value, null); + break; + case "condition": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter)value, null); + break; + case "delimited_payload": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter)value, null); + break; + case "dictionary_decompounder": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter)value, null); + break; + case "edge_ngram": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter)value, null); + break; + case "elision": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter)value, null); + break; + case "fingerprint": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter)value, null); + break; + case "hunspell": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter)value, null); + break; + case "hyphenation_decompounder": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter)value, null); + break; + case "icu_collation": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter)value, null); + break; + case "icu_folding": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter)value, null); + break; + case "icu_normalizer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter)value, null); + break; + case "icu_transform": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter)value, null); + break; + case "keep": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter)value, null); + break; + case "keep_types": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter)value, null); + break; + case "keyword_marker": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter)value, null); + break; + case "kstem": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter)value, null); + break; + case "kuromoji_part_of_speech": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter)value, null); + break; + case "kuromoji_readingform": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter)value, null); + break; + case "kuromoji_stemmer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter)value, null); + break; + case "length": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter)value, null); + break; + case "limit": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter)value, null); + break; + case "lowercase": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter)value, null); + break; + case "multiplexer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter)value, null); + break; + case "ngram": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter)value, null); + break; + case "nori_part_of_speech": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter)value, null); + break; + case "pattern_capture": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter)value, null); + break; + case "pattern_replace": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter)value, null); + break; + case "phonetic": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter)value, null); + break; + case "porter_stem": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter)value, null); + break; + case "predicate_token_filter": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter)value, null); + break; + case "remove_duplicates": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter)value, null); + break; + case "reverse": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter)value, null); + break; + case "shingle": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter)value, null); + break; + case "snowball": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter)value, null); + break; + case "stemmer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter)value, null); + break; + case "stemmer_override": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter)value, null); + break; + case "stop": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter)value, null); + break; + case "synonym": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter)value, null); + break; + case "synonym_graph": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter)value, null); + break; + case "trim": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter)value, null); + break; + case "truncate": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter)value, null); + break; + case "unique": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter)value, null); + break; + case "uppercase": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter)value, null); + break; + case "word_delimiter": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter)value, null); + break; + case "word_delimiter_graph": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ITokenFilter)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ITokenFilterConverter))] +public partial interface ITokenFilter +{ + public string Type { get; } +} + +public readonly partial struct TokenFilterFactory +{ + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter AsciiFolding(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter AsciiFolding() + { + return Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter AsciiFolding(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter CommonGrams(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter CommonGrams() + { + return Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter CommonGrams(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Condition(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Condition(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DelimitedPayload(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DelimitedPayload() + { + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DelimitedPayload(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DictionaryDecompounder(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DictionaryDecompounder() + { + return Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter DictionaryDecompounder(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter EdgeNGram(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter EdgeNGram() + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter EdgeNGram(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Elision(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Elision() + { + return Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Elision(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Fingerprint(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Fingerprint() + { + return Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Fingerprint(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Hunspell(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Hunspell(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter HyphenationDecompounder(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter HyphenationDecompounder() + { + return Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter HyphenationDecompounder(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuCollation(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuCollation() + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuCollation(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuFolding(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuFolding(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuNormalization(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuNormalization(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuTransform(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter IcuTransform(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepWords(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepWords() + { + return Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepWords(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepTypes(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepTypes() + { + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeepTypes(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeywordMarker(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeywordMarker() + { + return Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KeywordMarker(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KStem(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KStem() + { + return Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KStem(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiPartOfSpeech(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiPartOfSpeech(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiReadingForm(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiReadingForm(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiStemmer(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter KuromojiStemmer(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Length(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Length() + { + return Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Length(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter LimitTokenCount(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter LimitTokenCount() + { + return Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter LimitTokenCount(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Lowercase(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Lowercase() + { + return Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Lowercase(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Multiplexer(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Multiplexer(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NGram(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NGram() + { + return Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NGram(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NoriPartOfSpeech(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NoriPartOfSpeech() + { + return Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter NoriPartOfSpeech(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PatternCapture(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PatternCapture(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PatternReplace(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PatternReplace(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Phonetic(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Phonetic(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PorterStem(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PorterStem() + { + return Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter PorterStem(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Predicate(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Predicate(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter RemoveDuplicates(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter RemoveDuplicates() + { + return Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter RemoveDuplicates(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Reverse(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Reverse() + { + return Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Reverse(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Shingle(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Shingle() + { + return Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Shingle(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Snowball(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Snowball() + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Snowball(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stemmer(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stemmer() + { + return Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stemmer(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter StemmerOverride(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter StemmerOverride() + { + return Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter StemmerOverride(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stop(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stop() + { + return Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Stop(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Synonym(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Synonym() + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Synonym(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter SynonymGraph(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter SynonymGraph() + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter SynonymGraph(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Trim(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Trim() + { + return Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Trim(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Truncate(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Truncate() + { + return Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Truncate(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Unique(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Unique() + { + return Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Unique(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Uppercase(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Uppercase() + { + return Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Uppercase(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiter(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiter() + { + return Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiter(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiterGraph(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiterGraph() + { + return Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenFilter WordDelimiterGraph(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ITokenFilter Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.Analysis.TokenFilterFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilters.g.cs index 2fa0d6a043c..42e17fafcb0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TokenFilters.g.cs @@ -17,473 +17,840 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public partial class TokenFilters : IsADictionary +internal sealed partial class TokenFiltersConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Analysis.TokenFilters Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Analysis.TokenFilters(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TokenFilters value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TokenFiltersConverter))] +public sealed partial class TokenFilters : Elastic.Clients.Elasticsearch.IsADictionary { public TokenFilters() { } - public TokenFilters(IDictionary container) : base(container) + public TokenFilters(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, ITokenFilter tokenFilter) => BackingDictionary.Add(Sanitize(name), tokenFilter); - public bool TryGetTokenFilter(string name, [NotNullWhen(returnValue: true)] out ITokenFilter tokenFilter) => BackingDictionary.TryGetValue(Sanitize(name), out tokenFilter); + public void Add(string key, Elastic.Clients.Elasticsearch.Analysis.ITokenFilter value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetTokenFilter(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Analysis.ITokenFilter value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetTokenFilter(string name, [NotNullWhen(returnValue: true)] out T? tokenFilter) where T : class, ITokenFilter + public bool TryGetTokenFilter(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, ITokenFilter { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - tokenFilter = finalValue; + value = finalValue; return true; } - tokenFilter = null; + value = null; return false; } } -public sealed partial class TokenFiltersDescriptor : IsADictionaryDescriptor +public readonly partial struct TokenFiltersDescriptor { - public TokenFiltersDescriptor() : base(new TokenFilters()) - { - } - - public TokenFiltersDescriptor(TokenFilters tokenFilters) : base(tokenFilters ?? new TokenFilters()) - { - } - - public TokenFiltersDescriptor AsciiFolding(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor AsciiFolding(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor AsciiFolding(string tokenFilterName, AsciiFoldingTokenFilter asciiFoldingTokenFilter) => AssignVariant(tokenFilterName, asciiFoldingTokenFilter); - public TokenFiltersDescriptor CommonGrams(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor CommonGrams(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor CommonGrams(string tokenFilterName, CommonGramsTokenFilter commonGramsTokenFilter) => AssignVariant(tokenFilterName, commonGramsTokenFilter); - public TokenFiltersDescriptor Condition(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Condition(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Condition(string tokenFilterName, ConditionTokenFilter conditionTokenFilter) => AssignVariant(tokenFilterName, conditionTokenFilter); - public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName, DelimitedPayloadTokenFilter delimitedPayloadTokenFilter) => AssignVariant(tokenFilterName, delimitedPayloadTokenFilter); - public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName, DictionaryDecompounderTokenFilter dictionaryDecompounderTokenFilter) => AssignVariant(tokenFilterName, dictionaryDecompounderTokenFilter); - public TokenFiltersDescriptor EdgeNGram(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor EdgeNGram(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor EdgeNGram(string tokenFilterName, EdgeNGramTokenFilter edgeNGramTokenFilter) => AssignVariant(tokenFilterName, edgeNGramTokenFilter); - public TokenFiltersDescriptor Elision(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Elision(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Elision(string tokenFilterName, ElisionTokenFilter elisionTokenFilter) => AssignVariant(tokenFilterName, elisionTokenFilter); - public TokenFiltersDescriptor Fingerprint(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Fingerprint(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Fingerprint(string tokenFilterName, FingerprintTokenFilter fingerprintTokenFilter) => AssignVariant(tokenFilterName, fingerprintTokenFilter); - public TokenFiltersDescriptor Hunspell(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Hunspell(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Hunspell(string tokenFilterName, HunspellTokenFilter hunspellTokenFilter) => AssignVariant(tokenFilterName, hunspellTokenFilter); - public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName, HyphenationDecompounderTokenFilter hyphenationDecompounderTokenFilter) => AssignVariant(tokenFilterName, hyphenationDecompounderTokenFilter); - public TokenFiltersDescriptor IcuCollation(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor IcuCollation(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor IcuCollation(string tokenFilterName, IcuCollationTokenFilter icuCollationTokenFilter) => AssignVariant(tokenFilterName, icuCollationTokenFilter); - public TokenFiltersDescriptor IcuFolding(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor IcuFolding(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor IcuFolding(string tokenFilterName, IcuFoldingTokenFilter icuFoldingTokenFilter) => AssignVariant(tokenFilterName, icuFoldingTokenFilter); - public TokenFiltersDescriptor IcuNormalization(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor IcuNormalization(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor IcuNormalization(string tokenFilterName, IcuNormalizationTokenFilter icuNormalizationTokenFilter) => AssignVariant(tokenFilterName, icuNormalizationTokenFilter); - public TokenFiltersDescriptor IcuTransform(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor IcuTransform(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor IcuTransform(string tokenFilterName, IcuTransformTokenFilter icuTransformTokenFilter) => AssignVariant(tokenFilterName, icuTransformTokenFilter); - public TokenFiltersDescriptor KeepTypes(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KeepTypes(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KeepTypes(string tokenFilterName, KeepTypesTokenFilter keepTypesTokenFilter) => AssignVariant(tokenFilterName, keepTypesTokenFilter); - public TokenFiltersDescriptor KeepWords(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KeepWords(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KeepWords(string tokenFilterName, KeepWordsTokenFilter keepWordsTokenFilter) => AssignVariant(tokenFilterName, keepWordsTokenFilter); - public TokenFiltersDescriptor KeywordMarker(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KeywordMarker(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KeywordMarker(string tokenFilterName, KeywordMarkerTokenFilter keywordMarkerTokenFilter) => AssignVariant(tokenFilterName, keywordMarkerTokenFilter); - public TokenFiltersDescriptor KStem(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KStem(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KStem(string tokenFilterName, KStemTokenFilter kStemTokenFilter) => AssignVariant(tokenFilterName, kStemTokenFilter); - public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName, KuromojiPartOfSpeechTokenFilter kuromojiPartOfSpeechTokenFilter) => AssignVariant(tokenFilterName, kuromojiPartOfSpeechTokenFilter); - public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName, KuromojiReadingFormTokenFilter kuromojiReadingFormTokenFilter) => AssignVariant(tokenFilterName, kuromojiReadingFormTokenFilter); - public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName, KuromojiStemmerTokenFilter kuromojiStemmerTokenFilter) => AssignVariant(tokenFilterName, kuromojiStemmerTokenFilter); - public TokenFiltersDescriptor Length(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Length(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Length(string tokenFilterName, LengthTokenFilter lengthTokenFilter) => AssignVariant(tokenFilterName, lengthTokenFilter); - public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName, LimitTokenCountTokenFilter limitTokenCountTokenFilter) => AssignVariant(tokenFilterName, limitTokenCountTokenFilter); - public TokenFiltersDescriptor Lowercase(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Lowercase(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Lowercase(string tokenFilterName, LowercaseTokenFilter lowercaseTokenFilter) => AssignVariant(tokenFilterName, lowercaseTokenFilter); - public TokenFiltersDescriptor Multiplexer(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Multiplexer(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Multiplexer(string tokenFilterName, MultiplexerTokenFilter multiplexerTokenFilter) => AssignVariant(tokenFilterName, multiplexerTokenFilter); - public TokenFiltersDescriptor NGram(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor NGram(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor NGram(string tokenFilterName, NGramTokenFilter nGramTokenFilter) => AssignVariant(tokenFilterName, nGramTokenFilter); - public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName, NoriPartOfSpeechTokenFilter noriPartOfSpeechTokenFilter) => AssignVariant(tokenFilterName, noriPartOfSpeechTokenFilter); - public TokenFiltersDescriptor PatternCapture(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor PatternCapture(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor PatternCapture(string tokenFilterName, PatternCaptureTokenFilter patternCaptureTokenFilter) => AssignVariant(tokenFilterName, patternCaptureTokenFilter); - public TokenFiltersDescriptor PatternReplace(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor PatternReplace(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor PatternReplace(string tokenFilterName, PatternReplaceTokenFilter patternReplaceTokenFilter) => AssignVariant(tokenFilterName, patternReplaceTokenFilter); - public TokenFiltersDescriptor Phonetic(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Phonetic(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Phonetic(string tokenFilterName, PhoneticTokenFilter phoneticTokenFilter) => AssignVariant(tokenFilterName, phoneticTokenFilter); - public TokenFiltersDescriptor PorterStem(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor PorterStem(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor PorterStem(string tokenFilterName, PorterStemTokenFilter porterStemTokenFilter) => AssignVariant(tokenFilterName, porterStemTokenFilter); - public TokenFiltersDescriptor Predicate(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Predicate(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Predicate(string tokenFilterName, PredicateTokenFilter predicateTokenFilter) => AssignVariant(tokenFilterName, predicateTokenFilter); - public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName, RemoveDuplicatesTokenFilter removeDuplicatesTokenFilter) => AssignVariant(tokenFilterName, removeDuplicatesTokenFilter); - public TokenFiltersDescriptor Reverse(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Reverse(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Reverse(string tokenFilterName, ReverseTokenFilter reverseTokenFilter) => AssignVariant(tokenFilterName, reverseTokenFilter); - public TokenFiltersDescriptor Shingle(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Shingle(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Shingle(string tokenFilterName, ShingleTokenFilter shingleTokenFilter) => AssignVariant(tokenFilterName, shingleTokenFilter); - public TokenFiltersDescriptor Snowball(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Snowball(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Snowball(string tokenFilterName, SnowballTokenFilter snowballTokenFilter) => AssignVariant(tokenFilterName, snowballTokenFilter); - public TokenFiltersDescriptor StemmerOverride(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor StemmerOverride(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor StemmerOverride(string tokenFilterName, StemmerOverrideTokenFilter stemmerOverrideTokenFilter) => AssignVariant(tokenFilterName, stemmerOverrideTokenFilter); - public TokenFiltersDescriptor Stemmer(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Stemmer(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Stemmer(string tokenFilterName, StemmerTokenFilter stemmerTokenFilter) => AssignVariant(tokenFilterName, stemmerTokenFilter); - public TokenFiltersDescriptor Stop(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Stop(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Stop(string tokenFilterName, StopTokenFilter stopTokenFilter) => AssignVariant(tokenFilterName, stopTokenFilter); - public TokenFiltersDescriptor SynonymGraph(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor SynonymGraph(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor SynonymGraph(string tokenFilterName, SynonymGraphTokenFilter synonymGraphTokenFilter) => AssignVariant(tokenFilterName, synonymGraphTokenFilter); - public TokenFiltersDescriptor Synonym(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Synonym(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Synonym(string tokenFilterName, SynonymTokenFilter synonymTokenFilter) => AssignVariant(tokenFilterName, synonymTokenFilter); - public TokenFiltersDescriptor Trim(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Trim(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Trim(string tokenFilterName, TrimTokenFilter trimTokenFilter) => AssignVariant(tokenFilterName, trimTokenFilter); - public TokenFiltersDescriptor Truncate(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Truncate(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Truncate(string tokenFilterName, TruncateTokenFilter truncateTokenFilter) => AssignVariant(tokenFilterName, truncateTokenFilter); - public TokenFiltersDescriptor Unique(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Unique(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Unique(string tokenFilterName, UniqueTokenFilter uniqueTokenFilter) => AssignVariant(tokenFilterName, uniqueTokenFilter); - public TokenFiltersDescriptor Uppercase(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor Uppercase(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor Uppercase(string tokenFilterName, UppercaseTokenFilter uppercaseTokenFilter) => AssignVariant(tokenFilterName, uppercaseTokenFilter); - public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName, WordDelimiterGraphTokenFilter wordDelimiterGraphTokenFilter) => AssignVariant(tokenFilterName, wordDelimiterGraphTokenFilter); - public TokenFiltersDescriptor WordDelimiter(string tokenFilterName) => AssignVariant(tokenFilterName, null); - public TokenFiltersDescriptor WordDelimiter(string tokenFilterName, Action configure) => AssignVariant(tokenFilterName, configure); - public TokenFiltersDescriptor WordDelimiter(string tokenFilterName, WordDelimiterTokenFilter wordDelimiterTokenFilter) => AssignVariant(tokenFilterName, wordDelimiterTokenFilter); -} + private readonly Elastic.Clients.Elasticsearch.Analysis.TokenFilters _items = new(); -internal sealed partial class TokenFilterInterfaceConverter : JsonConverter -{ - public override ITokenFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private Elastic.Clients.Elasticsearch.Analysis.TokenFilters Value => _items; + + public TokenFiltersDescriptor() { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + } - switch (type) - { - case "asciifolding": - return JsonSerializer.Deserialize(ref reader, options); - case "common_grams": - return JsonSerializer.Deserialize(ref reader, options); - case "condition": - return JsonSerializer.Deserialize(ref reader, options); - case "delimited_payload": - return JsonSerializer.Deserialize(ref reader, options); - case "dictionary_decompounder": - return JsonSerializer.Deserialize(ref reader, options); - case "edge_ngram": - return JsonSerializer.Deserialize(ref reader, options); - case "elision": - return JsonSerializer.Deserialize(ref reader, options); - case "fingerprint": - return JsonSerializer.Deserialize(ref reader, options); - case "hunspell": - return JsonSerializer.Deserialize(ref reader, options); - case "hyphenation_decompounder": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_collation": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_folding": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_normalizer": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_transform": - return JsonSerializer.Deserialize(ref reader, options); - case "keep_types": - return JsonSerializer.Deserialize(ref reader, options); - case "keep": - return JsonSerializer.Deserialize(ref reader, options); - case "keyword_marker": - return JsonSerializer.Deserialize(ref reader, options); - case "kstem": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji_part_of_speech": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji_readingform": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji_stemmer": - return JsonSerializer.Deserialize(ref reader, options); - case "length": - return JsonSerializer.Deserialize(ref reader, options); - case "limit": - return JsonSerializer.Deserialize(ref reader, options); - case "lowercase": - return JsonSerializer.Deserialize(ref reader, options); - case "multiplexer": - return JsonSerializer.Deserialize(ref reader, options); - case "ngram": - return JsonSerializer.Deserialize(ref reader, options); - case "nori_part_of_speech": - return JsonSerializer.Deserialize(ref reader, options); - case "pattern_capture": - return JsonSerializer.Deserialize(ref reader, options); - case "pattern_replace": - return JsonSerializer.Deserialize(ref reader, options); - case "phonetic": - return JsonSerializer.Deserialize(ref reader, options); - case "porter_stem": - return JsonSerializer.Deserialize(ref reader, options); - case "predicate_token_filter": - return JsonSerializer.Deserialize(ref reader, options); - case "remove_duplicates": - return JsonSerializer.Deserialize(ref reader, options); - case "reverse": - return JsonSerializer.Deserialize(ref reader, options); - case "shingle": - return JsonSerializer.Deserialize(ref reader, options); - case "snowball": - return JsonSerializer.Deserialize(ref reader, options); - case "stemmer_override": - return JsonSerializer.Deserialize(ref reader, options); - case "stemmer": - return JsonSerializer.Deserialize(ref reader, options); - case "stop": - return JsonSerializer.Deserialize(ref reader, options); - case "synonym_graph": - return JsonSerializer.Deserialize(ref reader, options); - case "synonym": - return JsonSerializer.Deserialize(ref reader, options); - case "trim": - return JsonSerializer.Deserialize(ref reader, options); - case "truncate": - return JsonSerializer.Deserialize(ref reader, options); - case "unique": - return JsonSerializer.Deserialize(ref reader, options); - case "uppercase": - return JsonSerializer.Deserialize(ref reader, options); - case "word_delimiter_graph": - return JsonSerializer.Deserialize(ref reader, options); - case "word_delimiter": - return JsonSerializer.Deserialize(ref reader, options); - default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(ITokenFilter)); - return null; - } + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor AsciiFolding(string key, Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, ITokenFilter value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor AsciiFolding(string key) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor AsciiFolding(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor CommonGrams(string key, Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor CommonGrams(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor CommonGrams(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Condition(string key, Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Condition(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DelimitedPayload(string key, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DelimitedPayload(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DelimitedPayload(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DictionaryDecompounder(string key, Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DictionaryDecompounder(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor DictionaryDecompounder(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor EdgeNGram(string key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor EdgeNGram(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor.Build(null)); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor EdgeNGram(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Elision(string key, Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Elision(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Elision(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Fingerprint(string key, Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Fingerprint(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Fingerprint(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Hunspell(string key, Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Hunspell(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor HyphenationDecompounder(string key, Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor HyphenationDecompounder(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor HyphenationDecompounder(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuCollation(string key, Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuCollation(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuCollation(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuFolding(string key, Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuFolding(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuNormalization(string key, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuNormalization(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuTransform(string key, Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor IcuTransform(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepWords(string key, Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepWords(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepWords(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepTypes(string key, Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepTypes(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeepTypes(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeywordMarker(string key, Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeywordMarker(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KeywordMarker(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KStem(string key, Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KStem(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KStem(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiPartOfSpeech(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiPartOfSpeech(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiReadingForm(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiReadingForm(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiStemmer(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor KuromojiStemmer(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Length(string key, Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Length(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Length(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor LimitTokenCount(string key, Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor LimitTokenCount(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor LimitTokenCount(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Lowercase(string key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Lowercase(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Lowercase(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Multiplexer(string key, Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Multiplexer(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NGram(string key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NGram(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NGram(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NoriPartOfSpeech(string key, Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NoriPartOfSpeech(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor NoriPartOfSpeech(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PatternCapture(string key, Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PatternCapture(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PatternReplace(string key, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PatternReplace(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Phonetic(string key, Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Phonetic(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PorterStem(string key, Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PorterStem(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor PorterStem(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Predicate(string key, Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Predicate(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor RemoveDuplicates(string key, Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor RemoveDuplicates(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor RemoveDuplicates(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Reverse(string key, Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Reverse(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Reverse(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Shingle(string key, Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Shingle(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Shingle(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Snowball(string key, Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Snowball(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Snowball(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stemmer(string key, Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stemmer(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stemmer(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor StemmerOverride(string key, Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor StemmerOverride(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor StemmerOverride(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stop(string key, Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stop(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Stop(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StopTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Synonym(string key, Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Synonym(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Synonym(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor SynonymGraph(string key, Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor SynonymGraph(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor SynonymGraph(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Trim(string key, Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Trim(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Trim(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Truncate(string key, Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Truncate(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Truncate(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Unique(string key, Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Unique(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Unique(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Uppercase(string key, Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Uppercase(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor Uppercase(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiter(string key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiter(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiter(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiterGraph(string key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiterGraph(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor WordDelimiterGraph(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.TokenFilters Build(System.Action? action) + { + if (action is null) { - case "asciifolding": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.AsciiFoldingTokenFilter), options); - return; - case "common_grams": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CommonGramsTokenFilter), options); - return; - case "condition": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ConditionTokenFilter), options); - return; - case "delimited_payload": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadTokenFilter), options); - return; - case "dictionary_decompounder": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.DictionaryDecompounderTokenFilter), options); - return; - case "edge_ngram": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenFilter), options); - return; - case "elision": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ElisionTokenFilter), options); - return; - case "fingerprint": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.FingerprintTokenFilter), options); - return; - case "hunspell": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.HunspellTokenFilter), options); - return; - case "hyphenation_decompounder": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.HyphenationDecompounderTokenFilter), options); - return; - case "icu_collation": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationTokenFilter), options); - return; - case "icu_folding": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuFoldingTokenFilter), options); - return; - case "icu_normalizer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTokenFilter), options); - return; - case "icu_transform": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuTransformTokenFilter), options); - return; - case "keep_types": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KeepTypesTokenFilter), options); - return; - case "keep": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KeepWordsTokenFilter), options); - return; - case "keyword_marker": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordMarkerTokenFilter), options); - return; - case "kstem": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KStemTokenFilter), options); - return; - case "kuromoji_part_of_speech": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiPartOfSpeechTokenFilter), options); - return; - case "kuromoji_readingform": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiReadingFormTokenFilter), options); - return; - case "kuromoji_stemmer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiStemmerTokenFilter), options); - return; - case "length": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LengthTokenFilter), options); - return; - case "limit": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LimitTokenCountTokenFilter), options); - return; - case "lowercase": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenFilter), options); - return; - case "multiplexer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.MultiplexerTokenFilter), options); - return; - case "ngram": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NGramTokenFilter), options); - return; - case "nori_part_of_speech": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NoriPartOfSpeechTokenFilter), options); - return; - case "pattern_capture": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PatternCaptureTokenFilter), options); - return; - case "pattern_replace": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PatternReplaceTokenFilter), options); - return; - case "phonetic": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticTokenFilter), options); - return; - case "porter_stem": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PorterStemTokenFilter), options); - return; - case "predicate_token_filter": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PredicateTokenFilter), options); - return; - case "remove_duplicates": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.RemoveDuplicatesTokenFilter), options); - return; - case "reverse": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ReverseTokenFilter), options); - return; - case "shingle": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ShingleTokenFilter), options); - return; - case "snowball": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SnowballTokenFilter), options); - return; - case "stemmer_override": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StemmerOverrideTokenFilter), options); - return; - case "stemmer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StemmerTokenFilter), options); - return; - case "stop": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StopTokenFilter), options); - return; - case "synonym_graph": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SynonymGraphTokenFilter), options); - return; - case "synonym": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SynonymTokenFilter), options); - return; - case "trim": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter), options); - return; - case "truncate": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter), options); - return; - case "unique": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter), options); - return; - case "uppercase": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter), options); - return; - case "word_delimiter_graph": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter), options); - return; - case "word_delimiter": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.Analysis.TokenFilters(); } - } -} -[JsonConverter(typeof(TokenFilterInterfaceConverter))] -public partial interface ITokenFilter -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizer.g.cs new file mode 100644 index 00000000000..7c0cf471c9d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizer.g.cs @@ -0,0 +1,403 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Analysis; + +internal sealed partial class ITokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.ITokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "char_group" => reader.ReadValue(options, null), + "classic" => reader.ReadValue(options, null), + "edge_ngram" => reader.ReadValue(options, null), + "icu_tokenizer" => reader.ReadValue(options, null), + "keyword" => reader.ReadValue(options, null), + "kuromoji_tokenizer" => reader.ReadValue(options, null), + "letter" => reader.ReadValue(options, null), + "lowercase" => reader.ReadValue(options, null), + "ngram" => reader.ReadValue(options, null), + "nori_tokenizer" => reader.ReadValue(options, null), + "path_hierarchy" => reader.ReadValue(options, null), + "pattern" => reader.ReadValue(options, null), + "simple_pattern" => reader.ReadValue(options, null), + "simple_pattern_split" => reader.ReadValue(options, null), + "standard" => reader.ReadValue(options, null), + "thai" => reader.ReadValue(options, null), + "uax_url_email" => reader.ReadValue(options, null), + "whitespace" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ITokenizer)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.ITokenizer value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "char_group": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer)value, null); + break; + case "classic": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer)value, null); + break; + case "edge_ngram": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer)value, null); + break; + case "icu_tokenizer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer)value, null); + break; + case "keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer)value, null); + break; + case "kuromoji_tokenizer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer)value, null); + break; + case "letter": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer)value, null); + break; + case "lowercase": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer)value, null); + break; + case "ngram": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer)value, null); + break; + case "nori_tokenizer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer)value, null); + break; + case "path_hierarchy": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer)value, null); + break; + case "pattern": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer)value, null); + break; + case "simple_pattern": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer)value, null); + break; + case "simple_pattern_split": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer)value, null); + break; + case "standard": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer)value, null); + break; + case "thai": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer)value, null); + break; + case "uax_url_email": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer)value, null); + break; + case "whitespace": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Analysis.ITokenizer)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.ITokenizerConverter))] +public partial interface ITokenizer +{ + public string Type { get; } +} + +public readonly partial struct TokenizerFactory +{ + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer CharGroup(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer CharGroup(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Classic(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Classic() + { + return Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Classic(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer EdgeNGram(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer EdgeNGram() + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer EdgeNGram(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Icu(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Icu(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Keyword(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Keyword() + { + return Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Keyword(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Kuromoji(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Kuromoji(System.Action action) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Letter(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Letter() + { + return Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Letter(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Lowercase(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Lowercase() + { + return Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Lowercase(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer NGram(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer NGram() + { + return Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer NGram(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Nori(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Nori() + { + return Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Nori(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer PathHierarchy(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer PathHierarchy() + { + return Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer PathHierarchy(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Pattern(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Pattern() + { + return Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Pattern(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePattern(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePattern() + { + return Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePattern(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePatternSplit(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePatternSplit() + { + return Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer SimplePatternSplit(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Standard(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Standard() + { + return Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Standard(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Thai(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Thai() + { + return Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Thai(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer UaxEmailUrl(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer UaxEmailUrl() + { + return Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer UaxEmailUrl(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Whitespace(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Whitespace() + { + return Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Analysis.ITokenizer Whitespace(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.ITokenizer Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.Analysis.TokenizerFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizers.g.cs index 54f24ae2bab..98b7b77fc06 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Tokenizers.g.cs @@ -17,241 +17,378 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public partial class Tokenizers : IsADictionary +internal sealed partial class TokenizersConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Analysis.Tokenizers Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Analysis.Tokenizers(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.Tokenizers value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TokenizersConverter))] +public sealed partial class Tokenizers : Elastic.Clients.Elasticsearch.IsADictionary { public Tokenizers() { } - public Tokenizers(IDictionary container) : base(container) + public Tokenizers(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, ITokenizer tokenizer) => BackingDictionary.Add(Sanitize(name), tokenizer); - public bool TryGetTokenizer(string name, [NotNullWhen(returnValue: true)] out ITokenizer tokenizer) => BackingDictionary.TryGetValue(Sanitize(name), out tokenizer); + public void Add(string key, Elastic.Clients.Elasticsearch.Analysis.ITokenizer value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetTokenizer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Analysis.ITokenizer value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetTokenizer(string name, [NotNullWhen(returnValue: true)] out T? tokenizer) where T : class, ITokenizer + public bool TryGetTokenizer(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, ITokenizer { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - tokenizer = finalValue; + value = finalValue; return true; } - tokenizer = null; + value = null; return false; } } -public sealed partial class TokenizersDescriptor : IsADictionaryDescriptor +public readonly partial struct TokenizersDescriptor { - public TokenizersDescriptor() : base(new Tokenizers()) - { - } - - public TokenizersDescriptor(Tokenizers tokenizers) : base(tokenizers ?? new Tokenizers()) - { - } - - public TokenizersDescriptor CharGroup(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor CharGroup(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor CharGroup(string tokenizerName, CharGroupTokenizer charGroupTokenizer) => AssignVariant(tokenizerName, charGroupTokenizer); - public TokenizersDescriptor Classic(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Classic(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Classic(string tokenizerName, ClassicTokenizer classicTokenizer) => AssignVariant(tokenizerName, classicTokenizer); - public TokenizersDescriptor EdgeNGram(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor EdgeNGram(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor EdgeNGram(string tokenizerName, EdgeNGramTokenizer edgeNGramTokenizer) => AssignVariant(tokenizerName, edgeNGramTokenizer); - public TokenizersDescriptor Icu(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Icu(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Icu(string tokenizerName, IcuTokenizer icuTokenizer) => AssignVariant(tokenizerName, icuTokenizer); - public TokenizersDescriptor Keyword(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Keyword(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Keyword(string tokenizerName, KeywordTokenizer keywordTokenizer) => AssignVariant(tokenizerName, keywordTokenizer); - public TokenizersDescriptor Kuromoji(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Kuromoji(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Kuromoji(string tokenizerName, KuromojiTokenizer kuromojiTokenizer) => AssignVariant(tokenizerName, kuromojiTokenizer); - public TokenizersDescriptor Letter(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Letter(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Letter(string tokenizerName, LetterTokenizer letterTokenizer) => AssignVariant(tokenizerName, letterTokenizer); - public TokenizersDescriptor Lowercase(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Lowercase(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Lowercase(string tokenizerName, LowercaseTokenizer lowercaseTokenizer) => AssignVariant(tokenizerName, lowercaseTokenizer); - public TokenizersDescriptor NGram(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor NGram(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor NGram(string tokenizerName, NGramTokenizer nGramTokenizer) => AssignVariant(tokenizerName, nGramTokenizer); - public TokenizersDescriptor Nori(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Nori(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Nori(string tokenizerName, NoriTokenizer noriTokenizer) => AssignVariant(tokenizerName, noriTokenizer); - public TokenizersDescriptor PathHierarchy(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor PathHierarchy(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor PathHierarchy(string tokenizerName, PathHierarchyTokenizer pathHierarchyTokenizer) => AssignVariant(tokenizerName, pathHierarchyTokenizer); - public TokenizersDescriptor Pattern(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Pattern(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Pattern(string tokenizerName, PatternTokenizer patternTokenizer) => AssignVariant(tokenizerName, patternTokenizer); - public TokenizersDescriptor SimplePatternSplit(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor SimplePatternSplit(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor SimplePatternSplit(string tokenizerName, SimplePatternSplitTokenizer simplePatternSplitTokenizer) => AssignVariant(tokenizerName, simplePatternSplitTokenizer); - public TokenizersDescriptor SimplePattern(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor SimplePattern(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor SimplePattern(string tokenizerName, SimplePatternTokenizer simplePatternTokenizer) => AssignVariant(tokenizerName, simplePatternTokenizer); - public TokenizersDescriptor Standard(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Standard(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Standard(string tokenizerName, StandardTokenizer standardTokenizer) => AssignVariant(tokenizerName, standardTokenizer); - public TokenizersDescriptor Thai(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Thai(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Thai(string tokenizerName, ThaiTokenizer thaiTokenizer) => AssignVariant(tokenizerName, thaiTokenizer); - public TokenizersDescriptor UaxEmailUrl(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor UaxEmailUrl(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor UaxEmailUrl(string tokenizerName, UaxEmailUrlTokenizer uaxEmailUrlTokenizer) => AssignVariant(tokenizerName, uaxEmailUrlTokenizer); - public TokenizersDescriptor Whitespace(string tokenizerName) => AssignVariant(tokenizerName, null); - public TokenizersDescriptor Whitespace(string tokenizerName, Action configure) => AssignVariant(tokenizerName, configure); - public TokenizersDescriptor Whitespace(string tokenizerName, WhitespaceTokenizer whitespaceTokenizer) => AssignVariant(tokenizerName, whitespaceTokenizer); -} + private readonly Elastic.Clients.Elasticsearch.Analysis.Tokenizers _items = new(); -internal sealed partial class TokenizerInterfaceConverter : JsonConverter -{ - public override ITokenizer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private Elastic.Clients.Elasticsearch.Analysis.Tokenizers Value => _items; + + public TokenizersDescriptor() { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + } - switch (type) - { - case "char_group": - return JsonSerializer.Deserialize(ref reader, options); - case "classic": - return JsonSerializer.Deserialize(ref reader, options); - case "edge_ngram": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_tokenizer": - return JsonSerializer.Deserialize(ref reader, options); - case "keyword": - return JsonSerializer.Deserialize(ref reader, options); - case "kuromoji_tokenizer": - return JsonSerializer.Deserialize(ref reader, options); - case "letter": - return JsonSerializer.Deserialize(ref reader, options); - case "lowercase": - return JsonSerializer.Deserialize(ref reader, options); - case "ngram": - return JsonSerializer.Deserialize(ref reader, options); - case "nori_tokenizer": - return JsonSerializer.Deserialize(ref reader, options); - case "path_hierarchy": - return JsonSerializer.Deserialize(ref reader, options); - case "pattern": - return JsonSerializer.Deserialize(ref reader, options); - case "simple_pattern_split": - return JsonSerializer.Deserialize(ref reader, options); - case "simple_pattern": - return JsonSerializer.Deserialize(ref reader, options); - case "standard": - return JsonSerializer.Deserialize(ref reader, options); - case "thai": - return JsonSerializer.Deserialize(ref reader, options); - case "uax_url_email": - return JsonSerializer.Deserialize(ref reader, options); - case "whitespace": - return JsonSerializer.Deserialize(ref reader, options); - default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(ITokenizer)); - return null; - } + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor CharGroup(string key, Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, ITokenizer value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor CharGroup(string key, System.Action action) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Classic(string key, Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Classic(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Classic(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor EdgeNGram(string key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor EdgeNGram(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor EdgeNGram(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Icu(string key, Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Icu(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.IcuTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Keyword(string key, Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Keyword(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Keyword(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Kuromoji(string key, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Kuromoji(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Letter(string key, Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Letter(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Letter(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LetterTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Lowercase(string key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Lowercase(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Lowercase(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor NGram(string key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor NGram(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor NGram(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NGramTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Nori(string key, Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Nori(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Nori(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.NoriTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor PathHierarchy(string key, Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor PathHierarchy(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor PathHierarchy(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Pattern(string key, Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer value) + { + _items.Add(key, value); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Pattern(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Pattern(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.PatternTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePattern(string key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePattern(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePattern(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePatternSplit(string key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePatternSplit(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor SimplePatternSplit(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Standard(string key, Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Standard(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Standard(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.StandardTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Thai(string key, Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Thai(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Thai(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor UaxEmailUrl(string key, Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor UaxEmailUrl(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor UaxEmailUrl(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Whitespace(string key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Whitespace(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor Whitespace(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.Tokenizers Build(System.Action? action) + { + if (action is null) { - case "char_group": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.CharGroupTokenizer), options); - return; - case "classic": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ClassicTokenizer), options); - return; - case "edge_ngram": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramTokenizer), options); - return; - case "icu_tokenizer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.IcuTokenizer), options); - return; - case "keyword": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KeywordTokenizer), options); - return; - case "kuromoji_tokenizer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizer), options); - return; - case "letter": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LetterTokenizer), options); - return; - case "lowercase": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.LowercaseTokenizer), options); - return; - case "ngram": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NGramTokenizer), options); - return; - case "nori_tokenizer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.NoriTokenizer), options); - return; - case "path_hierarchy": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PathHierarchyTokenizer), options); - return; - case "pattern": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.PatternTokenizer), options); - return; - case "simple_pattern_split": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SimplePatternSplitTokenizer), options); - return; - case "simple_pattern": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.SimplePatternTokenizer), options); - return; - case "standard": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.StandardTokenizer), options); - return; - case "thai": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.ThaiTokenizer), options); - return; - case "uax_url_email": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer), options); - return; - case "whitespace": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.Analysis.Tokenizers(); } - } -} -[JsonConverter(typeof(TokenizerInterfaceConverter))] -public partial interface ITokenizer -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TrimTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TrimTokenFilter.g.cs index fea04ac53fc..ed16b0df320 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TrimTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TrimTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class TrimTokenFilter : ITokenFilter +internal sealed partial class TrimTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterConverter))] +public sealed partial class TrimTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public TrimTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public TrimTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrimTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "trim"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class TrimTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct TrimTokenFilterDescriptor { - internal TrimTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter instance) + { + Instance = instance; + } - public TrimTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter(Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor descriptor) => descriptor.Instance; - public TrimTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("trim"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.TrimTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - TrimTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs index ce8dda3b294..98c58010c7c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class TruncateTokenFilter : ITokenFilter +internal sealed partial class TruncateTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterConverter))] +public sealed partial class TruncateTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("length")] +#if NET7_0_OR_GREATER + public TruncateTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public TruncateTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TruncateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? Length { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "truncate"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class TruncateTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct TruncateTokenFilterDescriptor { - internal TruncateTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter Instance { get; init; } - public TruncateTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TruncateTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter instance) { + Instance = instance; } - private int? LengthValue { get; set; } - private string? VersionValue { get; set; } - - public TruncateTokenFilterDescriptor Length(int? length) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TruncateTokenFilterDescriptor() { - LengthValue = length; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TruncateTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter(Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor Length(int? value) { - VersionValue = version; - return Self; + Instance.Length = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (LengthValue.HasValue) - { - writer.WritePropertyName("length"); - writer.WriteNumberValue(LengthValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("truncate"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.TruncateTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - TruncateTokenFilter IBuildableDescriptor.Build() => new() - { - Length = LengthValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TurkishAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TurkishAnalyzer.g.cs index 29aad7e4200..65f1b5764ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TurkishAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TurkishAnalyzer.g.cs @@ -17,90 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class TurkishAnalyzer : IAnalyzer +internal sealed partial class TurkishAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStemExclusion = System.Text.Json.JsonEncodedText.Encode("stem_exclusion"); + private static readonly System.Text.Json.JsonEncodedText PropStopwords = System.Text.Json.JsonEncodedText.Encode("stopwords"); + private static readonly System.Text.Json.JsonEncodedText PropStopwordsPath = System.Text.Json.JsonEncodedText.Encode("stopwords_path"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStemExclusion = default; + LocalJsonValue?> propStopwords = default; + LocalJsonValue propStopwordsPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStemExclusion.TryReadProperty(ref reader, options, PropStemExclusion, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStopwords.TryReadProperty(ref reader, options, PropStopwords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propStopwordsPath.TryReadProperty(ref reader, options, PropStopwordsPath, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StemExclusion = propStemExclusion.Value, + Stopwords = propStopwords.Value, + StopwordsPath = propStopwordsPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStemExclusion, value.StemExclusion, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwords, value.Stopwords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStopwordsPath, value.StopwordsPath, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerConverter))] +public sealed partial class TurkishAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("stem_exclusion")] - public ICollection? StemExclusion { get; set; } - [JsonInclude, JsonPropertyName("stopwords")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Stopwords { get; set; } - [JsonInclude, JsonPropertyName("stopwords_path")] +#if NET7_0_OR_GREATER + public TurkishAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public TurkishAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TurkishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? StemExclusion { get; set; } + public System.Collections.Generic.ICollection? Stopwords { get; set; } public string? StopwordsPath { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "turkish"; } -public sealed partial class TurkishAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct TurkishAnalyzerDescriptor { - internal TurkishAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TurkishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer instance) + { + Instance = instance; + } - public TurkishAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TurkishAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? StemExclusionValue { get; set; } - private ICollection? StopwordsValue { get; set; } - private string? StopwordsPathValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer(Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor descriptor) => descriptor.Instance; - public TurkishAnalyzerDescriptor StemExclusion(ICollection? stemExclusion) + public Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor StemExclusion(System.Collections.Generic.ICollection? value) { - StemExclusionValue = stemExclusion; - return Self; + Instance.StemExclusion = value; + return this; } - public TurkishAnalyzerDescriptor Stopwords(ICollection? stopwords) + public Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor StemExclusion(params string[] values) { - StopwordsValue = stopwords; - return Self; + Instance.StemExclusion = [.. values]; + return this; } - public TurkishAnalyzerDescriptor StopwordsPath(string? stopwordsPath) + public Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor Stopwords(System.Collections.Generic.ICollection? value) { - StopwordsPathValue = stopwordsPath; - return Self; + Instance.Stopwords = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor Stopwords(params string[] values) { - writer.WriteStartObject(); - if (StemExclusionValue is not null) - { - writer.WritePropertyName("stem_exclusion"); - JsonSerializer.Serialize(writer, StemExclusionValue, options); - } + Instance.Stopwords = [.. values]; + return this; + } - if (StopwordsValue is not null) - { - writer.WritePropertyName("stopwords"); - SingleOrManySerializationHelper.Serialize(StopwordsValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor StopwordsPath(string? value) + { + Instance.StopwordsPath = value; + return this; + } - if (!string.IsNullOrEmpty(StopwordsPathValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("stopwords_path"); - writer.WriteStringValue(StopwordsPathValue); + return new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("turkish"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.TurkishAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - TurkishAnalyzer IBuildableDescriptor.Build() => new() - { - StemExclusion = StemExclusionValue, - Stopwords = StopwordsValue, - StopwordsPath = StopwordsPathValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UaxEmailUrlTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UaxEmailUrlTokenizer.g.cs index b51b1851ad8..5d37807ef6c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UaxEmailUrlTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UaxEmailUrlTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class UaxEmailUrlTokenizer : ITokenizer +internal sealed partial class UaxEmailUrlTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerConverter))] +public sealed partial class UaxEmailUrlTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("max_token_length")] +#if NET7_0_OR_GREATER + public UaxEmailUrlTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public UaxEmailUrlTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "uax_url_email"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class UaxEmailUrlTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct UaxEmailUrlTokenizerDescriptor { - internal UaxEmailUrlTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer Instance { get; init; } - public UaxEmailUrlTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UaxEmailUrlTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer instance) { + Instance = instance; } - private int? MaxTokenLengthValue { get; set; } - private string? VersionValue { get; set; } - - public UaxEmailUrlTokenizerDescriptor MaxTokenLength(int? maxTokenLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UaxEmailUrlTokenizerDescriptor() { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public UaxEmailUrlTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor MaxTokenLength(int? value) { - VersionValue = version; - return Self; + Instance.MaxTokenLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("uax_url_email"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.UaxEmailUrlTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - UaxEmailUrlTokenizer IBuildableDescriptor.Build() => new() - { - MaxTokenLength = MaxTokenLengthValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UniqueTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UniqueTokenFilter.g.cs index c6dc02b2ffa..15c8197fc03 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UniqueTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UniqueTokenFilter.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class UniqueTokenFilter : ITokenFilter +internal sealed partial class UniqueTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOnlyOnSamePosition = System.Text.Json.JsonEncodedText.Encode("only_on_same_position"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOnlyOnSamePosition = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOnlyOnSamePosition.TryReadProperty(ref reader, options, PropOnlyOnSamePosition, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + OnlyOnSamePosition = propOnlyOnSamePosition.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOnlyOnSamePosition, value.OnlyOnSamePosition, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterConverter))] +public sealed partial class UniqueTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("only_on_same_position")] +#if NET7_0_OR_GREATER + public UniqueTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public UniqueTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UniqueTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? OnlyOnSamePosition { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "unique"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class UniqueTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct UniqueTokenFilterDescriptor { - internal UniqueTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter Instance { get; init; } - public UniqueTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UniqueTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter instance) { + Instance = instance; } - private bool? OnlyOnSamePositionValue { get; set; } - private string? VersionValue { get; set; } - - public UniqueTokenFilterDescriptor OnlyOnSamePosition(bool? onlyOnSamePosition = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UniqueTokenFilterDescriptor() { - OnlyOnSamePositionValue = onlyOnSamePosition; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public UniqueTokenFilterDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter(Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor OnlyOnSamePosition(bool? value = true) { - VersionValue = version; - return Self; + Instance.OnlyOnSamePosition = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor Version(string? value) { - writer.WriteStartObject(); - if (OnlyOnSamePositionValue.HasValue) - { - writer.WritePropertyName("only_on_same_position"); - writer.WriteBooleanValue(OnlyOnSamePositionValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("unique"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.UniqueTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - UniqueTokenFilter IBuildableDescriptor.Build() => new() - { - OnlyOnSamePosition = OnlyOnSamePositionValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UppercaseTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UppercaseTokenFilter.g.cs index 225c48188d0..e5dd366e298 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UppercaseTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/UppercaseTokenFilter.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class UppercaseTokenFilter : ITokenFilter +internal sealed partial class UppercaseTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterConverter))] +public sealed partial class UppercaseTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public UppercaseTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public UppercaseTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "uppercase"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class UppercaseTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct UppercaseTokenFilterDescriptor { - internal UppercaseTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter instance) + { + Instance = instance; + } - public UppercaseTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseTokenFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor descriptor) => descriptor.Instance; - public UppercaseTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("uppercase"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.UppercaseTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - UppercaseTokenFilter IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceAnalyzer.g.cs index c7a4c564cc5..6f06290ca9c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceAnalyzer.g.cs @@ -17,57 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class WhitespaceAnalyzer : IAnalyzer +internal sealed partial class WhitespaceAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { +#pragma warning disable CS0618 + Version = propVersion.Value +#pragma warning restore CS0618 + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropVersion, value.Version, null, null) +#pragma warning restore CS0618 + ; + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerConverter))] +public sealed partial class WhitespaceAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public WhitespaceAnalyzer() + { + } +#endif +#if !NET7_0_OR_GREATER + public WhitespaceAnalyzer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "whitespace"; - [JsonInclude, JsonPropertyName("version")] + [System.Obsolete("Deprecated in '7.14.0'.")] public string? Version { get; set; } } -public sealed partial class WhitespaceAnalyzerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct WhitespaceAnalyzerDescriptor { - internal WhitespaceAnalyzerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WhitespaceAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer instance) + { + Instance = instance; + } - public WhitespaceAnalyzerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WhitespaceAnalyzerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor descriptor) => descriptor.Instance; - public WhitespaceAnalyzerDescriptor Version(string? version) + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor Version(string? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("whitespace"); - if (!string.IsNullOrEmpty(VersionValue)) + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.WhitespaceAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - WhitespaceAnalyzer IBuildableDescriptor.Build() => new() - { - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceTokenizer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceTokenizer.g.cs index 720ceb36794..40a72cbc562 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceTokenizer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WhitespaceTokenizer.g.cs @@ -17,74 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class WhitespaceTokenizer : ITokenizer +internal sealed partial class WhitespaceTokenizerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenLength = System.Text.Json.JsonEncodedText.Encode("max_token_length"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenLength = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenLength.TryReadProperty(ref reader, options, PropMaxTokenLength, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenLength = propMaxTokenLength.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenLength, value.MaxTokenLength, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerConverter))] +public sealed partial class WhitespaceTokenizer : Elastic.Clients.Elasticsearch.Analysis.ITokenizer { - [JsonInclude, JsonPropertyName("max_token_length")] +#if NET7_0_OR_GREATER + public WhitespaceTokenizer() + { + } +#endif +#if !NET7_0_OR_GREATER + public WhitespaceTokenizer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenLength { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "whitespace"; - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class WhitespaceTokenizerDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct WhitespaceTokenizerDescriptor { - internal WhitespaceTokenizerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer Instance { get; init; } - public WhitespaceTokenizerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WhitespaceTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer instance) { + Instance = instance; } - private int? MaxTokenLengthValue { get; set; } - private string? VersionValue { get; set; } - - public WhitespaceTokenizerDescriptor MaxTokenLength(int? maxTokenLength) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WhitespaceTokenizerDescriptor() { - MaxTokenLengthValue = maxTokenLength; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public WhitespaceTokenizerDescriptor Version(string? version) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer instance) => new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor MaxTokenLength(int? value) { - VersionValue = version; - return Self; + Instance.MaxTokenLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor Version(string? value) { - writer.WriteStartObject(); - if (MaxTokenLengthValue.HasValue) - { - writer.WritePropertyName("max_token_length"); - writer.WriteNumberValue(MaxTokenLengthValue.Value); - } + Instance.Version = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("whitespace"); - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.WhitespaceTokenizer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - WhitespaceTokenizer IBuildableDescriptor.Build() => new() - { - MaxTokenLength = MaxTokenLengthValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterGraphTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterGraphTokenFilter.g.cs index fdf70c03155..abfd2353856 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterGraphTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterGraphTokenFilter.g.cs @@ -17,298 +17,371 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class WordDelimiterGraphTokenFilter : ITokenFilter +internal sealed partial class WordDelimiterGraphTokenFilterConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("adjust_offsets")] + private static readonly System.Text.Json.JsonEncodedText PropAdjustOffsets = System.Text.Json.JsonEncodedText.Encode("adjust_offsets"); + private static readonly System.Text.Json.JsonEncodedText PropCatenateAll = System.Text.Json.JsonEncodedText.Encode("catenate_all"); + private static readonly System.Text.Json.JsonEncodedText PropCatenateNumbers = System.Text.Json.JsonEncodedText.Encode("catenate_numbers"); + private static readonly System.Text.Json.JsonEncodedText PropCatenateWords = System.Text.Json.JsonEncodedText.Encode("catenate_words"); + private static readonly System.Text.Json.JsonEncodedText PropGenerateNumberParts = System.Text.Json.JsonEncodedText.Encode("generate_number_parts"); + private static readonly System.Text.Json.JsonEncodedText PropGenerateWordParts = System.Text.Json.JsonEncodedText.Encode("generate_word_parts"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreKeywords = System.Text.Json.JsonEncodedText.Encode("ignore_keywords"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropProtectedWords = System.Text.Json.JsonEncodedText.Encode("protected_words"); + private static readonly System.Text.Json.JsonEncodedText PropProtectedWordsPath = System.Text.Json.JsonEncodedText.Encode("protected_words_path"); + private static readonly System.Text.Json.JsonEncodedText PropSplitOnCaseChange = System.Text.Json.JsonEncodedText.Encode("split_on_case_change"); + private static readonly System.Text.Json.JsonEncodedText PropSplitOnNumerics = System.Text.Json.JsonEncodedText.Encode("split_on_numerics"); + private static readonly System.Text.Json.JsonEncodedText PropStemEnglishPossessive = System.Text.Json.JsonEncodedText.Encode("stem_english_possessive"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropTypeTable = System.Text.Json.JsonEncodedText.Encode("type_table"); + private static readonly System.Text.Json.JsonEncodedText PropTypeTablePath = System.Text.Json.JsonEncodedText.Encode("type_table_path"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdjustOffsets = default; + LocalJsonValue propCatenateAll = default; + LocalJsonValue propCatenateNumbers = default; + LocalJsonValue propCatenateWords = default; + LocalJsonValue propGenerateNumberParts = default; + LocalJsonValue propGenerateWordParts = default; + LocalJsonValue propIgnoreKeywords = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue?> propProtectedWords = default; + LocalJsonValue propProtectedWordsPath = default; + LocalJsonValue propSplitOnCaseChange = default; + LocalJsonValue propSplitOnNumerics = default; + LocalJsonValue propStemEnglishPossessive = default; + LocalJsonValue?> propTypeTable = default; + LocalJsonValue propTypeTablePath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdjustOffsets.TryReadProperty(ref reader, options, PropAdjustOffsets, null)) + { + continue; + } + + if (propCatenateAll.TryReadProperty(ref reader, options, PropCatenateAll, null)) + { + continue; + } + + if (propCatenateNumbers.TryReadProperty(ref reader, options, PropCatenateNumbers, null)) + { + continue; + } + + if (propCatenateWords.TryReadProperty(ref reader, options, PropCatenateWords, null)) + { + continue; + } + + if (propGenerateNumberParts.TryReadProperty(ref reader, options, PropGenerateNumberParts, null)) + { + continue; + } + + if (propGenerateWordParts.TryReadProperty(ref reader, options, PropGenerateWordParts, null)) + { + continue; + } + + if (propIgnoreKeywords.TryReadProperty(ref reader, options, PropIgnoreKeywords, null)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (propProtectedWords.TryReadProperty(ref reader, options, PropProtectedWords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProtectedWordsPath.TryReadProperty(ref reader, options, PropProtectedWordsPath, null)) + { + continue; + } + + if (propSplitOnCaseChange.TryReadProperty(ref reader, options, PropSplitOnCaseChange, null)) + { + continue; + } + + if (propSplitOnNumerics.TryReadProperty(ref reader, options, PropSplitOnNumerics, null)) + { + continue; + } + + if (propStemEnglishPossessive.TryReadProperty(ref reader, options, PropStemEnglishPossessive, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propTypeTable.TryReadProperty(ref reader, options, PropTypeTable, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTypeTablePath.TryReadProperty(ref reader, options, PropTypeTablePath, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdjustOffsets = propAdjustOffsets.Value, + CatenateAll = propCatenateAll.Value, + CatenateNumbers = propCatenateNumbers.Value, + CatenateWords = propCatenateWords.Value, + GenerateNumberParts = propGenerateNumberParts.Value, + GenerateWordParts = propGenerateWordParts.Value, + IgnoreKeywords = propIgnoreKeywords.Value, + PreserveOriginal = propPreserveOriginal.Value, + ProtectedWords = propProtectedWords.Value, + ProtectedWordsPath = propProtectedWordsPath.Value, + SplitOnCaseChange = propSplitOnCaseChange.Value, + SplitOnNumerics = propSplitOnNumerics.Value, + StemEnglishPossessive = propStemEnglishPossessive.Value, + TypeTable = propTypeTable.Value, + TypeTablePath = propTypeTablePath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdjustOffsets, value.AdjustOffsets, null, null); + writer.WriteProperty(options, PropCatenateAll, value.CatenateAll, null, null); + writer.WriteProperty(options, PropCatenateNumbers, value.CatenateNumbers, null, null); + writer.WriteProperty(options, PropCatenateWords, value.CatenateWords, null, null); + writer.WriteProperty(options, PropGenerateNumberParts, value.GenerateNumberParts, null, null); + writer.WriteProperty(options, PropGenerateWordParts, value.GenerateWordParts, null, null); + writer.WriteProperty(options, PropIgnoreKeywords, value.IgnoreKeywords, null, null); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropProtectedWords, value.ProtectedWords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProtectedWordsPath, value.ProtectedWordsPath, null, null); + writer.WriteProperty(options, PropSplitOnCaseChange, value.SplitOnCaseChange, null, null); + writer.WriteProperty(options, PropSplitOnNumerics, value.SplitOnNumerics, null, null); + writer.WriteProperty(options, PropStemEnglishPossessive, value.StemEnglishPossessive, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropTypeTable, value.TypeTable, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTypeTablePath, value.TypeTablePath, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterConverter))] +public sealed partial class WordDelimiterGraphTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter +{ +#if NET7_0_OR_GREATER + public WordDelimiterGraphTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public WordDelimiterGraphTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? AdjustOffsets { get; set; } - [JsonInclude, JsonPropertyName("catenate_all")] public bool? CatenateAll { get; set; } - [JsonInclude, JsonPropertyName("catenate_numbers")] public bool? CatenateNumbers { get; set; } - [JsonInclude, JsonPropertyName("catenate_words")] public bool? CatenateWords { get; set; } - [JsonInclude, JsonPropertyName("generate_number_parts")] public bool? GenerateNumberParts { get; set; } - [JsonInclude, JsonPropertyName("generate_word_parts")] public bool? GenerateWordParts { get; set; } - [JsonInclude, JsonPropertyName("ignore_keywords")] public bool? IgnoreKeywords { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("protected_words")] - public ICollection? ProtectedWords { get; set; } - [JsonInclude, JsonPropertyName("protected_words_path")] + public System.Collections.Generic.ICollection? ProtectedWords { get; set; } public string? ProtectedWordsPath { get; set; } - [JsonInclude, JsonPropertyName("split_on_case_change")] public bool? SplitOnCaseChange { get; set; } - [JsonInclude, JsonPropertyName("split_on_numerics")] public bool? SplitOnNumerics { get; set; } - [JsonInclude, JsonPropertyName("stem_english_possessive")] public bool? StemEnglishPossessive { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "word_delimiter_graph"; - [JsonInclude, JsonPropertyName("type_table")] - public ICollection? TypeTable { get; set; } - [JsonInclude, JsonPropertyName("type_table_path")] + public System.Collections.Generic.ICollection? TypeTable { get; set; } public string? TypeTablePath { get; set; } - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class WordDelimiterGraphTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct WordDelimiterGraphTokenFilterDescriptor { - internal WordDelimiterGraphTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter Instance { get; init; } - public WordDelimiterGraphTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WordDelimiterGraphTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter instance) { + Instance = instance; } - private bool? AdjustOffsetsValue { get; set; } - private bool? CatenateAllValue { get; set; } - private bool? CatenateNumbersValue { get; set; } - private bool? CatenateWordsValue { get; set; } - private bool? GenerateNumberPartsValue { get; set; } - private bool? GenerateWordPartsValue { get; set; } - private bool? IgnoreKeywordsValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private ICollection? ProtectedWordsValue { get; set; } - private string? ProtectedWordsPathValue { get; set; } - private bool? SplitOnCaseChangeValue { get; set; } - private bool? SplitOnNumericsValue { get; set; } - private bool? StemEnglishPossessiveValue { get; set; } - private ICollection? TypeTableValue { get; set; } - private string? TypeTablePathValue { get; set; } - private string? VersionValue { get; set; } - - public WordDelimiterGraphTokenFilterDescriptor AdjustOffsets(bool? adjustOffsets = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WordDelimiterGraphTokenFilterDescriptor() { - AdjustOffsetsValue = adjustOffsets; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public WordDelimiterGraphTokenFilterDescriptor CatenateAll(bool? catenateAll = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor AdjustOffsets(bool? value = true) { - CatenateAllValue = catenateAll; - return Self; + Instance.AdjustOffsets = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor CatenateNumbers(bool? catenateNumbers = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor CatenateAll(bool? value = true) { - CatenateNumbersValue = catenateNumbers; - return Self; + Instance.CatenateAll = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor CatenateWords(bool? catenateWords = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor CatenateNumbers(bool? value = true) { - CatenateWordsValue = catenateWords; - return Self; + Instance.CatenateNumbers = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor GenerateNumberParts(bool? generateNumberParts = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor CatenateWords(bool? value = true) { - GenerateNumberPartsValue = generateNumberParts; - return Self; + Instance.CatenateWords = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor GenerateWordParts(bool? generateWordParts = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor GenerateNumberParts(bool? value = true) { - GenerateWordPartsValue = generateWordParts; - return Self; + Instance.GenerateNumberParts = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor IgnoreKeywords(bool? ignoreKeywords = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor GenerateWordParts(bool? value = true) { - IgnoreKeywordsValue = ignoreKeywords; - return Self; + Instance.GenerateWordParts = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor IgnoreKeywords(bool? value = true) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.IgnoreKeywords = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor ProtectedWords(ICollection? protectedWords) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor PreserveOriginal(bool? value = true) { - ProtectedWordsValue = protectedWords; - return Self; + Instance.PreserveOriginal = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor ProtectedWordsPath(string? protectedWordsPath) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor ProtectedWords(System.Collections.Generic.ICollection? value) { - ProtectedWordsPathValue = protectedWordsPath; - return Self; + Instance.ProtectedWords = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor SplitOnCaseChange(bool? splitOnCaseChange = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor ProtectedWords(params string[] values) { - SplitOnCaseChangeValue = splitOnCaseChange; - return Self; + Instance.ProtectedWords = [.. values]; + return this; } - public WordDelimiterGraphTokenFilterDescriptor SplitOnNumerics(bool? splitOnNumerics = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor ProtectedWordsPath(string? value) { - SplitOnNumericsValue = splitOnNumerics; - return Self; + Instance.ProtectedWordsPath = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor StemEnglishPossessive(bool? stemEnglishPossessive = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor SplitOnCaseChange(bool? value = true) { - StemEnglishPossessiveValue = stemEnglishPossessive; - return Self; + Instance.SplitOnCaseChange = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor TypeTable(ICollection? typeTable) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor SplitOnNumerics(bool? value = true) { - TypeTableValue = typeTable; - return Self; + Instance.SplitOnNumerics = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor TypeTablePath(string? typeTablePath) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor StemEnglishPossessive(bool? value = true) { - TypeTablePathValue = typeTablePath; - return Self; + Instance.StemEnglishPossessive = value; + return this; } - public WordDelimiterGraphTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor TypeTable(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.TypeTable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor TypeTable(params string[] values) { - writer.WriteStartObject(); - if (AdjustOffsetsValue.HasValue) - { - writer.WritePropertyName("adjust_offsets"); - writer.WriteBooleanValue(AdjustOffsetsValue.Value); - } - - if (CatenateAllValue.HasValue) - { - writer.WritePropertyName("catenate_all"); - writer.WriteBooleanValue(CatenateAllValue.Value); - } - - if (CatenateNumbersValue.HasValue) - { - writer.WritePropertyName("catenate_numbers"); - writer.WriteBooleanValue(CatenateNumbersValue.Value); - } - - if (CatenateWordsValue.HasValue) - { - writer.WritePropertyName("catenate_words"); - writer.WriteBooleanValue(CatenateWordsValue.Value); - } - - if (GenerateNumberPartsValue.HasValue) - { - writer.WritePropertyName("generate_number_parts"); - writer.WriteBooleanValue(GenerateNumberPartsValue.Value); - } - - if (GenerateWordPartsValue.HasValue) - { - writer.WritePropertyName("generate_word_parts"); - writer.WriteBooleanValue(GenerateWordPartsValue.Value); - } - - if (IgnoreKeywordsValue.HasValue) - { - writer.WritePropertyName("ignore_keywords"); - writer.WriteBooleanValue(IgnoreKeywordsValue.Value); - } - - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } - - if (ProtectedWordsValue is not null) - { - writer.WritePropertyName("protected_words"); - JsonSerializer.Serialize(writer, ProtectedWordsValue, options); - } - - if (!string.IsNullOrEmpty(ProtectedWordsPathValue)) - { - writer.WritePropertyName("protected_words_path"); - writer.WriteStringValue(ProtectedWordsPathValue); - } - - if (SplitOnCaseChangeValue.HasValue) - { - writer.WritePropertyName("split_on_case_change"); - writer.WriteBooleanValue(SplitOnCaseChangeValue.Value); - } - - if (SplitOnNumericsValue.HasValue) - { - writer.WritePropertyName("split_on_numerics"); - writer.WriteBooleanValue(SplitOnNumericsValue.Value); - } - - if (StemEnglishPossessiveValue.HasValue) - { - writer.WritePropertyName("stem_english_possessive"); - writer.WriteBooleanValue(StemEnglishPossessiveValue.Value); - } + Instance.TypeTable = [.. values]; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("word_delimiter_graph"); - if (TypeTableValue is not null) - { - writer.WritePropertyName("type_table"); - JsonSerializer.Serialize(writer, TypeTableValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor TypeTablePath(string? value) + { + Instance.TypeTablePath = value; + return this; + } - if (!string.IsNullOrEmpty(TypeTablePathValue)) - { - writer.WritePropertyName("type_table_path"); - writer.WriteStringValue(TypeTablePathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterGraphTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - WordDelimiterGraphTokenFilter IBuildableDescriptor.Build() => new() - { - AdjustOffsets = AdjustOffsetsValue, - CatenateAll = CatenateAllValue, - CatenateNumbers = CatenateNumbersValue, - CatenateWords = CatenateWordsValue, - GenerateNumberParts = GenerateNumberPartsValue, - GenerateWordParts = GenerateWordPartsValue, - IgnoreKeywords = IgnoreKeywordsValue, - PreserveOriginal = PreserveOriginalValue, - ProtectedWords = ProtectedWordsValue, - ProtectedWordsPath = ProtectedWordsPathValue, - SplitOnCaseChange = SplitOnCaseChangeValue, - SplitOnNumerics = SplitOnNumericsValue, - StemEnglishPossessive = StemEnglishPossessiveValue, - TypeTable = TypeTableValue, - TypeTablePath = TypeTablePathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterTokenFilter.g.cs index b58d41ff412..4ac8626cf68 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/WordDelimiterTokenFilter.g.cs @@ -17,266 +17,339 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -public sealed partial class WordDelimiterTokenFilter : ITokenFilter +internal sealed partial class WordDelimiterTokenFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCatenateAll = System.Text.Json.JsonEncodedText.Encode("catenate_all"); + private static readonly System.Text.Json.JsonEncodedText PropCatenateNumbers = System.Text.Json.JsonEncodedText.Encode("catenate_numbers"); + private static readonly System.Text.Json.JsonEncodedText PropCatenateWords = System.Text.Json.JsonEncodedText.Encode("catenate_words"); + private static readonly System.Text.Json.JsonEncodedText PropGenerateNumberParts = System.Text.Json.JsonEncodedText.Encode("generate_number_parts"); + private static readonly System.Text.Json.JsonEncodedText PropGenerateWordParts = System.Text.Json.JsonEncodedText.Encode("generate_word_parts"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveOriginal = System.Text.Json.JsonEncodedText.Encode("preserve_original"); + private static readonly System.Text.Json.JsonEncodedText PropProtectedWords = System.Text.Json.JsonEncodedText.Encode("protected_words"); + private static readonly System.Text.Json.JsonEncodedText PropProtectedWordsPath = System.Text.Json.JsonEncodedText.Encode("protected_words_path"); + private static readonly System.Text.Json.JsonEncodedText PropSplitOnCaseChange = System.Text.Json.JsonEncodedText.Encode("split_on_case_change"); + private static readonly System.Text.Json.JsonEncodedText PropSplitOnNumerics = System.Text.Json.JsonEncodedText.Encode("split_on_numerics"); + private static readonly System.Text.Json.JsonEncodedText PropStemEnglishPossessive = System.Text.Json.JsonEncodedText.Encode("stem_english_possessive"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropTypeTable = System.Text.Json.JsonEncodedText.Encode("type_table"); + private static readonly System.Text.Json.JsonEncodedText PropTypeTablePath = System.Text.Json.JsonEncodedText.Encode("type_table_path"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCatenateAll = default; + LocalJsonValue propCatenateNumbers = default; + LocalJsonValue propCatenateWords = default; + LocalJsonValue propGenerateNumberParts = default; + LocalJsonValue propGenerateWordParts = default; + LocalJsonValue propPreserveOriginal = default; + LocalJsonValue?> propProtectedWords = default; + LocalJsonValue propProtectedWordsPath = default; + LocalJsonValue propSplitOnCaseChange = default; + LocalJsonValue propSplitOnNumerics = default; + LocalJsonValue propStemEnglishPossessive = default; + LocalJsonValue?> propTypeTable = default; + LocalJsonValue propTypeTablePath = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCatenateAll.TryReadProperty(ref reader, options, PropCatenateAll, null)) + { + continue; + } + + if (propCatenateNumbers.TryReadProperty(ref reader, options, PropCatenateNumbers, null)) + { + continue; + } + + if (propCatenateWords.TryReadProperty(ref reader, options, PropCatenateWords, null)) + { + continue; + } + + if (propGenerateNumberParts.TryReadProperty(ref reader, options, PropGenerateNumberParts, null)) + { + continue; + } + + if (propGenerateWordParts.TryReadProperty(ref reader, options, PropGenerateWordParts, null)) + { + continue; + } + + if (propPreserveOriginal.TryReadProperty(ref reader, options, PropPreserveOriginal, null)) + { + continue; + } + + if (propProtectedWords.TryReadProperty(ref reader, options, PropProtectedWords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProtectedWordsPath.TryReadProperty(ref reader, options, PropProtectedWordsPath, null)) + { + continue; + } + + if (propSplitOnCaseChange.TryReadProperty(ref reader, options, PropSplitOnCaseChange, null)) + { + continue; + } + + if (propSplitOnNumerics.TryReadProperty(ref reader, options, PropSplitOnNumerics, null)) + { + continue; + } + + if (propStemEnglishPossessive.TryReadProperty(ref reader, options, PropStemEnglishPossessive, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propTypeTable.TryReadProperty(ref reader, options, PropTypeTable, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTypeTablePath.TryReadProperty(ref reader, options, PropTypeTablePath, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CatenateAll = propCatenateAll.Value, + CatenateNumbers = propCatenateNumbers.Value, + CatenateWords = propCatenateWords.Value, + GenerateNumberParts = propGenerateNumberParts.Value, + GenerateWordParts = propGenerateWordParts.Value, + PreserveOriginal = propPreserveOriginal.Value, + ProtectedWords = propProtectedWords.Value, + ProtectedWordsPath = propProtectedWordsPath.Value, + SplitOnCaseChange = propSplitOnCaseChange.Value, + SplitOnNumerics = propSplitOnNumerics.Value, + StemEnglishPossessive = propStemEnglishPossessive.Value, + TypeTable = propTypeTable.Value, + TypeTablePath = propTypeTablePath.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCatenateAll, value.CatenateAll, null, null); + writer.WriteProperty(options, PropCatenateNumbers, value.CatenateNumbers, null, null); + writer.WriteProperty(options, PropCatenateWords, value.CatenateWords, null, null); + writer.WriteProperty(options, PropGenerateNumberParts, value.GenerateNumberParts, null, null); + writer.WriteProperty(options, PropGenerateWordParts, value.GenerateWordParts, null, null); + writer.WriteProperty(options, PropPreserveOriginal, value.PreserveOriginal, null, null); + writer.WriteProperty(options, PropProtectedWords, value.ProtectedWords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProtectedWordsPath, value.ProtectedWordsPath, null, null); + writer.WriteProperty(options, PropSplitOnCaseChange, value.SplitOnCaseChange, null, null); + writer.WriteProperty(options, PropSplitOnNumerics, value.SplitOnNumerics, null, null); + writer.WriteProperty(options, PropStemEnglishPossessive, value.StemEnglishPossessive, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropTypeTable, value.TypeTable, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTypeTablePath, value.TypeTablePath, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterConverter))] +public sealed partial class WordDelimiterTokenFilter : Elastic.Clients.Elasticsearch.Analysis.ITokenFilter { - [JsonInclude, JsonPropertyName("catenate_all")] +#if NET7_0_OR_GREATER + public WordDelimiterTokenFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public WordDelimiterTokenFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? CatenateAll { get; set; } - [JsonInclude, JsonPropertyName("catenate_numbers")] public bool? CatenateNumbers { get; set; } - [JsonInclude, JsonPropertyName("catenate_words")] public bool? CatenateWords { get; set; } - [JsonInclude, JsonPropertyName("generate_number_parts")] public bool? GenerateNumberParts { get; set; } - [JsonInclude, JsonPropertyName("generate_word_parts")] public bool? GenerateWordParts { get; set; } - [JsonInclude, JsonPropertyName("preserve_original")] public bool? PreserveOriginal { get; set; } - [JsonInclude, JsonPropertyName("protected_words")] - public ICollection? ProtectedWords { get; set; } - [JsonInclude, JsonPropertyName("protected_words_path")] + public System.Collections.Generic.ICollection? ProtectedWords { get; set; } public string? ProtectedWordsPath { get; set; } - [JsonInclude, JsonPropertyName("split_on_case_change")] public bool? SplitOnCaseChange { get; set; } - [JsonInclude, JsonPropertyName("split_on_numerics")] public bool? SplitOnNumerics { get; set; } - [JsonInclude, JsonPropertyName("stem_english_possessive")] public bool? StemEnglishPossessive { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "word_delimiter"; - [JsonInclude, JsonPropertyName("type_table")] - public ICollection? TypeTable { get; set; } - [JsonInclude, JsonPropertyName("type_table_path")] + public System.Collections.Generic.ICollection? TypeTable { get; set; } public string? TypeTablePath { get; set; } - [JsonInclude, JsonPropertyName("version")] public string? Version { get; set; } } -public sealed partial class WordDelimiterTokenFilterDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct WordDelimiterTokenFilterDescriptor { - internal WordDelimiterTokenFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter Instance { get; init; } - public WordDelimiterTokenFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WordDelimiterTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter instance) { + Instance = instance; } - private bool? CatenateAllValue { get; set; } - private bool? CatenateNumbersValue { get; set; } - private bool? CatenateWordsValue { get; set; } - private bool? GenerateNumberPartsValue { get; set; } - private bool? GenerateWordPartsValue { get; set; } - private bool? PreserveOriginalValue { get; set; } - private ICollection? ProtectedWordsValue { get; set; } - private string? ProtectedWordsPathValue { get; set; } - private bool? SplitOnCaseChangeValue { get; set; } - private bool? SplitOnNumericsValue { get; set; } - private bool? StemEnglishPossessiveValue { get; set; } - private ICollection? TypeTableValue { get; set; } - private string? TypeTablePathValue { get; set; } - private string? VersionValue { get; set; } - - public WordDelimiterTokenFilterDescriptor CatenateAll(bool? catenateAll = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WordDelimiterTokenFilterDescriptor() { - CatenateAllValue = catenateAll; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public WordDelimiterTokenFilterDescriptor CatenateNumbers(bool? catenateNumbers = true) + public static explicit operator Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter instance) => new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor CatenateAll(bool? value = true) { - CatenateNumbersValue = catenateNumbers; - return Self; + Instance.CatenateAll = value; + return this; } - public WordDelimiterTokenFilterDescriptor CatenateWords(bool? catenateWords = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor CatenateNumbers(bool? value = true) { - CatenateWordsValue = catenateWords; - return Self; + Instance.CatenateNumbers = value; + return this; } - public WordDelimiterTokenFilterDescriptor GenerateNumberParts(bool? generateNumberParts = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor CatenateWords(bool? value = true) { - GenerateNumberPartsValue = generateNumberParts; - return Self; + Instance.CatenateWords = value; + return this; } - public WordDelimiterTokenFilterDescriptor GenerateWordParts(bool? generateWordParts = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor GenerateNumberParts(bool? value = true) { - GenerateWordPartsValue = generateWordParts; - return Self; + Instance.GenerateNumberParts = value; + return this; } - public WordDelimiterTokenFilterDescriptor PreserveOriginal(bool? preserveOriginal = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor GenerateWordParts(bool? value = true) { - PreserveOriginalValue = preserveOriginal; - return Self; + Instance.GenerateWordParts = value; + return this; } - public WordDelimiterTokenFilterDescriptor ProtectedWords(ICollection? protectedWords) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor PreserveOriginal(bool? value = true) { - ProtectedWordsValue = protectedWords; - return Self; + Instance.PreserveOriginal = value; + return this; } - public WordDelimiterTokenFilterDescriptor ProtectedWordsPath(string? protectedWordsPath) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor ProtectedWords(System.Collections.Generic.ICollection? value) { - ProtectedWordsPathValue = protectedWordsPath; - return Self; + Instance.ProtectedWords = value; + return this; } - public WordDelimiterTokenFilterDescriptor SplitOnCaseChange(bool? splitOnCaseChange = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor ProtectedWords(params string[] values) { - SplitOnCaseChangeValue = splitOnCaseChange; - return Self; + Instance.ProtectedWords = [.. values]; + return this; } - public WordDelimiterTokenFilterDescriptor SplitOnNumerics(bool? splitOnNumerics = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor ProtectedWordsPath(string? value) { - SplitOnNumericsValue = splitOnNumerics; - return Self; + Instance.ProtectedWordsPath = value; + return this; } - public WordDelimiterTokenFilterDescriptor StemEnglishPossessive(bool? stemEnglishPossessive = true) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor SplitOnCaseChange(bool? value = true) { - StemEnglishPossessiveValue = stemEnglishPossessive; - return Self; + Instance.SplitOnCaseChange = value; + return this; } - public WordDelimiterTokenFilterDescriptor TypeTable(ICollection? typeTable) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor SplitOnNumerics(bool? value = true) { - TypeTableValue = typeTable; - return Self; + Instance.SplitOnNumerics = value; + return this; } - public WordDelimiterTokenFilterDescriptor TypeTablePath(string? typeTablePath) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor StemEnglishPossessive(bool? value = true) { - TypeTablePathValue = typeTablePath; - return Self; + Instance.StemEnglishPossessive = value; + return this; } - public WordDelimiterTokenFilterDescriptor Version(string? version) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor TypeTable(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.TypeTable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor TypeTable(params string[] values) { - writer.WriteStartObject(); - if (CatenateAllValue.HasValue) - { - writer.WritePropertyName("catenate_all"); - writer.WriteBooleanValue(CatenateAllValue.Value); - } - - if (CatenateNumbersValue.HasValue) - { - writer.WritePropertyName("catenate_numbers"); - writer.WriteBooleanValue(CatenateNumbersValue.Value); - } - - if (CatenateWordsValue.HasValue) - { - writer.WritePropertyName("catenate_words"); - writer.WriteBooleanValue(CatenateWordsValue.Value); - } - - if (GenerateNumberPartsValue.HasValue) - { - writer.WritePropertyName("generate_number_parts"); - writer.WriteBooleanValue(GenerateNumberPartsValue.Value); - } - - if (GenerateWordPartsValue.HasValue) - { - writer.WritePropertyName("generate_word_parts"); - writer.WriteBooleanValue(GenerateWordPartsValue.Value); - } - - if (PreserveOriginalValue.HasValue) - { - writer.WritePropertyName("preserve_original"); - writer.WriteBooleanValue(PreserveOriginalValue.Value); - } - - if (ProtectedWordsValue is not null) - { - writer.WritePropertyName("protected_words"); - JsonSerializer.Serialize(writer, ProtectedWordsValue, options); - } - - if (!string.IsNullOrEmpty(ProtectedWordsPathValue)) - { - writer.WritePropertyName("protected_words_path"); - writer.WriteStringValue(ProtectedWordsPathValue); - } - - if (SplitOnCaseChangeValue.HasValue) - { - writer.WritePropertyName("split_on_case_change"); - writer.WriteBooleanValue(SplitOnCaseChangeValue.Value); - } - - if (SplitOnNumericsValue.HasValue) - { - writer.WritePropertyName("split_on_numerics"); - writer.WriteBooleanValue(SplitOnNumericsValue.Value); - } - - if (StemEnglishPossessiveValue.HasValue) - { - writer.WritePropertyName("stem_english_possessive"); - writer.WriteBooleanValue(StemEnglishPossessiveValue.Value); - } + Instance.TypeTable = [.. values]; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("word_delimiter"); - if (TypeTableValue is not null) - { - writer.WritePropertyName("type_table"); - JsonSerializer.Serialize(writer, TypeTableValue, options); - } + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor TypeTablePath(string? value) + { + Instance.TypeTablePath = value; + return this; + } - if (!string.IsNullOrEmpty(TypeTablePathValue)) - { - writer.WritePropertyName("type_table_path"); - writer.WriteStringValue(TypeTablePathValue); - } + public Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor Version(string? value) + { + Instance.Version = value; + return this; + } - if (!string.IsNullOrEmpty(VersionValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteStringValue(VersionValue); + return new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilterDescriptor(new Elastic.Clients.Elasticsearch.Analysis.WordDelimiterTokenFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - WordDelimiterTokenFilter IBuildableDescriptor.Build() => new() - { - CatenateAll = CatenateAllValue, - CatenateNumbers = CatenateNumbersValue, - CatenateWords = CatenateWordsValue, - GenerateNumberParts = GenerateNumberPartsValue, - GenerateWordParts = GenerateWordPartsValue, - PreserveOriginal = PreserveOriginalValue, - ProtectedWords = ProtectedWordsValue, - ProtectedWordsPath = ProtectedWordsPathValue, - SplitOnCaseChange = SplitOnCaseChangeValue, - SplitOnNumerics = SplitOnNumericsValue, - StemEnglishPossessive = StemEnglishPossessiveValue, - TypeTable = TypeTableValue, - TypeTablePath = TypeTablePathValue, - Version = VersionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/AsyncSearch/AsyncSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/AsyncSearch/AsyncSearch.g.cs index bcaf721928d..66df445da1d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/AsyncSearch/AsyncSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/AsyncSearch/AsyncSearch.g.cs @@ -17,33 +17,227 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public sealed partial class AsyncSearch +internal sealed partial class AsyncSearchConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHitsMetadata = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHitsMetadata = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHitsMetadata.TryReadProperty(ref reader, options, PropHitsMetadata, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + HitsMetadata = propHitsMetadata.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHitsMetadata, value.HitsMetadata, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class AsyncSearchConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(AsyncSearch<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(AsyncSearchConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.AsyncSearch.AsyncSearchConverterFactory))] +public partial class AsyncSearch { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AsyncSearch(Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata hitsMetadata, Elastic.Clients.Elasticsearch.ShardStatistics shards, bool timedOut, long took) + { + HitsMetadata = hitsMetadata; + Shards = shards; + TimedOut = timedOut; + Took = took; + } +#if NET7_0_OR_GREATER + public AsyncSearch() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AsyncSearch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AsyncSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// - /// Partial aggregations results, coming from the shards that have already completed the execution of the query. + /// Partial aggregations results, coming from the shards that have already completed running the query. /// /// - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; set; } + public double? MaxScore { get; set; } /// /// @@ -51,14 +245,10 @@ public sealed partial class AsyncSearch /// If this number increases compared to the last retrieved results for a get asynch search request, you can expect additional results included in the search response. /// /// - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } /// /// @@ -66,14 +256,21 @@ public sealed partial class AsyncSearch /// Note that in order for shard results to be included in the search response, they need to be reduced first. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkIndexByScrollFailure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkIndexByScrollFailure.g.cs index f964fa55cd5..49c35a32fb1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkIndexByScrollFailure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkIndexByScrollFailure.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class BulkIndexByScrollFailureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCause = System.Text.Json.JsonEncodedText.Encode("cause"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.BulkIndexByScrollFailure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCause = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCause.TryReadProperty(ref reader, options, PropCause, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.BulkIndexByScrollFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cause = propCause.Value, + Id = propId.Value, + Index = propIndex.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.BulkIndexByScrollFailure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCause, value.Cause, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.BulkIndexByScrollFailureConverter))] public sealed partial class BulkIndexByScrollFailure { - [JsonInclude, JsonPropertyName("cause")] - public Elastic.Clients.Elasticsearch.ErrorCause Cause { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("status")] - public int Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkIndexByScrollFailure(Elastic.Clients.Elasticsearch.ErrorCause cause, string id, string index, int status) + { + Cause = cause; + Id = id; + Index = index; + Status = status; + } +#if NET7_0_OR_GREATER + public BulkIndexByScrollFailure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkIndexByScrollFailure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkIndexByScrollFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Cause { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkStats.g.cs index 32e39a80b86..c5e25ec9131 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/BulkStats.g.cs @@ -17,34 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class BulkStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvgSize = System.Text.Json.JsonEncodedText.Encode("avg_size"); + private static readonly System.Text.Json.JsonEncodedText PropAvgSizeInBytes = System.Text.Json.JsonEncodedText.Encode("avg_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropAvgTime = System.Text.Json.JsonEncodedText.Encode("avg_time"); + private static readonly System.Text.Json.JsonEncodedText PropAvgTimeInMillis = System.Text.Json.JsonEncodedText.Encode("avg_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalOperations = System.Text.Json.JsonEncodedText.Encode("total_operations"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSize = System.Text.Json.JsonEncodedText.Encode("total_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.BulkStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvgSize = default; + LocalJsonValue propAvgSizeInBytes = default; + LocalJsonValue propAvgTime = default; + LocalJsonValue propAvgTimeInMillis = default; + LocalJsonValue propTotalOperations = default; + LocalJsonValue propTotalSize = default; + LocalJsonValue propTotalSizeInBytes = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvgSize.TryReadProperty(ref reader, options, PropAvgSize, null)) + { + continue; + } + + if (propAvgSizeInBytes.TryReadProperty(ref reader, options, PropAvgSizeInBytes, null)) + { + continue; + } + + if (propAvgTime.TryReadProperty(ref reader, options, PropAvgTime, null)) + { + continue; + } + + if (propAvgTimeInMillis.TryReadProperty(ref reader, options, PropAvgTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalOperations.TryReadProperty(ref reader, options, PropTotalOperations, null)) + { + continue; + } + + if (propTotalSize.TryReadProperty(ref reader, options, PropTotalSize, null)) + { + continue; + } + + if (propTotalSizeInBytes.TryReadProperty(ref reader, options, PropTotalSizeInBytes, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.BulkStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvgSize = propAvgSize.Value, + AvgSizeInBytes = propAvgSizeInBytes.Value, + AvgTime = propAvgTime.Value, + AvgTimeInMillis = propAvgTimeInMillis.Value, + TotalOperations = propTotalOperations.Value, + TotalSize = propTotalSize.Value, + TotalSizeInBytes = propTotalSizeInBytes.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.BulkStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvgSize, value.AvgSize, null, null); + writer.WriteProperty(options, PropAvgSizeInBytes, value.AvgSizeInBytes, null, null); + writer.WriteProperty(options, PropAvgTime, value.AvgTime, null, null); + writer.WriteProperty(options, PropAvgTimeInMillis, value.AvgTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalOperations, value.TotalOperations, null, null); + writer.WriteProperty(options, PropTotalSize, value.TotalSize, null, null); + writer.WriteProperty(options, PropTotalSizeInBytes, value.TotalSizeInBytes, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.BulkStatsConverter))] public sealed partial class BulkStats { - [JsonInclude, JsonPropertyName("avg_size")] - public Elastic.Clients.Elasticsearch.ByteSize? AvgSize { get; init; } - [JsonInclude, JsonPropertyName("avg_size_in_bytes")] - public long AvgSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("avg_time")] - public Elastic.Clients.Elasticsearch.Duration? AvgTime { get; init; } - [JsonInclude, JsonPropertyName("avg_time_in_millis")] - public long AvgTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_operations")] - public long TotalOperations { get; init; } - [JsonInclude, JsonPropertyName("total_size")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalSize { get; init; } - [JsonInclude, JsonPropertyName("total_size_in_bytes")] - public long TotalSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkStats(long avgSizeInBytes, System.TimeSpan avgTimeInMillis, long totalOperations, long totalSizeInBytes, System.TimeSpan totalTimeInMillis) + { + AvgSizeInBytes = avgSizeInBytes; + AvgTimeInMillis = avgTimeInMillis; + TotalOperations = totalOperations; + TotalSizeInBytes = totalSizeInBytes; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public BulkStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ByteSize? AvgSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long AvgSizeInBytes { get; set; } + public Elastic.Clients.Elasticsearch.Duration? AvgTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan AvgTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalOperations { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeInBytes { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs index ff080b07f17..4bc88f6e051 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs @@ -17,29 +17,81 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ByteSizeConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ByteSize Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.ByteSize(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.ByteSize(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.ByteSize)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ByteSize value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class ByteSize : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ByteSizeConverter))] +public sealed partial class ByteSize : Elastic.Clients.Elasticsearch.Union { - public ByteSize(long Bytesize) : base(Bytesize) + public ByteSize(long value) : base(value) + { + } + + public ByteSize(string value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.ByteSize(long value) => new Elastic.Clients.Elasticsearch.ByteSize(value); + public static implicit operator Elastic.Clients.Elasticsearch.ByteSize(string value) => new Elastic.Clients.Elasticsearch.ByteSize(value); +} + +public readonly partial struct ByteSizeFactory +{ + public Elastic.Clients.Elasticsearch.ByteSize Value(long value) + { + return new Elastic.Clients.Elasticsearch.ByteSize(value); + } + + public Elastic.Clients.Elasticsearch.ByteSize Value(string value) { + return new Elastic.Clients.Elasticsearch.ByteSize(value); } - public ByteSize(string Bytesize) : base(Bytesize) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ByteSize Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.ByteSizeFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationDecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationDecision.g.cs index 73f4caf7f7a..589b17e912e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationDecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationDecision.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class AllocationDecisionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDecider = System.Text.Json.JsonEncodedText.Encode("decider"); + private static readonly System.Text.Json.JsonEncodedText PropDecision = System.Text.Json.JsonEncodedText.Encode("decision"); + private static readonly System.Text.Json.JsonEncodedText PropExplanation = System.Text.Json.JsonEncodedText.Encode("explanation"); + + public override Elastic.Clients.Elasticsearch.Cluster.AllocationDecision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDecider = default; + LocalJsonValue propDecision = default; + LocalJsonValue propExplanation = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDecider.TryReadProperty(ref reader, options, PropDecider, null)) + { + continue; + } + + if (propDecision.TryReadProperty(ref reader, options, PropDecision, null)) + { + continue; + } + + if (propExplanation.TryReadProperty(ref reader, options, PropExplanation, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.AllocationDecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Decider = propDecider.Value, + Decision = propDecision.Value, + Explanation = propExplanation.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationDecision value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDecider, value.Decider, null, null); + writer.WriteProperty(options, PropDecision, value.Decision, null, null); + writer.WriteProperty(options, PropExplanation, value.Explanation, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.AllocationDecisionConverter))] public sealed partial class AllocationDecision { - [JsonInclude, JsonPropertyName("decider")] - public string Decider { get; init; } - [JsonInclude, JsonPropertyName("decision")] - public Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision Decision { get; init; } - [JsonInclude, JsonPropertyName("explanation")] - public string Explanation { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocationDecision(string decider, Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision decision, string explanation) + { + Decider = decider; + Decision = decision; + Explanation = explanation; + } +#if NET7_0_OR_GREATER + public AllocationDecision() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AllocationDecision() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllocationDecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Decider { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision Decision { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Explanation { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationStore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationStore.g.cs index 1d9ef9659c3..50ab1862289 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationStore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/AllocationStore.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class AllocationStoreConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocationId = System.Text.Json.JsonEncodedText.Encode("allocation_id"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropInSync = System.Text.Json.JsonEncodedText.Encode("in_sync"); + private static readonly System.Text.Json.JsonEncodedText PropMatchingSizeInBytes = System.Text.Json.JsonEncodedText.Encode("matching_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMatchingSyncId = System.Text.Json.JsonEncodedText.Encode("matching_sync_id"); + private static readonly System.Text.Json.JsonEncodedText PropStoreException = System.Text.Json.JsonEncodedText.Encode("store_exception"); + + public override Elastic.Clients.Elasticsearch.Cluster.AllocationStore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocationId = default; + LocalJsonValue propFound = default; + LocalJsonValue propInSync = default; + LocalJsonValue propMatchingSizeInBytes = default; + LocalJsonValue propMatchingSyncId = default; + LocalJsonValue propStoreException = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocationId.TryReadProperty(ref reader, options, PropAllocationId, null)) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propInSync.TryReadProperty(ref reader, options, PropInSync, null)) + { + continue; + } + + if (propMatchingSizeInBytes.TryReadProperty(ref reader, options, PropMatchingSizeInBytes, null)) + { + continue; + } + + if (propMatchingSyncId.TryReadProperty(ref reader, options, PropMatchingSyncId, null)) + { + continue; + } + + if (propStoreException.TryReadProperty(ref reader, options, PropStoreException, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.AllocationStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocationId = propAllocationId.Value, + Found = propFound.Value, + InSync = propInSync.Value, + MatchingSizeInBytes = propMatchingSizeInBytes.Value, + MatchingSyncId = propMatchingSyncId.Value, + StoreException = propStoreException.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationStore value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocationId, value.AllocationId, null, null); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropInSync, value.InSync, null, null); + writer.WriteProperty(options, PropMatchingSizeInBytes, value.MatchingSizeInBytes, null, null); + writer.WriteProperty(options, PropMatchingSyncId, value.MatchingSyncId, null, null); + writer.WriteProperty(options, PropStoreException, value.StoreException, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.AllocationStoreConverter))] public sealed partial class AllocationStore { - [JsonInclude, JsonPropertyName("allocation_id")] - public string AllocationId { get; init; } - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } - [JsonInclude, JsonPropertyName("in_sync")] - public bool InSync { get; init; } - [JsonInclude, JsonPropertyName("matching_size_in_bytes")] - public long MatchingSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("matching_sync_id")] - public bool MatchingSyncId { get; init; } - [JsonInclude, JsonPropertyName("store_exception")] - public string StoreException { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocationStore(string allocationId, bool found, bool inSync, long matchingSizeInBytes, bool matchingSyncId, string storeException) + { + AllocationId = allocationId; + Found = found; + InSync = inSync; + MatchingSizeInBytes = matchingSizeInBytes; + MatchingSyncId = matchingSyncId; + StoreException = storeException; + } +#if NET7_0_OR_GREATER + public AllocationStore() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AllocationStore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllocationStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string AllocationId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool InSync { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MatchingSizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool MatchingSyncId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string StoreException { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CharFilterTypes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CharFilterTypes.g.cs index 744da73f590..1b377194993 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CharFilterTypes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CharFilterTypes.g.cs @@ -17,79 +17,231 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class CharFilterTypesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzerTypes = System.Text.Json.JsonEncodedText.Encode("analyzer_types"); + private static readonly System.Text.Json.JsonEncodedText PropBuiltInAnalyzers = System.Text.Json.JsonEncodedText.Encode("built_in_analyzers"); + private static readonly System.Text.Json.JsonEncodedText PropBuiltInCharFilters = System.Text.Json.JsonEncodedText.Encode("built_in_char_filters"); + private static readonly System.Text.Json.JsonEncodedText PropBuiltInFilters = System.Text.Json.JsonEncodedText.Encode("built_in_filters"); + private static readonly System.Text.Json.JsonEncodedText PropBuiltInTokenizers = System.Text.Json.JsonEncodedText.Encode("built_in_tokenizers"); + private static readonly System.Text.Json.JsonEncodedText PropCharFilterTypes2 = System.Text.Json.JsonEncodedText.Encode("char_filter_types"); + private static readonly System.Text.Json.JsonEncodedText PropFilterTypes = System.Text.Json.JsonEncodedText.Encode("filter_types"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizerTypes = System.Text.Json.JsonEncodedText.Encode("tokenizer_types"); + + public override Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAnalyzerTypes = default; + LocalJsonValue> propBuiltInAnalyzers = default; + LocalJsonValue> propBuiltInCharFilters = default; + LocalJsonValue> propBuiltInFilters = default; + LocalJsonValue> propBuiltInTokenizers = default; + LocalJsonValue> propCharFilterTypes2 = default; + LocalJsonValue> propFilterTypes = default; + LocalJsonValue> propTokenizerTypes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzerTypes.TryReadProperty(ref reader, options, PropAnalyzerTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propBuiltInAnalyzers.TryReadProperty(ref reader, options, PropBuiltInAnalyzers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propBuiltInCharFilters.TryReadProperty(ref reader, options, PropBuiltInCharFilters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propBuiltInFilters.TryReadProperty(ref reader, options, PropBuiltInFilters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propBuiltInTokenizers.TryReadProperty(ref reader, options, PropBuiltInTokenizers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCharFilterTypes2.TryReadProperty(ref reader, options, PropCharFilterTypes2, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFilterTypes.TryReadProperty(ref reader, options, PropFilterTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTokenizerTypes.TryReadProperty(ref reader, options, PropTokenizerTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalyzerTypes = propAnalyzerTypes.Value, + BuiltInAnalyzers = propBuiltInAnalyzers.Value, + BuiltInCharFilters = propBuiltInCharFilters.Value, + BuiltInFilters = propBuiltInFilters.Value, + BuiltInTokenizers = propBuiltInTokenizers.Value, + CharFilterTypes2 = propCharFilterTypes2.Value, + FilterTypes = propFilterTypes.Value, + TokenizerTypes = propTokenizerTypes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzerTypes, value.AnalyzerTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBuiltInAnalyzers, value.BuiltInAnalyzers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBuiltInCharFilters, value.BuiltInCharFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBuiltInFilters, value.BuiltInFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBuiltInTokenizers, value.BuiltInTokenizers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCharFilterTypes2, value.CharFilterTypes2, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilterTypes, value.FilterTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTokenizerTypes, value.TokenizerTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.CharFilterTypesConverter))] public sealed partial class CharFilterTypes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CharFilterTypes(System.Collections.Generic.IReadOnlyCollection analyzerTypes, System.Collections.Generic.IReadOnlyCollection builtInAnalyzers, System.Collections.Generic.IReadOnlyCollection builtInCharFilters, System.Collections.Generic.IReadOnlyCollection builtInFilters, System.Collections.Generic.IReadOnlyCollection builtInTokenizers, System.Collections.Generic.IReadOnlyCollection charFilterTypes2, System.Collections.Generic.IReadOnlyCollection filterTypes, System.Collections.Generic.IReadOnlyCollection tokenizerTypes) + { + AnalyzerTypes = analyzerTypes; + BuiltInAnalyzers = builtInAnalyzers; + BuiltInCharFilters = builtInCharFilters; + BuiltInFilters = builtInFilters; + BuiltInTokenizers = builtInTokenizers; + CharFilterTypes2 = charFilterTypes2; + FilterTypes = filterTypes; + TokenizerTypes = tokenizerTypes; + } +#if NET7_0_OR_GREATER + public CharFilterTypes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CharFilterTypes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CharFilterTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about analyzer types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("analyzer_types")] - public IReadOnlyCollection AnalyzerTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection AnalyzerTypes { get; set; } /// /// /// Contains statistics about built-in analyzers used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("built_in_analyzers")] - public IReadOnlyCollection BuiltInAnalyzers { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BuiltInAnalyzers { get; set; } /// /// /// Contains statistics about built-in character filters used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("built_in_char_filters")] - public IReadOnlyCollection BuiltInCharFilters { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BuiltInCharFilters { get; set; } /// /// /// Contains statistics about built-in token filters used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("built_in_filters")] - public IReadOnlyCollection BuiltInFilters { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BuiltInFilters { get; set; } /// /// /// Contains statistics about built-in tokenizers used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("built_in_tokenizers")] - public IReadOnlyCollection BuiltInTokenizers { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BuiltInTokenizers { get; set; } /// /// /// Contains statistics about character filter types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("char_filter_types")] - public IReadOnlyCollection CharFilterTypes2 { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection CharFilterTypes2 { get; set; } /// /// /// Contains statistics about token filter types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("filter_types")] - public IReadOnlyCollection FilterTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FilterTypes { get; set; } /// /// /// Contains statistics about tokenizer types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("tokenizer_types")] - public IReadOnlyCollection TokenizerTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection TokenizerTypes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterFileSystem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterFileSystem.g.cs index fb80ef4af77..8a2137b1b61 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterFileSystem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterFileSystem.g.cs @@ -17,18 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterFileSystemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailableInBytes = System.Text.Json.JsonEncodedText.Encode("available_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailableInBytes = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propTotalInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailableInBytes.TryReadProperty(ref reader, options, PropAvailableInBytes, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvailableInBytes = propAvailableInBytes.Value, + FreeInBytes = propFreeInBytes.Value, + TotalInBytes = propTotalInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailableInBytes, value.AvailableInBytes, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystemConverter))] public sealed partial class ClusterFileSystem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterFileSystem(long availableInBytes, long freeInBytes, long totalInBytes) + { + AvailableInBytes = availableInBytes; + FreeInBytes = freeInBytes; + TotalInBytes = totalInBytes; + } +#if NET7_0_OR_GREATER + public ClusterFileSystem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterFileSystem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterFileSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of bytes available to JVM in file stores across all selected nodes. @@ -36,22 +114,31 @@ public sealed partial class ClusterFileSystem /// This is the actual amount of free disk space the selected Elasticsearch nodes can use. /// /// - [JsonInclude, JsonPropertyName("available_in_bytes")] - public long AvailableInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long AvailableInBytes { get; set; } /// /// /// Total number of unallocated bytes in file stores across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long FreeInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long FreeInBytes { get; set; } /// /// /// Total size, in bytes, of all file stores across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long TotalInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndices.g.cs index 7d491e75a90..e374bc9bc9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndices.g.cs @@ -17,103 +17,289 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterIndicesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropQueryCache = System.Text.Json.JsonEncodedText.Encode("query_cache"); + private static readonly System.Text.Json.JsonEncodedText PropSegments = System.Text.Json.JsonEncodedText.Encode("segments"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropVersions = System.Text.Json.JsonEncodedText.Encode("versions"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterIndices Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalysis = default; + LocalJsonValue propCompletion = default; + LocalJsonValue propCount = default; + LocalJsonValue propDocs = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propMappings = default; + LocalJsonValue propQueryCache = default; + LocalJsonValue propSegments = default; + LocalJsonValue propShards = default; + LocalJsonValue propStore = default; + LocalJsonValue?> propVersions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propCompletion.TryReadProperty(ref reader, options, PropCompletion, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDocs.TryReadProperty(ref reader, options, PropDocs, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propQueryCache.TryReadProperty(ref reader, options, PropQueryCache, null)) + { + continue; + } + + if (propSegments.TryReadProperty(ref reader, options, PropSegments, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propVersions.TryReadProperty(ref reader, options, PropVersions, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterIndices(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analysis = propAnalysis.Value, + Completion = propCompletion.Value, + Count = propCount.Value, + Docs = propDocs.Value, + Fielddata = propFielddata.Value, + Mappings = propMappings.Value, + QueryCache = propQueryCache.Value, + Segments = propSegments.Value, + Shards = propShards.Value, + Store = propStore.Value, + Versions = propVersions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterIndices value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropCompletion, value.Completion, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDocs, value.Docs, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropQueryCache, value.QueryCache, null, null); + writer.WriteProperty(options, PropSegments, value.Segments, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropVersions, value.Versions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesConverter))] public sealed partial class ClusterIndices { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterIndices(Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes analysis, Elastic.Clients.Elasticsearch.CompletionStats completion, long count, Elastic.Clients.Elasticsearch.DocStats docs, Elastic.Clients.Elasticsearch.FielddataStats fielddata, Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings mappings, Elastic.Clients.Elasticsearch.QueryCacheStats queryCache, Elastic.Clients.Elasticsearch.SegmentsStats segments, Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards shards, Elastic.Clients.Elasticsearch.StoreStats store) + { + Analysis = analysis; + Completion = completion; + Count = count; + Docs = docs; + Fielddata = fielddata; + Mappings = mappings; + QueryCache = queryCache; + Segments = segments; + Shards = shards; + Store = store; + } +#if NET7_0_OR_GREATER + public ClusterIndices() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterIndices() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterIndices(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about analyzers and analyzer components used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes Analysis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.CharFilterTypes Analysis { get; set; } /// /// /// Contains statistics about memory used for completion in selected nodes. /// /// - [JsonInclude, JsonPropertyName("completion")] - public Elastic.Clients.Elasticsearch.CompletionStats Completion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.CompletionStats Completion { get; set; } /// /// /// Total number of indices with shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// Contains counts for documents in selected nodes. /// /// - [JsonInclude, JsonPropertyName("docs")] - public Elastic.Clients.Elasticsearch.DocStats Docs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DocStats Docs { get; set; } /// /// /// Contains statistics about the field data cache of selected nodes. /// /// - [JsonInclude, JsonPropertyName("fielddata")] - public Elastic.Clients.Elasticsearch.FielddataStats Fielddata { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.FielddataStats Fielddata { get; set; } /// /// /// Contains statistics about field mappings in selected nodes. /// /// - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings Mappings { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings Mappings { get; set; } /// /// /// Contains statistics about the query cache of selected nodes. /// /// - [JsonInclude, JsonPropertyName("query_cache")] - public Elastic.Clients.Elasticsearch.QueryCacheStats QueryCache { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryCacheStats QueryCache { get; set; } /// /// /// Contains statistics about segments in selected nodes. /// /// - [JsonInclude, JsonPropertyName("segments")] - public Elastic.Clients.Elasticsearch.SegmentsStats Segments { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SegmentsStats Segments { get; set; } /// /// /// Contains statistics about indices with shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("shards")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards Shards { get; set; } /// /// /// Contains statistics about the size of shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("store")] - public Elastic.Clients.Elasticsearch.StoreStats Store { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.StoreStats Store { get; set; } /// /// /// Contains statistics about analyzers and analyzer components used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("versions")] - public IReadOnlyCollection? Versions { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Versions { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShards.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShards.g.cs index c5b582bb4c7..25d72abc080 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShards.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShards.g.cs @@ -17,52 +17,127 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterIndicesShardsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaries = System.Text.Json.JsonEncodedText.Encode("primaries"); + private static readonly System.Text.Json.JsonEncodedText PropReplication = System.Text.Json.JsonEncodedText.Encode("replication"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaries = default; + LocalJsonValue propReplication = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaries.TryReadProperty(ref reader, options, PropPrimaries, null)) + { + continue; + } + + if (propReplication.TryReadProperty(ref reader, options, PropReplication, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Primaries = propPrimaries.Value, + Replication = propReplication.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShards value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaries, value.Primaries, null, null); + writer.WriteProperty(options, PropReplication, value.Replication, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Contains statistics about shards assigned to selected nodes. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsConverter))] public sealed partial class ClusterIndicesShards { +#if NET7_0_OR_GREATER + public ClusterIndicesShards() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClusterIndicesShards() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterIndicesShards(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndex? Index { get; init; } + public Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndex? Index { get; set; } /// /// /// Number of primary shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("primaries")] - public double? Primaries { get; init; } + public double? Primaries { get; set; } /// /// /// Ratio of replica shards to primary shards across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("replication")] - public double? Replication { get; init; } + public double? Replication { get; set; } /// /// /// Total number of shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("total")] - public double? Total { get; init; } + public double? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShardsIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShardsIndex.g.cs index e8f861d298a..e81401e87d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShardsIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIndicesShardsIndex.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterIndicesShardsIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPrimaries = System.Text.Json.JsonEncodedText.Encode("primaries"); + private static readonly System.Text.Json.JsonEncodedText PropReplication = System.Text.Json.JsonEncodedText.Encode("replication"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPrimaries = default; + LocalJsonValue propReplication = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPrimaries.TryReadProperty(ref reader, options, PropPrimaries, null)) + { + continue; + } + + if (propReplication.TryReadProperty(ref reader, options, PropReplication, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Primaries = propPrimaries.Value, + Replication = propReplication.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPrimaries, value.Primaries, null, null); + writer.WriteProperty(options, PropReplication, value.Replication, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterIndicesShardsIndexConverter))] public sealed partial class ClusterIndicesShardsIndex { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterIndicesShardsIndex(Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics primaries, Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics replication, Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics shards) + { + Primaries = primaries; + Replication = replication; + Shards = shards; + } +#if NET7_0_OR_GREATER + public ClusterIndicesShardsIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterIndicesShardsIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterIndicesShardsIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about the number of primary shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("primaries")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Primaries { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Primaries { get; set; } /// /// /// Contains statistics about the number of replication shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("replication")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Replication { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Replication { get; set; } /// /// /// Contains statistics about the number of shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("shards")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Shards { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterInfo.g.cs index dc0aa489132..ba4b2a47b88 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterInfo.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropReservedSizes = System.Text.Json.JsonEncodedText.Encode("reserved_sizes"); + private static readonly System.Text.Json.JsonEncodedText PropShardDataSetSizes = System.Text.Json.JsonEncodedText.Encode("shard_data_set_sizes"); + private static readonly System.Text.Json.JsonEncodedText PropShardPaths = System.Text.Json.JsonEncodedText.Encode("shard_paths"); + private static readonly System.Text.Json.JsonEncodedText PropShardSizes = System.Text.Json.JsonEncodedText.Encode("shard_sizes"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + LocalJsonValue> propReservedSizes = default; + LocalJsonValue?> propShardDataSetSizes = default; + LocalJsonValue> propShardPaths = default; + LocalJsonValue> propShardSizes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propReservedSizes.TryReadProperty(ref reader, options, PropReservedSizes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShardDataSetSizes.TryReadProperty(ref reader, options, PropShardDataSetSizes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propShardPaths.TryReadProperty(ref reader, options, PropShardPaths, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propShardSizes.TryReadProperty(ref reader, options, PropShardSizes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value, + ReservedSizes = propReservedSizes.Value, + ShardDataSetSizes = propShardDataSetSizes.Value, + ShardPaths = propShardPaths.Value, + ShardSizes = propShardSizes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropReservedSizes, value.ReservedSizes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShardDataSetSizes, value.ShardDataSetSizes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShardPaths, value.ShardPaths, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShardSizes, value.ShardSizes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterInfoConverter))] public sealed partial class ClusterInfo { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyDictionary Nodes { get; init; } - [JsonInclude, JsonPropertyName("reserved_sizes")] - public IReadOnlyCollection ReservedSizes { get; init; } - [JsonInclude, JsonPropertyName("shard_data_set_sizes")] - public IReadOnlyDictionary? ShardDataSetSizes { get; init; } - [JsonInclude, JsonPropertyName("shard_paths")] - public IReadOnlyDictionary ShardPaths { get; init; } - [JsonInclude, JsonPropertyName("shard_sizes")] - public IReadOnlyDictionary ShardSizes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterInfo(System.Collections.Generic.IReadOnlyDictionary nodes, System.Collections.Generic.IReadOnlyCollection reservedSizes, System.Collections.Generic.IReadOnlyDictionary shardPaths, System.Collections.Generic.IReadOnlyDictionary shardSizes) + { + Nodes = nodes; + ReservedSizes = reservedSizes; + ShardPaths = shardPaths; + ShardSizes = shardSizes; + } +#if NET7_0_OR_GREATER + public ClusterInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Nodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReservedSizes { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ShardDataSetSizes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary ShardPaths { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary ShardSizes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIngest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIngest.g.cs index a97caf05403..0fe69b862b4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIngest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterIngest.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterIngestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumberOfPipelines = System.Text.Json.JsonEncodedText.Encode("number_of_pipelines"); + private static readonly System.Text.Json.JsonEncodedText PropProcessorStats = System.Text.Json.JsonEncodedText.Encode("processor_stats"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterIngest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumberOfPipelines = default; + LocalJsonValue> propProcessorStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumberOfPipelines.TryReadProperty(ref reader, options, PropNumberOfPipelines, null)) + { + continue; + } + + if (propProcessorStats.TryReadProperty(ref reader, options, PropProcessorStats, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumberOfPipelines = propNumberOfPipelines.Value, + ProcessorStats = propProcessorStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterIngest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumberOfPipelines, value.NumberOfPipelines, null, null); + writer.WriteProperty(options, PropProcessorStats, value.ProcessorStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterIngestConverter))] public sealed partial class ClusterIngest { - [JsonInclude, JsonPropertyName("number_of_pipelines")] - public int NumberOfPipelines { get; init; } - [JsonInclude, JsonPropertyName("processor_stats")] - public IReadOnlyDictionary ProcessorStats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterIngest(int numberOfPipelines, System.Collections.Generic.IReadOnlyDictionary processorStats) + { + NumberOfPipelines = numberOfPipelines; + ProcessorStats = processorStats; + } +#if NET7_0_OR_GREATER + public ClusterIngest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterIngest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfPipelines { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary ProcessorStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvm.g.cs index 8c0a40c889c..6b58b42a90e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvm.g.cs @@ -17,47 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterJvmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxUptimeInMillis = System.Text.Json.JsonEncodedText.Encode("max_uptime_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropThreads = System.Text.Json.JsonEncodedText.Encode("threads"); + private static readonly System.Text.Json.JsonEncodedText PropVersions = System.Text.Json.JsonEncodedText.Encode("versions"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterJvm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxUptimeInMillis = default; + LocalJsonValue propMem = default; + LocalJsonValue propThreads = default; + LocalJsonValue> propVersions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxUptimeInMillis.TryReadProperty(ref reader, options, PropMaxUptimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propThreads.TryReadProperty(ref reader, options, PropThreads, null)) + { + continue; + } + + if (propVersions.TryReadProperty(ref reader, options, PropVersions, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterJvm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxUptimeInMillis = propMaxUptimeInMillis.Value, + Mem = propMem.Value, + Threads = propThreads.Value, + Versions = propVersions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterJvm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxUptimeInMillis, value.MaxUptimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropThreads, value.Threads, null, null); + writer.WriteProperty(options, PropVersions, value.Versions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterJvmConverter))] public sealed partial class ClusterJvm { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterJvm(System.TimeSpan maxUptimeInMillis, Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory mem, long threads, System.Collections.Generic.IReadOnlyCollection versions) + { + MaxUptimeInMillis = maxUptimeInMillis; + Mem = mem; + Threads = threads; + Versions = versions; + } +#if NET7_0_OR_GREATER + public ClusterJvm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterJvm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterJvm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Uptime duration, in milliseconds, since JVM last started. /// /// - [JsonInclude, JsonPropertyName("max_uptime_in_millis")] - public long MaxUptimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan MaxUptimeInMillis { get; set; } /// /// /// Contains statistics about memory used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory Mem { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory Mem { get; set; } /// /// /// Number of active threads in use by JVM across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("threads")] - public long Threads { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Threads { get; set; } /// /// /// Contains statistics about the JVM versions used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("versions")] - public IReadOnlyCollection Versions { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Versions { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmMemory.g.cs index 44c88757a16..1c343d83bd8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmMemory.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterJvmMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHeapMaxInBytes = System.Text.Json.JsonEncodedText.Encode("heap_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapUsedInBytes = System.Text.Json.JsonEncodedText.Encode("heap_used_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHeapMaxInBytes = default; + LocalJsonValue propHeapUsedInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHeapMaxInBytes.TryReadProperty(ref reader, options, PropHeapMaxInBytes, null)) + { + continue; + } + + if (propHeapUsedInBytes.TryReadProperty(ref reader, options, PropHeapUsedInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HeapMaxInBytes = propHeapMaxInBytes.Value, + HeapUsedInBytes = propHeapUsedInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHeapMaxInBytes, value.HeapMaxInBytes, null, null); + writer.WriteProperty(options, PropHeapUsedInBytes, value.HeapUsedInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterJvmMemoryConverter))] public sealed partial class ClusterJvmMemory { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterJvmMemory(long heapMaxInBytes, long heapUsedInBytes) + { + HeapMaxInBytes = heapMaxInBytes; + HeapUsedInBytes = heapUsedInBytes; + } +#if NET7_0_OR_GREATER + public ClusterJvmMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterJvmMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterJvmMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Maximum amount of memory, in bytes, available for use by the heap across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("heap_max_in_bytes")] - public long HeapMaxInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long HeapMaxInBytes { get; set; } /// /// /// Memory, in bytes, currently in use by the heap across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("heap_used_in_bytes")] - public long HeapUsedInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long HeapUsedInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmVersion.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmVersion.g.cs index 1fee52d6cb7..acdcde51d9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmVersion.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterJvmVersion.g.cs @@ -17,65 +17,201 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterJvmVersionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBundledJdk = System.Text.Json.JsonEncodedText.Encode("bundled_jdk"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropUsingBundledJdk = System.Text.Json.JsonEncodedText.Encode("using_bundled_jdk"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVmName = System.Text.Json.JsonEncodedText.Encode("vm_name"); + private static readonly System.Text.Json.JsonEncodedText PropVmVendor = System.Text.Json.JsonEncodedText.Encode("vm_vendor"); + private static readonly System.Text.Json.JsonEncodedText PropVmVersion = System.Text.Json.JsonEncodedText.Encode("vm_version"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterJvmVersion Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBundledJdk = default; + LocalJsonValue propCount = default; + LocalJsonValue propUsingBundledJdk = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVmName = default; + LocalJsonValue propVmVendor = default; + LocalJsonValue propVmVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBundledJdk.TryReadProperty(ref reader, options, PropBundledJdk, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propUsingBundledJdk.TryReadProperty(ref reader, options, PropUsingBundledJdk, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVmName.TryReadProperty(ref reader, options, PropVmName, null)) + { + continue; + } + + if (propVmVendor.TryReadProperty(ref reader, options, PropVmVendor, null)) + { + continue; + } + + if (propVmVersion.TryReadProperty(ref reader, options, PropVmVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterJvmVersion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BundledJdk = propBundledJdk.Value, + Count = propCount.Value, + UsingBundledJdk = propUsingBundledJdk.Value, + Version = propVersion.Value, + VmName = propVmName.Value, + VmVendor = propVmVendor.Value, + VmVersion = propVmVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterJvmVersion value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBundledJdk, value.BundledJdk, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropUsingBundledJdk, value.UsingBundledJdk, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVmName, value.VmName, null, null); + writer.WriteProperty(options, PropVmVendor, value.VmVendor, null, null); + writer.WriteProperty(options, PropVmVersion, value.VmVersion, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterJvmVersionConverter))] public sealed partial class ClusterJvmVersion { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterJvmVersion(bool bundledJdk, int count, bool usingBundledJdk, string version, string vmName, string vmVendor, string vmVersion) + { + BundledJdk = bundledJdk; + Count = count; + UsingBundledJdk = usingBundledJdk; + Version = version; + VmName = vmName; + VmVendor = vmVendor; + VmVersion = vmVersion; + } +#if NET7_0_OR_GREATER + public ClusterJvmVersion() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterJvmVersion() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterJvmVersion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Always true. All distributions come with a bundled Java Development Kit (JDK). /// /// - [JsonInclude, JsonPropertyName("bundled_jdk")] - public bool BundledJdk { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool BundledJdk { get; set; } /// /// /// Total number of selected nodes using JVM. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// If true, a bundled JDK is in use by JVM. /// /// - [JsonInclude, JsonPropertyName("using_bundled_jdk")] - public bool UsingBundledJdk { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool UsingBundledJdk { get; set; } /// /// /// Version of JVM used by one or more selected nodes. /// /// - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } /// /// /// Name of the JVM. /// /// - [JsonInclude, JsonPropertyName("vm_name")] - public string VmName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmName { get; set; } /// /// /// Vendor of the JVM. /// /// - [JsonInclude, JsonPropertyName("vm_vendor")] - public string VmVendor { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmVendor { get; set; } /// /// @@ -83,6 +219,9 @@ public sealed partial class ClusterJvmVersion /// The full version number includes a plus sign (+) followed by the build number. /// /// - [JsonInclude, JsonPropertyName("vm_version")] - public string VmVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmVersion { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNetworkTypes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNetworkTypes.g.cs index 2a75ea8e1ea..ed526ef57ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNetworkTypes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNetworkTypes.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterNetworkTypesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHttpTypes = System.Text.Json.JsonEncodedText.Encode("http_types"); + private static readonly System.Text.Json.JsonEncodedText PropTransportTypes = System.Text.Json.JsonEncodedText.Encode("transport_types"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHttpTypes = default; + LocalJsonValue> propTransportTypes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHttpTypes.TryReadProperty(ref reader, options, PropHttpTypes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTransportTypes.TryReadProperty(ref reader, options, PropTransportTypes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HttpTypes = propHttpTypes.Value, + TransportTypes = propTransportTypes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHttpTypes, value.HttpTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTransportTypes, value.TransportTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypesConverter))] public sealed partial class ClusterNetworkTypes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterNetworkTypes(System.Collections.Generic.IReadOnlyDictionary httpTypes, System.Collections.Generic.IReadOnlyDictionary transportTypes) + { + HttpTypes = httpTypes; + TransportTypes = transportTypes; + } +#if NET7_0_OR_GREATER + public ClusterNetworkTypes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterNetworkTypes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterNetworkTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about the HTTP network types used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("http_types")] - public IReadOnlyDictionary HttpTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary HttpTypes { get; set; } /// /// /// Contains statistics about the transport network types used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("transport_types")] - public IReadOnlyDictionary TransportTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary TransportTypes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodeCount.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodeCount.g.cs index 63845f8c99c..92a12760b8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodeCount.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodeCount.g.cs @@ -17,44 +17,269 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterNodeCountConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingOnly = System.Text.Json.JsonEncodedText.Encode("coordinating_only"); + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropDataCold = System.Text.Json.JsonEncodedText.Encode("data_cold"); + private static readonly System.Text.Json.JsonEncodedText PropDataContent = System.Text.Json.JsonEncodedText.Encode("data_content"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrozen = System.Text.Json.JsonEncodedText.Encode("data_frozen"); + private static readonly System.Text.Json.JsonEncodedText PropDataHot = System.Text.Json.JsonEncodedText.Encode("data_hot"); + private static readonly System.Text.Json.JsonEncodedText PropDataWarm = System.Text.Json.JsonEncodedText.Encode("data_warm"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropMaster = System.Text.Json.JsonEncodedText.Encode("master"); + private static readonly System.Text.Json.JsonEncodedText PropMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteClusterClient = System.Text.Json.JsonEncodedText.Encode("remote_cluster_client"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTransform = System.Text.Json.JsonEncodedText.Encode("transform"); + private static readonly System.Text.Json.JsonEncodedText PropVotingOnly = System.Text.Json.JsonEncodedText.Encode("voting_only"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCoordinatingOnly = default; + LocalJsonValue propData = default; + LocalJsonValue propDataCold = default; + LocalJsonValue propDataContent = default; + LocalJsonValue propDataFrozen = default; + LocalJsonValue propDataHot = default; + LocalJsonValue propDataWarm = default; + LocalJsonValue propIngest = default; + LocalJsonValue propMaster = default; + LocalJsonValue propMl = default; + LocalJsonValue propRemoteClusterClient = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTransform = default; + LocalJsonValue propVotingOnly = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCoordinatingOnly.TryReadProperty(ref reader, options, PropCoordinatingOnly, null)) + { + continue; + } + + if (propData.TryReadProperty(ref reader, options, PropData, null)) + { + continue; + } + + if (propDataCold.TryReadProperty(ref reader, options, PropDataCold, null)) + { + continue; + } + + if (propDataContent.TryReadProperty(ref reader, options, PropDataContent, null)) + { + continue; + } + + if (propDataFrozen.TryReadProperty(ref reader, options, PropDataFrozen, null)) + { + continue; + } + + if (propDataHot.TryReadProperty(ref reader, options, PropDataHot, null)) + { + continue; + } + + if (propDataWarm.TryReadProperty(ref reader, options, PropDataWarm, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propMaster.TryReadProperty(ref reader, options, PropMaster, null)) + { + continue; + } + + if (propMl.TryReadProperty(ref reader, options, PropMl, null)) + { + continue; + } + + if (propRemoteClusterClient.TryReadProperty(ref reader, options, PropRemoteClusterClient, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTransform.TryReadProperty(ref reader, options, PropTransform, null)) + { + continue; + } + + if (propVotingOnly.TryReadProperty(ref reader, options, PropVotingOnly, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CoordinatingOnly = propCoordinatingOnly.Value, + Data = propData.Value, + DataCold = propDataCold.Value, + DataContent = propDataContent.Value, + DataFrozen = propDataFrozen.Value, + DataHot = propDataHot.Value, + DataWarm = propDataWarm.Value, + Ingest = propIngest.Value, + Master = propMaster.Value, + Ml = propMl.Value, + RemoteClusterClient = propRemoteClusterClient.Value, + Total = propTotal.Value, + Transform = propTransform.Value, + VotingOnly = propVotingOnly.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCoordinatingOnly, value.CoordinatingOnly, null, null); + writer.WriteProperty(options, PropData, value.Data, null, null); + writer.WriteProperty(options, PropDataCold, value.DataCold, null, null); + writer.WriteProperty(options, PropDataContent, value.DataContent, null, null); + writer.WriteProperty(options, PropDataFrozen, value.DataFrozen, null, null); + writer.WriteProperty(options, PropDataHot, value.DataHot, null, null); + writer.WriteProperty(options, PropDataWarm, value.DataWarm, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropMaster, value.Master, null, null); + writer.WriteProperty(options, PropMl, value.Ml, null, null); + writer.WriteProperty(options, PropRemoteClusterClient, value.RemoteClusterClient, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTransform, value.Transform, null, null); + writer.WriteProperty(options, PropVotingOnly, value.VotingOnly, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCountConverter))] public sealed partial class ClusterNodeCount { - [JsonInclude, JsonPropertyName("coordinating_only")] - public int CoordinatingOnly { get; init; } - [JsonInclude, JsonPropertyName("data")] - public int Data { get; init; } - [JsonInclude, JsonPropertyName("data_cold")] - public int DataCold { get; init; } - [JsonInclude, JsonPropertyName("data_content")] - public int DataContent { get; init; } - [JsonInclude, JsonPropertyName("data_frozen")] - public int? DataFrozen { get; init; } - [JsonInclude, JsonPropertyName("data_hot")] - public int DataHot { get; init; } - [JsonInclude, JsonPropertyName("data_warm")] - public int DataWarm { get; init; } - [JsonInclude, JsonPropertyName("ingest")] - public int Ingest { get; init; } - [JsonInclude, JsonPropertyName("master")] - public int Master { get; init; } - [JsonInclude, JsonPropertyName("ml")] - public int Ml { get; init; } - [JsonInclude, JsonPropertyName("remote_cluster_client")] - public int RemoteClusterClient { get; init; } - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } - [JsonInclude, JsonPropertyName("transform")] - public int Transform { get; init; } - [JsonInclude, JsonPropertyName("voting_only")] - public int VotingOnly { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterNodeCount(int coordinatingOnly, int data, int dataCold, int dataContent, int dataHot, int dataWarm, int ingest, int master, int ml, int remoteClusterClient, int total, int transform, int votingOnly) + { + CoordinatingOnly = coordinatingOnly; + Data = data; + DataCold = dataCold; + DataContent = dataContent; + DataHot = dataHot; + DataWarm = dataWarm; + Ingest = ingest; + Master = master; + Ml = ml; + RemoteClusterClient = remoteClusterClient; + Total = total; + Transform = transform; + VotingOnly = votingOnly; + } +#if NET7_0_OR_GREATER + public ClusterNodeCount() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterNodeCount() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterNodeCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int CoordinatingOnly { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Data { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataCold { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataContent { get; set; } + public int? DataFrozen { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataHot { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataWarm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Ingest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Master { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Ml { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RemoteClusterClient { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Transform { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int VotingOnly { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodes.g.cs index 23d6d9e9673..23a89dd4cda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterNodes.g.cs @@ -17,77 +17,272 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterNodesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDiscoveryTypes = System.Text.Json.JsonEncodedText.Encode("discovery_types"); + private static readonly System.Text.Json.JsonEncodedText PropFs = System.Text.Json.JsonEncodedText.Encode("fs"); + private static readonly System.Text.Json.JsonEncodedText PropIndexingPressure = System.Text.Json.JsonEncodedText.Encode("indexing_pressure"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropJvm = System.Text.Json.JsonEncodedText.Encode("jvm"); + private static readonly System.Text.Json.JsonEncodedText PropNetworkTypes = System.Text.Json.JsonEncodedText.Encode("network_types"); + private static readonly System.Text.Json.JsonEncodedText PropOs = System.Text.Json.JsonEncodedText.Encode("os"); + private static readonly System.Text.Json.JsonEncodedText PropPackagingTypes = System.Text.Json.JsonEncodedText.Encode("packaging_types"); + private static readonly System.Text.Json.JsonEncodedText PropPlugins = System.Text.Json.JsonEncodedText.Encode("plugins"); + private static readonly System.Text.Json.JsonEncodedText PropProcess = System.Text.Json.JsonEncodedText.Encode("process"); + private static readonly System.Text.Json.JsonEncodedText PropVersions = System.Text.Json.JsonEncodedText.Encode("versions"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterNodes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDiscoveryTypes = default; + LocalJsonValue propFs = default; + LocalJsonValue propIndexingPressure = default; + LocalJsonValue propIngest = default; + LocalJsonValue propJvm = default; + LocalJsonValue propNetworkTypes = default; + LocalJsonValue propOs = default; + LocalJsonValue> propPackagingTypes = default; + LocalJsonValue> propPlugins = default; + LocalJsonValue propProcess = default; + LocalJsonValue> propVersions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDiscoveryTypes.TryReadProperty(ref reader, options, PropDiscoveryTypes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propFs.TryReadProperty(ref reader, options, PropFs, null)) + { + continue; + } + + if (propIndexingPressure.TryReadProperty(ref reader, options, PropIndexingPressure, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propJvm.TryReadProperty(ref reader, options, PropJvm, null)) + { + continue; + } + + if (propNetworkTypes.TryReadProperty(ref reader, options, PropNetworkTypes, null)) + { + continue; + } + + if (propOs.TryReadProperty(ref reader, options, PropOs, null)) + { + continue; + } + + if (propPackagingTypes.TryReadProperty(ref reader, options, PropPackagingTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPlugins.TryReadProperty(ref reader, options, PropPlugins, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propProcess.TryReadProperty(ref reader, options, PropProcess, null)) + { + continue; + } + + if (propVersions.TryReadProperty(ref reader, options, PropVersions, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterNodes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + DiscoveryTypes = propDiscoveryTypes.Value, + Fs = propFs.Value, + IndexingPressure = propIndexingPressure.Value, + Ingest = propIngest.Value, + Jvm = propJvm.Value, + NetworkTypes = propNetworkTypes.Value, + Os = propOs.Value, + PackagingTypes = propPackagingTypes.Value, + Plugins = propPlugins.Value, + Process = propProcess.Value, + Versions = propVersions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterNodes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDiscoveryTypes, value.DiscoveryTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFs, value.Fs, null, null); + writer.WriteProperty(options, PropIndexingPressure, value.IndexingPressure, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropJvm, value.Jvm, null, null); + writer.WriteProperty(options, PropNetworkTypes, value.NetworkTypes, null, null); + writer.WriteProperty(options, PropOs, value.Os, null, null); + writer.WriteProperty(options, PropPackagingTypes, value.PackagingTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPlugins, value.Plugins, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProcess, value.Process, null, null); + writer.WriteProperty(options, PropVersions, value.Versions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterNodesConverter))] public sealed partial class ClusterNodes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterNodes(Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount count, System.Collections.Generic.IReadOnlyDictionary discoveryTypes, Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem fs, Elastic.Clients.Elasticsearch.Cluster.IndexingPressure indexingPressure, Elastic.Clients.Elasticsearch.Cluster.ClusterIngest ingest, Elastic.Clients.Elasticsearch.Cluster.ClusterJvm jvm, Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes networkTypes, Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem os, System.Collections.Generic.IReadOnlyCollection packagingTypes, System.Collections.Generic.IReadOnlyCollection plugins, Elastic.Clients.Elasticsearch.Cluster.ClusterProcess process, System.Collections.Generic.IReadOnlyCollection versions) + { + Count = count; + DiscoveryTypes = discoveryTypes; + Fs = fs; + IndexingPressure = indexingPressure; + Ingest = ingest; + Jvm = jvm; + NetworkTypes = networkTypes; + Os = os; + PackagingTypes = packagingTypes; + Plugins = plugins; + Process = process; + Versions = versions; + } +#if NET7_0_OR_GREATER + public ClusterNodes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterNodes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterNodes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains counts for nodes selected by the request’s node filters. /// /// - [JsonInclude, JsonPropertyName("count")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterNodeCount Count { get; set; } /// /// /// Contains statistics about the discovery types used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("discovery_types")] - public IReadOnlyDictionary DiscoveryTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary DiscoveryTypes { get; set; } /// /// /// Contains statistics about file stores by selected nodes. /// /// - [JsonInclude, JsonPropertyName("fs")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem Fs { get; init; } - [JsonInclude, JsonPropertyName("indexing_pressure")] - public Elastic.Clients.Elasticsearch.Cluster.IndexingPressure IndexingPressure { get; init; } - [JsonInclude, JsonPropertyName("ingest")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterIngest Ingest { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterFileSystem Fs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.IndexingPressure IndexingPressure { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterIngest Ingest { get; set; } /// /// /// Contains statistics about the Java Virtual Machines (JVMs) used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("jvm")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterJvm Jvm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterJvm Jvm { get; set; } /// /// /// Contains statistics about the transport and HTTP networks used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("network_types")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes NetworkTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterNetworkTypes NetworkTypes { get; set; } /// /// /// Contains statistics about the operating systems used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("os")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem Os { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem Os { get; set; } /// /// /// Contains statistics about Elasticsearch distributions installed on selected nodes. /// /// - [JsonInclude, JsonPropertyName("packaging_types")] - public IReadOnlyCollection PackagingTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PackagingTypes { get; set; } /// /// @@ -95,22 +290,31 @@ public sealed partial class ClusterNodes /// If no plugins or modules are installed, this array is empty. /// /// - [JsonInclude, JsonPropertyName("plugins")] - public IReadOnlyCollection Plugins { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Plugins { get; set; } /// /// /// Contains statistics about processes used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("process")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterProcess Process { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterProcess Process { get; set; } /// /// /// Array of Elasticsearch versions used on selected nodes. /// /// - [JsonInclude, JsonPropertyName("versions")] - public IReadOnlyCollection Versions { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Versions { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystem.g.cs index d27fc5c2e87..11f1d39d9ce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystem.g.cs @@ -17,18 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterOperatingSystemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocatedProcessors = System.Text.Json.JsonEncodedText.Encode("allocated_processors"); + private static readonly System.Text.Json.JsonEncodedText PropArchitectures = System.Text.Json.JsonEncodedText.Encode("architectures"); + private static readonly System.Text.Json.JsonEncodedText PropAvailableProcessors = System.Text.Json.JsonEncodedText.Encode("available_processors"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrettyNames = System.Text.Json.JsonEncodedText.Encode("pretty_names"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocatedProcessors = default; + LocalJsonValue?> propArchitectures = default; + LocalJsonValue propAvailableProcessors = default; + LocalJsonValue propMem = default; + LocalJsonValue> propNames = default; + LocalJsonValue> propPrettyNames = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocatedProcessors.TryReadProperty(ref reader, options, PropAllocatedProcessors, null)) + { + continue; + } + + if (propArchitectures.TryReadProperty(ref reader, options, PropArchitectures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propAvailableProcessors.TryReadProperty(ref reader, options, PropAvailableProcessors, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPrettyNames.TryReadProperty(ref reader, options, PropPrettyNames, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocatedProcessors = propAllocatedProcessors.Value, + Architectures = propArchitectures.Value, + AvailableProcessors = propAvailableProcessors.Value, + Mem = propMem.Value, + Names = propNames.Value, + PrettyNames = propPrettyNames.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocatedProcessors, value.AllocatedProcessors, null, null); + writer.WriteProperty(options, PropArchitectures, value.Architectures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropAvailableProcessors, value.AvailableProcessors, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrettyNames, value.PrettyNames, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemConverter))] public sealed partial class ClusterOperatingSystem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterOperatingSystem(int allocatedProcessors, int availableProcessors, Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo mem, System.Collections.Generic.IReadOnlyCollection names, System.Collections.Generic.IReadOnlyCollection prettyNames) + { + AllocatedProcessors = allocatedProcessors; + AvailableProcessors = availableProcessors; + Mem = mem; + Names = names; + PrettyNames = prettyNames; + } +#if NET7_0_OR_GREATER + public ClusterOperatingSystem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterOperatingSystem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterOperatingSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of processors used to calculate thread pool size across all selected nodes. @@ -36,46 +143,60 @@ public sealed partial class ClusterOperatingSystem /// In both cases, this number will never be larger than 32. /// /// - [JsonInclude, JsonPropertyName("allocated_processors")] - public int AllocatedProcessors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AllocatedProcessors { get; set; } /// /// /// Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("architectures")] - public IReadOnlyCollection? Architectures { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Architectures { get; set; } /// /// /// Number of processors available to JVM across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("available_processors")] - public int AvailableProcessors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AvailableProcessors { get; set; } /// /// /// Contains statistics about memory used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo Mem { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo Mem { get; set; } /// /// /// Contains statistics about operating systems used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("names")] - public IReadOnlyCollection Names { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Names { get; set; } /// /// /// Contains statistics about operating systems used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("pretty_names")] - public IReadOnlyCollection PrettyNames { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PrettyNames { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemArchitecture.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemArchitecture.g.cs index b56a049a1a7..6039f5f179a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemArchitecture.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemArchitecture.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterOperatingSystemArchitectureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropArch = System.Text.Json.JsonEncodedText.Encode("arch"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemArchitecture Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propArch = default; + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propArch.TryReadProperty(ref reader, options, PropArch, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemArchitecture(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Arch = propArch.Value, + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemArchitecture value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropArch, value.Arch, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemArchitectureConverter))] public sealed partial class ClusterOperatingSystemArchitecture { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterOperatingSystemArchitecture(string arch, int count) + { + Arch = arch; + Count = count; + } +#if NET7_0_OR_GREATER + public ClusterOperatingSystemArchitecture() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterOperatingSystemArchitecture() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterOperatingSystemArchitecture(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of an architecture used by one or more selected nodes. /// /// - [JsonInclude, JsonPropertyName("arch")] - public string Arch { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Arch { get; set; } /// /// /// Number of selected nodes using the architecture. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemName.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemName.g.cs index ec8775a23e6..18e0f12c490 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemName.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemName.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterOperatingSystemNameConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemName Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemName value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemNameConverter))] public sealed partial class ClusterOperatingSystemName { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterOperatingSystemName(int count, string name) + { + Count = count; + Name = name; + } +#if NET7_0_OR_GREATER + public ClusterOperatingSystemName() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterOperatingSystemName() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterOperatingSystemName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of selected nodes using the operating system. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Name of an operating system used by one or more selected nodes. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemPrettyName.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemPrettyName.g.cs index aba9ca2ea97..c64772c0b9f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemPrettyName.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterOperatingSystemPrettyName.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterOperatingSystemPrettyNameConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropPrettyName = System.Text.Json.JsonEncodedText.Encode("pretty_name"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemPrettyName Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propPrettyName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propPrettyName.TryReadProperty(ref reader, options, PropPrettyName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemPrettyName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + PrettyName = propPrettyName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemPrettyName value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropPrettyName, value.PrettyName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterOperatingSystemPrettyNameConverter))] public sealed partial class ClusterOperatingSystemPrettyName { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterOperatingSystemPrettyName(int count, string prettyName) + { + Count = count; + PrettyName = prettyName; + } +#if NET7_0_OR_GREATER + public ClusterOperatingSystemPrettyName() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterOperatingSystemPrettyName() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterOperatingSystemPrettyName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of selected nodes using the operating system. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Human-readable name of an operating system used by one or more selected nodes. /// /// - [JsonInclude, JsonPropertyName("pretty_name")] - public string PrettyName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string PrettyName { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcess.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcess.g.cs index 02380edf8ab..6face07cf0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcess.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcess.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterProcessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText PropOpenFileDescriptors = System.Text.Json.JsonEncodedText.Encode("open_file_descriptors"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterProcess Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCpu = default; + LocalJsonValue propOpenFileDescriptors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCpu.TryReadProperty(ref reader, options, PropCpu, null)) + { + continue; + } + + if (propOpenFileDescriptors.TryReadProperty(ref reader, options, PropOpenFileDescriptors, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterProcess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cpu = propCpu.Value, + OpenFileDescriptors = propOpenFileDescriptors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterProcess value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCpu, value.Cpu, null, null); + writer.WriteProperty(options, PropOpenFileDescriptors, value.OpenFileDescriptors, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterProcessConverter))] public sealed partial class ClusterProcess { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterProcess(Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu cpu, Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors openFileDescriptors) + { + Cpu = cpu; + OpenFileDescriptors = openFileDescriptors; + } +#if NET7_0_OR_GREATER + public ClusterProcess() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterProcess() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterProcess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about CPU used by selected nodes. /// /// - [JsonInclude, JsonPropertyName("cpu")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu Cpu { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu Cpu { get; set; } /// /// /// Contains statistics about open file descriptors in selected nodes. /// /// - [JsonInclude, JsonPropertyName("open_file_descriptors")] - public Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors OpenFileDescriptors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors OpenFileDescriptors { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessCpu.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessCpu.g.cs index b55d135943c..b7daa478778 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessCpu.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessCpu.g.cs @@ -17,24 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterProcessCpuConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPercent = System.Text.Json.JsonEncodedText.Encode("percent"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPercent.TryReadProperty(ref reader, options, PropPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Percent = propPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpu value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPercent, value.Percent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterProcessCpuConverter))] public sealed partial class ClusterProcessCpu { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterProcessCpu(int percent) + { + Percent = percent; + } +#if NET7_0_OR_GREATER + public ClusterProcessCpu() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterProcessCpu() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterProcessCpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Percentage of CPU used across all selected nodes. /// Returns -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("percent")] - public int Percent { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Percent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessOpenFileDescriptors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessOpenFileDescriptors.g.cs index 86fce288f02..4cde99e09eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessOpenFileDescriptors.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessOpenFileDescriptors.g.cs @@ -17,26 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterProcessOpenFileDescriptorsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + Max = propMax.Value, + Min = propMin.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptors value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterProcessOpenFileDescriptorsConverter))] public sealed partial class ClusterProcessOpenFileDescriptors { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterProcessOpenFileDescriptors(long avg, long max, long min) + { + Avg = avg; + Max = max; + Min = min; + } +#if NET7_0_OR_GREATER + public ClusterProcessOpenFileDescriptors() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterProcessOpenFileDescriptors() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterProcessOpenFileDescriptors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Average number of concurrently open file descriptors. /// Returns -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("avg")] - public long Avg { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Avg { get; set; } /// /// @@ -44,8 +125,11 @@ public sealed partial class ClusterProcessOpenFileDescriptors /// Returns -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("max")] - public long Max { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Max { get; set; } /// /// @@ -53,6 +137,9 @@ public sealed partial class ClusterProcessOpenFileDescriptors /// Returns -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("min")] - public long Min { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Min { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessor.g.cs index ad4908eaa76..e774f5e8e81 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterProcessor.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propCurrent = default; + LocalJsonValue propFailed = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Current = propCurrent.Value, + Failed = propFailed.Value, + Time = propTime.Value, + TimeInMillis = propTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterProcessorConverter))] public sealed partial class ClusterProcessor { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } - [JsonInclude, JsonPropertyName("failed")] - public long Failed { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterProcessor(long count, long current, long failed, System.TimeSpan timeInMillis) + { + Count = count; + Current = current; + Failed = failed; + TimeInMillis = timeInMillis; + } +#if NET7_0_OR_GREATER + public ClusterProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Failed { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterShardMetrics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterShardMetrics.g.cs index 7c2dcb2f0ff..541b989dc46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterShardMetrics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ClusterShardMetrics.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ClusterShardMetricsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + + public override Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + Max = propMax.Value, + Min = propMin.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetrics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ClusterShardMetricsConverter))] public sealed partial class ClusterShardMetrics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterShardMetrics(double avg, double max, double min) + { + Avg = avg; + Max = max; + Min = min; + } +#if NET7_0_OR_GREATER + public ClusterShardMetrics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterShardMetrics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterShardMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Mean number of shards in an index, counting only shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("avg")] - public double Avg { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Avg { get; set; } /// /// /// Maximum number of shards in an index, counting only shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("max")] - public double Max { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Max { get; set; } /// /// /// Minimum number of shards in an index, counting only shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("min")] - public double Min { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Min { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplate.g.cs index 65848f2a1e9..d1edb2edcea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplate.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ComponentTemplateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropComponentTemplateNode = System.Text.Json.JsonEncodedText.Encode("component_template"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Cluster.ComponentTemplate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propComponentTemplateNode = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComponentTemplateNode.TryReadProperty(ref reader, options, PropComponentTemplateNode, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ComponentTemplateNode = propComponentTemplateNode.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComponentTemplateNode, value.ComponentTemplateNode, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateConverter))] public sealed partial class ComponentTemplate { - [JsonInclude, JsonPropertyName("component_template")] - public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode ComponentTemplateNode { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplate(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode componentTemplateNode, string name) + { + ComponentTemplateNode = componentTemplateNode; + Name = name; + } +#if NET7_0_OR_GREATER + public ComponentTemplate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ComponentTemplate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ComponentTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode ComponentTemplateNode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateNode.g.cs index ab9a407b846..de6b1400223 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateNode.g.cs @@ -17,220 +17,281 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ComponentTemplateNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeprecated = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deprecated = propDeprecated.Value, + Meta = propMeta.Value, + Template = propTemplate.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeConverter))] public sealed partial class ComponentTemplateNode { - [JsonInclude, JsonPropertyName("deprecated")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateNode(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary template) + { + Template = template; + } +#if NET7_0_OR_GREATER + public ComponentTemplateNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ComponentTemplateNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Deprecated { get; set; } - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Template { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.IDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Template { get; set; } public long? Version { get; set; } } -public sealed partial class ComponentTemplateNodeDescriptor : SerializableDescriptor> +public readonly partial struct ComponentTemplateNodeDescriptor { - internal ComponentTemplateNodeDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode Instance { get; init; } - public ComponentTemplateNodeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateNodeDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode instance) { + Instance = instance; } - private bool? DeprecatedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor TemplateDescriptor { get; set; } - private Action> TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } - - public ComponentTemplateNodeDescriptor Deprecated(bool? deprecated = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateNodeDescriptor() { - DeprecatedValue = deprecated; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ComponentTemplateNodeDescriptor Meta(Func, FluentDictionary> selector) + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode instance) => new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Deprecated(bool? value = true) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Deprecated = value; + return this; } - public ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary template) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta(System.Collections.Generic.IDictionary? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Meta = value; + return this; } - public ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public ComponentTemplateNodeDescriptor Template(Action> configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta(System.Action? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public ComponentTemplateNodeDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor AddMeta(string key, object value) { - VersionValue = version; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary value) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + Instance.Template = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template() + { + Instance.Template = Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor.Build(null); + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(TemplateDescriptorAction), options); - } - else - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template(System.Action>? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor.Build(action); + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ComponentTemplateNodeDescriptor : SerializableDescriptor +public readonly partial struct ComponentTemplateNodeDescriptor { - internal ComponentTemplateNodeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateNodeDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode instance) + { + Instance = instance; + } - public ComponentTemplateNodeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateNodeDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? DeprecatedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode instance) => new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor descriptor) => descriptor.Instance; - public ComponentTemplateNodeDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } - public ComponentTemplateNodeDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary template) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta() { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Meta(System.Action? action) { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public ComponentTemplateNodeDescriptor Template(Action configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor AddMeta(string key, object value) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ComponentTemplateNodeDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary value) { - VersionValue = version; - return Self; + Instance.Template = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template() { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } + Instance.Template = Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor.Build(null); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template(System.Action? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor.Build(action); + return this; + } - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(TemplateDescriptorAction), options); - } - else - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Template(System.Action>? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor.Build(action); + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNodeDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateSummary.g.cs index 7e6398e09e5..34f5e3a29be 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ComponentTemplateSummary.g.cs @@ -17,336 +17,579 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ComponentTemplateSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propMappings = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue?> propSettings = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Lifecycle = propLifecycle.Value, + Mappings = propMappings.Value, + Meta = propMeta.Value, + Settings = propSettings.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryConverter))] public sealed partial class ComponentTemplateSummary { - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } - [JsonInclude, JsonPropertyName("lifecycle")] +#if NET7_0_OR_GREATER + public ComponentTemplateSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + public ComponentTemplateSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IDictionary? Aliases { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; set; } - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Settings { get; set; } public long? Version { get; set; } } -public sealed partial class ComponentTemplateSummaryDescriptor : SerializableDescriptor> +public readonly partial struct ComponentTemplateSummaryDescriptor { - internal ComponentTemplateSummaryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Instance { get; init; } - public ComponentTemplateSummaryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary instance) { + Instance = instance; } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private IDictionary> SettingsValue { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateSummaryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary instance) => new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor descriptor) => descriptor.Instance; - public ComponentTemplateSummaryDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases = value; + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? lifecycle) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases() { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition.Build(null); + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(System.Action>? action) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition.Build(action); + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Action configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition value) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(string key) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null) } }; + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(params string[] keys) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Action> configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + return this; } - public ComponentTemplateSummaryDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key, System.Action>? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; } - public ComponentTemplateSummaryDescriptor Settings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? value) { - SettingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Lifecycle = value; + return this; } - public ComponentTemplateSummaryDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle() { - VersionValue = version; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle(System.Action? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(action); + return this; + } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.Mappings = value; + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings() + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings(System.Action>? action) + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } - if (SettingsValue is not null) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Settings = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); } - if (VersionValue.HasValue) + Instance.Settings = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); + return new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ComponentTemplateSummaryDescriptor : SerializableDescriptor +public readonly partial struct ComponentTemplateSummaryDescriptor { - internal ComponentTemplateSummaryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary instance) + { + Instance = instance; + } - public ComponentTemplateSummaryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ComponentTemplateSummaryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private IDictionary SettingsValue { get; set; } - private long? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary instance) => new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor descriptor) => descriptor.Instance; - public ComponentTemplateSummaryDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(System.Collections.Generic.IDictionary? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = value; + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? lifecycle) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases() { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition.Build(null); + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(System.Action? action) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition.Build(action); + return this; } - public ComponentTemplateSummaryDescriptor Lifecycle(Action configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(System.Action>? action) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAliasDefinition.Build(action); + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(string key) { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null) } }; + return this; } - public ComponentTemplateSummaryDescriptor Mappings(Action configure) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Aliases(params string[] keys) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; } - public ComponentTemplateSummaryDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(null)); + return this; } - public ComponentTemplateSummaryDescriptor Settings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key, System.Action? action) { - SettingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; } - public ComponentTemplateSummaryDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddAlias(string key, System.Action>? action) { - VersionValue = version; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor.Build(action)); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? value) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } + Instance.Lifecycle = value; + return this; + } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle() + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(null); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Lifecycle(System.Action? action) + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.Mappings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings() + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings(System.Action? action) + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Mappings(System.Action>? action) + { + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } - if (SettingsValue is not null) + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(System.Collections.Generic.IDictionary? value) + { + Instance.Settings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings() + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameIndexSettings.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Settings = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Settings(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); } - if (VersionValue.HasValue) + Instance.Settings = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor AddSetting(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Settings ??= new System.Collections.Generic.Dictionary(); + Instance.Settings.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); + return new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummaryDescriptor(new Elastic.Clients.Elasticsearch.Cluster.ComponentTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CurrentNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CurrentNode.g.cs index 8943689f868..ce2f43055c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CurrentNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/CurrentNode.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class CurrentNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropWeightRanking = System.Text.Json.JsonEncodedText.Encode("weight_ranking"); + + public override Elastic.Clients.Elasticsearch.Cluster.CurrentNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propWeightRanking = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propWeightRanking.TryReadProperty(ref reader, options, PropWeightRanking, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.CurrentNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + Id = propId.Value, + Name = propName.Value, + Roles = propRoles.Value, + TransportAddress = propTransportAddress.Value, + WeightRanking = propWeightRanking.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.CurrentNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropWeightRanking, value.WeightRanking, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.CurrentNodeConverter))] public sealed partial class CurrentNode { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } - [JsonInclude, JsonPropertyName("weight_ranking")] - public int WeightRanking { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CurrentNode(System.Collections.Generic.IReadOnlyDictionary attributes, string id, string name, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, int weightRanking) + { + Attributes = attributes; + Id = id; + Name = name; + Roles = roles; + TransportAddress = transportAddress; + WeightRanking = weightRanking; + } +#if NET7_0_OR_GREATER + public CurrentNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CurrentNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CurrentNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int WeightRanking { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/DiskUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/DiskUsage.g.cs index 557f72de4a9..70a42e0c196 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/DiskUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/DiskUsage.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class DiskUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFreeBytes = System.Text.Json.JsonEncodedText.Encode("free_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreeDiskPercent = System.Text.Json.JsonEncodedText.Encode("free_disk_percent"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropTotalBytes = System.Text.Json.JsonEncodedText.Encode("total_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedBytes = System.Text.Json.JsonEncodedText.Encode("used_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedDiskPercent = System.Text.Json.JsonEncodedText.Encode("used_disk_percent"); + + public override Elastic.Clients.Elasticsearch.Cluster.DiskUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFreeBytes = default; + LocalJsonValue propFreeDiskPercent = default; + LocalJsonValue propPath = default; + LocalJsonValue propTotalBytes = default; + LocalJsonValue propUsedBytes = default; + LocalJsonValue propUsedDiskPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFreeBytes.TryReadProperty(ref reader, options, PropFreeBytes, null)) + { + continue; + } + + if (propFreeDiskPercent.TryReadProperty(ref reader, options, PropFreeDiskPercent, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propTotalBytes.TryReadProperty(ref reader, options, PropTotalBytes, null)) + { + continue; + } + + if (propUsedBytes.TryReadProperty(ref reader, options, PropUsedBytes, null)) + { + continue; + } + + if (propUsedDiskPercent.TryReadProperty(ref reader, options, PropUsedDiskPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.DiskUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FreeBytes = propFreeBytes.Value, + FreeDiskPercent = propFreeDiskPercent.Value, + Path = propPath.Value, + TotalBytes = propTotalBytes.Value, + UsedBytes = propUsedBytes.Value, + UsedDiskPercent = propUsedDiskPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.DiskUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFreeBytes, value.FreeBytes, null, null); + writer.WriteProperty(options, PropFreeDiskPercent, value.FreeDiskPercent, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropTotalBytes, value.TotalBytes, null, null); + writer.WriteProperty(options, PropUsedBytes, value.UsedBytes, null, null); + writer.WriteProperty(options, PropUsedDiskPercent, value.UsedDiskPercent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DiskUsageConverter))] public sealed partial class DiskUsage { - [JsonInclude, JsonPropertyName("free_bytes")] - public long FreeBytes { get; init; } - [JsonInclude, JsonPropertyName("free_disk_percent")] - public double FreeDiskPercent { get; init; } - [JsonInclude, JsonPropertyName("path")] - public string Path { get; init; } - [JsonInclude, JsonPropertyName("total_bytes")] - public long TotalBytes { get; init; } - [JsonInclude, JsonPropertyName("used_bytes")] - public long UsedBytes { get; init; } - [JsonInclude, JsonPropertyName("used_disk_percent")] - public double UsedDiskPercent { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskUsage(long freeBytes, double freeDiskPercent, string path, long totalBytes, long usedBytes, double usedDiskPercent) + { + FreeBytes = freeBytes; + FreeDiskPercent = freeDiskPercent; + Path = path; + TotalBytes = totalBytes; + UsedBytes = usedBytes; + UsedDiskPercent = usedDiskPercent; + } +#if NET7_0_OR_GREATER + public DiskUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DiskUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiskUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long FreeBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double FreeDiskPercent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Path { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long UsedBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double UsedDiskPercent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypes.g.cs index 5df2efc5a7e..ca78a596678 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypes.g.cs @@ -17,71 +17,190 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class FieldTypesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText PropIndexedVectorCount = System.Text.Json.JsonEncodedText.Encode("indexed_vector_count"); + private static readonly System.Text.Json.JsonEncodedText PropIndexedVectorDimMax = System.Text.Json.JsonEncodedText.Encode("indexed_vector_dim_max"); + private static readonly System.Text.Json.JsonEncodedText PropIndexedVectorDimMin = System.Text.Json.JsonEncodedText.Encode("indexed_vector_dim_min"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropScriptCount = System.Text.Json.JsonEncodedText.Encode("script_count"); + + public override Elastic.Clients.Elasticsearch.Cluster.FieldTypes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propIndexCount = default; + LocalJsonValue propIndexedVectorCount = default; + LocalJsonValue propIndexedVectorDimMax = default; + LocalJsonValue propIndexedVectorDimMin = default; + LocalJsonValue propName = default; + LocalJsonValue propScriptCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propIndexCount.TryReadProperty(ref reader, options, PropIndexCount, null)) + { + continue; + } + + if (propIndexedVectorCount.TryReadProperty(ref reader, options, PropIndexedVectorCount, null)) + { + continue; + } + + if (propIndexedVectorDimMax.TryReadProperty(ref reader, options, PropIndexedVectorDimMax, null)) + { + continue; + } + + if (propIndexedVectorDimMin.TryReadProperty(ref reader, options, PropIndexedVectorDimMin, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propScriptCount.TryReadProperty(ref reader, options, PropScriptCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.FieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + IndexCount = propIndexCount.Value, + IndexedVectorCount = propIndexedVectorCount.Value, + IndexedVectorDimMax = propIndexedVectorDimMax.Value, + IndexedVectorDimMin = propIndexedVectorDimMin.Value, + Name = propName.Value, + ScriptCount = propScriptCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.FieldTypes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropIndexCount, value.IndexCount, null, null); + writer.WriteProperty(options, PropIndexedVectorCount, value.IndexedVectorCount, null, null); + writer.WriteProperty(options, PropIndexedVectorDimMax, value.IndexedVectorDimMax, null, null); + writer.WriteProperty(options, PropIndexedVectorDimMin, value.IndexedVectorDimMin, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropScriptCount, value.ScriptCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.FieldTypesConverter))] public sealed partial class FieldTypes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldTypes(int count, int indexCount, string name) + { + Count = count; + IndexCount = indexCount; + Name = name; + } +#if NET7_0_OR_GREATER + public FieldTypes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldTypes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of occurrences of the field type in selected nodes. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The number of indices containing the field type in selected nodes. /// /// - [JsonInclude, JsonPropertyName("index_count")] - public int IndexCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int IndexCount { get; set; } /// /// /// For dense_vector field types, number of indexed vector types in selected nodes. /// /// - [JsonInclude, JsonPropertyName("indexed_vector_count")] - public long? IndexedVectorCount { get; init; } + public long? IndexedVectorCount { get; set; } /// /// /// For dense_vector field types, the maximum dimension of all indexed vector types in selected nodes. /// /// - [JsonInclude, JsonPropertyName("indexed_vector_dim_max")] - public long? IndexedVectorDimMax { get; init; } + public long? IndexedVectorDimMax { get; set; } /// /// /// For dense_vector field types, the minimum dimension of all indexed vector types in selected nodes. /// /// - [JsonInclude, JsonPropertyName("indexed_vector_dim_min")] - public long? IndexedVectorDimMin { get; init; } + public long? IndexedVectorDimMin { get; set; } /// /// /// The name for the field type in selected nodes. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// The number of fields that declare a script. /// /// - [JsonInclude, JsonPropertyName("script_count")] - public int? ScriptCount { get; init; } + public int? ScriptCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypesMappings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypesMappings.g.cs index 8e9caeac638..7048b04cb1b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypesMappings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/FieldTypesMappings.g.cs @@ -17,63 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class FieldTypesMappingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldTypes = System.Text.Json.JsonEncodedText.Encode("field_types"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeFieldTypes = System.Text.Json.JsonEncodedText.Encode("runtime_field_types"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDeduplicatedFieldCount = System.Text.Json.JsonEncodedText.Encode("total_deduplicated_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDeduplicatedMappingSize = System.Text.Json.JsonEncodedText.Encode("total_deduplicated_mapping_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDeduplicatedMappingSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_deduplicated_mapping_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalFieldCount = System.Text.Json.JsonEncodedText.Encode("total_field_count"); + + public override Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFieldTypes = default; + LocalJsonValue?> propRuntimeFieldTypes = default; + LocalJsonValue propTotalDeduplicatedFieldCount = default; + LocalJsonValue propTotalDeduplicatedMappingSize = default; + LocalJsonValue propTotalDeduplicatedMappingSizeInBytes = default; + LocalJsonValue propTotalFieldCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldTypes.TryReadProperty(ref reader, options, PropFieldTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRuntimeFieldTypes.TryReadProperty(ref reader, options, PropRuntimeFieldTypes, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTotalDeduplicatedFieldCount.TryReadProperty(ref reader, options, PropTotalDeduplicatedFieldCount, null)) + { + continue; + } + + if (propTotalDeduplicatedMappingSize.TryReadProperty(ref reader, options, PropTotalDeduplicatedMappingSize, null)) + { + continue; + } + + if (propTotalDeduplicatedMappingSizeInBytes.TryReadProperty(ref reader, options, PropTotalDeduplicatedMappingSizeInBytes, null)) + { + continue; + } + + if (propTotalFieldCount.TryReadProperty(ref reader, options, PropTotalFieldCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldTypes = propFieldTypes.Value, + RuntimeFieldTypes = propRuntimeFieldTypes.Value, + TotalDeduplicatedFieldCount = propTotalDeduplicatedFieldCount.Value, + TotalDeduplicatedMappingSize = propTotalDeduplicatedMappingSize.Value, + TotalDeduplicatedMappingSizeInBytes = propTotalDeduplicatedMappingSizeInBytes.Value, + TotalFieldCount = propTotalFieldCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldTypes, value.FieldTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRuntimeFieldTypes, value.RuntimeFieldTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotalDeduplicatedFieldCount, value.TotalDeduplicatedFieldCount, null, null); + writer.WriteProperty(options, PropTotalDeduplicatedMappingSize, value.TotalDeduplicatedMappingSize, null, null); + writer.WriteProperty(options, PropTotalDeduplicatedMappingSizeInBytes, value.TotalDeduplicatedMappingSizeInBytes, null, null); + writer.WriteProperty(options, PropTotalFieldCount, value.TotalFieldCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.FieldTypesMappingsConverter))] public sealed partial class FieldTypesMappings { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldTypesMappings(System.Collections.Generic.IReadOnlyCollection fieldTypes) + { + FieldTypes = fieldTypes; + } +#if NET7_0_OR_GREATER + public FieldTypesMappings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldTypesMappings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldTypesMappings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about field data types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("field_types")] - public IReadOnlyCollection FieldTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FieldTypes { get; set; } /// /// /// Contains statistics about runtime field data types used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("runtime_field_types")] - public IReadOnlyCollection? RuntimeFieldTypes { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RuntimeFieldTypes { get; set; } /// /// /// Total number of fields in all non-system indices, accounting for mapping deduplication. /// /// - [JsonInclude, JsonPropertyName("total_deduplicated_field_count")] - public int? TotalDeduplicatedFieldCount { get; init; } + public int? TotalDeduplicatedFieldCount { get; set; } /// /// /// Total size of all mappings after deduplication and compression. /// /// - [JsonInclude, JsonPropertyName("total_deduplicated_mapping_size")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalDeduplicatedMappingSize { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalDeduplicatedMappingSize { get; set; } /// /// /// Total size of all mappings, in bytes, after deduplication and compression. /// /// - [JsonInclude, JsonPropertyName("total_deduplicated_mapping_size_in_bytes")] - public long? TotalDeduplicatedMappingSizeInBytes { get; init; } + public long? TotalDeduplicatedMappingSizeInBytes { get; set; } /// /// /// Total number of fields in all non-system indices. /// /// - [JsonInclude, JsonPropertyName("total_field_count")] - public int? TotalFieldCount { get; init; } + public int? TotalFieldCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexHealthStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexHealthStats.g.cs index a978568c8ec..0fd83e39b2f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexHealthStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexHealthStats.g.cs @@ -17,36 +17,209 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class IndexHealthStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActivePrimaryShards = System.Text.Json.JsonEncodedText.Encode("active_primary_shards"); + private static readonly System.Text.Json.JsonEncodedText PropActiveShards = System.Text.Json.JsonEncodedText.Encode("active_shards"); + private static readonly System.Text.Json.JsonEncodedText PropInitializingShards = System.Text.Json.JsonEncodedText.Encode("initializing_shards"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfReplicas = System.Text.Json.JsonEncodedText.Encode("number_of_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfShards = System.Text.Json.JsonEncodedText.Encode("number_of_shards"); + private static readonly System.Text.Json.JsonEncodedText PropRelocatingShards = System.Text.Json.JsonEncodedText.Encode("relocating_shards"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedPrimaryShards = System.Text.Json.JsonEncodedText.Encode("unassigned_primary_shards"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedShards = System.Text.Json.JsonEncodedText.Encode("unassigned_shards"); + + public override Elastic.Clients.Elasticsearch.Cluster.IndexHealthStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActivePrimaryShards = default; + LocalJsonValue propActiveShards = default; + LocalJsonValue propInitializingShards = default; + LocalJsonValue propNumberOfReplicas = default; + LocalJsonValue propNumberOfShards = default; + LocalJsonValue propRelocatingShards = default; + LocalJsonValue?> propShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propUnassignedPrimaryShards = default; + LocalJsonValue propUnassignedShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActivePrimaryShards.TryReadProperty(ref reader, options, PropActivePrimaryShards, null)) + { + continue; + } + + if (propActiveShards.TryReadProperty(ref reader, options, PropActiveShards, null)) + { + continue; + } + + if (propInitializingShards.TryReadProperty(ref reader, options, PropInitializingShards, null)) + { + continue; + } + + if (propNumberOfReplicas.TryReadProperty(ref reader, options, PropNumberOfReplicas, null)) + { + continue; + } + + if (propNumberOfShards.TryReadProperty(ref reader, options, PropNumberOfShards, null)) + { + continue; + } + + if (propRelocatingShards.TryReadProperty(ref reader, options, PropRelocatingShards, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propUnassignedPrimaryShards.TryReadProperty(ref reader, options, PropUnassignedPrimaryShards, null)) + { + continue; + } + + if (propUnassignedShards.TryReadProperty(ref reader, options, PropUnassignedShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.IndexHealthStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActivePrimaryShards = propActivePrimaryShards.Value, + ActiveShards = propActiveShards.Value, + InitializingShards = propInitializingShards.Value, + NumberOfReplicas = propNumberOfReplicas.Value, + NumberOfShards = propNumberOfShards.Value, + RelocatingShards = propRelocatingShards.Value, + Shards = propShards.Value, + Status = propStatus.Value, + UnassignedPrimaryShards = propUnassignedPrimaryShards.Value, + UnassignedShards = propUnassignedShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.IndexHealthStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActivePrimaryShards, value.ActivePrimaryShards, null, null); + writer.WriteProperty(options, PropActiveShards, value.ActiveShards, null, null); + writer.WriteProperty(options, PropInitializingShards, value.InitializingShards, null, null); + writer.WriteProperty(options, PropNumberOfReplicas, value.NumberOfReplicas, null, null); + writer.WriteProperty(options, PropNumberOfShards, value.NumberOfShards, null, null); + writer.WriteProperty(options, PropRelocatingShards, value.RelocatingShards, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropUnassignedPrimaryShards, value.UnassignedPrimaryShards, null, null); + writer.WriteProperty(options, PropUnassignedShards, value.UnassignedShards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndexHealthStatsConverter))] public sealed partial class IndexHealthStats { - [JsonInclude, JsonPropertyName("active_primary_shards")] - public int ActivePrimaryShards { get; init; } - [JsonInclude, JsonPropertyName("active_shards")] - public int ActiveShards { get; init; } - [JsonInclude, JsonPropertyName("initializing_shards")] - public int InitializingShards { get; init; } - [JsonInclude, JsonPropertyName("number_of_replicas")] - public int NumberOfReplicas { get; init; } - [JsonInclude, JsonPropertyName("number_of_shards")] - public int NumberOfShards { get; init; } - [JsonInclude, JsonPropertyName("relocating_shards")] - public int RelocatingShards { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary? Shards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("unassigned_primary_shards")] - public int UnassignedPrimaryShards { get; init; } - [JsonInclude, JsonPropertyName("unassigned_shards")] - public int UnassignedShards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexHealthStats(int activePrimaryShards, int activeShards, int initializingShards, int numberOfReplicas, int numberOfShards, int relocatingShards, Elastic.Clients.Elasticsearch.HealthStatus status, int unassignedPrimaryShards, int unassignedShards) + { + ActivePrimaryShards = activePrimaryShards; + ActiveShards = activeShards; + InitializingShards = initializingShards; + NumberOfReplicas = numberOfReplicas; + NumberOfShards = numberOfShards; + RelocatingShards = relocatingShards; + Status = status; + UnassignedPrimaryShards = unassignedPrimaryShards; + UnassignedShards = unassignedShards; + } +#if NET7_0_OR_GREATER + public IndexHealthStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexHealthStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexHealthStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int ActivePrimaryShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ActiveShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int InitializingShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfReplicas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RelocatingShards { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedPrimaryShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedShards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressure.g.cs index 34389f922d8..5cb4d4c748f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressure.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class IndexingPressureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + + public override Elastic.Clients.Elasticsearch.Cluster.IndexingPressure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemory = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Memory = propMemory.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.IndexingPressure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndexingPressureConverter))] public sealed partial class IndexingPressure { - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory Memory { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressure(Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory memory) + { + Memory = memory; + } +#if NET7_0_OR_GREATER + public IndexingPressure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexingPressure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory Memory { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemory.g.cs index d46aa89e579..7ce1c7b24a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemory.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class IndexingPressureMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropLimitInBytes = System.Text.Json.JsonEncodedText.Encode("limit_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrent = default; + LocalJsonValue propLimitInBytes = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propLimitInBytes.TryReadProperty(ref reader, options, PropLimitInBytes, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Current = propCurrent.Value, + LimitInBytes = propLimitInBytes.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropLimitInBytes, value.LimitInBytes, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemoryConverter))] public sealed partial class IndexingPressureMemory { - [JsonInclude, JsonPropertyName("current")] - public Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary Current { get; init; } - [JsonInclude, JsonPropertyName("limit_in_bytes")] - public long LimitInBytes { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureMemory(Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary current, long limitInBytes, Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary total) + { + Current = current; + LimitInBytes = limitInBytes; + Total = total; + } +#if NET7_0_OR_GREATER + public IndexingPressureMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexingPressureMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary Current { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LimitInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemorySummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemorySummary.g.cs index 31340f1b41e..70050ad66b4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemorySummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndexingPressureMemorySummary.g.cs @@ -17,32 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class IndexingPressureMemorySummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllInBytes = System.Text.Json.JsonEncodedText.Encode("all_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCombinedCoordinatingAndPrimaryInBytes = System.Text.Json.JsonEncodedText.Encode("combined_coordinating_and_primary_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingInBytes = System.Text.Json.JsonEncodedText.Encode("coordinating_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingRejections = System.Text.Json.JsonEncodedText.Encode("coordinating_rejections"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryInBytes = System.Text.Json.JsonEncodedText.Encode("primary_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryRejections = System.Text.Json.JsonEncodedText.Encode("primary_rejections"); + private static readonly System.Text.Json.JsonEncodedText PropReplicaInBytes = System.Text.Json.JsonEncodedText.Encode("replica_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropReplicaRejections = System.Text.Json.JsonEncodedText.Encode("replica_rejections"); + + public override Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllInBytes = default; + LocalJsonValue propCombinedCoordinatingAndPrimaryInBytes = default; + LocalJsonValue propCoordinatingInBytes = default; + LocalJsonValue propCoordinatingRejections = default; + LocalJsonValue propPrimaryInBytes = default; + LocalJsonValue propPrimaryRejections = default; + LocalJsonValue propReplicaInBytes = default; + LocalJsonValue propReplicaRejections = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllInBytes.TryReadProperty(ref reader, options, PropAllInBytes, null)) + { + continue; + } + + if (propCombinedCoordinatingAndPrimaryInBytes.TryReadProperty(ref reader, options, PropCombinedCoordinatingAndPrimaryInBytes, null)) + { + continue; + } + + if (propCoordinatingInBytes.TryReadProperty(ref reader, options, PropCoordinatingInBytes, null)) + { + continue; + } + + if (propCoordinatingRejections.TryReadProperty(ref reader, options, PropCoordinatingRejections, null)) + { + continue; + } + + if (propPrimaryInBytes.TryReadProperty(ref reader, options, PropPrimaryInBytes, null)) + { + continue; + } + + if (propPrimaryRejections.TryReadProperty(ref reader, options, PropPrimaryRejections, null)) + { + continue; + } + + if (propReplicaInBytes.TryReadProperty(ref reader, options, PropReplicaInBytes, null)) + { + continue; + } + + if (propReplicaRejections.TryReadProperty(ref reader, options, PropReplicaRejections, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllInBytes = propAllInBytes.Value, + CombinedCoordinatingAndPrimaryInBytes = propCombinedCoordinatingAndPrimaryInBytes.Value, + CoordinatingInBytes = propCoordinatingInBytes.Value, + CoordinatingRejections = propCoordinatingRejections.Value, + PrimaryInBytes = propPrimaryInBytes.Value, + PrimaryRejections = propPrimaryRejections.Value, + ReplicaInBytes = propReplicaInBytes.Value, + ReplicaRejections = propReplicaRejections.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllInBytes, value.AllInBytes, null, null); + writer.WriteProperty(options, PropCombinedCoordinatingAndPrimaryInBytes, value.CombinedCoordinatingAndPrimaryInBytes, null, null); + writer.WriteProperty(options, PropCoordinatingInBytes, value.CoordinatingInBytes, null, null); + writer.WriteProperty(options, PropCoordinatingRejections, value.CoordinatingRejections, null, null); + writer.WriteProperty(options, PropPrimaryInBytes, value.PrimaryInBytes, null, null); + writer.WriteProperty(options, PropPrimaryRejections, value.PrimaryRejections, null, null); + writer.WriteProperty(options, PropReplicaInBytes, value.ReplicaInBytes, null, null); + writer.WriteProperty(options, PropReplicaRejections, value.ReplicaRejections, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndexingPressureMemorySummaryConverter))] public sealed partial class IndexingPressureMemorySummary { - [JsonInclude, JsonPropertyName("all_in_bytes")] - public long AllInBytes { get; init; } - [JsonInclude, JsonPropertyName("combined_coordinating_and_primary_in_bytes")] - public long CombinedCoordinatingAndPrimaryInBytes { get; init; } - [JsonInclude, JsonPropertyName("coordinating_in_bytes")] - public long CoordinatingInBytes { get; init; } - [JsonInclude, JsonPropertyName("coordinating_rejections")] - public long? CoordinatingRejections { get; init; } - [JsonInclude, JsonPropertyName("primary_in_bytes")] - public long PrimaryInBytes { get; init; } - [JsonInclude, JsonPropertyName("primary_rejections")] - public long? PrimaryRejections { get; init; } - [JsonInclude, JsonPropertyName("replica_in_bytes")] - public long ReplicaInBytes { get; init; } - [JsonInclude, JsonPropertyName("replica_rejections")] - public long? ReplicaRejections { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureMemorySummary(long allInBytes, long combinedCoordinatingAndPrimaryInBytes, long coordinatingInBytes, long primaryInBytes, long replicaInBytes) + { + AllInBytes = allInBytes; + CombinedCoordinatingAndPrimaryInBytes = combinedCoordinatingAndPrimaryInBytes; + CoordinatingInBytes = coordinatingInBytes; + PrimaryInBytes = primaryInBytes; + ReplicaInBytes = replicaInBytes; + } +#if NET7_0_OR_GREATER + public IndexingPressureMemorySummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexingPressureMemorySummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressureMemorySummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long AllInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CombinedCoordinatingAndPrimaryInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CoordinatingInBytes { get; set; } + public long? CoordinatingRejections { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryInBytes { get; set; } + public long? PrimaryRejections { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReplicaInBytes { get; set; } + public long? ReplicaRejections { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndicesVersions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndicesVersions.g.cs index a3e294fae8c..9ebf0cfb08f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndicesVersions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/IndicesVersions.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class IndicesVersionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryShardCount = System.Text.Json.JsonEncodedText.Encode("primary_shard_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalPrimaryBytes = System.Text.Json.JsonEncodedText.Encode("total_primary_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Cluster.IndicesVersions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexCount = default; + LocalJsonValue propPrimaryShardCount = default; + LocalJsonValue propTotalPrimaryBytes = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexCount.TryReadProperty(ref reader, options, PropIndexCount, null)) + { + continue; + } + + if (propPrimaryShardCount.TryReadProperty(ref reader, options, PropPrimaryShardCount, null)) + { + continue; + } + + if (propTotalPrimaryBytes.TryReadProperty(ref reader, options, PropTotalPrimaryBytes, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.IndicesVersions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexCount = propIndexCount.Value, + PrimaryShardCount = propPrimaryShardCount.Value, + TotalPrimaryBytes = propTotalPrimaryBytes.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.IndicesVersions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexCount, value.IndexCount, null, null); + writer.WriteProperty(options, PropPrimaryShardCount, value.PrimaryShardCount, null, null); + writer.WriteProperty(options, PropTotalPrimaryBytes, value.TotalPrimaryBytes, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.IndicesVersionsConverter))] public sealed partial class IndicesVersions { - [JsonInclude, JsonPropertyName("index_count")] - public int IndexCount { get; init; } - [JsonInclude, JsonPropertyName("primary_shard_count")] - public int PrimaryShardCount { get; init; } - [JsonInclude, JsonPropertyName("total_primary_bytes")] - public long TotalPrimaryBytes { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesVersions(int indexCount, int primaryShardCount, long totalPrimaryBytes, string version) + { + IndexCount = indexCount; + PrimaryShardCount = primaryShardCount; + TotalPrimaryBytes = totalPrimaryBytes; + Version = version; + } +#if NET7_0_OR_GREATER + public IndicesVersions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndicesVersions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesVersions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int IndexCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int PrimaryShardCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalPrimaryBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs index 29ecfdb8296..6d913d3667e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeAllocationExplanation.g.cs @@ -17,34 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class NodeAllocationExplanationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeciders = System.Text.Json.JsonEncodedText.Encode("deciders"); + private static readonly System.Text.Json.JsonEncodedText PropNodeAttributes = System.Text.Json.JsonEncodedText.Encode("node_attributes"); + private static readonly System.Text.Json.JsonEncodedText PropNodeDecision = System.Text.Json.JsonEncodedText.Encode("node_decision"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropNodeName = System.Text.Json.JsonEncodedText.Encode("node_name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropWeightRanking = System.Text.Json.JsonEncodedText.Encode("weight_ranking"); + + public override Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDeciders = default; + LocalJsonValue> propNodeAttributes = default; + LocalJsonValue propNodeDecision = default; + LocalJsonValue propNodeId = default; + LocalJsonValue propNodeName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propStore = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propWeightRanking = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeciders.TryReadProperty(ref reader, options, PropDeciders, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propNodeAttributes.TryReadProperty(ref reader, options, PropNodeAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeDecision.TryReadProperty(ref reader, options, PropNodeDecision, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propNodeName.TryReadProperty(ref reader, options, PropNodeName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propWeightRanking.TryReadProperty(ref reader, options, PropWeightRanking, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deciders = propDeciders.Value, + NodeAttributes = propNodeAttributes.Value, + NodeDecision = propNodeDecision.Value, + NodeId = propNodeId.Value, + NodeName = propNodeName.Value, + Roles = propRoles.Value, + Store = propStore.Value, + TransportAddress = propTransportAddress.Value, + WeightRanking = propWeightRanking.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeciders, value.Deciders, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNodeAttributes, value.NodeAttributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeDecision, value.NodeDecision, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropNodeName, value.NodeName, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropWeightRanking, value.WeightRanking, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.NodeAllocationExplanationConverter))] public sealed partial class NodeAllocationExplanation { - [JsonInclude, JsonPropertyName("deciders")] - public IReadOnlyCollection Deciders { get; init; } - [JsonInclude, JsonPropertyName("node_attributes")] - public IReadOnlyDictionary NodeAttributes { get; init; } - [JsonInclude, JsonPropertyName("node_decision")] - public Elastic.Clients.Elasticsearch.Cluster.Decision NodeDecision { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("node_name")] - public string NodeName { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("store")] - public Elastic.Clients.Elasticsearch.Cluster.AllocationStore? Store { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } - [JsonInclude, JsonPropertyName("weight_ranking")] - public int WeightRanking { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeAllocationExplanation(System.Collections.Generic.IReadOnlyCollection deciders, System.Collections.Generic.IReadOnlyDictionary nodeAttributes, Elastic.Clients.Elasticsearch.Cluster.Decision nodeDecision, string nodeId, string nodeName, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, int weightRanking) + { + Deciders = deciders; + NodeAttributes = nodeAttributes; + NodeDecision = nodeDecision; + NodeId = nodeId; + NodeName = nodeName; + Roles = roles; + TransportAddress = transportAddress; + WeightRanking = weightRanking; + } +#if NET7_0_OR_GREATER + public NodeAllocationExplanation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeAllocationExplanation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeAllocationExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Deciders { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary NodeAttributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.Decision NodeDecision { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.AllocationStore? Store { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int WeightRanking { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeDiskUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeDiskUsage.g.cs index 19c4c118637..3d2fcb71ae7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeDiskUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodeDiskUsage.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class NodeDiskUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLeastAvailable = System.Text.Json.JsonEncodedText.Encode("least_available"); + private static readonly System.Text.Json.JsonEncodedText PropMostAvailable = System.Text.Json.JsonEncodedText.Encode("most_available"); + private static readonly System.Text.Json.JsonEncodedText PropNodeName = System.Text.Json.JsonEncodedText.Encode("node_name"); + + public override Elastic.Clients.Elasticsearch.Cluster.NodeDiskUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLeastAvailable = default; + LocalJsonValue propMostAvailable = default; + LocalJsonValue propNodeName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLeastAvailable.TryReadProperty(ref reader, options, PropLeastAvailable, null)) + { + continue; + } + + if (propMostAvailable.TryReadProperty(ref reader, options, PropMostAvailable, null)) + { + continue; + } + + if (propNodeName.TryReadProperty(ref reader, options, PropNodeName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.NodeDiskUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + LeastAvailable = propLeastAvailable.Value, + MostAvailable = propMostAvailable.Value, + NodeName = propNodeName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.NodeDiskUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLeastAvailable, value.LeastAvailable, null, null); + writer.WriteProperty(options, PropMostAvailable, value.MostAvailable, null, null); + writer.WriteProperty(options, PropNodeName, value.NodeName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.NodeDiskUsageConverter))] public sealed partial class NodeDiskUsage { - [JsonInclude, JsonPropertyName("least_available")] - public Elastic.Clients.Elasticsearch.Cluster.DiskUsage LeastAvailable { get; init; } - [JsonInclude, JsonPropertyName("most_available")] - public Elastic.Clients.Elasticsearch.Cluster.DiskUsage MostAvailable { get; init; } - [JsonInclude, JsonPropertyName("node_name")] - public string NodeName { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeDiskUsage(Elastic.Clients.Elasticsearch.Cluster.DiskUsage leastAvailable, Elastic.Clients.Elasticsearch.Cluster.DiskUsage mostAvailable, string nodeName) + { + LeastAvailable = leastAvailable; + MostAvailable = mostAvailable; + NodeName = nodeName; + } +#if NET7_0_OR_GREATER + public NodeDiskUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeDiskUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeDiskUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.DiskUsage LeastAvailable { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.DiskUsage MostAvailable { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeName { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodePackagingType.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodePackagingType.g.cs index c2593e716a5..18282d0f003 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodePackagingType.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/NodePackagingType.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class NodePackagingTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropFlavor = System.Text.Json.JsonEncodedText.Encode("flavor"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Cluster.NodePackagingType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propFlavor = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propFlavor.TryReadProperty(ref reader, options, PropFlavor, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.NodePackagingType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Flavor = propFlavor.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.NodePackagingType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropFlavor, value.Flavor, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.NodePackagingTypeConverter))] public sealed partial class NodePackagingType { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodePackagingType(int count, string flavor, string type) + { + Count = count; + Flavor = flavor; + Type = type; + } +#if NET7_0_OR_GREATER + public NodePackagingType() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodePackagingType() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodePackagingType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of selected nodes using the distribution flavor and file type. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Type of Elasticsearch distribution. This is always default. /// /// - [JsonInclude, JsonPropertyName("flavor")] - public string Flavor { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Flavor { get; set; } /// /// /// File type (such as tar or zip) used for the distribution package. /// /// - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/OperatingSystemMemoryInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/OperatingSystemMemoryInfo.g.cs index c3a476e45f1..a4db1ad0c53 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/OperatingSystemMemoryInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/OperatingSystemMemoryInfo.g.cs @@ -17,63 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class OperatingSystemMemoryInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdjustedTotalInBytes = System.Text.Json.JsonEncodedText.Encode("adjusted_total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreePercent = System.Text.Json.JsonEncodedText.Encode("free_percent"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedInBytes = System.Text.Json.JsonEncodedText.Encode("used_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedPercent = System.Text.Json.JsonEncodedText.Encode("used_percent"); + + public override Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdjustedTotalInBytes = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propFreePercent = default; + LocalJsonValue propTotalInBytes = default; + LocalJsonValue propUsedInBytes = default; + LocalJsonValue propUsedPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdjustedTotalInBytes.TryReadProperty(ref reader, options, PropAdjustedTotalInBytes, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propFreePercent.TryReadProperty(ref reader, options, PropFreePercent, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (propUsedInBytes.TryReadProperty(ref reader, options, PropUsedInBytes, null)) + { + continue; + } + + if (propUsedPercent.TryReadProperty(ref reader, options, PropUsedPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdjustedTotalInBytes = propAdjustedTotalInBytes.Value, + FreeInBytes = propFreeInBytes.Value, + FreePercent = propFreePercent.Value, + TotalInBytes = propTotalInBytes.Value, + UsedInBytes = propUsedInBytes.Value, + UsedPercent = propUsedPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdjustedTotalInBytes, value.AdjustedTotalInBytes, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropFreePercent, value.FreePercent, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteProperty(options, PropUsedInBytes, value.UsedInBytes, null, null); + writer.WriteProperty(options, PropUsedPercent, value.UsedPercent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.OperatingSystemMemoryInfoConverter))] public sealed partial class OperatingSystemMemoryInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OperatingSystemMemoryInfo(long freeInBytes, int freePercent, long totalInBytes, long usedInBytes, int usedPercent) + { + FreeInBytes = freeInBytes; + FreePercent = freePercent; + TotalInBytes = totalInBytes; + UsedInBytes = usedInBytes; + UsedPercent = usedPercent; + } +#if NET7_0_OR_GREATER + public OperatingSystemMemoryInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OperatingSystemMemoryInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OperatingSystemMemoryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total amount, in bytes, of memory across all selected nodes, but using the value specified using the es.total_memory_bytes system property instead of measured total memory for those nodes where that system property was set. /// /// - [JsonInclude, JsonPropertyName("adjusted_total_in_bytes")] - public long? AdjustedTotalInBytes { get; init; } + public long? AdjustedTotalInBytes { get; set; } /// /// /// Amount, in bytes, of free physical memory across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long FreeInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long FreeInBytes { get; set; } /// /// /// Percentage of free physical memory across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("free_percent")] - public int FreePercent { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int FreePercent { get; set; } /// /// /// Total amount, in bytes, of physical memory across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long TotalInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalInBytes { get; set; } /// /// /// Amount, in bytes, of physical memory in use across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("used_in_bytes")] - public long UsedInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long UsedInBytes { get; set; } /// /// /// Percentage of physical memory in use across all selected nodes. /// /// - [JsonInclude, JsonPropertyName("used_percent")] - public int UsedPercent { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int UsedPercent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/PendingTask.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/PendingTask.g.cs index 582157faa70..2bfef429ee1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/PendingTask.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/PendingTask.g.cs @@ -17,33 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class PendingTaskConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExecuting = System.Text.Json.JsonEncodedText.Encode("executing"); + private static readonly System.Text.Json.JsonEncodedText PropInsertOrder = System.Text.Json.JsonEncodedText.Encode("insert_order"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInQueue = System.Text.Json.JsonEncodedText.Encode("time_in_queue"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInQueueMillis = System.Text.Json.JsonEncodedText.Encode("time_in_queue_millis"); + + public override Elastic.Clients.Elasticsearch.Cluster.PendingTask Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExecuting = default; + LocalJsonValue propInsertOrder = default; + LocalJsonValue propPriority = default; + LocalJsonValue propSource = default; + LocalJsonValue propTimeInQueue = default; + LocalJsonValue propTimeInQueueMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExecuting.TryReadProperty(ref reader, options, PropExecuting, null)) + { + continue; + } + + if (propInsertOrder.TryReadProperty(ref reader, options, PropInsertOrder, null)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propTimeInQueue.TryReadProperty(ref reader, options, PropTimeInQueue, null)) + { + continue; + } + + if (propTimeInQueueMillis.TryReadProperty(ref reader, options, PropTimeInQueueMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PendingTask(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Executing = propExecuting.Value, + InsertOrder = propInsertOrder.Value, + Priority = propPriority.Value, + Source = propSource.Value, + TimeInQueue = propTimeInQueue.Value, + TimeInQueueMillis = propTimeInQueueMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PendingTask value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExecuting, value.Executing, null, null); + writer.WriteProperty(options, PropInsertOrder, value.InsertOrder, null, null); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropTimeInQueue, value.TimeInQueue, null, null); + writer.WriteProperty(options, PropTimeInQueueMillis, value.TimeInQueueMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.PendingTaskConverter))] public sealed partial class PendingTask { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PendingTask(bool executing, int insertOrder, string priority, string source, System.TimeSpan timeInQueueMillis) + { + Executing = executing; + InsertOrder = insertOrder; + Priority = priority; + Source = source; + TimeInQueueMillis = timeInQueueMillis; + } +#if NET7_0_OR_GREATER + public PendingTask() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PendingTask() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PendingTask(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Indicates whether the pending tasks are currently executing or not. /// /// - [JsonInclude, JsonPropertyName("executing")] - public bool Executing { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Executing { get; set; } /// /// /// The number that represents when the task has been inserted into the task queue. /// /// - [JsonInclude, JsonPropertyName("insert_order")] - public int InsertOrder { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int InsertOrder { get; set; } /// /// @@ -51,30 +164,38 @@ public sealed partial class PendingTask /// The valid priorities in descending priority order are: IMMEDIATE > URGENT > HIGH > NORMAL > LOW > LANGUID. /// /// - [JsonInclude, JsonPropertyName("priority")] - public string Priority { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Priority { get; set; } /// /// /// A general description of the cluster task that may include a reason and origin. /// /// - [JsonInclude, JsonPropertyName("source")] - public string Source { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Source { get; set; } /// /// /// The time since the task is waiting for being performed. /// /// - [JsonInclude, JsonPropertyName("time_in_queue")] - public Elastic.Clients.Elasticsearch.Duration? TimeInQueue { get; init; } + public Elastic.Clients.Elasticsearch.Duration? TimeInQueue { get; set; } /// /// /// The time expressed in milliseconds since the task is waiting for being performed. /// /// - [JsonInclude, JsonPropertyName("time_in_queue_millis")] - public long TimeInQueueMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInQueueMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ReservedSize.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ReservedSize.g.cs index 3a0c32f54f0..2adff4578b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ReservedSize.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ReservedSize.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ReservedSizeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Cluster.ReservedSize Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNodeId = default; + LocalJsonValue propPath = default; + LocalJsonValue> propShards = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ReservedSize(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NodeId = propNodeId.Value, + Path = propPath.Value, + Shards = propShards.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ReservedSize value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ReservedSizeConverter))] public sealed partial class ReservedSize { - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("path")] - public string Path { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyCollection Shards { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReservedSize(string nodeId, string path, System.Collections.Generic.IReadOnlyCollection shards, long total) + { + NodeId = nodeId; + Path = path; + Shards = shards; + Total = total; + } +#if NET7_0_OR_GREATER + public ReservedSize() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReservedSize() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReservedSize(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Path { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/RuntimeFieldTypes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/RuntimeFieldTypes.g.cs index dc7d130b72c..c874d589c31 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/RuntimeFieldTypes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/RuntimeFieldTypes.g.cs @@ -17,127 +17,357 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class RuntimeFieldTypesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharsMax = System.Text.Json.JsonEncodedText.Encode("chars_max"); + private static readonly System.Text.Json.JsonEncodedText PropCharsTotal = System.Text.Json.JsonEncodedText.Encode("chars_total"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDocMax = System.Text.Json.JsonEncodedText.Encode("doc_max"); + private static readonly System.Text.Json.JsonEncodedText PropDocTotal = System.Text.Json.JsonEncodedText.Encode("doc_total"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText PropLang = System.Text.Json.JsonEncodedText.Encode("lang"); + private static readonly System.Text.Json.JsonEncodedText PropLinesMax = System.Text.Json.JsonEncodedText.Encode("lines_max"); + private static readonly System.Text.Json.JsonEncodedText PropLinesTotal = System.Text.Json.JsonEncodedText.Encode("lines_total"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropScriptlessCount = System.Text.Json.JsonEncodedText.Encode("scriptless_count"); + private static readonly System.Text.Json.JsonEncodedText PropShadowedCount = System.Text.Json.JsonEncodedText.Encode("shadowed_count"); + private static readonly System.Text.Json.JsonEncodedText PropSourceMax = System.Text.Json.JsonEncodedText.Encode("source_max"); + private static readonly System.Text.Json.JsonEncodedText PropSourceTotal = System.Text.Json.JsonEncodedText.Encode("source_total"); + + public override Elastic.Clients.Elasticsearch.Cluster.RuntimeFieldTypes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCharsMax = default; + LocalJsonValue propCharsTotal = default; + LocalJsonValue propCount = default; + LocalJsonValue propDocMax = default; + LocalJsonValue propDocTotal = default; + LocalJsonValue propIndexCount = default; + LocalJsonValue> propLang = default; + LocalJsonValue propLinesMax = default; + LocalJsonValue propLinesTotal = default; + LocalJsonValue propName = default; + LocalJsonValue propScriptlessCount = default; + LocalJsonValue propShadowedCount = default; + LocalJsonValue propSourceMax = default; + LocalJsonValue propSourceTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharsMax.TryReadProperty(ref reader, options, PropCharsMax, null)) + { + continue; + } + + if (propCharsTotal.TryReadProperty(ref reader, options, PropCharsTotal, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDocMax.TryReadProperty(ref reader, options, PropDocMax, null)) + { + continue; + } + + if (propDocTotal.TryReadProperty(ref reader, options, PropDocTotal, null)) + { + continue; + } + + if (propIndexCount.TryReadProperty(ref reader, options, PropIndexCount, null)) + { + continue; + } + + if (propLang.TryReadProperty(ref reader, options, PropLang, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLinesMax.TryReadProperty(ref reader, options, PropLinesMax, null)) + { + continue; + } + + if (propLinesTotal.TryReadProperty(ref reader, options, PropLinesTotal, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propScriptlessCount.TryReadProperty(ref reader, options, PropScriptlessCount, null)) + { + continue; + } + + if (propShadowedCount.TryReadProperty(ref reader, options, PropShadowedCount, null)) + { + continue; + } + + if (propSourceMax.TryReadProperty(ref reader, options, PropSourceMax, null)) + { + continue; + } + + if (propSourceTotal.TryReadProperty(ref reader, options, PropSourceTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.RuntimeFieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharsMax = propCharsMax.Value, + CharsTotal = propCharsTotal.Value, + Count = propCount.Value, + DocMax = propDocMax.Value, + DocTotal = propDocTotal.Value, + IndexCount = propIndexCount.Value, + Lang = propLang.Value, + LinesMax = propLinesMax.Value, + LinesTotal = propLinesTotal.Value, + Name = propName.Value, + ScriptlessCount = propScriptlessCount.Value, + ShadowedCount = propShadowedCount.Value, + SourceMax = propSourceMax.Value, + SourceTotal = propSourceTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.RuntimeFieldTypes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharsMax, value.CharsMax, null, null); + writer.WriteProperty(options, PropCharsTotal, value.CharsTotal, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDocMax, value.DocMax, null, null); + writer.WriteProperty(options, PropDocTotal, value.DocTotal, null, null); + writer.WriteProperty(options, PropIndexCount, value.IndexCount, null, null); + writer.WriteProperty(options, PropLang, value.Lang, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLinesMax, value.LinesMax, null, null); + writer.WriteProperty(options, PropLinesTotal, value.LinesTotal, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropScriptlessCount, value.ScriptlessCount, null, null); + writer.WriteProperty(options, PropShadowedCount, value.ShadowedCount, null, null); + writer.WriteProperty(options, PropSourceMax, value.SourceMax, null, null); + writer.WriteProperty(options, PropSourceTotal, value.SourceTotal, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.RuntimeFieldTypesConverter))] public sealed partial class RuntimeFieldTypes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldTypes(int charsMax, int charsTotal, int count, int docMax, int docTotal, int indexCount, System.Collections.Generic.IReadOnlyCollection lang, int linesMax, int linesTotal, string name, int scriptlessCount, int shadowedCount, int sourceMax, int sourceTotal) + { + CharsMax = charsMax; + CharsTotal = charsTotal; + Count = count; + DocMax = docMax; + DocTotal = docTotal; + IndexCount = indexCount; + Lang = lang; + LinesMax = linesMax; + LinesTotal = linesTotal; + Name = name; + ScriptlessCount = scriptlessCount; + ShadowedCount = shadowedCount; + SourceMax = sourceMax; + SourceTotal = sourceTotal; + } +#if NET7_0_OR_GREATER + public RuntimeFieldTypes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuntimeFieldTypes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuntimeFieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Maximum number of characters for a single runtime field script. /// /// - [JsonInclude, JsonPropertyName("chars_max")] - public int CharsMax { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int CharsMax { get; set; } /// /// /// Total number of characters for the scripts that define the current runtime field data type. /// /// - [JsonInclude, JsonPropertyName("chars_total")] - public int CharsTotal { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int CharsTotal { get; set; } /// /// /// Number of runtime fields mapped to the field data type in selected nodes. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Maximum number of accesses to doc_values for a single runtime field script /// /// - [JsonInclude, JsonPropertyName("doc_max")] - public int DocMax { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DocMax { get; set; } /// /// /// Total number of accesses to doc_values for the scripts that define the current runtime field data type. /// /// - [JsonInclude, JsonPropertyName("doc_total")] - public int DocTotal { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DocTotal { get; set; } /// /// /// Number of indices containing a mapping of the runtime field data type in selected nodes. /// /// - [JsonInclude, JsonPropertyName("index_count")] - public int IndexCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int IndexCount { get; set; } /// /// /// Script languages used for the runtime fields scripts. /// /// - [JsonInclude, JsonPropertyName("lang")] - public IReadOnlyCollection Lang { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Lang { get; set; } /// /// /// Maximum number of lines for a single runtime field script. /// /// - [JsonInclude, JsonPropertyName("lines_max")] - public int LinesMax { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int LinesMax { get; set; } /// /// /// Total number of lines for the scripts that define the current runtime field data type. /// /// - [JsonInclude, JsonPropertyName("lines_total")] - public int LinesTotal { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int LinesTotal { get; set; } /// /// /// Field data type used in selected nodes. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// Number of runtime fields that don’t declare a script. /// /// - [JsonInclude, JsonPropertyName("scriptless_count")] - public int ScriptlessCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ScriptlessCount { get; set; } /// /// /// Number of runtime fields that shadow an indexed field. /// /// - [JsonInclude, JsonPropertyName("shadowed_count")] - public int ShadowedCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ShadowedCount { get; set; } /// /// /// Maximum number of accesses to _source for a single runtime field script. /// /// - [JsonInclude, JsonPropertyName("source_max")] - public int SourceMax { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int SourceMax { get; set; } /// /// /// Total number of accesses to _source for the scripts that define the current runtime field data type. /// /// - [JsonInclude, JsonPropertyName("source_total")] - public int SourceTotal { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int SourceTotal { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ShardHealthStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ShardHealthStats.g.cs index 9f29e457ded..ac485463044 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ShardHealthStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/ShardHealthStats.g.cs @@ -17,30 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class ShardHealthStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActiveShards = System.Text.Json.JsonEncodedText.Encode("active_shards"); + private static readonly System.Text.Json.JsonEncodedText PropInitializingShards = System.Text.Json.JsonEncodedText.Encode("initializing_shards"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryActive = System.Text.Json.JsonEncodedText.Encode("primary_active"); + private static readonly System.Text.Json.JsonEncodedText PropRelocatingShards = System.Text.Json.JsonEncodedText.Encode("relocating_shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedPrimaryShards = System.Text.Json.JsonEncodedText.Encode("unassigned_primary_shards"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedShards = System.Text.Json.JsonEncodedText.Encode("unassigned_shards"); + + public override Elastic.Clients.Elasticsearch.Cluster.ShardHealthStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActiveShards = default; + LocalJsonValue propInitializingShards = default; + LocalJsonValue propPrimaryActive = default; + LocalJsonValue propRelocatingShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propUnassignedPrimaryShards = default; + LocalJsonValue propUnassignedShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActiveShards.TryReadProperty(ref reader, options, PropActiveShards, null)) + { + continue; + } + + if (propInitializingShards.TryReadProperty(ref reader, options, PropInitializingShards, null)) + { + continue; + } + + if (propPrimaryActive.TryReadProperty(ref reader, options, PropPrimaryActive, null)) + { + continue; + } + + if (propRelocatingShards.TryReadProperty(ref reader, options, PropRelocatingShards, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propUnassignedPrimaryShards.TryReadProperty(ref reader, options, PropUnassignedPrimaryShards, null)) + { + continue; + } + + if (propUnassignedShards.TryReadProperty(ref reader, options, PropUnassignedShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.ShardHealthStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActiveShards = propActiveShards.Value, + InitializingShards = propInitializingShards.Value, + PrimaryActive = propPrimaryActive.Value, + RelocatingShards = propRelocatingShards.Value, + Status = propStatus.Value, + UnassignedPrimaryShards = propUnassignedPrimaryShards.Value, + UnassignedShards = propUnassignedShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.ShardHealthStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActiveShards, value.ActiveShards, null, null); + writer.WriteProperty(options, PropInitializingShards, value.InitializingShards, null, null); + writer.WriteProperty(options, PropPrimaryActive, value.PrimaryActive, null, null); + writer.WriteProperty(options, PropRelocatingShards, value.RelocatingShards, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropUnassignedPrimaryShards, value.UnassignedPrimaryShards, null, null); + writer.WriteProperty(options, PropUnassignedShards, value.UnassignedShards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.ShardHealthStatsConverter))] public sealed partial class ShardHealthStats { - [JsonInclude, JsonPropertyName("active_shards")] - public int ActiveShards { get; init; } - [JsonInclude, JsonPropertyName("initializing_shards")] - public int InitializingShards { get; init; } - [JsonInclude, JsonPropertyName("primary_active")] - public bool PrimaryActive { get; init; } - [JsonInclude, JsonPropertyName("relocating_shards")] - public int RelocatingShards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("unassigned_primary_shards")] - public int UnassignedPrimaryShards { get; init; } - [JsonInclude, JsonPropertyName("unassigned_shards")] - public int UnassignedShards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardHealthStats(int activeShards, int initializingShards, bool primaryActive, int relocatingShards, Elastic.Clients.Elasticsearch.HealthStatus status, int unassignedPrimaryShards, int unassignedShards) + { + ActiveShards = activeShards; + InitializingShards = initializingShards; + PrimaryActive = primaryActive; + RelocatingShards = relocatingShards; + Status = status; + UnassignedPrimaryShards = unassignedPrimaryShards; + UnassignedShards = unassignedShards; + } +#if NET7_0_OR_GREATER + public ShardHealthStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardHealthStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardHealthStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int ActiveShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int InitializingShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool PrimaryActive { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RelocatingShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedPrimaryShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int UnassignedShards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/UnassignedInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/UnassignedInformation.g.cs index c1d0275160e..f6008a9036d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/UnassignedInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Cluster/UnassignedInformation.g.cs @@ -17,30 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; +internal sealed partial class UnassignedInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocationStatus = System.Text.Json.JsonEncodedText.Encode("allocation_status"); + private static readonly System.Text.Json.JsonEncodedText PropAt = System.Text.Json.JsonEncodedText.Encode("at"); + private static readonly System.Text.Json.JsonEncodedText PropDelayed = System.Text.Json.JsonEncodedText.Encode("delayed"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropFailedAllocationAttempts = System.Text.Json.JsonEncodedText.Encode("failed_allocation_attempts"); + private static readonly System.Text.Json.JsonEncodedText PropLastAllocationStatus = System.Text.Json.JsonEncodedText.Encode("last_allocation_status"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + + public override Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocationStatus = default; + LocalJsonValue propAt = default; + LocalJsonValue propDelayed = default; + LocalJsonValue propDetails = default; + LocalJsonValue propFailedAllocationAttempts = default; + LocalJsonValue propLastAllocationStatus = default; + LocalJsonValue propReason = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocationStatus.TryReadProperty(ref reader, options, PropAllocationStatus, null)) + { + continue; + } + + if (propAt.TryReadProperty(ref reader, options, PropAt, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propDelayed.TryReadProperty(ref reader, options, PropDelayed, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propFailedAllocationAttempts.TryReadProperty(ref reader, options, PropFailedAllocationAttempts, null)) + { + continue; + } + + if (propLastAllocationStatus.TryReadProperty(ref reader, options, PropLastAllocationStatus, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocationStatus = propAllocationStatus.Value, + At = propAt.Value, + Delayed = propDelayed.Value, + Details = propDetails.Value, + FailedAllocationAttempts = propFailedAllocationAttempts.Value, + LastAllocationStatus = propLastAllocationStatus.Value, + Reason = propReason.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocationStatus, value.AllocationStatus, null, null); + writer.WriteProperty(options, PropAt, value.At, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropDelayed, value.Delayed, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropFailedAllocationAttempts, value.FailedAllocationAttempts, null, null); + writer.WriteProperty(options, PropLastAllocationStatus, value.LastAllocationStatus, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationConverter))] public sealed partial class UnassignedInformation { - [JsonInclude, JsonPropertyName("allocation_status")] - public string? AllocationStatus { get; init; } - [JsonInclude, JsonPropertyName("at")] - public DateTimeOffset At { get; init; } - [JsonInclude, JsonPropertyName("delayed")] - public bool? Delayed { get; init; } - [JsonInclude, JsonPropertyName("details")] - public string? Details { get; init; } - [JsonInclude, JsonPropertyName("failed_allocation_attempts")] - public int? FailedAllocationAttempts { get; init; } - [JsonInclude, JsonPropertyName("last_allocation_status")] - public string? LastAllocationStatus { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason Reason { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnassignedInformation(System.DateTimeOffset at, Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason reason) + { + At = at; + Reason = reason; + } +#if NET7_0_OR_GREATER + public UnassignedInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnassignedInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnassignedInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? AllocationStatus { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset At { get; set; } + public bool? Delayed { get; set; } + public string? Details { get; set; } + public int? FailedAllocationAttempts { get; set; } + public string? LastAllocationStatus { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason Reason { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterDetails.g.cs index 84645104030..e4f47968f37 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterDetails.g.cs @@ -17,28 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ClusterDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.ClusterDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFailures = default; + LocalJsonValue propIndices = default; + LocalJsonValue propShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClusterDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Failures = propFailures.Value, + Indices = propIndices.Value, + Shards = propShards.Value, + Status = propStatus.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClusterDetailsConverter))] public sealed partial class ClusterDetails { - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public string Indices { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.ClusterSearchStatus Status { get; init; } - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterDetails(string indices, Elastic.Clients.Elasticsearch.ClusterSearchStatus status, bool timedOut) + { + Indices = indices; + Status = status; + TimedOut = timedOut; + } +#if NET7_0_OR_GREATER + public ClusterDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Indices { get; set; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ClusterSearchStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } + public System.TimeSpan? Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterStatistics.g.cs index fa0b3746a89..9585f280cf5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ClusterStatistics.g.cs @@ -17,30 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ClusterStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropPartial = System.Text.Json.JsonEncodedText.Encode("partial"); + private static readonly System.Text.Json.JsonEncodedText PropRunning = System.Text.Json.JsonEncodedText.Encode("running"); + private static readonly System.Text.Json.JsonEncodedText PropSkipped = System.Text.Json.JsonEncodedText.Encode("skipped"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessful = System.Text.Json.JsonEncodedText.Encode("successful"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.ClusterStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDetails = default; + LocalJsonValue propFailed = default; + LocalJsonValue propPartial = default; + LocalJsonValue propRunning = default; + LocalJsonValue propSkipped = default; + LocalJsonValue propSuccessful = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propPartial.TryReadProperty(ref reader, options, PropPartial, null)) + { + continue; + } + + if (propRunning.TryReadProperty(ref reader, options, PropRunning, null)) + { + continue; + } + + if (propSkipped.TryReadProperty(ref reader, options, PropSkipped, null)) + { + continue; + } + + if (propSuccessful.TryReadProperty(ref reader, options, PropSuccessful, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ClusterStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Failed = propFailed.Value, + Partial = propPartial.Value, + Running = propRunning.Value, + Skipped = propSkipped.Value, + Successful = propSuccessful.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropPartial, value.Partial, null, null); + writer.WriteProperty(options, PropRunning, value.Running, null, null); + writer.WriteProperty(options, PropSkipped, value.Skipped, null, null); + writer.WriteProperty(options, PropSuccessful, value.Successful, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClusterStatisticsConverter))] public sealed partial class ClusterStatistics { - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyDictionary? Details { get; init; } - [JsonInclude, JsonPropertyName("failed")] - public int Failed { get; init; } - [JsonInclude, JsonPropertyName("partial")] - public int Partial { get; init; } - [JsonInclude, JsonPropertyName("running")] - public int Running { get; init; } - [JsonInclude, JsonPropertyName("skipped")] - public int Skipped { get; init; } - [JsonInclude, JsonPropertyName("successful")] - public int Successful { get; init; } - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterStatistics(int failed, int partial, int running, int skipped, int successful, int total) + { + Failed = failed; + Partial = partial; + Running = running; + Skipped = skipped; + Successful = successful; + Total = total; + } +#if NET7_0_OR_GREATER + public ClusterStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Details { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Failed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Partial { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Running { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Skipped { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Successful { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionStats.g.cs index 00c49f9380c..b53c1f40b98 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CompletionStats.g.cs @@ -17,35 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class CompletionStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.CompletionStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFields = default; + LocalJsonValue propSize = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CompletionStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Size = propSize.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CompletionStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CompletionStatsConverter))] public sealed partial class CompletionStats { - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.FieldSizeUsage))] - public IReadOnlyDictionary? Fields { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionStats(long sizeInBytes) + { + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public CompletionStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// Total amount of memory used for completion across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize? Size { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } /// /// /// Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs index 5c33a21f098..6d0ebd2f646 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs @@ -17,76 +17,176 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class CoordsGeoBoundsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBottom = System.Text.Json.JsonEncodedText.Encode("bottom"); + private static readonly System.Text.Json.JsonEncodedText PropLeft = System.Text.Json.JsonEncodedText.Encode("left"); + private static readonly System.Text.Json.JsonEncodedText PropRight = System.Text.Json.JsonEncodedText.Encode("right"); + private static readonly System.Text.Json.JsonEncodedText PropTop = System.Text.Json.JsonEncodedText.Encode("top"); + + public override Elastic.Clients.Elasticsearch.CoordsGeoBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBottom = default; + LocalJsonValue propLeft = default; + LocalJsonValue propRight = default; + LocalJsonValue propTop = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBottom.TryReadProperty(ref reader, options, PropBottom, null)) + { + continue; + } + + if (propLeft.TryReadProperty(ref reader, options, PropLeft, null)) + { + continue; + } + + if (propRight.TryReadProperty(ref reader, options, PropRight, null)) + { + continue; + } + + if (propTop.TryReadProperty(ref reader, options, PropTop, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CoordsGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bottom = propBottom.Value, + Left = propLeft.Value, + Right = propRight.Value, + Top = propTop.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CoordsGeoBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBottom, value.Bottom, null, null); + writer.WriteProperty(options, PropLeft, value.Left, null, null); + writer.WriteProperty(options, PropRight, value.Right, null, null); + writer.WriteProperty(options, PropTop, value.Top, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CoordsGeoBoundsConverter))] public sealed partial class CoordsGeoBounds { - [JsonInclude, JsonPropertyName("bottom")] - public double Bottom { get; set; } - [JsonInclude, JsonPropertyName("left")] - public double Left { get; set; } - [JsonInclude, JsonPropertyName("right")] - public double Right { get; set; } - [JsonInclude, JsonPropertyName("top")] - public double Top { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CoordsGeoBounds(double bottom, double left, double right, double top) + { + Bottom = bottom; + Left = left; + Right = right; + Top = top; + } +#if NET7_0_OR_GREATER + public CoordsGeoBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CoordsGeoBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CoordsGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Bottom { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Left { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Right { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Top { get; set; } } -public sealed partial class CoordsGeoBoundsDescriptor : SerializableDescriptor +public readonly partial struct CoordsGeoBoundsDescriptor { - internal CoordsGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.CoordsGeoBounds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CoordsGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.CoordsGeoBounds instance) + { + Instance = instance; + } - public CoordsGeoBoundsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CoordsGeoBoundsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.CoordsGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double BottomValue { get; set; } - private double LeftValue { get; set; } - private double RightValue { get; set; } - private double TopValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.CoordsGeoBounds instance) => new Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.CoordsGeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor descriptor) => descriptor.Instance; - public CoordsGeoBoundsDescriptor Bottom(double bottom) + public Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor Bottom(double value) { - BottomValue = bottom; - return Self; + Instance.Bottom = value; + return this; } - public CoordsGeoBoundsDescriptor Left(double left) + public Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor Left(double value) { - LeftValue = left; - return Self; + Instance.Left = value; + return this; } - public CoordsGeoBoundsDescriptor Right(double right) + public Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor Right(double value) { - RightValue = right; - return Self; + Instance.Right = value; + return this; } - public CoordsGeoBoundsDescriptor Top(double top) + public Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor Top(double value) { - TopValue = top; - return Self; + Instance.Top = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.CoordsGeoBounds Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("bottom"); - writer.WriteNumberValue(BottomValue); - writer.WritePropertyName("left"); - writer.WriteNumberValue(LeftValue); - writer.WritePropertyName("right"); - writer.WriteNumberValue(RightValue); - writer.WritePropertyName("top"); - writer.WriteNumberValue(TopValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor(new Elastic.Clients.Elasticsearch.CoordsGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Bulk/ResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Bulk/ResponseItem.g.cs index 61f1188da67..5b1e1f3886f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Bulk/ResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Bulk/ResponseItem.g.cs @@ -17,40 +17,54 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public partial class ResponseItem +public abstract partial class ResponseItem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResponseItem(string index, int status) + { + Index = index; + Status = status; + } +#if NET7_0_OR_GREATER + public ResponseItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ResponseItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResponseItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Additional information about the failed operation. /// The property is returned only for failed operations. /// /// - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("failure_store")] - public Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus? FailureStore { get; init; } - [JsonInclude, JsonPropertyName("forced_refresh")] - public bool? ForcedRefresh { get; init; } - [JsonInclude, JsonPropertyName("get")] - public Elastic.Clients.Elasticsearch.InlineGet>? Get { get; init; } + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus? FailureStore { get; set; } + public bool? ForcedRefresh { get; set; } + public Elastic.Clients.Elasticsearch.InlineGet>? Get { get; set; } /// /// /// The document ID associated with the operation. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string? Id { get; init; } + public string? Id { get; set; } /// /// @@ -58,8 +72,11 @@ public partial class ResponseItem /// If the operation targeted a data stream, this is the backing index into which the document was written. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// @@ -67,8 +84,7 @@ public partial class ResponseItem /// This property is returned only for successful operations. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// @@ -76,8 +92,7 @@ public partial class ResponseItem /// Successful values are created, deleted, and updated. /// /// - [JsonInclude, JsonPropertyName("result")] - public string? Result { get; init; } + public string? Result { get; set; } /// /// @@ -85,24 +100,25 @@ public partial class ResponseItem /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// /// Shard information for the operation. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } /// /// /// The HTTP status code returned for the operation. /// /// - [JsonInclude, JsonPropertyName("status")] - public int Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Status { get; set; } /// /// @@ -111,6 +127,5 @@ public partial class ResponseItem /// This property is returned only for successful actions. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long? Version { get; init; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs index 3b0b5da0aaf..7b6b97acb85 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs @@ -17,32 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class ContextConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Core.Search.Context Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByPropertyOfT1(ref r, o, "dummy"); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.Search.Context(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.Search.Context(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.Context)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Context value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Text or location that we want similar documents for or a lookup to a document's field for the text. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class Context : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.ContextConverter))] +public sealed partial class Context : Elastic.Clients.Elasticsearch.Union { - public Context(string Category) : base(Category) + public Context(string value) : base(value) + { + } + + public Context(Elastic.Clients.Elasticsearch.GeoLocation value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Context(string value) => new Elastic.Clients.Elasticsearch.Core.Search.Context(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Context(Elastic.Clients.Elasticsearch.GeoLocation value) => new Elastic.Clients.Elasticsearch.Core.Search.Context(value); +} + +public readonly partial struct ContextFactory +{ + public Elastic.Clients.Elasticsearch.Core.Search.Context Category(string value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.Context(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.Context Location(Elastic.Clients.Elasticsearch.GeoLocation value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.Context(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.Context Location(System.Func action) { + return new Elastic.Clients.Elasticsearch.Core.Search.Context(Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action)); } - public Context(Elastic.Clients.Elasticsearch.GeoLocation Location) : base(Location) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Context Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.ContextFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/Explanation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/Explanation.g.cs index 9d4fe3bafbe..0e6417ef16e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/Explanation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/Explanation.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Explain; +internal sealed partial class ExplanationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Core.Explain.Explanation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue> propDetails = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Explain.Explanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Details = propDetails.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Explain.Explanation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Explain.ExplanationConverter))] public sealed partial class Explanation { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyCollection Details { get; init; } - [JsonInclude, JsonPropertyName("value")] - public float Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Explanation(string description, System.Collections.Generic.IReadOnlyCollection details, float value) + { + Description = description; + Details = details; + Value = value; + } +#if NET7_0_OR_GREATER + public Explanation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Explanation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Explanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Details { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/ExplanationDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/ExplanationDetail.g.cs index ae9be681fb6..a6983b2d117 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/ExplanationDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Explain/ExplanationDetail.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Explain; +internal sealed partial class ExplanationDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue?> propDetails = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Details = propDetails.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Explain.ExplanationDetailConverter))] public sealed partial class ExplanationDetail { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyCollection? Details { get; init; } - [JsonInclude, JsonPropertyName("value")] - public float Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplanationDetail(string description, float value) + { + Description = description; + Value = value; + } +#if NET7_0_OR_GREATER + public ExplanationDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExplanationDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplanationDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Details { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/FieldCaps/FieldCapability.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/FieldCaps/FieldCapability.g.cs index 7305368830a..9d80fbd9b9e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/FieldCaps/FieldCapability.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/FieldCaps/FieldCapability.g.cs @@ -17,50 +17,208 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.FieldCaps; +internal sealed partial class FieldCapabilityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregatable = System.Text.Json.JsonEncodedText.Encode("aggregatable"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMetadataField = System.Text.Json.JsonEncodedText.Encode("metadata_field"); + private static readonly System.Text.Json.JsonEncodedText PropMetricConflictsIndices = System.Text.Json.JsonEncodedText.Encode("metric_conflicts_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNonAggregatableIndices = System.Text.Json.JsonEncodedText.Encode("non_aggregatable_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNonDimensionIndices = System.Text.Json.JsonEncodedText.Encode("non_dimension_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNonSearchableIndices = System.Text.Json.JsonEncodedText.Encode("non_searchable_indices"); + private static readonly System.Text.Json.JsonEncodedText PropSearchable = System.Text.Json.JsonEncodedText.Encode("searchable"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.FieldCaps.FieldCapability Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregatable = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propMetadataField = default; + LocalJsonValue?> propMetricConflictsIndices = default; + LocalJsonValue?> propNonAggregatableIndices = default; + LocalJsonValue?> propNonDimensionIndices = default; + LocalJsonValue?> propNonSearchableIndices = default; + LocalJsonValue propSearchable = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregatable.TryReadProperty(ref reader, options, PropAggregatable, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMetadataField.TryReadProperty(ref reader, options, PropMetadataField, null)) + { + continue; + } + + if (propMetricConflictsIndices.TryReadProperty(ref reader, options, PropMetricConflictsIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNonAggregatableIndices.TryReadProperty(ref reader, options, PropNonAggregatableIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propNonDimensionIndices.TryReadProperty(ref reader, options, PropNonDimensionIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNonSearchableIndices.TryReadProperty(ref reader, options, PropNonSearchableIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propSearchable.TryReadProperty(ref reader, options, PropSearchable, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.FieldCaps.FieldCapability(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregatable = propAggregatable.Value, + Indices = propIndices.Value, + Meta = propMeta.Value, + MetadataField = propMetadataField.Value, + MetricConflictsIndices = propMetricConflictsIndices.Value, + NonAggregatableIndices = propNonAggregatableIndices.Value, + NonDimensionIndices = propNonDimensionIndices.Value, + NonSearchableIndices = propNonSearchableIndices.Value, + Searchable = propSearchable.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.FieldCaps.FieldCapability value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregatable, value.Aggregatable, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMetadataField, value.MetadataField, null, null); + writer.WriteProperty(options, PropMetricConflictsIndices, value.MetricConflictsIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNonAggregatableIndices, value.NonAggregatableIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNonDimensionIndices, value.NonDimensionIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNonSearchableIndices, value.NonSearchableIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSearchable, value.Searchable, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.FieldCaps.FieldCapabilityConverter))] public sealed partial class FieldCapability { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCapability(bool aggregatable, bool searchable, string type) + { + Aggregatable = aggregatable; + Searchable = searchable; + Type = type; + } +#if NET7_0_OR_GREATER + public FieldCapability() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldCapability() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldCapability(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Whether this field can be aggregated on all indices. /// /// - [JsonInclude, JsonPropertyName("aggregatable")] - public bool Aggregatable { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Aggregatable { get; set; } /// /// /// The list of indices where this field has the same type family, or null if all indices have the same type family for the field. /// /// - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? Indices { get; init; } + public System.Collections.Generic.ICollection? Indices { get; set; } /// /// /// Merged metadata across all indices as a map of string keys to arrays of values. A value length of 1 indicates that all indices had the same value for this key, while a length of 2 or more indicates that not all indices had the same value for this key. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IReadOnlyDictionary? Meta { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } /// /// /// Whether this field is registered as a metadata field. /// /// - [JsonInclude, JsonPropertyName("metadata_field")] - public bool? MetadataField { get; init; } + public bool? MetadataField { get; set; } /// /// @@ -68,17 +226,14 @@ public sealed partial class FieldCapability /// don’t have the same time_series_metric value for this field. /// /// - [JsonInclude, JsonPropertyName("metric_conflicts_indices")] - public IReadOnlyCollection? MetricConflictsIndices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? MetricConflictsIndices { get; set; } /// /// /// The list of indices where this field is not aggregatable, or null if all indices have the same definition for the field. /// /// - [JsonInclude, JsonPropertyName("non_aggregatable_indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? NonAggregatableIndices { get; init; } + public System.Collections.Generic.ICollection? NonAggregatableIndices { get; set; } /// /// @@ -86,33 +241,32 @@ public sealed partial class FieldCapability /// field marked as a dimension and other indices, the ones in this list, do not. /// /// - [JsonInclude, JsonPropertyName("non_dimension_indices")] - public IReadOnlyCollection? NonDimensionIndices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? NonDimensionIndices { get; set; } /// /// /// The list of indices where this field is not searchable, or null if all indices have the same definition for the field. /// /// - [JsonInclude, JsonPropertyName("non_searchable_indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? NonSearchableIndices { get; init; } + public System.Collections.Generic.ICollection? NonSearchableIndices { get; set; } /// /// /// Whether this field is indexed for search on all indices. /// /// - [JsonInclude, JsonPropertyName("searchable")] - public bool Searchable { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Searchable { get; set; } /// /// /// Whether this field is used as a time series dimension. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] - public bool? TimeSeriesDimension { get; init; } + public bool? TimeSeriesDimension { get; set; } /// /// @@ -120,8 +274,10 @@ public sealed partial class FieldCapability /// metrics, absent if the field is not used as metric. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] - public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Get/GetResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Get/GetResult.g.cs index 74c1fb23d0c..d43e5fb3b70 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Get/GetResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Get/GetResult.g.cs @@ -17,67 +17,230 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Get; +internal sealed partial class GetResultConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIgnored = System.Text.Json.JsonEncodedText.Encode("_ignored"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.Core.Get.GetResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFields = default; + LocalJsonValue propFound = default; + LocalJsonValue propId = default; + LocalJsonValue?> propIgnored = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIgnored.TryReadProperty(ref reader, options, PropIgnored, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Get.GetResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Found = propFound.Value, + Id = propId.Value, + Ignored = propIgnored.Value, + Index = propIndex.Value, + PrimaryTerm = propPrimaryTerm.Value, + Routing = propRouting.Value, + SeqNo = propSeqNo.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Get.GetResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIgnored, value.Ignored, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class GetResultConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(GetResult<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(GetResultConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Get.GetResultConverterFactory))] public sealed partial class GetResult { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetResult(bool found, string id, string index) + { + Found = found; + Id = id; + Index = index; + } +#if NET7_0_OR_GREATER + public GetResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GetResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the stored_fields parameter is set to true and found is true, it contains the document fields stored in the index. /// /// - [JsonInclude, JsonPropertyName("fields")] - public Elastic.Clients.Elasticsearch.FieldValues? Fields { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// Indicates whether the document exists. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } /// /// /// The unique identifier for the document. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_ignored")] - public IReadOnlyCollection? Ignored { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Ignored { get; set; } /// /// /// The name of the index the document belongs to. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// The primary term assigned to the document for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } + public long? PrimaryTerm { get; set; } /// /// /// The explicit routing, if set. /// /// - [JsonInclude, JsonPropertyName("_routing")] - public string? Routing { get; init; } + public string? Routing { get; set; } /// /// @@ -85,8 +248,7 @@ public sealed partial class GetResult /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. /// /// - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } + public long? SeqNo { get; set; } /// /// @@ -94,15 +256,12 @@ public sealed partial class GetResult /// If the _source parameter is set to false or the stored_fields parameter is set to true, it is excluded. /// /// - [JsonInclude, JsonPropertyName("_source")] - [SourceConverter] - public TDocument? Source { get; init; } + public TDocument? Source { get; set; } /// /// /// The document version, which is ncremented each time the document is updated. /// /// - [JsonInclude, JsonPropertyName("_version")] - public long? Version { get; init; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/Context.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/Context.g.cs index 5a177ddca51..499d0a3d160 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/Context.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/Context.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.GetScriptContext; +internal sealed partial class ContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMethods = System.Text.Json.JsonEncodedText.Encode("methods"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Core.GetScriptContext.Context Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMethods = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMethods.TryReadProperty(ref reader, options, PropMethods, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.GetScriptContext.Context(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Methods = propMethods.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.GetScriptContext.Context value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMethods, value.Methods, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextConverter))] public sealed partial class Context { - [JsonInclude, JsonPropertyName("methods")] - public IReadOnlyCollection Methods { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Context(System.Collections.Generic.IReadOnlyCollection methods, string name) + { + Methods = methods; + Name = name; + } +#if NET7_0_OR_GREATER + public Context() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Context() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Context(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Methods { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethod.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethod.g.cs index 4171d824aa8..7a54dec75c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethod.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethod.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.GetScriptContext; +internal sealed partial class ContextMethodConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropReturnType = System.Text.Json.JsonEncodedText.Encode("return_type"); + + public override Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethod Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue> propParams = default; + LocalJsonValue propReturnType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propReturnType.TryReadProperty(ref reader, options, PropReturnType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Params = propParams.Value, + ReturnType = propReturnType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethod value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropReturnType, value.ReturnType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethodConverter))] public sealed partial class ContextMethod { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("params")] - public IReadOnlyCollection Params { get; init; } - [JsonInclude, JsonPropertyName("return_type")] - public string ReturnType { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ContextMethod(string name, System.Collections.Generic.IReadOnlyCollection @params, string returnType) + { + Name = name; + Params = @params; + ReturnType = returnType; + } +#if NET7_0_OR_GREATER + public ContextMethod() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ContextMethod() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ContextMethod(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Params { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ReturnType { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethodParam.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethodParam.g.cs index dd3ec8acc19..8f6370d24d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethodParam.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptContext/ContextMethodParam.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.GetScriptContext; +internal sealed partial class ContextMethodParamConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethodParam Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethodParam(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethodParam value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.GetScriptContext.ContextMethodParamConverter))] public sealed partial class ContextMethodParam { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ContextMethodParam(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public ContextMethodParam() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ContextMethodParam() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ContextMethodParam(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptLanguages/LanguageContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptLanguages/LanguageContext.g.cs index 0b3a7677132..7907fb70e62 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptLanguages/LanguageContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/GetScriptLanguages/LanguageContext.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.GetScriptLanguages; +internal sealed partial class LanguageContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + + public override Elastic.Clients.Elasticsearch.Core.GetScriptLanguages.LanguageContext Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propContexts = default; + LocalJsonValue propLanguage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.GetScriptLanguages.LanguageContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Contexts = propContexts.Value, + Language = propLanguage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.GetScriptLanguages.LanguageContext value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.GetScriptLanguages.LanguageContextConverter))] public sealed partial class LanguageContext { - [JsonInclude, JsonPropertyName("contexts")] - public IReadOnlyCollection Contexts { get; init; } - [JsonInclude, JsonPropertyName("language")] - public Elastic.Clients.Elasticsearch.ScriptLanguage Language { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LanguageContext(System.Collections.Generic.IReadOnlyCollection contexts, Elastic.Clients.Elasticsearch.ScriptLanguage language) + { + Contexts = contexts; + Language = language; + } +#if NET7_0_OR_GREATER + public LanguageContext() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LanguageContext() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LanguageContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Contexts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ScriptLanguage Language { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleDetails.g.cs index 30890b5b810..804cd593874 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleDetails.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DataStreamLifecycleDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStagnatingBackingIndices = System.Text.Json.JsonEncodedText.Encode("stagnating_backing_indices"); + private static readonly System.Text.Json.JsonEncodedText PropStagnatingBackingIndicesCount = System.Text.Json.JsonEncodedText.Encode("stagnating_backing_indices_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalBackingIndicesInError = System.Text.Json.JsonEncodedText.Encode("total_backing_indices_in_error"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propStagnatingBackingIndices = default; + LocalJsonValue propStagnatingBackingIndicesCount = default; + LocalJsonValue propTotalBackingIndicesInError = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStagnatingBackingIndices.TryReadProperty(ref reader, options, PropStagnatingBackingIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStagnatingBackingIndicesCount.TryReadProperty(ref reader, options, PropStagnatingBackingIndicesCount, null)) + { + continue; + } + + if (propTotalBackingIndicesInError.TryReadProperty(ref reader, options, PropTotalBackingIndicesInError, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + StagnatingBackingIndices = propStagnatingBackingIndices.Value, + StagnatingBackingIndicesCount = propStagnatingBackingIndicesCount.Value, + TotalBackingIndicesInError = propTotalBackingIndicesInError.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStagnatingBackingIndices, value.StagnatingBackingIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStagnatingBackingIndicesCount, value.StagnatingBackingIndicesCount, null, null); + writer.WriteProperty(options, PropTotalBackingIndicesInError, value.TotalBackingIndicesInError, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetailsConverter))] public sealed partial class DataStreamLifecycleDetails { - [JsonInclude, JsonPropertyName("stagnating_backing_indices")] - public IReadOnlyCollection? StagnatingBackingIndices { get; init; } - [JsonInclude, JsonPropertyName("stagnating_backing_indices_count")] - public int StagnatingBackingIndicesCount { get; init; } - [JsonInclude, JsonPropertyName("total_backing_indices_in_error")] - public int TotalBackingIndicesInError { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDetails(int stagnatingBackingIndicesCount, int totalBackingIndicesInError) + { + StagnatingBackingIndicesCount = stagnatingBackingIndicesCount; + TotalBackingIndicesInError = totalBackingIndicesInError; + } +#if NET7_0_OR_GREATER + public DataStreamLifecycleDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamLifecycleDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? StagnatingBackingIndices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int StagnatingBackingIndicesCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalBackingIndicesInError { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleIndicator.g.cs index 24d201253cc..c382b1d0990 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DataStreamLifecycleIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DataStreamLifecycleIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// DATA_STREAM_LIFECYCLE /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicatorConverter))] public sealed partial class DataStreamLifecycleIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public DataStreamLifecycleIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamLifecycleIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Diagnosis.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Diagnosis.g.cs index 8199bac4cc7..95bb252d511 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Diagnosis.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Diagnosis.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DiagnosisConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropAffectedResources = System.Text.Json.JsonEncodedText.Encode("affected_resources"); + private static readonly System.Text.Json.JsonEncodedText PropCause = System.Text.Json.JsonEncodedText.Encode("cause"); + private static readonly System.Text.Json.JsonEncodedText PropHelpUrl = System.Text.Json.JsonEncodedText.Encode("help_url"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.Diagnosis Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propAffectedResources = default; + LocalJsonValue propCause = default; + LocalJsonValue propHelpUrl = default; + LocalJsonValue propId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propAffectedResources.TryReadProperty(ref reader, options, PropAffectedResources, null)) + { + continue; + } + + if (propCause.TryReadProperty(ref reader, options, PropCause, null)) + { + continue; + } + + if (propHelpUrl.TryReadProperty(ref reader, options, PropHelpUrl, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.Diagnosis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + AffectedResources = propAffectedResources.Value, + Cause = propCause.Value, + HelpUrl = propHelpUrl.Value, + Id = propId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.Diagnosis value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropAffectedResources, value.AffectedResources, null, null); + writer.WriteProperty(options, PropCause, value.Cause, null, null); + writer.WriteProperty(options, PropHelpUrl, value.HelpUrl, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisConverter))] public sealed partial class Diagnosis { - [JsonInclude, JsonPropertyName("action")] - public string Action { get; init; } - [JsonInclude, JsonPropertyName("affected_resources")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources AffectedResources { get; init; } - [JsonInclude, JsonPropertyName("cause")] - public string Cause { get; init; } - [JsonInclude, JsonPropertyName("help_url")] - public string HelpUrl { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Diagnosis(string action, Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources affectedResources, string cause, string helpUrl, string id) + { + Action = action; + AffectedResources = affectedResources; + Cause = cause; + HelpUrl = helpUrl; + Id = id; + } +#if NET7_0_OR_GREATER + public Diagnosis() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Diagnosis() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Diagnosis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Action { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources AffectedResources { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Cause { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string HelpUrl { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiagnosisAffectedResources.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiagnosisAffectedResources.g.cs index 389fd578f42..d4fab0d3db3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiagnosisAffectedResources.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiagnosisAffectedResources.g.cs @@ -17,27 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DiagnosisAffectedResourcesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureStates = System.Text.Json.JsonEncodedText.Encode("feature_states"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropSlmPolicies = System.Text.Json.JsonEncodedText.Encode("slm_policies"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshotRepositories = System.Text.Json.JsonEncodedText.Encode("snapshot_repositories"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFeatureStates = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propNodes = default; + LocalJsonValue?> propSlmPolicies = default; + LocalJsonValue?> propSnapshotRepositories = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureStates.TryReadProperty(ref reader, options, PropFeatureStates, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSlmPolicies.TryReadProperty(ref reader, options, PropSlmPolicies, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSnapshotRepositories.TryReadProperty(ref reader, options, PropSnapshotRepositories, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureStates = propFeatureStates.Value, + Indices = propIndices.Value, + Nodes = propNodes.Value, + SlmPolicies = propSlmPolicies.Value, + SnapshotRepositories = propSnapshotRepositories.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResources value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureStates, value.FeatureStates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSlmPolicies, value.SlmPolicies, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSnapshotRepositories, value.SnapshotRepositories, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DiagnosisAffectedResourcesConverter))] public sealed partial class DiagnosisAffectedResources { - [JsonInclude, JsonPropertyName("feature_states")] - public IReadOnlyCollection? FeatureStates { get; init; } - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? Indices { get; init; } - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyCollection? Nodes { get; init; } - [JsonInclude, JsonPropertyName("slm_policies")] - public IReadOnlyCollection? SlmPolicies { get; init; } - [JsonInclude, JsonPropertyName("snapshot_repositories")] - public IReadOnlyCollection? SnapshotRepositories { get; init; } +#if NET7_0_OR_GREATER + public DiagnosisAffectedResources() + { + } +#endif +#if !NET7_0_OR_GREATER + public DiagnosisAffectedResources() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiagnosisAffectedResources(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? FeatureStates { get; set; } + public System.Collections.Generic.ICollection? Indices { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Nodes { get; set; } + public System.Collections.Generic.IReadOnlyCollection? SlmPolicies { get; set; } + public System.Collections.Generic.IReadOnlyCollection? SnapshotRepositories { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicator.g.cs index 53fbb4a5483..92b28149d84 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DiskIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// DISK /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorConverter))] public sealed partial class DiskIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public DiskIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DiskIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiskIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicatorDetails.g.cs index 987522cb0e7..5f5b071a6d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/DiskIndicatorDetails.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class DiskIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndicesWithReadonlyBlock = System.Text.Json.JsonEncodedText.Encode("indices_with_readonly_block"); + private static readonly System.Text.Json.JsonEncodedText PropNodesOverFloodStageWatermark = System.Text.Json.JsonEncodedText.Encode("nodes_over_flood_stage_watermark"); + private static readonly System.Text.Json.JsonEncodedText PropNodesOverHighWatermark = System.Text.Json.JsonEncodedText.Encode("nodes_over_high_watermark"); + private static readonly System.Text.Json.JsonEncodedText PropNodesWithEnoughDiskSpace = System.Text.Json.JsonEncodedText.Encode("nodes_with_enough_disk_space"); + private static readonly System.Text.Json.JsonEncodedText PropNodesWithUnknownDiskStatus = System.Text.Json.JsonEncodedText.Encode("nodes_with_unknown_disk_status"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndicesWithReadonlyBlock = default; + LocalJsonValue propNodesOverFloodStageWatermark = default; + LocalJsonValue propNodesOverHighWatermark = default; + LocalJsonValue propNodesWithEnoughDiskSpace = default; + LocalJsonValue propNodesWithUnknownDiskStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndicesWithReadonlyBlock.TryReadProperty(ref reader, options, PropIndicesWithReadonlyBlock, null)) + { + continue; + } + + if (propNodesOverFloodStageWatermark.TryReadProperty(ref reader, options, PropNodesOverFloodStageWatermark, null)) + { + continue; + } + + if (propNodesOverHighWatermark.TryReadProperty(ref reader, options, PropNodesOverHighWatermark, null)) + { + continue; + } + + if (propNodesWithEnoughDiskSpace.TryReadProperty(ref reader, options, PropNodesWithEnoughDiskSpace, null)) + { + continue; + } + + if (propNodesWithUnknownDiskStatus.TryReadProperty(ref reader, options, PropNodesWithUnknownDiskStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndicesWithReadonlyBlock = propIndicesWithReadonlyBlock.Value, + NodesOverFloodStageWatermark = propNodesOverFloodStageWatermark.Value, + NodesOverHighWatermark = propNodesOverHighWatermark.Value, + NodesWithEnoughDiskSpace = propNodesWithEnoughDiskSpace.Value, + NodesWithUnknownDiskStatus = propNodesWithUnknownDiskStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndicesWithReadonlyBlock, value.IndicesWithReadonlyBlock, null, null); + writer.WriteProperty(options, PropNodesOverFloodStageWatermark, value.NodesOverFloodStageWatermark, null, null); + writer.WriteProperty(options, PropNodesOverHighWatermark, value.NodesOverHighWatermark, null, null); + writer.WriteProperty(options, PropNodesWithEnoughDiskSpace, value.NodesWithEnoughDiskSpace, null, null); + writer.WriteProperty(options, PropNodesWithUnknownDiskStatus, value.NodesWithUnknownDiskStatus, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicatorDetailsConverter))] public sealed partial class DiskIndicatorDetails { - [JsonInclude, JsonPropertyName("indices_with_readonly_block")] - public long IndicesWithReadonlyBlock { get; init; } - [JsonInclude, JsonPropertyName("nodes_over_flood_stage_watermark")] - public long NodesOverFloodStageWatermark { get; init; } - [JsonInclude, JsonPropertyName("nodes_over_high_watermark")] - public long NodesOverHighWatermark { get; init; } - [JsonInclude, JsonPropertyName("nodes_with_enough_disk_space")] - public long NodesWithEnoughDiskSpace { get; init; } - [JsonInclude, JsonPropertyName("nodes_with_unknown_disk_status")] - public long NodesWithUnknownDiskStatus { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiskIndicatorDetails(long indicesWithReadonlyBlock, long nodesOverFloodStageWatermark, long nodesOverHighWatermark, long nodesWithEnoughDiskSpace, long nodesWithUnknownDiskStatus) + { + IndicesWithReadonlyBlock = indicesWithReadonlyBlock; + NodesOverFloodStageWatermark = nodesOverFloodStageWatermark; + NodesOverHighWatermark = nodesOverHighWatermark; + NodesWithEnoughDiskSpace = nodesWithEnoughDiskSpace; + NodesWithUnknownDiskStatus = nodesWithUnknownDiskStatus; + } +#if NET7_0_OR_GREATER + public DiskIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DiskIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiskIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long IndicesWithReadonlyBlock { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NodesOverFloodStageWatermark { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NodesOverHighWatermark { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NodesWithEnoughDiskSpace { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NodesWithUnknownDiskStatus { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicator.g.cs new file mode 100644 index 00000000000..140a2cc94c5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicator.g.cs @@ -0,0 +1,145 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Core.HealthReport; + +internal sealed partial class FileSettingsIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// FILE_SETTINGS +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorConverter))] +public sealed partial class FileSettingsIndicator +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FileSettingsIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public FileSettingsIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FileSettingsIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileSettingsIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicatorDetails.g.cs new file mode 100644 index 00000000000..d113cb95709 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/FileSettingsIndicatorDetails.g.cs @@ -0,0 +1,110 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Core.HealthReport; + +internal sealed partial class FileSettingsIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailureStreak = System.Text.Json.JsonEncodedText.Encode("failure_streak"); + private static readonly System.Text.Json.JsonEncodedText PropMostRecentFailure = System.Text.Json.JsonEncodedText.Encode("most_recent_failure"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFailureStreak = default; + LocalJsonValue propMostRecentFailure = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailureStreak.TryReadProperty(ref reader, options, PropFailureStreak, null)) + { + continue; + } + + if (propMostRecentFailure.TryReadProperty(ref reader, options, PropMostRecentFailure, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FailureStreak = propFailureStreak.Value, + MostRecentFailure = propMostRecentFailure.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailureStreak, value.FailureStreak, null, null); + writer.WriteProperty(options, PropMostRecentFailure, value.MostRecentFailure, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicatorDetailsConverter))] +public sealed partial class FileSettingsIndicatorDetails +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FileSettingsIndicatorDetails(long failureStreak, string mostRecentFailure) + { + FailureStreak = failureStreak; + MostRecentFailure = mostRecentFailure; + } +#if NET7_0_OR_GREATER + public FileSettingsIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FileSettingsIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileSettingsIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long FailureStreak { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string MostRecentFailure { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicator.g.cs index 2ce6200c9c4..96684de2ad6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class IlmIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// ILM /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorConverter))] public sealed partial class IlmIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public IlmIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IlmIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IlmIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicatorDetails.g.cs index d11d1de7d20..22a03d24d07 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IlmIndicatorDetails.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class IlmIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIlmStatus = System.Text.Json.JsonEncodedText.Encode("ilm_status"); + private static readonly System.Text.Json.JsonEncodedText PropPolicies = System.Text.Json.JsonEncodedText.Encode("policies"); + private static readonly System.Text.Json.JsonEncodedText PropStagnatingIndices = System.Text.Json.JsonEncodedText.Encode("stagnating_indices"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIlmStatus = default; + LocalJsonValue propPolicies = default; + LocalJsonValue propStagnatingIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIlmStatus.TryReadProperty(ref reader, options, PropIlmStatus, null)) + { + continue; + } + + if (propPolicies.TryReadProperty(ref reader, options, PropPolicies, null)) + { + continue; + } + + if (propStagnatingIndices.TryReadProperty(ref reader, options, PropStagnatingIndices, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IlmStatus = propIlmStatus.Value, + Policies = propPolicies.Value, + StagnatingIndices = propStagnatingIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIlmStatus, value.IlmStatus, null, null); + writer.WriteProperty(options, PropPolicies, value.Policies, null, null); + writer.WriteProperty(options, PropStagnatingIndices, value.StagnatingIndices, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicatorDetailsConverter))] public sealed partial class IlmIndicatorDetails { - [JsonInclude, JsonPropertyName("ilm_status")] - public Elastic.Clients.Elasticsearch.LifecycleOperationMode IlmStatus { get; init; } - [JsonInclude, JsonPropertyName("policies")] - public long Policies { get; init; } - [JsonInclude, JsonPropertyName("stagnating_indices")] - public int StagnatingIndices { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmIndicatorDetails(Elastic.Clients.Elasticsearch.LifecycleOperationMode ilmStatus, long policies, int stagnatingIndices) + { + IlmStatus = ilmStatus; + Policies = policies; + StagnatingIndices = stagnatingIndices; + } +#if NET7_0_OR_GREATER + public IlmIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IlmIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IlmIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LifecycleOperationMode IlmStatus { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Policies { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int StagnatingIndices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Impact.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Impact.g.cs index 47efec4fe6f..8cda5cd7b6f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Impact.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Impact.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ImpactConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropImpactAreas = System.Text.Json.JsonEncodedText.Encode("impact_areas"); + private static readonly System.Text.Json.JsonEncodedText PropSeverity = System.Text.Json.JsonEncodedText.Encode("severity"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.Impact Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propId = default; + LocalJsonValue> propImpactAreas = default; + LocalJsonValue propSeverity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propImpactAreas.TryReadProperty(ref reader, options, PropImpactAreas, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propSeverity.TryReadProperty(ref reader, options, PropSeverity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.Impact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Id = propId.Value, + ImpactAreas = propImpactAreas.Value, + Severity = propSeverity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.Impact value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropImpactAreas, value.ImpactAreas, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeverity, value.Severity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactConverter))] public sealed partial class Impact { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("impact_areas")] - public IReadOnlyCollection ImpactAreas { get; init; } - [JsonInclude, JsonPropertyName("severity")] - public int Severity { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Impact(string description, string id, System.Collections.Generic.IReadOnlyCollection impactAreas, int severity) + { + Description = description; + Id = id; + ImpactAreas = impactAreas; + Severity = severity; + } +#if NET7_0_OR_GREATER + public Impact() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Impact() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Impact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ImpactAreas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Severity { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IndicatorNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IndicatorNode.g.cs index 57ad299b3fe..a4ed00408f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IndicatorNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/IndicatorNode.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class IndicatorNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propNodeId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + NodeId = propNodeId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNodeConverter))] public sealed partial class IndicatorNode { - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string? NodeId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicatorNode(string? name, string? nodeId) + { + Name = name; + NodeId = nodeId; + } +#if NET7_0_OR_GREATER + public IndicatorNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndicatorNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicatorNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string? Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string? NodeId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Indicators.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Indicators.g.cs index 6cc347b2606..64d7278cad7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Indicators.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/Indicators.g.cs @@ -17,32 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class IndicatorsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataStreamLifecycle = System.Text.Json.JsonEncodedText.Encode("data_stream_lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropDisk = System.Text.Json.JsonEncodedText.Encode("disk"); + private static readonly System.Text.Json.JsonEncodedText PropFileSettings = System.Text.Json.JsonEncodedText.Encode("file_settings"); + private static readonly System.Text.Json.JsonEncodedText PropIlm = System.Text.Json.JsonEncodedText.Encode("ilm"); + private static readonly System.Text.Json.JsonEncodedText PropMasterIsStable = System.Text.Json.JsonEncodedText.Encode("master_is_stable"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryIntegrity = System.Text.Json.JsonEncodedText.Encode("repository_integrity"); + private static readonly System.Text.Json.JsonEncodedText PropShardsAvailability = System.Text.Json.JsonEncodedText.Encode("shards_availability"); + private static readonly System.Text.Json.JsonEncodedText PropShardsCapacity = System.Text.Json.JsonEncodedText.Encode("shards_capacity"); + private static readonly System.Text.Json.JsonEncodedText PropSlm = System.Text.Json.JsonEncodedText.Encode("slm"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.Indicators Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataStreamLifecycle = default; + LocalJsonValue propDisk = default; + LocalJsonValue propFileSettings = default; + LocalJsonValue propIlm = default; + LocalJsonValue propMasterIsStable = default; + LocalJsonValue propRepositoryIntegrity = default; + LocalJsonValue propShardsAvailability = default; + LocalJsonValue propShardsCapacity = default; + LocalJsonValue propSlm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreamLifecycle.TryReadProperty(ref reader, options, PropDataStreamLifecycle, null)) + { + continue; + } + + if (propDisk.TryReadProperty(ref reader, options, PropDisk, null)) + { + continue; + } + + if (propFileSettings.TryReadProperty(ref reader, options, PropFileSettings, null)) + { + continue; + } + + if (propIlm.TryReadProperty(ref reader, options, PropIlm, null)) + { + continue; + } + + if (propMasterIsStable.TryReadProperty(ref reader, options, PropMasterIsStable, null)) + { + continue; + } + + if (propRepositoryIntegrity.TryReadProperty(ref reader, options, PropRepositoryIntegrity, null)) + { + continue; + } + + if (propShardsAvailability.TryReadProperty(ref reader, options, PropShardsAvailability, null)) + { + continue; + } + + if (propShardsCapacity.TryReadProperty(ref reader, options, PropShardsCapacity, null)) + { + continue; + } + + if (propSlm.TryReadProperty(ref reader, options, PropSlm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.Indicators(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreamLifecycle = propDataStreamLifecycle.Value, + Disk = propDisk.Value, + FileSettings = propFileSettings.Value, + Ilm = propIlm.Value, + MasterIsStable = propMasterIsStable.Value, + RepositoryIntegrity = propRepositoryIntegrity.Value, + ShardsAvailability = propShardsAvailability.Value, + ShardsCapacity = propShardsCapacity.Value, + Slm = propSlm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.Indicators value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreamLifecycle, value.DataStreamLifecycle, null, null); + writer.WriteProperty(options, PropDisk, value.Disk, null, null); + writer.WriteProperty(options, PropFileSettings, value.FileSettings, null, null); + writer.WriteProperty(options, PropIlm, value.Ilm, null, null); + writer.WriteProperty(options, PropMasterIsStable, value.MasterIsStable, null, null); + writer.WriteProperty(options, PropRepositoryIntegrity, value.RepositoryIntegrity, null, null); + writer.WriteProperty(options, PropShardsAvailability, value.ShardsAvailability, null, null); + writer.WriteProperty(options, PropShardsCapacity, value.ShardsCapacity, null, null); + writer.WriteProperty(options, PropSlm, value.Slm, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorsConverter))] public sealed partial class Indicators { - [JsonInclude, JsonPropertyName("data_stream_lifecycle")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicator? DataStreamLifecycle { get; init; } - [JsonInclude, JsonPropertyName("disk")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicator? Disk { get; init; } - [JsonInclude, JsonPropertyName("ilm")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicator? Ilm { get; init; } - [JsonInclude, JsonPropertyName("master_is_stable")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicator? MasterIsStable { get; init; } - [JsonInclude, JsonPropertyName("repository_integrity")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicator? RepositoryIntegrity { get; init; } - [JsonInclude, JsonPropertyName("shards_availability")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicator? ShardsAvailability { get; init; } - [JsonInclude, JsonPropertyName("shards_capacity")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicator? ShardsCapacity { get; init; } - [JsonInclude, JsonPropertyName("slm")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicator? Slm { get; init; } +#if NET7_0_OR_GREATER + public Indicators() + { + } +#endif +#if !NET7_0_OR_GREATER + public Indicators() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Indicators(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.DataStreamLifecycleIndicator? DataStreamLifecycle { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.DiskIndicator? Disk { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.FileSettingsIndicator? FileSettings { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.IlmIndicator? Ilm { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicator? MasterIsStable { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicator? RepositoryIntegrity { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicator? ShardsAvailability { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicator? ShardsCapacity { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicator? Slm { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicator.g.cs index d1c50ea6a48..025fd034ae3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class MasterIsStableIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// MASTER_IS_STABLE /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorConverter))] public sealed partial class MasterIsStableIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MasterIsStableIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public MasterIsStableIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MasterIsStableIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MasterIsStableIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorClusterFormationNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorClusterFormationNode.g.cs index ee9d1cc6dbe..d1ece701e59 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorClusterFormationNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorClusterFormationNode.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class MasterIsStableIndicatorClusterFormationNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusterFormationMessage = System.Text.Json.JsonEncodedText.Encode("cluster_formation_message"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorClusterFormationNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterFormationMessage = default; + LocalJsonValue propName = default; + LocalJsonValue propNodeId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterFormationMessage.TryReadProperty(ref reader, options, PropClusterFormationMessage, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorClusterFormationNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterFormationMessage = propClusterFormationMessage.Value, + Name = propName.Value, + NodeId = propNodeId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorClusterFormationNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterFormationMessage, value.ClusterFormationMessage, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorClusterFormationNodeConverter))] public sealed partial class MasterIsStableIndicatorClusterFormationNode { - [JsonInclude, JsonPropertyName("cluster_formation_message")] - public string ClusterFormationMessage { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MasterIsStableIndicatorClusterFormationNode(string clusterFormationMessage, string nodeId) + { + ClusterFormationMessage = clusterFormationMessage; + NodeId = nodeId; + } +#if NET7_0_OR_GREATER + public MasterIsStableIndicatorClusterFormationNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MasterIsStableIndicatorClusterFormationNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MasterIsStableIndicatorClusterFormationNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterFormationMessage { get; set; } + public string? Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorDetails.g.cs index b1fe8a040b9..c3664f684d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorDetails.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class MasterIsStableIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusterFormation = System.Text.Json.JsonEncodedText.Encode("cluster_formation"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentMaster = System.Text.Json.JsonEncodedText.Encode("current_master"); + private static readonly System.Text.Json.JsonEncodedText PropExceptionFetchingHistory = System.Text.Json.JsonEncodedText.Encode("exception_fetching_history"); + private static readonly System.Text.Json.JsonEncodedText PropRecentMasters = System.Text.Json.JsonEncodedText.Encode("recent_masters"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClusterFormation = default; + LocalJsonValue propCurrentMaster = default; + LocalJsonValue propExceptionFetchingHistory = default; + LocalJsonValue> propRecentMasters = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterFormation.TryReadProperty(ref reader, options, PropClusterFormation, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCurrentMaster.TryReadProperty(ref reader, options, PropCurrentMaster, null)) + { + continue; + } + + if (propExceptionFetchingHistory.TryReadProperty(ref reader, options, PropExceptionFetchingHistory, null)) + { + continue; + } + + if (propRecentMasters.TryReadProperty(ref reader, options, PropRecentMasters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterFormation = propClusterFormation.Value, + CurrentMaster = propCurrentMaster.Value, + ExceptionFetchingHistory = propExceptionFetchingHistory.Value, + RecentMasters = propRecentMasters.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterFormation, value.ClusterFormation, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCurrentMaster, value.CurrentMaster, null, null); + writer.WriteProperty(options, PropExceptionFetchingHistory, value.ExceptionFetchingHistory, null, null); + writer.WriteProperty(options, PropRecentMasters, value.RecentMasters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorDetailsConverter))] public sealed partial class MasterIsStableIndicatorDetails { - [JsonInclude, JsonPropertyName("cluster_formation")] - public IReadOnlyCollection? ClusterFormation { get; init; } - [JsonInclude, JsonPropertyName("current_master")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode CurrentMaster { get; init; } - [JsonInclude, JsonPropertyName("exception_fetching_history")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistory? ExceptionFetchingHistory { get; init; } - [JsonInclude, JsonPropertyName("recent_masters")] - public IReadOnlyCollection RecentMasters { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MasterIsStableIndicatorDetails(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode currentMaster, System.Collections.Generic.IReadOnlyCollection recentMasters) + { + CurrentMaster = currentMaster; + RecentMasters = recentMasters; + } +#if NET7_0_OR_GREATER + public MasterIsStableIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MasterIsStableIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MasterIsStableIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? ClusterFormation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorNode CurrentMaster { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistory? ExceptionFetchingHistory { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RecentMasters { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorExceptionFetchingHistory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorExceptionFetchingHistory.g.cs index 28d5bd932f3..4d5d9659491 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorExceptionFetchingHistory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/MasterIsStableIndicatorExceptionFetchingHistory.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class MasterIsStableIndicatorExceptionFetchingHistoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMessage = System.Text.Json.JsonEncodedText.Encode("message"); + private static readonly System.Text.Json.JsonEncodedText PropStackTrace = System.Text.Json.JsonEncodedText.Encode("stack_trace"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMessage = default; + LocalJsonValue propStackTrace = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMessage.TryReadProperty(ref reader, options, PropMessage, null)) + { + continue; + } + + if (propStackTrace.TryReadProperty(ref reader, options, PropStackTrace, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Message = propMessage.Value, + StackTrace = propStackTrace.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMessage, value.Message, null, null); + writer.WriteProperty(options, PropStackTrace, value.StackTrace, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.MasterIsStableIndicatorExceptionFetchingHistoryConverter))] public sealed partial class MasterIsStableIndicatorExceptionFetchingHistory { - [JsonInclude, JsonPropertyName("message")] - public string Message { get; init; } - [JsonInclude, JsonPropertyName("stack_trace")] - public string StackTrace { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MasterIsStableIndicatorExceptionFetchingHistory(string message, string stackTrace) + { + Message = message; + StackTrace = stackTrace; + } +#if NET7_0_OR_GREATER + public MasterIsStableIndicatorExceptionFetchingHistory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MasterIsStableIndicatorExceptionFetchingHistory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MasterIsStableIndicatorExceptionFetchingHistory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Message { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string StackTrace { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicator.g.cs index 0ba36efc6b1..0f48dfc1ab1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class RepositoryIntegrityIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// REPOSITORY_INTEGRITY /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorConverter))] public sealed partial class RepositoryIntegrityIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryIntegrityIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public RepositoryIntegrityIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RepositoryIntegrityIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryIntegrityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicatorDetails.g.cs index bb4c9ae83b9..89312c2418d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/RepositoryIntegrityIndicatorDetails.g.cs @@ -17,22 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class RepositoryIntegrityIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCorrupted = System.Text.Json.JsonEncodedText.Encode("corrupted"); + private static readonly System.Text.Json.JsonEncodedText PropCorruptedRepositories = System.Text.Json.JsonEncodedText.Encode("corrupted_repositories"); + private static readonly System.Text.Json.JsonEncodedText PropTotalRepositories = System.Text.Json.JsonEncodedText.Encode("total_repositories"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCorrupted = default; + LocalJsonValue propCorruptedRepositories = default; + LocalJsonValue propTotalRepositories = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCorrupted.TryReadProperty(ref reader, options, PropCorrupted, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCorruptedRepositories.TryReadProperty(ref reader, options, PropCorruptedRepositories, null)) + { + continue; + } + + if (propTotalRepositories.TryReadProperty(ref reader, options, PropTotalRepositories, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Corrupted = propCorrupted.Value, + CorruptedRepositories = propCorruptedRepositories.Value, + TotalRepositories = propTotalRepositories.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCorrupted, value.Corrupted, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCorruptedRepositories, value.CorruptedRepositories, null, null); + writer.WriteProperty(options, PropTotalRepositories, value.TotalRepositories, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.RepositoryIntegrityIndicatorDetailsConverter))] public sealed partial class RepositoryIntegrityIndicatorDetails { - [JsonInclude, JsonPropertyName("corrupted")] - public IReadOnlyCollection? Corrupted { get; init; } - [JsonInclude, JsonPropertyName("corrupted_repositories")] - public long? CorruptedRepositories { get; init; } - [JsonInclude, JsonPropertyName("total_repositories")] - public long? TotalRepositories { get; init; } +#if NET7_0_OR_GREATER + public RepositoryIntegrityIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + public RepositoryIntegrityIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryIntegrityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Corrupted { get; set; } + public long? CorruptedRepositories { get; set; } + public long? TotalRepositories { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicator.g.cs index 79d430ca52c..9cde7a38b03 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ShardsAvailabilityIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// SHARDS_AVAILABILITY /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorConverter))] public sealed partial class ShardsAvailabilityIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsAvailabilityIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public ShardsAvailabilityIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsAvailabilityIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsAvailabilityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicatorDetails.g.cs index eee5c93b71c..09fd6b4f247 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsAvailabilityIndicatorDetails.g.cs @@ -17,36 +17,214 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ShardsAvailabilityIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreatingPrimaries = System.Text.Json.JsonEncodedText.Encode("creating_primaries"); + private static readonly System.Text.Json.JsonEncodedText PropCreatingReplicas = System.Text.Json.JsonEncodedText.Encode("creating_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropInitializingPrimaries = System.Text.Json.JsonEncodedText.Encode("initializing_primaries"); + private static readonly System.Text.Json.JsonEncodedText PropInitializingReplicas = System.Text.Json.JsonEncodedText.Encode("initializing_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropRestartingPrimaries = System.Text.Json.JsonEncodedText.Encode("restarting_primaries"); + private static readonly System.Text.Json.JsonEncodedText PropRestartingReplicas = System.Text.Json.JsonEncodedText.Encode("restarting_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropStartedPrimaries = System.Text.Json.JsonEncodedText.Encode("started_primaries"); + private static readonly System.Text.Json.JsonEncodedText PropStartedReplicas = System.Text.Json.JsonEncodedText.Encode("started_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedPrimaries = System.Text.Json.JsonEncodedText.Encode("unassigned_primaries"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedReplicas = System.Text.Json.JsonEncodedText.Encode("unassigned_replicas"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreatingPrimaries = default; + LocalJsonValue propCreatingReplicas = default; + LocalJsonValue propInitializingPrimaries = default; + LocalJsonValue propInitializingReplicas = default; + LocalJsonValue propRestartingPrimaries = default; + LocalJsonValue propRestartingReplicas = default; + LocalJsonValue propStartedPrimaries = default; + LocalJsonValue propStartedReplicas = default; + LocalJsonValue propUnassignedPrimaries = default; + LocalJsonValue propUnassignedReplicas = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreatingPrimaries.TryReadProperty(ref reader, options, PropCreatingPrimaries, null)) + { + continue; + } + + if (propCreatingReplicas.TryReadProperty(ref reader, options, PropCreatingReplicas, null)) + { + continue; + } + + if (propInitializingPrimaries.TryReadProperty(ref reader, options, PropInitializingPrimaries, null)) + { + continue; + } + + if (propInitializingReplicas.TryReadProperty(ref reader, options, PropInitializingReplicas, null)) + { + continue; + } + + if (propRestartingPrimaries.TryReadProperty(ref reader, options, PropRestartingPrimaries, null)) + { + continue; + } + + if (propRestartingReplicas.TryReadProperty(ref reader, options, PropRestartingReplicas, null)) + { + continue; + } + + if (propStartedPrimaries.TryReadProperty(ref reader, options, PropStartedPrimaries, null)) + { + continue; + } + + if (propStartedReplicas.TryReadProperty(ref reader, options, PropStartedReplicas, null)) + { + continue; + } + + if (propUnassignedPrimaries.TryReadProperty(ref reader, options, PropUnassignedPrimaries, null)) + { + continue; + } + + if (propUnassignedReplicas.TryReadProperty(ref reader, options, PropUnassignedReplicas, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CreatingPrimaries = propCreatingPrimaries.Value, + CreatingReplicas = propCreatingReplicas.Value, + InitializingPrimaries = propInitializingPrimaries.Value, + InitializingReplicas = propInitializingReplicas.Value, + RestartingPrimaries = propRestartingPrimaries.Value, + RestartingReplicas = propRestartingReplicas.Value, + StartedPrimaries = propStartedPrimaries.Value, + StartedReplicas = propStartedReplicas.Value, + UnassignedPrimaries = propUnassignedPrimaries.Value, + UnassignedReplicas = propUnassignedReplicas.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreatingPrimaries, value.CreatingPrimaries, null, null); + writer.WriteProperty(options, PropCreatingReplicas, value.CreatingReplicas, null, null); + writer.WriteProperty(options, PropInitializingPrimaries, value.InitializingPrimaries, null, null); + writer.WriteProperty(options, PropInitializingReplicas, value.InitializingReplicas, null, null); + writer.WriteProperty(options, PropRestartingPrimaries, value.RestartingPrimaries, null, null); + writer.WriteProperty(options, PropRestartingReplicas, value.RestartingReplicas, null, null); + writer.WriteProperty(options, PropStartedPrimaries, value.StartedPrimaries, null, null); + writer.WriteProperty(options, PropStartedReplicas, value.StartedReplicas, null, null); + writer.WriteProperty(options, PropUnassignedPrimaries, value.UnassignedPrimaries, null, null); + writer.WriteProperty(options, PropUnassignedReplicas, value.UnassignedReplicas, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsAvailabilityIndicatorDetailsConverter))] public sealed partial class ShardsAvailabilityIndicatorDetails { - [JsonInclude, JsonPropertyName("creating_primaries")] - public long CreatingPrimaries { get; init; } - [JsonInclude, JsonPropertyName("creating_replicas")] - public long CreatingReplicas { get; init; } - [JsonInclude, JsonPropertyName("initializing_primaries")] - public long InitializingPrimaries { get; init; } - [JsonInclude, JsonPropertyName("initializing_replicas")] - public long InitializingReplicas { get; init; } - [JsonInclude, JsonPropertyName("restarting_primaries")] - public long RestartingPrimaries { get; init; } - [JsonInclude, JsonPropertyName("restarting_replicas")] - public long RestartingReplicas { get; init; } - [JsonInclude, JsonPropertyName("started_primaries")] - public long StartedPrimaries { get; init; } - [JsonInclude, JsonPropertyName("started_replicas")] - public long StartedReplicas { get; init; } - [JsonInclude, JsonPropertyName("unassigned_primaries")] - public long UnassignedPrimaries { get; init; } - [JsonInclude, JsonPropertyName("unassigned_replicas")] - public long UnassignedReplicas { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsAvailabilityIndicatorDetails(long creatingPrimaries, long creatingReplicas, long initializingPrimaries, long initializingReplicas, long restartingPrimaries, long restartingReplicas, long startedPrimaries, long startedReplicas, long unassignedPrimaries, long unassignedReplicas) + { + CreatingPrimaries = creatingPrimaries; + CreatingReplicas = creatingReplicas; + InitializingPrimaries = initializingPrimaries; + InitializingReplicas = initializingReplicas; + RestartingPrimaries = restartingPrimaries; + RestartingReplicas = restartingReplicas; + StartedPrimaries = startedPrimaries; + StartedReplicas = startedReplicas; + UnassignedPrimaries = unassignedPrimaries; + UnassignedReplicas = unassignedReplicas; + } +#if NET7_0_OR_GREATER + public ShardsAvailabilityIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsAvailabilityIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsAvailabilityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long CreatingPrimaries { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreatingReplicas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InitializingPrimaries { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InitializingReplicas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RestartingPrimaries { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RestartingReplicas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long StartedPrimaries { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long StartedReplicas { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long UnassignedPrimaries { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long UnassignedReplicas { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicator.g.cs index 6b1e54b0a0f..8c21ebf559a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ShardsCapacityIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// SHARDS_CAPACITY /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorConverter))] public sealed partial class ShardsCapacityIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsCapacityIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public ShardsCapacityIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsCapacityIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsCapacityIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorDetails.g.cs index c3fdd0dfb3a..c3c8b2fe25f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorDetails.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ShardsCapacityIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropFrozen = System.Text.Json.JsonEncodedText.Encode("frozen"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propData = default; + LocalJsonValue propFrozen = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, null)) + { + continue; + } + + if (propFrozen.TryReadProperty(ref reader, options, PropFrozen, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Frozen = propFrozen.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, null); + writer.WriteProperty(options, PropFrozen, value.Frozen, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorDetailsConverter))] public sealed partial class ShardsCapacityIndicatorDetails { - [JsonInclude, JsonPropertyName("data")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail Data { get; init; } - [JsonInclude, JsonPropertyName("frozen")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail Frozen { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsCapacityIndicatorDetails(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail data, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail frozen) + { + Data = data; + Frozen = frozen; + } +#if NET7_0_OR_GREATER + public ShardsCapacityIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsCapacityIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsCapacityIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail Data { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail Frozen { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorTierDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorTierDetail.g.cs index 4ef74d5717a..c35e9f0ff7c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorTierDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/ShardsCapacityIndicatorTierDetail.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class ShardsCapacityIndicatorTierDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentUsedShards = System.Text.Json.JsonEncodedText.Encode("current_used_shards"); + private static readonly System.Text.Json.JsonEncodedText PropMaxShardsInCluster = System.Text.Json.JsonEncodedText.Encode("max_shards_in_cluster"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentUsedShards = default; + LocalJsonValue propMaxShardsInCluster = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentUsedShards.TryReadProperty(ref reader, options, PropCurrentUsedShards, null)) + { + continue; + } + + if (propMaxShardsInCluster.TryReadProperty(ref reader, options, PropMaxShardsInCluster, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentUsedShards = propCurrentUsedShards.Value, + MaxShardsInCluster = propMaxShardsInCluster.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentUsedShards, value.CurrentUsedShards, null, null); + writer.WriteProperty(options, PropMaxShardsInCluster, value.MaxShardsInCluster, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ShardsCapacityIndicatorTierDetailConverter))] public sealed partial class ShardsCapacityIndicatorTierDetail { - [JsonInclude, JsonPropertyName("current_used_shards")] - public int? CurrentUsedShards { get; init; } - [JsonInclude, JsonPropertyName("max_shards_in_cluster")] - public int MaxShardsInCluster { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsCapacityIndicatorTierDetail(int maxShardsInCluster) + { + MaxShardsInCluster = maxShardsInCluster; + } +#if NET7_0_OR_GREATER + public ShardsCapacityIndicatorTierDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsCapacityIndicatorTierDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsCapacityIndicatorTierDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? CurrentUsedShards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxShardsInCluster { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicator.g.cs index e8ce7e202e7..e608353c7ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicator.g.cs @@ -17,31 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class SlmIndicatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropDiagnosis = System.Text.Json.JsonEncodedText.Encode("diagnosis"); + private static readonly System.Text.Json.JsonEncodedText PropImpacts = System.Text.Json.JsonEncodedText.Encode("impacts"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSymptom = System.Text.Json.JsonEncodedText.Encode("symptom"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDetails = default; + LocalJsonValue?> propDiagnosis = default; + LocalJsonValue?> propImpacts = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSymptom = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propDiagnosis.TryReadProperty(ref reader, options, PropDiagnosis, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propImpacts.TryReadProperty(ref reader, options, PropImpacts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSymptom.TryReadProperty(ref reader, options, PropSymptom, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Diagnosis = propDiagnosis.Value, + Impacts = propImpacts.Value, + Status = propStatus.Value, + Symptom = propSymptom.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropDiagnosis, value.Diagnosis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropImpacts, value.Impacts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSymptom, value.Symptom, null, null); + writer.WriteEndObject(); + } +} + /// /// /// SLM /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorConverter))] public sealed partial class SlmIndicator { - [JsonInclude, JsonPropertyName("details")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetails? Details { get; init; } - [JsonInclude, JsonPropertyName("diagnosis")] - public IReadOnlyCollection? Diagnosis { get; init; } - [JsonInclude, JsonPropertyName("impacts")] - public IReadOnlyCollection? Impacts { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; init; } - [JsonInclude, JsonPropertyName("symptom")] - public string Symptom { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmIndicator(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus status, string symptom) + { + Status = status; + Symptom = symptom; + } +#if NET7_0_OR_GREATER + public SlmIndicator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SlmIndicator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlmIndicator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetails? Details { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Diagnosis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Impacts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Symptom { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorDetails.g.cs index 00544274974..684f17c2059 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorDetails.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class SlmIndicatorDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPolicies = System.Text.Json.JsonEncodedText.Encode("policies"); + private static readonly System.Text.Json.JsonEncodedText PropSlmStatus = System.Text.Json.JsonEncodedText.Encode("slm_status"); + private static readonly System.Text.Json.JsonEncodedText PropUnhealthyPolicies = System.Text.Json.JsonEncodedText.Encode("unhealthy_policies"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPolicies = default; + LocalJsonValue propSlmStatus = default; + LocalJsonValue propUnhealthyPolicies = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicies.TryReadProperty(ref reader, options, PropPolicies, null)) + { + continue; + } + + if (propSlmStatus.TryReadProperty(ref reader, options, PropSlmStatus, null)) + { + continue; + } + + if (propUnhealthyPolicies.TryReadProperty(ref reader, options, PropUnhealthyPolicies, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Policies = propPolicies.Value, + SlmStatus = propSlmStatus.Value, + UnhealthyPolicies = propUnhealthyPolicies.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicies, value.Policies, null, null); + writer.WriteProperty(options, PropSlmStatus, value.SlmStatus, null, null); + writer.WriteProperty(options, PropUnhealthyPolicies, value.UnhealthyPolicies, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorDetailsConverter))] public sealed partial class SlmIndicatorDetails { - [JsonInclude, JsonPropertyName("policies")] - public long Policies { get; init; } - [JsonInclude, JsonPropertyName("slm_status")] - public Elastic.Clients.Elasticsearch.LifecycleOperationMode SlmStatus { get; init; } - [JsonInclude, JsonPropertyName("unhealthy_policies")] - public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPolicies? UnhealthyPolicies { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmIndicatorDetails(long policies, Elastic.Clients.Elasticsearch.LifecycleOperationMode slmStatus) + { + Policies = policies; + SlmStatus = slmStatus; + } +#if NET7_0_OR_GREATER + public SlmIndicatorDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SlmIndicatorDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlmIndicatorDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Policies { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LifecycleOperationMode SlmStatus { get; set; } + public Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPolicies? UnhealthyPolicies { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorUnhealthyPolicies.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorUnhealthyPolicies.g.cs index 95faa59e1c8..aeb8f07a57c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorUnhealthyPolicies.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/SlmIndicatorUnhealthyPolicies.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class SlmIndicatorUnhealthyPoliciesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropInvocationsSinceLastSuccess = System.Text.Json.JsonEncodedText.Encode("invocations_since_last_success"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPolicies Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue?> propInvocationsSinceLastSuccess = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propInvocationsSinceLastSuccess.TryReadProperty(ref reader, options, PropInvocationsSinceLastSuccess, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPolicies(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + InvocationsSinceLastSuccess = propInvocationsSinceLastSuccess.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPolicies value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropInvocationsSinceLastSuccess, value.InvocationsSinceLastSuccess, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.SlmIndicatorUnhealthyPoliciesConverter))] public sealed partial class SlmIndicatorUnhealthyPolicies { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("invocations_since_last_success")] - public IReadOnlyDictionary? InvocationsSinceLastSuccess { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmIndicatorUnhealthyPolicies(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public SlmIndicatorUnhealthyPolicies() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SlmIndicatorUnhealthyPolicies() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlmIndicatorUnhealthyPolicies(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? InvocationsSinceLastSuccess { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/StagnatingBackingIndices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/StagnatingBackingIndices.g.cs index 226ccbd1879..c6055d0bdf2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/StagnatingBackingIndices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/HealthReport/StagnatingBackingIndices.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; +internal sealed partial class StagnatingBackingIndicesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFirstOccurrenceTimestamp = System.Text.Json.JsonEncodedText.Encode("first_occurrence_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropIndexName = System.Text.Json.JsonEncodedText.Encode("index_name"); + private static readonly System.Text.Json.JsonEncodedText PropRetryCount = System.Text.Json.JsonEncodedText.Encode("retry_count"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.StagnatingBackingIndices Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFirstOccurrenceTimestamp = default; + LocalJsonValue propIndexName = default; + LocalJsonValue propRetryCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFirstOccurrenceTimestamp.TryReadProperty(ref reader, options, PropFirstOccurrenceTimestamp, null)) + { + continue; + } + + if (propIndexName.TryReadProperty(ref reader, options, PropIndexName, null)) + { + continue; + } + + if (propRetryCount.TryReadProperty(ref reader, options, PropRetryCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.HealthReport.StagnatingBackingIndices(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FirstOccurrenceTimestamp = propFirstOccurrenceTimestamp.Value, + IndexName = propIndexName.Value, + RetryCount = propRetryCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.StagnatingBackingIndices value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFirstOccurrenceTimestamp, value.FirstOccurrenceTimestamp, null, null); + writer.WriteProperty(options, PropIndexName, value.IndexName, null, null); + writer.WriteProperty(options, PropRetryCount, value.RetryCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.StagnatingBackingIndicesConverter))] public sealed partial class StagnatingBackingIndices { - [JsonInclude, JsonPropertyName("first_occurrence_timestamp")] - public long FirstOccurrenceTimestamp { get; init; } - [JsonInclude, JsonPropertyName("index_name")] - public string IndexName { get; init; } - [JsonInclude, JsonPropertyName("retry_count")] - public int RetryCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StagnatingBackingIndices(long firstOccurrenceTimestamp, string indexName, int retryCount) + { + FirstOccurrenceTimestamp = firstOccurrenceTimestamp; + IndexName = indexName; + RetryCount = retryCount; + } +#if NET7_0_OR_GREATER + public StagnatingBackingIndices() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StagnatingBackingIndices() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StagnatingBackingIndices(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long FirstOccurrenceTimestamp { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RetryCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetError.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetError.g.cs index e0ebbbe017b..8e3ca186d39 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetError.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetError.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MGet; +internal sealed partial class MultiGetErrorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + + public override Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Id = propId.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetErrorConverter))] public sealed partial class MultiGetError { - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause Error { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetError(Elastic.Clients.Elasticsearch.ErrorCause error, string id, string index) + { + Error = error; + Id = id; + Index = index; + } +#if NET7_0_OR_GREATER + public MultiGetError() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiGetError() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiGetError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Error { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetOperation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetOperation.g.cs index eb20a84fc6e..a5f1257e3ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetOperation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MGet/MultiGetOperation.g.cs @@ -17,32 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MGet; +internal sealed partial class MultiGetOperationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSource = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Routing = propRouting.Value, + Source = propSource.Value, + StoredFields = propStoredFields.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationConverter))] public sealed partial class MultiGetOperation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetOperation(Elastic.Clients.Elasticsearch.Id id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public MultiGetOperation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiGetOperation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The unique document ID. /// /// - [JsonInclude, JsonPropertyName("_id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } /// /// /// The index that contains the document. /// /// - [JsonInclude, JsonPropertyName("_index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -50,7 +164,6 @@ public sealed partial class MultiGetOperation /// The key for the primary shard the document resides on. Required if routing is used during indexing. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -58,7 +171,6 @@ public sealed partial class MultiGetOperation /// If false, excludes all _source fields. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// @@ -66,40 +178,39 @@ public sealed partial class MultiGetOperation /// The stored fields you want to retrieve. /// /// - [JsonInclude, JsonPropertyName("stored_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } - [JsonInclude, JsonPropertyName("version_type")] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } -public sealed partial class MultiGetOperationDescriptor : SerializableDescriptor> +public readonly partial struct MultiGetOperationDescriptor { - internal MultiGetOperationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation Instance { get; init; } - public MultiGetOperationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetOperationDescriptor(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetOperationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation instance) => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor descriptor) => descriptor.Instance; /// /// /// The unique document ID. /// /// - public MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -107,10 +218,10 @@ public MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.I /// The index that contains the document. /// /// - public MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -118,10 +229,10 @@ public MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearc /// The key for the primary shard the document resides on. Required if routing is used during indexing. /// /// - public MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -129,105 +240,94 @@ public MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsea /// If false, excludes all _source fields. /// /// - public MultiGetOperationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } /// /// - /// The stored fields you want to retrieve. + /// If false, excludes all _source fields. /// /// - public MultiGetOperationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - StoredFieldsValue = storedFields; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public MultiGetOperationDescriptor Version(long? version) + /// + /// + /// The stored fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - VersionValue = version; - return Self; + Instance.StoredFields = value; + return this; } - public MultiGetOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + /// + /// + /// The stored fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - VersionTypeValue = versionType; - return Self; + Instance.StoredFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Version(long? value) { - writer.WriteStartObject(); - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + Instance.Version = value; + return this; + } - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MultiGetOperationDescriptor : SerializableDescriptor +public readonly partial struct MultiGetOperationDescriptor { - internal MultiGetOperationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetOperationDescriptor(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation instance) + { + Instance = instance; + } - public MultiGetOperationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiGetOperationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation instance) => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor descriptor) => descriptor.Instance; /// /// /// The unique document ID. /// /// - public MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -235,10 +335,10 @@ public MultiGetOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// The index that contains the document. /// /// - public MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -246,10 +346,10 @@ public MultiGetOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName /// The key for the primary shard the document resides on. Required if routing is used during indexing. /// /// - public MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -257,76 +357,73 @@ public MultiGetOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing /// If false, excludes all _source fields. /// /// - public MultiGetOperationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } /// /// - /// The stored fields you want to retrieve. + /// If false, excludes all _source fields. /// /// - public MultiGetOperationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Source(System.Func action) { - StoredFieldsValue = storedFields; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public MultiGetOperationDescriptor Version(long? version) + /// + /// + /// If false, excludes all _source fields. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - VersionValue = version; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public MultiGetOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + /// + /// + /// The stored fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - VersionTypeValue = versionType; - return Self; + Instance.StoredFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The stored fields you want to retrieve. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + Instance.StoredFields = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } + public Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperationDescriptor(new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultiSearchItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultiSearchItem.g.cs index 129bb9dcdd5..ba593c3a093 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultiSearchItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultiSearchItem.g.cs @@ -17,40 +17,240 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MSearch; -public sealed partial class MultiSearchItem +internal sealed partial class MultiSearchItemConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("aggregations")] - public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("_clusters")] - public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHitsMetadata = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumReducePhases = System.Text.Json.JsonEncodedText.Encode("num_reduce_phases"); + private static readonly System.Text.Json.JsonEncodedText PropPitId = System.Text.Json.JsonEncodedText.Encode("pit_id"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropScrollId = System.Text.Json.JsonEncodedText.Encode("_scroll_id"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminatedEarly = System.Text.Json.JsonEncodedText.Encode("terminated_early"); + private static readonly System.Text.Json.JsonEncodedText PropTimedOut = System.Text.Json.JsonEncodedText.Encode("timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + + public override Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregations = default; + LocalJsonValue propClusters = default; + LocalJsonValue?> propFields = default; + LocalJsonValue> propHitsMetadata = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue propNumReducePhases = default; + LocalJsonValue propPitId = default; + LocalJsonValue propProfile = default; + LocalJsonValue propScrollId = default; + LocalJsonValue propShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue?> propSuggest = default; + LocalJsonValue propTerminatedEarly = default; + LocalJsonValue propTimedOut = default; + LocalJsonValue propTook = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHitsMetadata.TryReadProperty(ref reader, options, PropHitsMetadata, null)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propNumReducePhases.TryReadProperty(ref reader, options, PropNumReducePhases, null)) + { + continue; + } + + if (propPitId.TryReadProperty(ref reader, options, PropPitId, null)) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propScrollId.TryReadProperty(ref reader, options, PropScrollId, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } + + if (propTerminatedEarly.TryReadProperty(ref reader, options, PropTerminatedEarly, null)) + { + continue; + } + + if (propTimedOut.TryReadProperty(ref reader, options, PropTimedOut, null)) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Clusters = propClusters.Value, + Fields = propFields.Value, + HitsMetadata = propHitsMetadata.Value, + MaxScore = propMaxScore.Value, + NumReducePhases = propNumReducePhases.Value, + PitId = propPitId.Value, + Profile = propProfile.Value, + ScrollId = propScrollId.Value, + Shards = propShards.Value, + Status = propStatus.Value, + Suggest = propSuggest.Value, + TerminatedEarly = propTerminatedEarly.Value, + TimedOut = propTimedOut.Value, + Took = propTook.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHitsMetadata, value.HitsMetadata, null, null); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropNumReducePhases, value.NumReducePhases, null, null); + writer.WriteProperty(options, PropPitId, value.PitId, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropScrollId, value.ScrollId, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminatedEarly, value.TerminatedEarly, null, null); + writer.WriteProperty(options, PropTimedOut, value.TimedOut, null, null); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class MultiSearchItemConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiSearchItem<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiSearchItemConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItemConverterFactory))] +public partial class MultiSearchItem +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiSearchItem(Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata hitsMetadata, Elastic.Clients.Elasticsearch.ShardStatistics shards, bool timedOut, long took) + { + HitsMetadata = hitsMetadata; + Shards = shards; + TimedOut = timedOut; + Took = took; + } +#if NET7_0_OR_GREATER + public MultiSearchItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiSearchItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiSearchItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; set; } + public Elastic.Clients.Elasticsearch.ClusterStatistics? Clusters { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } /// /// /// The returned documents and metadata. /// /// - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } - [JsonInclude, JsonPropertyName("num_reduce_phases")] - public long? NumReducePhases { get; init; } - [JsonInclude, JsonPropertyName("pit_id")] - public string? PitId { get; init; } - [JsonInclude, JsonPropertyName("profile")] - public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata HitsMetadata { get; set; } + public double? MaxScore { get; set; } + public long? NumReducePhases { get; set; } + public string? PitId { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.Profile? Profile { get; set; } /// /// @@ -59,30 +259,32 @@ public sealed partial class MultiSearchItem /// This property is returned only if the scroll query parameter is specified in the request. /// /// - [JsonInclude, JsonPropertyName("_scroll_id")] - public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; init; } + public Elastic.Clients.Elasticsearch.ScrollId? ScrollId { get; set; } /// /// /// A count of shards used for the request. /// /// - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public int? Status { get; init; } - [JsonInclude, JsonPropertyName("suggest")] - public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; init; } - [JsonInclude, JsonPropertyName("terminated_early")] - public bool? TerminatedEarly { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public int? Status { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary? Suggest { get; set; } + public bool? TerminatedEarly { get; set; } /// /// /// If true, the request timed out before completion; returned results may be partial or empty. /// /// - [JsonInclude, JsonPropertyName("timed_out")] - public bool TimedOut { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool TimedOut { get; set; } /// /// @@ -128,6 +330,9 @@ public sealed partial class MultiSearchItem /// /// /// - [JsonInclude, JsonPropertyName("took")] - public long Took { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Took { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchBody.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchBody.g.cs index 1cac0049899..0ed76599cd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchBody.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchBody.g.cs @@ -17,430 +17,393 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MSearch; -internal sealed partial class MultisearchBodyConverter : JsonConverter +internal sealed partial class MultisearchBodyConverter : System.Text.Json.Serialization.JsonConverter { - public override MultisearchBody Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new MultisearchBody(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropDocvalueFields = System.Text.Json.JsonEncodedText.Encode("docvalue_fields"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropExt = System.Text.Json.JsonEncodedText.Encode("ext"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesBoost = System.Text.Json.JsonEncodedText.Encode("indices_boost"); + private static readonly System.Text.Json.JsonEncodedText PropKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropPit = System.Text.Json.JsonEncodedText.Encode("pit"); + private static readonly System.Text.Json.JsonEncodedText PropPostFilter = System.Text.Json.JsonEncodedText.Encode("post_filter"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRank = System.Text.Json.JsonEncodedText.Encode("rank"); + private static readonly System.Text.Json.JsonEncodedText PropRescore = System.Text.Json.JsonEncodedText.Encode("rescore"); + private static readonly System.Text.Json.JsonEncodedText PropRetriever = System.Text.Json.JsonEncodedText.Encode("retriever"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNoPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("seq_no_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSuggest = System.Text.Json.JsonEncodedText.Encode("suggest"); + private static readonly System.Text.Json.JsonEncodedText PropTerminateAfter = System.Text.Json.JsonEncodedText.Encode("terminate_after"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + private static readonly System.Text.Json.JsonEncodedText PropTrackScores = System.Text.Json.JsonEncodedText.Encode("track_scores"); + private static readonly System.Text.Json.JsonEncodedText PropTrackTotalHits = System.Text.Json.JsonEncodedText.Encode("track_total_hits"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propCollapse = default; + LocalJsonValue?> propDocvalueFields = default; + LocalJsonValue propExplain = default; + LocalJsonValue?> propExt = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propFrom = default; + LocalJsonValue propHighlight = default; + LocalJsonValue>?> propIndicesBoost = default; + LocalJsonValue?> propKnn = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propPit = default; + LocalJsonValue propPostFilter = default; + LocalJsonValue propProfile = default; + LocalJsonValue propQuery = default; + LocalJsonValue propRank = default; + LocalJsonValue?> propRescore = default; + LocalJsonValue propRetriever = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue propSeqNoPrimaryTerm = default; + LocalJsonValue propSize = default; + LocalJsonValue propSlice = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue?> propStats = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propSuggest = default; + LocalJsonValue propTerminateAfter = default; + LocalJsonValue propTimeout = default; + LocalJsonValue propTrackScores = default; + LocalJsonValue propTrackTotalHits = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "collapse") - { - variant.Collapse = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "docvalue_fields") - { - variant.DocvalueFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "explain") - { - variant.Explain = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ext") - { - variant.Ext = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "fields") - { - variant.Fields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "from") - { - variant.From = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "highlight") - { - variant.Highlight = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices_boost") - { - variant.IndicesBoost = JsonSerializer.Deserialize>?>(ref reader, options); - continue; - } - - if (property == "knn") - { - variant.Knn = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "min_score") - { - variant.MinScore = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "pit") - { - variant.Pit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "post_filter") - { - variant.PostFilter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "profile") - { - variant.Profile = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rescore") - { - variant.Rescore = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "search_after") - { - variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "seq_no_primary_term") - { - variant.SeqNoPrimaryTerm = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "size") - { - variant.Size = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "sort") - { - variant.Sort = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "_source") - { - variant.Source = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "stats") - { - variant.Stats = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "stored_fields") - { - reader.Read(); - variant.StoredFields = new FieldsConverter().Read(ref reader, typeToConvert, options); - continue; - } - - if (property == "suggest") - { - variant.Suggest = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "terminate_after") - { - variant.TerminateAfter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "timeout") - { - variant.Timeout = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_scores") - { - variant.TrackScores = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "track_total_hits") - { - variant.TrackTotalHits = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - variant.Version = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, MultisearchBody value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propDocvalueFields.TryReadProperty(ref reader, options, PropDocvalueFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Collapse is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, value.Collapse, options); - } + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } - if (value.DocvalueFields is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, value.DocvalueFields, options); - } + if (propExt.TryReadProperty(ref reader, options, PropExt, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.Explain.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(value.Explain.Value); - } + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Ext is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, value.Ext, options); - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (value.Fields is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, value.Fields, options); - } + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } - if (value.From.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(value.From.Value); - } + if (propIndicesBoost.TryReadProperty(ref reader, options, PropIndicesBoost, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } - if (value.Highlight is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, value.Highlight, options); - } + if (propKnn.TryReadProperty(ref reader, options, PropKnn, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.IndicesBoost is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, value.IndicesBoost, options); - } + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } - if (value.Knn is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, value.Knn, options); - } + if (propPit.TryReadProperty(ref reader, options, PropPit, null)) + { + continue; + } - if (value.MinScore.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(value.MinScore.Value); - } + if (propPostFilter.TryReadProperty(ref reader, options, PropPostFilter, null)) + { + continue; + } - if (value.Pit is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, value.Pit, options); - } + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } - if (value.PostFilter is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, value.PostFilter, options); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.Profile.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(value.Profile.Value); - } + if (propRank.TryReadProperty(ref reader, options, PropRank, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRescore.TryReadProperty(ref reader, options, PropRescore, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Rescore is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, value.Rescore, options); - } + if (propRetriever.TryReadProperty(ref reader, options, PropRetriever, null)) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.SearchAfter is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, value.SearchAfter, options); - } + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.SeqNoPrimaryTerm.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(value.SeqNoPrimaryTerm.Value); - } + if (propSeqNoPrimaryTerm.TryReadProperty(ref reader, options, PropSeqNoPrimaryTerm, null)) + { + continue; + } - if (value.Size.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(value.Size.Value); - } + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } - if (value.Sort is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, value.Sort, options); - } + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } - if (value.Source is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, value.Source, options); - } + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.Stats is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, value.Stats, options); - } + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } - if (value.StoredFields is not null) - { - writer.WritePropertyName("stored_fields"); - new FieldsConverter().Write(writer, value.StoredFields, options); - } + if (propStats.TryReadProperty(ref reader, options, PropStats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Suggest is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, value.Suggest, options); - } + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } - if (value.TerminateAfter.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(value.TerminateAfter.Value); - } + if (propSuggest.TryReadProperty(ref reader, options, PropSuggest, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Timeout)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(value.Timeout); - } + if (propTerminateAfter.TryReadProperty(ref reader, options, PropTerminateAfter, null)) + { + continue; + } - if (value.TrackScores.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(value.TrackScores.Value); - } + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } - if (value.TrackTotalHits is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, value.TrackTotalHits, options); - } + if (propTrackScores.TryReadProperty(ref reader, options, PropTrackScores, null)) + { + continue; + } - if (value.Version.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(value.Version.Value); - } + if (propTrackTotalHits.TryReadProperty(ref reader, options, PropTrackTotalHits, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Collapse = propCollapse.Value, + DocvalueFields = propDocvalueFields.Value, + Explain = propExplain.Value, + Ext = propExt.Value, + Fields = propFields.Value, + From = propFrom.Value, + Highlight = propHighlight.Value, + IndicesBoost = propIndicesBoost.Value, + Knn = propKnn.Value, + MinScore = propMinScore.Value, + Pit = propPit.Value, + PostFilter = propPostFilter.Value, + Profile = propProfile.Value, + Query = propQuery.Value, + Rank = propRank.Value, + Rescore = propRescore.Value, + Retriever = propRetriever.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + SearchAfter = propSearchAfter.Value, + SeqNoPrimaryTerm = propSeqNoPrimaryTerm.Value, + Size = propSize.Value, + Slice = propSlice.Value, + Sort = propSort.Value, + Source = propSource.Value, + Stats = propStats.Value, + StoredFields = propStoredFields.Value, + Suggest = propSuggest.Value, + TerminateAfter = propTerminateAfter.Value, + Timeout = propTimeout.Value, + TrackScores = propTrackScores.Value, + TrackTotalHits = propTrackTotalHits.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropDocvalueFields, value.DocvalueFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropExt, value.Ext, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropIndicesBoost, value.IndicesBoost, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropKnn, value.Knn, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropPit, value.Pit, null, null); + writer.WriteProperty(options, PropPostFilter, value.PostFilter, null, null); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRank, value.Rank, null, null); + writer.WriteProperty(options, PropRescore, value.Rescore, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRetriever, value.Retriever, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeqNoPrimaryTerm, value.SeqNoPrimaryTerm, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropSuggest, value.Suggest, null, null); + writer.WriteProperty(options, PropTerminateAfter, value.TerminateAfter, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteProperty(options, PropTrackScores, value.TrackScores, null, null); + writer.WriteProperty(options, PropTrackTotalHits, value.TrackTotalHits, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(MultisearchBodyConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyConverter))] public sealed partial class MultisearchBody { - public IDictionary? Aggregations { get; set; } +#if NET7_0_OR_GREATER + public MultisearchBody() + { + } +#endif +#if !NET7_0_OR_GREATER + public MultisearchBody() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public System.Collections.Generic.IDictionary? Aggregations { get; set; } + + /// + /// + /// Collapses search results the values of the specified field. + /// + /// public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } /// /// - /// Array of wildcard (*) patterns. The request returns doc values for field - /// names matching these patterns in the hits.fields property of the response. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public ICollection? DocvalueFields { get; set; } + public System.Collections.Generic.ICollection? DocvalueFields { get; set; } /// /// - /// If true, returns detailed information about score computation as part of a hit. + /// If true, the request returns detailed information about score computation as part of a hit. /// /// public bool? Explain { get; set; } @@ -450,141 +413,221 @@ public sealed partial class MultisearchBody /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public IDictionary? Ext { get; set; } + public System.Collections.Generic.IDictionary? Ext { get; set; } /// /// - /// Array of wildcard (*) patterns. The request returns values for field names - /// matching these patterns in the hits.fields property of the response. + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. /// /// - public ICollection? Fields { get; set; } + public System.Collections.Generic.ICollection? Fields { get; set; } /// /// - /// Starting document offset. By default, you cannot page through more than 10,000 - /// hits using the from and size parameters. To page through more hits, use the - /// search_after parameter. + /// The starting document offset, which must be non-negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. /// /// public int? From { get; set; } + + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// public Elastic.Clients.Elasticsearch.Core.Search.Highlight? Highlight { get; set; } /// /// - /// Boosts the _score of documents from specified indices. + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. /// /// - public ICollection>? IndicesBoost { get; set; } + public System.Collections.Generic.ICollection>? IndicesBoost { get; set; } /// /// - /// Defines the approximate kNN search to run. + /// The approximate kNN search to run. /// /// - public ICollection? Knn { get; set; } + public System.Collections.Generic.ICollection? Knn { get; set; } /// /// - /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// The minimum _score for matching documents. + /// Documents with a lower _score are not included in search results or results collected by aggregations. /// /// public double? MinScore { get; set; } /// /// - /// Limits the search to a point in time (PIT). If you provide a PIT, you - /// cannot specify an <index> in the request path. + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. /// /// public Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? Pit { get; set; } + + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// public Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilter { get; set; } + + /// + /// + /// Set to true to return detailed timing information about the execution of individual components in a search request. + /// NOTE: This is a debugging tool and adds significant overhead to search execution. + /// + /// public bool? Profile { get; set; } /// /// - /// Defines the search definition using the Query DSL. + /// The search definition using the Query DSL. /// /// public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } - public ICollection? Rescore { get; set; } /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.Rank? Rank { get; set; } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public System.Collections.Generic.ICollection? Rescore { get; set; } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.Retriever? Retriever { get; set; } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public IDictionary? ScriptFields { get; set; } - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } + + /// + /// + /// Used to retrieve the next page of hits using a set of sort values from the previous page. + /// + /// + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// - /// If true, returns sequence number and primary term of the last modification - /// of each hit. See Optimistic concurrency control. + /// If true, the request returns sequence number and primary term of the last modification of each hit. /// /// public bool? SeqNoPrimaryTerm { get; set; } /// /// - /// The number of hits to return. By default, you cannot page through more - /// than 10,000 hits using the from and size parameters. To page through more - /// hits, use the search_after parameter. + /// The number of hits to return, which must not be negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after property. /// /// public int? Size { get; set; } - public ICollection? Sort { get; set; } /// /// - /// Indicates which source fields are returned for matching documents. These - /// fields are returned in the hits._source property of the search response. + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public System.Collections.Generic.ICollection? Sort { get; set; } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. /// /// public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } /// /// - /// Stats groups to associate with the search. Each group maintains a statistics - /// aggregation for its associated searches. You can retrieve these stats using - /// the indices stats API. + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. /// /// - public ICollection? Stats { get; set; } + public System.Collections.Generic.ICollection? Stats { get; set; } /// /// - /// List of stored fields to return as part of a hit. If no fields are specified, - /// no stored fields are included in the response. If this field is specified, the _source - /// parameter defaults to false. You can pass _source: true to return both source fields - /// and stored fields in the search response. + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. /// /// public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// public Elastic.Clients.Elasticsearch.Core.Search.Suggester? Suggest { get; set; } /// /// - /// Maximum number of documents to collect for each shard. If a query reaches this - /// limit, Elasticsearch terminates the query early. Elasticsearch collects documents - /// before sorting. Defaults to 0, which does not terminate query execution early. + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this property to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. + /// + /// + /// If set to 0 (default), the query does not terminate early. /// /// public long? TerminateAfter { get; set; } /// /// - /// Specifies the period of time to wait for a response from each shard. If no response - /// is received before the timeout expires, the request fails and returns an error. + /// The period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. /// Defaults to no timeout. /// /// @@ -592,2057 +635,2163 @@ public sealed partial class MultisearchBody /// /// - /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// public bool? TrackScores { get; set; } /// /// - /// Number of hits matching the query to count accurately. If true, the exact - /// number of hits is returned at the cost of some performance. If false, the - /// response does not include the total number of hits matching the query. - /// Defaults to 10,000 hits. + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. /// /// public Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHits { get; set; } /// /// - /// If true, returns document version as part of a hit. + /// If true, the request returns the document version as part of a hit. /// /// public bool? Version { get; set; } } -public sealed partial class MultisearchBodyDescriptor : SerializableDescriptor> +public readonly partial struct MultisearchBodyDescriptor { - internal MultisearchBodyDescriptor(Action> configure) => configure.Invoke(this); - - public MultisearchBodyDescriptor() : base() - { - } - - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action> DocvalueFieldsDescriptorAction { get; set; } - private Action>[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action> FieldsDescriptorAction { get; set; } - private Action>[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action> HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action> KnnDescriptorAction { get; set; } - private Action>[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action> PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action> RescoreDescriptorAction { get; set; } - private Action>[] RescoreDescriptorActions { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action> SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } + internal Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody Instance { get; init; } - public MultisearchBodyDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchBodyDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody instance) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance = instance; } - public MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchBodyDescriptor() { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) - { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody instance) => new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor descriptor) => descriptor.Instance; - public MultisearchBodyDescriptor Collapse(Action> configure) + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Aggregations = value; + return this; } /// /// - /// Array of wildcard (*) patterns. The request returns doc values for field - /// names matching these patterns in the hits.fields property of the response. + /// Defines the aggregations that are run as part of the search request. /// /// - public MultisearchBodyDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations() { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; } - public MultisearchBodyDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations(System.Action>? action) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } - public MultisearchBodyDescriptor DocvalueFields(Action> configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public MultisearchBodyDescriptor DocvalueFields(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddAggregation(string key, System.Action> action) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// /// - /// If true, returns detailed information about score computation as part of a hit. + /// Collapses search results the values of the specified field. /// /// - public MultisearchBodyDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - ExplainValue = explain; - return Self; + Instance.Collapse = value; + return this; } /// /// - /// Configuration of search extensions defined by Elasticsearch plugins. + /// Collapses search results the values of the specified field. /// /// - public MultisearchBodyDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Collapse(System.Action> action) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// /// - /// Array of wildcard (*) patterns. The request returns values for field names - /// matching these patterns in the hits.fields property of the response. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public MultisearchBodyDescriptor Fields(ICollection? fields) - { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; - } - - public MultisearchBodyDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) - { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; - } - - public MultisearchBodyDescriptor Fields(Action> configure) - { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; - } - - public MultisearchBodyDescriptor Fields(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.DocvalueFields = value; + return this; } /// /// - /// Starting document offset. By default, you cannot page through more than 10,000 - /// hits using the from and size parameters. To page through more hits, use the - /// search_after parameter. + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. /// /// - public MultisearchBodyDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - FromValue = from; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(params System.Action>[] actions) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) - { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.DocvalueFields = items; + return this; } - public MultisearchBodyDescriptor Highlight(Action> configure) + /// + /// + /// If true, the request returns detailed information about score computation as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Explain(bool? value = true) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.Explain = value; + return this; } /// /// - /// Boosts the _score of documents from specified indices. + /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public MultisearchBodyDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext(System.Collections.Generic.IDictionary? value) { - IndicesBoostValue = indicesBoost; - return Self; + Instance.Ext = value; + return this; } /// /// - /// Defines the approximate kNN search to run. + /// Configuration of search extensions defined by Elasticsearch plugins. /// /// - public MultisearchBodyDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext() { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public MultisearchBodyDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext(System.Action? action) { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public MultisearchBodyDescriptor Knn(Action> configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddExt(string key, object value) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; } - public MultisearchBodyDescriptor Knn(params Action>[] configure) + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(System.Collections.Generic.ICollection? value) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + Instance.Fields = value; + return this; } /// /// - /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. /// /// - public MultisearchBodyDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - MinScoreValue = minScore; - return Self; + Instance.Fields = [.. values]; + return this; } /// /// - /// Limits the search to a point in time (PIT). If you provide a PIT, you - /// cannot specify an <index> in the request path. + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. /// /// - public MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(params System.Action>[] actions) { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; - } - - public MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) - { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Pit(Action configure) - { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; + Instance.Fields = items; + return this; } - public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) + /// + /// + /// The starting document offset, which must be non-negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor From(int? value) { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; + Instance.From = value; + return this; } - public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; + Instance.Highlight = value; + return this; } - public MultisearchBodyDescriptor PostFilter(Action> configure) + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Highlight(System.Action> action) { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public MultisearchBodyDescriptor Profile(bool? profile = true) + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) { - ProfileValue = profile; - return Self; + Instance.IndicesBoost = value; + return this; } /// /// - /// Defines the search definition using the Query DSL. + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. /// /// - public MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost() { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; } - public MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost(System.Action? action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; } - public MultisearchBodyDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public MultisearchBodyDescriptor Rescore(ICollection? rescore) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(System.Collections.Generic.ICollection? value) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; + Instance.Knn = value; + return this; } - public MultisearchBodyDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.Knn = [.. values]; + return this; } - public MultisearchBodyDescriptor Rescore(Action> configure) + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(params System.Action>[] actions) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Rescore(params Action>[] configure) - { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.Knn = items; + return this; } /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// The minimum _score for matching documents. + /// Documents with a lower _score are not included in search results or results collected by aggregations. /// /// - public MultisearchBodyDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor MinScore(double? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.MinScore = value; + return this; } /// /// - /// Retrieve a script evaluation (based on different fields) for each hit. + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. /// /// - public MultisearchBodyDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) - { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; - } - - public MultisearchBodyDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.Pit = value; + return this; } /// /// - /// If true, returns sequence number and primary term of the last modification - /// of each hit. See Optimistic concurrency control. + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. /// /// - public MultisearchBodyDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Pit(System.Action action) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; } /// /// - /// The number of hits to return. By default, you cannot page through more - /// than 10,000 hits using the from and size parameters. To page through more - /// hits, use the search_after parameter. + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. /// /// - public MultisearchBodyDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - SizeValue = size; - return Self; + Instance.PostFilter = value; + return this; } - public MultisearchBodyDescriptor Sort(ICollection? sort) + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor PostFilter(System.Action> action) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public MultisearchBodyDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// Set to true to return detailed timing information about the execution of individual components in a search request. + /// NOTE: This is a debugging tool and adds significant overhead to search execution. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Profile(bool? value = true) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Profile = value; + return this; } - public MultisearchBodyDescriptor Sort(Action> configure) + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Query = value; + return this; } - public MultisearchBodyDescriptor Sort(params Action>[] configure) + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Query(System.Action> action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// /// - /// Indicates which source fields are returned for matching documents. These - /// fields are returned in the hits._source property of the search response. + /// The Reciprocal Rank Fusion (RRF) to use. /// /// - public MultisearchBodyDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? value) { - SourceValue = source; - return Self; + Instance.Rank = value; + return this; } /// /// - /// Stats groups to associate with the search. Each group maintains a statistics - /// aggregation for its associated searches. You can retrieve these stats using - /// the indices stats API. + /// The Reciprocal Rank Fusion (RRF) to use. /// /// - public MultisearchBodyDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rank(System.Action action) { - StatsValue = stats; - return Self; + Instance.Rank = Elastic.Clients.Elasticsearch.RankDescriptor.Build(action); + return this; } /// /// - /// List of stored fields to return as part of a hit. If no fields are specified, - /// no stored fields are included in the response. If this field is specified, the _source - /// parameter defaults to false. You can pass _source: true to return both source fields - /// and stored fields in the search response. + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. /// /// - public MultisearchBodyDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(System.Collections.Generic.ICollection? value) { - StoredFieldsValue = storedFields; - return Self; + Instance.Rescore = value; + return this; } - public MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; + Instance.Rescore = [.. values]; + return this; } - public MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(params System.Action>[] actions) { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Suggest(Action> configure) - { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.Rescore = items; + return this; } /// /// - /// Maximum number of documents to collect for each shard. If a query reaches this - /// limit, Elasticsearch terminates the query early. Elasticsearch collects documents - /// before sorting. Defaults to 0, which does not terminate query execution early. + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. /// /// - public MultisearchBodyDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.Retriever = value; + return this; } /// /// - /// Specifies the period of time to wait for a response from each shard. If no response - /// is received before the timeout expires, the request fails and returns an error. - /// Defaults to no timeout. + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. /// /// - public MultisearchBodyDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Retriever(System.Action> action) { - TimeoutValue = timeout; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } /// /// - /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public MultisearchBodyDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - TrackScoresValue = trackScores; - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Number of hits matching the query to count accurately. If true, the exact - /// number of hits is returned at the cost of some performance. If false, the - /// response does not include the total number of hits matching the query. - /// Defaults to 10,000 hits. + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public MultisearchBodyDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings() { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// If true, returns document version as part of a hit. + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. /// /// - public MultisearchBodyDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings(System.Action>? action) { - VersionValue = version; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } - - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (ExtValue is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } - - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } - - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } - - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } - - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); - } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } - - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StatsValue is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } - - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } - - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } - - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } - - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } - - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } - - writer.WriteEndObject(); + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } -} -public sealed partial class MultisearchBodyDescriptor : SerializableDescriptor -{ - internal MultisearchBodyDescriptor(Action configure) => configure.Invoke(this); - - public MultisearchBodyDescriptor() : base() - { - } - - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action DocvalueFieldsDescriptorAction { get; set; } - private Action[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private IDictionary? ExtValue { get; set; } - private ICollection? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor FieldsDescriptor { get; set; } - private Action FieldsDescriptorAction { get; set; } - private Action[] FieldsDescriptorActions { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private ICollection>? IndicesBoostValue { get; set; } - private ICollection? KnnValue { get; set; } - private Elastic.Clients.Elasticsearch.KnnSearchDescriptor KnnDescriptor { get; set; } - private Action KnnDescriptorAction { get; set; } - private Action[] KnnDescriptorActions { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? PitValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor PitDescriptor { get; set; } - private Action PitDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? PostFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PostFilterDescriptor { get; set; } - private Action PostFilterDescriptorAction { get; set; } - private bool? ProfileValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? RescoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } - private Action RescoreDescriptorAction { get; set; } - private Action[] RescoreDescriptorActions { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private ICollection? SearchAfterValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private ICollection? StatsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Suggester? SuggestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor SuggestDescriptor { get; set; } - private Action SuggestDescriptorAction { get; set; } - private long? TerminateAfterValue { get; set; } - private string? TimeoutValue { get; set; } - private bool? TrackScoresValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.TrackHits? TrackTotalHitsValue { get; set; } - private bool? VersionValue { get; set; } - - public MultisearchBodyDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public MultisearchBodyDescriptor Collapse(Action configure) + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.ScriptFields = value; + return this; } /// /// - /// Array of wildcard (*) patterns. The request returns doc values for field - /// names matching these patterns in the hits.fields property of the response. + /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public MultisearchBodyDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields() { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; } - public MultisearchBodyDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields(System.Action? action) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; } - public MultisearchBodyDescriptor DocvalueFields(Action configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; } - public MultisearchBodyDescriptor DocvalueFields(params Action[] configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddScriptField(string key, System.Action action) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } /// /// - /// If true, returns detailed information about score computation as part of a hit. + /// Used to retrieve the next page of hits using a set of sort values from the previous page. /// /// - public MultisearchBodyDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - ExplainValue = explain; - return Self; + Instance.SearchAfter = value; + return this; } /// /// - /// Configuration of search extensions defined by Elasticsearch plugins. + /// Used to retrieve the next page of hits using a set of sort values from the previous page. /// /// - public MultisearchBodyDescriptor Ext(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - ExtValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// /// - /// Array of wildcard (*) patterns. The request returns values for field names - /// matching these patterns in the hits.fields property of the response. + /// If true, the request returns sequence number and primary term of the last modification of each hit. /// /// - public MultisearchBodyDescriptor Fields(ICollection? fields) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SeqNoPrimaryTerm(bool? value = true) { - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsValue = fields; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } - public MultisearchBodyDescriptor Fields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// The number of hits to return, which must not be negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after property. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Size(int? value) + { + Instance.Size = value; + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) + { + Instance.Slice = value; + return this; + } + + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Slice(System.Action> action) + { + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) + { + Instance.Sort = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; + } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; + } + + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Stats(System.Collections.Generic.ICollection? value) + { + Instance.Stats = value; + return this; + } + + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Stats(params string[] values) + { + Instance.Stats = [.. values]; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.StoredFields = value; + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) + { + Instance.Suggest = value; + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest() + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; + } + + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest(System.Action>? action) + { + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; + } + + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this property to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. + /// + /// + /// If set to 0 (default), the query does not terminate early. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TerminateAfter(long? value) + { + Instance.TerminateAfter = value; + return this; + } + + /// + /// + /// The period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Timeout(string? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackScores(bool? value = true) + { + Instance.TrackScores = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) + { + Instance.TrackTotalHits = value; + return this; + } + + /// + /// + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackTotalHits(System.Func action) + { + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; + } + + /// + /// + /// If true, the request returns the document version as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Version(bool? value = true) + { + Instance.Version = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct MultisearchBodyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchBodyDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchBodyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody instance) => new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + /// + /// + /// Defines the aggregations that are run as part of the search request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + /// + /// + /// Collapses search results the values of the specified field. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) + { + Instance.Collapse = value; + return this; + } + + /// + /// + /// Collapses search results the values of the specified field. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Collapse(System.Action action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } + + /// + /// + /// Collapses search results the values of the specified field. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Collapse(System.Action> action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) + { + Instance.DocvalueFields = value; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) + { + Instance.DocvalueFields = [.. values]; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns doc values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor DocvalueFields(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; + } + + /// + /// + /// If true, the request returns detailed information about score computation as part of a hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; + } + + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext(System.Collections.Generic.IDictionary? value) + { + Instance.Ext = value; + return this; + } + + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext() + { + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Configuration of search extensions defined by Elasticsearch plugins. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Ext(System.Action? action) + { + Instance.Ext = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddExt(string key, object value) + { + Instance.Ext ??= new System.Collections.Generic.Dictionary(); + Instance.Ext.Add(key, value); + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(System.Collections.Generic.ICollection? value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) + { + Instance.Fields = [.. values]; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; + } + + /// + /// + /// An array of wildcard (*) field patterns. + /// The request returns values for field names matching these patterns in the hits.fields property of the response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Fields(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.Fields = items; + return this; + } + + /// + /// + /// The starting document offset, which must be non-negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor From(int? value) + { + Instance.From = value; + return this; + } + + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) + { + Instance.Highlight = value; + return this; + } + + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Highlight(System.Action action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; + } + + /// + /// + /// Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Highlight(System.Action> action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; + } + + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost(System.Collections.Generic.ICollection>? value) + { + Instance.IndicesBoost = value; + return this; + } + + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost() + { + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(null); + return this; + } + + /// + /// + /// Boost the _score of documents from specified indices. + /// The boost value is the factor by which scores are multiplied. + /// A boost value greater than 1.0 increases the score. + /// A boost value between 0 and 1.0 decreases the score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor IndicesBoost(System.Action? action) + { + Instance.IndicesBoost = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfIndexNameDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddIndicesBoost(Elastic.Clients.Elasticsearch.IndexName key, double value) + { + Instance.IndicesBoost ??= new System.Collections.Generic.List>(); + Instance.IndicesBoost.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; + } + + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(System.Collections.Generic.ICollection? value) + { + Instance.Knn = value; + return this; + } + + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(params Elastic.Clients.Elasticsearch.KnnSearch[] values) + { + Instance.Knn = [.. values]; + return this; + } + + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); + } + + Instance.Knn = items; + return this; + } + + /// + /// + /// The approximate kNN search to run. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Knn(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.KnnSearchDescriptor.Build(action)); + } + + Instance.Knn = items; + return this; + } + + /// + /// + /// The minimum _score for matching documents. + /// Documents with a lower _score are not included in search results or results collected by aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor MinScore(double? value) + { + Instance.MinScore = value; + return this; + } + + /// + /// + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? value) + { + Instance.Pit = value; + return this; + } + + /// + /// + /// Limit the search to a point in time (PIT). + /// If you provide a PIT, you cannot specify an <index> in the request path. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Pit(System.Action action) + { + Instance.Pit = Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor.Build(action); + return this; + } + + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.PostFilter = value; + return this; + } + + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor PostFilter(System.Action action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Use the post_filter parameter to filter search results. + /// The search hits are filtered after the aggregations are calculated. + /// A post filter has no impact on the aggregation results. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor PostFilter(System.Action> action) + { + Instance.PostFilter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Set to true to return detailed timing information about the execution of individual components in a search request. + /// NOTE: This is a debugging tool and adds significant overhead to search execution. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Profile(bool? value = true) + { + Instance.Profile = value; + return this; + } + + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Query = value; + return this; + } + + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The search definition using the Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rank(Elastic.Clients.Elasticsearch.Rank? value) + { + Instance.Rank = value; + return this; + } + + /// + /// + /// The Reciprocal Rank Fusion (RRF) to use. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rank(System.Action action) + { + Instance.Rank = Elastic.Clients.Elasticsearch.RankDescriptor.Build(action); + return this; + } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(System.Collections.Generic.ICollection? value) + { + Instance.Rescore = value; + return this; + } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(params Elastic.Clients.Elasticsearch.Core.Search.Rescore[] values) + { + Instance.Rescore = [.. values]; + return this; + } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); + } + + Instance.Rescore = items; + return this; + } + + /// + /// + /// Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Rescore(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor.Build(action)); + } + + Instance.Rescore = items; + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever? value) + { + Instance.Retriever = value; + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Retriever(System.Action action) + { + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever is a specification to describe top documents returned from a search. + /// A retriever replaces other elements of the search API that also return top documents such as query and knn. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Retriever(System.Action> action) + { + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + /// + /// + /// One or more runtime fields in the search request. + /// These fields take precedence over mapped fields with the same name. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor RuntimeMappings(System.Action>? action) { - FieldsValue = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = null; - FieldsDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public MultisearchBodyDescriptor Fields(Action configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorActions = null; - FieldsDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public MultisearchBodyDescriptor Fields(params Action[] configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - FieldsValue = null; - FieldsDescriptor = null; - FieldsDescriptorAction = null; - FieldsDescriptorActions = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - /// - /// - /// Starting document offset. By default, you cannot page through more than 10,000 - /// hits using the from and size parameters. To page through more hits, use the - /// search_after parameter. - /// - /// - public MultisearchBodyDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) { - FromValue = from; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public MultisearchBodyDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - public MultisearchBodyDescriptor Highlight(Action configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// /// - /// Boosts the _score of documents from specified indices. + /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public MultisearchBodyDescriptor IndicesBoost(ICollection>? indicesBoost) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - IndicesBoostValue = indicesBoost; - return Self; + Instance.ScriptFields = value; + return this; } /// /// - /// Defines the approximate kNN search to run. + /// Retrieve a script evaluation (based on different fields) for each hit. /// /// - public MultisearchBodyDescriptor Knn(ICollection? knn) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields() { - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnValue = knn; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; } - public MultisearchBodyDescriptor Knn(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) + /// + /// + /// Retrieve a script evaluation (based on different fields) for each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor ScriptFields(System.Action? action) { - KnnValue = null; - KnnDescriptorAction = null; - KnnDescriptorActions = null; - KnnDescriptor = descriptor; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; } - public MultisearchBodyDescriptor Knn(Action configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorActions = null; - KnnDescriptorAction = configure; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; } - public MultisearchBodyDescriptor Knn(params Action[] configure) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor AddScriptField(string key, System.Action action) { - KnnValue = null; - KnnDescriptor = null; - KnnDescriptorAction = null; - KnnDescriptorActions = configure; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } /// /// - /// Minimum _score for matching documents. Documents with a lower _score are - /// not included in the search results. + /// Used to retrieve the next page of hits using a set of sort values from the previous page. /// /// - public MultisearchBodyDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - MinScoreValue = minScore; - return Self; + Instance.SearchAfter = value; + return this; } /// /// - /// Limits the search to a point in time (PIT). If you provide a PIT, you - /// cannot specify an <index> in the request path. + /// Used to retrieve the next page of hits using a set of sort values from the previous page. /// /// - public MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference? pit) - { - PitDescriptor = null; - PitDescriptorAction = null; - PitValue = pit; - return Self; - } - - public MultisearchBodyDescriptor Pit(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - PitValue = null; - PitDescriptorAction = null; - PitDescriptor = descriptor; - return Self; + Instance.SearchAfter = [.. values]; + return this; } - public MultisearchBodyDescriptor Pit(Action configure) - { - PitValue = null; - PitDescriptor = null; - PitDescriptorAction = configure; - return Self; - } - - public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.Query? postFilter) + /// + /// + /// If true, the request returns sequence number and primary term of the last modification of each hit. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor SeqNoPrimaryTerm(bool? value = true) { - PostFilterDescriptor = null; - PostFilterDescriptorAction = null; - PostFilterValue = postFilter; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } - public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The number of hits to return, which must not be negative. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after property. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Size(int? value) { - PostFilterValue = null; - PostFilterDescriptorAction = null; - PostFilterDescriptor = descriptor; - return Self; + Instance.Size = value; + return this; } - public MultisearchBodyDescriptor PostFilter(Action configure) + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - PostFilterValue = null; - PostFilterDescriptor = null; - PostFilterDescriptorAction = configure; - return Self; + Instance.Slice = value; + return this; } - public MultisearchBodyDescriptor Profile(bool? profile = true) + /// + /// + /// Split a scrolled search into multiple slices that can be consumed independently. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Slice(System.Action action) { - ProfileValue = profile; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } /// /// - /// Defines the search definition using the Query DSL. + /// Split a scrolled search into multiple slices that can be consumed independently. /// /// - public MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Slice(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public MultisearchBodyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Sort = value; + return this; } - public MultisearchBodyDescriptor Query(Action configure) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Sort = [.. values]; + return this; } - public MultisearchBodyDescriptor Rescore(ICollection? rescore) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(params System.Action[] actions) { - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreValue = rescore; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) - { - RescoreValue = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = null; - RescoreDescriptor = descriptor; - return Self; + Instance.Sort = items; + return this; } - public MultisearchBodyDescriptor Rescore(Action configure) + /// + /// + /// A comma-separated list of <field>:<direction> pairs. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Sort(params System.Action>[] actions) { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorActions = null; - RescoreDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public MultisearchBodyDescriptor Rescore(params Action[] configure) - { - RescoreValue = null; - RescoreDescriptor = null; - RescoreDescriptorAction = null; - RescoreDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } /// /// - /// Defines one or more runtime fields in the search request. These fields take - /// precedence over mapped fields with the same name. + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. /// /// - public MultisearchBodyDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Source = value; + return this; } /// /// - /// Retrieve a script evaluation (based on different fields) for each hit. + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. /// /// - public MultisearchBodyDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Source(System.Func action) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; - } - - public MultisearchBodyDescriptor SearchAfter(ICollection? searchAfter) - { - SearchAfterValue = searchAfter; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// /// - /// If true, returns sequence number and primary term of the last modification - /// of each hit. See Optimistic concurrency control. + /// The source fields that are returned for matching documents. + /// These fields are returned in the hits._source property of the search response. + /// If the stored_fields property is specified, the _source property defaults to false. + /// Otherwise, it defaults to true. /// /// - public MultisearchBodyDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } /// /// - /// The number of hits to return. By default, you cannot page through more - /// than 10,000 hits using the from and size parameters. To page through more - /// hits, use the search_after parameter. + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. /// /// - public MultisearchBodyDescriptor Size(int? size) - { - SizeValue = size; - return Self; - } - - public MultisearchBodyDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public MultisearchBodyDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Stats(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Stats = value; + return this; } - public MultisearchBodyDescriptor Sort(Action configure) + /// + /// + /// The stats groups to associate with the search. + /// Each group maintains a statistics aggregation for its associated searches. + /// You can retrieve these stats using the indices stats API. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Stats(params string[] values) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Stats = [.. values]; + return this; } - public MultisearchBodyDescriptor Sort(params Action[] configure) + /// + /// + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.StoredFields = value; + return this; } /// /// - /// Indicates which source fields are returned for matching documents. These - /// fields are returned in the hits._source property of the search response. + /// A comma-separated list of stored fields to return as part of a hit. + /// If no fields are specified, no stored fields are included in the response. + /// If this field is specified, the _source property defaults to false. + /// You can pass _source: true to return both source fields and stored fields in the search response. /// /// - public MultisearchBodyDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - SourceValue = source; - return Self; + Instance.StoredFields = value; + return this; } /// /// - /// Stats groups to associate with the search. Each group maintains a statistics - /// aggregation for its associated searches. You can retrieve these stats using - /// the indices stats API. + /// Defines a suggester that provides similar looking terms based on a provided text. /// /// - public MultisearchBodyDescriptor Stats(ICollection? stats) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? value) { - StatsValue = stats; - return Self; + Instance.Suggest = value; + return this; } /// /// - /// List of stored fields to return as part of a hit. If no fields are specified, - /// no stored fields are included in the response. If this field is specified, the _source - /// parameter defaults to false. You can pass _source: true to return both source fields - /// and stored fields in the search response. + /// Defines a suggester that provides similar looking terms based on a provided text. /// /// - public MultisearchBodyDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest() { - StoredFieldsValue = storedFields; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(null); + return this; } - public MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.Suggester? suggest) + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest(System.Action? action) { - SuggestDescriptor = null; - SuggestDescriptorAction = null; - SuggestValue = suggest; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; } - public MultisearchBodyDescriptor Suggest(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) + /// + /// + /// Defines a suggester that provides similar looking terms based on a provided text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Suggest(System.Action>? action) { - SuggestValue = null; - SuggestDescriptorAction = null; - SuggestDescriptor = descriptor; - return Self; + Instance.Suggest = Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor.Build(action); + return this; } - public MultisearchBodyDescriptor Suggest(Action configure) + /// + /// + /// The maximum number of documents to collect for each shard. + /// If a query reaches this limit, Elasticsearch terminates the query early. + /// Elasticsearch collects documents before sorting. + /// + /// + /// IMPORTANT: Use with caution. + /// Elasticsearch applies this property to each shard handling the request. + /// When possible, let Elasticsearch perform early termination automatically. + /// Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers. + /// + /// + /// If set to 0 (default), the query does not terminate early. + /// + /// + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TerminateAfter(long? value) { - SuggestValue = null; - SuggestDescriptor = null; - SuggestDescriptorAction = configure; - return Self; + Instance.TerminateAfter = value; + return this; } /// /// - /// Maximum number of documents to collect for each shard. If a query reaches this - /// limit, Elasticsearch terminates the query early. Elasticsearch collects documents - /// before sorting. Defaults to 0, which does not terminate query execution early. + /// The period of time to wait for a response from each shard. + /// If no response is received before the timeout expires, the request fails and returns an error. + /// Defaults to no timeout. /// /// - public MultisearchBodyDescriptor TerminateAfter(long? terminateAfter) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Timeout(string? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.Timeout = value; + return this; } /// /// - /// Specifies the period of time to wait for a response from each shard. If no response - /// is received before the timeout expires, the request fails and returns an error. - /// Defaults to no timeout. + /// If true, calculate and return document scores, even if the scores are not used for sorting. /// /// - public MultisearchBodyDescriptor Timeout(string? timeout) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackScores(bool? value = true) { - TimeoutValue = timeout; - return Self; + Instance.TrackScores = value; + return this; } /// /// - /// If true, calculate and return document scores, even if the scores are not used for sorting. + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. /// /// - public MultisearchBodyDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? value) { - TrackScoresValue = trackScores; - return Self; + Instance.TrackTotalHits = value; + return this; } /// /// - /// Number of hits matching the query to count accurately. If true, the exact - /// number of hits is returned at the cost of some performance. If false, the - /// response does not include the total number of hits matching the query. - /// Defaults to 10,000 hits. + /// Number of hits matching the query to count accurately. + /// If true, the exact number of hits is returned at the cost of some performance. + /// If false, the response does not include the total number of hits matching the query. /// /// - public MultisearchBodyDescriptor TrackTotalHits(Elastic.Clients.Elasticsearch.Core.Search.TrackHits? trackTotalHits) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor TrackTotalHits(System.Func action) { - TrackTotalHitsValue = trackTotalHits; - return Self; + Instance.TrackTotalHits = Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory.Build(action); + return this; } /// /// - /// If true, returns document version as part of a hit. + /// If true, the request returns the document version as part of a hit. /// /// - public MultisearchBodyDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor Version(bool? value = true) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody Build(System.Action? action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } - - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (ExtValue is not null) - { - writer.WritePropertyName("ext"); - JsonSerializer.Serialize(writer, ExtValue, options); - } - - if (FieldsDescriptor is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorAction is not null) - { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(FieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FieldsDescriptorActions is not null) + if (action is null) { - writer.WritePropertyName("fields"); - writer.WriteStartArray(); - foreach (var action in FieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IndicesBoostValue is not null) - { - writer.WritePropertyName("indices_boost"); - JsonSerializer.Serialize(writer, IndicesBoostValue, options); - } - - if (KnnDescriptor is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, KnnDescriptor, options); - } - else if (KnnDescriptorAction is not null) - { - writer.WritePropertyName("knn"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(KnnDescriptorAction), options); - } - else if (KnnDescriptorActions is not null) - { - writer.WritePropertyName("knn"); - if (KnnDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in KnnDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(action), options); - } - - if (KnnDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (KnnValue is not null) - { - writer.WritePropertyName("knn"); - SingleOrManySerializationHelper.Serialize(KnnValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (PitDescriptor is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitDescriptor, options); - } - else if (PitDescriptorAction is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(PitDescriptorAction), options); - } - else if (PitValue is not null) - { - writer.WritePropertyName("pit"); - JsonSerializer.Serialize(writer, PitValue, options); - } - - if (PostFilterDescriptor is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterDescriptor, options); - } - else if (PostFilterDescriptorAction is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PostFilterDescriptorAction), options); - } - else if (PostFilterValue is not null) - { - writer.WritePropertyName("post_filter"); - JsonSerializer.Serialize(writer, PostFilterValue, options); - } - - if (ProfileValue.HasValue) - { - writer.WritePropertyName("profile"); - writer.WriteBooleanValue(ProfileValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (RescoreDescriptor is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, RescoreDescriptor, options); - } - else if (RescoreDescriptorAction is not null) - { - writer.WritePropertyName("rescore"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(RescoreDescriptorAction), options); - } - else if (RescoreDescriptorActions is not null) - { - writer.WritePropertyName("rescore"); - if (RescoreDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in RescoreDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(action), options); - } - - if (RescoreDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (RescoreValue is not null) - { - writer.WritePropertyName("rescore"); - SingleOrManySerializationHelper.Serialize(RescoreValue, writer, options); - } - - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StatsValue is not null) - { - writer.WritePropertyName("stats"); - JsonSerializer.Serialize(writer, StatsValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } - - if (SuggestDescriptor is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestDescriptor, options); - } - else if (SuggestDescriptorAction is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(SuggestDescriptorAction), options); - } - else if (SuggestValue is not null) - { - writer.WritePropertyName("suggest"); - JsonSerializer.Serialize(writer, SuggestValue, options); - } - - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } - - if (!string.IsNullOrEmpty(TimeoutValue)) - { - writer.WritePropertyName("timeout"); - writer.WriteStringValue(TimeoutValue); - } - - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } - - if (TrackTotalHitsValue is not null) - { - writer.WritePropertyName("track_total_hits"); - JsonSerializer.Serialize(writer, TrackTotalHitsValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBodyDescriptor(new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchBody(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchHeader.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchHeader.g.cs index c9ff671b68d..0e9a1ccda52 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchHeader.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearch/MultisearchHeader.g.cs @@ -17,45 +17,175 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MSearch; +internal sealed partial class MultisearchHeaderConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowNoIndices = System.Text.Json.JsonEncodedText.Encode("allow_no_indices"); + private static readonly System.Text.Json.JsonEncodedText PropAllowPartialSearchResults = System.Text.Json.JsonEncodedText.Encode("allow_partial_search_results"); + private static readonly System.Text.Json.JsonEncodedText PropCcsMinimizeRoundtrips = System.Text.Json.JsonEncodedText.Encode("ccs_minimize_roundtrips"); + private static readonly System.Text.Json.JsonEncodedText PropExpandWildcards = System.Text.Json.JsonEncodedText.Encode("expand_wildcards"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreThrottled = System.Text.Json.JsonEncodedText.Encode("ignore_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnavailable = System.Text.Json.JsonEncodedText.Encode("ignore_unavailable"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPreference = System.Text.Json.JsonEncodedText.Encode("preference"); + private static readonly System.Text.Json.JsonEncodedText PropRequestCache = System.Text.Json.JsonEncodedText.Encode("request_cache"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearchType = System.Text.Json.JsonEncodedText.Encode("search_type"); + + public override Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowNoIndices = default; + LocalJsonValue propAllowPartialSearchResults = default; + LocalJsonValue propCcsMinimizeRoundtrips = default; + LocalJsonValue?> propExpandWildcards = default; + LocalJsonValue propIgnoreThrottled = default; + LocalJsonValue propIgnoreUnavailable = default; + LocalJsonValue propIndices = default; + LocalJsonValue propPreference = default; + LocalJsonValue propRequestCache = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearchType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowNoIndices.TryReadProperty(ref reader, options, PropAllowNoIndices, null)) + { + continue; + } + + if (propAllowPartialSearchResults.TryReadProperty(ref reader, options, PropAllowPartialSearchResults, null)) + { + continue; + } + + if (propCcsMinimizeRoundtrips.TryReadProperty(ref reader, options, PropCcsMinimizeRoundtrips, null)) + { + continue; + } + + if (propExpandWildcards.TryReadProperty(ref reader, options, PropExpandWildcards, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreThrottled.TryReadProperty(ref reader, options, PropIgnoreThrottled, null)) + { + continue; + } + + if (propIgnoreUnavailable.TryReadProperty(ref reader, options, PropIgnoreUnavailable, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propPreference.TryReadProperty(ref reader, options, PropPreference, null)) + { + continue; + } + + if (propRequestCache.TryReadProperty(ref reader, options, PropRequestCache, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearchType.TryReadProperty(ref reader, options, PropSearchType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowNoIndices = propAllowNoIndices.Value, + AllowPartialSearchResults = propAllowPartialSearchResults.Value, + CcsMinimizeRoundtrips = propCcsMinimizeRoundtrips.Value, + ExpandWildcards = propExpandWildcards.Value, + IgnoreThrottled = propIgnoreThrottled.Value, + IgnoreUnavailable = propIgnoreUnavailable.Value, + Indices = propIndices.Value, + Preference = propPreference.Value, + RequestCache = propRequestCache.Value, + Routing = propRouting.Value, + SearchType = propSearchType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowNoIndices, value.AllowNoIndices, null, null); + writer.WriteProperty(options, PropAllowPartialSearchResults, value.AllowPartialSearchResults, null, null); + writer.WriteProperty(options, PropCcsMinimizeRoundtrips, value.CcsMinimizeRoundtrips, null, null); + writer.WriteProperty(options, PropExpandWildcards, value.ExpandWildcards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreThrottled, value.IgnoreThrottled, null, null); + writer.WriteProperty(options, PropIgnoreUnavailable, value.IgnoreUnavailable, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropPreference, value.Preference, null, null); + writer.WriteProperty(options, PropRequestCache, value.RequestCache, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearchType, value.SearchType, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Contains parameters used to limit or change the subsequent search body request. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderConverter))] public sealed partial class MultisearchHeader { - [JsonInclude, JsonPropertyName("allow_no_indices")] +#if NET7_0_OR_GREATER + public MultisearchHeader() + { + } +#endif +#if !NET7_0_OR_GREATER + public MultisearchHeader() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultisearchHeader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? AllowNoIndices { get; set; } - [JsonInclude, JsonPropertyName("allow_partial_search_results")] public bool? AllowPartialSearchResults { get; set; } - [JsonInclude, JsonPropertyName("ccs_minimize_roundtrips")] public bool? CcsMinimizeRoundtrips { get; set; } - [JsonInclude, JsonPropertyName("expand_wildcards")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.ExpandWildcard))] - public ICollection? ExpandWildcards { get; set; } - [JsonInclude, JsonPropertyName("ignore_throttled")] + public System.Collections.Generic.ICollection? ExpandWildcards { get; set; } public bool? IgnoreThrottled { get; set; } - [JsonInclude, JsonPropertyName("ignore_unavailable")] public bool? IgnoreUnavailable { get; set; } - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } - [JsonInclude, JsonPropertyName("preference")] public string? Preference { get; set; } - [JsonInclude, JsonPropertyName("request_cache")] public bool? RequestCache { get; set; } - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } - [JsonInclude, JsonPropertyName("search_type")] public Elastic.Clients.Elasticsearch.SearchType? SearchType { get; set; } } @@ -64,161 +194,107 @@ public sealed partial class MultisearchHeader /// Contains parameters used to limit or change the subsequent search body request. /// /// -public sealed partial class MultisearchHeaderDescriptor : SerializableDescriptor +public readonly partial struct MultisearchHeaderDescriptor { - internal MultisearchHeaderDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader Instance { get; init; } - public MultisearchHeaderDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchHeaderDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader instance) { + Instance = instance; } - private bool? AllowNoIndicesValue { get; set; } - private bool? AllowPartialSearchResultsValue { get; set; } - private bool? CcsMinimizeRoundtripsValue { get; set; } - private ICollection? ExpandWildcardsValue { get; set; } - private bool? IgnoreThrottledValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private string? PreferenceValue { get; set; } - private bool? RequestCacheValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.SearchType? SearchTypeValue { get; set; } - - public MultisearchHeaderDescriptor AllowNoIndices(bool? allowNoIndices = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultisearchHeaderDescriptor() { - AllowNoIndicesValue = allowNoIndices; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MultisearchHeaderDescriptor AllowPartialSearchResults(bool? allowPartialSearchResults = true) + public static explicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader instance) => new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader(Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor AllowNoIndices(bool? value = true) { - AllowPartialSearchResultsValue = allowPartialSearchResults; - return Self; + Instance.AllowNoIndices = value; + return this; } - public MultisearchHeaderDescriptor CcsMinimizeRoundtrips(bool? ccsMinimizeRoundtrips = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor AllowPartialSearchResults(bool? value = true) { - CcsMinimizeRoundtripsValue = ccsMinimizeRoundtrips; - return Self; + Instance.AllowPartialSearchResults = value; + return this; } - public MultisearchHeaderDescriptor ExpandWildcards(ICollection? expandWildcards) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor CcsMinimizeRoundtrips(bool? value = true) { - ExpandWildcardsValue = expandWildcards; - return Self; + Instance.CcsMinimizeRoundtrips = value; + return this; } - public MultisearchHeaderDescriptor IgnoreThrottled(bool? ignoreThrottled = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - IgnoreThrottledValue = ignoreThrottled; - return Self; + Instance.ExpandWildcards = value; + return this; } - public MultisearchHeaderDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } - public MultisearchHeaderDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor IgnoreThrottled(bool? value = true) { - IndicesValue = indices; - return Self; + Instance.IgnoreThrottled = value; + return this; } - public MultisearchHeaderDescriptor Preference(string? preference) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor IgnoreUnavailable(bool? value = true) { - PreferenceValue = preference; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - public MultisearchHeaderDescriptor RequestCache(bool? requestCache = true) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - RequestCacheValue = requestCache; - return Self; + Instance.Indices = value; + return this; } - public MultisearchHeaderDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor Preference(string? value) { - RoutingValue = routing; - return Self; + Instance.Preference = value; + return this; } - public MultisearchHeaderDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? searchType) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor RequestCache(bool? value = true) { - SearchTypeValue = searchType; - return Self; + Instance.RequestCache = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - writer.WriteStartObject(); - if (AllowNoIndicesValue.HasValue) - { - writer.WritePropertyName("allow_no_indices"); - writer.WriteBooleanValue(AllowNoIndicesValue.Value); - } - - if (AllowPartialSearchResultsValue.HasValue) - { - writer.WritePropertyName("allow_partial_search_results"); - writer.WriteBooleanValue(AllowPartialSearchResultsValue.Value); - } - - if (CcsMinimizeRoundtripsValue.HasValue) - { - writer.WritePropertyName("ccs_minimize_roundtrips"); - writer.WriteBooleanValue(CcsMinimizeRoundtripsValue.Value); - } - - if (ExpandWildcardsValue is not null) - { - writer.WritePropertyName("expand_wildcards"); - SingleOrManySerializationHelper.Serialize(ExpandWildcardsValue, writer, options); - } - - if (IgnoreThrottledValue.HasValue) - { - writer.WritePropertyName("ignore_throttled"); - writer.WriteBooleanValue(IgnoreThrottledValue.Value); - } - - if (IgnoreUnavailableValue.HasValue) - { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); - } - - if (IndicesValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (!string.IsNullOrEmpty(PreferenceValue)) - { - writer.WritePropertyName("preference"); - writer.WriteStringValue(PreferenceValue); - } - - if (RequestCacheValue.HasValue) - { - writer.WritePropertyName("request_cache"); - writer.WriteBooleanValue(RequestCacheValue.Value); - } + Instance.Routing = value; + return this; + } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor SearchType(Elastic.Clients.Elasticsearch.SearchType? value) + { + Instance.SearchType = value; + return this; + } - if (SearchTypeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("search_type"); - JsonSerializer.Serialize(writer, SearchTypeValue, options); + return new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeaderDescriptor(new Elastic.Clients.Elasticsearch.Core.MSearch.MultisearchHeader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearchTemplate/TemplateConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearchTemplate/TemplateConfig.g.cs index 9b4e2b6bcb4..ebcf76eefc1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearchTemplate/TemplateConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MSearchTemplate/TemplateConfig.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MSearchTemplate; +internal sealed partial class TemplateConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropProfile = System.Text.Json.JsonEncodedText.Encode("profile"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.Core.MSearchTemplate.TemplateConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExplain = default; + LocalJsonValue propId = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propProfile = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProfile.TryReadProperty(ref reader, options, PropProfile, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.MSearchTemplate.TemplateConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Explain = propExplain.Value, + Id = propId.Value, + Params = propParams.Value, + Profile = propProfile.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MSearchTemplate.TemplateConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProfile, value.Profile, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MSearchTemplate.TemplateConfigConverter))] public sealed partial class TemplateConfig { +#if NET7_0_OR_GREATER + public TemplateConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public TemplateConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TemplateConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, returns detailed information about score calculation as part of each hit. /// /// - [JsonInclude, JsonPropertyName("explain")] - public bool? Explain { get; init; } + public bool? Explain { get; set; } /// /// @@ -43,8 +130,7 @@ public sealed partial class TemplateConfig /// this parameter is required. /// /// - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id? Id { get; init; } + public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// /// @@ -53,16 +139,14 @@ public sealed partial class TemplateConfig /// The value is the variable value. /// /// - [JsonInclude, JsonPropertyName("params")] - public IReadOnlyDictionary? Params { get; init; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// If true, the query execution is profiled. /// /// - [JsonInclude, JsonPropertyName("profile")] - public bool? Profile { get; init; } + public bool? Profile { get; set; } /// /// @@ -71,6 +155,5 @@ public sealed partial class TemplateConfig /// parameter is required. /// /// - [JsonInclude, JsonPropertyName("source")] - public string? Source { get; init; } + public string? Source { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsOperation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsOperation.g.cs index a21f16a7f7d..0917bfb79dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsOperation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsOperation.g.cs @@ -17,24 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Mtermvectors; +internal sealed partial class MultiTermVectorsOperationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFieldStatistics = System.Text.Json.JsonEncodedText.Encode("field_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropOffsets = System.Text.Json.JsonEncodedText.Encode("offsets"); + private static readonly System.Text.Json.JsonEncodedText PropPayloads = System.Text.Json.JsonEncodedText.Encode("payloads"); + private static readonly System.Text.Json.JsonEncodedText PropPositions = System.Text.Json.JsonEncodedText.Encode("positions"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropTermStatistics = System.Text.Json.JsonEncodedText.Encode("term_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoc = default; + LocalJsonValue propFields = default; + LocalJsonValue propFieldStatistics = default; + LocalJsonValue propFilter = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propOffsets = default; + LocalJsonValue propPayloads = default; + LocalJsonValue propPositions = default; + LocalJsonValue propRouting = default; + LocalJsonValue propTermStatistics = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propFieldStatistics.TryReadProperty(ref reader, options, PropFieldStatistics, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propOffsets.TryReadProperty(ref reader, options, PropOffsets, null)) + { + continue; + } + + if (propPayloads.TryReadProperty(ref reader, options, PropPayloads, null)) + { + continue; + } + + if (propPositions.TryReadProperty(ref reader, options, PropPositions, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propTermStatistics.TryReadProperty(ref reader, options, PropTermStatistics, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Doc = propDoc.Value, + Fields = propFields.Value, + FieldStatistics = propFieldStatistics.Value, + Filter = propFilter.Value, + Id = propId.Value, + Index = propIndex.Value, + Offsets = propOffsets.Value, + Payloads = propPayloads.Value, + Positions = propPositions.Value, + Routing = propRouting.Value, + TermStatistics = propTermStatistics.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropFieldStatistics, value.FieldStatistics, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropOffsets, value.Offsets, null, null); + writer.WriteProperty(options, PropPayloads, value.Payloads, null, null); + writer.WriteProperty(options, PropPositions, value.Positions, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropTermStatistics, value.TermStatistics, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationConverter))] public sealed partial class MultiTermVectorsOperation { +#if NET7_0_OR_GREATER + public MultiTermVectorsOperation() + { + } +#endif +#if !NET7_0_OR_GREATER + public MultiTermVectorsOperation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. /// /// - [JsonInclude, JsonPropertyName("doc")] public object? Doc { get; set; } /// @@ -43,8 +202,6 @@ public sealed partial class MultiTermVectorsOperation /// Used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -52,7 +209,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. /// /// - [JsonInclude, JsonPropertyName("field_statistics")] public bool? FieldStatistics { get; set; } /// @@ -60,7 +216,6 @@ public sealed partial class MultiTermVectorsOperation /// Filter terms based on their tf-idf scores. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? Filter { get; set; } /// @@ -68,7 +223,6 @@ public sealed partial class MultiTermVectorsOperation /// The ID of the document. /// /// - [JsonInclude, JsonPropertyName("_id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -76,7 +230,6 @@ public sealed partial class MultiTermVectorsOperation /// The index of the document. /// /// - [JsonInclude, JsonPropertyName("_index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -84,7 +237,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, the response includes term offsets. /// /// - [JsonInclude, JsonPropertyName("offsets")] public bool? Offsets { get; set; } /// @@ -92,7 +244,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, the response includes term payloads. /// /// - [JsonInclude, JsonPropertyName("payloads")] public bool? Payloads { get; set; } /// @@ -100,7 +251,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, the response includes term positions. /// /// - [JsonInclude, JsonPropertyName("positions")] public bool? Positions { get; set; } /// @@ -108,7 +258,6 @@ public sealed partial class MultiTermVectorsOperation /// Custom value used to route operations to a specific shard. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -116,7 +265,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, the response includes term frequency and document frequency. /// /// - [JsonInclude, JsonPropertyName("term_statistics")] public bool? TermStatistics { get; set; } /// @@ -124,7 +272,6 @@ public sealed partial class MultiTermVectorsOperation /// If true, returns the document version as part of a hit. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } /// @@ -132,43 +279,49 @@ public sealed partial class MultiTermVectorsOperation /// Specific version type. /// /// - [JsonInclude, JsonPropertyName("version_type")] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } -public sealed partial class MultiTermVectorsOperationDescriptor : SerializableDescriptor> +public readonly partial struct MultiTermVectorsOperationDescriptor { - internal MultiTermVectorsOperationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation Instance { get; init; } - public MultiTermVectorsOperationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsOperationDescriptor(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation instance) { + Instance = instance; } - private object? DocValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private bool? FieldStatisticsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private bool? OffsetsValue { get; set; } - private bool? PayloadsValue { get; set; } - private bool? PositionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private bool? TermStatisticsValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsOperationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation instance) => new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor descriptor) => descriptor.Instance; /// /// /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. /// /// - public MultiTermVectorsOperationDescriptor Doc(object? doc) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Doc(object? value) + { + Instance.Doc = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// Used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - DocValue = doc; - return Self; + Instance.Fields = value; + return this; } /// @@ -177,10 +330,10 @@ public MultiTermVectorsOperationDescriptor Doc(object? doc) /// Used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. /// /// - public MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -188,10 +341,10 @@ public MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Ela /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. /// /// - public MultiTermVectorsOperationDescriptor FieldStatistics(bool? fieldStatistics = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor FieldStatistics(bool? value = true) { - FieldStatisticsValue = fieldStatistics; - return Self; + Instance.FieldStatistics = value; + return this; } /// @@ -199,28 +352,32 @@ public MultiTermVectorsOperationDescriptor FieldStatistics(bool? fiel /// Filter terms based on their tf-idf scores. /// /// - public MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? filter) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor descriptor) + /// + /// + /// Filter terms based on their tf-idf scores. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter() { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(null); + return this; } - public MultiTermVectorsOperationDescriptor Filter(Action configure) + /// + /// + /// Filter terms based on their tf-idf scores. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter(System.Action? action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(action); + return this; } /// @@ -228,10 +385,10 @@ public MultiTermVectorsOperationDescriptor Filter(Action /// - public MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -239,10 +396,10 @@ public MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elastic /// The index of the document. /// /// - public MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -250,10 +407,10 @@ public MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elas /// If true, the response includes term offsets. /// /// - public MultiTermVectorsOperationDescriptor Offsets(bool? offsets = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Offsets(bool? value = true) { - OffsetsValue = offsets; - return Self; + Instance.Offsets = value; + return this; } /// @@ -261,10 +418,10 @@ public MultiTermVectorsOperationDescriptor Offsets(bool? offsets = tr /// If true, the response includes term payloads. /// /// - public MultiTermVectorsOperationDescriptor Payloads(bool? payloads = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Payloads(bool? value = true) { - PayloadsValue = payloads; - return Self; + Instance.Payloads = value; + return this; } /// @@ -272,10 +429,10 @@ public MultiTermVectorsOperationDescriptor Payloads(bool? payloads = /// If true, the response includes term positions. /// /// - public MultiTermVectorsOperationDescriptor Positions(bool? positions = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Positions(bool? value = true) { - PositionsValue = positions; - return Self; + Instance.Positions = value; + return this; } /// @@ -283,10 +440,10 @@ public MultiTermVectorsOperationDescriptor Positions(bool? positions /// Custom value used to route operations to a specific shard. /// /// - public MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -294,10 +451,10 @@ public MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.El /// If true, the response includes term frequency and document frequency. /// /// - public MultiTermVectorsOperationDescriptor TermStatistics(bool? termStatistics = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor TermStatistics(bool? value = true) { - TermStatisticsValue = termStatistics; - return Self; + Instance.TermStatistics = value; + return this; } /// @@ -305,10 +462,10 @@ public MultiTermVectorsOperationDescriptor TermStatistics(bool? termS /// If true, returns the document version as part of a hit. /// /// - public MultiTermVectorsOperationDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } /// @@ -316,140 +473,54 @@ public MultiTermVectorsOperationDescriptor Version(long? version) /// Specific version type. /// /// - public MultiTermVectorsOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) { - VersionTypeValue = versionType; - return Self; + Instance.VersionType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation Build(System.Action>? action) { - writer.WriteStartObject(); - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - JsonSerializer.Serialize(writer, DocValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FieldStatisticsValue.HasValue) - { - writer.WritePropertyName("field_statistics"); - writer.WriteBooleanValue(FieldStatisticsValue.Value); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (OffsetsValue.HasValue) - { - writer.WritePropertyName("offsets"); - writer.WriteBooleanValue(OffsetsValue.Value); - } - - if (PayloadsValue.HasValue) - { - writer.WritePropertyName("payloads"); - writer.WriteBooleanValue(PayloadsValue.Value); - } - - if (PositionsValue.HasValue) - { - writer.WritePropertyName("positions"); - writer.WriteBooleanValue(PositionsValue.Value); - } - - if (RoutingValue is not null) + if (action is null) { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); + return new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TermStatisticsValue.HasValue) - { - writer.WritePropertyName("term_statistics"); - writer.WriteBooleanValue(TermStatisticsValue.Value); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MultiTermVectorsOperationDescriptor : SerializableDescriptor +public readonly partial struct MultiTermVectorsOperationDescriptor { - internal MultiTermVectorsOperationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation Instance { get; init; } - public MultiTermVectorsOperationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsOperationDescriptor(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation instance) { + Instance = instance; } - private object? DocValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private bool? FieldStatisticsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private bool? OffsetsValue { get; set; } - private bool? PayloadsValue { get; set; } - private bool? PositionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private bool? TermStatisticsValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsOperationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation instance) => new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor descriptor) => descriptor.Instance; /// /// /// An artificial document (a document not present in the index) for which you want to retrieve term vectors. /// /// - public MultiTermVectorsOperationDescriptor Doc(object? doc) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Doc(object? value) { - DocValue = doc; - return Self; + Instance.Doc = value; + return this; } /// @@ -458,10 +529,22 @@ public MultiTermVectorsOperationDescriptor Doc(object? doc) /// Used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. /// /// - public MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// Comma-separated list or wildcard expressions of fields to include in the statistics. + /// Used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; } /// @@ -469,10 +552,10 @@ public MultiTermVectorsOperationDescriptor Fields(Elastic.Clients.Elasticsearch. /// If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. /// /// - public MultiTermVectorsOperationDescriptor FieldStatistics(bool? fieldStatistics = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor FieldStatistics(bool? value = true) { - FieldStatisticsValue = fieldStatistics; - return Self; + Instance.FieldStatistics = value; + return this; } /// @@ -480,28 +563,32 @@ public MultiTermVectorsOperationDescriptor FieldStatistics(bool? fieldStatistics /// Filter terms based on their tf-idf scores. /// /// - public MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? filter) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public MultiTermVectorsOperationDescriptor Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor descriptor) + /// + /// + /// Filter terms based on their tf-idf scores. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter() { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(null); + return this; } - public MultiTermVectorsOperationDescriptor Filter(Action configure) + /// + /// + /// Filter terms based on their tf-idf scores. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Filter(System.Action? action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor.Build(action); + return this; } /// @@ -509,10 +596,10 @@ public MultiTermVectorsOperationDescriptor Filter(Action /// - public MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -520,10 +607,10 @@ public MultiTermVectorsOperationDescriptor Id(Elastic.Clients.Elasticsearch.Id? /// The index of the document. /// /// - public MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -531,10 +618,10 @@ public MultiTermVectorsOperationDescriptor Index(Elastic.Clients.Elasticsearch.I /// If true, the response includes term offsets. /// /// - public MultiTermVectorsOperationDescriptor Offsets(bool? offsets = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Offsets(bool? value = true) { - OffsetsValue = offsets; - return Self; + Instance.Offsets = value; + return this; } /// @@ -542,10 +629,10 @@ public MultiTermVectorsOperationDescriptor Offsets(bool? offsets = true) /// If true, the response includes term payloads. /// /// - public MultiTermVectorsOperationDescriptor Payloads(bool? payloads = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Payloads(bool? value = true) { - PayloadsValue = payloads; - return Self; + Instance.Payloads = value; + return this; } /// @@ -553,10 +640,10 @@ public MultiTermVectorsOperationDescriptor Payloads(bool? payloads = true) /// If true, the response includes term positions. /// /// - public MultiTermVectorsOperationDescriptor Positions(bool? positions = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Positions(bool? value = true) { - PositionsValue = positions; - return Self; + Instance.Positions = value; + return this; } /// @@ -564,10 +651,10 @@ public MultiTermVectorsOperationDescriptor Positions(bool? positions = true) /// Custom value used to route operations to a specific shard. /// /// - public MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -575,10 +662,10 @@ public MultiTermVectorsOperationDescriptor Routing(Elastic.Clients.Elasticsearch /// If true, the response includes term frequency and document frequency. /// /// - public MultiTermVectorsOperationDescriptor TermStatistics(bool? termStatistics = true) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor TermStatistics(bool? value = true) { - TermStatisticsValue = termStatistics; - return Self; + Instance.TermStatistics = value; + return this; } /// @@ -586,10 +673,10 @@ public MultiTermVectorsOperationDescriptor TermStatistics(bool? termStatistics = /// If true, returns the document version as part of a hit. /// /// - public MultiTermVectorsOperationDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } /// @@ -597,103 +684,22 @@ public MultiTermVectorsOperationDescriptor Version(long? version) /// Specific version type. /// /// - public MultiTermVectorsOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + public Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) { - VersionTypeValue = versionType; - return Self; + Instance.VersionType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation Build(System.Action? action) { - writer.WriteStartObject(); - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - JsonSerializer.Serialize(writer, DocValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FieldStatisticsValue.HasValue) - { - writer.WritePropertyName("field_statistics"); - writer.WriteBooleanValue(FieldStatisticsValue.Value); - } - - if (FilterDescriptor is not null) + if (action is null) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); + return new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (OffsetsValue.HasValue) - { - writer.WritePropertyName("offsets"); - writer.WriteBooleanValue(OffsetsValue.Value); - } - - if (PayloadsValue.HasValue) - { - writer.WritePropertyName("payloads"); - writer.WriteBooleanValue(PayloadsValue.Value); - } - - if (PositionsValue.HasValue) - { - writer.WritePropertyName("positions"); - writer.WriteBooleanValue(PositionsValue.Value); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (TermStatisticsValue.HasValue) - { - writer.WritePropertyName("term_statistics"); - writer.WriteBooleanValue(TermStatisticsValue.Value); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperationDescriptor(new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsOperation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsResult.g.cs index e8ec6d5f061..4ccb316b6a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Mtermvectors/MultiTermVectorsResult.g.cs @@ -17,31 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Mtermvectors; +internal sealed partial class MultiTermVectorsResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropTermVectors = System.Text.Json.JsonEncodedText.Encode("term_vectors"); + private static readonly System.Text.Json.JsonEncodedText PropTook = System.Text.Json.JsonEncodedText.Encode("took"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propFound = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propTermVectors = default; + LocalJsonValue propTook = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propTermVectors.TryReadProperty(ref reader, options, PropTermVectors, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTook.TryReadProperty(ref reader, options, PropTook, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Found = propFound.Value, + Id = propId.Value, + Index = propIndex.Value, + TermVectors = propTermVectors.Value, + Took = propTook.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropTermVectors, value.TermVectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTook, value.Took, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Mtermvectors.MultiTermVectorsResultConverter))] public sealed partial class MultiTermVectorsResult { - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("found")] - public bool? Found { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string? Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("term_vectors")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.TermVector))] - public IReadOnlyDictionary? TermVectors { get; init; } - [JsonInclude, JsonPropertyName("took")] - public long? Took { get; init; } - [JsonInclude, JsonPropertyName("_version")] - public long? Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiTermVectorsResult(string index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public MultiTermVectorsResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiTermVectorsResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiTermVectorsResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public bool? Found { get; set; } + public string? Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? TermVectors { get; set; } + public long? Took { get; set; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs index 3db3670ab7e..77563d0397f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs @@ -17,26 +17,75 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MGet; -public sealed partial class MultiGetResponseItem : Union, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError> +internal sealed partial class MultiGetResponseItemConverter : System.Text.Json.Serialization.JsonConverter> { - public MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.Get.GetResult Result) : base(Result) + public override Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByPropertyOfT1(ref r, o, "found"); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(reader.ReadValue>(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem value, System.Text.Json.JsonSerializerOptions options) { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } } +} - public MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError Failure) : base(Failure) +internal sealed partial class MultiGetResponseItemConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiGetResponseItem<>); } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiGetResponseItemConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItemConverterFactory))] +public sealed partial class MultiGetResponseItem : Elastic.Clients.Elasticsearch.Union, Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError> +{ + public MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.Get.GetResult value) : base(value) + { + } + + public MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.Get.GetResult value) => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(Elastic.Clients.Elasticsearch.Core.MGet.MultiGetError value) => new Elastic.Clients.Elasticsearch.Core.MGet.MultiGetResponseItem(value); } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs index e4d5c8f2dcb..d89cc2d6a0f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs @@ -17,26 +17,75 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.MSearch; -public sealed partial class MultiSearchResponseItem : Union, Elastic.Clients.Elasticsearch.ErrorResponseBase> +internal sealed partial class MultiSearchResponseItemConverter : System.Text.Json.Serialization.JsonConverter> { - public MultiSearchResponseItem(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem Result) : base(Result) + public override Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByPropertyOfT1(ref r, o, "took"); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(reader.ReadValue>(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem value, System.Text.Json.JsonSerializerOptions options) { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } } +} - public MultiSearchResponseItem(Elastic.Clients.Elasticsearch.ErrorResponseBase Failure) : base(Failure) +internal sealed partial class MultiSearchResponseItemConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiSearchResponseItem<>); } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(MultiSearchResponseItemConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItemConverterFactory))] +public sealed partial class MultiSearchResponseItem : Elastic.Clients.Elasticsearch.Union, Elastic.Clients.Elasticsearch.ErrorResponseBase> +{ + public MultiSearchResponseItem(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem value) : base(value) + { + } + + public MultiSearchResponseItem(Elastic.Clients.Elasticsearch.ErrorResponseBase value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchItem value) => new Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(Elastic.Clients.Elasticsearch.ErrorResponseBase value) => new Elastic.Clients.Elasticsearch.Core.MSearch.MultiSearchResponseItem(value); } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/DocumentRating.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/DocumentRating.g.cs index 02090ba79cd..b0eed3ee2a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/DocumentRating.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/DocumentRating.g.cs @@ -17,64 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class DocumentRatingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropRating = System.Text.Json.JsonEncodedText.Encode("rating"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propRating = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propRating.TryReadProperty(ref reader, options, PropRating, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Rating = propRating.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropRating, value.Rating, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingConverter))] public sealed partial class DocumentRating { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentRating(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.IndexName index, int rating) + { + Id = id; + Index = index; + Rating = rating; + } +#if NET7_0_OR_GREATER + public DocumentRating() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DocumentRating() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DocumentRating(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The document ID. /// /// - [JsonInclude, JsonPropertyName("_id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } /// /// /// The document’s index. For data streams, this should be the document’s backing index. /// /// - [JsonInclude, JsonPropertyName("_index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// /// The document’s relevance with regard to this search request. /// /// - [JsonInclude, JsonPropertyName("rating")] - public int Rating { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Rating { get; set; } } -public sealed partial class DocumentRatingDescriptor : SerializableDescriptor +public readonly partial struct DocumentRatingDescriptor { - internal DocumentRatingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentRatingDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating instance) + { + Instance = instance; + } - public DocumentRatingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentRatingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private int RatingValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor descriptor) => descriptor.Instance; /// /// /// The document ID. /// /// - public DocumentRatingDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -82,10 +176,10 @@ public DocumentRatingDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// The document’s index. For data streams, this should be the document’s backing index. /// /// - public DocumentRatingDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -93,21 +187,17 @@ public DocumentRatingDescriptor Index(Elastic.Clients.Elasticsearch.IndexName in /// The document’s relevance with regard to this search request. /// /// - public DocumentRatingDescriptor Rating(int rating) + public Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor Rating(int value) { - RatingValue = rating; - return Self; + Instance.Rating = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WritePropertyName("rating"); - writer.WriteNumberValue(RatingValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHit.g.cs index bf29a47110f..75969eace8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHit.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalHitConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("_score"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Score = propScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHitConverter))] public sealed partial class RankEvalHit { - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("_score")] - public double Score { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalHit(string id, string index, double score) + { + Id = id; + Index = index; + Score = score; + } +#if NET7_0_OR_GREATER + public RankEvalHit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalHit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalHit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Score { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHitItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHitItem.g.cs index 770894d454a..fd979b3cd90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHitItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalHitItem.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalHitItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHit = System.Text.Json.JsonEncodedText.Encode("hit"); + private static readonly System.Text.Json.JsonEncodedText PropRating = System.Text.Json.JsonEncodedText.Encode("rating"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHitItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHit = default; + LocalJsonValue propRating = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHit.TryReadProperty(ref reader, options, PropHit, null)) + { + continue; + } + + if (propRating.TryReadProperty(ref reader, options, PropRating, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHitItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hit = propHit.Value, + Rating = propRating.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHitItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHit, value.Hit, null, null); + writer.WriteProperty(options, PropRating, value.Rating, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHitItemConverter))] public sealed partial class RankEvalHitItem { - [JsonInclude, JsonPropertyName("hit")] - public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit Hit { get; init; } - [JsonInclude, JsonPropertyName("rating")] - public double? Rating { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalHitItem(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit hit) + { + Hit = hit; + } +#if NET7_0_OR_GREATER + public RankEvalHitItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalHitItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalHitItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalHit Hit { get; set; } + public double? Rating { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetric.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetric.g.cs index 2ef7de65e07..e8c4d7f64bf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetric.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetric.g.cs @@ -17,257 +17,226 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDcg = System.Text.Json.JsonEncodedText.Encode("dcg"); + private static readonly System.Text.Json.JsonEncodedText PropExpectedReciprocalRank = System.Text.Json.JsonEncodedText.Encode("expected_reciprocal_rank"); + private static readonly System.Text.Json.JsonEncodedText PropMeanReciprocalRank = System.Text.Json.JsonEncodedText.Encode("mean_reciprocal_rank"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropRecall = System.Text.Json.JsonEncodedText.Encode("recall"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDcg = default; + LocalJsonValue propExpectedReciprocalRank = default; + LocalJsonValue propMeanReciprocalRank = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propRecall = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDcg.TryReadProperty(ref reader, options, PropDcg, null)) + { + continue; + } + + if (propExpectedReciprocalRank.TryReadProperty(ref reader, options, PropExpectedReciprocalRank, null)) + { + continue; + } + + if (propMeanReciprocalRank.TryReadProperty(ref reader, options, PropMeanReciprocalRank, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propRecall.TryReadProperty(ref reader, options, PropRecall, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dcg = propDcg.Value, + ExpectedReciprocalRank = propExpectedReciprocalRank.Value, + MeanReciprocalRank = propMeanReciprocalRank.Value, + Precision = propPrecision.Value, + Recall = propRecall.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDcg, value.Dcg, null, null); + writer.WriteProperty(options, PropExpectedReciprocalRank, value.ExpectedReciprocalRank, null, null); + writer.WriteProperty(options, PropMeanReciprocalRank, value.MeanReciprocalRank, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropRecall, value.Recall, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricConverter))] public sealed partial class RankEvalMetric { - [JsonInclude, JsonPropertyName("dcg")] +#if NET7_0_OR_GREATER + public RankEvalMetric() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankEvalMetric() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? Dcg { get; set; } - [JsonInclude, JsonPropertyName("expected_reciprocal_rank")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? ExpectedReciprocalRank { get; set; } - [JsonInclude, JsonPropertyName("mean_reciprocal_rank")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? MeanReciprocalRank { get; set; } - [JsonInclude, JsonPropertyName("precision")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? Precision { get; set; } - [JsonInclude, JsonPropertyName("recall")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? Recall { get; set; } } -public sealed partial class RankEvalMetricDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricDescriptor { - internal RankEvalMetricDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric Instance { get; init; } - public RankEvalMetricDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? DcgValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor DcgDescriptor { get; set; } - private Action DcgDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? ExpectedReciprocalRankValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor ExpectedReciprocalRankDescriptor { get; set; } - private Action ExpectedReciprocalRankDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? MeanReciprocalRankValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor MeanReciprocalRankDescriptor { get; set; } - private Action MeanReciprocalRankDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? PrecisionValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor PrecisionDescriptor { get; set; } - private Action PrecisionDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? RecallValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor RecallDescriptor { get; set; } - private Action RecallDescriptorAction { get; set; } - - public RankEvalMetricDescriptor Dcg(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? dcg) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricDescriptor() { - DcgDescriptor = null; - DcgDescriptorAction = null; - DcgValue = dcg; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RankEvalMetricDescriptor Dcg(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain? value) { - DcgValue = null; - DcgDescriptorAction = null; - DcgDescriptor = descriptor; - return Self; + Instance.Dcg = value; + return this; } - public RankEvalMetricDescriptor Dcg(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg() { - DcgValue = null; - DcgDescriptor = null; - DcgDescriptorAction = configure; - return Self; + Instance.Dcg = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor.Build(null); + return this; } - public RankEvalMetricDescriptor ExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? expectedReciprocalRank) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Dcg(System.Action? action) { - ExpectedReciprocalRankDescriptor = null; - ExpectedReciprocalRankDescriptorAction = null; - ExpectedReciprocalRankValue = expectedReciprocalRank; - return Self; + Instance.Dcg = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor.Build(action); + return this; } - public RankEvalMetricDescriptor ExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor ExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank? value) { - ExpectedReciprocalRankValue = null; - ExpectedReciprocalRankDescriptorAction = null; - ExpectedReciprocalRankDescriptor = descriptor; - return Self; + Instance.ExpectedReciprocalRank = value; + return this; } - public RankEvalMetricDescriptor ExpectedReciprocalRank(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor ExpectedReciprocalRank(System.Action action) { - ExpectedReciprocalRankValue = null; - ExpectedReciprocalRankDescriptor = null; - ExpectedReciprocalRankDescriptorAction = configure; - return Self; + Instance.ExpectedReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor.Build(action); + return this; } - public RankEvalMetricDescriptor MeanReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? meanReciprocalRank) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank? value) { - MeanReciprocalRankDescriptor = null; - MeanReciprocalRankDescriptorAction = null; - MeanReciprocalRankValue = meanReciprocalRank; - return Self; + Instance.MeanReciprocalRank = value; + return this; } - public RankEvalMetricDescriptor MeanReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank() { - MeanReciprocalRankValue = null; - MeanReciprocalRankDescriptorAction = null; - MeanReciprocalRankDescriptor = descriptor; - return Self; + Instance.MeanReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor.Build(null); + return this; } - public RankEvalMetricDescriptor MeanReciprocalRank(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor MeanReciprocalRank(System.Action? action) { - MeanReciprocalRankValue = null; - MeanReciprocalRankDescriptor = null; - MeanReciprocalRankDescriptorAction = configure; - return Self; + Instance.MeanReciprocalRank = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor.Build(action); + return this; } - public RankEvalMetricDescriptor Precision(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? precision) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision? value) { - PrecisionDescriptor = null; - PrecisionDescriptorAction = null; - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } - public RankEvalMetricDescriptor Precision(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision() { - PrecisionValue = null; - PrecisionDescriptorAction = null; - PrecisionDescriptor = descriptor; - return Self; + Instance.Precision = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor.Build(null); + return this; } - public RankEvalMetricDescriptor Precision(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Precision(System.Action? action) { - PrecisionValue = null; - PrecisionDescriptor = null; - PrecisionDescriptorAction = configure; - return Self; + Instance.Precision = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor.Build(action); + return this; } - public RankEvalMetricDescriptor Recall(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? recall) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall? value) { - RecallDescriptor = null; - RecallDescriptorAction = null; - RecallValue = recall; - return Self; + Instance.Recall = value; + return this; } - public RankEvalMetricDescriptor Recall(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall() { - RecallValue = null; - RecallDescriptorAction = null; - RecallDescriptor = descriptor; - return Self; + Instance.Recall = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor.Build(null); + return this; } - public RankEvalMetricDescriptor Recall(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor Recall(System.Action? action) { - RecallValue = null; - RecallDescriptor = null; - RecallDescriptorAction = configure; - return Self; + Instance.Recall = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric Build(System.Action? action) { - writer.WriteStartObject(); - if (DcgDescriptor is not null) - { - writer.WritePropertyName("dcg"); - JsonSerializer.Serialize(writer, DcgDescriptor, options); - } - else if (DcgDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("dcg"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor(DcgDescriptorAction), options); - } - else if (DcgValue is not null) - { - writer.WritePropertyName("dcg"); - JsonSerializer.Serialize(writer, DcgValue, options); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ExpectedReciprocalRankDescriptor is not null) - { - writer.WritePropertyName("expected_reciprocal_rank"); - JsonSerializer.Serialize(writer, ExpectedReciprocalRankDescriptor, options); - } - else if (ExpectedReciprocalRankDescriptorAction is not null) - { - writer.WritePropertyName("expected_reciprocal_rank"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor(ExpectedReciprocalRankDescriptorAction), options); - } - else if (ExpectedReciprocalRankValue is not null) - { - writer.WritePropertyName("expected_reciprocal_rank"); - JsonSerializer.Serialize(writer, ExpectedReciprocalRankValue, options); - } - - if (MeanReciprocalRankDescriptor is not null) - { - writer.WritePropertyName("mean_reciprocal_rank"); - JsonSerializer.Serialize(writer, MeanReciprocalRankDescriptor, options); - } - else if (MeanReciprocalRankDescriptorAction is not null) - { - writer.WritePropertyName("mean_reciprocal_rank"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor(MeanReciprocalRankDescriptorAction), options); - } - else if (MeanReciprocalRankValue is not null) - { - writer.WritePropertyName("mean_reciprocal_rank"); - JsonSerializer.Serialize(writer, MeanReciprocalRankValue, options); - } - - if (PrecisionDescriptor is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionDescriptor, options); - } - else if (PrecisionDescriptorAction is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor(PrecisionDescriptorAction), options); - } - else if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - if (RecallDescriptor is not null) - { - writer.WritePropertyName("recall"); - JsonSerializer.Serialize(writer, RecallDescriptor, options); - } - else if (RecallDescriptorAction is not null) - { - writer.WritePropertyName("recall"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor(RecallDescriptorAction), options); - } - else if (RecallValue is not null) - { - writer.WritePropertyName("recall"); - JsonSerializer.Serialize(writer, RecallValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDetail.g.cs index 6e45be39364..83694eec3b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDetail.g.cs @@ -17,47 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMetricDetails = System.Text.Json.JsonEncodedText.Encode("metric_details"); + private static readonly System.Text.Json.JsonEncodedText PropMetricScore = System.Text.Json.JsonEncodedText.Encode("metric_score"); + private static readonly System.Text.Json.JsonEncodedText PropUnratedDocs = System.Text.Json.JsonEncodedText.Encode("unrated_docs"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHits = default; + LocalJsonValue>> propMetricDetails = default; + LocalJsonValue propMetricScore = default; + LocalJsonValue> propUnratedDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMetricDetails.TryReadProperty(ref reader, options, PropMetricDetails, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (propMetricScore.TryReadProperty(ref reader, options, PropMetricScore, null)) + { + continue; + } + + if (propUnratedDocs.TryReadProperty(ref reader, options, PropUnratedDocs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value, + MetricDetails = propMetricDetails.Value, + MetricScore = propMetricScore.Value, + UnratedDocs = propUnratedDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetricDetails, value.MetricDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropMetricScore, value.MetricScore, null, null); + writer.WriteProperty(options, PropUnratedDocs, value.UnratedDocs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDetailConverter))] public sealed partial class RankEvalMetricDetail { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricDetail(System.Collections.Generic.IReadOnlyCollection hits, System.Collections.Generic.IReadOnlyDictionary> metricDetails, double metricScore, System.Collections.Generic.IReadOnlyCollection unratedDocs) + { + Hits = hits; + MetricDetails = metricDetails; + MetricScore = metricScore; + UnratedDocs = unratedDocs; + } +#if NET7_0_OR_GREATER + public RankEvalMetricDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalMetricDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The hits section shows a grouping of the search results with their supplied ratings /// /// - [JsonInclude, JsonPropertyName("hits")] - public IReadOnlyCollection Hits { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Hits { get; set; } /// /// /// The metric_details give additional information about the calculated quality metric (e.g. how many of the retrieved documents were relevant). The content varies for each metric but allows for better interpretation of the results /// /// - [JsonInclude, JsonPropertyName("metric_details")] - public IReadOnlyDictionary> MetricDetails { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> MetricDetails { get; set; } /// /// /// The metric_score in the details section shows the contribution of this query to the global quality metric score /// /// - [JsonInclude, JsonPropertyName("metric_score")] - public double MetricScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double MetricScore { get; set; } /// /// /// The unrated_docs section contains an _index and _id entry for each document in the search result for this query that didn’t have a ratings value. This can be used to ask the user to supply ratings for these documents /// /// - [JsonInclude, JsonPropertyName("unrated_docs")] - public IReadOnlyCollection UnratedDocs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection UnratedDocs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDiscountedCumulativeGain.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDiscountedCumulativeGain.g.cs index 8de32585af1..35fb77c662e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDiscountedCumulativeGain.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricDiscountedCumulativeGain.g.cs @@ -17,38 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricDiscountedCumulativeGainConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropNormalize = System.Text.Json.JsonEncodedText.Encode("normalize"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propK = default; + LocalJsonValue propNormalize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propNormalize.TryReadProperty(ref reader, options, PropNormalize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + K = propK.Value, + Normalize = propNormalize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropNormalize, value.Normalize, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Discounted cumulative gain (DCG) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainConverter))] public sealed partial class RankEvalMetricDiscountedCumulativeGain { +#if NET7_0_OR_GREATER + public RankEvalMetricDiscountedCumulativeGain() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankEvalMetricDiscountedCumulativeGain() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// If set to true, this metric will calculate the Normalized DCG. /// /// - [JsonInclude, JsonPropertyName("normalize")] public bool? Normalize { get; set; } } @@ -56,28 +115,36 @@ public sealed partial class RankEvalMetricDiscountedCumulativeGain /// /// Discounted cumulative gain (DCG) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class RankEvalMetricDiscountedCumulativeGainDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricDiscountedCumulativeGainDescriptor { - internal RankEvalMetricDiscountedCumulativeGainDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain Instance { get; init; } - public RankEvalMetricDiscountedCumulativeGainDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricDiscountedCumulativeGainDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain instance) { + Instance = instance; } - private int? kValue { get; set; } - private bool? NormalizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricDiscountedCumulativeGainDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor descriptor) => descriptor.Instance; /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - public RankEvalMetricDiscountedCumulativeGainDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -85,27 +152,22 @@ public RankEvalMetricDiscountedCumulativeGainDescriptor k(int? k) /// If set to true, this metric will calculate the Normalized DCG. /// /// - public RankEvalMetricDiscountedCumulativeGainDescriptor Normalize(bool? normalize = true) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor Normalize(bool? value = true) { - NormalizeValue = normalize; - return Self; + Instance.Normalize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain Build(System.Action? action) { - writer.WriteStartObject(); - if (kValue.HasValue) + if (action is null) { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (NormalizeValue.HasValue) - { - writer.WritePropertyName("normalize"); - writer.WriteBooleanValue(NormalizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGainDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricDiscountedCumulativeGain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricExpectedReciprocalRank.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricExpectedReciprocalRank.g.cs index 18c31ca04f5..a2a21860c1d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricExpectedReciprocalRank.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricExpectedReciprocalRank.g.cs @@ -17,67 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricExpectedReciprocalRankConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropMaximumRelevance = System.Text.Json.JsonEncodedText.Encode("maximum_relevance"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propK = default; + LocalJsonValue propMaximumRelevance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propMaximumRelevance.TryReadProperty(ref reader, options, PropMaximumRelevance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + K = propK.Value, + MaximumRelevance = propMaximumRelevance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropMaximumRelevance, value.MaximumRelevance, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Expected Reciprocal Rank (ERR) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankConverter))] public sealed partial class RankEvalMetricExpectedReciprocalRank { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricExpectedReciprocalRank(int maximumRelevance) + { + MaximumRelevance = maximumRelevance; + } +#if NET7_0_OR_GREATER + public RankEvalMetricExpectedReciprocalRank() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalMetricExpectedReciprocalRank() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// The highest relevance grade used in the user-supplied relevance judgments. /// /// - [JsonInclude, JsonPropertyName("maximum_relevance")] - public int MaximumRelevance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaximumRelevance { get; set; } } /// /// /// Expected Reciprocal Rank (ERR) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class RankEvalMetricExpectedReciprocalRankDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricExpectedReciprocalRankDescriptor { - internal RankEvalMetricExpectedReciprocalRankDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank Instance { get; init; } - public RankEvalMetricExpectedReciprocalRankDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricExpectedReciprocalRankDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank instance) { + Instance = instance; } - private int? kValue { get; set; } - private int MaximumRelevanceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricExpectedReciprocalRankDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor descriptor) => descriptor.Instance; /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - public RankEvalMetricExpectedReciprocalRankDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -85,23 +162,17 @@ public RankEvalMetricExpectedReciprocalRankDescriptor k(int? k) /// The highest relevance grade used in the user-supplied relevance judgments. /// /// - public RankEvalMetricExpectedReciprocalRankDescriptor MaximumRelevance(int maximumRelevance) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor MaximumRelevance(int value) { - MaximumRelevanceValue = maximumRelevance; - return Self; + Instance.MaximumRelevance = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank Build(System.Action action) { - writer.WriteStartObject(); - if (kValue.HasValue) - { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); - } - - writer.WritePropertyName("maximum_relevance"); - writer.WriteNumberValue(MaximumRelevanceValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRankDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricExpectedReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricMeanReciprocalRank.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricMeanReciprocalRank.g.cs index a5db8520c2f..2fcbdf2eca9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricMeanReciprocalRank.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricMeanReciprocalRank.g.cs @@ -17,38 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricMeanReciprocalRankConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropRelevantRatingThreshold = System.Text.Json.JsonEncodedText.Encode("relevant_rating_threshold"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propK = default; + LocalJsonValue propRelevantRatingThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propRelevantRatingThreshold.TryReadProperty(ref reader, options, PropRelevantRatingThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + K = propK.Value, + RelevantRatingThreshold = propRelevantRatingThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropRelevantRatingThreshold, value.RelevantRatingThreshold, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Mean Reciprocal Rank /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankConverter))] public sealed partial class RankEvalMetricMeanReciprocalRank { +#if NET7_0_OR_GREATER + public RankEvalMetricMeanReciprocalRank() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankEvalMetricMeanReciprocalRank() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - [JsonInclude, JsonPropertyName("relevant_rating_threshold")] public int? RelevantRatingThreshold { get; set; } } @@ -56,28 +115,36 @@ public sealed partial class RankEvalMetricMeanReciprocalRank /// /// Mean Reciprocal Rank /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class RankEvalMetricMeanReciprocalRankDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricMeanReciprocalRankDescriptor { - internal RankEvalMetricMeanReciprocalRankDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank Instance { get; init; } - public RankEvalMetricMeanReciprocalRankDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricMeanReciprocalRankDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank instance) { + Instance = instance; } - private int? kValue { get; set; } - private int? RelevantRatingThresholdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricMeanReciprocalRankDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor descriptor) => descriptor.Instance; /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - public RankEvalMetricMeanReciprocalRankDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -85,27 +152,22 @@ public RankEvalMetricMeanReciprocalRankDescriptor k(int? k) /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - public RankEvalMetricMeanReciprocalRankDescriptor RelevantRatingThreshold(int? relevantRatingThreshold) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor RelevantRatingThreshold(int? value) { - RelevantRatingThresholdValue = relevantRatingThreshold; - return Self; + Instance.RelevantRatingThreshold = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank Build(System.Action? action) { - writer.WriteStartObject(); - if (kValue.HasValue) + if (action is null) { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RelevantRatingThresholdValue.HasValue) - { - writer.WritePropertyName("relevant_rating_threshold"); - writer.WriteNumberValue(RelevantRatingThresholdValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRankDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricMeanReciprocalRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricPrecision.g.cs index ddf8cc6549e..c6ad704e596 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricPrecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricPrecision.g.cs @@ -17,30 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricPrecisionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnlabeled = System.Text.Json.JsonEncodedText.Encode("ignore_unlabeled"); + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropRelevantRatingThreshold = System.Text.Json.JsonEncodedText.Encode("relevant_rating_threshold"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIgnoreUnlabeled = default; + LocalJsonValue propK = default; + LocalJsonValue propRelevantRatingThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreUnlabeled.TryReadProperty(ref reader, options, PropIgnoreUnlabeled, null)) + { + continue; + } + + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propRelevantRatingThreshold.TryReadProperty(ref reader, options, PropRelevantRatingThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreUnlabeled = propIgnoreUnlabeled.Value, + K = propK.Value, + RelevantRatingThreshold = propRelevantRatingThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreUnlabeled, value.IgnoreUnlabeled, null, null); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropRelevantRatingThreshold, value.RelevantRatingThreshold, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Precision at K (P@k) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionConverter))] public sealed partial class RankEvalMetricPrecision { +#if NET7_0_OR_GREATER + public RankEvalMetricPrecision() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankEvalMetricPrecision() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Controls how unlabeled documents in the search results are counted. If set to true, unlabeled documents are ignored and neither count as relevant or irrelevant. Set to false (the default), they are treated as irrelevant. /// /// - [JsonInclude, JsonPropertyName("ignore_unlabeled")] public bool? IgnoreUnlabeled { get; set; } /// @@ -48,15 +117,13 @@ public sealed partial class RankEvalMetricPrecision /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - [JsonInclude, JsonPropertyName("relevant_rating_threshold")] public int? RelevantRatingThreshold { get; set; } } @@ -64,29 +131,36 @@ public sealed partial class RankEvalMetricPrecision /// /// Precision at K (P@k) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class RankEvalMetricPrecisionDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricPrecisionDescriptor { - internal RankEvalMetricPrecisionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricPrecisionDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision instance) + { + Instance = instance; + } - public RankEvalMetricPrecisionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricPrecisionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? IgnoreUnlabeledValue { get; set; } - private int? kValue { get; set; } - private int? RelevantRatingThresholdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor descriptor) => descriptor.Instance; /// /// /// Controls how unlabeled documents in the search results are counted. If set to true, unlabeled documents are ignored and neither count as relevant or irrelevant. Set to false (the default), they are treated as irrelevant. /// /// - public RankEvalMetricPrecisionDescriptor IgnoreUnlabeled(bool? ignoreUnlabeled = true) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor IgnoreUnlabeled(bool? value = true) { - IgnoreUnlabeledValue = ignoreUnlabeled; - return Self; + Instance.IgnoreUnlabeled = value; + return this; } /// @@ -94,10 +168,10 @@ public RankEvalMetricPrecisionDescriptor IgnoreUnlabeled(bool? ignoreUnlabeled = /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - public RankEvalMetricPrecisionDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -105,33 +179,22 @@ public RankEvalMetricPrecisionDescriptor k(int? k) /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - public RankEvalMetricPrecisionDescriptor RelevantRatingThreshold(int? relevantRatingThreshold) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor RelevantRatingThreshold(int? value) { - RelevantRatingThresholdValue = relevantRatingThreshold; - return Self; + Instance.RelevantRatingThreshold = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision Build(System.Action? action) { - writer.WriteStartObject(); - if (IgnoreUnlabeledValue.HasValue) - { - writer.WritePropertyName("ignore_unlabeled"); - writer.WriteBooleanValue(IgnoreUnlabeledValue.Value); - } - - if (kValue.HasValue) + if (action is null) { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RelevantRatingThresholdValue.HasValue) - { - writer.WritePropertyName("relevant_rating_threshold"); - writer.WriteNumberValue(RelevantRatingThresholdValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecisionDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricRecall.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricRecall.g.cs index 36a07ea83d2..45b55f2ba7a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricRecall.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalMetricRecall.g.cs @@ -17,38 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalMetricRecallConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropRelevantRatingThreshold = System.Text.Json.JsonEncodedText.Encode("relevant_rating_threshold"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propK = default; + LocalJsonValue propRelevantRatingThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propRelevantRatingThreshold.TryReadProperty(ref reader, options, PropRelevantRatingThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + K = propK.Value, + RelevantRatingThreshold = propRelevantRatingThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropRelevantRatingThreshold, value.RelevantRatingThreshold, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Recall at K (R@k) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallConverter))] public sealed partial class RankEvalMetricRecall { +#if NET7_0_OR_GREATER + public RankEvalMetricRecall() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankEvalMetricRecall() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - [JsonInclude, JsonPropertyName("relevant_rating_threshold")] public int? RelevantRatingThreshold { get; set; } } @@ -56,28 +115,36 @@ public sealed partial class RankEvalMetricRecall /// /// Recall at K (R@k) /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class RankEvalMetricRecallDescriptor : SerializableDescriptor +public readonly partial struct RankEvalMetricRecallDescriptor { - internal RankEvalMetricRecallDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall Instance { get; init; } - public RankEvalMetricRecallDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricRecallDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall instance) { + Instance = instance; } - private int? kValue { get; set; } - private int? RelevantRatingThresholdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalMetricRecallDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor descriptor) => descriptor.Instance; /// /// /// Sets the maximum number of documents retrieved per query. This value will act in place of the usual size parameter in the query. /// /// - public RankEvalMetricRecallDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -85,27 +152,22 @@ public RankEvalMetricRecallDescriptor k(int? k) /// Sets the rating threshold above which documents are considered to be "relevant". /// /// - public RankEvalMetricRecallDescriptor RelevantRatingThreshold(int? relevantRatingThreshold) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor RelevantRatingThreshold(int? value) { - RelevantRatingThresholdValue = relevantRatingThreshold; - return Self; + Instance.RelevantRatingThreshold = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall Build(System.Action? action) { - writer.WriteStartObject(); - if (kValue.HasValue) + if (action is null) { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RelevantRatingThresholdValue.HasValue) - { - writer.WritePropertyName("relevant_rating_threshold"); - writer.WriteNumberValue(RelevantRatingThresholdValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecallDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalMetricRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalQuery.g.cs index 687bd0ffd08..39be9a9d039 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalQuery.g.cs @@ -17,164 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var readerSnapshot = reader; + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + try + { + reader = readerSnapshot; + var result = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = result + }; + } + catch (System.Text.Json.JsonException) + { + throw; + } + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryConverter))] public sealed partial class RankEvalQuery { - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } - [JsonInclude, JsonPropertyName("size")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public RankEvalQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } public int? Size { get; set; } } -public sealed partial class RankEvalQueryDescriptor : SerializableDescriptor> +public readonly partial struct RankEvalQueryDescriptor { - internal RankEvalQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery Instance { get; init; } - public RankEvalQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalQueryDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private int? SizeValue { get; set; } - - public RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalQueryDescriptor() { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public RankEvalQueryDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RankEvalQueryDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RankEvalQueryDescriptor : SerializableDescriptor +public readonly partial struct RankEvalQueryDescriptor { - internal RankEvalQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery Instance { get; init; } - public RankEvalQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalQueryDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private int? SizeValue { get; set; } - - public RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalQueryDescriptor() { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public RankEvalQueryDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RankEvalQueryDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Query(System.Action> action) { - SizeValue = size; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor Size(int? value) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + Instance.Size = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalRequestItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalRequestItem.g.cs index d84d81c7bdc..0079f108f0e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalRequestItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/RankEvalRequestItem.g.cs @@ -17,48 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class RankEvalRequestItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropRatings = System.Text.Json.JsonEncodedText.Encode("ratings"); + private static readonly System.Text.Json.JsonEncodedText PropRequest = System.Text.Json.JsonEncodedText.Encode("request"); + private static readonly System.Text.Json.JsonEncodedText PropTemplateId = System.Text.Json.JsonEncodedText.Encode("template_id"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue?> propParams = default; + LocalJsonValue> propRatings = default; + LocalJsonValue propRequest = default; + LocalJsonValue propTemplateId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRatings.TryReadProperty(ref reader, options, PropRatings, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRequest.TryReadProperty(ref reader, options, PropRequest, null)) + { + continue; + } + + if (propTemplateId.TryReadProperty(ref reader, options, PropTemplateId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Params = propParams.Value, + Ratings = propRatings.Value, + Request = propRequest.Value, + TemplateId = propTemplateId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRatings, value.Ratings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRequest, value.Request, null, null); + writer.WriteProperty(options, PropTemplateId, value.TemplateId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemConverter))] public sealed partial class RankEvalRequestItem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestItem(Elastic.Clients.Elasticsearch.Id id, System.Collections.Generic.ICollection ratings) + { + Id = id; + Ratings = ratings; + } +#if NET7_0_OR_GREATER + public RankEvalRequestItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankEvalRequestItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The search request’s ID, used to group result details later. /// /// - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } /// /// /// The search template parameters. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// List of document ratings /// /// - [JsonInclude, JsonPropertyName("ratings")] - public ICollection Ratings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Ratings { get; set; } /// /// /// The query being evaluated. /// /// - [JsonInclude, JsonPropertyName("request")] public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? Request { get; set; } /// @@ -66,38 +165,37 @@ public sealed partial class RankEvalRequestItem /// The search template Id /// /// - [JsonInclude, JsonPropertyName("template_id")] public Elastic.Clients.Elasticsearch.Id? TemplateId { get; set; } } -public sealed partial class RankEvalRequestItemDescriptor : SerializableDescriptor> +public readonly partial struct RankEvalRequestItemDescriptor { - internal RankEvalRequestItemDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestItemDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem instance) + { + Instance = instance; + } - public RankEvalRequestItemDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestItemDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private ICollection RatingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor RatingsDescriptor { get; set; } - private Action RatingsDescriptorAction { get; set; } - private Action[] RatingsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? RequestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor RequestDescriptor { get; set; } - private Action> RequestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? TemplateIdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor descriptor) => descriptor.Instance; /// /// /// The search request’s ID, used to group result details later. /// /// - public RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -105,189 +203,150 @@ public RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch /// The search template parameters. /// /// - public RankEvalRequestItemDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// List of document ratings + /// The search template parameters. /// /// - public RankEvalRequestItemDescriptor Ratings(ICollection ratings) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params() { - RatingsDescriptor = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = null; - RatingsValue = ratings; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public RankEvalRequestItemDescriptor Ratings(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor descriptor) + /// + /// + /// The search template parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params(System.Action? action) { - RatingsValue = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = null; - RatingsDescriptor = descriptor; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public RankEvalRequestItemDescriptor Ratings(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor AddParam(string key, object value) { - RatingsValue = null; - RatingsDescriptor = null; - RatingsDescriptorActions = null; - RatingsDescriptorAction = configure; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public RankEvalRequestItemDescriptor Ratings(params Action[] configure) + /// + /// + /// List of document ratings + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(System.Collections.Generic.ICollection value) { - RatingsValue = null; - RatingsDescriptor = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = configure; - return Self; + Instance.Ratings = value; + return this; } /// /// - /// The query being evaluated. + /// List of document ratings /// /// - public RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? request) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(params Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating[] values) { - RequestDescriptor = null; - RequestDescriptorAction = null; - RequestValue = request; - return Self; + Instance.Ratings = [.. values]; + return this; } - public RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor descriptor) + /// + /// + /// List of document ratings + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(params System.Action[] actions) { - RequestValue = null; - RequestDescriptorAction = null; - RequestDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor.Build(action)); + } + + Instance.Ratings = items; + return this; } - public RankEvalRequestItemDescriptor Request(Action> configure) + /// + /// + /// The query being evaluated. + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? value) { - RequestValue = null; - RequestDescriptor = null; - RequestDescriptorAction = configure; - return Self; + Instance.Request = value; + return this; } /// /// - /// The search template Id + /// The query being evaluated. /// /// - public RankEvalRequestItemDescriptor TemplateId(Elastic.Clients.Elasticsearch.Id? templateId) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Request(System.Action> action) { - TemplateIdValue = templateId; - return Self; + Instance.Request = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The search template Id + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor TemplateId(Elastic.Clients.Elasticsearch.Id? value) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (RatingsDescriptor is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RatingsDescriptor, options); - writer.WriteEndArray(); - } - else if (RatingsDescriptorAction is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(RatingsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RatingsDescriptorActions is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - foreach (var action in RatingsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("ratings"); - JsonSerializer.Serialize(writer, RatingsValue, options); - } - - if (RequestDescriptor is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, RequestDescriptor, options); - } - else if (RequestDescriptorAction is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(RequestDescriptorAction), options); - } - else if (RequestValue is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, RequestValue, options); - } - - if (TemplateIdValue is not null) - { - writer.WritePropertyName("template_id"); - JsonSerializer.Serialize(writer, TemplateIdValue, options); - } + Instance.TemplateId = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RankEvalRequestItemDescriptor : SerializableDescriptor +public readonly partial struct RankEvalRequestItemDescriptor { - internal RankEvalRequestItemDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem Instance { get; init; } - public RankEvalRequestItemDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestItemDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private ICollection RatingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor RatingsDescriptor { get; set; } - private Action RatingsDescriptorAction { get; set; } - private Action[] RatingsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? RequestValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor RequestDescriptor { get; set; } - private Action RequestDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? TemplateIdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankEvalRequestItemDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem instance) => new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor descriptor) => descriptor.Instance; /// /// /// The search request’s ID, used to group result details later. /// /// - public RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -295,157 +354,129 @@ public RankEvalRequestItemDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// The search template parameters. /// /// - public RankEvalRequestItemDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// List of document ratings + /// The search template parameters. /// /// - public RankEvalRequestItemDescriptor Ratings(ICollection ratings) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params() { - RatingsDescriptor = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = null; - RatingsValue = ratings; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public RankEvalRequestItemDescriptor Ratings(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor descriptor) + /// + /// + /// The search template parameters. + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Params(System.Action? action) { - RatingsValue = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = null; - RatingsDescriptor = descriptor; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public RankEvalRequestItemDescriptor Ratings(Action configure) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor AddParam(string key, object value) { - RatingsValue = null; - RatingsDescriptor = null; - RatingsDescriptorActions = null; - RatingsDescriptorAction = configure; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public RankEvalRequestItemDescriptor Ratings(params Action[] configure) + /// + /// + /// List of document ratings + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(System.Collections.Generic.ICollection value) { - RatingsValue = null; - RatingsDescriptor = null; - RatingsDescriptorAction = null; - RatingsDescriptorActions = configure; - return Self; + Instance.Ratings = value; + return this; } /// /// - /// The query being evaluated. + /// List of document ratings /// /// - public RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? request) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(params Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRating[] values) { - RequestDescriptor = null; - RequestDescriptorAction = null; - RequestValue = request; - return Self; + Instance.Ratings = [.. values]; + return this; } - public RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor descriptor) + /// + /// + /// List of document ratings + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Ratings(params System.Action[] actions) { - RequestValue = null; - RequestDescriptorAction = null; - RequestDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor.Build(action)); + } + + Instance.Ratings = items; + return this; } - public RankEvalRequestItemDescriptor Request(Action configure) + /// + /// + /// The query being evaluated. + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Request(Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQuery? value) { - RequestValue = null; - RequestDescriptor = null; - RequestDescriptorAction = configure; - return Self; + Instance.Request = value; + return this; } /// /// - /// The search template Id + /// The query being evaluated. /// /// - public RankEvalRequestItemDescriptor TemplateId(Elastic.Clients.Elasticsearch.Id? templateId) + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Request(System.Action action) { - TemplateIdValue = templateId; - return Self; + Instance.Request = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The query being evaluated. + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor Request(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (RatingsDescriptor is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RatingsDescriptor, options); - writer.WriteEndArray(); - } - else if (RatingsDescriptorAction is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(RatingsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RatingsDescriptorActions is not null) - { - writer.WritePropertyName("ratings"); - writer.WriteStartArray(); - foreach (var action in RatingsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.DocumentRatingDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("ratings"); - JsonSerializer.Serialize(writer, RatingsValue, options); - } - - if (RequestDescriptor is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, RequestDescriptor, options); - } - else if (RequestDescriptorAction is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor(RequestDescriptorAction), options); - } - else if (RequestValue is not null) - { - writer.WritePropertyName("request"); - JsonSerializer.Serialize(writer, RequestValue, options); - } + Instance.Request = Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalQueryDescriptor.Build(action); + return this; + } - if (TemplateIdValue is not null) - { - writer.WritePropertyName("template_id"); - JsonSerializer.Serialize(writer, TemplateIdValue, options); - } + /// + /// + /// The search template Id + /// + /// + public Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor TemplateId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.TemplateId = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItemDescriptor(new Elastic.Clients.Elasticsearch.Core.RankEval.RankEvalRequestItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/UnratedDocument.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/UnratedDocument.g.cs index 5c11435cf83..ac338edd823 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/UnratedDocument.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/RankEval/UnratedDocument.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.RankEval; +internal sealed partial class UnratedDocumentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + + public override Elastic.Clients.Elasticsearch.Core.RankEval.UnratedDocument Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.RankEval.UnratedDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.RankEval.UnratedDocument value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.RankEval.UnratedDocumentConverter))] public sealed partial class UnratedDocument { - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnratedDocument(string id, string index) + { + Id = id; + Index = index; + } +#if NET7_0_OR_GREATER + public UnratedDocument() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UnratedDocument() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnratedDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Destination.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Destination.g.cs index 06c0ba69fef..69c0c3cc392 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Destination.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Destination.g.cs @@ -17,25 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Reindex; +internal sealed partial class DestinationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropOpType = System.Text.Json.JsonEncodedText.Encode("op_type"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.Core.Reindex.Destination Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propOpType = default; + LocalJsonValue propPipeline = default; + LocalJsonValue propRouting = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propOpType.TryReadProperty(ref reader, options, PropOpType, null)) + { + continue; + } + + if (propPipeline.TryReadProperty(ref reader, options, PropPipeline, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Reindex.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + OpType = propOpType.Value, + Pipeline = propPipeline.Value, + Routing = propRouting.Value, + VersionType = propVersionType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Reindex.Destination value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropOpType, value.OpType, null, null); + writer.WriteProperty(options, PropPipeline, value.Pipeline, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Reindex.DestinationConverter))] public sealed partial class Destination { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Destination(Elastic.Clients.Elasticsearch.IndexName index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public Destination() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Destination() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the data stream, index, or index alias you are copying to. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// @@ -45,7 +142,6 @@ public sealed partial class Destination /// IMPORTANT: To reindex to a data stream destination, this argument must be create. /// /// - [JsonInclude, JsonPropertyName("op_type")] public Elastic.Clients.Elasticsearch.OpType? OpType { get; set; } /// @@ -53,7 +149,6 @@ public sealed partial class Destination /// The name of the pipeline to use. /// /// - [JsonInclude, JsonPropertyName("pipeline")] public string? Pipeline { get; set; } /// @@ -64,7 +159,6 @@ public sealed partial class Destination /// If it is =value, the routing on the bulk request sent for each match is set to all value specified after the equals sign (=). /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -72,33 +166,37 @@ public sealed partial class Destination /// The versioning to use for the indexing operation. /// /// - [JsonInclude, JsonPropertyName("version_type")] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } -public sealed partial class DestinationDescriptor : SerializableDescriptor +public readonly partial struct DestinationDescriptor { - internal DestinationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Reindex.Destination Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DestinationDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Destination instance) + { + Instance = instance; + } - public DestinationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DestinationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Reindex.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.OpType? OpTypeValue { get; set; } - private string? PipelineValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Destination instance) => new Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Reindex.Destination(Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor descriptor) => descriptor.Instance; /// /// /// The name of the data stream, index, or index alias you are copying to. /// /// - public DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -109,10 +207,10 @@ public DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index /// IMPORTANT: To reindex to a data stream destination, this argument must be create. /// /// - public DestinationDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? opType) + public Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? value) { - OpTypeValue = opType; - return Self; + Instance.OpType = value; + return this; } /// @@ -120,10 +218,10 @@ public DestinationDescriptor OpType(Elastic.Clients.Elasticsearch.OpType? opType /// The name of the pipeline to use. /// /// - public DestinationDescriptor Pipeline(string? pipeline) + public Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor Pipeline(string? value) { - PipelineValue = pipeline; - return Self; + Instance.Pipeline = value; + return this; } /// @@ -134,10 +232,10 @@ public DestinationDescriptor Pipeline(string? pipeline) /// If it is =value, the routing on the bulk request sent for each match is set to all value specified after the equals sign (=). /// /// - public DestinationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -145,41 +243,17 @@ public DestinationDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? rout /// The versioning to use for the indexing operation. /// /// - public DestinationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + public Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) { - VersionTypeValue = versionType; - return Self; + Instance.VersionType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Reindex.Destination Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (OpTypeValue is not null) - { - writer.WritePropertyName("op_type"); - JsonSerializer.Serialize(writer, OpTypeValue, options); - } - - if (!string.IsNullOrEmpty(PipelineValue)) - { - writer.WritePropertyName("pipeline"); - writer.WriteStringValue(PipelineValue); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Reindex.DestinationDescriptor(new Elastic.Clients.Elasticsearch.Core.Reindex.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/RemoteSource.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/RemoteSource.g.cs index 33d553f98b2..892b356b8fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/RemoteSource.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/RemoteSource.g.cs @@ -17,24 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Reindex; +internal sealed partial class RemoteSourceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConnectTimeout = System.Text.Json.JsonEncodedText.Encode("connect_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText PropSocketTimeout = System.Text.Json.JsonEncodedText.Encode("socket_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConnectTimeout = default; + LocalJsonValue?> propHeaders = default; + LocalJsonValue propHost = default; + LocalJsonValue propPassword = default; + LocalJsonValue propSocketTimeout = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnectTimeout.TryReadProperty(ref reader, options, PropConnectTimeout, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propPassword.TryReadProperty(ref reader, options, PropPassword, null)) + { + continue; + } + + if (propSocketTimeout.TryReadProperty(ref reader, options, PropSocketTimeout, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ConnectTimeout = propConnectTimeout.Value, + Headers = propHeaders.Value, + Host = propHost.Value, + Password = propPassword.Value, + SocketTimeout = propSocketTimeout.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnectTimeout, value.ConnectTimeout, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropPassword, value.Password, null, null); + writer.WriteProperty(options, PropSocketTimeout, value.SocketTimeout, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceConverter))] public sealed partial class RemoteSource { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteSource(string host) + { + Host = host; + } +#if NET7_0_OR_GREATER + public RemoteSource() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RemoteSource() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoteSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The remote connection timeout. /// /// - [JsonInclude, JsonPropertyName("connect_timeout")] public Elastic.Clients.Elasticsearch.Duration? ConnectTimeout { get; set; } /// @@ -42,8 +144,7 @@ public sealed partial class RemoteSource /// An object containing the headers of the request. /// /// - [JsonInclude, JsonPropertyName("headers")] - public IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } /// /// @@ -51,15 +152,17 @@ public sealed partial class RemoteSource /// This information is required when you're indexing from remote. /// /// - [JsonInclude, JsonPropertyName("host")] - public string Host { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Host { get; set; } /// /// /// The password to use for authentication with the remote host. /// /// - [JsonInclude, JsonPropertyName("password")] public string? Password { get; set; } /// @@ -67,7 +170,6 @@ public sealed partial class RemoteSource /// The remote socket read timeout. /// /// - [JsonInclude, JsonPropertyName("socket_timeout")] public Elastic.Clients.Elasticsearch.Duration? SocketTimeout { get; set; } /// @@ -75,34 +177,37 @@ public sealed partial class RemoteSource /// The username to use for authentication with the remote host. /// /// - [JsonInclude, JsonPropertyName("username")] public Elastic.Clients.Elasticsearch.Username? Username { get; set; } } -public sealed partial class RemoteSourceDescriptor : SerializableDescriptor +public readonly partial struct RemoteSourceDescriptor { - internal RemoteSourceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteSourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource instance) + { + Instance = instance; + } - public RemoteSourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteSourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration? ConnectTimeoutValue { get; set; } - private IDictionary? HeadersValue { get; set; } - private string HostValue { get; set; } - private string? PasswordValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? SocketTimeoutValue { get; set; } - private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource instance) => new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor descriptor) => descriptor.Instance; /// /// /// The remote connection timeout. /// /// - public RemoteSourceDescriptor ConnectTimeout(Elastic.Clients.Elasticsearch.Duration? connectTimeout) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor ConnectTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - ConnectTimeoutValue = connectTimeout; - return Self; + Instance.ConnectTimeout = value; + return this; } /// @@ -110,10 +215,39 @@ public RemoteSourceDescriptor ConnectTimeout(Elastic.Clients.Elasticsearch.Durat /// An object containing the headers of the request. /// /// - public RemoteSourceDescriptor Headers(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Headers(System.Collections.Generic.IDictionary? value) { - HeadersValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Headers = value; + return this; + } + + /// + /// + /// An object containing the headers of the request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Headers() + { + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// An object containing the headers of the request. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Headers(System.Action? action) + { + Instance.Headers = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor AddHeader(string key, string value) + { + Instance.Headers ??= new System.Collections.Generic.Dictionary(); + Instance.Headers.Add(key, value); + return this; } /// @@ -122,10 +256,10 @@ public RemoteSourceDescriptor Headers(Func, Flu /// This information is required when you're indexing from remote. /// /// - public RemoteSourceDescriptor Host(string host) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Host(string value) { - HostValue = host; - return Self; + Instance.Host = value; + return this; } /// @@ -133,10 +267,10 @@ public RemoteSourceDescriptor Host(string host) /// The password to use for authentication with the remote host. /// /// - public RemoteSourceDescriptor Password(string? password) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Password(string? value) { - PasswordValue = password; - return Self; + Instance.Password = value; + return this; } /// @@ -144,10 +278,10 @@ public RemoteSourceDescriptor Password(string? password) /// The remote socket read timeout. /// /// - public RemoteSourceDescriptor SocketTimeout(Elastic.Clients.Elasticsearch.Duration? socketTimeout) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor SocketTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - SocketTimeoutValue = socketTimeout; - return Self; + Instance.SocketTimeout = value; + return this; } /// @@ -155,47 +289,17 @@ public RemoteSourceDescriptor SocketTimeout(Elastic.Clients.Elasticsearch.Durati /// The username to use for authentication with the remote host. /// /// - public RemoteSourceDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor Username(Elastic.Clients.Elasticsearch.Username? value) { - UsernameValue = username; - return Self; + Instance.Username = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource Build(System.Action action) { - writer.WriteStartObject(); - if (ConnectTimeoutValue is not null) - { - writer.WritePropertyName("connect_timeout"); - JsonSerializer.Serialize(writer, ConnectTimeoutValue, options); - } - - if (HeadersValue is not null) - { - writer.WritePropertyName("headers"); - JsonSerializer.Serialize(writer, HeadersValue, options); - } - - writer.WritePropertyName("host"); - writer.WriteStringValue(HostValue); - if (!string.IsNullOrEmpty(PasswordValue)) - { - writer.WritePropertyName("password"); - writer.WriteStringValue(PasswordValue); - } - - if (SocketTimeoutValue is not null) - { - writer.WritePropertyName("socket_timeout"); - JsonSerializer.Serialize(writer, SocketTimeoutValue, options); - } - - if (UsernameValue is not null) - { - writer.WritePropertyName("username"); - JsonSerializer.Serialize(writer, UsernameValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor(new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Source.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Source.g.cs index a00ef4dace2..383e742de8a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Source.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Reindex/Source.g.cs @@ -17,33 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Reindex; +internal sealed partial class SourceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRemote = System.Text.Json.JsonEncodedText.Encode("remote"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSlice = System.Text.Json.JsonEncodedText.Encode("slice"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSourceFields = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.Core.Reindex.Source Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndices = default; + LocalJsonValue propQuery = default; + LocalJsonValue propRemote = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue propSize = default; + LocalJsonValue propSlice = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSourceFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propRemote.TryReadProperty(ref reader, options, PropRemote, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSlice.TryReadProperty(ref reader, options, PropSlice, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propSourceFields.TryReadProperty(ref reader, options, PropSourceFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Query = propQuery.Value, + Remote = propRemote.Value, + RuntimeMappings = propRuntimeMappings.Value, + Size = propSize.Value, + Slice = propSlice.Value, +#pragma warning disable CS0618 + Sort = propSort.Value +#pragma warning restore CS0618 +, + SourceFields = propSourceFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Reindex.Source value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRemote, value.Remote, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSlice, value.Slice, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropSourceFields, value.SourceFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Reindex.SourceConverter))] public sealed partial class Source { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Source(Elastic.Clients.Elasticsearch.Indices indices) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public Source() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Source() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the data stream, index, or alias you are copying from. /// It accepts a comma-separated list to reindex from multiple sources. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.Indices Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get; set; } /// /// /// The documents to reindex, which is defined with Query DSL. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -51,10 +180,8 @@ public sealed partial class Source /// A remote instance of Elasticsearch that you want to index from. /// /// - [JsonInclude, JsonPropertyName("remote")] public Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? Remote { get; set; } - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// @@ -62,7 +189,6 @@ public sealed partial class Source /// Use it when you are indexing from remote to ensure that the batches fit within the on-heap buffer, which defaults to a maximum size of 100 MB. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -70,41 +196,49 @@ public sealed partial class Source /// Slice the reindex request manually using the provided slice ID and total number of slices. /// /// - [JsonInclude, JsonPropertyName("slice")] public Elastic.Clients.Elasticsearch.SlicedScroll? Slice { get; set; } + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + [System.Obsolete("Deprecated in '7.6.0'.")] + public System.Collections.Generic.ICollection? Sort { get; set; } + /// /// /// If true, reindex all source fields. /// Set it to a list to reindex select fields. /// /// - [JsonInclude, JsonPropertyName("_source")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? SourceFields { get; set; } } -public sealed partial class SourceDescriptor : SerializableDescriptor> +public readonly partial struct SourceDescriptor { - internal SourceDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Reindex.Source Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Source instance) + { + Instance = instance; + } - public SourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? RemoteValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor RemoteDescriptor { get; set; } - private Action RemoteDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action> SliceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Fields? SourceFieldsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Source instance) => new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor descriptor) => descriptor.Instance; /// /// @@ -112,10 +246,10 @@ public SourceDescriptor() : base() /// It accepts a comma-separated list to reindex from multiple sources. /// /// - public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -123,28 +257,32 @@ public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices /// The documents to reindex, which is defined with Query DSL. /// /// - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The documents to reindex, which is defined with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SourceDescriptor Query(Action> configure) + /// + /// + /// A remote instance of Elasticsearch that you want to index from. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Remote = value; + return this; } /// @@ -152,34 +290,56 @@ public SourceDescriptor Query(Action /// - public SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? remote) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Remote(System.Action action) + { + Instance.Remote = Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings(System.Action>? action) { - RemoteDescriptor = null; - RemoteDescriptorAction = null; - RemoteValue = remote; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RemoteValue = null; - RemoteDescriptorAction = null; - RemoteDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SourceDescriptor Remote(Action configure) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RemoteValue = null; - RemoteDescriptor = null; - RemoteDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SourceDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// @@ -188,10 +348,10 @@ public SourceDescriptor RuntimeMappings(Func /// - public SourceDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -199,138 +359,134 @@ public SourceDescriptor Size(int? size) /// Slice the reindex request manually using the provided slice ID and total number of slices. /// /// - public SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Slice = value; + return this; } - public SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + /// + /// + /// Slice the reindex request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Slice(System.Action> action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public SourceDescriptor Slice(Action> configure) + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(System.Collections.Generic.ICollection? value) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } + [System.Obsolete("Deprecated in '7.6.0'.")] /// /// - /// If true, reindex all source fields. - /// Set it to a list to reindex select fields. + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. /// /// - public SourceDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? sourceFields) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SourceFieldsValue = sourceFields; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(params System.Action>[] actions) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (RemoteDescriptor is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, RemoteDescriptor, options); - } - else if (RemoteDescriptorAction is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor(RemoteDescriptorAction), options); - } - else if (RemoteValue is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, RemoteValue, options); - } - - if (RuntimeMappingsValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + Instance.Sort = items; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + /// + /// + /// If true, reindex all source fields. + /// Set it to a list to reindex select fields. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceFields = value; + return this; + } - if (SourceFieldsValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceFieldsValue, options); - } + /// + /// + /// If true, reindex all source fields. + /// Set it to a list to reindex select fields. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceFields = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Reindex.Source Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(new Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SourceDescriptor : SerializableDescriptor +public readonly partial struct SourceDescriptor { - internal SourceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Reindex.Source Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Source instance) + { + Instance = instance; + } - public SourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? RemoteValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor RemoteDescriptor { get; set; } - private Action RemoteDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScroll? SliceValue { get; set; } - private Elastic.Clients.Elasticsearch.SlicedScrollDescriptor SliceDescriptor { get; set; } - private Action SliceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Fields? SourceFieldsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(Elastic.Clients.Elasticsearch.Core.Reindex.Source instance) => new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor descriptor) => descriptor.Instance; /// /// @@ -338,10 +494,10 @@ public SourceDescriptor() : base() /// It accepts a comma-separated list to reindex from multiple sources. /// /// - public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -349,28 +505,43 @@ public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) /// The documents to reindex, which is defined with Query DSL. /// /// - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The documents to reindex, which is defined with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The documents to reindex, which is defined with Query DSL. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SourceDescriptor Query(Action configure) + /// + /// + /// A remote instance of Elasticsearch that you want to index from. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Remote = value; + return this; } /// @@ -378,34 +549,76 @@ public SourceDescriptor Query(Action /// - public SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSource? remote) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Remote(System.Action action) + { + Instance.Remote = Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) + { + Instance.RuntimeMappings = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings() + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor RuntimeMappings(System.Action>? action) { - RemoteDescriptor = null; - RemoteDescriptorAction = null; - RemoteValue = remote; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public SourceDescriptor Remote(Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RemoteValue = null; - RemoteDescriptorAction = null; - RemoteDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SourceDescriptor Remote(Action configure) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - RemoteValue = null; - RemoteDescriptor = null; - RemoteDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public SourceDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } /// @@ -414,10 +627,10 @@ public SourceDescriptor RuntimeMappings(Func /// - public SourceDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -425,113 +638,147 @@ public SourceDescriptor Size(int? size) /// Slice the reindex request manually using the provided slice ID and total number of slices. /// /// - public SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? slice) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScroll? value) { - SliceDescriptor = null; - SliceDescriptorAction = null; - SliceValue = slice; - return Self; + Instance.Slice = value; + return this; } - public SourceDescriptor Slice(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) + /// + /// + /// Slice the reindex request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Slice(System.Action action) { - SliceValue = null; - SliceDescriptorAction = null; - SliceDescriptor = descriptor; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } - public SourceDescriptor Slice(Action configure) + /// + /// + /// Slice the reindex request manually using the provided slice ID and total number of slices. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Slice(System.Action> action) { - SliceValue = null; - SliceDescriptor = null; - SliceDescriptorAction = configure; - return Self; + Instance.Slice = Elastic.Clients.Elasticsearch.SlicedScrollDescriptor.Build(action); + return this; } + [System.Obsolete("Deprecated in '7.6.0'.")] /// /// - /// If true, reindex all source fields. - /// Set it to a list to reindex select fields. + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(System.Collections.Generic.ICollection? value) + { + Instance.Sort = value; + return this; + } + + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. /// /// - public SourceDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? sourceFields) + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SourceFieldsValue = sourceFields; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(params System.Action[] actions) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (RemoteDescriptor is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, RemoteDescriptor, options); - } - else if (RemoteDescriptorAction is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Reindex.RemoteSourceDescriptor(RemoteDescriptorAction), options); - } - else if (RemoteValue is not null) - { - writer.WritePropertyName("remote"); - JsonSerializer.Serialize(writer, RemoteValue, options); - } + Instance.Sort = items; + return this; + } - if (RuntimeMappingsValue is not null) + [System.Obsolete("Deprecated in '7.6.0'.")] + /// + /// + /// A comma-separated list of <field>:<direction> pairs to sort by before indexing. + /// Use it in conjunction with max_docs to control what documents are reindexed. + /// + /// + /// WARNING: Sort in reindex is deprecated. + /// Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. + /// If used in combination with max_docs, consider using a query filter instead. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + Instance.Sort = items; + return this; + } - if (SliceDescriptor is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceDescriptor, options); - } - else if (SliceDescriptorAction is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(SliceDescriptorAction), options); - } - else if (SliceValue is not null) - { - writer.WritePropertyName("slice"); - JsonSerializer.Serialize(writer, SliceValue, options); - } + /// + /// + /// If true, reindex all source fields. + /// Set it to a list to reindex select fields. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceFields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.SourceFields = value; + return this; + } - if (SourceFieldsValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceFieldsValue, options); - } + /// + /// + /// If true, reindex all source fields. + /// Set it to a list to reindex select fields. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor SourceFields(params System.Linq.Expressions.Expression>[] value) + { + Instance.SourceFields = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Reindex.Source Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Reindex.SourceDescriptor(new Elastic.Clients.Elasticsearch.Core.Reindex.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexNode.g.cs index ad0d625ceaa..085506fdc73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexNode.g.cs @@ -17,30 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.ReindexRethrottle; +internal sealed partial class ReindexNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propHost = default; + LocalJsonValue propIp = default; + LocalJsonValue propName = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue> propTasks = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + Host = propHost.Value, + Ip = propIp.Value, + Name = propName.Value, + Roles = propRoles.Value, + Tasks = propTasks.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexNodeConverter))] public sealed partial class ReindexNode { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("host")] - public string Host { get; init; } - [JsonInclude, JsonPropertyName("ip")] - public string Ip { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } - [JsonInclude, JsonPropertyName("tasks")] - public IReadOnlyDictionary Tasks { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexNode(System.Collections.Generic.IReadOnlyDictionary attributes, string host, string ip, string name, System.Collections.Generic.IReadOnlyDictionary tasks, string transportAddress) + { + Attributes = attributes; + Host = host; + Ip = ip; + Name = name; + Tasks = tasks; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public ReindexNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReindexNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Host { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Ip { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Tasks { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexStatus.g.cs index d9257364663..12da67be7ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexStatus.g.cs @@ -17,77 +17,272 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.ReindexRethrottle; +internal sealed partial class ReindexStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBatches = System.Text.Json.JsonEncodedText.Encode("batches"); + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText PropNoops = System.Text.Json.JsonEncodedText.Encode("noops"); + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerSecond = System.Text.Json.JsonEncodedText.Encode("requests_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropRetries = System.Text.Json.JsonEncodedText.Encode("retries"); + private static readonly System.Text.Json.JsonEncodedText PropThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledMillis = System.Text.Json.JsonEncodedText.Encode("throttled_millis"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntil = System.Text.Json.JsonEncodedText.Encode("throttled_until"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledUntilMillis = System.Text.Json.JsonEncodedText.Encode("throttled_until_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); + private static readonly System.Text.Json.JsonEncodedText PropVersionConflicts = System.Text.Json.JsonEncodedText.Encode("version_conflicts"); + + public override Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBatches = default; + LocalJsonValue propCreated = default; + LocalJsonValue propDeleted = default; + LocalJsonValue propNoops = default; + LocalJsonValue propRequestsPerSecond = default; + LocalJsonValue propRetries = default; + LocalJsonValue propThrottled = default; + LocalJsonValue propThrottledMillis = default; + LocalJsonValue propThrottledUntil = default; + LocalJsonValue propThrottledUntilMillis = default; + LocalJsonValue propTotal = default; + LocalJsonValue propUpdated = default; + LocalJsonValue propVersionConflicts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBatches.TryReadProperty(ref reader, options, PropBatches, null)) + { + continue; + } + + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (propNoops.TryReadProperty(ref reader, options, PropNoops, null)) + { + continue; + } + + if (propRequestsPerSecond.TryReadProperty(ref reader, options, PropRequestsPerSecond, null)) + { + continue; + } + + if (propRetries.TryReadProperty(ref reader, options, PropRetries, null)) + { + continue; + } + + if (propThrottled.TryReadProperty(ref reader, options, PropThrottled, null)) + { + continue; + } + + if (propThrottledMillis.TryReadProperty(ref reader, options, PropThrottledMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propThrottledUntil.TryReadProperty(ref reader, options, PropThrottledUntil, null)) + { + continue; + } + + if (propThrottledUntilMillis.TryReadProperty(ref reader, options, PropThrottledUntilMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propUpdated.TryReadProperty(ref reader, options, PropUpdated, null)) + { + continue; + } + + if (propVersionConflicts.TryReadProperty(ref reader, options, PropVersionConflicts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Batches = propBatches.Value, + Created = propCreated.Value, + Deleted = propDeleted.Value, + Noops = propNoops.Value, + RequestsPerSecond = propRequestsPerSecond.Value, + Retries = propRetries.Value, + Throttled = propThrottled.Value, + ThrottledMillis = propThrottledMillis.Value, + ThrottledUntil = propThrottledUntil.Value, + ThrottledUntilMillis = propThrottledUntilMillis.Value, + Total = propTotal.Value, + Updated = propUpdated.Value, + VersionConflicts = propVersionConflicts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBatches, value.Batches, null, null); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteProperty(options, PropNoops, value.Noops, null, null); + writer.WriteProperty(options, PropRequestsPerSecond, value.RequestsPerSecond, null, null); + writer.WriteProperty(options, PropRetries, value.Retries, null, null); + writer.WriteProperty(options, PropThrottled, value.Throttled, null, null); + writer.WriteProperty(options, PropThrottledMillis, value.ThrottledMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropThrottledUntil, value.ThrottledUntil, null, null); + writer.WriteProperty(options, PropThrottledUntilMillis, value.ThrottledUntilMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropUpdated, value.Updated, null, null); + writer.WriteProperty(options, PropVersionConflicts, value.VersionConflicts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatusConverter))] public sealed partial class ReindexStatus { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexStatus(long batches, long created, long deleted, long noops, float requestsPerSecond, Elastic.Clients.Elasticsearch.Retries retries, System.TimeSpan throttledMillis, System.TimeSpan throttledUntilMillis, long total, long updated, long versionConflicts) + { + Batches = batches; + Created = created; + Deleted = deleted; + Noops = noops; + RequestsPerSecond = requestsPerSecond; + Retries = retries; + ThrottledMillis = throttledMillis; + ThrottledUntilMillis = throttledUntilMillis; + Total = total; + Updated = updated; + VersionConflicts = versionConflicts; + } +#if NET7_0_OR_GREATER + public ReindexStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReindexStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of scroll responses pulled back by the reindex. /// /// - [JsonInclude, JsonPropertyName("batches")] - public long Batches { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Batches { get; set; } /// /// /// The number of documents that were successfully created. /// /// - [JsonInclude, JsonPropertyName("created")] - public long Created { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Created { get; set; } /// /// /// The number of documents that were successfully deleted. /// /// - [JsonInclude, JsonPropertyName("deleted")] - public long Deleted { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Deleted { get; set; } /// /// /// The number of documents that were ignored because the script used for the reindex returned a noop value for ctx.op. /// /// - [JsonInclude, JsonPropertyName("noops")] - public long Noops { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Noops { get; set; } /// /// /// The number of requests per second effectively executed during the reindex. /// /// - [JsonInclude, JsonPropertyName("requests_per_second")] - public float RequestsPerSecond { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + float RequestsPerSecond { get; set; } /// /// /// The number of retries attempted by reindex. bulk is the number of bulk actions retried and search is the number of search actions retried. /// /// - [JsonInclude, JsonPropertyName("retries")] - public Elastic.Clients.Elasticsearch.Retries Retries { get; init; } - [JsonInclude, JsonPropertyName("throttled")] - public Elastic.Clients.Elasticsearch.Duration? Throttled { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Retries Retries { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Throttled { get; set; } /// /// /// Number of milliseconds the request slept to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_millis")] - public long ThrottledMillis { get; init; } - [JsonInclude, JsonPropertyName("throttled_until")] - public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ThrottledMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ThrottledUntil { get; set; } /// /// @@ -95,30 +290,42 @@ public sealed partial class ReindexStatus /// It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform to requests_per_second. /// /// - [JsonInclude, JsonPropertyName("throttled_until_millis")] - public long ThrottledUntilMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ThrottledUntilMillis { get; set; } /// /// /// The number of documents that were successfully processed. /// /// - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } /// /// /// The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it. /// /// - [JsonInclude, JsonPropertyName("updated")] - public long Updated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Updated { get; set; } /// /// /// The number of version conflicts that reindex hits. /// /// - [JsonInclude, JsonPropertyName("version_conflicts")] - public long VersionConflicts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long VersionConflicts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexTask.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexTask.g.cs index c2c8d0e3a6f..a315985d922 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexTask.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ReindexRethrottle/ReindexTask.g.cs @@ -17,36 +17,214 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.ReindexRethrottle; +internal sealed partial class ReindexTaskConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropCancellable = System.Text.Json.JsonEncodedText.Encode("cancellable"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropRunningTimeInNanos = System.Text.Json.JsonEncodedText.Encode("running_time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexTask Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propCancellable = default; + LocalJsonValue propDescription = default; + LocalJsonValue>> propHeaders = default; + LocalJsonValue propId = default; + LocalJsonValue propNode = default; + LocalJsonValue propRunningTimeInNanos = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propStatus = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propCancellable.TryReadProperty(ref reader, options, PropCancellable, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)!)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propRunningTimeInNanos.TryReadProperty(ref reader, options, PropRunningTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexTask(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Cancellable = propCancellable.Value, + Description = propDescription.Value, + Headers = propHeaders.Value, + Id = propId.Value, + Node = propNode.Value, + RunningTimeInNanos = propRunningTimeInNanos.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + Status = propStatus.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexTask value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropCancellable, value.Cancellable, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropRunningTimeInNanos, value.RunningTimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexTaskConverter))] public sealed partial class ReindexTask { - [JsonInclude, JsonPropertyName("action")] - public string Action { get; init; } - [JsonInclude, JsonPropertyName("cancellable")] - public bool Cancellable { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("headers")] - public IReadOnlyDictionary>> Headers { get; init; } - [JsonInclude, JsonPropertyName("id")] - public long Id { get; init; } - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("running_time_in_nanos")] - public long RunningTimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus Status { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReindexTask(string action, bool cancellable, string description, System.Collections.Generic.IReadOnlyDictionary> headers, long id, string node, System.TimeSpan runningTimeInNanos, System.DateTimeOffset startTimeInMillis, Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus status, string type) + { + Action = action; + Cancellable = cancellable; + Description = description; + Headers = headers; + Id = id; + Node = node; + RunningTimeInNanos = runningTimeInNanos; + StartTimeInMillis = startTimeInMillis; + Status = status; + Type = type; + } +#if NET7_0_OR_GREATER + public ReindexTask() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReindexTask() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReindexTask(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Action { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Cancellable { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Headers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RunningTimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.ReindexRethrottle.ReindexStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ScriptsPainlessExecute/PainlessContextSetup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ScriptsPainlessExecute/PainlessContextSetup.g.cs index 1cb7f9ff331..9822403ef00 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ScriptsPainlessExecute/PainlessContextSetup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/ScriptsPainlessExecute/PainlessContextSetup.g.cs @@ -17,79 +17,178 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute; +internal sealed partial class PainlessContextSetupConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocument = System.Text.Json.JsonEncodedText.Encode("document"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocument = default; + LocalJsonValue propIndex = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocument.TryReadProperty(ref reader, options, PropDocument, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Document = propDocument.Value, + Index = propIndex.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocument, value.Document, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupConverter))] public sealed partial class PainlessContextSetup { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PainlessContextSetup(object document, Elastic.Clients.Elasticsearch.IndexName index) + { + Document = document; + Index = index; + } +#if NET7_0_OR_GREATER + public PainlessContextSetup() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PainlessContextSetup() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// - /// Document that’s temporarily indexed in-memory and accessible from the script. + /// Document that's temporarily indexed in-memory and accessible from the script. /// /// - [JsonInclude, JsonPropertyName("document")] - public object Document { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Document { get; set; } /// /// - /// Index containing a mapping that’s compatible with the indexed document. + /// Index containing a mapping that's compatible with the indexed document. /// You may specify a remote index by prefixing the index with the remote cluster alias. + /// For example, remote1:my_index indicates that you want to run the painless script against the "my_index" index on the "remote1" cluster. + /// This request will be forwarded to the "remote1" cluster if you have configured a connection to that remote cluster. + /// + /// + /// NOTE: Wildcards are not accepted in the index expression for this endpoint. + /// The expression *:myindex will return the error "No such remote cluster" and the expression logs* or remote1:logs* will return the error "index not found". /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// /// Use this parameter to specify a query for computing a score. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } -public sealed partial class PainlessContextSetupDescriptor : SerializableDescriptor> +public readonly partial struct PainlessContextSetupDescriptor { - internal PainlessContextSetupDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PainlessContextSetupDescriptor(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup instance) + { + Instance = instance; + } - public PainlessContextSetupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PainlessContextSetupDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private object DocumentValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup instance) => new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor descriptor) => descriptor.Instance; /// /// - /// Document that’s temporarily indexed in-memory and accessible from the script. + /// Document that's temporarily indexed in-memory and accessible from the script. /// /// - public PainlessContextSetupDescriptor Document(object document) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Document(object value) { - DocumentValue = document; - return Self; + Instance.Document = value; + return this; } /// /// - /// Index containing a mapping that’s compatible with the indexed document. + /// Index containing a mapping that's compatible with the indexed document. /// You may specify a remote index by prefixing the index with the remote cluster alias. + /// For example, remote1:my_index indicates that you want to run the painless script against the "my_index" index on the "remote1" cluster. + /// This request will be forwarded to the "remote1" cluster if you have configured a connection to that remote cluster. + /// + /// + /// NOTE: Wildcards are not accepted in the index expression for this endpoint. + /// The expression *:myindex will return the error "No such remote cluster" and the expression logs* or remote1:logs* will return the error "index not found". /// /// - public PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -97,92 +196,78 @@ public PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticse /// Use this parameter to specify a query for computing a score. /// /// - public PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public PainlessContextSetupDescriptor Query(Action> configure) + /// + /// + /// Use this parameter to specify a query for computing a score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("document"); - JsonSerializer.Serialize(writer, DocumentValue, options); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PainlessContextSetupDescriptor : SerializableDescriptor +public readonly partial struct PainlessContextSetupDescriptor { - internal PainlessContextSetupDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup Instance { get; init; } - public PainlessContextSetupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PainlessContextSetupDescriptor(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup instance) { + Instance = instance; } - private object DocumentValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PainlessContextSetupDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup instance) => new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor descriptor) => descriptor.Instance; /// /// - /// Document that’s temporarily indexed in-memory and accessible from the script. + /// Document that's temporarily indexed in-memory and accessible from the script. /// /// - public PainlessContextSetupDescriptor Document(object document) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Document(object value) { - DocumentValue = document; - return Self; + Instance.Document = value; + return this; } /// /// - /// Index containing a mapping that’s compatible with the indexed document. + /// Index containing a mapping that's compatible with the indexed document. /// You may specify a remote index by prefixing the index with the remote cluster alias. + /// For example, remote1:my_index indicates that you want to run the painless script against the "my_index" index on the "remote1" cluster. + /// This request will be forwarded to the "remote1" cluster if you have configured a connection to that remote cluster. + /// + /// + /// NOTE: Wildcards are not accepted in the index expression for this endpoint. + /// The expression *:myindex will return the error "No such remote cluster" and the expression logs* or remote1:logs* will return the error "index not found". /// /// - public PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -190,53 +275,39 @@ public PainlessContextSetupDescriptor Index(Elastic.Clients.Elasticsearch.IndexN /// Use this parameter to specify a query for computing a score. /// /// - public PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public PainlessContextSetupDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Use this parameter to specify a query for computing a score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public PainlessContextSetupDescriptor Query(Action configure) + /// + /// + /// Use this parameter to specify a query for computing a score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("document"); - JsonSerializer.Serialize(writer, DocumentValue, options); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetupDescriptor(new Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextSetup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationBreakdown.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationBreakdown.g.cs index 9bc652e4fd6..96e3c3618f7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationBreakdown.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationBreakdown.g.cs @@ -17,40 +17,234 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class AggregationBreakdownConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuildAggregation = System.Text.Json.JsonEncodedText.Encode("build_aggregation"); + private static readonly System.Text.Json.JsonEncodedText PropBuildAggregationCount = System.Text.Json.JsonEncodedText.Encode("build_aggregation_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuildLeafCollector = System.Text.Json.JsonEncodedText.Encode("build_leaf_collector"); + private static readonly System.Text.Json.JsonEncodedText PropBuildLeafCollectorCount = System.Text.Json.JsonEncodedText.Encode("build_leaf_collector_count"); + private static readonly System.Text.Json.JsonEncodedText PropCollect = System.Text.Json.JsonEncodedText.Encode("collect"); + private static readonly System.Text.Json.JsonEncodedText PropCollectCount = System.Text.Json.JsonEncodedText.Encode("collect_count"); + private static readonly System.Text.Json.JsonEncodedText PropInitialize = System.Text.Json.JsonEncodedText.Encode("initialize"); + private static readonly System.Text.Json.JsonEncodedText PropInitializeCount = System.Text.Json.JsonEncodedText.Encode("initialize_count"); + private static readonly System.Text.Json.JsonEncodedText PropPostCollection = System.Text.Json.JsonEncodedText.Encode("post_collection"); + private static readonly System.Text.Json.JsonEncodedText PropPostCollectionCount = System.Text.Json.JsonEncodedText.Encode("post_collection_count"); + private static readonly System.Text.Json.JsonEncodedText PropReduce = System.Text.Json.JsonEncodedText.Encode("reduce"); + private static readonly System.Text.Json.JsonEncodedText PropReduceCount = System.Text.Json.JsonEncodedText.Encode("reduce_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuildAggregation = default; + LocalJsonValue propBuildAggregationCount = default; + LocalJsonValue propBuildLeafCollector = default; + LocalJsonValue propBuildLeafCollectorCount = default; + LocalJsonValue propCollect = default; + LocalJsonValue propCollectCount = default; + LocalJsonValue propInitialize = default; + LocalJsonValue propInitializeCount = default; + LocalJsonValue propPostCollection = default; + LocalJsonValue propPostCollectionCount = default; + LocalJsonValue propReduce = default; + LocalJsonValue propReduceCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuildAggregation.TryReadProperty(ref reader, options, PropBuildAggregation, null)) + { + continue; + } + + if (propBuildAggregationCount.TryReadProperty(ref reader, options, PropBuildAggregationCount, null)) + { + continue; + } + + if (propBuildLeafCollector.TryReadProperty(ref reader, options, PropBuildLeafCollector, null)) + { + continue; + } + + if (propBuildLeafCollectorCount.TryReadProperty(ref reader, options, PropBuildLeafCollectorCount, null)) + { + continue; + } + + if (propCollect.TryReadProperty(ref reader, options, PropCollect, null)) + { + continue; + } + + if (propCollectCount.TryReadProperty(ref reader, options, PropCollectCount, null)) + { + continue; + } + + if (propInitialize.TryReadProperty(ref reader, options, PropInitialize, null)) + { + continue; + } + + if (propInitializeCount.TryReadProperty(ref reader, options, PropInitializeCount, null)) + { + continue; + } + + if (propPostCollection.TryReadProperty(ref reader, options, PropPostCollection, null)) + { + continue; + } + + if (propPostCollectionCount.TryReadProperty(ref reader, options, PropPostCollectionCount, null)) + { + continue; + } + + if (propReduce.TryReadProperty(ref reader, options, PropReduce, null)) + { + continue; + } + + if (propReduceCount.TryReadProperty(ref reader, options, PropReduceCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BuildAggregation = propBuildAggregation.Value, + BuildAggregationCount = propBuildAggregationCount.Value, + BuildLeafCollector = propBuildLeafCollector.Value, + BuildLeafCollectorCount = propBuildLeafCollectorCount.Value, + Collect = propCollect.Value, + CollectCount = propCollectCount.Value, + Initialize = propInitialize.Value, + InitializeCount = propInitializeCount.Value, + PostCollection = propPostCollection.Value, + PostCollectionCount = propPostCollectionCount.Value, + Reduce = propReduce.Value, + ReduceCount = propReduceCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuildAggregation, value.BuildAggregation, null, null); + writer.WriteProperty(options, PropBuildAggregationCount, value.BuildAggregationCount, null, null); + writer.WriteProperty(options, PropBuildLeafCollector, value.BuildLeafCollector, null, null); + writer.WriteProperty(options, PropBuildLeafCollectorCount, value.BuildLeafCollectorCount, null, null); + writer.WriteProperty(options, PropCollect, value.Collect, null, null); + writer.WriteProperty(options, PropCollectCount, value.CollectCount, null, null); + writer.WriteProperty(options, PropInitialize, value.Initialize, null, null); + writer.WriteProperty(options, PropInitializeCount, value.InitializeCount, null, null); + writer.WriteProperty(options, PropPostCollection, value.PostCollection, null, null); + writer.WriteProperty(options, PropPostCollectionCount, value.PostCollectionCount, null, null); + writer.WriteProperty(options, PropReduce, value.Reduce, null, null); + writer.WriteProperty(options, PropReduceCount, value.ReduceCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdownConverter))] public sealed partial class AggregationBreakdown { - [JsonInclude, JsonPropertyName("build_aggregation")] - public long BuildAggregation { get; init; } - [JsonInclude, JsonPropertyName("build_aggregation_count")] - public long BuildAggregationCount { get; init; } - [JsonInclude, JsonPropertyName("build_leaf_collector")] - public long BuildLeafCollector { get; init; } - [JsonInclude, JsonPropertyName("build_leaf_collector_count")] - public long BuildLeafCollectorCount { get; init; } - [JsonInclude, JsonPropertyName("collect")] - public long Collect { get; init; } - [JsonInclude, JsonPropertyName("collect_count")] - public long CollectCount { get; init; } - [JsonInclude, JsonPropertyName("initialize")] - public long Initialize { get; init; } - [JsonInclude, JsonPropertyName("initialize_count")] - public long InitializeCount { get; init; } - [JsonInclude, JsonPropertyName("post_collection")] - public long? PostCollection { get; init; } - [JsonInclude, JsonPropertyName("post_collection_count")] - public long? PostCollectionCount { get; init; } - [JsonInclude, JsonPropertyName("reduce")] - public long Reduce { get; init; } - [JsonInclude, JsonPropertyName("reduce_count")] - public long ReduceCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationBreakdown(long buildAggregation, long buildAggregationCount, long buildLeafCollector, long buildLeafCollectorCount, long collect, long collectCount, long initialize, long initializeCount, long reduce, long reduceCount) + { + BuildAggregation = buildAggregation; + BuildAggregationCount = buildAggregationCount; + BuildLeafCollector = buildLeafCollector; + BuildLeafCollectorCount = buildLeafCollectorCount; + Collect = collect; + CollectCount = collectCount; + Initialize = initialize; + InitializeCount = initializeCount; + Reduce = reduce; + ReduceCount = reduceCount; + } +#if NET7_0_OR_GREATER + public AggregationBreakdown() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AggregationBreakdown() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregationBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long BuildAggregation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildAggregationCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildLeafCollector { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildLeafCollectorCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Collect { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CollectCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Initialize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InitializeCount { get; set; } + public long? PostCollection { get; set; } + public long? PostCollectionCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Reduce { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReduceCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfile.g.cs index 1a12960c95c..6c6d2066019 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfile.g.cs @@ -17,28 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class AggregationProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBreakdown = System.Text.Json.JsonEncodedText.Encode("breakdown"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDebug = System.Text.Json.JsonEncodedText.Encode("debug"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.AggregationProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBreakdown = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue propDebug = default; + LocalJsonValue propDescription = default; + LocalJsonValue propTimeInNanos = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBreakdown.TryReadProperty(ref reader, options, PropBreakdown, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDebug.TryReadProperty(ref reader, options, PropDebug, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.AggregationProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Breakdown = propBreakdown.Value, + Children = propChildren.Value, + Debug = propDebug.Value, + Description = propDescription.Value, + TimeInNanos = propTimeInNanos.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.AggregationProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBreakdown, value.Breakdown, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDebug, value.Debug, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileConverter))] public sealed partial class AggregationProfile { - [JsonInclude, JsonPropertyName("breakdown")] - public Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown Breakdown { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("debug")] - public Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug? Debug { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregationProfile(Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown breakdown, string description, System.TimeSpan timeInNanos, string type) + { + Breakdown = breakdown; + Description = description; + TimeInNanos = timeInNanos; + Type = type; + } +#if NET7_0_OR_GREATER + public AggregationProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AggregationProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregationProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.AggregationBreakdown Breakdown { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug? Debug { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDebug.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDebug.g.cs index 8fa399791e9..6b09b252bd4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDebug.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDebug.g.cs @@ -17,80 +17,379 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class AggregationProfileDebugConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBruteForceUsed = System.Text.Json.JsonEncodedText.Encode("brute_force_used"); + private static readonly System.Text.Json.JsonEncodedText PropBuiltBuckets = System.Text.Json.JsonEncodedText.Encode("built_buckets"); + private static readonly System.Text.Json.JsonEncodedText PropCharsFetched = System.Text.Json.JsonEncodedText.Encode("chars_fetched"); + private static readonly System.Text.Json.JsonEncodedText PropCollectAnalyzedCount = System.Text.Json.JsonEncodedText.Encode("collect_analyzed_count"); + private static readonly System.Text.Json.JsonEncodedText PropCollectAnalyzedNs = System.Text.Json.JsonEncodedText.Encode("collect_analyzed_ns"); + private static readonly System.Text.Json.JsonEncodedText PropCollectionStrategy = System.Text.Json.JsonEncodedText.Encode("collection_strategy"); + private static readonly System.Text.Json.JsonEncodedText PropDeferredAggregators = System.Text.Json.JsonEncodedText.Encode("deferred_aggregators"); + private static readonly System.Text.Json.JsonEncodedText PropDelegate = System.Text.Json.JsonEncodedText.Encode("delegate"); + private static readonly System.Text.Json.JsonEncodedText PropDelegateDebug = System.Text.Json.JsonEncodedText.Encode("delegate_debug"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicPruningAttempted = System.Text.Json.JsonEncodedText.Encode("dynamic_pruning_attempted"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicPruningUsed = System.Text.Json.JsonEncodedText.Encode("dynamic_pruning_used"); + private static readonly System.Text.Json.JsonEncodedText PropEmptyCollectorsUsed = System.Text.Json.JsonEncodedText.Encode("empty_collectors_used"); + private static readonly System.Text.Json.JsonEncodedText PropExtractCount = System.Text.Json.JsonEncodedText.Encode("extract_count"); + private static readonly System.Text.Json.JsonEncodedText PropExtractNs = System.Text.Json.JsonEncodedText.Encode("extract_ns"); + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText PropHasFilter = System.Text.Json.JsonEncodedText.Encode("has_filter"); + private static readonly System.Text.Json.JsonEncodedText PropMapReducer = System.Text.Json.JsonEncodedText.Encode("map_reducer"); + private static readonly System.Text.Json.JsonEncodedText PropNumericCollectorsUsed = System.Text.Json.JsonEncodedText.Encode("numeric_collectors_used"); + private static readonly System.Text.Json.JsonEncodedText PropOrdinalsCollectorsOverheadTooHigh = System.Text.Json.JsonEncodedText.Encode("ordinals_collectors_overhead_too_high"); + private static readonly System.Text.Json.JsonEncodedText PropOrdinalsCollectorsUsed = System.Text.Json.JsonEncodedText.Encode("ordinals_collectors_used"); + private static readonly System.Text.Json.JsonEncodedText PropResultStrategy = System.Text.Json.JsonEncodedText.Encode("result_strategy"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsCollected = System.Text.Json.JsonEncodedText.Encode("segments_collected"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsCounted = System.Text.Json.JsonEncodedText.Encode("segments_counted"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsWithDeletedDocs = System.Text.Json.JsonEncodedText.Encode("segments_with_deleted_docs"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsWithDocCountField = System.Text.Json.JsonEncodedText.Encode("segments_with_doc_count_field"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsWithMultiValuedOrds = System.Text.Json.JsonEncodedText.Encode("segments_with_multi_valued_ords"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsWithSingleValuedOrds = System.Text.Json.JsonEncodedText.Encode("segments_with_single_valued_ords"); + private static readonly System.Text.Json.JsonEncodedText PropSkippedDueToNoData = System.Text.Json.JsonEncodedText.Encode("skipped_due_to_no_data"); + private static readonly System.Text.Json.JsonEncodedText PropStringHashingCollectorsUsed = System.Text.Json.JsonEncodedText.Encode("string_hashing_collectors_used"); + private static readonly System.Text.Json.JsonEncodedText PropSurvivingBuckets = System.Text.Json.JsonEncodedText.Encode("surviving_buckets"); + private static readonly System.Text.Json.JsonEncodedText PropTotalBuckets = System.Text.Json.JsonEncodedText.Encode("total_buckets"); + private static readonly System.Text.Json.JsonEncodedText PropValuesFetched = System.Text.Json.JsonEncodedText.Encode("values_fetched"); + + public override Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBruteForceUsed = default; + LocalJsonValue propBuiltBuckets = default; + LocalJsonValue propCharsFetched = default; + LocalJsonValue propCollectAnalyzedCount = default; + LocalJsonValue propCollectAnalyzedNs = default; + LocalJsonValue propCollectionStrategy = default; + LocalJsonValue?> propDeferredAggregators = default; + LocalJsonValue propDelegate = default; + LocalJsonValue propDelegateDebug = default; + LocalJsonValue propDynamicPruningAttempted = default; + LocalJsonValue propDynamicPruningUsed = default; + LocalJsonValue propEmptyCollectorsUsed = default; + LocalJsonValue propExtractCount = default; + LocalJsonValue propExtractNs = default; + LocalJsonValue?> propFilters = default; + LocalJsonValue propHasFilter = default; + LocalJsonValue propMapReducer = default; + LocalJsonValue propNumericCollectorsUsed = default; + LocalJsonValue propOrdinalsCollectorsOverheadTooHigh = default; + LocalJsonValue propOrdinalsCollectorsUsed = default; + LocalJsonValue propResultStrategy = default; + LocalJsonValue propSegmentsCollected = default; + LocalJsonValue propSegmentsCounted = default; + LocalJsonValue propSegmentsWithDeletedDocs = default; + LocalJsonValue propSegmentsWithDocCountField = default; + LocalJsonValue propSegmentsWithMultiValuedOrds = default; + LocalJsonValue propSegmentsWithSingleValuedOrds = default; + LocalJsonValue propSkippedDueToNoData = default; + LocalJsonValue propStringHashingCollectorsUsed = default; + LocalJsonValue propSurvivingBuckets = default; + LocalJsonValue propTotalBuckets = default; + LocalJsonValue propValuesFetched = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBruteForceUsed.TryReadProperty(ref reader, options, PropBruteForceUsed, null)) + { + continue; + } + + if (propBuiltBuckets.TryReadProperty(ref reader, options, PropBuiltBuckets, null)) + { + continue; + } + + if (propCharsFetched.TryReadProperty(ref reader, options, PropCharsFetched, null)) + { + continue; + } + + if (propCollectAnalyzedCount.TryReadProperty(ref reader, options, PropCollectAnalyzedCount, null)) + { + continue; + } + + if (propCollectAnalyzedNs.TryReadProperty(ref reader, options, PropCollectAnalyzedNs, null)) + { + continue; + } + + if (propCollectionStrategy.TryReadProperty(ref reader, options, PropCollectionStrategy, null)) + { + continue; + } + + if (propDeferredAggregators.TryReadProperty(ref reader, options, PropDeferredAggregators, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDelegate.TryReadProperty(ref reader, options, PropDelegate, null)) + { + continue; + } + + if (propDelegateDebug.TryReadProperty(ref reader, options, PropDelegateDebug, null)) + { + continue; + } + + if (propDynamicPruningAttempted.TryReadProperty(ref reader, options, PropDynamicPruningAttempted, null)) + { + continue; + } + + if (propDynamicPruningUsed.TryReadProperty(ref reader, options, PropDynamicPruningUsed, null)) + { + continue; + } + + if (propEmptyCollectorsUsed.TryReadProperty(ref reader, options, PropEmptyCollectorsUsed, null)) + { + continue; + } + + if (propExtractCount.TryReadProperty(ref reader, options, PropExtractCount, null)) + { + continue; + } + + if (propExtractNs.TryReadProperty(ref reader, options, PropExtractNs, null)) + { + continue; + } + + if (propFilters.TryReadProperty(ref reader, options, PropFilters, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propHasFilter.TryReadProperty(ref reader, options, PropHasFilter, null)) + { + continue; + } + + if (propMapReducer.TryReadProperty(ref reader, options, PropMapReducer, null)) + { + continue; + } + + if (propNumericCollectorsUsed.TryReadProperty(ref reader, options, PropNumericCollectorsUsed, null)) + { + continue; + } + + if (propOrdinalsCollectorsOverheadTooHigh.TryReadProperty(ref reader, options, PropOrdinalsCollectorsOverheadTooHigh, null)) + { + continue; + } + + if (propOrdinalsCollectorsUsed.TryReadProperty(ref reader, options, PropOrdinalsCollectorsUsed, null)) + { + continue; + } + + if (propResultStrategy.TryReadProperty(ref reader, options, PropResultStrategy, null)) + { + continue; + } + + if (propSegmentsCollected.TryReadProperty(ref reader, options, PropSegmentsCollected, null)) + { + continue; + } + + if (propSegmentsCounted.TryReadProperty(ref reader, options, PropSegmentsCounted, null)) + { + continue; + } + + if (propSegmentsWithDeletedDocs.TryReadProperty(ref reader, options, PropSegmentsWithDeletedDocs, null)) + { + continue; + } + + if (propSegmentsWithDocCountField.TryReadProperty(ref reader, options, PropSegmentsWithDocCountField, null)) + { + continue; + } + + if (propSegmentsWithMultiValuedOrds.TryReadProperty(ref reader, options, PropSegmentsWithMultiValuedOrds, null)) + { + continue; + } + + if (propSegmentsWithSingleValuedOrds.TryReadProperty(ref reader, options, PropSegmentsWithSingleValuedOrds, null)) + { + continue; + } + + if (propSkippedDueToNoData.TryReadProperty(ref reader, options, PropSkippedDueToNoData, null)) + { + continue; + } + + if (propStringHashingCollectorsUsed.TryReadProperty(ref reader, options, PropStringHashingCollectorsUsed, null)) + { + continue; + } + + if (propSurvivingBuckets.TryReadProperty(ref reader, options, PropSurvivingBuckets, null)) + { + continue; + } + + if (propTotalBuckets.TryReadProperty(ref reader, options, PropTotalBuckets, null)) + { + continue; + } + + if (propValuesFetched.TryReadProperty(ref reader, options, PropValuesFetched, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BruteForceUsed = propBruteForceUsed.Value, + BuiltBuckets = propBuiltBuckets.Value, + CharsFetched = propCharsFetched.Value, + CollectAnalyzedCount = propCollectAnalyzedCount.Value, + CollectAnalyzedNs = propCollectAnalyzedNs.Value, + CollectionStrategy = propCollectionStrategy.Value, + DeferredAggregators = propDeferredAggregators.Value, + Delegate = propDelegate.Value, + DelegateDebug = propDelegateDebug.Value, + DynamicPruningAttempted = propDynamicPruningAttempted.Value, + DynamicPruningUsed = propDynamicPruningUsed.Value, + EmptyCollectorsUsed = propEmptyCollectorsUsed.Value, + ExtractCount = propExtractCount.Value, + ExtractNs = propExtractNs.Value, + Filters = propFilters.Value, + HasFilter = propHasFilter.Value, + MapReducer = propMapReducer.Value, + NumericCollectorsUsed = propNumericCollectorsUsed.Value, + OrdinalsCollectorsOverheadTooHigh = propOrdinalsCollectorsOverheadTooHigh.Value, + OrdinalsCollectorsUsed = propOrdinalsCollectorsUsed.Value, + ResultStrategy = propResultStrategy.Value, + SegmentsCollected = propSegmentsCollected.Value, + SegmentsCounted = propSegmentsCounted.Value, + SegmentsWithDeletedDocs = propSegmentsWithDeletedDocs.Value, + SegmentsWithDocCountField = propSegmentsWithDocCountField.Value, + SegmentsWithMultiValuedOrds = propSegmentsWithMultiValuedOrds.Value, + SegmentsWithSingleValuedOrds = propSegmentsWithSingleValuedOrds.Value, + SkippedDueToNoData = propSkippedDueToNoData.Value, + StringHashingCollectorsUsed = propStringHashingCollectorsUsed.Value, + SurvivingBuckets = propSurvivingBuckets.Value, + TotalBuckets = propTotalBuckets.Value, + ValuesFetched = propValuesFetched.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBruteForceUsed, value.BruteForceUsed, null, null); + writer.WriteProperty(options, PropBuiltBuckets, value.BuiltBuckets, null, null); + writer.WriteProperty(options, PropCharsFetched, value.CharsFetched, null, null); + writer.WriteProperty(options, PropCollectAnalyzedCount, value.CollectAnalyzedCount, null, null); + writer.WriteProperty(options, PropCollectAnalyzedNs, value.CollectAnalyzedNs, null, null); + writer.WriteProperty(options, PropCollectionStrategy, value.CollectionStrategy, null, null); + writer.WriteProperty(options, PropDeferredAggregators, value.DeferredAggregators, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDelegate, value.Delegate, null, null); + writer.WriteProperty(options, PropDelegateDebug, value.DelegateDebug, null, null); + writer.WriteProperty(options, PropDynamicPruningAttempted, value.DynamicPruningAttempted, null, null); + writer.WriteProperty(options, PropDynamicPruningUsed, value.DynamicPruningUsed, null, null); + writer.WriteProperty(options, PropEmptyCollectorsUsed, value.EmptyCollectorsUsed, null, null); + writer.WriteProperty(options, PropExtractCount, value.ExtractCount, null, null); + writer.WriteProperty(options, PropExtractNs, value.ExtractNs, null, null); + writer.WriteProperty(options, PropFilters, value.Filters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHasFilter, value.HasFilter, null, null); + writer.WriteProperty(options, PropMapReducer, value.MapReducer, null, null); + writer.WriteProperty(options, PropNumericCollectorsUsed, value.NumericCollectorsUsed, null, null); + writer.WriteProperty(options, PropOrdinalsCollectorsOverheadTooHigh, value.OrdinalsCollectorsOverheadTooHigh, null, null); + writer.WriteProperty(options, PropOrdinalsCollectorsUsed, value.OrdinalsCollectorsUsed, null, null); + writer.WriteProperty(options, PropResultStrategy, value.ResultStrategy, null, null); + writer.WriteProperty(options, PropSegmentsCollected, value.SegmentsCollected, null, null); + writer.WriteProperty(options, PropSegmentsCounted, value.SegmentsCounted, null, null); + writer.WriteProperty(options, PropSegmentsWithDeletedDocs, value.SegmentsWithDeletedDocs, null, null); + writer.WriteProperty(options, PropSegmentsWithDocCountField, value.SegmentsWithDocCountField, null, null); + writer.WriteProperty(options, PropSegmentsWithMultiValuedOrds, value.SegmentsWithMultiValuedOrds, null, null); + writer.WriteProperty(options, PropSegmentsWithSingleValuedOrds, value.SegmentsWithSingleValuedOrds, null, null); + writer.WriteProperty(options, PropSkippedDueToNoData, value.SkippedDueToNoData, null, null); + writer.WriteProperty(options, PropStringHashingCollectorsUsed, value.StringHashingCollectorsUsed, null, null); + writer.WriteProperty(options, PropSurvivingBuckets, value.SurvivingBuckets, null, null); + writer.WriteProperty(options, PropTotalBuckets, value.TotalBuckets, null, null); + writer.WriteProperty(options, PropValuesFetched, value.ValuesFetched, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebugConverter))] public sealed partial class AggregationProfileDebug { - [JsonInclude, JsonPropertyName("brute_force_used")] - public int? BruteForceUsed { get; init; } - [JsonInclude, JsonPropertyName("built_buckets")] - public int? BuiltBuckets { get; init; } - [JsonInclude, JsonPropertyName("chars_fetched")] - public int? CharsFetched { get; init; } - [JsonInclude, JsonPropertyName("collect_analyzed_count")] - public int? CollectAnalyzedCount { get; init; } - [JsonInclude, JsonPropertyName("collect_analyzed_ns")] - public int? CollectAnalyzedNs { get; init; } - [JsonInclude, JsonPropertyName("collection_strategy")] - public string? CollectionStrategy { get; init; } - [JsonInclude, JsonPropertyName("deferred_aggregators")] - public IReadOnlyCollection? DeferredAggregators { get; init; } - [JsonInclude, JsonPropertyName("delegate")] - public string? Delegate { get; init; } - [JsonInclude, JsonPropertyName("delegate_debug")] - public Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug? DelegateDebug { get; init; } - [JsonInclude, JsonPropertyName("dynamic_pruning_attempted")] - public int? DynamicPruningAttempted { get; init; } - [JsonInclude, JsonPropertyName("dynamic_pruning_used")] - public int? DynamicPruningUsed { get; init; } - [JsonInclude, JsonPropertyName("empty_collectors_used")] - public int? EmptyCollectorsUsed { get; init; } - [JsonInclude, JsonPropertyName("extract_count")] - public int? ExtractCount { get; init; } - [JsonInclude, JsonPropertyName("extract_ns")] - public int? ExtractNs { get; init; } - [JsonInclude, JsonPropertyName("filters")] - public IReadOnlyCollection? Filters { get; init; } - [JsonInclude, JsonPropertyName("has_filter")] - public bool? HasFilter { get; init; } - [JsonInclude, JsonPropertyName("map_reducer")] - public string? MapReducer { get; init; } - [JsonInclude, JsonPropertyName("numeric_collectors_used")] - public int? NumericCollectorsUsed { get; init; } - [JsonInclude, JsonPropertyName("ordinals_collectors_overhead_too_high")] - public int? OrdinalsCollectorsOverheadTooHigh { get; init; } - [JsonInclude, JsonPropertyName("ordinals_collectors_used")] - public int? OrdinalsCollectorsUsed { get; init; } - [JsonInclude, JsonPropertyName("result_strategy")] - public string? ResultStrategy { get; init; } - [JsonInclude, JsonPropertyName("segments_collected")] - public int? SegmentsCollected { get; init; } - [JsonInclude, JsonPropertyName("segments_counted")] - public int? SegmentsCounted { get; init; } - [JsonInclude, JsonPropertyName("segments_with_deleted_docs")] - public int? SegmentsWithDeletedDocs { get; init; } - [JsonInclude, JsonPropertyName("segments_with_doc_count_field")] - public int? SegmentsWithDocCountField { get; init; } - [JsonInclude, JsonPropertyName("segments_with_multi_valued_ords")] - public int? SegmentsWithMultiValuedOrds { get; init; } - [JsonInclude, JsonPropertyName("segments_with_single_valued_ords")] - public int? SegmentsWithSingleValuedOrds { get; init; } - [JsonInclude, JsonPropertyName("skipped_due_to_no_data")] - public int? SkippedDueToNoData { get; init; } - [JsonInclude, JsonPropertyName("string_hashing_collectors_used")] - public int? StringHashingCollectorsUsed { get; init; } - [JsonInclude, JsonPropertyName("surviving_buckets")] - public int? SurvivingBuckets { get; init; } - [JsonInclude, JsonPropertyName("total_buckets")] - public int? TotalBuckets { get; init; } - [JsonInclude, JsonPropertyName("values_fetched")] - public int? ValuesFetched { get; init; } +#if NET7_0_OR_GREATER + public AggregationProfileDebug() + { + } +#endif +#if !NET7_0_OR_GREATER + public AggregationProfileDebug() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregationProfileDebug(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? BruteForceUsed { get; set; } + public int? BuiltBuckets { get; set; } + public int? CharsFetched { get; set; } + public int? CollectAnalyzedCount { get; set; } + public int? CollectAnalyzedNs { get; set; } + public string? CollectionStrategy { get; set; } + public System.Collections.Generic.IReadOnlyCollection? DeferredAggregators { get; set; } + public string? Delegate { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDebug? DelegateDebug { get; set; } + public int? DynamicPruningAttempted { get; set; } + public int? DynamicPruningUsed { get; set; } + public int? EmptyCollectorsUsed { get; set; } + public int? ExtractCount { get; set; } + public int? ExtractNs { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Filters { get; set; } + public bool? HasFilter { get; set; } + public string? MapReducer { get; set; } + public int? NumericCollectorsUsed { get; set; } + public int? OrdinalsCollectorsOverheadTooHigh { get; set; } + public int? OrdinalsCollectorsUsed { get; set; } + public string? ResultStrategy { get; set; } + public int? SegmentsCollected { get; set; } + public int? SegmentsCounted { get; set; } + public int? SegmentsWithDeletedDocs { get; set; } + public int? SegmentsWithDocCountField { get; set; } + public int? SegmentsWithMultiValuedOrds { get; set; } + public int? SegmentsWithSingleValuedOrds { get; set; } + public int? SkippedDueToNoData { get; set; } + public int? StringHashingCollectorsUsed { get; set; } + public int? SurvivingBuckets { get; set; } + public int? TotalBuckets { get; set; } + public int? ValuesFetched { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDelegateDebugFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDelegateDebugFilter.g.cs index b46c65672af..52d127c45b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDelegateDebugFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/AggregationProfileDelegateDebugFilter.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class AggregationProfileDelegateDebugFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropResultsFromMetadata = System.Text.Json.JsonEncodedText.Encode("results_from_metadata"); + private static readonly System.Text.Json.JsonEncodedText PropSegmentsCountedInConstantTime = System.Text.Json.JsonEncodedText.Encode("segments_counted_in_constant_time"); + private static readonly System.Text.Json.JsonEncodedText PropSpecializedFor = System.Text.Json.JsonEncodedText.Encode("specialized_for"); + + public override Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDelegateDebugFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + LocalJsonValue propResultsFromMetadata = default; + LocalJsonValue propSegmentsCountedInConstantTime = default; + LocalJsonValue propSpecializedFor = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propResultsFromMetadata.TryReadProperty(ref reader, options, PropResultsFromMetadata, null)) + { + continue; + } + + if (propSegmentsCountedInConstantTime.TryReadProperty(ref reader, options, PropSegmentsCountedInConstantTime, null)) + { + continue; + } + + if (propSpecializedFor.TryReadProperty(ref reader, options, PropSpecializedFor, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDelegateDebugFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value, + ResultsFromMetadata = propResultsFromMetadata.Value, + SegmentsCountedInConstantTime = propSegmentsCountedInConstantTime.Value, + SpecializedFor = propSpecializedFor.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDelegateDebugFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropResultsFromMetadata, value.ResultsFromMetadata, null, null); + writer.WriteProperty(options, PropSegmentsCountedInConstantTime, value.SegmentsCountedInConstantTime, null, null); + writer.WriteProperty(options, PropSpecializedFor, value.SpecializedFor, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.AggregationProfileDelegateDebugFilterConverter))] public sealed partial class AggregationProfileDelegateDebugFilter { - [JsonInclude, JsonPropertyName("query")] - public string? Query { get; init; } - [JsonInclude, JsonPropertyName("results_from_metadata")] - public int? ResultsFromMetadata { get; init; } - [JsonInclude, JsonPropertyName("segments_counted_in_constant_time")] - public int? SegmentsCountedInConstantTime { get; init; } - [JsonInclude, JsonPropertyName("specialized_for")] - public string? SpecializedFor { get; init; } +#if NET7_0_OR_GREATER + public AggregationProfileDelegateDebugFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public AggregationProfileDelegateDebugFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregationProfileDelegateDebugFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Query { get; set; } + public int? ResultsFromMetadata { get; set; } + public int? SegmentsCountedInConstantTime { get; set; } + public string? SpecializedFor { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Collector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Collector.g.cs index e206059116b..294a43e1c43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Collector.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Collector.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class CollectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + + public override Elastic.Clients.Elasticsearch.Core.Search.Collector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propChildren = default; + LocalJsonValue propName = default; + LocalJsonValue propReason = default; + LocalJsonValue propTimeInNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Collector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Children = propChildren.Value, + Name = propName.Value, + Reason = propReason.Value, + TimeInNanos = propTimeInNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Collector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.CollectorConverter))] public sealed partial class Collector { - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string Reason { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Collector(string name, string reason, System.TimeSpan timeInNanos) + { + Name = name; + Reason = reason; + TimeInNanos = timeInNanos; + } +#if NET7_0_OR_GREATER + public Collector() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Collector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Collector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs index 7e8b2f44500..57cb8792277 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs @@ -17,25 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class CompletionContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropContext = System.Text.Json.JsonEncodedText.Encode("context"); + private static readonly System.Text.Json.JsonEncodedText PropNeighbours = System.Text.Json.JsonEncodedText.Encode("neighbours"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + + public override Elastic.Clients.Elasticsearch.Core.Search.CompletionContext Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var readerSnapshot = reader; + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propContext = default; + LocalJsonValue?> propNeighbours = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propPrefix = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propContext.TryReadProperty(ref reader, options, PropContext, null)) + { + continue; + } + + if (propNeighbours.TryReadProperty(ref reader, options, PropNeighbours, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propPrefix.TryReadProperty(ref reader, options, PropPrefix, null)) + { + continue; + } + + try + { + reader = readerSnapshot; + var result = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Core.Search.CompletionContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Context = result + }; + } + catch (System.Text.Json.JsonException) + { + throw; + } + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.CompletionContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Context = propContext.Value, + Neighbours = propNeighbours.Value, + Precision = propPrecision.Value, + Prefix = propPrefix.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.CompletionContext value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropContext, value.Context, null, null); + writer.WriteProperty(options, PropNeighbours, value.Neighbours, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropPrefix, value.Prefix, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextConverter))] public sealed partial class CompletionContext { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionContext(Elastic.Clients.Elasticsearch.Core.Search.Context context) + { + Context = context; + } +#if NET7_0_OR_GREATER + public CompletionContext() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionContext() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The factor by which the score of the suggestion should be boosted. /// The score is computed by multiplying the boost with the suggestion weight. /// /// - [JsonInclude, JsonPropertyName("boost")] public double? Boost { get; set; } /// @@ -43,8 +143,11 @@ public sealed partial class CompletionContext /// The value of the category to filter/boost on. /// /// - [JsonInclude, JsonPropertyName("context")] - public Elastic.Clients.Elasticsearch.Core.Search.Context Context { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.Context Context { get; set; } /// /// @@ -53,8 +156,7 @@ public sealed partial class CompletionContext /// Defaults to generating neighbors for index time precision level. /// /// - [JsonInclude, JsonPropertyName("neighbours")] - public ICollection? Neighbours { get; set; } + public System.Collections.Generic.ICollection? Neighbours { get; set; } /// /// @@ -63,7 +165,6 @@ public sealed partial class CompletionContext /// Defaults to index time precision level. /// /// - [JsonInclude, JsonPropertyName("precision")] public Elastic.Clients.Elasticsearch.GeohashPrecision? Precision { get; set; } /// @@ -71,23 +172,27 @@ public sealed partial class CompletionContext /// Whether the category value should be treated as a prefix or not. /// /// - [JsonInclude, JsonPropertyName("prefix")] public bool? Prefix { get; set; } } -public sealed partial class CompletionContextDescriptor : SerializableDescriptor +public readonly partial struct CompletionContextDescriptor { - internal CompletionContextDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.CompletionContext Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionContextDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionContext instance) + { + Instance = instance; + } - public CompletionContextDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionContextDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.CompletionContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Context ContextValue { get; set; } - private ICollection? NeighboursValue { get; set; } - private Elastic.Clients.Elasticsearch.GeohashPrecision? PrecisionValue { get; set; } - private bool? PrefixValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionContext instance) => new Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionContext(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor descriptor) => descriptor.Instance; /// /// @@ -95,10 +200,10 @@ public CompletionContextDescriptor() : base() /// The score is computed by multiplying the boost with the suggestion weight. /// /// - public CompletionContextDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -106,10 +211,21 @@ public CompletionContextDescriptor Boost(double? boost) /// The value of the category to filter/boost on. /// /// - public CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Core.Search.Context context) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Core.Search.Context value) { - ContextValue = context; - return Self; + Instance.Context = value; + return this; + } + + /// + /// + /// The value of the category to filter/boost on. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Context(System.Func action) + { + Instance.Context = Elastic.Clients.Elasticsearch.Core.Search.ContextFactory.Build(action); + return this; } /// @@ -119,10 +235,42 @@ public CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Core.Se /// Defaults to generating neighbors for index time precision level. /// /// - public CompletionContextDescriptor Neighbours(ICollection? neighbours) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Neighbours(System.Collections.Generic.ICollection? value) { - NeighboursValue = neighbours; - return Self; + Instance.Neighbours = value; + return this; + } + + /// + /// + /// An array of precision values at which neighboring geohashes should be taken into account. + /// Precision value can be a distance value (5m, 10km, etc.) or a raw geohash precision (1..12). + /// Defaults to generating neighbors for index time precision level. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Neighbours(params Elastic.Clients.Elasticsearch.GeohashPrecision[] values) + { + Instance.Neighbours = [.. values]; + return this; + } + + /// + /// + /// An array of precision values at which neighboring geohashes should be taken into account. + /// Precision value can be a distance value (5m, 10km, etc.) or a raw geohash precision (1..12). + /// Defaults to generating neighbors for index time precision level. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Neighbours(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.GeohashPrecisionFactory.Build(action)); + } + + Instance.Neighbours = items; + return this; } /// @@ -132,52 +280,41 @@ public CompletionContextDescriptor Neighbours(ICollection /// - public CompletionContextDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? precision) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Precision(Elastic.Clients.Elasticsearch.GeohashPrecision? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } /// /// - /// Whether the category value should be treated as a prefix or not. + /// The precision of the geohash to encode the query geo point. + /// Can be specified as a distance value (5m, 10km, etc.), or as a raw geohash precision (1..12). + /// Defaults to index time precision level. /// /// - public CompletionContextDescriptor Prefix(bool? prefix = true) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Precision(System.Func action) { - PrefixValue = prefix; - return Self; + Instance.Precision = Elastic.Clients.Elasticsearch.GeohashPrecisionFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Whether the category value should be treated as a prefix or not. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor Prefix(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("context"); - JsonSerializer.Serialize(writer, ContextValue, options); - if (NeighboursValue is not null) - { - writer.WritePropertyName("neighbours"); - JsonSerializer.Serialize(writer, NeighboursValue, options); - } - - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - if (PrefixValue.HasValue) - { - writer.WritePropertyName("prefix"); - writer.WriteBooleanValue(PrefixValue.Value); - } + Instance.Prefix = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.CompletionContext Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.CompletionContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggest.g.cs index c294fa934bc..fbf74bc59c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggest.g.cs @@ -17,25 +17,143 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -public sealed partial class CompletionSuggest : ISuggest +internal sealed partial class CompletionSuggestConverter : System.Text.Json.Serialization.JsonConverter> { - [JsonInclude, JsonPropertyName("length")] - public int Length { get; init; } - [JsonInclude, JsonPropertyName("offset")] - public int Offset { get; init; } - [JsonInclude, JsonPropertyName("options")] - [GenericConverter(typeof(SingleOrManyCollectionConverter<>), unwrap: true)] - public IReadOnlyCollection> Options { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propOffset = default; + LocalJsonValue>> propOptions = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.ICollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, null)!)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Offset = propOffset.Value, + Options = propOptions.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection> v) => w.WriteSingleOrManyCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class CompletionSuggestConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(CompletionSuggest<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(CompletionSuggestConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggestConverterFactory))] +public sealed partial class CompletionSuggest : Elastic.Clients.Elasticsearch.Core.Search.ISuggest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggest(int length, int offset, System.Collections.Generic.ICollection> options, string text) + { + Length = length; + Offset = offset; + Options = options; + Text = text; + } +#if NET7_0_OR_GREATER + public CompletionSuggest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionSuggest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Length { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Offset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection> Options { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } + + string Elastic.Clients.Elasticsearch.Core.Search.ISuggest.Type => "completion"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggestOption.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggestOption.g.cs index 3e0c73771fb..919524e31b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggestOption.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggestOption.g.cs @@ -17,37 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class CompletionSuggestOptionConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropCollateMatch = System.Text.Json.JsonEncodedText.Encode("collate_match"); + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropScore0 = System.Text.Json.JsonEncodedText.Encode("_score"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggestOption Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollateMatch = default; + LocalJsonValue>?> propContexts = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propRouting = default; + LocalJsonValue propScore = default; + LocalJsonValue propScore0 = default; + LocalJsonValue propSource = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollateMatch.TryReadProperty(ref reader, options, PropCollateMatch, null)) + { + continue; + } + + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propScore0.TryReadProperty(ref reader, options, PropScore0, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollateMatch = propCollateMatch.Value, + Contexts = propContexts.Value, + Fields = propFields.Value, + Id = propId.Value, + Index = propIndex.Value, + Routing = propRouting.Value, + Score = propScore.Value, + Score0 = propScore0.Value, + Source = propSource.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggestOption value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollateMatch, value.CollateMatch, null, null); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropScore0, value.Score0, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class CompletionSuggestOptionConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(CompletionSuggestOption<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(CompletionSuggestOptionConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggestOptionConverterFactory))] public sealed partial class CompletionSuggestOption { - [JsonInclude, JsonPropertyName("collate_match")] - public bool? CollateMatch { get; init; } - [JsonInclude, JsonPropertyName("contexts")] - public IReadOnlyDictionary>? Contexts { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string? Id { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string? Index { get; init; } - [JsonInclude, JsonPropertyName("_routing")] - public string? Routing { get; init; } - [JsonInclude, JsonPropertyName("score")] - public double? Score { get; init; } - [JsonInclude, JsonPropertyName("_score")] - public double? Score0 { get; init; } - [JsonInclude, JsonPropertyName("_source")] - [SourceConverter] - public TDocument? Source { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggestOption(string text) + { + Text = text; + } +#if NET7_0_OR_GREATER + public CompletionSuggestOption() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionSuggestOption() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? CollateMatch { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>? Contexts { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public string? Id { get; set; } + public string? Index { get; set; } + public string? Routing { get; set; } + public double? Score { get; set; } + public double? Score0 { get; set; } + public TDocument? Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggester.g.cs index 29e84a56d33..93b8de200ca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionSuggester.g.cs @@ -17,25 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class CompletionSuggesterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzy = System.Text.Json.JsonEncodedText.Encode("fuzzy"); + private static readonly System.Text.Json.JsonEncodedText PropRegex = System.Text.Json.JsonEncodedText.Encode("regex"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSkipDuplicates = System.Text.Json.JsonEncodedText.Encode("skip_duplicates"); + + public override Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue>?> propContexts = default; + LocalJsonValue propField = default; + LocalJsonValue propFuzzy = default; + LocalJsonValue propRegex = default; + LocalJsonValue propSize = default; + LocalJsonValue propSkipDuplicates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFuzzy.TryReadProperty(ref reader, options, PropFuzzy, null)) + { + continue; + } + + if (propRegex.TryReadProperty(ref reader, options, PropRegex, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSkipDuplicates.TryReadProperty(ref reader, options, PropSkipDuplicates, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Contexts = propContexts.Value, + Field = propField.Value, + Fuzzy = propFuzzy.Value, + Regex = propRegex.Value, + Size = propSize.Value, + SkipDuplicates = propSkipDuplicates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFuzzy, value.Fuzzy, null, null); + writer.WriteProperty(options, PropRegex, value.Regex, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSkipDuplicates, value.SkipDuplicates, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterConverter))] public sealed partial class CompletionSuggester { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggester(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public CompletionSuggester() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionSuggester() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The analyzer to analyze the suggest text with. /// Defaults to the search analyzer of the suggest field. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -43,8 +154,7 @@ public sealed partial class CompletionSuggester /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. /// /// - [JsonInclude, JsonPropertyName("contexts")] - public IDictionary>>? Contexts { get; set; } + public System.Collections.Generic.IDictionary>? Contexts { get; set; } /// /// @@ -52,15 +162,17 @@ public sealed partial class CompletionSuggester /// Needs to be set globally or per suggestion. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Enables fuzziness, meaning you can have a typo in your search and still get results back. /// /// - [JsonInclude, JsonPropertyName("fuzzy")] public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? Fuzzy { get; set; } /// @@ -68,7 +180,6 @@ public sealed partial class CompletionSuggester /// A regex query that expresses a prefix as a regular expression. /// /// - [JsonInclude, JsonPropertyName("regex")] public Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? Regex { get; set; } /// @@ -76,7 +187,6 @@ public sealed partial class CompletionSuggester /// The maximum corrections to be returned per suggest text token. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -84,31 +194,27 @@ public sealed partial class CompletionSuggester /// Whether duplicate suggestions should be filtered out. /// /// - [JsonInclude, JsonPropertyName("skip_duplicates")] public bool? SkipDuplicates { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(CompletionSuggester completionSuggester) => Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester.Completion(completionSuggester); } -public sealed partial class CompletionSuggesterDescriptor : SerializableDescriptor> +public readonly partial struct CompletionSuggesterDescriptor { - internal CompletionSuggesterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester Instance { get; init; } - public CompletionSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private IDictionary>>? ContextsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? FuzzyValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor FuzzyDescriptor { get; set; } - private Action FuzzyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? RegexValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor RegexDescriptor { get; set; } - private Action RegexDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private bool? SkipDuplicatesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggesterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor descriptor) => descriptor.Instance; /// /// @@ -116,10 +222,10 @@ public CompletionSuggesterDescriptor() : base() /// Defaults to the search analyzer of the suggest field. /// /// - public CompletionSuggesterDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -127,22 +233,86 @@ public CompletionSuggesterDescriptor Analyzer(string? analyzer) /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. /// /// - public CompletionSuggesterDescriptor Contexts(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts(System.Collections.Generic.IDictionary>? value) { - ContextsValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Contexts = value; + return this; } /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. /// /// - public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts() { - FieldValue = field; - return Self; + Instance.Contexts = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext.Build(null); + return this; + } + + /// + /// + /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts(System.Action>? action) + { + Instance.Contexts = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, params Elastic.Clients.Elasticsearch.Core.Search.CompletionContext[] values) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, params Elastic.Clients.Elasticsearch.Core.Search.CompletionContext[] values) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor.Build(action)); + } + + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, items); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor.Build(action)); + } + + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, items); + return this; } /// @@ -151,10 +321,10 @@ public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsea /// Needs to be set globally or per suggestion. /// /// - public CompletionSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -163,10 +333,10 @@ public CompletionSuggesterDescriptor Field(Expression /// - public CompletionSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -174,28 +344,32 @@ public CompletionSuggesterDescriptor Field(Expression /// - public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? fuzzy) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? value) { - FuzzyDescriptor = null; - FuzzyDescriptorAction = null; - FuzzyValue = fuzzy; - return Self; + Instance.Fuzzy = value; + return this; } - public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor descriptor) + /// + /// + /// Enables fuzziness, meaning you can have a typo in your search and still get results back. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy() { - FuzzyValue = null; - FuzzyDescriptorAction = null; - FuzzyDescriptor = descriptor; - return Self; + Instance.Fuzzy = Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor.Build(null); + return this; } - public CompletionSuggesterDescriptor Fuzzy(Action configure) + /// + /// + /// Enables fuzziness, meaning you can have a typo in your search and still get results back. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy(System.Action? action) { - FuzzyValue = null; - FuzzyDescriptor = null; - FuzzyDescriptorAction = configure; - return Self; + Instance.Fuzzy = Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor.Build(action); + return this; } /// @@ -203,28 +377,32 @@ public CompletionSuggesterDescriptor Fuzzy(Action /// - public CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? regex) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? value) { - RegexDescriptor = null; - RegexDescriptorAction = null; - RegexValue = regex; - return Self; + Instance.Regex = value; + return this; } - public CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor descriptor) + /// + /// + /// A regex query that expresses a prefix as a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex() { - RegexValue = null; - RegexDescriptorAction = null; - RegexDescriptor = descriptor; - return Self; + Instance.Regex = Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor.Build(null); + return this; } - public CompletionSuggesterDescriptor Regex(Action configure) + /// + /// + /// A regex query that expresses a prefix as a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex(System.Action? action) { - RegexValue = null; - RegexDescriptor = null; - RegexDescriptorAction = configure; - return Self; + Instance.Regex = Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor.Build(action); + return this; } /// @@ -232,10 +410,10 @@ public CompletionSuggesterDescriptor Regex(Action /// - public CompletionSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -243,96 +421,39 @@ public CompletionSuggesterDescriptor Size(int? size) /// Whether duplicate suggestions should be filtered out. /// /// - public CompletionSuggesterDescriptor SkipDuplicates(bool? skipDuplicates = true) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor SkipDuplicates(bool? value = true) { - SkipDuplicatesValue = skipDuplicates; - return Self; + Instance.SkipDuplicates = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (ContextsValue is not null) - { - writer.WritePropertyName("contexts"); - JsonSerializer.Serialize(writer, ContextsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FuzzyDescriptor is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, FuzzyDescriptor, options); - } - else if (FuzzyDescriptorAction is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor(FuzzyDescriptorAction), options); - } - else if (FuzzyValue is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, FuzzyValue, options); - } - - if (RegexDescriptor is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, RegexDescriptor, options); - } - else if (RegexDescriptorAction is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor(RegexDescriptorAction), options); - } - else if (RegexValue is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, RegexValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SkipDuplicatesValue.HasValue) - { - writer.WritePropertyName("skip_duplicates"); - writer.WriteBooleanValue(SkipDuplicatesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CompletionSuggesterDescriptor : SerializableDescriptor +public readonly partial struct CompletionSuggesterDescriptor { - internal CompletionSuggesterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester instance) + { + Instance = instance; + } - public CompletionSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionSuggesterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private IDictionary>>? ContextsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? FuzzyValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor FuzzyDescriptor { get; set; } - private Action FuzzyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? RegexValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor RegexDescriptor { get; set; } - private Action RegexDescriptorAction { get; set; } - private int? SizeValue { get; set; } - private bool? SkipDuplicatesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor descriptor) => descriptor.Instance; /// /// @@ -340,10 +461,10 @@ public CompletionSuggesterDescriptor() : base() /// Defaults to the search analyzer of the suggest field. /// /// - public CompletionSuggesterDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -351,22 +472,97 @@ public CompletionSuggesterDescriptor Analyzer(string? analyzer) /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. /// /// - public CompletionSuggesterDescriptor Contexts(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts(System.Collections.Generic.IDictionary>? value) { - ContextsValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Contexts = value; + return this; } /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. /// /// - public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts() { - FieldValue = field; - return Self; + Instance.Contexts = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext.Build(null); + return this; + } + + /// + /// + /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts(System.Action? action) + { + Instance.Contexts = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext.Build(action); + return this; + } + + /// + /// + /// A value, geo point object, or a geo hash string to filter or boost the suggestion on. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Contexts(System.Action>? action) + { + Instance.Contexts = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldCollectionOfCompletionContext.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, params Elastic.Clients.Elasticsearch.Core.Search.CompletionContext[] values) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, params Elastic.Clients.Elasticsearch.Core.Search.CompletionContext[] values) + { + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(Elastic.Clients.Elasticsearch.Field key, params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor.Build(action)); + } + + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, items); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor AddContext(System.Linq.Expressions.Expression> key, params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.CompletionContextDescriptor.Build(action)); + } + + Instance.Contexts ??= new System.Collections.Generic.Dictionary>(); + Instance.Contexts.Add(key, items); + return this; } /// @@ -375,10 +571,10 @@ public CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// Needs to be set globally or per suggestion. /// /// - public CompletionSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -387,10 +583,10 @@ public CompletionSuggesterDescriptor Field(Expression /// - public CompletionSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -398,28 +594,32 @@ public CompletionSuggesterDescriptor Field(Expression /// - public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? fuzzy) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness? value) { - FuzzyDescriptor = null; - FuzzyDescriptorAction = null; - FuzzyValue = fuzzy; - return Self; + Instance.Fuzzy = value; + return this; } - public CompletionSuggesterDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor descriptor) + /// + /// + /// Enables fuzziness, meaning you can have a typo in your search and still get results back. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy() { - FuzzyValue = null; - FuzzyDescriptorAction = null; - FuzzyDescriptor = descriptor; - return Self; + Instance.Fuzzy = Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor.Build(null); + return this; } - public CompletionSuggesterDescriptor Fuzzy(Action configure) + /// + /// + /// Enables fuzziness, meaning you can have a typo in your search and still get results back. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Fuzzy(System.Action? action) { - FuzzyValue = null; - FuzzyDescriptor = null; - FuzzyDescriptorAction = configure; - return Self; + Instance.Fuzzy = Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor.Build(action); + return this; } /// @@ -427,28 +627,32 @@ public CompletionSuggesterDescriptor Fuzzy(Action /// - public CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? regex) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions? value) { - RegexDescriptor = null; - RegexDescriptorAction = null; - RegexValue = regex; - return Self; + Instance.Regex = value; + return this; } - public CompletionSuggesterDescriptor Regex(Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor descriptor) + /// + /// + /// A regex query that expresses a prefix as a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex() { - RegexValue = null; - RegexDescriptorAction = null; - RegexDescriptor = descriptor; - return Self; + Instance.Regex = Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor.Build(null); + return this; } - public CompletionSuggesterDescriptor Regex(Action configure) + /// + /// + /// A regex query that expresses a prefix as a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Regex(System.Action? action) { - RegexValue = null; - RegexDescriptor = null; - RegexDescriptorAction = configure; - return Self; + Instance.Regex = Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor.Build(action); + return this; } /// @@ -456,10 +660,10 @@ public CompletionSuggesterDescriptor Regex(Action /// - public CompletionSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -467,73 +671,17 @@ public CompletionSuggesterDescriptor Size(int? size) /// Whether duplicate suggestions should be filtered out. /// /// - public CompletionSuggesterDescriptor SkipDuplicates(bool? skipDuplicates = true) + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor SkipDuplicates(bool? value = true) { - SkipDuplicatesValue = skipDuplicates; - return Self; + Instance.SkipDuplicates = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (ContextsValue is not null) - { - writer.WritePropertyName("contexts"); - JsonSerializer.Serialize(writer, ContextsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FuzzyDescriptor is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, FuzzyDescriptor, options); - } - else if (FuzzyDescriptorAction is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor(FuzzyDescriptorAction), options); - } - else if (FuzzyValue is not null) - { - writer.WritePropertyName("fuzzy"); - JsonSerializer.Serialize(writer, FuzzyValue, options); - } - - if (RegexDescriptor is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, RegexDescriptor, options); - } - else if (RegexDescriptorAction is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor(RegexDescriptorAction), options); - } - else if (RegexValue is not null) - { - writer.WritePropertyName("regex"); - JsonSerializer.Serialize(writer, RegexValue, options); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SkipDuplicatesValue.HasValue) - { - writer.WritePropertyName("skip_duplicates"); - writer.WriteBooleanValue(SkipDuplicatesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsKnnProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsKnnProfile.g.cs index 17aa732b4ba..1a20530b998 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsKnnProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsKnnProfile.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class DfsKnnProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollector = System.Text.Json.JsonEncodedText.Encode("collector"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRewriteTime = System.Text.Json.JsonEncodedText.Encode("rewrite_time"); + private static readonly System.Text.Json.JsonEncodedText PropVectorOperationsCount = System.Text.Json.JsonEncodedText.Encode("vector_operations_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.DfsKnnProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCollector = default; + LocalJsonValue> propQuery = default; + LocalJsonValue propRewriteTime = default; + LocalJsonValue propVectorOperationsCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollector.TryReadProperty(ref reader, options, PropCollector, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRewriteTime.TryReadProperty(ref reader, options, PropRewriteTime, null)) + { + continue; + } + + if (propVectorOperationsCount.TryReadProperty(ref reader, options, PropVectorOperationsCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.DfsKnnProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collector = propCollector.Value, + Query = propQuery.Value, + RewriteTime = propRewriteTime.Value, + VectorOperationsCount = propVectorOperationsCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.DfsKnnProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollector, value.Collector, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRewriteTime, value.RewriteTime, null, null); + writer.WriteProperty(options, PropVectorOperationsCount, value.VectorOperationsCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.DfsKnnProfileConverter))] public sealed partial class DfsKnnProfile { - [JsonInclude, JsonPropertyName("collector")] - public IReadOnlyCollection Collector { get; init; } - [JsonInclude, JsonPropertyName("query")] - public IReadOnlyCollection Query { get; init; } - [JsonInclude, JsonPropertyName("rewrite_time")] - public long RewriteTime { get; init; } - [JsonInclude, JsonPropertyName("vector_operations_count")] - public long? VectorOperationsCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DfsKnnProfile(System.Collections.Generic.IReadOnlyCollection collector, System.Collections.Generic.IReadOnlyCollection query, long rewriteTime) + { + Collector = collector; + Query = query; + RewriteTime = rewriteTime; + } +#if NET7_0_OR_GREATER + public DfsKnnProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DfsKnnProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DfsKnnProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Collector { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RewriteTime { get; set; } + public long? VectorOperationsCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsProfile.g.cs index 6daaadcb967..116885551ef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsProfile.g.cs @@ -17,20 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class DfsProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText PropStatistics = System.Text.Json.JsonEncodedText.Encode("statistics"); + + public override Elastic.Clients.Elasticsearch.Core.Search.DfsProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propKnn = default; + LocalJsonValue propStatistics = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propKnn.TryReadProperty(ref reader, options, PropKnn, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatistics.TryReadProperty(ref reader, options, PropStatistics, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.DfsProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Knn = propKnn.Value, + Statistics = propStatistics.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.DfsProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropKnn, value.Knn, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatistics, value.Statistics, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.DfsProfileConverter))] public sealed partial class DfsProfile { - [JsonInclude, JsonPropertyName("knn")] - public IReadOnlyCollection? Knn { get; init; } - [JsonInclude, JsonPropertyName("statistics")] - public Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfile? Statistics { get; init; } +#if NET7_0_OR_GREATER + public DfsProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + public DfsProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DfsProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Knn { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfile? Statistics { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsBreakdown.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsBreakdown.g.cs index 2f335c297e1..80243ab2cff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsBreakdown.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsBreakdown.g.cs @@ -17,32 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class DfsStatisticsBreakdownConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollectionStatistics = System.Text.Json.JsonEncodedText.Encode("collection_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropCollectionStatisticsCount = System.Text.Json.JsonEncodedText.Encode("collection_statistics_count"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeight = System.Text.Json.JsonEncodedText.Encode("create_weight"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeightCount = System.Text.Json.JsonEncodedText.Encode("create_weight_count"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropRewriteCount = System.Text.Json.JsonEncodedText.Encode("rewrite_count"); + private static readonly System.Text.Json.JsonEncodedText PropTermStatistics = System.Text.Json.JsonEncodedText.Encode("term_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropTermStatisticsCount = System.Text.Json.JsonEncodedText.Encode("term_statistics_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollectionStatistics = default; + LocalJsonValue propCollectionStatisticsCount = default; + LocalJsonValue propCreateWeight = default; + LocalJsonValue propCreateWeightCount = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propRewriteCount = default; + LocalJsonValue propTermStatistics = default; + LocalJsonValue propTermStatisticsCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollectionStatistics.TryReadProperty(ref reader, options, PropCollectionStatistics, null)) + { + continue; + } + + if (propCollectionStatisticsCount.TryReadProperty(ref reader, options, PropCollectionStatisticsCount, null)) + { + continue; + } + + if (propCreateWeight.TryReadProperty(ref reader, options, PropCreateWeight, null)) + { + continue; + } + + if (propCreateWeightCount.TryReadProperty(ref reader, options, PropCreateWeightCount, null)) + { + continue; + } + + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } + + if (propRewriteCount.TryReadProperty(ref reader, options, PropRewriteCount, null)) + { + continue; + } + + if (propTermStatistics.TryReadProperty(ref reader, options, PropTermStatistics, null)) + { + continue; + } + + if (propTermStatisticsCount.TryReadProperty(ref reader, options, PropTermStatisticsCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollectionStatistics = propCollectionStatistics.Value, + CollectionStatisticsCount = propCollectionStatisticsCount.Value, + CreateWeight = propCreateWeight.Value, + CreateWeightCount = propCreateWeightCount.Value, + Rewrite = propRewrite.Value, + RewriteCount = propRewriteCount.Value, + TermStatistics = propTermStatistics.Value, + TermStatisticsCount = propTermStatisticsCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollectionStatistics, value.CollectionStatistics, null, null); + writer.WriteProperty(options, PropCollectionStatisticsCount, value.CollectionStatisticsCount, null, null); + writer.WriteProperty(options, PropCreateWeight, value.CreateWeight, null, null); + writer.WriteProperty(options, PropCreateWeightCount, value.CreateWeightCount, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropRewriteCount, value.RewriteCount, null, null); + writer.WriteProperty(options, PropTermStatistics, value.TermStatistics, null, null); + writer.WriteProperty(options, PropTermStatisticsCount, value.TermStatisticsCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdownConverter))] public sealed partial class DfsStatisticsBreakdown { - [JsonInclude, JsonPropertyName("collection_statistics")] - public long CollectionStatistics { get; init; } - [JsonInclude, JsonPropertyName("collection_statistics_count")] - public long CollectionStatisticsCount { get; init; } - [JsonInclude, JsonPropertyName("create_weight")] - public long CreateWeight { get; init; } - [JsonInclude, JsonPropertyName("create_weight_count")] - public long CreateWeightCount { get; init; } - [JsonInclude, JsonPropertyName("rewrite")] - public long Rewrite { get; init; } - [JsonInclude, JsonPropertyName("rewrite_count")] - public long RewriteCount { get; init; } - [JsonInclude, JsonPropertyName("term_statistics")] - public long TermStatistics { get; init; } - [JsonInclude, JsonPropertyName("term_statistics_count")] - public long TermStatisticsCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DfsStatisticsBreakdown(long collectionStatistics, long collectionStatisticsCount, long createWeight, long createWeightCount, long rewrite, long rewriteCount, long termStatistics, long termStatisticsCount) + { + CollectionStatistics = collectionStatistics; + CollectionStatisticsCount = collectionStatisticsCount; + CreateWeight = createWeight; + CreateWeightCount = createWeightCount; + Rewrite = rewrite; + RewriteCount = rewriteCount; + TermStatistics = termStatistics; + TermStatisticsCount = termStatisticsCount; + } +#if NET7_0_OR_GREATER + public DfsStatisticsBreakdown() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DfsStatisticsBreakdown() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DfsStatisticsBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long CollectionStatistics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CollectionStatisticsCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeightCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Rewrite { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RewriteCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TermStatistics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TermStatisticsCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsProfile.g.cs index cabdc2faca5..835e157f0b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DfsStatisticsProfile.g.cs @@ -17,30 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class DfsStatisticsProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBreakdown = System.Text.Json.JsonEncodedText.Encode("breakdown"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDebug = System.Text.Json.JsonEncodedText.Encode("debug"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBreakdown = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue?> propDebug = default; + LocalJsonValue propDescription = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInNanos = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBreakdown.TryReadProperty(ref reader, options, PropBreakdown, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDebug.TryReadProperty(ref reader, options, PropDebug, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Breakdown = propBreakdown.Value, + Children = propChildren.Value, + Debug = propDebug.Value, + Description = propDescription.Value, + Time = propTime.Value, + TimeInNanos = propTimeInNanos.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBreakdown, value.Breakdown, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDebug, value.Debug, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsProfileConverter))] public sealed partial class DfsStatisticsProfile { - [JsonInclude, JsonPropertyName("breakdown")] - public Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown Breakdown { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("debug")] - public IReadOnlyDictionary? Debug { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DfsStatisticsProfile(Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown breakdown, string description, System.TimeSpan timeInNanos, string type) + { + Breakdown = breakdown; + Description = description; + TimeInNanos = timeInNanos; + Type = type; + } +#if NET7_0_OR_GREATER + public DfsStatisticsProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DfsStatisticsProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DfsStatisticsProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.DfsStatisticsBreakdown Breakdown { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Debug { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DirectGenerator.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DirectGenerator.g.cs index a6c312dca6d..1ecf5b8fbd4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DirectGenerator.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/DirectGenerator.g.cs @@ -17,26 +17,177 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class DirectGeneratorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEdits = System.Text.Json.JsonEncodedText.Encode("max_edits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInspections = System.Text.Json.JsonEncodedText.Encode("max_inspections"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTermFreq = System.Text.Json.JsonEncodedText.Encode("max_term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocFreq = System.Text.Json.JsonEncodedText.Encode("min_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordLength = System.Text.Json.JsonEncodedText.Encode("min_word_length"); + private static readonly System.Text.Json.JsonEncodedText PropPostFilter = System.Text.Json.JsonEncodedText.Encode("post_filter"); + private static readonly System.Text.Json.JsonEncodedText PropPreFilter = System.Text.Json.JsonEncodedText.Encode("pre_filter"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestMode = System.Text.Json.JsonEncodedText.Encode("suggest_mode"); + + public override Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMaxEdits = default; + LocalJsonValue propMaxInspections = default; + LocalJsonValue propMaxTermFreq = default; + LocalJsonValue propMinDocFreq = default; + LocalJsonValue propMinWordLength = default; + LocalJsonValue propPostFilter = default; + LocalJsonValue propPreFilter = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propSize = default; + LocalJsonValue propSuggestMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMaxEdits.TryReadProperty(ref reader, options, PropMaxEdits, null)) + { + continue; + } + + if (propMaxInspections.TryReadProperty(ref reader, options, PropMaxInspections, null)) + { + continue; + } + + if (propMaxTermFreq.TryReadProperty(ref reader, options, PropMaxTermFreq, null)) + { + continue; + } + + if (propMinDocFreq.TryReadProperty(ref reader, options, PropMinDocFreq, null)) + { + continue; + } + + if (propMinWordLength.TryReadProperty(ref reader, options, PropMinWordLength, null)) + { + continue; + } + + if (propPostFilter.TryReadProperty(ref reader, options, PropPostFilter, null)) + { + continue; + } + + if (propPreFilter.TryReadProperty(ref reader, options, PropPreFilter, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSuggestMode.TryReadProperty(ref reader, options, PropSuggestMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + MaxEdits = propMaxEdits.Value, + MaxInspections = propMaxInspections.Value, + MaxTermFreq = propMaxTermFreq.Value, + MinDocFreq = propMinDocFreq.Value, + MinWordLength = propMinWordLength.Value, + PostFilter = propPostFilter.Value, + PreFilter = propPreFilter.Value, + PrefixLength = propPrefixLength.Value, + Size = propSize.Value, + SuggestMode = propSuggestMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMaxEdits, value.MaxEdits, null, null); + writer.WriteProperty(options, PropMaxInspections, value.MaxInspections, null, null); + writer.WriteProperty(options, PropMaxTermFreq, value.MaxTermFreq, null, null); + writer.WriteProperty(options, PropMinDocFreq, value.MinDocFreq, null, null); + writer.WriteProperty(options, PropMinWordLength, value.MinWordLength, null, null); + writer.WriteProperty(options, PropPostFilter, value.PostFilter, null, null); + writer.WriteProperty(options, PropPreFilter, value.PreFilter, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSuggestMode, value.SuggestMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorConverter))] public sealed partial class DirectGenerator { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DirectGenerator(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public DirectGenerator() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DirectGenerator() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field to fetch the candidate suggestions from. /// Needs to be set globally or per suggestion. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -44,7 +195,6 @@ public sealed partial class DirectGenerator /// Can only be 1 or 2. /// /// - [JsonInclude, JsonPropertyName("max_edits")] public int? MaxEdits { get; set; } /// @@ -53,7 +203,6 @@ public sealed partial class DirectGenerator /// Can improve accuracy at the cost of performance. /// /// - [JsonInclude, JsonPropertyName("max_inspections")] public float? MaxInspections { get; set; } /// @@ -64,7 +213,6 @@ public sealed partial class DirectGenerator /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - [JsonInclude, JsonPropertyName("max_term_freq")] public float? MaxTermFreq { get; set; } /// @@ -75,7 +223,6 @@ public sealed partial class DirectGenerator /// If a value higher than 1 is specified, the number cannot be fractional. /// /// - [JsonInclude, JsonPropertyName("min_doc_freq")] public float? MinDocFreq { get; set; } /// @@ -83,7 +230,6 @@ public sealed partial class DirectGenerator /// The minimum length a suggest text term must have in order to be included. /// /// - [JsonInclude, JsonPropertyName("min_word_length")] public int? MinWordLength { get; set; } /// @@ -91,7 +237,6 @@ public sealed partial class DirectGenerator /// A filter (analyzer) that is applied to each of the generated tokens before they are passed to the actual phrase scorer. /// /// - [JsonInclude, JsonPropertyName("post_filter")] public string? PostFilter { get; set; } /// @@ -100,7 +245,6 @@ public sealed partial class DirectGenerator /// This filter is applied to the original token before candidates are generated. /// /// - [JsonInclude, JsonPropertyName("pre_filter")] public string? PreFilter { get; set; } /// @@ -109,7 +253,6 @@ public sealed partial class DirectGenerator /// Increasing this number improves spellcheck performance. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } /// @@ -117,7 +260,6 @@ public sealed partial class DirectGenerator /// The maximum corrections to be returned per suggest text token. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -125,52 +267,38 @@ public sealed partial class DirectGenerator /// Controls what suggestions are included on the suggestions generated on each shard. /// /// - [JsonInclude, JsonPropertyName("suggest_mode")] public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get; set; } } -public sealed partial class DirectGeneratorDescriptor : SerializableDescriptor> +public readonly partial struct DirectGeneratorDescriptor { - internal DirectGeneratorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator Instance { get; init; } - public DirectGeneratorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DirectGeneratorDescriptor(Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxEditsValue { get; set; } - private float? MaxInspectionsValue { get; set; } - private float? MaxTermFreqValue { get; set; } - private float? MinDocFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private string? PostFilterValue { get; set; } - private string? PreFilterValue { get; set; } - private int? PrefixLengthValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } - - /// - /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. - /// - /// - public DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DirectGeneratorDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator instance) => new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor descriptor) => descriptor.Instance; + /// /// /// The field to fetch the candidate suggestions from. /// Needs to be set globally or per suggestion. /// /// - public DirectGeneratorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -179,10 +307,10 @@ public DirectGeneratorDescriptor Field(Expression /// - public DirectGeneratorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -191,10 +319,10 @@ public DirectGeneratorDescriptor Field(Expression1 or 2. /// /// - public DirectGeneratorDescriptor MaxEdits(int? maxEdits) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxEdits(int? value) { - MaxEditsValue = maxEdits; - return Self; + Instance.MaxEdits = value; + return this; } /// @@ -203,10 +331,10 @@ public DirectGeneratorDescriptor MaxEdits(int? maxEdits) /// Can improve accuracy at the cost of performance. /// /// - public DirectGeneratorDescriptor MaxInspections(float? maxInspections) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxInspections(float? value) { - MaxInspectionsValue = maxInspections; - return Self; + Instance.MaxInspections = value; + return this; } /// @@ -217,10 +345,10 @@ public DirectGeneratorDescriptor MaxInspections(float? maxInspections /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxTermFreq(float? value) { - MaxTermFreqValue = maxTermFreq; - return Self; + Instance.MaxTermFreq = value; + return this; } /// @@ -231,10 +359,10 @@ public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) /// If a value higher than 1 is specified, the number cannot be fractional. /// /// - public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MinDocFreq(float? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -242,10 +370,10 @@ public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) /// The minimum length a suggest text term must have in order to be included. /// /// - public DirectGeneratorDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } /// @@ -253,10 +381,10 @@ public DirectGeneratorDescriptor MinWordLength(int? minWordLength) /// A filter (analyzer) that is applied to each of the generated tokens before they are passed to the actual phrase scorer. /// /// - public DirectGeneratorDescriptor PostFilter(string? postFilter) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PostFilter(string? value) { - PostFilterValue = postFilter; - return Self; + Instance.PostFilter = value; + return this; } /// @@ -265,10 +393,10 @@ public DirectGeneratorDescriptor PostFilter(string? postFilter) /// This filter is applied to the original token before candidates are generated. /// /// - public DirectGeneratorDescriptor PreFilter(string? preFilter) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PreFilter(string? value) { - PreFilterValue = preFilter; - return Self; + Instance.PreFilter = value; + return this; } /// @@ -277,10 +405,10 @@ public DirectGeneratorDescriptor PreFilter(string? preFilter) /// Increasing this number improves spellcheck performance. /// /// - public DirectGeneratorDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -288,10 +416,10 @@ public DirectGeneratorDescriptor PrefixLength(int? prefixLength) /// The maximum corrections to be returned per suggest text token. /// /// - public DirectGeneratorDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -299,123 +427,50 @@ public DirectGeneratorDescriptor Size(int? size) /// Controls what suggestions are included on the suggestions generated on each shard. /// /// - public DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - SuggestModeValue = suggestMode; - return Self; + Instance.SuggestMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MaxEditsValue.HasValue) - { - writer.WritePropertyName("max_edits"); - writer.WriteNumberValue(MaxEditsValue.Value); - } - - if (MaxInspectionsValue.HasValue) - { - writer.WritePropertyName("max_inspections"); - writer.WriteNumberValue(MaxInspectionsValue.Value); - } - - if (MaxTermFreqValue.HasValue) - { - writer.WritePropertyName("max_term_freq"); - writer.WriteNumberValue(MaxTermFreqValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - if (!string.IsNullOrEmpty(PostFilterValue)) - { - writer.WritePropertyName("post_filter"); - writer.WriteStringValue(PostFilterValue); - } - - if (!string.IsNullOrEmpty(PreFilterValue)) - { - writer.WritePropertyName("pre_filter"); - writer.WriteStringValue(PreFilterValue); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SuggestModeValue is not null) - { - writer.WritePropertyName("suggest_mode"); - JsonSerializer.Serialize(writer, SuggestModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DirectGeneratorDescriptor : SerializableDescriptor +public readonly partial struct DirectGeneratorDescriptor { - internal DirectGeneratorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator Instance { get; init; } - public DirectGeneratorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DirectGeneratorDescriptor(Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxEditsValue { get; set; } - private float? MaxInspectionsValue { get; set; } - private float? MaxTermFreqValue { get; set; } - private float? MinDocFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private string? PostFilterValue { get; set; } - private string? PreFilterValue { get; set; } - private int? PrefixLengthValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } - - /// - /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. - /// - /// - public DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DirectGeneratorDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator instance) => new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor descriptor) => descriptor.Instance; + /// /// /// The field to fetch the candidate suggestions from. /// Needs to be set globally or per suggestion. /// /// - public DirectGeneratorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -424,10 +479,10 @@ public DirectGeneratorDescriptor Field(Expression /// - public DirectGeneratorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -436,10 +491,10 @@ public DirectGeneratorDescriptor Field(Expression1 or 2. /// /// - public DirectGeneratorDescriptor MaxEdits(int? maxEdits) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxEdits(int? value) { - MaxEditsValue = maxEdits; - return Self; + Instance.MaxEdits = value; + return this; } /// @@ -448,10 +503,10 @@ public DirectGeneratorDescriptor MaxEdits(int? maxEdits) /// Can improve accuracy at the cost of performance. /// /// - public DirectGeneratorDescriptor MaxInspections(float? maxInspections) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxInspections(float? value) { - MaxInspectionsValue = maxInspections; - return Self; + Instance.MaxInspections = value; + return this; } /// @@ -462,10 +517,10 @@ public DirectGeneratorDescriptor MaxInspections(float? maxInspections) /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MaxTermFreq(float? value) { - MaxTermFreqValue = maxTermFreq; - return Self; + Instance.MaxTermFreq = value; + return this; } /// @@ -476,10 +531,10 @@ public DirectGeneratorDescriptor MaxTermFreq(float? maxTermFreq) /// If a value higher than 1 is specified, the number cannot be fractional. /// /// - public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MinDocFreq(float? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -487,10 +542,10 @@ public DirectGeneratorDescriptor MinDocFreq(float? minDocFreq) /// The minimum length a suggest text term must have in order to be included. /// /// - public DirectGeneratorDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } /// @@ -498,10 +553,10 @@ public DirectGeneratorDescriptor MinWordLength(int? minWordLength) /// A filter (analyzer) that is applied to each of the generated tokens before they are passed to the actual phrase scorer. /// /// - public DirectGeneratorDescriptor PostFilter(string? postFilter) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PostFilter(string? value) { - PostFilterValue = postFilter; - return Self; + Instance.PostFilter = value; + return this; } /// @@ -510,10 +565,10 @@ public DirectGeneratorDescriptor PostFilter(string? postFilter) /// This filter is applied to the original token before candidates are generated. /// /// - public DirectGeneratorDescriptor PreFilter(string? preFilter) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PreFilter(string? value) { - PreFilterValue = preFilter; - return Self; + Instance.PreFilter = value; + return this; } /// @@ -522,10 +577,10 @@ public DirectGeneratorDescriptor PreFilter(string? preFilter) /// Increasing this number improves spellcheck performance. /// /// - public DirectGeneratorDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -533,10 +588,10 @@ public DirectGeneratorDescriptor PrefixLength(int? prefixLength) /// The maximum corrections to be returned per suggest text token. /// /// - public DirectGeneratorDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -544,77 +599,17 @@ public DirectGeneratorDescriptor Size(int? size) /// Controls what suggestions are included on the suggestions generated on each shard. /// /// - public DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + public Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - SuggestModeValue = suggestMode; - return Self; + Instance.SuggestMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MaxEditsValue.HasValue) - { - writer.WritePropertyName("max_edits"); - writer.WriteNumberValue(MaxEditsValue.Value); - } - - if (MaxInspectionsValue.HasValue) - { - writer.WritePropertyName("max_inspections"); - writer.WriteNumberValue(MaxInspectionsValue.Value); - } - - if (MaxTermFreqValue.HasValue) - { - writer.WritePropertyName("max_term_freq"); - writer.WriteNumberValue(MaxTermFreqValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - if (!string.IsNullOrEmpty(PostFilterValue)) - { - writer.WritePropertyName("post_filter"); - writer.WriteStringValue(PostFilterValue); - } - - if (!string.IsNullOrEmpty(PreFilterValue)) - { - writer.WritePropertyName("pre_filter"); - writer.WriteStringValue(PreFilterValue); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SuggestModeValue is not null) - { - writer.WritePropertyName("suggest_mode"); - JsonSerializer.Serialize(writer, SuggestModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfile.g.cs index 2203d2c987f..6d304ec7d7f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfile.g.cs @@ -17,28 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class FetchProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBreakdown = System.Text.Json.JsonEncodedText.Encode("breakdown"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDebug = System.Text.Json.JsonEncodedText.Encode("debug"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.FetchProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBreakdown = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue propDebug = default; + LocalJsonValue propDescription = default; + LocalJsonValue propTimeInNanos = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBreakdown.TryReadProperty(ref reader, options, PropBreakdown, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDebug.TryReadProperty(ref reader, options, PropDebug, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.FetchProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Breakdown = propBreakdown.Value, + Children = propChildren.Value, + Debug = propDebug.Value, + Description = propDescription.Value, + TimeInNanos = propTimeInNanos.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.FetchProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBreakdown, value.Breakdown, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDebug, value.Debug, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.FetchProfileConverter))] public sealed partial class FetchProfile { - [JsonInclude, JsonPropertyName("breakdown")] - public Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown Breakdown { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("debug")] - public Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebug? Debug { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FetchProfile(Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown breakdown, string description, System.TimeSpan timeInNanos, string type) + { + Breakdown = breakdown; + Description = description; + TimeInNanos = timeInNanos; + Type = type; + } +#if NET7_0_OR_GREATER + public FetchProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FetchProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FetchProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown Breakdown { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebug? Debug { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileBreakdown.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileBreakdown.g.cs index b22ce9e3dee..428d1e51bea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileBreakdown.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileBreakdown.g.cs @@ -17,32 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class FetchProfileBreakdownConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLoadSource = System.Text.Json.JsonEncodedText.Encode("load_source"); + private static readonly System.Text.Json.JsonEncodedText PropLoadSourceCount = System.Text.Json.JsonEncodedText.Encode("load_source_count"); + private static readonly System.Text.Json.JsonEncodedText PropLoadStoredFields = System.Text.Json.JsonEncodedText.Encode("load_stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropLoadStoredFieldsCount = System.Text.Json.JsonEncodedText.Encode("load_stored_fields_count"); + private static readonly System.Text.Json.JsonEncodedText PropNextReader = System.Text.Json.JsonEncodedText.Encode("next_reader"); + private static readonly System.Text.Json.JsonEncodedText PropNextReaderCount = System.Text.Json.JsonEncodedText.Encode("next_reader_count"); + private static readonly System.Text.Json.JsonEncodedText PropProcess = System.Text.Json.JsonEncodedText.Encode("process"); + private static readonly System.Text.Json.JsonEncodedText PropProcessCount = System.Text.Json.JsonEncodedText.Encode("process_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLoadSource = default; + LocalJsonValue propLoadSourceCount = default; + LocalJsonValue propLoadStoredFields = default; + LocalJsonValue propLoadStoredFieldsCount = default; + LocalJsonValue propNextReader = default; + LocalJsonValue propNextReaderCount = default; + LocalJsonValue propProcess = default; + LocalJsonValue propProcessCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLoadSource.TryReadProperty(ref reader, options, PropLoadSource, null)) + { + continue; + } + + if (propLoadSourceCount.TryReadProperty(ref reader, options, PropLoadSourceCount, null)) + { + continue; + } + + if (propLoadStoredFields.TryReadProperty(ref reader, options, PropLoadStoredFields, null)) + { + continue; + } + + if (propLoadStoredFieldsCount.TryReadProperty(ref reader, options, PropLoadStoredFieldsCount, null)) + { + continue; + } + + if (propNextReader.TryReadProperty(ref reader, options, PropNextReader, null)) + { + continue; + } + + if (propNextReaderCount.TryReadProperty(ref reader, options, PropNextReaderCount, null)) + { + continue; + } + + if (propProcess.TryReadProperty(ref reader, options, PropProcess, null)) + { + continue; + } + + if (propProcessCount.TryReadProperty(ref reader, options, PropProcessCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + LoadSource = propLoadSource.Value, + LoadSourceCount = propLoadSourceCount.Value, + LoadStoredFields = propLoadStoredFields.Value, + LoadStoredFieldsCount = propLoadStoredFieldsCount.Value, + NextReader = propNextReader.Value, + NextReaderCount = propNextReaderCount.Value, + Process = propProcess.Value, + ProcessCount = propProcessCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdown value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLoadSource, value.LoadSource, null, null); + writer.WriteProperty(options, PropLoadSourceCount, value.LoadSourceCount, null, null); + writer.WriteProperty(options, PropLoadStoredFields, value.LoadStoredFields, null, null); + writer.WriteProperty(options, PropLoadStoredFieldsCount, value.LoadStoredFieldsCount, null, null); + writer.WriteProperty(options, PropNextReader, value.NextReader, null, null); + writer.WriteProperty(options, PropNextReaderCount, value.NextReaderCount, null, null); + writer.WriteProperty(options, PropProcess, value.Process, null, null); + writer.WriteProperty(options, PropProcessCount, value.ProcessCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.FetchProfileBreakdownConverter))] public sealed partial class FetchProfileBreakdown { - [JsonInclude, JsonPropertyName("load_source")] - public int? LoadSource { get; init; } - [JsonInclude, JsonPropertyName("load_source_count")] - public int? LoadSourceCount { get; init; } - [JsonInclude, JsonPropertyName("load_stored_fields")] - public int? LoadStoredFields { get; init; } - [JsonInclude, JsonPropertyName("load_stored_fields_count")] - public int? LoadStoredFieldsCount { get; init; } - [JsonInclude, JsonPropertyName("next_reader")] - public int? NextReader { get; init; } - [JsonInclude, JsonPropertyName("next_reader_count")] - public int? NextReaderCount { get; init; } - [JsonInclude, JsonPropertyName("process")] - public int? Process { get; init; } - [JsonInclude, JsonPropertyName("process_count")] - public int? ProcessCount { get; init; } +#if NET7_0_OR_GREATER + public FetchProfileBreakdown() + { + } +#endif +#if !NET7_0_OR_GREATER + public FetchProfileBreakdown() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FetchProfileBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? LoadSource { get; set; } + public int? LoadSourceCount { get; set; } + public int? LoadStoredFields { get; set; } + public int? LoadStoredFieldsCount { get; set; } + public int? NextReader { get; set; } + public int? NextReaderCount { get; set; } + public int? Process { get; set; } + public int? ProcessCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileDebug.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileDebug.g.cs index e16c777e3ac..f0ca1413c2f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileDebug.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FetchProfileDebug.g.cs @@ -17,20 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class FetchProfileDebugConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFastPath = System.Text.Json.JsonEncodedText.Encode("fast_path"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + + public override Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebug Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFastPath = default; + LocalJsonValue?> propStoredFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFastPath.TryReadProperty(ref reader, options, PropFastPath, null)) + { + continue; + } + + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebug(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FastPath = propFastPath.Value, + StoredFields = propStoredFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebug value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFastPath, value.FastPath, null, null); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.FetchProfileDebugConverter))] public sealed partial class FetchProfileDebug { - [JsonInclude, JsonPropertyName("fast_path")] - public int? FastPath { get; init; } - [JsonInclude, JsonPropertyName("stored_fields")] - public IReadOnlyCollection? StoredFields { get; init; } +#if NET7_0_OR_GREATER + public FetchProfileDebug() + { + } +#endif +#if !NET7_0_OR_GREATER + public FetchProfileDebug() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FetchProfileDebug(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? FastPath { get; set; } + public System.Collections.Generic.IReadOnlyCollection? StoredFields { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldCollapse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldCollapse.g.cs index 06fbcd812b5..11d522b579f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldCollapse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldCollapse.g.cs @@ -17,19 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class FieldCollapseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxConcurrentGroupSearches = System.Text.Json.JsonEncodedText.Encode("max_concurrent_group_searches"); + + public override Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollapse = default; + LocalJsonValue propField = default; + LocalJsonValue?> propInnerHits = default; + LocalJsonValue propMaxConcurrentGroupSearches = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMaxConcurrentGroupSearches.TryReadProperty(ref reader, options, PropMaxConcurrentGroupSearches, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collapse = propCollapse.Value, + Field = propField.Value, + InnerHits = propInnerHits.Value, + MaxConcurrentGroupSearches = propMaxConcurrentGroupSearches.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxConcurrentGroupSearches, value.MaxConcurrentGroupSearches, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseConverter))] public sealed partial class FieldCollapse { - [JsonInclude, JsonPropertyName("collapse")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCollapse(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public FieldCollapse() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldCollapse() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } /// @@ -37,67 +121,56 @@ public sealed partial class FieldCollapse /// The field to collapse the result set on /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The number of inner hits and their sort order /// /// - [JsonInclude, JsonPropertyName("inner_hits")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.InnerHits))] - public ICollection? InnerHits { get; set; } + public System.Collections.Generic.ICollection? InnerHits { get; set; } /// /// /// The number of concurrent requests allowed to retrieve the inner_hits per group /// /// - [JsonInclude, JsonPropertyName("max_concurrent_group_searches")] public int? MaxConcurrentGroupSearches { get; set; } } -public sealed partial class FieldCollapseDescriptor : SerializableDescriptor> +public readonly partial struct FieldCollapseDescriptor { - internal FieldCollapseDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse Instance { get; init; } - public FieldCollapseDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCollapseDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action> InnerHitsDescriptorAction { get; set; } - private Action>[] InnerHitsDescriptorActions { get; set; } - private int? MaxConcurrentGroupSearchesValue { get; set; } - - public FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCollapseDescriptor() { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse instance) => new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Collapse = value; + return this; } - public FieldCollapseDescriptor Collapse(Action> configure) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// @@ -105,10 +178,10 @@ public FieldCollapseDescriptor Collapse(Action /// - public FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -116,21 +189,21 @@ public FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to collapse the result set on /// /// - public FieldCollapseDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to collapse the result set on + /// The number of inner hits and their sort order /// /// - public FieldCollapseDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.InnerHits = value; + return this; } /// @@ -138,40 +211,27 @@ public FieldCollapseDescriptor Field(Expression /// - public FieldCollapseDescriptor InnerHits(ICollection? innerHits) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(params Elastic.Clients.Elasticsearch.Core.Search.InnerHits[] values) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = [.. values]; + return this; } - public FieldCollapseDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) - { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = null; - InnerHitsDescriptor = descriptor; - return Self; - } - - public FieldCollapseDescriptor InnerHits(Action> configure) + /// + /// + /// The number of inner hits and their sort order + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(params System.Action>?[] actions) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorActions = null; - InnerHitsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action)); + } - public FieldCollapseDescriptor InnerHits(params Action>[] configure) - { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = configure; - return Self; + Instance.InnerHits = items; + return this; } /// @@ -179,112 +239,56 @@ public FieldCollapseDescriptor InnerHits(params Action /// - public FieldCollapseDescriptor MaxConcurrentGroupSearches(int? maxConcurrentGroupSearches) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor MaxConcurrentGroupSearches(int? value) { - MaxConcurrentGroupSearchesValue = maxConcurrentGroupSearches; - return Self; + Instance.MaxConcurrentGroupSearches = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse Build(System.Action> action) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsDescriptorActions is not null) - { - writer.WritePropertyName("inner_hits"); - if (InnerHitsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in InnerHitsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(action), options); - } - - if (InnerHitsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - SingleOrManySerializationHelper.Serialize(InnerHitsValue, writer, options); - } - - if (MaxConcurrentGroupSearchesValue.HasValue) - { - writer.WritePropertyName("max_concurrent_group_searches"); - writer.WriteNumberValue(MaxConcurrentGroupSearchesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldCollapseDescriptor : SerializableDescriptor +public readonly partial struct FieldCollapseDescriptor { - internal FieldCollapseDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse Instance { get; init; } - public FieldCollapseDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCollapseDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action InnerHitsDescriptorAction { get; set; } - private Action[] InnerHitsDescriptorActions { get; set; } - private int? MaxConcurrentGroupSearchesValue { get; set; } - - public FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldCollapseDescriptor() { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse instance) => new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) + { + Instance.Collapse = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Collapse(System.Action action) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } - public FieldCollapseDescriptor Collapse(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// @@ -292,10 +296,10 @@ public FieldCollapseDescriptor Collapse(Action /// - public FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -303,21 +307,21 @@ public FieldCollapseDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to collapse the result set on /// /// - public FieldCollapseDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to collapse the result set on + /// The number of inner hits and their sort order /// /// - public FieldCollapseDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.InnerHits = value; + return this; } /// @@ -325,40 +329,44 @@ public FieldCollapseDescriptor Field(Expression /// - public FieldCollapseDescriptor InnerHits(ICollection? innerHits) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(params Elastic.Clients.Elasticsearch.Core.Search.InnerHits[] values) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = [.. values]; + return this; } - public FieldCollapseDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// The number of inner hits and their sort order + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(params System.Action?[] actions) { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = null; - InnerHitsDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action)); + } - public FieldCollapseDescriptor InnerHits(Action configure) - { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorActions = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = items; + return this; } - public FieldCollapseDescriptor InnerHits(params Action[] configure) + /// + /// + /// The number of inner hits and their sort order + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor InnerHits(params System.Action>?[] actions) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action)); + } + + Instance.InnerHits = items; + return this; } /// @@ -366,68 +374,17 @@ public FieldCollapseDescriptor InnerHits(params Action /// - public FieldCollapseDescriptor MaxConcurrentGroupSearches(int? maxConcurrentGroupSearches) + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor MaxConcurrentGroupSearches(int? value) { - MaxConcurrentGroupSearchesValue = maxConcurrentGroupSearches; - return Self; + Instance.MaxConcurrentGroupSearches = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse Build(System.Action action) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsDescriptorActions is not null) - { - writer.WritePropertyName("inner_hits"); - if (InnerHitsDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in InnerHitsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(action), options); - } - - if (InnerHitsDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - SingleOrManySerializationHelper.Serialize(InnerHitsValue, writer, options); - } - - if (MaxConcurrentGroupSearchesValue.HasValue) - { - writer.WritePropertyName("max_concurrent_group_searches"); - writer.WriteNumberValue(MaxConcurrentGroupSearchesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldSuggester.g.cs index eb342fd32f5..3ef3fec562b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldSuggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/FieldSuggester.g.cs @@ -17,240 +17,298 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -[JsonConverter(typeof(FieldSuggesterConverter))] -public sealed partial class FieldSuggester -{ - internal FieldSuggester(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static FieldSuggester Completion(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester completionSuggester) => new FieldSuggester("completion", completionSuggester); - public static FieldSuggester Phrase(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester phraseSuggester) => new FieldSuggester("phrase", phraseSuggester); - public static FieldSuggester Term(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester termSuggester) => new FieldSuggester("term", termSuggester); - - /// - /// - /// Prefix used to search for suggestions. - /// - /// - [JsonInclude, JsonPropertyName("prefix")] - public string? Prefix { get; set; } - - /// - /// - /// A prefix expressed as a regular expression. - /// - /// - [JsonInclude, JsonPropertyName("regex")] - public string? Regex { get; set; } - - /// - /// - /// The text to use as input for the suggester. - /// Needs to be set globally or per suggestion. - /// - /// - [JsonInclude, JsonPropertyName("text")] - public string? Text { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class FieldSuggesterConverter : JsonConverter +internal sealed partial class FieldSuggesterConverter : System.Text.Json.Serialization.JsonConverter { - public override FieldSuggester Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText PropRegex = System.Text.Json.JsonEncodedText.Encode("regex"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + private static readonly System.Text.Json.JsonEncodedText VariantCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText VariantPhrase = System.Text.Json.JsonEncodedText.Encode("phrase"); + private static readonly System.Text.Json.JsonEncodedText VariantTerm = System.Text.Json.JsonEncodedText.Encode("term"); + + public override Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - string? prefixValue = default; - string? regexValue = default; - string? textValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPrefix = default; + LocalJsonValue propRegex = default; + LocalJsonValue propText = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propPrefix.TryReadProperty(ref reader, options, PropPrefix, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "prefix") + if (propRegex.TryReadProperty(ref reader, options, PropRegex, null)) { - prefixValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "regex") + if (propText.TryReadProperty(ref reader, options, PropText, null)) { - regexValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "text") + if (reader.ValueTextEquals(VariantCompletion)) { - textValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantCompletion.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "completion") + if (reader.ValueTextEquals(VariantPhrase)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPhrase.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "phrase") + if (reader.ValueTextEquals(VariantTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "term") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'FieldSuggester' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new FieldSuggester(variantNameValue, variantValue); - result.Prefix = prefixValue; - result.Regex = regexValue; - result.Text = textValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Prefix = propPrefix.Value, + Regex = propRegex.Value, + Text = propText.Value + }; } - public override void Write(Utf8JsonWriter writer, FieldSuggester value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Prefix)) + switch (value.VariantType) { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(value.Prefix); + case null: + break; + case "completion": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester)value.Variant, null, null); + break; + case "phrase": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester)value.Variant, null, null); + break; + case "term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.TermSuggester)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester)}'."); } - if (!string.IsNullOrEmpty(value.Regex)) - { - writer.WritePropertyName("regex"); - writer.WriteStringValue(value.Regex); - } + writer.WriteProperty(options, PropPrefix, value.Prefix, null, null); + writer.WriteProperty(options, PropRegex, value.Regex, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} - if (!string.IsNullOrEmpty(value.Text)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(value.Text); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterConverter))] +public sealed partial class FieldSuggester +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public FieldSuggester() + { + } +#endif +#if !NET7_0_OR_GREATER + public FieldSuggester() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester? Completion { get => GetVariant("completion"); set => SetVariant("completion", value); } + + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester? Phrase { get => GetVariant("phrase"); set => SetVariant("phrase", value); } + + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggester? Term { get => GetVariant("term"); set => SetVariant("term", value); } + + /// + /// + /// Prefix used to search for suggestions. + /// + /// + public string? Prefix { get; set; } + + /// + /// + /// A prefix expressed as a regular expression. + /// + /// + public string? Regex { get; set; } - if (value.VariantName is not null && value.Variant is not null) + /// + /// + /// The text to use as input for the suggester. + /// Needs to be set globally or per suggestion. + /// + /// + public string? Text { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester value) => new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester { Completion = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester value) => new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester { Phrase = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester value) => new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester { Term = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "completion": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester)value.Variant, options); - break; - case "phrase": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester)value.Variant, options); - break; - case "term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.TermSuggester)value.Variant, options); - break; - } + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class FieldSuggesterDescriptor : SerializableDescriptor> +public readonly partial struct FieldSuggesterDescriptor { - internal FieldSuggesterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester instance) + { + Instance = instance; + } - public FieldSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSuggesterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor descriptor) => descriptor.Instance; - private FieldSuggesterDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Completion(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Completion = value; + return this; } - private FieldSuggesterDescriptor Set(object variant, string variantName) + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Completion(System.Action> action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Completion = Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor.Build(action); + return this; } - private string? PrefixValue { get; set; } - private string? RegexValue { get; set; } - private string? TextValue { get; set; } + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Phrase(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester? value) + { + Instance.Phrase = value; + return this; + } + + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Phrase(System.Action> action) + { + Instance.Phrase = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor.Build(action); + return this; + } + + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Term(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor.Build(action); + return this; + } /// /// /// Prefix used to search for suggestions. /// /// - public FieldSuggesterDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Prefix(string? value) { - PrefixValue = prefix; - return Self; + Instance.Prefix = value; + return this; } /// @@ -258,10 +316,10 @@ public FieldSuggesterDescriptor Prefix(string? prefix) /// A prefix expressed as a regular expression. /// /// - public FieldSuggesterDescriptor Regex(string? regex) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Regex(string? value) { - RegexValue = regex; - return Self; + Instance.Regex = value; + return this; } /// @@ -270,101 +328,148 @@ public FieldSuggesterDescriptor Regex(string? regex) /// Needs to be set globally or per suggestion. /// /// - public FieldSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Text(string? value) + { + Instance.Text = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester Build(System.Action> action) { - TextValue = text; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public FieldSuggesterDescriptor Completion(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester completionSuggester) => Set(completionSuggester, "completion"); - public FieldSuggesterDescriptor Completion(Action> configure) => Set(configure, "completion"); - public FieldSuggesterDescriptor Phrase(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester phraseSuggester) => Set(phraseSuggester, "phrase"); - public FieldSuggesterDescriptor Phrase(Action> configure) => Set(configure, "phrase"); - public FieldSuggesterDescriptor Term(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester termSuggester) => Set(termSuggester, "term"); - public FieldSuggesterDescriptor Term(Action> configure) => Set(configure, "term"); +public readonly partial struct FieldSuggesterDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } + Instance = instance; + } - if (!string.IsNullOrEmpty(RegexValue)) - { - writer.WritePropertyName("regex"); - writer.WriteStringValue(RegexValue); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSuggesterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor descriptor) => descriptor.Instance; - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Completion(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester? value) + { + Instance.Completion = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Completion(System.Action action) + { + Instance.Completion = Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Provides auto-complete/search-as-you-type functionality. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Completion(System.Action> action) + { + Instance.Completion = Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggesterDescriptor.Build(action); + return this; } -} -public sealed partial class FieldSuggesterDescriptor : SerializableDescriptor -{ - internal FieldSuggesterDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Phrase(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester? value) + { + Instance.Phrase = value; + return this; + } - public FieldSuggesterDescriptor() : base() + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Phrase(System.Action action) { + Instance.Phrase = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor.Build(action); + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Provides access to word alternatives on a per token basis within a certain string distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Phrase(System.Action> action) + { + Instance.Phrase = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor.Build(action); + return this; + } - private FieldSuggesterDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Term(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Term = value; + return this; } - private FieldSuggesterDescriptor Set(object variant, string variantName) + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Term(System.Action action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Term = Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor.Build(action); + return this; } - private string? PrefixValue { get; set; } - private string? RegexValue { get; set; } - private string? TextValue { get; set; } + /// + /// + /// Suggests terms based on edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor.Build(action); + return this; + } /// /// /// Prefix used to search for suggestions. /// /// - public FieldSuggesterDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Prefix(string? value) { - PrefixValue = prefix; - return Self; + Instance.Prefix = value; + return this; } /// @@ -372,10 +477,10 @@ public FieldSuggesterDescriptor Prefix(string? prefix) /// A prefix expressed as a regular expression. /// /// - public FieldSuggesterDescriptor Regex(string? regex) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Regex(string? value) { - RegexValue = regex; - return Self; + Instance.Regex = value; + return this; } /// @@ -384,53 +489,17 @@ public FieldSuggesterDescriptor Regex(string? regex) /// Needs to be set globally or per suggestion. /// /// - public FieldSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor Text(string? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - public FieldSuggesterDescriptor Completion(Elastic.Clients.Elasticsearch.Core.Search.CompletionSuggester completionSuggester) => Set(completionSuggester, "completion"); - public FieldSuggesterDescriptor Completion(Action configure) => Set(configure, "completion"); - public FieldSuggesterDescriptor Phrase(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester phraseSuggester) => Set(phraseSuggester, "phrase"); - public FieldSuggesterDescriptor Phrase(Action configure) => Set(configure, "phrase"); - public FieldSuggesterDescriptor Term(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester termSuggester) => Set(termSuggester, "term"); - public FieldSuggesterDescriptor Term(Action configure) => Set(configure, "term"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } - - if (!string.IsNullOrEmpty(RegexValue)) - { - writer.WritePropertyName("regex"); - writer.WriteStringValue(RegexValue); - } - - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Highlight.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Highlight.g.cs index 0955a3e17ea..65f958e0cf6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Highlight.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Highlight.g.cs @@ -17,24 +17,279 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class HighlightConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoundaryChars = System.Text.Json.JsonEncodedText.Encode("boundary_chars"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryMaxScan = System.Text.Json.JsonEncodedText.Encode("boundary_max_scan"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryScanner = System.Text.Json.JsonEncodedText.Encode("boundary_scanner"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryScannerLocale = System.Text.Json.JsonEncodedText.Encode("boundary_scanner_locale"); + private static readonly System.Text.Json.JsonEncodedText PropEncoder = System.Text.Json.JsonEncodedText.Encode("encoder"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropForceSource = System.Text.Json.JsonEncodedText.Encode("force_source"); + private static readonly System.Text.Json.JsonEncodedText PropFragmenter = System.Text.Json.JsonEncodedText.Encode("fragmenter"); + private static readonly System.Text.Json.JsonEncodedText PropFragmentSize = System.Text.Json.JsonEncodedText.Encode("fragment_size"); + private static readonly System.Text.Json.JsonEncodedText PropHighlightFilter = System.Text.Json.JsonEncodedText.Encode("highlight_filter"); + private static readonly System.Text.Json.JsonEncodedText PropHighlightQuery = System.Text.Json.JsonEncodedText.Encode("highlight_query"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAnalyzedOffset = System.Text.Json.JsonEncodedText.Encode("max_analyzed_offset"); + private static readonly System.Text.Json.JsonEncodedText PropMaxFragmentLength = System.Text.Json.JsonEncodedText.Encode("max_fragment_length"); + private static readonly System.Text.Json.JsonEncodedText PropNoMatchSize = System.Text.Json.JsonEncodedText.Encode("no_match_size"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfFragments = System.Text.Json.JsonEncodedText.Encode("number_of_fragments"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropPhraseLimit = System.Text.Json.JsonEncodedText.Encode("phrase_limit"); + private static readonly System.Text.Json.JsonEncodedText PropPostTags = System.Text.Json.JsonEncodedText.Encode("post_tags"); + private static readonly System.Text.Json.JsonEncodedText PropPreTags = System.Text.Json.JsonEncodedText.Encode("pre_tags"); + private static readonly System.Text.Json.JsonEncodedText PropRequireFieldMatch = System.Text.Json.JsonEncodedText.Encode("require_field_match"); + private static readonly System.Text.Json.JsonEncodedText PropTagsSchema = System.Text.Json.JsonEncodedText.Encode("tags_schema"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.Highlight Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoundaryChars = default; + LocalJsonValue propBoundaryMaxScan = default; + LocalJsonValue propBoundaryScanner = default; + LocalJsonValue propBoundaryScannerLocale = default; + LocalJsonValue propEncoder = default; + LocalJsonValue> propFields = default; + LocalJsonValue propForceSource = default; + LocalJsonValue propFragmenter = default; + LocalJsonValue propFragmentSize = default; + LocalJsonValue propHighlightFilter = default; + LocalJsonValue propHighlightQuery = default; + LocalJsonValue propMaxAnalyzedOffset = default; + LocalJsonValue propMaxFragmentLength = default; + LocalJsonValue propNoMatchSize = default; + LocalJsonValue propNumberOfFragments = default; + LocalJsonValue?> propOptions = default; + LocalJsonValue propOrder = default; + LocalJsonValue propPhraseLimit = default; + LocalJsonValue?> propPostTags = default; + LocalJsonValue?> propPreTags = default; + LocalJsonValue propRequireFieldMatch = default; + LocalJsonValue propTagsSchema = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoundaryChars.TryReadProperty(ref reader, options, PropBoundaryChars, null)) + { + continue; + } + + if (propBoundaryMaxScan.TryReadProperty(ref reader, options, PropBoundaryMaxScan, null)) + { + continue; + } + + if (propBoundaryScanner.TryReadProperty(ref reader, options, PropBoundaryScanner, null)) + { + continue; + } + + if (propBoundaryScannerLocale.TryReadProperty(ref reader, options, PropBoundaryScannerLocale, null)) + { + continue; + } + + if (propEncoder.TryReadProperty(ref reader, options, PropEncoder, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propForceSource.TryReadProperty(ref reader, options, PropForceSource, null)) + { + continue; + } + + if (propFragmenter.TryReadProperty(ref reader, options, PropFragmenter, null)) + { + continue; + } + + if (propFragmentSize.TryReadProperty(ref reader, options, PropFragmentSize, null)) + { + continue; + } + + if (propHighlightFilter.TryReadProperty(ref reader, options, PropHighlightFilter, null)) + { + continue; + } + + if (propHighlightQuery.TryReadProperty(ref reader, options, PropHighlightQuery, null)) + { + continue; + } + + if (propMaxAnalyzedOffset.TryReadProperty(ref reader, options, PropMaxAnalyzedOffset, null)) + { + continue; + } + + if (propMaxFragmentLength.TryReadProperty(ref reader, options, PropMaxFragmentLength, null)) + { + continue; + } + + if (propNoMatchSize.TryReadProperty(ref reader, options, PropNoMatchSize, null)) + { + continue; + } + + if (propNumberOfFragments.TryReadProperty(ref reader, options, PropNumberOfFragments, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propPhraseLimit.TryReadProperty(ref reader, options, PropPhraseLimit, null)) + { + continue; + } + + if (propPostTags.TryReadProperty(ref reader, options, PropPostTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPreTags.TryReadProperty(ref reader, options, PropPreTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRequireFieldMatch.TryReadProperty(ref reader, options, PropRequireFieldMatch, null)) + { + continue; + } + + if (propTagsSchema.TryReadProperty(ref reader, options, PropTagsSchema, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BoundaryChars = propBoundaryChars.Value, + BoundaryMaxScan = propBoundaryMaxScan.Value, + BoundaryScanner = propBoundaryScanner.Value, + BoundaryScannerLocale = propBoundaryScannerLocale.Value, + Encoder = propEncoder.Value, + Fields = propFields.Value, + ForceSource = propForceSource.Value, + Fragmenter = propFragmenter.Value, + FragmentSize = propFragmentSize.Value, + HighlightFilter = propHighlightFilter.Value, + HighlightQuery = propHighlightQuery.Value, + MaxAnalyzedOffset = propMaxAnalyzedOffset.Value, + MaxFragmentLength = propMaxFragmentLength.Value, + NoMatchSize = propNoMatchSize.Value, + NumberOfFragments = propNumberOfFragments.Value, + Options = propOptions.Value, + Order = propOrder.Value, + PhraseLimit = propPhraseLimit.Value, + PostTags = propPostTags.Value, + PreTags = propPreTags.Value, + RequireFieldMatch = propRequireFieldMatch.Value, + TagsSchema = propTagsSchema.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Highlight value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoundaryChars, value.BoundaryChars, null, null); + writer.WriteProperty(options, PropBoundaryMaxScan, value.BoundaryMaxScan, null, null); + writer.WriteProperty(options, PropBoundaryScanner, value.BoundaryScanner, null, null); + writer.WriteProperty(options, PropBoundaryScannerLocale, value.BoundaryScannerLocale, null, null); + writer.WriteProperty(options, PropEncoder, value.Encoder, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropForceSource, value.ForceSource, null, null); + writer.WriteProperty(options, PropFragmenter, value.Fragmenter, null, null); + writer.WriteProperty(options, PropFragmentSize, value.FragmentSize, null, null); + writer.WriteProperty(options, PropHighlightFilter, value.HighlightFilter, null, null); + writer.WriteProperty(options, PropHighlightQuery, value.HighlightQuery, null, null); + writer.WriteProperty(options, PropMaxAnalyzedOffset, value.MaxAnalyzedOffset, null, null); + writer.WriteProperty(options, PropMaxFragmentLength, value.MaxFragmentLength, null, null); + writer.WriteProperty(options, PropNoMatchSize, value.NoMatchSize, null, null); + writer.WriteProperty(options, PropNumberOfFragments, value.NumberOfFragments, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropPhraseLimit, value.PhraseLimit, null, null); + writer.WriteProperty(options, PropPostTags, value.PostTags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreTags, value.PreTags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRequireFieldMatch, value.RequireFieldMatch, null, null); + writer.WriteProperty(options, PropTagsSchema, value.TagsSchema, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlightConverter))] public sealed partial class Highlight { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Highlight(System.Collections.Generic.IDictionary fields) + { + Fields = fields; + } +#if NET7_0_OR_GREATER + public Highlight() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Highlight() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that contains each boundary character. /// /// - [JsonInclude, JsonPropertyName("boundary_chars")] public string? BoundaryChars { get; set; } /// @@ -42,7 +297,6 @@ public sealed partial class Highlight /// How far to scan for boundary characters. /// /// - [JsonInclude, JsonPropertyName("boundary_max_scan")] public int? BoundaryMaxScan { get; set; } /// @@ -52,7 +306,6 @@ public sealed partial class Highlight /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - [JsonInclude, JsonPropertyName("boundary_scanner")] public Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScanner { get; set; } /// @@ -61,12 +314,14 @@ public sealed partial class Highlight /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - [JsonInclude, JsonPropertyName("boundary_scanner_locale")] public string? BoundaryScannerLocale { get; set; } - [JsonInclude, JsonPropertyName("encoder")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? Encoder { get; set; } - [JsonInclude, JsonPropertyName("fields")] - public IDictionary Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary Fields { get; set; } + public bool? ForceSource { get; set; } /// /// @@ -74,7 +329,6 @@ public sealed partial class Highlight /// Only valid for the plain highlighter. /// /// - [JsonInclude, JsonPropertyName("fragmenter")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? Fragmenter { get; set; } /// @@ -82,9 +336,7 @@ public sealed partial class Highlight /// The size of the highlighted fragment in characters. /// /// - [JsonInclude, JsonPropertyName("fragment_size")] public int? FragmentSize { get; set; } - [JsonInclude, JsonPropertyName("highlight_filter")] public bool? HighlightFilter { get; set; } /// @@ -93,7 +345,6 @@ public sealed partial class Highlight /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - [JsonInclude, JsonPropertyName("highlight_query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQuery { get; set; } /// @@ -103,9 +354,7 @@ public sealed partial class Highlight /// The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - [JsonInclude, JsonPropertyName("max_analyzed_offset")] public int? MaxAnalyzedOffset { get; set; } - [JsonInclude, JsonPropertyName("max_fragment_length")] public int? MaxFragmentLength { get; set; } /// @@ -113,7 +362,6 @@ public sealed partial class Highlight /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - [JsonInclude, JsonPropertyName("no_match_size")] public int? NoMatchSize { get; set; } /// @@ -125,10 +373,8 @@ public sealed partial class Highlight /// If number_of_fragments is 0, fragment_size is ignored. /// /// - [JsonInclude, JsonPropertyName("number_of_fragments")] public int? NumberOfFragments { get; set; } - [JsonInclude, JsonPropertyName("options")] - public IDictionary? Options { get; set; } + public System.Collections.Generic.IDictionary? Options { get; set; } /// /// @@ -138,7 +384,6 @@ public sealed partial class Highlight /// Each highlighter applies its own logic to compute relevancy scores. /// /// - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? Order { get; set; } /// @@ -149,7 +394,6 @@ public sealed partial class Highlight /// Only supported by the fvh highlighter. /// /// - [JsonInclude, JsonPropertyName("phrase_limit")] public int? PhraseLimit { get; set; } /// @@ -158,8 +402,7 @@ public sealed partial class Highlight /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - [JsonInclude, JsonPropertyName("post_tags")] - public ICollection? PostTags { get; set; } + public System.Collections.Generic.ICollection? PostTags { get; set; } /// /// @@ -167,8 +410,7 @@ public sealed partial class Highlight /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - [JsonInclude, JsonPropertyName("pre_tags")] - public ICollection? PreTags { get; set; } + public System.Collections.Generic.ICollection? PreTags { get; set; } /// /// @@ -176,7 +418,6 @@ public sealed partial class Highlight /// Set to false to highlight all fields. /// /// - [JsonInclude, JsonPropertyName("require_field_match")] public bool? RequireFieldMatch { get; set; } /// @@ -184,54 +425,38 @@ public sealed partial class Highlight /// Set to styled to use the built-in tag schema. /// /// - [JsonInclude, JsonPropertyName("tags_schema")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchema { get; set; } - [JsonInclude, JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? Type { get; set; } } -public sealed partial class HighlightDescriptor : SerializableDescriptor> +public readonly partial struct HighlightDescriptor { - internal HighlightDescriptor(Action> configure) => configure.Invoke(this); - - public HighlightDescriptor() : base() - { - } - - private string? BoundaryCharsValue { get; set; } - private int? BoundaryMaxScanValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScannerValue { get; set; } - private string? BoundaryScannerLocaleValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? EncoderValue { get; set; } - private IDictionary> FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? FragmenterValue { get; set; } - private int? FragmentSizeValue { get; set; } - private bool? HighlightFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HighlightQueryDescriptor { get; set; } - private Action> HighlightQueryDescriptorAction { get; set; } - private int? MaxAnalyzedOffsetValue { get; set; } - private int? MaxFragmentLengthValue { get; set; } - private int? NoMatchSizeValue { get; set; } - private int? NumberOfFragmentsValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? OrderValue { get; set; } - private int? PhraseLimitValue { get; set; } - private ICollection? PostTagsValue { get; set; } - private ICollection? PreTagsValue { get; set; } - private bool? RequireFieldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchemaValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? TypeValue { get; set; } + internal Elastic.Clients.Elasticsearch.Core.Search.Highlight Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Highlight instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Highlight instance) => new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) => descriptor.Instance; /// /// /// A string that contains each boundary character. /// /// - public HighlightDescriptor BoundaryChars(string? boundaryChars) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryChars(string? value) { - BoundaryCharsValue = boundaryChars; - return Self; + Instance.BoundaryChars = value; + return this; } /// @@ -239,10 +464,10 @@ public HighlightDescriptor BoundaryChars(string? boundaryChars) /// How far to scan for boundary characters. /// /// - public HighlightDescriptor BoundaryMaxScan(int? boundaryMaxScan) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryMaxScan(int? value) { - BoundaryMaxScanValue = boundaryMaxScan; - return Self; + Instance.BoundaryMaxScan = value; + return this; } /// @@ -252,10 +477,10 @@ public HighlightDescriptor BoundaryMaxScan(int? boundaryMaxScan) /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - public HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? boundaryScanner) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? value) { - BoundaryScannerValue = boundaryScanner; - return Self; + Instance.BoundaryScanner = value; + return this; } /// @@ -264,22 +489,106 @@ public HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsea /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - public HighlightDescriptor BoundaryScannerLocale(string? boundaryScannerLocale) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryScannerLocale(string? value) { - BoundaryScannerLocaleValue = boundaryScannerLocale; - return Self; + Instance.BoundaryScannerLocale = value; + return this; } - public HighlightDescriptor Encoder(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? encoder) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Encoder(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? value) { - EncoderValue = encoder; - return Self; + Instance.Encoder = value; + return this; } - public HighlightDescriptor Fields(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Collections.Generic.IDictionary value) { - FieldsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields() + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Action>? action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(Elastic.Clients.Elasticsearch.Field key) + { + Instance.Fields = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Linq.Expressions.Expression> key) + { + Instance.Fields = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(params Elastic.Clients.Elasticsearch.Field[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + } + + Instance.Fields = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key, System.Action>? action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key, System.Action>? action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor ForceSource(bool? value = true) + { + Instance.ForceSource = value; + return this; } /// @@ -288,10 +597,10 @@ public HighlightDescriptor Fields(Funcplain highlighter. /// /// - public HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? fragmenter) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? value) { - FragmenterValue = fragmenter; - return Self; + Instance.Fragmenter = value; + return this; } /// @@ -299,16 +608,16 @@ public HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.C /// The size of the highlighted fragment in characters. /// /// - public HighlightDescriptor FragmentSize(int? fragmentSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor FragmentSize(int? value) { - FragmentSizeValue = fragmentSize; - return Self; + Instance.FragmentSize = value; + return this; } - public HighlightDescriptor HighlightFilter(bool? highlightFilter = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightFilter(bool? value = true) { - HighlightFilterValue = highlightFilter; - return Self; + Instance.HighlightFilter = value; + return this; } /// @@ -317,28 +626,22 @@ public HighlightDescriptor HighlightFilter(bool? highlightFilter = tr /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - public HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? highlightQuery) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = null; - HighlightQueryValue = highlightQuery; - return Self; + Instance.HighlightQuery = value; + return this; } - public HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - HighlightQueryValue = null; - HighlightQueryDescriptorAction = null; - HighlightQueryDescriptor = descriptor; - return Self; - } - - public HighlightDescriptor HighlightQuery(Action> configure) + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightQuery(System.Action> action) { - HighlightQueryValue = null; - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = configure; - return Self; + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -348,16 +651,16 @@ public HighlightDescriptor HighlightQuery(Actionmax_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - public HighlightDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor MaxAnalyzedOffset(int? value) { - MaxAnalyzedOffsetValue = maxAnalyzedOffset; - return Self; + Instance.MaxAnalyzedOffset = value; + return this; } - public HighlightDescriptor MaxFragmentLength(int? maxFragmentLength) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor MaxFragmentLength(int? value) { - MaxFragmentLengthValue = maxFragmentLength; - return Self; + Instance.MaxFragmentLength = value; + return this; } /// @@ -365,10 +668,10 @@ public HighlightDescriptor MaxFragmentLength(int? maxFragmentLength) /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - public HighlightDescriptor NoMatchSize(int? noMatchSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor NoMatchSize(int? value) { - NoMatchSizeValue = noMatchSize; - return Self; + Instance.NoMatchSize = value; + return this; } /// @@ -380,16 +683,35 @@ public HighlightDescriptor NoMatchSize(int? noMatchSize) /// If number_of_fragments is 0, fragment_size is ignored. /// /// - public HighlightDescriptor NumberOfFragments(int? numberOfFragments) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor NumberOfFragments(int? value) { - NumberOfFragmentsValue = numberOfFragments; - return Self; + Instance.NumberOfFragments = value; + return this; } - public HighlightDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options(System.Collections.Generic.IDictionary? value) { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options() + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options(System.Action? action) + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddOption(string key, object value) + { + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -400,10 +722,10 @@ public HighlightDescriptor Options(Func /// - public HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? order) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -414,10 +736,10 @@ public HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.S /// Only supported by the fvh highlighter. /// /// - public HighlightDescriptor PhraseLimit(int? phraseLimit) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PhraseLimit(int? value) { - PhraseLimitValue = phraseLimit; - return Self; + Instance.PhraseLimit = value; + return this; } /// @@ -426,10 +748,34 @@ public HighlightDescriptor PhraseLimit(int? phraseLimit) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightDescriptor PostTags(ICollection? postTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PostTags(System.Collections.Generic.ICollection? value) + { + Instance.PostTags = value; + return this; + } + + /// + /// + /// Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PostTags(params string[] values) + { + Instance.PostTags = [.. values]; + return this; + } + + /// + /// + /// Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PreTags(System.Collections.Generic.ICollection? value) { - PostTagsValue = postTags; - return Self; + Instance.PreTags = value; + return this; } /// @@ -438,10 +784,10 @@ public HighlightDescriptor PostTags(ICollection? postTags) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightDescriptor PreTags(ICollection? preTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PreTags(params string[] values) { - PreTagsValue = preTags; - return Self; + Instance.PreTags = [.. values]; + return this; } /// @@ -450,10 +796,10 @@ public HighlightDescriptor PreTags(ICollection? preTags) /// Set to false to highlight all fields. /// /// - public HighlightDescriptor RequireFieldMatch(bool? requireFieldMatch = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor RequireFieldMatch(bool? value = true) { - RequireFieldMatchValue = requireFieldMatch; - return Self; + Instance.RequireFieldMatch = value; + return this; } /// @@ -461,205 +807,55 @@ public HighlightDescriptor RequireFieldMatch(bool? requireFieldMatch /// Set to styled to use the built-in tag schema. /// /// - public HighlightDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? tagsSchema) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? value) { - TagsSchemaValue = tagsSchema; - return Self; + Instance.TagsSchema = value; + return this; } - public HighlightDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? type) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Highlight Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BoundaryCharsValue)) - { - writer.WritePropertyName("boundary_chars"); - writer.WriteStringValue(BoundaryCharsValue); - } - - if (BoundaryMaxScanValue.HasValue) - { - writer.WritePropertyName("boundary_max_scan"); - writer.WriteNumberValue(BoundaryMaxScanValue.Value); - } - - if (BoundaryScannerValue is not null) - { - writer.WritePropertyName("boundary_scanner"); - JsonSerializer.Serialize(writer, BoundaryScannerValue, options); - } - - if (!string.IsNullOrEmpty(BoundaryScannerLocaleValue)) - { - writer.WritePropertyName("boundary_scanner_locale"); - writer.WriteStringValue(BoundaryScannerLocaleValue); - } - - if (EncoderValue is not null) - { - writer.WritePropertyName("encoder"); - JsonSerializer.Serialize(writer, EncoderValue, options); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (FragmenterValue is not null) - { - writer.WritePropertyName("fragmenter"); - JsonSerializer.Serialize(writer, FragmenterValue, options); - } - - if (FragmentSizeValue.HasValue) - { - writer.WritePropertyName("fragment_size"); - writer.WriteNumberValue(FragmentSizeValue.Value); - } - - if (HighlightFilterValue.HasValue) - { - writer.WritePropertyName("highlight_filter"); - writer.WriteBooleanValue(HighlightFilterValue.Value); - } - - if (HighlightQueryDescriptor is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryDescriptor, options); - } - else if (HighlightQueryDescriptorAction is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(HighlightQueryDescriptorAction), options); - } - else if (HighlightQueryValue is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryValue, options); - } - - if (MaxAnalyzedOffsetValue.HasValue) - { - writer.WritePropertyName("max_analyzed_offset"); - writer.WriteNumberValue(MaxAnalyzedOffsetValue.Value); - } - - if (MaxFragmentLengthValue.HasValue) - { - writer.WritePropertyName("max_fragment_length"); - writer.WriteNumberValue(MaxFragmentLengthValue.Value); - } - - if (NoMatchSizeValue.HasValue) - { - writer.WritePropertyName("no_match_size"); - writer.WriteNumberValue(NoMatchSizeValue.Value); - } - - if (NumberOfFragmentsValue.HasValue) - { - writer.WritePropertyName("number_of_fragments"); - writer.WriteNumberValue(NumberOfFragmentsValue.Value); - } - - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (PhraseLimitValue.HasValue) - { - writer.WritePropertyName("phrase_limit"); - writer.WriteNumberValue(PhraseLimitValue.Value); - } - - if (PostTagsValue is not null) - { - writer.WritePropertyName("post_tags"); - JsonSerializer.Serialize(writer, PostTagsValue, options); - } - - if (PreTagsValue is not null) - { - writer.WritePropertyName("pre_tags"); - JsonSerializer.Serialize(writer, PreTagsValue, options); - } - - if (RequireFieldMatchValue.HasValue) - { - writer.WritePropertyName("require_field_match"); - writer.WriteBooleanValue(RequireFieldMatchValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TagsSchemaValue is not null) - { - writer.WritePropertyName("tags_schema"); - JsonSerializer.Serialize(writer, TagsSchemaValue, options); - } +public readonly partial struct HighlightDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.Search.Highlight Instance { get; init; } - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Highlight instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class HighlightDescriptor : SerializableDescriptor -{ - internal HighlightDescriptor(Action configure) => configure.Invoke(this); - - public HighlightDescriptor() : base() - { - } - - private string? BoundaryCharsValue { get; set; } - private int? BoundaryMaxScanValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScannerValue { get; set; } - private string? BoundaryScannerLocaleValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? EncoderValue { get; set; } - private IDictionary FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? FragmenterValue { get; set; } - private int? FragmentSizeValue { get; set; } - private bool? HighlightFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HighlightQueryDescriptor { get; set; } - private Action HighlightQueryDescriptorAction { get; set; } - private int? MaxAnalyzedOffsetValue { get; set; } - private int? MaxFragmentLengthValue { get; set; } - private int? NoMatchSizeValue { get; set; } - private int? NumberOfFragmentsValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? OrderValue { get; set; } - private int? PhraseLimitValue { get; set; } - private ICollection? PostTagsValue { get; set; } - private ICollection? PreTagsValue { get; set; } - private bool? RequireFieldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchemaValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Highlight instance) => new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) => descriptor.Instance; /// /// /// A string that contains each boundary character. /// /// - public HighlightDescriptor BoundaryChars(string? boundaryChars) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryChars(string? value) { - BoundaryCharsValue = boundaryChars; - return Self; + Instance.BoundaryChars = value; + return this; } /// @@ -667,10 +863,10 @@ public HighlightDescriptor BoundaryChars(string? boundaryChars) /// How far to scan for boundary characters. /// /// - public HighlightDescriptor BoundaryMaxScan(int? boundaryMaxScan) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryMaxScan(int? value) { - BoundaryMaxScanValue = boundaryMaxScan; - return Self; + Instance.BoundaryMaxScan = value; + return this; } /// @@ -680,10 +876,10 @@ public HighlightDescriptor BoundaryMaxScan(int? boundaryMaxScan) /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - public HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? boundaryScanner) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? value) { - BoundaryScannerValue = boundaryScanner; - return Self; + Instance.BoundaryScanner = value; + return this; } /// @@ -692,22 +888,126 @@ public HighlightDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Se /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - public HighlightDescriptor BoundaryScannerLocale(string? boundaryScannerLocale) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor BoundaryScannerLocale(string? value) + { + Instance.BoundaryScannerLocale = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Encoder(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? value) + { + Instance.Encoder = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Collections.Generic.IDictionary value) + { + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields() + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Action? action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Action>? action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldHighlightField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(Elastic.Clients.Elasticsearch.Field key) + { + Instance.Fields = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(System.Linq.Expressions.Expression> key) + { + Instance.Fields = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fields(params Elastic.Clients.Elasticsearch.Field[] keys) { - BoundaryScannerLocaleValue = boundaryScannerLocale; - return Self; + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + } + + Instance.Fields = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; } - public HighlightDescriptor Encoder(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder? encoder) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key) { - EncoderValue = encoder; - return Self; + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(null)); + return this; } - public HighlightDescriptor Fields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key, System.Action? action) { - FieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key, System.Action? action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(Elastic.Clients.Elasticsearch.Field key, System.Action>? action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddField(System.Linq.Expressions.Expression> key, System.Action>? action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor ForceSource(bool? value = true) + { + Instance.ForceSource = value; + return this; } /// @@ -716,10 +1016,10 @@ public HighlightDescriptor Fields(Funcplain highlighter. /// /// - public HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? fragmenter) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? value) { - FragmenterValue = fragmenter; - return Self; + Instance.Fragmenter = value; + return this; } /// @@ -727,16 +1027,16 @@ public HighlightDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search. /// The size of the highlighted fragment in characters. /// /// - public HighlightDescriptor FragmentSize(int? fragmentSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor FragmentSize(int? value) { - FragmentSizeValue = fragmentSize; - return Self; + Instance.FragmentSize = value; + return this; } - public HighlightDescriptor HighlightFilter(bool? highlightFilter = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightFilter(bool? value = true) { - HighlightFilterValue = highlightFilter; - return Self; + Instance.HighlightFilter = value; + return this; } /// @@ -745,28 +1045,34 @@ public HighlightDescriptor HighlightFilter(bool? highlightFilter = true) /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - public HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? highlightQuery) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = null; - HighlightQueryValue = highlightQuery; - return Self; + Instance.HighlightQuery = value; + return this; } - public HighlightDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightQuery(System.Action action) { - HighlightQueryValue = null; - HighlightQueryDescriptorAction = null; - HighlightQueryDescriptor = descriptor; - return Self; + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HighlightDescriptor HighlightQuery(Action configure) + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightQuery(System.Action> action) { - HighlightQueryValue = null; - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = configure; - return Self; + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -776,16 +1082,16 @@ public HighlightDescriptor HighlightQuery(Actionmax_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - public HighlightDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor MaxAnalyzedOffset(int? value) { - MaxAnalyzedOffsetValue = maxAnalyzedOffset; - return Self; + Instance.MaxAnalyzedOffset = value; + return this; } - public HighlightDescriptor MaxFragmentLength(int? maxFragmentLength) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor MaxFragmentLength(int? value) { - MaxFragmentLengthValue = maxFragmentLength; - return Self; + Instance.MaxFragmentLength = value; + return this; } /// @@ -793,10 +1099,10 @@ public HighlightDescriptor MaxFragmentLength(int? maxFragmentLength) /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - public HighlightDescriptor NoMatchSize(int? noMatchSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor NoMatchSize(int? value) { - NoMatchSizeValue = noMatchSize; - return Self; + Instance.NoMatchSize = value; + return this; } /// @@ -808,16 +1114,35 @@ public HighlightDescriptor NoMatchSize(int? noMatchSize) /// If number_of_fragments is 0, fragment_size is ignored. /// /// - public HighlightDescriptor NumberOfFragments(int? numberOfFragments) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor NumberOfFragments(int? value) { - NumberOfFragmentsValue = numberOfFragments; - return Self; + Instance.NumberOfFragments = value; + return this; } - public HighlightDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options(System.Collections.Generic.IDictionary? value) { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options() + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Options(System.Action? action) + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor AddOption(string key, object value) + { + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -828,10 +1153,10 @@ public HighlightDescriptor Options(Func, Fluent /// Each highlighter applies its own logic to compute relevancy scores. /// /// - public HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? order) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -842,10 +1167,22 @@ public HighlightDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.Highl /// Only supported by the fvh highlighter. /// /// - public HighlightDescriptor PhraseLimit(int? phraseLimit) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PhraseLimit(int? value) + { + Instance.PhraseLimit = value; + return this; + } + + /// + /// + /// Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PostTags(System.Collections.Generic.ICollection? value) { - PhraseLimitValue = phraseLimit; - return Self; + Instance.PostTags = value; + return this; } /// @@ -854,10 +1191,10 @@ public HighlightDescriptor PhraseLimit(int? phraseLimit) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightDescriptor PostTags(ICollection? postTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PostTags(params string[] values) { - PostTagsValue = postTags; - return Self; + Instance.PostTags = [.. values]; + return this; } /// @@ -866,10 +1203,22 @@ public HighlightDescriptor PostTags(ICollection? postTags) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightDescriptor PreTags(ICollection? preTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PreTags(System.Collections.Generic.ICollection? value) { - PreTagsValue = preTags; - return Self; + Instance.PreTags = value; + return this; + } + + /// + /// + /// Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor PreTags(params string[] values) + { + Instance.PreTags = [.. values]; + return this; } /// @@ -878,10 +1227,10 @@ public HighlightDescriptor PreTags(ICollection? preTags) /// Set to false to highlight all fields. /// /// - public HighlightDescriptor RequireFieldMatch(bool? requireFieldMatch = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor RequireFieldMatch(bool? value = true) { - RequireFieldMatchValue = requireFieldMatch; - return Self; + Instance.RequireFieldMatch = value; + return this; } /// @@ -889,159 +1238,23 @@ public HighlightDescriptor RequireFieldMatch(bool? requireFieldMatch = true) /// Set to styled to use the built-in tag schema. /// /// - public HighlightDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? tagsSchema) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? value) { - TagsSchemaValue = tagsSchema; - return Self; + Instance.TagsSchema = value; + return this; } - public HighlightDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? type) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Highlight Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BoundaryCharsValue)) - { - writer.WritePropertyName("boundary_chars"); - writer.WriteStringValue(BoundaryCharsValue); - } - - if (BoundaryMaxScanValue.HasValue) - { - writer.WritePropertyName("boundary_max_scan"); - writer.WriteNumberValue(BoundaryMaxScanValue.Value); - } - - if (BoundaryScannerValue is not null) - { - writer.WritePropertyName("boundary_scanner"); - JsonSerializer.Serialize(writer, BoundaryScannerValue, options); - } - - if (!string.IsNullOrEmpty(BoundaryScannerLocaleValue)) - { - writer.WritePropertyName("boundary_scanner_locale"); - writer.WriteStringValue(BoundaryScannerLocaleValue); - } - - if (EncoderValue is not null) - { - writer.WritePropertyName("encoder"); - JsonSerializer.Serialize(writer, EncoderValue, options); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (FragmenterValue is not null) - { - writer.WritePropertyName("fragmenter"); - JsonSerializer.Serialize(writer, FragmenterValue, options); - } - - if (FragmentSizeValue.HasValue) - { - writer.WritePropertyName("fragment_size"); - writer.WriteNumberValue(FragmentSizeValue.Value); - } - - if (HighlightFilterValue.HasValue) - { - writer.WritePropertyName("highlight_filter"); - writer.WriteBooleanValue(HighlightFilterValue.Value); - } - - if (HighlightQueryDescriptor is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryDescriptor, options); - } - else if (HighlightQueryDescriptorAction is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(HighlightQueryDescriptorAction), options); - } - else if (HighlightQueryValue is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryValue, options); - } - - if (MaxAnalyzedOffsetValue.HasValue) - { - writer.WritePropertyName("max_analyzed_offset"); - writer.WriteNumberValue(MaxAnalyzedOffsetValue.Value); - } - - if (MaxFragmentLengthValue.HasValue) - { - writer.WritePropertyName("max_fragment_length"); - writer.WriteNumberValue(MaxFragmentLengthValue.Value); - } - - if (NoMatchSizeValue.HasValue) - { - writer.WritePropertyName("no_match_size"); - writer.WriteNumberValue(NoMatchSizeValue.Value); - } - - if (NumberOfFragmentsValue.HasValue) - { - writer.WritePropertyName("number_of_fragments"); - writer.WriteNumberValue(NumberOfFragmentsValue.Value); - } - - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (PhraseLimitValue.HasValue) - { - writer.WritePropertyName("phrase_limit"); - writer.WriteNumberValue(PhraseLimitValue.Value); - } - - if (PostTagsValue is not null) - { - writer.WritePropertyName("post_tags"); - JsonSerializer.Serialize(writer, PostTagsValue, options); - } - - if (PreTagsValue is not null) - { - writer.WritePropertyName("pre_tags"); - JsonSerializer.Serialize(writer, PreTagsValue, options); - } - - if (RequireFieldMatchValue.HasValue) - { - writer.WritePropertyName("require_field_match"); - writer.WriteBooleanValue(RequireFieldMatchValue.Value); - } - - if (TagsSchemaValue is not null) - { - writer.WritePropertyName("tags_schema"); - JsonSerializer.Serialize(writer, TagsSchemaValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Highlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HighlightField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HighlightField.g.cs index ef12eaa8957..146e0da34d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HighlightField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HighlightField.g.cs @@ -17,24 +17,273 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class HighlightFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoundaryChars = System.Text.Json.JsonEncodedText.Encode("boundary_chars"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryMaxScan = System.Text.Json.JsonEncodedText.Encode("boundary_max_scan"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryScanner = System.Text.Json.JsonEncodedText.Encode("boundary_scanner"); + private static readonly System.Text.Json.JsonEncodedText PropBoundaryScannerLocale = System.Text.Json.JsonEncodedText.Encode("boundary_scanner_locale"); + private static readonly System.Text.Json.JsonEncodedText PropForceSource = System.Text.Json.JsonEncodedText.Encode("force_source"); + private static readonly System.Text.Json.JsonEncodedText PropFragmenter = System.Text.Json.JsonEncodedText.Encode("fragmenter"); + private static readonly System.Text.Json.JsonEncodedText PropFragmentOffset = System.Text.Json.JsonEncodedText.Encode("fragment_offset"); + private static readonly System.Text.Json.JsonEncodedText PropFragmentSize = System.Text.Json.JsonEncodedText.Encode("fragment_size"); + private static readonly System.Text.Json.JsonEncodedText PropHighlightFilter = System.Text.Json.JsonEncodedText.Encode("highlight_filter"); + private static readonly System.Text.Json.JsonEncodedText PropHighlightQuery = System.Text.Json.JsonEncodedText.Encode("highlight_query"); + private static readonly System.Text.Json.JsonEncodedText PropMatchedFields = System.Text.Json.JsonEncodedText.Encode("matched_fields"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAnalyzedOffset = System.Text.Json.JsonEncodedText.Encode("max_analyzed_offset"); + private static readonly System.Text.Json.JsonEncodedText PropMaxFragmentLength = System.Text.Json.JsonEncodedText.Encode("max_fragment_length"); + private static readonly System.Text.Json.JsonEncodedText PropNoMatchSize = System.Text.Json.JsonEncodedText.Encode("no_match_size"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfFragments = System.Text.Json.JsonEncodedText.Encode("number_of_fragments"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropPhraseLimit = System.Text.Json.JsonEncodedText.Encode("phrase_limit"); + private static readonly System.Text.Json.JsonEncodedText PropPostTags = System.Text.Json.JsonEncodedText.Encode("post_tags"); + private static readonly System.Text.Json.JsonEncodedText PropPreTags = System.Text.Json.JsonEncodedText.Encode("pre_tags"); + private static readonly System.Text.Json.JsonEncodedText PropRequireFieldMatch = System.Text.Json.JsonEncodedText.Encode("require_field_match"); + private static readonly System.Text.Json.JsonEncodedText PropTagsSchema = System.Text.Json.JsonEncodedText.Encode("tags_schema"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlightField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoundaryChars = default; + LocalJsonValue propBoundaryMaxScan = default; + LocalJsonValue propBoundaryScanner = default; + LocalJsonValue propBoundaryScannerLocale = default; + LocalJsonValue propForceSource = default; + LocalJsonValue propFragmenter = default; + LocalJsonValue propFragmentOffset = default; + LocalJsonValue propFragmentSize = default; + LocalJsonValue propHighlightFilter = default; + LocalJsonValue propHighlightQuery = default; + LocalJsonValue propMatchedFields = default; + LocalJsonValue propMaxAnalyzedOffset = default; + LocalJsonValue propMaxFragmentLength = default; + LocalJsonValue propNoMatchSize = default; + LocalJsonValue propNumberOfFragments = default; + LocalJsonValue?> propOptions = default; + LocalJsonValue propOrder = default; + LocalJsonValue propPhraseLimit = default; + LocalJsonValue?> propPostTags = default; + LocalJsonValue?> propPreTags = default; + LocalJsonValue propRequireFieldMatch = default; + LocalJsonValue propTagsSchema = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoundaryChars.TryReadProperty(ref reader, options, PropBoundaryChars, null)) + { + continue; + } + + if (propBoundaryMaxScan.TryReadProperty(ref reader, options, PropBoundaryMaxScan, null)) + { + continue; + } + + if (propBoundaryScanner.TryReadProperty(ref reader, options, PropBoundaryScanner, null)) + { + continue; + } + + if (propBoundaryScannerLocale.TryReadProperty(ref reader, options, PropBoundaryScannerLocale, null)) + { + continue; + } + + if (propForceSource.TryReadProperty(ref reader, options, PropForceSource, null)) + { + continue; + } + + if (propFragmenter.TryReadProperty(ref reader, options, PropFragmenter, null)) + { + continue; + } + + if (propFragmentOffset.TryReadProperty(ref reader, options, PropFragmentOffset, null)) + { + continue; + } + + if (propFragmentSize.TryReadProperty(ref reader, options, PropFragmentSize, null)) + { + continue; + } + + if (propHighlightFilter.TryReadProperty(ref reader, options, PropHighlightFilter, null)) + { + continue; + } + + if (propHighlightQuery.TryReadProperty(ref reader, options, PropHighlightQuery, null)) + { + continue; + } + + if (propMatchedFields.TryReadProperty(ref reader, options, PropMatchedFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propMaxAnalyzedOffset.TryReadProperty(ref reader, options, PropMaxAnalyzedOffset, null)) + { + continue; + } + + if (propMaxFragmentLength.TryReadProperty(ref reader, options, PropMaxFragmentLength, null)) + { + continue; + } + + if (propNoMatchSize.TryReadProperty(ref reader, options, PropNoMatchSize, null)) + { + continue; + } + + if (propNumberOfFragments.TryReadProperty(ref reader, options, PropNumberOfFragments, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propPhraseLimit.TryReadProperty(ref reader, options, PropPhraseLimit, null)) + { + continue; + } + + if (propPostTags.TryReadProperty(ref reader, options, PropPostTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPreTags.TryReadProperty(ref reader, options, PropPreTags, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRequireFieldMatch.TryReadProperty(ref reader, options, PropRequireFieldMatch, null)) + { + continue; + } + + if (propTagsSchema.TryReadProperty(ref reader, options, PropTagsSchema, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BoundaryChars = propBoundaryChars.Value, + BoundaryMaxScan = propBoundaryMaxScan.Value, + BoundaryScanner = propBoundaryScanner.Value, + BoundaryScannerLocale = propBoundaryScannerLocale.Value, + ForceSource = propForceSource.Value, + Fragmenter = propFragmenter.Value, + FragmentOffset = propFragmentOffset.Value, + FragmentSize = propFragmentSize.Value, + HighlightFilter = propHighlightFilter.Value, + HighlightQuery = propHighlightQuery.Value, + MatchedFields = propMatchedFields.Value, + MaxAnalyzedOffset = propMaxAnalyzedOffset.Value, + MaxFragmentLength = propMaxFragmentLength.Value, + NoMatchSize = propNoMatchSize.Value, + NumberOfFragments = propNumberOfFragments.Value, + Options = propOptions.Value, + Order = propOrder.Value, + PhraseLimit = propPhraseLimit.Value, + PostTags = propPostTags.Value, + PreTags = propPreTags.Value, + RequireFieldMatch = propRequireFieldMatch.Value, + TagsSchema = propTagsSchema.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlightField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoundaryChars, value.BoundaryChars, null, null); + writer.WriteProperty(options, PropBoundaryMaxScan, value.BoundaryMaxScan, null, null); + writer.WriteProperty(options, PropBoundaryScanner, value.BoundaryScanner, null, null); + writer.WriteProperty(options, PropBoundaryScannerLocale, value.BoundaryScannerLocale, null, null); + writer.WriteProperty(options, PropForceSource, value.ForceSource, null, null); + writer.WriteProperty(options, PropFragmenter, value.Fragmenter, null, null); + writer.WriteProperty(options, PropFragmentOffset, value.FragmentOffset, null, null); + writer.WriteProperty(options, PropFragmentSize, value.FragmentSize, null, null); + writer.WriteProperty(options, PropHighlightFilter, value.HighlightFilter, null, null); + writer.WriteProperty(options, PropHighlightQuery, value.HighlightQuery, null, null); + writer.WriteProperty(options, PropMatchedFields, value.MatchedFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropMaxAnalyzedOffset, value.MaxAnalyzedOffset, null, null); + writer.WriteProperty(options, PropMaxFragmentLength, value.MaxFragmentLength, null, null); + writer.WriteProperty(options, PropNoMatchSize, value.NoMatchSize, null, null); + writer.WriteProperty(options, PropNumberOfFragments, value.NumberOfFragments, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropPhraseLimit, value.PhraseLimit, null, null); + writer.WriteProperty(options, PropPostTags, value.PostTags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreTags, value.PreTags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRequireFieldMatch, value.RequireFieldMatch, null, null); + writer.WriteProperty(options, PropTagsSchema, value.TagsSchema, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldConverter))] public sealed partial class HighlightField { +#if NET7_0_OR_GREATER + public HighlightField() + { + } +#endif +#if !NET7_0_OR_GREATER + public HighlightField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that contains each boundary character. /// /// - [JsonInclude, JsonPropertyName("boundary_chars")] public string? BoundaryChars { get; set; } /// @@ -42,7 +291,6 @@ public sealed partial class HighlightField /// How far to scan for boundary characters. /// /// - [JsonInclude, JsonPropertyName("boundary_max_scan")] public int? BoundaryMaxScan { get; set; } /// @@ -52,7 +300,6 @@ public sealed partial class HighlightField /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - [JsonInclude, JsonPropertyName("boundary_scanner")] public Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScanner { get; set; } /// @@ -61,8 +308,8 @@ public sealed partial class HighlightField /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - [JsonInclude, JsonPropertyName("boundary_scanner_locale")] public string? BoundaryScannerLocale { get; set; } + public bool? ForceSource { get; set; } /// /// @@ -70,9 +317,7 @@ public sealed partial class HighlightField /// Only valid for the plain highlighter. /// /// - [JsonInclude, JsonPropertyName("fragmenter")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? Fragmenter { get; set; } - [JsonInclude, JsonPropertyName("fragment_offset")] public int? FragmentOffset { get; set; } /// @@ -80,9 +325,7 @@ public sealed partial class HighlightField /// The size of the highlighted fragment in characters. /// /// - [JsonInclude, JsonPropertyName("fragment_size")] public int? FragmentSize { get; set; } - [JsonInclude, JsonPropertyName("highlight_filter")] public bool? HighlightFilter { get; set; } /// @@ -91,10 +334,7 @@ public sealed partial class HighlightField /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - [JsonInclude, JsonPropertyName("highlight_query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQuery { get; set; } - [JsonInclude, JsonPropertyName("matched_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? MatchedFields { get; set; } /// @@ -104,9 +344,7 @@ public sealed partial class HighlightField /// The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - [JsonInclude, JsonPropertyName("max_analyzed_offset")] public int? MaxAnalyzedOffset { get; set; } - [JsonInclude, JsonPropertyName("max_fragment_length")] public int? MaxFragmentLength { get; set; } /// @@ -114,7 +352,6 @@ public sealed partial class HighlightField /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - [JsonInclude, JsonPropertyName("no_match_size")] public int? NoMatchSize { get; set; } /// @@ -126,10 +363,8 @@ public sealed partial class HighlightField /// If number_of_fragments is 0, fragment_size is ignored. /// /// - [JsonInclude, JsonPropertyName("number_of_fragments")] public int? NumberOfFragments { get; set; } - [JsonInclude, JsonPropertyName("options")] - public IDictionary? Options { get; set; } + public System.Collections.Generic.IDictionary? Options { get; set; } /// /// @@ -139,7 +374,6 @@ public sealed partial class HighlightField /// Each highlighter applies its own logic to compute relevancy scores. /// /// - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? Order { get; set; } /// @@ -150,7 +384,6 @@ public sealed partial class HighlightField /// Only supported by the fvh highlighter. /// /// - [JsonInclude, JsonPropertyName("phrase_limit")] public int? PhraseLimit { get; set; } /// @@ -159,8 +392,7 @@ public sealed partial class HighlightField /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - [JsonInclude, JsonPropertyName("post_tags")] - public ICollection? PostTags { get; set; } + public System.Collections.Generic.ICollection? PostTags { get; set; } /// /// @@ -168,8 +400,7 @@ public sealed partial class HighlightField /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - [JsonInclude, JsonPropertyName("pre_tags")] - public ICollection? PreTags { get; set; } + public System.Collections.Generic.ICollection? PreTags { get; set; } /// /// @@ -177,7 +408,6 @@ public sealed partial class HighlightField /// Set to false to highlight all fields. /// /// - [JsonInclude, JsonPropertyName("require_field_match")] public bool? RequireFieldMatch { get; set; } /// @@ -185,54 +415,38 @@ public sealed partial class HighlightField /// Set to styled to use the built-in tag schema. /// /// - [JsonInclude, JsonPropertyName("tags_schema")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchema { get; set; } - [JsonInclude, JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? Type { get; set; } } -public sealed partial class HighlightFieldDescriptor : SerializableDescriptor> +public readonly partial struct HighlightFieldDescriptor { - internal HighlightFieldDescriptor(Action> configure) => configure.Invoke(this); - - public HighlightFieldDescriptor() : base() - { - } - - private string? BoundaryCharsValue { get; set; } - private int? BoundaryMaxScanValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScannerValue { get; set; } - private string? BoundaryScannerLocaleValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? FragmenterValue { get; set; } - private int? FragmentOffsetValue { get; set; } - private int? FragmentSizeValue { get; set; } - private bool? HighlightFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HighlightQueryDescriptor { get; set; } - private Action> HighlightQueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Fields? MatchedFieldsValue { get; set; } - private int? MaxAnalyzedOffsetValue { get; set; } - private int? MaxFragmentLengthValue { get; set; } - private int? NoMatchSizeValue { get; set; } - private int? NumberOfFragmentsValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? OrderValue { get; set; } - private int? PhraseLimitValue { get; set; } - private ICollection? PostTagsValue { get; set; } - private ICollection? PreTagsValue { get; set; } - private bool? RequireFieldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchemaValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? TypeValue { get; set; } + internal Elastic.Clients.Elasticsearch.Core.Search.HighlightField Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightFieldDescriptor(Elastic.Clients.Elasticsearch.Core.Search.HighlightField instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(Elastic.Clients.Elasticsearch.Core.Search.HighlightField instance) => new Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor descriptor) => descriptor.Instance; /// /// /// A string that contains each boundary character. /// /// - public HighlightFieldDescriptor BoundaryChars(string? boundaryChars) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryChars(string? value) { - BoundaryCharsValue = boundaryChars; - return Self; + Instance.BoundaryChars = value; + return this; } /// @@ -240,10 +454,10 @@ public HighlightFieldDescriptor BoundaryChars(string? boundaryChars) /// How far to scan for boundary characters. /// /// - public HighlightFieldDescriptor BoundaryMaxScan(int? boundaryMaxScan) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryMaxScan(int? value) { - BoundaryMaxScanValue = boundaryMaxScan; - return Self; + Instance.BoundaryMaxScan = value; + return this; } /// @@ -253,10 +467,10 @@ public HighlightFieldDescriptor BoundaryMaxScan(int? boundaryMaxScan) /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - public HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? boundaryScanner) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? value) { - BoundaryScannerValue = boundaryScanner; - return Self; + Instance.BoundaryScanner = value; + return this; } /// @@ -265,10 +479,16 @@ public HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elast /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - public HighlightFieldDescriptor BoundaryScannerLocale(string? boundaryScannerLocale) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryScannerLocale(string? value) + { + Instance.BoundaryScannerLocale = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor ForceSource(bool? value = true) { - BoundaryScannerLocaleValue = boundaryScannerLocale; - return Self; + Instance.ForceSource = value; + return this; } /// @@ -277,16 +497,16 @@ public HighlightFieldDescriptor BoundaryScannerLocale(string? boundar /// Only valid for the plain highlighter. /// /// - public HighlightFieldDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? fragmenter) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? value) { - FragmenterValue = fragmenter; - return Self; + Instance.Fragmenter = value; + return this; } - public HighlightFieldDescriptor FragmentOffset(int? fragmentOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor FragmentOffset(int? value) { - FragmentOffsetValue = fragmentOffset; - return Self; + Instance.FragmentOffset = value; + return this; } /// @@ -294,16 +514,16 @@ public HighlightFieldDescriptor FragmentOffset(int? fragmentOffset) /// The size of the highlighted fragment in characters. /// /// - public HighlightFieldDescriptor FragmentSize(int? fragmentSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor FragmentSize(int? value) { - FragmentSizeValue = fragmentSize; - return Self; + Instance.FragmentSize = value; + return this; } - public HighlightFieldDescriptor HighlightFilter(bool? highlightFilter = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightFilter(bool? value = true) { - HighlightFilterValue = highlightFilter; - return Self; + Instance.HighlightFilter = value; + return this; } /// @@ -312,34 +532,34 @@ public HighlightFieldDescriptor HighlightFilter(bool? highlightFilter /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - public HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? highlightQuery) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = null; - HighlightQueryValue = highlightQuery; - return Self; + Instance.HighlightQuery = value; + return this; } - public HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightQuery(System.Action> action) { - HighlightQueryValue = null; - HighlightQueryDescriptorAction = null; - HighlightQueryDescriptor = descriptor; - return Self; + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HighlightFieldDescriptor HighlightQuery(Action> configure) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elasticsearch.Fields? value) { - HighlightQueryValue = null; - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = configure; - return Self; + Instance.MatchedFields = value; + return this; } - public HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elasticsearch.Fields? matchedFields) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MatchedFields(params System.Linq.Expressions.Expression>[] value) { - MatchedFieldsValue = matchedFields; - return Self; + Instance.MatchedFields = value; + return this; } /// @@ -349,16 +569,16 @@ public HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elastic /// The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - public HighlightFieldDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MaxAnalyzedOffset(int? value) { - MaxAnalyzedOffsetValue = maxAnalyzedOffset; - return Self; + Instance.MaxAnalyzedOffset = value; + return this; } - public HighlightFieldDescriptor MaxFragmentLength(int? maxFragmentLength) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MaxFragmentLength(int? value) { - MaxFragmentLengthValue = maxFragmentLength; - return Self; + Instance.MaxFragmentLength = value; + return this; } /// @@ -366,10 +586,10 @@ public HighlightFieldDescriptor MaxFragmentLength(int? maxFragmentLen /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - public HighlightFieldDescriptor NoMatchSize(int? noMatchSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor NoMatchSize(int? value) { - NoMatchSizeValue = noMatchSize; - return Self; + Instance.NoMatchSize = value; + return this; } /// @@ -381,16 +601,35 @@ public HighlightFieldDescriptor NoMatchSize(int? noMatchSize) /// If number_of_fragments is 0, fragment_size is ignored. /// /// - public HighlightFieldDescriptor NumberOfFragments(int? numberOfFragments) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor NumberOfFragments(int? value) + { + Instance.NumberOfFragments = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options(System.Collections.Generic.IDictionary? value) + { + Instance.Options = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options() + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options(System.Action? action) { - NumberOfFragmentsValue = numberOfFragments; - return Self; + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public HighlightFieldDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor AddOption(string key, object value) { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -401,10 +640,10 @@ public HighlightFieldDescriptor Options(Func /// - public HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? order) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -415,10 +654,10 @@ public HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.C /// Only supported by the fvh highlighter. /// /// - public HighlightFieldDescriptor PhraseLimit(int? phraseLimit) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PhraseLimit(int? value) { - PhraseLimitValue = phraseLimit; - return Self; + Instance.PhraseLimit = value; + return this; } /// @@ -427,10 +666,22 @@ public HighlightFieldDescriptor PhraseLimit(int? phraseLimit) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightFieldDescriptor PostTags(ICollection? postTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PostTags(System.Collections.Generic.ICollection? value) { - PostTagsValue = postTags; - return Self; + Instance.PostTags = value; + return this; + } + + /// + /// + /// Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PostTags(params string[] values) + { + Instance.PostTags = [.. values]; + return this; } /// @@ -439,10 +690,22 @@ public HighlightFieldDescriptor PostTags(ICollection? postTag /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightFieldDescriptor PreTags(ICollection? preTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PreTags(System.Collections.Generic.ICollection? value) { - PreTagsValue = preTags; - return Self; + Instance.PreTags = value; + return this; + } + + /// + /// + /// Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PreTags(params string[] values) + { + Instance.PreTags = [.. values]; + return this; } /// @@ -451,10 +714,10 @@ public HighlightFieldDescriptor PreTags(ICollection? preTags) /// Set to false to highlight all fields. /// /// - public HighlightFieldDescriptor RequireFieldMatch(bool? requireFieldMatch = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor RequireFieldMatch(bool? value = true) { - RequireFieldMatchValue = requireFieldMatch; - return Self; + Instance.RequireFieldMatch = value; + return this; } /// @@ -462,209 +725,60 @@ public HighlightFieldDescriptor RequireFieldMatch(bool? requireFieldM /// Set to styled to use the built-in tag schema. /// /// - public HighlightFieldDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? tagsSchema) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? value) { - TagsSchemaValue = tagsSchema; - return Self; + Instance.TagsSchema = value; + return this; } - public HighlightFieldDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? type) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.HighlightField Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BoundaryCharsValue)) - { - writer.WritePropertyName("boundary_chars"); - writer.WriteStringValue(BoundaryCharsValue); - } - - if (BoundaryMaxScanValue.HasValue) - { - writer.WritePropertyName("boundary_max_scan"); - writer.WriteNumberValue(BoundaryMaxScanValue.Value); - } - - if (BoundaryScannerValue is not null) - { - writer.WritePropertyName("boundary_scanner"); - JsonSerializer.Serialize(writer, BoundaryScannerValue, options); - } - - if (!string.IsNullOrEmpty(BoundaryScannerLocaleValue)) - { - writer.WritePropertyName("boundary_scanner_locale"); - writer.WriteStringValue(BoundaryScannerLocaleValue); - } - - if (FragmenterValue is not null) - { - writer.WritePropertyName("fragmenter"); - JsonSerializer.Serialize(writer, FragmenterValue, options); - } - - if (FragmentOffsetValue.HasValue) - { - writer.WritePropertyName("fragment_offset"); - writer.WriteNumberValue(FragmentOffsetValue.Value); - } - - if (FragmentSizeValue.HasValue) - { - writer.WritePropertyName("fragment_size"); - writer.WriteNumberValue(FragmentSizeValue.Value); - } - - if (HighlightFilterValue.HasValue) + if (action is null) { - writer.WritePropertyName("highlight_filter"); - writer.WriteBooleanValue(HighlightFilterValue.Value); + return new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (HighlightQueryDescriptor is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryDescriptor, options); - } - else if (HighlightQueryDescriptorAction is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(HighlightQueryDescriptorAction), options); - } - else if (HighlightQueryValue is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryValue, options); - } - - if (MatchedFieldsValue is not null) - { - writer.WritePropertyName("matched_fields"); - JsonSerializer.Serialize(writer, MatchedFieldsValue, options); - } - - if (MaxAnalyzedOffsetValue.HasValue) - { - writer.WritePropertyName("max_analyzed_offset"); - writer.WriteNumberValue(MaxAnalyzedOffsetValue.Value); - } - - if (MaxFragmentLengthValue.HasValue) - { - writer.WritePropertyName("max_fragment_length"); - writer.WriteNumberValue(MaxFragmentLengthValue.Value); - } - - if (NoMatchSizeValue.HasValue) - { - writer.WritePropertyName("no_match_size"); - writer.WriteNumberValue(NoMatchSizeValue.Value); - } - - if (NumberOfFragmentsValue.HasValue) - { - writer.WritePropertyName("number_of_fragments"); - writer.WriteNumberValue(NumberOfFragmentsValue.Value); - } - - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (PhraseLimitValue.HasValue) - { - writer.WritePropertyName("phrase_limit"); - writer.WriteNumberValue(PhraseLimitValue.Value); - } - - if (PostTagsValue is not null) - { - writer.WritePropertyName("post_tags"); - JsonSerializer.Serialize(writer, PostTagsValue, options); - } - - if (PreTagsValue is not null) - { - writer.WritePropertyName("pre_tags"); - JsonSerializer.Serialize(writer, PreTagsValue, options); - } - - if (RequireFieldMatchValue.HasValue) - { - writer.WritePropertyName("require_field_match"); - writer.WriteBooleanValue(RequireFieldMatchValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TagsSchemaValue is not null) - { - writer.WritePropertyName("tags_schema"); - JsonSerializer.Serialize(writer, TagsSchemaValue, options); - } +public readonly partial struct HighlightFieldDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.Search.HighlightField Instance { get; init; } - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightFieldDescriptor(Elastic.Clients.Elasticsearch.Core.Search.HighlightField instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HighlightFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class HighlightFieldDescriptor : SerializableDescriptor -{ - internal HighlightFieldDescriptor(Action configure) => configure.Invoke(this); - - public HighlightFieldDescriptor() : base() - { - } - - private string? BoundaryCharsValue { get; set; } - private int? BoundaryMaxScanValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? BoundaryScannerValue { get; set; } - private string? BoundaryScannerLocaleValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? FragmenterValue { get; set; } - private int? FragmentOffsetValue { get; set; } - private int? FragmentSizeValue { get; set; } - private bool? HighlightFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? HighlightQueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HighlightQueryDescriptor { get; set; } - private Action HighlightQueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Fields? MatchedFieldsValue { get; set; } - private int? MaxAnalyzedOffsetValue { get; set; } - private int? MaxFragmentLengthValue { get; set; } - private int? NoMatchSizeValue { get; set; } - private int? NumberOfFragmentsValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? OrderValue { get; set; } - private int? PhraseLimitValue { get; set; } - private ICollection? PostTagsValue { get; set; } - private ICollection? PreTagsValue { get; set; } - private bool? RequireFieldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? TagsSchemaValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(Elastic.Clients.Elasticsearch.Core.Search.HighlightField instance) => new Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor descriptor) => descriptor.Instance; /// /// /// A string that contains each boundary character. /// /// - public HighlightFieldDescriptor BoundaryChars(string? boundaryChars) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryChars(string? value) { - BoundaryCharsValue = boundaryChars; - return Self; + Instance.BoundaryChars = value; + return this; } /// @@ -672,10 +786,10 @@ public HighlightFieldDescriptor BoundaryChars(string? boundaryChars) /// How far to scan for boundary characters. /// /// - public HighlightFieldDescriptor BoundaryMaxScan(int? boundaryMaxScan) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryMaxScan(int? value) { - BoundaryMaxScanValue = boundaryMaxScan; - return Self; + Instance.BoundaryMaxScan = value; + return this; } /// @@ -685,10 +799,10 @@ public HighlightFieldDescriptor BoundaryMaxScan(int? boundaryMaxScan) /// Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter. /// /// - public HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? boundaryScanner) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner? value) { - BoundaryScannerValue = boundaryScanner; - return Self; + Instance.BoundaryScanner = value; + return this; } /// @@ -697,10 +811,16 @@ public HighlightFieldDescriptor BoundaryScanner(Elastic.Clients.Elasticsearch.Co /// This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP". /// /// - public HighlightFieldDescriptor BoundaryScannerLocale(string? boundaryScannerLocale) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor BoundaryScannerLocale(string? value) + { + Instance.BoundaryScannerLocale = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor ForceSource(bool? value = true) { - BoundaryScannerLocaleValue = boundaryScannerLocale; - return Self; + Instance.ForceSource = value; + return this; } /// @@ -709,16 +829,16 @@ public HighlightFieldDescriptor BoundaryScannerLocale(string? boundaryScannerLoc /// Only valid for the plain highlighter. /// /// - public HighlightFieldDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? fragmenter) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Fragmenter(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter? value) { - FragmenterValue = fragmenter; - return Self; + Instance.Fragmenter = value; + return this; } - public HighlightFieldDescriptor FragmentOffset(int? fragmentOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor FragmentOffset(int? value) { - FragmentOffsetValue = fragmentOffset; - return Self; + Instance.FragmentOffset = value; + return this; } /// @@ -726,16 +846,16 @@ public HighlightFieldDescriptor FragmentOffset(int? fragmentOffset) /// The size of the highlighted fragment in characters. /// /// - public HighlightFieldDescriptor FragmentSize(int? fragmentSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor FragmentSize(int? value) { - FragmentSizeValue = fragmentSize; - return Self; + Instance.FragmentSize = value; + return this; } - public HighlightFieldDescriptor HighlightFilter(bool? highlightFilter = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightFilter(bool? value = true) { - HighlightFilterValue = highlightFilter; - return Self; + Instance.HighlightFilter = value; + return this; } /// @@ -744,34 +864,46 @@ public HighlightFieldDescriptor HighlightFilter(bool? highlightFilter = true) /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. /// /// - public HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? highlightQuery) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = null; - HighlightQueryValue = highlightQuery; - return Self; + Instance.HighlightQuery = value; + return this; } - public HighlightFieldDescriptor HighlightQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightQuery(System.Action action) + { + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Highlight matches for a query other than the search query. + /// This is especially useful if you use a rescore query because those are not taken into account by highlighting by default. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor HighlightQuery(System.Action> action) { - HighlightQueryValue = null; - HighlightQueryDescriptorAction = null; - HighlightQueryDescriptor = descriptor; - return Self; + Instance.HighlightQuery = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HighlightFieldDescriptor HighlightQuery(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elasticsearch.Fields? value) { - HighlightQueryValue = null; - HighlightQueryDescriptor = null; - HighlightQueryDescriptorAction = configure; - return Self; + Instance.MatchedFields = value; + return this; } - public HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elasticsearch.Fields? matchedFields) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MatchedFields(params System.Linq.Expressions.Expression>[] value) { - MatchedFieldsValue = matchedFields; - return Self; + Instance.MatchedFields = value; + return this; } /// @@ -781,16 +913,16 @@ public HighlightFieldDescriptor MatchedFields(Elastic.Clients.Elasticsearch.Fiel /// The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting. /// /// - public HighlightFieldDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MaxAnalyzedOffset(int? value) { - MaxAnalyzedOffsetValue = maxAnalyzedOffset; - return Self; + Instance.MaxAnalyzedOffset = value; + return this; } - public HighlightFieldDescriptor MaxFragmentLength(int? maxFragmentLength) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor MaxFragmentLength(int? value) { - MaxFragmentLengthValue = maxFragmentLength; - return Self; + Instance.MaxFragmentLength = value; + return this; } /// @@ -798,10 +930,10 @@ public HighlightFieldDescriptor MaxFragmentLength(int? maxFragmentLength) /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. /// /// - public HighlightFieldDescriptor NoMatchSize(int? noMatchSize) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor NoMatchSize(int? value) { - NoMatchSizeValue = noMatchSize; - return Self; + Instance.NoMatchSize = value; + return this; } /// @@ -813,16 +945,35 @@ public HighlightFieldDescriptor NoMatchSize(int? noMatchSize) /// If number_of_fragments is 0, fragment_size is ignored. /// /// - public HighlightFieldDescriptor NumberOfFragments(int? numberOfFragments) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor NumberOfFragments(int? value) + { + Instance.NumberOfFragments = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options(System.Collections.Generic.IDictionary? value) + { + Instance.Options = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options() + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Options(System.Action? action) { - NumberOfFragmentsValue = numberOfFragments; - return Self; + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public HighlightFieldDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor AddOption(string key, object value) { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -833,10 +984,10 @@ public HighlightFieldDescriptor Options(Func, F /// Each highlighter applies its own logic to compute relevancy scores. /// /// - public HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? order) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -847,10 +998,22 @@ public HighlightFieldDescriptor Order(Elastic.Clients.Elasticsearch.Core.Search. /// Only supported by the fvh highlighter. /// /// - public HighlightFieldDescriptor PhraseLimit(int? phraseLimit) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PhraseLimit(int? value) + { + Instance.PhraseLimit = value; + return this; + } + + /// + /// + /// Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PostTags(System.Collections.Generic.ICollection? value) { - PhraseLimitValue = phraseLimit; - return Self; + Instance.PostTags = value; + return this; } /// @@ -859,10 +1022,22 @@ public HighlightFieldDescriptor PhraseLimit(int? phraseLimit) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightFieldDescriptor PostTags(ICollection? postTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PostTags(params string[] values) + { + Instance.PostTags = [.. values]; + return this; + } + + /// + /// + /// Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. + /// By default, highlighted text is wrapped in <em> and </em> tags. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PreTags(System.Collections.Generic.ICollection? value) { - PostTagsValue = postTags; - return Self; + Instance.PreTags = value; + return this; } /// @@ -871,10 +1046,10 @@ public HighlightFieldDescriptor PostTags(ICollection? postTags) /// By default, highlighted text is wrapped in <em> and </em> tags. /// /// - public HighlightFieldDescriptor PreTags(ICollection? preTags) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor PreTags(params string[] values) { - PreTagsValue = preTags; - return Self; + Instance.PreTags = [.. values]; + return this; } /// @@ -883,10 +1058,10 @@ public HighlightFieldDescriptor PreTags(ICollection? preTags) /// Set to false to highlight all fields. /// /// - public HighlightFieldDescriptor RequireFieldMatch(bool? requireFieldMatch = true) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor RequireFieldMatch(bool? value = true) { - RequireFieldMatchValue = requireFieldMatch; - return Self; + Instance.RequireFieldMatch = value; + return this; } /// @@ -894,163 +1069,28 @@ public HighlightFieldDescriptor RequireFieldMatch(bool? requireFieldMatch = true /// Set to styled to use the built-in tag schema. /// /// - public HighlightFieldDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? tagsSchema) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor TagsSchema(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema? value) { - TagsSchemaValue = tagsSchema; - return Self; + Instance.TagsSchema = value; + return this; } - public HighlightFieldDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? type) + public Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor Type(Elastic.Clients.Elasticsearch.Core.Search.HighlighterType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.HighlightField Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BoundaryCharsValue)) - { - writer.WritePropertyName("boundary_chars"); - writer.WriteStringValue(BoundaryCharsValue); - } - - if (BoundaryMaxScanValue.HasValue) + if (action is null) { - writer.WritePropertyName("boundary_max_scan"); - writer.WriteNumberValue(BoundaryMaxScanValue.Value); + return new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (BoundaryScannerValue is not null) - { - writer.WritePropertyName("boundary_scanner"); - JsonSerializer.Serialize(writer, BoundaryScannerValue, options); - } - - if (!string.IsNullOrEmpty(BoundaryScannerLocaleValue)) - { - writer.WritePropertyName("boundary_scanner_locale"); - writer.WriteStringValue(BoundaryScannerLocaleValue); - } - - if (FragmenterValue is not null) - { - writer.WritePropertyName("fragmenter"); - JsonSerializer.Serialize(writer, FragmenterValue, options); - } - - if (FragmentOffsetValue.HasValue) - { - writer.WritePropertyName("fragment_offset"); - writer.WriteNumberValue(FragmentOffsetValue.Value); - } - - if (FragmentSizeValue.HasValue) - { - writer.WritePropertyName("fragment_size"); - writer.WriteNumberValue(FragmentSizeValue.Value); - } - - if (HighlightFilterValue.HasValue) - { - writer.WritePropertyName("highlight_filter"); - writer.WriteBooleanValue(HighlightFilterValue.Value); - } - - if (HighlightQueryDescriptor is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryDescriptor, options); - } - else if (HighlightQueryDescriptorAction is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(HighlightQueryDescriptorAction), options); - } - else if (HighlightQueryValue is not null) - { - writer.WritePropertyName("highlight_query"); - JsonSerializer.Serialize(writer, HighlightQueryValue, options); - } - - if (MatchedFieldsValue is not null) - { - writer.WritePropertyName("matched_fields"); - JsonSerializer.Serialize(writer, MatchedFieldsValue, options); - } - - if (MaxAnalyzedOffsetValue.HasValue) - { - writer.WritePropertyName("max_analyzed_offset"); - writer.WriteNumberValue(MaxAnalyzedOffsetValue.Value); - } - - if (MaxFragmentLengthValue.HasValue) - { - writer.WritePropertyName("max_fragment_length"); - writer.WriteNumberValue(MaxFragmentLengthValue.Value); - } - - if (NoMatchSizeValue.HasValue) - { - writer.WritePropertyName("no_match_size"); - writer.WriteNumberValue(NoMatchSizeValue.Value); - } - - if (NumberOfFragmentsValue.HasValue) - { - writer.WritePropertyName("number_of_fragments"); - writer.WriteNumberValue(NumberOfFragmentsValue.Value); - } - - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (PhraseLimitValue.HasValue) - { - writer.WritePropertyName("phrase_limit"); - writer.WriteNumberValue(PhraseLimitValue.Value); - } - - if (PostTagsValue is not null) - { - writer.WritePropertyName("post_tags"); - JsonSerializer.Serialize(writer, PostTagsValue, options); - } - - if (PreTagsValue is not null) - { - writer.WritePropertyName("pre_tags"); - JsonSerializer.Serialize(writer, PreTagsValue, options); - } - - if (RequireFieldMatchValue.HasValue) - { - writer.WritePropertyName("require_field_match"); - writer.WriteBooleanValue(RequireFieldMatchValue.Value); - } - - if (TagsSchemaValue is not null) - { - writer.WritePropertyName("tags_schema"); - JsonSerializer.Serialize(writer, TagsSchemaValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.HighlightFieldDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.HighlightField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Hit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Hit.g.cs index bddd3f292b6..4c6a804bcf6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Hit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Hit.g.cs @@ -17,57 +17,291 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class HitConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropExplanation = System.Text.Json.JsonEncodedText.Encode("_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIgnored = System.Text.Json.JsonEncodedText.Encode("_ignored"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoredFieldValues = System.Text.Json.JsonEncodedText.Encode("ignored_field_values"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropMatchedQueries = System.Text.Json.JsonEncodedText.Encode("matched_queries"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("_nested"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("_node"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropRank = System.Text.Json.JsonEncodedText.Encode("_rank"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("_score"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShard = System.Text.Json.JsonEncodedText.Encode("_shard"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.Core.Search.Hit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExplanation = default; + LocalJsonValue?> propFields = default; + LocalJsonValue>?> propHighlight = default; + LocalJsonValue propId = default; + LocalJsonValue?> propIgnored = default; + LocalJsonValue>?> propIgnoredFieldValues = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propInnerHits = default; + LocalJsonValue, System.Collections.Generic.IReadOnlyDictionary>?> propMatchedQueries = default; + LocalJsonValue propNested = default; + LocalJsonValue propNode = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propRank = default; + LocalJsonValue propRouting = default; + LocalJsonValue propScore = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShard = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExplanation.TryReadProperty(ref reader, options, PropExplanation, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIgnored.TryReadProperty(ref reader, options, PropIgnored, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIgnoredFieldValues.TryReadProperty(ref reader, options, PropIgnoredFieldValues, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMatchedQueries.TryReadProperty(ref reader, options, PropMatchedQueries, static Elastic.Clients.Elasticsearch.Union, System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue, System.Collections.Generic.IReadOnlyDictionary>(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject), static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propRank.TryReadProperty(ref reader, options, PropRank, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShard.TryReadProperty(ref reader, options, PropShard, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static TDocument? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Hit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Explanation = propExplanation.Value, + Fields = propFields.Value, + Highlight = propHighlight.Value, + Id = propId.Value, + Ignored = propIgnored.Value, + IgnoredFieldValues = propIgnoredFieldValues.Value, + Index = propIndex.Value, + InnerHits = propInnerHits.Value, + MatchedQueries = propMatchedQueries.Value, + Nested = propNested.Value, + Node = propNode.Value, + PrimaryTerm = propPrimaryTerm.Value, + Rank = propRank.Value, + Routing = propRouting.Value, + Score = propScore.Value, + SeqNo = propSeqNo.Value, + Shard = propShard.Value, + Sort = propSort.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Hit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExplanation, value.Explanation, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIgnored, value.Ignored, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoredFieldValues, value.IgnoredFieldValues, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMatchedQueries, value.MatchedQueries, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteUnionValue, System.Collections.Generic.IReadOnlyDictionary>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null), static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropRank, value.Rank, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShard, value.Shard, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TDocument? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class HitConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(Hit<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(HitConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HitConverterFactory))] public sealed partial class Hit { - [JsonInclude, JsonPropertyName("_explanation")] - public Elastic.Clients.Elasticsearch.Core.Explain.Explanation? Explanation { get; init; } - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary? Fields { get; init; } - [JsonInclude, JsonPropertyName("highlight")] - public IReadOnlyDictionary>? Highlight { get; init; } - [JsonInclude, JsonPropertyName("_id")] - public string? Id { get; init; } - [JsonInclude, JsonPropertyName("_ignored")] - public IReadOnlyCollection? Ignored { get; init; } - [JsonInclude, JsonPropertyName("ignored_field_values")] - public IReadOnlyDictionary>? IgnoredFieldValues { get; init; } - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("inner_hits")] - public IReadOnlyDictionary? InnerHits { get; init; } - [JsonInclude, JsonPropertyName("matched_queries")] - public IReadOnlyCollection? MatchedQueries { get; init; } - [JsonInclude, JsonPropertyName("_nested")] - public Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity? Nested { get; init; } - [JsonInclude, JsonPropertyName("_node")] - public string? Node { get; init; } - [JsonInclude, JsonPropertyName("_primary_term")] - public long? PrimaryTerm { get; init; } - [JsonInclude, JsonPropertyName("_rank")] - public int? Rank { get; init; } - [JsonInclude, JsonPropertyName("_routing")] - public string? Routing { get; init; } - [JsonInclude, JsonPropertyName("_score")] - public double? Score { get; init; } - [JsonInclude, JsonPropertyName("_seq_no")] - public long? SeqNo { get; init; } - [JsonInclude, JsonPropertyName("_shard")] - public string? Shard { get; init; } - [JsonInclude, JsonPropertyName("sort")] - public IReadOnlyCollection? Sort { get; init; } - [JsonInclude, JsonPropertyName("_source")] - [SourceConverter] - public TDocument? Source { get; init; } - [JsonInclude, JsonPropertyName("_version")] - public long? Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Hit(string id, string index) + { + Id = id; + Index = index; + } +#if NET7_0_OR_GREATER + public Hit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Hit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Hit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.Explain.Explanation? Explanation { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>? Highlight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Ignored { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>? IgnoredFieldValues { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? InnerHits { get; set; } + public Elastic.Clients.Elasticsearch.Union, System.Collections.Generic.IReadOnlyDictionary>? MatchedQueries { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity? Nested { get; set; } + public string? Node { get; set; } + public long? PrimaryTerm { get; set; } + public int? Rank { get; set; } + public string? Routing { get; set; } + public double? Score { get; set; } + public long? SeqNo { get; set; } + public string? Shard { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Sort { get; set; } + public TDocument? Source { get; set; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HitsMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HitsMetadata.g.cs index 78f5579d8de..15639f6112e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HitsMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/HitsMetadata.g.cs @@ -17,28 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class HitsMetadataConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScore = System.Text.Json.JsonEncodedText.Encode("max_score"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propHits = default; + LocalJsonValue propMaxScore = default; + LocalJsonValue?> propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!)) + { + continue; + } + + if (propMaxScore.TryReadProperty(ref reader, options, PropMaxScore, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number), null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value, + MaxScore = propMaxScore.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropMaxScore, value.MaxScore, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +internal sealed partial class HitsMetadataConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(HitsMetadata<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(HitsMetadataConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HitsMetadataConverterFactory))] public sealed partial class HitsMetadata { - [JsonInclude, JsonPropertyName("hits")] - public IReadOnlyCollection> Hits { get; init; } - [JsonInclude, JsonPropertyName("max_score")] - public double? MaxScore { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HitsMetadata(System.Collections.Generic.IReadOnlyCollection> hits) + { + Hits = hits; + } +#if NET7_0_OR_GREATER + public HitsMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HitsMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HitsMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Hits { get; set; } + public double? MaxScore { get; set; } /// /// /// Total hit count information, present only if track_total_hits wasn't false in the search request. /// /// - [JsonInclude, JsonPropertyName("total")] - public Union? Total { get; init; } + public Elastic.Clients.Elasticsearch.Union? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHits.g.cs index f896031d7d9..9077d2fd992 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHits.g.cs @@ -17,26 +17,208 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class InnerHitsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropDocvalueFields = System.Text.Json.JsonEncodedText.Encode("docvalue_fields"); + private static readonly System.Text.Json.JsonEncodedText PropExplain = System.Text.Json.JsonEncodedText.Encode("explain"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNoPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("seq_no_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropTrackScores = System.Text.Json.JsonEncodedText.Encode("track_scores"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Core.Search.InnerHits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollapse = default; + LocalJsonValue?> propDocvalueFields = default; + LocalJsonValue propExplain = default; + LocalJsonValue propFields = default; + LocalJsonValue propFrom = default; + LocalJsonValue propHighlight = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propName = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propSeqNoPrimaryTerm = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propSource = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propTrackScores = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } + + if (propDocvalueFields.TryReadProperty(ref reader, options, PropDocvalueFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propExplain.TryReadProperty(ref reader, options, PropExplain, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSeqNoPrimaryTerm.TryReadProperty(ref reader, options, PropSeqNoPrimaryTerm, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propTrackScores.TryReadProperty(ref reader, options, PropTrackScores, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collapse = propCollapse.Value, + DocvalueFields = propDocvalueFields.Value, + Explain = propExplain.Value, + Fields = propFields.Value, + From = propFrom.Value, + Highlight = propHighlight.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + Name = propName.Value, + ScriptFields = propScriptFields.Value, + SeqNoPrimaryTerm = propSeqNoPrimaryTerm.Value, + Size = propSize.Value, + Sort = propSort.Value, + Source = propSource.Value, + StoredFields = propStoredFields.Value, + TrackScores = propTrackScores.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.InnerHits value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropDocvalueFields, value.DocvalueFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropExplain, value.Explain, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSeqNoPrimaryTerm, value.SeqNoPrimaryTerm, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropTrackScores, value.TrackScores, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsConverter))] public sealed partial class InnerHits { - [JsonInclude, JsonPropertyName("collapse")] +#if NET7_0_OR_GREATER + public InnerHits() + { + } +#endif +#if !NET7_0_OR_GREATER + public InnerHits() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } - [JsonInclude, JsonPropertyName("docvalue_fields")] - public ICollection? DocvalueFields { get; set; } - [JsonInclude, JsonPropertyName("explain")] + public System.Collections.Generic.ICollection? DocvalueFields { get; set; } public bool? Explain { get; set; } - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -44,11 +226,8 @@ public sealed partial class InnerHits /// Inner hit starting document offset. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } - [JsonInclude, JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Core.Search.Highlight? Highlight { get; set; } - [JsonInclude, JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } /// @@ -57,11 +236,8 @@ public sealed partial class InnerHits /// Useful when a search request contains multiple inner hits. /// /// - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Name? Name { get; set; } - [JsonInclude, JsonPropertyName("script_fields")] - public IDictionary? ScriptFields { get; set; } - [JsonInclude, JsonPropertyName("seq_no_primary_term")] + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } public bool? SeqNoPrimaryTerm { get; set; } /// @@ -69,7 +245,6 @@ public sealed partial class InnerHits /// The maximum number of hits to return per inner_hits. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -78,125 +253,84 @@ public sealed partial class InnerHits /// By default, inner hits are sorted by score. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } - [JsonInclude, JsonPropertyName("_source")] + public System.Collections.Generic.ICollection? Sort { get; set; } public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? Source { get; set; } - [JsonInclude, JsonPropertyName("stored_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? StoredFields { get; set; } - [JsonInclude, JsonPropertyName("track_scores")] public bool? TrackScores { get; set; } - [JsonInclude, JsonPropertyName("version")] public bool? Version { get; set; } } -public sealed partial class InnerHitsDescriptor : SerializableDescriptor> +public readonly partial struct InnerHitsDescriptor { - internal InnerHitsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.InnerHits Instance { get; init; } - public InnerHitsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InnerHitsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.InnerHits instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action> DocvalueFieldsDescriptorAction { get; set; } - private Action>[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action> HighlightDescriptorAction { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private bool? TrackScoresValue { get; set; } - private bool? VersionValue { get; set; } - - public InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InnerHitsDescriptor() { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.InnerHits instance) => new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Collapse = value; + return this; } - public InnerHitsDescriptor Collapse(Action> configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } - public InnerHitsDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.DocvalueFields = value; + return this; } - public InnerHitsDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.DocvalueFields = [.. values]; + return this; } - public InnerHitsDescriptor DocvalueFields(Action> configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(params System.Action>[] actions) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); + } + + Instance.DocvalueFields = items; + return this; } - public InnerHitsDescriptor DocvalueFields(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Explain(bool? value = true) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.Explain = value; + return this; } - public InnerHitsDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - ExplainValue = explain; - return Self; + Instance.Fields = value; + return this; } - public InnerHitsDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -204,40 +338,28 @@ public InnerHitsDescriptor Fields(Elastic.Clients.Elasticsearch.Field /// Inner hit starting document offset. /// /// - public InnerHitsDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } - public InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.Highlight = value; + return this; } - public InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Highlight(System.Action> action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public InnerHitsDescriptor Highlight(Action> configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor IgnoreUnmapped(bool? value = true) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; - } - - public InnerHitsDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) - { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -246,22 +368,62 @@ public InnerHitsDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true /// Useful when a search request contains multiple inner hits. /// /// - public InnerHitsDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields(System.Action>? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(Elastic.Clients.Elasticsearch.Field key, System.Action action) { - NameValue = name; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } - public InnerHitsDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(System.Linq.Expressions.Expression> key, System.Action action) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } - public InnerHitsDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor SeqNoPrimaryTerm(bool? value = true) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// @@ -269,10 +431,10 @@ public InnerHitsDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = /// The maximum number of hits to return per inner_hits. /// /// - public InnerHitsDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -281,418 +443,339 @@ public InnerHitsDescriptor Size(int? size) /// By default, inner hits are sorted by score. /// /// - public InnerHitsDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public InnerHitsDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// How the inner hits should be sorted per inner_hits. + /// By default, inner hits are sorted by score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public InnerHitsDescriptor Sort(Action> configure) + /// + /// + /// How the inner hits should be sorted per inner_hits. + /// By default, inner hits are sorted by score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } - public InnerHitsDescriptor Sort(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Source = value; + return this; } - public InnerHitsDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - SourceValue = source; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public InnerHitsDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - StoredFieldsValue = storedFields; - return Self; + Instance.StoredFields = value; + return this; } - public InnerHitsDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - TrackScoresValue = trackScores; - return Self; + Instance.StoredFields = value; + return this; } - public InnerHitsDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor TrackScores(bool? value = true) { - VersionValue = version; - return Self; + Instance.TrackScores = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Version(bool? value = true) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } + Instance.Version = value; + return this; + } - if (ExplainValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.InnerHits Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); + return new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } +public readonly partial struct InnerHitsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.Search.InnerHits Instance { get; init; } - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InnerHitsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.InnerHits instance) + { + Instance = instance; + } - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InnerHitsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.InnerHits instance) => new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) => descriptor.Instance; - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) + { + Instance.Collapse = value; + return this; + } - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Collapse(System.Action action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Collapse(System.Action> action) + { + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; + } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(System.Collections.Generic.ICollection? value) + { + Instance.DocvalueFields = value; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(params Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat[] values) + { + Instance.DocvalueFields = [.. values]; + return this; + } - if (SourceValue is not null) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); } - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } + Instance.DocvalueFields = items; + return this; + } - if (TrackScoresValue.HasValue) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor DocvalueFields(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor.Build(action)); } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } + Instance.DocvalueFields = items; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Explain(bool? value = true) + { + Instance.Explain = value; + return this; } -} -public sealed partial class InnerHitsDescriptor : SerializableDescriptor -{ - internal InnerHitsDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.Fields = value; + return this; + } - public InnerHitsDescriptor() : base() + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { + Instance.Fields = value; + return this; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private ICollection? DocvalueFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor DocvalueFieldsDescriptor { get; set; } - private Action DocvalueFieldsDescriptorAction { get; set; } - private Action[] DocvalueFieldsDescriptorActions { get; set; } - private bool? ExplainValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private int? FromValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.Highlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private bool? SeqNoPrimaryTermValue { get; set; } - private int? SizeValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? StoredFieldsValue { get; set; } - private bool? TrackScoresValue { get; set; } - private bool? VersionValue { get; set; } + /// + /// + /// Inner hit starting document offset. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor From(int? value) + { + Instance.From = value; + return this; + } - public InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? value) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance.Highlight = value; + return this; } - public InnerHitsDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Highlight(System.Action action) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public InnerHitsDescriptor Collapse(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Highlight(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor.Build(action); + return this; } - public InnerHitsDescriptor DocvalueFields(ICollection? docvalueFields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor IgnoreUnmapped(bool? value = true) { - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsValue = docvalueFields; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public InnerHitsDescriptor DocvalueFields(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) + /// + /// + /// The name for the particular inner hit definition in the response. + /// Useful when a search request contains multiple inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptor = descriptor; - return Self; + Instance.Name = value; + return this; } - public InnerHitsDescriptor DocvalueFields(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorActions = null; - DocvalueFieldsDescriptorAction = configure; - return Self; + Instance.ScriptFields = value; + return this; } - public InnerHitsDescriptor DocvalueFields(params Action[] configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields() { - DocvalueFieldsValue = null; - DocvalueFieldsDescriptor = null; - DocvalueFieldsDescriptorAction = null; - DocvalueFieldsDescriptorActions = configure; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField.Build(null); + return this; } - public InnerHitsDescriptor Explain(bool? explain = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields(System.Action? action) { - ExplainValue = explain; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField.Build(action); + return this; } - public InnerHitsDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor ScriptFields(System.Action>? action) { - FieldsValue = fields; - return Self; + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldScriptField.Build(action); + return this; } - /// - /// - /// Inner hit starting document offset. - /// - /// - public InnerHitsDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.ScriptField value) { - FromValue = from; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; } - public InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.Highlight? highlight) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.ScriptField value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; } - public InnerHitsDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(Elastic.Clients.Elasticsearch.Field key, System.Action action) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } - public InnerHitsDescriptor Highlight(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor AddScriptField(System.Linq.Expressions.Expression> key, System.Action action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; } - public InnerHitsDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor SeqNoPrimaryTerm(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.SeqNoPrimaryTerm = value; + return this; } /// /// - /// The name for the particular inner hit definition in the response. - /// Useful when a search request contains multiple inner hits. + /// The maximum number of hits to return per inner_hits. /// /// - public InnerHitsDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Size(int? value) { - NameValue = name; - return Self; + Instance.Size = value; + return this; } - public InnerHitsDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + /// + /// + /// How the inner hits should be sorted per inner_hits. + /// By default, inner hits are sorted by score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(System.Collections.Generic.ICollection? value) { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Sort = value; + return this; } - public InnerHitsDescriptor SeqNoPrimaryTerm(bool? seqNoPrimaryTerm = true) + /// + /// + /// How the inner hits should be sorted per inner_hits. + /// By default, inner hits are sorted by score. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SeqNoPrimaryTermValue = seqNoPrimaryTerm; - return Self; + Instance.Sort = [.. values]; + return this; } /// /// - /// The maximum number of hits to return per inner_hits. + /// How the inner hits should be sorted per inner_hits. + /// By default, inner hits are sorted by score. /// /// - public InnerHitsDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(params System.Action[] actions) { - SizeValue = size; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } /// @@ -701,233 +784,70 @@ public InnerHitsDescriptor Size(int? size) /// By default, inner hits are sorted by score. /// /// - public InnerHitsDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Sort(params System.Action>[] actions) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } + + Instance.Sort = items; + return this; } - public InnerHitsDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? value) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public InnerHitsDescriptor Sort(Action configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Source(System.Func action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public InnerHitsDescriptor Sort(params Action[] configure) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Source(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory.Build(action); + return this; } - public InnerHitsDescriptor Source(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig? source) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? value) { - SourceValue = source; - return Self; + Instance.StoredFields = value; + return this; } - public InnerHitsDescriptor StoredFields(Elastic.Clients.Elasticsearch.Fields? storedFields) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor StoredFields(params System.Linq.Expressions.Expression>[] value) { - StoredFieldsValue = storedFields; - return Self; + Instance.StoredFields = value; + return this; } - public InnerHitsDescriptor TrackScores(bool? trackScores = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor TrackScores(bool? value = true) { - TrackScoresValue = trackScores; - return Self; + Instance.TrackScores = value; + return this; } - public InnerHitsDescriptor Version(bool? version = true) + public Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor Version(bool? value = true) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.InnerHits Build(System.Action? action) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (DocvalueFieldsDescriptor is not null) + if (action is null) { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocvalueFieldsDescriptor, options); - writer.WriteEndArray(); + return new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - else if (DocvalueFieldsDescriptorAction is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(DocvalueFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocvalueFieldsDescriptorActions is not null) - { - writer.WritePropertyName("docvalue_fields"); - writer.WriteStartArray(); - foreach (var action in DocvalueFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (DocvalueFieldsValue is not null) - { - writer.WritePropertyName("docvalue_fields"); - JsonSerializer.Serialize(writer, DocvalueFieldsValue, options); - } - - if (ExplainValue.HasValue) - { - writer.WritePropertyName("explain"); - writer.WriteBooleanValue(ExplainValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FromValue.HasValue) - { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.HighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } - - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } - - if (SeqNoPrimaryTermValue.HasValue) - { - writer.WritePropertyName("seq_no_primary_term"); - writer.WriteBooleanValue(SeqNoPrimaryTermValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (StoredFieldsValue is not null) - { - writer.WritePropertyName("stored_fields"); - JsonSerializer.Serialize(writer, StoredFieldsValue, options); - } - - if (TrackScoresValue.HasValue) - { - writer.WritePropertyName("track_scores"); - writer.WriteBooleanValue(TrackScoresValue.Value); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteBooleanValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.InnerHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHitsResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHitsResult.g.cs index 7f7f75b7a92..8db466cc5bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHitsResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/InnerHitsResult.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class InnerHitsResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + + public override Elastic.Clients.Elasticsearch.Core.Search.InnerHitsResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propHits = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Hits = propHits.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.InnerHitsResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsResultConverter))] public sealed partial class InnerHitsResult { - [JsonInclude, JsonPropertyName("hits")] - public Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InnerHitsResult(Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata hits) + { + Hits = hits; + } +#if NET7_0_OR_GREATER + public InnerHitsResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InnerHitsResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InnerHitsResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.HitsMetadata Hits { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnCollectorResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnCollectorResult.g.cs index aaec4e00032..4c67a6b9a3a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnCollectorResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnCollectorResult.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class KnnCollectorResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + + public override Elastic.Clients.Elasticsearch.Core.Search.KnnCollectorResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propChildren = default; + LocalJsonValue propName = default; + LocalJsonValue propReason = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.KnnCollectorResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Children = propChildren.Value, + Name = propName.Value, + Reason = propReason.Value, + Time = propTime.Value, + TimeInNanos = propTimeInNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.KnnCollectorResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.KnnCollectorResultConverter))] public sealed partial class KnnCollectorResult { - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string Reason { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnCollectorResult(string name, string reason, System.TimeSpan timeInNanos) + { + Name = name; + Reason = reason; + TimeInNanos = timeInNanos; + } +#if NET7_0_OR_GREATER + public KnnCollectorResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnCollectorResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnCollectorResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Reason { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileBreakdown.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileBreakdown.g.cs index fa1f6814a4c..c2a39c3d3e4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileBreakdown.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileBreakdown.g.cs @@ -17,56 +17,364 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class KnnQueryProfileBreakdownConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdvance = System.Text.Json.JsonEncodedText.Encode("advance"); + private static readonly System.Text.Json.JsonEncodedText PropAdvanceCount = System.Text.Json.JsonEncodedText.Encode("advance_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuildScorer = System.Text.Json.JsonEncodedText.Encode("build_scorer"); + private static readonly System.Text.Json.JsonEncodedText PropBuildScorerCount = System.Text.Json.JsonEncodedText.Encode("build_scorer_count"); + private static readonly System.Text.Json.JsonEncodedText PropComputeMaxScore = System.Text.Json.JsonEncodedText.Encode("compute_max_score"); + private static readonly System.Text.Json.JsonEncodedText PropComputeMaxScoreCount = System.Text.Json.JsonEncodedText.Encode("compute_max_score_count"); + private static readonly System.Text.Json.JsonEncodedText PropCountWeight = System.Text.Json.JsonEncodedText.Encode("count_weight"); + private static readonly System.Text.Json.JsonEncodedText PropCountWeightCount = System.Text.Json.JsonEncodedText.Encode("count_weight_count"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeight = System.Text.Json.JsonEncodedText.Encode("create_weight"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeightCount = System.Text.Json.JsonEncodedText.Encode("create_weight_count"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropMatchCount = System.Text.Json.JsonEncodedText.Encode("match_count"); + private static readonly System.Text.Json.JsonEncodedText PropNextDoc = System.Text.Json.JsonEncodedText.Encode("next_doc"); + private static readonly System.Text.Json.JsonEncodedText PropNextDocCount = System.Text.Json.JsonEncodedText.Encode("next_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropScoreCount = System.Text.Json.JsonEncodedText.Encode("score_count"); + private static readonly System.Text.Json.JsonEncodedText PropSetMinCompetitiveScore = System.Text.Json.JsonEncodedText.Encode("set_min_competitive_score"); + private static readonly System.Text.Json.JsonEncodedText PropSetMinCompetitiveScoreCount = System.Text.Json.JsonEncodedText.Encode("set_min_competitive_score_count"); + private static readonly System.Text.Json.JsonEncodedText PropShallowAdvance = System.Text.Json.JsonEncodedText.Encode("shallow_advance"); + private static readonly System.Text.Json.JsonEncodedText PropShallowAdvanceCount = System.Text.Json.JsonEncodedText.Encode("shallow_advance_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdvance = default; + LocalJsonValue propAdvanceCount = default; + LocalJsonValue propBuildScorer = default; + LocalJsonValue propBuildScorerCount = default; + LocalJsonValue propComputeMaxScore = default; + LocalJsonValue propComputeMaxScoreCount = default; + LocalJsonValue propCountWeight = default; + LocalJsonValue propCountWeightCount = default; + LocalJsonValue propCreateWeight = default; + LocalJsonValue propCreateWeightCount = default; + LocalJsonValue propMatch = default; + LocalJsonValue propMatchCount = default; + LocalJsonValue propNextDoc = default; + LocalJsonValue propNextDocCount = default; + LocalJsonValue propScore = default; + LocalJsonValue propScoreCount = default; + LocalJsonValue propSetMinCompetitiveScore = default; + LocalJsonValue propSetMinCompetitiveScoreCount = default; + LocalJsonValue propShallowAdvance = default; + LocalJsonValue propShallowAdvanceCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdvance.TryReadProperty(ref reader, options, PropAdvance, null)) + { + continue; + } + + if (propAdvanceCount.TryReadProperty(ref reader, options, PropAdvanceCount, null)) + { + continue; + } + + if (propBuildScorer.TryReadProperty(ref reader, options, PropBuildScorer, null)) + { + continue; + } + + if (propBuildScorerCount.TryReadProperty(ref reader, options, PropBuildScorerCount, null)) + { + continue; + } + + if (propComputeMaxScore.TryReadProperty(ref reader, options, PropComputeMaxScore, null)) + { + continue; + } + + if (propComputeMaxScoreCount.TryReadProperty(ref reader, options, PropComputeMaxScoreCount, null)) + { + continue; + } + + if (propCountWeight.TryReadProperty(ref reader, options, PropCountWeight, null)) + { + continue; + } + + if (propCountWeightCount.TryReadProperty(ref reader, options, PropCountWeightCount, null)) + { + continue; + } + + if (propCreateWeight.TryReadProperty(ref reader, options, PropCreateWeight, null)) + { + continue; + } + + if (propCreateWeightCount.TryReadProperty(ref reader, options, PropCreateWeightCount, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propMatchCount.TryReadProperty(ref reader, options, PropMatchCount, null)) + { + continue; + } + + if (propNextDoc.TryReadProperty(ref reader, options, PropNextDoc, null)) + { + continue; + } + + if (propNextDocCount.TryReadProperty(ref reader, options, PropNextDocCount, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propScoreCount.TryReadProperty(ref reader, options, PropScoreCount, null)) + { + continue; + } + + if (propSetMinCompetitiveScore.TryReadProperty(ref reader, options, PropSetMinCompetitiveScore, null)) + { + continue; + } + + if (propSetMinCompetitiveScoreCount.TryReadProperty(ref reader, options, PropSetMinCompetitiveScoreCount, null)) + { + continue; + } + + if (propShallowAdvance.TryReadProperty(ref reader, options, PropShallowAdvance, null)) + { + continue; + } + + if (propShallowAdvanceCount.TryReadProperty(ref reader, options, PropShallowAdvanceCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Advance = propAdvance.Value, + AdvanceCount = propAdvanceCount.Value, + BuildScorer = propBuildScorer.Value, + BuildScorerCount = propBuildScorerCount.Value, + ComputeMaxScore = propComputeMaxScore.Value, + ComputeMaxScoreCount = propComputeMaxScoreCount.Value, + CountWeight = propCountWeight.Value, + CountWeightCount = propCountWeightCount.Value, + CreateWeight = propCreateWeight.Value, + CreateWeightCount = propCreateWeightCount.Value, + Match = propMatch.Value, + MatchCount = propMatchCount.Value, + NextDoc = propNextDoc.Value, + NextDocCount = propNextDocCount.Value, + Score = propScore.Value, + ScoreCount = propScoreCount.Value, + SetMinCompetitiveScore = propSetMinCompetitiveScore.Value, + SetMinCompetitiveScoreCount = propSetMinCompetitiveScoreCount.Value, + ShallowAdvance = propShallowAdvance.Value, + ShallowAdvanceCount = propShallowAdvanceCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdvance, value.Advance, null, null); + writer.WriteProperty(options, PropAdvanceCount, value.AdvanceCount, null, null); + writer.WriteProperty(options, PropBuildScorer, value.BuildScorer, null, null); + writer.WriteProperty(options, PropBuildScorerCount, value.BuildScorerCount, null, null); + writer.WriteProperty(options, PropComputeMaxScore, value.ComputeMaxScore, null, null); + writer.WriteProperty(options, PropComputeMaxScoreCount, value.ComputeMaxScoreCount, null, null); + writer.WriteProperty(options, PropCountWeight, value.CountWeight, null, null); + writer.WriteProperty(options, PropCountWeightCount, value.CountWeightCount, null, null); + writer.WriteProperty(options, PropCreateWeight, value.CreateWeight, null, null); + writer.WriteProperty(options, PropCreateWeightCount, value.CreateWeightCount, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropMatchCount, value.MatchCount, null, null); + writer.WriteProperty(options, PropNextDoc, value.NextDoc, null, null); + writer.WriteProperty(options, PropNextDocCount, value.NextDocCount, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropScoreCount, value.ScoreCount, null, null); + writer.WriteProperty(options, PropSetMinCompetitiveScore, value.SetMinCompetitiveScore, null, null); + writer.WriteProperty(options, PropSetMinCompetitiveScoreCount, value.SetMinCompetitiveScoreCount, null, null); + writer.WriteProperty(options, PropShallowAdvance, value.ShallowAdvance, null, null); + writer.WriteProperty(options, PropShallowAdvanceCount, value.ShallowAdvanceCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdownConverter))] public sealed partial class KnnQueryProfileBreakdown { - [JsonInclude, JsonPropertyName("advance")] - public long Advance { get; init; } - [JsonInclude, JsonPropertyName("advance_count")] - public long AdvanceCount { get; init; } - [JsonInclude, JsonPropertyName("build_scorer")] - public long BuildScorer { get; init; } - [JsonInclude, JsonPropertyName("build_scorer_count")] - public long BuildScorerCount { get; init; } - [JsonInclude, JsonPropertyName("compute_max_score")] - public long ComputeMaxScore { get; init; } - [JsonInclude, JsonPropertyName("compute_max_score_count")] - public long ComputeMaxScoreCount { get; init; } - [JsonInclude, JsonPropertyName("count_weight")] - public long CountWeight { get; init; } - [JsonInclude, JsonPropertyName("count_weight_count")] - public long CountWeightCount { get; init; } - [JsonInclude, JsonPropertyName("create_weight")] - public long CreateWeight { get; init; } - [JsonInclude, JsonPropertyName("create_weight_count")] - public long CreateWeightCount { get; init; } - [JsonInclude, JsonPropertyName("match")] - public long Match { get; init; } - [JsonInclude, JsonPropertyName("match_count")] - public long MatchCount { get; init; } - [JsonInclude, JsonPropertyName("next_doc")] - public long NextDoc { get; init; } - [JsonInclude, JsonPropertyName("next_doc_count")] - public long NextDocCount { get; init; } - [JsonInclude, JsonPropertyName("score")] - public long Score { get; init; } - [JsonInclude, JsonPropertyName("score_count")] - public long ScoreCount { get; init; } - [JsonInclude, JsonPropertyName("set_min_competitive_score")] - public long SetMinCompetitiveScore { get; init; } - [JsonInclude, JsonPropertyName("set_min_competitive_score_count")] - public long SetMinCompetitiveScoreCount { get; init; } - [JsonInclude, JsonPropertyName("shallow_advance")] - public long ShallowAdvance { get; init; } - [JsonInclude, JsonPropertyName("shallow_advance_count")] - public long ShallowAdvanceCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryProfileBreakdown(long advance, long advanceCount, long buildScorer, long buildScorerCount, long computeMaxScore, long computeMaxScoreCount, long countWeight, long countWeightCount, long createWeight, long createWeightCount, long match, long matchCount, long nextDoc, long nextDocCount, long score, long scoreCount, long setMinCompetitiveScore, long setMinCompetitiveScoreCount, long shallowAdvance, long shallowAdvanceCount) + { + Advance = advance; + AdvanceCount = advanceCount; + BuildScorer = buildScorer; + BuildScorerCount = buildScorerCount; + ComputeMaxScore = computeMaxScore; + ComputeMaxScoreCount = computeMaxScoreCount; + CountWeight = countWeight; + CountWeightCount = countWeightCount; + CreateWeight = createWeight; + CreateWeightCount = createWeightCount; + Match = match; + MatchCount = matchCount; + NextDoc = nextDoc; + NextDocCount = nextDocCount; + Score = score; + ScoreCount = scoreCount; + SetMinCompetitiveScore = setMinCompetitiveScore; + SetMinCompetitiveScoreCount = setMinCompetitiveScoreCount; + ShallowAdvance = shallowAdvance; + ShallowAdvanceCount = shallowAdvanceCount; + } +#if NET7_0_OR_GREATER + public KnnQueryProfileBreakdown() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnQueryProfileBreakdown() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnQueryProfileBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Advance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long AdvanceCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildScorer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildScorerCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ComputeMaxScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ComputeMaxScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CountWeight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CountWeightCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeightCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Match { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MatchCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NextDoc { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NextDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Score { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SetMinCompetitiveScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SetMinCompetitiveScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShallowAdvance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShallowAdvanceCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileResult.g.cs index 7482c065065..e35cae468c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/KnnQueryProfileResult.g.cs @@ -17,30 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class KnnQueryProfileResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBreakdown = System.Text.Json.JsonEncodedText.Encode("breakdown"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDebug = System.Text.Json.JsonEncodedText.Encode("debug"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBreakdown = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue?> propDebug = default; + LocalJsonValue propDescription = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInNanos = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBreakdown.TryReadProperty(ref reader, options, PropBreakdown, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDebug.TryReadProperty(ref reader, options, PropDebug, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Breakdown = propBreakdown.Value, + Children = propChildren.Value, + Debug = propDebug.Value, + Description = propDescription.Value, + Time = propTime.Value, + TimeInNanos = propTimeInNanos.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBreakdown, value.Breakdown, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDebug, value.Debug, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileResultConverter))] public sealed partial class KnnQueryProfileResult { - [JsonInclude, JsonPropertyName("breakdown")] - public Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown Breakdown { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("debug")] - public IReadOnlyDictionary? Debug { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryProfileResult(Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown breakdown, string description, System.TimeSpan timeInNanos, string type) + { + Breakdown = breakdown; + Description = description; + TimeInNanos = timeInNanos; + Type = type; + } +#if NET7_0_OR_GREATER + public KnnQueryProfileResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnQueryProfileResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnQueryProfileResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.KnnQueryProfileBreakdown Breakdown { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Debug { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LaplaceSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LaplaceSmoothingModel.g.cs index 6b52da5cfb0..3d900ab014c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LaplaceSmoothingModel.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LaplaceSmoothingModel.g.cs @@ -17,55 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class LaplaceSmoothingModelConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAlpha = System.Text.Json.JsonEncodedText.Encode("alpha"); + + public override Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlpha = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlpha.TryReadProperty(ref reader, options, PropAlpha, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alpha = propAlpha.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlpha, value.Alpha, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelConverter))] public sealed partial class LaplaceSmoothingModel { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LaplaceSmoothingModel(double alpha) + { + Alpha = alpha; + } +#if NET7_0_OR_GREATER + public LaplaceSmoothingModel() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LaplaceSmoothingModel() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LaplaceSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A constant that is added to all counts to balance weights. /// /// - [JsonInclude, JsonPropertyName("alpha")] - public double Alpha { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(LaplaceSmoothingModel laplaceSmoothingModel) => Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel.Laplace(laplaceSmoothingModel); + public +#if NET7_0_OR_GREATER + required +#endif + double Alpha { get; set; } } -public sealed partial class LaplaceSmoothingModelDescriptor : SerializableDescriptor +public readonly partial struct LaplaceSmoothingModelDescriptor { - internal LaplaceSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel Instance { get; init; } - public LaplaceSmoothingModelDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LaplaceSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel instance) { + Instance = instance; } - private double AlphaValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LaplaceSmoothingModelDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel instance) => new Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor descriptor) => descriptor.Instance; /// /// /// A constant that is added to all counts to balance weights. /// /// - public LaplaceSmoothingModelDescriptor Alpha(double alpha) + public Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor Alpha(double value) { - AlphaValue = alpha; - return Self; + Instance.Alpha = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(AlphaValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LearningToRank.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LearningToRank.g.cs index f40e62d4290..67137068f18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LearningToRank.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LearningToRank.g.cs @@ -17,57 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class LearningToRankConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + + public override Elastic.Clients.Elasticsearch.Core.Search.LearningToRank Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModelId = default; + LocalJsonValue?> propParams = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.LearningToRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModelId = propModelId.Value, + Params = propParams.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.LearningToRank value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.LearningToRankConverter))] public sealed partial class LearningToRank { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRank(string modelId) + { + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public LearningToRank() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LearningToRank() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LearningToRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The unique identifier of the trained model uploaded to Elasticsearch /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } /// /// /// Named parameters to be passed to the query templates used for feature /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(LearningToRank learningToRank) => Elastic.Clients.Elasticsearch.Core.Search.Rescore.LearningToRank(learningToRank); + public System.Collections.Generic.IDictionary? Params { get; set; } } -public sealed partial class LearningToRankDescriptor : SerializableDescriptor +public readonly partial struct LearningToRankDescriptor { - internal LearningToRankDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.LearningToRank Instance { get; init; } - public LearningToRankDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank instance) { + Instance = instance; } - private string ModelIdValue { get; set; } - private IDictionary? ParamsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.LearningToRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank instance) => new Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor descriptor) => descriptor.Instance; /// /// /// The unique identifier of the trained model uploaded to Elasticsearch /// /// - public LearningToRankDescriptor ModelId(string modelId) + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor ModelId(string value) { - ModelIdValue = modelId; - return Self; + Instance.ModelId = value; + return this; } /// @@ -75,23 +150,46 @@ public LearningToRankDescriptor ModelId(string modelId) /// Named parameters to be passed to the query templates used for feature /// /// - public LearningToRankDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Named parameters to be passed to the query templates used for feature + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor Params() { - writer.WriteStartObject(); - writer.WritePropertyName("model_id"); - writer.WriteStringValue(ModelIdValue); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Named parameters to be passed to the query templates used for feature + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.LearningToRank Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.LearningToRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LinearInterpolationSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LinearInterpolationSmoothingModel.g.cs index 4461774acae..957cbb5d146 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LinearInterpolationSmoothingModel.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/LinearInterpolationSmoothingModel.g.cs @@ -17,67 +17,155 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class LinearInterpolationSmoothingModelConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBigramLambda = System.Text.Json.JsonEncodedText.Encode("bigram_lambda"); + private static readonly System.Text.Json.JsonEncodedText PropTrigramLambda = System.Text.Json.JsonEncodedText.Encode("trigram_lambda"); + private static readonly System.Text.Json.JsonEncodedText PropUnigramLambda = System.Text.Json.JsonEncodedText.Encode("unigram_lambda"); + + public override Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBigramLambda = default; + LocalJsonValue propTrigramLambda = default; + LocalJsonValue propUnigramLambda = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBigramLambda.TryReadProperty(ref reader, options, PropBigramLambda, null)) + { + continue; + } + + if (propTrigramLambda.TryReadProperty(ref reader, options, PropTrigramLambda, null)) + { + continue; + } + + if (propUnigramLambda.TryReadProperty(ref reader, options, PropUnigramLambda, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BigramLambda = propBigramLambda.Value, + TrigramLambda = propTrigramLambda.Value, + UnigramLambda = propUnigramLambda.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBigramLambda, value.BigramLambda, null, null); + writer.WriteProperty(options, PropTrigramLambda, value.TrigramLambda, null, null); + writer.WriteProperty(options, PropUnigramLambda, value.UnigramLambda, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelConverter))] public sealed partial class LinearInterpolationSmoothingModel { - [JsonInclude, JsonPropertyName("bigram_lambda")] - public double BigramLambda { get; set; } - [JsonInclude, JsonPropertyName("trigram_lambda")] - public double TrigramLambda { get; set; } - [JsonInclude, JsonPropertyName("unigram_lambda")] - public double UnigramLambda { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(LinearInterpolationSmoothingModel linearInterpolationSmoothingModel) => Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel.LinearInterpolation(linearInterpolationSmoothingModel); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LinearInterpolationSmoothingModel(double bigramLambda, double trigramLambda, double unigramLambda) + { + BigramLambda = bigramLambda; + TrigramLambda = trigramLambda; + UnigramLambda = unigramLambda; + } +#if NET7_0_OR_GREATER + public LinearInterpolationSmoothingModel() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LinearInterpolationSmoothingModel() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LinearInterpolationSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double BigramLambda { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double TrigramLambda { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double UnigramLambda { get; set; } } -public sealed partial class LinearInterpolationSmoothingModelDescriptor : SerializableDescriptor +public readonly partial struct LinearInterpolationSmoothingModelDescriptor { - internal LinearInterpolationSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LinearInterpolationSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel instance) + { + Instance = instance; + } - public LinearInterpolationSmoothingModelDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LinearInterpolationSmoothingModelDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double BigramLambdaValue { get; set; } - private double TrigramLambdaValue { get; set; } - private double UnigramLambdaValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel instance) => new Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor descriptor) => descriptor.Instance; - public LinearInterpolationSmoothingModelDescriptor BigramLambda(double bigramLambda) + public Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor BigramLambda(double value) { - BigramLambdaValue = bigramLambda; - return Self; + Instance.BigramLambda = value; + return this; } - public LinearInterpolationSmoothingModelDescriptor TrigramLambda(double trigramLambda) + public Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor TrigramLambda(double value) { - TrigramLambdaValue = trigramLambda; - return Self; + Instance.TrigramLambda = value; + return this; } - public LinearInterpolationSmoothingModelDescriptor UnigramLambda(double unigramLambda) + public Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor UnigramLambda(double value) { - UnigramLambdaValue = unigramLambda; - return Self; + Instance.UnigramLambda = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("bigram_lambda"); - writer.WriteNumberValue(BigramLambdaValue); - writer.WritePropertyName("trigram_lambda"); - writer.WriteNumberValue(TrigramLambdaValue); - writer.WritePropertyName("unigram_lambda"); - writer.WriteNumberValue(UnigramLambdaValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/NestedIdentity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/NestedIdentity.g.cs index e4de6e163e0..bcdfcfdebab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/NestedIdentity.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/NestedIdentity.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class NestedIdentityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("_nested"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + + public override Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propNested = default; + LocalJsonValue propOffset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Nested = propNested.Value, + Offset = propOffset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.NestedIdentityConverter))] public sealed partial class NestedIdentity { - [JsonInclude, JsonPropertyName("field")] - public string Field { get; init; } - [JsonInclude, JsonPropertyName("_nested")] - public Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity? Nested { get; init; } - [JsonInclude, JsonPropertyName("offset")] - public int Offset { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedIdentity(string field, int offset) + { + Field = field; + Offset = offset; + } +#if NET7_0_OR_GREATER + public NestedIdentity() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NestedIdentity() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedIdentity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.NestedIdentity? Nested { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Offset { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggest.g.cs index d00e32970ee..9da6536ab92 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggest.g.cs @@ -17,25 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -public sealed partial class PhraseSuggest : ISuggest +internal sealed partial class PhraseSuggestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propOffset = default; + LocalJsonValue> propOptions = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Offset = propOffset.Value, + Options = propOptions.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestConverter))] +public sealed partial class PhraseSuggest : Elastic.Clients.Elasticsearch.Core.Search.ISuggest { - [JsonInclude, JsonPropertyName("length")] - public int Length { get; init; } - [JsonInclude, JsonPropertyName("offset")] - public int Offset { get; init; } - [JsonInclude, JsonPropertyName("options")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestOption))] - public IReadOnlyCollection Options { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggest(int length, int offset, System.Collections.Generic.ICollection options, string text) + { + Length = length; + Offset = offset; + Options = options; + Text = text; + } +#if NET7_0_OR_GREATER + public PhraseSuggest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhraseSuggest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Length { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Offset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Options { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } + + string Elastic.Clients.Elasticsearch.Core.Search.ISuggest.Type => "phrase"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollate.g.cs index 326b084edbb..685075eafef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollate.g.cs @@ -17,32 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PhraseSuggestCollateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropPrune = System.Text.Json.JsonEncodedText.Encode("prune"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propParams = default; + LocalJsonValue propPrune = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPrune.TryReadProperty(ref reader, options, PropPrune, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Params = propParams.Value, + Prune = propPrune.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPrune, value.Prune, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateConverter))] public sealed partial class PhraseSuggestCollate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public PhraseSuggestCollate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhraseSuggestCollate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Parameters to use if the query is templated. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// Returns all suggestions with an extra collate_match option indicating whether the generated phrase matched any document. /// /// - [JsonInclude, JsonPropertyName("prune")] public bool? Prune { get; set; } /// @@ -50,106 +124,121 @@ public sealed partial class PhraseSuggestCollate /// A collate query that is run once for every suggestion. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery Query { get; set; } } -public sealed partial class PhraseSuggestCollateDescriptor : SerializableDescriptor +public readonly partial struct PhraseSuggestCollateDescriptor { - internal PhraseSuggestCollateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestCollateDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate instance) + { + Instance = instance; + } - public PhraseSuggestCollateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestCollateDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary? ParamsValue { get; set; } - private bool? PruneValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate instance) => new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor descriptor) => descriptor.Instance; /// /// /// Parameters to use if the query is templated. /// /// - public PhraseSuggestCollateDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// Returns all suggestions with an extra collate_match option indicating whether the generated phrase matched any document. + /// Parameters to use if the query is templated. /// /// - public PhraseSuggestCollateDescriptor Prune(bool? prune = true) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Params() { - PruneValue = prune; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// /// - /// A collate query that is run once for every suggestion. + /// Parameters to use if the query is templated. /// /// - public PhraseSuggestCollateDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery query) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Params(System.Action? action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PhraseSuggestCollateDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor AddParam(string key, object value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } - public PhraseSuggestCollateDescriptor Query(Action configure) + /// + /// + /// Returns all suggestions with an extra collate_match option indicating whether the generated phrase matched any document. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Prune(bool? value = true) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Prune = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A collate query that is run once for every suggestion. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery value) { - writer.WriteStartObject(); - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + Instance.Query = value; + return this; + } - if (PruneValue.HasValue) - { - writer.WritePropertyName("prune"); - writer.WriteBooleanValue(PruneValue.Value); - } + /// + /// + /// A collate query that is run once for every suggestion. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Query() + { + Instance.Query = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor.Build(null); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A collate query that is run once for every suggestion. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor Query(System.Action? action) + { + Instance.Query = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollateQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollateQuery.g.cs index fc167a5cb80..10fd5579631 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollateQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestCollateQuery.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PhraseSuggestCollateQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryConverter))] public sealed partial class PhraseSuggestCollateQuery { +#if NET7_0_OR_GREATER + public PhraseSuggestCollateQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public PhraseSuggestCollateQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The search template ID. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class PhraseSuggestCollateQuery /// The query source. /// /// - [JsonInclude, JsonPropertyName("source")] public string? Source { get; set; } } -public sealed partial class PhraseSuggestCollateQueryDescriptor : SerializableDescriptor +public readonly partial struct PhraseSuggestCollateQueryDescriptor { - internal PhraseSuggestCollateQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery Instance { get; init; } - public PhraseSuggestCollateQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestCollateQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private string? SourceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestCollateQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery instance) => new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor descriptor) => descriptor.Instance; /// /// /// The search template ID. /// /// - public PhraseSuggestCollateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -73,27 +140,22 @@ public PhraseSuggestCollateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? /// The query source. /// /// - public PhraseSuggestCollateQueryDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (IdValue is not null) + if (action is null) { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQueryDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestHighlight.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestHighlight.g.cs index c6f5d6a5e6a..2ea4aa36a25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestHighlight.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestHighlight.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PhraseSuggestHighlightConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPostTag = System.Text.Json.JsonEncodedText.Encode("post_tag"); + private static readonly System.Text.Json.JsonEncodedText PropPreTag = System.Text.Json.JsonEncodedText.Encode("pre_tag"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPostTag = default; + LocalJsonValue propPreTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPostTag.TryReadProperty(ref reader, options, PropPostTag, null)) + { + continue; + } + + if (propPreTag.TryReadProperty(ref reader, options, PropPreTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PostTag = propPostTag.Value, + PreTag = propPreTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPostTag, value.PostTag, null, null); + writer.WriteProperty(options, PropPreTag, value.PreTag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightConverter))] public sealed partial class PhraseSuggestHighlight { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestHighlight(string postTag, string preTag) + { + PostTag = postTag; + PreTag = preTag; + } +#if NET7_0_OR_GREATER + public PhraseSuggestHighlight() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhraseSuggestHighlight() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggestHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Use in conjunction with pre_tag to define the HTML tags to use for the highlighted text. /// /// - [JsonInclude, JsonPropertyName("post_tag")] - public string PostTag { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PostTag { get; set; } /// /// /// Use in conjunction with post_tag to define the HTML tags to use for the highlighted text. /// /// - [JsonInclude, JsonPropertyName("pre_tag")] - public string PreTag { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PreTag { get; set; } } -public sealed partial class PhraseSuggestHighlightDescriptor : SerializableDescriptor +public readonly partial struct PhraseSuggestHighlightDescriptor { - internal PhraseSuggestHighlightDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight Instance { get; init; } - public PhraseSuggestHighlightDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestHighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight instance) { + Instance = instance; } - private string PostTagValue { get; set; } - private string PreTagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestHighlightDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight instance) => new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor descriptor) => descriptor.Instance; /// /// /// Use in conjunction with pre_tag to define the HTML tags to use for the highlighted text. /// /// - public PhraseSuggestHighlightDescriptor PostTag(string postTag) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor PostTag(string value) { - PostTagValue = postTag; - return Self; + Instance.PostTag = value; + return this; } /// @@ -73,19 +155,17 @@ public PhraseSuggestHighlightDescriptor PostTag(string postTag) /// Use in conjunction with post_tag to define the HTML tags to use for the highlighted text. /// /// - public PhraseSuggestHighlightDescriptor PreTag(string preTag) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor PreTag(string value) { - PreTagValue = preTag; - return Self; + Instance.PreTag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("post_tag"); - writer.WriteStringValue(PostTagValue); - writer.WritePropertyName("pre_tag"); - writer.WriteStringValue(PreTagValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestOption.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestOption.g.cs index 2cbd7b9d532..52767abe1c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestOption.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggestOption.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PhraseSuggestOptionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollateMatch = System.Text.Json.JsonEncodedText.Encode("collate_match"); + private static readonly System.Text.Json.JsonEncodedText PropHighlighted = System.Text.Json.JsonEncodedText.Encode("highlighted"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestOption Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollateMatch = default; + LocalJsonValue propHighlighted = default; + LocalJsonValue propScore = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollateMatch.TryReadProperty(ref reader, options, PropCollateMatch, null)) + { + continue; + } + + if (propHighlighted.TryReadProperty(ref reader, options, PropHighlighted, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollateMatch = propCollateMatch.Value, + Highlighted = propHighlighted.Value, + Score = propScore.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestOption value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollateMatch, value.CollateMatch, null, null); + writer.WriteProperty(options, PropHighlighted, value.Highlighted, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestOptionConverter))] public sealed partial class PhraseSuggestOption { - [JsonInclude, JsonPropertyName("collate_match")] - public bool? CollateMatch { get; init; } - [JsonInclude, JsonPropertyName("highlighted")] - public string? Highlighted { get; init; } - [JsonInclude, JsonPropertyName("score")] - public double Score { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggestOption(double score, string text) + { + Score = score; + Text = text; + } +#if NET7_0_OR_GREATER + public PhraseSuggestOption() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhraseSuggestOption() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? CollateMatch { get; set; } + public string? Highlighted { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Score { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggester.g.cs index 0c7492fe497..f67cd0fc8ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PhraseSuggester.g.cs @@ -17,25 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PhraseSuggesterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCollate = System.Text.Json.JsonEncodedText.Encode("collate"); + private static readonly System.Text.Json.JsonEncodedText PropConfidence = System.Text.Json.JsonEncodedText.Encode("confidence"); + private static readonly System.Text.Json.JsonEncodedText PropDirectGenerator = System.Text.Json.JsonEncodedText.Encode("direct_generator"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropForceUnigrams = System.Text.Json.JsonEncodedText.Encode("force_unigrams"); + private static readonly System.Text.Json.JsonEncodedText PropGramSize = System.Text.Json.JsonEncodedText.Encode("gram_size"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropMaxErrors = System.Text.Json.JsonEncodedText.Encode("max_errors"); + private static readonly System.Text.Json.JsonEncodedText PropRealWordErrorLikelihood = System.Text.Json.JsonEncodedText.Encode("real_word_error_likelihood"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSmoothing = System.Text.Json.JsonEncodedText.Encode("smoothing"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + private static readonly System.Text.Json.JsonEncodedText PropTokenLimit = System.Text.Json.JsonEncodedText.Encode("token_limit"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propCollate = default; + LocalJsonValue propConfidence = default; + LocalJsonValue?> propDirectGenerator = default; + LocalJsonValue propField = default; + LocalJsonValue propForceUnigrams = default; + LocalJsonValue propGramSize = default; + LocalJsonValue propHighlight = default; + LocalJsonValue propMaxErrors = default; + LocalJsonValue propRealWordErrorLikelihood = default; + LocalJsonValue propSeparator = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + LocalJsonValue propSmoothing = default; + LocalJsonValue propText = default; + LocalJsonValue propTokenLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propCollate.TryReadProperty(ref reader, options, PropCollate, null)) + { + continue; + } + + if (propConfidence.TryReadProperty(ref reader, options, PropConfidence, null)) + { + continue; + } + + if (propDirectGenerator.TryReadProperty(ref reader, options, PropDirectGenerator, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propForceUnigrams.TryReadProperty(ref reader, options, PropForceUnigrams, null)) + { + continue; + } + + if (propGramSize.TryReadProperty(ref reader, options, PropGramSize, null)) + { + continue; + } + + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } + + if (propMaxErrors.TryReadProperty(ref reader, options, PropMaxErrors, null)) + { + continue; + } + + if (propRealWordErrorLikelihood.TryReadProperty(ref reader, options, PropRealWordErrorLikelihood, null)) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSmoothing.TryReadProperty(ref reader, options, PropSmoothing, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (propTokenLimit.TryReadProperty(ref reader, options, PropTokenLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Collate = propCollate.Value, + Confidence = propConfidence.Value, + DirectGenerator = propDirectGenerator.Value, + Field = propField.Value, + ForceUnigrams = propForceUnigrams.Value, + GramSize = propGramSize.Value, + Highlight = propHighlight.Value, + MaxErrors = propMaxErrors.Value, + RealWordErrorLikelihood = propRealWordErrorLikelihood.Value, + Separator = propSeparator.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value, + Smoothing = propSmoothing.Value, + Text = propText.Value, + TokenLimit = propTokenLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropCollate, value.Collate, null, null); + writer.WriteProperty(options, PropConfidence, value.Confidence, null, null); + writer.WriteProperty(options, PropDirectGenerator, value.DirectGenerator, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropForceUnigrams, value.ForceUnigrams, null, null); + writer.WriteProperty(options, PropGramSize, value.GramSize, null, null); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropMaxErrors, value.MaxErrors, null, null); + writer.WriteProperty(options, PropRealWordErrorLikelihood, value.RealWordErrorLikelihood, null, null); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSmoothing, value.Smoothing, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteProperty(options, PropTokenLimit, value.TokenLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterConverter))] public sealed partial class PhraseSuggester { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggester(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public PhraseSuggester() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PhraseSuggester() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The analyzer to analyze the suggest text with. /// Defaults to the search analyzer of the suggest field. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -43,7 +235,6 @@ public sealed partial class PhraseSuggester /// Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index. /// /// - [JsonInclude, JsonPropertyName("collate")] public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? Collate { get; set; } /// @@ -52,7 +243,6 @@ public sealed partial class PhraseSuggester /// Only candidates that score higher than the threshold will be included in the result. /// /// - [JsonInclude, JsonPropertyName("confidence")] public double? Confidence { get; set; } /// @@ -60,8 +250,7 @@ public sealed partial class PhraseSuggester /// A list of candidate generators that produce a list of possible terms per term in the given text. /// /// - [JsonInclude, JsonPropertyName("direct_generator")] - public ICollection? DirectGenerator { get; set; } + public System.Collections.Generic.ICollection? DirectGenerator { get; set; } /// /// @@ -69,9 +258,11 @@ public sealed partial class PhraseSuggester /// Needs to be set globally or per suggestion. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("force_unigrams")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public bool? ForceUnigrams { get; set; } /// @@ -81,7 +272,6 @@ public sealed partial class PhraseSuggester /// If the field uses a shingle filter, the gram_size is set to the max_shingle_size if not explicitly set. /// /// - [JsonInclude, JsonPropertyName("gram_size")] public int? GramSize { get; set; } /// @@ -90,7 +280,6 @@ public sealed partial class PhraseSuggester /// If not provided, no highlighted field is returned. /// /// - [JsonInclude, JsonPropertyName("highlight")] public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? Highlight { get; set; } /// @@ -99,7 +288,6 @@ public sealed partial class PhraseSuggester /// This method accepts a float value in the range [0..1) as a fraction of the actual query terms or a number >=1 as an absolute number of query terms. /// /// - [JsonInclude, JsonPropertyName("max_errors")] public double? MaxErrors { get; set; } /// @@ -107,7 +295,6 @@ public sealed partial class PhraseSuggester /// The likelihood of a term being misspelled even if the term exists in the dictionary. /// /// - [JsonInclude, JsonPropertyName("real_word_error_likelihood")] public double? RealWordErrorLikelihood { get; set; } /// @@ -116,7 +303,6 @@ public sealed partial class PhraseSuggester /// If not set, the whitespace character is used as a separator. /// /// - [JsonInclude, JsonPropertyName("separator")] public string? Separator { get; set; } /// @@ -124,7 +310,6 @@ public sealed partial class PhraseSuggester /// Sets the maximum number of suggested terms to be retrieved from each individual shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -132,7 +317,6 @@ public sealed partial class PhraseSuggester /// The maximum corrections to be returned per suggest text token. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -141,7 +325,6 @@ public sealed partial class PhraseSuggester /// The default model is Stupid Backoff. /// /// - [JsonInclude, JsonPropertyName("smoothing")] public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? Smoothing { get; set; } /// @@ -149,47 +332,28 @@ public sealed partial class PhraseSuggester /// The text/query to provide suggestions for. /// /// - [JsonInclude, JsonPropertyName("text")] public string? Text { get; set; } - [JsonInclude, JsonPropertyName("token_limit")] public int? TokenLimit { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(PhraseSuggester phraseSuggester) => Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester.Phrase(phraseSuggester); } -public sealed partial class PhraseSuggesterDescriptor : SerializableDescriptor> +public readonly partial struct PhraseSuggesterDescriptor { - internal PhraseSuggesterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester Instance { get; init; } - public PhraseSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? CollateValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor CollateDescriptor { get; set; } - private Action CollateDescriptorAction { get; set; } - private double? ConfidenceValue { get; set; } - private ICollection? DirectGeneratorValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor DirectGeneratorDescriptor { get; set; } - private Action> DirectGeneratorDescriptorAction { get; set; } - private Action>[] DirectGeneratorDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? ForceUnigramsValue { get; set; } - private int? GramSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private double? MaxErrorsValue { get; set; } - private double? RealWordErrorLikelihoodValue { get; set; } - private string? SeparatorValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? SmoothingValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor SmoothingDescriptor { get; set; } - private Action SmoothingDescriptorAction { get; set; } - private string? TextValue { get; set; } - private int? TokenLimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggesterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor descriptor) => descriptor.Instance; /// /// @@ -197,10 +361,10 @@ public PhraseSuggesterDescriptor() : base() /// Defaults to the search analyzer of the suggest field. /// /// - public PhraseSuggesterDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -208,28 +372,21 @@ public PhraseSuggesterDescriptor Analyzer(string? analyzer) /// Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index. /// /// - public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? collate) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? value) { - CollateDescriptor = null; - CollateDescriptorAction = null; - CollateValue = collate; - return Self; + Instance.Collate = value; + return this; } - public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor descriptor) - { - CollateValue = null; - CollateDescriptorAction = null; - CollateDescriptor = descriptor; - return Self; - } - - public PhraseSuggesterDescriptor Collate(Action configure) + /// + /// + /// Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Collate(System.Action action) { - CollateValue = null; - CollateDescriptor = null; - CollateDescriptorAction = configure; - return Self; + Instance.Collate = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor.Build(action); + return this; } /// @@ -238,10 +395,10 @@ public PhraseSuggesterDescriptor Collate(Action /// - public PhraseSuggesterDescriptor Confidence(double? confidence) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Confidence(double? value) { - ConfidenceValue = confidence; - return Self; + Instance.Confidence = value; + return this; } /// @@ -249,52 +406,38 @@ public PhraseSuggesterDescriptor Confidence(double? confidence) /// A list of candidate generators that produce a list of possible terms per term in the given text. /// /// - public PhraseSuggesterDescriptor DirectGenerator(ICollection? directGenerator) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(System.Collections.Generic.ICollection? value) { - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorValue = directGenerator; - return Self; + Instance.DirectGenerator = value; + return this; } - public PhraseSuggesterDescriptor DirectGenerator(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor descriptor) - { - DirectGeneratorValue = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorDescriptor = descriptor; - return Self; - } - - public PhraseSuggesterDescriptor DirectGenerator(Action> configure) - { - DirectGeneratorValue = null; - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorDescriptorAction = configure; - return Self; - } - - public PhraseSuggesterDescriptor DirectGenerator(params Action>[] configure) + /// + /// + /// A list of candidate generators that produce a list of possible terms per term in the given text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(params Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator[] values) { - DirectGeneratorValue = null; - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = configure; - return Self; + Instance.DirectGenerator = [.. values]; + return this; } /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// A list of candidate generators that produce a list of possible terms per term in the given text. /// /// - public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(params System.Action>[] actions) { - FieldValue = field; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor.Build(action)); + } + + Instance.DirectGenerator = items; + return this; } /// @@ -303,10 +446,10 @@ public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch. /// Needs to be set globally or per suggestion. /// /// - public PhraseSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -315,16 +458,16 @@ public PhraseSuggesterDescriptor Field(Expression /// - public PhraseSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = true) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor ForceUnigrams(bool? value = true) { - ForceUnigramsValue = forceUnigrams; - return Self; + Instance.ForceUnigrams = value; + return this; } /// @@ -334,10 +477,10 @@ public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = /// If the field uses a shingle filter, the gram_size is set to the max_shingle_size if not explicitly set. /// /// - public PhraseSuggesterDescriptor GramSize(int? gramSize) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor GramSize(int? value) { - GramSizeValue = gramSize; - return Self; + Instance.GramSize = value; + return this; } /// @@ -346,28 +489,22 @@ public PhraseSuggesterDescriptor GramSize(int? gramSize) /// If not provided, no highlighted field is returned. /// /// - public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? highlight) - { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; - } - - public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? value) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Highlight = value; + return this; } - public PhraseSuggesterDescriptor Highlight(Action configure) + /// + /// + /// Sets up suggestion highlighting. + /// If not provided, no highlighted field is returned. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Highlight(System.Action action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor.Build(action); + return this; } /// @@ -376,10 +513,10 @@ public PhraseSuggesterDescriptor Highlight(Action[0..1) as a fraction of the actual query terms or a number >=1 as an absolute number of query terms. /// /// - public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor MaxErrors(double? value) { - MaxErrorsValue = maxErrors; - return Self; + Instance.MaxErrors = value; + return this; } /// @@ -387,10 +524,10 @@ public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) /// The likelihood of a term being misspelled even if the term exists in the dictionary. /// /// - public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? realWordErrorLikelihood) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor RealWordErrorLikelihood(double? value) { - RealWordErrorLikelihoodValue = realWordErrorLikelihood; - return Self; + Instance.RealWordErrorLikelihood = value; + return this; } /// @@ -399,10 +536,10 @@ public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? real /// If not set, the whitespace character is used as a separator. /// /// - public PhraseSuggesterDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Separator(string? value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } /// @@ -410,10 +547,10 @@ public PhraseSuggesterDescriptor Separator(string? separator) /// Sets the maximum number of suggested terms to be retrieved from each individual shard. /// /// - public PhraseSuggesterDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -421,10 +558,10 @@ public PhraseSuggesterDescriptor ShardSize(int? shardSize) /// The maximum corrections to be returned per suggest text token. /// /// - public PhraseSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -433,28 +570,22 @@ public PhraseSuggesterDescriptor Size(int? size) /// The default model is Stupid Backoff. /// /// - public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? smoothing) - { - SmoothingDescriptor = null; - SmoothingDescriptorAction = null; - SmoothingValue = smoothing; - return Self; - } - - public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? value) { - SmoothingValue = null; - SmoothingDescriptorAction = null; - SmoothingDescriptor = descriptor; - return Self; + Instance.Smoothing = value; + return this; } - public PhraseSuggesterDescriptor Smoothing(Action configure) + /// + /// + /// The smoothing model used to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index). + /// The default model is Stupid Backoff. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Smoothing(System.Action action) { - SmoothingValue = null; - SmoothingDescriptor = null; - SmoothingDescriptorAction = configure; - return Self; + Instance.Smoothing = Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor.Build(action); + return this; } /// @@ -462,205 +593,45 @@ public PhraseSuggesterDescriptor Smoothing(Action /// - public PhraseSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Text(string? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - public PhraseSuggesterDescriptor TokenLimit(int? tokenLimit) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor TokenLimit(int? value) { - TokenLimitValue = tokenLimit; - return Self; + Instance.TokenLimit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (CollateDescriptor is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, CollateDescriptor, options); - } - else if (CollateDescriptorAction is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor(CollateDescriptorAction), options); - } - else if (CollateValue is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, CollateValue, options); - } - - if (ConfidenceValue.HasValue) - { - writer.WritePropertyName("confidence"); - writer.WriteNumberValue(ConfidenceValue.Value); - } - - if (DirectGeneratorDescriptor is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DirectGeneratorDescriptor, options); - writer.WriteEndArray(); - } - else if (DirectGeneratorDescriptorAction is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(DirectGeneratorDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DirectGeneratorDescriptorActions is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - foreach (var action in DirectGeneratorDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DirectGeneratorValue is not null) - { - writer.WritePropertyName("direct_generator"); - JsonSerializer.Serialize(writer, DirectGeneratorValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (ForceUnigramsValue.HasValue) - { - writer.WritePropertyName("force_unigrams"); - writer.WriteBooleanValue(ForceUnigramsValue.Value); - } - - if (GramSizeValue.HasValue) - { - writer.WritePropertyName("gram_size"); - writer.WriteNumberValue(GramSizeValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (MaxErrorsValue.HasValue) - { - writer.WritePropertyName("max_errors"); - writer.WriteNumberValue(MaxErrorsValue.Value); - } - - if (RealWordErrorLikelihoodValue.HasValue) - { - writer.WritePropertyName("real_word_error_likelihood"); - writer.WriteNumberValue(RealWordErrorLikelihoodValue.Value); - } - - if (!string.IsNullOrEmpty(SeparatorValue)) - { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SmoothingDescriptor is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, SmoothingDescriptor, options); - } - else if (SmoothingDescriptorAction is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor(SmoothingDescriptorAction), options); - } - else if (SmoothingValue is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, SmoothingValue, options); - } - - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } - - if (TokenLimitValue.HasValue) - { - writer.WritePropertyName("token_limit"); - writer.WriteNumberValue(TokenLimitValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PhraseSuggesterDescriptor : SerializableDescriptor +public readonly partial struct PhraseSuggesterDescriptor { - internal PhraseSuggesterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester instance) + { + Instance = instance; + } - public PhraseSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhraseSuggesterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? CollateValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor CollateDescriptor { get; set; } - private Action CollateDescriptorAction { get; set; } - private double? ConfidenceValue { get; set; } - private ICollection? DirectGeneratorValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor DirectGeneratorDescriptor { get; set; } - private Action DirectGeneratorDescriptorAction { get; set; } - private Action[] DirectGeneratorDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? ForceUnigramsValue { get; set; } - private int? GramSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private double? MaxErrorsValue { get; set; } - private double? RealWordErrorLikelihoodValue { get; set; } - private string? SeparatorValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? SmoothingValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor SmoothingDescriptor { get; set; } - private Action SmoothingDescriptorAction { get; set; } - private string? TextValue { get; set; } - private int? TokenLimitValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor descriptor) => descriptor.Instance; /// /// @@ -668,10 +639,10 @@ public PhraseSuggesterDescriptor() : base() /// Defaults to the search analyzer of the suggest field. /// /// - public PhraseSuggesterDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -679,28 +650,21 @@ public PhraseSuggesterDescriptor Analyzer(string? analyzer) /// Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index. /// /// - public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? collate) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollate? value) { - CollateDescriptor = null; - CollateDescriptorAction = null; - CollateValue = collate; - return Self; + Instance.Collate = value; + return this; } - public PhraseSuggesterDescriptor Collate(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor descriptor) - { - CollateValue = null; - CollateDescriptorAction = null; - CollateDescriptor = descriptor; - return Self; - } - - public PhraseSuggesterDescriptor Collate(Action configure) + /// + /// + /// Checks each suggestion against the specified query to prune suggestions for which no matching docs exist in the index. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Collate(System.Action action) { - CollateValue = null; - CollateDescriptor = null; - CollateDescriptorAction = configure; - return Self; + Instance.Collate = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor.Build(action); + return this; } /// @@ -709,10 +673,10 @@ public PhraseSuggesterDescriptor Collate(Action /// - public PhraseSuggesterDescriptor Confidence(double? confidence) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Confidence(double? value) { - ConfidenceValue = confidence; - return Self; + Instance.Confidence = value; + return this; } /// @@ -720,52 +684,55 @@ public PhraseSuggesterDescriptor Confidence(double? confidence) /// A list of candidate generators that produce a list of possible terms per term in the given text. /// /// - public PhraseSuggesterDescriptor DirectGenerator(ICollection? directGenerator) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(System.Collections.Generic.ICollection? value) { - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorValue = directGenerator; - return Self; + Instance.DirectGenerator = value; + return this; } - public PhraseSuggesterDescriptor DirectGenerator(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor descriptor) + /// + /// + /// A list of candidate generators that produce a list of possible terms per term in the given text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(params Elastic.Clients.Elasticsearch.Core.Search.DirectGenerator[] values) { - DirectGeneratorValue = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorDescriptor = descriptor; - return Self; + Instance.DirectGenerator = [.. values]; + return this; } - public PhraseSuggesterDescriptor DirectGenerator(Action configure) + /// + /// + /// A list of candidate generators that produce a list of possible terms per term in the given text. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(params System.Action[] actions) { - DirectGeneratorValue = null; - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorActions = null; - DirectGeneratorDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor.Build(action)); + } - public PhraseSuggesterDescriptor DirectGenerator(params Action[] configure) - { - DirectGeneratorValue = null; - DirectGeneratorDescriptor = null; - DirectGeneratorDescriptorAction = null; - DirectGeneratorDescriptorActions = configure; - return Self; + Instance.DirectGenerator = items; + return this; } /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// A list of candidate generators that produce a list of possible terms per term in the given text. /// /// - public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor DirectGenerator(params System.Action>[] actions) { - FieldValue = field; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor.Build(action)); + } + + Instance.DirectGenerator = items; + return this; } /// @@ -774,10 +741,10 @@ public PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// Needs to be set globally or per suggestion. /// /// - public PhraseSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -786,16 +753,16 @@ public PhraseSuggesterDescriptor Field(Expression /// - public PhraseSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = true) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor ForceUnigrams(bool? value = true) { - ForceUnigramsValue = forceUnigrams; - return Self; + Instance.ForceUnigrams = value; + return this; } /// @@ -805,10 +772,10 @@ public PhraseSuggesterDescriptor ForceUnigrams(bool? forceUnigrams = true) /// If the field uses a shingle filter, the gram_size is set to the max_shingle_size if not explicitly set. /// /// - public PhraseSuggesterDescriptor GramSize(int? gramSize) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor GramSize(int? value) { - GramSizeValue = gramSize; - return Self; + Instance.GramSize = value; + return this; } /// @@ -817,28 +784,22 @@ public PhraseSuggesterDescriptor GramSize(int? gramSize) /// If not provided, no highlighted field is returned. /// /// - public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? highlight) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlight? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.Highlight = value; + return this; } - public PhraseSuggesterDescriptor Highlight(Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor descriptor) - { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; - } - - public PhraseSuggesterDescriptor Highlight(Action configure) + /// + /// + /// Sets up suggestion highlighting. + /// If not provided, no highlighted field is returned. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Highlight(System.Action action) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.Highlight = Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor.Build(action); + return this; } /// @@ -847,10 +808,10 @@ public PhraseSuggesterDescriptor Highlight(Action[0..1) as a fraction of the actual query terms or a number >=1 as an absolute number of query terms. /// /// - public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor MaxErrors(double? value) { - MaxErrorsValue = maxErrors; - return Self; + Instance.MaxErrors = value; + return this; } /// @@ -858,10 +819,10 @@ public PhraseSuggesterDescriptor MaxErrors(double? maxErrors) /// The likelihood of a term being misspelled even if the term exists in the dictionary. /// /// - public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? realWordErrorLikelihood) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor RealWordErrorLikelihood(double? value) { - RealWordErrorLikelihoodValue = realWordErrorLikelihood; - return Self; + Instance.RealWordErrorLikelihood = value; + return this; } /// @@ -870,10 +831,10 @@ public PhraseSuggesterDescriptor RealWordErrorLikelihood(double? realWordErrorLi /// If not set, the whitespace character is used as a separator. /// /// - public PhraseSuggesterDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Separator(string? value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } /// @@ -881,10 +842,10 @@ public PhraseSuggesterDescriptor Separator(string? separator) /// Sets the maximum number of suggested terms to be retrieved from each individual shard. /// /// - public PhraseSuggesterDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -892,10 +853,10 @@ public PhraseSuggesterDescriptor ShardSize(int? shardSize) /// The maximum corrections to be returned per suggest text token. /// /// - public PhraseSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -904,28 +865,22 @@ public PhraseSuggesterDescriptor Size(int? size) /// The default model is Stupid Backoff. /// /// - public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? smoothing) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel? value) { - SmoothingDescriptor = null; - SmoothingDescriptorAction = null; - SmoothingValue = smoothing; - return Self; + Instance.Smoothing = value; + return this; } - public PhraseSuggesterDescriptor Smoothing(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor descriptor) - { - SmoothingValue = null; - SmoothingDescriptorAction = null; - SmoothingDescriptor = descriptor; - return Self; - } - - public PhraseSuggesterDescriptor Smoothing(Action configure) + /// + /// + /// The smoothing model used to balance weight between infrequent grams (grams (shingles) are not existing in the index) and frequent grams (appear at least once in the index). + /// The default model is Stupid Backoff. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Smoothing(System.Action action) { - SmoothingValue = null; - SmoothingDescriptor = null; - SmoothingDescriptorAction = configure; - return Self; + Instance.Smoothing = Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor.Build(action); + return this; } /// @@ -933,168 +888,23 @@ public PhraseSuggesterDescriptor Smoothing(Action /// - public PhraseSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor Text(string? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - public PhraseSuggesterDescriptor TokenLimit(int? tokenLimit) + public Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor TokenLimit(int? value) { - TokenLimitValue = tokenLimit; - return Self; + Instance.TokenLimit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (CollateDescriptor is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, CollateDescriptor, options); - } - else if (CollateDescriptorAction is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestCollateDescriptor(CollateDescriptorAction), options); - } - else if (CollateValue is not null) - { - writer.WritePropertyName("collate"); - JsonSerializer.Serialize(writer, CollateValue, options); - } - - if (ConfidenceValue.HasValue) - { - writer.WritePropertyName("confidence"); - writer.WriteNumberValue(ConfidenceValue.Value); - } - - if (DirectGeneratorDescriptor is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DirectGeneratorDescriptor, options); - writer.WriteEndArray(); - } - else if (DirectGeneratorDescriptorAction is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(DirectGeneratorDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DirectGeneratorDescriptorActions is not null) - { - writer.WritePropertyName("direct_generator"); - writer.WriteStartArray(); - foreach (var action in DirectGeneratorDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.DirectGeneratorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DirectGeneratorValue is not null) - { - writer.WritePropertyName("direct_generator"); - JsonSerializer.Serialize(writer, DirectGeneratorValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (ForceUnigramsValue.HasValue) - { - writer.WritePropertyName("force_unigrams"); - writer.WriteBooleanValue(ForceUnigramsValue.Value); - } - - if (GramSizeValue.HasValue) - { - writer.WritePropertyName("gram_size"); - writer.WriteNumberValue(GramSizeValue.Value); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggestHighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (MaxErrorsValue.HasValue) - { - writer.WritePropertyName("max_errors"); - writer.WriteNumberValue(MaxErrorsValue.Value); - } - - if (RealWordErrorLikelihoodValue.HasValue) - { - writer.WritePropertyName("real_word_error_likelihood"); - writer.WriteNumberValue(RealWordErrorLikelihoodValue.Value); - } - - if (!string.IsNullOrEmpty(SeparatorValue)) - { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SmoothingDescriptor is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, SmoothingDescriptor, options); - } - else if (SmoothingDescriptorAction is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor(SmoothingDescriptorAction), options); - } - else if (SmoothingValue is not null) - { - writer.WritePropertyName("smoothing"); - JsonSerializer.Serialize(writer, SmoothingValue, options); - } - - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } - - if (TokenLimitValue.HasValue) - { - writer.WritePropertyName("token_limit"); - writer.WriteNumberValue(TokenLimitValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PhraseSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PointInTimeReference.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PointInTimeReference.g.cs index f68dcb3a6cd..4e01b3e9a97 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PointInTimeReference.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/PointInTimeReference.g.cs @@ -17,58 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class PointInTimeReferenceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropKeepAlive = System.Text.Json.JsonEncodedText.Encode("keep_alive"); + + public override Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propKeepAlive = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propKeepAlive.TryReadProperty(ref reader, options, PropKeepAlive, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + KeepAlive = propKeepAlive.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropKeepAlive, value.KeepAlive, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceConverter))] public sealed partial class PointInTimeReference { - [JsonInclude, JsonPropertyName("id")] - public string Id { get; set; } - [JsonInclude, JsonPropertyName("keep_alive")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointInTimeReference(string id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public PointInTimeReference() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PointInTimeReference() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PointInTimeReference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get; set; } } -public sealed partial class PointInTimeReferenceDescriptor : SerializableDescriptor +public readonly partial struct PointInTimeReferenceDescriptor { - internal PointInTimeReferenceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference Instance { get; init; } - public PointInTimeReferenceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointInTimeReferenceDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference instance) { + Instance = instance; } - private string IdValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? KeepAliveValue { get; set; } - - public PointInTimeReferenceDescriptor Id(string id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointInTimeReferenceDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PointInTimeReferenceDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? keepAlive) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference instance) => new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference(Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor Id(string value) { - KeepAliveValue = keepAlive; - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor KeepAlive(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(IdValue); - if (KeepAliveValue is not null) - { - writer.WritePropertyName("keep_alive"); - JsonSerializer.Serialize(writer, KeepAliveValue, options); - } + Instance.KeepAlive = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReferenceDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.PointInTimeReference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Profile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Profile.g.cs index b266403c9e3..5c0d306311d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Profile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Profile.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class ProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.Core.Search.Profile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Profile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Profile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.ProfileConverter))] public sealed partial class Profile { - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyCollection Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Profile(System.Collections.Generic.IReadOnlyCollection shards) + { + Shards = shards; + } +#if NET7_0_OR_GREATER + public Profile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Profile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Profile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryBreakdown.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryBreakdown.g.cs index d89976f2084..378e3abf99e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryBreakdown.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryBreakdown.g.cs @@ -17,56 +17,364 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class QueryBreakdownConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdvance = System.Text.Json.JsonEncodedText.Encode("advance"); + private static readonly System.Text.Json.JsonEncodedText PropAdvanceCount = System.Text.Json.JsonEncodedText.Encode("advance_count"); + private static readonly System.Text.Json.JsonEncodedText PropBuildScorer = System.Text.Json.JsonEncodedText.Encode("build_scorer"); + private static readonly System.Text.Json.JsonEncodedText PropBuildScorerCount = System.Text.Json.JsonEncodedText.Encode("build_scorer_count"); + private static readonly System.Text.Json.JsonEncodedText PropComputeMaxScore = System.Text.Json.JsonEncodedText.Encode("compute_max_score"); + private static readonly System.Text.Json.JsonEncodedText PropComputeMaxScoreCount = System.Text.Json.JsonEncodedText.Encode("compute_max_score_count"); + private static readonly System.Text.Json.JsonEncodedText PropCountWeight = System.Text.Json.JsonEncodedText.Encode("count_weight"); + private static readonly System.Text.Json.JsonEncodedText PropCountWeightCount = System.Text.Json.JsonEncodedText.Encode("count_weight_count"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeight = System.Text.Json.JsonEncodedText.Encode("create_weight"); + private static readonly System.Text.Json.JsonEncodedText PropCreateWeightCount = System.Text.Json.JsonEncodedText.Encode("create_weight_count"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropMatchCount = System.Text.Json.JsonEncodedText.Encode("match_count"); + private static readonly System.Text.Json.JsonEncodedText PropNextDoc = System.Text.Json.JsonEncodedText.Encode("next_doc"); + private static readonly System.Text.Json.JsonEncodedText PropNextDocCount = System.Text.Json.JsonEncodedText.Encode("next_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropScoreCount = System.Text.Json.JsonEncodedText.Encode("score_count"); + private static readonly System.Text.Json.JsonEncodedText PropSetMinCompetitiveScore = System.Text.Json.JsonEncodedText.Encode("set_min_competitive_score"); + private static readonly System.Text.Json.JsonEncodedText PropSetMinCompetitiveScoreCount = System.Text.Json.JsonEncodedText.Encode("set_min_competitive_score_count"); + private static readonly System.Text.Json.JsonEncodedText PropShallowAdvance = System.Text.Json.JsonEncodedText.Encode("shallow_advance"); + private static readonly System.Text.Json.JsonEncodedText PropShallowAdvanceCount = System.Text.Json.JsonEncodedText.Encode("shallow_advance_count"); + + public override Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdvance = default; + LocalJsonValue propAdvanceCount = default; + LocalJsonValue propBuildScorer = default; + LocalJsonValue propBuildScorerCount = default; + LocalJsonValue propComputeMaxScore = default; + LocalJsonValue propComputeMaxScoreCount = default; + LocalJsonValue propCountWeight = default; + LocalJsonValue propCountWeightCount = default; + LocalJsonValue propCreateWeight = default; + LocalJsonValue propCreateWeightCount = default; + LocalJsonValue propMatch = default; + LocalJsonValue propMatchCount = default; + LocalJsonValue propNextDoc = default; + LocalJsonValue propNextDocCount = default; + LocalJsonValue propScore = default; + LocalJsonValue propScoreCount = default; + LocalJsonValue propSetMinCompetitiveScore = default; + LocalJsonValue propSetMinCompetitiveScoreCount = default; + LocalJsonValue propShallowAdvance = default; + LocalJsonValue propShallowAdvanceCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdvance.TryReadProperty(ref reader, options, PropAdvance, null)) + { + continue; + } + + if (propAdvanceCount.TryReadProperty(ref reader, options, PropAdvanceCount, null)) + { + continue; + } + + if (propBuildScorer.TryReadProperty(ref reader, options, PropBuildScorer, null)) + { + continue; + } + + if (propBuildScorerCount.TryReadProperty(ref reader, options, PropBuildScorerCount, null)) + { + continue; + } + + if (propComputeMaxScore.TryReadProperty(ref reader, options, PropComputeMaxScore, null)) + { + continue; + } + + if (propComputeMaxScoreCount.TryReadProperty(ref reader, options, PropComputeMaxScoreCount, null)) + { + continue; + } + + if (propCountWeight.TryReadProperty(ref reader, options, PropCountWeight, null)) + { + continue; + } + + if (propCountWeightCount.TryReadProperty(ref reader, options, PropCountWeightCount, null)) + { + continue; + } + + if (propCreateWeight.TryReadProperty(ref reader, options, PropCreateWeight, null)) + { + continue; + } + + if (propCreateWeightCount.TryReadProperty(ref reader, options, PropCreateWeightCount, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propMatchCount.TryReadProperty(ref reader, options, PropMatchCount, null)) + { + continue; + } + + if (propNextDoc.TryReadProperty(ref reader, options, PropNextDoc, null)) + { + continue; + } + + if (propNextDocCount.TryReadProperty(ref reader, options, PropNextDocCount, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propScoreCount.TryReadProperty(ref reader, options, PropScoreCount, null)) + { + continue; + } + + if (propSetMinCompetitiveScore.TryReadProperty(ref reader, options, PropSetMinCompetitiveScore, null)) + { + continue; + } + + if (propSetMinCompetitiveScoreCount.TryReadProperty(ref reader, options, PropSetMinCompetitiveScoreCount, null)) + { + continue; + } + + if (propShallowAdvance.TryReadProperty(ref reader, options, PropShallowAdvance, null)) + { + continue; + } + + if (propShallowAdvanceCount.TryReadProperty(ref reader, options, PropShallowAdvanceCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Advance = propAdvance.Value, + AdvanceCount = propAdvanceCount.Value, + BuildScorer = propBuildScorer.Value, + BuildScorerCount = propBuildScorerCount.Value, + ComputeMaxScore = propComputeMaxScore.Value, + ComputeMaxScoreCount = propComputeMaxScoreCount.Value, + CountWeight = propCountWeight.Value, + CountWeightCount = propCountWeightCount.Value, + CreateWeight = propCreateWeight.Value, + CreateWeightCount = propCreateWeightCount.Value, + Match = propMatch.Value, + MatchCount = propMatchCount.Value, + NextDoc = propNextDoc.Value, + NextDocCount = propNextDocCount.Value, + Score = propScore.Value, + ScoreCount = propScoreCount.Value, + SetMinCompetitiveScore = propSetMinCompetitiveScore.Value, + SetMinCompetitiveScoreCount = propSetMinCompetitiveScoreCount.Value, + ShallowAdvance = propShallowAdvance.Value, + ShallowAdvanceCount = propShallowAdvanceCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdvance, value.Advance, null, null); + writer.WriteProperty(options, PropAdvanceCount, value.AdvanceCount, null, null); + writer.WriteProperty(options, PropBuildScorer, value.BuildScorer, null, null); + writer.WriteProperty(options, PropBuildScorerCount, value.BuildScorerCount, null, null); + writer.WriteProperty(options, PropComputeMaxScore, value.ComputeMaxScore, null, null); + writer.WriteProperty(options, PropComputeMaxScoreCount, value.ComputeMaxScoreCount, null, null); + writer.WriteProperty(options, PropCountWeight, value.CountWeight, null, null); + writer.WriteProperty(options, PropCountWeightCount, value.CountWeightCount, null, null); + writer.WriteProperty(options, PropCreateWeight, value.CreateWeight, null, null); + writer.WriteProperty(options, PropCreateWeightCount, value.CreateWeightCount, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropMatchCount, value.MatchCount, null, null); + writer.WriteProperty(options, PropNextDoc, value.NextDoc, null, null); + writer.WriteProperty(options, PropNextDocCount, value.NextDocCount, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropScoreCount, value.ScoreCount, null, null); + writer.WriteProperty(options, PropSetMinCompetitiveScore, value.SetMinCompetitiveScore, null, null); + writer.WriteProperty(options, PropSetMinCompetitiveScoreCount, value.SetMinCompetitiveScoreCount, null, null); + writer.WriteProperty(options, PropShallowAdvance, value.ShallowAdvance, null, null); + writer.WriteProperty(options, PropShallowAdvanceCount, value.ShallowAdvanceCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdownConverter))] public sealed partial class QueryBreakdown { - [JsonInclude, JsonPropertyName("advance")] - public long Advance { get; init; } - [JsonInclude, JsonPropertyName("advance_count")] - public long AdvanceCount { get; init; } - [JsonInclude, JsonPropertyName("build_scorer")] - public long BuildScorer { get; init; } - [JsonInclude, JsonPropertyName("build_scorer_count")] - public long BuildScorerCount { get; init; } - [JsonInclude, JsonPropertyName("compute_max_score")] - public long ComputeMaxScore { get; init; } - [JsonInclude, JsonPropertyName("compute_max_score_count")] - public long ComputeMaxScoreCount { get; init; } - [JsonInclude, JsonPropertyName("count_weight")] - public long CountWeight { get; init; } - [JsonInclude, JsonPropertyName("count_weight_count")] - public long CountWeightCount { get; init; } - [JsonInclude, JsonPropertyName("create_weight")] - public long CreateWeight { get; init; } - [JsonInclude, JsonPropertyName("create_weight_count")] - public long CreateWeightCount { get; init; } - [JsonInclude, JsonPropertyName("match")] - public long Match { get; init; } - [JsonInclude, JsonPropertyName("match_count")] - public long MatchCount { get; init; } - [JsonInclude, JsonPropertyName("next_doc")] - public long NextDoc { get; init; } - [JsonInclude, JsonPropertyName("next_doc_count")] - public long NextDocCount { get; init; } - [JsonInclude, JsonPropertyName("score")] - public long Score { get; init; } - [JsonInclude, JsonPropertyName("score_count")] - public long ScoreCount { get; init; } - [JsonInclude, JsonPropertyName("set_min_competitive_score")] - public long SetMinCompetitiveScore { get; init; } - [JsonInclude, JsonPropertyName("set_min_competitive_score_count")] - public long SetMinCompetitiveScoreCount { get; init; } - [JsonInclude, JsonPropertyName("shallow_advance")] - public long ShallowAdvance { get; init; } - [JsonInclude, JsonPropertyName("shallow_advance_count")] - public long ShallowAdvanceCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryBreakdown(long advance, long advanceCount, long buildScorer, long buildScorerCount, long computeMaxScore, long computeMaxScoreCount, long countWeight, long countWeightCount, long createWeight, long createWeightCount, long match, long matchCount, long nextDoc, long nextDocCount, long score, long scoreCount, long setMinCompetitiveScore, long setMinCompetitiveScoreCount, long shallowAdvance, long shallowAdvanceCount) + { + Advance = advance; + AdvanceCount = advanceCount; + BuildScorer = buildScorer; + BuildScorerCount = buildScorerCount; + ComputeMaxScore = computeMaxScore; + ComputeMaxScoreCount = computeMaxScoreCount; + CountWeight = countWeight; + CountWeightCount = countWeightCount; + CreateWeight = createWeight; + CreateWeightCount = createWeightCount; + Match = match; + MatchCount = matchCount; + NextDoc = nextDoc; + NextDocCount = nextDocCount; + Score = score; + ScoreCount = scoreCount; + SetMinCompetitiveScore = setMinCompetitiveScore; + SetMinCompetitiveScoreCount = setMinCompetitiveScoreCount; + ShallowAdvance = shallowAdvance; + ShallowAdvanceCount = shallowAdvanceCount; + } +#if NET7_0_OR_GREATER + public QueryBreakdown() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryBreakdown() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryBreakdown(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Advance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long AdvanceCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildScorer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BuildScorerCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ComputeMaxScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ComputeMaxScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CountWeight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CountWeightCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CreateWeightCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Match { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MatchCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NextDoc { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NextDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Score { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SetMinCompetitiveScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SetMinCompetitiveScoreCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShallowAdvance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShallowAdvanceCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryProfile.g.cs index 3d3ed012fa2..bac97c9cae5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/QueryProfile.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class QueryProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBreakdown = System.Text.Json.JsonEncodedText.Encode("breakdown"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInNanos = System.Text.Json.JsonEncodedText.Encode("time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Core.Search.QueryProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBreakdown = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue propDescription = default; + LocalJsonValue propTimeInNanos = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBreakdown.TryReadProperty(ref reader, options, PropBreakdown, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propTimeInNanos.TryReadProperty(ref reader, options, PropTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.QueryProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Breakdown = propBreakdown.Value, + Children = propChildren.Value, + Description = propDescription.Value, + TimeInNanos = propTimeInNanos.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.QueryProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBreakdown, value.Breakdown, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropTimeInNanos, value.TimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.QueryProfileConverter))] public sealed partial class QueryProfile { - [JsonInclude, JsonPropertyName("breakdown")] - public Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown Breakdown { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("time_in_nanos")] - public long TimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryProfile(Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown breakdown, string description, System.TimeSpan timeInNanos, string type) + { + Breakdown = breakdown; + Description = description; + TimeInNanos = timeInNanos; + Type = type; + } +#if NET7_0_OR_GREATER + public QueryProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.QueryBreakdown Breakdown { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RegexOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RegexOptions.g.cs index dbf837cfbb7..5682afa54e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RegexOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RegexOptions.g.cs @@ -17,55 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class RegexOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDeterminizedStates = System.Text.Json.JsonEncodedText.Encode("max_determinized_states"); + + public override Elastic.Clients.Elasticsearch.Core.Search.RegexOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFlags = default; + LocalJsonValue propMaxDeterminizedStates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFlags.TryReadProperty(ref reader, options, PropFlags, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propMaxDeterminizedStates.TryReadProperty(ref reader, options, PropMaxDeterminizedStates, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.RegexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Flags = propFlags.Value, + MaxDeterminizedStates = propMaxDeterminizedStates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.RegexOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFlags, value.Flags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropMaxDeterminizedStates, value.MaxDeterminizedStates, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsConverter))] public sealed partial class RegexOptions { +#if NET7_0_OR_GREATER + public RegexOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public RegexOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RegexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Optional operators for the regular expression. /// /// - [JsonInclude, JsonPropertyName("flags")] - public object? Flags { get; set; } + public Elastic.Clients.Elasticsearch.Union? Flags { get; set; } /// /// /// Maximum number of automaton states required for the query. /// /// - [JsonInclude, JsonPropertyName("max_determinized_states")] public int? MaxDeterminizedStates { get; set; } } -public sealed partial class RegexOptionsDescriptor : SerializableDescriptor +public readonly partial struct RegexOptionsDescriptor { - internal RegexOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.RegexOptions Instance { get; init; } - public RegexOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexOptionsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions instance) { + Instance = instance; } - private object? FlagsValue { get; set; } - private int? MaxDeterminizedStatesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.RegexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RegexOptions instance) => new Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.RegexOptions(Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// Optional operators for the regular expression. /// /// - public RegexOptionsDescriptor Flags(object? flags) + public Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor Flags(Elastic.Clients.Elasticsearch.Union? value) { - FlagsValue = flags; - return Self; + Instance.Flags = value; + return this; } /// @@ -73,27 +140,22 @@ public RegexOptionsDescriptor Flags(object? flags) /// Maximum number of automaton states required for the query. /// /// - public RegexOptionsDescriptor MaxDeterminizedStates(int? maxDeterminizedStates) + public Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor MaxDeterminizedStates(int? value) { - MaxDeterminizedStatesValue = maxDeterminizedStates; - return Self; + Instance.MaxDeterminizedStates = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.RegexOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (FlagsValue is not null) + if (action is null) { - writer.WritePropertyName("flags"); - JsonSerializer.Serialize(writer, FlagsValue, options); + return new Elastic.Clients.Elasticsearch.Core.Search.RegexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MaxDeterminizedStatesValue.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(MaxDeterminizedStatesValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.RegexOptionsDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.RegexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Rescore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Rescore.g.cs index 4690dd4d38a..b67e0ed8476 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Rescore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Rescore.g.cs @@ -17,271 +17,252 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -[JsonConverter(typeof(RescoreConverter))] -public sealed partial class Rescore +internal sealed partial class RescoreConverter : System.Text.Json.Serialization.JsonConverter { - internal Rescore(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText PropWindowSize = System.Text.Json.JsonEncodedText.Encode("window_size"); + private static readonly System.Text.Json.JsonEncodedText VariantLearningToRank = System.Text.Json.JsonEncodedText.Encode("learning_to_rank"); + private static readonly System.Text.Json.JsonEncodedText VariantQuery = System.Text.Json.JsonEncodedText.Encode("query"); - public static Rescore LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank learningToRank) => new Rescore("learning_to_rank", learningToRank); - public static Rescore Query(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery rescoreQuery) => new Rescore("query", rescoreQuery); - - [JsonInclude, JsonPropertyName("window_size")] - public int? WindowSize { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.Core.Search.Rescore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propWindowSize = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class RescoreConverter : JsonConverter -{ - public override Rescore Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - int? windowSizeValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propWindowSize.TryReadProperty(ref reader, options, PropWindowSize, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "window_size") + if (reader.ValueTextEquals(VariantLearningToRank)) { - windowSizeValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantLearningToRank.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "learning_to_rank") + if (reader.ValueTextEquals(VariantQuery)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantQuery.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "query") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Rescore' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Rescore(variantNameValue, variantValue); - result.WindowSize = windowSizeValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + WindowSize = propWindowSize.Value + }; } - public override void Write(Utf8JsonWriter writer, Rescore value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Rescore value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.WindowSize.HasValue) + switch (value.VariantType) { - writer.WritePropertyName("window_size"); - writer.WriteNumberValue(value.WindowSize.Value); - } - - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "learning_to_rank": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.LearningToRank)value.Variant, options); - break; - case "query": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery)value.Variant, options); - break; - } + case null: + break; + case "learning_to_rank": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.LearningToRank)value.Variant, null, null); + break; + case "query": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.Rescore)}'."); } + writer.WriteProperty(options, PropWindowSize, value.WindowSize, null, null); writer.WriteEndObject(); } } -public sealed partial class RescoreDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.RescoreConverter))] +public sealed partial class Rescore { - internal RescoreDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Rescore() + { + } +#endif +#if !NET7_0_OR_GREATER + public Rescore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public RescoreDescriptor() : base() + public Elastic.Clients.Elasticsearch.Core.Search.LearningToRank? LearningToRank { get => GetVariant("learning_to_rank"); set => SetVariant("learning_to_rank", value); } + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery? Query { get => GetVariant("query"); set => SetVariant("query", value); } + public int? WindowSize { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank value) => new Elastic.Clients.Elasticsearch.Core.Search.Rescore { LearningToRank = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery value) => new Elastic.Clients.Elasticsearch.Core.Search.Rescore { Query = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct RescoreDescriptor +{ + internal Elastic.Clients.Elasticsearch.Core.Search.Rescore Instance { get; init; } - private RescoreDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Rescore instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private RescoreDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? WindowSizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Rescore instance) => new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) => descriptor.Instance; - public RescoreDescriptor WindowSize(int? windowSize) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank? value) { - WindowSizeValue = windowSize; - return Self; + Instance.LearningToRank = value; + return this; } - public RescoreDescriptor LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank learningToRank) => Set(learningToRank, "learning_to_rank"); - public RescoreDescriptor LearningToRank(Action configure) => Set(configure, "learning_to_rank"); - public RescoreDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery rescoreQuery) => Set(rescoreQuery, "query"); - public RescoreDescriptor Query(Action> configure) => Set(configure, "query"); + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor LearningToRank(System.Action action) + { + Instance.LearningToRank = Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery? value) { - writer.WriteStartObject(); - if (WindowSizeValue.HasValue) - { - writer.WritePropertyName("window_size"); - writer.WriteNumberValue(WindowSizeValue.Value); - } + Instance.Query = value; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor WindowSize(int? value) + { + Instance.WindowSize = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Rescore Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RescoreDescriptor : SerializableDescriptor +public readonly partial struct RescoreDescriptor { - internal RescoreDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.Rescore Instance { get; init; } - public RescoreDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Rescore instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RescoreDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private RescoreDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Rescore instance) => new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.LearningToRank = value; + return this; } - private int? WindowSizeValue { get; set; } - - public RescoreDescriptor WindowSize(int? windowSize) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor LearningToRank(System.Action action) { - WindowSizeValue = windowSize; - return Self; + Instance.LearningToRank = Elastic.Clients.Elasticsearch.Core.Search.LearningToRankDescriptor.Build(action); + return this; } - public RescoreDescriptor LearningToRank(Elastic.Clients.Elasticsearch.Core.Search.LearningToRank learningToRank) => Set(learningToRank, "learning_to_rank"); - public RescoreDescriptor LearningToRank(Action configure) => Set(configure, "learning_to_rank"); - public RescoreDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery rescoreQuery) => Set(rescoreQuery, "query"); - public RescoreDescriptor Query(Action configure) => Set(configure, "query"); + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor Query(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery? value) + { + Instance.Query = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor Query(System.Action action) { - writer.WriteStartObject(); - if (WindowSizeValue.HasValue) - { - writer.WritePropertyName("window_size"); - writer.WriteNumberValue(WindowSizeValue.Value); - } + Instance.Query = Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor.Build(action); + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor WindowSize(int? value) + { + Instance.WindowSize = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Rescore Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.RescoreDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Rescore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RescoreQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RescoreQuery.g.cs index ff7b9c82982..1da332daa21 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RescoreQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/RescoreQuery.g.cs @@ -17,33 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class RescoreQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("rescore_query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryWeight = System.Text.Json.JsonEncodedText.Encode("query_weight"); + private static readonly System.Text.Json.JsonEncodedText PropRescoreQueryWeight = System.Text.Json.JsonEncodedText.Encode("rescore_query_weight"); + private static readonly System.Text.Json.JsonEncodedText PropScoreMode = System.Text.Json.JsonEncodedText.Encode("score_mode"); + + public override Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propQuery = default; + LocalJsonValue propQueryWeight = default; + LocalJsonValue propRescoreQueryWeight = default; + LocalJsonValue propScoreMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryWeight.TryReadProperty(ref reader, options, PropQueryWeight, null)) + { + continue; + } + + if (propRescoreQueryWeight.TryReadProperty(ref reader, options, PropRescoreQueryWeight, null)) + { + continue; + } + + if (propScoreMode.TryReadProperty(ref reader, options, PropScoreMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Query = propQuery.Value, + QueryWeight = propQueryWeight.Value, + RescoreQueryWeight = propRescoreQueryWeight.Value, + ScoreMode = propScoreMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryWeight, value.QueryWeight, null, null); + writer.WriteProperty(options, PropRescoreQueryWeight, value.RescoreQueryWeight, null, null); + writer.WriteProperty(options, PropScoreMode, value.ScoreMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryConverter))] public sealed partial class RescoreQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public RescoreQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RescoreQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The query to use for rescoring. /// This query is only run on the Top-K results returned by the query and post_filter phases. /// /// - [JsonInclude, JsonPropertyName("rescore_query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } /// /// /// Relative importance of the original query versus the rescore query. /// /// - [JsonInclude, JsonPropertyName("query_weight")] public double? QueryWeight { get; set; } /// @@ -51,7 +138,6 @@ public sealed partial class RescoreQuery /// Relative importance of the rescore query versus the original query. /// /// - [JsonInclude, JsonPropertyName("rescore_query_weight")] public double? RescoreQueryWeight { get; set; } /// @@ -59,26 +145,27 @@ public sealed partial class RescoreQuery /// Determines how scores are combined. /// /// - [JsonInclude, JsonPropertyName("score_mode")] public Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? ScoreMode { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Rescore(RescoreQuery rescoreQuery) => Elastic.Clients.Elasticsearch.Core.Search.Rescore.Query(rescoreQuery); } -public sealed partial class RescoreQueryDescriptor : SerializableDescriptor> +public readonly partial struct RescoreQueryDescriptor { - internal RescoreQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery Instance { get; init; } - public RescoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private double? QueryWeightValue { get; set; } - private double? RescoreQueryWeightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? ScoreModeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery instance) => new Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -86,28 +173,22 @@ public RescoreQueryDescriptor() : base() /// This query is only run on the Top-K results returned by the query and post_filter phases. /// /// - public RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public RescoreQueryDescriptor Query(Action> configure) + /// + /// + /// The query to use for rescoring. + /// This query is only run on the Top-K results returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -115,10 +196,10 @@ public RescoreQueryDescriptor Query(Action /// - public RescoreQueryDescriptor QueryWeight(double? queryWeight) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor QueryWeight(double? value) { - QueryWeightValue = queryWeight; - return Self; + Instance.QueryWeight = value; + return this; } /// @@ -126,10 +207,10 @@ public RescoreQueryDescriptor QueryWeight(double? queryWeight) /// Relative importance of the rescore query versus the original query. /// /// - public RescoreQueryDescriptor RescoreQueryWeight(double? rescoreQueryWeight) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor RescoreQueryWeight(double? value) { - RescoreQueryWeightValue = rescoreQueryWeight; - return Self; + Instance.RescoreQueryWeight = value; + return this; } /// @@ -137,67 +218,39 @@ public RescoreQueryDescriptor RescoreQueryWeight(double? rescoreQuery /// Determines how scores are combined. /// /// - public RescoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (QueryWeightValue.HasValue) - { - writer.WritePropertyName("query_weight"); - writer.WriteNumberValue(QueryWeightValue.Value); - } - - if (RescoreQueryWeightValue.HasValue) - { - writer.WritePropertyName("rescore_query_weight"); - writer.WriteNumberValue(RescoreQueryWeightValue.Value); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RescoreQueryDescriptor : SerializableDescriptor +public readonly partial struct RescoreQueryDescriptor { - internal RescoreQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery Instance { get; init; } - public RescoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private double? QueryWeightValue { get; set; } - private double? RescoreQueryWeightValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? ScoreModeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery instance) => new Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -205,28 +258,34 @@ public RescoreQueryDescriptor() : base() /// This query is only run on the Top-K results returned by the query and post_filter phases. /// /// - public RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public RescoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The query to use for rescoring. + /// This query is only run on the Top-K results returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RescoreQueryDescriptor Query(Action configure) + /// + /// + /// The query to use for rescoring. + /// This query is only run on the Top-K results returned by the query and post_filter phases. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -234,10 +293,10 @@ public RescoreQueryDescriptor Query(Action /// - public RescoreQueryDescriptor QueryWeight(double? queryWeight) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor QueryWeight(double? value) { - QueryWeightValue = queryWeight; - return Self; + Instance.QueryWeight = value; + return this; } /// @@ -245,10 +304,10 @@ public RescoreQueryDescriptor QueryWeight(double? queryWeight) /// Relative importance of the rescore query versus the original query. /// /// - public RescoreQueryDescriptor RescoreQueryWeight(double? rescoreQueryWeight) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor RescoreQueryWeight(double? value) { - RescoreQueryWeightValue = rescoreQueryWeight; - return Self; + Instance.RescoreQueryWeight = value; + return this; } /// @@ -256,49 +315,17 @@ public RescoreQueryDescriptor RescoreQueryWeight(double? rescoreQueryWeight) /// Determines how scores are combined. /// /// - public RescoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery Build(System.Action action) { - writer.WriteStartObject(); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("rescore_query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (QueryWeightValue.HasValue) - { - writer.WritePropertyName("query_weight"); - writer.WriteNumberValue(QueryWeightValue.Value); - } - - if (RescoreQueryWeightValue.HasValue) - { - writer.WritePropertyName("rescore_query_weight"); - writer.WriteNumberValue(RescoreQueryWeightValue.Value); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.RescoreQueryDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.RescoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SearchProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SearchProfile.g.cs index f90b2765ee4..66401a1fabd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SearchProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SearchProfile.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class SearchProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollector = System.Text.Json.JsonEncodedText.Encode("collector"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRewriteTime = System.Text.Json.JsonEncodedText.Encode("rewrite_time"); + + public override Elastic.Clients.Elasticsearch.Core.Search.SearchProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propCollector = default; + LocalJsonValue> propQuery = default; + LocalJsonValue propRewriteTime = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollector.TryReadProperty(ref reader, options, PropCollector, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRewriteTime.TryReadProperty(ref reader, options, PropRewriteTime, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.SearchProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collector = propCollector.Value, + Query = propQuery.Value, + RewriteTime = propRewriteTime.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SearchProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollector, value.Collector, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRewriteTime, value.RewriteTime, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SearchProfileConverter))] public sealed partial class SearchProfile { - [JsonInclude, JsonPropertyName("collector")] - public IReadOnlyCollection Collector { get; init; } - [JsonInclude, JsonPropertyName("query")] - public IReadOnlyCollection Query { get; init; } - [JsonInclude, JsonPropertyName("rewrite_time")] - public long RewriteTime { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchProfile(System.Collections.Generic.IReadOnlyCollection collector, System.Collections.Generic.IReadOnlyCollection query, long rewriteTime) + { + Collector = collector; + Query = query; + RewriteTime = rewriteTime; + } +#if NET7_0_OR_GREATER + public SearchProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Collector { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RewriteTime { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/ShardProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/ShardProfile.g.cs index 20cfb6d97b0..53a05077717 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/ShardProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/ShardProfile.g.cs @@ -17,34 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class ShardProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDfs = System.Text.Json.JsonEncodedText.Encode("dfs"); + private static readonly System.Text.Json.JsonEncodedText PropFetch = System.Text.Json.JsonEncodedText.Encode("fetch"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropSearches = System.Text.Json.JsonEncodedText.Encode("searches"); + private static readonly System.Text.Json.JsonEncodedText PropShardId = System.Text.Json.JsonEncodedText.Encode("shard_id"); + + public override Elastic.Clients.Elasticsearch.Core.Search.ShardProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAggregations = default; + LocalJsonValue propCluster = default; + LocalJsonValue propDfs = default; + LocalJsonValue propFetch = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propNodeId = default; + LocalJsonValue> propSearches = default; + LocalJsonValue propShardId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, null)) + { + continue; + } + + if (propDfs.TryReadProperty(ref reader, options, PropDfs, null)) + { + continue; + } + + if (propFetch.TryReadProperty(ref reader, options, PropFetch, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propSearches.TryReadProperty(ref reader, options, PropSearches, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShardId.TryReadProperty(ref reader, options, PropShardId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.ShardProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Cluster = propCluster.Value, + Dfs = propDfs.Value, + Fetch = propFetch.Value, + Id = propId.Value, + Index = propIndex.Value, + NodeId = propNodeId.Value, + Searches = propSearches.Value, + ShardId = propShardId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.ShardProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, null); + writer.WriteProperty(options, PropDfs, value.Dfs, null, null); + writer.WriteProperty(options, PropFetch, value.Fetch, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropSearches, value.Searches, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShardId, value.ShardId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.ShardProfileConverter))] public sealed partial class ShardProfile { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyCollection Aggregations { get; init; } - [JsonInclude, JsonPropertyName("cluster")] - public string Cluster { get; init; } - [JsonInclude, JsonPropertyName("dfs")] - public Elastic.Clients.Elasticsearch.Core.Search.DfsProfile? Dfs { get; init; } - [JsonInclude, JsonPropertyName("fetch")] - public Elastic.Clients.Elasticsearch.Core.Search.FetchProfile? Fetch { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("searches")] - public IReadOnlyCollection Searches { get; init; } - [JsonInclude, JsonPropertyName("shard_id")] - public long ShardId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardProfile(System.Collections.Generic.IReadOnlyCollection aggregations, string cluster, string id, string index, string nodeId, System.Collections.Generic.IReadOnlyCollection searches, long shardId) + { + Aggregations = aggregations; + Cluster = cluster; + Id = id; + Index = index; + NodeId = nodeId; + Searches = searches; + ShardId = shardId; + } +#if NET7_0_OR_GREATER + public ShardProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Cluster { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.DfsProfile? Dfs { get; set; } + public Elastic.Clients.Elasticsearch.Core.Search.FetchProfile? Fetch { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Searches { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShardId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SmoothingModel.g.cs index 9d3e6ebe178..553ce3b7019 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SmoothingModel.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SmoothingModel.g.cs @@ -17,241 +17,245 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -[JsonConverter(typeof(SmoothingModelConverter))] -public sealed partial class SmoothingModel +internal sealed partial class SmoothingModelConverter : System.Text.Json.Serialization.JsonConverter { - internal SmoothingModel(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantLaplace = System.Text.Json.JsonEncodedText.Encode("laplace"); + private static readonly System.Text.Json.JsonEncodedText VariantLinearInterpolation = System.Text.Json.JsonEncodedText.Encode("linear_interpolation"); + private static readonly System.Text.Json.JsonEncodedText VariantStupidBackoff = System.Text.Json.JsonEncodedText.Encode("stupid_backoff"); - public static SmoothingModel Laplace(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel laplaceSmoothingModel) => new SmoothingModel("laplace", laplaceSmoothingModel); - public static SmoothingModel LinearInterpolation(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel linearInterpolationSmoothingModel) => new SmoothingModel("linear_interpolation", linearInterpolationSmoothingModel); - public static SmoothingModel StupidBackoff(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel stupidBackoffSmoothingModel) => new SmoothingModel("stupid_backoff", stupidBackoffSmoothingModel); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class SmoothingModelConverter : JsonConverter -{ - public override SmoothingModel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantLaplace)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantLaplace.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "laplace") + if (reader.ValueTextEquals(VariantLinearInterpolation)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLinearInterpolation.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "linear_interpolation") + if (reader.ValueTextEquals(VariantStupidBackoff)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantStupidBackoff.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "stupid_backoff") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'SmoothingModel' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new SmoothingModel(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, SmoothingModel value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "laplace": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel)value.Variant, options); - break; - case "linear_interpolation": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel)value.Variant, options); - break; - case "stupid_backoff": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel)value.Variant, options); - break; - } + case null: + break; + case "laplace": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel)value.Variant, null, null); + break; + case "linear_interpolation": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel)value.Variant, null, null); + break; + case "stupid_backoff": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel)}'."); } writer.WriteEndObject(); } } -public sealed partial class SmoothingModelDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelConverter))] +public sealed partial class SmoothingModel { - internal SmoothingModelDescriptor(Action> configure) => configure.Invoke(this); - - public SmoothingModelDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public SmoothingModel() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private SmoothingModelDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public SmoothingModel() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private SmoothingModelDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - public SmoothingModelDescriptor Laplace(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel laplaceSmoothingModel) => Set(laplaceSmoothingModel, "laplace"); - public SmoothingModelDescriptor Laplace(Action configure) => Set(configure, "laplace"); - public SmoothingModelDescriptor LinearInterpolation(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel linearInterpolationSmoothingModel) => Set(linearInterpolationSmoothingModel, "linear_interpolation"); - public SmoothingModelDescriptor LinearInterpolation(Action configure) => Set(configure, "linear_interpolation"); - public SmoothingModelDescriptor StupidBackoff(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel stupidBackoffSmoothingModel) => Set(stupidBackoffSmoothingModel, "stupid_backoff"); - public SmoothingModelDescriptor StupidBackoff(Action configure) => Set(configure, "stupid_backoff"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A smoothing model that uses an additive smoothing where a constant (typically 1.0 or smaller) is added to all counts to balance weights. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel? Laplace { get => GetVariant("laplace"); set => SetVariant("laplace", value); } + + /// + /// + /// A smoothing model that takes the weighted mean of the unigrams, bigrams, and trigrams based on user supplied weights (lambdas). + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel? LinearInterpolation { get => GetVariant("linear_interpolation"); set => SetVariant("linear_interpolation", value); } + + /// + /// + /// A simple backoff model that backs off to lower order n-gram models if the higher order count is 0 and discounts the lower order n-gram model by a constant factor. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel? StupidBackoff { get => GetVariant("stupid_backoff"); set => SetVariant("stupid_backoff", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel value) => new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel { Laplace = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel value) => new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel { LinearInterpolation = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel value) => new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel { StupidBackoff = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class SmoothingModelDescriptor : SerializableDescriptor +public readonly partial struct SmoothingModelDescriptor { - internal SmoothingModelDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel Instance { get; init; } - public SmoothingModelDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SmoothingModelDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel instance) => new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A smoothing model that uses an additive smoothing where a constant (typically 1.0 or smaller) is added to all counts to balance weights. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor Laplace(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel? value) + { + Instance.Laplace = value; + return this; + } - private SmoothingModelDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// A smoothing model that uses an additive smoothing where a constant (typically 1.0 or smaller) is added to all counts to balance weights. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor Laplace(System.Action action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Laplace = Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModelDescriptor.Build(action); + return this; } - private SmoothingModelDescriptor Set(object variant, string variantName) + /// + /// + /// A smoothing model that takes the weighted mean of the unigrams, bigrams, and trigrams based on user supplied weights (lambdas). + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor LinearInterpolation(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.LinearInterpolation = value; + return this; } - public SmoothingModelDescriptor Laplace(Elastic.Clients.Elasticsearch.Core.Search.LaplaceSmoothingModel laplaceSmoothingModel) => Set(laplaceSmoothingModel, "laplace"); - public SmoothingModelDescriptor Laplace(Action configure) => Set(configure, "laplace"); - public SmoothingModelDescriptor LinearInterpolation(Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModel linearInterpolationSmoothingModel) => Set(linearInterpolationSmoothingModel, "linear_interpolation"); - public SmoothingModelDescriptor LinearInterpolation(Action configure) => Set(configure, "linear_interpolation"); - public SmoothingModelDescriptor StupidBackoff(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel stupidBackoffSmoothingModel) => Set(stupidBackoffSmoothingModel, "stupid_backoff"); - public SmoothingModelDescriptor StupidBackoff(Action configure) => Set(configure, "stupid_backoff"); + /// + /// + /// A smoothing model that takes the weighted mean of the unigrams, bigrams, and trigrams based on user supplied weights (lambdas). + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor LinearInterpolation(System.Action action) + { + Instance.LinearInterpolation = Elastic.Clients.Elasticsearch.Core.Search.LinearInterpolationSmoothingModelDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A simple backoff model that backs off to lower order n-gram models if the higher order count is 0 and discounts the lower order n-gram model by a constant factor. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor StupidBackoff(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.StupidBackoff = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A simple backoff model that backs off to lower order n-gram models if the higher order count is 0 and discounts the lower order n-gram model by a constant factor. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor StupidBackoff(System.Action action) + { + Instance.StupidBackoff = Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModelDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SourceFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SourceFilter.g.cs index ecf27ebf675..e43b7c8177f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SourceFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SourceFilter.g.cs @@ -17,153 +17,204 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -internal sealed partial class SourceFilterConverter : JsonConverter +internal sealed partial class SourceFilterConverter : System.Text.Json.Serialization.JsonConverter { - public override SourceFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropExcludes = System.Text.Json.JsonEncodedText.Encode("excludes"); + private static readonly System.Text.Json.JsonEncodedText PropExcludes1 = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropIncludes = System.Text.Json.JsonEncodedText.Encode("includes"); + private static readonly System.Text.Json.JsonEncodedText PropIncludes1 = System.Text.Json.JsonEncodedText.Encode("include"); + + public override Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new SourceFilter(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + return new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "excludes" || property == "exclude") - { - reader.Read(); - variant.Excludes = new FieldsConverter().Read(ref reader, typeToConvert, options); - continue; - } - - if (property == "includes" || property == "include") - { - reader.Read(); - variant.Includes = new FieldsConverter().Read(ref reader, typeToConvert, options); - continue; - } - } + Includes = value + }; } - return variant; - } - - public override void Write(Utf8JsonWriter writer, SourceFilter value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Excludes is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExcludes = default; + LocalJsonValue propIncludes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("excludes"); - new FieldsConverter().Write(writer, value.Excludes, options); + if (propExcludes.TryReadProperty(ref reader, options, PropExcludes, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))) || propExcludes.TryReadProperty(ref reader, options, PropExcludes1, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propIncludes.TryReadProperty(ref reader, options, PropIncludes, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))) || propIncludes.TryReadProperty(ref reader, options, PropIncludes1, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Includes is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("includes"); - new FieldsConverter().Write(writer, value.Includes, options); - } + Excludes = propExcludes.Value, + Includes = propIncludes.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SourceFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExcludes, value.Excludes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropIncludes, value.Includes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); writer.WriteEndObject(); } } -[JsonConverter(typeof(SourceFilterConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterConverter))] public sealed partial class SourceFilter { +#if NET7_0_OR_GREATER + public SourceFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public SourceFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? Excludes { get; set; } public Elastic.Clients.Elasticsearch.Fields? Includes { get; set; } } -public sealed partial class SourceFilterDescriptor : SerializableDescriptor> +public readonly partial struct SourceFilterDescriptor { - internal SourceFilterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Instance { get; init; } - public SourceFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? ExcludesValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? IncludesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SourceFilterDescriptor Excludes(Elastic.Clients.Elasticsearch.Fields? excludes) + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter instance) => new Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Excludes(Elastic.Clients.Elasticsearch.Fields? value) { - ExcludesValue = excludes; - return Self; + Instance.Excludes = value; + return this; } - public SourceFilterDescriptor Includes(Elastic.Clients.Elasticsearch.Fields? includes) + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Excludes(params System.Linq.Expressions.Expression>[] value) { - IncludesValue = includes; - return Self; + Instance.Excludes = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Includes(Elastic.Clients.Elasticsearch.Fields? value) { - writer.WriteStartObject(); - if (ExcludesValue is not null) - { - writer.WritePropertyName("excludes"); - JsonSerializer.Serialize(writer, ExcludesValue, options); - } + Instance.Includes = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Includes(params System.Linq.Expressions.Expression>[] value) + { + Instance.Includes = value; + return this; + } - if (IncludesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("includes"); - JsonSerializer.Serialize(writer, IncludesValue, options); + return new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SourceFilterDescriptor : SerializableDescriptor +public readonly partial struct SourceFilterDescriptor { - internal SourceFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter instance) + { + Instance = instance; + } - public SourceFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? ExcludesValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? IncludesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter instance) => new Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor descriptor) => descriptor.Instance; - public SourceFilterDescriptor Excludes(Elastic.Clients.Elasticsearch.Fields? excludes) + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Excludes(Elastic.Clients.Elasticsearch.Fields? value) { - ExcludesValue = excludes; - return Self; + Instance.Excludes = value; + return this; } - public SourceFilterDescriptor Includes(Elastic.Clients.Elasticsearch.Fields? includes) + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Excludes(params System.Linq.Expressions.Expression>[] value) { - IncludesValue = includes; - return Self; + Instance.Excludes = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Includes(Elastic.Clients.Elasticsearch.Fields? value) { - writer.WriteStartObject(); - if (ExcludesValue is not null) - { - writer.WritePropertyName("excludes"); - JsonSerializer.Serialize(writer, ExcludesValue, options); - } + Instance.Includes = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor Includes(params System.Linq.Expressions.Expression>[] value) + { + Instance.Includes = value; + return this; + } - if (IncludesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("includes"); - JsonSerializer.Serialize(writer, IncludesValue, options); + return new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.SourceFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/StupidBackoffSmoothingModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/StupidBackoffSmoothingModel.g.cs index 0e355f7b7e9..c81a09c9827 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/StupidBackoffSmoothingModel.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/StupidBackoffSmoothingModel.g.cs @@ -17,55 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class StupidBackoffSmoothingModelConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscount = System.Text.Json.JsonEncodedText.Encode("discount"); + + public override Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDiscount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDiscount.TryReadProperty(ref reader, options, PropDiscount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Discount = propDiscount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDiscount, value.Discount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelConverter))] public sealed partial class StupidBackoffSmoothingModel { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StupidBackoffSmoothingModel(double discount) + { + Discount = discount; + } +#if NET7_0_OR_GREATER + public StupidBackoffSmoothingModel() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StupidBackoffSmoothingModel() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StupidBackoffSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A constant factor that the lower order n-gram model is discounted by. /// /// - [JsonInclude, JsonPropertyName("discount")] - public double Discount { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel(StupidBackoffSmoothingModel stupidBackoffSmoothingModel) => Elastic.Clients.Elasticsearch.Core.Search.SmoothingModel.StupidBackoff(stupidBackoffSmoothingModel); + public +#if NET7_0_OR_GREATER + required +#endif + double Discount { get; set; } } -public sealed partial class StupidBackoffSmoothingModelDescriptor : SerializableDescriptor +public readonly partial struct StupidBackoffSmoothingModelDescriptor { - internal StupidBackoffSmoothingModelDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel Instance { get; init; } - public StupidBackoffSmoothingModelDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StupidBackoffSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel instance) { + Instance = instance; } - private double DiscountValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StupidBackoffSmoothingModelDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel instance) => new Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel(Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor descriptor) => descriptor.Instance; /// /// /// A constant factor that the lower order n-gram model is discounted by. /// /// - public StupidBackoffSmoothingModelDescriptor Discount(double discount) + public Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor Discount(double value) { - DiscountValue = discount; - return Self; + Instance.Discount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("discount"); - writer.WriteNumberValue(DiscountValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModelDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.StupidBackoffSmoothingModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggest.g.cs similarity index 81% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceResponse.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggest.g.cs index 6b31527b8b9..fe2fb8f1b28 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/StreamInferenceResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggest.g.cs @@ -17,15 +17,13 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport.Products.Elasticsearch; using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; -namespace Elastic.Clients.Elasticsearch.Inference; +namespace Elastic.Clients.Elasticsearch.Core.Search; -public sealed partial class StreamInferenceResponse : ElasticsearchResponse +public partial interface ISuggest { + public string Type { get; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestDictionary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestDictionary.g.cs index 3cde4af0f69..bc6d63fe3c0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestDictionary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestDictionary.g.cs @@ -17,92 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -public partial interface ISuggest +internal sealed partial class SuggestDictionaryConverter : System.Text.Json.Serialization.JsonConverter> { -} + public override Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var dictionary = new System.Collections.Generic.Dictionary>(); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + ReadItem(ref reader, options, out string name, out System.Collections.Generic.IReadOnlyCollection value); + dictionary[name] = value; + } -[GenericConverter(typeof(SuggestDictionaryConverter<>), unwrap: true)] -public partial class SuggestDictionary : IsAReadOnlyDictionary> -{ - public SuggestDictionary(IReadOnlyDictionary> backingDictionary) : base(backingDictionary) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary(dictionary); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionary value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteStartObject(); + foreach (var pair in value) + { + WriteItem(writer, options, pair.Key, pair.Value); + } + + writer.WriteEndObject(); } - public IReadOnlyCollection>? GetCompletion(string key) => TryGet>(key); - public IReadOnlyCollection? GetPhrase(string key) => TryGet(key); - public IReadOnlyCollection? GetTerm(string key) => TryGet(key); - private IReadOnlyCollection? TryGet(string key) where T : class, ISuggest => BackingDictionary.TryGetValue(key, out var value) ? value.Cast().ToArray() : null; -} + internal static void ReadItem(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options, out string name, out System.Collections.Generic.IReadOnlyCollection value) + { + var key = reader.ReadPropertyName(options, null); + reader.Read(); + var parts = key.Split('#'); + if (parts.Length != 2) + { + throw new System.Text.Json.JsonException($"Unable to parse typed-key '{key}' for variant '{nameof(System.Collections.Generic.IReadOnlyCollection)}'."); + } -internal sealed partial class SuggestDictionaryConverter : JsonConverter> -{ - public override SuggestDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + var discriminator = parts[0]; + name = parts[1]; + value = discriminator switch + { + "completion" => reader.ReadValue>>(options, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!), + "phrase" => reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!), + "term" => reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(System.Collections.Generic.IReadOnlyCollection)}'.") + }; + } + + internal static void WriteItem(System.Text.Json.Utf8JsonWriter writer, System.Text.Json.JsonSerializerOptions options, string name, System.Collections.Generic.IReadOnlyCollection value) { - var dictionary = new Dictionary>(); - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException($"Expected {JsonTokenType.StartObject} but read {reader.TokenType}."); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + var key = System.Linq.Enumerable.First(value).Type + '#' + name; + switch (value) { - if (reader.TokenType != JsonTokenType.PropertyName) - throw new JsonException($"Expected {JsonTokenType.PropertyName} but read {reader.TokenType}."); - var name = reader.GetString(); - reader.Read(); - ReadItem(ref reader, options, dictionary, name); + case System.Collections.Generic.IReadOnlyCollection> v: + writer.WriteProperty(options, key, v, null, null); + break; + case System.Collections.Generic.IReadOnlyCollection v: + writer.WriteProperty(options, key, v, null, null); + break; + case System.Collections.Generic.IReadOnlyCollection v: + writer.WriteProperty(options, key, v, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{0}' is not supported for type '{nameof(System.Collections.Generic.IReadOnlyCollection)}'."); } + } +} - return new SuggestDictionary(dictionary); +internal sealed partial class SuggestDictionaryConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SuggestDictionary<>); } - public override void Write(Utf8JsonWriter writer, SuggestDictionary value, JsonSerializerOptions options) + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'SuggestDictionary' is a readonly type, used only on responses and does not support being written to JSON."); + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(SuggestDictionaryConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; } +} - public static void ReadItem(ref Utf8JsonReader reader, JsonSerializerOptions options, Dictionary> dictionary, string name) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SuggestDictionaryConverterFactory))] +public sealed partial class SuggestDictionary : Elastic.Clients.Elasticsearch.IsAReadOnlyDictionary> +{ + public SuggestDictionary(System.Collections.Generic.IReadOnlyDictionary> backingDictionary) : base(backingDictionary) { - var nameParts = name.Split('#'); - if (nameParts.Length != 2) - throw new JsonException($"Unable to parse typed-key '{name}'."); - var type = nameParts[0]; - switch (type) - { - case "completion": - { - var item = JsonSerializer.Deserialize>>(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "phrase": - { - var item = JsonSerializer.Deserialize>(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } - - case "term": - { - var item = JsonSerializer.Deserialize>(ref reader, options); - dictionary.Add(nameParts[1], item); - break; - } + } - default: - throw new NotSupportedException($"The tagged variant '{type}' is currently not supported."); + public bool TryGetSuggest(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out System.Collections.Generic.IReadOnlyCollection value) => BackingDictionary.TryGetValue(Sanitize(key), out value); + + public bool TryGetSuggest(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, ISuggest + { + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) + { + value = finalValue; + return true; } + + value = null; + return false; } + + public System.Collections.Generic.IReadOnlyCollection>? GetCompletion(string key) => TryGet>(key); + public System.Collections.Generic.IReadOnlyCollection? GetPhrase(string key) => TryGet(key); + public System.Collections.Generic.IReadOnlyCollection? GetTerm(string key) => TryGet(key); + private System.Collections.Generic.IReadOnlyCollection? TryGet(string key) where T : class, ISuggest => BackingDictionary.TryGetValue(Sanitize(key), out var value) ? System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Cast(value)) : null; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestFuzziness.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestFuzziness.g.cs index a6647a7ab42..3f968bc64f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestFuzziness.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/SuggestFuzziness.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class SuggestFuzzinessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropMinLength = System.Text.Json.JsonEncodedText.Encode("min_length"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropTranspositions = System.Text.Json.JsonEncodedText.Encode("transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropUnicodeAware = System.Text.Json.JsonEncodedText.Encode("unicode_aware"); + + public override Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFuzziness = default; + LocalJsonValue propMinLength = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propTranspositions = default; + LocalJsonValue propUnicodeAware = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } + + if (propMinLength.TryReadProperty(ref reader, options, PropMinLength, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (propTranspositions.TryReadProperty(ref reader, options, PropTranspositions, null)) + { + continue; + } + + if (propUnicodeAware.TryReadProperty(ref reader, options, PropUnicodeAware, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fuzziness = propFuzziness.Value, + MinLength = propMinLength.Value, + PrefixLength = propPrefixLength.Value, + Transpositions = propTranspositions.Value, + UnicodeAware = propUnicodeAware.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropMinLength, value.MinLength, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropTranspositions, value.Transpositions, null, null); + writer.WriteProperty(options, PropUnicodeAware, value.UnicodeAware, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessConverter))] public sealed partial class SuggestFuzziness { +#if NET7_0_OR_GREATER + public SuggestFuzziness() + { + } +#endif +#if !NET7_0_OR_GREATER + public SuggestFuzziness() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SuggestFuzziness(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The fuzziness factor. /// /// - [JsonInclude, JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class SuggestFuzziness /// Minimum length of the input before fuzzy suggestions are returned. /// /// - [JsonInclude, JsonPropertyName("min_length")] public int? MinLength { get; set; } /// @@ -50,7 +136,6 @@ public sealed partial class SuggestFuzziness /// Minimum length of the input, which is not checked for fuzzy alternatives. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } /// @@ -58,7 +143,6 @@ public sealed partial class SuggestFuzziness /// If set to true, transpositions are counted as one change instead of two. /// /// - [JsonInclude, JsonPropertyName("transpositions")] public bool? Transpositions { get; set; } /// @@ -67,33 +151,48 @@ public sealed partial class SuggestFuzziness /// This is slightly slower than raw bytes. /// /// - [JsonInclude, JsonPropertyName("unicode_aware")] public bool? UnicodeAware { get; set; } } -public sealed partial class SuggestFuzzinessDescriptor : SerializableDescriptor +public readonly partial struct SuggestFuzzinessDescriptor { - internal SuggestFuzzinessDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness Instance { get; init; } - public SuggestFuzzinessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestFuzzinessDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? MinLengthValue { get; set; } - private int? PrefixLengthValue { get; set; } - private bool? TranspositionsValue { get; set; } - private bool? UnicodeAwareValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestFuzzinessDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness instance) => new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness(Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The fuzziness factor. + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) + { + Instance.Fuzziness = value; + return this; + } /// /// /// The fuzziness factor. /// /// - public SuggestFuzzinessDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -101,10 +200,10 @@ public SuggestFuzzinessDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzzin /// Minimum length of the input before fuzzy suggestions are returned. /// /// - public SuggestFuzzinessDescriptor MinLength(int? minLength) + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor MinLength(int? value) { - MinLengthValue = minLength; - return Self; + Instance.MinLength = value; + return this; } /// @@ -112,10 +211,10 @@ public SuggestFuzzinessDescriptor MinLength(int? minLength) /// Minimum length of the input, which is not checked for fuzzy alternatives. /// /// - public SuggestFuzzinessDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -123,10 +222,10 @@ public SuggestFuzzinessDescriptor PrefixLength(int? prefixLength) /// If set to true, transpositions are counted as one change instead of two. /// /// - public SuggestFuzzinessDescriptor Transpositions(bool? transpositions = true) + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor Transpositions(bool? value = true) { - TranspositionsValue = transpositions; - return Self; + Instance.Transpositions = value; + return this; } /// @@ -135,45 +234,22 @@ public SuggestFuzzinessDescriptor Transpositions(bool? transpositions = true) /// This is slightly slower than raw bytes. /// /// - public SuggestFuzzinessDescriptor UnicodeAware(bool? unicodeAware = true) + public Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor UnicodeAware(bool? value = true) { - UnicodeAwareValue = unicodeAware; - return Self; + Instance.UnicodeAware = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness Build(System.Action? action) { - writer.WriteStartObject(); - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (MinLengthValue.HasValue) - { - writer.WritePropertyName("min_length"); - writer.WriteNumberValue(MinLengthValue.Value); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (TranspositionsValue.HasValue) - { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(TranspositionsValue.Value); - } - - if (UnicodeAwareValue.HasValue) + if (action is null) { - writer.WritePropertyName("unicode_aware"); - writer.WriteBooleanValue(UnicodeAwareValue.Value); + return new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzzinessDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.SuggestFuzziness(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggester.g.cs index 4c45bb505e6..1fd549dc6d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/Suggester.g.cs @@ -17,76 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -internal sealed partial class SuggesterConverter : JsonConverter +internal sealed partial class SuggesterConverter : System.Text.Json.Serialization.JsonConverter { - public override Suggester Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.Suggester Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new Suggester(); - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propSuggesters = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propText.TryReadProperty(ref reader, options, PropText, null)) { - var property = reader.GetString(); - if (property == "text") - { - variant.Text = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + propSuggesters ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value, null, null); + propSuggesters[key] = value; } - variant.Suggesters = additionalProperties; - return variant; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Suggesters = propSuggesters, + Text = propText.Value + }; } - public override void Write(Utf8JsonWriter writer, Suggester value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.Suggester value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); + writer.WriteProperty(options, PropText, value.Text, null, null); if (value.Suggesters is not null) { - foreach (var additionalProperty in value.Suggesters) + foreach (var item in value.Suggesters) { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); + writer.WriteProperty(options, item.Key, item.Value, null, null); } } - if (!string.IsNullOrEmpty(value.Text)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(value.Text); - } - writer.WriteEndObject(); } } -[JsonConverter(typeof(SuggesterConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SuggesterConverter))] public sealed partial class Suggester { +#if NET7_0_OR_GREATER + public Suggester() + { + } +#endif +#if !NET7_0_OR_GREATER + public Suggester() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The named suggesters /// /// - public IDictionary Suggesters { get; set; } + public System.Collections.Generic.IDictionary? Suggesters { get; set; } /// /// @@ -96,112 +102,202 @@ public sealed partial class Suggester public string? Text { get; set; } } -public sealed partial class SuggesterDescriptor : SerializableDescriptor> +public readonly partial struct SuggesterDescriptor { - internal SuggesterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.Suggester Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Suggester instance) + { + Instance = instance; + } - public SuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggesterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary> SuggestersValue { get; set; } - private string? TextValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Suggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) => descriptor.Instance; /// /// /// The named suggesters /// /// - public SuggesterDescriptor Suggesters(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters(System.Collections.Generic.IDictionary? value) { - SuggestersValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Suggesters = value; + return this; } /// /// - /// Global suggest text, to avoid repetition when the same text is used in several suggesters + /// The named suggesters /// /// - public SuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters() { - TextValue = text; - return Self; + Instance.Suggesters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The named suggesters + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } + Instance.Suggesters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor AddSuggester(string key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value) + { + Instance.Suggesters ??= new System.Collections.Generic.Dictionary(); + Instance.Suggesters.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor AddSuggester(string key, System.Action> action) + { + Instance.Suggesters ??= new System.Collections.Generic.Dictionary(); + Instance.Suggesters.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } - if (SuggestersValue is not null) + /// + /// + /// Global suggest text, to avoid repetition when the same text is used in several suggesters + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Text(string? value) + { + Instance.Text = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Suggester Build(System.Action>? action) + { + if (action is null) { - foreach (var additionalProperty in SuggestersValue) - { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); - } + return new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SuggesterDescriptor : SerializableDescriptor +public readonly partial struct SuggesterDescriptor { - internal SuggesterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.Suggester Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Suggester instance) + { + Instance = instance; + } - public SuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggesterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary SuggestersValue { get; set; } - private string? TextValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.Suggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor descriptor) => descriptor.Instance; /// /// /// The named suggesters /// /// - public SuggesterDescriptor Suggesters(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters(System.Collections.Generic.IDictionary? value) { - SuggestersValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Suggesters = value; + return this; } /// /// - /// Global suggest text, to avoid repetition when the same text is used in several suggesters + /// The named suggesters /// /// - public SuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters() { - TextValue = text; - return Self; + Instance.Suggesters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The named suggesters + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } + Instance.Suggesters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester.Build(action); + return this; + } - if (SuggestersValue is not null) + /// + /// + /// The named suggesters + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Suggesters(System.Action>? action) + { + Instance.Suggesters = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFieldSuggester.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor AddSuggester(string key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester value) + { + Instance.Suggesters ??= new System.Collections.Generic.Dictionary(); + Instance.Suggesters.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor AddSuggester(string key, System.Action action) + { + Instance.Suggesters ??= new System.Collections.Generic.Dictionary(); + Instance.Suggesters.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor AddSuggester(string key, System.Action> action) + { + Instance.Suggesters ??= new System.Collections.Generic.Dictionary(); + Instance.Suggesters.Add(key, Elastic.Clients.Elasticsearch.Core.Search.FieldSuggesterDescriptor.Build(action)); + return this; + } + + /// + /// + /// Global suggest text, to avoid repetition when the same text is used in several suggesters + /// + /// + public Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor Text(string? value) + { + Instance.Text = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.Suggester Build(System.Action? action) + { + if (action is null) { - foreach (var additionalProperty in SuggestersValue) - { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); - } + return new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.Suggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggest.g.cs index c7a1b48092c..d530dc416dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggest.g.cs @@ -17,25 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -public sealed partial class TermSuggest : ISuggest +internal sealed partial class TermSuggestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.TermSuggest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propOffset = default; + LocalJsonValue> propOptions = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.TermSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Offset = propOffset.Value, + Options = propOptions.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TermSuggest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TermSuggestConverter))] +public sealed partial class TermSuggest : Elastic.Clients.Elasticsearch.Core.Search.ISuggest { - [JsonInclude, JsonPropertyName("length")] - public int Length { get; init; } - [JsonInclude, JsonPropertyName("offset")] - public int Offset { get; init; } - [JsonInclude, JsonPropertyName("options")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TermSuggestOption))] - public IReadOnlyCollection Options { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggest(int length, int offset, System.Collections.Generic.ICollection options, string text) + { + Length = length; + Offset = offset; + Options = options; + Text = text; + } +#if NET7_0_OR_GREATER + public TermSuggest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermSuggest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermSuggest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Length { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Offset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Options { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } + + string Elastic.Clients.Elasticsearch.Core.Search.ISuggest.Type => "term"; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggestOption.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggestOption.g.cs index 7e9a68f6618..98576c01ebf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggestOption.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggestOption.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class TermSuggestOptionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollateMatch = System.Text.Json.JsonEncodedText.Encode("collate_match"); + private static readonly System.Text.Json.JsonEncodedText PropFreq = System.Text.Json.JsonEncodedText.Encode("freq"); + private static readonly System.Text.Json.JsonEncodedText PropHighlighted = System.Text.Json.JsonEncodedText.Encode("highlighted"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.TermSuggestOption Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollateMatch = default; + LocalJsonValue propFreq = default; + LocalJsonValue propHighlighted = default; + LocalJsonValue propScore = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollateMatch.TryReadProperty(ref reader, options, PropCollateMatch, null)) + { + continue; + } + + if (propFreq.TryReadProperty(ref reader, options, PropFreq, null)) + { + continue; + } + + if (propHighlighted.TryReadProperty(ref reader, options, PropHighlighted, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.TermSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollateMatch = propCollateMatch.Value, + Freq = propFreq.Value, + Highlighted = propHighlighted.Value, + Score = propScore.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TermSuggestOption value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollateMatch, value.CollateMatch, null, null); + writer.WriteProperty(options, PropFreq, value.Freq, null, null); + writer.WriteProperty(options, PropHighlighted, value.Highlighted, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TermSuggestOptionConverter))] public sealed partial class TermSuggestOption { - [JsonInclude, JsonPropertyName("collate_match")] - public bool? CollateMatch { get; init; } - [JsonInclude, JsonPropertyName("freq")] - public long Freq { get; init; } - [JsonInclude, JsonPropertyName("highlighted")] - public string? Highlighted { get; init; } - [JsonInclude, JsonPropertyName("score")] - public double Score { get; init; } - [JsonInclude, JsonPropertyName("text")] - public string Text { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggestOption(long freq, double score, string text) + { + Freq = freq; + Score = score; + Text = text; + } +#if NET7_0_OR_GREATER + public TermSuggestOption() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermSuggestOption() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermSuggestOption(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? CollateMatch { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Freq { get; set; } + public string? Highlighted { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Score { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggester.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggester.g.cs index 5e92afac9c4..528ae5245bf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggester.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TermSuggester.g.cs @@ -17,25 +17,208 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class TermSuggesterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropLowercaseTerms = System.Text.Json.JsonEncodedText.Encode("lowercase_terms"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEdits = System.Text.Json.JsonEncodedText.Encode("max_edits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInspections = System.Text.Json.JsonEncodedText.Encode("max_inspections"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTermFreq = System.Text.Json.JsonEncodedText.Encode("max_term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocFreq = System.Text.Json.JsonEncodedText.Encode("min_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordLength = System.Text.Json.JsonEncodedText.Encode("min_word_length"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropShardSize = System.Text.Json.JsonEncodedText.Encode("shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropStringDistance = System.Text.Json.JsonEncodedText.Encode("string_distance"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestMode = System.Text.Json.JsonEncodedText.Encode("suggest_mode"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Core.Search.TermSuggester Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propField = default; + LocalJsonValue propLowercaseTerms = default; + LocalJsonValue propMaxEdits = default; + LocalJsonValue propMaxInspections = default; + LocalJsonValue propMaxTermFreq = default; + LocalJsonValue propMinDocFreq = default; + LocalJsonValue propMinWordLength = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propShardSize = default; + LocalJsonValue propSize = default; + LocalJsonValue propSort = default; + LocalJsonValue propStringDistance = default; + LocalJsonValue propSuggestMode = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propLowercaseTerms.TryReadProperty(ref reader, options, PropLowercaseTerms, null)) + { + continue; + } + + if (propMaxEdits.TryReadProperty(ref reader, options, PropMaxEdits, null)) + { + continue; + } + + if (propMaxInspections.TryReadProperty(ref reader, options, PropMaxInspections, null)) + { + continue; + } + + if (propMaxTermFreq.TryReadProperty(ref reader, options, PropMaxTermFreq, null)) + { + continue; + } + + if (propMinDocFreq.TryReadProperty(ref reader, options, PropMinDocFreq, null)) + { + continue; + } + + if (propMinWordLength.TryReadProperty(ref reader, options, PropMinWordLength, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (propShardSize.TryReadProperty(ref reader, options, PropShardSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propStringDistance.TryReadProperty(ref reader, options, PropStringDistance, null)) + { + continue; + } + + if (propSuggestMode.TryReadProperty(ref reader, options, PropSuggestMode, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Field = propField.Value, + LowercaseTerms = propLowercaseTerms.Value, + MaxEdits = propMaxEdits.Value, + MaxInspections = propMaxInspections.Value, + MaxTermFreq = propMaxTermFreq.Value, + MinDocFreq = propMinDocFreq.Value, + MinWordLength = propMinWordLength.Value, + PrefixLength = propPrefixLength.Value, + ShardSize = propShardSize.Value, + Size = propSize.Value, + Sort = propSort.Value, + StringDistance = propStringDistance.Value, + SuggestMode = propSuggestMode.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TermSuggester value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropLowercaseTerms, value.LowercaseTerms, null, null); + writer.WriteProperty(options, PropMaxEdits, value.MaxEdits, null, null); + writer.WriteProperty(options, PropMaxInspections, value.MaxInspections, null, null); + writer.WriteProperty(options, PropMaxTermFreq, value.MaxTermFreq, null, null); + writer.WriteProperty(options, PropMinDocFreq, value.MinDocFreq, null, null); + writer.WriteProperty(options, PropMinWordLength, value.MinWordLength, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropShardSize, value.ShardSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropStringDistance, value.StringDistance, null, null); + writer.WriteProperty(options, PropSuggestMode, value.SuggestMode, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterConverter))] public sealed partial class TermSuggester { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggester(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TermSuggester() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermSuggester() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The analyzer to analyze the suggest text with. /// Defaults to the search analyzer of the suggest field. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -44,9 +227,11 @@ public sealed partial class TermSuggester /// Needs to be set globally or per suggestion. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("lowercase_terms")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public bool? LowercaseTerms { get; set; } /// @@ -55,7 +240,6 @@ public sealed partial class TermSuggester /// Can only be 1 or 2. /// /// - [JsonInclude, JsonPropertyName("max_edits")] public int? MaxEdits { get; set; } /// @@ -64,7 +248,6 @@ public sealed partial class TermSuggester /// Can improve accuracy at the cost of performance. /// /// - [JsonInclude, JsonPropertyName("max_inspections")] public int? MaxInspections { get; set; } /// @@ -74,7 +257,6 @@ public sealed partial class TermSuggester /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - [JsonInclude, JsonPropertyName("max_term_freq")] public float? MaxTermFreq { get; set; } /// @@ -85,7 +267,6 @@ public sealed partial class TermSuggester /// If a value higher than 1 is specified, then the number cannot be fractional. /// /// - [JsonInclude, JsonPropertyName("min_doc_freq")] public float? MinDocFreq { get; set; } /// @@ -93,7 +274,6 @@ public sealed partial class TermSuggester /// The minimum length a suggest text term must have in order to be included. /// /// - [JsonInclude, JsonPropertyName("min_word_length")] public int? MinWordLength { get; set; } /// @@ -102,7 +282,6 @@ public sealed partial class TermSuggester /// Increasing this number improves spellcheck performance. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } /// @@ -110,7 +289,6 @@ public sealed partial class TermSuggester /// Sets the maximum number of suggestions to be retrieved from each individual shard. /// /// - [JsonInclude, JsonPropertyName("shard_size")] public int? ShardSize { get; set; } /// @@ -118,7 +296,6 @@ public sealed partial class TermSuggester /// The maximum corrections to be returned per suggest text token. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } /// @@ -126,7 +303,6 @@ public sealed partial class TermSuggester /// Defines how suggestions should be sorted per suggest text term. /// /// - [JsonInclude, JsonPropertyName("sort")] public Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? Sort { get; set; } /// @@ -134,7 +310,6 @@ public sealed partial class TermSuggester /// The string distance implementation to use for comparing how similar suggested terms are. /// /// - [JsonInclude, JsonPropertyName("string_distance")] public Elastic.Clients.Elasticsearch.Core.Search.StringDistance? StringDistance { get; set; } /// @@ -142,7 +317,6 @@ public sealed partial class TermSuggester /// Controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. /// /// - [JsonInclude, JsonPropertyName("suggest_mode")] public Elastic.Clients.Elasticsearch.SuggestMode? SuggestMode { get; set; } /// @@ -151,58 +325,38 @@ public sealed partial class TermSuggester /// Needs to be set globally or per suggestion. /// /// - [JsonInclude, JsonPropertyName("text")] public string? Text { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester(TermSuggester termSuggester) => Elastic.Clients.Elasticsearch.Core.Search.FieldSuggester.Term(termSuggester); } -public sealed partial class TermSuggesterDescriptor : SerializableDescriptor> +public readonly partial struct TermSuggesterDescriptor { - internal TermSuggesterDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.TermSuggester Instance { get; init; } - public TermSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? LowercaseTermsValue { get; set; } - private int? MaxEditsValue { get; set; } - private int? MaxInspectionsValue { get; set; } - private float? MaxTermFreqValue { get; set; } - private float? MinDocFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private int? PrefixLengthValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.StringDistance? StringDistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } - private string? TextValue { get; set; } - - /// - /// - /// The analyzer to analyze the suggest text with. - /// Defaults to the search analyzer of the suggest field. - /// - /// - public TermSuggesterDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggesterDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// The analyzer to analyze the suggest text with. + /// Defaults to the search analyzer of the suggest field. /// /// - public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Analyzer(string? value) { - FieldValue = field; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -211,10 +365,10 @@ public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// Needs to be set globally or per suggestion. /// /// - public TermSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -223,16 +377,16 @@ public TermSuggesterDescriptor Field(Expression /// - public TermSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = true) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor LowercaseTerms(bool? value = true) { - LowercaseTermsValue = lowercaseTerms; - return Self; + Instance.LowercaseTerms = value; + return this; } /// @@ -241,10 +395,10 @@ public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = /// Can only be 1 or 2. /// /// - public TermSuggesterDescriptor MaxEdits(int? maxEdits) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxEdits(int? value) { - MaxEditsValue = maxEdits; - return Self; + Instance.MaxEdits = value; + return this; } /// @@ -253,10 +407,10 @@ public TermSuggesterDescriptor MaxEdits(int? maxEdits) /// Can improve accuracy at the cost of performance. /// /// - public TermSuggesterDescriptor MaxInspections(int? maxInspections) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxInspections(int? value) { - MaxInspectionsValue = maxInspections; - return Self; + Instance.MaxInspections = value; + return this; } /// @@ -266,10 +420,10 @@ public TermSuggesterDescriptor MaxInspections(int? maxInspections) /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxTermFreq(float? value) { - MaxTermFreqValue = maxTermFreq; - return Self; + Instance.MaxTermFreq = value; + return this; } /// @@ -280,10 +434,10 @@ public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) /// If a value higher than 1 is specified, then the number cannot be fractional. /// /// - public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MinDocFreq(float? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -291,10 +445,10 @@ public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) /// The minimum length a suggest text term must have in order to be included. /// /// - public TermSuggesterDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } /// @@ -303,10 +457,10 @@ public TermSuggesterDescriptor MinWordLength(int? minWordLength) /// Increasing this number improves spellcheck performance. /// /// - public TermSuggesterDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -314,10 +468,10 @@ public TermSuggesterDescriptor PrefixLength(int? prefixLength) /// Sets the maximum number of suggestions to be retrieved from each individual shard. /// /// - public TermSuggesterDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -325,10 +479,10 @@ public TermSuggesterDescriptor ShardSize(int? shardSize) /// The maximum corrections to be returned per suggest text token. /// /// - public TermSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -336,10 +490,10 @@ public TermSuggesterDescriptor Size(int? size) /// Defines how suggestions should be sorted per suggest text term. /// /// - public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? sort) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -347,10 +501,10 @@ public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Cor /// The string distance implementation to use for comparing how similar suggested terms are. /// /// - public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.Core.Search.StringDistance? stringDistance) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.Core.Search.StringDistance? value) { - StringDistanceValue = stringDistance; - return Self; + Instance.StringDistance = value; + return this; } /// @@ -358,10 +512,10 @@ public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elastic /// Controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. /// /// - public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - SuggestModeValue = suggestMode; - return Self; + Instance.SuggestMode = value; + return this; } /// @@ -370,151 +524,50 @@ public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsea /// Needs to be set globally or per suggestion. /// /// - public TermSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Text(string? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.TermSuggester Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LowercaseTermsValue.HasValue) - { - writer.WritePropertyName("lowercase_terms"); - writer.WriteBooleanValue(LowercaseTermsValue.Value); - } - - if (MaxEditsValue.HasValue) - { - writer.WritePropertyName("max_edits"); - writer.WriteNumberValue(MaxEditsValue.Value); - } - - if (MaxInspectionsValue.HasValue) - { - writer.WritePropertyName("max_inspections"); - writer.WriteNumberValue(MaxInspectionsValue.Value); - } - - if (MaxTermFreqValue.HasValue) - { - writer.WritePropertyName("max_term_freq"); - writer.WriteNumberValue(MaxTermFreqValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (StringDistanceValue is not null) - { - writer.WritePropertyName("string_distance"); - JsonSerializer.Serialize(writer, StringDistanceValue, options); - } - - if (SuggestModeValue is not null) - { - writer.WritePropertyName("suggest_mode"); - JsonSerializer.Serialize(writer, SuggestModeValue, options); - } - - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermSuggesterDescriptor : SerializableDescriptor +public readonly partial struct TermSuggesterDescriptor { - internal TermSuggesterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.Search.TermSuggester Instance { get; init; } - public TermSuggesterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? LowercaseTermsValue { get; set; } - private int? MaxEditsValue { get; set; } - private int? MaxInspectionsValue { get; set; } - private float? MaxTermFreqValue { get; set; } - private float? MinDocFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private int? PrefixLengthValue { get; set; } - private int? ShardSizeValue { get; set; } - private int? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.StringDistance? StringDistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.SuggestMode? SuggestModeValue { get; set; } - private string? TextValue { get; set; } - - /// - /// - /// The analyzer to analyze the suggest text with. - /// Defaults to the search analyzer of the suggest field. - /// - /// - public TermSuggesterDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermSuggesterDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(Elastic.Clients.Elasticsearch.Core.Search.TermSuggester instance) => new Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field to fetch the candidate suggestions from. - /// Needs to be set globally or per suggestion. + /// The analyzer to analyze the suggest text with. + /// Defaults to the search analyzer of the suggest field. /// /// - public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Analyzer(string? value) { - FieldValue = field; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -523,10 +576,10 @@ public TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// Needs to be set globally or per suggestion. /// /// - public TermSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -535,16 +588,16 @@ public TermSuggesterDescriptor Field(Expression /// - public TermSuggesterDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = true) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor LowercaseTerms(bool? value = true) { - LowercaseTermsValue = lowercaseTerms; - return Self; + Instance.LowercaseTerms = value; + return this; } /// @@ -553,10 +606,10 @@ public TermSuggesterDescriptor LowercaseTerms(bool? lowercaseTerms = true) /// Can only be 1 or 2. /// /// - public TermSuggesterDescriptor MaxEdits(int? maxEdits) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxEdits(int? value) { - MaxEditsValue = maxEdits; - return Self; + Instance.MaxEdits = value; + return this; } /// @@ -565,10 +618,10 @@ public TermSuggesterDescriptor MaxEdits(int? maxEdits) /// Can improve accuracy at the cost of performance. /// /// - public TermSuggesterDescriptor MaxInspections(int? maxInspections) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxInspections(int? value) { - MaxInspectionsValue = maxInspections; - return Self; + Instance.MaxInspections = value; + return this; } /// @@ -578,10 +631,10 @@ public TermSuggesterDescriptor MaxInspections(int? maxInspections) /// If a value higher than 1 is specified, then fractional can not be specified. /// /// - public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MaxTermFreq(float? value) { - MaxTermFreqValue = maxTermFreq; - return Self; + Instance.MaxTermFreq = value; + return this; } /// @@ -592,10 +645,10 @@ public TermSuggesterDescriptor MaxTermFreq(float? maxTermFreq) /// If a value higher than 1 is specified, then the number cannot be fractional. /// /// - public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MinDocFreq(float? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -603,10 +656,10 @@ public TermSuggesterDescriptor MinDocFreq(float? minDocFreq) /// The minimum length a suggest text term must have in order to be included. /// /// - public TermSuggesterDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } /// @@ -615,10 +668,10 @@ public TermSuggesterDescriptor MinWordLength(int? minWordLength) /// Increasing this number improves spellcheck performance. /// /// - public TermSuggesterDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -626,10 +679,10 @@ public TermSuggesterDescriptor PrefixLength(int? prefixLength) /// Sets the maximum number of suggestions to be retrieved from each individual shard. /// /// - public TermSuggesterDescriptor ShardSize(int? shardSize) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor ShardSize(int? value) { - ShardSizeValue = shardSize; - return Self; + Instance.ShardSize = value; + return this; } /// @@ -637,10 +690,10 @@ public TermSuggesterDescriptor ShardSize(int? shardSize) /// The maximum corrections to be returned per suggest text token. /// /// - public TermSuggesterDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } /// @@ -648,10 +701,10 @@ public TermSuggesterDescriptor Size(int? size) /// Defines how suggestions should be sorted per suggest text term. /// /// - public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? sort) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort? value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -659,10 +712,10 @@ public TermSuggesterDescriptor Sort(Elastic.Clients.Elasticsearch.Core.Search.Su /// The string distance implementation to use for comparing how similar suggested terms are. /// /// - public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.Core.Search.StringDistance? stringDistance) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.Core.Search.StringDistance? value) { - StringDistanceValue = stringDistance; - return Self; + Instance.StringDistance = value; + return this; } /// @@ -670,10 +723,10 @@ public TermSuggesterDescriptor StringDistance(Elastic.Clients.Elasticsearch.Core /// Controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. /// /// - public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? suggestMode) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.SuggestMode? value) { - SuggestModeValue = suggestMode; - return Self; + Instance.SuggestMode = value; + return this; } /// @@ -682,101 +735,17 @@ public TermSuggesterDescriptor SuggestMode(Elastic.Clients.Elasticsearch.Suggest /// Needs to be set globally or per suggestion. /// /// - public TermSuggesterDescriptor Text(string? text) + public Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor Text(string? value) { - TextValue = text; - return Self; + Instance.Text = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.TermSuggester Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LowercaseTermsValue.HasValue) - { - writer.WritePropertyName("lowercase_terms"); - writer.WriteBooleanValue(LowercaseTermsValue.Value); - } - - if (MaxEditsValue.HasValue) - { - writer.WritePropertyName("max_edits"); - writer.WriteNumberValue(MaxEditsValue.Value); - } - - if (MaxInspectionsValue.HasValue) - { - writer.WritePropertyName("max_inspections"); - writer.WriteNumberValue(MaxInspectionsValue.Value); - } - - if (MaxTermFreqValue.HasValue) - { - writer.WritePropertyName("max_term_freq"); - writer.WriteNumberValue(MaxTermFreqValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (ShardSizeValue.HasValue) - { - writer.WritePropertyName("shard_size"); - writer.WriteNumberValue(ShardSizeValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (StringDistanceValue is not null) - { - writer.WritePropertyName("string_distance"); - JsonSerializer.Serialize(writer, StringDistanceValue, options); - } - - if (SuggestModeValue is not null) - { - writer.WritePropertyName("suggest_mode"); - JsonSerializer.Serialize(writer, SuggestModeValue, options); - } - - if (!string.IsNullOrEmpty(TextValue)) - { - writer.WritePropertyName("text"); - writer.WriteStringValue(TextValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.Search.TermSuggesterDescriptor(new Elastic.Clients.Elasticsearch.Core.Search.TermSuggester(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TotalHits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TotalHits.g.cs index 6df716adf34..557ed577e81 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TotalHits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/TotalHits.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class TotalHitsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Core.Search.TotalHits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRelation = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.Search.TotalHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Relation = propRelation.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TotalHits value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TotalHitsConverter))] public sealed partial class TotalHits { - [JsonInclude, JsonPropertyName("relation")] - public Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation Relation { get; init; } - [JsonInclude, JsonPropertyName("value")] - public long Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TotalHits(Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation relation, long value) + { + Relation = relation; + Value = value; + } +#if NET7_0_OR_GREATER + public TotalHits() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TotalHits() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TotalHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation Relation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/SearchShardsNodeAttributes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/SearchShardsNodeAttributes.g.cs index 33fe1cb1b9f..b40593ff04b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/SearchShardsNodeAttributes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/SearchShardsNodeAttributes.g.cs @@ -17,57 +17,222 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.SearchShards; +internal sealed partial class SearchShardsNodeAttributesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropExternalId = System.Text.Json.JsonEncodedText.Encode("external_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxIndexVersion = System.Text.Json.JsonEncodedText.Encode("max_index_version"); + private static readonly System.Text.Json.JsonEncodedText PropMinIndexVersion = System.Text.Json.JsonEncodedText.Encode("min_index_version"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Core.SearchShards.SearchShardsNodeAttributes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propExternalId = default; + LocalJsonValue propMaxIndexVersion = default; + LocalJsonValue propMinIndexVersion = default; + LocalJsonValue propName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propExternalId.TryReadProperty(ref reader, options, PropExternalId, null)) + { + continue; + } + + if (propMaxIndexVersion.TryReadProperty(ref reader, options, PropMaxIndexVersion, null)) + { + continue; + } + + if (propMinIndexVersion.TryReadProperty(ref reader, options, PropMinIndexVersion, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.SearchShards.SearchShardsNodeAttributes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + ExternalId = propExternalId.Value, + MaxIndexVersion = propMaxIndexVersion.Value, + MinIndexVersion = propMinIndexVersion.Value, + Name = propName.Value, + Roles = propRoles.Value, + TransportAddress = propTransportAddress.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchShards.SearchShardsNodeAttributes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropExternalId, value.ExternalId, null, null); + writer.WriteProperty(options, PropMaxIndexVersion, value.MaxIndexVersion, null, null); + writer.WriteProperty(options, PropMinIndexVersion, value.MinIndexVersion, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.SearchShards.SearchShardsNodeAttributesConverter))] public sealed partial class SearchShardsNodeAttributes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchShardsNodeAttributes(System.Collections.Generic.IReadOnlyDictionary attributes, string ephemeralId, string externalId, int maxIndexVersion, int minIndexVersion, string name, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, string version) + { + Attributes = attributes; + EphemeralId = ephemeralId; + ExternalId = externalId; + MaxIndexVersion = maxIndexVersion; + MinIndexVersion = minIndexVersion; + Name = name; + Roles = roles; + TransportAddress = transportAddress; + Version = version; + } +#if NET7_0_OR_GREATER + public SearchShardsNodeAttributes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchShardsNodeAttributes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchShardsNodeAttributes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Lists node attributes. /// /// - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } /// /// /// The ephemeral ID of the node. /// /// - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string EphemeralId { get; init; } - [JsonInclude, JsonPropertyName("external_id")] - public string ExternalId { get; init; } - [JsonInclude, JsonPropertyName("max_index_version")] - public int MaxIndexVersion { get; init; } - [JsonInclude, JsonPropertyName("min_index_version")] - public int MinIndexVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string EphemeralId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ExternalId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxIndexVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MinIndexVersion { get; set; } /// /// /// The human-readable identifier of the node. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } /// /// /// The host and port where transport HTTP connections are accepted. /// /// - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/ShardStoreIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/ShardStoreIndex.g.cs index b14b40a42d5..45d743f96d4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/ShardStoreIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SearchShards/ShardStoreIndex.g.cs @@ -17,20 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.SearchShards; +internal sealed partial class ShardStoreIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + + public override Elastic.Clients.Elasticsearch.Core.SearchShards.ShardStoreIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propFilter = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.SearchShards.ShardStoreIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Filter = propFilter.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchShards.ShardStoreIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.SearchShards.ShardStoreIndexConverter))] public sealed partial class ShardStoreIndex { - [JsonInclude, JsonPropertyName("aliases")] - public IReadOnlyCollection? Aliases { get; init; } - [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; init; } +#if NET7_0_OR_GREATER + public ShardStoreIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShardStoreIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoreIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Aliases { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs index e64dca28647..9a7e553965f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs @@ -17,31 +17,128 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class SourceConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.SourceConfig)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered. /// /// -public sealed partial class SourceConfig : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigConverter))] +public sealed partial class SourceConfig : Elastic.Clients.Elasticsearch.Union +{ + public SourceConfig(bool value) : base(value) + { + } + + public SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(bool value) => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter value) => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); +} + +public readonly partial struct SourceConfigFactory { - public SourceConfig(bool Fetch) : base(Fetch) + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Fetch(bool value = true) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter() + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter(System.Action>? action) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor.Build(action)); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Build(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfig> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct SourceConfigFactory +{ + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Fetch(bool value = true) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter() + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter(System.Action? action) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Filter(System.Action>? action) { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilterDescriptor.Build(action)); } - public SourceConfig(Elastic.Clients.Elasticsearch.Core.Search.SourceFilter Filter) : base(Filter) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceConfig Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs index 6779a77007f..161221e9091 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs @@ -17,32 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class SourceConfigParamConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(reader.ReadValue(options, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered. /// Used as a query parameter along with the _source_includes and _source_excludes parameters. /// /// -public sealed partial class SourceConfigParam : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamConverter))] +public sealed partial class SourceConfigParam : Elastic.Clients.Elasticsearch.Union +{ + public SourceConfigParam(bool value) : base(value) + { + } + + public SourceConfigParam(Elastic.Clients.Elasticsearch.Fields value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(bool value) => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(Elastic.Clients.Elasticsearch.Fields value) => new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); +} + +public readonly partial struct SourceConfigParamFactory { - public SourceConfigParam(bool Fetch) : base(Fetch) + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fetch(bool value = true) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fields(Elastic.Clients.Elasticsearch.Fields value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fields(params System.Linq.Expressions.Expression>[] value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Build(System.Func, Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam> action) + { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct SourceConfigParamFactory +{ + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fetch(bool value = true) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fields(Elastic.Clients.Elasticsearch.Fields value) + { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Fields(params System.Linq.Expressions.Expression>[] value) { + return new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam(value); } - public SourceConfigParam(Elastic.Clients.Elasticsearch.Fields Fields) : base(Fields) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParam Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.SourceConfigParamFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/FieldStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/FieldStatistics.g.cs index 321c4fd9629..d9a90aca9f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/FieldStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/FieldStatistics.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.TermVectors; +internal sealed partial class FieldStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropSumDocFreq = System.Text.Json.JsonEncodedText.Encode("sum_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropSumTtf = System.Text.Json.JsonEncodedText.Encode("sum_ttf"); + + public override Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocCount = default; + LocalJsonValue propSumDocFreq = default; + LocalJsonValue propSumTtf = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propSumDocFreq.TryReadProperty(ref reader, options, PropSumDocFreq, null)) + { + continue; + } + + if (propSumTtf.TryReadProperty(ref reader, options, PropSumTtf, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocCount = propDocCount.Value, + SumDocFreq = propSumDocFreq.Value, + SumTtf = propSumTtf.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropSumDocFreq, value.SumDocFreq, null, null); + writer.WriteProperty(options, PropSumTtf, value.SumTtf, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatisticsConverter))] public sealed partial class FieldStatistics { - [JsonInclude, JsonPropertyName("doc_count")] - public int DocCount { get; init; } - [JsonInclude, JsonPropertyName("sum_doc_freq")] - public long SumDocFreq { get; init; } - [JsonInclude, JsonPropertyName("sum_ttf")] - public long SumTtf { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldStatistics(int docCount, long sumDocFreq, long sumTtf) + { + DocCount = docCount; + SumDocFreq = sumDocFreq; + SumTtf = sumTtf; + } +#if NET7_0_OR_GREATER + public FieldStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SumDocFreq { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SumTtf { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Filter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Filter.g.cs index 53294e06c2d..695aaf1bda5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Filter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Filter.g.cs @@ -17,25 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.TermVectors; +internal sealed partial class FilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxDocFreq = System.Text.Json.JsonEncodedText.Encode("max_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumTerms = System.Text.Json.JsonEncodedText.Encode("max_num_terms"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTermFreq = System.Text.Json.JsonEncodedText.Encode("max_term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWordLength = System.Text.Json.JsonEncodedText.Encode("max_word_length"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocFreq = System.Text.Json.JsonEncodedText.Encode("min_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinTermFreq = System.Text.Json.JsonEncodedText.Encode("min_term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordLength = System.Text.Json.JsonEncodedText.Encode("min_word_length"); + + public override Elastic.Clients.Elasticsearch.Core.TermVectors.Filter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxDocFreq = default; + LocalJsonValue propMaxNumTerms = default; + LocalJsonValue propMaxTermFreq = default; + LocalJsonValue propMaxWordLength = default; + LocalJsonValue propMinDocFreq = default; + LocalJsonValue propMinTermFreq = default; + LocalJsonValue propMinWordLength = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxDocFreq.TryReadProperty(ref reader, options, PropMaxDocFreq, null)) + { + continue; + } + + if (propMaxNumTerms.TryReadProperty(ref reader, options, PropMaxNumTerms, null)) + { + continue; + } + + if (propMaxTermFreq.TryReadProperty(ref reader, options, PropMaxTermFreq, null)) + { + continue; + } + + if (propMaxWordLength.TryReadProperty(ref reader, options, PropMaxWordLength, null)) + { + continue; + } + + if (propMinDocFreq.TryReadProperty(ref reader, options, PropMinDocFreq, null)) + { + continue; + } + + if (propMinTermFreq.TryReadProperty(ref reader, options, PropMinTermFreq, null)) + { + continue; + } + + if (propMinWordLength.TryReadProperty(ref reader, options, PropMinWordLength, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxDocFreq = propMaxDocFreq.Value, + MaxNumTerms = propMaxNumTerms.Value, + MaxTermFreq = propMaxTermFreq.Value, + MaxWordLength = propMaxWordLength.Value, + MinDocFreq = propMinDocFreq.Value, + MinTermFreq = propMinTermFreq.Value, + MinWordLength = propMinWordLength.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.TermVectors.Filter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxDocFreq, value.MaxDocFreq, null, null); + writer.WriteProperty(options, PropMaxNumTerms, value.MaxNumTerms, null, null); + writer.WriteProperty(options, PropMaxTermFreq, value.MaxTermFreq, null, null); + writer.WriteProperty(options, PropMaxWordLength, value.MaxWordLength, null, null); + writer.WriteProperty(options, PropMinDocFreq, value.MinDocFreq, null, null); + writer.WriteProperty(options, PropMinTermFreq, value.MinTermFreq, null, null); + writer.WriteProperty(options, PropMinWordLength, value.MinWordLength, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.FilterConverter))] public sealed partial class Filter { +#if NET7_0_OR_GREATER + public Filter() + { + } +#endif +#if !NET7_0_OR_GREATER + public Filter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Ignore words which occur in more than this many docs. /// Defaults to unbounded. /// /// - [JsonInclude, JsonPropertyName("max_doc_freq")] public int? MaxDocFreq { get; set; } /// @@ -43,7 +148,6 @@ public sealed partial class Filter /// The maximum number of terms that must be returned per field. /// /// - [JsonInclude, JsonPropertyName("max_num_terms")] public int? MaxNumTerms { get; set; } /// @@ -52,7 +156,6 @@ public sealed partial class Filter /// It defaults to unbounded. /// /// - [JsonInclude, JsonPropertyName("max_term_freq")] public int? MaxTermFreq { get; set; } /// @@ -61,7 +164,6 @@ public sealed partial class Filter /// Defaults to unbounded. /// /// - [JsonInclude, JsonPropertyName("max_word_length")] public int? MaxWordLength { get; set; } /// @@ -69,7 +171,6 @@ public sealed partial class Filter /// Ignore terms which do not occur in at least this many docs. /// /// - [JsonInclude, JsonPropertyName("min_doc_freq")] public int? MinDocFreq { get; set; } /// @@ -77,7 +178,6 @@ public sealed partial class Filter /// Ignore words with less than this frequency in the source doc. /// /// - [JsonInclude, JsonPropertyName("min_term_freq")] public int? MinTermFreq { get; set; } /// @@ -85,25 +185,27 @@ public sealed partial class Filter /// The minimum word length below which words will be ignored. /// /// - [JsonInclude, JsonPropertyName("min_word_length")] public int? MinWordLength { get; set; } } -public sealed partial class FilterDescriptor : SerializableDescriptor +public readonly partial struct FilterDescriptor { - internal FilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Core.TermVectors.Filter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterDescriptor(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter instance) + { + Instance = instance; + } - public FilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Core.TermVectors.Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? MaxDocFreqValue { get; set; } - private int? MaxNumTermsValue { get; set; } - private int? MaxTermFreqValue { get; set; } - private int? MaxWordLengthValue { get; set; } - private int? MinDocFreqValue { get; set; } - private int? MinTermFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(Elastic.Clients.Elasticsearch.Core.TermVectors.Filter instance) => new Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Core.TermVectors.Filter(Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor descriptor) => descriptor.Instance; /// /// @@ -111,10 +213,10 @@ public FilterDescriptor() : base() /// Defaults to unbounded. /// /// - public FilterDescriptor MaxDocFreq(int? maxDocFreq) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MaxDocFreq(int? value) { - MaxDocFreqValue = maxDocFreq; - return Self; + Instance.MaxDocFreq = value; + return this; } /// @@ -122,10 +224,10 @@ public FilterDescriptor MaxDocFreq(int? maxDocFreq) /// The maximum number of terms that must be returned per field. /// /// - public FilterDescriptor MaxNumTerms(int? maxNumTerms) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MaxNumTerms(int? value) { - MaxNumTermsValue = maxNumTerms; - return Self; + Instance.MaxNumTerms = value; + return this; } /// @@ -134,10 +236,10 @@ public FilterDescriptor MaxNumTerms(int? maxNumTerms) /// It defaults to unbounded. /// /// - public FilterDescriptor MaxTermFreq(int? maxTermFreq) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MaxTermFreq(int? value) { - MaxTermFreqValue = maxTermFreq; - return Self; + Instance.MaxTermFreq = value; + return this; } /// @@ -146,10 +248,10 @@ public FilterDescriptor MaxTermFreq(int? maxTermFreq) /// Defaults to unbounded. /// /// - public FilterDescriptor MaxWordLength(int? maxWordLength) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MaxWordLength(int? value) { - MaxWordLengthValue = maxWordLength; - return Self; + Instance.MaxWordLength = value; + return this; } /// @@ -157,10 +259,10 @@ public FilterDescriptor MaxWordLength(int? maxWordLength) /// Ignore terms which do not occur in at least this many docs. /// /// - public FilterDescriptor MinDocFreq(int? minDocFreq) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MinDocFreq(int? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -168,10 +270,10 @@ public FilterDescriptor MinDocFreq(int? minDocFreq) /// Ignore words with less than this frequency in the source doc. /// /// - public FilterDescriptor MinTermFreq(int? minTermFreq) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MinTermFreq(int? value) { - MinTermFreqValue = minTermFreq; - return Self; + Instance.MinTermFreq = value; + return this; } /// @@ -179,57 +281,22 @@ public FilterDescriptor MinTermFreq(int? minTermFreq) /// The minimum word length below which words will be ignored. /// /// - public FilterDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.TermVectors.Filter Build(System.Action? action) { - writer.WriteStartObject(); - if (MaxDocFreqValue.HasValue) - { - writer.WritePropertyName("max_doc_freq"); - writer.WriteNumberValue(MaxDocFreqValue.Value); - } - - if (MaxNumTermsValue.HasValue) - { - writer.WritePropertyName("max_num_terms"); - writer.WriteNumberValue(MaxNumTermsValue.Value); - } - - if (MaxTermFreqValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_term_freq"); - writer.WriteNumberValue(MaxTermFreqValue.Value); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MaxWordLengthValue.HasValue) - { - writer.WritePropertyName("max_word_length"); - writer.WriteNumberValue(MaxWordLengthValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinTermFreqValue.HasValue) - { - writer.WritePropertyName("min_term_freq"); - writer.WriteNumberValue(MinTermFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Core.TermVectors.FilterDescriptor(new Elastic.Clients.Elasticsearch.Core.TermVectors.Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Term.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Term.g.cs index 0c396feae93..4be99560451 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Term.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Term.g.cs @@ -17,26 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.TermVectors; +internal sealed partial class TermConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocFreq = System.Text.Json.JsonEncodedText.Encode("doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + private static readonly System.Text.Json.JsonEncodedText PropTermFreq = System.Text.Json.JsonEncodedText.Encode("term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + private static readonly System.Text.Json.JsonEncodedText PropTtf = System.Text.Json.JsonEncodedText.Encode("ttf"); + + public override Elastic.Clients.Elasticsearch.Core.TermVectors.Term Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocFreq = default; + LocalJsonValue propScore = default; + LocalJsonValue propTermFreq = default; + LocalJsonValue?> propTokens = default; + LocalJsonValue propTtf = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocFreq.TryReadProperty(ref reader, options, PropDocFreq, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (propTermFreq.TryReadProperty(ref reader, options, PropTermFreq, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTtf.TryReadProperty(ref reader, options, PropTtf, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.Term(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocFreq = propDocFreq.Value, + Score = propScore.Value, + TermFreq = propTermFreq.Value, + Tokens = propTokens.Value, + Ttf = propTtf.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.TermVectors.Term value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocFreq, value.DocFreq, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteProperty(options, PropTermFreq, value.TermFreq, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTtf, value.Ttf, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.TermConverter))] public sealed partial class Term { - [JsonInclude, JsonPropertyName("doc_freq")] - public int? DocFreq { get; init; } - [JsonInclude, JsonPropertyName("score")] - public double? Score { get; init; } - [JsonInclude, JsonPropertyName("term_freq")] - public int TermFreq { get; init; } - [JsonInclude, JsonPropertyName("tokens")] - public IReadOnlyCollection? Tokens { get; init; } - [JsonInclude, JsonPropertyName("ttf")] - public int? Ttf { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Term(int termFreq) + { + TermFreq = termFreq; + } +#if NET7_0_OR_GREATER + public Term() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Term() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Term(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? DocFreq { get; set; } + public double? Score { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TermFreq { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Tokens { get; set; } + public int? Ttf { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/TermVector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/TermVector.g.cs index 1044bc970fb..b6df866e38f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/TermVector.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/TermVector.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.TermVectors; +internal sealed partial class TermVectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldStatistics = System.Text.Json.JsonEncodedText.Encode("field_statistics"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.Core.TermVectors.TermVector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFieldStatistics = default; + LocalJsonValue> propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldStatistics.TryReadProperty(ref reader, options, PropFieldStatistics, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.TermVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldStatistics = propFieldStatistics.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.TermVectors.TermVector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldStatistics, value.FieldStatistics, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.TermVectorConverter))] public sealed partial class TermVector { - [JsonInclude, JsonPropertyName("field_statistics")] - public Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatistics? FieldStatistics { get; init; } - [JsonInclude, JsonPropertyName("terms")] - public IReadOnlyDictionary Terms { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermVector(System.Collections.Generic.IReadOnlyDictionary terms) + { + Terms = terms; + } +#if NET7_0_OR_GREATER + public TermVector() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermVector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Core.TermVectors.FieldStatistics? FieldStatistics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Terms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Token.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Token.g.cs index a35ef935598..35928f47050 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Token.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TermVectors/Token.g.cs @@ -17,24 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.TermVectors; +internal sealed partial class TokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEndOffset = System.Text.Json.JsonEncodedText.Encode("end_offset"); + private static readonly System.Text.Json.JsonEncodedText PropPayload = System.Text.Json.JsonEncodedText.Encode("payload"); + private static readonly System.Text.Json.JsonEncodedText PropPosition = System.Text.Json.JsonEncodedText.Encode("position"); + private static readonly System.Text.Json.JsonEncodedText PropStartOffset = System.Text.Json.JsonEncodedText.Encode("start_offset"); + + public override Elastic.Clients.Elasticsearch.Core.TermVectors.Token Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEndOffset = default; + LocalJsonValue propPayload = default; + LocalJsonValue propPosition = default; + LocalJsonValue propStartOffset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEndOffset.TryReadProperty(ref reader, options, PropEndOffset, null)) + { + continue; + } + + if (propPayload.TryReadProperty(ref reader, options, PropPayload, null)) + { + continue; + } + + if (propPosition.TryReadProperty(ref reader, options, PropPosition, null)) + { + continue; + } + + if (propStartOffset.TryReadProperty(ref reader, options, PropStartOffset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.TermVectors.Token(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EndOffset = propEndOffset.Value, + Payload = propPayload.Value, + Position = propPosition.Value, + StartOffset = propStartOffset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.TermVectors.Token value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEndOffset, value.EndOffset, null, null); + writer.WriteProperty(options, PropPayload, value.Payload, null, null); + writer.WriteProperty(options, PropPosition, value.Position, null, null); + writer.WriteProperty(options, PropStartOffset, value.StartOffset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.TermVectors.TokenConverter))] public sealed partial class Token { - [JsonInclude, JsonPropertyName("end_offset")] - public int? EndOffset { get; init; } - [JsonInclude, JsonPropertyName("payload")] - public string? Payload { get; init; } - [JsonInclude, JsonPropertyName("position")] - public int Position { get; init; } - [JsonInclude, JsonPropertyName("start_offset")] - public int? StartOffset { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Token(int position) + { + Position = position; + } +#if NET7_0_OR_GREATER + public Token() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Token() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Token(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? EndOffset { get; set; } + public string? Payload { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Position { get; set; } + public int? StartOffset { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs index 0d62aee06e5..cb07edeac11 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs @@ -17,19 +17,47 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; +internal sealed partial class TrackHitsConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Core.Search.TrackHits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Core.Search.TrackHits)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TrackHits value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Number of hits matching the query to count accurately. If true, the exact @@ -38,13 +66,37 @@ namespace Elastic.Clients.Elasticsearch.Core.Search; /// Defaults to 10,000 hits. /// /// -public sealed partial class TrackHits : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TrackHitsConverter))] +public sealed partial class TrackHits : Elastic.Clients.Elasticsearch.Union { - public TrackHits(bool Enabled) : base(Enabled) + public TrackHits(bool value) : base(value) + { + } + + public TrackHits(int value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.TrackHits(bool value) => new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(value); + public static implicit operator Elastic.Clients.Elasticsearch.Core.Search.TrackHits(int value) => new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(value); +} + +public readonly partial struct TrackHitsFactory +{ + public Elastic.Clients.Elasticsearch.Core.Search.TrackHits Enabled(bool value = true) + { + return new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(value); + } + + public Elastic.Clients.Elasticsearch.Core.Search.TrackHits Count(int value) { + return new Elastic.Clients.Elasticsearch.Core.Search.TrackHits(value); } - public TrackHits(int Count) : base(Count) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Core.Search.TrackHits Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.Core.Search.TrackHitsFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/UpdateByQueryRethrottle/UpdateByQueryRethrottleNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/UpdateByQueryRethrottle/UpdateByQueryRethrottleNode.g.cs index 6589bc7a9b4..e76c8b82fb0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/UpdateByQueryRethrottle/UpdateByQueryRethrottleNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/UpdateByQueryRethrottle/UpdateByQueryRethrottleNode.g.cs @@ -17,30 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.UpdateByQueryRethrottle; +internal sealed partial class UpdateByQueryRethrottleNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.Core.UpdateByQueryRethrottle.UpdateByQueryRethrottleNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propHost = default; + LocalJsonValue propIp = default; + LocalJsonValue propName = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue> propTasks = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Core.UpdateByQueryRethrottle.UpdateByQueryRethrottleNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + Host = propHost.Value, + Ip = propIp.Value, + Name = propName.Value, + Roles = propRoles.Value, + Tasks = propTasks.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.UpdateByQueryRethrottle.UpdateByQueryRethrottleNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.UpdateByQueryRethrottle.UpdateByQueryRethrottleNodeConverter))] public sealed partial class UpdateByQueryRethrottleNode { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("host")] - public string Host { get; init; } - [JsonInclude, JsonPropertyName("ip")] - public string Ip { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } - [JsonInclude, JsonPropertyName("tasks")] - public IReadOnlyDictionary Tasks { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UpdateByQueryRethrottleNode(System.Collections.Generic.IReadOnlyDictionary attributes, string host, string ip, string name, System.Collections.Generic.IReadOnlyDictionary tasks, string transportAddress) + { + Attributes = attributes; + Host = host; + Ip = ip; + Name = name; + Tasks = tasks; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public UpdateByQueryRethrottleNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UpdateByQueryRethrottleNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UpdateByQueryRethrottleNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Host { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Ip { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Tasks { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPattern.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPattern.g.cs index 50cd3855639..e5fb017b4d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPattern.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPattern.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class AutoFollowPatternConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPattern Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propPattern = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPattern(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Pattern = propPattern.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPattern value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternConverter))] public sealed partial class AutoFollowPattern { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("pattern")] - public Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary Pattern { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoFollowPattern(string name, Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary pattern) + { + Name = name; + Pattern = pattern; + } +#if NET7_0_OR_GREATER + public AutoFollowPattern() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AutoFollowPattern() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoFollowPattern(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary Pattern { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPatternSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPatternSummary.g.cs index 2847fd3a10c..bd6294bd329 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPatternSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowPatternSummary.g.cs @@ -17,58 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class AutoFollowPatternSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText PropFollowIndexPattern = System.Text.Json.JsonEncodedText.Encode("follow_index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndexExclusionPatterns = System.Text.Json.JsonEncodedText.Encode("leader_index_exclusion_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndexPatterns = System.Text.Json.JsonEncodedText.Encode("leader_index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActive = default; + LocalJsonValue propFollowIndexPattern = default; + LocalJsonValue> propLeaderIndexExclusionPatterns = default; + LocalJsonValue> propLeaderIndexPatterns = default; + LocalJsonValue propMaxOutstandingReadRequests = default; + LocalJsonValue propRemoteCluster = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActive.TryReadProperty(ref reader, options, PropActive, null)) + { + continue; + } + + if (propFollowIndexPattern.TryReadProperty(ref reader, options, PropFollowIndexPattern, null)) + { + continue; + } + + if (propLeaderIndexExclusionPatterns.TryReadProperty(ref reader, options, PropLeaderIndexExclusionPatterns, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLeaderIndexPatterns.TryReadProperty(ref reader, options, PropLeaderIndexPatterns, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMaxOutstandingReadRequests.TryReadProperty(ref reader, options, PropMaxOutstandingReadRequests, null)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Active = propActive.Value, + FollowIndexPattern = propFollowIndexPattern.Value, + LeaderIndexExclusionPatterns = propLeaderIndexExclusionPatterns.Value, + LeaderIndexPatterns = propLeaderIndexPatterns.Value, + MaxOutstandingReadRequests = propMaxOutstandingReadRequests.Value, + RemoteCluster = propRemoteCluster.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActive, value.Active, null, null); + writer.WriteProperty(options, PropFollowIndexPattern, value.FollowIndexPattern, null, null); + writer.WriteProperty(options, PropLeaderIndexExclusionPatterns, value.LeaderIndexExclusionPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLeaderIndexPatterns, value.LeaderIndexPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxOutstandingReadRequests, value.MaxOutstandingReadRequests, null, null); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowPatternSummaryConverter))] public sealed partial class AutoFollowPatternSummary { - [JsonInclude, JsonPropertyName("active")] - public bool Active { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoFollowPatternSummary(bool active, System.Collections.Generic.IReadOnlyCollection leaderIndexExclusionPatterns, System.Collections.Generic.IReadOnlyCollection leaderIndexPatterns, int maxOutstandingReadRequests, string remoteCluster) + { + Active = active; + LeaderIndexExclusionPatterns = leaderIndexExclusionPatterns; + LeaderIndexPatterns = leaderIndexPatterns; + MaxOutstandingReadRequests = maxOutstandingReadRequests; + RemoteCluster = remoteCluster; + } +#if NET7_0_OR_GREATER + public AutoFollowPatternSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AutoFollowPatternSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoFollowPatternSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Active { get; set; } /// /// /// The name of follower index. /// /// - [JsonInclude, JsonPropertyName("follow_index_pattern")] - public string? FollowIndexPattern { get; init; } + public string? FollowIndexPattern { get; set; } /// /// /// An array of simple index patterns that can be used to exclude indices from being auto-followed. /// /// - [JsonInclude, JsonPropertyName("leader_index_exclusion_patterns")] - public IReadOnlyCollection LeaderIndexExclusionPatterns { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection LeaderIndexExclusionPatterns { get; set; } /// /// /// An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field. /// /// - [JsonInclude, JsonPropertyName("leader_index_patterns")] - public IReadOnlyCollection LeaderIndexPatterns { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection LeaderIndexPatterns { get; set; } /// /// /// The maximum number of outstanding reads requests from the remote cluster. /// /// - [JsonInclude, JsonPropertyName("max_outstanding_read_requests")] - public int MaxOutstandingReadRequests { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxOutstandingReadRequests { get; set; } /// /// /// The remote cluster containing the leader indices to match against. /// /// - [JsonInclude, JsonPropertyName("remote_cluster")] - public string RemoteCluster { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RemoteCluster { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowStats.g.cs index fb98faedc6a..068909d9cc0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowStats.g.cs @@ -17,26 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class AutoFollowStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAutoFollowedClusters = System.Text.Json.JsonEncodedText.Encode("auto_followed_clusters"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfFailedFollowIndices = System.Text.Json.JsonEncodedText.Encode("number_of_failed_follow_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfFailedRemoteClusterStateRequests = System.Text.Json.JsonEncodedText.Encode("number_of_failed_remote_cluster_state_requests"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfSuccessfulFollowIndices = System.Text.Json.JsonEncodedText.Encode("number_of_successful_follow_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRecentAutoFollowErrors = System.Text.Json.JsonEncodedText.Encode("recent_auto_follow_errors"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAutoFollowedClusters = default; + LocalJsonValue propNumberOfFailedFollowIndices = default; + LocalJsonValue propNumberOfFailedRemoteClusterStateRequests = default; + LocalJsonValue propNumberOfSuccessfulFollowIndices = default; + LocalJsonValue> propRecentAutoFollowErrors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAutoFollowedClusters.TryReadProperty(ref reader, options, PropAutoFollowedClusters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propNumberOfFailedFollowIndices.TryReadProperty(ref reader, options, PropNumberOfFailedFollowIndices, null)) + { + continue; + } + + if (propNumberOfFailedRemoteClusterStateRequests.TryReadProperty(ref reader, options, PropNumberOfFailedRemoteClusterStateRequests, null)) + { + continue; + } + + if (propNumberOfSuccessfulFollowIndices.TryReadProperty(ref reader, options, PropNumberOfSuccessfulFollowIndices, null)) + { + continue; + } + + if (propRecentAutoFollowErrors.TryReadProperty(ref reader, options, PropRecentAutoFollowErrors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AutoFollowedClusters = propAutoFollowedClusters.Value, + NumberOfFailedFollowIndices = propNumberOfFailedFollowIndices.Value, + NumberOfFailedRemoteClusterStateRequests = propNumberOfFailedRemoteClusterStateRequests.Value, + NumberOfSuccessfulFollowIndices = propNumberOfSuccessfulFollowIndices.Value, + RecentAutoFollowErrors = propRecentAutoFollowErrors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAutoFollowedClusters, value.AutoFollowedClusters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNumberOfFailedFollowIndices, value.NumberOfFailedFollowIndices, null, null); + writer.WriteProperty(options, PropNumberOfFailedRemoteClusterStateRequests, value.NumberOfFailedRemoteClusterStateRequests, null, null); + writer.WriteProperty(options, PropNumberOfSuccessfulFollowIndices, value.NumberOfSuccessfulFollowIndices, null, null); + writer.WriteProperty(options, PropRecentAutoFollowErrors, value.RecentAutoFollowErrors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowStatsConverter))] public sealed partial class AutoFollowStats { - [JsonInclude, JsonPropertyName("auto_followed_clusters")] - public IReadOnlyCollection AutoFollowedClusters { get; init; } - [JsonInclude, JsonPropertyName("number_of_failed_follow_indices")] - public long NumberOfFailedFollowIndices { get; init; } - [JsonInclude, JsonPropertyName("number_of_failed_remote_cluster_state_requests")] - public long NumberOfFailedRemoteClusterStateRequests { get; init; } - [JsonInclude, JsonPropertyName("number_of_successful_follow_indices")] - public long NumberOfSuccessfulFollowIndices { get; init; } - [JsonInclude, JsonPropertyName("recent_auto_follow_errors")] - public IReadOnlyCollection RecentAutoFollowErrors { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoFollowStats(System.Collections.Generic.IReadOnlyCollection autoFollowedClusters, long numberOfFailedFollowIndices, long numberOfFailedRemoteClusterStateRequests, long numberOfSuccessfulFollowIndices, System.Collections.Generic.IReadOnlyCollection recentAutoFollowErrors) + { + AutoFollowedClusters = autoFollowedClusters; + NumberOfFailedFollowIndices = numberOfFailedFollowIndices; + NumberOfFailedRemoteClusterStateRequests = numberOfFailedRemoteClusterStateRequests; + NumberOfSuccessfulFollowIndices = numberOfSuccessfulFollowIndices; + RecentAutoFollowErrors = recentAutoFollowErrors; + } +#if NET7_0_OR_GREATER + public AutoFollowStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AutoFollowStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoFollowStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection AutoFollowedClusters { get; set; } + + /// + /// + /// The number of indices that the auto-follow coordinator failed to automatically follow. + /// The causes of recent failures are captured in the logs of the elected master node and in the auto_follow_stats.recent_auto_follow_errors field. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long NumberOfFailedFollowIndices { get; set; } + + /// + /// + /// The number of times that the auto-follow coordinator failed to retrieve the cluster state from a remote cluster registered in a collection of auto-follow patterns. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long NumberOfFailedRemoteClusterStateRequests { get; set; } + + /// + /// + /// The number of indices that the auto-follow coordinator successfully followed. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long NumberOfSuccessfulFollowIndices { get; set; } + + /// + /// + /// An array of objects representing failures by the auto-follow coordinator. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RecentAutoFollowErrors { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowedCluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowedCluster.g.cs index 7d0f31c5d2d..5f3d35e4661 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowedCluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/AutoFollowedCluster.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class AutoFollowedClusterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusterName = System.Text.Json.JsonEncodedText.Encode("cluster_name"); + private static readonly System.Text.Json.JsonEncodedText PropLastSeenMetadataVersion = System.Text.Json.JsonEncodedText.Encode("last_seen_metadata_version"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSinceLastCheckMillis = System.Text.Json.JsonEncodedText.Encode("time_since_last_check_millis"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowedCluster Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterName = default; + LocalJsonValue propLastSeenMetadataVersion = default; + LocalJsonValue propTimeSinceLastCheckMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterName.TryReadProperty(ref reader, options, PropClusterName, null)) + { + continue; + } + + if (propLastSeenMetadataVersion.TryReadProperty(ref reader, options, PropLastSeenMetadataVersion, null)) + { + continue; + } + + if (propTimeSinceLastCheckMillis.TryReadProperty(ref reader, options, PropTimeSinceLastCheckMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowedCluster(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterName = propClusterName.Value, + LastSeenMetadataVersion = propLastSeenMetadataVersion.Value, + TimeSinceLastCheckMillis = propTimeSinceLastCheckMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowedCluster value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterName, value.ClusterName, null, null); + writer.WriteProperty(options, PropLastSeenMetadataVersion, value.LastSeenMetadataVersion, null, null); + writer.WriteProperty(options, PropTimeSinceLastCheckMillis, value.TimeSinceLastCheckMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.AutoFollowedClusterConverter))] public sealed partial class AutoFollowedCluster { - [JsonInclude, JsonPropertyName("cluster_name")] - public string ClusterName { get; init; } - [JsonInclude, JsonPropertyName("last_seen_metadata_version")] - public long LastSeenMetadataVersion { get; init; } - [JsonInclude, JsonPropertyName("time_since_last_check_millis")] - public long TimeSinceLastCheckMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AutoFollowedCluster(string clusterName, long lastSeenMetadataVersion, System.TimeSpan timeSinceLastCheckMillis) + { + ClusterName = clusterName; + LastSeenMetadataVersion = lastSeenMetadataVersion; + TimeSinceLastCheckMillis = timeSinceLastCheckMillis; + } +#if NET7_0_OR_GREATER + public AutoFollowedCluster() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AutoFollowedCluster() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AutoFollowedCluster(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClusterName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LastSeenMetadataVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeSinceLastCheckMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowIndexStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowIndexStats.g.cs index f0a6e69d15d..7cbd3bbca78 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowIndexStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowIndexStats.g.cs @@ -17,20 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class FollowIndexStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowIndexStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowIndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowIndexStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowIndexStatsConverter))] public sealed partial class FollowIndexStats { - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyCollection Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowIndexStats(string index, System.Collections.Generic.IReadOnlyCollection shards) + { + Index = index; + Shards = shards; + } +#if NET7_0_OR_GREATER + public FollowIndexStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FollowIndexStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowIndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + + /// + /// + /// An array of shard-level following task statistics. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowStats.g.cs index 25583f2567b..ef28d324c8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowStats.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class FollowStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowStatsConverter))] public sealed partial class FollowStats { - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowStats(System.Collections.Generic.IReadOnlyCollection indices) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public FollowStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FollowStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndex.g.cs index f7ac41cadec..2c39362d371 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndex.g.cs @@ -17,26 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class FollowerIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndexValue = System.Text.Json.JsonEncodedText.Encode("follower_index"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndex = System.Text.Json.JsonEncodedText.Encode("leader_index"); + private static readonly System.Text.Json.JsonEncodedText PropParameters = System.Text.Json.JsonEncodedText.Encode("parameters"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFollowerIndexValue = default; + LocalJsonValue propLeaderIndex = default; + LocalJsonValue propParameters = default; + LocalJsonValue propRemoteCluster = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFollowerIndexValue.TryReadProperty(ref reader, options, PropFollowerIndexValue, null)) + { + continue; + } + + if (propLeaderIndex.TryReadProperty(ref reader, options, PropLeaderIndex, null)) + { + continue; + } + + if (propParameters.TryReadProperty(ref reader, options, PropParameters, null)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FollowerIndexValue = propFollowerIndexValue.Value, + LeaderIndex = propLeaderIndex.Value, + Parameters = propParameters.Value, + RemoteCluster = propRemoteCluster.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFollowerIndexValue, value.FollowerIndexValue, null, null); + writer.WriteProperty(options, PropLeaderIndex, value.LeaderIndex, null, null); + writer.WriteProperty(options, PropParameters, value.Parameters, null, null); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexConverter))] public sealed partial class FollowerIndex { - [JsonInclude, JsonPropertyName("follower_index")] - public string FollowerIndexValue { get; init; } - [JsonInclude, JsonPropertyName("leader_index")] - public string LeaderIndex { get; init; } - [JsonInclude, JsonPropertyName("parameters")] - public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParameters? Parameters { get; init; } - [JsonInclude, JsonPropertyName("remote_cluster")] - public string RemoteCluster { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FollowerIndex(string followerIndexValue, string leaderIndex, string remoteCluster, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus status) + { + FollowerIndexValue = followerIndexValue; + LeaderIndex = leaderIndex; + RemoteCluster = remoteCluster; + Status = status; + } +#if NET7_0_OR_GREATER + public FollowerIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FollowerIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowerIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string FollowerIndexValue { get; set; } + + /// + /// + /// The name of the index in the leader cluster that is followed. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string LeaderIndex { get; set; } + + /// + /// + /// An object that encapsulates cross-cluster replication parameters. If the follower index's status is paused, this object is omitted. + /// + /// + public Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParameters? Parameters { get; set; } + + /// + /// + /// The remote cluster that contains the leader index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string RemoteCluster { get; set; } + + /// + /// + /// The status of the index following: active or paused. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndexParameters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndexParameters.g.cs index 06ff51f8ada..e4ffa1efab7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndexParameters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/FollowerIndexParameters.g.cs @@ -17,36 +17,223 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class FollowerIndexParametersConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOutstandingWriteRequests = System.Text.Json.JsonEncodedText.Encode("max_outstanding_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_read_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxReadRequestSize = System.Text.Json.JsonEncodedText.Encode("max_read_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRetryDelay = System.Text.Json.JsonEncodedText.Encode("max_retry_delay"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferCount = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteBufferSize = System.Text.Json.JsonEncodedText.Encode("max_write_buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestOperationCount = System.Text.Json.JsonEncodedText.Encode("max_write_request_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWriteRequestSize = System.Text.Json.JsonEncodedText.Encode("max_write_request_size"); + private static readonly System.Text.Json.JsonEncodedText PropReadPollTimeout = System.Text.Json.JsonEncodedText.Encode("read_poll_timeout"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParameters Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxOutstandingReadRequests = default; + LocalJsonValue propMaxOutstandingWriteRequests = default; + LocalJsonValue propMaxReadRequestOperationCount = default; + LocalJsonValue propMaxReadRequestSize = default; + LocalJsonValue propMaxRetryDelay = default; + LocalJsonValue propMaxWriteBufferCount = default; + LocalJsonValue propMaxWriteBufferSize = default; + LocalJsonValue propMaxWriteRequestOperationCount = default; + LocalJsonValue propMaxWriteRequestSize = default; + LocalJsonValue propReadPollTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxOutstandingReadRequests.TryReadProperty(ref reader, options, PropMaxOutstandingReadRequests, null)) + { + continue; + } + + if (propMaxOutstandingWriteRequests.TryReadProperty(ref reader, options, PropMaxOutstandingWriteRequests, null)) + { + continue; + } + + if (propMaxReadRequestOperationCount.TryReadProperty(ref reader, options, PropMaxReadRequestOperationCount, null)) + { + continue; + } + + if (propMaxReadRequestSize.TryReadProperty(ref reader, options, PropMaxReadRequestSize, null)) + { + continue; + } + + if (propMaxRetryDelay.TryReadProperty(ref reader, options, PropMaxRetryDelay, null)) + { + continue; + } + + if (propMaxWriteBufferCount.TryReadProperty(ref reader, options, PropMaxWriteBufferCount, null)) + { + continue; + } + + if (propMaxWriteBufferSize.TryReadProperty(ref reader, options, PropMaxWriteBufferSize, null)) + { + continue; + } + + if (propMaxWriteRequestOperationCount.TryReadProperty(ref reader, options, PropMaxWriteRequestOperationCount, null)) + { + continue; + } + + if (propMaxWriteRequestSize.TryReadProperty(ref reader, options, PropMaxWriteRequestSize, null)) + { + continue; + } + + if (propReadPollTimeout.TryReadProperty(ref reader, options, PropReadPollTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxOutstandingReadRequests = propMaxOutstandingReadRequests.Value, + MaxOutstandingWriteRequests = propMaxOutstandingWriteRequests.Value, + MaxReadRequestOperationCount = propMaxReadRequestOperationCount.Value, + MaxReadRequestSize = propMaxReadRequestSize.Value, + MaxRetryDelay = propMaxRetryDelay.Value, + MaxWriteBufferCount = propMaxWriteBufferCount.Value, + MaxWriteBufferSize = propMaxWriteBufferSize.Value, + MaxWriteRequestOperationCount = propMaxWriteRequestOperationCount.Value, + MaxWriteRequestSize = propMaxWriteRequestSize.Value, + ReadPollTimeout = propReadPollTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParameters value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxOutstandingReadRequests, value.MaxOutstandingReadRequests, null, null); + writer.WriteProperty(options, PropMaxOutstandingWriteRequests, value.MaxOutstandingWriteRequests, null, null); + writer.WriteProperty(options, PropMaxReadRequestOperationCount, value.MaxReadRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxReadRequestSize, value.MaxReadRequestSize, null, null); + writer.WriteProperty(options, PropMaxRetryDelay, value.MaxRetryDelay, null, null); + writer.WriteProperty(options, PropMaxWriteBufferCount, value.MaxWriteBufferCount, null, null); + writer.WriteProperty(options, PropMaxWriteBufferSize, value.MaxWriteBufferSize, null, null); + writer.WriteProperty(options, PropMaxWriteRequestOperationCount, value.MaxWriteRequestOperationCount, null, null); + writer.WriteProperty(options, PropMaxWriteRequestSize, value.MaxWriteRequestSize, null, null); + writer.WriteProperty(options, PropReadPollTimeout, value.ReadPollTimeout, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexParametersConverter))] public sealed partial class FollowerIndexParameters { - [JsonInclude, JsonPropertyName("max_outstanding_read_requests")] - public int MaxOutstandingReadRequests { get; init; } - [JsonInclude, JsonPropertyName("max_outstanding_write_requests")] - public int MaxOutstandingWriteRequests { get; init; } - [JsonInclude, JsonPropertyName("max_read_request_operation_count")] - public int MaxReadRequestOperationCount { get; init; } - [JsonInclude, JsonPropertyName("max_read_request_size")] - public string MaxReadRequestSize { get; init; } - [JsonInclude, JsonPropertyName("max_retry_delay")] - public Elastic.Clients.Elasticsearch.Duration MaxRetryDelay { get; init; } - [JsonInclude, JsonPropertyName("max_write_buffer_count")] - public int MaxWriteBufferCount { get; init; } - [JsonInclude, JsonPropertyName("max_write_buffer_size")] - public string MaxWriteBufferSize { get; init; } - [JsonInclude, JsonPropertyName("max_write_request_operation_count")] - public int MaxWriteRequestOperationCount { get; init; } - [JsonInclude, JsonPropertyName("max_write_request_size")] - public string MaxWriteRequestSize { get; init; } - [JsonInclude, JsonPropertyName("read_poll_timeout")] - public Elastic.Clients.Elasticsearch.Duration ReadPollTimeout { get; init; } +#if NET7_0_OR_GREATER + public FollowerIndexParameters() + { + } +#endif +#if !NET7_0_OR_GREATER + public FollowerIndexParameters() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FollowerIndexParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The maximum number of outstanding reads requests from the remote cluster. + /// + /// + public long? MaxOutstandingReadRequests { get; set; } + + /// + /// + /// The maximum number of outstanding write requests on the follower. + /// + /// + public int? MaxOutstandingWriteRequests { get; set; } + + /// + /// + /// The maximum number of operations to pull per read from the remote cluster. + /// + /// + public int? MaxReadRequestOperationCount { get; set; } + + /// + /// + /// The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxReadRequestSize { get; set; } + + /// + /// + /// The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when + /// retrying. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MaxRetryDelay { get; set; } + + /// + /// + /// The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be + /// deferred until the number of queued operations goes below the limit. + /// + /// + public int? MaxWriteBufferCount { get; set; } + + /// + /// + /// The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will + /// be deferred until the total bytes of queued operations goes below the limit. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteBufferSize { get; set; } + + /// + /// + /// The maximum number of operations per bulk write request executed on the follower. + /// + /// + public int? MaxWriteRequestOperationCount { get; set; } + + /// + /// + /// The maximum total bytes of operations per bulk write request executed on the follower. + /// + /// + public Elastic.Clients.Elasticsearch.ByteSize? MaxWriteRequestSize { get; set; } + + /// + /// + /// The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. + /// When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. + /// Then the follower will immediately attempt to read from the leader again. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? ReadPollTimeout { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ReadException.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ReadException.g.cs index ecddd169e73..f2b3fd6e110 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ReadException.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ReadException.g.cs @@ -17,22 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class ReadExceptionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropException = System.Text.Json.JsonEncodedText.Encode("exception"); + private static readonly System.Text.Json.JsonEncodedText PropFromSeqNo = System.Text.Json.JsonEncodedText.Encode("from_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropRetries = System.Text.Json.JsonEncodedText.Encode("retries"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ReadException Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propException = default; + LocalJsonValue propFromSeqNo = default; + LocalJsonValue propRetries = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propException.TryReadProperty(ref reader, options, PropException, null)) + { + continue; + } + + if (propFromSeqNo.TryReadProperty(ref reader, options, PropFromSeqNo, null)) + { + continue; + } + + if (propRetries.TryReadProperty(ref reader, options, PropRetries, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ReadException(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exception = propException.Value, + FromSeqNo = propFromSeqNo.Value, + Retries = propRetries.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ReadException value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropException, value.Exception, null, null); + writer.WriteProperty(options, PropFromSeqNo, value.FromSeqNo, null, null); + writer.WriteProperty(options, PropRetries, value.Retries, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ReadExceptionConverter))] public sealed partial class ReadException { - [JsonInclude, JsonPropertyName("exception")] - public Elastic.Clients.Elasticsearch.ErrorCause Exception { get; init; } - [JsonInclude, JsonPropertyName("from_seq_no")] - public long FromSeqNo { get; init; } - [JsonInclude, JsonPropertyName("retries")] - public int Retries { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadException(Elastic.Clients.Elasticsearch.ErrorCause exception, long fromSeqNo, int retries) + { + Exception = exception; + FromSeqNo = fromSeqNo; + Retries = retries; + } +#if NET7_0_OR_GREATER + public ReadException() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReadException() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReadException(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The exception that caused the read to fail. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Exception { get; set; } + + /// + /// + /// The starting sequence number of the batch requested from the leader. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FromSeqNo { get; set; } + + /// + /// + /// The number of times the batch has been retried. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int Retries { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ShardStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ShardStats.g.cs index c14f686d4c2..cf5cce8fa26 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ShardStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CrossClusterReplication/ShardStats.g.cs @@ -17,82 +17,704 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; +internal sealed partial class ShardStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBytesRead = System.Text.Json.JsonEncodedText.Encode("bytes_read"); + private static readonly System.Text.Json.JsonEncodedText PropFailedReadRequests = System.Text.Json.JsonEncodedText.Encode("failed_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropFailedWriteRequests = System.Text.Json.JsonEncodedText.Encode("failed_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropFatalException = System.Text.Json.JsonEncodedText.Encode("fatal_exception"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerAliasesVersion = System.Text.Json.JsonEncodedText.Encode("follower_aliases_version"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerGlobalCheckpoint = System.Text.Json.JsonEncodedText.Encode("follower_global_checkpoint"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndex = System.Text.Json.JsonEncodedText.Encode("follower_index"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerMappingVersion = System.Text.Json.JsonEncodedText.Encode("follower_mapping_version"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerMaxSeqNo = System.Text.Json.JsonEncodedText.Encode("follower_max_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerSettingsVersion = System.Text.Json.JsonEncodedText.Encode("follower_settings_version"); + private static readonly System.Text.Json.JsonEncodedText PropLastRequestedSeqNo = System.Text.Json.JsonEncodedText.Encode("last_requested_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderGlobalCheckpoint = System.Text.Json.JsonEncodedText.Encode("leader_global_checkpoint"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderIndex = System.Text.Json.JsonEncodedText.Encode("leader_index"); + private static readonly System.Text.Json.JsonEncodedText PropLeaderMaxSeqNo = System.Text.Json.JsonEncodedText.Encode("leader_max_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropOperationsRead = System.Text.Json.JsonEncodedText.Encode("operations_read"); + private static readonly System.Text.Json.JsonEncodedText PropOperationsWritten = System.Text.Json.JsonEncodedText.Encode("operations_written"); + private static readonly System.Text.Json.JsonEncodedText PropOutstandingReadRequests = System.Text.Json.JsonEncodedText.Encode("outstanding_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropOutstandingWriteRequests = System.Text.Json.JsonEncodedText.Encode("outstanding_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropReadExceptions = System.Text.Json.JsonEncodedText.Encode("read_exceptions"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropShardId = System.Text.Json.JsonEncodedText.Encode("shard_id"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessfulReadRequests = System.Text.Json.JsonEncodedText.Encode("successful_read_requests"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessfulWriteRequests = System.Text.Json.JsonEncodedText.Encode("successful_write_requests"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSinceLastRead = System.Text.Json.JsonEncodedText.Encode("time_since_last_read"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSinceLastReadMillis = System.Text.Json.JsonEncodedText.Encode("time_since_last_read_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalReadRemoteExecTime = System.Text.Json.JsonEncodedText.Encode("total_read_remote_exec_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalReadRemoteExecTimeMillis = System.Text.Json.JsonEncodedText.Encode("total_read_remote_exec_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalReadTime = System.Text.Json.JsonEncodedText.Encode("total_read_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalReadTimeMillis = System.Text.Json.JsonEncodedText.Encode("total_read_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalWriteTime = System.Text.Json.JsonEncodedText.Encode("total_write_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalWriteTimeMillis = System.Text.Json.JsonEncodedText.Encode("total_write_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropWriteBufferOperationCount = System.Text.Json.JsonEncodedText.Encode("write_buffer_operation_count"); + private static readonly System.Text.Json.JsonEncodedText PropWriteBufferSizeInBytes = System.Text.Json.JsonEncodedText.Encode("write_buffer_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.ShardStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBytesRead = default; + LocalJsonValue propFailedReadRequests = default; + LocalJsonValue propFailedWriteRequests = default; + LocalJsonValue propFatalException = default; + LocalJsonValue propFollowerAliasesVersion = default; + LocalJsonValue propFollowerGlobalCheckpoint = default; + LocalJsonValue propFollowerIndex = default; + LocalJsonValue propFollowerMappingVersion = default; + LocalJsonValue propFollowerMaxSeqNo = default; + LocalJsonValue propFollowerSettingsVersion = default; + LocalJsonValue propLastRequestedSeqNo = default; + LocalJsonValue propLeaderGlobalCheckpoint = default; + LocalJsonValue propLeaderIndex = default; + LocalJsonValue propLeaderMaxSeqNo = default; + LocalJsonValue propOperationsRead = default; + LocalJsonValue propOperationsWritten = default; + LocalJsonValue propOutstandingReadRequests = default; + LocalJsonValue propOutstandingWriteRequests = default; + LocalJsonValue> propReadExceptions = default; + LocalJsonValue propRemoteCluster = default; + LocalJsonValue propShardId = default; + LocalJsonValue propSuccessfulReadRequests = default; + LocalJsonValue propSuccessfulWriteRequests = default; + LocalJsonValue propTimeSinceLastRead = default; + LocalJsonValue propTimeSinceLastReadMillis = default; + LocalJsonValue propTotalReadRemoteExecTime = default; + LocalJsonValue propTotalReadRemoteExecTimeMillis = default; + LocalJsonValue propTotalReadTime = default; + LocalJsonValue propTotalReadTimeMillis = default; + LocalJsonValue propTotalWriteTime = default; + LocalJsonValue propTotalWriteTimeMillis = default; + LocalJsonValue propWriteBufferOperationCount = default; + LocalJsonValue propWriteBufferSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBytesRead.TryReadProperty(ref reader, options, PropBytesRead, null)) + { + continue; + } + + if (propFailedReadRequests.TryReadProperty(ref reader, options, PropFailedReadRequests, null)) + { + continue; + } + + if (propFailedWriteRequests.TryReadProperty(ref reader, options, PropFailedWriteRequests, null)) + { + continue; + } + + if (propFatalException.TryReadProperty(ref reader, options, PropFatalException, null)) + { + continue; + } + + if (propFollowerAliasesVersion.TryReadProperty(ref reader, options, PropFollowerAliasesVersion, null)) + { + continue; + } + + if (propFollowerGlobalCheckpoint.TryReadProperty(ref reader, options, PropFollowerGlobalCheckpoint, null)) + { + continue; + } + + if (propFollowerIndex.TryReadProperty(ref reader, options, PropFollowerIndex, null)) + { + continue; + } + + if (propFollowerMappingVersion.TryReadProperty(ref reader, options, PropFollowerMappingVersion, null)) + { + continue; + } + + if (propFollowerMaxSeqNo.TryReadProperty(ref reader, options, PropFollowerMaxSeqNo, null)) + { + continue; + } + + if (propFollowerSettingsVersion.TryReadProperty(ref reader, options, PropFollowerSettingsVersion, null)) + { + continue; + } + + if (propLastRequestedSeqNo.TryReadProperty(ref reader, options, PropLastRequestedSeqNo, null)) + { + continue; + } + + if (propLeaderGlobalCheckpoint.TryReadProperty(ref reader, options, PropLeaderGlobalCheckpoint, null)) + { + continue; + } + + if (propLeaderIndex.TryReadProperty(ref reader, options, PropLeaderIndex, null)) + { + continue; + } + + if (propLeaderMaxSeqNo.TryReadProperty(ref reader, options, PropLeaderMaxSeqNo, null)) + { + continue; + } + + if (propOperationsRead.TryReadProperty(ref reader, options, PropOperationsRead, null)) + { + continue; + } + + if (propOperationsWritten.TryReadProperty(ref reader, options, PropOperationsWritten, null)) + { + continue; + } + + if (propOutstandingReadRequests.TryReadProperty(ref reader, options, PropOutstandingReadRequests, null)) + { + continue; + } + + if (propOutstandingWriteRequests.TryReadProperty(ref reader, options, PropOutstandingWriteRequests, null)) + { + continue; + } + + if (propReadExceptions.TryReadProperty(ref reader, options, PropReadExceptions, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, null)) + { + continue; + } + + if (propShardId.TryReadProperty(ref reader, options, PropShardId, null)) + { + continue; + } + + if (propSuccessfulReadRequests.TryReadProperty(ref reader, options, PropSuccessfulReadRequests, null)) + { + continue; + } + + if (propSuccessfulWriteRequests.TryReadProperty(ref reader, options, PropSuccessfulWriteRequests, null)) + { + continue; + } + + if (propTimeSinceLastRead.TryReadProperty(ref reader, options, PropTimeSinceLastRead, null)) + { + continue; + } + + if (propTimeSinceLastReadMillis.TryReadProperty(ref reader, options, PropTimeSinceLastReadMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalReadRemoteExecTime.TryReadProperty(ref reader, options, PropTotalReadRemoteExecTime, null)) + { + continue; + } + + if (propTotalReadRemoteExecTimeMillis.TryReadProperty(ref reader, options, PropTotalReadRemoteExecTimeMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalReadTime.TryReadProperty(ref reader, options, PropTotalReadTime, null)) + { + continue; + } + + if (propTotalReadTimeMillis.TryReadProperty(ref reader, options, PropTotalReadTimeMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalWriteTime.TryReadProperty(ref reader, options, PropTotalWriteTime, null)) + { + continue; + } + + if (propTotalWriteTimeMillis.TryReadProperty(ref reader, options, PropTotalWriteTimeMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propWriteBufferOperationCount.TryReadProperty(ref reader, options, PropWriteBufferOperationCount, null)) + { + continue; + } + + if (propWriteBufferSizeInBytes.TryReadProperty(ref reader, options, PropWriteBufferSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.CrossClusterReplication.ShardStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BytesRead = propBytesRead.Value, + FailedReadRequests = propFailedReadRequests.Value, + FailedWriteRequests = propFailedWriteRequests.Value, + FatalException = propFatalException.Value, + FollowerAliasesVersion = propFollowerAliasesVersion.Value, + FollowerGlobalCheckpoint = propFollowerGlobalCheckpoint.Value, + FollowerIndex = propFollowerIndex.Value, + FollowerMappingVersion = propFollowerMappingVersion.Value, + FollowerMaxSeqNo = propFollowerMaxSeqNo.Value, + FollowerSettingsVersion = propFollowerSettingsVersion.Value, + LastRequestedSeqNo = propLastRequestedSeqNo.Value, + LeaderGlobalCheckpoint = propLeaderGlobalCheckpoint.Value, + LeaderIndex = propLeaderIndex.Value, + LeaderMaxSeqNo = propLeaderMaxSeqNo.Value, + OperationsRead = propOperationsRead.Value, + OperationsWritten = propOperationsWritten.Value, + OutstandingReadRequests = propOutstandingReadRequests.Value, + OutstandingWriteRequests = propOutstandingWriteRequests.Value, + ReadExceptions = propReadExceptions.Value, + RemoteCluster = propRemoteCluster.Value, + ShardId = propShardId.Value, + SuccessfulReadRequests = propSuccessfulReadRequests.Value, + SuccessfulWriteRequests = propSuccessfulWriteRequests.Value, + TimeSinceLastRead = propTimeSinceLastRead.Value, + TimeSinceLastReadMillis = propTimeSinceLastReadMillis.Value, + TotalReadRemoteExecTime = propTotalReadRemoteExecTime.Value, + TotalReadRemoteExecTimeMillis = propTotalReadRemoteExecTimeMillis.Value, + TotalReadTime = propTotalReadTime.Value, + TotalReadTimeMillis = propTotalReadTimeMillis.Value, + TotalWriteTime = propTotalWriteTime.Value, + TotalWriteTimeMillis = propTotalWriteTimeMillis.Value, + WriteBufferOperationCount = propWriteBufferOperationCount.Value, + WriteBufferSizeInBytes = propWriteBufferSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.ShardStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBytesRead, value.BytesRead, null, null); + writer.WriteProperty(options, PropFailedReadRequests, value.FailedReadRequests, null, null); + writer.WriteProperty(options, PropFailedWriteRequests, value.FailedWriteRequests, null, null); + writer.WriteProperty(options, PropFatalException, value.FatalException, null, null); + writer.WriteProperty(options, PropFollowerAliasesVersion, value.FollowerAliasesVersion, null, null); + writer.WriteProperty(options, PropFollowerGlobalCheckpoint, value.FollowerGlobalCheckpoint, null, null); + writer.WriteProperty(options, PropFollowerIndex, value.FollowerIndex, null, null); + writer.WriteProperty(options, PropFollowerMappingVersion, value.FollowerMappingVersion, null, null); + writer.WriteProperty(options, PropFollowerMaxSeqNo, value.FollowerMaxSeqNo, null, null); + writer.WriteProperty(options, PropFollowerSettingsVersion, value.FollowerSettingsVersion, null, null); + writer.WriteProperty(options, PropLastRequestedSeqNo, value.LastRequestedSeqNo, null, null); + writer.WriteProperty(options, PropLeaderGlobalCheckpoint, value.LeaderGlobalCheckpoint, null, null); + writer.WriteProperty(options, PropLeaderIndex, value.LeaderIndex, null, null); + writer.WriteProperty(options, PropLeaderMaxSeqNo, value.LeaderMaxSeqNo, null, null); + writer.WriteProperty(options, PropOperationsRead, value.OperationsRead, null, null); + writer.WriteProperty(options, PropOperationsWritten, value.OperationsWritten, null, null); + writer.WriteProperty(options, PropOutstandingReadRequests, value.OutstandingReadRequests, null, null); + writer.WriteProperty(options, PropOutstandingWriteRequests, value.OutstandingWriteRequests, null, null); + writer.WriteProperty(options, PropReadExceptions, value.ReadExceptions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, null); + writer.WriteProperty(options, PropShardId, value.ShardId, null, null); + writer.WriteProperty(options, PropSuccessfulReadRequests, value.SuccessfulReadRequests, null, null); + writer.WriteProperty(options, PropSuccessfulWriteRequests, value.SuccessfulWriteRequests, null, null); + writer.WriteProperty(options, PropTimeSinceLastRead, value.TimeSinceLastRead, null, null); + writer.WriteProperty(options, PropTimeSinceLastReadMillis, value.TimeSinceLastReadMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalReadRemoteExecTime, value.TotalReadRemoteExecTime, null, null); + writer.WriteProperty(options, PropTotalReadRemoteExecTimeMillis, value.TotalReadRemoteExecTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalReadTime, value.TotalReadTime, null, null); + writer.WriteProperty(options, PropTotalReadTimeMillis, value.TotalReadTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalWriteTime, value.TotalWriteTime, null, null); + writer.WriteProperty(options, PropTotalWriteTimeMillis, value.TotalWriteTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropWriteBufferOperationCount, value.WriteBufferOperationCount, null, null); + writer.WriteProperty(options, PropWriteBufferSizeInBytes, value.WriteBufferSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.ShardStatsConverter))] public sealed partial class ShardStats { - [JsonInclude, JsonPropertyName("bytes_read")] - public long BytesRead { get; init; } - [JsonInclude, JsonPropertyName("failed_read_requests")] - public long FailedReadRequests { get; init; } - [JsonInclude, JsonPropertyName("failed_write_requests")] - public long FailedWriteRequests { get; init; } - [JsonInclude, JsonPropertyName("fatal_exception")] - public Elastic.Clients.Elasticsearch.ErrorCause? FatalException { get; init; } - [JsonInclude, JsonPropertyName("follower_aliases_version")] - public long FollowerAliasesVersion { get; init; } - [JsonInclude, JsonPropertyName("follower_global_checkpoint")] - public long FollowerGlobalCheckpoint { get; init; } - [JsonInclude, JsonPropertyName("follower_index")] - public string FollowerIndex { get; init; } - [JsonInclude, JsonPropertyName("follower_mapping_version")] - public long FollowerMappingVersion { get; init; } - [JsonInclude, JsonPropertyName("follower_max_seq_no")] - public long FollowerMaxSeqNo { get; init; } - [JsonInclude, JsonPropertyName("follower_settings_version")] - public long FollowerSettingsVersion { get; init; } - [JsonInclude, JsonPropertyName("last_requested_seq_no")] - public long LastRequestedSeqNo { get; init; } - [JsonInclude, JsonPropertyName("leader_global_checkpoint")] - public long LeaderGlobalCheckpoint { get; init; } - [JsonInclude, JsonPropertyName("leader_index")] - public string LeaderIndex { get; init; } - [JsonInclude, JsonPropertyName("leader_max_seq_no")] - public long LeaderMaxSeqNo { get; init; } - [JsonInclude, JsonPropertyName("operations_read")] - public long OperationsRead { get; init; } - [JsonInclude, JsonPropertyName("operations_written")] - public long OperationsWritten { get; init; } - [JsonInclude, JsonPropertyName("outstanding_read_requests")] - public int OutstandingReadRequests { get; init; } - [JsonInclude, JsonPropertyName("outstanding_write_requests")] - public int OutstandingWriteRequests { get; init; } - [JsonInclude, JsonPropertyName("read_exceptions")] - public IReadOnlyCollection ReadExceptions { get; init; } - [JsonInclude, JsonPropertyName("remote_cluster")] - public string RemoteCluster { get; init; } - [JsonInclude, JsonPropertyName("shard_id")] - public int ShardId { get; init; } - [JsonInclude, JsonPropertyName("successful_read_requests")] - public long SuccessfulReadRequests { get; init; } - [JsonInclude, JsonPropertyName("successful_write_requests")] - public long SuccessfulWriteRequests { get; init; } - [JsonInclude, JsonPropertyName("time_since_last_read")] - public Elastic.Clients.Elasticsearch.Duration? TimeSinceLastRead { get; init; } - [JsonInclude, JsonPropertyName("time_since_last_read_millis")] - public long TimeSinceLastReadMillis { get; init; } - [JsonInclude, JsonPropertyName("total_read_remote_exec_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalReadRemoteExecTime { get; init; } - [JsonInclude, JsonPropertyName("total_read_remote_exec_time_millis")] - public long TotalReadRemoteExecTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("total_read_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalReadTime { get; init; } - [JsonInclude, JsonPropertyName("total_read_time_millis")] - public long TotalReadTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("total_write_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalWriteTime { get; init; } - [JsonInclude, JsonPropertyName("total_write_time_millis")] - public long TotalWriteTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("write_buffer_operation_count")] - public long WriteBufferOperationCount { get; init; } - [JsonInclude, JsonPropertyName("write_buffer_size_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize WriteBufferSizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStats(long bytesRead, long failedReadRequests, long failedWriteRequests, long followerAliasesVersion, long followerGlobalCheckpoint, string followerIndex, long followerMappingVersion, long followerMaxSeqNo, long followerSettingsVersion, long lastRequestedSeqNo, long leaderGlobalCheckpoint, string leaderIndex, long leaderMaxSeqNo, long operationsRead, long operationsWritten, int outstandingReadRequests, int outstandingWriteRequests, System.Collections.Generic.IReadOnlyCollection readExceptions, string remoteCluster, int shardId, long successfulReadRequests, long successfulWriteRequests, System.TimeSpan timeSinceLastReadMillis, System.TimeSpan totalReadRemoteExecTimeMillis, System.TimeSpan totalReadTimeMillis, System.TimeSpan totalWriteTimeMillis, long writeBufferOperationCount, Elastic.Clients.Elasticsearch.ByteSize writeBufferSizeInBytes) + { + BytesRead = bytesRead; + FailedReadRequests = failedReadRequests; + FailedWriteRequests = failedWriteRequests; + FollowerAliasesVersion = followerAliasesVersion; + FollowerGlobalCheckpoint = followerGlobalCheckpoint; + FollowerIndex = followerIndex; + FollowerMappingVersion = followerMappingVersion; + FollowerMaxSeqNo = followerMaxSeqNo; + FollowerSettingsVersion = followerSettingsVersion; + LastRequestedSeqNo = lastRequestedSeqNo; + LeaderGlobalCheckpoint = leaderGlobalCheckpoint; + LeaderIndex = leaderIndex; + LeaderMaxSeqNo = leaderMaxSeqNo; + OperationsRead = operationsRead; + OperationsWritten = operationsWritten; + OutstandingReadRequests = outstandingReadRequests; + OutstandingWriteRequests = outstandingWriteRequests; + ReadExceptions = readExceptions; + RemoteCluster = remoteCluster; + ShardId = shardId; + SuccessfulReadRequests = successfulReadRequests; + SuccessfulWriteRequests = successfulWriteRequests; + TimeSinceLastReadMillis = timeSinceLastReadMillis; + TotalReadRemoteExecTimeMillis = totalReadRemoteExecTimeMillis; + TotalReadTimeMillis = totalReadTimeMillis; + TotalWriteTimeMillis = totalWriteTimeMillis; + WriteBufferOperationCount = writeBufferOperationCount; + WriteBufferSizeInBytes = writeBufferSizeInBytes; + } +#if NET7_0_OR_GREATER + public ShardStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The total of transferred bytes read from the leader. + /// This is only an estimate and does not account for compression if enabled. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long BytesRead { get; set; } + + /// + /// + /// The number of failed reads. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FailedReadRequests { get; set; } + + /// + /// + /// The number of failed bulk write requests on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FailedWriteRequests { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? FatalException { get; set; } + + /// + /// + /// The index aliases version the follower is synced up to. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FollowerAliasesVersion { get; set; } + + /// + /// + /// The current global checkpoint on the follower. + /// The difference between the leader_global_checkpoint and the follower_global_checkpoint is an indication of how much the follower is lagging the leader. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FollowerGlobalCheckpoint { get; set; } + + /// + /// + /// The name of the follower index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string FollowerIndex { get; set; } + + /// + /// + /// The mapping version the follower is synced up to. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FollowerMappingVersion { get; set; } + + /// + /// + /// The current maximum sequence number on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FollowerMaxSeqNo { get; set; } + + /// + /// + /// The index settings version the follower is synced up to. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long FollowerSettingsVersion { get; set; } + + /// + /// + /// The starting sequence number of the last batch of operations requested from the leader. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long LastRequestedSeqNo { get; set; } + + /// + /// + /// The current global checkpoint on the leader known to the follower task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long LeaderGlobalCheckpoint { get; set; } + + /// + /// + /// The name of the index in the leader cluster being followed. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string LeaderIndex { get; set; } + + /// + /// + /// The current maximum sequence number on the leader known to the follower task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long LeaderMaxSeqNo { get; set; } + + /// + /// + /// The total number of operations read from the leader. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long OperationsRead { get; set; } + + /// + /// + /// The number of operations written on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long OperationsWritten { get; set; } + + /// + /// + /// The number of active read requests from the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int OutstandingReadRequests { get; set; } + + /// + /// + /// The number of active bulk write requests on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int OutstandingWriteRequests { get; set; } + + /// + /// + /// An array of objects representing failed reads. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReadExceptions { get; set; } + + /// + /// + /// The remote cluster containing the leader index. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string RemoteCluster { get; set; } + + /// + /// + /// The numerical shard ID, with values from 0 to one less than the number of replicas. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int ShardId { get; set; } + + /// + /// + /// The number of successful fetches. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long SuccessfulReadRequests { get; set; } + + /// + /// + /// The number of bulk write requests run on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long SuccessfulWriteRequests { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TimeSinceLastRead { get; set; } + + /// + /// + /// The number of milliseconds since a read request was sent to the leader. + /// When the follower is caught up to the leader, this number will increase up to the configured read_poll_timeout at which point another read request will be sent to the leader. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeSinceLastReadMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalReadRemoteExecTime { get; set; } + + /// + /// + /// The total time reads spent running on the remote cluster. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalReadRemoteExecTimeMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalReadTime { get; set; } + + /// + /// + /// The total time reads were outstanding, measured from the time a read was sent to the leader to the time a reply was returned to the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalReadTimeMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalWriteTime { get; set; } + + /// + /// + /// The total time spent writing on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalWriteTimeMillis { get; set; } + + /// + /// + /// The number of write operations queued on the follower. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long WriteBufferOperationCount { get; set; } + + /// + /// + /// The total number of bytes of operations currently queued for writing. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize WriteBufferSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/DanglingIndices/DanglingIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DanglingIndices/DanglingIndex.g.cs index 5dc8b54516f..3ed6a6523b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/DanglingIndices/DanglingIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DanglingIndices/DanglingIndex.g.cs @@ -17,25 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.DanglingIndices; +internal sealed partial class DanglingIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreationDateMillis = System.Text.Json.JsonEncodedText.Encode("creation_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIndexName = System.Text.Json.JsonEncodedText.Encode("index_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndexUuid = System.Text.Json.JsonEncodedText.Encode("index_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropNodeIds = System.Text.Json.JsonEncodedText.Encode("node_ids"); + + public override Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreationDateMillis = default; + LocalJsonValue propIndexName = default; + LocalJsonValue propIndexUuid = default; + LocalJsonValue> propNodeIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreationDateMillis.TryReadProperty(ref reader, options, PropCreationDateMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIndexName.TryReadProperty(ref reader, options, PropIndexName, null)) + { + continue; + } + + if (propIndexUuid.TryReadProperty(ref reader, options, PropIndexUuid, null)) + { + continue; + } + + if (propNodeIds.TryReadProperty(ref reader, options, PropNodeIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CreationDateMillis = propCreationDateMillis.Value, + IndexName = propIndexName.Value, + IndexUuid = propIndexUuid.Value, + NodeIds = propNodeIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreationDateMillis, value.CreationDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIndexName, value.IndexName, null, null); + writer.WriteProperty(options, PropIndexUuid, value.IndexUuid, null, null); + writer.WriteProperty(options, PropNodeIds, value.NodeIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DanglingIndices.DanglingIndexConverter))] public sealed partial class DanglingIndex { - [JsonInclude, JsonPropertyName("creation_date_millis")] - public long CreationDateMillis { get; init; } - [JsonInclude, JsonPropertyName("index_name")] - public string IndexName { get; init; } - [JsonInclude, JsonPropertyName("index_uuid")] - public string IndexUuid { get; init; } - [JsonInclude, JsonPropertyName("node_ids")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection NodeIds { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DanglingIndex(System.DateTimeOffset creationDateMillis, string indexName, string indexUuid, System.Collections.Generic.ICollection nodeIds) + { + CreationDateMillis = creationDateMillis; + IndexName = indexName; + IndexUuid = indexUuid; + NodeIds = nodeIds; + } +#if NET7_0_OR_GREATER + public DanglingIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DanglingIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DanglingIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset CreationDateMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexUuid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection NodeIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/DocStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DocStats.g.cs index 02fb98ac034..69757020c5d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/DocStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/DocStats.g.cs @@ -17,26 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class DocStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + + public override Elastic.Clients.Elasticsearch.DocStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propDeleted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDeleted.TryReadProperty(ref reader, options, PropDeleted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.DocStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Deleted = propDeleted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DocStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDeleted, value.Deleted, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DocStatsConverter))] public sealed partial class DocStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocStats(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public DocStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DocStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DocStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of non-deleted documents across all primary shards assigned to selected nodes. /// This number is based on documents in Lucene segments and may include documents from nested fields. /// /// - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// @@ -45,6 +115,5 @@ public sealed partial class DocStats /// Elasticsearch reclaims the disk space of deleted Lucene documents when a segment is merged. /// /// - [JsonInclude, JsonPropertyName("deleted")] - public long? Deleted { get; init; } + public long? Deleted { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionInfo.g.cs index 5d9a9a38b09..e7c8ad7694b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionInfo.g.cs @@ -17,49 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ElasticsearchVersionInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuildDate = System.Text.Json.JsonEncodedText.Encode("build_date"); + private static readonly System.Text.Json.JsonEncodedText PropBuildFlavor = System.Text.Json.JsonEncodedText.Encode("build_flavor"); + private static readonly System.Text.Json.JsonEncodedText PropBuildHash = System.Text.Json.JsonEncodedText.Encode("build_hash"); + private static readonly System.Text.Json.JsonEncodedText PropBuildSnapshot = System.Text.Json.JsonEncodedText.Encode("build_snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropBuildType = System.Text.Json.JsonEncodedText.Encode("build_type"); + private static readonly System.Text.Json.JsonEncodedText PropLuceneVersion = System.Text.Json.JsonEncodedText.Encode("lucene_version"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumIndexCompatibilityVersion = System.Text.Json.JsonEncodedText.Encode("minimum_index_compatibility_version"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumWireCompatibilityVersion = System.Text.Json.JsonEncodedText.Encode("minimum_wire_compatibility_version"); + private static readonly System.Text.Json.JsonEncodedText PropNumber = System.Text.Json.JsonEncodedText.Encode("number"); + + public override Elastic.Clients.Elasticsearch.ElasticsearchVersionInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuildDate = default; + LocalJsonValue propBuildFlavor = default; + LocalJsonValue propBuildHash = default; + LocalJsonValue propBuildSnapshot = default; + LocalJsonValue propBuildType = default; + LocalJsonValue propLuceneVersion = default; + LocalJsonValue propMinimumIndexCompatibilityVersion = default; + LocalJsonValue propMinimumWireCompatibilityVersion = default; + LocalJsonValue propNumber = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuildDate.TryReadProperty(ref reader, options, PropBuildDate, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propBuildFlavor.TryReadProperty(ref reader, options, PropBuildFlavor, null)) + { + continue; + } + + if (propBuildHash.TryReadProperty(ref reader, options, PropBuildHash, null)) + { + continue; + } + + if (propBuildSnapshot.TryReadProperty(ref reader, options, PropBuildSnapshot, null)) + { + continue; + } + + if (propBuildType.TryReadProperty(ref reader, options, PropBuildType, null)) + { + continue; + } + + if (propLuceneVersion.TryReadProperty(ref reader, options, PropLuceneVersion, null)) + { + continue; + } + + if (propMinimumIndexCompatibilityVersion.TryReadProperty(ref reader, options, PropMinimumIndexCompatibilityVersion, null)) + { + continue; + } + + if (propMinimumWireCompatibilityVersion.TryReadProperty(ref reader, options, PropMinimumWireCompatibilityVersion, null)) + { + continue; + } + + if (propNumber.TryReadProperty(ref reader, options, PropNumber, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ElasticsearchVersionInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BuildDate = propBuildDate.Value, + BuildFlavor = propBuildFlavor.Value, + BuildHash = propBuildHash.Value, + BuildSnapshot = propBuildSnapshot.Value, + BuildType = propBuildType.Value, + LuceneVersion = propLuceneVersion.Value, + MinimumIndexCompatibilityVersion = propMinimumIndexCompatibilityVersion.Value, + MinimumWireCompatibilityVersion = propMinimumWireCompatibilityVersion.Value, + Number = propNumber.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ElasticsearchVersionInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuildDate, value.BuildDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropBuildFlavor, value.BuildFlavor, null, null); + writer.WriteProperty(options, PropBuildHash, value.BuildHash, null, null); + writer.WriteProperty(options, PropBuildSnapshot, value.BuildSnapshot, null, null); + writer.WriteProperty(options, PropBuildType, value.BuildType, null, null); + writer.WriteProperty(options, PropLuceneVersion, value.LuceneVersion, null, null); + writer.WriteProperty(options, PropMinimumIndexCompatibilityVersion, value.MinimumIndexCompatibilityVersion, null, null); + writer.WriteProperty(options, PropMinimumWireCompatibilityVersion, value.MinimumWireCompatibilityVersion, null, null); + writer.WriteProperty(options, PropNumber, value.Number, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ElasticsearchVersionInfoConverter))] public sealed partial class ElasticsearchVersionInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchVersionInfo(System.DateTimeOffset buildDate, string buildFlavor, string buildHash, bool buildSnapshot, string buildType, string luceneVersion, string minimumIndexCompatibilityVersion, string minimumWireCompatibilityVersion, string number) + { + BuildDate = buildDate; + BuildFlavor = buildFlavor; + BuildHash = buildHash; + BuildSnapshot = buildSnapshot; + BuildType = buildType; + LuceneVersion = luceneVersion; + MinimumIndexCompatibilityVersion = minimumIndexCompatibilityVersion; + MinimumWireCompatibilityVersion = minimumWireCompatibilityVersion; + Number = number; + } +#if NET7_0_OR_GREATER + public ElasticsearchVersionInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ElasticsearchVersionInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElasticsearchVersionInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The Elasticsearch Git commit's date. /// /// - [JsonInclude, JsonPropertyName("build_date")] - public DateTimeOffset BuildDate { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset BuildDate { get; set; } /// /// /// The build flavor. For example, default. /// /// - [JsonInclude, JsonPropertyName("build_flavor")] - public string BuildFlavor { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildFlavor { get; set; } /// /// /// The Elasticsearch Git commit's SHA hash. /// /// - [JsonInclude, JsonPropertyName("build_hash")] - public string BuildHash { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildHash { get; set; } /// /// /// Indicates whether the Elasticsearch build was a snapshot. /// /// - [JsonInclude, JsonPropertyName("build_snapshot")] - public bool BuildSnapshot { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool BuildSnapshot { get; set; } /// /// @@ -67,24 +217,33 @@ public sealed partial class ElasticsearchVersionInfo /// For example, docker, rpm, or tar. /// /// - [JsonInclude, JsonPropertyName("build_type")] - public string BuildType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildType { get; set; } /// /// /// The version number of Elasticsearch's underlying Lucene software. /// /// - [JsonInclude, JsonPropertyName("lucene_version")] - public string LuceneVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string LuceneVersion { get; set; } /// /// /// The minimum index version with which the responding node can read from disk. /// /// - [JsonInclude, JsonPropertyName("minimum_index_compatibility_version")] - public string MinimumIndexCompatibilityVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string MinimumIndexCompatibilityVersion { get; set; } /// /// @@ -92,14 +251,20 @@ public sealed partial class ElasticsearchVersionInfo /// Also the minimum version from which you can perform a rolling upgrade. /// /// - [JsonInclude, JsonPropertyName("minimum_wire_compatibility_version")] - public string MinimumWireCompatibilityVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string MinimumWireCompatibilityVersion { get; set; } /// /// /// The Elasticsearch version number. /// /// - [JsonInclude, JsonPropertyName("number")] - public string Number { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Number { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionMinInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionMinInfo.g.cs index d81337ce137..d820a3ab25c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionMinInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ElasticsearchVersionMinInfo.g.cs @@ -17,29 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ElasticsearchVersionMinInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuildFlavor = System.Text.Json.JsonEncodedText.Encode("build_flavor"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumIndexCompatibilityVersion = System.Text.Json.JsonEncodedText.Encode("minimum_index_compatibility_version"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumWireCompatibilityVersion = System.Text.Json.JsonEncodedText.Encode("minimum_wire_compatibility_version"); + private static readonly System.Text.Json.JsonEncodedText PropNumber = System.Text.Json.JsonEncodedText.Encode("number"); + + public override Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuildFlavor = default; + LocalJsonValue propMinimumIndexCompatibilityVersion = default; + LocalJsonValue propMinimumWireCompatibilityVersion = default; + LocalJsonValue propNumber = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuildFlavor.TryReadProperty(ref reader, options, PropBuildFlavor, null)) + { + continue; + } + + if (propMinimumIndexCompatibilityVersion.TryReadProperty(ref reader, options, PropMinimumIndexCompatibilityVersion, null)) + { + continue; + } + + if (propMinimumWireCompatibilityVersion.TryReadProperty(ref reader, options, PropMinimumWireCompatibilityVersion, null)) + { + continue; + } + + if (propNumber.TryReadProperty(ref reader, options, PropNumber, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BuildFlavor = propBuildFlavor.Value, + MinimumIndexCompatibilityVersion = propMinimumIndexCompatibilityVersion.Value, + MinimumWireCompatibilityVersion = propMinimumWireCompatibilityVersion.Value, + Number = propNumber.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuildFlavor, value.BuildFlavor, null, null); + writer.WriteProperty(options, PropMinimumIndexCompatibilityVersion, value.MinimumIndexCompatibilityVersion, null, null); + writer.WriteProperty(options, PropMinimumWireCompatibilityVersion, value.MinimumWireCompatibilityVersion, null, null); + writer.WriteProperty(options, PropNumber, value.Number, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Reduced (minimal) info ElasticsearchVersion /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfoConverter))] public sealed partial class ElasticsearchVersionMinInfo { - [JsonInclude, JsonPropertyName("build_flavor")] - public string BuildFlavor { get; init; } - [JsonInclude, JsonPropertyName("minimum_index_compatibility_version")] - public string MinimumIndexCompatibilityVersion { get; init; } - [JsonInclude, JsonPropertyName("minimum_wire_compatibility_version")] - public string MinimumWireCompatibilityVersion { get; init; } - [JsonInclude, JsonPropertyName("number")] - public string Number { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchVersionMinInfo(string buildFlavor, string minimumIndexCompatibilityVersion, string minimumWireCompatibilityVersion, string number) + { + BuildFlavor = buildFlavor; + MinimumIndexCompatibilityVersion = minimumIndexCompatibilityVersion; + MinimumWireCompatibilityVersion = minimumWireCompatibilityVersion; + Number = number; + } +#if NET7_0_OR_GREATER + public ElasticsearchVersionMinInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ElasticsearchVersionMinInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElasticsearchVersionMinInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string BuildFlavor { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string MinimumIndexCompatibilityVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string MinimumWireCompatibilityVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Number { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs index d31eb58444e..6ad06f31a55 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/EmptyObject.g.cs @@ -17,23 +17,64 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class EmptyObjectConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.EmptyObject Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.EmptyObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.EmptyObject value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + /// /// /// For empty Class assignments /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.EmptyObjectConverter))] public sealed partial class EmptyObject { +#if NET7_0_OR_GREATER + public EmptyObject() + { + } +#endif +#if !NET7_0_OR_GREATER + public EmptyObject() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EmptyObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } /// @@ -41,17 +82,35 @@ public sealed partial class EmptyObject /// For empty Class assignments /// /// -public sealed partial class EmptyObjectDescriptor : SerializableDescriptor +public readonly partial struct EmptyObjectDescriptor { - internal EmptyObjectDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.EmptyObject Instance { get; init; } - public EmptyObjectDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EmptyObjectDescriptor(Elastic.Clients.Elasticsearch.EmptyObject instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EmptyObjectDescriptor() { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.EmptyObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(Elastic.Clients.Elasticsearch.EmptyObject instance) => new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.EmptyObject(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.EmptyObject Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.EmptyObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(new Elastic.Clients.Elasticsearch.EmptyObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CacheStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CacheStats.g.cs index b884acb0e98..18a9eb2a3c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CacheStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CacheStats.g.cs @@ -17,32 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class CacheStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropHits = System.Text.Json.JsonEncodedText.Encode("hits"); + private static readonly System.Text.Json.JsonEncodedText PropHitsTimeInMillis = System.Text.Json.JsonEncodedText.Encode("hits_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropMisses = System.Text.Json.JsonEncodedText.Encode("misses"); + private static readonly System.Text.Json.JsonEncodedText PropMissesTimeInMillis = System.Text.Json.JsonEncodedText.Encode("misses_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Enrich.CacheStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propEvictions = default; + LocalJsonValue propHits = default; + LocalJsonValue propHitsTimeInMillis = default; + LocalJsonValue propMisses = default; + LocalJsonValue propMissesTimeInMillis = default; + LocalJsonValue propNodeId = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propHits.TryReadProperty(ref reader, options, PropHits, null)) + { + continue; + } + + if (propHitsTimeInMillis.TryReadProperty(ref reader, options, PropHitsTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propMisses.TryReadProperty(ref reader, options, PropMisses, null)) + { + continue; + } + + if (propMissesTimeInMillis.TryReadProperty(ref reader, options, PropMissesTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.CacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Evictions = propEvictions.Value, + Hits = propHits.Value, + HitsTimeInMillis = propHitsTimeInMillis.Value, + Misses = propMisses.Value, + MissesTimeInMillis = propMissesTimeInMillis.Value, + NodeId = propNodeId.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.CacheStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropHits, value.Hits, null, null); + writer.WriteProperty(options, PropHitsTimeInMillis, value.HitsTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropMisses, value.Misses, null, null); + writer.WriteProperty(options, PropMissesTimeInMillis, value.MissesTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.CacheStatsConverter))] public sealed partial class CacheStats { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("evictions")] - public int Evictions { get; init; } - [JsonInclude, JsonPropertyName("hits")] - public int Hits { get; init; } - [JsonInclude, JsonPropertyName("hits_time_in_millis")] - public long HitsTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("misses")] - public int Misses { get; init; } - [JsonInclude, JsonPropertyName("misses_time_in_millis")] - public long MissesTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheStats(int count, int evictions, int hits, System.TimeSpan hitsTimeInMillis, int misses, System.TimeSpan missesTimeInMillis, string nodeId, long sizeInBytes) + { + Count = count; + Evictions = evictions; + Hits = hits; + HitsTimeInMillis = hitsTimeInMillis; + Misses = misses; + MissesTimeInMillis = missesTimeInMillis; + NodeId = nodeId; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public CacheStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CacheStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Evictions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Hits { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan HitsTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Misses { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan MissesTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CoordinatorStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CoordinatorStats.g.cs index 9c6e33adc5a..b7c29c0aaaa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CoordinatorStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/CoordinatorStats.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class CoordinatorStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExecutedSearchesTotal = System.Text.Json.JsonEncodedText.Encode("executed_searches_total"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropQueueSize = System.Text.Json.JsonEncodedText.Encode("queue_size"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteRequestsCurrent = System.Text.Json.JsonEncodedText.Encode("remote_requests_current"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteRequestsTotal = System.Text.Json.JsonEncodedText.Encode("remote_requests_total"); + + public override Elastic.Clients.Elasticsearch.Enrich.CoordinatorStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExecutedSearchesTotal = default; + LocalJsonValue propNodeId = default; + LocalJsonValue propQueueSize = default; + LocalJsonValue propRemoteRequestsCurrent = default; + LocalJsonValue propRemoteRequestsTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExecutedSearchesTotal.TryReadProperty(ref reader, options, PropExecutedSearchesTotal, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propQueueSize.TryReadProperty(ref reader, options, PropQueueSize, null)) + { + continue; + } + + if (propRemoteRequestsCurrent.TryReadProperty(ref reader, options, PropRemoteRequestsCurrent, null)) + { + continue; + } + + if (propRemoteRequestsTotal.TryReadProperty(ref reader, options, PropRemoteRequestsTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.CoordinatorStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExecutedSearchesTotal = propExecutedSearchesTotal.Value, + NodeId = propNodeId.Value, + QueueSize = propQueueSize.Value, + RemoteRequestsCurrent = propRemoteRequestsCurrent.Value, + RemoteRequestsTotal = propRemoteRequestsTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.CoordinatorStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExecutedSearchesTotal, value.ExecutedSearchesTotal, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropQueueSize, value.QueueSize, null, null); + writer.WriteProperty(options, PropRemoteRequestsCurrent, value.RemoteRequestsCurrent, null, null); + writer.WriteProperty(options, PropRemoteRequestsTotal, value.RemoteRequestsTotal, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.CoordinatorStatsConverter))] public sealed partial class CoordinatorStats { - [JsonInclude, JsonPropertyName("executed_searches_total")] - public long ExecutedSearchesTotal { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("queue_size")] - public int QueueSize { get; init; } - [JsonInclude, JsonPropertyName("remote_requests_current")] - public int RemoteRequestsCurrent { get; init; } - [JsonInclude, JsonPropertyName("remote_requests_total")] - public long RemoteRequestsTotal { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CoordinatorStats(long executedSearchesTotal, string nodeId, int queueSize, int remoteRequestsCurrent, long remoteRequestsTotal) + { + ExecutedSearchesTotal = executedSearchesTotal; + NodeId = nodeId; + QueueSize = queueSize; + RemoteRequestsCurrent = remoteRequestsCurrent; + RemoteRequestsTotal = remoteRequestsTotal; + } +#if NET7_0_OR_GREATER + public CoordinatorStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CoordinatorStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CoordinatorStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long ExecutedSearchesTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int QueueSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RemoteRequestsCurrent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RemoteRequestsTotal { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichPolicy.g.cs index fc7a0cf8953..ad51d8e4fe3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichPolicy.g.cs @@ -17,277 +17,309 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class EnrichPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropElasticsearchVersion = System.Text.Json.JsonEncodedText.Encode("elasticsearch_version"); + private static readonly System.Text.Json.JsonEncodedText PropEnrichFields = System.Text.Json.JsonEncodedText.Encode("enrich_fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMatchField = System.Text.Json.JsonEncodedText.Encode("match_field"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propElasticsearchVersion = default; + LocalJsonValue propEnrichFields = default; + LocalJsonValue propIndices = default; + LocalJsonValue propMatchField = default; + LocalJsonValue propName = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propElasticsearchVersion.TryReadProperty(ref reader, options, PropElasticsearchVersion, null)) + { + continue; + } + + if (propEnrichFields.TryReadProperty(ref reader, options, PropEnrichFields, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMatchField.TryReadProperty(ref reader, options, PropMatchField, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ElasticsearchVersion = propElasticsearchVersion.Value, + EnrichFields = propEnrichFields.Value, + Indices = propIndices.Value, + MatchField = propMatchField.Value, + Name = propName.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropElasticsearchVersion, value.ElasticsearchVersion, null, null); + writer.WriteProperty(options, PropEnrichFields, value.EnrichFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMatchField, value.MatchField, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyConverter))] public sealed partial class EnrichPolicy { - [JsonInclude, JsonPropertyName("elasticsearch_version")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichPolicy(Elastic.Clients.Elasticsearch.Fields enrichFields, Elastic.Clients.Elasticsearch.Indices indices, Elastic.Clients.Elasticsearch.Field matchField) + { + EnrichFields = enrichFields; + Indices = indices; + MatchField = matchField; + } +#if NET7_0_OR_GREATER + public EnrichPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EnrichPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? ElasticsearchVersion { get; set; } - [JsonInclude, JsonPropertyName("enrich_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields EnrichFields { get; set; } - [JsonInclude, JsonPropertyName("indices")] - public Elastic.Clients.Elasticsearch.Indices Indices { get; set; } - [JsonInclude, JsonPropertyName("match_field")] - public Elastic.Clients.Elasticsearch.Field MatchField { get; set; } - [JsonInclude, JsonPropertyName("name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields EnrichFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field MatchField { get; set; } public Elastic.Clients.Elasticsearch.Name? Name { get; set; } - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } } -public sealed partial class EnrichPolicyDescriptor : SerializableDescriptor> +public readonly partial struct EnrichPolicyDescriptor { - internal EnrichPolicyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy Instance { get; init; } - public EnrichPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichPolicyDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy instance) { + Instance = instance; } - private string? ElasticsearchVersionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields EnrichFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field MatchFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - - public EnrichPolicyDescriptor ElasticsearchVersion(string? elasticsearchVersion) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichPolicyDescriptor() { - ElasticsearchVersionValue = elasticsearchVersion; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public EnrichPolicyDescriptor EnrichFields(Elastic.Clients.Elasticsearch.Fields enrichFields) + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy instance) => new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor ElasticsearchVersion(string? value) { - EnrichFieldsValue = enrichFields; - return Self; + Instance.ElasticsearchVersion = value; + return this; } - public EnrichPolicyDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor EnrichFields(Elastic.Clients.Elasticsearch.Fields value) { - IndicesValue = indices; - return Self; + Instance.EnrichFields = value; + return this; } - public EnrichPolicyDescriptor MatchField(Elastic.Clients.Elasticsearch.Field matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor EnrichFields(params System.Linq.Expressions.Expression>[] value) { - MatchFieldValue = matchField; - return Self; + Instance.EnrichFields = value; + return this; } - public EnrichPolicyDescriptor MatchField(Expression> matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - MatchFieldValue = matchField; - return Self; + Instance.Indices = value; + return this; } - public EnrichPolicyDescriptor MatchField(Expression> matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchField(Elastic.Clients.Elasticsearch.Field value) { - MatchFieldValue = matchField; - return Self; + Instance.MatchField = value; + return this; } - public EnrichPolicyDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchField(System.Linq.Expressions.Expression> value) { - NameValue = name; - return Self; + Instance.MatchField = value; + return this; } - public EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Name = value; + return this; } - public EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public EnrichPolicyDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ElasticsearchVersionValue)) - { - writer.WritePropertyName("elasticsearch_version"); - writer.WriteStringValue(ElasticsearchVersionValue); - } - - writer.WritePropertyName("enrich_fields"); - JsonSerializer.Serialize(writer, EnrichFieldsValue, options); - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - writer.WritePropertyName("match_field"); - JsonSerializer.Serialize(writer, MatchFieldValue, options); - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class EnrichPolicyDescriptor : SerializableDescriptor +public readonly partial struct EnrichPolicyDescriptor { - internal EnrichPolicyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy Instance { get; init; } - public EnrichPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichPolicyDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy instance) { + Instance = instance; } - private string? ElasticsearchVersionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields EnrichFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field MatchFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - - public EnrichPolicyDescriptor ElasticsearchVersion(string? elasticsearchVersion) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichPolicyDescriptor() { - ElasticsearchVersionValue = elasticsearchVersion; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public EnrichPolicyDescriptor EnrichFields(Elastic.Clients.Elasticsearch.Fields enrichFields) + public static explicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy instance) => new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor ElasticsearchVersion(string? value) { - EnrichFieldsValue = enrichFields; - return Self; + Instance.ElasticsearchVersion = value; + return this; } - public EnrichPolicyDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor EnrichFields(Elastic.Clients.Elasticsearch.Fields value) { - IndicesValue = indices; - return Self; + Instance.EnrichFields = value; + return this; } - public EnrichPolicyDescriptor MatchField(Elastic.Clients.Elasticsearch.Field matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor EnrichFields(params System.Linq.Expressions.Expression>[] value) { - MatchFieldValue = matchField; - return Self; + Instance.EnrichFields = value; + return this; } - public EnrichPolicyDescriptor MatchField(Expression> matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - MatchFieldValue = matchField; - return Self; + Instance.Indices = value; + return this; } - public EnrichPolicyDescriptor MatchField(Expression> matchField) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchField(Elastic.Clients.Elasticsearch.Field value) { - MatchFieldValue = matchField; - return Self; + Instance.MatchField = value; + return this; } - public EnrichPolicyDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor MatchField(System.Linq.Expressions.Expression> value) { - NameValue = name; - return Self; + Instance.MatchField = value; + return this; } - public EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Name = value; + return this; } - public EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public EnrichPolicyDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor Query(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ElasticsearchVersionValue)) - { - writer.WritePropertyName("elasticsearch_version"); - writer.WriteStringValue(ElasticsearchVersionValue); - } - - writer.WritePropertyName("enrich_fields"); - JsonSerializer.Serialize(writer, EnrichFieldsValue, options); - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - writer.WritePropertyName("match_field"); - JsonSerializer.Serialize(writer, MatchFieldValue, options); - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyDescriptor(new Elastic.Clients.Elasticsearch.Enrich.EnrichPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichSummary.g.cs index 9298d4e11d3..f7526b75bb6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/EnrichSummary.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class EnrichSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + + public override Elastic.Clients.Elasticsearch.Enrich.EnrichSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propConfig = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfig.TryReadProperty(ref reader, options, PropConfig, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.EnrichSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Config = propConfig.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfig, value.Config, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.EnrichSummaryConverter))] public sealed partial class EnrichSummary { - [JsonInclude, JsonPropertyName("config")] - public KeyValuePair Config { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichSummary(System.Collections.Generic.KeyValuePair config) + { + Config = config; + } +#if NET7_0_OR_GREATER + public EnrichSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EnrichSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrichSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.KeyValuePair Config { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecuteEnrichPolicyStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecuteEnrichPolicyStatus.g.cs index b4e3ea5b141..427fbc157ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecuteEnrichPolicyStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecuteEnrichPolicyStatus.g.cs @@ -17,18 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class ExecuteEnrichPolicyStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPhase = System.Text.Json.JsonEncodedText.Encode("phase"); + private static readonly System.Text.Json.JsonEncodedText PropStep = System.Text.Json.JsonEncodedText.Encode("step"); + + public override Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPhase = default; + LocalJsonValue propStep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPhase.TryReadProperty(ref reader, options, PropPhase, null)) + { + continue; + } + + if (propStep.TryReadProperty(ref reader, options, PropStep, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Phase = propPhase.Value, + Step = propStep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPhase, value.Phase, null, null); + writer.WriteProperty(options, PropStep, value.Step, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.ExecuteEnrichPolicyStatusConverter))] public sealed partial class ExecuteEnrichPolicyStatus { - [JsonInclude, JsonPropertyName("phase")] - public Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase Phase { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecuteEnrichPolicyStatus(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase phase) + { + Phase = phase; + } +#if NET7_0_OR_GREATER + public ExecuteEnrichPolicyStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExecuteEnrichPolicyStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecuteEnrichPolicyStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase Phase { get; set; } + public string? Step { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecutingPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecutingPolicy.g.cs index 9351cc69b64..1bbf4777cd2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecutingPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enrich/ExecutingPolicy.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; +internal sealed partial class ExecutingPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + + public override Elastic.Clients.Elasticsearch.Enrich.ExecutingPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propTask = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Enrich.ExecutingPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Task = propTask.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.ExecutingPolicy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.ExecutingPolicyConverter))] public sealed partial class ExecutingPolicy { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("task")] - public Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExecutingPolicy(string name, Elastic.Clients.Elasticsearch.Tasks.TaskInfo task) + { + Name = name; + Task = task; + } +#if NET7_0_OR_GREATER + public ExecutingPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExecutingPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExecutingPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs index bb501a37b36..80a740dcae5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Aggregations.g.cs @@ -17,864 +17,1426 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Aggregations; -[JsonConverter(typeof(CalendarIntervalConverter))] -public enum CalendarInterval +internal sealed partial class CardinalityExecutionModeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "year")] - Year, - [EnumMember(Value = "week")] - Week, - [EnumMember(Value = "second")] - Second, - [EnumMember(Value = "quarter")] - Quarter, - [EnumMember(Value = "month")] - Month, - [EnumMember(Value = "minute")] - Minute, - [EnumMember(Value = "hour")] - Hour, - [EnumMember(Value = "day")] - Day + private static readonly System.Text.Json.JsonEncodedText MemberDirect = System.Text.Json.JsonEncodedText.Encode("direct"); + private static readonly System.Text.Json.JsonEncodedText MemberGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText MemberSaveMemoryHeuristic = System.Text.Json.JsonEncodedText.Encode("save_memory_heuristic"); + private static readonly System.Text.Json.JsonEncodedText MemberSaveTimeHeuristic = System.Text.Json.JsonEncodedText.Encode("save_time_heuristic"); + private static readonly System.Text.Json.JsonEncodedText MemberSegmentOrdinals = System.Text.Json.JsonEncodedText.Encode("segment_ordinals"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDirect)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.Direct; + } + + if (reader.ValueTextEquals(MemberGlobalOrdinals)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.GlobalOrdinals; + } + + if (reader.ValueTextEquals(MemberSaveMemoryHeuristic)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveMemoryHeuristic; + } + + if (reader.ValueTextEquals(MemberSaveTimeHeuristic)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveTimeHeuristic; + } + + if (reader.ValueTextEquals(MemberSegmentOrdinals)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SegmentOrdinals; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDirect.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.Direct; + } + + if (string.Equals(value, MemberGlobalOrdinals.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.GlobalOrdinals; + } + + if (string.Equals(value, MemberSaveMemoryHeuristic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveMemoryHeuristic; + } + + if (string.Equals(value, MemberSaveTimeHeuristic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveTimeHeuristic; + } + + if (string.Equals(value, MemberSegmentOrdinals.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SegmentOrdinals; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.Direct: + writer.WriteStringValue(MemberDirect); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.GlobalOrdinals: + writer.WriteStringValue(MemberGlobalOrdinals); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveMemoryHeuristic: + writer.WriteStringValue(MemberSaveMemoryHeuristic); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SaveTimeHeuristic: + writer.WriteStringValue(MemberSaveTimeHeuristic); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode.SegmentOrdinals: + writer.WriteStringValue(MemberSegmentOrdinals); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class CalendarIntervalConverter : JsonConverter +internal sealed partial class TermsAggregationCollectModeConverter : System.Text.Json.Serialization.JsonConverter { - public override CalendarInterval Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "year": - case "1y": - return CalendarInterval.Year; - case "week": - case "1w": - return CalendarInterval.Week; - case "second": - case "1s": - return CalendarInterval.Second; - case "quarter": - case "1q": - return CalendarInterval.Quarter; - case "month": - case "1M": - return CalendarInterval.Month; - case "minute": - case "1m": - return CalendarInterval.Minute; - case "hour": - case "1h": - return CalendarInterval.Hour; - case "day": - case "1d": - return CalendarInterval.Day; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, CalendarInterval value, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberBreadthFirst = System.Text.Json.JsonEncodedText.Encode("breadth_first"); + private static readonly System.Text.Json.JsonEncodedText MemberDepthFirst = System.Text.Json.JsonEncodedText.Encode("depth_first"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBreadthFirst)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.BreadthFirst; + } + + if (reader.ValueTextEquals(MemberDepthFirst)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.DepthFirst; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBreadthFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.BreadthFirst; + } + + if (string.Equals(value, MemberDepthFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.DepthFirst; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case CalendarInterval.Year: - writer.WriteStringValue("year"); - return; - case CalendarInterval.Week: - writer.WriteStringValue("week"); - return; - case CalendarInterval.Second: - writer.WriteStringValue("second"); - return; - case CalendarInterval.Quarter: - writer.WriteStringValue("quarter"); - return; - case CalendarInterval.Month: - writer.WriteStringValue("month"); - return; - case CalendarInterval.Minute: - writer.WriteStringValue("minute"); - return; - case CalendarInterval.Hour: - writer.WriteStringValue("hour"); - return; - case CalendarInterval.Day: - writer.WriteStringValue("day"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.BreadthFirst: + writer.WriteStringValue(MemberBreadthFirst); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode.DepthFirst: + writer.WriteStringValue(MemberDepthFirst); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(CardinalityExecutionModeConverter))] -public enum CardinalityExecutionMode +internal sealed partial class TermsAggregationExecutionHintConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Run the aggregation by using segment ordinal values and resolving those values after each segment. - /// - /// - [EnumMember(Value = "segment_ordinals")] - SegmentOrdinals, - /// - /// - /// Heuristic-based mode, default in Elasticsearch 8.4 and later. - /// - /// - [EnumMember(Value = "save_time_heuristic")] - SaveTimeHeuristic, - /// - /// - /// Heuristic-based mode, default in Elasticsearch 8.3 and earlier. - /// - /// - [EnumMember(Value = "save_memory_heuristic")] - SaveMemoryHeuristic, - /// - /// - /// Run the aggregation by using global ordinals of the field and resolving those values after finishing a shard. - /// - /// - [EnumMember(Value = "global_ordinals")] - GlobalOrdinals, - /// - /// - /// Run the aggregation by using field values directly. - /// - /// - [EnumMember(Value = "direct")] - Direct + private static readonly System.Text.Json.JsonEncodedText MemberGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText MemberGlobalOrdinalsHash = System.Text.Json.JsonEncodedText.Encode("global_ordinals_hash"); + private static readonly System.Text.Json.JsonEncodedText MemberGlobalOrdinalsLowCardinality = System.Text.Json.JsonEncodedText.Encode("global_ordinals_low_cardinality"); + private static readonly System.Text.Json.JsonEncodedText MemberMap = System.Text.Json.JsonEncodedText.Encode("map"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberGlobalOrdinals)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinals; + } + + if (reader.ValueTextEquals(MemberGlobalOrdinalsHash)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsHash; + } + + if (reader.ValueTextEquals(MemberGlobalOrdinalsLowCardinality)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsLowCardinality; + } + + if (reader.ValueTextEquals(MemberMap)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.Map; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGlobalOrdinals.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinals; + } + + if (string.Equals(value, MemberGlobalOrdinalsHash.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsHash; + } + + if (string.Equals(value, MemberGlobalOrdinalsLowCardinality.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsLowCardinality; + } + + if (string.Equals(value, MemberMap.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.Map; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinals: + writer.WriteStringValue(MemberGlobalOrdinals); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsHash: + writer.WriteStringValue(MemberGlobalOrdinalsHash); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.GlobalOrdinalsLowCardinality: + writer.WriteStringValue(MemberGlobalOrdinalsLowCardinality); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint.Map: + writer.WriteStringValue(MemberMap); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHint value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class CardinalityExecutionModeConverter : JsonConverter +internal sealed partial class MissingOrderConverter : System.Text.Json.Serialization.JsonConverter { - public override CardinalityExecutionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDefault = System.Text.Json.JsonEncodedText.Encode("default"); + private static readonly System.Text.Json.JsonEncodedText MemberFirst = System.Text.Json.JsonEncodedText.Encode("first"); + private static readonly System.Text.Json.JsonEncodedText MemberLast = System.Text.Json.JsonEncodedText.Encode("last"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MissingOrder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDefault)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Default; + } + + if (reader.ValueTextEquals(MemberFirst)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.First; + } + + if (reader.ValueTextEquals(MemberLast)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Last; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDefault.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Default; + } + + if (string.Equals(value, MemberFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.First; + } + + if (string.Equals(value, MemberLast.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "segment_ordinals": - return CardinalityExecutionMode.SegmentOrdinals; - case "save_time_heuristic": - return CardinalityExecutionMode.SaveTimeHeuristic; - case "save_memory_heuristic": - return CardinalityExecutionMode.SaveMemoryHeuristic; - case "global_ordinals": - return CardinalityExecutionMode.GlobalOrdinals; - case "direct": - return CardinalityExecutionMode.Direct; + return Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Last; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder)}'."); } - public override void Write(Utf8JsonWriter writer, CardinalityExecutionMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MissingOrder value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case CardinalityExecutionMode.SegmentOrdinals: - writer.WriteStringValue("segment_ordinals"); - return; - case CardinalityExecutionMode.SaveTimeHeuristic: - writer.WriteStringValue("save_time_heuristic"); - return; - case CardinalityExecutionMode.SaveMemoryHeuristic: - writer.WriteStringValue("save_memory_heuristic"); - return; - case CardinalityExecutionMode.GlobalOrdinals: - writer.WriteStringValue("global_ordinals"); - return; - case CardinalityExecutionMode.Direct: - writer.WriteStringValue("direct"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Default: + writer.WriteStringValue(MemberDefault); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.First: + writer.WriteStringValue(MemberFirst); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MissingOrder.Last: + writer.WriteStringValue(MemberLast); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.MissingOrder)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.MissingOrder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MissingOrder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(GapPolicyConverter))] -public enum GapPolicy +internal sealed partial class MinimumIntervalConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Treats missing data as if the bucket does not exist. It will skip the bucket and - /// continue calculating using the next available value. - /// - /// - [EnumMember(Value = "skip")] - Skip, - /// - /// - /// Similar to skip, except if the metric provides a non-null, non-NaN value this value is used, - /// otherwise the empty bucket is skipped. - /// - /// - [EnumMember(Value = "keep_values")] - KeepValues, - /// - /// - /// Replace missing values with a zero (0) and pipeline aggregation computation will proceed as normal. - /// - /// - [EnumMember(Value = "insert_zeros")] - InsertZeros + private static readonly System.Text.Json.JsonEncodedText MemberDay = System.Text.Json.JsonEncodedText.Encode("day"); + private static readonly System.Text.Json.JsonEncodedText MemberHour = System.Text.Json.JsonEncodedText.Encode("hour"); + private static readonly System.Text.Json.JsonEncodedText MemberMinute = System.Text.Json.JsonEncodedText.Encode("minute"); + private static readonly System.Text.Json.JsonEncodedText MemberMonth = System.Text.Json.JsonEncodedText.Encode("month"); + private static readonly System.Text.Json.JsonEncodedText MemberSecond = System.Text.Json.JsonEncodedText.Encode("second"); + private static readonly System.Text.Json.JsonEncodedText MemberYear = System.Text.Json.JsonEncodedText.Encode("year"); + + public override Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDay)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Day; + } + + if (reader.ValueTextEquals(MemberHour)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Hour; + } + + if (reader.ValueTextEquals(MemberMinute)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Minute; + } + + if (reader.ValueTextEquals(MemberMonth)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Month; + } + + if (reader.ValueTextEquals(MemberSecond)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Second; + } + + if (reader.ValueTextEquals(MemberYear)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Year; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDay.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Day; + } + + if (string.Equals(value, MemberHour.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Hour; + } + + if (string.Equals(value, MemberMinute.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Minute; + } + + if (string.Equals(value, MemberMonth.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Month; + } + + if (string.Equals(value, MemberSecond.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Second; + } + + if (string.Equals(value, MemberYear.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Year; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Day: + writer.WriteStringValue(MemberDay); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Hour: + writer.WriteStringValue(MemberHour); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Minute: + writer.WriteStringValue(MemberMinute); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Month: + writer.WriteStringValue(MemberMonth); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Second: + writer.WriteStringValue(MemberSecond); + break; + case Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval.Year: + writer.WriteStringValue(MemberYear); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.MinimumInterval value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GapPolicyConverter : JsonConverter -{ - public override GapPolicy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) +internal sealed partial class GapPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberInsertZeros = System.Text.Json.JsonEncodedText.Encode("insert_zeros"); + private static readonly System.Text.Json.JsonEncodedText MemberKeepValues = System.Text.Json.JsonEncodedText.Encode("keep_values"); + private static readonly System.Text.Json.JsonEncodedText MemberSkip = System.Text.Json.JsonEncodedText.Encode("skip"); + + public override Elastic.Clients.Elasticsearch.Aggregations.GapPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberInsertZeros)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.InsertZeros; + } + + if (reader.ValueTextEquals(MemberKeepValues)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.KeepValues; + } + + if (reader.ValueTextEquals(MemberSkip)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.Skip; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberInsertZeros.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.InsertZeros; + } + + if (string.Equals(value, MemberKeepValues.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.KeepValues; + } + + if (string.Equals(value, MemberSkip.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.Skip; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GapPolicy value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.InsertZeros: + writer.WriteStringValue(MemberInsertZeros); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.KeepValues: + writer.WriteStringValue(MemberKeepValues); + break; + case Elastic.Clients.Elasticsearch.Aggregations.GapPolicy.Skip: + writer.WriteStringValue(MemberSkip); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.GapPolicy)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.GapPolicy ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.GapPolicy value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CalendarIntervalConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDay = System.Text.Json.JsonEncodedText.Encode("day"); + private static readonly System.Text.Json.JsonEncodedText MemberDay1 = System.Text.Json.JsonEncodedText.Encode("1d"); + private static readonly System.Text.Json.JsonEncodedText MemberHour = System.Text.Json.JsonEncodedText.Encode("hour"); + private static readonly System.Text.Json.JsonEncodedText MemberHour1 = System.Text.Json.JsonEncodedText.Encode("1h"); + private static readonly System.Text.Json.JsonEncodedText MemberMinute = System.Text.Json.JsonEncodedText.Encode("minute"); + private static readonly System.Text.Json.JsonEncodedText MemberMinute1 = System.Text.Json.JsonEncodedText.Encode("1m"); + private static readonly System.Text.Json.JsonEncodedText MemberMonth = System.Text.Json.JsonEncodedText.Encode("month"); + private static readonly System.Text.Json.JsonEncodedText MemberMonth1 = System.Text.Json.JsonEncodedText.Encode("1M"); + private static readonly System.Text.Json.JsonEncodedText MemberQuarter = System.Text.Json.JsonEncodedText.Encode("quarter"); + private static readonly System.Text.Json.JsonEncodedText MemberQuarter1 = System.Text.Json.JsonEncodedText.Encode("1q"); + private static readonly System.Text.Json.JsonEncodedText MemberSecond = System.Text.Json.JsonEncodedText.Encode("second"); + private static readonly System.Text.Json.JsonEncodedText MemberSecond1 = System.Text.Json.JsonEncodedText.Encode("1s"); + private static readonly System.Text.Json.JsonEncodedText MemberWeek = System.Text.Json.JsonEncodedText.Encode("week"); + private static readonly System.Text.Json.JsonEncodedText MemberWeek1 = System.Text.Json.JsonEncodedText.Encode("1w"); + private static readonly System.Text.Json.JsonEncodedText MemberYear = System.Text.Json.JsonEncodedText.Encode("year"); + private static readonly System.Text.Json.JsonEncodedText MemberYear1 = System.Text.Json.JsonEncodedText.Encode("1y"); + + public override Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDay) || reader.ValueTextEquals(MemberDay1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Day; + } + + if (reader.ValueTextEquals(MemberHour) || reader.ValueTextEquals(MemberHour1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Hour; + } + + if (reader.ValueTextEquals(MemberMinute) || reader.ValueTextEquals(MemberMinute1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Minute; + } + + if (reader.ValueTextEquals(MemberMonth) || reader.ValueTextEquals(MemberMonth1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Month; + } + + if (reader.ValueTextEquals(MemberQuarter) || reader.ValueTextEquals(MemberQuarter1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Quarter; + } + + if (reader.ValueTextEquals(MemberSecond) || reader.ValueTextEquals(MemberSecond1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Second; + } + + if (reader.ValueTextEquals(MemberWeek) || reader.ValueTextEquals(MemberWeek1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Week; + } + + if (reader.ValueTextEquals(MemberYear) || reader.ValueTextEquals(MemberYear1)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Year; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDay.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberDay1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Day; + } + + if (string.Equals(value, MemberHour.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberHour1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Hour; + } + + if (string.Equals(value, MemberMinute.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberMinute1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Minute; + } + + if (string.Equals(value, MemberMonth.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberMonth1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Month; + } + + if (string.Equals(value, MemberQuarter.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberQuarter1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Quarter; + } + + if (string.Equals(value, MemberSecond.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberSecond1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Second; + } + + if (string.Equals(value, MemberWeek.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberWeek1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Week; + } + + if (string.Equals(value, MemberYear.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberYear1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Year; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Day: + writer.WriteStringValue(MemberDay); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Hour: + writer.WriteStringValue(MemberHour); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Minute: + writer.WriteStringValue(MemberMinute); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Month: + writer.WriteStringValue(MemberMonth); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Quarter: + writer.WriteStringValue(MemberQuarter); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Second: + writer.WriteStringValue(MemberSecond); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Week: + writer.WriteStringValue(MemberWeek); + break; + case Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval.Year: + writer.WriteStringValue(MemberYear); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.CalendarInterval value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SamplerAggregationExecutionHintConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBytesHash = System.Text.Json.JsonEncodedText.Encode("bytes_hash"); + private static readonly System.Text.Json.JsonEncodedText MemberGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText MemberMap = System.Text.Json.JsonEncodedText.Encode("map"); + + public override Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBytesHash)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.BytesHash; + } + + if (reader.ValueTextEquals(MemberGlobalOrdinals)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.GlobalOrdinals; + } + + if (reader.ValueTextEquals(MemberMap)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.Map; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBytesHash.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.BytesHash; + } + + if (string.Equals(value, MemberGlobalOrdinals.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.GlobalOrdinals; + } + + if (string.Equals(value, MemberMap.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.Map; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.BytesHash: + writer.WriteStringValue(MemberBytesHash); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.GlobalOrdinals: + writer.WriteStringValue(MemberGlobalOrdinals); + break; + case Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint.Map: + writer.WriteStringValue(MemberMap); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHint value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class NormalizeMethodConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberMean = System.Text.Json.JsonEncodedText.Encode("mean"); + private static readonly System.Text.Json.JsonEncodedText MemberPercentOfSum = System.Text.Json.JsonEncodedText.Encode("percent_of_sum"); + private static readonly System.Text.Json.JsonEncodedText MemberRescale01 = System.Text.Json.JsonEncodedText.Encode("rescale_0_1"); + private static readonly System.Text.Json.JsonEncodedText MemberRescale0100 = System.Text.Json.JsonEncodedText.Encode("rescale_0_100"); + private static readonly System.Text.Json.JsonEncodedText MemberSoftmax = System.Text.Json.JsonEncodedText.Encode("softmax"); + private static readonly System.Text.Json.JsonEncodedText MemberZScore = System.Text.Json.JsonEncodedText.Encode("z-score"); + + public override Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberMean)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Mean; + } + + if (reader.ValueTextEquals(MemberPercentOfSum)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.PercentOfSum; + } + + if (reader.ValueTextEquals(MemberRescale01)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale01; + } + + if (reader.ValueTextEquals(MemberRescale0100)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale0100; + } + + if (reader.ValueTextEquals(MemberSoftmax)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Softmax; + } + + if (reader.ValueTextEquals(MemberZScore)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.ZScore; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberMean.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Mean; + } + + if (string.Equals(value, MemberPercentOfSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.PercentOfSum; + } + + if (string.Equals(value, MemberRescale01.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale01; + } + + if (string.Equals(value, MemberRescale0100.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale0100; + } + + if (string.Equals(value, MemberSoftmax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Softmax; + } + + if (string.Equals(value, MemberZScore.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.ZScore; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Mean: + writer.WriteStringValue(MemberMean); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.PercentOfSum: + writer.WriteStringValue(MemberPercentOfSum); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale01: + writer.WriteStringValue(MemberRescale01); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Rescale0100: + writer.WriteStringValue(MemberRescale0100); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.Softmax: + writer.WriteStringValue(MemberSoftmax); + break; + case Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod.ZScore: + writer.WriteStringValue(MemberZScore); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethod value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class RateModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText MemberValueCount = System.Text.Json.JsonEncodedText.Encode("value_count"); + + public override Elastic.Clients.Elasticsearch.Aggregations.RateMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.Aggregations.RateMode.Sum; + } + + if (reader.ValueTextEquals(MemberValueCount)) + { + return Elastic.Clients.Elasticsearch.Aggregations.RateMode.ValueCount; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.RateMode.Sum; + } + + if (string.Equals(value, MemberValueCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.RateMode.ValueCount; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.RateMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RateMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.RateMode.Sum: + writer.WriteStringValue(MemberSum); + break; + case Elastic.Clients.Elasticsearch.Aggregations.RateMode.ValueCount: + writer.WriteStringValue(MemberValueCount); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.RateMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.RateMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.RateMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class TTestTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberHeteroscedastic = System.Text.Json.JsonEncodedText.Encode("heteroscedastic"); + private static readonly System.Text.Json.JsonEncodedText MemberHomoscedastic = System.Text.Json.JsonEncodedText.Encode("homoscedastic"); + private static readonly System.Text.Json.JsonEncodedText MemberPaired = System.Text.Json.JsonEncodedText.Encode("paired"); + + public override Elastic.Clients.Elasticsearch.Aggregations.TTestType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberHeteroscedastic)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Heteroscedastic; + } + + if (reader.ValueTextEquals(MemberHomoscedastic)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Homoscedastic; + } + + if (reader.ValueTextEquals(MemberPaired)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Paired; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberHeteroscedastic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Heteroscedastic; + } + + if (string.Equals(value, MemberHomoscedastic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Homoscedastic; + } + + if (string.Equals(value, MemberPaired.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.TTestType.Paired; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TTestType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TTestType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Aggregations.TTestType.Heteroscedastic: + writer.WriteStringValue(MemberHeteroscedastic); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TTestType.Homoscedastic: + writer.WriteStringValue(MemberHomoscedastic); + break; + case Elastic.Clients.Elasticsearch.Aggregations.TTestType.Paired: + writer.WriteStringValue(MemberPaired); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.TTestType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Aggregations.TTestType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.TTestType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ValueTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBoolean = System.Text.Json.JsonEncodedText.Encode("boolean"); + private static readonly System.Text.Json.JsonEncodedText MemberDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText MemberDateNanos = System.Text.Json.JsonEncodedText.Encode("date_nanos"); + private static readonly System.Text.Json.JsonEncodedText MemberDouble = System.Text.Json.JsonEncodedText.Encode("double"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoPoint = System.Text.Json.JsonEncodedText.Encode("geo_point"); + private static readonly System.Text.Json.JsonEncodedText MemberIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText MemberLong = System.Text.Json.JsonEncodedText.Encode("long"); + private static readonly System.Text.Json.JsonEncodedText MemberNumber = System.Text.Json.JsonEncodedText.Encode("number"); + private static readonly System.Text.Json.JsonEncodedText MemberNumeric = System.Text.Json.JsonEncodedText.Encode("numeric"); + private static readonly System.Text.Json.JsonEncodedText MemberString = System.Text.Json.JsonEncodedText.Encode("string"); + + public override Elastic.Clients.Elasticsearch.Aggregations.ValueType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBoolean)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Boolean; + } + + if (reader.ValueTextEquals(MemberDate)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Date; + } + + if (reader.ValueTextEquals(MemberDateNanos)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.DateNanos; + } + + if (reader.ValueTextEquals(MemberDouble)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Double; + } + + if (reader.ValueTextEquals(MemberGeoPoint)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.GeoPoint; + } + + if (reader.ValueTextEquals(MemberIp)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Ip; + } + + if (reader.ValueTextEquals(MemberLong)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Long; + } + + if (reader.ValueTextEquals(MemberNumber)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Number; + } + + if (reader.ValueTextEquals(MemberNumeric)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Numeric; + } + + if (reader.ValueTextEquals(MemberString)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.String; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBoolean.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Boolean; + } + + if (string.Equals(value, MemberDate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Date; + } + + if (string.Equals(value, MemberDateNanos.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.DateNanos; + } + + if (string.Equals(value, MemberDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Double; + } + + if (string.Equals(value, MemberGeoPoint.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "skip": - return GapPolicy.Skip; - case "keep_values": - return GapPolicy.KeepValues; - case "insert_zeros": - return GapPolicy.InsertZeros; + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.GeoPoint; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (string.Equals(value, MemberIp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Ip; + } - public override void Write(Utf8JsonWriter writer, GapPolicy value, JsonSerializerOptions options) - { - switch (value) + if (string.Equals(value, MemberLong.Value, System.StringComparison.OrdinalIgnoreCase)) { - case GapPolicy.Skip: - writer.WriteStringValue("skip"); - return; - case GapPolicy.KeepValues: - writer.WriteStringValue("keep_values"); - return; - case GapPolicy.InsertZeros: - writer.WriteStringValue("insert_zeros"); - return; + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Long; } - writer.WriteNullValue(); - } -} + if (string.Equals(value, MemberNumber.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Number; + } -[JsonConverter(typeof(MinimumIntervalConverter))] -public enum MinimumInterval -{ - [EnumMember(Value = "year")] - Year, - [EnumMember(Value = "second")] - Second, - [EnumMember(Value = "month")] - Month, - [EnumMember(Value = "minute")] - Minute, - [EnumMember(Value = "hour")] - Hour, - [EnumMember(Value = "day")] - Day -} + if (string.Equals(value, MemberNumeric.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.Numeric; + } -internal sealed class MinimumIntervalConverter : JsonConverter -{ - public override MinimumInterval Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberString.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "year": - return MinimumInterval.Year; - case "second": - return MinimumInterval.Second; - case "month": - return MinimumInterval.Month; - case "minute": - return MinimumInterval.Minute; - case "hour": - return MinimumInterval.Hour; - case "day": - return MinimumInterval.Day; + return Elastic.Clients.Elasticsearch.Aggregations.ValueType.String; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.ValueType)}'."); } - public override void Write(Utf8JsonWriter writer, MinimumInterval value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ValueType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case MinimumInterval.Year: - writer.WriteStringValue("year"); - return; - case MinimumInterval.Second: - writer.WriteStringValue("second"); - return; - case MinimumInterval.Month: - writer.WriteStringValue("month"); - return; - case MinimumInterval.Minute: - writer.WriteStringValue("minute"); - return; - case MinimumInterval.Hour: - writer.WriteStringValue("hour"); - return; - case MinimumInterval.Day: - writer.WriteStringValue("day"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Boolean: + writer.WriteStringValue(MemberBoolean); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Date: + writer.WriteStringValue(MemberDate); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.DateNanos: + writer.WriteStringValue(MemberDateNanos); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Double: + writer.WriteStringValue(MemberDouble); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.GeoPoint: + writer.WriteStringValue(MemberGeoPoint); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Ip: + writer.WriteStringValue(MemberIp); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Long: + writer.WriteStringValue(MemberLong); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Number: + writer.WriteStringValue(MemberNumber); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.Numeric: + writer.WriteStringValue(MemberNumeric); + break; + case Elastic.Clients.Elasticsearch.Aggregations.ValueType.String: + writer.WriteStringValue(MemberString); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Aggregations.ValueType)}'."); + } } -} -[JsonConverter(typeof(MissingOrderConverter))] -public enum MissingOrder -{ - [EnumMember(Value = "last")] - Last, - [EnumMember(Value = "first")] - First, - [EnumMember(Value = "default")] - Default -} - -internal sealed class MissingOrderConverter : JsonConverter -{ - public override MissingOrder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Aggregations.ValueType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "last": - return MissingOrder.Last; - case "first": - return MissingOrder.First; - case "default": - return MissingOrder.Default; - } - - ThrowHelper.ThrowJsonException(); - return default; + return Read(ref reader, typeToConvert, options); } - public override void Write(Utf8JsonWriter writer, MissingOrder value, JsonSerializerOptions options) + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Aggregations.ValueType value, System.Text.Json.JsonSerializerOptions options) { - switch (value) - { - case MissingOrder.Last: - writer.WriteStringValue("last"); - return; - case MissingOrder.First: - writer.WriteStringValue("first"); - return; - case MissingOrder.Default: - writer.WriteStringValue("default"); - return; - } - - writer.WriteNullValue(); + Write(writer, value, options); } } -[JsonConverter(typeof(NormalizeMethodConverter))] -public enum NormalizeMethod +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CardinalityExecutionModeConverter))] +public enum CardinalityExecutionMode { /// /// - /// This method normalizes such that each value represents how far it is from the mean relative to the standard deviation. + /// Run the aggregation by using field values directly. /// /// - [EnumMember(Value = "z-score")] - ZScore, + [System.Runtime.Serialization.EnumMember(Value = "direct")] + Direct, /// /// - /// This method normalizes such that each value is exponentiated and relative to the sum of the exponents of the original values. + /// Run the aggregation by using global ordinals of the field and resolving those values after finishing a shard. /// /// - [EnumMember(Value = "softmax")] - Softmax, + [System.Runtime.Serialization.EnumMember(Value = "global_ordinals")] + GlobalOrdinals, /// /// - /// This method rescales the data such that the minimum number is 0, and the maximum number is 100, with the rest normalized linearly in-between. + /// Heuristic-based mode, default in Elasticsearch 8.3 and earlier. /// /// - [EnumMember(Value = "rescale_0_100")] - Rescale0100, + [System.Runtime.Serialization.EnumMember(Value = "save_memory_heuristic")] + SaveMemoryHeuristic, /// /// - /// This method rescales the data such that the minimum number is 0, and the maximum number is 1, with the rest normalized linearly in-between. + /// Heuristic-based mode, default in Elasticsearch 8.4 and later. /// /// - [EnumMember(Value = "rescale_0_1")] - Rescale01, + [System.Runtime.Serialization.EnumMember(Value = "save_time_heuristic")] + SaveTimeHeuristic, /// /// - /// This method normalizes each value so that it represents a percentage of the total sum it attributes to. + /// Run the aggregation by using segment ordinal values and resolving those values after each segment. /// /// - [EnumMember(Value = "percent_of_sum")] - PercentOfSum, + [System.Runtime.Serialization.EnumMember(Value = "segment_ordinals")] + SegmentOrdinals +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationCollectModeConverter))] +public enum TermsAggregationCollectMode +{ /// /// - /// This method normalizes such that each value is normalized by how much it differs from the average. + /// Caches the set of documents that fall into the uppermost buckets for subsequent replay. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "breadth_first")] + BreadthFirst, + /// + /// + /// Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs. /// /// - [EnumMember(Value = "mean")] - Mean + [System.Runtime.Serialization.EnumMember(Value = "depth_first")] + DepthFirst } -internal sealed class NormalizeMethodConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationExecutionHintConverter))] +public enum TermsAggregationExecutionHint { - public override NormalizeMethod Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "z-score": - return NormalizeMethod.ZScore; - case "softmax": - return NormalizeMethod.Softmax; - case "rescale_0_100": - return NormalizeMethod.Rescale0100; - case "rescale_0_1": - return NormalizeMethod.Rescale01; - case "percent_of_sum": - return NormalizeMethod.PercentOfSum; - case "mean": - return NormalizeMethod.Mean; - } + [System.Runtime.Serialization.EnumMember(Value = "global_ordinals")] + GlobalOrdinals, + [System.Runtime.Serialization.EnumMember(Value = "global_ordinals_hash")] + GlobalOrdinalsHash, + [System.Runtime.Serialization.EnumMember(Value = "global_ordinals_low_cardinality")] + GlobalOrdinalsLowCardinality, + [System.Runtime.Serialization.EnumMember(Value = "map")] + Map +} - ThrowHelper.ThrowJsonException(); - return default; - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MissingOrderConverter))] +public enum MissingOrder +{ + [System.Runtime.Serialization.EnumMember(Value = "default")] + Default, + [System.Runtime.Serialization.EnumMember(Value = "first")] + First, + [System.Runtime.Serialization.EnumMember(Value = "last")] + Last +} - public override void Write(Utf8JsonWriter writer, NormalizeMethod value, JsonSerializerOptions options) - { - switch (value) - { - case NormalizeMethod.ZScore: - writer.WriteStringValue("z-score"); - return; - case NormalizeMethod.Softmax: - writer.WriteStringValue("softmax"); - return; - case NormalizeMethod.Rescale0100: - writer.WriteStringValue("rescale_0_100"); - return; - case NormalizeMethod.Rescale01: - writer.WriteStringValue("rescale_0_1"); - return; - case NormalizeMethod.PercentOfSum: - writer.WriteStringValue("percent_of_sum"); - return; - case NormalizeMethod.Mean: - writer.WriteStringValue("mean"); - return; - } - - writer.WriteNullValue(); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.MinimumIntervalConverter))] +public enum MinimumInterval +{ + [System.Runtime.Serialization.EnumMember(Value = "day")] + Day, + [System.Runtime.Serialization.EnumMember(Value = "hour")] + Hour, + [System.Runtime.Serialization.EnumMember(Value = "minute")] + Minute, + [System.Runtime.Serialization.EnumMember(Value = "month")] + Month, + [System.Runtime.Serialization.EnumMember(Value = "second")] + Second, + [System.Runtime.Serialization.EnumMember(Value = "year")] + Year } -[JsonConverter(typeof(RateModeConverter))] -public enum RateMode +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.GapPolicyConverter))] +public enum GapPolicy { /// /// - /// Uses the number of values of the field. + /// Replace missing values with a zero (0) and pipeline aggregation computation will proceed as normal. /// /// - [EnumMember(Value = "value_count")] - ValueCount, + [System.Runtime.Serialization.EnumMember(Value = "insert_zeros")] + InsertZeros, /// /// - /// Calculates the sum of all values of the field. + /// Similar to skip, except if the metric provides a non-null, non-NaN value this value is used, + /// otherwise the empty bucket is skipped. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "keep_values")] + KeepValues, + /// + /// + /// Treats missing data as if the bucket does not exist. It will skip the bucket and + /// continue calculating using the next available value. /// /// - [EnumMember(Value = "sum")] - Sum + [System.Runtime.Serialization.EnumMember(Value = "skip")] + Skip } -internal sealed class RateModeConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.CalendarIntervalConverter))] +public enum CalendarInterval { - public override RateMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "value_count": - return RateMode.ValueCount; - case "sum": - return RateMode.Sum; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, RateMode value, JsonSerializerOptions options) - { - switch (value) - { - case RateMode.ValueCount: - writer.WriteStringValue("value_count"); - return; - case RateMode.Sum: - writer.WriteStringValue("sum"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "day")] + Day, + [System.Runtime.Serialization.EnumMember(Value = "hour")] + Hour, + [System.Runtime.Serialization.EnumMember(Value = "minute")] + Minute, + [System.Runtime.Serialization.EnumMember(Value = "month")] + Month, + [System.Runtime.Serialization.EnumMember(Value = "quarter")] + Quarter, + [System.Runtime.Serialization.EnumMember(Value = "second")] + Second, + [System.Runtime.Serialization.EnumMember(Value = "week")] + Week, + [System.Runtime.Serialization.EnumMember(Value = "year")] + Year } -[JsonConverter(typeof(SamplerAggregationExecutionHintConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.SamplerAggregationExecutionHintConverter))] public enum SamplerAggregationExecutionHint { /// /// - /// Hold field values directly. + /// Hold hashes of the field values - with potential for hash collisions. /// /// - [EnumMember(Value = "map")] - Map, + [System.Runtime.Serialization.EnumMember(Value = "bytes_hash")] + BytesHash, /// /// /// Hold ordinals of the field as determined by the Lucene index. /// /// - [EnumMember(Value = "global_ordinals")] + [System.Runtime.Serialization.EnumMember(Value = "global_ordinals")] GlobalOrdinals, /// /// - /// Hold hashes of the field values - with potential for hash collisions. + /// Hold field values directly. /// /// - [EnumMember(Value = "bytes_hash")] - BytesHash -} - -internal sealed class SamplerAggregationExecutionHintConverter : JsonConverter -{ - public override SamplerAggregationExecutionHint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "map": - return SamplerAggregationExecutionHint.Map; - case "global_ordinals": - return SamplerAggregationExecutionHint.GlobalOrdinals; - case "bytes_hash": - return SamplerAggregationExecutionHint.BytesHash; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SamplerAggregationExecutionHint value, JsonSerializerOptions options) - { - switch (value) - { - case SamplerAggregationExecutionHint.Map: - writer.WriteStringValue("map"); - return; - case SamplerAggregationExecutionHint.GlobalOrdinals: - writer.WriteStringValue("global_ordinals"); - return; - case SamplerAggregationExecutionHint.BytesHash: - writer.WriteStringValue("bytes_hash"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "map")] + Map } -[JsonConverter(typeof(TermsAggregationCollectModeConverter))] -public enum TermsAggregationCollectMode +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.NormalizeMethodConverter))] +public enum NormalizeMethod { /// /// - /// Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs. + /// This method normalizes such that each value is normalized by how much it differs from the average. /// /// - [EnumMember(Value = "depth_first")] - DepthFirst, + [System.Runtime.Serialization.EnumMember(Value = "mean")] + Mean, /// /// - /// Caches the set of documents that fall into the uppermost buckets for subsequent replay. + /// This method normalizes each value so that it represents a percentage of the total sum it attributes to. /// /// - [EnumMember(Value = "breadth_first")] - BreadthFirst -} - -internal sealed class TermsAggregationCollectModeConverter : JsonConverter -{ - public override TermsAggregationCollectMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "depth_first": - return TermsAggregationCollectMode.DepthFirst; - case "breadth_first": - return TermsAggregationCollectMode.BreadthFirst; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TermsAggregationCollectMode value, JsonSerializerOptions options) - { - switch (value) - { - case TermsAggregationCollectMode.DepthFirst: - writer.WriteStringValue("depth_first"); - return; - case TermsAggregationCollectMode.BreadthFirst: - writer.WriteStringValue("breadth_first"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(TermsAggregationExecutionHintConverter))] -public enum TermsAggregationExecutionHint -{ - [EnumMember(Value = "map")] - Map, - [EnumMember(Value = "global_ordinals_low_cardinality")] - GlobalOrdinalsLowCardinality, - [EnumMember(Value = "global_ordinals_hash")] - GlobalOrdinalsHash, - [EnumMember(Value = "global_ordinals")] - GlobalOrdinals + [System.Runtime.Serialization.EnumMember(Value = "percent_of_sum")] + PercentOfSum, + /// + /// + /// This method rescales the data such that the minimum number is 0, and the maximum number is 1, with the rest normalized linearly in-between. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "rescale_0_1")] + Rescale01, + /// + /// + /// This method rescales the data such that the minimum number is 0, and the maximum number is 100, with the rest normalized linearly in-between. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "rescale_0_100")] + Rescale0100, + /// + /// + /// This method normalizes such that each value is exponentiated and relative to the sum of the exponents of the original values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "softmax")] + Softmax, + /// + /// + /// This method normalizes such that each value represents how far it is from the mean relative to the standard deviation. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "z-score")] + ZScore } -internal sealed class TermsAggregationExecutionHintConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.RateModeConverter))] +public enum RateMode { - public override TermsAggregationExecutionHint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "map": - return TermsAggregationExecutionHint.Map; - case "global_ordinals_low_cardinality": - return TermsAggregationExecutionHint.GlobalOrdinalsLowCardinality; - case "global_ordinals_hash": - return TermsAggregationExecutionHint.GlobalOrdinalsHash; - case "global_ordinals": - return TermsAggregationExecutionHint.GlobalOrdinals; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TermsAggregationExecutionHint value, JsonSerializerOptions options) - { - switch (value) - { - case TermsAggregationExecutionHint.Map: - writer.WriteStringValue("map"); - return; - case TermsAggregationExecutionHint.GlobalOrdinalsLowCardinality: - writer.WriteStringValue("global_ordinals_low_cardinality"); - return; - case TermsAggregationExecutionHint.GlobalOrdinalsHash: - writer.WriteStringValue("global_ordinals_hash"); - return; - case TermsAggregationExecutionHint.GlobalOrdinals: - writer.WriteStringValue("global_ordinals"); - return; - } - - writer.WriteNullValue(); - } + /// + /// + /// Calculates the sum of all values of the field. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum, + /// + /// + /// Uses the number of values of the field. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "value_count")] + ValueCount } -[JsonConverter(typeof(TTestTypeConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.TTestTypeConverter))] public enum TTestType { /// /// - /// Performs paired t-test. + /// Performs two-sample unequal variance test. /// /// - [EnumMember(Value = "paired")] - Paired, + [System.Runtime.Serialization.EnumMember(Value = "heteroscedastic")] + Heteroscedastic, /// /// /// Performs two-sample equal variance test. /// /// - [EnumMember(Value = "homoscedastic")] + [System.Runtime.Serialization.EnumMember(Value = "homoscedastic")] Homoscedastic, /// /// - /// Performs two-sample unequal variance test. + /// Performs paired t-test. /// /// - [EnumMember(Value = "heteroscedastic")] - Heteroscedastic -} - -internal sealed class TTestTypeConverter : JsonConverter -{ - public override TTestType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "paired": - return TTestType.Paired; - case "homoscedastic": - return TTestType.Homoscedastic; - case "heteroscedastic": - return TTestType.Heteroscedastic; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TTestType value, JsonSerializerOptions options) - { - switch (value) - { - case TTestType.Paired: - writer.WriteStringValue("paired"); - return; - case TTestType.Homoscedastic: - writer.WriteStringValue("homoscedastic"); - return; - case TTestType.Heteroscedastic: - writer.WriteStringValue("heteroscedastic"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "paired")] + Paired } -[JsonConverter(typeof(ValueTypeConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Aggregations.ValueTypeConverter))] public enum ValueType { - [EnumMember(Value = "string")] - String, - [EnumMember(Value = "numeric")] - Numeric, - [EnumMember(Value = "number")] - Number, - [EnumMember(Value = "long")] - Long, - [EnumMember(Value = "ip")] - Ip, - [EnumMember(Value = "geo_point")] - GeoPoint, - [EnumMember(Value = "double")] - Double, - [EnumMember(Value = "date_nanos")] - DateNanos, - [EnumMember(Value = "date")] + [System.Runtime.Serialization.EnumMember(Value = "boolean")] + Boolean, + [System.Runtime.Serialization.EnumMember(Value = "date")] Date, - [EnumMember(Value = "boolean")] - Boolean -} - -internal sealed class ValueTypeConverter : JsonConverter -{ - public override ValueType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "string": - return ValueType.String; - case "numeric": - return ValueType.Numeric; - case "number": - return ValueType.Number; - case "long": - return ValueType.Long; - case "ip": - return ValueType.Ip; - case "geo_point": - return ValueType.GeoPoint; - case "double": - return ValueType.Double; - case "date_nanos": - return ValueType.DateNanos; - case "date": - return ValueType.Date; - case "boolean": - return ValueType.Boolean; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, ValueType value, JsonSerializerOptions options) - { - switch (value) - { - case ValueType.String: - writer.WriteStringValue("string"); - return; - case ValueType.Numeric: - writer.WriteStringValue("numeric"); - return; - case ValueType.Number: - writer.WriteStringValue("number"); - return; - case ValueType.Long: - writer.WriteStringValue("long"); - return; - case ValueType.Ip: - writer.WriteStringValue("ip"); - return; - case ValueType.GeoPoint: - writer.WriteStringValue("geo_point"); - return; - case ValueType.Double: - writer.WriteStringValue("double"); - return; - case ValueType.DateNanos: - writer.WriteStringValue("date_nanos"); - return; - case ValueType.Date: - writer.WriteStringValue("date"); - return; - case ValueType.Boolean: - writer.WriteStringValue("boolean"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "date_nanos")] + DateNanos, + [System.Runtime.Serialization.EnumMember(Value = "double")] + Double, + [System.Runtime.Serialization.EnumMember(Value = "geo_point")] + GeoPoint, + [System.Runtime.Serialization.EnumMember(Value = "ip")] + Ip, + [System.Runtime.Serialization.EnumMember(Value = "long")] + Long, + [System.Runtime.Serialization.EnumMember(Value = "number")] + Number, + [System.Runtime.Serialization.EnumMember(Value = "numeric")] + Numeric, + [System.Runtime.Serialization.EnumMember(Value = "string")] + String } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Analysis.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Analysis.g.cs index dae02bf828f..287abe32b83 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Analysis.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Analysis.g.cs @@ -17,1441 +17,2094 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Analysis; -[JsonConverter(typeof(DelimitedPayloadEncodingConverter))] -public enum DelimitedPayloadEncoding +internal sealed partial class KuromojiTokenizationModeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "int")] - Integer, - [EnumMember(Value = "identity")] - Identity, - [EnumMember(Value = "float")] - Float -} + private static readonly System.Text.Json.JsonEncodedText MemberExtended = System.Text.Json.JsonEncodedText.Encode("extended"); + private static readonly System.Text.Json.JsonEncodedText MemberNormal = System.Text.Json.JsonEncodedText.Encode("normal"); + private static readonly System.Text.Json.JsonEncodedText MemberSearch = System.Text.Json.JsonEncodedText.Encode("search"); -internal sealed class DelimitedPayloadEncodingConverter : JsonConverter -{ - public override DelimitedPayloadEncoding Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberExtended)) { - case "int": - return DelimitedPayloadEncoding.Integer; - case "identity": - return DelimitedPayloadEncoding.Identity; - case "float": - return DelimitedPayloadEncoding.Float; + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Extended; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberNormal)) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Normal; + } - public override void Write(Utf8JsonWriter writer, DelimitedPayloadEncoding value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberSearch)) { - case DelimitedPayloadEncoding.Integer: - writer.WriteStringValue("int"); - return; - case DelimitedPayloadEncoding.Identity: - writer.WriteStringValue("identity"); - return; - case DelimitedPayloadEncoding.Float: - writer.WriteStringValue("float"); - return; + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Search; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberExtended.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Extended; + } -[JsonConverter(typeof(EdgeNGramSideConverter))] -public enum EdgeNGramSide -{ - [EnumMember(Value = "front")] - Front, - [EnumMember(Value = "back")] - Back -} + if (string.Equals(value, MemberNormal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Normal; + } -internal sealed class EdgeNGramSideConverter : JsonConverter -{ - public override EdgeNGramSide Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberSearch.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "front": - return EdgeNGramSide.Front; - case "back": - return EdgeNGramSide.Back; + return Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Search; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode)}'."); } - public override void Write(Utf8JsonWriter writer, EdgeNGramSide value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case EdgeNGramSide.Front: - writer.WriteStringValue("front"); - return; - case EdgeNGramSide.Back: - writer.WriteStringValue("back"); - return; + case Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Extended: + writer.WriteStringValue(MemberExtended); + break; + case Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Normal: + writer.WriteStringValue(MemberNormal); + break; + case Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode.Search: + writer.WriteStringValue(MemberSearch); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(IcuCollationAlternateConverter))] -public enum IcuCollationAlternate +internal sealed partial class NoriDecompoundModeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "shifted")] - Shifted, - [EnumMember(Value = "non-ignorable")] - NonIgnorable -} + private static readonly System.Text.Json.JsonEncodedText MemberDiscard = System.Text.Json.JsonEncodedText.Encode("discard"); + private static readonly System.Text.Json.JsonEncodedText MemberMixed = System.Text.Json.JsonEncodedText.Encode("mixed"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); -internal sealed class IcuCollationAlternateConverter : JsonConverter -{ - public override IcuCollationAlternate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDiscard)) { - case "shifted": - return IcuCollationAlternate.Shifted; - case "non-ignorable": - return IcuCollationAlternate.NonIgnorable; + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Discard; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberMixed)) + { + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Mixed; + } - public override void Write(Utf8JsonWriter writer, IcuCollationAlternate value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberNone)) { - case IcuCollationAlternate.Shifted: - writer.WriteStringValue("shifted"); - return; - case IcuCollationAlternate.NonIgnorable: - writer.WriteStringValue("non-ignorable"); - return; + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.None; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberDiscard.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Discard; + } -[JsonConverter(typeof(IcuCollationCaseFirstConverter))] -public enum IcuCollationCaseFirst -{ - [EnumMember(Value = "upper")] - Upper, - [EnumMember(Value = "lower")] - Lower -} + if (string.Equals(value, MemberMixed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Mixed; + } -internal sealed class IcuCollationCaseFirstConverter : JsonConverter -{ - public override IcuCollationCaseFirst Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "upper": - return IcuCollationCaseFirst.Upper; - case "lower": - return IcuCollationCaseFirst.Lower; + return Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.None; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode)}'."); } - public override void Write(Utf8JsonWriter writer, IcuCollationCaseFirst value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IcuCollationCaseFirst.Upper: - writer.WriteStringValue("upper"); - return; - case IcuCollationCaseFirst.Lower: - writer.WriteStringValue("lower"); - return; + case Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Discard: + writer.WriteStringValue(MemberDiscard); + break; + case Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.Mixed: + writer.WriteStringValue(MemberMixed); + break; + case Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode.None: + writer.WriteStringValue(MemberNone); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(IcuCollationDecompositionConverter))] -public enum IcuCollationDecomposition +internal sealed partial class IcuNormalizationModeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "no")] - No, - [EnumMember(Value = "identical")] - Identical -} + private static readonly System.Text.Json.JsonEncodedText MemberCompose = System.Text.Json.JsonEncodedText.Encode("compose"); + private static readonly System.Text.Json.JsonEncodedText MemberDecompose = System.Text.Json.JsonEncodedText.Encode("decompose"); -internal sealed class IcuCollationDecompositionConverter : JsonConverter -{ - public override IcuCollationDecomposition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCompose)) { - case "no": - return IcuCollationDecomposition.No; - case "identical": - return IcuCollationDecomposition.Identical; + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Compose; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberDecompose)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Decompose; + } - public override void Write(Utf8JsonWriter writer, IcuCollationDecomposition value, JsonSerializerOptions options) - { - switch (value) + var value = reader.GetString()!; + if (string.Equals(value, MemberCompose.Value, System.StringComparison.OrdinalIgnoreCase)) { - case IcuCollationDecomposition.No: - writer.WriteStringValue("no"); - return; - case IcuCollationDecomposition.Identical: - writer.WriteStringValue("identical"); - return; + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Compose; } - writer.WriteNullValue(); - } -} + if (string.Equals(value, MemberDecompose.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Decompose; + } -[JsonConverter(typeof(IcuCollationStrengthConverter))] -public enum IcuCollationStrength -{ - [EnumMember(Value = "tertiary")] - Tertiary, - [EnumMember(Value = "secondary")] - Secondary, - [EnumMember(Value = "quaternary")] - Quaternary, - [EnumMember(Value = "primary")] - Primary, - [EnumMember(Value = "identical")] - Identical -} + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode)}'."); + } -internal sealed class IcuCollationStrengthConverter : JsonConverter -{ - public override IcuCollationStrength Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode value, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + switch (value) { - case "tertiary": - return IcuCollationStrength.Tertiary; - case "secondary": - return IcuCollationStrength.Secondary; - case "quaternary": - return IcuCollationStrength.Quaternary; - case "primary": - return IcuCollationStrength.Primary; - case "identical": - return IcuCollationStrength.Identical; + case Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Compose: + writer.WriteStringValue(MemberCompose); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode.Decompose: + writer.WriteStringValue(MemberDecompose); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode)}'."); } + } - ThrowHelper.ThrowJsonException(); - return default; + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } - public override void Write(Utf8JsonWriter writer, IcuCollationStrength value, JsonSerializerOptions options) + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationMode value, System.Text.Json.JsonSerializerOptions options) { - switch (value) - { - case IcuCollationStrength.Tertiary: - writer.WriteStringValue("tertiary"); - return; - case IcuCollationStrength.Secondary: - writer.WriteStringValue("secondary"); - return; - case IcuCollationStrength.Quaternary: - writer.WriteStringValue("quaternary"); - return; - case IcuCollationStrength.Primary: - writer.WriteStringValue("primary"); - return; - case IcuCollationStrength.Identical: - writer.WriteStringValue("identical"); - return; - } - - writer.WriteNullValue(); + Write(writer, value, options); } } -[JsonConverter(typeof(IcuNormalizationModeConverter))] -public enum IcuNormalizationMode +internal sealed partial class IcuNormalizationTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "decompose")] - Decompose, - [EnumMember(Value = "compose")] - Compose -} + private static readonly System.Text.Json.JsonEncodedText MemberNfc = System.Text.Json.JsonEncodedText.Encode("nfc"); + private static readonly System.Text.Json.JsonEncodedText MemberNfkc = System.Text.Json.JsonEncodedText.Encode("nfkc"); + private static readonly System.Text.Json.JsonEncodedText MemberNfkcCf = System.Text.Json.JsonEncodedText.Encode("nfkc_cf"); -internal sealed class IcuNormalizationModeConverter : JsonConverter -{ - public override IcuNormalizationMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberNfc)) { - case "decompose": - return IcuNormalizationMode.Decompose; - case "compose": - return IcuNormalizationMode.Compose; + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfc; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberNfkc)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfkc; + } - public override void Write(Utf8JsonWriter writer, IcuNormalizationMode value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberNfkcCf)) { - case IcuNormalizationMode.Decompose: - writer.WriteStringValue("decompose"); - return; - case IcuNormalizationMode.Compose: - writer.WriteStringValue("compose"); - return; + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.NfkcCf; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberNfc.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfc; + } -[JsonConverter(typeof(IcuNormalizationTypeConverter))] -public enum IcuNormalizationType -{ - [EnumMember(Value = "nfkc_cf")] - NfkcCf, - [EnumMember(Value = "nfkc")] - Nfkc, - [EnumMember(Value = "nfc")] - Nfc -} + if (string.Equals(value, MemberNfkc.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfkc; + } -internal sealed class IcuNormalizationTypeConverter : JsonConverter -{ - public override IcuNormalizationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberNfkcCf.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "nfkc_cf": - return IcuNormalizationType.NfkcCf; - case "nfkc": - return IcuNormalizationType.Nfkc; - case "nfc": - return IcuNormalizationType.Nfc; + return Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.NfkcCf; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType)}'."); } - public override void Write(Utf8JsonWriter writer, IcuNormalizationType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IcuNormalizationType.NfkcCf: - writer.WriteStringValue("nfkc_cf"); - return; - case IcuNormalizationType.Nfkc: - writer.WriteStringValue("nfkc"); - return; - case IcuNormalizationType.Nfc: - writer.WriteStringValue("nfc"); - return; + case Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfc: + writer.WriteStringValue(MemberNfc); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.Nfkc: + writer.WriteStringValue(MemberNfkc); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType.NfkcCf: + writer.WriteStringValue(MemberNfkcCf); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(IcuTransformDirectionConverter))] -public enum IcuTransformDirection -{ - [EnumMember(Value = "reverse")] - Reverse, - [EnumMember(Value = "forward")] - Forward + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class IcuTransformDirectionConverter : JsonConverter +internal sealed partial class DelimitedPayloadEncodingConverter : System.Text.Json.Serialization.JsonConverter { - public override IcuTransformDirection Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberFloat = System.Text.Json.JsonEncodedText.Encode("float"); + private static readonly System.Text.Json.JsonEncodedText MemberIdentity = System.Text.Json.JsonEncodedText.Encode("identity"); + private static readonly System.Text.Json.JsonEncodedText MemberInteger = System.Text.Json.JsonEncodedText.Encode("int"); + + public override Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFloat)) { - case "reverse": - return IcuTransformDirection.Reverse; - case "forward": - return IcuTransformDirection.Forward; + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Float; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberIdentity)) + { + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Identity; + } - public override void Write(Utf8JsonWriter writer, IcuTransformDirection value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberInteger)) { - case IcuTransformDirection.Reverse: - writer.WriteStringValue("reverse"); - return; - case IcuTransformDirection.Forward: - writer.WriteStringValue("forward"); - return; + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Integer; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Float; + } -[JsonConverter(typeof(KeepTypesModeConverter))] -public enum KeepTypesMode -{ - [EnumMember(Value = "include")] - Include, - [EnumMember(Value = "exclude")] - Exclude -} + if (string.Equals(value, MemberIdentity.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Identity; + } -internal sealed class KeepTypesModeConverter : JsonConverter -{ - public override KeepTypesMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberInteger.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "include": - return KeepTypesMode.Include; - case "exclude": - return KeepTypesMode.Exclude; + return Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Integer; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding)}'."); } - public override void Write(Utf8JsonWriter writer, KeepTypesMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case KeepTypesMode.Include: - writer.WriteStringValue("include"); - return; - case KeepTypesMode.Exclude: - writer.WriteStringValue("exclude"); - return; + case Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Float: + writer.WriteStringValue(MemberFloat); + break; + case Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Identity: + writer.WriteStringValue(MemberIdentity); + break; + case Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding.Integer: + writer.WriteStringValue(MemberInteger); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(KuromojiTokenizationModeConverter))] -public enum KuromojiTokenizationMode -{ - [EnumMember(Value = "search")] - Search, - [EnumMember(Value = "normal")] - Normal, - [EnumMember(Value = "extended")] - Extended + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncoding value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class KuromojiTokenizationModeConverter : JsonConverter +internal sealed partial class EdgeNGramSideConverter : System.Text.Json.Serialization.JsonConverter { - public override KuromojiTokenizationMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberBack = System.Text.Json.JsonEncodedText.Encode("back"); + private static readonly System.Text.Json.JsonEncodedText MemberFront = System.Text.Json.JsonEncodedText.Encode("front"); + + public override Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberBack)) + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Back; + } + + if (reader.ValueTextEquals(MemberFront)) + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Front; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBack.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Back; + } + + if (string.Equals(value, MemberFront.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "search": - return KuromojiTokenizationMode.Search; - case "normal": - return KuromojiTokenizationMode.Normal; - case "extended": - return KuromojiTokenizationMode.Extended; + return Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Front; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide)}'."); } - public override void Write(Utf8JsonWriter writer, KuromojiTokenizationMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case KuromojiTokenizationMode.Search: - writer.WriteStringValue("search"); - return; - case KuromojiTokenizationMode.Normal: - writer.WriteStringValue("normal"); - return; - case KuromojiTokenizationMode.Extended: - writer.WriteStringValue("extended"); - return; + case Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Back: + writer.WriteStringValue(MemberBack); + break; + case Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide.Front: + writer.WriteStringValue(MemberFront); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide)}'."); } - - writer.WriteNullValue(); } -} -[JsonConverter(typeof(LanguageConverter))] -public enum Language -{ - [EnumMember(Value = "Turkish")] - Turkish, - [EnumMember(Value = "Thai")] - Thai, - [EnumMember(Value = "Swedish")] - Swedish, - [EnumMember(Value = "Spanish")] - Spanish, - [EnumMember(Value = "Sorani")] - Sorani, - [EnumMember(Value = "Russian")] - Russian, - [EnumMember(Value = "Romanian")] - Romanian, - [EnumMember(Value = "Portuguese")] - Portuguese, - [EnumMember(Value = "Persian")] - Persian, - [EnumMember(Value = "Norwegian")] - Norwegian, - [EnumMember(Value = "Latvian")] - Latvian, - [EnumMember(Value = "Italian")] - Italian, - [EnumMember(Value = "Irish")] - Irish, - [EnumMember(Value = "Indonesian")] - Indonesian, - [EnumMember(Value = "Hungarian")] - Hungarian, - [EnumMember(Value = "Hindi")] - Hindi, - [EnumMember(Value = "Greek")] - Greek, - [EnumMember(Value = "German")] - German, - [EnumMember(Value = "Galician")] - Galician, - [EnumMember(Value = "French")] - French, - [EnumMember(Value = "Finnish")] - Finnish, - [EnumMember(Value = "Estonian")] - Estonian, - [EnumMember(Value = "English")] - English, - [EnumMember(Value = "Dutch")] - Dutch, - [EnumMember(Value = "Danish")] - Danish, - [EnumMember(Value = "Czech")] - Czech, - [EnumMember(Value = "Cjk")] - Cjk, - [EnumMember(Value = "Chinese")] - Chinese, - [EnumMember(Value = "Catalan")] - Catalan, - [EnumMember(Value = "Bulgarian")] - Bulgarian, - [EnumMember(Value = "Brazilian")] - Brazilian, - [EnumMember(Value = "Basque")] - Basque, - [EnumMember(Value = "Armenian")] - Armenian, - [EnumMember(Value = "Arabic")] - Arabic -} + public override Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } -internal sealed class LanguageConverter : JsonConverter -{ - public override Language Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "Turkish": - return Language.Turkish; - case "Thai": - return Language.Thai; - case "Swedish": - return Language.Swedish; - case "Spanish": - return Language.Spanish; - case "Sorani": - return Language.Sorani; - case "Russian": - return Language.Russian; - case "Romanian": - return Language.Romanian; - case "Portuguese": - return Language.Portuguese; - case "Persian": - return Language.Persian; - case "Norwegian": - return Language.Norwegian; - case "Latvian": - return Language.Latvian; - case "Italian": - return Language.Italian; - case "Irish": - return Language.Irish; - case "Indonesian": - return Language.Indonesian; - case "Hungarian": - return Language.Hungarian; - case "Hindi": - return Language.Hindi; - case "Greek": - return Language.Greek; - case "German": - return Language.German; - case "Galician": - return Language.Galician; - case "French": - return Language.French; - case "Finnish": - return Language.Finnish; - case "Estonian": - return Language.Estonian; - case "English": - return Language.English; - case "Dutch": - return Language.Dutch; - case "Danish": - return Language.Danish; - case "Czech": - return Language.Czech; - case "Cjk": - return Language.Cjk; - case "Chinese": - return Language.Chinese; - case "Catalan": - return Language.Catalan; - case "Bulgarian": - return Language.Bulgarian; - case "Brazilian": - return Language.Brazilian; - case "Basque": - return Language.Basque; - case "Armenian": - return Language.Armenian; - case "Arabic": - return Language.Arabic; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, Language value, JsonSerializerOptions options) + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSide value, System.Text.Json.JsonSerializerOptions options) { - switch (value) - { - case Language.Turkish: - writer.WriteStringValue("Turkish"); - return; - case Language.Thai: - writer.WriteStringValue("Thai"); - return; - case Language.Swedish: - writer.WriteStringValue("Swedish"); - return; - case Language.Spanish: - writer.WriteStringValue("Spanish"); - return; - case Language.Sorani: - writer.WriteStringValue("Sorani"); - return; - case Language.Russian: - writer.WriteStringValue("Russian"); - return; - case Language.Romanian: - writer.WriteStringValue("Romanian"); - return; - case Language.Portuguese: - writer.WriteStringValue("Portuguese"); - return; - case Language.Persian: - writer.WriteStringValue("Persian"); - return; - case Language.Norwegian: - writer.WriteStringValue("Norwegian"); - return; - case Language.Latvian: - writer.WriteStringValue("Latvian"); - return; - case Language.Italian: - writer.WriteStringValue("Italian"); - return; - case Language.Irish: - writer.WriteStringValue("Irish"); - return; - case Language.Indonesian: - writer.WriteStringValue("Indonesian"); - return; - case Language.Hungarian: - writer.WriteStringValue("Hungarian"); - return; - case Language.Hindi: - writer.WriteStringValue("Hindi"); - return; - case Language.Greek: - writer.WriteStringValue("Greek"); - return; - case Language.German: - writer.WriteStringValue("German"); - return; - case Language.Galician: - writer.WriteStringValue("Galician"); - return; - case Language.French: - writer.WriteStringValue("French"); - return; - case Language.Finnish: - writer.WriteStringValue("Finnish"); - return; - case Language.Estonian: - writer.WriteStringValue("Estonian"); - return; - case Language.English: - writer.WriteStringValue("English"); - return; - case Language.Dutch: - writer.WriteStringValue("Dutch"); - return; - case Language.Danish: - writer.WriteStringValue("Danish"); - return; - case Language.Czech: - writer.WriteStringValue("Czech"); - return; - case Language.Cjk: - writer.WriteStringValue("Cjk"); - return; - case Language.Chinese: - writer.WriteStringValue("Chinese"); - return; - case Language.Catalan: - writer.WriteStringValue("Catalan"); - return; - case Language.Bulgarian: - writer.WriteStringValue("Bulgarian"); - return; - case Language.Brazilian: - writer.WriteStringValue("Brazilian"); - return; - case Language.Basque: - writer.WriteStringValue("Basque"); - return; - case Language.Armenian: - writer.WriteStringValue("Armenian"); - return; - case Language.Arabic: - writer.WriteStringValue("Arabic"); - return; - } - - writer.WriteNullValue(); + Write(writer, value, options); } } -[JsonConverter(typeof(NoriDecompoundModeConverter))] -public enum NoriDecompoundMode +internal sealed partial class KeepTypesModeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "mixed")] - Mixed, - [EnumMember(Value = "discard")] - Discard -} + private static readonly System.Text.Json.JsonEncodedText MemberExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText MemberInclude = System.Text.Json.JsonEncodedText.Encode("include"); -internal sealed class NoriDecompoundModeConverter : JsonConverter -{ - public override NoriDecompoundMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberExclude)) + { + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Exclude; + } + + if (reader.ValueTextEquals(MemberInclude)) + { + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Include; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberExclude.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Exclude; + } + + if (string.Equals(value, MemberInclude.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "none": - return NoriDecompoundMode.None; - case "mixed": - return NoriDecompoundMode.Mixed; - case "discard": - return NoriDecompoundMode.Discard; + return Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Include; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode)}'."); } - public override void Write(Utf8JsonWriter writer, NoriDecompoundMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case NoriDecompoundMode.None: - writer.WriteStringValue("none"); - return; - case NoriDecompoundMode.Mixed: - writer.WriteStringValue("mixed"); - return; - case NoriDecompoundMode.Discard: - writer.WriteStringValue("discard"); - return; + case Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Exclude: + writer.WriteStringValue(MemberExclude); + break; + case Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode.Include: + writer.WriteStringValue(MemberInclude); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(PhoneticEncoderConverter))] -public enum PhoneticEncoder -{ - [EnumMember(Value = "soundex")] - Soundex, - [EnumMember(Value = "refined_soundex")] - RefinedSoundex, - [EnumMember(Value = "nysiis")] - Nysiis, - [EnumMember(Value = "metaphone")] - Metaphone, - [EnumMember(Value = "koelnerphonetik")] - Koelnerphonetik, - [EnumMember(Value = "haasephonetik")] - Haasephonetik, - [EnumMember(Value = "double_metaphone")] - DoubleMetaphone, - [EnumMember(Value = "daitch_mokotoff")] - DaitchMokotoff, - [EnumMember(Value = "cologne")] - Cologne, - [EnumMember(Value = "caverphone2")] - Caverphone2, - [EnumMember(Value = "caverphone1")] - Caverphone1, - [EnumMember(Value = "beider_morse")] - BeiderMorse + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KeepTypesMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class PhoneticEncoderConverter : JsonConverter +internal sealed partial class SnowballLanguageConverter : System.Text.Json.Serialization.JsonConverter { - public override PhoneticEncoder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "soundex": - return PhoneticEncoder.Soundex; - case "refined_soundex": - return PhoneticEncoder.RefinedSoundex; - case "nysiis": - return PhoneticEncoder.Nysiis; - case "metaphone": - return PhoneticEncoder.Metaphone; - case "koelnerphonetik": - return PhoneticEncoder.Koelnerphonetik; - case "haasephonetik": - return PhoneticEncoder.Haasephonetik; - case "double_metaphone": - return PhoneticEncoder.DoubleMetaphone; - case "daitch_mokotoff": - return PhoneticEncoder.DaitchMokotoff; - case "cologne": - return PhoneticEncoder.Cologne; - case "caverphone2": - return PhoneticEncoder.Caverphone2; - case "caverphone1": - return PhoneticEncoder.Caverphone1; - case "beider_morse": - return PhoneticEncoder.BeiderMorse; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, PhoneticEncoder value, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberArmenian = System.Text.Json.JsonEncodedText.Encode("Armenian"); + private static readonly System.Text.Json.JsonEncodedText MemberBasque = System.Text.Json.JsonEncodedText.Encode("Basque"); + private static readonly System.Text.Json.JsonEncodedText MemberCatalan = System.Text.Json.JsonEncodedText.Encode("Catalan"); + private static readonly System.Text.Json.JsonEncodedText MemberDanish = System.Text.Json.JsonEncodedText.Encode("Danish"); + private static readonly System.Text.Json.JsonEncodedText MemberDutch = System.Text.Json.JsonEncodedText.Encode("Dutch"); + private static readonly System.Text.Json.JsonEncodedText MemberEnglish = System.Text.Json.JsonEncodedText.Encode("English"); + private static readonly System.Text.Json.JsonEncodedText MemberFinnish = System.Text.Json.JsonEncodedText.Encode("Finnish"); + private static readonly System.Text.Json.JsonEncodedText MemberFrench = System.Text.Json.JsonEncodedText.Encode("French"); + private static readonly System.Text.Json.JsonEncodedText MemberGerman = System.Text.Json.JsonEncodedText.Encode("German"); + private static readonly System.Text.Json.JsonEncodedText MemberGerman2 = System.Text.Json.JsonEncodedText.Encode("German2"); + private static readonly System.Text.Json.JsonEncodedText MemberHungarian = System.Text.Json.JsonEncodedText.Encode("Hungarian"); + private static readonly System.Text.Json.JsonEncodedText MemberItalian = System.Text.Json.JsonEncodedText.Encode("Italian"); + private static readonly System.Text.Json.JsonEncodedText MemberKp = System.Text.Json.JsonEncodedText.Encode("Kp"); + private static readonly System.Text.Json.JsonEncodedText MemberLovins = System.Text.Json.JsonEncodedText.Encode("Lovins"); + private static readonly System.Text.Json.JsonEncodedText MemberNorwegian = System.Text.Json.JsonEncodedText.Encode("Norwegian"); + private static readonly System.Text.Json.JsonEncodedText MemberPorter = System.Text.Json.JsonEncodedText.Encode("Porter"); + private static readonly System.Text.Json.JsonEncodedText MemberPortuguese = System.Text.Json.JsonEncodedText.Encode("Portuguese"); + private static readonly System.Text.Json.JsonEncodedText MemberRomanian = System.Text.Json.JsonEncodedText.Encode("Romanian"); + private static readonly System.Text.Json.JsonEncodedText MemberRussian = System.Text.Json.JsonEncodedText.Encode("Russian"); + private static readonly System.Text.Json.JsonEncodedText MemberSpanish = System.Text.Json.JsonEncodedText.Encode("Spanish"); + private static readonly System.Text.Json.JsonEncodedText MemberSwedish = System.Text.Json.JsonEncodedText.Encode("Swedish"); + private static readonly System.Text.Json.JsonEncodedText MemberTurkish = System.Text.Json.JsonEncodedText.Encode("Turkish"); + + public override Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - switch (value) + if (reader.ValueTextEquals(MemberArmenian)) { - case PhoneticEncoder.Soundex: - writer.WriteStringValue("soundex"); - return; - case PhoneticEncoder.RefinedSoundex: - writer.WriteStringValue("refined_soundex"); - return; - case PhoneticEncoder.Nysiis: - writer.WriteStringValue("nysiis"); - return; - case PhoneticEncoder.Metaphone: - writer.WriteStringValue("metaphone"); - return; - case PhoneticEncoder.Koelnerphonetik: - writer.WriteStringValue("koelnerphonetik"); - return; - case PhoneticEncoder.Haasephonetik: - writer.WriteStringValue("haasephonetik"); - return; - case PhoneticEncoder.DoubleMetaphone: - writer.WriteStringValue("double_metaphone"); - return; - case PhoneticEncoder.DaitchMokotoff: - writer.WriteStringValue("daitch_mokotoff"); - return; - case PhoneticEncoder.Cologne: - writer.WriteStringValue("cologne"); - return; - case PhoneticEncoder.Caverphone2: - writer.WriteStringValue("caverphone2"); - return; - case PhoneticEncoder.Caverphone1: - writer.WriteStringValue("caverphone1"); - return; - case PhoneticEncoder.BeiderMorse: - writer.WriteStringValue("beider_morse"); - return; - } - - writer.WriteNullValue(); - } -} + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Armenian; + } -[JsonConverter(typeof(PhoneticLanguageConverter))] -public enum PhoneticLanguage -{ - [EnumMember(Value = "spanish")] - Spanish, - [EnumMember(Value = "russian")] - Russian, - [EnumMember(Value = "romanian")] - Romanian, - [EnumMember(Value = "polish")] - Polish, - [EnumMember(Value = "hungarian")] - Hungarian, - [EnumMember(Value = "hebrew")] - Hebrew, - [EnumMember(Value = "german")] - German, - [EnumMember(Value = "french")] - French, - [EnumMember(Value = "english")] - English, - [EnumMember(Value = "cyrillic")] - Cyrillic, - [EnumMember(Value = "common")] - Common, - [EnumMember(Value = "any")] - Any -} + if (reader.ValueTextEquals(MemberBasque)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Basque; + } -internal sealed class PhoneticLanguageConverter : JsonConverter -{ - public override PhoneticLanguage Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "spanish": - return PhoneticLanguage.Spanish; - case "russian": - return PhoneticLanguage.Russian; - case "romanian": - return PhoneticLanguage.Romanian; - case "polish": - return PhoneticLanguage.Polish; - case "hungarian": - return PhoneticLanguage.Hungarian; - case "hebrew": - return PhoneticLanguage.Hebrew; - case "german": - return PhoneticLanguage.German; - case "french": - return PhoneticLanguage.French; - case "english": - return PhoneticLanguage.English; - case "cyrillic": - return PhoneticLanguage.Cyrillic; - case "common": - return PhoneticLanguage.Common; - case "any": - return PhoneticLanguage.Any; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, PhoneticLanguage value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberCatalan)) { - case PhoneticLanguage.Spanish: - writer.WriteStringValue("spanish"); - return; - case PhoneticLanguage.Russian: - writer.WriteStringValue("russian"); - return; - case PhoneticLanguage.Romanian: - writer.WriteStringValue("romanian"); - return; - case PhoneticLanguage.Polish: - writer.WriteStringValue("polish"); - return; - case PhoneticLanguage.Hungarian: - writer.WriteStringValue("hungarian"); - return; - case PhoneticLanguage.Hebrew: - writer.WriteStringValue("hebrew"); - return; - case PhoneticLanguage.German: - writer.WriteStringValue("german"); - return; - case PhoneticLanguage.French: - writer.WriteStringValue("french"); - return; - case PhoneticLanguage.English: - writer.WriteStringValue("english"); - return; - case PhoneticLanguage.Cyrillic: - writer.WriteStringValue("cyrillic"); - return; - case PhoneticLanguage.Common: - writer.WriteStringValue("common"); - return; - case PhoneticLanguage.Any: - writer.WriteStringValue("any"); - return; - } - - writer.WriteNullValue(); - } -} + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Catalan; + } -[JsonConverter(typeof(PhoneticNameTypeConverter))] -public enum PhoneticNameType -{ - [EnumMember(Value = "sephardic")] - Sephardic, - [EnumMember(Value = "generic")] - Generic, - [EnumMember(Value = "ashkenazi")] - Ashkenazi -} + if (reader.ValueTextEquals(MemberDanish)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Danish; + } -internal sealed class PhoneticNameTypeConverter : JsonConverter -{ - public override PhoneticNameType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDutch)) { - case "sephardic": - return PhoneticNameType.Sephardic; - case "generic": - return PhoneticNameType.Generic; - case "ashkenazi": - return PhoneticNameType.Ashkenazi; + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Dutch; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberEnglish)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.English; + } - public override void Write(Utf8JsonWriter writer, PhoneticNameType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberFinnish)) { - case PhoneticNameType.Sephardic: - writer.WriteStringValue("sephardic"); - return; - case PhoneticNameType.Generic: - writer.WriteStringValue("generic"); - return; - case PhoneticNameType.Ashkenazi: - writer.WriteStringValue("ashkenazi"); - return; + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Finnish; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberFrench)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.French; + } -[JsonConverter(typeof(PhoneticRuleTypeConverter))] -public enum PhoneticRuleType -{ - [EnumMember(Value = "exact")] - Exact, - [EnumMember(Value = "approx")] - Approx -} + if (reader.ValueTextEquals(MemberGerman)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German; + } -internal sealed class PhoneticRuleTypeConverter : JsonConverter -{ - public override PhoneticRuleType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGerman2)) { - case "exact": - return PhoneticRuleType.Exact; - case "approx": - return PhoneticRuleType.Approx; + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German2; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberHungarian)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Hungarian; + } - public override void Write(Utf8JsonWriter writer, PhoneticRuleType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberItalian)) { - case PhoneticRuleType.Exact: - writer.WriteStringValue("exact"); - return; - case PhoneticRuleType.Approx: - writer.WriteStringValue("approx"); - return; + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Italian; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberKp)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Kp; + } -[JsonConverter(typeof(SnowballLanguageConverter))] -public enum SnowballLanguage -{ - [EnumMember(Value = "Turkish")] - Turkish, - [EnumMember(Value = "Swedish")] - Swedish, - [EnumMember(Value = "Spanish")] - Spanish, - [EnumMember(Value = "Russian")] - Russian, - [EnumMember(Value = "Romanian")] - Romanian, - [EnumMember(Value = "Portuguese")] - Portuguese, - [EnumMember(Value = "Porter")] - Porter, - [EnumMember(Value = "Norwegian")] - Norwegian, - [EnumMember(Value = "Lovins")] - Lovins, - [EnumMember(Value = "Kp")] - Kp, - [EnumMember(Value = "Italian")] - Italian, - [EnumMember(Value = "Hungarian")] - Hungarian, - [EnumMember(Value = "German2")] - German2, - [EnumMember(Value = "German")] - German, - [EnumMember(Value = "French")] - French, - [EnumMember(Value = "Finnish")] - Finnish, - [EnumMember(Value = "English")] - English, - [EnumMember(Value = "Dutch")] - Dutch, - [EnumMember(Value = "Danish")] - Danish, - [EnumMember(Value = "Catalan")] - Catalan, - [EnumMember(Value = "Basque")] - Basque, - [EnumMember(Value = "Armenian")] - Armenian + if (reader.ValueTextEquals(MemberLovins)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Lovins; + } + + if (reader.ValueTextEquals(MemberNorwegian)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Norwegian; + } + + if (reader.ValueTextEquals(MemberPorter)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Porter; + } + + if (reader.ValueTextEquals(MemberPortuguese)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Portuguese; + } + + if (reader.ValueTextEquals(MemberRomanian)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Romanian; + } + + if (reader.ValueTextEquals(MemberRussian)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Russian; + } + + if (reader.ValueTextEquals(MemberSpanish)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Spanish; + } + + if (reader.ValueTextEquals(MemberSwedish)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Swedish; + } + + if (reader.ValueTextEquals(MemberTurkish)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Turkish; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberArmenian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Armenian; + } + + if (string.Equals(value, MemberBasque.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Basque; + } + + if (string.Equals(value, MemberCatalan.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Catalan; + } + + if (string.Equals(value, MemberDanish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Danish; + } + + if (string.Equals(value, MemberDutch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Dutch; + } + + if (string.Equals(value, MemberEnglish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.English; + } + + if (string.Equals(value, MemberFinnish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Finnish; + } + + if (string.Equals(value, MemberFrench.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.French; + } + + if (string.Equals(value, MemberGerman.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German; + } + + if (string.Equals(value, MemberGerman2.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German2; + } + + if (string.Equals(value, MemberHungarian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Hungarian; + } + + if (string.Equals(value, MemberItalian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Italian; + } + + if (string.Equals(value, MemberKp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Kp; + } + + if (string.Equals(value, MemberLovins.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Lovins; + } + + if (string.Equals(value, MemberNorwegian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Norwegian; + } + + if (string.Equals(value, MemberPorter.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Porter; + } + + if (string.Equals(value, MemberPortuguese.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Portuguese; + } + + if (string.Equals(value, MemberRomanian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Romanian; + } + + if (string.Equals(value, MemberRussian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Russian; + } + + if (string.Equals(value, MemberSpanish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Spanish; + } + + if (string.Equals(value, MemberSwedish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Swedish; + } + + if (string.Equals(value, MemberTurkish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Turkish; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Armenian: + writer.WriteStringValue(MemberArmenian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Basque: + writer.WriteStringValue(MemberBasque); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Catalan: + writer.WriteStringValue(MemberCatalan); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Danish: + writer.WriteStringValue(MemberDanish); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Dutch: + writer.WriteStringValue(MemberDutch); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.English: + writer.WriteStringValue(MemberEnglish); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Finnish: + writer.WriteStringValue(MemberFinnish); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.French: + writer.WriteStringValue(MemberFrench); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German: + writer.WriteStringValue(MemberGerman); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.German2: + writer.WriteStringValue(MemberGerman2); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Hungarian: + writer.WriteStringValue(MemberHungarian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Italian: + writer.WriteStringValue(MemberItalian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Kp: + writer.WriteStringValue(MemberKp); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Lovins: + writer.WriteStringValue(MemberLovins); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Norwegian: + writer.WriteStringValue(MemberNorwegian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Porter: + writer.WriteStringValue(MemberPorter); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Portuguese: + writer.WriteStringValue(MemberPortuguese); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Romanian: + writer.WriteStringValue(MemberRomanian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Russian: + writer.WriteStringValue(MemberRussian); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Spanish: + writer.WriteStringValue(MemberSpanish); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Swedish: + writer.WriteStringValue(MemberSwedish); + break; + case Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage.Turkish: + writer.WriteStringValue(MemberTurkish); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SnowballLanguage value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SnowballLanguageConverter : JsonConverter +internal sealed partial class SynonymFormatConverter : System.Text.Json.Serialization.JsonConverter { - public override SnowballLanguage Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "Turkish": - return SnowballLanguage.Turkish; - case "Swedish": - return SnowballLanguage.Swedish; - case "Spanish": - return SnowballLanguage.Spanish; - case "Russian": - return SnowballLanguage.Russian; - case "Romanian": - return SnowballLanguage.Romanian; - case "Portuguese": - return SnowballLanguage.Portuguese; - case "Porter": - return SnowballLanguage.Porter; - case "Norwegian": - return SnowballLanguage.Norwegian; - case "Lovins": - return SnowballLanguage.Lovins; - case "Kp": - return SnowballLanguage.Kp; - case "Italian": - return SnowballLanguage.Italian; - case "Hungarian": - return SnowballLanguage.Hungarian; - case "German2": - return SnowballLanguage.German2; - case "German": - return SnowballLanguage.German; - case "French": - return SnowballLanguage.French; - case "Finnish": - return SnowballLanguage.Finnish; - case "English": - return SnowballLanguage.English; - case "Dutch": - return SnowballLanguage.Dutch; - case "Danish": - return SnowballLanguage.Danish; - case "Catalan": - return SnowballLanguage.Catalan; - case "Basque": - return SnowballLanguage.Basque; - case "Armenian": - return SnowballLanguage.Armenian; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SnowballLanguage value, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberSolr = System.Text.Json.JsonEncodedText.Encode("solr"); + private static readonly System.Text.Json.JsonEncodedText MemberWordnet = System.Text.Json.JsonEncodedText.Encode("wordnet"); + + public override Elastic.Clients.Elasticsearch.Analysis.SynonymFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberSolr)) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Solr; + } + + if (reader.ValueTextEquals(MemberWordnet)) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Wordnet; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberSolr.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Solr; + } + + if (string.Equals(value, MemberWordnet.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Wordnet; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SynonymFormat value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SnowballLanguage.Turkish: - writer.WriteStringValue("Turkish"); - return; - case SnowballLanguage.Swedish: - writer.WriteStringValue("Swedish"); - return; - case SnowballLanguage.Spanish: - writer.WriteStringValue("Spanish"); - return; - case SnowballLanguage.Russian: - writer.WriteStringValue("Russian"); - return; - case SnowballLanguage.Romanian: - writer.WriteStringValue("Romanian"); - return; - case SnowballLanguage.Portuguese: - writer.WriteStringValue("Portuguese"); - return; - case SnowballLanguage.Porter: - writer.WriteStringValue("Porter"); - return; - case SnowballLanguage.Norwegian: - writer.WriteStringValue("Norwegian"); - return; - case SnowballLanguage.Lovins: - writer.WriteStringValue("Lovins"); - return; - case SnowballLanguage.Kp: - writer.WriteStringValue("Kp"); - return; - case SnowballLanguage.Italian: - writer.WriteStringValue("Italian"); - return; - case SnowballLanguage.Hungarian: - writer.WriteStringValue("Hungarian"); - return; - case SnowballLanguage.German2: - writer.WriteStringValue("German2"); - return; - case SnowballLanguage.German: - writer.WriteStringValue("German"); - return; - case SnowballLanguage.French: - writer.WriteStringValue("French"); - return; - case SnowballLanguage.Finnish: - writer.WriteStringValue("Finnish"); - return; - case SnowballLanguage.English: - writer.WriteStringValue("English"); - return; - case SnowballLanguage.Dutch: - writer.WriteStringValue("Dutch"); - return; - case SnowballLanguage.Danish: - writer.WriteStringValue("Danish"); - return; - case SnowballLanguage.Catalan: - writer.WriteStringValue("Catalan"); - return; - case SnowballLanguage.Basque: - writer.WriteStringValue("Basque"); - return; - case SnowballLanguage.Armenian: - writer.WriteStringValue("Armenian"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Solr: + writer.WriteStringValue(MemberSolr); + break; + case Elastic.Clients.Elasticsearch.Analysis.SynonymFormat.Wordnet: + writer.WriteStringValue(MemberWordnet); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.SynonymFormat)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.SynonymFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.SynonymFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(SynonymFormatConverter))] -public enum SynonymFormat +internal sealed partial class IcuCollationAlternateConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "wordnet")] - Wordnet, - [EnumMember(Value = "solr")] - Solr + private static readonly System.Text.Json.JsonEncodedText MemberNonIgnorable = System.Text.Json.JsonEncodedText.Encode("non-ignorable"); + private static readonly System.Text.Json.JsonEncodedText MemberShifted = System.Text.Json.JsonEncodedText.Encode("shifted"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberNonIgnorable)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.NonIgnorable; + } + + if (reader.ValueTextEquals(MemberShifted)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.Shifted; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberNonIgnorable.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.NonIgnorable; + } + + if (string.Equals(value, MemberShifted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.Shifted; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.NonIgnorable: + writer.WriteStringValue(MemberNonIgnorable); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate.Shifted: + writer.WriteStringValue(MemberShifted); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SynonymFormatConverter : JsonConverter +internal sealed partial class IcuCollationCaseFirstConverter : System.Text.Json.Serialization.JsonConverter { - public override SynonymFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberLower = System.Text.Json.JsonEncodedText.Encode("lower"); + private static readonly System.Text.Json.JsonEncodedText MemberUpper = System.Text.Json.JsonEncodedText.Encode("upper"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberLower)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Lower; + } + + if (reader.ValueTextEquals(MemberUpper)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Upper; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberLower.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Lower; + } + + if (string.Equals(value, MemberUpper.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "wordnet": - return SynonymFormat.Wordnet; - case "solr": - return SynonymFormat.Solr; + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Upper; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst)}'."); } - public override void Write(Utf8JsonWriter writer, SynonymFormat value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SynonymFormat.Wordnet: - writer.WriteStringValue("wordnet"); - return; - case SynonymFormat.Solr: - writer.WriteStringValue("solr"); - return; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Lower: + writer.WriteStringValue(MemberLower); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst.Upper: + writer.WriteStringValue(MemberUpper); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(TokenCharConverter))] -public enum TokenChar +internal sealed partial class IcuCollationDecompositionConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "whitespace")] - Whitespace, - [EnumMember(Value = "symbol")] - Symbol, - [EnumMember(Value = "punctuation")] - Punctuation, - [EnumMember(Value = "letter")] - Letter, - [EnumMember(Value = "digit")] - Digit, - [EnumMember(Value = "custom")] - Custom + private static readonly System.Text.Json.JsonEncodedText MemberIdentical = System.Text.Json.JsonEncodedText.Encode("identical"); + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("no"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberIdentical)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.Identical; + } + + if (reader.ValueTextEquals(MemberNo)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.No; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberIdentical.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.Identical; + } + + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.No; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.Identical: + writer.WriteStringValue(MemberIdentical); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition.No: + writer.WriteStringValue(MemberNo); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class TokenCharConverter : JsonConverter +internal sealed partial class IcuCollationStrengthConverter : System.Text.Json.Serialization.JsonConverter { - public override TokenChar Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberIdentical = System.Text.Json.JsonEncodedText.Encode("identical"); + private static readonly System.Text.Json.JsonEncodedText MemberPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText MemberQuaternary = System.Text.Json.JsonEncodedText.Encode("quaternary"); + private static readonly System.Text.Json.JsonEncodedText MemberSecondary = System.Text.Json.JsonEncodedText.Encode("secondary"); + private static readonly System.Text.Json.JsonEncodedText MemberTertiary = System.Text.Json.JsonEncodedText.Encode("tertiary"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberIdentical)) { - case "whitespace": - return TokenChar.Whitespace; - case "symbol": - return TokenChar.Symbol; - case "punctuation": - return TokenChar.Punctuation; - case "letter": - return TokenChar.Letter; - case "digit": - return TokenChar.Digit; - case "custom": - return TokenChar.Custom; + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Identical; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberPrimary)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Primary; + } + + if (reader.ValueTextEquals(MemberQuaternary)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Quaternary; + } + + if (reader.ValueTextEquals(MemberSecondary)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Secondary; + } + + if (reader.ValueTextEquals(MemberTertiary)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Tertiary; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberIdentical.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Identical; + } + + if (string.Equals(value, MemberPrimary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Primary; + } + + if (string.Equals(value, MemberQuaternary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Quaternary; + } + + if (string.Equals(value, MemberSecondary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Secondary; + } + + if (string.Equals(value, MemberTertiary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Tertiary; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength)}'."); } - public override void Write(Utf8JsonWriter writer, TokenChar value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case TokenChar.Whitespace: - writer.WriteStringValue("whitespace"); - return; - case TokenChar.Symbol: - writer.WriteStringValue("symbol"); - return; - case TokenChar.Punctuation: - writer.WriteStringValue("punctuation"); - return; - case TokenChar.Letter: - writer.WriteStringValue("letter"); - return; - case TokenChar.Digit: - writer.WriteStringValue("digit"); - return; - case TokenChar.Custom: - writer.WriteStringValue("custom"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Identical: + writer.WriteStringValue(MemberIdentical); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Primary: + writer.WriteStringValue(MemberPrimary); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Quaternary: + writer.WriteStringValue(MemberQuaternary); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Secondary: + writer.WriteStringValue(MemberSecondary); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength.Tertiary: + writer.WriteStringValue(MemberTertiary); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength)}'."); + } } + + public override Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class IcuTransformDirectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberForward = System.Text.Json.JsonEncodedText.Encode("forward"); + private static readonly System.Text.Json.JsonEncodedText MemberReverse = System.Text.Json.JsonEncodedText.Encode("reverse"); + + public override Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberForward)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Forward; + } + + if (reader.ValueTextEquals(MemberReverse)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Reverse; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberForward.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Forward; + } + + if (string.Equals(value, MemberReverse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Reverse; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Forward: + writer.WriteStringValue(MemberForward); + break; + case Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection.Reverse: + writer.WriteStringValue(MemberReverse); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirection value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class PhoneticEncoderConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBeiderMorse = System.Text.Json.JsonEncodedText.Encode("beider_morse"); + private static readonly System.Text.Json.JsonEncodedText MemberCaverphone1 = System.Text.Json.JsonEncodedText.Encode("caverphone1"); + private static readonly System.Text.Json.JsonEncodedText MemberCaverphone2 = System.Text.Json.JsonEncodedText.Encode("caverphone2"); + private static readonly System.Text.Json.JsonEncodedText MemberCologne = System.Text.Json.JsonEncodedText.Encode("cologne"); + private static readonly System.Text.Json.JsonEncodedText MemberDaitchMokotoff = System.Text.Json.JsonEncodedText.Encode("daitch_mokotoff"); + private static readonly System.Text.Json.JsonEncodedText MemberDoubleMetaphone = System.Text.Json.JsonEncodedText.Encode("double_metaphone"); + private static readonly System.Text.Json.JsonEncodedText MemberHaasephonetik = System.Text.Json.JsonEncodedText.Encode("haasephonetik"); + private static readonly System.Text.Json.JsonEncodedText MemberKoelnerphonetik = System.Text.Json.JsonEncodedText.Encode("koelnerphonetik"); + private static readonly System.Text.Json.JsonEncodedText MemberMetaphone = System.Text.Json.JsonEncodedText.Encode("metaphone"); + private static readonly System.Text.Json.JsonEncodedText MemberNysiis = System.Text.Json.JsonEncodedText.Encode("nysiis"); + private static readonly System.Text.Json.JsonEncodedText MemberRefinedSoundex = System.Text.Json.JsonEncodedText.Encode("refined_soundex"); + private static readonly System.Text.Json.JsonEncodedText MemberSoundex = System.Text.Json.JsonEncodedText.Encode("soundex"); + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBeiderMorse)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.BeiderMorse; + } + + if (reader.ValueTextEquals(MemberCaverphone1)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone1; + } + + if (reader.ValueTextEquals(MemberCaverphone2)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone2; + } + + if (reader.ValueTextEquals(MemberCologne)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Cologne; + } + + if (reader.ValueTextEquals(MemberDaitchMokotoff)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DaitchMokotoff; + } + + if (reader.ValueTextEquals(MemberDoubleMetaphone)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DoubleMetaphone; + } + + if (reader.ValueTextEquals(MemberHaasephonetik)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Haasephonetik; + } + + if (reader.ValueTextEquals(MemberKoelnerphonetik)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Koelnerphonetik; + } + + if (reader.ValueTextEquals(MemberMetaphone)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Metaphone; + } + + if (reader.ValueTextEquals(MemberNysiis)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Nysiis; + } + + if (reader.ValueTextEquals(MemberRefinedSoundex)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.RefinedSoundex; + } + + if (reader.ValueTextEquals(MemberSoundex)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Soundex; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBeiderMorse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.BeiderMorse; + } + + if (string.Equals(value, MemberCaverphone1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone1; + } + + if (string.Equals(value, MemberCaverphone2.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone2; + } + + if (string.Equals(value, MemberCologne.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Cologne; + } + + if (string.Equals(value, MemberDaitchMokotoff.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DaitchMokotoff; + } + + if (string.Equals(value, MemberDoubleMetaphone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DoubleMetaphone; + } + + if (string.Equals(value, MemberHaasephonetik.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Haasephonetik; + } + + if (string.Equals(value, MemberKoelnerphonetik.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Koelnerphonetik; + } + + if (string.Equals(value, MemberMetaphone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Metaphone; + } + + if (string.Equals(value, MemberNysiis.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Nysiis; + } + + if (string.Equals(value, MemberRefinedSoundex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.RefinedSoundex; + } + + if (string.Equals(value, MemberSoundex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Soundex; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.BeiderMorse: + writer.WriteStringValue(MemberBeiderMorse); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone1: + writer.WriteStringValue(MemberCaverphone1); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Caverphone2: + writer.WriteStringValue(MemberCaverphone2); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Cologne: + writer.WriteStringValue(MemberCologne); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DaitchMokotoff: + writer.WriteStringValue(MemberDaitchMokotoff); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.DoubleMetaphone: + writer.WriteStringValue(MemberDoubleMetaphone); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Haasephonetik: + writer.WriteStringValue(MemberHaasephonetik); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Koelnerphonetik: + writer.WriteStringValue(MemberKoelnerphonetik); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Metaphone: + writer.WriteStringValue(MemberMetaphone); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Nysiis: + writer.WriteStringValue(MemberNysiis); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.RefinedSoundex: + writer.WriteStringValue(MemberRefinedSoundex); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder.Soundex: + writer.WriteStringValue(MemberSoundex); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class PhoneticNameTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAshkenazi = System.Text.Json.JsonEncodedText.Encode("ashkenazi"); + private static readonly System.Text.Json.JsonEncodedText MemberGeneric = System.Text.Json.JsonEncodedText.Encode("generic"); + private static readonly System.Text.Json.JsonEncodedText MemberSephardic = System.Text.Json.JsonEncodedText.Encode("sephardic"); + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAshkenazi)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Ashkenazi; + } + + if (reader.ValueTextEquals(MemberGeneric)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Generic; + } + + if (reader.ValueTextEquals(MemberSephardic)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Sephardic; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAshkenazi.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Ashkenazi; + } + + if (string.Equals(value, MemberGeneric.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Generic; + } + + if (string.Equals(value, MemberSephardic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Sephardic; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Ashkenazi: + writer.WriteStringValue(MemberAshkenazi); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Generic: + writer.WriteStringValue(MemberGeneric); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType.Sephardic: + writer.WriteStringValue(MemberSephardic); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticNameType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class PhoneticRuleTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberApprox = System.Text.Json.JsonEncodedText.Encode("approx"); + private static readonly System.Text.Json.JsonEncodedText MemberExact = System.Text.Json.JsonEncodedText.Encode("exact"); + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberApprox)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Approx; + } + + if (reader.ValueTextEquals(MemberExact)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Exact; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberApprox.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Approx; + } + + if (string.Equals(value, MemberExact.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Exact; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Approx: + writer.WriteStringValue(MemberApprox); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType.Exact: + writer.WriteStringValue(MemberExact); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class TokenCharConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCustom = System.Text.Json.JsonEncodedText.Encode("custom"); + private static readonly System.Text.Json.JsonEncodedText MemberDigit = System.Text.Json.JsonEncodedText.Encode("digit"); + private static readonly System.Text.Json.JsonEncodedText MemberLetter = System.Text.Json.JsonEncodedText.Encode("letter"); + private static readonly System.Text.Json.JsonEncodedText MemberPunctuation = System.Text.Json.JsonEncodedText.Encode("punctuation"); + private static readonly System.Text.Json.JsonEncodedText MemberSymbol = System.Text.Json.JsonEncodedText.Encode("symbol"); + private static readonly System.Text.Json.JsonEncodedText MemberWhitespace = System.Text.Json.JsonEncodedText.Encode("whitespace"); + + public override Elastic.Clients.Elasticsearch.Analysis.TokenChar Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCustom)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Custom; + } + + if (reader.ValueTextEquals(MemberDigit)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Digit; + } + + if (reader.ValueTextEquals(MemberLetter)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Letter; + } + + if (reader.ValueTextEquals(MemberPunctuation)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Punctuation; + } + + if (reader.ValueTextEquals(MemberSymbol)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Symbol; + } + + if (reader.ValueTextEquals(MemberWhitespace)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Whitespace; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCustom.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Custom; + } + + if (string.Equals(value, MemberDigit.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Digit; + } + + if (string.Equals(value, MemberLetter.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Letter; + } + + if (string.Equals(value, MemberPunctuation.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Punctuation; + } + + if (string.Equals(value, MemberSymbol.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Symbol; + } + + if (string.Equals(value, MemberWhitespace.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.TokenChar.Whitespace; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.TokenChar)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TokenChar value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Custom: + writer.WriteStringValue(MemberCustom); + break; + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Digit: + writer.WriteStringValue(MemberDigit); + break; + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Letter: + writer.WriteStringValue(MemberLetter); + break; + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Punctuation: + writer.WriteStringValue(MemberPunctuation); + break; + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Symbol: + writer.WriteStringValue(MemberSymbol); + break; + case Elastic.Clients.Elasticsearch.Analysis.TokenChar.Whitespace: + writer.WriteStringValue(MemberWhitespace); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.TokenChar)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.TokenChar ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.TokenChar value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class PhoneticLanguageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAny = System.Text.Json.JsonEncodedText.Encode("any"); + private static readonly System.Text.Json.JsonEncodedText MemberCommon = System.Text.Json.JsonEncodedText.Encode("common"); + private static readonly System.Text.Json.JsonEncodedText MemberCyrillic = System.Text.Json.JsonEncodedText.Encode("cyrillic"); + private static readonly System.Text.Json.JsonEncodedText MemberEnglish = System.Text.Json.JsonEncodedText.Encode("english"); + private static readonly System.Text.Json.JsonEncodedText MemberFrench = System.Text.Json.JsonEncodedText.Encode("french"); + private static readonly System.Text.Json.JsonEncodedText MemberGerman = System.Text.Json.JsonEncodedText.Encode("german"); + private static readonly System.Text.Json.JsonEncodedText MemberHebrew = System.Text.Json.JsonEncodedText.Encode("hebrew"); + private static readonly System.Text.Json.JsonEncodedText MemberHungarian = System.Text.Json.JsonEncodedText.Encode("hungarian"); + private static readonly System.Text.Json.JsonEncodedText MemberPolish = System.Text.Json.JsonEncodedText.Encode("polish"); + private static readonly System.Text.Json.JsonEncodedText MemberRomanian = System.Text.Json.JsonEncodedText.Encode("romanian"); + private static readonly System.Text.Json.JsonEncodedText MemberRussian = System.Text.Json.JsonEncodedText.Encode("russian"); + private static readonly System.Text.Json.JsonEncodedText MemberSpanish = System.Text.Json.JsonEncodedText.Encode("spanish"); + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAny)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Any; + } + + if (reader.ValueTextEquals(MemberCommon)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Common; + } + + if (reader.ValueTextEquals(MemberCyrillic)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Cyrillic; + } + + if (reader.ValueTextEquals(MemberEnglish)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.English; + } + + if (reader.ValueTextEquals(MemberFrench)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.French; + } + + if (reader.ValueTextEquals(MemberGerman)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.German; + } + + if (reader.ValueTextEquals(MemberHebrew)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hebrew; + } + + if (reader.ValueTextEquals(MemberHungarian)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hungarian; + } + + if (reader.ValueTextEquals(MemberPolish)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Polish; + } + + if (reader.ValueTextEquals(MemberRomanian)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Romanian; + } + + if (reader.ValueTextEquals(MemberRussian)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Russian; + } + + if (reader.ValueTextEquals(MemberSpanish)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Spanish; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAny.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Any; + } + + if (string.Equals(value, MemberCommon.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Common; + } + + if (string.Equals(value, MemberCyrillic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Cyrillic; + } + + if (string.Equals(value, MemberEnglish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.English; + } + + if (string.Equals(value, MemberFrench.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.French; + } + + if (string.Equals(value, MemberGerman.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.German; + } + + if (string.Equals(value, MemberHebrew.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hebrew; + } + + if (string.Equals(value, MemberHungarian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hungarian; + } + + if (string.Equals(value, MemberPolish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Polish; + } + + if (string.Equals(value, MemberRomanian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Romanian; + } + + if (string.Equals(value, MemberRussian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Russian; + } + + if (string.Equals(value, MemberSpanish.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Spanish; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Any: + writer.WriteStringValue(MemberAny); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Common: + writer.WriteStringValue(MemberCommon); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Cyrillic: + writer.WriteStringValue(MemberCyrillic); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.English: + writer.WriteStringValue(MemberEnglish); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.French: + writer.WriteStringValue(MemberFrench); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.German: + writer.WriteStringValue(MemberGerman); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hebrew: + writer.WriteStringValue(MemberHebrew); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Hungarian: + writer.WriteStringValue(MemberHungarian); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Polish: + writer.WriteStringValue(MemberPolish); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Romanian: + writer.WriteStringValue(MemberRomanian); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Russian: + writer.WriteStringValue(MemberRussian); + break; + case Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage.Spanish: + writer.WriteStringValue(MemberSpanish); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationModeConverter))] +public enum KuromojiTokenizationMode +{ + [System.Runtime.Serialization.EnumMember(Value = "extended")] + Extended, + [System.Runtime.Serialization.EnumMember(Value = "normal")] + Normal, + [System.Runtime.Serialization.EnumMember(Value = "search")] + Search +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.NoriDecompoundModeConverter))] +public enum NoriDecompoundMode +{ + [System.Runtime.Serialization.EnumMember(Value = "discard")] + Discard, + [System.Runtime.Serialization.EnumMember(Value = "mixed")] + Mixed, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationModeConverter))] +public enum IcuNormalizationMode +{ + [System.Runtime.Serialization.EnumMember(Value = "compose")] + Compose, + [System.Runtime.Serialization.EnumMember(Value = "decompose")] + Decompose +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuNormalizationTypeConverter))] +public enum IcuNormalizationType +{ + [System.Runtime.Serialization.EnumMember(Value = "nfc")] + Nfc, + [System.Runtime.Serialization.EnumMember(Value = "nfkc")] + Nfkc, + [System.Runtime.Serialization.EnumMember(Value = "nfkc_cf")] + NfkcCf +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.DelimitedPayloadEncodingConverter))] +public enum DelimitedPayloadEncoding +{ + [System.Runtime.Serialization.EnumMember(Value = "float")] + Float, + [System.Runtime.Serialization.EnumMember(Value = "identity")] + Identity, + [System.Runtime.Serialization.EnumMember(Value = "int")] + Integer +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.EdgeNGramSideConverter))] +public enum EdgeNGramSide +{ + [System.Runtime.Serialization.EnumMember(Value = "back")] + Back, + [System.Runtime.Serialization.EnumMember(Value = "front")] + Front +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.KeepTypesModeConverter))] +public enum KeepTypesMode +{ + [System.Runtime.Serialization.EnumMember(Value = "exclude")] + Exclude, + [System.Runtime.Serialization.EnumMember(Value = "include")] + Include +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SnowballLanguageConverter))] +public enum SnowballLanguage +{ + [System.Runtime.Serialization.EnumMember(Value = "Armenian")] + Armenian, + [System.Runtime.Serialization.EnumMember(Value = "Basque")] + Basque, + [System.Runtime.Serialization.EnumMember(Value = "Catalan")] + Catalan, + [System.Runtime.Serialization.EnumMember(Value = "Danish")] + Danish, + [System.Runtime.Serialization.EnumMember(Value = "Dutch")] + Dutch, + [System.Runtime.Serialization.EnumMember(Value = "English")] + English, + [System.Runtime.Serialization.EnumMember(Value = "Finnish")] + Finnish, + [System.Runtime.Serialization.EnumMember(Value = "French")] + French, + [System.Runtime.Serialization.EnumMember(Value = "German")] + German, + [System.Runtime.Serialization.EnumMember(Value = "German2")] + German2, + [System.Runtime.Serialization.EnumMember(Value = "Hungarian")] + Hungarian, + [System.Runtime.Serialization.EnumMember(Value = "Italian")] + Italian, + [System.Runtime.Serialization.EnumMember(Value = "Kp")] + Kp, + [System.Runtime.Serialization.EnumMember(Value = "Lovins")] + Lovins, + [System.Runtime.Serialization.EnumMember(Value = "Norwegian")] + Norwegian, + [System.Runtime.Serialization.EnumMember(Value = "Porter")] + Porter, + [System.Runtime.Serialization.EnumMember(Value = "Portuguese")] + Portuguese, + [System.Runtime.Serialization.EnumMember(Value = "Romanian")] + Romanian, + [System.Runtime.Serialization.EnumMember(Value = "Russian")] + Russian, + [System.Runtime.Serialization.EnumMember(Value = "Spanish")] + Spanish, + [System.Runtime.Serialization.EnumMember(Value = "Swedish")] + Swedish, + [System.Runtime.Serialization.EnumMember(Value = "Turkish")] + Turkish +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.SynonymFormatConverter))] +public enum SynonymFormat +{ + [System.Runtime.Serialization.EnumMember(Value = "solr")] + Solr, + [System.Runtime.Serialization.EnumMember(Value = "wordnet")] + Wordnet +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternateConverter))] +public enum IcuCollationAlternate +{ + [System.Runtime.Serialization.EnumMember(Value = "non-ignorable")] + NonIgnorable, + [System.Runtime.Serialization.EnumMember(Value = "shifted")] + Shifted +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirstConverter))] +public enum IcuCollationCaseFirst +{ + [System.Runtime.Serialization.EnumMember(Value = "lower")] + Lower, + [System.Runtime.Serialization.EnumMember(Value = "upper")] + Upper +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecompositionConverter))] +public enum IcuCollationDecomposition +{ + [System.Runtime.Serialization.EnumMember(Value = "identical")] + Identical, + [System.Runtime.Serialization.EnumMember(Value = "no")] + No +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrengthConverter))] +public enum IcuCollationStrength +{ + [System.Runtime.Serialization.EnumMember(Value = "identical")] + Identical, + [System.Runtime.Serialization.EnumMember(Value = "primary")] + Primary, + [System.Runtime.Serialization.EnumMember(Value = "quaternary")] + Quaternary, + [System.Runtime.Serialization.EnumMember(Value = "secondary")] + Secondary, + [System.Runtime.Serialization.EnumMember(Value = "tertiary")] + Tertiary +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.IcuTransformDirectionConverter))] +public enum IcuTransformDirection +{ + [System.Runtime.Serialization.EnumMember(Value = "forward")] + Forward, + [System.Runtime.Serialization.EnumMember(Value = "reverse")] + Reverse +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoderConverter))] +public enum PhoneticEncoder +{ + [System.Runtime.Serialization.EnumMember(Value = "beider_morse")] + BeiderMorse, + [System.Runtime.Serialization.EnumMember(Value = "caverphone1")] + Caverphone1, + [System.Runtime.Serialization.EnumMember(Value = "caverphone2")] + Caverphone2, + [System.Runtime.Serialization.EnumMember(Value = "cologne")] + Cologne, + [System.Runtime.Serialization.EnumMember(Value = "daitch_mokotoff")] + DaitchMokotoff, + [System.Runtime.Serialization.EnumMember(Value = "double_metaphone")] + DoubleMetaphone, + [System.Runtime.Serialization.EnumMember(Value = "haasephonetik")] + Haasephonetik, + [System.Runtime.Serialization.EnumMember(Value = "koelnerphonetik")] + Koelnerphonetik, + [System.Runtime.Serialization.EnumMember(Value = "metaphone")] + Metaphone, + [System.Runtime.Serialization.EnumMember(Value = "nysiis")] + Nysiis, + [System.Runtime.Serialization.EnumMember(Value = "refined_soundex")] + RefinedSoundex, + [System.Runtime.Serialization.EnumMember(Value = "soundex")] + Soundex +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticNameTypeConverter))] +public enum PhoneticNameType +{ + [System.Runtime.Serialization.EnumMember(Value = "ashkenazi")] + Ashkenazi, + [System.Runtime.Serialization.EnumMember(Value = "generic")] + Generic, + [System.Runtime.Serialization.EnumMember(Value = "sephardic")] + Sephardic +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticRuleTypeConverter))] +public enum PhoneticRuleType +{ + [System.Runtime.Serialization.EnumMember(Value = "approx")] + Approx, + [System.Runtime.Serialization.EnumMember(Value = "exact")] + Exact +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.TokenCharConverter))] +public enum TokenChar +{ + [System.Runtime.Serialization.EnumMember(Value = "custom")] + Custom, + [System.Runtime.Serialization.EnumMember(Value = "digit")] + Digit, + [System.Runtime.Serialization.EnumMember(Value = "letter")] + Letter, + [System.Runtime.Serialization.EnumMember(Value = "punctuation")] + Punctuation, + [System.Runtime.Serialization.EnumMember(Value = "symbol")] + Symbol, + [System.Runtime.Serialization.EnumMember(Value = "whitespace")] + Whitespace +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguageConverter))] +public enum PhoneticLanguage +{ + [System.Runtime.Serialization.EnumMember(Value = "any")] + Any, + [System.Runtime.Serialization.EnumMember(Value = "common")] + Common, + [System.Runtime.Serialization.EnumMember(Value = "cyrillic")] + Cyrillic, + [System.Runtime.Serialization.EnumMember(Value = "english")] + English, + [System.Runtime.Serialization.EnumMember(Value = "french")] + French, + [System.Runtime.Serialization.EnumMember(Value = "german")] + German, + [System.Runtime.Serialization.EnumMember(Value = "hebrew")] + Hebrew, + [System.Runtime.Serialization.EnumMember(Value = "hungarian")] + Hungarian, + [System.Runtime.Serialization.EnumMember(Value = "polish")] + Polish, + [System.Runtime.Serialization.EnumMember(Value = "romanian")] + Romanian, + [System.Runtime.Serialization.EnumMember(Value = "russian")] + Russian, + [System.Runtime.Serialization.EnumMember(Value = "spanish")] + Spanish } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Cluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Cluster.g.cs index f8a92c8f479..c6f0bc8e309 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Cluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Cluster.g.cs @@ -17,286 +17,542 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Cluster; -[JsonConverter(typeof(AllocationExplainDecisionConverter))] -public enum AllocationExplainDecision +internal sealed partial class AllocationExplainDecisionConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "YES")] - Yes, - [EnumMember(Value = "THROTTLE")] - Throttle, - [EnumMember(Value = "NO")] - No, - [EnumMember(Value = "ALWAYS")] - Always -} + private static readonly System.Text.Json.JsonEncodedText MemberAlways = System.Text.Json.JsonEncodedText.Encode("ALWAYS"); + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("NO"); + private static readonly System.Text.Json.JsonEncodedText MemberThrottle = System.Text.Json.JsonEncodedText.Encode("THROTTLE"); + private static readonly System.Text.Json.JsonEncodedText MemberYes = System.Text.Json.JsonEncodedText.Encode("YES"); -internal sealed class AllocationExplainDecisionConverter : JsonConverter -{ - public override AllocationExplainDecision Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAlways)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Always; + } + + if (reader.ValueTextEquals(MemberNo)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.No; + } + + if (reader.ValueTextEquals(MemberThrottle)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Throttle; + } + + if (reader.ValueTextEquals(MemberYes)) { - case "YES": - return AllocationExplainDecision.Yes; - case "THROTTLE": - return AllocationExplainDecision.Throttle; - case "NO": - return AllocationExplainDecision.No; - case "ALWAYS": - return AllocationExplainDecision.Always; + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Yes; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberAlways.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Always; + } + + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.No; + } + + if (string.Equals(value, MemberThrottle.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Throttle; + } + + if (string.Equals(value, MemberYes.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Yes; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision)}'."); } - public override void Write(Utf8JsonWriter writer, AllocationExplainDecision value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case AllocationExplainDecision.Yes: - writer.WriteStringValue("YES"); - return; - case AllocationExplainDecision.Throttle: - writer.WriteStringValue("THROTTLE"); - return; - case AllocationExplainDecision.No: - writer.WriteStringValue("NO"); - return; - case AllocationExplainDecision.Always: - writer.WriteStringValue("ALWAYS"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Always: + writer.WriteStringValue(MemberAlways); + break; + case Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.No: + writer.WriteStringValue(MemberNo); + break; + case Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Throttle: + writer.WriteStringValue(MemberThrottle); + break; + case Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision.Yes: + writer.WriteStringValue(MemberYes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision)}'."); + } } -} -[JsonConverter(typeof(DecisionConverter))] -public enum Decision -{ - [EnumMember(Value = "yes")] - Yes, - [EnumMember(Value = "worse_balance")] - WorseBalance, - [EnumMember(Value = "throttled")] - Throttled, - [EnumMember(Value = "no_valid_shard_copy")] - NoValidShardCopy, - [EnumMember(Value = "no_attempt")] - NoAttempt, - [EnumMember(Value = "no")] - No, - [EnumMember(Value = "awaiting_info")] - AwaitingInfo, - [EnumMember(Value = "allocation_delayed")] - AllocationDelayed + public override Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecision value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DecisionConverter : JsonConverter +internal sealed partial class DecisionConverter : System.Text.Json.Serialization.JsonConverter { - public override Decision Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAllocationDelayed = System.Text.Json.JsonEncodedText.Encode("allocation_delayed"); + private static readonly System.Text.Json.JsonEncodedText MemberAwaitingInfo = System.Text.Json.JsonEncodedText.Encode("awaiting_info"); + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("no"); + private static readonly System.Text.Json.JsonEncodedText MemberNoAttempt = System.Text.Json.JsonEncodedText.Encode("no_attempt"); + private static readonly System.Text.Json.JsonEncodedText MemberNoValidShardCopy = System.Text.Json.JsonEncodedText.Encode("no_valid_shard_copy"); + private static readonly System.Text.Json.JsonEncodedText MemberThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); + private static readonly System.Text.Json.JsonEncodedText MemberWorseBalance = System.Text.Json.JsonEncodedText.Encode("worse_balance"); + private static readonly System.Text.Json.JsonEncodedText MemberYes = System.Text.Json.JsonEncodedText.Encode("yes"); + + public override Elastic.Clients.Elasticsearch.Cluster.Decision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "yes": - return Decision.Yes; - case "worse_balance": - return Decision.WorseBalance; - case "throttled": - return Decision.Throttled; - case "no_valid_shard_copy": - return Decision.NoValidShardCopy; - case "no_attempt": - return Decision.NoAttempt; - case "no": - return Decision.No; - case "awaiting_info": - return Decision.AwaitingInfo; - case "allocation_delayed": - return Decision.AllocationDelayed; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAllocationDelayed)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.AllocationDelayed; + } + + if (reader.ValueTextEquals(MemberAwaitingInfo)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.AwaitingInfo; + } + + if (reader.ValueTextEquals(MemberNo)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.No; + } + + if (reader.ValueTextEquals(MemberNoAttempt)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.NoAttempt; + } + + if (reader.ValueTextEquals(MemberNoValidShardCopy)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.NoValidShardCopy; + } + + if (reader.ValueTextEquals(MemberThrottled)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.Throttled; + } + + if (reader.ValueTextEquals(MemberWorseBalance)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.WorseBalance; + } + + if (reader.ValueTextEquals(MemberYes)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.Yes; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAllocationDelayed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.AllocationDelayed; + } + + if (string.Equals(value, MemberAwaitingInfo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.AwaitingInfo; + } + + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.No; + } + + if (string.Equals(value, MemberNoAttempt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.NoAttempt; + } + + if (string.Equals(value, MemberNoValidShardCopy.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.NoValidShardCopy; + } + + if (string.Equals(value, MemberThrottled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.Throttled; + } + + if (string.Equals(value, MemberWorseBalance.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.WorseBalance; + } + + if (string.Equals(value, MemberYes.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.Decision.Yes; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.Decision)}'."); } - public override void Write(Utf8JsonWriter writer, Decision value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.Decision value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Decision.Yes: - writer.WriteStringValue("yes"); - return; - case Decision.WorseBalance: - writer.WriteStringValue("worse_balance"); - return; - case Decision.Throttled: - writer.WriteStringValue("throttled"); - return; - case Decision.NoValidShardCopy: - writer.WriteStringValue("no_valid_shard_copy"); - return; - case Decision.NoAttempt: - writer.WriteStringValue("no_attempt"); - return; - case Decision.No: - writer.WriteStringValue("no"); - return; - case Decision.AwaitingInfo: - writer.WriteStringValue("awaiting_info"); - return; - case Decision.AllocationDelayed: - writer.WriteStringValue("allocation_delayed"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Cluster.Decision.AllocationDelayed: + writer.WriteStringValue(MemberAllocationDelayed); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.AwaitingInfo: + writer.WriteStringValue(MemberAwaitingInfo); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.No: + writer.WriteStringValue(MemberNo); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.NoAttempt: + writer.WriteStringValue(MemberNoAttempt); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.NoValidShardCopy: + writer.WriteStringValue(MemberNoValidShardCopy); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.Throttled: + writer.WriteStringValue(MemberThrottled); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.WorseBalance: + writer.WriteStringValue(MemberWorseBalance); + break; + case Elastic.Clients.Elasticsearch.Cluster.Decision.Yes: + writer.WriteStringValue(MemberYes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.Decision)}'."); + } } -} -[JsonConverter(typeof(UnassignedInformationReasonConverter))] -public enum UnassignedInformationReason -{ - [EnumMember(Value = "REROUTE_CANCELLED")] - RerouteCancelled, - [EnumMember(Value = "REPLICA_ADDED")] - ReplicaAdded, - [EnumMember(Value = "REINITIALIZED")] - Reinitialized, - [EnumMember(Value = "REALLOCATED_REPLICA")] - ReallocatedReplica, - [EnumMember(Value = "PRIMARY_FAILED")] - PrimaryFailed, - [EnumMember(Value = "NODE_LEFT")] - NodeLeft, - [EnumMember(Value = "NEW_INDEX_RESTORED")] - NewIndexRestored, - [EnumMember(Value = "MANUAL_ALLOCATION")] - ManualAllocation, - [EnumMember(Value = "INDEX_REOPENED")] - IndexReopened, - [EnumMember(Value = "INDEX_CREATED")] - IndexCreated, - [EnumMember(Value = "FORCED_EMPTY_PRIMARY")] - ForcedEmptyPrimary, - [EnumMember(Value = "EXISTING_INDEX_RESTORED")] - ExistingIndexRestored, - [EnumMember(Value = "DANGLING_INDEX_IMPORTED")] - DanglingIndexImported, - [EnumMember(Value = "CLUSTER_RECOVERED")] - ClusterRecovered, - [EnumMember(Value = "ALLOCATION_FAILED")] - AllocationFailed + public override Elastic.Clients.Elasticsearch.Cluster.Decision ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.Decision value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class UnassignedInformationReasonConverter : JsonConverter +internal sealed partial class UnassignedInformationReasonConverter : System.Text.Json.Serialization.JsonConverter { - public override UnassignedInformationReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAllocationFailed = System.Text.Json.JsonEncodedText.Encode("ALLOCATION_FAILED"); + private static readonly System.Text.Json.JsonEncodedText MemberClusterRecovered = System.Text.Json.JsonEncodedText.Encode("CLUSTER_RECOVERED"); + private static readonly System.Text.Json.JsonEncodedText MemberDanglingIndexImported = System.Text.Json.JsonEncodedText.Encode("DANGLING_INDEX_IMPORTED"); + private static readonly System.Text.Json.JsonEncodedText MemberExistingIndexRestored = System.Text.Json.JsonEncodedText.Encode("EXISTING_INDEX_RESTORED"); + private static readonly System.Text.Json.JsonEncodedText MemberForcedEmptyPrimary = System.Text.Json.JsonEncodedText.Encode("FORCED_EMPTY_PRIMARY"); + private static readonly System.Text.Json.JsonEncodedText MemberIndexCreated = System.Text.Json.JsonEncodedText.Encode("INDEX_CREATED"); + private static readonly System.Text.Json.JsonEncodedText MemberIndexReopened = System.Text.Json.JsonEncodedText.Encode("INDEX_REOPENED"); + private static readonly System.Text.Json.JsonEncodedText MemberManualAllocation = System.Text.Json.JsonEncodedText.Encode("MANUAL_ALLOCATION"); + private static readonly System.Text.Json.JsonEncodedText MemberNewIndexRestored = System.Text.Json.JsonEncodedText.Encode("NEW_INDEX_RESTORED"); + private static readonly System.Text.Json.JsonEncodedText MemberNodeLeft = System.Text.Json.JsonEncodedText.Encode("NODE_LEFT"); + private static readonly System.Text.Json.JsonEncodedText MemberPrimaryFailed = System.Text.Json.JsonEncodedText.Encode("PRIMARY_FAILED"); + private static readonly System.Text.Json.JsonEncodedText MemberReallocatedReplica = System.Text.Json.JsonEncodedText.Encode("REALLOCATED_REPLICA"); + private static readonly System.Text.Json.JsonEncodedText MemberReinitialized = System.Text.Json.JsonEncodedText.Encode("REINITIALIZED"); + private static readonly System.Text.Json.JsonEncodedText MemberReplicaAdded = System.Text.Json.JsonEncodedText.Encode("REPLICA_ADDED"); + private static readonly System.Text.Json.JsonEncodedText MemberRerouteCancelled = System.Text.Json.JsonEncodedText.Encode("REROUTE_CANCELLED"); + + public override Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "REROUTE_CANCELLED": - return UnassignedInformationReason.RerouteCancelled; - case "REPLICA_ADDED": - return UnassignedInformationReason.ReplicaAdded; - case "REINITIALIZED": - return UnassignedInformationReason.Reinitialized; - case "REALLOCATED_REPLICA": - return UnassignedInformationReason.ReallocatedReplica; - case "PRIMARY_FAILED": - return UnassignedInformationReason.PrimaryFailed; - case "NODE_LEFT": - return UnassignedInformationReason.NodeLeft; - case "NEW_INDEX_RESTORED": - return UnassignedInformationReason.NewIndexRestored; - case "MANUAL_ALLOCATION": - return UnassignedInformationReason.ManualAllocation; - case "INDEX_REOPENED": - return UnassignedInformationReason.IndexReopened; - case "INDEX_CREATED": - return UnassignedInformationReason.IndexCreated; - case "FORCED_EMPTY_PRIMARY": - return UnassignedInformationReason.ForcedEmptyPrimary; - case "EXISTING_INDEX_RESTORED": - return UnassignedInformationReason.ExistingIndexRestored; - case "DANGLING_INDEX_IMPORTED": - return UnassignedInformationReason.DanglingIndexImported; - case "CLUSTER_RECOVERED": - return UnassignedInformationReason.ClusterRecovered; - case "ALLOCATION_FAILED": - return UnassignedInformationReason.AllocationFailed; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAllocationFailed)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.AllocationFailed; + } + + if (reader.ValueTextEquals(MemberClusterRecovered)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ClusterRecovered; + } + + if (reader.ValueTextEquals(MemberDanglingIndexImported)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.DanglingIndexImported; + } + + if (reader.ValueTextEquals(MemberExistingIndexRestored)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ExistingIndexRestored; + } + + if (reader.ValueTextEquals(MemberForcedEmptyPrimary)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ForcedEmptyPrimary; + } + + if (reader.ValueTextEquals(MemberIndexCreated)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexCreated; + } + + if (reader.ValueTextEquals(MemberIndexReopened)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexReopened; + } + + if (reader.ValueTextEquals(MemberManualAllocation)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ManualAllocation; + } + + if (reader.ValueTextEquals(MemberNewIndexRestored)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NewIndexRestored; + } + + if (reader.ValueTextEquals(MemberNodeLeft)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NodeLeft; + } + + if (reader.ValueTextEquals(MemberPrimaryFailed)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.PrimaryFailed; + } + + if (reader.ValueTextEquals(MemberReallocatedReplica)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReallocatedReplica; + } + + if (reader.ValueTextEquals(MemberReinitialized)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.Reinitialized; + } + + if (reader.ValueTextEquals(MemberReplicaAdded)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReplicaAdded; + } + + if (reader.ValueTextEquals(MemberRerouteCancelled)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.RerouteCancelled; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAllocationFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.AllocationFailed; + } + + if (string.Equals(value, MemberClusterRecovered.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ClusterRecovered; + } + + if (string.Equals(value, MemberDanglingIndexImported.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.DanglingIndexImported; + } + + if (string.Equals(value, MemberExistingIndexRestored.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ExistingIndexRestored; + } + + if (string.Equals(value, MemberForcedEmptyPrimary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ForcedEmptyPrimary; + } + + if (string.Equals(value, MemberIndexCreated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexCreated; + } + + if (string.Equals(value, MemberIndexReopened.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexReopened; + } + + if (string.Equals(value, MemberManualAllocation.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ManualAllocation; + } + + if (string.Equals(value, MemberNewIndexRestored.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NewIndexRestored; + } + + if (string.Equals(value, MemberNodeLeft.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NodeLeft; + } + + if (string.Equals(value, MemberPrimaryFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.PrimaryFailed; + } + + if (string.Equals(value, MemberReallocatedReplica.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReallocatedReplica; + } + + if (string.Equals(value, MemberReinitialized.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.Reinitialized; + } + + if (string.Equals(value, MemberReplicaAdded.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReplicaAdded; + } + + if (string.Equals(value, MemberRerouteCancelled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.RerouteCancelled; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason)}'."); } - public override void Write(Utf8JsonWriter writer, UnassignedInformationReason value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case UnassignedInformationReason.RerouteCancelled: - writer.WriteStringValue("REROUTE_CANCELLED"); - return; - case UnassignedInformationReason.ReplicaAdded: - writer.WriteStringValue("REPLICA_ADDED"); - return; - case UnassignedInformationReason.Reinitialized: - writer.WriteStringValue("REINITIALIZED"); - return; - case UnassignedInformationReason.ReallocatedReplica: - writer.WriteStringValue("REALLOCATED_REPLICA"); - return; - case UnassignedInformationReason.PrimaryFailed: - writer.WriteStringValue("PRIMARY_FAILED"); - return; - case UnassignedInformationReason.NodeLeft: - writer.WriteStringValue("NODE_LEFT"); - return; - case UnassignedInformationReason.NewIndexRestored: - writer.WriteStringValue("NEW_INDEX_RESTORED"); - return; - case UnassignedInformationReason.ManualAllocation: - writer.WriteStringValue("MANUAL_ALLOCATION"); - return; - case UnassignedInformationReason.IndexReopened: - writer.WriteStringValue("INDEX_REOPENED"); - return; - case UnassignedInformationReason.IndexCreated: - writer.WriteStringValue("INDEX_CREATED"); - return; - case UnassignedInformationReason.ForcedEmptyPrimary: - writer.WriteStringValue("FORCED_EMPTY_PRIMARY"); - return; - case UnassignedInformationReason.ExistingIndexRestored: - writer.WriteStringValue("EXISTING_INDEX_RESTORED"); - return; - case UnassignedInformationReason.DanglingIndexImported: - writer.WriteStringValue("DANGLING_INDEX_IMPORTED"); - return; - case UnassignedInformationReason.ClusterRecovered: - writer.WriteStringValue("CLUSTER_RECOVERED"); - return; - case UnassignedInformationReason.AllocationFailed: - writer.WriteStringValue("ALLOCATION_FAILED"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.AllocationFailed: + writer.WriteStringValue(MemberAllocationFailed); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ClusterRecovered: + writer.WriteStringValue(MemberClusterRecovered); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.DanglingIndexImported: + writer.WriteStringValue(MemberDanglingIndexImported); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ExistingIndexRestored: + writer.WriteStringValue(MemberExistingIndexRestored); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ForcedEmptyPrimary: + writer.WriteStringValue(MemberForcedEmptyPrimary); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexCreated: + writer.WriteStringValue(MemberIndexCreated); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.IndexReopened: + writer.WriteStringValue(MemberIndexReopened); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ManualAllocation: + writer.WriteStringValue(MemberManualAllocation); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NewIndexRestored: + writer.WriteStringValue(MemberNewIndexRestored); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.NodeLeft: + writer.WriteStringValue(MemberNodeLeft); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.PrimaryFailed: + writer.WriteStringValue(MemberPrimaryFailed); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReallocatedReplica: + writer.WriteStringValue(MemberReallocatedReplica); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.Reinitialized: + writer.WriteStringValue(MemberReinitialized); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.ReplicaAdded: + writer.WriteStringValue(MemberReplicaAdded); + break; + case Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason.RerouteCancelled: + writer.WriteStringValue(MemberRerouteCancelled); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason)}'."); + } } + + public override Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReason value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.AllocationExplainDecisionConverter))] +public enum AllocationExplainDecision +{ + [System.Runtime.Serialization.EnumMember(Value = "ALWAYS")] + Always, + [System.Runtime.Serialization.EnumMember(Value = "NO")] + No, + [System.Runtime.Serialization.EnumMember(Value = "THROTTLE")] + Throttle, + [System.Runtime.Serialization.EnumMember(Value = "YES")] + Yes +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.DecisionConverter))] +public enum Decision +{ + [System.Runtime.Serialization.EnumMember(Value = "allocation_delayed")] + AllocationDelayed, + [System.Runtime.Serialization.EnumMember(Value = "awaiting_info")] + AwaitingInfo, + [System.Runtime.Serialization.EnumMember(Value = "no")] + No, + [System.Runtime.Serialization.EnumMember(Value = "no_attempt")] + NoAttempt, + [System.Runtime.Serialization.EnumMember(Value = "no_valid_shard_copy")] + NoValidShardCopy, + [System.Runtime.Serialization.EnumMember(Value = "throttled")] + Throttled, + [System.Runtime.Serialization.EnumMember(Value = "worse_balance")] + WorseBalance, + [System.Runtime.Serialization.EnumMember(Value = "yes")] + Yes +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.UnassignedInformationReasonConverter))] +public enum UnassignedInformationReason +{ + [System.Runtime.Serialization.EnumMember(Value = "ALLOCATION_FAILED")] + AllocationFailed, + [System.Runtime.Serialization.EnumMember(Value = "CLUSTER_RECOVERED")] + ClusterRecovered, + [System.Runtime.Serialization.EnumMember(Value = "DANGLING_INDEX_IMPORTED")] + DanglingIndexImported, + [System.Runtime.Serialization.EnumMember(Value = "EXISTING_INDEX_RESTORED")] + ExistingIndexRestored, + [System.Runtime.Serialization.EnumMember(Value = "FORCED_EMPTY_PRIMARY")] + ForcedEmptyPrimary, + [System.Runtime.Serialization.EnumMember(Value = "INDEX_CREATED")] + IndexCreated, + [System.Runtime.Serialization.EnumMember(Value = "INDEX_REOPENED")] + IndexReopened, + [System.Runtime.Serialization.EnumMember(Value = "MANUAL_ALLOCATION")] + ManualAllocation, + [System.Runtime.Serialization.EnumMember(Value = "NEW_INDEX_RESTORED")] + NewIndexRestored, + [System.Runtime.Serialization.EnumMember(Value = "NODE_LEFT")] + NodeLeft, + [System.Runtime.Serialization.EnumMember(Value = "PRIMARY_FAILED")] + PrimaryFailed, + [System.Runtime.Serialization.EnumMember(Value = "REALLOCATED_REPLICA")] + ReallocatedReplica, + [System.Runtime.Serialization.EnumMember(Value = "REINITIALIZED")] + Reinitialized, + [System.Runtime.Serialization.EnumMember(Value = "REPLICA_ADDED")] + ReplicaAdded, + [System.Runtime.Serialization.EnumMember(Value = "REROUTE_CANCELLED")] + RerouteCancelled } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Bulk.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Bulk.g.cs index 1adc3ce767e..3a4c44361b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Bulk.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Bulk.g.cs @@ -17,69 +17,204 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -[JsonConverter(typeof(FailureStoreStatusConverter))] -public enum FailureStoreStatus +internal sealed partial class OperationTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "used")] - Used, - [EnumMember(Value = "not_enabled")] - NotEnabled, - [EnumMember(Value = "not_applicable_or_unknown")] - NotApplicableOrUnknown, - [EnumMember(Value = "failed")] - Failed + private static readonly System.Text.Json.JsonEncodedText MemberCreate = System.Text.Json.JsonEncodedText.Encode("create"); + private static readonly System.Text.Json.JsonEncodedText MemberDelete = System.Text.Json.JsonEncodedText.Encode("delete"); + private static readonly System.Text.Json.JsonEncodedText MemberIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText MemberUpdate = System.Text.Json.JsonEncodedText.Encode("update"); + + public override Elastic.Clients.Elasticsearch.Core.Bulk.OperationType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCreate)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Create; + } + + if (reader.ValueTextEquals(MemberDelete)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Delete; + } + + if (reader.ValueTextEquals(MemberIndex)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Index; + } + + if (reader.ValueTextEquals(MemberUpdate)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Update; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCreate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Create; + } + + if (string.Equals(value, MemberDelete.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Delete; + } + + if (string.Equals(value, MemberIndex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Index; + } + + if (string.Equals(value, MemberUpdate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Update; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Bulk.OperationType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Bulk.OperationType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Create: + writer.WriteStringValue(MemberCreate); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Delete: + writer.WriteStringValue(MemberDelete); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Index: + writer.WriteStringValue(MemberIndex); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.OperationType.Update: + writer.WriteStringValue(MemberUpdate); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Bulk.OperationType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Bulk.OperationType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Bulk.OperationType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class FailureStoreStatusConverter : JsonConverter +internal sealed partial class FailureStoreStatusConverter : System.Text.Json.Serialization.JsonConverter { - public override FailureStoreStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberNotApplicableOrUnknown = System.Text.Json.JsonEncodedText.Encode("not_applicable_or_unknown"); + private static readonly System.Text.Json.JsonEncodedText MemberNotEnabled = System.Text.Json.JsonEncodedText.Encode("not_enabled"); + private static readonly System.Text.Json.JsonEncodedText MemberUsed = System.Text.Json.JsonEncodedText.Encode("used"); + + public override Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFailed)) { - case "used": - return FailureStoreStatus.Used; - case "not_enabled": - return FailureStoreStatus.NotEnabled; - case "not_applicable_or_unknown": - return FailureStoreStatus.NotApplicableOrUnknown; - case "failed": - return FailureStoreStatus.Failed; + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Failed; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberNotApplicableOrUnknown)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotApplicableOrUnknown; + } + + if (reader.ValueTextEquals(MemberNotEnabled)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotEnabled; + } + + if (reader.ValueTextEquals(MemberUsed)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Used; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Failed; + } + + if (string.Equals(value, MemberNotApplicableOrUnknown.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotApplicableOrUnknown; + } + + if (string.Equals(value, MemberNotEnabled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotEnabled; + } + + if (string.Equals(value, MemberUsed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Used; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus)}'."); } - public override void Write(Utf8JsonWriter writer, FailureStoreStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case FailureStoreStatus.Used: - writer.WriteStringValue("used"); - return; - case FailureStoreStatus.NotEnabled: - writer.WriteStringValue("not_enabled"); - return; - case FailureStoreStatus.NotApplicableOrUnknown: - writer.WriteStringValue("not_applicable_or_unknown"); - return; - case FailureStoreStatus.Failed: - writer.WriteStringValue("failed"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotApplicableOrUnknown: + writer.WriteStringValue(MemberNotApplicableOrUnknown); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.NotEnabled: + writer.WriteStringValue(MemberNotEnabled); + break; + case Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus.Used: + writer.WriteStringValue(MemberUsed); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Bulk.OperationTypeConverter))] +public enum OperationType +{ + [System.Runtime.Serialization.EnumMember(Value = "create")] + Create, + [System.Runtime.Serialization.EnumMember(Value = "delete")] + Delete, + [System.Runtime.Serialization.EnumMember(Value = "index")] + Index, + [System.Runtime.Serialization.EnumMember(Value = "update")] + Update +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Bulk.FailureStoreStatusConverter))] +public enum FailureStoreStatus +{ + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, + [System.Runtime.Serialization.EnumMember(Value = "not_applicable_or_unknown")] + NotApplicableOrUnknown, + [System.Runtime.Serialization.EnumMember(Value = "not_enabled")] + NotEnabled, + [System.Runtime.Serialization.EnumMember(Value = "used")] + Used } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.HealthReport.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.HealthReport.g.cs index c3bc56ecfd4..c8dcb840c1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.HealthReport.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.HealthReport.g.cs @@ -17,125 +17,204 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.HealthReport; -[JsonConverter(typeof(ImpactAreaConverter))] -public enum ImpactArea +internal sealed partial class IndicatorHealthStatusConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "search")] - Search, - [EnumMember(Value = "ingest")] - Ingest, - [EnumMember(Value = "deployment_management")] - DeploymentManagement, - [EnumMember(Value = "backup")] - Backup -} + private static readonly System.Text.Json.JsonEncodedText MemberGreen = System.Text.Json.JsonEncodedText.Encode("green"); + private static readonly System.Text.Json.JsonEncodedText MemberRed = System.Text.Json.JsonEncodedText.Encode("red"); + private static readonly System.Text.Json.JsonEncodedText MemberUnknown = System.Text.Json.JsonEncodedText.Encode("unknown"); + private static readonly System.Text.Json.JsonEncodedText MemberYellow = System.Text.Json.JsonEncodedText.Encode("yellow"); -internal sealed class ImpactAreaConverter : JsonConverter -{ - public override ImpactArea Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGreen)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Green; + } + + if (reader.ValueTextEquals(MemberRed)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Red; + } + + if (reader.ValueTextEquals(MemberUnknown)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Unknown; + } + + if (reader.ValueTextEquals(MemberYellow)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Yellow; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGreen.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Green; + } + + if (string.Equals(value, MemberRed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Red; + } + + if (string.Equals(value, MemberUnknown.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "search": - return ImpactArea.Search; - case "ingest": - return ImpactArea.Ingest; - case "deployment_management": - return ImpactArea.DeploymentManagement; - case "backup": - return ImpactArea.Backup; + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Unknown; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberYellow.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Yellow; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus)}'."); } - public override void Write(Utf8JsonWriter writer, ImpactArea value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ImpactArea.Search: - writer.WriteStringValue("search"); - return; - case ImpactArea.Ingest: - writer.WriteStringValue("ingest"); - return; - case ImpactArea.DeploymentManagement: - writer.WriteStringValue("deployment_management"); - return; - case ImpactArea.Backup: - writer.WriteStringValue("backup"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Green: + writer.WriteStringValue(MemberGreen); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Red: + writer.WriteStringValue(MemberRed); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Unknown: + writer.WriteStringValue(MemberUnknown); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus.Yellow: + writer.WriteStringValue(MemberYellow); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus)}'."); + } } -} -[JsonConverter(typeof(IndicatorHealthStatusConverter))] -public enum IndicatorHealthStatus -{ - [EnumMember(Value = "yellow")] - Yellow, - [EnumMember(Value = "unknown")] - Unknown, - [EnumMember(Value = "red")] - Red, - [EnumMember(Value = "green")] - Green + public override Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class IndicatorHealthStatusConverter : JsonConverter +internal sealed partial class ImpactAreaConverter : System.Text.Json.Serialization.JsonConverter { - public override IndicatorHealthStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberBackup = System.Text.Json.JsonEncodedText.Encode("backup"); + private static readonly System.Text.Json.JsonEncodedText MemberDeploymentManagement = System.Text.Json.JsonEncodedText.Encode("deployment_management"); + private static readonly System.Text.Json.JsonEncodedText MemberIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText MemberSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberBackup)) { - case "yellow": - return IndicatorHealthStatus.Yellow; - case "unknown": - return IndicatorHealthStatus.Unknown; - case "red": - return IndicatorHealthStatus.Red; - case "green": - return IndicatorHealthStatus.Green; + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Backup; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberDeploymentManagement)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.DeploymentManagement; + } + + if (reader.ValueTextEquals(MemberIngest)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Ingest; + } + + if (reader.ValueTextEquals(MemberSearch)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Search; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBackup.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Backup; + } + + if (string.Equals(value, MemberDeploymentManagement.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.DeploymentManagement; + } + + if (string.Equals(value, MemberIngest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Ingest; + } + + if (string.Equals(value, MemberSearch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Search; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea)}'."); } - public override void Write(Utf8JsonWriter writer, IndicatorHealthStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndicatorHealthStatus.Yellow: - writer.WriteStringValue("yellow"); - return; - case IndicatorHealthStatus.Unknown: - writer.WriteStringValue("unknown"); - return; - case IndicatorHealthStatus.Red: - writer.WriteStringValue("red"); - return; - case IndicatorHealthStatus.Green: - writer.WriteStringValue("green"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Backup: + writer.WriteStringValue(MemberBackup); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.DeploymentManagement: + writer.WriteStringValue(MemberDeploymentManagement); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Ingest: + writer.WriteStringValue(MemberIngest); + break; + case Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea.Search: + writer.WriteStringValue(MemberSearch); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactArea value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.IndicatorHealthStatusConverter))] +public enum IndicatorHealthStatus +{ + [System.Runtime.Serialization.EnumMember(Value = "green")] + Green, + [System.Runtime.Serialization.EnumMember(Value = "red")] + Red, + [System.Runtime.Serialization.EnumMember(Value = "unknown")] + Unknown, + [System.Runtime.Serialization.EnumMember(Value = "yellow")] + Yellow +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.HealthReport.ImpactAreaConverter))] +public enum ImpactArea +{ + [System.Runtime.Serialization.EnumMember(Value = "backup")] + Backup, + [System.Runtime.Serialization.EnumMember(Value = "deployment_management")] + DeploymentManagement, + [System.Runtime.Serialization.EnumMember(Value = "ingest")] + Ingest, + [System.Runtime.Serialization.EnumMember(Value = "search")] + Search } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.ScriptsPainlessExecute.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.ScriptsPainlessExecute.g.cs new file mode 100644 index 00000000000..537aae5da01 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.ScriptsPainlessExecute.g.cs @@ -0,0 +1,289 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute; + +internal sealed partial class PainlessContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBooleanField = System.Text.Json.JsonEncodedText.Encode("boolean_field"); + private static readonly System.Text.Json.JsonEncodedText MemberCompositeField = System.Text.Json.JsonEncodedText.Encode("composite_field"); + private static readonly System.Text.Json.JsonEncodedText MemberDateField = System.Text.Json.JsonEncodedText.Encode("date_field"); + private static readonly System.Text.Json.JsonEncodedText MemberDoubleField = System.Text.Json.JsonEncodedText.Encode("double_field"); + private static readonly System.Text.Json.JsonEncodedText MemberFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoPointField = System.Text.Json.JsonEncodedText.Encode("geo_point_field"); + private static readonly System.Text.Json.JsonEncodedText MemberIpField = System.Text.Json.JsonEncodedText.Encode("ip_field"); + private static readonly System.Text.Json.JsonEncodedText MemberKeywordField = System.Text.Json.JsonEncodedText.Encode("keyword_field"); + private static readonly System.Text.Json.JsonEncodedText MemberLongField = System.Text.Json.JsonEncodedText.Encode("long_field"); + private static readonly System.Text.Json.JsonEncodedText MemberPainlessTest = System.Text.Json.JsonEncodedText.Encode("painless_test"); + private static readonly System.Text.Json.JsonEncodedText MemberScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBooleanField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.BooleanField; + } + + if (reader.ValueTextEquals(MemberCompositeField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.CompositeField; + } + + if (reader.ValueTextEquals(MemberDateField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DateField; + } + + if (reader.ValueTextEquals(MemberDoubleField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DoubleField; + } + + if (reader.ValueTextEquals(MemberFilter)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Filter; + } + + if (reader.ValueTextEquals(MemberGeoPointField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.GeoPointField; + } + + if (reader.ValueTextEquals(MemberIpField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.IpField; + } + + if (reader.ValueTextEquals(MemberKeywordField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.KeywordField; + } + + if (reader.ValueTextEquals(MemberLongField)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.LongField; + } + + if (reader.ValueTextEquals(MemberPainlessTest)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.PainlessTest; + } + + if (reader.ValueTextEquals(MemberScore)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Score; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBooleanField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.BooleanField; + } + + if (string.Equals(value, MemberCompositeField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.CompositeField; + } + + if (string.Equals(value, MemberDateField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DateField; + } + + if (string.Equals(value, MemberDoubleField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DoubleField; + } + + if (string.Equals(value, MemberFilter.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Filter; + } + + if (string.Equals(value, MemberGeoPointField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.GeoPointField; + } + + if (string.Equals(value, MemberIpField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.IpField; + } + + if (string.Equals(value, MemberKeywordField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.KeywordField; + } + + if (string.Equals(value, MemberLongField.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.LongField; + } + + if (string.Equals(value, MemberPainlessTest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.PainlessTest; + } + + if (string.Equals(value, MemberScore.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Score; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.BooleanField: + writer.WriteStringValue(MemberBooleanField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.CompositeField: + writer.WriteStringValue(MemberCompositeField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DateField: + writer.WriteStringValue(MemberDateField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.DoubleField: + writer.WriteStringValue(MemberDoubleField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Filter: + writer.WriteStringValue(MemberFilter); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.GeoPointField: + writer.WriteStringValue(MemberGeoPointField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.IpField: + writer.WriteStringValue(MemberIpField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.KeywordField: + writer.WriteStringValue(MemberKeywordField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.LongField: + writer.WriteStringValue(MemberLongField); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.PainlessTest: + writer.WriteStringValue(MemberPainlessTest); + break; + case Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext.Score: + writer.WriteStringValue(MemberScore); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContext value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.ScriptsPainlessExecute.PainlessContextConverter))] +public enum PainlessContext +{ + /// + /// + /// The context for boolean fields. The script returns a true or false response. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "boolean_field")] + BooleanField, + /// + /// + /// The context for composite runtime fields. The script returns a map of values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "composite_field")] + CompositeField, + /// + /// + /// The context for date fields. emit takes a long value and the script returns a sorted list of dates. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "date_field")] + DateField, + /// + /// + /// The context for double numeric fields. The script returns a sorted list of double values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "double_field")] + DoubleField, + /// + /// + /// Treats scripts as if they were run inside a script query. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "filter")] + Filter, + /// + /// + /// The context for geo-point fields. emit takes two double parameters, the latitude and longitude values, and the script returns an object in GeoJSON format containing the coordinates for the geo point. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "geo_point_field")] + GeoPointField, + /// + /// + /// The context for ip fields. The script returns a sorted list of IP addresses. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "ip_field")] + IpField, + /// + /// + /// The context for keyword fields. The script returns a sorted list of string values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "keyword_field")] + KeywordField, + /// + /// + /// The context for long numeric fields. The script returns a sorted list of long values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "long_field")] + LongField, + /// + /// + /// The default context if no other context is specified. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "painless_test")] + PainlessTest, + /// + /// + /// Treats scripts as if they were run inside a script_score function in a function_score query. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "score")] + Score +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Search.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Search.g.cs index d585ddc3ee1..fcfb1b69248 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Search.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.Search.g.cs @@ -17,256 +17,625 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -[JsonConverter(typeof(BoundaryScannerConverter))] -public enum BoundaryScanner +internal sealed partial class HighlighterTypeConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Break highlighted fragments at the next word boundary, as determined by Java’s BreakIterator. - /// You can specify the locale to use with boundary_scanner_locale. - /// - /// - [EnumMember(Value = "word")] - Word, - /// - /// - /// Break highlighted fragments at the next sentence boundary, as determined by Java’s BreakIterator. - /// You can specify the locale to use with boundary_scanner_locale. - /// When used with the unified highlighter, the sentence scanner splits sentences bigger than fragment_size at the first word boundary next to fragment_size. - /// You can set fragment_size to 0 to never split any sentence. - /// - /// - [EnumMember(Value = "sentence")] - Sentence, - /// - /// - /// Use the characters specified by boundary_chars as highlighting boundaries. - /// The boundary_max_scan setting controls how far to scan for boundary characters. - /// Only valid for the fvh highlighter. - /// - /// - [EnumMember(Value = "chars")] - Chars + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Core.Search.HighlighterType(reader.ReadValue(options, null)); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } } -internal sealed class BoundaryScannerConverter : JsonConverter +internal sealed partial class BoundaryScannerConverter : System.Text.Json.Serialization.JsonConverter { - public override BoundaryScanner Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberChars = System.Text.Json.JsonEncodedText.Encode("chars"); + private static readonly System.Text.Json.JsonEncodedText MemberSentence = System.Text.Json.JsonEncodedText.Encode("sentence"); + private static readonly System.Text.Json.JsonEncodedText MemberWord = System.Text.Json.JsonEncodedText.Encode("word"); + + public override Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberChars)) { - case "word": - return BoundaryScanner.Word; - case "sentence": - return BoundaryScanner.Sentence; - case "chars": - return BoundaryScanner.Chars; + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Chars; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberSentence)) + { + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Sentence; + } + + if (reader.ValueTextEquals(MemberWord)) + { + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Word; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberChars.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Chars; + } + + if (string.Equals(value, MemberSentence.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Sentence; + } + + if (string.Equals(value, MemberWord.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Word; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner)}'."); } - public override void Write(Utf8JsonWriter writer, BoundaryScanner value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case BoundaryScanner.Word: - writer.WriteStringValue("word"); - return; - case BoundaryScanner.Sentence: - writer.WriteStringValue("sentence"); - return; - case BoundaryScanner.Chars: - writer.WriteStringValue("chars"); - return; + case Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Chars: + writer.WriteStringValue(MemberChars); + break; + case Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Sentence: + writer.WriteStringValue(MemberSentence); + break; + case Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner.Word: + writer.WriteStringValue(MemberWord); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.BoundaryScanner value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(HighlighterEncoderConverter))] -public enum HighlighterEncoder +internal sealed partial class HighlighterFragmenterConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "html")] - Html, - [EnumMember(Value = "default")] - Default + private static readonly System.Text.Json.JsonEncodedText MemberSimple = System.Text.Json.JsonEncodedText.Encode("simple"); + private static readonly System.Text.Json.JsonEncodedText MemberSpan = System.Text.Json.JsonEncodedText.Encode("span"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberSimple)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Simple; + } + + if (reader.ValueTextEquals(MemberSpan)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Span; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberSimple.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Simple; + } + + if (string.Equals(value, MemberSpan.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Span; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Simple: + writer.WriteStringValue(MemberSimple); + break; + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter.Span: + writer.WriteStringValue(MemberSpan); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenter value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class HighlighterEncoderConverter : JsonConverter +internal sealed partial class HighlighterOrderConverter : System.Text.Json.Serialization.JsonConverter { - public override HighlighterEncoder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberScore)) { - case "html": - return HighlighterEncoder.Html; - case "default": - return HighlighterEncoder.Default; + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder.Score; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberScore.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder.Score; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder)}'."); } - public override void Write(Utf8JsonWriter writer, HighlighterEncoder value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case HighlighterEncoder.Html: - writer.WriteStringValue("html"); - return; - case HighlighterEncoder.Default: - writer.WriteStringValue("default"); - return; + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder.Score: + writer.WriteStringValue(MemberScore); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(HighlighterFragmenterConverter))] -public enum HighlighterFragmenter +internal sealed partial class HighlighterTagsSchemaConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "span")] - Span, - [EnumMember(Value = "simple")] - Simple + private static readonly System.Text.Json.JsonEncodedText MemberStyled = System.Text.Json.JsonEncodedText.Encode("styled"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberStyled)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema.Styled; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberStyled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema.Styled; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema.Styled: + writer.WriteStringValue(MemberStyled); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchema value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class HighlighterFragmenterConverter : JsonConverter +internal sealed partial class HighlighterEncoderConverter : System.Text.Json.Serialization.JsonConverter { - public override HighlighterFragmenter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDefault = System.Text.Json.JsonEncodedText.Encode("default"); + private static readonly System.Text.Json.JsonEncodedText MemberHtml = System.Text.Json.JsonEncodedText.Encode("html"); + + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDefault)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Default; + } + + if (reader.ValueTextEquals(MemberHtml)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Html; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDefault.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "span": - return HighlighterFragmenter.Span; - case "simple": - return HighlighterFragmenter.Simple; + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Default; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberHtml.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Html; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder)}'."); } - public override void Write(Utf8JsonWriter writer, HighlighterFragmenter value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case HighlighterFragmenter.Span: - writer.WriteStringValue("span"); - return; - case HighlighterFragmenter.Simple: - writer.WriteStringValue("simple"); - return; + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Default: + writer.WriteStringValue(MemberDefault); + break; + case Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder.Html: + writer.WriteStringValue(MemberHtml); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(HighlighterOrderConverter))] -public enum HighlighterOrder +internal sealed partial class TotalHitsRelationConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "score")] - Score + private static readonly System.Text.Json.JsonEncodedText MemberEq = System.Text.Json.JsonEncodedText.Encode("eq"); + private static readonly System.Text.Json.JsonEncodedText MemberGte = System.Text.Json.JsonEncodedText.Encode("gte"); + + public override Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberEq)) + { + return Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Eq; + } + + if (reader.ValueTextEquals(MemberGte)) + { + return Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Gte; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberEq.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Eq; + } + + if (string.Equals(value, MemberGte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Gte; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Eq: + writer.WriteStringValue(MemberEq); + break; + case Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation.Gte: + writer.WriteStringValue(MemberGte); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class HighlighterOrderConverter : JsonConverter +internal sealed partial class ScoreModeConverter : System.Text.Json.Serialization.JsonConverter { - public override HighlighterOrder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberMultiply = System.Text.Json.JsonEncodedText.Encode("multiply"); + private static readonly System.Text.Json.JsonEncodedText MemberTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Core.Search.ScoreMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Avg; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Max; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Min; + } + + if (reader.ValueTextEquals(MemberMultiply)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Multiply; + } + + if (reader.ValueTextEquals(MemberTotal)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Total; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Avg; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Min; + } + + if (string.Equals(value, MemberMultiply.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "score": - return HighlighterOrder.Score; + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Multiply; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberTotal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Total; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode)}'."); } - public override void Write(Utf8JsonWriter writer, HighlighterOrder value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.ScoreMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case HighlighterOrder.Score: - writer.WriteStringValue("score"); - return; + case Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Multiply: + writer.WriteStringValue(MemberMultiply); + break; + case Elastic.Clients.Elasticsearch.Core.Search.ScoreMode.Total: + writer.WriteStringValue(MemberTotal); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.ScoreMode)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Core.Search.ScoreMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.ScoreMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(HighlighterTagsSchemaConverter))] -public enum HighlighterTagsSchema +internal sealed partial class SuggestSortConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "styled")] - Styled + private static readonly System.Text.Json.JsonEncodedText MemberFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText MemberScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.Core.Search.SuggestSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFrequency)) + { + return Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Frequency; + } + + if (reader.ValueTextEquals(MemberScore)) + { + return Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Score; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFrequency.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Frequency; + } + + if (string.Equals(value, MemberScore.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Score; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SuggestSort value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Frequency: + writer.WriteStringValue(MemberFrequency); + break; + case Elastic.Clients.Elasticsearch.Core.Search.SuggestSort.Score: + writer.WriteStringValue(MemberScore); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.SuggestSort)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.SuggestSort ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.SuggestSort value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class HighlighterTagsSchemaConverter : JsonConverter +internal sealed partial class StringDistanceConverter : System.Text.Json.Serialization.JsonConverter { - public override HighlighterTagsSchema Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDamerauLevenshtein = System.Text.Json.JsonEncodedText.Encode("damerau_levenshtein"); + private static readonly System.Text.Json.JsonEncodedText MemberInternal = System.Text.Json.JsonEncodedText.Encode("internal"); + private static readonly System.Text.Json.JsonEncodedText MemberJaroWinkler = System.Text.Json.JsonEncodedText.Encode("jaro_winkler"); + private static readonly System.Text.Json.JsonEncodedText MemberLevenshtein = System.Text.Json.JsonEncodedText.Encode("levenshtein"); + private static readonly System.Text.Json.JsonEncodedText MemberNgram = System.Text.Json.JsonEncodedText.Encode("ngram"); + + public override Elastic.Clients.Elasticsearch.Core.Search.StringDistance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDamerauLevenshtein)) { - case "styled": - return HighlighterTagsSchema.Styled; + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.DamerauLevenshtein; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberInternal)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Internal; + } + + if (reader.ValueTextEquals(MemberJaroWinkler)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.JaroWinkler; + } + + if (reader.ValueTextEquals(MemberLevenshtein)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Levenshtein; + } + + if (reader.ValueTextEquals(MemberNgram)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Ngram; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDamerauLevenshtein.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.DamerauLevenshtein; + } + + if (string.Equals(value, MemberInternal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Internal; + } + + if (string.Equals(value, MemberJaroWinkler.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.JaroWinkler; + } + + if (string.Equals(value, MemberLevenshtein.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Levenshtein; + } + + if (string.Equals(value, MemberNgram.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Ngram; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.StringDistance)}'."); } - public override void Write(Utf8JsonWriter writer, HighlighterTagsSchema value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.StringDistance value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case HighlighterTagsSchema.Styled: - writer.WriteStringValue("styled"); - return; + case Elastic.Clients.Elasticsearch.Core.Search.StringDistance.DamerauLevenshtein: + writer.WriteStringValue(MemberDamerauLevenshtein); + break; + case Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Internal: + writer.WriteStringValue(MemberInternal); + break; + case Elastic.Clients.Elasticsearch.Core.Search.StringDistance.JaroWinkler: + writer.WriteStringValue(MemberJaroWinkler); + break; + case Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Levenshtein: + writer.WriteStringValue(MemberLevenshtein); + break; + case Elastic.Clients.Elasticsearch.Core.Search.StringDistance.Ngram: + writer.WriteStringValue(MemberNgram); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.Search.StringDistance)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Core.Search.StringDistance ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.Search.StringDistance value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct HighlighterType : IEnumStruct +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTypeConverter))] +public readonly partial struct HighlighterType : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct { public HighlighterType(string value) => Value = value; - +#if NET7_0_OR_GREATER + static HighlighterType IEnumStruct.Create(string value) => value; +#else HighlighterType IEnumStruct.Create(string value) => value; - +#endif public readonly string Value { get; } /// /// - /// The unified highlighter uses the Lucene Unified Highlighter. + /// The fvh highlighter uses the Lucene Fast Vector highlighter. /// /// - public static HighlighterType Unified { get; } = new HighlighterType("unified"); + public static HighlighterType FastVector { get; } = new HighlighterType("fvh"); /// /// @@ -277,14 +646,14 @@ public override void Write(Utf8JsonWriter writer, HighlighterTagsSchema value, J /// /// - /// The fvh highlighter uses the Lucene Fast Vector highlighter. + /// The unified highlighter uses the Lucene Unified Highlighter. /// /// - public static HighlighterType FastVector { get; } = new HighlighterType("fvh"); + public static HighlighterType Unified { get; } = new HighlighterType("unified"); public override string ToString() => Value ?? string.Empty; - public static implicit operator string(HighlighterType highlighterType) => highlighterType.Value; + public static implicit operator string(HighlighterType @enum) => @enum.Value; public static implicit operator HighlighterType(string value) => new(value); public override int GetHashCode() => Value.GetHashCode(); @@ -295,283 +664,185 @@ public override void Write(Utf8JsonWriter writer, HighlighterTagsSchema value, J public static bool operator !=(HighlighterType a, HighlighterType b) => !(a == b); } -[JsonConverter(typeof(ScoreModeConverter))] -public enum ScoreMode +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.BoundaryScannerConverter))] +public enum BoundaryScanner { /// /// - /// Add the original score and the rescore query score. + /// Use the characters specified by boundary_chars as highlighting boundaries. + /// The boundary_max_scan setting controls how far to scan for boundary characters. + /// Only valid for the fvh highlighter. /// /// - [EnumMember(Value = "total")] - Total, + [System.Runtime.Serialization.EnumMember(Value = "chars")] + Chars, /// /// - /// Multiply the original score by the rescore query score. - /// Useful for function query rescores. + /// Break highlighted fragments at the next sentence boundary, as determined by Java’s BreakIterator. + /// You can specify the locale to use with boundary_scanner_locale. + /// When used with the unified highlighter, the sentence scanner splits sentences bigger than fragment_size at the first word boundary next to fragment_size. + /// You can set fragment_size to 0 to never split any sentence. /// /// - [EnumMember(Value = "multiply")] - Multiply, + [System.Runtime.Serialization.EnumMember(Value = "sentence")] + Sentence, /// /// - /// Take the min of the original score and the rescore query score. + /// Break highlighted fragments at the next word boundary, as determined by Java’s BreakIterator. + /// You can specify the locale to use with boundary_scanner_locale. /// /// - [EnumMember(Value = "min")] - Min, + [System.Runtime.Serialization.EnumMember(Value = "word")] + Word +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterFragmenterConverter))] +public enum HighlighterFragmenter +{ + [System.Runtime.Serialization.EnumMember(Value = "simple")] + Simple, + [System.Runtime.Serialization.EnumMember(Value = "span")] + Span +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterOrderConverter))] +public enum HighlighterOrder +{ + [System.Runtime.Serialization.EnumMember(Value = "score")] + Score +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterTagsSchemaConverter))] +public enum HighlighterTagsSchema +{ + [System.Runtime.Serialization.EnumMember(Value = "styled")] + Styled +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.HighlighterEncoderConverter))] +public enum HighlighterEncoder +{ + [System.Runtime.Serialization.EnumMember(Value = "default")] + Default, + [System.Runtime.Serialization.EnumMember(Value = "html")] + Html +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.TotalHitsRelationConverter))] +public enum TotalHitsRelation +{ /// /// - /// Take the max of original score and the rescore query score. + /// Accurate /// /// - [EnumMember(Value = "max")] - Max, + [System.Runtime.Serialization.EnumMember(Value = "eq")] + Eq, /// /// - /// Average the original score and the rescore query score. + /// Lower bound, including returned events or sequences /// /// - [EnumMember(Value = "avg")] - Avg -} - -internal sealed class ScoreModeConverter : JsonConverter -{ - public override ScoreMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "total": - return ScoreMode.Total; - case "multiply": - return ScoreMode.Multiply; - case "min": - return ScoreMode.Min; - case "max": - return ScoreMode.Max; - case "avg": - return ScoreMode.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, ScoreMode value, JsonSerializerOptions options) - { - switch (value) - { - case ScoreMode.Total: - writer.WriteStringValue("total"); - return; - case ScoreMode.Multiply: - writer.WriteStringValue("multiply"); - return; - case ScoreMode.Min: - writer.WriteStringValue("min"); - return; - case ScoreMode.Max: - writer.WriteStringValue("max"); - return; - case ScoreMode.Avg: - writer.WriteStringValue("avg"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "gte")] + Gte } -[JsonConverter(typeof(StringDistanceConverter))] -public enum StringDistance +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.ScoreModeConverter))] +public enum ScoreMode { /// /// - /// String distance algorithm based on character n-grams. + /// Average the original score and the rescore query score. /// /// - [EnumMember(Value = "ngram")] - Ngram, + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, /// /// - /// String distance algorithm based on the Levenshtein edit distance algorithm. + /// Take the max of original score and the rescore query score. /// /// - [EnumMember(Value = "levenshtein")] - Levenshtein, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, /// /// - /// String distance algorithm based on Jaro-Winkler algorithm. + /// Take the min of the original score and the rescore query score. /// /// - [EnumMember(Value = "jaro_winkler")] - JaroWinkler, + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min, /// /// - /// Based on the Damerau-Levenshtein algorithm, but highly optimized for comparing string distance for terms inside the index. + /// Multiply the original score by the rescore query score. + /// Useful for function query rescores. /// /// - [EnumMember(Value = "internal")] - Internal, + [System.Runtime.Serialization.EnumMember(Value = "multiply")] + Multiply, /// /// - /// String distance algorithm based on Damerau-Levenshtein algorithm. + /// Add the original score and the rescore query score. /// /// - [EnumMember(Value = "damerau_levenshtein")] - DamerauLevenshtein + [System.Runtime.Serialization.EnumMember(Value = "total")] + Total } -internal sealed class StringDistanceConverter : JsonConverter -{ - public override StringDistance Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "ngram": - return StringDistance.Ngram; - case "levenshtein": - return StringDistance.Levenshtein; - case "jaro_winkler": - return StringDistance.JaroWinkler; - case "internal": - return StringDistance.Internal; - case "damerau_levenshtein": - return StringDistance.DamerauLevenshtein; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, StringDistance value, JsonSerializerOptions options) - { - switch (value) - { - case StringDistance.Ngram: - writer.WriteStringValue("ngram"); - return; - case StringDistance.Levenshtein: - writer.WriteStringValue("levenshtein"); - return; - case StringDistance.JaroWinkler: - writer.WriteStringValue("jaro_winkler"); - return; - case StringDistance.Internal: - writer.WriteStringValue("internal"); - return; - case StringDistance.DamerauLevenshtein: - writer.WriteStringValue("damerau_levenshtein"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(SuggestSortConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.SuggestSortConverter))] public enum SuggestSort { /// /// - /// Sort by score first, then document frequency and then the term itself. + /// Sort by document frequency first, then similarity score and then the term itself. /// /// - [EnumMember(Value = "score")] - Score, + [System.Runtime.Serialization.EnumMember(Value = "frequency")] + Frequency, /// /// - /// Sort by document frequency first, then similarity score and then the term itself. + /// Sort by score first, then document frequency and then the term itself. /// /// - [EnumMember(Value = "frequency")] - Frequency -} - -internal sealed class SuggestSortConverter : JsonConverter -{ - public override SuggestSort Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "score": - return SuggestSort.Score; - case "frequency": - return SuggestSort.Frequency; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SuggestSort value, JsonSerializerOptions options) - { - switch (value) - { - case SuggestSort.Score: - writer.WriteStringValue("score"); - return; - case SuggestSort.Frequency: - writer.WriteStringValue("frequency"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "score")] + Score } -[JsonConverter(typeof(TotalHitsRelationConverter))] -public enum TotalHitsRelation +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.Search.StringDistanceConverter))] +public enum StringDistance { /// /// - /// Lower bound, including returned events or sequences + /// String distance algorithm based on Damerau-Levenshtein algorithm. /// /// - [EnumMember(Value = "gte")] - Gte, + [System.Runtime.Serialization.EnumMember(Value = "damerau_levenshtein")] + DamerauLevenshtein, /// /// - /// Accurate + /// Based on the Damerau-Levenshtein algorithm, but highly optimized for comparing string distance for terms inside the index. /// /// - [EnumMember(Value = "eq")] - Eq -} - -internal sealed class TotalHitsRelationConverter : JsonConverter -{ - public override TotalHitsRelation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "gte": - return TotalHitsRelation.Gte; - case "eq": - return TotalHitsRelation.Eq; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TotalHitsRelation value, JsonSerializerOptions options) - { - switch (value) - { - case TotalHitsRelation.Gte: - writer.WriteStringValue("gte"); - return; - case TotalHitsRelation.Eq: - writer.WriteStringValue("eq"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "internal")] + Internal, + /// + /// + /// String distance algorithm based on Jaro-Winkler algorithm. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "jaro_winkler")] + JaroWinkler, + /// + /// + /// String distance algorithm based on the Levenshtein edit distance algorithm. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "levenshtein")] + Levenshtein, + /// + /// + /// String distance algorithm based on character n-grams. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "ngram")] + Ngram } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.SearchMvt.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.SearchMvt.g.cs index ba5a373ae24..472aba20fec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.SearchMvt.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Core.SearchMvt.g.cs @@ -17,104 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.SearchMvt; -[JsonConverter(typeof(GridAggregationTypeConverter))] -public enum GridAggregationType +internal sealed partial class GridAggregationTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "geotile")] - Geotile, - [EnumMember(Value = "geohex")] - Geohex -} + private static readonly System.Text.Json.JsonEncodedText MemberGeohex = System.Text.Json.JsonEncodedText.Encode("geohex"); + private static readonly System.Text.Json.JsonEncodedText MemberGeotile = System.Text.Json.JsonEncodedText.Encode("geotile"); -internal sealed class GridAggregationTypeConverter : JsonConverter -{ - public override GridAggregationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGeohex)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geohex; + } + + if (reader.ValueTextEquals(MemberGeotile)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geotile; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGeohex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geohex; + } + + if (string.Equals(value, MemberGeotile.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "geotile": - return GridAggregationType.Geotile; - case "geohex": - return GridAggregationType.Geohex; + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geotile; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType)}'."); } - public override void Write(Utf8JsonWriter writer, GridAggregationType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GridAggregationType.Geotile: - writer.WriteStringValue("geotile"); - return; - case GridAggregationType.Geohex: - writer.WriteStringValue("geohex"); - return; + case Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geohex: + writer.WriteStringValue(MemberGeohex); + break; + case Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType.Geotile: + writer.WriteStringValue(MemberGeotile); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(GridTypeConverter))] -public enum GridType -{ - [EnumMember(Value = "point")] - Point, - [EnumMember(Value = "grid")] - Grid, - [EnumMember(Value = "centroid")] - Centroid + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GridTypeConverter : JsonConverter +internal sealed partial class GridTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override GridType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberCentroid = System.Text.Json.JsonEncodedText.Encode("centroid"); + private static readonly System.Text.Json.JsonEncodedText MemberGrid = System.Text.Json.JsonEncodedText.Encode("grid"); + private static readonly System.Text.Json.JsonEncodedText MemberPoint = System.Text.Json.JsonEncodedText.Encode("point"); + + public override Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCentroid)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Centroid; + } + + if (reader.ValueTextEquals(MemberGrid)) { - case "point": - return GridType.Point; - case "grid": - return GridType.Grid; - case "centroid": - return GridType.Centroid; + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Grid; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberPoint)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Point; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCentroid.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Centroid; + } + + if (string.Equals(value, MemberGrid.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Grid; + } + + if (string.Equals(value, MemberPoint.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Point; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType)}'."); } - public override void Write(Utf8JsonWriter writer, GridType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GridType.Point: - writer.WriteStringValue("point"); - return; - case GridType.Grid: - writer.WriteStringValue("grid"); - return; - case GridType.Centroid: - writer.WriteStringValue("centroid"); - return; + case Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Centroid: + writer.WriteStringValue(MemberCentroid); + break; + case Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Grid: + writer.WriteStringValue(MemberGrid); + break; + case Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType.Point: + writer.WriteStringValue(MemberPoint); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Core.SearchMvt.GridType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridAggregationTypeConverter))] +public enum GridAggregationType +{ + [System.Runtime.Serialization.EnumMember(Value = "geohex")] + Geohex, + [System.Runtime.Serialization.EnumMember(Value = "geotile")] + Geotile +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Core.SearchMvt.GridTypeConverter))] +public enum GridType +{ + [System.Runtime.Serialization.EnumMember(Value = "centroid")] + Centroid, + [System.Runtime.Serialization.EnumMember(Value = "grid")] + Grid, + [System.Runtime.Serialization.EnumMember(Value = "point")] + Point } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.CrossClusterReplication.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.CrossClusterReplication.g.cs index b7c7782a161..c04b392dc0d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.CrossClusterReplication.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.CrossClusterReplication.g.cs @@ -17,55 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.CrossClusterReplication; -[JsonConverter(typeof(FollowerIndexStatusConverter))] -public enum FollowerIndexStatus +internal sealed partial class FollowerIndexStatusConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "paused")] - Paused, - [EnumMember(Value = "active")] - Active -} + private static readonly System.Text.Json.JsonEncodedText MemberActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText MemberPaused = System.Text.Json.JsonEncodedText.Encode("paused"); -internal sealed class FollowerIndexStatusConverter : JsonConverter -{ - public override FollowerIndexStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberActive)) + { + return Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Active; + } + + if (reader.ValueTextEquals(MemberPaused)) + { + return Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Paused; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberActive.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "paused": - return FollowerIndexStatus.Paused; - case "active": - return FollowerIndexStatus.Active; + return Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Active; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberPaused.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Paused; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus)}'."); } - public override void Write(Utf8JsonWriter writer, FollowerIndexStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case FollowerIndexStatus.Paused: - writer.WriteStringValue("paused"); - return; - case FollowerIndexStatus.Active: - writer.WriteStringValue("active"); - return; + case Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Active: + writer.WriteStringValue(MemberActive); + break; + case Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus.Paused: + writer.WriteStringValue(MemberPaused); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.CrossClusterReplication.FollowerIndexStatusConverter))] +public enum FollowerIndexStatus +{ + [System.Runtime.Serialization.EnumMember(Value = "active")] + Active, + [System.Runtime.Serialization.EnumMember(Value = "paused")] + Paused } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Enrich.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Enrich.g.cs index e515e745ac1..7d0a0639f7a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Enrich.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Enrich.g.cs @@ -17,118 +17,204 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Enrich; -[JsonConverter(typeof(EnrichPolicyPhaseConverter))] -public enum EnrichPolicyPhase +internal sealed partial class EnrichPolicyPhaseConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "SCHEDULED")] - Scheduled, - [EnumMember(Value = "RUNNING")] - Running, - [EnumMember(Value = "FAILED")] - Failed, - [EnumMember(Value = "COMPLETE")] - Complete -} + private static readonly System.Text.Json.JsonEncodedText MemberCancelled = System.Text.Json.JsonEncodedText.Encode("CANCELLED"); + private static readonly System.Text.Json.JsonEncodedText MemberComplete = System.Text.Json.JsonEncodedText.Encode("COMPLETE"); + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("FAILED"); + private static readonly System.Text.Json.JsonEncodedText MemberRunning = System.Text.Json.JsonEncodedText.Encode("RUNNING"); + private static readonly System.Text.Json.JsonEncodedText MemberScheduled = System.Text.Json.JsonEncodedText.Encode("SCHEDULED"); -internal sealed class EnrichPolicyPhaseConverter : JsonConverter -{ - public override EnrichPolicyPhase Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCancelled)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Cancelled; + } + + if (reader.ValueTextEquals(MemberComplete)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Complete; + } + + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Failed; + } + + if (reader.ValueTextEquals(MemberRunning)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Running; + } + + if (reader.ValueTextEquals(MemberScheduled)) { - case "SCHEDULED": - return EnrichPolicyPhase.Scheduled; - case "RUNNING": - return EnrichPolicyPhase.Running; - case "FAILED": - return EnrichPolicyPhase.Failed; - case "COMPLETE": - return EnrichPolicyPhase.Complete; + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Scheduled; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberCancelled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Cancelled; + } + + if (string.Equals(value, MemberComplete.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Complete; + } + + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Failed; + } + + if (string.Equals(value, MemberRunning.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Running; + } + + if (string.Equals(value, MemberScheduled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Scheduled; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase)}'."); } - public override void Write(Utf8JsonWriter writer, EnrichPolicyPhase value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case EnrichPolicyPhase.Scheduled: - writer.WriteStringValue("SCHEDULED"); - return; - case EnrichPolicyPhase.Running: - writer.WriteStringValue("RUNNING"); - return; - case EnrichPolicyPhase.Failed: - writer.WriteStringValue("FAILED"); - return; - case EnrichPolicyPhase.Complete: - writer.WriteStringValue("COMPLETE"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Cancelled: + writer.WriteStringValue(MemberCancelled); + break; + case Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Complete: + writer.WriteStringValue(MemberComplete); + break; + case Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Running: + writer.WriteStringValue(MemberRunning); + break; + case Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase.Scheduled: + writer.WriteStringValue(MemberScheduled); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase)}'."); + } } -} -[JsonConverter(typeof(PolicyTypeConverter))] -public enum PolicyType -{ - [EnumMember(Value = "range")] - Range, - [EnumMember(Value = "match")] - Match, - [EnumMember(Value = "geo_match")] - GeoMatch + public override Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhase value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class PolicyTypeConverter : JsonConverter +internal sealed partial class PolicyTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override PolicyType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberGeoMatch = System.Text.Json.JsonEncodedText.Encode("geo_match"); + private static readonly System.Text.Json.JsonEncodedText MemberMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText MemberRange = System.Text.Json.JsonEncodedText.Encode("range"); + + public override Elastic.Clients.Elasticsearch.Enrich.PolicyType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGeoMatch)) + { + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.GeoMatch; + } + + if (reader.ValueTextEquals(MemberMatch)) + { + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.Match; + } + + if (reader.ValueTextEquals(MemberRange)) + { + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.Range; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGeoMatch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.GeoMatch; + } + + if (string.Equals(value, MemberMatch.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "range": - return PolicyType.Range; - case "match": - return PolicyType.Match; - case "geo_match": - return PolicyType.GeoMatch; + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.Match; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Enrich.PolicyType.Range; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Enrich.PolicyType)}'."); } - public override void Write(Utf8JsonWriter writer, PolicyType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.PolicyType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case PolicyType.Range: - writer.WriteStringValue("range"); - return; - case PolicyType.Match: - writer.WriteStringValue("match"); - return; - case PolicyType.GeoMatch: - writer.WriteStringValue("geo_match"); - return; + case Elastic.Clients.Elasticsearch.Enrich.PolicyType.GeoMatch: + writer.WriteStringValue(MemberGeoMatch); + break; + case Elastic.Clients.Elasticsearch.Enrich.PolicyType.Match: + writer.WriteStringValue(MemberMatch); + break; + case Elastic.Clients.Elasticsearch.Enrich.PolicyType.Range: + writer.WriteStringValue(MemberRange); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Enrich.PolicyType)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Enrich.PolicyType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Enrich.PolicyType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.EnrichPolicyPhaseConverter))] +public enum EnrichPolicyPhase +{ + [System.Runtime.Serialization.EnumMember(Value = "CANCELLED")] + Cancelled, + [System.Runtime.Serialization.EnumMember(Value = "COMPLETE")] + Complete, + [System.Runtime.Serialization.EnumMember(Value = "FAILED")] + Failed, + [System.Runtime.Serialization.EnumMember(Value = "RUNNING")] + Running, + [System.Runtime.Serialization.EnumMember(Value = "SCHEDULED")] + Scheduled +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Enrich.PolicyTypeConverter))] +public enum PolicyType +{ + [System.Runtime.Serialization.EnumMember(Value = "geo_match")] + GeoMatch, + [System.Runtime.Serialization.EnumMember(Value = "match")] + Match, + [System.Runtime.Serialization.EnumMember(Value = "range")] + Range } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Eql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Eql.g.cs index d4d3772640b..f3eae7798b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Eql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Eql.g.cs @@ -17,65 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; -[JsonConverter(typeof(ResultPositionConverter))] -public enum ResultPosition +internal sealed partial class ResultPositionConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Return the most recent matches, similar to the Unix tail command. - /// - /// - [EnumMember(Value = "tail")] - Tail, - /// - /// - /// Return the earliest matches, similar to the Unix head command. - /// - /// - [EnumMember(Value = "head")] - Head -} + private static readonly System.Text.Json.JsonEncodedText MemberHead = System.Text.Json.JsonEncodedText.Encode("head"); + private static readonly System.Text.Json.JsonEncodedText MemberTail = System.Text.Json.JsonEncodedText.Encode("tail"); -internal sealed class ResultPositionConverter : JsonConverter -{ - public override ResultPosition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Eql.ResultPosition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberHead)) { - case "tail": - return ResultPosition.Tail; - case "head": - return ResultPosition.Head; + return Elastic.Clients.Elasticsearch.Eql.ResultPosition.Head; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberTail)) + { + return Elastic.Clients.Elasticsearch.Eql.ResultPosition.Tail; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberHead.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Eql.ResultPosition.Head; + } + + if (string.Equals(value, MemberTail.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Eql.ResultPosition.Tail; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Eql.ResultPosition)}'."); } - public override void Write(Utf8JsonWriter writer, ResultPosition value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.ResultPosition value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ResultPosition.Tail: - writer.WriteStringValue("tail"); - return; - case ResultPosition.Head: - writer.WriteStringValue("head"); - return; + case Elastic.Clients.Elasticsearch.Eql.ResultPosition.Head: + writer.WriteStringValue(MemberHead); + break; + case Elastic.Clients.Elasticsearch.Eql.ResultPosition.Tail: + writer.WriteStringValue(MemberTail); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Eql.ResultPosition)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Eql.ResultPosition ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.ResultPosition value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.ResultPositionConverter))] +public enum ResultPosition +{ + /// + /// + /// Return the earliest matches, similar to the Unix head command. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "head")] + Head, + /// + /// + /// Return the most recent matches, similar to the Unix tail command. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "tail")] + Tail } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs index 88f73b46228..cd426889710 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs @@ -17,97 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Esql; -[JsonConverter(typeof(EsqlFormatConverter))] -public enum EsqlFormat +internal sealed partial class EsqlFormatConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "yaml")] - Yaml, - [EnumMember(Value = "txt")] - Txt, - [EnumMember(Value = "tsv")] - Tsv, - [EnumMember(Value = "smile")] - Smile, - [EnumMember(Value = "json")] - Json, - [EnumMember(Value = "csv")] - Csv, - [EnumMember(Value = "cbor")] - Cbor, - [EnumMember(Value = "arrow")] - Arrow -} + private static readonly System.Text.Json.JsonEncodedText MemberArrow = System.Text.Json.JsonEncodedText.Encode("arrow"); + private static readonly System.Text.Json.JsonEncodedText MemberCbor = System.Text.Json.JsonEncodedText.Encode("cbor"); + private static readonly System.Text.Json.JsonEncodedText MemberCsv = System.Text.Json.JsonEncodedText.Encode("csv"); + private static readonly System.Text.Json.JsonEncodedText MemberJson = System.Text.Json.JsonEncodedText.Encode("json"); + private static readonly System.Text.Json.JsonEncodedText MemberSmile = System.Text.Json.JsonEncodedText.Encode("smile"); + private static readonly System.Text.Json.JsonEncodedText MemberTsv = System.Text.Json.JsonEncodedText.Encode("tsv"); + private static readonly System.Text.Json.JsonEncodedText MemberTxt = System.Text.Json.JsonEncodedText.Encode("txt"); + private static readonly System.Text.Json.JsonEncodedText MemberYaml = System.Text.Json.JsonEncodedText.Encode("yaml"); -internal sealed class EsqlFormatConverter : JsonConverter -{ - public override EsqlFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Esql.EsqlFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "yaml": - return EsqlFormat.Yaml; - case "txt": - return EsqlFormat.Txt; - case "tsv": - return EsqlFormat.Tsv; - case "smile": - return EsqlFormat.Smile; - case "json": - return EsqlFormat.Json; - case "csv": - return EsqlFormat.Csv; - case "cbor": - return EsqlFormat.Cbor; - case "arrow": - return EsqlFormat.Arrow; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberArrow)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Arrow; + } + + if (reader.ValueTextEquals(MemberCbor)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Cbor; + } + + if (reader.ValueTextEquals(MemberCsv)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Csv; + } + + if (reader.ValueTextEquals(MemberJson)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Json; + } + + if (reader.ValueTextEquals(MemberSmile)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Smile; + } + + if (reader.ValueTextEquals(MemberTsv)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Tsv; + } + + if (reader.ValueTextEquals(MemberTxt)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Txt; + } + + if (reader.ValueTextEquals(MemberYaml)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Yaml; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberArrow.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Arrow; + } + + if (string.Equals(value, MemberCbor.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Cbor; + } + + if (string.Equals(value, MemberCsv.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Csv; + } + + if (string.Equals(value, MemberJson.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Json; + } + + if (string.Equals(value, MemberSmile.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Smile; + } + + if (string.Equals(value, MemberTsv.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Tsv; + } + + if (string.Equals(value, MemberTxt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Txt; + } + + if (string.Equals(value, MemberYaml.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Yaml; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Esql.EsqlFormat)}'."); } - public override void Write(Utf8JsonWriter writer, EsqlFormat value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.EsqlFormat value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case EsqlFormat.Yaml: - writer.WriteStringValue("yaml"); - return; - case EsqlFormat.Txt: - writer.WriteStringValue("txt"); - return; - case EsqlFormat.Tsv: - writer.WriteStringValue("tsv"); - return; - case EsqlFormat.Smile: - writer.WriteStringValue("smile"); - return; - case EsqlFormat.Json: - writer.WriteStringValue("json"); - return; - case EsqlFormat.Csv: - writer.WriteStringValue("csv"); - return; - case EsqlFormat.Cbor: - writer.WriteStringValue("cbor"); - return; - case EsqlFormat.Arrow: - writer.WriteStringValue("arrow"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Arrow: + writer.WriteStringValue(MemberArrow); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Cbor: + writer.WriteStringValue(MemberCbor); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Csv: + writer.WriteStringValue(MemberCsv); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Json: + writer.WriteStringValue(MemberJson); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Smile: + writer.WriteStringValue(MemberSmile); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Tsv: + writer.WriteStringValue(MemberTsv); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Txt: + writer.WriteStringValue(MemberTxt); + break; + case Elastic.Clients.Elasticsearch.Esql.EsqlFormat.Yaml: + writer.WriteStringValue(MemberYaml); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Esql.EsqlFormat)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Esql.EsqlFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Esql.EsqlFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Esql.EsqlFormatConverter))] +public enum EsqlFormat +{ + [System.Runtime.Serialization.EnumMember(Value = "arrow")] + Arrow, + [System.Runtime.Serialization.EnumMember(Value = "cbor")] + Cbor, + [System.Runtime.Serialization.EnumMember(Value = "csv")] + Csv, + [System.Runtime.Serialization.EnumMember(Value = "json")] + Json, + [System.Runtime.Serialization.EnumMember(Value = "smile")] + Smile, + [System.Runtime.Serialization.EnumMember(Value = "tsv")] + Tsv, + [System.Runtime.Serialization.EnumMember(Value = "txt")] + Txt, + [System.Runtime.Serialization.EnumMember(Value = "yaml")] + Yaml } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.IndexManagement.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.IndexManagement.g.cs index 26f7df4182d..b9414ddb33f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.IndexManagement.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.IndexManagement.g.cs @@ -17,746 +17,1261 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -[JsonConverter(typeof(FeatureConverter))] -public enum Feature +internal sealed partial class FeatureConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "settings")] - Settings, - [EnumMember(Value = "mappings")] - Mappings, - [EnumMember(Value = "aliases")] - Aliases -} + private static readonly System.Text.Json.JsonEncodedText MemberAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText MemberMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText MemberSettings = System.Text.Json.JsonEncodedText.Encode("settings"); -internal sealed class FeatureConverter : JsonConverter -{ - public override Feature Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.IndexManagement.Feature Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAliases)) { - case "settings": - return Feature.Settings; - case "mappings": - return Feature.Mappings; - case "aliases": - return Feature.Aliases; + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Aliases; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberMappings)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Mappings; + } - public override void Write(Utf8JsonWriter writer, Feature value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberSettings)) { - case Feature.Settings: - writer.WriteStringValue("settings"); - return; - case Feature.Mappings: - writer.WriteStringValue("mappings"); - return; - case Feature.Aliases: - writer.WriteStringValue("aliases"); - return; + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Settings; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAliases.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Aliases; + } -[JsonConverter(typeof(IndexCheckOnStartupConverter))] -public enum IndexCheckOnStartup -{ - [EnumMember(Value = "true")] - True, - [EnumMember(Value = "false")] - False, - [EnumMember(Value = "checksum")] - Checksum -} + if (string.Equals(value, MemberMappings.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Mappings; + } -internal sealed class IndexCheckOnStartupConverter : JsonConverter -{ - public override IndexCheckOnStartup Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberSettings.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "true": - return IndexCheckOnStartup.True; - case "false": - return IndexCheckOnStartup.False; - case "checksum": - return IndexCheckOnStartup.Checksum; + return Elastic.Clients.Elasticsearch.IndexManagement.Feature.Settings; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.Feature)}'."); } - public override void Write(Utf8JsonWriter writer, IndexCheckOnStartup value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Feature value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndexCheckOnStartup.True: - writer.WriteStringValue("true"); - return; - case IndexCheckOnStartup.False: - writer.WriteStringValue("false"); - return; - case IndexCheckOnStartup.Checksum: - writer.WriteStringValue("checksum"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.Feature.Aliases: + writer.WriteStringValue(MemberAliases); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.Feature.Mappings: + writer.WriteStringValue(MemberMappings); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.Feature.Settings: + writer.WriteStringValue(MemberSettings); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.Feature)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.Feature ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(IndexMetadataStateConverter))] -public enum IndexMetadataState -{ - [EnumMember(Value = "open")] - Open, - [EnumMember(Value = "close")] - Close + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Feature value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class IndexMetadataStateConverter : JsonConverter +internal sealed partial class ModeEnumConverter : System.Text.Json.Serialization.JsonConverter { - public override IndexMetadataState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberUpgrade = System.Text.Json.JsonEncodedText.Encode("upgrade"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberUpgrade)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum.Upgrade; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberUpgrade.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "open": - return IndexMetadataState.Open; - case "close": - return IndexMetadataState.Close; + return Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum.Upgrade; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum)}'."); } - public override void Write(Utf8JsonWriter writer, IndexMetadataState value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndexMetadataState.Open: - writer.WriteStringValue("open"); - return; - case IndexMetadataState.Close: - writer.WriteStringValue("close"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum.Upgrade: + writer.WriteStringValue(MemberUpgrade); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(IndexRoutingAllocationOptionsConverter))] -public enum IndexRoutingAllocationOptions -{ - [EnumMember(Value = "primaries")] - Primaries, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "new_primaries")] - NewPrimaries, - [EnumMember(Value = "all")] - All + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class IndexRoutingAllocationOptionsConverter : JsonConverter +internal sealed partial class ShardStoreAllocationConverter : System.Text.Json.Serialization.JsonConverter { - public override IndexRoutingAllocationOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText MemberReplica = System.Text.Json.JsonEncodedText.Encode("replica"); + private static readonly System.Text.Json.JsonEncodedText MemberUnused = System.Text.Json.JsonEncodedText.Encode("unused"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberPrimary)) { - case "primaries": - return IndexRoutingAllocationOptions.Primaries; - case "none": - return IndexRoutingAllocationOptions.None; - case "new_primaries": - return IndexRoutingAllocationOptions.NewPrimaries; - case "all": - return IndexRoutingAllocationOptions.All; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Primary; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberReplica)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Replica; + } - public override void Write(Utf8JsonWriter writer, IndexRoutingAllocationOptions value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberUnused)) { - case IndexRoutingAllocationOptions.Primaries: - writer.WriteStringValue("primaries"); - return; - case IndexRoutingAllocationOptions.None: - writer.WriteStringValue("none"); - return; - case IndexRoutingAllocationOptions.NewPrimaries: - writer.WriteStringValue("new_primaries"); - return; - case IndexRoutingAllocationOptions.All: - writer.WriteStringValue("all"); - return; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Unused; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberPrimary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Primary; + } -[JsonConverter(typeof(IndexRoutingRebalanceOptionsConverter))] -public enum IndexRoutingRebalanceOptions -{ - [EnumMember(Value = "replicas")] - Replicas, - [EnumMember(Value = "primaries")] - Primaries, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "all")] - All -} + if (string.Equals(value, MemberReplica.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Replica; + } -internal sealed class IndexRoutingRebalanceOptionsConverter : JsonConverter -{ - public override IndexRoutingRebalanceOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberUnused.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "replicas": - return IndexRoutingRebalanceOptions.Replicas; - case "primaries": - return IndexRoutingRebalanceOptions.Primaries; - case "none": - return IndexRoutingRebalanceOptions.None; - case "all": - return IndexRoutingRebalanceOptions.All; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Unused; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation)}'."); } - public override void Write(Utf8JsonWriter writer, IndexRoutingRebalanceOptions value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndexRoutingRebalanceOptions.Replicas: - writer.WriteStringValue("replicas"); - return; - case IndexRoutingRebalanceOptions.Primaries: - writer.WriteStringValue("primaries"); - return; - case IndexRoutingRebalanceOptions.None: - writer.WriteStringValue("none"); - return; - case IndexRoutingRebalanceOptions.All: - writer.WriteStringValue("all"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Primary: + writer.WriteStringValue(MemberPrimary); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Replica: + writer.WriteStringValue(MemberReplica); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation.Unused: + writer.WriteStringValue(MemberUnused); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ManagedByConverter))] -public enum ManagedBy -{ - [EnumMember(Value = "Unmanaged")] - Unmanaged, - [EnumMember(Value = "Index Lifecycle Management")] - Ilm, - [EnumMember(Value = "Data stream lifecycle")] - Datastream + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ManagedByConverter : JsonConverter +internal sealed partial class ShardStoreStatusConverter : System.Text.Json.Serialization.JsonConverter { - public override ManagedBy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberGreen = System.Text.Json.JsonEncodedText.Encode("green"); + private static readonly System.Text.Json.JsonEncodedText MemberRed = System.Text.Json.JsonEncodedText.Encode("red"); + private static readonly System.Text.Json.JsonEncodedText MemberYellow = System.Text.Json.JsonEncodedText.Encode("yellow"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAll)) { - case "Unmanaged": - return ManagedBy.Unmanaged; - case "Index Lifecycle Management": - return ManagedBy.Ilm; - case "Data stream lifecycle": - return ManagedBy.Datastream; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.All; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberGreen)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Green; + } - public override void Write(Utf8JsonWriter writer, ManagedBy value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberRed)) { - case ManagedBy.Unmanaged: - writer.WriteStringValue("Unmanaged"); - return; - case ManagedBy.Ilm: - writer.WriteStringValue("Index Lifecycle Management"); - return; - case ManagedBy.Datastream: - writer.WriteStringValue("Data stream lifecycle"); - return; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Red; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberYellow)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Yellow; + } -[JsonConverter(typeof(NumericFielddataFormatConverter))] -public enum NumericFielddataFormat -{ - [EnumMember(Value = "disabled")] - Disabled, - [EnumMember(Value = "array")] - Array -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.All; + } -internal sealed class NumericFielddataFormatConverter : JsonConverter -{ - public override NumericFielddataFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberGreen.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Green; + } + + if (string.Equals(value, MemberRed.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "disabled": - return NumericFielddataFormat.Disabled; - case "array": - return NumericFielddataFormat.Array; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Red; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberYellow.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Yellow; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus)}'."); } - public override void Write(Utf8JsonWriter writer, NumericFielddataFormat value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case NumericFielddataFormat.Disabled: - writer.WriteStringValue("disabled"); - return; - case NumericFielddataFormat.Array: - writer.WriteStringValue("array"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Green: + writer.WriteStringValue(MemberGreen); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Red: + writer.WriteStringValue(MemberRed); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus.Yellow: + writer.WriteStringValue(MemberYellow); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SegmentSortMissingConverter))] -public enum SegmentSortMissing -{ - [EnumMember(Value = "_last")] - Last, - [EnumMember(Value = "_first")] - First + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SegmentSortMissingConverter : JsonConverter +internal sealed partial class IndexMetadataStateConverter : System.Text.Json.Serialization.JsonConverter { - public override SegmentSortMissing Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberClose = System.Text.Json.JsonEncodedText.Encode("close"); + private static readonly System.Text.Json.JsonEncodedText MemberOpen = System.Text.Json.JsonEncodedText.Encode("open"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberClose)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Close; + } + + if (reader.ValueTextEquals(MemberOpen)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Open; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberClose.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Close; + } + + if (string.Equals(value, MemberOpen.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "_last": - return SegmentSortMissing.Last; - case "_first": - return SegmentSortMissing.First; + return Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Open; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState)}'."); } - public override void Write(Utf8JsonWriter writer, SegmentSortMissing value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SegmentSortMissing.Last: - writer.WriteStringValue("_last"); - return; - case SegmentSortMissing.First: - writer.WriteStringValue("_first"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Close: + writer.WriteStringValue(MemberClose); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState.Open: + writer.WriteStringValue(MemberOpen); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SegmentSortModeConverter))] -public enum SegmentSortMode -{ - [EnumMember(Value = "min")] - Min, - [EnumMember(Value = "max")] - Max + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SegmentSortModeConverter : JsonConverter +internal sealed partial class ShardRoutingStateConverter : System.Text.Json.Serialization.JsonConverter { - public override SegmentSortMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberInitializing = System.Text.Json.JsonEncodedText.Encode("INITIALIZING"); + private static readonly System.Text.Json.JsonEncodedText MemberRelocating = System.Text.Json.JsonEncodedText.Encode("RELOCATING"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("STARTED"); + private static readonly System.Text.Json.JsonEncodedText MemberUnassigned = System.Text.Json.JsonEncodedText.Encode("UNASSIGNED"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberInitializing)) { - case "min": - case "MIN": - return SegmentSortMode.Min; - case "max": - case "MAX": - return SegmentSortMode.Max; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Initializing; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberRelocating)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Relocating; + } - public override void Write(Utf8JsonWriter writer, SegmentSortMode value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberStarted)) { - case SegmentSortMode.Min: - writer.WriteStringValue("min"); - return; - case SegmentSortMode.Max: - writer.WriteStringValue("max"); - return; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Started; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberUnassigned)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Unassigned; + } -[JsonConverter(typeof(SegmentSortOrderConverter))] -public enum SegmentSortOrder -{ - [EnumMember(Value = "desc")] - Desc, - [EnumMember(Value = "asc")] - Asc -} + var value = reader.GetString()!; + if (string.Equals(value, MemberInitializing.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Initializing; + } -internal sealed class SegmentSortOrderConverter : JsonConverter -{ - public override SegmentSortOrder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberRelocating.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "desc": - case "DESC": - return SegmentSortOrder.Desc; - case "asc": - case "ASC": - return SegmentSortOrder.Asc; + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Relocating; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Started; + } + + if (string.Equals(value, MemberUnassigned.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Unassigned; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState)}'."); } - public override void Write(Utf8JsonWriter writer, SegmentSortOrder value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SegmentSortOrder.Desc: - writer.WriteStringValue("desc"); - return; - case SegmentSortOrder.Asc: - writer.WriteStringValue("asc"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Initializing: + writer.WriteStringValue(MemberInitializing); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Relocating: + writer.WriteStringValue(MemberRelocating); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState.Unassigned: + writer.WriteStringValue(MemberUnassigned); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState)}'."); } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(ShardRoutingStateConverter))] -public enum ShardRoutingState +internal sealed partial class IndexCheckOnStartupConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "UNASSIGNED")] - Unassigned, - [EnumMember(Value = "STARTED")] - Started, - [EnumMember(Value = "RELOCATING")] - Relocating, - [EnumMember(Value = "INITIALIZING")] - Initializing -} + private static readonly System.Text.Json.JsonEncodedText MemberChecksum = System.Text.Json.JsonEncodedText.Encode("checksum"); + private static readonly System.Text.Json.JsonEncodedText MemberFalse = System.Text.Json.JsonEncodedText.Encode("false"); + private static readonly System.Text.Json.JsonEncodedText MemberTrue = System.Text.Json.JsonEncodedText.Encode("true"); -internal sealed class ShardRoutingStateConverter : JsonConverter -{ - public override ShardRoutingState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberChecksum)) { - case "UNASSIGNED": - return ShardRoutingState.Unassigned; - case "STARTED": - return ShardRoutingState.Started; - case "RELOCATING": - return ShardRoutingState.Relocating; - case "INITIALIZING": - return ShardRoutingState.Initializing; + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.Checksum; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberFalse)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.False; + } - public override void Write(Utf8JsonWriter writer, ShardRoutingState value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberTrue)) { - case ShardRoutingState.Unassigned: - writer.WriteStringValue("UNASSIGNED"); - return; - case ShardRoutingState.Started: - writer.WriteStringValue("STARTED"); - return; - case ShardRoutingState.Relocating: - writer.WriteStringValue("RELOCATING"); - return; - case ShardRoutingState.Initializing: - writer.WriteStringValue("INITIALIZING"); - return; + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.True; } - writer.WriteNullValue(); - } -} + if (reader.TokenType is not System.Text.Json.JsonTokenType.String) + { + throw new System.Text.Json.JsonException($"Unknown member of type '{reader.TokenType}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup)}'."); + } -[JsonConverter(typeof(ShardStoreAllocationConverter))] -public enum ShardStoreAllocation -{ - [EnumMember(Value = "unused")] - Unused, - [EnumMember(Value = "replica")] - Replica, - [EnumMember(Value = "primary")] - Primary -} + var value = reader.GetString()!; + if (string.Equals(value, MemberChecksum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.Checksum; + } -internal sealed class ShardStoreAllocationConverter : JsonConverter -{ - public override ShardStoreAllocation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberFalse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.False; + } + + if (string.Equals(value, MemberTrue.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "unused": - return ShardStoreAllocation.Unused; - case "replica": - return ShardStoreAllocation.Replica; - case "primary": - return ShardStoreAllocation.Primary; + return Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.True; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup)}'."); } - public override void Write(Utf8JsonWriter writer, ShardStoreAllocation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ShardStoreAllocation.Unused: - writer.WriteStringValue("unused"); - return; - case ShardStoreAllocation.Replica: - writer.WriteStringValue("replica"); - return; - case ShardStoreAllocation.Primary: - writer.WriteStringValue("primary"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.Checksum: + writer.WriteStringValue(MemberChecksum); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.False: + writer.WriteRawValue(MemberFalse.EncodedUtf8Bytes); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup.True: + writer.WriteRawValue(MemberTrue.EncodedUtf8Bytes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ShardStoreStatusConverter))] -public enum ShardStoreStatus -{ - /// - /// - /// One or more replica shards are unassigned. - /// - /// - [EnumMember(Value = "yellow")] - Yellow, - /// - /// - /// The primary shard is unassigned. - /// - /// - [EnumMember(Value = "red")] - Red, - /// - /// - /// The primary shard and all replica shards are assigned. - /// - /// - [EnumMember(Value = "green")] - Green, - /// - /// - /// Return all shards, regardless of health status. - /// - /// - [EnumMember(Value = "all")] - All + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ShardStoreStatusConverter : JsonConverter +internal sealed partial class ManagedByConverter : System.Text.Json.Serialization.JsonConverter { - public override ShardStoreStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDatastream = System.Text.Json.JsonEncodedText.Encode("Data stream lifecycle"); + private static readonly System.Text.Json.JsonEncodedText MemberIlm = System.Text.Json.JsonEncodedText.Encode("Index Lifecycle Management"); + private static readonly System.Text.Json.JsonEncodedText MemberUnmanaged = System.Text.Json.JsonEncodedText.Encode("Unmanaged"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDatastream)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Datastream; + } + + if (reader.ValueTextEquals(MemberIlm)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Ilm; + } + + if (reader.ValueTextEquals(MemberUnmanaged)) { - case "yellow": - return ShardStoreStatus.Yellow; - case "red": - return ShardStoreStatus.Red; - case "green": - return ShardStoreStatus.Green; - case "all": - return ShardStoreStatus.All; + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Unmanaged; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberDatastream.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Datastream; + } + + if (string.Equals(value, MemberIlm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Ilm; + } + + if (string.Equals(value, MemberUnmanaged.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Unmanaged; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy)}'."); } - public override void Write(Utf8JsonWriter writer, ShardStoreStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ShardStoreStatus.Yellow: - writer.WriteStringValue("yellow"); - return; - case ShardStoreStatus.Red: - writer.WriteStringValue("red"); - return; - case ShardStoreStatus.Green: - writer.WriteStringValue("green"); - return; - case ShardStoreStatus.All: - writer.WriteStringValue("all"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Datastream: + writer.WriteStringValue(MemberDatastream); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Ilm: + writer.WriteStringValue(MemberIlm); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy.Unmanaged: + writer.WriteStringValue(MemberUnmanaged); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SourceModeConverter))] -public enum SourceMode -{ - [EnumMember(Value = "synthetic")] - Synthetic, - [EnumMember(Value = "stored")] - Stored, - [EnumMember(Value = "disabled")] - Disabled + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SourceModeConverter : JsonConverter +internal sealed partial class TranslogDurabilityConverter : System.Text.Json.Serialization.JsonConverter { - public override SourceMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAsync = System.Text.Json.JsonEncodedText.Encode("async"); + private static readonly System.Text.Json.JsonEncodedText MemberAsync1 = System.Text.Json.JsonEncodedText.Encode("ASYNC"); + private static readonly System.Text.Json.JsonEncodedText MemberRequest = System.Text.Json.JsonEncodedText.Encode("request"); + private static readonly System.Text.Json.JsonEncodedText MemberRequest1 = System.Text.Json.JsonEncodedText.Encode("REQUEST"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAsync) || reader.ValueTextEquals(MemberAsync1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Async; + } + + if (reader.ValueTextEquals(MemberRequest) || reader.ValueTextEquals(MemberRequest1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Request; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAsync.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberAsync1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Async; + } + + if (string.Equals(value, MemberRequest.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberRequest1.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "synthetic": - return SourceMode.Synthetic; - case "stored": - return SourceMode.Stored; - case "disabled": - return SourceMode.Disabled; + return Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Request; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability)}'."); } - public override void Write(Utf8JsonWriter writer, SourceMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SourceMode.Synthetic: - writer.WriteStringValue("synthetic"); - return; - case SourceMode.Stored: - writer.WriteStringValue("stored"); - return; - case SourceMode.Disabled: - writer.WriteStringValue("disabled"); - return; + case Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Async: + writer.WriteStringValue(MemberAsync); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability.Request: + writer.WriteStringValue(MemberRequest); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability)}'."); } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct StorageType : IEnumStruct +internal sealed partial class StorageTypeConverter : System.Text.Json.Serialization.JsonConverter { - public StorageType(string value) => Value = value; + public override Elastic.Clients.Elasticsearch.IndexManagement.StorageType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.StorageType(reader.ReadValue(options, null)); + } - StorageType IEnumStruct.Create(string value) => value; + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.StorageType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } +} - public readonly string Value { get; } +internal sealed partial class IndexRoutingAllocationOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberNewPrimaries = System.Text.Json.JsonEncodedText.Encode("new_primaries"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberPrimaries = System.Text.Json.JsonEncodedText.Encode("primaries"); - /// - /// - /// The NIO FS type stores the shard index on the file system (maps to Lucene NIOFSDirectory) using NIO. It allows multiple - /// threads to read from the same file concurrently. It is not recommended on Windows because of a bug in the SUN Java - /// implementation and disables some optimizations for heap memory usage. - /// + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.All; + } + + if (reader.ValueTextEquals(MemberNewPrimaries)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.NewPrimaries; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.None; + } + + if (reader.ValueTextEquals(MemberPrimaries)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.Primaries; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.All; + } + + if (string.Equals(value, MemberNewPrimaries.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.NewPrimaries; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.None; + } + + if (string.Equals(value, MemberPrimaries.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.Primaries; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.NewPrimaries: + writer.WriteStringValue(MemberNewPrimaries); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions.Primaries: + writer.WriteStringValue(MemberPrimaries); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class IndexRoutingRebalanceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberPrimaries = System.Text.Json.JsonEncodedText.Encode("primaries"); + private static readonly System.Text.Json.JsonEncodedText MemberReplicas = System.Text.Json.JsonEncodedText.Encode("replicas"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.All; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.None; + } + + if (reader.ValueTextEquals(MemberPrimaries)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Primaries; + } + + if (reader.ValueTextEquals(MemberReplicas)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Replicas; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.All; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.None; + } + + if (string.Equals(value, MemberPrimaries.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Primaries; + } + + if (string.Equals(value, MemberReplicas.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Replicas; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Primaries: + writer.WriteStringValue(MemberPrimaries); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions.Replicas: + writer.WriteStringValue(MemberReplicas); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SegmentSortOrderConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAsc = System.Text.Json.JsonEncodedText.Encode("asc"); + private static readonly System.Text.Json.JsonEncodedText MemberAsc1 = System.Text.Json.JsonEncodedText.Encode("ASC"); + private static readonly System.Text.Json.JsonEncodedText MemberDesc = System.Text.Json.JsonEncodedText.Encode("desc"); + private static readonly System.Text.Json.JsonEncodedText MemberDesc1 = System.Text.Json.JsonEncodedText.Encode("DESC"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAsc) || reader.ValueTextEquals(MemberAsc1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Asc; + } + + if (reader.ValueTextEquals(MemberDesc) || reader.ValueTextEquals(MemberDesc1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Desc; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAsc.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberAsc1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Asc; + } + + if (string.Equals(value, MemberDesc.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberDesc1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Desc; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Asc: + writer.WriteStringValue(MemberAsc); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder.Desc: + writer.WriteStringValue(MemberDesc); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SegmentSortModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMax1 = System.Text.Json.JsonEncodedText.Encode("MAX"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberMin1 = System.Text.Json.JsonEncodedText.Encode("MIN"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberMax) || reader.ValueTextEquals(MemberMax1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Max; + } + + if (reader.ValueTextEquals(MemberMin) || reader.ValueTextEquals(MemberMin1)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Min; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberMax1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberMin1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Min; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode.Min: + writer.WriteStringValue(MemberMin); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SegmentSortMissingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFirst = System.Text.Json.JsonEncodedText.Encode("_first"); + private static readonly System.Text.Json.JsonEncodedText MemberLast = System.Text.Json.JsonEncodedText.Encode("_last"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFirst)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.First; + } + + if (reader.ValueTextEquals(MemberLast)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.Last; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.First; + } + + if (string.Equals(value, MemberLast.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.Last; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.First: + writer.WriteStringValue(MemberFirst); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing.Last: + writer.WriteStringValue(MemberLast); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SourceModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDisabled = System.Text.Json.JsonEncodedText.Encode("disabled"); + private static readonly System.Text.Json.JsonEncodedText MemberStored = System.Text.Json.JsonEncodedText.Encode("stored"); + private static readonly System.Text.Json.JsonEncodedText MemberSynthetic = System.Text.Json.JsonEncodedText.Encode("synthetic"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SourceMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDisabled)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Disabled; + } + + if (reader.ValueTextEquals(MemberStored)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Stored; + } + + if (reader.ValueTextEquals(MemberSynthetic)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Synthetic; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDisabled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Disabled; + } + + if (string.Equals(value, MemberStored.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Stored; + } + + if (string.Equals(value, MemberSynthetic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Synthetic; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SourceMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SourceMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Disabled: + writer.WriteStringValue(MemberDisabled); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Stored: + writer.WriteStringValue(MemberStored); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.SourceMode.Synthetic: + writer.WriteStringValue(MemberSynthetic); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.SourceMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.SourceMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SourceMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class NumericFielddataFormatConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberArray = System.Text.Json.JsonEncodedText.Encode("array"); + private static readonly System.Text.Json.JsonEncodedText MemberDisabled = System.Text.Json.JsonEncodedText.Encode("disabled"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberArray)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Array; + } + + if (reader.ValueTextEquals(MemberDisabled)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Disabled; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberArray.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Array; + } + + if (string.Equals(value, MemberDisabled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Disabled; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Array: + writer.WriteStringValue(MemberArray); + break; + case Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat.Disabled: + writer.WriteStringValue(MemberDisabled); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FeatureConverter))] +public enum Feature +{ + [System.Runtime.Serialization.EnumMember(Value = "aliases")] + Aliases, + [System.Runtime.Serialization.EnumMember(Value = "mappings")] + Mappings, + [System.Runtime.Serialization.EnumMember(Value = "settings")] + Settings +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ModeEnumConverter))] +public enum ModeEnum +{ + [System.Runtime.Serialization.EnumMember(Value = "upgrade")] + Upgrade +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocationConverter))] +public enum ShardStoreAllocation +{ + [System.Runtime.Serialization.EnumMember(Value = "primary")] + Primary, + [System.Runtime.Serialization.EnumMember(Value = "replica")] + Replica, + [System.Runtime.Serialization.EnumMember(Value = "unused")] + Unused +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreStatusConverter))] +public enum ShardStoreStatus +{ + /// + /// + /// Return all shards, regardless of health status. + /// /// - public static StorageType Niofs { get; } = new StorageType("niofs"); + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + /// + /// + /// The primary shard and all replica shards are assigned. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "green")] + Green, + /// + /// + /// The primary shard is unassigned. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "red")] + Red, + /// + /// + /// One or more replica shards are unassigned. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "yellow")] + Yellow +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataStateConverter))] +public enum IndexMetadataState +{ + [System.Runtime.Serialization.EnumMember(Value = "close")] + Close, + [System.Runtime.Serialization.EnumMember(Value = "open")] + Open +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingStateConverter))] +public enum ShardRoutingState +{ + [System.Runtime.Serialization.EnumMember(Value = "INITIALIZING")] + Initializing, + [System.Runtime.Serialization.EnumMember(Value = "RELOCATING")] + Relocating, + [System.Runtime.Serialization.EnumMember(Value = "STARTED")] + Started, + [System.Runtime.Serialization.EnumMember(Value = "UNASSIGNED")] + Unassigned +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartupConverter))] +public enum IndexCheckOnStartup +{ + [System.Runtime.Serialization.EnumMember(Value = "checksum")] + Checksum, + [System.Runtime.Serialization.EnumMember(Value = "false")] + False, + [System.Runtime.Serialization.EnumMember(Value = "true")] + True +} +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ManagedByConverter))] +public enum ManagedBy +{ + [System.Runtime.Serialization.EnumMember(Value = "Data stream lifecycle")] + Datastream, + [System.Runtime.Serialization.EnumMember(Value = "Index Lifecycle Management")] + Ilm, + [System.Runtime.Serialization.EnumMember(Value = "Unmanaged")] + Unmanaged +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurabilityConverter))] +public enum TranslogDurability +{ /// /// - /// The MMap FS type stores the shard index on the file system (maps to Lucene MMapDirectory) by mapping a file into - /// memory (mmap). Memory mapping uses up a portion of the virtual memory address space in your process equal to the size - /// of the file being mapped. Before using this class, be sure you have allowed plenty of virtual address space. + /// fsync and commit in the background every sync_interval. In the event of a failure, all acknowledged writes + /// since the last automatic commit will be discarded. /// /// - public static StorageType Mmapfs { get; } = new StorageType("mmapfs"); + [System.Runtime.Serialization.EnumMember(Value = "async")] + Async, + /// + /// + /// (default) fsync and commit after every request. In the event of hardware failure, all acknowledged writes + /// will already have been committed to disk. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "request")] + Request +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.StorageTypeConverter))] +public readonly partial struct StorageType : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct +{ + public StorageType(string value) => Value = value; +#if NET7_0_OR_GREATER + static StorageType IEnumStruct.Create(string value) => value; +#else + StorageType IEnumStruct.Create(string value) => value; +#endif + public readonly string Value { get; } + + /// + /// + /// Default file system implementation. This will pick the best implementation depending on the operating environment, which + /// is currently hybridfs on all supported systems but is subject to change. + /// + /// + public static StorageType Fs { get; } = new StorageType("fs"); /// /// @@ -770,15 +1285,25 @@ public override void Write(Utf8JsonWriter writer, SourceMode value, JsonSerializ /// /// - /// Default file system implementation. This will pick the best implementation depending on the operating environment, which - /// is currently hybridfs on all supported systems but is subject to change. + /// The MMap FS type stores the shard index on the file system (maps to Lucene MMapDirectory) by mapping a file into + /// memory (mmap). Memory mapping uses up a portion of the virtual memory address space in your process equal to the size + /// of the file being mapped. Before using this class, be sure you have allowed plenty of virtual address space. /// /// - public static StorageType Fs { get; } = new StorageType("fs"); + public static StorageType Mmapfs { get; } = new StorageType("mmapfs"); + + /// + /// + /// The NIO FS type stores the shard index on the file system (maps to Lucene NIOFSDirectory) using NIO. It allows multiple + /// threads to read from the same file concurrently. It is not recommended on Windows because of a bug in the SUN Java + /// implementation and disables some optimizations for heap memory usage. + /// + /// + public static StorageType Niofs { get; } = new StorageType("niofs"); public override string ToString() => Value ?? string.Empty; - public static implicit operator string(StorageType storageType) => storageType.Value; + public static implicit operator string(StorageType @enum) => @enum.Value; public static implicit operator StorageType(string value) => new(value); public override int GetHashCode() => Value.GetHashCode(); @@ -789,58 +1314,75 @@ public override void Write(Utf8JsonWriter writer, SourceMode value, JsonSerializ public static bool operator !=(StorageType a, StorageType b) => !(a == b); } -[JsonConverter(typeof(TranslogDurabilityConverter))] -public enum TranslogDurability +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptionsConverter))] +public enum IndexRoutingAllocationOptions { - /// - /// - /// (default) fsync and commit after every request. In the event of hardware failure, all acknowledged writes - /// will already have been committed to disk. - /// - /// - [EnumMember(Value = "request")] - Request, - /// - /// - /// fsync and commit in the background every sync_interval. In the event of a failure, all acknowledged writes - /// since the last automatic commit will be discarded. - /// - /// - [EnumMember(Value = "async")] - Async + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + [System.Runtime.Serialization.EnumMember(Value = "new_primaries")] + NewPrimaries, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "primaries")] + Primaries } -internal sealed class TranslogDurabilityConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptionsConverter))] +public enum IndexRoutingRebalanceOptions { - public override TranslogDurability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "request": - case "REQUEST": - return TranslogDurability.Request; - case "async": - case "ASYNC": - return TranslogDurability.Async; - } + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "primaries")] + Primaries, + [System.Runtime.Serialization.EnumMember(Value = "replicas")] + Replicas +} - ThrowHelper.ThrowJsonException(); - return default; - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrderConverter))] +public enum SegmentSortOrder +{ + [System.Runtime.Serialization.EnumMember(Value = "asc")] + Asc, + [System.Runtime.Serialization.EnumMember(Value = "desc")] + Desc +} - public override void Write(Utf8JsonWriter writer, TranslogDurability value, JsonSerializerOptions options) - { - switch (value) - { - case TranslogDurability.Request: - writer.WriteStringValue("request"); - return; - case TranslogDurability.Async: - writer.WriteStringValue("async"); - return; - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortModeConverter))] +public enum SegmentSortMode +{ + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min +} - writer.WriteNullValue(); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissingConverter))] +public enum SegmentSortMissing +{ + [System.Runtime.Serialization.EnumMember(Value = "_first")] + First, + [System.Runtime.Serialization.EnumMember(Value = "_last")] + Last +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SourceModeConverter))] +public enum SourceMode +{ + [System.Runtime.Serialization.EnumMember(Value = "disabled")] + Disabled, + [System.Runtime.Serialization.EnumMember(Value = "stored")] + Stored, + [System.Runtime.Serialization.EnumMember(Value = "synthetic")] + Synthetic +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormatConverter))] +public enum NumericFielddataFormat +{ + [System.Runtime.Serialization.EnumMember(Value = "array")] + Array, + [System.Runtime.Serialization.EnumMember(Value = "disabled")] + Disabled } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Inference.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Inference.g.cs index ab0a177455b..4c02a43e4a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Inference.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Inference.g.cs @@ -17,69 +17,1702 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; -[JsonConverter(typeof(TaskTypeConverter))] -public enum TaskType +internal sealed partial class TaskTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "text_embedding")] - TextEmbedding, - [EnumMember(Value = "sparse_embedding")] - SparseEmbedding, - [EnumMember(Value = "rerank")] - Rerank, - [EnumMember(Value = "completion")] - Completion + private static readonly System.Text.Json.JsonEncodedText MemberChatCompletion = System.Text.Json.JsonEncodedText.Encode("chat_completion"); + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberSparseEmbedding = System.Text.Json.JsonEncodedText.Encode("sparse_embedding"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.TaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberChatCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.ChatCompletion; + } + + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.Completion; + } + + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberSparseEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.SparseEmbedding; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberChatCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.ChatCompletion; + } + + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.Completion; + } + + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.Rerank; + } + + if (string.Equals(value, MemberSparseEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.SparseEmbedding; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.TaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.TaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.TaskType.ChatCompletion: + writer.WriteStringValue(MemberChatCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.TaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.TaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.TaskType.SparseEmbedding: + writer.WriteStringValue(MemberSparseEmbedding); + break; + case Elastic.Clients.Elasticsearch.Inference.TaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.TaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.TaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AlibabaCloudTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberSpaceEmbedding = System.Text.Json.JsonEncodedText.Encode("space_embedding"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Completion; + } + + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberSpaceEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.SpaceEmbedding; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Completion; + } + + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Rerank; + } + + if (string.Equals(value, MemberSpaceEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.SpaceEmbedding; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.SpaceEmbedding: + writer.WriteStringValue(MemberSpaceEmbedding); + break; + case Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AmazonBedrockTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.Completion; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.Completion; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AnthropicTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + + public override Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType.Completion; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType.Completion; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AnthropicTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AzureAiStudioTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.Completion; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.Completion; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AzureOpenAITaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.Completion; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.Completion; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class TaskTypeConverter : JsonConverter +internal sealed partial class CohereTaskTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override TaskType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCompletion)) { - case "text_embedding": - return TaskType.TextEmbedding; - case "sparse_embedding": - return TaskType.SparseEmbedding; - case "rerank": - return TaskType.Rerank; - case "completion": - return TaskType.Completion; + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Completion; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Completion; + } + + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Rerank; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereTaskType)}'."); } - public override void Write(Utf8JsonWriter writer, TaskType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereTaskType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case TaskType.TextEmbedding: - writer.WriteStringValue("text_embedding"); - return; - case TaskType.SparseEmbedding: - writer.WriteStringValue("sparse_embedding"); - return; - case TaskType.Rerank: - writer.WriteStringValue("rerank"); - return; - case TaskType.Completion: - writer.WriteStringValue("completion"); - return; + case Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereTaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.CohereTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ElasticsearchTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberSparseEmbedding = System.Text.Json.JsonEncodedText.Encode("sparse_embedding"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberSparseEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.SparseEmbedding; } - writer.WriteNullValue(); + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.Rerank; + } + + if (string.Equals(value, MemberSparseEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.SparseEmbedding; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType)}'."); } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.SparseEmbedding: + writer.WriteStringValue(MemberSparseEmbedding); + break; + case Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ElserTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberSparseEmbedding = System.Text.Json.JsonEncodedText.Encode("sparse_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.ElserTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberSparseEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.ElserTaskType.SparseEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberSparseEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.ElserTaskType.SparseEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.ElserTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElserTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.ElserTaskType.SparseEmbedding: + writer.WriteStringValue(MemberSparseEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.ElserTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.ElserTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElserTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GoogleAiStudioTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.Completion; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.Completion; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GoogleVertexAITaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.Rerank; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class HuggingFaceTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class JinaAITaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.JinaAITaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.Rerank; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAITaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAITaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.JinaAITaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class MistralTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.MistralTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.MistralTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.MistralTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.MistralTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.MistralTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.MistralTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.MistralTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.MistralTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.MistralTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class OpenAITaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberChatCompletion = System.Text.Json.JsonEncodedText.Encode("chat_completion"); + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.OpenAITaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberChatCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.ChatCompletion; + } + + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.Completion; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberChatCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.ChatCompletion; + } + + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.Completion; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.OpenAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.ChatCompletion: + writer.WriteStringValue(MemberChatCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Inference.OpenAITaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.OpenAITaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.OpenAITaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.OpenAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class VoyageAITaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberRerank = System.Text.Json.JsonEncodedText.Encode("rerank"); + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberRerank)) + { + return Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.Rerank; + } + + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRerank.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.Rerank; + } + + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.Rerank: + writer.WriteStringValue(MemberRerank); + break; + case Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.VoyageAITaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class WatsonxTaskTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberTextEmbedding)) + { + return Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType.TextEmbedding; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberTextEmbedding.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType.TextEmbedding; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType.TextEmbedding: + writer.WriteStringValue(MemberTextEmbedding); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.WatsonxTaskType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CohereEmbeddingTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberByte = System.Text.Json.JsonEncodedText.Encode("byte"); + private static readonly System.Text.Json.JsonEncodedText MemberFloat = System.Text.Json.JsonEncodedText.Encode("float"); + private static readonly System.Text.Json.JsonEncodedText MemberInt8 = System.Text.Json.JsonEncodedText.Encode("int8"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberByte)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Byte; + } + + if (reader.ValueTextEquals(MemberFloat)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Float; + } + + if (reader.ValueTextEquals(MemberInt8)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Int8; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberByte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Byte; + } + + if (string.Equals(value, MemberFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Float; + } + + if (string.Equals(value, MemberInt8.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Int8; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Byte: + writer.WriteStringValue(MemberByte); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Float: + writer.WriteStringValue(MemberFloat); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType.Int8: + writer.WriteStringValue(MemberInt8); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CohereSimilarityTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCosine = System.Text.Json.JsonEncodedText.Encode("cosine"); + private static readonly System.Text.Json.JsonEncodedText MemberDotProduct = System.Text.Json.JsonEncodedText.Encode("dot_product"); + private static readonly System.Text.Json.JsonEncodedText MemberL2Norm = System.Text.Json.JsonEncodedText.Encode("l2_norm"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCosine)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.Cosine; + } + + if (reader.ValueTextEquals(MemberDotProduct)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.DotProduct; + } + + if (reader.ValueTextEquals(MemberL2Norm)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.L2Norm; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCosine.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.Cosine; + } + + if (string.Equals(value, MemberDotProduct.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.DotProduct; + } + + if (string.Equals(value, MemberL2Norm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.L2Norm; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.Cosine: + writer.WriteStringValue(MemberCosine); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.DotProduct: + writer.WriteStringValue(MemberDotProduct); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType.L2Norm: + writer.WriteStringValue(MemberL2Norm); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CohereInputTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText MemberClustering = System.Text.Json.JsonEncodedText.Encode("clustering"); + private static readonly System.Text.Json.JsonEncodedText MemberIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText MemberSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereInputType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberClassification)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Classification; + } + + if (reader.ValueTextEquals(MemberClustering)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Clustering; + } + + if (reader.ValueTextEquals(MemberIngest)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Ingest; + } + + if (reader.ValueTextEquals(MemberSearch)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Search; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberClassification.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Classification; + } + + if (string.Equals(value, MemberClustering.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Clustering; + } + + if (string.Equals(value, MemberIngest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Ingest; + } + + if (string.Equals(value, MemberSearch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereInputType.Search; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereInputType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereInputType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.CohereInputType.Classification: + writer.WriteStringValue(MemberClassification); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereInputType.Clustering: + writer.WriteStringValue(MemberClustering); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereInputType.Ingest: + writer.WriteStringValue(MemberIngest); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereInputType.Search: + writer.WriteStringValue(MemberSearch); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereInputType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.CohereInputType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereInputType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CohereTruncateTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberEnd = System.Text.Json.JsonEncodedText.Encode("END"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("NONE"); + private static readonly System.Text.Json.JsonEncodedText MemberStart = System.Text.Json.JsonEncodedText.Encode("START"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereTruncateType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberEnd)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.End; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.None; + } + + if (reader.ValueTextEquals(MemberStart)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.Start; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberEnd.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.End; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.None; + } + + if (string.Equals(value, MemberStart.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.Start; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereTruncateType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereTruncateType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.End: + writer.WriteStringValue(MemberEnd); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.Inference.CohereTruncateType.Start: + writer.WriteStringValue(MemberStart); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.CohereTruncateType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.CohereTruncateType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereTruncateType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class JinaAISimilarityTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCosine = System.Text.Json.JsonEncodedText.Encode("cosine"); + private static readonly System.Text.Json.JsonEncodedText MemberDotProduct = System.Text.Json.JsonEncodedText.Encode("dot_product"); + private static readonly System.Text.Json.JsonEncodedText MemberL2Norm = System.Text.Json.JsonEncodedText.Encode("l2_norm"); + + public override Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCosine)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.Cosine; + } + + if (reader.ValueTextEquals(MemberDotProduct)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.DotProduct; + } + + if (reader.ValueTextEquals(MemberL2Norm)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.L2Norm; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCosine.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.Cosine; + } + + if (string.Equals(value, MemberDotProduct.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.DotProduct; + } + + if (string.Equals(value, MemberL2Norm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.L2Norm; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.Cosine: + writer.WriteStringValue(MemberCosine); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.DotProduct: + writer.WriteStringValue(MemberDotProduct); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType.L2Norm: + writer.WriteStringValue(MemberL2Norm); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class JinaAITextEmbeddingTaskConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText MemberClustering = System.Text.Json.JsonEncodedText.Encode("clustering"); + private static readonly System.Text.Json.JsonEncodedText MemberIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText MemberSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberClassification)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Classification; + } + + if (reader.ValueTextEquals(MemberClustering)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Clustering; + } + + if (reader.ValueTextEquals(MemberIngest)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Ingest; + } + + if (reader.ValueTextEquals(MemberSearch)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Search; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberClassification.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Classification; + } + + if (string.Equals(value, MemberClustering.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Clustering; + } + + if (string.Equals(value, MemberIngest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Ingest; + } + + if (string.Equals(value, MemberSearch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Search; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Classification: + writer.WriteStringValue(MemberClassification); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Clustering: + writer.WriteStringValue(MemberClustering); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Ingest: + writer.WriteStringValue(MemberIngest); + break; + case Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask.Search: + writer.WriteStringValue(MemberSearch); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TaskTypeConverter))] +public enum TaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "chat_completion")] + ChatCompletion, + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "sparse_embedding")] + SparseEmbedding, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskTypeConverter))] +public enum AlibabaCloudTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "space_embedding")] + SpaceEmbedding, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskTypeConverter))] +public enum AmazonBedrockTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskTypeConverter))] +public enum AnthropicTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskTypeConverter))] +public enum AzureAiStudioTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskTypeConverter))] +public enum AzureOpenAITaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereTaskTypeConverter))] +public enum CohereTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskTypeConverter))] +public enum ElasticsearchTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "sparse_embedding")] + SparseEmbedding, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ElserTaskTypeConverter))] +public enum ElserTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "sparse_embedding")] + SparseEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioTaskTypeConverter))] +public enum GoogleAiStudioTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskTypeConverter))] +public enum GoogleVertexAITaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.HuggingFaceTaskTypeConverter))] +public enum HuggingFaceTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.JinaAITaskTypeConverter))] +public enum JinaAITaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.MistralTaskTypeConverter))] +public enum MistralTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.OpenAITaskTypeConverter))] +public enum OpenAITaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "chat_completion")] + ChatCompletion, + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskTypeConverter))] +public enum VoyageAITaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "rerank")] + Rerank, + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.WatsonxTaskTypeConverter))] +public enum WatsonxTaskType +{ + [System.Runtime.Serialization.EnumMember(Value = "text_embedding")] + TextEmbedding +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingTypeConverter))] +public enum CohereEmbeddingType +{ + [System.Runtime.Serialization.EnumMember(Value = "byte")] + Byte, + [System.Runtime.Serialization.EnumMember(Value = "float")] + Float, + [System.Runtime.Serialization.EnumMember(Value = "int8")] + Int8 +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereSimilarityTypeConverter))] +public enum CohereSimilarityType +{ + [System.Runtime.Serialization.EnumMember(Value = "cosine")] + Cosine, + [System.Runtime.Serialization.EnumMember(Value = "dot_product")] + DotProduct, + [System.Runtime.Serialization.EnumMember(Value = "l2_norm")] + L2Norm +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereInputTypeConverter))] +public enum CohereInputType +{ + [System.Runtime.Serialization.EnumMember(Value = "classification")] + Classification, + [System.Runtime.Serialization.EnumMember(Value = "clustering")] + Clustering, + [System.Runtime.Serialization.EnumMember(Value = "ingest")] + Ingest, + [System.Runtime.Serialization.EnumMember(Value = "search")] + Search +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereTruncateTypeConverter))] +public enum CohereTruncateType +{ + [System.Runtime.Serialization.EnumMember(Value = "END")] + End, + [System.Runtime.Serialization.EnumMember(Value = "NONE")] + None, + [System.Runtime.Serialization.EnumMember(Value = "START")] + Start +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityTypeConverter))] +public enum JinaAISimilarityType +{ + [System.Runtime.Serialization.EnumMember(Value = "cosine")] + Cosine, + [System.Runtime.Serialization.EnumMember(Value = "dot_product")] + DotProduct, + [System.Runtime.Serialization.EnumMember(Value = "l2_norm")] + L2Norm +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTaskConverter))] +public enum JinaAITextEmbeddingTask +{ + [System.Runtime.Serialization.EnumMember(Value = "classification")] + Classification, + [System.Runtime.Serialization.EnumMember(Value = "clustering")] + Clustering, + [System.Runtime.Serialization.EnumMember(Value = "ingest")] + Ingest, + [System.Runtime.Serialization.EnumMember(Value = "search")] + Search } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ingest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ingest.g.cs index 6e2a0890436..c3e9699e9bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ingest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Ingest.g.cs @@ -17,408 +17,688 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -[JsonConverter(typeof(ConvertTypeConverter))] -public enum ConvertType +internal sealed partial class ShapeTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "string")] - String, - [EnumMember(Value = "long")] - Long, - [EnumMember(Value = "ip")] - Ip, - [EnumMember(Value = "integer")] - Integer, - [EnumMember(Value = "float")] - Float, - [EnumMember(Value = "double")] - Double, - [EnumMember(Value = "boolean")] - Boolean, - [EnumMember(Value = "auto")] - Auto -} + private static readonly System.Text.Json.JsonEncodedText MemberGeoShape = System.Text.Json.JsonEncodedText.Encode("geo_shape"); + private static readonly System.Text.Json.JsonEncodedText MemberShape = System.Text.Json.JsonEncodedText.Encode("shape"); -internal sealed class ConvertTypeConverter : JsonConverter -{ - public override ConvertType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Ingest.ShapeType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "string": - return ConvertType.String; - case "long": - return ConvertType.Long; - case "ip": - return ConvertType.Ip; - case "integer": - return ConvertType.Integer; - case "float": - return ConvertType.Float; - case "double": - return ConvertType.Double; - case "boolean": - return ConvertType.Boolean; - case "auto": - return ConvertType.Auto; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberGeoShape)) + { + return Elastic.Clients.Elasticsearch.Ingest.ShapeType.GeoShape; + } + + if (reader.ValueTextEquals(MemberShape)) + { + return Elastic.Clients.Elasticsearch.Ingest.ShapeType.Shape; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGeoShape.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ShapeType.GeoShape; + } + + if (string.Equals(value, MemberShape.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ShapeType.Shape; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.ShapeType)}'."); } - public override void Write(Utf8JsonWriter writer, ConvertType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ShapeType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ConvertType.String: - writer.WriteStringValue("string"); - return; - case ConvertType.Long: - writer.WriteStringValue("long"); - return; - case ConvertType.Ip: - writer.WriteStringValue("ip"); - return; - case ConvertType.Integer: - writer.WriteStringValue("integer"); - return; - case ConvertType.Float: - writer.WriteStringValue("float"); - return; - case ConvertType.Double: - writer.WriteStringValue("double"); - return; - case ConvertType.Boolean: - writer.WriteStringValue("boolean"); - return; - case ConvertType.Auto: - writer.WriteStringValue("auto"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Ingest.ShapeType.GeoShape: + writer.WriteStringValue(MemberGeoShape); + break; + case Elastic.Clients.Elasticsearch.Ingest.ShapeType.Shape: + writer.WriteStringValue(MemberShape); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.ShapeType)}'."); + } } -} -[JsonConverter(typeof(FingerprintDigestConverter))] -public enum FingerprintDigest -{ - [EnumMember(Value = "SHA-512")] - Sha512, - [EnumMember(Value = "SHA-256")] - Sha256, - [EnumMember(Value = "SHA-1")] - Sha1, - [EnumMember(Value = "MurmurHash3")] - Murmurhash3, - [EnumMember(Value = "MD5")] - Md5 + public override Elastic.Clients.Elasticsearch.Ingest.ShapeType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ShapeType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class FingerprintDigestConverter : JsonConverter +internal sealed partial class ConvertTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override FingerprintDigest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAuto = System.Text.Json.JsonEncodedText.Encode("auto"); + private static readonly System.Text.Json.JsonEncodedText MemberBoolean = System.Text.Json.JsonEncodedText.Encode("boolean"); + private static readonly System.Text.Json.JsonEncodedText MemberDouble = System.Text.Json.JsonEncodedText.Encode("double"); + private static readonly System.Text.Json.JsonEncodedText MemberFloat = System.Text.Json.JsonEncodedText.Encode("float"); + private static readonly System.Text.Json.JsonEncodedText MemberInteger = System.Text.Json.JsonEncodedText.Encode("integer"); + private static readonly System.Text.Json.JsonEncodedText MemberIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText MemberLong = System.Text.Json.JsonEncodedText.Encode("long"); + private static readonly System.Text.Json.JsonEncodedText MemberString = System.Text.Json.JsonEncodedText.Encode("string"); + + public override Elastic.Clients.Elasticsearch.Ingest.ConvertType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "SHA-512": - return FingerprintDigest.Sha512; - case "SHA-256": - return FingerprintDigest.Sha256; - case "SHA-1": - return FingerprintDigest.Sha1; - case "MurmurHash3": - return FingerprintDigest.Murmurhash3; - case "MD5": - return FingerprintDigest.Md5; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAuto)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Auto; + } + + if (reader.ValueTextEquals(MemberBoolean)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Boolean; + } + + if (reader.ValueTextEquals(MemberDouble)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Double; + } + + if (reader.ValueTextEquals(MemberFloat)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Float; + } + + if (reader.ValueTextEquals(MemberInteger)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Integer; + } + + if (reader.ValueTextEquals(MemberIp)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Ip; + } + + if (reader.ValueTextEquals(MemberLong)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Long; + } + + if (reader.ValueTextEquals(MemberString)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.String; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAuto.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Auto; + } + + if (string.Equals(value, MemberBoolean.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Boolean; + } + + if (string.Equals(value, MemberDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Double; + } + + if (string.Equals(value, MemberFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Float; + } + + if (string.Equals(value, MemberInteger.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Integer; + } + + if (string.Equals(value, MemberIp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Ip; + } + + if (string.Equals(value, MemberLong.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.Long; + } + + if (string.Equals(value, MemberString.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.ConvertType.String; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.ConvertType)}'."); } - public override void Write(Utf8JsonWriter writer, FingerprintDigest value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ConvertType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case FingerprintDigest.Sha512: - writer.WriteStringValue("SHA-512"); - return; - case FingerprintDigest.Sha256: - writer.WriteStringValue("SHA-256"); - return; - case FingerprintDigest.Sha1: - writer.WriteStringValue("SHA-1"); - return; - case FingerprintDigest.Murmurhash3: - writer.WriteStringValue("MurmurHash3"); - return; - case FingerprintDigest.Md5: - writer.WriteStringValue("MD5"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Auto: + writer.WriteStringValue(MemberAuto); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Boolean: + writer.WriteStringValue(MemberBoolean); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Double: + writer.WriteStringValue(MemberDouble); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Float: + writer.WriteStringValue(MemberFloat); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Integer: + writer.WriteStringValue(MemberInteger); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Ip: + writer.WriteStringValue(MemberIp); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.Long: + writer.WriteStringValue(MemberLong); + break; + case Elastic.Clients.Elasticsearch.Ingest.ConvertType.String: + writer.WriteStringValue(MemberString); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.ConvertType)}'."); + } } -} -[JsonConverter(typeof(GeoGridTargetFormatConverter))] -public enum GeoGridTargetFormat -{ - [EnumMember(Value = "wkt")] - Wkt, - [EnumMember(Value = "geojson")] - Geojson + public override Elastic.Clients.Elasticsearch.Ingest.ConvertType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ConvertType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GeoGridTargetFormatConverter : JsonConverter +internal sealed partial class FingerprintDigestConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoGridTargetFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberMd5 = System.Text.Json.JsonEncodedText.Encode("MD5"); + private static readonly System.Text.Json.JsonEncodedText MemberMurmurHash3 = System.Text.Json.JsonEncodedText.Encode("MurmurHash3"); + private static readonly System.Text.Json.JsonEncodedText MemberSha1 = System.Text.Json.JsonEncodedText.Encode("SHA-1"); + private static readonly System.Text.Json.JsonEncodedText MemberSha256 = System.Text.Json.JsonEncodedText.Encode("SHA-256"); + private static readonly System.Text.Json.JsonEncodedText MemberSha512 = System.Text.Json.JsonEncodedText.Encode("SHA-512"); + + public override Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberMd5)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Md5; + } + + if (reader.ValueTextEquals(MemberMurmurHash3)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.MurmurHash3; + } + + if (reader.ValueTextEquals(MemberSha1)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha1; + } + + if (reader.ValueTextEquals(MemberSha256)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha256; + } + + if (reader.ValueTextEquals(MemberSha512)) { - case "wkt": - return GeoGridTargetFormat.Wkt; - case "geojson": - return GeoGridTargetFormat.Geojson; + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha512; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberMd5.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Md5; + } + + if (string.Equals(value, MemberMurmurHash3.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.MurmurHash3; + } + + if (string.Equals(value, MemberSha1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha1; + } + + if (string.Equals(value, MemberSha256.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha256; + } + + if (string.Equals(value, MemberSha512.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha512; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest)}'."); } - public override void Write(Utf8JsonWriter writer, GeoGridTargetFormat value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GeoGridTargetFormat.Wkt: - writer.WriteStringValue("wkt"); - return; - case GeoGridTargetFormat.Geojson: - writer.WriteStringValue("geojson"); - return; + case Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Md5: + writer.WriteStringValue(MemberMd5); + break; + case Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.MurmurHash3: + writer.WriteStringValue(MemberMurmurHash3); + break; + case Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha1: + writer.WriteStringValue(MemberSha1); + break; + case Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha256: + writer.WriteStringValue(MemberSha256); + break; + case Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest.Sha512: + writer.WriteStringValue(MemberSha512); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(GeoGridTileTypeConverter))] -public enum GeoGridTileType -{ - [EnumMember(Value = "geotile")] - Geotile, - [EnumMember(Value = "geohex")] - Geohex, - [EnumMember(Value = "geohash")] - Geohash + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GeoGridTileTypeConverter : JsonConverter +internal sealed partial class GeoGridTileTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoGridTileType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberGeohash = System.Text.Json.JsonEncodedText.Encode("geohash"); + private static readonly System.Text.Json.JsonEncodedText MemberGeohex = System.Text.Json.JsonEncodedText.Encode("geohex"); + private static readonly System.Text.Json.JsonEncodedText MemberGeotile = System.Text.Json.JsonEncodedText.Encode("geotile"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGeohash)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohash; + } + + if (reader.ValueTextEquals(MemberGeohex)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohex; + } + + if (reader.ValueTextEquals(MemberGeotile)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geotile; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGeohash.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohash; + } + + if (string.Equals(value, MemberGeohex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohex; + } + + if (string.Equals(value, MemberGeotile.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "geotile": - return GeoGridTileType.Geotile; - case "geohex": - return GeoGridTileType.Geohex; - case "geohash": - return GeoGridTileType.Geohash; + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geotile; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType)}'."); } - public override void Write(Utf8JsonWriter writer, GeoGridTileType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GeoGridTileType.Geotile: - writer.WriteStringValue("geotile"); - return; - case GeoGridTileType.Geohex: - writer.WriteStringValue("geohex"); - return; - case GeoGridTileType.Geohash: - writer.WriteStringValue("geohash"); - return; + case Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohash: + writer.WriteStringValue(MemberGeohash); + break; + case Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geohex: + writer.WriteStringValue(MemberGeohex); + break; + case Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType.Geotile: + writer.WriteStringValue(MemberGeotile); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(JsonProcessorConflictStrategyConverter))] -public enum JsonProcessorConflictStrategy -{ - /// - /// - /// Root fields that conflict with fields from the parsed JSON will be overridden. - /// - /// - [EnumMember(Value = "replace")] - Replace, - /// - /// - /// Conflicting fields will be merged. - /// - /// - [EnumMember(Value = "merge")] - Merge + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class JsonProcessorConflictStrategyConverter : JsonConverter +internal sealed partial class GeoGridTargetFormatConverter : System.Text.Json.Serialization.JsonConverter { - public override JsonProcessorConflictStrategy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberGeojson = System.Text.Json.JsonEncodedText.Encode("geojson"); + private static readonly System.Text.Json.JsonEncodedText MemberWkt = System.Text.Json.JsonEncodedText.Encode("wkt"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGeojson)) { - case "replace": - return JsonProcessorConflictStrategy.Replace; - case "merge": - return JsonProcessorConflictStrategy.Merge; + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Geojson; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberWkt)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Wkt; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGeojson.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Geojson; + } + + if (string.Equals(value, MemberWkt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Wkt; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat)}'."); } - public override void Write(Utf8JsonWriter writer, JsonProcessorConflictStrategy value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case JsonProcessorConflictStrategy.Replace: - writer.WriteStringValue("replace"); - return; - case JsonProcessorConflictStrategy.Merge: - writer.WriteStringValue("merge"); - return; + case Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Geojson: + writer.WriteStringValue(MemberGeojson); + break; + case Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat.Wkt: + writer.WriteStringValue(MemberWkt); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ShapeTypeConverter))] -public enum ShapeType -{ - [EnumMember(Value = "shape")] - Shape, - [EnumMember(Value = "geo_shape")] - GeoShape + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ShapeTypeConverter : JsonConverter +internal sealed partial class JsonProcessorConflictStrategyConverter : System.Text.Json.Serialization.JsonConverter { - public override ShapeType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberMerge = System.Text.Json.JsonEncodedText.Encode("merge"); + private static readonly System.Text.Json.JsonEncodedText MemberReplace = System.Text.Json.JsonEncodedText.Encode("replace"); + + public override Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberMerge)) { - case "shape": - return ShapeType.Shape; - case "geo_shape": - return ShapeType.GeoShape; + return Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Merge; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberReplace)) + { + return Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Replace; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberMerge.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Merge; + } + + if (string.Equals(value, MemberReplace.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Replace; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy)}'."); } - public override void Write(Utf8JsonWriter writer, ShapeType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ShapeType.Shape: - writer.WriteStringValue("shape"); - return; - case ShapeType.GeoShape: - writer.WriteStringValue("geo_shape"); - return; + case Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Merge: + writer.WriteStringValue(MemberMerge); + break; + case Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy.Replace: + writer.WriteStringValue(MemberReplace); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(UserAgentPropertyConverter))] -public enum UserAgentProperty -{ - [EnumMember(Value = "version")] - Version, - [EnumMember(Value = "os")] - Os, - [EnumMember(Value = "original")] - Original, - [EnumMember(Value = "name")] - Name, - [EnumMember(Value = "device")] - Device + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class UserAgentPropertyConverter : JsonConverter +internal sealed partial class UserAgentPropertyConverter : System.Text.Json.Serialization.JsonConverter { - public override UserAgentProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDevice = System.Text.Json.JsonEncodedText.Encode("device"); + private static readonly System.Text.Json.JsonEncodedText MemberName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText MemberOriginal = System.Text.Json.JsonEncodedText.Encode("original"); + private static readonly System.Text.Json.JsonEncodedText MemberOs = System.Text.Json.JsonEncodedText.Encode("os"); + private static readonly System.Text.Json.JsonEncodedText MemberVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "version": - return UserAgentProperty.Version; - case "os": - return UserAgentProperty.Os; - case "original": - return UserAgentProperty.Original; - case "name": - return UserAgentProperty.Name; - case "device": - return UserAgentProperty.Device; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberDevice)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Device; + } + + if (reader.ValueTextEquals(MemberName)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Name; + } + + if (reader.ValueTextEquals(MemberOriginal)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Original; + } + + if (reader.ValueTextEquals(MemberOs)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Os; + } + + if (reader.ValueTextEquals(MemberVersion)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Version; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDevice.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Device; + } + + if (string.Equals(value, MemberName.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Name; + } + + if (string.Equals(value, MemberOriginal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Original; + } + + if (string.Equals(value, MemberOs.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Os; + } + + if (string.Equals(value, MemberVersion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Version; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty)}'."); } - public override void Write(Utf8JsonWriter writer, UserAgentProperty value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case UserAgentProperty.Version: - writer.WriteStringValue("version"); - return; - case UserAgentProperty.Os: - writer.WriteStringValue("os"); - return; - case UserAgentProperty.Original: - writer.WriteStringValue("original"); - return; - case UserAgentProperty.Name: - writer.WriteStringValue("name"); - return; - case UserAgentProperty.Device: - writer.WriteStringValue("device"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Device: + writer.WriteStringValue(MemberDevice); + break; + case Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Name: + writer.WriteStringValue(MemberName); + break; + case Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Original: + writer.WriteStringValue(MemberOriginal); + break; + case Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Os: + writer.WriteStringValue(MemberOs); + break; + case Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty.Version: + writer.WriteStringValue(MemberVersion); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ShapeTypeConverter))] +public enum ShapeType +{ + [System.Runtime.Serialization.EnumMember(Value = "geo_shape")] + GeoShape, + [System.Runtime.Serialization.EnumMember(Value = "shape")] + Shape +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ConvertTypeConverter))] +public enum ConvertType +{ + [System.Runtime.Serialization.EnumMember(Value = "auto")] + Auto, + [System.Runtime.Serialization.EnumMember(Value = "boolean")] + Boolean, + [System.Runtime.Serialization.EnumMember(Value = "double")] + Double, + [System.Runtime.Serialization.EnumMember(Value = "float")] + Float, + [System.Runtime.Serialization.EnumMember(Value = "integer")] + Integer, + [System.Runtime.Serialization.EnumMember(Value = "ip")] + Ip, + [System.Runtime.Serialization.EnumMember(Value = "long")] + Long, + [System.Runtime.Serialization.EnumMember(Value = "string")] + String +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigestConverter))] +public enum FingerprintDigest +{ + [System.Runtime.Serialization.EnumMember(Value = "MD5")] + Md5, + [System.Runtime.Serialization.EnumMember(Value = "MurmurHash3")] + MurmurHash3, + [System.Runtime.Serialization.EnumMember(Value = "SHA-1")] + Sha1, + [System.Runtime.Serialization.EnumMember(Value = "SHA-256")] + Sha256, + [System.Runtime.Serialization.EnumMember(Value = "SHA-512")] + Sha512 +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileTypeConverter))] +public enum GeoGridTileType +{ + [System.Runtime.Serialization.EnumMember(Value = "geohash")] + Geohash, + [System.Runtime.Serialization.EnumMember(Value = "geohex")] + Geohex, + [System.Runtime.Serialization.EnumMember(Value = "geotile")] + Geotile +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormatConverter))] +public enum GeoGridTargetFormat +{ + [System.Runtime.Serialization.EnumMember(Value = "geojson")] + Geojson, + [System.Runtime.Serialization.EnumMember(Value = "wkt")] + Wkt +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategyConverter))] +public enum JsonProcessorConflictStrategy +{ + /// + /// + /// Conflicting fields will be merged. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "merge")] + Merge, + /// + /// + /// Root fields that conflict with fields from the parsed JSON will be overridden. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "replace")] + Replace +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.UserAgentPropertyConverter))] +public enum UserAgentProperty +{ + [System.Runtime.Serialization.EnumMember(Value = "device")] + Device, + [System.Runtime.Serialization.EnumMember(Value = "name")] + Name, + [System.Runtime.Serialization.EnumMember(Value = "original")] + Original, + [System.Runtime.Serialization.EnumMember(Value = "os")] + Os, + [System.Runtime.Serialization.EnumMember(Value = "version")] + Version } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.LicenseManagement.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.LicenseManagement.g.cs index 00f97d8b1e7..da6403296a0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.LicenseManagement.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.LicenseManagement.g.cs @@ -17,160 +17,284 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; -[JsonConverter(typeof(LicenseStatusConverter))] -public enum LicenseStatus +internal sealed partial class LicenseStatusConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "valid")] - Valid, - [EnumMember(Value = "invalid")] - Invalid, - [EnumMember(Value = "expired")] - Expired, - [EnumMember(Value = "active")] - Active -} + private static readonly System.Text.Json.JsonEncodedText MemberActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText MemberExpired = System.Text.Json.JsonEncodedText.Encode("expired"); + private static readonly System.Text.Json.JsonEncodedText MemberInvalid = System.Text.Json.JsonEncodedText.Encode("invalid"); + private static readonly System.Text.Json.JsonEncodedText MemberValid = System.Text.Json.JsonEncodedText.Encode("valid"); -internal sealed class LicenseStatusConverter : JsonConverter -{ - public override LicenseStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberActive)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Active; + } + + if (reader.ValueTextEquals(MemberExpired)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Expired; + } + + if (reader.ValueTextEquals(MemberInvalid)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Invalid; + } + + if (reader.ValueTextEquals(MemberValid)) { - case "valid": - return LicenseStatus.Valid; - case "invalid": - return LicenseStatus.Invalid; - case "expired": - return LicenseStatus.Expired; - case "active": - return LicenseStatus.Active; + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Valid; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberActive.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Active; + } + + if (string.Equals(value, MemberExpired.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Expired; + } + + if (string.Equals(value, MemberInvalid.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Invalid; + } + + if (string.Equals(value, MemberValid.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Valid; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus)}'."); } - public override void Write(Utf8JsonWriter writer, LicenseStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case LicenseStatus.Valid: - writer.WriteStringValue("valid"); - return; - case LicenseStatus.Invalid: - writer.WriteStringValue("invalid"); - return; - case LicenseStatus.Expired: - writer.WriteStringValue("expired"); - return; - case LicenseStatus.Active: - writer.WriteStringValue("active"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Active: + writer.WriteStringValue(MemberActive); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Expired: + writer.WriteStringValue(MemberExpired); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Invalid: + writer.WriteStringValue(MemberInvalid); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus.Valid: + writer.WriteStringValue(MemberValid); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus)}'."); + } } -} -[JsonConverter(typeof(LicenseTypeConverter))] -public enum LicenseType -{ - [EnumMember(Value = "trial")] - Trial, - [EnumMember(Value = "standard")] - Standard, - [EnumMember(Value = "silver")] - Silver, - [EnumMember(Value = "platinum")] - Platinum, - [EnumMember(Value = "missing")] - Missing, - [EnumMember(Value = "gold")] - Gold, - [EnumMember(Value = "enterprise")] - Enterprise, - [EnumMember(Value = "dev")] - Dev, - [EnumMember(Value = "basic")] - Basic + public override Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class LicenseTypeConverter : JsonConverter +internal sealed partial class LicenseTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override LicenseType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberBasic = System.Text.Json.JsonEncodedText.Encode("basic"); + private static readonly System.Text.Json.JsonEncodedText MemberDev = System.Text.Json.JsonEncodedText.Encode("dev"); + private static readonly System.Text.Json.JsonEncodedText MemberEnterprise = System.Text.Json.JsonEncodedText.Encode("enterprise"); + private static readonly System.Text.Json.JsonEncodedText MemberGold = System.Text.Json.JsonEncodedText.Encode("gold"); + private static readonly System.Text.Json.JsonEncodedText MemberMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText MemberPlatinum = System.Text.Json.JsonEncodedText.Encode("platinum"); + private static readonly System.Text.Json.JsonEncodedText MemberSilver = System.Text.Json.JsonEncodedText.Encode("silver"); + private static readonly System.Text.Json.JsonEncodedText MemberStandard = System.Text.Json.JsonEncodedText.Encode("standard"); + private static readonly System.Text.Json.JsonEncodedText MemberTrial = System.Text.Json.JsonEncodedText.Encode("trial"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "trial": - return LicenseType.Trial; - case "standard": - return LicenseType.Standard; - case "silver": - return LicenseType.Silver; - case "platinum": - return LicenseType.Platinum; - case "missing": - return LicenseType.Missing; - case "gold": - return LicenseType.Gold; - case "enterprise": - return LicenseType.Enterprise; - case "dev": - return LicenseType.Dev; - case "basic": - return LicenseType.Basic; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberBasic)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Basic; + } + + if (reader.ValueTextEquals(MemberDev)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Dev; + } + + if (reader.ValueTextEquals(MemberEnterprise)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Enterprise; + } + + if (reader.ValueTextEquals(MemberGold)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Gold; + } + + if (reader.ValueTextEquals(MemberMissing)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Missing; + } + + if (reader.ValueTextEquals(MemberPlatinum)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Platinum; + } + + if (reader.ValueTextEquals(MemberSilver)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Silver; + } + + if (reader.ValueTextEquals(MemberStandard)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Standard; + } + + if (reader.ValueTextEquals(MemberTrial)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Trial; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBasic.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Basic; + } + + if (string.Equals(value, MemberDev.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Dev; + } + + if (string.Equals(value, MemberEnterprise.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Enterprise; + } + + if (string.Equals(value, MemberGold.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Gold; + } + + if (string.Equals(value, MemberMissing.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Missing; + } + + if (string.Equals(value, MemberPlatinum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Platinum; + } + + if (string.Equals(value, MemberSilver.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Silver; + } + + if (string.Equals(value, MemberStandard.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Standard; + } + + if (string.Equals(value, MemberTrial.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Trial; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType)}'."); } - public override void Write(Utf8JsonWriter writer, LicenseType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case LicenseType.Trial: - writer.WriteStringValue("trial"); - return; - case LicenseType.Standard: - writer.WriteStringValue("standard"); - return; - case LicenseType.Silver: - writer.WriteStringValue("silver"); - return; - case LicenseType.Platinum: - writer.WriteStringValue("platinum"); - return; - case LicenseType.Missing: - writer.WriteStringValue("missing"); - return; - case LicenseType.Gold: - writer.WriteStringValue("gold"); - return; - case LicenseType.Enterprise: - writer.WriteStringValue("enterprise"); - return; - case LicenseType.Dev: - writer.WriteStringValue("dev"); - return; - case LicenseType.Basic: - writer.WriteStringValue("basic"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Basic: + writer.WriteStringValue(MemberBasic); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Dev: + writer.WriteStringValue(MemberDev); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Enterprise: + writer.WriteStringValue(MemberEnterprise); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Gold: + writer.WriteStringValue(MemberGold); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Missing: + writer.WriteStringValue(MemberMissing); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Platinum: + writer.WriteStringValue(MemberPlatinum); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Silver: + writer.WriteStringValue(MemberSilver); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Standard: + writer.WriteStringValue(MemberStandard); + break; + case Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType.Trial: + writer.WriteStringValue(MemberTrial); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType)}'."); + } } + + public override Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatusConverter))] +public enum LicenseStatus +{ + [System.Runtime.Serialization.EnumMember(Value = "active")] + Active, + [System.Runtime.Serialization.EnumMember(Value = "expired")] + Expired, + [System.Runtime.Serialization.EnumMember(Value = "invalid")] + Invalid, + [System.Runtime.Serialization.EnumMember(Value = "valid")] + Valid +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseTypeConverter))] +public enum LicenseType +{ + [System.Runtime.Serialization.EnumMember(Value = "basic")] + Basic, + [System.Runtime.Serialization.EnumMember(Value = "dev")] + Dev, + [System.Runtime.Serialization.EnumMember(Value = "enterprise")] + Enterprise, + [System.Runtime.Serialization.EnumMember(Value = "gold")] + Gold, + [System.Runtime.Serialization.EnumMember(Value = "missing")] + Missing, + [System.Runtime.Serialization.EnumMember(Value = "platinum")] + Platinum, + [System.Runtime.Serialization.EnumMember(Value = "silver")] + Silver, + [System.Runtime.Serialization.EnumMember(Value = "standard")] + Standard, + [System.Runtime.Serialization.EnumMember(Value = "trial")] + Trial } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.MachineLearning.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.MachineLearning.g.cs index a9f89e68101..38f160e324f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.MachineLearning.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.MachineLearning.g.cs @@ -17,1207 +17,1952 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(AppliesToConverter))] -public enum AppliesTo +internal sealed partial class IncludeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "typical")] - Typical, - [EnumMember(Value = "time")] - Time, - [EnumMember(Value = "diff_from_typical")] - DiffFromTypical, - [EnumMember(Value = "actual")] - Actual -} + private static readonly System.Text.Json.JsonEncodedText MemberDefinition = System.Text.Json.JsonEncodedText.Encode("definition"); + private static readonly System.Text.Json.JsonEncodedText MemberDefinitionStatus = System.Text.Json.JsonEncodedText.Encode("definition_status"); + private static readonly System.Text.Json.JsonEncodedText MemberFeatureImportanceBaseline = System.Text.Json.JsonEncodedText.Encode("feature_importance_baseline"); + private static readonly System.Text.Json.JsonEncodedText MemberHyperparameters = System.Text.Json.JsonEncodedText.Encode("hyperparameters"); + private static readonly System.Text.Json.JsonEncodedText MemberTotalFeatureImportance = System.Text.Json.JsonEncodedText.Encode("total_feature_importance"); -internal sealed class AppliesToConverter : JsonConverter -{ - public override AppliesTo Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.MachineLearning.Include Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDefinition)) { - case "typical": - return AppliesTo.Typical; - case "time": - return AppliesTo.Time; - case "diff_from_typical": - return AppliesTo.DiffFromTypical; - case "actual": - return AppliesTo.Actual; + return Elastic.Clients.Elasticsearch.MachineLearning.Include.Definition; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberDefinitionStatus)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.DefinitionStatus; + } - public override void Write(Utf8JsonWriter writer, AppliesTo value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberFeatureImportanceBaseline)) { - case AppliesTo.Typical: - writer.WriteStringValue("typical"); - return; - case AppliesTo.Time: - writer.WriteStringValue("time"); - return; - case AppliesTo.DiffFromTypical: - writer.WriteStringValue("diff_from_typical"); - return; - case AppliesTo.Actual: - writer.WriteStringValue("actual"); - return; + return Elastic.Clients.Elasticsearch.MachineLearning.Include.FeatureImportanceBaseline; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberHyperparameters)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.Hyperparameters; + } -[JsonConverter(typeof(CategorizationStatusConverter))] -public enum CategorizationStatus -{ - [EnumMember(Value = "warn")] - Warn, - [EnumMember(Value = "ok")] - Ok -} + if (reader.ValueTextEquals(MemberTotalFeatureImportance)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.TotalFeatureImportance; + } -internal sealed class CategorizationStatusConverter : JsonConverter -{ - public override CategorizationStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + var value = reader.GetString()!; + if (string.Equals(value, MemberDefinition.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.Definition; + } + + if (string.Equals(value, MemberDefinitionStatus.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.DefinitionStatus; + } + + if (string.Equals(value, MemberFeatureImportanceBaseline.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.FeatureImportanceBaseline; + } + + if (string.Equals(value, MemberHyperparameters.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "warn": - return CategorizationStatus.Warn; - case "ok": - return CategorizationStatus.Ok; + return Elastic.Clients.Elasticsearch.MachineLearning.Include.Hyperparameters; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberTotalFeatureImportance.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.Include.TotalFeatureImportance; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.Include)}'."); } - public override void Write(Utf8JsonWriter writer, CategorizationStatus value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Include value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case CategorizationStatus.Warn: - writer.WriteStringValue("warn"); - return; - case CategorizationStatus.Ok: - writer.WriteStringValue("ok"); - return; + case Elastic.Clients.Elasticsearch.MachineLearning.Include.Definition: + writer.WriteStringValue(MemberDefinition); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.Include.DefinitionStatus: + writer.WriteStringValue(MemberDefinitionStatus); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.Include.FeatureImportanceBaseline: + writer.WriteStringValue(MemberFeatureImportanceBaseline); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.Include.Hyperparameters: + writer.WriteStringValue(MemberHyperparameters); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.Include.TotalFeatureImportance: + writer.WriteStringValue(MemberTotalFeatureImportance); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.Include)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.MachineLearning.Include ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ChunkingModeConverter))] -public enum ChunkingMode -{ - [EnumMember(Value = "off")] - Off, - [EnumMember(Value = "manual")] - Manual, - [EnumMember(Value = "auto")] - Auto + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Include value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ChunkingModeConverter : JsonConverter +internal sealed partial class TrainingPriorityConverter : System.Text.Json.Serialization.JsonConverter { - public override ChunkingMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberLow = System.Text.Json.JsonEncodedText.Encode("low"); + private static readonly System.Text.Json.JsonEncodedText MemberNormal = System.Text.Json.JsonEncodedText.Encode("normal"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberLow)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Low; + } + + if (reader.ValueTextEquals(MemberNormal)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Normal; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberLow.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Low; + } + + if (string.Equals(value, MemberNormal.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "off": - return ChunkingMode.Off; - case "manual": - return ChunkingMode.Manual; - case "auto": - return ChunkingMode.Auto; + return Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Normal; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority)}'."); } - public override void Write(Utf8JsonWriter writer, ChunkingMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ChunkingMode.Off: - writer.WriteStringValue("off"); - return; - case ChunkingMode.Manual: - writer.WriteStringValue("manual"); - return; - case ChunkingMode.Auto: - writer.WriteStringValue("auto"); - return; + case Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Low: + writer.WriteStringValue(MemberLow); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority.Normal: + writer.WriteStringValue(MemberNormal); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ConditionOperatorConverter))] -public enum ConditionOperator -{ - [EnumMember(Value = "lte")] - Lte, - [EnumMember(Value = "lt")] - Lt, - [EnumMember(Value = "gte")] - Gte, - [EnumMember(Value = "gt")] - Gt + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ConditionOperatorConverter : JsonConverter +internal sealed partial class DeploymentAllocationStateConverter : System.Text.Json.Serialization.JsonConverter { - public override ConditionOperator Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberFullyAllocated = System.Text.Json.JsonEncodedText.Encode("fully_allocated"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStarting = System.Text.Json.JsonEncodedText.Encode("starting"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFullyAllocated)) { - case "lte": - return ConditionOperator.Lte; - case "lt": - return ConditionOperator.Lt; - case "gte": - return ConditionOperator.Gte; - case "gt": - return ConditionOperator.Gt; + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.FullyAllocated; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Started; + } - public override void Write(Utf8JsonWriter writer, ConditionOperator value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberStarting)) { - case ConditionOperator.Lte: - writer.WriteStringValue("lte"); - return; - case ConditionOperator.Lt: - writer.WriteStringValue("lt"); - return; - case ConditionOperator.Gte: - writer.WriteStringValue("gte"); - return; - case ConditionOperator.Gt: - writer.WriteStringValue("gt"); - return; + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Starting; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberFullyAllocated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.FullyAllocated; + } -[JsonConverter(typeof(DatafeedStateConverter))] -public enum DatafeedState -{ - [EnumMember(Value = "stopping")] - Stopping, - [EnumMember(Value = "stopped")] - Stopped, - [EnumMember(Value = "starting")] - Starting, - [EnumMember(Value = "started")] - Started -} + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Started; + } -internal sealed class DatafeedStateConverter : JsonConverter -{ - public override DatafeedState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberStarting.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "stopping": - return DatafeedState.Stopping; - case "stopped": - return DatafeedState.Stopped; - case "starting": - return DatafeedState.Starting; - case "started": - return DatafeedState.Started; + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Starting; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState)}'."); } - public override void Write(Utf8JsonWriter writer, DatafeedState value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case DatafeedState.Stopping: - writer.WriteStringValue("stopping"); - return; - case DatafeedState.Stopped: - writer.WriteStringValue("stopped"); - return; - case DatafeedState.Starting: - writer.WriteStringValue("starting"); - return; - case DatafeedState.Started: - writer.WriteStringValue("started"); - return; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.FullyAllocated: + writer.WriteStringValue(MemberFullyAllocated); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState.Starting: + writer.WriteStringValue(MemberStarting); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DataframeStateConverter))] -public enum DataframeState -{ - [EnumMember(Value = "stopping")] - Stopping, - [EnumMember(Value = "stopped")] - Stopped, - [EnumMember(Value = "starting")] - Starting, - [EnumMember(Value = "started")] - Started, - [EnumMember(Value = "failed")] - Failed + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DataframeStateConverter : JsonConverter +internal sealed partial class TrainedModelTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override DataframeState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberLangIdent = System.Text.Json.JsonEncodedText.Encode("lang_ident"); + private static readonly System.Text.Json.JsonEncodedText MemberPytorch = System.Text.Json.JsonEncodedText.Encode("pytorch"); + private static readonly System.Text.Json.JsonEncodedText MemberTreeEnsemble = System.Text.Json.JsonEncodedText.Encode("tree_ensemble"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberLangIdent)) { - case "stopping": - return DataframeState.Stopping; - case "stopped": - return DataframeState.Stopped; - case "starting": - return DataframeState.Starting; - case "started": - return DataframeState.Started; - case "failed": - return DataframeState.Failed; + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.LangIdent; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberPytorch)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.Pytorch; + } - public override void Write(Utf8JsonWriter writer, DataframeState value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberTreeEnsemble)) { - case DataframeState.Stopping: - writer.WriteStringValue("stopping"); - return; - case DataframeState.Stopped: - writer.WriteStringValue("stopped"); - return; - case DataframeState.Starting: - writer.WriteStringValue("starting"); - return; - case DataframeState.Started: - writer.WriteStringValue("started"); - return; - case DataframeState.Failed: - writer.WriteStringValue("failed"); - return; - } - - writer.WriteNullValue(); - } -} + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.TreeEnsemble; + } -[JsonConverter(typeof(DeploymentAllocationStateConverter))] -public enum DeploymentAllocationState -{ - /// - /// - /// Trained model deployment is starting but it is not yet deployed on any nodes. - /// - /// - [EnumMember(Value = "starting")] - Starting, - /// - /// - /// The trained model is started on at least one node. - /// - /// - [EnumMember(Value = "started")] - Started, - /// - /// - /// Trained model deployment has started on all valid nodes. - /// - /// - [EnumMember(Value = "fully_allocated")] - FullyAllocated -} + var value = reader.GetString()!; + if (string.Equals(value, MemberLangIdent.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.LangIdent; + } -internal sealed class DeploymentAllocationStateConverter : JsonConverter -{ - public override DeploymentAllocationState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberPytorch.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "starting": - return DeploymentAllocationState.Starting; - case "started": - return DeploymentAllocationState.Started; - case "fully_allocated": - return DeploymentAllocationState.FullyAllocated; + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.Pytorch; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberTreeEnsemble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.TreeEnsemble; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType)}'."); } - public override void Write(Utf8JsonWriter writer, DeploymentAllocationState value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case DeploymentAllocationState.Starting: - writer.WriteStringValue("starting"); - return; - case DeploymentAllocationState.Started: - writer.WriteStringValue("started"); - return; - case DeploymentAllocationState.FullyAllocated: - writer.WriteStringValue("fully_allocated"); - return; + case Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.LangIdent: + writer.WriteStringValue(MemberLangIdent); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.Pytorch: + writer.WriteStringValue(MemberPytorch); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType.TreeEnsemble: + writer.WriteStringValue(MemberTreeEnsemble); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DeploymentAssignmentStateConverter))] -public enum DeploymentAssignmentState -{ - /// - /// - /// The deployment is preparing to stop and deallocate the model from the relevant nodes. - /// - /// - [EnumMember(Value = "stopping")] - Stopping, - /// - /// - /// The deployment has recently started but is not yet usable; the model is not allocated on any nodes. - /// - /// - [EnumMember(Value = "starting")] - Starting, - /// - /// - /// The deployment is usable; at least one node has the model allocated. - /// - /// - [EnumMember(Value = "started")] - Started, - /// - /// - /// The deployment is on a failed state and must be re-deployed. - /// - /// - [EnumMember(Value = "failed")] - Failed + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DeploymentAssignmentStateConverter : JsonConverter +internal sealed partial class ExcludeFrequentConverter : System.Text.Json.Serialization.JsonConverter { - public override DeploymentAssignmentState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberBy = System.Text.Json.JsonEncodedText.Encode("by"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberOver = System.Text.Json.JsonEncodedText.Encode("over"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAll)) { - case "stopping": - return DeploymentAssignmentState.Stopping; - case "starting": - return DeploymentAssignmentState.Starting; - case "started": - return DeploymentAssignmentState.Started; - case "failed": - return DeploymentAssignmentState.Failed; + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.All; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberBy)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.By; + } - public override void Write(Utf8JsonWriter writer, DeploymentAssignmentState value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberNone)) { - case DeploymentAssignmentState.Stopping: - writer.WriteStringValue("stopping"); - return; - case DeploymentAssignmentState.Starting: - writer.WriteStringValue("starting"); - return; - case DeploymentAssignmentState.Started: - writer.WriteStringValue("started"); - return; - case DeploymentAssignmentState.Failed: - writer.WriteStringValue("failed"); - return; + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.None; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberOver)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.Over; + } -[JsonConverter(typeof(ExcludeFrequentConverter))] -public enum ExcludeFrequent -{ - [EnumMember(Value = "over")] - Over, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "by")] - By, - [EnumMember(Value = "all")] - All -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.All; + } -internal sealed class ExcludeFrequentConverter : JsonConverter -{ - public override ExcludeFrequent Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberBy.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.By; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.None; + } + + if (string.Equals(value, MemberOver.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "over": - return ExcludeFrequent.Over; - case "none": - return ExcludeFrequent.None; - case "by": - return ExcludeFrequent.By; - case "all": - return ExcludeFrequent.All; + return Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.Over; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent)}'."); } - public override void Write(Utf8JsonWriter writer, ExcludeFrequent value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ExcludeFrequent.Over: - writer.WriteStringValue("over"); - return; - case ExcludeFrequent.None: - writer.WriteStringValue("none"); - return; - case ExcludeFrequent.By: - writer.WriteStringValue("by"); - return; - case ExcludeFrequent.All: - writer.WriteStringValue("all"); - return; + case Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.By: + writer.WriteStringValue(MemberBy); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent.Over: + writer.WriteStringValue(MemberOver); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(FilterTypeConverter))] -public enum FilterType -{ - [EnumMember(Value = "include")] - Include, - [EnumMember(Value = "exclude")] - Exclude + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class FilterTypeConverter : JsonConverter +internal sealed partial class ChunkingModeConverter : System.Text.Json.Serialization.JsonConverter { - public override FilterType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAuto = System.Text.Json.JsonEncodedText.Encode("auto"); + private static readonly System.Text.Json.JsonEncodedText MemberManual = System.Text.Json.JsonEncodedText.Encode("manual"); + private static readonly System.Text.Json.JsonEncodedText MemberOff = System.Text.Json.JsonEncodedText.Encode("off"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAuto)) { - case "include": - return FilterType.Include; - case "exclude": - return FilterType.Exclude; + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Auto; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberManual)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Manual; + } - public override void Write(Utf8JsonWriter writer, FilterType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberOff)) { - case FilterType.Include: - writer.WriteStringValue("include"); - return; - case FilterType.Exclude: - writer.WriteStringValue("exclude"); - return; + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Off; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAuto.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Auto; + } -[JsonConverter(typeof(IncludeConverter))] -public enum Include -{ - /// - /// - /// Includes the total feature importance for the training data set. The - /// baseline and total feature importance values are returned in the metadata - /// field in the response body. - /// - /// - [EnumMember(Value = "total_feature_importance")] - TotalFeatureImportance, - /// - /// - /// Includes the information about hyperparameters used to train the model. - /// This information consists of the value, the absolute and relative - /// importance of the hyperparameter as well as an indicator of whether it was - /// specified by the user or tuned during hyperparameter optimization. - /// - /// - [EnumMember(Value = "hyperparameters")] - Hyperparameters, - /// - /// - /// Includes the baseline for feature importance values. - /// - /// - [EnumMember(Value = "feature_importance_baseline")] - FeatureImportanceBaseline, - /// - /// - /// Includes the model definition status. - /// - /// - [EnumMember(Value = "definition_status")] - DefinitionStatus, - /// - /// - /// Includes the model definition. - /// - /// - [EnumMember(Value = "definition")] - Definition -} + if (string.Equals(value, MemberManual.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Manual; + } -internal sealed class IncludeConverter : JsonConverter -{ - public override Include Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberOff.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "total_feature_importance": - return Include.TotalFeatureImportance; - case "hyperparameters": - return Include.Hyperparameters; - case "feature_importance_baseline": - return Include.FeatureImportanceBaseline; - case "definition_status": - return Include.DefinitionStatus; - case "definition": - return Include.Definition; + return Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Off; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode)}'."); } - public override void Write(Utf8JsonWriter writer, Include value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Include.TotalFeatureImportance: - writer.WriteStringValue("total_feature_importance"); - return; - case Include.Hyperparameters: - writer.WriteStringValue("hyperparameters"); - return; - case Include.FeatureImportanceBaseline: - writer.WriteStringValue("feature_importance_baseline"); - return; - case Include.DefinitionStatus: - writer.WriteStringValue("definition_status"); - return; - case Include.Definition: - writer.WriteStringValue("definition"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Auto: + writer.WriteStringValue(MemberAuto); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Manual: + writer.WriteStringValue(MemberManual); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode.Off: + writer.WriteStringValue(MemberOff); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode)}'."); + } } -} -[JsonConverter(typeof(JobBlockedReasonConverter))] -public enum JobBlockedReason -{ - [EnumMember(Value = "revert")] - Revert, - [EnumMember(Value = "reset")] - Reset, - [EnumMember(Value = "delete")] - Delete + public override Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class JobBlockedReasonConverter : JsonConverter +internal sealed partial class DeploymentAssignmentStateConverter : System.Text.Json.Serialization.JsonConverter { - public override JobBlockedReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStarting = System.Text.Json.JsonEncodedText.Encode("starting"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("stopping"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFailed)) { - case "revert": - return JobBlockedReason.Revert; - case "reset": - return JobBlockedReason.Reset; - case "delete": - return JobBlockedReason.Delete; + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Failed; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Started; + } - public override void Write(Utf8JsonWriter writer, JobBlockedReason value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberStarting)) { - case JobBlockedReason.Revert: - writer.WriteStringValue("revert"); - return; - case JobBlockedReason.Reset: - writer.WriteStringValue("reset"); - return; - case JobBlockedReason.Delete: - writer.WriteStringValue("delete"); - return; + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Starting; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Failed; + } + + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Started; + } + + if (string.Equals(value, MemberStarting.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Starting; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Stopping; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Starting: + writer.WriteStringValue(MemberStarting); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DataframeStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStarting = System.Text.Json.JsonEncodedText.Encode("starting"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("stopping"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Failed; + } + + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Started; + } + + if (reader.ValueTextEquals(MemberStarting)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Starting; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopped; + } + + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Failed; + } + + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Started; + } + + if (string.Equals(value, MemberStarting.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Starting; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopped; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopping; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Starting: + writer.WriteStringValue(MemberStarting); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopped: + writer.WriteStringValue(MemberStopped); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DataframeState.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DatafeedStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStarting = System.Text.Json.JsonEncodedText.Encode("starting"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("stopping"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Started; + } + + if (reader.ValueTextEquals(MemberStarting)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Starting; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopped; + } + + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Started; + } + + if (string.Equals(value, MemberStarting.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Starting; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopped; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopping; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Starting: + writer.WriteStringValue(MemberStarting); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopped: + writer.WriteStringValue(MemberStopped); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class JobStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberClosed = System.Text.Json.JsonEncodedText.Encode("closed"); + private static readonly System.Text.Json.JsonEncodedText MemberClosing = System.Text.Json.JsonEncodedText.Encode("closing"); + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberOpened = System.Text.Json.JsonEncodedText.Encode("opened"); + private static readonly System.Text.Json.JsonEncodedText MemberOpening = System.Text.Json.JsonEncodedText.Encode("opening"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberClosed)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closed; + } + + if (reader.ValueTextEquals(MemberClosing)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closing; + } + + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Failed; + } + + if (reader.ValueTextEquals(MemberOpened)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opened; + } + + if (reader.ValueTextEquals(MemberOpening)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opening; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberClosed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closed; + } + + if (string.Equals(value, MemberClosing.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closing; + } + + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Failed; + } + + if (string.Equals(value, MemberOpened.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opened; + } + + if (string.Equals(value, MemberOpening.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opening; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.JobState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closed: + writer.WriteStringValue(MemberClosed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobState.Closing: + writer.WriteStringValue(MemberClosing); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobState.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opened: + writer.WriteStringValue(MemberOpened); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobState.Opening: + writer.WriteStringValue(MemberOpening); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.JobState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SnapshotUpgradeStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberLoadingOldState = System.Text.Json.JsonEncodedText.Encode("loading_old_state"); + private static readonly System.Text.Json.JsonEncodedText MemberSavingNewState = System.Text.Json.JsonEncodedText.Encode("saving_new_state"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Failed; + } + + if (reader.ValueTextEquals(MemberLoadingOldState)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.LoadingOldState; + } + + if (reader.ValueTextEquals(MemberSavingNewState)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.SavingNewState; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Stopped; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Failed; + } + + if (string.Equals(value, MemberLoadingOldState.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.LoadingOldState; + } + + if (string.Equals(value, MemberSavingNewState.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.SavingNewState; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Stopped; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.LoadingOldState: + writer.WriteStringValue(MemberLoadingOldState); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.SavingNewState: + writer.WriteStringValue(MemberSavingNewState); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState.Stopped: + writer.WriteStringValue(MemberStopped); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class MemoryStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberHardLimit = System.Text.Json.JsonEncodedText.Encode("hard_limit"); + private static readonly System.Text.Json.JsonEncodedText MemberOk = System.Text.Json.JsonEncodedText.Encode("ok"); + private static readonly System.Text.Json.JsonEncodedText MemberSoftLimit = System.Text.Json.JsonEncodedText.Encode("soft_limit"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberHardLimit)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.HardLimit; + } + + if (reader.ValueTextEquals(MemberOk)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.Ok; + } + + if (reader.ValueTextEquals(MemberSoftLimit)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.SoftLimit; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberHardLimit.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.HardLimit; + } + + if (string.Equals(value, MemberOk.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.Ok; + } + + if (string.Equals(value, MemberSoftLimit.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.SoftLimit; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.HardLimit: + writer.WriteStringValue(MemberHardLimit); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.Ok: + writer.WriteStringValue(MemberOk); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus.SoftLimit: + writer.WriteStringValue(MemberSoftLimit); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CategorizationStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberOk = System.Text.Json.JsonEncodedText.Encode("ok"); + private static readonly System.Text.Json.JsonEncodedText MemberWarn = System.Text.Json.JsonEncodedText.Encode("warn"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberOk)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Ok; + } + + if (reader.ValueTextEquals(MemberWarn)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Warn; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberOk.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Ok; + } + + if (string.Equals(value, MemberWarn.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Warn; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Ok: + writer.WriteStringValue(MemberOk); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus.Warn: + writer.WriteStringValue(MemberWarn); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class JobBlockedReasonConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDelete = System.Text.Json.JsonEncodedText.Encode("delete"); + private static readonly System.Text.Json.JsonEncodedText MemberReset = System.Text.Json.JsonEncodedText.Encode("reset"); + private static readonly System.Text.Json.JsonEncodedText MemberRevert = System.Text.Json.JsonEncodedText.Encode("revert"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDelete)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Delete; + } + + if (reader.ValueTextEquals(MemberReset)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Reset; + } + + if (reader.ValueTextEquals(MemberRevert)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Revert; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDelete.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Delete; + } + + if (string.Equals(value, MemberReset.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Reset; + } + + if (string.Equals(value, MemberRevert.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Revert; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Delete: + writer.WriteStringValue(MemberDelete); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Reset: + writer.WriteStringValue(MemberReset); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason.Revert: + writer.WriteStringValue(MemberRevert); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class RoutingStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStarting = System.Text.Json.JsonEncodedText.Encode("starting"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("stopping"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RoutingState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Failed; + } + + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Started; + } + + if (reader.ValueTextEquals(MemberStarting)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Starting; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopped; + } + + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Failed; + } + + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Started; + } + + if (string.Equals(value, MemberStarting.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Starting; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopped; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopping; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.RoutingState)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RoutingState value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Starting: + writer.WriteStringValue(MemberStarting); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopped: + writer.WriteStringValue(MemberStopped); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.RoutingState.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.RoutingState)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.RoutingState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RoutingState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class RuleActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberSkipModelUpdate = System.Text.Json.JsonEncodedText.Encode("skip_model_update"); + private static readonly System.Text.Json.JsonEncodedText MemberSkipResult = System.Text.Json.JsonEncodedText.Encode("skip_result"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RuleAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberSkipModelUpdate)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipModelUpdate; + } + + if (reader.ValueTextEquals(MemberSkipResult)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipResult; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberSkipModelUpdate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipModelUpdate; + } + + if (string.Equals(value, MemberSkipResult.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipResult; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.RuleAction)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RuleAction value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipModelUpdate: + writer.WriteStringValue(MemberSkipModelUpdate); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.RuleAction.SkipResult: + writer.WriteStringValue(MemberSkipResult); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.RuleAction)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.RuleAction ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RuleAction value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class TokenizationTruncateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFirst = System.Text.Json.JsonEncodedText.Encode("first"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberSecond = System.Text.Json.JsonEncodedText.Encode("second"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFirst)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.First; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.None; + } + + if (reader.ValueTextEquals(MemberSecond)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.Second; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.First; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.None; + } + + if (string.Equals(value, MemberSecond.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.Second; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.First: + writer.WriteStringValue(MemberFirst); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate.Second: + writer.WriteStringValue(MemberSecond); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class AppliesToConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberActual = System.Text.Json.JsonEncodedText.Encode("actual"); + private static readonly System.Text.Json.JsonEncodedText MemberDiffFromTypical = System.Text.Json.JsonEncodedText.Encode("diff_from_typical"); + private static readonly System.Text.Json.JsonEncodedText MemberTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText MemberTypical = System.Text.Json.JsonEncodedText.Encode("typical"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberActual)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Actual; + } + + if (reader.ValueTextEquals(MemberDiffFromTypical)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.DiffFromTypical; + } + + if (reader.ValueTextEquals(MemberTime)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Time; + } + + if (reader.ValueTextEquals(MemberTypical)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Typical; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberActual.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Actual; + } + + if (string.Equals(value, MemberDiffFromTypical.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.DiffFromTypical; + } + + if (string.Equals(value, MemberTime.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Time; + } + + if (string.Equals(value, MemberTypical.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Typical; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Actual: + writer.WriteStringValue(MemberActual); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.DiffFromTypical: + writer.WriteStringValue(MemberDiffFromTypical); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Time: + writer.WriteStringValue(MemberTime); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo.Typical: + writer.WriteStringValue(MemberTypical); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ConditionOperatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText MemberGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText MemberLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText MemberLte = System.Text.Json.JsonEncodedText.Encode("lte"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberGt)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gt; + } + + if (reader.ValueTextEquals(MemberGte)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gte; + } + + if (reader.ValueTextEquals(MemberLt)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lt; + } + + if (reader.ValueTextEquals(MemberLte)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lte; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberGt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gt; + } + + if (string.Equals(value, MemberGte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gte; + } + + if (string.Equals(value, MemberLt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lt; + } + + if (string.Equals(value, MemberLte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lte; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gt: + writer.WriteStringValue(MemberGt); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Gte: + writer.WriteStringValue(MemberGte); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lt: + writer.WriteStringValue(MemberLt); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator.Lte: + writer.WriteStringValue(MemberLte); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class FilterTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText MemberInclude = System.Text.Json.JsonEncodedText.Encode("include"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FilterType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberExclude)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Exclude; + } + + if (reader.ValueTextEquals(MemberInclude)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Include; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberExclude.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Exclude; + } + + if (string.Equals(value, MemberInclude.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Include; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.FilterType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FilterType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Exclude: + writer.WriteStringValue(MemberExclude); + break; + case Elastic.Clients.Elasticsearch.MachineLearning.FilterType.Include: + writer.WriteStringValue(MemberInclude); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.FilterType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.MachineLearning.FilterType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FilterType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.IncludeConverter))] +public enum Include +{ + /// + /// + /// Includes the model definition. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "definition")] + Definition, + /// + /// + /// Includes the model definition status. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "definition_status")] + DefinitionStatus, + /// + /// + /// Includes the baseline for feature importance values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "feature_importance_baseline")] + FeatureImportanceBaseline, + /// + /// + /// Includes the information about hyperparameters used to train the model. + /// This information consists of the value, the absolute and relative + /// importance of the hyperparameter as well as an indicator of whether it was + /// specified by the user or tuned during hyperparameter optimization. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "hyperparameters")] + Hyperparameters, + /// + /// + /// Includes the total feature importance for the training data set. The + /// baseline and total feature importance values are returned in the metadata + /// field in the response body. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "total_feature_importance")] + TotalFeatureImportance +} -[JsonConverter(typeof(JobStateConverter))] -public enum JobState +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriorityConverter))] +public enum TrainingPriority +{ + [System.Runtime.Serialization.EnumMember(Value = "low")] + Low, + [System.Runtime.Serialization.EnumMember(Value = "normal")] + Normal +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationStateConverter))] +public enum DeploymentAllocationState { /// /// - /// The job open action is in progress and has not yet completed. + /// Trained model deployment has started on all valid nodes. /// /// - [EnumMember(Value = "opening")] - Opening, + [System.Runtime.Serialization.EnumMember(Value = "fully_allocated")] + FullyAllocated, /// /// - /// The job is available to receive and process data. + /// The trained model is started on at least one node. /// /// - [EnumMember(Value = "opened")] - Opened, + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, /// /// - /// The job did not finish successfully due to an error. - /// This situation can occur due to invalid input data, a fatal error occurring during the analysis, or an external interaction such as the process being killed by the Linux out of memory (OOM) killer. - /// If the job had irrevocably failed, it must be force closed and then deleted. - /// If the datafeed can be corrected, the job can be closed and then re-opened. + /// Trained model deployment is starting but it is not yet deployed on any nodes. /// /// - [EnumMember(Value = "failed")] - Failed, + [System.Runtime.Serialization.EnumMember(Value = "starting")] + Starting +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTypeConverter))] +public enum TrainedModelType +{ /// /// - /// The job close action is in progress and has not yet completed. A closing job cannot accept further data. + /// A special type reserved for language identification models. /// /// - [EnumMember(Value = "closing")] - Closing, + [System.Runtime.Serialization.EnumMember(Value = "lang_ident")] + LangIdent, /// /// - /// The job finished successfully with its model state persisted. The job must be opened before it can accept further data. + /// The stored definition is a PyTorch (specifically a TorchScript) model. + /// Currently only NLP models are supported. /// /// - [EnumMember(Value = "closed")] - Closed -} - -internal sealed class JobStateConverter : JsonConverter -{ - public override JobState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "opening": - return JobState.Opening; - case "opened": - return JobState.Opened; - case "failed": - return JobState.Failed; - case "closing": - return JobState.Closing; - case "closed": - return JobState.Closed; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, JobState value, JsonSerializerOptions options) - { - switch (value) - { - case JobState.Opening: - writer.WriteStringValue("opening"); - return; - case JobState.Opened: - writer.WriteStringValue("opened"); - return; - case JobState.Failed: - writer.WriteStringValue("failed"); - return; - case JobState.Closing: - writer.WriteStringValue("closing"); - return; - case JobState.Closed: - writer.WriteStringValue("closed"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "pytorch")] + Pytorch, + /// + /// + /// The model definition is an ensemble model of decision trees. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "tree_ensemble")] + TreeEnsemble } -[JsonConverter(typeof(MemoryStatusConverter))] -public enum MemoryStatus +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequentConverter))] +public enum ExcludeFrequent { - [EnumMember(Value = "soft_limit")] - SoftLimit, - [EnumMember(Value = "ok")] - Ok, - [EnumMember(Value = "hard_limit")] - HardLimit + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + [System.Runtime.Serialization.EnumMember(Value = "by")] + By, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "over")] + Over } -internal sealed class MemoryStatusConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingModeConverter))] +public enum ChunkingMode { - public override MemoryStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "soft_limit": - return MemoryStatus.SoftLimit; - case "ok": - return MemoryStatus.Ok; - case "hard_limit": - return MemoryStatus.HardLimit; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, MemoryStatus value, JsonSerializerOptions options) - { - switch (value) - { - case MemoryStatus.SoftLimit: - writer.WriteStringValue("soft_limit"); - return; - case MemoryStatus.Ok: - writer.WriteStringValue("ok"); - return; - case MemoryStatus.HardLimit: - writer.WriteStringValue("hard_limit"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "auto")] + Auto, + [System.Runtime.Serialization.EnumMember(Value = "manual")] + Manual, + [System.Runtime.Serialization.EnumMember(Value = "off")] + Off } -[JsonConverter(typeof(RoutingStateConverter))] -public enum RoutingState +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentStateConverter))] +public enum DeploymentAssignmentState { /// /// - /// The trained model is being deallocated from this node. + /// The deployment is on a failed state and must be re-deployed. /// /// - [EnumMember(Value = "stopping")] - Stopping, + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, /// /// - /// The trained model is fully deallocated from this node. + /// The deployment is usable; at least one node has the model allocated. /// /// - [EnumMember(Value = "stopped")] - Stopped, + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, /// /// - /// The trained model is attempting to allocate on this node; inference requests are not yet accepted. + /// The deployment has recently started but is not yet usable; the model is not allocated on any nodes. /// /// - [EnumMember(Value = "starting")] + [System.Runtime.Serialization.EnumMember(Value = "starting")] Starting, /// /// - /// The trained model is allocated and ready to accept inference requests. - /// - /// - [EnumMember(Value = "started")] - Started, - /// - /// - /// The allocation attempt failed. + /// The deployment is preparing to stop and deallocate the model from the relevant nodes. /// /// - [EnumMember(Value = "failed")] - Failed + [System.Runtime.Serialization.EnumMember(Value = "stopping")] + Stopping } -internal sealed class RoutingStateConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeStateConverter))] +public enum DataframeState { - public override RoutingState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "stopping": - return RoutingState.Stopping; - case "stopped": - return RoutingState.Stopped; - case "starting": - return RoutingState.Starting; - case "started": - return RoutingState.Started; - case "failed": - return RoutingState.Failed; - } - - ThrowHelper.ThrowJsonException(); - return default; - } + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, + [System.Runtime.Serialization.EnumMember(Value = "starting")] + Starting, + [System.Runtime.Serialization.EnumMember(Value = "stopped")] + Stopped, + [System.Runtime.Serialization.EnumMember(Value = "stopping")] + Stopping +} - public override void Write(Utf8JsonWriter writer, RoutingState value, JsonSerializerOptions options) - { - switch (value) - { - case RoutingState.Stopping: - writer.WriteStringValue("stopping"); - return; - case RoutingState.Stopped: - writer.WriteStringValue("stopped"); - return; - case RoutingState.Starting: - writer.WriteStringValue("starting"); - return; - case RoutingState.Started: - writer.WriteStringValue("started"); - return; - case RoutingState.Failed: - writer.WriteStringValue("failed"); - return; - } - - writer.WriteNullValue(); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedStateConverter))] +public enum DatafeedState +{ + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, + [System.Runtime.Serialization.EnumMember(Value = "starting")] + Starting, + [System.Runtime.Serialization.EnumMember(Value = "stopped")] + Stopped, + [System.Runtime.Serialization.EnumMember(Value = "stopping")] + Stopping } -[JsonConverter(typeof(RuleActionConverter))] -public enum RuleAction +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobStateConverter))] +public enum JobState { /// /// - /// The result will not be created. Unless you also specify skip_model_update, the model will be updated as usual with the corresponding series value. + /// The job finished successfully with its model state persisted. The job must be opened before it can accept further data. /// /// - [EnumMember(Value = "skip_result")] - SkipResult, + [System.Runtime.Serialization.EnumMember(Value = "closed")] + Closed, /// /// - /// The value for that series will not be used to update the model. Unless you also specify skip_result, the results will be created as usual. This action is suitable when certain values are expected to be consistently anomalous and they affect the model in a way that negatively impacts the rest of the results. + /// The job close action is in progress and has not yet completed. A closing job cannot accept further data. /// /// - [EnumMember(Value = "skip_model_update")] - SkipModelUpdate -} - -internal sealed class RuleActionConverter : JsonConverter -{ - public override RuleAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "skip_result": - return RuleAction.SkipResult; - case "skip_model_update": - return RuleAction.SkipModelUpdate; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, RuleAction value, JsonSerializerOptions options) - { - switch (value) - { - case RuleAction.SkipResult: - writer.WriteStringValue("skip_result"); - return; - case RuleAction.SkipModelUpdate: - writer.WriteStringValue("skip_model_update"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "closing")] + Closing, + /// + /// + /// The job did not finish successfully due to an error. + /// This situation can occur due to invalid input data, a fatal error occurring during the analysis, or an external interaction such as the process being killed by the Linux out of memory (OOM) killer. + /// If the job had irrevocably failed, it must be force closed and then deleted. + /// If the datafeed can be corrected, the job can be closed and then re-opened. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, + /// + /// + /// The job is available to receive and process data. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "opened")] + Opened, + /// + /// + /// The job open action is in progress and has not yet completed. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "opening")] + Opening } -[JsonConverter(typeof(SnapshotUpgradeStateConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeStateConverter))] public enum SnapshotUpgradeState { - [EnumMember(Value = "stopped")] - Stopped, - [EnumMember(Value = "saving_new_state")] - SavingNewState, - [EnumMember(Value = "loading_old_state")] + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, + [System.Runtime.Serialization.EnumMember(Value = "loading_old_state")] LoadingOldState, - [EnumMember(Value = "failed")] - Failed + [System.Runtime.Serialization.EnumMember(Value = "saving_new_state")] + SavingNewState, + [System.Runtime.Serialization.EnumMember(Value = "stopped")] + Stopped } -internal sealed class SnapshotUpgradeStateConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatusConverter))] +public enum MemoryStatus { - public override SnapshotUpgradeState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "stopped": - return SnapshotUpgradeState.Stopped; - case "saving_new_state": - return SnapshotUpgradeState.SavingNewState; - case "loading_old_state": - return SnapshotUpgradeState.LoadingOldState; - case "failed": - return SnapshotUpgradeState.Failed; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SnapshotUpgradeState value, JsonSerializerOptions options) - { - switch (value) - { - case SnapshotUpgradeState.Stopped: - writer.WriteStringValue("stopped"); - return; - case SnapshotUpgradeState.SavingNewState: - writer.WriteStringValue("saving_new_state"); - return; - case SnapshotUpgradeState.LoadingOldState: - writer.WriteStringValue("loading_old_state"); - return; - case SnapshotUpgradeState.Failed: - writer.WriteStringValue("failed"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "hard_limit")] + HardLimit, + [System.Runtime.Serialization.EnumMember(Value = "ok")] + Ok, + [System.Runtime.Serialization.EnumMember(Value = "soft_limit")] + SoftLimit } -[JsonConverter(typeof(TokenizationTruncateConverter))] -public enum TokenizationTruncate +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatusConverter))] +public enum CategorizationStatus { - [EnumMember(Value = "second")] - Second, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "first")] - First + [System.Runtime.Serialization.EnumMember(Value = "ok")] + Ok, + [System.Runtime.Serialization.EnumMember(Value = "warn")] + Warn } -internal sealed class TokenizationTruncateConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReasonConverter))] +public enum JobBlockedReason { - public override TokenizationTruncate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "second": - return TokenizationTruncate.Second; - case "none": - return TokenizationTruncate.None; - case "first": - return TokenizationTruncate.First; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TokenizationTruncate value, JsonSerializerOptions options) - { - switch (value) - { - case TokenizationTruncate.Second: - writer.WriteStringValue("second"); - return; - case TokenizationTruncate.None: - writer.WriteStringValue("none"); - return; - case TokenizationTruncate.First: - writer.WriteStringValue("first"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "delete")] + Delete, + [System.Runtime.Serialization.EnumMember(Value = "reset")] + Reset, + [System.Runtime.Serialization.EnumMember(Value = "revert")] + Revert } -[JsonConverter(typeof(TrainedModelTypeConverter))] -public enum TrainedModelType +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RoutingStateConverter))] +public enum RoutingState { /// /// - /// The model definition is an ensemble model of decision trees. + /// The allocation attempt failed. /// /// - [EnumMember(Value = "tree_ensemble")] - TreeEnsemble, + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, /// /// - /// The stored definition is a PyTorch (specifically a TorchScript) model. - /// Currently only NLP models are supported. + /// The trained model is allocated and ready to accept inference requests. /// /// - [EnumMember(Value = "pytorch")] - Pytorch, + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, /// /// - /// A special type reserved for language identification models. + /// The trained model is attempting to allocate on this node; inference requests are not yet accepted. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "starting")] + Starting, + /// + /// + /// The trained model is fully deallocated from this node. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "stopped")] + Stopped, + /// + /// + /// The trained model is being deallocated from this node. /// /// - [EnumMember(Value = "lang_ident")] - LangIdent + [System.Runtime.Serialization.EnumMember(Value = "stopping")] + Stopping } -internal sealed class TrainedModelTypeConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RuleActionConverter))] +public enum RuleAction { - public override TrainedModelType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "tree_ensemble": - return TrainedModelType.TreeEnsemble; - case "pytorch": - return TrainedModelType.Pytorch; - case "lang_ident": - return TrainedModelType.LangIdent; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TrainedModelType value, JsonSerializerOptions options) - { - switch (value) - { - case TrainedModelType.TreeEnsemble: - writer.WriteStringValue("tree_ensemble"); - return; - case TrainedModelType.Pytorch: - writer.WriteStringValue("pytorch"); - return; - case TrainedModelType.LangIdent: - writer.WriteStringValue("lang_ident"); - return; - } - - writer.WriteNullValue(); - } + /// + /// + /// The value for that series will not be used to update the model. Unless you also specify skip_result, the results will be created as usual. This action is suitable when certain values are expected to be consistently anomalous and they affect the model in a way that negatively impacts the rest of the results. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "skip_model_update")] + SkipModelUpdate, + /// + /// + /// The result will not be created. Unless you also specify skip_model_update, the model will be updated as usual with the corresponding series value. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "skip_result")] + SkipResult } -[JsonConverter(typeof(TrainingPriorityConverter))] -public enum TrainingPriority +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncateConverter))] +public enum TokenizationTruncate { - [EnumMember(Value = "normal")] - Normal, - [EnumMember(Value = "low")] - Low + [System.Runtime.Serialization.EnumMember(Value = "first")] + First, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "second")] + Second } -internal sealed class TrainingPriorityConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AppliesToConverter))] +public enum AppliesTo { - public override TrainingPriority Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "normal": - return TrainingPriority.Normal; - case "low": - return TrainingPriority.Low; - } - - ThrowHelper.ThrowJsonException(); - return default; - } + [System.Runtime.Serialization.EnumMember(Value = "actual")] + Actual, + [System.Runtime.Serialization.EnumMember(Value = "diff_from_typical")] + DiffFromTypical, + [System.Runtime.Serialization.EnumMember(Value = "time")] + Time, + [System.Runtime.Serialization.EnumMember(Value = "typical")] + Typical +} - public override void Write(Utf8JsonWriter writer, TrainingPriority value, JsonSerializerOptions options) - { - switch (value) - { - case TrainingPriority.Normal: - writer.WriteStringValue("normal"); - return; - case TrainingPriority.Low: - writer.WriteStringValue("low"); - return; - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperatorConverter))] +public enum ConditionOperator +{ + [System.Runtime.Serialization.EnumMember(Value = "gt")] + Gt, + [System.Runtime.Serialization.EnumMember(Value = "gte")] + Gte, + [System.Runtime.Serialization.EnumMember(Value = "lt")] + Lt, + [System.Runtime.Serialization.EnumMember(Value = "lte")] + Lte +} - writer.WriteNullValue(); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FilterTypeConverter))] +public enum FilterType +{ + [System.Runtime.Serialization.EnumMember(Value = "exclude")] + Exclude, + [System.Runtime.Serialization.EnumMember(Value = "include")] + Include } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs index 97f25205c22..e2532c0d9ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs @@ -17,1296 +17,2486 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -[JsonConverter(typeof(DenseVectorElementTypeConverter))] -public enum DenseVectorElementType +internal sealed partial class DynamicMappingConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Indexes a 4-byte floating-point value per dimension. - /// - /// - [EnumMember(Value = "float")] - Float, - /// - /// - /// Indexes a 1-byte integer value per dimension. - /// - /// - [EnumMember(Value = "byte")] - Byte, - /// - /// - /// Indexes a single bit per dimension. Useful for very high-dimensional vectors or models that specifically support - /// bit vectors. - /// - /// - /// NOTE: when using bit, the number of dimensions must be a multiple of 8 and must represent the number of bits. - /// - /// - [EnumMember(Value = "bit")] - Bit -} + private static readonly System.Text.Json.JsonEncodedText MemberFalse = System.Text.Json.JsonEncodedText.Encode("false"); + private static readonly System.Text.Json.JsonEncodedText MemberRuntime = System.Text.Json.JsonEncodedText.Encode("runtime"); + private static readonly System.Text.Json.JsonEncodedText MemberStrict = System.Text.Json.JsonEncodedText.Encode("strict"); + private static readonly System.Text.Json.JsonEncodedText MemberTrue = System.Text.Json.JsonEncodedText.Encode("true"); -internal sealed class DenseVectorElementTypeConverter : JsonConverter -{ - public override DenseVectorElementType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Mapping.DynamicMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFalse)) { - case "float": - return DenseVectorElementType.Float; - case "byte": - return DenseVectorElementType.Byte; - case "bit": - return DenseVectorElementType.Bit; + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.False; } - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, DenseVectorElementType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberRuntime)) { - case DenseVectorElementType.Float: - writer.WriteStringValue("float"); - return; - case DenseVectorElementType.Byte: - writer.WriteStringValue("byte"); - return; - case DenseVectorElementType.Bit: - writer.WriteStringValue("bit"); - return; + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Runtime; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberStrict)) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Strict; + } -[JsonConverter(typeof(DenseVectorIndexOptionsTypeConverter))] -public enum DenseVectorIndexOptionsType -{ - /// - /// - /// The default index type for float vectors. This utilizes the HNSW algorithm in addition to automatically scalar - /// quantization for scalable approximate kNN search with element_type of float. - /// - /// - /// This can reduce the memory footprint by 4x at the cost of some accuracy. - /// - /// - [EnumMember(Value = "int8_hnsw")] - Int8Hnsw, - /// - /// - /// This utilizes a brute-force search algorithm in addition to automatically scalar quantization. Only supports - /// element_type of float. - /// - /// - [EnumMember(Value = "int8_flat")] - Int8Flat, - /// - /// - /// This utilizes the HNSW algorithm in addition to automatically scalar quantization for scalable approximate kNN - /// search with element_type of float. - /// - /// - /// This can reduce the memory footprint by 8x at the cost of some accuracy. - /// - /// - [EnumMember(Value = "int4_hnsw")] - Int4Hnsw, - /// - /// - /// This utilizes a brute-force search algorithm in addition to automatically half-byte scalar quantization. - /// Only supports element_type of float. - /// - /// - [EnumMember(Value = "int4_flat")] - Int4Flat, - /// - /// - /// This utilizes the HNSW algorithm for scalable approximate kNN search. This supports all element_type values. - /// - /// - [EnumMember(Value = "hnsw")] - Hnsw, - /// - /// - /// This utilizes a brute-force search algorithm for exact kNN search. This supports all element_type values. - /// - /// - [EnumMember(Value = "flat")] - Flat -} + if (reader.ValueTextEquals(MemberTrue)) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.True; + } -internal sealed class DenseVectorIndexOptionsTypeConverter : JsonConverter -{ - public override DenseVectorIndexOptionsType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.TokenType is not System.Text.Json.JsonTokenType.String) { - case "int8_hnsw": - return DenseVectorIndexOptionsType.Int8Hnsw; - case "int8_flat": - return DenseVectorIndexOptionsType.Int8Flat; - case "int4_hnsw": - return DenseVectorIndexOptionsType.Int4Hnsw; - case "int4_flat": - return DenseVectorIndexOptionsType.Int4Flat; - case "hnsw": - return DenseVectorIndexOptionsType.Hnsw; - case "flat": - return DenseVectorIndexOptionsType.Flat; + throw new System.Text.Json.JsonException($"Unknown member of type '{reader.TokenType}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping)}'."); } - ThrowHelper.ThrowJsonException(); - return default; - } + var value = reader.GetString()!; + if (string.Equals(value, MemberFalse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.False; + } - public override void Write(Utf8JsonWriter writer, DenseVectorIndexOptionsType value, JsonSerializerOptions options) - { - switch (value) + if (string.Equals(value, MemberRuntime.Value, System.StringComparison.OrdinalIgnoreCase)) { - case DenseVectorIndexOptionsType.Int8Hnsw: - writer.WriteStringValue("int8_hnsw"); - return; - case DenseVectorIndexOptionsType.Int8Flat: - writer.WriteStringValue("int8_flat"); - return; - case DenseVectorIndexOptionsType.Int4Hnsw: - writer.WriteStringValue("int4_hnsw"); - return; - case DenseVectorIndexOptionsType.Int4Flat: - writer.WriteStringValue("int4_flat"); - return; - case DenseVectorIndexOptionsType.Hnsw: - writer.WriteStringValue("hnsw"); - return; - case DenseVectorIndexOptionsType.Flat: - writer.WriteStringValue("flat"); - return; - } - - writer.WriteNullValue(); - } -} + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Runtime; + } -[JsonConverter(typeof(DenseVectorSimilarityConverter))] -public enum DenseVectorSimilarity -{ - /// - /// - /// Computes the maximum inner product of two vectors. This is similar to dot_product, but doesn't require vectors - /// to be normalized. This means that each vector’s magnitude can significantly effect the score. - /// - /// - /// The document _score is adjusted to prevent negative values. For max_inner_product values < 0, the _score - /// is 1 / (1 + -1 * max_inner_product(query, vector)). For non-negative max_inner_product results the _score - /// is calculated max_inner_product(query, vector) + 1. - /// - /// - [EnumMember(Value = "max_inner_product")] - MaxInnerProduct, - /// - /// - /// Computes similarity based on the L2 distance (also known as Euclidean distance) between the vectors. - /// - /// - /// The document _score is computed as 1 / (1 + l2_norm(query, vector)^2). - /// - /// - /// For bit vectors, instead of using l2_norm, the hamming distance between the vectors is used. - /// - /// - /// The _score transformation is (numBits - hamming(a, b)) / numBits. - /// - /// - [EnumMember(Value = "l2_norm")] - L2Norm, - /// - /// - /// Computes the dot product of two unit vectors. This option provides an optimized way to perform cosine similarity. - /// The constraints and computed score are defined by element_type. - /// - /// - /// When element_type is float, all vectors must be unit length, including both document and query vectors. - /// - /// - /// The document _score is computed as (1 + dot_product(query, vector)) / 2. - /// - /// - /// When element_type is byte, all vectors must have the same length including both document and query vectors or - /// results will be inaccurate. - /// - /// - /// The document _score is computed as 0.5 + (dot_product(query, vector) / (32768 * dims)) where dims is the - /// number of dimensions per vector. - /// - /// - [EnumMember(Value = "dot_product")] - DotProduct, - /// - /// - /// Computes the cosine similarity. During indexing Elasticsearch automatically normalizes vectors with cosine - /// similarity to unit length. This allows to internally use dot_product for computing similarity, which is more - /// efficient. Original un-normalized vectors can be still accessed through scripts. - /// - /// - /// The document _score is computed as (1 + cosine(query, vector)) / 2. - /// - /// - /// The cosine similarity does not allow vectors with zero magnitude, since cosine is not defined in this case. - /// - /// - [EnumMember(Value = "cosine")] - Cosine -} + if (string.Equals(value, MemberStrict.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Strict; + } -internal sealed class DenseVectorSimilarityConverter : JsonConverter -{ - public override DenseVectorSimilarity Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberTrue.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "max_inner_product": - return DenseVectorSimilarity.MaxInnerProduct; - case "l2_norm": - return DenseVectorSimilarity.L2Norm; - case "dot_product": - return DenseVectorSimilarity.DotProduct; - case "cosine": - return DenseVectorSimilarity.Cosine; + return Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.True; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping)}'."); } - public override void Write(Utf8JsonWriter writer, DenseVectorSimilarity value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DynamicMapping value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case DenseVectorSimilarity.MaxInnerProduct: - writer.WriteStringValue("max_inner_product"); - return; - case DenseVectorSimilarity.L2Norm: - writer.WriteStringValue("l2_norm"); - return; - case DenseVectorSimilarity.DotProduct: - writer.WriteStringValue("dot_product"); - return; - case DenseVectorSimilarity.Cosine: - writer.WriteStringValue("cosine"); - return; + case Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.False: + writer.WriteRawValue(MemberFalse.EncodedUtf8Bytes); + break; + case Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Runtime: + writer.WriteStringValue(MemberRuntime); + break; + case Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.Strict: + writer.WriteStringValue(MemberStrict); + break; + case Elastic.Clients.Elasticsearch.Mapping.DynamicMapping.True: + writer.WriteRawValue(MemberTrue.EncodedUtf8Bytes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.DynamicMapping ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DynamicMappingConverter))] -public enum DynamicMapping -{ - [EnumMember(Value = "true")] - True, - [EnumMember(Value = "strict")] - Strict, - [EnumMember(Value = "runtime")] - Runtime, - [EnumMember(Value = "false")] - False + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DynamicMapping value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DynamicMappingConverter : JsonConverter +internal sealed partial class SubobjectsConverter : System.Text.Json.Serialization.JsonConverter { - public override DynamicMapping Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAuto = System.Text.Json.JsonEncodedText.Encode("auto"); + private static readonly System.Text.Json.JsonEncodedText MemberFalse = System.Text.Json.JsonEncodedText.Encode("false"); + private static readonly System.Text.Json.JsonEncodedText MemberTrue = System.Text.Json.JsonEncodedText.Encode("true"); + + public override Elastic.Clients.Elasticsearch.Mapping.Subobjects Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAuto)) { - case "true": - return DynamicMapping.True; - case "strict": - return DynamicMapping.Strict; - case "runtime": - return DynamicMapping.Runtime; - case "false": - return DynamicMapping.False; + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.Auto; } - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, DynamicMapping value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberFalse)) { - case DynamicMapping.True: - writer.WriteStringValue("true"); - return; - case DynamicMapping.Strict: - writer.WriteStringValue("strict"); - return; - case DynamicMapping.Runtime: - writer.WriteStringValue("runtime"); - return; - case DynamicMapping.False: - writer.WriteStringValue("false"); - return; + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.False; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberTrue)) + { + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.True; + } -[JsonConverter(typeof(FieldTypeConverter))] -public enum FieldType -{ - [EnumMember(Value = "version")] - Version, - [EnumMember(Value = "token_count")] - TokenCount, - [EnumMember(Value = "text")] - Text, - [EnumMember(Value = "sparse_vector")] - SparseVector, - [EnumMember(Value = "short")] - Short, - [EnumMember(Value = "shape")] - Shape, - [EnumMember(Value = "semantic_text")] - SemanticText, - [EnumMember(Value = "search_as_you_type")] - SearchAsYouType, - [EnumMember(Value = "scaled_float")] - ScaledFloat, - [EnumMember(Value = "rank_features")] - RankFeatures, - [EnumMember(Value = "rank_feature")] - RankFeature, - [EnumMember(Value = "percolator")] - Percolator, - [EnumMember(Value = "object")] - Object, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "nested")] - Nested, - [EnumMember(Value = "murmur3")] - Murmur3, - [EnumMember(Value = "match_only_text")] - MatchOnlyText, - [EnumMember(Value = "long_range")] - LongRange, - [EnumMember(Value = "long")] - Long, - [EnumMember(Value = "keyword")] - Keyword, - [EnumMember(Value = "join")] - Join, - [EnumMember(Value = "ip_range")] - IpRange, - [EnumMember(Value = "ip")] - Ip, - [EnumMember(Value = "integer_range")] - IntegerRange, - [EnumMember(Value = "integer")] - Integer, - [EnumMember(Value = "icu_collation_keyword")] - IcuCollationKeyword, - [EnumMember(Value = "histogram")] - Histogram, - [EnumMember(Value = "half_float")] - HalfFloat, - [EnumMember(Value = "geo_shape")] - GeoShape, - [EnumMember(Value = "geo_point")] - GeoPoint, - [EnumMember(Value = "float_range")] - FloatRange, - [EnumMember(Value = "float")] - Float, - [EnumMember(Value = "flattened")] - Flattened, - [EnumMember(Value = "double_range")] - DoubleRange, - [EnumMember(Value = "double")] - Double, - [EnumMember(Value = "dense_vector")] - DenseVector, - [EnumMember(Value = "date_range")] - DateRange, - [EnumMember(Value = "date_nanos")] - DateNanos, - [EnumMember(Value = "date")] - Date, - [EnumMember(Value = "constant_keyword")] - ConstantKeyword, - [EnumMember(Value = "completion")] - Completion, - [EnumMember(Value = "byte")] - Byte, - [EnumMember(Value = "boolean")] - Boolean, - [EnumMember(Value = "binary")] - Binary, - [EnumMember(Value = "alias")] - Alias, - [EnumMember(Value = "aggregate_metric_double")] - AggregateMetricDouble -} + if (reader.TokenType is not System.Text.Json.JsonTokenType.String) + { + throw new System.Text.Json.JsonException($"Unknown member of type '{reader.TokenType}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.Subobjects)}'."); + } -internal sealed class FieldTypeConverter : JsonConverter -{ - public override FieldType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "version": - return FieldType.Version; - case "token_count": - return FieldType.TokenCount; - case "text": - return FieldType.Text; - case "sparse_vector": - return FieldType.SparseVector; - case "short": - return FieldType.Short; - case "shape": - return FieldType.Shape; - case "semantic_text": - return FieldType.SemanticText; - case "search_as_you_type": - return FieldType.SearchAsYouType; - case "scaled_float": - return FieldType.ScaledFloat; - case "rank_features": - return FieldType.RankFeatures; - case "rank_feature": - return FieldType.RankFeature; - case "percolator": - return FieldType.Percolator; - case "object": - return FieldType.Object; - case "none": - return FieldType.None; - case "nested": - return FieldType.Nested; - case "murmur3": - return FieldType.Murmur3; - case "match_only_text": - return FieldType.MatchOnlyText; - case "long_range": - return FieldType.LongRange; - case "long": - return FieldType.Long; - case "keyword": - return FieldType.Keyword; - case "join": - return FieldType.Join; - case "ip_range": - return FieldType.IpRange; - case "ip": - return FieldType.Ip; - case "integer_range": - return FieldType.IntegerRange; - case "integer": - return FieldType.Integer; - case "icu_collation_keyword": - return FieldType.IcuCollationKeyword; - case "histogram": - return FieldType.Histogram; - case "half_float": - return FieldType.HalfFloat; - case "geo_shape": - return FieldType.GeoShape; - case "geo_point": - return FieldType.GeoPoint; - case "float_range": - return FieldType.FloatRange; - case "float": - return FieldType.Float; - case "flattened": - return FieldType.Flattened; - case "double_range": - return FieldType.DoubleRange; - case "double": - return FieldType.Double; - case "dense_vector": - return FieldType.DenseVector; - case "date_range": - return FieldType.DateRange; - case "date_nanos": - return FieldType.DateNanos; - case "date": - return FieldType.Date; - case "constant_keyword": - return FieldType.ConstantKeyword; - case "completion": - return FieldType.Completion; - case "byte": - return FieldType.Byte; - case "boolean": - return FieldType.Boolean; - case "binary": - return FieldType.Binary; - case "alias": - return FieldType.Alias; - case "aggregate_metric_double": - return FieldType.AggregateMetricDouble; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, FieldType value, JsonSerializerOptions options) - { - switch (value) + var value = reader.GetString()!; + if (string.Equals(value, MemberAuto.Value, System.StringComparison.OrdinalIgnoreCase)) { - case FieldType.Version: - writer.WriteStringValue("version"); - return; - case FieldType.TokenCount: - writer.WriteStringValue("token_count"); - return; - case FieldType.Text: - writer.WriteStringValue("text"); - return; - case FieldType.SparseVector: - writer.WriteStringValue("sparse_vector"); - return; - case FieldType.Short: - writer.WriteStringValue("short"); - return; - case FieldType.Shape: - writer.WriteStringValue("shape"); - return; - case FieldType.SemanticText: - writer.WriteStringValue("semantic_text"); - return; - case FieldType.SearchAsYouType: - writer.WriteStringValue("search_as_you_type"); - return; - case FieldType.ScaledFloat: - writer.WriteStringValue("scaled_float"); - return; - case FieldType.RankFeatures: - writer.WriteStringValue("rank_features"); - return; - case FieldType.RankFeature: - writer.WriteStringValue("rank_feature"); - return; - case FieldType.Percolator: - writer.WriteStringValue("percolator"); - return; - case FieldType.Object: - writer.WriteStringValue("object"); - return; - case FieldType.None: - writer.WriteStringValue("none"); - return; - case FieldType.Nested: - writer.WriteStringValue("nested"); - return; - case FieldType.Murmur3: - writer.WriteStringValue("murmur3"); - return; - case FieldType.MatchOnlyText: - writer.WriteStringValue("match_only_text"); - return; - case FieldType.LongRange: - writer.WriteStringValue("long_range"); - return; - case FieldType.Long: - writer.WriteStringValue("long"); - return; - case FieldType.Keyword: - writer.WriteStringValue("keyword"); - return; - case FieldType.Join: - writer.WriteStringValue("join"); - return; - case FieldType.IpRange: - writer.WriteStringValue("ip_range"); - return; - case FieldType.Ip: - writer.WriteStringValue("ip"); - return; - case FieldType.IntegerRange: - writer.WriteStringValue("integer_range"); - return; - case FieldType.Integer: - writer.WriteStringValue("integer"); - return; - case FieldType.IcuCollationKeyword: - writer.WriteStringValue("icu_collation_keyword"); - return; - case FieldType.Histogram: - writer.WriteStringValue("histogram"); - return; - case FieldType.HalfFloat: - writer.WriteStringValue("half_float"); - return; - case FieldType.GeoShape: - writer.WriteStringValue("geo_shape"); - return; - case FieldType.GeoPoint: - writer.WriteStringValue("geo_point"); - return; - case FieldType.FloatRange: - writer.WriteStringValue("float_range"); - return; - case FieldType.Float: - writer.WriteStringValue("float"); - return; - case FieldType.Flattened: - writer.WriteStringValue("flattened"); - return; - case FieldType.DoubleRange: - writer.WriteStringValue("double_range"); - return; - case FieldType.Double: - writer.WriteStringValue("double"); - return; - case FieldType.DenseVector: - writer.WriteStringValue("dense_vector"); - return; - case FieldType.DateRange: - writer.WriteStringValue("date_range"); - return; - case FieldType.DateNanos: - writer.WriteStringValue("date_nanos"); - return; - case FieldType.Date: - writer.WriteStringValue("date"); - return; - case FieldType.ConstantKeyword: - writer.WriteStringValue("constant_keyword"); - return; - case FieldType.Completion: - writer.WriteStringValue("completion"); - return; - case FieldType.Byte: - writer.WriteStringValue("byte"); - return; - case FieldType.Boolean: - writer.WriteStringValue("boolean"); - return; - case FieldType.Binary: - writer.WriteStringValue("binary"); - return; - case FieldType.Alias: - writer.WriteStringValue("alias"); - return; - case FieldType.AggregateMetricDouble: - writer.WriteStringValue("aggregate_metric_double"); - return; - } - - writer.WriteNullValue(); - } -} + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.Auto; + } -[JsonConverter(typeof(GeoOrientationConverter))] -public enum GeoOrientation -{ - [EnumMember(Value = "right")] - Right, - [EnumMember(Value = "left")] - Left -} + if (string.Equals(value, MemberFalse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.False; + } -internal sealed class GeoOrientationConverter : JsonConverter -{ - public override GeoOrientation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberTrue.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "right": - case "RIGHT": - case "counterclockwise": - case "ccw": - return GeoOrientation.Right; - case "left": - case "LEFT": - case "clockwise": - case "cw": - return GeoOrientation.Left; + return Elastic.Clients.Elasticsearch.Mapping.Subobjects.True; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.Subobjects)}'."); } - public override void Write(Utf8JsonWriter writer, GeoOrientation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.Subobjects value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GeoOrientation.Right: - writer.WriteStringValue("right"); - return; - case GeoOrientation.Left: - writer.WriteStringValue("left"); - return; + case Elastic.Clients.Elasticsearch.Mapping.Subobjects.Auto: + writer.WriteStringValue(MemberAuto); + break; + case Elastic.Clients.Elasticsearch.Mapping.Subobjects.False: + writer.WriteRawValue(MemberFalse.EncodedUtf8Bytes); + break; + case Elastic.Clients.Elasticsearch.Mapping.Subobjects.True: + writer.WriteRawValue(MemberTrue.EncodedUtf8Bytes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.Subobjects)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.Subobjects ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(GeoStrategyConverter))] -public enum GeoStrategy -{ - [EnumMember(Value = "term")] - Term, - [EnumMember(Value = "recursive")] - Recursive + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.Subobjects value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GeoStrategyConverter : JsonConverter +internal sealed partial class SourceFieldModeConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoStrategy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDisabled = System.Text.Json.JsonEncodedText.Encode("disabled"); + private static readonly System.Text.Json.JsonEncodedText MemberStored = System.Text.Json.JsonEncodedText.Encode("stored"); + private static readonly System.Text.Json.JsonEncodedText MemberSynthetic = System.Text.Json.JsonEncodedText.Encode("synthetic"); + + public override Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDisabled)) { - case "term": - return GeoStrategy.Term; - case "recursive": - return GeoStrategy.Recursive; + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Disabled; } - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, GeoStrategy value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberStored)) { - case GeoStrategy.Term: - writer.WriteStringValue("term"); - return; - case GeoStrategy.Recursive: - writer.WriteStringValue("recursive"); - return; + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Stored; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberSynthetic)) + { + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Synthetic; + } -[JsonConverter(typeof(IndexOptionsConverter))] -public enum IndexOptions -{ - [EnumMember(Value = "positions")] - Positions, - [EnumMember(Value = "offsets")] - Offsets, - [EnumMember(Value = "freqs")] - Freqs, - [EnumMember(Value = "docs")] - Docs -} + var value = reader.GetString()!; + if (string.Equals(value, MemberDisabled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Disabled; + } -internal sealed class IndexOptionsConverter : JsonConverter -{ - public override IndexOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberStored.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Stored; + } + + if (string.Equals(value, MemberSynthetic.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "positions": - return IndexOptions.Positions; - case "offsets": - return IndexOptions.Offsets; - case "freqs": - return IndexOptions.Freqs; - case "docs": - return IndexOptions.Docs; + return Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Synthetic; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode)}'."); } - public override void Write(Utf8JsonWriter writer, IndexOptions value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndexOptions.Positions: - writer.WriteStringValue("positions"); - return; - case IndexOptions.Offsets: - writer.WriteStringValue("offsets"); - return; - case IndexOptions.Freqs: - writer.WriteStringValue("freqs"); - return; - case IndexOptions.Docs: - writer.WriteStringValue("docs"); - return; + case Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Disabled: + writer.WriteStringValue(MemberDisabled); + break; + case Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Stored: + writer.WriteStringValue(MemberStored); + break; + case Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode.Synthetic: + writer.WriteStringValue(MemberSynthetic); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(MatchTypeConverter))] -public enum MatchType -{ - [EnumMember(Value = "simple")] - Simple, - [EnumMember(Value = "regex")] - Regex + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class MatchTypeConverter : JsonConverter +internal sealed partial class TimeSeriesMetricTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override MatchType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberCounter = System.Text.Json.JsonEncodedText.Encode("counter"); + private static readonly System.Text.Json.JsonEncodedText MemberGauge = System.Text.Json.JsonEncodedText.Encode("gauge"); + private static readonly System.Text.Json.JsonEncodedText MemberHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText MemberPosition = System.Text.Json.JsonEncodedText.Encode("position"); + private static readonly System.Text.Json.JsonEncodedText MemberSummary = System.Text.Json.JsonEncodedText.Encode("summary"); + + public override Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCounter)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Counter; + } + + if (reader.ValueTextEquals(MemberGauge)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Gauge; + } + + if (reader.ValueTextEquals(MemberHistogram)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Histogram; + } + + if (reader.ValueTextEquals(MemberPosition)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Position; + } + + if (reader.ValueTextEquals(MemberSummary)) { - case "simple": - return MatchType.Simple; - case "regex": - return MatchType.Regex; + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Summary; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberCounter.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Counter; + } + + if (string.Equals(value, MemberGauge.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Gauge; + } + + if (string.Equals(value, MemberHistogram.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Histogram; + } + + if (string.Equals(value, MemberPosition.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Position; + } + + if (string.Equals(value, MemberSummary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Summary; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType)}'."); } - public override void Write(Utf8JsonWriter writer, MatchType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case MatchType.Simple: - writer.WriteStringValue("simple"); - return; - case MatchType.Regex: - writer.WriteStringValue("regex"); - return; + case Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Counter: + writer.WriteStringValue(MemberCounter); + break; + case Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Gauge: + writer.WriteStringValue(MemberGauge); + break; + case Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Histogram: + writer.WriteStringValue(MemberHistogram); + break; + case Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Position: + writer.WriteStringValue(MemberPosition); + break; + case Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType.Summary: + writer.WriteStringValue(MemberSummary); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(OnScriptErrorConverter))] -public enum OnScriptError -{ - [EnumMember(Value = "fail")] - Fail, - [EnumMember(Value = "continue")] - Continue + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class OnScriptErrorConverter : JsonConverter +internal sealed partial class MatchTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override OnScriptError Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberRegex = System.Text.Json.JsonEncodedText.Encode("regex"); + private static readonly System.Text.Json.JsonEncodedText MemberSimple = System.Text.Json.JsonEncodedText.Encode("simple"); + + public override Elastic.Clients.Elasticsearch.Mapping.MatchType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberRegex)) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchType.Regex; + } + + if (reader.ValueTextEquals(MemberSimple)) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchType.Simple; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRegex.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchType.Regex; + } + + if (string.Equals(value, MemberSimple.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "fail": - return OnScriptError.Fail; - case "continue": - return OnScriptError.Continue; + return Elastic.Clients.Elasticsearch.Mapping.MatchType.Simple; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.MatchType)}'."); } - public override void Write(Utf8JsonWriter writer, OnScriptError value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.MatchType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case OnScriptError.Fail: - writer.WriteStringValue("fail"); - return; - case OnScriptError.Continue: - writer.WriteStringValue("continue"); - return; + case Elastic.Clients.Elasticsearch.Mapping.MatchType.Regex: + writer.WriteStringValue(MemberRegex); + break; + case Elastic.Clients.Elasticsearch.Mapping.MatchType.Simple: + writer.WriteStringValue(MemberSimple); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.MatchType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.MatchType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(RuntimeFieldTypeConverter))] -public enum RuntimeFieldType -{ - [EnumMember(Value = "lookup")] - Lookup, - [EnumMember(Value = "long")] - Long, - [EnumMember(Value = "keyword")] - Keyword, - [EnumMember(Value = "ip")] - Ip, - [EnumMember(Value = "geo_point")] - GeoPoint, - [EnumMember(Value = "double")] - Double, - [EnumMember(Value = "date")] - Date, - [EnumMember(Value = "composite")] - Composite, - [EnumMember(Value = "boolean")] - Boolean + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.MatchType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class RuntimeFieldTypeConverter : JsonConverter +internal sealed partial class RuntimeFieldTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override RuntimeFieldType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberBoolean = System.Text.Json.JsonEncodedText.Encode("boolean"); + private static readonly System.Text.Json.JsonEncodedText MemberComposite = System.Text.Json.JsonEncodedText.Encode("composite"); + private static readonly System.Text.Json.JsonEncodedText MemberDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText MemberDouble = System.Text.Json.JsonEncodedText.Encode("double"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoPoint = System.Text.Json.JsonEncodedText.Encode("geo_point"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoShape = System.Text.Json.JsonEncodedText.Encode("geo_shape"); + private static readonly System.Text.Json.JsonEncodedText MemberIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText MemberKeyword = System.Text.Json.JsonEncodedText.Encode("keyword"); + private static readonly System.Text.Json.JsonEncodedText MemberLong = System.Text.Json.JsonEncodedText.Encode("long"); + private static readonly System.Text.Json.JsonEncodedText MemberLookup = System.Text.Json.JsonEncodedText.Encode("lookup"); + + public override Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberBoolean)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Boolean; + } + + if (reader.ValueTextEquals(MemberComposite)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Composite; + } + + if (reader.ValueTextEquals(MemberDate)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Date; + } + + if (reader.ValueTextEquals(MemberDouble)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Double; + } + + if (reader.ValueTextEquals(MemberGeoPoint)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoPoint; + } + + if (reader.ValueTextEquals(MemberGeoShape)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoShape; + } + + if (reader.ValueTextEquals(MemberIp)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Ip; + } + + if (reader.ValueTextEquals(MemberKeyword)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Keyword; + } + + if (reader.ValueTextEquals(MemberLong)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Long; + } + + if (reader.ValueTextEquals(MemberLookup)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Lookup; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBoolean.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Boolean; + } + + if (string.Equals(value, MemberComposite.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Composite; + } + + if (string.Equals(value, MemberDate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Date; + } + + if (string.Equals(value, MemberDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Double; + } + + if (string.Equals(value, MemberGeoPoint.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoPoint; + } + + if (string.Equals(value, MemberGeoShape.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoShape; + } + + if (string.Equals(value, MemberIp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Ip; + } + + if (string.Equals(value, MemberKeyword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Keyword; + } + + if (string.Equals(value, MemberLong.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "lookup": - return RuntimeFieldType.Lookup; - case "long": - return RuntimeFieldType.Long; - case "keyword": - return RuntimeFieldType.Keyword; - case "ip": - return RuntimeFieldType.Ip; - case "geo_point": - return RuntimeFieldType.GeoPoint; - case "double": - return RuntimeFieldType.Double; - case "date": - return RuntimeFieldType.Date; - case "composite": - return RuntimeFieldType.Composite; - case "boolean": - return RuntimeFieldType.Boolean; + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Long; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberLookup.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Lookup; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType)}'."); } - public override void Write(Utf8JsonWriter writer, RuntimeFieldType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case RuntimeFieldType.Lookup: - writer.WriteStringValue("lookup"); - return; - case RuntimeFieldType.Long: - writer.WriteStringValue("long"); - return; - case RuntimeFieldType.Keyword: - writer.WriteStringValue("keyword"); - return; - case RuntimeFieldType.Ip: - writer.WriteStringValue("ip"); - return; - case RuntimeFieldType.GeoPoint: - writer.WriteStringValue("geo_point"); - return; - case RuntimeFieldType.Double: - writer.WriteStringValue("double"); - return; - case RuntimeFieldType.Date: - writer.WriteStringValue("date"); - return; - case RuntimeFieldType.Composite: - writer.WriteStringValue("composite"); - return; - case RuntimeFieldType.Boolean: - writer.WriteStringValue("boolean"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Boolean: + writer.WriteStringValue(MemberBoolean); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Composite: + writer.WriteStringValue(MemberComposite); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Date: + writer.WriteStringValue(MemberDate); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Double: + writer.WriteStringValue(MemberDouble); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoPoint: + writer.WriteStringValue(MemberGeoPoint); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.GeoShape: + writer.WriteStringValue(MemberGeoShape); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Ip: + writer.WriteStringValue(MemberIp); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Keyword: + writer.WriteStringValue(MemberKeyword); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Long: + writer.WriteStringValue(MemberLong); + break; + case Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType.Lookup: + writer.WriteStringValue(MemberLookup); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType)}'."); + } } -} -[JsonConverter(typeof(SourceFieldModeConverter))] -public enum SourceFieldMode -{ - /// - /// - /// Instead of storing source documents on disk exactly as you send them, - /// Elasticsearch can reconstruct source content on the fly upon retrieval. - /// - /// - [EnumMember(Value = "synthetic")] - Synthetic, - [EnumMember(Value = "stored")] - Stored, - [EnumMember(Value = "disabled")] - Disabled + public override Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SourceFieldModeConverter : JsonConverter +internal sealed partial class SyntheticSourceKeepEnumConverter : System.Text.Json.Serialization.JsonConverter { - public override SourceFieldMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberArrays = System.Text.Json.JsonEncodedText.Encode("arrays"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + + public override Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.All; + } + + if (reader.ValueTextEquals(MemberArrays)) + { + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.Arrays; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.None; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.All; + } + + if (string.Equals(value, MemberArrays.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "synthetic": - return SourceFieldMode.Synthetic; - case "stored": - return SourceFieldMode.Stored; - case "disabled": - return SourceFieldMode.Disabled; + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.Arrays; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.None; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum)}'."); } - public override void Write(Utf8JsonWriter writer, SourceFieldMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SourceFieldMode.Synthetic: - writer.WriteStringValue("synthetic"); - return; - case SourceFieldMode.Stored: - writer.WriteStringValue("stored"); - return; - case SourceFieldMode.Disabled: - writer.WriteStringValue("disabled"); - return; + case Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.Arrays: + writer.WriteStringValue(MemberArrays); + break; + case Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum.None: + writer.WriteStringValue(MemberNone); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SyntheticSourceKeepEnumConverter))] -public enum SyntheticSourceKeepEnum -{ - /// - /// - /// Synthetic source diverges from the original source (default) - /// - /// - [EnumMember(Value = "none")] - None, - /// - /// - /// Arrays of the corresponding field or object preserve the original element ordering and duplicate elements. - /// The synthetic source fragment for such arrays is not guaranteed to match the original source exactly, - /// e.g. array [1, 2, [5], [[4, [3]]], 5] may appear as-is or in an equivalent format like [1, 2, 5, 4, 3, 5]. - /// The exact format may change in the future, in an effort to reduce the storage overhead of this option. - /// - /// - [EnumMember(Value = "arrays")] - Arrays, - /// - /// - /// The source for both singleton instances and arrays of the corresponding field or object gets recorded. - /// When applied to objects, the source of all sub-objects and sub-fields gets captured. - /// Furthermore, the original source of arrays gets captured and appears in synthetic source with no modifications. - /// - /// - [EnumMember(Value = "all")] - All + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SyntheticSourceKeepEnumConverter : JsonConverter +internal sealed partial class OnScriptErrorConverter : System.Text.Json.Serialization.JsonConverter { - public override SyntheticSourceKeepEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberContinue = System.Text.Json.JsonEncodedText.Encode("continue"); + private static readonly System.Text.Json.JsonEncodedText MemberFail = System.Text.Json.JsonEncodedText.Encode("fail"); + + public override Elastic.Clients.Elasticsearch.Mapping.OnScriptError Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberContinue)) + { + return Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Continue; + } + + if (reader.ValueTextEquals(MemberFail)) { - case "none": - return SyntheticSourceKeepEnum.None; - case "arrays": - return SyntheticSourceKeepEnum.Arrays; - case "all": - return SyntheticSourceKeepEnum.All; + return Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Fail; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberContinue.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Continue; + } + + if (string.Equals(value, MemberFail.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Fail; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.OnScriptError)}'."); } - public override void Write(Utf8JsonWriter writer, SyntheticSourceKeepEnum value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.OnScriptError value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SyntheticSourceKeepEnum.None: - writer.WriteStringValue("none"); - return; - case SyntheticSourceKeepEnum.Arrays: - writer.WriteStringValue("arrays"); - return; - case SyntheticSourceKeepEnum.All: - writer.WriteStringValue("all"); - return; + case Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Continue: + writer.WriteStringValue(MemberContinue); + break; + case Elastic.Clients.Elasticsearch.Mapping.OnScriptError.Fail: + writer.WriteStringValue(MemberFail); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.OnScriptError)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Mapping.OnScriptError ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.OnScriptError value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(TermVectorOptionConverter))] -public enum TermVectorOption +internal sealed partial class IndexOptionsConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "yes")] - Yes, - [EnumMember(Value = "with_positions_payloads")] - WithPositionsPayloads, - [EnumMember(Value = "with_positions_offsets_payloads")] - WithPositionsOffsetsPayloads, - [EnumMember(Value = "with_positions_offsets")] - WithPositionsOffsets, - [EnumMember(Value = "with_positions")] - WithPositions, - [EnumMember(Value = "with_offsets")] - WithOffsets, - [EnumMember(Value = "no")] - No -} + private static readonly System.Text.Json.JsonEncodedText MemberDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText MemberFreqs = System.Text.Json.JsonEncodedText.Encode("freqs"); + private static readonly System.Text.Json.JsonEncodedText MemberOffsets = System.Text.Json.JsonEncodedText.Encode("offsets"); + private static readonly System.Text.Json.JsonEncodedText MemberPositions = System.Text.Json.JsonEncodedText.Encode("positions"); -internal sealed class TermVectorOptionConverter : JsonConverter -{ - public override TermVectorOption Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Mapping.IndexOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDocs)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Docs; + } + + if (reader.ValueTextEquals(MemberFreqs)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Freqs; + } + + if (reader.ValueTextEquals(MemberOffsets)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Offsets; + } + + if (reader.ValueTextEquals(MemberPositions)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Positions; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDocs.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Docs; + } + + if (string.Equals(value, MemberFreqs.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Freqs; + } + + if (string.Equals(value, MemberOffsets.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Offsets; + } + + if (string.Equals(value, MemberPositions.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "yes": - return TermVectorOption.Yes; - case "with_positions_payloads": - return TermVectorOption.WithPositionsPayloads; - case "with_positions_offsets_payloads": - return TermVectorOption.WithPositionsOffsetsPayloads; - case "with_positions_offsets": - return TermVectorOption.WithPositionsOffsets; - case "with_positions": - return TermVectorOption.WithPositions; - case "with_offsets": - return TermVectorOption.WithOffsets; - case "no": - return TermVectorOption.No; + return Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Positions; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.IndexOptions)}'."); } - public override void Write(Utf8JsonWriter writer, TermVectorOption value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IndexOptions value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case TermVectorOption.Yes: - writer.WriteStringValue("yes"); - return; - case TermVectorOption.WithPositionsPayloads: - writer.WriteStringValue("with_positions_payloads"); - return; - case TermVectorOption.WithPositionsOffsetsPayloads: - writer.WriteStringValue("with_positions_offsets_payloads"); - return; - case TermVectorOption.WithPositionsOffsets: - writer.WriteStringValue("with_positions_offsets"); - return; - case TermVectorOption.WithPositions: - writer.WriteStringValue("with_positions"); - return; - case TermVectorOption.WithOffsets: - writer.WriteStringValue("with_offsets"); - return; - case TermVectorOption.No: - writer.WriteStringValue("no"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Docs: + writer.WriteStringValue(MemberDocs); + break; + case Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Freqs: + writer.WriteStringValue(MemberFreqs); + break; + case Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Offsets: + writer.WriteStringValue(MemberOffsets); + break; + case Elastic.Clients.Elasticsearch.Mapping.IndexOptions.Positions: + writer.WriteStringValue(MemberPositions); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.IndexOptions)}'."); + } } -} -[JsonConverter(typeof(TimeSeriesMetricTypeConverter))] -public enum TimeSeriesMetricType -{ - [EnumMember(Value = "summary")] - Summary, - [EnumMember(Value = "position")] - Position, - [EnumMember(Value = "histogram")] - Histogram, - [EnumMember(Value = "gauge")] - Gauge, - [EnumMember(Value = "counter")] - Counter + public override Elastic.Clients.Elasticsearch.Mapping.IndexOptions ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IndexOptions value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class TimeSeriesMetricTypeConverter : JsonConverter +internal sealed partial class TermVectorOptionConverter : System.Text.Json.Serialization.JsonConverter { - public override TimeSeriesMetricType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("no"); + private static readonly System.Text.Json.JsonEncodedText MemberWithOffsets = System.Text.Json.JsonEncodedText.Encode("with_offsets"); + private static readonly System.Text.Json.JsonEncodedText MemberWithPositions = System.Text.Json.JsonEncodedText.Encode("with_positions"); + private static readonly System.Text.Json.JsonEncodedText MemberWithPositionsOffsets = System.Text.Json.JsonEncodedText.Encode("with_positions_offsets"); + private static readonly System.Text.Json.JsonEncodedText MemberWithPositionsOffsetsPayloads = System.Text.Json.JsonEncodedText.Encode("with_positions_offsets_payloads"); + private static readonly System.Text.Json.JsonEncodedText MemberWithPositionsPayloads = System.Text.Json.JsonEncodedText.Encode("with_positions_payloads"); + private static readonly System.Text.Json.JsonEncodedText MemberYes = System.Text.Json.JsonEncodedText.Encode("yes"); + + public override Elastic.Clients.Elasticsearch.Mapping.TermVectorOption Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberNo)) { - case "summary": - return TimeSeriesMetricType.Summary; - case "position": - return TimeSeriesMetricType.Position; - case "histogram": - return TimeSeriesMetricType.Histogram; - case "gauge": - return TimeSeriesMetricType.Gauge; - case "counter": - return TimeSeriesMetricType.Counter; + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.No; } - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TimeSeriesMetricType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberWithOffsets)) { - case TimeSeriesMetricType.Summary: - writer.WriteStringValue("summary"); - return; - case TimeSeriesMetricType.Position: - writer.WriteStringValue("position"); - return; - case TimeSeriesMetricType.Histogram: - writer.WriteStringValue("histogram"); - return; - case TimeSeriesMetricType.Gauge: - writer.WriteStringValue("gauge"); - return; - case TimeSeriesMetricType.Counter: - writer.WriteStringValue("counter"); - return; - } - - writer.WriteNullValue(); + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithOffsets; + } + + if (reader.ValueTextEquals(MemberWithPositions)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositions; + } + + if (reader.ValueTextEquals(MemberWithPositionsOffsets)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsets; + } + + if (reader.ValueTextEquals(MemberWithPositionsOffsetsPayloads)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsetsPayloads; + } + + if (reader.ValueTextEquals(MemberWithPositionsPayloads)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsPayloads; + } + + if (reader.ValueTextEquals(MemberYes)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.Yes; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.No; + } + + if (string.Equals(value, MemberWithOffsets.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithOffsets; + } + + if (string.Equals(value, MemberWithPositions.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositions; + } + + if (string.Equals(value, MemberWithPositionsOffsets.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsets; + } + + if (string.Equals(value, MemberWithPositionsOffsetsPayloads.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsetsPayloads; + } + + if (string.Equals(value, MemberWithPositionsPayloads.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsPayloads; + } + + if (string.Equals(value, MemberYes.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.Yes; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TermVectorOption value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.No: + writer.WriteStringValue(MemberNo); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithOffsets: + writer.WriteStringValue(MemberWithOffsets); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositions: + writer.WriteStringValue(MemberWithPositions); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsets: + writer.WriteStringValue(MemberWithPositionsOffsets); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsOffsetsPayloads: + writer.WriteStringValue(MemberWithPositionsOffsetsPayloads); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.WithPositionsPayloads: + writer.WriteStringValue(MemberWithPositionsPayloads); + break; + case Elastic.Clients.Elasticsearch.Mapping.TermVectorOption.Yes: + writer.WriteStringValue(MemberYes); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.TermVectorOption ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TermVectorOption value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DenseVectorElementTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBit = System.Text.Json.JsonEncodedText.Encode("bit"); + private static readonly System.Text.Json.JsonEncodedText MemberByte = System.Text.Json.JsonEncodedText.Encode("byte"); + private static readonly System.Text.Json.JsonEncodedText MemberFloat = System.Text.Json.JsonEncodedText.Encode("float"); + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBit)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Bit; + } + + if (reader.ValueTextEquals(MemberByte)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Byte; + } + + if (reader.ValueTextEquals(MemberFloat)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Float; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBit.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Bit; + } + + if (string.Equals(value, MemberByte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Byte; + } + + if (string.Equals(value, MemberFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Float; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Bit: + writer.WriteStringValue(MemberBit); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Byte: + writer.WriteStringValue(MemberByte); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType.Float: + writer.WriteStringValue(MemberFloat); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DenseVectorSimilarityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCosine = System.Text.Json.JsonEncodedText.Encode("cosine"); + private static readonly System.Text.Json.JsonEncodedText MemberDotProduct = System.Text.Json.JsonEncodedText.Encode("dot_product"); + private static readonly System.Text.Json.JsonEncodedText MemberL2Norm = System.Text.Json.JsonEncodedText.Encode("l2_norm"); + private static readonly System.Text.Json.JsonEncodedText MemberMaxInnerProduct = System.Text.Json.JsonEncodedText.Encode("max_inner_product"); + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCosine)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.Cosine; + } + + if (reader.ValueTextEquals(MemberDotProduct)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.DotProduct; + } + + if (reader.ValueTextEquals(MemberL2Norm)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.L2Norm; + } + + if (reader.ValueTextEquals(MemberMaxInnerProduct)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.MaxInnerProduct; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCosine.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.Cosine; + } + + if (string.Equals(value, MemberDotProduct.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.DotProduct; + } + + if (string.Equals(value, MemberL2Norm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.L2Norm; + } + + if (string.Equals(value, MemberMaxInnerProduct.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.MaxInnerProduct; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.Cosine: + writer.WriteStringValue(MemberCosine); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.DotProduct: + writer.WriteStringValue(MemberDotProduct); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.L2Norm: + writer.WriteStringValue(MemberL2Norm); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity.MaxInnerProduct: + writer.WriteStringValue(MemberMaxInnerProduct); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +internal sealed partial class GeoOrientationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberLeft = System.Text.Json.JsonEncodedText.Encode("left"); + private static readonly System.Text.Json.JsonEncodedText MemberLeft1 = System.Text.Json.JsonEncodedText.Encode("LEFT"); + private static readonly System.Text.Json.JsonEncodedText MemberLeft2 = System.Text.Json.JsonEncodedText.Encode("clockwise"); + private static readonly System.Text.Json.JsonEncodedText MemberLeft3 = System.Text.Json.JsonEncodedText.Encode("cw"); + private static readonly System.Text.Json.JsonEncodedText MemberRight = System.Text.Json.JsonEncodedText.Encode("right"); + private static readonly System.Text.Json.JsonEncodedText MemberRight1 = System.Text.Json.JsonEncodedText.Encode("RIGHT"); + private static readonly System.Text.Json.JsonEncodedText MemberRight2 = System.Text.Json.JsonEncodedText.Encode("counterclockwise"); + private static readonly System.Text.Json.JsonEncodedText MemberRight3 = System.Text.Json.JsonEncodedText.Encode("ccw"); + + public override Elastic.Clients.Elasticsearch.Mapping.GeoOrientation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberLeft) || reader.ValueTextEquals(MemberLeft1) || reader.ValueTextEquals(MemberLeft2) || reader.ValueTextEquals(MemberLeft3)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Left; + } + + if (reader.ValueTextEquals(MemberRight) || reader.ValueTextEquals(MemberRight1) || reader.ValueTextEquals(MemberRight2) || reader.ValueTextEquals(MemberRight3)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Right; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberLeft.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberLeft1.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberLeft2.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberLeft3.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Left; + } + + if (string.Equals(value, MemberRight.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberRight1.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberRight2.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberRight3.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Right; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoOrientation value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Left: + writer.WriteStringValue(MemberLeft); + break; + case Elastic.Clients.Elasticsearch.Mapping.GeoOrientation.Right: + writer.WriteStringValue(MemberRight); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.GeoOrientation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoOrientation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GeoStrategyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberRecursive = System.Text.Json.JsonEncodedText.Encode("recursive"); + private static readonly System.Text.Json.JsonEncodedText MemberTerm = System.Text.Json.JsonEncodedText.Encode("term"); + + public override Elastic.Clients.Elasticsearch.Mapping.GeoStrategy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberRecursive)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Recursive; + } + + if (reader.ValueTextEquals(MemberTerm)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Term; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRecursive.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Recursive; + } + + if (string.Equals(value, MemberTerm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Term; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoStrategy value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Recursive: + writer.WriteStringValue(MemberRecursive); + break; + case Elastic.Clients.Elasticsearch.Mapping.GeoStrategy.Term: + writer.WriteStringValue(MemberTerm); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.GeoStrategy ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoStrategy value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class FieldTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAggregateMetricDouble = System.Text.Json.JsonEncodedText.Encode("aggregate_metric_double"); + private static readonly System.Text.Json.JsonEncodedText MemberAlias = System.Text.Json.JsonEncodedText.Encode("alias"); + private static readonly System.Text.Json.JsonEncodedText MemberBinary = System.Text.Json.JsonEncodedText.Encode("binary"); + private static readonly System.Text.Json.JsonEncodedText MemberBoolean = System.Text.Json.JsonEncodedText.Encode("boolean"); + private static readonly System.Text.Json.JsonEncodedText MemberByte = System.Text.Json.JsonEncodedText.Encode("byte"); + private static readonly System.Text.Json.JsonEncodedText MemberCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText MemberConstantKeyword = System.Text.Json.JsonEncodedText.Encode("constant_keyword"); + private static readonly System.Text.Json.JsonEncodedText MemberCountedKeyword = System.Text.Json.JsonEncodedText.Encode("counted_keyword"); + private static readonly System.Text.Json.JsonEncodedText MemberDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText MemberDateNanos = System.Text.Json.JsonEncodedText.Encode("date_nanos"); + private static readonly System.Text.Json.JsonEncodedText MemberDateRange = System.Text.Json.JsonEncodedText.Encode("date_range"); + private static readonly System.Text.Json.JsonEncodedText MemberDenseVector = System.Text.Json.JsonEncodedText.Encode("dense_vector"); + private static readonly System.Text.Json.JsonEncodedText MemberDouble = System.Text.Json.JsonEncodedText.Encode("double"); + private static readonly System.Text.Json.JsonEncodedText MemberDoubleRange = System.Text.Json.JsonEncodedText.Encode("double_range"); + private static readonly System.Text.Json.JsonEncodedText MemberFlattened = System.Text.Json.JsonEncodedText.Encode("flattened"); + private static readonly System.Text.Json.JsonEncodedText MemberFloat = System.Text.Json.JsonEncodedText.Encode("float"); + private static readonly System.Text.Json.JsonEncodedText MemberFloatRange = System.Text.Json.JsonEncodedText.Encode("float_range"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoPoint = System.Text.Json.JsonEncodedText.Encode("geo_point"); + private static readonly System.Text.Json.JsonEncodedText MemberGeoShape = System.Text.Json.JsonEncodedText.Encode("geo_shape"); + private static readonly System.Text.Json.JsonEncodedText MemberHalfFloat = System.Text.Json.JsonEncodedText.Encode("half_float"); + private static readonly System.Text.Json.JsonEncodedText MemberHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText MemberIcuCollationKeyword = System.Text.Json.JsonEncodedText.Encode("icu_collation_keyword"); + private static readonly System.Text.Json.JsonEncodedText MemberInteger = System.Text.Json.JsonEncodedText.Encode("integer"); + private static readonly System.Text.Json.JsonEncodedText MemberIntegerRange = System.Text.Json.JsonEncodedText.Encode("integer_range"); + private static readonly System.Text.Json.JsonEncodedText MemberIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText MemberIpRange = System.Text.Json.JsonEncodedText.Encode("ip_range"); + private static readonly System.Text.Json.JsonEncodedText MemberJoin = System.Text.Json.JsonEncodedText.Encode("join"); + private static readonly System.Text.Json.JsonEncodedText MemberKeyword = System.Text.Json.JsonEncodedText.Encode("keyword"); + private static readonly System.Text.Json.JsonEncodedText MemberLong = System.Text.Json.JsonEncodedText.Encode("long"); + private static readonly System.Text.Json.JsonEncodedText MemberLongRange = System.Text.Json.JsonEncodedText.Encode("long_range"); + private static readonly System.Text.Json.JsonEncodedText MemberMatchOnlyText = System.Text.Json.JsonEncodedText.Encode("match_only_text"); + private static readonly System.Text.Json.JsonEncodedText MemberMurmur3 = System.Text.Json.JsonEncodedText.Encode("murmur3"); + private static readonly System.Text.Json.JsonEncodedText MemberNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberObject = System.Text.Json.JsonEncodedText.Encode("object"); + private static readonly System.Text.Json.JsonEncodedText MemberPassthrough = System.Text.Json.JsonEncodedText.Encode("passthrough"); + private static readonly System.Text.Json.JsonEncodedText MemberPercolator = System.Text.Json.JsonEncodedText.Encode("percolator"); + private static readonly System.Text.Json.JsonEncodedText MemberRankFeature = System.Text.Json.JsonEncodedText.Encode("rank_feature"); + private static readonly System.Text.Json.JsonEncodedText MemberRankFeatures = System.Text.Json.JsonEncodedText.Encode("rank_features"); + private static readonly System.Text.Json.JsonEncodedText MemberScaledFloat = System.Text.Json.JsonEncodedText.Encode("scaled_float"); + private static readonly System.Text.Json.JsonEncodedText MemberSearchAsYouType = System.Text.Json.JsonEncodedText.Encode("search_as_you_type"); + private static readonly System.Text.Json.JsonEncodedText MemberSemanticText = System.Text.Json.JsonEncodedText.Encode("semantic_text"); + private static readonly System.Text.Json.JsonEncodedText MemberShape = System.Text.Json.JsonEncodedText.Encode("shape"); + private static readonly System.Text.Json.JsonEncodedText MemberShort = System.Text.Json.JsonEncodedText.Encode("short"); + private static readonly System.Text.Json.JsonEncodedText MemberSparseVector = System.Text.Json.JsonEncodedText.Encode("sparse_vector"); + private static readonly System.Text.Json.JsonEncodedText MemberText = System.Text.Json.JsonEncodedText.Encode("text"); + private static readonly System.Text.Json.JsonEncodedText MemberTokenCount = System.Text.Json.JsonEncodedText.Encode("token_count"); + private static readonly System.Text.Json.JsonEncodedText MemberVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Mapping.FieldType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAggregateMetricDouble)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.AggregateMetricDouble; + } + + if (reader.ValueTextEquals(MemberAlias)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Alias; + } + + if (reader.ValueTextEquals(MemberBinary)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Binary; + } + + if (reader.ValueTextEquals(MemberBoolean)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Boolean; + } + + if (reader.ValueTextEquals(MemberByte)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Byte; + } + + if (reader.ValueTextEquals(MemberCompletion)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Completion; + } + + if (reader.ValueTextEquals(MemberConstantKeyword)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.ConstantKeyword; + } + + if (reader.ValueTextEquals(MemberCountedKeyword)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.CountedKeyword; + } + + if (reader.ValueTextEquals(MemberDate)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Date; + } + + if (reader.ValueTextEquals(MemberDateNanos)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DateNanos; + } + + if (reader.ValueTextEquals(MemberDateRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DateRange; + } + + if (reader.ValueTextEquals(MemberDenseVector)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DenseVector; + } + + if (reader.ValueTextEquals(MemberDouble)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Double; + } + + if (reader.ValueTextEquals(MemberDoubleRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DoubleRange; + } + + if (reader.ValueTextEquals(MemberFlattened)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Flattened; + } + + if (reader.ValueTextEquals(MemberFloat)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Float; + } + + if (reader.ValueTextEquals(MemberFloatRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.FloatRange; + } + + if (reader.ValueTextEquals(MemberGeoPoint)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoPoint; + } + + if (reader.ValueTextEquals(MemberGeoShape)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoShape; + } + + if (reader.ValueTextEquals(MemberHalfFloat)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.HalfFloat; + } + + if (reader.ValueTextEquals(MemberHistogram)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Histogram; + } + + if (reader.ValueTextEquals(MemberIcuCollationKeyword)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IcuCollationKeyword; + } + + if (reader.ValueTextEquals(MemberInteger)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Integer; + } + + if (reader.ValueTextEquals(MemberIntegerRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IntegerRange; + } + + if (reader.ValueTextEquals(MemberIp)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Ip; + } + + if (reader.ValueTextEquals(MemberIpRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IpRange; + } + + if (reader.ValueTextEquals(MemberJoin)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Join; + } + + if (reader.ValueTextEquals(MemberKeyword)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Keyword; + } + + if (reader.ValueTextEquals(MemberLong)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Long; + } + + if (reader.ValueTextEquals(MemberLongRange)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.LongRange; + } + + if (reader.ValueTextEquals(MemberMatchOnlyText)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.MatchOnlyText; + } + + if (reader.ValueTextEquals(MemberMurmur3)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Murmur3; + } + + if (reader.ValueTextEquals(MemberNested)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Nested; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.None; + } + + if (reader.ValueTextEquals(MemberObject)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Object; + } + + if (reader.ValueTextEquals(MemberPassthrough)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Passthrough; + } + + if (reader.ValueTextEquals(MemberPercolator)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Percolator; + } + + if (reader.ValueTextEquals(MemberRankFeature)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeature; + } + + if (reader.ValueTextEquals(MemberRankFeatures)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeatures; + } + + if (reader.ValueTextEquals(MemberScaledFloat)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.ScaledFloat; + } + + if (reader.ValueTextEquals(MemberSearchAsYouType)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SearchAsYouType; + } + + if (reader.ValueTextEquals(MemberSemanticText)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SemanticText; + } + + if (reader.ValueTextEquals(MemberShape)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Shape; + } + + if (reader.ValueTextEquals(MemberShort)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Short; + } + + if (reader.ValueTextEquals(MemberSparseVector)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SparseVector; + } + + if (reader.ValueTextEquals(MemberText)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Text; + } + + if (reader.ValueTextEquals(MemberTokenCount)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.TokenCount; + } + + if (reader.ValueTextEquals(MemberVersion)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Version; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAggregateMetricDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.AggregateMetricDouble; + } + + if (string.Equals(value, MemberAlias.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Alias; + } + + if (string.Equals(value, MemberBinary.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Binary; + } + + if (string.Equals(value, MemberBoolean.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Boolean; + } + + if (string.Equals(value, MemberByte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Byte; + } + + if (string.Equals(value, MemberCompletion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Completion; + } + + if (string.Equals(value, MemberConstantKeyword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.ConstantKeyword; + } + + if (string.Equals(value, MemberCountedKeyword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.CountedKeyword; + } + + if (string.Equals(value, MemberDate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Date; + } + + if (string.Equals(value, MemberDateNanos.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DateNanos; + } + + if (string.Equals(value, MemberDateRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DateRange; + } + + if (string.Equals(value, MemberDenseVector.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DenseVector; + } + + if (string.Equals(value, MemberDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Double; + } + + if (string.Equals(value, MemberDoubleRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.DoubleRange; + } + + if (string.Equals(value, MemberFlattened.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Flattened; + } + + if (string.Equals(value, MemberFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Float; + } + + if (string.Equals(value, MemberFloatRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.FloatRange; + } + + if (string.Equals(value, MemberGeoPoint.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoPoint; + } + + if (string.Equals(value, MemberGeoShape.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoShape; + } + + if (string.Equals(value, MemberHalfFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.HalfFloat; + } + + if (string.Equals(value, MemberHistogram.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Histogram; + } + + if (string.Equals(value, MemberIcuCollationKeyword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IcuCollationKeyword; + } + + if (string.Equals(value, MemberInteger.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Integer; + } + + if (string.Equals(value, MemberIntegerRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IntegerRange; + } + + if (string.Equals(value, MemberIp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Ip; + } + + if (string.Equals(value, MemberIpRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.IpRange; + } + + if (string.Equals(value, MemberJoin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Join; + } + + if (string.Equals(value, MemberKeyword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Keyword; + } + + if (string.Equals(value, MemberLong.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Long; + } + + if (string.Equals(value, MemberLongRange.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.LongRange; + } + + if (string.Equals(value, MemberMatchOnlyText.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.MatchOnlyText; + } + + if (string.Equals(value, MemberMurmur3.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Murmur3; + } + + if (string.Equals(value, MemberNested.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Nested; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.None; + } + + if (string.Equals(value, MemberObject.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Object; + } + + if (string.Equals(value, MemberPassthrough.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Passthrough; + } + + if (string.Equals(value, MemberPercolator.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Percolator; + } + + if (string.Equals(value, MemberRankFeature.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeature; + } + + if (string.Equals(value, MemberRankFeatures.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeatures; + } + + if (string.Equals(value, MemberScaledFloat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.ScaledFloat; + } + + if (string.Equals(value, MemberSearchAsYouType.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SearchAsYouType; + } + + if (string.Equals(value, MemberSemanticText.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SemanticText; + } + + if (string.Equals(value, MemberShape.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Shape; + } + + if (string.Equals(value, MemberShort.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Short; + } + + if (string.Equals(value, MemberSparseVector.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.SparseVector; + } + + if (string.Equals(value, MemberText.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Text; + } + + if (string.Equals(value, MemberTokenCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.TokenCount; + } + + if (string.Equals(value, MemberVersion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldType.Version; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.FieldType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FieldType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.FieldType.AggregateMetricDouble: + writer.WriteStringValue(MemberAggregateMetricDouble); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Alias: + writer.WriteStringValue(MemberAlias); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Binary: + writer.WriteStringValue(MemberBinary); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Boolean: + writer.WriteStringValue(MemberBoolean); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Byte: + writer.WriteStringValue(MemberByte); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Completion: + writer.WriteStringValue(MemberCompletion); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.ConstantKeyword: + writer.WriteStringValue(MemberConstantKeyword); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.CountedKeyword: + writer.WriteStringValue(MemberCountedKeyword); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Date: + writer.WriteStringValue(MemberDate); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.DateNanos: + writer.WriteStringValue(MemberDateNanos); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.DateRange: + writer.WriteStringValue(MemberDateRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.DenseVector: + writer.WriteStringValue(MemberDenseVector); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Double: + writer.WriteStringValue(MemberDouble); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.DoubleRange: + writer.WriteStringValue(MemberDoubleRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Flattened: + writer.WriteStringValue(MemberFlattened); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Float: + writer.WriteStringValue(MemberFloat); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.FloatRange: + writer.WriteStringValue(MemberFloatRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoPoint: + writer.WriteStringValue(MemberGeoPoint); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.GeoShape: + writer.WriteStringValue(MemberGeoShape); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.HalfFloat: + writer.WriteStringValue(MemberHalfFloat); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Histogram: + writer.WriteStringValue(MemberHistogram); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.IcuCollationKeyword: + writer.WriteStringValue(MemberIcuCollationKeyword); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Integer: + writer.WriteStringValue(MemberInteger); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.IntegerRange: + writer.WriteStringValue(MemberIntegerRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Ip: + writer.WriteStringValue(MemberIp); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.IpRange: + writer.WriteStringValue(MemberIpRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Join: + writer.WriteStringValue(MemberJoin); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Keyword: + writer.WriteStringValue(MemberKeyword); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Long: + writer.WriteStringValue(MemberLong); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.LongRange: + writer.WriteStringValue(MemberLongRange); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.MatchOnlyText: + writer.WriteStringValue(MemberMatchOnlyText); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Murmur3: + writer.WriteStringValue(MemberMurmur3); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Nested: + writer.WriteStringValue(MemberNested); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Object: + writer.WriteStringValue(MemberObject); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Passthrough: + writer.WriteStringValue(MemberPassthrough); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Percolator: + writer.WriteStringValue(MemberPercolator); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeature: + writer.WriteStringValue(MemberRankFeature); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.RankFeatures: + writer.WriteStringValue(MemberRankFeatures); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.ScaledFloat: + writer.WriteStringValue(MemberScaledFloat); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.SearchAsYouType: + writer.WriteStringValue(MemberSearchAsYouType); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.SemanticText: + writer.WriteStringValue(MemberSemanticText); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Shape: + writer.WriteStringValue(MemberShape); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Short: + writer.WriteStringValue(MemberShort); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.SparseVector: + writer.WriteStringValue(MemberSparseVector); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Text: + writer.WriteStringValue(MemberText); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.TokenCount: + writer.WriteStringValue(MemberTokenCount); + break; + case Elastic.Clients.Elasticsearch.Mapping.FieldType.Version: + writer.WriteStringValue(MemberVersion); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.FieldType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.FieldType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FieldType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DenseVectorIndexOptionsTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBbqFlat = System.Text.Json.JsonEncodedText.Encode("bbq_flat"); + private static readonly System.Text.Json.JsonEncodedText MemberBbqHnsw = System.Text.Json.JsonEncodedText.Encode("bbq_hnsw"); + private static readonly System.Text.Json.JsonEncodedText MemberFlat = System.Text.Json.JsonEncodedText.Encode("flat"); + private static readonly System.Text.Json.JsonEncodedText MemberHnsw = System.Text.Json.JsonEncodedText.Encode("hnsw"); + private static readonly System.Text.Json.JsonEncodedText MemberInt4Flat = System.Text.Json.JsonEncodedText.Encode("int4_flat"); + private static readonly System.Text.Json.JsonEncodedText MemberInt4Hnsw = System.Text.Json.JsonEncodedText.Encode("int4_hnsw"); + private static readonly System.Text.Json.JsonEncodedText MemberInt8Flat = System.Text.Json.JsonEncodedText.Encode("int8_flat"); + private static readonly System.Text.Json.JsonEncodedText MemberInt8Hnsw = System.Text.Json.JsonEncodedText.Encode("int8_hnsw"); + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBbqFlat)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqFlat; + } + + if (reader.ValueTextEquals(MemberBbqHnsw)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqHnsw; + } + + if (reader.ValueTextEquals(MemberFlat)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Flat; + } + + if (reader.ValueTextEquals(MemberHnsw)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Hnsw; + } + + if (reader.ValueTextEquals(MemberInt4Flat)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Flat; + } + + if (reader.ValueTextEquals(MemberInt4Hnsw)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Hnsw; + } + + if (reader.ValueTextEquals(MemberInt8Flat)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Flat; + } + + if (reader.ValueTextEquals(MemberInt8Hnsw)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Hnsw; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBbqFlat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqFlat; + } + + if (string.Equals(value, MemberBbqHnsw.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqHnsw; + } + + if (string.Equals(value, MemberFlat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Flat; + } + + if (string.Equals(value, MemberHnsw.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Hnsw; + } + + if (string.Equals(value, MemberInt4Flat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Flat; + } + + if (string.Equals(value, MemberInt4Hnsw.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Hnsw; + } + + if (string.Equals(value, MemberInt8Flat.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Flat; + } + + if (string.Equals(value, MemberInt8Hnsw.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Hnsw; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqFlat: + writer.WriteStringValue(MemberBbqFlat); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.BbqHnsw: + writer.WriteStringValue(MemberBbqHnsw); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Flat: + writer.WriteStringValue(MemberFlat); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Hnsw: + writer.WriteStringValue(MemberHnsw); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Flat: + writer.WriteStringValue(MemberInt4Flat); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int4Hnsw: + writer.WriteStringValue(MemberInt4Hnsw); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Flat: + writer.WriteStringValue(MemberInt8Flat); + break; + case Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType.Int8Hnsw: + writer.WriteStringValue(MemberInt8Hnsw); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DynamicMappingConverter))] +public enum DynamicMapping +{ + [System.Runtime.Serialization.EnumMember(Value = "false")] + False, + [System.Runtime.Serialization.EnumMember(Value = "runtime")] + Runtime, + [System.Runtime.Serialization.EnumMember(Value = "strict")] + Strict, + [System.Runtime.Serialization.EnumMember(Value = "true")] + True +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SubobjectsConverter))] +public enum Subobjects +{ + [System.Runtime.Serialization.EnumMember(Value = "auto")] + Auto, + [System.Runtime.Serialization.EnumMember(Value = "false")] + False, + [System.Runtime.Serialization.EnumMember(Value = "true")] + True +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SourceFieldModeConverter))] +public enum SourceFieldMode +{ + [System.Runtime.Serialization.EnumMember(Value = "disabled")] + Disabled, + [System.Runtime.Serialization.EnumMember(Value = "stored")] + Stored, + /// + /// + /// Instead of storing source documents on disk exactly as you send them, + /// Elasticsearch can reconstruct source content on the fly upon retrieval. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "synthetic")] + Synthetic +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricTypeConverter))] +public enum TimeSeriesMetricType +{ + [System.Runtime.Serialization.EnumMember(Value = "counter")] + Counter, + [System.Runtime.Serialization.EnumMember(Value = "gauge")] + Gauge, + [System.Runtime.Serialization.EnumMember(Value = "histogram")] + Histogram, + [System.Runtime.Serialization.EnumMember(Value = "position")] + Position, + [System.Runtime.Serialization.EnumMember(Value = "summary")] + Summary +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.MatchTypeConverter))] +public enum MatchType +{ + [System.Runtime.Serialization.EnumMember(Value = "regex")] + Regex, + [System.Runtime.Serialization.EnumMember(Value = "simple")] + Simple +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldTypeConverter))] +public enum RuntimeFieldType +{ + [System.Runtime.Serialization.EnumMember(Value = "boolean")] + Boolean, + [System.Runtime.Serialization.EnumMember(Value = "composite")] + Composite, + [System.Runtime.Serialization.EnumMember(Value = "date")] + Date, + [System.Runtime.Serialization.EnumMember(Value = "double")] + Double, + [System.Runtime.Serialization.EnumMember(Value = "geo_point")] + GeoPoint, + [System.Runtime.Serialization.EnumMember(Value = "geo_shape")] + GeoShape, + [System.Runtime.Serialization.EnumMember(Value = "ip")] + Ip, + [System.Runtime.Serialization.EnumMember(Value = "keyword")] + Keyword, + [System.Runtime.Serialization.EnumMember(Value = "long")] + Long, + [System.Runtime.Serialization.EnumMember(Value = "lookup")] + Lookup +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnumConverter))] +public enum SyntheticSourceKeepEnum +{ + /// + /// + /// The source for both singleton instances and arrays of the corresponding field or object gets recorded. + /// When applied to objects, the source of all sub-objects and sub-fields gets captured. + /// Furthermore, the original source of arrays gets captured and appears in synthetic source with no modifications. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + /// + /// + /// Arrays of the corresponding field or object preserve the original element ordering and duplicate elements. + /// The synthetic source fragment for such arrays is not guaranteed to match the original source exactly, + /// e.g. array [1, 2, [5], [[4, [3]]], 5] may appear as-is or in an equivalent format like [1, 2, 5, 4, 3, 5]. + /// The exact format may change in the future, in an effort to reduce the storage overhead of this option. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "arrays")] + Arrays, + /// + /// + /// Synthetic source diverges from the original source (default) + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "none")] + None +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.OnScriptErrorConverter))] +public enum OnScriptError +{ + [System.Runtime.Serialization.EnumMember(Value = "continue")] + Continue, + [System.Runtime.Serialization.EnumMember(Value = "fail")] + Fail +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IndexOptionsConverter))] +public enum IndexOptions +{ + [System.Runtime.Serialization.EnumMember(Value = "docs")] + Docs, + [System.Runtime.Serialization.EnumMember(Value = "freqs")] + Freqs, + [System.Runtime.Serialization.EnumMember(Value = "offsets")] + Offsets, + [System.Runtime.Serialization.EnumMember(Value = "positions")] + Positions +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TermVectorOptionConverter))] +public enum TermVectorOption +{ + [System.Runtime.Serialization.EnumMember(Value = "no")] + No, + [System.Runtime.Serialization.EnumMember(Value = "with_offsets")] + WithOffsets, + [System.Runtime.Serialization.EnumMember(Value = "with_positions")] + WithPositions, + [System.Runtime.Serialization.EnumMember(Value = "with_positions_offsets")] + WithPositionsOffsets, + [System.Runtime.Serialization.EnumMember(Value = "with_positions_offsets_payloads")] + WithPositionsOffsetsPayloads, + [System.Runtime.Serialization.EnumMember(Value = "with_positions_payloads")] + WithPositionsPayloads, + [System.Runtime.Serialization.EnumMember(Value = "yes")] + Yes +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementTypeConverter))] +public enum DenseVectorElementType +{ + /// + /// + /// Indexes a single bit per dimension. Useful for very high-dimensional vectors or models that specifically support + /// bit vectors. + /// + /// + /// NOTE: when using bit, the number of dimensions must be a multiple of 8 and must represent the number of bits. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "bit")] + Bit, + /// + /// + /// Indexes a 1-byte integer value per dimension. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "byte")] + Byte, + /// + /// + /// Indexes a 4-byte floating-point value per dimension. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "float")] + Float +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarityConverter))] +public enum DenseVectorSimilarity +{ + /// + /// + /// Computes the cosine similarity. During indexing Elasticsearch automatically normalizes vectors with cosine + /// similarity to unit length. This allows to internally use dot_product for computing similarity, which is more + /// efficient. Original un-normalized vectors can be still accessed through scripts. + /// + /// + /// The document _score is computed as (1 + cosine(query, vector)) / 2. + /// + /// + /// The cosine similarity does not allow vectors with zero magnitude, since cosine is not defined in this case. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "cosine")] + Cosine, + /// + /// + /// Computes the dot product of two unit vectors. This option provides an optimized way to perform cosine similarity. + /// The constraints and computed score are defined by element_type. + /// + /// + /// When element_type is float, all vectors must be unit length, including both document and query vectors. + /// + /// + /// The document _score is computed as (1 + dot_product(query, vector)) / 2. + /// + /// + /// When element_type is byte, all vectors must have the same length including both document and query vectors or + /// results will be inaccurate. + /// + /// + /// The document _score is computed as 0.5 + (dot_product(query, vector) / (32768 * dims)) where dims is the + /// number of dimensions per vector. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "dot_product")] + DotProduct, + /// + /// + /// Computes similarity based on the L2 distance (also known as Euclidean distance) between the vectors. + /// + /// + /// The document _score is computed as 1 / (1 + l2_norm(query, vector)^2). + /// + /// + /// For bit vectors, instead of using l2_norm, the hamming distance between the vectors is used. + /// + /// + /// The _score transformation is (numBits - hamming(a, b)) / numBits. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "l2_norm")] + L2Norm, + /// + /// + /// Computes the maximum inner product of two vectors. This is similar to dot_product, but doesn't require vectors + /// to be normalized. This means that each vector’s magnitude can significantly effect the score. + /// + /// + /// The document _score is adjusted to prevent negative values. For max_inner_product values < 0, the _score + /// is 1 / (1 + -1 * max_inner_product(query, vector)). For non-negative max_inner_product results the _score + /// is calculated max_inner_product(query, vector) + 1. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "max_inner_product")] + MaxInnerProduct +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.GeoOrientationConverter))] +public enum GeoOrientation +{ + [System.Runtime.Serialization.EnumMember(Value = "left")] + Left, + [System.Runtime.Serialization.EnumMember(Value = "right")] + Right +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.GeoStrategyConverter))] +public enum GeoStrategy +{ + [System.Runtime.Serialization.EnumMember(Value = "recursive")] + Recursive, + [System.Runtime.Serialization.EnumMember(Value = "term")] + Term +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FieldTypeConverter))] +public enum FieldType +{ + [System.Runtime.Serialization.EnumMember(Value = "aggregate_metric_double")] + AggregateMetricDouble, + [System.Runtime.Serialization.EnumMember(Value = "alias")] + Alias, + [System.Runtime.Serialization.EnumMember(Value = "binary")] + Binary, + [System.Runtime.Serialization.EnumMember(Value = "boolean")] + Boolean, + [System.Runtime.Serialization.EnumMember(Value = "byte")] + Byte, + [System.Runtime.Serialization.EnumMember(Value = "completion")] + Completion, + [System.Runtime.Serialization.EnumMember(Value = "constant_keyword")] + ConstantKeyword, + [System.Runtime.Serialization.EnumMember(Value = "counted_keyword")] + CountedKeyword, + [System.Runtime.Serialization.EnumMember(Value = "date")] + Date, + [System.Runtime.Serialization.EnumMember(Value = "date_nanos")] + DateNanos, + [System.Runtime.Serialization.EnumMember(Value = "date_range")] + DateRange, + [System.Runtime.Serialization.EnumMember(Value = "dense_vector")] + DenseVector, + [System.Runtime.Serialization.EnumMember(Value = "double")] + Double, + [System.Runtime.Serialization.EnumMember(Value = "double_range")] + DoubleRange, + [System.Runtime.Serialization.EnumMember(Value = "flattened")] + Flattened, + [System.Runtime.Serialization.EnumMember(Value = "float")] + Float, + [System.Runtime.Serialization.EnumMember(Value = "float_range")] + FloatRange, + [System.Runtime.Serialization.EnumMember(Value = "geo_point")] + GeoPoint, + [System.Runtime.Serialization.EnumMember(Value = "geo_shape")] + GeoShape, + [System.Runtime.Serialization.EnumMember(Value = "half_float")] + HalfFloat, + [System.Runtime.Serialization.EnumMember(Value = "histogram")] + Histogram, + [System.Runtime.Serialization.EnumMember(Value = "icu_collation_keyword")] + IcuCollationKeyword, + [System.Runtime.Serialization.EnumMember(Value = "integer")] + Integer, + [System.Runtime.Serialization.EnumMember(Value = "integer_range")] + IntegerRange, + [System.Runtime.Serialization.EnumMember(Value = "ip")] + Ip, + [System.Runtime.Serialization.EnumMember(Value = "ip_range")] + IpRange, + [System.Runtime.Serialization.EnumMember(Value = "join")] + Join, + [System.Runtime.Serialization.EnumMember(Value = "keyword")] + Keyword, + [System.Runtime.Serialization.EnumMember(Value = "long")] + Long, + [System.Runtime.Serialization.EnumMember(Value = "long_range")] + LongRange, + [System.Runtime.Serialization.EnumMember(Value = "match_only_text")] + MatchOnlyText, + [System.Runtime.Serialization.EnumMember(Value = "murmur3")] + Murmur3, + [System.Runtime.Serialization.EnumMember(Value = "nested")] + Nested, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "object")] + Object, + [System.Runtime.Serialization.EnumMember(Value = "passthrough")] + Passthrough, + [System.Runtime.Serialization.EnumMember(Value = "percolator")] + Percolator, + [System.Runtime.Serialization.EnumMember(Value = "rank_feature")] + RankFeature, + [System.Runtime.Serialization.EnumMember(Value = "rank_features")] + RankFeatures, + [System.Runtime.Serialization.EnumMember(Value = "scaled_float")] + ScaledFloat, + [System.Runtime.Serialization.EnumMember(Value = "search_as_you_type")] + SearchAsYouType, + [System.Runtime.Serialization.EnumMember(Value = "semantic_text")] + SemanticText, + [System.Runtime.Serialization.EnumMember(Value = "shape")] + Shape, + [System.Runtime.Serialization.EnumMember(Value = "short")] + Short, + [System.Runtime.Serialization.EnumMember(Value = "sparse_vector")] + SparseVector, + [System.Runtime.Serialization.EnumMember(Value = "text")] + Text, + [System.Runtime.Serialization.EnumMember(Value = "token_count")] + TokenCount, + [System.Runtime.Serialization.EnumMember(Value = "version")] + Version +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsTypeConverter))] +public enum DenseVectorIndexOptionsType +{ + /// + /// + /// This utilizes a brute-force search algorithm in addition to automatically quantizing to binary vectors. + /// Only supports element_type of float. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "bbq_flat")] + BbqFlat, + /// + /// + /// This utilizes the HNSW algorithm in addition to automatic binary quantization for scalable approximate kNN + /// search with element_type of float. + /// + /// + /// This can reduce the memory footprint by nearly 32x at the cost of some accuracy. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "bbq_hnsw")] + BbqHnsw, + /// + /// + /// This utilizes a brute-force search algorithm for exact kNN search. This supports all element_type values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "flat")] + Flat, + /// + /// + /// This utilizes the HNSW algorithm for scalable approximate kNN search. This supports all element_type values. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "hnsw")] + Hnsw, + /// + /// + /// This utilizes a brute-force search algorithm in addition to automatically half-byte scalar quantization. + /// Only supports element_type of float. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "int4_flat")] + Int4Flat, + /// + /// + /// This utilizes the HNSW algorithm in addition to automatically scalar quantization for scalable approximate kNN + /// search with element_type of float. + /// + /// + /// This can reduce the memory footprint by 8x at the cost of some accuracy. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "int4_hnsw")] + Int4Hnsw, + /// + /// + /// This utilizes a brute-force search algorithm in addition to automatically scalar quantization. Only supports + /// element_type of float. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "int8_flat")] + Int8Flat, + /// + /// + /// The default index type for float vectors. This utilizes the HNSW algorithm in addition to automatically scalar + /// quantization for scalable approximate kNN search with element_type of float. + /// + /// + /// This can reduce the memory footprint by 4x at the cost of some accuracy. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "int8_hnsw")] + Int8Hnsw } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs index c590e11665a..dd68e21e027 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.NoNamespace.g.cs @@ -17,1889 +17,3418 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[JsonConverter(typeof(ClusterInfoTargetConverter))] -public enum ClusterInfoTarget -{ - [EnumMember(Value = "thread_pool")] - ThreadPool, - [EnumMember(Value = "script")] - Script, - [EnumMember(Value = "ingest")] - Ingest, - [EnumMember(Value = "http")] - Http, - [EnumMember(Value = "_all")] - All -} - -internal sealed class ClusterInfoTargetConverter : JsonConverter +internal sealed partial class TimeUnitConverter : System.Text.Json.Serialization.JsonConverter { - public override ClusterInfoTarget Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDays = System.Text.Json.JsonEncodedText.Encode("d"); + private static readonly System.Text.Json.JsonEncodedText MemberHours = System.Text.Json.JsonEncodedText.Encode("h"); + private static readonly System.Text.Json.JsonEncodedText MemberMinutes = System.Text.Json.JsonEncodedText.Encode("m"); + private static readonly System.Text.Json.JsonEncodedText MemberMicroseconds = System.Text.Json.JsonEncodedText.Encode("micros"); + private static readonly System.Text.Json.JsonEncodedText MemberMilliseconds = System.Text.Json.JsonEncodedText.Encode("ms"); + private static readonly System.Text.Json.JsonEncodedText MemberNanoseconds = System.Text.Json.JsonEncodedText.Encode("nanos"); + private static readonly System.Text.Json.JsonEncodedText MemberSeconds = System.Text.Json.JsonEncodedText.Encode("s"); + + public override Elastic.Clients.Elasticsearch.TimeUnit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDays)) { - case "thread_pool": - return ClusterInfoTarget.ThreadPool; - case "script": - return ClusterInfoTarget.Script; - case "ingest": - return ClusterInfoTarget.Ingest; - case "http": - return ClusterInfoTarget.Http; - case "_all": - return ClusterInfoTarget.All; + return Elastic.Clients.Elasticsearch.TimeUnit.Days; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberHours)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Hours; + } - public override void Write(Utf8JsonWriter writer, ClusterInfoTarget value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberMinutes)) { - case ClusterInfoTarget.ThreadPool: - writer.WriteStringValue("thread_pool"); - return; - case ClusterInfoTarget.Script: - writer.WriteStringValue("script"); - return; - case ClusterInfoTarget.Ingest: - writer.WriteStringValue("ingest"); - return; - case ClusterInfoTarget.Http: - writer.WriteStringValue("http"); - return; - case ClusterInfoTarget.All: - writer.WriteStringValue("_all"); - return; + return Elastic.Clients.Elasticsearch.TimeUnit.Minutes; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberMicroseconds)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Microseconds; + } -[JsonConverter(typeof(ClusterSearchStatusConverter))] -public enum ClusterSearchStatus -{ - [EnumMember(Value = "successful")] - Successful, - [EnumMember(Value = "skipped")] - Skipped, - [EnumMember(Value = "running")] - Running, - [EnumMember(Value = "partial")] - Partial, - [EnumMember(Value = "failed")] - Failed -} + if (reader.ValueTextEquals(MemberMilliseconds)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Milliseconds; + } -internal sealed class ClusterSearchStatusConverter : JsonConverter -{ - public override ClusterSearchStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberNanoseconds)) { - case "successful": - return ClusterSearchStatus.Successful; - case "skipped": - return ClusterSearchStatus.Skipped; - case "running": - return ClusterSearchStatus.Running; - case "partial": - return ClusterSearchStatus.Partial; - case "failed": - return ClusterSearchStatus.Failed; + return Elastic.Clients.Elasticsearch.TimeUnit.Nanoseconds; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberSeconds)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Seconds; + } - public override void Write(Utf8JsonWriter writer, ClusterSearchStatus value, JsonSerializerOptions options) - { - switch (value) + var value = reader.GetString()!; + if (string.Equals(value, MemberDays.Value, System.StringComparison.OrdinalIgnoreCase)) { - case ClusterSearchStatus.Successful: - writer.WriteStringValue("successful"); - return; - case ClusterSearchStatus.Skipped: - writer.WriteStringValue("skipped"); - return; - case ClusterSearchStatus.Running: - writer.WriteStringValue("running"); - return; - case ClusterSearchStatus.Partial: - writer.WriteStringValue("partial"); - return; - case ClusterSearchStatus.Failed: - writer.WriteStringValue("failed"); - return; + return Elastic.Clients.Elasticsearch.TimeUnit.Days; } - writer.WriteNullValue(); - } -} + if (string.Equals(value, MemberHours.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Hours; + } -[JsonConverter(typeof(ConflictsConverter))] -public enum Conflicts -{ - /// - /// - /// Continue reindexing even if there are conflicts. - /// - /// - [EnumMember(Value = "proceed")] - Proceed, - /// - /// - /// Stop reindexing if there are conflicts. - /// - /// - [EnumMember(Value = "abort")] - Abort -} + if (string.Equals(value, MemberMinutes.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Minutes; + } -internal sealed class ConflictsConverter : JsonConverter -{ - public override Conflicts Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberMicroseconds.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Microseconds; + } + + if (string.Equals(value, MemberMilliseconds.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Milliseconds; + } + + if (string.Equals(value, MemberNanoseconds.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "proceed": - return Conflicts.Proceed; - case "abort": - return Conflicts.Abort; + return Elastic.Clients.Elasticsearch.TimeUnit.Nanoseconds; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberSeconds.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TimeUnit.Seconds; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TimeUnit)}'."); } - public override void Write(Utf8JsonWriter writer, Conflicts value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TimeUnit value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Conflicts.Proceed: - writer.WriteStringValue("proceed"); - return; - case Conflicts.Abort: - writer.WriteStringValue("abort"); - return; + case Elastic.Clients.Elasticsearch.TimeUnit.Days: + writer.WriteStringValue(MemberDays); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Hours: + writer.WriteStringValue(MemberHours); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Minutes: + writer.WriteStringValue(MemberMinutes); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Microseconds: + writer.WriteStringValue(MemberMicroseconds); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Milliseconds: + writer.WriteStringValue(MemberMilliseconds); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Nanoseconds: + writer.WriteStringValue(MemberNanoseconds); + break; + case Elastic.Clients.Elasticsearch.TimeUnit.Seconds: + writer.WriteStringValue(MemberSeconds); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TimeUnit)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.TimeUnit ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DFIIndependenceMeasureConverter))] -public enum DFIIndependenceMeasure -{ - [EnumMember(Value = "standardized")] - Standardized, - [EnumMember(Value = "saturated")] - Saturated, - [EnumMember(Value = "chisquared")] - Chisquared + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TimeUnit value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DFIIndependenceMeasureConverter : JsonConverter +internal sealed partial class SearchTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override DFIIndependenceMeasure Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDfsQueryThenFetch = System.Text.Json.JsonEncodedText.Encode("dfs_query_then_fetch"); + private static readonly System.Text.Json.JsonEncodedText MemberQueryThenFetch = System.Text.Json.JsonEncodedText.Encode("query_then_fetch"); + + public override Elastic.Clients.Elasticsearch.SearchType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDfsQueryThenFetch)) + { + return Elastic.Clients.Elasticsearch.SearchType.DfsQueryThenFetch; + } + + if (reader.ValueTextEquals(MemberQueryThenFetch)) + { + return Elastic.Clients.Elasticsearch.SearchType.QueryThenFetch; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDfsQueryThenFetch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchType.DfsQueryThenFetch; + } + + if (string.Equals(value, MemberQueryThenFetch.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "standardized": - return DFIIndependenceMeasure.Standardized; - case "saturated": - return DFIIndependenceMeasure.Saturated; - case "chisquared": - return DFIIndependenceMeasure.Chisquared; + return Elastic.Clients.Elasticsearch.SearchType.QueryThenFetch; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchType)}'."); } - public override void Write(Utf8JsonWriter writer, DFIIndependenceMeasure value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case DFIIndependenceMeasure.Standardized: - writer.WriteStringValue("standardized"); - return; - case DFIIndependenceMeasure.Saturated: - writer.WriteStringValue("saturated"); - return; - case DFIIndependenceMeasure.Chisquared: - writer.WriteStringValue("chisquared"); - return; + case Elastic.Clients.Elasticsearch.SearchType.DfsQueryThenFetch: + writer.WriteStringValue(MemberDfsQueryThenFetch); + break; + case Elastic.Clients.Elasticsearch.SearchType.QueryThenFetch: + writer.WriteStringValue(MemberQueryThenFetch); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.SearchType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DFRAfterEffectConverter))] -public enum DFRAfterEffect -{ - [EnumMember(Value = "no")] - No, - [EnumMember(Value = "l")] - l, - [EnumMember(Value = "b")] - b + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DFRAfterEffectConverter : JsonConverter +internal sealed partial class SuggestModeConverter : System.Text.Json.Serialization.JsonConverter { - public override DFRAfterEffect Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAlways = System.Text.Json.JsonEncodedText.Encode("always"); + private static readonly System.Text.Json.JsonEncodedText MemberMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText MemberPopular = System.Text.Json.JsonEncodedText.Encode("popular"); + + public override Elastic.Clients.Elasticsearch.SuggestMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAlways)) + { + return Elastic.Clients.Elasticsearch.SuggestMode.Always; + } + + if (reader.ValueTextEquals(MemberMissing)) + { + return Elastic.Clients.Elasticsearch.SuggestMode.Missing; + } + + if (reader.ValueTextEquals(MemberPopular)) { - case "no": - return DFRAfterEffect.No; - case "l": - return DFRAfterEffect.l; - case "b": - return DFRAfterEffect.b; + return Elastic.Clients.Elasticsearch.SuggestMode.Popular; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberAlways.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SuggestMode.Always; + } + + if (string.Equals(value, MemberMissing.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SuggestMode.Missing; + } + + if (string.Equals(value, MemberPopular.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SuggestMode.Popular; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SuggestMode)}'."); } - public override void Write(Utf8JsonWriter writer, DFRAfterEffect value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SuggestMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case DFRAfterEffect.No: - writer.WriteStringValue("no"); - return; - case DFRAfterEffect.l: - writer.WriteStringValue("l"); - return; - case DFRAfterEffect.b: - writer.WriteStringValue("b"); - return; + case Elastic.Clients.Elasticsearch.SuggestMode.Always: + writer.WriteStringValue(MemberAlways); + break; + case Elastic.Clients.Elasticsearch.SuggestMode.Missing: + writer.WriteStringValue(MemberMissing); + break; + case Elastic.Clients.Elasticsearch.SuggestMode.Popular: + writer.WriteStringValue(MemberPopular); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SuggestMode)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.SuggestMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(DFRBasicModelConverter))] -public enum DFRBasicModel -{ - [EnumMember(Value = "p")] - p, - [EnumMember(Value = "ine")] - Ine, - [EnumMember(Value = "in")] - In, - [EnumMember(Value = "if")] - If, - [EnumMember(Value = "g")] - g, - [EnumMember(Value = "d")] - d, - [EnumMember(Value = "be")] - Be + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SuggestMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class DFRBasicModelConverter : JsonConverter +internal sealed partial class RefreshConverter : System.Text.Json.Serialization.JsonConverter { - public override DFRBasicModel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberFalse = System.Text.Json.JsonEncodedText.Encode("false"); + private static readonly System.Text.Json.JsonEncodedText MemberTrue = System.Text.Json.JsonEncodedText.Encode("true"); + private static readonly System.Text.Json.JsonEncodedText MemberWaitFor = System.Text.Json.JsonEncodedText.Encode("wait_for"); + + public override Elastic.Clients.Elasticsearch.Refresh Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFalse)) { - case "p": - return DFRBasicModel.p; - case "ine": - return DFRBasicModel.Ine; - case "in": - return DFRBasicModel.In; - case "if": - return DFRBasicModel.If; - case "g": - return DFRBasicModel.g; - case "d": - return DFRBasicModel.d; - case "be": - return DFRBasicModel.Be; + return Elastic.Clients.Elasticsearch.Refresh.False; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberTrue)) + { + return Elastic.Clients.Elasticsearch.Refresh.True; + } - public override void Write(Utf8JsonWriter writer, DFRBasicModel value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberWaitFor)) { - case DFRBasicModel.p: - writer.WriteStringValue("p"); - return; - case DFRBasicModel.Ine: - writer.WriteStringValue("ine"); - return; - case DFRBasicModel.In: - writer.WriteStringValue("in"); - return; - case DFRBasicModel.If: - writer.WriteStringValue("if"); - return; - case DFRBasicModel.g: - writer.WriteStringValue("g"); - return; - case DFRBasicModel.d: - writer.WriteStringValue("d"); - return; - case DFRBasicModel.Be: - writer.WriteStringValue("be"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(DistanceUnitConverter))] -public enum DistanceUnit -{ - [EnumMember(Value = "yd")] - Yards, - [EnumMember(Value = "nmi")] - NauticMiles, - [EnumMember(Value = "mm")] - Millimeters, - [EnumMember(Value = "mi")] - Miles, - [EnumMember(Value = "m")] - Meters, - [EnumMember(Value = "km")] - Kilometers, - [EnumMember(Value = "in")] - Inches, - [EnumMember(Value = "ft")] - Feet, - [EnumMember(Value = "cm")] - Centimeters -} + return Elastic.Clients.Elasticsearch.Refresh.WaitFor; + } -internal sealed class DistanceUnitConverter : JsonConverter -{ - public override DistanceUnit Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.TokenType is not System.Text.Json.JsonTokenType.String) { - case "yd": - return DistanceUnit.Yards; - case "nmi": - return DistanceUnit.NauticMiles; - case "mm": - return DistanceUnit.Millimeters; - case "mi": - return DistanceUnit.Miles; - case "m": - return DistanceUnit.Meters; - case "km": - return DistanceUnit.Kilometers; - case "in": - return DistanceUnit.Inches; - case "ft": - return DistanceUnit.Feet; - case "cm": - return DistanceUnit.Centimeters; + throw new System.Text.Json.JsonException($"Unknown member of type '{reader.TokenType}' for enum '{nameof(Elastic.Clients.Elasticsearch.Refresh)}'."); } - ThrowHelper.ThrowJsonException(); - return default; - } + var value = reader.GetString()!; + if (string.Equals(value, MemberFalse.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Refresh.False; + } - public override void Write(Utf8JsonWriter writer, DistanceUnit value, JsonSerializerOptions options) - { - switch (value) + if (string.Equals(value, MemberTrue.Value, System.StringComparison.OrdinalIgnoreCase)) { - case DistanceUnit.Yards: - writer.WriteStringValue("yd"); - return; - case DistanceUnit.NauticMiles: - writer.WriteStringValue("nmi"); - return; - case DistanceUnit.Millimeters: - writer.WriteStringValue("mm"); - return; - case DistanceUnit.Miles: - writer.WriteStringValue("mi"); - return; - case DistanceUnit.Meters: - writer.WriteStringValue("m"); - return; - case DistanceUnit.Kilometers: - writer.WriteStringValue("km"); - return; - case DistanceUnit.Inches: - writer.WriteStringValue("in"); - return; - case DistanceUnit.Feet: - writer.WriteStringValue("ft"); - return; - case DistanceUnit.Centimeters: - writer.WriteStringValue("cm"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(ExpandWildcardConverter))] -public enum ExpandWildcard -{ - /// - /// - /// Match open, non-hidden indices. Also matches any non-hidden data stream. - /// - /// - [EnumMember(Value = "open")] - Open, - /// - /// - /// Wildcard expressions are not accepted. - /// - /// - [EnumMember(Value = "none")] - None, - /// - /// - /// Match hidden data streams and hidden indices. Must be combined with open, closed, or both. - /// - /// - [EnumMember(Value = "hidden")] - Hidden, - /// - /// - /// Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. - /// - /// - [EnumMember(Value = "closed")] - Closed, - /// - /// - /// Match any data stream or index, including hidden ones. - /// - /// - [EnumMember(Value = "all")] - All -} + return Elastic.Clients.Elasticsearch.Refresh.True; + } -internal sealed class ExpandWildcardConverter : JsonConverter -{ - public override ExpandWildcard Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberWaitFor.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "open": - return ExpandWildcard.Open; - case "none": - return ExpandWildcard.None; - case "hidden": - return ExpandWildcard.Hidden; - case "closed": - return ExpandWildcard.Closed; - case "all": - return ExpandWildcard.All; + return Elastic.Clients.Elasticsearch.Refresh.WaitFor; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Refresh)}'."); } - public override void Write(Utf8JsonWriter writer, ExpandWildcard value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Refresh value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ExpandWildcard.Open: - writer.WriteStringValue("open"); - return; - case ExpandWildcard.None: - writer.WriteStringValue("none"); - return; - case ExpandWildcard.Hidden: - writer.WriteStringValue("hidden"); - return; - case ExpandWildcard.Closed: - writer.WriteStringValue("closed"); - return; - case ExpandWildcard.All: - writer.WriteStringValue("all"); - return; + case Elastic.Clients.Elasticsearch.Refresh.False: + writer.WriteRawValue(MemberFalse.EncodedUtf8Bytes); + break; + case Elastic.Clients.Elasticsearch.Refresh.True: + writer.WriteRawValue(MemberTrue.EncodedUtf8Bytes); + break; + case Elastic.Clients.Elasticsearch.Refresh.WaitFor: + writer.WriteStringValue(MemberWaitFor); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Refresh)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Refresh ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(FieldSortNumericTypeConverter))] -public enum FieldSortNumericType -{ - [EnumMember(Value = "long")] - Long, - [EnumMember(Value = "double")] - Double, - [EnumMember(Value = "date_nanos")] - DateNanos, - [EnumMember(Value = "date")] - Date + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Refresh value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class FieldSortNumericTypeConverter : JsonConverter +internal sealed partial class HealthStatusConverter : System.Text.Json.Serialization.JsonConverter { - public override FieldSortNumericType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberGreen = System.Text.Json.JsonEncodedText.Encode("green"); + private static readonly System.Text.Json.JsonEncodedText MemberGreen1 = System.Text.Json.JsonEncodedText.Encode("GREEN"); + private static readonly System.Text.Json.JsonEncodedText MemberRed = System.Text.Json.JsonEncodedText.Encode("red"); + private static readonly System.Text.Json.JsonEncodedText MemberRed1 = System.Text.Json.JsonEncodedText.Encode("RED"); + private static readonly System.Text.Json.JsonEncodedText MemberYellow = System.Text.Json.JsonEncodedText.Encode("yellow"); + private static readonly System.Text.Json.JsonEncodedText MemberYellow1 = System.Text.Json.JsonEncodedText.Encode("YELLOW"); + + public override Elastic.Clients.Elasticsearch.HealthStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberGreen) || reader.ValueTextEquals(MemberGreen1)) { - case "long": - return FieldSortNumericType.Long; - case "double": - return FieldSortNumericType.Double; - case "date_nanos": - return FieldSortNumericType.DateNanos; - case "date": - return FieldSortNumericType.Date; + return Elastic.Clients.Elasticsearch.HealthStatus.Green; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberRed) || reader.ValueTextEquals(MemberRed1)) + { + return Elastic.Clients.Elasticsearch.HealthStatus.Red; + } - public override void Write(Utf8JsonWriter writer, FieldSortNumericType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberYellow) || reader.ValueTextEquals(MemberYellow1)) { - case FieldSortNumericType.Long: - writer.WriteStringValue("long"); - return; - case FieldSortNumericType.Double: - writer.WriteStringValue("double"); - return; - case FieldSortNumericType.DateNanos: - writer.WriteStringValue("date_nanos"); - return; - case FieldSortNumericType.Date: - writer.WriteStringValue("date"); - return; + return Elastic.Clients.Elasticsearch.HealthStatus.Yellow; } - writer.WriteNullValue(); - } -} + var value = reader.GetString()!; + if (string.Equals(value, MemberGreen.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberGreen1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.HealthStatus.Green; + } -[JsonConverter(typeof(GeoDistanceTypeConverter))] -public enum GeoDistanceType -{ - /// - /// - /// The plane calculation is faster but less accurate. - /// - /// - [EnumMember(Value = "plane")] - Plane, - /// - /// - /// The arc calculation is the most accurate. - /// - /// - [EnumMember(Value = "arc")] - Arc -} + if (string.Equals(value, MemberRed.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberRed1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.HealthStatus.Red; + } -internal sealed class GeoDistanceTypeConverter : JsonConverter -{ - public override GeoDistanceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberYellow.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberYellow1.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "plane": - return GeoDistanceType.Plane; - case "arc": - return GeoDistanceType.Arc; + return Elastic.Clients.Elasticsearch.HealthStatus.Yellow; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.HealthStatus)}'."); } - public override void Write(Utf8JsonWriter writer, GeoDistanceType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.HealthStatus value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GeoDistanceType.Plane: - writer.WriteStringValue("plane"); - return; - case GeoDistanceType.Arc: - writer.WriteStringValue("arc"); - return; + case Elastic.Clients.Elasticsearch.HealthStatus.Green: + writer.WriteStringValue(MemberGreen); + break; + case Elastic.Clients.Elasticsearch.HealthStatus.Red: + writer.WriteStringValue(MemberRed); + break; + case Elastic.Clients.Elasticsearch.HealthStatus.Yellow: + writer.WriteStringValue(MemberYellow); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.HealthStatus)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.HealthStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(GeoShapeRelationConverter))] -public enum GeoShapeRelation -{ - /// - /// - /// Return all documents whose geo_shape or geo_point field is within the query geometry. - /// Line geometries are not supported. - /// - /// - [EnumMember(Value = "within")] - Within, - /// - /// - /// Return all documents whose geo_shape or geo_point field intersects the query geometry. - /// - /// - [EnumMember(Value = "intersects")] - Intersects, - /// - /// - /// Return all documents whose geo_shape or geo_point field has nothing in common with the query geometry. - /// - /// - [EnumMember(Value = "disjoint")] - Disjoint, - /// - /// - /// Return all documents whose geo_shape or geo_point field contains the query geometry. - /// - /// - [EnumMember(Value = "contains")] - Contains + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.HealthStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class GeoShapeRelationConverter : JsonConverter +internal sealed partial class LevelConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoShapeRelation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText MemberIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText MemberShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.Level Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCluster)) + { + return Elastic.Clients.Elasticsearch.Level.Cluster; + } + + if (reader.ValueTextEquals(MemberIndices)) + { + return Elastic.Clients.Elasticsearch.Level.Indices; + } + + if (reader.ValueTextEquals(MemberShards)) + { + return Elastic.Clients.Elasticsearch.Level.Shards; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCluster.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "within": - return GeoShapeRelation.Within; - case "intersects": - return GeoShapeRelation.Intersects; - case "disjoint": - return GeoShapeRelation.Disjoint; - case "contains": - return GeoShapeRelation.Contains; + return Elastic.Clients.Elasticsearch.Level.Cluster; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberIndices.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Level.Indices; + } + + if (string.Equals(value, MemberShards.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Level.Shards; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Level)}'."); } - public override void Write(Utf8JsonWriter writer, GeoShapeRelation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Level value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case GeoShapeRelation.Within: - writer.WriteStringValue("within"); - return; - case GeoShapeRelation.Intersects: - writer.WriteStringValue("intersects"); - return; - case GeoShapeRelation.Disjoint: - writer.WriteStringValue("disjoint"); - return; - case GeoShapeRelation.Contains: - writer.WriteStringValue("contains"); - return; + case Elastic.Clients.Elasticsearch.Level.Cluster: + writer.WriteStringValue(MemberCluster); + break; + case Elastic.Clients.Elasticsearch.Level.Indices: + writer.WriteStringValue(MemberIndices); + break; + case Elastic.Clients.Elasticsearch.Level.Shards: + writer.WriteStringValue(MemberShards); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Level)}'."); } - - writer.WriteNullValue(); } -} -[JsonConverter(typeof(HealthStatusConverter))] -public enum HealthStatus -{ - /// - /// - /// All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired. - /// - /// - [EnumMember(Value = "yellow")] - Yellow, - /// - /// - /// One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned. - /// - /// - [EnumMember(Value = "red")] - Red, - /// - /// - /// All shards are assigned. - /// - /// - [EnumMember(Value = "green")] - Green + public override Elastic.Clients.Elasticsearch.Level ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Level value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class HealthStatusConverter : JsonConverter +internal sealed partial class WaitForEventsConverter : System.Text.Json.Serialization.JsonConverter { - public override HealthStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberHigh = System.Text.Json.JsonEncodedText.Encode("high"); + private static readonly System.Text.Json.JsonEncodedText MemberImmediate = System.Text.Json.JsonEncodedText.Encode("immediate"); + private static readonly System.Text.Json.JsonEncodedText MemberLanguid = System.Text.Json.JsonEncodedText.Encode("languid"); + private static readonly System.Text.Json.JsonEncodedText MemberLow = System.Text.Json.JsonEncodedText.Encode("low"); + private static readonly System.Text.Json.JsonEncodedText MemberNormal = System.Text.Json.JsonEncodedText.Encode("normal"); + private static readonly System.Text.Json.JsonEncodedText MemberUrgent = System.Text.Json.JsonEncodedText.Encode("urgent"); + + public override Elastic.Clients.Elasticsearch.WaitForEvents Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberHigh)) { - case "yellow": - case "YELLOW": - return HealthStatus.Yellow; - case "red": - case "RED": - return HealthStatus.Red; - case "green": - case "GREEN": - return HealthStatus.Green; + return Elastic.Clients.Elasticsearch.WaitForEvents.High; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberImmediate)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Immediate; + } - public override void Write(Utf8JsonWriter writer, HealthStatus value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberLanguid)) { - case HealthStatus.Yellow: - writer.WriteStringValue("yellow"); - return; - case HealthStatus.Red: - writer.WriteStringValue("red"); - return; - case HealthStatus.Green: - writer.WriteStringValue("green"); - return; + return Elastic.Clients.Elasticsearch.WaitForEvents.Languid; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberLow)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Low; + } -[JsonConverter(typeof(IBDistributionConverter))] -public enum IBDistribution -{ - [EnumMember(Value = "spl")] - Spl, - [EnumMember(Value = "ll")] - Ll -} + if (reader.ValueTextEquals(MemberNormal)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Normal; + } -internal sealed class IBDistributionConverter : JsonConverter -{ - public override IBDistribution Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberUrgent)) { - case "spl": - return IBDistribution.Spl; - case "ll": - return IBDistribution.Ll; + return Elastic.Clients.Elasticsearch.WaitForEvents.Urgent; } - ThrowHelper.ThrowJsonException(); - return default; - } + var value = reader.GetString()!; + if (string.Equals(value, MemberHigh.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.High; + } - public override void Write(Utf8JsonWriter writer, IBDistribution value, JsonSerializerOptions options) - { - switch (value) + if (string.Equals(value, MemberImmediate.Value, System.StringComparison.OrdinalIgnoreCase)) { - case IBDistribution.Spl: - writer.WriteStringValue("spl"); - return; - case IBDistribution.Ll: - writer.WriteStringValue("ll"); - return; + return Elastic.Clients.Elasticsearch.WaitForEvents.Immediate; } - writer.WriteNullValue(); - } -} + if (string.Equals(value, MemberLanguid.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Languid; + } -[JsonConverter(typeof(IBLambdaConverter))] -public enum IBLambda -{ - [EnumMember(Value = "ttf")] - Ttf, - [EnumMember(Value = "df")] - Df -} + if (string.Equals(value, MemberLow.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Low; + } -internal sealed class IBLambdaConverter : JsonConverter -{ - public override IBLambda Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberNormal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.WaitForEvents.Normal; + } + + if (string.Equals(value, MemberUrgent.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "ttf": - return IBLambda.Ttf; - case "df": - return IBLambda.Df; + return Elastic.Clients.Elasticsearch.WaitForEvents.Urgent; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.WaitForEvents)}'."); } - public override void Write(Utf8JsonWriter writer, IBLambda value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WaitForEvents value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IBLambda.Ttf: - writer.WriteStringValue("ttf"); - return; - case IBLambda.Df: - writer.WriteStringValue("df"); - return; + case Elastic.Clients.Elasticsearch.WaitForEvents.High: + writer.WriteStringValue(MemberHigh); + break; + case Elastic.Clients.Elasticsearch.WaitForEvents.Immediate: + writer.WriteStringValue(MemberImmediate); + break; + case Elastic.Clients.Elasticsearch.WaitForEvents.Languid: + writer.WriteStringValue(MemberLanguid); + break; + case Elastic.Clients.Elasticsearch.WaitForEvents.Low: + writer.WriteStringValue(MemberLow); + break; + case Elastic.Clients.Elasticsearch.WaitForEvents.Normal: + writer.WriteStringValue(MemberNormal); + break; + case Elastic.Clients.Elasticsearch.WaitForEvents.Urgent: + writer.WriteStringValue(MemberUrgent); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.WaitForEvents)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.WaitForEvents ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(LevelConverter))] -public enum Level -{ - [EnumMember(Value = "shards")] - Shards, - [EnumMember(Value = "indices")] - Indices, - [EnumMember(Value = "cluster")] - Cluster + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WaitForEvents value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class LevelConverter : JsonConverter +internal sealed partial class OpTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override Level Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberCreate = System.Text.Json.JsonEncodedText.Encode("create"); + private static readonly System.Text.Json.JsonEncodedText MemberIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.OpType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCreate)) + { + return Elastic.Clients.Elasticsearch.OpType.Create; + } + + if (reader.ValueTextEquals(MemberIndex)) + { + return Elastic.Clients.Elasticsearch.OpType.Index; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCreate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.OpType.Create; + } + + if (string.Equals(value, MemberIndex.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "shards": - return Level.Shards; - case "indices": - return Level.Indices; - case "cluster": - return Level.Cluster; + return Elastic.Clients.Elasticsearch.OpType.Index; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.OpType)}'."); } - public override void Write(Utf8JsonWriter writer, Level value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.OpType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Level.Shards: - writer.WriteStringValue("shards"); - return; - case Level.Indices: - writer.WriteStringValue("indices"); - return; - case Level.Cluster: - writer.WriteStringValue("cluster"); - return; + case Elastic.Clients.Elasticsearch.OpType.Create: + writer.WriteStringValue(MemberCreate); + break; + case Elastic.Clients.Elasticsearch.OpType.Index: + writer.WriteStringValue(MemberIndex); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.OpType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.OpType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(LifecycleOperationModeConverter))] -public enum LifecycleOperationMode -{ - [EnumMember(Value = "STOPPING")] - Stopping, - [EnumMember(Value = "STOPPED")] - Stopped, - [EnumMember(Value = "RUNNING")] - Running + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.OpType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class LifecycleOperationModeConverter : JsonConverter +internal sealed partial class VersionTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override LifecycleOperationMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberExternal = System.Text.Json.JsonEncodedText.Encode("external"); + private static readonly System.Text.Json.JsonEncodedText MemberExternalGte = System.Text.Json.JsonEncodedText.Encode("external_gte"); + private static readonly System.Text.Json.JsonEncodedText MemberForce = System.Text.Json.JsonEncodedText.Encode("force"); + private static readonly System.Text.Json.JsonEncodedText MemberInternal = System.Text.Json.JsonEncodedText.Encode("internal"); + + public override Elastic.Clients.Elasticsearch.VersionType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberExternal)) { - case "STOPPING": - return LifecycleOperationMode.Stopping; - case "STOPPED": - return LifecycleOperationMode.Stopped; - case "RUNNING": - return LifecycleOperationMode.Running; + return Elastic.Clients.Elasticsearch.VersionType.External; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberExternalGte)) + { + return Elastic.Clients.Elasticsearch.VersionType.ExternalGte; + } - public override void Write(Utf8JsonWriter writer, LifecycleOperationMode value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberForce)) { - case LifecycleOperationMode.Stopping: - writer.WriteStringValue("STOPPING"); - return; - case LifecycleOperationMode.Stopped: - writer.WriteStringValue("STOPPED"); - return; - case LifecycleOperationMode.Running: - writer.WriteStringValue("RUNNING"); - return; + return Elastic.Clients.Elasticsearch.VersionType.Force; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberInternal)) + { + return Elastic.Clients.Elasticsearch.VersionType.Internal; + } -[JsonConverter(typeof(NodeRoleConverter))] -public enum NodeRole -{ - [EnumMember(Value = "voting_only")] - VotingOnly, - [EnumMember(Value = "transform")] - Transform, - [EnumMember(Value = "remote_cluster_client")] - RemoteClusterClient, - [EnumMember(Value = "ml")] - Ml, - [EnumMember(Value = "master")] - Master, - [EnumMember(Value = "ingest")] - Ingest, - [EnumMember(Value = "data_warm")] - DataWarm, - [EnumMember(Value = "data_hot")] - DataHot, - [EnumMember(Value = "data_frozen")] - DataFrozen, - [EnumMember(Value = "data_content")] - DataContent, - [EnumMember(Value = "data_cold")] - DataCold, - [EnumMember(Value = "data")] - Data, - [EnumMember(Value = "coordinating_only")] - CoordinatingOnly, - [EnumMember(Value = "client")] - Client -} - -internal sealed class NodeRoleConverter : JsonConverter -{ - public override NodeRole Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "voting_only": - return NodeRole.VotingOnly; - case "transform": - return NodeRole.Transform; - case "remote_cluster_client": - return NodeRole.RemoteClusterClient; - case "ml": - return NodeRole.Ml; - case "master": - return NodeRole.Master; - case "ingest": - return NodeRole.Ingest; - case "data_warm": - return NodeRole.DataWarm; - case "data_hot": - return NodeRole.DataHot; - case "data_frozen": - return NodeRole.DataFrozen; - case "data_content": - return NodeRole.DataContent; - case "data_cold": - return NodeRole.DataCold; - case "data": - return NodeRole.Data; - case "coordinating_only": - return NodeRole.CoordinatingOnly; - case "client": - return NodeRole.Client; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, NodeRole value, JsonSerializerOptions options) - { - switch (value) + var value = reader.GetString()!; + if (string.Equals(value, MemberExternal.Value, System.StringComparison.OrdinalIgnoreCase)) { - case NodeRole.VotingOnly: - writer.WriteStringValue("voting_only"); - return; - case NodeRole.Transform: - writer.WriteStringValue("transform"); - return; - case NodeRole.RemoteClusterClient: - writer.WriteStringValue("remote_cluster_client"); - return; - case NodeRole.Ml: - writer.WriteStringValue("ml"); - return; - case NodeRole.Master: - writer.WriteStringValue("master"); - return; - case NodeRole.Ingest: - writer.WriteStringValue("ingest"); - return; - case NodeRole.DataWarm: - writer.WriteStringValue("data_warm"); - return; - case NodeRole.DataHot: - writer.WriteStringValue("data_hot"); - return; - case NodeRole.DataFrozen: - writer.WriteStringValue("data_frozen"); - return; - case NodeRole.DataContent: - writer.WriteStringValue("data_content"); - return; - case NodeRole.DataCold: - writer.WriteStringValue("data_cold"); - return; - case NodeRole.Data: - writer.WriteStringValue("data"); - return; - case NodeRole.CoordinatingOnly: - writer.WriteStringValue("coordinating_only"); - return; - case NodeRole.Client: - writer.WriteStringValue("client"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(NormalizationConverter))] -public enum Normalization -{ - [EnumMember(Value = "z")] - z, - [EnumMember(Value = "no")] - No, - [EnumMember(Value = "h3")] - H3, - [EnumMember(Value = "h2")] - H2, - [EnumMember(Value = "h1")] - H1 -} + return Elastic.Clients.Elasticsearch.VersionType.External; + } -internal sealed class NormalizationConverter : JsonConverter -{ - public override Normalization Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberExternalGte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.VersionType.ExternalGte; + } + + if (string.Equals(value, MemberForce.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.VersionType.Force; + } + + if (string.Equals(value, MemberInternal.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "z": - return Normalization.z; - case "no": - return Normalization.No; - case "h3": - return Normalization.H3; - case "h2": - return Normalization.H2; - case "h1": - return Normalization.H1; + return Elastic.Clients.Elasticsearch.VersionType.Internal; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.VersionType)}'."); } - public override void Write(Utf8JsonWriter writer, Normalization value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.VersionType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Normalization.z: - writer.WriteStringValue("z"); - return; - case Normalization.No: - writer.WriteStringValue("no"); - return; - case Normalization.H3: - writer.WriteStringValue("h3"); - return; - case Normalization.H2: - writer.WriteStringValue("h2"); - return; - case Normalization.H1: - writer.WriteStringValue("h1"); - return; + case Elastic.Clients.Elasticsearch.VersionType.External: + writer.WriteStringValue(MemberExternal); + break; + case Elastic.Clients.Elasticsearch.VersionType.ExternalGte: + writer.WriteStringValue(MemberExternalGte); + break; + case Elastic.Clients.Elasticsearch.VersionType.Force: + writer.WriteStringValue(MemberForce); + break; + case Elastic.Clients.Elasticsearch.VersionType.Internal: + writer.WriteStringValue(MemberInternal); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.VersionType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.VersionType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ResultConverter))] -public enum Result -{ - [EnumMember(Value = "updated")] - Updated, - [EnumMember(Value = "not_found")] - NotFound, - [EnumMember(Value = "noop")] - NoOp, - [EnumMember(Value = "deleted")] - Deleted, - [EnumMember(Value = "created")] - Created + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.VersionType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ResultConverter : JsonConverter +internal sealed partial class ConflictsConverter : System.Text.Json.Serialization.JsonConverter { - public override Result Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAbort = System.Text.Json.JsonEncodedText.Encode("abort"); + private static readonly System.Text.Json.JsonEncodedText MemberProceed = System.Text.Json.JsonEncodedText.Encode("proceed"); + + public override Elastic.Clients.Elasticsearch.Conflicts Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAbort)) + { + return Elastic.Clients.Elasticsearch.Conflicts.Abort; + } + + if (reader.ValueTextEquals(MemberProceed)) + { + return Elastic.Clients.Elasticsearch.Conflicts.Proceed; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAbort.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Conflicts.Abort; + } + + if (string.Equals(value, MemberProceed.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "updated": - return Result.Updated; - case "not_found": - return Result.NotFound; - case "noop": - return Result.NoOp; - case "deleted": - return Result.Deleted; - case "created": - return Result.Created; + return Elastic.Clients.Elasticsearch.Conflicts.Proceed; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Conflicts)}'."); } - public override void Write(Utf8JsonWriter writer, Result value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Conflicts value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Result.Updated: - writer.WriteStringValue("updated"); - return; - case Result.NotFound: - writer.WriteStringValue("not_found"); - return; - case Result.NoOp: - writer.WriteStringValue("noop"); - return; - case Result.Deleted: - writer.WriteStringValue("deleted"); - return; - case Result.Created: - writer.WriteStringValue("created"); - return; + case Elastic.Clients.Elasticsearch.Conflicts.Abort: + writer.WriteStringValue(MemberAbort); + break; + case Elastic.Clients.Elasticsearch.Conflicts.Proceed: + writer.WriteStringValue(MemberProceed); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Conflicts)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Conflicts ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Conflicts value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct ScriptLanguage : IEnumStruct +internal sealed partial class ThreadTypeConverter : System.Text.Json.Serialization.JsonConverter { - public ScriptLanguage(string value) => Value = value; - - ScriptLanguage IEnumStruct.Create(string value) => value; - - public readonly string Value { get; } + private static readonly System.Text.Json.JsonEncodedText MemberBlock = System.Text.Json.JsonEncodedText.Encode("block"); + private static readonly System.Text.Json.JsonEncodedText MemberCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText MemberGpu = System.Text.Json.JsonEncodedText.Encode("gpu"); + private static readonly System.Text.Json.JsonEncodedText MemberMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText MemberWait = System.Text.Json.JsonEncodedText.Encode("wait"); - /// - /// - /// Painless scripting language, purpose-built for Elasticsearch. - /// - /// - public static ScriptLanguage Painless { get; } = new ScriptLanguage("painless"); + public override Elastic.Clients.Elasticsearch.ThreadType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBlock)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Block; + } - /// - /// - /// Mustache templated, used for templates. - /// - /// - public static ScriptLanguage Mustache { get; } = new ScriptLanguage("mustache"); + if (reader.ValueTextEquals(MemberCpu)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Cpu; + } - /// - /// - /// Expert Java API - /// - /// - public static ScriptLanguage Java { get; } = new ScriptLanguage("java"); + if (reader.ValueTextEquals(MemberGpu)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Gpu; + } - /// - /// - /// Lucene’s expressions language, compiles a JavaScript expression to bytecode. - /// - /// - public static ScriptLanguage Expression { get; } = new ScriptLanguage("expression"); + if (reader.ValueTextEquals(MemberMem)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Mem; + } - public override string ToString() => Value ?? string.Empty; + if (reader.ValueTextEquals(MemberWait)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Wait; + } - public static implicit operator string(ScriptLanguage scriptLanguage) => scriptLanguage.Value; - public static implicit operator ScriptLanguage(string value) => new(value); + var value = reader.GetString()!; + if (string.Equals(value, MemberBlock.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Block; + } - public override int GetHashCode() => Value.GetHashCode(); - public override bool Equals(object obj) => obj is ScriptLanguage other && this.Equals(other); - public bool Equals(ScriptLanguage other) => Value == other.Value; + if (string.Equals(value, MemberCpu.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Cpu; + } - public static bool operator ==(ScriptLanguage a, ScriptLanguage b) => a.Equals(b); - public static bool operator !=(ScriptLanguage a, ScriptLanguage b) => !(a == b); -} + if (string.Equals(value, MemberGpu.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Gpu; + } -[JsonConverter(typeof(ScriptSortTypeConverter))] -public enum ScriptSortType -{ - [EnumMember(Value = "version")] - Version, - [EnumMember(Value = "string")] - String, - [EnumMember(Value = "number")] - Number -} + if (string.Equals(value, MemberMem.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ThreadType.Mem; + } -internal sealed class ScriptSortTypeConverter : JsonConverter -{ - public override ScriptSortType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberWait.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "version": - return ScriptSortType.Version; - case "string": - return ScriptSortType.String; - case "number": - return ScriptSortType.Number; + return Elastic.Clients.Elasticsearch.ThreadType.Wait; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ThreadType)}'."); } - public override void Write(Utf8JsonWriter writer, ScriptSortType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ThreadType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ScriptSortType.Version: - writer.WriteStringValue("version"); - return; - case ScriptSortType.String: - writer.WriteStringValue("string"); - return; - case ScriptSortType.Number: - writer.WriteStringValue("number"); - return; + case Elastic.Clients.Elasticsearch.ThreadType.Block: + writer.WriteStringValue(MemberBlock); + break; + case Elastic.Clients.Elasticsearch.ThreadType.Cpu: + writer.WriteStringValue(MemberCpu); + break; + case Elastic.Clients.Elasticsearch.ThreadType.Gpu: + writer.WriteStringValue(MemberGpu); + break; + case Elastic.Clients.Elasticsearch.ThreadType.Mem: + writer.WriteStringValue(MemberMem); + break; + case Elastic.Clients.Elasticsearch.ThreadType.Wait: + writer.WriteStringValue(MemberWait); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ThreadType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.ThreadType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SearchTypeConverter))] -public enum SearchType -{ - /// - /// - /// Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate. - /// - /// - [EnumMember(Value = "query_then_fetch")] - QueryThenFetch, - /// - /// - /// Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate. - /// - /// - [EnumMember(Value = "dfs_query_then_fetch")] - DfsQueryThenFetch + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ThreadType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SearchTypeConverter : JsonConverter +internal sealed partial class SortOrderConverter : System.Text.Json.Serialization.JsonConverter { - public override SearchType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAsc = System.Text.Json.JsonEncodedText.Encode("asc"); + private static readonly System.Text.Json.JsonEncodedText MemberDesc = System.Text.Json.JsonEncodedText.Encode("desc"); + + public override Elastic.Clients.Elasticsearch.SortOrder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAsc)) { - case "query_then_fetch": - return SearchType.QueryThenFetch; - case "dfs_query_then_fetch": - return SearchType.DfsQueryThenFetch; + return Elastic.Clients.Elasticsearch.SortOrder.Asc; } - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SearchType value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberDesc)) { - case SearchType.QueryThenFetch: - writer.WriteStringValue("query_then_fetch"); - return; - case SearchType.DfsQueryThenFetch: - writer.WriteStringValue("dfs_query_then_fetch"); - return; + return Elastic.Clients.Elasticsearch.SortOrder.Desc; } - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(SlicesCalculationConverter))] -public enum SlicesCalculation -{ - /// - /// - /// Let Elasticsearch choose a reasonable number for most data streams and indices. - /// - /// - [EnumMember(Value = "auto")] - Auto -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAsc.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortOrder.Asc; + } -internal sealed class SlicesCalculationConverter : JsonConverter -{ - public override SlicesCalculation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberDesc.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "auto": - return SlicesCalculation.Auto; + return Elastic.Clients.Elasticsearch.SortOrder.Desc; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SortOrder)}'."); } - public override void Write(Utf8JsonWriter writer, SlicesCalculation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SortOrder value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SlicesCalculation.Auto: - writer.WriteStringValue("auto"); - return; + case Elastic.Clients.Elasticsearch.SortOrder.Asc: + writer.WriteStringValue(MemberAsc); + break; + case Elastic.Clients.Elasticsearch.SortOrder.Desc: + writer.WriteStringValue(MemberDesc); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SortOrder)}'."); } + } + + public override Elastic.Clients.Elasticsearch.SortOrder ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SortOrder value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(SortModeConverter))] -public enum SortMode +internal sealed partial class ResultConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "sum")] - Sum, - [EnumMember(Value = "min")] - Min, - [EnumMember(Value = "median")] - Median, - [EnumMember(Value = "max")] - Max, - [EnumMember(Value = "avg")] - Avg -} + private static readonly System.Text.Json.JsonEncodedText MemberCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText MemberDeleted = System.Text.Json.JsonEncodedText.Encode("deleted"); + private static readonly System.Text.Json.JsonEncodedText MemberNoOp = System.Text.Json.JsonEncodedText.Encode("noop"); + private static readonly System.Text.Json.JsonEncodedText MemberNotFound = System.Text.Json.JsonEncodedText.Encode("not_found"); + private static readonly System.Text.Json.JsonEncodedText MemberUpdated = System.Text.Json.JsonEncodedText.Encode("updated"); -internal sealed class SortModeConverter : JsonConverter -{ - public override SortMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Result Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCreated)) { - case "sum": - return SortMode.Sum; - case "min": - return SortMode.Min; - case "median": - return SortMode.Median; - case "max": - return SortMode.Max; - case "avg": - return SortMode.Avg; + return Elastic.Clients.Elasticsearch.Result.Created; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberDeleted)) + { + return Elastic.Clients.Elasticsearch.Result.Deleted; + } - public override void Write(Utf8JsonWriter writer, SortMode value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberNoOp)) { - case SortMode.Sum: - writer.WriteStringValue("sum"); - return; - case SortMode.Min: - writer.WriteStringValue("min"); - return; - case SortMode.Median: - writer.WriteStringValue("median"); - return; - case SortMode.Max: - writer.WriteStringValue("max"); - return; - case SortMode.Avg: - writer.WriteStringValue("avg"); - return; + return Elastic.Clients.Elasticsearch.Result.NoOp; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberNotFound)) + { + return Elastic.Clients.Elasticsearch.Result.NotFound; + } -[JsonConverter(typeof(SortOrderConverter))] -public enum SortOrder -{ - /// - /// - /// Descending (largest to smallest) - /// - /// - [EnumMember(Value = "desc")] - Desc, - /// - /// - /// Ascending (smallest to largest) - /// - /// - [EnumMember(Value = "asc")] - Asc -} + if (reader.ValueTextEquals(MemberUpdated)) + { + return Elastic.Clients.Elasticsearch.Result.Updated; + } -internal sealed class SortOrderConverter : JsonConverter -{ - public override SortOrder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + var value = reader.GetString()!; + if (string.Equals(value, MemberCreated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Result.Created; + } + + if (string.Equals(value, MemberDeleted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Result.Deleted; + } + + if (string.Equals(value, MemberNoOp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Result.NoOp; + } + + if (string.Equals(value, MemberNotFound.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "desc": - return SortOrder.Desc; - case "asc": - return SortOrder.Asc; + return Elastic.Clients.Elasticsearch.Result.NotFound; } - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberUpdated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Result.Updated; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Result)}'."); } - public override void Write(Utf8JsonWriter writer, SortOrder value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Result value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SortOrder.Desc: - writer.WriteStringValue("desc"); - return; - case SortOrder.Asc: - writer.WriteStringValue("asc"); - return; + case Elastic.Clients.Elasticsearch.Result.Created: + writer.WriteStringValue(MemberCreated); + break; + case Elastic.Clients.Elasticsearch.Result.Deleted: + writer.WriteStringValue(MemberDeleted); + break; + case Elastic.Clients.Elasticsearch.Result.NoOp: + writer.WriteStringValue(MemberNoOp); + break; + case Elastic.Clients.Elasticsearch.Result.NotFound: + writer.WriteStringValue(MemberNotFound); + break; + case Elastic.Clients.Elasticsearch.Result.Updated: + writer.WriteStringValue(MemberUpdated); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Result)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Result ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(SuggestModeConverter))] -public enum SuggestMode -{ - /// - /// - /// Only suggest terms that occur in more docs on the shard than the original term. - /// - /// - [EnumMember(Value = "popular")] - Popular, - /// - /// - /// Only generate suggestions for terms that are not in the shard. - /// - /// - [EnumMember(Value = "missing")] - Missing, - /// - /// - /// Suggest any matching suggestions based on terms in the suggest text. - /// - /// - [EnumMember(Value = "always")] - Always + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Result value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class SuggestModeConverter : JsonConverter +internal sealed partial class LifecycleOperationModeConverter : System.Text.Json.Serialization.JsonConverter { - public override SuggestMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberRunning = System.Text.Json.JsonEncodedText.Encode("RUNNING"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("STOPPED"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("STOPPING"); + + public override Elastic.Clients.Elasticsearch.LifecycleOperationMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberRunning)) + { + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Running; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopped; + } + + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberRunning.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Running; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopped; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "popular": - return SuggestMode.Popular; - case "missing": - return SuggestMode.Missing; - case "always": - return SuggestMode.Always; + return Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopping; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LifecycleOperationMode)}'."); } - public override void Write(Utf8JsonWriter writer, SuggestMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LifecycleOperationMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SuggestMode.Popular: - writer.WriteStringValue("popular"); - return; - case SuggestMode.Missing: - writer.WriteStringValue("missing"); - return; - case SuggestMode.Always: - writer.WriteStringValue("always"); - return; + case Elastic.Clients.Elasticsearch.LifecycleOperationMode.Running: + writer.WriteStringValue(MemberRunning); + break; + case Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopped: + writer.WriteStringValue(MemberStopped); + break; + case Elastic.Clients.Elasticsearch.LifecycleOperationMode.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.LifecycleOperationMode)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.LifecycleOperationMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(ThreadTypeConverter))] -public enum ThreadType -{ - [EnumMember(Value = "wait")] - Wait, - [EnumMember(Value = "mem")] - Mem, - [EnumMember(Value = "gpu")] - Gpu, - [EnumMember(Value = "cpu")] - Cpu, - [EnumMember(Value = "block")] - Block + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LifecycleOperationMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ThreadTypeConverter : JsonConverter +internal sealed partial class ExpandWildcardConverter : System.Text.Json.Serialization.JsonConverter { - public override ThreadType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberClosed = System.Text.Json.JsonEncodedText.Encode("closed"); + private static readonly System.Text.Json.JsonEncodedText MemberHidden = System.Text.Json.JsonEncodedText.Encode("hidden"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberOpen = System.Text.Json.JsonEncodedText.Encode("open"); + + public override Elastic.Clients.Elasticsearch.ExpandWildcard Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.All; + } + + if (reader.ValueTextEquals(MemberClosed)) { - case "wait": - return ThreadType.Wait; - case "mem": - return ThreadType.Mem; - case "gpu": - return ThreadType.Gpu; - case "cpu": - return ThreadType.Cpu; - case "block": - return ThreadType.Block; + return Elastic.Clients.Elasticsearch.ExpandWildcard.Closed; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberHidden)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.Hidden; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.None; + } + + if (reader.ValueTextEquals(MemberOpen)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.Open; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.All; + } + + if (string.Equals(value, MemberClosed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.Closed; + } + + if (string.Equals(value, MemberHidden.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.Hidden; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.None; + } + + if (string.Equals(value, MemberOpen.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ExpandWildcard.Open; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ExpandWildcard)}'."); } - public override void Write(Utf8JsonWriter writer, ThreadType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExpandWildcard value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ThreadType.Wait: - writer.WriteStringValue("wait"); - return; - case ThreadType.Mem: - writer.WriteStringValue("mem"); - return; - case ThreadType.Gpu: - writer.WriteStringValue("gpu"); - return; - case ThreadType.Cpu: - writer.WriteStringValue("cpu"); - return; - case ThreadType.Block: - writer.WriteStringValue("block"); - return; + case Elastic.Clients.Elasticsearch.ExpandWildcard.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.ExpandWildcard.Closed: + writer.WriteStringValue(MemberClosed); + break; + case Elastic.Clients.Elasticsearch.ExpandWildcard.Hidden: + writer.WriteStringValue(MemberHidden); + break; + case Elastic.Clients.Elasticsearch.ExpandWildcard.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.ExpandWildcard.Open: + writer.WriteStringValue(MemberOpen); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ExpandWildcard)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.ExpandWildcard ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(TimeUnitConverter))] -public enum TimeUnit -{ - [EnumMember(Value = "s")] - Seconds, - [EnumMember(Value = "nanos")] - Nanoseconds, - [EnumMember(Value = "m")] - Minutes, - [EnumMember(Value = "ms")] - Milliseconds, - [EnumMember(Value = "micros")] - Microseconds, - [EnumMember(Value = "h")] - Hours, - [EnumMember(Value = "d")] - Days + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ExpandWildcard value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class TimeUnitConverter : JsonConverter +internal sealed partial class WaitForActiveShardOptionsConverter : System.Text.Json.Serialization.JsonConverter { - public override TimeUnit Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberIndexSetting = System.Text.Json.JsonEncodedText.Encode("index-setting"); + + public override Elastic.Clients.Elasticsearch.WaitForActiveShardOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAll)) { - case "s": - return TimeUnit.Seconds; - case "nanos": - return TimeUnit.Nanoseconds; - case "m": - return TimeUnit.Minutes; - case "ms": - return TimeUnit.Milliseconds; - case "micros": - return TimeUnit.Microseconds; - case "h": - return TimeUnit.Hours; - case "d": - return TimeUnit.Days; + return Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.All; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberIndexSetting)) + { + return Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.IndexSetting; + } - public override void Write(Utf8JsonWriter writer, TimeUnit value, JsonSerializerOptions options) - { - switch (value) + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) { - case TimeUnit.Seconds: - writer.WriteStringValue("s"); - return; - case TimeUnit.Nanoseconds: - writer.WriteStringValue("nanos"); - return; - case TimeUnit.Minutes: - writer.WriteStringValue("m"); - return; - case TimeUnit.Milliseconds: - writer.WriteStringValue("ms"); - return; - case TimeUnit.Microseconds: - writer.WriteStringValue("micros"); - return; - case TimeUnit.Hours: - writer.WriteStringValue("h"); - return; - case TimeUnit.Days: - writer.WriteStringValue("d"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(VersionTypeConverter))] -public enum VersionType -{ - /// - /// - /// Use internal versioning that starts at 1 and increments with each update or delete. - /// - /// - [EnumMember(Value = "internal")] - Internal, - /// - /// - /// This option is deprecated because it can cause primary and replica shards to diverge. - /// - /// - [EnumMember(Value = "force")] - Force, - /// - /// - /// Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document. - /// NOTE: The external_gte version type is meant for special use cases and should be used with care. - /// If used incorrectly, it can result in loss of data. - /// - /// - [EnumMember(Value = "external_gte")] - ExternalGte, - /// - /// - /// Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document. - /// - /// - [EnumMember(Value = "external")] - External -} + return Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.All; + } -internal sealed class VersionTypeConverter : JsonConverter -{ - public override VersionType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) + if (string.Equals(value, MemberIndexSetting.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "internal": - return VersionType.Internal; - case "force": - return VersionType.Force; - case "external_gte": - return VersionType.ExternalGte; - case "external": - return VersionType.External; + return Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.IndexSetting; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.WaitForActiveShardOptions)}'."); } - public override void Write(Utf8JsonWriter writer, VersionType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WaitForActiveShardOptions value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case VersionType.Internal: - writer.WriteStringValue("internal"); - return; - case VersionType.Force: - writer.WriteStringValue("force"); - return; - case VersionType.ExternalGte: - writer.WriteStringValue("external_gte"); - return; - case VersionType.External: - writer.WriteStringValue("external"); - return; + case Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.WaitForActiveShardOptions.IndexSetting: + writer.WriteStringValue(MemberIndexSetting); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.WaitForActiveShardOptions)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.WaitForActiveShardOptions ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(WaitForEventsConverter))] -public enum WaitForEvents -{ - [EnumMember(Value = "urgent")] - Urgent, - [EnumMember(Value = "normal")] - Normal, - [EnumMember(Value = "low")] - Low, - [EnumMember(Value = "languid")] - Languid, - [EnumMember(Value = "immediate")] - Immediate, - [EnumMember(Value = "high")] - High + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WaitForActiveShardOptions value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class WaitForEventsConverter : JsonConverter +internal sealed partial class NodeRoleConverter : System.Text.Json.Serialization.JsonConverter { - public override WaitForEvents Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberClient = System.Text.Json.JsonEncodedText.Encode("client"); + private static readonly System.Text.Json.JsonEncodedText MemberCoordinatingOnly = System.Text.Json.JsonEncodedText.Encode("coordinating_only"); + private static readonly System.Text.Json.JsonEncodedText MemberData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText MemberDataCold = System.Text.Json.JsonEncodedText.Encode("data_cold"); + private static readonly System.Text.Json.JsonEncodedText MemberDataContent = System.Text.Json.JsonEncodedText.Encode("data_content"); + private static readonly System.Text.Json.JsonEncodedText MemberDataFrozen = System.Text.Json.JsonEncodedText.Encode("data_frozen"); + private static readonly System.Text.Json.JsonEncodedText MemberDataHot = System.Text.Json.JsonEncodedText.Encode("data_hot"); + private static readonly System.Text.Json.JsonEncodedText MemberDataWarm = System.Text.Json.JsonEncodedText.Encode("data_warm"); + private static readonly System.Text.Json.JsonEncodedText MemberIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText MemberMaster = System.Text.Json.JsonEncodedText.Encode("master"); + private static readonly System.Text.Json.JsonEncodedText MemberMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText MemberRemoteClusterClient = System.Text.Json.JsonEncodedText.Encode("remote_cluster_client"); + private static readonly System.Text.Json.JsonEncodedText MemberTransform = System.Text.Json.JsonEncodedText.Encode("transform"); + private static readonly System.Text.Json.JsonEncodedText MemberVotingOnly = System.Text.Json.JsonEncodedText.Encode("voting_only"); + + public override Elastic.Clients.Elasticsearch.NodeRole Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberClient)) { - case "urgent": - return WaitForEvents.Urgent; - case "normal": - return WaitForEvents.Normal; - case "low": - return WaitForEvents.Low; - case "languid": - return WaitForEvents.Languid; - case "immediate": - return WaitForEvents.Immediate; - case "high": - return WaitForEvents.High; + return Elastic.Clients.Elasticsearch.NodeRole.Client; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberCoordinatingOnly)) + { + return Elastic.Clients.Elasticsearch.NodeRole.CoordinatingOnly; + } - public override void Write(Utf8JsonWriter writer, WaitForEvents value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberData)) { - case WaitForEvents.Urgent: - writer.WriteStringValue("urgent"); - return; - case WaitForEvents.Normal: - writer.WriteStringValue("normal"); - return; - case WaitForEvents.Low: - writer.WriteStringValue("low"); - return; - case WaitForEvents.Languid: - writer.WriteStringValue("languid"); - return; - case WaitForEvents.Immediate: - writer.WriteStringValue("immediate"); - return; - case WaitForEvents.High: - writer.WriteStringValue("high"); - return; - } - - writer.WriteNullValue(); - } + return Elastic.Clients.Elasticsearch.NodeRole.Data; + } + + if (reader.ValueTextEquals(MemberDataCold)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataCold; + } + + if (reader.ValueTextEquals(MemberDataContent)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataContent; + } + + if (reader.ValueTextEquals(MemberDataFrozen)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataFrozen; + } + + if (reader.ValueTextEquals(MemberDataHot)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataHot; + } + + if (reader.ValueTextEquals(MemberDataWarm)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataWarm; + } + + if (reader.ValueTextEquals(MemberIngest)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Ingest; + } + + if (reader.ValueTextEquals(MemberMaster)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Master; + } + + if (reader.ValueTextEquals(MemberMl)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Ml; + } + + if (reader.ValueTextEquals(MemberRemoteClusterClient)) + { + return Elastic.Clients.Elasticsearch.NodeRole.RemoteClusterClient; + } + + if (reader.ValueTextEquals(MemberTransform)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Transform; + } + + if (reader.ValueTextEquals(MemberVotingOnly)) + { + return Elastic.Clients.Elasticsearch.NodeRole.VotingOnly; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberClient.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Client; + } + + if (string.Equals(value, MemberCoordinatingOnly.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.CoordinatingOnly; + } + + if (string.Equals(value, MemberData.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Data; + } + + if (string.Equals(value, MemberDataCold.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataCold; + } + + if (string.Equals(value, MemberDataContent.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataContent; + } + + if (string.Equals(value, MemberDataFrozen.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataFrozen; + } + + if (string.Equals(value, MemberDataHot.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataHot; + } + + if (string.Equals(value, MemberDataWarm.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.DataWarm; + } + + if (string.Equals(value, MemberIngest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Ingest; + } + + if (string.Equals(value, MemberMaster.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Master; + } + + if (string.Equals(value, MemberMl.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Ml; + } + + if (string.Equals(value, MemberRemoteClusterClient.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.RemoteClusterClient; + } + + if (string.Equals(value, MemberTransform.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.Transform; + } + + if (string.Equals(value, MemberVotingOnly.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.NodeRole.VotingOnly; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.NodeRole)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NodeRole value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.NodeRole.Client: + writer.WriteStringValue(MemberClient); + break; + case Elastic.Clients.Elasticsearch.NodeRole.CoordinatingOnly: + writer.WriteStringValue(MemberCoordinatingOnly); + break; + case Elastic.Clients.Elasticsearch.NodeRole.Data: + writer.WriteStringValue(MemberData); + break; + case Elastic.Clients.Elasticsearch.NodeRole.DataCold: + writer.WriteStringValue(MemberDataCold); + break; + case Elastic.Clients.Elasticsearch.NodeRole.DataContent: + writer.WriteStringValue(MemberDataContent); + break; + case Elastic.Clients.Elasticsearch.NodeRole.DataFrozen: + writer.WriteStringValue(MemberDataFrozen); + break; + case Elastic.Clients.Elasticsearch.NodeRole.DataHot: + writer.WriteStringValue(MemberDataHot); + break; + case Elastic.Clients.Elasticsearch.NodeRole.DataWarm: + writer.WriteStringValue(MemberDataWarm); + break; + case Elastic.Clients.Elasticsearch.NodeRole.Ingest: + writer.WriteStringValue(MemberIngest); + break; + case Elastic.Clients.Elasticsearch.NodeRole.Master: + writer.WriteStringValue(MemberMaster); + break; + case Elastic.Clients.Elasticsearch.NodeRole.Ml: + writer.WriteStringValue(MemberMl); + break; + case Elastic.Clients.Elasticsearch.NodeRole.RemoteClusterClient: + writer.WriteStringValue(MemberRemoteClusterClient); + break; + case Elastic.Clients.Elasticsearch.NodeRole.Transform: + writer.WriteStringValue(MemberTransform); + break; + case Elastic.Clients.Elasticsearch.NodeRole.VotingOnly: + writer.WriteStringValue(MemberVotingOnly); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.NodeRole)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.NodeRole ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NodeRole value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ClusterInfoTargetConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText MemberHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText MemberIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText MemberScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText MemberThreadPool = System.Text.Json.JsonEncodedText.Encode("thread_pool"); + + public override Elastic.Clients.Elasticsearch.ClusterInfoTarget Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.All; + } + + if (reader.ValueTextEquals(MemberHttp)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Http; + } + + if (reader.ValueTextEquals(MemberIngest)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Ingest; + } + + if (reader.ValueTextEquals(MemberScript)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Script; + } + + if (reader.ValueTextEquals(MemberThreadPool)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.ThreadPool; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.All; + } + + if (string.Equals(value, MemberHttp.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Http; + } + + if (string.Equals(value, MemberIngest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Ingest; + } + + if (string.Equals(value, MemberScript.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.Script; + } + + if (string.Equals(value, MemberThreadPool.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterInfoTarget.ThreadPool; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ClusterInfoTarget)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterInfoTarget value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.ClusterInfoTarget.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.ClusterInfoTarget.Http: + writer.WriteStringValue(MemberHttp); + break; + case Elastic.Clients.Elasticsearch.ClusterInfoTarget.Ingest: + writer.WriteStringValue(MemberIngest); + break; + case Elastic.Clients.Elasticsearch.ClusterInfoTarget.Script: + writer.WriteStringValue(MemberScript); + break; + case Elastic.Clients.Elasticsearch.ClusterInfoTarget.ThreadPool: + writer.WriteStringValue(MemberThreadPool); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ClusterInfoTarget)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.ClusterInfoTarget ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterInfoTarget value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SlicesCalculationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAuto = System.Text.Json.JsonEncodedText.Encode("auto"); + + public override Elastic.Clients.Elasticsearch.SlicesCalculation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAuto)) + { + return Elastic.Clients.Elasticsearch.SlicesCalculation.Auto; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAuto.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SlicesCalculation.Auto; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SlicesCalculation)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SlicesCalculation value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.SlicesCalculation.Auto: + writer.WriteStringValue(MemberAuto); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SlicesCalculation)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.SlicesCalculation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SlicesCalculation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ScriptLanguageConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.ScriptLanguage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.ScriptLanguage(reader.ReadValue(options, null)); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptLanguage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } +} + +internal sealed partial class GeoDistanceTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberArc = System.Text.Json.JsonEncodedText.Encode("arc"); + private static readonly System.Text.Json.JsonEncodedText MemberPlane = System.Text.Json.JsonEncodedText.Encode("plane"); + + public override Elastic.Clients.Elasticsearch.GeoDistanceType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberArc)) + { + return Elastic.Clients.Elasticsearch.GeoDistanceType.Arc; + } + + if (reader.ValueTextEquals(MemberPlane)) + { + return Elastic.Clients.Elasticsearch.GeoDistanceType.Plane; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberArc.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoDistanceType.Arc; + } + + if (string.Equals(value, MemberPlane.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoDistanceType.Plane; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.GeoDistanceType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoDistanceType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.GeoDistanceType.Arc: + writer.WriteStringValue(MemberArc); + break; + case Elastic.Clients.Elasticsearch.GeoDistanceType.Plane: + writer.WriteStringValue(MemberPlane); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.GeoDistanceType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.GeoDistanceType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoDistanceType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ClusterSearchStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText MemberPartial = System.Text.Json.JsonEncodedText.Encode("partial"); + private static readonly System.Text.Json.JsonEncodedText MemberRunning = System.Text.Json.JsonEncodedText.Encode("running"); + private static readonly System.Text.Json.JsonEncodedText MemberSkipped = System.Text.Json.JsonEncodedText.Encode("skipped"); + private static readonly System.Text.Json.JsonEncodedText MemberSuccessful = System.Text.Json.JsonEncodedText.Encode("successful"); + + public override Elastic.Clients.Elasticsearch.ClusterSearchStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberFailed)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Failed; + } + + if (reader.ValueTextEquals(MemberPartial)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Partial; + } + + if (reader.ValueTextEquals(MemberRunning)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Running; + } + + if (reader.ValueTextEquals(MemberSkipped)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Skipped; + } + + if (reader.ValueTextEquals(MemberSuccessful)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Successful; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Failed; + } + + if (string.Equals(value, MemberPartial.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Partial; + } + + if (string.Equals(value, MemberRunning.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Running; + } + + if (string.Equals(value, MemberSkipped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Skipped; + } + + if (string.Equals(value, MemberSuccessful.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ClusterSearchStatus.Successful; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ClusterSearchStatus)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterSearchStatus value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.ClusterSearchStatus.Failed: + writer.WriteStringValue(MemberFailed); + break; + case Elastic.Clients.Elasticsearch.ClusterSearchStatus.Partial: + writer.WriteStringValue(MemberPartial); + break; + case Elastic.Clients.Elasticsearch.ClusterSearchStatus.Running: + writer.WriteStringValue(MemberRunning); + break; + case Elastic.Clients.Elasticsearch.ClusterSearchStatus.Skipped: + writer.WriteStringValue(MemberSkipped); + break; + case Elastic.Clients.Elasticsearch.ClusterSearchStatus.Successful: + writer.WriteStringValue(MemberSuccessful); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ClusterSearchStatus)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.ClusterSearchStatus ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ClusterSearchStatus value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DistanceUnitConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCentimeters = System.Text.Json.JsonEncodedText.Encode("cm"); + private static readonly System.Text.Json.JsonEncodedText MemberFeet = System.Text.Json.JsonEncodedText.Encode("ft"); + private static readonly System.Text.Json.JsonEncodedText MemberInches = System.Text.Json.JsonEncodedText.Encode("in"); + private static readonly System.Text.Json.JsonEncodedText MemberKilometers = System.Text.Json.JsonEncodedText.Encode("km"); + private static readonly System.Text.Json.JsonEncodedText MemberMeters = System.Text.Json.JsonEncodedText.Encode("m"); + private static readonly System.Text.Json.JsonEncodedText MemberMiles = System.Text.Json.JsonEncodedText.Encode("mi"); + private static readonly System.Text.Json.JsonEncodedText MemberMillimeters = System.Text.Json.JsonEncodedText.Encode("mm"); + private static readonly System.Text.Json.JsonEncodedText MemberNauticMiles = System.Text.Json.JsonEncodedText.Encode("nmi"); + private static readonly System.Text.Json.JsonEncodedText MemberYards = System.Text.Json.JsonEncodedText.Encode("yd"); + + public override Elastic.Clients.Elasticsearch.DistanceUnit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCentimeters)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Centimeters; + } + + if (reader.ValueTextEquals(MemberFeet)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Feet; + } + + if (reader.ValueTextEquals(MemberInches)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Inches; + } + + if (reader.ValueTextEquals(MemberKilometers)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Kilometers; + } + + if (reader.ValueTextEquals(MemberMeters)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Meters; + } + + if (reader.ValueTextEquals(MemberMiles)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Miles; + } + + if (reader.ValueTextEquals(MemberMillimeters)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Millimeters; + } + + if (reader.ValueTextEquals(MemberNauticMiles)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.NauticMiles; + } + + if (reader.ValueTextEquals(MemberYards)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Yards; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCentimeters.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Centimeters; + } + + if (string.Equals(value, MemberFeet.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Feet; + } + + if (string.Equals(value, MemberInches.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Inches; + } + + if (string.Equals(value, MemberKilometers.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Kilometers; + } + + if (string.Equals(value, MemberMeters.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Meters; + } + + if (string.Equals(value, MemberMiles.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Miles; + } + + if (string.Equals(value, MemberMillimeters.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Millimeters; + } + + if (string.Equals(value, MemberNauticMiles.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.NauticMiles; + } + + if (string.Equals(value, MemberYards.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DistanceUnit.Yards; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DistanceUnit)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DistanceUnit value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.DistanceUnit.Centimeters: + writer.WriteStringValue(MemberCentimeters); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Feet: + writer.WriteStringValue(MemberFeet); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Inches: + writer.WriteStringValue(MemberInches); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Kilometers: + writer.WriteStringValue(MemberKilometers); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Meters: + writer.WriteStringValue(MemberMeters); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Miles: + writer.WriteStringValue(MemberMiles); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Millimeters: + writer.WriteStringValue(MemberMillimeters); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.NauticMiles: + writer.WriteStringValue(MemberNauticMiles); + break; + case Elastic.Clients.Elasticsearch.DistanceUnit.Yards: + writer.WriteStringValue(MemberYards); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DistanceUnit)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.DistanceUnit ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DistanceUnit value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SortModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMedian = System.Text.Json.JsonEncodedText.Encode("median"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.SortMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.SortMode.Avg; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.SortMode.Max; + } + + if (reader.ValueTextEquals(MemberMedian)) + { + return Elastic.Clients.Elasticsearch.SortMode.Median; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.SortMode.Min; + } + + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.SortMode.Sum; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortMode.Avg; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortMode.Max; + } + + if (string.Equals(value, MemberMedian.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortMode.Median; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortMode.Min; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SortMode.Sum; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SortMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SortMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.SortMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.SortMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.SortMode.Median: + writer.WriteStringValue(MemberMedian); + break; + case Elastic.Clients.Elasticsearch.SortMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.SortMode.Sum: + writer.WriteStringValue(MemberSum); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SortMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.SortMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SortMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GeoShapeRelationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberContains = System.Text.Json.JsonEncodedText.Encode("contains"); + private static readonly System.Text.Json.JsonEncodedText MemberDisjoint = System.Text.Json.JsonEncodedText.Encode("disjoint"); + private static readonly System.Text.Json.JsonEncodedText MemberIntersects = System.Text.Json.JsonEncodedText.Encode("intersects"); + private static readonly System.Text.Json.JsonEncodedText MemberWithin = System.Text.Json.JsonEncodedText.Encode("within"); + + public override Elastic.Clients.Elasticsearch.GeoShapeRelation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberContains)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Contains; + } + + if (reader.ValueTextEquals(MemberDisjoint)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Disjoint; + } + + if (reader.ValueTextEquals(MemberIntersects)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Intersects; + } + + if (reader.ValueTextEquals(MemberWithin)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Within; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberContains.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Contains; + } + + if (string.Equals(value, MemberDisjoint.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Disjoint; + } + + if (string.Equals(value, MemberIntersects.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Intersects; + } + + if (string.Equals(value, MemberWithin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.GeoShapeRelation.Within; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.GeoShapeRelation)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoShapeRelation value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.GeoShapeRelation.Contains: + writer.WriteStringValue(MemberContains); + break; + case Elastic.Clients.Elasticsearch.GeoShapeRelation.Disjoint: + writer.WriteStringValue(MemberDisjoint); + break; + case Elastic.Clients.Elasticsearch.GeoShapeRelation.Intersects: + writer.WriteStringValue(MemberIntersects); + break; + case Elastic.Clients.Elasticsearch.GeoShapeRelation.Within: + writer.WriteStringValue(MemberWithin); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.GeoShapeRelation)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.GeoShapeRelation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoShapeRelation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ScriptSortTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberNumber = System.Text.Json.JsonEncodedText.Encode("number"); + private static readonly System.Text.Json.JsonEncodedText MemberString = System.Text.Json.JsonEncodedText.Encode("string"); + private static readonly System.Text.Json.JsonEncodedText MemberVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.ScriptSortType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberNumber)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.Number; + } + + if (reader.ValueTextEquals(MemberString)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.String; + } + + if (reader.ValueTextEquals(MemberVersion)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.Version; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberNumber.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.Number; + } + + if (string.Equals(value, MemberString.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.String; + } + + if (string.Equals(value, MemberVersion.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.ScriptSortType.Version; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ScriptSortType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptSortType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.ScriptSortType.Number: + writer.WriteStringValue(MemberNumber); + break; + case Elastic.Clients.Elasticsearch.ScriptSortType.String: + writer.WriteStringValue(MemberString); + break; + case Elastic.Clients.Elasticsearch.ScriptSortType.Version: + writer.WriteStringValue(MemberVersion); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.ScriptSortType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.ScriptSortType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptSortType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DFIIndependenceMeasureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberChisquared = System.Text.Json.JsonEncodedText.Encode("chisquared"); + private static readonly System.Text.Json.JsonEncodedText MemberSaturated = System.Text.Json.JsonEncodedText.Encode("saturated"); + private static readonly System.Text.Json.JsonEncodedText MemberStandardized = System.Text.Json.JsonEncodedText.Encode("standardized"); + + public override Elastic.Clients.Elasticsearch.DFIIndependenceMeasure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberChisquared)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Chisquared; + } + + if (reader.ValueTextEquals(MemberSaturated)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Saturated; + } + + if (reader.ValueTextEquals(MemberStandardized)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Standardized; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberChisquared.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Chisquared; + } + + if (string.Equals(value, MemberSaturated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Saturated; + } + + if (string.Equals(value, MemberStandardized.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Standardized; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFIIndependenceMeasure)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFIIndependenceMeasure value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Chisquared: + writer.WriteStringValue(MemberChisquared); + break; + case Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Saturated: + writer.WriteStringValue(MemberSaturated); + break; + case Elastic.Clients.Elasticsearch.DFIIndependenceMeasure.Standardized: + writer.WriteStringValue(MemberStandardized); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFIIndependenceMeasure)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.DFIIndependenceMeasure ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFIIndependenceMeasure value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DFRAfterEffectConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberB = System.Text.Json.JsonEncodedText.Encode("b"); + private static readonly System.Text.Json.JsonEncodedText MemberL = System.Text.Json.JsonEncodedText.Encode("l"); + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("no"); + + public override Elastic.Clients.Elasticsearch.DFRAfterEffect Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberB)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.B; + } + + if (reader.ValueTextEquals(MemberL)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.L; + } + + if (reader.ValueTextEquals(MemberNo)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.No; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberB.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.B; + } + + if (string.Equals(value, MemberL.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.L; + } + + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRAfterEffect.No; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFRAfterEffect)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFRAfterEffect value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.DFRAfterEffect.B: + writer.WriteStringValue(MemberB); + break; + case Elastic.Clients.Elasticsearch.DFRAfterEffect.L: + writer.WriteStringValue(MemberL); + break; + case Elastic.Clients.Elasticsearch.DFRAfterEffect.No: + writer.WriteStringValue(MemberNo); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFRAfterEffect)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.DFRAfterEffect ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFRAfterEffect value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class DFRBasicModelConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBe = System.Text.Json.JsonEncodedText.Encode("be"); + private static readonly System.Text.Json.JsonEncodedText MemberD = System.Text.Json.JsonEncodedText.Encode("d"); + private static readonly System.Text.Json.JsonEncodedText MemberG = System.Text.Json.JsonEncodedText.Encode("g"); + private static readonly System.Text.Json.JsonEncodedText MemberIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText MemberIn = System.Text.Json.JsonEncodedText.Encode("in"); + private static readonly System.Text.Json.JsonEncodedText MemberIne = System.Text.Json.JsonEncodedText.Encode("ine"); + private static readonly System.Text.Json.JsonEncodedText MemberP = System.Text.Json.JsonEncodedText.Encode("p"); + + public override Elastic.Clients.Elasticsearch.DFRBasicModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBe)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.Be; + } + + if (reader.ValueTextEquals(MemberD)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.D; + } + + if (reader.ValueTextEquals(MemberG)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.G; + } + + if (reader.ValueTextEquals(MemberIf)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.If; + } + + if (reader.ValueTextEquals(MemberIn)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.In; + } + + if (reader.ValueTextEquals(MemberIne)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.Ine; + } + + if (reader.ValueTextEquals(MemberP)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.P; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBe.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.Be; + } + + if (string.Equals(value, MemberD.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.D; + } + + if (string.Equals(value, MemberG.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.G; + } + + if (string.Equals(value, MemberIf.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.If; + } + + if (string.Equals(value, MemberIn.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.In; + } + + if (string.Equals(value, MemberIne.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.Ine; + } + + if (string.Equals(value, MemberP.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.DFRBasicModel.P; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFRBasicModel)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFRBasicModel value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.DFRBasicModel.Be: + writer.WriteStringValue(MemberBe); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.D: + writer.WriteStringValue(MemberD); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.G: + writer.WriteStringValue(MemberG); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.If: + writer.WriteStringValue(MemberIf); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.In: + writer.WriteStringValue(MemberIn); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.Ine: + writer.WriteStringValue(MemberIne); + break; + case Elastic.Clients.Elasticsearch.DFRBasicModel.P: + writer.WriteStringValue(MemberP); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.DFRBasicModel)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.DFRBasicModel ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.DFRBasicModel value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class NormalizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberH1 = System.Text.Json.JsonEncodedText.Encode("h1"); + private static readonly System.Text.Json.JsonEncodedText MemberH2 = System.Text.Json.JsonEncodedText.Encode("h2"); + private static readonly System.Text.Json.JsonEncodedText MemberH3 = System.Text.Json.JsonEncodedText.Encode("h3"); + private static readonly System.Text.Json.JsonEncodedText MemberNo = System.Text.Json.JsonEncodedText.Encode("no"); + private static readonly System.Text.Json.JsonEncodedText MemberZ = System.Text.Json.JsonEncodedText.Encode("z"); + + public override Elastic.Clients.Elasticsearch.Normalization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberH1)) + { + return Elastic.Clients.Elasticsearch.Normalization.H1; + } + + if (reader.ValueTextEquals(MemberH2)) + { + return Elastic.Clients.Elasticsearch.Normalization.H2; + } + + if (reader.ValueTextEquals(MemberH3)) + { + return Elastic.Clients.Elasticsearch.Normalization.H3; + } + + if (reader.ValueTextEquals(MemberNo)) + { + return Elastic.Clients.Elasticsearch.Normalization.No; + } + + if (reader.ValueTextEquals(MemberZ)) + { + return Elastic.Clients.Elasticsearch.Normalization.Z; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberH1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Normalization.H1; + } + + if (string.Equals(value, MemberH2.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Normalization.H2; + } + + if (string.Equals(value, MemberH3.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Normalization.H3; + } + + if (string.Equals(value, MemberNo.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Normalization.No; + } + + if (string.Equals(value, MemberZ.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Normalization.Z; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Normalization)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Normalization value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Normalization.H1: + writer.WriteStringValue(MemberH1); + break; + case Elastic.Clients.Elasticsearch.Normalization.H2: + writer.WriteStringValue(MemberH2); + break; + case Elastic.Clients.Elasticsearch.Normalization.H3: + writer.WriteStringValue(MemberH3); + break; + case Elastic.Clients.Elasticsearch.Normalization.No: + writer.WriteStringValue(MemberNo); + break; + case Elastic.Clients.Elasticsearch.Normalization.Z: + writer.WriteStringValue(MemberZ); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Normalization)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Normalization ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Normalization value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class IBDistributionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberLl = System.Text.Json.JsonEncodedText.Encode("ll"); + private static readonly System.Text.Json.JsonEncodedText MemberSpl = System.Text.Json.JsonEncodedText.Encode("spl"); + + public override Elastic.Clients.Elasticsearch.IBDistribution Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberLl)) + { + return Elastic.Clients.Elasticsearch.IBDistribution.Ll; + } + + if (reader.ValueTextEquals(MemberSpl)) + { + return Elastic.Clients.Elasticsearch.IBDistribution.Spl; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberLl.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IBDistribution.Ll; + } + + if (string.Equals(value, MemberSpl.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IBDistribution.Spl; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IBDistribution)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IBDistribution value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IBDistribution.Ll: + writer.WriteStringValue(MemberLl); + break; + case Elastic.Clients.Elasticsearch.IBDistribution.Spl: + writer.WriteStringValue(MemberSpl); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IBDistribution)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IBDistribution ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IBDistribution value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class IBLambdaConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDf = System.Text.Json.JsonEncodedText.Encode("df"); + private static readonly System.Text.Json.JsonEncodedText MemberTtf = System.Text.Json.JsonEncodedText.Encode("ttf"); + + public override Elastic.Clients.Elasticsearch.IBLambda Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDf)) + { + return Elastic.Clients.Elasticsearch.IBLambda.Df; + } + + if (reader.ValueTextEquals(MemberTtf)) + { + return Elastic.Clients.Elasticsearch.IBLambda.Ttf; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDf.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IBLambda.Df; + } + + if (string.Equals(value, MemberTtf.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.IBLambda.Ttf; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IBLambda)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IBLambda value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.IBLambda.Df: + writer.WriteStringValue(MemberDf); + break; + case Elastic.Clients.Elasticsearch.IBLambda.Ttf: + writer.WriteStringValue(MemberTtf); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.IBLambda)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.IBLambda ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IBLambda value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class FieldSortNumericTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText MemberDateNanos = System.Text.Json.JsonEncodedText.Encode("date_nanos"); + private static readonly System.Text.Json.JsonEncodedText MemberDouble = System.Text.Json.JsonEncodedText.Encode("double"); + private static readonly System.Text.Json.JsonEncodedText MemberLong = System.Text.Json.JsonEncodedText.Encode("long"); + + public override Elastic.Clients.Elasticsearch.FieldSortNumericType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDate)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Date; + } + + if (reader.ValueTextEquals(MemberDateNanos)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.DateNanos; + } + + if (reader.ValueTextEquals(MemberDouble)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Double; + } + + if (reader.ValueTextEquals(MemberLong)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Long; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDate.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Date; + } + + if (string.Equals(value, MemberDateNanos.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.DateNanos; + } + + if (string.Equals(value, MemberDouble.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Double; + } + + if (string.Equals(value, MemberLong.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.FieldSortNumericType.Long; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.FieldSortNumericType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldSortNumericType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.FieldSortNumericType.Date: + writer.WriteStringValue(MemberDate); + break; + case Elastic.Clients.Elasticsearch.FieldSortNumericType.DateNanos: + writer.WriteStringValue(MemberDateNanos); + break; + case Elastic.Clients.Elasticsearch.FieldSortNumericType.Double: + writer.WriteStringValue(MemberDouble); + break; + case Elastic.Clients.Elasticsearch.FieldSortNumericType.Long: + writer.WriteStringValue(MemberLong); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.FieldSortNumericType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.FieldSortNumericType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldSortNumericType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TimeUnitConverter))] +public enum TimeUnit +{ + [System.Runtime.Serialization.EnumMember(Value = "d")] + Days, + [System.Runtime.Serialization.EnumMember(Value = "h")] + Hours, + [System.Runtime.Serialization.EnumMember(Value = "m")] + Minutes, + [System.Runtime.Serialization.EnumMember(Value = "micros")] + Microseconds, + [System.Runtime.Serialization.EnumMember(Value = "ms")] + Milliseconds, + [System.Runtime.Serialization.EnumMember(Value = "nanos")] + Nanoseconds, + [System.Runtime.Serialization.EnumMember(Value = "s")] + Seconds +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchTypeConverter))] +public enum SearchType +{ + /// + /// + /// Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "dfs_query_then_fetch")] + DfsQueryThenFetch, + /// + /// + /// Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "query_then_fetch")] + QueryThenFetch +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SuggestModeConverter))] +public enum SuggestMode +{ + /// + /// + /// Suggest any matching suggestions based on terms in the suggest text. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "always")] + Always, + /// + /// + /// Only generate suggestions for terms that are not in the shard. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "missing")] + Missing, + /// + /// + /// Only suggest terms that occur in more docs on the shard than the original term. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "popular")] + Popular +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RefreshConverter))] +public enum Refresh +{ + [System.Runtime.Serialization.EnumMember(Value = "false")] + False, + [System.Runtime.Serialization.EnumMember(Value = "true")] + True, + [System.Runtime.Serialization.EnumMember(Value = "wait_for")] + WaitFor +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.HealthStatusConverter))] +public enum HealthStatus +{ + /// + /// + /// All shards are assigned. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "green")] + Green, + /// + /// + /// One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "red")] + Red, + /// + /// + /// All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "yellow")] + Yellow +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LevelConverter))] +public enum Level +{ + [System.Runtime.Serialization.EnumMember(Value = "cluster")] + Cluster, + [System.Runtime.Serialization.EnumMember(Value = "indices")] + Indices, + [System.Runtime.Serialization.EnumMember(Value = "shards")] + Shards +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.WaitForEventsConverter))] +public enum WaitForEvents +{ + [System.Runtime.Serialization.EnumMember(Value = "high")] + High, + [System.Runtime.Serialization.EnumMember(Value = "immediate")] + Immediate, + [System.Runtime.Serialization.EnumMember(Value = "languid")] + Languid, + [System.Runtime.Serialization.EnumMember(Value = "low")] + Low, + [System.Runtime.Serialization.EnumMember(Value = "normal")] + Normal, + [System.Runtime.Serialization.EnumMember(Value = "urgent")] + Urgent +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.OpTypeConverter))] +public enum OpType +{ + /// + /// + /// Only index documents that do not already exist. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "create")] + Create, + /// + /// + /// Overwrite any documents that already exist. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "index")] + Index +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.VersionTypeConverter))] +public enum VersionType +{ + /// + /// + /// Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "external")] + External, + /// + /// + /// Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document. + /// NOTE: The external_gte version type is meant for special use cases and should be used with care. + /// If used incorrectly, it can result in loss of data. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "external_gte")] + ExternalGte, + /// + /// + /// This option is deprecated because it can cause primary and replica shards to diverge. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "force")] + Force, + /// + /// + /// Use internal versioning that starts at 1 and increments with each update or delete. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "internal")] + Internal +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ConflictsConverter))] +public enum Conflicts +{ + /// + /// + /// Stop reindexing if there are conflicts. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "abort")] + Abort, + /// + /// + /// Continue reindexing even if there are conflicts. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "proceed")] + Proceed +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ThreadTypeConverter))] +public enum ThreadType +{ + [System.Runtime.Serialization.EnumMember(Value = "block")] + Block, + [System.Runtime.Serialization.EnumMember(Value = "cpu")] + Cpu, + [System.Runtime.Serialization.EnumMember(Value = "gpu")] + Gpu, + [System.Runtime.Serialization.EnumMember(Value = "mem")] + Mem, + [System.Runtime.Serialization.EnumMember(Value = "wait")] + Wait +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SortOrderConverter))] +public enum SortOrder +{ + /// + /// + /// Ascending (smallest to largest) + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "asc")] + Asc, + /// + /// + /// Descending (largest to smallest) + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "desc")] + Desc +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ResultConverter))] +public enum Result +{ + [System.Runtime.Serialization.EnumMember(Value = "created")] + Created, + [System.Runtime.Serialization.EnumMember(Value = "deleted")] + Deleted, + [System.Runtime.Serialization.EnumMember(Value = "noop")] + NoOp, + [System.Runtime.Serialization.EnumMember(Value = "not_found")] + NotFound, + [System.Runtime.Serialization.EnumMember(Value = "updated")] + Updated +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LifecycleOperationModeConverter))] +public enum LifecycleOperationMode +{ + [System.Runtime.Serialization.EnumMember(Value = "RUNNING")] + Running, + [System.Runtime.Serialization.EnumMember(Value = "STOPPED")] + Stopped, + [System.Runtime.Serialization.EnumMember(Value = "STOPPING")] + Stopping +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ExpandWildcardConverter))] +public enum ExpandWildcard +{ + /// + /// + /// Match any data stream or index, including hidden ones. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + /// + /// + /// Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "closed")] + Closed, + /// + /// + /// Match hidden data streams and hidden indices. Must be combined with open, closed, or both. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "hidden")] + Hidden, + /// + /// + /// Wildcard expressions are not accepted. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + /// + /// + /// Match open, non-hidden indices. Also matches any non-hidden data stream. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "open")] + Open +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.WaitForActiveShardOptionsConverter))] +public enum WaitForActiveShardOptions +{ + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, + [System.Runtime.Serialization.EnumMember(Value = "index-setting")] + IndexSetting +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NodeRoleConverter))] +public enum NodeRole +{ + [System.Runtime.Serialization.EnumMember(Value = "client")] + Client, + [System.Runtime.Serialization.EnumMember(Value = "coordinating_only")] + CoordinatingOnly, + [System.Runtime.Serialization.EnumMember(Value = "data")] + Data, + [System.Runtime.Serialization.EnumMember(Value = "data_cold")] + DataCold, + [System.Runtime.Serialization.EnumMember(Value = "data_content")] + DataContent, + [System.Runtime.Serialization.EnumMember(Value = "data_frozen")] + DataFrozen, + [System.Runtime.Serialization.EnumMember(Value = "data_hot")] + DataHot, + [System.Runtime.Serialization.EnumMember(Value = "data_warm")] + DataWarm, + [System.Runtime.Serialization.EnumMember(Value = "ingest")] + Ingest, + [System.Runtime.Serialization.EnumMember(Value = "master")] + Master, + [System.Runtime.Serialization.EnumMember(Value = "ml")] + Ml, + [System.Runtime.Serialization.EnumMember(Value = "remote_cluster_client")] + RemoteClusterClient, + [System.Runtime.Serialization.EnumMember(Value = "transform")] + Transform, + [System.Runtime.Serialization.EnumMember(Value = "voting_only")] + VotingOnly +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClusterInfoTargetConverter))] +public enum ClusterInfoTarget +{ + [System.Runtime.Serialization.EnumMember(Value = "_all")] + All, + [System.Runtime.Serialization.EnumMember(Value = "http")] + Http, + [System.Runtime.Serialization.EnumMember(Value = "ingest")] + Ingest, + [System.Runtime.Serialization.EnumMember(Value = "script")] + Script, + [System.Runtime.Serialization.EnumMember(Value = "thread_pool")] + ThreadPool +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SlicesCalculationConverter))] +public enum SlicesCalculation +{ + /// + /// + /// Let Elasticsearch choose a reasonable number for most data streams and indices. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "auto")] + Auto +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptLanguageConverter))] +public readonly partial struct ScriptLanguage : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct +{ + public ScriptLanguage(string value) => Value = value; +#if NET7_0_OR_GREATER + static ScriptLanguage IEnumStruct.Create(string value) => value; +#else + ScriptLanguage IEnumStruct.Create(string value) => value; +#endif + public readonly string Value { get; } + + /// + /// + /// Lucene’s expressions language, compiles a JavaScript expression to bytecode. + /// + /// + public static ScriptLanguage Expression { get; } = new ScriptLanguage("expression"); + + /// + /// + /// Expert Java API + /// + /// + public static ScriptLanguage Java { get; } = new ScriptLanguage("java"); + + /// + /// + /// Mustache templated, used for templates. + /// + /// + public static ScriptLanguage Mustache { get; } = new ScriptLanguage("mustache"); + + /// + /// + /// Painless scripting language, purpose-built for Elasticsearch. + /// + /// + public static ScriptLanguage Painless { get; } = new ScriptLanguage("painless"); + + public override string ToString() => Value ?? string.Empty; + + public static implicit operator string(ScriptLanguage @enum) => @enum.Value; + public static implicit operator ScriptLanguage(string value) => new(value); + + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is ScriptLanguage other && this.Equals(other); + public bool Equals(ScriptLanguage other) => Value == other.Value; + + public static bool operator ==(ScriptLanguage a, ScriptLanguage b) => a.Equals(b); + public static bool operator !=(ScriptLanguage a, ScriptLanguage b) => !(a == b); +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeoDistanceTypeConverter))] +public enum GeoDistanceType +{ + /// + /// + /// The arc calculation is the most accurate. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "arc")] + Arc, + /// + /// + /// The plane calculation is faster but less accurate. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "plane")] + Plane +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ClusterSearchStatusConverter))] +public enum ClusterSearchStatus +{ + [System.Runtime.Serialization.EnumMember(Value = "failed")] + Failed, + [System.Runtime.Serialization.EnumMember(Value = "partial")] + Partial, + [System.Runtime.Serialization.EnumMember(Value = "running")] + Running, + [System.Runtime.Serialization.EnumMember(Value = "skipped")] + Skipped, + [System.Runtime.Serialization.EnumMember(Value = "successful")] + Successful +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DistanceUnitConverter))] +public enum DistanceUnit +{ + [System.Runtime.Serialization.EnumMember(Value = "cm")] + Centimeters, + [System.Runtime.Serialization.EnumMember(Value = "ft")] + Feet, + [System.Runtime.Serialization.EnumMember(Value = "in")] + Inches, + [System.Runtime.Serialization.EnumMember(Value = "km")] + Kilometers, + [System.Runtime.Serialization.EnumMember(Value = "m")] + Meters, + [System.Runtime.Serialization.EnumMember(Value = "mi")] + Miles, + [System.Runtime.Serialization.EnumMember(Value = "mm")] + Millimeters, + [System.Runtime.Serialization.EnumMember(Value = "nmi")] + NauticMiles, + [System.Runtime.Serialization.EnumMember(Value = "yd")] + Yards +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SortModeConverter))] +public enum SortMode +{ + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, + [System.Runtime.Serialization.EnumMember(Value = "median")] + Median, + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min, + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeoShapeRelationConverter))] +public enum GeoShapeRelation +{ + /// + /// + /// Return all documents whose geo_shape or geo_point field contains the query geometry. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "contains")] + Contains, + /// + /// + /// Return all documents whose geo_shape or geo_point field has nothing in common with the query geometry. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "disjoint")] + Disjoint, + /// + /// + /// Return all documents whose geo_shape or geo_point field intersects the query geometry. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "intersects")] + Intersects, + /// + /// + /// Return all documents whose geo_shape or geo_point field is within the query geometry. + /// Line geometries are not supported. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "within")] + Within +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptSortTypeConverter))] +public enum ScriptSortType +{ + [System.Runtime.Serialization.EnumMember(Value = "number")] + Number, + [System.Runtime.Serialization.EnumMember(Value = "string")] + String, + [System.Runtime.Serialization.EnumMember(Value = "version")] + Version +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DFIIndependenceMeasureConverter))] +public enum DFIIndependenceMeasure +{ + [System.Runtime.Serialization.EnumMember(Value = "chisquared")] + Chisquared, + [System.Runtime.Serialization.EnumMember(Value = "saturated")] + Saturated, + [System.Runtime.Serialization.EnumMember(Value = "standardized")] + Standardized +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DFRAfterEffectConverter))] +public enum DFRAfterEffect +{ + [System.Runtime.Serialization.EnumMember(Value = "b")] + B, + [System.Runtime.Serialization.EnumMember(Value = "l")] + L, + [System.Runtime.Serialization.EnumMember(Value = "no")] + No +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.DFRBasicModelConverter))] +public enum DFRBasicModel +{ + [System.Runtime.Serialization.EnumMember(Value = "be")] + Be, + [System.Runtime.Serialization.EnumMember(Value = "d")] + D, + [System.Runtime.Serialization.EnumMember(Value = "g")] + G, + [System.Runtime.Serialization.EnumMember(Value = "if")] + If, + [System.Runtime.Serialization.EnumMember(Value = "in")] + In, + [System.Runtime.Serialization.EnumMember(Value = "ine")] + Ine, + [System.Runtime.Serialization.EnumMember(Value = "p")] + P +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NormalizationConverter))] +public enum Normalization +{ + [System.Runtime.Serialization.EnumMember(Value = "h1")] + H1, + [System.Runtime.Serialization.EnumMember(Value = "h2")] + H2, + [System.Runtime.Serialization.EnumMember(Value = "h3")] + H3, + [System.Runtime.Serialization.EnumMember(Value = "no")] + No, + [System.Runtime.Serialization.EnumMember(Value = "z")] + Z +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IBDistributionConverter))] +public enum IBDistribution +{ + [System.Runtime.Serialization.EnumMember(Value = "ll")] + Ll, + [System.Runtime.Serialization.EnumMember(Value = "spl")] + Spl +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IBLambdaConverter))] +public enum IBLambda +{ + [System.Runtime.Serialization.EnumMember(Value = "df")] + Df, + [System.Runtime.Serialization.EnumMember(Value = "ttf")] + Ttf +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldSortNumericTypeConverter))] +public enum FieldSortNumericType +{ + [System.Runtime.Serialization.EnumMember(Value = "date")] + Date, + [System.Runtime.Serialization.EnumMember(Value = "date_nanos")] + DateNanos, + [System.Runtime.Serialization.EnumMember(Value = "double")] + Double, + [System.Runtime.Serialization.EnumMember(Value = "long")] + Long } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs index 3af92fe8e4b..f2bdfde94d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs @@ -17,1098 +17,1694 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(ChildScoreModeConverter))] -public enum ChildScoreMode +internal sealed partial class OperatorConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "sum")] - Sum, - [EnumMember(Value = "none")] - None, - [EnumMember(Value = "min")] - Min, - [EnumMember(Value = "max")] - Max, - [EnumMember(Value = "avg")] - Avg + private static readonly System.Text.Json.JsonEncodedText MemberAnd = System.Text.Json.JsonEncodedText.Encode("and"); + private static readonly System.Text.Json.JsonEncodedText MemberAnd1 = System.Text.Json.JsonEncodedText.Encode("AND"); + private static readonly System.Text.Json.JsonEncodedText MemberOr = System.Text.Json.JsonEncodedText.Encode("or"); + private static readonly System.Text.Json.JsonEncodedText MemberOr1 = System.Text.Json.JsonEncodedText.Encode("OR"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.Operator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAnd) || reader.ValueTextEquals(MemberAnd1)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.Operator.And; + } + + if (reader.ValueTextEquals(MemberOr) || reader.ValueTextEquals(MemberOr1)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.Operator.Or; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAnd.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberAnd1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.Operator.And; + } + + if (string.Equals(value, MemberOr.Value, System.StringComparison.OrdinalIgnoreCase) || string.Equals(value, MemberOr1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.Operator.Or; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.Operator)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.Operator value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.Operator.And: + writer.WriteStringValue(MemberAnd); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.Operator.Or: + writer.WriteStringValue(MemberOr); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.Operator)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.Operator ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.Operator value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ChildScoreModeConverter : JsonConverter +internal sealed partial class ZeroTermsQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override ChildScoreMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "sum": - return ChildScoreMode.Sum; - case "none": - return ChildScoreMode.None; - case "min": - return ChildScoreMode.Min; - case "max": - return ChildScoreMode.Max; - case "avg": - return ChildScoreMode.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.All; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.None; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.All; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.None; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery)}'."); } - public override void Write(Utf8JsonWriter writer, ChildScoreMode value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ChildScoreMode.Sum: - writer.WriteStringValue("sum"); - return; - case ChildScoreMode.None: - writer.WriteStringValue("none"); - return; - case ChildScoreMode.Min: - writer.WriteStringValue("min"); - return; - case ChildScoreMode.Max: - writer.WriteStringValue("max"); + case Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery.None: + writer.WriteStringValue(MemberNone); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CombinedFieldsOperatorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAnd = System.Text.Json.JsonEncodedText.Encode("and"); + private static readonly System.Text.Json.JsonEncodedText MemberOr = System.Text.Json.JsonEncodedText.Encode("or"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAnd)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.And; + } + + if (reader.ValueTextEquals(MemberOr)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.Or; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAnd.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.And; + } + + if (string.Equals(value, MemberOr.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.Or; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.And: + writer.WriteStringValue(MemberAnd); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator.Or: + writer.WriteStringValue(MemberOr); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class CombinedFieldsZeroTermsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAll)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.All; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.None; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAll.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.All; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.None; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.All: + writer.WriteStringValue(MemberAll); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms.None: + writer.WriteStringValue(MemberNone); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class FunctionBoostModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberMultiply = System.Text.Json.JsonEncodedText.Encode("multiply"); + private static readonly System.Text.Json.JsonEncodedText MemberReplace = System.Text.Json.JsonEncodedText.Encode("replace"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Avg; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Max; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Min; + } + + if (reader.ValueTextEquals(MemberMultiply)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Multiply; + } + + if (reader.ValueTextEquals(MemberReplace)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Replace; + } + + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Sum; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Avg; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Min; + } + + if (string.Equals(value, MemberMultiply.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Multiply; + } + + if (string.Equals(value, MemberReplace.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Replace; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Sum; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Multiply: + writer.WriteStringValue(MemberMultiply); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Replace: + writer.WriteStringValue(MemberReplace); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode.Sum: + writer.WriteStringValue(MemberSum); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class FunctionScoreModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberFirst = System.Text.Json.JsonEncodedText.Encode("first"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberMultiply = System.Text.Json.JsonEncodedText.Encode("multiply"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Avg; + } + + if (reader.ValueTextEquals(MemberFirst)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.First; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Max; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Min; + } + + if (reader.ValueTextEquals(MemberMultiply)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Multiply; + } + + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Sum; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Avg; + } + + if (string.Equals(value, MemberFirst.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.First; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Min; + } + + if (string.Equals(value, MemberMultiply.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Multiply; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Sum; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.First: + writer.WriteStringValue(MemberFirst); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Multiply: + writer.WriteStringValue(MemberMultiply); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode.Sum: + writer.WriteStringValue(MemberSum); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GeoExecutionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberIndexed = System.Text.Json.JsonEncodedText.Encode("indexed"); + private static readonly System.Text.Json.JsonEncodedText MemberMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberIndexed)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Indexed; + } + + if (reader.ValueTextEquals(MemberMemory)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Memory; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberIndexed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Indexed; + } + + if (string.Equals(value, MemberMemory.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Memory; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Indexed: + writer.WriteStringValue(MemberIndexed); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution.Memory: + writer.WriteStringValue(MemberMemory); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class GeoValidationMethodConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText MemberIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText MemberStrict = System.Text.Json.JsonEncodedText.Encode("strict"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCoerce)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Coerce; + } + + if (reader.ValueTextEquals(MemberIgnoreMalformed)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.IgnoreMalformed; + } + + if (reader.ValueTextEquals(MemberStrict)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Strict; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCoerce.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Coerce; + } + + if (string.Equals(value, MemberIgnoreMalformed.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.IgnoreMalformed; + } + + if (string.Equals(value, MemberStrict.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Strict; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Coerce: + writer.WriteStringValue(MemberCoerce); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.IgnoreMalformed: + writer.WriteStringValue(MemberIgnoreMalformed); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod.Strict: + writer.WriteStringValue(MemberStrict); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ChildScoreModeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Avg; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Max; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Min; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.None; + } + + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Sum; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Avg; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Min; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.None; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Sum; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode.Sum: + writer.WriteStringValue(MemberSum); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class TextQueryTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberBestFields = System.Text.Json.JsonEncodedText.Encode("best_fields"); + private static readonly System.Text.Json.JsonEncodedText MemberBoolPrefix = System.Text.Json.JsonEncodedText.Encode("bool_prefix"); + private static readonly System.Text.Json.JsonEncodedText MemberCrossFields = System.Text.Json.JsonEncodedText.Encode("cross_fields"); + private static readonly System.Text.Json.JsonEncodedText MemberMostFields = System.Text.Json.JsonEncodedText.Encode("most_fields"); + private static readonly System.Text.Json.JsonEncodedText MemberPhrase = System.Text.Json.JsonEncodedText.Encode("phrase"); + private static readonly System.Text.Json.JsonEncodedText MemberPhrasePrefix = System.Text.Json.JsonEncodedText.Encode("phrase_prefix"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberBestFields)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BestFields; + } + + if (reader.ValueTextEquals(MemberBoolPrefix)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BoolPrefix; + } + + if (reader.ValueTextEquals(MemberCrossFields)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.CrossFields; + } + + if (reader.ValueTextEquals(MemberMostFields)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.MostFields; + } + + if (reader.ValueTextEquals(MemberPhrase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.Phrase; + } + + if (reader.ValueTextEquals(MemberPhrasePrefix)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.PhrasePrefix; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberBestFields.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BestFields; + } + + if (string.Equals(value, MemberBoolPrefix.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BoolPrefix; + } + + if (string.Equals(value, MemberCrossFields.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.CrossFields; + } + + if (string.Equals(value, MemberMostFields.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.MostFields; + } + + if (string.Equals(value, MemberPhrase.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.Phrase; + } + + if (string.Equals(value, MemberPhrasePrefix.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.PhrasePrefix; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BestFields: + writer.WriteStringValue(MemberBestFields); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.BoolPrefix: + writer.WriteStringValue(MemberBoolPrefix); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.CrossFields: + writer.WriteStringValue(MemberCrossFields); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.MostFields: + writer.WriteStringValue(MemberMostFields); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.Phrase: + writer.WriteStringValue(MemberPhrase); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType.PhrasePrefix: + writer.WriteStringValue(MemberPhrasePrefix); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class SimpleQueryStringFlagsConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + { + var s = reader.GetString(); + if (string.IsNullOrEmpty(s)) + { + return default; + } + + var flags = s.Split('|'); + var result = default(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags); + foreach (var flag in flags) + { + result |= flag switch + { + "ALL" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.All, + "AND" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.And, + "ESCAPE" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Escape, + "FUZZY" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Fuzzy, + "NEAR" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Near, + "NONE" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.None, + "NOT" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Not, + "OR" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Or, + "PHRASE" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Phrase, + "PRECEDENCE" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Precedence, + "PREFIX" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Prefix, + "SLOP" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Slop, + "WHITESPACE" => Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Whitespace, + _ => throw new System.Text.Json.JsonException($"Invalid flag value '{flag}' for type '{typeToConvert.Name}'.") + }; + } + + return result; + } + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags value, System.Text.Json.JsonSerializerOptions options) + { + { + if (value == default) + { + writer.WriteStringValue(string.Empty); return; - case ChildScoreMode.Avg: - writer.WriteStringValue("avg"); + } + + var sb = new System.Text.StringBuilder(); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.All)) + sb.Append("ALL|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.And)) + sb.Append("AND|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Escape)) + sb.Append("ESCAPE|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Fuzzy)) + sb.Append("FUZZY|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Near)) + sb.Append("NEAR|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.None)) + sb.Append("NONE|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Not)) + sb.Append("NOT|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Or)) + sb.Append("OR|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Phrase)) + sb.Append("PHRASE|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Precedence)) + sb.Append("PRECEDENCE|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Prefix)) + sb.Append("PREFIX|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Slop)) + sb.Append("SLOP|"); + if (value.HasFlag(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags.Whitespace)) + sb.Append("WHITESPACE|"); + if (sb.Length == 0) + { + writer.WriteStringValue(string.Empty); return; - } + } - writer.WriteNullValue(); + sb.Remove(sb.Length - 1, 1); + writer.WriteStringValue(sb.ToString()); + } } } -[JsonConverter(typeof(CombinedFieldsOperatorConverter))] -public enum CombinedFieldsOperator +internal sealed partial class RangeRelationConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "or")] - Or, - [EnumMember(Value = "and")] - And + private static readonly System.Text.Json.JsonEncodedText MemberContains = System.Text.Json.JsonEncodedText.Encode("contains"); + private static readonly System.Text.Json.JsonEncodedText MemberIntersects = System.Text.Json.JsonEncodedText.Encode("intersects"); + private static readonly System.Text.Json.JsonEncodedText MemberWithin = System.Text.Json.JsonEncodedText.Encode("within"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberContains)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Contains; + } + + if (reader.ValueTextEquals(MemberIntersects)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Intersects; + } + + if (reader.ValueTextEquals(MemberWithin)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Within; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberContains.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Contains; + } + + if (string.Equals(value, MemberIntersects.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Intersects; + } + + if (string.Equals(value, MemberWithin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Within; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Contains: + writer.WriteStringValue(MemberContains); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Intersects: + writer.WriteStringValue(MemberIntersects); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation.Within: + writer.WriteStringValue(MemberWithin); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class CombinedFieldsOperatorConverter : JsonConverter -{ - public override CombinedFieldsOperator Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) +internal sealed partial class FieldValueFactorModifierConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberLn = System.Text.Json.JsonEncodedText.Encode("ln"); + private static readonly System.Text.Json.JsonEncodedText MemberLn1p = System.Text.Json.JsonEncodedText.Encode("ln1p"); + private static readonly System.Text.Json.JsonEncodedText MemberLn2p = System.Text.Json.JsonEncodedText.Encode("ln2p"); + private static readonly System.Text.Json.JsonEncodedText MemberLog = System.Text.Json.JsonEncodedText.Encode("log"); + private static readonly System.Text.Json.JsonEncodedText MemberLog1p = System.Text.Json.JsonEncodedText.Encode("log1p"); + private static readonly System.Text.Json.JsonEncodedText MemberLog2p = System.Text.Json.JsonEncodedText.Encode("log2p"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberReciprocal = System.Text.Json.JsonEncodedText.Encode("reciprocal"); + private static readonly System.Text.Json.JsonEncodedText MemberSqrt = System.Text.Json.JsonEncodedText.Encode("sqrt"); + private static readonly System.Text.Json.JsonEncodedText MemberSquare = System.Text.Json.JsonEncodedText.Encode("square"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberLn)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln; + } + + if (reader.ValueTextEquals(MemberLn1p)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln1p; + } + + if (reader.ValueTextEquals(MemberLn2p)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln2p; + } + + if (reader.ValueTextEquals(MemberLog)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log; + } + + if (reader.ValueTextEquals(MemberLog1p)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log1p; + } + + if (reader.ValueTextEquals(MemberLog2p)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log2p; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.None; + } + + if (reader.ValueTextEquals(MemberReciprocal)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Reciprocal; + } + + if (reader.ValueTextEquals(MemberSqrt)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Sqrt; + } + + if (reader.ValueTextEquals(MemberSquare)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Square; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberLn.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln; + } + + if (string.Equals(value, MemberLn1p.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln1p; + } + + if (string.Equals(value, MemberLn2p.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln2p; + } + + if (string.Equals(value, MemberLog.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log; + } + + if (string.Equals(value, MemberLog1p.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log1p; + } + + if (string.Equals(value, MemberLog2p.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log2p; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.None; + } + + if (string.Equals(value, MemberReciprocal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Reciprocal; + } + + if (string.Equals(value, MemberSqrt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Sqrt; + } + + if (string.Equals(value, MemberSquare.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "or": - return CombinedFieldsOperator.Or; - case "and": - return CombinedFieldsOperator.And; + return Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Square; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier)}'."); } - public override void Write(Utf8JsonWriter writer, CombinedFieldsOperator value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case CombinedFieldsOperator.Or: - writer.WriteStringValue("or"); - return; - case CombinedFieldsOperator.And: - writer.WriteStringValue("and"); - return; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln: + writer.WriteStringValue(MemberLn); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln1p: + writer.WriteStringValue(MemberLn1p); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Ln2p: + writer.WriteStringValue(MemberLn2p); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log: + writer.WriteStringValue(MemberLog); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log1p: + writer.WriteStringValue(MemberLog1p); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Log2p: + writer.WriteStringValue(MemberLog2p); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Reciprocal: + writer.WriteStringValue(MemberReciprocal); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Sqrt: + writer.WriteStringValue(MemberSqrt); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier.Square: + writer.WriteStringValue(MemberSquare); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(CombinedFieldsZeroTermsConverter))] -public enum CombinedFieldsZeroTerms -{ - /// - /// - /// No documents are returned if the analyzer removes all tokens. - /// - /// - [EnumMember(Value = "none")] - None, - /// - /// - /// Returns all documents, similar to a match_all query. - /// - /// - [EnumMember(Value = "all")] - All + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class CombinedFieldsZeroTermsConverter : JsonConverter +internal sealed partial class MultiValueModeConverter : System.Text.Json.Serialization.JsonConverter { - public override CombinedFieldsZeroTerms Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAvg)) { - case "none": - return CombinedFieldsZeroTerms.None; - case "all": - return CombinedFieldsZeroTerms.All; + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Avg; } - ThrowHelper.ThrowJsonException(); - return default; - } + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Max; + } - public override void Write(Utf8JsonWriter writer, CombinedFieldsZeroTerms value, JsonSerializerOptions options) - { - switch (value) + if (reader.ValueTextEquals(MemberMin)) { - case CombinedFieldsZeroTerms.None: - writer.WriteStringValue("none"); - return; - case CombinedFieldsZeroTerms.All: - writer.WriteStringValue("all"); - return; + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Min; } - writer.WriteNullValue(); - } -} + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Sum; + } -[JsonConverter(typeof(FieldValueFactorModifierConverter))] -public enum FieldValueFactorModifier -{ - /// - /// - /// Square the field value (multiply it by itself). - /// - /// - [EnumMember(Value = "square")] - Square, - /// - /// - /// Take the square root of the field value. - /// - /// - [EnumMember(Value = "sqrt")] - Sqrt, - /// - /// - /// Reciprocate the field value, same as 1/x where x is the field’s value. - /// - /// - [EnumMember(Value = "reciprocal")] - Reciprocal, - /// - /// - /// Do not apply any multiplier to the field value. - /// - /// - [EnumMember(Value = "none")] - None, - /// - /// - /// Add 2 to the field value and take the common logarithm. - /// - /// - [EnumMember(Value = "log2p")] - Log2p, - /// - /// - /// Add 1 to the field value and take the common logarithm. - /// - /// - [EnumMember(Value = "log1p")] - Log1p, - /// - /// - /// Take the common logarithm of the field value. - /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use log1p instead. - /// - /// - [EnumMember(Value = "log")] - Log, - /// - /// - /// Add 2 to the field value and take the natural logarithm. - /// - /// - [EnumMember(Value = "ln2p")] - Ln2p, - /// - /// - /// Add 1 to the field value and take the natural logarithm. - /// - /// - [EnumMember(Value = "ln1p")] - Ln1p, - /// - /// - /// Take the natural logarithm of the field value. - /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use ln1p instead. - /// - /// - [EnumMember(Value = "ln")] - Ln -} + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Avg; + } -internal sealed class FieldValueFactorModifierConverter : JsonConverter -{ - public override FieldValueFactorModifier Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "square": - return FieldValueFactorModifier.Square; - case "sqrt": - return FieldValueFactorModifier.Sqrt; - case "reciprocal": - return FieldValueFactorModifier.Reciprocal; - case "none": - return FieldValueFactorModifier.None; - case "log2p": - return FieldValueFactorModifier.Log2p; - case "log1p": - return FieldValueFactorModifier.Log1p; - case "log": - return FieldValueFactorModifier.Log; - case "ln2p": - return FieldValueFactorModifier.Ln2p; - case "ln1p": - return FieldValueFactorModifier.Ln1p; - case "ln": - return FieldValueFactorModifier.Ln; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Min; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Sum; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode)}'."); } - public override void Write(Utf8JsonWriter writer, FieldValueFactorModifier value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case FieldValueFactorModifier.Square: - writer.WriteStringValue("square"); - return; - case FieldValueFactorModifier.Sqrt: - writer.WriteStringValue("sqrt"); - return; - case FieldValueFactorModifier.Reciprocal: - writer.WriteStringValue("reciprocal"); - return; - case FieldValueFactorModifier.None: - writer.WriteStringValue("none"); - return; - case FieldValueFactorModifier.Log2p: - writer.WriteStringValue("log2p"); - return; - case FieldValueFactorModifier.Log1p: - writer.WriteStringValue("log1p"); - return; - case FieldValueFactorModifier.Log: - writer.WriteStringValue("log"); - return; - case FieldValueFactorModifier.Ln2p: - writer.WriteStringValue("ln2p"); - return; - case FieldValueFactorModifier.Ln1p: - writer.WriteStringValue("ln1p"); - return; - case FieldValueFactorModifier.Ln: - writer.WriteStringValue("ln"); - return; + case Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode.Sum: + writer.WriteStringValue(MemberSum); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode)}'."); } + } + + public override Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(FunctionBoostModeConverter))] -public enum FunctionBoostMode +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.OperatorConverter))] +public enum Operator +{ + [System.Runtime.Serialization.EnumMember(Value = "and")] + And, + [System.Runtime.Serialization.EnumMember(Value = "or")] + Or +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQueryConverter))] +public enum ZeroTermsQuery { /// /// - /// Query score and function score are added - /// - /// - [EnumMember(Value = "sum")] - Sum, - /// - /// - /// Only the function score is used. - /// The query score is ignored. - /// - /// - [EnumMember(Value = "replace")] - Replace, - /// - /// - /// Query score and function score are multiplied + /// Returns all documents, similar to a match_all query. /// /// - [EnumMember(Value = "multiply")] - Multiply, + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, /// /// - /// Min of query score and function score + /// No documents are returned if the analyzer removes all tokens. /// /// - [EnumMember(Value = "min")] - Min, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperatorConverter))] +public enum CombinedFieldsOperator +{ + [System.Runtime.Serialization.EnumMember(Value = "and")] + And, + [System.Runtime.Serialization.EnumMember(Value = "or")] + Or +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTermsConverter))] +public enum CombinedFieldsZeroTerms +{ /// /// - /// Max of query score and function score + /// Returns all documents, similar to a match_all query. /// /// - [EnumMember(Value = "max")] - Max, + [System.Runtime.Serialization.EnumMember(Value = "all")] + All, /// /// - /// Query score and function score are averaged + /// No documents are returned if the analyzer removes all tokens. /// /// - [EnumMember(Value = "avg")] - Avg -} - -internal sealed class FunctionBoostModeConverter : JsonConverter -{ - public override FunctionBoostMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "sum": - return FunctionBoostMode.Sum; - case "replace": - return FunctionBoostMode.Replace; - case "multiply": - return FunctionBoostMode.Multiply; - case "min": - return FunctionBoostMode.Min; - case "max": - return FunctionBoostMode.Max; - case "avg": - return FunctionBoostMode.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, FunctionBoostMode value, JsonSerializerOptions options) - { - switch (value) - { - case FunctionBoostMode.Sum: - writer.WriteStringValue("sum"); - return; - case FunctionBoostMode.Replace: - writer.WriteStringValue("replace"); - return; - case FunctionBoostMode.Multiply: - writer.WriteStringValue("multiply"); - return; - case FunctionBoostMode.Min: - writer.WriteStringValue("min"); - return; - case FunctionBoostMode.Max: - writer.WriteStringValue("max"); - return; - case FunctionBoostMode.Avg: - writer.WriteStringValue("avg"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "none")] + None } -[JsonConverter(typeof(FunctionScoreModeConverter))] -public enum FunctionScoreMode +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostModeConverter))] +public enum FunctionBoostMode { /// /// - /// Scores are summed. + /// Query score and function score are averaged /// /// - [EnumMember(Value = "sum")] - Sum, + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, /// /// - /// Scores are multiplied. + /// Max of query score and function score /// /// - [EnumMember(Value = "multiply")] - Multiply, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, /// /// - /// Minimum score is used. + /// Min of query score and function score /// /// - [EnumMember(Value = "min")] + [System.Runtime.Serialization.EnumMember(Value = "min")] Min, /// /// - /// Maximum score is used. + /// Query score and function score are multiplied /// /// - [EnumMember(Value = "max")] - Max, + [System.Runtime.Serialization.EnumMember(Value = "multiply")] + Multiply, /// /// - /// The first function that has a matching filter is applied. + /// Only the function score is used. + /// The query score is ignored. /// /// - [EnumMember(Value = "first")] - First, + [System.Runtime.Serialization.EnumMember(Value = "replace")] + Replace, /// /// - /// Scores are averaged. + /// Query score and function score are added /// /// - [EnumMember(Value = "avg")] - Avg -} - -internal sealed class FunctionScoreModeConverter : JsonConverter -{ - public override FunctionScoreMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "sum": - return FunctionScoreMode.Sum; - case "multiply": - return FunctionScoreMode.Multiply; - case "min": - return FunctionScoreMode.Min; - case "max": - return FunctionScoreMode.Max; - case "first": - return FunctionScoreMode.First; - case "avg": - return FunctionScoreMode.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, FunctionScoreMode value, JsonSerializerOptions options) - { - switch (value) - { - case FunctionScoreMode.Sum: - writer.WriteStringValue("sum"); - return; - case FunctionScoreMode.Multiply: - writer.WriteStringValue("multiply"); - return; - case FunctionScoreMode.Min: - writer.WriteStringValue("min"); - return; - case FunctionScoreMode.Max: - writer.WriteStringValue("max"); - return; - case FunctionScoreMode.First: - writer.WriteStringValue("first"); - return; - case FunctionScoreMode.Avg: - writer.WriteStringValue("avg"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum } -[JsonConverter(typeof(GeoValidationMethodConverter))] -public enum GeoValidationMethod +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreModeConverter))] +public enum FunctionScoreMode { - [EnumMember(Value = "strict")] - Strict, /// /// - /// Accept geo points with invalid latitude or longitude. + /// Scores are averaged. /// /// - [EnumMember(Value = "ignore_malformed")] - IgnoreMalformed, + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, /// /// - /// Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates. + /// The first function that has a matching filter is applied. /// /// - [EnumMember(Value = "coerce")] - Coerce -} - -internal sealed class GeoValidationMethodConverter : JsonConverter -{ - public override GeoValidationMethod Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "strict": - return GeoValidationMethod.Strict; - case "ignore_malformed": - return GeoValidationMethod.IgnoreMalformed; - case "coerce": - return GeoValidationMethod.Coerce; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, GeoValidationMethod value, JsonSerializerOptions options) - { - switch (value) - { - case GeoValidationMethod.Strict: - writer.WriteStringValue("strict"); - return; - case GeoValidationMethod.IgnoreMalformed: - writer.WriteStringValue("ignore_malformed"); - return; - case GeoValidationMethod.Coerce: - writer.WriteStringValue("coerce"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(MultiValueModeConverter))] -public enum MultiValueMode -{ + [System.Runtime.Serialization.EnumMember(Value = "first")] + First, /// /// - /// Distance is the sum of all distances. + /// Maximum score is used. /// /// - [EnumMember(Value = "sum")] - Sum, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, /// /// - /// Distance is the minimum distance. + /// Minimum score is used. /// /// - [EnumMember(Value = "min")] + [System.Runtime.Serialization.EnumMember(Value = "min")] Min, /// /// - /// Distance is the maximum distance. + /// Scores are multiplied. /// /// - [EnumMember(Value = "max")] - Max, + [System.Runtime.Serialization.EnumMember(Value = "multiply")] + Multiply, /// /// - /// Distance is the average distance. + /// Scores are summed. /// /// - [EnumMember(Value = "avg")] - Avg + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum } -internal sealed class MultiValueModeConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoExecutionConverter))] +public enum GeoExecution { - public override MultiValueMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "sum": - return MultiValueMode.Sum; - case "min": - return MultiValueMode.Min; - case "max": - return MultiValueMode.Max; - case "avg": - return MultiValueMode.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, MultiValueMode value, JsonSerializerOptions options) - { - switch (value) - { - case MultiValueMode.Sum: - writer.WriteStringValue("sum"); - return; - case MultiValueMode.Min: - writer.WriteStringValue("min"); - return; - case MultiValueMode.Max: - writer.WriteStringValue("max"); - return; - case MultiValueMode.Avg: - writer.WriteStringValue("avg"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "indexed")] + Indexed, + [System.Runtime.Serialization.EnumMember(Value = "memory")] + Memory } -[JsonConverter(typeof(OperatorConverter))] -public enum Operator +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethodConverter))] +public enum GeoValidationMethod { - [EnumMember(Value = "or")] - Or, - [EnumMember(Value = "and")] - And + /// + /// + /// Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "coerce")] + Coerce, + /// + /// + /// Accept geo points with invalid latitude or longitude. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "ignore_malformed")] + IgnoreMalformed, + [System.Runtime.Serialization.EnumMember(Value = "strict")] + Strict } -internal sealed class OperatorConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreModeConverter))] +public enum ChildScoreMode { - public override Operator Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "or": - case "OR": - return Operator.Or; - case "and": - case "AND": - return Operator.And; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, Operator value, JsonSerializerOptions options) - { - switch (value) - { - case Operator.Or: - writer.WriteStringValue("or"); - return; - case Operator.And: - writer.WriteStringValue("and"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min, + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum } -[JsonConverter(typeof(RangeRelationConverter))] -public enum RangeRelation +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryTypeConverter))] +public enum TextQueryType { /// /// - /// Matches documents with a range field value entirely within the query’s range. + /// Finds documents that match any field, but uses the _score from the best field. /// /// - [EnumMember(Value = "within")] - Within, + [System.Runtime.Serialization.EnumMember(Value = "best_fields")] + BestFields, /// /// - /// Matches documents with a range field value that intersects the query’s range. + /// Creates a match_bool_prefix query on each field and combines the _score from each field. /// /// - [EnumMember(Value = "intersects")] - Intersects, + [System.Runtime.Serialization.EnumMember(Value = "bool_prefix")] + BoolPrefix, /// /// - /// Matches documents with a range field value that entirely contains the query’s range. + /// Treats fields with the same analyzer as though they were one big field. + /// Looks for each word in any field. /// /// - [EnumMember(Value = "contains")] - Contains -} - -internal sealed class RangeRelationConverter : JsonConverter -{ - public override RangeRelation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "within": - return RangeRelation.Within; - case "intersects": - return RangeRelation.Intersects; - case "contains": - return RangeRelation.Contains; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, RangeRelation value, JsonSerializerOptions options) - { - switch (value) - { - case RangeRelation.Within: - writer.WriteStringValue("within"); - return; - case RangeRelation.Intersects: - writer.WriteStringValue("intersects"); - return; - case RangeRelation.Contains: - writer.WriteStringValue("contains"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "cross_fields")] + CrossFields, + /// + /// + /// Finds documents that match any field and combines the _score from each field. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "most_fields")] + MostFields, + /// + /// + /// Runs a match_phrase query on each field and uses the _score from the best field. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "phrase")] + Phrase, + /// + /// + /// Runs a match_phrase_prefix query on each field and uses the _score from the best field. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "phrase_prefix")] + PhrasePrefix } -[JsonConverter(typeof(SimpleQueryStringFlagConverter))] -[Flags] -public enum SimpleQueryStringFlag +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlagsConverter))] +[System.Flags] +public enum SimpleQueryStringFlags { /// /// - /// Enables whitespace as split characters. + /// Enables all optional operators. /// /// - [EnumMember(Value = "WHITESPACE")] - Whitespace = 1 << 0, + [System.Runtime.Serialization.EnumMember(Value = "ALL")] + All = 1 << 0, /// /// - /// Enables the ~N operator, after a phrase where N is maximum number of positions allowed between matching tokens. - /// Synonymous to NEAR. + /// Enables the + AND operator. /// /// - [EnumMember(Value = "SLOP")] - Slop = 1 << 1, + [System.Runtime.Serialization.EnumMember(Value = "AND")] + And = 1 << 1, /// /// - /// Enables the * prefix operator. + /// Enables \ as an escape character. /// /// - [EnumMember(Value = "PREFIX")] - Prefix = 1 << 2, + [System.Runtime.Serialization.EnumMember(Value = "ESCAPE")] + Escape = 1 << 2, /// /// - /// Enables the ( and ) operators to control operator precedence. + /// Enables the ~N operator after a word, where N is an integer denoting the allowed edit distance for matching. /// /// - [EnumMember(Value = "PRECEDENCE")] - Precedence = 1 << 3, + [System.Runtime.Serialization.EnumMember(Value = "FUZZY")] + Fuzzy = 1 << 3, /// /// - /// Enables the " quotes operator used to search for phrases. + /// Enables the ~N operator, after a phrase where N is the maximum number of positions allowed between matching tokens. + /// Synonymous to SLOP. /// /// - [EnumMember(Value = "PHRASE")] - Phrase = 1 << 4, + [System.Runtime.Serialization.EnumMember(Value = "NEAR")] + Near = 1 << 4, /// /// - /// Enables the \| OR operator. + /// Disables all operators. /// /// - [EnumMember(Value = "OR")] - Or = 1 << 5, + [System.Runtime.Serialization.EnumMember(Value = "NONE")] + None = 1 << 5, /// /// /// Enables the - NOT operator. /// /// - [EnumMember(Value = "NOT")] + [System.Runtime.Serialization.EnumMember(Value = "NOT")] Not = 1 << 6, /// /// - /// Disables all operators. + /// Enables the \| OR operator. /// /// - [EnumMember(Value = "NONE")] - None = 1 << 7, + [System.Runtime.Serialization.EnumMember(Value = "OR")] + Or = 1 << 7, /// /// - /// Enables the ~N operator, after a phrase where N is the maximum number of positions allowed between matching tokens. - /// Synonymous to SLOP. + /// Enables the " quotes operator used to search for phrases. /// /// - [EnumMember(Value = "NEAR")] - Near = 1 << 8, + [System.Runtime.Serialization.EnumMember(Value = "PHRASE")] + Phrase = 1 << 8, /// /// - /// Enables the ~N operator after a word, where N is an integer denoting the allowed edit distance for matching. + /// Enables the ( and ) operators to control operator precedence. /// /// - [EnumMember(Value = "FUZZY")] - Fuzzy = 1 << 9, + [System.Runtime.Serialization.EnumMember(Value = "PRECEDENCE")] + Precedence = 1 << 9, /// /// - /// Enables \ as an escape character. + /// Enables the * prefix operator. /// /// - [EnumMember(Value = "ESCAPE")] - Escape = 1 << 10, + [System.Runtime.Serialization.EnumMember(Value = "PREFIX")] + Prefix = 1 << 10, /// /// - /// Enables the + AND operator. + /// Enables the ~N operator, after a phrase where N is maximum number of positions allowed between matching tokens. + /// Synonymous to NEAR. /// /// - [EnumMember(Value = "AND")] - And = 1 << 11, + [System.Runtime.Serialization.EnumMember(Value = "SLOP")] + Slop = 1 << 11, /// /// - /// Enables all optional operators. + /// Enables whitespace as split characters. /// /// - [EnumMember(Value = "ALL")] - All = 1 << 12 + [System.Runtime.Serialization.EnumMember(Value = "WHITESPACE")] + Whitespace = 1 << 12 } -internal sealed class SimpleQueryStringFlagConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelationConverter))] +public enum RangeRelation { - public override SimpleQueryStringFlag Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var s = reader.GetString(); - if (string.IsNullOrEmpty(s)) - { - return default; - } - - var flags = s.Split('|'); - var result = default(SimpleQueryStringFlag); - foreach (var flag in flags) - { - result |= flag switch - { - "WHITESPACE" => SimpleQueryStringFlag.Whitespace, - "SLOP" => SimpleQueryStringFlag.Slop, - "PREFIX" => SimpleQueryStringFlag.Prefix, - "PRECEDENCE" => SimpleQueryStringFlag.Precedence, - "PHRASE" => SimpleQueryStringFlag.Phrase, - "OR" => SimpleQueryStringFlag.Or, - "NOT" => SimpleQueryStringFlag.Not, - "NONE" => SimpleQueryStringFlag.None, - "NEAR" => SimpleQueryStringFlag.Near, - "FUZZY" => SimpleQueryStringFlag.Fuzzy, - "ESCAPE" => SimpleQueryStringFlag.Escape, - "AND" => SimpleQueryStringFlag.And, - "ALL" => SimpleQueryStringFlag.All, - _ => throw new JsonException($"Invalid flag value '{flag}' for type '{typeToConvert.Name}'.") - }; - } - - return result; - } - - public override void Write(Utf8JsonWriter writer, SimpleQueryStringFlag value, JsonSerializerOptions options) - { - if (value == default) - { - writer.WriteStringValue(string.Empty); - return; - } - - var sb = new StringBuilder(); - if (value.HasFlag(SimpleQueryStringFlag.Whitespace)) - sb.Append("WHITESPACE|"); - if (value.HasFlag(SimpleQueryStringFlag.Slop)) - sb.Append("SLOP|"); - if (value.HasFlag(SimpleQueryStringFlag.Prefix)) - sb.Append("PREFIX|"); - if (value.HasFlag(SimpleQueryStringFlag.Precedence)) - sb.Append("PRECEDENCE|"); - if (value.HasFlag(SimpleQueryStringFlag.Phrase)) - sb.Append("PHRASE|"); - if (value.HasFlag(SimpleQueryStringFlag.Or)) - sb.Append("OR|"); - if (value.HasFlag(SimpleQueryStringFlag.Not)) - sb.Append("NOT|"); - if (value.HasFlag(SimpleQueryStringFlag.None)) - sb.Append("NONE|"); - if (value.HasFlag(SimpleQueryStringFlag.Near)) - sb.Append("NEAR|"); - if (value.HasFlag(SimpleQueryStringFlag.Fuzzy)) - sb.Append("FUZZY|"); - if (value.HasFlag(SimpleQueryStringFlag.Escape)) - sb.Append("ESCAPE|"); - if (value.HasFlag(SimpleQueryStringFlag.And)) - sb.Append("AND|"); - if (value.HasFlag(SimpleQueryStringFlag.All)) - sb.Append("ALL|"); - if (sb.Length == 0) - { - writer.WriteStringValue(string.Empty); - return; - } - - sb.Remove(sb.Length - 1, 1); - writer.WriteStringValue(sb.ToString()); - } + /// + /// + /// Matches documents with a range field value that entirely contains the query’s range. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "contains")] + Contains, + /// + /// + /// Matches documents with a range field value that intersects the query’s range. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "intersects")] + Intersects, + /// + /// + /// Matches documents with a range field value entirely within the query’s range. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "within")] + Within } -[JsonConverter(typeof(TextQueryTypeConverter))] -public enum TextQueryType +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifierConverter))] +public enum FieldValueFactorModifier { /// /// - /// Runs a match_phrase_prefix query on each field and uses the _score from the best field. + /// Take the natural logarithm of the field value. + /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use ln1p instead. /// /// - [EnumMember(Value = "phrase_prefix")] - PhrasePrefix, + [System.Runtime.Serialization.EnumMember(Value = "ln")] + Ln, /// /// - /// Runs a match_phrase query on each field and uses the _score from the best field. + /// Add 1 to the field value and take the natural logarithm. /// /// - [EnumMember(Value = "phrase")] - Phrase, + [System.Runtime.Serialization.EnumMember(Value = "ln1p")] + Ln1p, /// /// - /// Finds documents that match any field and combines the _score from each field. + /// Add 2 to the field value and take the natural logarithm. /// /// - [EnumMember(Value = "most_fields")] - MostFields, + [System.Runtime.Serialization.EnumMember(Value = "ln2p")] + Ln2p, /// /// - /// Treats fields with the same analyzer as though they were one big field. - /// Looks for each word in any field. + /// Take the common logarithm of the field value. + /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use log1p instead. /// /// - [EnumMember(Value = "cross_fields")] - CrossFields, + [System.Runtime.Serialization.EnumMember(Value = "log")] + Log, /// /// - /// Creates a match_bool_prefix query on each field and combines the _score from each field. + /// Add 1 to the field value and take the common logarithm. /// /// - [EnumMember(Value = "bool_prefix")] - BoolPrefix, + [System.Runtime.Serialization.EnumMember(Value = "log1p")] + Log1p, /// /// - /// Finds documents that match any field, but uses the _score from the best field. + /// Add 2 to the field value and take the common logarithm. /// /// - [EnumMember(Value = "best_fields")] - BestFields -} - -internal sealed class TextQueryTypeConverter : JsonConverter -{ - public override TextQueryType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "phrase_prefix": - return TextQueryType.PhrasePrefix; - case "phrase": - return TextQueryType.Phrase; - case "most_fields": - return TextQueryType.MostFields; - case "cross_fields": - return TextQueryType.CrossFields; - case "bool_prefix": - return TextQueryType.BoolPrefix; - case "best_fields": - return TextQueryType.BestFields; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TextQueryType value, JsonSerializerOptions options) - { - switch (value) - { - case TextQueryType.PhrasePrefix: - writer.WriteStringValue("phrase_prefix"); - return; - case TextQueryType.Phrase: - writer.WriteStringValue("phrase"); - return; - case TextQueryType.MostFields: - writer.WriteStringValue("most_fields"); - return; - case TextQueryType.CrossFields: - writer.WriteStringValue("cross_fields"); - return; - case TextQueryType.BoolPrefix: - writer.WriteStringValue("bool_prefix"); - return; - case TextQueryType.BestFields: - writer.WriteStringValue("best_fields"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(ZeroTermsQueryConverter))] -public enum ZeroTermsQuery -{ + [System.Runtime.Serialization.EnumMember(Value = "log2p")] + Log2p, /// /// - /// No documents are returned if the analyzer removes all tokens. + /// Do not apply any multiplier to the field value. /// /// - [EnumMember(Value = "none")] + [System.Runtime.Serialization.EnumMember(Value = "none")] None, /// /// - /// Returns all documents, similar to a match_all query. + /// Reciprocate the field value, same as 1/x where x is the field’s value. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "reciprocal")] + Reciprocal, + /// + /// + /// Take the square root of the field value. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "sqrt")] + Sqrt, + /// + /// + /// Square the field value (multiply it by itself). /// /// - [EnumMember(Value = "all")] - All + [System.Runtime.Serialization.EnumMember(Value = "square")] + Square } -internal sealed class ZeroTermsQueryConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueModeConverter))] +public enum MultiValueMode { - public override ZeroTermsQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "none": - return ZeroTermsQuery.None; - case "all": - return ZeroTermsQuery.All; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, ZeroTermsQuery value, JsonSerializerOptions options) - { - switch (value) - { - case ZeroTermsQuery.None: - writer.WriteStringValue("none"); - return; - case ZeroTermsQuery.All: - writer.WriteStringValue("all"); - return; - } - - writer.WriteNullValue(); - } + /// + /// + /// Distance is the average distance. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, + /// + /// + /// Distance is the maximum distance. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, + /// + /// + /// Distance is the minimum distance. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min, + /// + /// + /// Distance is the sum of all distances. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryRules.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryRules.g.cs index 2a8f7fef228..e274535bf9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryRules.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryRules.g.cs @@ -17,167 +17,300 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; -[JsonConverter(typeof(QueryRuleCriteriaTypeConverter))] -public enum QueryRuleCriteriaType +internal sealed partial class QueryRuleTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "suffix")] - Suffix, - [EnumMember(Value = "prefix")] - Prefix, - [EnumMember(Value = "lte")] - Lte, - [EnumMember(Value = "lt")] - Lt, - [EnumMember(Value = "gte")] - Gte, - [EnumMember(Value = "gt")] - Gt, - [EnumMember(Value = "global")] - Global, - [EnumMember(Value = "fuzzy")] - Fuzzy, - [EnumMember(Value = "exact_fuzzy")] - ExactFuzzy, - [EnumMember(Value = "exact")] - Exact, - [EnumMember(Value = "contains")] - Contains, - [EnumMember(Value = "always")] - Always -} + private static readonly System.Text.Json.JsonEncodedText MemberExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText MemberPinned = System.Text.Json.JsonEncodedText.Encode("pinned"); -internal sealed class QueryRuleCriteriaTypeConverter : JsonConverter -{ - public override QueryRuleCriteriaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "suffix": - return QueryRuleCriteriaType.Suffix; - case "prefix": - return QueryRuleCriteriaType.Prefix; - case "lte": - return QueryRuleCriteriaType.Lte; - case "lt": - return QueryRuleCriteriaType.Lt; - case "gte": - return QueryRuleCriteriaType.Gte; - case "gt": - return QueryRuleCriteriaType.Gt; - case "global": - return QueryRuleCriteriaType.Global; - case "fuzzy": - return QueryRuleCriteriaType.Fuzzy; - case "exact_fuzzy": - return QueryRuleCriteriaType.ExactFuzzy; - case "exact": - return QueryRuleCriteriaType.Exact; - case "contains": - return QueryRuleCriteriaType.Contains; - case "always": - return QueryRuleCriteriaType.Always; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberExclude)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Exclude; + } + + if (reader.ValueTextEquals(MemberPinned)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Pinned; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberExclude.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Exclude; + } + + if (string.Equals(value, MemberPinned.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Pinned; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType)}'."); } - public override void Write(Utf8JsonWriter writer, QueryRuleCriteriaType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case QueryRuleCriteriaType.Suffix: - writer.WriteStringValue("suffix"); - return; - case QueryRuleCriteriaType.Prefix: - writer.WriteStringValue("prefix"); - return; - case QueryRuleCriteriaType.Lte: - writer.WriteStringValue("lte"); - return; - case QueryRuleCriteriaType.Lt: - writer.WriteStringValue("lt"); - return; - case QueryRuleCriteriaType.Gte: - writer.WriteStringValue("gte"); - return; - case QueryRuleCriteriaType.Gt: - writer.WriteStringValue("gt"); - return; - case QueryRuleCriteriaType.Global: - writer.WriteStringValue("global"); - return; - case QueryRuleCriteriaType.Fuzzy: - writer.WriteStringValue("fuzzy"); - return; - case QueryRuleCriteriaType.ExactFuzzy: - writer.WriteStringValue("exact_fuzzy"); - return; - case QueryRuleCriteriaType.Exact: - writer.WriteStringValue("exact"); - return; - case QueryRuleCriteriaType.Contains: - writer.WriteStringValue("contains"); - return; - case QueryRuleCriteriaType.Always: - writer.WriteStringValue("always"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Exclude: + writer.WriteStringValue(MemberExclude); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType.Pinned: + writer.WriteStringValue(MemberPinned); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType)}'."); + } } -} -[JsonConverter(typeof(QueryRuleTypeConverter))] -public enum QueryRuleType -{ - [EnumMember(Value = "pinned")] - Pinned, - [EnumMember(Value = "exclude")] - Exclude + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class QueryRuleTypeConverter : JsonConverter +internal sealed partial class QueryRuleCriteriaTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override QueryRuleType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAlways = System.Text.Json.JsonEncodedText.Encode("always"); + private static readonly System.Text.Json.JsonEncodedText MemberContains = System.Text.Json.JsonEncodedText.Encode("contains"); + private static readonly System.Text.Json.JsonEncodedText MemberExact = System.Text.Json.JsonEncodedText.Encode("exact"); + private static readonly System.Text.Json.JsonEncodedText MemberExactFuzzy = System.Text.Json.JsonEncodedText.Encode("exact_fuzzy"); + private static readonly System.Text.Json.JsonEncodedText MemberFuzzy = System.Text.Json.JsonEncodedText.Encode("fuzzy"); + private static readonly System.Text.Json.JsonEncodedText MemberGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText MemberGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText MemberGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText MemberLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText MemberLte = System.Text.Json.JsonEncodedText.Encode("lte"); + private static readonly System.Text.Json.JsonEncodedText MemberPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText MemberSuffix = System.Text.Json.JsonEncodedText.Encode("suffix"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAlways)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Always; + } + + if (reader.ValueTextEquals(MemberContains)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Contains; + } + + if (reader.ValueTextEquals(MemberExact)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Exact; + } + + if (reader.ValueTextEquals(MemberExactFuzzy)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.ExactFuzzy; + } + + if (reader.ValueTextEquals(MemberFuzzy)) { - case "pinned": - return QueryRuleType.Pinned; - case "exclude": - return QueryRuleType.Exclude; + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Fuzzy; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberGlobal)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Global; + } + + if (reader.ValueTextEquals(MemberGt)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gt; + } + + if (reader.ValueTextEquals(MemberGte)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gte; + } + + if (reader.ValueTextEquals(MemberLt)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lt; + } + + if (reader.ValueTextEquals(MemberLte)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lte; + } + + if (reader.ValueTextEquals(MemberPrefix)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Prefix; + } + + if (reader.ValueTextEquals(MemberSuffix)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Suffix; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAlways.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Always; + } + + if (string.Equals(value, MemberContains.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Contains; + } + + if (string.Equals(value, MemberExact.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Exact; + } + + if (string.Equals(value, MemberExactFuzzy.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.ExactFuzzy; + } + + if (string.Equals(value, MemberFuzzy.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Fuzzy; + } + + if (string.Equals(value, MemberGlobal.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Global; + } + + if (string.Equals(value, MemberGt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gt; + } + + if (string.Equals(value, MemberGte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gte; + } + + if (string.Equals(value, MemberLt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lt; + } + + if (string.Equals(value, MemberLte.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lte; + } + + if (string.Equals(value, MemberPrefix.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Prefix; + } + + if (string.Equals(value, MemberSuffix.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Suffix; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType)}'."); } - public override void Write(Utf8JsonWriter writer, QueryRuleType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case QueryRuleType.Pinned: - writer.WriteStringValue("pinned"); - return; - case QueryRuleType.Exclude: - writer.WriteStringValue("exclude"); - return; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Always: + writer.WriteStringValue(MemberAlways); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Contains: + writer.WriteStringValue(MemberContains); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Exact: + writer.WriteStringValue(MemberExact); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.ExactFuzzy: + writer.WriteStringValue(MemberExactFuzzy); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Fuzzy: + writer.WriteStringValue(MemberFuzzy); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Global: + writer.WriteStringValue(MemberGlobal); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gt: + writer.WriteStringValue(MemberGt); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Gte: + writer.WriteStringValue(MemberGte); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lt: + writer.WriteStringValue(MemberLt); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Lte: + writer.WriteStringValue(MemberLte); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Prefix: + writer.WriteStringValue(MemberPrefix); + break; + case Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType.Suffix: + writer.WriteStringValue(MemberSuffix); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType)}'."); } + } + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleTypeConverter))] +public enum QueryRuleType +{ + [System.Runtime.Serialization.EnumMember(Value = "exclude")] + Exclude, + [System.Runtime.Serialization.EnumMember(Value = "pinned")] + Pinned +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaTypeConverter))] +public enum QueryRuleCriteriaType +{ + [System.Runtime.Serialization.EnumMember(Value = "always")] + Always, + [System.Runtime.Serialization.EnumMember(Value = "contains")] + Contains, + [System.Runtime.Serialization.EnumMember(Value = "exact")] + Exact, + [System.Runtime.Serialization.EnumMember(Value = "exact_fuzzy")] + ExactFuzzy, + [System.Runtime.Serialization.EnumMember(Value = "fuzzy")] + Fuzzy, + [System.Runtime.Serialization.EnumMember(Value = "global")] + Global, + [System.Runtime.Serialization.EnumMember(Value = "gt")] + Gt, + [System.Runtime.Serialization.EnumMember(Value = "gte")] + Gte, + [System.Runtime.Serialization.EnumMember(Value = "lt")] + Lt, + [System.Runtime.Serialization.EnumMember(Value = "lte")] + Lte, + [System.Runtime.Serialization.EnumMember(Value = "prefix")] + Prefix, + [System.Runtime.Serialization.EnumMember(Value = "suffix")] + Suffix } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Rollup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Rollup.g.cs index 21d54ddc082..f536de10a6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Rollup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Rollup.g.cs @@ -17,139 +17,236 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; -[JsonConverter(typeof(IndexingJobStateConverter))] -public enum IndexingJobState +internal sealed partial class IndexingJobStateConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "stopping")] - Stopping, - [EnumMember(Value = "stopped")] - Stopped, - [EnumMember(Value = "started")] - Started, - [EnumMember(Value = "indexing")] - Indexing, - [EnumMember(Value = "aborting")] - Aborting -} + private static readonly System.Text.Json.JsonEncodedText MemberAborting = System.Text.Json.JsonEncodedText.Encode("aborting"); + private static readonly System.Text.Json.JsonEncodedText MemberIndexing = System.Text.Json.JsonEncodedText.Encode("indexing"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText MemberStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + private static readonly System.Text.Json.JsonEncodedText MemberStopping = System.Text.Json.JsonEncodedText.Encode("stopping"); -internal sealed class IndexingJobStateConverter : JsonConverter -{ - public override IndexingJobState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Rollup.IndexingJobState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "stopping": - return IndexingJobState.Stopping; - case "stopped": - return IndexingJobState.Stopped; - case "started": - return IndexingJobState.Started; - case "indexing": - return IndexingJobState.Indexing; - case "aborting": - return IndexingJobState.Aborting; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAborting)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Aborting; + } + + if (reader.ValueTextEquals(MemberIndexing)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Indexing; + } + + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Started; + } + + if (reader.ValueTextEquals(MemberStopped)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopped; + } + + if (reader.ValueTextEquals(MemberStopping)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopping; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAborting.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Aborting; + } + + if (string.Equals(value, MemberIndexing.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Indexing; + } + + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Started; + } + + if (string.Equals(value, MemberStopped.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopped; + } + + if (string.Equals(value, MemberStopping.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopping; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Rollup.IndexingJobState)}'."); } - public override void Write(Utf8JsonWriter writer, IndexingJobState value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.IndexingJobState value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case IndexingJobState.Stopping: - writer.WriteStringValue("stopping"); - return; - case IndexingJobState.Stopped: - writer.WriteStringValue("stopped"); - return; - case IndexingJobState.Started: - writer.WriteStringValue("started"); - return; - case IndexingJobState.Indexing: - writer.WriteStringValue("indexing"); - return; - case IndexingJobState.Aborting: - writer.WriteStringValue("aborting"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Aborting: + writer.WriteStringValue(MemberAborting); + break; + case Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Indexing: + writer.WriteStringValue(MemberIndexing); + break; + case Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Started: + writer.WriteStringValue(MemberStarted); + break; + case Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopped: + writer.WriteStringValue(MemberStopped); + break; + case Elastic.Clients.Elasticsearch.Rollup.IndexingJobState.Stopping: + writer.WriteStringValue(MemberStopping); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Rollup.IndexingJobState)}'."); + } } -} -[JsonConverter(typeof(MetricConverter))] -public enum Metric -{ - [EnumMember(Value = "value_count")] - ValueCount, - [EnumMember(Value = "sum")] - Sum, - [EnumMember(Value = "min")] - Min, - [EnumMember(Value = "max")] - Max, - [EnumMember(Value = "avg")] - Avg + public override Elastic.Clients.Elasticsearch.Rollup.IndexingJobState ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.IndexingJobState value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class MetricConverter : JsonConverter +internal sealed partial class MetricConverter : System.Text.Json.Serialization.JsonConverter { - public override Metric Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText MemberMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText MemberMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText MemberSum = System.Text.Json.JsonEncodedText.Encode("sum"); + private static readonly System.Text.Json.JsonEncodedText MemberValueCount = System.Text.Json.JsonEncodedText.Encode("value_count"); + + public override Elastic.Clients.Elasticsearch.Rollup.Metric Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) - { - case "value_count": - return Metric.ValueCount; - case "sum": - return Metric.Sum; - case "min": - return Metric.Min; - case "max": - return Metric.Max; - case "avg": - return Metric.Avg; - } - - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberAvg)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Avg; + } + + if (reader.ValueTextEquals(MemberMax)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Max; + } + + if (reader.ValueTextEquals(MemberMin)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Min; + } + + if (reader.ValueTextEquals(MemberSum)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Sum; + } + + if (reader.ValueTextEquals(MemberValueCount)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.ValueCount; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAvg.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Avg; + } + + if (string.Equals(value, MemberMax.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Max; + } + + if (string.Equals(value, MemberMin.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Min; + } + + if (string.Equals(value, MemberSum.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.Sum; + } + + if (string.Equals(value, MemberValueCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Rollup.Metric.ValueCount; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Rollup.Metric)}'."); } - public override void Write(Utf8JsonWriter writer, Metric value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.Metric value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case Metric.ValueCount: - writer.WriteStringValue("value_count"); - return; - case Metric.Sum: - writer.WriteStringValue("sum"); - return; - case Metric.Min: - writer.WriteStringValue("min"); - return; - case Metric.Max: - writer.WriteStringValue("max"); - return; - case Metric.Avg: - writer.WriteStringValue("avg"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Rollup.Metric.Avg: + writer.WriteStringValue(MemberAvg); + break; + case Elastic.Clients.Elasticsearch.Rollup.Metric.Max: + writer.WriteStringValue(MemberMax); + break; + case Elastic.Clients.Elasticsearch.Rollup.Metric.Min: + writer.WriteStringValue(MemberMin); + break; + case Elastic.Clients.Elasticsearch.Rollup.Metric.Sum: + writer.WriteStringValue(MemberSum); + break; + case Elastic.Clients.Elasticsearch.Rollup.Metric.ValueCount: + writer.WriteStringValue(MemberValueCount); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Rollup.Metric)}'."); + } } + + public override Elastic.Clients.Elasticsearch.Rollup.Metric ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.Metric value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.IndexingJobStateConverter))] +public enum IndexingJobState +{ + [System.Runtime.Serialization.EnumMember(Value = "aborting")] + Aborting, + [System.Runtime.Serialization.EnumMember(Value = "indexing")] + Indexing, + [System.Runtime.Serialization.EnumMember(Value = "started")] + Started, + [System.Runtime.Serialization.EnumMember(Value = "stopped")] + Stopped, + [System.Runtime.Serialization.EnumMember(Value = "stopping")] + Stopping +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.MetricConverter))] +public enum Metric +{ + [System.Runtime.Serialization.EnumMember(Value = "avg")] + Avg, + [System.Runtime.Serialization.EnumMember(Value = "max")] + Max, + [System.Runtime.Serialization.EnumMember(Value = "min")] + Min, + [System.Runtime.Serialization.EnumMember(Value = "sum")] + Sum, + [System.Runtime.Serialization.EnumMember(Value = "value_count")] + ValueCount } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchApplication.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchApplication.g.cs index 0b57910379c..c19bc96d1c2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchApplication.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchApplication.g.cs @@ -17,62 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -[JsonConverter(typeof(EventTypeConverter))] -public enum EventType +internal sealed partial class EventTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "search_click")] - Searchclick, - [EnumMember(Value = "search")] - Search, - [EnumMember(Value = "page_view")] - Pageview -} + private static readonly System.Text.Json.JsonEncodedText MemberPageView = System.Text.Json.JsonEncodedText.Encode("page_view"); + private static readonly System.Text.Json.JsonEncodedText MemberSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText MemberSearchClick = System.Text.Json.JsonEncodedText.Encode("search_click"); -internal sealed class EventTypeConverter : JsonConverter -{ - public override EventType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.SearchApplication.EventType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberPageView)) + { + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.PageView; + } + + if (reader.ValueTextEquals(MemberSearch)) + { + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.Search; + } + + if (reader.ValueTextEquals(MemberSearchClick)) { - case "search_click": - return EventType.Searchclick; - case "search": - return EventType.Search; - case "page_view": - return EventType.Pageview; + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.SearchClick; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberPageView.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.PageView; + } + + if (string.Equals(value, MemberSearch.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.Search; + } + + if (string.Equals(value, MemberSearchClick.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchApplication.EventType.SearchClick; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchApplication.EventType)}'."); } - public override void Write(Utf8JsonWriter writer, EventType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.EventType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case EventType.Searchclick: - writer.WriteStringValue("search_click"); - return; - case EventType.Search: - writer.WriteStringValue("search"); - return; - case EventType.Pageview: - writer.WriteStringValue("page_view"); - return; + case Elastic.Clients.Elasticsearch.SearchApplication.EventType.PageView: + writer.WriteStringValue(MemberPageView); + break; + case Elastic.Clients.Elasticsearch.SearchApplication.EventType.Search: + writer.WriteStringValue(MemberSearch); + break; + case Elastic.Clients.Elasticsearch.SearchApplication.EventType.SearchClick: + writer.WriteStringValue(MemberSearchClick); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchApplication.EventType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.SearchApplication.EventType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.EventType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.EventTypeConverter))] +public enum EventType +{ + [System.Runtime.Serialization.EnumMember(Value = "page_view")] + PageView, + [System.Runtime.Serialization.EnumMember(Value = "search")] + Search, + [System.Runtime.Serialization.EnumMember(Value = "search_click")] + SearchClick } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchableSnapshots.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchableSnapshots.g.cs index 347c56fa44b..fc12f17cf13 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchableSnapshots.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.SearchableSnapshots.g.cs @@ -17,62 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; -[JsonConverter(typeof(StatsLevelConverter))] -public enum StatsLevel +internal sealed partial class StatsLevelConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "shards")] - Shards, - [EnumMember(Value = "indices")] - Indices, - [EnumMember(Value = "cluster")] - Cluster -} + private static readonly System.Text.Json.JsonEncodedText MemberCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText MemberIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText MemberShards = System.Text.Json.JsonEncodedText.Encode("shards"); -internal sealed class StatsLevelConverter : JsonConverter -{ - public override StatsLevel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCluster)) + { + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Cluster; + } + + if (reader.ValueTextEquals(MemberIndices)) + { + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Indices; + } + + if (reader.ValueTextEquals(MemberShards)) { - case "shards": - return StatsLevel.Shards; - case "indices": - return StatsLevel.Indices; - case "cluster": - return StatsLevel.Cluster; + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Shards; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberCluster.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Cluster; + } + + if (string.Equals(value, MemberIndices.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Indices; + } + + if (string.Equals(value, MemberShards.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Shards; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel)}'."); } - public override void Write(Utf8JsonWriter writer, StatsLevel value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case StatsLevel.Shards: - writer.WriteStringValue("shards"); - return; - case StatsLevel.Indices: - writer.WriteStringValue("indices"); - return; - case StatsLevel.Cluster: - writer.WriteStringValue("cluster"); - return; + case Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Cluster: + writer.WriteStringValue(MemberCluster); + break; + case Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Indices: + writer.WriteStringValue(MemberIndices); + break; + case Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel.Shards: + writer.WriteStringValue(MemberShards); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevel value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.StatsLevelConverter))] +public enum StatsLevel +{ + [System.Runtime.Serialization.EnumMember(Value = "cluster")] + Cluster, + [System.Runtime.Serialization.EnumMember(Value = "indices")] + Indices, + [System.Runtime.Serialization.EnumMember(Value = "shards")] + Shards } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs index d2100d3b8df..d4e0241bb45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs @@ -17,353 +17,610 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(AccessTokenGrantTypeConverter))] -public enum AccessTokenGrantType +internal sealed partial class AccessTokenGrantTypeConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// This grant type implements the Refresh Token Grant of OAuth2. - /// In this grant a user exchanges a previously issued refresh token for a new access token and a new refresh token. - /// - /// - [EnumMember(Value = "refresh_token")] - RefreshToken, - /// - /// - /// This grant type implements the Resource Owner Password Credentials Grant of OAuth2. - /// In this grant, a trusted client exchanges the end user's credentials for an access token and (possibly) a refresh token. - /// The request needs to be made by an authenticated user but happens on behalf of another authenticated user (the one whose credentials are passed as request parameters). - /// This grant type is not suitable or designed for the self-service user creation of tokens. - /// - /// - [EnumMember(Value = "password")] - Password, - /// - /// - /// This grant type is supported internally and implements SPNEGO based Kerberos support. - /// The _kerberos grant type may change from version to version. - /// - /// - [EnumMember(Value = "_kerberos")] - Kerberos, - /// - /// - /// This grant type implements the Client Credentials Grant of OAuth2. - /// It is geared for machine to machine communication and is not suitable or designed for the self-service user creation of tokens. - /// It generates only access tokens that cannot be refreshed. - /// The premise is that the entity that uses client_credentials has constant access to a set of (client, not end-user) credentials and can authenticate itself at will. - /// - /// - [EnumMember(Value = "client_credentials")] - ClientCredentials -} + private static readonly System.Text.Json.JsonEncodedText MemberKerberos = System.Text.Json.JsonEncodedText.Encode("_kerberos"); + private static readonly System.Text.Json.JsonEncodedText MemberClientCredentials = System.Text.Json.JsonEncodedText.Encode("client_credentials"); + private static readonly System.Text.Json.JsonEncodedText MemberPassword = System.Text.Json.JsonEncodedText.Encode("password"); + private static readonly System.Text.Json.JsonEncodedText MemberRefreshToken = System.Text.Json.JsonEncodedText.Encode("refresh_token"); -internal sealed class AccessTokenGrantTypeConverter : JsonConverter -{ - public override AccessTokenGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberKerberos)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Kerberos; + } + + if (reader.ValueTextEquals(MemberClientCredentials)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.ClientCredentials; + } + + if (reader.ValueTextEquals(MemberPassword)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Password; + } + + if (reader.ValueTextEquals(MemberRefreshToken)) { - case "refresh_token": - return AccessTokenGrantType.RefreshToken; - case "password": - return AccessTokenGrantType.Password; - case "_kerberos": - return AccessTokenGrantType.Kerberos; - case "client_credentials": - return AccessTokenGrantType.ClientCredentials; + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.RefreshToken; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberKerberos.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Kerberos; + } + + if (string.Equals(value, MemberClientCredentials.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.ClientCredentials; + } + + if (string.Equals(value, MemberPassword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Password; + } + + if (string.Equals(value, MemberRefreshToken.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.RefreshToken; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType)}'."); } - public override void Write(Utf8JsonWriter writer, AccessTokenGrantType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case AccessTokenGrantType.RefreshToken: - writer.WriteStringValue("refresh_token"); - return; - case AccessTokenGrantType.Password: - writer.WriteStringValue("password"); - return; - case AccessTokenGrantType.Kerberos: - writer.WriteStringValue("_kerberos"); - return; - case AccessTokenGrantType.ClientCredentials: - writer.WriteStringValue("client_credentials"); - return; - } - - writer.WriteNullValue(); + case Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Kerberos: + writer.WriteStringValue(MemberKerberos); + break; + case Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.ClientCredentials: + writer.WriteStringValue(MemberClientCredentials); + break; + case Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.Password: + writer.WriteStringValue(MemberPassword); + break; + case Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType.RefreshToken: + writer.WriteStringValue(MemberRefreshToken); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(ApiKeyGrantTypeConverter))] -public enum ApiKeyGrantType +internal sealed partial class ApiKeyGrantTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "password")] - Password, - [EnumMember(Value = "access_token")] - AccessToken + private static readonly System.Text.Json.JsonEncodedText MemberAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText MemberPassword = System.Text.Json.JsonEncodedText.Encode("password"); + + public override Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberAccessToken)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.AccessToken; + } + + if (reader.ValueTextEquals(MemberPassword)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.Password; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAccessToken.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.AccessToken; + } + + if (string.Equals(value, MemberPassword.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.Password; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.AccessToken: + writer.WriteStringValue(MemberAccessToken); + break; + case Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType.Password: + writer.WriteStringValue(MemberPassword); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class ApiKeyGrantTypeConverter : JsonConverter +internal sealed partial class GrantTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override ApiKeyGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberAccessToken = System.Text.Json.JsonEncodedText.Encode("access_token"); + private static readonly System.Text.Json.JsonEncodedText MemberPassword = System.Text.Json.JsonEncodedText.Encode("password"); + + public override Elastic.Clients.Elasticsearch.Security.GrantType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberAccessToken)) + { + return Elastic.Clients.Elasticsearch.Security.GrantType.AccessToken; + } + + if (reader.ValueTextEquals(MemberPassword)) + { + return Elastic.Clients.Elasticsearch.Security.GrantType.Password; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberAccessToken.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.GrantType.AccessToken; + } + + if (string.Equals(value, MemberPassword.Value, System.StringComparison.OrdinalIgnoreCase)) { - case "password": - return ApiKeyGrantType.Password; - case "access_token": - return ApiKeyGrantType.AccessToken; + return Elastic.Clients.Elasticsearch.Security.GrantType.Password; } - ThrowHelper.ThrowJsonException(); - return default; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.GrantType)}'."); } - public override void Write(Utf8JsonWriter writer, ApiKeyGrantType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GrantType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ApiKeyGrantType.Password: - writer.WriteStringValue("password"); - return; - case ApiKeyGrantType.AccessToken: - writer.WriteStringValue("access_token"); - return; + case Elastic.Clients.Elasticsearch.Security.GrantType.AccessToken: + writer.WriteStringValue(MemberAccessToken); + break; + case Elastic.Clients.Elasticsearch.Security.GrantType.Password: + writer.WriteStringValue(MemberPassword); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.GrantType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Security.GrantType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GrantType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(ApiKeyTypeConverter))] -public enum ApiKeyType +internal sealed partial class ClusterPrivilegeConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.ClusterPrivilege Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Security.ClusterPrivilege(reader.ReadValue(options, null)); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClusterPrivilege value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } +} + +internal sealed partial class IndexPrivilegeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "rest")] - Rest, - [EnumMember(Value = "cross_cluster")] - CrossCluster + public override Elastic.Clients.Elasticsearch.Security.IndexPrivilege Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Security.IndexPrivilege(reader.ReadValue(options, null)); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.IndexPrivilege value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } } -internal sealed class ApiKeyTypeConverter : JsonConverter +internal sealed partial class RemoteClusterPrivilegeConverter : System.Text.Json.Serialization.JsonConverter { - public override ApiKeyType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberMonitorEnrich = System.Text.Json.JsonEncodedText.Encode("monitor_enrich"); + private static readonly System.Text.Json.JsonEncodedText MemberMonitorStats = System.Text.Json.JsonEncodedText.Encode("monitor_stats"); + + public override Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberMonitorEnrich)) { - case "rest": - return ApiKeyType.Rest; - case "cross_cluster": - return ApiKeyType.CrossCluster; + return Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorEnrich; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberMonitorStats)) + { + return Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorStats; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberMonitorEnrich.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorEnrich; + } + + if (string.Equals(value, MemberMonitorStats.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorStats; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege)}'."); } - public override void Write(Utf8JsonWriter writer, ApiKeyType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ApiKeyType.Rest: - writer.WriteStringValue("rest"); - return; - case ApiKeyType.CrossCluster: - writer.WriteStringValue("cross_cluster"); - return; + case Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorEnrich: + writer.WriteStringValue(MemberMonitorEnrich); + break; + case Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege.MonitorStats: + writer.WriteStringValue(MemberMonitorStats); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct ClusterPrivilege : IEnumStruct +internal sealed partial class TemplateFormatConverter : System.Text.Json.Serialization.JsonConverter { - public ClusterPrivilege(string value) => Value = value; + private static readonly System.Text.Json.JsonEncodedText MemberJson = System.Text.Json.JsonEncodedText.Encode("json"); + private static readonly System.Text.Json.JsonEncodedText MemberString = System.Text.Json.JsonEncodedText.Encode("string"); - ClusterPrivilege IEnumStruct.Create(string value) => value; + public override Elastic.Clients.Elasticsearch.Security.TemplateFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberJson)) + { + return Elastic.Clients.Elasticsearch.Security.TemplateFormat.Json; + } - public readonly string Value { get; } - public static ClusterPrivilege WriteFleetSecrets { get; } = new ClusterPrivilege("write_fleet_secrets"); - public static ClusterPrivilege WriteConnectorSecrets { get; } = new ClusterPrivilege("write_connector_secrets"); - public static ClusterPrivilege TransportClient { get; } = new ClusterPrivilege("transport_client"); - public static ClusterPrivilege ReadSlm { get; } = new ClusterPrivilege("read_slm"); - public static ClusterPrivilege ReadSecurity { get; } = new ClusterPrivilege("read_security"); - public static ClusterPrivilege ReadPipeline { get; } = new ClusterPrivilege("read_pipeline"); - public static ClusterPrivilege ReadIlm { get; } = new ClusterPrivilege("read_ilm"); - public static ClusterPrivilege ReadFleetSecrets { get; } = new ClusterPrivilege("read_fleet_secrets"); - public static ClusterPrivilege ReadCcr { get; } = new ClusterPrivilege("read_ccr"); - public static ClusterPrivilege PostBehavioralAnalyticsEvent { get; } = new ClusterPrivilege("post_behavioral_analytics_event"); - public static ClusterPrivilege None { get; } = new ClusterPrivilege("none"); - public static ClusterPrivilege MonitorWatcher { get; } = new ClusterPrivilege("monitor_watcher"); - public static ClusterPrivilege MonitorTransform { get; } = new ClusterPrivilege("monitor_transform"); - public static ClusterPrivilege MonitorTextStructure { get; } = new ClusterPrivilege("monitor_text_structure"); - public static ClusterPrivilege MonitorStats { get; } = new ClusterPrivilege("monitor_stats"); - public static ClusterPrivilege MonitorSnapshot { get; } = new ClusterPrivilege("monitor_snapshot"); - public static ClusterPrivilege MonitorRollup { get; } = new ClusterPrivilege("monitor_rollup"); - public static ClusterPrivilege MonitorMl { get; } = new ClusterPrivilege("monitor_ml"); - public static ClusterPrivilege MonitorInference { get; } = new ClusterPrivilege("monitor_inference"); - public static ClusterPrivilege MonitorEnrich { get; } = new ClusterPrivilege("monitor_enrich"); - public static ClusterPrivilege MonitorDataStreamGlobalRetention { get; } = new ClusterPrivilege("monitor_data_stream_global_retention"); - public static ClusterPrivilege MonitorDataFrameTransforms { get; } = new ClusterPrivilege("monitor_data_frame_transforms"); - public static ClusterPrivilege Monitor { get; } = new ClusterPrivilege("monitor"); - public static ClusterPrivilege ManageWatcher { get; } = new ClusterPrivilege("manage_watcher"); - public static ClusterPrivilege ManageUserProfile { get; } = new ClusterPrivilege("manage_user_profile"); - public static ClusterPrivilege ManageTransform { get; } = new ClusterPrivilege("manage_transform"); - public static ClusterPrivilege ManageToken { get; } = new ClusterPrivilege("manage_token"); - public static ClusterPrivilege ManageSlm { get; } = new ClusterPrivilege("manage_slm"); - public static ClusterPrivilege ManageServiceAccount { get; } = new ClusterPrivilege("manage_service_account"); - public static ClusterPrivilege ManageSecurity { get; } = new ClusterPrivilege("manage_security"); - public static ClusterPrivilege ManageSearchSynonyms { get; } = new ClusterPrivilege("manage_search_synonyms"); - public static ClusterPrivilege ManageSearchQueryRules { get; } = new ClusterPrivilege("manage_search_query_rules"); - public static ClusterPrivilege ManageSearchApplication { get; } = new ClusterPrivilege("manage_search_application"); - public static ClusterPrivilege ManageSaml { get; } = new ClusterPrivilege("manage_saml"); - public static ClusterPrivilege ManageRollup { get; } = new ClusterPrivilege("manage_rollup"); - public static ClusterPrivilege ManagePipeline { get; } = new ClusterPrivilege("manage_pipeline"); - public static ClusterPrivilege ManageOwnApiKey { get; } = new ClusterPrivilege("manage_own_api_key"); - public static ClusterPrivilege ManageOidc { get; } = new ClusterPrivilege("manage_oidc"); - public static ClusterPrivilege ManageMl { get; } = new ClusterPrivilege("manage_ml"); - public static ClusterPrivilege ManageLogstashPipelines { get; } = new ClusterPrivilege("manage_logstash_pipelines"); - public static ClusterPrivilege ManageIngestPipelines { get; } = new ClusterPrivilege("manage_ingest_pipelines"); - public static ClusterPrivilege ManageInference { get; } = new ClusterPrivilege("manage_inference"); - public static ClusterPrivilege ManageIndexTemplates { get; } = new ClusterPrivilege("manage_index_templates"); - public static ClusterPrivilege ManageIlm { get; } = new ClusterPrivilege("manage_ilm"); - public static ClusterPrivilege ManageEnrich { get; } = new ClusterPrivilege("manage_enrich"); - public static ClusterPrivilege ManageDataStreamGlobalRetention { get; } = new ClusterPrivilege("manage_data_stream_global_retention"); - public static ClusterPrivilege ManageDataFrameTransforms { get; } = new ClusterPrivilege("manage_data_frame_transforms"); - public static ClusterPrivilege ManageCcr { get; } = new ClusterPrivilege("manage_ccr"); - public static ClusterPrivilege ManageBehavioralAnalytics { get; } = new ClusterPrivilege("manage_behavioral_analytics"); - public static ClusterPrivilege ManageAutoscaling { get; } = new ClusterPrivilege("manage_autoscaling"); - public static ClusterPrivilege ManageApiKey { get; } = new ClusterPrivilege("manage_api_key"); - public static ClusterPrivilege Manage { get; } = new ClusterPrivilege("manage"); - public static ClusterPrivilege GrantApiKey { get; } = new ClusterPrivilege("grant_api_key"); - public static ClusterPrivilege DelegatePki { get; } = new ClusterPrivilege("delegate_pki"); - public static ClusterPrivilege CrossClusterSearch { get; } = new ClusterPrivilege("cross_cluster_search"); - public static ClusterPrivilege CrossClusterReplication { get; } = new ClusterPrivilege("cross_cluster_replication"); - public static ClusterPrivilege CreateSnapshot { get; } = new ClusterPrivilege("create_snapshot"); - public static ClusterPrivilege CancelTask { get; } = new ClusterPrivilege("cancel_task"); - public static ClusterPrivilege All { get; } = new ClusterPrivilege("all"); + if (reader.ValueTextEquals(MemberString)) + { + return Elastic.Clients.Elasticsearch.Security.TemplateFormat.String; + } - public override string ToString() => Value ?? string.Empty; + var value = reader.GetString()!; + if (string.Equals(value, MemberJson.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.TemplateFormat.Json; + } - public static implicit operator string(ClusterPrivilege clusterPrivilege) => clusterPrivilege.Value; - public static implicit operator ClusterPrivilege(string value) => new(value); + if (string.Equals(value, MemberString.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.TemplateFormat.String; + } - public override int GetHashCode() => Value.GetHashCode(); - public override bool Equals(object obj) => obj is ClusterPrivilege other && this.Equals(other); - public bool Equals(ClusterPrivilege other) => Value == other.Value; + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.TemplateFormat)}'."); + } - public static bool operator ==(ClusterPrivilege a, ClusterPrivilege b) => a.Equals(b); - public static bool operator !=(ClusterPrivilege a, ClusterPrivilege b) => !(a == b); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.TemplateFormat value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Security.TemplateFormat.Json: + writer.WriteStringValue(MemberJson); + break; + case Elastic.Clients.Elasticsearch.Security.TemplateFormat.String: + writer.WriteStringValue(MemberString); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.TemplateFormat)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Security.TemplateFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.TemplateFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -[JsonConverter(typeof(GrantTypeConverter))] -public enum GrantType +internal sealed partial class RestrictionWorkflowConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Security.RestrictionWorkflow Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.Security.RestrictionWorkflow(reader.ReadValue(options, null)); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RestrictionWorkflow value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.Value, null); + } +} + +internal sealed partial class ApiKeyTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberCrossCluster = System.Text.Json.JsonEncodedText.Encode("cross_cluster"); + private static readonly System.Text.Json.JsonEncodedText MemberRest = System.Text.Json.JsonEncodedText.Encode("rest"); + + public override Elastic.Clients.Elasticsearch.Security.ApiKeyType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberCrossCluster)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyType.CrossCluster; + } + + if (reader.ValueTextEquals(MemberRest)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyType.Rest; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCrossCluster.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyType.CrossCluster; + } + + if (string.Equals(value, MemberRest.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Security.ApiKeyType.Rest; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyType)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyType value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Security.ApiKeyType.CrossCluster: + writer.WriteStringValue(MemberCrossCluster); + break; + case Elastic.Clients.Elasticsearch.Security.ApiKeyType.Rest: + writer.WriteStringValue(MemberRest); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyType)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Security.ApiKeyType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantTypeConverter))] +public enum AccessTokenGrantType { /// /// - /// In this type of grant, you must supply the user ID and password for which you want to create the API key. + /// This grant type is supported internally and implements SPNEGO based Kerberos support. + /// The _kerberos grant type may change from version to version. /// /// - [EnumMember(Value = "password")] + [System.Runtime.Serialization.EnumMember(Value = "_kerberos")] + Kerberos, + /// + /// + /// This grant type implements the Client Credentials Grant of OAuth2. + /// It is geared for machine to machine communication and is not suitable or designed for the self-service user creation of tokens. + /// It generates only access tokens that cannot be refreshed. + /// The premise is that the entity that uses client_credentials has constant access to a set of (client, not end-user) credentials and can authenticate itself at will. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "client_credentials")] + ClientCredentials, + /// + /// + /// This grant type implements the Resource Owner Password Credentials Grant of OAuth2. + /// In this grant, a trusted client exchanges the end user's credentials for an access token and (possibly) a refresh token. + /// The request needs to be made by an authenticated user but happens on behalf of another authenticated user (the one whose credentials are passed as request parameters). + /// This grant type is not suitable or designed for the self-service user creation of tokens. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "password")] Password, + /// + /// + /// This grant type implements the Refresh Token Grant of OAuth2. + /// In this grant a user exchanges a previously issued refresh token for a new access token and a new refresh token. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "refresh_token")] + RefreshToken +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantTypeConverter))] +public enum ApiKeyGrantType +{ + [System.Runtime.Serialization.EnumMember(Value = "access_token")] + AccessToken, + [System.Runtime.Serialization.EnumMember(Value = "password")] + Password +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GrantTypeConverter))] +public enum GrantType +{ /// /// /// In this type of grant, you must supply an access token that was created by the Elasticsearch token service. /// If you are activating a user profile, you can alternatively supply a JWT (either a JWT access_token or a JWT id_token). /// /// - [EnumMember(Value = "access_token")] - AccessToken + [System.Runtime.Serialization.EnumMember(Value = "access_token")] + AccessToken, + /// + /// + /// In this type of grant, you must supply the user ID and password for which you want to create the API key. + /// + /// + [System.Runtime.Serialization.EnumMember(Value = "password")] + Password } -internal sealed class GrantTypeConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClusterPrivilegeConverter))] +public readonly partial struct ClusterPrivilege : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct { - public override GrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "password": - return GrantType.Password; - case "access_token": - return GrantType.AccessToken; - } + public ClusterPrivilege(string value) => Value = value; +#if NET7_0_OR_GREATER + static ClusterPrivilege IEnumStruct.Create(string value) => value; +#else + ClusterPrivilege IEnumStruct.Create(string value) => value; +#endif + public readonly string Value { get; } + public static ClusterPrivilege All { get; } = new ClusterPrivilege("all"); + public static ClusterPrivilege CancelTask { get; } = new ClusterPrivilege("cancel_task"); + public static ClusterPrivilege CreateSnapshot { get; } = new ClusterPrivilege("create_snapshot"); + public static ClusterPrivilege CrossClusterReplication { get; } = new ClusterPrivilege("cross_cluster_replication"); + public static ClusterPrivilege CrossClusterSearch { get; } = new ClusterPrivilege("cross_cluster_search"); + public static ClusterPrivilege DelegatePki { get; } = new ClusterPrivilege("delegate_pki"); + public static ClusterPrivilege GrantApiKey { get; } = new ClusterPrivilege("grant_api_key"); + public static ClusterPrivilege Manage { get; } = new ClusterPrivilege("manage"); + public static ClusterPrivilege ManageApiKey { get; } = new ClusterPrivilege("manage_api_key"); + public static ClusterPrivilege ManageAutoscaling { get; } = new ClusterPrivilege("manage_autoscaling"); + public static ClusterPrivilege ManageBehavioralAnalytics { get; } = new ClusterPrivilege("manage_behavioral_analytics"); + public static ClusterPrivilege ManageCcr { get; } = new ClusterPrivilege("manage_ccr"); + public static ClusterPrivilege ManageDataFrameTransforms { get; } = new ClusterPrivilege("manage_data_frame_transforms"); + public static ClusterPrivilege ManageDataStreamGlobalRetention { get; } = new ClusterPrivilege("manage_data_stream_global_retention"); + public static ClusterPrivilege ManageEnrich { get; } = new ClusterPrivilege("manage_enrich"); + public static ClusterPrivilege ManageIlm { get; } = new ClusterPrivilege("manage_ilm"); + public static ClusterPrivilege ManageIndexTemplates { get; } = new ClusterPrivilege("manage_index_templates"); + public static ClusterPrivilege ManageInference { get; } = new ClusterPrivilege("manage_inference"); + public static ClusterPrivilege ManageIngestPipelines { get; } = new ClusterPrivilege("manage_ingest_pipelines"); + public static ClusterPrivilege ManageLogstashPipelines { get; } = new ClusterPrivilege("manage_logstash_pipelines"); + public static ClusterPrivilege ManageMl { get; } = new ClusterPrivilege("manage_ml"); + public static ClusterPrivilege ManageOidc { get; } = new ClusterPrivilege("manage_oidc"); + public static ClusterPrivilege ManageOwnApiKey { get; } = new ClusterPrivilege("manage_own_api_key"); + public static ClusterPrivilege ManagePipeline { get; } = new ClusterPrivilege("manage_pipeline"); + public static ClusterPrivilege ManageRollup { get; } = new ClusterPrivilege("manage_rollup"); + public static ClusterPrivilege ManageSaml { get; } = new ClusterPrivilege("manage_saml"); + public static ClusterPrivilege ManageSearchApplication { get; } = new ClusterPrivilege("manage_search_application"); + public static ClusterPrivilege ManageSearchQueryRules { get; } = new ClusterPrivilege("manage_search_query_rules"); + public static ClusterPrivilege ManageSearchSynonyms { get; } = new ClusterPrivilege("manage_search_synonyms"); + public static ClusterPrivilege ManageSecurity { get; } = new ClusterPrivilege("manage_security"); + public static ClusterPrivilege ManageServiceAccount { get; } = new ClusterPrivilege("manage_service_account"); + public static ClusterPrivilege ManageSlm { get; } = new ClusterPrivilege("manage_slm"); + public static ClusterPrivilege ManageToken { get; } = new ClusterPrivilege("manage_token"); + public static ClusterPrivilege ManageTransform { get; } = new ClusterPrivilege("manage_transform"); + public static ClusterPrivilege ManageUserProfile { get; } = new ClusterPrivilege("manage_user_profile"); + public static ClusterPrivilege ManageWatcher { get; } = new ClusterPrivilege("manage_watcher"); + public static ClusterPrivilege Monitor { get; } = new ClusterPrivilege("monitor"); + public static ClusterPrivilege MonitorDataFrameTransforms { get; } = new ClusterPrivilege("monitor_data_frame_transforms"); + public static ClusterPrivilege MonitorDataStreamGlobalRetention { get; } = new ClusterPrivilege("monitor_data_stream_global_retention"); + public static ClusterPrivilege MonitorEnrich { get; } = new ClusterPrivilege("monitor_enrich"); + public static ClusterPrivilege MonitorInference { get; } = new ClusterPrivilege("monitor_inference"); + public static ClusterPrivilege MonitorMl { get; } = new ClusterPrivilege("monitor_ml"); + public static ClusterPrivilege MonitorRollup { get; } = new ClusterPrivilege("monitor_rollup"); + public static ClusterPrivilege MonitorSnapshot { get; } = new ClusterPrivilege("monitor_snapshot"); + public static ClusterPrivilege MonitorStats { get; } = new ClusterPrivilege("monitor_stats"); + public static ClusterPrivilege MonitorTextStructure { get; } = new ClusterPrivilege("monitor_text_structure"); + public static ClusterPrivilege MonitorTransform { get; } = new ClusterPrivilege("monitor_transform"); + public static ClusterPrivilege MonitorWatcher { get; } = new ClusterPrivilege("monitor_watcher"); + public static ClusterPrivilege None { get; } = new ClusterPrivilege("none"); + public static ClusterPrivilege PostBehavioralAnalyticsEvent { get; } = new ClusterPrivilege("post_behavioral_analytics_event"); + public static ClusterPrivilege ReadCcr { get; } = new ClusterPrivilege("read_ccr"); + public static ClusterPrivilege ReadFleetSecrets { get; } = new ClusterPrivilege("read_fleet_secrets"); + public static ClusterPrivilege ReadIlm { get; } = new ClusterPrivilege("read_ilm"); + public static ClusterPrivilege ReadPipeline { get; } = new ClusterPrivilege("read_pipeline"); + public static ClusterPrivilege ReadSecurity { get; } = new ClusterPrivilege("read_security"); + public static ClusterPrivilege ReadSlm { get; } = new ClusterPrivilege("read_slm"); + public static ClusterPrivilege TransportClient { get; } = new ClusterPrivilege("transport_client"); + public static ClusterPrivilege WriteConnectorSecrets { get; } = new ClusterPrivilege("write_connector_secrets"); + public static ClusterPrivilege WriteFleetSecrets { get; } = new ClusterPrivilege("write_fleet_secrets"); - ThrowHelper.ThrowJsonException(); - return default; - } + public override string ToString() => Value ?? string.Empty; - public override void Write(Utf8JsonWriter writer, GrantType value, JsonSerializerOptions options) - { - switch (value) - { - case GrantType.Password: - writer.WriteStringValue("password"); - return; - case GrantType.AccessToken: - writer.WriteStringValue("access_token"); - return; - } + public static implicit operator string(ClusterPrivilege @enum) => @enum.Value; + public static implicit operator ClusterPrivilege(string value) => new(value); - writer.WriteNullValue(); - } + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is ClusterPrivilege other && this.Equals(other); + public bool Equals(ClusterPrivilege other) => Value == other.Value; + + public static bool operator ==(ClusterPrivilege a, ClusterPrivilege b) => a.Equals(b); + public static bool operator !=(ClusterPrivilege a, ClusterPrivilege b) => !(a == b); } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct IndexPrivilege : IEnumStruct +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.IndexPrivilegeConverter))] +public readonly partial struct IndexPrivilege : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct { public IndexPrivilege(string value) => Value = value; - +#if NET7_0_OR_GREATER + static IndexPrivilege IEnumStruct.Create(string value) => value; +#else IndexPrivilege IEnumStruct.Create(string value) => value; - +#endif public readonly string Value { get; } - public static IndexPrivilege Write { get; } = new IndexPrivilege("write"); - public static IndexPrivilege ViewIndexMetadata { get; } = new IndexPrivilege("view_index_metadata"); - public static IndexPrivilege ReadCrossCluster { get; } = new IndexPrivilege("read_cross_cluster"); - public static IndexPrivilege Read { get; } = new IndexPrivilege("read"); - public static IndexPrivilege None { get; } = new IndexPrivilege("none"); - public static IndexPrivilege Monitor { get; } = new IndexPrivilege("monitor"); - public static IndexPrivilege ManageLeaderIndex { get; } = new IndexPrivilege("manage_leader_index"); - public static IndexPrivilege ManageIlm { get; } = new IndexPrivilege("manage_ilm"); - public static IndexPrivilege ManageFollowIndex { get; } = new IndexPrivilege("manage_follow_index"); - public static IndexPrivilege ManageDataStreamLifecycle { get; } = new IndexPrivilege("manage_data_stream_lifecycle"); - public static IndexPrivilege Manage { get; } = new IndexPrivilege("manage"); - public static IndexPrivilege Maintenance { get; } = new IndexPrivilege("maintenance"); - public static IndexPrivilege Index { get; } = new IndexPrivilege("index"); - public static IndexPrivilege DeleteIndex { get; } = new IndexPrivilege("delete_index"); - public static IndexPrivilege Delete { get; } = new IndexPrivilege("delete"); - public static IndexPrivilege CrossClusterReplicationInternal { get; } = new IndexPrivilege("cross_cluster_replication_internal"); - public static IndexPrivilege CrossClusterReplication { get; } = new IndexPrivilege("cross_cluster_replication"); - public static IndexPrivilege CreateIndex { get; } = new IndexPrivilege("create_index"); - public static IndexPrivilege CreateDoc { get; } = new IndexPrivilege("create_doc"); - public static IndexPrivilege Create { get; } = new IndexPrivilege("create"); - public static IndexPrivilege AutoConfigure { get; } = new IndexPrivilege("auto_configure"); public static IndexPrivilege All { get; } = new IndexPrivilege("all"); + public static IndexPrivilege AutoConfigure { get; } = new IndexPrivilege("auto_configure"); + public static IndexPrivilege Create { get; } = new IndexPrivilege("create"); + public static IndexPrivilege CreateDoc { get; } = new IndexPrivilege("create_doc"); + public static IndexPrivilege CreateIndex { get; } = new IndexPrivilege("create_index"); + public static IndexPrivilege CrossClusterReplication { get; } = new IndexPrivilege("cross_cluster_replication"); + public static IndexPrivilege CrossClusterReplicationInternal { get; } = new IndexPrivilege("cross_cluster_replication_internal"); + public static IndexPrivilege Delete { get; } = new IndexPrivilege("delete"); + public static IndexPrivilege DeleteIndex { get; } = new IndexPrivilege("delete_index"); + public static IndexPrivilege Index { get; } = new IndexPrivilege("index"); + public static IndexPrivilege Maintenance { get; } = new IndexPrivilege("maintenance"); + public static IndexPrivilege Manage { get; } = new IndexPrivilege("manage"); + public static IndexPrivilege ManageDataStreamLifecycle { get; } = new IndexPrivilege("manage_data_stream_lifecycle"); + public static IndexPrivilege ManageFollowIndex { get; } = new IndexPrivilege("manage_follow_index"); + public static IndexPrivilege ManageIlm { get; } = new IndexPrivilege("manage_ilm"); + public static IndexPrivilege ManageLeaderIndex { get; } = new IndexPrivilege("manage_leader_index"); + public static IndexPrivilege Monitor { get; } = new IndexPrivilege("monitor"); + public static IndexPrivilege None { get; } = new IndexPrivilege("none"); + public static IndexPrivilege Read { get; } = new IndexPrivilege("read"); + public static IndexPrivilege ReadCrossCluster { get; } = new IndexPrivilege("read_cross_cluster"); + public static IndexPrivilege ViewIndexMetadata { get; } = new IndexPrivilege("view_index_metadata"); + public static IndexPrivilege Write { get; } = new IndexPrivilege("write"); public override string ToString() => Value ?? string.Empty; - public static implicit operator string(IndexPrivilege indexPrivilege) => indexPrivilege.Value; + public static implicit operator string(IndexPrivilege @enum) => @enum.Value; public static implicit operator IndexPrivilege(string value) => new(value); public override int GetHashCode() => Value.GetHashCode(); @@ -374,61 +631,39 @@ public override void Write(Utf8JsonWriter writer, GrantType value, JsonSerialize public static bool operator !=(IndexPrivilege a, IndexPrivilege b) => !(a == b); } -[JsonConverter(typeof(RemoteClusterPrivilegeConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegeConverter))] public enum RemoteClusterPrivilege { - [EnumMember(Value = "monitor_stats")] - MonitorStats, - [EnumMember(Value = "monitor_enrich")] - MonitorEnrich + [System.Runtime.Serialization.EnumMember(Value = "monitor_enrich")] + MonitorEnrich, + [System.Runtime.Serialization.EnumMember(Value = "monitor_stats")] + MonitorStats } -internal sealed class RemoteClusterPrivilegeConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.TemplateFormatConverter))] +public enum TemplateFormat { - public override RemoteClusterPrivilege Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "monitor_stats": - return RemoteClusterPrivilege.MonitorStats; - case "monitor_enrich": - return RemoteClusterPrivilege.MonitorEnrich; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, RemoteClusterPrivilege value, JsonSerializerOptions options) - { - switch (value) - { - case RemoteClusterPrivilege.MonitorStats: - writer.WriteStringValue("monitor_stats"); - return; - case RemoteClusterPrivilege.MonitorEnrich: - writer.WriteStringValue("monitor_enrich"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "json")] + Json, + [System.Runtime.Serialization.EnumMember(Value = "string")] + String } -[JsonConverter(typeof(EnumStructConverter))] -public readonly partial struct RestrictionWorkflow : IEnumStruct +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RestrictionWorkflowConverter))] +public readonly partial struct RestrictionWorkflow : Elastic.Clients.Elasticsearch.Serialization.IEnumStruct { public RestrictionWorkflow(string value) => Value = value; - +#if NET7_0_OR_GREATER + static RestrictionWorkflow IEnumStruct.Create(string value) => value; +#else RestrictionWorkflow IEnumStruct.Create(string value) => value; - +#endif public readonly string Value { get; } public static RestrictionWorkflow SearchApplicationQuery { get; } = new RestrictionWorkflow("search_application_query"); public override string ToString() => Value ?? string.Empty; - public static implicit operator string(RestrictionWorkflow restrictionWorkflow) => restrictionWorkflow.Value; + public static implicit operator string(RestrictionWorkflow @enum) => @enum.Value; public static implicit operator RestrictionWorkflow(string value) => new(value); public override int GetHashCode() => Value.GetHashCode(); @@ -439,44 +674,11 @@ public override void Write(Utf8JsonWriter writer, RemoteClusterPrivilege value, public static bool operator !=(RestrictionWorkflow a, RestrictionWorkflow b) => !(a == b); } -[JsonConverter(typeof(TemplateFormatConverter))] -public enum TemplateFormat -{ - [EnumMember(Value = "string")] - String, - [EnumMember(Value = "json")] - Json -} - -internal sealed class TemplateFormatConverter : JsonConverter +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyTypeConverter))] +public enum ApiKeyType { - public override TemplateFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "string": - return TemplateFormat.String; - case "json": - return TemplateFormat.Json; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, TemplateFormat value, JsonSerializerOptions options) - { - switch (value) - { - case TemplateFormat.String: - writer.WriteStringValue("string"); - return; - case TemplateFormat.Json: - writer.WriteStringValue("json"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "cross_cluster")] + CrossCluster, + [System.Runtime.Serialization.EnumMember(Value = "rest")] + Rest } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Snapshot.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Snapshot.g.cs index f6ecd4edf17..5c3e74013c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Snapshot.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Snapshot.g.cs @@ -17,178 +17,293 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -[JsonConverter(typeof(ShardsStatsStageConverter))] +internal sealed partial class SnapshotSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDuration = System.Text.Json.JsonEncodedText.Encode("duration"); + private static readonly System.Text.Json.JsonEncodedText MemberFailedShardCount = System.Text.Json.JsonEncodedText.Encode("failed_shard_count"); + private static readonly System.Text.Json.JsonEncodedText MemberIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText MemberName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText MemberRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText MemberShardCount = System.Text.Json.JsonEncodedText.Encode("shard_count"); + private static readonly System.Text.Json.JsonEncodedText MemberStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDuration)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Duration; + } + + if (reader.ValueTextEquals(MemberFailedShardCount)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.FailedShardCount; + } + + if (reader.ValueTextEquals(MemberIndexCount)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.IndexCount; + } + + if (reader.ValueTextEquals(MemberName)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Name; + } + + if (reader.ValueTextEquals(MemberRepository)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Repository; + } + + if (reader.ValueTextEquals(MemberShardCount)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.ShardCount; + } + + if (reader.ValueTextEquals(MemberStartTime)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.StartTime; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDuration.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Duration; + } + + if (string.Equals(value, MemberFailedShardCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.FailedShardCount; + } + + if (string.Equals(value, MemberIndexCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.IndexCount; + } + + if (string.Equals(value, MemberName.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Name; + } + + if (string.Equals(value, MemberRepository.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Repository; + } + + if (string.Equals(value, MemberShardCount.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.ShardCount; + } + + if (string.Equals(value, MemberStartTime.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.StartTime; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Duration: + writer.WriteStringValue(MemberDuration); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.FailedShardCount: + writer.WriteStringValue(MemberFailedShardCount); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.IndexCount: + writer.WriteStringValue(MemberIndexCount); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Name: + writer.WriteStringValue(MemberName); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.Repository: + writer.WriteStringValue(MemberRepository); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.ShardCount: + writer.WriteStringValue(MemberShardCount); + break; + case Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort.StartTime: + writer.WriteStringValue(MemberStartTime); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotSort value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +internal sealed partial class ShardsStatsStageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberDone = System.Text.Json.JsonEncodedText.Encode("DONE"); + private static readonly System.Text.Json.JsonEncodedText MemberFailure = System.Text.Json.JsonEncodedText.Encode("FAILURE"); + private static readonly System.Text.Json.JsonEncodedText MemberFinalize = System.Text.Json.JsonEncodedText.Encode("FINALIZE"); + private static readonly System.Text.Json.JsonEncodedText MemberInit = System.Text.Json.JsonEncodedText.Encode("INIT"); + private static readonly System.Text.Json.JsonEncodedText MemberStarted = System.Text.Json.JsonEncodedText.Encode("STARTED"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberDone)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Done; + } + + if (reader.ValueTextEquals(MemberFailure)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Failure; + } + + if (reader.ValueTextEquals(MemberFinalize)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Finalize; + } + + if (reader.ValueTextEquals(MemberInit)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Init; + } + + if (reader.ValueTextEquals(MemberStarted)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Started; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Done; + } + + if (string.Equals(value, MemberFailure.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Failure; + } + + if (string.Equals(value, MemberFinalize.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Finalize; + } + + if (string.Equals(value, MemberInit.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Init; + } + + if (string.Equals(value, MemberStarted.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Started; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Done: + writer.WriteStringValue(MemberDone); + break; + case Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Failure: + writer.WriteStringValue(MemberFailure); + break; + case Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Finalize: + writer.WriteStringValue(MemberFinalize); + break; + case Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Init: + writer.WriteStringValue(MemberInit); + break; + case Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage.Started: + writer.WriteStringValue(MemberStarted); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotSortConverter))] +public enum SnapshotSort +{ + [System.Runtime.Serialization.EnumMember(Value = "duration")] + Duration, + [System.Runtime.Serialization.EnumMember(Value = "failed_shard_count")] + FailedShardCount, + [System.Runtime.Serialization.EnumMember(Value = "index_count")] + IndexCount, + [System.Runtime.Serialization.EnumMember(Value = "name")] + Name, + [System.Runtime.Serialization.EnumMember(Value = "repository")] + Repository, + [System.Runtime.Serialization.EnumMember(Value = "shard_count")] + ShardCount, + [System.Runtime.Serialization.EnumMember(Value = "start_time")] + StartTime +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStageConverter))] public enum ShardsStatsStage { /// /// - /// Number of shards in the snapshot that are in the started stage of being stored in the repository. + /// The number of shards in the snapshot that were successfully stored in the repository. /// /// - [EnumMember(Value = "STARTED")] - Started, + [System.Runtime.Serialization.EnumMember(Value = "DONE")] + Done, /// /// - /// Number of shards in the snapshot that are in the initializing stage of being stored in the repository. + /// The number of shards in the snapshot that were not successfully stored in the repository. /// /// - [EnumMember(Value = "INIT")] - Init, + [System.Runtime.Serialization.EnumMember(Value = "FAILURE")] + Failure, /// /// - /// Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. + /// The number of shards in the snapshot that are in the finalizing stage of being stored in the repository. /// /// - [EnumMember(Value = "FINALIZE")] + [System.Runtime.Serialization.EnumMember(Value = "FINALIZE")] Finalize, /// /// - /// Number of shards in the snapshot that were not successfully stored in the repository. + /// The number of shards in the snapshot that are in the initializing stage of being stored in the repository. /// /// - [EnumMember(Value = "FAILURE")] - Failure, + [System.Runtime.Serialization.EnumMember(Value = "INIT")] + Init, /// /// - /// Number of shards in the snapshot that were successfully stored in the repository. + /// The number of shards in the snapshot that are in the started stage of being stored in the repository. /// /// - [EnumMember(Value = "DONE")] - Done -} - -internal sealed class ShardsStatsStageConverter : JsonConverter -{ - public override ShardsStatsStage Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "STARTED": - return ShardsStatsStage.Started; - case "INIT": - return ShardsStatsStage.Init; - case "FINALIZE": - return ShardsStatsStage.Finalize; - case "FAILURE": - return ShardsStatsStage.Failure; - case "DONE": - return ShardsStatsStage.Done; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, ShardsStatsStage value, JsonSerializerOptions options) - { - switch (value) - { - case ShardsStatsStage.Started: - writer.WriteStringValue("STARTED"); - return; - case ShardsStatsStage.Init: - writer.WriteStringValue("INIT"); - return; - case ShardsStatsStage.Finalize: - writer.WriteStringValue("FINALIZE"); - return; - case ShardsStatsStage.Failure: - writer.WriteStringValue("FAILURE"); - return; - case ShardsStatsStage.Done: - writer.WriteStringValue("DONE"); - return; - } - - writer.WriteNullValue(); - } -} - -[JsonConverter(typeof(SnapshotSortConverter))] -public enum SnapshotSort -{ - [EnumMember(Value = "start_time")] - StartTime, - [EnumMember(Value = "shard_count")] - ShardCount, - [EnumMember(Value = "repository")] - Repository, - [EnumMember(Value = "name")] - Name, - [EnumMember(Value = "index_count")] - IndexCount, - [EnumMember(Value = "failed_shard_count")] - FailedShardCount, - [EnumMember(Value = "duration")] - Duration -} - -internal sealed class SnapshotSortConverter : JsonConverter -{ - public override SnapshotSort Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "start_time": - return SnapshotSort.StartTime; - case "shard_count": - return SnapshotSort.ShardCount; - case "repository": - return SnapshotSort.Repository; - case "name": - return SnapshotSort.Name; - case "index_count": - return SnapshotSort.IndexCount; - case "failed_shard_count": - return SnapshotSort.FailedShardCount; - case "duration": - return SnapshotSort.Duration; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, SnapshotSort value, JsonSerializerOptions options) - { - switch (value) - { - case SnapshotSort.StartTime: - writer.WriteStringValue("start_time"); - return; - case SnapshotSort.ShardCount: - writer.WriteStringValue("shard_count"); - return; - case SnapshotSort.Repository: - writer.WriteStringValue("repository"); - return; - case SnapshotSort.Name: - writer.WriteStringValue("name"); - return; - case SnapshotSort.IndexCount: - writer.WriteStringValue("index_count"); - return; - case SnapshotSort.FailedShardCount: - writer.WriteStringValue("failed_shard_count"); - return; - case SnapshotSort.Duration: - writer.WriteStringValue("duration"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "STARTED")] + Started } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Sql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Sql.g.cs index 5b2210e7a2a..62743d6613d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Sql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Sql.g.cs @@ -17,90 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; -[JsonConverter(typeof(SqlFormatConverter))] -public enum SqlFormat +internal sealed partial class SqlFormatConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "yaml")] - Yaml, - [EnumMember(Value = "txt")] - Txt, - [EnumMember(Value = "tsv")] - Tsv, - [EnumMember(Value = "smile")] - Smile, - [EnumMember(Value = "json")] - Json, - [EnumMember(Value = "csv")] - Csv, - [EnumMember(Value = "cbor")] - Cbor -} + private static readonly System.Text.Json.JsonEncodedText MemberCbor = System.Text.Json.JsonEncodedText.Encode("cbor"); + private static readonly System.Text.Json.JsonEncodedText MemberCsv = System.Text.Json.JsonEncodedText.Encode("csv"); + private static readonly System.Text.Json.JsonEncodedText MemberJson = System.Text.Json.JsonEncodedText.Encode("json"); + private static readonly System.Text.Json.JsonEncodedText MemberSmile = System.Text.Json.JsonEncodedText.Encode("smile"); + private static readonly System.Text.Json.JsonEncodedText MemberTsv = System.Text.Json.JsonEncodedText.Encode("tsv"); + private static readonly System.Text.Json.JsonEncodedText MemberTxt = System.Text.Json.JsonEncodedText.Encode("txt"); + private static readonly System.Text.Json.JsonEncodedText MemberYaml = System.Text.Json.JsonEncodedText.Encode("yaml"); -internal sealed class SqlFormatConverter : JsonConverter -{ - public override SqlFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Sql.SqlFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberCbor)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Cbor; + } + + if (reader.ValueTextEquals(MemberCsv)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Csv; + } + + if (reader.ValueTextEquals(MemberJson)) { - case "yaml": - return SqlFormat.Yaml; - case "txt": - return SqlFormat.Txt; - case "tsv": - return SqlFormat.Tsv; - case "smile": - return SqlFormat.Smile; - case "json": - return SqlFormat.Json; - case "csv": - return SqlFormat.Csv; - case "cbor": - return SqlFormat.Cbor; + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Json; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberSmile)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Smile; + } + + if (reader.ValueTextEquals(MemberTsv)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Tsv; + } + + if (reader.ValueTextEquals(MemberTxt)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Txt; + } + + if (reader.ValueTextEquals(MemberYaml)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Yaml; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberCbor.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Cbor; + } + + if (string.Equals(value, MemberCsv.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Csv; + } + + if (string.Equals(value, MemberJson.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Json; + } + + if (string.Equals(value, MemberSmile.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Smile; + } + + if (string.Equals(value, MemberTsv.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Tsv; + } + + if (string.Equals(value, MemberTxt.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Txt; + } + + if (string.Equals(value, MemberYaml.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Sql.SqlFormat.Yaml; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Sql.SqlFormat)}'."); } - public override void Write(Utf8JsonWriter writer, SqlFormat value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.SqlFormat value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case SqlFormat.Yaml: - writer.WriteStringValue("yaml"); - return; - case SqlFormat.Txt: - writer.WriteStringValue("txt"); - return; - case SqlFormat.Tsv: - writer.WriteStringValue("tsv"); - return; - case SqlFormat.Smile: - writer.WriteStringValue("smile"); - return; - case SqlFormat.Json: - writer.WriteStringValue("json"); - return; - case SqlFormat.Csv: - writer.WriteStringValue("csv"); - return; - case SqlFormat.Cbor: - writer.WriteStringValue("cbor"); - return; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Cbor: + writer.WriteStringValue(MemberCbor); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Csv: + writer.WriteStringValue(MemberCsv); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Json: + writer.WriteStringValue(MemberJson); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Smile: + writer.WriteStringValue(MemberSmile); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Tsv: + writer.WriteStringValue(MemberTsv); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Txt: + writer.WriteStringValue(MemberTxt); + break; + case Elastic.Clients.Elasticsearch.Sql.SqlFormat.Yaml: + writer.WriteStringValue(MemberYaml); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Sql.SqlFormat)}'."); } + } + + public override Elastic.Clients.Elasticsearch.Sql.SqlFormat ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.SqlFormat value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.SqlFormatConverter))] +public enum SqlFormat +{ + [System.Runtime.Serialization.EnumMember(Value = "cbor")] + Cbor, + [System.Runtime.Serialization.EnumMember(Value = "csv")] + Csv, + [System.Runtime.Serialization.EnumMember(Value = "json")] + Json, + [System.Runtime.Serialization.EnumMember(Value = "smile")] + Smile, + [System.Runtime.Serialization.EnumMember(Value = "tsv")] + Tsv, + [System.Runtime.Serialization.EnumMember(Value = "txt")] + Txt, + [System.Runtime.Serialization.EnumMember(Value = "yaml")] + Yaml } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs index 8dd4b7e1bd6..1ba6e1f0887 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs @@ -17,77 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -[JsonConverter(typeof(GroupByConverter))] +internal sealed partial class GroupByConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText MemberNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText MemberNone = System.Text.Json.JsonEncodedText.Encode("none"); + private static readonly System.Text.Json.JsonEncodedText MemberParents = System.Text.Json.JsonEncodedText.Encode("parents"); + + public override Elastic.Clients.Elasticsearch.Tasks.GroupBy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.ValueTextEquals(MemberNodes)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.Nodes; + } + + if (reader.ValueTextEquals(MemberNone)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.None; + } + + if (reader.ValueTextEquals(MemberParents)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.Parents; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberNodes.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.Nodes; + } + + if (string.Equals(value, MemberNone.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.None; + } + + if (string.Equals(value, MemberParents.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Tasks.GroupBy.Parents; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Tasks.GroupBy)}'."); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.GroupBy value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.Tasks.GroupBy.Nodes: + writer.WriteStringValue(MemberNodes); + break; + case Elastic.Clients.Elasticsearch.Tasks.GroupBy.None: + writer.WriteStringValue(MemberNone); + break; + case Elastic.Clients.Elasticsearch.Tasks.GroupBy.Parents: + writer.WriteStringValue(MemberParents); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Tasks.GroupBy)}'."); + } + } + + public override Elastic.Clients.Elasticsearch.Tasks.GroupBy ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.GroupBy value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.GroupByConverter))] public enum GroupBy { /// /// - /// Group tasks by parent task ID. + /// Group tasks by node ID. /// /// - [EnumMember(Value = "parents")] - Parents, + [System.Runtime.Serialization.EnumMember(Value = "nodes")] + Nodes, /// /// /// Do not group tasks. /// /// - [EnumMember(Value = "none")] + [System.Runtime.Serialization.EnumMember(Value = "none")] None, /// /// - /// Group tasks by node ID. + /// Group tasks by parent task ID. /// /// - [EnumMember(Value = "nodes")] - Nodes -} - -internal sealed class GroupByConverter : JsonConverter -{ - public override GroupBy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "parents": - return GroupBy.Parents; - case "none": - return GroupBy.None; - case "nodes": - return GroupBy.Nodes; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, GroupBy value, JsonSerializerOptions options) - { - switch (value) - { - case GroupBy.Parents: - writer.WriteStringValue("parents"); - return; - case GroupBy.None: - writer.WriteStringValue("none"); - return; - case GroupBy.Nodes: - writer.WriteStringValue("nodes"); - return; - } - - writer.WriteNullValue(); - } + [System.Runtime.Serialization.EnumMember(Value = "parents")] + Parents } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.TextStructure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.TextStructure.g.cs index 3fc28166b89..c6b1d05e3d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.TextStructure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.TextStructure.g.cs @@ -17,111 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; -[JsonConverter(typeof(EcsCompatibilityTypeConverter))] -public enum EcsCompatibilityType +internal sealed partial class EcsCompatibilityTypeConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "v1")] - V1, - [EnumMember(Value = "disabled")] - Disabled -} + private static readonly System.Text.Json.JsonEncodedText MemberDisabled = System.Text.Json.JsonEncodedText.Encode("disabled"); + private static readonly System.Text.Json.JsonEncodedText MemberV1 = System.Text.Json.JsonEncodedText.Encode("v1"); -internal sealed class EcsCompatibilityTypeConverter : JsonConverter -{ - public override EcsCompatibilityType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDisabled)) + { + return Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.Disabled; + } + + if (reader.ValueTextEquals(MemberV1)) { - case "v1": - return EcsCompatibilityType.V1; - case "disabled": - return EcsCompatibilityType.Disabled; + return Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.V1; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberDisabled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.Disabled; + } + + if (string.Equals(value, MemberV1.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.V1; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType)}'."); } - public override void Write(Utf8JsonWriter writer, EcsCompatibilityType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case EcsCompatibilityType.V1: - writer.WriteStringValue("v1"); - return; - case EcsCompatibilityType.Disabled: - writer.WriteStringValue("disabled"); - return; + case Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.Disabled: + writer.WriteStringValue(MemberDisabled); + break; + case Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType.V1: + writer.WriteStringValue(MemberV1); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } -} -[JsonConverter(typeof(FormatTypeConverter))] -public enum FormatType -{ - [EnumMember(Value = "xml")] - Xml, - [EnumMember(Value = "semi_structured_text")] - SemiStructuredText, - [EnumMember(Value = "ndjson")] - Ndjson, - [EnumMember(Value = "delimited")] - Delimited + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } } -internal sealed class FormatTypeConverter : JsonConverter +internal sealed partial class FormatTypeConverter : System.Text.Json.Serialization.JsonConverter { - public override FormatType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText MemberDelimited = System.Text.Json.JsonEncodedText.Encode("delimited"); + private static readonly System.Text.Json.JsonEncodedText MemberNdjson = System.Text.Json.JsonEncodedText.Encode("ndjson"); + private static readonly System.Text.Json.JsonEncodedText MemberSemiStructuredText = System.Text.Json.JsonEncodedText.Encode("semi_structured_text"); + private static readonly System.Text.Json.JsonEncodedText MemberXml = System.Text.Json.JsonEncodedText.Encode("xml"); + + public override Elastic.Clients.Elasticsearch.TextStructure.FormatType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberDelimited)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Delimited; + } + + if (reader.ValueTextEquals(MemberNdjson)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Ndjson; + } + + if (reader.ValueTextEquals(MemberSemiStructuredText)) { - case "xml": - return FormatType.Xml; - case "semi_structured_text": - return FormatType.SemiStructuredText; - case "ndjson": - return FormatType.Ndjson; - case "delimited": - return FormatType.Delimited; + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.SemiStructuredText; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberXml)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Xml; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberDelimited.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Delimited; + } + + if (string.Equals(value, MemberNdjson.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Ndjson; + } + + if (string.Equals(value, MemberSemiStructuredText.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.SemiStructuredText; + } + + if (string.Equals(value, MemberXml.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.TextStructure.FormatType.Xml; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TextStructure.FormatType)}'."); } - public override void Write(Utf8JsonWriter writer, FormatType value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FormatType value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case FormatType.Xml: - writer.WriteStringValue("xml"); - return; - case FormatType.SemiStructuredText: - writer.WriteStringValue("semi_structured_text"); - return; - case FormatType.Ndjson: - writer.WriteStringValue("ndjson"); - return; - case FormatType.Delimited: - writer.WriteStringValue("delimited"); - return; + case Elastic.Clients.Elasticsearch.TextStructure.FormatType.Delimited: + writer.WriteStringValue(MemberDelimited); + break; + case Elastic.Clients.Elasticsearch.TextStructure.FormatType.Ndjson: + writer.WriteStringValue(MemberNdjson); + break; + case Elastic.Clients.Elasticsearch.TextStructure.FormatType.SemiStructuredText: + writer.WriteStringValue(MemberSemiStructuredText); + break; + case Elastic.Clients.Elasticsearch.TextStructure.FormatType.Xml: + writer.WriteStringValue(MemberXml); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.TextStructure.FormatType)}'."); } + } + + public override Elastic.Clients.Elasticsearch.TextStructure.FormatType ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); + } - writer.WriteNullValue(); + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FormatType value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.EcsCompatibilityTypeConverter))] +public enum EcsCompatibilityType +{ + [System.Runtime.Serialization.EnumMember(Value = "disabled")] + Disabled, + [System.Runtime.Serialization.EnumMember(Value = "v1")] + V1 +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FormatTypeConverter))] +public enum FormatType +{ + [System.Runtime.Serialization.EnumMember(Value = "delimited")] + Delimited, + [System.Runtime.Serialization.EnumMember(Value = "ndjson")] + Ndjson, + [System.Runtime.Serialization.EnumMember(Value = "semi_structured_text")] + SemiStructuredText, + [System.Runtime.Serialization.EnumMember(Value = "xml")] + Xml } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Watcher.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Watcher.g.cs index fdb9af07820..32ec544f196 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Watcher.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Watcher.g.cs @@ -17,69 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Watcher; -[JsonConverter(typeof(ActionStatusOptionsConverter))] -public enum ActionStatusOptions +internal sealed partial class ActionStatusOptionsConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "throttled")] - Throttled, - [EnumMember(Value = "success")] - Success, - [EnumMember(Value = "simulated")] - Simulated, - [EnumMember(Value = "failure")] - Failure -} + private static readonly System.Text.Json.JsonEncodedText MemberFailure = System.Text.Json.JsonEncodedText.Encode("failure"); + private static readonly System.Text.Json.JsonEncodedText MemberSimulated = System.Text.Json.JsonEncodedText.Encode("simulated"); + private static readonly System.Text.Json.JsonEncodedText MemberSuccess = System.Text.Json.JsonEncodedText.Encode("success"); + private static readonly System.Text.Json.JsonEncodedText MemberThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); -internal sealed class ActionStatusOptionsConverter : JsonConverter -{ - public override ActionStatusOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberFailure)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Failure; + } + + if (reader.ValueTextEquals(MemberSimulated)) { - case "throttled": - return ActionStatusOptions.Throttled; - case "success": - return ActionStatusOptions.Success; - case "simulated": - return ActionStatusOptions.Simulated; - case "failure": - return ActionStatusOptions.Failure; + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Simulated; } - ThrowHelper.ThrowJsonException(); - return default; + if (reader.ValueTextEquals(MemberSuccess)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Success; + } + + if (reader.ValueTextEquals(MemberThrottled)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Throttled; + } + + var value = reader.GetString()!; + if (string.Equals(value, MemberFailure.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Failure; + } + + if (string.Equals(value, MemberSimulated.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Simulated; + } + + if (string.Equals(value, MemberSuccess.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Success; + } + + if (string.Equals(value, MemberThrottled.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Throttled; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions)}'."); } - public override void Write(Utf8JsonWriter writer, ActionStatusOptions value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case ActionStatusOptions.Throttled: - writer.WriteStringValue("throttled"); - return; - case ActionStatusOptions.Success: - writer.WriteStringValue("success"); - return; - case ActionStatusOptions.Simulated: - writer.WriteStringValue("simulated"); - return; - case ActionStatusOptions.Failure: - writer.WriteStringValue("failure"); - return; + case Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Failure: + writer.WriteStringValue(MemberFailure); + break; + case Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Simulated: + writer.WriteStringValue(MemberSimulated); + break; + case Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Success: + writer.WriteStringValue(MemberSuccess); + break; + case Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions.Throttled: + writer.WriteStringValue(MemberThrottled); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptionsConverter))] +public enum ActionStatusOptions +{ + [System.Runtime.Serialization.EnumMember(Value = "failure")] + Failure, + [System.Runtime.Serialization.EnumMember(Value = "simulated")] + Simulated, + [System.Runtime.Serialization.EnumMember(Value = "success")] + Success, + [System.Runtime.Serialization.EnumMember(Value = "throttled")] + Throttled } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Xpack.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Xpack.g.cs index 36d2bdbd1e9..7ef37d47566 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Xpack.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Xpack.g.cs @@ -17,62 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; -[JsonConverter(typeof(XPackCategoryConverter))] -public enum XPackCategory +internal sealed partial class XPackCategoryConverter : System.Text.Json.Serialization.JsonConverter { - [EnumMember(Value = "license")] - License, - [EnumMember(Value = "features")] - Features, - [EnumMember(Value = "build")] - Build -} + private static readonly System.Text.Json.JsonEncodedText MemberBuild = System.Text.Json.JsonEncodedText.Encode("build"); + private static readonly System.Text.Json.JsonEncodedText MemberFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + private static readonly System.Text.Json.JsonEncodedText MemberLicense = System.Text.Json.JsonEncodedText.Encode("license"); -internal sealed class XPackCategoryConverter : JsonConverter -{ - public override XPackCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Xpack.XPackCategory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - var enumString = reader.GetString(); - switch (enumString) + if (reader.ValueTextEquals(MemberBuild)) + { + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Build; + } + + if (reader.ValueTextEquals(MemberFeatures)) + { + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Features; + } + + if (reader.ValueTextEquals(MemberLicense)) { - case "license": - return XPackCategory.License; - case "features": - return XPackCategory.Features; - case "build": - return XPackCategory.Build; + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.License; } - ThrowHelper.ThrowJsonException(); - return default; + var value = reader.GetString()!; + if (string.Equals(value, MemberBuild.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Build; + } + + if (string.Equals(value, MemberFeatures.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Features; + } + + if (string.Equals(value, MemberLicense.Value, System.StringComparison.OrdinalIgnoreCase)) + { + return Elastic.Clients.Elasticsearch.Xpack.XPackCategory.License; + } + + throw new System.Text.Json.JsonException($"Unknown member '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Xpack.XPackCategory)}'."); } - public override void Write(Utf8JsonWriter writer, XPackCategory value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XPackCategory value, System.Text.Json.JsonSerializerOptions options) { switch (value) { - case XPackCategory.License: - writer.WriteStringValue("license"); - return; - case XPackCategory.Features: - writer.WriteStringValue("features"); - return; - case XPackCategory.Build: - writer.WriteStringValue("build"); - return; + case Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Build: + writer.WriteStringValue(MemberBuild); + break; + case Elastic.Clients.Elasticsearch.Xpack.XPackCategory.Features: + writer.WriteStringValue(MemberFeatures); + break; + case Elastic.Clients.Elasticsearch.Xpack.XPackCategory.License: + writer.WriteStringValue(MemberLicense); + break; + default: + throw new System.Text.Json.JsonException($"Invalid value '{value}' for enum '{nameof(Elastic.Clients.Elasticsearch.Xpack.XPackCategory)}'."); } + } - writer.WriteNullValue(); + public override Elastic.Clients.Elasticsearch.Xpack.XPackCategory ReadAsPropertyName(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return Read(ref reader, typeToConvert, options); } + + public override void WriteAsPropertyName(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XPackCategory value, System.Text.Json.JsonSerializerOptions options) + { + Write(writer, value, options); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XPackCategoryConverter))] +public enum XPackCategory +{ + [System.Runtime.Serialization.EnumMember(Value = "build")] + Build, + [System.Runtime.Serialization.EnumMember(Value = "features")] + Features, + [System.Runtime.Serialization.EnumMember(Value = "license")] + License } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/EqlHits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/EqlHits.g.cs index 87713b7a04f..c8e0485113c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/EqlHits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/EqlHits.g.cs @@ -17,39 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; +internal sealed partial class EqlHitsConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropEvents = System.Text.Json.JsonEncodedText.Encode("events"); + private static readonly System.Text.Json.JsonEncodedText PropSequences = System.Text.Json.JsonEncodedText.Encode("sequences"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Eql.EqlHits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propEvents = default; + LocalJsonValue>?> propSequences = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvents.TryReadProperty(ref reader, options, PropEvents, static System.Collections.Generic.IReadOnlyCollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null))) + { + continue; + } + + if (propSequences.TryReadProperty(ref reader, options, PropSequences, static System.Collections.Generic.IReadOnlyCollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.EqlHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Events = propEvents.Value, + Sequences = propSequences.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.EqlHits value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvents, value.Events, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection>? v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropSequences, value.Sequences, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection>? v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class EqlHitsConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(EqlHits<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(EqlHitsConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.EqlHitsConverterFactory))] public sealed partial class EqlHits { +#if NET7_0_OR_GREATER + public EqlHits() + { + } +#endif +#if !NET7_0_OR_GREATER + public EqlHits() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlHits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains events matching the query. Each object represents a matching event. /// /// - [JsonInclude, JsonPropertyName("events")] - public IReadOnlyCollection>? Events { get; init; } + public System.Collections.Generic.IReadOnlyCollection>? Events { get; set; } /// /// /// Contains event sequences matching the query. Each object represents a matching sequence. This parameter is only returned for EQL queries containing a sequence. /// /// - [JsonInclude, JsonPropertyName("sequences")] - public IReadOnlyCollection>? Sequences { get; init; } + public System.Collections.Generic.IReadOnlyCollection>? Sequences { get; set; } /// /// /// Metadata about the number of matching events or sequences. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Core.Search.TotalHits? Total { get; init; } + public Elastic.Clients.Elasticsearch.Core.Search.TotalHits? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsEvent.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsEvent.g.cs index 6ec2792b4d5..736a9cdacb8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsEvent.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsEvent.g.cs @@ -17,52 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; +internal sealed partial class HitsEventConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.Eql.HitsEvent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propFields = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propMissing = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static TEvent (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.HitsEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Id = propId.Value, + Index = propIndex.Value, + Missing = propMissing.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.HitsEvent value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, TEvent v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); + writer.WriteEndObject(); + } +} + +internal sealed partial class HitsEventConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(HitsEvent<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(HitsEventConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.HitsEventConverterFactory))] public sealed partial class HitsEvent { - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(IReadOnlyCollection))] - public IReadOnlyDictionary>? Fields { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HitsEvent(string id, string index, TEvent source) + { + Id = id; + Index = index; + Source = source; + } +#if NET7_0_OR_GREATER + public HitsEvent() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HitsEvent() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HitsEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary>? Fields { get; set; } /// /// /// Unique identifier for the event. This ID is only unique within the index. /// /// - [JsonInclude, JsonPropertyName("_id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Name of the index containing the event. /// /// - [JsonInclude, JsonPropertyName("_index")] - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// Set to true for events in a timespan-constrained sequence that do not meet a given condition. /// /// - [JsonInclude, JsonPropertyName("missing")] - public bool? Missing { get; init; } + public bool? Missing { get; set; } /// /// /// Original JSON body passed for the event at index time. /// /// - [JsonInclude, JsonPropertyName("_source")] - [SourceConverter] - public TEvent Source { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + TEvent Source { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsSequence.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsSequence.g.cs index a2f67ae5619..694349f3f2f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsSequence.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Eql/HitsSequence.g.cs @@ -17,31 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Eql; +internal sealed partial class HitsSequenceConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropEvents = System.Text.Json.JsonEncodedText.Encode("events"); + private static readonly System.Text.Json.JsonEncodedText PropJoinKeys = System.Text.Json.JsonEncodedText.Encode("join_keys"); + + public override Elastic.Clients.Elasticsearch.Eql.HitsSequence Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propEvents = default; + LocalJsonValue?> propJoinKeys = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvents.TryReadProperty(ref reader, options, PropEvents, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, null)!)) + { + continue; + } + + if (propJoinKeys.TryReadProperty(ref reader, options, PropJoinKeys, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Eql.HitsSequence(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Events = propEvents.Value, + JoinKeys = propJoinKeys.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Eql.HitsSequence value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvents, value.Events, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, null)); + writer.WriteProperty(options, PropJoinKeys, value.JoinKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +internal sealed partial class HitsSequenceConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(HitsSequence<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(HitsSequenceConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Eql.HitsSequenceConverterFactory))] public sealed partial class HitsSequence { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HitsSequence(System.Collections.Generic.IReadOnlyCollection> events) + { + Events = events; + } +#if NET7_0_OR_GREATER + public HitsSequence() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HitsSequence() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HitsSequence(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains events matching the query. Each object represents a matching event. /// /// - [JsonInclude, JsonPropertyName("events")] - public IReadOnlyCollection> Events { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Events { get; set; } /// /// /// Shared field values used to constrain matches in the sequence. These are defined using the by keyword in the EQL query syntax. /// /// - [JsonInclude, JsonPropertyName("join_keys")] - public IReadOnlyCollection? JoinKeys { get; init; } + public System.Collections.Generic.IReadOnlyCollection? JoinKeys { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs index e35a05a388e..f678c71a75f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorCause.g.cs @@ -17,82 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -internal sealed partial class ErrorCauseConverter : JsonConverter +internal sealed partial class ErrorCauseConverter : System.Text.Json.Serialization.JsonConverter { - public override ErrorCause Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropCausedBy = System.Text.Json.JsonEncodedText.Encode("caused_by"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRootCause = System.Text.Json.JsonEncodedText.Encode("root_cause"); + private static readonly System.Text.Json.JsonEncodedText PropStackTrace = System.Text.Json.JsonEncodedText.Encode("stack_trace"); + private static readonly System.Text.Json.JsonEncodedText PropSuppressed = System.Text.Json.JsonEncodedText.Encode("suppressed"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.ErrorCause Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - Elastic.Clients.Elasticsearch.ErrorCause? causedBy = default; - string? reason = default; - IReadOnlyCollection? rootCause = default; - string? stackTrace = default; - IReadOnlyCollection? suppressed = default; - string type = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCausedBy = default; + System.Collections.Generic.Dictionary? propMetadata = default; + LocalJsonValue propReason = default; + LocalJsonValue?> propRootCause = default; + LocalJsonValue propStackTrace = default; + LocalJsonValue?> propSuppressed = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propCausedBy.TryReadProperty(ref reader, options, PropCausedBy, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRootCause.TryReadProperty(ref reader, options, PropRootCause, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStackTrace.TryReadProperty(ref reader, options, PropStackTrace, null)) + { + continue; + } + + if (propSuppressed.TryReadProperty(ref reader, options, PropSuppressed, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) { - var property = reader.GetString(); - if (property == "caused_by") - { - causedBy = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "reason") - { - reason = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "root_cause") - { - rootCause = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "stack_trace") - { - stackTrace = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "suppressed") - { - suppressed = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "type") - { - type = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + propMetadata ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propMetadata[key] = value; } - return new ErrorCause { CausedBy = causedBy, Metadata = additionalProperties, Reason = reason, RootCause = rootCause, StackTrace = stackTrace, Suppressed = suppressed, Type = type }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ErrorCause(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CausedBy = propCausedBy.Value, + Metadata = propMetadata, + Reason = propReason.Value, + RootCause = propRootCause.Value, + StackTrace = propStackTrace.Value, + Suppressed = propSuppressed.Value, + Type = propType.Value + }; } - public override void Write(Utf8JsonWriter writer, ErrorCause value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ErrorCause value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ErrorCause' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropCausedBy, value.CausedBy, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRootCause, value.RootCause, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStackTrace, value.StackTrace, null, null); + writer.WriteProperty(options, PropSuppressed, value.Suppressed, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + if (value.Metadata is not null) + { + foreach (var item in value.Metadata) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } @@ -102,38 +119,64 @@ public override void Write(Utf8JsonWriter writer, ErrorCause value, JsonSerializ /// Additional details are also provided, that depend on the error type. /// /// -[JsonConverter(typeof(ErrorCauseConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ErrorCauseConverter))] public sealed partial class ErrorCause { - public Elastic.Clients.Elasticsearch.ErrorCause? CausedBy { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ErrorCause(string type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public ErrorCause() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ErrorCause() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ErrorCause(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ErrorCause? CausedBy { get; set; } /// /// /// Additional details about the error /// /// - public IReadOnlyDictionary Metadata { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } /// /// /// A human-readable explanation of the error, in English. /// /// - public string? Reason { get; init; } - public IReadOnlyCollection? RootCause { get; init; } + public string? Reason { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RootCause { get; set; } /// /// /// The server stack trace. Present only if the error_trace=true parameter was sent with the request. /// /// - public string? StackTrace { get; init; } - public IReadOnlyCollection? Suppressed { get; init; } + public string? StackTrace { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Suppressed { get; set; } /// /// /// The type of error /// /// - public string Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorResponseBase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorResponseBase.g.cs index 2fc8953500c..788c793a658 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorResponseBase.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ErrorResponseBase.g.cs @@ -17,25 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ErrorResponseBaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.ErrorResponseBase Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ErrorResponseBase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ErrorResponseBase value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + /// /// /// The response returned by Elasticsearch when request execution did not succeed. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ErrorResponseBaseConverter))] public sealed partial class ErrorResponseBase { - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause Error { get; init; } - [JsonInclude, JsonPropertyName("status")] - public int Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ErrorResponseBase(Elastic.Clients.Elasticsearch.ErrorCause error, int status) + { + Error = error; + Status = status; + } +#if NET7_0_OR_GREATER + public ErrorResponseBase() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ErrorResponseBase() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ErrorResponseBase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Error { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Features/Feature.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Features/Feature.g.cs index f81694a06c2..60d02ebd95b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Features/Feature.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Features/Feature.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Features; +internal sealed partial class FeatureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Features.Feature Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Features.Feature(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Features.Feature value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Features.FeatureConverter))] public sealed partial class Feature { - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Feature(string description, string name) + { + Description = description; + Name = name; + } +#if NET7_0_OR_GREATER + public Feature() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Feature() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Feature(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldMemoryUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldMemoryUsage.g.cs index 10e8984780b..b44e4beda90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldMemoryUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldMemoryUsage.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FieldMemoryUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemorySize = System.Text.Json.JsonEncodedText.Encode("memory_size"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySizeInBytes = System.Text.Json.JsonEncodedText.Encode("memory_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.FieldMemoryUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemorySize = default; + LocalJsonValue propMemorySizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemorySize.TryReadProperty(ref reader, options, PropMemorySize, null)) + { + continue; + } + + if (propMemorySizeInBytes.TryReadProperty(ref reader, options, PropMemorySizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FieldMemoryUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MemorySize = propMemorySize.Value, + MemorySizeInBytes = propMemorySizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldMemoryUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemorySize, value.MemorySize, null, null); + writer.WriteProperty(options, PropMemorySizeInBytes, value.MemorySizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldMemoryUsageConverter))] public sealed partial class FieldMemoryUsage { - [JsonInclude, JsonPropertyName("memory_size")] - public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; init; } - [JsonInclude, JsonPropertyName("memory_size_in_bytes")] - public long MemorySizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMemoryUsage(long memorySizeInBytes) + { + MemorySizeInBytes = memorySizeInBytes; + } +#if NET7_0_OR_GREATER + public FieldMemoryUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldMemoryUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldMemoryUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemorySizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSizeUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSizeUsage.g.cs index 60c9509284a..303233ca99f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSizeUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSizeUsage.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FieldSizeUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.FieldSizeUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSize = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FieldSizeUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Size = propSize.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldSizeUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldSizeUsageConverter))] public sealed partial class FieldSizeUsage { - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize? Size { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSizeUsage(long sizeInBytes) + { + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public FieldSizeUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldSizeUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldSizeUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSort.g.cs index 669d99a22ce..f77da9ad7b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FieldSort.g.cs @@ -17,304 +17,338 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FieldSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText PropNumericType = System.Text.Json.JsonEncodedText.Encode("numeric_type"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropUnmappedType = System.Text.Json.JsonEncodedText.Encode("unmapped_type"); + + public override Elastic.Clients.Elasticsearch.FieldSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + reader.Read(); + propField.ReadPropertyName(ref reader, options, null); + reader.Read(); + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Order = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFormat = default; + LocalJsonValue propMissing = default; + LocalJsonValue propMode = default; + LocalJsonValue propNested = default; + LocalJsonValue propNumericType = default; + LocalJsonValue propOrder = default; + LocalJsonValue propUnmappedType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } + + if (propNumericType.TryReadProperty(ref reader, options, PropNumericType, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propUnmappedType.TryReadProperty(ref reader, options, PropUnmappedType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + Missing = propMissing.Value, + Mode = propMode.Value, + Nested = propNested.Value, + NumericType = propNumericType.Value, + Order = propOrder.Value, + UnmappedType = propUnmappedType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FieldSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropNumericType, value.NumericType, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropUnmappedType, value.UnmappedType, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FieldSortConverter))] public sealed partial class FieldSort { - [JsonInclude, JsonPropertyName("format")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSort(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public FieldSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? Format { get; set; } - [JsonInclude, JsonPropertyName("missing")] - public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } - [JsonInclude, JsonPropertyName("mode")] + public object? Missing { get; set; } public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } - [JsonInclude, JsonPropertyName("nested")] public Elastic.Clients.Elasticsearch.NestedSortValue? Nested { get; set; } - [JsonInclude, JsonPropertyName("numeric_type")] public Elastic.Clients.Elasticsearch.FieldSortNumericType? NumericType { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } - [JsonInclude, JsonPropertyName("unmapped_type")] public Elastic.Clients.Elasticsearch.Mapping.FieldType? UnmappedType { get; set; } } -public sealed partial class FieldSortDescriptor : SerializableDescriptor> +public readonly partial struct FieldSortDescriptor { - internal FieldSortDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.FieldSort Instance { get; init; } - public FieldSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSortDescriptor(Elastic.Clients.Elasticsearch.FieldSort instance) { + Instance = instance; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action> NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldSortNumericType? NumericTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldType? UnmappedTypeValue { get; set; } - - public FieldSortDescriptor Format(string? format) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSortDescriptor() { - FormatValue = format; - return Self; + Instance = new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FieldSortDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public static explicit operator Elastic.Clients.Elasticsearch.FieldSortDescriptor(Elastic.Clients.Elasticsearch.FieldSort instance) => new Elastic.Clients.Elasticsearch.FieldSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.FieldSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - MissingValue = missing; - return Self; + Instance.Field = value; + return this; } - public FieldSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Field(System.Linq.Expressions.Expression> value) { - ModeValue = mode; - return Self; + Instance.Field = value; + return this; } - public FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Format(string? value) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.Format = value; + return this; } - public FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Missing(object? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Missing = value; + return this; } - public FieldSortDescriptor Nested(Action> configure) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Mode = value; + return this; } - public FieldSortDescriptor NumericType(Elastic.Clients.Elasticsearch.FieldSortNumericType? numericType) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NumericTypeValue = numericType; - return Self; + Instance.Nested = value; + return this; } - public FieldSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Nested(System.Action> action) { - OrderValue = order; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public FieldSortDescriptor UnmappedType(Elastic.Clients.Elasticsearch.Mapping.FieldType? unmappedType) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor NumericType(Elastic.Clients.Elasticsearch.FieldSortNumericType? value) { - UnmappedTypeValue = unmappedType; - return Self; + Instance.NumericType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (NumericTypeValue is not null) - { - writer.WritePropertyName("numeric_type"); - JsonSerializer.Serialize(writer, NumericTypeValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } + Instance.Order = value; + return this; + } - if (UnmappedTypeValue is not null) - { - writer.WritePropertyName("unmapped_type"); - JsonSerializer.Serialize(writer, UnmappedTypeValue, options); - } + public Elastic.Clients.Elasticsearch.FieldSortDescriptor UnmappedType(Elastic.Clients.Elasticsearch.Mapping.FieldType? value) + { + Instance.UnmappedType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.FieldSort Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldSortDescriptor(new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldSortDescriptor : SerializableDescriptor +public readonly partial struct FieldSortDescriptor { - internal FieldSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.FieldSort Instance { get; init; } - public FieldSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSortDescriptor(Elastic.Clients.Elasticsearch.FieldSort instance) { + Instance = instance; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.FieldSortNumericType? NumericTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldType? UnmappedTypeValue { get; set; } - - public FieldSortDescriptor Format(string? format) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSortDescriptor() { - FormatValue = format; - return Self; + Instance = new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FieldSortDescriptor Missing(Elastic.Clients.Elasticsearch.FieldValue? missing) + public static explicit operator Elastic.Clients.Elasticsearch.FieldSortDescriptor(Elastic.Clients.Elasticsearch.FieldSort instance) => new Elastic.Clients.Elasticsearch.FieldSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.FieldSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - MissingValue = missing; - return Self; + Instance.Field = value; + return this; } - public FieldSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Field(System.Linq.Expressions.Expression> value) { - ModeValue = mode; - return Self; + Instance.Field = value; + return this; } - public FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Format(string? value) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.Format = value; + return this; } - public FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Missing(object? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Missing = value; + return this; } - public FieldSortDescriptor Nested(Action configure) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Mode = value; + return this; } - public FieldSortDescriptor NumericType(Elastic.Clients.Elasticsearch.FieldSortNumericType? numericType) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NumericTypeValue = numericType; - return Self; + Instance.Nested = value; + return this; } - public FieldSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Nested(System.Action action) { - OrderValue = order; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public FieldSortDescriptor UnmappedType(Elastic.Clients.Elasticsearch.Mapping.FieldType? unmappedType) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Nested(System.Action> action) { - UnmappedTypeValue = unmappedType; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.FieldSortDescriptor NumericType(Elastic.Clients.Elasticsearch.FieldSortNumericType? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, MissingValue, options); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (NumericTypeValue is not null) - { - writer.WritePropertyName("numeric_type"); - JsonSerializer.Serialize(writer, NumericTypeValue, options); - } + Instance.NumericType = value; + return this; + } - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } + public Elastic.Clients.Elasticsearch.FieldSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) + { + Instance.Order = value; + return this; + } - if (UnmappedTypeValue is not null) - { - writer.WritePropertyName("unmapped_type"); - JsonSerializer.Serialize(writer, UnmappedTypeValue, options); - } + public Elastic.Clients.Elasticsearch.FieldSortDescriptor UnmappedType(Elastic.Clients.Elasticsearch.Mapping.FieldType? value) + { + Instance.UnmappedType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.FieldSort Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.FieldSortDescriptor(new Elastic.Clients.Elasticsearch.FieldSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FielddataStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FielddataStats.g.cs index f3328e0464e..bb9626e0409 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FielddataStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FielddataStats.g.cs @@ -17,25 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FielddataStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySize = System.Text.Json.JsonEncodedText.Encode("memory_size"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySizeInBytes = System.Text.Json.JsonEncodedText.Encode("memory_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.FielddataStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEvictions = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propMemorySize = default; + LocalJsonValue propMemorySizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMemorySize.TryReadProperty(ref reader, options, PropMemorySize, null)) + { + continue; + } + + if (propMemorySizeInBytes.TryReadProperty(ref reader, options, PropMemorySizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FielddataStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Evictions = propEvictions.Value, + Fields = propFields.Value, + MemorySize = propMemorySize.Value, + MemorySizeInBytes = propMemorySizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FielddataStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMemorySize, value.MemorySize, null, null); + writer.WriteProperty(options, PropMemorySizeInBytes, value.MemorySizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FielddataStatsConverter))] public sealed partial class FielddataStats { - [JsonInclude, JsonPropertyName("evictions")] - public long? Evictions { get; init; } - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.FieldMemoryUsage))] - public IReadOnlyDictionary? Fields { get; init; } - [JsonInclude, JsonPropertyName("memory_size")] - public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; init; } - [JsonInclude, JsonPropertyName("memory_size_in_bytes")] - public long MemorySizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FielddataStats(long memorySizeInBytes) + { + MemorySizeInBytes = memorySizeInBytes; + } +#if NET7_0_OR_GREATER + public FielddataStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FielddataStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FielddataStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? Evictions { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemorySizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FlushStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FlushStats.g.cs index c48aca3fca0..a24779dc9f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FlushStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FlushStats.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FlushStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPeriodic = System.Text.Json.JsonEncodedText.Encode("periodic"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.FlushStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPeriodic = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPeriodic.TryReadProperty(ref reader, options, PropPeriodic, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.FlushStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Periodic = propPeriodic.Value, + Total = propTotal.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.FlushStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPeriodic, value.Periodic, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FlushStatsConverter))] public sealed partial class FlushStats { - [JsonInclude, JsonPropertyName("periodic")] - public long Periodic { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlushStats(long periodic, long total, System.TimeSpan totalTimeInMillis) + { + Periodic = periodic; + Total = total; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public FlushStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FlushStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlushStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Periodic { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs index 467552231b7..cc8e44c0b67 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs @@ -17,29 +17,81 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class FuzzinessConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Fuzziness Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Fuzziness(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Fuzziness(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Fuzziness)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Fuzziness value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class Fuzziness : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.FuzzinessConverter))] +public sealed partial class Fuzziness : Elastic.Clients.Elasticsearch.Union { - public Fuzziness(string Fuzziness) : base(Fuzziness) + public Fuzziness(string value) : base(value) + { + } + + public Fuzziness(int value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Fuzziness(string value) => new Elastic.Clients.Elasticsearch.Fuzziness(value); + public static implicit operator Elastic.Clients.Elasticsearch.Fuzziness(int value) => new Elastic.Clients.Elasticsearch.Fuzziness(value); +} + +public readonly partial struct FuzzinessFactory +{ + public Elastic.Clients.Elasticsearch.Fuzziness Value(string value) + { + return new Elastic.Clients.Elasticsearch.Fuzziness(value); + } + + public Elastic.Clients.Elasticsearch.Fuzziness Value(int value) { + return new Elastic.Clients.Elasticsearch.Fuzziness(value); } - public Fuzziness(int Fuzziness) : base(Fuzziness) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Fuzziness Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.FuzzinessFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs index be1e7b57175..224deb0c715 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs @@ -17,16 +17,9 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; @@ -57,8 +50,7 @@ namespace Elastic.Clients.Elasticsearch; /// /// /// -[JsonConverter(typeof(GeoBoundsConverter))] -public sealed partial class GeoBounds : IComplexUnion +public sealed partial class GeoBounds : Elastic.Clients.Elasticsearch.Core.IComplexUnion { public enum Kind { @@ -71,9 +63,9 @@ public enum Kind private readonly Kind _kind; private readonly object _value; - Kind IComplexUnion.ValueKind => _kind; + Kind Elastic.Clients.Elasticsearch.Core.IComplexUnion.ValueKind => _kind; - object IComplexUnion.Value => _value; + object Elastic.Clients.Elasticsearch.Core.IComplexUnion.Value => _value; private GeoBounds(Kind kind, object value) { @@ -81,11 +73,15 @@ private GeoBounds(Kind kind, object value) _value = value; } - public static GeoBounds Coordinates(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => new(Kind.Coordinates, coordinates); + internal GeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBounds variant) : this(Kind.Coordinates, variant) + { + } + + public static Elastic.Clients.Elasticsearch.GeoBounds Coordinates(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => new(Kind.Coordinates, coordinates); - public bool IsCoordinates => _kind == Kind.Coordinates; + public bool IsCoordinates => _kind is Kind.Coordinates; - public bool TryGetCoordinates([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.CoordsGeoBounds? coordinates) + public bool TryGetCoordinates([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.CoordsGeoBounds? coordinates) { coordinates = null; if (_kind == Kind.Coordinates) @@ -97,13 +93,17 @@ public bool TryGetCoordinates([NotNullWhen(true)] out Elastic.Clients.Elasticsea return false; } - public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => GeoBounds.Coordinates(coordinates); + public static implicit operator Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => GeoBounds.Coordinates(coordinates); - public static GeoBounds TopLeftBottomRight(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => new(Kind.TopLeftBottomRight, topLeftBottomRight); + internal GeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds variant) : this(Kind.TopLeftBottomRight, variant) + { + } + + public static Elastic.Clients.Elasticsearch.GeoBounds TopLeftBottomRight(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => new(Kind.TopLeftBottomRight, topLeftBottomRight); - public bool IsTopLeftBottomRight => _kind == Kind.TopLeftBottomRight; + public bool IsTopLeftBottomRight => _kind is Kind.TopLeftBottomRight; - public bool TryGetTopLeftBottomRight([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds? topLeftBottomRight) + public bool TryGetTopLeftBottomRight([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds? topLeftBottomRight) { topLeftBottomRight = null; if (_kind == Kind.TopLeftBottomRight) @@ -115,13 +115,17 @@ public bool TryGetTopLeftBottomRight([NotNullWhen(true)] out Elastic.Clients.Ela return false; } - public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => GeoBounds.TopLeftBottomRight(topLeftBottomRight); + public static implicit operator Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => GeoBounds.TopLeftBottomRight(topLeftBottomRight); - public static GeoBounds TopRightBottomLeft(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => new(Kind.TopRightBottomLeft, topRightBottomLeft); + internal GeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds variant) : this(Kind.TopRightBottomLeft, variant) + { + } - public bool IsTopRightBottomLeft => _kind == Kind.TopRightBottomLeft; + public static Elastic.Clients.Elasticsearch.GeoBounds TopRightBottomLeft(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => new(Kind.TopRightBottomLeft, topRightBottomLeft); - public bool TryGetTopRightBottomLeft([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds? topRightBottomLeft) + public bool IsTopRightBottomLeft => _kind is Kind.TopRightBottomLeft; + + public bool TryGetTopRightBottomLeft([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds? topRightBottomLeft) { topRightBottomLeft = null; if (_kind == Kind.TopRightBottomLeft) @@ -133,13 +137,17 @@ public bool TryGetTopRightBottomLeft([NotNullWhen(true)] out Elastic.Clients.Ela return false; } - public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => GeoBounds.TopRightBottomLeft(topRightBottomLeft); + public static implicit operator Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => GeoBounds.TopRightBottomLeft(topRightBottomLeft); - public static GeoBounds Wkt(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => new(Kind.Wkt, wkt); + internal GeoBounds(Elastic.Clients.Elasticsearch.WktGeoBounds variant) : this(Kind.Wkt, variant) + { + } - public bool IsWkt => _kind == Kind.Wkt; + public static Elastic.Clients.Elasticsearch.GeoBounds Wkt(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => new(Kind.Wkt, wkt); - public bool TryGetWkt([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.WktGeoBounds? wkt) + public bool IsWkt => _kind is Kind.Wkt; + + public bool TryGetWkt([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.WktGeoBounds? wkt) { wkt = null; if (_kind == Kind.Wkt) @@ -151,15 +159,55 @@ public bool TryGetWkt([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.WktG return false; } - public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => GeoBounds.Wkt(wkt); + public static implicit operator Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => GeoBounds.Wkt(wkt); } -internal sealed class GeoBoundsConverter : MultiItemUnionConverter +public readonly partial struct GeoBoundsFactory { - public GeoBoundsConverter() + public Elastic.Clients.Elasticsearch.GeoBounds Coordinates(Elastic.Clients.Elasticsearch.CoordsGeoBounds value) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(value); + } + + public Elastic.Clients.Elasticsearch.GeoBounds Coordinates(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBoundsDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.GeoBounds TopLeftBottomRight(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds value) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(value); + } + + public Elastic.Clients.Elasticsearch.GeoBounds TopLeftBottomRight(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.GeoBounds TopRightBottomLeft(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds value) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(value); + } + + public Elastic.Clients.Elasticsearch.GeoBounds TopRightBottomLeft(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.GeoBounds Wkt(Elastic.Clients.Elasticsearch.WktGeoBounds value) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(value); + } + + public Elastic.Clients.Elasticsearch.GeoBounds Wkt(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoBounds(Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor.Build(action)); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeoBounds Build(System.Func action) { - _types = new Dictionary { { GeoBounds.Kind.Coordinates, typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds) }, { GeoBounds.Kind.TopLeftBottomRight, typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds) }, { GeoBounds.Kind.TopRightBottomLeft, typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds) }, { GeoBounds.Kind.Wkt, typeof(Elastic.Clients.Elasticsearch.WktGeoBounds) } }; - _factories = new Dictionary> { { typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds), o => GeoBounds.Coordinates((Elastic.Clients.Elasticsearch.CoordsGeoBounds)o) }, { typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds), o => GeoBounds.TopLeftBottomRight((Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds)o) }, { typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds), o => GeoBounds.TopRightBottomLeft((Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds)o) }, { typeof(Elastic.Clients.Elasticsearch.WktGeoBounds), o => GeoBounds.Wkt((Elastic.Clients.Elasticsearch.WktGeoBounds)o) } }; - _uniquePropertyToType = new Dictionary { { "bottom", typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds) }, { "bottom_right", typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds) }, { "bottom_left", typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds) }, { "wkt", typeof(Elastic.Clients.Elasticsearch.WktGeoBounds) } }; + var builder = new Elastic.Clients.Elasticsearch.GeoBoundsFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs index d3eaa418c60..83455531eee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoDistanceSort.g.cs @@ -17,453 +17,354 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -internal sealed partial class GeoDistanceSortConverter : JsonConverter +internal sealed partial class GeoDistanceSortConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoDistanceSort Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropDistanceType = System.Text.Json.JsonEncodedText.Encode("distance_type"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropUnit = System.Text.Json.JsonEncodedText.Encode("unit"); + + public override Elastic.Clients.Elasticsearch.GeoDistanceSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new GeoDistanceSort(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDistanceType = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue> propLocation = default; + LocalJsonValue propMode = default; + LocalJsonValue propNested = default; + LocalJsonValue propOrder = default; + LocalJsonValue propUnit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propDistanceType.TryReadProperty(ref reader, options, PropDistanceType, null)) { - var property = reader.GetString(); - if (property == "distance_type") - { - variant.DistanceType = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignore_unmapped") - { - variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "mode") - { - variant.Mode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "nested") - { - variant.Nested = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "order") - { - variant.Order = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "unit") - { - variant.Unit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Location = JsonSerializer.Deserialize>(ref reader, options); + continue; } - } - return variant; - } - - public override void Write(Utf8JsonWriter writer, GeoDistanceSort value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.Location is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Location, options); - } - - if (value.DistanceType is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, value.DistanceType, options); - } + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } - if (value.IgnoreUnmapped.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(value.IgnoreUnmapped.Value); - } + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } - if (value.Mode is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, value.Mode, options); - } + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } - if (value.Nested is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, value.Nested, options); - } + if (propUnit.TryReadProperty(ref reader, options, PropUnit, null)) + { + continue; + } - if (value.Order is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, value.Order, options); + propField.Initialized = propLocation.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propLocation.Value, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!); } - if (value.Unit is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, value.Unit, options); - } + DistanceType = propDistanceType.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + Location = propLocation.Value, + Mode = propMode.Value, + Nested = propNested.Value, + Order = propOrder.Value, + Unit = propUnit.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoDistanceSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDistanceType, value.DistanceType, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropUnit, value.Unit, null, null); + writer.WriteProperty(options, value.Field, value.Location, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); writer.WriteEndObject(); } } -[JsonConverter(typeof(GeoDistanceSortConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeoDistanceSortConverter))] public sealed partial class GeoDistanceSort { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceSort(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection location) + { + Field = field; + Location = location; + } +#if NET7_0_OR_GREATER + public GeoDistanceSort() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoDistanceSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public bool? IgnoreUnmapped { get; set; } - public ICollection Location { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Location { get; set; } public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } public Elastic.Clients.Elasticsearch.NestedSortValue? Nested { get; set; } public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } public Elastic.Clients.Elasticsearch.DistanceUnit? Unit { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(GeoDistanceSort geoDistanceSort) => Elastic.Clients.Elasticsearch.SortOptions.GeoDistance(geoDistanceSort); } -public sealed partial class GeoDistanceSortDescriptor : SerializableDescriptor> +public readonly partial struct GeoDistanceSortDescriptor { - internal GeoDistanceSortDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GeoDistanceSort Instance { get; init; } - public GeoDistanceSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceSortDescriptor(Elastic.Clients.Elasticsearch.GeoDistanceSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private ICollection LocationValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action> NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } - - public GeoDistanceSortDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceSortDescriptor() { - DistanceTypeValue = distanceType; - return Self; + Instance = new Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GeoDistanceSortDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public static explicit operator Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(Elastic.Clients.Elasticsearch.GeoDistanceSort instance) => new Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - FieldValue = field; - return Self; + Instance.DistanceType = value; + return this; } - public GeoDistanceSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceSortDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public GeoDistanceSortDescriptor Location(ICollection location) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(System.Collections.Generic.ICollection value) { - LocationValue = location; - return Self; + Instance.Location = value; + return this; } - public GeoDistanceSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(params Elastic.Clients.Elasticsearch.GeoLocation[] values) { - ModeValue = mode; - return Self; + Instance.Location = [.. values]; + return this; } - public GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(params System.Func[] actions) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action)); + } + + Instance.Location = items; + return this; } - public GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Mode = value; + return this; } - public GeoDistanceSortDescriptor Nested(Action> configure) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = value; + return this; } - public GeoDistanceSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Nested(System.Action> action) { - OrderValue = order; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public GeoDistanceSortDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - UnitValue = unit; - return Self; + Instance.Order = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? value) { - writer.WriteStartObject(); - if (FieldValue is not null && LocationValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (DistanceTypeValue is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (UnitValue is not null) - { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); - } + Instance.Unit = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeoDistanceSort Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(new Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoDistanceSortDescriptor : SerializableDescriptor +public readonly partial struct GeoDistanceSortDescriptor { - internal GeoDistanceSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GeoDistanceSort Instance { get; init; } - public GeoDistanceSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceSortDescriptor(Elastic.Clients.Elasticsearch.GeoDistanceSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private ICollection LocationValue { get; set; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.DistanceUnit? UnitValue { get; set; } - - public GeoDistanceSortDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceSortDescriptor() { - DistanceTypeValue = distanceType; - return Self; + Instance = new Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GeoDistanceSortDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public static explicit operator Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(Elastic.Clients.Elasticsearch.GeoDistanceSort instance) => new Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - FieldValue = field; - return Self; + Instance.DistanceType = value; + return this; } - public GeoDistanceSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceSortDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceSortDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public GeoDistanceSortDescriptor Location(ICollection location) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(System.Collections.Generic.ICollection value) { - LocationValue = location; - return Self; + Instance.Location = value; + return this; } - public GeoDistanceSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(params Elastic.Clients.Elasticsearch.GeoLocation[] values) { - ModeValue = mode; - return Self; + Instance.Location = [.. values]; + return this; } - public GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Location(params System.Func[] actions) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action)); + } + + Instance.Location = items; + return this; } - public GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Mode = value; + return this; } - public GeoDistanceSortDescriptor Nested(Action configure) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = value; + return this; } - public GeoDistanceSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Nested(System.Action action) { - OrderValue = order; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public GeoDistanceSortDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? unit) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Nested(System.Action> action) { - UnitValue = unit; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - writer.WriteStartObject(); - if (FieldValue is not null && LocationValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (DistanceTypeValue is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } + Instance.Order = value; + return this; + } - if (UnitValue is not null) - { - writer.WritePropertyName("unit"); - JsonSerializer.Serialize(writer, UnitValue, options); - } + public Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor Unit(Elastic.Clients.Elasticsearch.DistanceUnit? value) + { + Instance.Unit = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeoDistanceSort Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor(new Elastic.Clients.Elasticsearch.GeoDistanceSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs index 0606ef6dc53..fadd6a51537 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class GeoHashLocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGeohash = System.Text.Json.JsonEncodedText.Encode("geohash"); + + public override Elastic.Clients.Elasticsearch.GeoHashLocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGeohash = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGeohash.TryReadProperty(ref reader, options, PropGeohash, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GeoHashLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Geohash = propGeohash.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoHashLocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGeohash, value.Geohash, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeoHashLocationConverter))] public sealed partial class GeoHashLocation { - [JsonInclude, JsonPropertyName("geohash")] - public string Geohash { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoHashLocation(string geohash) + { + Geohash = geohash; + } +#if NET7_0_OR_GREATER + public GeoHashLocation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoHashLocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoHashLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Geohash { get; set; } } -public sealed partial class GeoHashLocationDescriptor : SerializableDescriptor +public readonly partial struct GeoHashLocationDescriptor { - internal GeoHashLocationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.GeoHashLocation Instance { get; init; } - public GeoHashLocationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoHashLocationDescriptor(Elastic.Clients.Elasticsearch.GeoHashLocation instance) { + Instance = instance; } - private string GeohashValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoHashLocationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.GeoHashLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public GeoHashLocationDescriptor Geohash(string geohash) + public static explicit operator Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor(Elastic.Clients.Elasticsearch.GeoHashLocation instance) => new Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.GeoHashLocation(Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor Geohash(string value) { - GeohashValue = geohash; - return Self; + Instance.Geohash = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeoHashLocation Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("geohash"); - writer.WriteStringValue(GeohashValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor(new Elastic.Clients.Elasticsearch.GeoHashLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLine.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLine.g.cs index 126a6f621f7..65804e83edd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLine.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLine.g.cs @@ -17,36 +17,110 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class GeoLineConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCoordinates = System.Text.Json.JsonEncodedText.Encode("coordinates"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.GeoLine Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propCoordinates = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCoordinates.TryReadProperty(ref reader, options, PropCoordinates, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GeoLine(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Coordinates = propCoordinates.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeoLine value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCoordinates, value.Coordinates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A GeoJson GeoLine. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeoLineConverter))] public sealed partial class GeoLine { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoLine(System.Collections.Generic.IReadOnlyCollection> coordinates, string type) + { + Coordinates = coordinates; + Type = type; + } +#if NET7_0_OR_GREATER + public GeoLine() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoLine() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoLine(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Array of [lon, lat] coordinates /// /// - [JsonInclude, JsonPropertyName("coordinates")] - public IReadOnlyCollection> Coordinates { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Coordinates { get; set; } /// /// /// Always "LineString" /// /// - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs index 6688041ea3a..27f0c22a406 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs @@ -17,16 +17,9 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; @@ -57,13 +50,12 @@ namespace Elastic.Clients.Elasticsearch; /// /// /// -[JsonConverter(typeof(GeoLocationConverter))] -public sealed partial class GeoLocation : IComplexUnion +public sealed partial class GeoLocation : Elastic.Clients.Elasticsearch.Core.IComplexUnion { public enum Kind { LatitudeLongitude, - Geohash, + GeoHash, Coordinates, Text } @@ -71,9 +63,9 @@ public enum Kind private readonly Kind _kind; private readonly object _value; - Kind IComplexUnion.ValueKind => _kind; + Kind Elastic.Clients.Elasticsearch.Core.IComplexUnion.ValueKind => _kind; - object IComplexUnion.Value => _value; + object Elastic.Clients.Elasticsearch.Core.IComplexUnion.Value => _value; private GeoLocation(Kind kind, object value) { @@ -81,11 +73,15 @@ private GeoLocation(Kind kind, object value) _value = value; } - public static GeoLocation LatitudeLongitude(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => new(Kind.LatitudeLongitude, latitudeLongitude); + internal GeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocation variant) : this(Kind.LatitudeLongitude, variant) + { + } + + public static Elastic.Clients.Elasticsearch.GeoLocation LatitudeLongitude(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => new(Kind.LatitudeLongitude, latitudeLongitude); - public bool IsLatitudeLongitude => _kind == Kind.LatitudeLongitude; + public bool IsLatitudeLongitude => _kind is Kind.LatitudeLongitude; - public bool TryGetLatitudeLongitude([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.LatLonGeoLocation? latitudeLongitude) + public bool TryGetLatitudeLongitude([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.LatLonGeoLocation? latitudeLongitude) { latitudeLongitude = null; if (_kind == Kind.LatitudeLongitude) @@ -97,49 +93,61 @@ public bool TryGetLatitudeLongitude([NotNullWhen(true)] out Elastic.Clients.Elas return false; } - public static implicit operator GeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => GeoLocation.LatitudeLongitude(latitudeLongitude); + public static implicit operator Elastic.Clients.Elasticsearch.GeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => GeoLocation.LatitudeLongitude(latitudeLongitude); - public static GeoLocation Geohash(Elastic.Clients.Elasticsearch.GeoHashLocation geohash) => new(Kind.Geohash, geohash); + internal GeoLocation(Elastic.Clients.Elasticsearch.GeoHashLocation variant) : this(Kind.GeoHash, variant) + { + } - public bool IsGeohash => _kind == Kind.Geohash; + public static Elastic.Clients.Elasticsearch.GeoLocation GeoHash(Elastic.Clients.Elasticsearch.GeoHashLocation geoHash) => new(Kind.GeoHash, geoHash); - public bool TryGetGeohash([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.GeoHashLocation? geohash) + public bool IsGeoHash => _kind is Kind.GeoHash; + + public bool TryGetGeoHash([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out Elastic.Clients.Elasticsearch.GeoHashLocation? geoHash) { - geohash = null; - if (_kind == Kind.Geohash) + geoHash = null; + if (_kind == Kind.GeoHash) { - geohash = (Elastic.Clients.Elasticsearch.GeoHashLocation)_value; + geoHash = (Elastic.Clients.Elasticsearch.GeoHashLocation)_value; return true; } return false; } - public static implicit operator GeoLocation(Elastic.Clients.Elasticsearch.GeoHashLocation geohash) => GeoLocation.Geohash(geohash); + public static implicit operator Elastic.Clients.Elasticsearch.GeoLocation(Elastic.Clients.Elasticsearch.GeoHashLocation geoHash) => GeoLocation.GeoHash(geoHash); + + internal GeoLocation(System.Collections.Generic.ICollection variant) : this(Kind.Coordinates, variant) + { + } - public static GeoLocation Coordinates(double[] coordinates) => new(Kind.Coordinates, coordinates); + public static Elastic.Clients.Elasticsearch.GeoLocation Coordinates(System.Collections.Generic.ICollection coordinates) => new(Kind.Coordinates, coordinates); - public bool IsCoordinates => _kind == Kind.Coordinates; + public bool IsCoordinates => _kind is Kind.Coordinates; - public bool TryGetCoordinates([NotNullWhen(true)] out double[]? coordinates) + public bool TryGetCoordinates([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out System.Collections.Generic.ICollection? coordinates) { coordinates = null; if (_kind == Kind.Coordinates) { - coordinates = (double[])_value; + coordinates = (System.Collections.Generic.ICollection)_value; return true; } return false; } - public static implicit operator GeoLocation(double[] coordinates) => GeoLocation.Coordinates(coordinates); + public static implicit operator Elastic.Clients.Elasticsearch.GeoLocation(double[] coordinates) => GeoLocation.Coordinates(coordinates); + + internal GeoLocation(string variant) : this(Kind.Text, variant) + { + } - public static GeoLocation Text(string text) => new(Kind.Text, text); + public static Elastic.Clients.Elasticsearch.GeoLocation Text(string text) => new(Kind.Text, text); - public bool IsText => _kind == Kind.Text; + public bool IsText => _kind is Kind.Text; - public bool TryGetText([NotNullWhen(true)] out string? text) + public bool TryGetText([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out string? text) { text = null; if (_kind == Kind.Text) @@ -151,15 +159,50 @@ public bool TryGetText([NotNullWhen(true)] out string? text) return false; } - public static implicit operator GeoLocation(string text) => GeoLocation.Text(text); + public static implicit operator Elastic.Clients.Elasticsearch.GeoLocation(string text) => GeoLocation.Text(text); } -internal sealed class GeoLocationConverter : MultiItemUnionConverter +public readonly partial struct GeoLocationFactory { - public GeoLocationConverter() + public Elastic.Clients.Elasticsearch.GeoLocation LatitudeLongitude(Elastic.Clients.Elasticsearch.LatLonGeoLocation value) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(value); + } + + public Elastic.Clients.Elasticsearch.GeoLocation LatitudeLongitude(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.GeoLocation GeoHash(Elastic.Clients.Elasticsearch.GeoHashLocation value) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(value); + } + + public Elastic.Clients.Elasticsearch.GeoLocation GeoHash(System.Action action) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(Elastic.Clients.Elasticsearch.GeoHashLocationDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.GeoLocation Coordinates(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(value); + } + + public Elastic.Clients.Elasticsearch.GeoLocation Coordinates(params double[] values) + { + return new Elastic.Clients.Elasticsearch.GeoLocation([.. values]); + } + + public Elastic.Clients.Elasticsearch.GeoLocation Text(string value) + { + return new Elastic.Clients.Elasticsearch.GeoLocation(value); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeoLocation Build(System.Func action) { - _types = new Dictionary { { GeoLocation.Kind.LatitudeLongitude, typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation) }, { GeoLocation.Kind.Geohash, typeof(Elastic.Clients.Elasticsearch.GeoHashLocation) } }; - _factories = new Dictionary> { { typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation), o => GeoLocation.LatitudeLongitude((Elastic.Clients.Elasticsearch.LatLonGeoLocation)o) }, { typeof(Elastic.Clients.Elasticsearch.GeoHashLocation), o => GeoLocation.Geohash((Elastic.Clients.Elasticsearch.GeoHashLocation)o) } }; - _uniquePropertyToType = new Dictionary { { "lat", typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation) }, { "geohash", typeof(Elastic.Clients.Elasticsearch.GeoHashLocation) } }; + var builder = new Elastic.Clients.Elasticsearch.GeoLocationFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs index 63c4fc0fb88..7b746a0a774 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeohashPrecision.g.cs @@ -17,31 +17,83 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class GeohashPrecisionConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.GeohashPrecision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.GeohashPrecision(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.GeohashPrecision(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.GeohashPrecision)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GeohashPrecision value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// A precision that can be expressed as a geohash length between 1 and 12, or a distance measure like "1km", "10m". /// /// -public sealed partial class GeohashPrecision : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GeohashPrecisionConverter))] +public sealed partial class GeohashPrecision : Elastic.Clients.Elasticsearch.Union { - public GeohashPrecision(double GeohashLength) : base(GeohashLength) + public GeohashPrecision(long value) : base(value) + { + } + + public GeohashPrecision(string value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.GeohashPrecision(long value) => new Elastic.Clients.Elasticsearch.GeohashPrecision(value); + public static implicit operator Elastic.Clients.Elasticsearch.GeohashPrecision(string value) => new Elastic.Clients.Elasticsearch.GeohashPrecision(value); +} + +public readonly partial struct GeohashPrecisionFactory +{ + public Elastic.Clients.Elasticsearch.GeohashPrecision GeohashLength(long value) + { + return new Elastic.Clients.Elasticsearch.GeohashPrecision(value); + } + + public Elastic.Clients.Elasticsearch.GeohashPrecision Distance(string value) { + return new Elastic.Clients.Elasticsearch.GeohashPrecision(value); } - public GeohashPrecision(string Distance) : base(Distance) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.GeohashPrecision Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.GeohashPrecisionFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GetStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GetStats.g.cs index 2a6e9c1bddf..904bc434eba 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GetStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GetStats.g.cs @@ -17,36 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class GetStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropExistsTime = System.Text.Json.JsonEncodedText.Encode("exists_time"); + private static readonly System.Text.Json.JsonEncodedText PropExistsTimeInMillis = System.Text.Json.JsonEncodedText.Encode("exists_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropExistsTotal = System.Text.Json.JsonEncodedText.Encode("exists_total"); + private static readonly System.Text.Json.JsonEncodedText PropMissingTime = System.Text.Json.JsonEncodedText.Encode("missing_time"); + private static readonly System.Text.Json.JsonEncodedText PropMissingTimeInMillis = System.Text.Json.JsonEncodedText.Encode("missing_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropMissingTotal = System.Text.Json.JsonEncodedText.Encode("missing_total"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.GetStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrent = default; + LocalJsonValue propExistsTime = default; + LocalJsonValue propExistsTimeInMillis = default; + LocalJsonValue propExistsTotal = default; + LocalJsonValue propMissingTime = default; + LocalJsonValue propMissingTimeInMillis = default; + LocalJsonValue propMissingTotal = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInMillis = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propExistsTime.TryReadProperty(ref reader, options, PropExistsTime, null)) + { + continue; + } + + if (propExistsTimeInMillis.TryReadProperty(ref reader, options, PropExistsTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propExistsTotal.TryReadProperty(ref reader, options, PropExistsTotal, null)) + { + continue; + } + + if (propMissingTime.TryReadProperty(ref reader, options, PropMissingTime, null)) + { + continue; + } + + if (propMissingTimeInMillis.TryReadProperty(ref reader, options, PropMissingTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propMissingTotal.TryReadProperty(ref reader, options, PropMissingTotal, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.GetStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Current = propCurrent.Value, + ExistsTime = propExistsTime.Value, + ExistsTimeInMillis = propExistsTimeInMillis.Value, + ExistsTotal = propExistsTotal.Value, + MissingTime = propMissingTime.Value, + MissingTimeInMillis = propMissingTimeInMillis.Value, + MissingTotal = propMissingTotal.Value, + Time = propTime.Value, + TimeInMillis = propTimeInMillis.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.GetStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropExistsTime, value.ExistsTime, null, null); + writer.WriteProperty(options, PropExistsTimeInMillis, value.ExistsTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropExistsTotal, value.ExistsTotal, null, null); + writer.WriteProperty(options, PropMissingTime, value.MissingTime, null, null); + writer.WriteProperty(options, PropMissingTimeInMillis, value.MissingTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropMissingTotal, value.MissingTotal, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.GetStatsConverter))] public sealed partial class GetStats { - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } - [JsonInclude, JsonPropertyName("exists_time")] - public Elastic.Clients.Elasticsearch.Duration? ExistsTime { get; init; } - [JsonInclude, JsonPropertyName("exists_time_in_millis")] - public long ExistsTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("exists_total")] - public long ExistsTotal { get; init; } - [JsonInclude, JsonPropertyName("missing_time")] - public Elastic.Clients.Elasticsearch.Duration? MissingTime { get; init; } - [JsonInclude, JsonPropertyName("missing_time_in_millis")] - public long MissingTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("missing_total")] - public long MissingTotal { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStats(long current, System.TimeSpan existsTimeInMillis, long existsTotal, System.TimeSpan missingTimeInMillis, long missingTotal, System.TimeSpan timeInMillis, long total) + { + Current = current; + ExistsTimeInMillis = existsTimeInMillis; + ExistsTotal = existsTotal; + MissingTimeInMillis = missingTimeInMillis; + MissingTotal = missingTotal; + TimeInMillis = timeInMillis; + Total = total; + } +#if NET7_0_OR_GREATER + public GetStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GetStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ExistsTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ExistsTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ExistsTotal { get; set; } + public Elastic.Clients.Elasticsearch.Duration? MissingTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan MissingTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MissingTotal { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Connection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Connection.g.cs index 5fca74a7a6c..b1fc8d21624 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Connection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Connection.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class ConnectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropTarget = System.Text.Json.JsonEncodedText.Encode("target"); + private static readonly System.Text.Json.JsonEncodedText PropWeight = System.Text.Json.JsonEncodedText.Encode("weight"); + + public override Elastic.Clients.Elasticsearch.Graph.Connection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocCount = default; + LocalJsonValue propSource = default; + LocalJsonValue propTarget = default; + LocalJsonValue propWeight = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propTarget.TryReadProperty(ref reader, options, PropTarget, null)) + { + continue; + } + + if (propWeight.TryReadProperty(ref reader, options, PropWeight, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.Connection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocCount = propDocCount.Value, + Source = propSource.Value, + Target = propTarget.Value, + Weight = propWeight.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.Connection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropTarget, value.Target, null, null); + writer.WriteProperty(options, PropWeight, value.Weight, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.ConnectionConverter))] public sealed partial class Connection { - [JsonInclude, JsonPropertyName("doc_count")] - public long DocCount { get; init; } - [JsonInclude, JsonPropertyName("source")] - public long Source { get; init; } - [JsonInclude, JsonPropertyName("target")] - public long Target { get; init; } - [JsonInclude, JsonPropertyName("weight")] - public double Weight { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Connection(long docCount, long source, long target, double weight) + { + DocCount = docCount; + Source = source; + Target = target; + Weight = weight; + } +#if NET7_0_OR_GREATER + public Connection() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Connection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Connection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Target { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Weight { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/ExploreControls.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/ExploreControls.g.cs index 938e767082a..5731543e7fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/ExploreControls.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/ExploreControls.g.cs @@ -17,25 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class ExploreControlsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSampleDiversity = System.Text.Json.JsonEncodedText.Encode("sample_diversity"); + private static readonly System.Text.Json.JsonEncodedText PropSampleSize = System.Text.Json.JsonEncodedText.Encode("sample_size"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + private static readonly System.Text.Json.JsonEncodedText PropUseSignificance = System.Text.Json.JsonEncodedText.Encode("use_significance"); + + public override Elastic.Clients.Elasticsearch.Graph.ExploreControls Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSampleDiversity = default; + LocalJsonValue propSampleSize = default; + LocalJsonValue propTimeout = default; + LocalJsonValue propUseSignificance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSampleDiversity.TryReadProperty(ref reader, options, PropSampleDiversity, null)) + { + continue; + } + + if (propSampleSize.TryReadProperty(ref reader, options, PropSampleSize, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (propUseSignificance.TryReadProperty(ref reader, options, PropUseSignificance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SampleDiversity = propSampleDiversity.Value, + SampleSize = propSampleSize.Value, + Timeout = propTimeout.Value, + UseSignificance = propUseSignificance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.ExploreControls value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSampleDiversity, value.SampleDiversity, null, null); + writer.WriteProperty(options, PropSampleSize, value.SampleSize, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteProperty(options, PropUseSignificance, value.UseSignificance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.ExploreControlsConverter))] public sealed partial class ExploreControls { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreControls(bool useSignificance) + { + UseSignificance = useSignificance; + } +#if NET7_0_OR_GREATER + public ExploreControls() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExploreControls() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// To avoid the top-matching documents sample being dominated by a single source of results, it is sometimes necessary to request diversity in the sample. /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. /// /// - [JsonInclude, JsonPropertyName("sample_diversity")] public Elastic.Clients.Elasticsearch.Graph.SampleDiversity? SampleDiversity { get; set; } /// @@ -46,7 +130,6 @@ public sealed partial class ExploreControls /// Very large sample sizes can dilute the quality of the results and increase execution times. /// /// - [JsonInclude, JsonPropertyName("sample_size")] public int? SampleSize { get; set; } /// @@ -56,7 +139,6 @@ public sealed partial class ExploreControls /// Execution might overrun this timeout if, for example, a long pause is encountered while FieldData is loaded for a field. /// /// - [JsonInclude, JsonPropertyName("timeout")] public Elastic.Clients.Elasticsearch.Duration? Timeout { get; set; } /// @@ -64,24 +146,31 @@ public sealed partial class ExploreControls /// Filters associated terms so only those that are significantly associated with your query are included. /// /// - [JsonInclude, JsonPropertyName("use_significance")] - public bool UseSignificance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool UseSignificance { get; set; } } -public sealed partial class ExploreControlsDescriptor : SerializableDescriptor> +public readonly partial struct ExploreControlsDescriptor { - internal ExploreControlsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.ExploreControls Instance { get; init; } - public ExploreControlsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreControlsDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreControls instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Graph.SampleDiversity? SampleDiversityValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor SampleDiversityDescriptor { get; set; } - private Action> SampleDiversityDescriptorAction { get; set; } - private int? SampleSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - private bool UseSignificanceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreControlsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreControls instance) => new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor descriptor) => descriptor.Instance; /// /// @@ -89,28 +178,22 @@ public ExploreControlsDescriptor() : base() /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. /// /// - public ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversity? sampleDiversity) - { - SampleDiversityDescriptor = null; - SampleDiversityDescriptorAction = null; - SampleDiversityValue = sampleDiversity; - return Self; - } - - public ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversity? value) { - SampleDiversityValue = null; - SampleDiversityDescriptorAction = null; - SampleDiversityDescriptor = descriptor; - return Self; + Instance.SampleDiversity = value; + return this; } - public ExploreControlsDescriptor SampleDiversity(Action> configure) + /// + /// + /// To avoid the top-matching documents sample being dominated by a single source of results, it is sometimes necessary to request diversity in the sample. + /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleDiversity(System.Action> action) { - SampleDiversityValue = null; - SampleDiversityDescriptor = null; - SampleDiversityDescriptorAction = configure; - return Self; + Instance.SampleDiversity = Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor.Build(action); + return this; } /// @@ -121,10 +204,10 @@ public ExploreControlsDescriptor SampleDiversity(Action /// - public ExploreControlsDescriptor SampleSize(int? sampleSize) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleSize(int? value) { - SampleSizeValue = sampleSize; - return Self; + Instance.SampleSize = value; + return this; } /// @@ -134,10 +217,10 @@ public ExploreControlsDescriptor SampleSize(int? sampleSize) /// Execution might overrun this timeout if, for example, a long pause is encountered while FieldData is loaded for a field. /// /// - public ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } /// @@ -145,63 +228,39 @@ public ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearc /// Filters associated terms so only those that are significantly associated with your query are included. /// /// - public ExploreControlsDescriptor UseSignificance(bool useSignificance = true) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor UseSignificance(bool value = true) { - UseSignificanceValue = useSignificance; - return Self; + Instance.UseSignificance = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.ExploreControls Build(System.Action> action) { - writer.WriteStartObject(); - if (SampleDiversityDescriptor is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, SampleDiversityDescriptor, options); - } - else if (SampleDiversityDescriptorAction is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(SampleDiversityDescriptorAction), options); - } - else if (SampleDiversityValue is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, SampleDiversityValue, options); - } - - if (SampleSizeValue.HasValue) - { - writer.WritePropertyName("sample_size"); - writer.WriteNumberValue(SampleSizeValue.Value); - } - - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } - - writer.WritePropertyName("use_significance"); - writer.WriteBooleanValue(UseSignificanceValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(new Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ExploreControlsDescriptor : SerializableDescriptor +public readonly partial struct ExploreControlsDescriptor { - internal ExploreControlsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.ExploreControls Instance { get; init; } - public ExploreControlsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreControlsDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreControls instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Graph.SampleDiversity? SampleDiversityValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor SampleDiversityDescriptor { get; set; } - private Action SampleDiversityDescriptorAction { get; set; } - private int? SampleSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeoutValue { get; set; } - private bool UseSignificanceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExploreControlsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(Elastic.Clients.Elasticsearch.Graph.ExploreControls instance) => new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor descriptor) => descriptor.Instance; /// /// @@ -209,28 +268,34 @@ public ExploreControlsDescriptor() : base() /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. /// /// - public ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversity? sampleDiversity) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversity? value) { - SampleDiversityDescriptor = null; - SampleDiversityDescriptorAction = null; - SampleDiversityValue = sampleDiversity; - return Self; + Instance.SampleDiversity = value; + return this; } - public ExploreControlsDescriptor SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor descriptor) + /// + /// + /// To avoid the top-matching documents sample being dominated by a single source of results, it is sometimes necessary to request diversity in the sample. + /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleDiversity(System.Action action) { - SampleDiversityValue = null; - SampleDiversityDescriptorAction = null; - SampleDiversityDescriptor = descriptor; - return Self; + Instance.SampleDiversity = Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor.Build(action); + return this; } - public ExploreControlsDescriptor SampleDiversity(Action configure) + /// + /// + /// To avoid the top-matching documents sample being dominated by a single source of results, it is sometimes necessary to request diversity in the sample. + /// You can do this by selecting a single-value field and setting a maximum number of documents per value for that field. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleDiversity(System.Action> action) { - SampleDiversityValue = null; - SampleDiversityDescriptor = null; - SampleDiversityDescriptorAction = configure; - return Self; + Instance.SampleDiversity = Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor.Build(action); + return this; } /// @@ -241,10 +306,10 @@ public ExploreControlsDescriptor SampleDiversity(Action /// - public ExploreControlsDescriptor SampleSize(int? sampleSize) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor SampleSize(int? value) { - SampleSizeValue = sampleSize; - return Self; + Instance.SampleSize = value; + return this; } /// @@ -254,10 +319,10 @@ public ExploreControlsDescriptor SampleSize(int? sampleSize) /// Execution might overrun this timeout if, for example, a long pause is encountered while FieldData is loaded for a field. /// /// - public ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) { - TimeoutValue = timeout; - return Self; + Instance.Timeout = value; + return this; } /// @@ -265,45 +330,17 @@ public ExploreControlsDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? /// Filters associated terms so only those that are significantly associated with your query are included. /// /// - public ExploreControlsDescriptor UseSignificance(bool useSignificance = true) + public Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor UseSignificance(bool value = true) { - UseSignificanceValue = useSignificance; - return Self; + Instance.UseSignificance = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.ExploreControls Build(System.Action action) { - writer.WriteStartObject(); - if (SampleDiversityDescriptor is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, SampleDiversityDescriptor, options); - } - else if (SampleDiversityDescriptorAction is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(SampleDiversityDescriptorAction), options); - } - else if (SampleDiversityValue is not null) - { - writer.WritePropertyName("sample_diversity"); - JsonSerializer.Serialize(writer, SampleDiversityValue, options); - } - - if (SampleSizeValue.HasValue) - { - writer.WritePropertyName("sample_size"); - writer.WriteNumberValue(SampleSizeValue.Value); - } - - if (TimeoutValue is not null) - { - writer.WritePropertyName("timeout"); - JsonSerializer.Serialize(writer, TimeoutValue, options); - } - - writer.WritePropertyName("use_significance"); - writer.WriteBooleanValue(UseSignificanceValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.ExploreControlsDescriptor(new Elastic.Clients.Elasticsearch.Graph.ExploreControls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Hop.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Hop.g.cs index 6fc41e9426f..e29e7074a25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Hop.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Hop.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class HopConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConnections = System.Text.Json.JsonEncodedText.Encode("connections"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropVertices = System.Text.Json.JsonEncodedText.Encode("vertices"); + + public override Elastic.Clients.Elasticsearch.Graph.Hop Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConnections = default; + LocalJsonValue propQuery = default; + LocalJsonValue> propVertices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnections.TryReadProperty(ref reader, options, PropConnections, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propVertices.TryReadProperty(ref reader, options, PropVertices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Connections = propConnections.Value, + Query = propQuery.Value, + Vertices = propVertices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.Hop value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnections, value.Connections, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropVertices, value.Vertices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.HopConverter))] public sealed partial class Hop { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Hop(System.Collections.Generic.ICollection vertices) + { + Vertices = vertices; + } +#if NET7_0_OR_GREATER + public Hop() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Hop() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. /// /// - [JsonInclude, JsonPropertyName("connections")] public Elastic.Clients.Elasticsearch.Graph.Hop? Connections { get; set; } /// @@ -42,64 +117,70 @@ public sealed partial class Hop /// An optional guiding query that constrains the Graph API as it explores connected terms. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// /// /// Contains the fields you are interested in. /// /// - [JsonInclude, JsonPropertyName("vertices")] - public ICollection Vertices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Vertices { get; set; } } -public sealed partial class HopDescriptor : SerializableDescriptor> +public readonly partial struct HopDescriptor { - internal HopDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.Hop Instance { get; init; } - public HopDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HopDescriptor(Elastic.Clients.Elasticsearch.Graph.Hop instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Graph.Hop? ConnectionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.HopDescriptor ConnectionsDescriptor { get; set; } - private Action> ConnectionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection VerticesValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor VerticesDescriptor { get; set; } - private Action> VerticesDescriptorAction { get; set; } - private Action>[] VerticesDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HopDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Graph.HopDescriptor(Elastic.Clients.Elasticsearch.Graph.Hop instance) => new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. /// /// - public HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? connections) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? value) { - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = null; - ConnectionsValue = connections; - return Self; + Instance.Connections = value; + return this; } - public HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) + /// + /// + /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Connections(System.Action> action) { - ConnectionsValue = null; - ConnectionsDescriptorAction = null; - ConnectionsDescriptor = descriptor; - return Self; + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; } - public HopDescriptor Connections(Action> configure) + /// + /// + /// An optional guiding query that constrains the Graph API as it explores connected terms. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - ConnectionsValue = null; - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = configure; - return Self; + Instance.Query = value; + return this; } /// @@ -107,28 +188,32 @@ public HopDescriptor Connections(Action /// - public HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Contains the fields you are interested in. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(System.Collections.Generic.ICollection value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Vertices = value; + return this; } - public HopDescriptor Query(Action> configure) + /// + /// + /// Contains the fields you are interested in. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(params Elastic.Clients.Elasticsearch.Graph.VertexDefinition[] values) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Vertices = [.. values]; + return this; } /// @@ -136,158 +221,77 @@ public HopDescriptor Query(Action /// - public HopDescriptor Vertices(ICollection vertices) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(params System.Action>[] actions) { - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesValue = vertices; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); + } - public HopDescriptor Vertices(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) - { - VerticesValue = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesDescriptor = descriptor; - return Self; + Instance.Vertices = items; + return this; } - public HopDescriptor Vertices(Action> configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.Hop Build(System.Action> action) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorActions = null; - VerticesDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(new Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public HopDescriptor Vertices(params Action>[] configure) - { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = configure; - return Self; - } +public readonly partial struct HopDescriptor +{ + internal Elastic.Clients.Elasticsearch.Graph.Hop Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HopDescriptor(Elastic.Clients.Elasticsearch.Graph.Hop instance) { - writer.WriteStartObject(); - if (ConnectionsDescriptor is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsDescriptor, options); - } - else if (ConnectionsDescriptorAction is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(ConnectionsDescriptorAction), options); - } - else if (ConnectionsValue is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsValue, options); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (VerticesDescriptor is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, VerticesDescriptor, options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorAction is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(VerticesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorActions is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - foreach (var action in VerticesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("vertices"); - JsonSerializer.Serialize(writer, VerticesValue, options); - } - - writer.WriteEndObject(); + Instance = instance; } -} - -public sealed partial class HopDescriptor : SerializableDescriptor -{ - internal HopDescriptor(Action configure) => configure.Invoke(this); - public HopDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HopDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Graph.Hop? ConnectionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.HopDescriptor ConnectionsDescriptor { get; set; } - private Action ConnectionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection VerticesValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor VerticesDescriptor { get; set; } - private Action VerticesDescriptorAction { get; set; } - private Action[] VerticesDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Graph.HopDescriptor(Elastic.Clients.Elasticsearch.Graph.Hop instance) => new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. /// /// - public HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? connections) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.Hop? value) { - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = null; - ConnectionsValue = connections; - return Self; + Instance.Connections = value; + return this; } - public HopDescriptor Connections(Elastic.Clients.Elasticsearch.Graph.HopDescriptor descriptor) + /// + /// + /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Connections(System.Action action) { - ConnectionsValue = null; - ConnectionsDescriptorAction = null; - ConnectionsDescriptor = descriptor; - return Self; + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; } - public HopDescriptor Connections(Action configure) + /// + /// + /// Specifies one or more fields from which you want to extract terms that are associated with the specified vertices. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Connections(System.Action> action) { - ConnectionsValue = null; - ConnectionsDescriptor = null; - ConnectionsDescriptorAction = configure; - return Self; + Instance.Connections = Elastic.Clients.Elasticsearch.Graph.HopDescriptor.Build(action); + return this; } /// @@ -295,28 +299,32 @@ public HopDescriptor Connections(Action /// - public HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public HopDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// An optional guiding query that constrains the Graph API as it explores connected terms. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HopDescriptor Query(Action configure) + /// + /// + /// An optional guiding query that constrains the Graph API as it explores connected terms. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -324,108 +332,62 @@ public HopDescriptor Query(Action /// - public HopDescriptor Vertices(ICollection vertices) - { - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesValue = vertices; - return Self; - } - - public HopDescriptor Vertices(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) - { - VerticesValue = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = null; - VerticesDescriptor = descriptor; - return Self; - } - - public HopDescriptor Vertices(Action configure) + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(System.Collections.Generic.ICollection value) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorActions = null; - VerticesDescriptorAction = configure; - return Self; + Instance.Vertices = value; + return this; } - public HopDescriptor Vertices(params Action[] configure) + /// + /// + /// Contains the fields you are interested in. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(params Elastic.Clients.Elasticsearch.Graph.VertexDefinition[] values) { - VerticesValue = null; - VerticesDescriptor = null; - VerticesDescriptorAction = null; - VerticesDescriptorActions = configure; - return Self; + Instance.Vertices = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Contains the fields you are interested in. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(params System.Action[] actions) { - writer.WriteStartObject(); - if (ConnectionsDescriptor is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsDescriptor, options); - } - else if (ConnectionsDescriptorAction is not null) - { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(ConnectionsDescriptorAction), options); - } - else if (ConnectionsValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("connections"); - JsonSerializer.Serialize(writer, ConnectionsValue, options); + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Vertices = items; + return this; + } - if (VerticesDescriptor is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, VerticesDescriptor, options); - writer.WriteEndArray(); - } - else if (VerticesDescriptorAction is not null) + /// + /// + /// Contains the fields you are interested in. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.HopDescriptor Vertices(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(VerticesDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor.Build(action)); } - else if (VerticesDescriptorActions is not null) - { - writer.WritePropertyName("vertices"); - writer.WriteStartArray(); - foreach (var action in VerticesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("vertices"); - JsonSerializer.Serialize(writer, VerticesValue, options); - } + Instance.Vertices = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.Hop Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Graph.HopDescriptor(new Elastic.Clients.Elasticsearch.Graph.Hop(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/SampleDiversity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/SampleDiversity.g.cs index d8c24e165bd..379459a31c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/SampleDiversity.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/SampleDiversity.g.cs @@ -17,112 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class SampleDiversityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocsPerValue = System.Text.Json.JsonEncodedText.Encode("max_docs_per_value"); + + public override Elastic.Clients.Elasticsearch.Graph.SampleDiversity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMaxDocsPerValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMaxDocsPerValue.TryReadProperty(ref reader, options, PropMaxDocsPerValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + MaxDocsPerValue = propMaxDocsPerValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.SampleDiversity value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMaxDocsPerValue, value.MaxDocsPerValue, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.SampleDiversityConverter))] public sealed partial class SampleDiversity { - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("max_docs_per_value")] - public int MaxDocsPerValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SampleDiversity(Elastic.Clients.Elasticsearch.Field field, int maxDocsPerValue) + { + Field = field; + MaxDocsPerValue = maxDocsPerValue; + } +#if NET7_0_OR_GREATER + public SampleDiversity() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SampleDiversity() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxDocsPerValue { get; set; } } -public sealed partial class SampleDiversityDescriptor : SerializableDescriptor> +public readonly partial struct SampleDiversityDescriptor { - internal SampleDiversityDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.SampleDiversity Instance { get; init; } - public SampleDiversityDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SampleDiversityDescriptor(Elastic.Clients.Elasticsearch.Graph.SampleDiversity instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int MaxDocsPerValueValue { get; set; } - - public SampleDiversityDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SampleDiversityDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SampleDiversityDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(Elastic.Clients.Elasticsearch.Graph.SampleDiversity instance) => new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SampleDiversityDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SampleDiversityDescriptor MaxDocsPerValue(int maxDocsPerValue) + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor MaxDocsPerValue(int value) { - MaxDocsPerValueValue = maxDocsPerValue; - return Self; + Instance.MaxDocsPerValue = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.SampleDiversity Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("max_docs_per_value"); - writer.WriteNumberValue(MaxDocsPerValueValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(new Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SampleDiversityDescriptor : SerializableDescriptor +public readonly partial struct SampleDiversityDescriptor { - internal SampleDiversityDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.SampleDiversity Instance { get; init; } - public SampleDiversityDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SampleDiversityDescriptor(Elastic.Clients.Elasticsearch.Graph.SampleDiversity instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int MaxDocsPerValueValue { get; set; } - - public SampleDiversityDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SampleDiversityDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SampleDiversityDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(Elastic.Clients.Elasticsearch.Graph.SampleDiversity instance) => new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SampleDiversityDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SampleDiversityDescriptor MaxDocsPerValue(int maxDocsPerValue) + public Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor MaxDocsPerValue(int value) { - MaxDocsPerValueValue = maxDocsPerValue; - return Self; + Instance.MaxDocsPerValue = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.SampleDiversity Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("max_docs_per_value"); - writer.WriteNumberValue(MaxDocsPerValueValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.SampleDiversityDescriptor(new Elastic.Clients.Elasticsearch.Graph.SampleDiversity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Vertex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Vertex.g.cs index 4f9c9078647..b6efaad191f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Vertex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/Vertex.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class VertexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDepth = System.Text.Json.JsonEncodedText.Encode("depth"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText PropWeight = System.Text.Json.JsonEncodedText.Encode("weight"); + + public override Elastic.Clients.Elasticsearch.Graph.Vertex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDepth = default; + LocalJsonValue propField = default; + LocalJsonValue propTerm = default; + LocalJsonValue propWeight = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDepth.TryReadProperty(ref reader, options, PropDepth, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propTerm.TryReadProperty(ref reader, options, PropTerm, null)) + { + continue; + } + + if (propWeight.TryReadProperty(ref reader, options, PropWeight, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.Vertex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Depth = propDepth.Value, + Field = propField.Value, + Term = propTerm.Value, + Weight = propWeight.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.Vertex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDepth, value.Depth, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropTerm, value.Term, null, null); + writer.WriteProperty(options, PropWeight, value.Weight, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.VertexConverter))] public sealed partial class Vertex { - [JsonInclude, JsonPropertyName("depth")] - public long Depth { get; init; } - [JsonInclude, JsonPropertyName("field")] - public string Field { get; init; } - [JsonInclude, JsonPropertyName("term")] - public string Term { get; init; } - [JsonInclude, JsonPropertyName("weight")] - public double Weight { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Vertex(long depth, string field, string term, double weight) + { + Depth = depth; + Field = field; + Term = term; + Weight = weight; + } +#if NET7_0_OR_GREATER + public Vertex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Vertex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Vertex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Depth { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Term { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Weight { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexDefinition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexDefinition.g.cs index 10866647fd7..b04f48a12dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexDefinition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexDefinition.g.cs @@ -17,41 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class VertexDefinitionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocCount = System.Text.Json.JsonEncodedText.Encode("min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropShardMinDocCount = System.Text.Json.JsonEncodedText.Encode("shard_min_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Graph.VertexDefinition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propExclude = default; + LocalJsonValue propField = default; + LocalJsonValue?> propInclude = default; + LocalJsonValue propMinDocCount = default; + LocalJsonValue propShardMinDocCount = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExclude.TryReadProperty(ref reader, options, PropExclude, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMinDocCount.TryReadProperty(ref reader, options, PropMinDocCount, null)) + { + continue; + } + + if (propShardMinDocCount.TryReadProperty(ref reader, options, PropShardMinDocCount, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exclude = propExclude.Value, + Field = propField.Value, + Include = propInclude.Value, + MinDocCount = propMinDocCount.Value, + ShardMinDocCount = propShardMinDocCount.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.VertexDefinition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExclude, value.Exclude, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinDocCount, value.MinDocCount, null, null); + writer.WriteProperty(options, PropShardMinDocCount, value.ShardMinDocCount, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionConverter))] public sealed partial class VertexDefinition { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexDefinition(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public VertexDefinition() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VertexDefinition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Prevents the specified terms from being included in the results. /// /// - [JsonInclude, JsonPropertyName("exclude")] - public ICollection? Exclude { get; set; } + public System.Collections.Generic.ICollection? Exclude { get; set; } /// /// /// Identifies a field in the documents of interest. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Identifies the terms of interest that form the starting points from which you want to spider out. /// /// - [JsonInclude, JsonPropertyName("include")] - public ICollection? Include { get; set; } + public System.Collections.Generic.ICollection? Include { get; set; } /// /// @@ -59,7 +163,6 @@ public sealed partial class VertexDefinition /// This setting acts as a certainty threshold. /// /// - [JsonInclude, JsonPropertyName("min_doc_count")] public long? MinDocCount { get; set; } /// @@ -67,7 +170,6 @@ public sealed partial class VertexDefinition /// Controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration. /// /// - [JsonInclude, JsonPropertyName("shard_min_doc_count")] public long? ShardMinDocCount { get; set; } /// @@ -75,48 +177,48 @@ public sealed partial class VertexDefinition /// Specifies the maximum number of vertex terms returned for each field. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } } -public sealed partial class VertexDefinitionDescriptor : SerializableDescriptor> +public readonly partial struct VertexDefinitionDescriptor { - internal VertexDefinitionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.VertexDefinition Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexDefinitionDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexDefinition instance) + { + Instance = instance; + } - public VertexDefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexDefinitionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor IncludeDescriptor { get; set; } - private Action IncludeDescriptorAction { get; set; } - private Action[] IncludeDescriptorActions { get; set; } - private long? MinDocCountValue { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexDefinition instance) => new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// Prevents the specified terms from being included in the results. /// /// - public VertexDefinitionDescriptor Exclude(ICollection? exclude) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Exclude(System.Collections.Generic.ICollection? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// /// - /// Identifies a field in the documents of interest. + /// Prevents the specified terms from being included in the results. /// /// - public VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Exclude(params string[] values) { - FieldValue = field; - return Self; + Instance.Exclude = [.. values]; + return this; } /// @@ -124,10 +226,10 @@ public VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch /// Identifies a field in the documents of interest. /// /// - public VertexDefinitionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -135,10 +237,10 @@ public VertexDefinitionDescriptor Field(Expression /// - public VertexDefinitionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -146,40 +248,38 @@ public VertexDefinitionDescriptor Field(Expression /// - public VertexDefinitionDescriptor Include(ICollection? include) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(System.Collections.Generic.ICollection? value) { - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = null; - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - public VertexDefinitionDescriptor Include(Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor descriptor) + /// + /// + /// Identifies the terms of interest that form the starting points from which you want to spider out. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(params Elastic.Clients.Elasticsearch.Graph.VertexInclude[] values) { - IncludeValue = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = null; - IncludeDescriptor = descriptor; - return Self; + Instance.Include = [.. values]; + return this; } - public VertexDefinitionDescriptor Include(Action configure) + /// + /// + /// Identifies the terms of interest that form the starting points from which you want to spider out. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(params System.Action[] actions) { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorActions = null; - IncludeDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor.Build(action)); + } - public VertexDefinitionDescriptor Include(params Action[] configure) - { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = configure; - return Self; + Instance.Include = items; + return this; } /// @@ -188,10 +288,10 @@ public VertexDefinitionDescriptor Include(params Action /// - public VertexDefinitionDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -199,10 +299,10 @@ public VertexDefinitionDescriptor MinDocCount(long? minDocCount) /// Controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration. /// /// - public VertexDefinitionDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -210,114 +310,60 @@ public VertexDefinitionDescriptor ShardMinDocCount(long? shardMinDocC /// Specifies the maximum number of vertex terms returned for each field. /// /// - public VertexDefinitionDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.VertexDefinition Build(System.Action> action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IncludeDescriptor is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IncludeDescriptor, options); - writer.WriteEndArray(); - } - else if (IncludeDescriptorAction is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(IncludeDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IncludeDescriptorActions is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - foreach (var action in IncludeDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(new Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class VertexDefinitionDescriptor : SerializableDescriptor +public readonly partial struct VertexDefinitionDescriptor { - internal VertexDefinitionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.VertexDefinition Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexDefinitionDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexDefinition instance) + { + Instance = instance; + } - public VertexDefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexDefinitionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor IncludeDescriptor { get; set; } - private Action IncludeDescriptorAction { get; set; } - private Action[] IncludeDescriptorActions { get; set; } - private long? MinDocCountValue { get; set; } - private long? ShardMinDocCountValue { get; set; } - private int? SizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexDefinition instance) => new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// Prevents the specified terms from being included in the results. /// /// - public VertexDefinitionDescriptor Exclude(ICollection? exclude) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Exclude(System.Collections.Generic.ICollection? value) { - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } /// /// - /// Identifies a field in the documents of interest. + /// Prevents the specified terms from being included in the results. /// /// - public VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Exclude(params string[] values) { - FieldValue = field; - return Self; + Instance.Exclude = [.. values]; + return this; } /// @@ -325,10 +371,10 @@ public VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// Identifies a field in the documents of interest. /// /// - public VertexDefinitionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -336,10 +382,10 @@ public VertexDefinitionDescriptor Field(Expression /// - public VertexDefinitionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -347,40 +393,38 @@ public VertexDefinitionDescriptor Field(Expression /// - public VertexDefinitionDescriptor Include(ICollection? include) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(System.Collections.Generic.ICollection? value) { - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = null; - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - public VertexDefinitionDescriptor Include(Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor descriptor) + /// + /// + /// Identifies the terms of interest that form the starting points from which you want to spider out. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(params Elastic.Clients.Elasticsearch.Graph.VertexInclude[] values) { - IncludeValue = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = null; - IncludeDescriptor = descriptor; - return Self; + Instance.Include = [.. values]; + return this; } - public VertexDefinitionDescriptor Include(Action configure) + /// + /// + /// Identifies the terms of interest that form the starting points from which you want to spider out. + /// + /// + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Include(params System.Action[] actions) { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorActions = null; - IncludeDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor.Build(action)); + } - public VertexDefinitionDescriptor Include(params Action[] configure) - { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeDescriptorActions = configure; - return Self; + Instance.Include = items; + return this; } /// @@ -389,10 +433,10 @@ public VertexDefinitionDescriptor Include(params Action /// - public VertexDefinitionDescriptor MinDocCount(long? minDocCount) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor MinDocCount(long? value) { - MinDocCountValue = minDocCount; - return Self; + Instance.MinDocCount = value; + return this; } /// @@ -400,10 +444,10 @@ public VertexDefinitionDescriptor MinDocCount(long? minDocCount) /// Controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration. /// /// - public VertexDefinitionDescriptor ShardMinDocCount(long? shardMinDocCount) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor ShardMinDocCount(long? value) { - ShardMinDocCountValue = shardMinDocCount; - return Self; + Instance.ShardMinDocCount = value; + return this; } /// @@ -411,72 +455,17 @@ public VertexDefinitionDescriptor ShardMinDocCount(long? shardMinDocCount) /// Specifies the maximum number of vertex terms returned for each field. /// /// - public VertexDefinitionDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.VertexDefinition Build(System.Action action) { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IncludeDescriptor is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IncludeDescriptor, options); - writer.WriteEndArray(); - } - else if (IncludeDescriptorAction is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(IncludeDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IncludeDescriptorActions is not null) - { - writer.WritePropertyName("include"); - writer.WriteStartArray(); - foreach (var action in IncludeDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (MinDocCountValue.HasValue) - { - writer.WritePropertyName("min_doc_count"); - writer.WriteNumberValue(MinDocCountValue.Value); - } - - if (ShardMinDocCountValue.HasValue) - { - writer.WritePropertyName("shard_min_doc_count"); - writer.WriteNumberValue(ShardMinDocCountValue.Value); - } - - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.VertexDefinitionDescriptor(new Elastic.Clients.Elasticsearch.Graph.VertexDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexInclude.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexInclude.g.cs index cc7f9fe81a6..4180eeec4dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexInclude.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Graph/VertexInclude.g.cs @@ -17,54 +17,138 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Graph; +internal sealed partial class VertexIncludeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropTerm = System.Text.Json.JsonEncodedText.Encode("term"); + + public override Elastic.Clients.Elasticsearch.Graph.VertexInclude Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Graph.VertexInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Term = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propTerm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propTerm.TryReadProperty(ref reader, options, PropTerm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Graph.VertexInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Term = propTerm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Graph.VertexInclude value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropTerm, value.Term, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Graph.VertexIncludeConverter))] public sealed partial class VertexInclude { - [JsonInclude, JsonPropertyName("boost")] - public double Boost { get; set; } - [JsonInclude, JsonPropertyName("term")] - public string Term { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexInclude(string term) + { + Term = term; + } +#if NET7_0_OR_GREATER + public VertexInclude() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VertexInclude() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VertexInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public double? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Term { get; set; } } -public sealed partial class VertexIncludeDescriptor : SerializableDescriptor +public readonly partial struct VertexIncludeDescriptor { - internal VertexIncludeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Graph.VertexInclude Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexIncludeDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexInclude instance) + { + Instance = instance; + } - public VertexIncludeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VertexIncludeDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Graph.VertexInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double BoostValue { get; set; } - private string TermValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(Elastic.Clients.Elasticsearch.Graph.VertexInclude instance) => new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Graph.VertexInclude(Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor descriptor) => descriptor.Instance; - public VertexIncludeDescriptor Boost(double boost) + public Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public VertexIncludeDescriptor Term(string term) + public Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor Term(string value) { - TermValue = term; - return Self; + Instance.Term = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Graph.VertexInclude Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue); - writer.WritePropertyName("term"); - writer.WriteStringValue(TermValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Graph.VertexIncludeDescriptor(new Elastic.Clients.Elasticsearch.Graph.VertexInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Actions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Actions.g.cs index b809226b35d..7a9a1e04a1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Actions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Actions.g.cs @@ -17,24 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class ActionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocate = System.Text.Json.JsonEncodedText.Encode("allocate"); + private static readonly System.Text.Json.JsonEncodedText PropDelete = System.Text.Json.JsonEncodedText.Encode("delete"); + private static readonly System.Text.Json.JsonEncodedText PropDownsample = System.Text.Json.JsonEncodedText.Encode("downsample"); + private static readonly System.Text.Json.JsonEncodedText PropForcemerge = System.Text.Json.JsonEncodedText.Encode("forcemerge"); + private static readonly System.Text.Json.JsonEncodedText PropFreeze = System.Text.Json.JsonEncodedText.Encode("freeze"); + private static readonly System.Text.Json.JsonEncodedText PropMigrate = System.Text.Json.JsonEncodedText.Encode("migrate"); + private static readonly System.Text.Json.JsonEncodedText PropReadonly = System.Text.Json.JsonEncodedText.Encode("readonly"); + private static readonly System.Text.Json.JsonEncodedText PropRollover = System.Text.Json.JsonEncodedText.Encode("rollover"); + private static readonly System.Text.Json.JsonEncodedText PropSearchableSnapshot = System.Text.Json.JsonEncodedText.Encode("searchable_snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropSetPriority = System.Text.Json.JsonEncodedText.Encode("set_priority"); + private static readonly System.Text.Json.JsonEncodedText PropShrink = System.Text.Json.JsonEncodedText.Encode("shrink"); + private static readonly System.Text.Json.JsonEncodedText PropUnfollow = System.Text.Json.JsonEncodedText.Encode("unfollow"); + private static readonly System.Text.Json.JsonEncodedText PropWaitForSnapshot = System.Text.Json.JsonEncodedText.Encode("wait_for_snapshot"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocate = default; + LocalJsonValue propDelete = default; + LocalJsonValue propDownsample = default; + LocalJsonValue propForcemerge = default; + LocalJsonValue propFreeze = default; + LocalJsonValue propMigrate = default; + LocalJsonValue propReadonly = default; + LocalJsonValue propRollover = default; + LocalJsonValue propSearchableSnapshot = default; + LocalJsonValue propSetPriority = default; + LocalJsonValue propShrink = default; + LocalJsonValue propUnfollow = default; + LocalJsonValue propWaitForSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocate.TryReadProperty(ref reader, options, PropAllocate, null)) + { + continue; + } + + if (propDelete.TryReadProperty(ref reader, options, PropDelete, null)) + { + continue; + } + + if (propDownsample.TryReadProperty(ref reader, options, PropDownsample, null)) + { + continue; + } + + if (propForcemerge.TryReadProperty(ref reader, options, PropForcemerge, null)) + { + continue; + } + + if (propFreeze.TryReadProperty(ref reader, options, PropFreeze, null)) + { + continue; + } + + if (propMigrate.TryReadProperty(ref reader, options, PropMigrate, null)) + { + continue; + } + + if (propReadonly.TryReadProperty(ref reader, options, PropReadonly, null)) + { + continue; + } + + if (propRollover.TryReadProperty(ref reader, options, PropRollover, null)) + { + continue; + } + + if (propSearchableSnapshot.TryReadProperty(ref reader, options, PropSearchableSnapshot, null)) + { + continue; + } + + if (propSetPriority.TryReadProperty(ref reader, options, PropSetPriority, null)) + { + continue; + } + + if (propShrink.TryReadProperty(ref reader, options, PropShrink, null)) + { + continue; + } + + if (propUnfollow.TryReadProperty(ref reader, options, PropUnfollow, null)) + { + continue; + } + + if (propWaitForSnapshot.TryReadProperty(ref reader, options, PropWaitForSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Allocate = propAllocate.Value, + Delete = propDelete.Value, + Downsample = propDownsample.Value, + Forcemerge = propForcemerge.Value, +#pragma warning disable CS0618 + Freeze = propFreeze.Value +#pragma warning restore CS0618 +, + Migrate = propMigrate.Value, + Readonly = propReadonly.Value, + Rollover = propRollover.Value, + SearchableSnapshot = propSearchableSnapshot.Value, + SetPriority = propSetPriority.Value, + Shrink = propShrink.Value, + Unfollow = propUnfollow.Value, + WaitForSnapshot = propWaitForSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocate, value.Allocate, null, null); + writer.WriteProperty(options, PropDelete, value.Delete, null, null); + writer.WriteProperty(options, PropDownsample, value.Downsample, null, null); + writer.WriteProperty(options, PropForcemerge, value.Forcemerge, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropFreeze, value.Freeze, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropMigrate, value.Migrate, null, null); + writer.WriteProperty(options, PropReadonly, value.Readonly, null, null); + writer.WriteProperty(options, PropRollover, value.Rollover, null, null); + writer.WriteProperty(options, PropSearchableSnapshot, value.SearchableSnapshot, null, null); + writer.WriteProperty(options, PropSetPriority, value.SetPriority, null, null); + writer.WriteProperty(options, PropShrink, value.Shrink, null, null); + writer.WriteProperty(options, PropUnfollow, value.Unfollow, null, null); + writer.WriteProperty(options, PropWaitForSnapshot, value.WaitForSnapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsConverter))] public sealed partial class Actions { +#if NET7_0_OR_GREATER + public Actions() + { + } +#endif +#if !NET7_0_OR_GREATER + public Actions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Actions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Phases allowed: warm, cold. /// /// - [JsonInclude, JsonPropertyName("allocate")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction? Allocate { get; set; } /// @@ -42,7 +207,6 @@ public sealed partial class Actions /// Phases allowed: delete. /// /// - [JsonInclude, JsonPropertyName("delete")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction? Delete { get; set; } /// @@ -50,7 +214,6 @@ public sealed partial class Actions /// Phases allowed: hot, warm, cold. /// /// - [JsonInclude, JsonPropertyName("downsample")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction? Downsample { get; set; } /// @@ -58,15 +221,21 @@ public sealed partial class Actions /// Phases allowed: hot, warm. /// /// - [JsonInclude, JsonPropertyName("forcemerge")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction? Forcemerge { get; set; } + /// + /// + /// The freeze action is a noop in 8.x + /// + /// + [System.Obsolete("Deprecated in '7.0.0'.")] + public Elastic.Clients.Elasticsearch.EmptyObject? Freeze { get; set; } + /// /// /// Phases allowed: warm, cold. /// /// - [JsonInclude, JsonPropertyName("migrate")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction? Migrate { get; set; } /// @@ -74,7 +243,6 @@ public sealed partial class Actions /// Phases allowed: hot, warm, cold. /// /// - [JsonInclude, JsonPropertyName("readonly")] public Elastic.Clients.Elasticsearch.EmptyObject? Readonly { get; set; } /// @@ -82,7 +250,6 @@ public sealed partial class Actions /// Phases allowed: hot. /// /// - [JsonInclude, JsonPropertyName("rollover")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction? Rollover { get; set; } /// @@ -90,7 +257,6 @@ public sealed partial class Actions /// Phases allowed: hot, cold, frozen. /// /// - [JsonInclude, JsonPropertyName("searchable_snapshot")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction? SearchableSnapshot { get; set; } /// @@ -98,7 +264,6 @@ public sealed partial class Actions /// Phases allowed: hot, warm, cold. /// /// - [JsonInclude, JsonPropertyName("set_priority")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction? SetPriority { get; set; } /// @@ -106,7 +271,6 @@ public sealed partial class Actions /// Phases allowed: hot, warm. /// /// - [JsonInclude, JsonPropertyName("shrink")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction? Shrink { get; set; } /// @@ -114,7 +278,6 @@ public sealed partial class Actions /// Phases allowed: hot, warm, cold, frozen. /// /// - [JsonInclude, JsonPropertyName("unfollow")] public Elastic.Clients.Elasticsearch.EmptyObject? Unfollow { get; set; } /// @@ -122,82 +285,59 @@ public sealed partial class Actions /// Phases allowed: delete. /// /// - [JsonInclude, JsonPropertyName("wait_for_snapshot")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction? WaitForSnapshot { get; set; } } -public sealed partial class ActionsDescriptor : SerializableDescriptor +public readonly partial struct ActionsDescriptor { - internal ActionsDescriptor(Action configure) => configure.Invoke(this); - - public ActionsDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction? AllocateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AllocateDescriptor { get; set; } - private Action AllocateDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction? DeleteValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor DeleteDescriptor { get; set; } - private Action DeleteDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction? DownsampleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor DownsampleDescriptor { get; set; } - private Action DownsampleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction? ForcemergeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor ForcemergeDescriptor { get; set; } - private Action ForcemergeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction? MigrateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor MigrateDescriptor { get; set; } - private Action MigrateDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? ReadonlyValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor ReadonlyDescriptor { get; set; } - private Action ReadonlyDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction? RolloverValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor RolloverDescriptor { get; set; } - private Action RolloverDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction? SearchableSnapshotValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor SearchableSnapshotDescriptor { get; set; } - private Action SearchableSnapshotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction? SetPriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor SetPriorityDescriptor { get; set; } - private Action SetPriorityDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction? ShrinkValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor ShrinkDescriptor { get; set; } - private Action ShrinkDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObject? UnfollowValue { get; set; } - private Elastic.Clients.Elasticsearch.EmptyObjectDescriptor UnfollowDescriptor { get; set; } - private Action UnfollowDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction? WaitForSnapshotValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor WaitForSnapshotDescriptor { get; set; } - private Action WaitForSnapshotDescriptorAction { get; set; } + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ActionsDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ActionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor descriptor) => descriptor.Instance; /// /// /// Phases allowed: warm, cold. /// /// - public ActionsDescriptor Allocate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction? allocate) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Allocate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction? value) { - AllocateDescriptor = null; - AllocateDescriptorAction = null; - AllocateValue = allocate; - return Self; + Instance.Allocate = value; + return this; } - public ActionsDescriptor Allocate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor descriptor) + /// + /// + /// Phases allowed: warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Allocate() { - AllocateValue = null; - AllocateDescriptorAction = null; - AllocateDescriptor = descriptor; - return Self; + Instance.Allocate = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor.Build(null); + return this; } - public ActionsDescriptor Allocate(Action configure) + /// + /// + /// Phases allowed: warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Allocate(System.Action? action) { - AllocateValue = null; - AllocateDescriptor = null; - AllocateDescriptorAction = configure; - return Self; + Instance.Allocate = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor.Build(action); + return this; } /// @@ -205,28 +345,32 @@ public ActionsDescriptor Allocate(Action /// - public ActionsDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction? delete) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction? value) { - DeleteDescriptor = null; - DeleteDescriptorAction = null; - DeleteValue = delete; - return Self; + Instance.Delete = value; + return this; } - public ActionsDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor descriptor) + /// + /// + /// Phases allowed: delete. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Delete() { - DeleteValue = null; - DeleteDescriptorAction = null; - DeleteDescriptor = descriptor; - return Self; + Instance.Delete = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor.Build(null); + return this; } - public ActionsDescriptor Delete(Action configure) + /// + /// + /// Phases allowed: delete. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Delete(System.Action? action) { - DeleteValue = null; - DeleteDescriptor = null; - DeleteDescriptorAction = configure; - return Self; + Instance.Delete = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor.Build(action); + return this; } /// @@ -234,28 +378,32 @@ public ActionsDescriptor Delete(Action /// - public ActionsDescriptor Downsample(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction? downsample) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Downsample(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction? value) { - DownsampleDescriptor = null; - DownsampleDescriptorAction = null; - DownsampleValue = downsample; - return Self; + Instance.Downsample = value; + return this; } - public ActionsDescriptor Downsample(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor descriptor) + /// + /// + /// Phases allowed: hot, warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Downsample(System.Action action) { - DownsampleValue = null; - DownsampleDescriptorAction = null; - DownsampleDescriptor = descriptor; - return Self; + Instance.Downsample = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor.Build(action); + return this; } - public ActionsDescriptor Downsample(Action configure) + /// + /// + /// Phases allowed: hot, warm. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Forcemerge(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction? value) { - DownsampleValue = null; - DownsampleDescriptor = null; - DownsampleDescriptorAction = configure; - return Self; + Instance.Forcemerge = value; + return this; } /// @@ -263,28 +411,46 @@ public ActionsDescriptor Downsample(Action /// - public ActionsDescriptor Forcemerge(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction? forcemerge) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Forcemerge(System.Action action) { - ForcemergeDescriptor = null; - ForcemergeDescriptorAction = null; - ForcemergeValue = forcemerge; - return Self; + Instance.Forcemerge = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor.Build(action); + return this; } - public ActionsDescriptor Forcemerge(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor descriptor) + [System.Obsolete("Deprecated in '7.0.0'.")] + /// + /// + /// The freeze action is a noop in 8.x + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Freeze(Elastic.Clients.Elasticsearch.EmptyObject? value) { - ForcemergeValue = null; - ForcemergeDescriptorAction = null; - ForcemergeDescriptor = descriptor; - return Self; + Instance.Freeze = value; + return this; } - public ActionsDescriptor Forcemerge(Action configure) + [System.Obsolete("Deprecated in '7.0.0'.")] + /// + /// + /// The freeze action is a noop in 8.x + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Freeze() + { + Instance.Freeze = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; + } + + [System.Obsolete("Deprecated in '7.0.0'.")] + /// + /// + /// The freeze action is a noop in 8.x + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Freeze(System.Action? action) { - ForcemergeValue = null; - ForcemergeDescriptor = null; - ForcemergeDescriptorAction = configure; - return Self; + Instance.Freeze = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -292,28 +458,32 @@ public ActionsDescriptor Forcemerge(Action /// - public ActionsDescriptor Migrate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction? migrate) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Migrate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction? value) { - MigrateDescriptor = null; - MigrateDescriptorAction = null; - MigrateValue = migrate; - return Self; + Instance.Migrate = value; + return this; } - public ActionsDescriptor Migrate(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor descriptor) + /// + /// + /// Phases allowed: warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Migrate() { - MigrateValue = null; - MigrateDescriptorAction = null; - MigrateDescriptor = descriptor; - return Self; + Instance.Migrate = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor.Build(null); + return this; } - public ActionsDescriptor Migrate(Action configure) + /// + /// + /// Phases allowed: warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Migrate(System.Action? action) { - MigrateValue = null; - MigrateDescriptor = null; - MigrateDescriptorAction = configure; - return Self; + Instance.Migrate = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor.Build(action); + return this; } /// @@ -321,28 +491,32 @@ public ActionsDescriptor Migrate(Action /// - public ActionsDescriptor Readonly(Elastic.Clients.Elasticsearch.EmptyObject? value) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Readonly(Elastic.Clients.Elasticsearch.EmptyObject? value) { - ReadonlyDescriptor = null; - ReadonlyDescriptorAction = null; - ReadonlyValue = value; - return Self; + Instance.Readonly = value; + return this; } - public ActionsDescriptor Readonly(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Phases allowed: hot, warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Readonly() { - ReadonlyValue = null; - ReadonlyDescriptorAction = null; - ReadonlyDescriptor = descriptor; - return Self; + Instance.Readonly = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public ActionsDescriptor Readonly(Action configure) + /// + /// + /// Phases allowed: hot, warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Readonly(System.Action? action) { - ReadonlyValue = null; - ReadonlyDescriptor = null; - ReadonlyDescriptorAction = configure; - return Self; + Instance.Readonly = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -350,28 +524,32 @@ public ActionsDescriptor Readonly(Action /// - public ActionsDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction? rollover) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction? value) { - RolloverDescriptor = null; - RolloverDescriptorAction = null; - RolloverValue = rollover; - return Self; + Instance.Rollover = value; + return this; } - public ActionsDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor descriptor) + /// + /// + /// Phases allowed: hot. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Rollover() { - RolloverValue = null; - RolloverDescriptorAction = null; - RolloverDescriptor = descriptor; - return Self; + Instance.Rollover = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor.Build(null); + return this; } - public ActionsDescriptor Rollover(Action configure) + /// + /// + /// Phases allowed: hot. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Rollover(System.Action? action) { - RolloverValue = null; - RolloverDescriptor = null; - RolloverDescriptorAction = configure; - return Self; + Instance.Rollover = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor.Build(action); + return this; } /// @@ -379,28 +557,21 @@ public ActionsDescriptor Rollover(Action /// - public ActionsDescriptor SearchableSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction? searchableSnapshot) - { - SearchableSnapshotDescriptor = null; - SearchableSnapshotDescriptorAction = null; - SearchableSnapshotValue = searchableSnapshot; - return Self; - } - - public ActionsDescriptor SearchableSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor SearchableSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction? value) { - SearchableSnapshotValue = null; - SearchableSnapshotDescriptorAction = null; - SearchableSnapshotDescriptor = descriptor; - return Self; + Instance.SearchableSnapshot = value; + return this; } - public ActionsDescriptor SearchableSnapshot(Action configure) + /// + /// + /// Phases allowed: hot, cold, frozen. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor SearchableSnapshot(System.Action action) { - SearchableSnapshotValue = null; - SearchableSnapshotDescriptor = null; - SearchableSnapshotDescriptorAction = configure; - return Self; + Instance.SearchableSnapshot = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor.Build(action); + return this; } /// @@ -408,28 +579,32 @@ public ActionsDescriptor SearchableSnapshot(Action /// - public ActionsDescriptor SetPriority(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction? setPriority) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor SetPriority(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction? value) { - SetPriorityDescriptor = null; - SetPriorityDescriptorAction = null; - SetPriorityValue = setPriority; - return Self; + Instance.SetPriority = value; + return this; } - public ActionsDescriptor SetPriority(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor descriptor) + /// + /// + /// Phases allowed: hot, warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor SetPriority() { - SetPriorityValue = null; - SetPriorityDescriptorAction = null; - SetPriorityDescriptor = descriptor; - return Self; + Instance.SetPriority = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor.Build(null); + return this; } - public ActionsDescriptor SetPriority(Action configure) + /// + /// + /// Phases allowed: hot, warm, cold. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor SetPriority(System.Action? action) { - SetPriorityValue = null; - SetPriorityDescriptor = null; - SetPriorityDescriptorAction = configure; - return Self; + Instance.SetPriority = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor.Build(action); + return this; } /// @@ -437,28 +612,32 @@ public ActionsDescriptor SetPriority(Action /// - public ActionsDescriptor Shrink(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction? shrink) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Shrink(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction? value) { - ShrinkDescriptor = null; - ShrinkDescriptorAction = null; - ShrinkValue = shrink; - return Self; + Instance.Shrink = value; + return this; } - public ActionsDescriptor Shrink(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor descriptor) + /// + /// + /// Phases allowed: hot, warm. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Shrink() { - ShrinkValue = null; - ShrinkDescriptorAction = null; - ShrinkDescriptor = descriptor; - return Self; + Instance.Shrink = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor.Build(null); + return this; } - public ActionsDescriptor Shrink(Action configure) + /// + /// + /// Phases allowed: hot, warm. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Shrink(System.Action? action) { - ShrinkValue = null; - ShrinkDescriptor = null; - ShrinkDescriptorAction = configure; - return Self; + Instance.Shrink = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor.Build(action); + return this; } /// @@ -466,28 +645,32 @@ public ActionsDescriptor Shrink(Action /// - public ActionsDescriptor Unfollow(Elastic.Clients.Elasticsearch.EmptyObject? unfollow) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Unfollow(Elastic.Clients.Elasticsearch.EmptyObject? value) { - UnfollowDescriptor = null; - UnfollowDescriptorAction = null; - UnfollowValue = unfollow; - return Self; + Instance.Unfollow = value; + return this; } - public ActionsDescriptor Unfollow(Elastic.Clients.Elasticsearch.EmptyObjectDescriptor descriptor) + /// + /// + /// Phases allowed: hot, warm, cold, frozen. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Unfollow() { - UnfollowValue = null; - UnfollowDescriptorAction = null; - UnfollowDescriptor = descriptor; - return Self; + Instance.Unfollow = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(null); + return this; } - public ActionsDescriptor Unfollow(Action configure) + /// + /// + /// Phases allowed: hot, warm, cold, frozen. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor Unfollow(System.Action? action) { - UnfollowValue = null; - UnfollowDescriptor = null; - UnfollowDescriptorAction = configure; - return Self; + Instance.Unfollow = Elastic.Clients.Elasticsearch.EmptyObjectDescriptor.Build(action); + return this; } /// @@ -495,225 +678,33 @@ public ActionsDescriptor Unfollow(Action /// - public ActionsDescriptor WaitForSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction? waitForSnapshot) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor WaitForSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction? value) { - WaitForSnapshotDescriptor = null; - WaitForSnapshotDescriptorAction = null; - WaitForSnapshotValue = waitForSnapshot; - return Self; + Instance.WaitForSnapshot = value; + return this; } - public ActionsDescriptor WaitForSnapshot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor descriptor) - { - WaitForSnapshotValue = null; - WaitForSnapshotDescriptorAction = null; - WaitForSnapshotDescriptor = descriptor; - return Self; - } - - public ActionsDescriptor WaitForSnapshot(Action configure) + /// + /// + /// Phases allowed: delete. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor WaitForSnapshot(System.Action action) { - WaitForSnapshotValue = null; - WaitForSnapshotDescriptor = null; - WaitForSnapshotDescriptorAction = configure; - return Self; + Instance.WaitForSnapshot = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions Build(System.Action? action) { - writer.WriteStartObject(); - if (AllocateDescriptor is not null) - { - writer.WritePropertyName("allocate"); - JsonSerializer.Serialize(writer, AllocateDescriptor, options); - } - else if (AllocateDescriptorAction is not null) - { - writer.WritePropertyName("allocate"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(AllocateDescriptorAction), options); - } - else if (AllocateValue is not null) - { - writer.WritePropertyName("allocate"); - JsonSerializer.Serialize(writer, AllocateValue, options); - } - - if (DeleteDescriptor is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, DeleteDescriptor, options); - } - else if (DeleteDescriptorAction is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor(DeleteDescriptorAction), options); - } - else if (DeleteValue is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, DeleteValue, options); - } - - if (DownsampleDescriptor is not null) - { - writer.WritePropertyName("downsample"); - JsonSerializer.Serialize(writer, DownsampleDescriptor, options); - } - else if (DownsampleDescriptorAction is not null) - { - writer.WritePropertyName("downsample"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor(DownsampleDescriptorAction), options); - } - else if (DownsampleValue is not null) - { - writer.WritePropertyName("downsample"); - JsonSerializer.Serialize(writer, DownsampleValue, options); - } - - if (ForcemergeDescriptor is not null) - { - writer.WritePropertyName("forcemerge"); - JsonSerializer.Serialize(writer, ForcemergeDescriptor, options); - } - else if (ForcemergeDescriptorAction is not null) - { - writer.WritePropertyName("forcemerge"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor(ForcemergeDescriptorAction), options); - } - else if (ForcemergeValue is not null) - { - writer.WritePropertyName("forcemerge"); - JsonSerializer.Serialize(writer, ForcemergeValue, options); - } - - if (MigrateDescriptor is not null) - { - writer.WritePropertyName("migrate"); - JsonSerializer.Serialize(writer, MigrateDescriptor, options); - } - else if (MigrateDescriptorAction is not null) - { - writer.WritePropertyName("migrate"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor(MigrateDescriptorAction), options); - } - else if (MigrateValue is not null) - { - writer.WritePropertyName("migrate"); - JsonSerializer.Serialize(writer, MigrateValue, options); - } - - if (ReadonlyDescriptor is not null) - { - writer.WritePropertyName("readonly"); - JsonSerializer.Serialize(writer, ReadonlyDescriptor, options); - } - else if (ReadonlyDescriptorAction is not null) - { - writer.WritePropertyName("readonly"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(ReadonlyDescriptorAction), options); - } - else if (ReadonlyValue is not null) - { - writer.WritePropertyName("readonly"); - JsonSerializer.Serialize(writer, ReadonlyValue, options); - } - - if (RolloverDescriptor is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, RolloverDescriptor, options); - } - else if (RolloverDescriptorAction is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor(RolloverDescriptorAction), options); - } - else if (RolloverValue is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, RolloverValue, options); - } - - if (SearchableSnapshotDescriptor is not null) - { - writer.WritePropertyName("searchable_snapshot"); - JsonSerializer.Serialize(writer, SearchableSnapshotDescriptor, options); - } - else if (SearchableSnapshotDescriptorAction is not null) - { - writer.WritePropertyName("searchable_snapshot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor(SearchableSnapshotDescriptorAction), options); - } - else if (SearchableSnapshotValue is not null) + if (action is null) { - writer.WritePropertyName("searchable_snapshot"); - JsonSerializer.Serialize(writer, SearchableSnapshotValue, options); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SetPriorityDescriptor is not null) - { - writer.WritePropertyName("set_priority"); - JsonSerializer.Serialize(writer, SetPriorityDescriptor, options); - } - else if (SetPriorityDescriptorAction is not null) - { - writer.WritePropertyName("set_priority"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor(SetPriorityDescriptorAction), options); - } - else if (SetPriorityValue is not null) - { - writer.WritePropertyName("set_priority"); - JsonSerializer.Serialize(writer, SetPriorityValue, options); - } - - if (ShrinkDescriptor is not null) - { - writer.WritePropertyName("shrink"); - JsonSerializer.Serialize(writer, ShrinkDescriptor, options); - } - else if (ShrinkDescriptorAction is not null) - { - writer.WritePropertyName("shrink"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor(ShrinkDescriptorAction), options); - } - else if (ShrinkValue is not null) - { - writer.WritePropertyName("shrink"); - JsonSerializer.Serialize(writer, ShrinkValue, options); - } - - if (UnfollowDescriptor is not null) - { - writer.WritePropertyName("unfollow"); - JsonSerializer.Serialize(writer, UnfollowDescriptor, options); - } - else if (UnfollowDescriptorAction is not null) - { - writer.WritePropertyName("unfollow"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.EmptyObjectDescriptor(UnfollowDescriptorAction), options); - } - else if (UnfollowValue is not null) - { - writer.WritePropertyName("unfollow"); - JsonSerializer.Serialize(writer, UnfollowValue, options); - } - - if (WaitForSnapshotDescriptor is not null) - { - writer.WritePropertyName("wait_for_snapshot"); - JsonSerializer.Serialize(writer, WaitForSnapshotDescriptor, options); - } - else if (WaitForSnapshotDescriptorAction is not null) - { - writer.WritePropertyName("wait_for_snapshot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor(WaitForSnapshotDescriptorAction), options); - } - else if (WaitForSnapshotValue is not null) - { - writer.WritePropertyName("wait_for_snapshot"); - JsonSerializer.Serialize(writer, WaitForSnapshotValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/AllocateAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/AllocateAction.g.cs index 94e6437f241..26c50b543b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/AllocateAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/AllocateAction.g.cs @@ -17,107 +17,229 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class AllocateActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfReplicas = System.Text.Json.JsonEncodedText.Encode("number_of_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropRequire = System.Text.Json.JsonEncodedText.Encode("require"); + private static readonly System.Text.Json.JsonEncodedText PropTotalShardsPerNode = System.Text.Json.JsonEncodedText.Encode("total_shards_per_node"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propExclude = default; + LocalJsonValue?> propInclude = default; + LocalJsonValue propNumberOfReplicas = default; + LocalJsonValue?> propRequire = default; + LocalJsonValue propTotalShardsPerNode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExclude.TryReadProperty(ref reader, options, PropExclude, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNumberOfReplicas.TryReadProperty(ref reader, options, PropNumberOfReplicas, null)) + { + continue; + } + + if (propRequire.TryReadProperty(ref reader, options, PropRequire, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTotalShardsPerNode.TryReadProperty(ref reader, options, PropTotalShardsPerNode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exclude = propExclude.Value, + Include = propInclude.Value, + NumberOfReplicas = propNumberOfReplicas.Value, + Require = propRequire.Value, + TotalShardsPerNode = propTotalShardsPerNode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExclude, value.Exclude, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropInclude, value.Include, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNumberOfReplicas, value.NumberOfReplicas, null, null); + writer.WriteProperty(options, PropRequire, value.Require, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTotalShardsPerNode, value.TotalShardsPerNode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionConverter))] public sealed partial class AllocateAction { - [JsonInclude, JsonPropertyName("exclude")] - public IDictionary? Exclude { get; set; } - [JsonInclude, JsonPropertyName("include")] - public IDictionary? Include { get; set; } - [JsonInclude, JsonPropertyName("number_of_replicas")] +#if NET7_0_OR_GREATER + public AllocateAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public AllocateAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IDictionary? Exclude { get; set; } + public System.Collections.Generic.IDictionary? Include { get; set; } public int? NumberOfReplicas { get; set; } - [JsonInclude, JsonPropertyName("require")] - public IDictionary? Require { get; set; } - [JsonInclude, JsonPropertyName("total_shards_per_node")] + public System.Collections.Generic.IDictionary? Require { get; set; } public int? TotalShardsPerNode { get; set; } } -public sealed partial class AllocateActionDescriptor : SerializableDescriptor +public readonly partial struct AllocateActionDescriptor { - internal AllocateActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction instance) + { + Instance = instance; + } - public AllocateActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllocateActionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary? ExcludeValue { get; set; } - private IDictionary? IncludeValue { get; set; } - private int? NumberOfReplicasValue { get; set; } - private IDictionary? RequireValue { get; set; } - private int? TotalShardsPerNodeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor descriptor) => descriptor.Instance; - public AllocateActionDescriptor Exclude(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude(System.Collections.Generic.IDictionary? value) { - ExcludeValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Exclude = value; + return this; } - public AllocateActionDescriptor Include(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude() { - IncludeValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Exclude = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public AllocateActionDescriptor NumberOfReplicas(int? numberOfReplicas) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude(System.Action? action) { - NumberOfReplicasValue = numberOfReplicas; - return Self; + Instance.Exclude = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public AllocateActionDescriptor Require(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddExclude(string key, string value) { - RequireValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Exclude ??= new System.Collections.Generic.Dictionary(); + Instance.Exclude.Add(key, value); + return this; } - public AllocateActionDescriptor TotalShardsPerNode(int? totalShardsPerNode) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include(System.Collections.Generic.IDictionary? value) { - TotalShardsPerNodeValue = totalShardsPerNode; - return Self; + Instance.Include = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include() { - writer.WriteStartObject(); - if (ExcludeValue is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } + Instance.Include = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } - if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include(System.Action? action) + { + Instance.Include = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } - if (NumberOfReplicasValue.HasValue) - { - writer.WritePropertyName("number_of_replicas"); - writer.WriteNumberValue(NumberOfReplicasValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddInclude(string key, string value) + { + Instance.Include ??= new System.Collections.Generic.Dictionary(); + Instance.Include.Add(key, value); + return this; + } - if (RequireValue is not null) - { - writer.WritePropertyName("require"); - JsonSerializer.Serialize(writer, RequireValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor NumberOfReplicas(int? value) + { + Instance.NumberOfReplicas = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require(System.Collections.Generic.IDictionary? value) + { + Instance.Require = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require() + { + Instance.Require = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } - if (TotalShardsPerNodeValue.HasValue) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require(System.Action? action) + { + Instance.Require = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddRequire(string key, string value) + { + Instance.Require ??= new System.Collections.Generic.Dictionary(); + Instance.Require.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor TotalShardsPerNode(int? value) + { + Instance.TotalShardsPerNode = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("total_shards_per_node"); - writer.WriteNumberValue(TotalShardsPerNodeValue.Value); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DeleteAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DeleteAction.g.cs index 4caad7a6cec..713645d9ba1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DeleteAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DeleteAction.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class DeleteActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeleteSearchableSnapshot = System.Text.Json.JsonEncodedText.Encode("delete_searchable_snapshot"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeleteSearchableSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleteSearchableSnapshot.TryReadProperty(ref reader, options, PropDeleteSearchableSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeleteSearchableSnapshot = propDeleteSearchableSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleteSearchableSnapshot, value.DeleteSearchableSnapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionConverter))] public sealed partial class DeleteAction { - [JsonInclude, JsonPropertyName("delete_searchable_snapshot")] +#if NET7_0_OR_GREATER + public DeleteAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public DeleteAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeleteAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? DeleteSearchableSnapshot { get; set; } } -public sealed partial class DeleteActionDescriptor : SerializableDescriptor +public readonly partial struct DeleteActionDescriptor { - internal DeleteActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction Instance { get; init; } - public DeleteActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction instance) { + Instance = instance; } - private bool? DeleteSearchableSnapshotValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DeleteActionDescriptor DeleteSearchableSnapshot(bool? deleteSearchableSnapshot = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor DeleteSearchableSnapshot(bool? value = true) { - DeleteSearchableSnapshotValue = deleteSearchableSnapshot; - return Self; + Instance.DeleteSearchableSnapshot = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction Build(System.Action? action) { - writer.WriteStartObject(); - if (DeleteSearchableSnapshotValue.HasValue) + if (action is null) { - writer.WritePropertyName("delete_searchable_snapshot"); - writer.WriteBooleanValue(DeleteSearchableSnapshotValue.Value); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DeleteAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DownsampleAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DownsampleAction.g.cs index 7c8a7b95e5a..a929ce72c72 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DownsampleAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/DownsampleAction.g.cs @@ -17,58 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class DownsampleActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + private static readonly System.Text.Json.JsonEncodedText PropWaitTimeout = System.Text.Json.JsonEncodedText.Encode("wait_timeout"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFixedInterval = default; + LocalJsonValue propWaitTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) + { + continue; + } + + if (propWaitTimeout.TryReadProperty(ref reader, options, PropWaitTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FixedInterval = propFixedInterval.Value, + WaitTimeout = propWaitTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteProperty(options, PropWaitTimeout, value.WaitTimeout, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionConverter))] public sealed partial class DownsampleAction { - [JsonInclude, JsonPropertyName("fixed_interval")] - public string FixedInterval { get; set; } - [JsonInclude, JsonPropertyName("wait_timeout")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleAction(string fixedInterval) + { + FixedInterval = fixedInterval; + } +#if NET7_0_OR_GREATER + public DownsampleAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DownsampleAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DownsampleAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string FixedInterval { get; set; } public Elastic.Clients.Elasticsearch.Duration? WaitTimeout { get; set; } } -public sealed partial class DownsampleActionDescriptor : SerializableDescriptor +public readonly partial struct DownsampleActionDescriptor { - internal DownsampleActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction Instance { get; init; } - public DownsampleActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction instance) { + Instance = instance; } - private string FixedIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WaitTimeoutValue { get; set; } - - public DownsampleActionDescriptor FixedInterval(string fixedInterval) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleActionDescriptor() { - FixedIntervalValue = fixedInterval; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DownsampleActionDescriptor WaitTimeout(Elastic.Clients.Elasticsearch.Duration? waitTimeout) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor FixedInterval(string value) { - WaitTimeoutValue = waitTimeout; - return Self; + Instance.FixedInterval = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor WaitTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - writer.WritePropertyName("fixed_interval"); - writer.WriteStringValue(FixedIntervalValue); - if (WaitTimeoutValue is not null) - { - writer.WritePropertyName("wait_timeout"); - JsonSerializer.Serialize(writer, WaitTimeoutValue, options); - } + Instance.WaitTimeout = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.DownsampleAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ForceMergeAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ForceMergeAction.g.cs index 684747c48a3..7c8a7dff455 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ForceMergeAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ForceMergeAction.g.cs @@ -17,58 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class ForceMergeActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexCodec = System.Text.Json.JsonEncodedText.Encode("index_codec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumSegments = System.Text.Json.JsonEncodedText.Encode("max_num_segments"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexCodec = default; + LocalJsonValue propMaxNumSegments = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexCodec.TryReadProperty(ref reader, options, PropIndexCodec, null)) + { + continue; + } + + if (propMaxNumSegments.TryReadProperty(ref reader, options, PropMaxNumSegments, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexCodec = propIndexCodec.Value, + MaxNumSegments = propMaxNumSegments.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexCodec, value.IndexCodec, null, null); + writer.WriteProperty(options, PropMaxNumSegments, value.MaxNumSegments, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionConverter))] public sealed partial class ForceMergeAction { - [JsonInclude, JsonPropertyName("index_codec")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForceMergeAction(int maxNumSegments) + { + MaxNumSegments = maxNumSegments; + } +#if NET7_0_OR_GREATER + public ForceMergeAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ForceMergeAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForceMergeAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? IndexCodec { get; set; } - [JsonInclude, JsonPropertyName("max_num_segments")] - public int MaxNumSegments { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxNumSegments { get; set; } } -public sealed partial class ForceMergeActionDescriptor : SerializableDescriptor +public readonly partial struct ForceMergeActionDescriptor { - internal ForceMergeActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction Instance { get; init; } - public ForceMergeActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForceMergeActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction instance) { + Instance = instance; } - private string? IndexCodecValue { get; set; } - private int MaxNumSegmentsValue { get; set; } - - public ForceMergeActionDescriptor IndexCodec(string? indexCodec) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForceMergeActionDescriptor() { - IndexCodecValue = indexCodec; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ForceMergeActionDescriptor MaxNumSegments(int maxNumSegments) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor IndexCodec(string? value) { - MaxNumSegmentsValue = maxNumSegments; - return Self; + Instance.IndexCodec = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor MaxNumSegments(int value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(IndexCodecValue)) - { - writer.WritePropertyName("index_codec"); - writer.WriteStringValue(IndexCodecValue); - } + Instance.MaxNumSegments = value; + return this; + } - writer.WritePropertyName("max_num_segments"); - writer.WriteNumberValue(MaxNumSegmentsValue); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ForceMergeAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/IlmPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/IlmPolicy.g.cs index 16e5f4cdfe0..286c380f191 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/IlmPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/IlmPolicy.g.cs @@ -17,102 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class IlmPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPhases = System.Text.Json.JsonEncodedText.Encode("phases"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMeta = default; + LocalJsonValue propPhases = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPhases.TryReadProperty(ref reader, options, PropPhases, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Meta = propMeta.Value, + Phases = propPhases.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPhases, value.Phases, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyConverter))] public sealed partial class IlmPolicy { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmPolicy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases phases) + { + Phases = phases; + } +#if NET7_0_OR_GREATER + public IlmPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IlmPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Arbitrary metadata that is not automatically generated or used by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("phases")] - public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases Phases { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases Phases { get; set; } } -public sealed partial class IlmPolicyDescriptor : SerializableDescriptor +public readonly partial struct IlmPolicyDescriptor { - internal IlmPolicyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy Instance { get; init; } - public IlmPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmPolicyDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy instance) { + Instance = instance; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases PhasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor PhasesDescriptor { get; set; } - private Action PhasesDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmPolicyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor descriptor) => descriptor.Instance; /// /// /// Arbitrary metadata that is not automatically generated or used by Elasticsearch. /// /// - public IlmPolicyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IlmPolicyDescriptor Phases(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases phases) + /// + /// + /// Arbitrary metadata that is not automatically generated or used by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Meta() { - PhasesDescriptor = null; - PhasesDescriptorAction = null; - PhasesValue = phases; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public IlmPolicyDescriptor Phases(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor descriptor) + /// + /// + /// Arbitrary metadata that is not automatically generated or used by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Meta(System.Action? action) { - PhasesValue = null; - PhasesDescriptorAction = null; - PhasesDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public IlmPolicyDescriptor Phases(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor AddMeta(string key, object value) { - PhasesValue = null; - PhasesDescriptor = null; - PhasesDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Phases(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases value) { - writer.WriteStartObject(); - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Phases = value; + return this; + } - if (PhasesDescriptor is not null) - { - writer.WritePropertyName("phases"); - JsonSerializer.Serialize(writer, PhasesDescriptor, options); - } - else if (PhasesDescriptorAction is not null) - { - writer.WritePropertyName("phases"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor(PhasesDescriptorAction), options); - } - else - { - writer.WritePropertyName("phases"); - JsonSerializer.Serialize(writer, PhasesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Phases() + { + Instance.Phases = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor Phases(System.Action? action) + { + Instance.Phases = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicyDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Lifecycle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Lifecycle.g.cs index cfe7b62dd3b..9081d115bd9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Lifecycle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Lifecycle.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class LifecycleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropModifiedDate = System.Text.Json.JsonEncodedText.Encode("modified_date"); + private static readonly System.Text.Json.JsonEncodedText PropPolicy = System.Text.Json.JsonEncodedText.Encode("policy"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Lifecycle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModifiedDate = default; + LocalJsonValue propPolicy = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModifiedDate.TryReadProperty(ref reader, options, PropModifiedDate, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propPolicy.TryReadProperty(ref reader, options, PropPolicy, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Lifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModifiedDate = propModifiedDate.Value, + Policy = propPolicy.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Lifecycle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModifiedDate, value.ModifiedDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropPolicy, value.Policy, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.LifecycleConverter))] public sealed partial class Lifecycle { - [JsonInclude, JsonPropertyName("modified_date")] - public DateTimeOffset ModifiedDate { get; init; } - [JsonInclude, JsonPropertyName("policy")] - public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy Policy { get; init; } - [JsonInclude, JsonPropertyName("version")] - public long Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Lifecycle(System.DateTimeOffset modifiedDate, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy policy, long version) + { + ModifiedDate = modifiedDate; + Policy = policy; + Version = version; + } +#if NET7_0_OR_GREATER + public Lifecycle() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Lifecycle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Lifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ModifiedDate { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexLifecycleManagement.IlmPolicy Policy { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/MigrateAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/MigrateAction.g.cs index cd968e3bd33..a0f44d46373 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/MigrateAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/MigrateAction.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class MigrateActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionConverter))] public sealed partial class MigrateAction { - [JsonInclude, JsonPropertyName("enabled")] +#if NET7_0_OR_GREATER + public MigrateAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public MigrateAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Enabled { get; set; } } -public sealed partial class MigrateActionDescriptor : SerializableDescriptor +public readonly partial struct MigrateActionDescriptor { - internal MigrateActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction Instance { get; init; } - public MigrateActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction instance) { + Instance = instance; } - private bool? EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public MigrateActionDescriptor Enabled(bool? enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction Build(System.Action? action) { - writer.WriteStartObject(); - if (EnabledValue.HasValue) + if (action is null) { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.MigrateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phase.g.cs index 6c34675689a..04686144cb9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phase.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phase.g.cs @@ -17,92 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class PhaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropMinAge = System.Text.Json.JsonEncodedText.Encode("min_age"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActions = default; + LocalJsonValue propMinAge = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, null)) + { + continue; + } + + if (propMinAge.TryReadProperty(ref reader, options, PropMinAge, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + MinAge = propMinAge.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, null); + writer.WriteProperty(options, PropMinAge, value.MinAge, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseConverter))] public sealed partial class Phase { - [JsonInclude, JsonPropertyName("actions")] +#if NET7_0_OR_GREATER + public Phase() + { + } +#endif +#if !NET7_0_OR_GREATER + public Phase() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions? Actions { get; set; } - [JsonInclude, JsonPropertyName("min_age")] public Elastic.Clients.Elasticsearch.Duration? MinAge { get; set; } } -public sealed partial class PhaseDescriptor : SerializableDescriptor +public readonly partial struct PhaseDescriptor { - internal PhaseDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase Instance { get; init; } - public PhaseDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhaseDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions? ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor ActionsDescriptor { get; set; } - private Action ActionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MinAgeValue { get; set; } - - public PhaseDescriptor Actions(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions? actions) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhaseDescriptor() { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsValue = actions; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PhaseDescriptor Actions(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor Actions(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Actions? value) { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptor = descriptor; - return Self; + Instance.Actions = value; + return this; } - public PhaseDescriptor Actions(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor Actions() { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = configure; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor.Build(null); + return this; } - public PhaseDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? minAge) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor Actions(System.Action? action) { - MinAgeValue = minAge; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - } - else if (ActionsDescriptorAction is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ActionsDescriptor(ActionsDescriptorAction), options); - } - else if (ActionsValue is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + Instance.MinAge = value; + return this; + } - if (MinAgeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("min_age"); - JsonSerializer.Serialize(writer, MinAgeValue, options); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phases.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phases.g.cs index 3f4557b59bb..68746409ae5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phases.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/Phases.g.cs @@ -17,257 +17,232 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class PhasesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCold = System.Text.Json.JsonEncodedText.Encode("cold"); + private static readonly System.Text.Json.JsonEncodedText PropDelete = System.Text.Json.JsonEncodedText.Encode("delete"); + private static readonly System.Text.Json.JsonEncodedText PropFrozen = System.Text.Json.JsonEncodedText.Encode("frozen"); + private static readonly System.Text.Json.JsonEncodedText PropHot = System.Text.Json.JsonEncodedText.Encode("hot"); + private static readonly System.Text.Json.JsonEncodedText PropWarm = System.Text.Json.JsonEncodedText.Encode("warm"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCold = default; + LocalJsonValue propDelete = default; + LocalJsonValue propFrozen = default; + LocalJsonValue propHot = default; + LocalJsonValue propWarm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCold.TryReadProperty(ref reader, options, PropCold, null)) + { + continue; + } + + if (propDelete.TryReadProperty(ref reader, options, PropDelete, null)) + { + continue; + } + + if (propFrozen.TryReadProperty(ref reader, options, PropFrozen, null)) + { + continue; + } + + if (propHot.TryReadProperty(ref reader, options, PropHot, null)) + { + continue; + } + + if (propWarm.TryReadProperty(ref reader, options, PropWarm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cold = propCold.Value, + Delete = propDelete.Value, + Frozen = propFrozen.Value, + Hot = propHot.Value, + Warm = propWarm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCold, value.Cold, null, null); + writer.WriteProperty(options, PropDelete, value.Delete, null, null); + writer.WriteProperty(options, PropFrozen, value.Frozen, null, null); + writer.WriteProperty(options, PropHot, value.Hot, null, null); + writer.WriteProperty(options, PropWarm, value.Warm, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesConverter))] public sealed partial class Phases { - [JsonInclude, JsonPropertyName("cold")] +#if NET7_0_OR_GREATER + public Phases() + { + } +#endif +#if !NET7_0_OR_GREATER + public Phases() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? Cold { get; set; } - [JsonInclude, JsonPropertyName("delete")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? Delete { get; set; } - [JsonInclude, JsonPropertyName("frozen")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? Frozen { get; set; } - [JsonInclude, JsonPropertyName("hot")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? Hot { get; set; } - [JsonInclude, JsonPropertyName("warm")] public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? Warm { get; set; } } -public sealed partial class PhasesDescriptor : SerializableDescriptor +public readonly partial struct PhasesDescriptor { - internal PhasesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases Instance { get; init; } - public PhasesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhasesDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? ColdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor ColdDescriptor { get; set; } - private Action ColdDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? DeleteValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor DeleteDescriptor { get; set; } - private Action DeleteDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? FrozenValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor FrozenDescriptor { get; set; } - private Action FrozenDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? HotValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor HotDescriptor { get; set; } - private Action HotDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? WarmValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor WarmDescriptor { get; set; } - private Action WarmDescriptorAction { get; set; } - - public PhasesDescriptor Cold(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? cold) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PhasesDescriptor() { - ColdDescriptor = null; - ColdDescriptorAction = null; - ColdValue = cold; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PhasesDescriptor Cold(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Cold(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? value) { - ColdValue = null; - ColdDescriptorAction = null; - ColdDescriptor = descriptor; - return Self; + Instance.Cold = value; + return this; } - public PhasesDescriptor Cold(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Cold() { - ColdValue = null; - ColdDescriptor = null; - ColdDescriptorAction = configure; - return Self; + Instance.Cold = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(null); + return this; } - public PhasesDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? delete) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Cold(System.Action? action) { - DeleteDescriptor = null; - DeleteDescriptorAction = null; - DeleteValue = delete; - return Self; + Instance.Cold = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(action); + return this; } - public PhasesDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Delete(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? value) { - DeleteValue = null; - DeleteDescriptorAction = null; - DeleteDescriptor = descriptor; - return Self; + Instance.Delete = value; + return this; } - public PhasesDescriptor Delete(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Delete() { - DeleteValue = null; - DeleteDescriptor = null; - DeleteDescriptorAction = configure; - return Self; + Instance.Delete = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(null); + return this; } - public PhasesDescriptor Frozen(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? frozen) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Delete(System.Action? action) { - FrozenDescriptor = null; - FrozenDescriptorAction = null; - FrozenValue = frozen; - return Self; + Instance.Delete = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(action); + return this; } - public PhasesDescriptor Frozen(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Frozen(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? value) { - FrozenValue = null; - FrozenDescriptorAction = null; - FrozenDescriptor = descriptor; - return Self; + Instance.Frozen = value; + return this; } - public PhasesDescriptor Frozen(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Frozen() { - FrozenValue = null; - FrozenDescriptor = null; - FrozenDescriptorAction = configure; - return Self; + Instance.Frozen = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(null); + return this; } - public PhasesDescriptor Hot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? hot) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Frozen(System.Action? action) { - HotDescriptor = null; - HotDescriptorAction = null; - HotValue = hot; - return Self; + Instance.Frozen = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(action); + return this; } - public PhasesDescriptor Hot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Hot(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? value) { - HotValue = null; - HotDescriptorAction = null; - HotDescriptor = descriptor; - return Self; + Instance.Hot = value; + return this; } - public PhasesDescriptor Hot(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Hot() { - HotValue = null; - HotDescriptor = null; - HotDescriptorAction = configure; - return Self; + Instance.Hot = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(null); + return this; } - public PhasesDescriptor Warm(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? warm) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Hot(System.Action? action) { - WarmDescriptor = null; - WarmDescriptorAction = null; - WarmValue = warm; - return Self; + Instance.Hot = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(action); + return this; } - public PhasesDescriptor Warm(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Warm(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phase? value) { - WarmValue = null; - WarmDescriptorAction = null; - WarmDescriptor = descriptor; - return Self; + Instance.Warm = value; + return this; } - public PhasesDescriptor Warm(Action configure) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Warm() { - WarmValue = null; - WarmDescriptor = null; - WarmDescriptorAction = configure; - return Self; + Instance.Warm = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor Warm(System.Action? action) { - writer.WriteStartObject(); - if (ColdDescriptor is not null) - { - writer.WritePropertyName("cold"); - JsonSerializer.Serialize(writer, ColdDescriptor, options); - } - else if (ColdDescriptorAction is not null) - { - writer.WritePropertyName("cold"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(ColdDescriptorAction), options); - } - else if (ColdValue is not null) - { - writer.WritePropertyName("cold"); - JsonSerializer.Serialize(writer, ColdValue, options); - } - - if (DeleteDescriptor is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, DeleteDescriptor, options); - } - else if (DeleteDescriptorAction is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(DeleteDescriptorAction), options); - } - else if (DeleteValue is not null) - { - writer.WritePropertyName("delete"); - JsonSerializer.Serialize(writer, DeleteValue, options); - } - - if (FrozenDescriptor is not null) - { - writer.WritePropertyName("frozen"); - JsonSerializer.Serialize(writer, FrozenDescriptor, options); - } - else if (FrozenDescriptorAction is not null) - { - writer.WritePropertyName("frozen"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(FrozenDescriptorAction), options); - } - else if (FrozenValue is not null) - { - writer.WritePropertyName("frozen"); - JsonSerializer.Serialize(writer, FrozenValue, options); - } - - if (HotDescriptor is not null) - { - writer.WritePropertyName("hot"); - JsonSerializer.Serialize(writer, HotDescriptor, options); - } - else if (HotDescriptorAction is not null) - { - writer.WritePropertyName("hot"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(HotDescriptorAction), options); - } - else if (HotValue is not null) - { - writer.WritePropertyName("hot"); - JsonSerializer.Serialize(writer, HotValue, options); - } + Instance.Warm = Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor.Build(action); + return this; + } - if (WarmDescriptor is not null) - { - writer.WritePropertyName("warm"); - JsonSerializer.Serialize(writer, WarmDescriptor, options); - } - else if (WarmDescriptorAction is not null) - { - writer.WritePropertyName("warm"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhaseDescriptor(WarmDescriptorAction), options); - } - else if (WarmValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("warm"); - JsonSerializer.Serialize(writer, WarmValue, options); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.PhasesDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/RolloverAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/RolloverAction.g.cs index 9c0c5996f47..4f9dda504be 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/RolloverAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/RolloverAction.g.cs @@ -17,182 +17,276 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class RolloverActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAge = System.Text.Json.JsonEncodedText.Encode("max_age"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSize = System.Text.Json.JsonEncodedText.Encode("max_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinAge = System.Text.Json.JsonEncodedText.Encode("min_age"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocs = System.Text.Json.JsonEncodedText.Encode("min_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinSize = System.Text.Json.JsonEncodedText.Encode("min_size"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAge = default; + LocalJsonValue propMaxDocs = default; + LocalJsonValue propMaxPrimaryShardDocs = default; + LocalJsonValue propMaxPrimaryShardSize = default; + LocalJsonValue propMaxSize = default; + LocalJsonValue propMinAge = default; + LocalJsonValue propMinDocs = default; + LocalJsonValue propMinPrimaryShardDocs = default; + LocalJsonValue propMinPrimaryShardSize = default; + LocalJsonValue propMinSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAge.TryReadProperty(ref reader, options, PropMaxAge, null)) + { + continue; + } + + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardDocs.TryReadProperty(ref reader, options, PropMaxPrimaryShardDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardSize.TryReadProperty(ref reader, options, PropMaxPrimaryShardSize, null)) + { + continue; + } + + if (propMaxSize.TryReadProperty(ref reader, options, PropMaxSize, null)) + { + continue; + } + + if (propMinAge.TryReadProperty(ref reader, options, PropMinAge, null)) + { + continue; + } + + if (propMinDocs.TryReadProperty(ref reader, options, PropMinDocs, null)) + { + continue; + } + + if (propMinPrimaryShardDocs.TryReadProperty(ref reader, options, PropMinPrimaryShardDocs, null)) + { + continue; + } + + if (propMinPrimaryShardSize.TryReadProperty(ref reader, options, PropMinPrimaryShardSize, null)) + { + continue; + } + + if (propMinSize.TryReadProperty(ref reader, options, PropMinSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAge = propMaxAge.Value, + MaxDocs = propMaxDocs.Value, + MaxPrimaryShardDocs = propMaxPrimaryShardDocs.Value, + MaxPrimaryShardSize = propMaxPrimaryShardSize.Value, + MaxSize = propMaxSize.Value, + MinAge = propMinAge.Value, + MinDocs = propMinDocs.Value, + MinPrimaryShardDocs = propMinPrimaryShardDocs.Value, + MinPrimaryShardSize = propMinPrimaryShardSize.Value, + MinSize = propMinSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAge, value.MaxAge, null, null); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardDocs, value.MaxPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardSize, value.MaxPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMaxSize, value.MaxSize, null, null); + writer.WriteProperty(options, PropMinAge, value.MinAge, null, null); + writer.WriteProperty(options, PropMinDocs, value.MinDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardDocs, value.MinPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardSize, value.MinPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMinSize, value.MinSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionConverter))] public sealed partial class RolloverAction { - [JsonInclude, JsonPropertyName("max_age")] +#if NET7_0_OR_GREATER + public RolloverAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public RolloverAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RolloverAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Duration? MaxAge { get; set; } - [JsonInclude, JsonPropertyName("max_docs")] public long? MaxDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_docs")] public long? MaxPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("max_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxSize { get; set; } - [JsonInclude, JsonPropertyName("min_age")] public Elastic.Clients.Elasticsearch.Duration? MinAge { get; set; } - [JsonInclude, JsonPropertyName("min_docs")] public long? MinDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_docs")] public long? MinPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("min_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinSize { get; set; } } -public sealed partial class RolloverActionDescriptor : SerializableDescriptor +public readonly partial struct RolloverActionDescriptor { - internal RolloverActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction Instance { get; init; } - public RolloverActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? MaxAgeValue { get; set; } - private long? MaxDocsValue { get; set; } - private long? MaxPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MinAgeValue { get; set; } - private long? MinDocsValue { get; set; } - private long? MinPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinSizeValue { get; set; } - - public RolloverActionDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration? maxAge) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverActionDescriptor() { - MaxAgeValue = maxAge; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RolloverActionDescriptor MaxDocs(long? maxDocs) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxAge = value; + return this; } - public RolloverActionDescriptor MaxPrimaryShardDocs(long? maxPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxDocs(long? value) { - MaxPrimaryShardDocsValue = maxPrimaryShardDocs; - return Self; + Instance.MaxDocs = value; + return this; } - public RolloverActionDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? maxPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxPrimaryShardDocs(long? value) { - MaxPrimaryShardSizeValue = maxPrimaryShardSize; - return Self; + Instance.MaxPrimaryShardDocs = value; + return this; } - public RolloverActionDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? maxSize) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxSizeValue = maxSize; - return Self; + Instance.MaxPrimaryShardSize = value; + return this; } - public RolloverActionDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? minAge) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxPrimaryShardSize(System.Func action) { - MinAgeValue = minAge; - return Self; + Instance.MaxPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public RolloverActionDescriptor MinDocs(long? minDocs) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MinDocsValue = minDocs; - return Self; + Instance.MaxSize = value; + return this; } - public RolloverActionDescriptor MinPrimaryShardDocs(long? minPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MaxSize(System.Func action) { - MinPrimaryShardDocsValue = minPrimaryShardDocs; - return Self; + Instance.MaxSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public RolloverActionDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? minPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? value) { - MinPrimaryShardSizeValue = minPrimaryShardSize; - return Self; + Instance.MinAge = value; + return this; } - public RolloverActionDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? minSize) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinDocs(long? value) { - MinSizeValue = minSize; - return Self; + Instance.MinDocs = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinPrimaryShardDocs(long? value) { - writer.WriteStartObject(); - if (MaxAgeValue is not null) - { - writer.WritePropertyName("max_age"); - JsonSerializer.Serialize(writer, MaxAgeValue, options); - } - - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } - - if (MaxPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("max_primary_shard_docs"); - writer.WriteNumberValue(MaxPrimaryShardDocsValue.Value); - } - - if (MaxPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("max_primary_shard_size"); - JsonSerializer.Serialize(writer, MaxPrimaryShardSizeValue, options); - } - - if (MaxSizeValue is not null) - { - writer.WritePropertyName("max_size"); - JsonSerializer.Serialize(writer, MaxSizeValue, options); - } + Instance.MinPrimaryShardDocs = value; + return this; + } - if (MinAgeValue is not null) - { - writer.WritePropertyName("min_age"); - JsonSerializer.Serialize(writer, MinAgeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MinPrimaryShardSize = value; + return this; + } - if (MinDocsValue.HasValue) - { - writer.WritePropertyName("min_docs"); - writer.WriteNumberValue(MinDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinPrimaryShardSize(System.Func action) + { + Instance.MinPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("min_primary_shard_docs"); - writer.WriteNumberValue(MinPrimaryShardDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MinSize = value; + return this; + } - if (MinPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("min_primary_shard_size"); - JsonSerializer.Serialize(writer, MinPrimaryShardSizeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor MinSize(System.Func action) + { + Instance.MinSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinSizeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("min_size"); - JsonSerializer.Serialize(writer, MinSizeValue, options); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.RolloverAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SearchableSnapshotAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SearchableSnapshotAction.g.cs index 7b4f0145054..7f7e4fd9187 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SearchableSnapshotAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SearchableSnapshotAction.g.cs @@ -17,58 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class SearchableSnapshotActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForceMergeIndex = System.Text.Json.JsonEncodedText.Encode("force_merge_index"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshotRepository = System.Text.Json.JsonEncodedText.Encode("snapshot_repository"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForceMergeIndex = default; + LocalJsonValue propSnapshotRepository = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForceMergeIndex.TryReadProperty(ref reader, options, PropForceMergeIndex, null)) + { + continue; + } + + if (propSnapshotRepository.TryReadProperty(ref reader, options, PropSnapshotRepository, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForceMergeIndex = propForceMergeIndex.Value, + SnapshotRepository = propSnapshotRepository.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForceMergeIndex, value.ForceMergeIndex, null, null); + writer.WriteProperty(options, PropSnapshotRepository, value.SnapshotRepository, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionConverter))] public sealed partial class SearchableSnapshotAction { - [JsonInclude, JsonPropertyName("force_merge_index")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotAction(string snapshotRepository) + { + SnapshotRepository = snapshotRepository; + } +#if NET7_0_OR_GREATER + public SearchableSnapshotAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchableSnapshotAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchableSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? ForceMergeIndex { get; set; } - [JsonInclude, JsonPropertyName("snapshot_repository")] - public string SnapshotRepository { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string SnapshotRepository { get; set; } } -public sealed partial class SearchableSnapshotActionDescriptor : SerializableDescriptor +public readonly partial struct SearchableSnapshotActionDescriptor { - internal SearchableSnapshotActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction Instance { get; init; } - public SearchableSnapshotActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction instance) { + Instance = instance; } - private bool? ForceMergeIndexValue { get; set; } - private string SnapshotRepositoryValue { get; set; } - - public SearchableSnapshotActionDescriptor ForceMergeIndex(bool? forceMergeIndex = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshotActionDescriptor() { - ForceMergeIndexValue = forceMergeIndex; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SearchableSnapshotActionDescriptor SnapshotRepository(string snapshotRepository) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor ForceMergeIndex(bool? value = true) { - SnapshotRepositoryValue = snapshotRepository; - return Self; + Instance.ForceMergeIndex = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor SnapshotRepository(string value) { - writer.WriteStartObject(); - if (ForceMergeIndexValue.HasValue) - { - writer.WritePropertyName("force_merge_index"); - writer.WriteBooleanValue(ForceMergeIndexValue.Value); - } + Instance.SnapshotRepository = value; + return this; + } - writer.WritePropertyName("snapshot_repository"); - writer.WriteStringValue(SnapshotRepositoryValue); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SearchableSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SetPriorityAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SetPriorityAction.g.cs index b4765a04c32..5e2a9248121 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SetPriorityAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/SetPriorityAction.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class SetPriorityActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPriority = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Priority = propPriority.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionConverter))] public sealed partial class SetPriorityAction { - [JsonInclude, JsonPropertyName("priority")] +#if NET7_0_OR_GREATER + public SetPriorityAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public SetPriorityAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SetPriorityAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? Priority { get; set; } } -public sealed partial class SetPriorityActionDescriptor : SerializableDescriptor +public readonly partial struct SetPriorityActionDescriptor { - internal SetPriorityActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction Instance { get; init; } - public SetPriorityActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetPriorityActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction instance) { + Instance = instance; } - private int? PriorityValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetPriorityActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SetPriorityActionDescriptor Priority(int? priority) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor Priority(int? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction Build(System.Action? action) { - writer.WriteStartObject(); - if (PriorityValue.HasValue) + if (action is null) { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.SetPriorityAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ShrinkAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ShrinkAction.g.cs index 60a128ad8c0..44e4972740b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ShrinkAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/ShrinkAction.g.cs @@ -17,77 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class ShrinkActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowWriteAfterShrink = System.Text.Json.JsonEncodedText.Encode("allow_write_after_shrink"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfShards = System.Text.Json.JsonEncodedText.Encode("number_of_shards"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowWriteAfterShrink = default; + LocalJsonValue propMaxPrimaryShardSize = default; + LocalJsonValue propNumberOfShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowWriteAfterShrink.TryReadProperty(ref reader, options, PropAllowWriteAfterShrink, null)) + { + continue; + } + + if (propMaxPrimaryShardSize.TryReadProperty(ref reader, options, PropMaxPrimaryShardSize, null)) + { + continue; + } + + if (propNumberOfShards.TryReadProperty(ref reader, options, PropNumberOfShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowWriteAfterShrink = propAllowWriteAfterShrink.Value, + MaxPrimaryShardSize = propMaxPrimaryShardSize.Value, + NumberOfShards = propNumberOfShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowWriteAfterShrink, value.AllowWriteAfterShrink, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardSize, value.MaxPrimaryShardSize, null, null); + writer.WriteProperty(options, PropNumberOfShards, value.NumberOfShards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionConverter))] public sealed partial class ShrinkAction { - [JsonInclude, JsonPropertyName("allow_write_after_shrink")] +#if NET7_0_OR_GREATER + public ShrinkAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShrinkAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShrinkAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? AllowWriteAfterShrink { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("number_of_shards")] public int? NumberOfShards { get; set; } } -public sealed partial class ShrinkActionDescriptor : SerializableDescriptor +public readonly partial struct ShrinkActionDescriptor { - internal ShrinkActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction Instance { get; init; } - public ShrinkActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShrinkActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction instance) { + Instance = instance; } - private bool? AllowWriteAfterShrinkValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSizeValue { get; set; } - private int? NumberOfShardsValue { get; set; } - - public ShrinkActionDescriptor AllowWriteAfterShrink(bool? allowWriteAfterShrink = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShrinkActionDescriptor() { - AllowWriteAfterShrinkValue = allowWriteAfterShrink; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ShrinkActionDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? maxPrimaryShardSize) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor AllowWriteAfterShrink(bool? value = true) { - MaxPrimaryShardSizeValue = maxPrimaryShardSize; - return Self; + Instance.AllowWriteAfterShrink = value; + return this; } - public ShrinkActionDescriptor NumberOfShards(int? numberOfShards) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - NumberOfShardsValue = numberOfShards; - return Self; + Instance.MaxPrimaryShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor MaxPrimaryShardSize(System.Func action) { - writer.WriteStartObject(); - if (AllowWriteAfterShrinkValue.HasValue) - { - writer.WritePropertyName("allow_write_after_shrink"); - writer.WriteBooleanValue(AllowWriteAfterShrinkValue.Value); - } + Instance.MaxPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("max_primary_shard_size"); - JsonSerializer.Serialize(writer, MaxPrimaryShardSizeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor NumberOfShards(int? value) + { + Instance.NumberOfShards = value; + return this; + } - if (NumberOfShardsValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("number_of_shards"); - writer.WriteNumberValue(NumberOfShardsValue.Value); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.ShrinkAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/StepKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/StepKey.g.cs index 0da782d1db3..83321403b20 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/StepKey.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/StepKey.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class StepKeyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropPhase = System.Text.Json.JsonEncodedText.Encode("phase"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propName = default; + LocalJsonValue propPhase = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propPhase.TryReadProperty(ref reader, options, PropPhase, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Name = propName.Value, + Phase = propPhase.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropPhase, value.Phase, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyConverter))] public sealed partial class StepKey { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StepKey(string phase) + { + Phase = phase; + } +#if NET7_0_OR_GREATER + public StepKey() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StepKey() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StepKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The optional action to which the index will be moved. /// /// - [JsonInclude, JsonPropertyName("action")] public string? Action { get; set; } /// @@ -42,33 +117,42 @@ public sealed partial class StepKey /// The optional step name to which the index will be moved. /// /// - [JsonInclude, JsonPropertyName("name")] public string? Name { get; set; } - [JsonInclude, JsonPropertyName("phase")] - public string Phase { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Phase { get; set; } } -public sealed partial class StepKeyDescriptor : SerializableDescriptor +public readonly partial struct StepKeyDescriptor { - internal StepKeyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StepKeyDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey instance) + { + Instance = instance; + } - public StepKeyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StepKeyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ActionValue { get; set; } - private string? NameValue { get; set; } - private string PhaseValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor descriptor) => descriptor.Instance; /// /// /// The optional action to which the index will be moved. /// /// - public StepKeyDescriptor Action(string? action) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor Action(string? value) { - ActionValue = action; - return Self; + Instance.Action = value; + return this; } /// @@ -76,35 +160,23 @@ public StepKeyDescriptor Action(string? action) /// The optional step name to which the index will be moved. /// /// - public StepKeyDescriptor Name(string? name) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor Name(string? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } - public StepKeyDescriptor Phase(string phase) + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor Phase(string value) { - PhaseValue = phase; - return Self; + Instance.Phase = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ActionValue)) - { - writer.WritePropertyName("action"); - writer.WriteStringValue(ActionValue); - } - - if (!string.IsNullOrEmpty(NameValue)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); - } - - writer.WritePropertyName("phase"); - writer.WriteStringValue(PhaseValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKeyDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.StepKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/WaitForSnapshotAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/WaitForSnapshotAction.g.cs index 1d899c71982..55daad85e6d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/WaitForSnapshotAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexLifecycleManagement/WaitForSnapshotAction.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement; +internal sealed partial class WaitForSnapshotActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPolicy = System.Text.Json.JsonEncodedText.Encode("policy"); + + public override Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPolicy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicy.TryReadProperty(ref reader, options, PropPolicy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Policy = propPolicy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicy, value.Policy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionConverter))] public sealed partial class WaitForSnapshotAction { - [JsonInclude, JsonPropertyName("policy")] - public string Policy { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WaitForSnapshotAction(string policy) + { + Policy = policy; + } +#if NET7_0_OR_GREATER + public WaitForSnapshotAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WaitForSnapshotAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WaitForSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Policy { get; set; } } -public sealed partial class WaitForSnapshotActionDescriptor : SerializableDescriptor +public readonly partial struct WaitForSnapshotActionDescriptor { - internal WaitForSnapshotActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction Instance { get; init; } - public WaitForSnapshotActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WaitForSnapshotActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction instance) { + Instance = instance; } - private string PolicyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WaitForSnapshotActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public WaitForSnapshotActionDescriptor Policy(string policy) + public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor Policy(string value) { - PolicyValue = policy; - return Self; + Instance.Policy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("policy"); - writer.WriteStringValue(PolicyValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.WaitForSnapshotAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AddAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AddAction.g.cs index b2238856538..57b54c751e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AddAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AddAction.g.cs @@ -17,25 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AddActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAlias = System.Text.Json.JsonEncodedText.Encode("alias"); + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexRouting = System.Text.Json.JsonEncodedText.Encode("index_routing"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIsHidden = System.Text.Json.JsonEncodedText.Encode("is_hidden"); + private static readonly System.Text.Json.JsonEncodedText PropIsWriteIndex = System.Text.Json.JsonEncodedText.Encode("is_write_index"); + private static readonly System.Text.Json.JsonEncodedText PropMustExist = System.Text.Json.JsonEncodedText.Encode("must_exist"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearchRouting = System.Text.Json.JsonEncodedText.Encode("search_routing"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AddAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlias = default; + LocalJsonValue?> propAliases = default; + LocalJsonValue propFilter = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexRouting = default; + LocalJsonValue propIndices = default; + LocalJsonValue propIsHidden = default; + LocalJsonValue propIsWriteIndex = default; + LocalJsonValue propMustExist = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearchRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlias.TryReadProperty(ref reader, options, PropAlias, null)) + { + continue; + } + + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexRouting.TryReadProperty(ref reader, options, PropIndexRouting, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propIsHidden.TryReadProperty(ref reader, options, PropIsHidden, null)) + { + continue; + } + + if (propIsWriteIndex.TryReadProperty(ref reader, options, PropIsWriteIndex, null)) + { + continue; + } + + if (propMustExist.TryReadProperty(ref reader, options, PropMustExist, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearchRouting.TryReadProperty(ref reader, options, PropSearchRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alias = propAlias.Value, + Aliases = propAliases.Value, + Filter = propFilter.Value, + Index = propIndex.Value, + IndexRouting = propIndexRouting.Value, + Indices = propIndices.Value, + IsHidden = propIsHidden.Value, + IsWriteIndex = propIsWriteIndex.Value, + MustExist = propMustExist.Value, + Routing = propRouting.Value, + SearchRouting = propSearchRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AddAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlias, value.Alias, null, null); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexRouting, value.IndexRouting, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropIsHidden, value.IsHidden, null, null); + writer.WriteProperty(options, PropIsWriteIndex, value.IsWriteIndex, null, null); + writer.WriteProperty(options, PropMustExist, value.MustExist, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearchRouting, value.SearchRouting, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AddActionConverter))] public sealed partial class AddAction { +#if NET7_0_OR_GREATER + public AddAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public AddAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Alias for the action. /// Index alias names support date math. /// /// - [JsonInclude, JsonPropertyName("alias")] public Elastic.Clients.Elasticsearch.IndexAlias? Alias { get; set; } /// @@ -44,16 +185,13 @@ public sealed partial class AddAction /// Index alias names support date math. /// /// - [JsonInclude, JsonPropertyName("aliases")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexAlias))] - public ICollection? Aliases { get; set; } + public System.Collections.Generic.ICollection? Aliases { get; set; } /// /// /// Query used to limit documents the alias can access. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -62,7 +200,6 @@ public sealed partial class AddAction /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -72,7 +209,6 @@ public sealed partial class AddAction /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("index_routing")] public Elastic.Clients.Elasticsearch.Routing? IndexRouting { get; set; } /// @@ -81,7 +217,6 @@ public sealed partial class AddAction /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// @@ -89,7 +224,6 @@ public sealed partial class AddAction /// If true, the alias is hidden. /// /// - [JsonInclude, JsonPropertyName("is_hidden")] public bool? IsHidden { get; set; } /// @@ -97,7 +231,6 @@ public sealed partial class AddAction /// If true, sets the write index or data stream for the alias. /// /// - [JsonInclude, JsonPropertyName("is_write_index")] public bool? IsWriteIndex { get; set; } /// @@ -105,7 +238,6 @@ public sealed partial class AddAction /// If true, the alias must exist to perform the action. /// /// - [JsonInclude, JsonPropertyName("must_exist")] public bool? MustExist { get; set; } /// @@ -114,7 +246,6 @@ public sealed partial class AddAction /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -124,33 +255,27 @@ public sealed partial class AddAction /// Data stream aliases don’t support this parameter. /// /// - [JsonInclude, JsonPropertyName("search_routing")] public Elastic.Clients.Elasticsearch.Routing? SearchRouting { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(AddAction addAction) => Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction.Add(addAction); } -public sealed partial class AddActionDescriptor : SerializableDescriptor> +public readonly partial struct AddActionDescriptor { - internal AddActionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AddAction Instance { get; init; } - public AddActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AddActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AddAction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexAlias? AliasValue { get; set; } - private ICollection? AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private bool? MustExistValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AddActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AddAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor descriptor) => descriptor.Instance; /// /// @@ -158,10 +283,10 @@ public AddActionDescriptor() : base() /// Index alias names support date math. /// /// - public AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? alias) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? value) { - AliasValue = alias; - return Self; + Instance.Alias = value; + return this; } /// @@ -170,39 +295,44 @@ public AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexA /// Index alias names support date math. /// /// - public AddActionDescriptor Aliases(ICollection? aliases) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Aliases(System.Collections.Generic.ICollection? value) { - AliasesValue = aliases; - return Self; + Instance.Aliases = value; + return this; } /// /// - /// Query used to limit documents the alias can access. + /// Aliases for the action. + /// Index alias names support date math. /// /// - public AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexAlias[] values) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Aliases = [.. values]; + return this; } - public AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public AddActionDescriptor Filter(Action> configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -211,10 +341,10 @@ public AddActionDescriptor Filter(Action*). /// /// - public AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -224,10 +354,10 @@ public AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexN /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -236,10 +366,10 @@ public AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch /// Supports wildcards (*). /// /// - public AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -247,10 +377,10 @@ public AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indi /// If true, the alias is hidden. /// /// - public AddActionDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -258,10 +388,10 @@ public AddActionDescriptor IsHidden(bool? isHidden = true) /// If true, sets the write index or data stream for the alias. /// /// - public AddActionDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -269,10 +399,10 @@ public AddActionDescriptor IsWriteIndex(bool? isWriteIndex = true) /// If true, the alias must exist to perform the action. /// /// - public AddActionDescriptor MustExist(bool? mustExist = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor MustExist(bool? value = true) { - MustExistValue = mustExist; - return Self; + Instance.MustExist = value; + return this; } /// @@ -281,10 +411,10 @@ public AddActionDescriptor MustExist(bool? mustExist = true) /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -294,116 +424,44 @@ public AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Rout /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AddAction Build(System.Action>? action) { - writer.WriteStartObject(); - if (AliasValue is not null) - { - writer.WritePropertyName("alias"); - JsonSerializer.Serialize(writer, AliasValue, options); - } - - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - SingleOrManySerializationHelper.Serialize(AliasesValue, writer, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } - - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (MustExistValue.HasValue) - { - writer.WritePropertyName("must_exist"); - writer.WriteBooleanValue(MustExistValue.Value); - } - - if (RoutingValue is not null) + if (action is null) { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AddActionDescriptor : SerializableDescriptor +public readonly partial struct AddActionDescriptor { - internal AddActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AddAction Instance { get; init; } - public AddActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AddActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AddAction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexAlias? AliasValue { get; set; } - private ICollection? AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private bool? MustExistValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AddActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AddAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor descriptor) => descriptor.Instance; /// /// @@ -411,10 +469,22 @@ public AddActionDescriptor() : base() /// Index alias names support date math. /// /// - public AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? alias) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? value) + { + Instance.Alias = value; + return this; + } + + /// + /// + /// Aliases for the action. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Aliases(System.Collections.Generic.ICollection? value) { - AliasValue = alias; - return Self; + Instance.Aliases = value; + return this; } /// @@ -423,10 +493,10 @@ public AddActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? alias /// Index alias names support date math. /// /// - public AddActionDescriptor Aliases(ICollection? aliases) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexAlias[] values) { - AliasesValue = aliases; - return Self; + Instance.Aliases = [.. values]; + return this; } /// @@ -434,28 +504,32 @@ public AddActionDescriptor Aliases(ICollection /// - public AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public AddActionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public AddActionDescriptor Filter(Action configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -464,10 +538,10 @@ public AddActionDescriptor Filter(Action*). /// /// - public AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -477,10 +551,10 @@ public AddActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -489,10 +563,10 @@ public AddActionDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? i /// Supports wildcards (*). /// /// - public AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -500,10 +574,10 @@ public AddActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indice /// If true, the alias is hidden. /// /// - public AddActionDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -511,10 +585,10 @@ public AddActionDescriptor IsHidden(bool? isHidden = true) /// If true, sets the write index or data stream for the alias. /// /// - public AddActionDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -522,10 +596,10 @@ public AddActionDescriptor IsWriteIndex(bool? isWriteIndex = true) /// If true, the alias must exist to perform the action. /// /// - public AddActionDescriptor MustExist(bool? mustExist = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor MustExist(bool? value = true) { - MustExistValue = mustExist; - return Self; + Instance.MustExist = value; + return this; } /// @@ -534,10 +608,10 @@ public AddActionDescriptor MustExist(bool? mustExist = true) /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -547,91 +621,22 @@ public AddActionDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routin /// Data stream aliases don’t support this parameter. /// /// - public AddActionDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AddAction Build(System.Action? action) { - writer.WriteStartObject(); - if (AliasValue is not null) + if (action is null) { - writer.WritePropertyName("alias"); - JsonSerializer.Serialize(writer, AliasValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - SingleOrManySerializationHelper.Serialize(AliasesValue, writer, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } - - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (MustExistValue.HasValue) - { - writer.WritePropertyName("must_exist"); - writer.WriteBooleanValue(MustExistValue.Value); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AddAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Alias.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Alias.g.cs index a643a43f98a..504cdad4b59 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Alias.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Alias.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AliasConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIndexRouting = System.Text.Json.JsonEncodedText.Encode("index_routing"); + private static readonly System.Text.Json.JsonEncodedText PropIsHidden = System.Text.Json.JsonEncodedText.Encode("is_hidden"); + private static readonly System.Text.Json.JsonEncodedText PropIsWriteIndex = System.Text.Json.JsonEncodedText.Encode("is_write_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearchRouting = System.Text.Json.JsonEncodedText.Encode("search_routing"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Alias Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue propIndexRouting = default; + LocalJsonValue propIsHidden = default; + LocalJsonValue propIsWriteIndex = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearchRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIndexRouting.TryReadProperty(ref reader, options, PropIndexRouting, null)) + { + continue; + } + + if (propIsHidden.TryReadProperty(ref reader, options, PropIsHidden, null)) + { + continue; + } + + if (propIsWriteIndex.TryReadProperty(ref reader, options, PropIsWriteIndex, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearchRouting.TryReadProperty(ref reader, options, PropSearchRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + IndexRouting = propIndexRouting.Value, + IsHidden = propIsHidden.Value, + IsWriteIndex = propIsWriteIndex.Value, + Routing = propRouting.Value, + SearchRouting = propSearchRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Alias value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIndexRouting, value.IndexRouting, null, null); + writer.WriteProperty(options, PropIsHidden, value.IsHidden, null, null); + writer.WriteProperty(options, PropIsWriteIndex, value.IsWriteIndex, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearchRouting, value.SearchRouting, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AliasConverter))] public sealed partial class Alias { +#if NET7_0_OR_GREATER + public Alias() + { + } +#endif +#if !NET7_0_OR_GREATER + public Alias() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Query used to limit documents the alias can access. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -43,7 +139,6 @@ public sealed partial class Alias /// If specified, this overwrites the routing value for indexing operations. /// /// - [JsonInclude, JsonPropertyName("index_routing")] public Elastic.Clients.Elasticsearch.Routing? IndexRouting { get; set; } /// @@ -52,7 +147,6 @@ public sealed partial class Alias /// All indices for the alias must have the same is_hidden value. /// /// - [JsonInclude, JsonPropertyName("is_hidden")] public bool? IsHidden { get; set; } /// @@ -60,7 +154,6 @@ public sealed partial class Alias /// If true, the index is the write index for the alias. /// /// - [JsonInclude, JsonPropertyName("is_write_index")] public bool? IsWriteIndex { get; set; } /// @@ -68,7 +161,6 @@ public sealed partial class Alias /// Value used to route indexing and search operations to a specific shard. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -77,54 +169,48 @@ public sealed partial class Alias /// If specified, this overwrites the routing value for search operations. /// /// - [JsonInclude, JsonPropertyName("search_routing")] public Elastic.Clients.Elasticsearch.Routing? SearchRouting { get; set; } } -public sealed partial class AliasDescriptor : SerializableDescriptor> +public readonly partial struct AliasDescriptor { - internal AliasDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Alias Instance { get; init; } - public AliasDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Alias instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Alias instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor descriptor) => descriptor.Instance; /// /// /// Query used to limit documents the alias can access. /// /// - public AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public AliasDescriptor Filter(Action> configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -133,10 +219,10 @@ public AliasDescriptor Filter(Actionrouting value for indexing operations. /// /// - public AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -145,10 +231,10 @@ public AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Rou /// All indices for the alias must have the same is_hidden value. /// /// - public AliasDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -156,10 +242,10 @@ public AliasDescriptor IsHidden(bool? isHidden = true) /// If true, the index is the write index for the alias. /// /// - public AliasDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -167,10 +253,10 @@ public AliasDescriptor IsWriteIndex(bool? isWriteIndex = true) /// Value used to route indexing and search operations to a specific shard. /// /// - public AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -179,109 +265,76 @@ public AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? /// If specified, this overwrites the routing value for search operations. /// /// - public AliasDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Alias Build(System.Action>? action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } - - if (IsHiddenValue.HasValue) + if (action is null) { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AliasDescriptor : SerializableDescriptor +public readonly partial struct AliasDescriptor { - internal AliasDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Alias Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Alias instance) + { + Instance = instance; + } - public AliasDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Routing? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? SearchRoutingValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Alias instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor descriptor) => descriptor.Instance; /// /// /// Query used to limit documents the alias can access. /// /// - public AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public AliasDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public AliasDescriptor Filter(Action configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -290,10 +343,10 @@ public AliasDescriptor Filter(Actionrouting value for indexing operations. /// /// - public AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -302,10 +355,10 @@ public AliasDescriptor IndexRouting(Elastic.Clients.Elasticsearch.Routing? index /// All indices for the alias must have the same is_hidden value. /// /// - public AliasDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -313,10 +366,10 @@ public AliasDescriptor IsHidden(bool? isHidden = true) /// If true, the index is the write index for the alias. /// /// - public AliasDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -324,10 +377,10 @@ public AliasDescriptor IsWriteIndex(bool? isWriteIndex = true) /// Value used to route indexing and search operations to a specific shard. /// /// - public AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -336,61 +389,22 @@ public AliasDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) /// If specified, this overwrites the routing value for search operations. /// /// - public AliasDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor SearchRouting(Elastic.Clients.Elasticsearch.Routing? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Alias Build(System.Action? action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IndexRoutingValue is not null) - { - writer.WritePropertyName("index_routing"); - JsonSerializer.Serialize(writer, IndexRoutingValue, options); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) + if (action is null) { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (SearchRoutingValue is not null) - { - writer.WritePropertyName("search_routing"); - JsonSerializer.Serialize(writer, SearchRoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Alias(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs index 72c98d5beba..7494cc70f40 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AliasDefinition.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AliasDefinitionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIndexRouting = System.Text.Json.JsonEncodedText.Encode("index_routing"); + private static readonly System.Text.Json.JsonEncodedText PropIsHidden = System.Text.Json.JsonEncodedText.Encode("is_hidden"); + private static readonly System.Text.Json.JsonEncodedText PropIsWriteIndex = System.Text.Json.JsonEncodedText.Encode("is_write_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearchRouting = System.Text.Json.JsonEncodedText.Encode("search_routing"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue propIndexRouting = default; + LocalJsonValue propIsHidden = default; + LocalJsonValue propIsWriteIndex = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearchRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIndexRouting.TryReadProperty(ref reader, options, PropIndexRouting, null)) + { + continue; + } + + if (propIsHidden.TryReadProperty(ref reader, options, PropIsHidden, null)) + { + continue; + } + + if (propIsWriteIndex.TryReadProperty(ref reader, options, PropIsWriteIndex, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearchRouting.TryReadProperty(ref reader, options, PropSearchRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + IndexRouting = propIndexRouting.Value, + IsHidden = propIsHidden.Value, + IsWriteIndex = propIsWriteIndex.Value, + Routing = propRouting.Value, + SearchRouting = propSearchRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIndexRouting, value.IndexRouting, null, null); + writer.WriteProperty(options, PropIsHidden, value.IsHidden, null, null); + writer.WriteProperty(options, PropIsWriteIndex, value.IsWriteIndex, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearchRouting, value.SearchRouting, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionConverter))] public sealed partial class AliasDefinition { +#if NET7_0_OR_GREATER + public AliasDefinition() + { + } +#endif +#if !NET7_0_OR_GREATER + public AliasDefinition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Query used to limit documents the alias can access. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } /// @@ -43,7 +139,6 @@ public sealed partial class AliasDefinition /// If specified, this overwrites the routing value for indexing operations. /// /// - [JsonInclude, JsonPropertyName("index_routing")] public string? IndexRouting { get; set; } /// @@ -52,7 +147,6 @@ public sealed partial class AliasDefinition /// All indices for the alias must have the same is_hidden value. /// /// - [JsonInclude, JsonPropertyName("is_hidden")] public bool? IsHidden { get; set; } /// @@ -60,7 +154,6 @@ public sealed partial class AliasDefinition /// If true, the index is the write index for the alias. /// /// - [JsonInclude, JsonPropertyName("is_write_index")] public bool? IsWriteIndex { get; set; } /// @@ -68,7 +161,6 @@ public sealed partial class AliasDefinition /// Value used to route indexing and search operations to a specific shard. /// /// - [JsonInclude, JsonPropertyName("routing")] public string? Routing { get; set; } /// @@ -77,54 +169,48 @@ public sealed partial class AliasDefinition /// If specified, this overwrites the routing value for search operations. /// /// - [JsonInclude, JsonPropertyName("search_routing")] public string? SearchRouting { get; set; } } -public sealed partial class AliasDefinitionDescriptor : SerializableDescriptor> +public readonly partial struct AliasDefinitionDescriptor { - internal AliasDefinitionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition Instance { get; init; } - public AliasDefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDefinitionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private string? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private string? RoutingValue { get; set; } - private string? SearchRoutingValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDefinitionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// Query used to limit documents the alias can access. /// /// - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public AliasDefinitionDescriptor Filter(Action> configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -133,10 +219,10 @@ public AliasDefinitionDescriptor Filter(Actionrouting value for indexing operations. /// /// - public AliasDefinitionDescriptor IndexRouting(string? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IndexRouting(string? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -145,10 +231,10 @@ public AliasDefinitionDescriptor IndexRouting(string? indexRouting) /// All indices for the alias must have the same is_hidden value. /// /// - public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -156,10 +242,10 @@ public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) /// If true, the index is the write index for the alias. /// /// - public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -167,10 +253,10 @@ public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = tr /// Value used to route indexing and search operations to a specific shard. /// /// - public AliasDefinitionDescriptor Routing(string? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Routing(string? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -179,109 +265,76 @@ public AliasDefinitionDescriptor Routing(string? routing) /// If specified, this overwrites the routing value for search operations. /// /// - public AliasDefinitionDescriptor SearchRouting(string? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor SearchRouting(string? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition Build(System.Action>? action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(IndexRoutingValue)) - { - writer.WritePropertyName("index_routing"); - writer.WriteStringValue(IndexRoutingValue); - } - - if (IsHiddenValue.HasValue) + if (action is null) { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IsWriteIndexValue.HasValue) - { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); - } - - if (!string.IsNullOrEmpty(RoutingValue)) - { - writer.WritePropertyName("routing"); - writer.WriteStringValue(RoutingValue); - } - - if (!string.IsNullOrEmpty(SearchRoutingValue)) - { - writer.WritePropertyName("search_routing"); - writer.WriteStringValue(SearchRoutingValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AliasDefinitionDescriptor : SerializableDescriptor +public readonly partial struct AliasDefinitionDescriptor { - internal AliasDefinitionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDefinitionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition instance) + { + Instance = instance; + } - public AliasDefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AliasDefinitionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private string? IndexRoutingValue { get; set; } - private bool? IsHiddenValue { get; set; } - private bool? IsWriteIndexValue { get; set; } - private string? RoutingValue { get; set; } - private string? SearchRoutingValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition instance) => new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// Query used to limit documents the alias can access. /// /// - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public AliasDefinitionDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public AliasDefinitionDescriptor Filter(Action configure) + /// + /// + /// Query used to limit documents the alias can access. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -290,10 +343,10 @@ public AliasDefinitionDescriptor Filter(Actionrouting value for indexing operations. /// /// - public AliasDefinitionDescriptor IndexRouting(string? indexRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IndexRouting(string? value) { - IndexRoutingValue = indexRouting; - return Self; + Instance.IndexRouting = value; + return this; } /// @@ -302,10 +355,10 @@ public AliasDefinitionDescriptor IndexRouting(string? indexRouting) /// All indices for the alias must have the same is_hidden value. /// /// - public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IsHidden(bool? value = true) { - IsHiddenValue = isHidden; - return Self; + Instance.IsHidden = value; + return this; } /// @@ -313,10 +366,10 @@ public AliasDefinitionDescriptor IsHidden(bool? isHidden = true) /// If true, the index is the write index for the alias. /// /// - public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = true) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor IsWriteIndex(bool? value = true) { - IsWriteIndexValue = isWriteIndex; - return Self; + Instance.IsWriteIndex = value; + return this; } /// @@ -324,10 +377,10 @@ public AliasDefinitionDescriptor IsWriteIndex(bool? isWriteIndex = true) /// Value used to route indexing and search operations to a specific shard. /// /// - public AliasDefinitionDescriptor Routing(string? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor Routing(string? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -336,61 +389,22 @@ public AliasDefinitionDescriptor Routing(string? routing) /// If specified, this overwrites the routing value for search operations. /// /// - public AliasDefinitionDescriptor SearchRouting(string? searchRouting) + public Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor SearchRouting(string? value) { - SearchRoutingValue = searchRouting; - return Self; + Instance.SearchRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition Build(System.Action? action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(IndexRoutingValue)) - { - writer.WritePropertyName("index_routing"); - writer.WriteStringValue(IndexRoutingValue); - } - - if (IsHiddenValue.HasValue) - { - writer.WritePropertyName("is_hidden"); - writer.WriteBooleanValue(IsHiddenValue.Value); - } - - if (IsWriteIndexValue.HasValue) + if (action is null) { - writer.WritePropertyName("is_write_index"); - writer.WriteBooleanValue(IsWriteIndexValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(RoutingValue)) - { - writer.WritePropertyName("routing"); - writer.WriteStringValue(RoutingValue); - } - - if (!string.IsNullOrEmpty(SearchRoutingValue)) - { - writer.WritePropertyName("search_routing"); - writer.WriteStringValue(SearchRoutingValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinitionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.AliasDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeDetail.g.cs index 1fb99221aa0..7049d509da3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeDetail.g.cs @@ -17,26 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AnalyzeDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCharfilters = System.Text.Json.JsonEncodedText.Encode("charfilters"); + private static readonly System.Text.Json.JsonEncodedText PropCustomAnalyzer = System.Text.Json.JsonEncodedText.Encode("custom_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropTokenfilters = System.Text.Json.JsonEncodedText.Encode("tokenfilters"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue?> propCharfilters = default; + LocalJsonValue propCustomAnalyzer = default; + LocalJsonValue?> propTokenfilters = default; + LocalJsonValue propTokenizer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propCharfilters.TryReadProperty(ref reader, options, PropCharfilters, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCustomAnalyzer.TryReadProperty(ref reader, options, PropCustomAnalyzer, null)) + { + continue; + } + + if (propTokenfilters.TryReadProperty(ref reader, options, PropTokenfilters, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Charfilters = propCharfilters.Value, + CustomAnalyzer = propCustomAnalyzer.Value, + Tokenfilters = propTokenfilters.Value, + Tokenizer = propTokenizer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropCharfilters, value.Charfilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCustomAnalyzer, value.CustomAnalyzer, null, null); + writer.WriteProperty(options, PropTokenfilters, value.Tokenfilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeDetailConverter))] public sealed partial class AnalyzeDetail { - [JsonInclude, JsonPropertyName("analyzer")] - public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetail? Analyzer { get; init; } - [JsonInclude, JsonPropertyName("charfilters")] - public IReadOnlyCollection? Charfilters { get; init; } - [JsonInclude, JsonPropertyName("custom_analyzer")] - public bool CustomAnalyzer { get; init; } - [JsonInclude, JsonPropertyName("tokenfilters")] - public IReadOnlyCollection? Tokenfilters { get; init; } - [JsonInclude, JsonPropertyName("tokenizer")] - public Elastic.Clients.Elasticsearch.IndexManagement.TokenDetail? Tokenizer { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzeDetail(bool customAnalyzer) + { + CustomAnalyzer = customAnalyzer; + } +#if NET7_0_OR_GREATER + public AnalyzeDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalyzeDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyzeDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetail? Analyzer { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Charfilters { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool CustomAnalyzer { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Tokenfilters { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.TokenDetail? Tokenizer { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeToken.g.cs index 364b16cd57e..bb46ba0379c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzeToken.g.cs @@ -17,28 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AnalyzeTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEndOffset = System.Text.Json.JsonEncodedText.Encode("end_offset"); + private static readonly System.Text.Json.JsonEncodedText PropPosition = System.Text.Json.JsonEncodedText.Encode("position"); + private static readonly System.Text.Json.JsonEncodedText PropPositionLength = System.Text.Json.JsonEncodedText.Encode("positionLength"); + private static readonly System.Text.Json.JsonEncodedText PropStartOffset = System.Text.Json.JsonEncodedText.Encode("start_offset"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEndOffset = default; + LocalJsonValue propPosition = default; + LocalJsonValue propPositionLength = default; + LocalJsonValue propStartOffset = default; + LocalJsonValue propToken = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEndOffset.TryReadProperty(ref reader, options, PropEndOffset, null)) + { + continue; + } + + if (propPosition.TryReadProperty(ref reader, options, PropPosition, null)) + { + continue; + } + + if (propPositionLength.TryReadProperty(ref reader, options, PropPositionLength, null)) + { + continue; + } + + if (propStartOffset.TryReadProperty(ref reader, options, PropStartOffset, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EndOffset = propEndOffset.Value, + Position = propPosition.Value, + PositionLength = propPositionLength.Value, + StartOffset = propStartOffset.Value, + Token = propToken.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEndOffset, value.EndOffset, null, null); + writer.WriteProperty(options, PropPosition, value.Position, null, null); + writer.WriteProperty(options, PropPositionLength, value.PositionLength, null, null); + writer.WriteProperty(options, PropStartOffset, value.StartOffset, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzeTokenConverter))] public sealed partial class AnalyzeToken { - [JsonInclude, JsonPropertyName("end_offset")] - public long EndOffset { get; init; } - [JsonInclude, JsonPropertyName("position")] - public long Position { get; init; } - [JsonInclude, JsonPropertyName("positionLength")] - public long? Positionlength { get; init; } - [JsonInclude, JsonPropertyName("start_offset")] - public long StartOffset { get; init; } - [JsonInclude, JsonPropertyName("token")] - public string Token { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzeToken(long endOffset, long position, long startOffset, string token, string type) + { + EndOffset = endOffset; + Position = position; + StartOffset = startOffset; + Token = token; + Type = type; + } +#if NET7_0_OR_GREATER + public AnalyzeToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalyzeToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyzeToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long EndOffset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Position { get; set; } + public long? PositionLength { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long StartOffset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Token { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzerDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzerDetail.g.cs index 8ffc54c9817..e393b5808b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzerDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/AnalyzerDetail.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class AnalyzerDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue> propTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Tokens = propTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.AnalyzerDetailConverter))] public sealed partial class AnalyzerDetail { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("tokens")] - public IReadOnlyCollection Tokens { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyzerDetail(string name, System.Collections.Generic.IReadOnlyCollection tokens) + { + Name = name; + Tokens = tokens; + } +#if NET7_0_OR_GREATER + public AnalyzerDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalyzerDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyzerDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Tokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CacheQueries.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CacheQueries.g.cs index 0bf5a0624d5..3a2a4a7b65e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CacheQueries.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CacheQueries.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class CacheQueriesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesConverter))] public sealed partial class CacheQueries { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheQueries(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public CacheQueries() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CacheQueries() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CacheQueries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class CacheQueriesDescriptor : SerializableDescriptor +public readonly partial struct CacheQueriesDescriptor { - internal CacheQueriesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries Instance { get; init; } - public CacheQueriesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheQueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries instance) { + Instance = instance; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CacheQueriesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CacheQueriesDescriptor Enabled(bool enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CharFilterDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CharFilterDetail.g.cs index a54cc2bcde6..0b34c8ad51c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CharFilterDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CharFilterDetail.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class CharFilterDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilteredText = System.Text.Json.JsonEncodedText.Encode("filtered_text"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CharFilterDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFilteredText = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilteredText.TryReadProperty(ref reader, options, PropFilteredText, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CharFilterDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FilteredText = propFilteredText.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CharFilterDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilteredText, value.FilteredText, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CharFilterDetailConverter))] public sealed partial class CharFilterDetail { - [JsonInclude, JsonPropertyName("filtered_text")] - public IReadOnlyCollection FilteredText { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CharFilterDetail(System.Collections.Generic.IReadOnlyCollection filteredText, string name) + { + FilteredText = filteredText; + Name = name; + } +#if NET7_0_OR_GREATER + public CharFilterDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CharFilterDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CharFilterDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FilteredText { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseIndexResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseIndexResult.g.cs index f1d144d6279..8a1a81b18fb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseIndexResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseIndexResult.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class CloseIndexResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClosed = System.Text.Json.JsonEncodedText.Encode("closed"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClosed = default; + LocalJsonValue?> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClosed.TryReadProperty(ref reader, options, PropClosed, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Closed = propClosed.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClosed, value.Closed, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloseIndexResultConverter))] public sealed partial class CloseIndexResult { - [JsonInclude, JsonPropertyName("closed")] - public bool Closed { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary? Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseIndexResult(bool closed) + { + Closed = closed; + } +#if NET7_0_OR_GREATER + public CloseIndexResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CloseIndexResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseIndexResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Closed { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseShardResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseShardResult.g.cs index 88a872cd3d0..513639f9494 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseShardResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CloseShardResult.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class CloseShardResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CloseShardResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFailures = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CloseShardResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Failures = propFailures.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CloseShardResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CloseShardResultConverter))] public sealed partial class CloseShardResult { - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection Failures { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CloseShardResult(System.Collections.Generic.IReadOnlyCollection failures) + { + Failures = failures; + } +#if NET7_0_OR_GREATER + public CloseShardResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CloseShardResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CloseShardResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Failures { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CreateFrom.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CreateFrom.g.cs new file mode 100644 index 00000000000..780649d2f78 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/CreateFrom.g.cs @@ -0,0 +1,364 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class CreateFromConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMappingsOverride = System.Text.Json.JsonEncodedText.Encode("mappings_override"); + private static readonly System.Text.Json.JsonEncodedText PropRemoveIndexBlocks = System.Text.Json.JsonEncodedText.Encode("remove_index_blocks"); + private static readonly System.Text.Json.JsonEncodedText PropSettingsOverride = System.Text.Json.JsonEncodedText.Encode("settings_override"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMappingsOverride = default; + LocalJsonValue propRemoveIndexBlocks = default; + LocalJsonValue propSettingsOverride = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMappingsOverride.TryReadProperty(ref reader, options, PropMappingsOverride, null)) + { + continue; + } + + if (propRemoveIndexBlocks.TryReadProperty(ref reader, options, PropRemoveIndexBlocks, null)) + { + continue; + } + + if (propSettingsOverride.TryReadProperty(ref reader, options, PropSettingsOverride, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MappingsOverride = propMappingsOverride.Value, + RemoveIndexBlocks = propRemoveIndexBlocks.Value, + SettingsOverride = propSettingsOverride.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMappingsOverride, value.MappingsOverride, null, null); + writer.WriteProperty(options, PropRemoveIndexBlocks, value.RemoveIndexBlocks, null, null); + writer.WriteProperty(options, PropSettingsOverride, value.SettingsOverride, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromConverter))] +public sealed partial class CreateFrom +{ +#if NET7_0_OR_GREATER + public CreateFrom() + { + } +#endif +#if !NET7_0_OR_GREATER + public CreateFrom() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsOverride { get; set; } + + /// + /// + /// If index blocks should be removed when creating destination index (optional) + /// + /// + public bool? RemoveIndexBlocks { get; set; } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsOverride { get; set; } +} + +public readonly partial struct CreateFromDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.MappingsOverride = value; + return this; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride() + { + Instance.MappingsOverride = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride(System.Action>? action) + { + Instance.MappingsOverride = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// If index blocks should be removed when creating destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor RemoveIndexBlocks(bool? value = true) + { + Instance.RemoveIndexBlocks = value; + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.SettingsOverride = value; + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride() + { + Instance.SettingsOverride = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride(System.Action>? action) + { + Instance.SettingsOverride = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct CreateFromDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateFromDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom instance) => new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) + { + Instance.MappingsOverride = value; + return this; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride() + { + Instance.MappingsOverride = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride(System.Action? action) + { + Instance.MappingsOverride = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// Mappings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor MappingsOverride(System.Action>? action) + { + Instance.MappingsOverride = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; + } + + /// + /// + /// If index blocks should be removed when creating destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor RemoveIndexBlocks(bool? value = true) + { + Instance.RemoveIndexBlocks = value; + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.SettingsOverride = value; + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride() + { + Instance.SettingsOverride = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride(System.Action? action) + { + Instance.SettingsOverride = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Settings overrides to be applied to the destination index (optional) + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor SettingsOverride(System.Action>? action) + { + Instance.SettingsOverride = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.CreateFromDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.CreateFrom(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStream.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStream.g.cs index cb193e3e25b..12ca838d7ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStream.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStream.g.cs @@ -17,49 +17,264 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowCustomRouting = System.Text.Json.JsonEncodedText.Encode("allow_custom_routing"); + private static readonly System.Text.Json.JsonEncodedText PropFailureStore = System.Text.Json.JsonEncodedText.Encode("failure_store"); + private static readonly System.Text.Json.JsonEncodedText PropGeneration = System.Text.Json.JsonEncodedText.Encode("generation"); + private static readonly System.Text.Json.JsonEncodedText PropHidden = System.Text.Json.JsonEncodedText.Encode("hidden"); + private static readonly System.Text.Json.JsonEncodedText PropIlmPolicy = System.Text.Json.JsonEncodedText.Encode("ilm_policy"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropNextGenerationManagedBy = System.Text.Json.JsonEncodedText.Encode("next_generation_managed_by"); + private static readonly System.Text.Json.JsonEncodedText PropPreferIlm = System.Text.Json.JsonEncodedText.Encode("prefer_ilm"); + private static readonly System.Text.Json.JsonEncodedText PropReplicated = System.Text.Json.JsonEncodedText.Encode("replicated"); + private static readonly System.Text.Json.JsonEncodedText PropRolloverOnWrite = System.Text.Json.JsonEncodedText.Encode("rollover_on_write"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropSystem = System.Text.Json.JsonEncodedText.Encode("system"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampField = System.Text.Json.JsonEncodedText.Encode("timestamp_field"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStream Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowCustomRouting = default; + LocalJsonValue propFailureStore = default; + LocalJsonValue propGeneration = default; + LocalJsonValue propHidden = default; + LocalJsonValue propIlmPolicy = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propName = default; + LocalJsonValue propNextGenerationManagedBy = default; + LocalJsonValue propPreferIlm = default; + LocalJsonValue propReplicated = default; + LocalJsonValue propRolloverOnWrite = default; + LocalJsonValue propStatus = default; + LocalJsonValue propSystem = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propTimestampField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowCustomRouting.TryReadProperty(ref reader, options, PropAllowCustomRouting, null)) + { + continue; + } + + if (propFailureStore.TryReadProperty(ref reader, options, PropFailureStore, null)) + { + continue; + } + + if (propGeneration.TryReadProperty(ref reader, options, PropGeneration, null)) + { + continue; + } + + if (propHidden.TryReadProperty(ref reader, options, PropHidden, null)) + { + continue; + } + + if (propIlmPolicy.TryReadProperty(ref reader, options, PropIlmPolicy, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propNextGenerationManagedBy.TryReadProperty(ref reader, options, PropNextGenerationManagedBy, null)) + { + continue; + } + + if (propPreferIlm.TryReadProperty(ref reader, options, PropPreferIlm, null)) + { + continue; + } + + if (propReplicated.TryReadProperty(ref reader, options, PropReplicated, null)) + { + continue; + } + + if (propRolloverOnWrite.TryReadProperty(ref reader, options, PropRolloverOnWrite, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propSystem.TryReadProperty(ref reader, options, PropSystem, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propTimestampField.TryReadProperty(ref reader, options, PropTimestampField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStream(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowCustomRouting = propAllowCustomRouting.Value, + FailureStore = propFailureStore.Value, + Generation = propGeneration.Value, + Hidden = propHidden.Value, + IlmPolicy = propIlmPolicy.Value, + Indices = propIndices.Value, + Lifecycle = propLifecycle.Value, + Meta = propMeta.Value, + Name = propName.Value, + NextGenerationManagedBy = propNextGenerationManagedBy.Value, + PreferIlm = propPreferIlm.Value, + Replicated = propReplicated.Value, + RolloverOnWrite = propRolloverOnWrite.Value, + Status = propStatus.Value, + System = propSystem.Value, + Template = propTemplate.Value, + TimestampField = propTimestampField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStream value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowCustomRouting, value.AllowCustomRouting, null, null); + writer.WriteProperty(options, PropFailureStore, value.FailureStore, null, null); + writer.WriteProperty(options, PropGeneration, value.Generation, null, null); + writer.WriteProperty(options, PropHidden, value.Hidden, null, null); + writer.WriteProperty(options, PropIlmPolicy, value.IlmPolicy, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropNextGenerationManagedBy, value.NextGenerationManagedBy, null, null); + writer.WriteProperty(options, PropPreferIlm, value.PreferIlm, null, null); + writer.WriteProperty(options, PropReplicated, value.Replicated, null, null); + writer.WriteProperty(options, PropRolloverOnWrite, value.RolloverOnWrite, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropSystem, value.System, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropTimestampField, value.TimestampField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamConverter))] public sealed partial class DataStream { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStream(int generation, bool hidden, System.Collections.Generic.IReadOnlyCollection indices, string name, Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy nextGenerationManagedBy, bool preferIlm, bool rolloverOnWrite, Elastic.Clients.Elasticsearch.HealthStatus status, string template, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField timestampField) + { + Generation = generation; + Hidden = hidden; + Indices = indices; + Name = name; + NextGenerationManagedBy = nextGenerationManagedBy; + PreferIlm = preferIlm; + RolloverOnWrite = rolloverOnWrite; + Status = status; + Template = template; + TimestampField = timestampField; + } +#if NET7_0_OR_GREATER + public DataStream() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStream() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStream(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, the data stream allows custom routing on write request. /// /// - [JsonInclude, JsonPropertyName("allow_custom_routing")] - public bool? AllowCustomRouting { get; init; } + public bool? AllowCustomRouting { get; set; } /// /// /// Information about failure store backing indices /// /// - [JsonInclude, JsonPropertyName("failure_store")] - public Elastic.Clients.Elasticsearch.IndexManagement.FailureStore? FailureStore { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.FailureStore? FailureStore { get; set; } /// /// /// Current generation for the data stream. This number acts as a cumulative count of the stream’s rollovers, starting at 1. /// /// - [JsonInclude, JsonPropertyName("generation")] - public int Generation { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Generation { get; set; } /// /// /// If true, the data stream is hidden. /// /// - [JsonInclude, JsonPropertyName("hidden")] - public bool Hidden { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Hidden { get; set; } /// /// @@ -69,8 +284,7 @@ public sealed partial class DataStream /// NOTE: A data stream’s backing indices may be assigned different lifecycle policies. To retrieve the lifecycle policy for individual backing indices, use the get index settings API. /// /// - [JsonInclude, JsonPropertyName("ilm_policy")] - public string? IlmPolicy { get; init; } + public string? IlmPolicy { get; set; } /// /// @@ -78,16 +292,18 @@ public sealed partial class DataStream /// The last item in this array contains information about the stream’s current write index. /// /// - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } /// /// /// Contains the configuration for the data stream lifecycle of this data stream. /// /// - [JsonInclude, JsonPropertyName("lifecycle")] - public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; set; } /// /// @@ -95,48 +311,58 @@ public sealed partial class DataStream /// If empty, the response omits this property. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IReadOnlyDictionary? Meta { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } /// /// /// Name of the data stream. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// Name of the lifecycle system that'll manage the next generation of the data stream. /// /// - [JsonInclude, JsonPropertyName("next_generation_managed_by")] - public Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy NextGenerationManagedBy { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy NextGenerationManagedBy { get; set; } /// /// /// Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream. /// /// - [JsonInclude, JsonPropertyName("prefer_ilm")] - public bool PreferIlm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool PreferIlm { get; set; } /// /// /// If true, the data stream is created and managed by cross-cluster replication and the local cluster can not write into this data stream or change its mappings. /// /// - [JsonInclude, JsonPropertyName("replicated")] - public bool? Replicated { get; init; } + public bool? Replicated { get; set; } /// /// /// If true, the next write to this data stream will trigger a rollover first and the document will be indexed in the new backing index. If the rollover fails the indexing request will fail too. /// /// - [JsonInclude, JsonPropertyName("rollover_on_write")] - public bool RolloverOnWrite { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool RolloverOnWrite { get; set; } /// /// @@ -144,16 +370,18 @@ public sealed partial class DataStream /// This health status is based on the state of the primary and replica shards of the stream’s backing indices. /// /// - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } /// /// /// If true, the data stream is created and managed by an Elastic stack component and cannot be modified through normal user interaction. /// /// - [JsonInclude, JsonPropertyName("system")] - public bool? System { get; init; } + public bool? System { get; set; } /// /// @@ -161,14 +389,20 @@ public sealed partial class DataStream /// The template’s index pattern must match the name of this data stream. /// /// - [JsonInclude, JsonPropertyName("template")] - public string Template { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Template { get; set; } /// /// /// Information about the @timestamp field in the data stream. /// /// - [JsonInclude, JsonPropertyName("timestamp_field")] - public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField TimestampField { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField TimestampField { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamIndex.g.cs index 956a966132f..fadfcdfb91f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamIndex.g.cs @@ -17,55 +17,153 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIlmPolicy = System.Text.Json.JsonEncodedText.Encode("ilm_policy"); + private static readonly System.Text.Json.JsonEncodedText PropIndexName = System.Text.Json.JsonEncodedText.Encode("index_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndexUuid = System.Text.Json.JsonEncodedText.Encode("index_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropManagedBy = System.Text.Json.JsonEncodedText.Encode("managed_by"); + private static readonly System.Text.Json.JsonEncodedText PropPreferIlm = System.Text.Json.JsonEncodedText.Encode("prefer_ilm"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIlmPolicy = default; + LocalJsonValue propIndexName = default; + LocalJsonValue propIndexUuid = default; + LocalJsonValue propManagedBy = default; + LocalJsonValue propPreferIlm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIlmPolicy.TryReadProperty(ref reader, options, PropIlmPolicy, null)) + { + continue; + } + + if (propIndexName.TryReadProperty(ref reader, options, PropIndexName, null)) + { + continue; + } + + if (propIndexUuid.TryReadProperty(ref reader, options, PropIndexUuid, null)) + { + continue; + } + + if (propManagedBy.TryReadProperty(ref reader, options, PropManagedBy, null)) + { + continue; + } + + if (propPreferIlm.TryReadProperty(ref reader, options, PropPreferIlm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IlmPolicy = propIlmPolicy.Value, + IndexName = propIndexName.Value, + IndexUuid = propIndexUuid.Value, + ManagedBy = propManagedBy.Value, + PreferIlm = propPreferIlm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIlmPolicy, value.IlmPolicy, null, null); + writer.WriteProperty(options, PropIndexName, value.IndexName, null, null); + writer.WriteProperty(options, PropIndexUuid, value.IndexUuid, null, null); + writer.WriteProperty(options, PropManagedBy, value.ManagedBy, null, null); + writer.WriteProperty(options, PropPreferIlm, value.PreferIlm, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamIndexConverter))] public sealed partial class DataStreamIndex { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamIndex(string indexName, string indexUuid) + { + IndexName = indexName; + IndexUuid = indexUuid; + } +#if NET7_0_OR_GREATER + public DataStreamIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the current ILM lifecycle policy configured for this backing index. /// /// - [JsonInclude, JsonPropertyName("ilm_policy")] - public string? IlmPolicy { get; init; } + public string? IlmPolicy { get; set; } /// /// /// Name of the backing index. /// /// - [JsonInclude, JsonPropertyName("index_name")] - public string IndexName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexName { get; set; } /// /// /// Universally unique identifier (UUID) for the index. /// /// - [JsonInclude, JsonPropertyName("index_uuid")] - public string IndexUuid { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexUuid { get; set; } /// /// /// Name of the lifecycle system that's currently managing this backing index. /// /// - [JsonInclude, JsonPropertyName("managed_by")] - public Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy? ManagedBy { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.ManagedBy? ManagedBy { get; set; } /// /// /// Indicates if ILM should take precedence over DSL in case both are configured to manage this index. /// /// - [JsonInclude, JsonPropertyName("prefer_ilm")] - public bool? PreferIlm { get; init; } + public bool? PreferIlm { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycle.g.cs index bde86c5aa76..f4c1f42298e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycle.g.cs @@ -17,27 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamLifecycleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataRetention = System.Text.Json.JsonEncodedText.Encode("data_retention"); + private static readonly System.Text.Json.JsonEncodedText PropDownsampling = System.Text.Json.JsonEncodedText.Encode("downsampling"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataRetention = default; + LocalJsonValue propDownsampling = default; + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataRetention.TryReadProperty(ref reader, options, PropDataRetention, null)) + { + continue; + } + + if (propDownsampling.TryReadProperty(ref reader, options, PropDownsampling, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataRetention = propDataRetention.Value, + Downsampling = propDownsampling.Value, + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataRetention, value.DataRetention, null, null); + writer.WriteProperty(options, PropDownsampling, value.Downsampling, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Data stream lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleConverter))] public sealed partial class DataStreamLifecycle { - [JsonInclude, JsonPropertyName("data_retention")] +#if NET7_0_OR_GREATER + public DataStreamLifecycle() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataStreamLifecycle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// If defined, every document added to this data stream will be stored at least for this time frame. + /// Any time after this duration the document could be deleted. + /// When empty, every document in this data stream will be stored indefinitely. + /// + /// public Elastic.Clients.Elasticsearch.Duration? DataRetention { get; set; } - [JsonInclude, JsonPropertyName("downsampling")] + + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? Downsampling { get; set; } + + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public bool? Enabled { get; set; } } /// @@ -45,74 +134,82 @@ public sealed partial class DataStreamLifecycle /// Data stream lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration. /// /// -public sealed partial class DataStreamLifecycleDescriptor : SerializableDescriptor +public readonly partial struct DataStreamLifecycleDescriptor { - internal DataStreamLifecycleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle Instance { get; init; } - public DataStreamLifecycleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? DataRetentionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? DownsamplingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor DownsamplingDescriptor { get; set; } - private Action DownsamplingDescriptorAction { get; set; } - - public DataStreamLifecycleDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? dataRetention) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDescriptor() { - DataRetentionValue = dataRetention; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataStreamLifecycleDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? downsampling) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// If defined, every document added to this data stream will be stored at least for this time frame. + /// Any time after this duration the document could be deleted. + /// When empty, every document in this data stream will be stored indefinitely. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? value) { - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = null; - DownsamplingValue = downsampling; - return Self; + Instance.DataRetention = value; + return this; } - public DataStreamLifecycleDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor descriptor) + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? value) { - DownsamplingValue = null; - DownsamplingDescriptorAction = null; - DownsamplingDescriptor = descriptor; - return Self; + Instance.Downsampling = value; + return this; } - public DataStreamLifecycleDescriptor Downsampling(Action configure) + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor Downsampling(System.Action action) { - DownsamplingValue = null; - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = configure; - return Self; + Instance.Downsampling = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor Enabled(bool? value = true) { - writer.WriteStartObject(); - if (DataRetentionValue is not null) - { - writer.WritePropertyName("data_retention"); - JsonSerializer.Serialize(writer, DataRetentionValue, options); - } + Instance.Enabled = value; + return this; + } - if (DownsamplingDescriptor is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingDescriptor, options); - } - else if (DownsamplingDescriptorAction is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(DownsamplingDescriptorAction), options); - } - else if (DownsamplingValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleDownsampling.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleDownsampling.g.cs index 30cbf55d219..7691490eab3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleDownsampling.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleDownsampling.g.cs @@ -17,115 +17,151 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamLifecycleDownsamplingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRounds = System.Text.Json.JsonEncodedText.Encode("rounds"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRounds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRounds.TryReadProperty(ref reader, options, PropRounds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Rounds = propRounds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRounds, value.Rounds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingConverter))] public sealed partial class DataStreamLifecycleDownsampling { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDownsampling(System.Collections.Generic.ICollection rounds) + { + Rounds = rounds; + } +#if NET7_0_OR_GREATER + public DataStreamLifecycleDownsampling() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamLifecycleDownsampling() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleDownsampling(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The list of downsampling rounds to execute as part of this downsampling configuration /// /// - [JsonInclude, JsonPropertyName("rounds")] - public ICollection Rounds { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Rounds { get; set; } } -public sealed partial class DataStreamLifecycleDownsamplingDescriptor : SerializableDescriptor +public readonly partial struct DataStreamLifecycleDownsamplingDescriptor { - internal DataStreamLifecycleDownsamplingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling Instance { get; init; } - public DataStreamLifecycleDownsamplingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDownsamplingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling instance) { + Instance = instance; } - private ICollection RoundsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor RoundsDescriptor { get; set; } - private Action RoundsDescriptorAction { get; set; } - private Action[] RoundsDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleDownsamplingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor descriptor) => descriptor.Instance; /// /// /// The list of downsampling rounds to execute as part of this downsampling configuration /// /// - public DataStreamLifecycleDownsamplingDescriptor Rounds(ICollection rounds) - { - RoundsDescriptor = null; - RoundsDescriptorAction = null; - RoundsDescriptorActions = null; - RoundsValue = rounds; - return Self; - } - - public DataStreamLifecycleDownsamplingDescriptor Rounds(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor descriptor) - { - RoundsValue = null; - RoundsDescriptorAction = null; - RoundsDescriptorActions = null; - RoundsDescriptor = descriptor; - return Self; - } - - public DataStreamLifecycleDownsamplingDescriptor Rounds(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor Rounds(System.Collections.Generic.ICollection value) { - RoundsValue = null; - RoundsDescriptor = null; - RoundsDescriptorActions = null; - RoundsDescriptorAction = configure; - return Self; + Instance.Rounds = value; + return this; } - public DataStreamLifecycleDownsamplingDescriptor Rounds(params Action[] configure) + /// + /// + /// The list of downsampling rounds to execute as part of this downsampling configuration + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor Rounds(params Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound[] values) { - RoundsValue = null; - RoundsDescriptor = null; - RoundsDescriptorAction = null; - RoundsDescriptorActions = configure; - return Self; + Instance.Rounds = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The list of downsampling rounds to execute as part of this downsampling configuration + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor Rounds(params System.Action[] actions) { - writer.WriteStartObject(); - if (RoundsDescriptor is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("rounds"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RoundsDescriptor, options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor.Build(action)); } - else if (RoundsDescriptorAction is not null) - { - writer.WritePropertyName("rounds"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor(RoundsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RoundsDescriptorActions is not null) - { - writer.WritePropertyName("rounds"); - writer.WriteStartArray(); - foreach (var action in RoundsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("rounds"); - JsonSerializer.Serialize(writer, RoundsValue, options); - } + Instance.Rounds = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleExplain.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleExplain.g.cs index 588beec7ffd..6a12be7ef9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleExplain.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleExplain.g.cs @@ -17,34 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamLifecycleExplainConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropGenerationTime = System.Text.Json.JsonEncodedText.Encode("generation_time"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCreationDateMillis = System.Text.Json.JsonEncodedText.Encode("index_creation_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropManagedByLifecycle = System.Text.Json.JsonEncodedText.Encode("managed_by_lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropRolloverDateMillis = System.Text.Json.JsonEncodedText.Encode("rollover_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSinceIndexCreation = System.Text.Json.JsonEncodedText.Encode("time_since_index_creation"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSinceRollover = System.Text.Json.JsonEncodedText.Encode("time_since_rollover"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleExplain Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propGenerationTime = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexCreationDateMillis = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propManagedByLifecycle = default; + LocalJsonValue propRolloverDateMillis = default; + LocalJsonValue propTimeSinceIndexCreation = default; + LocalJsonValue propTimeSinceRollover = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propGenerationTime.TryReadProperty(ref reader, options, PropGenerationTime, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexCreationDateMillis.TryReadProperty(ref reader, options, PropIndexCreationDateMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propManagedByLifecycle.TryReadProperty(ref reader, options, PropManagedByLifecycle, null)) + { + continue; + } + + if (propRolloverDateMillis.TryReadProperty(ref reader, options, PropRolloverDateMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimeSinceIndexCreation.TryReadProperty(ref reader, options, PropTimeSinceIndexCreation, null)) + { + continue; + } + + if (propTimeSinceRollover.TryReadProperty(ref reader, options, PropTimeSinceRollover, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleExplain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + GenerationTime = propGenerationTime.Value, + Index = propIndex.Value, + IndexCreationDateMillis = propIndexCreationDateMillis.Value, + Lifecycle = propLifecycle.Value, + ManagedByLifecycle = propManagedByLifecycle.Value, + RolloverDateMillis = propRolloverDateMillis.Value, + TimeSinceIndexCreation = propTimeSinceIndexCreation.Value, + TimeSinceRollover = propTimeSinceRollover.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleExplain value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropGenerationTime, value.GenerationTime, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexCreationDateMillis, value.IndexCreationDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropManagedByLifecycle, value.ManagedByLifecycle, null, null); + writer.WriteProperty(options, PropRolloverDateMillis, value.RolloverDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimeSinceIndexCreation, value.TimeSinceIndexCreation, null, null); + writer.WriteProperty(options, PropTimeSinceRollover, value.TimeSinceRollover, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleExplainConverter))] public sealed partial class DataStreamLifecycleExplain { - [JsonInclude, JsonPropertyName("error")] - public string? Error { get; init; } - [JsonInclude, JsonPropertyName("generation_time")] - public Elastic.Clients.Elasticsearch.Duration? GenerationTime { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("index_creation_date_millis")] - public long? IndexCreationDateMillis { get; init; } - [JsonInclude, JsonPropertyName("lifecycle")] - public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; init; } - [JsonInclude, JsonPropertyName("managed_by_lifecycle")] - public bool ManagedByLifecycle { get; init; } - [JsonInclude, JsonPropertyName("rollover_date_millis")] - public long? RolloverDateMillis { get; init; } - [JsonInclude, JsonPropertyName("time_since_index_creation")] - public Elastic.Clients.Elasticsearch.Duration? TimeSinceIndexCreation { get; init; } - [JsonInclude, JsonPropertyName("time_since_rollover")] - public Elastic.Clients.Elasticsearch.Duration? TimeSinceRollover { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleExplain(string index, bool managedByLifecycle) + { + Index = index; + ManagedByLifecycle = managedByLifecycle; + } +#if NET7_0_OR_GREATER + public DataStreamLifecycleExplain() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamLifecycleExplain() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleExplain(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Error { get; set; } + public Elastic.Clients.Elasticsearch.Duration? GenerationTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public System.DateTimeOffset? IndexCreationDateMillis { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ManagedByLifecycle { get; set; } + public System.DateTimeOffset? RolloverDateMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TimeSinceIndexCreation { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TimeSinceRollover { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleRolloverConditions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleRolloverConditions.g.cs index 8b858e71b2a..fb3277e1680 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleRolloverConditions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleRolloverConditions.g.cs @@ -17,182 +17,276 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamLifecycleRolloverConditionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAge = System.Text.Json.JsonEncodedText.Encode("max_age"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSize = System.Text.Json.JsonEncodedText.Encode("max_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinAge = System.Text.Json.JsonEncodedText.Encode("min_age"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocs = System.Text.Json.JsonEncodedText.Encode("min_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinSize = System.Text.Json.JsonEncodedText.Encode("min_size"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAge = default; + LocalJsonValue propMaxDocs = default; + LocalJsonValue propMaxPrimaryShardDocs = default; + LocalJsonValue propMaxPrimaryShardSize = default; + LocalJsonValue propMaxSize = default; + LocalJsonValue propMinAge = default; + LocalJsonValue propMinDocs = default; + LocalJsonValue propMinPrimaryShardDocs = default; + LocalJsonValue propMinPrimaryShardSize = default; + LocalJsonValue propMinSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAge.TryReadProperty(ref reader, options, PropMaxAge, null)) + { + continue; + } + + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardDocs.TryReadProperty(ref reader, options, PropMaxPrimaryShardDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardSize.TryReadProperty(ref reader, options, PropMaxPrimaryShardSize, null)) + { + continue; + } + + if (propMaxSize.TryReadProperty(ref reader, options, PropMaxSize, null)) + { + continue; + } + + if (propMinAge.TryReadProperty(ref reader, options, PropMinAge, null)) + { + continue; + } + + if (propMinDocs.TryReadProperty(ref reader, options, PropMinDocs, null)) + { + continue; + } + + if (propMinPrimaryShardDocs.TryReadProperty(ref reader, options, PropMinPrimaryShardDocs, null)) + { + continue; + } + + if (propMinPrimaryShardSize.TryReadProperty(ref reader, options, PropMinPrimaryShardSize, null)) + { + continue; + } + + if (propMinSize.TryReadProperty(ref reader, options, PropMinSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAge = propMaxAge.Value, + MaxDocs = propMaxDocs.Value, + MaxPrimaryShardDocs = propMaxPrimaryShardDocs.Value, + MaxPrimaryShardSize = propMaxPrimaryShardSize.Value, + MaxSize = propMaxSize.Value, + MinAge = propMinAge.Value, + MinDocs = propMinDocs.Value, + MinPrimaryShardDocs = propMinPrimaryShardDocs.Value, + MinPrimaryShardSize = propMinPrimaryShardSize.Value, + MinSize = propMinSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAge, value.MaxAge, null, null); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardDocs, value.MaxPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardSize, value.MaxPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMaxSize, value.MaxSize, null, null); + writer.WriteProperty(options, PropMinAge, value.MinAge, null, null); + writer.WriteProperty(options, PropMinDocs, value.MinDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardDocs, value.MinPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardSize, value.MinPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMinSize, value.MinSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsConverter))] public sealed partial class DataStreamLifecycleRolloverConditions { - [JsonInclude, JsonPropertyName("max_age")] +#if NET7_0_OR_GREATER + public DataStreamLifecycleRolloverConditions() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataStreamLifecycleRolloverConditions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? MaxAge { get; set; } - [JsonInclude, JsonPropertyName("max_docs")] public long? MaxDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_docs")] public long? MaxPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("max_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxSize { get; set; } - [JsonInclude, JsonPropertyName("min_age")] public Elastic.Clients.Elasticsearch.Duration? MinAge { get; set; } - [JsonInclude, JsonPropertyName("min_docs")] public long? MinDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_docs")] public long? MinPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("min_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinSize { get; set; } } -public sealed partial class DataStreamLifecycleRolloverConditionsDescriptor : SerializableDescriptor +public readonly partial struct DataStreamLifecycleRolloverConditionsDescriptor { - internal DataStreamLifecycleRolloverConditionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions Instance { get; init; } - public DataStreamLifecycleRolloverConditionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleRolloverConditionsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions instance) { + Instance = instance; } - private string? MaxAgeValue { get; set; } - private long? MaxDocsValue { get; set; } - private long? MaxPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MinAgeValue { get; set; } - private long? MinDocsValue { get; set; } - private long? MinPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinSizeValue { get; set; } - - public DataStreamLifecycleRolloverConditionsDescriptor MaxAge(string? maxAge) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleRolloverConditionsDescriptor() { - MaxAgeValue = maxAge; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataStreamLifecycleRolloverConditionsDescriptor MaxDocs(long? maxDocs) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxAge(string? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxAge = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MaxPrimaryShardDocs(long? maxPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxDocs(long? value) { - MaxPrimaryShardDocsValue = maxPrimaryShardDocs; - return Self; + Instance.MaxDocs = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? maxPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxPrimaryShardDocs(long? value) { - MaxPrimaryShardSizeValue = maxPrimaryShardSize; - return Self; + Instance.MaxPrimaryShardDocs = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? maxSize) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxSizeValue = maxSize; - return Self; + Instance.MaxPrimaryShardSize = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? minAge) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxPrimaryShardSize(System.Func action) { - MinAgeValue = minAge; - return Self; + Instance.MaxPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MinDocs(long? minDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MinDocsValue = minDocs; - return Self; + Instance.MaxSize = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MinPrimaryShardDocs(long? minPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MaxSize(System.Func action) { - MinPrimaryShardDocsValue = minPrimaryShardDocs; - return Self; + Instance.MaxSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? minPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? value) { - MinPrimaryShardSizeValue = minPrimaryShardSize; - return Self; + Instance.MinAge = value; + return this; } - public DataStreamLifecycleRolloverConditionsDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? minSize) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinDocs(long? value) { - MinSizeValue = minSize; - return Self; + Instance.MinDocs = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinPrimaryShardDocs(long? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(MaxAgeValue)) - { - writer.WritePropertyName("max_age"); - writer.WriteStringValue(MaxAgeValue); - } - - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } - - if (MaxPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("max_primary_shard_docs"); - writer.WriteNumberValue(MaxPrimaryShardDocsValue.Value); - } - - if (MaxPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("max_primary_shard_size"); - JsonSerializer.Serialize(writer, MaxPrimaryShardSizeValue, options); - } - - if (MaxSizeValue is not null) - { - writer.WritePropertyName("max_size"); - JsonSerializer.Serialize(writer, MaxSizeValue, options); - } + Instance.MinPrimaryShardDocs = value; + return this; + } - if (MinAgeValue is not null) - { - writer.WritePropertyName("min_age"); - JsonSerializer.Serialize(writer, MinAgeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MinPrimaryShardSize = value; + return this; + } - if (MinDocsValue.HasValue) - { - writer.WritePropertyName("min_docs"); - writer.WriteNumberValue(MinDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinPrimaryShardSize(System.Func action) + { + Instance.MinPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("min_primary_shard_docs"); - writer.WriteNumberValue(MinPrimaryShardDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MinSize = value; + return this; + } - if (MinPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("min_primary_shard_size"); - JsonSerializer.Serialize(writer, MinPrimaryShardSizeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor MinSize(System.Func action) + { + Instance.MinSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinSizeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("min_size"); - JsonSerializer.Serialize(writer, MinSizeValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleWithRollover.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleWithRollover.g.cs index faa19347cfc..88201c7df55 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleWithRollover.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamLifecycleWithRollover.g.cs @@ -17,24 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamLifecycleWithRolloverConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataRetention = System.Text.Json.JsonEncodedText.Encode("data_retention"); + private static readonly System.Text.Json.JsonEncodedText PropDownsampling = System.Text.Json.JsonEncodedText.Encode("downsampling"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropRollover = System.Text.Json.JsonEncodedText.Encode("rollover"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataRetention = default; + LocalJsonValue propDownsampling = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propRollover = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataRetention.TryReadProperty(ref reader, options, PropDataRetention, null)) + { + continue; + } + + if (propDownsampling.TryReadProperty(ref reader, options, PropDownsampling, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propRollover.TryReadProperty(ref reader, options, PropRollover, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataRetention = propDataRetention.Value, + Downsampling = propDownsampling.Value, + Enabled = propEnabled.Value, + Rollover = propRollover.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataRetention, value.DataRetention, null, null); + writer.WriteProperty(options, PropDownsampling, value.Downsampling, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropRollover, value.Rollover, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Data stream lifecycle with rollover can be used to display the configuration including the default rollover conditions, /// if asked. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverConverter))] public sealed partial class DataStreamLifecycleWithRollover { +#if NET7_0_OR_GREATER + public DataStreamLifecycleWithRollover() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataStreamLifecycleWithRollover() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If defined, every document added to this data stream will be stored at least for this time frame. @@ -42,7 +121,6 @@ public sealed partial class DataStreamLifecycleWithRollover /// When empty, every document in this data stream will be stored indefinitely. /// /// - [JsonInclude, JsonPropertyName("data_retention")] public Elastic.Clients.Elasticsearch.Duration? DataRetention { get; set; } /// @@ -50,9 +128,16 @@ public sealed partial class DataStreamLifecycleWithRollover /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - [JsonInclude, JsonPropertyName("downsampling")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? Downsampling { get; set; } + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public bool? Enabled { get; set; } + /// /// /// The conditions which will trigger the rollover of a backing index as configured by the cluster setting cluster.lifecycle.default.rollover. @@ -60,7 +145,6 @@ public sealed partial class DataStreamLifecycleWithRollover /// The contents of this field are subject to change. /// /// - [JsonInclude, JsonPropertyName("rollover")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions? Rollover { get; set; } } @@ -70,21 +154,24 @@ public sealed partial class DataStreamLifecycleWithRollover /// if asked. /// /// -public sealed partial class DataStreamLifecycleWithRolloverDescriptor : SerializableDescriptor +public readonly partial struct DataStreamLifecycleWithRolloverDescriptor { - internal DataStreamLifecycleWithRolloverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover Instance { get; init; } - public DataStreamLifecycleWithRolloverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleWithRolloverDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? DataRetentionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? DownsamplingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor DownsamplingDescriptor { get; set; } - private Action DownsamplingDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions? RolloverValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor RolloverDescriptor { get; set; } - private Action RolloverDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamLifecycleWithRolloverDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor descriptor) => descriptor.Instance; /// /// @@ -93,10 +180,10 @@ public DataStreamLifecycleWithRolloverDescriptor() : base() /// When empty, every document in this data stream will be stored indefinitely. /// /// - public DataStreamLifecycleWithRolloverDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? dataRetention) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor DataRetention(Elastic.Clients.Elasticsearch.Duration? value) { - DataRetentionValue = dataRetention; - return Self; + Instance.DataRetention = value; + return this; } /// @@ -104,28 +191,33 @@ public DataStreamLifecycleWithRolloverDescriptor DataRetention(Elastic.Clients.E /// The downsampling configuration to execute for the managed backing index after rollover. /// /// - public DataStreamLifecycleWithRolloverDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? downsampling) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsampling? value) { - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = null; - DownsamplingValue = downsampling; - return Self; + Instance.Downsampling = value; + return this; } - public DataStreamLifecycleWithRolloverDescriptor Downsampling(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor descriptor) + /// + /// + /// The downsampling configuration to execute for the managed backing index after rollover. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Downsampling(System.Action action) { - DownsamplingValue = null; - DownsamplingDescriptorAction = null; - DownsamplingDescriptor = descriptor; - return Self; + Instance.Downsampling = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor.Build(action); + return this; } - public DataStreamLifecycleWithRolloverDescriptor Downsampling(Action configure) + /// + /// + /// If defined, it turns data stream lifecycle on/off (true/false) for this data stream. A data stream lifecycle + /// that's disabled (enabled: false) will have no effect on the data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Enabled(bool? value = true) { - DownsamplingValue = null; - DownsamplingDescriptor = null; - DownsamplingDescriptorAction = configure; - return Self; + Instance.Enabled = value; + return this; } /// @@ -135,71 +227,48 @@ public DataStreamLifecycleWithRolloverDescriptor Downsampling(Action /// - public DataStreamLifecycleWithRolloverDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions? rollover) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditions? value) { - RolloverDescriptor = null; - RolloverDescriptorAction = null; - RolloverValue = rollover; - return Self; + Instance.Rollover = value; + return this; } - public DataStreamLifecycleWithRolloverDescriptor Rollover(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor descriptor) + /// + /// + /// The conditions which will trigger the rollover of a backing index as configured by the cluster setting cluster.lifecycle.default.rollover. + /// This property is an implementation detail and it will only be retrieved when the query param include_defaults is set to true. + /// The contents of this field are subject to change. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Rollover() { - RolloverValue = null; - RolloverDescriptorAction = null; - RolloverDescriptor = descriptor; - return Self; + Instance.Rollover = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor.Build(null); + return this; } - public DataStreamLifecycleWithRolloverDescriptor Rollover(Action configure) + /// + /// + /// The conditions which will trigger the rollover of a backing index as configured by the cluster setting cluster.lifecycle.default.rollover. + /// This property is an implementation detail and it will only be retrieved when the query param include_defaults is set to true. + /// The contents of this field are subject to change. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor Rollover(System.Action? action) { - RolloverValue = null; - RolloverDescriptor = null; - RolloverDescriptorAction = configure; - return Self; + Instance.Rollover = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover Build(System.Action? action) { - writer.WriteStartObject(); - if (DataRetentionValue is not null) + if (action is null) { - writer.WritePropertyName("data_retention"); - JsonSerializer.Serialize(writer, DataRetentionValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DownsamplingDescriptor is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingDescriptor, options); - } - else if (DownsamplingDescriptorAction is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDownsamplingDescriptor(DownsamplingDescriptorAction), options); - } - else if (DownsamplingValue is not null) - { - writer.WritePropertyName("downsampling"); - JsonSerializer.Serialize(writer, DownsamplingValue, options); - } - - if (RolloverDescriptor is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, RolloverDescriptor, options); - } - else if (RolloverDescriptorAction is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleRolloverConditionsDescriptor(RolloverDescriptorAction), options); - } - else if (RolloverValue is not null) - { - writer.WritePropertyName("rollover"); - JsonSerializer.Serialize(writer, RolloverValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamStats.g.cs index a814c24f3cd..5042ab99fee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamStats.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackingIndicesInError = System.Text.Json.JsonEncodedText.Encode("backing_indices_in_error"); + private static readonly System.Text.Json.JsonEncodedText PropBackingIndicesInTotal = System.Text.Json.JsonEncodedText.Encode("backing_indices_in_total"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackingIndicesInError = default; + LocalJsonValue propBackingIndicesInTotal = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackingIndicesInError.TryReadProperty(ref reader, options, PropBackingIndicesInError, null)) + { + continue; + } + + if (propBackingIndicesInTotal.TryReadProperty(ref reader, options, PropBackingIndicesInTotal, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackingIndicesInError = propBackingIndicesInError.Value, + BackingIndicesInTotal = propBackingIndicesInTotal.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackingIndicesInError, value.BackingIndicesInError, null, null); + writer.WriteProperty(options, PropBackingIndicesInTotal, value.BackingIndicesInTotal, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamStatsConverter))] public sealed partial class DataStreamStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamStats(int backingIndicesInError, int backingIndicesInTotal, string name) + { + BackingIndicesInError = backingIndicesInError; + BackingIndicesInTotal = backingIndicesInTotal; + Name = name; + } +#if NET7_0_OR_GREATER + public DataStreamStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The count of the backing indices for the data stream. /// /// - [JsonInclude, JsonPropertyName("backing_indices_in_error")] - public int BackingIndicesInError { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int BackingIndicesInError { get; set; } /// /// /// The count of the backing indices for the data stream that have encountered an error. /// /// - [JsonInclude, JsonPropertyName("backing_indices_in_total")] - public int BackingIndicesInTotal { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int BackingIndicesInTotal { get; set; } /// /// /// The name of the data stream. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamTimestampField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamTimestampField.g.cs index 4cdb9fd1daa..1537e6596de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamTimestampField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamTimestampField.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamTimestampFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamTimestampFieldConverter))] public sealed partial class DataStreamTimestampField { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamTimestampField(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public DataStreamTimestampField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamTimestampField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamTimestampField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the timestamp field for the data stream, which must be @timestamp. The @timestamp field must be included in every document indexed to the data stream. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamVisibility.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamVisibility.g.cs index 3fd9f9b693d..c2c318f416c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamVisibility.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamVisibility.g.cs @@ -17,62 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamVisibilityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowCustomRouting = System.Text.Json.JsonEncodedText.Encode("allow_custom_routing"); + private static readonly System.Text.Json.JsonEncodedText PropHidden = System.Text.Json.JsonEncodedText.Encode("hidden"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowCustomRouting = default; + LocalJsonValue propHidden = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowCustomRouting.TryReadProperty(ref reader, options, PropAllowCustomRouting, null)) + { + continue; + } + + if (propHidden.TryReadProperty(ref reader, options, PropHidden, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowCustomRouting = propAllowCustomRouting.Value, + Hidden = propHidden.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowCustomRouting, value.AllowCustomRouting, null, null); + writer.WriteProperty(options, PropHidden, value.Hidden, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityConverter))] public sealed partial class DataStreamVisibility { - [JsonInclude, JsonPropertyName("allow_custom_routing")] +#if NET7_0_OR_GREATER + public DataStreamVisibility() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataStreamVisibility() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamVisibility(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? AllowCustomRouting { get; set; } - [JsonInclude, JsonPropertyName("hidden")] public bool? Hidden { get; set; } } -public sealed partial class DataStreamVisibilityDescriptor : SerializableDescriptor +public readonly partial struct DataStreamVisibilityDescriptor { - internal DataStreamVisibilityDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility Instance { get; init; } - public DataStreamVisibilityDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamVisibilityDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility instance) { + Instance = instance; } - private bool? AllowCustomRoutingValue { get; set; } - private bool? HiddenValue { get; set; } - - public DataStreamVisibilityDescriptor AllowCustomRouting(bool? allowCustomRouting = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamVisibilityDescriptor() { - AllowCustomRoutingValue = allowCustomRouting; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataStreamVisibilityDescriptor Hidden(bool? hidden = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor AllowCustomRouting(bool? value = true) { - HiddenValue = hidden; - return Self; + Instance.AllowCustomRouting = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor Hidden(bool? value = true) { - writer.WriteStartObject(); - if (AllowCustomRoutingValue.HasValue) - { - writer.WritePropertyName("allow_custom_routing"); - writer.WriteBooleanValue(AllowCustomRoutingValue.Value); - } + Instance.Hidden = value; + return this; + } - if (HiddenValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("hidden"); - writer.WriteBooleanValue(HiddenValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibilityDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamVisibility(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamWithLifecycle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamWithLifecycle.g.cs index f1f55abf69b..4a83c6d7efd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamWithLifecycle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamWithLifecycle.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamWithLifecycleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamWithLifecycle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLifecycle = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamWithLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lifecycle = propLifecycle.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamWithLifecycle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamWithLifecycleConverter))] public sealed partial class DataStreamWithLifecycle { - [JsonInclude, JsonPropertyName("lifecycle")] - public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? Lifecycle { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamWithLifecycle(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public DataStreamWithLifecycle() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamWithLifecycle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamWithLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamsStatsItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamsStatsItem.g.cs index 5b8640e9fb8..15b7ccf154e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamsStatsItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DataStreamsStatsItem.g.cs @@ -17,33 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DataStreamsStatsItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackingIndices = System.Text.Json.JsonEncodedText.Encode("backing_indices"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropMaximumTimestamp = System.Text.Json.JsonEncodedText.Encode("maximum_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropStoreSize = System.Text.Json.JsonEncodedText.Encode("store_size"); + private static readonly System.Text.Json.JsonEncodedText PropStoreSizeBytes = System.Text.Json.JsonEncodedText.Encode("store_size_bytes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBackingIndices = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propMaximumTimestamp = default; + LocalJsonValue propStoreSize = default; + LocalJsonValue propStoreSizeBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackingIndices.TryReadProperty(ref reader, options, PropBackingIndices, null)) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propMaximumTimestamp.TryReadProperty(ref reader, options, PropMaximumTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStoreSize.TryReadProperty(ref reader, options, PropStoreSize, null)) + { + continue; + } + + if (propStoreSizeBytes.TryReadProperty(ref reader, options, PropStoreSizeBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackingIndices = propBackingIndices.Value, + DataStream = propDataStream.Value, + MaximumTimestamp = propMaximumTimestamp.Value, + StoreSize = propStoreSize.Value, + StoreSizeBytes = propStoreSizeBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackingIndices, value.BackingIndices, null, null); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropMaximumTimestamp, value.MaximumTimestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStoreSize, value.StoreSize, null, null); + writer.WriteProperty(options, PropStoreSizeBytes, value.StoreSizeBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamsStatsItemConverter))] public sealed partial class DataStreamsStatsItem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamsStatsItem(int backingIndices, string dataStream, System.DateTimeOffset maximumTimestamp, long storeSizeBytes) + { + BackingIndices = backingIndices; + DataStream = dataStream; + MaximumTimestamp = maximumTimestamp; + StoreSizeBytes = storeSizeBytes; + } +#if NET7_0_OR_GREATER + public DataStreamsStatsItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamsStatsItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamsStatsItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Current number of backing indices for the data stream. /// /// - [JsonInclude, JsonPropertyName("backing_indices")] - public int BackingIndices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int BackingIndices { get; set; } /// /// /// Name of the data stream. /// /// - [JsonInclude, JsonPropertyName("data_stream")] - public string DataStream { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string DataStream { get; set; } /// /// @@ -54,8 +157,11 @@ public sealed partial class DataStreamsStatsItem /// Backing indices with a lower generation contain higher @timestamp values. /// /// - [JsonInclude, JsonPropertyName("maximum_timestamp")] - public long MaximumTimestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset MaximumTimestamp { get; set; } /// /// @@ -63,14 +169,16 @@ public sealed partial class DataStreamsStatsItem /// This parameter is only returned if the human query parameter is true. /// /// - [JsonInclude, JsonPropertyName("store_size")] - public Elastic.Clients.Elasticsearch.ByteSize? StoreSize { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? StoreSize { get; set; } /// /// /// Total size, in bytes, of all shards for the data stream’s backing indices. /// /// - [JsonInclude, JsonPropertyName("store_size_bytes")] - public long StoreSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long StoreSizeBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs index a6c920a16d8..d1cb76c94c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsampleConfig.g.cs @@ -17,53 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DownsampleConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFixedInterval = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FixedInterval = propFixedInterval.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigConverter))] public sealed partial class DownsampleConfig { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleConfig(string fixedInterval) + { + FixedInterval = fixedInterval; + } +#if NET7_0_OR_GREATER + public DownsampleConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DownsampleConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The interval at which to aggregate the original time series index. /// /// - [JsonInclude, JsonPropertyName("fixed_interval")] - public string FixedInterval { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FixedInterval { get; set; } } -public sealed partial class DownsampleConfigDescriptor : SerializableDescriptor +public readonly partial struct DownsampleConfigDescriptor { - internal DownsampleConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Instance { get; init; } - public DownsampleConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleConfigDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig instance) { + Instance = instance; } - private string FixedIntervalValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsampleConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor descriptor) => descriptor.Instance; /// /// /// The interval at which to aggregate the original time series index. /// /// - public DownsampleConfigDescriptor FixedInterval(string fixedInterval) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor FixedInterval(string value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("fixed_interval"); - writer.WriteStringValue(FixedIntervalValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs index 7b63a71e9cb..117addd8135 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/DownsamplingRound.g.cs @@ -17,57 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class DownsamplingRoundConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAfter = System.Text.Json.JsonEncodedText.Encode("after"); + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAfter = default; + LocalJsonValue propConfig = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAfter.TryReadProperty(ref reader, options, PropAfter, null)) + { + continue; + } + + if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + After = propAfter.Value, + Config = propConfig.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAfter, value.After, null, null); + writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundConverter))] public sealed partial class DownsamplingRound { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsamplingRound(Elastic.Clients.Elasticsearch.Duration after, Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) + { + After = after; + Config = config; + } +#if NET7_0_OR_GREATER + public DownsamplingRound() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DownsamplingRound() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The duration since rollover when this downsampling round should execute /// /// - [JsonInclude, JsonPropertyName("after")] - public Elastic.Clients.Elasticsearch.Duration After { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration After { get; set; } /// /// /// The downsample configuration to execute. /// /// - [JsonInclude, JsonPropertyName("config")] - public Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Config { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig Config { get; set; } } -public sealed partial class DownsamplingRoundDescriptor : SerializableDescriptor +public readonly partial struct DownsamplingRoundDescriptor { - internal DownsamplingRoundDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsamplingRoundDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound instance) + { + Instance = instance; + } - public DownsamplingRoundDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DownsamplingRoundDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration AfterValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig ConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor ConfigDescriptor { get; set; } - private Action ConfigDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound instance) => new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound(Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor descriptor) => descriptor.Instance; /// /// /// The duration since rollover when this downsampling round should execute /// /// - public DownsamplingRoundDescriptor After(Elastic.Clients.Elasticsearch.Duration after) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor After(Elastic.Clients.Elasticsearch.Duration value) { - AfterValue = after; - return Self; + Instance.After = value; + return this; } /// @@ -75,51 +155,28 @@ public DownsamplingRoundDescriptor After(Elastic.Clients.Elasticsearch.Duration /// The downsample configuration to execute. /// /// - public DownsamplingRoundDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig config) - { - ConfigDescriptor = null; - ConfigDescriptorAction = null; - ConfigValue = config; - return Self; - } - - public DownsamplingRoundDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor Config(Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfig value) { - ConfigValue = null; - ConfigDescriptorAction = null; - ConfigDescriptor = descriptor; - return Self; + Instance.Config = value; + return this; } - public DownsamplingRoundDescriptor Config(Action configure) + /// + /// + /// The downsample configuration to execute. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor Config(System.Action action) { - ConfigValue = null; - ConfigDescriptor = null; - ConfigDescriptorAction = configure; - return Self; + Instance.Config = Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("after"); - JsonSerializer.Serialize(writer, AfterValue, options); - if (ConfigDescriptor is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigDescriptor, options); - } - else if (ConfigDescriptorAction is not null) - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DownsampleConfigDescriptor(ConfigDescriptorAction), options); - } - else - { - writer.WritePropertyName("config"); - JsonSerializer.Serialize(writer, ConfigValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRoundDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.DownsamplingRound(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs index 266cfa6e3c0..4015d3d2564 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ExplainAnalyzeToken.g.cs @@ -17,122 +17,206 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -internal sealed partial class ExplainAnalyzeTokenConverter : JsonConverter +internal sealed partial class ExplainAnalyzeTokenConverter : System.Text.Json.Serialization.JsonConverter { - public override ExplainAnalyzeToken Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBytes = System.Text.Json.JsonEncodedText.Encode("bytes"); + private static readonly System.Text.Json.JsonEncodedText PropEndOffset = System.Text.Json.JsonEncodedText.Encode("end_offset"); + private static readonly System.Text.Json.JsonEncodedText PropKeyword = System.Text.Json.JsonEncodedText.Encode("keyword"); + private static readonly System.Text.Json.JsonEncodedText PropPosition = System.Text.Json.JsonEncodedText.Encode("position"); + private static readonly System.Text.Json.JsonEncodedText PropPositionLength = System.Text.Json.JsonEncodedText.Encode("positionLength"); + private static readonly System.Text.Json.JsonEncodedText PropStartOffset = System.Text.Json.JsonEncodedText.Encode("start_offset"); + private static readonly System.Text.Json.JsonEncodedText PropTermFrequency = System.Text.Json.JsonEncodedText.Encode("termFrequency"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ExplainAnalyzeToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - string bytes = default; - long endOffset = default; - bool? keyword = default; - long position = default; - long positionlength = default; - long startOffset = default; - long termfrequency = default; - string token = default; - string type = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + System.Collections.Generic.Dictionary? propAttributes = default; + LocalJsonValue propBytes = default; + LocalJsonValue propEndOffset = default; + LocalJsonValue propKeyword = default; + LocalJsonValue propPosition = default; + LocalJsonValue propPositionLength = default; + LocalJsonValue propStartOffset = default; + LocalJsonValue propTermFrequency = default; + LocalJsonValue propToken = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBytes.TryReadProperty(ref reader, options, PropBytes, null)) + { + continue; + } + + if (propEndOffset.TryReadProperty(ref reader, options, PropEndOffset, null)) + { + continue; + } + + if (propKeyword.TryReadProperty(ref reader, options, PropKeyword, null)) + { + continue; + } + + if (propPosition.TryReadProperty(ref reader, options, PropPosition, null)) + { + continue; + } + + if (propPositionLength.TryReadProperty(ref reader, options, PropPositionLength, null)) + { + continue; + } + + if (propStartOffset.TryReadProperty(ref reader, options, PropStartOffset, null)) + { + continue; + } + + if (propTermFrequency.TryReadProperty(ref reader, options, PropTermFrequency, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) { - var property = reader.GetString(); - if (property == "bytes") - { - bytes = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "end_offset") - { - endOffset = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "keyword") - { - keyword = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "position") - { - position = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "positionLength") - { - positionlength = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "start_offset") - { - startOffset = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "termFrequency") - { - termfrequency = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "token") - { - token = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "type") - { - type = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + propAttributes ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propAttributes[key] = value; } - return new ExplainAnalyzeToken { Attributes = additionalProperties, Bytes = bytes, EndOffset = endOffset, Keyword = keyword, Position = position, Positionlength = positionlength, StartOffset = startOffset, Termfrequency = termfrequency, Token = token, Type = type }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ExplainAnalyzeToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes, + Bytes = propBytes.Value, + EndOffset = propEndOffset.Value, + Keyword = propKeyword.Value, + Position = propPosition.Value, + PositionLength = propPositionLength.Value, + StartOffset = propStartOffset.Value, + TermFrequency = propTermFrequency.Value, + Token = propToken.Value, + Type = propType.Value + }; } - public override void Write(Utf8JsonWriter writer, ExplainAnalyzeToken value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ExplainAnalyzeToken value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ExplainAnalyzeToken' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBytes, value.Bytes, null, null); + writer.WriteProperty(options, PropEndOffset, value.EndOffset, null, null); + writer.WriteProperty(options, PropKeyword, value.Keyword, null, null); + writer.WriteProperty(options, PropPosition, value.Position, null, null); + writer.WriteProperty(options, PropPositionLength, value.PositionLength, null, null); + writer.WriteProperty(options, PropStartOffset, value.StartOffset, null, null); + writer.WriteProperty(options, PropTermFrequency, value.TermFrequency, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + if (value.Attributes is not null) + { + foreach (var item in value.Attributes) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(ExplainAnalyzeTokenConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ExplainAnalyzeTokenConverter))] public sealed partial class ExplainAnalyzeToken { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExplainAnalyzeToken(string bytes, long endOffset, long position, long positionLength, long startOffset, long termFrequency, string token, string type) + { + Bytes = bytes; + EndOffset = endOffset; + Position = position; + PositionLength = positionLength; + StartOffset = startOffset; + TermFrequency = termFrequency; + Token = token; + Type = type; + } +#if NET7_0_OR_GREATER + public ExplainAnalyzeToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExplainAnalyzeToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExplainAnalyzeToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Additional tokenizer-specific attributes /// /// - public IReadOnlyDictionary Attributes { get; init; } - public string Bytes { get; init; } - public long EndOffset { get; init; } - public bool? Keyword { get; init; } - public long Position { get; init; } - public long Positionlength { get; init; } - public long StartOffset { get; init; } - public long Termfrequency { get; init; } - public string Token { get; init; } - public string Type { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Bytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long EndOffset { get; set; } + public bool? Keyword { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Position { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PositionLength { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long StartOffset { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TermFrequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Token { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FailureStore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FailureStore.g.cs index b33765216e9..bb471d91cf3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FailureStore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FailureStore.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class FailureStoreConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropRolloverOnWrite = System.Text.Json.JsonEncodedText.Encode("rollover_on_write"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FailureStore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propRolloverOnWrite = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propRolloverOnWrite.TryReadProperty(ref reader, options, PropRolloverOnWrite, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FailureStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Indices = propIndices.Value, + RolloverOnWrite = propRolloverOnWrite.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FailureStore value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRolloverOnWrite, value.RolloverOnWrite, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FailureStoreConverter))] public sealed partial class FailureStore { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("rollover_on_write")] - public bool RolloverOnWrite { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailureStore(bool enabled, System.Collections.Generic.IReadOnlyCollection indices, bool rolloverOnWrite) + { + Enabled = enabled; + Indices = indices; + RolloverOnWrite = rolloverOnWrite; + } +#if NET7_0_OR_GREATER + public FailureStore() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FailureStore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FailureStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool RolloverOnWrite { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FieldSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FieldSummary.g.cs new file mode 100644 index 00000000000..fc7217dd4e2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FieldSummary.g.cs @@ -0,0 +1,200 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class FieldSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAny = System.Text.Json.JsonEncodedText.Encode("any"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropInvertedIndex = System.Text.Json.JsonEncodedText.Encode("inverted_index"); + private static readonly System.Text.Json.JsonEncodedText PropKnnVectors = System.Text.Json.JsonEncodedText.Encode("knn_vectors"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropPoints = System.Text.Json.JsonEncodedText.Encode("points"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFields = System.Text.Json.JsonEncodedText.Encode("stored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropTermVectors = System.Text.Json.JsonEncodedText.Encode("term_vectors"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FieldSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAny = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propInvertedIndex = default; + LocalJsonValue propKnnVectors = default; + LocalJsonValue propNorms = default; + LocalJsonValue propPoints = default; + LocalJsonValue propStoredFields = default; + LocalJsonValue propTermVectors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAny.TryReadProperty(ref reader, options, PropAny, null)) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propInvertedIndex.TryReadProperty(ref reader, options, PropInvertedIndex, null)) + { + continue; + } + + if (propKnnVectors.TryReadProperty(ref reader, options, PropKnnVectors, null)) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propPoints.TryReadProperty(ref reader, options, PropPoints, null)) + { + continue; + } + + if (propStoredFields.TryReadProperty(ref reader, options, PropStoredFields, null)) + { + continue; + } + + if (propTermVectors.TryReadProperty(ref reader, options, PropTermVectors, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FieldSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Any = propAny.Value, + DocValues = propDocValues.Value, + InvertedIndex = propInvertedIndex.Value, + KnnVectors = propKnnVectors.Value, + Norms = propNorms.Value, + Points = propPoints.Value, + StoredFields = propStoredFields.Value, + TermVectors = propTermVectors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FieldSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAny, value.Any, null, null); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropInvertedIndex, value.InvertedIndex, null, null); + writer.WriteProperty(options, PropKnnVectors, value.KnnVectors, null, null); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropPoints, value.Points, null, null); + writer.WriteProperty(options, PropStoredFields, value.StoredFields, null, null); + writer.WriteProperty(options, PropTermVectors, value.TermVectors, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FieldSummaryConverter))] +public sealed partial class FieldSummary +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSummary(int any, int docValues, Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndex invertedIndex, int knnVectors, int norms, int points, int storedFields, int termVectors) + { + Any = any; + DocValues = docValues; + InvertedIndex = invertedIndex; + KnnVectors = knnVectors; + Norms = norms; + Points = points; + StoredFields = storedFields; + TermVectors = termVectors; + } +#if NET7_0_OR_GREATER + public FieldSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Any { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DocValues { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndex InvertedIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int KnnVectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Norms { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Points { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int StoredFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TermVectors { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FielddataFrequencyFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FielddataFrequencyFilter.g.cs index 6b7d1eaacf4..65a0f62982c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FielddataFrequencyFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FielddataFrequencyFilter.g.cs @@ -17,65 +17,155 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class FielddataFrequencyFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropMinSegmentSize = System.Text.Json.JsonEncodedText.Encode("min_segment_size"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + LocalJsonValue propMinSegmentSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propMinSegmentSize.TryReadProperty(ref reader, options, PropMinSegmentSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Max = propMax.Value, + Min = propMin.Value, + MinSegmentSize = propMinSegmentSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropMinSegmentSize, value.MinSegmentSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterConverter))] public sealed partial class FielddataFrequencyFilter { - [JsonInclude, JsonPropertyName("max")] - public double Max { get; set; } - [JsonInclude, JsonPropertyName("min")] - public double Min { get; set; } - [JsonInclude, JsonPropertyName("min_segment_size")] - public int MinSegmentSize { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FielddataFrequencyFilter(double max, double min, int minSegmentSize) + { + Max = max; + Min = min; + MinSegmentSize = minSegmentSize; + } +#if NET7_0_OR_GREATER + public FielddataFrequencyFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FielddataFrequencyFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Max { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Min { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MinSegmentSize { get; set; } } -public sealed partial class FielddataFrequencyFilterDescriptor : SerializableDescriptor +public readonly partial struct FielddataFrequencyFilterDescriptor { - internal FielddataFrequencyFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FielddataFrequencyFilterDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter instance) + { + Instance = instance; + } - public FielddataFrequencyFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FielddataFrequencyFilterDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double MaxValue { get; set; } - private double MinValue { get; set; } - private int MinSegmentSizeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter instance) => new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor descriptor) => descriptor.Instance; - public FielddataFrequencyFilterDescriptor Max(double max) + public Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor Max(double value) { - MaxValue = max; - return Self; + Instance.Max = value; + return this; } - public FielddataFrequencyFilterDescriptor Min(double min) + public Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor Min(double value) { - MinValue = min; - return Self; + Instance.Min = value; + return this; } - public FielddataFrequencyFilterDescriptor MinSegmentSize(int minSegmentSize) + public Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor MinSegmentSize(int value) { - MinSegmentSizeValue = minSegmentSize; - return Self; + Instance.MinSegmentSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue); - writer.WritePropertyName("min"); - writer.WriteNumberValue(MinValue); - writer.WritePropertyName("min_segment_size"); - writer.WriteNumberValue(MinSegmentSizeValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FileDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FileDetails.g.cs index c6041e3f6fe..a306e76b733 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FileDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/FileDetails.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class FileDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRecovered = System.Text.Json.JsonEncodedText.Encode("recovered"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.FileDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propName = default; + LocalJsonValue propRecovered = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRecovered.TryReadProperty(ref reader, options, PropRecovered, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.FileDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Name = propName.Value, + Recovered = propRecovered.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.FileDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRecovered, value.Recovered, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.FileDetailsConverter))] public sealed partial class FileDetails { - [JsonInclude, JsonPropertyName("length")] - public long Length { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("recovered")] - public long Recovered { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FileDetails(long length, string name, long recovered) + { + Length = length; + Name = name; + Recovered = recovered; + } +#if NET7_0_OR_GREATER + public FileDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FileDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Length { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Recovered { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAliases.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAliases.g.cs index e8797e9bfba..732db268457 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAliases.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAliases.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexAliasesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexAliases Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAliases = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexAliases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexAliases value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexAliasesConverter))] public sealed partial class IndexAliases { - [JsonInclude, JsonPropertyName("aliases")] - public IReadOnlyDictionary Aliases { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexAliases(System.Collections.Generic.IReadOnlyDictionary aliases) + { + Aliases = aliases; + } +#if NET7_0_OR_GREATER + public IndexAliases() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexAliases() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexAliases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Aliases { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAndDataStreamAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAndDataStreamAction.g.cs index 495d9f3a994..155ae574585 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAndDataStreamAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexAndDataStreamAction.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexAndDataStreamActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataStream = default; + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStream = propDataStream.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionConverter))] public sealed partial class IndexAndDataStreamAction { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.DataStreamName dataStream, Elastic.Clients.Elasticsearch.IndexName index) + { + DataStream = dataStream; + Index = index; + } +#if NET7_0_OR_GREATER + public IndexAndDataStreamAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexAndDataStreamAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Data stream targeted by the action. /// /// - [JsonInclude, JsonPropertyName("data_stream")] - public Elastic.Clients.Elasticsearch.DataStreamName DataStream { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DataStreamName DataStream { get; set; } /// /// /// Index for the action. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } } -public sealed partial class IndexAndDataStreamActionDescriptor : SerializableDescriptor +public readonly partial struct IndexAndDataStreamActionDescriptor { - internal IndexAndDataStreamActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction Instance { get; init; } - public IndexAndDataStreamActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexAndDataStreamActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.DataStreamName DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexAndDataStreamActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor descriptor) => descriptor.Instance; /// /// /// Data stream targeted by the action. /// /// - public IndexAndDataStreamActionDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName value) { - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } /// @@ -73,19 +155,17 @@ public IndexAndDataStreamActionDescriptor DataStream(Elastic.Clients.Elasticsear /// Index for the action. /// /// - public IndexAndDataStreamActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexMappingRecord.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexMappingRecord.g.cs index ecee9ebb4e8..3229862de58 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexMappingRecord.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexMappingRecord.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexMappingRecordConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropItem = System.Text.Json.JsonEncodedText.Encode("item"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexMappingRecord Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propItem = default; + LocalJsonValue propMappings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propItem.TryReadProperty(ref reader, options, PropItem, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexMappingRecord(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Item = propItem.Value, + Mappings = propMappings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexMappingRecord value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropItem, value.Item, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexMappingRecordConverter))] public sealed partial class IndexMappingRecord { - [JsonInclude, JsonPropertyName("item")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Item { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexMappingRecord(Elastic.Clients.Elasticsearch.Mapping.TypeMapping mappings) + { + Mappings = mappings; + } +#if NET7_0_OR_GREATER + public IndexMappingRecord() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexMappingRecord() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexMappingRecord(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Item { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexModifyDataStreamAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexModifyDataStreamAction.g.cs index e8b87c850cc..58fd616f4f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexModifyDataStreamAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexModifyDataStreamAction.g.cs @@ -17,226 +17,215 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -[JsonConverter(typeof(IndexModifyDataStreamActionConverter))] -public sealed partial class IndexModifyDataStreamAction +internal sealed partial class IndexModifyDataStreamActionConverter : System.Text.Json.Serialization.JsonConverter { - internal IndexModifyDataStreamAction(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static IndexModifyDataStreamAction AddBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => new IndexModifyDataStreamAction("add_backing_index", indexAndDataStreamAction); - public static IndexModifyDataStreamAction RemoveBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => new IndexModifyDataStreamAction("remove_backing_index", indexAndDataStreamAction); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantAddBackingIndex = System.Text.Json.JsonEncodedText.Encode("add_backing_index"); + private static readonly System.Text.Json.JsonEncodedText VariantRemoveBackingIndex = System.Text.Json.JsonEncodedText.Encode("remove_backing_index"); -internal sealed partial class IndexModifyDataStreamActionConverter : JsonConverter -{ - public override IndexModifyDataStreamAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAddBackingIndex)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAddBackingIndex.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "add_backing_index") + if (reader.ValueTextEquals(VariantRemoveBackingIndex)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRemoveBackingIndex.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "remove_backing_index") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'IndexModifyDataStreamAction' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new IndexModifyDataStreamAction(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, IndexModifyDataStreamAction value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "add_backing_index": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction)value.Variant, options); - break; - case "remove_backing_index": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction)value.Variant, options); - break; - } + case null: + break; + case "add_backing_index": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction)value.Variant, null, null); + break; + case "remove_backing_index": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction)}'."); } writer.WriteEndObject(); } } -public sealed partial class IndexModifyDataStreamActionDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionConverter))] +public sealed partial class IndexModifyDataStreamAction { - internal IndexModifyDataStreamActionDescriptor(Action> configure) => configure.Invoke(this); - - public IndexModifyDataStreamActionDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public IndexModifyDataStreamAction() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private IndexModifyDataStreamActionDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public IndexModifyDataStreamAction() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private IndexModifyDataStreamActionDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexModifyDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - public IndexModifyDataStreamActionDescriptor AddBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => Set(indexAndDataStreamAction, "add_backing_index"); - public IndexModifyDataStreamActionDescriptor AddBackingIndex(Action configure) => Set(configure, "add_backing_index"); - public IndexModifyDataStreamActionDescriptor RemoveBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => Set(indexAndDataStreamAction, "remove_backing_index"); - public IndexModifyDataStreamActionDescriptor RemoveBackingIndex(Action configure) => Set(configure, "remove_backing_index"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Adds an existing index as a backing index for a data stream. + /// The index is hidden as part of this operation. + /// WARNING: Adding indices with the add_backing_index action can potentially result in improper data stream behavior. + /// This should be considered an expert level API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction? AddBackingIndex { get => GetVariant("add_backing_index"); set => SetVariant("add_backing_index", value); } + + /// + /// + /// Removes a backing index from a data stream. + /// The index is unhidden as part of this operation. + /// A data stream’s write index cannot be removed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction? RemoveBackingIndex { get => GetVariant("remove_backing_index"); set => SetVariant("remove_backing_index", value); } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class IndexModifyDataStreamActionDescriptor : SerializableDescriptor +public readonly partial struct IndexModifyDataStreamActionDescriptor { - internal IndexModifyDataStreamActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction Instance { get; init; } - public IndexModifyDataStreamActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexModifyDataStreamActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private IndexModifyDataStreamActionDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexModifyDataStreamActionDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IndexModifyDataStreamActionDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction(Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Adds an existing index as a backing index for a data stream. + /// The index is hidden as part of this operation. + /// WARNING: Adding indices with the add_backing_index action can potentially result in improper data stream behavior. + /// This should be considered an expert level API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor AddBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.AddBackingIndex = value; + return this; } - public IndexModifyDataStreamActionDescriptor AddBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => Set(indexAndDataStreamAction, "add_backing_index"); - public IndexModifyDataStreamActionDescriptor AddBackingIndex(Action configure) => Set(configure, "add_backing_index"); - public IndexModifyDataStreamActionDescriptor RemoveBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction indexAndDataStreamAction) => Set(indexAndDataStreamAction, "remove_backing_index"); - public IndexModifyDataStreamActionDescriptor RemoveBackingIndex(Action configure) => Set(configure, "remove_backing_index"); + /// + /// + /// Adds an existing index as a backing index for a data stream. + /// The index is hidden as part of this operation. + /// WARNING: Adding indices with the add_backing_index action can potentially result in improper data stream behavior. + /// This should be considered an expert level API. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor AddBackingIndex(System.Action action) + { + Instance.AddBackingIndex = Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Removes a backing index from a data stream. + /// The index is unhidden as part of this operation. + /// A data stream’s write index cannot be removed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor RemoveBackingIndex(Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamAction? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.RemoveBackingIndex = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Removes a backing index from a data stream. + /// The index is unhidden as part of this operation. + /// A data stream’s write index cannot be removed. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor RemoveBackingIndex(System.Action action) + { + Instance.RemoveBackingIndex = Elastic.Clients.Elasticsearch.IndexManagement.IndexAndDataStreamActionDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexModifyDataStreamAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRouting.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRouting.g.cs index 6066c294f5c..db718ccec4a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRouting.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRouting.g.cs @@ -17,122 +17,142 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocation = System.Text.Json.JsonEncodedText.Encode("allocation"); + private static readonly System.Text.Json.JsonEncodedText PropRebalance = System.Text.Json.JsonEncodedText.Encode("rebalance"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocation = default; + LocalJsonValue propRebalance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocation.TryReadProperty(ref reader, options, PropAllocation, null)) + { + continue; + } + + if (propRebalance.TryReadProperty(ref reader, options, PropRebalance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Allocation = propAllocation.Value, + Rebalance = propRebalance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocation, value.Allocation, null, null); + writer.WriteProperty(options, PropRebalance, value.Rebalance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingConverter))] public sealed partial class IndexRouting { - [JsonInclude, JsonPropertyName("allocation")] +#if NET7_0_OR_GREATER + public IndexRouting() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexRouting() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation? Allocation { get; set; } - [JsonInclude, JsonPropertyName("rebalance")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance? Rebalance { get; set; } } -public sealed partial class IndexRoutingDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingDescriptor { - internal IndexRoutingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting Instance { get; init; } - public IndexRoutingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation? AllocationValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor AllocationDescriptor { get; set; } - private Action AllocationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance? RebalanceValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor RebalanceDescriptor { get; set; } - private Action RebalanceDescriptorAction { get; set; } - - public IndexRoutingDescriptor Allocation(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation? allocation) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingDescriptor() { - AllocationDescriptor = null; - AllocationDescriptorAction = null; - AllocationValue = allocation; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexRoutingDescriptor Allocation(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor Allocation(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation? value) { - AllocationValue = null; - AllocationDescriptorAction = null; - AllocationDescriptor = descriptor; - return Self; + Instance.Allocation = value; + return this; } - public IndexRoutingDescriptor Allocation(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor Allocation() { - AllocationValue = null; - AllocationDescriptor = null; - AllocationDescriptorAction = configure; - return Self; + Instance.Allocation = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor.Build(null); + return this; } - public IndexRoutingDescriptor Rebalance(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance? rebalance) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor Allocation(System.Action? action) { - RebalanceDescriptor = null; - RebalanceDescriptorAction = null; - RebalanceValue = rebalance; - return Self; + Instance.Allocation = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor.Build(action); + return this; } - public IndexRoutingDescriptor Rebalance(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor Rebalance(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance? value) { - RebalanceValue = null; - RebalanceDescriptorAction = null; - RebalanceDescriptor = descriptor; - return Self; + Instance.Rebalance = value; + return this; } - public IndexRoutingDescriptor Rebalance(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor Rebalance(System.Action action) { - RebalanceValue = null; - RebalanceDescriptor = null; - RebalanceDescriptorAction = configure; - return Self; + Instance.Rebalance = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting Build(System.Action? action) { - writer.WriteStartObject(); - if (AllocationDescriptor is not null) + if (action is null) { - writer.WritePropertyName("allocation"); - JsonSerializer.Serialize(writer, AllocationDescriptor, options); - } - else if (AllocationDescriptorAction is not null) - { - writer.WritePropertyName("allocation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor(AllocationDescriptorAction), options); - } - else if (AllocationValue is not null) - { - writer.WritePropertyName("allocation"); - JsonSerializer.Serialize(writer, AllocationValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RebalanceDescriptor is not null) - { - writer.WritePropertyName("rebalance"); - JsonSerializer.Serialize(writer, RebalanceDescriptor, options); - } - else if (RebalanceDescriptorAction is not null) - { - writer.WritePropertyName("rebalance"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor(RebalanceDescriptorAction), options); - } - else if (RebalanceValue is not null) - { - writer.WritePropertyName("rebalance"); - JsonSerializer.Serialize(writer, RebalanceValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocation.g.cs index c94c53f3909..a8ef9079219 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocation.g.cs @@ -17,182 +17,192 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingAllocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDisk = System.Text.Json.JsonEncodedText.Encode("disk"); + private static readonly System.Text.Json.JsonEncodedText PropEnable = System.Text.Json.JsonEncodedText.Encode("enable"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropInitialRecovery = System.Text.Json.JsonEncodedText.Encode("initial_recovery"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDisk = default; + LocalJsonValue propEnable = default; + LocalJsonValue propInclude = default; + LocalJsonValue propInitialRecovery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDisk.TryReadProperty(ref reader, options, PropDisk, null)) + { + continue; + } + + if (propEnable.TryReadProperty(ref reader, options, PropEnable, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propInitialRecovery.TryReadProperty(ref reader, options, PropInitialRecovery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Disk = propDisk.Value, + Enable = propEnable.Value, + Include = propInclude.Value, + InitialRecovery = propInitialRecovery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDisk, value.Disk, null, null); + writer.WriteProperty(options, PropEnable, value.Enable, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropInitialRecovery, value.InitialRecovery, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationConverter))] public sealed partial class IndexRoutingAllocation { - [JsonInclude, JsonPropertyName("disk")] +#if NET7_0_OR_GREATER + public IndexRoutingAllocation() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexRoutingAllocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRoutingAllocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk? Disk { get; set; } - [JsonInclude, JsonPropertyName("enable")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions? Enable { get; set; } - [JsonInclude, JsonPropertyName("include")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude? Include { get; set; } - [JsonInclude, JsonPropertyName("initial_recovery")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery? InitialRecovery { get; set; } } -public sealed partial class IndexRoutingAllocationDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingAllocationDescriptor { - internal IndexRoutingAllocationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation Instance { get; init; } - public IndexRoutingAllocationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk? DiskValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor DiskDescriptor { get; set; } - private Action DiskDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions? EnableValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude? IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor IncludeDescriptor { get; set; } - private Action IncludeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery? InitialRecoveryValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor InitialRecoveryDescriptor { get; set; } - private Action InitialRecoveryDescriptorAction { get; set; } - - public IndexRoutingAllocationDescriptor Disk(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk? disk) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationDescriptor() { - DiskDescriptor = null; - DiskDescriptorAction = null; - DiskValue = disk; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexRoutingAllocationDescriptor Disk(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Disk(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk? value) { - DiskValue = null; - DiskDescriptorAction = null; - DiskDescriptor = descriptor; - return Self; + Instance.Disk = value; + return this; } - public IndexRoutingAllocationDescriptor Disk(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Disk() { - DiskValue = null; - DiskDescriptor = null; - DiskDescriptorAction = configure; - return Self; + Instance.Disk = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor.Build(null); + return this; } - public IndexRoutingAllocationDescriptor Enable(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions? enable) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Disk(System.Action? action) { - EnableValue = enable; - return Self; + Instance.Disk = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor.Build(action); + return this; } - public IndexRoutingAllocationDescriptor Include(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude? include) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Enable(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationOptions? value) { - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeValue = include; - return Self; + Instance.Enable = value; + return this; } - public IndexRoutingAllocationDescriptor Include(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Include(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude? value) { - IncludeValue = null; - IncludeDescriptorAction = null; - IncludeDescriptor = descriptor; - return Self; + Instance.Include = value; + return this; } - public IndexRoutingAllocationDescriptor Include(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Include() { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorAction = configure; - return Self; + Instance.Include = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor.Build(null); + return this; } - public IndexRoutingAllocationDescriptor InitialRecovery(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery? initialRecovery) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor Include(System.Action? action) { - InitialRecoveryDescriptor = null; - InitialRecoveryDescriptorAction = null; - InitialRecoveryValue = initialRecovery; - return Self; + Instance.Include = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor.Build(action); + return this; } - public IndexRoutingAllocationDescriptor InitialRecovery(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor InitialRecovery(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery? value) { - InitialRecoveryValue = null; - InitialRecoveryDescriptorAction = null; - InitialRecoveryDescriptor = descriptor; - return Self; + Instance.InitialRecovery = value; + return this; } - public IndexRoutingAllocationDescriptor InitialRecovery(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor InitialRecovery() { - InitialRecoveryValue = null; - InitialRecoveryDescriptor = null; - InitialRecoveryDescriptorAction = configure; - return Self; + Instance.InitialRecovery = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor InitialRecovery(System.Action? action) { - writer.WriteStartObject(); - if (DiskDescriptor is not null) - { - writer.WritePropertyName("disk"); - JsonSerializer.Serialize(writer, DiskDescriptor, options); - } - else if (DiskDescriptorAction is not null) - { - writer.WritePropertyName("disk"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor(DiskDescriptorAction), options); - } - else if (DiskValue is not null) - { - writer.WritePropertyName("disk"); - JsonSerializer.Serialize(writer, DiskValue, options); - } - - if (EnableValue is not null) - { - writer.WritePropertyName("enable"); - JsonSerializer.Serialize(writer, EnableValue, options); - } - - if (IncludeDescriptor is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeDescriptor, options); - } - else if (IncludeDescriptorAction is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor(IncludeDescriptorAction), options); - } - else if (IncludeValue is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } + Instance.InitialRecovery = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor.Build(action); + return this; + } - if (InitialRecoveryDescriptor is not null) - { - writer.WritePropertyName("initial_recovery"); - JsonSerializer.Serialize(writer, InitialRecoveryDescriptor, options); - } - else if (InitialRecoveryDescriptorAction is not null) - { - writer.WritePropertyName("initial_recovery"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor(InitialRecoveryDescriptorAction), options); - } - else if (InitialRecoveryValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("initial_recovery"); - JsonSerializer.Serialize(writer, InitialRecoveryValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationDisk.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationDisk.g.cs index 365324aa133..8fe3da9e279 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationDisk.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationDisk.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingAllocationDiskConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropThresholdEnabled = System.Text.Json.JsonEncodedText.Encode("threshold_enabled"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propThresholdEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propThresholdEnabled.TryReadProperty(ref reader, options, PropThresholdEnabled, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ThresholdEnabled = propThresholdEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropThresholdEnabled, value.ThresholdEnabled, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskConverter))] public sealed partial class IndexRoutingAllocationDisk { - [JsonInclude, JsonPropertyName("threshold_enabled")] - public object? ThresholdEnabled { get; set; } +#if NET7_0_OR_GREATER + public IndexRoutingAllocationDisk() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexRoutingAllocationDisk() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Union? ThresholdEnabled { get; set; } } -public sealed partial class IndexRoutingAllocationDiskDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingAllocationDiskDescriptor { - internal IndexRoutingAllocationDiskDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk Instance { get; init; } - public IndexRoutingAllocationDiskDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationDiskDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk instance) { + Instance = instance; } - private object? ThresholdEnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationDiskDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IndexRoutingAllocationDiskDescriptor ThresholdEnabled(object? thresholdEnabled) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor ThresholdEnabled(Elastic.Clients.Elasticsearch.Union? value) { - ThresholdEnabledValue = thresholdEnabled; - return Self; + Instance.ThresholdEnabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk Build(System.Action? action) { - writer.WriteStartObject(); - if (ThresholdEnabledValue is not null) + if (action is null) { - writer.WritePropertyName("threshold_enabled"); - JsonSerializer.Serialize(writer, ThresholdEnabledValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDiskDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationDisk(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInclude.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInclude.g.cs index 8ec4e908e7e..ebd34aa3077 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInclude.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInclude.g.cs @@ -17,62 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingAllocationIncludeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropTierPreference = System.Text.Json.JsonEncodedText.Encode("_tier_preference"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propTierPreference = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propTierPreference.TryReadProperty(ref reader, options, PropTierPreference, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + TierPreference = propTierPreference.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropTierPreference, value.TierPreference, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeConverter))] public sealed partial class IndexRoutingAllocationInclude { - [JsonInclude, JsonPropertyName("_id")] +#if NET7_0_OR_GREATER + public IndexRoutingAllocationInclude() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexRoutingAllocationInclude() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Id? Id { get; set; } - [JsonInclude, JsonPropertyName("_tier_preference")] public string? TierPreference { get; set; } } -public sealed partial class IndexRoutingAllocationIncludeDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingAllocationIncludeDescriptor { - internal IndexRoutingAllocationIncludeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude Instance { get; init; } - public IndexRoutingAllocationIncludeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationIncludeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private string? TierPreferenceValue { get; set; } - - public IndexRoutingAllocationIncludeDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationIncludeDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexRoutingAllocationIncludeDescriptor TierPreference(string? tierPreference) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - TierPreferenceValue = tierPreference; - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor TierPreference(string? value) { - writer.WriteStartObject(); - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } + Instance.TierPreference = value; + return this; + } - if (!string.IsNullOrEmpty(TierPreferenceValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("_tier_preference"); - writer.WriteStringValue(TierPreferenceValue); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationIncludeDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInclude(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInitialRecovery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInitialRecovery.g.cs index 10a57cbf20f..90e953f4371 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInitialRecovery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingAllocationInitialRecovery.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingAllocationInitialRecoveryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryConverter))] public sealed partial class IndexRoutingAllocationInitialRecovery { - [JsonInclude, JsonPropertyName("_id")] +#if NET7_0_OR_GREATER + public IndexRoutingAllocationInitialRecovery() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexRoutingAllocationInitialRecovery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Id? Id { get; set; } } -public sealed partial class IndexRoutingAllocationInitialRecoveryDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingAllocationInitialRecoveryDescriptor { - internal IndexRoutingAllocationInitialRecoveryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery Instance { get; init; } - public IndexRoutingAllocationInitialRecoveryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationInitialRecoveryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingAllocationInitialRecoveryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IndexRoutingAllocationInitialRecoveryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery Build(System.Action? action) { - writer.WriteStartObject(); - if (IdValue is not null) + if (action is null) { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecoveryDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingAllocationInitialRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingRebalance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingRebalance.g.cs index 4a0c0ecb835..0a4c7f47a7e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingRebalance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexRoutingRebalance.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexRoutingRebalanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnable = System.Text.Json.JsonEncodedText.Encode("enable"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnable = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnable.TryReadProperty(ref reader, options, PropEnable, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enable = propEnable.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnable, value.Enable, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceConverter))] public sealed partial class IndexRoutingRebalance { - [JsonInclude, JsonPropertyName("enable")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions Enable { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingRebalance(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions enable) + { + Enable = enable; + } +#if NET7_0_OR_GREATER + public IndexRoutingRebalance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexRoutingRebalance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexRoutingRebalance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions Enable { get; set; } } -public sealed partial class IndexRoutingRebalanceDescriptor : SerializableDescriptor +public readonly partial struct IndexRoutingRebalanceDescriptor { - internal IndexRoutingRebalanceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance Instance { get; init; } - public IndexRoutingRebalanceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingRebalanceDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions EnableValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexRoutingRebalanceDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IndexRoutingRebalanceDescriptor Enable(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions enable) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor Enable(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceOptions value) { - EnableValue = enable; - return Self; + Instance.Enable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enable"); - JsonSerializer.Serialize(writer, EnableValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalanceDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingRebalance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegment.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegment.g.cs index 179034d33c5..c251cecfd48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegment.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegment.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSegmentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSegment Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSegment value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentConverter))] public sealed partial class IndexSegment { - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary>> Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSegment(System.Collections.Generic.IReadOnlyDictionary> shards) + { + Shards = shards; + } +#if NET7_0_OR_GREATER + public IndexSegment() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexSegment() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSegment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegmentSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegmentSort.g.cs index 41e475ffda0..5f7d2c711bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegmentSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSegmentSort.g.cs @@ -17,164 +17,261 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSegmentSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propMissing = default; + LocalJsonValue?> propMode = default; + LocalJsonValue?> propOrder = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Missing = propMissing.Value, + Mode = propMode.Value, + Order = propOrder.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropMissing, value.Missing, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMode, value.Mode, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortConverter))] public sealed partial class IndexSegmentSort { - [JsonInclude, JsonPropertyName("field")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public IndexSegmentSort() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSegmentSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? Field { get; set; } - [JsonInclude, JsonPropertyName("missing")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing))] - public ICollection? Missing { get; set; } - [JsonInclude, JsonPropertyName("mode")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode))] - public ICollection? Mode { get; set; } - [JsonInclude, JsonPropertyName("order")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder))] - public ICollection? Order { get; set; } + public System.Collections.Generic.ICollection? Missing { get; set; } + public System.Collections.Generic.ICollection? Mode { get; set; } + public System.Collections.Generic.ICollection? Order { get; set; } } -public sealed partial class IndexSegmentSortDescriptor : SerializableDescriptor> +public readonly partial struct IndexSegmentSortDescriptor { - internal IndexSegmentSortDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) + { + Instance = instance; + } - public IndexSegmentSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSegmentSortDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? FieldValue { get; set; } - private ICollection? MissingValue { get; set; } - private ICollection? ModeValue { get; set; } - private ICollection? OrderValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor descriptor) => descriptor.Instance; - public IndexSegmentSortDescriptor Field(Elastic.Clients.Elasticsearch.Fields? field) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field(Elastic.Clients.Elasticsearch.Fields? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public IndexSegmentSortDescriptor Missing(ICollection? missing) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field(params System.Linq.Expressions.Expression>[] value) { - MissingValue = missing; - return Self; + Instance.Field = value; + return this; } - public IndexSegmentSortDescriptor Mode(ICollection? mode) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(System.Collections.Generic.ICollection? value) { - ModeValue = mode; - return Self; + Instance.Missing = value; + return this; } - public IndexSegmentSortDescriptor Order(ICollection? order) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing[] values) { - OrderValue = order; - return Self; + Instance.Missing = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + Instance.Mode = value; + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - SingleOrManySerializationHelper.Serialize(MissingValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode[] values) + { + Instance.Mode = [.. values]; + return this; + } - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - SingleOrManySerializationHelper.Serialize(ModeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(System.Collections.Generic.ICollection? value) + { + Instance.Order = value; + return this; + } - if (OrderValue is not null) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder[] values) + { + Instance.Order = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize(OrderValue, writer, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IndexSegmentSortDescriptor : SerializableDescriptor +public readonly partial struct IndexSegmentSortDescriptor { - internal IndexSegmentSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) + { + Instance = instance; + } - public IndexSegmentSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSegmentSortDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? FieldValue { get; set; } - private ICollection? MissingValue { get; set; } - private ICollection? ModeValue { get; set; } - private ICollection? OrderValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor descriptor) => descriptor.Instance; - public IndexSegmentSortDescriptor Field(Elastic.Clients.Elasticsearch.Fields? field) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field(Elastic.Clients.Elasticsearch.Fields? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public IndexSegmentSortDescriptor Missing(ICollection? missing) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Field(params System.Linq.Expressions.Expression>[] value) { - MissingValue = missing; - return Self; + Instance.Field = value; + return this; } - public IndexSegmentSortDescriptor Mode(ICollection? mode) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(System.Collections.Generic.ICollection? value) { - ModeValue = mode; - return Self; + Instance.Missing = value; + return this; } - public IndexSegmentSortDescriptor Order(ICollection? order) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Missing(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMissing[] values) { - OrderValue = order; - return Self; + Instance.Missing = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + Instance.Mode = value; + return this; + } - if (MissingValue is not null) - { - writer.WritePropertyName("missing"); - SingleOrManySerializationHelper.Serialize(MissingValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Mode(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortMode[] values) + { + Instance.Mode = [.. values]; + return this; + } - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - SingleOrManySerializationHelper.Serialize(ModeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(System.Collections.Generic.ICollection? value) + { + Instance.Order = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor Order(params Elastic.Clients.Elasticsearch.IndexManagement.SegmentSortOrder[] values) + { + Instance.Order = [.. values]; + return this; + } - if (OrderValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("order"); - SingleOrManySerializationHelper.Serialize(OrderValue, writer, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingBlocks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingBlocks.g.cs index bd8c575e677..7dccce2032e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingBlocks.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingBlocks.g.cs @@ -17,107 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSettingBlocksConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRead = System.Text.Json.JsonEncodedText.Encode("read"); + private static readonly System.Text.Json.JsonEncodedText PropReadOnly = System.Text.Json.JsonEncodedText.Encode("read_only"); + private static readonly System.Text.Json.JsonEncodedText PropReadOnlyAllowDelete = System.Text.Json.JsonEncodedText.Encode("read_only_allow_delete"); + private static readonly System.Text.Json.JsonEncodedText PropWrite = System.Text.Json.JsonEncodedText.Encode("write"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMetadata = default; + LocalJsonValue propRead = default; + LocalJsonValue propReadOnly = default; + LocalJsonValue propReadOnlyAllowDelete = default; + LocalJsonValue propWrite = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (propRead.TryReadProperty(ref reader, options, PropRead, null)) + { + continue; + } + + if (propReadOnly.TryReadProperty(ref reader, options, PropReadOnly, null)) + { + continue; + } + + if (propReadOnlyAllowDelete.TryReadProperty(ref reader, options, PropReadOnlyAllowDelete, null)) + { + continue; + } + + if (propWrite.TryReadProperty(ref reader, options, PropWrite, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Metadata = propMetadata.Value, + Read = propRead.Value, + ReadOnly = propReadOnly.Value, + ReadOnlyAllowDelete = propReadOnlyAllowDelete.Value, + Write = propWrite.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteProperty(options, PropRead, value.Read, null, null); + writer.WriteProperty(options, PropReadOnly, value.ReadOnly, null, null); + writer.WriteProperty(options, PropReadOnlyAllowDelete, value.ReadOnlyAllowDelete, null, null); + writer.WriteProperty(options, PropWrite, value.Write, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksConverter))] public sealed partial class IndexSettingBlocks { - [JsonInclude, JsonPropertyName("metadata")] +#if NET7_0_OR_GREATER + public IndexSettingBlocks() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSettingBlocks() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettingBlocks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Metadata { get; set; } - [JsonInclude, JsonPropertyName("read")] public bool? Read { get; set; } - [JsonInclude, JsonPropertyName("read_only")] public bool? ReadOnly { get; set; } - [JsonInclude, JsonPropertyName("read_only_allow_delete")] public bool? ReadOnlyAllowDelete { get; set; } - [JsonInclude, JsonPropertyName("write")] public bool? Write { get; set; } } -public sealed partial class IndexSettingBlocksDescriptor : SerializableDescriptor +public readonly partial struct IndexSettingBlocksDescriptor { - internal IndexSettingBlocksDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks Instance { get; init; } - public IndexSettingBlocksDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingBlocksDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks instance) { + Instance = instance; } - private bool? MetadataValue { get; set; } - private bool? ReadValue { get; set; } - private bool? ReadOnlyValue { get; set; } - private bool? ReadOnlyAllowDeleteValue { get; set; } - private bool? WriteValue { get; set; } - - public IndexSettingBlocksDescriptor Metadata(bool? metadata = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingBlocksDescriptor() { - MetadataValue = metadata; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexSettingBlocksDescriptor Read(bool? read = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor Metadata(bool? value = true) { - ReadValue = read; - return Self; + Instance.Metadata = value; + return this; } - public IndexSettingBlocksDescriptor ReadOnly(bool? readOnly = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor Read(bool? value = true) { - ReadOnlyValue = readOnly; - return Self; + Instance.Read = value; + return this; } - public IndexSettingBlocksDescriptor ReadOnlyAllowDelete(bool? readOnlyAllowDelete = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor ReadOnly(bool? value = true) { - ReadOnlyAllowDeleteValue = readOnlyAllowDelete; - return Self; + Instance.ReadOnly = value; + return this; } - public IndexSettingBlocksDescriptor Write(bool? write = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor ReadOnlyAllowDelete(bool? value = true) { - WriteValue = write; - return Self; + Instance.ReadOnlyAllowDelete = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor Write(bool? value = true) { - writer.WriteStartObject(); - if (MetadataValue.HasValue) - { - writer.WritePropertyName("metadata"); - writer.WriteBooleanValue(MetadataValue.Value); - } - - if (ReadValue.HasValue) - { - writer.WritePropertyName("read"); - writer.WriteBooleanValue(ReadValue.Value); - } - - if (ReadOnlyValue.HasValue) - { - writer.WritePropertyName("read_only"); - writer.WriteBooleanValue(ReadOnlyValue.Value); - } - - if (ReadOnlyAllowDeleteValue.HasValue) - { - writer.WritePropertyName("read_only_allow_delete"); - writer.WriteBooleanValue(ReadOnlyAllowDeleteValue.Value); - } + Instance.Write = value; + return this; + } - if (WriteValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("write"); - writer.WriteBooleanValue(WriteValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs index 85cb6c2f4ac..ef07f5c6e91 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettings.g.cs @@ -17,721 +17,546 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -internal sealed partial class IndexSettingsConverter : JsonConverter +internal sealed partial class IndexSettingsConverter : System.Text.Json.Serialization.JsonConverter { - public override IndexSettings Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new IndexSettings(); - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyze = System.Text.Json.JsonEncodedText.Encode("analyze"); + private static readonly System.Text.Json.JsonEncodedText PropAutoExpandReplicas = System.Text.Json.JsonEncodedText.Encode("auto_expand_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropBlocks = System.Text.Json.JsonEncodedText.Encode("blocks"); + private static readonly System.Text.Json.JsonEncodedText PropCheckOnStartup = System.Text.Json.JsonEncodedText.Encode("check_on_startup"); + private static readonly System.Text.Json.JsonEncodedText PropCodec = System.Text.Json.JsonEncodedText.Encode("codec"); + private static readonly System.Text.Json.JsonEncodedText PropCreationDate = System.Text.Json.JsonEncodedText.Encode("creation_date"); + private static readonly System.Text.Json.JsonEncodedText PropCreationDateString = System.Text.Json.JsonEncodedText.Encode("creation_date_string"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultPipeline = System.Text.Json.JsonEncodedText.Encode("default_pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropFinalPipeline = System.Text.Json.JsonEncodedText.Encode("final_pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropGcDeletes = System.Text.Json.JsonEncodedText.Encode("gc_deletes"); + private static readonly System.Text.Json.JsonEncodedText PropHidden = System.Text.Json.JsonEncodedText.Encode("hidden"); + private static readonly System.Text.Json.JsonEncodedText PropHighlight = System.Text.Json.JsonEncodedText.Encode("highlight"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexingPressure = System.Text.Json.JsonEncodedText.Encode("indexing_pressure"); + private static readonly System.Text.Json.JsonEncodedText PropIndexingSlowlog = System.Text.Json.JsonEncodedText.Encode("indexing.slowlog"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropLoadFixedBitsetFiltersEagerly = System.Text.Json.JsonEncodedText.Encode("load_fixed_bitset_filters_eagerly"); + private static readonly System.Text.Json.JsonEncodedText PropMapping = System.Text.Json.JsonEncodedText.Encode("mapping"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocvalueFieldsSearch = System.Text.Json.JsonEncodedText.Encode("max_docvalue_fields_search"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInnerResultWindow = System.Text.Json.JsonEncodedText.Encode("max_inner_result_window"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNgramDiff = System.Text.Json.JsonEncodedText.Encode("max_ngram_diff"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRefreshListeners = System.Text.Json.JsonEncodedText.Encode("max_refresh_listeners"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRegexLength = System.Text.Json.JsonEncodedText.Encode("max_regex_length"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRescoreWindow = System.Text.Json.JsonEncodedText.Encode("max_rescore_window"); + private static readonly System.Text.Json.JsonEncodedText PropMaxResultWindow = System.Text.Json.JsonEncodedText.Encode("max_result_window"); + private static readonly System.Text.Json.JsonEncodedText PropMaxScriptFields = System.Text.Json.JsonEncodedText.Encode("max_script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropMaxShingleDiff = System.Text.Json.JsonEncodedText.Encode("max_shingle_diff"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSlicesPerScroll = System.Text.Json.JsonEncodedText.Encode("max_slices_per_scroll"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTermsCount = System.Text.Json.JsonEncodedText.Encode("max_terms_count"); + private static readonly System.Text.Json.JsonEncodedText PropMerge = System.Text.Json.JsonEncodedText.Encode("merge"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfReplicas = System.Text.Json.JsonEncodedText.Encode("number_of_replicas"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfRoutingShards = System.Text.Json.JsonEncodedText.Encode("number_of_routing_shards"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfShards = System.Text.Json.JsonEncodedText.Encode("number_of_shards"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropProvidedName = System.Text.Json.JsonEncodedText.Encode("provided_name"); + private static readonly System.Text.Json.JsonEncodedText PropQueries = System.Text.Json.JsonEncodedText.Encode("queries"); + private static readonly System.Text.Json.JsonEncodedText PropQueryString = System.Text.Json.JsonEncodedText.Encode("query_string"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshInterval = System.Text.Json.JsonEncodedText.Encode("refresh_interval"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingPartitionSize = System.Text.Json.JsonEncodedText.Encode("routing_partition_size"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingPath = System.Text.Json.JsonEncodedText.Encode("routing_path"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropSoftDeletes = System.Text.Json.JsonEncodedText.Encode("soft_deletes"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeries = System.Text.Json.JsonEncodedText.Encode("time_series"); + private static readonly System.Text.Json.JsonEncodedText PropTopMetricsMaxSize = System.Text.Json.JsonEncodedText.Encode("top_metrics_max_size"); + private static readonly System.Text.Json.JsonEncodedText PropTranslog = System.Text.Json.JsonEncodedText.Encode("translog"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + private static readonly System.Text.Json.JsonEncodedText PropVerifiedBeforeClose = System.Text.Json.JsonEncodedText.Encode("verified_before_close"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyze = default; + LocalJsonValue propAutoExpandReplicas = default; + LocalJsonValue propBlocks = default; + LocalJsonValue propCheckOnStartup = default; + LocalJsonValue propCodec = default; + LocalJsonValue propCreationDate = default; + LocalJsonValue propCreationDateString = default; + LocalJsonValue propDefaultPipeline = default; + LocalJsonValue propFinalPipeline = default; + LocalJsonValue?> propFormat = default; + LocalJsonValue propGcDeletes = default; + LocalJsonValue?> propHidden = default; + LocalJsonValue propHighlight = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexingPressure = default; + LocalJsonValue propIndexingSlowlog = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propLoadFixedBitsetFiltersEagerly = default; + LocalJsonValue propMapping = default; + LocalJsonValue propMaxDocvalueFieldsSearch = default; + LocalJsonValue propMaxInnerResultWindow = default; + LocalJsonValue propMaxNgramDiff = default; + LocalJsonValue propMaxRefreshListeners = default; + LocalJsonValue propMaxRegexLength = default; + LocalJsonValue propMaxRescoreWindow = default; + LocalJsonValue propMaxResultWindow = default; + LocalJsonValue propMaxScriptFields = default; + LocalJsonValue propMaxShingleDiff = default; + LocalJsonValue propMaxSlicesPerScroll = default; + LocalJsonValue propMaxTermsCount = default; + LocalJsonValue propMerge = default; + LocalJsonValue propMode = default; + LocalJsonValue?> propNumberOfReplicas = default; + LocalJsonValue propNumberOfRoutingShards = default; + LocalJsonValue?> propNumberOfShards = default; + System.Collections.Generic.Dictionary? propOtherSettings = default; + LocalJsonValue?> propPriority = default; + LocalJsonValue propProvidedName = default; + LocalJsonValue propQueries = default; + LocalJsonValue propQueryString = default; + LocalJsonValue propRefreshInterval = default; + LocalJsonValue propRouting = default; + LocalJsonValue propRoutingPartitionSize = default; + LocalJsonValue?> propRoutingPath = default; + LocalJsonValue propSearch = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propSoftDeletes = default; + LocalJsonValue propSort = default; + LocalJsonValue propStore = default; + LocalJsonValue propTimeSeries = default; + LocalJsonValue propTopMetricsMaxSize = default; + LocalJsonValue propTranslog = default; + LocalJsonValue propUuid = default; + LocalJsonValue?> propVerifiedBeforeClose = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) { - var property = reader.GetString(); - if (property == "analysis") - { - variant.Analysis = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "analyze") - { - variant.Analyze = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "auto_expand_replicas") - { - variant.AutoExpandReplicas = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "blocks") - { - variant.Blocks = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "check_on_startup") - { - variant.CheckOnStartup = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "codec") - { - variant.Codec = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "creation_date") - { - variant.CreationDate = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "creation_date_string") - { - variant.CreationDateString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "default_pipeline") - { - variant.DefaultPipeline = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "final_pipeline") - { - variant.FinalPipeline = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "format") - { - variant.Format = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gc_deletes") - { - variant.GcDeletes = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "hidden") - { - variant.Hidden = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "highlight") - { - variant.Highlight = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "index") - { - variant.Index = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indexing_pressure") - { - variant.IndexingPressure = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indexing.slowlog") - { - variant.IndexingSlowlog = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lifecycle") - { - variant.Lifecycle = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "load_fixed_bitset_filters_eagerly") - { - variant.LoadFixedBitsetFiltersEagerly = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "mapping") - { - variant.Mapping = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_docvalue_fields_search") - { - variant.MaxDocvalueFieldsSearch = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_inner_result_window") - { - variant.MaxInnerResultWindow = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_ngram_diff") - { - variant.MaxNgramDiff = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_refresh_listeners") - { - variant.MaxRefreshListeners = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_regex_length") - { - variant.MaxRegexLength = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_rescore_window") - { - variant.MaxRescoreWindow = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_result_window") - { - variant.MaxResultWindow = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_script_fields") - { - variant.MaxScriptFields = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_shingle_diff") - { - variant.MaxShingleDiff = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_slices_per_scroll") - { - variant.MaxSlicesPerScroll = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_terms_count") - { - variant.MaxTermsCount = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "merge") - { - variant.Merge = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "mode") - { - variant.Mode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "number_of_replicas") - { - variant.NumberOfReplicas = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "number_of_routing_shards") - { - variant.NumberOfRoutingShards = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "number_of_shards") - { - variant.NumberOfShards = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "priority") - { - variant.Priority = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "provided_name") - { - variant.ProvidedName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "queries") - { - variant.Queries = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query_string") - { - variant.QueryString = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "refresh_interval") - { - variant.RefreshInterval = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "routing") - { - variant.Routing = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "routing_partition_size") - { - variant.RoutingPartitionSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "routing_path") - { - variant.RoutingPath = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "search") - { - variant.Search = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "settings") - { - variant.Settings = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "similarity") - { - variant.Similarity = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "soft_deletes") - { - variant.SoftDeletes = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "sort") - { - variant.Sort = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "store") - { - variant.Store = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "time_series") - { - variant.TimeSeries = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "top_metrics_max_size") - { - variant.TopMetricsMaxSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "translog") - { - variant.Translog = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "uuid") - { - variant.Uuid = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "verified_before_close") - { - variant.VerifiedBeforeClose = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - variant.Version = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } - } - - variant.OtherSettings = additionalProperties; - return variant; - } - public override void Write(Utf8JsonWriter writer, IndexSettings value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.OtherSettings is not null) - { - foreach (var additionalProperty in value.OtherSettings) + if (propAnalyze.TryReadProperty(ref reader, options, PropAnalyze, null)) { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); + continue; } - } - if (value.Analysis is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, value.Analysis, options); - } - - if (value.Analyze is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, value.Analyze, options); - } + if (propAutoExpandReplicas.TryReadProperty(ref reader, options, PropAutoExpandReplicas, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.AutoExpandReplicas)) - { - writer.WritePropertyName("auto_expand_replicas"); - writer.WriteStringValue(value.AutoExpandReplicas); - } + if (propBlocks.TryReadProperty(ref reader, options, PropBlocks, null)) + { + continue; + } - if (value.Blocks is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, value.Blocks, options); - } + if (propCheckOnStartup.TryReadProperty(ref reader, options, PropCheckOnStartup, null)) + { + continue; + } - if (value.CheckOnStartup is not null) - { - writer.WritePropertyName("check_on_startup"); - JsonSerializer.Serialize(writer, value.CheckOnStartup, options); - } + if (propCodec.TryReadProperty(ref reader, options, PropCodec, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Codec)) - { - writer.WritePropertyName("codec"); - writer.WriteStringValue(value.Codec); - } + if (propCreationDate.TryReadProperty(ref reader, options, PropCreationDate, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } - if (value.CreationDate.HasValue) - { - writer.WritePropertyName("creation_date"); - writer.WriteNumberValue(value.CreationDate.Value); - } + if (propCreationDateString.TryReadProperty(ref reader, options, PropCreationDateString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } - if (value.CreationDateString is not null) - { - writer.WritePropertyName("creation_date_string"); - JsonSerializer.Serialize(writer, value.CreationDateString, options); - } + if (propDefaultPipeline.TryReadProperty(ref reader, options, PropDefaultPipeline, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.DefaultPipeline)) - { - writer.WritePropertyName("default_pipeline"); - writer.WriteStringValue(value.DefaultPipeline); - } + if (propFinalPipeline.TryReadProperty(ref reader, options, PropFinalPipeline, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.FinalPipeline)) - { - writer.WritePropertyName("final_pipeline"); - writer.WriteStringValue(value.FinalPipeline); - } + if (propFormat.TryReadProperty(ref reader, options, PropFormat, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number), null, null))) + { + continue; + } - if (value.Format is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, value.Format, options); - } + if (propGcDeletes.TryReadProperty(ref reader, options, PropGcDeletes, null)) + { + continue; + } - if (value.GcDeletes is not null) - { - writer.WritePropertyName("gc_deletes"); - JsonSerializer.Serialize(writer, value.GcDeletes, options); - } + if (propHidden.TryReadProperty(ref reader, options, PropHidden, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } - if (value.Hidden is not null) - { - writer.WritePropertyName("hidden"); - JsonSerializer.Serialize(writer, value.Hidden, options); - } + if (propHighlight.TryReadProperty(ref reader, options, PropHighlight, null)) + { + continue; + } - if (value.Highlight is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, value.Highlight, options); - } + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } - if (value.Index is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, value.Index, options); - } + if (propIndexingPressure.TryReadProperty(ref reader, options, PropIndexingPressure, null)) + { + continue; + } - if (value.IndexingPressure is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, value.IndexingPressure, options); - } + if (propIndexingSlowlog.TryReadProperty(ref reader, options, PropIndexingSlowlog, null)) + { + continue; + } - if (value.IndexingSlowlog is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, value.IndexingSlowlog, options); - } + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } - if (value.Lifecycle is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, value.Lifecycle, options); - } + if (propLoadFixedBitsetFiltersEagerly.TryReadProperty(ref reader, options, PropLoadFixedBitsetFiltersEagerly, null)) + { + continue; + } - if (value.LoadFixedBitsetFiltersEagerly.HasValue) - { - writer.WritePropertyName("load_fixed_bitset_filters_eagerly"); - writer.WriteBooleanValue(value.LoadFixedBitsetFiltersEagerly.Value); - } + if (propMapping.TryReadProperty(ref reader, options, PropMapping, null)) + { + continue; + } - if (value.Mapping is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, value.Mapping, options); - } + if (propMaxDocvalueFieldsSearch.TryReadProperty(ref reader, options, PropMaxDocvalueFieldsSearch, null)) + { + continue; + } - if (value.MaxDocvalueFieldsSearch.HasValue) - { - writer.WritePropertyName("max_docvalue_fields_search"); - writer.WriteNumberValue(value.MaxDocvalueFieldsSearch.Value); - } + if (propMaxInnerResultWindow.TryReadProperty(ref reader, options, PropMaxInnerResultWindow, null)) + { + continue; + } - if (value.MaxInnerResultWindow.HasValue) - { - writer.WritePropertyName("max_inner_result_window"); - writer.WriteNumberValue(value.MaxInnerResultWindow.Value); - } + if (propMaxNgramDiff.TryReadProperty(ref reader, options, PropMaxNgramDiff, null)) + { + continue; + } - if (value.MaxNgramDiff.HasValue) - { - writer.WritePropertyName("max_ngram_diff"); - writer.WriteNumberValue(value.MaxNgramDiff.Value); - } + if (propMaxRefreshListeners.TryReadProperty(ref reader, options, PropMaxRefreshListeners, null)) + { + continue; + } - if (value.MaxRefreshListeners.HasValue) - { - writer.WritePropertyName("max_refresh_listeners"); - writer.WriteNumberValue(value.MaxRefreshListeners.Value); - } + if (propMaxRegexLength.TryReadProperty(ref reader, options, PropMaxRegexLength, null)) + { + continue; + } - if (value.MaxRegexLength.HasValue) - { - writer.WritePropertyName("max_regex_length"); - writer.WriteNumberValue(value.MaxRegexLength.Value); - } + if (propMaxRescoreWindow.TryReadProperty(ref reader, options, PropMaxRescoreWindow, null)) + { + continue; + } - if (value.MaxRescoreWindow.HasValue) - { - writer.WritePropertyName("max_rescore_window"); - writer.WriteNumberValue(value.MaxRescoreWindow.Value); - } + if (propMaxResultWindow.TryReadProperty(ref reader, options, PropMaxResultWindow, null)) + { + continue; + } - if (value.MaxResultWindow.HasValue) - { - writer.WritePropertyName("max_result_window"); - writer.WriteNumberValue(value.MaxResultWindow.Value); - } + if (propMaxScriptFields.TryReadProperty(ref reader, options, PropMaxScriptFields, null)) + { + continue; + } - if (value.MaxScriptFields.HasValue) - { - writer.WritePropertyName("max_script_fields"); - writer.WriteNumberValue(value.MaxScriptFields.Value); - } + if (propMaxShingleDiff.TryReadProperty(ref reader, options, PropMaxShingleDiff, null)) + { + continue; + } - if (value.MaxShingleDiff.HasValue) - { - writer.WritePropertyName("max_shingle_diff"); - writer.WriteNumberValue(value.MaxShingleDiff.Value); - } + if (propMaxSlicesPerScroll.TryReadProperty(ref reader, options, PropMaxSlicesPerScroll, null)) + { + continue; + } - if (value.MaxSlicesPerScroll.HasValue) - { - writer.WritePropertyName("max_slices_per_scroll"); - writer.WriteNumberValue(value.MaxSlicesPerScroll.Value); - } + if (propMaxTermsCount.TryReadProperty(ref reader, options, PropMaxTermsCount, null)) + { + continue; + } - if (value.MaxTermsCount.HasValue) - { - writer.WritePropertyName("max_terms_count"); - writer.WriteNumberValue(value.MaxTermsCount.Value); - } + if (propMerge.TryReadProperty(ref reader, options, PropMerge, null)) + { + continue; + } - if (value.Merge is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, value.Merge, options); - } + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Mode)) - { - writer.WritePropertyName("mode"); - writer.WriteStringValue(value.Mode); - } + if (propNumberOfReplicas.TryReadProperty(ref reader, options, PropNumberOfReplicas, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } - if (value.NumberOfReplicas is not null) - { - writer.WritePropertyName("number_of_replicas"); - JsonSerializer.Serialize(writer, value.NumberOfReplicas, options); - } + if (propNumberOfRoutingShards.TryReadProperty(ref reader, options, PropNumberOfRoutingShards, null)) + { + continue; + } - if (value.NumberOfRoutingShards.HasValue) - { - writer.WritePropertyName("number_of_routing_shards"); - writer.WriteNumberValue(value.NumberOfRoutingShards.Value); - } + if (propNumberOfShards.TryReadProperty(ref reader, options, PropNumberOfShards, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } - if (value.NumberOfShards is not null) - { - writer.WritePropertyName("number_of_shards"); - JsonSerializer.Serialize(writer, value.NumberOfShards, options); - } + if (propPriority.TryReadProperty(ref reader, options, PropPriority, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } - if (value.Priority is not null) - { - writer.WritePropertyName("priority"); - JsonSerializer.Serialize(writer, value.Priority, options); - } + if (propProvidedName.TryReadProperty(ref reader, options, PropProvidedName, null)) + { + continue; + } - if (value.ProvidedName is not null) - { - writer.WritePropertyName("provided_name"); - JsonSerializer.Serialize(writer, value.ProvidedName, options); - } + if (propQueries.TryReadProperty(ref reader, options, PropQueries, null)) + { + continue; + } - if (value.Queries is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, value.Queries, options); - } + if (propQueryString.TryReadProperty(ref reader, options, PropQueryString, null)) + { + continue; + } - if (value.QueryString is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, value.QueryString, options); - } + if (propRefreshInterval.TryReadProperty(ref reader, options, PropRefreshInterval, null)) + { + continue; + } - if (value.RefreshInterval is not null) - { - writer.WritePropertyName("refresh_interval"); - JsonSerializer.Serialize(writer, value.RefreshInterval, options); - } + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } - if (value.Routing is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, value.Routing, options); - } + if (propRoutingPartitionSize.TryReadProperty(ref reader, options, PropRoutingPartitionSize, null)) + { + continue; + } - if (value.RoutingPartitionSize.HasValue) - { - writer.WritePropertyName("routing_partition_size"); - writer.WriteNumberValue(value.RoutingPartitionSize.Value); - } + if (propRoutingPath.TryReadProperty(ref reader, options, PropRoutingPath, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (value.RoutingPath is not null) - { - writer.WritePropertyName("routing_path"); - JsonSerializer.Serialize(writer, value.RoutingPath, options); - } + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } - if (value.Search is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, value.Search, options); - } + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - if (value.Settings is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, value.Settings, options); - } + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } - if (value.Similarity is not null) - { - writer.WritePropertyName("similarity"); - JsonSerializer.Serialize(writer, value.Similarity, options); - } + if (propSoftDeletes.TryReadProperty(ref reader, options, PropSoftDeletes, null)) + { + continue; + } - if (value.SoftDeletes is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, value.SoftDeletes, options); - } + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } - if (value.Sort is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, value.Sort, options); - } + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } - if (value.Store is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, value.Store, options); - } + if (propTimeSeries.TryReadProperty(ref reader, options, PropTimeSeries, null)) + { + continue; + } - if (value.TimeSeries is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, value.TimeSeries, options); - } + if (propTopMetricsMaxSize.TryReadProperty(ref reader, options, PropTopMetricsMaxSize, null)) + { + continue; + } - if (value.TopMetricsMaxSize.HasValue) - { - writer.WritePropertyName("top_metrics_max_size"); - writer.WriteNumberValue(value.TopMetricsMaxSize.Value); - } + if (propTranslog.TryReadProperty(ref reader, options, PropTranslog, null)) + { + continue; + } - if (value.Translog is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, value.Translog, options); - } + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Uuid)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(value.Uuid); - } + if (propVerifiedBeforeClose.TryReadProperty(ref reader, options, PropVerifiedBeforeClose, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } - if (value.VerifiedBeforeClose is not null) - { - writer.WritePropertyName("verified_before_close"); - JsonSerializer.Serialize(writer, value.VerifiedBeforeClose, options); - } + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } - if (value.Version is not null) + propOtherSettings ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propOtherSettings[key] = value; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analysis = propAnalysis.Value, + Analyze = propAnalyze.Value, + AutoExpandReplicas = propAutoExpandReplicas.Value, + Blocks = propBlocks.Value, + CheckOnStartup = propCheckOnStartup.Value, + Codec = propCodec.Value, + CreationDate = propCreationDate.Value, + CreationDateString = propCreationDateString.Value, + DefaultPipeline = propDefaultPipeline.Value, + FinalPipeline = propFinalPipeline.Value, + Format = propFormat.Value, + GcDeletes = propGcDeletes.Value, + Hidden = propHidden.Value, + Highlight = propHighlight.Value, + Index = propIndex.Value, + IndexingPressure = propIndexingPressure.Value, + IndexingSlowlog = propIndexingSlowlog.Value, + Lifecycle = propLifecycle.Value, + LoadFixedBitsetFiltersEagerly = propLoadFixedBitsetFiltersEagerly.Value, + Mapping = propMapping.Value, + MaxDocvalueFieldsSearch = propMaxDocvalueFieldsSearch.Value, + MaxInnerResultWindow = propMaxInnerResultWindow.Value, + MaxNgramDiff = propMaxNgramDiff.Value, + MaxRefreshListeners = propMaxRefreshListeners.Value, + MaxRegexLength = propMaxRegexLength.Value, + MaxRescoreWindow = propMaxRescoreWindow.Value, + MaxResultWindow = propMaxResultWindow.Value, + MaxScriptFields = propMaxScriptFields.Value, + MaxShingleDiff = propMaxShingleDiff.Value, + MaxSlicesPerScroll = propMaxSlicesPerScroll.Value, + MaxTermsCount = propMaxTermsCount.Value, + Merge = propMerge.Value, + Mode = propMode.Value, + NumberOfReplicas = propNumberOfReplicas.Value, + NumberOfRoutingShards = propNumberOfRoutingShards.Value, + NumberOfShards = propNumberOfShards.Value, + OtherSettings = propOtherSettings, + Priority = propPriority.Value, + ProvidedName = propProvidedName.Value, + Queries = propQueries.Value, + QueryString = propQueryString.Value, + RefreshInterval = propRefreshInterval.Value, + Routing = propRouting.Value, + RoutingPartitionSize = propRoutingPartitionSize.Value, + RoutingPath = propRoutingPath.Value, + Search = propSearch.Value, + Settings = propSettings.Value, + Similarity = propSimilarity.Value, + SoftDeletes = propSoftDeletes.Value, + Sort = propSort.Value, + Store = propStore.Value, + TimeSeries = propTimeSeries.Value, + TopMetricsMaxSize = propTopMetricsMaxSize.Value, + Translog = propTranslog.Value, + Uuid = propUuid.Value, + VerifiedBeforeClose = propVerifiedBeforeClose.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyze, value.Analyze, null, null); + writer.WriteProperty(options, PropAutoExpandReplicas, value.AutoExpandReplicas, null, null); + writer.WriteProperty(options, PropBlocks, value.Blocks, null, null); + writer.WriteProperty(options, PropCheckOnStartup, value.CheckOnStartup, null, null); + writer.WriteProperty(options, PropCodec, value.Codec, null, null); + writer.WriteProperty(options, PropCreationDate, value.CreationDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropCreationDateString, value.CreationDateString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropDefaultPipeline, value.DefaultPipeline, null, null); + writer.WriteProperty(options, PropFinalPipeline, value.FinalPipeline, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropGcDeletes, value.GcDeletes, null, null); + writer.WriteProperty(options, PropHidden, value.Hidden, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropHighlight, value.Highlight, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexingPressure, value.IndexingPressure, null, null); + writer.WriteProperty(options, PropIndexingSlowlog, value.IndexingSlowlog, null, null); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropLoadFixedBitsetFiltersEagerly, value.LoadFixedBitsetFiltersEagerly, null, null); + writer.WriteProperty(options, PropMapping, value.Mapping, null, null); + writer.WriteProperty(options, PropMaxDocvalueFieldsSearch, value.MaxDocvalueFieldsSearch, null, null); + writer.WriteProperty(options, PropMaxInnerResultWindow, value.MaxInnerResultWindow, null, null); + writer.WriteProperty(options, PropMaxNgramDiff, value.MaxNgramDiff, null, null); + writer.WriteProperty(options, PropMaxRefreshListeners, value.MaxRefreshListeners, null, null); + writer.WriteProperty(options, PropMaxRegexLength, value.MaxRegexLength, null, null); + writer.WriteProperty(options, PropMaxRescoreWindow, value.MaxRescoreWindow, null, null); + writer.WriteProperty(options, PropMaxResultWindow, value.MaxResultWindow, null, null); + writer.WriteProperty(options, PropMaxScriptFields, value.MaxScriptFields, null, null); + writer.WriteProperty(options, PropMaxShingleDiff, value.MaxShingleDiff, null, null); + writer.WriteProperty(options, PropMaxSlicesPerScroll, value.MaxSlicesPerScroll, null, null); + writer.WriteProperty(options, PropMaxTermsCount, value.MaxTermsCount, null, null); + writer.WriteProperty(options, PropMerge, value.Merge, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropNumberOfReplicas, value.NumberOfReplicas, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropNumberOfRoutingShards, value.NumberOfRoutingShards, null, null); + writer.WriteProperty(options, PropNumberOfShards, value.NumberOfShards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropProvidedName, value.ProvidedName, null, null); + writer.WriteProperty(options, PropQueries, value.Queries, null, null); + writer.WriteProperty(options, PropQueryString, value.QueryString, null, null); + writer.WriteProperty(options, PropRefreshInterval, value.RefreshInterval, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropRoutingPartitionSize, value.RoutingPartitionSize, null, null); + writer.WriteProperty(options, PropRoutingPath, value.RoutingPath, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropSoftDeletes, value.SoftDeletes, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropTimeSeries, value.TimeSeries, null, null); + writer.WriteProperty(options, PropTopMetricsMaxSize, value.TopMetricsMaxSize, null, null); + writer.WriteProperty(options, PropTranslog, value.Translog, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteProperty(options, PropVerifiedBeforeClose, value.VerifiedBeforeClose, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + if (value.OtherSettings is not null) { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, value.Version, options); + foreach (var item in value.OtherSettings) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } } writer.WriteEndObject(); @@ -739,11 +564,27 @@ public override void Write(Utf8JsonWriter writer, IndexSettings value, JsonSeria } /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -[JsonConverter(typeof(IndexSettingsConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsConverter))] public sealed partial class IndexSettings { +#if NET7_0_OR_GREATER + public IndexSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? Analysis { get; set; } /// @@ -756,13 +597,13 @@ public sealed partial class IndexSettings public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? Blocks { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? CheckOnStartup { get; set; } public string? Codec { get; set; } - public long? CreationDate { get; set; } - public DateTimeOffset? CreationDateString { get; set; } + public System.DateTimeOffset? CreationDate { get; set; } + public System.DateTimeOffset? CreationDateString { get; set; } public string? DefaultPipeline { get; set; } public string? FinalPipeline { get; set; } - public object? Format { get; set; } + public Elastic.Clients.Elasticsearch.Union? Format { get; set; } public Elastic.Clients.Elasticsearch.Duration? GcDeletes { get; set; } - public object? Hidden { get; set; } + public Elastic.Clients.Elasticsearch.Union? Hidden { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? Highlight { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Index { get; set; } @@ -795,24 +636,24 @@ public sealed partial class IndexSettings public int? MaxTermsCount { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.Merge? Merge { get; set; } public string? Mode { get; set; } - public object? NumberOfReplicas { get; set; } + public Elastic.Clients.Elasticsearch.Union? NumberOfReplicas { get; set; } public int? NumberOfRoutingShards { get; set; } - public object? NumberOfShards { get; set; } + public Elastic.Clients.Elasticsearch.Union? NumberOfShards { get; set; } /// /// - /// Additional settings not covered in this type. Unless these settings are defined by a plugin, please open an issue on the Elasticsearch API specification so that they can be added in a future release + /// Additional settings not covered in this type. /// /// - public IDictionary OtherSettings { get; set; } - public object? Priority { get; set; } + public System.Collections.Generic.IDictionary? OtherSettings { get; set; } + public Elastic.Clients.Elasticsearch.Union? Priority { get; set; } public Elastic.Clients.Elasticsearch.Name? ProvidedName { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.Queries? Queries { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? QueryString { get; set; } public Elastic.Clients.Elasticsearch.Duration? RefreshInterval { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? Routing { get; set; } public int? RoutingPartitionSize { get; set; } - public ICollection? RoutingPath { get; set; } + public System.Collections.Generic.ICollection? RoutingPath { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? Search { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } @@ -835,304 +676,206 @@ public sealed partial class IndexSettings public int? TopMetricsMaxSize { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.Translog? Translog { get; set; } public string? Uuid { get; set; } - public object? VerifiedBeforeClose { get; set; } + public Elastic.Clients.Elasticsearch.Union? VerifiedBeforeClose { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? Version { get; set; } } /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class IndexSettingsDescriptor : SerializableDescriptor> +public readonly partial struct IndexSettingsDescriptor { - internal IndexSettingsDescriptor(Action> configure) => configure.Invoke(this); - - public IndexSettingsDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? AnalyzeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor AnalyzeDescriptor { get; set; } - private Action AnalyzeDescriptorAction { get; set; } - private string? AutoExpandReplicasValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? BlocksValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor BlocksDescriptor { get; set; } - private Action BlocksDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? CheckOnStartupValue { get; set; } - private string? CodecValue { get; set; } - private long? CreationDateValue { get; set; } - private DateTimeOffset? CreationDateStringValue { get; set; } - private string? DefaultPipelineValue { get; set; } - private string? FinalPipelineValue { get; set; } - private object? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? GcDeletesValue { get; set; } - private object? HiddenValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexDescriptor { get; set; } - private Action> IndexDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? IndexingPressureValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor IndexingPressureDescriptor { get; set; } - private Action IndexingPressureDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? IndexingSlowlogValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor IndexingSlowlogDescriptor { get; set; } - private Action IndexingSlowlogDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private bool? LoadFixedBitsetFiltersEagerlyValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor MappingDescriptor { get; set; } - private Action MappingDescriptorAction { get; set; } - private int? MaxDocvalueFieldsSearchValue { get; set; } - private int? MaxInnerResultWindowValue { get; set; } - private int? MaxNgramDiffValue { get; set; } - private int? MaxRefreshListenersValue { get; set; } - private int? MaxRegexLengthValue { get; set; } - private int? MaxRescoreWindowValue { get; set; } - private int? MaxResultWindowValue { get; set; } - private int? MaxScriptFieldsValue { get; set; } - private int? MaxShingleDiffValue { get; set; } - private int? MaxSlicesPerScrollValue { get; set; } - private int? MaxTermsCountValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Merge? MergeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor MergeDescriptor { get; set; } - private Action MergeDescriptorAction { get; set; } - private string? ModeValue { get; set; } - private object? NumberOfReplicasValue { get; set; } - private int? NumberOfRoutingShardsValue { get; set; } - private object? NumberOfShardsValue { get; set; } - private IDictionary OtherSettingsValue { get; set; } - private object? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? ProvidedNameValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Queries? QueriesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor QueriesDescriptor { get; set; } - private Action QueriesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? QueryStringValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor QueryStringDescriptor { get; set; } - private Action QueryStringDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? RefreshIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private int? RoutingPartitionSizeValue { get; set; } - private ICollection? RoutingPathValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? SearchValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor SearchDescriptor { get; set; } - private Action SearchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? SimilarityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? SoftDeletesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor SoftDeletesDescriptor { get; set; } - private Action SoftDeletesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Storage? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor StoreDescriptor { get; set; } - private Action StoreDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? TimeSeriesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor TimeSeriesDescriptor { get; set; } - private Action TimeSeriesDescriptorAction { get; set; } - private int? TopMetricsMaxSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Translog? TranslogValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor TranslogDescriptor { get; set; } - private Action TranslogDescriptorAction { get; set; } - private string? UuidValue { get; set; } - private object? VerifiedBeforeCloseValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor VersionDescriptor { get; set; } - private Action VersionDescriptorAction { get; set; } - - public IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? analysis) - { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; - } - - public IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor descriptor) - { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Analysis(Action configure) - { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; - } + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Instance { get; init; } - /// - /// - /// Settings to define analyzers, tokenizers, token filters and character filters. - /// - /// - public IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? analyze) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings instance) { - AnalyzeDescriptor = null; - AnalyzeDescriptorAction = null; - AnalyzeValue = analyze; - return Self; + Instance = instance; } - public IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsDescriptor() { - AnalyzeValue = null; - AnalyzeDescriptorAction = null; - AnalyzeDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexSettingsDescriptor Analyze(Action configure) - { - AnalyzeValue = null; - AnalyzeDescriptor = null; - AnalyzeDescriptorAction = configure; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) => descriptor.Instance; - public IndexSettingsDescriptor AutoExpandReplicas(string? autoExpandReplicas) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? value) { - AutoExpandReplicasValue = autoExpandReplicas; - return Self; + Instance.Analysis = value; + return this; } - public IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? blocks) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis() { - BlocksDescriptor = null; - BlocksDescriptorAction = null; - BlocksValue = blocks; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis(System.Action? action) { - BlocksValue = null; - BlocksDescriptorAction = null; - BlocksDescriptor = descriptor; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Blocks(Action configure) + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? value) { - BlocksValue = null; - BlocksDescriptor = null; - BlocksDescriptorAction = configure; - return Self; + Instance.Analyze = value; + return this; } - public IndexSettingsDescriptor CheckOnStartup(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? checkOnStartup) + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze() + { + Instance.Analyze = Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor.Build(null); + return this; + } + + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze(System.Action? action) + { + Instance.Analyze = Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor AutoExpandReplicas(string? value) { - CheckOnStartupValue = checkOnStartup; - return Self; + Instance.AutoExpandReplicas = value; + return this; } - public IndexSettingsDescriptor Codec(string? codec) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? value) { - CodecValue = codec; - return Self; + Instance.Blocks = value; + return this; } - public IndexSettingsDescriptor CreationDate(long? creationDate) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks() { - CreationDateValue = creationDate; - return Self; + Instance.Blocks = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor CreationDateString(DateTimeOffset? creationDateString) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks(System.Action? action) { - CreationDateStringValue = creationDateString; - return Self; + Instance.Blocks = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor DefaultPipeline(string? defaultPipeline) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CheckOnStartup(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? value) { - DefaultPipelineValue = defaultPipeline; - return Self; + Instance.CheckOnStartup = value; + return this; } - public IndexSettingsDescriptor FinalPipeline(string? finalPipeline) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Codec(string? value) { - FinalPipelineValue = finalPipeline; - return Self; + Instance.Codec = value; + return this; } - public IndexSettingsDescriptor Format(object? format) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CreationDate(System.DateTimeOffset? value) { - FormatValue = format; - return Self; + Instance.CreationDate = value; + return this; } - public IndexSettingsDescriptor GcDeletes(Elastic.Clients.Elasticsearch.Duration? gcDeletes) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CreationDateString(System.DateTimeOffset? value) { - GcDeletesValue = gcDeletes; - return Self; + Instance.CreationDateString = value; + return this; } - public IndexSettingsDescriptor Hidden(object? hidden) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor DefaultPipeline(string? value) { - HiddenValue = hidden; - return Self; + Instance.DefaultPipeline = value; + return this; } - public IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? highlight) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor FinalPipeline(string? value) { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; + Instance.FinalPipeline = value; + return this; } - public IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Format(Elastic.Clients.Elasticsearch.Union? value) { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; + Instance.Format = value; + return this; } - public IndexSettingsDescriptor Highlight(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor GcDeletes(Elastic.Clients.Elasticsearch.Duration? value) { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; + Instance.GcDeletes = value; + return this; } - public IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? index) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Hidden(Elastic.Clients.Elasticsearch.Union? value) { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexValue = index; - return Self; + Instance.Hidden = value; + return this; } - public IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? value) { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptor = descriptor; - return Self; + Instance.Highlight = value; + return this; } - public IndexSettingsDescriptor Index(Action> configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight() + { + Instance.Highlight = Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight(System.Action? action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.Index = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index() + { + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index(System.Action>? action) + { + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + /// + /// + /// Configure indexing back pressure limits. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? value) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = configure; - return Self; + Instance.IndexingPressure = value; + return this; } /// @@ -1140,82 +883,74 @@ public IndexSettingsDescriptor Index(Action /// - public IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? indexingPressure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingPressure(System.Action action) { - IndexingPressureDescriptor = null; - IndexingPressureDescriptorAction = null; - IndexingPressureValue = indexingPressure; - return Self; + Instance.IndexingPressure = Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? value) { - IndexingPressureValue = null; - IndexingPressureDescriptorAction = null; - IndexingPressureDescriptor = descriptor; - return Self; + Instance.IndexingSlowlog = value; + return this; } - public IndexSettingsDescriptor IndexingPressure(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog() { - IndexingPressureValue = null; - IndexingPressureDescriptor = null; - IndexingPressureDescriptorAction = configure; - return Self; + Instance.IndexingSlowlog = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? indexingSlowlog) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog(System.Action? action) { - IndexingSlowlogDescriptor = null; - IndexingSlowlogDescriptorAction = null; - IndexingSlowlogValue = indexingSlowlog; - return Self; + Instance.IndexingSlowlog = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? value) { - IndexingSlowlogValue = null; - IndexingSlowlogDescriptorAction = null; - IndexingSlowlogDescriptor = descriptor; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexSettingsDescriptor IndexingSlowlog(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle() { - IndexingSlowlogValue = null; - IndexingSlowlogDescriptor = null; - IndexingSlowlogDescriptorAction = configure; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? lifecycle) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle(System.Action? action) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? value = true) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.LoadFixedBitsetFiltersEagerly = value; + return this; } - public IndexSettingsDescriptor Lifecycle(Action configure) + /// + /// + /// Enable or disable dynamic mapping for an index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? value) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Mapping = value; + return this; } - public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? loadFixedBitsetFiltersEagerly = true) + /// + /// + /// Enable or disable dynamic mapping for an index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping() { - LoadFixedBitsetFiltersEagerlyValue = loadFixedBitsetFiltersEagerly; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor.Build(null); + return this; } /// @@ -1223,303 +958,278 @@ public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? lo /// Enable or disable dynamic mapping for an index. /// /// - public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mapping) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping(System.Action? action) { - MappingDescriptor = null; - MappingDescriptorAction = null; - MappingValue = mapping; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxDocvalueFieldsSearch(int? value) { - MappingValue = null; - MappingDescriptorAction = null; - MappingDescriptor = descriptor; - return Self; + Instance.MaxDocvalueFieldsSearch = value; + return this; } - public IndexSettingsDescriptor Mapping(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxInnerResultWindow(int? value) { - MappingValue = null; - MappingDescriptor = null; - MappingDescriptorAction = configure; - return Self; + Instance.MaxInnerResultWindow = value; + return this; } - public IndexSettingsDescriptor MaxDocvalueFieldsSearch(int? maxDocvalueFieldsSearch) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxNgramDiff(int? value) { - MaxDocvalueFieldsSearchValue = maxDocvalueFieldsSearch; - return Self; + Instance.MaxNgramDiff = value; + return this; } - public IndexSettingsDescriptor MaxInnerResultWindow(int? maxInnerResultWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRefreshListeners(int? value) { - MaxInnerResultWindowValue = maxInnerResultWindow; - return Self; + Instance.MaxRefreshListeners = value; + return this; } - public IndexSettingsDescriptor MaxNgramDiff(int? maxNgramDiff) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRegexLength(int? value) { - MaxNgramDiffValue = maxNgramDiff; - return Self; + Instance.MaxRegexLength = value; + return this; } - public IndexSettingsDescriptor MaxRefreshListeners(int? maxRefreshListeners) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRescoreWindow(int? value) { - MaxRefreshListenersValue = maxRefreshListeners; - return Self; + Instance.MaxRescoreWindow = value; + return this; } - public IndexSettingsDescriptor MaxRegexLength(int? maxRegexLength) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxResultWindow(int? value) { - MaxRegexLengthValue = maxRegexLength; - return Self; + Instance.MaxResultWindow = value; + return this; } - public IndexSettingsDescriptor MaxRescoreWindow(int? maxRescoreWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxScriptFields(int? value) { - MaxRescoreWindowValue = maxRescoreWindow; - return Self; + Instance.MaxScriptFields = value; + return this; } - public IndexSettingsDescriptor MaxResultWindow(int? maxResultWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxShingleDiff(int? value) { - MaxResultWindowValue = maxResultWindow; - return Self; + Instance.MaxShingleDiff = value; + return this; } - public IndexSettingsDescriptor MaxScriptFields(int? maxScriptFields) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxSlicesPerScroll(int? value) { - MaxScriptFieldsValue = maxScriptFields; - return Self; + Instance.MaxSlicesPerScroll = value; + return this; } - public IndexSettingsDescriptor MaxShingleDiff(int? maxShingleDiff) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxTermsCount(int? value) { - MaxShingleDiffValue = maxShingleDiff; - return Self; + Instance.MaxTermsCount = value; + return this; } - public IndexSettingsDescriptor MaxSlicesPerScroll(int? maxSlicesPerScroll) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.Merge? value) { - MaxSlicesPerScrollValue = maxSlicesPerScroll; - return Self; + Instance.Merge = value; + return this; } - public IndexSettingsDescriptor MaxTermsCount(int? maxTermsCount) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge() { - MaxTermsCountValue = maxTermsCount; - return Self; + Instance.Merge = Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.Merge? merge) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge(System.Action? action) { - MergeDescriptor = null; - MergeDescriptorAction = null; - MergeValue = merge; - return Self; + Instance.Merge = Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mode(string? value) { - MergeValue = null; - MergeDescriptorAction = null; - MergeDescriptor = descriptor; - return Self; + Instance.Mode = value; + return this; } - public IndexSettingsDescriptor Merge(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfReplicas(Elastic.Clients.Elasticsearch.Union? value) { - MergeValue = null; - MergeDescriptor = null; - MergeDescriptorAction = configure; - return Self; + Instance.NumberOfReplicas = value; + return this; } - public IndexSettingsDescriptor Mode(string? mode) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfRoutingShards(int? value) { - ModeValue = mode; - return Self; + Instance.NumberOfRoutingShards = value; + return this; } - public IndexSettingsDescriptor NumberOfReplicas(object? numberOfReplicas) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfShards(Elastic.Clients.Elasticsearch.Union? value) { - NumberOfReplicasValue = numberOfReplicas; - return Self; + Instance.NumberOfShards = value; + return this; } - public IndexSettingsDescriptor NumberOfRoutingShards(int? numberOfRoutingShards) + /// + /// + /// Additional settings not covered in this type. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings(System.Collections.Generic.IDictionary? value) { - NumberOfRoutingShardsValue = numberOfRoutingShards; - return Self; + Instance.OtherSettings = value; + return this; } - public IndexSettingsDescriptor NumberOfShards(object? numberOfShards) + /// + /// + /// Additional settings not covered in this type. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings() { - NumberOfShardsValue = numberOfShards; - return Self; + Instance.OtherSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// /// - /// Additional settings not covered in this type. Unless these settings are defined by a plugin, please open an issue on the Elasticsearch API specification so that they can be added in a future release + /// Additional settings not covered in this type. /// /// - public IndexSettingsDescriptor OtherSettings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings(System.Action? action) + { + Instance.OtherSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor AddOtherSetting(string key, object value) { - OtherSettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.OtherSettings ??= new System.Collections.Generic.Dictionary(); + Instance.OtherSettings.Add(key, value); + return this; } - public IndexSettingsDescriptor Priority(object? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Priority(Elastic.Clients.Elasticsearch.Union? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } - public IndexSettingsDescriptor ProvidedName(Elastic.Clients.Elasticsearch.Name? providedName) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor ProvidedName(Elastic.Clients.Elasticsearch.Name? value) { - ProvidedNameValue = providedName; - return Self; + Instance.ProvidedName = value; + return this; } - public IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.Queries? queries) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.Queries? value) { - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesValue = queries; - return Self; + Instance.Queries = value; + return this; } - public IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries() { - QueriesValue = null; - QueriesDescriptorAction = null; - QueriesDescriptor = descriptor; - return Self; + Instance.Queries = Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Queries(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries(System.Action? action) { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorAction = configure; - return Self; + Instance.Queries = Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? queryString) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? value) { - QueryStringDescriptor = null; - QueryStringDescriptorAction = null; - QueryStringValue = queryString; - return Self; + Instance.QueryString = value; + return this; } - public IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor QueryString(System.Action action) { - QueryStringValue = null; - QueryStringDescriptorAction = null; - QueryStringDescriptor = descriptor; - return Self; + Instance.QueryString = Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor QueryString(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RefreshInterval(Elastic.Clients.Elasticsearch.Duration? value) { - QueryStringValue = null; - QueryStringDescriptor = null; - QueryStringDescriptorAction = configure; - return Self; + Instance.RefreshInterval = value; + return this; } - public IndexSettingsDescriptor RefreshInterval(Elastic.Clients.Elasticsearch.Duration? refreshInterval) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? value) { - RefreshIntervalValue = refreshInterval; - return Self; + Instance.Routing = value; + return this; } - public IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing() { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing(System.Action? action) { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Routing(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPartitionSize(int? value) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.RoutingPartitionSize = value; + return this; } - public IndexSettingsDescriptor RoutingPartitionSize(int? routingPartitionSize) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPath(System.Collections.Generic.ICollection? value) { - RoutingPartitionSizeValue = routingPartitionSize; - return Self; + Instance.RoutingPath = value; + return this; } - public IndexSettingsDescriptor RoutingPath(ICollection? routingPath) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPath(params string[] values) { - RoutingPathValue = routingPath; - return Self; + Instance.RoutingPath = [.. values]; + return this; } - public IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? search) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? value) { - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchValue = search; - return Self; + Instance.Search = value; + return this; } - public IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search() { - SearchValue = null; - SearchDescriptorAction = null; - SearchDescriptor = descriptor; - return Self; + Instance.Search = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Search(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search(System.Action? action) { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorAction = configure; - return Self; + Instance.Search = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Settings(Action> configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -1527,72 +1237,68 @@ public IndexSettingsDescriptor Settings(Action /// - public IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? similarity) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - public IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor descriptor) + /// + /// + /// Configure custom similarity settings to customize how search results are scored. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Similarity(System.Action action) { - SimilarityValue = descriptor.PromisedValue; - return Self; + Instance.Similarity = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Similarity(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? value) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor(); - configure?.Invoke(descriptor); - SimilarityValue = descriptor.PromisedValue; - return Self; + Instance.SoftDeletes = value; + return this; } - public IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? softDeletes) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes() { - SoftDeletesDescriptor = null; - SoftDeletesDescriptorAction = null; - SoftDeletesValue = softDeletes; - return Self; + Instance.SoftDeletes = Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes(System.Action? action) { - SoftDeletesValue = null; - SoftDeletesDescriptorAction = null; - SoftDeletesDescriptor = descriptor; - return Self; + Instance.SoftDeletes = Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor SoftDeletes(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? value) { - SoftDeletesValue = null; - SoftDeletesDescriptor = null; - SoftDeletesDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } - public IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? sort) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort() { - SortDescriptor = null; - SortDescriptorAction = null; - SortValue = sort; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort(System.Action>? action) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Sort(Action> configure) + /// + /// + /// The store module allows you to control how index data is stored and accessed on disk. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.Storage? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = configure; - return Self; + Instance.Store = value; + return this; } /// @@ -1600,1059 +1306,375 @@ public IndexSettingsDescriptor Sort(Action /// - public IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.Storage? store) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Store(System.Action action) { - StoreDescriptor = null; - StoreDescriptorAction = null; - StoreValue = store; - return Self; + Instance.Store = Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? value) { - StoreValue = null; - StoreDescriptorAction = null; - StoreDescriptor = descriptor; - return Self; + Instance.TimeSeries = value; + return this; } - public IndexSettingsDescriptor Store(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries() { - StoreValue = null; - StoreDescriptor = null; - StoreDescriptorAction = configure; - return Self; + Instance.TimeSeries = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? timeSeries) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries(System.Action? action) { - TimeSeriesDescriptor = null; - TimeSeriesDescriptorAction = null; - TimeSeriesValue = timeSeries; - return Self; + Instance.TimeSeries = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TopMetricsMaxSize(int? value) { - TimeSeriesValue = null; - TimeSeriesDescriptorAction = null; - TimeSeriesDescriptor = descriptor; - return Self; + Instance.TopMetricsMaxSize = value; + return this; } - public IndexSettingsDescriptor TimeSeries(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.Translog? value) { - TimeSeriesValue = null; - TimeSeriesDescriptor = null; - TimeSeriesDescriptorAction = configure; - return Self; + Instance.Translog = value; + return this; } - public IndexSettingsDescriptor TopMetricsMaxSize(int? topMetricsMaxSize) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog() { - TopMetricsMaxSizeValue = topMetricsMaxSize; - return Self; + Instance.Translog = Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.Translog? translog) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog(System.Action? action) { - TranslogDescriptor = null; - TranslogDescriptorAction = null; - TranslogValue = translog; - return Self; + Instance.Translog = Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Uuid(string? value) { - TranslogValue = null; - TranslogDescriptorAction = null; - TranslogDescriptor = descriptor; - return Self; + Instance.Uuid = value; + return this; } - public IndexSettingsDescriptor Translog(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor VerifiedBeforeClose(Elastic.Clients.Elasticsearch.Union? value) { - TranslogValue = null; - TranslogDescriptor = null; - TranslogDescriptorAction = configure; - return Self; + Instance.VerifiedBeforeClose = value; + return this; } - public IndexSettingsDescriptor Uuid(string? uuid) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? value) { - UuidValue = uuid; - return Self; + Instance.Version = value; + return this; } - public IndexSettingsDescriptor VerifiedBeforeClose(object? verifiedBeforeClose) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version() { - VerifiedBeforeCloseValue = verifiedBeforeClose; - return Self; + Instance.Version = Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? version) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version(System.Action? action) { - VersionDescriptor = null; - VersionDescriptorAction = null; - VersionValue = version; - return Self; + Instance.Version = Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Build(System.Action>? action) { - VersionValue = null; - VersionDescriptorAction = null; - VersionDescriptor = descriptor; - return Self; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} + +/// +/// Learn more about this API in the Elasticsearch documentation. +/// +public readonly partial struct IndexSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Instance { get; init; } - public IndexSettingsDescriptor Version(Action configure) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings instance) { - VersionValue = null; - VersionDescriptor = null; - VersionDescriptorAction = configure; - return Self; + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsDescriptor() { - writer.WriteStartObject(); - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else if (AnalysisValue is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (AnalyzeDescriptor is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, AnalyzeDescriptor, options); - } - else if (AnalyzeDescriptorAction is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor(AnalyzeDescriptorAction), options); - } - else if (AnalyzeValue is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, AnalyzeValue, options); - } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) => descriptor.Instance; - if (!string.IsNullOrEmpty(AutoExpandReplicasValue)) - { - writer.WritePropertyName("auto_expand_replicas"); - writer.WriteStringValue(AutoExpandReplicasValue); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? value) + { + Instance.Analysis = value; + return this; + } - if (BlocksDescriptor is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, BlocksDescriptor, options); - } - else if (BlocksDescriptorAction is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor(BlocksDescriptorAction), options); - } - else if (BlocksValue is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, BlocksValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis() + { + Instance.Analysis = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor.Build(null); + return this; + } - if (CheckOnStartupValue is not null) - { - writer.WritePropertyName("check_on_startup"); - JsonSerializer.Serialize(writer, CheckOnStartupValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analysis(System.Action? action) + { + Instance.Analysis = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor.Build(action); + return this; + } - if (!string.IsNullOrEmpty(CodecValue)) - { - writer.WritePropertyName("codec"); - writer.WriteStringValue(CodecValue); - } + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? value) + { + Instance.Analyze = value; + return this; + } - if (CreationDateValue.HasValue) - { - writer.WritePropertyName("creation_date"); - writer.WriteNumberValue(CreationDateValue.Value); - } + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze() + { + Instance.Analyze = Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor.Build(null); + return this; + } - if (CreationDateStringValue is not null) - { - writer.WritePropertyName("creation_date_string"); - JsonSerializer.Serialize(writer, CreationDateStringValue, options); - } + /// + /// + /// Settings to define analyzers, tokenizers, token filters and character filters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Analyze(System.Action? action) + { + Instance.Analyze = Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor.Build(action); + return this; + } - if (!string.IsNullOrEmpty(DefaultPipelineValue)) - { - writer.WritePropertyName("default_pipeline"); - writer.WriteStringValue(DefaultPipelineValue); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor AutoExpandReplicas(string? value) + { + Instance.AutoExpandReplicas = value; + return this; + } - if (!string.IsNullOrEmpty(FinalPipelineValue)) - { - writer.WritePropertyName("final_pipeline"); - writer.WriteStringValue(FinalPipelineValue); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? value) + { + Instance.Blocks = value; + return this; + } - if (FormatValue is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks() + { + Instance.Blocks = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor.Build(null); + return this; + } - if (GcDeletesValue is not null) - { - writer.WritePropertyName("gc_deletes"); - JsonSerializer.Serialize(writer, GcDeletesValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Blocks(System.Action? action) + { + Instance.Blocks = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor.Build(action); + return this; + } - if (HiddenValue is not null) - { - writer.WritePropertyName("hidden"); - JsonSerializer.Serialize(writer, HiddenValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CheckOnStartup(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? value) + { + Instance.CheckOnStartup = value; + return this; + } - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Codec(string? value) + { + Instance.Codec = value; + return this; + } - if (IndexDescriptor is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexDescriptorAction), options); - } - else if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CreationDate(System.DateTimeOffset? value) + { + Instance.CreationDate = value; + return this; + } - if (IndexingPressureDescriptor is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, IndexingPressureDescriptor, options); - } - else if (IndexingPressureDescriptorAction is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor(IndexingPressureDescriptorAction), options); - } - else if (IndexingPressureValue is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, IndexingPressureValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor CreationDateString(System.DateTimeOffset? value) + { + Instance.CreationDateString = value; + return this; + } - if (IndexingSlowlogDescriptor is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, IndexingSlowlogDescriptor, options); - } - else if (IndexingSlowlogDescriptorAction is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor(IndexingSlowlogDescriptorAction), options); - } - else if (IndexingSlowlogValue is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, IndexingSlowlogValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor DefaultPipeline(string? value) + { + Instance.DefaultPipeline = value; + return this; + } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor FinalPipeline(string? value) + { + Instance.FinalPipeline = value; + return this; + } - if (LoadFixedBitsetFiltersEagerlyValue.HasValue) - { - writer.WritePropertyName("load_fixed_bitset_filters_eagerly"); - writer.WriteBooleanValue(LoadFixedBitsetFiltersEagerlyValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Format(Elastic.Clients.Elasticsearch.Union? value) + { + Instance.Format = value; + return this; + } - if (MappingDescriptor is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingDescriptor, options); - } - else if (MappingDescriptorAction is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor(MappingDescriptorAction), options); - } - else if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor GcDeletes(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.GcDeletes = value; + return this; + } - if (MaxDocvalueFieldsSearchValue.HasValue) - { - writer.WritePropertyName("max_docvalue_fields_search"); - writer.WriteNumberValue(MaxDocvalueFieldsSearchValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Hidden(Elastic.Clients.Elasticsearch.Union? value) + { + Instance.Hidden = value; + return this; + } - if (MaxInnerResultWindowValue.HasValue) - { - writer.WritePropertyName("max_inner_result_window"); - writer.WriteNumberValue(MaxInnerResultWindowValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? value) + { + Instance.Highlight = value; + return this; + } - if (MaxNgramDiffValue.HasValue) - { - writer.WritePropertyName("max_ngram_diff"); - writer.WriteNumberValue(MaxNgramDiffValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight() + { + Instance.Highlight = Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor.Build(null); + return this; + } - if (MaxRefreshListenersValue.HasValue) - { - writer.WritePropertyName("max_refresh_listeners"); - writer.WriteNumberValue(MaxRefreshListenersValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Highlight(System.Action? action) + { + Instance.Highlight = Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor.Build(action); + return this; + } - if (MaxRegexLengthValue.HasValue) - { - writer.WritePropertyName("max_regex_length"); - writer.WriteNumberValue(MaxRegexLengthValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) + { + Instance.Index = value; + return this; + } - if (MaxRescoreWindowValue.HasValue) - { - writer.WritePropertyName("max_rescore_window"); - writer.WriteNumberValue(MaxRescoreWindowValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index() + { + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; + } - if (MaxResultWindowValue.HasValue) - { - writer.WritePropertyName("max_result_window"); - writer.WriteNumberValue(MaxResultWindowValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index(System.Action? action) + { + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MaxScriptFieldsValue.HasValue) - { - writer.WritePropertyName("max_script_fields"); - writer.WriteNumberValue(MaxScriptFieldsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Index(System.Action>? action) + { + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MaxShingleDiffValue.HasValue) - { - writer.WritePropertyName("max_shingle_diff"); - writer.WriteNumberValue(MaxShingleDiffValue.Value); - } + /// + /// + /// Configure indexing back pressure limits. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? value) + { + Instance.IndexingPressure = value; + return this; + } - if (MaxSlicesPerScrollValue.HasValue) - { - writer.WritePropertyName("max_slices_per_scroll"); - writer.WriteNumberValue(MaxSlicesPerScrollValue.Value); - } + /// + /// + /// Configure indexing back pressure limits. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingPressure(System.Action action) + { + Instance.IndexingPressure = Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor.Build(action); + return this; + } - if (MaxTermsCountValue.HasValue) - { - writer.WritePropertyName("max_terms_count"); - writer.WriteNumberValue(MaxTermsCountValue.Value); - } - - if (MergeDescriptor is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, MergeDescriptor, options); - } - else if (MergeDescriptorAction is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor(MergeDescriptorAction), options); - } - else if (MergeValue is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, MergeValue, options); - } - - if (!string.IsNullOrEmpty(ModeValue)) - { - writer.WritePropertyName("mode"); - writer.WriteStringValue(ModeValue); - } - - if (NumberOfReplicasValue is not null) - { - writer.WritePropertyName("number_of_replicas"); - JsonSerializer.Serialize(writer, NumberOfReplicasValue, options); - } - - if (NumberOfRoutingShardsValue.HasValue) - { - writer.WritePropertyName("number_of_routing_shards"); - writer.WriteNumberValue(NumberOfRoutingShardsValue.Value); - } - - if (NumberOfShardsValue is not null) - { - writer.WritePropertyName("number_of_shards"); - JsonSerializer.Serialize(writer, NumberOfShardsValue, options); - } - - if (PriorityValue is not null) - { - writer.WritePropertyName("priority"); - JsonSerializer.Serialize(writer, PriorityValue, options); - } - - if (ProvidedNameValue is not null) - { - writer.WritePropertyName("provided_name"); - JsonSerializer.Serialize(writer, ProvidedNameValue, options); - } - - if (QueriesDescriptor is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesDescriptor, options); - } - else if (QueriesDescriptorAction is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(QueriesDescriptorAction), options); - } - else if (QueriesValue is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesValue, options); - } - - if (QueryStringDescriptor is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, QueryStringDescriptor, options); - } - else if (QueryStringDescriptorAction is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor(QueryStringDescriptorAction), options); - } - else if (QueryStringValue is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, QueryStringValue, options); - } - - if (RefreshIntervalValue is not null) - { - writer.WritePropertyName("refresh_interval"); - JsonSerializer.Serialize(writer, RefreshIntervalValue, options); - } - - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (RoutingPartitionSizeValue.HasValue) - { - writer.WritePropertyName("routing_partition_size"); - writer.WriteNumberValue(RoutingPartitionSizeValue.Value); - } - - if (RoutingPathValue is not null) - { - writer.WritePropertyName("routing_path"); - SingleOrManySerializationHelper.Serialize(RoutingPathValue, writer, options); - } - - if (SearchDescriptor is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchDescriptor, options); - } - else if (SearchDescriptorAction is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor(SearchDescriptorAction), options); - } - else if (SearchValue is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchValue, options); - } - - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } - - if (SimilarityValue is not null) - { - writer.WritePropertyName("similarity"); - JsonSerializer.Serialize(writer, SimilarityValue, options); - } - - if (SoftDeletesDescriptor is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, SoftDeletesDescriptor, options); - } - else if (SoftDeletesDescriptorAction is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor(SoftDeletesDescriptorAction), options); - } - else if (SoftDeletesValue is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, SoftDeletesValue, options); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(SortDescriptorAction), options); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (StoreDescriptor is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, StoreDescriptor, options); - } - else if (StoreDescriptorAction is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor(StoreDescriptorAction), options); - } - else if (StoreValue is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, StoreValue, options); - } - - if (TimeSeriesDescriptor is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, TimeSeriesDescriptor, options); - } - else if (TimeSeriesDescriptorAction is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor(TimeSeriesDescriptorAction), options); - } - else if (TimeSeriesValue is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, TimeSeriesValue, options); - } - - if (TopMetricsMaxSizeValue.HasValue) - { - writer.WritePropertyName("top_metrics_max_size"); - writer.WriteNumberValue(TopMetricsMaxSizeValue.Value); - } - - if (TranslogDescriptor is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, TranslogDescriptor, options); - } - else if (TranslogDescriptorAction is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor(TranslogDescriptorAction), options); - } - else if (TranslogValue is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, TranslogValue, options); - } - - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } - - if (VerifiedBeforeCloseValue is not null) - { - writer.WritePropertyName("verified_before_close"); - JsonSerializer.Serialize(writer, VerifiedBeforeCloseValue, options); - } - - if (VersionDescriptor is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionDescriptor, options); - } - else if (VersionDescriptorAction is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor(VersionDescriptorAction), options); - } - else if (VersionValue is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionValue, options); - } - - if (OtherSettingsValue is not null) - { - foreach (var additionalProperty in OtherSettingsValue) - { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); - } - } - - writer.WriteEndObject(); - } -} - -/// -/// Learn more about this API in the Elasticsearch documentation. -/// -public sealed partial class IndexSettingsDescriptor : SerializableDescriptor -{ - internal IndexSettingsDescriptor(Action configure) => configure.Invoke(this); - - public IndexSettingsDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? AnalyzeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor AnalyzeDescriptor { get; set; } - private Action AnalyzeDescriptorAction { get; set; } - private string? AutoExpandReplicasValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? BlocksValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor BlocksDescriptor { get; set; } - private Action BlocksDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? CheckOnStartupValue { get; set; } - private string? CodecValue { get; set; } - private long? CreationDateValue { get; set; } - private DateTimeOffset? CreationDateStringValue { get; set; } - private string? DefaultPipelineValue { get; set; } - private string? FinalPipelineValue { get; set; } - private object? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? GcDeletesValue { get; set; } - private object? HiddenValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? HighlightValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor HighlightDescriptor { get; set; } - private Action HighlightDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexDescriptor { get; set; } - private Action IndexDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? IndexingPressureValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor IndexingPressureDescriptor { get; set; } - private Action IndexingPressureDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? IndexingSlowlogValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor IndexingSlowlogDescriptor { get; set; } - private Action IndexingSlowlogDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private bool? LoadFixedBitsetFiltersEagerlyValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? MappingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor MappingDescriptor { get; set; } - private Action MappingDescriptorAction { get; set; } - private int? MaxDocvalueFieldsSearchValue { get; set; } - private int? MaxInnerResultWindowValue { get; set; } - private int? MaxNgramDiffValue { get; set; } - private int? MaxRefreshListenersValue { get; set; } - private int? MaxRegexLengthValue { get; set; } - private int? MaxRescoreWindowValue { get; set; } - private int? MaxResultWindowValue { get; set; } - private int? MaxScriptFieldsValue { get; set; } - private int? MaxShingleDiffValue { get; set; } - private int? MaxSlicesPerScrollValue { get; set; } - private int? MaxTermsCountValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Merge? MergeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor MergeDescriptor { get; set; } - private Action MergeDescriptorAction { get; set; } - private string? ModeValue { get; set; } - private object? NumberOfReplicasValue { get; set; } - private int? NumberOfRoutingShardsValue { get; set; } - private object? NumberOfShardsValue { get; set; } - private IDictionary OtherSettingsValue { get; set; } - private object? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? ProvidedNameValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Queries? QueriesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor QueriesDescriptor { get; set; } - private Action QueriesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? QueryStringValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor QueryStringDescriptor { get; set; } - private Action QueryStringDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? RefreshIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private int? RoutingPartitionSizeValue { get; set; } - private ICollection? RoutingPathValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? SearchValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor SearchDescriptor { get; set; } - private Action SearchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? SimilarityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? SoftDeletesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor SoftDeletesDescriptor { get; set; } - private Action SoftDeletesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Storage? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor StoreDescriptor { get; set; } - private Action StoreDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? TimeSeriesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor TimeSeriesDescriptor { get; set; } - private Action TimeSeriesDescriptorAction { get; set; } - private int? TopMetricsMaxSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.Translog? TranslogValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor TranslogDescriptor { get; set; } - private Action TranslogDescriptorAction { get; set; } - private string? UuidValue { get; set; } - private object? VerifiedBeforeCloseValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor VersionDescriptor { get; set; } - private Action VersionDescriptorAction { get; set; } - - public IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis? analysis) - { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; - } - - public IndexSettingsDescriptor Analysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor descriptor) - { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Analysis(Action configure) - { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; - } - - /// - /// - /// Settings to define analyzers, tokenizers, token filters and character filters. - /// - /// - public IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze? analyze) - { - AnalyzeDescriptor = null; - AnalyzeDescriptorAction = null; - AnalyzeValue = analyze; - return Self; - } - - public IndexSettingsDescriptor Analyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor descriptor) - { - AnalyzeValue = null; - AnalyzeDescriptorAction = null; - AnalyzeDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Analyze(Action configure) - { - AnalyzeValue = null; - AnalyzeDescriptor = null; - AnalyzeDescriptorAction = configure; - return Self; - } - - public IndexSettingsDescriptor AutoExpandReplicas(string? autoExpandReplicas) - { - AutoExpandReplicasValue = autoExpandReplicas; - return Self; - } - - public IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocks? blocks) - { - BlocksDescriptor = null; - BlocksDescriptorAction = null; - BlocksValue = blocks; - return Self; - } - - public IndexSettingsDescriptor Blocks(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? value) { - BlocksValue = null; - BlocksDescriptorAction = null; - BlocksDescriptor = descriptor; - return Self; + Instance.IndexingSlowlog = value; + return this; } - public IndexSettingsDescriptor Blocks(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog() { - BlocksValue = null; - BlocksDescriptor = null; - BlocksDescriptorAction = configure; - return Self; + Instance.IndexingSlowlog = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor CheckOnStartup(Elastic.Clients.Elasticsearch.IndexManagement.IndexCheckOnStartup? checkOnStartup) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexingSlowlog(System.Action? action) { - CheckOnStartupValue = checkOnStartup; - return Self; + Instance.IndexingSlowlog = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Codec(string? codec) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? value) { - CodecValue = codec; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexSettingsDescriptor CreationDate(long? creationDate) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle() { - CreationDateValue = creationDate; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor CreationDateString(DateTimeOffset? creationDateString) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Lifecycle(System.Action? action) { - CreationDateStringValue = creationDateString; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor DefaultPipeline(string? defaultPipeline) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? value = true) { - DefaultPipelineValue = defaultPipeline; - return Self; - } - - public IndexSettingsDescriptor FinalPipeline(string? finalPipeline) - { - FinalPipelineValue = finalPipeline; - return Self; - } - - public IndexSettingsDescriptor Format(object? format) - { - FormatValue = format; - return Self; - } - - public IndexSettingsDescriptor GcDeletes(Elastic.Clients.Elasticsearch.Duration? gcDeletes) - { - GcDeletesValue = gcDeletes; - return Self; - } - - public IndexSettingsDescriptor Hidden(object? hidden) - { - HiddenValue = hidden; - return Self; - } - - public IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight? highlight) - { - HighlightDescriptor = null; - HighlightDescriptorAction = null; - HighlightValue = highlight; - return Self; - } - - public IndexSettingsDescriptor Highlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor descriptor) - { - HighlightValue = null; - HighlightDescriptorAction = null; - HighlightDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Highlight(Action configure) - { - HighlightValue = null; - HighlightDescriptor = null; - HighlightDescriptorAction = configure; - return Self; - } - - public IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? index) - { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexValue = index; - return Self; - } - - public IndexSettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) - { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Index(Action configure) - { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = configure; - return Self; + Instance.LoadFixedBitsetFiltersEagerly = value; + return this; } /// /// - /// Configure indexing back pressure limits. + /// Enable or disable dynamic mapping for an index. /// /// - public IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure? indexingPressure) - { - IndexingPressureDescriptor = null; - IndexingPressureDescriptorAction = null; - IndexingPressureValue = indexingPressure; - return Self; - } - - public IndexSettingsDescriptor IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor descriptor) - { - IndexingPressureValue = null; - IndexingPressureDescriptorAction = null; - IndexingPressureDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor IndexingPressure(Action configure) - { - IndexingPressureValue = null; - IndexingPressureDescriptor = null; - IndexingPressureDescriptorAction = configure; - return Self; - } - - public IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings? indexingSlowlog) - { - IndexingSlowlogDescriptor = null; - IndexingSlowlogDescriptorAction = null; - IndexingSlowlogValue = indexingSlowlog; - return Self; - } - - public IndexSettingsDescriptor IndexingSlowlog(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor descriptor) - { - IndexingSlowlogValue = null; - IndexingSlowlogDescriptorAction = null; - IndexingSlowlogDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor IndexingSlowlog(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? value) { - IndexingSlowlogValue = null; - IndexingSlowlogDescriptor = null; - IndexingSlowlogDescriptorAction = configure; - return Self; + Instance.Mapping = value; + return this; } - public IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle? lifecycle) - { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; - } - - public IndexSettingsDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor descriptor) - { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; - } - - public IndexSettingsDescriptor Lifecycle(Action configure) - { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; - } - - public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? loadFixedBitsetFiltersEagerly = true) + /// + /// + /// Enable or disable dynamic mapping for an index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping() { - LoadFixedBitsetFiltersEagerlyValue = loadFixedBitsetFiltersEagerly; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor.Build(null); + return this; } /// @@ -2660,303 +1682,284 @@ public IndexSettingsDescriptor LoadFixedBitsetFiltersEagerly(bool? loadFixedBits /// Enable or disable dynamic mapping for an index. /// /// - public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings? mapping) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mapping(System.Action? action) { - MappingDescriptor = null; - MappingDescriptorAction = null; - MappingValue = mapping; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Mapping(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxDocvalueFieldsSearch(int? value) { - MappingValue = null; - MappingDescriptorAction = null; - MappingDescriptor = descriptor; - return Self; + Instance.MaxDocvalueFieldsSearch = value; + return this; } - public IndexSettingsDescriptor Mapping(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxInnerResultWindow(int? value) { - MappingValue = null; - MappingDescriptor = null; - MappingDescriptorAction = configure; - return Self; + Instance.MaxInnerResultWindow = value; + return this; } - public IndexSettingsDescriptor MaxDocvalueFieldsSearch(int? maxDocvalueFieldsSearch) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxNgramDiff(int? value) { - MaxDocvalueFieldsSearchValue = maxDocvalueFieldsSearch; - return Self; + Instance.MaxNgramDiff = value; + return this; } - public IndexSettingsDescriptor MaxInnerResultWindow(int? maxInnerResultWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRefreshListeners(int? value) { - MaxInnerResultWindowValue = maxInnerResultWindow; - return Self; + Instance.MaxRefreshListeners = value; + return this; } - public IndexSettingsDescriptor MaxNgramDiff(int? maxNgramDiff) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRegexLength(int? value) { - MaxNgramDiffValue = maxNgramDiff; - return Self; + Instance.MaxRegexLength = value; + return this; } - public IndexSettingsDescriptor MaxRefreshListeners(int? maxRefreshListeners) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxRescoreWindow(int? value) { - MaxRefreshListenersValue = maxRefreshListeners; - return Self; + Instance.MaxRescoreWindow = value; + return this; } - public IndexSettingsDescriptor MaxRegexLength(int? maxRegexLength) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxResultWindow(int? value) { - MaxRegexLengthValue = maxRegexLength; - return Self; + Instance.MaxResultWindow = value; + return this; } - public IndexSettingsDescriptor MaxRescoreWindow(int? maxRescoreWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxScriptFields(int? value) { - MaxRescoreWindowValue = maxRescoreWindow; - return Self; + Instance.MaxScriptFields = value; + return this; } - public IndexSettingsDescriptor MaxResultWindow(int? maxResultWindow) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxShingleDiff(int? value) { - MaxResultWindowValue = maxResultWindow; - return Self; + Instance.MaxShingleDiff = value; + return this; } - public IndexSettingsDescriptor MaxScriptFields(int? maxScriptFields) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxSlicesPerScroll(int? value) { - MaxScriptFieldsValue = maxScriptFields; - return Self; + Instance.MaxSlicesPerScroll = value; + return this; } - public IndexSettingsDescriptor MaxShingleDiff(int? maxShingleDiff) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor MaxTermsCount(int? value) { - MaxShingleDiffValue = maxShingleDiff; - return Self; + Instance.MaxTermsCount = value; + return this; } - public IndexSettingsDescriptor MaxSlicesPerScroll(int? maxSlicesPerScroll) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.Merge? value) { - MaxSlicesPerScrollValue = maxSlicesPerScroll; - return Self; + Instance.Merge = value; + return this; } - public IndexSettingsDescriptor MaxTermsCount(int? maxTermsCount) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge() { - MaxTermsCountValue = maxTermsCount; - return Self; + Instance.Merge = Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.Merge? merge) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Merge(System.Action? action) { - MergeDescriptor = null; - MergeDescriptorAction = null; - MergeValue = merge; - return Self; + Instance.Merge = Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Merge(Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Mode(string? value) { - MergeValue = null; - MergeDescriptorAction = null; - MergeDescriptor = descriptor; - return Self; + Instance.Mode = value; + return this; } - public IndexSettingsDescriptor Merge(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfReplicas(Elastic.Clients.Elasticsearch.Union? value) { - MergeValue = null; - MergeDescriptor = null; - MergeDescriptorAction = configure; - return Self; + Instance.NumberOfReplicas = value; + return this; } - public IndexSettingsDescriptor Mode(string? mode) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfRoutingShards(int? value) { - ModeValue = mode; - return Self; + Instance.NumberOfRoutingShards = value; + return this; } - public IndexSettingsDescriptor NumberOfReplicas(object? numberOfReplicas) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor NumberOfShards(Elastic.Clients.Elasticsearch.Union? value) { - NumberOfReplicasValue = numberOfReplicas; - return Self; + Instance.NumberOfShards = value; + return this; } - public IndexSettingsDescriptor NumberOfRoutingShards(int? numberOfRoutingShards) + /// + /// + /// Additional settings not covered in this type. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings(System.Collections.Generic.IDictionary? value) { - NumberOfRoutingShardsValue = numberOfRoutingShards; - return Self; + Instance.OtherSettings = value; + return this; } - public IndexSettingsDescriptor NumberOfShards(object? numberOfShards) + /// + /// + /// Additional settings not covered in this type. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings() { - NumberOfShardsValue = numberOfShards; - return Self; + Instance.OtherSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// /// - /// Additional settings not covered in this type. Unless these settings are defined by a plugin, please open an issue on the Elasticsearch API specification so that they can be added in a future release + /// Additional settings not covered in this type. /// /// - public IndexSettingsDescriptor OtherSettings(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor OtherSettings(System.Action? action) + { + Instance.OtherSettings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor AddOtherSetting(string key, object value) + { + Instance.OtherSettings ??= new System.Collections.Generic.Dictionary(); + Instance.OtherSettings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Priority(Elastic.Clients.Elasticsearch.Union? value) { - OtherSettingsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Priority = value; + return this; } - public IndexSettingsDescriptor Priority(object? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor ProvidedName(Elastic.Clients.Elasticsearch.Name? value) { - PriorityValue = priority; - return Self; + Instance.ProvidedName = value; + return this; } - public IndexSettingsDescriptor ProvidedName(Elastic.Clients.Elasticsearch.Name? providedName) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.Queries? value) { - ProvidedNameValue = providedName; - return Self; + Instance.Queries = value; + return this; } - public IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.Queries? queries) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries() { - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesValue = queries; - return Self; + Instance.Queries = Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Queries(Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Queries(System.Action? action) { - QueriesValue = null; - QueriesDescriptorAction = null; - QueriesDescriptor = descriptor; - return Self; + Instance.Queries = Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Queries(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? value) { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorAction = configure; - return Self; + Instance.QueryString = value; + return this; } - public IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString? queryString) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor QueryString(System.Action action) { - QueryStringDescriptor = null; - QueryStringDescriptorAction = null; - QueryStringValue = queryString; - return Self; + Instance.QueryString = Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor QueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RefreshInterval(Elastic.Clients.Elasticsearch.Duration? value) { - QueryStringValue = null; - QueryStringDescriptorAction = null; - QueryStringDescriptor = descriptor; - return Self; + Instance.RefreshInterval = value; + return this; } - public IndexSettingsDescriptor QueryString(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? value) { - QueryStringValue = null; - QueryStringDescriptor = null; - QueryStringDescriptorAction = configure; - return Self; + Instance.Routing = value; + return this; } - public IndexSettingsDescriptor RefreshInterval(Elastic.Clients.Elasticsearch.Duration? refreshInterval) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing() { - RefreshIntervalValue = refreshInterval; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? routing) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Routing(System.Action? action) { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Routing(Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPartitionSize(int? value) { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.RoutingPartitionSize = value; + return this; } - public IndexSettingsDescriptor Routing(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPath(System.Collections.Generic.ICollection? value) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.RoutingPath = value; + return this; } - public IndexSettingsDescriptor RoutingPartitionSize(int? routingPartitionSize) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor RoutingPath(params string[] values) { - RoutingPartitionSizeValue = routingPartitionSize; - return Self; + Instance.RoutingPath = [.. values]; + return this; } - public IndexSettingsDescriptor RoutingPath(ICollection? routingPath) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? value) { - RoutingPathValue = routingPath; - return Self; + Instance.Search = value; + return this; } - public IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch? search) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search() { - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchValue = search; - return Self; + Instance.Search = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Search(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Search(System.Action? action) { - SearchValue = null; - SearchDescriptorAction = null; - SearchDescriptor = descriptor; - return Self; + Instance.Search = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Search(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorAction = configure; - return Self; + Instance.Settings = value; + return this; } - public IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings() { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings(System.Action? action) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Settings(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -2964,72 +1967,63 @@ public IndexSettingsDescriptor Settings(Action /// - public IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? similarity) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities? value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - public IndexSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor descriptor) + /// + /// + /// Configure custom similarity settings to customize how search results are scored. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Similarity(System.Action action) { - SimilarityValue = descriptor.PromisedValue; - return Self; + Instance.Similarity = Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Similarity(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? value) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor(); - configure?.Invoke(descriptor); - SimilarityValue = descriptor.PromisedValue; - return Self; + Instance.SoftDeletes = value; + return this; } - public IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes? softDeletes) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes() { - SoftDeletesDescriptor = null; - SoftDeletesDescriptorAction = null; - SoftDeletesValue = softDeletes; - return Self; + Instance.SoftDeletes = Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SoftDeletes(System.Action? action) { - SoftDeletesValue = null; - SoftDeletesDescriptorAction = null; - SoftDeletesDescriptor = descriptor; - return Self; + Instance.SoftDeletes = Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor SoftDeletes(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? value) { - SoftDeletesValue = null; - SoftDeletesDescriptor = null; - SoftDeletesDescriptorAction = configure; - return Self; + Instance.Sort = value; + return this; } - public IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSort? sort) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort() { - SortDescriptor = null; - SortDescriptorAction = null; - SortValue = sort; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Sort(Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort(System.Action? action) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Sort(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Sort(System.Action>? action) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = configure; - return Self; + Instance.Sort = Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor.Build(action); + return this; } /// @@ -3037,678 +2031,105 @@ public IndexSettingsDescriptor Sort(Action /// - public IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.Storage? store) - { - StoreDescriptor = null; - StoreDescriptorAction = null; - StoreValue = store; - return Self; - } - - public IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Store(Elastic.Clients.Elasticsearch.IndexManagement.Storage? value) { - StoreValue = null; - StoreDescriptorAction = null; - StoreDescriptor = descriptor; - return Self; + Instance.Store = value; + return this; } - public IndexSettingsDescriptor Store(Action configure) + /// + /// + /// The store module allows you to control how index data is stored and accessed on disk. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Store(System.Action action) { - StoreValue = null; - StoreDescriptor = null; - StoreDescriptorAction = configure; - return Self; + Instance.Store = Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? timeSeries) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries? value) { - TimeSeriesDescriptor = null; - TimeSeriesDescriptorAction = null; - TimeSeriesValue = timeSeries; - return Self; + Instance.TimeSeries = value; + return this; } - public IndexSettingsDescriptor TimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries() { - TimeSeriesValue = null; - TimeSeriesDescriptorAction = null; - TimeSeriesDescriptor = descriptor; - return Self; + Instance.TimeSeries = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor TimeSeries(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TimeSeries(System.Action? action) { - TimeSeriesValue = null; - TimeSeriesDescriptor = null; - TimeSeriesDescriptorAction = configure; - return Self; + Instance.TimeSeries = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor TopMetricsMaxSize(int? topMetricsMaxSize) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor TopMetricsMaxSize(int? value) { - TopMetricsMaxSizeValue = topMetricsMaxSize; - return Self; + Instance.TopMetricsMaxSize = value; + return this; } - public IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.Translog? translog) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.Translog? value) { - TranslogDescriptor = null; - TranslogDescriptorAction = null; - TranslogValue = translog; - return Self; + Instance.Translog = value; + return this; } - public IndexSettingsDescriptor Translog(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog() { - TranslogValue = null; - TranslogDescriptorAction = null; - TranslogDescriptor = descriptor; - return Self; + Instance.Translog = Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Translog(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Translog(System.Action? action) { - TranslogValue = null; - TranslogDescriptor = null; - TranslogDescriptorAction = configure; - return Self; + Instance.Translog = Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor.Build(action); + return this; } - public IndexSettingsDescriptor Uuid(string? uuid) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Uuid(string? value) { - UuidValue = uuid; - return Self; + Instance.Uuid = value; + return this; } - public IndexSettingsDescriptor VerifiedBeforeClose(object? verifiedBeforeClose) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor VerifiedBeforeClose(Elastic.Clients.Elasticsearch.Union? value) { - VerifiedBeforeCloseValue = verifiedBeforeClose; - return Self; + Instance.VerifiedBeforeClose = value; + return this; } - public IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? version) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning? value) { - VersionDescriptor = null; - VersionDescriptorAction = null; - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - public IndexSettingsDescriptor Version(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version() { - VersionValue = null; - VersionDescriptorAction = null; - VersionDescriptor = descriptor; - return Self; + Instance.Version = Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor.Build(null); + return this; } - public IndexSettingsDescriptor Version(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor Version(System.Action? action) { - VersionValue = null; - VersionDescriptor = null; - VersionDescriptorAction = configure; - return Self; + Instance.Version = Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Build(System.Action? action) { - writer.WriteStartObject(); - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else if (AnalysisValue is not null) + if (action is null) { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (AnalyzeDescriptor is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, AnalyzeDescriptor, options); - } - else if (AnalyzeDescriptorAction is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor(AnalyzeDescriptorAction), options); - } - else if (AnalyzeValue is not null) - { - writer.WritePropertyName("analyze"); - JsonSerializer.Serialize(writer, AnalyzeValue, options); - } - - if (!string.IsNullOrEmpty(AutoExpandReplicasValue)) - { - writer.WritePropertyName("auto_expand_replicas"); - writer.WriteStringValue(AutoExpandReplicasValue); - } - - if (BlocksDescriptor is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, BlocksDescriptor, options); - } - else if (BlocksDescriptorAction is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingBlocksDescriptor(BlocksDescriptorAction), options); - } - else if (BlocksValue is not null) - { - writer.WritePropertyName("blocks"); - JsonSerializer.Serialize(writer, BlocksValue, options); - } - - if (CheckOnStartupValue is not null) - { - writer.WritePropertyName("check_on_startup"); - JsonSerializer.Serialize(writer, CheckOnStartupValue, options); - } - - if (!string.IsNullOrEmpty(CodecValue)) - { - writer.WritePropertyName("codec"); - writer.WriteStringValue(CodecValue); - } - - if (CreationDateValue.HasValue) - { - writer.WritePropertyName("creation_date"); - writer.WriteNumberValue(CreationDateValue.Value); - } - - if (CreationDateStringValue is not null) - { - writer.WritePropertyName("creation_date_string"); - JsonSerializer.Serialize(writer, CreationDateStringValue, options); - } - - if (!string.IsNullOrEmpty(DefaultPipelineValue)) - { - writer.WritePropertyName("default_pipeline"); - writer.WriteStringValue(DefaultPipelineValue); - } - - if (!string.IsNullOrEmpty(FinalPipelineValue)) - { - writer.WritePropertyName("final_pipeline"); - writer.WriteStringValue(FinalPipelineValue); - } - - if (FormatValue is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - } - - if (GcDeletesValue is not null) - { - writer.WritePropertyName("gc_deletes"); - JsonSerializer.Serialize(writer, GcDeletesValue, options); - } - - if (HiddenValue is not null) - { - writer.WritePropertyName("hidden"); - JsonSerializer.Serialize(writer, HiddenValue, options); - } - - if (HighlightDescriptor is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightDescriptor, options); - } - else if (HighlightDescriptorAction is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor(HighlightDescriptorAction), options); - } - else if (HighlightValue is not null) - { - writer.WritePropertyName("highlight"); - JsonSerializer.Serialize(writer, HighlightValue, options); - } - - if (IndexDescriptor is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexDescriptorAction), options); - } - else if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (IndexingPressureDescriptor is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, IndexingPressureDescriptor, options); - } - else if (IndexingPressureDescriptorAction is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor(IndexingPressureDescriptorAction), options); - } - else if (IndexingPressureValue is not null) - { - writer.WritePropertyName("indexing_pressure"); - JsonSerializer.Serialize(writer, IndexingPressureValue, options); - } - - if (IndexingSlowlogDescriptor is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, IndexingSlowlogDescriptor, options); - } - else if (IndexingSlowlogDescriptorAction is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor(IndexingSlowlogDescriptorAction), options); - } - else if (IndexingSlowlogValue is not null) - { - writer.WritePropertyName("indexing.slowlog"); - JsonSerializer.Serialize(writer, IndexingSlowlogValue, options); - } - - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } - - if (LoadFixedBitsetFiltersEagerlyValue.HasValue) - { - writer.WritePropertyName("load_fixed_bitset_filters_eagerly"); - writer.WriteBooleanValue(LoadFixedBitsetFiltersEagerlyValue.Value); - } - - if (MappingDescriptor is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingDescriptor, options); - } - else if (MappingDescriptorAction is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor(MappingDescriptorAction), options); - } - else if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } - - if (MaxDocvalueFieldsSearchValue.HasValue) - { - writer.WritePropertyName("max_docvalue_fields_search"); - writer.WriteNumberValue(MaxDocvalueFieldsSearchValue.Value); - } - - if (MaxInnerResultWindowValue.HasValue) - { - writer.WritePropertyName("max_inner_result_window"); - writer.WriteNumberValue(MaxInnerResultWindowValue.Value); - } - - if (MaxNgramDiffValue.HasValue) - { - writer.WritePropertyName("max_ngram_diff"); - writer.WriteNumberValue(MaxNgramDiffValue.Value); - } - - if (MaxRefreshListenersValue.HasValue) - { - writer.WritePropertyName("max_refresh_listeners"); - writer.WriteNumberValue(MaxRefreshListenersValue.Value); - } - - if (MaxRegexLengthValue.HasValue) - { - writer.WritePropertyName("max_regex_length"); - writer.WriteNumberValue(MaxRegexLengthValue.Value); - } - - if (MaxRescoreWindowValue.HasValue) - { - writer.WritePropertyName("max_rescore_window"); - writer.WriteNumberValue(MaxRescoreWindowValue.Value); - } - - if (MaxResultWindowValue.HasValue) - { - writer.WritePropertyName("max_result_window"); - writer.WriteNumberValue(MaxResultWindowValue.Value); - } - - if (MaxScriptFieldsValue.HasValue) - { - writer.WritePropertyName("max_script_fields"); - writer.WriteNumberValue(MaxScriptFieldsValue.Value); - } - - if (MaxShingleDiffValue.HasValue) - { - writer.WritePropertyName("max_shingle_diff"); - writer.WriteNumberValue(MaxShingleDiffValue.Value); - } - - if (MaxSlicesPerScrollValue.HasValue) - { - writer.WritePropertyName("max_slices_per_scroll"); - writer.WriteNumberValue(MaxSlicesPerScrollValue.Value); - } - - if (MaxTermsCountValue.HasValue) - { - writer.WritePropertyName("max_terms_count"); - writer.WriteNumberValue(MaxTermsCountValue.Value); - } - - if (MergeDescriptor is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, MergeDescriptor, options); - } - else if (MergeDescriptorAction is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor(MergeDescriptorAction), options); - } - else if (MergeValue is not null) - { - writer.WritePropertyName("merge"); - JsonSerializer.Serialize(writer, MergeValue, options); - } - - if (!string.IsNullOrEmpty(ModeValue)) - { - writer.WritePropertyName("mode"); - writer.WriteStringValue(ModeValue); - } - - if (NumberOfReplicasValue is not null) - { - writer.WritePropertyName("number_of_replicas"); - JsonSerializer.Serialize(writer, NumberOfReplicasValue, options); - } - - if (NumberOfRoutingShardsValue.HasValue) - { - writer.WritePropertyName("number_of_routing_shards"); - writer.WriteNumberValue(NumberOfRoutingShardsValue.Value); - } - - if (NumberOfShardsValue is not null) - { - writer.WritePropertyName("number_of_shards"); - JsonSerializer.Serialize(writer, NumberOfShardsValue, options); - } - - if (PriorityValue is not null) - { - writer.WritePropertyName("priority"); - JsonSerializer.Serialize(writer, PriorityValue, options); - } - - if (ProvidedNameValue is not null) - { - writer.WritePropertyName("provided_name"); - JsonSerializer.Serialize(writer, ProvidedNameValue, options); - } - - if (QueriesDescriptor is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesDescriptor, options); - } - else if (QueriesDescriptorAction is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(QueriesDescriptorAction), options); - } - else if (QueriesValue is not null) - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesValue, options); - } - - if (QueryStringDescriptor is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, QueryStringDescriptor, options); - } - else if (QueryStringDescriptorAction is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor(QueryStringDescriptorAction), options); - } - else if (QueryStringValue is not null) - { - writer.WritePropertyName("query_string"); - JsonSerializer.Serialize(writer, QueryStringValue, options); - } - - if (RefreshIntervalValue is not null) - { - writer.WritePropertyName("refresh_interval"); - JsonSerializer.Serialize(writer, RefreshIntervalValue, options); - } - - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexRoutingDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (RoutingPartitionSizeValue.HasValue) - { - writer.WritePropertyName("routing_partition_size"); - writer.WriteNumberValue(RoutingPartitionSizeValue.Value); - } - - if (RoutingPathValue is not null) - { - writer.WritePropertyName("routing_path"); - SingleOrManySerializationHelper.Serialize(RoutingPathValue, writer, options); - } - - if (SearchDescriptor is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchDescriptor, options); - } - else if (SearchDescriptorAction is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor(SearchDescriptorAction), options); - } - else if (SearchValue is not null) - { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchValue, options); - } - - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } - - if (SimilarityValue is not null) - { - writer.WritePropertyName("similarity"); - JsonSerializer.Serialize(writer, SimilarityValue, options); - } - - if (SoftDeletesDescriptor is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, SoftDeletesDescriptor, options); - } - else if (SoftDeletesDescriptorAction is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor(SoftDeletesDescriptorAction), options); - } - else if (SoftDeletesValue is not null) - { - writer.WritePropertyName("soft_deletes"); - JsonSerializer.Serialize(writer, SoftDeletesValue, options); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSegmentSortDescriptor(SortDescriptorAction), options); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - } - - if (StoreDescriptor is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, StoreDescriptor, options); - } - else if (StoreDescriptorAction is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor(StoreDescriptorAction), options); - } - else if (StoreValue is not null) - { - writer.WritePropertyName("store"); - JsonSerializer.Serialize(writer, StoreValue, options); - } - - if (TimeSeriesDescriptor is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, TimeSeriesDescriptor, options); - } - else if (TimeSeriesDescriptorAction is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor(TimeSeriesDescriptorAction), options); - } - else if (TimeSeriesValue is not null) - { - writer.WritePropertyName("time_series"); - JsonSerializer.Serialize(writer, TimeSeriesValue, options); - } - - if (TopMetricsMaxSizeValue.HasValue) - { - writer.WritePropertyName("top_metrics_max_size"); - writer.WriteNumberValue(TopMetricsMaxSizeValue.Value); - } - - if (TranslogDescriptor is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, TranslogDescriptor, options); - } - else if (TranslogDescriptorAction is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor(TranslogDescriptorAction), options); - } - else if (TranslogValue is not null) - { - writer.WritePropertyName("translog"); - JsonSerializer.Serialize(writer, TranslogValue, options); - } - - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } - - if (VerifiedBeforeCloseValue is not null) - { - writer.WritePropertyName("verified_before_close"); - JsonSerializer.Serialize(writer, VerifiedBeforeCloseValue, options); - } - - if (VersionDescriptor is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionDescriptor, options); - } - else if (VersionDescriptorAction is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor(VersionDescriptorAction), options); - } - else if (VersionValue is not null) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionValue, options); - } - - if (OtherSettingsValue is not null) - { - foreach (var additionalProperty in OtherSettingsValue) - { - writer.WritePropertyName(additionalProperty.Key); - JsonSerializer.Serialize(writer, additionalProperty.Value, options); - } - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsAnalysis.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsAnalysis.g.cs index 87420519fe5..a851186dff5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsAnalysis.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsAnalysis.g.cs @@ -17,177 +17,202 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class IndexSettingsAnalysis +internal sealed partial class IndexSettingsAnalysisConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("analyzer")] - public Elastic.Clients.Elasticsearch.Analysis.Analyzers? Analyzers { get; set; } - [JsonInclude, JsonPropertyName("char_filter")] - public Elastic.Clients.Elasticsearch.Analysis.CharFilters? CharFilters { get; set; } - [JsonInclude, JsonPropertyName("normalizer")] - public Elastic.Clients.Elasticsearch.Analysis.Normalizers? Normalizers { get; set; } - [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.Analysis.TokenFilters? TokenFilters { get; set; } - [JsonInclude, JsonPropertyName("tokenizer")] - public Elastic.Clients.Elasticsearch.Analysis.Tokenizers? Tokenizers { get; set; } -} + private static readonly System.Text.Json.JsonEncodedText PropAnalyzers = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCharFilters = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizers = System.Text.Json.JsonEncodedText.Encode("normalizer"); + private static readonly System.Text.Json.JsonEncodedText PropTokenFilters = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizers = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzers = default; + LocalJsonValue propCharFilters = default; + LocalJsonValue propNormalizers = default; + LocalJsonValue propTokenFilters = default; + LocalJsonValue propTokenizers = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzers.TryReadProperty(ref reader, options, PropAnalyzers, null)) + { + continue; + } + + if (propCharFilters.TryReadProperty(ref reader, options, PropCharFilters, null)) + { + continue; + } + + if (propNormalizers.TryReadProperty(ref reader, options, PropNormalizers, null)) + { + continue; + } + + if (propTokenFilters.TryReadProperty(ref reader, options, PropTokenFilters, null)) + { + continue; + } + + if (propTokenizers.TryReadProperty(ref reader, options, PropTokenizers, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } -public sealed partial class IndexSettingsAnalysisDescriptor : SerializableDescriptor -{ - internal IndexSettingsAnalysisDescriptor(Action configure) => configure.Invoke(this); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzers = propAnalyzers.Value, + CharFilters = propCharFilters.Value, + Normalizers = propNormalizers.Value, + TokenFilters = propTokenFilters.Value, + Tokenizers = propTokenizers.Value + }; + } - public IndexSettingsAnalysisDescriptor() : base() + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis value, System.Text.Json.JsonSerializerOptions options) { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzers, value.Analyzers, null, null); + writer.WriteProperty(options, PropCharFilters, value.CharFilters, null, null); + writer.WriteProperty(options, PropNormalizers, value.Normalizers, null, null); + writer.WriteProperty(options, PropTokenFilters, value.TokenFilters, null, null); + writer.WriteProperty(options, PropTokenizers, value.Tokenizers, null, null); + writer.WriteEndObject(); } +} - private Elastic.Clients.Elasticsearch.Analysis.Analyzers? AnalyzersValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.CharFilters? CharFiltersValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.Normalizers? NormalizersValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.TokenFilters? TokenFiltersValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.Tokenizers? TokenizersValue { get; set; } - - public IndexSettingsAnalysisDescriptor Analyzers(Elastic.Clients.Elasticsearch.Analysis.Analyzers? analyzers) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisConverter))] +public sealed partial class IndexSettingsAnalysis +{ +#if NET7_0_OR_GREATER + public IndexSettingsAnalysis() { - AnalyzersValue = analyzers; - return Self; } - - public IndexSettingsAnalysisDescriptor Analyzers(Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor descriptor) +#endif +#if !NET7_0_OR_GREATER + public IndexSettingsAnalysis() { - AnalyzersValue = descriptor.PromisedValue; - return Self; } - - public IndexSettingsAnalysisDescriptor Analyzers(Action configure) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - var descriptor = new Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor(); - configure?.Invoke(descriptor); - AnalyzersValue = descriptor.PromisedValue; - return Self; + _ = sentinel; } - public IndexSettingsAnalysisDescriptor CharFilters(Elastic.Clients.Elasticsearch.Analysis.CharFilters? charFilters) + public Elastic.Clients.Elasticsearch.Analysis.Analyzers? Analyzers { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.CharFilters? CharFilters { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.Normalizers? Normalizers { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.TokenFilters? TokenFilters { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.Tokenizers? Tokenizers { get; set; } +} + +public readonly partial struct IndexSettingsAnalysisDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsAnalysisDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis instance) { - CharFiltersValue = charFilters; - return Self; + Instance = instance; } - public IndexSettingsAnalysisDescriptor CharFilters(Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsAnalysisDescriptor() { - CharFiltersValue = descriptor.PromisedValue; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexSettingsAnalysisDescriptor CharFilters(Action configure) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Analyzers(Elastic.Clients.Elasticsearch.Analysis.Analyzers? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor(); - configure?.Invoke(descriptor); - CharFiltersValue = descriptor.PromisedValue; - return Self; + Instance.Analyzers = value; + return this; } - public IndexSettingsAnalysisDescriptor Normalizers(Elastic.Clients.Elasticsearch.Analysis.Normalizers? normalizers) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Analyzers(System.Action action) { - NormalizersValue = normalizers; - return Self; + Instance.Analyzers = Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor.Build(action); + return this; } - public IndexSettingsAnalysisDescriptor Normalizers(Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor CharFilters(Elastic.Clients.Elasticsearch.Analysis.CharFilters? value) { - NormalizersValue = descriptor.PromisedValue; - return Self; + Instance.CharFilters = value; + return this; } - public IndexSettingsAnalysisDescriptor Normalizers(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor CharFilters(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor(); - configure?.Invoke(descriptor); - NormalizersValue = descriptor.PromisedValue; - return Self; + Instance.CharFilters = Elastic.Clients.Elasticsearch.Analysis.CharFiltersDescriptor.Build(action); + return this; } - public IndexSettingsAnalysisDescriptor TokenFilters(Elastic.Clients.Elasticsearch.Analysis.TokenFilters? tokenFilters) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Normalizers(Elastic.Clients.Elasticsearch.Analysis.Normalizers? value) { - TokenFiltersValue = tokenFilters; - return Self; + Instance.Normalizers = value; + return this; } - public IndexSettingsAnalysisDescriptor TokenFilters(Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Normalizers(System.Action action) { - TokenFiltersValue = descriptor.PromisedValue; - return Self; + Instance.Normalizers = Elastic.Clients.Elasticsearch.Analysis.NormalizersDescriptor.Build(action); + return this; } - public IndexSettingsAnalysisDescriptor TokenFilters(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor TokenFilters(Elastic.Clients.Elasticsearch.Analysis.TokenFilters? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor(); - configure?.Invoke(descriptor); - TokenFiltersValue = descriptor.PromisedValue; - return Self; + Instance.TokenFilters = value; + return this; } - public IndexSettingsAnalysisDescriptor Tokenizers(Elastic.Clients.Elasticsearch.Analysis.Tokenizers? tokenizers) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor TokenFilters(System.Action action) { - TokenizersValue = tokenizers; - return Self; + Instance.TokenFilters = Elastic.Clients.Elasticsearch.Analysis.TokenFiltersDescriptor.Build(action); + return this; } - public IndexSettingsAnalysisDescriptor Tokenizers(Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Tokenizers(Elastic.Clients.Elasticsearch.Analysis.Tokenizers? value) { - TokenizersValue = descriptor.PromisedValue; - return Self; + Instance.Tokenizers = value; + return this; } - public IndexSettingsAnalysisDescriptor Tokenizers(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor Tokenizers(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor(); - configure?.Invoke(descriptor); - TokenizersValue = descriptor.PromisedValue; - return Self; + Instance.Tokenizers = Elastic.Clients.Elasticsearch.Analysis.TokenizersDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis Build(System.Action? action) { - writer.WriteStartObject(); - if (AnalyzersValue is not null) + if (action is null) { - writer.WritePropertyName("analyzer"); - JsonSerializer.Serialize(writer, AnalyzersValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CharFiltersValue is not null) - { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFiltersValue, options); - } - - if (NormalizersValue is not null) - { - writer.WritePropertyName("normalizer"); - JsonSerializer.Serialize(writer, NormalizersValue, options); - } - - if (TokenFiltersValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, TokenFiltersValue, options); - } - - if (TokenizersValue is not null) - { - writer.WritePropertyName("tokenizer"); - JsonSerializer.Serialize(writer, TokenizersValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysisDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycle.g.cs index b0ffbd8ba5c..9054f3da87a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycle.g.cs @@ -17,25 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSettingsLifecycleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexingComplete = System.Text.Json.JsonEncodedText.Encode("indexing_complete"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOriginationDate = System.Text.Json.JsonEncodedText.Encode("origination_date"); + private static readonly System.Text.Json.JsonEncodedText PropParseOriginationDate = System.Text.Json.JsonEncodedText.Encode("parse_origination_date"); + private static readonly System.Text.Json.JsonEncodedText PropPreferIlm = System.Text.Json.JsonEncodedText.Encode("prefer_ilm"); + private static readonly System.Text.Json.JsonEncodedText PropRolloverAlias = System.Text.Json.JsonEncodedText.Encode("rollover_alias"); + private static readonly System.Text.Json.JsonEncodedText PropStep = System.Text.Json.JsonEncodedText.Encode("step"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexingComplete = default; + LocalJsonValue propName = default; + LocalJsonValue propOriginationDate = default; + LocalJsonValue propParseOriginationDate = default; + LocalJsonValue?> propPreferIlm = default; + LocalJsonValue propRolloverAlias = default; + LocalJsonValue propStep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexingComplete.TryReadProperty(ref reader, options, PropIndexingComplete, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propOriginationDate.TryReadProperty(ref reader, options, PropOriginationDate, null)) + { + continue; + } + + if (propParseOriginationDate.TryReadProperty(ref reader, options, PropParseOriginationDate, null)) + { + continue; + } + + if (propPreferIlm.TryReadProperty(ref reader, options, PropPreferIlm, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propRolloverAlias.TryReadProperty(ref reader, options, PropRolloverAlias, null)) + { + continue; + } + + if (propStep.TryReadProperty(ref reader, options, PropStep, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexingComplete = propIndexingComplete.Value, + Name = propName.Value, + OriginationDate = propOriginationDate.Value, + ParseOriginationDate = propParseOriginationDate.Value, + PreferIlm = propPreferIlm.Value, + RolloverAlias = propRolloverAlias.Value, + Step = propStep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexingComplete, value.IndexingComplete, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropOriginationDate, value.OriginationDate, null, null); + writer.WriteProperty(options, PropParseOriginationDate, value.ParseOriginationDate, null, null); + writer.WriteProperty(options, PropPreferIlm, value.PreferIlm, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropRolloverAlias, value.RolloverAlias, null, null); + writer.WriteProperty(options, PropStep, value.Step, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleConverter))] public sealed partial class IndexSettingsLifecycle { +#if NET7_0_OR_GREATER + public IndexSettingsLifecycle() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSettingsLifecycle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Indicates whether or not the index has been rolled over. Automatically set to true when ILM completes the rollover action. /// You can explicitly set it to skip rollover. /// /// - [JsonInclude, JsonPropertyName("indexing_complete")] public bool? IndexingComplete { get; set; } /// @@ -43,7 +148,6 @@ public sealed partial class IndexSettingsLifecycle /// The name of the policy to use to manage the index. For information about how Elasticsearch applies policy changes, see Policy updates. /// /// - [JsonInclude, JsonPropertyName("name")] public Elastic.Clients.Elasticsearch.Name? Name { get; set; } /// @@ -53,7 +157,6 @@ public sealed partial class IndexSettingsLifecycle /// age. Specified as a Unix epoch value in milliseconds. /// /// - [JsonInclude, JsonPropertyName("origination_date")] public long? OriginationDate { get; set; } /// @@ -64,7 +167,6 @@ public sealed partial class IndexSettingsLifecycle /// for example logs-2016.10.31-000002). If the index name doesn’t match the pattern, index creation fails. /// /// - [JsonInclude, JsonPropertyName("parse_origination_date")] public bool? ParseOriginationDate { get; set; } /// @@ -73,8 +175,7 @@ public sealed partial class IndexSettingsLifecycle /// applicable for an index). /// /// - [JsonInclude, JsonPropertyName("prefer_ilm")] - public object? PreferIlm { get; set; } + public Elastic.Clients.Elasticsearch.Union? PreferIlm { get; set; } /// /// @@ -83,29 +184,28 @@ public sealed partial class IndexSettingsLifecycle /// information about rolling indices, see Rollover. /// /// - [JsonInclude, JsonPropertyName("rollover_alias")] public string? RolloverAlias { get; set; } - [JsonInclude, JsonPropertyName("step")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep? Step { get; set; } } -public sealed partial class IndexSettingsLifecycleDescriptor : SerializableDescriptor +public readonly partial struct IndexSettingsLifecycleDescriptor { - internal IndexSettingsLifecycleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsLifecycleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle instance) + { + Instance = instance; + } - public IndexSettingsLifecycleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsLifecycleDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? IndexingCompleteValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } - private long? OriginationDateValue { get; set; } - private bool? ParseOriginationDateValue { get; set; } - private object? PreferIlmValue { get; set; } - private string? RolloverAliasValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep? StepValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor StepDescriptor { get; set; } - private Action StepDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor descriptor) => descriptor.Instance; /// /// @@ -113,10 +213,10 @@ public IndexSettingsLifecycleDescriptor() : base() /// You can explicitly set it to skip rollover. /// /// - public IndexSettingsLifecycleDescriptor IndexingComplete(bool? indexingComplete = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor IndexingComplete(bool? value = true) { - IndexingCompleteValue = indexingComplete; - return Self; + Instance.IndexingComplete = value; + return this; } /// @@ -124,10 +224,10 @@ public IndexSettingsLifecycleDescriptor IndexingComplete(bool? indexingComplete /// The name of the policy to use to manage the index. For information about how Elasticsearch applies policy changes, see Policy updates. /// /// - public IndexSettingsLifecycleDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -137,10 +237,10 @@ public IndexSettingsLifecycleDescriptor Name(Elastic.Clients.Elasticsearch.Name? /// age. Specified as a Unix epoch value in milliseconds. /// /// - public IndexSettingsLifecycleDescriptor OriginationDate(long? originationDate) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor OriginationDate(long? value) { - OriginationDateValue = originationDate; - return Self; + Instance.OriginationDate = value; + return this; } /// @@ -151,10 +251,10 @@ public IndexSettingsLifecycleDescriptor OriginationDate(long? originationDate) /// for example logs-2016.10.31-000002). If the index name doesn’t match the pattern, index creation fails. /// /// - public IndexSettingsLifecycleDescriptor ParseOriginationDate(bool? parseOriginationDate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor ParseOriginationDate(bool? value = true) { - ParseOriginationDateValue = parseOriginationDate; - return Self; + Instance.ParseOriginationDate = value; + return this; } /// @@ -163,10 +263,10 @@ public IndexSettingsLifecycleDescriptor ParseOriginationDate(bool? parseOriginat /// applicable for an index). /// /// - public IndexSettingsLifecycleDescriptor PreferIlm(object? preferIlm) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor PreferIlm(Elastic.Clients.Elasticsearch.Union? value) { - PreferIlmValue = preferIlm; - return Self; + Instance.PreferIlm = value; + return this; } /// @@ -176,91 +276,40 @@ public IndexSettingsLifecycleDescriptor PreferIlm(object? preferIlm) /// information about rolling indices, see Rollover. /// /// - public IndexSettingsLifecycleDescriptor RolloverAlias(string? rolloverAlias) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor RolloverAlias(string? value) { - RolloverAliasValue = rolloverAlias; - return Self; + Instance.RolloverAlias = value; + return this; } - public IndexSettingsLifecycleDescriptor Step(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep? step) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor Step(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep? value) { - StepDescriptor = null; - StepDescriptorAction = null; - StepValue = step; - return Self; + Instance.Step = value; + return this; } - public IndexSettingsLifecycleDescriptor Step(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor Step() { - StepValue = null; - StepDescriptorAction = null; - StepDescriptor = descriptor; - return Self; + Instance.Step = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor.Build(null); + return this; } - public IndexSettingsLifecycleDescriptor Step(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor Step(System.Action? action) { - StepValue = null; - StepDescriptor = null; - StepDescriptorAction = configure; - return Self; + Instance.Step = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexingCompleteValue.HasValue) - { - writer.WritePropertyName("indexing_complete"); - writer.WriteBooleanValue(IndexingCompleteValue.Value); - } - - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } - - if (OriginationDateValue.HasValue) - { - writer.WritePropertyName("origination_date"); - writer.WriteNumberValue(OriginationDateValue.Value); - } - - if (ParseOriginationDateValue.HasValue) + if (action is null) { - writer.WritePropertyName("parse_origination_date"); - writer.WriteBooleanValue(ParseOriginationDateValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (PreferIlmValue is not null) - { - writer.WritePropertyName("prefer_ilm"); - JsonSerializer.Serialize(writer, PreferIlmValue, options); - } - - if (!string.IsNullOrEmpty(RolloverAliasValue)) - { - writer.WritePropertyName("rollover_alias"); - writer.WriteStringValue(RolloverAliasValue); - } - - if (StepDescriptor is not null) - { - writer.WritePropertyName("step"); - JsonSerializer.Serialize(writer, StepDescriptor, options); - } - else if (StepDescriptorAction is not null) - { - writer.WritePropertyName("step"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor(StepDescriptorAction), options); - } - else if (StepValue is not null) - { - writer.WritePropertyName("step"); - JsonSerializer.Serialize(writer, StepValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycleStep.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycleStep.g.cs index 426ad2f8254..a8cbab2469c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycleStep.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsLifecycleStep.g.cs @@ -17,37 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSettingsLifecycleStepConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropWaitTimeThreshold = System.Text.Json.JsonEncodedText.Encode("wait_time_threshold"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propWaitTimeThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propWaitTimeThreshold.TryReadProperty(ref reader, options, PropWaitTimeThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + WaitTimeThreshold = propWaitTimeThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropWaitTimeThreshold, value.WaitTimeThreshold, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepConverter))] public sealed partial class IndexSettingsLifecycleStep { +#if NET7_0_OR_GREATER + public IndexSettingsLifecycleStep() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSettingsLifecycleStep() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Time to wait for the cluster to resolve allocation issues during an ILM shrink action. Must be greater than 1h (1 hour). /// See Shard allocation for shrink. /// /// - [JsonInclude, JsonPropertyName("wait_time_threshold")] public Elastic.Clients.Elasticsearch.Duration? WaitTimeThreshold { get; set; } } -public sealed partial class IndexSettingsLifecycleStepDescriptor : SerializableDescriptor +public readonly partial struct IndexSettingsLifecycleStepDescriptor { - internal IndexSettingsLifecycleStepDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep Instance { get; init; } - public IndexSettingsLifecycleStepDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsLifecycleStepDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? WaitTimeThresholdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsLifecycleStepDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor descriptor) => descriptor.Instance; /// /// @@ -55,21 +115,22 @@ public IndexSettingsLifecycleStepDescriptor() : base() /// See Shard allocation for shrink. /// /// - public IndexSettingsLifecycleStepDescriptor WaitTimeThreshold(Elastic.Clients.Elasticsearch.Duration? waitTimeThreshold) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor WaitTimeThreshold(Elastic.Clients.Elasticsearch.Duration? value) { - WaitTimeThresholdValue = waitTimeThreshold; - return Self; + Instance.WaitTimeThreshold = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep Build(System.Action? action) { - writer.WriteStartObject(); - if (WaitTimeThresholdValue is not null) + if (action is null) { - writer.WritePropertyName("wait_time_threshold"); - JsonSerializer.Serialize(writer, WaitTimeThresholdValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStepDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsLifecycleStep(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsTimeSeries.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsTimeSeries.g.cs index 262bd30a159..90763844894 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsTimeSeries.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexSettingsTimeSeries.g.cs @@ -17,62 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexSettingsTimeSeriesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEndTime = System.Text.Json.JsonEncodedText.Encode("end_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEndTime = default; + LocalJsonValue propStartTime = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEndTime.TryReadProperty(ref reader, options, PropEndTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EndTime = propEndTime.Value, + StartTime = propStartTime.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEndTime, value.EndTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesConverter))] public sealed partial class IndexSettingsTimeSeries { - [JsonInclude, JsonPropertyName("end_time")] - public DateTimeOffset? EndTime { get; set; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; set; } +#if NET7_0_OR_GREATER + public IndexSettingsTimeSeries() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexSettingsTimeSeries() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.DateTimeOffset? EndTime { get; set; } + public System.DateTimeOffset? StartTime { get; set; } } -public sealed partial class IndexSettingsTimeSeriesDescriptor : SerializableDescriptor +public readonly partial struct IndexSettingsTimeSeriesDescriptor { - internal IndexSettingsTimeSeriesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries Instance { get; init; } - public IndexSettingsTimeSeriesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsTimeSeriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries instance) { + Instance = instance; } - private DateTimeOffset? EndTimeValue { get; set; } - private DateTimeOffset? StartTimeValue { get; set; } - - public IndexSettingsTimeSeriesDescriptor EndTime(DateTimeOffset? endTime) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexSettingsTimeSeriesDescriptor() { - EndTimeValue = endTime; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexSettingsTimeSeriesDescriptor StartTime(DateTimeOffset? startTime) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor EndTime(System.DateTimeOffset? value) { - StartTimeValue = startTime; - return Self; + Instance.EndTime = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor StartTime(System.DateTimeOffset? value) { - writer.WriteStartObject(); - if (EndTimeValue is not null) - { - writer.WritePropertyName("end_time"); - JsonSerializer.Serialize(writer, EndTimeValue, options); - } + Instance.StartTime = value; + return this; + } - if (StartTimeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("start_time"); - JsonSerializer.Serialize(writer, StartTimeValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeriesDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsTimeSeries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexState.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexState.g.cs index 5329a4108a0..0da1912a5bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexState.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexState.g.cs @@ -17,21 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropDefaults = System.Text.Json.JsonEncodedText.Encode("defaults"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propDefaults = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propMappings = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propDefaults.TryReadProperty(ref reader, options, PropDefaults, null)) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + DataStream = propDataStream.Value, + Defaults = propDefaults.Value, + Lifecycle = propLifecycle.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexState value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropDefaults, value.Defaults, null, null); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexStateConverter))] public sealed partial class IndexState { - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } - [JsonInclude, JsonPropertyName("data_stream")] +#if NET7_0_OR_GREATER + public IndexState() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexState() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IDictionary? Aliases { get; set; } public Elastic.Clients.Elasticsearch.DataStreamName? DataStream { get; set; } /// @@ -39,7 +134,6 @@ public sealed partial class IndexState /// Default settings, included when the request's include_default is true. /// /// - [JsonInclude, JsonPropertyName("defaults")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Defaults { get; set; } /// @@ -47,47 +141,91 @@ public sealed partial class IndexState /// Data stream lifecycle applicable if this is a data stream. /// /// - [JsonInclude, JsonPropertyName("lifecycle")] public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? Lifecycle { get; set; } - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } } -public sealed partial class IndexStateDescriptor : SerializableDescriptor> +public readonly partial struct IndexStateDescriptor { - internal IndexStateDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexState Instance { get; init; } - public IndexStateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexStateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexState instance) { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexStateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexState instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.DataStreamName? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? DefaultsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor DefaultsDescriptor { get; set; } - private Action> DefaultsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } - public IndexStateDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } - public IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName? value) { - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } /// @@ -95,28 +233,32 @@ public IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch. /// Default settings, included when the request's include_default is true. /// /// - public IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? defaults) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - DefaultsDescriptor = null; - DefaultsDescriptorAction = null; - DefaultsValue = defaults; - return Self; + Instance.Defaults = value; + return this; } - public IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Default settings, included when the request's include_default is true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults() { - DefaultsValue = null; - DefaultsDescriptorAction = null; - DefaultsDescriptor = descriptor; - return Self; + Instance.Defaults = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexStateDescriptor Defaults(Action> configure) + /// + /// + /// Default settings, included when the request's include_default is true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults(System.Action>? action) { - DefaultsValue = null; - DefaultsDescriptor = null; - DefaultsDescriptorAction = configure; - return Self; + Instance.Defaults = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -124,194 +266,188 @@ public IndexStateDescriptor Defaults(Action /// - public IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? lifecycle) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? value) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor descriptor) + /// + /// + /// Data stream lifecycle applicable if this is a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle() { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(null); + return this; } - public IndexStateDescriptor Lifecycle(Action configure) + /// + /// + /// Data stream lifecycle applicable if this is a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle(System.Action? action) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(action); + return this; } - public IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexStateDescriptor Mappings(Action> configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexStateDescriptor Settings(Action> configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexState Build(System.Action>? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) + if (action is null) { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (DefaultsDescriptor is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, DefaultsDescriptor, options); - } - else if (DefaultsDescriptorAction is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(DefaultsDescriptorAction), options); - } - else if (DefaultsValue is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, DefaultsValue, options); - } +public readonly partial struct IndexStateDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexState Instance { get; init; } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexStateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexState instance) + { + Instance = instance; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexStateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexState instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(System.Action? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); } - writer.WriteEndObject(); + Instance.Aliases = items; + return this; } -} -public sealed partial class IndexStateDescriptor : SerializableDescriptor -{ - internal IndexStateDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } - public IndexStateDescriptor() : base() + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.DataStreamName? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? DefaultsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor DefaultsDescriptor { get; set; } - private Action DefaultsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } - public IndexStateDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName? value) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.DataStream = value; + return this; } - public IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamName? dataStream) + /// + /// + /// Default settings, included when the request's include_default is true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - DataStreamValue = dataStream; - return Self; + Instance.Defaults = value; + return this; } /// @@ -319,28 +455,32 @@ public IndexStateDescriptor DataStream(Elastic.Clients.Elasticsearch.DataStreamN /// Default settings, included when the request's include_default is true. /// /// - public IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? defaults) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults() { - DefaultsDescriptor = null; - DefaultsDescriptorAction = null; - DefaultsValue = defaults; - return Self; + Instance.Defaults = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexStateDescriptor Defaults(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Default settings, included when the request's include_default is true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults(System.Action? action) { - DefaultsValue = null; - DefaultsDescriptorAction = null; - DefaultsDescriptor = descriptor; - return Self; + Instance.Defaults = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - public IndexStateDescriptor Defaults(Action configure) + /// + /// + /// Default settings, included when the request's include_default is true. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Defaults(System.Action>? action) { - DefaultsValue = null; - DefaultsDescriptor = null; - DefaultsDescriptorAction = configure; - return Self; + Instance.Defaults = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } /// @@ -348,157 +488,92 @@ public IndexStateDescriptor Defaults(Action /// - public IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? lifecycle) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? value) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexStateDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor descriptor) + /// + /// + /// Data stream lifecycle applicable if this is a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle() { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(null); + return this; } - public IndexStateDescriptor Lifecycle(Action configure) + /// + /// + /// Data stream lifecycle applicable if this is a data stream. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Lifecycle(System.Action? action) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(action); + return this; } - public IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexStateDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexStateDescriptor Mappings(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings(System.Action? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Mappings(System.Action>? action) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = value; + return this; } - public IndexStateDescriptor Settings(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings() { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings(System.Action? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } - - if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DefaultsDescriptor is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, DefaultsDescriptor, options); - } - else if (DefaultsDescriptorAction is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(DefaultsDescriptorAction), options); - } - else if (DefaultsValue is not null) - { - writer.WritePropertyName("defaults"); - JsonSerializer.Serialize(writer, DefaultsValue, options); - } - - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexState Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexStateDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexStats.g.cs index b069740dddc..7d0fddc2387 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexStats.g.cs @@ -17,156 +17,351 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBulk = System.Text.Json.JsonEncodedText.Encode("bulk"); + private static readonly System.Text.Json.JsonEncodedText PropCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropFlush = System.Text.Json.JsonEncodedText.Encode("flush"); + private static readonly System.Text.Json.JsonEncodedText PropGet = System.Text.Json.JsonEncodedText.Encode("get"); + private static readonly System.Text.Json.JsonEncodedText PropIndexing = System.Text.Json.JsonEncodedText.Encode("indexing"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMerges = System.Text.Json.JsonEncodedText.Encode("merges"); + private static readonly System.Text.Json.JsonEncodedText PropQueryCache = System.Text.Json.JsonEncodedText.Encode("query_cache"); + private static readonly System.Text.Json.JsonEncodedText PropRecovery = System.Text.Json.JsonEncodedText.Encode("recovery"); + private static readonly System.Text.Json.JsonEncodedText PropRefresh = System.Text.Json.JsonEncodedText.Encode("refresh"); + private static readonly System.Text.Json.JsonEncodedText PropRequestCache = System.Text.Json.JsonEncodedText.Encode("request_cache"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText PropSegments = System.Text.Json.JsonEncodedText.Encode("segments"); + private static readonly System.Text.Json.JsonEncodedText PropShardStats = System.Text.Json.JsonEncodedText.Encode("shard_stats"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropTranslog = System.Text.Json.JsonEncodedText.Encode("translog"); + private static readonly System.Text.Json.JsonEncodedText PropWarmer = System.Text.Json.JsonEncodedText.Encode("warmer"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBulk = default; + LocalJsonValue propCompletion = default; + LocalJsonValue propDocs = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propFlush = default; + LocalJsonValue propGet = default; + LocalJsonValue propIndexing = default; + LocalJsonValue propIndices = default; + LocalJsonValue propMerges = default; + LocalJsonValue propQueryCache = default; + LocalJsonValue propRecovery = default; + LocalJsonValue propRefresh = default; + LocalJsonValue propRequestCache = default; + LocalJsonValue propSearch = default; + LocalJsonValue propSegments = default; + LocalJsonValue propShardStats = default; + LocalJsonValue propStore = default; + LocalJsonValue propTranslog = default; + LocalJsonValue propWarmer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBulk.TryReadProperty(ref reader, options, PropBulk, null)) + { + continue; + } + + if (propCompletion.TryReadProperty(ref reader, options, PropCompletion, null)) + { + continue; + } + + if (propDocs.TryReadProperty(ref reader, options, PropDocs, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propFlush.TryReadProperty(ref reader, options, PropFlush, null)) + { + continue; + } + + if (propGet.TryReadProperty(ref reader, options, PropGet, null)) + { + continue; + } + + if (propIndexing.TryReadProperty(ref reader, options, PropIndexing, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMerges.TryReadProperty(ref reader, options, PropMerges, null)) + { + continue; + } + + if (propQueryCache.TryReadProperty(ref reader, options, PropQueryCache, null)) + { + continue; + } + + if (propRecovery.TryReadProperty(ref reader, options, PropRecovery, null)) + { + continue; + } + + if (propRefresh.TryReadProperty(ref reader, options, PropRefresh, null)) + { + continue; + } + + if (propRequestCache.TryReadProperty(ref reader, options, PropRequestCache, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (propSegments.TryReadProperty(ref reader, options, PropSegments, null)) + { + continue; + } + + if (propShardStats.TryReadProperty(ref reader, options, PropShardStats, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propTranslog.TryReadProperty(ref reader, options, PropTranslog, null)) + { + continue; + } + + if (propWarmer.TryReadProperty(ref reader, options, PropWarmer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bulk = propBulk.Value, + Completion = propCompletion.Value, + Docs = propDocs.Value, + Fielddata = propFielddata.Value, + Flush = propFlush.Value, + Get = propGet.Value, + Indexing = propIndexing.Value, + Indices = propIndices.Value, + Merges = propMerges.Value, + QueryCache = propQueryCache.Value, + Recovery = propRecovery.Value, + Refresh = propRefresh.Value, + RequestCache = propRequestCache.Value, + Search = propSearch.Value, + Segments = propSegments.Value, + ShardStats = propShardStats.Value, + Store = propStore.Value, + Translog = propTranslog.Value, + Warmer = propWarmer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBulk, value.Bulk, null, null); + writer.WriteProperty(options, PropCompletion, value.Completion, null, null); + writer.WriteProperty(options, PropDocs, value.Docs, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropFlush, value.Flush, null, null); + writer.WriteProperty(options, PropGet, value.Get, null, null); + writer.WriteProperty(options, PropIndexing, value.Indexing, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMerges, value.Merges, null, null); + writer.WriteProperty(options, PropQueryCache, value.QueryCache, null, null); + writer.WriteProperty(options, PropRecovery, value.Recovery, null, null); + writer.WriteProperty(options, PropRefresh, value.Refresh, null, null); + writer.WriteProperty(options, PropRequestCache, value.RequestCache, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteProperty(options, PropSegments, value.Segments, null, null); + writer.WriteProperty(options, PropShardStats, value.ShardStats, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropTranslog, value.Translog, null, null); + writer.WriteProperty(options, PropWarmer, value.Warmer, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexStatsConverter))] public sealed partial class IndexStats { - [JsonInclude, JsonPropertyName("bulk")] - public Elastic.Clients.Elasticsearch.BulkStats? Bulk { get; init; } +#if NET7_0_OR_GREATER + public IndexStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.BulkStats? Bulk { get; set; } /// /// /// Contains statistics about completions across all shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("completion")] - public Elastic.Clients.Elasticsearch.CompletionStats? Completion { get; init; } + public Elastic.Clients.Elasticsearch.CompletionStats? Completion { get; set; } /// /// /// Contains statistics about documents across all primary shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("docs")] - public Elastic.Clients.Elasticsearch.DocStats? Docs { get; init; } + public Elastic.Clients.Elasticsearch.DocStats? Docs { get; set; } /// /// /// Contains statistics about the field data cache across all shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("fielddata")] - public Elastic.Clients.Elasticsearch.FielddataStats? Fielddata { get; init; } + public Elastic.Clients.Elasticsearch.FielddataStats? Fielddata { get; set; } /// /// /// Contains statistics about flush operations for the node. /// /// - [JsonInclude, JsonPropertyName("flush")] - public Elastic.Clients.Elasticsearch.FlushStats? Flush { get; init; } + public Elastic.Clients.Elasticsearch.FlushStats? Flush { get; set; } /// /// /// Contains statistics about get operations for the node. /// /// - [JsonInclude, JsonPropertyName("get")] - public Elastic.Clients.Elasticsearch.GetStats? Get { get; init; } + public Elastic.Clients.Elasticsearch.GetStats? Get { get; set; } /// /// /// Contains statistics about indexing operations for the node. /// /// - [JsonInclude, JsonPropertyName("indexing")] - public Elastic.Clients.Elasticsearch.IndexingStats? Indexing { get; init; } + public Elastic.Clients.Elasticsearch.IndexingStats? Indexing { get; set; } /// /// /// Contains statistics about indices operations for the node. /// /// - [JsonInclude, JsonPropertyName("indices")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats? Indices { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats? Indices { get; set; } /// /// /// Contains statistics about merge operations for the node. /// /// - [JsonInclude, JsonPropertyName("merges")] - public Elastic.Clients.Elasticsearch.MergesStats? Merges { get; init; } + public Elastic.Clients.Elasticsearch.MergesStats? Merges { get; set; } /// /// /// Contains statistics about the query cache across all shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("query_cache")] - public Elastic.Clients.Elasticsearch.QueryCacheStats? QueryCache { get; init; } + public Elastic.Clients.Elasticsearch.QueryCacheStats? QueryCache { get; set; } /// /// /// Contains statistics about recovery operations for the node. /// /// - [JsonInclude, JsonPropertyName("recovery")] - public Elastic.Clients.Elasticsearch.RecoveryStats? Recovery { get; init; } + public Elastic.Clients.Elasticsearch.RecoveryStats? Recovery { get; set; } /// /// /// Contains statistics about refresh operations for the node. /// /// - [JsonInclude, JsonPropertyName("refresh")] - public Elastic.Clients.Elasticsearch.RefreshStats? Refresh { get; init; } + public Elastic.Clients.Elasticsearch.RefreshStats? Refresh { get; set; } /// /// /// Contains statistics about the request cache across all shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("request_cache")] - public Elastic.Clients.Elasticsearch.RequestCacheStats? RequestCache { get; init; } + public Elastic.Clients.Elasticsearch.RequestCacheStats? RequestCache { get; set; } /// /// /// Contains statistics about search operations for the node. /// /// - [JsonInclude, JsonPropertyName("search")] - public Elastic.Clients.Elasticsearch.SearchStats? Search { get; init; } + public Elastic.Clients.Elasticsearch.SearchStats? Search { get; set; } /// /// /// Contains statistics about segments across all shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("segments")] - public Elastic.Clients.Elasticsearch.SegmentsStats? Segments { get; init; } - [JsonInclude, JsonPropertyName("shard_stats")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats? ShardStats { get; init; } + public Elastic.Clients.Elasticsearch.SegmentsStats? Segments { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats? ShardStats { get; set; } /// /// /// Contains statistics about the size of shards assigned to the node. /// /// - [JsonInclude, JsonPropertyName("store")] - public Elastic.Clients.Elasticsearch.StoreStats? Store { get; init; } + public Elastic.Clients.Elasticsearch.StoreStats? Store { get; set; } /// /// /// Contains statistics about transaction log operations for the node. /// /// - [JsonInclude, JsonPropertyName("translog")] - public Elastic.Clients.Elasticsearch.TranslogStats? Translog { get; init; } + public Elastic.Clients.Elasticsearch.TranslogStats? Translog { get; set; } /// /// /// Contains statistics about index warming operations for the node. /// /// - [JsonInclude, JsonPropertyName("warmer")] - public Elastic.Clients.Elasticsearch.WarmerStats? Warmer { get; init; } + public Elastic.Clients.Elasticsearch.WarmerStats? Warmer { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplate.g.cs index 97869c59b97..79084ca62d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplate.g.cs @@ -17,19 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexTemplateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowAutoCreate = System.Text.Json.JsonEncodedText.Encode("allow_auto_create"); + private static readonly System.Text.Json.JsonEncodedText PropComposedOf = System.Text.Json.JsonEncodedText.Encode("composed_of"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissingComponentTemplates = System.Text.Json.JsonEncodedText.Encode("ignore_missing_component_templates"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowAutoCreate = default; + LocalJsonValue> propComposedOf = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propDeprecated = default; + LocalJsonValue propIgnoreMissingComponentTemplates = default; + LocalJsonValue propIndexPatterns = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPriority = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowAutoCreate.TryReadProperty(ref reader, options, PropAllowAutoCreate, null)) + { + continue; + } + + if (propComposedOf.TryReadProperty(ref reader, options, PropComposedOf, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propIgnoreMissingComponentTemplates.TryReadProperty(ref reader, options, PropIgnoreMissingComponentTemplates, null)) + { + continue; + } + + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowAutoCreate = propAllowAutoCreate.Value, + ComposedOf = propComposedOf.Value, + DataStream = propDataStream.Value, + Deprecated = propDeprecated.Value, + IgnoreMissingComponentTemplates = propIgnoreMissingComponentTemplates.Value, + IndexPatterns = propIndexPatterns.Value, + Meta = propMeta.Value, + Priority = propPriority.Value, + Template = propTemplate.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowAutoCreate, value.AllowAutoCreate, null, null); + writer.WriteProperty(options, PropComposedOf, value.ComposedOf, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropIgnoreMissingComponentTemplates, value.IgnoreMissingComponentTemplates, null, null); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateConverter))] public sealed partial class IndexTemplate { - [JsonInclude, JsonPropertyName("allow_auto_create")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplate(System.Collections.Generic.ICollection composedOf, Elastic.Clients.Elasticsearch.Names indexPatterns) + { + ComposedOf = composedOf; + IndexPatterns = indexPatterns; + } +#if NET7_0_OR_GREATER + public IndexTemplate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexTemplate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? AllowAutoCreate { get; set; } /// @@ -38,8 +177,11 @@ public sealed partial class IndexTemplate /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - [JsonInclude, JsonPropertyName("composed_of")] - public ICollection ComposedOf { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection ComposedOf { get; set; } /// /// @@ -48,7 +190,6 @@ public sealed partial class IndexTemplate /// Data streams require a matching index template with a data_stream object. /// /// - [JsonInclude, JsonPropertyName("data_stream")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? DataStream { get; set; } /// @@ -58,7 +199,6 @@ public sealed partial class IndexTemplate /// Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -66,7 +206,6 @@ public sealed partial class IndexTemplate /// A list of component template names that are allowed to be absent. /// /// - [JsonInclude, JsonPropertyName("ignore_missing_component_templates")] public Elastic.Clients.Elasticsearch.Names? IgnoreMissingComponentTemplates { get; set; } /// @@ -74,8 +213,11 @@ public sealed partial class IndexTemplate /// Name of the index template. /// /// - [JsonInclude, JsonPropertyName("index_patterns")] - public Elastic.Clients.Elasticsearch.Names IndexPatterns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names IndexPatterns { get; set; } /// /// @@ -83,8 +225,7 @@ public sealed partial class IndexTemplate /// This map is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -94,7 +235,6 @@ public sealed partial class IndexTemplate /// This number is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("priority")] public long? Priority { get; set; } /// @@ -103,7 +243,6 @@ public sealed partial class IndexTemplate /// It may optionally include an aliases, mappings, or settings configuration. /// /// - [JsonInclude, JsonPropertyName("template")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? Template { get; set; } /// @@ -112,37 +251,32 @@ public sealed partial class IndexTemplate /// This number is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } -public sealed partial class IndexTemplateDescriptor : SerializableDescriptor> +public readonly partial struct IndexTemplateDescriptor { - internal IndexTemplateDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate Instance { get; init; } - public IndexTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate instance) { + Instance = instance; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private Elastic.Clients.Elasticsearch.Names? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Names IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor TemplateDescriptor { get; set; } - private Action> TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor descriptor) => descriptor.Instance; - public IndexTemplateDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor AllowAutoCreate(bool? value = true) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.AllowAutoCreate = value; + return this; } /// @@ -151,10 +285,22 @@ public IndexTemplateDescriptor AllowAutoCreate(bool? allowAutoCreate /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public IndexTemplateDescriptor ComposedOf(ICollection composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor ComposedOf(System.Collections.Generic.ICollection value) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) + { + Instance.ComposedOf = [.. values]; + return this; } /// @@ -164,28 +310,36 @@ public IndexTemplateDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor.Build(null); + return this; } - public IndexTemplateDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor.Build(action); + return this; } /// @@ -195,10 +349,10 @@ public IndexTemplateDescriptor DataStream(Action /// - public IndexTemplateDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -206,10 +360,10 @@ public IndexTemplateDescriptor Deprecated(bool? deprecated = true) /// A list of component template names that are allowed to be absent. /// /// - public IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elastic.Clients.Elasticsearch.Names? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elastic.Clients.Elasticsearch.Names? value) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; } /// @@ -217,10 +371,34 @@ public IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elasti /// Name of the index template. /// /// - public IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Names indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Names value) + { + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta() { - IndexPatternsValue = indexPatterns; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -229,10 +407,17 @@ public IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elastics /// This map is not automatically generated by Elasticsearch. /// /// - public IndexTemplateDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor AddMeta(string key, object value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -243,10 +428,10 @@ public IndexTemplateDescriptor Meta(Func /// - public IndexTemplateDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -255,28 +440,34 @@ public IndexTemplateDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? template) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor.Build(null); + return this; } - public IndexTemplateDescriptor Template(Action> configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template(System.Action>? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor.Build(action); + return this; } /// @@ -285,118 +476,56 @@ public IndexTemplateDescriptor Template(Action /// - public IndexTemplateDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate Build(System.Action> action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) - { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); - } - - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } - - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } - - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } - - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IndexTemplateDescriptor : SerializableDescriptor +public readonly partial struct IndexTemplateDescriptor { - internal IndexTemplateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate Instance { get; init; } - public IndexTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate instance) { + Instance = instance; } - private bool? AllowAutoCreateValue { get; set; } - private ICollection ComposedOfValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? DataStreamValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor DataStreamDescriptor { get; set; } - private Action DataStreamDescriptorAction { get; set; } - private bool? DeprecatedValue { get; set; } - private Elastic.Clients.Elasticsearch.Names? IgnoreMissingComponentTemplatesValue { get; set; } - private Elastic.Clients.Elasticsearch.Names IndexPatternsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IndexTemplateDescriptor AllowAutoCreate(bool? allowAutoCreate = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor AllowAutoCreate(bool? value = true) + { + Instance.AllowAutoCreate = value; + return this; + } + + /// + /// + /// An ordered list of component template names. + /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor ComposedOf(System.Collections.Generic.ICollection value) { - AllowAutoCreateValue = allowAutoCreate; - return Self; + Instance.ComposedOf = value; + return this; } /// @@ -405,10 +534,10 @@ public IndexTemplateDescriptor AllowAutoCreate(bool? allowAutoCreate = true) /// Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence. /// /// - public IndexTemplateDescriptor ComposedOf(ICollection composedOf) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor ComposedOf(params Elastic.Clients.Elasticsearch.Name[] values) { - ComposedOfValue = composedOf; - return Self; + Instance.ComposedOf = [.. values]; + return this; } /// @@ -418,28 +547,36 @@ public IndexTemplateDescriptor ComposedOf(ICollectiondata_stream object. /// /// - public IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? dataStream) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration? value) { - DataStreamDescriptor = null; - DataStreamDescriptorAction = null; - DataStreamValue = dataStream; - return Self; + Instance.DataStream = value; + return this; } - public IndexTemplateDescriptor DataStream(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor descriptor) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream() { - DataStreamValue = null; - DataStreamDescriptorAction = null; - DataStreamDescriptor = descriptor; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor.Build(null); + return this; } - public IndexTemplateDescriptor DataStream(Action configure) + /// + /// + /// If this object is included, the template is used to create data streams and their backing indices. + /// Supports an empty object. + /// Data streams require a matching index template with a data_stream object. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor DataStream(System.Action? action) { - DataStreamValue = null; - DataStreamDescriptor = null; - DataStreamDescriptorAction = configure; - return Self; + Instance.DataStream = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor.Build(action); + return this; } /// @@ -449,10 +586,10 @@ public IndexTemplateDescriptor DataStream(Action /// - public IndexTemplateDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -460,10 +597,10 @@ public IndexTemplateDescriptor Deprecated(bool? deprecated = true) /// A list of component template names that are allowed to be absent. /// /// - public IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elastic.Clients.Elasticsearch.Names? ignoreMissingComponentTemplates) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elastic.Clients.Elasticsearch.Names? value) { - IgnoreMissingComponentTemplatesValue = ignoreMissingComponentTemplates; - return Self; + Instance.IgnoreMissingComponentTemplates = value; + return this; } /// @@ -471,10 +608,22 @@ public IndexTemplateDescriptor IgnoreMissingComponentTemplates(Elastic.Clients.E /// Name of the index template. /// /// - public IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Names indexPatterns) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Names value) + { + Instance.IndexPatterns = value; + return this; + } + + /// + /// + /// Optional user metadata about the index template. May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexPatternsValue = indexPatterns; - return Self; + Instance.Meta = value; + return this; } /// @@ -483,10 +632,29 @@ public IndexTemplateDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Names /// This map is not automatically generated by Elasticsearch. /// /// - public IndexTemplateDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Optional user metadata about the index template. May have any contents. + /// This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -497,10 +665,10 @@ public IndexTemplateDescriptor Meta(Func, Fluen /// This number is not automatically generated by Elasticsearch. /// /// - public IndexTemplateDescriptor Priority(long? priority) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Priority(long? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -509,28 +677,46 @@ public IndexTemplateDescriptor Priority(long? priority) /// It may optionally include an aliases, mappings, or settings configuration. /// /// - public IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? template) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Template = value; + return this; } - public IndexTemplateDescriptor Template(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor descriptor) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template() { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor.Build(null); + return this; } - public IndexTemplateDescriptor Template(Action configure) + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template(System.Action? action) { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor.Build(action); + return this; + } + + /// + /// + /// Template to be applied. + /// It may optionally include an aliases, mappings, or settings configuration. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Template(System.Action>? action) + { + Instance.Template = Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor.Build(action); + return this; } /// @@ -539,87 +725,17 @@ public IndexTemplateDescriptor Template(Action /// - public IndexTemplateDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate Build(System.Action action) { - writer.WriteStartObject(); - if (AllowAutoCreateValue.HasValue) - { - writer.WritePropertyName("allow_auto_create"); - writer.WriteBooleanValue(AllowAutoCreateValue.Value); - } - - writer.WritePropertyName("composed_of"); - JsonSerializer.Serialize(writer, ComposedOfValue, options); - if (DataStreamDescriptor is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamDescriptor, options); - } - else if (DataStreamDescriptorAction is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor(DataStreamDescriptorAction), options); - } - else if (DataStreamValue is not null) - { - writer.WritePropertyName("data_stream"); - JsonSerializer.Serialize(writer, DataStreamValue, options); - } - - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } - - if (IgnoreMissingComponentTemplatesValue is not null) - { - writer.WritePropertyName("ignore_missing_component_templates"); - JsonSerializer.Serialize(writer, IgnoreMissingComponentTemplatesValue, options); - } - - writer.WritePropertyName("index_patterns"); - JsonSerializer.Serialize(writer, IndexPatternsValue, options); - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } - - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateDataStreamConfiguration.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateDataStreamConfiguration.g.cs index aef9bcd6101..b1f1f71c0ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateDataStreamConfiguration.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateDataStreamConfiguration.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexTemplateDataStreamConfigurationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowCustomRouting = System.Text.Json.JsonEncodedText.Encode("allow_custom_routing"); + private static readonly System.Text.Json.JsonEncodedText PropHidden = System.Text.Json.JsonEncodedText.Encode("hidden"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowCustomRouting = default; + LocalJsonValue propHidden = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowCustomRouting.TryReadProperty(ref reader, options, PropAllowCustomRouting, null)) + { + continue; + } + + if (propHidden.TryReadProperty(ref reader, options, PropHidden, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowCustomRouting = propAllowCustomRouting.Value, + Hidden = propHidden.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowCustomRouting, value.AllowCustomRouting, null, null); + writer.WriteProperty(options, PropHidden, value.Hidden, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationConverter))] public sealed partial class IndexTemplateDataStreamConfiguration { +#if NET7_0_OR_GREATER + public IndexTemplateDataStreamConfiguration() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexTemplateDataStreamConfiguration() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, the data stream supports custom routing. /// /// - [JsonInclude, JsonPropertyName("allow_custom_routing")] public bool? AllowCustomRouting { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class IndexTemplateDataStreamConfiguration /// If true, the data stream is hidden. /// /// - [JsonInclude, JsonPropertyName("hidden")] public bool? Hidden { get; set; } } -public sealed partial class IndexTemplateDataStreamConfigurationDescriptor : SerializableDescriptor +public readonly partial struct IndexTemplateDataStreamConfigurationDescriptor { - internal IndexTemplateDataStreamConfigurationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration Instance { get; init; } - public IndexTemplateDataStreamConfigurationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDataStreamConfigurationDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration instance) { + Instance = instance; } - private bool? AllowCustomRoutingValue { get; set; } - private bool? HiddenValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateDataStreamConfigurationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor descriptor) => descriptor.Instance; /// /// /// If true, the data stream supports custom routing. /// /// - public IndexTemplateDataStreamConfigurationDescriptor AllowCustomRouting(bool? allowCustomRouting = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor AllowCustomRouting(bool? value = true) { - AllowCustomRoutingValue = allowCustomRouting; - return Self; + Instance.AllowCustomRouting = value; + return this; } /// @@ -73,27 +140,22 @@ public IndexTemplateDataStreamConfigurationDescriptor AllowCustomRouting(bool? a /// If true, the data stream is hidden. /// /// - public IndexTemplateDataStreamConfigurationDescriptor Hidden(bool? hidden = true) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor Hidden(bool? value = true) { - HiddenValue = hidden; - return Self; + Instance.Hidden = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration Build(System.Action? action) { - writer.WriteStartObject(); - if (AllowCustomRoutingValue.HasValue) + if (action is null) { - writer.WritePropertyName("allow_custom_routing"); - writer.WriteBooleanValue(AllowCustomRoutingValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (HiddenValue.HasValue) - { - writer.WritePropertyName("hidden"); - writer.WriteBooleanValue(HiddenValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfigurationDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateDataStreamConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateItem.g.cs index 0d18b704f1d..bdcfccb489b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateItem.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexTemplateItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexTemplate = System.Text.Json.JsonEncodedText.Encode("index_template"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexTemplate = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexTemplate.TryReadProperty(ref reader, options, PropIndexTemplate, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexTemplate = propIndexTemplate.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexTemplate, value.IndexTemplate, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateItemConverter))] public sealed partial class IndexTemplateItem { - [JsonInclude, JsonPropertyName("index_template")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate IndexTemplate { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateItem(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate indexTemplate, string name) + { + IndexTemplate = indexTemplate; + Name = name; + } +#if NET7_0_OR_GREATER + public IndexTemplateItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexTemplateItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexTemplateItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplate IndexTemplate { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateMapping.g.cs index 39b1b8a0161..58e256184b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateMapping.g.cs @@ -17,18 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexTemplateMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propMappings = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Lifecycle = propLifecycle.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingConverter))] public sealed partial class IndexTemplateMapping { +#if NET7_0_OR_GREATER + public IndexTemplateMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexTemplateMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Aliases to add. @@ -37,9 +116,7 @@ public sealed partial class IndexTemplateMapping /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } - [JsonInclude, JsonPropertyName("lifecycle")] + public System.Collections.Generic.IDictionary? Aliases { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? Lifecycle { get; set; } /// @@ -48,7 +125,6 @@ public sealed partial class IndexTemplateMapping /// If specified, this mapping can include field names, field data types, and mapping parameters. /// /// - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } /// @@ -56,28 +132,90 @@ public sealed partial class IndexTemplateMapping /// Configuration options for the index. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } } -public sealed partial class IndexTemplateMappingDescriptor : SerializableDescriptor> +public readonly partial struct IndexTemplateMappingDescriptor { - internal IndexTemplateMappingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateMappingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping instance) + { + Instance = instance; + } - public IndexTemplateMappingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateMappingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } /// /// @@ -87,34 +225,48 @@ public IndexTemplateMappingDescriptor() : base() /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - public IndexTemplateMappingDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? lifecycle) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? value) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle() { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle(System.Action? action) + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(action); + return this; } /// @@ -123,28 +275,34 @@ public IndexTemplateMappingDescriptor Lifecycle(Action /// - public IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexTemplateMappingDescriptor Mappings(Action> configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -152,109 +310,94 @@ public IndexTemplateMappingDescriptor Mappings(Action /// - public IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexTemplateMappingDescriptor Settings(Action> configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping Build(System.Action>? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) + if (action is null) { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } +public readonly partial struct IndexTemplateMappingDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping Instance { get; init; } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateMappingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateMappingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class IndexTemplateMappingDescriptor : SerializableDescriptor -{ - internal IndexTemplateMappingDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor descriptor) => descriptor.Instance; - public IndexTemplateMappingDescriptor() : base() + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(System.Collections.Generic.IDictionary? value) { + Instance.Aliases = value; + return this; } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } /// /// @@ -264,34 +407,104 @@ public IndexTemplateMappingDescriptor() : base() /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - public IndexTemplateMappingDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(System.Action? action) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? lifecycle) + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(System.Action>? action) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; } - public IndexTemplateMappingDescriptor Lifecycle(Action configure) + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycle? value) + { + Instance.Lifecycle = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle() + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Lifecycle(System.Action? action) + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor.Build(action); + return this; } /// @@ -300,116 +513,102 @@ public IndexTemplateMappingDescriptor Lifecycle(Action /// - public IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexTemplateMappingDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexTemplateMappingDescriptor Mappings(Action configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings(System.Action? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// /// - /// Configuration options for the index. + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. /// /// - public IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Mappings(System.Action>? action) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = value; + return this; } - public IndexTemplateMappingDescriptor Settings(Action configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings() { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings(System.Action? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } - - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMappingDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateSummary.g.cs index 15fdb68c53c..f38361db6cf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexTemplateSummary.g.cs @@ -17,18 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexTemplateSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropLifecycle = System.Text.Json.JsonEncodedText.Encode("lifecycle"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue propLifecycle = default; + LocalJsonValue propMappings = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propLifecycle.TryReadProperty(ref reader, options, PropLifecycle, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Lifecycle = propLifecycle.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLifecycle, value.Lifecycle, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryConverter))] public sealed partial class IndexTemplateSummary { +#if NET7_0_OR_GREATER + public IndexTemplateSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexTemplateSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Aliases to add. @@ -37,9 +116,7 @@ public sealed partial class IndexTemplateSummary /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - [JsonInclude, JsonPropertyName("aliases")] - public IDictionary? Aliases { get; set; } - [JsonInclude, JsonPropertyName("lifecycle")] + public System.Collections.Generic.IDictionary? Aliases { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? Lifecycle { get; set; } /// @@ -48,7 +125,6 @@ public sealed partial class IndexTemplateSummary /// If specified, this mapping can include field names, field data types, and mapping parameters. /// /// - [JsonInclude, JsonPropertyName("mappings")] public Elastic.Clients.Elasticsearch.Mapping.TypeMapping? Mappings { get; set; } /// @@ -56,28 +132,90 @@ public sealed partial class IndexTemplateSummary /// Configuration options for the index. /// /// - [JsonInclude, JsonPropertyName("settings")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } } -public sealed partial class IndexTemplateSummaryDescriptor : SerializableDescriptor> +public readonly partial struct IndexTemplateSummaryDescriptor { - internal IndexTemplateSummaryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary instance) + { + Instance = instance; + } - public IndexTemplateSummaryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateSummaryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary> AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action> MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action> SettingsDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(System.Collections.Generic.IDictionary? value) + { + Instance.Aliases = value; + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(System.Action>? action) + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } /// /// @@ -87,34 +225,48 @@ public IndexTemplateSummaryDescriptor() : base() /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - public IndexTemplateSummaryDescriptor Aliases(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? lifecycle) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? value) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Lifecycle = value; + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle() { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle(System.Action? action) + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(action); + return this; } /// @@ -123,28 +275,34 @@ public IndexTemplateSummaryDescriptor Lifecycle(Action /// - public IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexTemplateSummaryDescriptor Mappings(Action> configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings(System.Action>? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// @@ -152,109 +310,94 @@ public IndexTemplateSummaryDescriptor Mappings(Action /// - public IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Settings = value; + return this; } - public IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings() { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public IndexTemplateSummaryDescriptor Settings(Action> configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings(System.Action>? action) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary Build(System.Action>? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) + if (action is null) { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } +public readonly partial struct IndexTemplateSummaryDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary Instance { get; init; } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexTemplateSummaryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class IndexTemplateSummaryDescriptor : SerializableDescriptor -{ - internal IndexTemplateSummaryDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor descriptor) => descriptor.Instance; - public IndexTemplateSummaryDescriptor() : base() + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(System.Collections.Generic.IDictionary? value) { + Instance.Aliases = value; + return this; } - private IDictionary AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? LifecycleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor LifecycleDescriptor { get; set; } - private Action LifecycleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMapping? MappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } - private Action MappingsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases() + { + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(null); + return this; + } /// /// @@ -264,34 +407,104 @@ public IndexTemplateSummaryDescriptor() : base() /// Data stream aliases ignore the index_routing, routing, and search_routing options. /// /// - public IndexTemplateSummaryDescriptor Aliases(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(System.Action? action) { - AliasesValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? lifecycle) + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(System.Action>? action) { - LifecycleDescriptor = null; - LifecycleDescriptorAction = null; - LifecycleValue = lifecycle; - return Self; + Instance.Aliases = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfIndexNameAlias.Build(action); + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, Elastic.Clients.Elasticsearch.IndexManagement.Alias value) { - LifecycleValue = null; - LifecycleDescriptorAction = null; - LifecycleDescriptor = descriptor; - return Self; + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, value); + return this; } - public IndexTemplateSummaryDescriptor Lifecycle(Action configure) + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(Elastic.Clients.Elasticsearch.IndexName key) { - LifecycleValue = null; - LifecycleDescriptor = null; - LifecycleDescriptorAction = configure; - return Self; + Instance.Aliases = new System.Collections.Generic.Dictionary { { key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null) } }; + return this; + } + + /// + /// + /// Aliases to add. + /// If the index template includes a data_stream object, these are data stream aliases. + /// Otherwise, these are index aliases. + /// Data stream aliases ignore the index_routing, routing, and search_routing options. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexName[] keys) + { + var items = new System.Collections.Generic.Dictionary(); + foreach (var key in keys) + { + items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + } + + Instance.Aliases = items; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor AddAlias(Elastic.Clients.Elasticsearch.IndexName key, System.Action>? action) + { + Instance.Aliases ??= new System.Collections.Generic.Dictionary(); + Instance.Aliases.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.AliasDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle(Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRollover? value) + { + Instance.Lifecycle = value; + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle() + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Lifecycle(System.Action? action) + { + Instance.Lifecycle = Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor.Build(action); + return this; } /// @@ -300,116 +513,102 @@ public IndexTemplateSummaryDescriptor Lifecycle(Action /// - public IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? mappings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMapping? value) { - MappingsDescriptor = null; - MappingsDescriptorAction = null; - MappingsValue = mappings; - return Self; + Instance.Mappings = value; + return this; } - public IndexTemplateSummaryDescriptor Mappings(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings() { - MappingsValue = null; - MappingsDescriptorAction = null; - MappingsDescriptor = descriptor; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(null); + return this; } - public IndexTemplateSummaryDescriptor Mappings(Action configure) + /// + /// + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings(System.Action? action) { - MappingsValue = null; - MappingsDescriptor = null; - MappingsDescriptorAction = configure; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } /// /// - /// Configuration options for the index. + /// Mapping for fields in the index. + /// If specified, this mapping can include field names, field data types, and mapping parameters. /// /// - public IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Mappings(System.Action>? action) { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance.Mappings = Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor.Build(action); + return this; } - public IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = value; + return this; } - public IndexTemplateSummaryDescriptor Settings(Action configure) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings() { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings(System.Action? action) { - writer.WriteStartObject(); - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - JsonSerializer.Serialize(writer, AliasesValue, options); - } - - if (LifecycleDescriptor is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleDescriptor, options); - } - else if (LifecycleDescriptorAction is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.DataStreamLifecycleWithRolloverDescriptor(LifecycleDescriptorAction), options); - } - else if (LifecycleValue is not null) - { - writer.WritePropertyName("lifecycle"); - JsonSerializer.Serialize(writer, LifecycleValue, options); - } + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (MappingsDescriptor is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsDescriptor, options); - } - else if (MappingsDescriptorAction is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(MappingsDescriptorAction), options); - } - else if (MappingsValue is not null) - { - writer.WritePropertyName("mappings"); - JsonSerializer.Serialize(writer, MappingsValue, options); - } + /// + /// + /// Configuration options for the index. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor Settings(System.Action>? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); - } - else if (SettingsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummaryDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexTemplateSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexUpdateAliasesAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexUpdateAliasesAction.g.cs index df29e80b76f..2a067152387 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexUpdateAliasesAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexUpdateAliasesAction.g.cs @@ -17,241 +17,431 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -[JsonConverter(typeof(IndexUpdateAliasesActionConverter))] -public sealed partial class IndexUpdateAliasesAction +internal sealed partial class IndexUpdateAliasesActionConverter : System.Text.Json.Serialization.JsonConverter { - internal IndexUpdateAliasesAction(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static IndexUpdateAliasesAction Add(Elastic.Clients.Elasticsearch.IndexManagement.AddAction addAction) => new IndexUpdateAliasesAction("add", addAction); - public static IndexUpdateAliasesAction Remove(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction removeAction) => new IndexUpdateAliasesAction("remove", removeAction); - public static IndexUpdateAliasesAction RemoveIndex(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction removeIndexAction) => new IndexUpdateAliasesAction("remove_index", removeIndexAction); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantAdd = System.Text.Json.JsonEncodedText.Encode("add"); + private static readonly System.Text.Json.JsonEncodedText VariantRemove = System.Text.Json.JsonEncodedText.Encode("remove"); + private static readonly System.Text.Json.JsonEncodedText VariantRemoveIndex = System.Text.Json.JsonEncodedText.Encode("remove_index"); -internal sealed partial class IndexUpdateAliasesActionConverter : JsonConverter -{ - public override IndexUpdateAliasesAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAdd)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAdd.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "add") + if (reader.ValueTextEquals(VariantRemove)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRemove.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "remove") + if (reader.ValueTextEquals(VariantRemoveIndex)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRemoveIndex.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "remove_index") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'IndexUpdateAliasesAction' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new IndexUpdateAliasesAction(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, IndexUpdateAliasesAction value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "add": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.IndexManagement.AddAction)value.Variant, options); - break; - case "remove": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction)value.Variant, options); - break; - case "remove_index": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction)value.Variant, options); - break; - } + case null: + break; + case "add": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.IndexManagement.AddAction)value.Variant, null, null); + break; + case "remove": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction)value.Variant, null, null); + break; + case "remove_index": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction)}'."); } writer.WriteEndObject(); } } -public sealed partial class IndexUpdateAliasesActionDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionConverter))] +public sealed partial class IndexUpdateAliasesAction { - internal IndexUpdateAliasesActionDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public IndexUpdateAliasesAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexUpdateAliasesAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public IndexUpdateAliasesActionDescriptor() : base() + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.AddAction? Add { get => GetVariant("add"); set => SetVariant("add", value); } + + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction? Remove { get => GetVariant("remove"); set => SetVariant("remove", value); } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction? RemoveIndex { get => GetVariant("remove_index"); set => SetVariant("remove_index", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.IndexManagement.AddAction value) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction { Add = value }; + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction value) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction { Remove = value }; + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction value) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction { RemoveIndex = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} - private IndexUpdateAliasesActionDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +public readonly partial struct IndexUpdateAliasesActionDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexUpdateAliasesActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private IndexUpdateAliasesActionDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexUpdateAliasesActionDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexUpdateAliasesActionDescriptor Add(Elastic.Clients.Elasticsearch.IndexManagement.AddAction addAction) => Set(addAction, "add"); - public IndexUpdateAliasesActionDescriptor Add(Action> configure) => Set(configure, "add"); - public IndexUpdateAliasesActionDescriptor Remove(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction removeAction) => Set(removeAction, "remove"); - public IndexUpdateAliasesActionDescriptor Remove(Action configure) => Set(configure, "remove"); - public IndexUpdateAliasesActionDescriptor RemoveIndex(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction removeIndexAction) => Set(removeIndexAction, "remove_index"); - public IndexUpdateAliasesActionDescriptor RemoveIndex(Action configure) => Set(configure, "remove_index"); + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add(Elastic.Clients.Elasticsearch.IndexManagement.AddAction? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Add = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add() + { + Instance.Add = Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add(System.Action>? action) + { + Instance.Add = Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction? value) + { + Instance.Remove = value; + return this; + } + + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove() + { + Instance.Remove = Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor.Build(null); + return this; + } + + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove(System.Action? action) + { + Instance.Remove = Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor.Build(action); + return this; + } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction? value) + { + Instance.RemoveIndex = value; + return this; + } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex() + { + Instance.RemoveIndex = Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor.Build(null); + return this; + } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex(System.Action? action) + { + Instance.RemoveIndex = Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IndexUpdateAliasesActionDescriptor : SerializableDescriptor +public readonly partial struct IndexUpdateAliasesActionDescriptor { - internal IndexUpdateAliasesActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexUpdateAliasesActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexUpdateAliasesActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor descriptor) => descriptor.Instance; - public IndexUpdateAliasesActionDescriptor() : base() + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add(Elastic.Clients.Elasticsearch.IndexManagement.AddAction? value) { + Instance.Add = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add() + { + Instance.Add = Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor.Build(null); + return this; + } - private IndexUpdateAliasesActionDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add(System.Action? action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Add = Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor.Build(action); + return this; } - private IndexUpdateAliasesActionDescriptor Set(object variant, string variantName) + /// + /// + /// Adds a data stream or index to an alias. + /// If the alias doesn’t exist, the add action creates it. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Add(System.Action>? action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Add = Elastic.Clients.Elasticsearch.IndexManagement.AddActionDescriptor.Build(action); + return this; } - public IndexUpdateAliasesActionDescriptor Add(Elastic.Clients.Elasticsearch.IndexManagement.AddAction addAction) => Set(addAction, "add"); - public IndexUpdateAliasesActionDescriptor Add(Action configure) => Set(configure, "add"); - public IndexUpdateAliasesActionDescriptor Remove(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction removeAction) => Set(removeAction, "remove"); - public IndexUpdateAliasesActionDescriptor Remove(Action configure) => Set(configure, "remove"); - public IndexUpdateAliasesActionDescriptor RemoveIndex(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction removeIndexAction) => Set(removeIndexAction, "remove_index"); - public IndexUpdateAliasesActionDescriptor RemoveIndex(Action configure) => Set(configure, "remove_index"); + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction? value) + { + Instance.Remove = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Remove = Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor.Build(null); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Removes a data stream or index from an alias. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor Remove(System.Action? action) + { + Instance.Remove = Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction? value) + { + Instance.RemoveIndex = value; + return this; + } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex() + { + Instance.RemoveIndex = Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor.Build(null); + return this; + } + + /// + /// + /// Deletes an index. + /// You cannot use this action on aliases or data streams. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor RemoveIndex(System.Action? action) + { + Instance.RemoveIndex = Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexVersioning.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexVersioning.g.cs index 0ea324d4c2f..8c21fbc2ec9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexVersioning.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexVersioning.g.cs @@ -17,62 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexVersioningConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + private static readonly System.Text.Json.JsonEncodedText PropCreatedString = System.Text.Json.JsonEncodedText.Encode("created_string"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreated = default; + LocalJsonValue propCreatedString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (propCreatedString.TryReadProperty(ref reader, options, PropCreatedString, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value, + CreatedString = propCreatedString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteProperty(options, PropCreatedString, value.CreatedString, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningConverter))] public sealed partial class IndexVersioning { - [JsonInclude, JsonPropertyName("created")] +#if NET7_0_OR_GREATER + public IndexVersioning() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexVersioning() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexVersioning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Created { get; set; } - [JsonInclude, JsonPropertyName("created_string")] public string? CreatedString { get; set; } } -public sealed partial class IndexVersioningDescriptor : SerializableDescriptor +public readonly partial struct IndexVersioningDescriptor { - internal IndexVersioningDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning Instance { get; init; } - public IndexVersioningDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexVersioningDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning instance) { + Instance = instance; } - private string? CreatedValue { get; set; } - private string? CreatedStringValue { get; set; } - - public IndexVersioningDescriptor Created(string? created) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexVersioningDescriptor() { - CreatedValue = created; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexVersioningDescriptor CreatedString(string? createdString) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning(Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor Created(string? value) { - CreatedStringValue = createdString; - return Self; + Instance.Created = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor CreatedString(string? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(CreatedValue)) - { - writer.WritePropertyName("created"); - writer.WriteStringValue(CreatedValue); - } + Instance.CreatedString = value; + return this; + } - if (!string.IsNullOrEmpty(CreatedStringValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("created_string"); - writer.WriteStringValue(CreatedStringValue); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioningDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexVersioning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressure.g.cs index ce90dc10053..43c5de801fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressure.g.cs @@ -17,77 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexingPressureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemory = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Memory = propMemory.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureConverter))] public sealed partial class IndexingPressure { - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory Memory { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory memory) + { + Memory = memory; + } +#if NET7_0_OR_GREATER + public IndexingPressure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexingPressure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory Memory { get; set; } } -public sealed partial class IndexingPressureDescriptor : SerializableDescriptor +public readonly partial struct IndexingPressureDescriptor { - internal IndexingPressureDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure Instance { get; init; } - public IndexingPressureDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory MemoryValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor MemoryDescriptor { get; set; } - private Action MemoryDescriptorAction { get; set; } - - public IndexingPressureDescriptor Memory(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory memory) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureDescriptor() { - MemoryDescriptor = null; - MemoryDescriptorAction = null; - MemoryValue = memory; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexingPressureDescriptor Memory(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor Memory(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory value) { - MemoryValue = null; - MemoryDescriptorAction = null; - MemoryDescriptor = descriptor; - return Self; + Instance.Memory = value; + return this; } - public IndexingPressureDescriptor Memory(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor Memory() { - MemoryValue = null; - MemoryDescriptor = null; - MemoryDescriptorAction = configure; - return Self; + Instance.Memory = Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor Memory(System.Action? action) { - writer.WriteStartObject(); - if (MemoryDescriptor is not null) - { - writer.WritePropertyName("memory"); - JsonSerializer.Serialize(writer, MemoryDescriptor, options); - } - else if (MemoryDescriptorAction is not null) - { - writer.WritePropertyName("memory"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor(MemoryDescriptorAction), options); - } - else - { - writer.WritePropertyName("memory"); - JsonSerializer.Serialize(writer, MemoryValue, options); - } + Instance.Memory = Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressureMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressureMemory.g.cs index 2c1bfc3d6f6..722cf8954f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressureMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingPressureMemory.g.cs @@ -17,18 +17,70 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexingPressureMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryConverter))] public sealed partial class IndexingPressureMemory { +#if NET7_0_OR_GREATER + public IndexingPressureMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexingPressureMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of outstanding bytes that may be consumed by indexing requests. When this limit is reached or exceeded, @@ -36,19 +88,27 @@ public sealed partial class IndexingPressureMemory /// the node will reject new replica operations. Defaults to 10% of the heap. /// /// - [JsonInclude, JsonPropertyName("limit")] public int? Limit { get; set; } } -public sealed partial class IndexingPressureMemoryDescriptor : SerializableDescriptor +public readonly partial struct IndexingPressureMemoryDescriptor { - internal IndexingPressureMemoryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory Instance { get; init; } - public IndexingPressureMemoryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureMemoryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory instance) { + Instance = instance; } - private int? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingPressureMemoryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory(Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor descriptor) => descriptor.Instance; /// /// @@ -57,21 +117,22 @@ public IndexingPressureMemoryDescriptor() : base() /// the node will reject new replica operations. Defaults to 10% of the heap. /// /// - public IndexingPressureMemoryDescriptor Limit(int? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor Limit(int? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemoryDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogSettings.g.cs index 76acfbb2c0a..ec4b8759157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogSettings.g.cs @@ -17,122 +17,168 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexingSlowlogSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLevel = System.Text.Json.JsonEncodedText.Encode("level"); + private static readonly System.Text.Json.JsonEncodedText PropReformat = System.Text.Json.JsonEncodedText.Encode("reformat"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropThreshold = System.Text.Json.JsonEncodedText.Encode("threshold"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLevel = default; + LocalJsonValue propReformat = default; + LocalJsonValue propSource = default; + LocalJsonValue propThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLevel.TryReadProperty(ref reader, options, PropLevel, null)) + { + continue; + } + + if (propReformat.TryReadProperty(ref reader, options, PropReformat, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propThreshold.TryReadProperty(ref reader, options, PropThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Level = propLevel.Value, + Reformat = propReformat.Value, + Source = propSource.Value, + Threshold = propThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLevel, value.Level, null, null); + writer.WriteProperty(options, PropReformat, value.Reformat, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropThreshold, value.Threshold, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsConverter))] public sealed partial class IndexingSlowlogSettings { - [JsonInclude, JsonPropertyName("level")] +#if NET7_0_OR_GREATER + public IndexingSlowlogSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexingSlowlogSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Level { get; set; } - [JsonInclude, JsonPropertyName("reformat")] public bool? Reformat { get; set; } - [JsonInclude, JsonPropertyName("source")] public int? Source { get; set; } - [JsonInclude, JsonPropertyName("threshold")] public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds? Threshold { get; set; } } -public sealed partial class IndexingSlowlogSettingsDescriptor : SerializableDescriptor +public readonly partial struct IndexingSlowlogSettingsDescriptor { - internal IndexingSlowlogSettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings Instance { get; init; } - public IndexingSlowlogSettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingSlowlogSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings instance) { + Instance = instance; } - private string? LevelValue { get; set; } - private bool? ReformatValue { get; set; } - private int? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds? ThresholdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor ThresholdDescriptor { get; set; } - private Action ThresholdDescriptorAction { get; set; } - - public IndexingSlowlogSettingsDescriptor Level(string? level) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingSlowlogSettingsDescriptor() { - LevelValue = level; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IndexingSlowlogSettingsDescriptor Reformat(bool? reformat = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Level(string? value) { - ReformatValue = reformat; - return Self; + Instance.Level = value; + return this; } - public IndexingSlowlogSettingsDescriptor Source(int? source) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Reformat(bool? value = true) { - SourceValue = source; - return Self; + Instance.Reformat = value; + return this; } - public IndexingSlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds? threshold) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Source(int? value) { - ThresholdDescriptor = null; - ThresholdDescriptorAction = null; - ThresholdValue = threshold; - return Self; + Instance.Source = value; + return this; } - public IndexingSlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds? value) { - ThresholdValue = null; - ThresholdDescriptorAction = null; - ThresholdDescriptor = descriptor; - return Self; + Instance.Threshold = value; + return this; } - public IndexingSlowlogSettingsDescriptor Threshold(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Threshold() { - ThresholdValue = null; - ThresholdDescriptor = null; - ThresholdDescriptorAction = configure; - return Self; + Instance.Threshold = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor Threshold(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(LevelValue)) - { - writer.WritePropertyName("level"); - writer.WriteStringValue(LevelValue); - } - - if (ReformatValue.HasValue) - { - writer.WritePropertyName("reformat"); - writer.WriteBooleanValue(ReformatValue.Value); - } - - if (SourceValue.HasValue) - { - writer.WritePropertyName("source"); - writer.WriteNumberValue(SourceValue.Value); - } + Instance.Threshold = Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor.Build(action); + return this; + } - if (ThresholdDescriptor is not null) - { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, ThresholdDescriptor, options); - } - else if (ThresholdDescriptorAction is not null) - { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor(ThresholdDescriptorAction), options); - } - else if (ThresholdValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, ThresholdValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettingsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogTresholds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogTresholds.g.cs index 7bcf5ae689a..707957775a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogTresholds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndexingSlowlogTresholds.g.cs @@ -17,39 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndexingSlowlogTresholdsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsConverter))] public sealed partial class IndexingSlowlogTresholds { +#if NET7_0_OR_GREATER + public IndexingSlowlogTresholds() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexingSlowlogTresholds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The indexing slow log, similar in functionality to the search slow log. The log file name ends with _index_indexing_slowlog.json. /// Log and the thresholds are configured in the same way as the search slowlog. /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? Index { get; set; } } -public sealed partial class IndexingSlowlogTresholdsDescriptor : SerializableDescriptor +public readonly partial struct IndexingSlowlogTresholdsDescriptor { - internal IndexingSlowlogTresholdsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingSlowlogTresholdsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds instance) + { + Instance = instance; + } - public IndexingSlowlogTresholdsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingSlowlogTresholdsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor IndexDescriptor { get; set; } - private Action IndexDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds instance) => new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor descriptor) => descriptor.Instance; /// /// @@ -57,49 +115,46 @@ public IndexingSlowlogTresholdsDescriptor() : base() /// Log and the thresholds are configured in the same way as the search slowlog. /// /// - public IndexingSlowlogTresholdsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? index) + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? value) { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public IndexingSlowlogTresholdsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor descriptor) + /// + /// + /// The indexing slow log, similar in functionality to the search slow log. The log file name ends with _index_indexing_slowlog.json. + /// Log and the thresholds are configured in the same way as the search slowlog. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor Index() { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptor = descriptor; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(null); + return this; } - public IndexingSlowlogTresholdsDescriptor Index(Action configure) + /// + /// + /// The indexing slow log, similar in functionality to the search slow log. The log file name ends with _index_indexing_slowlog.json. + /// Log and the thresholds are configured in the same way as the search slowlog. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor Index(System.Action? action) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = configure; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexDescriptor is not null) + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(IndexDescriptorAction), options); - } - else if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholdsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.IndexingSlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesShardStores.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesShardStores.g.cs index 23e111c289a..557732c7227 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesShardStores.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesShardStores.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndicesShardStoresConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndicesShardStores Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesShardStores(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndicesShardStores value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesShardStoresConverter))] public sealed partial class IndicesShardStores { - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesShardStores(System.Collections.Generic.IReadOnlyDictionary shards) + { + Shards = shards; + } +#if NET7_0_OR_GREATER + public IndicesShardStores() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndicesShardStores() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesShardStores(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesStats.g.cs index e50c989d36b..538f482b32e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesStats.g.cs @@ -17,28 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndicesStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHealth = System.Text.Json.JsonEncodedText.Encode("health"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaries = System.Text.Json.JsonEncodedText.Encode("primaries"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHealth = default; + LocalJsonValue propPrimaries = default; + LocalJsonValue>?> propShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTotal = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHealth.TryReadProperty(ref reader, options, PropHealth, null)) + { + continue; + } + + if (propPrimaries.TryReadProperty(ref reader, options, PropPrimaries, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Health = propHealth.Value, + Primaries = propPrimaries.Value, + Shards = propShards.Value, + Status = propStatus.Value, + Total = propTotal.Value, + Uuid = propUuid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHealth, value.Health, null, null); + writer.WriteProperty(options, PropPrimaries, value.Primaries, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesStatsConverter))] public sealed partial class IndicesStats { - [JsonInclude, JsonPropertyName("health")] - public Elastic.Clients.Elasticsearch.HealthStatus? Health { get; init; } - [JsonInclude, JsonPropertyName("primaries")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexStats? Primaries { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary>? Shards { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState? Status { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexStats? Total { get; init; } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; init; } +#if NET7_0_OR_GREATER + public IndicesStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndicesStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.HealthStatus? Health { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStats? Primaries { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>? Shards { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexMetadataState? Status { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexStats? Total { get; set; } + public string? Uuid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesValidationExplanation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesValidationExplanation.g.cs index 5ed18677b39..e35178ca7b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesValidationExplanation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/IndicesValidationExplanation.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class IndicesValidationExplanationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropExplanation = System.Text.Json.JsonEncodedText.Encode("explanation"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropValid = System.Text.Json.JsonEncodedText.Encode("valid"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.IndicesValidationExplanation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propExplanation = default; + LocalJsonValue propIndex = default; + LocalJsonValue propValid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propExplanation.TryReadProperty(ref reader, options, PropExplanation, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propValid.TryReadProperty(ref reader, options, PropValid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.IndicesValidationExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Explanation = propExplanation.Value, + Index = propIndex.Value, + Valid = propValid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.IndicesValidationExplanation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropExplanation, value.Explanation, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropValid, value.Valid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.IndicesValidationExplanationConverter))] public sealed partial class IndicesValidationExplanation { - [JsonInclude, JsonPropertyName("error")] - public string? Error { get; init; } - [JsonInclude, JsonPropertyName("explanation")] - public string? Explanation { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("valid")] - public bool Valid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesValidationExplanation(string index, bool valid) + { + Index = index; + Valid = valid; + } +#if NET7_0_OR_GREATER + public IndicesValidationExplanation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndicesValidationExplanation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesValidationExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Error { get; set; } + public string? Explanation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Valid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/InvertedIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/InvertedIndex.g.cs new file mode 100644 index 00000000000..cdbb1f97455 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/InvertedIndex.g.cs @@ -0,0 +1,185 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class InvertedIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOffsets = System.Text.Json.JsonEncodedText.Encode("offsets"); + private static readonly System.Text.Json.JsonEncodedText PropPayloads = System.Text.Json.JsonEncodedText.Encode("payloads"); + private static readonly System.Text.Json.JsonEncodedText PropPositions = System.Text.Json.JsonEncodedText.Encode("positions"); + private static readonly System.Text.Json.JsonEncodedText PropPostings = System.Text.Json.JsonEncodedText.Encode("postings"); + private static readonly System.Text.Json.JsonEncodedText PropProximity = System.Text.Json.JsonEncodedText.Encode("proximity"); + private static readonly System.Text.Json.JsonEncodedText PropTermFrequencies = System.Text.Json.JsonEncodedText.Encode("term_frequencies"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOffsets = default; + LocalJsonValue propPayloads = default; + LocalJsonValue propPositions = default; + LocalJsonValue propPostings = default; + LocalJsonValue propProximity = default; + LocalJsonValue propTermFrequencies = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOffsets.TryReadProperty(ref reader, options, PropOffsets, null)) + { + continue; + } + + if (propPayloads.TryReadProperty(ref reader, options, PropPayloads, null)) + { + continue; + } + + if (propPositions.TryReadProperty(ref reader, options, PropPositions, null)) + { + continue; + } + + if (propPostings.TryReadProperty(ref reader, options, PropPostings, null)) + { + continue; + } + + if (propProximity.TryReadProperty(ref reader, options, PropProximity, null)) + { + continue; + } + + if (propTermFrequencies.TryReadProperty(ref reader, options, PropTermFrequencies, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Offsets = propOffsets.Value, + Payloads = propPayloads.Value, + Positions = propPositions.Value, + Postings = propPostings.Value, + Proximity = propProximity.Value, + TermFrequencies = propTermFrequencies.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOffsets, value.Offsets, null, null); + writer.WriteProperty(options, PropPayloads, value.Payloads, null, null); + writer.WriteProperty(options, PropPositions, value.Positions, null, null); + writer.WriteProperty(options, PropPostings, value.Postings, null, null); + writer.WriteProperty(options, PropProximity, value.Proximity, null, null); + writer.WriteProperty(options, PropTermFrequencies, value.TermFrequencies, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.InvertedIndexConverter))] +public sealed partial class InvertedIndex +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InvertedIndex(int offsets, int payloads, int positions, int postings, int proximity, int termFrequencies, int terms) + { + Offsets = offsets; + Payloads = payloads; + Positions = positions; + Postings = postings; + Proximity = proximity; + TermFrequencies = termFrequencies; + Terms = terms; + } +#if NET7_0_OR_GREATER + public InvertedIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InvertedIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InvertedIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Offsets { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Payloads { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Positions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Postings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Proximity { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TermFrequencies { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Terms { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettings.g.cs index 98ed5d32891..9dfd94e9651 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettings.g.cs @@ -17,41 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropDepth = System.Text.Json.JsonEncodedText.Encode("depth"); + private static readonly System.Text.Json.JsonEncodedText PropDimensionFields = System.Text.Json.JsonEncodedText.Encode("dimension_fields"); + private static readonly System.Text.Json.JsonEncodedText PropFieldNameLength = System.Text.Json.JsonEncodedText.Encode("field_name_length"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropNestedFields = System.Text.Json.JsonEncodedText.Encode("nested_fields"); + private static readonly System.Text.Json.JsonEncodedText PropNestedObjects = System.Text.Json.JsonEncodedText.Encode("nested_objects"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropTotalFields = System.Text.Json.JsonEncodedText.Encode("total_fields"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCoerce = default; + LocalJsonValue propDepth = default; + LocalJsonValue propDimensionFields = default; + LocalJsonValue propFieldNameLength = default; + LocalJsonValue?> propIgnoreMalformed = default; + LocalJsonValue propNestedFields = default; + LocalJsonValue propNestedObjects = default; + LocalJsonValue propSource = default; + LocalJsonValue propTotalFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propDepth.TryReadProperty(ref reader, options, PropDepth, null)) + { + continue; + } + + if (propDimensionFields.TryReadProperty(ref reader, options, PropDimensionFields, null)) + { + continue; + } + + if (propFieldNameLength.TryReadProperty(ref reader, options, PropFieldNameLength, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propNestedFields.TryReadProperty(ref reader, options, PropNestedFields, null)) + { + continue; + } + + if (propNestedObjects.TryReadProperty(ref reader, options, PropNestedObjects, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propTotalFields.TryReadProperty(ref reader, options, PropTotalFields, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Coerce = propCoerce.Value, + Depth = propDepth.Value, + DimensionFields = propDimensionFields.Value, + FieldNameLength = propFieldNameLength.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + NestedFields = propNestedFields.Value, + NestedObjects = propNestedObjects.Value, + Source = propSource.Value, + TotalFields = propTotalFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropDepth, value.Depth, null, null); + writer.WriteProperty(options, PropDimensionFields, value.DimensionFields, null, null); + writer.WriteProperty(options, PropFieldNameLength, value.FieldNameLength, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropNestedFields, value.NestedFields, null, null); + writer.WriteProperty(options, PropNestedObjects, value.NestedObjects, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropTotalFields, value.TotalFields, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Mapping Limit Settings /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsConverter))] public sealed partial class MappingLimitSettings { - [JsonInclude, JsonPropertyName("coerce")] +#if NET7_0_OR_GREATER + public MappingLimitSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("depth")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth? Depth { get; set; } - [JsonInclude, JsonPropertyName("dimension_fields")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields? DimensionFields { get; set; } - [JsonInclude, JsonPropertyName("field_name_length")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength? FieldNameLength { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] - public object? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("nested_fields")] + public Elastic.Clients.Elasticsearch.Union? IgnoreMalformed { get; set; } public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields? NestedFields { get; set; } - [JsonInclude, JsonPropertyName("nested_objects")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects? NestedObjects { get; set; } - [JsonInclude, JsonPropertyName("source")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields? Source { get; set; } - [JsonInclude, JsonPropertyName("total_fields")] public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields? TotalFields { get; set; } } @@ -59,347 +174,169 @@ public sealed partial class MappingLimitSettings /// /// Mapping Limit Settings /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class MappingLimitSettingsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsDescriptor { - internal MappingLimitSettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings Instance { get; init; } - public MappingLimitSettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings instance) { + Instance = instance; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth? DepthValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor DepthDescriptor { get; set; } - private Action DepthDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields? DimensionFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor DimensionFieldsDescriptor { get; set; } - private Action DimensionFieldsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength? FieldNameLengthValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor FieldNameLengthDescriptor { get; set; } - private Action FieldNameLengthDescriptorAction { get; set; } - private object? IgnoreMalformedValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields? NestedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor NestedFieldsDescriptor { get; set; } - private Action NestedFieldsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects? NestedObjectsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor NestedObjectsDescriptor { get; set; } - private Action NestedObjectsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields? TotalFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor TotalFieldsDescriptor { get; set; } - private Action TotalFieldsDescriptorAction { get; set; } - - public MappingLimitSettingsDescriptor Coerce(bool? coerce = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDescriptor() { - CoerceValue = coerce; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MappingLimitSettingsDescriptor Depth(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth? depth) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Coerce(bool? value = true) { - DepthDescriptor = null; - DepthDescriptorAction = null; - DepthValue = depth; - return Self; + Instance.Coerce = value; + return this; } - public MappingLimitSettingsDescriptor Depth(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Depth(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth? value) { - DepthValue = null; - DepthDescriptorAction = null; - DepthDescriptor = descriptor; - return Self; + Instance.Depth = value; + return this; } - public MappingLimitSettingsDescriptor Depth(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Depth() { - DepthValue = null; - DepthDescriptor = null; - DepthDescriptorAction = configure; - return Self; + Instance.Depth = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor DimensionFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields? dimensionFields) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Depth(System.Action? action) { - DimensionFieldsDescriptor = null; - DimensionFieldsDescriptorAction = null; - DimensionFieldsValue = dimensionFields; - return Self; + Instance.Depth = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor DimensionFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor DimensionFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields? value) { - DimensionFieldsValue = null; - DimensionFieldsDescriptorAction = null; - DimensionFieldsDescriptor = descriptor; - return Self; + Instance.DimensionFields = value; + return this; } - public MappingLimitSettingsDescriptor DimensionFields(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor DimensionFields() { - DimensionFieldsValue = null; - DimensionFieldsDescriptor = null; - DimensionFieldsDescriptorAction = configure; - return Self; + Instance.DimensionFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor FieldNameLength(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength? fieldNameLength) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor DimensionFields(System.Action? action) { - FieldNameLengthDescriptor = null; - FieldNameLengthDescriptorAction = null; - FieldNameLengthValue = fieldNameLength; - return Self; + Instance.DimensionFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor FieldNameLength(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor FieldNameLength(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength? value) { - FieldNameLengthValue = null; - FieldNameLengthDescriptorAction = null; - FieldNameLengthDescriptor = descriptor; - return Self; + Instance.FieldNameLength = value; + return this; } - public MappingLimitSettingsDescriptor FieldNameLength(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor FieldNameLength() { - FieldNameLengthValue = null; - FieldNameLengthDescriptor = null; - FieldNameLengthDescriptorAction = configure; - return Self; + Instance.FieldNameLength = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor IgnoreMalformed(object? ignoreMalformed) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor FieldNameLength(System.Action? action) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.FieldNameLength = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor NestedFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields? nestedFields) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor IgnoreMalformed(Elastic.Clients.Elasticsearch.Union? value) { - NestedFieldsDescriptor = null; - NestedFieldsDescriptorAction = null; - NestedFieldsValue = nestedFields; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public MappingLimitSettingsDescriptor NestedFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields? value) { - NestedFieldsValue = null; - NestedFieldsDescriptorAction = null; - NestedFieldsDescriptor = descriptor; - return Self; + Instance.NestedFields = value; + return this; } - public MappingLimitSettingsDescriptor NestedFields(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedFields() { - NestedFieldsValue = null; - NestedFieldsDescriptor = null; - NestedFieldsDescriptorAction = configure; - return Self; + Instance.NestedFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor NestedObjects(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects? nestedObjects) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedFields(System.Action? action) { - NestedObjectsDescriptor = null; - NestedObjectsDescriptorAction = null; - NestedObjectsValue = nestedObjects; - return Self; + Instance.NestedFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor NestedObjects(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedObjects(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects? value) { - NestedObjectsValue = null; - NestedObjectsDescriptorAction = null; - NestedObjectsDescriptor = descriptor; - return Self; + Instance.NestedObjects = value; + return this; } - public MappingLimitSettingsDescriptor NestedObjects(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedObjects() { - NestedObjectsValue = null; - NestedObjectsDescriptor = null; - NestedObjectsDescriptorAction = configure; - return Self; + Instance.NestedObjects = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor Source(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields? source) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor NestedObjects(System.Action? action) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.NestedObjects = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor Source(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Source(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields? value) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public MappingLimitSettingsDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor.Build(action); + return this; } - public MappingLimitSettingsDescriptor TotalFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields? totalFields) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor TotalFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields? value) { - TotalFieldsDescriptor = null; - TotalFieldsDescriptorAction = null; - TotalFieldsValue = totalFields; - return Self; + Instance.TotalFields = value; + return this; } - public MappingLimitSettingsDescriptor TotalFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor TotalFields() { - TotalFieldsValue = null; - TotalFieldsDescriptorAction = null; - TotalFieldsDescriptor = descriptor; - return Self; + Instance.TotalFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor.Build(null); + return this; } - public MappingLimitSettingsDescriptor TotalFields(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor TotalFields(System.Action? action) { - TotalFieldsValue = null; - TotalFieldsDescriptor = null; - TotalFieldsDescriptorAction = configure; - return Self; + Instance.TotalFields = Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings Build(System.Action? action) { - writer.WriteStartObject(); - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (DepthDescriptor is not null) - { - writer.WritePropertyName("depth"); - JsonSerializer.Serialize(writer, DepthDescriptor, options); - } - else if (DepthDescriptorAction is not null) - { - writer.WritePropertyName("depth"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor(DepthDescriptorAction), options); - } - else if (DepthValue is not null) - { - writer.WritePropertyName("depth"); - JsonSerializer.Serialize(writer, DepthValue, options); - } - - if (DimensionFieldsDescriptor is not null) - { - writer.WritePropertyName("dimension_fields"); - JsonSerializer.Serialize(writer, DimensionFieldsDescriptor, options); - } - else if (DimensionFieldsDescriptorAction is not null) - { - writer.WritePropertyName("dimension_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor(DimensionFieldsDescriptorAction), options); - } - else if (DimensionFieldsValue is not null) + if (action is null) { - writer.WritePropertyName("dimension_fields"); - JsonSerializer.Serialize(writer, DimensionFieldsValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FieldNameLengthDescriptor is not null) - { - writer.WritePropertyName("field_name_length"); - JsonSerializer.Serialize(writer, FieldNameLengthDescriptor, options); - } - else if (FieldNameLengthDescriptorAction is not null) - { - writer.WritePropertyName("field_name_length"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor(FieldNameLengthDescriptorAction), options); - } - else if (FieldNameLengthValue is not null) - { - writer.WritePropertyName("field_name_length"); - JsonSerializer.Serialize(writer, FieldNameLengthValue, options); - } - - if (IgnoreMalformedValue is not null) - { - writer.WritePropertyName("ignore_malformed"); - JsonSerializer.Serialize(writer, IgnoreMalformedValue, options); - } - - if (NestedFieldsDescriptor is not null) - { - writer.WritePropertyName("nested_fields"); - JsonSerializer.Serialize(writer, NestedFieldsDescriptor, options); - } - else if (NestedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("nested_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor(NestedFieldsDescriptorAction), options); - } - else if (NestedFieldsValue is not null) - { - writer.WritePropertyName("nested_fields"); - JsonSerializer.Serialize(writer, NestedFieldsValue, options); - } - - if (NestedObjectsDescriptor is not null) - { - writer.WritePropertyName("nested_objects"); - JsonSerializer.Serialize(writer, NestedObjectsDescriptor, options); - } - else if (NestedObjectsDescriptorAction is not null) - { - writer.WritePropertyName("nested_objects"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor(NestedObjectsDescriptorAction), options); - } - else if (NestedObjectsValue is not null) - { - writer.WritePropertyName("nested_objects"); - JsonSerializer.Serialize(writer, NestedObjectsValue, options); - } - - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - if (TotalFieldsDescriptor is not null) - { - writer.WritePropertyName("total_fields"); - JsonSerializer.Serialize(writer, TotalFieldsDescriptor, options); - } - else if (TotalFieldsDescriptorAction is not null) - { - writer.WritePropertyName("total_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor(TotalFieldsDescriptorAction), options); - } - else if (TotalFieldsValue is not null) - { - writer.WritePropertyName("total_fields"); - JsonSerializer.Serialize(writer, TotalFieldsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDepth.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDepth.g.cs index 45d8387916c..8d6978c5e6c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDepth.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDepth.g.cs @@ -17,37 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsDepthConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthConverter))] public sealed partial class MappingLimitSettingsDepth { +#if NET7_0_OR_GREATER + public MappingLimitSettingsDepth() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsDepth() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined /// at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc. /// /// - [JsonInclude, JsonPropertyName("limit")] public long? Limit { get; set; } } -public sealed partial class MappingLimitSettingsDepthDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsDepthDescriptor { - internal MappingLimitSettingsDepthDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth Instance { get; init; } - public MappingLimitSettingsDepthDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDepthDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth instance) { + Instance = instance; } - private long? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDepthDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor descriptor) => descriptor.Instance; /// /// @@ -55,21 +115,22 @@ public MappingLimitSettingsDepthDescriptor() : base() /// at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc. /// /// - public MappingLimitSettingsDepthDescriptor Limit(long? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor Limit(long? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepthDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDepth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDimensionFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDimensionFields.g.cs index b809a923150..4deb60ece7a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDimensionFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsDimensionFields.g.cs @@ -17,37 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsDimensionFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsConverter))] public sealed partial class MappingLimitSettingsDimensionFields { +#if NET7_0_OR_GREATER + public MappingLimitSettingsDimensionFields() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsDimensionFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// [preview] This functionality is in technical preview and may be changed or removed in a future release. /// Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. /// /// - [JsonInclude, JsonPropertyName("limit")] public long? Limit { get; set; } } -public sealed partial class MappingLimitSettingsDimensionFieldsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsDimensionFieldsDescriptor { - internal MappingLimitSettingsDimensionFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields Instance { get; init; } - public MappingLimitSettingsDimensionFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDimensionFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields instance) { + Instance = instance; } - private long? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsDimensionFieldsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor descriptor) => descriptor.Instance; /// /// @@ -55,21 +115,22 @@ public MappingLimitSettingsDimensionFieldsDescriptor() : base() /// Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. /// /// - public MappingLimitSettingsDimensionFieldsDescriptor Limit(long? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor Limit(long? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFieldsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsDimensionFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsFieldNameLength.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsFieldNameLength.g.cs index c4e64623d03..8935f6b0361 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsFieldNameLength.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsFieldNameLength.g.cs @@ -17,18 +17,70 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsFieldNameLengthConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthConverter))] public sealed partial class MappingLimitSettingsFieldNameLength { +#if NET7_0_OR_GREATER + public MappingLimitSettingsFieldNameLength() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsFieldNameLength() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Setting for the maximum length of a field name. This setting isn’t really something that addresses mappings explosion but @@ -36,19 +88,27 @@ public sealed partial class MappingLimitSettingsFieldNameLength /// default is okay unless a user starts to add a huge number of fields with really long names. Default is Long.MAX_VALUE (no limit). /// /// - [JsonInclude, JsonPropertyName("limit")] public long? Limit { get; set; } } -public sealed partial class MappingLimitSettingsFieldNameLengthDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsFieldNameLengthDescriptor { - internal MappingLimitSettingsFieldNameLengthDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength Instance { get; init; } - public MappingLimitSettingsFieldNameLengthDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsFieldNameLengthDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength instance) { + Instance = instance; } - private long? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsFieldNameLengthDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor descriptor) => descriptor.Instance; /// /// @@ -57,21 +117,22 @@ public MappingLimitSettingsFieldNameLengthDescriptor() : base() /// default is okay unless a user starts to add a huge number of fields with really long names. Default is Long.MAX_VALUE (no limit). /// /// - public MappingLimitSettingsFieldNameLengthDescriptor Limit(long? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor Limit(long? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLengthDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsFieldNameLength(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedFields.g.cs index c6331ffc1e2..5a06121b00b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedFields.g.cs @@ -17,18 +17,70 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsNestedFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsConverter))] public sealed partial class MappingLimitSettingsNestedFields { +#if NET7_0_OR_GREATER + public MappingLimitSettingsNestedFields() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsNestedFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when @@ -36,19 +88,27 @@ public sealed partial class MappingLimitSettingsNestedFields /// setting limits the number of unique nested types per index. /// /// - [JsonInclude, JsonPropertyName("limit")] public long? Limit { get; set; } } -public sealed partial class MappingLimitSettingsNestedFieldsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsNestedFieldsDescriptor { - internal MappingLimitSettingsNestedFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields Instance { get; init; } - public MappingLimitSettingsNestedFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsNestedFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields instance) { + Instance = instance; } - private long? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsNestedFieldsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor descriptor) => descriptor.Instance; /// /// @@ -57,21 +117,22 @@ public MappingLimitSettingsNestedFieldsDescriptor() : base() /// setting limits the number of unique nested types per index. /// /// - public MappingLimitSettingsNestedFieldsDescriptor Limit(long? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor Limit(long? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFieldsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedObjects.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedObjects.g.cs index 9da47c0321f..399355c753d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedObjects.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsNestedObjects.g.cs @@ -17,37 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsNestedObjectsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsConverter))] public sealed partial class MappingLimitSettingsNestedObjects { +#if NET7_0_OR_GREATER + public MappingLimitSettingsNestedObjects() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsNestedObjects() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps /// to prevent out of memory errors when a document contains too many nested objects. /// /// - [JsonInclude, JsonPropertyName("limit")] public long? Limit { get; set; } } -public sealed partial class MappingLimitSettingsNestedObjectsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsNestedObjectsDescriptor { - internal MappingLimitSettingsNestedObjectsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects Instance { get; init; } - public MappingLimitSettingsNestedObjectsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsNestedObjectsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects instance) { + Instance = instance; } - private long? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsNestedObjectsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor descriptor) => descriptor.Instance; /// /// @@ -55,21 +115,22 @@ public MappingLimitSettingsNestedObjectsDescriptor() : base() /// to prevent out of memory errors when a document contains too many nested objects. /// /// - public MappingLimitSettingsNestedObjectsDescriptor Limit(long? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor Limit(long? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects Build(System.Action? action) { - writer.WriteStartObject(); - if (LimitValue.HasValue) + if (action is null) { - writer.WritePropertyName("limit"); - writer.WriteNumberValue(LimitValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjectsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsNestedObjects(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsSourceFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsSourceFields.g.cs index cd91e0cc57e..88ad0962222 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsSourceFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsSourceFields.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsSourceFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsConverter))] public sealed partial class MappingLimitSettingsSourceFields { - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.IndexManagement.SourceMode Mode { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.IndexManagement.SourceMode mode) + { + Mode = mode; + } +#if NET7_0_OR_GREATER + public MappingLimitSettingsSourceFields() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MappingLimitSettingsSourceFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.SourceMode Mode { get; set; } } -public sealed partial class MappingLimitSettingsSourceFieldsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsSourceFieldsDescriptor { - internal MappingLimitSettingsSourceFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields Instance { get; init; } - public MappingLimitSettingsSourceFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsSourceFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.SourceMode ModeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsSourceFieldsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public MappingLimitSettingsSourceFieldsDescriptor Mode(Elastic.Clients.Elasticsearch.IndexManagement.SourceMode mode) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor Mode(Elastic.Clients.Elasticsearch.IndexManagement.SourceMode value) { - ModeValue = mode; - return Self; + Instance.Mode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFieldsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsSourceFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsTotalFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsTotalFields.g.cs index 40b883ca2cb..4fd082c2c68 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsTotalFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingLimitSettingsTotalFields.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingLimitSettingsTotalFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreDynamicBeyondLimit = System.Text.Json.JsonEncodedText.Encode("ignore_dynamic_beyond_limit"); + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propIgnoreDynamicBeyondLimit = default; + LocalJsonValue?> propLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreDynamicBeyondLimit.TryReadProperty(ref reader, options, PropIgnoreDynamicBeyondLimit, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propLimit.TryReadProperty(ref reader, options, PropLimit, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreDynamicBeyondLimit = propIgnoreDynamicBeyondLimit.Value, + Limit = propLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreDynamicBeyondLimit, value.IgnoreDynamicBeyondLimit, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropLimit, value.Limit, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsConverter))] public sealed partial class MappingLimitSettingsTotalFields { +#if NET7_0_OR_GREATER + public MappingLimitSettingsTotalFields() + { + } +#endif +#if !NET7_0_OR_GREATER + public MappingLimitSettingsTotalFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// This setting determines what happens when a dynamically mapped field would exceed the total fields limit. When set @@ -38,8 +99,7 @@ public sealed partial class MappingLimitSettingsTotalFields /// The fields that were not added to the mapping will be added to the _ignored field. /// /// - [JsonInclude, JsonPropertyName("ignore_dynamic_beyond_limit")] - public object? IgnoreDynamicBeyondLimit { get; set; } + public Elastic.Clients.Elasticsearch.Union? IgnoreDynamicBeyondLimit { get; set; } /// /// @@ -48,20 +108,27 @@ public sealed partial class MappingLimitSettingsTotalFields /// degradations and memory issues, especially in clusters with a high load or few resources. /// /// - [JsonInclude, JsonPropertyName("limit")] - public object? Limit { get; set; } + public Elastic.Clients.Elasticsearch.Union? Limit { get; set; } } -public sealed partial class MappingLimitSettingsTotalFieldsDescriptor : SerializableDescriptor +public readonly partial struct MappingLimitSettingsTotalFieldsDescriptor { - internal MappingLimitSettingsTotalFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields Instance { get; init; } - public MappingLimitSettingsTotalFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsTotalFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields instance) { + Instance = instance; } - private object? IgnoreDynamicBeyondLimitValue { get; set; } - private object? LimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingLimitSettingsTotalFieldsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor descriptor) => descriptor.Instance; /// /// @@ -72,10 +139,10 @@ public MappingLimitSettingsTotalFieldsDescriptor() : base() /// The fields that were not added to the mapping will be added to the _ignored field. /// /// - public MappingLimitSettingsTotalFieldsDescriptor IgnoreDynamicBeyondLimit(object? ignoreDynamicBeyondLimit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor IgnoreDynamicBeyondLimit(Elastic.Clients.Elasticsearch.Union? value) { - IgnoreDynamicBeyondLimitValue = ignoreDynamicBeyondLimit; - return Self; + Instance.IgnoreDynamicBeyondLimit = value; + return this; } /// @@ -85,27 +152,22 @@ public MappingLimitSettingsTotalFieldsDescriptor IgnoreDynamicBeyondLimit(object /// degradations and memory issues, especially in clusters with a high load or few resources. /// /// - public MappingLimitSettingsTotalFieldsDescriptor Limit(object? limit) + public Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor Limit(Elastic.Clients.Elasticsearch.Union? value) { - LimitValue = limit; - return Self; + Instance.Limit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields Build(System.Action? action) { - writer.WriteStartObject(); - if (IgnoreDynamicBeyondLimitValue is not null) + if (action is null) { - writer.WritePropertyName("ignore_dynamic_beyond_limit"); - JsonSerializer.Serialize(writer, IgnoreDynamicBeyondLimitValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (LimitValue is not null) - { - writer.WritePropertyName("limit"); - JsonSerializer.Serialize(writer, LimitValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFieldsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MappingLimitSettingsTotalFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingStats.g.cs index 62b8fdb09c2..2a3ddaa9c82 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MappingStats.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MappingStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTotalCount = System.Text.Json.JsonEncodedText.Encode("total_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalEstimatedOverhead = System.Text.Json.JsonEncodedText.Encode("total_estimated_overhead"); + private static readonly System.Text.Json.JsonEncodedText PropTotalEstimatedOverheadInBytes = System.Text.Json.JsonEncodedText.Encode("total_estimated_overhead_in_bytes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MappingStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTotalCount = default; + LocalJsonValue propTotalEstimatedOverhead = default; + LocalJsonValue propTotalEstimatedOverheadInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTotalCount.TryReadProperty(ref reader, options, PropTotalCount, null)) + { + continue; + } + + if (propTotalEstimatedOverhead.TryReadProperty(ref reader, options, PropTotalEstimatedOverhead, null)) + { + continue; + } + + if (propTotalEstimatedOverheadInBytes.TryReadProperty(ref reader, options, PropTotalEstimatedOverheadInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MappingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + TotalCount = propTotalCount.Value, + TotalEstimatedOverhead = propTotalEstimatedOverhead.Value, + TotalEstimatedOverheadInBytes = propTotalEstimatedOverheadInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MappingStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTotalCount, value.TotalCount, null, null); + writer.WriteProperty(options, PropTotalEstimatedOverhead, value.TotalEstimatedOverhead, null, null); + writer.WriteProperty(options, PropTotalEstimatedOverheadInBytes, value.TotalEstimatedOverheadInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MappingStatsConverter))] public sealed partial class MappingStats { - [JsonInclude, JsonPropertyName("total_count")] - public long TotalCount { get; init; } - [JsonInclude, JsonPropertyName("total_estimated_overhead")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalEstimatedOverhead { get; init; } - [JsonInclude, JsonPropertyName("total_estimated_overhead_in_bytes")] - public long TotalEstimatedOverheadInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MappingStats(long totalCount, long totalEstimatedOverheadInBytes) + { + TotalCount = totalCount; + TotalEstimatedOverheadInBytes = totalEstimatedOverheadInBytes; + } +#if NET7_0_OR_GREATER + public MappingStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MappingStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MappingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long TotalCount { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalEstimatedOverhead { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalEstimatedOverheadInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Merge.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Merge.g.cs index 77498dbc373..ce0018e04dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Merge.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Merge.g.cs @@ -17,77 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MergeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScheduler = System.Text.Json.JsonEncodedText.Encode("scheduler"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Merge Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScheduler = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScheduler.TryReadProperty(ref reader, options, PropScheduler, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Merge(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Scheduler = propScheduler.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Merge value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScheduler, value.Scheduler, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MergeConverter))] public sealed partial class Merge { - [JsonInclude, JsonPropertyName("scheduler")] +#if NET7_0_OR_GREATER + public Merge() + { + } +#endif +#if !NET7_0_OR_GREATER + public Merge() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Merge(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler? Scheduler { get; set; } } -public sealed partial class MergeDescriptor : SerializableDescriptor +public readonly partial struct MergeDescriptor { - internal MergeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Merge Instance { get; init; } - public MergeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MergeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Merge instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler? SchedulerValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor SchedulerDescriptor { get; set; } - private Action SchedulerDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MergeDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Merge(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Merge instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Merge(Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor descriptor) => descriptor.Instance; - public MergeDescriptor Scheduler(Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler? scheduler) + public Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor Scheduler(Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler? value) { - SchedulerDescriptor = null; - SchedulerDescriptorAction = null; - SchedulerValue = scheduler; - return Self; + Instance.Scheduler = value; + return this; } - public MergeDescriptor Scheduler(Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor Scheduler() { - SchedulerValue = null; - SchedulerDescriptorAction = null; - SchedulerDescriptor = descriptor; - return Self; + Instance.Scheduler = Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor.Build(null); + return this; } - public MergeDescriptor Scheduler(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor Scheduler(System.Action? action) { - SchedulerValue = null; - SchedulerDescriptor = null; - SchedulerDescriptorAction = configure; - return Self; + Instance.Scheduler = Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Merge Build(System.Action? action) { - writer.WriteStartObject(); - if (SchedulerDescriptor is not null) - { - writer.WritePropertyName("scheduler"); - JsonSerializer.Serialize(writer, SchedulerDescriptor, options); - } - else if (SchedulerDescriptorAction is not null) - { - writer.WritePropertyName("scheduler"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor(SchedulerDescriptorAction), options); - } - else if (SchedulerValue is not null) + if (action is null) { - writer.WritePropertyName("scheduler"); - JsonSerializer.Serialize(writer, SchedulerValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.Merge(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MergeDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Merge(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MergeScheduler.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MergeScheduler.g.cs index e933ab90b77..c5f9c91cda1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MergeScheduler.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MergeScheduler.g.cs @@ -17,62 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class MergeSchedulerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxMergeCount = System.Text.Json.JsonEncodedText.Encode("max_merge_count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxThreadCount = System.Text.Json.JsonEncodedText.Encode("max_thread_count"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxMergeCount = default; + LocalJsonValue propMaxThreadCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxMergeCount.TryReadProperty(ref reader, options, PropMaxMergeCount, null)) + { + continue; + } + + if (propMaxThreadCount.TryReadProperty(ref reader, options, PropMaxThreadCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxMergeCount = propMaxMergeCount.Value, + MaxThreadCount = propMaxThreadCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxMergeCount, value.MaxMergeCount, null, null); + writer.WriteProperty(options, PropMaxThreadCount, value.MaxThreadCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerConverter))] public sealed partial class MergeScheduler { - [JsonInclude, JsonPropertyName("max_merge_count")] +#if NET7_0_OR_GREATER + public MergeScheduler() + { + } +#endif +#if !NET7_0_OR_GREATER + public MergeScheduler() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MergeScheduler(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxMergeCount { get; set; } - [JsonInclude, JsonPropertyName("max_thread_count")] public int? MaxThreadCount { get; set; } } -public sealed partial class MergeSchedulerDescriptor : SerializableDescriptor +public readonly partial struct MergeSchedulerDescriptor { - internal MergeSchedulerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler Instance { get; init; } - public MergeSchedulerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MergeSchedulerDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler instance) { + Instance = instance; } - private int? MaxMergeCountValue { get; set; } - private int? MaxThreadCountValue { get; set; } - - public MergeSchedulerDescriptor MaxMergeCount(int? maxMergeCount) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MergeSchedulerDescriptor() { - MaxMergeCountValue = maxMergeCount; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public MergeSchedulerDescriptor MaxThreadCount(int? maxThreadCount) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler(Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor MaxMergeCount(int? value) { - MaxThreadCountValue = maxThreadCount; - return Self; + Instance.MaxMergeCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor MaxThreadCount(int? value) { - writer.WriteStartObject(); - if (MaxMergeCountValue.HasValue) - { - writer.WritePropertyName("max_merge_count"); - writer.WriteNumberValue(MaxMergeCountValue.Value); - } + Instance.MaxThreadCount = value; + return this; + } - if (MaxThreadCountValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("max_thread_count"); - writer.WriteNumberValue(MaxThreadCountValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MergeSchedulerDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MergeScheduler(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MigrateReindex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MigrateReindex.g.cs new file mode 100644 index 00000000000..1297dd1e43a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/MigrateReindex.g.cs @@ -0,0 +1,182 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class MigrateReindexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexConverter))] +public sealed partial class MigrateReindex +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindex(Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum mode, Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex source) + { + Mode = mode; + Source = source; + } +#if NET7_0_OR_GREATER + public MigrateReindex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MigrateReindex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MigrateReindex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Reindex mode. Currently only 'upgrade' is supported. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum Mode { get; set; } + + /// + /// + /// The source index or data stream (only data streams are currently supported). + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex Source { get; set; } +} + +public readonly partial struct MigrateReindexDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindexDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MigrateReindexDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex instance) => new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex(Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Reindex mode. Currently only 'upgrade' is supported. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor Mode(Elastic.Clients.Elasticsearch.IndexManagement.ModeEnum value) + { + Instance.Mode = value; + return this; + } + + /// + /// + /// The source index or data stream (only data streams are currently supported). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor Source(Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// The source index or data stream (only data streams are currently supported). + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor Source(System.Action action) + { + Instance.Source = Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindexDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.MigrateReindex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/NumericFielddata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/NumericFielddata.g.cs index 27c17aa6dba..b5ffa3cb116 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/NumericFielddata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/NumericFielddata.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class NumericFielddataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFormat = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Format = propFormat.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataConverter))] public sealed partial class NumericFielddata { - [JsonInclude, JsonPropertyName("format")] - public Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat Format { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericFielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat format) + { + Format = format; + } +#if NET7_0_OR_GREATER + public NumericFielddata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NumericFielddata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NumericFielddata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat Format { get; set; } } -public sealed partial class NumericFielddataDescriptor : SerializableDescriptor +public readonly partial struct NumericFielddataDescriptor { - internal NumericFielddataDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata Instance { get; init; } - public NumericFielddataDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericFielddataDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat FormatValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericFielddataDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public NumericFielddataDescriptor Format(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat format) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata instance) => new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor Format(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataFormat value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Overlapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Overlapping.g.cs index d61e05dabff..5e59fb0889d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Overlapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Overlapping.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class OverlappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Overlapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndexPatterns = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Overlapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexPatterns = propIndexPatterns.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Overlapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.OverlappingConverter))] public sealed partial class Overlapping { - [JsonInclude, JsonPropertyName("index_patterns")] - public IReadOnlyCollection IndexPatterns { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Overlapping(System.Collections.Generic.IReadOnlyCollection indexPatterns, string name) + { + IndexPatterns = indexPatterns; + Name = name; + } +#if NET7_0_OR_GREATER + public Overlapping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Overlapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Overlapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection IndexPatterns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Queries.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Queries.g.cs index 79df47144aa..696ae5875b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Queries.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Queries.g.cs @@ -17,77 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class QueriesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCache = System.Text.Json.JsonEncodedText.Encode("cache"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Queries Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCache = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCache.TryReadProperty(ref reader, options, PropCache, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cache = propCache.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Queries value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCache, value.Cache, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.QueriesConverter))] public sealed partial class Queries { - [JsonInclude, JsonPropertyName("cache")] +#if NET7_0_OR_GREATER + public Queries() + { + } +#endif +#if !NET7_0_OR_GREATER + public Queries() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? Cache { get; set; } } -public sealed partial class QueriesDescriptor : SerializableDescriptor +public readonly partial struct QueriesDescriptor { - internal QueriesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Queries Instance { get; init; } - public QueriesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Queries instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? CacheValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor CacheDescriptor { get; set; } - private Action CacheDescriptorAction { get; set; } - - public QueriesDescriptor Cache(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? cache) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueriesDescriptor() { - CacheDescriptor = null; - CacheDescriptorAction = null; - CacheValue = cache; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public QueriesDescriptor Cache(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Queries instance) => new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor Cache(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? value) { - CacheValue = null; - CacheDescriptorAction = null; - CacheDescriptor = descriptor; - return Self; + Instance.Cache = value; + return this; } - public QueriesDescriptor Cache(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor Cache(System.Action action) { - CacheValue = null; - CacheDescriptor = null; - CacheDescriptorAction = configure; - return Self; + Instance.Cache = Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Queries Build(System.Action? action) { - writer.WriteStartObject(); - if (CacheDescriptor is not null) - { - writer.WritePropertyName("cache"); - JsonSerializer.Serialize(writer, CacheDescriptor, options); - } - else if (CacheDescriptorAction is not null) - { - writer.WritePropertyName("cache"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor(CacheDescriptorAction), options); - } - else if (CacheValue is not null) + if (action is null) { - writer.WritePropertyName("cache"); - JsonSerializer.Serialize(writer, CacheValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryBytes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryBytes.g.cs index d619ee02ddd..e5eec34b9f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryBytes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryBytes.g.cs @@ -17,34 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryBytesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPercent = System.Text.Json.JsonEncodedText.Encode("percent"); + private static readonly System.Text.Json.JsonEncodedText PropRecovered = System.Text.Json.JsonEncodedText.Encode("recovered"); + private static readonly System.Text.Json.JsonEncodedText PropRecoveredFromSnapshot = System.Text.Json.JsonEncodedText.Encode("recovered_from_snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropRecoveredFromSnapshotInBytes = System.Text.Json.JsonEncodedText.Encode("recovered_from_snapshot_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropRecoveredInBytes = System.Text.Json.JsonEncodedText.Encode("recovered_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropReused = System.Text.Json.JsonEncodedText.Encode("reused"); + private static readonly System.Text.Json.JsonEncodedText PropReusedInBytes = System.Text.Json.JsonEncodedText.Encode("reused_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPercent = default; + LocalJsonValue propRecovered = default; + LocalJsonValue propRecoveredFromSnapshot = default; + LocalJsonValue propRecoveredFromSnapshotInBytes = default; + LocalJsonValue propRecoveredInBytes = default; + LocalJsonValue propReused = default; + LocalJsonValue propReusedInBytes = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPercent.TryReadProperty(ref reader, options, PropPercent, null)) + { + continue; + } + + if (propRecovered.TryReadProperty(ref reader, options, PropRecovered, null)) + { + continue; + } + + if (propRecoveredFromSnapshot.TryReadProperty(ref reader, options, PropRecoveredFromSnapshot, null)) + { + continue; + } + + if (propRecoveredFromSnapshotInBytes.TryReadProperty(ref reader, options, PropRecoveredFromSnapshotInBytes, null)) + { + continue; + } + + if (propRecoveredInBytes.TryReadProperty(ref reader, options, PropRecoveredInBytes, null)) + { + continue; + } + + if (propReused.TryReadProperty(ref reader, options, PropReused, null)) + { + continue; + } + + if (propReusedInBytes.TryReadProperty(ref reader, options, PropReusedInBytes, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Percent = propPercent.Value, + Recovered = propRecovered.Value, + RecoveredFromSnapshot = propRecoveredFromSnapshot.Value, + RecoveredFromSnapshotInBytes = propRecoveredFromSnapshotInBytes.Value, + RecoveredInBytes = propRecoveredInBytes.Value, + Reused = propReused.Value, + ReusedInBytes = propReusedInBytes.Value, + Total = propTotal.Value, + TotalInBytes = propTotalInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPercent, value.Percent, null, null); + writer.WriteProperty(options, PropRecovered, value.Recovered, null, null); + writer.WriteProperty(options, PropRecoveredFromSnapshot, value.RecoveredFromSnapshot, null, null); + writer.WriteProperty(options, PropRecoveredFromSnapshotInBytes, value.RecoveredFromSnapshotInBytes, null, null); + writer.WriteProperty(options, PropRecoveredInBytes, value.RecoveredInBytes, null, null); + writer.WriteProperty(options, PropReused, value.Reused, null, null); + writer.WriteProperty(options, PropReusedInBytes, value.ReusedInBytes, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytesConverter))] public sealed partial class RecoveryBytes { - [JsonInclude, JsonPropertyName("percent")] - public double Percent { get; init; } - [JsonInclude, JsonPropertyName("recovered")] - public Elastic.Clients.Elasticsearch.ByteSize? Recovered { get; init; } - [JsonInclude, JsonPropertyName("recovered_from_snapshot")] - public Elastic.Clients.Elasticsearch.ByteSize? RecoveredFromSnapshot { get; init; } - [JsonInclude, JsonPropertyName("recovered_from_snapshot_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? RecoveredFromSnapshotInBytes { get; init; } - [JsonInclude, JsonPropertyName("recovered_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize RecoveredInBytes { get; init; } - [JsonInclude, JsonPropertyName("reused")] - public Elastic.Clients.Elasticsearch.ByteSize? Reused { get; init; } - [JsonInclude, JsonPropertyName("reused_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize ReusedInBytes { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.ByteSize? Total { get; init; } - [JsonInclude, JsonPropertyName("total_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize TotalInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryBytes(Elastic.Clients.Elasticsearch.Percentage percent, Elastic.Clients.Elasticsearch.ByteSize recoveredInBytes, Elastic.Clients.Elasticsearch.ByteSize reusedInBytes, Elastic.Clients.Elasticsearch.ByteSize totalInBytes) + { + Percent = percent; + RecoveredInBytes = recoveredInBytes; + ReusedInBytes = reusedInBytes; + TotalInBytes = totalInBytes; + } +#if NET7_0_OR_GREATER + public RecoveryBytes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryBytes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryBytes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Percentage Percent { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Recovered { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? RecoveredFromSnapshot { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? RecoveredFromSnapshotInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize RecoveredInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Reused { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize ReusedInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Total { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize TotalInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryFiles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryFiles.g.cs index a899e6a73ea..e7f8727e06a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryFiles.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryFiles.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryFilesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropPercent = System.Text.Json.JsonEncodedText.Encode("percent"); + private static readonly System.Text.Json.JsonEncodedText PropRecovered = System.Text.Json.JsonEncodedText.Encode("recovered"); + private static readonly System.Text.Json.JsonEncodedText PropReused = System.Text.Json.JsonEncodedText.Encode("reused"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDetails = default; + LocalJsonValue propPercent = default; + LocalJsonValue propRecovered = default; + LocalJsonValue propReused = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPercent.TryReadProperty(ref reader, options, PropPercent, null)) + { + continue; + } + + if (propRecovered.TryReadProperty(ref reader, options, PropRecovered, null)) + { + continue; + } + + if (propReused.TryReadProperty(ref reader, options, PropReused, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Details = propDetails.Value, + Percent = propPercent.Value, + Recovered = propRecovered.Value, + Reused = propReused.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPercent, value.Percent, null, null); + writer.WriteProperty(options, PropRecovered, value.Recovered, null, null); + writer.WriteProperty(options, PropReused, value.Reused, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFilesConverter))] public sealed partial class RecoveryFiles { - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyCollection? Details { get; init; } - [JsonInclude, JsonPropertyName("percent")] - public double Percent { get; init; } - [JsonInclude, JsonPropertyName("recovered")] - public long Recovered { get; init; } - [JsonInclude, JsonPropertyName("reused")] - public long Reused { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryFiles(Elastic.Clients.Elasticsearch.Percentage percent, long recovered, long reused, long total) + { + Percent = percent; + Recovered = recovered; + Reused = reused; + Total = total; + } +#if NET7_0_OR_GREATER + public RecoveryFiles() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryFiles() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryFiles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Details { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Percentage Percent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Recovered { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Reused { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryIndexStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryIndexStatus.g.cs index 54ebae2c15f..d370d9d29cf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryIndexStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryIndexStatus.g.cs @@ -17,34 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryIndexStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBytes = System.Text.Json.JsonEncodedText.Encode("bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFiles = System.Text.Json.JsonEncodedText.Encode("files"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSourceThrottleTime = System.Text.Json.JsonEncodedText.Encode("source_throttle_time"); + private static readonly System.Text.Json.JsonEncodedText PropSourceThrottleTimeInMillis = System.Text.Json.JsonEncodedText.Encode("source_throttle_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTargetThrottleTime = System.Text.Json.JsonEncodedText.Encode("target_throttle_time"); + private static readonly System.Text.Json.JsonEncodedText PropTargetThrottleTimeInMillis = System.Text.Json.JsonEncodedText.Encode("target_throttle_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBytes = default; + LocalJsonValue propFiles = default; + LocalJsonValue propSize = default; + LocalJsonValue propSourceThrottleTime = default; + LocalJsonValue propSourceThrottleTimeInMillis = default; + LocalJsonValue propTargetThrottleTime = default; + LocalJsonValue propTargetThrottleTimeInMillis = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBytes.TryReadProperty(ref reader, options, PropBytes, null)) + { + continue; + } + + if (propFiles.TryReadProperty(ref reader, options, PropFiles, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSourceThrottleTime.TryReadProperty(ref reader, options, PropSourceThrottleTime, null)) + { + continue; + } + + if (propSourceThrottleTimeInMillis.TryReadProperty(ref reader, options, PropSourceThrottleTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTargetThrottleTime.TryReadProperty(ref reader, options, PropTargetThrottleTime, null)) + { + continue; + } + + if (propTargetThrottleTimeInMillis.TryReadProperty(ref reader, options, PropTargetThrottleTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bytes = propBytes.Value, + Files = propFiles.Value, + Size = propSize.Value, + SourceThrottleTime = propSourceThrottleTime.Value, + SourceThrottleTimeInMillis = propSourceThrottleTimeInMillis.Value, + TargetThrottleTime = propTargetThrottleTime.Value, + TargetThrottleTimeInMillis = propTargetThrottleTimeInMillis.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBytes, value.Bytes, null, null); + writer.WriteProperty(options, PropFiles, value.Files, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSourceThrottleTime, value.SourceThrottleTime, null, null); + writer.WriteProperty(options, PropSourceThrottleTimeInMillis, value.SourceThrottleTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTargetThrottleTime, value.TargetThrottleTime, null, null); + writer.WriteProperty(options, PropTargetThrottleTimeInMillis, value.TargetThrottleTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatusConverter))] public sealed partial class RecoveryIndexStatus { - [JsonInclude, JsonPropertyName("bytes")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes? Bytes { get; init; } - [JsonInclude, JsonPropertyName("files")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles Files { get; init; } - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes Size { get; init; } - [JsonInclude, JsonPropertyName("source_throttle_time")] - public Elastic.Clients.Elasticsearch.Duration? SourceThrottleTime { get; init; } - [JsonInclude, JsonPropertyName("source_throttle_time_in_millis")] - public long SourceThrottleTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("target_throttle_time")] - public Elastic.Clients.Elasticsearch.Duration? TargetThrottleTime { get; init; } - [JsonInclude, JsonPropertyName("target_throttle_time_in_millis")] - public long TargetThrottleTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryIndexStatus(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles files, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes size, System.TimeSpan sourceThrottleTimeInMillis, System.TimeSpan targetThrottleTimeInMillis, System.TimeSpan totalTimeInMillis) + { + Files = files; + Size = size; + SourceThrottleTimeInMillis = sourceThrottleTimeInMillis; + TargetThrottleTimeInMillis = targetThrottleTimeInMillis; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public RecoveryIndexStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryIndexStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryIndexStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes? Bytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.RecoveryFiles Files { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.RecoveryBytes Size { get; set; } + public Elastic.Clients.Elasticsearch.Duration? SourceThrottleTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan SourceThrottleTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TargetThrottleTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TargetThrottleTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryOrigin.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryOrigin.g.cs index c654c84889d..c648611b3e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryOrigin.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryOrigin.g.cs @@ -17,40 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryOriginConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBootstrapNewHistoryUuid = System.Text.Json.JsonEncodedText.Encode("bootstrap_new_history_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropHostname = System.Text.Json.JsonEncodedText.Encode("hostname"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropRestoreUuid = System.Text.Json.JsonEncodedText.Encode("restoreUUID"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBootstrapNewHistoryUuid = default; + LocalJsonValue propHost = default; + LocalJsonValue propHostname = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIp = default; + LocalJsonValue propName = default; + LocalJsonValue propRepository = default; + LocalJsonValue propRestoreUuid = default; + LocalJsonValue propSnapshot = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBootstrapNewHistoryUuid.TryReadProperty(ref reader, options, PropBootstrapNewHistoryUuid, null)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propHostname.TryReadProperty(ref reader, options, PropHostname, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propRestoreUuid.TryReadProperty(ref reader, options, PropRestoreUuid, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BootstrapNewHistoryUuid = propBootstrapNewHistoryUuid.Value, + Host = propHost.Value, + Hostname = propHostname.Value, + Id = propId.Value, + Index = propIndex.Value, + Ip = propIp.Value, + Name = propName.Value, + Repository = propRepository.Value, + RestoreUuid = propRestoreUuid.Value, + Snapshot = propSnapshot.Value, + TransportAddress = propTransportAddress.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBootstrapNewHistoryUuid, value.BootstrapNewHistoryUuid, null, null); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropHostname, value.Hostname, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropRestoreUuid, value.RestoreUuid, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOriginConverter))] public sealed partial class RecoveryOrigin { - [JsonInclude, JsonPropertyName("bootstrap_new_history_uuid")] - public bool? BootstrapNewHistoryUuid { get; init; } - [JsonInclude, JsonPropertyName("host")] - public string? Host { get; init; } - [JsonInclude, JsonPropertyName("hostname")] - public string? Hostname { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string? Index { get; init; } - [JsonInclude, JsonPropertyName("ip")] - public string? Ip { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } - [JsonInclude, JsonPropertyName("repository")] - public string? Repository { get; init; } - [JsonInclude, JsonPropertyName("restoreUUID")] - public string? Restoreuuid { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public string? Snapshot { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string? TransportAddress { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } +#if NET7_0_OR_GREATER + public RecoveryOrigin() + { + } +#endif +#if !NET7_0_OR_GREATER + public RecoveryOrigin() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryOrigin(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? BootstrapNewHistoryUuid { get; set; } + public string? Host { get; set; } + public string? Hostname { get; set; } + public string? Id { get; set; } + public string? Index { get; set; } + public string? Ip { get; set; } + public string? Name { get; set; } + public string? Repository { get; set; } + public string? RestoreUuid { get; set; } + public string? Snapshot { get; set; } + public string? TransportAddress { get; set; } + public string? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStartStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStartStatus.g.cs index a4d034dbb0e..0bbb8c2aa69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStartStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStartStatus.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryStartStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCheckIndexTime = System.Text.Json.JsonEncodedText.Encode("check_index_time"); + private static readonly System.Text.Json.JsonEncodedText PropCheckIndexTimeInMillis = System.Text.Json.JsonEncodedText.Encode("check_index_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCheckIndexTime = default; + LocalJsonValue propCheckIndexTimeInMillis = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCheckIndexTime.TryReadProperty(ref reader, options, PropCheckIndexTime, null)) + { + continue; + } + + if (propCheckIndexTimeInMillis.TryReadProperty(ref reader, options, PropCheckIndexTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CheckIndexTime = propCheckIndexTime.Value, + CheckIndexTimeInMillis = propCheckIndexTimeInMillis.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCheckIndexTime, value.CheckIndexTime, null, null); + writer.WriteProperty(options, PropCheckIndexTimeInMillis, value.CheckIndexTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatusConverter))] public sealed partial class RecoveryStartStatus { - [JsonInclude, JsonPropertyName("check_index_time")] - public Elastic.Clients.Elasticsearch.Duration? CheckIndexTime { get; init; } - [JsonInclude, JsonPropertyName("check_index_time_in_millis")] - public long CheckIndexTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryStartStatus(System.TimeSpan checkIndexTimeInMillis, System.TimeSpan totalTimeInMillis) + { + CheckIndexTimeInMillis = checkIndexTimeInMillis; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public RecoveryStartStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryStartStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryStartStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Duration? CheckIndexTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan CheckIndexTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStatus.g.cs index c4796ec355d..fdf1fe9938b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RecoveryStatus.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RecoveryStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStatusConverter))] public sealed partial class RecoveryStatus { - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyCollection Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryStatus(System.Collections.Generic.IReadOnlyCollection shards) + { + Shards = shards; + } +#if NET7_0_OR_GREATER + public RecoveryStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadDetails.g.cs index e0e09696cee..b74e42b468f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadDetails.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ReloadDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropReloadedAnalyzers = System.Text.Json.JsonEncodedText.Encode("reloaded_analyzers"); + private static readonly System.Text.Json.JsonEncodedText PropReloadedNodeIds = System.Text.Json.JsonEncodedText.Encode("reloaded_node_ids"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ReloadDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue> propReloadedAnalyzers = default; + LocalJsonValue> propReloadedNodeIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propReloadedAnalyzers.TryReadProperty(ref reader, options, PropReloadedAnalyzers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propReloadedNodeIds.TryReadProperty(ref reader, options, PropReloadedNodeIds, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ReloadDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + ReloadedAnalyzers = propReloadedAnalyzers.Value, + ReloadedNodeIds = propReloadedNodeIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ReloadDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropReloadedAnalyzers, value.ReloadedAnalyzers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropReloadedNodeIds, value.ReloadedNodeIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ReloadDetailsConverter))] public sealed partial class ReloadDetails { - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("reloaded_analyzers")] - public IReadOnlyCollection ReloadedAnalyzers { get; init; } - [JsonInclude, JsonPropertyName("reloaded_node_ids")] - public IReadOnlyCollection ReloadedNodeIds { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadDetails(string index, System.Collections.Generic.IReadOnlyCollection reloadedAnalyzers, System.Collections.Generic.IReadOnlyCollection reloadedNodeIds) + { + Index = index; + ReloadedAnalyzers = reloadedAnalyzers; + ReloadedNodeIds = reloadedNodeIds; + } +#if NET7_0_OR_GREATER + public ReloadDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReloadDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReloadedAnalyzers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReloadedNodeIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadResult.g.cs index 22e6b0f1950..fbf6cceb306 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ReloadResult.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ReloadResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReloadDetails = System.Text.Json.JsonEncodedText.Encode("reload_details"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("_shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propReloadDetails = default; + LocalJsonValue propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReloadDetails.TryReadProperty(ref reader, options, PropReloadDetails, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReloadDetails = propReloadDetails.Value, + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReloadDetails, value.ReloadDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ReloadResultConverter))] public sealed partial class ReloadResult { - [JsonInclude, JsonPropertyName("reload_details")] - public IReadOnlyCollection ReloadDetails { get; init; } - [JsonInclude, JsonPropertyName("_shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReloadResult(System.Collections.Generic.IReadOnlyCollection reloadDetails, Elastic.Clients.Elasticsearch.ShardStatistics shards) + { + ReloadDetails = reloadDetails; + Shards = shards; + } +#if NET7_0_OR_GREATER + public ReloadResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReloadResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReloadResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ReloadDetails { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveAction.g.cs index fc2de9dd136..3e423639c45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveAction.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RemoveActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAlias = System.Text.Json.JsonEncodedText.Encode("alias"); + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMustExist = System.Text.Json.JsonEncodedText.Encode("must_exist"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlias = default; + LocalJsonValue?> propAliases = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndices = default; + LocalJsonValue propMustExist = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlias.TryReadProperty(ref reader, options, PropAlias, null)) + { + continue; + } + + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMustExist.TryReadProperty(ref reader, options, PropMustExist, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alias = propAlias.Value, + Aliases = propAliases.Value, + Index = propIndex.Value, + Indices = propIndices.Value, + MustExist = propMustExist.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlias, value.Alias, null, null); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMustExist, value.MustExist, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionConverter))] public sealed partial class RemoveAction { +#if NET7_0_OR_GREATER + public RemoveAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public RemoveAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoveAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Alias for the action. /// Index alias names support date math. /// /// - [JsonInclude, JsonPropertyName("alias")] public Elastic.Clients.Elasticsearch.IndexAlias? Alias { get; set; } /// @@ -44,9 +131,7 @@ public sealed partial class RemoveAction /// Index alias names support date math. /// /// - [JsonInclude, JsonPropertyName("aliases")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexAlias))] - public ICollection? Aliases { get; set; } + public System.Collections.Generic.ICollection? Aliases { get; set; } /// /// @@ -54,7 +139,6 @@ public sealed partial class RemoveAction /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -63,7 +147,6 @@ public sealed partial class RemoveAction /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// @@ -71,25 +154,27 @@ public sealed partial class RemoveAction /// If true, the alias must exist to perform the action. /// /// - [JsonInclude, JsonPropertyName("must_exist")] public bool? MustExist { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(RemoveAction removeAction) => Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction.Remove(removeAction); } -public sealed partial class RemoveActionDescriptor : SerializableDescriptor +public readonly partial struct RemoveActionDescriptor { - internal RemoveActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction Instance { get; init; } - public RemoveActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexAlias? AliasValue { get; set; } - private ICollection? AliasesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? MustExistValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveActionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction(Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor descriptor) => descriptor.Instance; /// /// @@ -97,10 +182,22 @@ public RemoveActionDescriptor() : base() /// Index alias names support date math. /// /// - public RemoveActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? alias) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? value) + { + Instance.Alias = value; + return this; + } + + /// + /// + /// Aliases for the action. + /// Index alias names support date math. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor Aliases(System.Collections.Generic.ICollection? value) { - AliasValue = alias; - return Self; + Instance.Aliases = value; + return this; } /// @@ -109,10 +206,10 @@ public RemoveActionDescriptor Alias(Elastic.Clients.Elasticsearch.IndexAlias? al /// Index alias names support date math. /// /// - public RemoveActionDescriptor Aliases(ICollection? aliases) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor Aliases(params Elastic.Clients.Elasticsearch.IndexAlias[] values) { - AliasesValue = aliases; - return Self; + Instance.Aliases = [.. values]; + return this; } /// @@ -121,10 +218,10 @@ public RemoveActionDescriptor Aliases(ICollection*). /// /// - public RemoveActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -133,10 +230,10 @@ public RemoveActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? ind /// Supports wildcards (*). /// /// - public RemoveActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -144,45 +241,22 @@ public RemoveActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? ind /// If true, the alias must exist to perform the action. /// /// - public RemoveActionDescriptor MustExist(bool? mustExist = true) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor MustExist(bool? value = true) { - MustExistValue = mustExist; - return Self; + Instance.MustExist = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction Build(System.Action? action) { - writer.WriteStartObject(); - if (AliasValue is not null) - { - writer.WritePropertyName("alias"); - JsonSerializer.Serialize(writer, AliasValue, options); - } - - if (AliasesValue is not null) - { - writer.WritePropertyName("aliases"); - SingleOrManySerializationHelper.Serialize(AliasesValue, writer, options); - } - - if (IndexValue is not null) + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (MustExistValue.HasValue) - { - writer.WritePropertyName("must_exist"); - writer.WriteBooleanValue(MustExistValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RemoveActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RemoveAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveIndexAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveIndexAction.g.cs index 795a0b6aac6..a664d744bf5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveIndexAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RemoveIndexAction.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RemoveIndexActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMustExist = System.Text.Json.JsonEncodedText.Encode("must_exist"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propIndices = default; + LocalJsonValue propMustExist = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMustExist.TryReadProperty(ref reader, options, PropMustExist, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Indices = propIndices.Value, + MustExist = propMustExist.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMustExist, value.MustExist, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionConverter))] public sealed partial class RemoveIndexAction { +#if NET7_0_OR_GREATER + public RemoveIndexAction() + { + } +#endif +#if !NET7_0_OR_GREATER + public RemoveIndexAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoveIndexAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Data stream or index for the action. /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -44,7 +113,6 @@ public sealed partial class RemoveIndexAction /// Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// @@ -52,23 +120,27 @@ public sealed partial class RemoveIndexAction /// If true, the alias must exist to perform the action. /// /// - [JsonInclude, JsonPropertyName("must_exist")] public bool? MustExist { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction(RemoveIndexAction removeIndexAction) => Elastic.Clients.Elasticsearch.IndexManagement.IndexUpdateAliasesAction.RemoveIndex(removeIndexAction); } -public sealed partial class RemoveIndexActionDescriptor : SerializableDescriptor +public readonly partial struct RemoveIndexActionDescriptor { - internal RemoveIndexActionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveIndexActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction instance) + { + Instance = instance; + } - public RemoveIndexActionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveIndexActionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private bool? MustExistValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction(Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor descriptor) => descriptor.Instance; /// /// @@ -76,10 +148,10 @@ public RemoveIndexActionDescriptor() : base() /// Supports wildcards (*). /// /// - public RemoveIndexActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -88,10 +160,10 @@ public RemoveIndexActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName /// Supports wildcards (*). /// /// - public RemoveIndexActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -99,33 +171,22 @@ public RemoveIndexActionDescriptor Indices(Elastic.Clients.Elasticsearch.Indices /// If true, the alias must exist to perform the action. /// /// - public RemoveIndexActionDescriptor MustExist(bool? mustExist = true) + public Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor MustExist(bool? value = true) { - MustExistValue = mustExist; - return Self; + Instance.MustExist = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (IndicesValue is not null) + if (action is null) { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MustExistValue.HasValue) - { - writer.WritePropertyName("must_exist"); - writer.WriteBooleanValue(MustExistValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexActionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RemoveIndexAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveClusterInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveClusterInfo.g.cs index 6870149f308..dac73d5e8f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveClusterInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveClusterInfo.g.cs @@ -17,30 +17,128 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ResolveClusterInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConnected = System.Text.Json.JsonEncodedText.Encode("connected"); + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropMatchingIndices = System.Text.Json.JsonEncodedText.Encode("matching_indices"); + private static readonly System.Text.Json.JsonEncodedText PropSkipUnavailable = System.Text.Json.JsonEncodedText.Encode("skip_unavailable"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConnected = default; + LocalJsonValue propError = default; + LocalJsonValue propMatchingIndices = default; + LocalJsonValue propSkipUnavailable = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnected.TryReadProperty(ref reader, options, PropConnected, null)) + { + continue; + } + + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propMatchingIndices.TryReadProperty(ref reader, options, PropMatchingIndices, null)) + { + continue; + } + + if (propSkipUnavailable.TryReadProperty(ref reader, options, PropSkipUnavailable, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Connected = propConnected.Value, + Error = propError.Value, + MatchingIndices = propMatchingIndices.Value, + SkipUnavailable = propSkipUnavailable.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnected, value.Connected, null, null); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropMatchingIndices, value.MatchingIndices, null, null); + writer.WriteProperty(options, PropSkipUnavailable, value.SkipUnavailable, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Provides information about each cluster request relevant to doing a cross-cluster search. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveClusterInfoConverter))] public sealed partial class ResolveClusterInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveClusterInfo(bool connected, bool skipUnavailable) + { + Connected = connected; + SkipUnavailable = skipUnavailable; + } +#if NET7_0_OR_GREATER + public ResolveClusterInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ResolveClusterInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveClusterInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Whether the remote cluster is connected to the local (querying) cluster. /// /// - [JsonInclude, JsonPropertyName("connected")] - public bool Connected { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Connected { get; set; } /// /// @@ -48,8 +146,7 @@ public sealed partial class ResolveClusterInfo /// on the specified cluster (for example, lack of security privileges to query an index). /// /// - [JsonInclude, JsonPropertyName("error")] - public string? Error { get; init; } + public string? Error { get; set; } /// /// @@ -57,22 +154,23 @@ public sealed partial class ResolveClusterInfo /// on the cluster. /// /// - [JsonInclude, JsonPropertyName("matching_indices")] - public bool? MatchingIndices { get; init; } + public bool? MatchingIndices { get; set; } /// /// /// The skip_unavailable setting for a remote cluster. /// /// - [JsonInclude, JsonPropertyName("skip_unavailable")] - public bool SkipUnavailable { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool SkipUnavailable { get; set; } /// /// /// Provides version information about the cluster. /// /// - [JsonInclude, JsonPropertyName("version")] - public Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfo? Version { get; init; } + public Elastic.Clients.Elasticsearch.ElasticsearchVersionMinInfo? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexAliasItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexAliasItem.g.cs index fee1e4ee883..c0a045533d1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexAliasItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexAliasItem.g.cs @@ -17,21 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ResolveIndexAliasItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexAliasItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexAliasItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexAliasItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexAliasItemConverter))] public sealed partial class ResolveIndexAliasItem { - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveIndexAliasItem(System.Collections.Generic.ICollection indices, string name) + { + Indices = indices; + Name = name; + } +#if NET7_0_OR_GREATER + public ResolveIndexAliasItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ResolveIndexAliasItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveIndexAliasItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexDataStreamsItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexDataStreamsItem.g.cs index bde3f17ffea..1445c55b3d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexDataStreamsItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexDataStreamsItem.g.cs @@ -17,23 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ResolveIndexDataStreamsItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBackingIndices = System.Text.Json.JsonEncodedText.Encode("backing_indices"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampField = System.Text.Json.JsonEncodedText.Encode("timestamp_field"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexDataStreamsItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBackingIndices = default; + LocalJsonValue propName = default; + LocalJsonValue propTimestampField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBackingIndices.TryReadProperty(ref reader, options, PropBackingIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTimestampField.TryReadProperty(ref reader, options, PropTimestampField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexDataStreamsItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BackingIndices = propBackingIndices.Value, + Name = propName.Value, + TimestampField = propTimestampField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexDataStreamsItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBackingIndices, value.BackingIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTimestampField, value.TimestampField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexDataStreamsItemConverter))] public sealed partial class ResolveIndexDataStreamsItem { - [JsonInclude, JsonPropertyName("backing_indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection BackingIndices { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("timestamp_field")] - public string TimestampField { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveIndexDataStreamsItem(System.Collections.Generic.ICollection backingIndices, string name, string timestampField) + { + BackingIndices = backingIndices; + Name = name; + TimestampField = timestampField; + } +#if NET7_0_OR_GREATER + public ResolveIndexDataStreamsItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ResolveIndexDataStreamsItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveIndexDataStreamsItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection BackingIndices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TimestampField { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexItem.g.cs index 588cb493527..f6ad1adfdc2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ResolveIndexItem.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ResolveIndexItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropDataStream = System.Text.Json.JsonEncodedText.Encode("data_stream"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAliases = default; + LocalJsonValue> propAttributes = default; + LocalJsonValue propDataStream = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDataStream.TryReadProperty(ref reader, options, PropDataStream, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Attributes = propAttributes.Value, + DataStream = propDataStream.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDataStream, value.DataStream, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ResolveIndexItemConverter))] public sealed partial class ResolveIndexItem { - [JsonInclude, JsonPropertyName("aliases")] - public IReadOnlyCollection? Aliases { get; init; } - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyCollection Attributes { get; init; } - [JsonInclude, JsonPropertyName("data_stream")] - public string? DataStream { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ResolveIndexItem(System.Collections.Generic.IReadOnlyCollection attributes, string name) + { + Attributes = attributes; + Name = name; + } +#if NET7_0_OR_GREATER + public ResolveIndexItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ResolveIndexItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ResolveIndexItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Aliases { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Attributes { get; set; } + public string? DataStream { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RetentionLease.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RetentionLease.g.cs index 7fc4e32ef7e..4d90d1a30be 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RetentionLease.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RetentionLease.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RetentionLeaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPeriod = System.Text.Json.JsonEncodedText.Encode("period"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPeriod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPeriod.TryReadProperty(ref reader, options, PropPeriod, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Period = propPeriod.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPeriod, value.Period, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseConverter))] public sealed partial class RetentionLease { - [JsonInclude, JsonPropertyName("period")] - public Elastic.Clients.Elasticsearch.Duration Period { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionLease(Elastic.Clients.Elasticsearch.Duration period) + { + Period = period; + } +#if NET7_0_OR_GREATER + public RetentionLease() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RetentionLease() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RetentionLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration Period { get; set; } } -public sealed partial class RetentionLeaseDescriptor : SerializableDescriptor +public readonly partial struct RetentionLeaseDescriptor { - internal RetentionLeaseDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease Instance { get; init; } - public RetentionLeaseDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionLeaseDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration PeriodValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionLeaseDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public RetentionLeaseDescriptor Period(Elastic.Clients.Elasticsearch.Duration period) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor Period(Elastic.Clients.Elasticsearch.Duration value) { - PeriodValue = period; - return Self; + Instance.Period = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("period"); - JsonSerializer.Serialize(writer, PeriodValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RolloverConditions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RolloverConditions.g.cs index bd063e40ea7..f4a907fc810 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RolloverConditions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/RolloverConditions.g.cs @@ -17,257 +17,356 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class RolloverConditionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAge = System.Text.Json.JsonEncodedText.Encode("max_age"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAgeMillis = System.Text.Json.JsonEncodedText.Encode("max_age_millis"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocs = System.Text.Json.JsonEncodedText.Encode("max_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPrimaryShardSizeBytes = System.Text.Json.JsonEncodedText.Encode("max_primary_shard_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSize = System.Text.Json.JsonEncodedText.Encode("max_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSizeBytes = System.Text.Json.JsonEncodedText.Encode("max_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMinAge = System.Text.Json.JsonEncodedText.Encode("min_age"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocs = System.Text.Json.JsonEncodedText.Encode("min_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardDocs = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_docs"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardSize = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinPrimaryShardSizeBytes = System.Text.Json.JsonEncodedText.Encode("min_primary_shard_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMinSize = System.Text.Json.JsonEncodedText.Encode("min_size"); + private static readonly System.Text.Json.JsonEncodedText PropMinSizeBytes = System.Text.Json.JsonEncodedText.Encode("min_size_bytes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAge = default; + LocalJsonValue propMaxAgeMillis = default; + LocalJsonValue propMaxDocs = default; + LocalJsonValue propMaxPrimaryShardDocs = default; + LocalJsonValue propMaxPrimaryShardSize = default; + LocalJsonValue propMaxPrimaryShardSizeBytes = default; + LocalJsonValue propMaxSize = default; + LocalJsonValue propMaxSizeBytes = default; + LocalJsonValue propMinAge = default; + LocalJsonValue propMinDocs = default; + LocalJsonValue propMinPrimaryShardDocs = default; + LocalJsonValue propMinPrimaryShardSize = default; + LocalJsonValue propMinPrimaryShardSizeBytes = default; + LocalJsonValue propMinSize = default; + LocalJsonValue propMinSizeBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAge.TryReadProperty(ref reader, options, PropMaxAge, null)) + { + continue; + } + + if (propMaxAgeMillis.TryReadProperty(ref reader, options, PropMaxAgeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propMaxDocs.TryReadProperty(ref reader, options, PropMaxDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardDocs.TryReadProperty(ref reader, options, PropMaxPrimaryShardDocs, null)) + { + continue; + } + + if (propMaxPrimaryShardSize.TryReadProperty(ref reader, options, PropMaxPrimaryShardSize, null)) + { + continue; + } + + if (propMaxPrimaryShardSizeBytes.TryReadProperty(ref reader, options, PropMaxPrimaryShardSizeBytes, null)) + { + continue; + } + + if (propMaxSize.TryReadProperty(ref reader, options, PropMaxSize, null)) + { + continue; + } + + if (propMaxSizeBytes.TryReadProperty(ref reader, options, PropMaxSizeBytes, null)) + { + continue; + } + + if (propMinAge.TryReadProperty(ref reader, options, PropMinAge, null)) + { + continue; + } + + if (propMinDocs.TryReadProperty(ref reader, options, PropMinDocs, null)) + { + continue; + } + + if (propMinPrimaryShardDocs.TryReadProperty(ref reader, options, PropMinPrimaryShardDocs, null)) + { + continue; + } + + if (propMinPrimaryShardSize.TryReadProperty(ref reader, options, PropMinPrimaryShardSize, null)) + { + continue; + } + + if (propMinPrimaryShardSizeBytes.TryReadProperty(ref reader, options, PropMinPrimaryShardSizeBytes, null)) + { + continue; + } + + if (propMinSize.TryReadProperty(ref reader, options, PropMinSize, null)) + { + continue; + } + + if (propMinSizeBytes.TryReadProperty(ref reader, options, PropMinSizeBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAge = propMaxAge.Value, + MaxAgeMillis = propMaxAgeMillis.Value, + MaxDocs = propMaxDocs.Value, + MaxPrimaryShardDocs = propMaxPrimaryShardDocs.Value, + MaxPrimaryShardSize = propMaxPrimaryShardSize.Value, + MaxPrimaryShardSizeBytes = propMaxPrimaryShardSizeBytes.Value, + MaxSize = propMaxSize.Value, + MaxSizeBytes = propMaxSizeBytes.Value, + MinAge = propMinAge.Value, + MinDocs = propMinDocs.Value, + MinPrimaryShardDocs = propMinPrimaryShardDocs.Value, + MinPrimaryShardSize = propMinPrimaryShardSize.Value, + MinPrimaryShardSizeBytes = propMinPrimaryShardSizeBytes.Value, + MinSize = propMinSize.Value, + MinSizeBytes = propMinSizeBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAge, value.MaxAge, null, null); + writer.WriteProperty(options, PropMaxAgeMillis, value.MaxAgeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropMaxDocs, value.MaxDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardDocs, value.MaxPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardSize, value.MaxPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMaxPrimaryShardSizeBytes, value.MaxPrimaryShardSizeBytes, null, null); + writer.WriteProperty(options, PropMaxSize, value.MaxSize, null, null); + writer.WriteProperty(options, PropMaxSizeBytes, value.MaxSizeBytes, null, null); + writer.WriteProperty(options, PropMinAge, value.MinAge, null, null); + writer.WriteProperty(options, PropMinDocs, value.MinDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardDocs, value.MinPrimaryShardDocs, null, null); + writer.WriteProperty(options, PropMinPrimaryShardSize, value.MinPrimaryShardSize, null, null); + writer.WriteProperty(options, PropMinPrimaryShardSizeBytes, value.MinPrimaryShardSizeBytes, null, null); + writer.WriteProperty(options, PropMinSize, value.MinSize, null, null); + writer.WriteProperty(options, PropMinSizeBytes, value.MinSizeBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsConverter))] public sealed partial class RolloverConditions { - [JsonInclude, JsonPropertyName("max_age")] +#if NET7_0_OR_GREATER + public RolloverConditions() + { + } +#endif +#if !NET7_0_OR_GREATER + public RolloverConditions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Duration? MaxAge { get; set; } - [JsonInclude, JsonPropertyName("max_age_millis")] - public long? MaxAgeMillis { get; set; } - [JsonInclude, JsonPropertyName("max_docs")] + public System.TimeSpan? MaxAgeMillis { get; set; } public long? MaxDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_docs")] public long? MaxPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("max_primary_shard_size_bytes")] public long? MaxPrimaryShardSizeBytes { get; set; } - [JsonInclude, JsonPropertyName("max_size")] public Elastic.Clients.Elasticsearch.ByteSize? MaxSize { get; set; } - [JsonInclude, JsonPropertyName("max_size_bytes")] public long? MaxSizeBytes { get; set; } - [JsonInclude, JsonPropertyName("min_age")] public Elastic.Clients.Elasticsearch.Duration? MinAge { get; set; } - [JsonInclude, JsonPropertyName("min_docs")] public long? MinDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_docs")] public long? MinPrimaryShardDocs { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSize { get; set; } - [JsonInclude, JsonPropertyName("min_primary_shard_size_bytes")] public long? MinPrimaryShardSizeBytes { get; set; } - [JsonInclude, JsonPropertyName("min_size")] public Elastic.Clients.Elasticsearch.ByteSize? MinSize { get; set; } - [JsonInclude, JsonPropertyName("min_size_bytes")] public long? MinSizeBytes { get; set; } } -public sealed partial class RolloverConditionsDescriptor : SerializableDescriptor +public readonly partial struct RolloverConditionsDescriptor { - internal RolloverConditionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions Instance { get; init; } - public RolloverConditionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverConditionsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? MaxAgeValue { get; set; } - private long? MaxAgeMillisValue { get; set; } - private long? MaxDocsValue { get; set; } - private long? MaxPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxPrimaryShardSizeValue { get; set; } - private long? MaxPrimaryShardSizeBytesValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSizeValue { get; set; } - private long? MaxSizeBytesValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? MinAgeValue { get; set; } - private long? MinDocsValue { get; set; } - private long? MinPrimaryShardDocsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinPrimaryShardSizeValue { get; set; } - private long? MinPrimaryShardSizeBytesValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MinSizeValue { get; set; } - private long? MinSizeBytesValue { get; set; } - - public RolloverConditionsDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration? maxAge) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RolloverConditionsDescriptor() { - MaxAgeValue = maxAge; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RolloverConditionsDescriptor MaxAgeMillis(long? maxAgeMillis) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions instance) => new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions(Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration? value) { - MaxAgeMillisValue = maxAgeMillis; - return Self; + Instance.MaxAge = value; + return this; } - public RolloverConditionsDescriptor MaxDocs(long? maxDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxAgeMillis(System.TimeSpan? value) { - MaxDocsValue = maxDocs; - return Self; + Instance.MaxAgeMillis = value; + return this; } - public RolloverConditionsDescriptor MaxPrimaryShardDocs(long? maxPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxDocs(long? value) { - MaxPrimaryShardDocsValue = maxPrimaryShardDocs; - return Self; + Instance.MaxDocs = value; + return this; } - public RolloverConditionsDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? maxPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxPrimaryShardDocs(long? value) { - MaxPrimaryShardSizeValue = maxPrimaryShardSize; - return Self; + Instance.MaxPrimaryShardDocs = value; + return this; } - public RolloverConditionsDescriptor MaxPrimaryShardSizeBytes(long? maxPrimaryShardSizeBytes) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MaxPrimaryShardSizeBytesValue = maxPrimaryShardSizeBytes; - return Self; + Instance.MaxPrimaryShardSize = value; + return this; } - public RolloverConditionsDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? maxSize) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxPrimaryShardSize(System.Func action) { - MaxSizeValue = maxSize; - return Self; + Instance.MaxPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public RolloverConditionsDescriptor MaxSizeBytes(long? maxSizeBytes) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxPrimaryShardSizeBytes(long? value) { - MaxSizeBytesValue = maxSizeBytes; - return Self; + Instance.MaxPrimaryShardSizeBytes = value; + return this; } - public RolloverConditionsDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? minAge) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MinAgeValue = minAge; - return Self; + Instance.MaxSize = value; + return this; } - public RolloverConditionsDescriptor MinDocs(long? minDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxSize(System.Func action) { - MinDocsValue = minDocs; - return Self; + Instance.MaxSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public RolloverConditionsDescriptor MinPrimaryShardDocs(long? minPrimaryShardDocs) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MaxSizeBytes(long? value) { - MinPrimaryShardDocsValue = minPrimaryShardDocs; - return Self; + Instance.MaxSizeBytes = value; + return this; } - public RolloverConditionsDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? minPrimaryShardSize) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinAge(Elastic.Clients.Elasticsearch.Duration? value) { - MinPrimaryShardSizeValue = minPrimaryShardSize; - return Self; + Instance.MinAge = value; + return this; } - public RolloverConditionsDescriptor MinPrimaryShardSizeBytes(long? minPrimaryShardSizeBytes) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinDocs(long? value) { - MinPrimaryShardSizeBytesValue = minPrimaryShardSizeBytes; - return Self; + Instance.MinDocs = value; + return this; } - public RolloverConditionsDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? minSize) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinPrimaryShardDocs(long? value) { - MinSizeValue = minSize; - return Self; + Instance.MinPrimaryShardDocs = value; + return this; } - public RolloverConditionsDescriptor MinSizeBytes(long? minSizeBytes) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinPrimaryShardSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - MinSizeBytesValue = minSizeBytes; - return Self; + Instance.MinPrimaryShardSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinPrimaryShardSize(System.Func action) { - writer.WriteStartObject(); - if (MaxAgeValue is not null) - { - writer.WritePropertyName("max_age"); - JsonSerializer.Serialize(writer, MaxAgeValue, options); - } - - if (MaxAgeMillisValue.HasValue) - { - writer.WritePropertyName("max_age_millis"); - writer.WriteNumberValue(MaxAgeMillisValue.Value); - } - - if (MaxDocsValue.HasValue) - { - writer.WritePropertyName("max_docs"); - writer.WriteNumberValue(MaxDocsValue.Value); - } - - if (MaxPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("max_primary_shard_docs"); - writer.WriteNumberValue(MaxPrimaryShardDocsValue.Value); - } - - if (MaxPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("max_primary_shard_size"); - JsonSerializer.Serialize(writer, MaxPrimaryShardSizeValue, options); - } - - if (MaxPrimaryShardSizeBytesValue.HasValue) - { - writer.WritePropertyName("max_primary_shard_size_bytes"); - writer.WriteNumberValue(MaxPrimaryShardSizeBytesValue.Value); - } - - if (MaxSizeValue is not null) - { - writer.WritePropertyName("max_size"); - JsonSerializer.Serialize(writer, MaxSizeValue, options); - } - - if (MaxSizeBytesValue.HasValue) - { - writer.WritePropertyName("max_size_bytes"); - writer.WriteNumberValue(MaxSizeBytesValue.Value); - } - - if (MinAgeValue is not null) - { - writer.WritePropertyName("min_age"); - JsonSerializer.Serialize(writer, MinAgeValue, options); - } - - if (MinDocsValue.HasValue) - { - writer.WritePropertyName("min_docs"); - writer.WriteNumberValue(MinDocsValue.Value); - } + Instance.MinPrimaryShardSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinPrimaryShardDocsValue.HasValue) - { - writer.WritePropertyName("min_primary_shard_docs"); - writer.WriteNumberValue(MinPrimaryShardDocsValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinPrimaryShardSizeBytes(long? value) + { + Instance.MinPrimaryShardSizeBytes = value; + return this; + } - if (MinPrimaryShardSizeValue is not null) - { - writer.WritePropertyName("min_primary_shard_size"); - JsonSerializer.Serialize(writer, MinPrimaryShardSizeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinSize(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MinSize = value; + return this; + } - if (MinPrimaryShardSizeBytesValue.HasValue) - { - writer.WritePropertyName("min_primary_shard_size_bytes"); - writer.WriteNumberValue(MinPrimaryShardSizeBytesValue.Value); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinSize(System.Func action) + { + Instance.MinSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MinSizeValue is not null) - { - writer.WritePropertyName("min_size"); - JsonSerializer.Serialize(writer, MinSizeValue, options); - } + public Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor MinSizeBytes(long? value) + { + Instance.MinSizeBytes = value; + return this; + } - if (MinSizeBytesValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("min_size_bytes"); - writer.WriteNumberValue(MinSizeBytesValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditionsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.RolloverConditions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SearchIdle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SearchIdle.g.cs index 3c8a910aa89..614208bee3a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SearchIdle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SearchIdle.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SearchIdleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAfter = System.Text.Json.JsonEncodedText.Encode("after"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAfter = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAfter.TryReadProperty(ref reader, options, PropAfter, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + After = propAfter.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAfter, value.After, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleConverter))] public sealed partial class SearchIdle { - [JsonInclude, JsonPropertyName("after")] +#if NET7_0_OR_GREATER + public SearchIdle() + { + } +#endif +#if !NET7_0_OR_GREATER + public SearchIdle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchIdle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Duration? After { get; set; } } -public sealed partial class SearchIdleDescriptor : SerializableDescriptor +public readonly partial struct SearchIdleDescriptor { - internal SearchIdleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle Instance { get; init; } - public SearchIdleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchIdleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? AfterValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchIdleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SearchIdleDescriptor After(Elastic.Clients.Elasticsearch.Duration? after) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor After(Elastic.Clients.Elasticsearch.Duration? value) { - AfterValue = after; - return Self; + Instance.After = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle Build(System.Action? action) { - writer.WriteStartObject(); - if (AfterValue is not null) + if (action is null) { - writer.WritePropertyName("after"); - JsonSerializer.Serialize(writer, AfterValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Segment.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Segment.g.cs index e67acb2be9f..667b5cea1c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Segment.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Segment.g.cs @@ -17,34 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SegmentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropCommitted = System.Text.Json.JsonEncodedText.Encode("committed"); + private static readonly System.Text.Json.JsonEncodedText PropCompound = System.Text.Json.JsonEncodedText.Encode("compound"); + private static readonly System.Text.Json.JsonEncodedText PropDeletedDocs = System.Text.Json.JsonEncodedText.Encode("deleted_docs"); + private static readonly System.Text.Json.JsonEncodedText PropGeneration = System.Text.Json.JsonEncodedText.Encode("generation"); + private static readonly System.Text.Json.JsonEncodedText PropNumDocs = System.Text.Json.JsonEncodedText.Encode("num_docs"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Segment Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propCommitted = default; + LocalJsonValue propCompound = default; + LocalJsonValue propDeletedDocs = default; + LocalJsonValue propGeneration = default; + LocalJsonValue propNumDocs = default; + LocalJsonValue propSearch = default; + LocalJsonValue propSizeInBytes = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propCommitted.TryReadProperty(ref reader, options, PropCommitted, null)) + { + continue; + } + + if (propCompound.TryReadProperty(ref reader, options, PropCompound, null)) + { + continue; + } + + if (propDeletedDocs.TryReadProperty(ref reader, options, PropDeletedDocs, null)) + { + continue; + } + + if (propGeneration.TryReadProperty(ref reader, options, PropGeneration, null)) + { + continue; + } + + if (propNumDocs.TryReadProperty(ref reader, options, PropNumDocs, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Segment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + Committed = propCommitted.Value, + Compound = propCompound.Value, + DeletedDocs = propDeletedDocs.Value, + Generation = propGeneration.Value, + NumDocs = propNumDocs.Value, + Search = propSearch.Value, + SizeInBytes = propSizeInBytes.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Segment value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCommitted, value.Committed, null, null); + writer.WriteProperty(options, PropCompound, value.Compound, null, null); + writer.WriteProperty(options, PropDeletedDocs, value.DeletedDocs, null, null); + writer.WriteProperty(options, PropGeneration, value.Generation, null, null); + writer.WriteProperty(options, PropNumDocs, value.NumDocs, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SegmentConverter))] public sealed partial class Segment { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("committed")] - public bool Committed { get; init; } - [JsonInclude, JsonPropertyName("compound")] - public bool Compound { get; init; } - [JsonInclude, JsonPropertyName("deleted_docs")] - public long DeletedDocs { get; init; } - [JsonInclude, JsonPropertyName("generation")] - public int Generation { get; init; } - [JsonInclude, JsonPropertyName("num_docs")] - public long NumDocs { get; init; } - [JsonInclude, JsonPropertyName("search")] - public bool Search { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public double SizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Segment(System.Collections.Generic.IReadOnlyDictionary attributes, bool committed, bool compound, long deletedDocs, int generation, long numDocs, bool search, double sizeInBytes, string version) + { + Attributes = attributes; + Committed = committed; + Compound = compound; + DeletedDocs = deletedDocs; + Generation = generation; + NumDocs = numDocs; + Search = search; + SizeInBytes = sizeInBytes; + Version = version; + } +#if NET7_0_OR_GREATER + public Segment() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Segment() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Segment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Committed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Compound { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DeletedDocs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Generation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NumDocs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Search { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double SizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsAnalyze.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsAnalyze.g.cs index c848a55f254..81a4d3b14f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsAnalyze.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsAnalyze.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SettingsAnalyzeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokenCount = System.Text.Json.JsonEncodedText.Encode("max_token_count"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokenCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokenCount.TryReadProperty(ref reader, options, PropMaxTokenCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokenCount = propMaxTokenCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokenCount, value.MaxTokenCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeConverter))] public sealed partial class SettingsAnalyze { - [JsonInclude, JsonPropertyName("max_token_count")] +#if NET7_0_OR_GREATER + public SettingsAnalyze() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsAnalyze() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsAnalyze(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxTokenCount { get; set; } } -public sealed partial class SettingsAnalyzeDescriptor : SerializableDescriptor +public readonly partial struct SettingsAnalyzeDescriptor { - internal SettingsAnalyzeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze Instance { get; init; } - public SettingsAnalyzeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsAnalyzeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze instance) { + Instance = instance; } - private int? MaxTokenCountValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsAnalyzeDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SettingsAnalyzeDescriptor MaxTokenCount(int? maxTokenCount) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze(Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor MaxTokenCount(int? value) { - MaxTokenCountValue = maxTokenCount; - return Self; + Instance.MaxTokenCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze Build(System.Action? action) { - writer.WriteStartObject(); - if (MaxTokenCountValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_token_count"); - writer.WriteNumberValue(MaxTokenCountValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyzeDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsAnalyze(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsHighlight.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsHighlight.g.cs index e070b688a5f..ea1cda8e15d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsHighlight.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsHighlight.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SettingsHighlightConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAnalyzedOffset = System.Text.Json.JsonEncodedText.Encode("max_analyzed_offset"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAnalyzedOffset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAnalyzedOffset.TryReadProperty(ref reader, options, PropMaxAnalyzedOffset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAnalyzedOffset = propMaxAnalyzedOffset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAnalyzedOffset, value.MaxAnalyzedOffset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightConverter))] public sealed partial class SettingsHighlight { - [JsonInclude, JsonPropertyName("max_analyzed_offset")] +#if NET7_0_OR_GREATER + public SettingsHighlight() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsHighlight() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public int? MaxAnalyzedOffset { get; set; } } -public sealed partial class SettingsHighlightDescriptor : SerializableDescriptor +public readonly partial struct SettingsHighlightDescriptor { - internal SettingsHighlightDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight Instance { get; init; } - public SettingsHighlightDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsHighlightDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight instance) { + Instance = instance; } - private int? MaxAnalyzedOffsetValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsHighlightDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SettingsHighlightDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight(Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor MaxAnalyzedOffset(int? value) { - MaxAnalyzedOffsetValue = maxAnalyzedOffset; - return Self; + Instance.MaxAnalyzedOffset = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight Build(System.Action? action) { - writer.WriteStartObject(); - if (MaxAnalyzedOffsetValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_analyzed_offset"); - writer.WriteNumberValue(MaxAnalyzedOffsetValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlightDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsHighlight(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsQueryString.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsQueryString.g.cs index af44bd56911..11205edc402 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsQueryString.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsQueryString.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SettingsQueryStringConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLenient = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lenient = propLenient.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringConverter))] public sealed partial class SettingsQueryString { - [JsonInclude, JsonPropertyName("lenient")] - public bool Lenient { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsQueryString(bool lenient) + { + Lenient = lenient; + } +#if NET7_0_OR_GREATER + public SettingsQueryString() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SettingsQueryString() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsQueryString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Lenient { get; set; } } -public sealed partial class SettingsQueryStringDescriptor : SerializableDescriptor +public readonly partial struct SettingsQueryStringDescriptor { - internal SettingsQueryStringDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString Instance { get; init; } - public SettingsQueryStringDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsQueryStringDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString instance) { + Instance = instance; } - private bool LenientValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsQueryStringDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SettingsQueryStringDescriptor Lenient(bool lenient = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString(Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor Lenient(bool value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryStringDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsQueryString(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSearch.g.cs index d50a4f9fbc3..9cc8b59e250 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSearch.g.cs @@ -17,122 +17,148 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SettingsSearchConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIdle = System.Text.Json.JsonEncodedText.Encode("idle"); + private static readonly System.Text.Json.JsonEncodedText PropSlowlog = System.Text.Json.JsonEncodedText.Encode("slowlog"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIdle = default; + LocalJsonValue propSlowlog = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIdle.TryReadProperty(ref reader, options, PropIdle, null)) + { + continue; + } + + if (propSlowlog.TryReadProperty(ref reader, options, PropSlowlog, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Idle = propIdle.Value, + Slowlog = propSlowlog.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIdle, value.Idle, null, null); + writer.WriteProperty(options, PropSlowlog, value.Slowlog, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchConverter))] public sealed partial class SettingsSearch { - [JsonInclude, JsonPropertyName("idle")] +#if NET7_0_OR_GREATER + public SettingsSearch() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsSearch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle? Idle { get; set; } - [JsonInclude, JsonPropertyName("slowlog")] public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings? Slowlog { get; set; } } -public sealed partial class SettingsSearchDescriptor : SerializableDescriptor +public readonly partial struct SettingsSearchDescriptor { - internal SettingsSearchDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch Instance { get; init; } - public SettingsSearchDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSearchDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle? IdleValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor IdleDescriptor { get; set; } - private Action IdleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings? SlowlogValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor SlowlogDescriptor { get; set; } - private Action SlowlogDescriptorAction { get; set; } - - public SettingsSearchDescriptor Idle(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle? idle) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSearchDescriptor() { - IdleDescriptor = null; - IdleDescriptorAction = null; - IdleValue = idle; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SettingsSearchDescriptor Idle(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Idle(Elastic.Clients.Elasticsearch.IndexManagement.SearchIdle? value) { - IdleValue = null; - IdleDescriptorAction = null; - IdleDescriptor = descriptor; - return Self; + Instance.Idle = value; + return this; } - public SettingsSearchDescriptor Idle(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Idle() { - IdleValue = null; - IdleDescriptor = null; - IdleDescriptorAction = configure; - return Self; + Instance.Idle = Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor.Build(null); + return this; } - public SettingsSearchDescriptor Slowlog(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings? slowlog) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Idle(System.Action? action) { - SlowlogDescriptor = null; - SlowlogDescriptorAction = null; - SlowlogValue = slowlog; - return Self; + Instance.Idle = Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor.Build(action); + return this; } - public SettingsSearchDescriptor Slowlog(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Slowlog(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings? value) { - SlowlogValue = null; - SlowlogDescriptorAction = null; - SlowlogDescriptor = descriptor; - return Self; + Instance.Slowlog = value; + return this; } - public SettingsSearchDescriptor Slowlog(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Slowlog() { - SlowlogValue = null; - SlowlogDescriptor = null; - SlowlogDescriptorAction = configure; - return Self; + Instance.Slowlog = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor Slowlog(System.Action? action) { - writer.WriteStartObject(); - if (IdleDescriptor is not null) - { - writer.WritePropertyName("idle"); - JsonSerializer.Serialize(writer, IdleDescriptor, options); - } - else if (IdleDescriptorAction is not null) - { - writer.WritePropertyName("idle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SearchIdleDescriptor(IdleDescriptorAction), options); - } - else if (IdleValue is not null) - { - writer.WritePropertyName("idle"); - JsonSerializer.Serialize(writer, IdleValue, options); - } + Instance.Slowlog = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor.Build(action); + return this; + } - if (SlowlogDescriptor is not null) - { - writer.WritePropertyName("slowlog"); - JsonSerializer.Serialize(writer, SlowlogDescriptor, options); - } - else if (SlowlogDescriptorAction is not null) - { - writer.WritePropertyName("slowlog"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor(SlowlogDescriptorAction), options); - } - else if (SlowlogValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("slowlog"); - JsonSerializer.Serialize(writer, SlowlogValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearchDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarities.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarities.g.cs index 49db5a56af3..41ffe9d3177 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarities.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarities.g.cs @@ -17,161 +17,192 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public partial class SettingsSimilarities : IsADictionary +internal sealed partial class SettingsSimilaritiesConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesConverter))] +public sealed partial class SettingsSimilarities : Elastic.Clients.Elasticsearch.IsADictionary { public SettingsSimilarities() { } - public SettingsSimilarities(IDictionary container) : base(container) + public SettingsSimilarities(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(string name, ISettingsSimilarity settingsSimilarity) => BackingDictionary.Add(Sanitize(name), settingsSimilarity); - public bool TryGetSettingsSimilarity(string name, [NotNullWhen(returnValue: true)] out ISettingsSimilarity settingsSimilarity) => BackingDictionary.TryGetValue(Sanitize(name), out settingsSimilarity); + public void Add(string key, Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetSettingsSimilarity(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetSettingsSimilarity(string name, [NotNullWhen(returnValue: true)] out T? settingsSimilarity) where T : class, ISettingsSimilarity + public bool TryGetSettingsSimilarity(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, ISettingsSimilarity { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - settingsSimilarity = finalValue; + value = finalValue; return true; } - settingsSimilarity = null; + value = null; return false; } } -public sealed partial class SettingsSimilaritiesDescriptor : IsADictionaryDescriptor +public readonly partial struct SettingsSimilaritiesDescriptor { - public SettingsSimilaritiesDescriptor() : base(new SettingsSimilarities()) - { - } - - public SettingsSimilaritiesDescriptor(SettingsSimilarities settingsSimilarities) : base(settingsSimilarities ?? new SettingsSimilarities()) - { - } - - public SettingsSimilaritiesDescriptor Bm25(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Bm25(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Bm25(string settingsSimilarityName, SettingsSimilarityBm25 settingsSimilarityBm25) => AssignVariant(settingsSimilarityName, settingsSimilarityBm25); - public SettingsSimilaritiesDescriptor Boolean(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Boolean(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Boolean(string settingsSimilarityName, SettingsSimilarityBoolean settingsSimilarityBoolean) => AssignVariant(settingsSimilarityName, settingsSimilarityBoolean); - public SettingsSimilaritiesDescriptor Dfi(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Dfi(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Dfi(string settingsSimilarityName, SettingsSimilarityDfi settingsSimilarityDfi) => AssignVariant(settingsSimilarityName, settingsSimilarityDfi); - public SettingsSimilaritiesDescriptor Dfr(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Dfr(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Dfr(string settingsSimilarityName, SettingsSimilarityDfr settingsSimilarityDfr) => AssignVariant(settingsSimilarityName, settingsSimilarityDfr); - public SettingsSimilaritiesDescriptor Ib(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Ib(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Ib(string settingsSimilarityName, SettingsSimilarityIb settingsSimilarityIb) => AssignVariant(settingsSimilarityName, settingsSimilarityIb); - public SettingsSimilaritiesDescriptor Lmd(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Lmd(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Lmd(string settingsSimilarityName, SettingsSimilarityLmd settingsSimilarityLmd) => AssignVariant(settingsSimilarityName, settingsSimilarityLmd); - public SettingsSimilaritiesDescriptor Lmj(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Lmj(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Lmj(string settingsSimilarityName, SettingsSimilarityLmj settingsSimilarityLmj) => AssignVariant(settingsSimilarityName, settingsSimilarityLmj); - public SettingsSimilaritiesDescriptor Scripted(string settingsSimilarityName) => AssignVariant(settingsSimilarityName, null); - public SettingsSimilaritiesDescriptor Scripted(string settingsSimilarityName, Action configure) => AssignVariant(settingsSimilarityName, configure); - public SettingsSimilaritiesDescriptor Scripted(string settingsSimilarityName, SettingsSimilarityScripted settingsSimilarityScripted) => AssignVariant(settingsSimilarityName, settingsSimilarityScripted); -} + private readonly Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities _items = new(); -internal sealed partial class SettingsSimilarityInterfaceConverter : JsonConverter -{ - public override ISettingsSimilarity Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities Value => _items; + + public SettingsSimilaritiesDescriptor() { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + } - switch (type) - { - case "BM25": - return JsonSerializer.Deserialize(ref reader, options); - case "boolean": - return JsonSerializer.Deserialize(ref reader, options); - case "DFI": - return JsonSerializer.Deserialize(ref reader, options); - case "DFR": - return JsonSerializer.Deserialize(ref reader, options); - case "IB": - return JsonSerializer.Deserialize(ref reader, options); - case "LMDirichlet": - return JsonSerializer.Deserialize(ref reader, options); - case "LMJelinekMercer": - return JsonSerializer.Deserialize(ref reader, options); - case "scripted": - return JsonSerializer.Deserialize(ref reader, options); - default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(ISettingsSimilarity)); - return null; - } + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Bm25(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, ISettingsSimilarity value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Bm25(string key) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Bm25(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Boolean(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Boolean(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor.Build(null)); + return this; + } - switch (value.Type) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Boolean(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Dfi(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Dfi(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Dfr(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Dfr(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Ib(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Ib(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmd(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmd(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmd(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmj(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmj(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Lmj(string key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Scripted(string key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor Scripted(string key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities Build(System.Action? action) + { + if (action is null) { - case "BM25": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25), options); - return; - case "boolean": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean), options); - return; - case "DFI": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi), options); - return; - case "DFR": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr), options); - return; - case "IB": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb), options); - return; - case "LMDirichlet": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd), options); - return; - case "LMJelinekMercer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj), options); - return; - case "scripted": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarities(); } - } -} -[JsonConverter(typeof(SettingsSimilarityInterfaceConverter))] -public partial interface ISettingsSimilarity -{ - public string? Type { get; } + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilaritiesDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarity.g.cs new file mode 100644 index 00000000000..b73d264d83c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarity.g.cs @@ -0,0 +1,98 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class ISettingsSimilarityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "BM25" => reader.ReadValue(options, null), + "boolean" => reader.ReadValue(options, null), + "DFI" => reader.ReadValue(options, null), + "DFR" => reader.ReadValue(options, null), + "IB" => reader.ReadValue(options, null), + "LMDirichlet" => reader.ReadValue(options, null), + "LMJelinekMercer" => reader.ReadValue(options, null), + "scripted" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "BM25": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25)value, null); + break; + case "boolean": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean)value, null); + break; + case "DFI": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi)value, null); + break; + case "DFR": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr)value, null); + break; + case "IB": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb)value, null); + break; + case "LMDirichlet": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd)value, null); + break; + case "LMJelinekMercer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj)value, null); + break; + case "scripted": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarityConverter))] +public partial interface ISettingsSimilarity +{ + public string Type { get; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBm25.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBm25.g.cs index 4c05bb1d2d0..a390d125faf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBm25.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBm25.g.cs @@ -17,89 +17,150 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityBm25 : ISettingsSimilarity +internal sealed partial class SettingsSimilarityBm25Converter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("b")] - public double? b { get; set; } - [JsonInclude, JsonPropertyName("discount_overlaps")] + private static readonly System.Text.Json.JsonEncodedText PropB = System.Text.Json.JsonEncodedText.Encode("b"); + private static readonly System.Text.Json.JsonEncodedText PropDiscountOverlaps = System.Text.Json.JsonEncodedText.Encode("discount_overlaps"); + private static readonly System.Text.Json.JsonEncodedText PropK1 = System.Text.Json.JsonEncodedText.Encode("k1"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propB = default; + LocalJsonValue propDiscountOverlaps = default; + LocalJsonValue propK1 = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propB.TryReadProperty(ref reader, options, PropB, null)) + { + continue; + } + + if (propDiscountOverlaps.TryReadProperty(ref reader, options, PropDiscountOverlaps, null)) + { + continue; + } + + if (propK1.TryReadProperty(ref reader, options, PropK1, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + B = propB.Value, + DiscountOverlaps = propDiscountOverlaps.Value, + K1 = propK1.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropB, value.B, null, null); + writer.WriteProperty(options, PropDiscountOverlaps, value.DiscountOverlaps, null, null); + writer.WriteProperty(options, PropK1, value.K1, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Converter))] +public sealed partial class SettingsSimilarityBm25 : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity +{ +#if NET7_0_OR_GREATER + public SettingsSimilarityBm25() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsSimilarityBm25() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public double? B { get; set; } public bool? DiscountOverlaps { get; set; } - [JsonInclude, JsonPropertyName("k1")] public double? K1 { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "BM25"; } -public sealed partial class SettingsSimilarityBm25Descriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityBm25Descriptor { - internal SettingsSimilarityBm25Descriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 Instance { get; init; } - public SettingsSimilarityBm25Descriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityBm25Descriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 instance) { + Instance = instance; } - private double? bValue { get; set; } - private bool? DiscountOverlapsValue { get; set; } - private double? K1Value { get; set; } - - public SettingsSimilarityBm25Descriptor b(double? b) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityBm25Descriptor() { - bValue = b; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SettingsSimilarityBm25Descriptor DiscountOverlaps(bool? discountOverlaps = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor B(double? value) { - DiscountOverlapsValue = discountOverlaps; - return Self; + Instance.B = value; + return this; } - public SettingsSimilarityBm25Descriptor K1(double? k1) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor DiscountOverlaps(bool? value = true) { - K1Value = k1; - return Self; + Instance.DiscountOverlaps = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor K1(double? value) { - writer.WriteStartObject(); - if (bValue.HasValue) - { - writer.WritePropertyName("b"); - writer.WriteNumberValue(bValue.Value); - } - - if (DiscountOverlapsValue.HasValue) - { - writer.WritePropertyName("discount_overlaps"); - writer.WriteBooleanValue(DiscountOverlapsValue.Value); - } + Instance.K1 = value; + return this; + } - if (K1Value.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25 Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("k1"); - writer.WriteNumberValue(K1Value.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("BM25"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25Descriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBm25(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SettingsSimilarityBm25 IBuildableDescriptor.Build() => new() - { - b = bValue, - DiscountOverlaps = DiscountOverlapsValue, - K1 = K1Value - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBoolean.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBoolean.g.cs index 152ce54095e..e8d41cdf5d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBoolean.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityBoolean.g.cs @@ -17,39 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityBoolean : ISettingsSimilarity +internal sealed partial class SettingsSimilarityBooleanConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanConverter))] +public sealed partial class SettingsSimilarityBoolean : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity { - [JsonInclude, JsonPropertyName("type")] +#if NET7_0_OR_GREATER + public SettingsSimilarityBoolean() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsSimilarityBoolean() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string Type => "boolean"; } -public sealed partial class SettingsSimilarityBooleanDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityBooleanDescriptor { - internal SettingsSimilarityBooleanDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean Instance { get; init; } - public SettingsSimilarityBooleanDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityBooleanDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityBooleanDescriptor() { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue("boolean"); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - SettingsSimilarityBoolean IBuildableDescriptor.Build() => new() + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean Build(System.Action? action) { - }; + if (action is null) + { + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBooleanDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityBoolean(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfi.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfi.g.cs index 7afd7c74faf..ddd3800fb35 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfi.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfi.g.cs @@ -17,53 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityDfi : ISettingsSimilarity +internal sealed partial class SettingsSimilarityDfiConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("independence_measure")] - public Elastic.Clients.Elasticsearch.DFIIndependenceMeasure IndependenceMeasure { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropIndependenceMeasure = System.Text.Json.JsonEncodedText.Encode("independence_measure"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndependenceMeasure = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndependenceMeasure.TryReadProperty(ref reader, options, PropIndependenceMeasure, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndependenceMeasure = propIndependenceMeasure.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndependenceMeasure, value.IndependenceMeasure, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiConverter))] +public sealed partial class SettingsSimilarityDfi : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.DFIIndependenceMeasure independenceMeasure) + { + IndependenceMeasure = independenceMeasure; + } +#if NET7_0_OR_GREATER + public SettingsSimilarityDfi() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SettingsSimilarityDfi() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DFIIndependenceMeasure IndependenceMeasure { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "DFI"; } -public sealed partial class SettingsSimilarityDfiDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityDfiDescriptor { - internal SettingsSimilarityDfiDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi Instance { get; init; } - public SettingsSimilarityDfiDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfiDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.DFIIndependenceMeasure IndependenceMeasureValue { get; set; } - - public SettingsSimilarityDfiDescriptor IndependenceMeasure(Elastic.Clients.Elasticsearch.DFIIndependenceMeasure independenceMeasure) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfiDescriptor() { - IndependenceMeasureValue = independenceMeasure; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor IndependenceMeasure(Elastic.Clients.Elasticsearch.DFIIndependenceMeasure value) { - writer.WriteStartObject(); - writer.WritePropertyName("independence_measure"); - JsonSerializer.Serialize(writer, IndependenceMeasureValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("DFI"); - writer.WriteEndObject(); + Instance.IndependenceMeasure = value; + return this; } - SettingsSimilarityDfi IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi Build(System.Action action) { - IndependenceMeasure = IndependenceMeasureValue - }; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfiDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfi(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfr.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfr.g.cs index 6ec1d24507c..85329ec12ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfr.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityDfr.g.cs @@ -17,77 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityDfr : ISettingsSimilarity +internal sealed partial class SettingsSimilarityDfrConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAfterEffect = System.Text.Json.JsonEncodedText.Encode("after_effect"); + private static readonly System.Text.Json.JsonEncodedText PropBasicModel = System.Text.Json.JsonEncodedText.Encode("basic_model"); + private static readonly System.Text.Json.JsonEncodedText PropNormalization = System.Text.Json.JsonEncodedText.Encode("normalization"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAfterEffect = default; + LocalJsonValue propBasicModel = default; + LocalJsonValue propNormalization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAfterEffect.TryReadProperty(ref reader, options, PropAfterEffect, null)) + { + continue; + } + + if (propBasicModel.TryReadProperty(ref reader, options, PropBasicModel, null)) + { + continue; + } + + if (propNormalization.TryReadProperty(ref reader, options, PropNormalization, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AfterEffect = propAfterEffect.Value, + BasicModel = propBasicModel.Value, + Normalization = propNormalization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAfterEffect, value.AfterEffect, null, null); + writer.WriteProperty(options, PropBasicModel, value.BasicModel, null, null); + writer.WriteProperty(options, PropNormalization, value.Normalization, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrConverter))] +public sealed partial class SettingsSimilarityDfr : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity { - [JsonInclude, JsonPropertyName("after_effect")] - public Elastic.Clients.Elasticsearch.DFRAfterEffect AfterEffect { get; set; } - [JsonInclude, JsonPropertyName("basic_model")] - public Elastic.Clients.Elasticsearch.DFRBasicModel BasicModel { get; set; } - [JsonInclude, JsonPropertyName("normalization")] - public Elastic.Clients.Elasticsearch.Normalization Normalization { get; set; } - - [JsonInclude, JsonPropertyName("type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.DFRAfterEffect afterEffect, Elastic.Clients.Elasticsearch.DFRBasicModel basicModel, Elastic.Clients.Elasticsearch.Normalization normalization) + { + AfterEffect = afterEffect; + BasicModel = basicModel; + Normalization = normalization; + } +#if NET7_0_OR_GREATER + public SettingsSimilarityDfr() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SettingsSimilarityDfr() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DFRAfterEffect AfterEffect { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DFRBasicModel BasicModel { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Normalization Normalization { get; set; } + public string Type => "DFR"; } -public sealed partial class SettingsSimilarityDfrDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityDfrDescriptor { - internal SettingsSimilarityDfrDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr Instance { get; init; } - public SettingsSimilarityDfrDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfrDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.DFRAfterEffect AfterEffectValue { get; set; } - private Elastic.Clients.Elasticsearch.DFRBasicModel BasicModelValue { get; set; } - private Elastic.Clients.Elasticsearch.Normalization NormalizationValue { get; set; } - - public SettingsSimilarityDfrDescriptor AfterEffect(Elastic.Clients.Elasticsearch.DFRAfterEffect afterEffect) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityDfrDescriptor() { - AfterEffectValue = afterEffect; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SettingsSimilarityDfrDescriptor BasicModel(Elastic.Clients.Elasticsearch.DFRBasicModel basicModel) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor AfterEffect(Elastic.Clients.Elasticsearch.DFRAfterEffect value) { - BasicModelValue = basicModel; - return Self; + Instance.AfterEffect = value; + return this; } - public SettingsSimilarityDfrDescriptor Normalization(Elastic.Clients.Elasticsearch.Normalization normalization) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor BasicModel(Elastic.Clients.Elasticsearch.DFRBasicModel value) { - NormalizationValue = normalization; - return Self; + Instance.BasicModel = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor Normalization(Elastic.Clients.Elasticsearch.Normalization value) { - writer.WriteStartObject(); - writer.WritePropertyName("after_effect"); - JsonSerializer.Serialize(writer, AfterEffectValue, options); - writer.WritePropertyName("basic_model"); - JsonSerializer.Serialize(writer, BasicModelValue, options); - writer.WritePropertyName("normalization"); - JsonSerializer.Serialize(writer, NormalizationValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("DFR"); - writer.WriteEndObject(); + Instance.Normalization = value; + return this; } - SettingsSimilarityDfr IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr Build(System.Action action) { - AfterEffect = AfterEffectValue, - BasicModel = BasicModelValue, - Normalization = NormalizationValue - }; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfrDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityDfr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityIb.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityIb.g.cs index 25a268377ea..dc8eeaf71d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityIb.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityIb.g.cs @@ -17,77 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityIb : ISettingsSimilarity +internal sealed partial class SettingsSimilarityIbConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDistribution = System.Text.Json.JsonEncodedText.Encode("distribution"); + private static readonly System.Text.Json.JsonEncodedText PropLambda = System.Text.Json.JsonEncodedText.Encode("lambda"); + private static readonly System.Text.Json.JsonEncodedText PropNormalization = System.Text.Json.JsonEncodedText.Encode("normalization"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDistribution = default; + LocalJsonValue propLambda = default; + LocalJsonValue propNormalization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDistribution.TryReadProperty(ref reader, options, PropDistribution, null)) + { + continue; + } + + if (propLambda.TryReadProperty(ref reader, options, PropLambda, null)) + { + continue; + } + + if (propNormalization.TryReadProperty(ref reader, options, PropNormalization, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Distribution = propDistribution.Value, + Lambda = propLambda.Value, + Normalization = propNormalization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDistribution, value.Distribution, null, null); + writer.WriteProperty(options, PropLambda, value.Lambda, null, null); + writer.WriteProperty(options, PropNormalization, value.Normalization, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbConverter))] +public sealed partial class SettingsSimilarityIb : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity { - [JsonInclude, JsonPropertyName("distribution")] - public Elastic.Clients.Elasticsearch.IBDistribution Distribution { get; set; } - [JsonInclude, JsonPropertyName("lambda")] - public Elastic.Clients.Elasticsearch.IBLambda Lambda { get; set; } - [JsonInclude, JsonPropertyName("normalization")] - public Elastic.Clients.Elasticsearch.Normalization Normalization { get; set; } - - [JsonInclude, JsonPropertyName("type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityIb(Elastic.Clients.Elasticsearch.IBDistribution distribution, Elastic.Clients.Elasticsearch.IBLambda lambda, Elastic.Clients.Elasticsearch.Normalization normalization) + { + Distribution = distribution; + Lambda = lambda; + Normalization = normalization; + } +#if NET7_0_OR_GREATER + public SettingsSimilarityIb() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SettingsSimilarityIb() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityIb(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IBDistribution Distribution { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IBLambda Lambda { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Normalization Normalization { get; set; } + public string Type => "IB"; } -public sealed partial class SettingsSimilarityIbDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityIbDescriptor { - internal SettingsSimilarityIbDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb Instance { get; init; } - public SettingsSimilarityIbDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityIbDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IBDistribution DistributionValue { get; set; } - private Elastic.Clients.Elasticsearch.IBLambda LambdaValue { get; set; } - private Elastic.Clients.Elasticsearch.Normalization NormalizationValue { get; set; } - - public SettingsSimilarityIbDescriptor Distribution(Elastic.Clients.Elasticsearch.IBDistribution distribution) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityIbDescriptor() { - DistributionValue = distribution; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SettingsSimilarityIbDescriptor Lambda(Elastic.Clients.Elasticsearch.IBLambda lambda) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor Distribution(Elastic.Clients.Elasticsearch.IBDistribution value) { - LambdaValue = lambda; - return Self; + Instance.Distribution = value; + return this; } - public SettingsSimilarityIbDescriptor Normalization(Elastic.Clients.Elasticsearch.Normalization normalization) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor Lambda(Elastic.Clients.Elasticsearch.IBLambda value) { - NormalizationValue = normalization; - return Self; + Instance.Lambda = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor Normalization(Elastic.Clients.Elasticsearch.Normalization value) { - writer.WriteStartObject(); - writer.WritePropertyName("distribution"); - JsonSerializer.Serialize(writer, DistributionValue, options); - writer.WritePropertyName("lambda"); - JsonSerializer.Serialize(writer, LambdaValue, options); - writer.WritePropertyName("normalization"); - JsonSerializer.Serialize(writer, NormalizationValue, options); - writer.WritePropertyName("type"); - writer.WriteStringValue("IB"); - writer.WriteEndObject(); + Instance.Normalization = value; + return this; } - SettingsSimilarityIb IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb Build(System.Action action) { - Distribution = DistributionValue, - Lambda = LambdaValue, - Normalization = NormalizationValue - }; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIbDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityIb(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmd.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmd.g.cs index 758aea7ad7e..4cb166acf32 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmd.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmd.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityLmd : ISettingsSimilarity +internal sealed partial class SettingsSimilarityLmdConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMu = System.Text.Json.JsonEncodedText.Encode("mu"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMu = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMu.TryReadProperty(ref reader, options, PropMu, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mu = propMu.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMu, value.Mu, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdConverter))] +public sealed partial class SettingsSimilarityLmd : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity { - [JsonInclude, JsonPropertyName("mu")] +#if NET7_0_OR_GREATER + public SettingsSimilarityLmd() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsSimilarityLmd() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Mu { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "LMDirichlet"; } -public sealed partial class SettingsSimilarityLmdDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityLmdDescriptor { - internal SettingsSimilarityLmdDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityLmdDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd instance) + { + Instance = instance; + } - public SettingsSimilarityLmdDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityLmdDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? MuValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor descriptor) => descriptor.Instance; - public SettingsSimilarityLmdDescriptor Mu(double? mu) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor Mu(double? value) { - MuValue = mu; - return Self; + Instance.Mu = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd Build(System.Action? action) { - writer.WriteStartObject(); - if (MuValue.HasValue) + if (action is null) { - writer.WritePropertyName("mu"); - writer.WriteNumberValue(MuValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("LMDirichlet"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmdDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmd(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SettingsSimilarityLmd IBuildableDescriptor.Build() => new() - { - Mu = MuValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmj.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmj.g.cs index e152f81886e..856168c7031 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmj.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityLmj.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityLmj : ISettingsSimilarity +internal sealed partial class SettingsSimilarityLmjConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLambda = System.Text.Json.JsonEncodedText.Encode("lambda"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLambda = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLambda.TryReadProperty(ref reader, options, PropLambda, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lambda = propLambda.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLambda, value.Lambda, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjConverter))] +public sealed partial class SettingsSimilarityLmj : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity { - [JsonInclude, JsonPropertyName("lambda")] +#if NET7_0_OR_GREATER + public SettingsSimilarityLmj() + { + } +#endif +#if !NET7_0_OR_GREATER + public SettingsSimilarityLmj() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Lambda { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "LMJelinekMercer"; } -public sealed partial class SettingsSimilarityLmjDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SettingsSimilarityLmjDescriptor { - internal SettingsSimilarityLmjDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityLmjDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj instance) + { + Instance = instance; + } - public SettingsSimilarityLmjDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityLmjDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? LambdaValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor descriptor) => descriptor.Instance; - public SettingsSimilarityLmjDescriptor Lambda(double? lambda) + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor Lambda(double? value) { - LambdaValue = lambda; - return Self; + Instance.Lambda = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj Build(System.Action? action) { - writer.WriteStartObject(); - if (LambdaValue.HasValue) + if (action is null) { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(LambdaValue.Value); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("LMJelinekMercer"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmjDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityLmj(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SettingsSimilarityLmj IBuildableDescriptor.Build() => new() - { - Lambda = LambdaValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityScripted.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityScripted.g.cs index 0cf4d8f103d..47a81075eec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityScripted.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SettingsSimilarityScripted.g.cs @@ -17,182 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public sealed partial class SettingsSimilarityScripted : ISettingsSimilarity +internal sealed partial class SettingsSimilarityScriptedConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropWeightScript = System.Text.Json.JsonEncodedText.Encode("weight_script"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "scripted"; + public override Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + LocalJsonValue propWeightScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("weight_script")] - public Elastic.Clients.Elasticsearch.Script? WeightScript { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class SettingsSimilarityScriptedDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal SettingsSimilarityScriptedDescriptor(Action configure) => configure.Invoke(this); + if (propWeightScript.TryReadProperty(ref reader, options, PropWeightScript, null)) + { + continue; + } - public SettingsSimilarityScriptedDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Script? WeightScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor WeightScriptDescriptor { get; set; } - private Action WeightScriptDescriptorAction { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public SettingsSimilarityScriptedDescriptor Script(Elastic.Clients.Elasticsearch.Script script) - { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value, + WeightScript = propWeightScript.Value + }; } - public SettingsSimilarityScriptedDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted value, System.Text.Json.JsonSerializerOptions options) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropWeightScript, value.WeightScript, null, null); + writer.WriteEndObject(); } +} - public SettingsSimilarityScriptedDescriptor Script(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedConverter))] +public sealed partial class SettingsSimilarityScripted : Elastic.Clients.Elasticsearch.IndexManagement.ISettingsSimilarity +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.Script script) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Script = script; } - - public SettingsSimilarityScriptedDescriptor WeightScript(Elastic.Clients.Elasticsearch.Script? weightScript) +#if NET7_0_OR_GREATER + public SettingsSimilarityScripted() { - WeightScriptDescriptor = null; - WeightScriptDescriptorAction = null; - WeightScriptValue = weightScript; - return Self; } - - public SettingsSimilarityScriptedDescriptor WeightScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SettingsSimilarityScripted() { - WeightScriptValue = null; - WeightScriptDescriptorAction = null; - WeightScriptDescriptor = descriptor; - return Self; } - - public SettingsSimilarityScriptedDescriptor WeightScript(Action configure) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - WeightScriptValue = null; - WeightScriptDescriptor = null; - WeightScriptDescriptorAction = configure; - return Self; + _ = sentinel; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } - writer.WritePropertyName("type"); - writer.WriteStringValue("scripted"); - if (WeightScriptDescriptor is not null) - { - writer.WritePropertyName("weight_script"); - JsonSerializer.Serialize(writer, WeightScriptDescriptor, options); - } - else if (WeightScriptDescriptorAction is not null) - { - writer.WritePropertyName("weight_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(WeightScriptDescriptorAction), options); - } - else if (WeightScriptValue is not null) - { - writer.WritePropertyName("weight_script"); - JsonSerializer.Serialize(writer, WeightScriptValue, options); - } + public string Type => "scripted"; - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Script? WeightScript { get; set; } +} + +public readonly partial struct SettingsSimilarityScriptedDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityScriptedDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsSimilarityScriptedDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor descriptor) => descriptor.Instance; - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor Script(Elastic.Clients.Elasticsearch.Script value) + { + Instance.Script = value; + return this; + } - return null; + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - private Elastic.Clients.Elasticsearch.Script? BuildWeightScript() + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor Script(System.Action? action) { - if (WeightScriptValue is not null) - { - return WeightScriptValue; - } + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if ((object)WeightScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor WeightScript(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.WeightScript = value; + return this; + } - if (WeightScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(WeightScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor WeightScript() + { + Instance.WeightScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - return null; + public Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor WeightScript(System.Action? action) + { + Instance.WeightScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - SettingsSimilarityScripted IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted Build(System.Action action) { - Script = BuildScript(), - WeightScript = BuildWeightScript() - }; + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScriptedDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SettingsSimilarityScripted(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardCommit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardCommit.g.cs index 8d09ad5f3c9..0640223238f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardCommit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardCommit.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardCommitConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGeneration = System.Text.Json.JsonEncodedText.Encode("generation"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropNumDocs = System.Text.Json.JsonEncodedText.Encode("num_docs"); + private static readonly System.Text.Json.JsonEncodedText PropUserData = System.Text.Json.JsonEncodedText.Encode("user_data"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardCommit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGeneration = default; + LocalJsonValue propId = default; + LocalJsonValue propNumDocs = default; + LocalJsonValue> propUserData = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGeneration.TryReadProperty(ref reader, options, PropGeneration, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propNumDocs.TryReadProperty(ref reader, options, PropNumDocs, null)) + { + continue; + } + + if (propUserData.TryReadProperty(ref reader, options, PropUserData, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardCommit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Generation = propGeneration.Value, + Id = propId.Value, + NumDocs = propNumDocs.Value, + UserData = propUserData.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardCommit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGeneration, value.Generation, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropNumDocs, value.NumDocs, null, null); + writer.WriteProperty(options, PropUserData, value.UserData, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardCommitConverter))] public sealed partial class ShardCommit { - [JsonInclude, JsonPropertyName("generation")] - public int Generation { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("num_docs")] - public long NumDocs { get; init; } - [JsonInclude, JsonPropertyName("user_data")] - public IReadOnlyDictionary UserData { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardCommit(int generation, string id, long numDocs, System.Collections.Generic.IReadOnlyDictionary userData) + { + Generation = generation; + Id = id; + NumDocs = numDocs; + UserData = userData; + } +#if NET7_0_OR_GREATER + public ShardCommit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardCommit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardCommit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Generation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NumDocs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary UserData { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardFileSizeInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardFileSizeInfo.g.cs index 430290e4f24..5e7a2ea4680 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardFileSizeInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardFileSizeInfo.g.cs @@ -17,28 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardFileSizeInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAverageSizeInBytes = System.Text.Json.JsonEncodedText.Encode("average_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSizeInBytes = System.Text.Json.JsonEncodedText.Encode("max_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMinSizeInBytes = System.Text.Json.JsonEncodedText.Encode("min_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardFileSizeInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAverageSizeInBytes = default; + LocalJsonValue propCount = default; + LocalJsonValue propDescription = default; + LocalJsonValue propMaxSizeInBytes = default; + LocalJsonValue propMinSizeInBytes = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAverageSizeInBytes.TryReadProperty(ref reader, options, PropAverageSizeInBytes, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propMaxSizeInBytes.TryReadProperty(ref reader, options, PropMaxSizeInBytes, null)) + { + continue; + } + + if (propMinSizeInBytes.TryReadProperty(ref reader, options, PropMinSizeInBytes, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardFileSizeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AverageSizeInBytes = propAverageSizeInBytes.Value, + Count = propCount.Value, + Description = propDescription.Value, + MaxSizeInBytes = propMaxSizeInBytes.Value, + MinSizeInBytes = propMinSizeInBytes.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardFileSizeInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAverageSizeInBytes, value.AverageSizeInBytes, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropMaxSizeInBytes, value.MaxSizeInBytes, null, null); + writer.WriteProperty(options, PropMinSizeInBytes, value.MinSizeInBytes, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardFileSizeInfoConverter))] public sealed partial class ShardFileSizeInfo { - [JsonInclude, JsonPropertyName("average_size_in_bytes")] - public long? AverageSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("max_size_in_bytes")] - public long? MaxSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("min_size_in_bytes")] - public long? MinSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardFileSizeInfo(string description, long sizeInBytes) + { + Description = description; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public ShardFileSizeInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardFileSizeInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardFileSizeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? AverageSizeInBytes { get; set; } + public long? Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public long? MaxSizeInBytes { get; set; } + public long? MinSizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardLease.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardLease.g.cs index 35f6bbf2607..e8918d4fce0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardLease.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardLease.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardLeaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropRetainingSeqNo = System.Text.Json.JsonEncodedText.Encode("retaining_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardLease Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propRetainingSeqNo = default; + LocalJsonValue propSource = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propRetainingSeqNo.TryReadProperty(ref reader, options, PropRetainingSeqNo, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + RetainingSeqNo = propRetainingSeqNo.Value, + Source = propSource.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardLease value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropRetainingSeqNo, value.RetainingSeqNo, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardLeaseConverter))] public sealed partial class ShardLease { - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("retaining_seq_no")] - public long RetainingSeqNo { get; init; } - [JsonInclude, JsonPropertyName("source")] - public string Source { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardLease(string id, long retainingSeqNo, string source, long timestamp) + { + Id = id; + RetainingSeqNo = retainingSeqNo; + Source = source; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public ShardLease() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardLease() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardLease(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RetainingSeqNo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardPath.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardPath.g.cs index 2155b760511..647ccde0693 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardPath.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardPath.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardPathConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataPath = System.Text.Json.JsonEncodedText.Encode("data_path"); + private static readonly System.Text.Json.JsonEncodedText PropIsCustomDataPath = System.Text.Json.JsonEncodedText.Encode("is_custom_data_path"); + private static readonly System.Text.Json.JsonEncodedText PropStatePath = System.Text.Json.JsonEncodedText.Encode("state_path"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardPath Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDataPath = default; + LocalJsonValue propIsCustomDataPath = default; + LocalJsonValue propStatePath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataPath.TryReadProperty(ref reader, options, PropDataPath, null)) + { + continue; + } + + if (propIsCustomDataPath.TryReadProperty(ref reader, options, PropIsCustomDataPath, null)) + { + continue; + } + + if (propStatePath.TryReadProperty(ref reader, options, PropStatePath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardPath(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataPath = propDataPath.Value, + IsCustomDataPath = propIsCustomDataPath.Value, + StatePath = propStatePath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardPath value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataPath, value.DataPath, null, null); + writer.WriteProperty(options, PropIsCustomDataPath, value.IsCustomDataPath, null, null); + writer.WriteProperty(options, PropStatePath, value.StatePath, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardPathConverter))] public sealed partial class ShardPath { - [JsonInclude, JsonPropertyName("data_path")] - public string DataPath { get; init; } - [JsonInclude, JsonPropertyName("is_custom_data_path")] - public bool IsCustomDataPath { get; init; } - [JsonInclude, JsonPropertyName("state_path")] - public string StatePath { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardPath(string dataPath, bool isCustomDataPath, string statePath) + { + DataPath = dataPath; + IsCustomDataPath = isCustomDataPath; + StatePath = statePath; + } +#if NET7_0_OR_GREATER + public ShardPath() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardPath() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardPath(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string DataPath { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsCustomDataPath { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string StatePath { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardQueryCache.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardQueryCache.g.cs index a10cd7c8280..789e9c5593a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardQueryCache.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardQueryCache.g.cs @@ -17,30 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardQueryCacheConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheCount = System.Text.Json.JsonEncodedText.Encode("cache_count"); + private static readonly System.Text.Json.JsonEncodedText PropCacheSize = System.Text.Json.JsonEncodedText.Encode("cache_size"); + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropHitCount = System.Text.Json.JsonEncodedText.Encode("hit_count"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySizeInBytes = System.Text.Json.JsonEncodedText.Encode("memory_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMissCount = System.Text.Json.JsonEncodedText.Encode("miss_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCount = System.Text.Json.JsonEncodedText.Encode("total_count"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCache Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheCount = default; + LocalJsonValue propCacheSize = default; + LocalJsonValue propEvictions = default; + LocalJsonValue propHitCount = default; + LocalJsonValue propMemorySizeInBytes = default; + LocalJsonValue propMissCount = default; + LocalJsonValue propTotalCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheCount.TryReadProperty(ref reader, options, PropCacheCount, null)) + { + continue; + } + + if (propCacheSize.TryReadProperty(ref reader, options, PropCacheSize, null)) + { + continue; + } + + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propHitCount.TryReadProperty(ref reader, options, PropHitCount, null)) + { + continue; + } + + if (propMemorySizeInBytes.TryReadProperty(ref reader, options, PropMemorySizeInBytes, null)) + { + continue; + } + + if (propMissCount.TryReadProperty(ref reader, options, PropMissCount, null)) + { + continue; + } + + if (propTotalCount.TryReadProperty(ref reader, options, PropTotalCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheCount = propCacheCount.Value, + CacheSize = propCacheSize.Value, + Evictions = propEvictions.Value, + HitCount = propHitCount.Value, + MemorySizeInBytes = propMemorySizeInBytes.Value, + MissCount = propMissCount.Value, + TotalCount = propTotalCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCache value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheCount, value.CacheCount, null, null); + writer.WriteProperty(options, PropCacheSize, value.CacheSize, null, null); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropHitCount, value.HitCount, null, null); + writer.WriteProperty(options, PropMemorySizeInBytes, value.MemorySizeInBytes, null, null); + writer.WriteProperty(options, PropMissCount, value.MissCount, null, null); + writer.WriteProperty(options, PropTotalCount, value.TotalCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCacheConverter))] public sealed partial class ShardQueryCache { - [JsonInclude, JsonPropertyName("cache_count")] - public long CacheCount { get; init; } - [JsonInclude, JsonPropertyName("cache_size")] - public long CacheSize { get; init; } - [JsonInclude, JsonPropertyName("evictions")] - public long Evictions { get; init; } - [JsonInclude, JsonPropertyName("hit_count")] - public long HitCount { get; init; } - [JsonInclude, JsonPropertyName("memory_size_in_bytes")] - public long MemorySizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("miss_count")] - public long MissCount { get; init; } - [JsonInclude, JsonPropertyName("total_count")] - public long TotalCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardQueryCache(long cacheCount, long cacheSize, long evictions, long hitCount, long memorySizeInBytes, long missCount, long totalCount) + { + CacheCount = cacheCount; + CacheSize = cacheSize; + Evictions = evictions; + HitCount = hitCount; + MemorySizeInBytes = memorySizeInBytes; + MissCount = missCount; + TotalCount = totalCount; + } +#if NET7_0_OR_GREATER + public ShardQueryCache() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardQueryCache() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardQueryCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long CacheCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CacheSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Evictions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long HitCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemorySizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MissCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRecovery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRecovery.g.cs index 6909feabb62..dade4f8957c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRecovery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRecovery.g.cs @@ -17,48 +17,279 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardRecoveryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropStage = System.Text.Json.JsonEncodedText.Encode("stage"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropStopTime = System.Text.Json.JsonEncodedText.Encode("stop_time"); + private static readonly System.Text.Json.JsonEncodedText PropStopTimeInMillis = System.Text.Json.JsonEncodedText.Encode("stop_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTarget = System.Text.Json.JsonEncodedText.Encode("target"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTranslog = System.Text.Json.JsonEncodedText.Encode("translog"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVerifyIndex = System.Text.Json.JsonEncodedText.Encode("verify_index"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardRecovery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propSource = default; + LocalJsonValue propStage = default; + LocalJsonValue propStart = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propStopTime = default; + LocalJsonValue propStopTimeInMillis = default; + LocalJsonValue propTarget = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + LocalJsonValue propTranslog = default; + LocalJsonValue propType = default; + LocalJsonValue propVerifyIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propStage.TryReadProperty(ref reader, options, PropStage, null)) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStopTime.TryReadProperty(ref reader, options, PropStopTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStopTimeInMillis.TryReadProperty(ref reader, options, PropStopTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTarget.TryReadProperty(ref reader, options, PropTarget, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTranslog.TryReadProperty(ref reader, options, PropTranslog, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propVerifyIndex.TryReadProperty(ref reader, options, PropVerifyIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Primary = propPrimary.Value, + Source = propSource.Value, + Stage = propStage.Value, + Start = propStart.Value, + StartTime = propStartTime.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + StopTime = propStopTime.Value, + StopTimeInMillis = propStopTimeInMillis.Value, + Target = propTarget.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value, + Translog = propTranslog.Value, + Type = propType.Value, + VerifyIndex = propVerifyIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardRecovery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropStage, value.Stage, null, null); + writer.WriteProperty(options, PropStart, value.Start, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStopTime, value.StopTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStopTimeInMillis, value.StopTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTarget, value.Target, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTranslog, value.Translog, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVerifyIndex, value.VerifyIndex, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRecoveryConverter))] public sealed partial class ShardRecovery { - [JsonInclude, JsonPropertyName("id")] - public long Id { get; init; } - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus Index { get; init; } - [JsonInclude, JsonPropertyName("primary")] - public bool Primary { get; init; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin Source { get; init; } - [JsonInclude, JsonPropertyName("stage")] - public string Stage { get; init; } - [JsonInclude, JsonPropertyName("start")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatus? Start { get; init; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("stop_time")] - public DateTimeOffset? StopTime { get; init; } - [JsonInclude, JsonPropertyName("stop_time_in_millis")] - public long? StopTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("target")] - public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin Target { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("translog")] - public Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus Translog { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } - [JsonInclude, JsonPropertyName("verify_index")] - public Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex VerifyIndex { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardRecovery(long id, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus index, bool primary, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin source, string stage, System.DateTimeOffset startTimeInMillis, Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin target, System.TimeSpan totalTimeInMillis, Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus translog, string type, Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex verifyIndex) + { + Id = id; + Index = index; + Primary = primary; + Source = source; + Stage = stage; + StartTimeInMillis = startTimeInMillis; + Target = target; + TotalTimeInMillis = totalTimeInMillis; + Translog = translog; + Type = type; + VerifyIndex = verifyIndex; + } +#if NET7_0_OR_GREATER + public ShardRecovery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardRecovery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardRecovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.RecoveryIndexStatus Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Primary { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Stage { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.RecoveryStartStatus? Start { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } + public System.DateTimeOffset? StopTime { get; set; } + public System.DateTimeOffset? StopTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.RecoveryOrigin Target { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus Translog { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex VerifyIndex { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRetentionLeases.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRetentionLeases.g.cs index 3ee107b7d2c..1895a0754cb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRetentionLeases.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRetentionLeases.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardRetentionLeasesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLeases = System.Text.Json.JsonEncodedText.Encode("leases"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeases Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propLeases = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLeases.TryReadProperty(ref reader, options, PropLeases, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Leases = propLeases.Value, + PrimaryTerm = propPrimaryTerm.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeases value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLeases, value.Leases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeasesConverter))] public sealed partial class ShardRetentionLeases { - [JsonInclude, JsonPropertyName("leases")] - public IReadOnlyCollection Leases { get; init; } - [JsonInclude, JsonPropertyName("primary_term")] - public long PrimaryTerm { get; init; } - [JsonInclude, JsonPropertyName("version")] - public long Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardRetentionLeases(System.Collections.Generic.IReadOnlyCollection leases, long primaryTerm, long version) + { + Leases = leases; + PrimaryTerm = primaryTerm; + Version = version; + } +#if NET7_0_OR_GREATER + public ShardRetentionLeases() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardRetentionLeases() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardRetentionLeases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Leases { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryTerm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRouting.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRouting.g.cs index 98939e39a15..448e3340c86 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRouting.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardRouting.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardRoutingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropRelocatingNode = System.Text.Json.JsonEncodedText.Encode("relocating_node"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNode = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propRelocatingNode = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propRelocatingNode.TryReadProperty(ref reader, options, PropRelocatingNode, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Node = propNode.Value, + Primary = propPrimary.Value, + RelocatingNode = propRelocatingNode.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropRelocatingNode, value.RelocatingNode, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingConverter))] public sealed partial class ShardRouting { - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("primary")] - public bool Primary { get; init; } - [JsonInclude, JsonPropertyName("relocating_node")] - public string? RelocatingNode { get; init; } - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState State { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardRouting(string node, bool primary, Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState state) + { + Node = node; + Primary = primary; + State = state; + } +#if NET7_0_OR_GREATER + public ShardRouting() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardRouting() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Primary { get; set; } + public string? RelocatingNode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState State { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSegmentRouting.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSegmentRouting.g.cs index 3a1d4589608..1cf71fee3e5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSegmentRouting.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSegmentRouting.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardSegmentRoutingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNode = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Node = propNode.Value, + Primary = propPrimary.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRoutingConverter))] public sealed partial class ShardSegmentRouting { - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("primary")] - public bool Primary { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string State { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardSegmentRouting(string node, bool primary, string state) + { + Node = node; + Primary = primary; + State = state; + } +#if NET7_0_OR_GREATER + public ShardSegmentRouting() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardSegmentRouting() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardSegmentRouting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Primary { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSequenceNumber.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSequenceNumber.g.cs index 7d571c4d163..2214f9f9e46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSequenceNumber.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardSequenceNumber.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardSequenceNumberConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGlobalCheckpoint = System.Text.Json.JsonEncodedText.Encode("global_checkpoint"); + private static readonly System.Text.Json.JsonEncodedText PropLocalCheckpoint = System.Text.Json.JsonEncodedText.Encode("local_checkpoint"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSeqNo = System.Text.Json.JsonEncodedText.Encode("max_seq_no"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumber Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGlobalCheckpoint = default; + LocalJsonValue propLocalCheckpoint = default; + LocalJsonValue propMaxSeqNo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGlobalCheckpoint.TryReadProperty(ref reader, options, PropGlobalCheckpoint, null)) + { + continue; + } + + if (propLocalCheckpoint.TryReadProperty(ref reader, options, PropLocalCheckpoint, null)) + { + continue; + } + + if (propMaxSeqNo.TryReadProperty(ref reader, options, PropMaxSeqNo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GlobalCheckpoint = propGlobalCheckpoint.Value, + LocalCheckpoint = propLocalCheckpoint.Value, + MaxSeqNo = propMaxSeqNo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumber value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGlobalCheckpoint, value.GlobalCheckpoint, null, null); + writer.WriteProperty(options, PropLocalCheckpoint, value.LocalCheckpoint, null, null); + writer.WriteProperty(options, PropMaxSeqNo, value.MaxSeqNo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumberConverter))] public sealed partial class ShardSequenceNumber { - [JsonInclude, JsonPropertyName("global_checkpoint")] - public long GlobalCheckpoint { get; init; } - [JsonInclude, JsonPropertyName("local_checkpoint")] - public long LocalCheckpoint { get; init; } - [JsonInclude, JsonPropertyName("max_seq_no")] - public long MaxSeqNo { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardSequenceNumber(long globalCheckpoint, long localCheckpoint, long maxSeqNo) + { + GlobalCheckpoint = globalCheckpoint; + LocalCheckpoint = localCheckpoint; + MaxSeqNo = maxSeqNo; + } +#if NET7_0_OR_GREATER + public ShardSequenceNumber() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardSequenceNumber() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardSequenceNumber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long GlobalCheckpoint { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LocalCheckpoint { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxSeqNo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStats.g.cs index 76c31252cf3..d46f7f5dd5e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStats.g.cs @@ -17,69 +17,319 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBulk = System.Text.Json.JsonEncodedText.Encode("bulk"); + private static readonly System.Text.Json.JsonEncodedText PropCommit = System.Text.Json.JsonEncodedText.Encode("commit"); + private static readonly System.Text.Json.JsonEncodedText PropCompletion = System.Text.Json.JsonEncodedText.Encode("completion"); + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropFlush = System.Text.Json.JsonEncodedText.Encode("flush"); + private static readonly System.Text.Json.JsonEncodedText PropGet = System.Text.Json.JsonEncodedText.Encode("get"); + private static readonly System.Text.Json.JsonEncodedText PropIndexing = System.Text.Json.JsonEncodedText.Encode("indexing"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropMerges = System.Text.Json.JsonEncodedText.Encode("merges"); + private static readonly System.Text.Json.JsonEncodedText PropQueryCache = System.Text.Json.JsonEncodedText.Encode("query_cache"); + private static readonly System.Text.Json.JsonEncodedText PropRecovery = System.Text.Json.JsonEncodedText.Encode("recovery"); + private static readonly System.Text.Json.JsonEncodedText PropRefresh = System.Text.Json.JsonEncodedText.Encode("refresh"); + private static readonly System.Text.Json.JsonEncodedText PropRequestCache = System.Text.Json.JsonEncodedText.Encode("request_cache"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionLeases = System.Text.Json.JsonEncodedText.Encode("retention_leases"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText PropSegments = System.Text.Json.JsonEncodedText.Encode("segments"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropShardPath = System.Text.Json.JsonEncodedText.Encode("shard_path"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropShardStats2 = System.Text.Json.JsonEncodedText.Encode("shard_stats"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropTranslog = System.Text.Json.JsonEncodedText.Encode("translog"); + private static readonly System.Text.Json.JsonEncodedText PropWarmer = System.Text.Json.JsonEncodedText.Encode("warmer"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBulk = default; + LocalJsonValue propCommit = default; + LocalJsonValue propCompletion = default; + LocalJsonValue propDocs = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propFlush = default; + LocalJsonValue propGet = default; + LocalJsonValue propIndexing = default; + LocalJsonValue propIndices = default; + LocalJsonValue propMappings = default; + LocalJsonValue propMerges = default; + LocalJsonValue propQueryCache = default; + LocalJsonValue propRecovery = default; + LocalJsonValue propRefresh = default; + LocalJsonValue propRequestCache = default; + LocalJsonValue propRetentionLeases = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSearch = default; + LocalJsonValue propSegments = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShardPath = default; + LocalJsonValue?> propShards = default; + LocalJsonValue propShardStats2 = default; + LocalJsonValue propStore = default; + LocalJsonValue propTranslog = default; + LocalJsonValue propWarmer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBulk.TryReadProperty(ref reader, options, PropBulk, null)) + { + continue; + } + + if (propCommit.TryReadProperty(ref reader, options, PropCommit, null)) + { + continue; + } + + if (propCompletion.TryReadProperty(ref reader, options, PropCompletion, null)) + { + continue; + } + + if (propDocs.TryReadProperty(ref reader, options, PropDocs, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propFlush.TryReadProperty(ref reader, options, PropFlush, null)) + { + continue; + } + + if (propGet.TryReadProperty(ref reader, options, PropGet, null)) + { + continue; + } + + if (propIndexing.TryReadProperty(ref reader, options, PropIndexing, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propMerges.TryReadProperty(ref reader, options, PropMerges, null)) + { + continue; + } + + if (propQueryCache.TryReadProperty(ref reader, options, PropQueryCache, null)) + { + continue; + } + + if (propRecovery.TryReadProperty(ref reader, options, PropRecovery, null)) + { + continue; + } + + if (propRefresh.TryReadProperty(ref reader, options, PropRefresh, null)) + { + continue; + } + + if (propRequestCache.TryReadProperty(ref reader, options, PropRequestCache, null)) + { + continue; + } + + if (propRetentionLeases.TryReadProperty(ref reader, options, PropRetentionLeases, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (propSegments.TryReadProperty(ref reader, options, PropSegments, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propShardPath.TryReadProperty(ref reader, options, PropShardPath, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propShardStats2.TryReadProperty(ref reader, options, PropShardStats2, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propTranslog.TryReadProperty(ref reader, options, PropTranslog, null)) + { + continue; + } + + if (propWarmer.TryReadProperty(ref reader, options, PropWarmer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bulk = propBulk.Value, + Commit = propCommit.Value, + Completion = propCompletion.Value, + Docs = propDocs.Value, + Fielddata = propFielddata.Value, + Flush = propFlush.Value, + Get = propGet.Value, + Indexing = propIndexing.Value, + Indices = propIndices.Value, + Mappings = propMappings.Value, + Merges = propMerges.Value, + QueryCache = propQueryCache.Value, + Recovery = propRecovery.Value, + Refresh = propRefresh.Value, + RequestCache = propRequestCache.Value, + RetentionLeases = propRetentionLeases.Value, + Routing = propRouting.Value, + Search = propSearch.Value, + Segments = propSegments.Value, + SeqNo = propSeqNo.Value, + ShardPath = propShardPath.Value, + Shards = propShards.Value, + ShardStats2 = propShardStats2.Value, + Store = propStore.Value, + Translog = propTranslog.Value, + Warmer = propWarmer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBulk, value.Bulk, null, null); + writer.WriteProperty(options, PropCommit, value.Commit, null, null); + writer.WriteProperty(options, PropCompletion, value.Completion, null, null); + writer.WriteProperty(options, PropDocs, value.Docs, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropFlush, value.Flush, null, null); + writer.WriteProperty(options, PropGet, value.Get, null, null); + writer.WriteProperty(options, PropIndexing, value.Indexing, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropMerges, value.Merges, null, null); + writer.WriteProperty(options, PropQueryCache, value.QueryCache, null, null); + writer.WriteProperty(options, PropRecovery, value.Recovery, null, null); + writer.WriteProperty(options, PropRefresh, value.Refresh, null, null); + writer.WriteProperty(options, PropRequestCache, value.RequestCache, null, null); + writer.WriteProperty(options, PropRetentionLeases, value.RetentionLeases, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteProperty(options, PropSegments, value.Segments, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShardPath, value.ShardPath, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShardStats2, value.ShardStats2, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropTranslog, value.Translog, null, null); + writer.WriteProperty(options, PropWarmer, value.Warmer, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStatsConverter))] public sealed partial class ShardStats { - [JsonInclude, JsonPropertyName("bulk")] - public Elastic.Clients.Elasticsearch.BulkStats? Bulk { get; init; } - [JsonInclude, JsonPropertyName("commit")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardCommit? Commit { get; init; } - [JsonInclude, JsonPropertyName("completion")] - public Elastic.Clients.Elasticsearch.CompletionStats? Completion { get; init; } - [JsonInclude, JsonPropertyName("docs")] - public Elastic.Clients.Elasticsearch.DocStats? Docs { get; init; } - [JsonInclude, JsonPropertyName("fielddata")] - public Elastic.Clients.Elasticsearch.FielddataStats? Fielddata { get; init; } - [JsonInclude, JsonPropertyName("flush")] - public Elastic.Clients.Elasticsearch.FlushStats? Flush { get; init; } - [JsonInclude, JsonPropertyName("get")] - public Elastic.Clients.Elasticsearch.GetStats? Get { get; init; } - [JsonInclude, JsonPropertyName("indexing")] - public Elastic.Clients.Elasticsearch.IndexingStats? Indexing { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats? Indices { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.IndexManagement.MappingStats? Mappings { get; init; } - [JsonInclude, JsonPropertyName("merges")] - public Elastic.Clients.Elasticsearch.MergesStats? Merges { get; init; } - [JsonInclude, JsonPropertyName("query_cache")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCache? QueryCache { get; init; } - [JsonInclude, JsonPropertyName("recovery")] - public Elastic.Clients.Elasticsearch.RecoveryStats? Recovery { get; init; } - [JsonInclude, JsonPropertyName("refresh")] - public Elastic.Clients.Elasticsearch.RefreshStats? Refresh { get; init; } - [JsonInclude, JsonPropertyName("request_cache")] - public Elastic.Clients.Elasticsearch.RequestCacheStats? RequestCache { get; init; } - [JsonInclude, JsonPropertyName("retention_leases")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeases? RetentionLeases { get; init; } - [JsonInclude, JsonPropertyName("routing")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting? Routing { get; init; } - [JsonInclude, JsonPropertyName("search")] - public Elastic.Clients.Elasticsearch.SearchStats? Search { get; init; } - [JsonInclude, JsonPropertyName("segments")] - public Elastic.Clients.Elasticsearch.SegmentsStats? Segments { get; init; } - [JsonInclude, JsonPropertyName("seq_no")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumber? SeqNo { get; init; } - [JsonInclude, JsonPropertyName("shard_path")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardPath? ShardPath { get; init; } - [JsonInclude, JsonPropertyName("shards")] - [ReadOnlyIndexNameDictionaryConverter(typeof(object))] - public IReadOnlyDictionary? Shards { get; init; } - [JsonInclude, JsonPropertyName("shard_stats")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats? ShardStats2 { get; init; } - [JsonInclude, JsonPropertyName("store")] - public Elastic.Clients.Elasticsearch.StoreStats? Store { get; init; } - [JsonInclude, JsonPropertyName("translog")] - public Elastic.Clients.Elasticsearch.TranslogStats? Translog { get; init; } - [JsonInclude, JsonPropertyName("warmer")] - public Elastic.Clients.Elasticsearch.WarmerStats? Warmer { get; init; } +#if NET7_0_OR_GREATER + public ShardStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShardStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.BulkStats? Bulk { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardCommit? Commit { get; set; } + public Elastic.Clients.Elasticsearch.CompletionStats? Completion { get; set; } + public Elastic.Clients.Elasticsearch.DocStats? Docs { get; set; } + public Elastic.Clients.Elasticsearch.FielddataStats? Fielddata { get; set; } + public Elastic.Clients.Elasticsearch.FlushStats? Flush { get; set; } + public Elastic.Clients.Elasticsearch.GetStats? Get { get; set; } + public Elastic.Clients.Elasticsearch.IndexingStats? Indexing { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndicesStats? Indices { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.MappingStats? Mappings { get; set; } + public Elastic.Clients.Elasticsearch.MergesStats? Merges { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardQueryCache? QueryCache { get; set; } + public Elastic.Clients.Elasticsearch.RecoveryStats? Recovery { get; set; } + public Elastic.Clients.Elasticsearch.RefreshStats? Refresh { get; set; } + public Elastic.Clients.Elasticsearch.RequestCacheStats? RequestCache { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardRetentionLeases? RetentionLeases { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting? Routing { get; set; } + public Elastic.Clients.Elasticsearch.SearchStats? Search { get; set; } + public Elastic.Clients.Elasticsearch.SegmentsStats? Segments { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardSequenceNumber? SeqNo { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardPath? ShardPath { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Shards { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats? ShardStats2 { get; set; } + public Elastic.Clients.Elasticsearch.StoreStats? Store { get; set; } + public Elastic.Clients.Elasticsearch.TranslogStats? Translog { get; set; } + public Elastic.Clients.Elasticsearch.WarmerStats? Warmer { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStore.g.cs index 45555b85e60..39a766f3349 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStore.g.cs @@ -17,71 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; -internal sealed partial class ShardStoreConverter : JsonConverter +internal sealed partial class ShardStoreConverter : System.Text.Json.Serialization.JsonConverter { - public override ShardStore Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAllocation = System.Text.Json.JsonEncodedText.Encode("allocation"); + private static readonly System.Text.Json.JsonEncodedText PropAllocationId = System.Text.Json.JsonEncodedText.Encode("allocation_id"); + private static readonly System.Text.Json.JsonEncodedText PropStoreException = System.Text.Json.JsonEncodedText.Encode("store_exception"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation allocation = default; - string? allocationId = default; - Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException? storeException = default; - string nodeId = default; - Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode node = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocation = default; + LocalJsonValue propAllocationId = default; + LocalJsonValue propNode = default; + LocalJsonValue propNodeId = default; + LocalJsonValue propStoreException = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAllocation.TryReadProperty(ref reader, options, PropAllocation, null)) { - var property = reader.GetString(); - if (property == "allocation") - { - allocation = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "allocation_id") - { - allocationId = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; + } - if (property == "store_exception") - { - storeException = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propAllocationId.TryReadProperty(ref reader, options, PropAllocationId, null)) + { + continue; + } - nodeId = property; - reader.Read(); - node = JsonSerializer.Deserialize(ref reader, options); + if (propStoreException.TryReadProperty(ref reader, options, PropStoreException, null)) + { + continue; } + + propNodeId.Initialized = propNode.Initialized = true; + reader.ReadProperty(options, out propNodeId.Value, out propNode.Value, null, null); } - return new ShardStore { Allocation = allocation, AllocationId = allocationId, Node = node, NodeId = nodeId, StoreException = storeException }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Allocation = propAllocation.Value, + AllocationId = propAllocationId.Value, + Node = propNode.Value, + NodeId = propNodeId.Value, + StoreException = propStoreException.Value + }; } - public override void Write(Utf8JsonWriter writer, ShardStore value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStore value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'ShardStore' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocation, value.Allocation, null, null); + writer.WriteProperty(options, PropAllocationId, value.AllocationId, null, null); + writer.WriteProperty(options, PropStoreException, value.StoreException, null, null); + writer.WriteProperty(options, value.NodeId, value.Node, null, null); + writer.WriteEndObject(); } } -[JsonConverter(typeof(ShardStoreConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreConverter))] public sealed partial class ShardStore { - public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation Allocation { get; init; } - public string? AllocationId { get; init; } - public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode Node { get; init; } - public string NodeId { get; init; } - public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException? StoreException { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStore(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation allocation, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode node, string nodeId) + { + Allocation = allocation; + Node = node; + NodeId = nodeId; + } +#if NET7_0_OR_GREATER + public ShardStore() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreAllocation Allocation { get; set; } + public string? AllocationId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException? StoreException { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreException.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreException.g.cs index 9c8d5237ae0..25f5613bf04 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreException.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreException.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardStoreExceptionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReason = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Reason = propReason.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreException value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreExceptionConverter))] public sealed partial class ShardStoreException { - [JsonInclude, JsonPropertyName("reason")] - public string Reason { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoreException(string reason, string type) + { + Reason = reason; + Type = type; + } +#if NET7_0_OR_GREATER + public ShardStoreException() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStoreException() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoreException(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreNode.g.cs index e7f3a201ea9..5cbd7e9cdab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreNode.g.cs @@ -17,28 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardStoreNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropExternalId = System.Text.Json.JsonEncodedText.Encode("external_id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propExternalId = default; + LocalJsonValue propName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propExternalId.TryReadProperty(ref reader, options, PropExternalId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + ExternalId = propExternalId.Value, + Name = propName.Value, + Roles = propRoles.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropExternalId, value.ExternalId, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreNodeConverter))] public sealed partial class ShardStoreNode { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string? EphemeralId { get; init; } - [JsonInclude, JsonPropertyName("external_id")] - public string? ExternalId { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoreNode(System.Collections.Generic.IReadOnlyDictionary attributes, string name, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress) + { + Attributes = attributes; + Name = name; + Roles = roles; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public ShardStoreNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStoreNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoreNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public string? EphemeralId { get; set; } + public string? ExternalId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreWrapper.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreWrapper.g.cs index 5e03fbbad98..eeea1d3353d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreWrapper.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardStoreWrapper.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardStoreWrapperConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStores = System.Text.Json.JsonEncodedText.Encode("stores"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreWrapper Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propStores = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStores.TryReadProperty(ref reader, options, PropStores, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreWrapper(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stores = propStores.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreWrapper value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStores, value.Stores, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardStoreWrapperConverter))] public sealed partial class ShardStoreWrapper { - [JsonInclude, JsonPropertyName("stores")] - public IReadOnlyCollection Stores { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStoreWrapper(System.Collections.Generic.IReadOnlyCollection stores) + { + Stores = stores; + } +#if NET7_0_OR_GREATER + public ShardStoreWrapper() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStoreWrapper() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStoreWrapper(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Stores { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsSegment.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsSegment.g.cs index 6cf6304fed2..38ec9f7b9ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsSegment.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsSegment.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardsSegmentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumCommittedSegments = System.Text.Json.JsonEncodedText.Encode("num_committed_segments"); + private static readonly System.Text.Json.JsonEncodedText PropNumSearchSegments = System.Text.Json.JsonEncodedText.Encode("num_search_segments"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropSegments = System.Text.Json.JsonEncodedText.Encode("segments"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardsSegment Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumCommittedSegments = default; + LocalJsonValue propNumSearchSegments = default; + LocalJsonValue propRouting = default; + LocalJsonValue> propSegments = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumCommittedSegments.TryReadProperty(ref reader, options, PropNumCommittedSegments, null)) + { + continue; + } + + if (propNumSearchSegments.TryReadProperty(ref reader, options, PropNumSearchSegments, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSegments.TryReadProperty(ref reader, options, PropSegments, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardsSegment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumCommittedSegments = propNumCommittedSegments.Value, + NumSearchSegments = propNumSearchSegments.Value, + Routing = propRouting.Value, + Segments = propSegments.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardsSegment value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumCommittedSegments, value.NumCommittedSegments, null, null); + writer.WriteProperty(options, PropNumSearchSegments, value.NumSearchSegments, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSegments, value.Segments, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardsSegmentConverter))] public sealed partial class ShardsSegment { - [JsonInclude, JsonPropertyName("num_committed_segments")] - public int NumCommittedSegments { get; init; } - [JsonInclude, JsonPropertyName("num_search_segments")] - public int NumSearchSegments { get; init; } - [JsonInclude, JsonPropertyName("routing")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting Routing { get; init; } - [JsonInclude, JsonPropertyName("segments")] - public IReadOnlyDictionary Segments { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsSegment(int numCommittedSegments, int numSearchSegments, Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting routing, System.Collections.Generic.IReadOnlyDictionary segments) + { + NumCommittedSegments = numCommittedSegments; + NumSearchSegments = numSearchSegments; + Routing = routing; + Segments = segments; + } +#if NET7_0_OR_GREATER + public ShardsSegment() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsSegment() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsSegment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int NumCommittedSegments { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumSearchSegments { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardSegmentRouting Routing { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Segments { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsStats.g.cs new file mode 100644 index 00000000000..7a763a67717 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsStats.g.cs @@ -0,0 +1,110 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class ShardsStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllFields = System.Text.Json.JsonEncodedText.Encode("all_fields"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardsStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllFields = default; + LocalJsonValue> propFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllFields.TryReadProperty(ref reader, options, PropAllFields, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllFields = propAllFields.Value, + Fields = propFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardsStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllFields, value.AllFields, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardsStatsConverter))] +public sealed partial class ShardsStats +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsStats(Elastic.Clients.Elasticsearch.IndexManagement.FieldSummary allFields, System.Collections.Generic.IReadOnlyDictionary fields) + { + AllFields = allFields; + Fields = fields; + } +#if NET7_0_OR_GREATER + public ShardsStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.FieldSummary AllFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Fields { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsTotalStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsTotalStats.g.cs index bf947d8f11b..485368e411c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsTotalStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/ShardsTotalStats.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class ShardsTotalStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTotalCount = System.Text.Json.JsonEncodedText.Encode("total_count"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTotalCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTotalCount.TryReadProperty(ref reader, options, PropTotalCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + TotalCount = propTotalCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTotalCount, value.TotalCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.ShardsTotalStatsConverter))] public sealed partial class ShardsTotalStats { - [JsonInclude, JsonPropertyName("total_count")] - public long TotalCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsTotalStats(long totalCount) + { + TotalCount = totalCount; + } +#if NET7_0_OR_GREATER + public ShardsTotalStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsTotalStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsTotalStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long TotalCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogSettings.g.cs index 8b90454f753..7d55de11501 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogSettings.g.cs @@ -17,122 +17,168 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SlowlogSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLevel = System.Text.Json.JsonEncodedText.Encode("level"); + private static readonly System.Text.Json.JsonEncodedText PropReformat = System.Text.Json.JsonEncodedText.Encode("reformat"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropThreshold = System.Text.Json.JsonEncodedText.Encode("threshold"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLevel = default; + LocalJsonValue propReformat = default; + LocalJsonValue propSource = default; + LocalJsonValue propThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLevel.TryReadProperty(ref reader, options, PropLevel, null)) + { + continue; + } + + if (propReformat.TryReadProperty(ref reader, options, PropReformat, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propThreshold.TryReadProperty(ref reader, options, PropThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Level = propLevel.Value, + Reformat = propReformat.Value, + Source = propSource.Value, + Threshold = propThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLevel, value.Level, null, null); + writer.WriteProperty(options, PropReformat, value.Reformat, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropThreshold, value.Threshold, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsConverter))] public sealed partial class SlowlogSettings { - [JsonInclude, JsonPropertyName("level")] +#if NET7_0_OR_GREATER + public SlowlogSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public SlowlogSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Level { get; set; } - [JsonInclude, JsonPropertyName("reformat")] public bool? Reformat { get; set; } - [JsonInclude, JsonPropertyName("source")] public int? Source { get; set; } - [JsonInclude, JsonPropertyName("threshold")] public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds? Threshold { get; set; } } -public sealed partial class SlowlogSettingsDescriptor : SerializableDescriptor +public readonly partial struct SlowlogSettingsDescriptor { - internal SlowlogSettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings Instance { get; init; } - public SlowlogSettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings instance) { + Instance = instance; } - private string? LevelValue { get; set; } - private bool? ReformatValue { get; set; } - private int? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds? ThresholdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor ThresholdDescriptor { get; set; } - private Action ThresholdDescriptorAction { get; set; } - - public SlowlogSettingsDescriptor Level(string? level) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogSettingsDescriptor() { - LevelValue = level; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SlowlogSettingsDescriptor Reformat(bool? reformat = true) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Level(string? value) { - ReformatValue = reformat; - return Self; + Instance.Level = value; + return this; } - public SlowlogSettingsDescriptor Source(int? source) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Reformat(bool? value = true) { - SourceValue = source; - return Self; + Instance.Reformat = value; + return this; } - public SlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds? threshold) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Source(int? value) { - ThresholdDescriptor = null; - ThresholdDescriptorAction = null; - ThresholdValue = threshold; - return Self; + Instance.Source = value; + return this; } - public SlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Threshold(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds? value) { - ThresholdValue = null; - ThresholdDescriptorAction = null; - ThresholdDescriptor = descriptor; - return Self; + Instance.Threshold = value; + return this; } - public SlowlogSettingsDescriptor Threshold(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Threshold() { - ThresholdValue = null; - ThresholdDescriptor = null; - ThresholdDescriptorAction = configure; - return Self; + Instance.Threshold = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor Threshold(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(LevelValue)) - { - writer.WritePropertyName("level"); - writer.WriteStringValue(LevelValue); - } - - if (ReformatValue.HasValue) - { - writer.WritePropertyName("reformat"); - writer.WriteBooleanValue(ReformatValue.Value); - } - - if (SourceValue.HasValue) - { - writer.WritePropertyName("source"); - writer.WriteNumberValue(SourceValue.Value); - } + Instance.Threshold = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor.Build(action); + return this; + } - if (ThresholdDescriptor is not null) - { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, ThresholdDescriptor, options); - } - else if (ThresholdDescriptorAction is not null) - { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor(ThresholdDescriptorAction), options); - } - else if (ThresholdValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("threshold"); - JsonSerializer.Serialize(writer, ThresholdValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettingsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholdLevels.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholdLevels.g.cs index 366828d9fa2..1db1213edf8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholdLevels.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholdLevels.g.cs @@ -17,92 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SlowlogTresholdLevelsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDebug = System.Text.Json.JsonEncodedText.Encode("debug"); + private static readonly System.Text.Json.JsonEncodedText PropInfo = System.Text.Json.JsonEncodedText.Encode("info"); + private static readonly System.Text.Json.JsonEncodedText PropTrace = System.Text.Json.JsonEncodedText.Encode("trace"); + private static readonly System.Text.Json.JsonEncodedText PropWarn = System.Text.Json.JsonEncodedText.Encode("warn"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDebug = default; + LocalJsonValue propInfo = default; + LocalJsonValue propTrace = default; + LocalJsonValue propWarn = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDebug.TryReadProperty(ref reader, options, PropDebug, null)) + { + continue; + } + + if (propInfo.TryReadProperty(ref reader, options, PropInfo, null)) + { + continue; + } + + if (propTrace.TryReadProperty(ref reader, options, PropTrace, null)) + { + continue; + } + + if (propWarn.TryReadProperty(ref reader, options, PropWarn, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Debug = propDebug.Value, + Info = propInfo.Value, + Trace = propTrace.Value, + Warn = propWarn.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDebug, value.Debug, null, null); + writer.WriteProperty(options, PropInfo, value.Info, null, null); + writer.WriteProperty(options, PropTrace, value.Trace, null, null); + writer.WriteProperty(options, PropWarn, value.Warn, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsConverter))] public sealed partial class SlowlogTresholdLevels { - [JsonInclude, JsonPropertyName("debug")] +#if NET7_0_OR_GREATER + public SlowlogTresholdLevels() + { + } +#endif +#if !NET7_0_OR_GREATER + public SlowlogTresholdLevels() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Duration? Debug { get; set; } - [JsonInclude, JsonPropertyName("info")] public Elastic.Clients.Elasticsearch.Duration? Info { get; set; } - [JsonInclude, JsonPropertyName("trace")] public Elastic.Clients.Elasticsearch.Duration? Trace { get; set; } - [JsonInclude, JsonPropertyName("warn")] public Elastic.Clients.Elasticsearch.Duration? Warn { get; set; } } -public sealed partial class SlowlogTresholdLevelsDescriptor : SerializableDescriptor +public readonly partial struct SlowlogTresholdLevelsDescriptor { - internal SlowlogTresholdLevelsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels Instance { get; init; } - public SlowlogTresholdLevelsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogTresholdLevelsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? DebugValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? InfoValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TraceValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? WarnValue { get; set; } - - public SlowlogTresholdLevelsDescriptor Debug(Elastic.Clients.Elasticsearch.Duration? debug) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogTresholdLevelsDescriptor() { - DebugValue = debug; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SlowlogTresholdLevelsDescriptor Info(Elastic.Clients.Elasticsearch.Duration? info) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor Debug(Elastic.Clients.Elasticsearch.Duration? value) { - InfoValue = info; - return Self; + Instance.Debug = value; + return this; } - public SlowlogTresholdLevelsDescriptor Trace(Elastic.Clients.Elasticsearch.Duration? trace) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor Info(Elastic.Clients.Elasticsearch.Duration? value) { - TraceValue = trace; - return Self; + Instance.Info = value; + return this; } - public SlowlogTresholdLevelsDescriptor Warn(Elastic.Clients.Elasticsearch.Duration? warn) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor Trace(Elastic.Clients.Elasticsearch.Duration? value) { - WarnValue = warn; - return Self; + Instance.Trace = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor Warn(Elastic.Clients.Elasticsearch.Duration? value) { - writer.WriteStartObject(); - if (DebugValue is not null) - { - writer.WritePropertyName("debug"); - JsonSerializer.Serialize(writer, DebugValue, options); - } - - if (InfoValue is not null) - { - writer.WritePropertyName("info"); - JsonSerializer.Serialize(writer, InfoValue, options); - } - - if (TraceValue is not null) - { - writer.WritePropertyName("trace"); - JsonSerializer.Serialize(writer, TraceValue, options); - } + Instance.Warn = value; + return this; + } - if (WarnValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("warn"); - JsonSerializer.Serialize(writer, WarnValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholds.g.cs index a470ccab3e6..f35c8bac0d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SlowlogTresholds.g.cs @@ -17,122 +17,148 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SlowlogTresholdsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFetch = System.Text.Json.JsonEncodedText.Encode("fetch"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFetch = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFetch.TryReadProperty(ref reader, options, PropFetch, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fetch = propFetch.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFetch, value.Fetch, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsConverter))] public sealed partial class SlowlogTresholds { - [JsonInclude, JsonPropertyName("fetch")] +#if NET7_0_OR_GREATER + public SlowlogTresholds() + { + } +#endif +#if !NET7_0_OR_GREATER + public SlowlogTresholds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? Fetch { get; set; } - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? Query { get; set; } } -public sealed partial class SlowlogTresholdsDescriptor : SerializableDescriptor +public readonly partial struct SlowlogTresholdsDescriptor { - internal SlowlogTresholdsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds Instance { get; init; } - public SlowlogTresholdsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogTresholdsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? FetchValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor FetchDescriptor { get; set; } - private Action FetchDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - - public SlowlogTresholdsDescriptor Fetch(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? fetch) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlowlogTresholdsDescriptor() { - FetchDescriptor = null; - FetchDescriptorAction = null; - FetchValue = fetch; - return Self; + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SlowlogTresholdsDescriptor Fetch(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Fetch(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? value) { - FetchValue = null; - FetchDescriptorAction = null; - FetchDescriptor = descriptor; - return Self; + Instance.Fetch = value; + return this; } - public SlowlogTresholdsDescriptor Fetch(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Fetch() { - FetchValue = null; - FetchDescriptor = null; - FetchDescriptorAction = configure; - return Self; + Instance.Fetch = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(null); + return this; } - public SlowlogTresholdsDescriptor Query(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? query) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Fetch(System.Action? action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Fetch = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(action); + return this; } - public SlowlogTresholdsDescriptor Query(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Query(Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevels? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public SlowlogTresholdsDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Query() { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor Query(System.Action? action) { - writer.WriteStartObject(); - if (FetchDescriptor is not null) - { - writer.WritePropertyName("fetch"); - JsonSerializer.Serialize(writer, FetchDescriptor, options); - } - else if (FetchDescriptorAction is not null) - { - writer.WritePropertyName("fetch"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(FetchDescriptorAction), options); - } - else if (FetchValue is not null) - { - writer.WritePropertyName("fetch"); - JsonSerializer.Serialize(writer, FetchValue, options); - } + Instance.Query = Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor.Build(action); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdLevelsDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholdsDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SlowlogTresholds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SoftDeletes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SoftDeletes.g.cs index 9f4ba2342ab..4cbf0f2ef4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SoftDeletes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SoftDeletes.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class SoftDeletesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionLease = System.Text.Json.JsonEncodedText.Encode("retention_lease"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propRetentionLease = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propRetentionLease.TryReadProperty(ref reader, options, PropRetentionLease, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + RetentionLease = propRetentionLease.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropRetentionLease, value.RetentionLease, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesConverter))] public sealed partial class SoftDeletes { +#if NET7_0_OR_GREATER + public SoftDeletes() + { + } +#endif +#if !NET7_0_OR_GREATER + public SoftDeletes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SoftDeletes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Indicates whether soft deletes are enabled on the index. /// /// - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } /// @@ -45,32 +105,37 @@ public sealed partial class SoftDeletes /// process will fail due to incomplete history on the leader. /// /// - [JsonInclude, JsonPropertyName("retention_lease")] public Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease? RetentionLease { get; set; } } -public sealed partial class SoftDeletesDescriptor : SerializableDescriptor +public readonly partial struct SoftDeletesDescriptor { - internal SoftDeletesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes Instance { get; init; } - public SoftDeletesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SoftDeletesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes instance) { + Instance = instance; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease? RetentionLeaseValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor RetentionLeaseDescriptor { get; set; } - private Action RetentionLeaseDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SoftDeletesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes(Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor descriptor) => descriptor.Instance; /// /// /// Indicates whether soft deletes are enabled on the index. /// /// - public SoftDeletesDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } /// @@ -81,55 +146,36 @@ public SoftDeletesDescriptor Enabled(bool? enabled = true) /// process will fail due to incomplete history on the leader. /// /// - public SoftDeletesDescriptor RetentionLease(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease? retentionLease) + public Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor RetentionLease(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLease? value) { - RetentionLeaseDescriptor = null; - RetentionLeaseDescriptorAction = null; - RetentionLeaseValue = retentionLease; - return Self; + Instance.RetentionLease = value; + return this; } - public SoftDeletesDescriptor RetentionLease(Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor descriptor) - { - RetentionLeaseValue = null; - RetentionLeaseDescriptorAction = null; - RetentionLeaseDescriptor = descriptor; - return Self; - } - - public SoftDeletesDescriptor RetentionLease(Action configure) + /// + /// + /// The maximum period to retain a shard history retention lease before it is considered expired. + /// Shard history retention leases ensure that soft deletes are retained during merges on the Lucene + /// index. If a soft delete is merged away before it can be replicated to a follower the following + /// process will fail due to incomplete history on the leader. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor RetentionLease(System.Action action) { - RetentionLeaseValue = null; - RetentionLeaseDescriptor = null; - RetentionLeaseDescriptorAction = configure; - return Self; + Instance.RetentionLease = Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes Build(System.Action? action) { - writer.WriteStartObject(); - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (RetentionLeaseDescriptor is not null) - { - writer.WritePropertyName("retention_lease"); - JsonSerializer.Serialize(writer, RetentionLeaseDescriptor, options); - } - else if (RetentionLeaseDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("retention_lease"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.RetentionLeaseDescriptor(RetentionLeaseDescriptorAction), options); - } - else if (RetentionLeaseValue is not null) - { - writer.WritePropertyName("retention_lease"); - JsonSerializer.Serialize(writer, RetentionLeaseValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletesDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SoftDeletes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SourceIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SourceIndex.g.cs new file mode 100644 index 00000000000..c028f3fe60b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/SourceIndex.g.cs @@ -0,0 +1,129 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class SourceIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexConverter))] +public sealed partial class SourceIndex +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceIndex(Elastic.Clients.Elasticsearch.IndexName index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public SourceIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SourceIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SourceIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } +} + +public readonly partial struct SourceIndexDescriptor +{ + internal Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceIndexDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceIndexDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex instance) => new Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex(Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) + { + Instance.Index = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.SourceIndexDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.SourceIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusError.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusError.g.cs new file mode 100644 index 00000000000..b216e563d39 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusError.g.cs @@ -0,0 +1,110 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class StatusErrorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMessage = System.Text.Json.JsonEncodedText.Encode("message"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.StatusError Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propMessage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMessage.TryReadProperty(ref reader, options, PropMessage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.StatusError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Message = propMessage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.StatusError value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMessage, value.Message, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.StatusErrorConverter))] +public sealed partial class StatusError +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatusError(string index, string message) + { + Index = index; + Message = message; + } +#if NET7_0_OR_GREATER + public StatusError() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StatusError() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatusError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Message { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusInProgress.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusInProgress.g.cs new file mode 100644 index 00000000000..eddb592c27b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/StatusInProgress.g.cs @@ -0,0 +1,125 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class StatusInProgressConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropReindexedDocCount = System.Text.Json.JsonEncodedText.Encode("reindexed_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDocCount = System.Text.Json.JsonEncodedText.Encode("total_doc_count"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.StatusInProgress Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propReindexedDocCount = default; + LocalJsonValue propTotalDocCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propReindexedDocCount.TryReadProperty(ref reader, options, PropReindexedDocCount, null)) + { + continue; + } + + if (propTotalDocCount.TryReadProperty(ref reader, options, PropTotalDocCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.StatusInProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + ReindexedDocCount = propReindexedDocCount.Value, + TotalDocCount = propTotalDocCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.StatusInProgress value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropReindexedDocCount, value.ReindexedDocCount, null, null); + writer.WriteProperty(options, PropTotalDocCount, value.TotalDocCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.StatusInProgressConverter))] +public sealed partial class StatusInProgress +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StatusInProgress(string index, long reindexedDocCount, long totalDocCount) + { + Index = index; + ReindexedDocCount = reindexedDocCount; + TotalDocCount = totalDocCount; + } +#if NET7_0_OR_GREATER + public StatusInProgress() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StatusInProgress() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StatusInProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReindexedDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalDocCount { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Storage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Storage.g.cs index 91daa31894b..04c382c2c65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Storage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Storage.g.cs @@ -17,18 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class StorageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowMmap = System.Text.Json.JsonEncodedText.Encode("allow_mmap"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Storage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowMmap = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowMmap.TryReadProperty(ref reader, options, PropAllowMmap, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Storage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowMmap = propAllowMmap.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Storage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowMmap, value.AllowMmap, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.StorageConverter))] public sealed partial class Storage { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Storage(Elastic.Clients.Elasticsearch.IndexManagement.StorageType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public Storage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Storage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Storage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// You can restrict the use of the mmapfs and the related hybridfs store type via the setting node.store.allow_mmap. @@ -37,22 +104,32 @@ public sealed partial class Storage /// of memory maps so you need disable the ability to use memory-mapping. /// /// - [JsonInclude, JsonPropertyName("allow_mmap")] public bool? AllowMmap { get; set; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.IndexManagement.StorageType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.StorageType Type { get; set; } } -public sealed partial class StorageDescriptor : SerializableDescriptor +public readonly partial struct StorageDescriptor { - internal StorageDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Storage Instance { get; init; } - public StorageDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StorageDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Storage instance) { + Instance = instance; } - private bool? AllowMmapValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.StorageType TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StorageDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Storage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Storage instance) => new Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Storage(Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor descriptor) => descriptor.Instance; /// /// @@ -62,29 +139,23 @@ public StorageDescriptor() : base() /// of memory maps so you need disable the ability to use memory-mapping. /// /// - public StorageDescriptor AllowMmap(bool? allowMmap = true) + public Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor AllowMmap(bool? value = true) { - AllowMmapValue = allowMmap; - return Self; + Instance.AllowMmap = value; + return this; } - public StorageDescriptor Type(Elastic.Clients.Elasticsearch.IndexManagement.StorageType type) + public Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor Type(Elastic.Clients.Elasticsearch.IndexManagement.StorageType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Storage Build(System.Action action) { - writer.WriteStartObject(); - if (AllowMmapValue.HasValue) - { - writer.WritePropertyName("allow_mmap"); - writer.WriteBooleanValue(AllowMmapValue.Value); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.StorageDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Storage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Template.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Template.g.cs index fbbf7a1f103..9c2589e8d42 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Template.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Template.g.cs @@ -17,23 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TemplateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Template Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAliases = default; + LocalJsonValue propMappings = default; + LocalJsonValue propSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Template(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + Mappings = propMappings.Value, + Settings = propSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Template value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TemplateConverter))] public sealed partial class Template { - [JsonInclude, JsonPropertyName("aliases")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Alias))] - public IReadOnlyDictionary Aliases { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; init; } - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Settings { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Template(System.Collections.Generic.IReadOnlyDictionary aliases, Elastic.Clients.Elasticsearch.Mapping.TypeMapping mappings, Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings settings) + { + Aliases = aliases; + Mappings = mappings; + Settings = settings; + } +#if NET7_0_OR_GREATER + public Template() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Template() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Template(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Aliases { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings Settings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TemplateMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TemplateMapping.g.cs index a64d9721337..47e7f42d6eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TemplateMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TemplateMapping.g.cs @@ -17,29 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TemplateMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAliases = System.Text.Json.JsonEncodedText.Encode("aliases"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPatterns = System.Text.Json.JsonEncodedText.Encode("index_patterns"); + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TemplateMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAliases = default; + LocalJsonValue> propIndexPatterns = default; + LocalJsonValue propMappings = default; + LocalJsonValue propOrder = default; + LocalJsonValue> propSettings = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAliases.TryReadProperty(ref reader, options, PropAliases, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propIndexPatterns.TryReadProperty(ref reader, options, PropIndexPatterns, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMappings.TryReadProperty(ref reader, options, PropMappings, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.TemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aliases = propAliases.Value, + IndexPatterns = propIndexPatterns.Value, + Mappings = propMappings.Value, + Order = propOrder.Value, + Settings = propSettings.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TemplateMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAliases, value.Aliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIndexPatterns, value.IndexPatterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMappings, value.Mappings, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TemplateMappingConverter))] public sealed partial class TemplateMapping { - [JsonInclude, JsonPropertyName("aliases")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Alias))] - public IReadOnlyDictionary Aliases { get; init; } - [JsonInclude, JsonPropertyName("index_patterns")] - public IReadOnlyCollection IndexPatterns { get; init; } - [JsonInclude, JsonPropertyName("mappings")] - public Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; init; } - [JsonInclude, JsonPropertyName("order")] - public int Order { get; init; } - [JsonInclude, JsonPropertyName("settings")] - public IReadOnlyDictionary Settings { get; init; } - [JsonInclude, JsonPropertyName("version")] - public long? Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TemplateMapping(System.Collections.Generic.IReadOnlyDictionary aliases, System.Collections.Generic.IReadOnlyCollection indexPatterns, Elastic.Clients.Elasticsearch.Mapping.TypeMapping mappings, int order, System.Collections.Generic.IReadOnlyDictionary settings) + { + Aliases = aliases; + IndexPatterns = indexPatterns; + Mappings = mappings; + Order = order; + Settings = settings; + } +#if NET7_0_OR_GREATER + public TemplateMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TemplateMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TemplateMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Aliases { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection IndexPatterns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.TypeMapping Mappings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Order { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Settings { get; set; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TokenDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TokenDetail.g.cs index 4fa9f229093..d56d302da0a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TokenDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TokenDetail.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TokenDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TokenDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue> propTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.TokenDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Tokens = propTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TokenDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TokenDetailConverter))] public sealed partial class TokenDetail { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("tokens")] - public IReadOnlyCollection Tokens { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenDetail(string name, System.Collections.Generic.IReadOnlyCollection tokens) + { + Name = name; + Tokens = tokens; + } +#if NET7_0_OR_GREATER + public TokenDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TokenDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TokenDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Tokens { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Translog.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Translog.g.cs index e3fd1ff06c7..4a782c07ecd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Translog.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/Translog.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TranslogConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDurability = System.Text.Json.JsonEncodedText.Encode("durability"); + private static readonly System.Text.Json.JsonEncodedText PropFlushThresholdSize = System.Text.Json.JsonEncodedText.Encode("flush_threshold_size"); + private static readonly System.Text.Json.JsonEncodedText PropRetention = System.Text.Json.JsonEncodedText.Encode("retention"); + private static readonly System.Text.Json.JsonEncodedText PropSyncInterval = System.Text.Json.JsonEncodedText.Encode("sync_interval"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.Translog Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDurability = default; + LocalJsonValue propFlushThresholdSize = default; + LocalJsonValue propRetention = default; + LocalJsonValue propSyncInterval = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDurability.TryReadProperty(ref reader, options, PropDurability, null)) + { + continue; + } + + if (propFlushThresholdSize.TryReadProperty(ref reader, options, PropFlushThresholdSize, null)) + { + continue; + } + + if (propRetention.TryReadProperty(ref reader, options, PropRetention, null)) + { + continue; + } + + if (propSyncInterval.TryReadProperty(ref reader, options, PropSyncInterval, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.Translog(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Durability = propDurability.Value, + FlushThresholdSize = propFlushThresholdSize.Value, + Retention = propRetention.Value, + SyncInterval = propSyncInterval.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.Translog value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDurability, value.Durability, null, null); + writer.WriteProperty(options, PropFlushThresholdSize, value.FlushThresholdSize, null, null); + writer.WriteProperty(options, PropRetention, value.Retention, null, null); + writer.WriteProperty(options, PropSyncInterval, value.SyncInterval, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogConverter))] public sealed partial class Translog { +#if NET7_0_OR_GREATER + public Translog() + { + } +#endif +#if !NET7_0_OR_GREATER + public Translog() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Translog(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Whether or not to fsync and commit the translog after every index, delete, update, or bulk request. /// /// - [JsonInclude, JsonPropertyName("durability")] public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability? Durability { get; set; } /// @@ -46,9 +124,7 @@ public sealed partial class Translog /// maximum size has been reached a flush will happen, generating a new Lucene commit point. /// /// - [JsonInclude, JsonPropertyName("flush_threshold_size")] public Elastic.Clients.Elasticsearch.ByteSize? FlushThresholdSize { get; set; } - [JsonInclude, JsonPropertyName("retention")] public Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention? Retention { get; set; } /// @@ -57,34 +133,37 @@ public sealed partial class Translog /// Values less than 100ms are not allowed. /// /// - [JsonInclude, JsonPropertyName("sync_interval")] public Elastic.Clients.Elasticsearch.Duration? SyncInterval { get; set; } } -public sealed partial class TranslogDescriptor : SerializableDescriptor +public readonly partial struct TranslogDescriptor { - internal TranslogDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.Translog Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Translog instance) + { + Instance = instance; + } - public TranslogDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Translog(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability? DurabilityValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? FlushThresholdSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention? RetentionValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor RetentionDescriptor { get; set; } - private Action RetentionDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? SyncIntervalValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Translog instance) => new Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Translog(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor descriptor) => descriptor.Instance; /// /// /// Whether or not to fsync and commit the translog after every index, delete, update, or bulk request. /// /// - public TranslogDescriptor Durability(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability? durability) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor Durability(Elastic.Clients.Elasticsearch.IndexManagement.TranslogDurability? value) { - DurabilityValue = durability; - return Self; + Instance.Durability = value; + return this; } /// @@ -96,34 +175,43 @@ public TranslogDescriptor Durability(Elastic.Clients.Elasticsearch.IndexManageme /// maximum size has been reached a flush will happen, generating a new Lucene commit point. /// /// - public TranslogDescriptor FlushThresholdSize(Elastic.Clients.Elasticsearch.ByteSize? flushThresholdSize) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor FlushThresholdSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - FlushThresholdSizeValue = flushThresholdSize; - return Self; + Instance.FlushThresholdSize = value; + return this; } - public TranslogDescriptor Retention(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention? retention) + /// + /// + /// The translog stores all operations that are not yet safely persisted in Lucene (i.e., are not + /// part of a Lucene commit point). Although these operations are available for reads, they will need + /// to be replayed if the shard was stopped and had to be recovered. This setting controls the + /// maximum total size of these operations, to prevent recoveries from taking too long. Once the + /// maximum size has been reached a flush will happen, generating a new Lucene commit point. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor FlushThresholdSize(System.Func action) { - RetentionDescriptor = null; - RetentionDescriptorAction = null; - RetentionValue = retention; - return Self; + Instance.FlushThresholdSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public TranslogDescriptor Retention(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor descriptor) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor Retention(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention? value) { - RetentionValue = null; - RetentionDescriptorAction = null; - RetentionDescriptor = descriptor; - return Self; + Instance.Retention = value; + return this; } - public TranslogDescriptor Retention(Action configure) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor Retention() { - RetentionValue = null; - RetentionDescriptor = null; - RetentionDescriptorAction = configure; - return Self; + Instance.Retention = Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor Retention(System.Action? action) + { + Instance.Retention = Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor.Build(action); + return this; } /// @@ -132,49 +220,22 @@ public TranslogDescriptor Retention(Action /// - public TranslogDescriptor SyncInterval(Elastic.Clients.Elasticsearch.Duration? syncInterval) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor SyncInterval(Elastic.Clients.Elasticsearch.Duration? value) { - SyncIntervalValue = syncInterval; - return Self; + Instance.SyncInterval = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.Translog Build(System.Action? action) { - writer.WriteStartObject(); - if (DurabilityValue is not null) + if (action is null) { - writer.WritePropertyName("durability"); - JsonSerializer.Serialize(writer, DurabilityValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.Translog(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (FlushThresholdSizeValue is not null) - { - writer.WritePropertyName("flush_threshold_size"); - JsonSerializer.Serialize(writer, FlushThresholdSizeValue, options); - } - - if (RetentionDescriptor is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, RetentionDescriptor, options); - } - else if (RetentionDescriptorAction is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor(RetentionDescriptorAction), options); - } - else if (RetentionValue is not null) - { - writer.WritePropertyName("retention"); - JsonSerializer.Serialize(writer, RetentionValue, options); - } - - if (SyncIntervalValue is not null) - { - writer.WritePropertyName("sync_interval"); - JsonSerializer.Serialize(writer, SyncIntervalValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.TranslogDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Translog(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogRetention.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogRetention.g.cs index d454410965f..f49a8450849 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogRetention.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogRetention.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TranslogRetentionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAge = System.Text.Json.JsonEncodedText.Encode("age"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAge = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAge.TryReadProperty(ref reader, options, PropAge, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Age = propAge.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAge, value.Age, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionConverter))] public sealed partial class TranslogRetention { +#if NET7_0_OR_GREATER + public TranslogRetention() + { + } +#endif +#if !NET7_0_OR_GREATER + public TranslogRetention() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TranslogRetention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// This controls the maximum duration for which translog files are kept by each shard. Keeping more @@ -38,7 +99,6 @@ public sealed partial class TranslogRetention /// indices created in Elasticsearch versions 7.0.0 and later. /// /// - [JsonInclude, JsonPropertyName("age")] public Elastic.Clients.Elasticsearch.Duration? Age { get; set; } /// @@ -50,20 +110,27 @@ public sealed partial class TranslogRetention /// versions 7.0.0 and later. /// /// - [JsonInclude, JsonPropertyName("size")] public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } } -public sealed partial class TranslogRetentionDescriptor : SerializableDescriptor +public readonly partial struct TranslogRetentionDescriptor { - internal TranslogRetentionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention Instance { get; init; } - public TranslogRetentionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogRetentionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? AgeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogRetentionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention instance) => new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention(Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor descriptor) => descriptor.Instance; /// /// @@ -74,10 +141,10 @@ public TranslogRetentionDescriptor() : base() /// indices created in Elasticsearch versions 7.0.0 and later. /// /// - public TranslogRetentionDescriptor Age(Elastic.Clients.Elasticsearch.Duration? age) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor Age(Elastic.Clients.Elasticsearch.Duration? value) { - AgeValue = age; - return Self; + Instance.Age = value; + return this; } /// @@ -89,27 +156,37 @@ public TranslogRetentionDescriptor Age(Elastic.Clients.Elasticsearch.Duration? a /// versions 7.0.0 and later. /// /// - public TranslogRetentionDescriptor Size(Elastic.Clients.Elasticsearch.ByteSize? size) + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor Size(Elastic.Clients.Elasticsearch.ByteSize? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// This controls the total size of translog files to keep for each shard. Keeping more translog files increases + /// the chance of performing an operation based sync when recovering a replica. If the translog files are not + /// sufficient, replica recovery will fall back to a file based sync. This setting is ignored, and should not be + /// set, if soft deletes are enabled. Soft deletes are enabled by default in indices created in Elasticsearch + /// versions 7.0.0 and later. + /// + /// + public Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor Size(System.Func action) { - writer.WriteStartObject(); - if (AgeValue is not null) - { - writer.WritePropertyName("age"); - JsonSerializer.Serialize(writer, AgeValue, options); - } + Instance.Size = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (SizeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("size"); - JsonSerializer.Serialize(writer, SizeValue, options); + return new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetentionDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.TranslogRetention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogStatus.g.cs index d0a4adce47e..30509b0327b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TranslogStatus.g.cs @@ -17,28 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TranslogStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPercent = System.Text.Json.JsonEncodedText.Encode("percent"); + private static readonly System.Text.Json.JsonEncodedText PropRecovered = System.Text.Json.JsonEncodedText.Encode("recovered"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalOnStart = System.Text.Json.JsonEncodedText.Encode("total_on_start"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPercent = default; + LocalJsonValue propRecovered = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalOnStart = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPercent.TryReadProperty(ref reader, options, PropPercent, null)) + { + continue; + } + + if (propRecovered.TryReadProperty(ref reader, options, PropRecovered, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalOnStart.TryReadProperty(ref reader, options, PropTotalOnStart, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Percent = propPercent.Value, + Recovered = propRecovered.Value, + Total = propTotal.Value, + TotalOnStart = propTotalOnStart.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPercent, value.Percent, null, null); + writer.WriteProperty(options, PropRecovered, value.Recovered, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalOnStart, value.TotalOnStart, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TranslogStatusConverter))] public sealed partial class TranslogStatus { - [JsonInclude, JsonPropertyName("percent")] - public double Percent { get; init; } - [JsonInclude, JsonPropertyName("recovered")] - public long Recovered { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } - [JsonInclude, JsonPropertyName("total_on_start")] - public long TotalOnStart { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogStatus(Elastic.Clients.Elasticsearch.Percentage percent, long recovered, long total, long totalOnStart, System.TimeSpan totalTimeInMillis) + { + Percent = percent; + Recovered = recovered; + Total = total; + TotalOnStart = totalOnStart; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public TranslogStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TranslogStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TranslogStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Percentage Percent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Recovered { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalOnStart { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TypeFieldMappings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TypeFieldMappings.g.cs index c21918185ba..4f2a98944f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TypeFieldMappings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/TypeFieldMappings.g.cs @@ -17,19 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class TypeFieldMappingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMappings = System.Text.Json.JsonEncodedText.Encode("mappings"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.TypeFieldMappings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propMappings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMappings.TryReadProperty(ref reader, options, PropMappings, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.TypeFieldMappings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mappings = propMappings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.TypeFieldMappings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMappings, value.Mappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.TypeFieldMappingsConverter))] public sealed partial class TypeFieldMappings { - [JsonInclude, JsonPropertyName("mappings")] - [ReadOnlyFieldDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FieldMapping))] - public IReadOnlyDictionary Mappings { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeFieldMappings(System.Collections.Generic.IReadOnlyDictionary mappings) + { + Mappings = mappings; + } +#if NET7_0_OR_GREATER + public TypeFieldMappings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TypeFieldMappings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TypeFieldMappings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Mappings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsIndex.g.cs new file mode 100644 index 00000000000..6ff62f0dbc5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsIndex.g.cs @@ -0,0 +1,95 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class UsageStatsIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propShards = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsIndexConverter))] +public sealed partial class UsageStatsIndex +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UsageStatsIndex(System.Collections.Generic.IReadOnlyCollection shards) + { + Shards = shards; + } +#if NET7_0_OR_GREATER + public UsageStatsIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UsageStatsIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UsageStatsIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Shards { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsShards.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsShards.g.cs new file mode 100644 index 00000000000..87d0ab19022 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/UsageStatsShards.g.cs @@ -0,0 +1,140 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +internal sealed partial class UsageStatsShardsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropTrackingId = System.Text.Json.JsonEncodedText.Encode("tracking_id"); + private static readonly System.Text.Json.JsonEncodedText PropTrackingStartedAtMillis = System.Text.Json.JsonEncodedText.Encode("tracking_started_at_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsShards Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRouting = default; + LocalJsonValue propStats = default; + LocalJsonValue propTrackingId = default; + LocalJsonValue propTrackingStartedAtMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propTrackingId.TryReadProperty(ref reader, options, PropTrackingId, null)) + { + continue; + } + + if (propTrackingStartedAtMillis.TryReadProperty(ref reader, options, PropTrackingStartedAtMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsShards(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Routing = propRouting.Value, + Stats = propStats.Value, + TrackingId = propTrackingId.Value, + TrackingStartedAtMillis = propTrackingStartedAtMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsShards value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropTrackingId, value.TrackingId, null, null); + writer.WriteProperty(options, PropTrackingStartedAtMillis, value.TrackingStartedAtMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.UsageStatsShardsConverter))] +public sealed partial class UsageStatsShards +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UsageStatsShards(Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting routing, Elastic.Clients.Elasticsearch.IndexManagement.ShardsStats stats, string trackingId, System.DateTimeOffset trackingStartedAtMillis) + { + Routing = routing; + Stats = stats; + TrackingId = trackingId; + TrackingStartedAtMillis = trackingStartedAtMillis; + } +#if NET7_0_OR_GREATER + public UsageStatsShards() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UsageStatsShards() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UsageStatsShards(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardRouting Routing { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardsStats Stats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TrackingId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset TrackingStartedAtMillis { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/VerifyIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/VerifyIndex.g.cs index bccd66ad7b2..99cedeb8098 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/VerifyIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexManagement/VerifyIndex.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.IndexManagement; +internal sealed partial class VerifyIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCheckIndexTime = System.Text.Json.JsonEncodedText.Encode("check_index_time"); + private static readonly System.Text.Json.JsonEncodedText PropCheckIndexTimeInMillis = System.Text.Json.JsonEncodedText.Encode("check_index_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCheckIndexTime = default; + LocalJsonValue propCheckIndexTimeInMillis = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCheckIndexTime.TryReadProperty(ref reader, options, PropCheckIndexTime, null)) + { + continue; + } + + if (propCheckIndexTimeInMillis.TryReadProperty(ref reader, options, PropCheckIndexTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CheckIndexTime = propCheckIndexTime.Value, + CheckIndexTimeInMillis = propCheckIndexTimeInMillis.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCheckIndexTime, value.CheckIndexTime, null, null); + writer.WriteProperty(options, PropCheckIndexTimeInMillis, value.CheckIndexTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.VerifyIndexConverter))] public sealed partial class VerifyIndex { - [JsonInclude, JsonPropertyName("check_index_time")] - public Elastic.Clients.Elasticsearch.Duration? CheckIndexTime { get; init; } - [JsonInclude, JsonPropertyName("check_index_time_in_millis")] - public long CheckIndexTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VerifyIndex(System.TimeSpan checkIndexTimeInMillis, System.TimeSpan totalTimeInMillis) + { + CheckIndexTimeInMillis = checkIndexTimeInMillis; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public VerifyIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VerifyIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VerifyIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Duration? CheckIndexTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan CheckIndexTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexingStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexingStats.g.cs index 7169dd4581f..2f46463a582 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexingStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndexingStats.g.cs @@ -17,46 +17,264 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class IndexingStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeleteCurrent = System.Text.Json.JsonEncodedText.Encode("delete_current"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteTime = System.Text.Json.JsonEncodedText.Encode("delete_time"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteTimeInMillis = System.Text.Json.JsonEncodedText.Encode("delete_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteTotal = System.Text.Json.JsonEncodedText.Encode("delete_total"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCurrent = System.Text.Json.JsonEncodedText.Encode("index_current"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFailed = System.Text.Json.JsonEncodedText.Encode("index_failed"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTime = System.Text.Json.JsonEncodedText.Encode("index_time"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTimeInMillis = System.Text.Json.JsonEncodedText.Encode("index_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTotal = System.Text.Json.JsonEncodedText.Encode("index_total"); + private static readonly System.Text.Json.JsonEncodedText PropIsThrottled = System.Text.Json.JsonEncodedText.Encode("is_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropNoopUpdateTotal = System.Text.Json.JsonEncodedText.Encode("noop_update_total"); + private static readonly System.Text.Json.JsonEncodedText PropThrottleTime = System.Text.Json.JsonEncodedText.Encode("throttle_time"); + private static readonly System.Text.Json.JsonEncodedText PropThrottleTimeInMillis = System.Text.Json.JsonEncodedText.Encode("throttle_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTypes = System.Text.Json.JsonEncodedText.Encode("types"); + private static readonly System.Text.Json.JsonEncodedText PropWriteLoad = System.Text.Json.JsonEncodedText.Encode("write_load"); + + public override Elastic.Clients.Elasticsearch.IndexingStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeleteCurrent = default; + LocalJsonValue propDeleteTime = default; + LocalJsonValue propDeleteTimeInMillis = default; + LocalJsonValue propDeleteTotal = default; + LocalJsonValue propIndexCurrent = default; + LocalJsonValue propIndexFailed = default; + LocalJsonValue propIndexTime = default; + LocalJsonValue propIndexTimeInMillis = default; + LocalJsonValue propIndexTotal = default; + LocalJsonValue propIsThrottled = default; + LocalJsonValue propNoopUpdateTotal = default; + LocalJsonValue propThrottleTime = default; + LocalJsonValue propThrottleTimeInMillis = default; + LocalJsonValue?> propTypes = default; + LocalJsonValue propWriteLoad = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleteCurrent.TryReadProperty(ref reader, options, PropDeleteCurrent, null)) + { + continue; + } + + if (propDeleteTime.TryReadProperty(ref reader, options, PropDeleteTime, null)) + { + continue; + } + + if (propDeleteTimeInMillis.TryReadProperty(ref reader, options, PropDeleteTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propDeleteTotal.TryReadProperty(ref reader, options, PropDeleteTotal, null)) + { + continue; + } + + if (propIndexCurrent.TryReadProperty(ref reader, options, PropIndexCurrent, null)) + { + continue; + } + + if (propIndexFailed.TryReadProperty(ref reader, options, PropIndexFailed, null)) + { + continue; + } + + if (propIndexTime.TryReadProperty(ref reader, options, PropIndexTime, null)) + { + continue; + } + + if (propIndexTimeInMillis.TryReadProperty(ref reader, options, PropIndexTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propIndexTotal.TryReadProperty(ref reader, options, PropIndexTotal, null)) + { + continue; + } + + if (propIsThrottled.TryReadProperty(ref reader, options, PropIsThrottled, null)) + { + continue; + } + + if (propNoopUpdateTotal.TryReadProperty(ref reader, options, PropNoopUpdateTotal, null)) + { + continue; + } + + if (propThrottleTime.TryReadProperty(ref reader, options, PropThrottleTime, null)) + { + continue; + } + + if (propThrottleTimeInMillis.TryReadProperty(ref reader, options, PropThrottleTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTypes.TryReadProperty(ref reader, options, PropTypes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propWriteLoad.TryReadProperty(ref reader, options, PropWriteLoad, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndexingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeleteCurrent = propDeleteCurrent.Value, + DeleteTime = propDeleteTime.Value, + DeleteTimeInMillis = propDeleteTimeInMillis.Value, + DeleteTotal = propDeleteTotal.Value, + IndexCurrent = propIndexCurrent.Value, + IndexFailed = propIndexFailed.Value, + IndexTime = propIndexTime.Value, + IndexTimeInMillis = propIndexTimeInMillis.Value, + IndexTotal = propIndexTotal.Value, + IsThrottled = propIsThrottled.Value, + NoopUpdateTotal = propNoopUpdateTotal.Value, + ThrottleTime = propThrottleTime.Value, + ThrottleTimeInMillis = propThrottleTimeInMillis.Value, + Types = propTypes.Value, + WriteLoad = propWriteLoad.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndexingStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleteCurrent, value.DeleteCurrent, null, null); + writer.WriteProperty(options, PropDeleteTime, value.DeleteTime, null, null); + writer.WriteProperty(options, PropDeleteTimeInMillis, value.DeleteTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropDeleteTotal, value.DeleteTotal, null, null); + writer.WriteProperty(options, PropIndexCurrent, value.IndexCurrent, null, null); + writer.WriteProperty(options, PropIndexFailed, value.IndexFailed, null, null); + writer.WriteProperty(options, PropIndexTime, value.IndexTime, null, null); + writer.WriteProperty(options, PropIndexTimeInMillis, value.IndexTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropIndexTotal, value.IndexTotal, null, null); + writer.WriteProperty(options, PropIsThrottled, value.IsThrottled, null, null); + writer.WriteProperty(options, PropNoopUpdateTotal, value.NoopUpdateTotal, null, null); + writer.WriteProperty(options, PropThrottleTime, value.ThrottleTime, null, null); + writer.WriteProperty(options, PropThrottleTimeInMillis, value.ThrottleTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTypes, value.Types, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropWriteLoad, value.WriteLoad, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexingStatsConverter))] public sealed partial class IndexingStats { - [JsonInclude, JsonPropertyName("delete_current")] - public long DeleteCurrent { get; init; } - [JsonInclude, JsonPropertyName("delete_time")] - public Elastic.Clients.Elasticsearch.Duration? DeleteTime { get; init; } - [JsonInclude, JsonPropertyName("delete_time_in_millis")] - public long DeleteTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("delete_total")] - public long DeleteTotal { get; init; } - [JsonInclude, JsonPropertyName("index_current")] - public long IndexCurrent { get; init; } - [JsonInclude, JsonPropertyName("index_failed")] - public long IndexFailed { get; init; } - [JsonInclude, JsonPropertyName("index_time")] - public Elastic.Clients.Elasticsearch.Duration? IndexTime { get; init; } - [JsonInclude, JsonPropertyName("index_time_in_millis")] - public long IndexTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("index_total")] - public long IndexTotal { get; init; } - [JsonInclude, JsonPropertyName("is_throttled")] - public bool IsThrottled { get; init; } - [JsonInclude, JsonPropertyName("noop_update_total")] - public long NoopUpdateTotal { get; init; } - [JsonInclude, JsonPropertyName("throttle_time")] - public Elastic.Clients.Elasticsearch.Duration? ThrottleTime { get; init; } - [JsonInclude, JsonPropertyName("throttle_time_in_millis")] - public long ThrottleTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("types")] - public IReadOnlyDictionary? Types { get; init; } - [JsonInclude, JsonPropertyName("write_load")] - public double? WriteLoad { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexingStats(long deleteCurrent, System.TimeSpan deleteTimeInMillis, long deleteTotal, long indexCurrent, long indexFailed, System.TimeSpan indexTimeInMillis, long indexTotal, bool isThrottled, long noopUpdateTotal, System.TimeSpan throttleTimeInMillis) + { + DeleteCurrent = deleteCurrent; + DeleteTimeInMillis = deleteTimeInMillis; + DeleteTotal = deleteTotal; + IndexCurrent = indexCurrent; + IndexFailed = indexFailed; + IndexTimeInMillis = indexTimeInMillis; + IndexTotal = indexTotal; + IsThrottled = isThrottled; + NoopUpdateTotal = noopUpdateTotal; + ThrottleTimeInMillis = throttleTimeInMillis; + } +#if NET7_0_OR_GREATER + public IndexingStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexingStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DeleteCurrent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? DeleteTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan DeleteTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DeleteTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexCurrent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexFailed { get; set; } + public Elastic.Clients.Elasticsearch.Duration? IndexTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan IndexTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsThrottled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NoopUpdateTotal { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ThrottleTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ThrottleTimeInMillis { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Types { get; set; } + public double? WriteLoad { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndicesOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndicesOptions.g.cs index 39dafca28b2..60ee500d03e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndicesOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/IndicesOptions.g.cs @@ -17,24 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class IndicesOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowNoIndices = System.Text.Json.JsonEncodedText.Encode("allow_no_indices"); + private static readonly System.Text.Json.JsonEncodedText PropExpandWildcards = System.Text.Json.JsonEncodedText.Encode("expand_wildcards"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreThrottled = System.Text.Json.JsonEncodedText.Encode("ignore_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnavailable = System.Text.Json.JsonEncodedText.Encode("ignore_unavailable"); + + public override Elastic.Clients.Elasticsearch.IndicesOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowNoIndices = default; + LocalJsonValue?> propExpandWildcards = default; + LocalJsonValue propIgnoreThrottled = default; + LocalJsonValue propIgnoreUnavailable = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowNoIndices.TryReadProperty(ref reader, options, PropAllowNoIndices, null)) + { + continue; + } + + if (propExpandWildcards.TryReadProperty(ref reader, options, PropExpandWildcards, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreThrottled.TryReadProperty(ref reader, options, PropIgnoreThrottled, null)) + { + continue; + } + + if (propIgnoreUnavailable.TryReadProperty(ref reader, options, PropIgnoreUnavailable, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.IndicesOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowNoIndices = propAllowNoIndices.Value, + ExpandWildcards = propExpandWildcards.Value, + IgnoreThrottled = propIgnoreThrottled.Value, + IgnoreUnavailable = propIgnoreUnavailable.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.IndicesOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowNoIndices, value.AllowNoIndices, null, null); + writer.WriteProperty(options, PropExpandWildcards, value.ExpandWildcards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreThrottled, value.IgnoreThrottled, null, null); + writer.WriteProperty(options, PropIgnoreUnavailable, value.IgnoreUnavailable, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Controls how to deal with unavailable concrete indices (closed or missing), how wildcard expressions are expanded /// to actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndicesOptionsConverter))] public sealed partial class IndicesOptions { +#if NET7_0_OR_GREATER + public IndicesOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndicesOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If false, the request returns an error if any wildcard expression, index alias, or _all value targets only @@ -42,7 +121,6 @@ public sealed partial class IndicesOptions /// a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - [JsonInclude, JsonPropertyName("allow_no_indices")] public bool? AllowNoIndices { get; set; } /// @@ -52,16 +130,13 @@ public sealed partial class IndicesOptions /// such as open,hidden. /// /// - [JsonInclude, JsonPropertyName("expand_wildcards")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.ExpandWildcard))] - public ICollection? ExpandWildcards { get; set; } + public System.Collections.Generic.ICollection? ExpandWildcards { get; set; } /// /// /// If true, concrete, expanded or aliased indices are ignored when frozen. /// /// - [JsonInclude, JsonPropertyName("ignore_throttled")] public bool? IgnoreThrottled { get; set; } /// @@ -69,7 +144,6 @@ public sealed partial class IndicesOptions /// If true, missing or closed indices are not included in the response. /// /// - [JsonInclude, JsonPropertyName("ignore_unavailable")] public bool? IgnoreUnavailable { get; set; } } @@ -79,18 +153,24 @@ public sealed partial class IndicesOptions /// to actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices. /// /// -public sealed partial class IndicesOptionsDescriptor : SerializableDescriptor +public readonly partial struct IndicesOptionsDescriptor { - internal IndicesOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.IndicesOptions Instance { get; init; } - public IndicesOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesOptionsDescriptor(Elastic.Clients.Elasticsearch.IndicesOptions instance) { + Instance = instance; } - private bool? AllowNoIndicesValue { get; set; } - private ICollection? ExpandWildcardsValue { get; set; } - private bool? IgnoreThrottledValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.IndicesOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(Elastic.Clients.Elasticsearch.IndicesOptions instance) => new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) => descriptor.Instance; /// /// @@ -99,10 +179,23 @@ public IndicesOptionsDescriptor() : base() /// a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. /// /// - public IndicesOptionsDescriptor AllowNoIndices(bool? allowNoIndices = true) + public Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor AllowNoIndices(bool? value = true) + { + Instance.AllowNoIndices = value; + return this; + } + + /// + /// + /// Type of index that wildcard patterns can match. If the request can target data streams, this argument + /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + /// such as open,hidden. + /// + /// + public Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor ExpandWildcards(System.Collections.Generic.ICollection? value) { - AllowNoIndicesValue = allowNoIndices; - return Self; + Instance.ExpandWildcards = value; + return this; } /// @@ -112,10 +205,10 @@ public IndicesOptionsDescriptor AllowNoIndices(bool? allowNoIndices = true) /// such as open,hidden. /// /// - public IndicesOptionsDescriptor ExpandWildcards(ICollection? expandWildcards) + public Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor ExpandWildcards(params Elastic.Clients.Elasticsearch.ExpandWildcard[] values) { - ExpandWildcardsValue = expandWildcards; - return Self; + Instance.ExpandWildcards = [.. values]; + return this; } /// @@ -123,10 +216,10 @@ public IndicesOptionsDescriptor ExpandWildcards(ICollection /// - public IndicesOptionsDescriptor IgnoreThrottled(bool? ignoreThrottled = true) + public Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IgnoreThrottled(bool? value = true) { - IgnoreThrottledValue = ignoreThrottled; - return Self; + Instance.IgnoreThrottled = value; + return this; } /// @@ -134,39 +227,22 @@ public IndicesOptionsDescriptor IgnoreThrottled(bool? ignoreThrottled = true) /// If true, missing or closed indices are not included in the response. /// /// - public IndicesOptionsDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + public Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IgnoreUnavailable(bool? value = true) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.IgnoreUnavailable = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.IndicesOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (AllowNoIndicesValue.HasValue) - { - writer.WritePropertyName("allow_no_indices"); - writer.WriteBooleanValue(AllowNoIndicesValue.Value); - } - - if (ExpandWildcardsValue is not null) - { - writer.WritePropertyName("expand_wildcards"); - SingleOrManySerializationHelper.Serialize(ExpandWildcardsValue, writer, options); - } - - if (IgnoreThrottledValue.HasValue) - { - writer.WritePropertyName("ignore_throttled"); - writer.WriteBooleanValue(IgnoreThrottledValue.Value); - } - - if (IgnoreUnavailableValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); + return new Elastic.Clients.Elasticsearch.IndicesOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(new Elastic.Clients.Elasticsearch.IndicesOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AdaptiveAllocations.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AdaptiveAllocations.g.cs new file mode 100644 index 00000000000..f463f057cff --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AdaptiveAllocations.g.cs @@ -0,0 +1,194 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AdaptiveAllocationsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("max_number_of_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropMinNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("min_number_of_allocations"); + + public override Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propMaxNumberOfAllocations = default; + LocalJsonValue propMinNumberOfAllocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propMaxNumberOfAllocations.TryReadProperty(ref reader, options, PropMaxNumberOfAllocations, null)) + { + continue; + } + + if (propMinNumberOfAllocations.TryReadProperty(ref reader, options, PropMinNumberOfAllocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + MaxNumberOfAllocations = propMaxNumberOfAllocations.Value, + MinNumberOfAllocations = propMinNumberOfAllocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropMaxNumberOfAllocations, value.MaxNumberOfAllocations, null, null); + writer.WriteProperty(options, PropMinNumberOfAllocations, value.MinNumberOfAllocations, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsConverter))] +public sealed partial class AdaptiveAllocations +{ +#if NET7_0_OR_GREATER + public AdaptiveAllocations() + { + } +#endif +#if !NET7_0_OR_GREATER + public AdaptiveAllocations() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdaptiveAllocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Turn on adaptive_allocations. + /// + /// + public bool? Enabled { get; set; } + + /// + /// + /// The maximum number of allocations to scale to. + /// If set, it must be greater than or equal to min_number_of_allocations. + /// + /// + public int? MaxNumberOfAllocations { get; set; } + + /// + /// + /// The minimum number of allocations to scale to. + /// If set, it must be greater than or equal to 0. + /// If not defined, the deployment scales to 0. + /// + /// + public int? MinNumberOfAllocations { get; set; } +} + +public readonly partial struct AdaptiveAllocationsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdaptiveAllocationsDescriptor(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdaptiveAllocationsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations instance) => new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Turn on adaptive_allocations. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor Enabled(bool? value = true) + { + Instance.Enabled = value; + return this; + } + + /// + /// + /// The maximum number of allocations to scale to. + /// If set, it must be greater than or equal to min_number_of_allocations. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor MaxNumberOfAllocations(int? value) + { + Instance.MaxNumberOfAllocations = value; + return this; + } + + /// + /// + /// The minimum number of allocations to scale to. + /// If set, it must be greater than or equal to 0. + /// If not defined, the deployment scales to 0. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor MinNumberOfAllocations(int? value) + { + Instance.MinNumberOfAllocations = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudServiceSettings.g.cs new file mode 100644 index 00000000000..9c08fcc0740 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudServiceSettings.g.cs @@ -0,0 +1,394 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AlibabaCloudServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropServiceId = System.Text.Json.JsonEncodedText.Encode("service_id"); + private static readonly System.Text.Json.JsonEncodedText PropWorkspace = System.Text.Json.JsonEncodedText.Encode("workspace"); + + public override Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propHost = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propServiceId = default; + LocalJsonValue propWorkspace = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propServiceId.TryReadProperty(ref reader, options, PropServiceId, null)) + { + continue; + } + + if (propWorkspace.TryReadProperty(ref reader, options, PropWorkspace, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Host = propHost.Value, + RateLimit = propRateLimit.Value, + ServiceId = propServiceId.Value, + Workspace = propWorkspace.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropServiceId, value.ServiceId, null, null); + writer.WriteProperty(options, PropWorkspace, value.Workspace, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsConverter))] +public sealed partial class AlibabaCloudServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AlibabaCloudServiceSettings(string apiKey, string host, string serviceId, string workspace) + { + ApiKey = apiKey; + Host = host; + ServiceId = serviceId; + Workspace = workspace; + } +#if NET7_0_OR_GREATER + public AlibabaCloudServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AlibabaCloudServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AlibabaCloudServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key for the AlibabaCloud AI Search API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The name of the host address used for the inference task. + /// You can find the host address in the API keys section of the documentation. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Host { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from AlibabaCloud AI Search. + /// By default, the alibabacloud-ai-search service sets the number of requests allowed per minute to 1000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The name of the model service to use for the inference task. + /// The following service IDs are available for the completion task: + /// + /// + /// + /// + /// ops-qwen-turbo + /// + /// + /// + /// + /// qwen-turbo + /// + /// + /// + /// + /// qwen-plus + /// + /// + /// + /// + /// qwen-max ÷ qwen-max-longcontext + /// + /// + /// + /// + /// The following service ID is available for the rerank task: + /// + /// + /// + /// + /// ops-bge-reranker-larger + /// + /// + /// + /// + /// The following service ID is available for the sparse_embedding task: + /// + /// + /// + /// + /// ops-text-sparse-embedding-001 + /// + /// + /// + /// + /// The following service IDs are available for the text_embedding task: + /// + /// + /// ops-text-embedding-001 + /// ops-text-embedding-zh-001 + /// ops-text-embedding-en-001 + /// ops-text-embedding-002 + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ServiceId { get; set; } + + /// + /// + /// The name of the workspace used for the inference task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Workspace { get; set; } +} + +public readonly partial struct AlibabaCloudServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AlibabaCloudServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AlibabaCloudServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key for the AlibabaCloud AI Search API. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The name of the host address used for the inference task. + /// You can find the host address in the API keys section of the documentation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor Host(string value) + { + Instance.Host = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from AlibabaCloud AI Search. + /// By default, the alibabacloud-ai-search service sets the number of requests allowed per minute to 1000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from AlibabaCloud AI Search. + /// By default, the alibabacloud-ai-search service sets the number of requests allowed per minute to 1000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from AlibabaCloud AI Search. + /// By default, the alibabacloud-ai-search service sets the number of requests allowed per minute to 1000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The name of the model service to use for the inference task. + /// The following service IDs are available for the completion task: + /// + /// + /// + /// + /// ops-qwen-turbo + /// + /// + /// + /// + /// qwen-turbo + /// + /// + /// + /// + /// qwen-plus + /// + /// + /// + /// + /// qwen-max ÷ qwen-max-longcontext + /// + /// + /// + /// + /// The following service ID is available for the rerank task: + /// + /// + /// + /// + /// ops-bge-reranker-larger + /// + /// + /// + /// + /// The following service ID is available for the sparse_embedding task: + /// + /// + /// + /// + /// ops-text-sparse-embedding-001 + /// + /// + /// + /// + /// The following service IDs are available for the text_embedding task: + /// + /// + /// ops-text-embedding-001 + /// ops-text-embedding-zh-001 + /// ops-text-embedding-en-001 + /// ops-text-embedding-002 + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor ServiceId(string value) + { + Instance.ServiceId = value; + return this; + } + + /// + /// + /// The name of the workspace used for the inference task. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor Workspace(string value) + { + Instance.Workspace = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudTaskSettings.g.cs new file mode 100644 index 00000000000..94ae39fbb78 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AlibabaCloudTaskSettings.g.cs @@ -0,0 +1,189 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AlibabaCloudTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInputType = System.Text.Json.JsonEncodedText.Encode("input_type"); + private static readonly System.Text.Json.JsonEncodedText PropReturnToken = System.Text.Json.JsonEncodedText.Encode("return_token"); + + public override Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInputType = default; + LocalJsonValue propReturnToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInputType.TryReadProperty(ref reader, options, PropInputType, null)) + { + continue; + } + + if (propReturnToken.TryReadProperty(ref reader, options, PropReturnToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InputType = propInputType.Value, + ReturnToken = propReturnToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInputType, value.InputType, null, null); + writer.WriteProperty(options, PropReturnToken, value.ReturnToken, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsConverter))] +public sealed partial class AlibabaCloudTaskSettings +{ +#if NET7_0_OR_GREATER + public AlibabaCloudTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public AlibabaCloudTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a sparse_embedding or text_embedding task, specify the type of input passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// ingest for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + public string? InputType { get; set; } + + /// + /// + /// For a sparse_embedding task, it affects whether the token name will be returned in the response. + /// It defaults to false, which means only the token ID will be returned in the response. + /// + /// + public bool? ReturnToken { get; set; } +} + +public readonly partial struct AlibabaCloudTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AlibabaCloudTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AlibabaCloudTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a sparse_embedding or text_embedding task, specify the type of input passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// ingest for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor InputType(string? value) + { + Instance.InputType = value; + return this; + } + + /// + /// + /// For a sparse_embedding task, it affects whether the token name will be returned in the response. + /// It defaults to false, which means only the token ID will be returned in the response. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor ReturnToken(bool? value = true) + { + Instance.ReturnToken = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AlibabaCloudTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockServiceSettings.g.cs new file mode 100644 index 00000000000..0aa12dfb596 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockServiceSettings.g.cs @@ -0,0 +1,391 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AmazonBedrockServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccessKey = System.Text.Json.JsonEncodedText.Encode("access_key"); + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + private static readonly System.Text.Json.JsonEncodedText PropProvider = System.Text.Json.JsonEncodedText.Encode("provider"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropRegion = System.Text.Json.JsonEncodedText.Encode("region"); + private static readonly System.Text.Json.JsonEncodedText PropSecretKey = System.Text.Json.JsonEncodedText.Encode("secret_key"); + + public override Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccessKey = default; + LocalJsonValue propModel = default; + LocalJsonValue propProvider = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propRegion = default; + LocalJsonValue propSecretKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccessKey.TryReadProperty(ref reader, options, PropAccessKey, null)) + { + continue; + } + + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (propProvider.TryReadProperty(ref reader, options, PropProvider, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propRegion.TryReadProperty(ref reader, options, PropRegion, null)) + { + continue; + } + + if (propSecretKey.TryReadProperty(ref reader, options, PropSecretKey, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccessKey = propAccessKey.Value, + Model = propModel.Value, + Provider = propProvider.Value, + RateLimit = propRateLimit.Value, + Region = propRegion.Value, + SecretKey = propSecretKey.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccessKey, value.AccessKey, null, null); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteProperty(options, PropProvider, value.Provider, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropRegion, value.Region, null, null); + writer.WriteProperty(options, PropSecretKey, value.SecretKey, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsConverter))] +public sealed partial class AmazonBedrockServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AmazonBedrockServiceSettings(string accessKey, string model, string region, string secretKey) + { + AccessKey = accessKey; + Model = model; + Region = region; + SecretKey = secretKey; + } +#if NET7_0_OR_GREATER + public AmazonBedrockServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AmazonBedrockServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AmazonBedrockServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid AWS access key that has permissions to use Amazon Bedrock and access to models for inference requests. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string AccessKey { get; set; } + + /// + /// + /// The base model ID or an ARN to a custom model based on a foundational model. + /// The base model IDs can be found in the Amazon Bedrock documentation. + /// Note that the model ID must be available for the provider chosen and your IAM user must have access to the model. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Model { get; set; } + + /// + /// + /// The model provider for your deployment. + /// Note that some providers may support only certain task types. + /// Supported providers include: + /// + /// + /// + /// + /// amazontitan - available for text_embedding and completion task types + /// + /// + /// + /// + /// anthropic - available for completion task type only + /// + /// + /// + /// + /// ai21labs - available for completion task type only + /// + /// + /// + /// + /// cohere - available for text_embedding and completion task types + /// + /// + /// + /// + /// meta - available for completion task type only + /// + /// + /// + /// + /// mistral - available for completion task type only + /// + /// + /// + /// + public string? Provider { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The region that your model or ARN is deployed in. + /// The list of available regions per model can be found in the Amazon Bedrock documentation. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Region { get; set; } + + /// + /// + /// A valid AWS secret key that is paired with the access_key. + /// For informationg about creating and managing access and secret keys, refer to the AWS documentation. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string SecretKey { get; set; } +} + +public readonly partial struct AmazonBedrockServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AmazonBedrockServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AmazonBedrockServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid AWS access key that has permissions to use Amazon Bedrock and access to models for inference requests. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor AccessKey(string value) + { + Instance.AccessKey = value; + return this; + } + + /// + /// + /// The base model ID or an ARN to a custom model based on a foundational model. + /// The base model IDs can be found in the Amazon Bedrock documentation. + /// Note that the model ID must be available for the provider chosen and your IAM user must have access to the model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor Model(string value) + { + Instance.Model = value; + return this; + } + + /// + /// + /// The model provider for your deployment. + /// Note that some providers may support only certain task types. + /// Supported providers include: + /// + /// + /// + /// + /// amazontitan - available for text_embedding and completion task types + /// + /// + /// + /// + /// anthropic - available for completion task type only + /// + /// + /// + /// + /// ai21labs - available for completion task type only + /// + /// + /// + /// + /// cohere - available for text_embedding and completion task types + /// + /// + /// + /// + /// meta - available for completion task type only + /// + /// + /// + /// + /// mistral - available for completion task type only + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor Provider(string? value) + { + Instance.Provider = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The region that your model or ARN is deployed in. + /// The list of available regions per model can be found in the Amazon Bedrock documentation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor Region(string value) + { + Instance.Region = value; + return this; + } + + /// + /// + /// A valid AWS secret key that is paired with the access_key. + /// For informationg about creating and managing access and secret keys, refer to the AWS documentation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor SecretKey(string value) + { + Instance.SecretKey = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockTaskSettings.g.cs new file mode 100644 index 00000000000..3c3f1060d8c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AmazonBedrockTaskSettings.g.cs @@ -0,0 +1,227 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AmazonBedrockTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxNewTokens = System.Text.Json.JsonEncodedText.Encode("max_new_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropTemperature = System.Text.Json.JsonEncodedText.Encode("temperature"); + private static readonly System.Text.Json.JsonEncodedText PropTopK = System.Text.Json.JsonEncodedText.Encode("top_k"); + private static readonly System.Text.Json.JsonEncodedText PropTopP = System.Text.Json.JsonEncodedText.Encode("top_p"); + + public override Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxNewTokens = default; + LocalJsonValue propTemperature = default; + LocalJsonValue propTopK = default; + LocalJsonValue propTopP = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxNewTokens.TryReadProperty(ref reader, options, PropMaxNewTokens, null)) + { + continue; + } + + if (propTemperature.TryReadProperty(ref reader, options, PropTemperature, null)) + { + continue; + } + + if (propTopK.TryReadProperty(ref reader, options, PropTopK, null)) + { + continue; + } + + if (propTopP.TryReadProperty(ref reader, options, PropTopP, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxNewTokens = propMaxNewTokens.Value, + Temperature = propTemperature.Value, + TopK = propTopK.Value, + TopP = propTopP.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxNewTokens, value.MaxNewTokens, null, null); + writer.WriteProperty(options, PropTemperature, value.Temperature, null, null); + writer.WriteProperty(options, PropTopK, value.TopK, null, null); + writer.WriteProperty(options, PropTopP, value.TopP, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsConverter))] +public sealed partial class AmazonBedrockTaskSettings +{ +#if NET7_0_OR_GREATER + public AmazonBedrockTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public AmazonBedrockTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a completion task, it sets the maximum number for the output tokens to be generated. + /// + /// + public int? MaxNewTokens { get; set; } + + /// + /// + /// For a completion task, it is a number between 0.0 and 1.0 that controls the apparent creativity of the results. + /// At temperature 0.0 the model is most deterministic, at temperature 1.0 most random. + /// It should not be used if top_p or top_k is specified. + /// + /// + public float? Temperature { get; set; } + + /// + /// + /// For a completion task, it limits samples to the top-K most likely words, balancing coherence and variability. + /// It is only available for anthropic, cohere, and mistral providers. + /// It is an alternative to temperature; it should not be used if temperature is specified. + /// + /// + public float? TopK { get; set; } + + /// + /// + /// For a completion task, it is a number in the range of 0.0 to 1.0, to eliminate low-probability tokens. + /// Top-p uses nucleus sampling to select top tokens whose sum of likelihoods does not exceed a certain value, ensuring both variety and coherence. + /// It is an alternative to temperature; it should not be used if temperature is specified. + /// + /// + public float? TopP { get; set; } +} + +public readonly partial struct AmazonBedrockTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AmazonBedrockTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AmazonBedrockTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a completion task, it sets the maximum number for the output tokens to be generated. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor MaxNewTokens(int? value) + { + Instance.MaxNewTokens = value; + return this; + } + + /// + /// + /// For a completion task, it is a number between 0.0 and 1.0 that controls the apparent creativity of the results. + /// At temperature 0.0 the model is most deterministic, at temperature 1.0 most random. + /// It should not be used if top_p or top_k is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor Temperature(float? value) + { + Instance.Temperature = value; + return this; + } + + /// + /// + /// For a completion task, it limits samples to the top-K most likely words, balancing coherence and variability. + /// It is only available for anthropic, cohere, and mistral providers. + /// It is an alternative to temperature; it should not be used if temperature is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor TopK(float? value) + { + Instance.TopK = value; + return this; + } + + /// + /// + /// For a completion task, it is a number in the range of 0.0 to 1.0, to eliminate low-probability tokens. + /// Top-p uses nucleus sampling to select top tokens whose sum of likelihoods does not exceed a certain value, ensuring both variety and coherence. + /// It is an alternative to temperature; it should not be used if temperature is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor TopP(float? value) + { + Instance.TopP = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AmazonBedrockTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicServiceSettings.g.cs new file mode 100644 index 00000000000..82db6ae2258 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicServiceSettings.g.cs @@ -0,0 +1,226 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AnthropicServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + + public override Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propModelId = default; + LocalJsonValue propRateLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + ModelId = propModelId.Value, + RateLimit = propRateLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsConverter))] +public sealed partial class AnthropicServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicServiceSettings(string apiKey, string modelId) + { + ApiKey = apiKey; + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public AnthropicServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnthropicServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnthropicServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key for the Anthropic API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Anthropic documentation for the list of supported models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Anthropic. + /// By default, the anthropic service sets the number of requests allowed per minute to 50. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } +} + +public readonly partial struct AnthropicServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings(Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key for the Anthropic API. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Anthropic documentation for the list of supported models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Anthropic. + /// By default, the anthropic service sets the number of requests allowed per minute to 50. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Anthropic. + /// By default, the anthropic service sets the number of requests allowed per minute to 50. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Anthropic. + /// By default, the anthropic service sets the number of requests allowed per minute to 50. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AnthropicServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicTaskSettings.g.cs new file mode 100644 index 00000000000..3c0411af820 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AnthropicTaskSettings.g.cs @@ -0,0 +1,234 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AnthropicTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxTokens = System.Text.Json.JsonEncodedText.Encode("max_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropTemperature = System.Text.Json.JsonEncodedText.Encode("temperature"); + private static readonly System.Text.Json.JsonEncodedText PropTopK = System.Text.Json.JsonEncodedText.Encode("top_k"); + private static readonly System.Text.Json.JsonEncodedText PropTopP = System.Text.Json.JsonEncodedText.Encode("top_p"); + + public override Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxTokens = default; + LocalJsonValue propTemperature = default; + LocalJsonValue propTopK = default; + LocalJsonValue propTopP = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxTokens.TryReadProperty(ref reader, options, PropMaxTokens, null)) + { + continue; + } + + if (propTemperature.TryReadProperty(ref reader, options, PropTemperature, null)) + { + continue; + } + + if (propTopK.TryReadProperty(ref reader, options, PropTopK, null)) + { + continue; + } + + if (propTopP.TryReadProperty(ref reader, options, PropTopP, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxTokens = propMaxTokens.Value, + Temperature = propTemperature.Value, + TopK = propTopK.Value, + TopP = propTopP.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxTokens, value.MaxTokens, null, null); + writer.WriteProperty(options, PropTemperature, value.Temperature, null, null); + writer.WriteProperty(options, PropTopK, value.TopK, null, null); + writer.WriteProperty(options, PropTopP, value.TopP, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsConverter))] +public sealed partial class AnthropicTaskSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicTaskSettings(int maxTokens) + { + MaxTokens = maxTokens; + } +#if NET7_0_OR_GREATER + public AnthropicTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnthropicTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnthropicTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a completion task, it is the maximum number of tokens to generate before stopping. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int MaxTokens { get; set; } + + /// + /// + /// For a completion task, it is the amount of randomness injected into the response. + /// For more details about the supported range, refer to Anthropic documentation. + /// + /// + public float? Temperature { get; set; } + + /// + /// + /// For a completion task, it specifies to only sample from the top K options for each subsequent token. + /// It is recommended for advanced use cases only. + /// You usually only need to use temperature. + /// + /// + public int? TopK { get; set; } + + /// + /// + /// For a completion task, it specifies to use Anthropic's nucleus sampling. + /// In nucleus sampling, Anthropic computes the cumulative distribution over all the options for each subsequent token in decreasing probability order and cuts it off once it reaches the specified probability. + /// You should either alter temperature or top_p, but not both. + /// It is recommended for advanced use cases only. + /// You usually only need to use temperature. + /// + /// + public float? TopP { get; set; } +} + +public readonly partial struct AnthropicTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnthropicTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings(Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a completion task, it is the maximum number of tokens to generate before stopping. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor MaxTokens(int value) + { + Instance.MaxTokens = value; + return this; + } + + /// + /// + /// For a completion task, it is the amount of randomness injected into the response. + /// For more details about the supported range, refer to Anthropic documentation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor Temperature(float? value) + { + Instance.Temperature = value; + return this; + } + + /// + /// + /// For a completion task, it specifies to only sample from the top K options for each subsequent token. + /// It is recommended for advanced use cases only. + /// You usually only need to use temperature. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor TopK(int? value) + { + Instance.TopK = value; + return this; + } + + /// + /// + /// For a completion task, it specifies to use Anthropic's nucleus sampling. + /// In nucleus sampling, Anthropic computes the cumulative distribution over all the options for each subsequent token in decreasing probability order and cuts it off once it reaches the specified probability. + /// You should either alter temperature or top_p, but not both. + /// It is recommended for advanced use cases only. + /// You usually only need to use temperature. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor TopP(float? value) + { + Instance.TopP = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AnthropicTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioServiceSettings.g.cs new file mode 100644 index 00000000000..1b990fb566f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioServiceSettings.g.cs @@ -0,0 +1,376 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AzureAiStudioServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropEndpointType = System.Text.Json.JsonEncodedText.Encode("endpoint_type"); + private static readonly System.Text.Json.JsonEncodedText PropProvider = System.Text.Json.JsonEncodedText.Encode("provider"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropTarget = System.Text.Json.JsonEncodedText.Encode("target"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propEndpointType = default; + LocalJsonValue propProvider = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propTarget = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propEndpointType.TryReadProperty(ref reader, options, PropEndpointType, null)) + { + continue; + } + + if (propProvider.TryReadProperty(ref reader, options, PropProvider, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propTarget.TryReadProperty(ref reader, options, PropTarget, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + EndpointType = propEndpointType.Value, + Provider = propProvider.Value, + RateLimit = propRateLimit.Value, + Target = propTarget.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropEndpointType, value.EndpointType, null, null); + writer.WriteProperty(options, PropProvider, value.Provider, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropTarget, value.Target, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsConverter))] +public sealed partial class AzureAiStudioServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureAiStudioServiceSettings(string apiKey, string endpointType, string provider, string target) + { + ApiKey = apiKey; + EndpointType = endpointType; + Provider = provider; + Target = target; + } +#if NET7_0_OR_GREATER + public AzureAiStudioServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AzureAiStudioServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your Azure AI Studio model deployment. + /// This key can be found on the overview page for your deployment in the management section of your Azure AI Studio account. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The type of endpoint that is available for deployment through Azure AI Studio: token or realtime. + /// The token endpoint type is for "pay as you go" endpoints that are billed per token. + /// The realtime endpoint type is for "real-time" endpoints that are billed per hour of usage. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string EndpointType { get; set; } + + /// + /// + /// The model provider for your deployment. + /// Note that some providers may support only certain task types. + /// Supported providers include: + /// + /// + /// + /// + /// cohere - available for text_embedding and completion task types + /// + /// + /// + /// + /// databricks - available for completion task type only + /// + /// + /// + /// + /// meta - available for completion task type only + /// + /// + /// + /// + /// microsoft_phi - available for completion task type only + /// + /// + /// + /// + /// mistral - available for completion task type only + /// + /// + /// + /// + /// openai - available for text_embedding and completion task types + /// + /// + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Provider { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure AI Studio. + /// By default, the azureaistudio service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The target URL of your Azure AI Studio model deployment. + /// This can be found on the overview page for your deployment in the management section of your Azure AI Studio account. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Target { get; set; } +} + +public readonly partial struct AzureAiStudioServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureAiStudioServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureAiStudioServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your Azure AI Studio model deployment. + /// This key can be found on the overview page for your deployment in the management section of your Azure AI Studio account. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The type of endpoint that is available for deployment through Azure AI Studio: token or realtime. + /// The token endpoint type is for "pay as you go" endpoints that are billed per token. + /// The realtime endpoint type is for "real-time" endpoints that are billed per hour of usage. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor EndpointType(string value) + { + Instance.EndpointType = value; + return this; + } + + /// + /// + /// The model provider for your deployment. + /// Note that some providers may support only certain task types. + /// Supported providers include: + /// + /// + /// + /// + /// cohere - available for text_embedding and completion task types + /// + /// + /// + /// + /// databricks - available for completion task type only + /// + /// + /// + /// + /// meta - available for completion task type only + /// + /// + /// + /// + /// microsoft_phi - available for completion task type only + /// + /// + /// + /// + /// mistral - available for completion task type only + /// + /// + /// + /// + /// openai - available for text_embedding and completion task types + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor Provider(string value) + { + Instance.Provider = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure AI Studio. + /// By default, the azureaistudio service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure AI Studio. + /// By default, the azureaistudio service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure AI Studio. + /// By default, the azureaistudio service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The target URL of your Azure AI Studio model deployment. + /// This can be found on the overview page for your deployment in the management section of your Azure AI Studio account. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor Target(string value) + { + Instance.Target = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioTaskSettings.g.cs new file mode 100644 index 00000000000..a8496e67c96 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureAiStudioTaskSettings.g.cs @@ -0,0 +1,254 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AzureAiStudioTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoSample = System.Text.Json.JsonEncodedText.Encode("do_sample"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNewTokens = System.Text.Json.JsonEncodedText.Encode("max_new_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropTemperature = System.Text.Json.JsonEncodedText.Encode("temperature"); + private static readonly System.Text.Json.JsonEncodedText PropTopP = System.Text.Json.JsonEncodedText.Encode("top_p"); + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoSample = default; + LocalJsonValue propMaxNewTokens = default; + LocalJsonValue propTemperature = default; + LocalJsonValue propTopP = default; + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoSample.TryReadProperty(ref reader, options, PropDoSample, null)) + { + continue; + } + + if (propMaxNewTokens.TryReadProperty(ref reader, options, PropMaxNewTokens, null)) + { + continue; + } + + if (propTemperature.TryReadProperty(ref reader, options, PropTemperature, null)) + { + continue; + } + + if (propTopP.TryReadProperty(ref reader, options, PropTopP, null)) + { + continue; + } + + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DoSample = propDoSample.Value, + MaxNewTokens = propMaxNewTokens.Value, + Temperature = propTemperature.Value, + TopP = propTopP.Value, + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoSample, value.DoSample, null, null); + writer.WriteProperty(options, PropMaxNewTokens, value.MaxNewTokens, null, null); + writer.WriteProperty(options, PropTemperature, value.Temperature, null, null); + writer.WriteProperty(options, PropTopP, value.TopP, null, null); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsConverter))] +public sealed partial class AzureAiStudioTaskSettings +{ +#if NET7_0_OR_GREATER + public AzureAiStudioTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public AzureAiStudioTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a completion task, instruct the inference process to perform sampling. + /// It has no effect unless temperature or top_p is specified. + /// + /// + public float? DoSample { get; set; } + + /// + /// + /// For a completion task, provide a hint for the maximum number of output tokens to be generated. + /// + /// + public int? MaxNewTokens { get; set; } + + /// + /// + /// For a completion task, control the apparent creativity of generated completions with a sampling temperature. + /// It must be a number in the range of 0.0 to 2.0. + /// It should not be used if top_p is specified. + /// + /// + public float? Temperature { get; set; } + + /// + /// + /// For a completion task, make the model consider the results of the tokens with nucleus sampling probability. + /// It is an alternative value to temperature and must be a number in the range of 0.0 to 2.0. + /// It should not be used if temperature is specified. + /// + /// + public float? TopP { get; set; } + + /// + /// + /// For a text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public string? User { get; set; } +} + +public readonly partial struct AzureAiStudioTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureAiStudioTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureAiStudioTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a completion task, instruct the inference process to perform sampling. + /// It has no effect unless temperature or top_p is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor DoSample(float? value) + { + Instance.DoSample = value; + return this; + } + + /// + /// + /// For a completion task, provide a hint for the maximum number of output tokens to be generated. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor MaxNewTokens(int? value) + { + Instance.MaxNewTokens = value; + return this; + } + + /// + /// + /// For a completion task, control the apparent creativity of generated completions with a sampling temperature. + /// It must be a number in the range of 0.0 to 2.0. + /// It should not be used if top_p is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor Temperature(float? value) + { + Instance.Temperature = value; + return this; + } + + /// + /// + /// For a completion task, make the model consider the results of the tokens with nucleus sampling probability. + /// It is an alternative value to temperature and must be a number in the range of 0.0 to 2.0. + /// It should not be used if temperature is specified. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor TopP(float? value) + { + Instance.TopP = value; + return this; + } + + /// + /// + /// For a text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor User(string? value) + { + Instance.User = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AzureAiStudioTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAIServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAIServiceSettings.g.cs new file mode 100644 index 00000000000..57847cc9e84 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAIServiceSettings.g.cs @@ -0,0 +1,344 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AzureOpenAIServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropApiVersion = System.Text.Json.JsonEncodedText.Encode("api_version"); + private static readonly System.Text.Json.JsonEncodedText PropDeploymentId = System.Text.Json.JsonEncodedText.Encode("deployment_id"); + private static readonly System.Text.Json.JsonEncodedText PropEntraId = System.Text.Json.JsonEncodedText.Encode("entra_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropResourceName = System.Text.Json.JsonEncodedText.Encode("resource_name"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propApiVersion = default; + LocalJsonValue propDeploymentId = default; + LocalJsonValue propEntraId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propResourceName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propApiVersion.TryReadProperty(ref reader, options, PropApiVersion, null)) + { + continue; + } + + if (propDeploymentId.TryReadProperty(ref reader, options, PropDeploymentId, null)) + { + continue; + } + + if (propEntraId.TryReadProperty(ref reader, options, PropEntraId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propResourceName.TryReadProperty(ref reader, options, PropResourceName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + ApiVersion = propApiVersion.Value, + DeploymentId = propDeploymentId.Value, + EntraId = propEntraId.Value, + RateLimit = propRateLimit.Value, + ResourceName = propResourceName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropApiVersion, value.ApiVersion, null, null); + writer.WriteProperty(options, PropDeploymentId, value.DeploymentId, null, null); + writer.WriteProperty(options, PropEntraId, value.EntraId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropResourceName, value.ResourceName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettingsConverter))] +public sealed partial class AzureOpenAIServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureOpenAIServiceSettings(string apiVersion, string deploymentId, string resourceName) + { + ApiVersion = apiVersion; + DeploymentId = deploymentId; + ResourceName = resourceName; + } +#if NET7_0_OR_GREATER + public AzureOpenAIServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AzureOpenAIServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureOpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key for your Azure OpenAI account. + /// You must specify either api_key or entra_id. + /// If you do not provide either or you provide both, you will receive an error when you try to create your model. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public string? ApiKey { get; set; } + + /// + /// + /// The Azure API version ID to use. + /// It is recommended to use the latest supported non-preview version. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiVersion { get; set; } + + /// + /// + /// The deployment name of your deployed models. + /// Your Azure OpenAI deployments can be found though the Azure OpenAI Studio portal that is linked to your subscription. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string DeploymentId { get; set; } + + /// + /// + /// A valid Microsoft Entra token. + /// You must specify either api_key or entra_id. + /// If you do not provide either or you provide both, you will receive an error when you try to create your model. + /// + /// + public string? EntraId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure. + /// The azureopenai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 1440. + /// For completion, it is set to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The name of your Azure OpenAI resource. + /// You can find this from the list of resources in the Azure Portal for your subscription. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ResourceName { get; set; } +} + +public readonly partial struct AzureOpenAiServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureOpenAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureOpenAiServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key for your Azure OpenAI account. + /// You must specify either api_key or entra_id. + /// If you do not provide either or you provide both, you will receive an error when you try to create your model. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor ApiKey(string? value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The Azure API version ID to use. + /// It is recommended to use the latest supported non-preview version. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor ApiVersion(string value) + { + Instance.ApiVersion = value; + return this; + } + + /// + /// + /// The deployment name of your deployed models. + /// Your Azure OpenAI deployments can be found though the Azure OpenAI Studio portal that is linked to your subscription. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor DeploymentId(string value) + { + Instance.DeploymentId = value; + return this; + } + + /// + /// + /// A valid Microsoft Entra token. + /// You must specify either api_key or entra_id. + /// If you do not provide either or you provide both, you will receive an error when you try to create your model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor EntraId(string? value) + { + Instance.EntraId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure. + /// The azureopenai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 1440. + /// For completion, it is set to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure. + /// The azureopenai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 1440. + /// For completion, it is set to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Azure. + /// The azureopenai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 1440. + /// For completion, it is set to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The name of your Azure OpenAI resource. + /// You can find this from the list of resources in the Azure Portal for your subscription. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor ResourceName(string value) + { + Instance.ResourceName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.AzureOpenAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AzureOpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAITaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAITaskSettings.g.cs new file mode 100644 index 00000000000..03aca0eec46 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/AzureOpenAITaskSettings.g.cs @@ -0,0 +1,136 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class AzureOpenAITaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettingsConverter))] +public sealed partial class AzureOpenAITaskSettings +{ +#if NET7_0_OR_GREATER + public AzureOpenAITaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public AzureOpenAITaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a completion or text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public string? User { get; set; } +} + +public readonly partial struct AzureOpenAiTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureOpenAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureOpenAiTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a completion or text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor User(string? value) + { + Instance.User = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.AzureOpenAiTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.AzureOpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereServiceSettings.g.cs new file mode 100644 index 00000000000..eb557ec44ff --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereServiceSettings.g.cs @@ -0,0 +1,337 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CohereServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropEmbeddingType = System.Text.Json.JsonEncodedText.Encode("embedding_type"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propEmbeddingType = default; + LocalJsonValue propModelId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propSimilarity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propEmbeddingType.TryReadProperty(ref reader, options, PropEmbeddingType, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + EmbeddingType = propEmbeddingType.Value, + ModelId = propModelId.Value, + RateLimit = propRateLimit.Value, + Similarity = propSimilarity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropEmbeddingType, value.EmbeddingType, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsConverter))] +public sealed partial class CohereServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CohereServiceSettings(string apiKey) + { + ApiKey = apiKey; + } +#if NET7_0_OR_GREATER + public CohereServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CohereServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CohereServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key for your Cohere account. + /// You can find or create your Cohere API keys on the Cohere API key settings page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// For a text_embedding task, the types of embeddings you want to get back. + /// Use byte for signed int8 embeddings (this is a synonym of int8). + /// Use float for the default float embeddings. + /// Use int8 for signed int8 embeddings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType? EmbeddingType { get; set; } + + /// + /// + /// For a completion, rerank, or text_embedding task, the name of the model to use for the inference task. + /// + /// + /// + /// + /// For the available completion models, refer to the Cohere command docs. + /// + /// + /// + /// + /// For the available rerank models, refer to the Cohere rerank docs. + /// + /// + /// + /// + /// For the available text_embedding models, refer to Cohere embed docs. + /// + /// + /// + /// + /// The default value for a text embedding task is embed-english-v2.0. + /// + /// + public string? ModelId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Cohere. + /// By default, the cohere service sets the number of requests allowed per minute to 10000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The similarity measure. + /// If the embedding_type is float, the default value is dot_product. + /// If the embedding_type is int8 or byte, the default value is cosine. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType? Similarity { get; set; } +} + +public readonly partial struct CohereServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CohereServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CohereServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings(Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key for your Cohere account. + /// You can find or create your Cohere API keys on the Cohere API key settings page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// For a text_embedding task, the types of embeddings you want to get back. + /// Use byte for signed int8 embeddings (this is a synonym of int8). + /// Use float for the default float embeddings. + /// Use int8 for signed int8 embeddings. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor EmbeddingType(Elastic.Clients.Elasticsearch.Inference.CohereEmbeddingType? value) + { + Instance.EmbeddingType = value; + return this; + } + + /// + /// + /// For a completion, rerank, or text_embedding task, the name of the model to use for the inference task. + /// + /// + /// + /// + /// For the available completion models, refer to the Cohere command docs. + /// + /// + /// + /// + /// For the available rerank models, refer to the Cohere rerank docs. + /// + /// + /// + /// + /// For the available text_embedding models, refer to Cohere embed docs. + /// + /// + /// + /// + /// The default value for a text embedding task is embed-english-v2.0. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor ModelId(string? value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Cohere. + /// By default, the cohere service sets the number of requests allowed per minute to 10000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Cohere. + /// By default, the cohere service sets the number of requests allowed per minute to 10000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Cohere. + /// By default, the cohere service sets the number of requests allowed per minute to 10000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The similarity measure. + /// If the embedding_type is float, the default value is dot_product. + /// If the embedding_type is int8 or byte, the default value is cosine. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.Inference.CohereSimilarityType? value) + { + Instance.Similarity = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.CohereServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.CohereServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereTaskSettings.g.cs new file mode 100644 index 00000000000..4d569f60eb4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CohereTaskSettings.g.cs @@ -0,0 +1,307 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CohereTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInputType = System.Text.Json.JsonEncodedText.Encode("input_type"); + private static readonly System.Text.Json.JsonEncodedText PropReturnDocuments = System.Text.Json.JsonEncodedText.Encode("return_documents"); + private static readonly System.Text.Json.JsonEncodedText PropTopN = System.Text.Json.JsonEncodedText.Encode("top_n"); + private static readonly System.Text.Json.JsonEncodedText PropTruncate = System.Text.Json.JsonEncodedText.Encode("truncate"); + + public override Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInputType = default; + LocalJsonValue propReturnDocuments = default; + LocalJsonValue propTopN = default; + LocalJsonValue propTruncate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInputType.TryReadProperty(ref reader, options, PropInputType, null)) + { + continue; + } + + if (propReturnDocuments.TryReadProperty(ref reader, options, PropReturnDocuments, null)) + { + continue; + } + + if (propTopN.TryReadProperty(ref reader, options, PropTopN, null)) + { + continue; + } + + if (propTruncate.TryReadProperty(ref reader, options, PropTruncate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InputType = propInputType.Value, + ReturnDocuments = propReturnDocuments.Value, + TopN = propTopN.Value, + Truncate = propTruncate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInputType, value.InputType, null, null); + writer.WriteProperty(options, PropReturnDocuments, value.ReturnDocuments, null, null); + writer.WriteProperty(options, PropTopN, value.TopN, null, null); + writer.WriteProperty(options, PropTruncate, value.Truncate, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsConverter))] +public sealed partial class CohereTaskSettings +{ +#if NET7_0_OR_GREATER + public CohereTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public CohereTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CohereTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a text_embedding task, the type of input passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// classification: Use it for embeddings passed through a text classifier. + /// + /// + /// + /// + /// clustering: Use it for the embeddings run through a clustering algorithm. + /// + /// + /// + /// + /// ingest: Use it for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search: Use it for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + /// IMPORTANT: The input_type field is required when using embedding models v3 and higher. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereInputType? InputType { get; set; } + + /// + /// + /// For a rerank task, return doc text within the results. + /// + /// + public bool? ReturnDocuments { get; set; } + + /// + /// + /// For a rerank task, the number of most relevant documents to return. + /// It defaults to the number of the documents. + /// If this inference endpoint is used in a text_similarity_reranker retriever query and top_n is set, it must be greater than or equal to rank_window_size in the query. + /// + /// + public int? TopN { get; set; } + + /// + /// + /// For a text_embedding task, the method to handle inputs longer than the maximum token length. + /// Valid values are: + /// + /// + /// + /// + /// END: When the input exceeds the maximum input token length, the end of the input is discarded. + /// + /// + /// + /// + /// NONE: When the input exceeds the maximum input token length, an error is returned. + /// + /// + /// + /// + /// START: When the input exceeds the maximum input token length, the start of the input is discarded. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTruncateType? Truncate { get; set; } +} + +public readonly partial struct CohereTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CohereTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CohereTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings(Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a text_embedding task, the type of input passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// classification: Use it for embeddings passed through a text classifier. + /// + /// + /// + /// + /// clustering: Use it for the embeddings run through a clustering algorithm. + /// + /// + /// + /// + /// ingest: Use it for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search: Use it for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + /// IMPORTANT: The input_type field is required when using embedding models v3 and higher. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor InputType(Elastic.Clients.Elasticsearch.Inference.CohereInputType? value) + { + Instance.InputType = value; + return this; + } + + /// + /// + /// For a rerank task, return doc text within the results. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor ReturnDocuments(bool? value = true) + { + Instance.ReturnDocuments = value; + return this; + } + + /// + /// + /// For a rerank task, the number of most relevant documents to return. + /// It defaults to the number of the documents. + /// If this inference endpoint is used in a text_similarity_reranker retriever query and top_n is set, it must be greater than or equal to rank_window_size in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor TopN(int? value) + { + Instance.TopN = value; + return this; + } + + /// + /// + /// For a text_embedding task, the method to handle inputs longer than the maximum token length. + /// Valid values are: + /// + /// + /// + /// + /// END: When the input exceeds the maximum input token length, the end of the input is discarded. + /// + /// + /// + /// + /// NONE: When the input exceeds the maximum input token length, an error is returned. + /// + /// + /// + /// + /// START: When the input exceeds the maximum input token length, the start of the input is discarded. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor Truncate(Elastic.Clients.Elasticsearch.Inference.CohereTruncateType? value) + { + Instance.Truncate = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.CohereTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionResult.g.cs new file mode 100644 index 00000000000..a5273b02b43 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionResult.g.cs @@ -0,0 +1,100 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResult = System.Text.Json.JsonEncodedText.Encode("result"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResult = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Result = propResult.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// The completion result object +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionResultConverter))] +public sealed partial class CompletionResult +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionResult(string result) + { + Result = result; + } +#if NET7_0_OR_GREATER + public CompletionResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Result { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionTool.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionTool.g.cs new file mode 100644 index 00000000000..bbf5117bd61 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionTool.g.cs @@ -0,0 +1,192 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionToolConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionTool Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFunction = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionTool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Function = propFunction.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionTool value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// A list of tools that the model can call. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionToolConverter))] +public sealed partial class CompletionTool +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionTool(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction function, string type) + { + Function = function; + Type = type; + } +#if NET7_0_OR_GREATER + public CompletionTool() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionTool() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionTool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The function definition. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction Function { get; set; } + + /// + /// + /// The type of tool. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } +} + +/// +/// +/// A list of tools that the model can call. +/// +/// +public readonly partial struct CompletionToolDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.CompletionTool Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionTool instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.CompletionTool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionTool instance) => new Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.CompletionTool(Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The function definition. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor Function(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction value) + { + Instance.Function = value; + return this; + } + + /// + /// + /// The function definition. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor Function(System.Action action) + { + Instance.Function = Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor.Build(action); + return this; + } + + /// + /// + /// The type of tool. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor Type(string value) + { + Instance.Type = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.CompletionTool Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor(new Elastic.Clients.Elasticsearch.Inference.CompletionTool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoice.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoice.g.cs new file mode 100644 index 00000000000..553090ce8b3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoice.g.cs @@ -0,0 +1,126 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionToolChoiceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionToolChoice Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFunction = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionToolChoice(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Function = propFunction.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionToolChoice value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// Controls which tool is called by the model. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceConverter))] +public sealed partial class CompletionToolChoice +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolChoice(Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunction function, string type) + { + Function = function; + Type = type; + } +#if NET7_0_OR_GREATER + public CompletionToolChoice() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionToolChoice() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionToolChoice(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The tool choice function. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunction Function { get; set; } + + /// + /// + /// The type of the tool. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoiceFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoiceFunction.g.cs new file mode 100644 index 00000000000..b6884af38c7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolChoiceFunction.g.cs @@ -0,0 +1,105 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionToolChoiceFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// The tool choice function. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionToolChoiceFunctionConverter))] +public sealed partial class CompletionToolChoiceFunction +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolChoiceFunction(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public CompletionToolChoiceFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionToolChoiceFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionToolChoiceFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The name of the function to call. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolFunction.g.cs new file mode 100644 index 00000000000..b73bfc9a254 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CompletionToolFunction.g.cs @@ -0,0 +1,232 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class CompletionToolFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropParameters = System.Text.Json.JsonEncodedText.Encode("parameters"); + private static readonly System.Text.Json.JsonEncodedText PropStrict = System.Text.Json.JsonEncodedText.Encode("strict"); + + public override Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propName = default; + LocalJsonValue propParameters = default; + LocalJsonValue propStrict = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propParameters.TryReadProperty(ref reader, options, PropParameters, null)) + { + continue; + } + + if (propStrict.TryReadProperty(ref reader, options, PropStrict, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Name = propName.Value, + Parameters = propParameters.Value, + Strict = propStrict.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropParameters, value.Parameters, null, null); + writer.WriteProperty(options, PropStrict, value.Strict, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// The completion tool function definition. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionConverter))] +public sealed partial class CompletionToolFunction +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolFunction(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public CompletionToolFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompletionToolFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionToolFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A description of what the function does. + /// This is used by the model to choose when and how to call the function. + /// + /// + public string? Description { get; set; } + + /// + /// + /// The name of the function. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + + /// + /// + /// The parameters the functional accepts. This should be formatted as a JSON object. + /// + /// + public object? Parameters { get; set; } + + /// + /// + /// Whether to enable schema adherence when generating the function call. + /// + /// + public bool? Strict { get; set; } +} + +/// +/// +/// The completion tool function definition. +/// +/// +public readonly partial struct CompletionToolFunctionDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolFunctionDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionToolFunctionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction instance) => new Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction(Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A description of what the function does. + /// This is used by the model to choose when and how to call the function. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// The name of the function. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor Name(string value) + { + Instance.Name = value; + return this; + } + + /// + /// + /// The parameters the functional accepts. This should be formatted as a JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor Parameters(object? value) + { + Instance.Parameters = value; + return this; + } + + /// + /// + /// Whether to enable schema adherence when generating the function call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor Strict(bool? value = true) + { + Instance.Strict = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.CompletionToolFunctionDescriptor(new Elastic.Clients.Elasticsearch.Inference.CompletionToolFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ContentObject.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ContentObject.g.cs new file mode 100644 index 00000000000..8b590476dee --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ContentObject.g.cs @@ -0,0 +1,126 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ContentObjectConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Inference.ContentObject Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propText = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ContentObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Text = propText.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ContentObject value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// An object style representation of a single portion of a conversation. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ContentObjectConverter))] +public sealed partial class ContentObject +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ContentObject(string text, string type) + { + Text = text; + Type = type; + } +#if NET7_0_OR_GREATER + public ContentObject() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ContentObject() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ContentObject(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The text content. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Text { get; set; } + + /// + /// + /// The type of content. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchServiceSettings.g.cs new file mode 100644 index 00000000000..d0d6d5f808c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchServiceSettings.g.cs @@ -0,0 +1,306 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ElasticsearchServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropDeploymentId = System.Text.Json.JsonEncodedText.Encode("deployment_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropNumAllocations = System.Text.Json.JsonEncodedText.Encode("num_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropNumThreads = System.Text.Json.JsonEncodedText.Encode("num_threads"); + + public override Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + LocalJsonValue propDeploymentId = default; + LocalJsonValue propModelId = default; + LocalJsonValue propNumAllocations = default; + LocalJsonValue propNumThreads = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (propDeploymentId.TryReadProperty(ref reader, options, PropDeploymentId, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propNumAllocations.TryReadProperty(ref reader, options, PropNumAllocations, null)) + { + continue; + } + + if (propNumThreads.TryReadProperty(ref reader, options, PropNumThreads, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value, + DeploymentId = propDeploymentId.Value, + ModelId = propModelId.Value, + NumAllocations = propNumAllocations.Value, + NumThreads = propNumThreads.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteProperty(options, PropDeploymentId, value.DeploymentId, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropNumAllocations, value.NumAllocations, null, null); + writer.WriteProperty(options, PropNumThreads, value.NumThreads, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsConverter))] +public sealed partial class ElasticsearchServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchServiceSettings(string modelId, int numThreads) + { + ModelId = modelId; + NumThreads = numThreads; + } +#if NET7_0_OR_GREATER + public ElasticsearchServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ElasticsearchServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElasticsearchServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations? AdaptiveAllocations { get; set; } + + /// + /// + /// The deployment identifier for a trained model deployment. + /// When deployment_id is used the model_id is optional. + /// + /// + public string? DeploymentId { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// It can be the ID of a built-in model (for example, .multilingual-e5-small for E5) or a text embedding model that was uploaded by using the Eland client. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// The total number of allocations that are assigned to the model across machine learning nodes. + /// Increasing this value generally increases the throughput. + /// If adaptive allocations are enabled, do not set this value because it's automatically set. + /// + /// + public int? NumAllocations { get; set; } + + /// + /// + /// The number of threads used by each model allocation during inference. + /// This setting generally increases the speed per inference request. + /// The inference process is a compute-bound process; threads_per_allocations must not exceed the number of available allocated processors per node. + /// The value must be a power of 2. + /// The maximum value is 32. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int NumThreads { get; set; } +} + +public readonly partial struct ElasticsearchServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings(Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor AdaptiveAllocations(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations? value) + { + Instance.AdaptiveAllocations = value; + return this; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor AdaptiveAllocations() + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor.Build(null); + return this; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor AdaptiveAllocations(System.Action? action) + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor.Build(action); + return this; + } + + /// + /// + /// The deployment identifier for a trained model deployment. + /// When deployment_id is used the model_id is optional. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor DeploymentId(string? value) + { + Instance.DeploymentId = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// It can be the ID of a built-in model (for example, .multilingual-e5-small for E5) or a text embedding model that was uploaded by using the Eland client. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The total number of allocations that are assigned to the model across machine learning nodes. + /// Increasing this value generally increases the throughput. + /// If adaptive allocations are enabled, do not set this value because it's automatically set. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor NumAllocations(int? value) + { + Instance.NumAllocations = value; + return this; + } + + /// + /// + /// The number of threads used by each model allocation during inference. + /// This setting generally increases the speed per inference request. + /// The inference process is a compute-bound process; threads_per_allocations must not exceed the number of available allocated processors per node. + /// The value must be a power of 2. + /// The maximum value is 32. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor NumThreads(int value) + { + Instance.NumThreads = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.ElasticsearchServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchTaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchTaskSettings.g.cs new file mode 100644 index 00000000000..5f7bd5496e0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElasticsearchTaskSettings.g.cs @@ -0,0 +1,134 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ElasticsearchTaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReturnDocuments = System.Text.Json.JsonEncodedText.Encode("return_documents"); + + public override Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReturnDocuments = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReturnDocuments.TryReadProperty(ref reader, options, PropReturnDocuments, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReturnDocuments = propReturnDocuments.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReturnDocuments, value.ReturnDocuments, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsConverter))] +public sealed partial class ElasticsearchTaskSettings +{ +#if NET7_0_OR_GREATER + public ElasticsearchTaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public ElasticsearchTaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a rerank task, return the document instead of only the index. + /// + /// + public bool? ReturnDocuments { get; set; } +} + +public readonly partial struct ElasticsearchTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElasticsearchTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a rerank task, return the document instead of only the index. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor ReturnDocuments(bool? value = true) + { + Instance.ReturnDocuments = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.ElasticsearchTaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElserServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElserServiceSettings.g.cs new file mode 100644 index 00000000000..2f0b5880552 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ElserServiceSettings.g.cs @@ -0,0 +1,256 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ElserServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropNumAllocations = System.Text.Json.JsonEncodedText.Encode("num_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropNumThreads = System.Text.Json.JsonEncodedText.Encode("num_threads"); + + public override Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + LocalJsonValue propNumAllocations = default; + LocalJsonValue propNumThreads = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (propNumAllocations.TryReadProperty(ref reader, options, PropNumAllocations, null)) + { + continue; + } + + if (propNumThreads.TryReadProperty(ref reader, options, PropNumThreads, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value, + NumAllocations = propNumAllocations.Value, + NumThreads = propNumThreads.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteProperty(options, PropNumAllocations, value.NumAllocations, null, null); + writer.WriteProperty(options, PropNumThreads, value.NumThreads, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsConverter))] +public sealed partial class ElserServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElserServiceSettings(int numAllocations, int numThreads) + { + NumAllocations = numAllocations; + NumThreads = numThreads; + } +#if NET7_0_OR_GREATER + public ElserServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ElserServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ElserServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations? AdaptiveAllocations { get; set; } + + /// + /// + /// The total number of allocations this model is assigned across machine learning nodes. + /// Increasing this value generally increases the throughput. + /// If adaptive allocations is enabled, do not set this value because it's automatically set. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int NumAllocations { get; set; } + + /// + /// + /// The number of threads used by each model allocation during inference. + /// Increasing this value generally increases the speed per inference request. + /// The inference process is a compute-bound process; threads_per_allocations must not exceed the number of available allocated processors per node. + /// The value must be a power of 2. + /// The maximum value is 32. + /// + /// + /// info + /// If you want to optimize your ELSER endpoint for ingest, set the number of threads to 1. If you want to optimize your ELSER endpoint for search, set the number of threads to greater than 1. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int NumThreads { get; set; } +} + +public readonly partial struct ElserServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElserServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ElserServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings(Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor AdaptiveAllocations(Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocations? value) + { + Instance.AdaptiveAllocations = value; + return this; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor AdaptiveAllocations() + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor.Build(null); + return this; + } + + /// + /// + /// Adaptive allocations configuration details. + /// If enabled is true, the number of allocations of the model is set based on the current load the process gets. + /// When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set. + /// When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set. + /// If enabled is true, do not set the number of allocations manually. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor AdaptiveAllocations(System.Action? action) + { + Instance.AdaptiveAllocations = Elastic.Clients.Elasticsearch.Inference.AdaptiveAllocationsDescriptor.Build(action); + return this; + } + + /// + /// + /// The total number of allocations this model is assigned across machine learning nodes. + /// Increasing this value generally increases the throughput. + /// If adaptive allocations is enabled, do not set this value because it's automatically set. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor NumAllocations(int value) + { + Instance.NumAllocations = value; + return this; + } + + /// + /// + /// The number of threads used by each model allocation during inference. + /// Increasing this value generally increases the speed per inference request. + /// The inference process is a compute-bound process; threads_per_allocations must not exceed the number of available allocated processors per node. + /// The value must be a power of 2. + /// The maximum value is 32. + /// + /// + /// info + /// If you want to optimize your ELSER endpoint for ingest, set the number of threads to 1. If you want to optimize your ELSER endpoint for search, set the number of threads to greater than 1. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor NumThreads(int value) + { + Instance.NumThreads = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.ElserServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.ElserServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleAiStudioServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleAiStudioServiceSettings.g.cs new file mode 100644 index 00000000000..6b7976b5540 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleAiStudioServiceSettings.g.cs @@ -0,0 +1,226 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class GoogleAiStudioServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + + public override Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propModelId = default; + LocalJsonValue propRateLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + ModelId = propModelId.Value, + RateLimit = propRateLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsConverter))] +public sealed partial class GoogleAiStudioServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleAiStudioServiceSettings(string apiKey, string modelId) + { + ApiKey = apiKey; + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public GoogleAiStudioServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GoogleAiStudioServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GoogleAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your Google Gemini account. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Google documentation for the list of supported models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google AI Studio. + /// By default, the googleaistudio service sets the number of requests allowed per minute to 360. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } +} + +public readonly partial struct GoogleAiStudioServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleAiStudioServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleAiStudioServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your Google Gemini account. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Google documentation for the list of supported models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google AI Studio. + /// By default, the googleaistudio service sets the number of requests allowed per minute to 360. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google AI Studio. + /// By default, the googleaistudio service sets the number of requests allowed per minute to 360. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google AI Studio. + /// By default, the googleaistudio service sets the number of requests allowed per minute to 360. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.GoogleAiStudioServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAIServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAIServiceSettings.g.cs new file mode 100644 index 00000000000..c89444e3f8e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAIServiceSettings.g.cs @@ -0,0 +1,292 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class GoogleVertexAIServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropProjectId = System.Text.Json.JsonEncodedText.Encode("project_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropServiceAccountJson = System.Text.Json.JsonEncodedText.Encode("service_account_json"); + + public override Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLocation = default; + LocalJsonValue propModelId = default; + LocalJsonValue propProjectId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propServiceAccountJson = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propProjectId.TryReadProperty(ref reader, options, PropProjectId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propServiceAccountJson.TryReadProperty(ref reader, options, PropServiceAccountJson, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Location = propLocation.Value, + ModelId = propModelId.Value, + ProjectId = propProjectId.Value, + RateLimit = propRateLimit.Value, + ServiceAccountJson = propServiceAccountJson.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropProjectId, value.ProjectId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropServiceAccountJson, value.ServiceAccountJson, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettingsConverter))] +public sealed partial class GoogleVertexAIServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleVertexAIServiceSettings(string location, string modelId, string projectId, string serviceAccountJson) + { + Location = location; + ModelId = modelId; + ProjectId = projectId; + ServiceAccountJson = serviceAccountJson; + } +#if NET7_0_OR_GREATER + public GoogleVertexAIServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GoogleVertexAIServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The name of the location to use for the inference task. + /// Refer to the Google documentation for the list of supported locations. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Location { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Google documentation for the list of supported models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// The name of the project to use for the inference task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ProjectId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. + /// By default, the googlevertexai service sets the number of requests allowed per minute to 30.000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// A valid service account in JSON format for the Google Vertex AI API. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ServiceAccountJson { get; set; } +} + +public readonly partial struct GoogleVertexAiServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleVertexAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleVertexAiServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The name of the location to use for the inference task. + /// Refer to the Google documentation for the list of supported locations. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor Location(string value) + { + Instance.Location = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Google documentation for the list of supported models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The name of the project to use for the inference task. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ProjectId(string value) + { + Instance.ProjectId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. + /// By default, the googlevertexai service sets the number of requests allowed per minute to 30.000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. + /// By default, the googlevertexai service sets the number of requests allowed per minute to 30.000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. + /// By default, the googlevertexai service sets the number of requests allowed per minute to 30.000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// A valid service account in JSON format for the Google Vertex AI API. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ServiceAccountJson(string value) + { + Instance.ServiceAccountJson = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAITaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAITaskSettings.g.cs new file mode 100644 index 00000000000..d585a8e16e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/GoogleVertexAITaskSettings.g.cs @@ -0,0 +1,161 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class GoogleVertexAITaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAutoTruncate = System.Text.Json.JsonEncodedText.Encode("auto_truncate"); + private static readonly System.Text.Json.JsonEncodedText PropTopN = System.Text.Json.JsonEncodedText.Encode("top_n"); + + public override Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAutoTruncate = default; + LocalJsonValue propTopN = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAutoTruncate.TryReadProperty(ref reader, options, PropAutoTruncate, null)) + { + continue; + } + + if (propTopN.TryReadProperty(ref reader, options, PropTopN, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AutoTruncate = propAutoTruncate.Value, + TopN = propTopN.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAutoTruncate, value.AutoTruncate, null, null); + writer.WriteProperty(options, PropTopN, value.TopN, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettingsConverter))] +public sealed partial class GoogleVertexAITaskSettings +{ +#if NET7_0_OR_GREATER + public GoogleVertexAITaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public GoogleVertexAITaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a text_embedding task, truncate inputs longer than the maximum token length automatically. + /// + /// + public bool? AutoTruncate { get; set; } + + /// + /// + /// For a rerank task, the number of the top N documents that should be returned. + /// + /// + public int? TopN { get; set; } +} + +public readonly partial struct GoogleVertexAiTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleVertexAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GoogleVertexAiTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a text_embedding task, truncate inputs longer than the maximum token length automatically. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor AutoTruncate(bool? value = true) + { + Instance.AutoTruncate = value; + return this; + } + + /// + /// + /// For a rerank task, the number of the top N documents that should be returned. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor TopN(int? value) + { + Instance.TopN = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/HuggingFaceServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/HuggingFaceServiceSettings.g.cs new file mode 100644 index 00000000000..8462e99a92b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/HuggingFaceServiceSettings.g.cs @@ -0,0 +1,238 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class HuggingFaceServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropUrl = System.Text.Json.JsonEncodedText.Encode("url"); + + public override Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propUrl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propUrl.TryReadProperty(ref reader, options, PropUrl, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + RateLimit = propRateLimit.Value, + Url = propUrl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropUrl, value.Url, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsConverter))] +public sealed partial class HuggingFaceServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HuggingFaceServiceSettings(string apiKey, string url) + { + ApiKey = apiKey; + Url = url; + } +#if NET7_0_OR_GREATER + public HuggingFaceServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HuggingFaceServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HuggingFaceServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid access token for your HuggingFace account. + /// You can create or find your access tokens on the HuggingFace settings page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Hugging Face. + /// By default, the hugging_face service sets the number of requests allowed per minute to 3000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The URL endpoint to use for the requests. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Url { get; set; } +} + +public readonly partial struct HuggingFaceServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HuggingFaceServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HuggingFaceServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings(Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid access token for your HuggingFace account. + /// You can create or find your access tokens on the HuggingFace settings page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Hugging Face. + /// By default, the hugging_face service sets the number of requests allowed per minute to 3000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Hugging Face. + /// By default, the hugging_face service sets the number of requests allowed per minute to 3000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Hugging Face. + /// By default, the hugging_face service sets the number of requests allowed per minute to 3000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The URL endpoint to use for the requests. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor Url(string value) + { + Instance.Url = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.HuggingFaceServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceChunkingSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceChunkingSettings.g.cs index 4e6406fc6aa..57092ce8c4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceChunkingSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceChunkingSettings.g.cs @@ -17,92 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; +internal sealed partial class InferenceChunkingSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxChunkSize = System.Text.Json.JsonEncodedText.Encode("max_chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropOverlap = System.Text.Json.JsonEncodedText.Encode("overlap"); + private static readonly System.Text.Json.JsonEncodedText PropSentenceOverlap = System.Text.Json.JsonEncodedText.Encode("sentence_overlap"); + private static readonly System.Text.Json.JsonEncodedText PropStrategy = System.Text.Json.JsonEncodedText.Encode("strategy"); + + public override Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxChunkSize = default; + LocalJsonValue propOverlap = default; + LocalJsonValue propSentenceOverlap = default; + LocalJsonValue propStrategy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxChunkSize.TryReadProperty(ref reader, options, PropMaxChunkSize, null)) + { + continue; + } + + if (propOverlap.TryReadProperty(ref reader, options, PropOverlap, null)) + { + continue; + } + + if (propSentenceOverlap.TryReadProperty(ref reader, options, PropSentenceOverlap, null)) + { + continue; + } + + if (propStrategy.TryReadProperty(ref reader, options, PropStrategy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxChunkSize = propMaxChunkSize.Value, + Overlap = propOverlap.Value, + SentenceOverlap = propSentenceOverlap.Value, + Strategy = propStrategy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxChunkSize, value.MaxChunkSize, null, null); + writer.WriteProperty(options, PropOverlap, value.Overlap, null, null); + writer.WriteProperty(options, PropSentenceOverlap, value.SentenceOverlap, null, null); + writer.WriteProperty(options, PropStrategy, value.Strategy, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Chunking configuration object /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsConverter))] public sealed partial class InferenceChunkingSettings { - /// - /// - /// Chunking configuration object - /// - /// - [JsonInclude, JsonPropertyName("chunking_settings")] - public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } +#if NET7_0_OR_GREATER + public InferenceChunkingSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceChunkingSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// - /// Specifies the maximum size of a chunk in words - /// This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy) + /// The maximum size of a chunk in words. + /// This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy). /// /// - [JsonInclude, JsonPropertyName("max_chunk_size")] public int? MaxChunkSize { get; set; } /// /// - /// Specifies the number of overlapping words for chunks - /// Only for word chunking strategy - /// This value cannot be higher than the half of max_chunk_size + /// The number of overlapping words for chunks. + /// It is applicable only to a word chunking strategy. + /// This value cannot be higher than half the max_chunk_size value. /// /// - [JsonInclude, JsonPropertyName("overlap")] public int? Overlap { get; set; } /// /// - /// Specifies the number of overlapping sentences for chunks - /// Only for sentence chunking strategy - /// It can be either 1 or 0 + /// The number of overlapping sentences for chunks. + /// It is applicable only for a sentence chunking strategy. + /// It can be either 1 or 0. /// /// - [JsonInclude, JsonPropertyName("sentence_overlap")] public int? SentenceOverlap { get; set; } /// /// - /// The service type - /// - /// - [JsonInclude, JsonPropertyName("service")] - public string Service { get; set; } - - /// - /// - /// Settings specific to the service + /// The chunking strategy: sentence or word. /// /// - [JsonInclude, JsonPropertyName("service_settings")] - public object ServiceSettings { get; set; } - - /// - /// - /// Specifies the chunking strategy - /// It could be either sentence or word - /// - /// - [JsonInclude, JsonPropertyName("strategy")] public string? Strategy { get; set; } - - /// - /// - /// Task settings specific to the service and task type - /// - /// - [JsonInclude, JsonPropertyName("task_settings")] - public object? TaskSettings { get; set; } } /// @@ -110,190 +152,84 @@ public sealed partial class InferenceChunkingSettings /// Chunking configuration object /// /// -public sealed partial class InferenceChunkingSettingsDescriptor : SerializableDescriptor +public readonly partial struct InferenceChunkingSettingsDescriptor { - internal InferenceChunkingSettingsDescriptor(Action configure) => configure.Invoke(this); - - public InferenceChunkingSettingsDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor ChunkingSettingsDescriptor { get; set; } - private Action ChunkingSettingsDescriptorAction { get; set; } - private int? MaxChunkSizeValue { get; set; } - private int? OverlapValue { get; set; } - private int? SentenceOverlapValue { get; set; } - private string ServiceValue { get; set; } - private object ServiceSettingsValue { get; set; } - private string? StrategyValue { get; set; } - private object? TaskSettingsValue { get; set; } - - /// - /// - /// Chunking configuration object - /// - /// - public InferenceChunkingSettingsDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? chunkingSettings) - { - ChunkingSettingsDescriptor = null; - ChunkingSettingsDescriptorAction = null; - ChunkingSettingsValue = chunkingSettings; - return Self; - } + internal Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings Instance { get; init; } - public InferenceChunkingSettingsDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceChunkingSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings instance) { - ChunkingSettingsValue = null; - ChunkingSettingsDescriptorAction = null; - ChunkingSettingsDescriptor = descriptor; - return Self; + Instance = instance; } - public InferenceChunkingSettingsDescriptor ChunkingSettings(Action configure) - { - ChunkingSettingsValue = null; - ChunkingSettingsDescriptor = null; - ChunkingSettingsDescriptorAction = configure; - return Self; - } - - /// - /// - /// Specifies the maximum size of a chunk in words - /// This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy) - /// - /// - public InferenceChunkingSettingsDescriptor MaxChunkSize(int? maxChunkSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceChunkingSettingsDescriptor() { - MaxChunkSizeValue = maxChunkSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - /// - /// - /// Specifies the number of overlapping words for chunks - /// Only for word chunking strategy - /// This value cannot be higher than the half of max_chunk_size - /// - /// - public InferenceChunkingSettingsDescriptor Overlap(int? overlap) - { - OverlapValue = overlap; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings instance) => new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor descriptor) => descriptor.Instance; /// /// - /// Specifies the number of overlapping sentences for chunks - /// Only for sentence chunking strategy - /// It can be either 1 or 0 + /// The maximum size of a chunk in words. + /// This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy). /// /// - public InferenceChunkingSettingsDescriptor SentenceOverlap(int? sentenceOverlap) + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor MaxChunkSize(int? value) { - SentenceOverlapValue = sentenceOverlap; - return Self; + Instance.MaxChunkSize = value; + return this; } /// /// - /// The service type + /// The number of overlapping words for chunks. + /// It is applicable only to a word chunking strategy. + /// This value cannot be higher than half the max_chunk_size value. /// /// - public InferenceChunkingSettingsDescriptor Service(string service) + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor Overlap(int? value) { - ServiceValue = service; - return Self; + Instance.Overlap = value; + return this; } /// /// - /// Settings specific to the service + /// The number of overlapping sentences for chunks. + /// It is applicable only for a sentence chunking strategy. + /// It can be either 1 or 0. /// /// - public InferenceChunkingSettingsDescriptor ServiceSettings(object serviceSettings) + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor SentenceOverlap(int? value) { - ServiceSettingsValue = serviceSettings; - return Self; + Instance.SentenceOverlap = value; + return this; } /// /// - /// Specifies the chunking strategy - /// It could be either sentence or word + /// The chunking strategy: sentence or word. /// /// - public InferenceChunkingSettingsDescriptor Strategy(string? strategy) + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor Strategy(string? value) { - StrategyValue = strategy; - return Self; + Instance.Strategy = value; + return this; } - /// - /// - /// Task settings specific to the service and task type - /// - /// - public InferenceChunkingSettingsDescriptor TaskSettings(object? taskSettings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings Build(System.Action? action) { - TaskSettingsValue = taskSettings; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (ChunkingSettingsDescriptor is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, ChunkingSettingsDescriptor, options); - } - else if (ChunkingSettingsDescriptorAction is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor(ChunkingSettingsDescriptorAction), options); - } - else if (ChunkingSettingsValue is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, ChunkingSettingsValue, options); - } - - if (MaxChunkSizeValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_chunk_size"); - writer.WriteNumberValue(MaxChunkSizeValue.Value); + return new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (OverlapValue.HasValue) - { - writer.WritePropertyName("overlap"); - writer.WriteNumberValue(OverlapValue.Value); - } - - if (SentenceOverlapValue.HasValue) - { - writer.WritePropertyName("sentence_overlap"); - writer.WriteNumberValue(SentenceOverlapValue.Value); - } - - writer.WritePropertyName("service"); - writer.WriteStringValue(ServiceValue); - writer.WritePropertyName("service_settings"); - JsonSerializer.Serialize(writer, ServiceSettingsValue, options); - if (!string.IsNullOrEmpty(StrategyValue)) - { - writer.WritePropertyName("strategy"); - writer.WriteStringValue(StrategyValue); - } - - if (TaskSettingsValue is not null) - { - writer.WritePropertyName("task_settings"); - JsonSerializer.Serialize(writer, TaskSettingsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs index 396fd5dfbf4..d6e8ce47f94 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs @@ -17,29 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; +internal sealed partial class InferenceEndpointConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + + public override Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Configuration options when storing the inference endpoint /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointConverter))] public sealed partial class InferenceEndpoint { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceEndpoint(string service, object serviceSettings) + { + Service = service; + ServiceSettings = serviceSettings; + } +#if NET7_0_OR_GREATER + public InferenceEndpoint() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceEndpoint() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceEndpoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Chunking configuration object /// /// - [JsonInclude, JsonPropertyName("chunking_settings")] public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } /// @@ -47,23 +132,28 @@ public sealed partial class InferenceEndpoint /// The service type /// /// - [JsonInclude, JsonPropertyName("service")] - public string Service { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } /// /// /// Settings specific to the service /// /// - [JsonInclude, JsonPropertyName("service_settings")] - public object ServiceSettings { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } /// /// /// Task settings specific to the service and task type /// /// - [JsonInclude, JsonPropertyName("task_settings")] public object? TaskSettings { get; set; } } @@ -72,48 +162,56 @@ public sealed partial class InferenceEndpoint /// Configuration options when storing the inference endpoint /// /// -public sealed partial class InferenceEndpointDescriptor : SerializableDescriptor +public readonly partial struct InferenceEndpointDescriptor { - internal InferenceEndpointDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint Instance { get; init; } - public InferenceEndpointDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceEndpointDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor ChunkingSettingsDescriptor { get; set; } - private Action ChunkingSettingsDescriptorAction { get; set; } - private string ServiceValue { get; set; } - private object ServiceSettingsValue { get; set; } - private object? TaskSettingsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceEndpointDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint instance) => new Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor descriptor) => descriptor.Instance; /// /// /// Chunking configuration object /// /// - public InferenceEndpointDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? chunkingSettings) + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? value) { - ChunkingSettingsDescriptor = null; - ChunkingSettingsDescriptorAction = null; - ChunkingSettingsValue = chunkingSettings; - return Self; + Instance.ChunkingSettings = value; + return this; } - public InferenceEndpointDescriptor ChunkingSettings(Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor descriptor) + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor ChunkingSettings() { - ChunkingSettingsValue = null; - ChunkingSettingsDescriptorAction = null; - ChunkingSettingsDescriptor = descriptor; - return Self; + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(null); + return this; } - public InferenceEndpointDescriptor ChunkingSettings(Action configure) + /// + /// + /// Chunking configuration object + /// + /// + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor ChunkingSettings(System.Action? action) { - ChunkingSettingsValue = null; - ChunkingSettingsDescriptor = null; - ChunkingSettingsDescriptorAction = configure; - return Self; + Instance.ChunkingSettings = Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor.Build(action); + return this; } /// @@ -121,10 +219,10 @@ public InferenceEndpointDescriptor ChunkingSettings(Action /// - public InferenceEndpointDescriptor Service(string service) + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor Service(string value) { - ServiceValue = service; - return Self; + Instance.Service = value; + return this; } /// @@ -132,10 +230,10 @@ public InferenceEndpointDescriptor Service(string service) /// Settings specific to the service /// /// - public InferenceEndpointDescriptor ServiceSettings(object serviceSettings) + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor ServiceSettings(object value) { - ServiceSettingsValue = serviceSettings; - return Self; + Instance.ServiceSettings = value; + return this; } /// @@ -143,41 +241,17 @@ public InferenceEndpointDescriptor ServiceSettings(object serviceSettings) /// Task settings specific to the service and task type /// /// - public InferenceEndpointDescriptor TaskSettings(object? taskSettings) + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor TaskSettings(object? value) { - TaskSettingsValue = taskSettings; - return Self; + Instance.TaskSettings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint Build(System.Action action) { - writer.WriteStartObject(); - if (ChunkingSettingsDescriptor is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, ChunkingSettingsDescriptor, options); - } - else if (ChunkingSettingsDescriptorAction is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettingsDescriptor(ChunkingSettingsDescriptorAction), options); - } - else if (ChunkingSettingsValue is not null) - { - writer.WritePropertyName("chunking_settings"); - JsonSerializer.Serialize(writer, ChunkingSettingsValue, options); - } - - writer.WritePropertyName("service"); - writer.WriteStringValue(ServiceValue); - writer.WritePropertyName("service_settings"); - JsonSerializer.Serialize(writer, ServiceSettingsValue, options); - if (TaskSettingsValue is not null) - { - writer.WritePropertyName("task_settings"); - JsonSerializer.Serialize(writer, TaskSettingsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor(new Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs index c47cc9d986c..96c363710f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs @@ -17,68 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Inference; +internal sealed partial class InferenceEndpointInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkingSettings = System.Text.Json.JsonEncodedText.Encode("chunking_settings"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropService = System.Text.Json.JsonEncodedText.Encode("service"); + private static readonly System.Text.Json.JsonEncodedText PropServiceSettings = System.Text.Json.JsonEncodedText.Encode("service_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskSettings = System.Text.Json.JsonEncodedText.Encode("task_settings"); + private static readonly System.Text.Json.JsonEncodedText PropTaskType = System.Text.Json.JsonEncodedText.Encode("task_type"); + + public override Elastic.Clients.Elasticsearch.Inference.InferenceEndpointInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkingSettings = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propService = default; + LocalJsonValue propServiceSettings = default; + LocalJsonValue propTaskSettings = default; + LocalJsonValue propTaskType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkingSettings.TryReadProperty(ref reader, options, PropChunkingSettings, null)) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propService.TryReadProperty(ref reader, options, PropService, null)) + { + continue; + } + + if (propServiceSettings.TryReadProperty(ref reader, options, PropServiceSettings, null)) + { + continue; + } + + if (propTaskSettings.TryReadProperty(ref reader, options, PropTaskSettings, null)) + { + continue; + } + + if (propTaskType.TryReadProperty(ref reader, options, PropTaskType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.InferenceEndpointInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkingSettings = propChunkingSettings.Value, + InferenceId = propInferenceId.Value, + Service = propService.Value, + ServiceSettings = propServiceSettings.Value, + TaskSettings = propTaskSettings.Value, + TaskType = propTaskType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.InferenceEndpointInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkingSettings, value.ChunkingSettings, null, null); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropService, value.Service, null, null); + writer.WriteProperty(options, PropServiceSettings, value.ServiceSettings, null, null); + writer.WriteProperty(options, PropTaskSettings, value.TaskSettings, null, null); + writer.WriteProperty(options, PropTaskType, value.TaskType, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Represents an inference endpoint as returned by the GET API /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointInfoConverter))] public sealed partial class InferenceEndpointInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceEndpointInfo(string inferenceId, string service, object serviceSettings, Elastic.Clients.Elasticsearch.Inference.TaskType taskType) + { + InferenceId = inferenceId; + Service = service; + ServiceSettings = serviceSettings; + TaskType = taskType; + } +#if NET7_0_OR_GREATER + public InferenceEndpointInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceEndpointInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceEndpointInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Chunking configuration object /// /// - [JsonInclude, JsonPropertyName("chunking_settings")] - public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; init; } + public Elastic.Clients.Elasticsearch.Inference.InferenceChunkingSettings? ChunkingSettings { get; set; } /// /// /// The inference Id /// /// - [JsonInclude, JsonPropertyName("inference_id")] - public string InferenceId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InferenceId { get; set; } /// /// /// The service type /// /// - [JsonInclude, JsonPropertyName("service")] - public string Service { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Service { get; set; } /// /// /// Settings specific to the service /// /// - [JsonInclude, JsonPropertyName("service_settings")] - public object ServiceSettings { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + object ServiceSettings { get; set; } /// /// /// Task settings specific to the service and task type /// /// - [JsonInclude, JsonPropertyName("task_settings")] - public object? TaskSettings { get; init; } + public object? TaskSettings { get; set; } /// /// /// The task type /// /// - [JsonInclude, JsonPropertyName("task_type")] - public Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAIServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAIServiceSettings.g.cs new file mode 100644 index 00000000000..8d2d6101adc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAIServiceSettings.g.cs @@ -0,0 +1,266 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class JinaAIServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + + public override Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propModelId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propSimilarity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + ModelId = propModelId.Value, + RateLimit = propRateLimit.Value, + Similarity = propSimilarity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettingsConverter))] +public sealed partial class JinaAIServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JinaAIServiceSettings(string apiKey) + { + ApiKey = apiKey; + } +#if NET7_0_OR_GREATER + public JinaAIServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JinaAIServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JinaAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your JinaAI account. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// For a rerank task, it is required. + /// For a text_embedding task, it is optional. + /// + /// + public string? ModelId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from JinaAI. + /// By default, the jinaai service sets the number of requests allowed per minute to 2000 for all task types. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// For a text_embedding task, the similarity measure. One of cosine, dot_product, l2_norm. + /// The default values varies with the embedding type. + /// For example, a float embedding type uses a dot_product similarity measure by default. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType? Similarity { get; set; } +} + +public readonly partial struct JinaAiServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JinaAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JinaAiServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your JinaAI account. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// For a rerank task, it is required. + /// For a text_embedding task, it is optional. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor ModelId(string? value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from JinaAI. + /// By default, the jinaai service sets the number of requests allowed per minute to 2000 for all task types. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from JinaAI. + /// By default, the jinaai service sets the number of requests allowed per minute to 2000 for all task types. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from JinaAI. + /// By default, the jinaai service sets the number of requests allowed per minute to 2000 for all task types. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// For a text_embedding task, the similarity measure. One of cosine, dot_product, l2_norm. + /// The default values varies with the embedding type. + /// For example, a float embedding type uses a dot_product similarity measure by default. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.Inference.JinaAISimilarityType? value) + { + Instance.Similarity = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.JinaAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.JinaAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAITaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAITaskSettings.g.cs new file mode 100644 index 00000000000..56bc25e3120 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/JinaAITaskSettings.g.cs @@ -0,0 +1,238 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class JinaAITaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReturnDocuments = System.Text.Json.JsonEncodedText.Encode("return_documents"); + private static readonly System.Text.Json.JsonEncodedText PropTask = System.Text.Json.JsonEncodedText.Encode("task"); + private static readonly System.Text.Json.JsonEncodedText PropTopN = System.Text.Json.JsonEncodedText.Encode("top_n"); + + public override Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReturnDocuments = default; + LocalJsonValue propTask = default; + LocalJsonValue propTopN = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReturnDocuments.TryReadProperty(ref reader, options, PropReturnDocuments, null)) + { + continue; + } + + if (propTask.TryReadProperty(ref reader, options, PropTask, null)) + { + continue; + } + + if (propTopN.TryReadProperty(ref reader, options, PropTopN, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ReturnDocuments = propReturnDocuments.Value, + Task = propTask.Value, + TopN = propTopN.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReturnDocuments, value.ReturnDocuments, null, null); + writer.WriteProperty(options, PropTask, value.Task, null, null); + writer.WriteProperty(options, PropTopN, value.TopN, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettingsConverter))] +public sealed partial class JinaAITaskSettings +{ +#if NET7_0_OR_GREATER + public JinaAITaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public JinaAITaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JinaAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a rerank task, return the doc text within the results. + /// + /// + public bool? ReturnDocuments { get; set; } + + /// + /// + /// For a text_embedding task, the task passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// classification: Use it for embeddings passed through a text classifier. + /// + /// + /// + /// + /// clustering: Use it for the embeddings run through a clustering algorithm. + /// + /// + /// + /// + /// ingest: Use it for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search: Use it for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask? Task { get; set; } + + /// + /// + /// For a rerank task, the number of most relevant documents to return. + /// It defaults to the number of the documents. + /// If this inference endpoint is used in a text_similarity_reranker retriever query and top_n is set, it must be greater than or equal to rank_window_size in the query. + /// + /// + public int? TopN { get; set; } +} + +public readonly partial struct JinaAiTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JinaAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JinaAiTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings(Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a rerank task, return the doc text within the results. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor ReturnDocuments(bool? value = true) + { + Instance.ReturnDocuments = value; + return this; + } + + /// + /// + /// For a text_embedding task, the task passed to the model. + /// Valid values are: + /// + /// + /// + /// + /// classification: Use it for embeddings passed through a text classifier. + /// + /// + /// + /// + /// clustering: Use it for the embeddings run through a clustering algorithm. + /// + /// + /// + /// + /// ingest: Use it for storing document embeddings in a vector database. + /// + /// + /// + /// + /// search: Use it for storing embeddings of search queries run against a vector database to find relevant documents. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor Task(Elastic.Clients.Elasticsearch.Inference.JinaAITextEmbeddingTask? value) + { + Instance.Task = value; + return this; + } + + /// + /// + /// For a rerank task, the number of most relevant documents to return. + /// It defaults to the number of the documents. + /// If this inference endpoint is used in a text_similarity_reranker retriever query and top_n is set, it must be greater than or equal to rank_window_size in the query. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor TopN(int? value) + { + Instance.TopN = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.JinaAiTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.JinaAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/Message.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/Message.g.cs new file mode 100644 index 00000000000..e90ccb1fb44 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/Message.g.cs @@ -0,0 +1,258 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class MessageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropContent = System.Text.Json.JsonEncodedText.Encode("content"); + private static readonly System.Text.Json.JsonEncodedText PropRole = System.Text.Json.JsonEncodedText.Encode("role"); + private static readonly System.Text.Json.JsonEncodedText PropToolCallId = System.Text.Json.JsonEncodedText.Encode("tool_call_id"); + private static readonly System.Text.Json.JsonEncodedText PropToolCalls = System.Text.Json.JsonEncodedText.Encode("tool_calls"); + + public override Elastic.Clients.Elasticsearch.Inference.Message Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propContent = default; + LocalJsonValue propRole = default; + LocalJsonValue propToolCallId = default; + LocalJsonValue?> propToolCalls = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propContent.TryReadProperty(ref reader, options, PropContent, static Elastic.Clients.Elasticsearch.Union>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue>(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray), null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propRole.TryReadProperty(ref reader, options, PropRole, null)) + { + continue; + } + + if (propToolCallId.TryReadProperty(ref reader, options, PropToolCallId, null)) + { + continue; + } + + if (propToolCalls.TryReadProperty(ref reader, options, PropToolCalls, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.Message(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Content = propContent.Value, + Role = propRole.Value, + ToolCallId = propToolCallId.Value, + ToolCalls = propToolCalls.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.Message value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropContent, value.Content, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union>? v) => w.WriteUnionValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropRole, value.Role, null, null); + writer.WriteProperty(options, PropToolCallId, value.ToolCallId, null, null); + writer.WriteProperty(options, PropToolCalls, value.ToolCalls, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +/// +/// +/// An object representing part of the conversation. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.MessageConverter))] +public sealed partial class Message +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Message(string role) + { + Role = role; + } +#if NET7_0_OR_GREATER + public Message() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Message() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Message(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The content of the message. + /// + /// + public Elastic.Clients.Elasticsearch.Union>? Content { get; set; } + + /// + /// + /// The role of the message author. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Role { get; set; } + + /// + /// + /// The tool call that this message is responding to. + /// + /// + public Elastic.Clients.Elasticsearch.Id? ToolCallId { get; set; } + + /// + /// + /// The tool calls generated by the model. + /// + /// + public System.Collections.Generic.ICollection? ToolCalls { get; set; } +} + +/// +/// +/// An object representing part of the conversation. +/// +/// +public readonly partial struct MessageDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.Message Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MessageDescriptor(Elastic.Clients.Elasticsearch.Inference.Message instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MessageDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.Message(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.MessageDescriptor(Elastic.Clients.Elasticsearch.Inference.Message instance) => new Elastic.Clients.Elasticsearch.Inference.MessageDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.Message(Elastic.Clients.Elasticsearch.Inference.MessageDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The content of the message. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor Content(Elastic.Clients.Elasticsearch.Union>? value) + { + Instance.Content = value; + return this; + } + + /// + /// + /// The role of the message author. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor Role(string value) + { + Instance.Role = value; + return this; + } + + /// + /// + /// The tool call that this message is responding to. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor ToolCallId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.ToolCallId = value; + return this; + } + + /// + /// + /// The tool calls generated by the model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor ToolCalls(System.Collections.Generic.ICollection? value) + { + Instance.ToolCalls = value; + return this; + } + + /// + /// + /// The tool calls generated by the model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor ToolCalls(params Elastic.Clients.Elasticsearch.Inference.ToolCall[] values) + { + Instance.ToolCalls = [.. values]; + return this; + } + + /// + /// + /// The tool calls generated by the model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MessageDescriptor ToolCalls(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor.Build(action)); + } + + Instance.ToolCalls = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.Message Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.MessageDescriptor(new Elastic.Clients.Elasticsearch.Inference.Message(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/MistralServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/MistralServiceSettings.g.cs new file mode 100644 index 00000000000..fe7b6f01977 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/MistralServiceSettings.g.cs @@ -0,0 +1,267 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class MistralServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInputTokens = System.Text.Json.JsonEncodedText.Encode("max_input_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + + public override Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propMaxInputTokens = default; + LocalJsonValue propModel = default; + LocalJsonValue propRateLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propMaxInputTokens.TryReadProperty(ref reader, options, PropMaxInputTokens, null)) + { + continue; + } + + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + MaxInputTokens = propMaxInputTokens.Value, + Model = propModel.Value, + RateLimit = propRateLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropMaxInputTokens, value.MaxInputTokens, null, null); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsConverter))] +public sealed partial class MistralServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MistralServiceSettings(string apiKey, string model) + { + ApiKey = apiKey; + Model = model; + } +#if NET7_0_OR_GREATER + public MistralServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MistralServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MistralServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your Mistral account. + /// You can find your Mistral API keys or you can create a new one on the API Keys page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The maximum number of tokens per input before chunking occurs. + /// + /// + public int? MaxInputTokens { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Mistral models documentation for the list of available text embedding models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Model { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from the Mistral API. + /// By default, the mistral service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } +} + +public readonly partial struct MistralServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MistralServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MistralServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings(Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your Mistral account. + /// You can find your Mistral API keys or you can create a new one on the API Keys page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The maximum number of tokens per input before chunking occurs. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor MaxInputTokens(int? value) + { + Instance.MaxInputTokens = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the Mistral models documentation for the list of available text embedding models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor Model(string value) + { + Instance.Model = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from the Mistral API. + /// By default, the mistral service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from the Mistral API. + /// By default, the mistral service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from the Mistral API. + /// By default, the mistral service sets the number of requests allowed per minute to 240. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.MistralServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.MistralServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAIServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAIServiceSettings.g.cs new file mode 100644 index 00000000000..1edad9dce40 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAIServiceSettings.g.cs @@ -0,0 +1,337 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class OpenAIServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropDimensions = System.Text.Json.JsonEncodedText.Encode("dimensions"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropOrganizationId = System.Text.Json.JsonEncodedText.Encode("organization_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropUrl = System.Text.Json.JsonEncodedText.Encode("url"); + + public override Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propDimensions = default; + LocalJsonValue propModelId = default; + LocalJsonValue propOrganizationId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propUrl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propDimensions.TryReadProperty(ref reader, options, PropDimensions, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propOrganizationId.TryReadProperty(ref reader, options, PropOrganizationId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propUrl.TryReadProperty(ref reader, options, PropUrl, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Dimensions = propDimensions.Value, + ModelId = propModelId.Value, + OrganizationId = propOrganizationId.Value, + RateLimit = propRateLimit.Value, + Url = propUrl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropDimensions, value.Dimensions, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropOrganizationId, value.OrganizationId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropUrl, value.Url, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettingsConverter))] +public sealed partial class OpenAIServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIServiceSettings(string apiKey, string modelId) + { + ApiKey = apiKey; + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public OpenAIServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OpenAIServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your OpenAI account. + /// You can find your OpenAI API keys in your OpenAI account under the API keys section. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// The number of dimensions the resulting output embeddings should have. + /// It is supported only in text-embedding-3 and later models. + /// If it is not set, the OpenAI defined default for the model is used. + /// + /// + public int? Dimensions { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the OpenAI documentation for the list of available text embedding models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// The unique identifier for your organization. + /// You can find the Organization ID in your OpenAI account under Settings > Organizations. + /// + /// + public string? OrganizationId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from OpenAI. + /// The openai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 3000. + /// For completion, it is set to 500. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The URL endpoint to use for the requests. + /// It can be changed for testing purposes. + /// + /// + public string? Url { get; set; } +} + +public readonly partial struct OpenAiServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAiServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your OpenAI account. + /// You can find your OpenAI API keys in your OpenAI account under the API keys section. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// The number of dimensions the resulting output embeddings should have. + /// It is supported only in text-embedding-3 and later models. + /// If it is not set, the OpenAI defined default for the model is used. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor Dimensions(int? value) + { + Instance.Dimensions = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the OpenAI documentation for the list of available text embedding models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The unique identifier for your organization. + /// You can find the Organization ID in your OpenAI account under Settings > Organizations. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor OrganizationId(string? value) + { + Instance.OrganizationId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from OpenAI. + /// The openai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 3000. + /// For completion, it is set to 500. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from OpenAI. + /// The openai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 3000. + /// For completion, it is set to 500. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from OpenAI. + /// The openai service sets a default number of requests allowed per minute depending on the task type. + /// For text_embedding, it is set to 3000. + /// For completion, it is set to 500. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The URL endpoint to use for the requests. + /// It can be changed for testing purposes. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor Url(string? value) + { + Instance.Url = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.OpenAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.OpenAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAITaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAITaskSettings.g.cs new file mode 100644 index 00000000000..5e310b6d477 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/OpenAITaskSettings.g.cs @@ -0,0 +1,136 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class OpenAITaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettingsConverter))] +public sealed partial class OpenAITaskSettings +{ +#if NET7_0_OR_GREATER + public OpenAITaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public OpenAITaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// For a completion or text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public string? User { get; set; } +} + +public readonly partial struct OpenAiTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAiTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings(Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// For a completion or text_embedding task, specify the user issuing the request. + /// This information can be used for abuse detection. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor User(string? value) + { + Instance.User = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.OpenAiTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.OpenAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RankedDocument.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RankedDocument.g.cs new file mode 100644 index 00000000000..2628ccb8216 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RankedDocument.g.cs @@ -0,0 +1,128 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class RankedDocumentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropRelevanceScore = System.Text.Json.JsonEncodedText.Encode("relevance_score"); + private static readonly System.Text.Json.JsonEncodedText PropText = System.Text.Json.JsonEncodedText.Encode("text"); + + public override Elastic.Clients.Elasticsearch.Inference.RankedDocument Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propRelevanceScore = default; + LocalJsonValue propText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propRelevanceScore.TryReadProperty(ref reader, options, PropRelevanceScore, null)) + { + continue; + } + + if (propText.TryReadProperty(ref reader, options, PropText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.RankedDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + RelevanceScore = propRelevanceScore.Value, + Text = propText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.RankedDocument value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropRelevanceScore, value.RelevanceScore, null, null); + writer.WriteProperty(options, PropText, value.Text, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// The rerank result object representing a single ranked document +/// id: the original index of the document in the request +/// relevance_score: the relevance_score of the document relative to the query +/// text: Optional, the text of the document, if requested +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.RankedDocumentConverter))] +public sealed partial class RankedDocument +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankedDocument(int index, float relevanceScore) + { + Index = index; + RelevanceScore = relevanceScore; + } +#if NET7_0_OR_GREATER + public RankedDocument() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankedDocument() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankedDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float RelevanceScore { get; set; } + public string? Text { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RateLimitSetting.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RateLimitSetting.g.cs new file mode 100644 index 00000000000..8564783b52a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RateLimitSetting.g.cs @@ -0,0 +1,134 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class RateLimitSettingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRequestsPerMinute = System.Text.Json.JsonEncodedText.Encode("requests_per_minute"); + + public override Elastic.Clients.Elasticsearch.Inference.RateLimitSetting Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRequestsPerMinute = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRequestsPerMinute.TryReadProperty(ref reader, options, PropRequestsPerMinute, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.RateLimitSetting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RequestsPerMinute = propRequestsPerMinute.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.RateLimitSetting value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRequestsPerMinute, value.RequestsPerMinute, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.RateLimitSettingConverter))] +public sealed partial class RateLimitSetting +{ +#if NET7_0_OR_GREATER + public RateLimitSetting() + { + } +#endif +#if !NET7_0_OR_GREATER + public RateLimitSetting() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RateLimitSetting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The number of requests allowed per minute. + /// + /// + public int? RequestsPerMinute { get; set; } +} + +public readonly partial struct RateLimitSettingDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.RateLimitSetting Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateLimitSettingDescriptor(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RateLimitSettingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.RateLimitSetting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting instance) => new Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.RateLimitSetting(Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The number of requests allowed per minute. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor RequestsPerMinute(int? value) + { + Instance.RequestsPerMinute = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.RateLimitSetting Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.RateLimitSetting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor(new Elastic.Clients.Elasticsearch.Inference.RateLimitSetting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs new file mode 100644 index 00000000000..cd750ae21fc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/RequestChatCompletion.g.cs @@ -0,0 +1,395 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class RequestChatCompletionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxCompletionTokens = System.Text.Json.JsonEncodedText.Encode("max_completion_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropMessages = System.Text.Json.JsonEncodedText.Encode("messages"); + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + private static readonly System.Text.Json.JsonEncodedText PropStop = System.Text.Json.JsonEncodedText.Encode("stop"); + private static readonly System.Text.Json.JsonEncodedText PropTemperature = System.Text.Json.JsonEncodedText.Encode("temperature"); + private static readonly System.Text.Json.JsonEncodedText PropToolChoice = System.Text.Json.JsonEncodedText.Encode("tool_choice"); + private static readonly System.Text.Json.JsonEncodedText PropTools = System.Text.Json.JsonEncodedText.Encode("tools"); + private static readonly System.Text.Json.JsonEncodedText PropTopP = System.Text.Json.JsonEncodedText.Encode("top_p"); + + public override Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxCompletionTokens = default; + LocalJsonValue> propMessages = default; + LocalJsonValue propModel = default; + LocalJsonValue?> propStop = default; + LocalJsonValue propTemperature = default; + LocalJsonValue?> propToolChoice = default; + LocalJsonValue?> propTools = default; + LocalJsonValue propTopP = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxCompletionTokens.TryReadProperty(ref reader, options, PropMaxCompletionTokens, null)) + { + continue; + } + + if (propMessages.TryReadProperty(ref reader, options, PropMessages, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (propStop.TryReadProperty(ref reader, options, PropStop, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTemperature.TryReadProperty(ref reader, options, PropTemperature, null)) + { + continue; + } + + if (propToolChoice.TryReadProperty(ref reader, options, PropToolChoice, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject), null, null))) + { + continue; + } + + if (propTools.TryReadProperty(ref reader, options, PropTools, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTopP.TryReadProperty(ref reader, options, PropTopP, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxCompletionTokens = propMaxCompletionTokens.Value, + Messages = propMessages.Value, + Model = propModel.Value, + Stop = propStop.Value, + Temperature = propTemperature.Value, + ToolChoice = propToolChoice.Value, + Tools = propTools.Value, + TopP = propTopP.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxCompletionTokens, value.MaxCompletionTokens, null, null); + writer.WriteProperty(options, PropMessages, value.Messages, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteProperty(options, PropStop, value.Stop, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTemperature, value.Temperature, null, null); + writer.WriteProperty(options, PropToolChoice, value.ToolChoice, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropTools, value.Tools, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTopP, value.TopP, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionConverter))] +public sealed partial class RequestChatCompletion +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestChatCompletion(System.Collections.Generic.ICollection messages) + { + Messages = messages; + } +#if NET7_0_OR_GREATER + public RequestChatCompletion() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RequestChatCompletion() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RequestChatCompletion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The upper bound limit for the number of tokens that can be generated for a completion request. + /// + /// + public long? MaxCompletionTokens { get; set; } + + /// + /// + /// A list of objects representing the conversation. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Messages { get; set; } + + /// + /// + /// The ID of the model to use. + /// + /// + public string? Model { get; set; } + + /// + /// + /// A sequence of strings to control when the model should stop generating additional tokens. + /// + /// + public System.Collections.Generic.ICollection? Stop { get; set; } + + /// + /// + /// The sampling temperature to use. + /// + /// + public float? Temperature { get; set; } + + /// + /// + /// Controls which tool is called by the model. + /// + /// + public Elastic.Clients.Elasticsearch.Union? ToolChoice { get; set; } + + /// + /// + /// A list of tools that the model can call. + /// + /// + public System.Collections.Generic.ICollection? Tools { get; set; } + + /// + /// + /// Nucleus sampling, an alternative to sampling with temperature. + /// + /// + public float? TopP { get; set; } +} + +public readonly partial struct RequestChatCompletionDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestChatCompletionDescriptor(Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestChatCompletionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor(Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion instance) => new Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion(Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The upper bound limit for the number of tokens that can be generated for a completion request. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor MaxCompletionTokens(long? value) + { + Instance.MaxCompletionTokens = value; + return this; + } + + /// + /// + /// A list of objects representing the conversation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Messages(System.Collections.Generic.ICollection value) + { + Instance.Messages = value; + return this; + } + + /// + /// + /// A list of objects representing the conversation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Messages(params Elastic.Clients.Elasticsearch.Inference.Message[] values) + { + Instance.Messages = [.. values]; + return this; + } + + /// + /// + /// A list of objects representing the conversation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Messages(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Inference.MessageDescriptor.Build(action)); + } + + Instance.Messages = items; + return this; + } + + /// + /// + /// The ID of the model to use. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Model(string? value) + { + Instance.Model = value; + return this; + } + + /// + /// + /// A sequence of strings to control when the model should stop generating additional tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Stop(System.Collections.Generic.ICollection? value) + { + Instance.Stop = value; + return this; + } + + /// + /// + /// A sequence of strings to control when the model should stop generating additional tokens. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Stop(params string[] values) + { + Instance.Stop = [.. values]; + return this; + } + + /// + /// + /// The sampling temperature to use. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Temperature(float? value) + { + Instance.Temperature = value; + return this; + } + + /// + /// + /// Controls which tool is called by the model. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor ToolChoice(Elastic.Clients.Elasticsearch.Union? value) + { + Instance.ToolChoice = value; + return this; + } + + /// + /// + /// A list of tools that the model can call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Tools(System.Collections.Generic.ICollection? value) + { + Instance.Tools = value; + return this; + } + + /// + /// + /// A list of tools that the model can call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Tools(params Elastic.Clients.Elasticsearch.Inference.CompletionTool[] values) + { + Instance.Tools = [.. values]; + return this; + } + + /// + /// + /// A list of tools that the model can call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor Tools(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Inference.CompletionToolDescriptor.Build(action)); + } + + Instance.Tools = items; + return this; + } + + /// + /// + /// Nucleus sampling, an alternative to sampling with temperature. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor TopP(float? value) + { + Instance.TopP = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.RequestChatCompletionDescriptor(new Elastic.Clients.Elasticsearch.Inference.RequestChatCompletion(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/SparseEmbeddingResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/SparseEmbeddingResult.g.cs new file mode 100644 index 00000000000..9eeb98deeda --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/SparseEmbeddingResult.g.cs @@ -0,0 +1,95 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class SparseEmbeddingResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmbedding = System.Text.Json.JsonEncodedText.Encode("embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEmbedding = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmbedding.TryReadProperty(ref reader, options, PropEmbedding, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Embedding = propEmbedding.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmbedding, value.Embedding, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.SparseEmbeddingResultConverter))] +public sealed partial class SparseEmbeddingResult +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseEmbeddingResult(System.Collections.Generic.IReadOnlyDictionary embedding) + { + Embedding = embedding; + } +#if NET7_0_OR_GREATER + public SparseEmbeddingResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SparseEmbeddingResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SparseEmbeddingResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Embedding { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingByteResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingByteResult.g.cs new file mode 100644 index 00000000000..bc8631eb841 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingByteResult.g.cs @@ -0,0 +1,100 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class TextEmbeddingByteResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmbedding = System.Text.Json.JsonEncodedText.Encode("embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.TextEmbeddingByteResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEmbedding = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmbedding.TryReadProperty(ref reader, options, PropEmbedding, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingByteResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Embedding = propEmbedding.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TextEmbeddingByteResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmbedding, value.Embedding, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +/// +/// +/// The text embedding result object for byte representation +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingByteResultConverter))] +public sealed partial class TextEmbeddingByteResult +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingByteResult(System.Collections.Generic.IReadOnlyCollection embedding) + { + Embedding = embedding; + } +#if NET7_0_OR_GREATER + public TextEmbeddingByteResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextEmbeddingByteResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingByteResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Embedding { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingInferenceResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingInferenceResult.g.cs new file mode 100644 index 00000000000..f55fa97ce65 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingInferenceResult.g.cs @@ -0,0 +1,148 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class TextEmbeddingInferenceResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbeddingBits = System.Text.Json.JsonEncodedText.Encode("text_embedding_bits"); + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbeddingBytes = System.Text.Json.JsonEncodedText.Encode("text_embedding_bytes"); + + public override Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(VariantTextEmbedding)) + { + variantType = VariantTextEmbedding.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); + continue; + } + + if (reader.ValueTextEquals(VariantTextEmbeddingBits)) + { + variantType = VariantTextEmbeddingBits.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); + continue; + } + + if (reader.ValueTextEquals(VariantTextEmbeddingBytes)) + { + variantType = VariantTextEmbeddingBytes.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + switch (value.VariantType) + { + case null: + break; + case "text_embedding": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.IReadOnlyCollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + break; + case "text_embedding_bits": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.IReadOnlyCollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + break; + case "text_embedding_bytes": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.IReadOnlyCollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult)}'."); + } + + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResultConverter))] +public sealed partial class TextEmbeddingInferenceResult +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public TextEmbeddingInferenceResult() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextEmbeddingInferenceResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingInferenceResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? TextEmbedding { get => GetVariant>("text_embedding"); set => SetVariant("text_embedding", value); } + public System.Collections.Generic.IReadOnlyCollection? TextEmbeddingBits { get => GetVariant>("text_embedding_bits"); set => SetVariant("text_embedding_bits", value); } + public System.Collections.Generic.IReadOnlyCollection? TextEmbeddingBytes { get => GetVariant>("text_embedding_bytes"); set => SetVariant("text_embedding_bytes", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResult[] value) => new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingInferenceResult { TextEmbedding = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingResult.g.cs new file mode 100644 index 00000000000..5285bdb8d5d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/TextEmbeddingResult.g.cs @@ -0,0 +1,100 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class TextEmbeddingResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmbedding = System.Text.Json.JsonEncodedText.Encode("embedding"); + + public override Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEmbedding = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmbedding.TryReadProperty(ref reader, options, PropEmbedding, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Embedding = propEmbedding.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmbedding, value.Embedding, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +/// +/// +/// The text embedding result object +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.TextEmbeddingResultConverter))] +public sealed partial class TextEmbeddingResult +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingResult(System.Collections.Generic.IReadOnlyCollection embedding) + { + Embedding = embedding; + } +#if NET7_0_OR_GREATER + public TextEmbeddingResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextEmbeddingResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Embedding { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCall.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCall.g.cs new file mode 100644 index 00000000000..0c922930ae6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCall.g.cs @@ -0,0 +1,224 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ToolCallConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Inference.ToolCall Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFunction = default; + LocalJsonValue propId = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ToolCall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Function = propFunction.Value, + Id = propId.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ToolCall value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// A tool call generated by the model. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ToolCallConverter))] +public sealed partial class ToolCall +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCall(Elastic.Clients.Elasticsearch.Inference.ToolCallFunction function, Elastic.Clients.Elasticsearch.Id id, string type) + { + Function = function; + Id = id; + Type = type; + } +#if NET7_0_OR_GREATER + public ToolCall() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ToolCall() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ToolCall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The function that the model called. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Inference.ToolCallFunction Function { get; set; } + + /// + /// + /// The identifier of the tool call. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } + + /// + /// + /// The type of the tool call. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } +} + +/// +/// +/// A tool call generated by the model. +/// +/// +public readonly partial struct ToolCallDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ToolCall Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallDescriptor(Elastic.Clients.Elasticsearch.Inference.ToolCall instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.ToolCall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor(Elastic.Clients.Elasticsearch.Inference.ToolCall instance) => new Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ToolCall(Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The function that the model called. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor Function(Elastic.Clients.Elasticsearch.Inference.ToolCallFunction value) + { + Instance.Function = value; + return this; + } + + /// + /// + /// The function that the model called. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor Function(System.Action action) + { + Instance.Function = Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor.Build(action); + return this; + } + + /// + /// + /// The identifier of the tool call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor Id(Elastic.Clients.Elasticsearch.Id value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// The type of the tool call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor Type(string value) + { + Instance.Type = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ToolCall Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.ToolCallDescriptor(new Elastic.Clients.Elasticsearch.Inference.ToolCall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCallFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCallFunction.g.cs new file mode 100644 index 00000000000..f3951dafb0f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ToolCallFunction.g.cs @@ -0,0 +1,181 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class ToolCallFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropArguments = System.Text.Json.JsonEncodedText.Encode("arguments"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Inference.ToolCallFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propArguments = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propArguments.TryReadProperty(ref reader, options, PropArguments, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.ToolCallFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Arguments = propArguments.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.ToolCallFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropArguments, value.Arguments, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +/// +/// +/// The function that the model called. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionConverter))] +public sealed partial class ToolCallFunction +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallFunction(string arguments, string name) + { + Arguments = arguments; + Name = name; + } +#if NET7_0_OR_GREATER + public ToolCallFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ToolCallFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ToolCallFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The arguments to call the function with in JSON format. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Arguments { get; set; } + + /// + /// + /// The name of the function to call. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } +} + +/// +/// +/// The function that the model called. +/// +/// +public readonly partial struct ToolCallFunctionDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.ToolCallFunction Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallFunctionDescriptor(Elastic.Clients.Elasticsearch.Inference.ToolCallFunction instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallFunctionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.ToolCallFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor(Elastic.Clients.Elasticsearch.Inference.ToolCallFunction instance) => new Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.ToolCallFunction(Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The arguments to call the function with in JSON format. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor Arguments(string value) + { + Instance.Arguments = value; + return this; + } + + /// + /// + /// The name of the function to call. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor Name(string value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.ToolCallFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.ToolCallFunctionDescriptor(new Elastic.Clients.Elasticsearch.Inference.ToolCallFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAIServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAIServiceSettings.g.cs new file mode 100644 index 00000000000..41e63a2b182 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAIServiceSettings.g.cs @@ -0,0 +1,266 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class VoyageAIServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDimensions = System.Text.Json.JsonEncodedText.Encode("dimensions"); + private static readonly System.Text.Json.JsonEncodedText PropEmbeddingType = System.Text.Json.JsonEncodedText.Encode("embedding_type"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + + public override Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDimensions = default; + LocalJsonValue propEmbeddingType = default; + LocalJsonValue propModelId = default; + LocalJsonValue propRateLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDimensions.TryReadProperty(ref reader, options, PropDimensions, null)) + { + continue; + } + + if (propEmbeddingType.TryReadProperty(ref reader, options, PropEmbeddingType, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dimensions = propDimensions.Value, + EmbeddingType = propEmbeddingType.Value, + ModelId = propModelId.Value, + RateLimit = propRateLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDimensions, value.Dimensions, null, null); + writer.WriteProperty(options, PropEmbeddingType, value.EmbeddingType, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettingsConverter))] +public sealed partial class VoyageAIServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VoyageAIServiceSettings(string modelId) + { + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public VoyageAIServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public VoyageAIServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VoyageAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The number of dimensions for resulting output embeddings. + /// This setting maps to output_dimension in the VoyageAI documentation. + /// Only for the text_embedding task type. + /// + /// + public int? Dimensions { get; set; } + + /// + /// + /// The data type for the embeddings to be returned. + /// This setting maps to output_dtype in the VoyageAI documentation. + /// Permitted values: float, int8, bit. + /// int8 is a synonym of byte in the VoyageAI documentation. + /// bit is a synonym of binary in the VoyageAI documentation. + /// Only for the text_embedding task type. + /// + /// + public float? EmbeddingType { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the VoyageAI documentation for the list of available text embedding and rerank models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from VoyageAI. + /// The voyageai service sets a default number of requests allowed per minute depending on the task type. + /// For both text_embedding and rerank, it is set to 2000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } +} + +public readonly partial struct VoyageAiServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VoyageAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VoyageAiServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The number of dimensions for resulting output embeddings. + /// This setting maps to output_dimension in the VoyageAI documentation. + /// Only for the text_embedding task type. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor Dimensions(int? value) + { + Instance.Dimensions = value; + return this; + } + + /// + /// + /// The data type for the embeddings to be returned. + /// This setting maps to output_dtype in the VoyageAI documentation. + /// Permitted values: float, int8, bit. + /// int8 is a synonym of byte in the VoyageAI documentation. + /// bit is a synonym of binary in the VoyageAI documentation. + /// Only for the text_embedding task type. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor EmbeddingType(float? value) + { + Instance.EmbeddingType = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the VoyageAI documentation for the list of available text embedding and rerank models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from VoyageAI. + /// The voyageai service sets a default number of requests allowed per minute depending on the task type. + /// For both text_embedding and rerank, it is set to 2000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from VoyageAI. + /// The voyageai service sets a default number of requests allowed per minute depending on the task type. + /// For both text_embedding and rerank, it is set to 2000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from VoyageAI. + /// The voyageai service sets a default number of requests allowed per minute depending on the task type. + /// For both text_embedding and rerank, it is set to 2000. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.VoyageAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.VoyageAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAITaskSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAITaskSettings.g.cs new file mode 100644 index 00000000000..185c1c66a86 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/VoyageAITaskSettings.g.cs @@ -0,0 +1,225 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class VoyageAITaskSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInputType = System.Text.Json.JsonEncodedText.Encode("input_type"); + private static readonly System.Text.Json.JsonEncodedText PropReturnDocuments = System.Text.Json.JsonEncodedText.Encode("return_documents"); + private static readonly System.Text.Json.JsonEncodedText PropTopK = System.Text.Json.JsonEncodedText.Encode("top_k"); + private static readonly System.Text.Json.JsonEncodedText PropTruncation = System.Text.Json.JsonEncodedText.Encode("truncation"); + + public override Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInputType = default; + LocalJsonValue propReturnDocuments = default; + LocalJsonValue propTopK = default; + LocalJsonValue propTruncation = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInputType.TryReadProperty(ref reader, options, PropInputType, null)) + { + continue; + } + + if (propReturnDocuments.TryReadProperty(ref reader, options, PropReturnDocuments, null)) + { + continue; + } + + if (propTopK.TryReadProperty(ref reader, options, PropTopK, null)) + { + continue; + } + + if (propTruncation.TryReadProperty(ref reader, options, PropTruncation, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InputType = propInputType.Value, + ReturnDocuments = propReturnDocuments.Value, + TopK = propTopK.Value, + Truncation = propTruncation.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInputType, value.InputType, null, null); + writer.WriteProperty(options, PropReturnDocuments, value.ReturnDocuments, null, null); + writer.WriteProperty(options, PropTopK, value.TopK, null, null); + writer.WriteProperty(options, PropTruncation, value.Truncation, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettingsConverter))] +public sealed partial class VoyageAITaskSettings +{ +#if NET7_0_OR_GREATER + public VoyageAITaskSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public VoyageAITaskSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Type of the input text. + /// Permitted values: ingest (maps to document in the VoyageAI documentation), search (maps to query in the VoyageAI documentation). + /// Only for the text_embedding task type. + /// + /// + public string? InputType { get; set; } + + /// + /// + /// Whether to return the source documents in the response. + /// Only for the rerank task type. + /// + /// + public bool? ReturnDocuments { get; set; } + + /// + /// + /// The number of most relevant documents to return. + /// If not specified, the reranking results of all documents will be returned. + /// Only for the rerank task type. + /// + /// + public int? TopK { get; set; } + + /// + /// + /// Whether to truncate the input texts to fit within the context length. + /// + /// + public bool? Truncation { get; set; } +} + +public readonly partial struct VoyageAiTaskSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VoyageAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VoyageAiTaskSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings instance) => new Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Type of the input text. + /// Permitted values: ingest (maps to document in the VoyageAI documentation), search (maps to query in the VoyageAI documentation). + /// Only for the text_embedding task type. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor InputType(string? value) + { + Instance.InputType = value; + return this; + } + + /// + /// + /// Whether to return the source documents in the response. + /// Only for the rerank task type. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor ReturnDocuments(bool? value = true) + { + Instance.ReturnDocuments = value; + return this; + } + + /// + /// + /// The number of most relevant documents to return. + /// If not specified, the reranking results of all documents will be returned. + /// Only for the rerank task type. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor TopK(int? value) + { + Instance.TopK = value; + return this; + } + + /// + /// + /// Whether to truncate the input texts to fit within the context length. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor Truncation(bool? value = true) + { + Instance.Truncation = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Inference.VoyageAiTaskSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.VoyageAITaskSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/WatsonxServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/WatsonxServiceSettings.g.cs new file mode 100644 index 00000000000..31b8e635846 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/WatsonxServiceSettings.g.cs @@ -0,0 +1,338 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +internal sealed partial class WatsonxServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropApiVersion = System.Text.Json.JsonEncodedText.Encode("api_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropProjectId = System.Text.Json.JsonEncodedText.Encode("project_id"); + private static readonly System.Text.Json.JsonEncodedText PropRateLimit = System.Text.Json.JsonEncodedText.Encode("rate_limit"); + private static readonly System.Text.Json.JsonEncodedText PropUrl = System.Text.Json.JsonEncodedText.Encode("url"); + + public override Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue propApiVersion = default; + LocalJsonValue propModelId = default; + LocalJsonValue propProjectId = default; + LocalJsonValue propRateLimit = default; + LocalJsonValue propUrl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propApiVersion.TryReadProperty(ref reader, options, PropApiVersion, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propProjectId.TryReadProperty(ref reader, options, PropProjectId, null)) + { + continue; + } + + if (propRateLimit.TryReadProperty(ref reader, options, PropRateLimit, null)) + { + continue; + } + + if (propUrl.TryReadProperty(ref reader, options, PropUrl, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + ApiVersion = propApiVersion.Value, + ModelId = propModelId.Value, + ProjectId = propProjectId.Value, + RateLimit = propRateLimit.Value, + Url = propUrl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropApiVersion, value.ApiVersion, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropProjectId, value.ProjectId, null, null); + writer.WriteProperty(options, PropRateLimit, value.RateLimit, null, null); + writer.WriteProperty(options, PropUrl, value.Url, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsConverter))] +public sealed partial class WatsonxServiceSettings +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatsonxServiceSettings(string apiKey, string apiVersion, string modelId, string projectId, string url) + { + ApiKey = apiKey; + ApiVersion = apiVersion; + ModelId = modelId; + ProjectId = projectId; + Url = url; + } +#if NET7_0_OR_GREATER + public WatsonxServiceSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatsonxServiceSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatsonxServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A valid API key of your Watsonx account. + /// You can find your Watsonx API keys or you can create a new one on the API keys page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiKey { get; set; } + + /// + /// + /// A version parameter that takes a version date in the format of YYYY-MM-DD. + /// For the active version data parameters, refer to the Wastonx documentation. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ApiVersion { get; set; } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the IBM Embedding Models section in the Watsonx documentation for the list of available text embedding models. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// The identifier of the IBM Cloud project to use for the inference task. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ProjectId { get; set; } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; } + + /// + /// + /// The URL of the inference endpoint that you created on Watsonx. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Url { get; set; } +} + +public readonly partial struct WatsonxServiceSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatsonxServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatsonxServiceSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings(Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A valid API key of your Watsonx account. + /// You can find your Watsonx API keys or you can create a new one on the API keys page. + /// + /// + /// IMPORTANT: You need to provide the API key only once, during the inference model creation. + /// The get inference endpoint API does not retrieve your API key. + /// After creating the inference model, you cannot change the associated API key. + /// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor ApiKey(string value) + { + Instance.ApiKey = value; + return this; + } + + /// + /// + /// A version parameter that takes a version date in the format of YYYY-MM-DD. + /// For the active version data parameters, refer to the Wastonx documentation. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor ApiVersion(string value) + { + Instance.ApiVersion = value; + return this; + } + + /// + /// + /// The name of the model to use for the inference task. + /// Refer to the IBM Embedding Models section in the Watsonx documentation for the list of available text embedding models. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The identifier of the IBM Cloud project to use for the inference task. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor ProjectId(string value) + { + Instance.ProjectId = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value) + { + Instance.RateLimit = value; + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor RateLimit() + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null); + return this; + } + + /// + /// + /// This setting helps to minimize the number of rate limit errors returned from Watsonx. + /// By default, the watsonxai service sets the number of requests allowed per minute to 120. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor RateLimit(System.Action? action) + { + Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action); + return this; + } + + /// + /// + /// The URL of the inference endpoint that you created on Watsonx. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor Url(string value) + { + Instance.Url = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.WatsonxServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AppendProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AppendProcessor.g.cs index b609af8460c..c0236eabc3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AppendProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AppendProcessor.g.cs @@ -17,24 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class AppendProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowDuplicates = System.Text.Json.JsonEncodedText.Encode("allow_duplicates"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Ingest.AppendProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowDuplicates = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue> propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowDuplicates.TryReadProperty(ref reader, options, PropAllowDuplicates, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowDuplicates = propAllowDuplicates.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.AppendProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowDuplicates, value.AllowDuplicates, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.AppendProcessorConverter))] public sealed partial class AppendProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AppendProcessor(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public AppendProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AppendProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If false, the processor does not append values already present in the field. /// /// - [JsonInclude, JsonPropertyName("allow_duplicates")] public bool? AllowDuplicates { get; set; } /// @@ -43,7 +164,6 @@ public sealed partial class AppendProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -52,23 +172,24 @@ public sealed partial class AppendProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -76,8 +197,7 @@ public sealed partial class AppendProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -85,7 +205,6 @@ public sealed partial class AppendProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,42 +212,41 @@ public sealed partial class AppendProcessor /// The value to be appended. Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("value")] - [SingleOrManyCollectionConverter(typeof(object))] - public ICollection Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(AppendProcessor appendProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Append(appendProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Value { get; set; } } -public sealed partial class AppendProcessorDescriptor : SerializableDescriptor> +public readonly partial struct AppendProcessorDescriptor { - internal AppendProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.AppendProcessor Instance { get; init; } - public AppendProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AppendProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor instance) { + Instance = instance; } - private bool? AllowDuplicatesValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private ICollection ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AppendProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// If false, the processor does not append values already present in the field. /// /// - public AppendProcessorDescriptor AllowDuplicates(bool? allowDuplicates = true) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor AllowDuplicates(bool? value = true) { - AllowDuplicatesValue = allowDuplicates; - return Self; + Instance.AllowDuplicates = value; + return this; } /// @@ -137,10 +255,10 @@ public AppendProcessorDescriptor AllowDuplicates(bool? allowDuplicate /// Useful for describing the purpose of the processor or its configuration. /// /// - public AppendProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -149,10 +267,10 @@ public AppendProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -161,22 +279,21 @@ public AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch. /// Supports template snippets. /// /// - public AppendProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be appended to. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public AppendProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -184,62 +301,71 @@ public AppendProcessorDescriptor Field(Expression /// - public AppendProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public AppendProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public AppendProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public AppendProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public AppendProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public AppendProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -248,10 +374,10 @@ public AppendProcessorDescriptor OnFailure(params Action /// - public AppendProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -259,113 +385,60 @@ public AppendProcessorDescriptor Tag(string? tag) /// The value to be appended. Supports template snippets. /// /// - public AppendProcessorDescriptor Value(ICollection value) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Value(System.Collections.Generic.ICollection value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The value to be appended. Supports template snippets. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Value(params object[] values) { - writer.WriteStartObject(); - if (AllowDuplicatesValue.HasValue) - { - writer.WritePropertyName("allow_duplicates"); - writer.WriteBooleanValue(AllowDuplicatesValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + Instance.Value = [.. values]; + return this; + } - writer.WritePropertyName("value"); - SingleOrManySerializationHelper.Serialize(ValueValue, writer, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.AppendProcessor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AppendProcessorDescriptor : SerializableDescriptor +public readonly partial struct AppendProcessorDescriptor { - internal AppendProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.AppendProcessor Instance { get; init; } - public AppendProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AppendProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor instance) { + Instance = instance; } - private bool? AllowDuplicatesValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private ICollection ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AppendProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// If false, the processor does not append values already present in the field. /// /// - public AppendProcessorDescriptor AllowDuplicates(bool? allowDuplicates = true) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor AllowDuplicates(bool? value = true) { - AllowDuplicatesValue = allowDuplicates; - return Self; + Instance.AllowDuplicates = value; + return this; } /// @@ -374,10 +447,10 @@ public AppendProcessorDescriptor AllowDuplicates(bool? allowDuplicates = true) /// Useful for describing the purpose of the processor or its configuration. /// /// - public AppendProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -386,10 +459,10 @@ public AppendProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -398,22 +471,21 @@ public AppendProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// Supports template snippets. /// /// - public AppendProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be appended to. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public AppendProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -421,10 +493,21 @@ public AppendProcessorDescriptor Field(Expression /// - public AppendProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -432,10 +515,10 @@ public AppendProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public AppendProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -443,40 +526,55 @@ public AppendProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Handle failures for the processor. /// /// - public AppendProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public AppendProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public AppendProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public AppendProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -485,10 +583,10 @@ public AppendProcessorDescriptor OnFailure(params Action /// - public AppendProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -496,80 +594,28 @@ public AppendProcessorDescriptor Tag(string? tag) /// The value to be appended. Supports template snippets. /// /// - public AppendProcessorDescriptor Value(ICollection value) + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Value(System.Collections.Generic.ICollection value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The value to be appended. Supports template snippets. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor Value(params object[] values) { - writer.WriteStartObject(); - if (AllowDuplicatesValue.HasValue) - { - writer.WritePropertyName("allow_duplicates"); - writer.WriteBooleanValue(AllowDuplicatesValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + Instance.Value = [.. values]; + return this; + } - writer.WritePropertyName("value"); - SingleOrManySerializationHelper.Serialize(ValueValue, writer, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.AppendProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.AppendProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AttachmentProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AttachmentProcessor.g.cs index 9f18faaab3c..8a7ccd7b303 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AttachmentProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/AttachmentProcessor.g.cs @@ -17,25 +17,190 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class AttachmentProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropIndexedChars = System.Text.Json.JsonEncodedText.Encode("indexed_chars"); + private static readonly System.Text.Json.JsonEncodedText PropIndexedCharsField = System.Text.Json.JsonEncodedText.Encode("indexed_chars_field"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRemoveBinary = System.Text.Json.JsonEncodedText.Encode("remove_binary"); + private static readonly System.Text.Json.JsonEncodedText PropResourceName = System.Text.Json.JsonEncodedText.Encode("resource_name"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propIndexedChars = default; + LocalJsonValue propIndexedCharsField = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProperties = default; + LocalJsonValue propRemoveBinary = default; + LocalJsonValue propResourceName = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propIndexedChars.TryReadProperty(ref reader, options, PropIndexedChars, null)) + { + continue; + } + + if (propIndexedCharsField.TryReadProperty(ref reader, options, PropIndexedCharsField, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoveBinary.TryReadProperty(ref reader, options, PropRemoveBinary, null)) + { + continue; + } + + if (propResourceName.TryReadProperty(ref reader, options, PropResourceName, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + IndexedChars = propIndexedChars.Value, + IndexedCharsField = propIndexedCharsField.Value, + OnFailure = propOnFailure.Value, + Properties = propProperties.Value, + RemoveBinary = propRemoveBinary.Value, + ResourceName = propResourceName.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropIndexedChars, value.IndexedChars, null, null); + writer.WriteProperty(options, PropIndexedCharsField, value.IndexedCharsField, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoveBinary, value.RemoveBinary, null, null); + writer.WriteProperty(options, PropResourceName, value.ResourceName, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorConverter))] public sealed partial class AttachmentProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AttachmentProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public AttachmentProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AttachmentProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +208,24 @@ public sealed partial class AttachmentProcessor /// The field to get the base64 encoded field from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +233,6 @@ public sealed partial class AttachmentProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -76,7 +241,6 @@ public sealed partial class AttachmentProcessor /// Use -1 for no limit. /// /// - [JsonInclude, JsonPropertyName("indexed_chars")] public long? IndexedChars { get; set; } /// @@ -84,7 +248,6 @@ public sealed partial class AttachmentProcessor /// Field name from which you can overwrite the number of chars being used for extraction. /// /// - [JsonInclude, JsonPropertyName("indexed_chars_field")] public Elastic.Clients.Elasticsearch.Field? IndexedCharsField { get; set; } /// @@ -92,8 +255,7 @@ public sealed partial class AttachmentProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -101,15 +263,13 @@ public sealed partial class AttachmentProcessor /// Can be content, title, name, author, keywords, date, content_type, content_length, language. /// /// - [JsonInclude, JsonPropertyName("properties")] - public ICollection? Properties { get; set; } + public System.Collections.Generic.ICollection? Properties { get; set; } /// /// /// If true, the binary field will be removed from the document /// /// - [JsonInclude, JsonPropertyName("remove_binary")] public bool? RemoveBinary { get; set; } /// @@ -118,7 +278,6 @@ public sealed partial class AttachmentProcessor /// If specified, the processor passes this resource name to the underlying Tika library to enable Resource Name Based Detection. /// /// - [JsonInclude, JsonPropertyName("resource_name")] public string? ResourceName { get; set; } /// @@ -127,7 +286,6 @@ public sealed partial class AttachmentProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -135,36 +293,27 @@ public sealed partial class AttachmentProcessor /// The field that will hold the attachment information. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(AttachmentProcessor attachmentProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Attachment(attachmentProcessor); } -public sealed partial class AttachmentProcessorDescriptor : SerializableDescriptor> +public readonly partial struct AttachmentProcessorDescriptor { - internal AttachmentProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor Instance { get; init; } - public AttachmentProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AttachmentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private long? IndexedCharsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IndexedCharsFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private bool? RemoveBinaryValue { get; set; } - private string? ResourceNameValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AttachmentProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -172,10 +321,10 @@ public AttachmentProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public AttachmentProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -183,10 +332,10 @@ public AttachmentProcessorDescriptor Description(string? description) /// The field to get the base64 encoded field from. /// /// - public AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -194,21 +343,32 @@ public AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsea /// The field to get the base64 encoded field from. /// /// - public AttachmentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the base64 encoded field from. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public AttachmentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -216,10 +376,10 @@ public AttachmentProcessorDescriptor Field(Expression /// - public AttachmentProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -227,10 +387,10 @@ public AttachmentProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public AttachmentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -238,10 +398,10 @@ public AttachmentProcessorDescriptor IgnoreFailure(bool? ignoreFailur /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public AttachmentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -250,10 +410,10 @@ public AttachmentProcessorDescriptor IgnoreMissing(bool? ignoreMissin /// Use -1 for no limit. /// /// - public AttachmentProcessorDescriptor IndexedChars(long? indexedChars) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedChars(long? value) { - IndexedCharsValue = indexedChars; - return Self; + Instance.IndexedChars = value; + return this; } /// @@ -261,10 +421,10 @@ public AttachmentProcessorDescriptor IndexedChars(long? indexedChars) /// Field name from which you can overwrite the number of chars being used for extraction. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Elastic.Clients.Elasticsearch.Field? indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedCharsField(Elastic.Clients.Elasticsearch.Field? value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.IndexedCharsField = value; + return this; } /// @@ -272,21 +432,21 @@ public AttachmentProcessorDescriptor IndexedCharsField(Elastic.Client /// Field name from which you can overwrite the number of chars being used for extraction. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Expression> indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedCharsField(System.Linq.Expressions.Expression> value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.IndexedCharsField = value; + return this; } /// /// - /// Field name from which you can overwrite the number of chars being used for extraction. + /// Handle failures for the processor. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Expression> indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.OnFailure = value; + return this; } /// @@ -294,40 +454,39 @@ public AttachmentProcessorDescriptor IndexedCharsField(Expression /// - public AttachmentProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public AttachmentProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public AttachmentProcessorDescriptor OnFailure(Action> configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = items; + return this; } - public AttachmentProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Array of properties to select to be stored. + /// Can be content, title, name, author, keywords, date, content_type, content_length, language. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Properties = value; + return this; } /// @@ -336,10 +495,10 @@ public AttachmentProcessorDescriptor OnFailure(params Actioncontent, title, name, author, keywords, date, content_type, content_length, language. /// /// - public AttachmentProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Properties(params string[] values) { - PropertiesValue = properties; - return Self; + Instance.Properties = [.. values]; + return this; } /// @@ -347,10 +506,10 @@ public AttachmentProcessorDescriptor Properties(ICollection? /// If true, the binary field will be removed from the document /// /// - public AttachmentProcessorDescriptor RemoveBinary(bool? removeBinary = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor RemoveBinary(bool? value = true) { - RemoveBinaryValue = removeBinary; - return Self; + Instance.RemoveBinary = value; + return this; } /// @@ -359,10 +518,10 @@ public AttachmentProcessorDescriptor RemoveBinary(bool? removeBinary /// If specified, the processor passes this resource name to the underlying Tika library to enable Resource Name Based Detection. /// /// - public AttachmentProcessorDescriptor ResourceName(string? resourceName) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor ResourceName(string? value) { - ResourceNameValue = resourceName; - return Self; + Instance.ResourceName = value; + return this; } /// @@ -371,10 +530,10 @@ public AttachmentProcessorDescriptor ResourceName(string? resourceNam /// Useful for debugging and metrics. /// /// - public AttachmentProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -382,10 +541,10 @@ public AttachmentProcessorDescriptor Tag(string? tag) /// The field that will hold the attachment information. /// /// - public AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -393,153 +552,39 @@ public AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elas /// The field that will hold the attachment information. /// /// - public AttachmentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// The field that will hold the attachment information. - /// - /// - public AttachmentProcessorDescriptor TargetField(Expression> targetField) - { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (IndexedCharsValue.HasValue) - { - writer.WritePropertyName("indexed_chars"); - writer.WriteNumberValue(IndexedCharsValue.Value); - } - - if (IndexedCharsFieldValue is not null) - { - writer.WritePropertyName("indexed_chars_field"); - JsonSerializer.Serialize(writer, IndexedCharsFieldValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (RemoveBinaryValue.HasValue) - { - writer.WritePropertyName("remove_binary"); - writer.WriteBooleanValue(RemoveBinaryValue.Value); - } - - if (!string.IsNullOrEmpty(ResourceNameValue)) - { - writer.WritePropertyName("resource_name"); - writer.WriteStringValue(ResourceNameValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AttachmentProcessorDescriptor : SerializableDescriptor +public readonly partial struct AttachmentProcessorDescriptor { - internal AttachmentProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor Instance { get; init; } - public AttachmentProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AttachmentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private long? IndexedCharsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IndexedCharsFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private bool? RemoveBinaryValue { get; set; } - private string? ResourceNameValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AttachmentProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -547,10 +592,10 @@ public AttachmentProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public AttachmentProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -558,10 +603,10 @@ public AttachmentProcessorDescriptor Description(string? description) /// The field to get the base64 encoded field from. /// /// - public AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -569,21 +614,21 @@ public AttachmentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// The field to get the base64 encoded field from. /// /// - public AttachmentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the base64 encoded field from. + /// Conditionally execute the processor. /// /// - public AttachmentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -591,10 +636,21 @@ public AttachmentProcessorDescriptor Field(Expression /// - public AttachmentProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -602,10 +658,10 @@ public AttachmentProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public AttachmentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -613,10 +669,10 @@ public AttachmentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public AttachmentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -625,10 +681,10 @@ public AttachmentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Use -1 for no limit. /// /// - public AttachmentProcessorDescriptor IndexedChars(long? indexedChars) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedChars(long? value) { - IndexedCharsValue = indexedChars; - return Self; + Instance.IndexedChars = value; + return this; } /// @@ -636,10 +692,10 @@ public AttachmentProcessorDescriptor IndexedChars(long? indexedChars) /// Field name from which you can overwrite the number of chars being used for extraction. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Elastic.Clients.Elasticsearch.Field? indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedCharsField(Elastic.Clients.Elasticsearch.Field? value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.IndexedCharsField = value; + return this; } /// @@ -647,21 +703,21 @@ public AttachmentProcessorDescriptor IndexedCharsField(Elastic.Clients.Elasticse /// Field name from which you can overwrite the number of chars being used for extraction. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Expression> indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor IndexedCharsField(System.Linq.Expressions.Expression> value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.IndexedCharsField = value; + return this; } /// /// - /// Field name from which you can overwrite the number of chars being used for extraction. + /// Handle failures for the processor. /// /// - public AttachmentProcessorDescriptor IndexedCharsField(Expression> indexedCharsField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - IndexedCharsFieldValue = indexedCharsField; - return Self; + Instance.OnFailure = value; + return this; } /// @@ -669,40 +725,44 @@ public AttachmentProcessorDescriptor IndexedCharsField(Expression /// - public AttachmentProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public AttachmentProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public AttachmentProcessorDescriptor OnFailure(Action configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = items; + return this; } - public AttachmentProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -711,56 +771,57 @@ public AttachmentProcessorDescriptor OnFailure(params Actioncontent, title, name, author, keywords, date, content_type, content_length, language. /// /// - public AttachmentProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// If true, the binary field will be removed from the document + /// Array of properties to select to be stored. + /// Can be content, title, name, author, keywords, date, content_type, content_length, language. /// /// - public AttachmentProcessorDescriptor RemoveBinary(bool? removeBinary = true) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Properties(params string[] values) { - RemoveBinaryValue = removeBinary; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// Field containing the name of the resource to decode. - /// If specified, the processor passes this resource name to the underlying Tika library to enable Resource Name Based Detection. + /// If true, the binary field will be removed from the document /// /// - public AttachmentProcessorDescriptor ResourceName(string? resourceName) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor RemoveBinary(bool? value = true) { - ResourceNameValue = resourceName; - return Self; + Instance.RemoveBinary = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Field containing the name of the resource to decode. + /// If specified, the processor passes this resource name to the underlying Tika library to enable Resource Name Based Detection. /// /// - public AttachmentProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor ResourceName(string? value) { - TagValue = tag; - return Self; + Instance.ResourceName = value; + return this; } /// /// - /// The field that will hold the attachment information. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -768,10 +829,10 @@ public AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.F /// The field that will hold the attachment information. /// /// - public AttachmentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -779,114 +840,17 @@ public AttachmentProcessorDescriptor TargetField(Expression /// - public AttachmentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (IndexedCharsValue.HasValue) - { - writer.WritePropertyName("indexed_chars"); - writer.WriteNumberValue(IndexedCharsValue.Value); - } - - if (IndexedCharsFieldValue is not null) - { - writer.WritePropertyName("indexed_chars_field"); - JsonSerializer.Serialize(writer, IndexedCharsFieldValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (RemoveBinaryValue.HasValue) - { - writer.WritePropertyName("remove_binary"); - writer.WriteBooleanValue(RemoveBinaryValue.Value); - } - - if (!string.IsNullOrEmpty(ResourceNameValue)) - { - writer.WritePropertyName("resource_name"); - writer.WriteStringValue(ResourceNameValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/BytesProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/BytesProcessor.g.cs index 09f2d5320ed..59bc1c66bb9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/BytesProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/BytesProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class BytesProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.BytesProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.BytesProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.BytesProcessorConverter))] public sealed partial class BytesProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BytesProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public BytesProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BytesProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class BytesProcessor /// The field to convert. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class BytesProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class BytesProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class BytesProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class BytesProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(BytesProcessor bytesProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Bytes(bytesProcessor); } -public sealed partial class BytesProcessorDescriptor : SerializableDescriptor> +public readonly partial struct BytesProcessorDescriptor { - internal BytesProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.BytesProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BytesProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor instance) + { + Instance = instance; + } - public BytesProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BytesProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public BytesProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public BytesProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public BytesProcessorDescriptor Description(string? description) /// The field to convert. /// /// - public BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.F /// The field to convert. /// /// - public BytesProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to convert. + /// Conditionally execute the processor. /// /// - public BytesProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public BytesProcessorDescriptor Field(Expression /// - public BytesProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public BytesProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public BytesProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public BytesProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public BytesProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public BytesProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public BytesProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public BytesProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticse /// By default, the field is updated in-place. /// /// - public BytesProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public BytesProcessorDescriptor TargetField(Expression /// - public BytesProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.BytesProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class BytesProcessorDescriptor : SerializableDescriptor +public readonly partial struct BytesProcessorDescriptor { - internal BytesProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.BytesProcessor Instance { get; init; } - public BytesProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BytesProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BytesProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public BytesProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public BytesProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public BytesProcessorDescriptor Description(string? description) /// The field to convert. /// /// - public BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public BytesProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to convert. /// /// - public BytesProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to convert. + /// Conditionally execute the processor. /// /// - public BytesProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public BytesProcessorDescriptor Field(Expression /// - public BytesProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public BytesProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public BytesProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public BytesProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public BytesProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public BytesProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public BytesProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public BytesProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public BytesProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public BytesProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public BytesProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public BytesProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public BytesProcessorDescriptor TargetField(Expression /// - public BytesProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.BytesProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.BytesProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CircleProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CircleProcessor.g.cs index b18cd987e1c..940a2538649 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CircleProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CircleProcessor.g.cs @@ -17,25 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class CircleProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropErrorDistance = System.Text.Json.JsonEncodedText.Encode("error_distance"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropShapeType = System.Text.Json.JsonEncodedText.Encode("shape_type"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.CircleProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propErrorDistance = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propShapeType = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propErrorDistance.TryReadProperty(ref reader, options, PropErrorDistance, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propShapeType.TryReadProperty(ref reader, options, PropShapeType, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + ErrorDistance = propErrorDistance.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + ShapeType = propShapeType.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.CircleProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropErrorDistance, value.ErrorDistance, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShapeType, value.ShapeType, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.CircleProcessorConverter))] public sealed partial class CircleProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CircleProcessor(double errorDistance, Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Ingest.ShapeType shapeType) + { + ErrorDistance = errorDistance; + Field = field; + ShapeType = shapeType; + } +#if NET7_0_OR_GREATER + public CircleProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CircleProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,31 +183,35 @@ public sealed partial class CircleProcessor /// The difference between the resulting inscribed distance from center to side and the circle’s radius (measured in meters for geo_shape, unit-less for shape). /// /// - [JsonInclude, JsonPropertyName("error_distance")] - public double ErrorDistance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ErrorDistance { get; set; } /// /// /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -75,7 +219,6 @@ public sealed partial class CircleProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -83,16 +226,18 @@ public sealed partial class CircleProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Which field mapping type is to be used when processing the circle: geo_shape or shape. /// /// - [JsonInclude, JsonPropertyName("shape_type")] - public Elastic.Clients.Elasticsearch.Ingest.ShapeType ShapeType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.ShapeType ShapeType { get; set; } /// /// @@ -100,7 +245,6 @@ public sealed partial class CircleProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -109,33 +253,27 @@ public sealed partial class CircleProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(CircleProcessor circleProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Circle(circleProcessor); } -public sealed partial class CircleProcessorDescriptor : SerializableDescriptor> +public readonly partial struct CircleProcessorDescriptor { - internal CircleProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CircleProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CircleProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor instance) + { + Instance = instance; + } - public CircleProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CircleProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private double ErrorDistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ShapeType ShapeTypeValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -143,10 +281,10 @@ public CircleProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public CircleProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -154,10 +292,10 @@ public CircleProcessorDescriptor Description(string? description) /// The difference between the resulting inscribed distance from center to side and the circle’s radius (measured in meters for geo_shape, unit-less for shape). /// /// - public CircleProcessorDescriptor ErrorDistance(double errorDistance) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor ErrorDistance(double value) { - ErrorDistanceValue = errorDistance; - return Self; + Instance.ErrorDistance = value; + return this; } /// @@ -165,10 +303,10 @@ public CircleProcessorDescriptor ErrorDistance(double errorDistance) /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. /// /// - public CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -176,21 +314,21 @@ public CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch. /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. /// /// - public CircleProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. + /// Conditionally execute the processor. /// /// - public CircleProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -198,10 +336,21 @@ public CircleProcessorDescriptor Field(Expression /// - public CircleProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -209,10 +358,10 @@ public CircleProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CircleProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -220,10 +369,10 @@ public CircleProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public CircleProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -231,40 +380,38 @@ public CircleProcessorDescriptor IgnoreMissing(bool? ignoreMissing = /// Handle failures for the processor. /// /// - public CircleProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public CircleProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public CircleProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public CircleProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -272,10 +419,10 @@ public CircleProcessorDescriptor OnFailure(params Actiongeo_shape or shape. /// /// - public CircleProcessorDescriptor ShapeType(Elastic.Clients.Elasticsearch.Ingest.ShapeType shapeType) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor ShapeType(Elastic.Clients.Elasticsearch.Ingest.ShapeType value) { - ShapeTypeValue = shapeType; - return Self; + Instance.ShapeType = value; + return this; } /// @@ -284,10 +431,10 @@ public CircleProcessorDescriptor ShapeType(Elastic.Clients.Elasticsea /// Useful for debugging and metrics. /// /// - public CircleProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -296,10 +443,10 @@ public CircleProcessorDescriptor Tag(string? tag) /// By default, the field is updated in-place. /// /// - public CircleProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -308,125 +455,39 @@ public CircleProcessorDescriptor TargetField(Elastic.Clients.Elastics /// By default, the field is updated in-place. /// /// - public CircleProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// The field to assign the polygon shape to - /// By default, the field is updated in-place. - /// - /// - public CircleProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CircleProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("error_distance"); - writer.WriteNumberValue(ErrorDistanceValue); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("shape_type"); - JsonSerializer.Serialize(writer, ShapeTypeValue, options); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CircleProcessorDescriptor : SerializableDescriptor +public readonly partial struct CircleProcessorDescriptor { - internal CircleProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CircleProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CircleProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor instance) + { + Instance = instance; + } - public CircleProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CircleProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private double ErrorDistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ShapeType ShapeTypeValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -434,10 +495,10 @@ public CircleProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public CircleProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -445,10 +506,10 @@ public CircleProcessorDescriptor Description(string? description) /// The difference between the resulting inscribed distance from center to side and the circle’s radius (measured in meters for geo_shape, unit-less for shape). /// /// - public CircleProcessorDescriptor ErrorDistance(double errorDistance) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor ErrorDistance(double value) { - ErrorDistanceValue = errorDistance; - return Self; + Instance.ErrorDistance = value; + return this; } /// @@ -456,10 +517,10 @@ public CircleProcessorDescriptor ErrorDistance(double errorDistance) /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. /// /// - public CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -467,21 +528,32 @@ public CircleProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. /// /// - public CircleProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to interpret as a circle. Either a string in WKT format or a map for GeoJSON. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public CircleProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -489,10 +561,10 @@ public CircleProcessorDescriptor Field(Expression /// - public CircleProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -500,10 +572,10 @@ public CircleProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CircleProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -511,10 +583,10 @@ public CircleProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public CircleProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -522,75 +594,78 @@ public CircleProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public CircleProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public CircleProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public CircleProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public CircleProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Which field mapping type is to be used when processing the circle: geo_shape or shape. + /// Handle failures for the processor. /// /// - public CircleProcessorDescriptor ShapeType(Elastic.Clients.Elasticsearch.Ingest.ShapeType shapeType) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor OnFailure(params System.Action>[] actions) { - ShapeTypeValue = shapeType; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Which field mapping type is to be used when processing the circle: geo_shape or shape. /// /// - public CircleProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor ShapeType(Elastic.Clients.Elasticsearch.Ingest.ShapeType value) { - TagValue = tag; - return Self; + Instance.ShapeType = value; + return this; } /// /// - /// The field to assign the polygon shape to - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public CircleProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -599,10 +674,10 @@ public CircleProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field /// By default, the field is updated in-place. /// /// - public CircleProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -611,88 +686,17 @@ public CircleProcessorDescriptor TargetField(Expression /// - public CircleProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CircleProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("error_distance"); - writer.WriteNumberValue(ErrorDistanceValue); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("shape_type"); - JsonSerializer.Serialize(writer, ShapeTypeValue, options); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CircleProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CommunityIDProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CommunityIDProcessor.g.cs index 5b12c5802f2..1c8cce666d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CommunityIDProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CommunityIDProcessor.g.cs @@ -17,25 +17,211 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class CommunityIDProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDestinationIp = System.Text.Json.JsonEncodedText.Encode("destination_ip"); + private static readonly System.Text.Json.JsonEncodedText PropDestinationPort = System.Text.Json.JsonEncodedText.Encode("destination_port"); + private static readonly System.Text.Json.JsonEncodedText PropIanaNumber = System.Text.Json.JsonEncodedText.Encode("iana_number"); + private static readonly System.Text.Json.JsonEncodedText PropIcmpCode = System.Text.Json.JsonEncodedText.Encode("icmp_code"); + private static readonly System.Text.Json.JsonEncodedText PropIcmpType = System.Text.Json.JsonEncodedText.Encode("icmp_type"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropSeed = System.Text.Json.JsonEncodedText.Encode("seed"); + private static readonly System.Text.Json.JsonEncodedText PropSourceIp = System.Text.Json.JsonEncodedText.Encode("source_ip"); + private static readonly System.Text.Json.JsonEncodedText PropSourcePort = System.Text.Json.JsonEncodedText.Encode("source_port"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + + public override Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDestinationIp = default; + LocalJsonValue propDestinationPort = default; + LocalJsonValue propIanaNumber = default; + LocalJsonValue propIcmpCode = default; + LocalJsonValue propIcmpType = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propSeed = default; + LocalJsonValue propSourceIp = default; + LocalJsonValue propSourcePort = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propTransport = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDestinationIp.TryReadProperty(ref reader, options, PropDestinationIp, null)) + { + continue; + } + + if (propDestinationPort.TryReadProperty(ref reader, options, PropDestinationPort, null)) + { + continue; + } + + if (propIanaNumber.TryReadProperty(ref reader, options, PropIanaNumber, null)) + { + continue; + } + + if (propIcmpCode.TryReadProperty(ref reader, options, PropIcmpCode, null)) + { + continue; + } + + if (propIcmpType.TryReadProperty(ref reader, options, PropIcmpType, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSeed.TryReadProperty(ref reader, options, PropSeed, null)) + { + continue; + } + + if (propSourceIp.TryReadProperty(ref reader, options, PropSourceIp, null)) + { + continue; + } + + if (propSourcePort.TryReadProperty(ref reader, options, PropSourcePort, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + DestinationIp = propDestinationIp.Value, + DestinationPort = propDestinationPort.Value, + IanaNumber = propIanaNumber.Value, + IcmpCode = propIcmpCode.Value, + IcmpType = propIcmpType.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Seed = propSeed.Value, + SourceIp = propSourceIp.Value, + SourcePort = propSourcePort.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value, + Transport = propTransport.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDestinationIp, value.DestinationIp, null, null); + writer.WriteProperty(options, PropDestinationPort, value.DestinationPort, null, null); + writer.WriteProperty(options, PropIanaNumber, value.IanaNumber, null, null); + writer.WriteProperty(options, PropIcmpCode, value.IcmpCode, null, null); + writer.WriteProperty(options, PropIcmpType, value.IcmpType, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeed, value.Seed, null, null); + writer.WriteProperty(options, PropSourceIp, value.SourceIp, null, null); + writer.WriteProperty(options, PropSourcePort, value.SourcePort, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessorConverter))] public sealed partial class CommunityIDProcessor { +#if NET7_0_OR_GREATER + public CommunityIDProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public CommunityIDProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,7 +229,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the destination IP address. /// /// - [JsonInclude, JsonPropertyName("destination_ip")] public Elastic.Clients.Elasticsearch.Field? DestinationIp { get; set; } /// @@ -51,7 +236,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the destination port. /// /// - [JsonInclude, JsonPropertyName("destination_port")] public Elastic.Clients.Elasticsearch.Field? DestinationPort { get; set; } /// @@ -59,7 +243,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the IANA number. /// /// - [JsonInclude, JsonPropertyName("iana_number")] public Elastic.Clients.Elasticsearch.Field? IanaNumber { get; set; } /// @@ -67,7 +250,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the ICMP code. /// /// - [JsonInclude, JsonPropertyName("icmp_code")] public Elastic.Clients.Elasticsearch.Field? IcmpCode { get; set; } /// @@ -75,7 +257,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the ICMP type. /// /// - [JsonInclude, JsonPropertyName("icmp_type")] public Elastic.Clients.Elasticsearch.Field? IcmpType { get; set; } /// @@ -83,15 +264,13 @@ public sealed partial class CommunityIDProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -100,7 +279,6 @@ public sealed partial class CommunityIDProcessor /// without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -108,8 +286,7 @@ public sealed partial class CommunityIDProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -118,7 +295,6 @@ public sealed partial class CommunityIDProcessor /// and production network that use the same addressing scheme. /// /// - [JsonInclude, JsonPropertyName("seed")] public int? Seed { get; set; } /// @@ -126,7 +302,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the source IP address. /// /// - [JsonInclude, JsonPropertyName("source_ip")] public Elastic.Clients.Elasticsearch.Field? SourceIp { get; set; } /// @@ -134,7 +309,6 @@ public sealed partial class CommunityIDProcessor /// Field containing the source port. /// /// - [JsonInclude, JsonPropertyName("source_port")] public Elastic.Clients.Elasticsearch.Field? SourcePort { get; set; } /// @@ -143,7 +317,6 @@ public sealed partial class CommunityIDProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -151,7 +324,6 @@ public sealed partial class CommunityIDProcessor /// Output field for the community ID. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -161,72 +333,38 @@ public sealed partial class CommunityIDProcessor /// supported: eigrp, gre, icmp, icmpv6, igmp, ipv6-icmp, ospf, pim, sctp, tcp, udp /// /// - [JsonInclude, JsonPropertyName("transport")] public Elastic.Clients.Elasticsearch.Field? Transport { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(CommunityIDProcessor communityIDProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.CommunityId(communityIDProcessor); } -public sealed partial class CommunityIDProcessorDescriptor : SerializableDescriptor> +public readonly partial struct CommunityIdProcessorDescriptor { - internal CommunityIDProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor Instance { get; init; } - public CommunityIDProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommunityIdProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationIpValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationPortValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IanaNumberValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IcmpCodeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IcmpTypeValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private int? SeedValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourceIpValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourcePortValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TransportValue { get; set; } - - /// - /// - /// Description of the processor. - /// Useful for describing the purpose of the processor or its configuration. - /// - /// - public CommunityIDProcessorDescriptor Description(string? description) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommunityIdProcessorDescriptor() { - DescriptionValue = description; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - /// - /// - /// Field containing the destination IP address. - /// - /// - public CommunityIDProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? destinationIp) - { - DestinationIpValue = destinationIp; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor descriptor) => descriptor.Instance; /// /// - /// Field containing the destination IP address. + /// Description of the processor. + /// Useful for describing the purpose of the processor or its configuration. /// /// - public CommunityIDProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Description(string? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.Description = value; + return this; } /// @@ -234,21 +372,21 @@ public CommunityIDProcessorDescriptor DestinationIp(Expressio /// Field containing the destination IP address. /// /// - public CommunityIDProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// /// - /// Field containing the destination port. + /// Field containing the destination IP address. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Elastic.Clients.Elasticsearch.Field? destinationPort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationIp(System.Linq.Expressions.Expression> value) { - DestinationPortValue = destinationPort; - return Self; + Instance.DestinationIp = value; + return this; } /// @@ -256,10 +394,10 @@ public CommunityIDProcessorDescriptor DestinationPort(Elastic.Clients /// Field containing the destination port. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Expression> destinationPort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationPort(Elastic.Clients.Elasticsearch.Field? value) { - DestinationPortValue = destinationPort; - return Self; + Instance.DestinationPort = value; + return this; } /// @@ -267,21 +405,10 @@ public CommunityIDProcessorDescriptor DestinationPort(Express /// Field containing the destination port. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Expression> destinationPort) - { - DestinationPortValue = destinationPort; - return Self; - } - - /// - /// - /// Field containing the IANA number. - /// - /// - public CommunityIDProcessorDescriptor IanaNumber(Elastic.Clients.Elasticsearch.Field? ianaNumber) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationPort(System.Linq.Expressions.Expression> value) { - IanaNumberValue = ianaNumber; - return Self; + Instance.DestinationPort = value; + return this; } /// @@ -289,10 +416,10 @@ public CommunityIDProcessorDescriptor IanaNumber(Elastic.Clients.Elas /// Field containing the IANA number. /// /// - public CommunityIDProcessorDescriptor IanaNumber(Expression> ianaNumber) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IanaNumber(Elastic.Clients.Elasticsearch.Field? value) { - IanaNumberValue = ianaNumber; - return Self; + Instance.IanaNumber = value; + return this; } /// @@ -300,10 +427,10 @@ public CommunityIDProcessorDescriptor IanaNumber(Expression /// - public CommunityIDProcessorDescriptor IanaNumber(Expression> ianaNumber) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IanaNumber(System.Linq.Expressions.Expression> value) { - IanaNumberValue = ianaNumber; - return Self; + Instance.IanaNumber = value; + return this; } /// @@ -311,10 +438,10 @@ public CommunityIDProcessorDescriptor IanaNumber(Expression /// - public CommunityIDProcessorDescriptor IcmpCode(Elastic.Clients.Elasticsearch.Field? icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpCode(Elastic.Clients.Elasticsearch.Field? value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpCode = value; + return this; } /// @@ -322,21 +449,21 @@ public CommunityIDProcessorDescriptor IcmpCode(Elastic.Clients.Elasti /// Field containing the ICMP code. /// /// - public CommunityIDProcessorDescriptor IcmpCode(Expression> icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpCode(System.Linq.Expressions.Expression> value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpCode = value; + return this; } /// /// - /// Field containing the ICMP code. + /// Field containing the ICMP type. /// /// - public CommunityIDProcessorDescriptor IcmpCode(Expression> icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpType(Elastic.Clients.Elasticsearch.Field? value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpType = value; + return this; } /// @@ -344,32 +471,32 @@ public CommunityIDProcessorDescriptor IcmpCode(Expression /// - public CommunityIDProcessorDescriptor IcmpType(Elastic.Clients.Elasticsearch.Field? icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpType(System.Linq.Expressions.Expression> value) { - IcmpTypeValue = icmpType; - return Self; + Instance.IcmpType = value; + return this; } /// /// - /// Field containing the ICMP type. + /// Conditionally execute the processor. /// /// - public CommunityIDProcessorDescriptor IcmpType(Expression> icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IcmpTypeValue = icmpType; - return Self; + Instance.If = value; + return this; } /// /// - /// Field containing the ICMP type. + /// Conditionally execute the processor. /// /// - public CommunityIDProcessorDescriptor IcmpType(Expression> icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If() { - IcmpTypeValue = icmpType; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -377,10 +504,10 @@ public CommunityIDProcessorDescriptor IcmpType(Expression /// - public CommunityIDProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -388,10 +515,10 @@ public CommunityIDProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CommunityIDProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -400,10 +527,10 @@ public CommunityIDProcessorDescriptor IgnoreFailure(bool? ignoreFailu /// without modifying the document. /// /// - public CommunityIDProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -411,75 +538,51 @@ public CommunityIDProcessorDescriptor IgnoreMissing(bool? ignoreMissi /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(Action> configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Seed for the community ID hash. Must be between 0 and 65535 (inclusive). The - /// seed can prevent hash collisions between network domains, such as a staging - /// and production network that use the same addressing scheme. + /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor Seed(int? seed) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - SeedValue = seed; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(params System.Action>[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Field containing the source IP address. + /// Seed for the community ID hash. Must be between 0 and 65535 (inclusive). The + /// seed can prevent hash collisions between network domains, such as a staging + /// and production network that use the same addressing scheme. /// /// - public CommunityIDProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Seed(int? value) { - SourceIpValue = sourceIp; - return Self; + Instance.Seed = value; + return this; } /// @@ -487,21 +590,21 @@ public CommunityIDProcessorDescriptor SourceIp(Expression /// - public CommunityIDProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? value) { - SourceIpValue = sourceIp; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Field containing the source port. + /// Field containing the source IP address. /// /// - public CommunityIDProcessorDescriptor SourcePort(Elastic.Clients.Elasticsearch.Field? sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourceIp(System.Linq.Expressions.Expression> value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourceIp = value; + return this; } /// @@ -509,10 +612,10 @@ public CommunityIDProcessorDescriptor SourcePort(Elastic.Clients.Elas /// Field containing the source port. /// /// - public CommunityIDProcessorDescriptor SourcePort(Expression> sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourcePort(Elastic.Clients.Elasticsearch.Field? value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourcePort = value; + return this; } /// @@ -520,10 +623,10 @@ public CommunityIDProcessorDescriptor SourcePort(Expression /// - public CommunityIDProcessorDescriptor SourcePort(Expression> sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourcePort(System.Linq.Expressions.Expression> value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourcePort = value; + return this; } /// @@ -532,10 +635,10 @@ public CommunityIDProcessorDescriptor SourcePort(Expression /// - public CommunityIDProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -543,10 +646,10 @@ public CommunityIDProcessorDescriptor Tag(string? tag) /// Output field for the community ID. /// /// - public CommunityIDProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -554,21 +657,10 @@ public CommunityIDProcessorDescriptor TargetField(Elastic.Clients.Ela /// Output field for the community ID. /// /// - public CommunityIDProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; - } - - /// - /// - /// Output field for the community ID. - /// - /// - public CommunityIDProcessorDescriptor TargetField(Expression> targetField) - { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -578,10 +670,10 @@ public CommunityIDProcessorDescriptor TargetField(Expression /// - public CommunityIDProcessorDescriptor Transport(Elastic.Clients.Elasticsearch.Field? transport) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Transport(Elastic.Clients.Elasticsearch.Field? value) { - TransportValue = transport; - return Self; + Instance.Transport = value; + return this; } /// @@ -591,213 +683,55 @@ public CommunityIDProcessorDescriptor Transport(Elastic.Clients.Elast /// supported: eigrp, gre, icmp, icmpv6, igmp, ipv6-icmp, ospf, pim, sctp, tcp, udp /// /// - public CommunityIDProcessorDescriptor Transport(Expression> transport) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Transport(System.Linq.Expressions.Expression> value) { - TransportValue = transport; - return Self; + Instance.Transport = value; + return this; } - /// - /// - /// Field containing the transport protocol name or number. Used only when the - /// iana_number field is not present. The following protocol names are currently - /// supported: eigrp, gre, icmp, icmpv6, igmp, ipv6-icmp, ospf, pim, sctp, tcp, udp - /// - /// - public CommunityIDProcessorDescriptor Transport(Expression> transport) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor Build(System.Action>? action) { - TransportValue = transport; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestinationIpValue is not null) - { - writer.WritePropertyName("destination_ip"); - JsonSerializer.Serialize(writer, DestinationIpValue, options); - } - - if (DestinationPortValue is not null) - { - writer.WritePropertyName("destination_port"); - JsonSerializer.Serialize(writer, DestinationPortValue, options); - } - - if (IanaNumberValue is not null) - { - writer.WritePropertyName("iana_number"); - JsonSerializer.Serialize(writer, IanaNumberValue, options); - } - - if (IcmpCodeValue is not null) + if (action is null) { - writer.WritePropertyName("icmp_code"); - JsonSerializer.Serialize(writer, IcmpCodeValue, options); + return new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IcmpTypeValue is not null) - { - writer.WritePropertyName("icmp_type"); - JsonSerializer.Serialize(writer, IcmpTypeValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (SeedValue.HasValue) - { - writer.WritePropertyName("seed"); - writer.WriteNumberValue(SeedValue.Value); - } - - if (SourceIpValue is not null) - { - writer.WritePropertyName("source_ip"); - JsonSerializer.Serialize(writer, SourceIpValue, options); - } - - if (SourcePortValue is not null) - { - writer.WritePropertyName("source_port"); - JsonSerializer.Serialize(writer, SourcePortValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TransportValue is not null) - { - writer.WritePropertyName("transport"); - JsonSerializer.Serialize(writer, TransportValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CommunityIDProcessorDescriptor : SerializableDescriptor +public readonly partial struct CommunityIdProcessorDescriptor { - internal CommunityIDProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor Instance { get; init; } - public CommunityIDProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommunityIdProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationIpValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationPortValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IanaNumberValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IcmpCodeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? IcmpTypeValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private int? SeedValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourceIpValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourcePortValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TransportValue { get; set; } - - /// - /// - /// Description of the processor. - /// Useful for describing the purpose of the processor or its configuration. - /// - /// - public CommunityIDProcessorDescriptor Description(string? description) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommunityIdProcessorDescriptor() { - DescriptionValue = description; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - /// - /// - /// Field containing the destination IP address. - /// - /// - public CommunityIDProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? destinationIp) - { - DestinationIpValue = destinationIp; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor descriptor) => descriptor.Instance; /// /// - /// Field containing the destination IP address. + /// Description of the processor. + /// Useful for describing the purpose of the processor or its configuration. /// /// - public CommunityIDProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Description(string? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.Description = value; + return this; } /// @@ -805,21 +739,21 @@ public CommunityIDProcessorDescriptor DestinationIp(Expressio /// Field containing the destination IP address. /// /// - public CommunityIDProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// /// - /// Field containing the destination port. + /// Field containing the destination IP address. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Elastic.Clients.Elasticsearch.Field? destinationPort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationIp(System.Linq.Expressions.Expression> value) { - DestinationPortValue = destinationPort; - return Self; + Instance.DestinationIp = value; + return this; } /// @@ -827,10 +761,10 @@ public CommunityIDProcessorDescriptor DestinationPort(Elastic.Clients.Elasticsea /// Field containing the destination port. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Expression> destinationPort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationPort(Elastic.Clients.Elasticsearch.Field? value) { - DestinationPortValue = destinationPort; - return Self; + Instance.DestinationPort = value; + return this; } /// @@ -838,10 +772,10 @@ public CommunityIDProcessorDescriptor DestinationPort(Express /// Field containing the destination port. /// /// - public CommunityIDProcessorDescriptor DestinationPort(Expression> destinationPort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor DestinationPort(System.Linq.Expressions.Expression> value) { - DestinationPortValue = destinationPort; - return Self; + Instance.DestinationPort = value; + return this; } /// @@ -849,10 +783,10 @@ public CommunityIDProcessorDescriptor DestinationPort(Expression /// - public CommunityIDProcessorDescriptor IanaNumber(Elastic.Clients.Elasticsearch.Field? ianaNumber) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IanaNumber(Elastic.Clients.Elasticsearch.Field? value) { - IanaNumberValue = ianaNumber; - return Self; + Instance.IanaNumber = value; + return this; } /// @@ -860,21 +794,10 @@ public CommunityIDProcessorDescriptor IanaNumber(Elastic.Clients.Elasticsearch.F /// Field containing the IANA number. /// /// - public CommunityIDProcessorDescriptor IanaNumber(Expression> ianaNumber) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IanaNumber(System.Linq.Expressions.Expression> value) { - IanaNumberValue = ianaNumber; - return Self; - } - - /// - /// - /// Field containing the IANA number. - /// - /// - public CommunityIDProcessorDescriptor IanaNumber(Expression> ianaNumber) - { - IanaNumberValue = ianaNumber; - return Self; + Instance.IanaNumber = value; + return this; } /// @@ -882,10 +805,10 @@ public CommunityIDProcessorDescriptor IanaNumber(Expression /// - public CommunityIDProcessorDescriptor IcmpCode(Elastic.Clients.Elasticsearch.Field? icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpCode(Elastic.Clients.Elasticsearch.Field? value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpCode = value; + return this; } /// @@ -893,21 +816,21 @@ public CommunityIDProcessorDescriptor IcmpCode(Elastic.Clients.Elasticsearch.Fie /// Field containing the ICMP code. /// /// - public CommunityIDProcessorDescriptor IcmpCode(Expression> icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpCode(System.Linq.Expressions.Expression> value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpCode = value; + return this; } /// /// - /// Field containing the ICMP code. + /// Field containing the ICMP type. /// /// - public CommunityIDProcessorDescriptor IcmpCode(Expression> icmpCode) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpType(Elastic.Clients.Elasticsearch.Field? value) { - IcmpCodeValue = icmpCode; - return Self; + Instance.IcmpType = value; + return this; } /// @@ -915,32 +838,32 @@ public CommunityIDProcessorDescriptor IcmpCode(Expression /// - public CommunityIDProcessorDescriptor IcmpType(Elastic.Clients.Elasticsearch.Field? icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IcmpType(System.Linq.Expressions.Expression> value) { - IcmpTypeValue = icmpType; - return Self; + Instance.IcmpType = value; + return this; } /// /// - /// Field containing the ICMP type. + /// Conditionally execute the processor. /// /// - public CommunityIDProcessorDescriptor IcmpType(Expression> icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IcmpTypeValue = icmpType; - return Self; + Instance.If = value; + return this; } /// /// - /// Field containing the ICMP type. + /// Conditionally execute the processor. /// /// - public CommunityIDProcessorDescriptor IcmpType(Expression> icmpType) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If() { - IcmpTypeValue = icmpType; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -948,10 +871,10 @@ public CommunityIDProcessorDescriptor IcmpType(Expression /// - public CommunityIDProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -959,10 +882,10 @@ public CommunityIDProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CommunityIDProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -971,10 +894,10 @@ public CommunityIDProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// without modifying the document. /// /// - public CommunityIDProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -982,108 +905,90 @@ public CommunityIDProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(Action configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public CommunityIDProcessorDescriptor OnFailure(params Action[] configure) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Seed for the community ID hash. Must be between 0 and 65535 (inclusive). The - /// seed can prevent hash collisions between network domains, such as a staging - /// and production network that use the same addressing scheme. + /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor Seed(int? seed) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - SeedValue = seed; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(params System.Action[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public CommunityIDProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor OnFailure(params System.Action>[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Field containing the source IP address. + /// Seed for the community ID hash. Must be between 0 and 65535 (inclusive). The + /// seed can prevent hash collisions between network domains, such as a staging + /// and production network that use the same addressing scheme. /// /// - public CommunityIDProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Seed(int? value) { - SourceIpValue = sourceIp; - return Self; + Instance.Seed = value; + return this; } /// /// - /// Field containing the source port. + /// Field containing the source IP address. /// /// - public CommunityIDProcessorDescriptor SourcePort(Elastic.Clients.Elasticsearch.Field? sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Field containing the source port. + /// Field containing the source IP address. /// /// - public CommunityIDProcessorDescriptor SourcePort(Expression> sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourceIp(System.Linq.Expressions.Expression> value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourceIp = value; + return this; } /// @@ -1091,33 +996,33 @@ public CommunityIDProcessorDescriptor SourcePort(Expression /// - public CommunityIDProcessorDescriptor SourcePort(Expression> sourcePort) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourcePort(Elastic.Clients.Elasticsearch.Field? value) { - SourcePortValue = sourcePort; - return Self; + Instance.SourcePort = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Field containing the source port. /// /// - public CommunityIDProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor SourcePort(System.Linq.Expressions.Expression> value) { - TagValue = tag; - return Self; + Instance.SourcePort = value; + return this; } /// /// - /// Output field for the community ID. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public CommunityIDProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -1125,10 +1030,10 @@ public CommunityIDProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch. /// Output field for the community ID. /// /// - public CommunityIDProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -1136,23 +1041,10 @@ public CommunityIDProcessorDescriptor TargetField(Expression< /// Output field for the community ID. /// /// - public CommunityIDProcessorDescriptor TargetField(Expression> targetField) - { - TargetFieldValue = targetField; - return Self; - } - - /// - /// - /// Field containing the transport protocol name or number. Used only when the - /// iana_number field is not present. The following protocol names are currently - /// supported: eigrp, gre, icmp, icmpv6, igmp, ipv6-icmp, ospf, pim, sctp, tcp, udp - /// - /// - public CommunityIDProcessorDescriptor Transport(Elastic.Clients.Elasticsearch.Field? transport) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TransportValue = transport; - return Self; + Instance.TargetField = value; + return this; } /// @@ -1162,10 +1054,10 @@ public CommunityIDProcessorDescriptor Transport(Elastic.Clients.Elasticsearch.Fi /// supported: eigrp, gre, icmp, icmpv6, igmp, ipv6-icmp, ospf, pim, sctp, tcp, udp /// /// - public CommunityIDProcessorDescriptor Transport(Expression> transport) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Transport(Elastic.Clients.Elasticsearch.Field? value) { - TransportValue = transport; - return Self; + Instance.Transport = value; + return this; } /// @@ -1175,136 +1067,22 @@ public CommunityIDProcessorDescriptor Transport(Expression /// - public CommunityIDProcessorDescriptor Transport(Expression> transport) + public Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor Transport(System.Linq.Expressions.Expression> value) { - TransportValue = transport; - return Self; + Instance.Transport = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestinationIpValue is not null) - { - writer.WritePropertyName("destination_ip"); - JsonSerializer.Serialize(writer, DestinationIpValue, options); - } - - if (DestinationPortValue is not null) - { - writer.WritePropertyName("destination_port"); - JsonSerializer.Serialize(writer, DestinationPortValue, options); - } - - if (IanaNumberValue is not null) - { - writer.WritePropertyName("iana_number"); - JsonSerializer.Serialize(writer, IanaNumberValue, options); - } - - if (IcmpCodeValue is not null) - { - writer.WritePropertyName("icmp_code"); - JsonSerializer.Serialize(writer, IcmpCodeValue, options); - } - - if (IcmpTypeValue is not null) - { - writer.WritePropertyName("icmp_type"); - JsonSerializer.Serialize(writer, IcmpTypeValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (SeedValue.HasValue) - { - writer.WritePropertyName("seed"); - writer.WriteNumberValue(SeedValue.Value); - } - - if (SourceIpValue is not null) - { - writer.WritePropertyName("source_ip"); - JsonSerializer.Serialize(writer, SourceIpValue, options); - } - - if (SourcePortValue is not null) + if (action is null) { - writer.WritePropertyName("source_port"); - JsonSerializer.Serialize(writer, SourcePortValue, options); + return new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TransportValue is not null) - { - writer.WritePropertyName("transport"); - JsonSerializer.Serialize(writer, TransportValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ConvertProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ConvertProcessor.g.cs index ccf9b55b880..3a0aeda7c5d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ConvertProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ConvertProcessor.g.cs @@ -17,25 +17,155 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class ConvertProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorConverter))] public sealed partial class ConvertProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConvertProcessor(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Ingest.ConvertType type) + { + Field = field; + Type = type; + } +#if NET7_0_OR_GREATER + public ConvertProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConvertProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +173,24 @@ public sealed partial class ConvertProcessor /// The field whose value is to be converted. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +198,6 @@ public sealed partial class ConvertProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +205,7 @@ public sealed partial class ConvertProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +213,6 @@ public sealed partial class ConvertProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,7 +221,6 @@ public sealed partial class ConvertProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -101,32 +228,31 @@ public sealed partial class ConvertProcessor /// The type to convert the existing value to. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Ingest.ConvertType Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(ConvertProcessor convertProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Convert(convertProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.ConvertType Type { get; set; } } -public sealed partial class ConvertProcessorDescriptor : SerializableDescriptor> +public readonly partial struct ConvertProcessorDescriptor { - internal ConvertProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConvertProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor instance) + { + Instance = instance; + } - public ConvertProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConvertProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ConvertType TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -134,10 +260,10 @@ public ConvertProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ConvertProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -145,10 +271,10 @@ public ConvertProcessorDescriptor Description(string? description) /// The field whose value is to be converted. /// /// - public ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -156,21 +282,21 @@ public ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch /// The field whose value is to be converted. /// /// - public ConvertProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field whose value is to be converted. + /// Conditionally execute the processor. /// /// - public ConvertProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -178,97 +304,94 @@ public ConvertProcessorDescriptor Field(Expression /// - public ConvertProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public ConvertProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public ConvertProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public ConvertProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreMissing = value; + return this; } - public ConvertProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public ConvertProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public ConvertProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public ConvertProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public ConvertProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -277,10 +400,10 @@ public ConvertProcessorDescriptor TargetField(Elastic.Clients.Elastic /// By default, the field is updated in-place. /// /// - public ConvertProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -289,10 +412,10 @@ public ConvertProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public ConvertProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -300,110 +423,39 @@ public ConvertProcessorDescriptor TargetField(Expression /// - public ConvertProcessorDescriptor Type(Elastic.Clients.Elasticsearch.Ingest.ConvertType type) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Type(Elastic.Clients.Elasticsearch.Ingest.ConvertType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ConvertProcessorDescriptor : SerializableDescriptor +public readonly partial struct ConvertProcessorDescriptor { - internal ConvertProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConvertProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor instance) + { + Instance = instance; + } - public ConvertProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConvertProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ConvertType TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -411,10 +463,10 @@ public ConvertProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ConvertProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -422,10 +474,10 @@ public ConvertProcessorDescriptor Description(string? description) /// The field whose value is to be converted. /// /// - public ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -433,21 +485,32 @@ public ConvertProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// The field whose value is to be converted. /// /// - public ConvertProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field whose value is to be converted. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public ConvertProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -455,10 +518,10 @@ public ConvertProcessorDescriptor Field(Expression /// - public ConvertProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -466,10 +529,10 @@ public ConvertProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public ConvertProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -477,10 +540,10 @@ public ConvertProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public ConvertProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -488,64 +551,67 @@ public ConvertProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public ConvertProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public ConvertProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public ConvertProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public ConvertProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public ConvertProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public ConvertProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -554,10 +620,10 @@ public ConvertProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fiel /// By default, the field is updated in-place. /// /// - public ConvertProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -566,10 +632,10 @@ public ConvertProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public ConvertProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -577,86 +643,17 @@ public ConvertProcessorDescriptor TargetField(Expression /// - public ConvertProcessorDescriptor Type(Elastic.Clients.Elasticsearch.Ingest.ConvertType type) + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor Type(Elastic.Clients.Elasticsearch.Ingest.ConvertType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CsvProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CsvProcessor.g.cs index a5d99c2209f..f04323329d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CsvProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/CsvProcessor.g.cs @@ -17,25 +17,182 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class CsvProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEmptyValue = System.Text.Json.JsonEncodedText.Encode("empty_value"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropQuote = System.Text.Json.JsonEncodedText.Encode("quote"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetFields = System.Text.Json.JsonEncodedText.Encode("target_fields"); + private static readonly System.Text.Json.JsonEncodedText PropTrim = System.Text.Json.JsonEncodedText.Encode("trim"); + + public override Elastic.Clients.Elasticsearch.Ingest.CsvProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propEmptyValue = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propQuote = default; + LocalJsonValue propSeparator = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetFields = default; + LocalJsonValue propTrim = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEmptyValue.TryReadProperty(ref reader, options, PropEmptyValue, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propQuote.TryReadProperty(ref reader, options, PropQuote, null)) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetFields.TryReadProperty(ref reader, options, PropTargetFields, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propTrim.TryReadProperty(ref reader, options, PropTrim, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + EmptyValue = propEmptyValue.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Quote = propQuote.Value, + Separator = propSeparator.Value, + Tag = propTag.Value, + TargetFields = propTargetFields.Value, + Trim = propTrim.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.CsvProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEmptyValue, value.EmptyValue, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuote, value.Quote, null, null); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetFields, value.TargetFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropTrim, value.Trim, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.CsvProcessorConverter))] public sealed partial class CsvProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CsvProcessor(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Fields targetFields) + { + Field = field; + TargetFields = targetFields; + } +#if NET7_0_OR_GREATER + public CsvProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CsvProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -45,7 +202,6 @@ public sealed partial class CsvProcessor /// An empty field is one with no value (2 consecutive separators) or empty quotes (""). /// /// - [JsonInclude, JsonPropertyName("empty_value")] public object? EmptyValue { get; set; } /// @@ -53,23 +209,24 @@ public sealed partial class CsvProcessor /// The field to extract data from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -77,7 +234,6 @@ public sealed partial class CsvProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -85,15 +241,13 @@ public sealed partial class CsvProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Quote used in CSV, has to be single character string. /// /// - [JsonInclude, JsonPropertyName("quote")] public string? Quote { get; set; } /// @@ -101,7 +255,6 @@ public sealed partial class CsvProcessor /// Separator used in CSV, has to be single character string. /// /// - [JsonInclude, JsonPropertyName("separator")] public string? Separator { get; set; } /// @@ -110,7 +263,6 @@ public sealed partial class CsvProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -118,44 +270,38 @@ public sealed partial class CsvProcessor /// The array of fields to assign extracted values to. /// /// - [JsonInclude, JsonPropertyName("target_fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields TargetFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields TargetFields { get; set; } /// /// /// Trim whitespaces in unquoted fields. /// /// - [JsonInclude, JsonPropertyName("trim")] public bool? Trim { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(CsvProcessor csvProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Csv(csvProcessor); } -public sealed partial class CsvProcessorDescriptor : SerializableDescriptor> +public readonly partial struct CsvProcessorDescriptor { - internal CsvProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CsvProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CsvProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor instance) + { + Instance = instance; + } - public CsvProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CsvProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private object? EmptyValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? QuoteValue { get; set; } - private string? SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields TargetFieldsValue { get; set; } - private bool? TrimValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -163,10 +309,10 @@ public CsvProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public CsvProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -176,10 +322,10 @@ public CsvProcessorDescriptor Description(string? description) /// An empty field is one with no value (2 consecutive separators) or empty quotes (""). /// /// - public CsvProcessorDescriptor EmptyValue(object? emptyValue) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor EmptyValue(object? value) { - EmptyValueValue = emptyValue; - return Self; + Instance.EmptyValue = value; + return this; } /// @@ -187,10 +333,10 @@ public CsvProcessorDescriptor EmptyValue(object? emptyValue) /// The field to extract data from. /// /// - public CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -198,21 +344,32 @@ public CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fie /// The field to extract data from. /// /// - public CsvProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to extract data from. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public CsvProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -220,10 +377,10 @@ public CsvProcessorDescriptor Field(Expression /// - public CsvProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -231,10 +388,10 @@ public CsvProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CsvProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -242,10 +399,10 @@ public CsvProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tru /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public CsvProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -253,40 +410,38 @@ public CsvProcessorDescriptor IgnoreMissing(bool? ignoreMissing = tru /// Handle failures for the processor. /// /// - public CsvProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public CsvProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public CsvProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public CsvProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -294,10 +449,10 @@ public CsvProcessorDescriptor OnFailure(params Action /// - public CsvProcessorDescriptor Quote(string? quote) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Quote(string? value) { - QuoteValue = quote; - return Self; + Instance.Quote = value; + return this; } /// @@ -305,10 +460,10 @@ public CsvProcessorDescriptor Quote(string? quote) /// Separator used in CSV, has to be single character string. /// /// - public CsvProcessorDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Separator(string? value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } /// @@ -317,10 +472,10 @@ public CsvProcessorDescriptor Separator(string? separator) /// Useful for debugging and metrics. /// /// - public CsvProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -328,142 +483,61 @@ public CsvProcessorDescriptor Tag(string? tag) /// The array of fields to assign extracted values to. /// /// - public CsvProcessorDescriptor TargetFields(Elastic.Clients.Elasticsearch.Fields targetFields) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor TargetFields(Elastic.Clients.Elasticsearch.Fields value) { - TargetFieldsValue = targetFields; - return Self; + Instance.TargetFields = value; + return this; } /// /// - /// Trim whitespaces in unquoted fields. + /// The array of fields to assign extracted values to. /// /// - public CsvProcessorDescriptor Trim(bool? trim = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor TargetFields(params System.Linq.Expressions.Expression>[] value) { - TrimValue = trim; - return Self; + Instance.TargetFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Trim whitespaces in unquoted fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Trim(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (EmptyValueValue is not null) - { - writer.WritePropertyName("empty_value"); - JsonSerializer.Serialize(writer, EmptyValueValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(QuoteValue)) - { - writer.WritePropertyName("quote"); - writer.WriteStringValue(QuoteValue); - } - - if (!string.IsNullOrEmpty(SeparatorValue)) - { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_fields"); - JsonSerializer.Serialize(writer, TargetFieldsValue, options); - if (TrimValue.HasValue) - { - writer.WritePropertyName("trim"); - writer.WriteBooleanValue(TrimValue.Value); - } + Instance.Trim = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CsvProcessor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CsvProcessorDescriptor : SerializableDescriptor +public readonly partial struct CsvProcessorDescriptor { - internal CsvProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.CsvProcessor Instance { get; init; } - public CsvProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CsvProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private object? EmptyValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? QuoteValue { get; set; } - private string? SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields TargetFieldsValue { get; set; } - private bool? TrimValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CsvProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -471,10 +545,10 @@ public CsvProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public CsvProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -484,10 +558,10 @@ public CsvProcessorDescriptor Description(string? description) /// An empty field is one with no value (2 consecutive separators) or empty quotes (""). /// /// - public CsvProcessorDescriptor EmptyValue(object? emptyValue) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor EmptyValue(object? value) { - EmptyValueValue = emptyValue; - return Self; + Instance.EmptyValue = value; + return this; } /// @@ -495,10 +569,10 @@ public CsvProcessorDescriptor EmptyValue(object? emptyValue) /// The field to extract data from. /// /// - public CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -506,21 +580,32 @@ public CsvProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to extract data from. /// /// - public CsvProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to extract data from. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public CsvProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -528,10 +613,10 @@ public CsvProcessorDescriptor Field(Expression /// - public CsvProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -539,10 +624,10 @@ public CsvProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public CsvProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -550,10 +635,10 @@ public CsvProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public CsvProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -561,40 +646,55 @@ public CsvProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public CsvProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public CsvProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public CsvProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public CsvProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -602,10 +702,10 @@ public CsvProcessorDescriptor OnFailure(params Action /// - public CsvProcessorDescriptor Quote(string? quote) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Quote(string? value) { - QuoteValue = quote; - return Self; + Instance.Quote = value; + return this; } /// @@ -613,10 +713,10 @@ public CsvProcessorDescriptor Quote(string? quote) /// Separator used in CSV, has to be single character string. /// /// - public CsvProcessorDescriptor Separator(string? separator) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Separator(string? value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } /// @@ -625,10 +725,10 @@ public CsvProcessorDescriptor Separator(string? separator) /// Useful for debugging and metrics. /// /// - public CsvProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -636,115 +736,39 @@ public CsvProcessorDescriptor Tag(string? tag) /// The array of fields to assign extracted values to. /// /// - public CsvProcessorDescriptor TargetFields(Elastic.Clients.Elasticsearch.Fields targetFields) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor TargetFields(Elastic.Clients.Elasticsearch.Fields value) { - TargetFieldsValue = targetFields; - return Self; + Instance.TargetFields = value; + return this; } /// /// - /// Trim whitespaces in unquoted fields. + /// The array of fields to assign extracted values to. /// /// - public CsvProcessorDescriptor Trim(bool? trim = true) + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor TargetFields(params System.Linq.Expressions.Expression>[] value) { - TrimValue = trim; - return Self; + Instance.TargetFields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Trim whitespaces in unquoted fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor Trim(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (EmptyValueValue is not null) - { - writer.WritePropertyName("empty_value"); - JsonSerializer.Serialize(writer, EmptyValueValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(QuoteValue)) - { - writer.WritePropertyName("quote"); - writer.WriteStringValue(QuoteValue); - } - - if (!string.IsNullOrEmpty(SeparatorValue)) - { - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_fields"); - JsonSerializer.Serialize(writer, TargetFieldsValue, options); - if (TrimValue.HasValue) - { - writer.WritePropertyName("trim"); - writer.WriteBooleanValue(TrimValue.Value); - } + Instance.Trim = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.CsvProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.CsvProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfiguration.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfiguration.g.cs index 0ee2cf7640a..c1a90495c75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfiguration.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfiguration.g.cs @@ -17,293 +17,213 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -/// -/// -/// The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading. -/// At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. -/// A provider (either maxmind or ipinfo) must be specified. The web and local providers can be returned as read only configurations. -/// -/// -[JsonConverter(typeof(DatabaseConfigurationConverter))] -public sealed partial class DatabaseConfiguration +internal sealed partial class DatabaseConfigurationConverter : System.Text.Json.Serialization.JsonConverter { - internal DatabaseConfiguration(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static DatabaseConfiguration Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => new DatabaseConfiguration("ipinfo", ipinfo); - public static DatabaseConfiguration Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => new DatabaseConfiguration("maxmind", maxmind); - - /// - /// - /// The provider-assigned name of the IP geolocation database to download. - /// - /// - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText VariantIpinfo = System.Text.Json.JsonEncodedText.Encode("ipinfo"); + private static readonly System.Text.Json.JsonEncodedText VariantMaxmind = System.Text.Json.JsonEncodedText.Encode("maxmind"); -internal sealed partial class DatabaseConfigurationConverter : JsonConverter -{ - public override DatabaseConfiguration Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - Elastic.Clients.Elasticsearch.Name nameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (propName.TryReadProperty(ref reader, options, PropName, null)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "name") + if (reader.ValueTextEquals(VariantIpinfo)) { - nameValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantIpinfo.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ipinfo") + if (reader.ValueTextEquals(VariantMaxmind)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMaxmind.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "maxmind") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DatabaseConfiguration' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DatabaseConfiguration(variantNameValue, variantValue); - result.Name = nameValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Name = propName.Value + }; } - public override void Write(Utf8JsonWriter writer, DatabaseConfiguration value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Name is not null) + switch (value.VariantType) { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, value.Name, options); - } - - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "ipinfo": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Ipinfo)value.Variant, options); - break; - case "maxmind": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Maxmind)value.Variant, options); - break; - } + case null: + break; + case "ipinfo": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Ipinfo)value.Variant, null, null); + break; + case "maxmind": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Maxmind)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration)}'."); } + writer.WriteProperty(options, PropName, value.Name, null, null); writer.WriteEndObject(); } } -public sealed partial class DatabaseConfigurationDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationConverter))] +public sealed partial class DatabaseConfiguration { - internal DatabaseConfigurationDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } - public DatabaseConfigurationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatabaseConfiguration(Elastic.Clients.Elasticsearch.Name name) { + Name = name; } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private DatabaseConfigurationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#if NET7_0_OR_GREATER + public DatabaseConfiguration() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private DatabaseConfigurationDescriptor Set(object variant, string variantName) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatabaseConfiguration() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatabaseConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.Ipinfo? Ipinfo { get => GetVariant("ipinfo"); set => SetVariant("ipinfo", value); } + public Elastic.Clients.Elasticsearch.Ingest.Maxmind? Maxmind { get => GetVariant("maxmind"); set => SetVariant("maxmind", value); } /// /// /// The provider-assigned name of the IP geolocation database to download. /// /// - public DatabaseConfigurationDescriptor Name(Elastic.Clients.Elasticsearch.Name name) - { - NameValue = name; - return Self; - } - - public DatabaseConfigurationDescriptor Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => Set(ipinfo, "ipinfo"); - public DatabaseConfigurationDescriptor Ipinfo(Action configure) => Set(configure, "ipinfo"); - public DatabaseConfigurationDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => Set(maxmind, "maxmind"); - public DatabaseConfigurationDescriptor Maxmind(Action configure) => Set(configure, "maxmind"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (NameValue is not null) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); + return result; } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + return default; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class DatabaseConfigurationDescriptor : SerializableDescriptor +public readonly partial struct DatabaseConfigurationDescriptor { - internal DatabaseConfigurationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatabaseConfigurationDescriptor(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatabaseConfigurationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration instance) => new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor descriptor) => descriptor.Instance; - public DatabaseConfigurationDescriptor() : base() + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo? value) { + Instance.Ipinfo = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Ipinfo() + { + Instance.Ipinfo = Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor.Build(null); + return this; + } - private DatabaseConfigurationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Ipinfo(System.Action? action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Ipinfo = Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor.Build(action); + return this; } - private DatabaseConfigurationDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Maxmind = value; + return this; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Maxmind(System.Action action) + { + Instance.Maxmind = Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor.Build(action); + return this; + } /// /// /// The provider-assigned name of the IP geolocation database to download. /// /// - public DatabaseConfigurationDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } - public DatabaseConfigurationDescriptor Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => Set(ipinfo, "ipinfo"); - public DatabaseConfigurationDescriptor Ipinfo(Action configure) => Set(configure, "ipinfo"); - public DatabaseConfigurationDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => Set(maxmind, "maxmind"); - public DatabaseConfigurationDescriptor Maxmind(Action configure) => Set(configure, "maxmind"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Build(System.Action action) { - writer.WriteStartObject(); - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationFull.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationFull.g.cs index 153f4bd724b..0b01ba0a48a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationFull.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationFull.g.cs @@ -17,316 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -[JsonConverter(typeof(DatabaseConfigurationFullConverter))] -public sealed partial class DatabaseConfigurationFull +internal sealed partial class DatabaseConfigurationFullConverter : System.Text.Json.Serialization.JsonConverter { - internal DatabaseConfigurationFull(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static DatabaseConfigurationFull Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => new DatabaseConfigurationFull("ipinfo", ipinfo); - public static DatabaseConfigurationFull Local(Elastic.Clients.Elasticsearch.Ingest.Local local) => new DatabaseConfigurationFull("local", local); - public static DatabaseConfigurationFull Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => new DatabaseConfigurationFull("maxmind", maxmind); - public static DatabaseConfigurationFull Web(Elastic.Clients.Elasticsearch.Ingest.Web web) => new DatabaseConfigurationFull("web", web); - - /// - /// - /// The provider-assigned name of the IP geolocation database to download. - /// - /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText VariantIpinfo = System.Text.Json.JsonEncodedText.Encode("ipinfo"); + private static readonly System.Text.Json.JsonEncodedText VariantLocal = System.Text.Json.JsonEncodedText.Encode("local"); + private static readonly System.Text.Json.JsonEncodedText VariantMaxmind = System.Text.Json.JsonEncodedText.Encode("maxmind"); + private static readonly System.Text.Json.JsonEncodedText VariantWeb = System.Text.Json.JsonEncodedText.Encode("web"); - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class DatabaseConfigurationFullConverter : JsonConverter -{ - public override DatabaseConfigurationFull Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - string nameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propName.TryReadProperty(ref reader, options, PropName, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "name") + if (reader.ValueTextEquals(VariantIpinfo)) { - nameValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantIpinfo.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ipinfo") + if (reader.ValueTextEquals(VariantLocal)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLocal.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "local") + if (reader.ValueTextEquals(VariantMaxmind)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMaxmind.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "maxmind") + if (reader.ValueTextEquals(VariantWeb)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWeb.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "web") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DatabaseConfigurationFull' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DatabaseConfigurationFull(variantNameValue, variantValue); - result.Name = nameValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Name = propName.Value + }; } - public override void Write(Utf8JsonWriter writer, DatabaseConfigurationFull value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Name)) + switch (value.VariantType) { - writer.WritePropertyName("name"); - writer.WriteStringValue(value.Name); - } - - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "ipinfo": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Ipinfo)value.Variant, options); - break; - case "local": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Local)value.Variant, options); - break; - case "maxmind": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Maxmind)value.Variant, options); - break; - case "web": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.Web)value.Variant, options); - break; - } + case null: + break; + case "ipinfo": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Ipinfo)value.Variant, null, null); + break; + case "local": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Local)value.Variant, null, null); + break; + case "maxmind": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Maxmind)value.Variant, null, null); + break; + case "web": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.Web)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull)}'."); } + writer.WriteProperty(options, PropName, value.Name, null, null); writer.WriteEndObject(); } } -public sealed partial class DatabaseConfigurationFullDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFullConverter))] +public sealed partial class DatabaseConfigurationFull { - internal DatabaseConfigurationFullDescriptor(Action> configure) => configure.Invoke(this); - - public DatabaseConfigurationFullDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private DatabaseConfigurationFullDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private DatabaseConfigurationFullDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - private string NameValue { get; set; } + internal string? VariantType { get; set; } + internal object? Variant { get; set; } - /// - /// - /// The provider-assigned name of the IP geolocation database to download. - /// - /// - public DatabaseConfigurationFullDescriptor Name(string name) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatabaseConfigurationFull(string name) { - NameValue = name; - return Self; + Name = name; } - - public DatabaseConfigurationFullDescriptor Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => Set(ipinfo, "ipinfo"); - public DatabaseConfigurationFullDescriptor Ipinfo(Action configure) => Set(configure, "ipinfo"); - public DatabaseConfigurationFullDescriptor Local(Elastic.Clients.Elasticsearch.Ingest.Local local) => Set(local, "local"); - public DatabaseConfigurationFullDescriptor Local(Action configure) => Set(configure, "local"); - public DatabaseConfigurationFullDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => Set(maxmind, "maxmind"); - public DatabaseConfigurationFullDescriptor Maxmind(Action configure) => Set(configure, "maxmind"); - public DatabaseConfigurationFullDescriptor Web(Elastic.Clients.Elasticsearch.Ingest.Web web) => Set(web, "web"); - public DatabaseConfigurationFullDescriptor Web(Action configure) => Set(configure, "web"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) +#if NET7_0_OR_GREATER + public DatabaseConfigurationFull() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(NameValue)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); } -} - -public sealed partial class DatabaseConfigurationFullDescriptor : SerializableDescriptor -{ - internal DatabaseConfigurationFullDescriptor(Action configure) => configure.Invoke(this); - - public DatabaseConfigurationFullDescriptor() : base() +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatabaseConfigurationFull() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private DatabaseConfigurationFullDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatabaseConfigurationFull(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + _ = sentinel; } - private DatabaseConfigurationFullDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - private string NameValue { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.Ipinfo? Ipinfo { get => GetVariant("ipinfo"); set => SetVariant("ipinfo", value); } + public Elastic.Clients.Elasticsearch.Ingest.Local? Local { get => GetVariant("local"); set => SetVariant("local", value); } + public Elastic.Clients.Elasticsearch.Ingest.Maxmind? Maxmind { get => GetVariant("maxmind"); set => SetVariant("maxmind", value); } + public Elastic.Clients.Elasticsearch.Ingest.Web? Web { get => GetVariant("web"); set => SetVariant("web", value); } /// /// /// The provider-assigned name of the IP geolocation database to download. /// /// - public DatabaseConfigurationFullDescriptor Name(string name) + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - NameValue = name; - return Self; - } - - public DatabaseConfigurationFullDescriptor Ipinfo(Elastic.Clients.Elasticsearch.Ingest.Ipinfo ipinfo) => Set(ipinfo, "ipinfo"); - public DatabaseConfigurationFullDescriptor Ipinfo(Action configure) => Set(configure, "ipinfo"); - public DatabaseConfigurationFullDescriptor Local(Elastic.Clients.Elasticsearch.Ingest.Local local) => Set(local, "local"); - public DatabaseConfigurationFullDescriptor Local(Action configure) => Set(configure, "local"); - public DatabaseConfigurationFullDescriptor Maxmind(Elastic.Clients.Elasticsearch.Ingest.Maxmind maxmind) => Set(maxmind, "maxmind"); - public DatabaseConfigurationFullDescriptor Maxmind(Action configure) => Set(configure, "maxmind"); - public DatabaseConfigurationFullDescriptor Web(Elastic.Clients.Elasticsearch.Ingest.Web web) => Set(web, "web"); - public DatabaseConfigurationFullDescriptor Web(Action configure) => Set(configure, "web"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(NameValue)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); + return result; } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + return default; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationMetadata.g.cs index 8403d2a1a44..5dc76acfe25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DatabaseConfigurationMetadata.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DatabaseConfigurationMetadataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabase = System.Text.Json.JsonEncodedText.Encode("database"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropModifiedDateMillis = System.Text.Json.JsonEncodedText.Encode("modified_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDatabase = default; + LocalJsonValue propId = default; + LocalJsonValue propModifiedDateMillis = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabase.TryReadProperty(ref reader, options, PropDatabase, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propModifiedDateMillis.TryReadProperty(ref reader, options, PropModifiedDateMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Database = propDatabase.Value, + Id = propId.Value, + ModifiedDateMillis = propModifiedDateMillis.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabase, value.Database, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropModifiedDateMillis, value.ModifiedDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationMetadataConverter))] public sealed partial class DatabaseConfigurationMetadata { - [JsonInclude, JsonPropertyName("database")] - public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Database { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("modified_date_millis")] - public long ModifiedDateMillis { get; init; } - [JsonInclude, JsonPropertyName("version")] - public long Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration database, string id, System.DateTimeOffset modifiedDateMillis, long version) + { + Database = database; + Id = id; + ModifiedDateMillis = modifiedDateMillis; + Version = version; + } +#if NET7_0_OR_GREATER + public DatabaseConfigurationMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatabaseConfigurationMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration Database { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ModifiedDateMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateIndexNameProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateIndexNameProcessor.g.cs index 19b233d62e0..2daec74e2d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateIndexNameProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateIndexNameProcessor.g.cs @@ -17,26 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DateIndexNameProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDateFormats = System.Text.Json.JsonEncodedText.Encode("date_formats"); + private static readonly System.Text.Json.JsonEncodedText PropDateRounding = System.Text.Json.JsonEncodedText.Encode("date_rounding"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIndexNameFormat = System.Text.Json.JsonEncodedText.Encode("index_name_format"); + private static readonly System.Text.Json.JsonEncodedText PropIndexNamePrefix = System.Text.Json.JsonEncodedText.Encode("index_name_prefix"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTimezone = System.Text.Json.JsonEncodedText.Encode("timezone"); + + public override Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDateFormats = default; + LocalJsonValue propDateRounding = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIndexNameFormat = default; + LocalJsonValue propIndexNamePrefix = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTimezone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDateFormats.TryReadProperty(ref reader, options, PropDateFormats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDateRounding.TryReadProperty(ref reader, options, PropDateRounding, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIndexNameFormat.TryReadProperty(ref reader, options, PropIndexNameFormat, null)) + { + continue; + } + + if (propIndexNamePrefix.TryReadProperty(ref reader, options, PropIndexNamePrefix, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTimezone.TryReadProperty(ref reader, options, PropTimezone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DateFormats = propDateFormats.Value, + DateRounding = propDateRounding.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IndexNameFormat = propIndexNameFormat.Value, + IndexNamePrefix = propIndexNamePrefix.Value, + Locale = propLocale.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + Timezone = propTimezone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDateFormats, value.DateFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDateRounding, value.DateRounding, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIndexNameFormat, value.IndexNameFormat, null, null); + writer.WriteProperty(options, PropIndexNamePrefix, value.IndexNamePrefix, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTimezone, value.Timezone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorConverter))] public sealed partial class DateIndexNameProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateIndexNameProcessor(string dateRounding, Elastic.Clients.Elasticsearch.Field field) + { + DateRounding = dateRounding; + Field = field; + } +#if NET7_0_OR_GREATER + public DateIndexNameProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateIndexNameProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of the expected date formats for parsing dates / timestamps in the document being preprocessed. /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - [JsonInclude, JsonPropertyName("date_formats")] - public ICollection DateFormats { get; set; } + public System.Collections.Generic.ICollection? DateFormats { get; set; } /// /// @@ -45,8 +202,11 @@ public sealed partial class DateIndexNameProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("date_rounding")] - public string DateRounding { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DateRounding { get; set; } /// /// @@ -54,7 +214,6 @@ public sealed partial class DateIndexNameProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -62,23 +221,24 @@ public sealed partial class DateIndexNameProcessor /// The field to get the date or timestamp from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -88,7 +248,6 @@ public sealed partial class DateIndexNameProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("index_name_format")] public string? IndexNameFormat { get; set; } /// @@ -97,7 +256,6 @@ public sealed partial class DateIndexNameProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("index_name_prefix")] public string? IndexNamePrefix { get; set; } /// @@ -105,7 +263,6 @@ public sealed partial class DateIndexNameProcessor /// The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. /// /// - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -113,8 +270,7 @@ public sealed partial class DateIndexNameProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -122,7 +278,6 @@ public sealed partial class DateIndexNameProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -130,35 +285,27 @@ public sealed partial class DateIndexNameProcessor /// The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names. /// /// - [JsonInclude, JsonPropertyName("timezone")] public string? Timezone { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(DateIndexNameProcessor dateIndexNameProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.DateIndexName(dateIndexNameProcessor); } -public sealed partial class DateIndexNameProcessorDescriptor : SerializableDescriptor> +public readonly partial struct DateIndexNameProcessorDescriptor { - internal DateIndexNameProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor Instance { get; init; } - public DateIndexNameProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateIndexNameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor instance) { + Instance = instance; } - private ICollection DateFormatsValue { get; set; } - private string DateRoundingValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? IndexNameFormatValue { get; set; } - private string? IndexNamePrefixValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private string? TimezoneValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateIndexNameProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -166,10 +313,22 @@ public DateIndexNameProcessorDescriptor() : base() /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - public DateIndexNameProcessorDescriptor DateFormats(ICollection dateFormats) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateFormats(System.Collections.Generic.ICollection? value) { - DateFormatsValue = dateFormats; - return Self; + Instance.DateFormats = value; + return this; + } + + /// + /// + /// An array of the expected date formats for parsing dates / timestamps in the document being preprocessed. + /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateFormats(params string[] values) + { + Instance.DateFormats = [.. values]; + return this; } /// @@ -179,10 +338,10 @@ public DateIndexNameProcessorDescriptor DateFormats(ICollection /// - public DateIndexNameProcessorDescriptor DateRounding(string dateRounding) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateRounding(string value) { - DateRoundingValue = dateRounding; - return Self; + Instance.DateRounding = value; + return this; } /// @@ -191,10 +350,10 @@ public DateIndexNameProcessorDescriptor DateRounding(string dateRound /// Useful for describing the purpose of the processor or its configuration. /// /// - public DateIndexNameProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -202,10 +361,10 @@ public DateIndexNameProcessorDescriptor Description(string? descripti /// The field to get the date or timestamp from. /// /// - public DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -213,21 +372,32 @@ public DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elastic /// The field to get the date or timestamp from. /// /// - public DateIndexNameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the date or timestamp from. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public DateIndexNameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -235,10 +405,10 @@ public DateIndexNameProcessorDescriptor Field(Expression /// - public DateIndexNameProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -246,10 +416,10 @@ public DateIndexNameProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DateIndexNameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -259,10 +429,10 @@ public DateIndexNameProcessorDescriptor IgnoreFailure(bool? ignoreFai /// Supports template snippets. /// /// - public DateIndexNameProcessorDescriptor IndexNameFormat(string? indexNameFormat) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IndexNameFormat(string? value) { - IndexNameFormatValue = indexNameFormat; - return Self; + Instance.IndexNameFormat = value; + return this; } /// @@ -271,10 +441,10 @@ public DateIndexNameProcessorDescriptor IndexNameFormat(string? index /// Supports template snippets. /// /// - public DateIndexNameProcessorDescriptor IndexNamePrefix(string? indexNamePrefix) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IndexNamePrefix(string? value) { - IndexNamePrefixValue = indexNamePrefix; - return Self; + Instance.IndexNamePrefix = value; + return this; } /// @@ -282,10 +452,10 @@ public DateIndexNameProcessorDescriptor IndexNamePrefix(string? index /// The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. /// /// - public DateIndexNameProcessorDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -293,40 +463,38 @@ public DateIndexNameProcessorDescriptor Locale(string? locale) /// Handle failures for the processor. /// /// - public DateIndexNameProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DateIndexNameProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DateIndexNameProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public DateIndexNameProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -335,10 +503,10 @@ public DateIndexNameProcessorDescriptor OnFailure(params Action /// - public DateIndexNameProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -346,127 +514,51 @@ public DateIndexNameProcessorDescriptor Tag(string? tag) /// The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names. /// /// - public DateIndexNameProcessorDescriptor Timezone(string? timezone) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Timezone(string? value) { - TimezoneValue = timezone; - return Self; + Instance.Timezone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("date_formats"); - JsonSerializer.Serialize(writer, DateFormatsValue, options); - writer.WritePropertyName("date_rounding"); - writer.WriteStringValue(DateRoundingValue); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(IndexNameFormatValue)) - { - writer.WritePropertyName("index_name_format"); - writer.WriteStringValue(IndexNameFormatValue); - } - - if (!string.IsNullOrEmpty(IndexNamePrefixValue)) - { - writer.WritePropertyName("index_name_prefix"); - writer.WriteStringValue(IndexNamePrefixValue); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (!string.IsNullOrEmpty(TimezoneValue)) - { - writer.WritePropertyName("timezone"); - writer.WriteStringValue(TimezoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateIndexNameProcessorDescriptor : SerializableDescriptor +public readonly partial struct DateIndexNameProcessorDescriptor { - internal DateIndexNameProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor Instance { get; init; } - public DateIndexNameProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateIndexNameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor instance) { + Instance = instance; } - private ICollection DateFormatsValue { get; set; } - private string DateRoundingValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? IndexNameFormatValue { get; set; } - private string? IndexNamePrefixValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private string? TimezoneValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateIndexNameProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// An array of the expected date formats for parsing dates / timestamps in the document being preprocessed. + /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateFormats(System.Collections.Generic.ICollection? value) + { + Instance.DateFormats = value; + return this; + } /// /// @@ -474,10 +566,10 @@ public DateIndexNameProcessorDescriptor() : base() /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - public DateIndexNameProcessorDescriptor DateFormats(ICollection dateFormats) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateFormats(params string[] values) { - DateFormatsValue = dateFormats; - return Self; + Instance.DateFormats = [.. values]; + return this; } /// @@ -487,10 +579,10 @@ public DateIndexNameProcessorDescriptor DateFormats(ICollection dateForm /// Supports template snippets. /// /// - public DateIndexNameProcessorDescriptor DateRounding(string dateRounding) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor DateRounding(string value) { - DateRoundingValue = dateRounding; - return Self; + Instance.DateRounding = value; + return this; } /// @@ -499,10 +591,10 @@ public DateIndexNameProcessorDescriptor DateRounding(string dateRounding) /// Useful for describing the purpose of the processor or its configuration. /// /// - public DateIndexNameProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -510,10 +602,10 @@ public DateIndexNameProcessorDescriptor Description(string? description) /// The field to get the date or timestamp from. /// /// - public DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -521,21 +613,21 @@ public DateIndexNameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// The field to get the date or timestamp from. /// /// - public DateIndexNameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the date or timestamp from. + /// Conditionally execute the processor. /// /// - public DateIndexNameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -543,10 +635,21 @@ public DateIndexNameProcessorDescriptor Field(Expression /// - public DateIndexNameProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -554,10 +657,10 @@ public DateIndexNameProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DateIndexNameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -567,10 +670,10 @@ public DateIndexNameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true /// Supports template snippets. /// /// - public DateIndexNameProcessorDescriptor IndexNameFormat(string? indexNameFormat) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IndexNameFormat(string? value) { - IndexNameFormatValue = indexNameFormat; - return Self; + Instance.IndexNameFormat = value; + return this; } /// @@ -579,10 +682,10 @@ public DateIndexNameProcessorDescriptor IndexNameFormat(string? indexNameFormat) /// Supports template snippets. /// /// - public DateIndexNameProcessorDescriptor IndexNamePrefix(string? indexNamePrefix) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor IndexNamePrefix(string? value) { - IndexNamePrefixValue = indexNamePrefix; - return Self; + Instance.IndexNamePrefix = value; + return this; } /// @@ -590,10 +693,10 @@ public DateIndexNameProcessorDescriptor IndexNamePrefix(string? indexNamePrefix) /// The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. /// /// - public DateIndexNameProcessorDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -601,40 +704,55 @@ public DateIndexNameProcessorDescriptor Locale(string? locale) /// Handle failures for the processor. /// /// - public DateIndexNameProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DateIndexNameProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DateIndexNameProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public DateIndexNameProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -643,10 +761,10 @@ public DateIndexNameProcessorDescriptor OnFailure(params Action /// - public DateIndexNameProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -654,100 +772,17 @@ public DateIndexNameProcessorDescriptor Tag(string? tag) /// The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names. /// /// - public DateIndexNameProcessorDescriptor Timezone(string? timezone) + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor Timezone(string? value) { - TimezoneValue = timezone; - return Self; + Instance.Timezone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("date_formats"); - JsonSerializer.Serialize(writer, DateFormatsValue, options); - writer.WritePropertyName("date_rounding"); - writer.WriteStringValue(DateRoundingValue); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(IndexNameFormatValue)) - { - writer.WritePropertyName("index_name_format"); - writer.WriteStringValue(IndexNameFormatValue); - } - - if (!string.IsNullOrEmpty(IndexNamePrefixValue)) - { - writer.WritePropertyName("index_name_prefix"); - writer.WriteStringValue(IndexNamePrefixValue); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (!string.IsNullOrEmpty(TimezoneValue)) - { - writer.WritePropertyName("timezone"); - writer.WriteStringValue(TimezoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateProcessor.g.cs index c74aa779235..edc1bf52ca5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DateProcessor.g.cs @@ -17,25 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DateProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormats = System.Text.Json.JsonEncodedText.Encode("formats"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOutputFormat = System.Text.Json.JsonEncodedText.Encode("output_format"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropTimezone = System.Text.Json.JsonEncodedText.Encode("timezone"); + + public override Elastic.Clients.Elasticsearch.Ingest.DateProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue> propFormats = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propOutputFormat = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propTimezone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormats.TryReadProperty(ref reader, options, PropFormats, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOutputFormat.TryReadProperty(ref reader, options, PropOutputFormat, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propTimezone.TryReadProperty(ref reader, options, PropTimezone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + Formats = propFormats.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + Locale = propLocale.Value, + OnFailure = propOnFailure.Value, + OutputFormat = propOutputFormat.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value, + Timezone = propTimezone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DateProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormats, value.Formats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOutputFormat, value.OutputFormat, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropTimezone, value.Timezone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DateProcessorConverter))] public sealed partial class DateProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateProcessor(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection formats) + { + Field = field; + Formats = formats; + } +#if NET7_0_OR_GREATER + public DateProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,8 +191,11 @@ public sealed partial class DateProcessor /// The field to get the date from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -52,23 +203,24 @@ public sealed partial class DateProcessor /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - [JsonInclude, JsonPropertyName("formats")] - public ICollection Formats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Formats { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -77,7 +229,6 @@ public sealed partial class DateProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -85,8 +236,7 @@ public sealed partial class DateProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -94,7 +244,6 @@ public sealed partial class DateProcessor /// java time pattern. /// /// - [JsonInclude, JsonPropertyName("output_format")] public string? OutputFormat { get; set; } /// @@ -103,7 +252,6 @@ public sealed partial class DateProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -111,7 +259,6 @@ public sealed partial class DateProcessor /// The field that will hold the parsed date. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -120,34 +267,27 @@ public sealed partial class DateProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("timezone")] public string? Timezone { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(DateProcessor dateProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Date(dateProcessor); } -public sealed partial class DateProcessorDescriptor : SerializableDescriptor> +public readonly partial struct DateProcessorDescriptor { - internal DateProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DateProcessor Instance { get; init; } - public DateProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection FormatsValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? OutputFormatValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private string? TimezoneValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -155,10 +295,10 @@ public DateProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DateProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -166,10 +306,10 @@ public DateProcessorDescriptor Description(string? description) /// The field to get the date from. /// /// - public DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -177,21 +317,22 @@ public DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to get the date from. /// /// - public DateProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the date from. + /// An array of the expected date formats. + /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - public DateProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Formats(System.Collections.Generic.ICollection value) { - FieldValue = field; - return Self; + Instance.Formats = value; + return this; } /// @@ -200,10 +341,10 @@ public DateProcessorDescriptor Field(Expression /// - public DateProcessorDescriptor Formats(ICollection formats) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Formats(params string[] values) { - FormatsValue = formats; - return Self; + Instance.Formats = [.. values]; + return this; } /// @@ -211,109 +352,118 @@ public DateProcessorDescriptor Formats(ICollection formats) /// Conditionally execute the processor. /// /// - public DateProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public DateProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// The locale to use when parsing the date, relevant when parsing month names or week days. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public DateProcessorDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If(System.Action? action) { - LocaleValue = locale; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public DateProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public DateProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// The locale to use when parsing the date, relevant when parsing month names or week days. + /// Supports template snippets. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Locale(string? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Locale = value; + return this; } - public DateProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public DateProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// The format to use when writing the date to target_field. Must be a valid - /// java time pattern. + /// Handle failures for the processor. /// /// - public DateProcessorDescriptor OutputFormat(string? outputFormat) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(params System.Action>[] actions) { - OutputFormatValue = outputFormat; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The format to use when writing the date to target_field. Must be a valid + /// java time pattern. /// /// - public DateProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OutputFormat(string? value) { - TagValue = tag; - return Self; + Instance.OutputFormat = value; + return this; } /// /// - /// The field that will hold the parsed date. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -321,10 +471,10 @@ public DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// The field that will hold the parsed date. /// /// - public DateProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -332,10 +482,10 @@ public DateProcessorDescriptor TargetField(Expression /// - public DateProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -344,124 +494,39 @@ public DateProcessorDescriptor TargetField(Expression /// - public DateProcessorDescriptor Timezone(string? timezone) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Timezone(string? value) { - TimezoneValue = timezone; - return Self; + Instance.Timezone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DateProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("formats"); - JsonSerializer.Serialize(writer, FormatsValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(OutputFormatValue)) - { - writer.WritePropertyName("output_format"); - writer.WriteStringValue(OutputFormatValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (!string.IsNullOrEmpty(TimezoneValue)) - { - writer.WritePropertyName("timezone"); - writer.WriteStringValue(TimezoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateProcessorDescriptor : SerializableDescriptor +public readonly partial struct DateProcessorDescriptor { - internal DateProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DateProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateProcessor instance) + { + Instance = instance; + } - public DateProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection FormatsValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? LocaleValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? OutputFormatValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private string? TimezoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DateProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -469,10 +534,10 @@ public DateProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DateProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -480,10 +545,10 @@ public DateProcessorDescriptor Description(string? description) /// The field to get the date from. /// /// - public DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -491,21 +556,22 @@ public DateProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to get the date from. /// /// - public DateProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the date from. + /// An array of the expected date formats. + /// Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. /// /// - public DateProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Formats(System.Collections.Generic.ICollection value) { - FieldValue = field; - return Self; + Instance.Formats = value; + return this; } /// @@ -514,10 +580,32 @@ public DateProcessorDescriptor Field(Expression /// - public DateProcessorDescriptor Formats(ICollection formats) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Formats(params string[] values) + { + Instance.Formats = [.. values]; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If() { - FormatsValue = formats; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -525,10 +613,10 @@ public DateProcessorDescriptor Formats(ICollection formats) /// Conditionally execute the processor. /// /// - public DateProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -536,10 +624,10 @@ public DateProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DateProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -548,10 +636,10 @@ public DateProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Supports template snippets. /// /// - public DateProcessorDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -559,75 +647,79 @@ public DateProcessorDescriptor Locale(string? locale) /// Handle failures for the processor. /// /// - public DateProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DateProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DateProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public DateProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// The format to use when writing the date to target_field. Must be a valid - /// java time pattern. + /// Handle failures for the processor. /// /// - public DateProcessorDescriptor OutputFormat(string? outputFormat) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OnFailure(params System.Action>[] actions) { - OutputFormatValue = outputFormat; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The format to use when writing the date to target_field. Must be a valid + /// java time pattern. /// /// - public DateProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor OutputFormat(string? value) { - TagValue = tag; - return Self; + Instance.OutputFormat = value; + return this; } /// /// - /// The field that will hold the parsed date. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -635,10 +727,10 @@ public DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// The field that will hold the parsed date. /// /// - public DateProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -646,10 +738,10 @@ public DateProcessorDescriptor TargetField(Expression /// - public DateProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -658,98 +750,17 @@ public DateProcessorDescriptor TargetField(Expression /// - public DateProcessorDescriptor Timezone(string? timezone) + public Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor Timezone(string? value) { - TimezoneValue = timezone; - return Self; + Instance.Timezone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DateProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("formats"); - JsonSerializer.Serialize(writer, FormatsValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(OutputFormatValue)) - { - writer.WritePropertyName("output_format"); - writer.WriteStringValue(OutputFormatValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (!string.IsNullOrEmpty(TimezoneValue)) - { - writer.WritePropertyName("timezone"); - writer.WriteStringValue(TimezoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DissectProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DissectProcessor.g.cs index ef9bc68d98d..fbe7b4eb0a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DissectProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DissectProcessor.g.cs @@ -17,24 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DissectProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAppendSeparator = System.Text.Json.JsonEncodedText.Encode("append_separator"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.DissectProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAppendSeparator = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propPattern = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAppendSeparator.TryReadProperty(ref reader, options, PropAppendSeparator, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AppendSeparator = propAppendSeparator.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Pattern = propPattern.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DissectProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAppendSeparator, value.AppendSeparator, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DissectProcessorConverter))] public sealed partial class DissectProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DissectProcessor(Elastic.Clients.Elasticsearch.Field field, string pattern) + { + Field = field; + Pattern = pattern; + } +#if NET7_0_OR_GREATER + public DissectProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DissectProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The character(s) that separate the appended fields. /// /// - [JsonInclude, JsonPropertyName("append_separator")] public string? AppendSeparator { get; set; } /// @@ -43,7 +173,6 @@ public sealed partial class DissectProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -51,23 +180,24 @@ public sealed partial class DissectProcessor /// The field to dissect. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -75,7 +205,6 @@ public sealed partial class DissectProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -83,16 +212,18 @@ public sealed partial class DissectProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// The pattern to apply to the field. /// /// - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Pattern { get; set; } /// /// @@ -100,42 +231,37 @@ public sealed partial class DissectProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(DissectProcessor dissectProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Dissect(dissectProcessor); } -public sealed partial class DissectProcessorDescriptor : SerializableDescriptor> +public readonly partial struct DissectProcessorDescriptor { - internal DissectProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DissectProcessor Instance { get; init; } - public DissectProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DissectProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor instance) { + Instance = instance; } - private string? AppendSeparatorValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string PatternValue { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DissectProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The character(s) that separate the appended fields. /// /// - public DissectProcessorDescriptor AppendSeparator(string? appendSeparator) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor AppendSeparator(string? value) { - AppendSeparatorValue = appendSeparator; - return Self; + Instance.AppendSeparator = value; + return this; } /// @@ -144,10 +270,10 @@ public DissectProcessorDescriptor AppendSeparator(string? appendSepar /// Useful for describing the purpose of the processor or its configuration. /// /// - public DissectProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -155,10 +281,10 @@ public DissectProcessorDescriptor Description(string? description) /// The field to dissect. /// /// - public DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -166,21 +292,32 @@ public DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch /// The field to dissect. /// /// - public DissectProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to dissect. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public DissectProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -188,10 +325,10 @@ public DissectProcessorDescriptor Field(Expression /// - public DissectProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -199,10 +336,10 @@ public DissectProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DissectProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -210,10 +347,10 @@ public DissectProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public DissectProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -221,40 +358,38 @@ public DissectProcessorDescriptor IgnoreMissing(bool? ignoreMissing = /// Handle failures for the processor. /// /// - public DissectProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DissectProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DissectProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public DissectProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -262,10 +397,10 @@ public DissectProcessorDescriptor OnFailure(params Action /// - public DissectProcessorDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Pattern(string value) { - PatternValue = pattern; - return Self; + Instance.Pattern = value; + return this; } /// @@ -274,120 +409,49 @@ public DissectProcessorDescriptor Pattern(string pattern) /// Useful for debugging and metrics. /// /// - public DissectProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DissectProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AppendSeparatorValue)) - { - writer.WritePropertyName("append_separator"); - writer.WriteStringValue(AppendSeparatorValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DissectProcessorDescriptor : SerializableDescriptor +public readonly partial struct DissectProcessorDescriptor { - internal DissectProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DissectProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DissectProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor instance) + { + Instance = instance; + } - public DissectProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DissectProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AppendSeparatorValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string PatternValue { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The character(s) that separate the appended fields. /// /// - public DissectProcessorDescriptor AppendSeparator(string? appendSeparator) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor AppendSeparator(string? value) { - AppendSeparatorValue = appendSeparator; - return Self; + Instance.AppendSeparator = value; + return this; } /// @@ -396,10 +460,10 @@ public DissectProcessorDescriptor AppendSeparator(string? appendSeparator) /// Useful for describing the purpose of the processor or its configuration. /// /// - public DissectProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -407,10 +471,10 @@ public DissectProcessorDescriptor Description(string? description) /// The field to dissect. /// /// - public DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -418,21 +482,32 @@ public DissectProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// The field to dissect. /// /// - public DissectProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to dissect. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public DissectProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -440,10 +515,10 @@ public DissectProcessorDescriptor Field(Expression /// - public DissectProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -451,10 +526,10 @@ public DissectProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DissectProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -462,10 +537,10 @@ public DissectProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public DissectProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -473,40 +548,55 @@ public DissectProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public DissectProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DissectProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DissectProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public DissectProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -514,10 +604,10 @@ public DissectProcessorDescriptor OnFailure(params Action /// - public DissectProcessorDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Pattern(string value) { - PatternValue = pattern; - return Self; + Instance.Pattern = value; + return this; } /// @@ -526,86 +616,17 @@ public DissectProcessorDescriptor Pattern(string pattern) /// Useful for debugging and metrics. /// /// - public DissectProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DissectProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AppendSeparatorValue)) - { - writer.WritePropertyName("append_separator"); - writer.WriteStringValue(AppendSeparatorValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DissectProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Document.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Document.g.cs index 13e443abcda..eb95759a279 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Document.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Document.g.cs @@ -17,25 +17,100 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DocumentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.Ingest.Document Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Document(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Document value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DocumentConverter))] public sealed partial class Document { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Document(object source) + { + Source = source; + } +#if NET7_0_OR_GREATER + public Document() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Document() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Document(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Unique identifier for the document. /// This ID must be unique within the _index. /// /// - [JsonInclude, JsonPropertyName("_id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -43,7 +118,6 @@ public sealed partial class Document /// Name of the index containing the document. /// /// - [JsonInclude, JsonPropertyName("_index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -51,21 +125,31 @@ public sealed partial class Document /// JSON body for the document. /// /// - [JsonInclude, JsonPropertyName("_source")] - public object Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Source { get; set; } } -public sealed partial class DocumentDescriptor : SerializableDescriptor +public readonly partial struct DocumentDescriptor { - internal DocumentDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.Document Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentDescriptor(Elastic.Clients.Elasticsearch.Ingest.Document instance) + { + Instance = instance; + } - public DocumentDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Document(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private object SourceValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(Elastic.Clients.Elasticsearch.Ingest.Document instance) => new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Document(Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor descriptor) => descriptor.Instance; /// /// @@ -73,10 +157,10 @@ public DocumentDescriptor() : base() /// This ID must be unique within the _index. /// /// - public DocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -84,10 +168,10 @@ public DocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// Name of the index containing the document. /// /// - public DocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -95,29 +179,17 @@ public DocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) /// JSON body for the document. /// /// - public DocumentDescriptor Source(object source) + public Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor Source(object value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Document Build(System.Action action) { - writer.WriteStartObject(); - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DocumentDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Document(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DocumentSimulation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DocumentSimulation.g.cs index 2b1315027ed..72b69fee3c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DocumentSimulation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DocumentSimulation.g.cs @@ -17,89 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -internal sealed partial class DocumentSimulationConverter : JsonConverter +internal sealed partial class DocumentSimulationConverter : System.Text.Json.Serialization.JsonConverter { - public override DocumentSimulation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("_ingest"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("_version_type"); + + public override Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - string id = default; - string index = default; - Elastic.Clients.Elasticsearch.Ingest.Ingest ingest = default; - string? routing = default; - IReadOnlyDictionary source = default; - long? version = default; - Elastic.Clients.Elasticsearch.VersionType? versionType = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIngest = default; + System.Collections.Generic.Dictionary? propMetadata = default; + LocalJsonValue propRouting = default; + LocalJsonValue> propSource = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) { - var property = reader.GetString(); - if (property == "_id") - { - id = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_index") - { - index = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_ingest") - { - ingest = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_routing") - { - routing = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_source") - { - source = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "_version") - { - version = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_version_type") - { - versionType = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + propMetadata ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out string value, null, null); + propMetadata[key] = value; } - return new DocumentSimulation { Id = id, Index = index, Ingest = ingest, Metadata = additionalProperties, Routing = routing, Source = source, Version = version, VersionType = versionType }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Ingest = propIngest.Value, + Metadata = propMetadata, + Routing = propRouting.Value, + Source = propSource.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; } - public override void Write(Utf8JsonWriter writer, DocumentSimulation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'DocumentSimulation' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + if (value.Metadata is not null) + { + foreach (var item in value.Metadata) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } @@ -108,44 +127,85 @@ public override void Write(Utf8JsonWriter writer, DocumentSimulation value, Json /// The simulated document, with optional metadata. /// /// -[JsonConverter(typeof(DocumentSimulationConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DocumentSimulationConverter))] public sealed partial class DocumentSimulation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DocumentSimulation(string id, string index, Elastic.Clients.Elasticsearch.Ingest.Ingest ingest, System.Collections.Generic.IReadOnlyDictionary source) + { + Id = id; + Index = index; + Ingest = ingest; + Source = source; + } +#if NET7_0_OR_GREATER + public DocumentSimulation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DocumentSimulation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DocumentSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Unique identifier for the document. This ID must be unique within the _index. /// /// - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Name of the index containing the document. /// /// - public string Index { get; init; } - public Elastic.Clients.Elasticsearch.Ingest.Ingest Ingest { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.Ingest Ingest { get; set; } /// /// /// Additional metadata /// /// - public IReadOnlyDictionary Metadata { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } /// /// /// Value used to send the document to a specific primary shard. /// /// - public string? Routing { get; init; } + public string? Routing { get; set; } /// /// /// JSON body for the document. /// /// - public IReadOnlyDictionary Source { get; init; } - public long? Version { get; init; } - public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Source { get; set; } + public long? Version { get; set; } + public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DotExpanderProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DotExpanderProcessor.g.cs index 0140218155e..5d28d340aec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DotExpanderProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DotExpanderProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DotExpanderProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOverride = System.Text.Json.JsonEncodedText.Encode("override"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propOverride = default; + LocalJsonValue propPath = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOverride.TryReadProperty(ref reader, options, PropOverride, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Override = propOverride.Value, + Path = propPath.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverride, value.Override, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorConverter))] public sealed partial class DotExpanderProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DotExpanderProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public DotExpanderProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DotExpanderProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,23 +164,24 @@ public sealed partial class DotExpanderProcessor /// If set to *, all top-level fields will be expanded. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,8 +189,7 @@ public sealed partial class DotExpanderProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -78,7 +198,6 @@ public sealed partial class DotExpanderProcessor /// When true, the value from the expanded field will overwrite the existing value. /// /// - [JsonInclude, JsonPropertyName("override")] public bool? Override { get; set; } /// @@ -87,7 +206,6 @@ public sealed partial class DotExpanderProcessor /// Only required if the field to expand is part another object field, because the field option can only understand leaf fields. /// /// - [JsonInclude, JsonPropertyName("path")] public string? Path { get; set; } /// @@ -96,31 +214,27 @@ public sealed partial class DotExpanderProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(DotExpanderProcessor dotExpanderProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.DotExpander(dotExpanderProcessor); } -public sealed partial class DotExpanderProcessorDescriptor : SerializableDescriptor> +public readonly partial struct DotExpanderProcessorDescriptor { - internal DotExpanderProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DotExpanderProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor instance) + { + Instance = instance; + } - public DotExpanderProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DotExpanderProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string? PathValue { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -128,10 +242,10 @@ public DotExpanderProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DotExpanderProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -140,10 +254,10 @@ public DotExpanderProcessorDescriptor Description(string? description /// If set to *, all top-level fields will be expanded. /// /// - public DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -152,22 +266,21 @@ public DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticse /// If set to *, all top-level fields will be expanded. /// /// - public DotExpanderProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to expand into an object field. - /// If set to *, all top-level fields will be expanded. + /// Conditionally execute the processor. /// /// - public DotExpanderProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -175,62 +288,71 @@ public DotExpanderProcessorDescriptor Field(Expression /// - public DotExpanderProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public DotExpanderProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public DotExpanderProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public DotExpanderProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public DotExpanderProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DotExpanderProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -240,10 +362,10 @@ public DotExpanderProcessorDescriptor OnFailure(params Actiontrue, the value from the expanded field will overwrite the existing value. /// /// - public DotExpanderProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -252,10 +374,10 @@ public DotExpanderProcessorDescriptor Override(bool? value = true) /// Only required if the field to expand is part another object field, because the field option can only understand leaf fields. /// /// - public DotExpanderProcessorDescriptor Path(string? path) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Path(string? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -264,107 +386,39 @@ public DotExpanderProcessorDescriptor Path(string? path) /// Useful for debugging and metrics. /// /// - public DotExpanderProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - if (!string.IsNullOrEmpty(PathValue)) - { - writer.WritePropertyName("path"); - writer.WriteStringValue(PathValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DotExpanderProcessorDescriptor : SerializableDescriptor +public readonly partial struct DotExpanderProcessorDescriptor { - internal DotExpanderProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor Instance { get; init; } - public DotExpanderProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DotExpanderProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string? PathValue { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DotExpanderProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -372,10 +426,10 @@ public DotExpanderProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DotExpanderProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -384,10 +438,10 @@ public DotExpanderProcessorDescriptor Description(string? description) /// If set to *, all top-level fields will be expanded. /// /// - public DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -396,22 +450,32 @@ public DotExpanderProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field /// If set to *, all top-level fields will be expanded. /// /// - public DotExpanderProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to expand into an object field. - /// If set to *, all top-level fields will be expanded. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public DotExpanderProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -419,10 +483,10 @@ public DotExpanderProcessorDescriptor Field(Expression /// - public DotExpanderProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -430,10 +494,10 @@ public DotExpanderProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public DotExpanderProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -441,40 +505,55 @@ public DotExpanderProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Handle failures for the processor. /// /// - public DotExpanderProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public DotExpanderProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public DotExpanderProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public DotExpanderProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -484,10 +563,10 @@ public DotExpanderProcessorDescriptor OnFailure(params Actiontrue, the value from the expanded field will overwrite the existing value. /// /// - public DotExpanderProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -496,10 +575,10 @@ public DotExpanderProcessorDescriptor Override(bool? value = true) /// Only required if the field to expand is part another object field, because the field option can only understand leaf fields. /// /// - public DotExpanderProcessorDescriptor Path(string? path) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Path(string? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -508,84 +587,17 @@ public DotExpanderProcessorDescriptor Path(string? path) /// Useful for debugging and metrics. /// /// - public DotExpanderProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - if (!string.IsNullOrEmpty(PathValue)) - { - writer.WritePropertyName("path"); - writer.WriteStringValue(PathValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DropProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DropProcessor.g.cs index 9dc80e64627..9ecc53e205a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DropProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/DropProcessor.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class DropProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.DropProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.DropProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.DropProcessorConverter))] public sealed partial class DropProcessor { +#if NET7_0_OR_GREATER + public DropProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public DropProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,15 +130,13 @@ public sealed partial class DropProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -59,8 +144,7 @@ public sealed partial class DropProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -68,28 +152,27 @@ public sealed partial class DropProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(DropProcessor dropProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Drop(dropProcessor); } -public sealed partial class DropProcessorDescriptor : SerializableDescriptor> +public readonly partial struct DropProcessorDescriptor { - internal DropProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DropProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DropProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DropProcessor instance) + { + Instance = instance; + } - public DropProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DropProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DropProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -97,10 +180,10 @@ public DropProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DropProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -108,154 +191,128 @@ public DropProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Handle failures for the processor. + /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If(System.Action? action) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DropProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public DropProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Ignore failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public DropProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public DropProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(params System.Action>[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DropProcessor Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DropProcessorDescriptor : SerializableDescriptor +public readonly partial struct DropProcessorDescriptor { - internal DropProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.DropProcessor Instance { get; init; } - public DropProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DropProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DropProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DropProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.DropProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -263,10 +320,10 @@ public DropProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public DropProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -274,134 +331,123 @@ public DropProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Handle failures for the processor. + /// Conditionally execute the processor. /// /// - public DropProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public DropProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor If(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DropProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Ignore failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public DropProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public DropProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(params System.Action[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } + Instance.OnFailure = items; + return this; + } - if (IgnoreFailureValue.HasValue) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.DropProcessor Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.DropProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/EnrichProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/EnrichProcessor.g.cs index 36af3be5431..90f74247a4f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/EnrichProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/EnrichProcessor.g.cs @@ -17,25 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class EnrichProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropMaxMatches = System.Text.Json.JsonEncodedText.Encode("max_matches"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOverride = System.Text.Json.JsonEncodedText.Encode("override"); + private static readonly System.Text.Json.JsonEncodedText PropPolicyName = System.Text.Json.JsonEncodedText.Encode("policy_name"); + private static readonly System.Text.Json.JsonEncodedText PropShapeRelation = System.Text.Json.JsonEncodedText.Encode("shape_relation"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propMaxMatches = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propOverride = default; + LocalJsonValue propPolicyName = default; + LocalJsonValue propShapeRelation = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propMaxMatches.TryReadProperty(ref reader, options, PropMaxMatches, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOverride.TryReadProperty(ref reader, options, PropOverride, null)) + { + continue; + } + + if (propPolicyName.TryReadProperty(ref reader, options, PropPolicyName, null)) + { + continue; + } + + if (propShapeRelation.TryReadProperty(ref reader, options, PropShapeRelation, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + MaxMatches = propMaxMatches.Value, + OnFailure = propOnFailure.Value, + Override = propOverride.Value, + PolicyName = propPolicyName.Value, + ShapeRelation = propShapeRelation.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropMaxMatches, value.MaxMatches, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverride, value.Override, null, null); + writer.WriteProperty(options, PropPolicyName, value.PolicyName, null, null); + writer.WriteProperty(options, PropShapeRelation, value.ShapeRelation, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorConverter))] public sealed partial class EnrichProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichProcessor(Elastic.Clients.Elasticsearch.Field field, string policyName, Elastic.Clients.Elasticsearch.Field targetField) + { + Field = field; + PolicyName = policyName; + TargetField = targetField; + } +#if NET7_0_OR_GREATER + public EnrichProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EnrichProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,23 +202,24 @@ public sealed partial class EnrichProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,7 +227,6 @@ public sealed partial class EnrichProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -78,7 +236,6 @@ public sealed partial class EnrichProcessor /// In order to avoid documents getting too large, the maximum allowed value is 128. /// /// - [JsonInclude, JsonPropertyName("max_matches")] public int? MaxMatches { get; set; } /// @@ -86,8 +243,7 @@ public sealed partial class EnrichProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -95,7 +251,6 @@ public sealed partial class EnrichProcessor /// When set to false, such fields will not be touched. /// /// - [JsonInclude, JsonPropertyName("override")] public bool? Override { get; set; } /// @@ -103,8 +258,11 @@ public sealed partial class EnrichProcessor /// The name of the enrich policy to use. /// /// - [JsonInclude, JsonPropertyName("policy_name")] - public string PolicyName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PolicyName { get; set; } /// /// @@ -112,7 +270,6 @@ public sealed partial class EnrichProcessor /// This option is only used for geo_match enrich policy types. /// /// - [JsonInclude, JsonPropertyName("shape_relation")] public Elastic.Clients.Elasticsearch.GeoShapeRelation? ShapeRelation { get; set; } /// @@ -121,7 +278,6 @@ public sealed partial class EnrichProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -130,35 +286,31 @@ public sealed partial class EnrichProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("target_field")] - public Elastic.Clients.Elasticsearch.Field TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(EnrichProcessor enrichProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Enrich(enrichProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field TargetField { get; set; } } -public sealed partial class EnrichProcessorDescriptor : SerializableDescriptor> +public readonly partial struct EnrichProcessorDescriptor { - internal EnrichProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor Instance { get; init; } - public EnrichProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private int? MaxMatchesValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string PolicyNameValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? ShapeRelationValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -166,10 +318,10 @@ public EnrichProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public EnrichProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -178,10 +330,10 @@ public EnrichProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -190,22 +342,32 @@ public EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch. /// Supports template snippets. /// /// - public EnrichProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field in the input document that matches the policies match_field used to retrieve the enrichment data. - /// Supports template snippets. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public EnrichProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -213,10 +375,10 @@ public EnrichProcessorDescriptor Field(Expression /// - public EnrichProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -224,10 +386,10 @@ public EnrichProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public EnrichProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -235,10 +397,10 @@ public EnrichProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public EnrichProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -248,10 +410,10 @@ public EnrichProcessorDescriptor IgnoreMissing(bool? ignoreMissing = /// In order to avoid documents getting too large, the maximum allowed value is 128. /// /// - public EnrichProcessorDescriptor MaxMatches(int? maxMatches) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor MaxMatches(int? value) { - MaxMatchesValue = maxMatches; - return Self; + Instance.MaxMatches = value; + return this; } /// @@ -259,40 +421,38 @@ public EnrichProcessorDescriptor MaxMatches(int? maxMatches) /// Handle failures for the processor. /// /// - public EnrichProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public EnrichProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public EnrichProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public EnrichProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -301,10 +461,10 @@ public EnrichProcessorDescriptor OnFailure(params Actionfalse, such fields will not be touched. /// /// - public EnrichProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -312,10 +472,10 @@ public EnrichProcessorDescriptor Override(bool? value = true) /// The name of the enrich policy to use. /// /// - public EnrichProcessorDescriptor PolicyName(string policyName) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor PolicyName(string value) { - PolicyNameValue = policyName; - return Self; + Instance.PolicyName = value; + return this; } /// @@ -324,10 +484,10 @@ public EnrichProcessorDescriptor PolicyName(string policyName) /// This option is only used for geo_match enrich policy types. /// /// - public EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasticsearch.GeoShapeRelation? shapeRelation) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - ShapeRelationValue = shapeRelation; - return Self; + Instance.ShapeRelation = value; + return this; } /// @@ -336,10 +496,10 @@ public EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasti /// Useful for debugging and metrics. /// /// - public EnrichProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -348,10 +508,10 @@ public EnrichProcessorDescriptor Tag(string? tag) /// Supports template snippets. /// /// - public EnrichProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field targetField) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -360,139 +520,39 @@ public EnrichProcessorDescriptor TargetField(Elastic.Clients.Elastics /// Supports template snippets. /// /// - public EnrichProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// Field added to incoming documents to contain enrich data. This field contains both the match_field and enrich_fields specified in the enrich policy. - /// Supports template snippets. - /// - /// - public EnrichProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (MaxMatchesValue.HasValue) - { - writer.WritePropertyName("max_matches"); - writer.WriteNumberValue(MaxMatchesValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - writer.WritePropertyName("policy_name"); - writer.WriteStringValue(PolicyNameValue); - if (ShapeRelationValue is not null) - { - writer.WritePropertyName("shape_relation"); - JsonSerializer.Serialize(writer, ShapeRelationValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class EnrichProcessorDescriptor : SerializableDescriptor +public readonly partial struct EnrichProcessorDescriptor { - internal EnrichProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor Instance { get; init; } - public EnrichProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private int? MaxMatchesValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string PolicyNameValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? ShapeRelationValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnrichProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -500,10 +560,10 @@ public EnrichProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public EnrichProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -512,10 +572,10 @@ public EnrichProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -524,22 +584,32 @@ public EnrichProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// Supports template snippets. /// /// - public EnrichProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field in the input document that matches the policies match_field used to retrieve the enrichment data. - /// Supports template snippets. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public EnrichProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -547,10 +617,10 @@ public EnrichProcessorDescriptor Field(Expression /// - public EnrichProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -558,10 +628,10 @@ public EnrichProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public EnrichProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -569,10 +639,10 @@ public EnrichProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public EnrichProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -582,10 +652,10 @@ public EnrichProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// In order to avoid documents getting too large, the maximum allowed value is 128. /// /// - public EnrichProcessorDescriptor MaxMatches(int? maxMatches) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor MaxMatches(int? value) { - MaxMatchesValue = maxMatches; - return Self; + Instance.MaxMatches = value; + return this; } /// @@ -593,40 +663,55 @@ public EnrichProcessorDescriptor MaxMatches(int? maxMatches) /// Handle failures for the processor. /// /// - public EnrichProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public EnrichProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public EnrichProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public EnrichProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -635,10 +720,10 @@ public EnrichProcessorDescriptor OnFailure(params Actionfalse, such fields will not be touched. /// /// - public EnrichProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -646,10 +731,10 @@ public EnrichProcessorDescriptor Override(bool? value = true) /// The name of the enrich policy to use. /// /// - public EnrichProcessorDescriptor PolicyName(string policyName) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor PolicyName(string value) { - PolicyNameValue = policyName; - return Self; + Instance.PolicyName = value; + return this; } /// @@ -658,10 +743,10 @@ public EnrichProcessorDescriptor PolicyName(string policyName) /// This option is only used for geo_match enrich policy types. /// /// - public EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasticsearch.GeoShapeRelation? shapeRelation) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - ShapeRelationValue = shapeRelation; - return Self; + Instance.ShapeRelation = value; + return this; } /// @@ -670,10 +755,10 @@ public EnrichProcessorDescriptor ShapeRelation(Elastic.Clients.Elasticsearch.Geo /// Useful for debugging and metrics. /// /// - public EnrichProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -682,10 +767,10 @@ public EnrichProcessorDescriptor Tag(string? tag) /// Supports template snippets. /// /// - public EnrichProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field targetField) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -694,112 +779,17 @@ public EnrichProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field /// Supports template snippets. /// /// - public EnrichProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// Field added to incoming documents to contain enrich data. This field contains both the match_field and enrich_fields specified in the enrich policy. - /// Supports template snippets. - /// - /// - public EnrichProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor Build(System.Action action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (MaxMatchesValue.HasValue) - { - writer.WritePropertyName("max_matches"); - writer.WriteNumberValue(MaxMatchesValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - writer.WritePropertyName("policy_name"); - writer.WriteStringValue(PolicyNameValue); - if (ShapeRelationValue is not null) - { - writer.WritePropertyName("shape_relation"); - JsonSerializer.Serialize(writer, ShapeRelationValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FailProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FailProcessor.g.cs index 5f072ad8050..88e8bea5953 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FailProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FailProcessor.g.cs @@ -17,25 +17,127 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class FailProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropMessage = System.Text.Json.JsonEncodedText.Encode("message"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.FailProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propMessage = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propMessage.TryReadProperty(ref reader, options, PropMessage, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + Message = propMessage.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.FailProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropMessage, value.Message, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.FailProcessorConverter))] public sealed partial class FailProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailProcessor(string message) + { + Message = message; + } +#if NET7_0_OR_GREATER + public FailProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FailProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,15 +145,13 @@ public sealed partial class FailProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -60,16 +160,18 @@ public sealed partial class FailProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("message")] - public string Message { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Message { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -77,29 +179,27 @@ public sealed partial class FailProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(FailProcessor failProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Fail(failProcessor); } -public sealed partial class FailProcessorDescriptor : SerializableDescriptor> +public readonly partial struct FailProcessorDescriptor { - internal FailProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.FailProcessor Instance { get; init; } - public FailProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FailProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string MessageValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FailProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -107,10 +207,21 @@ public FailProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public FailProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - DescriptionValue = description; - return Self; + Instance.If = value; + return this; } /// @@ -118,10 +229,21 @@ public FailProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public FailProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -129,10 +251,10 @@ public FailProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public FailProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -141,10 +263,10 @@ public FailProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tr /// Supports template snippets. /// /// - public FailProcessorDescriptor Message(string message) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Message(string value) { - MessageValue = message; - return Self; + Instance.Message = value; + return this; } /// @@ -152,40 +274,38 @@ public FailProcessorDescriptor Message(string message) /// Handle failures for the processor. /// /// - public FailProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public FailProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public FailProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public FailProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -194,93 +314,39 @@ public FailProcessorDescriptor OnFailure(params Action /// - public FailProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.FailProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - writer.WritePropertyName("message"); - writer.WriteStringValue(MessageValue); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FailProcessorDescriptor : SerializableDescriptor +public readonly partial struct FailProcessorDescriptor { - internal FailProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.FailProcessor Instance { get; init; } - public FailProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FailProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string MessageValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FailProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FailProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -288,10 +354,10 @@ public FailProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public FailProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -299,148 +365,130 @@ public FailProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public FailProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public FailProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// The error message thrown by the processor. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public FailProcessorDescriptor Message(string message) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor If(System.Action? action) { - MessageValue = message; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public FailProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public FailProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreFailure = value; + return this; } - public FailProcessorDescriptor OnFailure(Action configure) + /// + /// + /// The error message thrown by the processor. + /// Supports template snippets. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Message(string value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Message = value; + return this; } - public FailProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public FailProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(params System.Action[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } + Instance.OnFailure = items; + return this; + } - writer.WritePropertyName("message"); - writer.WriteStringValue(MessageValue); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + Instance.OnFailure = items; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.FailProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.FailProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FingerprintProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FingerprintProcessor.g.cs index 1242f11c013..35e8a4fc6d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FingerprintProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/FingerprintProcessor.g.cs @@ -17,25 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class FingerprintProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropMethod = System.Text.Json.JsonEncodedText.Encode("method"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropSalt = System.Text.Json.JsonEncodedText.Encode("salt"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propFields = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propMethod = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propSalt = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propMethod.TryReadProperty(ref reader, options, PropMethod, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSalt.TryReadProperty(ref reader, options, PropSalt, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Fields = propFields.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + Method = propMethod.Value, + OnFailure = propOnFailure.Value, + Salt = propSalt.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropMethod, value.Method, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSalt, value.Salt, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorConverter))] public sealed partial class FingerprintProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintProcessor(Elastic.Clients.Elasticsearch.Fields fields) + { + Fields = fields; + } +#if NET7_0_OR_GREATER + public FingerprintProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FingerprintProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -45,24 +183,24 @@ public sealed partial class FingerprintProcessor /// only the field value. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Fields { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -71,7 +209,6 @@ public sealed partial class FingerprintProcessor /// missing, the processor silently exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -80,7 +217,6 @@ public sealed partial class FingerprintProcessor /// SHA-256, SHA-512, or MurmurHash3. /// /// - [JsonInclude, JsonPropertyName("method")] public Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? Method { get; set; } /// @@ -88,15 +224,13 @@ public sealed partial class FingerprintProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Salt value for the hash function. /// /// - [JsonInclude, JsonPropertyName("salt")] public string? Salt { get; set; } /// @@ -105,7 +239,6 @@ public sealed partial class FingerprintProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -113,33 +246,27 @@ public sealed partial class FingerprintProcessor /// Output field for the fingerprint. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(FingerprintProcessor fingerprintProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Fingerprint(fingerprintProcessor); } -public sealed partial class FingerprintProcessorDescriptor : SerializableDescriptor> +public readonly partial struct FingerprintProcessorDescriptor { - internal FingerprintProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor instance) + { + Instance = instance; + } - public FingerprintProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? MethodValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? SaltValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -147,10 +274,10 @@ public FingerprintProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public FingerprintProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -160,10 +287,34 @@ public FingerprintProcessorDescriptor Description(string? description /// only the field value. /// /// - public FingerprintProcessorDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Array of fields to include in the fingerprint. For objects, the processor + /// hashes both the field key and value. For other fields, the processor hashes + /// only the field value. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldsValue = fields; - return Self; + Instance.If = value; + return this; } /// @@ -171,10 +322,21 @@ public FingerprintProcessorDescriptor Fields(Elastic.Clients.Elastics /// Conditionally execute the processor. /// /// - public FingerprintProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -182,10 +344,10 @@ public FingerprintProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public FingerprintProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -194,10 +356,10 @@ public FingerprintProcessorDescriptor IgnoreFailure(bool? ignoreFailu /// missing, the processor silently exits without modifying the document. /// /// - public FingerprintProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -206,10 +368,10 @@ public FingerprintProcessorDescriptor IgnoreMissing(bool? ignoreMissi /// SHA-256, SHA-512, or MurmurHash3. /// /// - public FingerprintProcessorDescriptor Method(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? method) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Method(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? value) { - MethodValue = method; - return Self; + Instance.Method = value; + return this; } /// @@ -217,40 +379,38 @@ public FingerprintProcessorDescriptor Method(Elastic.Clients.Elastics /// Handle failures for the processor. /// /// - public FingerprintProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public FingerprintProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public FingerprintProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public FingerprintProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -258,10 +418,10 @@ public FingerprintProcessorDescriptor OnFailure(params Action /// - public FingerprintProcessorDescriptor Salt(string? salt) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Salt(string? value) { - SaltValue = salt; - return Self; + Instance.Salt = value; + return this; } /// @@ -270,10 +430,10 @@ public FingerprintProcessorDescriptor Salt(string? salt) /// Useful for debugging and metrics. /// /// - public FingerprintProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -281,10 +441,10 @@ public FingerprintProcessorDescriptor Tag(string? tag) /// Output field for the fingerprint. /// /// - public FingerprintProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -292,132 +452,39 @@ public FingerprintProcessorDescriptor TargetField(Elastic.Clients.Ela /// Output field for the fingerprint. /// /// - public FingerprintProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// Output field for the fingerprint. - /// - /// - public FingerprintProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (MethodValue is not null) - { - writer.WritePropertyName("method"); - JsonSerializer.Serialize(writer, MethodValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(SaltValue)) - { - writer.WritePropertyName("salt"); - writer.WriteStringValue(SaltValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FingerprintProcessorDescriptor : SerializableDescriptor +public readonly partial struct FingerprintProcessorDescriptor { - internal FingerprintProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor instance) + { + Instance = instance; + } - public FingerprintProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FingerprintProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? MethodValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? SaltValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -425,10 +492,10 @@ public FingerprintProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public FingerprintProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -438,10 +505,34 @@ public FingerprintProcessorDescriptor Description(string? description) /// only the field value. /// /// - public FingerprintProcessorDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// Array of fields to include in the fingerprint. For objects, the processor + /// hashes both the field key and value. For other fields, the processor hashes + /// only the field value. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; } /// @@ -449,10 +540,21 @@ public FingerprintProcessorDescriptor Fields(Elastic.Clients.Elasticsearch.Field /// Conditionally execute the processor. /// /// - public FingerprintProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -460,10 +562,10 @@ public FingerprintProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public FingerprintProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -472,10 +574,10 @@ public FingerprintProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// missing, the processor silently exits without modifying the document. /// /// - public FingerprintProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -484,10 +586,10 @@ public FingerprintProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// SHA-256, SHA-512, or MurmurHash3. /// /// - public FingerprintProcessorDescriptor Method(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? method) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Method(Elastic.Clients.Elasticsearch.Ingest.FingerprintDigest? value) { - MethodValue = method; - return Self; + Instance.Method = value; + return this; } /// @@ -495,74 +597,78 @@ public FingerprintProcessorDescriptor Method(Elastic.Clients.Elasticsearch.Inges /// Handle failures for the processor. /// /// - public FingerprintProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public FingerprintProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public FingerprintProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public FingerprintProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Salt value for the hash function. + /// Handle failures for the processor. /// /// - public FingerprintProcessorDescriptor Salt(string? salt) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor OnFailure(params System.Action>[] actions) { - SaltValue = salt; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Salt value for the hash function. /// /// - public FingerprintProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Salt(string? value) { - TagValue = tag; - return Self; + Instance.Salt = value; + return this; } /// /// - /// Output field for the fingerprint. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public FingerprintProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -570,10 +676,10 @@ public FingerprintProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch. /// Output field for the fingerprint. /// /// - public FingerprintProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -581,96 +687,17 @@ public FingerprintProcessorDescriptor TargetField(Expression< /// Output field for the fingerprint. /// /// - public FingerprintProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (MethodValue is not null) - { - writer.WritePropertyName("method"); - JsonSerializer.Serialize(writer, MethodValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(SaltValue)) - { - writer.WritePropertyName("salt"); - writer.WriteStringValue(SaltValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ForeachProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ForeachProcessor.g.cs index eed79aa6e2c..3b38cf1cc87 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ForeachProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ForeachProcessor.g.cs @@ -17,25 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class ForeachProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProcessor = System.Text.Json.JsonEncodedText.Encode("processor"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propProcessor = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProcessor.TryReadProperty(ref reader, options, PropProcessor, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Processor = propProcessor.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProcessor, value.Processor, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorConverter))] public sealed partial class ForeachProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForeachProcessor(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Ingest.Processor processor) + { + Field = field; + Processor = processor; + } +#if NET7_0_OR_GREATER + public ForeachProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ForeachProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +164,24 @@ public sealed partial class ForeachProcessor /// Field containing array or object values. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +189,6 @@ public sealed partial class ForeachProcessor /// If true, the processor silently exits without changing the document if the field is null or missing. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,16 +196,18 @@ public sealed partial class ForeachProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Ingest processor to run on each element. /// /// - [JsonInclude, JsonPropertyName("processor")] - public Elastic.Clients.Elasticsearch.Ingest.Processor Processor { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.Processor Processor { get; set; } /// /// @@ -92,33 +215,27 @@ public sealed partial class ForeachProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(ForeachProcessor foreachProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Foreach(foreachProcessor); } -public sealed partial class ForeachProcessorDescriptor : SerializableDescriptor> +public readonly partial struct ForeachProcessorDescriptor { - internal ForeachProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForeachProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor instance) + { + Instance = instance; + } - public ForeachProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForeachProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.Processor ProcessorValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorDescriptor { get; set; } - private Action> ProcessorDescriptorAction { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -126,10 +243,10 @@ public ForeachProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ForeachProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -137,10 +254,10 @@ public ForeachProcessorDescriptor Description(string? description) /// Field containing array or object values. /// /// - public ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -148,21 +265,32 @@ public ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch /// Field containing array or object values. /// /// - public ForeachProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing array or object values. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public ForeachProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -170,10 +298,10 @@ public ForeachProcessorDescriptor Field(Expression /// - public ForeachProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -181,10 +309,10 @@ public ForeachProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public ForeachProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -192,10 +320,10 @@ public ForeachProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// If true, the processor silently exits without changing the document if the field is null or missing. /// /// - public ForeachProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -203,40 +331,38 @@ public ForeachProcessorDescriptor IgnoreMissing(bool? ignoreMissing = /// Handle failures for the processor. /// /// - public ForeachProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public ForeachProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public ForeachProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public ForeachProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -244,28 +370,21 @@ public ForeachProcessorDescriptor OnFailure(params Action /// - public ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.Processor processor) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.Processor value) { - ProcessorDescriptor = null; - ProcessorDescriptorAction = null; - ProcessorValue = processor; - return Self; + Instance.Processor = value; + return this; } - public ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - ProcessorValue = null; - ProcessorDescriptorAction = null; - ProcessorDescriptor = descriptor; - return Self; - } - - public ForeachProcessorDescriptor Processor(Action> configure) + /// + /// + /// Ingest processor to run on each element. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Processor(System.Action> action) { - ProcessorValue = null; - ProcessorDescriptor = null; - ProcessorDescriptorAction = configure; - return Self; + Instance.Processor = Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action); + return this; } /// @@ -274,119 +393,39 @@ public ForeachProcessorDescriptor Processor(Action /// - public ForeachProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ProcessorDescriptor is not null) - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, ProcessorDescriptor, options); - } - else if (ProcessorDescriptorAction is not null) - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorDescriptorAction), options); - } - else - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, ProcessorValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ForeachProcessorDescriptor : SerializableDescriptor +public readonly partial struct ForeachProcessorDescriptor { - internal ForeachProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForeachProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor instance) + { + Instance = instance; + } - public ForeachProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ForeachProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.Processor ProcessorValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorDescriptor { get; set; } - private Action ProcessorDescriptorAction { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -394,10 +433,10 @@ public ForeachProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ForeachProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -405,10 +444,10 @@ public ForeachProcessorDescriptor Description(string? description) /// Field containing array or object values. /// /// - public ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -416,21 +455,21 @@ public ForeachProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// Field containing array or object values. /// /// - public ForeachProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing array or object values. + /// Conditionally execute the processor. /// /// - public ForeachProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -438,10 +477,21 @@ public ForeachProcessorDescriptor Field(Expression /// - public ForeachProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -449,10 +499,10 @@ public ForeachProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public ForeachProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -460,10 +510,10 @@ public ForeachProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true, the processor silently exits without changing the document if the field is null or missing. /// /// - public ForeachProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -471,40 +521,55 @@ public ForeachProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public ForeachProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public ForeachProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public ForeachProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public ForeachProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -512,28 +577,32 @@ public ForeachProcessorDescriptor OnFailure(params Action /// - public ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.Processor processor) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.Processor value) { - ProcessorDescriptor = null; - ProcessorDescriptorAction = null; - ProcessorValue = processor; - return Self; + Instance.Processor = value; + return this; } - public ForeachProcessorDescriptor Processor(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Ingest processor to run on each element. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Processor(System.Action action) { - ProcessorValue = null; - ProcessorDescriptorAction = null; - ProcessorDescriptor = descriptor; - return Self; + Instance.Processor = Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action); + return this; } - public ForeachProcessorDescriptor Processor(Action configure) + /// + /// + /// Ingest processor to run on each element. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Processor(System.Action> action) { - ProcessorValue = null; - ProcessorDescriptor = null; - ProcessorDescriptorAction = configure; - return Self; + Instance.Processor = Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action); + return this; } /// @@ -542,94 +611,17 @@ public ForeachProcessorDescriptor Processor(Action /// - public ForeachProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ProcessorDescriptor is not null) - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, ProcessorDescriptor, options); - } - else if (ProcessorDescriptorAction is not null) - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorDescriptorAction), options); - } - else - { - writer.WritePropertyName("processor"); - JsonSerializer.Serialize(writer, ProcessorValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoGridProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoGridProcessor.g.cs index a0b61667ffe..2615af4e7f9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoGridProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoGridProcessor.g.cs @@ -17,24 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GeoGridProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChildrenField = System.Text.Json.JsonEncodedText.Encode("children_field"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropNonChildrenField = System.Text.Json.JsonEncodedText.Encode("non_children_field"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropParentField = System.Text.Json.JsonEncodedText.Encode("parent_field"); + private static readonly System.Text.Json.JsonEncodedText PropPrecisionField = System.Text.Json.JsonEncodedText.Encode("precision_field"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropTargetFormat = System.Text.Json.JsonEncodedText.Encode("target_format"); + private static readonly System.Text.Json.JsonEncodedText PropTileType = System.Text.Json.JsonEncodedText.Encode("tile_type"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChildrenField = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propNonChildrenField = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propParentField = default; + LocalJsonValue propPrecisionField = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propTargetFormat = default; + LocalJsonValue propTileType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChildrenField.TryReadProperty(ref reader, options, PropChildrenField, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propNonChildrenField.TryReadProperty(ref reader, options, PropNonChildrenField, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propParentField.TryReadProperty(ref reader, options, PropParentField, null)) + { + continue; + } + + if (propPrecisionField.TryReadProperty(ref reader, options, PropPrecisionField, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propTargetFormat.TryReadProperty(ref reader, options, PropTargetFormat, null)) + { + continue; + } + + if (propTileType.TryReadProperty(ref reader, options, PropTileType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChildrenField = propChildrenField.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + NonChildrenField = propNonChildrenField.Value, + OnFailure = propOnFailure.Value, + ParentField = propParentField.Value, + PrecisionField = propPrecisionField.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value, + TargetFormat = propTargetFormat.Value, + TileType = propTileType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChildrenField, value.ChildrenField, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropNonChildrenField, value.NonChildrenField, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropParentField, value.ParentField, null, null); + writer.WriteProperty(options, PropPrecisionField, value.PrecisionField, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropTargetFormat, value.TargetFormat, null, null); + writer.WriteProperty(options, PropTileType, value.TileType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorConverter))] public sealed partial class GeoGridProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridProcessor(string field, Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType tileType) + { + Field = field; + TileType = tileType; + } +#if NET7_0_OR_GREATER + public GeoGridProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoGridProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If specified and children tiles exist, save those tile addresses to this field as an array of strings. /// /// - [JsonInclude, JsonPropertyName("children_field")] public Elastic.Clients.Elasticsearch.Field? ChildrenField { get; set; } /// @@ -43,7 +218,6 @@ public sealed partial class GeoGridProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -52,23 +226,24 @@ public sealed partial class GeoGridProcessor /// The field format is determined by the tile_type. /// /// - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -76,7 +251,6 @@ public sealed partial class GeoGridProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -84,7 +258,6 @@ public sealed partial class GeoGridProcessor /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. /// /// - [JsonInclude, JsonPropertyName("non_children_field")] public Elastic.Clients.Elasticsearch.Field? NonChildrenField { get; set; } /// @@ -92,15 +265,13 @@ public sealed partial class GeoGridProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// If specified and a parent tile exists, save that tile address to this field. /// /// - [JsonInclude, JsonPropertyName("parent_field")] public Elastic.Clients.Elasticsearch.Field? ParentField { get; set; } /// @@ -108,7 +279,6 @@ public sealed partial class GeoGridProcessor /// If specified, save the tile precision (zoom) as an integer to this field. /// /// - [JsonInclude, JsonPropertyName("precision_field")] public Elastic.Clients.Elasticsearch.Field? PrecisionField { get; set; } /// @@ -117,7 +287,6 @@ public sealed partial class GeoGridProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -125,7 +294,6 @@ public sealed partial class GeoGridProcessor /// The field to assign the polygon shape to, by default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -133,7 +301,6 @@ public sealed partial class GeoGridProcessor /// Which format to save the generated polygon in. /// /// - [JsonInclude, JsonPropertyName("target_format")] public Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? TargetFormat { get; set; } /// @@ -141,58 +308,41 @@ public sealed partial class GeoGridProcessor /// Three tile formats are understood: geohash, geotile and geohex. /// /// - [JsonInclude, JsonPropertyName("tile_type")] - public Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType TileType { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(GeoGridProcessor geoGridProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.GeoGrid(geoGridProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType TileType { get; set; } } -public sealed partial class GeoGridProcessorDescriptor : SerializableDescriptor> +public readonly partial struct GeoGridProcessorDescriptor { - internal GeoGridProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor Instance { get; init; } - public GeoGridProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? ChildrenFieldValue { get; set; } - private string? DescriptionValue { get; set; } - private string FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? NonChildrenFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field? ParentFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PrecisionFieldValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? TargetFormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType TileTypeValue { get; set; } - - /// - /// - /// If specified and children tiles exist, save those tile addresses to this field as an array of strings. - /// - /// - public GeoGridProcessorDescriptor ChildrenField(Elastic.Clients.Elasticsearch.Field? childrenField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridProcessorDescriptor() { - ChildrenFieldValue = childrenField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor descriptor) => descriptor.Instance; + /// /// /// If specified and children tiles exist, save those tile addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor ChildrenField(Expression> childrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ChildrenField(Elastic.Clients.Elasticsearch.Field? value) { - ChildrenFieldValue = childrenField; - return Self; + Instance.ChildrenField = value; + return this; } /// @@ -200,10 +350,10 @@ public GeoGridProcessorDescriptor ChildrenField(Expression /// - public GeoGridProcessorDescriptor ChildrenField(Expression> childrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ChildrenField(System.Linq.Expressions.Expression> value) { - ChildrenFieldValue = childrenField; - return Self; + Instance.ChildrenField = value; + return this; } /// @@ -212,10 +362,10 @@ public GeoGridProcessorDescriptor ChildrenField(Expression /// - public GeoGridProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -224,10 +374,10 @@ public GeoGridProcessorDescriptor Description(string? description) /// The field format is determined by the tile_type. /// /// - public GeoGridProcessorDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -235,54 +385,54 @@ public GeoGridProcessorDescriptor Field(string field) /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// If true and field does not exist, the processor quietly exits without modifying the document. + /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If(System.Action? action) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. + /// Ignore failures for the processor. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Elastic.Clients.Elasticsearch.Field? nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor IgnoreFailure(bool? value = true) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. + /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Expression> nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor IgnoreMissing(bool? value = true) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -290,106 +440,82 @@ public GeoGridProcessorDescriptor NonChildrenField(Expression /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Expression> nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor NonChildrenField(Elastic.Clients.Elasticsearch.Field? value) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.NonChildrenField = value; + return this; } /// /// - /// Handle failures for the processor. + /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public GeoGridProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public GeoGridProcessorDescriptor OnFailure(Action> configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public GeoGridProcessorDescriptor OnFailure(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor NonChildrenField(System.Linq.Expressions.Expression> value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.NonChildrenField = value; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Elastic.Clients.Elasticsearch.Field? parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - ParentFieldValue = parentField; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Expression> parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ParentFieldValue = parentField; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Expression> parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(params System.Action>[] actions) { - ParentFieldValue = parentField; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// If specified, save the tile precision (zoom) as an integer to this field. + /// If specified and a parent tile exists, save that tile address to this field. /// /// - public GeoGridProcessorDescriptor PrecisionField(Elastic.Clients.Elasticsearch.Field? precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ParentField(Elastic.Clients.Elasticsearch.Field? value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.ParentField = value; + return this; } /// /// - /// If specified, save the tile precision (zoom) as an integer to this field. + /// If specified and a parent tile exists, save that tile address to this field. /// /// - public GeoGridProcessorDescriptor PrecisionField(Expression> precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ParentField(System.Linq.Expressions.Expression> value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.ParentField = value; + return this; } /// @@ -397,33 +523,33 @@ public GeoGridProcessorDescriptor PrecisionField(Expression /// - public GeoGridProcessorDescriptor PrecisionField(Expression> precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor PrecisionField(Elastic.Clients.Elasticsearch.Field? value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.PrecisionField = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// If specified, save the tile precision (zoom) as an integer to this field. /// /// - public GeoGridProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor PrecisionField(System.Linq.Expressions.Expression> value) { - TagValue = tag; - return Self; + Instance.PrecisionField = value; + return this; } /// /// - /// The field to assign the polygon shape to, by default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -431,10 +557,10 @@ public GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elastic /// The field to assign the polygon shape to, by default, the field is updated in-place. /// /// - public GeoGridProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -442,10 +568,10 @@ public GeoGridProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public GeoGridProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -453,10 +579,10 @@ public GeoGridProcessorDescriptor TargetField(Expression /// - public GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? targetFormat) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? value) { - TargetFormatValue = targetFormat; - return Self; + Instance.TargetFormat = value; + return this; } /// @@ -464,166 +590,49 @@ public GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasti /// Three tile formats are understood: geohash, geotile and geohex. /// /// - public GeoGridProcessorDescriptor TileType(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType tileType) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TileType(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType value) { - TileTypeValue = tileType; - return Self; + Instance.TileType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (ChildrenFieldValue is not null) - { - writer.WritePropertyName("children_field"); - JsonSerializer.Serialize(writer, ChildrenFieldValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (NonChildrenFieldValue is not null) - { - writer.WritePropertyName("non_children_field"); - JsonSerializer.Serialize(writer, NonChildrenFieldValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ParentFieldValue is not null) - { - writer.WritePropertyName("parent_field"); - JsonSerializer.Serialize(writer, ParentFieldValue, options); - } - - if (PrecisionFieldValue is not null) - { - writer.WritePropertyName("precision_field"); - JsonSerializer.Serialize(writer, PrecisionFieldValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TargetFormatValue is not null) - { - writer.WritePropertyName("target_format"); - JsonSerializer.Serialize(writer, TargetFormatValue, options); - } - - writer.WritePropertyName("tile_type"); - JsonSerializer.Serialize(writer, TileTypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoGridProcessorDescriptor : SerializableDescriptor +public readonly partial struct GeoGridProcessorDescriptor { - internal GeoGridProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor Instance { get; init; } - public GeoGridProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? ChildrenFieldValue { get; set; } - private string? DescriptionValue { get; set; } - private string FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? NonChildrenFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field? ParentFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PrecisionFieldValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? TargetFormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType TileTypeValue { get; set; } - - /// - /// - /// If specified and children tiles exist, save those tile addresses to this field as an array of strings. - /// - /// - public GeoGridProcessorDescriptor ChildrenField(Elastic.Clients.Elasticsearch.Field? childrenField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridProcessorDescriptor() { - ChildrenFieldValue = childrenField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor descriptor) => descriptor.Instance; + /// /// /// If specified and children tiles exist, save those tile addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor ChildrenField(Expression> childrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ChildrenField(Elastic.Clients.Elasticsearch.Field? value) { - ChildrenFieldValue = childrenField; - return Self; + Instance.ChildrenField = value; + return this; } /// @@ -631,10 +640,10 @@ public GeoGridProcessorDescriptor ChildrenField(Expression /// - public GeoGridProcessorDescriptor ChildrenField(Expression> childrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ChildrenField(System.Linq.Expressions.Expression> value) { - ChildrenFieldValue = childrenField; - return Self; + Instance.ChildrenField = value; + return this; } /// @@ -643,10 +652,10 @@ public GeoGridProcessorDescriptor ChildrenField(Expression /// - public GeoGridProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -655,10 +664,10 @@ public GeoGridProcessorDescriptor Description(string? description) /// The field format is determined by the tile_type. /// /// - public GeoGridProcessorDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -666,54 +675,54 @@ public GeoGridProcessorDescriptor Field(string field) /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// If true and field does not exist, the processor quietly exits without modifying the document. + /// Conditionally execute the processor. /// /// - public GeoGridProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor If(System.Action? action) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. + /// Ignore failures for the processor. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Elastic.Clients.Elasticsearch.Field? nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor IgnoreFailure(bool? value = true) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. + /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Expression> nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor IgnoreMissing(bool? value = true) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -721,106 +730,99 @@ public GeoGridProcessorDescriptor NonChildrenField(Expression /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor NonChildrenField(Expression> nonChildrenField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor NonChildrenField(Elastic.Clients.Elasticsearch.Field? value) { - NonChildrenFieldValue = nonChildrenField; - return Self; + Instance.NonChildrenField = value; + return this; } /// /// - /// Handle failures for the processor. + /// If specified and intersecting non-child tiles exist, save their addresses to this field as an array of strings. /// /// - public GeoGridProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor NonChildrenField(System.Linq.Expressions.Expression> value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.NonChildrenField = value; + return this; } - public GeoGridProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public GeoGridProcessorDescriptor OnFailure(Action configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public GeoGridProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Elastic.Clients.Elasticsearch.Field? parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ParentFieldValue = parentField; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Expression> parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(params System.Action[] actions) { - ParentFieldValue = parentField; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// If specified and a parent tile exists, save that tile address to this field. + /// Handle failures for the processor. /// /// - public GeoGridProcessorDescriptor ParentField(Expression> parentField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor OnFailure(params System.Action>[] actions) { - ParentFieldValue = parentField; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// If specified, save the tile precision (zoom) as an integer to this field. + /// If specified and a parent tile exists, save that tile address to this field. /// /// - public GeoGridProcessorDescriptor PrecisionField(Elastic.Clients.Elasticsearch.Field? precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ParentField(Elastic.Clients.Elasticsearch.Field? value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.ParentField = value; + return this; } /// /// - /// If specified, save the tile precision (zoom) as an integer to this field. + /// If specified and a parent tile exists, save that tile address to this field. /// /// - public GeoGridProcessorDescriptor PrecisionField(Expression> precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor ParentField(System.Linq.Expressions.Expression> value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.ParentField = value; + return this; } /// @@ -828,33 +830,33 @@ public GeoGridProcessorDescriptor PrecisionField(Expression /// - public GeoGridProcessorDescriptor PrecisionField(Expression> precisionField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor PrecisionField(Elastic.Clients.Elasticsearch.Field? value) { - PrecisionFieldValue = precisionField; - return Self; + Instance.PrecisionField = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// If specified, save the tile precision (zoom) as an integer to this field. /// /// - public GeoGridProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor PrecisionField(System.Linq.Expressions.Expression> value) { - TagValue = tag; - return Self; + Instance.PrecisionField = value; + return this; } /// /// - /// The field to assign the polygon shape to, by default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -862,10 +864,10 @@ public GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fiel /// The field to assign the polygon shape to, by default, the field is updated in-place. /// /// - public GeoGridProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -873,10 +875,10 @@ public GeoGridProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public GeoGridProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -884,10 +886,10 @@ public GeoGridProcessorDescriptor TargetField(Expression /// - public GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? targetFormat) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasticsearch.Ingest.GeoGridTargetFormat? value) { - TargetFormatValue = targetFormat; - return Self; + Instance.TargetFormat = value; + return this; } /// @@ -895,116 +897,17 @@ public GeoGridProcessorDescriptor TargetFormat(Elastic.Clients.Elasticsearch.Ing /// Three tile formats are understood: geohash, geotile and geohex. /// /// - public GeoGridProcessorDescriptor TileType(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType tileType) + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor TileType(Elastic.Clients.Elasticsearch.Ingest.GeoGridTileType value) { - TileTypeValue = tileType; - return Self; + Instance.TileType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (ChildrenFieldValue is not null) - { - writer.WritePropertyName("children_field"); - JsonSerializer.Serialize(writer, ChildrenFieldValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (NonChildrenFieldValue is not null) - { - writer.WritePropertyName("non_children_field"); - JsonSerializer.Serialize(writer, NonChildrenFieldValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ParentFieldValue is not null) - { - writer.WritePropertyName("parent_field"); - JsonSerializer.Serialize(writer, ParentFieldValue, options); - } - - if (PrecisionFieldValue is not null) - { - writer.WritePropertyName("precision_field"); - JsonSerializer.Serialize(writer, PrecisionFieldValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TargetFormatValue is not null) - { - writer.WritePropertyName("target_format"); - JsonSerializer.Serialize(writer, TargetFormatValue, options); - } - - writer.WritePropertyName("tile_type"); - JsonSerializer.Serialize(writer, TileTypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpDownloadStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpDownloadStatistics.g.cs index 70171fb6c8c..7906566a761 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpDownloadStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpDownloadStatistics.g.cs @@ -17,63 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GeoIpDownloadStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabasesCount = System.Text.Json.JsonEncodedText.Encode("databases_count"); + private static readonly System.Text.Json.JsonEncodedText PropExpiredDatabases = System.Text.Json.JsonEncodedText.Encode("expired_databases"); + private static readonly System.Text.Json.JsonEncodedText PropFailedDownloads = System.Text.Json.JsonEncodedText.Encode("failed_downloads"); + private static readonly System.Text.Json.JsonEncodedText PropSkippedUpdates = System.Text.Json.JsonEncodedText.Encode("skipped_updates"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessfulDownloads = System.Text.Json.JsonEncodedText.Encode("successful_downloads"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDownloadTime = System.Text.Json.JsonEncodedText.Encode("total_download_time"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDatabasesCount = default; + LocalJsonValue propExpiredDatabases = default; + LocalJsonValue propFailedDownloads = default; + LocalJsonValue propSkippedUpdates = default; + LocalJsonValue propSuccessfulDownloads = default; + LocalJsonValue propTotalDownloadTime = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabasesCount.TryReadProperty(ref reader, options, PropDatabasesCount, null)) + { + continue; + } + + if (propExpiredDatabases.TryReadProperty(ref reader, options, PropExpiredDatabases, null)) + { + continue; + } + + if (propFailedDownloads.TryReadProperty(ref reader, options, PropFailedDownloads, null)) + { + continue; + } + + if (propSkippedUpdates.TryReadProperty(ref reader, options, PropSkippedUpdates, null)) + { + continue; + } + + if (propSuccessfulDownloads.TryReadProperty(ref reader, options, PropSuccessfulDownloads, null)) + { + continue; + } + + if (propTotalDownloadTime.TryReadProperty(ref reader, options, PropTotalDownloadTime, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DatabasesCount = propDatabasesCount.Value, + ExpiredDatabases = propExpiredDatabases.Value, + FailedDownloads = propFailedDownloads.Value, + SkippedUpdates = propSkippedUpdates.Value, + SuccessfulDownloads = propSuccessfulDownloads.Value, + TotalDownloadTime = propTotalDownloadTime.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabasesCount, value.DatabasesCount, null, null); + writer.WriteProperty(options, PropExpiredDatabases, value.ExpiredDatabases, null, null); + writer.WriteProperty(options, PropFailedDownloads, value.FailedDownloads, null, null); + writer.WriteProperty(options, PropSkippedUpdates, value.SkippedUpdates, null, null); + writer.WriteProperty(options, PropSuccessfulDownloads, value.SuccessfulDownloads, null, null); + writer.WriteProperty(options, PropTotalDownloadTime, value.TotalDownloadTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatisticsConverter))] public sealed partial class GeoIpDownloadStatistics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpDownloadStatistics(int databasesCount, int expiredDatabases, int failedDownloads, int skippedUpdates, int successfulDownloads, System.TimeSpan totalDownloadTime) + { + DatabasesCount = databasesCount; + ExpiredDatabases = expiredDatabases; + FailedDownloads = failedDownloads; + SkippedUpdates = skippedUpdates; + SuccessfulDownloads = successfulDownloads; + TotalDownloadTime = totalDownloadTime; + } +#if NET7_0_OR_GREATER + public GeoIpDownloadStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoIpDownloadStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpDownloadStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Current number of databases available for use. /// /// - [JsonInclude, JsonPropertyName("databases_count")] - public int DatabasesCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DatabasesCount { get; set; } /// /// /// Total number of databases not updated after 30 days /// /// - [JsonInclude, JsonPropertyName("expired_databases")] - public int ExpiredDatabases { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ExpiredDatabases { get; set; } /// /// /// Total number of failed database downloads. /// /// - [JsonInclude, JsonPropertyName("failed_downloads")] - public int FailedDownloads { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int FailedDownloads { get; set; } /// /// /// Total number of database updates skipped. /// /// - [JsonInclude, JsonPropertyName("skipped_updates")] - public int SkippedUpdates { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int SkippedUpdates { get; set; } /// /// /// Total number of successful database downloads. /// /// - [JsonInclude, JsonPropertyName("successful_downloads")] - public int SuccessfulDownloads { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int SuccessfulDownloads { get; set; } /// /// /// Total milliseconds spent downloading databases. /// /// - [JsonInclude, JsonPropertyName("total_download_time")] - public long TotalDownloadTime { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalDownloadTime { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabaseName.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabaseName.g.cs index d634d346834..9a657211df9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabaseName.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabaseName.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GeoIpNodeDatabaseNameConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabaseName Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabaseName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabaseName value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabaseNameConverter))] public sealed partial class GeoIpNodeDatabaseName { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpNodeDatabaseName(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public GeoIpNodeDatabaseName() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoIpNodeDatabaseName() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpNodeDatabaseName(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the database. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabases.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabases.g.cs index 2624f7e5f33..a04a34b0dcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabases.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpNodeDatabases.g.cs @@ -17,36 +17,110 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GeoIpNodeDatabasesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabases = System.Text.Json.JsonEncodedText.Encode("databases"); + private static readonly System.Text.Json.JsonEncodedText PropFilesInTemp = System.Text.Json.JsonEncodedText.Encode("files_in_temp"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabases Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDatabases = default; + LocalJsonValue> propFilesInTemp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabases.TryReadProperty(ref reader, options, PropDatabases, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFilesInTemp.TryReadProperty(ref reader, options, PropFilesInTemp, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Databases = propDatabases.Value, + FilesInTemp = propFilesInTemp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabases value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabases, value.Databases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilesInTemp, value.FilesInTemp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// Downloaded databases for the node. The field key is the node ID. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabasesConverter))] public sealed partial class GeoIpNodeDatabases { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpNodeDatabases(System.Collections.Generic.IReadOnlyCollection databases, System.Collections.Generic.IReadOnlyCollection filesInTemp) + { + Databases = databases; + FilesInTemp = filesInTemp; + } +#if NET7_0_OR_GREATER + public GeoIpNodeDatabases() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoIpNodeDatabases() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpNodeDatabases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Downloaded databases for the node. /// /// - [JsonInclude, JsonPropertyName("databases")] - public IReadOnlyCollection Databases { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Databases { get; set; } /// /// /// Downloaded database files, including related license files. Elasticsearch stores these files in the node’s temporary directory: $ES_TMPDIR/geoip-databases/<node_id>. /// /// - [JsonInclude, JsonPropertyName("files_in_temp")] - public IReadOnlyCollection FilesInTemp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FilesInTemp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpProcessor.g.cs index db9452f8ded..f57710930a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GeoIpProcessor.g.cs @@ -17,24 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GeoIpProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabaseFile = System.Text.Json.JsonEncodedText.Encode("database_file"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDownloadDatabaseOnPipelineCreation = System.Text.Json.JsonEncodedText.Encode("download_database_on_pipeline_creation"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFirstOnly = System.Text.Json.JsonEncodedText.Encode("first_only"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDatabaseFile = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDownloadDatabaseOnPipelineCreation = default; + LocalJsonValue propField = default; + LocalJsonValue propFirstOnly = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProperties = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabaseFile.TryReadProperty(ref reader, options, PropDatabaseFile, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDownloadDatabaseOnPipelineCreation.TryReadProperty(ref reader, options, PropDownloadDatabaseOnPipelineCreation, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFirstOnly.TryReadProperty(ref reader, options, PropFirstOnly, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DatabaseFile = propDatabaseFile.Value, + Description = propDescription.Value, + DownloadDatabaseOnPipelineCreation = propDownloadDatabaseOnPipelineCreation.Value, + Field = propField.Value, + FirstOnly = propFirstOnly.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Properties = propProperties.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabaseFile, value.DatabaseFile, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDownloadDatabaseOnPipelineCreation, value.DownloadDatabaseOnPipelineCreation, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFirstOnly, value.FirstOnly, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorConverter))] public sealed partial class GeoIpProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public GeoIpProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoIpProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - [JsonInclude, JsonPropertyName("database_file")] public string? DatabaseFile { get; set; } /// @@ -43,7 +199,6 @@ public sealed partial class GeoIpProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -52,7 +207,6 @@ public sealed partial class GeoIpProcessor /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - [JsonInclude, JsonPropertyName("download_database_on_pipeline_creation")] public bool? DownloadDatabaseOnPipelineCreation { get; set; } /// @@ -60,15 +214,17 @@ public sealed partial class GeoIpProcessor /// The field to get the ip address from for the geographical lookup. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// If true, only the first found geoip data will be returned, even if the field contains an array. /// /// - [JsonInclude, JsonPropertyName("first_only")] public bool? FirstOnly { get; set; } /// @@ -76,15 +232,13 @@ public sealed partial class GeoIpProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -92,7 +246,6 @@ public sealed partial class GeoIpProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -100,16 +253,14 @@ public sealed partial class GeoIpProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Controls what properties are added to the target_field based on the geoip lookup. /// /// - [JsonInclude, JsonPropertyName("properties")] - public ICollection? Properties { get; set; } + public System.Collections.Generic.ICollection? Properties { get; set; } /// /// @@ -117,7 +268,6 @@ public sealed partial class GeoIpProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -125,45 +275,37 @@ public sealed partial class GeoIpProcessor /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(GeoIpProcessor geoIpProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Geoip(geoIpProcessor); } -public sealed partial class GeoIpProcessorDescriptor : SerializableDescriptor> +public readonly partial struct GeoIpProcessorDescriptor { - internal GeoIpProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor instance) + { + Instance = instance; + } - public GeoIpProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DatabaseFileValue { get; set; } - private string? DescriptionValue { get; set; } - private bool? DownloadDatabaseOnPipelineCreationValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? FirstOnlyValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - public GeoIpProcessorDescriptor DatabaseFile(string? databaseFile) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor DatabaseFile(string? value) { - DatabaseFileValue = databaseFile; - return Self; + Instance.DatabaseFile = value; + return this; } /// @@ -172,10 +314,10 @@ public GeoIpProcessorDescriptor DatabaseFile(string? databaseFile) /// Useful for describing the purpose of the processor or its configuration. /// /// - public GeoIpProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -184,10 +326,10 @@ public GeoIpProcessorDescriptor Description(string? description) /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - public GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? downloadDatabaseOnPipelineCreation = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? value = true) { - DownloadDatabaseOnPipelineCreationValue = downloadDatabaseOnPipelineCreation; - return Self; + Instance.DownloadDatabaseOnPipelineCreation = value; + return this; } /// @@ -195,10 +337,10 @@ public GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bo /// The field to get the ip address from for the geographical lookup. /// /// - public GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -206,32 +348,32 @@ public GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.F /// The field to get the ip address from for the geographical lookup. /// /// - public GeoIpProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the ip address from for the geographical lookup. + /// If true, only the first found geoip data will be returned, even if the field contains an array. /// /// - public GeoIpProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor FirstOnly(bool? value = true) { - FieldValue = field; - return Self; + Instance.FirstOnly = value; + return this; } /// /// - /// If true, only the first found geoip data will be returned, even if the field contains an array. + /// Conditionally execute the processor. /// /// - public GeoIpProcessorDescriptor FirstOnly(bool? firstOnly = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FirstOnlyValue = firstOnly; - return Self; + Instance.If = value; + return this; } /// @@ -239,10 +381,21 @@ public GeoIpProcessorDescriptor FirstOnly(bool? firstOnly = true) /// Conditionally execute the processor. /// /// - public GeoIpProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -250,10 +403,10 @@ public GeoIpProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GeoIpProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -261,10 +414,10 @@ public GeoIpProcessorDescriptor IgnoreFailure(bool? ignoreFailure = t /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public GeoIpProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -272,40 +425,38 @@ public GeoIpProcessorDescriptor IgnoreMissing(bool? ignoreMissing = t /// Handle failures for the processor. /// /// - public GeoIpProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GeoIpProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public GeoIpProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public GeoIpProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -313,33 +464,33 @@ public GeoIpProcessorDescriptor OnFailure(params Actiontarget_field based on the geoip lookup. /// /// - public GeoIpProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Controls what properties are added to the target_field based on the geoip lookup. /// /// - public GeoIpProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Properties(params string[] values) { - TagValue = tag; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// The field that will hold the geographical information looked up from the MaxMind database. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -347,10 +498,10 @@ public GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticse /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - public GeoIpProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -358,145 +509,49 @@ public GeoIpProcessorDescriptor TargetField(Expression /// - public GeoIpProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DatabaseFileValue)) - { - writer.WritePropertyName("database_file"); - writer.WriteStringValue(DatabaseFileValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DownloadDatabaseOnPipelineCreationValue.HasValue) - { - writer.WritePropertyName("download_database_on_pipeline_creation"); - writer.WriteBooleanValue(DownloadDatabaseOnPipelineCreationValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FirstOnlyValue.HasValue) - { - writer.WritePropertyName("first_only"); - writer.WriteBooleanValue(FirstOnlyValue.Value); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoIpProcessorDescriptor : SerializableDescriptor +public readonly partial struct GeoIpProcessorDescriptor { - internal GeoIpProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor Instance { get; init; } - public GeoIpProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor instance) { + Instance = instance; } - private string? DatabaseFileValue { get; set; } - private string? DescriptionValue { get; set; } - private bool? DownloadDatabaseOnPipelineCreationValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? FirstOnlyValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoIpProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - public GeoIpProcessorDescriptor DatabaseFile(string? databaseFile) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor DatabaseFile(string? value) { - DatabaseFileValue = databaseFile; - return Self; + Instance.DatabaseFile = value; + return this; } /// @@ -505,10 +560,10 @@ public GeoIpProcessorDescriptor DatabaseFile(string? databaseFile) /// Useful for describing the purpose of the processor or its configuration. /// /// - public GeoIpProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -517,10 +572,10 @@ public GeoIpProcessorDescriptor Description(string? description) /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - public GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? downloadDatabaseOnPipelineCreation = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? value = true) { - DownloadDatabaseOnPipelineCreationValue = downloadDatabaseOnPipelineCreation; - return Self; + Instance.DownloadDatabaseOnPipelineCreation = value; + return this; } /// @@ -528,10 +583,10 @@ public GeoIpProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? downloa /// The field to get the ip address from for the geographical lookup. /// /// - public GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -539,32 +594,43 @@ public GeoIpProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to get the ip address from for the geographical lookup. /// /// - public GeoIpProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the ip address from for the geographical lookup. + /// If true, only the first found geoip data will be returned, even if the field contains an array. /// /// - public GeoIpProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor FirstOnly(bool? value = true) { - FieldValue = field; - return Self; + Instance.FirstOnly = value; + return this; } /// /// - /// If true, only the first found geoip data will be returned, even if the field contains an array. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public GeoIpProcessorDescriptor FirstOnly(bool? firstOnly = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If() { - FirstOnlyValue = firstOnly; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -572,10 +638,10 @@ public GeoIpProcessorDescriptor FirstOnly(bool? firstOnly = true) /// Conditionally execute the processor. /// /// - public GeoIpProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -583,10 +649,10 @@ public GeoIpProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GeoIpProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -594,10 +660,10 @@ public GeoIpProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public GeoIpProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -605,40 +671,55 @@ public GeoIpProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public GeoIpProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GeoIpProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public GeoIpProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public GeoIpProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -646,33 +727,33 @@ public GeoIpProcessorDescriptor OnFailure(params Actiontarget_field based on the geoip lookup. /// /// - public GeoIpProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Controls what properties are added to the target_field based on the geoip lookup. /// /// - public GeoIpProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Properties(params string[] values) { - TagValue = tag; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// The field that will hold the geographical information looked up from the MaxMind database. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -680,10 +761,10 @@ public GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - public GeoIpProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -691,108 +772,17 @@ public GeoIpProcessorDescriptor TargetField(Expression /// - public GeoIpProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DatabaseFileValue)) - { - writer.WritePropertyName("database_file"); - writer.WriteStringValue(DatabaseFileValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DownloadDatabaseOnPipelineCreationValue.HasValue) - { - writer.WritePropertyName("download_database_on_pipeline_creation"); - writer.WriteBooleanValue(DownloadDatabaseOnPipelineCreationValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FirstOnlyValue.HasValue) - { - writer.WritePropertyName("first_only"); - writer.WriteBooleanValue(FirstOnlyValue.Value); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GrokProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GrokProcessor.g.cs index f7948688c86..824896503e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GrokProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GrokProcessor.g.cs @@ -17,25 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GrokProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEcsCompatibility = System.Text.Json.JsonEncodedText.Encode("ecs_compatibility"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPatternDefinitions = System.Text.Json.JsonEncodedText.Encode("pattern_definitions"); + private static readonly System.Text.Json.JsonEncodedText PropPatterns = System.Text.Json.JsonEncodedText.Encode("patterns"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTraceMatch = System.Text.Json.JsonEncodedText.Encode("trace_match"); + + public override Elastic.Clients.Elasticsearch.Ingest.GrokProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propEcsCompatibility = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propPatternDefinitions = default; + LocalJsonValue> propPatterns = default; + LocalJsonValue propTag = default; + LocalJsonValue propTraceMatch = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEcsCompatibility.TryReadProperty(ref reader, options, PropEcsCompatibility, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPatternDefinitions.TryReadProperty(ref reader, options, PropPatternDefinitions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPatterns.TryReadProperty(ref reader, options, PropPatterns, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTraceMatch.TryReadProperty(ref reader, options, PropTraceMatch, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + EcsCompatibility = propEcsCompatibility.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + PatternDefinitions = propPatternDefinitions.Value, + Patterns = propPatterns.Value, + Tag = propTag.Value, + TraceMatch = propTraceMatch.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GrokProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEcsCompatibility, value.EcsCompatibility, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPatternDefinitions, value.PatternDefinitions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPatterns, value.Patterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTraceMatch, value.TraceMatch, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GrokProcessorConverter))] public sealed partial class GrokProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrokProcessor(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection patterns) + { + Field = field; + Patterns = patterns; + } +#if NET7_0_OR_GREATER + public GrokProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GrokProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,7 +192,6 @@ public sealed partial class GrokProcessor /// Common Schema (ECS) field names. /// /// - [JsonInclude, JsonPropertyName("ecs_compatibility")] public string? EcsCompatibility { get; set; } /// @@ -52,23 +199,24 @@ public sealed partial class GrokProcessor /// The field to use for grok expression parsing. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -76,7 +224,6 @@ public sealed partial class GrokProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -84,8 +231,7 @@ public sealed partial class GrokProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -93,8 +239,7 @@ public sealed partial class GrokProcessor /// Patterns matching existing names will override the pre-existing definition. /// /// - [JsonInclude, JsonPropertyName("pattern_definitions")] - public IDictionary? PatternDefinitions { get; set; } + public System.Collections.Generic.IDictionary? PatternDefinitions { get; set; } /// /// @@ -102,8 +247,11 @@ public sealed partial class GrokProcessor /// Returns on the first expression in the list that matches. /// /// - [JsonInclude, JsonPropertyName("patterns")] - public ICollection Patterns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Patterns { get; set; } /// /// @@ -111,7 +259,6 @@ public sealed partial class GrokProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -119,34 +266,27 @@ public sealed partial class GrokProcessor /// When true, _ingest._grok_match_index will be inserted into your matched document’s metadata with the index into the pattern found in patterns that matched. /// /// - [JsonInclude, JsonPropertyName("trace_match")] public bool? TraceMatch { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(GrokProcessor grokProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Grok(grokProcessor); } -public sealed partial class GrokProcessorDescriptor : SerializableDescriptor> +public readonly partial struct GrokProcessorDescriptor { - internal GrokProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GrokProcessor Instance { get; init; } - public GrokProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrokProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? EcsCompatibilityValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private IDictionary? PatternDefinitionsValue { get; set; } - private ICollection PatternsValue { get; set; } - private string? TagValue { get; set; } - private bool? TraceMatchValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrokProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -154,10 +294,10 @@ public GrokProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public GrokProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -166,10 +306,10 @@ public GrokProcessorDescriptor Description(string? description) /// Common Schema (ECS) field names. /// /// - public GrokProcessorDescriptor EcsCompatibility(string? ecsCompatibility) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor EcsCompatibility(string? value) { - EcsCompatibilityValue = ecsCompatibility; - return Self; + Instance.EcsCompatibility = value; + return this; } /// @@ -177,10 +317,10 @@ public GrokProcessorDescriptor EcsCompatibility(string? ecsCompatibil /// The field to use for grok expression parsing. /// /// - public GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -188,21 +328,32 @@ public GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to use for grok expression parsing. /// /// - public GrokProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to use for grok expression parsing. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public GrokProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -210,10 +361,10 @@ public GrokProcessorDescriptor Field(Expression /// - public GrokProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -221,10 +372,10 @@ public GrokProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GrokProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -232,10 +383,10 @@ public GrokProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tr /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public GrokProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -243,40 +394,50 @@ public GrokProcessorDescriptor IgnoreMissing(bool? ignoreMissing = tr /// Handle failures for the processor. /// /// - public GrokProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GrokProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public GrokProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public GrokProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. + /// Patterns matching existing names will override the pre-existing definition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions(System.Collections.Generic.IDictionary? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.PatternDefinitions = value; + return this; } /// @@ -285,10 +446,29 @@ public GrokProcessorDescriptor OnFailure(params Action /// - public GrokProcessorDescriptor PatternDefinitions(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions() { - PatternDefinitionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. + /// Patterns matching existing names will override the pre-existing definition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions(System.Action? action) + { + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor AddPatternDefinition(string key, string value) + { + Instance.PatternDefinitions ??= new System.Collections.Generic.Dictionary(); + Instance.PatternDefinitions.Add(key, value); + return this; } /// @@ -297,10 +477,22 @@ public GrokProcessorDescriptor PatternDefinitions(Func /// - public GrokProcessorDescriptor Patterns(ICollection patterns) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Patterns(System.Collections.Generic.ICollection value) { - PatternsValue = patterns; - return Self; + Instance.Patterns = value; + return this; + } + + /// + /// + /// An ordered list of grok expression to match and extract named captures with. + /// Returns on the first expression in the list that matches. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Patterns(params string[] values) + { + Instance.Patterns = [.. values]; + return this; } /// @@ -309,10 +501,10 @@ public GrokProcessorDescriptor Patterns(ICollection patterns) /// Useful for debugging and metrics. /// /// - public GrokProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -320,124 +512,39 @@ public GrokProcessorDescriptor Tag(string? tag) /// When true, _ingest._grok_match_index will be inserted into your matched document’s metadata with the index into the pattern found in patterns that matched. /// /// - public GrokProcessorDescriptor TraceMatch(bool? traceMatch = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor TraceMatch(bool? value = true) { - TraceMatchValue = traceMatch; - return Self; + Instance.TraceMatch = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GrokProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(EcsCompatibilityValue)) - { - writer.WritePropertyName("ecs_compatibility"); - writer.WriteStringValue(EcsCompatibilityValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PatternDefinitionsValue is not null) - { - writer.WritePropertyName("pattern_definitions"); - JsonSerializer.Serialize(writer, PatternDefinitionsValue, options); - } - - writer.WritePropertyName("patterns"); - JsonSerializer.Serialize(writer, PatternsValue, options); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TraceMatchValue.HasValue) - { - writer.WritePropertyName("trace_match"); - writer.WriteBooleanValue(TraceMatchValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GrokProcessorDescriptor : SerializableDescriptor +public readonly partial struct GrokProcessorDescriptor { - internal GrokProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GrokProcessor Instance { get; init; } - public GrokProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrokProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? EcsCompatibilityValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private IDictionary? PatternDefinitionsValue { get; set; } - private ICollection PatternsValue { get; set; } - private string? TagValue { get; set; } - private bool? TraceMatchValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrokProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -445,10 +552,10 @@ public GrokProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public GrokProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -457,10 +564,10 @@ public GrokProcessorDescriptor Description(string? description) /// Common Schema (ECS) field names. /// /// - public GrokProcessorDescriptor EcsCompatibility(string? ecsCompatibility) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor EcsCompatibility(string? value) { - EcsCompatibilityValue = ecsCompatibility; - return Self; + Instance.EcsCompatibility = value; + return this; } /// @@ -468,10 +575,10 @@ public GrokProcessorDescriptor EcsCompatibility(string? ecsCompatibility) /// The field to use for grok expression parsing. /// /// - public GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -479,21 +586,21 @@ public GrokProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to use for grok expression parsing. /// /// - public GrokProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to use for grok expression parsing. + /// Conditionally execute the processor. /// /// - public GrokProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -501,10 +608,21 @@ public GrokProcessorDescriptor Field(Expression /// - public GrokProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -512,10 +630,10 @@ public GrokProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GrokProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -523,10 +641,10 @@ public GrokProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public GrokProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -534,40 +652,79 @@ public GrokProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public GrokProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GrokProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public GrokProcessorDescriptor OnFailure(Action configure) + /// + /// + /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. + /// Patterns matching existing names will override the pre-existing definition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions(System.Collections.Generic.IDictionary? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.PatternDefinitions = value; + return this; } - public GrokProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. + /// Patterns matching existing names will override the pre-existing definition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions() { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -576,10 +733,29 @@ public GrokProcessorDescriptor OnFailure(params Action /// - public GrokProcessorDescriptor PatternDefinitions(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor PatternDefinitions(System.Action? action) + { + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor AddPatternDefinition(string key, string value) + { + Instance.PatternDefinitions ??= new System.Collections.Generic.Dictionary(); + Instance.PatternDefinitions.Add(key, value); + return this; + } + + /// + /// + /// An ordered list of grok expression to match and extract named captures with. + /// Returns on the first expression in the list that matches. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Patterns(System.Collections.Generic.ICollection value) { - PatternDefinitionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Patterns = value; + return this; } /// @@ -588,10 +764,10 @@ public GrokProcessorDescriptor PatternDefinitions(Func /// - public GrokProcessorDescriptor Patterns(ICollection patterns) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Patterns(params string[] values) { - PatternsValue = patterns; - return Self; + Instance.Patterns = [.. values]; + return this; } /// @@ -600,10 +776,10 @@ public GrokProcessorDescriptor Patterns(ICollection patterns) /// Useful for debugging and metrics. /// /// - public GrokProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -611,98 +787,17 @@ public GrokProcessorDescriptor Tag(string? tag) /// When true, _ingest._grok_match_index will be inserted into your matched document’s metadata with the index into the pattern found in patterns that matched. /// /// - public GrokProcessorDescriptor TraceMatch(bool? traceMatch = true) + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor TraceMatch(bool? value = true) { - TraceMatchValue = traceMatch; - return Self; + Instance.TraceMatch = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GrokProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(EcsCompatibilityValue)) - { - writer.WritePropertyName("ecs_compatibility"); - writer.WriteStringValue(EcsCompatibilityValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PatternDefinitionsValue is not null) - { - writer.WritePropertyName("pattern_definitions"); - JsonSerializer.Serialize(writer, PatternDefinitionsValue, options); - } - - writer.WritePropertyName("patterns"); - JsonSerializer.Serialize(writer, PatternsValue, options); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TraceMatchValue.HasValue) - { - writer.WritePropertyName("trace_match"); - writer.WriteBooleanValue(TraceMatchValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GrokProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GsubProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GsubProcessor.g.cs index a20854d181a..adf190f45a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GsubProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/GsubProcessor.g.cs @@ -17,25 +17,165 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class GsubProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropReplacement = System.Text.Json.JsonEncodedText.Encode("replacement"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.GsubProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propPattern = default; + LocalJsonValue propReplacement = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propReplacement.TryReadProperty(ref reader, options, PropReplacement, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Pattern = propPattern.Value, + Replacement = propReplacement.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.GsubProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropReplacement, value.Replacement, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.GsubProcessorConverter))] public sealed partial class GsubProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GsubProcessor(Elastic.Clients.Elasticsearch.Field field, string pattern, string replacement) + { + Field = field; + Pattern = pattern; + Replacement = replacement; + } +#if NET7_0_OR_GREATER + public GsubProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GsubProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +183,24 @@ public sealed partial class GsubProcessor /// The field to apply the replacement to. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +208,6 @@ public sealed partial class GsubProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,24 +215,29 @@ public sealed partial class GsubProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// The pattern to be replaced. /// /// - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Pattern { get; set; } /// /// /// The string to replace the matching patterns with. /// /// - [JsonInclude, JsonPropertyName("replacement")] - public string Replacement { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Replacement { get; set; } /// /// @@ -100,7 +245,6 @@ public sealed partial class GsubProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -109,33 +253,27 @@ public sealed partial class GsubProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(GsubProcessor gsubProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Gsub(gsubProcessor); } -public sealed partial class GsubProcessorDescriptor : SerializableDescriptor> +public readonly partial struct GsubProcessorDescriptor { - internal GsubProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GsubProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GsubProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor instance) + { + Instance = instance; + } - public GsubProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GsubProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string PatternValue { get; set; } - private string ReplacementValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -143,10 +281,10 @@ public GsubProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public GsubProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -154,10 +292,10 @@ public GsubProcessorDescriptor Description(string? description) /// The field to apply the replacement to. /// /// - public GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -165,21 +303,21 @@ public GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to apply the replacement to. /// /// - public GsubProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to apply the replacement to. + /// Conditionally execute the processor. /// /// - public GsubProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -187,10 +325,21 @@ public GsubProcessorDescriptor Field(Expression /// - public GsubProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -198,10 +347,10 @@ public GsubProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GsubProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -209,10 +358,10 @@ public GsubProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tr /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public GsubProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -220,40 +369,38 @@ public GsubProcessorDescriptor IgnoreMissing(bool? ignoreMissing = tr /// Handle failures for the processor. /// /// - public GsubProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GsubProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public GsubProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public GsubProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -261,10 +408,10 @@ public GsubProcessorDescriptor OnFailure(params Action /// - public GsubProcessorDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Pattern(string value) { - PatternValue = pattern; - return Self; + Instance.Pattern = value; + return this; } /// @@ -272,10 +419,10 @@ public GsubProcessorDescriptor Pattern(string pattern) /// The string to replace the matching patterns with. /// /// - public GsubProcessorDescriptor Replacement(string replacement) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Replacement(string value) { - ReplacementValue = replacement; - return Self; + Instance.Replacement = value; + return this; } /// @@ -284,10 +431,10 @@ public GsubProcessorDescriptor Replacement(string replacement) /// Useful for debugging and metrics. /// /// - public GsubProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -296,10 +443,10 @@ public GsubProcessorDescriptor Tag(string? tag) /// By default, the field is updated in-place. /// /// - public GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -308,125 +455,39 @@ public GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// By default, the field is updated in-place. /// /// - public GsubProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// The field to assign the converted value to - /// By default, the field is updated in-place. - /// - /// - public GsubProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GsubProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GsubProcessorDescriptor : SerializableDescriptor +public readonly partial struct GsubProcessorDescriptor { - internal GsubProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.GsubProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GsubProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor instance) + { + Instance = instance; + } - public GsubProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GsubProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string PatternValue { get; set; } - private string ReplacementValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -434,10 +495,10 @@ public GsubProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public GsubProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -445,10 +506,10 @@ public GsubProcessorDescriptor Description(string? description) /// The field to apply the replacement to. /// /// - public GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -456,21 +517,21 @@ public GsubProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to apply the replacement to. /// /// - public GsubProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to apply the replacement to. + /// Conditionally execute the processor. /// /// - public GsubProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -478,10 +539,21 @@ public GsubProcessorDescriptor Field(Expression /// - public GsubProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -489,10 +561,10 @@ public GsubProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public GsubProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -500,10 +572,10 @@ public GsubProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public GsubProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -511,86 +583,89 @@ public GsubProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public GsubProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public GsubProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public GsubProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public GsubProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// The pattern to be replaced. + /// Handle failures for the processor. /// /// - public GsubProcessorDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor OnFailure(params System.Action>[] actions) { - PatternValue = pattern; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The string to replace the matching patterns with. + /// The pattern to be replaced. /// /// - public GsubProcessorDescriptor Replacement(string replacement) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Pattern(string value) { - ReplacementValue = replacement; - return Self; + Instance.Pattern = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The string to replace the matching patterns with. /// /// - public GsubProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Replacement(string value) { - TagValue = tag; - return Self; + Instance.Replacement = value; + return this; } /// /// - /// The field to assign the converted value to - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -599,10 +674,10 @@ public GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public GsubProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -611,88 +686,17 @@ public GsubProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public GsubProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.GsubProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - writer.WritePropertyName("replacement"); - writer.WriteStringValue(ReplacementValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.GsubProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/HtmlStripProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/HtmlStripProcessor.g.cs index c63a68a8313..d7b4e21b32d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/HtmlStripProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/HtmlStripProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class HtmlStripProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorConverter))] public sealed partial class HtmlStripProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public HtmlStripProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HtmlStripProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class HtmlStripProcessor /// The string-valued field to remove HTML tags from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class HtmlStripProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document, /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class HtmlStripProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class HtmlStripProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class HtmlStripProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(HtmlStripProcessor htmlStripProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.HtmlStrip(htmlStripProcessor); } -public sealed partial class HtmlStripProcessorDescriptor : SerializableDescriptor> +public readonly partial struct HtmlStripProcessorDescriptor { - internal HtmlStripProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor instance) + { + Instance = instance; + } - public HtmlStripProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public HtmlStripProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public HtmlStripProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public HtmlStripProcessorDescriptor Description(string? description) /// The string-valued field to remove HTML tags from. /// /// - public HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsear /// The string-valued field to remove HTML tags from. /// /// - public HtmlStripProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The string-valued field to remove HTML tags from. + /// Conditionally execute the processor. /// /// - public HtmlStripProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public HtmlStripProcessorDescriptor Field(Expression /// - public HtmlStripProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public HtmlStripProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document, + /// Ignore failures for the processor. /// /// - public HtmlStripProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document, /// /// - public HtmlStripProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public HtmlStripProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public HtmlStripProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public HtmlStripProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public HtmlStripProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elast /// By default, the field is updated in-place. /// /// - public HtmlStripProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public HtmlStripProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public HtmlStripProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class HtmlStripProcessorDescriptor : SerializableDescriptor +public readonly partial struct HtmlStripProcessorDescriptor { - internal HtmlStripProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor Instance { get; init; } - public HtmlStripProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HtmlStripProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public HtmlStripProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public HtmlStripProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public HtmlStripProcessorDescriptor Description(string? description) /// The string-valued field to remove HTML tags from. /// /// - public HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public HtmlStripProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fi /// The string-valued field to remove HTML tags from. /// /// - public HtmlStripProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The string-valued field to remove HTML tags from. + /// Conditionally execute the processor. /// /// - public HtmlStripProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public HtmlStripProcessorDescriptor Field(Expression /// - public HtmlStripProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public HtmlStripProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public HtmlStripProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public HtmlStripProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document, /// /// - public HtmlStripProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public HtmlStripProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public HtmlStripProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public HtmlStripProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public HtmlStripProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public HtmlStripProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public HtmlStripProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fi /// By default, the field is updated in-place. /// /// - public HtmlStripProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public HtmlStripProcessorDescriptor TargetField(Expressionfield is updated in-place. /// /// - public HtmlStripProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfig.g.cs index ffa884fd3af..07c1cf028f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfig.g.cs @@ -17,226 +17,341 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -[JsonConverter(typeof(InferenceConfigConverter))] -public sealed partial class InferenceConfig +internal sealed partial class InferenceConfigConverter : System.Text.Json.Serialization.JsonConverter { - internal InferenceConfig(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static InferenceConfig Classification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification inferenceConfigClassification) => new InferenceConfig("classification", inferenceConfigClassification); - public static InferenceConfig Regression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression inferenceConfigRegression) => new InferenceConfig("regression", inferenceConfigRegression); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); - return false; - } -} - -internal sealed partial class InferenceConfigConverter : JsonConverter -{ - public override InferenceConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Ingest.InferenceConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'InferenceConfig' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new InferenceConfig(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, InferenceConfig value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.InferenceConfig value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig)}'."); } writer.WriteEndObject(); } } -public sealed partial class InferenceConfigDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigConverter))] +public sealed partial class InferenceConfig { - internal InferenceConfigDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public InferenceConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public InferenceConfigDescriptor() : base() + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification value) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression value) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig { Regression = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct InferenceConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfig Instance { get; init; } - private InferenceConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private InferenceConfigDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification inferenceConfigClassification) => Set(inferenceConfigClassification, "classification"); - public InferenceConfigDescriptor Classification(Action> configure) => Set(configure, "classification"); - public InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression inferenceConfigRegression) => Set(inferenceConfigRegression, "regression"); - public InferenceConfigDescriptor Regression(Action> configure) => Set(configure, "regression"); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification() + { + Instance.Classification = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification(System.Action>? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfig Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigDescriptor { - internal InferenceConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig instance) + { + Instance = instance; + } - public InferenceConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor descriptor) => descriptor.Instance; - private InferenceConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = value; + return this; } - private InferenceConfigDescriptor Set(object variant, string variantName) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor.Build(null); + return this; } - public InferenceConfigDescriptor Classification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification inferenceConfigClassification) => Set(inferenceConfigClassification, "classification"); - public InferenceConfigDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression inferenceConfigRegression) => Set(inferenceConfigRegression, "regression"); - public InferenceConfigDescriptor Regression(Action configure) => Set(configure, "regression"); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Classification(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression? value) + { + Instance.Regression = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression(System.Action? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigClassification.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigClassification.g.cs index 29e911ac49c..1e1be6d92ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigClassification.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigClassification.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class InferenceConfigClassificationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionFieldType = System.Text.Json.JsonEncodedText.Encode("prediction_field_type"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTopClassesResultsField = System.Text.Json.JsonEncodedText.Encode("top_classes_results_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propPredictionFieldType = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTopClassesResultsField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } + + if (propPredictionFieldType.TryReadProperty(ref reader, options, PropPredictionFieldType, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTopClassesResultsField.TryReadProperty(ref reader, options, PropTopClassesResultsField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumTopClasses = propNumTopClasses.Value, + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + PredictionFieldType = propPredictionFieldType.Value, + ResultsField = propResultsField.Value, + TopClassesResultsField = propTopClassesResultsField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropPredictionFieldType, value.PredictionFieldType, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTopClassesResultsField, value.TopClassesResultsField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationConverter))] public sealed partial class InferenceConfigClassification { +#if NET7_0_OR_GREATER + public InferenceConfigClassification() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfigClassification() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the number of top class predictions to return. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class InferenceConfigClassification /// Specifies the maximum number of feature importance values per document. /// /// - [JsonInclude, JsonPropertyName("num_top_feature_importance_values")] public int? NumTopFeatureImportanceValues { get; set; } /// @@ -51,7 +137,6 @@ public sealed partial class InferenceConfigClassification /// Valid values are: string, number, boolean. /// /// - [JsonInclude, JsonPropertyName("prediction_field_type")] public string? PredictionFieldType { get; set; } /// @@ -59,7 +144,6 @@ public sealed partial class InferenceConfigClassification /// The field that is added to incoming documents to contain the inference prediction. /// /// - [JsonInclude, JsonPropertyName("results_field")] public Elastic.Clients.Elasticsearch.Field? ResultsField { get; set; } /// @@ -67,35 +151,37 @@ public sealed partial class InferenceConfigClassification /// Specifies the field to which the top classes are written. /// /// - [JsonInclude, JsonPropertyName("top_classes_results_field")] public Elastic.Clients.Elasticsearch.Field? TopClassesResultsField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(InferenceConfigClassification inferenceConfigClassification) => Elastic.Clients.Elasticsearch.Ingest.InferenceConfig.Classification(inferenceConfigClassification); } -public sealed partial class InferenceConfigClassificationDescriptor : SerializableDescriptor> +public readonly partial struct InferenceConfigClassificationDescriptor { - internal InferenceConfigClassificationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigClassificationDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification instance) + { + Instance = instance; + } - public InferenceConfigClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigClassificationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? NumTopClassesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private string? PredictionFieldTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TopClassesResultsFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the number of top class predictions to return. /// /// - public InferenceConfigClassificationDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -103,10 +189,10 @@ public InferenceConfigClassificationDescriptor NumTopClasses(int? num /// Specifies the maximum number of feature importance values per document. /// /// - public InferenceConfigClassificationDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -115,10 +201,10 @@ public InferenceConfigClassificationDescriptor NumTopFeatureImportanc /// Valid values are: string, number, boolean. /// /// - public InferenceConfigClassificationDescriptor PredictionFieldType(string? predictionFieldType) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor PredictionFieldType(string? value) { - PredictionFieldTypeValue = predictionFieldType; - return Self; + Instance.PredictionFieldType = value; + return this; } /// @@ -126,10 +212,10 @@ public InferenceConfigClassificationDescriptor PredictionFieldType(st /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigClassificationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -137,21 +223,10 @@ public InferenceConfigClassificationDescriptor ResultsField(Elastic.C /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigClassificationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; - } - - /// - /// - /// The field that is added to incoming documents to contain the inference prediction. - /// - /// - public InferenceConfigClassificationDescriptor ResultsField(Expression> resultsField) - { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -159,10 +234,10 @@ public InferenceConfigClassificationDescriptor ResultsField(Expressio /// Specifies the field to which the top classes are written. /// /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Elastic.Clients.Elasticsearch.Field? topClassesResultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor TopClassesResultsField(Elastic.Clients.Elasticsearch.Field? value) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; + Instance.TopClassesResultsField = value; + return this; } /// @@ -170,83 +245,54 @@ public InferenceConfigClassificationDescriptor TopClassesResultsField /// Specifies the field to which the top classes are written. /// /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Expression> topClassesResultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor TopClassesResultsField(System.Linq.Expressions.Expression> value) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; + Instance.TopClassesResultsField = value; + return this; } - /// - /// - /// Specifies the field to which the top classes are written. - /// - /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Expression> topClassesResultsField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification Build(System.Action>? action) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (NumTopClassesValue.HasValue) + if (action is null) { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (!string.IsNullOrEmpty(PredictionFieldTypeValue)) - { - writer.WritePropertyName("prediction_field_type"); - writer.WriteStringValue(PredictionFieldTypeValue); - } - - if (ResultsFieldValue is not null) - { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); - } - - if (TopClassesResultsFieldValue is not null) - { - writer.WritePropertyName("top_classes_results_field"); - JsonSerializer.Serialize(writer, TopClassesResultsFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigClassificationDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigClassificationDescriptor { - internal InferenceConfigClassificationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification Instance { get; init; } - public InferenceConfigClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigClassificationDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification instance) { + Instance = instance; } - private int? NumTopClassesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private string? PredictionFieldTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TopClassesResultsFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigClassificationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the number of top class predictions to return. /// /// - public InferenceConfigClassificationDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -254,10 +300,10 @@ public InferenceConfigClassificationDescriptor NumTopClasses(int? numTopClasses) /// Specifies the maximum number of feature importance values per document. /// /// - public InferenceConfigClassificationDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -266,21 +312,10 @@ public InferenceConfigClassificationDescriptor NumTopFeatureImportanceValues(int /// Valid values are: string, number, boolean. /// /// - public InferenceConfigClassificationDescriptor PredictionFieldType(string? predictionFieldType) - { - PredictionFieldTypeValue = predictionFieldType; - return Self; - } - - /// - /// - /// The field that is added to incoming documents to contain the inference prediction. - /// - /// - public InferenceConfigClassificationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor PredictionFieldType(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.PredictionFieldType = value; + return this; } /// @@ -288,10 +323,10 @@ public InferenceConfigClassificationDescriptor ResultsField(Elastic.Clients.Elas /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigClassificationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -299,10 +334,10 @@ public InferenceConfigClassificationDescriptor ResultsField(E /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigClassificationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -310,10 +345,10 @@ public InferenceConfigClassificationDescriptor ResultsField(Expressio /// Specifies the field to which the top classes are written. /// /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Elastic.Clients.Elasticsearch.Field? topClassesResultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor TopClassesResultsField(Elastic.Clients.Elasticsearch.Field? value) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; + Instance.TopClassesResultsField = value; + return this; } /// @@ -321,56 +356,22 @@ public InferenceConfigClassificationDescriptor TopClassesResultsField(Elastic.Cl /// Specifies the field to which the top classes are written. /// /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Expression> topClassesResultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor TopClassesResultsField(System.Linq.Expressions.Expression> value) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; + Instance.TopClassesResultsField = value; + return this; } - /// - /// - /// Specifies the field to which the top classes are written. - /// - /// - public InferenceConfigClassificationDescriptor TopClassesResultsField(Expression> topClassesResultsField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification Build(System.Action? action) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (!string.IsNullOrEmpty(PredictionFieldTypeValue)) + if (action is null) { - writer.WritePropertyName("prediction_field_type"); - writer.WriteStringValue(PredictionFieldTypeValue); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ResultsFieldValue is not null) - { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); - } - - if (TopClassesResultsFieldValue is not null) - { - writer.WritePropertyName("top_classes_results_field"); - JsonSerializer.Serialize(writer, TopClassesResultsFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassificationDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigRegression.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigRegression.g.cs index 25fd91b2faa..ee7fc47234a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigRegression.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceConfigRegression.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class InferenceConfigRegressionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propResultsField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + ResultsField = propResultsField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionConverter))] public sealed partial class InferenceConfigRegression { +#if NET7_0_OR_GREATER + public InferenceConfigRegression() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfigRegression() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the maximum number of feature importance values per document. /// /// - [JsonInclude, JsonPropertyName("num_top_feature_importance_values")] public int? NumTopFeatureImportanceValues { get; set; } /// @@ -42,43 +102,37 @@ public sealed partial class InferenceConfigRegression /// The field that is added to incoming documents to contain the inference prediction. /// /// - [JsonInclude, JsonPropertyName("results_field")] public Elastic.Clients.Elasticsearch.Field? ResultsField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfig(InferenceConfigRegression inferenceConfigRegression) => Elastic.Clients.Elasticsearch.Ingest.InferenceConfig.Regression(inferenceConfigRegression); } -public sealed partial class InferenceConfigRegressionDescriptor : SerializableDescriptor> +public readonly partial struct InferenceConfigRegressionDescriptor { - internal InferenceConfigRegressionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression Instance { get; init; } - public InferenceConfigRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigRegressionDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression instance) { + Instance = instance; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Specifies the maximum number of feature importance values per document. - /// - /// - public InferenceConfigRegressionDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigRegressionDescriptor() { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field that is added to incoming documents to contain the inference prediction. + /// Specifies the maximum number of feature importance values per document. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor NumTopFeatureImportanceValues(int? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -86,10 +140,10 @@ public InferenceConfigRegressionDescriptor ResultsField(Elastic.Clien /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -97,62 +151,54 @@ public InferenceConfigRegressionDescriptor ResultsField(Expre /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression Build(System.Action>? action) { - writer.WriteStartObject(); - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (ResultsFieldValue is not null) + if (action is null) { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigRegressionDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigRegressionDescriptor { - internal InferenceConfigRegressionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression Instance { get; init; } - public InferenceConfigRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigRegressionDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression instance) { + Instance = instance; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Specifies the maximum number of feature importance values per document. - /// - /// - public InferenceConfigRegressionDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigRegressionDescriptor() { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field that is added to incoming documents to contain the inference prediction. + /// Specifies the maximum number of feature importance values per document. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor NumTopFeatureImportanceValues(int? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -160,10 +206,10 @@ public InferenceConfigRegressionDescriptor ResultsField(Elastic.Clients.Elastics /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -171,27 +217,22 @@ public InferenceConfigRegressionDescriptor ResultsField(Expre /// The field that is added to incoming documents to contain the inference prediction. /// /// - public InferenceConfigRegressionDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression Build(System.Action? action) { - writer.WriteStartObject(); - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (ResultsFieldValue is not null) + if (action is null) { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegressionDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceProcessor.g.cs index 66ef214621d..6d4639e637a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InferenceProcessor.g.cs @@ -17,25 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class InferenceProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFieldMap = System.Text.Json.JsonEncodedText.Encode("field_map"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropInputOutput = System.Text.Json.JsonEncodedText.Encode("input_output"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue?> propFieldMap = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propInferenceConfig = default; + LocalJsonValue?> propInputOutput = default; + LocalJsonValue propModelId = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFieldMap.TryReadProperty(ref reader, options, PropFieldMap, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (propInputOutput.TryReadProperty(ref reader, options, PropInputOutput, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + FieldMap = propFieldMap.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + InferenceConfig = propInferenceConfig.Value, + InputOutput = propInputOutput.Value, + ModelId = propModelId.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFieldMap, value.FieldMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteProperty(options, PropInputOutput, value.InputOutput, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorConverter))] public sealed partial class InferenceProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceProcessor(Elastic.Clients.Elasticsearch.Id modelId) + { + ModelId = modelId; + } +#if NET7_0_OR_GREATER + public InferenceProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InferenceProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,48 +191,63 @@ public sealed partial class InferenceProcessor /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - [JsonInclude, JsonPropertyName("field_map")] - public IDictionary? FieldMap { get; set; } + public System.Collections.Generic.IDictionary? FieldMap { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } + /// + /// + /// If true and any of the input fields defined in input_ouput are missing + /// then those missing fields are quietly ignored, otherwise a missing field causes a failure. + /// Only applies when using input_output configurations to explicitly list the input fields. + /// + /// + public bool? IgnoreMissing { get; set; } + /// /// /// Contains the inference type and its options. /// /// - [JsonInclude, JsonPropertyName("inference_config")] public Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? InferenceConfig { get; set; } + /// + /// + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. + /// + /// + public System.Collections.Generic.ICollection? InputOutput { get; set; } + /// /// /// The ID or alias for the trained model, or the ID of the deployment. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public Elastic.Clients.Elasticsearch.Id ModelId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id ModelId { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -93,7 +255,6 @@ public sealed partial class InferenceProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -101,34 +262,27 @@ public sealed partial class InferenceProcessor /// Field added to incoming documents to contain results objects. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(InferenceProcessor inferenceProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Inference(inferenceProcessor); } -public sealed partial class InferenceProcessorDescriptor : SerializableDescriptor> +public readonly partial struct InferenceProcessorDescriptor { - internal InferenceProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor instance) + { + Instance = instance; + } - public InferenceProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private IDictionary? FieldMapValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor InferenceConfigDescriptor { get; set; } - private Action> InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id ModelIdValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -136,10 +290,10 @@ public InferenceProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public InferenceProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -148,274 +302,282 @@ public InferenceProcessorDescriptor Description(string? description) /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor FieldMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap(System.Collections.Generic.IDictionary? value) { - FieldMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FieldMap = value; + return this; } /// /// - /// Conditionally execute the processor. + /// Maps the document field names to the known field names of the model. + /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap() { - IfValue = value; - return Self; + Instance.FieldMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Maps the document field names to the known field names of the model. + /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap(System.Action>? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.FieldMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor AddFieldMap(Elastic.Clients.Elasticsearch.Field key, object value) + { + Instance.FieldMap ??= new System.Collections.Generic.Dictionary(); + Instance.FieldMap.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor AddFieldMap(System.Linq.Expressions.Expression> key, object value) + { + Instance.FieldMap ??= new System.Collections.Generic.Dictionary(); + Instance.FieldMap.Add(key, value); + return this; } /// /// - /// Contains the inference type and its options. + /// Conditionally execute the processor. /// /// - public InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? inferenceConfig) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.If = value; + return this; } - public InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor descriptor) + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If() { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public InferenceProcessorDescriptor InferenceConfig(Action> configure) + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If(System.Action? action) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// The ID or alias for the trained model, or the ID of the deployment. + /// Ignore failures for the processor. /// /// - public InferenceProcessorDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor IgnoreFailure(bool? value = true) { - ModelIdValue = modelId; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and any of the input fields defined in input_ouput are missing + /// then those missing fields are quietly ignored, otherwise a missing field causes a failure. + /// Only applies when using input_output configurations to explicitly list the input fields. /// /// - public InferenceProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreMissing = value; + return this; } - public InferenceProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Contains the inference type and its options. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.InferenceConfig = value; + return this; } - public InferenceProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Contains the inference type and its options. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InferenceConfig(System.Action> action) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor.Build(action); + return this; } - public InferenceProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.InputOutput = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. /// /// - public InferenceProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(params Elastic.Clients.Elasticsearch.Ingest.InputConfig[] values) { - TagValue = tag; - return Self; + Instance.InputOutput = [.. values]; + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. /// /// - public InferenceProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(params System.Action[] actions) { - TargetFieldValue = targetField; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor.Build(action)); + } + + Instance.InputOutput = items; + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// The ID or alias for the trained model, or the ID of the deployment. /// /// - public InferenceProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) { - TargetFieldValue = targetField; - return Self; + Instance.ModelId = value; + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// Handle failures for the processor. /// /// - public InferenceProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - TargetFieldValue = targetField; - return Self; + Instance.OnFailure = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (FieldMapValue is not null) - { - writer.WritePropertyName("field_map"); - JsonSerializer.Serialize(writer, FieldMapValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } + Instance.OnFailure = [.. values]; + return this; + } - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - writer.WritePropertyName("model_id"); - JsonSerializer.Serialize(writer, ModelIdValue, options); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + /// + /// + /// Field added to incoming documents to contain results objects. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.TargetField = value; + return this; + } - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } + /// + /// + /// Field added to incoming documents to contain results objects. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) + { + Instance.TargetField = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceProcessorDescriptor : SerializableDescriptor +public readonly partial struct InferenceProcessorDescriptor { - internal InferenceProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor Instance { get; init; } - public InferenceProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private IDictionary? FieldMapValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? InferenceConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor InferenceConfigDescriptor { get; set; } - private Action InferenceConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id ModelIdValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -423,10 +585,10 @@ public InferenceProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public InferenceProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -435,248 +597,300 @@ public InferenceProcessorDescriptor Description(string? description) /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor FieldMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap(System.Collections.Generic.IDictionary? value) { - FieldMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FieldMap = value; + return this; } /// /// - /// Conditionally execute the processor. + /// Maps the document field names to the known field names of the model. + /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap() { - IfValue = value; - return Self; + Instance.FieldMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Maps the document field names to the known field names of the model. + /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.FieldMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject.Build(action); + return this; } /// /// - /// Contains the inference type and its options. + /// Maps the document field names to the known field names of the model. + /// This mapping takes precedence over any default mappings provided in the model configuration. /// /// - public InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? inferenceConfig) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor FieldMap(System.Action>? action) { - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = null; - InferenceConfigValue = inferenceConfig; - return Self; + Instance.FieldMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldObject.Build(action); + return this; } - public InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor AddFieldMap(Elastic.Clients.Elasticsearch.Field key, object value) { - InferenceConfigValue = null; - InferenceConfigDescriptorAction = null; - InferenceConfigDescriptor = descriptor; - return Self; + Instance.FieldMap ??= new System.Collections.Generic.Dictionary(); + Instance.FieldMap.Add(key, value); + return this; } - public InferenceProcessorDescriptor InferenceConfig(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor AddFieldMap(System.Linq.Expressions.Expression> key, object value) { - InferenceConfigValue = null; - InferenceConfigDescriptor = null; - InferenceConfigDescriptorAction = configure; - return Self; + Instance.FieldMap ??= new System.Collections.Generic.Dictionary(); + Instance.FieldMap.Add(key, value); + return this; } /// /// - /// The ID or alias for the trained model, or the ID of the deployment. + /// Conditionally execute the processor. /// /// - public InferenceProcessorDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - ModelIdValue = modelId; - return Self; + Instance.If = value; + return this; } /// /// - /// Handle failures for the processor. + /// Conditionally execute the processor. /// /// - public InferenceProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If() { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public InferenceProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor If(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public InferenceProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Ignore failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public InferenceProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// If true and any of the input fields defined in input_ouput are missing + /// then those missing fields are quietly ignored, otherwise a missing field causes a failure. + /// Only applies when using input_output configurations to explicitly list the input fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.IgnoreMissing = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Contains the inference type and its options. /// /// - public InferenceProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Ingest.InferenceConfig? value) { - TagValue = tag; - return Self; + Instance.InferenceConfig = value; + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// Contains the inference type and its options. /// /// - public InferenceProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InferenceConfig(System.Action action) { - TargetFieldValue = targetField; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor.Build(action); + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// Contains the inference type and its options. /// /// - public InferenceProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InferenceConfig(System.Action> action) { - TargetFieldValue = targetField; - return Self; + Instance.InferenceConfig = Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor.Build(action); + return this; } /// /// - /// Field added to incoming documents to contain results objects. + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. /// /// - public InferenceProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(System.Collections.Generic.ICollection? value) { - TargetFieldValue = targetField; - return Self; + Instance.InputOutput = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(params Elastic.Clients.Elasticsearch.Ingest.InputConfig[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } + Instance.InputOutput = [.. values]; + return this; + } - if (FieldMapValue is not null) + /// + /// + /// Input fields for inference and output (destination) fields for the inference results. + /// This option is incompatible with the target_field and field_map options. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor InputOutput(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("field_map"); - JsonSerializer.Serialize(writer, FieldMapValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } + Instance.InputOutput = items; + return this; + } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } + /// + /// + /// The ID or alias for the trained model, or the ID of the deployment. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor ModelId(Elastic.Clients.Elasticsearch.Id value) + { + Instance.ModelId = value; + return this; + } - if (InferenceConfigDescriptor is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigDescriptor, options); - } - else if (InferenceConfigDescriptorAction is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.InferenceConfigDescriptor(InferenceConfigDescriptorAction), options); - } - else if (InferenceConfigValue is not null) - { - writer.WritePropertyName("inference_config"); - JsonSerializer.Serialize(writer, InferenceConfigValue, options); - } + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) + { + Instance.OnFailure = value; + return this; + } - writer.WritePropertyName("model_id"); - JsonSerializer.Serialize(writer, ModelIdValue, options); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) + { + Instance.OnFailure = [.. values]; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + Instance.OnFailure = items; + return this; + } - if (TargetFieldValue is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.OnFailure = items; + return this; + } + + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } + + /// + /// + /// Field added to incoming documents to contain results objects. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) + { + Instance.TargetField = value; + return this; + } + + /// + /// + /// Field added to incoming documents to contain results objects. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) + { + Instance.TargetField = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ingest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ingest.g.cs index 972a815ffdd..26243ea7bf9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ingest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ingest.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class IngestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropRedact = System.Text.Json.JsonEncodedText.Encode("_redact"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.Ingest.Ingest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPipeline = default; + LocalJsonValue propRedact = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPipeline.TryReadProperty(ref reader, options, PropPipeline, null)) + { + continue; + } + + if (propRedact.TryReadProperty(ref reader, options, PropRedact, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Ingest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Pipeline = propPipeline.Value, + Redact = propRedact.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Ingest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPipeline, value.Pipeline, null, null); + writer.WriteProperty(options, PropRedact, value.Redact, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.IngestConverter))] public sealed partial class Ingest { - [JsonInclude, JsonPropertyName("pipeline")] - public string? Pipeline { get; init; } - [JsonInclude, JsonPropertyName("_redact")] - public Elastic.Clients.Elasticsearch.Ingest.Redact? Redact { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public DateTimeOffset Timestamp { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Ingest(System.DateTimeOffset timestamp) + { + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public Ingest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Ingest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ingest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Pipeline { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.Redact? Redact { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InputConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InputConfig.g.cs new file mode 100644 index 00000000000..6f5abc6100c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/InputConfig.g.cs @@ -0,0 +1,150 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Ingest; + +internal sealed partial class InputConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInputField = System.Text.Json.JsonEncodedText.Encode("input_field"); + private static readonly System.Text.Json.JsonEncodedText PropOutputField = System.Text.Json.JsonEncodedText.Encode("output_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.InputConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInputField = default; + LocalJsonValue propOutputField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInputField.TryReadProperty(ref reader, options, PropInputField, null)) + { + continue; + } + + if (propOutputField.TryReadProperty(ref reader, options, PropOutputField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.InputConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InputField = propInputField.Value, + OutputField = propOutputField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.InputConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInputField, value.InputField, null, null); + writer.WriteProperty(options, PropOutputField, value.OutputField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.InputConfigConverter))] +public sealed partial class InputConfig +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputConfig(string inputField, string outputField) + { + InputField = inputField; + OutputField = outputField; + } +#if NET7_0_OR_GREATER + public InputConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InputConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InputConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string InputField { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string OutputField { get; set; } +} + +public readonly partial struct InputConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.Ingest.InputConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InputConfig instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.InputConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor(Elastic.Clients.Elasticsearch.Ingest.InputConfig instance) => new Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.InputConfig(Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor InputField(string value) + { + Instance.InputField = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor OutputField(string value) + { + Instance.OutputField = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.InputConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.InputConfigDescriptor(new Elastic.Clients.Elasticsearch.Ingest.InputConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpDatabaseConfigurationMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpDatabaseConfigurationMetadata.g.cs index 5242779f807..858411580a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpDatabaseConfigurationMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpDatabaseConfigurationMetadata.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class IpDatabaseConfigurationMetadataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabase = System.Text.Json.JsonEncodedText.Encode("database"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropModifiedDate = System.Text.Json.JsonEncodedText.Encode("modified_date"); + private static readonly System.Text.Json.JsonEncodedText PropModifiedDateMillis = System.Text.Json.JsonEncodedText.Encode("modified_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.IpDatabaseConfigurationMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDatabase = default; + LocalJsonValue propId = default; + LocalJsonValue propModifiedDate = default; + LocalJsonValue propModifiedDateMillis = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabase.TryReadProperty(ref reader, options, PropDatabase, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propModifiedDate.TryReadProperty(ref reader, options, PropModifiedDate, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propModifiedDateMillis.TryReadProperty(ref reader, options, PropModifiedDateMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.IpDatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Database = propDatabase.Value, + Id = propId.Value, + ModifiedDate = propModifiedDate.Value, + ModifiedDateMillis = propModifiedDateMillis.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.IpDatabaseConfigurationMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabase, value.Database, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropModifiedDate, value.ModifiedDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropModifiedDateMillis, value.ModifiedDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.IpDatabaseConfigurationMetadataConverter))] public sealed partial class IpDatabaseConfigurationMetadata { - [JsonInclude, JsonPropertyName("database")] - public Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull Database { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("modified_date")] - public long? ModifiedDate { get; init; } - [JsonInclude, JsonPropertyName("modified_date_millis")] - public long? ModifiedDateMillis { get; init; } - [JsonInclude, JsonPropertyName("version")] - public long Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpDatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull database, string id, long version) + { + Database = database; + Id = id; + Version = version; + } +#if NET7_0_OR_GREATER + public IpDatabaseConfigurationMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpDatabaseConfigurationMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpDatabaseConfigurationMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull Database { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public System.DateTimeOffset? ModifiedDate { get; set; } + public System.DateTimeOffset? ModifiedDateMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpLocationProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpLocationProcessor.g.cs index c6691f1eb02..af7afb63e3d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpLocationProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/IpLocationProcessor.g.cs @@ -17,24 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class IpLocationProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDatabaseFile = System.Text.Json.JsonEncodedText.Encode("database_file"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDownloadDatabaseOnPipelineCreation = System.Text.Json.JsonEncodedText.Encode("download_database_on_pipeline_creation"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFirstOnly = System.Text.Json.JsonEncodedText.Encode("first_only"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDatabaseFile = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDownloadDatabaseOnPipelineCreation = default; + LocalJsonValue propField = default; + LocalJsonValue propFirstOnly = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProperties = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDatabaseFile.TryReadProperty(ref reader, options, PropDatabaseFile, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDownloadDatabaseOnPipelineCreation.TryReadProperty(ref reader, options, PropDownloadDatabaseOnPipelineCreation, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFirstOnly.TryReadProperty(ref reader, options, PropFirstOnly, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DatabaseFile = propDatabaseFile.Value, + Description = propDescription.Value, + DownloadDatabaseOnPipelineCreation = propDownloadDatabaseOnPipelineCreation.Value, + Field = propField.Value, + FirstOnly = propFirstOnly.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Properties = propProperties.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDatabaseFile, value.DatabaseFile, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDownloadDatabaseOnPipelineCreation, value.DownloadDatabaseOnPipelineCreation, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFirstOnly, value.FirstOnly, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorConverter))] public sealed partial class IpLocationProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpLocationProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public IpLocationProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpLocationProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - [JsonInclude, JsonPropertyName("database_file")] public string? DatabaseFile { get; set; } /// @@ -43,7 +199,6 @@ public sealed partial class IpLocationProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -52,7 +207,6 @@ public sealed partial class IpLocationProcessor /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - [JsonInclude, JsonPropertyName("download_database_on_pipeline_creation")] public bool? DownloadDatabaseOnPipelineCreation { get; set; } /// @@ -60,15 +214,17 @@ public sealed partial class IpLocationProcessor /// The field to get the ip address from for the geographical lookup. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// If true, only the first found IP location data will be returned, even if the field contains an array. /// /// - [JsonInclude, JsonPropertyName("first_only")] public bool? FirstOnly { get; set; } /// @@ -76,15 +232,13 @@ public sealed partial class IpLocationProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -92,7 +246,6 @@ public sealed partial class IpLocationProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -100,16 +253,14 @@ public sealed partial class IpLocationProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Controls what properties are added to the target_field based on the IP location lookup. /// /// - [JsonInclude, JsonPropertyName("properties")] - public ICollection? Properties { get; set; } + public System.Collections.Generic.ICollection? Properties { get; set; } /// /// @@ -117,7 +268,6 @@ public sealed partial class IpLocationProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -125,45 +275,37 @@ public sealed partial class IpLocationProcessor /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(IpLocationProcessor ipLocationProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.IpLocation(ipLocationProcessor); } -public sealed partial class IpLocationProcessorDescriptor : SerializableDescriptor> +public readonly partial struct IpLocationProcessorDescriptor { - internal IpLocationProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpLocationProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor instance) + { + Instance = instance; + } - public IpLocationProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpLocationProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DatabaseFileValue { get; set; } - private string? DescriptionValue { get; set; } - private bool? DownloadDatabaseOnPipelineCreationValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? FirstOnlyValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - public IpLocationProcessorDescriptor DatabaseFile(string? databaseFile) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor DatabaseFile(string? value) { - DatabaseFileValue = databaseFile; - return Self; + Instance.DatabaseFile = value; + return this; } /// @@ -172,10 +314,10 @@ public IpLocationProcessorDescriptor DatabaseFile(string? databaseFil /// Useful for describing the purpose of the processor or its configuration. /// /// - public IpLocationProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -184,10 +326,10 @@ public IpLocationProcessorDescriptor Description(string? description) /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - public IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? downloadDatabaseOnPipelineCreation = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? value = true) { - DownloadDatabaseOnPipelineCreationValue = downloadDatabaseOnPipelineCreation; - return Self; + Instance.DownloadDatabaseOnPipelineCreation = value; + return this; } /// @@ -195,10 +337,10 @@ public IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreati /// The field to get the ip address from for the geographical lookup. /// /// - public IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -206,32 +348,32 @@ public IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsea /// The field to get the ip address from for the geographical lookup. /// /// - public IpLocationProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the ip address from for the geographical lookup. + /// If true, only the first found IP location data will be returned, even if the field contains an array. /// /// - public IpLocationProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor FirstOnly(bool? value = true) { - FieldValue = field; - return Self; + Instance.FirstOnly = value; + return this; } /// /// - /// If true, only the first found IP location data will be returned, even if the field contains an array. + /// Conditionally execute the processor. /// /// - public IpLocationProcessorDescriptor FirstOnly(bool? firstOnly = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FirstOnlyValue = firstOnly; - return Self; + Instance.If = value; + return this; } /// @@ -239,10 +381,21 @@ public IpLocationProcessorDescriptor FirstOnly(bool? firstOnly = true /// Conditionally execute the processor. /// /// - public IpLocationProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -250,10 +403,10 @@ public IpLocationProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public IpLocationProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -261,10 +414,10 @@ public IpLocationProcessorDescriptor IgnoreFailure(bool? ignoreFailur /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public IpLocationProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -272,40 +425,38 @@ public IpLocationProcessorDescriptor IgnoreMissing(bool? ignoreMissin /// Handle failures for the processor. /// /// - public IpLocationProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public IpLocationProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public IpLocationProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public IpLocationProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -313,33 +464,33 @@ public IpLocationProcessorDescriptor OnFailure(params Actiontarget_field based on the IP location lookup. /// /// - public IpLocationProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Controls what properties are added to the target_field based on the IP location lookup. /// /// - public IpLocationProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Properties(params string[] values) { - TagValue = tag; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// The field that will hold the geographical information looked up from the MaxMind database. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -347,10 +498,10 @@ public IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elas /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - public IpLocationProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -358,145 +509,49 @@ public IpLocationProcessorDescriptor TargetField(Expression /// - public IpLocationProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DatabaseFileValue)) - { - writer.WritePropertyName("database_file"); - writer.WriteStringValue(DatabaseFileValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DownloadDatabaseOnPipelineCreationValue.HasValue) - { - writer.WritePropertyName("download_database_on_pipeline_creation"); - writer.WriteBooleanValue(DownloadDatabaseOnPipelineCreationValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FirstOnlyValue.HasValue) - { - writer.WritePropertyName("first_only"); - writer.WriteBooleanValue(FirstOnlyValue.Value); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IpLocationProcessorDescriptor : SerializableDescriptor +public readonly partial struct IpLocationProcessorDescriptor { - internal IpLocationProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor Instance { get; init; } - public IpLocationProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpLocationProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor instance) { + Instance = instance; } - private string? DatabaseFileValue { get; set; } - private string? DescriptionValue { get; set; } - private bool? DownloadDatabaseOnPipelineCreationValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? FirstOnlyValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpLocationProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor descriptor) => descriptor.Instance; /// /// /// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory. /// /// - public IpLocationProcessorDescriptor DatabaseFile(string? databaseFile) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor DatabaseFile(string? value) { - DatabaseFileValue = databaseFile; - return Self; + Instance.DatabaseFile = value; + return this; } /// @@ -505,10 +560,10 @@ public IpLocationProcessorDescriptor DatabaseFile(string? databaseFile) /// Useful for describing the purpose of the processor or its configuration. /// /// - public IpLocationProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -517,10 +572,10 @@ public IpLocationProcessorDescriptor Description(string? description) /// Else, the download is triggered by when the pipeline is used as the default_pipeline or final_pipeline in an index. /// /// - public IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? downloadDatabaseOnPipelineCreation = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? value = true) { - DownloadDatabaseOnPipelineCreationValue = downloadDatabaseOnPipelineCreation; - return Self; + Instance.DownloadDatabaseOnPipelineCreation = value; + return this; } /// @@ -528,10 +583,10 @@ public IpLocationProcessorDescriptor DownloadDatabaseOnPipelineCreation(bool? do /// The field to get the ip address from for the geographical lookup. /// /// - public IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -539,32 +594,43 @@ public IpLocationProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// The field to get the ip address from for the geographical lookup. /// /// - public IpLocationProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to get the ip address from for the geographical lookup. + /// If true, only the first found IP location data will be returned, even if the field contains an array. /// /// - public IpLocationProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor FirstOnly(bool? value = true) { - FieldValue = field; - return Self; + Instance.FirstOnly = value; + return this; } /// /// - /// If true, only the first found IP location data will be returned, even if the field contains an array. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public IpLocationProcessorDescriptor FirstOnly(bool? firstOnly = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If() { - FirstOnlyValue = firstOnly; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -572,10 +638,10 @@ public IpLocationProcessorDescriptor FirstOnly(bool? firstOnly = true) /// Conditionally execute the processor. /// /// - public IpLocationProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -583,10 +649,10 @@ public IpLocationProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public IpLocationProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -594,10 +660,10 @@ public IpLocationProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public IpLocationProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -605,40 +671,55 @@ public IpLocationProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public IpLocationProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public IpLocationProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public IpLocationProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public IpLocationProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -646,33 +727,33 @@ public IpLocationProcessorDescriptor OnFailure(params Actiontarget_field based on the IP location lookup. /// /// - public IpLocationProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Controls what properties are added to the target_field based on the IP location lookup. /// /// - public IpLocationProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Properties(params string[] values) { - TagValue = tag; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// The field that will hold the geographical information looked up from the MaxMind database. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -680,10 +761,10 @@ public IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.F /// The field that will hold the geographical information looked up from the MaxMind database. /// /// - public IpLocationProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -691,108 +772,17 @@ public IpLocationProcessorDescriptor TargetField(Expression /// - public IpLocationProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DatabaseFileValue)) - { - writer.WritePropertyName("database_file"); - writer.WriteStringValue(DatabaseFileValue); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DownloadDatabaseOnPipelineCreationValue.HasValue) - { - writer.WritePropertyName("download_database_on_pipeline_creation"); - writer.WriteBooleanValue(DownloadDatabaseOnPipelineCreationValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FirstOnlyValue.HasValue) - { - writer.WritePropertyName("first_only"); - writer.WriteBooleanValue(FirstOnlyValue.Value); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ipinfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ipinfo.g.cs index 22d40793b7c..0fb7a8dde29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ipinfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Ipinfo.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class IpinfoConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Ingest.Ipinfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Ipinfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Ipinfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.IpinfoConverter))] public sealed partial class Ipinfo { +#if NET7_0_OR_GREATER + public Ipinfo() + { + } +#endif +#if !NET7_0_OR_GREATER + public Ipinfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ipinfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } -public sealed partial class IpinfoDescriptor : SerializableDescriptor +public readonly partial struct IpinfoDescriptor { - internal IpinfoDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.Ipinfo Instance { get; init; } - public IpinfoDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpinfoDescriptor(Elastic.Clients.Elasticsearch.Ingest.Ipinfo instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpinfoDescriptor() { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.Ingest.Ipinfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor(Elastic.Clients.Elasticsearch.Ingest.Ipinfo instance) => new Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Ipinfo(Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Ipinfo Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Ingest.Ipinfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Ingest.IpinfoDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Ipinfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JoinProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JoinProcessor.g.cs index 5f0069755fe..c11e7dcf51d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JoinProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JoinProcessor.g.cs @@ -17,25 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class JoinProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.JoinProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propSeparator = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Separator = propSeparator.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.JoinProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.JoinProcessorConverter))] public sealed partial class JoinProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinProcessor(Elastic.Clients.Elasticsearch.Field field, string separator) + { + Field = field; + Separator = separator; + } +#if NET7_0_OR_GREATER + public JoinProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JoinProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +164,24 @@ public sealed partial class JoinProcessor /// Field containing array values to join. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,16 +189,18 @@ public sealed partial class JoinProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// The separator character. /// /// - [JsonInclude, JsonPropertyName("separator")] - public string Separator { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Separator { get; set; } /// /// @@ -84,7 +208,6 @@ public sealed partial class JoinProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +216,27 @@ public sealed partial class JoinProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(JoinProcessor joinProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Join(joinProcessor); } -public sealed partial class JoinProcessorDescriptor : SerializableDescriptor> +public readonly partial struct JoinProcessorDescriptor { - internal JoinProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.JoinProcessor Instance { get; init; } - public JoinProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +244,10 @@ public JoinProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public JoinProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +255,10 @@ public JoinProcessorDescriptor Description(string? description) /// Field containing array values to join. /// /// - public JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +266,21 @@ public JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// Field containing array values to join. /// /// - public JoinProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing array values to join. + /// Conditionally execute the processor. /// /// - public JoinProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +288,94 @@ public JoinProcessorDescriptor Field(Expression /// - public JoinProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public JoinProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public JoinProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public JoinProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreFailure = value; + return this; } - public JoinProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public JoinProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// The separator character. + /// Handle failures for the processor. /// /// - public JoinProcessorDescriptor Separator(string separator) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(params System.Action>[] actions) { - SeparatorValue = separator; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The separator character. /// /// - public JoinProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Separator(string value) { - TagValue = tag; - return Self; + Instance.Separator = value; + return this; } /// /// - /// The field to assign the joined value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +384,10 @@ public JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// By default, the field is updated in-place. /// /// - public JoinProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,103 +396,39 @@ public JoinProcessorDescriptor TargetField(Expression /// - public JoinProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.JoinProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class JoinProcessorDescriptor : SerializableDescriptor +public readonly partial struct JoinProcessorDescriptor { - internal JoinProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.JoinProcessor Instance { get; init; } - public JoinProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -384,10 +436,10 @@ public JoinProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public JoinProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -395,10 +447,10 @@ public JoinProcessorDescriptor Description(string? description) /// Field containing array values to join. /// /// - public JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -406,21 +458,21 @@ public JoinProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// Field containing array values to join. /// /// - public JoinProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing array values to join. + /// Conditionally execute the processor. /// /// - public JoinProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -428,97 +480,111 @@ public JoinProcessorDescriptor Field(Expression /// - public JoinProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public JoinProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public JoinProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public JoinProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public JoinProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public JoinProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The separator character. + /// Handle failures for the processor. /// /// - public JoinProcessorDescriptor Separator(string separator) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor OnFailure(params System.Action>[] actions) { - SeparatorValue = separator; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The separator character. /// /// - public JoinProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Separator(string value) { - TagValue = tag; - return Self; + Instance.Separator = value; + return this; } /// /// - /// The field to assign the joined value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -527,10 +593,10 @@ public JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public JoinProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -539,80 +605,17 @@ public JoinProcessorDescriptor TargetField(Expression /// - public JoinProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.JoinProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.JoinProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JsonProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JsonProcessor.g.cs index 5193ee0ff15..b103ce95d56 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JsonProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/JsonProcessor.g.cs @@ -17,25 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class JsonProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAddToRoot = System.Text.Json.JsonEncodedText.Encode("add_to_root"); + private static readonly System.Text.Json.JsonEncodedText PropAddToRootConflictStrategy = System.Text.Json.JsonEncodedText.Encode("add_to_root_conflict_strategy"); + private static readonly System.Text.Json.JsonEncodedText PropAllowDuplicateKeys = System.Text.Json.JsonEncodedText.Encode("allow_duplicate_keys"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.JsonProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAddToRoot = default; + LocalJsonValue propAddToRootConflictStrategy = default; + LocalJsonValue propAllowDuplicateKeys = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAddToRoot.TryReadProperty(ref reader, options, PropAddToRoot, null)) + { + continue; + } + + if (propAddToRootConflictStrategy.TryReadProperty(ref reader, options, PropAddToRootConflictStrategy, null)) + { + continue; + } + + if (propAllowDuplicateKeys.TryReadProperty(ref reader, options, PropAllowDuplicateKeys, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AddToRoot = propAddToRoot.Value, + AddToRootConflictStrategy = propAddToRootConflictStrategy.Value, + AllowDuplicateKeys = propAllowDuplicateKeys.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.JsonProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAddToRoot, value.AddToRoot, null, null); + writer.WriteProperty(options, PropAddToRootConflictStrategy, value.AddToRootConflictStrategy, null, null); + writer.WriteProperty(options, PropAllowDuplicateKeys, value.AllowDuplicateKeys, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConverter))] public sealed partial class JsonProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JsonProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public JsonProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JsonProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Flag that forces the parsed JSON to be added at the top level of the document. /// target_field must not be set when this option is chosen. /// /// - [JsonInclude, JsonPropertyName("add_to_root")] public bool? AddToRoot { get; set; } /// @@ -45,7 +183,6 @@ public sealed partial class JsonProcessor /// Only applicable if add_to_root is set to true. /// /// - [JsonInclude, JsonPropertyName("add_to_root_conflict_strategy")] public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? AddToRootConflictStrategy { get; set; } /// @@ -54,7 +191,6 @@ public sealed partial class JsonProcessor /// Instead, the last encountered value for any duplicate key wins. /// /// - [JsonInclude, JsonPropertyName("allow_duplicate_keys")] public bool? AllowDuplicateKeys { get; set; } /// @@ -63,7 +199,6 @@ public sealed partial class JsonProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -71,23 +206,24 @@ public sealed partial class JsonProcessor /// The field to be parsed. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -95,8 +231,7 @@ public sealed partial class JsonProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -104,7 +239,6 @@ public sealed partial class JsonProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -113,33 +247,27 @@ public sealed partial class JsonProcessor /// Any existing content in this field will be overwritten. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(JsonProcessor jsonProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Json(jsonProcessor); } -public sealed partial class JsonProcessorDescriptor : SerializableDescriptor> +public readonly partial struct JsonProcessorDescriptor { - internal JsonProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.JsonProcessor Instance { get; init; } - public JsonProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JsonProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor instance) { + Instance = instance; } - private bool? AddToRootValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? AddToRootConflictStrategyValue { get; set; } - private bool? AllowDuplicateKeysValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JsonProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -147,10 +275,10 @@ public JsonProcessorDescriptor() : base() /// target_field must not be set when this option is chosen. /// /// - public JsonProcessorDescriptor AddToRoot(bool? addToRoot = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AddToRoot(bool? value = true) { - AddToRootValue = addToRoot; - return Self; + Instance.AddToRoot = value; + return this; } /// @@ -160,10 +288,10 @@ public JsonProcessorDescriptor AddToRoot(bool? addToRoot = true) /// Only applicable if add_to_root is set to true. /// /// - public JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? addToRootConflictStrategy) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? value) { - AddToRootConflictStrategyValue = addToRootConflictStrategy; - return Self; + Instance.AddToRootConflictStrategy = value; + return this; } /// @@ -172,10 +300,10 @@ public JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clie /// Instead, the last encountered value for any duplicate key wins. /// /// - public JsonProcessorDescriptor AllowDuplicateKeys(bool? allowDuplicateKeys = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AllowDuplicateKeys(bool? value = true) { - AllowDuplicateKeysValue = allowDuplicateKeys; - return Self; + Instance.AllowDuplicateKeys = value; + return this; } /// @@ -184,10 +312,10 @@ public JsonProcessorDescriptor AllowDuplicateKeys(bool? allowDuplicat /// Useful for describing the purpose of the processor or its configuration. /// /// - public JsonProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -195,10 +323,10 @@ public JsonProcessorDescriptor Description(string? description) /// The field to be parsed. /// /// - public JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -206,21 +334,21 @@ public JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to be parsed. /// /// - public JsonProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be parsed. + /// Conditionally execute the processor. /// /// - public JsonProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -228,86 +356,83 @@ public JsonProcessorDescriptor Field(Expression /// - public JsonProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public JsonProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public JsonProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public JsonProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public JsonProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public JsonProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public JsonProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field that the converted structured object will be written into. - /// Any existing content in this field will be overwritten. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -316,10 +441,10 @@ public JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// Any existing content in this field will be overwritten. /// /// - public JsonProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -328,121 +453,39 @@ public JsonProcessorDescriptor TargetField(Expression /// - public JsonProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.JsonProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (AddToRootValue.HasValue) - { - writer.WritePropertyName("add_to_root"); - writer.WriteBooleanValue(AddToRootValue.Value); - } - - if (AddToRootConflictStrategyValue is not null) - { - writer.WritePropertyName("add_to_root_conflict_strategy"); - JsonSerializer.Serialize(writer, AddToRootConflictStrategyValue, options); - } - - if (AllowDuplicateKeysValue.HasValue) - { - writer.WritePropertyName("allow_duplicate_keys"); - writer.WriteBooleanValue(AllowDuplicateKeysValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class JsonProcessorDescriptor : SerializableDescriptor +public readonly partial struct JsonProcessorDescriptor { - internal JsonProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.JsonProcessor Instance { get; init; } - public JsonProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JsonProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor instance) { + Instance = instance; } - private bool? AddToRootValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? AddToRootConflictStrategyValue { get; set; } - private bool? AllowDuplicateKeysValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JsonProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -450,10 +493,10 @@ public JsonProcessorDescriptor() : base() /// target_field must not be set when this option is chosen. /// /// - public JsonProcessorDescriptor AddToRoot(bool? addToRoot = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AddToRoot(bool? value = true) { - AddToRootValue = addToRoot; - return Self; + Instance.AddToRoot = value; + return this; } /// @@ -463,10 +506,10 @@ public JsonProcessorDescriptor AddToRoot(bool? addToRoot = true) /// Only applicable if add_to_root is set to true. /// /// - public JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? addToRootConflictStrategy) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clients.Elasticsearch.Ingest.JsonProcessorConflictStrategy? value) { - AddToRootConflictStrategyValue = addToRootConflictStrategy; - return Self; + Instance.AddToRootConflictStrategy = value; + return this; } /// @@ -475,10 +518,10 @@ public JsonProcessorDescriptor AddToRootConflictStrategy(Elastic.Clients.Elastic /// Instead, the last encountered value for any duplicate key wins. /// /// - public JsonProcessorDescriptor AllowDuplicateKeys(bool? allowDuplicateKeys = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor AllowDuplicateKeys(bool? value = true) { - AllowDuplicateKeysValue = allowDuplicateKeys; - return Self; + Instance.AllowDuplicateKeys = value; + return this; } /// @@ -487,10 +530,10 @@ public JsonProcessorDescriptor AllowDuplicateKeys(bool? allowDuplicateKeys = tru /// Useful for describing the purpose of the processor or its configuration. /// /// - public JsonProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -498,10 +541,10 @@ public JsonProcessorDescriptor Description(string? description) /// The field to be parsed. /// /// - public JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -509,21 +552,21 @@ public JsonProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to be parsed. /// /// - public JsonProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be parsed. + /// Conditionally execute the processor. /// /// - public JsonProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -531,86 +574,100 @@ public JsonProcessorDescriptor Field(Expression /// - public JsonProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public JsonProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public JsonProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public JsonProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public JsonProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public JsonProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public JsonProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field that the converted structured object will be written into. - /// Any existing content in this field will be overwritten. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -619,10 +676,10 @@ public JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// Any existing content in this field will be overwritten. /// /// - public JsonProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -631,96 +688,17 @@ public JsonProcessorDescriptor TargetField(Expression /// - public JsonProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.JsonProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (AddToRootValue.HasValue) - { - writer.WritePropertyName("add_to_root"); - writer.WriteBooleanValue(AddToRootValue.Value); - } - - if (AddToRootConflictStrategyValue is not null) - { - writer.WritePropertyName("add_to_root_conflict_strategy"); - JsonSerializer.Serialize(writer, AddToRootConflictStrategyValue, options); - } - - if (AllowDuplicateKeysValue.HasValue) - { - writer.WritePropertyName("allow_duplicate_keys"); - writer.WriteBooleanValue(AllowDuplicateKeysValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.JsonProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/KeyValueProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/KeyValueProcessor.g.cs index db7604b7d3f..73b76a45501 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/KeyValueProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/KeyValueProcessor.g.cs @@ -17,25 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class KeyValueProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeKeys = System.Text.Json.JsonEncodedText.Encode("exclude_keys"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSplit = System.Text.Json.JsonEncodedText.Encode("field_split"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeKeys = System.Text.Json.JsonEncodedText.Encode("include_keys"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText PropStripBrackets = System.Text.Json.JsonEncodedText.Encode("strip_brackets"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropTrimKey = System.Text.Json.JsonEncodedText.Encode("trim_key"); + private static readonly System.Text.Json.JsonEncodedText PropTrimValue = System.Text.Json.JsonEncodedText.Encode("trim_value"); + private static readonly System.Text.Json.JsonEncodedText PropValueSplit = System.Text.Json.JsonEncodedText.Encode("value_split"); + + public override Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue?> propExcludeKeys = default; + LocalJsonValue propField = default; + LocalJsonValue propFieldSplit = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propIncludeKeys = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propPrefix = default; + LocalJsonValue propStripBrackets = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propTrimKey = default; + LocalJsonValue propTrimValue = default; + LocalJsonValue propValueSplit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propExcludeKeys.TryReadProperty(ref reader, options, PropExcludeKeys, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFieldSplit.TryReadProperty(ref reader, options, PropFieldSplit, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propIncludeKeys.TryReadProperty(ref reader, options, PropIncludeKeys, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPrefix.TryReadProperty(ref reader, options, PropPrefix, null)) + { + continue; + } + + if (propStripBrackets.TryReadProperty(ref reader, options, PropStripBrackets, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propTrimKey.TryReadProperty(ref reader, options, PropTrimKey, null)) + { + continue; + } + + if (propTrimValue.TryReadProperty(ref reader, options, PropTrimValue, null)) + { + continue; + } + + if (propValueSplit.TryReadProperty(ref reader, options, PropValueSplit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + ExcludeKeys = propExcludeKeys.Value, + Field = propField.Value, + FieldSplit = propFieldSplit.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + IncludeKeys = propIncludeKeys.Value, + OnFailure = propOnFailure.Value, + Prefix = propPrefix.Value, + StripBrackets = propStripBrackets.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value, + TrimKey = propTrimKey.Value, + TrimValue = propTrimValue.Value, + ValueSplit = propValueSplit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropExcludeKeys, value.ExcludeKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFieldSplit, value.FieldSplit, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropIncludeKeys, value.IncludeKeys, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrefix, value.Prefix, null, null); + writer.WriteProperty(options, PropStripBrackets, value.StripBrackets, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropTrimKey, value.TrimKey, null, null); + writer.WriteProperty(options, PropTrimValue, value.TrimValue, null, null); + writer.WriteProperty(options, PropValueSplit, value.ValueSplit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorConverter))] public sealed partial class KeyValueProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeyValueProcessor(Elastic.Clients.Elasticsearch.Field field, string fieldSplit, string valueSplit) + { + Field = field; + FieldSplit = fieldSplit; + ValueSplit = valueSplit; + } +#if NET7_0_OR_GREATER + public KeyValueProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KeyValueProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,8 +237,7 @@ public sealed partial class KeyValueProcessor /// List of keys to exclude from document. /// /// - [JsonInclude, JsonPropertyName("exclude_keys")] - public ICollection? ExcludeKeys { get; set; } + public System.Collections.Generic.ICollection? ExcludeKeys { get; set; } /// /// @@ -52,31 +245,35 @@ public sealed partial class KeyValueProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Regex pattern to use for splitting key-value pairs. /// /// - [JsonInclude, JsonPropertyName("field_split")] - public string FieldSplit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FieldSplit { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -84,7 +281,6 @@ public sealed partial class KeyValueProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -93,23 +289,20 @@ public sealed partial class KeyValueProcessor /// Defaults to including all keys. /// /// - [JsonInclude, JsonPropertyName("include_keys")] - public ICollection? IncludeKeys { get; set; } + public System.Collections.Generic.ICollection? IncludeKeys { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Prefix to be added to extracted keys. /// /// - [JsonInclude, JsonPropertyName("prefix")] public string? Prefix { get; set; } /// @@ -117,7 +310,6 @@ public sealed partial class KeyValueProcessor /// If true. strip brackets (), <>, [] as well as quotes ' and " from extracted values. /// /// - [JsonInclude, JsonPropertyName("strip_brackets")] public bool? StripBrackets { get; set; } /// @@ -126,7 +318,6 @@ public sealed partial class KeyValueProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -136,7 +327,6 @@ public sealed partial class KeyValueProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -144,7 +334,6 @@ public sealed partial class KeyValueProcessor /// String of characters to trim from extracted keys. /// /// - [JsonInclude, JsonPropertyName("trim_key")] public string? TrimKey { get; set; } /// @@ -152,7 +341,6 @@ public sealed partial class KeyValueProcessor /// String of characters to trim from extracted values. /// /// - [JsonInclude, JsonPropertyName("trim_value")] public string? TrimValue { get; set; } /// @@ -160,39 +348,31 @@ public sealed partial class KeyValueProcessor /// Regex pattern to use for splitting the key from the value within a key-value pair. /// /// - [JsonInclude, JsonPropertyName("value_split")] - public string ValueSplit { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(KeyValueProcessor keyValueProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Kv(keyValueProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + string ValueSplit { get; set; } } -public sealed partial class KeyValueProcessorDescriptor : SerializableDescriptor> +public readonly partial struct KeyValueProcessorDescriptor { - internal KeyValueProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor Instance { get; init; } - public KeyValueProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeyValueProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private ICollection? ExcludeKeysValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string FieldSplitValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? IncludeKeysValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? PrefixValue { get; set; } - private bool? StripBracketsValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private string? TrimKeyValue { get; set; } - private string? TrimValueValue { get; set; } - private string ValueSplitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeyValueProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -200,10 +380,10 @@ public KeyValueProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public KeyValueProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -211,22 +391,21 @@ public KeyValueProcessorDescriptor Description(string? description) /// List of keys to exclude from document. /// /// - public KeyValueProcessorDescriptor ExcludeKeys(ICollection? excludeKeys) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ExcludeKeys(System.Collections.Generic.ICollection? value) { - ExcludeKeysValue = excludeKeys; - return Self; + Instance.ExcludeKeys = value; + return this; } /// /// - /// The field to be parsed. - /// Supports template snippets. + /// List of keys to exclude from document. /// /// - public KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ExcludeKeys(params string[] values) { - FieldValue = field; - return Self; + Instance.ExcludeKeys = [.. values]; + return this; } /// @@ -235,10 +414,10 @@ public KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearc /// Supports template snippets. /// /// - public KeyValueProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -247,10 +426,10 @@ public KeyValueProcessorDescriptor Field(Expression /// - public KeyValueProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -258,10 +437,32 @@ public KeyValueProcessorDescriptor Field(Expression /// - public KeyValueProcessorDescriptor FieldSplit(string fieldSplit) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor FieldSplit(string value) + { + Instance.FieldSplit = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If() { - FieldSplitValue = fieldSplit; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -269,10 +470,10 @@ public KeyValueProcessorDescriptor FieldSplit(string fieldSplit) /// Conditionally execute the processor. /// /// - public KeyValueProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -280,10 +481,10 @@ public KeyValueProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public KeyValueProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -291,10 +492,10 @@ public KeyValueProcessorDescriptor IgnoreFailure(bool? ignoreFailure /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public KeyValueProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -303,98 +504,95 @@ public KeyValueProcessorDescriptor IgnoreMissing(bool? ignoreMissing /// Defaults to including all keys. /// /// - public KeyValueProcessorDescriptor IncludeKeys(ICollection? includeKeys) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IncludeKeys(System.Collections.Generic.ICollection? value) { - IncludeKeysValue = includeKeys; - return Self; + Instance.IncludeKeys = value; + return this; } /// /// - /// Handle failures for the processor. + /// List of keys to filter and insert into document. + /// Defaults to including all keys. /// /// - public KeyValueProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IncludeKeys(params string[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IncludeKeys = [.. values]; + return this; } - public KeyValueProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public KeyValueProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public KeyValueProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Prefix to be added to extracted keys. + /// Handle failures for the processor. /// /// - public KeyValueProcessorDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(params System.Action>[] actions) { - PrefixValue = prefix; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// If true. strip brackets (), <>, [] as well as quotes ' and " from extracted values. + /// Prefix to be added to extracted keys. /// /// - public KeyValueProcessorDescriptor StripBrackets(bool? stripBrackets = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Prefix(string? value) { - StripBracketsValue = stripBrackets; - return Self; + Instance.Prefix = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// If true. strip brackets (), <>, [] as well as quotes ' and " from extracted values. /// /// - public KeyValueProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor StripBrackets(bool? value = true) { - TagValue = tag; - return Self; + Instance.StripBrackets = value; + return this; } /// /// - /// The field to insert the extracted keys into. - /// Defaults to the root of the document. - /// Supports template snippets. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -404,10 +602,10 @@ public KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasti /// Supports template snippets. /// /// - public KeyValueProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -417,10 +615,10 @@ public KeyValueProcessorDescriptor TargetField(Expression /// - public KeyValueProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -428,10 +626,10 @@ public KeyValueProcessorDescriptor TargetField(Expression /// - public KeyValueProcessorDescriptor TrimKey(string? trimKey) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TrimKey(string? value) { - TrimKeyValue = trimKey; - return Self; + Instance.TrimKey = value; + return this; } /// @@ -439,10 +637,10 @@ public KeyValueProcessorDescriptor TrimKey(string? trimKey) /// String of characters to trim from extracted values. /// /// - public KeyValueProcessorDescriptor TrimValue(string? trimValue) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TrimValue(string? value) { - TrimValueValue = trimValue; - return Self; + Instance.TrimValue = value; + return this; } /// @@ -450,155 +648,39 @@ public KeyValueProcessorDescriptor TrimValue(string? trimValue) /// Regex pattern to use for splitting the key from the value within a key-value pair. /// /// - public KeyValueProcessorDescriptor ValueSplit(string valueSplit) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ValueSplit(string value) { - ValueSplitValue = valueSplit; - return Self; + Instance.ValueSplit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (ExcludeKeysValue is not null) - { - writer.WritePropertyName("exclude_keys"); - JsonSerializer.Serialize(writer, ExcludeKeysValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("field_split"); - writer.WriteStringValue(FieldSplitValue); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (IncludeKeysValue is not null) - { - writer.WritePropertyName("include_keys"); - JsonSerializer.Serialize(writer, IncludeKeysValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } - - if (StripBracketsValue.HasValue) - { - writer.WritePropertyName("strip_brackets"); - writer.WriteBooleanValue(StripBracketsValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (!string.IsNullOrEmpty(TrimKeyValue)) - { - writer.WritePropertyName("trim_key"); - writer.WriteStringValue(TrimKeyValue); - } - - if (!string.IsNullOrEmpty(TrimValueValue)) - { - writer.WritePropertyName("trim_value"); - writer.WriteStringValue(TrimValueValue); - } - - writer.WritePropertyName("value_split"); - writer.WriteStringValue(ValueSplitValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class KeyValueProcessorDescriptor : SerializableDescriptor +public readonly partial struct KeyValueProcessorDescriptor { - internal KeyValueProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeyValueProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor instance) + { + Instance = instance; + } - public KeyValueProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeyValueProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private ICollection? ExcludeKeysValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string FieldSplitValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? IncludeKeysValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? PrefixValue { get; set; } - private bool? StripBracketsValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private string? TrimKeyValue { get; set; } - private string? TrimValueValue { get; set; } - private string ValueSplitValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -606,10 +688,10 @@ public KeyValueProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public KeyValueProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -617,22 +699,21 @@ public KeyValueProcessorDescriptor Description(string? description) /// List of keys to exclude from document. /// /// - public KeyValueProcessorDescriptor ExcludeKeys(ICollection? excludeKeys) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ExcludeKeys(System.Collections.Generic.ICollection? value) { - ExcludeKeysValue = excludeKeys; - return Self; + Instance.ExcludeKeys = value; + return this; } /// /// - /// The field to be parsed. - /// Supports template snippets. + /// List of keys to exclude from document. /// /// - public KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ExcludeKeys(params string[] values) { - FieldValue = field; - return Self; + Instance.ExcludeKeys = [.. values]; + return this; } /// @@ -641,10 +722,10 @@ public KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fie /// Supports template snippets. /// /// - public KeyValueProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -653,10 +734,10 @@ public KeyValueProcessorDescriptor Field(Expression /// - public KeyValueProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -664,10 +745,32 @@ public KeyValueProcessorDescriptor Field(Expression /// - public KeyValueProcessorDescriptor FieldSplit(string fieldSplit) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor FieldSplit(string value) + { + Instance.FieldSplit = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If() { - FieldSplitValue = fieldSplit; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -675,10 +778,10 @@ public KeyValueProcessorDescriptor FieldSplit(string fieldSplit) /// Conditionally execute the processor. /// /// - public KeyValueProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -686,10 +789,10 @@ public KeyValueProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public KeyValueProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -697,10 +800,10 @@ public KeyValueProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public KeyValueProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -709,98 +812,112 @@ public KeyValueProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Defaults to including all keys. /// /// - public KeyValueProcessorDescriptor IncludeKeys(ICollection? includeKeys) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IncludeKeys(System.Collections.Generic.ICollection? value) { - IncludeKeysValue = includeKeys; - return Self; + Instance.IncludeKeys = value; + return this; } /// /// - /// Handle failures for the processor. + /// List of keys to filter and insert into document. + /// Defaults to including all keys. /// /// - public KeyValueProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor IncludeKeys(params string[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IncludeKeys = [.. values]; + return this; } - public KeyValueProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public KeyValueProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public KeyValueProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Prefix to be added to extracted keys. + /// Handle failures for the processor. /// /// - public KeyValueProcessorDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor OnFailure(params System.Action>[] actions) { - PrefixValue = prefix; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// If true. strip brackets (), <>, [] as well as quotes ' and " from extracted values. + /// Prefix to be added to extracted keys. /// /// - public KeyValueProcessorDescriptor StripBrackets(bool? stripBrackets = true) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Prefix(string? value) { - StripBracketsValue = stripBrackets; - return Self; + Instance.Prefix = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// If true. strip brackets (), <>, [] as well as quotes ' and " from extracted values. /// /// - public KeyValueProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor StripBrackets(bool? value = true) { - TagValue = tag; - return Self; + Instance.StripBrackets = value; + return this; } /// /// - /// The field to insert the extracted keys into. - /// Defaults to the root of the document. - /// Supports template snippets. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -810,10 +927,10 @@ public KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fie /// Supports template snippets. /// /// - public KeyValueProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -823,10 +940,10 @@ public KeyValueProcessorDescriptor TargetField(Expression /// - public KeyValueProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -834,10 +951,10 @@ public KeyValueProcessorDescriptor TargetField(Expression /// - public KeyValueProcessorDescriptor TrimKey(string? trimKey) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TrimKey(string? value) { - TrimKeyValue = trimKey; - return Self; + Instance.TrimKey = value; + return this; } /// @@ -845,10 +962,10 @@ public KeyValueProcessorDescriptor TrimKey(string? trimKey) /// String of characters to trim from extracted values. /// /// - public KeyValueProcessorDescriptor TrimValue(string? trimValue) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor TrimValue(string? value) { - TrimValueValue = trimValue; - return Self; + Instance.TrimValue = value; + return this; } /// @@ -856,124 +973,17 @@ public KeyValueProcessorDescriptor TrimValue(string? trimValue) /// Regex pattern to use for splitting the key from the value within a key-value pair. /// /// - public KeyValueProcessorDescriptor ValueSplit(string valueSplit) + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor ValueSplit(string value) { - ValueSplitValue = valueSplit; - return Self; + Instance.ValueSplit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (ExcludeKeysValue is not null) - { - writer.WritePropertyName("exclude_keys"); - JsonSerializer.Serialize(writer, ExcludeKeysValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("field_split"); - writer.WriteStringValue(FieldSplitValue); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (IncludeKeysValue is not null) - { - writer.WritePropertyName("include_keys"); - JsonSerializer.Serialize(writer, IncludeKeysValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } - - if (StripBracketsValue.HasValue) - { - writer.WritePropertyName("strip_brackets"); - writer.WriteBooleanValue(StripBracketsValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (!string.IsNullOrEmpty(TrimKeyValue)) - { - writer.WritePropertyName("trim_key"); - writer.WriteStringValue(TrimKeyValue); - } - - if (!string.IsNullOrEmpty(TrimValueValue)) - { - writer.WritePropertyName("trim_value"); - writer.WriteStringValue(TrimValueValue); - } - - writer.WritePropertyName("value_split"); - writer.WriteStringValue(ValueSplitValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Local.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Local.g.cs index 72e158e02c5..bb20c67dedc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Local.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Local.g.cs @@ -17,45 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class Local -{ - [JsonInclude, JsonPropertyName("type")] - public string Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull(Local local) => Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull.Local(local); -} - -public sealed partial class LocalDescriptor : SerializableDescriptor +internal sealed partial class LocalConverter : System.Text.Json.Serialization.JsonConverter { - internal LocalDescriptor(Action configure) => configure.Invoke(this); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); - public LocalDescriptor() : base() + public override Elastic.Clients.Elasticsearch.Ingest.Local Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - } + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } - private string TypeValue { get; set; } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - public LocalDescriptor Type(string type) - { - TypeValue = type; - return Self; + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Local(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Local value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); + writer.WriteProperty(options, PropType, value.Type, null, null); writer.WriteEndObject(); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.LocalConverter))] +public sealed partial class Local +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Local(string type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public Local() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Local() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Local(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/LowercaseProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/LowercaseProcessor.g.cs index 37c80274049..5c0f1ad8083 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/LowercaseProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/LowercaseProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class LowercaseProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorConverter))] public sealed partial class LowercaseProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public LowercaseProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LowercaseProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class LowercaseProcessor /// The field to make lowercase. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class LowercaseProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class LowercaseProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class LowercaseProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class LowercaseProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(LowercaseProcessor lowercaseProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Lowercase(lowercaseProcessor); } -public sealed partial class LowercaseProcessorDescriptor : SerializableDescriptor> +public readonly partial struct LowercaseProcessorDescriptor { - internal LowercaseProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor instance) + { + Instance = instance; + } - public LowercaseProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public LowercaseProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public LowercaseProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public LowercaseProcessorDescriptor Description(string? description) /// The field to make lowercase. /// /// - public LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsear /// The field to make lowercase. /// /// - public LowercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to make lowercase. + /// Conditionally execute the processor. /// /// - public LowercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public LowercaseProcessorDescriptor Field(Expression /// - public LowercaseProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public LowercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public LowercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public LowercaseProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public LowercaseProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public LowercaseProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public LowercaseProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public LowercaseProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elast /// By default, the field is updated in-place. /// /// - public LowercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public LowercaseProcessorDescriptor TargetField(Expression /// - public LowercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class LowercaseProcessorDescriptor : SerializableDescriptor +public readonly partial struct LowercaseProcessorDescriptor { - internal LowercaseProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor Instance { get; init; } - public LowercaseProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LowercaseProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public LowercaseProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public LowercaseProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public LowercaseProcessorDescriptor Description(string? description) /// The field to make lowercase. /// /// - public LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public LowercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fi /// The field to make lowercase. /// /// - public LowercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to make lowercase. + /// Conditionally execute the processor. /// /// - public LowercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public LowercaseProcessorDescriptor Field(Expression /// - public LowercaseProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public LowercaseProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public LowercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public LowercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public LowercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public LowercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public LowercaseProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public LowercaseProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public LowercaseProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public LowercaseProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public LowercaseProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fi /// By default, the field is updated in-place. /// /// - public LowercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public LowercaseProcessorDescriptor TargetField(Expression /// - public LowercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Maxmind.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Maxmind.g.cs index 16164834ba4..45e1a679ab4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Maxmind.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Maxmind.g.cs @@ -17,46 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class MaxmindConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccountId = System.Text.Json.JsonEncodedText.Encode("account_id"); + + public override Elastic.Clients.Elasticsearch.Ingest.Maxmind Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccountId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccountId.TryReadProperty(ref reader, options, PropAccountId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Maxmind(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AccountId = propAccountId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Maxmind value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccountId, value.AccountId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.MaxmindConverter))] public sealed partial class Maxmind { - [JsonInclude, JsonPropertyName("account_id")] - public Elastic.Clients.Elasticsearch.Id AccountId { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Maxmind(Elastic.Clients.Elasticsearch.Id accountId) + { + AccountId = accountId; + } +#if NET7_0_OR_GREATER + public Maxmind() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Maxmind() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Maxmind(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration(Maxmind maxmind) => Elastic.Clients.Elasticsearch.Ingest.DatabaseConfiguration.Maxmind(maxmind); - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull(Maxmind maxmind) => Elastic.Clients.Elasticsearch.Ingest.DatabaseConfigurationFull.Maxmind(maxmind); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id AccountId { get; set; } } -public sealed partial class MaxmindDescriptor : SerializableDescriptor +public readonly partial struct MaxmindDescriptor { - internal MaxmindDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.Maxmind Instance { get; init; } - public MaxmindDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxmindDescriptor(Elastic.Clients.Elasticsearch.Ingest.Maxmind instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id AccountIdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MaxmindDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Maxmind(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public MaxmindDescriptor AccountId(Elastic.Clients.Elasticsearch.Id accountId) + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor(Elastic.Clients.Elasticsearch.Ingest.Maxmind instance) => new Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Maxmind(Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor AccountId(Elastic.Clients.Elasticsearch.Id value) { - AccountIdValue = accountId; - return Self; + Instance.AccountId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Maxmind Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("account_id"); - JsonSerializer.Serialize(writer, AccountIdValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.MaxmindDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Maxmind(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/NetworkDirectionProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/NetworkDirectionProcessor.g.cs index 22371363f48..5fd983c86aa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/NetworkDirectionProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/NetworkDirectionProcessor.g.cs @@ -17,25 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class NetworkDirectionProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDestinationIp = System.Text.Json.JsonEncodedText.Encode("destination_ip"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropInternalNetworks = System.Text.Json.JsonEncodedText.Encode("internal_networks"); + private static readonly System.Text.Json.JsonEncodedText PropInternalNetworksField = System.Text.Json.JsonEncodedText.Encode("internal_networks_field"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropSourceIp = System.Text.Json.JsonEncodedText.Encode("source_ip"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDestinationIp = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propInternalNetworks = default; + LocalJsonValue propInternalNetworksField = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propSourceIp = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDestinationIp.TryReadProperty(ref reader, options, PropDestinationIp, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propInternalNetworks.TryReadProperty(ref reader, options, PropInternalNetworks, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propInternalNetworksField.TryReadProperty(ref reader, options, PropInternalNetworksField, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSourceIp.TryReadProperty(ref reader, options, PropSourceIp, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + DestinationIp = propDestinationIp.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + InternalNetworks = propInternalNetworks.Value, + InternalNetworksField = propInternalNetworksField.Value, + OnFailure = propOnFailure.Value, + SourceIp = propSourceIp.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDestinationIp, value.DestinationIp, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropInternalNetworks, value.InternalNetworks, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInternalNetworksField, value.InternalNetworksField, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSourceIp, value.SourceIp, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorConverter))] public sealed partial class NetworkDirectionProcessor { +#if NET7_0_OR_GREATER + public NetworkDirectionProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public NetworkDirectionProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,7 +184,6 @@ public sealed partial class NetworkDirectionProcessor /// Field containing the destination IP address. /// /// - [JsonInclude, JsonPropertyName("destination_ip")] public Elastic.Clients.Elasticsearch.Field? DestinationIp { get; set; } /// @@ -51,15 +191,13 @@ public sealed partial class NetworkDirectionProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,7 +206,6 @@ public sealed partial class NetworkDirectionProcessor /// without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -79,8 +216,7 @@ public sealed partial class NetworkDirectionProcessor /// internal_networks or internal_networks_field. /// /// - [JsonInclude, JsonPropertyName("internal_networks")] - public ICollection? InternalNetworks { get; set; } + public System.Collections.Generic.ICollection? InternalNetworks { get; set; } /// /// @@ -88,7 +224,6 @@ public sealed partial class NetworkDirectionProcessor /// from. /// /// - [JsonInclude, JsonPropertyName("internal_networks_field")] public Elastic.Clients.Elasticsearch.Field? InternalNetworksField { get; set; } /// @@ -96,15 +231,13 @@ public sealed partial class NetworkDirectionProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Field containing the source IP address. /// /// - [JsonInclude, JsonPropertyName("source_ip")] public Elastic.Clients.Elasticsearch.Field? SourceIp { get; set; } /// @@ -113,7 +246,6 @@ public sealed partial class NetworkDirectionProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -121,34 +253,27 @@ public sealed partial class NetworkDirectionProcessor /// Output field for the network direction. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(NetworkDirectionProcessor networkDirectionProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.NetworkDirection(networkDirectionProcessor); } -public sealed partial class NetworkDirectionProcessorDescriptor : SerializableDescriptor> +public readonly partial struct NetworkDirectionProcessorDescriptor { - internal NetworkDirectionProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor Instance { get; init; } - public NetworkDirectionProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NetworkDirectionProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationIpValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? InternalNetworksValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? InternalNetworksFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourceIpValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NetworkDirectionProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -156,10 +281,10 @@ public NetworkDirectionProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public NetworkDirectionProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -167,10 +292,10 @@ public NetworkDirectionProcessorDescriptor Description(string? descri /// Field containing the destination IP address. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// @@ -178,21 +303,32 @@ public NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clie /// Field containing the destination IP address. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor DestinationIp(System.Linq.Expressions.Expression> value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// /// - /// Field containing the destination IP address. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If() { - DestinationIpValue = destinationIp; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -200,10 +336,10 @@ public NetworkDirectionProcessorDescriptor DestinationIp(Expression /// - public NetworkDirectionProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -211,10 +347,10 @@ public NetworkDirectionProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -223,10 +359,10 @@ public NetworkDirectionProcessorDescriptor IgnoreFailure(bool? ignore /// without modifying the document. /// /// - public NetworkDirectionProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -237,22 +373,24 @@ public NetworkDirectionProcessorDescriptor IgnoreMissing(bool? ignore /// internal_networks or internal_networks_field. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworks(ICollection? internalNetworks) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworks(System.Collections.Generic.ICollection? value) { - InternalNetworksValue = internalNetworks; - return Self; + Instance.InternalNetworks = value; + return this; } /// /// - /// A field on the given document to read the internal_networks configuration - /// from. + /// List of internal networks. Supports IPv4 and IPv6 addresses and ranges in + /// CIDR notation. Also supports the named ranges listed below. These may be + /// constructed with template snippets. Must specify only one of + /// internal_networks or internal_networks_field. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Elastic.Clients.Elasticsearch.Field? internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworks(params string[] values) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworks = [.. values]; + return this; } /// @@ -261,10 +399,10 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField(Elas /// from. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Expression> internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworksField(Elastic.Clients.Elasticsearch.Field? value) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworksField = value; + return this; } /// @@ -273,10 +411,10 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Expression> internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworksField(System.Linq.Expressions.Expression> value) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworksField = value; + return this; } /// @@ -284,62 +422,38 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField(Expr /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public NetworkDirectionProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public NetworkDirectionProcessorDescriptor OnFailure(Action> configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public NetworkDirectionProcessorDescriptor OnFailure(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - SourceIpValue = sourceIp; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(params System.Action>[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -347,33 +461,33 @@ public NetworkDirectionProcessorDescriptor SourceIp(Expressio /// Field containing the source IP address. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? value) { - SourceIpValue = sourceIp; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Field containing the source IP address. /// /// - public NetworkDirectionProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor SourceIp(System.Linq.Expressions.Expression> value) { - TagValue = tag; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Output field for the network direction. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -381,10 +495,10 @@ public NetworkDirectionProcessorDescriptor TargetField(Elastic.Client /// Output field for the network direction. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -392,132 +506,44 @@ public NetworkDirectionProcessorDescriptor TargetField(Expres /// Output field for the network direction. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestinationIpValue is not null) - { - writer.WritePropertyName("destination_ip"); - JsonSerializer.Serialize(writer, DestinationIpValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (InternalNetworksValue is not null) - { - writer.WritePropertyName("internal_networks"); - JsonSerializer.Serialize(writer, InternalNetworksValue, options); - } - - if (InternalNetworksFieldValue is not null) + if (action is null) { - writer.WritePropertyName("internal_networks_field"); - JsonSerializer.Serialize(writer, InternalNetworksFieldValue, options); + return new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (SourceIpValue is not null) - { - writer.WritePropertyName("source_ip"); - JsonSerializer.Serialize(writer, SourceIpValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NetworkDirectionProcessorDescriptor : SerializableDescriptor +public readonly partial struct NetworkDirectionProcessorDescriptor { - internal NetworkDirectionProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NetworkDirectionProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor instance) + { + Instance = instance; + } - public NetworkDirectionProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NetworkDirectionProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DestinationIpValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? InternalNetworksValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? InternalNetworksFieldValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Field? SourceIpValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -525,10 +551,10 @@ public NetworkDirectionProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public NetworkDirectionProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -536,10 +562,10 @@ public NetworkDirectionProcessorDescriptor Description(string? description) /// Field containing the destination IP address. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clients.Elasticsearch.Field? value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// @@ -547,21 +573,32 @@ public NetworkDirectionProcessorDescriptor DestinationIp(Elastic.Clients.Elastic /// Field containing the destination IP address. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor DestinationIp(System.Linq.Expressions.Expression> value) { - DestinationIpValue = destinationIp; - return Self; + Instance.DestinationIp = value; + return this; } /// /// - /// Field containing the destination IP address. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public NetworkDirectionProcessorDescriptor DestinationIp(Expression> destinationIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If() { - DestinationIpValue = destinationIp; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -569,10 +606,10 @@ public NetworkDirectionProcessorDescriptor DestinationIp(Expression /// - public NetworkDirectionProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -580,10 +617,10 @@ public NetworkDirectionProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -592,10 +629,10 @@ public NetworkDirectionProcessorDescriptor IgnoreFailure(bool? ignoreFailure = t /// without modifying the document. /// /// - public NetworkDirectionProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -606,22 +643,24 @@ public NetworkDirectionProcessorDescriptor IgnoreMissing(bool? ignoreMissing = t /// internal_networks or internal_networks_field. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworks(ICollection? internalNetworks) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworks(System.Collections.Generic.ICollection? value) { - InternalNetworksValue = internalNetworks; - return Self; + Instance.InternalNetworks = value; + return this; } /// /// - /// A field on the given document to read the internal_networks configuration - /// from. + /// List of internal networks. Supports IPv4 and IPv6 addresses and ranges in + /// CIDR notation. Also supports the named ranges listed below. These may be + /// constructed with template snippets. Must specify only one of + /// internal_networks or internal_networks_field. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Elastic.Clients.Elasticsearch.Field? internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworks(params string[] values) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworks = [.. values]; + return this; } /// @@ -630,10 +669,10 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField(Elastic.Clients /// from. /// /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Expression> internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworksField(Elastic.Clients.Elasticsearch.Field? value) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworksField = value; + return this; } /// @@ -642,10 +681,10 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField /// - public NetworkDirectionProcessorDescriptor InternalNetworksField(Expression> internalNetworksField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor InternalNetworksField(System.Linq.Expressions.Expression> value) { - InternalNetworksFieldValue = internalNetworksField; - return Self; + Instance.InternalNetworksField = value; + return this; } /// @@ -653,62 +692,55 @@ public NetworkDirectionProcessorDescriptor InternalNetworksField(Expr /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public NetworkDirectionProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public NetworkDirectionProcessorDescriptor OnFailure(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public NetworkDirectionProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(params System.Action[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Field containing the source IP address. + /// Handle failures for the processor. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor OnFailure(params System.Action>[] actions) { - SourceIpValue = sourceIp; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -716,33 +748,33 @@ public NetworkDirectionProcessorDescriptor SourceIp(Expressio /// Field containing the source IP address. /// /// - public NetworkDirectionProcessorDescriptor SourceIp(Expression> sourceIp) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor SourceIp(Elastic.Clients.Elasticsearch.Field? value) { - SourceIpValue = sourceIp; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Field containing the source IP address. /// /// - public NetworkDirectionProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor SourceIp(System.Linq.Expressions.Expression> value) { - TagValue = tag; - return Self; + Instance.SourceIp = value; + return this; } /// /// - /// Output field for the network direction. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -750,10 +782,10 @@ public NetworkDirectionProcessorDescriptor TargetField(Elastic.Clients.Elasticse /// Output field for the network direction. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -761,106 +793,22 @@ public NetworkDirectionProcessorDescriptor TargetField(Expres /// Output field for the network direction. /// /// - public NetworkDirectionProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (DestinationIpValue is not null) - { - writer.WritePropertyName("destination_ip"); - JsonSerializer.Serialize(writer, DestinationIpValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); + return new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (InternalNetworksValue is not null) - { - writer.WritePropertyName("internal_networks"); - JsonSerializer.Serialize(writer, InternalNetworksValue, options); - } - - if (InternalNetworksFieldValue is not null) - { - writer.WritePropertyName("internal_networks_field"); - JsonSerializer.Serialize(writer, InternalNetworksFieldValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (SourceIpValue is not null) - { - writer.WritePropertyName("source_ip"); - JsonSerializer.Serialize(writer, SourceIpValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Pipeline.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Pipeline.g.cs index 4d32454100b..2a9331c54f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Pipeline.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Pipeline.g.cs @@ -17,25 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class PipelineConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeprecated = System.Text.Json.JsonEncodedText.Encode("deprecated"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.Pipeline Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeprecated = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProcessors = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeprecated.TryReadProperty(ref reader, options, PropDeprecated, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deprecated = propDeprecated.Value, + Description = propDescription.Value, + Meta = propMeta.Value, + OnFailure = propOnFailure.Value, + Processors = propProcessors.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Pipeline value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeprecated, value.Deprecated, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PipelineConverter))] public sealed partial class Pipeline { +#if NET7_0_OR_GREATER + public Pipeline() + { + } +#endif +#if !NET7_0_OR_GREATER + public Pipeline() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Marks this ingest pipeline as deprecated. /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - [JsonInclude, JsonPropertyName("deprecated")] public bool? Deprecated { get; set; } /// @@ -43,7 +139,6 @@ public sealed partial class Pipeline /// Description of the ingest pipeline. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -51,16 +146,14 @@ public sealed partial class Pipeline /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// /// Processors to run immediately after a processor failure. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -68,38 +161,34 @@ public sealed partial class Pipeline /// Processors run sequentially in the order specified. /// /// - [JsonInclude, JsonPropertyName("processors")] - public ICollection? Processors { get; set; } + public System.Collections.Generic.ICollection? Processors { get; set; } /// /// /// Version number used by external systems to track ingest pipelines. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } } -public sealed partial class PipelineDescriptor : SerializableDescriptor> +public readonly partial struct PipelineDescriptor { - internal PipelineDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.Pipeline Instance { get; init; } - public PipelineDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineDescriptor(Elastic.Clients.Elasticsearch.Ingest.Pipeline instance) { + Instance = instance; } - private bool? DeprecatedValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? ProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorsDescriptor { get; set; } - private Action> ProcessorsDescriptorAction { get; set; } - private Action>[] ProcessorsDescriptorActions { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(Elastic.Clients.Elasticsearch.Ingest.Pipeline instance) => new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor descriptor) => descriptor.Instance; /// /// @@ -107,10 +196,10 @@ public PipelineDescriptor() : base() /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - public PipelineDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -118,10 +207,10 @@ public PipelineDescriptor Deprecated(bool? deprecated = true) /// Description of the ingest pipeline. /// /// - public PipelineDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -129,219 +218,165 @@ public PipelineDescriptor Description(string? description) /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. /// /// - public PipelineDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } /// /// - /// Processors to run immediately after a processor failure. + /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. /// /// - public PipelineDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta() { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public PipelineDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PipelineDescriptor OnFailure(Action> configure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor AddMeta(string key, object value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PipelineDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Processors to run immediately after a processor failure. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Processors used to perform transformations on documents before indexing. - /// Processors run sequentially in the order specified. + /// Processors to run immediately after a processor failure. /// /// - public PipelineDescriptor Processors(ICollection? processors) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsValue = processors; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PipelineDescriptor Processors(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Processors to run immediately after a processor failure. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(params System.Action>[] actions) { - ProcessorsValue = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public PipelineDescriptor Processors(Action> configure) - { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptorAction = configure; - return Self; + Instance.OnFailure = items; + return this; } - public PipelineDescriptor Processors(params Action>[] configure) + /// + /// + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(System.Collections.Generic.ICollection? value) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = configure; - return Self; + Instance.Processors = value; + return this; } /// /// - /// Version number used by external systems to track ingest pipelines. + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. /// /// - public PipelineDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - VersionValue = version; - return Self; + Instance.Processors = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(params System.Action>[] actions) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) - { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (MetaValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ProcessorsDescriptor is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - foreach (var action in ProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.Processors = items; + return this; + } - writer.WriteEndArray(); - } - else if (ProcessorsValue is not null) - { - writer.WritePropertyName("processors"); - JsonSerializer.Serialize(writer, ProcessorsValue, options); - } + /// + /// + /// Version number used by external systems to track ingest pipelines. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Pipeline Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); + return new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PipelineDescriptor : SerializableDescriptor +public readonly partial struct PipelineDescriptor { - internal PipelineDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.Pipeline Instance { get; init; } - public PipelineDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineDescriptor(Elastic.Clients.Elasticsearch.Ingest.Pipeline instance) { + Instance = instance; } - private bool? DeprecatedValue { get; set; } - private string? DescriptionValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? ProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor ProcessorsDescriptor { get; set; } - private Action ProcessorsDescriptorAction { get; set; } - private Action[] ProcessorsDescriptorActions { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(Elastic.Clients.Elasticsearch.Ingest.Pipeline instance) => new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor descriptor) => descriptor.Instance; /// /// @@ -349,10 +384,10 @@ public PipelineDescriptor() : base() /// When a deprecated ingest pipeline is referenced as the default or final pipeline when creating or updating a non-deprecated index template, Elasticsearch will emit a deprecation warning. /// /// - public PipelineDescriptor Deprecated(bool? deprecated = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Deprecated(bool? value = true) { - DeprecatedValue = deprecated; - return Self; + Instance.Deprecated = value; + return this; } /// @@ -360,10 +395,10 @@ public PipelineDescriptor Deprecated(bool? deprecated = true) /// Description of the ingest pipeline. /// /// - public PipelineDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -371,195 +406,178 @@ public PipelineDescriptor Description(string? description) /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. /// /// - public PipelineDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } /// /// - /// Processors to run immediately after a processor failure. + /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. /// /// - public PipelineDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta() { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public PipelineDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Arbitrary metadata about the ingest pipeline. This map is not automatically generated by Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Meta(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public PipelineDescriptor OnFailure(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor AddMeta(string key, object value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PipelineDescriptor OnFailure(params Action[] configure) + /// + /// + /// Processors to run immediately after a processor failure. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Processors used to perform transformations on documents before indexing. - /// Processors run sequentially in the order specified. + /// Processors to run immediately after a processor failure. /// /// - public PipelineDescriptor Processors(ICollection? processors) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsValue = processors; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PipelineDescriptor Processors(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Processors to run immediately after a processor failure. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(params System.Action[] actions) { - ProcessorsValue = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public PipelineDescriptor Processors(Action configure) + /// + /// + /// Processors to run immediately after a processor failure. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor OnFailure(params System.Action>[] actions) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorActions = null; - ProcessorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public PipelineDescriptor Processors(params Action[] configure) + /// + /// + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(System.Collections.Generic.ICollection? value) { - ProcessorsValue = null; - ProcessorsDescriptor = null; - ProcessorsDescriptorAction = null; - ProcessorsDescriptorActions = configure; - return Self; + Instance.Processors = value; + return this; } /// /// - /// Version number used by external systems to track ingest pipelines. + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. /// /// - public PipelineDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - VersionValue = version; - return Self; + Instance.Processors = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(params System.Action[] actions) { - writer.WriteStartObject(); - if (DeprecatedValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("deprecated"); - writer.WriteBooleanValue(DeprecatedValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.Processors = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) + /// + /// + /// Processors used to perform transformations on documents before indexing. + /// Processors run sequentially in the order specified. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Processors(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (ProcessorsDescriptor is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(ProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("processors"); - writer.WriteStartArray(); - foreach (var action in ProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.Processors = items; + return this; + } - writer.WriteEndArray(); - } - else if (ProcessorsValue is not null) - { - writer.WritePropertyName("processors"); - JsonSerializer.Serialize(writer, ProcessorsValue, options); - } + /// + /// + /// Version number used by external systems to track ingest pipelines. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Pipeline Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); + return new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PipelineDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Pipeline(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineConfig.g.cs index 698d1261e8e..4589b421f77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineConfig.g.cs @@ -17,25 +17,100 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class PipelineConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Ingest.PipelineConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue> propProcessors = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PipelineConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Processors = propProcessors.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PipelineConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PipelineConfigConverter))] public sealed partial class PipelineConfig { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineConfig(System.Collections.Generic.IReadOnlyCollection processors) + { + Processors = processors; + } +#if NET7_0_OR_GREATER + public PipelineConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PipelineConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PipelineConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the ingest pipeline. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// @@ -43,14 +118,16 @@ public sealed partial class PipelineConfig /// Processors run sequentially in the order specified. /// /// - [JsonInclude, JsonPropertyName("processors")] - public IReadOnlyCollection Processors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Processors { get; set; } /// /// /// Version number used by external systems to track ingest pipelines. /// /// - [JsonInclude, JsonPropertyName("version")] - public long? Version { get; init; } + public long? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineProcessor.g.cs index 294980689cd..807f9d09d75 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineProcessor.g.cs @@ -17,25 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class PipelineProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissingPipeline = System.Text.Json.JsonEncodedText.Encode("ignore_missing_pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissingPipeline = default; + LocalJsonValue propName = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissingPipeline.TryReadProperty(ref reader, options, PropIgnoreMissingPipeline, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissingPipeline = propIgnoreMissingPipeline.Value, + Name = propName.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissingPipeline, value.IgnoreMissingPipeline, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorConverter))] public sealed partial class PipelineProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineProcessor(Elastic.Clients.Elasticsearch.Name name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public PipelineProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PipelineProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,15 +154,13 @@ public sealed partial class PipelineProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -59,7 +168,6 @@ public sealed partial class PipelineProcessor /// Whether to ignore missing pipelines instead of failing. /// /// - [JsonInclude, JsonPropertyName("ignore_missing_pipeline")] public bool? IgnoreMissingPipeline { get; set; } /// @@ -68,16 +176,18 @@ public sealed partial class PipelineProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -85,30 +195,27 @@ public sealed partial class PipelineProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(PipelineProcessor pipelineProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Pipeline(pipelineProcessor); } -public sealed partial class PipelineProcessorDescriptor : SerializableDescriptor> +public readonly partial struct PipelineProcessorDescriptor { - internal PipelineProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor instance) + { + Instance = instance; + } - public PipelineProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingPipelineValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -116,10 +223,32 @@ public PipelineProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public PipelineProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If() { - DescriptionValue = description; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -127,10 +256,10 @@ public PipelineProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public PipelineProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -138,10 +267,10 @@ public PipelineProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public PipelineProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -149,10 +278,10 @@ public PipelineProcessorDescriptor IgnoreFailure(bool? ignoreFailure /// Whether to ignore missing pipelines instead of failing. /// /// - public PipelineProcessorDescriptor IgnoreMissingPipeline(bool? ignoreMissingPipeline = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor IgnoreMissingPipeline(bool? value = true) { - IgnoreMissingPipelineValue = ignoreMissingPipeline; - return Self; + Instance.IgnoreMissingPipeline = value; + return this; } /// @@ -161,10 +290,10 @@ public PipelineProcessorDescriptor IgnoreMissingPipeline(bool? ignore /// Supports template snippets. /// /// - public PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -172,40 +301,38 @@ public PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch /// Handle failures for the processor. /// /// - public PipelineProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public PipelineProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PipelineProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public PipelineProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -214,100 +341,39 @@ public PipelineProcessorDescriptor OnFailure(params Action /// - public PipelineProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingPipelineValue.HasValue) - { - writer.WritePropertyName("ignore_missing_pipeline"); - writer.WriteBooleanValue(IgnoreMissingPipelineValue.Value); - } - - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PipelineProcessorDescriptor : SerializableDescriptor +public readonly partial struct PipelineProcessorDescriptor { - internal PipelineProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor Instance { get; init; } - public PipelineProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingPipelineValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PipelineProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -315,10 +381,32 @@ public PipelineProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public PipelineProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If() { - DescriptionValue = description; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -326,10 +414,10 @@ public PipelineProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public PipelineProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -337,10 +425,10 @@ public PipelineProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public PipelineProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -348,10 +436,10 @@ public PipelineProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Whether to ignore missing pipelines instead of failing. /// /// - public PipelineProcessorDescriptor IgnoreMissingPipeline(bool? ignoreMissingPipeline = true) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor IgnoreMissingPipeline(bool? value = true) { - IgnoreMissingPipelineValue = ignoreMissingPipeline; - return Self; + Instance.IgnoreMissingPipeline = value; + return this; } /// @@ -360,10 +448,10 @@ public PipelineProcessorDescriptor IgnoreMissingPipeline(bool? ignoreMissingPipe /// Supports template snippets. /// /// - public PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -371,40 +459,55 @@ public PipelineProcessorDescriptor Name(Elastic.Clients.Elasticsearch.Name name) /// Handle failures for the processor. /// /// - public PipelineProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public PipelineProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public PipelineProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public PipelineProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -413,78 +516,17 @@ public PipelineProcessorDescriptor OnFailure(params Action /// - public PipelineProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingPipelineValue.HasValue) - { - writer.WritePropertyName("ignore_missing_pipeline"); - writer.WriteBooleanValue(IgnoreMissingPipelineValue.Value); - } - - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineSimulation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineSimulation.g.cs index 5b3cad876d6..85983254eea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineSimulation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/PipelineSimulation.g.cs @@ -17,30 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class PipelineSimulationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoredError = System.Text.Json.JsonEncodedText.Encode("ignored_error"); + private static readonly System.Text.Json.JsonEncodedText PropProcessorType = System.Text.Json.JsonEncodedText.Encode("processor_type"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.PipelineSimulation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propDoc = default; + LocalJsonValue propError = default; + LocalJsonValue propIgnoredError = default; + LocalJsonValue propProcessorType = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propIgnoredError.TryReadProperty(ref reader, options, PropIgnoredError, null)) + { + continue; + } + + if (propProcessorType.TryReadProperty(ref reader, options, PropProcessorType, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.PipelineSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Doc = propDoc.Value, + Error = propError.Value, + IgnoredError = propIgnoredError.Value, + ProcessorType = propProcessorType.Value, + Status = propStatus.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.PipelineSimulation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropIgnoredError, value.IgnoredError, null, null); + writer.WriteProperty(options, PropProcessorType, value.ProcessorType, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.PipelineSimulationConverter))] public sealed partial class PipelineSimulation { - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("doc")] - public Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation? Doc { get; init; } - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("ignored_error")] - public Elastic.Clients.Elasticsearch.ErrorCause? IgnoredError { get; init; } - [JsonInclude, JsonPropertyName("processor_type")] - public string? ProcessorType { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions? Status { get; init; } - [JsonInclude, JsonPropertyName("tag")] - public string? Tag { get; init; } +#if NET7_0_OR_GREATER + public PipelineSimulation() + { + } +#endif +#if !NET7_0_OR_GREATER + public PipelineSimulation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PipelineSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Description { get; set; } + public Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation? Doc { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? IgnoredError { get; set; } + public string? ProcessorType { get; set; } + public Elastic.Clients.Elasticsearch.Watcher.ActionStatusOptions? Status { get; set; } + public string? Tag { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Processor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Processor.g.cs index b7020c13d1a..d56a4a112e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Processor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Processor.g.cs @@ -17,871 +17,3940 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -[JsonConverter(typeof(ProcessorConverter))] -public sealed partial class Processor -{ - internal Processor(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Processor Append(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor appendProcessor) => new Processor("append", appendProcessor); - public static Processor Attachment(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor attachmentProcessor) => new Processor("attachment", attachmentProcessor); - public static Processor Bytes(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor bytesProcessor) => new Processor("bytes", bytesProcessor); - public static Processor Circle(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor circleProcessor) => new Processor("circle", circleProcessor); - public static Processor CommunityId(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor communityIDProcessor) => new Processor("community_id", communityIDProcessor); - public static Processor Convert(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor convertProcessor) => new Processor("convert", convertProcessor); - public static Processor Csv(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor csvProcessor) => new Processor("csv", csvProcessor); - public static Processor Date(Elastic.Clients.Elasticsearch.Ingest.DateProcessor dateProcessor) => new Processor("date", dateProcessor); - public static Processor DateIndexName(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor dateIndexNameProcessor) => new Processor("date_index_name", dateIndexNameProcessor); - public static Processor Dissect(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor dissectProcessor) => new Processor("dissect", dissectProcessor); - public static Processor DotExpander(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor dotExpanderProcessor) => new Processor("dot_expander", dotExpanderProcessor); - public static Processor Drop(Elastic.Clients.Elasticsearch.Ingest.DropProcessor dropProcessor) => new Processor("drop", dropProcessor); - public static Processor Enrich(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor enrichProcessor) => new Processor("enrich", enrichProcessor); - public static Processor Fail(Elastic.Clients.Elasticsearch.Ingest.FailProcessor failProcessor) => new Processor("fail", failProcessor); - public static Processor Fingerprint(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor fingerprintProcessor) => new Processor("fingerprint", fingerprintProcessor); - public static Processor Foreach(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor foreachProcessor) => new Processor("foreach", foreachProcessor); - public static Processor GeoGrid(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor geoGridProcessor) => new Processor("geo_grid", geoGridProcessor); - public static Processor Geoip(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor geoIpProcessor) => new Processor("geoip", geoIpProcessor); - public static Processor Grok(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor grokProcessor) => new Processor("grok", grokProcessor); - public static Processor Gsub(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor gsubProcessor) => new Processor("gsub", gsubProcessor); - public static Processor HtmlStrip(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor htmlStripProcessor) => new Processor("html_strip", htmlStripProcessor); - public static Processor Inference(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor inferenceProcessor) => new Processor("inference", inferenceProcessor); - public static Processor IpLocation(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor ipLocationProcessor) => new Processor("ip_location", ipLocationProcessor); - public static Processor Join(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor joinProcessor) => new Processor("join", joinProcessor); - public static Processor Json(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor jsonProcessor) => new Processor("json", jsonProcessor); - public static Processor Kv(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor keyValueProcessor) => new Processor("kv", keyValueProcessor); - public static Processor Lowercase(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor lowercaseProcessor) => new Processor("lowercase", lowercaseProcessor); - public static Processor NetworkDirection(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor networkDirectionProcessor) => new Processor("network_direction", networkDirectionProcessor); - public static Processor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor pipelineProcessor) => new Processor("pipeline", pipelineProcessor); - public static Processor Redact(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor redactProcessor) => new Processor("redact", redactProcessor); - public static Processor RegisteredDomain(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor registeredDomainProcessor) => new Processor("registered_domain", registeredDomainProcessor); - public static Processor Remove(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor removeProcessor) => new Processor("remove", removeProcessor); - public static Processor Rename(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor renameProcessor) => new Processor("rename", renameProcessor); - public static Processor Reroute(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor rerouteProcessor) => new Processor("reroute", rerouteProcessor); - public static Processor Script(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor scriptProcessor) => new Processor("script", scriptProcessor); - public static Processor Set(Elastic.Clients.Elasticsearch.Ingest.SetProcessor setProcessor) => new Processor("set", setProcessor); - public static Processor SetSecurityUser(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor setSecurityUserProcessor) => new Processor("set_security_user", setSecurityUserProcessor); - public static Processor Sort(Elastic.Clients.Elasticsearch.Ingest.SortProcessor sortProcessor) => new Processor("sort", sortProcessor); - public static Processor Split(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor splitProcessor) => new Processor("split", splitProcessor); - public static Processor Terminate(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor terminateProcessor) => new Processor("terminate", terminateProcessor); - public static Processor Trim(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor trimProcessor) => new Processor("trim", trimProcessor); - public static Processor Uppercase(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor uppercaseProcessor) => new Processor("uppercase", uppercaseProcessor); - public static Processor UriParts(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor uriPartsProcessor) => new Processor("uri_parts", uriPartsProcessor); - public static Processor UrlDecode(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor urlDecodeProcessor) => new Processor("urldecode", urlDecodeProcessor); - public static Processor UserAgent(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor userAgentProcessor) => new Processor("user_agent", userAgentProcessor); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class ProcessorConverter : JsonConverter +internal sealed partial class ProcessorConverter : System.Text.Json.Serialization.JsonConverter { - public override Processor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText VariantAppend = System.Text.Json.JsonEncodedText.Encode("append"); + private static readonly System.Text.Json.JsonEncodedText VariantAttachment = System.Text.Json.JsonEncodedText.Encode("attachment"); + private static readonly System.Text.Json.JsonEncodedText VariantBytes = System.Text.Json.JsonEncodedText.Encode("bytes"); + private static readonly System.Text.Json.JsonEncodedText VariantCircle = System.Text.Json.JsonEncodedText.Encode("circle"); + private static readonly System.Text.Json.JsonEncodedText VariantCommunityId = System.Text.Json.JsonEncodedText.Encode("community_id"); + private static readonly System.Text.Json.JsonEncodedText VariantConvert = System.Text.Json.JsonEncodedText.Encode("convert"); + private static readonly System.Text.Json.JsonEncodedText VariantCsv = System.Text.Json.JsonEncodedText.Encode("csv"); + private static readonly System.Text.Json.JsonEncodedText VariantDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText VariantDateIndexName = System.Text.Json.JsonEncodedText.Encode("date_index_name"); + private static readonly System.Text.Json.JsonEncodedText VariantDissect = System.Text.Json.JsonEncodedText.Encode("dissect"); + private static readonly System.Text.Json.JsonEncodedText VariantDotExpander = System.Text.Json.JsonEncodedText.Encode("dot_expander"); + private static readonly System.Text.Json.JsonEncodedText VariantDrop = System.Text.Json.JsonEncodedText.Encode("drop"); + private static readonly System.Text.Json.JsonEncodedText VariantEnrich = System.Text.Json.JsonEncodedText.Encode("enrich"); + private static readonly System.Text.Json.JsonEncodedText VariantFail = System.Text.Json.JsonEncodedText.Encode("fail"); + private static readonly System.Text.Json.JsonEncodedText VariantFingerprint = System.Text.Json.JsonEncodedText.Encode("fingerprint"); + private static readonly System.Text.Json.JsonEncodedText VariantForeach = System.Text.Json.JsonEncodedText.Encode("foreach"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoGrid = System.Text.Json.JsonEncodedText.Encode("geo_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoip = System.Text.Json.JsonEncodedText.Encode("geoip"); + private static readonly System.Text.Json.JsonEncodedText VariantGrok = System.Text.Json.JsonEncodedText.Encode("grok"); + private static readonly System.Text.Json.JsonEncodedText VariantGsub = System.Text.Json.JsonEncodedText.Encode("gsub"); + private static readonly System.Text.Json.JsonEncodedText VariantHtmlStrip = System.Text.Json.JsonEncodedText.Encode("html_strip"); + private static readonly System.Text.Json.JsonEncodedText VariantInference = System.Text.Json.JsonEncodedText.Encode("inference"); + private static readonly System.Text.Json.JsonEncodedText VariantIpLocation = System.Text.Json.JsonEncodedText.Encode("ip_location"); + private static readonly System.Text.Json.JsonEncodedText VariantJoin = System.Text.Json.JsonEncodedText.Encode("join"); + private static readonly System.Text.Json.JsonEncodedText VariantJson = System.Text.Json.JsonEncodedText.Encode("json"); + private static readonly System.Text.Json.JsonEncodedText VariantKv = System.Text.Json.JsonEncodedText.Encode("kv"); + private static readonly System.Text.Json.JsonEncodedText VariantLowercase = System.Text.Json.JsonEncodedText.Encode("lowercase"); + private static readonly System.Text.Json.JsonEncodedText VariantNetworkDirection = System.Text.Json.JsonEncodedText.Encode("network_direction"); + private static readonly System.Text.Json.JsonEncodedText VariantPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText VariantRedact = System.Text.Json.JsonEncodedText.Encode("redact"); + private static readonly System.Text.Json.JsonEncodedText VariantRegisteredDomain = System.Text.Json.JsonEncodedText.Encode("registered_domain"); + private static readonly System.Text.Json.JsonEncodedText VariantRemove = System.Text.Json.JsonEncodedText.Encode("remove"); + private static readonly System.Text.Json.JsonEncodedText VariantRename = System.Text.Json.JsonEncodedText.Encode("rename"); + private static readonly System.Text.Json.JsonEncodedText VariantReroute = System.Text.Json.JsonEncodedText.Encode("reroute"); + private static readonly System.Text.Json.JsonEncodedText VariantScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText VariantSet = System.Text.Json.JsonEncodedText.Encode("set"); + private static readonly System.Text.Json.JsonEncodedText VariantSetSecurityUser = System.Text.Json.JsonEncodedText.Encode("set_security_user"); + private static readonly System.Text.Json.JsonEncodedText VariantSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText VariantSplit = System.Text.Json.JsonEncodedText.Encode("split"); + private static readonly System.Text.Json.JsonEncodedText VariantTerminate = System.Text.Json.JsonEncodedText.Encode("terminate"); + private static readonly System.Text.Json.JsonEncodedText VariantTrim = System.Text.Json.JsonEncodedText.Encode("trim"); + private static readonly System.Text.Json.JsonEncodedText VariantUppercase = System.Text.Json.JsonEncodedText.Encode("uppercase"); + private static readonly System.Text.Json.JsonEncodedText VariantUriParts = System.Text.Json.JsonEncodedText.Encode("uri_parts"); + private static readonly System.Text.Json.JsonEncodedText VariantUrlDecode = System.Text.Json.JsonEncodedText.Encode("urldecode"); + private static readonly System.Text.Json.JsonEncodedText VariantUserAgent = System.Text.Json.JsonEncodedText.Encode("user_agent"); + + public override Elastic.Clients.Elasticsearch.Ingest.Processor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAppend)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAppend.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "append") + if (reader.ValueTextEquals(VariantAttachment)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAttachment.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "attachment") + if (reader.ValueTextEquals(VariantBytes)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBytes.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bytes") + if (reader.ValueTextEquals(VariantCircle)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCircle.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "circle") + if (reader.ValueTextEquals(VariantCommunityId)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCommunityId.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "community_id") + if (reader.ValueTextEquals(VariantConvert)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantConvert.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "convert") + if (reader.ValueTextEquals(VariantCsv)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantCsv.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "csv") + if (reader.ValueTextEquals(VariantDate)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDate.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "date") + if (reader.ValueTextEquals(VariantDateIndexName)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDateIndexName.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "date_index_name") + if (reader.ValueTextEquals(VariantDissect)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDissect.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "dissect") + if (reader.ValueTextEquals(VariantDotExpander)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDotExpander.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "dot_expander") + if (reader.ValueTextEquals(VariantDrop)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDrop.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "drop") + if (reader.ValueTextEquals(VariantEnrich)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantEnrich.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "enrich") + if (reader.ValueTextEquals(VariantFail)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFail.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fail") + if (reader.ValueTextEquals(VariantFingerprint)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFingerprint.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fingerprint") + if (reader.ValueTextEquals(VariantForeach)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantForeach.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "foreach") + if (reader.ValueTextEquals(VariantGeoGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_grid") + if (reader.ValueTextEquals(VariantGeoip)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoip.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geoip") + if (reader.ValueTextEquals(VariantGrok)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGrok.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "grok") + if (reader.ValueTextEquals(VariantGsub)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGsub.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "gsub") + if (reader.ValueTextEquals(VariantHtmlStrip)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantHtmlStrip.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "html_strip") + if (reader.ValueTextEquals(VariantInference)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantInference.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "inference") + if (reader.ValueTextEquals(VariantIpLocation)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIpLocation.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ip_location") + if (reader.ValueTextEquals(VariantJoin)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantJoin.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "join") + if (reader.ValueTextEquals(VariantJson)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantJson.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "json") + if (reader.ValueTextEquals(VariantKv)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantKv.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "kv") + if (reader.ValueTextEquals(VariantLowercase)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLowercase.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "lowercase") + if (reader.ValueTextEquals(VariantNetworkDirection)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNetworkDirection.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "network_direction") + if (reader.ValueTextEquals(VariantPipeline)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPipeline.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "pipeline") + if (reader.ValueTextEquals(VariantRedact)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRedact.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "redact") + if (reader.ValueTextEquals(VariantRegisteredDomain)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegisteredDomain.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "registered_domain") + if (reader.ValueTextEquals(VariantRemove)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRemove.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "remove") + if (reader.ValueTextEquals(VariantRename)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRename.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rename") + if (reader.ValueTextEquals(VariantReroute)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantReroute.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "reroute") + if (reader.ValueTextEquals(VariantScript)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScript.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "script") + if (reader.ValueTextEquals(VariantSet)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSet.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "set") + if (reader.ValueTextEquals(VariantSetSecurityUser)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSetSecurityUser.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "set_security_user") + if (reader.ValueTextEquals(VariantSort)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSort.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "sort") + if (reader.ValueTextEquals(VariantSplit)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSplit.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "split") + if (reader.ValueTextEquals(VariantTerminate)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerminate.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terminate") + if (reader.ValueTextEquals(VariantTrim)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTrim.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "trim") + if (reader.ValueTextEquals(VariantUppercase)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantUppercase.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "uppercase") + if (reader.ValueTextEquals(VariantUriParts)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantUriParts.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "uri_parts") + if (reader.ValueTextEquals(VariantUrlDecode)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantUrlDecode.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "urldecode") + if (reader.ValueTextEquals(VariantUserAgent)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantUserAgent.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "user_agent") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Processor' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Processor(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Processor value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Processor value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "append": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.AppendProcessor)value.Variant, options); - break; - case "attachment": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor)value.Variant, options); - break; - case "bytes": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.BytesProcessor)value.Variant, options); - break; - case "circle": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.CircleProcessor)value.Variant, options); - break; - case "community_id": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor)value.Variant, options); - break; - case "convert": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor)value.Variant, options); - break; - case "csv": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.CsvProcessor)value.Variant, options); - break; - case "date": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.DateProcessor)value.Variant, options); - break; - case "date_index_name": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor)value.Variant, options); - break; - case "dissect": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.DissectProcessor)value.Variant, options); - break; - case "dot_expander": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor)value.Variant, options); - break; - case "drop": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.DropProcessor)value.Variant, options); - break; - case "enrich": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor)value.Variant, options); - break; - case "fail": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.FailProcessor)value.Variant, options); - break; - case "fingerprint": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor)value.Variant, options); - break; - case "foreach": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor)value.Variant, options); - break; - case "geo_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor)value.Variant, options); - break; - case "geoip": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor)value.Variant, options); - break; - case "grok": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.GrokProcessor)value.Variant, options); - break; - case "gsub": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.GsubProcessor)value.Variant, options); - break; - case "html_strip": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor)value.Variant, options); - break; - case "inference": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor)value.Variant, options); - break; - case "ip_location": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor)value.Variant, options); - break; - case "join": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.JoinProcessor)value.Variant, options); - break; - case "json": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.JsonProcessor)value.Variant, options); - break; - case "kv": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor)value.Variant, options); - break; - case "lowercase": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor)value.Variant, options); - break; - case "network_direction": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor)value.Variant, options); - break; - case "pipeline": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor)value.Variant, options); - break; - case "redact": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.RedactProcessor)value.Variant, options); - break; - case "registered_domain": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor)value.Variant, options); - break; - case "remove": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor)value.Variant, options); - break; - case "rename": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.RenameProcessor)value.Variant, options); - break; - case "reroute": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor)value.Variant, options); - break; - case "script": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor)value.Variant, options); - break; - case "set": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.SetProcessor)value.Variant, options); - break; - case "set_security_user": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor)value.Variant, options); - break; - case "sort": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.SortProcessor)value.Variant, options); - break; - case "split": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.SplitProcessor)value.Variant, options); - break; - case "terminate": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor)value.Variant, options); - break; - case "trim": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.TrimProcessor)value.Variant, options); - break; - case "uppercase": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor)value.Variant, options); - break; - case "uri_parts": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor)value.Variant, options); - break; - case "urldecode": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor)value.Variant, options); - break; - case "user_agent": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor)value.Variant, options); - break; - } + case null: + break; + case "append": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.AppendProcessor)value.Variant, null, null); + break; + case "attachment": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor)value.Variant, null, null); + break; + case "bytes": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.BytesProcessor)value.Variant, null, null); + break; + case "circle": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.CircleProcessor)value.Variant, null, null); + break; + case "community_id": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor)value.Variant, null, null); + break; + case "convert": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor)value.Variant, null, null); + break; + case "csv": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.CsvProcessor)value.Variant, null, null); + break; + case "date": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.DateProcessor)value.Variant, null, null); + break; + case "date_index_name": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor)value.Variant, null, null); + break; + case "dissect": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.DissectProcessor)value.Variant, null, null); + break; + case "dot_expander": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor)value.Variant, null, null); + break; + case "drop": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.DropProcessor)value.Variant, null, null); + break; + case "enrich": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor)value.Variant, null, null); + break; + case "fail": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.FailProcessor)value.Variant, null, null); + break; + case "fingerprint": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor)value.Variant, null, null); + break; + case "foreach": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor)value.Variant, null, null); + break; + case "geo_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor)value.Variant, null, null); + break; + case "geoip": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor)value.Variant, null, null); + break; + case "grok": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.GrokProcessor)value.Variant, null, null); + break; + case "gsub": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.GsubProcessor)value.Variant, null, null); + break; + case "html_strip": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor)value.Variant, null, null); + break; + case "inference": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor)value.Variant, null, null); + break; + case "ip_location": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor)value.Variant, null, null); + break; + case "join": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.JoinProcessor)value.Variant, null, null); + break; + case "json": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.JsonProcessor)value.Variant, null, null); + break; + case "kv": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor)value.Variant, null, null); + break; + case "lowercase": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor)value.Variant, null, null); + break; + case "network_direction": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor)value.Variant, null, null); + break; + case "pipeline": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor)value.Variant, null, null); + break; + case "redact": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.RedactProcessor)value.Variant, null, null); + break; + case "registered_domain": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor)value.Variant, null, null); + break; + case "remove": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor)value.Variant, null, null); + break; + case "rename": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.RenameProcessor)value.Variant, null, null); + break; + case "reroute": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor)value.Variant, null, null); + break; + case "script": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor)value.Variant, null, null); + break; + case "set": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.SetProcessor)value.Variant, null, null); + break; + case "set_security_user": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor)value.Variant, null, null); + break; + case "sort": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.SortProcessor)value.Variant, null, null); + break; + case "split": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.SplitProcessor)value.Variant, null, null); + break; + case "terminate": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor)value.Variant, null, null); + break; + case "trim": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.TrimProcessor)value.Variant, null, null); + break; + case "uppercase": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor)value.Variant, null, null); + break; + case "uri_parts": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor)value.Variant, null, null); + break; + case "urldecode": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor)value.Variant, null, null); + break; + case "user_agent": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Ingest.Processor)}'."); } writer.WriteEndObject(); } } -public sealed partial class ProcessorDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ProcessorConverter))] +public sealed partial class Processor { - internal ProcessorDescriptor(Action> configure) => configure.Invoke(this); - - public ProcessorDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private ProcessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private ProcessorDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public ProcessorDescriptor Append(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor appendProcessor) => Set(appendProcessor, "append"); - public ProcessorDescriptor Append(Action> configure) => Set(configure, "append"); - public ProcessorDescriptor Attachment(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor attachmentProcessor) => Set(attachmentProcessor, "attachment"); - public ProcessorDescriptor Attachment(Action> configure) => Set(configure, "attachment"); - public ProcessorDescriptor Bytes(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor bytesProcessor) => Set(bytesProcessor, "bytes"); - public ProcessorDescriptor Bytes(Action> configure) => Set(configure, "bytes"); - public ProcessorDescriptor Circle(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor circleProcessor) => Set(circleProcessor, "circle"); - public ProcessorDescriptor Circle(Action> configure) => Set(configure, "circle"); - public ProcessorDescriptor CommunityId(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor communityIDProcessor) => Set(communityIDProcessor, "community_id"); - public ProcessorDescriptor CommunityId(Action> configure) => Set(configure, "community_id"); - public ProcessorDescriptor Convert(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor convertProcessor) => Set(convertProcessor, "convert"); - public ProcessorDescriptor Convert(Action> configure) => Set(configure, "convert"); - public ProcessorDescriptor Csv(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor csvProcessor) => Set(csvProcessor, "csv"); - public ProcessorDescriptor Csv(Action> configure) => Set(configure, "csv"); - public ProcessorDescriptor Date(Elastic.Clients.Elasticsearch.Ingest.DateProcessor dateProcessor) => Set(dateProcessor, "date"); - public ProcessorDescriptor Date(Action> configure) => Set(configure, "date"); - public ProcessorDescriptor DateIndexName(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor dateIndexNameProcessor) => Set(dateIndexNameProcessor, "date_index_name"); - public ProcessorDescriptor DateIndexName(Action> configure) => Set(configure, "date_index_name"); - public ProcessorDescriptor Dissect(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor dissectProcessor) => Set(dissectProcessor, "dissect"); - public ProcessorDescriptor Dissect(Action> configure) => Set(configure, "dissect"); - public ProcessorDescriptor DotExpander(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor dotExpanderProcessor) => Set(dotExpanderProcessor, "dot_expander"); - public ProcessorDescriptor DotExpander(Action> configure) => Set(configure, "dot_expander"); - public ProcessorDescriptor Drop(Elastic.Clients.Elasticsearch.Ingest.DropProcessor dropProcessor) => Set(dropProcessor, "drop"); - public ProcessorDescriptor Drop(Action> configure) => Set(configure, "drop"); - public ProcessorDescriptor Enrich(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor enrichProcessor) => Set(enrichProcessor, "enrich"); - public ProcessorDescriptor Enrich(Action> configure) => Set(configure, "enrich"); - public ProcessorDescriptor Fail(Elastic.Clients.Elasticsearch.Ingest.FailProcessor failProcessor) => Set(failProcessor, "fail"); - public ProcessorDescriptor Fail(Action> configure) => Set(configure, "fail"); - public ProcessorDescriptor Fingerprint(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor fingerprintProcessor) => Set(fingerprintProcessor, "fingerprint"); - public ProcessorDescriptor Fingerprint(Action> configure) => Set(configure, "fingerprint"); - public ProcessorDescriptor Foreach(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor foreachProcessor) => Set(foreachProcessor, "foreach"); - public ProcessorDescriptor Foreach(Action> configure) => Set(configure, "foreach"); - public ProcessorDescriptor GeoGrid(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor geoGridProcessor) => Set(geoGridProcessor, "geo_grid"); - public ProcessorDescriptor GeoGrid(Action> configure) => Set(configure, "geo_grid"); - public ProcessorDescriptor Geoip(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor geoIpProcessor) => Set(geoIpProcessor, "geoip"); - public ProcessorDescriptor Geoip(Action> configure) => Set(configure, "geoip"); - public ProcessorDescriptor Grok(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor grokProcessor) => Set(grokProcessor, "grok"); - public ProcessorDescriptor Grok(Action> configure) => Set(configure, "grok"); - public ProcessorDescriptor Gsub(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor gsubProcessor) => Set(gsubProcessor, "gsub"); - public ProcessorDescriptor Gsub(Action> configure) => Set(configure, "gsub"); - public ProcessorDescriptor HtmlStrip(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor htmlStripProcessor) => Set(htmlStripProcessor, "html_strip"); - public ProcessorDescriptor HtmlStrip(Action> configure) => Set(configure, "html_strip"); - public ProcessorDescriptor Inference(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor inferenceProcessor) => Set(inferenceProcessor, "inference"); - public ProcessorDescriptor Inference(Action> configure) => Set(configure, "inference"); - public ProcessorDescriptor IpLocation(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor ipLocationProcessor) => Set(ipLocationProcessor, "ip_location"); - public ProcessorDescriptor IpLocation(Action> configure) => Set(configure, "ip_location"); - public ProcessorDescriptor Join(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor joinProcessor) => Set(joinProcessor, "join"); - public ProcessorDescriptor Join(Action> configure) => Set(configure, "join"); - public ProcessorDescriptor Json(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor jsonProcessor) => Set(jsonProcessor, "json"); - public ProcessorDescriptor Json(Action> configure) => Set(configure, "json"); - public ProcessorDescriptor Kv(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor keyValueProcessor) => Set(keyValueProcessor, "kv"); - public ProcessorDescriptor Kv(Action> configure) => Set(configure, "kv"); - public ProcessorDescriptor Lowercase(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor lowercaseProcessor) => Set(lowercaseProcessor, "lowercase"); - public ProcessorDescriptor Lowercase(Action> configure) => Set(configure, "lowercase"); - public ProcessorDescriptor NetworkDirection(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor networkDirectionProcessor) => Set(networkDirectionProcessor, "network_direction"); - public ProcessorDescriptor NetworkDirection(Action> configure) => Set(configure, "network_direction"); - public ProcessorDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor pipelineProcessor) => Set(pipelineProcessor, "pipeline"); - public ProcessorDescriptor Pipeline(Action> configure) => Set(configure, "pipeline"); - public ProcessorDescriptor Redact(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor redactProcessor) => Set(redactProcessor, "redact"); - public ProcessorDescriptor Redact(Action> configure) => Set(configure, "redact"); - public ProcessorDescriptor RegisteredDomain(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor registeredDomainProcessor) => Set(registeredDomainProcessor, "registered_domain"); - public ProcessorDescriptor RegisteredDomain(Action> configure) => Set(configure, "registered_domain"); - public ProcessorDescriptor Remove(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor removeProcessor) => Set(removeProcessor, "remove"); - public ProcessorDescriptor Remove(Action> configure) => Set(configure, "remove"); - public ProcessorDescriptor Rename(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor renameProcessor) => Set(renameProcessor, "rename"); - public ProcessorDescriptor Rename(Action> configure) => Set(configure, "rename"); - public ProcessorDescriptor Reroute(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor rerouteProcessor) => Set(rerouteProcessor, "reroute"); - public ProcessorDescriptor Reroute(Action> configure) => Set(configure, "reroute"); - public ProcessorDescriptor Script(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor scriptProcessor) => Set(scriptProcessor, "script"); - public ProcessorDescriptor Script(Action> configure) => Set(configure, "script"); - public ProcessorDescriptor Set(Elastic.Clients.Elasticsearch.Ingest.SetProcessor setProcessor) => Set(setProcessor, "set"); - public ProcessorDescriptor Set(Action> configure) => Set(configure, "set"); - public ProcessorDescriptor SetSecurityUser(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor setSecurityUserProcessor) => Set(setSecurityUserProcessor, "set_security_user"); - public ProcessorDescriptor SetSecurityUser(Action> configure) => Set(configure, "set_security_user"); - public ProcessorDescriptor Sort(Elastic.Clients.Elasticsearch.Ingest.SortProcessor sortProcessor) => Set(sortProcessor, "sort"); - public ProcessorDescriptor Sort(Action> configure) => Set(configure, "sort"); - public ProcessorDescriptor Split(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor splitProcessor) => Set(splitProcessor, "split"); - public ProcessorDescriptor Split(Action> configure) => Set(configure, "split"); - public ProcessorDescriptor Terminate(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor terminateProcessor) => Set(terminateProcessor, "terminate"); - public ProcessorDescriptor Terminate(Action> configure) => Set(configure, "terminate"); - public ProcessorDescriptor Trim(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor trimProcessor) => Set(trimProcessor, "trim"); - public ProcessorDescriptor Trim(Action> configure) => Set(configure, "trim"); - public ProcessorDescriptor Uppercase(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor uppercaseProcessor) => Set(uppercaseProcessor, "uppercase"); - public ProcessorDescriptor Uppercase(Action> configure) => Set(configure, "uppercase"); - public ProcessorDescriptor UriParts(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor uriPartsProcessor) => Set(uriPartsProcessor, "uri_parts"); - public ProcessorDescriptor UriParts(Action> configure) => Set(configure, "uri_parts"); - public ProcessorDescriptor UrlDecode(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor urlDecodeProcessor) => Set(urlDecodeProcessor, "urldecode"); - public ProcessorDescriptor UrlDecode(Action> configure) => Set(configure, "urldecode"); - public ProcessorDescriptor UserAgent(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor userAgentProcessor) => Set(userAgentProcessor, "user_agent"); - public ProcessorDescriptor UserAgent(Action> configure) => Set(configure, "user_agent"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Processor() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + } +#endif +#if !NET7_0_OR_GREATER + public Processor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AppendProcessor? Append { get => GetVariant("append"); set => SetVariant("append", value); } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor? Attachment { get => GetVariant("attachment"); set => SetVariant("attachment", value); } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.BytesProcessor? Bytes { get => GetVariant("bytes"); set => SetVariant("bytes", value); } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CircleProcessor? Circle { get => GetVariant("circle"); set => SetVariant("circle", value); } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor? CommunityId { get => GetVariant("community_id"); set => SetVariant("community_id", value); } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor? Convert { get => GetVariant("convert"); set => SetVariant("convert", value); } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.CsvProcessor? Csv { get => GetVariant("csv"); set => SetVariant("csv", value); } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateProcessor? Date { get => GetVariant("date"); set => SetVariant("date", value); } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor? DateIndexName { get => GetVariant("date_index_name"); set => SetVariant("date_index_name", value); } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DissectProcessor? Dissect { get => GetVariant("dissect"); set => SetVariant("dissect", value); } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor? DotExpander { get => GetVariant("dot_expander"); set => SetVariant("dot_expander", value); } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.DropProcessor? Drop { get => GetVariant("drop"); set => SetVariant("drop", value); } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor? Enrich { get => GetVariant("enrich"); set => SetVariant("enrich", value); } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FailProcessor? Fail { get => GetVariant("fail"); set => SetVariant("fail", value); } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor? Fingerprint { get => GetVariant("fingerprint"); set => SetVariant("fingerprint", value); } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor? Foreach { get => GetVariant("foreach"); set => SetVariant("foreach", value); } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor? GeoGrid { get => GetVariant("geo_grid"); set => SetVariant("geo_grid", value); } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor? Geoip { get => GetVariant("geoip"); set => SetVariant("geoip", value); } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GrokProcessor? Grok { get => GetVariant("grok"); set => SetVariant("grok", value); } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.GsubProcessor? Gsub { get => GetVariant("gsub"); set => SetVariant("gsub", value); } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor? HtmlStrip { get => GetVariant("html_strip"); set => SetVariant("html_strip", value); } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor? Inference { get => GetVariant("inference"); set => SetVariant("inference", value); } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor? IpLocation { get => GetVariant("ip_location"); set => SetVariant("ip_location", value); } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JoinProcessor? Join { get => GetVariant("join"); set => SetVariant("join", value); } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.JsonProcessor? Json { get => GetVariant("json"); set => SetVariant("json", value); } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor? Kv { get => GetVariant("kv"); set => SetVariant("kv", value); } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor? Lowercase { get => GetVariant("lowercase"); set => SetVariant("lowercase", value); } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor? NetworkDirection { get => GetVariant("network_direction"); set => SetVariant("network_direction", value); } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor? Pipeline { get => GetVariant("pipeline"); set => SetVariant("pipeline", value); } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessor? Redact { get => GetVariant("redact"); set => SetVariant("redact", value); } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor? RegisteredDomain { get => GetVariant("registered_domain"); set => SetVariant("registered_domain", value); } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor? Remove { get => GetVariant("remove"); set => SetVariant("remove", value); } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessor? Rename { get => GetVariant("rename"); set => SetVariant("rename", value); } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor? Reroute { get => GetVariant("reroute"); set => SetVariant("reroute", value); } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor? Script { get => GetVariant("script"); set => SetVariant("script", value); } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessor? Set { get => GetVariant("set"); set => SetVariant("set", value); } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor? SetSecurityUser { get => GetVariant("set_security_user"); set => SetVariant("set_security_user", value); } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessor? Sort { get => GetVariant("sort"); set => SetVariant("sort", value); } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessor? Split { get => GetVariant("split"); set => SetVariant("split", value); } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor? Terminate { get => GetVariant("terminate"); set => SetVariant("terminate", value); } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessor? Trim { get => GetVariant("trim"); set => SetVariant("trim", value); } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor? Uppercase { get => GetVariant("uppercase"); set => SetVariant("uppercase", value); } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor? UriParts { get => GetVariant("uri_parts"); set => SetVariant("uri_parts", value); } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor? UrlDecode { get => GetVariant("urldecode"); set => SetVariant("urldecode", value); } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor? UserAgent { get => GetVariant("user_agent"); set => SetVariant("user_agent", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Append = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Attachment = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Bytes = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Circle = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { CommunityId = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Convert = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Csv = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.DateProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Date = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { DateIndexName = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Dissect = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { DotExpander = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.DropProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Drop = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Enrich = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.FailProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Fail = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Fingerprint = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Foreach = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { GeoGrid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Geoip = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Grok = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Gsub = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { HtmlStrip = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Inference = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { IpLocation = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Join = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Json = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Kv = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Lowercase = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { NetworkDirection = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Pipeline = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Redact = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { RegisteredDomain = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Remove = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Rename = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Reroute = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Script = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.SetProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Set = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { SetSecurityUser = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.SortProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Sort = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Split = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Terminate = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Trim = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { Uppercase = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { UriParts = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { UrlDecode = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor value) => new Elastic.Clients.Elasticsearch.Ingest.Processor { UserAgent = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class ProcessorDescriptor : SerializableDescriptor +public readonly partial struct ProcessorDescriptor { - internal ProcessorDescriptor(Action configure) => configure.Invoke(this); - - public ProcessorDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private ProcessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private ProcessorDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public ProcessorDescriptor Append(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor appendProcessor) => Set(appendProcessor, "append"); - public ProcessorDescriptor Append(Action configure) => Set(configure, "append"); - public ProcessorDescriptor Attachment(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor attachmentProcessor) => Set(attachmentProcessor, "attachment"); - public ProcessorDescriptor Attachment(Action configure) => Set(configure, "attachment"); - public ProcessorDescriptor Bytes(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor bytesProcessor) => Set(bytesProcessor, "bytes"); - public ProcessorDescriptor Bytes(Action configure) => Set(configure, "bytes"); - public ProcessorDescriptor Circle(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor circleProcessor) => Set(circleProcessor, "circle"); - public ProcessorDescriptor Circle(Action configure) => Set(configure, "circle"); - public ProcessorDescriptor CommunityId(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor communityIDProcessor) => Set(communityIDProcessor, "community_id"); - public ProcessorDescriptor CommunityId(Action configure) => Set(configure, "community_id"); - public ProcessorDescriptor Convert(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor convertProcessor) => Set(convertProcessor, "convert"); - public ProcessorDescriptor Convert(Action configure) => Set(configure, "convert"); - public ProcessorDescriptor Csv(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor csvProcessor) => Set(csvProcessor, "csv"); - public ProcessorDescriptor Csv(Action configure) => Set(configure, "csv"); - public ProcessorDescriptor Date(Elastic.Clients.Elasticsearch.Ingest.DateProcessor dateProcessor) => Set(dateProcessor, "date"); - public ProcessorDescriptor Date(Action configure) => Set(configure, "date"); - public ProcessorDescriptor DateIndexName(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor dateIndexNameProcessor) => Set(dateIndexNameProcessor, "date_index_name"); - public ProcessorDescriptor DateIndexName(Action configure) => Set(configure, "date_index_name"); - public ProcessorDescriptor Dissect(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor dissectProcessor) => Set(dissectProcessor, "dissect"); - public ProcessorDescriptor Dissect(Action configure) => Set(configure, "dissect"); - public ProcessorDescriptor DotExpander(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor dotExpanderProcessor) => Set(dotExpanderProcessor, "dot_expander"); - public ProcessorDescriptor DotExpander(Action configure) => Set(configure, "dot_expander"); - public ProcessorDescriptor Drop(Elastic.Clients.Elasticsearch.Ingest.DropProcessor dropProcessor) => Set(dropProcessor, "drop"); - public ProcessorDescriptor Drop(Action configure) => Set(configure, "drop"); - public ProcessorDescriptor Enrich(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor enrichProcessor) => Set(enrichProcessor, "enrich"); - public ProcessorDescriptor Enrich(Action configure) => Set(configure, "enrich"); - public ProcessorDescriptor Fail(Elastic.Clients.Elasticsearch.Ingest.FailProcessor failProcessor) => Set(failProcessor, "fail"); - public ProcessorDescriptor Fail(Action configure) => Set(configure, "fail"); - public ProcessorDescriptor Fingerprint(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor fingerprintProcessor) => Set(fingerprintProcessor, "fingerprint"); - public ProcessorDescriptor Fingerprint(Action configure) => Set(configure, "fingerprint"); - public ProcessorDescriptor Foreach(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor foreachProcessor) => Set(foreachProcessor, "foreach"); - public ProcessorDescriptor Foreach(Action configure) => Set(configure, "foreach"); - public ProcessorDescriptor GeoGrid(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor geoGridProcessor) => Set(geoGridProcessor, "geo_grid"); - public ProcessorDescriptor GeoGrid(Action configure) => Set(configure, "geo_grid"); - public ProcessorDescriptor Geoip(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor geoIpProcessor) => Set(geoIpProcessor, "geoip"); - public ProcessorDescriptor Geoip(Action configure) => Set(configure, "geoip"); - public ProcessorDescriptor Grok(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor grokProcessor) => Set(grokProcessor, "grok"); - public ProcessorDescriptor Grok(Action configure) => Set(configure, "grok"); - public ProcessorDescriptor Gsub(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor gsubProcessor) => Set(gsubProcessor, "gsub"); - public ProcessorDescriptor Gsub(Action configure) => Set(configure, "gsub"); - public ProcessorDescriptor HtmlStrip(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor htmlStripProcessor) => Set(htmlStripProcessor, "html_strip"); - public ProcessorDescriptor HtmlStrip(Action configure) => Set(configure, "html_strip"); - public ProcessorDescriptor Inference(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor inferenceProcessor) => Set(inferenceProcessor, "inference"); - public ProcessorDescriptor Inference(Action configure) => Set(configure, "inference"); - public ProcessorDescriptor IpLocation(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor ipLocationProcessor) => Set(ipLocationProcessor, "ip_location"); - public ProcessorDescriptor IpLocation(Action configure) => Set(configure, "ip_location"); - public ProcessorDescriptor Join(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor joinProcessor) => Set(joinProcessor, "join"); - public ProcessorDescriptor Join(Action configure) => Set(configure, "join"); - public ProcessorDescriptor Json(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor jsonProcessor) => Set(jsonProcessor, "json"); - public ProcessorDescriptor Json(Action configure) => Set(configure, "json"); - public ProcessorDescriptor Kv(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor keyValueProcessor) => Set(keyValueProcessor, "kv"); - public ProcessorDescriptor Kv(Action configure) => Set(configure, "kv"); - public ProcessorDescriptor Lowercase(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor lowercaseProcessor) => Set(lowercaseProcessor, "lowercase"); - public ProcessorDescriptor Lowercase(Action configure) => Set(configure, "lowercase"); - public ProcessorDescriptor NetworkDirection(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor networkDirectionProcessor) => Set(networkDirectionProcessor, "network_direction"); - public ProcessorDescriptor NetworkDirection(Action configure) => Set(configure, "network_direction"); - public ProcessorDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor pipelineProcessor) => Set(pipelineProcessor, "pipeline"); - public ProcessorDescriptor Pipeline(Action configure) => Set(configure, "pipeline"); - public ProcessorDescriptor Redact(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor redactProcessor) => Set(redactProcessor, "redact"); - public ProcessorDescriptor Redact(Action configure) => Set(configure, "redact"); - public ProcessorDescriptor RegisteredDomain(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor registeredDomainProcessor) => Set(registeredDomainProcessor, "registered_domain"); - public ProcessorDescriptor RegisteredDomain(Action configure) => Set(configure, "registered_domain"); - public ProcessorDescriptor Remove(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor removeProcessor) => Set(removeProcessor, "remove"); - public ProcessorDescriptor Remove(Action configure) => Set(configure, "remove"); - public ProcessorDescriptor Rename(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor renameProcessor) => Set(renameProcessor, "rename"); - public ProcessorDescriptor Rename(Action configure) => Set(configure, "rename"); - public ProcessorDescriptor Reroute(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor rerouteProcessor) => Set(rerouteProcessor, "reroute"); - public ProcessorDescriptor Reroute(Action configure) => Set(configure, "reroute"); - public ProcessorDescriptor Script(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor scriptProcessor) => Set(scriptProcessor, "script"); - public ProcessorDescriptor Script(Action configure) => Set(configure, "script"); - public ProcessorDescriptor Set(Elastic.Clients.Elasticsearch.Ingest.SetProcessor setProcessor) => Set(setProcessor, "set"); - public ProcessorDescriptor Set(Action configure) => Set(configure, "set"); - public ProcessorDescriptor SetSecurityUser(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor setSecurityUserProcessor) => Set(setSecurityUserProcessor, "set_security_user"); - public ProcessorDescriptor SetSecurityUser(Action configure) => Set(configure, "set_security_user"); - public ProcessorDescriptor Sort(Elastic.Clients.Elasticsearch.Ingest.SortProcessor sortProcessor) => Set(sortProcessor, "sort"); - public ProcessorDescriptor Sort(Action configure) => Set(configure, "sort"); - public ProcessorDescriptor Split(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor splitProcessor) => Set(splitProcessor, "split"); - public ProcessorDescriptor Split(Action configure) => Set(configure, "split"); - public ProcessorDescriptor Terminate(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor terminateProcessor) => Set(terminateProcessor, "terminate"); - public ProcessorDescriptor Terminate(Action configure) => Set(configure, "terminate"); - public ProcessorDescriptor Trim(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor trimProcessor) => Set(trimProcessor, "trim"); - public ProcessorDescriptor Trim(Action configure) => Set(configure, "trim"); - public ProcessorDescriptor Uppercase(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor uppercaseProcessor) => Set(uppercaseProcessor, "uppercase"); - public ProcessorDescriptor Uppercase(Action configure) => Set(configure, "uppercase"); - public ProcessorDescriptor UriParts(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor uriPartsProcessor) => Set(uriPartsProcessor, "uri_parts"); - public ProcessorDescriptor UriParts(Action configure) => Set(configure, "uri_parts"); - public ProcessorDescriptor UrlDecode(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor urlDecodeProcessor) => Set(urlDecodeProcessor, "urldecode"); - public ProcessorDescriptor UrlDecode(Action configure) => Set(configure, "urldecode"); - public ProcessorDescriptor UserAgent(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor userAgentProcessor) => Set(userAgentProcessor, "user_agent"); - public ProcessorDescriptor UserAgent(Action configure) => Set(configure, "user_agent"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal Elastic.Clients.Elasticsearch.Ingest.Processor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.Processor instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance = instance; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WriteEndObject(); + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.Processor instance) => new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Append(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor? value) + { + Instance.Append = value; + return this; + } + + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Append(System.Action> action) + { + Instance.Append = Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Attachment(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor? value) + { + Instance.Attachment = value; + return this; + } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Attachment(System.Action> action) + { + Instance.Attachment = Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Bytes(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor? value) + { + Instance.Bytes = value; + return this; + } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Bytes(System.Action> action) + { + Instance.Bytes = Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Circle(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor? value) + { + Instance.Circle = value; + return this; + } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Circle(System.Action> action) + { + Instance.Circle = Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor? value) + { + Instance.CommunityId = value; + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId() + { + Instance.CommunityId = Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId(System.Action>? action) + { + Instance.CommunityId = Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Convert(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor? value) + { + Instance.Convert = value; + return this; + } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Convert(System.Action> action) + { + Instance.Convert = Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Csv(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor? value) + { + Instance.Csv = value; + return this; + } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Csv(System.Action> action) + { + Instance.Csv = Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Date(Elastic.Clients.Elasticsearch.Ingest.DateProcessor? value) + { + Instance.Date = value; + return this; + } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Date(System.Action> action) + { + Instance.Date = Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DateIndexName(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor? value) + { + Instance.DateIndexName = value; + return this; + } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DateIndexName(System.Action> action) + { + Instance.DateIndexName = Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Dissect(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor? value) + { + Instance.Dissect = value; + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Dissect(System.Action> action) + { + Instance.Dissect = Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DotExpander(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor? value) + { + Instance.DotExpander = value; + return this; + } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DotExpander(System.Action> action) + { + Instance.DotExpander = Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop(Elastic.Clients.Elasticsearch.Ingest.DropProcessor? value) + { + Instance.Drop = value; + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop() + { + Instance.Drop = Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop(System.Action>? action) + { + Instance.Drop = Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Enrich(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor? value) + { + Instance.Enrich = value; + return this; + } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Enrich(System.Action> action) + { + Instance.Enrich = Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fail(Elastic.Clients.Elasticsearch.Ingest.FailProcessor? value) + { + Instance.Fail = value; + return this; + } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fail(System.Action> action) + { + Instance.Fail = Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fingerprint(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor? value) + { + Instance.Fingerprint = value; + return this; + } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fingerprint(System.Action> action) + { + Instance.Fingerprint = Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Foreach(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor? value) + { + Instance.Foreach = value; + return this; + } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Foreach(System.Action> action) + { + Instance.Foreach = Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor GeoGrid(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor? value) + { + Instance.GeoGrid = value; + return this; + } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor GeoGrid(System.Action> action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Geoip(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor? value) + { + Instance.Geoip = value; + return this; + } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Geoip(System.Action> action) + { + Instance.Geoip = Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Grok(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor? value) + { + Instance.Grok = value; + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Grok(System.Action> action) + { + Instance.Grok = Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Gsub(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor? value) + { + Instance.Gsub = value; + return this; + } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Gsub(System.Action> action) + { + Instance.Gsub = Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor HtmlStrip(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor? value) + { + Instance.HtmlStrip = value; + return this; + } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor HtmlStrip(System.Action> action) + { + Instance.HtmlStrip = Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Inference(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor? value) + { + Instance.Inference = value; + return this; + } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Inference(System.Action> action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor IpLocation(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor? value) + { + Instance.IpLocation = value; + return this; + } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor IpLocation(System.Action> action) + { + Instance.IpLocation = Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Join(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor? value) + { + Instance.Join = value; + return this; + } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Join(System.Action> action) + { + Instance.Join = Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Json(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor? value) + { + Instance.Json = value; + return this; + } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Json(System.Action> action) + { + Instance.Json = Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Kv(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor? value) + { + Instance.Kv = value; + return this; + } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Kv(System.Action> action) + { + Instance.Kv = Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Lowercase(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor? value) + { + Instance.Lowercase = value; + return this; + } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Lowercase(System.Action> action) + { + Instance.Lowercase = Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor? value) + { + Instance.NetworkDirection = value; + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection() + { + Instance.NetworkDirection = Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection(System.Action>? action) + { + Instance.NetworkDirection = Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor? value) + { + Instance.Pipeline = value; + return this; + } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Pipeline(System.Action> action) + { + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Redact(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor? value) + { + Instance.Redact = value; + return this; + } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Redact(System.Action> action) + { + Instance.Redact = Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor RegisteredDomain(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor? value) + { + Instance.RegisteredDomain = value; + return this; + } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor RegisteredDomain(System.Action> action) + { + Instance.RegisteredDomain = Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Remove(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor? value) + { + Instance.Remove = value; + return this; + } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Remove(System.Action> action) + { + Instance.Remove = Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Rename(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor? value) + { + Instance.Rename = value; + return this; + } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Rename(System.Action> action) + { + Instance.Rename = Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor? value) + { + Instance.Reroute = value; + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute() + { + Instance.Reroute = Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute(System.Action>? action) + { + Instance.Reroute = Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script(System.Action>? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Set(Elastic.Clients.Elasticsearch.Ingest.SetProcessor? value) + { + Instance.Set = value; + return this; + } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Set(System.Action> action) + { + Instance.Set = Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor SetSecurityUser(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor? value) + { + Instance.SetSecurityUser = value; + return this; + } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor SetSecurityUser(System.Action> action) + { + Instance.SetSecurityUser = Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Sort(Elastic.Clients.Elasticsearch.Ingest.SortProcessor? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Sort(System.Action> action) + { + Instance.Sort = Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Split(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor? value) + { + Instance.Split = value; + return this; + } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Split(System.Action> action) + { + Instance.Split = Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor? value) + { + Instance.Terminate = value; + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate() + { + Instance.Terminate = Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate(System.Action>? action) + { + Instance.Terminate = Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Trim(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor? value) + { + Instance.Trim = value; + return this; + } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Trim(System.Action> action) + { + Instance.Trim = Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Uppercase(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor? value) + { + Instance.Uppercase = value; + return this; + } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Uppercase(System.Action> action) + { + Instance.Uppercase = Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UriParts(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor? value) + { + Instance.UriParts = value; + return this; + } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UriParts(System.Action> action) + { + Instance.UriParts = Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UrlDecode(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor? value) + { + Instance.UrlDecode = value; + return this; + } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UrlDecode(System.Action> action) + { + Instance.UrlDecode = Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UserAgent(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor? value) + { + Instance.UserAgent = value; + return this; + } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UserAgent(System.Action> action) + { + Instance.UserAgent = Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Processor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct ProcessorDescriptor +{ + internal Elastic.Clients.Elasticsearch.Ingest.Processor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.Processor instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.Processor instance) => new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Append(Elastic.Clients.Elasticsearch.Ingest.AppendProcessor? value) + { + Instance.Append = value; + return this; + } + + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Append(System.Action action) + { + Instance.Append = Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Appends one or more values to an existing array if the field already exists and it is an array. + /// Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. + /// Creates an array containing the provided values if the field doesn’t exist. + /// Accepts a single value or an array of values. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Append(System.Action> action) + { + Instance.Append = Elastic.Clients.Elasticsearch.Ingest.AppendProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Attachment(Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessor? value) + { + Instance.Attachment = value; + return this; + } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Attachment(System.Action action) + { + Instance.Attachment = Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The attachment processor lets Elasticsearch extract file attachments in common formats (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Attachment(System.Action> action) + { + Instance.Attachment = Elastic.Clients.Elasticsearch.Ingest.AttachmentProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Bytes(Elastic.Clients.Elasticsearch.Ingest.BytesProcessor? value) + { + Instance.Bytes = value; + return this; + } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Bytes(System.Action action) + { + Instance.Bytes = Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a human readable byte value (for example 1kb) to its value in bytes (for example 1024). + /// If the field is an array of strings, all members of the array will be converted. + /// Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. + /// An error will occur if the field is not a supported format or resultant value exceeds 2^63. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Bytes(System.Action> action) + { + Instance.Bytes = Elastic.Clients.Elasticsearch.Ingest.BytesProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Circle(Elastic.Clients.Elasticsearch.Ingest.CircleProcessor? value) + { + Instance.Circle = value; + return this; + } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Circle(System.Action action) + { + Instance.Circle = Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts circle definitions of shapes to regular polygons which approximate them. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Circle(System.Action> action) + { + Instance.Circle = Elastic.Clients.Elasticsearch.Ingest.CircleProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId(Elastic.Clients.Elasticsearch.Ingest.CommunityIDProcessor? value) + { + Instance.CommunityId = value; + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId() + { + Instance.CommunityId = Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId(System.Action? action) + { + Instance.CommunityId = Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes the Community ID for network flow data as defined in the + /// Community ID Specification. You can use a community ID to correlate network + /// events related to a single flow. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor CommunityId(System.Action>? action) + { + Instance.CommunityId = Elastic.Clients.Elasticsearch.Ingest.CommunityIdProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Convert(Elastic.Clients.Elasticsearch.Ingest.ConvertProcessor? value) + { + Instance.Convert = value; + return this; + } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Convert(System.Action action) + { + Instance.Convert = Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a field in the currently ingested document to a different type, such as converting a string to an integer. + /// If the field value is an array, all members will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Convert(System.Action> action) + { + Instance.Convert = Elastic.Clients.Elasticsearch.Ingest.ConvertProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Csv(Elastic.Clients.Elasticsearch.Ingest.CsvProcessor? value) + { + Instance.Csv = value; + return this; + } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Csv(System.Action action) + { + Instance.Csv = Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts fields from CSV line out of a single text field within a document. + /// Any empty field in CSV will be skipped. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Csv(System.Action> action) + { + Instance.Csv = Elastic.Clients.Elasticsearch.Ingest.CsvProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Date(Elastic.Clients.Elasticsearch.Ingest.DateProcessor? value) + { + Instance.Date = value; + return this; + } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Date(System.Action action) + { + Instance.Date = Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses dates from fields, and then uses the date or timestamp as the timestamp for the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Date(System.Action> action) + { + Instance.Date = Elastic.Clients.Elasticsearch.Ingest.DateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DateIndexName(Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessor? value) + { + Instance.DateIndexName = value; + return this; + } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DateIndexName(System.Action action) + { + Instance.DateIndexName = Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The purpose of this processor is to point documents to the right time based index based on a date or timestamp field in a document by using the date math index name support. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DateIndexName(System.Action> action) + { + Instance.DateIndexName = Elastic.Clients.Elasticsearch.Ingest.DateIndexNameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Dissect(Elastic.Clients.Elasticsearch.Ingest.DissectProcessor? value) + { + Instance.Dissect = value; + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Dissect(System.Action action) + { + Instance.Dissect = Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field by matching the text field against a delimiter-based pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Dissect(System.Action> action) + { + Instance.Dissect = Elastic.Clients.Elasticsearch.Ingest.DissectProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DotExpander(Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessor? value) + { + Instance.DotExpander = value; + return this; + } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DotExpander(System.Action action) + { + Instance.DotExpander = Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Expands a field with dots into an object field. + /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. + /// Otherwise these fields can’t be accessed by any processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor DotExpander(System.Action> action) + { + Instance.DotExpander = Elastic.Clients.Elasticsearch.Ingest.DotExpanderProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop(Elastic.Clients.Elasticsearch.Ingest.DropProcessor? value) + { + Instance.Drop = value; + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop() + { + Instance.Drop = Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop(System.Action? action) + { + Instance.Drop = Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Drops the document without raising any errors. + /// This is useful to prevent the document from getting indexed based on some condition. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Drop(System.Action>? action) + { + Instance.Drop = Elastic.Clients.Elasticsearch.Ingest.DropProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Enrich(Elastic.Clients.Elasticsearch.Ingest.EnrichProcessor? value) + { + Instance.Enrich = value; + return this; + } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Enrich(System.Action action) + { + Instance.Enrich = Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The enrich processor can enrich documents with data from another index. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Enrich(System.Action> action) + { + Instance.Enrich = Elastic.Clients.Elasticsearch.Ingest.EnrichProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fail(Elastic.Clients.Elasticsearch.Ingest.FailProcessor? value) + { + Instance.Fail = value; + return this; + } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fail(System.Action action) + { + Instance.Fail = Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Raises an exception. + /// This is useful for when you expect a pipeline to fail and want to relay a specific message to the requester. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fail(System.Action> action) + { + Instance.Fail = Elastic.Clients.Elasticsearch.Ingest.FailProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fingerprint(Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessor? value) + { + Instance.Fingerprint = value; + return this; + } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fingerprint(System.Action action) + { + Instance.Fingerprint = Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Computes a hash of the document’s content. You can use this hash for + /// content fingerprinting. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Fingerprint(System.Action> action) + { + Instance.Fingerprint = Elastic.Clients.Elasticsearch.Ingest.FingerprintProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Foreach(Elastic.Clients.Elasticsearch.Ingest.ForeachProcessor? value) + { + Instance.Foreach = value; + return this; + } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Foreach(System.Action action) + { + Instance.Foreach = Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an ingest processor on each element of an array or object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Foreach(System.Action> action) + { + Instance.Foreach = Elastic.Clients.Elasticsearch.Ingest.ForeachProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor GeoGrid(Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessor? value) + { + Instance.GeoGrid = value; + return this; + } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor GeoGrid(System.Action action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts geo-grid definitions of grid tiles or cells to regular bounding boxes or polygons which describe their shape. + /// This is useful if there is a need to interact with the tile shapes as spatially indexable fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor GeoGrid(System.Action> action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.Ingest.GeoGridProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Geoip(Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessor? value) + { + Instance.Geoip = value; + return this; + } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Geoip(System.Action action) + { + Instance.Geoip = Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The geoip processor adds information about the geographical location of an IPv4 or IPv6 address. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Geoip(System.Action> action) + { + Instance.Geoip = Elastic.Clients.Elasticsearch.Ingest.GeoIpProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Grok(Elastic.Clients.Elasticsearch.Ingest.GrokProcessor? value) + { + Instance.Grok = value; + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Grok(System.Action action) + { + Instance.Grok = Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts structured fields out of a single text field within a document. + /// You choose which field to extract matched fields from, as well as the grok pattern you expect will match. + /// A grok pattern is like a regular expression that supports aliased expressions that can be reused. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Grok(System.Action> action) + { + Instance.Grok = Elastic.Clients.Elasticsearch.Ingest.GrokProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Gsub(Elastic.Clients.Elasticsearch.Ingest.GsubProcessor? value) + { + Instance.Gsub = value; + return this; + } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Gsub(System.Action action) + { + Instance.Gsub = Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string field by applying a regular expression and a replacement. + /// If the field is an array of string, all members of the array will be converted. + /// If any non-string values are encountered, the processor will throw an exception. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Gsub(System.Action> action) + { + Instance.Gsub = Elastic.Clients.Elasticsearch.Ingest.GsubProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor HtmlStrip(Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessor? value) + { + Instance.HtmlStrip = value; + return this; + } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor HtmlStrip(System.Action action) + { + Instance.HtmlStrip = Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes HTML tags from the field. + /// If the field is an array of strings, HTML tags will be removed from all members of the array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor HtmlStrip(System.Action> action) + { + Instance.HtmlStrip = Elastic.Clients.Elasticsearch.Ingest.HtmlStripProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Inference(Elastic.Clients.Elasticsearch.Ingest.InferenceProcessor? value) + { + Instance.Inference = value; + return this; + } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Inference(System.Action action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a pre-trained data frame analytics model or a model deployed for natural language processing tasks to infer against the data that is being ingested in the pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Inference(System.Action> action) + { + Instance.Inference = Elastic.Clients.Elasticsearch.Ingest.InferenceProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor IpLocation(Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessor? value) + { + Instance.IpLocation = value; + return this; + } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor IpLocation(System.Action action) + { + Instance.IpLocation = Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Currently an undocumented alias for GeoIP Processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor IpLocation(System.Action> action) + { + Instance.IpLocation = Elastic.Clients.Elasticsearch.Ingest.IpLocationProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Join(Elastic.Clients.Elasticsearch.Ingest.JoinProcessor? value) + { + Instance.Join = value; + return this; + } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Join(System.Action action) + { + Instance.Join = Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Joins each element of an array into a single string using a separator character between each element. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Join(System.Action> action) + { + Instance.Join = Elastic.Clients.Elasticsearch.Ingest.JoinProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Json(Elastic.Clients.Elasticsearch.Ingest.JsonProcessor? value) + { + Instance.Json = value; + return this; + } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Json(System.Action action) + { + Instance.Json = Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a JSON string into a structured JSON object. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Json(System.Action> action) + { + Instance.Json = Elastic.Clients.Elasticsearch.Ingest.JsonProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Kv(Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessor? value) + { + Instance.Kv = value; + return this; + } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Kv(System.Action action) + { + Instance.Kv = Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Kv(System.Action> action) + { + Instance.Kv = Elastic.Clients.Elasticsearch.Ingest.KeyValueProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Lowercase(Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessor? value) + { + Instance.Lowercase = value; + return this; + } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Lowercase(System.Action action) + { + Instance.Lowercase = Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its lowercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Lowercase(System.Action> action) + { + Instance.Lowercase = Elastic.Clients.Elasticsearch.Ingest.LowercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection(Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessor? value) + { + Instance.NetworkDirection = value; + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection() + { + Instance.NetworkDirection = Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection(System.Action? action) + { + Instance.NetworkDirection = Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Calculates the network direction given a source IP address, destination IP + /// address, and a list of internal networks. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor NetworkDirection(System.Action>? action) + { + Instance.NetworkDirection = Elastic.Clients.Elasticsearch.Ingest.NetworkDirectionProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Pipeline(Elastic.Clients.Elasticsearch.Ingest.PipelineProcessor? value) + { + Instance.Pipeline = value; + return this; + } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Pipeline(System.Action action) + { + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Executes another pipeline. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Pipeline(System.Action> action) + { + Instance.Pipeline = Elastic.Clients.Elasticsearch.Ingest.PipelineProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Redact(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor? value) + { + Instance.Redact = value; + return this; + } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Redact(System.Action action) + { + Instance.Redact = Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The Redact processor uses the Grok rules engine to obscure text in the input document matching the given Grok patterns. + /// The processor can be used to obscure Personal Identifying Information (PII) by configuring it to detect known patterns such as email or IP addresses. + /// Text that matches a Grok pattern is replaced with a configurable string such as <EMAIL> where an email address is matched or simply replace all matches with the text <REDACTED> if preferred. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Redact(System.Action> action) + { + Instance.Redact = Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor RegisteredDomain(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor? value) + { + Instance.RegisteredDomain = value; + return this; + } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor RegisteredDomain(System.Action action) + { + Instance.RegisteredDomain = Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Extracts the registered domain (also known as the effective top-level + /// domain or eTLD), sub-domain, and top-level domain from a fully qualified + /// domain name (FQDN). Uses the registered domains defined in the Mozilla + /// Public Suffix List. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor RegisteredDomain(System.Action> action) + { + Instance.RegisteredDomain = Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Remove(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor? value) + { + Instance.Remove = value; + return this; + } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Remove(System.Action action) + { + Instance.Remove = Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes existing fields. + /// If one field doesn’t exist, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Remove(System.Action> action) + { + Instance.Remove = Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Rename(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor? value) + { + Instance.Rename = value; + return this; + } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Rename(System.Action action) + { + Instance.Rename = Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Renames an existing field. + /// If the field doesn’t exist or the new name is already used, an exception will be thrown. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Rename(System.Action> action) + { + Instance.Rename = Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor? value) + { + Instance.Reroute = value; + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute() + { + Instance.Reroute = Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute(System.Action? action) + { + Instance.Reroute = Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Routes a document to another target index or data stream. + /// When setting the destination option, the target is explicitly specified and the dataset and namespace options can’t be set. + /// When the destination option is not set, this processor is in a data stream mode. Note that in this mode, the reroute processor can only be used on data streams that follow the data stream naming scheme. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Reroute(System.Action>? action) + { + Instance.Reroute = Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Runs an inline or stored script on incoming documents. + /// The script runs in the ingest context. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Script(System.Action>? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Set(Elastic.Clients.Elasticsearch.Ingest.SetProcessor? value) + { + Instance.Set = value; + return this; + } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Set(System.Action action) + { + Instance.Set = Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Adds a field with the specified value. + /// If the field already exists, its value will be replaced with the provided one. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Set(System.Action> action) + { + Instance.Set = Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor SetSecurityUser(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor? value) + { + Instance.SetSecurityUser = value; + return this; + } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor SetSecurityUser(System.Action action) + { + Instance.SetSecurityUser = Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sets user-related details (such as username, roles, email, full_name, metadata, api_key, realm and authentication_type) from the current authenticated user to the current document by pre-processing the ingest. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor SetSecurityUser(System.Action> action) + { + Instance.SetSecurityUser = Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Sort(Elastic.Clients.Elasticsearch.Ingest.SortProcessor? value) + { + Instance.Sort = value; + return this; + } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Sort(System.Action action) + { + Instance.Sort = Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Sorts the elements of an array ascending or descending. + /// Homogeneous arrays of numbers will be sorted numerically, while arrays of strings or heterogeneous arrays of strings + numbers will be sorted lexicographically. + /// Throws an error when the field is not an array. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Sort(System.Action> action) + { + Instance.Sort = Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Split(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor? value) + { + Instance.Split = value; + return this; + } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Split(System.Action action) + { + Instance.Split = Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Splits a field into an array using a separator character. + /// Only works on string fields. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Split(System.Action> action) + { + Instance.Split = Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor? value) + { + Instance.Terminate = value; + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate() + { + Instance.Terminate = Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor.Build(null); + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate(System.Action? action) + { + Instance.Terminate = Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Terminates the current ingest pipeline, causing no further processors to be run. + /// This will normally be executed conditionally, using the if option. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Terminate(System.Action>? action) + { + Instance.Terminate = Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Trim(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor? value) + { + Instance.Trim = value; + return this; + } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Trim(System.Action action) + { + Instance.Trim = Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Trims whitespace from a field. + /// If the field is an array of strings, all members of the array will be trimmed. + /// This only works on leading and trailing whitespace. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Trim(System.Action> action) + { + Instance.Trim = Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Uppercase(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor? value) + { + Instance.Uppercase = value; + return this; + } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Uppercase(System.Action action) + { + Instance.Uppercase = Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Converts a string to its uppercase equivalent. + /// If the field is an array of strings, all members of the array will be converted. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor Uppercase(System.Action> action) + { + Instance.Uppercase = Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UriParts(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor? value) + { + Instance.UriParts = value; + return this; + } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UriParts(System.Action action) + { + Instance.UriParts = Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// Parses a Uniform Resource Identifier (URI) string and extracts its components as an object. + /// This URI object includes properties for the URI’s domain, path, fragment, port, query, scheme, user info, username, and password. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UriParts(System.Action> action) + { + Instance.UriParts = Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UrlDecode(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor? value) + { + Instance.UrlDecode = value; + return this; + } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UrlDecode(System.Action action) + { + Instance.UrlDecode = Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// URL-decodes a string. + /// If the field is an array of strings, all members of the array will be decoded. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UrlDecode(System.Action> action) + { + Instance.UrlDecode = Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UserAgent(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor? value) + { + Instance.UserAgent = value; + return this; + } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UserAgent(System.Action action) + { + Instance.UserAgent = Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor.Build(action); + return this; + } + + /// + /// + /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. + /// This processor adds this information by default under the user_agent field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor UserAgent(System.Action> action) + { + Instance.UserAgent = Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.Processor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Redact.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Redact.g.cs index 28bfd168d3a..579cc111c09 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Redact.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Redact.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RedactConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIsRedacted = System.Text.Json.JsonEncodedText.Encode("_is_redacted"); + + public override Elastic.Clients.Elasticsearch.Ingest.Redact Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIsRedacted = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIsRedacted.TryReadProperty(ref reader, options, PropIsRedacted, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Redact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IsRedacted = propIsRedacted.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Redact value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIsRedacted, value.IsRedacted, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RedactConverter))] public sealed partial class Redact { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Redact(bool isRedacted) + { + IsRedacted = isRedacted; + } +#if NET7_0_OR_GREATER + public Redact() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Redact() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Redact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// indicates if document has been redacted /// /// - [JsonInclude, JsonPropertyName("_is_redacted")] - public bool IsRedacted { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRedacted { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RedactProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RedactProcessor.g.cs index bc07497c735..9f0894415ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RedactProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RedactProcessor.g.cs @@ -17,25 +17,191 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RedactProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPatternDefinitions = System.Text.Json.JsonEncodedText.Encode("pattern_definitions"); + private static readonly System.Text.Json.JsonEncodedText PropPatterns = System.Text.Json.JsonEncodedText.Encode("patterns"); + private static readonly System.Text.Json.JsonEncodedText PropPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText PropSkipIfUnlicensed = System.Text.Json.JsonEncodedText.Encode("skip_if_unlicensed"); + private static readonly System.Text.Json.JsonEncodedText PropSuffix = System.Text.Json.JsonEncodedText.Encode("suffix"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTraceRedact = System.Text.Json.JsonEncodedText.Encode("trace_redact"); + + public override Elastic.Clients.Elasticsearch.Ingest.RedactProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propPatternDefinitions = default; + LocalJsonValue> propPatterns = default; + LocalJsonValue propPrefix = default; + LocalJsonValue propSkipIfUnlicensed = default; + LocalJsonValue propSuffix = default; + LocalJsonValue propTag = default; + LocalJsonValue propTraceRedact = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPatternDefinitions.TryReadProperty(ref reader, options, PropPatternDefinitions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPatterns.TryReadProperty(ref reader, options, PropPatterns, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPrefix.TryReadProperty(ref reader, options, PropPrefix, null)) + { + continue; + } + + if (propSkipIfUnlicensed.TryReadProperty(ref reader, options, PropSkipIfUnlicensed, null)) + { + continue; + } + + if (propSuffix.TryReadProperty(ref reader, options, PropSuffix, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTraceRedact.TryReadProperty(ref reader, options, PropTraceRedact, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + PatternDefinitions = propPatternDefinitions.Value, + Patterns = propPatterns.Value, + Prefix = propPrefix.Value, + SkipIfUnlicensed = propSkipIfUnlicensed.Value, + Suffix = propSuffix.Value, + Tag = propTag.Value, + TraceRedact = propTraceRedact.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.RedactProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPatternDefinitions, value.PatternDefinitions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPatterns, value.Patterns, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrefix, value.Prefix, null, null); + writer.WriteProperty(options, PropSkipIfUnlicensed, value.SkipIfUnlicensed, null, null); + writer.WriteProperty(options, PropSuffix, value.Suffix, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTraceRedact, value.TraceRedact, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RedactProcessorConverter))] public sealed partial class RedactProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RedactProcessor(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection patterns) + { + Field = field; + Patterns = patterns; + } +#if NET7_0_OR_GREATER + public RedactProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RedactProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +209,24 @@ public sealed partial class RedactProcessor /// The field to be redacted /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +234,6 @@ public sealed partial class RedactProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,25 +241,25 @@ public sealed partial class RedactProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } - [JsonInclude, JsonPropertyName("pattern_definitions")] - public IDictionary? PatternDefinitions { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } + public System.Collections.Generic.IDictionary? PatternDefinitions { get; set; } /// /// /// A list of grok expressions to match and redact named captures with /// /// - [JsonInclude, JsonPropertyName("patterns")] - public ICollection Patterns { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Patterns { get; set; } /// /// /// Start a redacted section with this token /// /// - [JsonInclude, JsonPropertyName("prefix")] public string? Prefix { get; set; } /// @@ -101,7 +267,6 @@ public sealed partial class RedactProcessor /// If true and the current license does not support running redact processors, then the processor quietly exits without modifying the document /// /// - [JsonInclude, JsonPropertyName("skip_if_unlicensed")] public bool? SkipIfUnlicensed { get; set; } /// @@ -109,7 +274,6 @@ public sealed partial class RedactProcessor /// End a redacted section with this token /// /// - [JsonInclude, JsonPropertyName("suffix")] public string? Suffix { get; set; } /// @@ -118,7 +282,6 @@ public sealed partial class RedactProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -126,36 +289,27 @@ public sealed partial class RedactProcessor /// If true then ingest metadata _ingest._redact._is_redacted is set to true if the document has been redacted /// /// - [JsonInclude, JsonPropertyName("trace_redact")] public bool? TraceRedact { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(RedactProcessor redactProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Redact(redactProcessor); } -public sealed partial class RedactProcessorDescriptor : SerializableDescriptor> +public readonly partial struct RedactProcessorDescriptor { - internal RedactProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RedactProcessor Instance { get; init; } - public RedactProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RedactProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private IDictionary? PatternDefinitionsValue { get; set; } - private ICollection PatternsValue { get; set; } - private string? PrefixValue { get; set; } - private bool? SkipIfUnlicensedValue { get; set; } - private string? SuffixValue { get; set; } - private string? TagValue { get; set; } - private bool? TraceRedactValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RedactProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -163,10 +317,10 @@ public RedactProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RedactProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -174,10 +328,10 @@ public RedactProcessorDescriptor Description(string? description) /// The field to be redacted /// /// - public RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -185,21 +339,21 @@ public RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch. /// The field to be redacted /// /// - public RedactProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be redacted + /// Conditionally execute the processor. /// /// - public RedactProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -207,10 +361,21 @@ public RedactProcessorDescriptor Field(Expression /// - public RedactProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -218,10 +383,10 @@ public RedactProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RedactProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -229,10 +394,10 @@ public RedactProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public RedactProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -240,46 +405,63 @@ public RedactProcessorDescriptor IgnoreMissing(bool? ignoreMissing = /// Handle failures for the processor. /// /// - public RedactProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public RedactProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public RedactProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public RedactProcessorDescriptor OnFailure(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions(System.Collections.Generic.IDictionary? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.PatternDefinitions = value; + return this; } - public RedactProcessorDescriptor PatternDefinitions(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions() { - PatternDefinitionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions(System.Action? action) + { + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor AddPatternDefinition(string key, string value) + { + Instance.PatternDefinitions ??= new System.Collections.Generic.Dictionary(); + Instance.PatternDefinitions.Add(key, value); + return this; } /// @@ -287,10 +469,21 @@ public RedactProcessorDescriptor PatternDefinitions(Func /// - public RedactProcessorDescriptor Patterns(ICollection patterns) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Patterns(System.Collections.Generic.ICollection value) { - PatternsValue = patterns; - return Self; + Instance.Patterns = value; + return this; + } + + /// + /// + /// A list of grok expressions to match and redact named captures with + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Patterns(params string[] values) + { + Instance.Patterns = [.. values]; + return this; } /// @@ -298,10 +491,10 @@ public RedactProcessorDescriptor Patterns(ICollection pattern /// Start a redacted section with this token /// /// - public RedactProcessorDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Prefix(string? value) { - PrefixValue = prefix; - return Self; + Instance.Prefix = value; + return this; } /// @@ -309,10 +502,10 @@ public RedactProcessorDescriptor Prefix(string? prefix) /// If true and the current license does not support running redact processors, then the processor quietly exits without modifying the document /// /// - public RedactProcessorDescriptor SkipIfUnlicensed(bool? skipIfUnlicensed = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor SkipIfUnlicensed(bool? value = true) { - SkipIfUnlicensedValue = skipIfUnlicensed; - return Self; + Instance.SkipIfUnlicensed = value; + return this; } /// @@ -320,10 +513,10 @@ public RedactProcessorDescriptor SkipIfUnlicensed(bool? skipIfUnlicen /// End a redacted section with this token /// /// - public RedactProcessorDescriptor Suffix(string? suffix) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Suffix(string? value) { - SuffixValue = suffix; - return Self; + Instance.Suffix = value; + return this; } /// @@ -332,10 +525,10 @@ public RedactProcessorDescriptor Suffix(string? suffix) /// Useful for debugging and metrics. /// /// - public RedactProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -343,138 +536,39 @@ public RedactProcessorDescriptor Tag(string? tag) /// If true then ingest metadata _ingest._redact._is_redacted is set to true if the document has been redacted /// /// - public RedactProcessorDescriptor TraceRedact(bool? traceRedact = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor TraceRedact(bool? value = true) { - TraceRedactValue = traceRedact; - return Self; + Instance.TraceRedact = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RedactProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PatternDefinitionsValue is not null) - { - writer.WritePropertyName("pattern_definitions"); - JsonSerializer.Serialize(writer, PatternDefinitionsValue, options); - } - - writer.WritePropertyName("patterns"); - JsonSerializer.Serialize(writer, PatternsValue, options); - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } - - if (SkipIfUnlicensedValue.HasValue) - { - writer.WritePropertyName("skip_if_unlicensed"); - writer.WriteBooleanValue(SkipIfUnlicensedValue.Value); - } - - if (!string.IsNullOrEmpty(SuffixValue)) - { - writer.WritePropertyName("suffix"); - writer.WriteStringValue(SuffixValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TraceRedactValue.HasValue) - { - writer.WritePropertyName("trace_redact"); - writer.WriteBooleanValue(TraceRedactValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RedactProcessorDescriptor : SerializableDescriptor +public readonly partial struct RedactProcessorDescriptor { - internal RedactProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RedactProcessor Instance { get; init; } - public RedactProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RedactProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private IDictionary? PatternDefinitionsValue { get; set; } - private ICollection PatternsValue { get; set; } - private string? PrefixValue { get; set; } - private bool? SkipIfUnlicensedValue { get; set; } - private string? SuffixValue { get; set; } - private string? TagValue { get; set; } - private bool? TraceRedactValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RedactProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -482,10 +576,10 @@ public RedactProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RedactProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -493,10 +587,10 @@ public RedactProcessorDescriptor Description(string? description) /// The field to be redacted /// /// - public RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -504,21 +598,21 @@ public RedactProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// The field to be redacted /// /// - public RedactProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be redacted + /// Conditionally execute the processor. /// /// - public RedactProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -526,10 +620,21 @@ public RedactProcessorDescriptor Field(Expression /// - public RedactProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -537,10 +642,10 @@ public RedactProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RedactProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -548,10 +653,49 @@ public RedactProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public RedactProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor IgnoreMissing(bool? value = true) + { + Instance.IgnoreMissing = value; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) + { + Instance.OnFailure = value; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) + { + Instance.OnFailure = [.. values]; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(params System.Action[] actions) { - IgnoreMissingValue = ignoreMissing; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -559,46 +703,41 @@ public RedactProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public RedactProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public RedactProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions(System.Collections.Generic.IDictionary? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.PatternDefinitions = value; + return this; } - public RedactProcessorDescriptor OnFailure(Action configure) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions() { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public RedactProcessorDescriptor OnFailure(params Action[] configure) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor PatternDefinitions(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.PatternDefinitions = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public RedactProcessorDescriptor PatternDefinitions(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor AddPatternDefinition(string key, string value) { - PatternDefinitionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PatternDefinitions ??= new System.Collections.Generic.Dictionary(); + Instance.PatternDefinitions.Add(key, value); + return this; } /// @@ -606,10 +745,21 @@ public RedactProcessorDescriptor PatternDefinitions(Func /// - public RedactProcessorDescriptor Patterns(ICollection patterns) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Patterns(System.Collections.Generic.ICollection value) { - PatternsValue = patterns; - return Self; + Instance.Patterns = value; + return this; + } + + /// + /// + /// A list of grok expressions to match and redact named captures with + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Patterns(params string[] values) + { + Instance.Patterns = [.. values]; + return this; } /// @@ -617,10 +767,10 @@ public RedactProcessorDescriptor Patterns(ICollection patterns) /// Start a redacted section with this token /// /// - public RedactProcessorDescriptor Prefix(string? prefix) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Prefix(string? value) { - PrefixValue = prefix; - return Self; + Instance.Prefix = value; + return this; } /// @@ -628,10 +778,10 @@ public RedactProcessorDescriptor Prefix(string? prefix) /// If true and the current license does not support running redact processors, then the processor quietly exits without modifying the document /// /// - public RedactProcessorDescriptor SkipIfUnlicensed(bool? skipIfUnlicensed = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor SkipIfUnlicensed(bool? value = true) { - SkipIfUnlicensedValue = skipIfUnlicensed; - return Self; + Instance.SkipIfUnlicensed = value; + return this; } /// @@ -639,10 +789,10 @@ public RedactProcessorDescriptor SkipIfUnlicensed(bool? skipIfUnlicensed = true) /// End a redacted section with this token /// /// - public RedactProcessorDescriptor Suffix(string? suffix) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Suffix(string? value) { - SuffixValue = suffix; - return Self; + Instance.Suffix = value; + return this; } /// @@ -651,10 +801,10 @@ public RedactProcessorDescriptor Suffix(string? suffix) /// Useful for debugging and metrics. /// /// - public RedactProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -662,110 +812,17 @@ public RedactProcessorDescriptor Tag(string? tag) /// If true then ingest metadata _ingest._redact._is_redacted is set to true if the document has been redacted /// /// - public RedactProcessorDescriptor TraceRedact(bool? traceRedact = true) + public Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor TraceRedact(bool? value = true) { - TraceRedactValue = traceRedact; - return Self; + Instance.TraceRedact = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RedactProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PatternDefinitionsValue is not null) - { - writer.WritePropertyName("pattern_definitions"); - JsonSerializer.Serialize(writer, PatternDefinitionsValue, options); - } - - writer.WritePropertyName("patterns"); - JsonSerializer.Serialize(writer, PatternsValue, options); - if (!string.IsNullOrEmpty(PrefixValue)) - { - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - } - - if (SkipIfUnlicensedValue.HasValue) - { - writer.WritePropertyName("skip_if_unlicensed"); - writer.WriteBooleanValue(SkipIfUnlicensedValue.Value); - } - - if (!string.IsNullOrEmpty(SuffixValue)) - { - writer.WritePropertyName("suffix"); - writer.WriteStringValue(SuffixValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TraceRedactValue.HasValue) - { - writer.WritePropertyName("trace_redact"); - writer.WriteBooleanValue(TraceRedactValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RedactProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RedactProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RegisteredDomainProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RegisteredDomainProcessor.g.cs index a8089013ea1..98668d9fd25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RegisteredDomainProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RegisteredDomainProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RegisteredDomainProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorConverter))] public sealed partial class RegisteredDomainProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public RegisteredDomainProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RegisteredDomainProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class RegisteredDomainProcessor /// Field containing the source FQDN. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,7 +189,6 @@ public sealed partial class RegisteredDomainProcessor /// without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -76,8 +196,7 @@ public sealed partial class RegisteredDomainProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -85,7 +204,6 @@ public sealed partial class RegisteredDomainProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -94,31 +212,27 @@ public sealed partial class RegisteredDomainProcessor /// the processor adds components to the document’s root. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(RegisteredDomainProcessor registeredDomainProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.RegisteredDomain(registeredDomainProcessor); } -public sealed partial class RegisteredDomainProcessorDescriptor : SerializableDescriptor> +public readonly partial struct RegisteredDomainProcessorDescriptor { - internal RegisteredDomainProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegisteredDomainProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor instance) + { + Instance = instance; + } - public RegisteredDomainProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegisteredDomainProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -126,10 +240,10 @@ public RegisteredDomainProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RegisteredDomainProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -137,10 +251,10 @@ public RegisteredDomainProcessorDescriptor Description(string? descri /// Field containing the source FQDN. /// /// - public RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -148,21 +262,32 @@ public RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elas /// Field containing the source FQDN. /// /// - public RegisteredDomainProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing the source FQDN. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public RegisteredDomainProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -170,10 +295,10 @@ public RegisteredDomainProcessorDescriptor Field(Expression /// - public RegisteredDomainProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -181,10 +306,10 @@ public RegisteredDomainProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -193,10 +318,10 @@ public RegisteredDomainProcessorDescriptor IgnoreFailure(bool? ignore /// without modifying the document. /// /// - public RegisteredDomainProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -204,64 +329,50 @@ public RegisteredDomainProcessorDescriptor IgnoreMissing(bool? ignore /// Handle failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public RegisteredDomainProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public RegisteredDomainProcessorDescriptor OnFailure(Action> configure) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public RegisteredDomainProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Object field containing extracted domain components. If an empty string, - /// the processor adds components to the document’s root. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -270,10 +381,10 @@ public RegisteredDomainProcessorDescriptor TargetField(Elastic.Client /// the processor adds components to the document’s root. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -282,107 +393,39 @@ public RegisteredDomainProcessorDescriptor TargetField(Expres /// the processor adds components to the document’s root. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RegisteredDomainProcessorDescriptor : SerializableDescriptor +public readonly partial struct RegisteredDomainProcessorDescriptor { - internal RegisteredDomainProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor Instance { get; init; } - public RegisteredDomainProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegisteredDomainProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegisteredDomainProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -390,10 +433,10 @@ public RegisteredDomainProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RegisteredDomainProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -401,10 +444,10 @@ public RegisteredDomainProcessorDescriptor Description(string? description) /// Field containing the source FQDN. /// /// - public RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -412,21 +455,21 @@ public RegisteredDomainProcessorDescriptor Field(Elastic.Clients.Elasticsearch.F /// Field containing the source FQDN. /// /// - public RegisteredDomainProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing the source FQDN. + /// Conditionally execute the processor. /// /// - public RegisteredDomainProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -434,10 +477,21 @@ public RegisteredDomainProcessorDescriptor Field(Expression /// - public RegisteredDomainProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -445,10 +499,10 @@ public RegisteredDomainProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -457,10 +511,10 @@ public RegisteredDomainProcessorDescriptor IgnoreFailure(bool? ignoreFailure = t /// without modifying the document. /// /// - public RegisteredDomainProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -468,64 +522,67 @@ public RegisteredDomainProcessorDescriptor IgnoreMissing(bool? ignoreMissing = t /// Handle failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public RegisteredDomainProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public RegisteredDomainProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public RegisteredDomainProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RegisteredDomainProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Object field containing extracted domain components. If an empty string, - /// the processor adds components to the document’s root. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -534,10 +591,10 @@ public RegisteredDomainProcessorDescriptor TargetField(Elastic.Clients.Elasticse /// the processor adds components to the document’s root. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -546,84 +603,17 @@ public RegisteredDomainProcessorDescriptor TargetField(Expres /// the processor adds components to the document’s root. /// /// - public RegisteredDomainProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RegisteredDomainProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs index 33124de7f4a..ee01e3bf6f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RemoveProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropKeep = System.Text.Json.JsonEncodedText.Encode("keep"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propKeep = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propKeep.TryReadProperty(ref reader, options, PropKeep, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + Keep = propKeep.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropKeep, value.Keep, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorConverter))] public sealed partial class RemoveProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProcessor(Elastic.Clients.Elasticsearch.Fields field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public RemoveProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RemoveProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,24 +163,24 @@ public sealed partial class RemoveProcessor /// Fields to be removed. Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,7 +188,6 @@ public sealed partial class RemoveProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -76,8 +195,6 @@ public sealed partial class RemoveProcessor /// Fields to be kept. When set, all fields other than those specified are removed. /// /// - [JsonInclude, JsonPropertyName("keep")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Keep { get; set; } /// @@ -85,8 +202,7 @@ public sealed partial class RemoveProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -94,31 +210,27 @@ public sealed partial class RemoveProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(RemoveProcessor removeProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Remove(removeProcessor); } -public sealed partial class RemoveProcessorDescriptor : SerializableDescriptor> +public readonly partial struct RemoveProcessorDescriptor { - internal RemoveProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor Instance { get; init; } - public RemoveProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? KeepValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -126,10 +238,10 @@ public RemoveProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RemoveProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -137,204 +249,178 @@ public RemoveProcessorDescriptor Description(string? description) /// Fields to be removed. Supports template snippets. /// /// - public RemoveProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fields field) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fields value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Conditionally execute the processor. + /// Fields to be removed. Supports template snippets. /// /// - public RemoveProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Field(params System.Linq.Expressions.Expression>[] value) { - IfValue = value; - return Self; + Instance.Field = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = value; + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If() { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Fields to be kept. When set, all fields other than those specified are removed. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? keep) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If(System.Action? action) { - KeepValue = keep; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public RemoveProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public RemoveProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public RemoveProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Keep = value; + return this; } - public RemoveProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Keep(params System.Linq.Expressions.Expression>[] value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Keep = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RemoveProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - TagValue = tag; - return Self; + Instance.OnFailure = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (KeepValue is not null) - { - writer.WritePropertyName("keep"); - JsonSerializer.Serialize(writer, KeepValue, options); - } + Instance.OnFailure = [.. values]; + return this; + } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + Instance.OnFailure = items; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RemoveProcessorDescriptor : SerializableDescriptor +public readonly partial struct RemoveProcessorDescriptor { - internal RemoveProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor instance) + { + Instance = instance; + } - public RemoveProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? KeepValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -342,10 +428,10 @@ public RemoveProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RemoveProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -353,181 +439,173 @@ public RemoveProcessorDescriptor Description(string? description) /// Fields to be removed. Supports template snippets. /// /// - public RemoveProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fields field) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fields value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Conditionally execute the processor. + /// Fields to be removed. Supports template snippets. /// /// - public RemoveProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Field(params System.Linq.Expressions.Expression>[] value) { - IfValue = value; - return Self; + Instance.Field = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = value; + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If() { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Fields to be kept. When set, all fields other than those specified are removed. + /// Conditionally execute the processor. /// /// - public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? keep) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor If(System.Action? action) { - KeepValue = keep; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public RemoveProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public RemoveProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public RemoveProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Keep = value; + return this; } - public RemoveProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Keep(params System.Linq.Expressions.Expression>[] value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Keep = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RemoveProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - TagValue = tag; - return Self; + Instance.OnFailure = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } + Instance.OnFailure = [.. values]; + return this; + } - if (IgnoreMissingValue.HasValue) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (KeepValue is not null) - { - writer.WritePropertyName("keep"); - JsonSerializer.Serialize(writer, KeepValue, options); - } + Instance.OnFailure = items; + return this; + } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + Instance.OnFailure = items; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RemoveProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RenameProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RenameProcessor.g.cs index 38111549a4b..e10084b3a11 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RenameProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RenameProcessor.g.cs @@ -17,25 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RenameProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.RenameProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.RenameProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RenameProcessorConverter))] public sealed partial class RenameProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenameProcessor(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Field targetField) + { + Field = field; + TargetField = targetField; + } +#if NET7_0_OR_GREATER + public RenameProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RenameProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,23 +165,24 @@ public sealed partial class RenameProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,7 +190,6 @@ public sealed partial class RenameProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -76,8 +197,7 @@ public sealed partial class RenameProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -85,7 +205,6 @@ public sealed partial class RenameProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -94,31 +213,31 @@ public sealed partial class RenameProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("target_field")] - public Elastic.Clients.Elasticsearch.Field TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(RenameProcessor renameProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Rename(renameProcessor); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field TargetField { get; set; } } -public sealed partial class RenameProcessorDescriptor : SerializableDescriptor> +public readonly partial struct RenameProcessorDescriptor { - internal RenameProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RenameProcessor Instance { get; init; } - public RenameProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenameProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -126,10 +245,10 @@ public RenameProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RenameProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -138,10 +257,10 @@ public RenameProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -150,22 +269,21 @@ public RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch. /// Supports template snippets. /// /// - public RenameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be renamed. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public RenameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -173,97 +291,94 @@ public RenameProcessorDescriptor Field(Expression /// - public RenameProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public RenameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public RenameProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public RenameProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreMissing = value; + return this; } - public RenameProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public RenameProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public RenameProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RenameProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The new name of the field. - /// Supports template snippets. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public RenameProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -272,10 +387,10 @@ public RenameProcessorDescriptor TargetField(Elastic.Clients.Elastics /// Supports template snippets. /// /// - public RenameProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -284,103 +399,39 @@ public RenameProcessorDescriptor TargetField(Expression /// - public RenameProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RenameProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RenameProcessorDescriptor : SerializableDescriptor +public readonly partial struct RenameProcessorDescriptor { - internal RenameProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RenameProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor instance) + { + Instance = instance; + } - public RenameProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RenameProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +439,10 @@ public RenameProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public RenameProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -400,10 +451,10 @@ public RenameProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -412,22 +463,21 @@ public RenameProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field /// Supports template snippets. /// /// - public RenameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be renamed. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public RenameProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -435,10 +485,21 @@ public RenameProcessorDescriptor Field(Expression /// - public RenameProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -446,10 +507,10 @@ public RenameProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RenameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -457,10 +518,10 @@ public RenameProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public RenameProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -468,64 +529,67 @@ public RenameProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public RenameProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public RenameProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public RenameProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public RenameProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RenameProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The new name of the field. - /// Supports template snippets. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public RenameProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -534,10 +598,10 @@ public RenameProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field /// Supports template snippets. /// /// - public RenameProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -546,80 +610,17 @@ public RenameProcessorDescriptor TargetField(Expression /// - public RenameProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RenameProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RenameProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RenameProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RerouteProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RerouteProcessor.g.cs index 2f92c5c108e..b8d0e553338 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RerouteProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RerouteProcessor.g.cs @@ -17,18 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class RerouteProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataset = System.Text.Json.JsonEncodedText.Encode("dataset"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDestination = System.Text.Json.JsonEncodedText.Encode("destination"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropNamespace = System.Text.Json.JsonEncodedText.Encode("namespace"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDataset = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDestination = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propNamespace = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataset.TryReadProperty(ref reader, options, PropDataset, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDestination.TryReadProperty(ref reader, options, PropDestination, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propNamespace.TryReadProperty(ref reader, options, PropNamespace, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dataset = propDataset.Value, + Description = propDescription.Value, + Destination = propDestination.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + Namespace = propNamespace.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataset, value.Dataset, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDestination, value.Destination, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropNamespace, value.Namespace, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorConverter))] public sealed partial class RerouteProcessor { +#if NET7_0_OR_GREATER + public RerouteProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public RerouteProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Field references or a static value for the dataset part of the data stream name. @@ -44,9 +159,7 @@ public sealed partial class RerouteProcessor /// default {{data_stream.dataset}} /// /// - [JsonInclude, JsonPropertyName("dataset")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Dataset { get; set; } + public System.Collections.Generic.ICollection? Dataset { get; set; } /// /// @@ -54,7 +167,6 @@ public sealed partial class RerouteProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -62,7 +174,6 @@ public sealed partial class RerouteProcessor /// A static value for the target. Can’t be set when the dataset or namespace option is set. /// /// - [JsonInclude, JsonPropertyName("destination")] public string? Destination { get; set; } /// @@ -70,15 +181,13 @@ public sealed partial class RerouteProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -95,17 +204,14 @@ public sealed partial class RerouteProcessor /// default {{data_stream.namespace}} /// /// - [JsonInclude, JsonPropertyName("namespace")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? Namespace { get; set; } + public System.Collections.Generic.ICollection? Namespace { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -113,31 +219,48 @@ public sealed partial class RerouteProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(RerouteProcessor rerouteProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Reroute(rerouteProcessor); } -public sealed partial class RerouteProcessorDescriptor : SerializableDescriptor> +public readonly partial struct RerouteProcessorDescriptor { - internal RerouteProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerouteProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor instance) + { + Instance = instance; + } - public RerouteProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerouteProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? DatasetValue { get; set; } - private string? DescriptionValue { get; set; } - private string? DestinationValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? NamespaceValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Field references or a static value for the dataset part of the data stream name. + /// In addition to the criteria for index names, cannot contain - and must be no longer than 100 characters. + /// Example values are nginx.access and nginx.error. + /// + /// + /// Supports field references with a mustache-like syntax (denoted as {{double}} or {{{triple}}} curly braces). + /// When resolving field references, the processor replaces invalid characters with _. Uses the <dataset> part + /// of the index name as a fallback if all field references resolve to a null, missing, or non-string value. + /// + /// + /// default {{data_stream.dataset}} + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Dataset(System.Collections.Generic.ICollection? value) + { + Instance.Dataset = value; + return this; + } /// /// @@ -154,10 +277,10 @@ public RerouteProcessorDescriptor() : base() /// default {{data_stream.dataset}} /// /// - public RerouteProcessorDescriptor Dataset(ICollection? dataset) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Dataset(params string[] values) { - DatasetValue = dataset; - return Self; + Instance.Dataset = [.. values]; + return this; } /// @@ -166,10 +289,10 @@ public RerouteProcessorDescriptor Dataset(ICollection? datase /// Useful for describing the purpose of the processor or its configuration. /// /// - public RerouteProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -177,10 +300,21 @@ public RerouteProcessorDescriptor Description(string? description) /// A static value for the target. Can’t be set when the dataset or namespace option is set. /// /// - public RerouteProcessorDescriptor Destination(string? destination) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Destination(string? value) + { + Instance.Destination = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - DestinationValue = destination; - return Self; + Instance.If = value; + return this; } /// @@ -188,10 +322,21 @@ public RerouteProcessorDescriptor Destination(string? destination) /// Conditionally execute the processor. /// /// - public RerouteProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -199,10 +344,10 @@ public RerouteProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RerouteProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -219,51 +364,69 @@ public RerouteProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// default {{data_stream.namespace}} /// /// - public RerouteProcessorDescriptor Namespace(ICollection? value) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Namespace(System.Collections.Generic.ICollection? value) { - NamespaceValue = value; - return Self; + Instance.Namespace = value; + return this; } /// /// - /// Handle failures for the processor. + /// Field references or a static value for the namespace part of the data stream name. See the criteria for + /// index names for allowed characters. Must be no longer than 100 characters. + /// + /// + /// Supports field references with a mustache-like syntax (denoted as {{double}} or {{{triple}}} curly braces). + /// When resolving field references, the processor replaces invalid characters with _. Uses the <namespace> part + /// of the index name as a fallback if all field references resolve to a null, missing, or non-string value. + /// + /// + /// default {{data_stream.namespace}} /// /// - public RerouteProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Namespace(params string[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.Namespace = [.. values]; + return this; } - public RerouteProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public RerouteProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public RerouteProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -272,111 +435,65 @@ public RerouteProcessorDescriptor OnFailure(params Action /// - public RerouteProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor Build(System.Action>? action) { - writer.WriteStartObject(); - if (DatasetValue is not null) - { - writer.WritePropertyName("dataset"); - SingleOrManySerializationHelper.Serialize(DatasetValue, writer, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(DestinationValue)) - { - writer.WritePropertyName("destination"); - writer.WriteStringValue(DestinationValue); - } - - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (NamespaceValue is not null) - { - writer.WritePropertyName("namespace"); - SingleOrManySerializationHelper.Serialize(NamespaceValue, writer, options); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RerouteProcessorDescriptor : SerializableDescriptor +public readonly partial struct RerouteProcessorDescriptor { - internal RerouteProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerouteProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor instance) + { + Instance = instance; + } - public RerouteProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RerouteProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? DatasetValue { get; set; } - private string? DescriptionValue { get; set; } - private string? DestinationValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? NamespaceValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Field references or a static value for the dataset part of the data stream name. + /// In addition to the criteria for index names, cannot contain - and must be no longer than 100 characters. + /// Example values are nginx.access and nginx.error. + /// + /// + /// Supports field references with a mustache-like syntax (denoted as {{double}} or {{{triple}}} curly braces). + /// When resolving field references, the processor replaces invalid characters with _. Uses the <dataset> part + /// of the index name as a fallback if all field references resolve to a null, missing, or non-string value. + /// + /// + /// default {{data_stream.dataset}} + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Dataset(System.Collections.Generic.ICollection? value) + { + Instance.Dataset = value; + return this; + } /// /// @@ -393,10 +510,10 @@ public RerouteProcessorDescriptor() : base() /// default {{data_stream.dataset}} /// /// - public RerouteProcessorDescriptor Dataset(ICollection? dataset) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Dataset(params string[] values) { - DatasetValue = dataset; - return Self; + Instance.Dataset = [.. values]; + return this; } /// @@ -405,10 +522,10 @@ public RerouteProcessorDescriptor Dataset(ICollection? dataset) /// Useful for describing the purpose of the processor or its configuration. /// /// - public RerouteProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -416,10 +533,32 @@ public RerouteProcessorDescriptor Description(string? description) /// A static value for the target. Can’t be set when the dataset or namespace option is set. /// /// - public RerouteProcessorDescriptor Destination(string? destination) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Destination(string? value) + { + Instance.Destination = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If() { - DestinationValue = destination; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -427,10 +566,10 @@ public RerouteProcessorDescriptor Destination(string? destination) /// Conditionally execute the processor. /// /// - public RerouteProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -438,10 +577,10 @@ public RerouteProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public RerouteProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -458,141 +597,110 @@ public RerouteProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// default {{data_stream.namespace}} /// /// - public RerouteProcessorDescriptor Namespace(ICollection? value) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Namespace(System.Collections.Generic.ICollection? value) { - NamespaceValue = value; - return Self; + Instance.Namespace = value; + return this; } /// /// - /// Handle failures for the processor. + /// Field references or a static value for the namespace part of the data stream name. See the criteria for + /// index names for allowed characters. Must be no longer than 100 characters. + /// + /// + /// Supports field references with a mustache-like syntax (denoted as {{double}} or {{{triple}}} curly braces). + /// When resolving field references, the processor replaces invalid characters with _. Uses the <namespace> part + /// of the index name as a fallback if all field references resolve to a null, missing, or non-string value. + /// + /// + /// default {{data_stream.namespace}} /// /// - public RerouteProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public RerouteProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Namespace(params string[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.Namespace = [.. values]; + return this; } - public RerouteProcessorDescriptor OnFailure(Action configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } - - public RerouteProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public RerouteProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(params System.Action[] actions) { - writer.WriteStartObject(); - if (DatasetValue is not null) - { - writer.WritePropertyName("dataset"); - SingleOrManySerializationHelper.Serialize(DatasetValue, writer, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(DestinationValue)) - { - writer.WritePropertyName("destination"); - writer.WriteStringValue(DestinationValue); - } - - if (!string.IsNullOrEmpty(IfValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } + Instance.OnFailure = items; + return this; + } - if (NamespaceValue is not null) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("namespace"); - SingleOrManySerializationHelper.Serialize(NamespaceValue, writer, options); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.RerouteProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ScriptProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ScriptProcessor.g.cs index d337108d136..d295f8a2fad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ScriptProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/ScriptProcessor.g.cs @@ -17,25 +17,148 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class ScriptProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropLang = System.Text.Json.JsonEncodedText.Encode("lang"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propId = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propLang = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propSource = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propLang.TryReadProperty(ref reader, options, PropLang, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Id = propId.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + Lang = propLang.Value, + OnFailure = propOnFailure.Value, + Params = propParams.Value, + Source = propSource.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropLang, value.Lang, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorConverter))] public sealed partial class ScriptProcessor { +#if NET7_0_OR_GREATER + public ScriptProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScriptProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -44,7 +167,6 @@ public sealed partial class ScriptProcessor /// If no source is specified, this parameter is required. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -52,15 +174,13 @@ public sealed partial class ScriptProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -68,24 +188,21 @@ public sealed partial class ScriptProcessor /// Script language. /// /// - [JsonInclude, JsonPropertyName("lang")] - public string? Lang { get; set; } + public Elastic.Clients.Elasticsearch.ScriptLanguage? Lang { get; set; } /// /// /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Object containing parameters for the script. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// @@ -93,7 +210,6 @@ public sealed partial class ScriptProcessor /// If no id is specified, this parameter is required. /// /// - [JsonInclude, JsonPropertyName("source")] public string? Source { get; set; } /// @@ -102,32 +218,27 @@ public sealed partial class ScriptProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(ScriptProcessor scriptProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Script(scriptProcessor); } -public sealed partial class ScriptProcessorDescriptor : SerializableDescriptor> +public readonly partial struct ScriptProcessorDescriptor { - internal ScriptProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor Instance { get; init; } - public ScriptProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? LangValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? SourceValue { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -135,10 +246,10 @@ public ScriptProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ScriptProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -147,10 +258,32 @@ public ScriptProcessorDescriptor Description(string? description) /// If no source is specified, this parameter is required. /// /// - public ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If() { - IdValue = id; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -158,10 +291,10 @@ public ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? /// Conditionally execute the processor. /// /// - public ScriptProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -169,10 +302,10 @@ public ScriptProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public ScriptProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -180,10 +313,10 @@ public ScriptProcessorDescriptor IgnoreFailure(bool? ignoreFailure = /// Script language. /// /// - public ScriptProcessorDescriptor Lang(string? lang) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Lang(Elastic.Clients.Elasticsearch.ScriptLanguage? value) { - LangValue = lang; - return Self; + Instance.Lang = value; + return this; } /// @@ -191,40 +324,60 @@ public ScriptProcessorDescriptor Lang(string? lang) /// Handle failures for the processor. /// /// - public ScriptProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public ScriptProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) + { + Instance.OnFailure = [.. values]; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public ScriptProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Object containing parameters for the script. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params(System.Collections.Generic.IDictionary? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.Params = value; + return this; } - public ScriptProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Object containing parameters for the script. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params() { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -232,10 +385,17 @@ public ScriptProcessorDescriptor OnFailure(params Action /// - public ScriptProcessorDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor AddParam(string key, object value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -244,10 +404,10 @@ public ScriptProcessorDescriptor Params(Funcid is specified, this parameter is required. /// /// - public ScriptProcessorDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } /// @@ -256,118 +416,44 @@ public ScriptProcessorDescriptor Source(string? source) /// Useful for debugging and metrics. /// /// - public ScriptProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) + if (action is null) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + return new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(LangValue)) - { - writer.WritePropertyName("lang"); - writer.WriteStringValue(LangValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ScriptProcessorDescriptor : SerializableDescriptor +public readonly partial struct ScriptProcessorDescriptor { - internal ScriptProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor instance) + { + Instance = instance; + } - public ScriptProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? LangValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? SourceValue { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -375,10 +461,10 @@ public ScriptProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public ScriptProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -387,10 +473,21 @@ public ScriptProcessorDescriptor Description(string? description) /// If no source is specified, this parameter is required. /// /// - public ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.Id = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IdValue = id; - return Self; + Instance.If = value; + return this; } /// @@ -398,10 +495,21 @@ public ScriptProcessorDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// Conditionally execute the processor. /// /// - public ScriptProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -409,10 +517,10 @@ public ScriptProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public ScriptProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -420,10 +528,10 @@ public ScriptProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Script language. /// /// - public ScriptProcessorDescriptor Lang(string? lang) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Lang(Elastic.Clients.Elasticsearch.ScriptLanguage? value) { - LangValue = lang; - return Self; + Instance.Lang = value; + return this; } /// @@ -431,40 +539,55 @@ public ScriptProcessorDescriptor Lang(string? lang) /// Handle failures for the processor. /// /// - public ScriptProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public ScriptProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public ScriptProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public ScriptProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -472,10 +595,39 @@ public ScriptProcessorDescriptor OnFailure(params Action /// - public ScriptProcessorDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; + } + + /// + /// + /// Object containing parameters for the script. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params() + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Object containing parameters for the script. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Params(System.Action? action) + { + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; } /// @@ -484,10 +636,10 @@ public ScriptProcessorDescriptor Params(Func, F /// If no id is specified, this parameter is required. /// /// - public ScriptProcessorDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Source(string? value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } /// @@ -496,94 +648,22 @@ public ScriptProcessorDescriptor Source(string? source) /// Useful for debugging and metrics. /// /// - public ScriptProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (!string.IsNullOrEmpty(IfValue)) + if (action is null) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + return new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(LangValue)) - { - writer.WritePropertyName("lang"); - writer.WriteStringValue(LangValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } - - if (!string.IsNullOrEmpty(SourceValue)) - { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.ScriptProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetProcessor.g.cs index c858bd62a5b..03d476eabda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetProcessor.g.cs @@ -17,25 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class SetProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyFrom = System.Text.Json.JsonEncodedText.Encode("copy_from"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreEmptyValue = System.Text.Json.JsonEncodedText.Encode("ignore_empty_value"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropMediaType = System.Text.Json.JsonEncodedText.Encode("media_type"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOverride = System.Text.Json.JsonEncodedText.Encode("override"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Ingest.SetProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyFrom = default; + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreEmptyValue = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propMediaType = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propOverride = default; + LocalJsonValue propTag = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyFrom.TryReadProperty(ref reader, options, PropCopyFrom, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreEmptyValue.TryReadProperty(ref reader, options, PropIgnoreEmptyValue, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propMediaType.TryReadProperty(ref reader, options, PropMediaType, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOverride.TryReadProperty(ref reader, options, PropOverride, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyFrom = propCopyFrom.Value, + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreEmptyValue = propIgnoreEmptyValue.Value, + IgnoreFailure = propIgnoreFailure.Value, + MediaType = propMediaType.Value, + OnFailure = propOnFailure.Value, + Override = propOverride.Value, + Tag = propTag.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SetProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyFrom, value.CopyFrom, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreEmptyValue, value.IgnoreEmptyValue, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropMediaType, value.MediaType, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverride, value.Override, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SetProcessorConverter))] public sealed partial class SetProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public SetProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SetProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The origin field which will be copied to field, cannot set value simultaneously. /// Supported data types are boolean, number, array, object, string, date, etc. /// /// - [JsonInclude, JsonPropertyName("copy_from")] public Elastic.Clients.Elasticsearch.Field? CopyFrom { get; set; } /// @@ -44,7 +191,6 @@ public sealed partial class SetProcessor /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -53,23 +199,24 @@ public sealed partial class SetProcessor /// Supports template snippets. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// If true and value is a template snippet that evaluates to null or the empty string, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_empty_value")] public bool? IgnoreEmptyValue { get; set; } /// @@ -77,7 +224,6 @@ public sealed partial class SetProcessor /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -87,7 +233,6 @@ public sealed partial class SetProcessor /// Must be one of application/json, text/plain, or application/x-www-form-urlencoded. /// /// - [JsonInclude, JsonPropertyName("media_type")] public string? MediaType { get; set; } /// @@ -95,8 +240,7 @@ public sealed partial class SetProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -104,7 +248,6 @@ public sealed partial class SetProcessor /// When set to false, such fields will not be touched. /// /// - [JsonInclude, JsonPropertyName("override")] public bool? Override { get; set; } /// @@ -113,7 +256,6 @@ public sealed partial class SetProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -123,34 +265,27 @@ public sealed partial class SetProcessor /// May specify only one of value or copy_from. /// /// - [JsonInclude, JsonPropertyName("value")] public object? Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(SetProcessor setProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Set(setProcessor); } -public sealed partial class SetProcessorDescriptor : SerializableDescriptor> +public readonly partial struct SetProcessorDescriptor { - internal SetProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SetProcessor Instance { get; init; } - public SetProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetProcessor instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? CopyFromValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreEmptyValueValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? MediaTypeValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string? TagValue { get; set; } - private object? ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -158,10 +293,10 @@ public SetProcessorDescriptor() : base() /// Supported data types are boolean, number, array, object, string, date, etc. /// /// - public SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch.Field? copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch.Field? value) { - CopyFromValue = copyFrom; - return Self; + Instance.CopyFrom = value; + return this; } /// @@ -170,34 +305,34 @@ public SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch. /// Supported data types are boolean, number, array, object, string, date, etc. /// /// - public SetProcessorDescriptor CopyFrom(Expression> copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor CopyFrom(System.Linq.Expressions.Expression> value) { - CopyFromValue = copyFrom; - return Self; + Instance.CopyFrom = value; + return this; } /// /// - /// The origin field which will be copied to field, cannot set value simultaneously. - /// Supported data types are boolean, number, array, object, string, date, etc. + /// Description of the processor. + /// Useful for describing the purpose of the processor or its configuration. /// /// - public SetProcessorDescriptor CopyFrom(Expression> copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Description(string? value) { - CopyFromValue = copyFrom; - return Self; + Instance.Description = value; + return this; } /// /// - /// Description of the processor. - /// Useful for describing the purpose of the processor or its configuration. + /// The field to insert, upsert, or update. + /// Supports template snippets. /// /// - public SetProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - DescriptionValue = description; - return Self; + Instance.Field = value; + return this; } /// @@ -206,34 +341,32 @@ public SetProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public SetProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to insert, upsert, or update. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public SetProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// /// - /// The field to insert, upsert, or update. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public SetProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -241,10 +374,10 @@ public SetProcessorDescriptor Field(Expression /// - public SetProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -252,10 +385,10 @@ public SetProcessorDescriptor If(string? value) /// If true and value is a template snippet that evaluates to null or the empty string, the processor quietly exits without modifying the document. /// /// - public SetProcessorDescriptor IgnoreEmptyValue(bool? ignoreEmptyValue = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor IgnoreEmptyValue(bool? value = true) { - IgnoreEmptyValueValue = ignoreEmptyValue; - return Self; + Instance.IgnoreEmptyValue = value; + return this; } /// @@ -263,10 +396,10 @@ public SetProcessorDescriptor IgnoreEmptyValue(bool? ignoreEmptyValue /// Ignore failures for the processor. /// /// - public SetProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -276,10 +409,10 @@ public SetProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tru /// Must be one of application/json, text/plain, or application/x-www-form-urlencoded. /// /// - public SetProcessorDescriptor MediaType(string? mediaType) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor MediaType(string? value) { - MediaTypeValue = mediaType; - return Self; + Instance.MediaType = value; + return this; } /// @@ -287,40 +420,38 @@ public SetProcessorDescriptor MediaType(string? mediaType) /// Handle failures for the processor. /// /// - public SetProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public SetProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SetProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public SetProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -329,10 +460,10 @@ public SetProcessorDescriptor OnFailure(params Actionfalse, such fields will not be touched. /// /// - public SetProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -341,10 +472,10 @@ public SetProcessorDescriptor Override(bool? value = true) /// Useful for debugging and metrics. /// /// - public SetProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -354,128 +485,39 @@ public SetProcessorDescriptor Tag(string? tag) /// May specify only one of value or copy_from. /// /// - public SetProcessorDescriptor Value(object? value) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Value(object? value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SetProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (CopyFromValue is not null) - { - writer.WritePropertyName("copy_from"); - JsonSerializer.Serialize(writer, CopyFromValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreEmptyValueValue.HasValue) - { - writer.WritePropertyName("ignore_empty_value"); - writer.WriteBooleanValue(IgnoreEmptyValueValue.Value); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(MediaTypeValue)) - { - writer.WritePropertyName("media_type"); - writer.WriteStringValue(MediaTypeValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (ValueValue is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SetProcessorDescriptor : SerializableDescriptor +public readonly partial struct SetProcessorDescriptor { - internal SetProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SetProcessor Instance { get; init; } - public SetProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetProcessor instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? CopyFromValue { get; set; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreEmptyValueValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private string? MediaTypeValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private bool? OverrideValue { get; set; } - private string? TagValue { get; set; } - private object? ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -483,10 +525,10 @@ public SetProcessorDescriptor() : base() /// Supported data types are boolean, number, array, object, string, date, etc. /// /// - public SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch.Field? copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch.Field? value) { - CopyFromValue = copyFrom; - return Self; + Instance.CopyFrom = value; + return this; } /// @@ -495,34 +537,34 @@ public SetProcessorDescriptor CopyFrom(Elastic.Clients.Elasticsearch.Field? copy /// Supported data types are boolean, number, array, object, string, date, etc. /// /// - public SetProcessorDescriptor CopyFrom(Expression> copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor CopyFrom(System.Linq.Expressions.Expression> value) { - CopyFromValue = copyFrom; - return Self; + Instance.CopyFrom = value; + return this; } /// /// - /// The origin field which will be copied to field, cannot set value simultaneously. - /// Supported data types are boolean, number, array, object, string, date, etc. + /// Description of the processor. + /// Useful for describing the purpose of the processor or its configuration. /// /// - public SetProcessorDescriptor CopyFrom(Expression> copyFrom) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Description(string? value) { - CopyFromValue = copyFrom; - return Self; + Instance.Description = value; + return this; } /// /// - /// Description of the processor. - /// Useful for describing the purpose of the processor or its configuration. + /// The field to insert, upsert, or update. + /// Supports template snippets. /// /// - public SetProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - DescriptionValue = description; - return Self; + Instance.Field = value; + return this; } /// @@ -531,34 +573,32 @@ public SetProcessorDescriptor Description(string? description) /// Supports template snippets. /// /// - public SetProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to insert, upsert, or update. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public SetProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// /// - /// The field to insert, upsert, or update. - /// Supports template snippets. + /// Conditionally execute the processor. /// /// - public SetProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -566,10 +606,10 @@ public SetProcessorDescriptor Field(Expression /// - public SetProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -577,10 +617,10 @@ public SetProcessorDescriptor If(string? value) /// If true and value is a template snippet that evaluates to null or the empty string, the processor quietly exits without modifying the document. /// /// - public SetProcessorDescriptor IgnoreEmptyValue(bool? ignoreEmptyValue = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor IgnoreEmptyValue(bool? value = true) { - IgnoreEmptyValueValue = ignoreEmptyValue; - return Self; + Instance.IgnoreEmptyValue = value; + return this; } /// @@ -588,10 +628,10 @@ public SetProcessorDescriptor IgnoreEmptyValue(bool? ignoreEmptyValue = true) /// Ignore failures for the processor. /// /// - public SetProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -601,10 +641,10 @@ public SetProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// Must be one of application/json, text/plain, or application/x-www-form-urlencoded. /// /// - public SetProcessorDescriptor MediaType(string? mediaType) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor MediaType(string? value) { - MediaTypeValue = mediaType; - return Self; + Instance.MediaType = value; + return this; } /// @@ -612,40 +652,55 @@ public SetProcessorDescriptor MediaType(string? mediaType) /// Handle failures for the processor. /// /// - public SetProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public SetProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SetProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public SetProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -654,10 +709,10 @@ public SetProcessorDescriptor OnFailure(params Actionfalse, such fields will not be touched. /// /// - public SetProcessorDescriptor Override(bool? value = true) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Override(bool? value = true) { - OverrideValue = value; - return Self; + Instance.Override = value; + return this; } /// @@ -666,10 +721,10 @@ public SetProcessorDescriptor Override(bool? value = true) /// Useful for debugging and metrics. /// /// - public SetProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -679,102 +734,17 @@ public SetProcessorDescriptor Tag(string? tag) /// May specify only one of value or copy_from. /// /// - public SetProcessorDescriptor Value(object? value) + public Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor Value(object? value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SetProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (CopyFromValue is not null) - { - writer.WritePropertyName("copy_from"); - JsonSerializer.Serialize(writer, CopyFromValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreEmptyValueValue.HasValue) - { - writer.WritePropertyName("ignore_empty_value"); - writer.WriteBooleanValue(IgnoreEmptyValueValue.Value); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (!string.IsNullOrEmpty(MediaTypeValue)) - { - writer.WritePropertyName("media_type"); - writer.WriteStringValue(MediaTypeValue); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OverrideValue.HasValue) - { - writer.WritePropertyName("override"); - writer.WriteBooleanValue(OverrideValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (ValueValue is not null) - { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SetProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SetProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetSecurityUserProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetSecurityUserProcessor.g.cs index b5ffe1a8ec9..aa8f9e687e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetSecurityUserProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SetSecurityUserProcessor.g.cs @@ -17,25 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class SetSecurityUserProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProperties = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Properties = propProperties.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorConverter))] public sealed partial class SetSecurityUserProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public SetSecurityUserProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SetSecurityUserProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +154,24 @@ public sealed partial class SetSecurityUserProcessor /// The field to store the user information into. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,16 +179,14 @@ public sealed partial class SetSecurityUserProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Controls what user related properties are added to the field. /// /// - [JsonInclude, JsonPropertyName("properties")] - public ICollection? Properties { get; set; } + public System.Collections.Generic.ICollection? Properties { get; set; } /// /// @@ -84,30 +194,27 @@ public sealed partial class SetSecurityUserProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(SetSecurityUserProcessor setSecurityUserProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.SetSecurityUser(setSecurityUserProcessor); } -public sealed partial class SetSecurityUserProcessorDescriptor : SerializableDescriptor> +public readonly partial struct SetSecurityUserProcessorDescriptor { - internal SetSecurityUserProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSecurityUserProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor instance) + { + Instance = instance; + } - public SetSecurityUserProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSecurityUserProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -115,10 +222,10 @@ public SetSecurityUserProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SetSecurityUserProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -126,10 +233,10 @@ public SetSecurityUserProcessorDescriptor Description(string? descrip /// The field to store the user information into. /// /// - public SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -137,21 +244,21 @@ public SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elast /// The field to store the user information into. /// /// - public SetSecurityUserProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to store the user information into. + /// Conditionally execute the processor. /// /// - public SetSecurityUserProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -159,10 +266,21 @@ public SetSecurityUserProcessorDescriptor Field(Expression /// - public SetSecurityUserProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -170,10 +288,10 @@ public SetSecurityUserProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public SetSecurityUserProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -181,40 +299,49 @@ public SetSecurityUserProcessorDescriptor IgnoreFailure(bool? ignoreF /// Handle failures for the processor. /// /// - public SetSecurityUserProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Controls what user related properties are added to the field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Properties = value; + return this; } /// @@ -222,10 +349,10 @@ public SetSecurityUserProcessorDescriptor OnFailure(params Action /// - public SetSecurityUserProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Properties(params string[] values) { - PropertiesValue = properties; - return Self; + Instance.Properties = [.. values]; + return this; } /// @@ -234,100 +361,39 @@ public SetSecurityUserProcessorDescriptor Properties(ICollection /// - public SetSecurityUserProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SetSecurityUserProcessorDescriptor : SerializableDescriptor +public readonly partial struct SetSecurityUserProcessorDescriptor { - internal SetSecurityUserProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor Instance { get; init; } - public SetSecurityUserProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSecurityUserProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSecurityUserProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -335,10 +401,10 @@ public SetSecurityUserProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SetSecurityUserProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -346,10 +412,10 @@ public SetSecurityUserProcessorDescriptor Description(string? description) /// The field to store the user information into. /// /// - public SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -357,21 +423,21 @@ public SetSecurityUserProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to store the user information into. /// /// - public SetSecurityUserProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to store the user information into. + /// Conditionally execute the processor. /// /// - public SetSecurityUserProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -379,10 +445,21 @@ public SetSecurityUserProcessorDescriptor Field(Expression /// - public SetSecurityUserProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -390,10 +467,21 @@ public SetSecurityUserProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public SetSecurityUserProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor IgnoreFailure(bool? value = true) + { + Instance.IgnoreFailure = value; + return this; + } + + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.OnFailure = value; + return this; } /// @@ -401,40 +489,55 @@ public SetSecurityUserProcessorDescriptor IgnoreFailure(bool? ignoreFailure = tr /// Handle failures for the processor. /// /// - public SetSecurityUserProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public SetSecurityUserProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Controls what user related properties are added to the field. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.Properties = value; + return this; } /// @@ -442,10 +545,10 @@ public SetSecurityUserProcessorDescriptor OnFailure(params Action /// - public SetSecurityUserProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Properties(params string[] values) { - PropertiesValue = properties; - return Self; + Instance.Properties = [.. values]; + return this; } /// @@ -454,78 +557,17 @@ public SetSecurityUserProcessorDescriptor Properties(ICollection? proper /// Useful for debugging and metrics. /// /// - public SetSecurityUserProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SetSecurityUserProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SimulateDocumentResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SimulateDocumentResult.g.cs index 0fdf45f2322..9925fa0b5f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SimulateDocumentResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SimulateDocumentResult.g.cs @@ -17,22 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class SimulateDocumentResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropProcessorResults = System.Text.Json.JsonEncodedText.Encode("processor_results"); + + public override Elastic.Clients.Elasticsearch.Ingest.SimulateDocumentResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoc = default; + LocalJsonValue propError = default; + LocalJsonValue?> propProcessorResults = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propProcessorResults.TryReadProperty(ref reader, options, PropProcessorResults, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SimulateDocumentResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Doc = propDoc.Value, + Error = propError.Value, + ProcessorResults = propProcessorResults.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SimulateDocumentResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropProcessorResults, value.ProcessorResults, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SimulateDocumentResultConverter))] public sealed partial class SimulateDocumentResult { - [JsonInclude, JsonPropertyName("doc")] - public Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation? Doc { get; init; } - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("processor_results")] - public IReadOnlyCollection? ProcessorResults { get; init; } +#if NET7_0_OR_GREATER + public SimulateDocumentResult() + { + } +#endif +#if !NET7_0_OR_GREATER + public SimulateDocumentResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateDocumentResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Ingest.DocumentSimulation? Doc { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public System.Collections.Generic.IReadOnlyCollection? ProcessorResults { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SortProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SortProcessor.g.cs index a332228c4f9..4e68a7fce1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SortProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SortProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class SortProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.SortProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propOrder = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Order = propOrder.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SortProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SortProcessorConverter))] public sealed partial class SortProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public SortProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SortProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class SortProcessor /// The field to be sorted. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,8 +188,7 @@ public sealed partial class SortProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -76,7 +196,6 @@ public sealed partial class SortProcessor /// Accepts "asc" or "desc". /// /// - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } /// @@ -85,7 +204,6 @@ public sealed partial class SortProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -94,31 +212,27 @@ public sealed partial class SortProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(SortProcessor sortProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Sort(sortProcessor); } -public sealed partial class SortProcessorDescriptor : SerializableDescriptor> +public readonly partial struct SortProcessorDescriptor { - internal SortProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SortProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SortProcessor instance) + { + Instance = instance; + } - public SortProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SortProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -126,10 +240,10 @@ public SortProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SortProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -137,10 +251,10 @@ public SortProcessorDescriptor Description(string? description) /// The field to be sorted. /// /// - public SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -148,21 +262,21 @@ public SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The field to be sorted. /// /// - public SortProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be sorted. + /// Conditionally execute the processor. /// /// - public SortProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -170,62 +284,71 @@ public SortProcessorDescriptor Field(Expression /// - public SortProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public SortProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public SortProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public SortProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public SortProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SortProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -234,10 +357,10 @@ public SortProcessorDescriptor OnFailure(params Action"asc" or "desc". /// /// - public SortProcessorDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } /// @@ -246,10 +369,10 @@ public SortProcessorDescriptor Order(Elastic.Clients.Elasticsearch.So /// Useful for debugging and metrics. /// /// - public SortProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -258,10 +381,10 @@ public SortProcessorDescriptor Tag(string? tag) /// By default, the field is updated in-place. /// /// - public SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -270,119 +393,39 @@ public SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// By default, the field is updated in-place. /// /// - public SortProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// The field to assign the sorted value to. - /// By default, the field is updated in-place. - /// - /// - public SortProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SortProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SortProcessorDescriptor : SerializableDescriptor +public readonly partial struct SortProcessorDescriptor { - internal SortProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SortProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SortProcessor instance) + { + Instance = instance; + } - public SortProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SortProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -390,10 +433,10 @@ public SortProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SortProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -401,10 +444,10 @@ public SortProcessorDescriptor Description(string? description) /// The field to be sorted. /// /// - public SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -412,21 +455,21 @@ public SortProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to be sorted. /// /// - public SortProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to be sorted. + /// Conditionally execute the processor. /// /// - public SortProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -434,98 +477,112 @@ public SortProcessorDescriptor Field(Expression /// - public SortProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public SortProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// Handle failures for the processor. + /// Ignore failures for the processor. /// /// - public SortProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public SortProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = value; + return this; } - public SortProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SortProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The sort order to use. - /// Accepts "asc" or "desc". + /// Handle failures for the processor. /// /// - public SortProcessorDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor OnFailure(params System.Action>[] actions) { - OrderValue = order; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The sort order to use. + /// Accepts "asc" or "desc". /// /// - public SortProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - TagValue = tag; - return Self; + Instance.Order = value; + return this; } /// /// - /// The field to assign the sorted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -534,10 +591,10 @@ public SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public SortProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -546,84 +603,17 @@ public SortProcessorDescriptor TargetField(Expression /// - public SortProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SortProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SortProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SortProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SplitProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SplitProcessor.g.cs index 898d5a4ca31..3414e2f7b58 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SplitProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/SplitProcessor.g.cs @@ -17,25 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class SplitProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveTrailing = System.Text.Json.JsonEncodedText.Encode("preserve_trailing"); + private static readonly System.Text.Json.JsonEncodedText PropSeparator = System.Text.Json.JsonEncodedText.Encode("separator"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.SplitProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propPreserveTrailing = default; + LocalJsonValue propSeparator = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propPreserveTrailing.TryReadProperty(ref reader, options, PropPreserveTrailing, null)) + { + continue; + } + + if (propSeparator.TryReadProperty(ref reader, options, PropSeparator, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + PreserveTrailing = propPreserveTrailing.Value, + Separator = propSeparator.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.SplitProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPreserveTrailing, value.PreserveTrailing, null, null); + writer.WriteProperty(options, PropSeparator, value.Separator, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.SplitProcessorConverter))] public sealed partial class SplitProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitProcessor(Elastic.Clients.Elasticsearch.Field field, string separator) + { + Field = field; + Separator = separator; + } +#if NET7_0_OR_GREATER + public SplitProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SplitProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +182,24 @@ public sealed partial class SplitProcessor /// The field to split. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +207,6 @@ public sealed partial class SplitProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,15 +214,13 @@ public sealed partial class SplitProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Preserves empty trailing fields, if any. /// /// - [JsonInclude, JsonPropertyName("preserve_trailing")] public bool? PreserveTrailing { get; set; } /// @@ -91,8 +228,11 @@ public sealed partial class SplitProcessor /// A regex which matches the separator, for example, , or \s+. /// /// - [JsonInclude, JsonPropertyName("separator")] - public string Separator { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Separator { get; set; } /// /// @@ -100,7 +240,6 @@ public sealed partial class SplitProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -109,33 +248,27 @@ public sealed partial class SplitProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(SplitProcessor splitProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Split(splitProcessor); } -public sealed partial class SplitProcessorDescriptor : SerializableDescriptor> +public readonly partial struct SplitProcessorDescriptor { - internal SplitProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SplitProcessor Instance { get; init; } - public SplitProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private bool? PreserveTrailingValue { get; set; } - private string SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -143,10 +276,10 @@ public SplitProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SplitProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -154,10 +287,10 @@ public SplitProcessorDescriptor Description(string? description) /// The field to split. /// /// - public SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -165,21 +298,32 @@ public SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.F /// The field to split. /// /// - public SplitProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to split. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public SplitProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -187,10 +331,10 @@ public SplitProcessorDescriptor Field(Expression /// - public SplitProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -198,10 +342,10 @@ public SplitProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public SplitProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -209,10 +353,10 @@ public SplitProcessorDescriptor IgnoreFailure(bool? ignoreFailure = t /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public SplitProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -220,40 +364,38 @@ public SplitProcessorDescriptor IgnoreMissing(bool? ignoreMissing = t /// Handle failures for the processor. /// /// - public SplitProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public SplitProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SplitProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public SplitProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -261,10 +403,10 @@ public SplitProcessorDescriptor OnFailure(params Action /// - public SplitProcessorDescriptor PreserveTrailing(bool? preserveTrailing = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor PreserveTrailing(bool? value = true) { - PreserveTrailingValue = preserveTrailing; - return Self; + Instance.PreserveTrailing = value; + return this; } /// @@ -272,10 +414,10 @@ public SplitProcessorDescriptor PreserveTrailing(bool? preserveTraili /// A regex which matches the separator, for example, , or \s+. /// /// - public SplitProcessorDescriptor Separator(string separator) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Separator(string value) { - SeparatorValue = separator; - return Self; + Instance.Separator = value; + return this; } /// @@ -284,10 +426,10 @@ public SplitProcessorDescriptor Separator(string separator) /// Useful for debugging and metrics. /// /// - public SplitProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -296,10 +438,10 @@ public SplitProcessorDescriptor Tag(string? tag) /// By default, the field is updated in-place. /// /// - public SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -308,129 +450,39 @@ public SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticse /// By default, the field is updated in-place. /// /// - public SplitProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// The field to assign the split value to. - /// By default, the field is updated in-place. - /// - /// - public SplitProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SplitProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PreserveTrailingValue.HasValue) - { - writer.WritePropertyName("preserve_trailing"); - writer.WriteBooleanValue(PreserveTrailingValue.Value); - } - - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SplitProcessorDescriptor : SerializableDescriptor +public readonly partial struct SplitProcessorDescriptor { - internal SplitProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.SplitProcessor Instance { get; init; } - public SplitProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private bool? PreserveTrailingValue { get; set; } - private string SeparatorValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SplitProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -438,10 +490,10 @@ public SplitProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public SplitProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -449,10 +501,10 @@ public SplitProcessorDescriptor Description(string? description) /// The field to split. /// /// - public SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -460,21 +512,32 @@ public SplitProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to split. /// /// - public SplitProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to split. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public SplitProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -482,10 +545,10 @@ public SplitProcessorDescriptor Field(Expression /// - public SplitProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -493,10 +556,10 @@ public SplitProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public SplitProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -504,10 +567,10 @@ public SplitProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public SplitProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -515,86 +578,89 @@ public SplitProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public SplitProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public SplitProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public SplitProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public SplitProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Preserves empty trailing fields, if any. + /// Handle failures for the processor. /// /// - public SplitProcessorDescriptor PreserveTrailing(bool? preserveTrailing = true) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor OnFailure(params System.Action>[] actions) { - PreserveTrailingValue = preserveTrailing; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// A regex which matches the separator, for example, , or \s+. + /// Preserves empty trailing fields, if any. /// /// - public SplitProcessorDescriptor Separator(string separator) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor PreserveTrailing(bool? value = true) { - SeparatorValue = separator; - return Self; + Instance.PreserveTrailing = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// A regex which matches the separator, for example, , or \s+. /// /// - public SplitProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Separator(string value) { - TagValue = tag; - return Self; + Instance.Separator = value; + return this; } /// /// - /// The field to assign the split value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -603,10 +669,10 @@ public SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public SplitProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -615,92 +681,17 @@ public SplitProcessorDescriptor TargetField(Expression /// - public SplitProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.SplitProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PreserveTrailingValue.HasValue) - { - writer.WritePropertyName("preserve_trailing"); - writer.WriteBooleanValue(PreserveTrailingValue.Value); - } - - writer.WritePropertyName("separator"); - writer.WriteStringValue(SeparatorValue); - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.SplitProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.SplitProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TerminateProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TerminateProcessor.g.cs index 16b80dd17d9..2e103a3a538 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TerminateProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TerminateProcessor.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class TerminateProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + + public override Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorConverter))] public sealed partial class TerminateProcessor { +#if NET7_0_OR_GREATER + public TerminateProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public TerminateProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,15 +130,13 @@ public sealed partial class TerminateProcessor /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -59,8 +144,7 @@ public sealed partial class TerminateProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -68,28 +152,27 @@ public sealed partial class TerminateProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(TerminateProcessor terminateProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Terminate(terminateProcessor); } -public sealed partial class TerminateProcessorDescriptor : SerializableDescriptor> +public readonly partial struct TerminateProcessorDescriptor { - internal TerminateProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TerminateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor instance) + { + Instance = instance; + } - public TerminateProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TerminateProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -97,10 +180,10 @@ public TerminateProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public TerminateProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -108,154 +191,128 @@ public TerminateProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Handle failures for the processor. + /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If(System.Action? action) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TerminateProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) - { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; - } - - public TerminateProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Ignore failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public TerminateProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public TerminateProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(params System.Action>[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (!string.IsNullOrEmpty(IfValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TerminateProcessorDescriptor : SerializableDescriptor +public readonly partial struct TerminateProcessorDescriptor { - internal TerminateProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor Instance { get; init; } - public TerminateProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TerminateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TerminateProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -263,10 +320,10 @@ public TerminateProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public TerminateProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -274,134 +331,123 @@ public TerminateProcessorDescriptor Description(string? description) /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - IfValue = value; - return Self; + Instance.If = value; + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Handle failures for the processor. + /// Conditionally execute the processor. /// /// - public TerminateProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public TerminateProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor If(System.Action? action) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TerminateProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Ignore failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor IgnoreFailure(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.IgnoreFailure = value; + return this; } - public TerminateProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = value; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public TerminateProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - TagValue = tag; - return Self; + Instance.OnFailure = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(params System.Action[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } + Instance.OnFailure = items; + return this; + } - if (IgnoreFailureValue.HasValue) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor OnFailure(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); } - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } + Instance.OnFailure = items; + return this; + } - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } + /// + /// + /// Identifier for the processor. + /// Useful for debugging and metrics. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor Tag(string? value) + { + Instance.Tag = value; + return this; + } - if (!string.IsNullOrEmpty(TagValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); + return new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.TerminateProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TrimProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TrimProcessor.g.cs index aba47b0f834..ae620133de2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TrimProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/TrimProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class TrimProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.TrimProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.TrimProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.TrimProcessorConverter))] public sealed partial class TrimProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TrimProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrimProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class TrimProcessor /// The string-valued field to trim whitespace from. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class TrimProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class TrimProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class TrimProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class TrimProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(TrimProcessor trimProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Trim(trimProcessor); } -public sealed partial class TrimProcessorDescriptor : SerializableDescriptor> +public readonly partial struct TrimProcessorDescriptor { - internal TrimProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.TrimProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor instance) + { + Instance = instance; + } - public TrimProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public TrimProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public TrimProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public TrimProcessorDescriptor Description(string? description) /// The string-valued field to trim whitespace from. /// /// - public TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// The string-valued field to trim whitespace from. /// /// - public TrimProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The string-valued field to trim whitespace from. + /// Conditionally execute the processor. /// /// - public TrimProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public TrimProcessorDescriptor Field(Expression /// - public TrimProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public TrimProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public TrimProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public TrimProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public TrimProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public TrimProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public TrimProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public TrimProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the trimmed value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsea /// By default, the field is updated in-place. /// /// - public TrimProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public TrimProcessorDescriptor TargetField(Expression /// - public TrimProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.TrimProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TrimProcessorDescriptor : SerializableDescriptor +public readonly partial struct TrimProcessorDescriptor { - internal TrimProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.TrimProcessor Instance { get; init; } - public TrimProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrimProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public TrimProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public TrimProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public TrimProcessorDescriptor Description(string? description) /// The string-valued field to trim whitespace from. /// /// - public TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public TrimProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The string-valued field to trim whitespace from. /// /// - public TrimProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The string-valued field to trim whitespace from. + /// Conditionally execute the processor. /// /// - public TrimProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public TrimProcessorDescriptor Field(Expression /// - public TrimProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public TrimProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public TrimProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public TrimProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public TrimProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public TrimProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public TrimProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public TrimProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public TrimProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public TrimProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public TrimProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the trimmed value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? /// By default, the field is updated in-place. /// /// - public TrimProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public TrimProcessorDescriptor TargetField(Expression /// - public TrimProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.TrimProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.TrimProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.TrimProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UppercaseProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UppercaseProcessor.g.cs index 0b519e7e494..c41b363e571 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UppercaseProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UppercaseProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class UppercaseProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorConverter))] public sealed partial class UppercaseProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public UppercaseProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UppercaseProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class UppercaseProcessor /// The field to make uppercase. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class UppercaseProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class UppercaseProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class UppercaseProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class UppercaseProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(UppercaseProcessor uppercaseProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.Uppercase(uppercaseProcessor); } -public sealed partial class UppercaseProcessorDescriptor : SerializableDescriptor> +public readonly partial struct UppercaseProcessorDescriptor { - internal UppercaseProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor instance) + { + Instance = instance; + } - public UppercaseProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public UppercaseProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UppercaseProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public UppercaseProcessorDescriptor Description(string? description) /// The field to make uppercase. /// /// - public UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsear /// The field to make uppercase. /// /// - public UppercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to make uppercase. + /// Conditionally execute the processor. /// /// - public UppercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public UppercaseProcessorDescriptor Field(Expression /// - public UppercaseProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public UppercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public UppercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public UppercaseProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public UppercaseProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public UppercaseProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public UppercaseProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public UppercaseProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elast /// By default, the field is updated in-place. /// /// - public UppercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public UppercaseProcessorDescriptor TargetField(Expression /// - public UppercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UppercaseProcessorDescriptor : SerializableDescriptor +public readonly partial struct UppercaseProcessorDescriptor { - internal UppercaseProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor Instance { get; init; } - public UppercaseProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UppercaseProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public UppercaseProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UppercaseProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public UppercaseProcessorDescriptor Description(string? description) /// The field to make uppercase. /// /// - public UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public UppercaseProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fi /// The field to make uppercase. /// /// - public UppercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to make uppercase. + /// Conditionally execute the processor. /// /// - public UppercaseProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public UppercaseProcessorDescriptor Field(Expression /// - public UppercaseProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public UppercaseProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UppercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public UppercaseProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public UppercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public UppercaseProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public UppercaseProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UppercaseProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UppercaseProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public UppercaseProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public UppercaseProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fi /// By default, the field is updated in-place. /// /// - public UppercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public UppercaseProcessorDescriptor TargetField(Expression /// - public UppercaseProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UppercaseProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UriPartsProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UriPartsProcessor.g.cs index dc96910e95d..cc92a66dd15 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UriPartsProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UriPartsProcessor.g.cs @@ -17,25 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class UriPartsProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropKeepOriginal = System.Text.Json.JsonEncodedText.Encode("keep_original"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropRemoveIfSuccessful = System.Text.Json.JsonEncodedText.Encode("remove_if_successful"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue propKeepOriginal = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propRemoveIfSuccessful = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propKeepOriginal.TryReadProperty(ref reader, options, PropKeepOriginal, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoveIfSuccessful.TryReadProperty(ref reader, options, PropRemoveIfSuccessful, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + KeepOriginal = propKeepOriginal.Value, + OnFailure = propOnFailure.Value, + RemoveIfSuccessful = propRemoveIfSuccessful.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropKeepOriginal, value.KeepOriginal, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoveIfSuccessful, value.RemoveIfSuccessful, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorConverter))] public sealed partial class UriPartsProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UriPartsProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public UriPartsProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UriPartsProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +181,24 @@ public sealed partial class UriPartsProcessor /// Field containing the URI string. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +206,6 @@ public sealed partial class UriPartsProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,7 +213,6 @@ public sealed partial class UriPartsProcessor /// If true, the processor copies the unparsed URI to <target_field>.original. /// /// - [JsonInclude, JsonPropertyName("keep_original")] public bool? KeepOriginal { get; set; } /// @@ -83,8 +220,7 @@ public sealed partial class UriPartsProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -92,7 +228,6 @@ public sealed partial class UriPartsProcessor /// If parsing fails, the processor does not remove the field. /// /// - [JsonInclude, JsonPropertyName("remove_if_successful")] public bool? RemoveIfSuccessful { get; set; } /// @@ -101,7 +236,6 @@ public sealed partial class UriPartsProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -109,33 +243,27 @@ public sealed partial class UriPartsProcessor /// Output field for the URI object. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(UriPartsProcessor uriPartsProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.UriParts(uriPartsProcessor); } -public sealed partial class UriPartsProcessorDescriptor : SerializableDescriptor> +public readonly partial struct UriPartsProcessorDescriptor { - internal UriPartsProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor Instance { get; init; } - public UriPartsProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UriPartsProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private bool? KeepOriginalValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private bool? RemoveIfSuccessfulValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UriPartsProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -143,10 +271,10 @@ public UriPartsProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UriPartsProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -154,10 +282,10 @@ public UriPartsProcessorDescriptor Description(string? description) /// Field containing the URI string. /// /// - public UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -165,21 +293,32 @@ public UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearc /// Field containing the URI string. /// /// - public UriPartsProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing the URI string. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public UriPartsProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -187,10 +326,10 @@ public UriPartsProcessorDescriptor Field(Expression /// - public UriPartsProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -198,10 +337,10 @@ public UriPartsProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UriPartsProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -209,10 +348,10 @@ public UriPartsProcessorDescriptor IgnoreFailure(bool? ignoreFailure /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public UriPartsProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -220,10 +359,10 @@ public UriPartsProcessorDescriptor IgnoreMissing(bool? ignoreMissing /// If true, the processor copies the unparsed URI to <target_field>.original. /// /// - public UriPartsProcessorDescriptor KeepOriginal(bool? keepOriginal = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor KeepOriginal(bool? value = true) { - KeepOriginalValue = keepOriginal; - return Self; + Instance.KeepOriginal = value; + return this; } /// @@ -231,40 +370,38 @@ public UriPartsProcessorDescriptor KeepOriginal(bool? keepOriginal = /// Handle failures for the processor. /// /// - public UriPartsProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UriPartsProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UriPartsProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public UriPartsProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -273,10 +410,10 @@ public UriPartsProcessorDescriptor OnFailure(params Actionfield. /// /// - public UriPartsProcessorDescriptor RemoveIfSuccessful(bool? removeIfSuccessful = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor RemoveIfSuccessful(bool? value = true) { - RemoveIfSuccessfulValue = removeIfSuccessful; - return Self; + Instance.RemoveIfSuccessful = value; + return this; } /// @@ -285,10 +422,10 @@ public UriPartsProcessorDescriptor RemoveIfSuccessful(bool? removeIfS /// Useful for debugging and metrics. /// /// - public UriPartsProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Tag(string? value) { - TagValue = tag; - return Self; + Instance.Tag = value; + return this; } /// @@ -296,10 +433,10 @@ public UriPartsProcessorDescriptor Tag(string? tag) /// Output field for the URI object. /// /// - public UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -307,132 +444,39 @@ public UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasti /// Output field for the URI object. /// /// - public UriPartsProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - /// - /// - /// Output field for the URI object. - /// - /// - public UriPartsProcessorDescriptor TargetField(Expression> targetField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor Build(System.Action> action) { - TargetFieldValue = targetField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (KeepOriginalValue.HasValue) - { - writer.WritePropertyName("keep_original"); - writer.WriteBooleanValue(KeepOriginalValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (RemoveIfSuccessfulValue.HasValue) - { - writer.WritePropertyName("remove_if_successful"); - writer.WriteBooleanValue(RemoveIfSuccessfulValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UriPartsProcessorDescriptor : SerializableDescriptor +public readonly partial struct UriPartsProcessorDescriptor { - internal UriPartsProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor Instance { get; init; } - public UriPartsProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UriPartsProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private bool? KeepOriginalValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private bool? RemoveIfSuccessfulValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UriPartsProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -440,10 +484,10 @@ public UriPartsProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UriPartsProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -451,10 +495,10 @@ public UriPartsProcessorDescriptor Description(string? description) /// Field containing the URI string. /// /// - public UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -462,21 +506,32 @@ public UriPartsProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fie /// Field containing the URI string. /// /// - public UriPartsProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Field containing the URI string. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public UriPartsProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -484,10 +539,10 @@ public UriPartsProcessorDescriptor Field(Expression /// - public UriPartsProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -495,10 +550,10 @@ public UriPartsProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UriPartsProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -506,10 +561,10 @@ public UriPartsProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public UriPartsProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -517,10 +572,10 @@ public UriPartsProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// If true, the processor copies the unparsed URI to <target_field>.original. /// /// - public UriPartsProcessorDescriptor KeepOriginal(bool? keepOriginal = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor KeepOriginal(bool? value = true) { - KeepOriginalValue = keepOriginal; - return Self; + Instance.KeepOriginal = value; + return this; } /// @@ -528,75 +583,79 @@ public UriPartsProcessorDescriptor KeepOriginal(bool? keepOriginal = true) /// Handle failures for the processor. /// /// - public UriPartsProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UriPartsProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UriPartsProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public UriPartsProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// If true, the processor removes the field after parsing the URI string. - /// If parsing fails, the processor does not remove the field. + /// Handle failures for the processor. /// /// - public UriPartsProcessorDescriptor RemoveIfSuccessful(bool? removeIfSuccessful = true) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor OnFailure(params System.Action>[] actions) { - RemoveIfSuccessfulValue = removeIfSuccessful; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// If true, the processor removes the field after parsing the URI string. + /// If parsing fails, the processor does not remove the field. /// /// - public UriPartsProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor RemoveIfSuccessful(bool? value = true) { - TagValue = tag; - return Self; + Instance.RemoveIfSuccessful = value; + return this; } /// /// - /// Output field for the URI object. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -604,10 +663,10 @@ public UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fie /// Output field for the URI object. /// /// - public UriPartsProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -615,96 +674,17 @@ public UriPartsProcessorDescriptor TargetField(Expression /// - public UriPartsProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (KeepOriginalValue.HasValue) - { - writer.WritePropertyName("keep_original"); - writer.WriteBooleanValue(KeepOriginalValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (RemoveIfSuccessfulValue.HasValue) - { - writer.WritePropertyName("remove_if_successful"); - writer.WriteBooleanValue(RemoveIfSuccessfulValue.Value); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UriPartsProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UrlDecodeProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UrlDecodeProcessor.g.cs index c851950f904..5cd7f35f782 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UrlDecodeProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UrlDecodeProcessor.g.cs @@ -17,25 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class UrlDecodeProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorConverter))] public sealed partial class UrlDecodeProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public UrlDecodeProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UrlDecodeProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,23 +163,24 @@ public sealed partial class UrlDecodeProcessor /// The field to decode. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -67,7 +188,6 @@ public sealed partial class UrlDecodeProcessor /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -75,8 +195,7 @@ public sealed partial class UrlDecodeProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// @@ -84,7 +203,6 @@ public sealed partial class UrlDecodeProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -93,31 +211,27 @@ public sealed partial class UrlDecodeProcessor /// By default, the field is updated in-place. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(UrlDecodeProcessor urlDecodeProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.UrlDecode(urlDecodeProcessor); } -public sealed partial class UrlDecodeProcessorDescriptor : SerializableDescriptor> +public readonly partial struct UrlDecodeProcessorDescriptor { - internal UrlDecodeProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UrlDecodeProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor instance) + { + Instance = instance; + } - public UrlDecodeProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UrlDecodeProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -125,10 +239,10 @@ public UrlDecodeProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UrlDecodeProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -136,10 +250,10 @@ public UrlDecodeProcessorDescriptor Description(string? description) /// The field to decode. /// /// - public UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -147,21 +261,21 @@ public UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsear /// The field to decode. /// /// - public UrlDecodeProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to decode. + /// Conditionally execute the processor. /// /// - public UrlDecodeProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -169,97 +283,94 @@ public UrlDecodeProcessorDescriptor Field(Expression /// - public UrlDecodeProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// Ignore failures for the processor. + /// Conditionally execute the processor. /// /// - public UrlDecodeProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If(System.Action? action) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// /// - /// If true and field does not exist or is null, the processor quietly exits without modifying the document. + /// Ignore failures for the processor. /// /// - public UrlDecodeProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreFailure = value; + return this; } /// /// - /// Handle failures for the processor. + /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public UrlDecodeProcessorDescriptor OnFailure(ICollection? onFailure) - { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; - } - - public UrlDecodeProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor IgnoreMissing(bool? value = true) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.IgnoreMissing = value; + return this; } - public UrlDecodeProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + Instance.OnFailure = value; + return this; } - public UrlDecodeProcessorDescriptor OnFailure(params Action>[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public UrlDecodeProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -268,10 +379,10 @@ public UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elast /// By default, the field is updated in-place. /// /// - public UrlDecodeProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -280,107 +391,39 @@ public UrlDecodeProcessorDescriptor TargetField(Expression /// - public UrlDecodeProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UrlDecodeProcessorDescriptor : SerializableDescriptor +public readonly partial struct UrlDecodeProcessorDescriptor { - internal UrlDecodeProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor Instance { get; init; } - public UrlDecodeProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UrlDecodeProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UrlDecodeProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -388,10 +431,10 @@ public UrlDecodeProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UrlDecodeProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -399,10 +442,10 @@ public UrlDecodeProcessorDescriptor Description(string? description) /// The field to decode. /// /// - public UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -410,21 +453,21 @@ public UrlDecodeProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fi /// The field to decode. /// /// - public UrlDecodeProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to decode. + /// Conditionally execute the processor. /// /// - public UrlDecodeProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -432,10 +475,21 @@ public UrlDecodeProcessorDescriptor Field(Expression /// - public UrlDecodeProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -443,10 +497,10 @@ public UrlDecodeProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UrlDecodeProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -454,10 +508,10 @@ public UrlDecodeProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist or is null, the processor quietly exits without modifying the document. /// /// - public UrlDecodeProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -465,64 +519,67 @@ public UrlDecodeProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public UrlDecodeProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UrlDecodeProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UrlDecodeProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public UrlDecodeProcessorDescriptor OnFailure(params Action[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// Handle failures for the processor. /// /// - public UrlDecodeProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor OnFailure(params System.Action>[] actions) { - TagValue = tag; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// /// - /// The field to assign the converted value to. - /// By default, the field is updated in-place. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -531,10 +588,10 @@ public UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fi /// By default, the field is updated in-place. /// /// - public UrlDecodeProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -543,84 +600,17 @@ public UrlDecodeProcessorDescriptor TargetField(Expression /// - public UrlDecodeProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UrlDecodeProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UserAgentProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UserAgentProcessor.g.cs index 34a08b30431..f2c89acd4bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UserAgentProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/UserAgentProcessor.g.cs @@ -17,25 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; +internal sealed partial class UserAgentProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropExtractDeviceType = System.Text.Json.JsonEncodedText.Encode("extract_device_type"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropIf = System.Text.Json.JsonEncodedText.Encode("if"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMissing = System.Text.Json.JsonEncodedText.Encode("ignore_missing"); + private static readonly System.Text.Json.JsonEncodedText PropOnFailure = System.Text.Json.JsonEncodedText.Encode("on_failure"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRegexFile = System.Text.Json.JsonEncodedText.Encode("regex_file"); + private static readonly System.Text.Json.JsonEncodedText PropTag = System.Text.Json.JsonEncodedText.Encode("tag"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + + public override Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propExtractDeviceType = default; + LocalJsonValue propField = default; + LocalJsonValue propIf = default; + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propIgnoreMissing = default; + LocalJsonValue?> propOnFailure = default; + LocalJsonValue?> propProperties = default; + LocalJsonValue propRegexFile = default; + LocalJsonValue propTag = default; + LocalJsonValue propTargetField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propExtractDeviceType.TryReadProperty(ref reader, options, PropExtractDeviceType, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propIf.TryReadProperty(ref reader, options, PropIf, null)) + { + continue; + } + + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propIgnoreMissing.TryReadProperty(ref reader, options, PropIgnoreMissing, null)) + { + continue; + } + + if (propOnFailure.TryReadProperty(ref reader, options, PropOnFailure, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRegexFile.TryReadProperty(ref reader, options, PropRegexFile, null)) + { + continue; + } + + if (propTag.TryReadProperty(ref reader, options, PropTag, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + ExtractDeviceType = propExtractDeviceType.Value, + Field = propField.Value, + If = propIf.Value, + IgnoreFailure = propIgnoreFailure.Value, + IgnoreMissing = propIgnoreMissing.Value, + OnFailure = propOnFailure.Value, + Properties = propProperties.Value, + RegexFile = propRegexFile.Value, + Tag = propTag.Value, + TargetField = propTargetField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropExtractDeviceType, value.ExtractDeviceType, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropIf, value.If, null, null); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropIgnoreMissing, value.IgnoreMissing, null, null); + writer.WriteProperty(options, PropOnFailure, value.OnFailure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRegexFile, value.RegexFile, null, null); + writer.WriteProperty(options, PropTag, value.Tag, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorConverter))] public sealed partial class UserAgentProcessor { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserAgentProcessor(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public UserAgentProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserAgentProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Description of the processor. /// Useful for describing the purpose of the processor or its configuration. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -43,7 +190,6 @@ public sealed partial class UserAgentProcessor /// Extracts device type from the user agent string on a best-effort basis. /// /// - [JsonInclude, JsonPropertyName("extract_device_type")] public bool? ExtractDeviceType { get; set; } /// @@ -51,23 +197,24 @@ public sealed partial class UserAgentProcessor /// The field containing the user agent string. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Conditionally execute the processor. /// /// - [JsonInclude, JsonPropertyName("if")] - public string? If { get; set; } + public Elastic.Clients.Elasticsearch.Script? If { get; set; } /// /// /// Ignore failures for the processor. /// /// - [JsonInclude, JsonPropertyName("ignore_failure")] public bool? IgnoreFailure { get; set; } /// @@ -75,7 +222,6 @@ public sealed partial class UserAgentProcessor /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } /// @@ -83,23 +229,20 @@ public sealed partial class UserAgentProcessor /// Handle failures for the processor. /// /// - [JsonInclude, JsonPropertyName("on_failure")] - public ICollection? OnFailure { get; set; } + public System.Collections.Generic.ICollection? OnFailure { get; set; } /// /// /// Controls what properties are added to target_field. /// /// - [JsonInclude, JsonPropertyName("properties")] - public ICollection? Properties { get; set; } + public System.Collections.Generic.ICollection? Properties { get; set; } /// /// /// The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user agent string. Both the directory and the file have to be created before starting Elasticsearch. If not specified, ingest-user-agent will use the regexes.yaml from uap-core it ships with. /// /// - [JsonInclude, JsonPropertyName("regex_file")] public string? RegexFile { get; set; } /// @@ -108,7 +251,6 @@ public sealed partial class UserAgentProcessor /// Useful for debugging and metrics. /// /// - [JsonInclude, JsonPropertyName("tag")] public string? Tag { get; set; } /// @@ -116,34 +258,27 @@ public sealed partial class UserAgentProcessor /// The field that will be filled with the user agent details. /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Ingest.Processor(UserAgentProcessor userAgentProcessor) => Elastic.Clients.Elasticsearch.Ingest.Processor.UserAgent(userAgentProcessor); } -public sealed partial class UserAgentProcessorDescriptor : SerializableDescriptor> +public readonly partial struct UserAgentProcessorDescriptor { - internal UserAgentProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserAgentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor instance) + { + Instance = instance; + } - public UserAgentProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserAgentProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? DescriptionValue { get; set; } - private bool? ExtractDeviceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action> OnFailureDescriptorAction { get; set; } - private Action>[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? RegexFileValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -151,10 +286,10 @@ public UserAgentProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UserAgentProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -162,10 +297,10 @@ public UserAgentProcessorDescriptor Description(string? description) /// Extracts device type from the user agent string on a best-effort basis. /// /// - public UserAgentProcessorDescriptor ExtractDeviceType(bool? extractDeviceType = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor ExtractDeviceType(bool? value = true) { - ExtractDeviceTypeValue = extractDeviceType; - return Self; + Instance.ExtractDeviceType = value; + return this; } /// @@ -173,10 +308,10 @@ public UserAgentProcessorDescriptor ExtractDeviceType(bool? extractDe /// The field containing the user agent string. /// /// - public UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -184,21 +319,21 @@ public UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsear /// The field containing the user agent string. /// /// - public UserAgentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field containing the user agent string. + /// Conditionally execute the processor. /// /// - public UserAgentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) { - FieldValue = field; - return Self; + Instance.If = value; + return this; } /// @@ -206,10 +341,21 @@ public UserAgentProcessorDescriptor Field(Expression /// - public UserAgentProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If() { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If(System.Action? action) + { + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -217,10 +363,10 @@ public UserAgentProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UserAgentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -228,10 +374,10 @@ public UserAgentProcessorDescriptor IgnoreFailure(bool? ignoreFailure /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public UserAgentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -239,40 +385,38 @@ public UserAgentProcessorDescriptor IgnoreMissing(bool? ignoreMissing /// Handle failures for the processor. /// /// - public UserAgentProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UserAgentProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UserAgentProcessorDescriptor OnFailure(Action> configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } - public UserAgentProcessorDescriptor OnFailure(params Action>[] configure) - { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + Instance.OnFailure = items; + return this; } /// @@ -280,44 +424,44 @@ public UserAgentProcessorDescriptor OnFailure(params Actiontarget_field. /// /// - public UserAgentProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user agent string. Both the directory and the file have to be created before starting Elasticsearch. If not specified, ingest-user-agent will use the regexes.yaml from uap-core it ships with. + /// Controls what properties are added to target_field. /// /// - public UserAgentProcessorDescriptor RegexFile(string? regexFile) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Properties(params Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty[] values) { - RegexFileValue = regexFile; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user agent string. Both the directory and the file have to be created before starting Elasticsearch. If not specified, ingest-user-agent will use the regexes.yaml from uap-core it ships with. /// /// - public UserAgentProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor RegexFile(string? value) { - TagValue = tag; - return Self; + Instance.RegexFile = value; + return this; } /// /// - /// The field that will be filled with the user agent details. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -325,10 +469,10 @@ public UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elast /// The field that will be filled with the user agent details. /// /// - public UserAgentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -336,128 +480,39 @@ public UserAgentProcessorDescriptor TargetField(Expression /// - public UserAgentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (ExtractDeviceTypeValue.HasValue) - { - writer.WritePropertyName("extract_device_type"); - writer.WriteBooleanValue(ExtractDeviceTypeValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(RegexFileValue)) - { - writer.WritePropertyName("regex_file"); - writer.WriteStringValue(RegexFileValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UserAgentProcessorDescriptor : SerializableDescriptor +public readonly partial struct UserAgentProcessorDescriptor { - internal UserAgentProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor Instance { get; init; } - public UserAgentProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserAgentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor instance) { + Instance = instance; } - private string? DescriptionValue { get; set; } - private bool? ExtractDeviceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? IfValue { get; set; } - private bool? IgnoreFailureValue { get; set; } - private bool? IgnoreMissingValue { get; set; } - private ICollection? OnFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } - private Action OnFailureDescriptorAction { get; set; } - private Action[] OnFailureDescriptorActions { get; set; } - private ICollection? PropertiesValue { get; set; } - private string? RegexFileValue { get; set; } - private string? TagValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserAgentProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor instance) => new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor descriptor) => descriptor.Instance; /// /// @@ -465,10 +520,10 @@ public UserAgentProcessorDescriptor() : base() /// Useful for describing the purpose of the processor or its configuration. /// /// - public UserAgentProcessorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -476,10 +531,10 @@ public UserAgentProcessorDescriptor Description(string? description) /// Extracts device type from the user agent string on a best-effort basis. /// /// - public UserAgentProcessorDescriptor ExtractDeviceType(bool? extractDeviceType = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor ExtractDeviceType(bool? value = true) { - ExtractDeviceTypeValue = extractDeviceType; - return Self; + Instance.ExtractDeviceType = value; + return this; } /// @@ -487,10 +542,10 @@ public UserAgentProcessorDescriptor ExtractDeviceType(bool? extractDeviceType = /// The field containing the user agent string. /// /// - public UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -498,21 +553,32 @@ public UserAgentProcessorDescriptor Field(Elastic.Clients.Elasticsearch.Field fi /// The field containing the user agent string. /// /// - public UserAgentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field containing the user agent string. + /// Conditionally execute the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.If = value; + return this; + } + + /// + /// + /// Conditionally execute the processor. /// /// - public UserAgentProcessorDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If() { - FieldValue = field; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// @@ -520,10 +586,10 @@ public UserAgentProcessorDescriptor Field(Expression /// - public UserAgentProcessorDescriptor If(string? value) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor If(System.Action? action) { - IfValue = value; - return Self; + Instance.If = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -531,10 +597,10 @@ public UserAgentProcessorDescriptor If(string? value) /// Ignore failures for the processor. /// /// - public UserAgentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor IgnoreFailure(bool? value = true) { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance.IgnoreFailure = value; + return this; } /// @@ -542,10 +608,10 @@ public UserAgentProcessorDescriptor IgnoreFailure(bool? ignoreFailure = true) /// If true and field does not exist, the processor quietly exits without modifying the document. /// /// - public UserAgentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor IgnoreMissing(bool? value = true) { - IgnoreMissingValue = ignoreMissing; - return Self; + Instance.IgnoreMissing = value; + return this; } /// @@ -553,40 +619,55 @@ public UserAgentProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) /// Handle failures for the processor. /// /// - public UserAgentProcessorDescriptor OnFailure(ICollection? onFailure) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(System.Collections.Generic.ICollection? value) { - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureValue = onFailure; - return Self; + Instance.OnFailure = value; + return this; } - public UserAgentProcessorDescriptor OnFailure(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor descriptor) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(params Elastic.Clients.Elasticsearch.Ingest.Processor[] values) { - OnFailureValue = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = null; - OnFailureDescriptor = descriptor; - return Self; + Instance.OnFailure = [.. values]; + return this; } - public UserAgentProcessorDescriptor OnFailure(Action configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(params System.Action[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorActions = null; - OnFailureDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } - public UserAgentProcessorDescriptor OnFailure(params Action[] configure) + /// + /// + /// Handle failures for the processor. + /// + /// + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor OnFailure(params System.Action>[] actions) { - OnFailureValue = null; - OnFailureDescriptor = null; - OnFailureDescriptorAction = null; - OnFailureDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor.Build(action)); + } + + Instance.OnFailure = items; + return this; } /// @@ -594,44 +675,44 @@ public UserAgentProcessorDescriptor OnFailure(params Actiontarget_field. /// /// - public UserAgentProcessorDescriptor Properties(ICollection? properties) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Properties(System.Collections.Generic.ICollection? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } /// /// - /// The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user agent string. Both the directory and the file have to be created before starting Elasticsearch. If not specified, ingest-user-agent will use the regexes.yaml from uap-core it ships with. + /// Controls what properties are added to target_field. /// /// - public UserAgentProcessorDescriptor RegexFile(string? regexFile) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Properties(params Elastic.Clients.Elasticsearch.Ingest.UserAgentProperty[] values) { - RegexFileValue = regexFile; - return Self; + Instance.Properties = [.. values]; + return this; } /// /// - /// Identifier for the processor. - /// Useful for debugging and metrics. + /// The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user agent string. Both the directory and the file have to be created before starting Elasticsearch. If not specified, ingest-user-agent will use the regexes.yaml from uap-core it ships with. /// /// - public UserAgentProcessorDescriptor Tag(string? tag) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor RegexFile(string? value) { - TagValue = tag; - return Self; + Instance.RegexFile = value; + return this; } /// /// - /// The field that will be filled with the user agent details. + /// Identifier for the processor. + /// Useful for debugging and metrics. /// /// - public UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor Tag(string? value) { - TargetFieldValue = targetField; - return Self; + Instance.Tag = value; + return this; } /// @@ -639,10 +720,10 @@ public UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Fi /// The field that will be filled with the user agent details. /// /// - public UserAgentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -650,102 +731,17 @@ public UserAgentProcessorDescriptor TargetField(Expression /// - public UserAgentProcessorDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (ExtractDeviceTypeValue.HasValue) - { - writer.WritePropertyName("extract_device_type"); - writer.WriteBooleanValue(ExtractDeviceTypeValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(IfValue)) - { - writer.WritePropertyName("if"); - writer.WriteStringValue(IfValue); - } - - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (IgnoreMissingValue.HasValue) - { - writer.WritePropertyName("ignore_missing"); - writer.WriteBooleanValue(IgnoreMissingValue.Value); - } - - if (OnFailureDescriptor is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, OnFailureDescriptor, options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorAction is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(OnFailureDescriptorAction), options); - writer.WriteEndArray(); - } - else if (OnFailureDescriptorActions is not null) - { - writer.WritePropertyName("on_failure"); - writer.WriteStartArray(); - foreach (var action in OnFailureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (OnFailureValue is not null) - { - writer.WritePropertyName("on_failure"); - JsonSerializer.Serialize(writer, OnFailureValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(RegexFileValue)) - { - writer.WritePropertyName("regex_file"); - writer.WriteStringValue(RegexFileValue); - } - - if (!string.IsNullOrEmpty(TagValue)) - { - writer.WritePropertyName("tag"); - writer.WriteStringValue(TagValue); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessorDescriptor(new Elastic.Clients.Elasticsearch.Ingest.UserAgentProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Web.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Web.g.cs index b98bbde2f8d..a2c3390b8b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Web.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/Web.g.cs @@ -17,31 +17,57 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Ingest; -public sealed partial class Web +internal sealed partial class WebConverter : System.Text.Json.Serialization.JsonConverter { -} + public override Elastic.Clients.Elasticsearch.Ingest.Web Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } -public sealed partial class WebDescriptor : SerializableDescriptor -{ - internal WebDescriptor(Action configure) => configure.Invoke(this); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public WebDescriptor() : base() - { + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Ingest.Web(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Ingest.Web value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteEndObject(); } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Ingest.WebConverter))] +public sealed partial class Web +{ +#if NET7_0_OR_GREATER + public Web() + { + } +#endif +#if !NET7_0_OR_GREATER + public Web() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Web(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs index 8a7a7d95cd3..03b8f83ff3c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/InlineGet.g.cs @@ -17,99 +17,159 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -internal sealed partial class InlineGetConverter : JsonConverter> +internal sealed partial class InlineGetConverter : System.Text.Json.Serialization.JsonConverter> { - public override InlineGet Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.InlineGet Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFields = default; + LocalJsonValue propFound = default; + System.Collections.Generic.Dictionary? propMetadata = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propRouting = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + propMetadata ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propMetadata[key] = value; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.InlineGet(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Found = propFound.Value, + Metadata = propMetadata, + PrimaryTerm = propPrimaryTerm.Value, + Routing = propRouting.Value, + SeqNo = propSeqNo.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.InlineGet value, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyDictionary? fields = default; - bool found = default; - long? primaryTerm = default; - string? routing = default; - long? seqNo = default; - TDocument? source = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + if (value.Metadata is not null) { - if (reader.TokenType == JsonTokenType.PropertyName) + foreach (var item in value.Metadata) { - var property = reader.GetString(); - if (property == "fields") - { - fields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "found") - { - found = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_primary_term") - { - primaryTerm = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_routing") - { - routing = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_seq_no") - { - seqNo = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_source") - { - source = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + writer.WriteProperty(options, item.Key, item.Value, null, null); } } - return new InlineGet { Fields = fields, Found = found, Metadata = additionalProperties, PrimaryTerm = primaryTerm, Routing = routing, SeqNo = seqNo, Source = source }; + writer.WriteEndObject(); } +} - public override void Write(Utf8JsonWriter writer, InlineGet value, JsonSerializerOptions options) +internal sealed partial class InlineGetConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) { - throw new NotImplementedException("'InlineGet' is a readonly type, used only on responses and does not support being written to JSON."); + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(InlineGet<>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(InlineGetConverter<>).MakeGenericType(args[0]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; } } -[GenericConverter(typeof(InlineGetConverter<>), unwrap: true)] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.InlineGetConverterFactory))] public sealed partial class InlineGet { - public IReadOnlyDictionary? Fields { get; init; } - public bool Found { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InlineGet(bool found) + { + Found = found; + } +#if NET7_0_OR_GREATER + public InlineGet() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InlineGet() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InlineGet(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } /// /// /// Document metadata /// /// - public IReadOnlyDictionary Metadata { get; init; } - public long? PrimaryTerm { get; init; } - public string? Routing { get; init; } - public long? SeqNo { get; init; } - public TDocument? Source { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } + public long? PrimaryTerm { get; set; } + public string? Routing { get; set; } + public long? SeqNo { get; set; } + public TDocument? Source { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs index 8ef6b7429e7..3e96a50040e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs @@ -17,18 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class KnnQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropNumCandidates = System.Text.Json.JsonEncodedText.Encode("num_candidates"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVector = System.Text.Json.JsonEncodedText.Encode("query_vector"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVectorBuilder = System.Text.Json.JsonEncodedText.Encode("query_vector_builder"); + private static readonly System.Text.Json.JsonEncodedText PropRescoreVector = System.Text.Json.JsonEncodedText.Encode("rescore_vector"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + + public override Elastic.Clients.Elasticsearch.KnnQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propK = default; + LocalJsonValue propNumCandidates = default; + LocalJsonValue propQueryName = default; + LocalJsonValue?> propQueryVector = default; + LocalJsonValue propQueryVectorBuilder = default; + LocalJsonValue propRescoreVector = default; + LocalJsonValue propSimilarity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propNumCandidates.TryReadProperty(ref reader, options, PropNumCandidates, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propQueryVector.TryReadProperty(ref reader, options, PropQueryVector, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propQueryVectorBuilder.TryReadProperty(ref reader, options, PropQueryVectorBuilder, null)) + { + continue; + } + + if (propRescoreVector.TryReadProperty(ref reader, options, PropRescoreVector, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Filter = propFilter.Value, + K = propK.Value, + NumCandidates = propNumCandidates.Value, + QueryName = propQueryName.Value, + QueryVector = propQueryVector.Value, + QueryVectorBuilder = propQueryVectorBuilder.Value, + RescoreVector = propRescoreVector.Value, + Similarity = propSimilarity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.KnnQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropNumCandidates, value.NumCandidates, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropQueryVector, value.QueryVector, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryVectorBuilder, value.QueryVectorBuilder, null, null); + writer.WriteProperty(options, PropRescoreVector, value.RescoreVector, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.KnnQueryConverter))] public sealed partial class KnnQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public KnnQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +176,6 @@ public sealed partial class KnnQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,34 +183,32 @@ public sealed partial class KnnQuery /// The name of the vector field to search against /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Filters for the kNN search query /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// The final number of nearest neighbors to return as top hits /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// The number of nearest neighbor candidates to consider per shard /// /// - [JsonInclude, JsonPropertyName("num_candidates")] public int? NumCandidates { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -80,50 +216,48 @@ public sealed partial class KnnQuery /// The query vector /// /// - [JsonInclude, JsonPropertyName("query_vector")] - public ICollection? QueryVector { get; set; } + public System.Collections.Generic.ICollection? QueryVector { get; set; } /// /// /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. /// /// - [JsonInclude, JsonPropertyName("query_vector_builder")] public Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilder { get; set; } + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.RescoreVector? RescoreVector { get; set; } + /// /// /// The minimum similarity for a vector to be considered a match /// /// - [JsonInclude, JsonPropertyName("similarity")] public float? Similarity { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(KnnQuery knnQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Knn(knnQuery); } -public sealed partial class KnnQueryDescriptor : SerializableDescriptor> +public readonly partial struct KnnQueryDescriptor { - internal KnnQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnQuery Instance { get; init; } - public KnnQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryDescriptor(Elastic.Clients.Elasticsearch.KnnQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private int? kValue { get; set; } - private int? NumCandidatesValue { get; set; } - private string? QueryNameValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.KnnQueryDescriptor(Elastic.Clients.Elasticsearch.KnnQuery instance) => new Elastic.Clients.Elasticsearch.KnnQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.KnnQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -133,10 +267,10 @@ public KnnQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public KnnQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -144,10 +278,10 @@ public KnnQueryDescriptor Boost(float? boost) /// The name of the vector field to search against /// /// - public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -155,21 +289,21 @@ public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// The name of the vector field to search against /// /// - public KnnQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the vector field to search against + /// Filters for the kNN search query /// /// - public KnnQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -177,40 +311,27 @@ public KnnQueryDescriptor Field(Expression> f /// Filters for the kNN search query /// /// - public KnnQueryDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; - } - - public KnnQueryDescriptor Filter(Action> configure) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public KnnQueryDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -218,10 +339,10 @@ public KnnQueryDescriptor Filter(params Action /// - public KnnQueryDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -229,16 +350,16 @@ public KnnQueryDescriptor k(int? k) /// The number of nearest neighbor candidates to consider per shard /// /// - public KnnQueryDescriptor NumCandidates(int? numCandidates) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor NumCandidates(int? value) { - NumCandidatesValue = numCandidates; - return Self; + Instance.NumCandidates = value; + return this; } - public KnnQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -246,164 +367,105 @@ public KnnQueryDescriptor QueryName(string? queryName) /// The query vector /// /// - public KnnQueryDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// The query vector /// /// - public KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVector(params float[] values) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVector = [.. values]; + return this; } - public KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.QueryVectorBuilder = value; + return this; } - public KnnQueryDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } /// /// - /// The minimum similarity for a vector to be considered a match + /// Apply oversampling and rescoring to quantized vectors * /// /// - public KnnQueryDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - SimilarityValue = similarity; - return Self; + Instance.RescoreVector = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor RescoreVector(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (kValue.HasValue) - { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); - } - - if (NumCandidatesValue.HasValue) - { - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; + } - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } + /// + /// + /// The minimum similarity for a vector to be considered a match + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Similarity(float? value) + { + Instance.Similarity = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.KnnQueryDescriptor(new Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class KnnQueryDescriptor : SerializableDescriptor +public readonly partial struct KnnQueryDescriptor { - internal KnnQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnQuery Instance { get; init; } - public KnnQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryDescriptor(Elastic.Clients.Elasticsearch.KnnQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private int? kValue { get; set; } - private int? NumCandidatesValue { get; set; } - private string? QueryNameValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.KnnQueryDescriptor(Elastic.Clients.Elasticsearch.KnnQuery instance) => new Elastic.Clients.Elasticsearch.KnnQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.KnnQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -413,10 +475,10 @@ public KnnQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public KnnQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -424,10 +486,10 @@ public KnnQueryDescriptor Boost(float? boost) /// The name of the vector field to search against /// /// - public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -435,21 +497,21 @@ public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The name of the vector field to search against /// /// - public KnnQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the vector field to search against + /// Filters for the kNN search query /// /// - public KnnQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -457,40 +519,44 @@ public KnnQueryDescriptor Field(Expression> f /// Filters for the kNN search query /// /// - public KnnQueryDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public KnnQueryDescriptor Filter(Action configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = items; + return this; } - public KnnQueryDescriptor Filter(params Action[] configure) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -498,10 +564,10 @@ public KnnQueryDescriptor Filter(params Action /// - public KnnQueryDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -509,16 +575,16 @@ public KnnQueryDescriptor k(int? k) /// The number of nearest neighbor candidates to consider per shard /// /// - public KnnQueryDescriptor NumCandidates(int? numCandidates) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor NumCandidates(int? value) { - NumCandidatesValue = numCandidates; - return Self; + Instance.NumCandidates = value; + return this; } - public KnnQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -526,138 +592,83 @@ public KnnQueryDescriptor QueryName(string? queryName) /// The query vector /// /// - public KnnQueryDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// The query vector /// /// - public KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVector(params float[] values) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVector = [.. values]; + return this; } - public KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.QueryVectorBuilder = value; + return this; } - public KnnQueryDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } /// /// - /// The minimum similarity for a vector to be considered a match + /// Apply oversampling and rescoring to quantized vectors * /// /// - public KnnQueryDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - SimilarityValue = similarity; - return Self; + Instance.RescoreVector = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor RescoreVector(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (kValue.HasValue) - { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); - } - - if (NumCandidatesValue.HasValue) - { - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; + } - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } + /// + /// + /// The minimum similarity for a vector to be considered a match + /// + /// + public Elastic.Clients.Elasticsearch.KnnQueryDescriptor Similarity(float? value) + { + Instance.Similarity = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.KnnQueryDescriptor(new Elastic.Clients.Elasticsearch.KnnQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnRetriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnRetriever.g.cs index effdb6f24c5..2625c338e41 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnRetriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnRetriever.g.cs @@ -17,49 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class KnnRetrieverConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropNumCandidates = System.Text.Json.JsonEncodedText.Encode("num_candidates"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVector = System.Text.Json.JsonEncodedText.Encode("query_vector"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVectorBuilder = System.Text.Json.JsonEncodedText.Encode("query_vector_builder"); + private static readonly System.Text.Json.JsonEncodedText PropRescoreVector = System.Text.Json.JsonEncodedText.Encode("rescore_vector"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + + public override Elastic.Clients.Elasticsearch.KnnRetriever Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propK = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propNumCandidates = default; + LocalJsonValue?> propQueryVector = default; + LocalJsonValue propQueryVectorBuilder = default; + LocalJsonValue propRescoreVector = default; + LocalJsonValue propSimilarity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propNumCandidates.TryReadProperty(ref reader, options, PropNumCandidates, null)) + { + continue; + } + + if (propQueryVector.TryReadProperty(ref reader, options, PropQueryVector, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propQueryVectorBuilder.TryReadProperty(ref reader, options, PropQueryVectorBuilder, null)) + { + continue; + } + + if (propRescoreVector.TryReadProperty(ref reader, options, PropRescoreVector, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Filter = propFilter.Value, + K = propK.Value, + MinScore = propMinScore.Value, + NumCandidates = propNumCandidates.Value, + QueryVector = propQueryVector.Value, + QueryVectorBuilder = propQueryVectorBuilder.Value, + RescoreVector = propRescoreVector.Value, + Similarity = propSimilarity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.KnnRetriever value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropNumCandidates, value.NumCandidates, null, null); + writer.WriteProperty(options, PropQueryVector, value.QueryVector, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryVectorBuilder, value.QueryVectorBuilder, null, null); + writer.WriteProperty(options, PropRescoreVector, value.RescoreVector, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.KnnRetrieverConverter))] public sealed partial class KnnRetriever { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnRetriever(string field, int k, int numCandidates) + { + Field = field; + K = k; + NumCandidates = numCandidates; + } +#if NET7_0_OR_GREATER + public KnnRetriever() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnRetriever() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the vector field to search against. /// /// - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } /// /// /// Query to filter the documents that can match. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Number of nearest neighbors to return as top hits. /// /// - [JsonInclude, JsonPropertyName("k")] - public int k { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int K { get; set; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -67,67 +202,69 @@ public sealed partial class KnnRetriever /// Number of nearest neighbor candidates to consider per shard. /// /// - [JsonInclude, JsonPropertyName("num_candidates")] - public int NumCandidates { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumCandidates { get; set; } /// /// /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. /// /// - [JsonInclude, JsonPropertyName("query_vector")] - public ICollection? QueryVector { get; set; } + public System.Collections.Generic.ICollection? QueryVector { get; set; } /// /// /// Defines a model to build a query vector. /// /// - [JsonInclude, JsonPropertyName("query_vector_builder")] public Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilder { get; set; } + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.RescoreVector? RescoreVector { get; set; } + /// /// /// The minimum similarity required for a document to be considered a match. /// /// - [JsonInclude, JsonPropertyName("similarity")] public float? Similarity { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Retriever(KnnRetriever knnRetriever) => Elastic.Clients.Elasticsearch.Retriever.Knn(knnRetriever); } -public sealed partial class KnnRetrieverDescriptor : SerializableDescriptor> +public readonly partial struct KnnRetrieverDescriptor { - internal KnnRetrieverDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnRetriever Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnRetrieverDescriptor(Elastic.Clients.Elasticsearch.KnnRetriever instance) + { + Instance = instance; + } - public KnnRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnRetrieverDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private int kValue { get; set; } - private float? MinScoreValue { get; set; } - private int NumCandidatesValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(Elastic.Clients.Elasticsearch.KnnRetriever instance) => new Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// The name of the vector field to search against. /// /// - public KnnRetrieverDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -135,40 +272,38 @@ public KnnRetrieverDescriptor Field(string field) /// Query to filter the documents that can match. /// /// - public KnnRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public KnnRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnRetrieverDescriptor Filter(Action> configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public KnnRetrieverDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -176,10 +311,10 @@ public KnnRetrieverDescriptor Filter(params Action /// - public KnnRetrieverDescriptor k(int k) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor K(int value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -187,10 +322,10 @@ public KnnRetrieverDescriptor k(int k) /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public KnnRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -198,10 +333,10 @@ public KnnRetrieverDescriptor MinScore(float? minScore) /// Number of nearest neighbor candidates to consider per shard. /// /// - public KnnRetrieverDescriptor NumCandidates(int numCandidates) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor NumCandidates(int value) { - NumCandidatesValue = numCandidates; - return Self; + Instance.NumCandidates = value; + return this; } /// @@ -209,159 +344,115 @@ public KnnRetrieverDescriptor NumCandidates(int numCandidates) /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnRetrieverDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// Defines a model to build a query vector. + /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVector(params float[] values) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVector = [.. values]; + return this; } - public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// Defines a model to build a query vector. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.QueryVectorBuilder = value; + return this; } - public KnnRetrieverDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// Defines a model to build a query vector. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } /// /// - /// The minimum similarity required for a document to be considered a match. + /// Apply oversampling and rescoring to quantized vectors * /// /// - public KnnRetrieverDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - SimilarityValue = similarity; - return Self; + Instance.RescoreVector = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor RescoreVector(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue); - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue); - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; + } - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } + /// + /// + /// The minimum similarity required for a document to be considered a match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Similarity(float? value) + { + Instance.Similarity = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnRetriever Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(new Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class KnnRetrieverDescriptor : SerializableDescriptor +public readonly partial struct KnnRetrieverDescriptor { - internal KnnRetrieverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnRetriever Instance { get; init; } - public KnnRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnRetrieverDescriptor(Elastic.Clients.Elasticsearch.KnnRetriever instance) { + Instance = instance; } - private string FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private int kValue { get; set; } - private float? MinScoreValue { get; set; } - private int NumCandidatesValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnRetrieverDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(Elastic.Clients.Elasticsearch.KnnRetriever instance) => new Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// The name of the vector field to search against. /// /// - public KnnRetrieverDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -369,40 +460,55 @@ public KnnRetrieverDescriptor Field(string field) /// Query to filter the documents that can match. /// /// - public KnnRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public KnnRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnRetrieverDescriptor Filter(Action configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public KnnRetrieverDescriptor Filter(params Action[] configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -410,10 +516,10 @@ public KnnRetrieverDescriptor Filter(params Action /// - public KnnRetrieverDescriptor k(int k) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor K(int value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -421,10 +527,10 @@ public KnnRetrieverDescriptor k(int k) /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public KnnRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -432,10 +538,10 @@ public KnnRetrieverDescriptor MinScore(float? minScore) /// Number of nearest neighbor candidates to consider per shard. /// /// - public KnnRetrieverDescriptor NumCandidates(int numCandidates) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor NumCandidates(int value) { - NumCandidatesValue = numCandidates; - return Self; + Instance.NumCandidates = value; + return this; } /// @@ -443,124 +549,83 @@ public KnnRetrieverDescriptor NumCandidates(int numCandidates) /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnRetrieverDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// Defines a model to build a query vector. + /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVector(params float[] values) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVector = [.. values]; + return this; } - public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// Defines a model to build a query vector. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.QueryVectorBuilder = value; + return this; } - public KnnRetrieverDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// Defines a model to build a query vector. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } /// /// - /// The minimum similarity required for a document to be considered a match. + /// Apply oversampling and rescoring to quantized vectors * /// /// - public KnnRetrieverDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - SimilarityValue = similarity; - return Self; + Instance.RescoreVector = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor RescoreVector(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue); - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue); - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; + } - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } + /// + /// + /// The minimum similarity required for a document to be considered a match. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor Similarity(float? value) + { + Instance.Similarity = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnRetriever Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor(new Elastic.Clients.Elasticsearch.KnnRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs index a3a664f8101..d4e1b274902 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs @@ -17,24 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class KnnSearchConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropK = System.Text.Json.JsonEncodedText.Encode("k"); + private static readonly System.Text.Json.JsonEncodedText PropNumCandidates = System.Text.Json.JsonEncodedText.Encode("num_candidates"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVector = System.Text.Json.JsonEncodedText.Encode("query_vector"); + private static readonly System.Text.Json.JsonEncodedText PropQueryVectorBuilder = System.Text.Json.JsonEncodedText.Encode("query_vector_builder"); + private static readonly System.Text.Json.JsonEncodedText PropRescoreVector = System.Text.Json.JsonEncodedText.Encode("rescore_vector"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + + public override Elastic.Clients.Elasticsearch.KnnSearch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propInnerHits = default; + LocalJsonValue propK = default; + LocalJsonValue propNumCandidates = default; + LocalJsonValue?> propQueryVector = default; + LocalJsonValue propQueryVectorBuilder = default; + LocalJsonValue propRescoreVector = default; + LocalJsonValue propSimilarity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, null)) + { + continue; + } + + if (propK.TryReadProperty(ref reader, options, PropK, null)) + { + continue; + } + + if (propNumCandidates.TryReadProperty(ref reader, options, PropNumCandidates, null)) + { + continue; + } + + if (propQueryVector.TryReadProperty(ref reader, options, PropQueryVector, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propQueryVectorBuilder.TryReadProperty(ref reader, options, PropQueryVectorBuilder, null)) + { + continue; + } + + if (propRescoreVector.TryReadProperty(ref reader, options, PropRescoreVector, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Filter = propFilter.Value, + InnerHits = propInnerHits.Value, + K = propK.Value, + NumCandidates = propNumCandidates.Value, + QueryVector = propQueryVector.Value, + QueryVectorBuilder = propQueryVectorBuilder.Value, + RescoreVector = propRescoreVector.Value, + Similarity = propSimilarity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.KnnSearch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, null); + writer.WriteProperty(options, PropK, value.K, null, null); + writer.WriteProperty(options, PropNumCandidates, value.NumCandidates, null, null); + writer.WriteProperty(options, PropQueryVector, value.QueryVector, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryVectorBuilder, value.QueryVectorBuilder, null, null); + writer.WriteProperty(options, PropRescoreVector, value.RescoreVector, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.KnnSearchConverter))] public sealed partial class KnnSearch { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnSearch(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public KnnSearch() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KnnSearch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Boost value to apply to kNN scores /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -42,24 +180,24 @@ public sealed partial class KnnSearch /// The name of the vector field to search against /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Filters for the kNN search query /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// If defined, each search hit will contain inner hits. /// /// - [JsonInclude, JsonPropertyName("inner_hits")] public Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHits { get; set; } /// @@ -67,15 +205,13 @@ public sealed partial class KnnSearch /// The final number of nearest neighbors to return as top hits /// /// - [JsonInclude, JsonPropertyName("k")] - public int? k { get; set; } + public int? K { get; set; } /// /// /// The number of nearest neighbor candidates to consider per shard /// /// - [JsonInclude, JsonPropertyName("num_candidates")] public int? NumCandidates { get; set; } /// @@ -83,60 +219,58 @@ public sealed partial class KnnSearch /// The query vector /// /// - [JsonInclude, JsonPropertyName("query_vector")] - public ICollection? QueryVector { get; set; } + public System.Collections.Generic.ICollection? QueryVector { get; set; } /// /// /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. /// /// - [JsonInclude, JsonPropertyName("query_vector_builder")] public Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilder { get; set; } + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.RescoreVector? RescoreVector { get; set; } + /// /// /// The minimum similarity for a vector to be considered a match /// /// - [JsonInclude, JsonPropertyName("similarity")] public float? Similarity { get; set; } } -public sealed partial class KnnSearchDescriptor : SerializableDescriptor> +public readonly partial struct KnnSearchDescriptor { - internal KnnSearchDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnSearch Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnSearchDescriptor(Elastic.Clients.Elasticsearch.KnnSearch instance) + { + Instance = instance; + } - public KnnSearchDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnSearchDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action> InnerHitsDescriptorAction { get; set; } - private int? kValue { get; set; } - private int? NumCandidatesValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.KnnSearchDescriptor(Elastic.Clients.Elasticsearch.KnnSearch instance) => new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) => descriptor.Instance; /// /// /// Boost value to apply to kNN scores /// /// - public KnnSearchDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -144,10 +278,10 @@ public KnnSearchDescriptor Boost(float? boost) /// The name of the vector field to search against /// /// - public KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -155,21 +289,21 @@ public KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field /// The name of the vector field to search against /// /// - public KnnSearchDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the vector field to search against + /// Filters for the kNN search query /// /// - public KnnSearchDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -177,40 +311,49 @@ public KnnSearchDescriptor Field(Expression> /// Filters for the kNN search query /// /// - public KnnSearchDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnSearchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public KnnSearchDescriptor Filter(Action> configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + Instance.InnerHits = value; + return this; } - public KnnSearchDescriptor Filter(params Action>[] configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits() { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } /// @@ -218,61 +361,65 @@ public KnnSearchDescriptor Filter(params Action /// - public KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits(System.Action>? action) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } - public KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// The final number of nearest neighbors to return as top hits + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor K(int? value) { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.K = value; + return this; } - public KnnSearchDescriptor InnerHits(Action> configure) + /// + /// + /// The number of nearest neighbor candidates to consider per shard + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor NumCandidates(int? value) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.NumCandidates = value; + return this; } /// /// - /// The final number of nearest neighbors to return as top hits + /// The query vector /// /// - public KnnSearchDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - kValue = k; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// The number of nearest neighbor candidates to consider per shard + /// The query vector /// /// - public KnnSearchDescriptor NumCandidates(int? numCandidates) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVector(params float[] values) { - NumCandidatesValue = numCandidates; - return Self; + Instance.QueryVector = [.. values]; + return this; } /// /// - /// The query vector + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnSearchDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVectorBuilder = value; + return this; } /// @@ -280,28 +427,32 @@ public KnnSearchDescriptor QueryVector(ICollection? queryVecto /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. /// /// - public KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } - public KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.RescoreVector = value; + return this; } - public KnnSearchDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor RescoreVector(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; } /// @@ -309,146 +460,49 @@ public KnnSearchDescriptor QueryVectorBuilder(Action /// - public KnnSearchDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Similarity(float? value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnSearch Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - if (kValue.HasValue) - { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); - } - - if (NumCandidatesValue.HasValue) - { - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue.Value); - } - - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } - - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(new Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class KnnSearchDescriptor : SerializableDescriptor +public readonly partial struct KnnSearchDescriptor { - internal KnnSearchDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.KnnSearch Instance { get; init; } - public KnnSearchDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnSearchDescriptor(Elastic.Clients.Elasticsearch.KnnSearch instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action InnerHitsDescriptorAction { get; set; } - private int? kValue { get; set; } - private int? NumCandidatesValue { get; set; } - private ICollection? QueryVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } - private Action QueryVectorBuilderDescriptorAction { get; set; } - private float? SimilarityValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KnnSearchDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.KnnSearchDescriptor(Elastic.Clients.Elasticsearch.KnnSearch instance) => new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.KnnSearchDescriptor descriptor) => descriptor.Instance; /// /// /// Boost value to apply to kNN scores /// /// - public KnnSearchDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -456,10 +510,10 @@ public KnnSearchDescriptor Boost(float? boost) /// The name of the vector field to search against /// /// - public KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -467,21 +521,21 @@ public KnnSearchDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The name of the vector field to search against /// /// - public KnnSearchDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the vector field to search against + /// Filters for the kNN search query /// /// - public KnnSearchDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(System.Collections.Generic.ICollection? value) { - FieldValue = field; - return Self; + Instance.Filter = value; + return this; } /// @@ -489,40 +543,55 @@ public KnnSearchDescriptor Field(Expression> /// Filters for the kNN search query /// /// - public KnnSearchDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = [.. values]; + return this; } - public KnnSearchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public KnnSearchDescriptor Filter(Action configure) + /// + /// + /// Filters for the kNN search query + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public KnnSearchDescriptor Filter(params Action[] configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.InnerHits = value; + return this; } /// @@ -530,28 +599,32 @@ public KnnSearchDescriptor Filter(params Action /// - public KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits() { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public KnnSearchDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits(System.Action? action) { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } - public KnnSearchDescriptor InnerHits(Action configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor InnerHits(System.Action>? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -559,10 +632,10 @@ public KnnSearchDescriptor InnerHits(Action /// - public KnnSearchDescriptor k(int? k) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor K(int? value) { - kValue = k; - return Self; + Instance.K = value; + return this; } /// @@ -570,10 +643,10 @@ public KnnSearchDescriptor k(int? k) /// The number of nearest neighbor candidates to consider per shard /// /// - public KnnSearchDescriptor NumCandidates(int? numCandidates) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor NumCandidates(int? value) { - NumCandidatesValue = numCandidates; - return Self; + Instance.NumCandidates = value; + return this; } /// @@ -581,148 +654,83 @@ public KnnSearchDescriptor NumCandidates(int? numCandidates) /// The query vector /// /// - public KnnSearchDescriptor QueryVector(ICollection? queryVector) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVector(System.Collections.Generic.ICollection? value) { - QueryVectorValue = queryVector; - return Self; + Instance.QueryVector = value; + return this; } /// /// - /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// The query vector /// /// - public KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? queryVectorBuilder) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVector(params float[] values) { - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderValue = queryVectorBuilder; - return Self; + Instance.QueryVector = [.. values]; + return this; } - public KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilder? value) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptorAction = null; - QueryVectorBuilderDescriptor = descriptor; - return Self; + Instance.QueryVectorBuilder = value; + return this; } - public KnnSearchDescriptor QueryVectorBuilder(Action configure) + /// + /// + /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both. + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor QueryVectorBuilder(System.Action action) { - QueryVectorBuilderValue = null; - QueryVectorBuilderDescriptor = null; - QueryVectorBuilderDescriptorAction = configure; - return Self; + Instance.QueryVectorBuilder = Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor.Build(action); + return this; } /// /// - /// The minimum similarity for a vector to be considered a match + /// Apply oversampling and rescoring to quantized vectors * /// /// - public KnnSearchDescriptor Similarity(float? similarity) + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor RescoreVector(Elastic.Clients.Elasticsearch.RescoreVector? value) { - SimilarityValue = similarity; - return Self; + Instance.RescoreVector = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Apply oversampling and rescoring to quantized vectors * + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor RescoreVector(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - if (kValue.HasValue) - { - writer.WritePropertyName("k"); - writer.WriteNumberValue(kValue.Value); - } - - if (NumCandidatesValue.HasValue) - { - writer.WritePropertyName("num_candidates"); - writer.WriteNumberValue(NumCandidatesValue.Value); - } - - if (QueryVectorValue is not null) - { - writer.WritePropertyName("query_vector"); - JsonSerializer.Serialize(writer, QueryVectorValue, options); - } - - if (QueryVectorBuilderDescriptor is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); - } - else if (QueryVectorBuilderDescriptorAction is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); - } - else if (QueryVectorBuilderValue is not null) - { - writer.WritePropertyName("query_vector_builder"); - JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); - } + Instance.RescoreVector = Elastic.Clients.Elasticsearch.RescoreVectorDescriptor.Build(action); + return this; + } - if (SimilarityValue.HasValue) - { - writer.WritePropertyName("similarity"); - writer.WriteNumberValue(SimilarityValue.Value); - } + /// + /// + /// The minimum similarity for a vector to be considered a match + /// + /// + public Elastic.Clients.Elasticsearch.KnnSearchDescriptor Similarity(float? value) + { + Instance.Similarity = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.KnnSearch Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.KnnSearchDescriptor(new Elastic.Clients.Elasticsearch.KnnSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs index 16a92d27141..2145e3dcbf3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class LatLonGeoLocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLat = System.Text.Json.JsonEncodedText.Encode("lat"); + private static readonly System.Text.Json.JsonEncodedText PropLon = System.Text.Json.JsonEncodedText.Encode("lon"); + + public override Elastic.Clients.Elasticsearch.LatLonGeoLocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLat = default; + LocalJsonValue propLon = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLat.TryReadProperty(ref reader, options, PropLat, null)) + { + continue; + } + + if (propLon.TryReadProperty(ref reader, options, PropLon, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LatLonGeoLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Lat = propLat.Value, + Lon = propLon.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LatLonGeoLocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLat, value.Lat, null, null); + writer.WriteProperty(options, PropLon, value.Lon, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocationConverter))] public sealed partial class LatLonGeoLocation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatLonGeoLocation(double lat, double lon) + { + Lat = lat; + Lon = lon; + } +#if NET7_0_OR_GREATER + public LatLonGeoLocation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LatLonGeoLocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LatLonGeoLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Latitude /// /// - [JsonInclude, JsonPropertyName("lat")] - public double Lat { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Lat { get; set; } /// /// /// Longitude /// /// - [JsonInclude, JsonPropertyName("lon")] - public double Lon { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Lon { get; set; } } -public sealed partial class LatLonGeoLocationDescriptor : SerializableDescriptor +public readonly partial struct LatLonGeoLocationDescriptor { - internal LatLonGeoLocationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LatLonGeoLocation Instance { get; init; } - public LatLonGeoLocationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatLonGeoLocationDescriptor(Elastic.Clients.Elasticsearch.LatLonGeoLocation instance) { + Instance = instance; } - private double LatValue { get; set; } - private double LonValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatLonGeoLocationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.LatLonGeoLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor(Elastic.Clients.Elasticsearch.LatLonGeoLocation instance) => new Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LatLonGeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor descriptor) => descriptor.Instance; /// /// /// Latitude /// /// - public LatLonGeoLocationDescriptor Lat(double lat) + public Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor Lat(double value) { - LatValue = lat; - return Self; + Instance.Lat = value; + return this; } /// @@ -73,19 +155,17 @@ public LatLonGeoLocationDescriptor Lat(double lat) /// Longitude /// /// - public LatLonGeoLocationDescriptor Lon(double lon) + public Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor Lon(double value) { - LonValue = lon; - return Self; + Instance.Lon = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LatLonGeoLocation Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("lat"); - writer.WriteNumberValue(LatValue); - writer.WritePropertyName("lon"); - writer.WriteNumberValue(LonValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.LatLonGeoLocationDescriptor(new Elastic.Clients.Elasticsearch.LatLonGeoLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/Acknowledgement.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/Acknowledgement.g.cs index 528902e7649..fd495341f74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/Acknowledgement.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/Acknowledgement.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; +internal sealed partial class AcknowledgementConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLicense = System.Text.Json.JsonEncodedText.Encode("license"); + private static readonly System.Text.Json.JsonEncodedText PropMessage = System.Text.Json.JsonEncodedText.Encode("message"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.Acknowledgement Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propLicense = default; + LocalJsonValue propMessage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLicense.TryReadProperty(ref reader, options, PropLicense, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMessage.TryReadProperty(ref reader, options, PropMessage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.Acknowledgement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + License = propLicense.Value, + Message = propMessage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.Acknowledgement value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLicense, value.License, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMessage, value.Message, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.AcknowledgementConverter))] public sealed partial class Acknowledgement { - [JsonInclude, JsonPropertyName("license")] - public IReadOnlyCollection License { get; init; } - [JsonInclude, JsonPropertyName("message")] - public string Message { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Acknowledgement(System.Collections.Generic.IReadOnlyCollection license, string message) + { + License = license; + Message = message; + } +#if NET7_0_OR_GREATER + public Acknowledgement() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Acknowledgement() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Acknowledgement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection License { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Message { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/License.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/License.g.cs index b6671feb117..7d786b70299 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/License.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/License.g.cs @@ -17,154 +17,287 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; +internal sealed partial class LicenseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiryDateInMillis = System.Text.Json.JsonEncodedText.Encode("expiry_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIssueDateInMillis = System.Text.Json.JsonEncodedText.Encode("issue_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIssuedTo = System.Text.Json.JsonEncodedText.Encode("issued_to"); + private static readonly System.Text.Json.JsonEncodedText PropIssuer = System.Text.Json.JsonEncodedText.Encode("issuer"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNodes = System.Text.Json.JsonEncodedText.Encode("max_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxResourceUnits = System.Text.Json.JsonEncodedText.Encode("max_resource_units"); + private static readonly System.Text.Json.JsonEncodedText PropSignature = System.Text.Json.JsonEncodedText.Encode("signature"); + private static readonly System.Text.Json.JsonEncodedText PropStartDateInMillis = System.Text.Json.JsonEncodedText.Encode("start_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.License Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiryDateInMillis = default; + LocalJsonValue propIssueDateInMillis = default; + LocalJsonValue propIssuedTo = default; + LocalJsonValue propIssuer = default; + LocalJsonValue propMaxNodes = default; + LocalJsonValue propMaxResourceUnits = default; + LocalJsonValue propSignature = default; + LocalJsonValue propStartDateInMillis = default; + LocalJsonValue propType = default; + LocalJsonValue propUid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiryDateInMillis.TryReadProperty(ref reader, options, PropExpiryDateInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIssueDateInMillis.TryReadProperty(ref reader, options, PropIssueDateInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIssuedTo.TryReadProperty(ref reader, options, PropIssuedTo, null)) + { + continue; + } + + if (propIssuer.TryReadProperty(ref reader, options, PropIssuer, null)) + { + continue; + } + + if (propMaxNodes.TryReadProperty(ref reader, options, PropMaxNodes, null)) + { + continue; + } + + if (propMaxResourceUnits.TryReadProperty(ref reader, options, PropMaxResourceUnits, null)) + { + continue; + } + + if (propSignature.TryReadProperty(ref reader, options, PropSignature, null)) + { + continue; + } + + if (propStartDateInMillis.TryReadProperty(ref reader, options, PropStartDateInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.License(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpiryDateInMillis = propExpiryDateInMillis.Value, + IssueDateInMillis = propIssueDateInMillis.Value, + IssuedTo = propIssuedTo.Value, + Issuer = propIssuer.Value, + MaxNodes = propMaxNodes.Value, + MaxResourceUnits = propMaxResourceUnits.Value, + Signature = propSignature.Value, + StartDateInMillis = propStartDateInMillis.Value, + Type = propType.Value, + Uid = propUid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.License value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiryDateInMillis, value.ExpiryDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIssueDateInMillis, value.IssueDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIssuedTo, value.IssuedTo, null, null); + writer.WriteProperty(options, PropIssuer, value.Issuer, null, null); + writer.WriteProperty(options, PropMaxNodes, value.MaxNodes, null, null); + writer.WriteProperty(options, PropMaxResourceUnits, value.MaxResourceUnits, null, null); + writer.WriteProperty(options, PropSignature, value.Signature, null, null); + writer.WriteProperty(options, PropStartDateInMillis, value.StartDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseConverter))] public sealed partial class License { - [JsonInclude, JsonPropertyName("expiry_date_in_millis")] - public long ExpiryDateInMillis { get; set; } - [JsonInclude, JsonPropertyName("issue_date_in_millis")] - public long IssueDateInMillis { get; set; } - [JsonInclude, JsonPropertyName("issued_to")] - public string IssuedTo { get; set; } - [JsonInclude, JsonPropertyName("issuer")] - public string Issuer { get; set; } - [JsonInclude, JsonPropertyName("max_nodes")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public License(System.DateTimeOffset expiryDateInMillis, System.DateTimeOffset issueDateInMillis, string issuedTo, string issuer, string signature, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType type, string uid) + { + ExpiryDateInMillis = expiryDateInMillis; + IssueDateInMillis = issueDateInMillis; + IssuedTo = issuedTo; + Issuer = issuer; + Signature = signature; + Type = type; + Uid = uid; + } +#if NET7_0_OR_GREATER + public License() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public License() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal License(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpiryDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset IssueDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IssuedTo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Issuer { get; set; } public long? MaxNodes { get; set; } - [JsonInclude, JsonPropertyName("max_resource_units")] public long? MaxResourceUnits { get; set; } - [JsonInclude, JsonPropertyName("signature")] - public string Signature { get; set; } - [JsonInclude, JsonPropertyName("start_date_in_millis")] - public long? StartDateInMillis { get; set; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; set; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Signature { get; set; } + public System.DateTimeOffset? StartDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } } -public sealed partial class LicenseDescriptor : SerializableDescriptor +public readonly partial struct LicenseDescriptor { - internal LicenseDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.LicenseManagement.License Instance { get; init; } - public LicenseDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LicenseDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.License instance) { + Instance = instance; } - private long ExpiryDateInMillisValue { get; set; } - private long IssueDateInMillisValue { get; set; } - private string IssuedToValue { get; set; } - private string IssuerValue { get; set; } - private long? MaxNodesValue { get; set; } - private long? MaxResourceUnitsValue { get; set; } - private string SignatureValue { get; set; } - private long? StartDateInMillisValue { get; set; } - private Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType TypeValue { get; set; } - private string UidValue { get; set; } - - public LicenseDescriptor ExpiryDateInMillis(long expiryDateInMillis) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LicenseDescriptor() { - ExpiryDateInMillisValue = expiryDateInMillis; - return Self; + Instance = new Elastic.Clients.Elasticsearch.LicenseManagement.License(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public LicenseDescriptor IssueDateInMillis(long issueDateInMillis) + public static explicit operator Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(Elastic.Clients.Elasticsearch.LicenseManagement.License instance) => new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.LicenseManagement.License(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor ExpiryDateInMillis(System.DateTimeOffset value) { - IssueDateInMillisValue = issueDateInMillis; - return Self; + Instance.ExpiryDateInMillis = value; + return this; } - public LicenseDescriptor IssuedTo(string issuedTo) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor IssueDateInMillis(System.DateTimeOffset value) { - IssuedToValue = issuedTo; - return Self; + Instance.IssueDateInMillis = value; + return this; } - public LicenseDescriptor Issuer(string issuer) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor IssuedTo(string value) { - IssuerValue = issuer; - return Self; + Instance.IssuedTo = value; + return this; } - public LicenseDescriptor MaxNodes(long? maxNodes) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor Issuer(string value) { - MaxNodesValue = maxNodes; - return Self; + Instance.Issuer = value; + return this; } - public LicenseDescriptor MaxResourceUnits(long? maxResourceUnits) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor MaxNodes(long? value) { - MaxResourceUnitsValue = maxResourceUnits; - return Self; + Instance.MaxNodes = value; + return this; } - public LicenseDescriptor Signature(string signature) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor MaxResourceUnits(long? value) { - SignatureValue = signature; - return Self; + Instance.MaxResourceUnits = value; + return this; } - public LicenseDescriptor StartDateInMillis(long? startDateInMillis) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor Signature(string value) { - StartDateInMillisValue = startDateInMillis; - return Self; + Instance.Signature = value; + return this; } - public LicenseDescriptor Type(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType type) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor StartDateInMillis(System.DateTimeOffset? value) { - TypeValue = type; - return Self; + Instance.StartDateInMillis = value; + return this; } - public LicenseDescriptor Uid(string uid) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor Type(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType value) { - UidValue = uid; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor Uid(string value) { - writer.WriteStartObject(); - writer.WritePropertyName("expiry_date_in_millis"); - writer.WriteNumberValue(ExpiryDateInMillisValue); - writer.WritePropertyName("issue_date_in_millis"); - writer.WriteNumberValue(IssueDateInMillisValue); - writer.WritePropertyName("issued_to"); - writer.WriteStringValue(IssuedToValue); - writer.WritePropertyName("issuer"); - writer.WriteStringValue(IssuerValue); - if (MaxNodesValue.HasValue) - { - writer.WritePropertyName("max_nodes"); - writer.WriteNumberValue(MaxNodesValue.Value); - } - - if (MaxResourceUnitsValue.HasValue) - { - writer.WritePropertyName("max_resource_units"); - writer.WriteNumberValue(MaxResourceUnitsValue.Value); - } - - writer.WritePropertyName("signature"); - writer.WriteStringValue(SignatureValue); - if (StartDateInMillisValue.HasValue) - { - writer.WritePropertyName("start_date_in_millis"); - writer.WriteNumberValue(StartDateInMillisValue.Value); - } + Instance.Uid = value; + return this; + } - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WritePropertyName("uid"); - writer.WriteStringValue(UidValue); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.LicenseManagement.License Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseDescriptor(new Elastic.Clients.Elasticsearch.LicenseManagement.License(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/LicenseInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/LicenseInformation.g.cs index 1ac2d70dc1a..5cfd081f890 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/LicenseInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LicenseManagement/LicenseInformation.g.cs @@ -17,40 +17,229 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.LicenseManagement; +internal sealed partial class LicenseInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiryDate = System.Text.Json.JsonEncodedText.Encode("expiry_date"); + private static readonly System.Text.Json.JsonEncodedText PropExpiryDateInMillis = System.Text.Json.JsonEncodedText.Encode("expiry_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIssueDate = System.Text.Json.JsonEncodedText.Encode("issue_date"); + private static readonly System.Text.Json.JsonEncodedText PropIssueDateInMillis = System.Text.Json.JsonEncodedText.Encode("issue_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropIssuedTo = System.Text.Json.JsonEncodedText.Encode("issued_to"); + private static readonly System.Text.Json.JsonEncodedText PropIssuer = System.Text.Json.JsonEncodedText.Encode("issuer"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNodes = System.Text.Json.JsonEncodedText.Encode("max_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxResourceUnits = System.Text.Json.JsonEncodedText.Encode("max_resource_units"); + private static readonly System.Text.Json.JsonEncodedText PropStartDateInMillis = System.Text.Json.JsonEncodedText.Encode("start_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + + public override Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiryDate = default; + LocalJsonValue propExpiryDateInMillis = default; + LocalJsonValue propIssueDate = default; + LocalJsonValue propIssueDateInMillis = default; + LocalJsonValue propIssuedTo = default; + LocalJsonValue propIssuer = default; + LocalJsonValue propMaxNodes = default; + LocalJsonValue propMaxResourceUnits = default; + LocalJsonValue propStartDateInMillis = default; + LocalJsonValue propStatus = default; + LocalJsonValue propType = default; + LocalJsonValue propUid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiryDate.TryReadProperty(ref reader, options, PropExpiryDate, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propExpiryDateInMillis.TryReadProperty(ref reader, options, PropExpiryDateInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIssueDate.TryReadProperty(ref reader, options, PropIssueDate, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propIssueDateInMillis.TryReadProperty(ref reader, options, PropIssueDateInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIssuedTo.TryReadProperty(ref reader, options, PropIssuedTo, null)) + { + continue; + } + + if (propIssuer.TryReadProperty(ref reader, options, PropIssuer, null)) + { + continue; + } + + if (propMaxNodes.TryReadProperty(ref reader, options, PropMaxNodes, null)) + { + continue; + } + + if (propMaxResourceUnits.TryReadProperty(ref reader, options, PropMaxResourceUnits, null)) + { + continue; + } + + if (propStartDateInMillis.TryReadProperty(ref reader, options, PropStartDateInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpiryDate = propExpiryDate.Value, + ExpiryDateInMillis = propExpiryDateInMillis.Value, + IssueDate = propIssueDate.Value, + IssueDateInMillis = propIssueDateInMillis.Value, + IssuedTo = propIssuedTo.Value, + Issuer = propIssuer.Value, + MaxNodes = propMaxNodes.Value, + MaxResourceUnits = propMaxResourceUnits.Value, + StartDateInMillis = propStartDateInMillis.Value, + Status = propStatus.Value, + Type = propType.Value, + Uid = propUid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiryDate, value.ExpiryDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropExpiryDateInMillis, value.ExpiryDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIssueDate, value.IssueDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropIssueDateInMillis, value.IssueDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIssuedTo, value.IssuedTo, null, null); + writer.WriteProperty(options, PropIssuer, value.Issuer, null, null); + writer.WriteProperty(options, PropMaxNodes, value.MaxNodes, null, null); + writer.WriteProperty(options, PropMaxResourceUnits, value.MaxResourceUnits, null, null); + writer.WriteProperty(options, PropStartDateInMillis, value.StartDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.LicenseManagement.LicenseInformationConverter))] public sealed partial class LicenseInformation { - [JsonInclude, JsonPropertyName("expiry_date")] - public DateTimeOffset? ExpiryDate { get; init; } - [JsonInclude, JsonPropertyName("expiry_date_in_millis")] - public long? ExpiryDateInMillis { get; init; } - [JsonInclude, JsonPropertyName("issue_date")] - public DateTimeOffset IssueDate { get; init; } - [JsonInclude, JsonPropertyName("issue_date_in_millis")] - public long IssueDateInMillis { get; init; } - [JsonInclude, JsonPropertyName("issued_to")] - public string IssuedTo { get; init; } - [JsonInclude, JsonPropertyName("issuer")] - public string Issuer { get; init; } - [JsonInclude, JsonPropertyName("max_nodes")] - public long? MaxNodes { get; init; } - [JsonInclude, JsonPropertyName("max_resource_units")] - public int? MaxResourceUnits { get; init; } - [JsonInclude, JsonPropertyName("start_date_in_millis")] - public long StartDateInMillis { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus Status { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; init; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LicenseInformation(System.DateTimeOffset issueDate, System.DateTimeOffset issueDateInMillis, string issuedTo, string issuer, long? maxNodes, System.DateTimeOffset startDateInMillis, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus status, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType type, string uid) + { + IssueDate = issueDate; + IssueDateInMillis = issueDateInMillis; + IssuedTo = issuedTo; + Issuer = issuer; + MaxNodes = maxNodes; + StartDateInMillis = startDateInMillis; + Status = status; + Type = type; + Uid = uid; + } +#if NET7_0_OR_GREATER + public LicenseInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LicenseInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LicenseInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.DateTimeOffset? ExpiryDate { get; set; } + public System.DateTimeOffset? ExpiryDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset IssueDate { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset IssueDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IssuedTo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Issuer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long? MaxNodes { get; set; } + public int? MaxResourceUnits { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AdaptiveAllocationsSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AdaptiveAllocationsSettings.g.cs index 20423691083..d12d38d3a77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AdaptiveAllocationsSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AdaptiveAllocationsSettings.g.cs @@ -17,22 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AdaptiveAllocationsSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("max_number_of_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropMinNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("min_number_of_allocations"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propMaxNumberOfAllocations = default; + LocalJsonValue propMinNumberOfAllocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propMaxNumberOfAllocations.TryReadProperty(ref reader, options, PropMaxNumberOfAllocations, null)) + { + continue; + } + + if (propMinNumberOfAllocations.TryReadProperty(ref reader, options, PropMinNumberOfAllocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + MaxNumberOfAllocations = propMaxNumberOfAllocations.Value, + MinNumberOfAllocations = propMinNumberOfAllocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropMaxNumberOfAllocations, value.MaxNumberOfAllocations, null, null); + writer.WriteProperty(options, PropMinNumberOfAllocations, value.MinNumberOfAllocations, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsConverter))] public sealed partial class AdaptiveAllocationsSettings { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("max_number_of_allocations")] - public int? MaxNumberOfAllocations { get; init; } - [JsonInclude, JsonPropertyName("min_number_of_allocations")] - public int? MinNumberOfAllocations { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdaptiveAllocationsSettings(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public AdaptiveAllocationsSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AdaptiveAllocationsSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdaptiveAllocationsSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// If true, adaptive_allocations is enabled + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + + /// + /// + /// Specifies the maximum number of allocations to scale to. + /// If set, it must be greater than or equal to min_number_of_allocations. + /// + /// + public int? MaxNumberOfAllocations { get; set; } + + /// + /// + /// Specifies the minimum number of allocations to scale to. + /// If set, it must be greater than or equal to 0. + /// If not defined, the deployment scales to 0. + /// + /// + public int? MinNumberOfAllocations { get; set; } +} + +public readonly partial struct AdaptiveAllocationsSettingsDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdaptiveAllocationsSettingsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AdaptiveAllocationsSettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings(Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// If true, adaptive_allocations is enabled + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor Enabled(bool value = true) + { + Instance.Enabled = value; + return this; + } + + /// + /// + /// Specifies the maximum number of allocations to scale to. + /// If set, it must be greater than or equal to min_number_of_allocations. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor MaxNumberOfAllocations(int? value) + { + Instance.MaxNumberOfAllocations = value; + return this; + } + + /// + /// + /// Specifies the minimum number of allocations to scale to. + /// If set, it must be greater than or equal to 0. + /// If not defined, the deployment scales to 0. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor MinNumberOfAllocations(int? value) + { + Instance.MinNumberOfAllocations = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettingsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AggregateOutput.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AggregateOutput.g.cs index 7f46c8a855a..278798e5d19 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AggregateOutput.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AggregateOutput.g.cs @@ -17,212 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class AggregateOutput +internal sealed partial class AggregateOutputConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("exponent")] - public Elastic.Clients.Elasticsearch.MachineLearning.Weights? Exponent { get; set; } - [JsonInclude, JsonPropertyName("logistic_regression")] - public Elastic.Clients.Elasticsearch.MachineLearning.Weights? LogisticRegression { get; set; } - [JsonInclude, JsonPropertyName("weighted_mode")] - public Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedMode { get; set; } - [JsonInclude, JsonPropertyName("weighted_sum")] - public Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedSum { get; set; } -} + private static readonly System.Text.Json.JsonEncodedText PropExponent = System.Text.Json.JsonEncodedText.Encode("exponent"); + private static readonly System.Text.Json.JsonEncodedText PropLogisticRegression = System.Text.Json.JsonEncodedText.Encode("logistic_regression"); + private static readonly System.Text.Json.JsonEncodedText PropWeightedMode = System.Text.Json.JsonEncodedText.Encode("weighted_mode"); + private static readonly System.Text.Json.JsonEncodedText PropWeightedSum = System.Text.Json.JsonEncodedText.Encode("weighted_sum"); -public sealed partial class AggregateOutputDescriptor : SerializableDescriptor -{ - internal AggregateOutputDescriptor(Action configure) => configure.Invoke(this); - - public AggregateOutputDescriptor() : base() + public override Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - } + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExponent = default; + LocalJsonValue propLogisticRegression = default; + LocalJsonValue propWeightedMode = default; + LocalJsonValue propWeightedSum = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExponent.TryReadProperty(ref reader, options, PropExponent, null)) + { + continue; + } + + if (propLogisticRegression.TryReadProperty(ref reader, options, PropLogisticRegression, null)) + { + continue; + } + + if (propWeightedMode.TryReadProperty(ref reader, options, PropWeightedMode, null)) + { + continue; + } + + if (propWeightedSum.TryReadProperty(ref reader, options, PropWeightedSum, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - private Elastic.Clients.Elasticsearch.MachineLearning.Weights? ExponentValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor ExponentDescriptor { get; set; } - private Action ExponentDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Weights? LogisticRegressionValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor LogisticRegressionDescriptor { get; set; } - private Action LogisticRegressionDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedModeValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor WeightedModeDescriptor { get; set; } - private Action WeightedModeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedSumValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor WeightedSumDescriptor { get; set; } - private Action WeightedSumDescriptorAction { get; set; } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exponent = propExponent.Value, + LogisticRegression = propLogisticRegression.Value, + WeightedMode = propWeightedMode.Value, + WeightedSum = propWeightedSum.Value + }; + } - public AggregateOutputDescriptor Exponent(Elastic.Clients.Elasticsearch.MachineLearning.Weights? exponent) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput value, System.Text.Json.JsonSerializerOptions options) { - ExponentDescriptor = null; - ExponentDescriptorAction = null; - ExponentValue = exponent; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropExponent, value.Exponent, null, null); + writer.WriteProperty(options, PropLogisticRegression, value.LogisticRegression, null, null); + writer.WriteProperty(options, PropWeightedMode, value.WeightedMode, null, null); + writer.WriteProperty(options, PropWeightedSum, value.WeightedSum, null, null); + writer.WriteEndObject(); } +} - public AggregateOutputDescriptor Exponent(Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor descriptor) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputConverter))] +public sealed partial class AggregateOutput +{ +#if NET7_0_OR_GREATER + public AggregateOutput() { - ExponentValue = null; - ExponentDescriptorAction = null; - ExponentDescriptor = descriptor; - return Self; } - - public AggregateOutputDescriptor Exponent(Action configure) +#endif +#if !NET7_0_OR_GREATER + public AggregateOutput() { - ExponentValue = null; - ExponentDescriptor = null; - ExponentDescriptorAction = configure; - return Self; } - - public AggregateOutputDescriptor LogisticRegression(Elastic.Clients.Elasticsearch.MachineLearning.Weights? logisticRegression) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregateOutput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - LogisticRegressionDescriptor = null; - LogisticRegressionDescriptorAction = null; - LogisticRegressionValue = logisticRegression; - return Self; + _ = sentinel; } - public AggregateOutputDescriptor LogisticRegression(Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.Weights? Exponent { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.Weights? LogisticRegression { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedMode { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.Weights? WeightedSum { get; set; } +} + +public readonly partial struct AggregateOutputDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateOutputDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput instance) { - LogisticRegressionValue = null; - LogisticRegressionDescriptorAction = null; - LogisticRegressionDescriptor = descriptor; - return Self; + Instance = instance; } - public AggregateOutputDescriptor LogisticRegression(Action configure) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateOutputDescriptor() { - LogisticRegressionValue = null; - LogisticRegressionDescriptor = null; - LogisticRegressionDescriptorAction = configure; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public AggregateOutputDescriptor WeightedMode(Elastic.Clients.Elasticsearch.MachineLearning.Weights? weightedMode) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor Exponent(Elastic.Clients.Elasticsearch.MachineLearning.Weights? value) { - WeightedModeDescriptor = null; - WeightedModeDescriptorAction = null; - WeightedModeValue = weightedMode; - return Self; + Instance.Exponent = value; + return this; } - public AggregateOutputDescriptor WeightedMode(Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor Exponent(System.Action action) { - WeightedModeValue = null; - WeightedModeDescriptorAction = null; - WeightedModeDescriptor = descriptor; - return Self; + Instance.Exponent = Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor.Build(action); + return this; } - public AggregateOutputDescriptor WeightedMode(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor LogisticRegression(Elastic.Clients.Elasticsearch.MachineLearning.Weights? value) { - WeightedModeValue = null; - WeightedModeDescriptor = null; - WeightedModeDescriptorAction = configure; - return Self; + Instance.LogisticRegression = value; + return this; } - public AggregateOutputDescriptor WeightedSum(Elastic.Clients.Elasticsearch.MachineLearning.Weights? weightedSum) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor LogisticRegression(System.Action action) { - WeightedSumDescriptor = null; - WeightedSumDescriptorAction = null; - WeightedSumValue = weightedSum; - return Self; + Instance.LogisticRegression = Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor.Build(action); + return this; } - public AggregateOutputDescriptor WeightedSum(Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor WeightedMode(Elastic.Clients.Elasticsearch.MachineLearning.Weights? value) { - WeightedSumValue = null; - WeightedSumDescriptorAction = null; - WeightedSumDescriptor = descriptor; - return Self; + Instance.WeightedMode = value; + return this; } - public AggregateOutputDescriptor WeightedSum(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor WeightedMode(System.Action action) { - WeightedSumValue = null; - WeightedSumDescriptor = null; - WeightedSumDescriptorAction = configure; - return Self; + Instance.WeightedMode = Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor WeightedSum(Elastic.Clients.Elasticsearch.MachineLearning.Weights? value) { - writer.WriteStartObject(); - if (ExponentDescriptor is not null) - { - writer.WritePropertyName("exponent"); - JsonSerializer.Serialize(writer, ExponentDescriptor, options); - } - else if (ExponentDescriptorAction is not null) - { - writer.WritePropertyName("exponent"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(ExponentDescriptorAction), options); - } - else if (ExponentValue is not null) - { - writer.WritePropertyName("exponent"); - JsonSerializer.Serialize(writer, ExponentValue, options); - } - - if (LogisticRegressionDescriptor is not null) - { - writer.WritePropertyName("logistic_regression"); - JsonSerializer.Serialize(writer, LogisticRegressionDescriptor, options); - } - else if (LogisticRegressionDescriptorAction is not null) - { - writer.WritePropertyName("logistic_regression"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(LogisticRegressionDescriptorAction), options); - } - else if (LogisticRegressionValue is not null) - { - writer.WritePropertyName("logistic_regression"); - JsonSerializer.Serialize(writer, LogisticRegressionValue, options); - } + Instance.WeightedSum = value; + return this; + } - if (WeightedModeDescriptor is not null) - { - writer.WritePropertyName("weighted_mode"); - JsonSerializer.Serialize(writer, WeightedModeDescriptor, options); - } - else if (WeightedModeDescriptorAction is not null) - { - writer.WritePropertyName("weighted_mode"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(WeightedModeDescriptorAction), options); - } - else if (WeightedModeValue is not null) - { - writer.WritePropertyName("weighted_mode"); - JsonSerializer.Serialize(writer, WeightedModeValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor WeightedSum(System.Action action) + { + Instance.WeightedSum = Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor.Build(action); + return this; + } - if (WeightedSumDescriptor is not null) - { - writer.WritePropertyName("weighted_sum"); - JsonSerializer.Serialize(writer, WeightedSumDescriptor, options); - } - else if (WeightedSumDescriptorAction is not null) - { - writer.WritePropertyName("weighted_sum"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(WeightedSumDescriptorAction), options); - } - else if (WeightedSumValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("weighted_sum"); - JsonSerializer.Serialize(writer, WeightedSumValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfig.g.cs index 317b1ad5cbb..6bf7eacc3b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfig.g.cs @@ -17,25 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnalysisConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationAnalyzer = System.Text.Json.JsonEncodedText.Encode("categorization_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFieldName = System.Text.Json.JsonEncodedText.Encode("categorization_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFilters = System.Text.Json.JsonEncodedText.Encode("categorization_filters"); + private static readonly System.Text.Json.JsonEncodedText PropDetectors = System.Text.Json.JsonEncodedText.Encode("detectors"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencers = System.Text.Json.JsonEncodedText.Encode("influencers"); + private static readonly System.Text.Json.JsonEncodedText PropLatency = System.Text.Json.JsonEncodedText.Encode("latency"); + private static readonly System.Text.Json.JsonEncodedText PropModelPruneWindow = System.Text.Json.JsonEncodedText.Encode("model_prune_window"); + private static readonly System.Text.Json.JsonEncodedText PropMultivariateByFields = System.Text.Json.JsonEncodedText.Encode("multivariate_by_fields"); + private static readonly System.Text.Json.JsonEncodedText PropPerPartitionCategorization = System.Text.Json.JsonEncodedText.Encode("per_partition_categorization"); + private static readonly System.Text.Json.JsonEncodedText PropSummaryCountFieldName = System.Text.Json.JsonEncodedText.Encode("summary_count_field_name"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketSpan = default; + LocalJsonValue propCategorizationAnalyzer = default; + LocalJsonValue propCategorizationFieldName = default; + LocalJsonValue?> propCategorizationFilters = default; + LocalJsonValue> propDetectors = default; + LocalJsonValue propInfluencers = default; + LocalJsonValue propLatency = default; + LocalJsonValue propModelPruneWindow = default; + LocalJsonValue propMultivariateByFields = default; + LocalJsonValue propPerPartitionCategorization = default; + LocalJsonValue propSummaryCountFieldName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, null)) + { + continue; + } + + if (propCategorizationAnalyzer.TryReadProperty(ref reader, options, PropCategorizationAnalyzer, null)) + { + continue; + } + + if (propCategorizationFieldName.TryReadProperty(ref reader, options, PropCategorizationFieldName, null)) + { + continue; + } + + if (propCategorizationFilters.TryReadProperty(ref reader, options, PropCategorizationFilters, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDetectors.TryReadProperty(ref reader, options, PropDetectors, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propInfluencers.TryReadProperty(ref reader, options, PropInfluencers, null)) + { + continue; + } + + if (propLatency.TryReadProperty(ref reader, options, PropLatency, null)) + { + continue; + } + + if (propModelPruneWindow.TryReadProperty(ref reader, options, PropModelPruneWindow, null)) + { + continue; + } + + if (propMultivariateByFields.TryReadProperty(ref reader, options, PropMultivariateByFields, null)) + { + continue; + } + + if (propPerPartitionCategorization.TryReadProperty(ref reader, options, PropPerPartitionCategorization, null)) + { + continue; + } + + if (propSummaryCountFieldName.TryReadProperty(ref reader, options, PropSummaryCountFieldName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketSpan = propBucketSpan.Value, + CategorizationAnalyzer = propCategorizationAnalyzer.Value, + CategorizationFieldName = propCategorizationFieldName.Value, + CategorizationFilters = propCategorizationFilters.Value, + Detectors = propDetectors.Value, + Influencers = propInfluencers.Value, + Latency = propLatency.Value, + ModelPruneWindow = propModelPruneWindow.Value, + MultivariateByFields = propMultivariateByFields.Value, + PerPartitionCategorization = propPerPartitionCategorization.Value, + SummaryCountFieldName = propSummaryCountFieldName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, null); + writer.WriteProperty(options, PropCategorizationAnalyzer, value.CategorizationAnalyzer, null, null); + writer.WriteProperty(options, PropCategorizationFieldName, value.CategorizationFieldName, null, null); + writer.WriteProperty(options, PropCategorizationFilters, value.CategorizationFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDetectors, value.Detectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInfluencers, value.Influencers, null, null); + writer.WriteProperty(options, PropLatency, value.Latency, null, null); + writer.WriteProperty(options, PropModelPruneWindow, value.ModelPruneWindow, null, null); + writer.WriteProperty(options, PropMultivariateByFields, value.MultivariateByFields, null, null); + writer.WriteProperty(options, PropPerPartitionCategorization, value.PerPartitionCategorization, null, null); + writer.WriteProperty(options, PropSummaryCountFieldName, value.SummaryCountFieldName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigConverter))] public sealed partial class AnalysisConfig { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfig(System.Collections.Generic.ICollection detectors) + { + Detectors = detectors; + } +#if NET7_0_OR_GREATER + public AnalysisConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalysisConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The size of the interval that the analysis is aggregated into, typically between 5m and 1h. This value should be either a whole number of days or equate to a /// whole number of buckets in one day. If the anomaly detection job uses a datafeed with aggregations, this value must also be divisible by the interval of the date histogram aggregation. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] public Elastic.Clients.Elasticsearch.Duration? BucketSpan { get; set; } /// @@ -43,7 +190,6 @@ public sealed partial class AnalysisConfig /// If categorization_field_name is specified, you can also define the analyzer that is used to interpret the categorization field. This property cannot be used at the same time as categorization_filters. The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. The categorization_analyzer field can be specified either as a string or as an object. If it is a string, it must refer to a built-in analyzer or one added by another plugin. /// /// - [JsonInclude, JsonPropertyName("categorization_analyzer")] public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? CategorizationAnalyzer { get; set; } /// @@ -51,7 +197,6 @@ public sealed partial class AnalysisConfig /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - [JsonInclude, JsonPropertyName("categorization_field_name")] public Elastic.Clients.Elasticsearch.Field? CategorizationFieldName { get; set; } /// @@ -59,24 +204,24 @@ public sealed partial class AnalysisConfig /// If categorization_field_name is specified, you can also define optional filters. This property expects an array of regular expressions. The expressions are used to filter out matching sequences from the categorization field values. You can use this functionality to fine tune the categorization by excluding sequences from consideration when categories are defined. For example, you can exclude SQL statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. If you only want to define simple regular expression filters that are applied prior to tokenization, setting this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, use the categorization_analyzer property instead and include the filters as pattern_replace character filters. The effect is exactly the same. /// /// - [JsonInclude, JsonPropertyName("categorization_filters")] - public ICollection? CategorizationFilters { get; set; } + public System.Collections.Generic.ICollection? CategorizationFilters { get; set; } /// /// /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. /// /// - [JsonInclude, JsonPropertyName("detectors")] - public ICollection Detectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Detectors { get; set; } /// /// /// A comma separated list of influencer field names. Typically these can be the by, over, or partition fields that are used in the detector configuration. You might also want to use a field name that is not specifically named in a detector, but is available as part of the input data. When you use multiple detectors, the use of influencers is recommended as it aggregates results for each influencer entity. /// /// - [JsonInclude, JsonPropertyName("influencers")] - [JsonConverter(typeof(FieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Influencers { get; set; } /// @@ -84,7 +229,6 @@ public sealed partial class AnalysisConfig /// The size of the window in which to expect data that is out of time order. If you specify a non-zero value, it must be greater than or equal to one second. NOTE: Latency is applicable only when you send data by using the post data API. /// /// - [JsonInclude, JsonPropertyName("latency")] public Elastic.Clients.Elasticsearch.Duration? Latency { get; set; } /// @@ -92,7 +236,6 @@ public sealed partial class AnalysisConfig /// Advanced configuration option. Affects the pruning of models that have not been updated for the given time duration. The value must be set to a multiple of the bucket_span. If set too low, important information may be removed from the model. For jobs created in 8.1 and later, the default value is the greater of 30d or 20 times bucket_span. /// /// - [JsonInclude, JsonPropertyName("model_prune_window")] public Elastic.Clients.Elasticsearch.Duration? ModelPruneWindow { get; set; } /// @@ -100,7 +243,6 @@ public sealed partial class AnalysisConfig /// This functionality is reserved for internal use. It is not supported for use in customer environments and is not subject to the support SLA of official GA features. If set to true, the analysis will automatically find correlations between metrics for a given by field value and report anomalies when those correlations cease to hold. For example, suppose CPU and memory usage on host A is usually highly correlated with the same metrics on host B. Perhaps this correlation occurs because they are running a load-balanced application. If you enable this property, anomalies will be reported when, for example, CPU usage on host A is high and the value of CPU usage on host B is low. That is to say, you’ll see an anomaly when the CPU of host A is unusual given the CPU of host B. To use the multivariate_by_fields property, you must also specify by_field_name in your detector. /// /// - [JsonInclude, JsonPropertyName("multivariate_by_fields")] public bool? MultivariateByFields { get; set; } /// @@ -108,7 +250,6 @@ public sealed partial class AnalysisConfig /// Settings related to how categorization interacts with partition fields. /// /// - [JsonInclude, JsonPropertyName("per_partition_categorization")] public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorization { get; set; } /// @@ -116,34 +257,27 @@ public sealed partial class AnalysisConfig /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. /// /// - [JsonInclude, JsonPropertyName("summary_count_field_name")] public Elastic.Clients.Elasticsearch.Field? SummaryCountFieldName { get; set; } } -public sealed partial class AnalysisConfigDescriptor : SerializableDescriptor> +public readonly partial struct AnalysisConfigDescriptor { - internal AnalysisConfigDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig instance) + { + Instance = instance; + } - public AnalysisConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfigDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration? BucketSpanValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? CategorizationAnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? CategorizationFieldNameValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private ICollection DetectorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorsDescriptor { get; set; } - private Action> DetectorsDescriptorAction { get; set; } - private Action>[] DetectorsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Fields? InfluencersValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? LatencyValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ModelPruneWindowValue { get; set; } - private bool? MultivariateByFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor PerPartitionCategorizationDescriptor { get; set; } - private Action PerPartitionCategorizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SummaryCountFieldNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) => descriptor.Instance; /// /// @@ -151,10 +285,10 @@ public AnalysisConfigDescriptor() : base() /// whole number of buckets in one day. If the anomaly detection job uses a datafeed with aggregations, this value must also be divisible by the interval of the date histogram aggregation. /// /// - public AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? bucketSpan) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? value) { - BucketSpanValue = bucketSpan; - return Self; + Instance.BucketSpan = value; + return this; } /// @@ -162,21 +296,21 @@ public AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsea /// If categorization_field_name is specified, you can also define the analyzer that is used to interpret the categorization field. This property cannot be used at the same time as categorization_filters. The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. The categorization_analyzer field can be specified either as a string or as an object. If it is a string, it must refer to a built-in analyzer or one added by another plugin. /// /// - public AnalysisConfigDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? categorizationAnalyzer) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? value) { - CategorizationAnalyzerValue = categorizationAnalyzer; - return Self; + Instance.CategorizationAnalyzer = value; + return this; } /// /// - /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. + /// If categorization_field_name is specified, you can also define the analyzer that is used to interpret the categorization field. This property cannot be used at the same time as categorization_filters. The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. The categorization_analyzer field can be specified either as a string or as an object. If it is a string, it must refer to a built-in analyzer or one added by another plugin. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clients.Elasticsearch.Field? categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationAnalyzer(System.Func action) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationAnalyzer = Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerFactory.Build(action); + return this; } /// @@ -184,10 +318,10 @@ public AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clien /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Expression> categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clients.Elasticsearch.Field? value) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationFieldName = value; + return this; } /// @@ -195,10 +329,21 @@ public AnalysisConfigDescriptor CategorizationFieldName(Expre /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Expression> categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFieldName(System.Linq.Expressions.Expression> value) + { + Instance.CategorizationFieldName = value; + return this; + } + + /// + /// + /// If categorization_field_name is specified, you can also define optional filters. This property expects an array of regular expressions. The expressions are used to filter out matching sequences from the categorization field values. You can use this functionality to fine tune the categorization by excluding sequences from consideration when categories are defined. For example, you can exclude SQL statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. If you only want to define simple regular expression filters that are applied prior to tokenization, setting this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, use the categorization_analyzer property instead and include the filters as pattern_replace character filters. The effect is exactly the same. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationFilters = value; + return this; } /// @@ -206,10 +351,10 @@ public AnalysisConfigDescriptor CategorizationFieldName(Expressioncategorization_field_name is specified, you can also define optional filters. This property expects an array of regular expressions. The expressions are used to filter out matching sequences from the categorization field values. You can use this functionality to fine tune the categorization by excluding sequences from consideration when categories are defined. For example, you can exclude SQL statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. If you only want to define simple regular expression filters that are applied prior to tokenization, setting this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, use the categorization_analyzer property instead and include the filters as pattern_replace character filters. The effect is exactly the same. /// /// - public AnalysisConfigDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFilters(params string[] values) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -217,40 +362,49 @@ public AnalysisConfigDescriptor CategorizationFilters(ICollection /// - public AnalysisConfigDescriptor Detectors(ICollection detectors) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(System.Collections.Generic.ICollection value) { - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsValue = detectors; - return Self; + Instance.Detectors = value; + return this; } - public AnalysisConfigDescriptor Detectors(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) + /// + /// + /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(params Elastic.Clients.Elasticsearch.MachineLearning.Detector[] values) { - DetectorsValue = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsDescriptor = descriptor; - return Self; + Instance.Detectors = [.. values]; + return this; } - public AnalysisConfigDescriptor Detectors(Action> configure) + /// + /// + /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(params System.Action>?[] actions) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorActions = null; - DetectorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; } - public AnalysisConfigDescriptor Detectors(params Action>[] configure) + /// + /// + /// A comma separated list of influencer field names. Typically these can be the by, over, or partition fields that are used in the detector configuration. You might also want to use a field name that is not specifically named in a detector, but is available as part of the input data. When you use multiple detectors, the use of influencers is recommended as it aggregates results for each influencer entity. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticsearch.Fields? value) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = configure; - return Self; + Instance.Influencers = value; + return this; } /// @@ -258,10 +412,10 @@ public AnalysisConfigDescriptor Detectors(params Action /// - public AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticsearch.Fields? influencers) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Influencers(params System.Linq.Expressions.Expression>[] value) { - InfluencersValue = influencers; - return Self; + Instance.Influencers = value; + return this; } /// @@ -269,10 +423,10 @@ public AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticse /// The size of the window in which to expect data that is out of time order. If you specify a non-zero value, it must be greater than or equal to one second. NOTE: Latency is applicable only when you send data by using the post data API. /// /// - public AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch.Duration? latency) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch.Duration? value) { - LatencyValue = latency; - return Self; + Instance.Latency = value; + return this; } /// @@ -280,10 +434,10 @@ public AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch /// Advanced configuration option. Affects the pruning of models that have not been updated for the given time duration. The value must be set to a multiple of the bucket_span. If set too low, important information may be removed from the model. For jobs created in 8.1 and later, the default value is the greater of 30d or 20 times bucket_span. /// /// - public AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? modelPruneWindow) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? value) { - ModelPruneWindowValue = modelPruneWindow; - return Self; + Instance.ModelPruneWindow = value; + return this; } /// @@ -291,10 +445,10 @@ public AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elas /// This functionality is reserved for internal use. It is not supported for use in customer environments and is not subject to the support SLA of official GA features. If set to true, the analysis will automatically find correlations between metrics for a given by field value and report anomalies when those correlations cease to hold. For example, suppose CPU and memory usage on host A is usually highly correlated with the same metrics on host B. Perhaps this correlation occurs because they are running a load-balanced application. If you enable this property, anomalies will be reported when, for example, CPU usage on host A is high and the value of CPU usage on host B is low. That is to say, you’ll see an anomaly when the CPU of host A is unusual given the CPU of host B. To use the multivariate_by_fields property, you must also specify by_field_name in your detector. /// /// - public AnalysisConfigDescriptor MultivariateByFields(bool? multivariateByFields = true) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor MultivariateByFields(bool? value = true) { - MultivariateByFieldsValue = multivariateByFields; - return Self; + Instance.MultivariateByFields = value; + return this; } /// @@ -302,39 +456,32 @@ public AnalysisConfigDescriptor MultivariateByFields(bool? multivaria /// Settings related to how categorization interacts with partition fields. /// /// - public AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? perPartitionCategorization) - { - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationValue = perPartitionCategorization; - return Self; - } - - public AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? value) { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationDescriptor = descriptor; - return Self; + Instance.PerPartitionCategorization = value; + return this; } - public AnalysisConfigDescriptor PerPartitionCategorization(Action configure) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization() { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = configure; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(null); + return this; } /// /// - /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. + /// Settings related to how categorization interacts with partition fields. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients.Elasticsearch.Field? summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization(System.Action? action) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(action); + return this; } /// @@ -342,10 +489,10 @@ public AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Expression> summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients.Elasticsearch.Field? value) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.SummaryCountFieldName = value; + return this; } /// @@ -353,144 +500,39 @@ public AnalysisConfigDescriptor SummaryCountFieldName(Express /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Expression> summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor SummaryCountFieldName(System.Linq.Expressions.Expression> value) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.SummaryCountFieldName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig Build(System.Action> action) { - writer.WriteStartObject(); - if (BucketSpanValue is not null) - { - writer.WritePropertyName("bucket_span"); - JsonSerializer.Serialize(writer, BucketSpanValue, options); - } - - if (CategorizationAnalyzerValue is not null) - { - writer.WritePropertyName("categorization_analyzer"); - JsonSerializer.Serialize(writer, CategorizationAnalyzerValue, options); - } - - if (CategorizationFieldNameValue is not null) - { - writer.WritePropertyName("categorization_field_name"); - JsonSerializer.Serialize(writer, CategorizationFieldNameValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - if (DetectorsDescriptor is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DetectorsDescriptor, options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorAction is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(DetectorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorActions is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - foreach (var action in DetectorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("detectors"); - JsonSerializer.Serialize(writer, DetectorsValue, options); - } - - if (InfluencersValue is not null) - { - writer.WritePropertyName("influencers"); - JsonSerializer.Serialize(writer, InfluencersValue, options); - } - - if (LatencyValue is not null) - { - writer.WritePropertyName("latency"); - JsonSerializer.Serialize(writer, LatencyValue, options); - } - - if (ModelPruneWindowValue is not null) - { - writer.WritePropertyName("model_prune_window"); - JsonSerializer.Serialize(writer, ModelPruneWindowValue, options); - } - - if (MultivariateByFieldsValue.HasValue) - { - writer.WritePropertyName("multivariate_by_fields"); - writer.WriteBooleanValue(MultivariateByFieldsValue.Value); - } - - if (PerPartitionCategorizationDescriptor is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationDescriptor, options); - } - else if (PerPartitionCategorizationDescriptorAction is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(PerPartitionCategorizationDescriptorAction), options); - } - else if (PerPartitionCategorizationValue is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationValue, options); - } - - if (SummaryCountFieldNameValue is not null) - { - writer.WritePropertyName("summary_count_field_name"); - JsonSerializer.Serialize(writer, SummaryCountFieldNameValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AnalysisConfigDescriptor : SerializableDescriptor +public readonly partial struct AnalysisConfigDescriptor { - internal AnalysisConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig Instance { get; init; } - public AnalysisConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? BucketSpanValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? CategorizationAnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? CategorizationFieldNameValue { get; set; } - private ICollection? CategorizationFiltersValue { get; set; } - private ICollection DetectorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorsDescriptor { get; set; } - private Action DetectorsDescriptorAction { get; set; } - private Action[] DetectorsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Fields? InfluencersValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? LatencyValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? ModelPruneWindowValue { get; set; } - private bool? MultivariateByFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor PerPartitionCategorizationDescriptor { get; set; } - private Action PerPartitionCategorizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? SummaryCountFieldNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor descriptor) => descriptor.Instance; /// /// @@ -498,10 +540,10 @@ public AnalysisConfigDescriptor() : base() /// whole number of buckets in one day. If the anomaly detection job uses a datafeed with aggregations, this value must also be divisible by the interval of the date histogram aggregation. /// /// - public AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? bucketSpan) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duration? value) { - BucketSpanValue = bucketSpan; - return Self; + Instance.BucketSpan = value; + return this; } /// @@ -509,21 +551,21 @@ public AnalysisConfigDescriptor BucketSpan(Elastic.Clients.Elasticsearch.Duratio /// If categorization_field_name is specified, you can also define the analyzer that is used to interpret the categorization field. This property cannot be used at the same time as categorization_filters. The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. The categorization_analyzer field can be specified either as a string or as an object. If it is a string, it must refer to a built-in analyzer or one added by another plugin. /// /// - public AnalysisConfigDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? categorizationAnalyzer) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? value) { - CategorizationAnalyzerValue = categorizationAnalyzer; - return Self; + Instance.CategorizationAnalyzer = value; + return this; } /// /// - /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. + /// If categorization_field_name is specified, you can also define the analyzer that is used to interpret the categorization field. This property cannot be used at the same time as categorization_filters. The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. The categorization_analyzer field can be specified either as a string or as an object. If it is a string, it must refer to a built-in analyzer or one added by another plugin. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clients.Elasticsearch.Field? categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationAnalyzer(System.Func action) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationAnalyzer = Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerFactory.Build(action); + return this; } /// @@ -531,10 +573,10 @@ public AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clients.Elastics /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Expression> categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFieldName(Elastic.Clients.Elasticsearch.Field? value) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationFieldName = value; + return this; } /// @@ -542,10 +584,21 @@ public AnalysisConfigDescriptor CategorizationFieldName(Expre /// If this property is specified, the values of the specified field will be categorized. The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - public AnalysisConfigDescriptor CategorizationFieldName(Expression> categorizationFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFieldName(System.Linq.Expressions.Expression> value) + { + Instance.CategorizationFieldName = value; + return this; + } + + /// + /// + /// If categorization_field_name is specified, you can also define optional filters. This property expects an array of regular expressions. The expressions are used to filter out matching sequences from the categorization field values. You can use this functionality to fine tune the categorization by excluding sequences from consideration when categories are defined. For example, you can exclude SQL statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. If you only want to define simple regular expression filters that are applied prior to tokenization, setting this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, use the categorization_analyzer property instead and include the filters as pattern_replace character filters. The effect is exactly the same. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFilters(System.Collections.Generic.ICollection? value) { - CategorizationFieldNameValue = categorizationFieldName; - return Self; + Instance.CategorizationFilters = value; + return this; } /// @@ -553,10 +606,10 @@ public AnalysisConfigDescriptor CategorizationFieldName(Expressioncategorization_field_name is specified, you can also define optional filters. This property expects an array of regular expressions. The expressions are used to filter out matching sequences from the categorization field values. You can use this functionality to fine tune the categorization by excluding sequences from consideration when categories are defined. For example, you can exclude SQL statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer. If you only want to define simple regular expression filters that are applied prior to tokenization, setting this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, use the categorization_analyzer property instead and include the filters as pattern_replace character filters. The effect is exactly the same. /// /// - public AnalysisConfigDescriptor CategorizationFilters(ICollection? categorizationFilters) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor CategorizationFilters(params string[] values) { - CategorizationFiltersValue = categorizationFilters; - return Self; + Instance.CategorizationFilters = [.. values]; + return this; } /// @@ -564,40 +617,66 @@ public AnalysisConfigDescriptor CategorizationFilters(ICollection? categ /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. /// /// - public AnalysisConfigDescriptor Detectors(ICollection detectors) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(System.Collections.Generic.ICollection value) { - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsValue = detectors; - return Self; + Instance.Detectors = value; + return this; } - public AnalysisConfigDescriptor Detectors(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) + /// + /// + /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(params Elastic.Clients.Elasticsearch.MachineLearning.Detector[] values) { - DetectorsValue = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = null; - DetectorsDescriptor = descriptor; - return Self; + Instance.Detectors = [.. values]; + return this; } - public AnalysisConfigDescriptor Detectors(Action configure) + /// + /// + /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(params System.Action?[] actions) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorActions = null; - DetectorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; } - public AnalysisConfigDescriptor Detectors(params Action[] configure) + /// + /// + /// Detector configuration objects specify which data fields a job analyzes. They also specify which analytical functions are used. You can specify multiple detectors for a job. If the detectors array does not contain at least one detector, no analysis can occur and an error is returned. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Detectors(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor.Build(action)); + } + + Instance.Detectors = items; + return this; + } + + /// + /// + /// A comma separated list of influencer field names. Typically these can be the by, over, or partition fields that are used in the detector configuration. You might also want to use a field name that is not specifically named in a detector, but is available as part of the input data. When you use multiple detectors, the use of influencers is recommended as it aggregates results for each influencer entity. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticsearch.Fields? value) { - DetectorsValue = null; - DetectorsDescriptor = null; - DetectorsDescriptorAction = null; - DetectorsDescriptorActions = configure; - return Self; + Instance.Influencers = value; + return this; } /// @@ -605,10 +684,10 @@ public AnalysisConfigDescriptor Detectors(params Action /// - public AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticsearch.Fields? influencers) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Influencers(params System.Linq.Expressions.Expression>[] value) { - InfluencersValue = influencers; - return Self; + Instance.Influencers = value; + return this; } /// @@ -616,10 +695,10 @@ public AnalysisConfigDescriptor Influencers(Elastic.Clients.Elasticsearch.Fields /// The size of the window in which to expect data that is out of time order. If you specify a non-zero value, it must be greater than or equal to one second. NOTE: Latency is applicable only when you send data by using the post data API. /// /// - public AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch.Duration? latency) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch.Duration? value) { - LatencyValue = latency; - return Self; + Instance.Latency = value; + return this; } /// @@ -627,10 +706,10 @@ public AnalysisConfigDescriptor Latency(Elastic.Clients.Elasticsearch.Duration? /// Advanced configuration option. Affects the pruning of models that have not been updated for the given time duration. The value must be set to a multiple of the bucket_span. If set too low, important information may be removed from the model. For jobs created in 8.1 and later, the default value is the greater of 30d or 20 times bucket_span. /// /// - public AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? modelPruneWindow) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.Duration? value) { - ModelPruneWindowValue = modelPruneWindow; - return Self; + Instance.ModelPruneWindow = value; + return this; } /// @@ -638,10 +717,10 @@ public AnalysisConfigDescriptor ModelPruneWindow(Elastic.Clients.Elasticsearch.D /// This functionality is reserved for internal use. It is not supported for use in customer environments and is not subject to the support SLA of official GA features. If set to true, the analysis will automatically find correlations between metrics for a given by field value and report anomalies when those correlations cease to hold. For example, suppose CPU and memory usage on host A is usually highly correlated with the same metrics on host B. Perhaps this correlation occurs because they are running a load-balanced application. If you enable this property, anomalies will be reported when, for example, CPU usage on host A is high and the value of CPU usage on host B is low. That is to say, you’ll see an anomaly when the CPU of host A is unusual given the CPU of host B. To use the multivariate_by_fields property, you must also specify by_field_name in your detector. /// /// - public AnalysisConfigDescriptor MultivariateByFields(bool? multivariateByFields = true) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor MultivariateByFields(bool? value = true) { - MultivariateByFieldsValue = multivariateByFields; - return Self; + Instance.MultivariateByFields = value; + return this; } /// @@ -649,39 +728,32 @@ public AnalysisConfigDescriptor MultivariateByFields(bool? multivariateByFields /// Settings related to how categorization interacts with partition fields. /// /// - public AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? perPartitionCategorization) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? value) { - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationValue = perPartitionCategorization; - return Self; + Instance.PerPartitionCategorization = value; + return this; } - public AnalysisConfigDescriptor PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor descriptor) - { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptorAction = null; - PerPartitionCategorizationDescriptor = descriptor; - return Self; - } - - public AnalysisConfigDescriptor PerPartitionCategorization(Action configure) + /// + /// + /// Settings related to how categorization interacts with partition fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization() { - PerPartitionCategorizationValue = null; - PerPartitionCategorizationDescriptor = null; - PerPartitionCategorizationDescriptorAction = configure; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(null); + return this; } /// /// - /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. + /// Settings related to how categorization interacts with partition fields. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients.Elasticsearch.Field? summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor PerPartitionCategorization(System.Action? action) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.PerPartitionCategorization = Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor.Build(action); + return this; } /// @@ -689,10 +761,10 @@ public AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients.Elasticsea /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Expression> summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor SummaryCountFieldName(Elastic.Clients.Elasticsearch.Field? value) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.SummaryCountFieldName = value; + return this; } /// @@ -700,116 +772,17 @@ public AnalysisConfigDescriptor SummaryCountFieldName(Express /// If this property is specified, the data that is fed to the job is expected to be pre-summarized. This property value is the name of the field that contains the count of raw data points that have been summarized. The same summary_count_field_name applies to all detectors in the job. NOTE: The summary_count_field_name property cannot be used with the metric function. /// /// - public AnalysisConfigDescriptor SummaryCountFieldName(Expression> summaryCountFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor SummaryCountFieldName(System.Linq.Expressions.Expression> value) { - SummaryCountFieldNameValue = summaryCountFieldName; - return Self; + Instance.SummaryCountFieldName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig Build(System.Action action) { - writer.WriteStartObject(); - if (BucketSpanValue is not null) - { - writer.WritePropertyName("bucket_span"); - JsonSerializer.Serialize(writer, BucketSpanValue, options); - } - - if (CategorizationAnalyzerValue is not null) - { - writer.WritePropertyName("categorization_analyzer"); - JsonSerializer.Serialize(writer, CategorizationAnalyzerValue, options); - } - - if (CategorizationFieldNameValue is not null) - { - writer.WritePropertyName("categorization_field_name"); - JsonSerializer.Serialize(writer, CategorizationFieldNameValue, options); - } - - if (CategorizationFiltersValue is not null) - { - writer.WritePropertyName("categorization_filters"); - JsonSerializer.Serialize(writer, CategorizationFiltersValue, options); - } - - if (DetectorsDescriptor is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DetectorsDescriptor, options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorAction is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(DetectorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DetectorsDescriptorActions is not null) - { - writer.WritePropertyName("detectors"); - writer.WriteStartArray(); - foreach (var action in DetectorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("detectors"); - JsonSerializer.Serialize(writer, DetectorsValue, options); - } - - if (InfluencersValue is not null) - { - writer.WritePropertyName("influencers"); - JsonSerializer.Serialize(writer, InfluencersValue, options); - } - - if (LatencyValue is not null) - { - writer.WritePropertyName("latency"); - JsonSerializer.Serialize(writer, LatencyValue, options); - } - - if (ModelPruneWindowValue is not null) - { - writer.WritePropertyName("model_prune_window"); - JsonSerializer.Serialize(writer, ModelPruneWindowValue, options); - } - - if (MultivariateByFieldsValue.HasValue) - { - writer.WritePropertyName("multivariate_by_fields"); - writer.WriteBooleanValue(MultivariateByFieldsValue.Value); - } - - if (PerPartitionCategorizationDescriptor is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationDescriptor, options); - } - else if (PerPartitionCategorizationDescriptorAction is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(PerPartitionCategorizationDescriptorAction), options); - } - else if (PerPartitionCategorizationValue is not null) - { - writer.WritePropertyName("per_partition_categorization"); - JsonSerializer.Serialize(writer, PerPartitionCategorizationValue, options); - } - - if (SummaryCountFieldNameValue is not null) - { - writer.WritePropertyName("summary_count_field_name"); - JsonSerializer.Serialize(writer, SummaryCountFieldNameValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfigRead.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfigRead.g.cs index d474fce980b..96d0cf84fef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfigRead.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisConfigRead.g.cs @@ -17,25 +17,178 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnalysisConfigReadConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationAnalyzer = System.Text.Json.JsonEncodedText.Encode("categorization_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFieldName = System.Text.Json.JsonEncodedText.Encode("categorization_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationFilters = System.Text.Json.JsonEncodedText.Encode("categorization_filters"); + private static readonly System.Text.Json.JsonEncodedText PropDetectors = System.Text.Json.JsonEncodedText.Encode("detectors"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencers = System.Text.Json.JsonEncodedText.Encode("influencers"); + private static readonly System.Text.Json.JsonEncodedText PropLatency = System.Text.Json.JsonEncodedText.Encode("latency"); + private static readonly System.Text.Json.JsonEncodedText PropModelPruneWindow = System.Text.Json.JsonEncodedText.Encode("model_prune_window"); + private static readonly System.Text.Json.JsonEncodedText PropMultivariateByFields = System.Text.Json.JsonEncodedText.Encode("multivariate_by_fields"); + private static readonly System.Text.Json.JsonEncodedText PropPerPartitionCategorization = System.Text.Json.JsonEncodedText.Encode("per_partition_categorization"); + private static readonly System.Text.Json.JsonEncodedText PropSummaryCountFieldName = System.Text.Json.JsonEncodedText.Encode("summary_count_field_name"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketSpan = default; + LocalJsonValue propCategorizationAnalyzer = default; + LocalJsonValue propCategorizationFieldName = default; + LocalJsonValue?> propCategorizationFilters = default; + LocalJsonValue> propDetectors = default; + LocalJsonValue propInfluencers = default; + LocalJsonValue propLatency = default; + LocalJsonValue propModelPruneWindow = default; + LocalJsonValue propMultivariateByFields = default; + LocalJsonValue propPerPartitionCategorization = default; + LocalJsonValue propSummaryCountFieldName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, null)) + { + continue; + } + + if (propCategorizationAnalyzer.TryReadProperty(ref reader, options, PropCategorizationAnalyzer, null)) + { + continue; + } + + if (propCategorizationFieldName.TryReadProperty(ref reader, options, PropCategorizationFieldName, null)) + { + continue; + } + + if (propCategorizationFilters.TryReadProperty(ref reader, options, PropCategorizationFilters, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDetectors.TryReadProperty(ref reader, options, PropDetectors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propInfluencers.TryReadProperty(ref reader, options, PropInfluencers, null)) + { + continue; + } + + if (propLatency.TryReadProperty(ref reader, options, PropLatency, null)) + { + continue; + } + + if (propModelPruneWindow.TryReadProperty(ref reader, options, PropModelPruneWindow, null)) + { + continue; + } + + if (propMultivariateByFields.TryReadProperty(ref reader, options, PropMultivariateByFields, null)) + { + continue; + } + + if (propPerPartitionCategorization.TryReadProperty(ref reader, options, PropPerPartitionCategorization, null)) + { + continue; + } + + if (propSummaryCountFieldName.TryReadProperty(ref reader, options, PropSummaryCountFieldName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketSpan = propBucketSpan.Value, + CategorizationAnalyzer = propCategorizationAnalyzer.Value, + CategorizationFieldName = propCategorizationFieldName.Value, + CategorizationFilters = propCategorizationFilters.Value, + Detectors = propDetectors.Value, + Influencers = propInfluencers.Value, + Latency = propLatency.Value, + ModelPruneWindow = propModelPruneWindow.Value, + MultivariateByFields = propMultivariateByFields.Value, + PerPartitionCategorization = propPerPartitionCategorization.Value, + SummaryCountFieldName = propSummaryCountFieldName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigRead value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, null); + writer.WriteProperty(options, PropCategorizationAnalyzer, value.CategorizationAnalyzer, null, null); + writer.WriteProperty(options, PropCategorizationFieldName, value.CategorizationFieldName, null, null); + writer.WriteProperty(options, PropCategorizationFilters, value.CategorizationFilters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDetectors, value.Detectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInfluencers, value.Influencers, null, null); + writer.WriteProperty(options, PropLatency, value.Latency, null, null); + writer.WriteProperty(options, PropModelPruneWindow, value.ModelPruneWindow, null, null); + writer.WriteProperty(options, PropMultivariateByFields, value.MultivariateByFields, null, null); + writer.WriteProperty(options, PropPerPartitionCategorization, value.PerPartitionCategorization, null, null); + writer.WriteProperty(options, PropSummaryCountFieldName, value.SummaryCountFieldName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfigReadConverter))] public sealed partial class AnalysisConfigRead { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisConfigRead(Elastic.Clients.Elasticsearch.Duration bucketSpan, System.Collections.Generic.IReadOnlyCollection detectors, Elastic.Clients.Elasticsearch.Fields influencers) + { + BucketSpan = bucketSpan; + Detectors = detectors; + Influencers = influencers; + } +#if NET7_0_OR_GREATER + public AnalysisConfigRead() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalysisConfigRead() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalysisConfigRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The size of the interval that the analysis is aggregated into, typically between 5m and 1h. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public Elastic.Clients.Elasticsearch.Duration BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration BucketSpan { get; set; } /// /// @@ -44,8 +197,7 @@ public sealed partial class AnalysisConfigRead /// The categorization analyzer specifies how the categorization_field is interpreted by the categorization process. /// /// - [JsonInclude, JsonPropertyName("categorization_analyzer")] - public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? CategorizationAnalyzer { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer? CategorizationAnalyzer { get; set; } /// /// @@ -53,8 +205,7 @@ public sealed partial class AnalysisConfigRead /// The resulting categories must be used in a detector by setting by_field_name, over_field_name, or partition_field_name to the keyword mlcategory. /// /// - [JsonInclude, JsonPropertyName("categorization_field_name")] - public string? CategorizationFieldName { get; init; } + public string? CategorizationFieldName { get; set; } /// /// @@ -63,8 +214,7 @@ public sealed partial class AnalysisConfigRead /// The expressions are used to filter out matching sequences from the categorization field values. /// /// - [JsonInclude, JsonPropertyName("categorization_filters")] - public IReadOnlyCollection? CategorizationFilters { get; init; } + public System.Collections.Generic.IReadOnlyCollection? CategorizationFilters { get; set; } /// /// @@ -74,8 +224,11 @@ public sealed partial class AnalysisConfigRead /// You can specify multiple detectors for a job. /// /// - [JsonInclude, JsonPropertyName("detectors")] - public IReadOnlyCollection Detectors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Detectors { get; set; } /// /// @@ -85,8 +238,11 @@ public sealed partial class AnalysisConfigRead /// When you use multiple detectors, the use of influencers is recommended as it aggregates results for each influencer entity. /// /// - [JsonInclude, JsonPropertyName("influencers")] - public IReadOnlyCollection Influencers { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Influencers { get; set; } /// /// @@ -95,8 +251,7 @@ public sealed partial class AnalysisConfigRead /// If you specify a non-zero value, it must be greater than or equal to one second. /// /// - [JsonInclude, JsonPropertyName("latency")] - public Elastic.Clients.Elasticsearch.Duration? Latency { get; init; } + public Elastic.Clients.Elasticsearch.Duration? Latency { get; set; } /// /// @@ -109,8 +264,7 @@ public sealed partial class AnalysisConfigRead /// For jobs created in 8.1 and later, the default value is the greater of 30d or 20 times bucket_span. /// /// - [JsonInclude, JsonPropertyName("model_prune_window")] - public Elastic.Clients.Elasticsearch.Duration? ModelPruneWindow { get; init; } + public Elastic.Clients.Elasticsearch.Duration? ModelPruneWindow { get; set; } /// /// @@ -119,16 +273,14 @@ public sealed partial class AnalysisConfigRead /// If set to true, the analysis will automatically find correlations between metrics for a given by field value and report anomalies when those correlations cease to hold. /// /// - [JsonInclude, JsonPropertyName("multivariate_by_fields")] - public bool? MultivariateByFields { get; init; } + public bool? MultivariateByFields { get; set; } /// /// /// Settings related to how categorization interacts with partition fields. /// /// - [JsonInclude, JsonPropertyName("per_partition_categorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorization { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization? PerPartitionCategorization { get; set; } /// /// @@ -137,6 +289,5 @@ public sealed partial class AnalysisConfigRead /// The same summary_count_field_name applies to all detectors in the job. /// /// - [JsonInclude, JsonPropertyName("summary_count_field_name")] - public string? SummaryCountFieldName { get; init; } + public string? SummaryCountFieldName { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisLimits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisLimits.g.cs index 714533433d4..dd8414c6fb0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisLimits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisLimits.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnalysisLimitsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCategorizationExamplesLimit = System.Text.Json.JsonEncodedText.Encode("categorization_examples_limit"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCategorizationExamplesLimit = default; + LocalJsonValue propModelMemoryLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCategorizationExamplesLimit.TryReadProperty(ref reader, options, PropCategorizationExamplesLimit, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CategorizationExamplesLimit = propCategorizationExamplesLimit.Value, + ModelMemoryLimit = propModelMemoryLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCategorizationExamplesLimit, value.CategorizationExamplesLimit, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsConverter))] public sealed partial class AnalysisLimits { +#if NET7_0_OR_GREATER + public AnalysisLimits() + { + } +#endif +#if !NET7_0_OR_GREATER + public AnalysisLimits() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalysisLimits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum number of examples stored per category in memory and in the results data store. If you increase this value, more examples are available, however it requires that you have more storage available. If you set this value to 0, no examples are stored. NOTE: The categorization_examples_limit applies only to analysis that uses categorization. /// /// - [JsonInclude, JsonPropertyName("categorization_examples_limit")] public long? CategorizationExamplesLimit { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class AnalysisLimits /// The approximate maximum amount of memory resources that are required for analytical processing. Once this limit is approached, data pruning becomes more aggressive. Upon exceeding this limit, new entities are not modeled. If the xpack.ml.max_model_memory_limit setting has a value greater than 0 and less than 1024mb, that value is used instead of the default. The default value is relatively small to ensure that high resource usage is a conscious decision. If you have jobs that are expected to analyze high cardinality fields, you will likely need to use a higher value. If you specify a number instead of a string, the units are assumed to be MiB. Specifying a string is recommended for clarity. If you specify a byte size unit of b or kb and the number does not equate to a discrete number of megabytes, it is rounded down to the closest MiB. The minimum valid value is 1 MiB. If you specify a value less than 1 MiB, an error occurs. If you specify a value for the xpack.ml.max_model_memory_limit setting, an error occurs when you try to create jobs that have model_memory_limit values greater than that setting value. /// /// - [JsonInclude, JsonPropertyName("model_memory_limit")] public Elastic.Clients.Elasticsearch.ByteSize? ModelMemoryLimit { get; set; } } -public sealed partial class AnalysisLimitsDescriptor : SerializableDescriptor +public readonly partial struct AnalysisLimitsDescriptor { - internal AnalysisLimitsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits Instance { get; init; } - public AnalysisLimitsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisLimitsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits instance) { + Instance = instance; } - private long? CategorizationExamplesLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? ModelMemoryLimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisLimitsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor descriptor) => descriptor.Instance; /// /// /// The maximum number of examples stored per category in memory and in the results data store. If you increase this value, more examples are available, however it requires that you have more storage available. If you set this value to 0, no examples are stored. NOTE: The categorization_examples_limit applies only to analysis that uses categorization. /// /// - public AnalysisLimitsDescriptor CategorizationExamplesLimit(long? categorizationExamplesLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor CategorizationExamplesLimit(long? value) { - CategorizationExamplesLimitValue = categorizationExamplesLimit; - return Self; + Instance.CategorizationExamplesLimit = value; + return this; } /// @@ -73,27 +140,33 @@ public AnalysisLimitsDescriptor CategorizationExamplesLimit(long? categorization /// The approximate maximum amount of memory resources that are required for analytical processing. Once this limit is approached, data pruning becomes more aggressive. Upon exceeding this limit, new entities are not modeled. If the xpack.ml.max_model_memory_limit setting has a value greater than 0 and less than 1024mb, that value is used instead of the default. The default value is relatively small to ensure that high resource usage is a conscious decision. If you have jobs that are expected to analyze high cardinality fields, you will likely need to use a higher value. If you specify a number instead of a string, the units are assumed to be MiB. Specifying a string is recommended for clarity. If you specify a byte size unit of b or kb and the number does not equate to a discrete number of megabytes, it is rounded down to the closest MiB. The minimum valid value is 1 MiB. If you specify a value less than 1 MiB, an error occurs. If you specify a value for the xpack.ml.max_model_memory_limit setting, an error occurs when you try to create jobs that have model_memory_limit values greater than that setting value. /// /// - public AnalysisLimitsDescriptor ModelMemoryLimit(Elastic.Clients.Elasticsearch.ByteSize? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor ModelMemoryLimit(Elastic.Clients.Elasticsearch.ByteSize? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The approximate maximum amount of memory resources that are required for analytical processing. Once this limit is approached, data pruning becomes more aggressive. Upon exceeding this limit, new entities are not modeled. If the xpack.ml.max_model_memory_limit setting has a value greater than 0 and less than 1024mb, that value is used instead of the default. The default value is relatively small to ensure that high resource usage is a conscious decision. If you have jobs that are expected to analyze high cardinality fields, you will likely need to use a higher value. If you specify a number instead of a string, the units are assumed to be MiB. Specifying a string is recommended for clarity. If you specify a byte size unit of b or kb and the number does not equate to a discrete number of megabytes, it is rounded down to the closest MiB. The minimum valid value is 1 MiB. If you specify a value less than 1 MiB, an error occurs. If you specify a value for the xpack.ml.max_model_memory_limit setting, an error occurs when you try to create jobs that have model_memory_limit values greater than that setting value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor ModelMemoryLimit(System.Func action) { - writer.WriteStartObject(); - if (CategorizationExamplesLimitValue.HasValue) - { - writer.WritePropertyName("categorization_examples_limit"); - writer.WriteNumberValue(CategorizationExamplesLimitValue.Value); - } + Instance.ModelMemoryLimit = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (ModelMemoryLimitValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("model_memory_limit"); - JsonSerializer.Serialize(writer, ModelMemoryLimitValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimitsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisMemoryLimit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisMemoryLimit.g.cs index 60063d4c66d..9c9508f586e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisMemoryLimit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnalysisMemoryLimit.g.cs @@ -17,53 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnalysisMemoryLimitConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModelMemoryLimit = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModelMemoryLimit = propModelMemoryLimit.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitConverter))] public sealed partial class AnalysisMemoryLimit { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisMemoryLimit(string modelMemoryLimit) + { + ModelMemoryLimit = modelMemoryLimit; + } +#if NET7_0_OR_GREATER + public AnalysisMemoryLimit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalysisMemoryLimit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalysisMemoryLimit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. /// /// - [JsonInclude, JsonPropertyName("model_memory_limit")] - public string ModelMemoryLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelMemoryLimit { get; set; } } -public sealed partial class AnalysisMemoryLimitDescriptor : SerializableDescriptor +public readonly partial struct AnalysisMemoryLimitDescriptor { - internal AnalysisMemoryLimitDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit Instance { get; init; } - public AnalysisMemoryLimitDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisMemoryLimitDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit instance) { + Instance = instance; } - private string ModelMemoryLimitValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalysisMemoryLimitDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit instance) => new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit(Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor descriptor) => descriptor.Instance; /// /// /// Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes. /// /// - public AnalysisMemoryLimitDescriptor ModelMemoryLimit(string modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor ModelMemoryLimit(string value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.ModelMemoryLimit = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimitDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.AnalysisMemoryLimit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Anomaly.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Anomaly.g.cs index 8c006610d5e..a2c22bc2bb6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Anomaly.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Anomaly.g.cs @@ -17,207 +17,492 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnomalyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActual = System.Text.Json.JsonEncodedText.Encode("actual"); + private static readonly System.Text.Json.JsonEncodedText PropAnomalyScoreExplanation = System.Text.Json.JsonEncodedText.Encode("anomaly_score_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropByFieldName = System.Text.Json.JsonEncodedText.Encode("by_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropByFieldValue = System.Text.Json.JsonEncodedText.Encode("by_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropCauses = System.Text.Json.JsonEncodedText.Encode("causes"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorIndex = System.Text.Json.JsonEncodedText.Encode("detector_index"); + private static readonly System.Text.Json.JsonEncodedText PropFieldName = System.Text.Json.JsonEncodedText.Encode("field_name"); + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropFunctionDescription = System.Text.Json.JsonEncodedText.Encode("function_description"); + private static readonly System.Text.Json.JsonEncodedText PropGeoResults = System.Text.Json.JsonEncodedText.Encode("geo_results"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencers = System.Text.Json.JsonEncodedText.Encode("influencers"); + private static readonly System.Text.Json.JsonEncodedText PropInitialRecordScore = System.Text.Json.JsonEncodedText.Encode("initial_record_score"); + private static readonly System.Text.Json.JsonEncodedText PropIsInterim = System.Text.Json.JsonEncodedText.Encode("is_interim"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldName = System.Text.Json.JsonEncodedText.Encode("over_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldValue = System.Text.Json.JsonEncodedText.Encode("over_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldName = System.Text.Json.JsonEncodedText.Encode("partition_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldValue = System.Text.Json.JsonEncodedText.Encode("partition_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropProbability = System.Text.Json.JsonEncodedText.Encode("probability"); + private static readonly System.Text.Json.JsonEncodedText PropRecordScore = System.Text.Json.JsonEncodedText.Encode("record_score"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTypical = System.Text.Json.JsonEncodedText.Encode("typical"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Anomaly Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propActual = default; + LocalJsonValue propAnomalyScoreExplanation = default; + LocalJsonValue propBucketSpan = default; + LocalJsonValue propByFieldName = default; + LocalJsonValue propByFieldValue = default; + LocalJsonValue?> propCauses = default; + LocalJsonValue propDetectorIndex = default; + LocalJsonValue propFieldName = default; + LocalJsonValue propFunction = default; + LocalJsonValue propFunctionDescription = default; + LocalJsonValue propGeoResults = default; + LocalJsonValue?> propInfluencers = default; + LocalJsonValue propInitialRecordScore = default; + LocalJsonValue propIsInterim = default; + LocalJsonValue propJobId = default; + LocalJsonValue propOverFieldName = default; + LocalJsonValue propOverFieldValue = default; + LocalJsonValue propPartitionFieldName = default; + LocalJsonValue propPartitionFieldValue = default; + LocalJsonValue propProbability = default; + LocalJsonValue propRecordScore = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue?> propTypical = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActual.TryReadProperty(ref reader, options, PropActual, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propAnomalyScoreExplanation.TryReadProperty(ref reader, options, PropAnomalyScoreExplanation, null)) + { + continue; + } + + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker)))) + { + continue; + } + + if (propByFieldName.TryReadProperty(ref reader, options, PropByFieldName, null)) + { + continue; + } + + if (propByFieldValue.TryReadProperty(ref reader, options, PropByFieldValue, null)) + { + continue; + } + + if (propCauses.TryReadProperty(ref reader, options, PropCauses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDetectorIndex.TryReadProperty(ref reader, options, PropDetectorIndex, null)) + { + continue; + } + + if (propFieldName.TryReadProperty(ref reader, options, PropFieldName, null)) + { + continue; + } + + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propFunctionDescription.TryReadProperty(ref reader, options, PropFunctionDescription, null)) + { + continue; + } + + if (propGeoResults.TryReadProperty(ref reader, options, PropGeoResults, null)) + { + continue; + } + + if (propInfluencers.TryReadProperty(ref reader, options, PropInfluencers, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propInitialRecordScore.TryReadProperty(ref reader, options, PropInitialRecordScore, null)) + { + continue; + } + + if (propIsInterim.TryReadProperty(ref reader, options, PropIsInterim, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propOverFieldName.TryReadProperty(ref reader, options, PropOverFieldName, null)) + { + continue; + } + + if (propOverFieldValue.TryReadProperty(ref reader, options, PropOverFieldValue, null)) + { + continue; + } + + if (propPartitionFieldName.TryReadProperty(ref reader, options, PropPartitionFieldName, null)) + { + continue; + } + + if (propPartitionFieldValue.TryReadProperty(ref reader, options, PropPartitionFieldValue, null)) + { + continue; + } + + if (propProbability.TryReadProperty(ref reader, options, PropProbability, null)) + { + continue; + } + + if (propRecordScore.TryReadProperty(ref reader, options, PropRecordScore, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTypical.TryReadProperty(ref reader, options, PropTypical, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Anomaly(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actual = propActual.Value, + AnomalyScoreExplanation = propAnomalyScoreExplanation.Value, + BucketSpan = propBucketSpan.Value, + ByFieldName = propByFieldName.Value, + ByFieldValue = propByFieldValue.Value, + Causes = propCauses.Value, + DetectorIndex = propDetectorIndex.Value, + FieldName = propFieldName.Value, + Function = propFunction.Value, + FunctionDescription = propFunctionDescription.Value, + GeoResults = propGeoResults.Value, + Influencers = propInfluencers.Value, + InitialRecordScore = propInitialRecordScore.Value, + IsInterim = propIsInterim.Value, + JobId = propJobId.Value, + OverFieldName = propOverFieldName.Value, + OverFieldValue = propOverFieldValue.Value, + PartitionFieldName = propPartitionFieldName.Value, + PartitionFieldValue = propPartitionFieldValue.Value, + Probability = propProbability.Value, + RecordScore = propRecordScore.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value, + Typical = propTypical.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Anomaly value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActual, value.Actual, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropAnomalyScoreExplanation, value.AnomalyScoreExplanation, null, null); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker))); + writer.WriteProperty(options, PropByFieldName, value.ByFieldName, null, null); + writer.WriteProperty(options, PropByFieldValue, value.ByFieldValue, null, null); + writer.WriteProperty(options, PropCauses, value.Causes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDetectorIndex, value.DetectorIndex, null, null); + writer.WriteProperty(options, PropFieldName, value.FieldName, null, null); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropFunctionDescription, value.FunctionDescription, null, null); + writer.WriteProperty(options, PropGeoResults, value.GeoResults, null, null); + writer.WriteProperty(options, PropInfluencers, value.Influencers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInitialRecordScore, value.InitialRecordScore, null, null); + writer.WriteProperty(options, PropIsInterim, value.IsInterim, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropOverFieldName, value.OverFieldName, null, null); + writer.WriteProperty(options, PropOverFieldValue, value.OverFieldValue, null, null); + writer.WriteProperty(options, PropPartitionFieldName, value.PartitionFieldName, null, null); + writer.WriteProperty(options, PropPartitionFieldValue, value.PartitionFieldValue, null, null); + writer.WriteProperty(options, PropProbability, value.Probability, null, null); + writer.WriteProperty(options, PropRecordScore, value.RecordScore, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTypical, value.Typical, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnomalyConverter))] public sealed partial class Anomaly { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Anomaly(System.TimeSpan bucketSpan, int detectorIndex, double initialRecordScore, bool isInterim, string jobId, double probability, double recordScore, string resultType, System.DateTimeOffset timestamp) + { + BucketSpan = bucketSpan; + DetectorIndex = detectorIndex; + InitialRecordScore = initialRecordScore; + IsInterim = isInterim; + JobId = jobId; + Probability = probability; + RecordScore = recordScore; + ResultType = resultType; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public Anomaly() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Anomaly() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Anomaly(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The actual value for the bucket. /// /// - [JsonInclude, JsonPropertyName("actual")] - public IReadOnlyCollection? Actual { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Actual { get; set; } /// /// /// Information about the factors impacting the initial anomaly score. /// /// - [JsonInclude, JsonPropertyName("anomaly_score_explanation")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanation? AnomalyScoreExplanation { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanation? AnomalyScoreExplanation { get; set; } /// /// /// The length of the bucket in seconds. This value matches the bucket_span that is specified in the job. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public long BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan BucketSpan { get; set; } /// /// /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. /// /// - [JsonInclude, JsonPropertyName("by_field_name")] - public string? ByFieldName { get; init; } + public string? ByFieldName { get; set; } /// /// /// The value of by_field_name. /// /// - [JsonInclude, JsonPropertyName("by_field_value")] - public string? ByFieldValue { get; init; } + public string? ByFieldValue { get; set; } /// /// /// For population analysis, an over field must be specified in the detector. This property contains an array of anomaly records that are the causes for the anomaly that has been identified for the over field. This sub-resource contains the most anomalous records for the over_field_name. For scalability reasons, a maximum of the 10 most significant causes of the anomaly are returned. As part of the core analytical modeling, these low-level anomaly records are aggregated for their parent over field record. The causes resource contains similar elements to the record resource, namely actual, typical, geo_results.actual_point, geo_results.typical_point, *_field_name and *_field_value. Probability and scores are not applicable to causes. /// /// - [JsonInclude, JsonPropertyName("causes")] - public IReadOnlyCollection? Causes { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Causes { get; set; } /// /// /// A unique identifier for the detector. /// /// - [JsonInclude, JsonPropertyName("detector_index")] - public int DetectorIndex { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DetectorIndex { get; set; } /// /// /// Certain functions require a field to operate on, for example, sum(). For those functions, this value is the name of the field to be analyzed. /// /// - [JsonInclude, JsonPropertyName("field_name")] - public string? FieldName { get; init; } + public string? FieldName { get; set; } /// /// /// The function in which the anomaly occurs, as specified in the detector configuration. For example, max. /// /// - [JsonInclude, JsonPropertyName("function")] - public string? Function { get; init; } + public string? Function { get; set; } /// /// /// The description of the function in which the anomaly occurs, as specified in the detector configuration. /// /// - [JsonInclude, JsonPropertyName("function_description")] - public string? FunctionDescription { get; init; } + public string? FunctionDescription { get; set; } /// /// /// If the detector function is lat_long, this object contains comma delimited strings for the latitude and longitude of the actual and typical values. /// /// - [JsonInclude, JsonPropertyName("geo_results")] - public Elastic.Clients.Elasticsearch.MachineLearning.GeoResults? GeoResults { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.GeoResults? GeoResults { get; set; } /// /// /// If influencers were specified in the detector configuration, this array contains influencers that contributed to or were to blame for an anomaly. /// /// - [JsonInclude, JsonPropertyName("influencers")] - public IReadOnlyCollection? Influencers { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Influencers { get; set; } /// /// /// A normalized score between 0-100, which is based on the probability of the anomalousness of this record. This is the initial value that was calculated at the time the bucket was processed. /// /// - [JsonInclude, JsonPropertyName("initial_record_score")] - public double InitialRecordScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double InitialRecordScore { get; set; } /// /// /// If true, this is an interim result. In other words, the results are calculated based on partial input data. /// /// - [JsonInclude, JsonPropertyName("is_interim")] - public bool IsInterim { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsInterim { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. /// /// - [JsonInclude, JsonPropertyName("over_field_name")] - public string? OverFieldName { get; init; } + public string? OverFieldName { get; set; } /// /// /// The value of over_field_name. /// /// - [JsonInclude, JsonPropertyName("over_field_value")] - public string? OverFieldValue { get; init; } + public string? OverFieldValue { get; set; } /// /// /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. /// /// - [JsonInclude, JsonPropertyName("partition_field_name")] - public string? PartitionFieldName { get; init; } + public string? PartitionFieldName { get; set; } /// /// /// The value of partition_field_name. /// /// - [JsonInclude, JsonPropertyName("partition_field_value")] - public string? PartitionFieldValue { get; init; } + public string? PartitionFieldValue { get; set; } /// /// /// The probability of the individual anomaly occurring, in the range 0 to 1. For example, 0.0000772031. This value can be held to a high precision of over 300 decimal places, so the record_score is provided as a human-readable and friendly interpretation of this. /// /// - [JsonInclude, JsonPropertyName("probability")] - public double Probability { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Probability { get; set; } /// /// /// A normalized score between 0-100, which is based on the probability of the anomalousness of this record. Unlike initial_record_score, this value will be updated by a re-normalization process as new data is analyzed. /// /// - [JsonInclude, JsonPropertyName("record_score")] - public double RecordScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double RecordScore { get; set; } /// /// /// Internal. This is always set to record. /// /// - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } /// /// /// The typical value for the bucket, according to analytical modeling. /// /// - [JsonInclude, JsonPropertyName("typical")] - public IReadOnlyCollection? Typical { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Typical { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyCause.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyCause.g.cs index 5b7654f74c6..69365edb8e5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyCause.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyCause.g.cs @@ -17,46 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnomalyCauseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActual = System.Text.Json.JsonEncodedText.Encode("actual"); + private static readonly System.Text.Json.JsonEncodedText PropByFieldName = System.Text.Json.JsonEncodedText.Encode("by_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropByFieldValue = System.Text.Json.JsonEncodedText.Encode("by_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropCorrelatedByFieldValue = System.Text.Json.JsonEncodedText.Encode("correlated_by_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropFieldName = System.Text.Json.JsonEncodedText.Encode("field_name"); + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropFunctionDescription = System.Text.Json.JsonEncodedText.Encode("function_description"); + private static readonly System.Text.Json.JsonEncodedText PropGeoResults = System.Text.Json.JsonEncodedText.Encode("geo_results"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencers = System.Text.Json.JsonEncodedText.Encode("influencers"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldName = System.Text.Json.JsonEncodedText.Encode("over_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldValue = System.Text.Json.JsonEncodedText.Encode("over_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldName = System.Text.Json.JsonEncodedText.Encode("partition_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldValue = System.Text.Json.JsonEncodedText.Encode("partition_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropProbability = System.Text.Json.JsonEncodedText.Encode("probability"); + private static readonly System.Text.Json.JsonEncodedText PropTypical = System.Text.Json.JsonEncodedText.Encode("typical"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnomalyCause Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propActual = default; + LocalJsonValue propByFieldName = default; + LocalJsonValue propByFieldValue = default; + LocalJsonValue propCorrelatedByFieldValue = default; + LocalJsonValue propFieldName = default; + LocalJsonValue propFunction = default; + LocalJsonValue propFunctionDescription = default; + LocalJsonValue propGeoResults = default; + LocalJsonValue?> propInfluencers = default; + LocalJsonValue propOverFieldName = default; + LocalJsonValue propOverFieldValue = default; + LocalJsonValue propPartitionFieldName = default; + LocalJsonValue propPartitionFieldValue = default; + LocalJsonValue propProbability = default; + LocalJsonValue?> propTypical = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActual.TryReadProperty(ref reader, options, PropActual, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propByFieldName.TryReadProperty(ref reader, options, PropByFieldName, null)) + { + continue; + } + + if (propByFieldValue.TryReadProperty(ref reader, options, PropByFieldValue, null)) + { + continue; + } + + if (propCorrelatedByFieldValue.TryReadProperty(ref reader, options, PropCorrelatedByFieldValue, null)) + { + continue; + } + + if (propFieldName.TryReadProperty(ref reader, options, PropFieldName, null)) + { + continue; + } + + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propFunctionDescription.TryReadProperty(ref reader, options, PropFunctionDescription, null)) + { + continue; + } + + if (propGeoResults.TryReadProperty(ref reader, options, PropGeoResults, null)) + { + continue; + } + + if (propInfluencers.TryReadProperty(ref reader, options, PropInfluencers, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOverFieldName.TryReadProperty(ref reader, options, PropOverFieldName, null)) + { + continue; + } + + if (propOverFieldValue.TryReadProperty(ref reader, options, PropOverFieldValue, null)) + { + continue; + } + + if (propPartitionFieldName.TryReadProperty(ref reader, options, PropPartitionFieldName, null)) + { + continue; + } + + if (propPartitionFieldValue.TryReadProperty(ref reader, options, PropPartitionFieldValue, null)) + { + continue; + } + + if (propProbability.TryReadProperty(ref reader, options, PropProbability, null)) + { + continue; + } + + if (propTypical.TryReadProperty(ref reader, options, PropTypical, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnomalyCause(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actual = propActual.Value, + ByFieldName = propByFieldName.Value, + ByFieldValue = propByFieldValue.Value, + CorrelatedByFieldValue = propCorrelatedByFieldValue.Value, + FieldName = propFieldName.Value, + Function = propFunction.Value, + FunctionDescription = propFunctionDescription.Value, + GeoResults = propGeoResults.Value, + Influencers = propInfluencers.Value, + OverFieldName = propOverFieldName.Value, + OverFieldValue = propOverFieldValue.Value, + PartitionFieldName = propPartitionFieldName.Value, + PartitionFieldValue = propPartitionFieldValue.Value, + Probability = propProbability.Value, + Typical = propTypical.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnomalyCause value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActual, value.Actual, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropByFieldName, value.ByFieldName, null, null); + writer.WriteProperty(options, PropByFieldValue, value.ByFieldValue, null, null); + writer.WriteProperty(options, PropCorrelatedByFieldValue, value.CorrelatedByFieldValue, null, null); + writer.WriteProperty(options, PropFieldName, value.FieldName, null, null); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropFunctionDescription, value.FunctionDescription, null, null); + writer.WriteProperty(options, PropGeoResults, value.GeoResults, null, null); + writer.WriteProperty(options, PropInfluencers, value.Influencers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverFieldName, value.OverFieldName, null, null); + writer.WriteProperty(options, PropOverFieldValue, value.OverFieldValue, null, null); + writer.WriteProperty(options, PropPartitionFieldName, value.PartitionFieldName, null, null); + writer.WriteProperty(options, PropPartitionFieldValue, value.PartitionFieldValue, null, null); + writer.WriteProperty(options, PropProbability, value.Probability, null, null); + writer.WriteProperty(options, PropTypical, value.Typical, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnomalyCauseConverter))] public sealed partial class AnomalyCause { - [JsonInclude, JsonPropertyName("actual")] - public IReadOnlyCollection? Actual { get; init; } - [JsonInclude, JsonPropertyName("by_field_name")] - public string? ByFieldName { get; init; } - [JsonInclude, JsonPropertyName("by_field_value")] - public string? ByFieldValue { get; init; } - [JsonInclude, JsonPropertyName("correlated_by_field_value")] - public string? CorrelatedByFieldValue { get; init; } - [JsonInclude, JsonPropertyName("field_name")] - public string? FieldName { get; init; } - [JsonInclude, JsonPropertyName("function")] - public string? Function { get; init; } - [JsonInclude, JsonPropertyName("function_description")] - public string? FunctionDescription { get; init; } - [JsonInclude, JsonPropertyName("geo_results")] - public Elastic.Clients.Elasticsearch.MachineLearning.GeoResults? GeoResults { get; init; } - [JsonInclude, JsonPropertyName("influencers")] - public IReadOnlyCollection? Influencers { get; init; } - [JsonInclude, JsonPropertyName("over_field_name")] - public string? OverFieldName { get; init; } - [JsonInclude, JsonPropertyName("over_field_value")] - public string? OverFieldValue { get; init; } - [JsonInclude, JsonPropertyName("partition_field_name")] - public string? PartitionFieldName { get; init; } - [JsonInclude, JsonPropertyName("partition_field_value")] - public string? PartitionFieldValue { get; init; } - [JsonInclude, JsonPropertyName("probability")] - public double Probability { get; init; } - [JsonInclude, JsonPropertyName("typical")] - public IReadOnlyCollection? Typical { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnomalyCause(double probability) + { + Probability = probability; + } +#if NET7_0_OR_GREATER + public AnomalyCause() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnomalyCause() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnomalyCause(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Actual { get; set; } + public string? ByFieldName { get; set; } + public string? ByFieldValue { get; set; } + public string? CorrelatedByFieldValue { get; set; } + public string? FieldName { get; set; } + public string? Function { get; set; } + public string? FunctionDescription { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.GeoResults? GeoResults { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Influencers { get; set; } + public string? OverFieldName { get; set; } + public string? OverFieldValue { get; set; } + public string? PartitionFieldName { get; set; } + public string? PartitionFieldValue { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Probability { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Typical { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyDetectors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyDetectors.g.cs index 252879eab56..bd60d147eed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyDetectors.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyDetectors.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnomalyDetectorsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCategorizationAnalyzer = System.Text.Json.JsonEncodedText.Encode("categorization_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationExamplesLimit = System.Text.Json.JsonEncodedText.Encode("categorization_examples_limit"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCategorizationAnalyzer = default; + LocalJsonValue propCategorizationExamplesLimit = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCategorizationAnalyzer.TryReadProperty(ref reader, options, PropCategorizationAnalyzer, null)) + { + continue; + } + + if (propCategorizationExamplesLimit.TryReadProperty(ref reader, options, PropCategorizationExamplesLimit, null)) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CategorizationAnalyzer = propCategorizationAnalyzer.Value, + CategorizationExamplesLimit = propCategorizationExamplesLimit.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCategorizationAnalyzer, value.CategorizationAnalyzer, null, null); + writer.WriteProperty(options, PropCategorizationExamplesLimit, value.CategorizationExamplesLimit, null, null); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectorsConverter))] public sealed partial class AnomalyDetectors { - [JsonInclude, JsonPropertyName("categorization_analyzer")] - public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer CategorizationAnalyzer { get; init; } - [JsonInclude, JsonPropertyName("categorization_examples_limit")] - public int CategorizationExamplesLimit { get; init; } - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] - public int DailyModelSnapshotRetentionAfterDays { get; init; } - [JsonInclude, JsonPropertyName("model_memory_limit")] - public string ModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] - public int ModelSnapshotRetentionDays { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnomalyDetectors(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer categorizationAnalyzer, int categorizationExamplesLimit, int dailyModelSnapshotRetentionAfterDays, string modelMemoryLimit, int modelSnapshotRetentionDays) + { + CategorizationAnalyzer = categorizationAnalyzer; + CategorizationExamplesLimit = categorizationExamplesLimit; + DailyModelSnapshotRetentionAfterDays = dailyModelSnapshotRetentionAfterDays; + ModelMemoryLimit = modelMemoryLimit; + ModelSnapshotRetentionDays = modelSnapshotRetentionDays; + } +#if NET7_0_OR_GREATER + public AnomalyDetectors() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnomalyDetectors() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnomalyDetectors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer CategorizationAnalyzer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int CategorizationExamplesLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DailyModelSnapshotRetentionAfterDays { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelMemoryLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ModelSnapshotRetentionDays { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyExplanation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyExplanation.g.cs index 14920cc8f36..53b90b62bae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyExplanation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/AnomalyExplanation.g.cs @@ -17,95 +17,218 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class AnomalyExplanationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyCharacteristicsImpact = System.Text.Json.JsonEncodedText.Encode("anomaly_characteristics_impact"); + private static readonly System.Text.Json.JsonEncodedText PropAnomalyLength = System.Text.Json.JsonEncodedText.Encode("anomaly_length"); + private static readonly System.Text.Json.JsonEncodedText PropAnomalyType = System.Text.Json.JsonEncodedText.Encode("anomaly_type"); + private static readonly System.Text.Json.JsonEncodedText PropHighVariancePenalty = System.Text.Json.JsonEncodedText.Encode("high_variance_penalty"); + private static readonly System.Text.Json.JsonEncodedText PropIncompleteBucketPenalty = System.Text.Json.JsonEncodedText.Encode("incomplete_bucket_penalty"); + private static readonly System.Text.Json.JsonEncodedText PropLowerConfidenceBound = System.Text.Json.JsonEncodedText.Encode("lower_confidence_bound"); + private static readonly System.Text.Json.JsonEncodedText PropMultiBucketImpact = System.Text.Json.JsonEncodedText.Encode("multi_bucket_impact"); + private static readonly System.Text.Json.JsonEncodedText PropSingleBucketImpact = System.Text.Json.JsonEncodedText.Encode("single_bucket_impact"); + private static readonly System.Text.Json.JsonEncodedText PropTypicalValue = System.Text.Json.JsonEncodedText.Encode("typical_value"); + private static readonly System.Text.Json.JsonEncodedText PropUpperConfidenceBound = System.Text.Json.JsonEncodedText.Encode("upper_confidence_bound"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyCharacteristicsImpact = default; + LocalJsonValue propAnomalyLength = default; + LocalJsonValue propAnomalyType = default; + LocalJsonValue propHighVariancePenalty = default; + LocalJsonValue propIncompleteBucketPenalty = default; + LocalJsonValue propLowerConfidenceBound = default; + LocalJsonValue propMultiBucketImpact = default; + LocalJsonValue propSingleBucketImpact = default; + LocalJsonValue propTypicalValue = default; + LocalJsonValue propUpperConfidenceBound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyCharacteristicsImpact.TryReadProperty(ref reader, options, PropAnomalyCharacteristicsImpact, null)) + { + continue; + } + + if (propAnomalyLength.TryReadProperty(ref reader, options, PropAnomalyLength, null)) + { + continue; + } + + if (propAnomalyType.TryReadProperty(ref reader, options, PropAnomalyType, null)) + { + continue; + } + + if (propHighVariancePenalty.TryReadProperty(ref reader, options, PropHighVariancePenalty, null)) + { + continue; + } + + if (propIncompleteBucketPenalty.TryReadProperty(ref reader, options, PropIncompleteBucketPenalty, null)) + { + continue; + } + + if (propLowerConfidenceBound.TryReadProperty(ref reader, options, PropLowerConfidenceBound, null)) + { + continue; + } + + if (propMultiBucketImpact.TryReadProperty(ref reader, options, PropMultiBucketImpact, null)) + { + continue; + } + + if (propSingleBucketImpact.TryReadProperty(ref reader, options, PropSingleBucketImpact, null)) + { + continue; + } + + if (propTypicalValue.TryReadProperty(ref reader, options, PropTypicalValue, null)) + { + continue; + } + + if (propUpperConfidenceBound.TryReadProperty(ref reader, options, PropUpperConfidenceBound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyCharacteristicsImpact = propAnomalyCharacteristicsImpact.Value, + AnomalyLength = propAnomalyLength.Value, + AnomalyType = propAnomalyType.Value, + HighVariancePenalty = propHighVariancePenalty.Value, + IncompleteBucketPenalty = propIncompleteBucketPenalty.Value, + LowerConfidenceBound = propLowerConfidenceBound.Value, + MultiBucketImpact = propMultiBucketImpact.Value, + SingleBucketImpact = propSingleBucketImpact.Value, + TypicalValue = propTypicalValue.Value, + UpperConfidenceBound = propUpperConfidenceBound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyCharacteristicsImpact, value.AnomalyCharacteristicsImpact, null, null); + writer.WriteProperty(options, PropAnomalyLength, value.AnomalyLength, null, null); + writer.WriteProperty(options, PropAnomalyType, value.AnomalyType, null, null); + writer.WriteProperty(options, PropHighVariancePenalty, value.HighVariancePenalty, null, null); + writer.WriteProperty(options, PropIncompleteBucketPenalty, value.IncompleteBucketPenalty, null, null); + writer.WriteProperty(options, PropLowerConfidenceBound, value.LowerConfidenceBound, null, null); + writer.WriteProperty(options, PropMultiBucketImpact, value.MultiBucketImpact, null, null); + writer.WriteProperty(options, PropSingleBucketImpact, value.SingleBucketImpact, null, null); + writer.WriteProperty(options, PropTypicalValue, value.TypicalValue, null, null); + writer.WriteProperty(options, PropUpperConfidenceBound, value.UpperConfidenceBound, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.AnomalyExplanationConverter))] public sealed partial class AnomalyExplanation { +#if NET7_0_OR_GREATER + public AnomalyExplanation() + { + } +#endif +#if !NET7_0_OR_GREATER + public AnomalyExplanation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnomalyExplanation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Impact from the duration and magnitude of the detected anomaly relative to the historical average. /// /// - [JsonInclude, JsonPropertyName("anomaly_characteristics_impact")] - public int? AnomalyCharacteristicsImpact { get; init; } + public int? AnomalyCharacteristicsImpact { get; set; } /// /// /// Length of the detected anomaly in the number of buckets. /// /// - [JsonInclude, JsonPropertyName("anomaly_length")] - public int? AnomalyLength { get; init; } + public int? AnomalyLength { get; set; } /// /// /// Type of the detected anomaly: spike or dip. /// /// - [JsonInclude, JsonPropertyName("anomaly_type")] - public string? AnomalyType { get; init; } + public string? AnomalyType { get; set; } /// /// /// Indicates reduction of anomaly score for the bucket with large confidence intervals. If a bucket has large confidence intervals, the score is reduced. /// /// - [JsonInclude, JsonPropertyName("high_variance_penalty")] - public bool? HighVariancePenalty { get; init; } + public bool? HighVariancePenalty { get; set; } /// /// /// If the bucket contains fewer samples than expected, the score is reduced. /// /// - [JsonInclude, JsonPropertyName("incomplete_bucket_penalty")] - public bool? IncompleteBucketPenalty { get; init; } + public bool? IncompleteBucketPenalty { get; set; } /// /// /// Lower bound of the 95% confidence interval. /// /// - [JsonInclude, JsonPropertyName("lower_confidence_bound")] - public double? LowerConfidenceBound { get; init; } + public double? LowerConfidenceBound { get; set; } /// /// /// Impact of the deviation between actual and typical values in the past 12 buckets. /// /// - [JsonInclude, JsonPropertyName("multi_bucket_impact")] - public int? MultiBucketImpact { get; init; } + public int? MultiBucketImpact { get; set; } /// /// /// Impact of the deviation between actual and typical values in the current bucket. /// /// - [JsonInclude, JsonPropertyName("single_bucket_impact")] - public int? SingleBucketImpact { get; init; } + public int? SingleBucketImpact { get; set; } /// /// /// Typical (expected) value for this bucket. /// /// - [JsonInclude, JsonPropertyName("typical_value")] - public double? TypicalValue { get; init; } + public double? TypicalValue { get; set; } /// /// /// Upper bound of the 95% confidence interval. /// /// - [JsonInclude, JsonPropertyName("upper_confidence_bound")] - public double? UpperConfidenceBound { get; init; } + public double? UpperConfidenceBound { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ApiKeyAuthorization.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ApiKeyAuthorization.g.cs index bf97fc9d3ed..5f938778daa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ApiKeyAuthorization.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ApiKeyAuthorization.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ApiKeyAuthorizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorizationConverter))] public sealed partial class ApiKeyAuthorization { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyAuthorization(string id, string name) + { + Id = id; + Name = name; + } +#if NET7_0_OR_GREATER + public ApiKeyAuthorization() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ApiKeyAuthorization() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApiKeyAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The identifier for the API key. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// The name of the API key. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketInfluencer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketInfluencer.g.cs index 30fe60c787c..728144ce700 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketInfluencer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketInfluencer.g.cs @@ -17,42 +17,208 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class BucketInfluencerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyScore = System.Text.Json.JsonEncodedText.Encode("anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencerFieldName = System.Text.Json.JsonEncodedText.Encode("influencer_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropInitialAnomalyScore = System.Text.Json.JsonEncodedText.Encode("initial_anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropIsInterim = System.Text.Json.JsonEncodedText.Encode("is_interim"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropProbability = System.Text.Json.JsonEncodedText.Encode("probability"); + private static readonly System.Text.Json.JsonEncodedText PropRawAnomalyScore = System.Text.Json.JsonEncodedText.Encode("raw_anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampString = System.Text.Json.JsonEncodedText.Encode("timestamp_string"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.BucketInfluencer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyScore = default; + LocalJsonValue propBucketSpan = default; + LocalJsonValue propInfluencerFieldName = default; + LocalJsonValue propInitialAnomalyScore = default; + LocalJsonValue propIsInterim = default; + LocalJsonValue propJobId = default; + LocalJsonValue propProbability = default; + LocalJsonValue propRawAnomalyScore = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTimestampString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyScore.TryReadProperty(ref reader, options, PropAnomalyScore, null)) + { + continue; + } + + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker)))) + { + continue; + } + + if (propInfluencerFieldName.TryReadProperty(ref reader, options, PropInfluencerFieldName, null)) + { + continue; + } + + if (propInitialAnomalyScore.TryReadProperty(ref reader, options, PropInitialAnomalyScore, null)) + { + continue; + } + + if (propIsInterim.TryReadProperty(ref reader, options, PropIsInterim, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propProbability.TryReadProperty(ref reader, options, PropProbability, null)) + { + continue; + } + + if (propRawAnomalyScore.TryReadProperty(ref reader, options, PropRawAnomalyScore, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimestampString.TryReadProperty(ref reader, options, PropTimestampString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.BucketInfluencer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyScore = propAnomalyScore.Value, + BucketSpan = propBucketSpan.Value, + InfluencerFieldName = propInfluencerFieldName.Value, + InitialAnomalyScore = propInitialAnomalyScore.Value, + IsInterim = propIsInterim.Value, + JobId = propJobId.Value, + Probability = propProbability.Value, + RawAnomalyScore = propRawAnomalyScore.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value, + TimestampString = propTimestampString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.BucketInfluencer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyScore, value.AnomalyScore, null, null); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker))); + writer.WriteProperty(options, PropInfluencerFieldName, value.InfluencerFieldName, null, null); + writer.WriteProperty(options, PropInitialAnomalyScore, value.InitialAnomalyScore, null, null); + writer.WriteProperty(options, PropIsInterim, value.IsInterim, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropProbability, value.Probability, null, null); + writer.WriteProperty(options, PropRawAnomalyScore, value.RawAnomalyScore, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimestampString, value.TimestampString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.BucketInfluencerConverter))] public sealed partial class BucketInfluencer { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketInfluencer(double anomalyScore, System.TimeSpan bucketSpan, string influencerFieldName, double initialAnomalyScore, bool isInterim, string jobId, double probability, double rawAnomalyScore, string resultType, System.DateTimeOffset timestamp) + { + AnomalyScore = anomalyScore; + BucketSpan = bucketSpan; + InfluencerFieldName = influencerFieldName; + InitialAnomalyScore = initialAnomalyScore; + IsInterim = isInterim; + JobId = jobId; + Probability = probability; + RawAnomalyScore = rawAnomalyScore; + ResultType = resultType; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public BucketInfluencer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketInfluencer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketInfluencer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A normalized score between 0-100, which is calculated for each bucket influencer. This score might be updated as /// newer data is analyzed. /// /// - [JsonInclude, JsonPropertyName("anomaly_score")] - public double AnomalyScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double AnomalyScore { get; set; } /// /// /// The length of the bucket in seconds. This value matches the bucket span that is specified in the job. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public long BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan BucketSpan { get; set; } /// /// /// The field name of the influencer. /// /// - [JsonInclude, JsonPropertyName("influencer_field_name")] - public string InfluencerFieldName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InfluencerFieldName { get; set; } /// /// @@ -60,24 +226,33 @@ public sealed partial class BucketInfluencer /// time the bucket was processed. /// /// - [JsonInclude, JsonPropertyName("initial_anomaly_score")] - public double InitialAnomalyScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double InitialAnomalyScore { get; set; } /// /// /// If true, this is an interim result. In other words, the results are calculated based on partial input data. /// /// - [JsonInclude, JsonPropertyName("is_interim")] - public bool IsInterim { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsInterim { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// @@ -86,38 +261,49 @@ public sealed partial class BucketInfluencer /// this. /// /// - [JsonInclude, JsonPropertyName("probability")] - public double Probability { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Probability { get; set; } /// /// /// Internal. /// /// - [JsonInclude, JsonPropertyName("raw_anomaly_score")] - public double RawAnomalyScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double RawAnomalyScore { get; set; } /// /// /// Internal. This value is always set to bucket_influencer. /// /// - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp_string")] - public DateTimeOffset? TimestampString { get; init; } + public System.DateTimeOffset? TimestampString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketSummary.g.cs index b90c1d498af..6e21baafd59 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/BucketSummary.g.cs @@ -17,18 +17,175 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class BucketSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyScore = System.Text.Json.JsonEncodedText.Encode("anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropBucketInfluencers = System.Text.Json.JsonEncodedText.Encode("bucket_influencers"); + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropEventCount = System.Text.Json.JsonEncodedText.Encode("event_count"); + private static readonly System.Text.Json.JsonEncodedText PropInitialAnomalyScore = System.Text.Json.JsonEncodedText.Encode("initial_anomaly_score"); + private static readonly System.Text.Json.JsonEncodedText PropIsInterim = System.Text.Json.JsonEncodedText.Encode("is_interim"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampString = System.Text.Json.JsonEncodedText.Encode("timestamp_string"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.BucketSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyScore = default; + LocalJsonValue> propBucketInfluencers = default; + LocalJsonValue propBucketSpan = default; + LocalJsonValue propEventCount = default; + LocalJsonValue propInitialAnomalyScore = default; + LocalJsonValue propIsInterim = default; + LocalJsonValue propJobId = default; + LocalJsonValue propProcessingTimeMs = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTimestampString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyScore.TryReadProperty(ref reader, options, PropAnomalyScore, null)) + { + continue; + } + + if (propBucketInfluencers.TryReadProperty(ref reader, options, PropBucketInfluencers, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker)))) + { + continue; + } + + if (propEventCount.TryReadProperty(ref reader, options, PropEventCount, null)) + { + continue; + } + + if (propInitialAnomalyScore.TryReadProperty(ref reader, options, PropInitialAnomalyScore, null)) + { + continue; + } + + if (propIsInterim.TryReadProperty(ref reader, options, PropIsInterim, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propProcessingTimeMs.TryReadProperty(ref reader, options, PropProcessingTimeMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimestampString.TryReadProperty(ref reader, options, PropTimestampString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.BucketSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyScore = propAnomalyScore.Value, + BucketInfluencers = propBucketInfluencers.Value, + BucketSpan = propBucketSpan.Value, + EventCount = propEventCount.Value, + InitialAnomalyScore = propInitialAnomalyScore.Value, + IsInterim = propIsInterim.Value, + JobId = propJobId.Value, + ProcessingTimeMs = propProcessingTimeMs.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value, + TimestampString = propTimestampString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.BucketSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyScore, value.AnomalyScore, null, null); + writer.WriteProperty(options, PropBucketInfluencers, value.BucketInfluencers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker))); + writer.WriteProperty(options, PropEventCount, value.EventCount, null, null); + writer.WriteProperty(options, PropInitialAnomalyScore, value.InitialAnomalyScore, null, null); + writer.WriteProperty(options, PropIsInterim, value.IsInterim, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropProcessingTimeMs, value.ProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimestampString, value.TimestampString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.BucketSummaryConverter))] public sealed partial class BucketSummary { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BucketSummary(double anomalyScore, System.Collections.Generic.IReadOnlyCollection bucketInfluencers, System.TimeSpan bucketSpan, long eventCount, double initialAnomalyScore, bool isInterim, string jobId, System.TimeSpan processingTimeMs, string resultType, System.DateTimeOffset timestamp) + { + AnomalyScore = anomalyScore; + BucketInfluencers = bucketInfluencers; + BucketSpan = bucketSpan; + EventCount = eventCount; + InitialAnomalyScore = initialAnomalyScore; + IsInterim = isInterim; + JobId = jobId; + ProcessingTimeMs = processingTimeMs; + ResultType = resultType; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public BucketSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BucketSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BucketSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum anomaly score, between 0-100, for any of the bucket influencers. This is an overall, rate-limited @@ -36,26 +193,38 @@ public sealed partial class BucketSummary /// new data is analyzed. /// /// - [JsonInclude, JsonPropertyName("anomaly_score")] - public double AnomalyScore { get; init; } - [JsonInclude, JsonPropertyName("bucket_influencers")] - public IReadOnlyCollection BucketInfluencers { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double AnomalyScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BucketInfluencers { get; set; } /// /// /// The length of the bucket in seconds. This value matches the bucket span that is specified in the job. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public long BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan BucketSpan { get; set; } /// /// /// The number of input data records processed in this bucket. /// /// - [JsonInclude, JsonPropertyName("event_count")] - public long EventCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long EventCount { get; set; } /// /// @@ -63,40 +232,55 @@ public sealed partial class BucketSummary /// time the bucket was processed. /// /// - [JsonInclude, JsonPropertyName("initial_anomaly_score")] - public double InitialAnomalyScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double InitialAnomalyScore { get; set; } /// /// /// If true, this is an interim result. In other words, the results are calculated based on partial input data. /// /// - [JsonInclude, JsonPropertyName("is_interim")] - public bool IsInterim { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsInterim { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// The amount of time, in milliseconds, that it took to analyze the bucket contents and calculate results. /// /// - [JsonInclude, JsonPropertyName("processing_time_ms")] - public long ProcessingTimeMs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ProcessingTimeMs { get; set; } /// /// /// Internal. This value is always set to bucket. /// /// - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// @@ -104,8 +288,11 @@ public sealed partial class BucketSummary /// timestamp of the bucket are included in the results for the bucket. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } /// /// @@ -113,6 +300,5 @@ public sealed partial class BucketSummary /// timestamp of the bucket are included in the results for the bucket. /// /// - [JsonInclude, JsonPropertyName("timestamp_string")] - public DateTimeOffset? TimestampString { get; init; } + public System.DateTimeOffset? TimestampString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Calendar.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Calendar.g.cs index 1b8cb82b44e..6f859fb20e5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Calendar.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Calendar.g.cs @@ -17,39 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class CalendarConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendarId = System.Text.Json.JsonEncodedText.Encode("calendar_id"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobIds = System.Text.Json.JsonEncodedText.Encode("job_ids"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Calendar Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarId = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propJobIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarId.TryReadProperty(ref reader, options, PropCalendarId, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobIds.TryReadProperty(ref reader, options, PropJobIds, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Calendar(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarId = propCalendarId.Value, + Description = propDescription.Value, + JobIds = propJobIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Calendar value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarId, value.CalendarId, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobIds, value.JobIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CalendarConverter))] public sealed partial class Calendar { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Calendar(string calendarId, System.Collections.Generic.IReadOnlyCollection jobIds) + { + CalendarId = calendarId; + JobIds = jobIds; + } +#if NET7_0_OR_GREATER + public Calendar() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Calendar() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Calendar(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that uniquely identifies a calendar. /// /// - [JsonInclude, JsonPropertyName("calendar_id")] - public string CalendarId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string CalendarId { get; set; } /// /// /// A description of the calendar. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// An array of anomaly detection job identifiers. /// /// - [JsonInclude, JsonPropertyName("job_ids")] - public IReadOnlyCollection JobIds { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection JobIds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CalendarEvent.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CalendarEvent.g.cs index a0e178429e7..63058c73929 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CalendarEvent.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CalendarEvent.g.cs @@ -17,24 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class CalendarEventConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendarId = System.Text.Json.JsonEncodedText.Encode("calendar_id"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEndTime = System.Text.Json.JsonEncodedText.Encode("end_time"); + private static readonly System.Text.Json.JsonEncodedText PropEventId = System.Text.Json.JsonEncodedText.Encode("event_id"); + private static readonly System.Text.Json.JsonEncodedText PropForceTimeShift = System.Text.Json.JsonEncodedText.Encode("force_time_shift"); + private static readonly System.Text.Json.JsonEncodedText PropSkipModelUpdate = System.Text.Json.JsonEncodedText.Encode("skip_model_update"); + private static readonly System.Text.Json.JsonEncodedText PropSkipResult = System.Text.Json.JsonEncodedText.Encode("skip_result"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarId = default; + LocalJsonValue propDescription = default; + LocalJsonValue propEndTime = default; + LocalJsonValue propEventId = default; + LocalJsonValue propForceTimeShift = default; + LocalJsonValue propSkipModelUpdate = default; + LocalJsonValue propSkipResult = default; + LocalJsonValue propStartTime = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarId.TryReadProperty(ref reader, options, PropCalendarId, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEndTime.TryReadProperty(ref reader, options, PropEndTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propEventId.TryReadProperty(ref reader, options, PropEventId, null)) + { + continue; + } + + if (propForceTimeShift.TryReadProperty(ref reader, options, PropForceTimeShift, null)) + { + continue; + } + + if (propSkipModelUpdate.TryReadProperty(ref reader, options, PropSkipModelUpdate, null)) + { + continue; + } + + if (propSkipResult.TryReadProperty(ref reader, options, PropSkipResult, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarId = propCalendarId.Value, + Description = propDescription.Value, + EndTime = propEndTime.Value, + EventId = propEventId.Value, + ForceTimeShift = propForceTimeShift.Value, + SkipModelUpdate = propSkipModelUpdate.Value, + SkipResult = propSkipResult.Value, + StartTime = propStartTime.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarId, value.CalendarId, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEndTime, value.EndTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropEventId, value.EventId, null, null); + writer.WriteProperty(options, PropForceTimeShift, value.ForceTimeShift, null, null); + writer.WriteProperty(options, PropSkipModelUpdate, value.SkipModelUpdate, null, null); + writer.WriteProperty(options, PropSkipResult, value.SkipResult, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventConverter))] public sealed partial class CalendarEvent { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CalendarEvent(string description, System.DateTimeOffset endTime, System.DateTimeOffset startTime) + { + Description = description; + EndTime = endTime; + StartTime = startTime; + } +#if NET7_0_OR_GREATER + public CalendarEvent() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CalendarEvent() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CalendarEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A string that uniquely identifies a calendar. /// /// - [JsonInclude, JsonPropertyName("calendar_id")] public Elastic.Clients.Elasticsearch.Id? CalendarId { get; set; } /// @@ -42,51 +164,85 @@ public sealed partial class CalendarEvent /// A description of the scheduled event. /// /// - [JsonInclude, JsonPropertyName("description")] - public string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } /// /// /// The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format. /// /// - [JsonInclude, JsonPropertyName("end_time")] - public DateTimeOffset EndTime { get; set; } - [JsonInclude, JsonPropertyName("event_id")] + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset EndTime { get; set; } public Elastic.Clients.Elasticsearch.Id? EventId { get; set; } + /// + /// + /// Shift time by this many seconds. For example adjust time for daylight savings changes + /// + /// + public int? ForceTimeShift { get; set; } + + /// + /// + /// When true the model will not be updated for this calendar period. + /// + /// + public bool? SkipModelUpdate { get; set; } + + /// + /// + /// When true the model will not create results for this calendar period. + /// + /// + public bool? SkipResult { get; set; } + /// /// /// The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format. /// /// - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTime { get; set; } } -public sealed partial class CalendarEventDescriptor : SerializableDescriptor +public readonly partial struct CalendarEventDescriptor { - internal CalendarEventDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent Instance { get; init; } - public CalendarEventDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CalendarEventDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? CalendarIdValue { get; set; } - private string DescriptionValue { get; set; } - private DateTimeOffset EndTimeValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? EventIdValue { get; set; } - private DateTimeOffset StartTimeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CalendarEventDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent instance) => new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent(Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor descriptor) => descriptor.Instance; /// /// /// A string that uniquely identifies a calendar. /// /// - public CalendarEventDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id? calendarId) + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id? value) { - CalendarIdValue = calendarId; - return Self; + Instance.CalendarId = value; + return this; } /// @@ -94,10 +250,10 @@ public CalendarEventDescriptor CalendarId(Elastic.Clients.Elasticsearch.Id? cale /// A description of the scheduled event. /// /// - public CalendarEventDescriptor Description(string description) + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor Description(string value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -105,50 +261,67 @@ public CalendarEventDescriptor Description(string description) /// The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format. /// /// - public CalendarEventDescriptor EndTime(DateTimeOffset endTime) + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor EndTime(System.DateTimeOffset value) { - EndTimeValue = endTime; - return Self; + Instance.EndTime = value; + return this; } - public CalendarEventDescriptor EventId(Elastic.Clients.Elasticsearch.Id? eventId) + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor EventId(Elastic.Clients.Elasticsearch.Id? value) { - EventIdValue = eventId; - return Self; + Instance.EventId = value; + return this; } /// /// - /// The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format. + /// Shift time by this many seconds. For example adjust time for daylight savings changes /// /// - public CalendarEventDescriptor StartTime(DateTimeOffset startTime) + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor ForceTimeShift(int? value) { - StartTimeValue = startTime; - return Self; + Instance.ForceTimeShift = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// When true the model will not be updated for this calendar period. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor SkipModelUpdate(bool? value = true) { - writer.WriteStartObject(); - if (CalendarIdValue is not null) - { - writer.WritePropertyName("calendar_id"); - JsonSerializer.Serialize(writer, CalendarIdValue, options); - } + Instance.SkipModelUpdate = value; + return this; + } - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - writer.WritePropertyName("end_time"); - JsonSerializer.Serialize(writer, EndTimeValue, options); - if (EventIdValue is not null) - { - writer.WritePropertyName("event_id"); - JsonSerializer.Serialize(writer, EventIdValue, options); - } + /// + /// + /// When true the model will not create results for this calendar period. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor SkipResult(bool? value = true) + { + Instance.SkipResult = value; + return this; + } - writer.WritePropertyName("start_time"); - JsonSerializer.Serialize(writer, StartTimeValue, options); - writer.WriteEndObject(); + /// + /// + /// The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor StartTime(System.DateTimeOffset value) + { + Instance.StartTime = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEventDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.CalendarEvent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzer.g.cs index 24508aef8fe..946e25d90c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzer.g.cs @@ -17,26 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -public sealed partial class CategorizationAnalyzer : Union +internal sealed partial class CategorizationAnalyzerConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerConverter))] +public sealed partial class CategorizationAnalyzer : Elastic.Clients.Elasticsearch.Union +{ + public CategorizationAnalyzer(string value) : base(value) + { + } + + public CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(string value) => new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(value); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition value) => new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(value); +} + +public readonly partial struct CategorizationAnalyzerFactory { - public CategorizationAnalyzer(string Name) : base(Name) + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Name(string value) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(value); + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Definition(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition value) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(value); + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Definition() + { + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Definition(System.Action? action) { + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor.Build(action)); } - public CategorizationAnalyzer(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition Definition) : base(Definition) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzer Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzerDefinition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzerDefinition.g.cs index ee670a7e365..a61a1e55c54 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzerDefinition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/CategorizationAnalyzerDefinition.g.cs @@ -17,64 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class CategorizationAnalyzerDefinitionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharFilter = System.Text.Json.JsonEncodedText.Encode("char_filter"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropTokenizer = System.Text.Json.JsonEncodedText.Encode("tokenizer"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCharFilter = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propTokenizer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharFilter.TryReadProperty(ref reader, options, PropCharFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTokenizer.TryReadProperty(ref reader, options, PropTokenizer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharFilter = propCharFilter.Value, + Filter = propFilter.Value, + Tokenizer = propTokenizer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharFilter, value.CharFilter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTokenizer, value.Tokenizer, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionConverter))] public sealed partial class CategorizationAnalyzerDefinition { +#if NET7_0_OR_GREATER + public CategorizationAnalyzerDefinition() + { + } +#endif +#if !NET7_0_OR_GREATER + public CategorizationAnalyzerDefinition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// One or more character filters. In addition to the built-in character filters, other plugins can provide more character filters. If this property is not specified, no character filters are applied prior to categorization. If you are customizing some other aspect of the analyzer and you need to achieve the equivalent of categorization_filters (which are not permitted when some other aspect of the analyzer is customized), add them here as pattern replace character filters. /// /// - [JsonInclude, JsonPropertyName("char_filter")] - public ICollection? CharFilter { get; set; } + public System.Collections.Generic.ICollection? CharFilter { get; set; } /// /// /// One or more token filters. In addition to the built-in token filters, other plugins can provide more token filters. If this property is not specified, no token filters are applied prior to categorization. /// /// - [JsonInclude, JsonPropertyName("filter")] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// The name or definition of the tokenizer to use after character filters are applied. This property is compulsory if categorization_analyzer is specified as an object. Machine learning provides a tokenizer called ml_standard that tokenizes in a way that has been determined to produce good categorization results on a variety of log file formats for logs in English. If you want to use that tokenizer but change the character or token filters, specify "tokenizer": "ml_standard" in your categorization_analyzer. Additionally, the ml_classic tokenizer is available, which tokenizes in the same way as the non-customizable tokenizer in old versions of the product (before 6.2). ml_classic was the default categorization tokenizer in versions 6.2 to 7.13, so if you need categorization identical to the default for jobs created in these versions, specify "tokenizer": "ml_classic" in your categorization_analyzer. /// /// - [JsonInclude, JsonPropertyName("tokenizer")] public Elastic.Clients.Elasticsearch.Analysis.ITokenizer? Tokenizer { get; set; } } -public sealed partial class CategorizationAnalyzerDefinitionDescriptor : SerializableDescriptor +public readonly partial struct CategorizationAnalyzerDefinitionDescriptor { - internal CategorizationAnalyzerDefinitionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition Instance { get; init; } - public CategorizationAnalyzerDefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizationAnalyzerDefinitionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition instance) { + Instance = instance; } - private ICollection? CharFilterValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.ITokenizer? TokenizerValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CategorizationAnalyzerDefinitionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition instance) => new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// One or more character filters. In addition to the built-in character filters, other plugins can provide more character filters. If this property is not specified, no character filters are applied prior to categorization. If you are customizing some other aspect of the analyzer and you need to achieve the equivalent of categorization_filters (which are not permitted when some other aspect of the analyzer is customized), add them here as pattern replace character filters. /// /// - public CategorizationAnalyzerDefinitionDescriptor CharFilter(ICollection? charFilter) + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor CharFilter(System.Collections.Generic.ICollection? value) { - CharFilterValue = charFilter; - return Self; + Instance.CharFilter = value; + return this; + } + + /// + /// + /// One or more character filters. In addition to the built-in character filters, other plugins can provide more character filters. If this property is not specified, no character filters are applied prior to categorization. If you are customizing some other aspect of the analyzer and you need to achieve the equivalent of categorization_filters (which are not permitted when some other aspect of the analyzer is customized), add them here as pattern replace character filters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor CharFilter(params Elastic.Clients.Elasticsearch.Analysis.ICharFilter[] values) + { + Instance.CharFilter = [.. values]; + return this; + } + + /// + /// + /// One or more character filters. In addition to the built-in character filters, other plugins can provide more character filters. If this property is not specified, no character filters are applied prior to categorization. If you are customizing some other aspect of the analyzer and you need to achieve the equivalent of categorization_filters (which are not permitted when some other aspect of the analyzer is customized), add them here as pattern replace character filters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor CharFilter(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Analysis.CharFilterFactory.Build(action)); + } + + Instance.CharFilter = items; + return this; } /// @@ -82,44 +184,72 @@ public CategorizationAnalyzerDefinitionDescriptor CharFilter(ICollection /// - public CategorizationAnalyzerDefinitionDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } /// /// - /// The name or definition of the tokenizer to use after character filters are applied. This property is compulsory if categorization_analyzer is specified as an object. Machine learning provides a tokenizer called ml_standard that tokenizes in a way that has been determined to produce good categorization results on a variety of log file formats for logs in English. If you want to use that tokenizer but change the character or token filters, specify "tokenizer": "ml_standard" in your categorization_analyzer. Additionally, the ml_classic tokenizer is available, which tokenizes in the same way as the non-customizable tokenizer in old versions of the product (before 6.2). ml_classic was the default categorization tokenizer in versions 6.2 to 7.13, so if you need categorization identical to the default for jobs created in these versions, specify "tokenizer": "ml_classic" in your categorization_analyzer. + /// One or more token filters. In addition to the built-in token filters, other plugins can provide more token filters. If this property is not specified, no token filters are applied prior to categorization. /// /// - public CategorizationAnalyzerDefinitionDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? tokenizer) + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor Filter(params Elastic.Clients.Elasticsearch.Analysis.ITokenFilter[] values) { - TokenizerValue = tokenizer; - return Self; + Instance.Filter = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// One or more token filters. In addition to the built-in token filters, other plugins can provide more token filters. If this property is not specified, no token filters are applied prior to categorization. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor Filter(params System.Func[] actions) { - writer.WriteStartObject(); - if (CharFilterValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("char_filter"); - JsonSerializer.Serialize(writer, CharFilterValue, options); + items.Add(Elastic.Clients.Elasticsearch.Analysis.TokenFilterFactory.Build(action)); } - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + Instance.Filter = items; + return this; + } - if (TokenizerValue is not null) + /// + /// + /// The name or definition of the tokenizer to use after character filters are applied. This property is compulsory if categorization_analyzer is specified as an object. Machine learning provides a tokenizer called ml_standard that tokenizes in a way that has been determined to produce good categorization results on a variety of log file formats for logs in English. If you want to use that tokenizer but change the character or token filters, specify "tokenizer": "ml_standard" in your categorization_analyzer. Additionally, the ml_classic tokenizer is available, which tokenizes in the same way as the non-customizable tokenizer in old versions of the product (before 6.2). ml_classic was the default categorization tokenizer in versions 6.2 to 7.13, so if you need categorization identical to the default for jobs created in these versions, specify "tokenizer": "ml_classic" in your categorization_analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor Tokenizer(Elastic.Clients.Elasticsearch.Analysis.ITokenizer? value) + { + Instance.Tokenizer = value; + return this; + } + + /// + /// + /// The name or definition of the tokenizer to use after character filters are applied. This property is compulsory if categorization_analyzer is specified as an object. Machine learning provides a tokenizer called ml_standard that tokenizes in a way that has been determined to produce good categorization results on a variety of log file formats for logs in English. If you want to use that tokenizer but change the character or token filters, specify "tokenizer": "ml_standard" in your categorization_analyzer. Additionally, the ml_classic tokenizer is available, which tokenizes in the same way as the non-customizable tokenizer in old versions of the product (before 6.2). ml_classic was the default categorization tokenizer in versions 6.2 to 7.13, so if you need categorization identical to the default for jobs created in these versions, specify "tokenizer": "ml_classic" in your categorization_analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor Tokenizer(System.Func action) + { + Instance.Tokenizer = Elastic.Clients.Elasticsearch.Analysis.TokenizerFactory.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tokenizer"); - JsonSerializer.Serialize(writer, TokenizerValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinitionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.CategorizationAnalyzerDefinition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Category.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Category.g.cs index 7068e74f17d..9f7fcf40f9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Category.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Category.g.cs @@ -17,109 +17,309 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class CategoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCategoryId = System.Text.Json.JsonEncodedText.Encode("category_id"); + private static readonly System.Text.Json.JsonEncodedText PropExamples = System.Text.Json.JsonEncodedText.Encode("examples"); + private static readonly System.Text.Json.JsonEncodedText PropGrokPattern = System.Text.Json.JsonEncodedText.Encode("grok_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxMatchingLength = System.Text.Json.JsonEncodedText.Encode("max_matching_length"); + private static readonly System.Text.Json.JsonEncodedText PropMlcategory = System.Text.Json.JsonEncodedText.Encode("mlcategory"); + private static readonly System.Text.Json.JsonEncodedText PropNumMatches = System.Text.Json.JsonEncodedText.Encode("num_matches"); + private static readonly System.Text.Json.JsonEncodedText PropP = System.Text.Json.JsonEncodedText.Encode("p"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldName = System.Text.Json.JsonEncodedText.Encode("partition_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldValue = System.Text.Json.JsonEncodedText.Encode("partition_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropPreferredToCategories = System.Text.Json.JsonEncodedText.Encode("preferred_to_categories"); + private static readonly System.Text.Json.JsonEncodedText PropRegex = System.Text.Json.JsonEncodedText.Encode("regex"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Category Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCategoryId = default; + LocalJsonValue> propExamples = default; + LocalJsonValue propGrokPattern = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxMatchingLength = default; + LocalJsonValue propMlcategory = default; + LocalJsonValue propNumMatches = default; + LocalJsonValue propP = default; + LocalJsonValue propPartitionFieldName = default; + LocalJsonValue propPartitionFieldValue = default; + LocalJsonValue?> propPreferredToCategories = default; + LocalJsonValue propRegex = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCategoryId.TryReadProperty(ref reader, options, PropCategoryId, null)) + { + continue; + } + + if (propExamples.TryReadProperty(ref reader, options, PropExamples, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propGrokPattern.TryReadProperty(ref reader, options, PropGrokPattern, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaxMatchingLength.TryReadProperty(ref reader, options, PropMaxMatchingLength, null)) + { + continue; + } + + if (propMlcategory.TryReadProperty(ref reader, options, PropMlcategory, null)) + { + continue; + } + + if (propNumMatches.TryReadProperty(ref reader, options, PropNumMatches, null)) + { + continue; + } + + if (propP.TryReadProperty(ref reader, options, PropP, null)) + { + continue; + } + + if (propPartitionFieldName.TryReadProperty(ref reader, options, PropPartitionFieldName, null)) + { + continue; + } + + if (propPartitionFieldValue.TryReadProperty(ref reader, options, PropPartitionFieldValue, null)) + { + continue; + } + + if (propPreferredToCategories.TryReadProperty(ref reader, options, PropPreferredToCategories, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRegex.TryReadProperty(ref reader, options, PropRegex, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Category(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CategoryId = propCategoryId.Value, + Examples = propExamples.Value, + GrokPattern = propGrokPattern.Value, + JobId = propJobId.Value, + MaxMatchingLength = propMaxMatchingLength.Value, + Mlcategory = propMlcategory.Value, + NumMatches = propNumMatches.Value, + P = propP.Value, + PartitionFieldName = propPartitionFieldName.Value, + PartitionFieldValue = propPartitionFieldValue.Value, + PreferredToCategories = propPreferredToCategories.Value, + Regex = propRegex.Value, + ResultType = propResultType.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Category value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCategoryId, value.CategoryId, null, null); + writer.WriteProperty(options, PropExamples, value.Examples, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropGrokPattern, value.GrokPattern, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxMatchingLength, value.MaxMatchingLength, null, null); + writer.WriteProperty(options, PropMlcategory, value.Mlcategory, null, null); + writer.WriteProperty(options, PropNumMatches, value.NumMatches, null, null); + writer.WriteProperty(options, PropP, value.P, null, null); + writer.WriteProperty(options, PropPartitionFieldName, value.PartitionFieldName, null, null); + writer.WriteProperty(options, PropPartitionFieldValue, value.PartitionFieldValue, null, null); + writer.WriteProperty(options, PropPreferredToCategories, value.PreferredToCategories, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRegex, value.Regex, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.CategoryConverter))] public sealed partial class Category { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Category(long categoryId, System.Collections.Generic.IReadOnlyCollection examples, string jobId, long maxMatchingLength, string mlcategory, string regex, string resultType, string terms) + { + CategoryId = categoryId; + Examples = examples; + JobId = jobId; + MaxMatchingLength = maxMatchingLength; + Mlcategory = mlcategory; + Regex = regex; + ResultType = resultType; + Terms = terms; + } +#if NET7_0_OR_GREATER + public Category() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Category() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Category(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A unique identifier for the category. category_id is unique at the job level, even when per-partition categorization is enabled. /// /// - [JsonInclude, JsonPropertyName("category_id")] - public long CategoryId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long CategoryId { get; set; } /// /// /// A list of examples of actual values that matched the category. /// /// - [JsonInclude, JsonPropertyName("examples")] - public IReadOnlyCollection Examples { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Examples { get; set; } /// /// /// [experimental] A Grok pattern that could be used in Logstash or an ingest pipeline to extract fields from messages that match the category. This field is experimental and may be changed or removed in a future release. The Grok patterns that are found are not optimal, but are often a good starting point for manual tweaking. /// /// - [JsonInclude, JsonPropertyName("grok_pattern")] - public string? GrokPattern { get; init; } + public string? GrokPattern { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// The maximum length of the fields that matched the category. The value is increased by 10% to enable matching for similar fields that have not been analyzed. /// /// - [JsonInclude, JsonPropertyName("max_matching_length")] - public long MaxMatchingLength { get; init; } - [JsonInclude, JsonPropertyName("mlcategory")] - public string Mlcategory { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxMatchingLength { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Mlcategory { get; set; } /// /// /// The number of messages that have been matched by this category. This is only guaranteed to have the latest accurate count after a job _flush or _close /// /// - [JsonInclude, JsonPropertyName("num_matches")] - public long? NumMatches { get; init; } - [JsonInclude, JsonPropertyName("p")] - public string? p { get; init; } + public long? NumMatches { get; set; } + public string? P { get; set; } /// /// /// If per-partition categorization is enabled, this property identifies the field used to segment the categorization. It is not present when per-partition categorization is disabled. /// /// - [JsonInclude, JsonPropertyName("partition_field_name")] - public string? PartitionFieldName { get; init; } + public string? PartitionFieldName { get; set; } /// /// /// If per-partition categorization is enabled, this property identifies the value of the partition_field_name for the category. It is not present when per-partition categorization is disabled. /// /// - [JsonInclude, JsonPropertyName("partition_field_value")] - public string? PartitionFieldValue { get; init; } + public string? PartitionFieldValue { get; set; } /// /// /// A list of category_id entries that this current category encompasses. Any new message that is processed by the categorizer will match against this category and not any of the categories in this list. This is only guaranteed to have the latest accurate list of categories after a job _flush or _close /// /// - [JsonInclude, JsonPropertyName("preferred_to_categories")] - public IReadOnlyCollection? PreferredToCategories { get; init; } + public System.Collections.Generic.IReadOnlyCollection? PreferredToCategories { get; set; } /// /// /// A regular expression that is used to search for values that match the category. /// /// - [JsonInclude, JsonPropertyName("regex")] - public string Regex { get; init; } - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Regex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// /// A space separated list of the common tokens that are matched in values of the category. /// /// - [JsonInclude, JsonPropertyName("terms")] - public string Terms { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Terms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ChunkingConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ChunkingConfig.g.cs index be00153c687..17af0ae7f3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ChunkingConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ChunkingConfig.g.cs @@ -17,18 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ChunkingConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSpan = System.Text.Json.JsonEncodedText.Encode("time_span"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue propTimeSpan = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propTimeSpan.TryReadProperty(ref reader, options, PropTimeSpan, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + TimeSpan = propTimeSpan.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropTimeSpan, value.TimeSpan, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigConverter))] public sealed partial class ChunkingConfig { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode mode) + { + Mode = mode; + } +#if NET7_0_OR_GREATER + public ChunkingConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ChunkingConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ChunkingConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the mode is auto, the chunk size is dynamically calculated; @@ -37,28 +104,38 @@ public sealed partial class ChunkingConfig /// use this mode when the datafeed uses aggregations. If the mode is off, no chunking is applied. /// /// - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode Mode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode Mode { get; set; } /// /// /// The time span that each search will be querying. This setting is applicable only when the mode is set to manual. /// /// - [JsonInclude, JsonPropertyName("time_span")] public Elastic.Clients.Elasticsearch.Duration? TimeSpan { get; set; } } -public sealed partial class ChunkingConfigDescriptor : SerializableDescriptor +public readonly partial struct ChunkingConfigDescriptor { - internal ChunkingConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig Instance { get; init; } - public ChunkingConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChunkingConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? TimeSpanValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ChunkingConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) => descriptor.Instance; /// /// @@ -68,10 +145,10 @@ public ChunkingConfigDescriptor() : base() /// use this mode when the datafeed uses aggregations. If the mode is off, no chunking is applied. /// /// - public ChunkingConfigDescriptor Mode(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode mode) + public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor Mode(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingMode value) { - ModeValue = mode; - return Self; + Instance.Mode = value; + return this; } /// @@ -79,23 +156,17 @@ public ChunkingConfigDescriptor Mode(Elastic.Clients.Elasticsearch.MachineLearni /// The time span that each search will be querying. This setting is applicable only when the mode is set to manual. /// /// - public ChunkingConfigDescriptor TimeSpan(Elastic.Clients.Elasticsearch.Duration? timeSpan) + public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor TimeSpan(Elastic.Clients.Elasticsearch.Duration? value) { - TimeSpanValue = timeSpan; - return Self; + Instance.TimeSpan = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - if (TimeSpanValue is not null) - { - writer.WritePropertyName("time_span"); - JsonSerializer.Serialize(writer, TimeSpanValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ClassificationInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ClassificationInferenceOptions.g.cs index 459ed12623c..08852730365 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ClassificationInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ClassificationInferenceOptions.g.cs @@ -17,24 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ClassificationInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionFieldType = System.Text.Json.JsonEncodedText.Encode("prediction_field_type"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTopClassesResultsField = System.Text.Json.JsonEncodedText.Encode("top_classes_results_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propPredictionFieldType = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTopClassesResultsField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } + + if (propPredictionFieldType.TryReadProperty(ref reader, options, PropPredictionFieldType, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTopClassesResultsField.TryReadProperty(ref reader, options, PropTopClassesResultsField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumTopClasses = propNumTopClasses.Value, + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + PredictionFieldType = propPredictionFieldType.Value, + ResultsField = propResultsField.Value, + TopClassesResultsField = propTopClassesResultsField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropPredictionFieldType, value.PredictionFieldType, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTopClassesResultsField, value.TopClassesResultsField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsConverter))] public sealed partial class ClassificationInferenceOptions { +#if NET7_0_OR_GREATER + public ClassificationInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClassificationInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -42,7 +129,6 @@ public sealed partial class ClassificationInferenceOptions /// Specifies the maximum number of feature importance values per document. /// /// - [JsonInclude, JsonPropertyName("num_top_feature_importance_values")] public int? NumTopFeatureImportanceValues { get; set; } /// @@ -50,7 +136,6 @@ public sealed partial class ClassificationInferenceOptions /// Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false. /// /// - [JsonInclude, JsonPropertyName("prediction_field_type")] public string? PredictionFieldType { get; set; } /// @@ -58,7 +143,6 @@ public sealed partial class ClassificationInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -66,37 +150,37 @@ public sealed partial class ClassificationInferenceOptions /// Specifies the field to which the top classes are written. Defaults to top_classes. /// /// - [JsonInclude, JsonPropertyName("top_classes_results_field")] public string? TopClassesResultsField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(ClassificationInferenceOptions classificationInferenceOptions) => Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig.Classification(classificationInferenceOptions); - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(ClassificationInferenceOptions classificationInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.Classification(classificationInferenceOptions); - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(ClassificationInferenceOptions classificationInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.Classification(classificationInferenceOptions); } -public sealed partial class ClassificationInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct ClassificationInferenceOptionsDescriptor { - internal ClassificationInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions Instance { get; init; } - public ClassificationInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions instance) { + Instance = instance; } - private int? NumTopClassesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private string? PredictionFieldTypeValue { get; set; } - private string? ResultsFieldValue { get; set; } - private string? TopClassesResultsFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClassificationInferenceOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public ClassificationInferenceOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -104,10 +188,10 @@ public ClassificationInferenceOptionsDescriptor NumTopClasses(int? numTopClasses /// Specifies the maximum number of feature importance values per document. /// /// - public ClassificationInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -115,10 +199,10 @@ public ClassificationInferenceOptionsDescriptor NumTopFeatureImportanceValues(in /// Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false. /// /// - public ClassificationInferenceOptionsDescriptor PredictionFieldType(string? predictionFieldType) + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor PredictionFieldType(string? value) { - PredictionFieldTypeValue = predictionFieldType; - return Self; + Instance.PredictionFieldType = value; + return this; } /// @@ -126,10 +210,10 @@ public ClassificationInferenceOptionsDescriptor PredictionFieldType(string? pred /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public ClassificationInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -137,45 +221,22 @@ public ClassificationInferenceOptionsDescriptor ResultsField(string? resultsFiel /// Specifies the field to which the top classes are written. Defaults to top_classes. /// /// - public ClassificationInferenceOptionsDescriptor TopClassesResultsField(string? topClassesResultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor TopClassesResultsField(string? value) { - TopClassesResultsFieldValue = topClassesResultsField; - return Self; + Instance.TopClassesResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) + if (action is null) { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(PredictionFieldTypeValue)) - { - writer.WritePropertyName("prediction_field_type"); - writer.WriteStringValue(PredictionFieldTypeValue); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (!string.IsNullOrEmpty(TopClassesResultsFieldValue)) - { - writer.WritePropertyName("top_classes_results_field"); - writer.WriteStringValue(TopClassesResultsFieldValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixItem.g.cs index 0431e3c30f0..4b5467c2c42 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixItem.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ConfusionMatrixItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActualClass = System.Text.Json.JsonEncodedText.Encode("actual_class"); + private static readonly System.Text.Json.JsonEncodedText PropActualClassDocCount = System.Text.Json.JsonEncodedText.Encode("actual_class_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropOtherPredictedClassDocCount = System.Text.Json.JsonEncodedText.Encode("other_predicted_class_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedClasses = System.Text.Json.JsonEncodedText.Encode("predicted_classes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActualClass = default; + LocalJsonValue propActualClassDocCount = default; + LocalJsonValue propOtherPredictedClassDocCount = default; + LocalJsonValue> propPredictedClasses = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActualClass.TryReadProperty(ref reader, options, PropActualClass, null)) + { + continue; + } + + if (propActualClassDocCount.TryReadProperty(ref reader, options, PropActualClassDocCount, null)) + { + continue; + } + + if (propOtherPredictedClassDocCount.TryReadProperty(ref reader, options, PropOtherPredictedClassDocCount, null)) + { + continue; + } + + if (propPredictedClasses.TryReadProperty(ref reader, options, PropPredictedClasses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActualClass = propActualClass.Value, + ActualClassDocCount = propActualClassDocCount.Value, + OtherPredictedClassDocCount = propOtherPredictedClassDocCount.Value, + PredictedClasses = propPredictedClasses.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActualClass, value.ActualClass, null, null); + writer.WriteProperty(options, PropActualClassDocCount, value.ActualClassDocCount, null, null); + writer.WriteProperty(options, PropOtherPredictedClassDocCount, value.OtherPredictedClassDocCount, null, null); + writer.WriteProperty(options, PropPredictedClasses, value.PredictedClasses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixItemConverter))] public sealed partial class ConfusionMatrixItem { - [JsonInclude, JsonPropertyName("actual_class")] - public string ActualClass { get; init; } - [JsonInclude, JsonPropertyName("actual_class_doc_count")] - public int ActualClassDocCount { get; init; } - [JsonInclude, JsonPropertyName("other_predicted_class_doc_count")] - public int OtherPredictedClassDocCount { get; init; } - [JsonInclude, JsonPropertyName("predicted_classes")] - public IReadOnlyCollection PredictedClasses { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConfusionMatrixItem(string actualClass, int actualClassDocCount, int otherPredictedClassDocCount, System.Collections.Generic.IReadOnlyCollection predictedClasses) + { + ActualClass = actualClass; + ActualClassDocCount = actualClassDocCount; + OtherPredictedClassDocCount = otherPredictedClassDocCount; + PredictedClasses = predictedClasses; + } +#if NET7_0_OR_GREATER + public ConfusionMatrixItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConfusionMatrixItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConfusionMatrixItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ActualClass { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ActualClassDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int OtherPredictedClassDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PredictedClasses { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixPrediction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixPrediction.g.cs index 4097b8e29b8..b61ffa602bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixPrediction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixPrediction.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ConfusionMatrixPredictionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedClass = System.Text.Json.JsonEncodedText.Encode("predicted_class"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixPrediction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propPredictedClass = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propPredictedClass.TryReadProperty(ref reader, options, PropPredictedClass, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixPrediction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + PredictedClass = propPredictedClass.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixPrediction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropPredictedClass, value.PredictedClass, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixPredictionConverter))] public sealed partial class ConfusionMatrixPrediction { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("predicted_class")] - public string PredictedClass { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConfusionMatrixPrediction(int count, string predictedClass) + { + Count = count; + PredictedClass = predictedClass; + } +#if NET7_0_OR_GREATER + public ConfusionMatrixPrediction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConfusionMatrixPrediction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConfusionMatrixPrediction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PredictedClass { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixThreshold.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixThreshold.g.cs index c4bd30a85f9..3074f63b49f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixThreshold.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ConfusionMatrixThreshold.g.cs @@ -17,47 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ConfusionMatrixThresholdConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFalseNegative = System.Text.Json.JsonEncodedText.Encode("fn"); + private static readonly System.Text.Json.JsonEncodedText PropFalsePositive = System.Text.Json.JsonEncodedText.Encode("fp"); + private static readonly System.Text.Json.JsonEncodedText PropTrueNegative = System.Text.Json.JsonEncodedText.Encode("tn"); + private static readonly System.Text.Json.JsonEncodedText PropTruePositive = System.Text.Json.JsonEncodedText.Encode("tp"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixThreshold Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFalseNegative = default; + LocalJsonValue propFalsePositive = default; + LocalJsonValue propTrueNegative = default; + LocalJsonValue propTruePositive = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFalseNegative.TryReadProperty(ref reader, options, PropFalseNegative, null)) + { + continue; + } + + if (propFalsePositive.TryReadProperty(ref reader, options, PropFalsePositive, null)) + { + continue; + } + + if (propTrueNegative.TryReadProperty(ref reader, options, PropTrueNegative, null)) + { + continue; + } + + if (propTruePositive.TryReadProperty(ref reader, options, PropTruePositive, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixThreshold(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FalseNegative = propFalseNegative.Value, + FalsePositive = propFalsePositive.Value, + TrueNegative = propTrueNegative.Value, + TruePositive = propTruePositive.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixThreshold value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFalseNegative, value.FalseNegative, null, null); + writer.WriteProperty(options, PropFalsePositive, value.FalsePositive, null, null); + writer.WriteProperty(options, PropTrueNegative, value.TrueNegative, null, null); + writer.WriteProperty(options, PropTruePositive, value.TruePositive, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ConfusionMatrixThresholdConverter))] public sealed partial class ConfusionMatrixThreshold { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConfusionMatrixThreshold(int falseNegative, int falsePositive, int trueNegative, int truePositive) + { + FalseNegative = falseNegative; + FalsePositive = falsePositive; + TrueNegative = trueNegative; + TruePositive = truePositive; + } +#if NET7_0_OR_GREATER + public ConfusionMatrixThreshold() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConfusionMatrixThreshold() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConfusionMatrixThreshold(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// False Negative /// /// - [JsonInclude, JsonPropertyName("fn")] - public int FalseNegative { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int FalseNegative { get; set; } /// /// /// False Positive /// /// - [JsonInclude, JsonPropertyName("fp")] - public int FalsePositive { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int FalsePositive { get; set; } /// /// /// True Negative /// /// - [JsonInclude, JsonPropertyName("tn")] - public int TrueNegative { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TrueNegative { get; set; } /// /// /// True Positive /// /// - [JsonInclude, JsonPropertyName("tp")] - public int TruePositive { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TruePositive { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataCounts.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataCounts.g.cs index 45d2043fb05..00be60ce302 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataCounts.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataCounts.g.cs @@ -17,54 +17,314 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataCountsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketCount = System.Text.Json.JsonEncodedText.Encode("bucket_count"); + private static readonly System.Text.Json.JsonEncodedText PropEarliestRecordTimestamp = System.Text.Json.JsonEncodedText.Encode("earliest_record_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropEmptyBucketCount = System.Text.Json.JsonEncodedText.Encode("empty_bucket_count"); + private static readonly System.Text.Json.JsonEncodedText PropInputBytes = System.Text.Json.JsonEncodedText.Encode("input_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropInputFieldCount = System.Text.Json.JsonEncodedText.Encode("input_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropInputRecordCount = System.Text.Json.JsonEncodedText.Encode("input_record_count"); + private static readonly System.Text.Json.JsonEncodedText PropInvalidDateCount = System.Text.Json.JsonEncodedText.Encode("invalid_date_count"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropLastDataTime = System.Text.Json.JsonEncodedText.Encode("last_data_time"); + private static readonly System.Text.Json.JsonEncodedText PropLatestBucketTimestamp = System.Text.Json.JsonEncodedText.Encode("latest_bucket_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropLatestEmptyBucketTimestamp = System.Text.Json.JsonEncodedText.Encode("latest_empty_bucket_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropLatestRecordTimestamp = System.Text.Json.JsonEncodedText.Encode("latest_record_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropLatestSparseBucketTimestamp = System.Text.Json.JsonEncodedText.Encode("latest_sparse_bucket_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropLogTime = System.Text.Json.JsonEncodedText.Encode("log_time"); + private static readonly System.Text.Json.JsonEncodedText PropMissingFieldCount = System.Text.Json.JsonEncodedText.Encode("missing_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropOutOfOrderTimestampCount = System.Text.Json.JsonEncodedText.Encode("out_of_order_timestamp_count"); + private static readonly System.Text.Json.JsonEncodedText PropProcessedFieldCount = System.Text.Json.JsonEncodedText.Encode("processed_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropProcessedRecordCount = System.Text.Json.JsonEncodedText.Encode("processed_record_count"); + private static readonly System.Text.Json.JsonEncodedText PropSparseBucketCount = System.Text.Json.JsonEncodedText.Encode("sparse_bucket_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataCounts Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketCount = default; + LocalJsonValue propEarliestRecordTimestamp = default; + LocalJsonValue propEmptyBucketCount = default; + LocalJsonValue propInputBytes = default; + LocalJsonValue propInputFieldCount = default; + LocalJsonValue propInputRecordCount = default; + LocalJsonValue propInvalidDateCount = default; + LocalJsonValue propJobId = default; + LocalJsonValue propLastDataTime = default; + LocalJsonValue propLatestBucketTimestamp = default; + LocalJsonValue propLatestEmptyBucketTimestamp = default; + LocalJsonValue propLatestRecordTimestamp = default; + LocalJsonValue propLatestSparseBucketTimestamp = default; + LocalJsonValue propLogTime = default; + LocalJsonValue propMissingFieldCount = default; + LocalJsonValue propOutOfOrderTimestampCount = default; + LocalJsonValue propProcessedFieldCount = default; + LocalJsonValue propProcessedRecordCount = default; + LocalJsonValue propSparseBucketCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketCount.TryReadProperty(ref reader, options, PropBucketCount, null)) + { + continue; + } + + if (propEarliestRecordTimestamp.TryReadProperty(ref reader, options, PropEarliestRecordTimestamp, null)) + { + continue; + } + + if (propEmptyBucketCount.TryReadProperty(ref reader, options, PropEmptyBucketCount, null)) + { + continue; + } + + if (propInputBytes.TryReadProperty(ref reader, options, PropInputBytes, null)) + { + continue; + } + + if (propInputFieldCount.TryReadProperty(ref reader, options, PropInputFieldCount, null)) + { + continue; + } + + if (propInputRecordCount.TryReadProperty(ref reader, options, PropInputRecordCount, null)) + { + continue; + } + + if (propInvalidDateCount.TryReadProperty(ref reader, options, PropInvalidDateCount, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propLastDataTime.TryReadProperty(ref reader, options, PropLastDataTime, null)) + { + continue; + } + + if (propLatestBucketTimestamp.TryReadProperty(ref reader, options, PropLatestBucketTimestamp, null)) + { + continue; + } + + if (propLatestEmptyBucketTimestamp.TryReadProperty(ref reader, options, PropLatestEmptyBucketTimestamp, null)) + { + continue; + } + + if (propLatestRecordTimestamp.TryReadProperty(ref reader, options, PropLatestRecordTimestamp, null)) + { + continue; + } + + if (propLatestSparseBucketTimestamp.TryReadProperty(ref reader, options, PropLatestSparseBucketTimestamp, null)) + { + continue; + } + + if (propLogTime.TryReadProperty(ref reader, options, PropLogTime, null)) + { + continue; + } + + if (propMissingFieldCount.TryReadProperty(ref reader, options, PropMissingFieldCount, null)) + { + continue; + } + + if (propOutOfOrderTimestampCount.TryReadProperty(ref reader, options, PropOutOfOrderTimestampCount, null)) + { + continue; + } + + if (propProcessedFieldCount.TryReadProperty(ref reader, options, PropProcessedFieldCount, null)) + { + continue; + } + + if (propProcessedRecordCount.TryReadProperty(ref reader, options, PropProcessedRecordCount, null)) + { + continue; + } + + if (propSparseBucketCount.TryReadProperty(ref reader, options, PropSparseBucketCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketCount = propBucketCount.Value, + EarliestRecordTimestamp = propEarliestRecordTimestamp.Value, + EmptyBucketCount = propEmptyBucketCount.Value, + InputBytes = propInputBytes.Value, + InputFieldCount = propInputFieldCount.Value, + InputRecordCount = propInputRecordCount.Value, + InvalidDateCount = propInvalidDateCount.Value, + JobId = propJobId.Value, + LastDataTime = propLastDataTime.Value, + LatestBucketTimestamp = propLatestBucketTimestamp.Value, + LatestEmptyBucketTimestamp = propLatestEmptyBucketTimestamp.Value, + LatestRecordTimestamp = propLatestRecordTimestamp.Value, + LatestSparseBucketTimestamp = propLatestSparseBucketTimestamp.Value, + LogTime = propLogTime.Value, + MissingFieldCount = propMissingFieldCount.Value, + OutOfOrderTimestampCount = propOutOfOrderTimestampCount.Value, + ProcessedFieldCount = propProcessedFieldCount.Value, + ProcessedRecordCount = propProcessedRecordCount.Value, + SparseBucketCount = propSparseBucketCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataCounts value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketCount, value.BucketCount, null, null); + writer.WriteProperty(options, PropEarliestRecordTimestamp, value.EarliestRecordTimestamp, null, null); + writer.WriteProperty(options, PropEmptyBucketCount, value.EmptyBucketCount, null, null); + writer.WriteProperty(options, PropInputBytes, value.InputBytes, null, null); + writer.WriteProperty(options, PropInputFieldCount, value.InputFieldCount, null, null); + writer.WriteProperty(options, PropInputRecordCount, value.InputRecordCount, null, null); + writer.WriteProperty(options, PropInvalidDateCount, value.InvalidDateCount, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropLastDataTime, value.LastDataTime, null, null); + writer.WriteProperty(options, PropLatestBucketTimestamp, value.LatestBucketTimestamp, null, null); + writer.WriteProperty(options, PropLatestEmptyBucketTimestamp, value.LatestEmptyBucketTimestamp, null, null); + writer.WriteProperty(options, PropLatestRecordTimestamp, value.LatestRecordTimestamp, null, null); + writer.WriteProperty(options, PropLatestSparseBucketTimestamp, value.LatestSparseBucketTimestamp, null, null); + writer.WriteProperty(options, PropLogTime, value.LogTime, null, null); + writer.WriteProperty(options, PropMissingFieldCount, value.MissingFieldCount, null, null); + writer.WriteProperty(options, PropOutOfOrderTimestampCount, value.OutOfOrderTimestampCount, null, null); + writer.WriteProperty(options, PropProcessedFieldCount, value.ProcessedFieldCount, null, null); + writer.WriteProperty(options, PropProcessedRecordCount, value.ProcessedRecordCount, null, null); + writer.WriteProperty(options, PropSparseBucketCount, value.SparseBucketCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataCountsConverter))] public sealed partial class DataCounts { - [JsonInclude, JsonPropertyName("bucket_count")] - public long BucketCount { get; init; } - [JsonInclude, JsonPropertyName("earliest_record_timestamp")] - public long? EarliestRecordTimestamp { get; init; } - [JsonInclude, JsonPropertyName("empty_bucket_count")] - public long EmptyBucketCount { get; init; } - [JsonInclude, JsonPropertyName("input_bytes")] - public long InputBytes { get; init; } - [JsonInclude, JsonPropertyName("input_field_count")] - public long InputFieldCount { get; init; } - [JsonInclude, JsonPropertyName("input_record_count")] - public long InputRecordCount { get; init; } - [JsonInclude, JsonPropertyName("invalid_date_count")] - public long InvalidDateCount { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("last_data_time")] - public long? LastDataTime { get; init; } - [JsonInclude, JsonPropertyName("latest_bucket_timestamp")] - public long? LatestBucketTimestamp { get; init; } - [JsonInclude, JsonPropertyName("latest_empty_bucket_timestamp")] - public long? LatestEmptyBucketTimestamp { get; init; } - [JsonInclude, JsonPropertyName("latest_record_timestamp")] - public long? LatestRecordTimestamp { get; init; } - [JsonInclude, JsonPropertyName("latest_sparse_bucket_timestamp")] - public long? LatestSparseBucketTimestamp { get; init; } - [JsonInclude, JsonPropertyName("log_time")] - public long? LogTime { get; init; } - [JsonInclude, JsonPropertyName("missing_field_count")] - public long MissingFieldCount { get; init; } - [JsonInclude, JsonPropertyName("out_of_order_timestamp_count")] - public long OutOfOrderTimestampCount { get; init; } - [JsonInclude, JsonPropertyName("processed_field_count")] - public long ProcessedFieldCount { get; init; } - [JsonInclude, JsonPropertyName("processed_record_count")] - public long ProcessedRecordCount { get; init; } - [JsonInclude, JsonPropertyName("sparse_bucket_count")] - public long SparseBucketCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataCounts(long bucketCount, long emptyBucketCount, long inputBytes, long inputFieldCount, long inputRecordCount, long invalidDateCount, string jobId, long missingFieldCount, long outOfOrderTimestampCount, long processedFieldCount, long processedRecordCount, long sparseBucketCount) + { + BucketCount = bucketCount; + EmptyBucketCount = emptyBucketCount; + InputBytes = inputBytes; + InputFieldCount = inputFieldCount; + InputRecordCount = inputRecordCount; + InvalidDateCount = invalidDateCount; + JobId = jobId; + MissingFieldCount = missingFieldCount; + OutOfOrderTimestampCount = outOfOrderTimestampCount; + ProcessedFieldCount = processedFieldCount; + ProcessedRecordCount = processedRecordCount; + SparseBucketCount = sparseBucketCount; + } +#if NET7_0_OR_GREATER + public DataCounts() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataCounts() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long BucketCount { get; set; } + public long? EarliestRecordTimestamp { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long EmptyBucketCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InputBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InputFieldCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InputRecordCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long InvalidDateCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public long? LastDataTime { get; set; } + public long? LatestBucketTimestamp { get; set; } + public long? LatestEmptyBucketTimestamp { get; set; } + public long? LatestRecordTimestamp { get; set; } + public long? LatestSparseBucketTimestamp { get; set; } + public long? LogTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MissingFieldCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long OutOfOrderTimestampCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ProcessedFieldCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ProcessedRecordCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SparseBucketCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataDescription.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataDescription.g.cs index c2f8ff09348..bc5a8c53c74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataDescription.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataDescription.g.cs @@ -17,19 +17,97 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataDescriptionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldDelimiter = System.Text.Json.JsonEncodedText.Encode("field_delimiter"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropTimeField = System.Text.Json.JsonEncodedText.Encode("time_field"); + private static readonly System.Text.Json.JsonEncodedText PropTimeFormat = System.Text.Json.JsonEncodedText.Encode("time_format"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataDescription Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFieldDelimiter = default; + LocalJsonValue propFormat = default; + LocalJsonValue propTimeField = default; + LocalJsonValue propTimeFormat = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldDelimiter.TryReadProperty(ref reader, options, PropFieldDelimiter, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propTimeField.TryReadProperty(ref reader, options, PropTimeField, null)) + { + continue; + } + + if (propTimeFormat.TryReadProperty(ref reader, options, PropTimeFormat, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldDelimiter = propFieldDelimiter.Value, + Format = propFormat.Value, + TimeField = propTimeField.Value, + TimeFormat = propTimeFormat.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataDescription value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldDelimiter, value.FieldDelimiter, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropTimeField, value.TimeField, null, null); + writer.WriteProperty(options, PropTimeFormat, value.TimeFormat, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionConverter))] public sealed partial class DataDescription { - [JsonInclude, JsonPropertyName("field_delimiter")] +#if NET7_0_OR_GREATER + public DataDescription() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataDescription() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? FieldDelimiter { get; set; } /// @@ -37,7 +115,6 @@ public sealed partial class DataDescription /// Only JSON format is supported at this time. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -45,7 +122,6 @@ public sealed partial class DataDescription /// The name of the field that contains the timestamp. /// /// - [JsonInclude, JsonPropertyName("time_field")] public Elastic.Clients.Elasticsearch.Field? TimeField { get; set; } /// @@ -53,49 +129,43 @@ public sealed partial class DataDescription /// The time format, which can be epoch, epoch_ms, or a custom pattern. The value epoch refers to UNIX or Epoch time (the number of seconds since 1 Jan 1970). The value epoch_ms indicates that time is measured in milliseconds since the epoch. The epoch and epoch_ms time formats accept either integer or real values. Custom patterns must conform to the Java DateTimeFormatter class. When you use date-time formatting patterns, it is recommended that you provide the full date, time and time zone. For example: yyyy-MM-dd'T'HH:mm:ssX. If the pattern that you specify is not sufficient to produce a complete timestamp, job creation fails. /// /// - [JsonInclude, JsonPropertyName("time_format")] public string? TimeFormat { get; set; } } -public sealed partial class DataDescriptionDescriptor : SerializableDescriptor> +public readonly partial struct DataDescriptionDescriptor { - internal DataDescriptionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataDescription Instance { get; init; } - public DataDescriptionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataDescriptionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription instance) { + Instance = instance; } - private string? FieldDelimiterValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TimeFieldValue { get; set; } - private string? TimeFormatValue { get; set; } - - public DataDescriptionDescriptor FieldDelimiter(string? fieldDelimiter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataDescriptionDescriptor() { - FieldDelimiterValue = fieldDelimiter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - /// - /// - /// Only JSON format is supported at this time. - /// - /// - public DataDescriptionDescriptor Format(string? format) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor FieldDelimiter(string? value) { - FormatValue = format; - return Self; + Instance.FieldDelimiter = value; + return this; } /// /// - /// The name of the field that contains the timestamp. + /// Only JSON format is supported at this time. /// /// - public DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsearch.Field? timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor Format(string? value) { - TimeFieldValue = timeField; - return Self; + Instance.Format = value; + return this; } /// @@ -103,10 +173,10 @@ public DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsea /// The name of the field that contains the timestamp. /// /// - public DataDescriptionDescriptor TimeField(Expression> timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsearch.Field? value) { - TimeFieldValue = timeField; - return Self; + Instance.TimeField = value; + return this; } /// @@ -114,10 +184,10 @@ public DataDescriptionDescriptor TimeField(Expression /// - public DataDescriptionDescriptor TimeField(Expression> timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeField(System.Linq.Expressions.Expression> value) { - TimeFieldValue = timeField; - return Self; + Instance.TimeField = value; + return this; } /// @@ -125,82 +195,60 @@ public DataDescriptionDescriptor TimeField(Expressionepoch, epoch_ms, or a custom pattern. The value epoch refers to UNIX or Epoch time (the number of seconds since 1 Jan 1970). The value epoch_ms indicates that time is measured in milliseconds since the epoch. The epoch and epoch_ms time formats accept either integer or real values. Custom patterns must conform to the Java DateTimeFormatter class. When you use date-time formatting patterns, it is recommended that you provide the full date, time and time zone. For example: yyyy-MM-dd'T'HH:mm:ssX. If the pattern that you specify is not sufficient to produce a complete timestamp, job creation fails. /// /// - public DataDescriptionDescriptor TimeFormat(string? timeFormat) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeFormat(string? value) { - TimeFormatValue = timeFormat; - return Self; + Instance.TimeFormat = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataDescription Build(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FieldDelimiterValue)) - { - writer.WritePropertyName("field_delimiter"); - writer.WriteStringValue(FieldDelimiterValue); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (TimeFieldValue is not null) + if (action is null) { - writer.WritePropertyName("time_field"); - JsonSerializer.Serialize(writer, TimeFieldValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(TimeFormatValue)) - { - writer.WritePropertyName("time_format"); - writer.WriteStringValue(TimeFormatValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataDescriptionDescriptor : SerializableDescriptor +public readonly partial struct DataDescriptionDescriptor { - internal DataDescriptionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataDescription Instance { get; init; } - public DataDescriptionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataDescriptionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription instance) { + Instance = instance; } - private string? FieldDelimiterValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TimeFieldValue { get; set; } - private string? TimeFormatValue { get; set; } - - public DataDescriptionDescriptor FieldDelimiter(string? fieldDelimiter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataDescriptionDescriptor() { - FieldDelimiterValue = fieldDelimiter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - /// - /// - /// Only JSON format is supported at this time. - /// - /// - public DataDescriptionDescriptor Format(string? format) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataDescription instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor FieldDelimiter(string? value) { - FormatValue = format; - return Self; + Instance.FieldDelimiter = value; + return this; } /// /// - /// The name of the field that contains the timestamp. + /// Only JSON format is supported at this time. /// /// - public DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsearch.Field? timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor Format(string? value) { - TimeFieldValue = timeField; - return Self; + Instance.Format = value; + return this; } /// @@ -208,10 +256,10 @@ public DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsearch.Field? /// The name of the field that contains the timestamp. /// /// - public DataDescriptionDescriptor TimeField(Expression> timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeField(Elastic.Clients.Elasticsearch.Field? value) { - TimeFieldValue = timeField; - return Self; + Instance.TimeField = value; + return this; } /// @@ -219,10 +267,10 @@ public DataDescriptionDescriptor TimeField(Expression /// - public DataDescriptionDescriptor TimeField(Expression> timeField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeField(System.Linq.Expressions.Expression> value) { - TimeFieldValue = timeField; - return Self; + Instance.TimeField = value; + return this; } /// @@ -230,39 +278,22 @@ public DataDescriptionDescriptor TimeField(Expressionepoch, epoch_ms, or a custom pattern. The value epoch refers to UNIX or Epoch time (the number of seconds since 1 Jan 1970). The value epoch_ms indicates that time is measured in milliseconds since the epoch. The epoch and epoch_ms time formats accept either integer or real values. Custom patterns must conform to the Java DateTimeFormatter class. When you use date-time formatting patterns, it is recommended that you provide the full date, time and time zone. For example: yyyy-MM-dd'T'HH:mm:ssX. If the pattern that you specify is not sufficient to produce a complete timestamp, job creation fails. /// /// - public DataDescriptionDescriptor TimeFormat(string? timeFormat) + public Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor TimeFormat(string? value) { - TimeFormatValue = timeFormat; - return Self; + Instance.TimeFormat = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataDescription Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FieldDelimiterValue)) - { - writer.WritePropertyName("field_delimiter"); - writer.WriteStringValue(FieldDelimiterValue); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (TimeFieldValue is not null) + if (action is null) { - writer.WritePropertyName("time_field"); - JsonSerializer.Serialize(writer, TimeFieldValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(TimeFormatValue)) - { - writer.WritePropertyName("time_format"); - writer.WriteStringValue(TimeFormatValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataDescriptionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataDescription(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeed.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeed.g.cs index 399bbc72bc7..b2c7e11250f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeed.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeed.g.cs @@ -17,173 +17,256 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -internal sealed partial class DatafeedConverter : JsonConverter +internal sealed partial class DatafeedConverter : System.Text.Json.Serialization.JsonConverter { - public override Datafeed Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedId = System.Text.Json.JsonEncodedText.Encode("datafeed_id"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropIndexes = System.Text.Json.JsonEncodedText.Encode("indexes"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Datafeed Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyDictionary? aggregations = default; - Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? authorization = default; - Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig = default; - string datafeedId = default; - Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig delayedDataCheckConfig = default; - Elastic.Clients.Elasticsearch.Duration? frequency = default; - IReadOnlyCollection? indexes = default; - IReadOnlyCollection indices = default; - Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions = default; - string jobId = default; - int? maxEmptySearches = default; - Elastic.Clients.Elasticsearch.QueryDsl.Query query = default; - Elastic.Clients.Elasticsearch.Duration? queryDelay = default; - IReadOnlyDictionary? runtimeMappings = default; - IReadOnlyDictionary? scriptFields = default; - int? scrollSize = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDatafeedId = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue?> propIndexes = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "authorization") - { - authorization = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "chunking_config") - { - chunkingConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "datafeed_id") - { - datafeedId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "delayed_data_check_config") - { - delayedDataCheckConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "frequency") - { - frequency = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indexes") - { - indexes = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "indices") - { - indices = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "indices_options") - { - indicesOptions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "job_id") - { - jobId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_empty_searches") - { - maxEmptySearches = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query_delay") - { - queryDelay = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - runtimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - scriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "scroll_size") - { - scrollSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } + + if (propDatafeedId.TryReadProperty(ref reader, options, PropDatafeedId, null)) + { + continue; + } + + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propIndexes.TryReadProperty(ref reader, options, PropIndexes, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return new Datafeed { Aggregations = aggregations, Authorization = authorization, ChunkingConfig = chunkingConfig, DatafeedId = datafeedId, DelayedDataCheckConfig = delayedDataCheckConfig, Frequency = frequency, Indexes = indexes, Indices = indices, IndicesOptions = indicesOptions, JobId = jobId, MaxEmptySearches = maxEmptySearches, Query = query, QueryDelay = queryDelay, RuntimeMappings = runtimeMappings, ScriptFields = scriptFields, ScrollSize = scrollSize }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Datafeed(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Authorization = propAuthorization.Value, + ChunkingConfig = propChunkingConfig.Value, + DatafeedId = propDatafeedId.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Indexes = propIndexes.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; } - public override void Write(Utf8JsonWriter writer, Datafeed value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Datafeed value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'Datafeed' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDatafeedId, value.DatafeedId, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropIndexes, value.Indexes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); + writer.WriteEndObject(); } } -[JsonConverter(typeof(DatafeedConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConverter))] public sealed partial class Datafeed { - public IReadOnlyDictionary? Aggregations { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Datafeed(string datafeedId, Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig delayedDataCheckConfig, System.Collections.Generic.IReadOnlyCollection indices, string jobId, Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + DatafeedId = datafeedId; + DelayedDataCheckConfig = delayedDataCheckConfig; + Indices = indices; + JobId = jobId; + Query = query; + } +#if NET7_0_OR_GREATER + public Datafeed() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Datafeed() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Datafeed(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Aggregations { get; set; } /// /// /// The security privileges that the datafeed uses to run its queries. If Elastic Stack security features were disabled at the time of the most recent update to the datafeed, this property is omitted. /// /// - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; init; } - public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfig { get; init; } - public string DatafeedId { get; init; } - public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig DelayedDataCheckConfig { get; init; } - public Elastic.Clients.Elasticsearch.Duration? Frequency { get; init; } - public IReadOnlyCollection? Indexes { get; init; } - public IReadOnlyCollection Indices { get; init; } - public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; init; } - public string JobId { get; init; } - public int? MaxEmptySearches { get; init; } - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; init; } - public Elastic.Clients.Elasticsearch.Duration? QueryDelay { get; init; } - public IReadOnlyDictionary? RuntimeMappings { get; init; } - public IReadOnlyDictionary? ScriptFields { get; init; } - public int? ScrollSize { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization? Authorization { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfig { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DatafeedId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig DelayedDataCheckConfig { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Indexes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public int? MaxEmptySearches { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } + public Elastic.Clients.Elasticsearch.Duration? QueryDelay { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ScriptFields { get; set; } + public int? ScrollSize { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedAuthorization.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedAuthorization.g.cs index 966bab43c78..5c28b35a1f6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedAuthorization.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedAuthorization.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DatafeedAuthorizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropServiceAccount = System.Text.Json.JsonEncodedText.Encode("service_account"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue propServiceAccount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propServiceAccount.TryReadProperty(ref reader, options, PropServiceAccount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Roles = propRoles.Value, + ServiceAccount = propServiceAccount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorization value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropServiceAccount, value.ServiceAccount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedAuthorizationConverter))] public sealed partial class DatafeedAuthorization { +#if NET7_0_OR_GREATER + public DatafeedAuthorization() + { + } +#endif +#if !NET7_0_OR_GREATER + public DatafeedAuthorization() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatafeedAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If an API key was used for the most recent update to the datafeed, its name and identifier are listed in the response. /// /// - [JsonInclude, JsonPropertyName("api_key")] - public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; set; } /// /// /// If a user ID was used for the most recent update to the datafeed, its roles at the time of the update are listed in the response. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } /// /// /// If a service account was used for the most recent update to the datafeed, the account name is listed in the response. /// /// - [JsonInclude, JsonPropertyName("service_account")] - public string? ServiceAccount { get; init; } + public string? ServiceAccount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedConfig.g.cs index 0402dcefb43..77242dd4b45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedConfig.g.cs @@ -17,217 +17,195 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -internal sealed partial class DatafeedConfigConverter : JsonConverter +internal sealed partial class DatafeedConfigConverter : System.Text.Json.Serialization.JsonConverter { - public override DatafeedConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropChunkingConfig = System.Text.Json.JsonEncodedText.Encode("chunking_config"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedId = System.Text.Json.JsonEncodedText.Encode("datafeed_id"); + private static readonly System.Text.Json.JsonEncodedText PropDelayedDataCheckConfig = System.Text.Json.JsonEncodedText.Encode("delayed_data_check_config"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("indexes"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesOptions = System.Text.Json.JsonEncodedText.Encode("indices_options"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxEmptySearches = System.Text.Json.JsonEncodedText.Encode("max_empty_searches"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryDelay = System.Text.Json.JsonEncodedText.Encode("query_delay"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropScriptFields = System.Text.Json.JsonEncodedText.Encode("script_fields"); + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new DatafeedConfig(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue propChunkingConfig = default; + LocalJsonValue propDatafeedId = default; + LocalJsonValue propDelayedDataCheckConfig = default; + LocalJsonValue propFrequency = default; + LocalJsonValue propIndices = default; + LocalJsonValue propIndicesOptions = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaxEmptySearches = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryDelay = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue?> propScriptFields = default; + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "chunking_config") - { - variant.ChunkingConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "datafeed_id") - { - variant.DatafeedId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "delayed_data_check_config") - { - variant.DelayedDataCheckConfig = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "frequency") - { - variant.Frequency = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices" || property == "indexes") - { - variant.Indices = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "indices_options") - { - variant.IndicesOptions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "job_id") - { - variant.JobId = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_empty_searches") - { - variant.MaxEmptySearches = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query_delay") - { - variant.QueryDelay = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "runtime_mappings") - { - variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "script_fields") - { - variant.ScriptFields = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "scroll_size") - { - variant.ScrollSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propChunkingConfig.TryReadProperty(ref reader, options, PropChunkingConfig, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, DatafeedConfig value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); - } + if (propDatafeedId.TryReadProperty(ref reader, options, PropDatafeedId, null)) + { + continue; + } - if (value.ChunkingConfig is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, value.ChunkingConfig, options); - } + if (propDelayedDataCheckConfig.TryReadProperty(ref reader, options, PropDelayedDataCheckConfig, null)) + { + continue; + } - if (value.DatafeedId is not null) - { - writer.WritePropertyName("datafeed_id"); - JsonSerializer.Serialize(writer, value.DatafeedId, options); - } + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } - if (value.DelayedDataCheckConfig is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, value.DelayedDataCheckConfig, options); - } + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null) || propIndices.TryReadProperty(ref reader, options, PropIndices1, null)) + { + continue; + } - if (value.Frequency is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, value.Frequency, options); - } + if (propIndicesOptions.TryReadProperty(ref reader, options, PropIndicesOptions, null)) + { + continue; + } - if (value.Indices is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, value.Indices, options); - } + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } - if (value.IndicesOptions is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, value.IndicesOptions, options); - } + if (propMaxEmptySearches.TryReadProperty(ref reader, options, PropMaxEmptySearches, null)) + { + continue; + } - if (value.JobId is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, value.JobId, options); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.MaxEmptySearches.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(value.MaxEmptySearches.Value); - } + if (propQueryDelay.TryReadProperty(ref reader, options, PropQueryDelay, null)) + { + continue; + } - if (value.Query is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - } + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.QueryDelay is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, value.QueryDelay, options); - } + if (propScriptFields.TryReadProperty(ref reader, options, PropScriptFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RuntimeMappings is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, value.RuntimeMappings, options); - } + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } - if (value.ScriptFields is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, value.ScriptFields, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ScrollSize.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(value.ScrollSize.Value); - } + Aggregations = propAggregations.Value, + ChunkingConfig = propChunkingConfig.Value, + DatafeedId = propDatafeedId.Value, + DelayedDataCheckConfig = propDelayedDataCheckConfig.Value, + Frequency = propFrequency.Value, + Indices = propIndices.Value, + IndicesOptions = propIndicesOptions.Value, + JobId = propJobId.Value, + MaxEmptySearches = propMaxEmptySearches.Value, + Query = propQuery.Value, + QueryDelay = propQueryDelay.Value, + RuntimeMappings = propRuntimeMappings.Value, + ScriptFields = propScriptFields.Value, + ScrollSize = propScrollSize.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropChunkingConfig, value.ChunkingConfig, null, null); + writer.WriteProperty(options, PropDatafeedId, value.DatafeedId, null, null); + writer.WriteProperty(options, PropDelayedDataCheckConfig, value.DelayedDataCheckConfig, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropIndicesOptions, value.IndicesOptions, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxEmptySearches, value.MaxEmptySearches, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryDelay, value.QueryDelay, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScriptFields, value.ScriptFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(DatafeedConfigConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigConverter))] public sealed partial class DatafeedConfig { +#if NET7_0_OR_GREATER + public DatafeedConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public DatafeedConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. /// /// - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// @@ -298,14 +276,14 @@ public sealed partial class DatafeedConfig /// Specifies runtime fields for the datafeed search. /// /// - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. /// /// - public IDictionary? ScriptFields { get; set; } + public System.Collections.Generic.IDictionary? ScriptFields { get; set; } /// /// @@ -315,115 +293,125 @@ public sealed partial class DatafeedConfig public int? ScrollSize { get; set; } } -public sealed partial class DatafeedConfigDescriptor : SerializableDescriptor> +public readonly partial struct DatafeedConfigDescriptor { - internal DatafeedConfigDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig Instance { get; init; } - public DatafeedConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig instance) { + Instance = instance; } - private IDictionary> AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? DatafeedIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor descriptor) => descriptor.Instance; /// /// /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. /// /// - public DatafeedConfigDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggregations = value; + return this; } /// /// - /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. /// /// - public DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations(System.Action>? action) { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } - public DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public DatafeedConfigDescriptor ChunkingConfig(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddAggregation(string key, System.Action> action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// /// - /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. The default value is the job identifier. + /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. /// /// - public DatafeedConfigDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id? datafeedId) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - DatafeedIdValue = datafeedId; - return Self; + Instance.ChunkingConfig = value; + return this; } /// /// - /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. /// /// - public DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ChunkingConfig(System.Action action) { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; } - public DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. The default value is the job identifier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id? value) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; + Instance.DatafeedId = value; + return this; } - public DatafeedConfigDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) + { + Instance.DelayedDataCheckConfig = value; + return this; + } + + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DelayedDataCheckConfig(System.Action action) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// @@ -431,10 +419,10 @@ public DatafeedConfigDescriptor DelayedDataCheckConfig(Action150s. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation. /// /// - public DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -442,10 +430,10 @@ public DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsear /// An array of index names. Wildcards are supported. If any indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role. /// /// - public DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -453,34 +441,38 @@ public DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch /// Specifies index expansion options that are used during search. /// /// - public DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.IndicesOptions = value; + return this; } - public DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions() { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; } - public DatafeedConfigDescriptor IndicesOptions(Action configure) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions(System.Action? action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; } - public DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -488,10 +480,10 @@ public DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.I /// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop itself and close its associated job after this many real-time searches that return no documents. In other words, it will stop after frequency times max_empty_searches of real-time operation. If not set then a datafeed with no end time that sees no data will remain started until it is explicitly stopped. /// /// - public DatafeedConfigDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor MaxEmptySearches(int? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.MaxEmptySearches = value; + return this; } /// @@ -499,28 +491,21 @@ public DatafeedConfigDescriptor MaxEmptySearches(int? maxEmptySearche /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. /// /// - public DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public DatafeedConfigDescriptor Query(Action> configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -528,10 +513,10 @@ public DatafeedConfigDescriptor Query(Action60s and 120s. This randomness improves the query performance when there are multiple jobs running on the same node. /// /// - public DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.QueryDelay = value; + return this; } /// @@ -539,274 +524,271 @@ public DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsea /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings(System.Action>? action) { - ScrollSizeValue = scrollSize; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DatafeedIdValue is not null) - { - writer.WritePropertyName("datafeed_id"); - JsonSerializer.Serialize(writer, DatafeedIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } - if (QueryDelayValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } +public readonly partial struct DatafeedConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig Instance { get; init; } - if (ScrollSizeValue.HasValue) - { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class DatafeedConfigDescriptor : SerializableDescriptor -{ - internal DatafeedConfigDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor descriptor) => descriptor.Instance; - public DatafeedConfigDescriptor() : base() + /// + /// + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { + Instance.Aggregations = value; + return this; } - private IDictionary AggregationsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? ChunkingConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor ChunkingConfigDescriptor { get; set; } - private Action ChunkingConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? DatafeedIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? DelayedDataCheckConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor DelayedDataCheckConfigDescriptor { get; set; } - private Action DelayedDataCheckConfigDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FrequencyValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptions? IndicesOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor IndicesOptionsDescriptor { get; set; } - private Action IndicesOptionsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Id? JobIdValue { get; set; } - private int? MaxEmptySearchesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Duration? QueryDelayValue { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private IDictionary ScriptFieldsValue { get; set; } - private int? ScrollSizeValue { get; set; } + /// + /// + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } /// /// /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. /// /// - public DatafeedConfigDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations(System.Action? action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; } /// /// - /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. + /// If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. /// /// - public DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? chunkingConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) { - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigValue = chunkingConfig; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; } - public DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddAggregation(string key, System.Action action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptorAction = null; - ChunkingConfigDescriptor = descriptor; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } - public DatafeedConfigDescriptor ChunkingConfig(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddAggregation(string key, System.Action> action) { - ChunkingConfigValue = null; - ChunkingConfigDescriptor = null; - ChunkingConfigDescriptorAction = configure; - return Self; + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// /// - /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. The default value is the job identifier. + /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. /// /// - public DatafeedConfigDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id? datafeedId) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ChunkingConfig(Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfig? value) { - DatafeedIdValue = datafeedId; - return Self; + Instance.ChunkingConfig = value; + return this; } /// /// - /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated and is an advanced configuration option. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ChunkingConfig(System.Action action) + { + Instance.ChunkingConfig = Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor.Build(action); + return this; + } + + /// + /// + /// A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. The default value is the job identifier. /// /// - public DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? delayedDataCheckConfig) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DatafeedId(Elastic.Clients.Elasticsearch.Id? value) { - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigValue = delayedDataCheckConfig; - return Self; + Instance.DatafeedId = value; + return this; } - public DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig? value) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptorAction = null; - DelayedDataCheckConfigDescriptor = descriptor; - return Self; + Instance.DelayedDataCheckConfig = value; + return this; } - public DatafeedConfigDescriptor DelayedDataCheckConfig(Action configure) + /// + /// + /// Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay option is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor DelayedDataCheckConfig(System.Action action) { - DelayedDataCheckConfigValue = null; - DelayedDataCheckConfigDescriptor = null; - DelayedDataCheckConfigDescriptorAction = configure; - return Self; + Instance.DelayedDataCheckConfig = Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor.Build(action); + return this; } /// @@ -814,10 +796,10 @@ public DatafeedConfigDescriptor DelayedDataCheckConfig(Action150s. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation. /// /// - public DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? frequency) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration? value) { - FrequencyValue = frequency; - return Self; + Instance.Frequency = value; + return this; } /// @@ -825,10 +807,10 @@ public DatafeedConfigDescriptor Frequency(Elastic.Clients.Elasticsearch.Duration /// An array of index names. Wildcards are supported. If any indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role. /// /// - public DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -836,34 +818,38 @@ public DatafeedConfigDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? i /// Specifies index expansion options that are used during search. /// /// - public DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? indicesOptions) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptions? value) { - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsValue = indicesOptions; - return Self; + Instance.IndicesOptions = value; + return this; } - public DatafeedConfigDescriptor IndicesOptions(Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor descriptor) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions() { - IndicesOptionsValue = null; - IndicesOptionsDescriptorAction = null; - IndicesOptionsDescriptor = descriptor; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(null); + return this; } - public DatafeedConfigDescriptor IndicesOptions(Action configure) + /// + /// + /// Specifies index expansion options that are used during search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor IndicesOptions(System.Action? action) { - IndicesOptionsValue = null; - IndicesOptionsDescriptor = null; - IndicesOptionsDescriptorAction = configure; - return Self; + Instance.IndicesOptions = Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor.Build(action); + return this; } - public DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.Id? value) { - JobIdValue = jobId; - return Self; + Instance.JobId = value; + return this; } /// @@ -871,10 +857,10 @@ public DatafeedConfigDescriptor JobId(Elastic.Clients.Elasticsearch.Id? jobId) /// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop itself and close its associated job after this many real-time searches that return no documents. In other words, it will stop after frequency times max_empty_searches of real-time operation. If not set then a datafeed with no end time that sees no data will remain started until it is explicitly stopped. /// /// - public DatafeedConfigDescriptor MaxEmptySearches(int? maxEmptySearches) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor MaxEmptySearches(int? value) { - MaxEmptySearchesValue = maxEmptySearches; - return Self; + Instance.MaxEmptySearches = value; + return this; } /// @@ -882,28 +868,32 @@ public DatafeedConfigDescriptor MaxEmptySearches(int? maxEmptySearches) /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. /// /// - public DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public DatafeedConfigDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public DatafeedConfigDescriptor Query(Action configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -911,10 +901,10 @@ public DatafeedConfigDescriptor Query(Action60s and 120s. This randomness improves the query performance when there are multiple jobs running on the same node. /// /// - public DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? queryDelay) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - QueryDelayValue = queryDelay; - return Self; + Instance.QueryDelay = value; + return this; } /// @@ -922,161 +912,155 @@ public DatafeedConfigDescriptor QueryDelay(Elastic.Clients.Elasticsearch.Duratio /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor ScriptFields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings() { - ScriptFieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// Specifies runtime fields for the datafeed search. /// /// - public DatafeedConfigDescriptor ScrollSize(int? scrollSize) + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings(System.Action? action) { - ScrollSizeValue = scrollSize; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies runtime fields for the datafeed search. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor RuntimeMappings(System.Action>? action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - if (ChunkingConfigDescriptor is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigDescriptor, options); - } - else if (ChunkingConfigDescriptorAction is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.ChunkingConfigDescriptor(ChunkingConfigDescriptorAction), options); - } - else if (ChunkingConfigValue is not null) - { - writer.WritePropertyName("chunking_config"); - JsonSerializer.Serialize(writer, ChunkingConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DatafeedIdValue is not null) - { - writer.WritePropertyName("datafeed_id"); - JsonSerializer.Serialize(writer, DatafeedIdValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (DelayedDataCheckConfigDescriptor is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigDescriptor, options); - } - else if (DelayedDataCheckConfigDescriptorAction is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(DelayedDataCheckConfigDescriptorAction), options); - } - else if (DelayedDataCheckConfigValue is not null) - { - writer.WritePropertyName("delayed_data_check_config"); - JsonSerializer.Serialize(writer, DelayedDataCheckConfigValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (FrequencyValue is not null) - { - writer.WritePropertyName("frequency"); - JsonSerializer.Serialize(writer, FrequencyValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (IndicesOptionsDescriptor is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsDescriptor, options); - } - else if (IndicesOptionsDescriptorAction is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndicesOptionsDescriptor(IndicesOptionsDescriptorAction), options); - } - else if (IndicesOptionsValue is not null) - { - writer.WritePropertyName("indices_options"); - JsonSerializer.Serialize(writer, IndicesOptionsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (JobIdValue is not null) - { - writer.WritePropertyName("job_id"); - JsonSerializer.Serialize(writer, JobIdValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields(System.Collections.Generic.IDictionary? value) + { + Instance.ScriptFields = value; + return this; + } - if (MaxEmptySearchesValue.HasValue) - { - writer.WritePropertyName("max_empty_searches"); - writer.WriteNumberValue(MaxEmptySearchesValue.Value); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields() + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(null); + return this; + } - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScriptFields(System.Action? action) + { + Instance.ScriptFields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringScriptField.Build(action); + return this; + } - if (QueryDelayValue is not null) - { - writer.WritePropertyName("query_delay"); - JsonSerializer.Serialize(writer, QueryDelayValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddScriptField(string key, Elastic.Clients.Elasticsearch.ScriptField value) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, value); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor AddScriptField(string key, System.Action action) + { + Instance.ScriptFields ??= new System.Collections.Generic.Dictionary(); + Instance.ScriptFields.Add(key, Elastic.Clients.Elasticsearch.ScriptFieldDescriptor.Build(action)); + return this; + } - if (ScriptFieldsValue is not null) - { - writer.WritePropertyName("script_fields"); - JsonSerializer.Serialize(writer, ScriptFieldsValue, options); - } + /// + /// + /// The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window, which is 10,000 by default. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor ScrollSize(int? value) + { + Instance.ScrollSize = value; + return this; + } - if (ScrollSizeValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("scroll_size"); - writer.WriteNumberValue(ScrollSizeValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedRunningState.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedRunningState.g.cs index c73e1ee16ce..4150fdcf00e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedRunningState.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedRunningState.g.cs @@ -17,25 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DatafeedRunningStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRealTimeConfigured = System.Text.Json.JsonEncodedText.Encode("real_time_configured"); + private static readonly System.Text.Json.JsonEncodedText PropRealTimeRunning = System.Text.Json.JsonEncodedText.Encode("real_time_running"); + private static readonly System.Text.Json.JsonEncodedText PropSearchInterval = System.Text.Json.JsonEncodedText.Encode("search_interval"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRealTimeConfigured = default; + LocalJsonValue propRealTimeRunning = default; + LocalJsonValue propSearchInterval = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRealTimeConfigured.TryReadProperty(ref reader, options, PropRealTimeConfigured, null)) + { + continue; + } + + if (propRealTimeRunning.TryReadProperty(ref reader, options, PropRealTimeRunning, null)) + { + continue; + } + + if (propSearchInterval.TryReadProperty(ref reader, options, PropSearchInterval, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RealTimeConfigured = propRealTimeConfigured.Value, + RealTimeRunning = propRealTimeRunning.Value, + SearchInterval = propSearchInterval.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningState value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRealTimeConfigured, value.RealTimeConfigured, null, null); + writer.WriteProperty(options, PropRealTimeRunning, value.RealTimeRunning, null, null); + writer.WriteProperty(options, PropSearchInterval, value.SearchInterval, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningStateConverter))] public sealed partial class DatafeedRunningState { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedRunningState(bool realTimeConfigured, bool realTimeRunning) + { + RealTimeConfigured = realTimeConfigured; + RealTimeRunning = realTimeRunning; + } +#if NET7_0_OR_GREATER + public DatafeedRunningState() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatafeedRunningState() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatafeedRunningState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Indicates if the datafeed is "real-time"; meaning that the datafeed has no configured end time. /// /// - [JsonInclude, JsonPropertyName("real_time_configured")] - public bool RealTimeConfigured { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool RealTimeConfigured { get; set; } /// /// @@ -43,14 +123,16 @@ public sealed partial class DatafeedRunningState /// For datafeeds without a configured end time, this means that the datafeed is now running on "real-time" data. /// /// - [JsonInclude, JsonPropertyName("real_time_running")] - public bool RealTimeRunning { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool RealTimeRunning { get; set; } /// /// /// Provides the latest time interval the datafeed has searched. /// /// - [JsonInclude, JsonPropertyName("search_interval")] - public Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchInterval? SearchInterval { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchInterval? SearchInterval { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedStats.g.cs index 3cd3e8629d8..4373371e21e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedStats.g.cs @@ -17,25 +17,128 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DatafeedStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAssignmentExplanation = System.Text.Json.JsonEncodedText.Encode("assignment_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedId = System.Text.Json.JsonEncodedText.Encode("datafeed_id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropRunningState = System.Text.Json.JsonEncodedText.Encode("running_state"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropTimingStats = System.Text.Json.JsonEncodedText.Encode("timing_stats"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignmentExplanation = default; + LocalJsonValue propDatafeedId = default; + LocalJsonValue propNode = default; + LocalJsonValue propRunningState = default; + LocalJsonValue propState = default; + LocalJsonValue propTimingStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignmentExplanation.TryReadProperty(ref reader, options, PropAssignmentExplanation, null)) + { + continue; + } + + if (propDatafeedId.TryReadProperty(ref reader, options, PropDatafeedId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propRunningState.TryReadProperty(ref reader, options, PropRunningState, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propTimingStats.TryReadProperty(ref reader, options, PropTimingStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AssignmentExplanation = propAssignmentExplanation.Value, + DatafeedId = propDatafeedId.Value, + Node = propNode.Value, + RunningState = propRunningState.Value, + State = propState.Value, + TimingStats = propTimingStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignmentExplanation, value.AssignmentExplanation, null, null); + writer.WriteProperty(options, PropDatafeedId, value.DatafeedId, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropRunningState, value.RunningState, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropTimingStats, value.TimingStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedStatsConverter))] public sealed partial class DatafeedStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedStats(string datafeedId, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState state) + { + DatafeedId = datafeedId; + State = state; + } +#if NET7_0_OR_GREATER + public DatafeedStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatafeedStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatafeedStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For started datafeeds only, contains messages relating to the selection of a node. /// /// - [JsonInclude, JsonPropertyName("assignment_explanation")] - public string? AssignmentExplanation { get; init; } + public string? AssignmentExplanation { get; set; } /// /// @@ -44,16 +147,18 @@ public sealed partial class DatafeedStats /// It must start and end with alphanumeric characters. /// /// - [JsonInclude, JsonPropertyName("datafeed_id")] - public string DatafeedId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string DatafeedId { get; set; } /// /// /// For started datafeeds only, this information pertains to the node upon which the datafeed is started. /// /// - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact? Node { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact? Node { get; set; } /// /// @@ -61,22 +166,23 @@ public sealed partial class DatafeedStats /// It is only provided if the datafeed is started. /// /// - [JsonInclude, JsonPropertyName("running_state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningState? RunningState { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedRunningState? RunningState { get; set; } /// /// /// The status of the datafeed, which can be one of the following values: starting, started, stopping, stopped. /// /// - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState State { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DatafeedState State { get; set; } /// /// /// An object that provides statistical information about timing aspect of this datafeed. /// /// - [JsonInclude, JsonPropertyName("timing_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStats? TimingStats { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStats? TimingStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedTimingStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedTimingStats.g.cs index fa9c55834e7..509ba4b3624 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedTimingStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DatafeedTimingStats.g.cs @@ -17,65 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DatafeedTimingStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAverageSearchTimePerBucketMs = System.Text.Json.JsonEncodedText.Encode("average_search_time_per_bucket_ms"); + private static readonly System.Text.Json.JsonEncodedText PropBucketCount = System.Text.Json.JsonEncodedText.Encode("bucket_count"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAverageCalculationContext = System.Text.Json.JsonEncodedText.Encode("exponential_average_calculation_context"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAverageSearchTimePerHourMs = System.Text.Json.JsonEncodedText.Encode("exponential_average_search_time_per_hour_ms"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropSearchCount = System.Text.Json.JsonEncodedText.Encode("search_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSearchTimeMs = System.Text.Json.JsonEncodedText.Encode("total_search_time_ms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAverageSearchTimePerBucketMs = default; + LocalJsonValue propBucketCount = default; + LocalJsonValue propExponentialAverageCalculationContext = default; + LocalJsonValue propExponentialAverageSearchTimePerHourMs = default; + LocalJsonValue propJobId = default; + LocalJsonValue propSearchCount = default; + LocalJsonValue propTotalSearchTimeMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAverageSearchTimePerBucketMs.TryReadProperty(ref reader, options, PropAverageSearchTimePerBucketMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propBucketCount.TryReadProperty(ref reader, options, PropBucketCount, null)) + { + continue; + } + + if (propExponentialAverageCalculationContext.TryReadProperty(ref reader, options, PropExponentialAverageCalculationContext, null)) + { + continue; + } + + if (propExponentialAverageSearchTimePerHourMs.TryReadProperty(ref reader, options, PropExponentialAverageSearchTimePerHourMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propSearchCount.TryReadProperty(ref reader, options, PropSearchCount, null)) + { + continue; + } + + if (propTotalSearchTimeMs.TryReadProperty(ref reader, options, PropTotalSearchTimeMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AverageSearchTimePerBucketMs = propAverageSearchTimePerBucketMs.Value, + BucketCount = propBucketCount.Value, + ExponentialAverageCalculationContext = propExponentialAverageCalculationContext.Value, + ExponentialAverageSearchTimePerHourMs = propExponentialAverageSearchTimePerHourMs.Value, + JobId = propJobId.Value, + SearchCount = propSearchCount.Value, + TotalSearchTimeMs = propTotalSearchTimeMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAverageSearchTimePerBucketMs, value.AverageSearchTimePerBucketMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropBucketCount, value.BucketCount, null, null); + writer.WriteProperty(options, PropExponentialAverageCalculationContext, value.ExponentialAverageCalculationContext, null, null); + writer.WriteProperty(options, PropExponentialAverageSearchTimePerHourMs, value.ExponentialAverageSearchTimePerHourMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropSearchCount, value.SearchCount, null, null); + writer.WriteProperty(options, PropTotalSearchTimeMs, value.TotalSearchTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedTimingStatsConverter))] public sealed partial class DatafeedTimingStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatafeedTimingStats(long bucketCount, System.TimeSpan exponentialAverageSearchTimePerHourMs, string jobId, long searchCount, System.TimeSpan totalSearchTimeMs) + { + BucketCount = bucketCount; + ExponentialAverageSearchTimePerHourMs = exponentialAverageSearchTimePerHourMs; + JobId = jobId; + SearchCount = searchCount; + TotalSearchTimeMs = totalSearchTimeMs; + } +#if NET7_0_OR_GREATER + public DatafeedTimingStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DatafeedTimingStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DatafeedTimingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The average search time per bucket, in milliseconds. /// /// - [JsonInclude, JsonPropertyName("average_search_time_per_bucket_ms")] - public double? AverageSearchTimePerBucketMs { get; init; } + public System.TimeSpan? AverageSearchTimePerBucketMs { get; set; } /// /// /// The number of buckets processed. /// /// - [JsonInclude, JsonPropertyName("bucket_count")] - public long BucketCount { get; init; } - [JsonInclude, JsonPropertyName("exponential_average_calculation_context")] - public Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContext? ExponentialAverageCalculationContext { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long BucketCount { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContext? ExponentialAverageCalculationContext { get; set; } /// /// /// The exponential average search time per hour, in milliseconds. /// /// - [JsonInclude, JsonPropertyName("exponential_average_search_time_per_hour_ms")] - public double ExponentialAverageSearchTimePerHourMs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ExponentialAverageSearchTimePerHourMs { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// The number of searches run by the datafeed. /// /// - [JsonInclude, JsonPropertyName("search_count")] - public long SearchCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long SearchCount { get; set; } /// /// /// The total time the datafeed spent searching, in milliseconds. /// /// - [JsonInclude, JsonPropertyName("total_search_time_ms")] - public double TotalSearchTimeMs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalSearchTimeMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeeds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeeds.g.cs index c2a86f33d4f..1434d9cb1f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeeds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Datafeeds.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DatafeedsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScrollSize = System.Text.Json.JsonEncodedText.Encode("scroll_size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScrollSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScrollSize.TryReadProperty(ref reader, options, PropScrollSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ScrollSize = propScrollSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScrollSize, value.ScrollSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DatafeedsConverter))] public sealed partial class Datafeeds { - [JsonInclude, JsonPropertyName("scroll_size")] - public int ScrollSize { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Datafeeds(int scrollSize) + { + ScrollSize = scrollSize; + } +#if NET7_0_OR_GREATER + public Datafeeds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Datafeeds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Datafeeds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int ScrollSize { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysis.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysis.g.cs index f7a17f76691..8ee77a5391c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysis.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysis.g.cs @@ -17,241 +17,383 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(DataframeAnalysisConverter))] -public sealed partial class DataframeAnalysis +internal sealed partial class DataframeAnalysisConverter : System.Text.Json.Serialization.JsonConverter { - internal DataframeAnalysis(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantOutlierDetection = System.Text.Json.JsonEncodedText.Encode("outlier_detection"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); - public static DataframeAnalysis Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification dataframeAnalysisClassification) => new DataframeAnalysis("classification", dataframeAnalysisClassification); - public static DataframeAnalysis OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection dataframeAnalysisOutlierDetection) => new DataframeAnalysis("outlier_detection", dataframeAnalysisOutlierDetection); - public static DataframeAnalysis Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression dataframeAnalysisRegression) => new DataframeAnalysis("regression", dataframeAnalysisRegression); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class DataframeAnalysisConverter : JsonConverter -{ - public override DataframeAnalysis Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantOutlierDetection)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantOutlierDetection.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "outlier_detection") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DataframeAnalysis' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DataframeAnalysis(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, DataframeAnalysis value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification)value.Variant, options); - break; - case "outlier_detection": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification)value.Variant, null, null); + break; + case "outlier_detection": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis)}'."); } writer.WriteEndObject(); } } -public sealed partial class DataframeAnalysisDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisConverter))] +public sealed partial class DataframeAnalysis { - internal DataframeAnalysisDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public DataframeAnalysis() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeAnalysis() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public DataframeAnalysisDescriptor() : base() + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection? OutlierDetection { get => GetVariant("outlier_detection"); set => SetVariant("outlier_detection", value); } + + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis { OutlierDetection = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis { Regression = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} - private DataframeAnalysisDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +public readonly partial struct DataframeAnalysisDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private DataframeAnalysisDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataframeAnalysisDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification dataframeAnalysisClassification) => Set(dataframeAnalysisClassification, "classification"); - public DataframeAnalysisDescriptor Classification(Action> configure) => Set(configure, "classification"); - public DataframeAnalysisDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection dataframeAnalysisOutlierDetection) => Set(dataframeAnalysisOutlierDetection, "outlier_detection"); - public DataframeAnalysisDescriptor OutlierDetection(Action configure) => Set(configure, "outlier_detection"); - public DataframeAnalysisDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression dataframeAnalysisRegression) => Set(dataframeAnalysisRegression, "regression"); - public DataframeAnalysisDescriptor Regression(Action> configure) => Set(configure, "regression"); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Classification(System.Action> action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection? value) + { + Instance.OutlierDetection = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection() + { + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor.Build(null); + return this; + } + + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection(System.Action? action) + { + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Regression(System.Action> action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisDescriptor { - internal DataframeAnalysisDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) => descriptor.Instance; - public DataframeAnalysisDescriptor() : base() + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification? value) { + Instance.Classification = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Classification(System.Action action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor.Build(action); + return this; + } - private DataframeAnalysisDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// The configuration information necessary to perform classification. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Classification(System.Action> action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor.Build(action); + return this; } - private DataframeAnalysisDescriptor Set(object variant, string variantName) + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.OutlierDetection = value; + return this; } - public DataframeAnalysisDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification dataframeAnalysisClassification) => Set(dataframeAnalysisClassification, "classification"); - public DataframeAnalysisDescriptor Classification(Action configure) => Set(configure, "classification"); - public DataframeAnalysisDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection dataframeAnalysisOutlierDetection) => Set(dataframeAnalysisOutlierDetection, "outlier_detection"); - public DataframeAnalysisDescriptor OutlierDetection(Action configure) => Set(configure, "outlier_detection"); - public DataframeAnalysisDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression dataframeAnalysisRegression) => Set(dataframeAnalysisRegression, "regression"); - public DataframeAnalysisDescriptor Regression(Action configure) => Set(configure, "regression"); + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection() + { + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor.Build(null); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The configuration information necessary to perform outlier detection. NOTE: Advanced parameters are for fine-tuning classification analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor OutlierDetection(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression? value) + { + Instance.Regression = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Regression(System.Action action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform regression. NOTE: Advanced parameters are for fine-tuning regression analysis. They are set automatically by hyperparameter optimization to give the minimum validation error. It is highly recommended to use the default values unless you fully understand the function of these parameters. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor Regression(System.Action> action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisAnalyzedFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisAnalyzedFields.g.cs index 0ceb9b0f4e9..321ef230cea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisAnalyzedFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisAnalyzedFields.g.cs @@ -17,55 +17,142 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisAnalyzedFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExcludes = System.Text.Json.JsonEncodedText.Encode("excludes"); + private static readonly System.Text.Json.JsonEncodedText PropIncludes = System.Text.Json.JsonEncodedText.Encode("includes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue?>(options, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Includes = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propExcludes = default; + LocalJsonValue?> propIncludes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExcludes.TryReadProperty(ref reader, options, PropExcludes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIncludes.TryReadProperty(ref reader, options, PropIncludes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Excludes = propExcludes.Value, + Includes = propIncludes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExcludes, value.Excludes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIncludes, value.Includes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsConverter))] public sealed partial class DataframeAnalysisAnalyzedFields { +#if NET7_0_OR_GREATER + public DataframeAnalysisAnalyzedFields() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeAnalysisAnalyzedFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of strings that defines the fields that will be included in the analysis. /// /// - [JsonInclude, JsonPropertyName("excludes")] - public ICollection Excludes { get; set; } + public System.Collections.Generic.ICollection? Excludes { get; set; } /// /// /// An array of strings that defines the fields that will be excluded from the analysis. You do not need to add fields with unsupported data types to excludes, these fields are excluded from the analysis automatically. /// /// - [JsonInclude, JsonPropertyName("includes")] - public ICollection Includes { get; set; } + public System.Collections.Generic.ICollection? Includes { get; set; } } -public sealed partial class DataframeAnalysisAnalyzedFieldsDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisAnalyzedFieldsDescriptor { - internal DataframeAnalysisAnalyzedFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisAnalyzedFieldsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields instance) + { + Instance = instance; + } - public DataframeAnalysisAnalyzedFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisAnalyzedFieldsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection ExcludesValue { get; set; } - private ICollection IncludesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// An array of strings that defines the fields that will be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor Excludes(System.Collections.Generic.ICollection? value) + { + Instance.Excludes = value; + return this; + } /// /// /// An array of strings that defines the fields that will be included in the analysis. /// /// - public DataframeAnalysisAnalyzedFieldsDescriptor Excludes(ICollection excludes) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor Excludes(params string[] values) { - ExcludesValue = excludes; - return Self; + Instance.Excludes = [.. values]; + return this; } /// @@ -73,19 +160,33 @@ public DataframeAnalysisAnalyzedFieldsDescriptor Excludes(ICollection ex /// An array of strings that defines the fields that will be excluded from the analysis. You do not need to add fields with unsupported data types to excludes, these fields are excluded from the analysis automatically. /// /// - public DataframeAnalysisAnalyzedFieldsDescriptor Includes(ICollection includes) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor Includes(System.Collections.Generic.ICollection? value) { - IncludesValue = includes; - return Self; + Instance.Includes = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of strings that defines the fields that will be excluded from the analysis. You do not need to add fields with unsupported data types to excludes, these fields are excluded from the analysis automatically. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor Includes(params string[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("excludes"); - JsonSerializer.Serialize(writer, ExcludesValue, options); - writer.WritePropertyName("includes"); - JsonSerializer.Serialize(writer, IncludesValue, options); - writer.WriteEndObject(); + Instance.Includes = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisClassification.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisClassification.g.cs index 06504695f4c..ed1b036a2f7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisClassification.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisClassification.g.cs @@ -17,279 +17,248 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -internal sealed partial class DataframeAnalysisClassificationConverter : JsonConverter +internal sealed partial class DataframeAnalysisClassificationConverter : System.Text.Json.Serialization.JsonConverter { - public override DataframeAnalysisClassification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new DataframeAnalysisClassification(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + private static readonly System.Text.Json.JsonEncodedText PropAlpha = System.Text.Json.JsonEncodedText.Encode("alpha"); + private static readonly System.Text.Json.JsonEncodedText PropClassAssignmentObjective = System.Text.Json.JsonEncodedText.Encode("class_assignment_objective"); + private static readonly System.Text.Json.JsonEncodedText PropDependentVariable = System.Text.Json.JsonEncodedText.Encode("dependent_variable"); + private static readonly System.Text.Json.JsonEncodedText PropDownsampleFactor = System.Text.Json.JsonEncodedText.Encode("downsample_factor"); + private static readonly System.Text.Json.JsonEncodedText PropEarlyStoppingEnabled = System.Text.Json.JsonEncodedText.Encode("early_stopping_enabled"); + private static readonly System.Text.Json.JsonEncodedText PropEta = System.Text.Json.JsonEncodedText.Encode("eta"); + private static readonly System.Text.Json.JsonEncodedText PropEtaGrowthRatePerTree = System.Text.Json.JsonEncodedText.Encode("eta_growth_rate_per_tree"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureBagFraction = System.Text.Json.JsonEncodedText.Encode("feature_bag_fraction"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureProcessors = System.Text.Json.JsonEncodedText.Encode("feature_processors"); + private static readonly System.Text.Json.JsonEncodedText PropGamma = System.Text.Json.JsonEncodedText.Encode("gamma"); + private static readonly System.Text.Json.JsonEncodedText PropLambda = System.Text.Json.JsonEncodedText.Encode("lambda"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOptimizationRoundsPerHyperparameter = System.Text.Json.JsonEncodedText.Encode("max_optimization_rounds_per_hyperparameter"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTrees = System.Text.Json.JsonEncodedText.Encode("max_trees"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTrees1 = System.Text.Json.JsonEncodedText.Encode("maximum_number_trees"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionFieldName = System.Text.Json.JsonEncodedText.Encode("prediction_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropRandomizeSeed = System.Text.Json.JsonEncodedText.Encode("randomize_seed"); + private static readonly System.Text.Json.JsonEncodedText PropSoftTreeDepthLimit = System.Text.Json.JsonEncodedText.Encode("soft_tree_depth_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSoftTreeDepthTolerance = System.Text.Json.JsonEncodedText.Encode("soft_tree_depth_tolerance"); + private static readonly System.Text.Json.JsonEncodedText PropTrainingPercent = System.Text.Json.JsonEncodedText.Encode("training_percent"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlpha = default; + LocalJsonValue propClassAssignmentObjective = default; + LocalJsonValue propDependentVariable = default; + LocalJsonValue propDownsampleFactor = default; + LocalJsonValue propEarlyStoppingEnabled = default; + LocalJsonValue propEta = default; + LocalJsonValue propEtaGrowthRatePerTree = default; + LocalJsonValue propFeatureBagFraction = default; + LocalJsonValue?> propFeatureProcessors = default; + LocalJsonValue propGamma = default; + LocalJsonValue propLambda = default; + LocalJsonValue propMaxOptimizationRoundsPerHyperparameter = default; + LocalJsonValue propMaxTrees = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propPredictionFieldName = default; + LocalJsonValue propRandomizeSeed = default; + LocalJsonValue propSoftTreeDepthLimit = default; + LocalJsonValue propSoftTreeDepthTolerance = default; + LocalJsonValue propTrainingPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlpha.TryReadProperty(ref reader, options, PropAlpha, null)) { - var property = reader.GetString(); - if (property == "alpha") - { - variant.Alpha = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "class_assignment_objective") - { - variant.ClassAssignmentObjective = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "dependent_variable") - { - variant.DependentVariable = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "downsample_factor") - { - variant.DownsampleFactor = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "early_stopping_enabled") - { - variant.EarlyStoppingEnabled = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "eta") - { - variant.Eta = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "eta_growth_rate_per_tree") - { - variant.EtaGrowthRatePerTree = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "feature_bag_fraction") - { - variant.FeatureBagFraction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "feature_processors") - { - variant.FeatureProcessors = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "gamma") - { - variant.Gamma = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lambda") - { - variant.Lambda = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_optimization_rounds_per_hyperparameter") - { - variant.MaxOptimizationRoundsPerHyperparameter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_trees" || property == "maximum_number_trees") - { - variant.MaxTrees = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "num_top_classes") - { - variant.NumTopClasses = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "num_top_feature_importance_values") - { - variant.NumTopFeatureImportanceValues = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "prediction_field_name") - { - variant.PredictionFieldName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "randomize_seed") - { - variant.RandomizeSeed = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "soft_tree_depth_limit") - { - variant.SoftTreeDepthLimit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "soft_tree_depth_tolerance") - { - variant.SoftTreeDepthTolerance = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "training_percent") - { - variant.TrainingPercent = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propClassAssignmentObjective.TryReadProperty(ref reader, options, PropClassAssignmentObjective, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, DataframeAnalysisClassification value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Alpha.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(value.Alpha.Value); - } + if (propDependentVariable.TryReadProperty(ref reader, options, PropDependentVariable, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.ClassAssignmentObjective)) - { - writer.WritePropertyName("class_assignment_objective"); - writer.WriteStringValue(value.ClassAssignmentObjective); - } + if (propDownsampleFactor.TryReadProperty(ref reader, options, PropDownsampleFactor, null)) + { + continue; + } - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(value.DependentVariable); - if (value.DownsampleFactor.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(value.DownsampleFactor.Value); - } + if (propEarlyStoppingEnabled.TryReadProperty(ref reader, options, PropEarlyStoppingEnabled, null)) + { + continue; + } - if (value.EarlyStoppingEnabled.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(value.EarlyStoppingEnabled.Value); - } + if (propEta.TryReadProperty(ref reader, options, PropEta, null)) + { + continue; + } - if (value.Eta.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(value.Eta.Value); - } + if (propEtaGrowthRatePerTree.TryReadProperty(ref reader, options, PropEtaGrowthRatePerTree, null)) + { + continue; + } - if (value.EtaGrowthRatePerTree.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(value.EtaGrowthRatePerTree.Value); - } + if (propFeatureBagFraction.TryReadProperty(ref reader, options, PropFeatureBagFraction, null)) + { + continue; + } - if (value.FeatureBagFraction.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(value.FeatureBagFraction.Value); - } + if (propFeatureProcessors.TryReadProperty(ref reader, options, PropFeatureProcessors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.FeatureProcessors is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, value.FeatureProcessors, options); - } + if (propGamma.TryReadProperty(ref reader, options, PropGamma, null)) + { + continue; + } - if (value.Gamma.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(value.Gamma.Value); - } + if (propLambda.TryReadProperty(ref reader, options, PropLambda, null)) + { + continue; + } - if (value.Lambda.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(value.Lambda.Value); - } + if (propMaxOptimizationRoundsPerHyperparameter.TryReadProperty(ref reader, options, PropMaxOptimizationRoundsPerHyperparameter, null)) + { + continue; + } - if (value.MaxOptimizationRoundsPerHyperparameter.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(value.MaxOptimizationRoundsPerHyperparameter.Value); - } + if (propMaxTrees.TryReadProperty(ref reader, options, PropMaxTrees, null) || propMaxTrees.TryReadProperty(ref reader, options, PropMaxTrees1, null)) + { + continue; + } - if (value.MaxTrees.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(value.MaxTrees.Value); - } + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } - if (value.NumTopClasses.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(value.NumTopClasses.Value); - } + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } - if (value.NumTopFeatureImportanceValues.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(value.NumTopFeatureImportanceValues.Value); - } + if (propPredictionFieldName.TryReadProperty(ref reader, options, PropPredictionFieldName, null)) + { + continue; + } - if (value.PredictionFieldName is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, value.PredictionFieldName, options); - } + if (propRandomizeSeed.TryReadProperty(ref reader, options, PropRandomizeSeed, null)) + { + continue; + } - if (value.RandomizeSeed.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(value.RandomizeSeed.Value); - } + if (propSoftTreeDepthLimit.TryReadProperty(ref reader, options, PropSoftTreeDepthLimit, null)) + { + continue; + } - if (value.SoftTreeDepthLimit.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(value.SoftTreeDepthLimit.Value); - } + if (propSoftTreeDepthTolerance.TryReadProperty(ref reader, options, PropSoftTreeDepthTolerance, null)) + { + continue; + } - if (value.SoftTreeDepthTolerance.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(value.SoftTreeDepthTolerance.Value); - } + if (propTrainingPercent.TryReadProperty(ref reader, options, PropTrainingPercent, null)) + { + continue; + } - if (value.TrainingPercent.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(value.TrainingPercent.Value); - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alpha = propAlpha.Value, + ClassAssignmentObjective = propClassAssignmentObjective.Value, + DependentVariable = propDependentVariable.Value, + DownsampleFactor = propDownsampleFactor.Value, + EarlyStoppingEnabled = propEarlyStoppingEnabled.Value, + Eta = propEta.Value, + EtaGrowthRatePerTree = propEtaGrowthRatePerTree.Value, + FeatureBagFraction = propFeatureBagFraction.Value, + FeatureProcessors = propFeatureProcessors.Value, + Gamma = propGamma.Value, + Lambda = propLambda.Value, + MaxOptimizationRoundsPerHyperparameter = propMaxOptimizationRoundsPerHyperparameter.Value, + MaxTrees = propMaxTrees.Value, + NumTopClasses = propNumTopClasses.Value, + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + PredictionFieldName = propPredictionFieldName.Value, + RandomizeSeed = propRandomizeSeed.Value, + SoftTreeDepthLimit = propSoftTreeDepthLimit.Value, + SoftTreeDepthTolerance = propSoftTreeDepthTolerance.Value, + TrainingPercent = propTrainingPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlpha, value.Alpha, null, null); + writer.WriteProperty(options, PropClassAssignmentObjective, value.ClassAssignmentObjective, null, null); + writer.WriteProperty(options, PropDependentVariable, value.DependentVariable, null, null); + writer.WriteProperty(options, PropDownsampleFactor, value.DownsampleFactor, null, null); + writer.WriteProperty(options, PropEarlyStoppingEnabled, value.EarlyStoppingEnabled, null, null); + writer.WriteProperty(options, PropEta, value.Eta, null, null); + writer.WriteProperty(options, PropEtaGrowthRatePerTree, value.EtaGrowthRatePerTree, null, null); + writer.WriteProperty(options, PropFeatureBagFraction, value.FeatureBagFraction, null, null); + writer.WriteProperty(options, PropFeatureProcessors, value.FeatureProcessors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropGamma, value.Gamma, null, null); + writer.WriteProperty(options, PropLambda, value.Lambda, null, null); + writer.WriteProperty(options, PropMaxOptimizationRoundsPerHyperparameter, value.MaxOptimizationRoundsPerHyperparameter, null, null); + writer.WriteProperty(options, PropMaxTrees, value.MaxTrees, null, null); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropPredictionFieldName, value.PredictionFieldName, null, null); + writer.WriteProperty(options, PropRandomizeSeed, value.RandomizeSeed, null, null); + writer.WriteProperty(options, PropSoftTreeDepthLimit, value.SoftTreeDepthLimit, null, null); + writer.WriteProperty(options, PropSoftTreeDepthTolerance, value.SoftTreeDepthTolerance, null, null); + writer.WriteProperty(options, PropTrainingPercent, value.TrainingPercent, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(DataframeAnalysisClassificationConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationConverter))] public sealed partial class DataframeAnalysisClassification { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisClassification(string dependentVariable) + { + DependentVariable = dependentVariable; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisClassification() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisClassification() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. @@ -305,7 +274,11 @@ public sealed partial class DataframeAnalysisClassification /// For regression analysis, the data type of the field must be numeric. /// /// - public string DependentVariable { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DependentVariable { get; set; } /// /// @@ -347,7 +320,7 @@ public sealed partial class DataframeAnalysisClassification /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public ICollection? FeatureProcessors { get; set; } + public System.Collections.Generic.ICollection? FeatureProcessors { get; set; } /// /// @@ -424,58 +397,43 @@ public sealed partial class DataframeAnalysisClassification /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public double? TrainingPercent { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(DataframeAnalysisClassification dataframeAnalysisClassification) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis.Classification(dataframeAnalysisClassification); + public Elastic.Clients.Elasticsearch.Percentage? TrainingPercent { get; set; } } -public sealed partial class DataframeAnalysisClassificationDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisClassificationDescriptor { - internal DataframeAnalysisClassificationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification instance) + { + Instance = instance; + } - public DataframeAnalysisClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisClassificationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? AlphaValue { get; set; } - private string? ClassAssignmentObjectiveValue { get; set; } - private string DependentVariableValue { get; set; } - private double? DownsampleFactorValue { get; set; } - private bool? EarlyStoppingEnabledValue { get; set; } - private double? EtaValue { get; set; } - private double? EtaGrowthRatePerTreeValue { get; set; } - private double? FeatureBagFractionValue { get; set; } - private ICollection? FeatureProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FeatureProcessorsDescriptor { get; set; } - private Action> FeatureProcessorsDescriptorAction { get; set; } - private Action>[] FeatureProcessorsDescriptorActions { get; set; } - private double? GammaValue { get; set; } - private double? LambdaValue { get; set; } - private int? MaxOptimizationRoundsPerHyperparameterValue { get; set; } - private int? MaxTreesValue { get; set; } - private int? NumTopClassesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictionFieldNameValue { get; set; } - private double? RandomizeSeedValue { get; set; } - private int? SoftTreeDepthLimitValue { get; set; } - private double? SoftTreeDepthToleranceValue { get; set; } - private double? TrainingPercentValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor descriptor) => descriptor.Instance; /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. /// /// - public DataframeAnalysisClassificationDescriptor Alpha(double? alpha) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Alpha(double? value) { - AlphaValue = alpha; - return Self; + Instance.Alpha = value; + return this; } - public DataframeAnalysisClassificationDescriptor ClassAssignmentObjective(string? classAssignmentObjective) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor ClassAssignmentObjective(string? value) { - ClassAssignmentObjectiveValue = classAssignmentObjective; - return Self; + Instance.ClassAssignmentObjective = value; + return this; } /// @@ -485,10 +443,10 @@ public DataframeAnalysisClassificationDescriptor ClassAssignmentObjec /// For regression analysis, the data type of the field must be numeric. /// /// - public DataframeAnalysisClassificationDescriptor DependentVariable(string dependentVariable) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor DependentVariable(string value) { - DependentVariableValue = dependentVariable; - return Self; + Instance.DependentVariable = value; + return this; } /// @@ -496,10 +454,10 @@ public DataframeAnalysisClassificationDescriptor DependentVariable(st /// Advanced configuration option. Controls the fraction of data that is used to compute the derivatives of the loss function for tree training. A small value results in the use of a small fraction of the data. If this value is set to be less than 1, accuracy typically improves. However, too small a value may result in poor convergence for the ensemble and so require more trees. By default, this value is calculated during hyperparameter optimization. It must be greater than zero and less than or equal to 1. /// /// - public DataframeAnalysisClassificationDescriptor DownsampleFactor(double? downsampleFactor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor DownsampleFactor(double? value) { - DownsampleFactorValue = downsampleFactor; - return Self; + Instance.DownsampleFactor = value; + return this; } /// @@ -507,10 +465,10 @@ public DataframeAnalysisClassificationDescriptor DownsampleFactor(dou /// Advanced configuration option. Specifies whether the training process should finish if it is not finding any better performing models. If disabled, the training process can take significantly longer and the chance of finding a better performing model is unremarkable. /// /// - public DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled(bool? earlyStoppingEnabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled(bool? value = true) { - EarlyStoppingEnabledValue = earlyStoppingEnabled; - return Self; + Instance.EarlyStoppingEnabled = value; + return this; } /// @@ -518,10 +476,10 @@ public DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled /// Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, larger forests cause slower training. By default, this value is calculated during hyperparameter optimization. It must be a value between 0.001 and 1. /// /// - public DataframeAnalysisClassificationDescriptor Eta(double? eta) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Eta(double? value) { - EtaValue = eta; - return Self; + Instance.Eta = value; + return this; } /// @@ -529,10 +487,10 @@ public DataframeAnalysisClassificationDescriptor Eta(double? eta) /// Advanced configuration option. Specifies the rate at which eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5% for each extra tree. By default, this value is calculated during hyperparameter optimization. It must be between 0.5 and 2. /// /// - public DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree(double? etaGrowthRatePerTree) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree(double? value) { - EtaGrowthRatePerTreeValue = etaGrowthRatePerTree; - return Self; + Instance.EtaGrowthRatePerTree = value; + return this; } /// @@ -540,10 +498,10 @@ public DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree /// Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor FeatureBagFraction(double? featureBagFraction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureBagFraction(double? value) { - FeatureBagFractionValue = featureBagFraction; - return Self; + Instance.FeatureBagFraction = value; + return this; } /// @@ -551,40 +509,38 @@ public DataframeAnalysisClassificationDescriptor FeatureBagFraction(d /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public DataframeAnalysisClassificationDescriptor FeatureProcessors(ICollection? featureProcessors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(System.Collections.Generic.ICollection? value) { - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsValue = featureProcessors; - return Self; + Instance.FeatureProcessors = value; + return this; } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(params Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor[] values) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptor = descriptor; - return Self; + Instance.FeatureProcessors = [.. values]; + return this; } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(Action> configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(params System.Action>[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(params Action>[] configure) - { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = configure; - return Self; + Instance.FeatureProcessors = items; + return this; } /// @@ -592,10 +548,10 @@ public DataframeAnalysisClassificationDescriptor FeatureProcessors(pa /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies a linear penalty associated with the size of individual trees in the forest. A high gamma value causes training to prefer small trees. A small gamma value results in larger individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisClassificationDescriptor Gamma(double? gamma) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Gamma(double? value) { - GammaValue = gamma; - return Self; + Instance.Gamma = value; + return this; } /// @@ -603,10 +559,10 @@ public DataframeAnalysisClassificationDescriptor Gamma(double? gamma) /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularization term which applies to leaf weights of the individual trees in the forest. A high lambda value causes training to favor small leaf weights. This behavior makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. A small lambda value results in large individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisClassificationDescriptor Lambda(double? lambda) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Lambda(double? value) { - LambdaValue = lambda; - return Self; + Instance.Lambda = value; + return this; } /// @@ -614,10 +570,10 @@ public DataframeAnalysisClassificationDescriptor Lambda(double? lambd /// Advanced configuration option. A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor MaxOptimizationRoundsPerHyperparameter(int? maxOptimizationRoundsPerHyperparameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor MaxOptimizationRoundsPerHyperparameter(int? value) { - MaxOptimizationRoundsPerHyperparameterValue = maxOptimizationRoundsPerHyperparameter; - return Self; + Instance.MaxOptimizationRoundsPerHyperparameter = value; + return this; } /// @@ -625,10 +581,10 @@ public DataframeAnalysisClassificationDescriptor MaxOptimizationRound /// Advanced configuration option. Defines the maximum number of decision trees in the forest. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor MaxTrees(int? maxTrees) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor MaxTrees(int? value) { - MaxTreesValue = maxTrees; - return Self; + Instance.MaxTrees = value; + return this; } /// @@ -636,10 +592,10 @@ public DataframeAnalysisClassificationDescriptor MaxTrees(int? maxTre /// Defines the number of categories for which the predicted probabilities are reported. It must be non-negative or -1. If it is -1 or greater than the total number of categories, probabilities are reported for all categories; if you have a large number of categories, there could be a significant effect on the size of your destination index. NOTE: To use the AUC ROC evaluation method, num_top_classes must be set to -1 or a value greater than or equal to the total number of categories. /// /// - public DataframeAnalysisClassificationDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -647,10 +603,10 @@ public DataframeAnalysisClassificationDescriptor NumTopClasses(int? n /// Advanced configuration option. Specifies the maximum number of feature importance values per document to return. By default, no feature importance calculation occurs. /// /// - public DataframeAnalysisClassificationDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -658,10 +614,10 @@ public DataframeAnalysisClassificationDescriptor NumTopFeatureImporta /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// @@ -669,54 +625,54 @@ public DataframeAnalysisClassificationDescriptor PredictionFieldName( /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor PredictionFieldName(System.Linq.Expressions.Expression> value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// /// - /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. + /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor RandomizeSeed(double? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.RandomizeSeed = value; + return this; } /// /// - /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). + /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. /// /// - public DataframeAnalysisClassificationDescriptor RandomizeSeed(double? randomizeSeed) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor SoftTreeDepthLimit(int? value) { - RandomizeSeedValue = randomizeSeed; - return Self; + Instance.SoftTreeDepthLimit = value; + return this; } /// /// - /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. + /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. /// /// - public DataframeAnalysisClassificationDescriptor SoftTreeDepthLimit(int? softTreeDepthLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor SoftTreeDepthTolerance(double? value) { - SoftTreeDepthLimitValue = softTreeDepthLimit; - return Self; + Instance.SoftTreeDepthTolerance = value; + return this; } /// /// - /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. + /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisClassificationDescriptor SoftTreeDepthTolerance(double? softTreeDepthTolerance) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor TrainingPercent(Elastic.Clients.Elasticsearch.Percentage? value) { - SoftTreeDepthToleranceValue = softTreeDepthTolerance; - return Self; + Instance.TrainingPercent = value; + return this; } /// @@ -724,207 +680,55 @@ public DataframeAnalysisClassificationDescriptor SoftTreeDepthToleran /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisClassificationDescriptor TrainingPercent(double? trainingPercent) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor TrainingPercent(System.Func action) { - TrainingPercentValue = trainingPercent; - return Self; + Instance.TrainingPercent = Elastic.Clients.Elasticsearch.PercentageFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification Build(System.Action> action) { - writer.WriteStartObject(); - if (AlphaValue.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(AlphaValue.Value); - } - - if (!string.IsNullOrEmpty(ClassAssignmentObjectiveValue)) - { - writer.WritePropertyName("class_assignment_objective"); - writer.WriteStringValue(ClassAssignmentObjectiveValue); - } - - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(DependentVariableValue); - if (DownsampleFactorValue.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(DownsampleFactorValue.Value); - } - - if (EarlyStoppingEnabledValue.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(EarlyStoppingEnabledValue.Value); - } - - if (EtaValue.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(EtaValue.Value); - } - - if (EtaGrowthRatePerTreeValue.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(EtaGrowthRatePerTreeValue.Value); - } - - if (FeatureBagFractionValue.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(FeatureBagFractionValue.Value); - } - - if (FeatureProcessorsDescriptor is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FeatureProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(FeatureProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - foreach (var action in FeatureProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FeatureProcessorsValue is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, FeatureProcessorsValue, options); - } - - if (GammaValue.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(GammaValue.Value); - } - - if (LambdaValue.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(LambdaValue.Value); - } - - if (MaxOptimizationRoundsPerHyperparameterValue.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(MaxOptimizationRoundsPerHyperparameterValue.Value); - } - - if (MaxTreesValue.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(MaxTreesValue.Value); - } - - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (PredictionFieldNameValue is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, PredictionFieldNameValue, options); - } - - if (RandomizeSeedValue.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(RandomizeSeedValue.Value); - } - - if (SoftTreeDepthLimitValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(SoftTreeDepthLimitValue.Value); - } - - if (SoftTreeDepthToleranceValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(SoftTreeDepthToleranceValue.Value); - } - - if (TrainingPercentValue.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(TrainingPercentValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisClassificationDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisClassificationDescriptor { - internal DataframeAnalysisClassificationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification instance) + { + Instance = instance; + } - public DataframeAnalysisClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisClassificationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? AlphaValue { get; set; } - private string? ClassAssignmentObjectiveValue { get; set; } - private string DependentVariableValue { get; set; } - private double? DownsampleFactorValue { get; set; } - private bool? EarlyStoppingEnabledValue { get; set; } - private double? EtaValue { get; set; } - private double? EtaGrowthRatePerTreeValue { get; set; } - private double? FeatureBagFractionValue { get; set; } - private ICollection? FeatureProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FeatureProcessorsDescriptor { get; set; } - private Action FeatureProcessorsDescriptorAction { get; set; } - private Action[] FeatureProcessorsDescriptorActions { get; set; } - private double? GammaValue { get; set; } - private double? LambdaValue { get; set; } - private int? MaxOptimizationRoundsPerHyperparameterValue { get; set; } - private int? MaxTreesValue { get; set; } - private int? NumTopClassesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictionFieldNameValue { get; set; } - private double? RandomizeSeedValue { get; set; } - private int? SoftTreeDepthLimitValue { get; set; } - private double? SoftTreeDepthToleranceValue { get; set; } - private double? TrainingPercentValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor descriptor) => descriptor.Instance; /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. /// /// - public DataframeAnalysisClassificationDescriptor Alpha(double? alpha) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Alpha(double? value) { - AlphaValue = alpha; - return Self; + Instance.Alpha = value; + return this; } - public DataframeAnalysisClassificationDescriptor ClassAssignmentObjective(string? classAssignmentObjective) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor ClassAssignmentObjective(string? value) { - ClassAssignmentObjectiveValue = classAssignmentObjective; - return Self; + Instance.ClassAssignmentObjective = value; + return this; } /// @@ -934,10 +738,10 @@ public DataframeAnalysisClassificationDescriptor ClassAssignmentObjective(string /// For regression analysis, the data type of the field must be numeric. /// /// - public DataframeAnalysisClassificationDescriptor DependentVariable(string dependentVariable) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor DependentVariable(string value) { - DependentVariableValue = dependentVariable; - return Self; + Instance.DependentVariable = value; + return this; } /// @@ -945,10 +749,10 @@ public DataframeAnalysisClassificationDescriptor DependentVariable(string depend /// Advanced configuration option. Controls the fraction of data that is used to compute the derivatives of the loss function for tree training. A small value results in the use of a small fraction of the data. If this value is set to be less than 1, accuracy typically improves. However, too small a value may result in poor convergence for the ensemble and so require more trees. By default, this value is calculated during hyperparameter optimization. It must be greater than zero and less than or equal to 1. /// /// - public DataframeAnalysisClassificationDescriptor DownsampleFactor(double? downsampleFactor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor DownsampleFactor(double? value) { - DownsampleFactorValue = downsampleFactor; - return Self; + Instance.DownsampleFactor = value; + return this; } /// @@ -956,10 +760,10 @@ public DataframeAnalysisClassificationDescriptor DownsampleFactor(double? downsa /// Advanced configuration option. Specifies whether the training process should finish if it is not finding any better performing models. If disabled, the training process can take significantly longer and the chance of finding a better performing model is unremarkable. /// /// - public DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled(bool? earlyStoppingEnabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled(bool? value = true) { - EarlyStoppingEnabledValue = earlyStoppingEnabled; - return Self; + Instance.EarlyStoppingEnabled = value; + return this; } /// @@ -967,10 +771,10 @@ public DataframeAnalysisClassificationDescriptor EarlyStoppingEnabled(bool? earl /// Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, larger forests cause slower training. By default, this value is calculated during hyperparameter optimization. It must be a value between 0.001 and 1. /// /// - public DataframeAnalysisClassificationDescriptor Eta(double? eta) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Eta(double? value) { - EtaValue = eta; - return Self; + Instance.Eta = value; + return this; } /// @@ -978,10 +782,10 @@ public DataframeAnalysisClassificationDescriptor Eta(double? eta) /// Advanced configuration option. Specifies the rate at which eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5% for each extra tree. By default, this value is calculated during hyperparameter optimization. It must be between 0.5 and 2. /// /// - public DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree(double? etaGrowthRatePerTree) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree(double? value) { - EtaGrowthRatePerTreeValue = etaGrowthRatePerTree; - return Self; + Instance.EtaGrowthRatePerTree = value; + return this; } /// @@ -989,10 +793,10 @@ public DataframeAnalysisClassificationDescriptor EtaGrowthRatePerTree(double? et /// Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor FeatureBagFraction(double? featureBagFraction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureBagFraction(double? value) { - FeatureBagFractionValue = featureBagFraction; - return Self; + Instance.FeatureBagFraction = value; + return this; } /// @@ -1000,40 +804,55 @@ public DataframeAnalysisClassificationDescriptor FeatureBagFraction(double? feat /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public DataframeAnalysisClassificationDescriptor FeatureProcessors(ICollection? featureProcessors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(System.Collections.Generic.ICollection? value) { - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsValue = featureProcessors; - return Self; + Instance.FeatureProcessors = value; + return this; } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(params Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor[] values) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptor = descriptor; - return Self; + Instance.FeatureProcessors = [.. values]; + return this; } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(Action configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(params System.Action[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } + + Instance.FeatureProcessors = items; + return this; } - public DataframeAnalysisClassificationDescriptor FeatureProcessors(params Action[] configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor FeatureProcessors(params System.Action>[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } + + Instance.FeatureProcessors = items; + return this; } /// @@ -1041,10 +860,10 @@ public DataframeAnalysisClassificationDescriptor FeatureProcessors(params Action /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies a linear penalty associated with the size of individual trees in the forest. A high gamma value causes training to prefer small trees. A small gamma value results in larger individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisClassificationDescriptor Gamma(double? gamma) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Gamma(double? value) { - GammaValue = gamma; - return Self; + Instance.Gamma = value; + return this; } /// @@ -1052,10 +871,10 @@ public DataframeAnalysisClassificationDescriptor Gamma(double? gamma) /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularization term which applies to leaf weights of the individual trees in the forest. A high lambda value causes training to favor small leaf weights. This behavior makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. A small lambda value results in large individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisClassificationDescriptor Lambda(double? lambda) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor Lambda(double? value) { - LambdaValue = lambda; - return Self; + Instance.Lambda = value; + return this; } /// @@ -1063,10 +882,10 @@ public DataframeAnalysisClassificationDescriptor Lambda(double? lambda) /// Advanced configuration option. A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor MaxOptimizationRoundsPerHyperparameter(int? maxOptimizationRoundsPerHyperparameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor MaxOptimizationRoundsPerHyperparameter(int? value) { - MaxOptimizationRoundsPerHyperparameterValue = maxOptimizationRoundsPerHyperparameter; - return Self; + Instance.MaxOptimizationRoundsPerHyperparameter = value; + return this; } /// @@ -1074,10 +893,10 @@ public DataframeAnalysisClassificationDescriptor MaxOptimizationRoundsPerHyperpa /// Advanced configuration option. Defines the maximum number of decision trees in the forest. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisClassificationDescriptor MaxTrees(int? maxTrees) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor MaxTrees(int? value) { - MaxTreesValue = maxTrees; - return Self; + Instance.MaxTrees = value; + return this; } /// @@ -1085,10 +904,10 @@ public DataframeAnalysisClassificationDescriptor MaxTrees(int? maxTrees) /// Defines the number of categories for which the predicted probabilities are reported. It must be non-negative or -1. If it is -1 or greater than the total number of categories, probabilities are reported for all categories; if you have a large number of categories, there could be a significant effect on the size of your destination index. NOTE: To use the AUC ROC evaluation method, num_top_classes must be set to -1 or a value greater than or equal to the total number of categories. /// /// - public DataframeAnalysisClassificationDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -1096,10 +915,10 @@ public DataframeAnalysisClassificationDescriptor NumTopClasses(int? numTopClasse /// Advanced configuration option. Specifies the maximum number of feature importance values per document to return. By default, no feature importance calculation occurs. /// /// - public DataframeAnalysisClassificationDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -1107,10 +926,10 @@ public DataframeAnalysisClassificationDescriptor NumTopFeatureImportanceValues(i /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// @@ -1118,54 +937,54 @@ public DataframeAnalysisClassificationDescriptor PredictionFieldName(Elastic.Cli /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor PredictionFieldName(System.Linq.Expressions.Expression> value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// /// - /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. + /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). /// /// - public DataframeAnalysisClassificationDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor RandomizeSeed(double? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.RandomizeSeed = value; + return this; } /// /// - /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). + /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. /// /// - public DataframeAnalysisClassificationDescriptor RandomizeSeed(double? randomizeSeed) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor SoftTreeDepthLimit(int? value) { - RandomizeSeedValue = randomizeSeed; - return Self; + Instance.SoftTreeDepthLimit = value; + return this; } /// /// - /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. + /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. /// /// - public DataframeAnalysisClassificationDescriptor SoftTreeDepthLimit(int? softTreeDepthLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor SoftTreeDepthTolerance(double? value) { - SoftTreeDepthLimitValue = softTreeDepthLimit; - return Self; + Instance.SoftTreeDepthTolerance = value; + return this; } /// /// - /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. + /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisClassificationDescriptor SoftTreeDepthTolerance(double? softTreeDepthTolerance) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor TrainingPercent(Elastic.Clients.Elasticsearch.Percentage? value) { - SoftTreeDepthToleranceValue = softTreeDepthTolerance; - return Self; + Instance.TrainingPercent = value; + return this; } /// @@ -1173,156 +992,17 @@ public DataframeAnalysisClassificationDescriptor SoftTreeDepthTolerance(double? /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisClassificationDescriptor TrainingPercent(double? trainingPercent) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor TrainingPercent(System.Func action) { - TrainingPercentValue = trainingPercent; - return Self; + Instance.TrainingPercent = Elastic.Clients.Elasticsearch.PercentageFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification Build(System.Action action) { - writer.WriteStartObject(); - if (AlphaValue.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(AlphaValue.Value); - } - - if (!string.IsNullOrEmpty(ClassAssignmentObjectiveValue)) - { - writer.WritePropertyName("class_assignment_objective"); - writer.WriteStringValue(ClassAssignmentObjectiveValue); - } - - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(DependentVariableValue); - if (DownsampleFactorValue.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(DownsampleFactorValue.Value); - } - - if (EarlyStoppingEnabledValue.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(EarlyStoppingEnabledValue.Value); - } - - if (EtaValue.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(EtaValue.Value); - } - - if (EtaGrowthRatePerTreeValue.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(EtaGrowthRatePerTreeValue.Value); - } - - if (FeatureBagFractionValue.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(FeatureBagFractionValue.Value); - } - - if (FeatureProcessorsDescriptor is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FeatureProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(FeatureProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - foreach (var action in FeatureProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FeatureProcessorsValue is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, FeatureProcessorsValue, options); - } - - if (GammaValue.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(GammaValue.Value); - } - - if (LambdaValue.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(LambdaValue.Value); - } - - if (MaxOptimizationRoundsPerHyperparameterValue.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(MaxOptimizationRoundsPerHyperparameterValue.Value); - } - - if (MaxTreesValue.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(MaxTreesValue.Value); - } - - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (PredictionFieldNameValue is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, PredictionFieldNameValue, options); - } - - if (RandomizeSeedValue.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(RandomizeSeedValue.Value); - } - - if (SoftTreeDepthLimitValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(SoftTreeDepthLimitValue.Value); - } - - if (SoftTreeDepthToleranceValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(SoftTreeDepthToleranceValue.Value); - } - - if (TrainingPercentValue.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(TrainingPercentValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassificationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessor.g.cs index 68a0de314d1..5419a14eed3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessor.g.cs @@ -17,271 +17,511 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(DataframeAnalysisFeatureProcessorConverter))] -public sealed partial class DataframeAnalysisFeatureProcessor +internal sealed partial class DataframeAnalysisFeatureProcessorConverter : System.Text.Json.Serialization.JsonConverter { - internal DataframeAnalysisFeatureProcessor(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantFrequencyEncoding = System.Text.Json.JsonEncodedText.Encode("frequency_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantMultiEncoding = System.Text.Json.JsonEncodedText.Encode("multi_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantNGramEncoding = System.Text.Json.JsonEncodedText.Encode("n_gram_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantOneHotEncoding = System.Text.Json.JsonEncodedText.Encode("one_hot_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantTargetMeanEncoding = System.Text.Json.JsonEncodedText.Encode("target_mean_encoding"); - public static DataframeAnalysisFeatureProcessor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding dataframeAnalysisFeatureProcessorFrequencyEncoding) => new DataframeAnalysisFeatureProcessor("frequency_encoding", dataframeAnalysisFeatureProcessorFrequencyEncoding); - public static DataframeAnalysisFeatureProcessor MultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding dataframeAnalysisFeatureProcessorMultiEncoding) => new DataframeAnalysisFeatureProcessor("multi_encoding", dataframeAnalysisFeatureProcessorMultiEncoding); - public static DataframeAnalysisFeatureProcessor NGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding dataframeAnalysisFeatureProcessorNGramEncoding) => new DataframeAnalysisFeatureProcessor("n_gram_encoding", dataframeAnalysisFeatureProcessorNGramEncoding); - public static DataframeAnalysisFeatureProcessor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding dataframeAnalysisFeatureProcessorOneHotEncoding) => new DataframeAnalysisFeatureProcessor("one_hot_encoding", dataframeAnalysisFeatureProcessorOneHotEncoding); - public static DataframeAnalysisFeatureProcessor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding dataframeAnalysisFeatureProcessorTargetMeanEncoding) => new DataframeAnalysisFeatureProcessor("target_mean_encoding", dataframeAnalysisFeatureProcessorTargetMeanEncoding); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class DataframeAnalysisFeatureProcessorConverter : JsonConverter -{ - public override DataframeAnalysisFeatureProcessor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantFrequencyEncoding)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantFrequencyEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "frequency_encoding") + if (reader.ValueTextEquals(VariantMultiEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMultiEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "multi_encoding") + if (reader.ValueTextEquals(VariantNGramEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNGramEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "n_gram_encoding") + if (reader.ValueTextEquals(VariantOneHotEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantOneHotEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "one_hot_encoding") + if (reader.ValueTextEquals(VariantTargetMeanEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTargetMeanEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "target_mean_encoding") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DataframeAnalysisFeatureProcessor' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DataframeAnalysisFeatureProcessor(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, DataframeAnalysisFeatureProcessor value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "frequency_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding)value.Variant, options); - break; - case "multi_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding)value.Variant, options); - break; - case "n_gram_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding)value.Variant, options); - break; - case "one_hot_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding)value.Variant, options); - break; - case "target_mean_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding)value.Variant, options); - break; - } + case null: + break; + case "frequency_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding)value.Variant, null, null); + break; + case "multi_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding)value.Variant, null, null); + break; + case "n_gram_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding)value.Variant, null, null); + break; + case "one_hot_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding)value.Variant, null, null); + break; + case "target_mean_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor)}'."); } writer.WriteEndObject(); } } -public sealed partial class DataframeAnalysisFeatureProcessorDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorConverter))] +public sealed partial class DataframeAnalysisFeatureProcessor +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding? FrequencyEncoding { get => GetVariant("frequency_encoding"); set => SetVariant("frequency_encoding", value); } + + /// + /// + /// The configuration information necessary to perform multi encoding. It allows multiple processors to be changed together. This way the output of a processor can then be passed to another as an input. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding? MultiEncoding { get => GetVariant("multi_encoding"); set => SetVariant("multi_encoding", value); } + + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding? NGramEncoding { get => GetVariant("n_gram_encoding"); set => SetVariant("n_gram_encoding", value); } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding? OneHotEncoding { get => GetVariant("one_hot_encoding"); set => SetVariant("one_hot_encoding", value); } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding? TargetMeanEncoding { get => GetVariant("target_mean_encoding"); set => SetVariant("target_mean_encoding", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor { FrequencyEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor { MultiEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor { NGramEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor { OneHotEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor { TargetMeanEncoding = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} + +public readonly partial struct DataframeAnalysisFeatureProcessorDescriptor { - internal DataframeAnalysisFeatureProcessorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor Instance { get; init; } - public DataframeAnalysisFeatureProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private DataframeAnalysisFeatureProcessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.FrequencyEncoding = value; + return this; } - private DataframeAnalysisFeatureProcessorDescriptor Set(object variant, string variantName) + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(System.Action> action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.FrequencyEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor.Build(action); + return this; } - public DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding dataframeAnalysisFeatureProcessorFrequencyEncoding) => Set(dataframeAnalysisFeatureProcessorFrequencyEncoding, "frequency_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Action> configure) => Set(configure, "frequency_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding dataframeAnalysisFeatureProcessorMultiEncoding) => Set(dataframeAnalysisFeatureProcessorMultiEncoding, "multi_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Action configure) => Set(configure, "multi_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding dataframeAnalysisFeatureProcessorNGramEncoding) => Set(dataframeAnalysisFeatureProcessorNGramEncoding, "n_gram_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Action> configure) => Set(configure, "n_gram_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding dataframeAnalysisFeatureProcessorOneHotEncoding) => Set(dataframeAnalysisFeatureProcessorOneHotEncoding, "one_hot_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Action> configure) => Set(configure, "one_hot_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding dataframeAnalysisFeatureProcessorTargetMeanEncoding) => Set(dataframeAnalysisFeatureProcessorTargetMeanEncoding, "target_mean_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Action> configure) => Set(configure, "target_mean_encoding"); + /// + /// + /// The configuration information necessary to perform multi encoding. It allows multiple processors to be changed together. This way the output of a processor can then be passed to another as an input. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding? value) + { + Instance.MultiEncoding = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The configuration information necessary to perform multi encoding. It allows multiple processors to be changed together. This way the output of a processor can then be passed to another as an input. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.MultiEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding? value) + { + Instance.NGramEncoding = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(System.Action> action) + { + Instance.NGramEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding? value) + { + Instance.OneHotEncoding = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(System.Action> action) + { + Instance.OneHotEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding? value) + { + Instance.TargetMeanEncoding = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(System.Action> action) + { + Instance.TargetMeanEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisFeatureProcessorDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorDescriptor { - internal DataframeAnalysisFeatureProcessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor instance) + { + Instance = instance; + } - public DataframeAnalysisFeatureProcessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) => descriptor.Instance; - private DataframeAnalysisFeatureProcessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.FrequencyEncoding = value; + return this; } - private DataframeAnalysisFeatureProcessorDescriptor Set(object variant, string variantName) + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(System.Action action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.FrequencyEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor.Build(action); + return this; } - public DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding dataframeAnalysisFeatureProcessorFrequencyEncoding) => Set(dataframeAnalysisFeatureProcessorFrequencyEncoding, "frequency_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(Action configure) => Set(configure, "frequency_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding dataframeAnalysisFeatureProcessorMultiEncoding) => Set(dataframeAnalysisFeatureProcessorMultiEncoding, "multi_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Action configure) => Set(configure, "multi_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding dataframeAnalysisFeatureProcessorNGramEncoding) => Set(dataframeAnalysisFeatureProcessorNGramEncoding, "n_gram_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Action configure) => Set(configure, "n_gram_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding dataframeAnalysisFeatureProcessorOneHotEncoding) => Set(dataframeAnalysisFeatureProcessorOneHotEncoding, "one_hot_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Action configure) => Set(configure, "one_hot_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding dataframeAnalysisFeatureProcessorTargetMeanEncoding) => Set(dataframeAnalysisFeatureProcessorTargetMeanEncoding, "target_mean_encoding"); - public DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Action configure) => Set(configure, "target_mean_encoding"); + /// + /// + /// The configuration information necessary to perform frequency encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FrequencyEncoding(System.Action> action) + { + Instance.FrequencyEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The configuration information necessary to perform multi encoding. It allows multiple processors to be changed together. This way the output of a processor can then be passed to another as an input. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.MultiEncoding = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// The configuration information necessary to perform multi encoding. It allows multiple processors to be changed together. This way the output of a processor can then be passed to another as an input. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor MultiEncoding(System.Action action) + { + Instance.MultiEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding? value) + { + Instance.NGramEncoding = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(System.Action action) + { + Instance.NGramEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform n-gram encoding. Features created by this encoder have the following name format: <feature_prefix>.<ngram><string position>. For example, if the feature_prefix is f, the feature name for the second unigram in a string is f.11. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor NGramEncoding(System.Action> action) + { + Instance.NGramEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding? value) + { + Instance.OneHotEncoding = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(System.Action action) + { + Instance.OneHotEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform one hot encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor OneHotEncoding(System.Action> action) + { + Instance.OneHotEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding? value) + { + Instance.TargetMeanEncoding = value; + return this; + } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(System.Action action) + { + Instance.TargetMeanEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor.Build(action); + return this; + } + + /// + /// + /// The configuration information necessary to perform target mean encoding. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor TargetMeanEncoding(System.Action> action) + { + Instance.TargetMeanEncoding = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorFrequencyEncoding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorFrequencyEncoding.g.cs index 68bceea4f8d..b2174f5025e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorFrequencyEncoding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorFrequencyEncoding.g.cs @@ -17,78 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisFeatureProcessorFrequencyEncodingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFrequencyMap = System.Text.Json.JsonEncodedText.Encode("frequency_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFeatureName = default; + LocalJsonValue propField = default; + LocalJsonValue> propFrequencyMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFrequencyMap.TryReadProperty(ref reader, options, PropFrequencyMap, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureName = propFeatureName.Value, + Field = propField.Value, + FrequencyMap = propFrequencyMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFrequencyMap, value.FrequencyMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingConverter))] public sealed partial class DataframeAnalysisFeatureProcessorFrequencyEncoding { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Name featureName, Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.IDictionary frequencyMap) + { + FeatureName = featureName; + Field = field; + FrequencyMap = frequencyMap; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessorFrequencyEncoding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisFeatureProcessorFrequencyEncoding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The resulting feature name. /// /// - [JsonInclude, JsonPropertyName("feature_name")] - public Elastic.Clients.Elasticsearch.Name FeatureName { get; set; } - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. /// /// - [JsonInclude, JsonPropertyName("frequency_map")] - public IDictionary FrequencyMap { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(DataframeAnalysisFeatureProcessorFrequencyEncoding dataframeAnalysisFeatureProcessorFrequencyEncoding) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor.FrequencyEncoding(dataframeAnalysisFeatureProcessorFrequencyEncoding); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary FrequencyMap { get; set; } } -public sealed partial class DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding instance) + { + Instance = instance; + } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Name FeatureNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private IDictionary FrequencyMapValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor descriptor) => descriptor.Instance; /// /// /// The resulting feature name. /// /// - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name featureName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(System.Collections.Generic.IDictionary value) { - FieldValue = field; - return Self; + Instance.FrequencyMap = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Expression> field) + /// + /// + /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap() { - FieldValue = field; - return Self; + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(null); + return this; } /// @@ -96,64 +204,79 @@ public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor F /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. /// /// - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(System.Action? action) { - FrequencyMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor AddFrequencyMap(string key, double value) { - writer.WriteStartObject(); - writer.WritePropertyName("feature_name"); - JsonSerializer.Serialize(writer, FeatureNameValue, options); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("frequency_map"); - JsonSerializer.Serialize(writer, FrequencyMapValue, options); - writer.WriteEndObject(); + Instance.FrequencyMap ??= new System.Collections.Generic.Dictionary(); + Instance.FrequencyMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Name FeatureNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private IDictionary FrequencyMapValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor descriptor) => descriptor.Instance; /// /// /// The resulting feature name. /// /// - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name featureName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field(Expression> field) + /// + /// + /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(System.Collections.Generic.IDictionary value) { - FieldValue = field; - return Self; + Instance.FrequencyMap = value; + return this; } /// @@ -161,21 +284,35 @@ public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor Field /// - public DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap() { - FrequencyMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The resulting frequency map for the field value. If the field value is missing from the frequency_map, the resulting value is 0. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor FrequencyMap(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("feature_name"); - JsonSerializer.Serialize(writer, FeatureNameValue, options); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("frequency_map"); - JsonSerializer.Serialize(writer, FrequencyMapValue, options); - writer.WriteEndObject(); + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor AddFrequencyMap(string key, double value) + { + Instance.FrequencyMap ??= new System.Collections.Generic.Dictionary(); + Instance.FrequencyMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorFrequencyEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorMultiEncoding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorMultiEncoding.g.cs index 845758fd8ca..7848050438e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorMultiEncoding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorMultiEncoding.g.cs @@ -17,55 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisFeatureProcessorMultiEncodingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propProcessors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Processors = propProcessors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingConverter))] public sealed partial class DataframeAnalysisFeatureProcessorMultiEncoding { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorMultiEncoding(System.Collections.Generic.ICollection processors) + { + Processors = processors; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessorMultiEncoding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisFeatureProcessorMultiEncoding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessorMultiEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The ordered array of custom processors to execute. Must be more than 1. /// /// - [JsonInclude, JsonPropertyName("processors")] - public ICollection Processors { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(DataframeAnalysisFeatureProcessorMultiEncoding dataframeAnalysisFeatureProcessorMultiEncoding) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor.MultiEncoding(dataframeAnalysisFeatureProcessorMultiEncoding); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Processors { get; set; } } -public sealed partial class DataframeAnalysisFeatureProcessorMultiEncodingDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorMultiEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorMultiEncodingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorMultiEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorMultiEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding instance) { + Instance = instance; } - private ICollection ProcessorsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorMultiEncodingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor descriptor) => descriptor.Instance; /// /// /// The ordered array of custom processors to execute. Must be more than 1. /// /// - public DataframeAnalysisFeatureProcessorMultiEncodingDescriptor Processors(ICollection processors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor Processors(System.Collections.Generic.ICollection value) { - ProcessorsValue = processors; - return Self; + Instance.Processors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The ordered array of custom processors to execute. Must be more than 1. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor Processors(params int[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("processors"); - JsonSerializer.Serialize(writer, ProcessorsValue, options); - writer.WriteEndObject(); + Instance.Processors = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorMultiEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorNGramEncoding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorNGramEncoding.g.cs index b534f8f9a44..c490af203fc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorNGramEncoding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorNGramEncoding.g.cs @@ -17,19 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisFeatureProcessorNGramEncodingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCustom = System.Text.Json.JsonEncodedText.Encode("custom"); + private static readonly System.Text.Json.JsonEncodedText PropFeaturePrefix = System.Text.Json.JsonEncodedText.Encode("feature_prefix"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropNGrams = System.Text.Json.JsonEncodedText.Encode("n_grams"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCustom = default; + LocalJsonValue propFeaturePrefix = default; + LocalJsonValue propField = default; + LocalJsonValue propLength = default; + LocalJsonValue> propNGrams = default; + LocalJsonValue propStart = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCustom.TryReadProperty(ref reader, options, PropCustom, null)) + { + continue; + } + + if (propFeaturePrefix.TryReadProperty(ref reader, options, PropFeaturePrefix, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propNGrams.TryReadProperty(ref reader, options, PropNGrams, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Custom = propCustom.Value, + FeaturePrefix = propFeaturePrefix.Value, + Field = propField.Value, + Length = propLength.Value, + NGrams = propNGrams.Value, + Start = propStart.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCustom, value.Custom, null, null); + writer.WriteProperty(options, PropFeaturePrefix, value.FeaturePrefix, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropNGrams, value.NGrams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStart, value.Start, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingConverter))] public sealed partial class DataframeAnalysisFeatureProcessorNGramEncoding { - [JsonInclude, JsonPropertyName("custom")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection nGrams) + { + Field = field; + NGrams = nGrams; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessorNGramEncoding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisFeatureProcessorNGramEncoding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Custom { get; set; } /// @@ -37,7 +140,6 @@ public sealed partial class DataframeAnalysisFeatureProcessorNGramEncoding /// The feature name prefix. Defaults to ngram_<start>_<length>. /// /// - [JsonInclude, JsonPropertyName("feature_prefix")] public string? FeaturePrefix { get; set; } /// @@ -45,15 +147,17 @@ public sealed partial class DataframeAnalysisFeatureProcessorNGramEncoding /// The name of the text field to encode. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Specifies the length of the n-gram substring. Defaults to 50. Must be greater than 0. /// /// - [JsonInclude, JsonPropertyName("length")] public int? Length { get; set; } /// @@ -61,39 +165,43 @@ public sealed partial class DataframeAnalysisFeatureProcessorNGramEncoding /// Specifies which n-grams to gather. It’s an array of integer values where the minimum value is 1, and a maximum value is 5. /// /// - [JsonInclude, JsonPropertyName("n_grams")] - public ICollection NGrams { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection NGrams { get; set; } /// /// /// Specifies the zero-indexed start of the n-gram substring. Negative values are allowed for encoding n-grams of string suffixes. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("start")] public int? Start { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(DataframeAnalysisFeatureProcessorNGramEncoding dataframeAnalysisFeatureProcessorNGramEncoding) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor.NGramEncoding(dataframeAnalysisFeatureProcessorNGramEncoding); } -public sealed partial class DataframeAnalysisFeatureProcessorNGramEncodingDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisFeatureProcessorNGramEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding instance) { + Instance = instance; } - private bool? CustomValue { get; set; } - private string? FeaturePrefixValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? LengthValue { get; set; } - private ICollection NGramsValue { get; set; } - private int? StartValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custom(bool? custom = true) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custom(bool? value = true) { - CustomValue = custom; - return Self; + Instance.Custom = value; + return this; } /// @@ -101,10 +209,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custo /// The feature name prefix. Defaults to ngram_<start>_<length>. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor FeaturePrefix(string? featurePrefix) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor FeaturePrefix(string? value) { - FeaturePrefixValue = featurePrefix; - return Self; + Instance.FeaturePrefix = value; + return this; } /// @@ -112,10 +220,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Featu /// The name of the text field to encode. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -123,32 +231,32 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field /// The name of the text field to encode. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the text field to encode. + /// Specifies the length of the n-gram substring. Defaults to 50. Must be greater than 0. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Length(int? value) { - FieldValue = field; - return Self; + Instance.Length = value; + return this; } /// /// - /// Specifies the length of the n-gram substring. Defaults to 50. Must be greater than 0. + /// Specifies which n-grams to gather. It’s an array of integer values where the minimum value is 1, and a maximum value is 5. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Length(int? length) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(System.Collections.Generic.ICollection value) { - LengthValue = length; - return Self; + Instance.NGrams = value; + return this; } /// @@ -156,10 +264,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Lengt /// Specifies which n-grams to gather. It’s an array of integer values where the minimum value is 1, and a maximum value is 5. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(ICollection nGrams) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(params int[] values) { - NGramsValue = nGrams; - return Self; + Instance.NGrams = [.. values]; + return this; } /// @@ -167,66 +275,44 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGram /// Specifies the zero-indexed start of the n-gram substring. Negative values are allowed for encoding n-grams of string suffixes. Defaults to 0. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Start(int? start) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Start(int? value) { - StartValue = start; - return Self; + Instance.Start = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding Build(System.Action> action) { - writer.WriteStartObject(); - if (CustomValue.HasValue) - { - writer.WritePropertyName("custom"); - writer.WriteBooleanValue(CustomValue.Value); - } - - if (!string.IsNullOrEmpty(FeaturePrefixValue)) - { - writer.WritePropertyName("feature_prefix"); - writer.WriteStringValue(FeaturePrefixValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LengthValue.HasValue) - { - writer.WritePropertyName("length"); - writer.WriteNumberValue(LengthValue.Value); - } - - writer.WritePropertyName("n_grams"); - JsonSerializer.Serialize(writer, NGramsValue, options); - if (StartValue.HasValue) - { - writer.WritePropertyName("start"); - writer.WriteNumberValue(StartValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisFeatureProcessorNGramEncodingDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorNGramEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding instance) { + Instance = instance; } - private bool? CustomValue { get; set; } - private string? FeaturePrefixValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? LengthValue { get; set; } - private ICollection NGramsValue { get; set; } - private int? StartValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custom(bool? custom = true) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custom(bool? value = true) { - CustomValue = custom; - return Self; + Instance.Custom = value; + return this; } /// @@ -234,10 +320,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Custom(bool? cus /// The feature name prefix. Defaults to ngram_<start>_<length>. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor FeaturePrefix(string? featurePrefix) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor FeaturePrefix(string? value) { - FeaturePrefixValue = featurePrefix; - return Self; + Instance.FeaturePrefix = value; + return this; } /// @@ -245,10 +331,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor FeaturePrefix(st /// The name of the text field to encode. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -256,32 +342,32 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Elastic.Cl /// The name of the text field to encode. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the text field to encode. + /// Specifies the length of the n-gram substring. Defaults to 50. Must be greater than 0. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Length(int? value) { - FieldValue = field; - return Self; + Instance.Length = value; + return this; } /// /// - /// Specifies the length of the n-gram substring. Defaults to 50. Must be greater than 0. + /// Specifies which n-grams to gather. It’s an array of integer values where the minimum value is 1, and a maximum value is 5. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Length(int? length) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(System.Collections.Generic.ICollection value) { - LengthValue = length; - return Self; + Instance.NGrams = value; + return this; } /// @@ -289,10 +375,10 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Length(int? leng /// Specifies which n-grams to gather. It’s an array of integer values where the minimum value is 1, and a maximum value is 5. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(ICollection nGrams) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(params int[] values) { - NGramsValue = nGrams; - return Self; + Instance.NGrams = [.. values]; + return this; } /// @@ -300,43 +386,17 @@ public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor NGrams(ICollecti /// Specifies the zero-indexed start of the n-gram substring. Negative values are allowed for encoding n-grams of string suffixes. Defaults to 0. /// /// - public DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Start(int? start) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor Start(int? value) { - StartValue = start; - return Self; + Instance.Start = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding Build(System.Action action) { - writer.WriteStartObject(); - if (CustomValue.HasValue) - { - writer.WritePropertyName("custom"); - writer.WriteBooleanValue(CustomValue.Value); - } - - if (!string.IsNullOrEmpty(FeaturePrefixValue)) - { - writer.WritePropertyName("feature_prefix"); - writer.WriteStringValue(FeaturePrefixValue); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LengthValue.HasValue) - { - writer.WritePropertyName("length"); - writer.WriteNumberValue(LengthValue.Value); - } - - writer.WritePropertyName("n_grams"); - JsonSerializer.Serialize(writer, NGramsValue, options); - if (StartValue.HasValue) - { - writer.WritePropertyName("start"); - writer.WriteNumberValue(StartValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorNGramEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorOneHotEncoding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorOneHotEncoding.g.cs index 511740a107d..5ce3c5100a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorOneHotEncoding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorOneHotEncoding.g.cs @@ -17,68 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisFeatureProcessorOneHotEncodingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropHotMap = System.Text.Json.JsonEncodedText.Encode("hot_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propHotMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propHotMap.TryReadProperty(ref reader, options, PropHotMap, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + HotMap = propHotMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropHotMap, value.HotMap, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingConverter))] public sealed partial class DataframeAnalysisFeatureProcessorOneHotEncoding { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Field field, string hotMap) + { + Field = field; + HotMap = hotMap; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessorOneHotEncoding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisFeatureProcessorOneHotEncoding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the field to encode. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The one hot map mapping the field value with the column name. /// /// - [JsonInclude, JsonPropertyName("hot_map")] - public string HotMap { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(DataframeAnalysisFeatureProcessorOneHotEncoding dataframeAnalysisFeatureProcessorOneHotEncoding) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor.OneHotEncoding(dataframeAnalysisFeatureProcessorOneHotEncoding); + public +#if NET7_0_OR_GREATER + required +#endif + string HotMap { get; set; } } -public sealed partial class DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string HotMapValue { get; set; } - - /// - /// - /// The name of the field to encode. - /// - /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -86,10 +155,10 @@ public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Fiel /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -97,54 +166,49 @@ public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Fiel /// The one hot map mapping the field value with the column name. /// /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor HotMap(string hotMap) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor HotMap(string value) { - HotMapValue = hotMap; - return Self; + Instance.HotMap = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("hot_map"); - writer.WriteStringValue(HotMapValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string HotMapValue { get; set; } - - /// - /// - /// The name of the field to encode. - /// - /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor descriptor) => descriptor.Instance; + /// /// /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -152,10 +216,10 @@ public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -163,19 +227,17 @@ public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor Field /// - public DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor HotMap(string hotMap) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor HotMap(string value) { - HotMapValue = hotMap; - return Self; + Instance.HotMap = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("hot_map"); - writer.WriteStringValue(HotMapValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorOneHotEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorTargetMeanEncoding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorTargetMeanEncoding.g.cs index c1383aedb32..740172c7116 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorTargetMeanEncoding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisFeatureProcessorTargetMeanEncoding.g.cs @@ -17,75 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisFeatureProcessorTargetMeanEncodingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaultValue = System.Text.Json.JsonEncodedText.Encode("default_value"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropTargetMap = System.Text.Json.JsonEncodedText.Encode("target_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefaultValue = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue propField = default; + LocalJsonValue> propTargetMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaultValue.TryReadProperty(ref reader, options, PropDefaultValue, null)) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propTargetMap.TryReadProperty(ref reader, options, PropTargetMap, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DefaultValue = propDefaultValue.Value, + FeatureName = propFeatureName.Value, + Field = propField.Value, + TargetMap = propTargetMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaultValue, value.DefaultValue, null, null); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropTargetMap, value.TargetMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingConverter))] public sealed partial class DataframeAnalysisFeatureProcessorTargetMeanEncoding { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorTargetMeanEncoding(int defaultValue, Elastic.Clients.Elasticsearch.Name featureName, Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.IDictionary targetMap) + { + DefaultValue = defaultValue; + FeatureName = featureName; + Field = field; + TargetMap = targetMap; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisFeatureProcessorTargetMeanEncoding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisFeatureProcessorTargetMeanEncoding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The default value if field value is not found in the target_map. /// /// - [JsonInclude, JsonPropertyName("default_value")] - public int DefaultValue { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DefaultValue { get; set; } /// /// /// The resulting feature name. /// /// - [JsonInclude, JsonPropertyName("feature_name")] - public Elastic.Clients.Elasticsearch.Name FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name FeatureName { get; set; } /// /// /// The name of the field to encode. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The field value to target mean transition map. /// /// - [JsonInclude, JsonPropertyName("target_map")] - public IDictionary TargetMap { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor(DataframeAnalysisFeatureProcessorTargetMeanEncoding dataframeAnalysisFeatureProcessorTargetMeanEncoding) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor.TargetMeanEncoding(dataframeAnalysisFeatureProcessorTargetMeanEncoding); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary TargetMap { get; set; } } -public sealed partial class DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding Instance { get; init; } - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding instance) { + Instance = instance; } - private int DefaultValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Name FeatureNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private IDictionary TargetMapValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor descriptor) => descriptor.Instance; /// /// /// The default value if field value is not found in the target_map. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor DefaultValue(int defaultValue) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor DefaultValue(int value) { - DefaultValueValue = defaultValue; - return Self; + Instance.DefaultValue = value; + return this; } /// @@ -93,10 +197,10 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor /// The resulting feature name. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name featureName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } /// @@ -104,10 +208,10 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -115,21 +219,21 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the field to encode. + /// The field value to target mean transition map. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(System.Collections.Generic.IDictionary value) { - FieldValue = field; - return Self; + Instance.TargetMap = value; + return this; } /// @@ -137,49 +241,67 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor /// The field value to target mean transition map. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap() { - TargetMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The field value to target mean transition map. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("default_value"); - writer.WriteNumberValue(DefaultValueValue); - writer.WritePropertyName("feature_name"); - JsonSerializer.Serialize(writer, FeatureNameValue, options); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("target_map"); - JsonSerializer.Serialize(writer, TargetMapValue, options); - writer.WriteEndObject(); + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor AddTargetMap(string key, object value) + { + Instance.TargetMap ??= new System.Collections.Generic.Dictionary(); + Instance.TargetMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor { - internal DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding instance) + { + Instance = instance; + } - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int DefaultValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Name FeatureNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private IDictionary TargetMapValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor descriptor) => descriptor.Instance; /// /// /// The default value if field value is not found in the target_map. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor DefaultValue(int defaultValue) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor DefaultValue(int value) { - DefaultValueValue = defaultValue; - return Self; + Instance.DefaultValue = value; + return this; } /// @@ -187,10 +309,10 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor DefaultValu /// The resulting feature name. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name featureName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor FeatureName(Elastic.Clients.Elasticsearch.Name value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } /// @@ -198,10 +320,10 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor FeatureName /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -209,21 +331,32 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Elast /// The name of the field to encode. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the field to encode. + /// The field value to target mean transition map. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(System.Collections.Generic.IDictionary value) + { + Instance.TargetMap = value; + return this; + } + + /// + /// + /// The field value to target mean transition map. /// /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap() { - FieldValue = field; - return Self; + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -231,23 +364,24 @@ public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor Field /// - public DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor TargetMap(System.Action? action) { - TargetMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor AddTargetMap(string key, object value) { - writer.WriteStartObject(); - writer.WritePropertyName("default_value"); - writer.WriteNumberValue(DefaultValueValue); - writer.WritePropertyName("feature_name"); - JsonSerializer.Serialize(writer, FeatureNameValue, options); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("target_map"); - JsonSerializer.Serialize(writer, TargetMapValue, options); - writer.WriteEndObject(); + Instance.TargetMap ??= new System.Collections.Generic.Dictionary(); + Instance.TargetMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncodingDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorTargetMeanEncoding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisOutlierDetection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisOutlierDetection.g.cs index 5c976d32f09..d77c6f16d76 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisOutlierDetection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisOutlierDetection.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalysisOutlierDetectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropComputeFeatureInfluence = System.Text.Json.JsonEncodedText.Encode("compute_feature_influence"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureInfluenceThreshold = System.Text.Json.JsonEncodedText.Encode("feature_influence_threshold"); + private static readonly System.Text.Json.JsonEncodedText PropMethod = System.Text.Json.JsonEncodedText.Encode("method"); + private static readonly System.Text.Json.JsonEncodedText PropNNeighbors = System.Text.Json.JsonEncodedText.Encode("n_neighbors"); + private static readonly System.Text.Json.JsonEncodedText PropOutlierFraction = System.Text.Json.JsonEncodedText.Encode("outlier_fraction"); + private static readonly System.Text.Json.JsonEncodedText PropStandardizationEnabled = System.Text.Json.JsonEncodedText.Encode("standardization_enabled"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propComputeFeatureInfluence = default; + LocalJsonValue propFeatureInfluenceThreshold = default; + LocalJsonValue propMethod = default; + LocalJsonValue propNNeighbors = default; + LocalJsonValue propOutlierFraction = default; + LocalJsonValue propStandardizationEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propComputeFeatureInfluence.TryReadProperty(ref reader, options, PropComputeFeatureInfluence, null)) + { + continue; + } + + if (propFeatureInfluenceThreshold.TryReadProperty(ref reader, options, PropFeatureInfluenceThreshold, null)) + { + continue; + } + + if (propMethod.TryReadProperty(ref reader, options, PropMethod, null)) + { + continue; + } + + if (propNNeighbors.TryReadProperty(ref reader, options, PropNNeighbors, null)) + { + continue; + } + + if (propOutlierFraction.TryReadProperty(ref reader, options, PropOutlierFraction, null)) + { + continue; + } + + if (propStandardizationEnabled.TryReadProperty(ref reader, options, PropStandardizationEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ComputeFeatureInfluence = propComputeFeatureInfluence.Value, + FeatureInfluenceThreshold = propFeatureInfluenceThreshold.Value, + Method = propMethod.Value, + NNeighbors = propNNeighbors.Value, + OutlierFraction = propOutlierFraction.Value, + StandardizationEnabled = propStandardizationEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropComputeFeatureInfluence, value.ComputeFeatureInfluence, null, null); + writer.WriteProperty(options, PropFeatureInfluenceThreshold, value.FeatureInfluenceThreshold, null, null); + writer.WriteProperty(options, PropMethod, value.Method, null, null); + writer.WriteProperty(options, PropNNeighbors, value.NNeighbors, null, null); + writer.WriteProperty(options, PropOutlierFraction, value.OutlierFraction, null, null); + writer.WriteProperty(options, PropStandardizationEnabled, value.StandardizationEnabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionConverter))] public sealed partial class DataframeAnalysisOutlierDetection { +#if NET7_0_OR_GREATER + public DataframeAnalysisOutlierDetection() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeAnalysisOutlierDetection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies whether the feature influence calculation is enabled. /// /// - [JsonInclude, JsonPropertyName("compute_feature_influence")] public bool? ComputeFeatureInfluence { get; set; } /// @@ -42,7 +138,6 @@ public sealed partial class DataframeAnalysisOutlierDetection /// The minimum outlier score that a document needs to have in order to calculate its feature influence score. Value range: 0-1. /// /// - [JsonInclude, JsonPropertyName("feature_influence_threshold")] public double? FeatureInfluenceThreshold { get; set; } /// @@ -50,7 +145,6 @@ public sealed partial class DataframeAnalysisOutlierDetection /// The method that outlier detection uses. Available methods are lof, ldof, distance_kth_nn, distance_knn, and ensemble. The default value is ensemble, which means that outlier detection uses an ensemble of different methods and normalises and combines their individual outlier scores to obtain the overall outlier score. /// /// - [JsonInclude, JsonPropertyName("method")] public string? Method { get; set; } /// @@ -58,7 +152,6 @@ public sealed partial class DataframeAnalysisOutlierDetection /// Defines the value for how many nearest neighbors each method of outlier detection uses to calculate its outlier score. When the value is not set, different values are used for different ensemble members. This default behavior helps improve the diversity in the ensemble; only override it if you are confident that the value you choose is appropriate for the data set. /// /// - [JsonInclude, JsonPropertyName("n_neighbors")] public int? NNeighbors { get; set; } /// @@ -66,7 +159,6 @@ public sealed partial class DataframeAnalysisOutlierDetection /// The proportion of the data set that is assumed to be outlying prior to outlier detection. For example, 0.05 means it is assumed that 5% of values are real outliers and 95% are inliers. /// /// - [JsonInclude, JsonPropertyName("outlier_fraction")] public double? OutlierFraction { get; set; } /// @@ -74,36 +166,37 @@ public sealed partial class DataframeAnalysisOutlierDetection /// If true, the following operation is performed on the columns before computing outlier scores: (x_i - mean(x_i)) / sd(x_i). /// /// - [JsonInclude, JsonPropertyName("standardization_enabled")] public bool? StandardizationEnabled { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(DataframeAnalysisOutlierDetection dataframeAnalysisOutlierDetection) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis.OutlierDetection(dataframeAnalysisOutlierDetection); } -public sealed partial class DataframeAnalysisOutlierDetectionDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisOutlierDetectionDescriptor { - internal DataframeAnalysisOutlierDetectionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection Instance { get; init; } - public DataframeAnalysisOutlierDetectionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection instance) { + Instance = instance; } - private bool? ComputeFeatureInfluenceValue { get; set; } - private double? FeatureInfluenceThresholdValue { get; set; } - private string? MethodValue { get; set; } - private int? NNeighborsValue { get; set; } - private double? OutlierFractionValue { get; set; } - private bool? StandardizationEnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisOutlierDetectionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies whether the feature influence calculation is enabled. /// /// - public DataframeAnalysisOutlierDetectionDescriptor ComputeFeatureInfluence(bool? computeFeatureInfluence = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor ComputeFeatureInfluence(bool? value = true) { - ComputeFeatureInfluenceValue = computeFeatureInfluence; - return Self; + Instance.ComputeFeatureInfluence = value; + return this; } /// @@ -111,10 +204,10 @@ public DataframeAnalysisOutlierDetectionDescriptor ComputeFeatureInfluence(bool? /// The minimum outlier score that a document needs to have in order to calculate its feature influence score. Value range: 0-1. /// /// - public DataframeAnalysisOutlierDetectionDescriptor FeatureInfluenceThreshold(double? featureInfluenceThreshold) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor FeatureInfluenceThreshold(double? value) { - FeatureInfluenceThresholdValue = featureInfluenceThreshold; - return Self; + Instance.FeatureInfluenceThreshold = value; + return this; } /// @@ -122,10 +215,10 @@ public DataframeAnalysisOutlierDetectionDescriptor FeatureInfluenceThreshold(dou /// The method that outlier detection uses. Available methods are lof, ldof, distance_kth_nn, distance_knn, and ensemble. The default value is ensemble, which means that outlier detection uses an ensemble of different methods and normalises and combines their individual outlier scores to obtain the overall outlier score. /// /// - public DataframeAnalysisOutlierDetectionDescriptor Method(string? method) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor Method(string? value) { - MethodValue = method; - return Self; + Instance.Method = value; + return this; } /// @@ -133,10 +226,10 @@ public DataframeAnalysisOutlierDetectionDescriptor Method(string? method) /// Defines the value for how many nearest neighbors each method of outlier detection uses to calculate its outlier score. When the value is not set, different values are used for different ensemble members. This default behavior helps improve the diversity in the ensemble; only override it if you are confident that the value you choose is appropriate for the data set. /// /// - public DataframeAnalysisOutlierDetectionDescriptor NNeighbors(int? nNeighbors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor NNeighbors(int? value) { - NNeighborsValue = nNeighbors; - return Self; + Instance.NNeighbors = value; + return this; } /// @@ -144,10 +237,10 @@ public DataframeAnalysisOutlierDetectionDescriptor NNeighbors(int? nNeighbors) /// The proportion of the data set that is assumed to be outlying prior to outlier detection. For example, 0.05 means it is assumed that 5% of values are real outliers and 95% are inliers. /// /// - public DataframeAnalysisOutlierDetectionDescriptor OutlierFraction(double? outlierFraction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor OutlierFraction(double? value) { - OutlierFractionValue = outlierFraction; - return Self; + Instance.OutlierFraction = value; + return this; } /// @@ -155,51 +248,22 @@ public DataframeAnalysisOutlierDetectionDescriptor OutlierFraction(double? outli /// If true, the following operation is performed on the columns before computing outlier scores: (x_i - mean(x_i)) / sd(x_i). /// /// - public DataframeAnalysisOutlierDetectionDescriptor StandardizationEnabled(bool? standardizationEnabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor StandardizationEnabled(bool? value = true) { - StandardizationEnabledValue = standardizationEnabled; - return Self; + Instance.StandardizationEnabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection Build(System.Action? action) { - writer.WriteStartObject(); - if (ComputeFeatureInfluenceValue.HasValue) - { - writer.WritePropertyName("compute_feature_influence"); - writer.WriteBooleanValue(ComputeFeatureInfluenceValue.Value); - } - - if (FeatureInfluenceThresholdValue.HasValue) + if (action is null) { - writer.WritePropertyName("feature_influence_threshold"); - writer.WriteNumberValue(FeatureInfluenceThresholdValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(MethodValue)) - { - writer.WritePropertyName("method"); - writer.WriteStringValue(MethodValue); - } - - if (NNeighborsValue.HasValue) - { - writer.WritePropertyName("n_neighbors"); - writer.WriteNumberValue(NNeighborsValue.Value); - } - - if (OutlierFractionValue.HasValue) - { - writer.WritePropertyName("outlier_fraction"); - writer.WriteNumberValue(OutlierFractionValue.Value); - } - - if (StandardizationEnabledValue.HasValue) - { - writer.WritePropertyName("standardization_enabled"); - writer.WriteBooleanValue(StandardizationEnabledValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetectionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisRegression.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisRegression.g.cs index 33f1f359972..d714b6cddb8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisRegression.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalysisRegression.g.cs @@ -17,279 +17,248 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -internal sealed partial class DataframeAnalysisRegressionConverter : JsonConverter +internal sealed partial class DataframeAnalysisRegressionConverter : System.Text.Json.Serialization.JsonConverter { - public override DataframeAnalysisRegression Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAlpha = System.Text.Json.JsonEncodedText.Encode("alpha"); + private static readonly System.Text.Json.JsonEncodedText PropDependentVariable = System.Text.Json.JsonEncodedText.Encode("dependent_variable"); + private static readonly System.Text.Json.JsonEncodedText PropDownsampleFactor = System.Text.Json.JsonEncodedText.Encode("downsample_factor"); + private static readonly System.Text.Json.JsonEncodedText PropEarlyStoppingEnabled = System.Text.Json.JsonEncodedText.Encode("early_stopping_enabled"); + private static readonly System.Text.Json.JsonEncodedText PropEta = System.Text.Json.JsonEncodedText.Encode("eta"); + private static readonly System.Text.Json.JsonEncodedText PropEtaGrowthRatePerTree = System.Text.Json.JsonEncodedText.Encode("eta_growth_rate_per_tree"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureBagFraction = System.Text.Json.JsonEncodedText.Encode("feature_bag_fraction"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureProcessors = System.Text.Json.JsonEncodedText.Encode("feature_processors"); + private static readonly System.Text.Json.JsonEncodedText PropGamma = System.Text.Json.JsonEncodedText.Encode("gamma"); + private static readonly System.Text.Json.JsonEncodedText PropLambda = System.Text.Json.JsonEncodedText.Encode("lambda"); + private static readonly System.Text.Json.JsonEncodedText PropLossFunction = System.Text.Json.JsonEncodedText.Encode("loss_function"); + private static readonly System.Text.Json.JsonEncodedText PropLossFunctionParameter = System.Text.Json.JsonEncodedText.Encode("loss_function_parameter"); + private static readonly System.Text.Json.JsonEncodedText PropMaxOptimizationRoundsPerHyperparameter = System.Text.Json.JsonEncodedText.Encode("max_optimization_rounds_per_hyperparameter"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTrees = System.Text.Json.JsonEncodedText.Encode("max_trees"); + private static readonly System.Text.Json.JsonEncodedText PropMaxTrees1 = System.Text.Json.JsonEncodedText.Encode("maximum_number_trees"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionFieldName = System.Text.Json.JsonEncodedText.Encode("prediction_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropRandomizeSeed = System.Text.Json.JsonEncodedText.Encode("randomize_seed"); + private static readonly System.Text.Json.JsonEncodedText PropSoftTreeDepthLimit = System.Text.Json.JsonEncodedText.Encode("soft_tree_depth_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSoftTreeDepthTolerance = System.Text.Json.JsonEncodedText.Encode("soft_tree_depth_tolerance"); + private static readonly System.Text.Json.JsonEncodedText PropTrainingPercent = System.Text.Json.JsonEncodedText.Encode("training_percent"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new DataframeAnalysisRegression(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlpha = default; + LocalJsonValue propDependentVariable = default; + LocalJsonValue propDownsampleFactor = default; + LocalJsonValue propEarlyStoppingEnabled = default; + LocalJsonValue propEta = default; + LocalJsonValue propEtaGrowthRatePerTree = default; + LocalJsonValue propFeatureBagFraction = default; + LocalJsonValue?> propFeatureProcessors = default; + LocalJsonValue propGamma = default; + LocalJsonValue propLambda = default; + LocalJsonValue propLossFunction = default; + LocalJsonValue propLossFunctionParameter = default; + LocalJsonValue propMaxOptimizationRoundsPerHyperparameter = default; + LocalJsonValue propMaxTrees = default; + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propPredictionFieldName = default; + LocalJsonValue propRandomizeSeed = default; + LocalJsonValue propSoftTreeDepthLimit = default; + LocalJsonValue propSoftTreeDepthTolerance = default; + LocalJsonValue propTrainingPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlpha.TryReadProperty(ref reader, options, PropAlpha, null)) { - var property = reader.GetString(); - if (property == "alpha") - { - variant.Alpha = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "dependent_variable") - { - variant.DependentVariable = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "downsample_factor") - { - variant.DownsampleFactor = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "early_stopping_enabled") - { - variant.EarlyStoppingEnabled = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "eta") - { - variant.Eta = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "eta_growth_rate_per_tree") - { - variant.EtaGrowthRatePerTree = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "feature_bag_fraction") - { - variant.FeatureBagFraction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "feature_processors") - { - variant.FeatureProcessors = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "gamma") - { - variant.Gamma = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lambda") - { - variant.Lambda = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "loss_function") - { - variant.LossFunction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "loss_function_parameter") - { - variant.LossFunctionParameter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_optimization_rounds_per_hyperparameter") - { - variant.MaxOptimizationRoundsPerHyperparameter = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_trees" || property == "maximum_number_trees") - { - variant.MaxTrees = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "num_top_feature_importance_values") - { - variant.NumTopFeatureImportanceValues = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "prediction_field_name") - { - variant.PredictionFieldName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "randomize_seed") - { - variant.RandomizeSeed = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "soft_tree_depth_limit") - { - variant.SoftTreeDepthLimit = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "soft_tree_depth_tolerance") - { - variant.SoftTreeDepthTolerance = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "training_percent") - { - variant.TrainingPercent = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propDependentVariable.TryReadProperty(ref reader, options, PropDependentVariable, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, DataframeAnalysisRegression value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Alpha.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(value.Alpha.Value); - } + if (propDownsampleFactor.TryReadProperty(ref reader, options, PropDownsampleFactor, null)) + { + continue; + } - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(value.DependentVariable); - if (value.DownsampleFactor.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(value.DownsampleFactor.Value); - } + if (propEarlyStoppingEnabled.TryReadProperty(ref reader, options, PropEarlyStoppingEnabled, null)) + { + continue; + } - if (value.EarlyStoppingEnabled.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(value.EarlyStoppingEnabled.Value); - } + if (propEta.TryReadProperty(ref reader, options, PropEta, null)) + { + continue; + } - if (value.Eta.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(value.Eta.Value); - } + if (propEtaGrowthRatePerTree.TryReadProperty(ref reader, options, PropEtaGrowthRatePerTree, null)) + { + continue; + } - if (value.EtaGrowthRatePerTree.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(value.EtaGrowthRatePerTree.Value); - } + if (propFeatureBagFraction.TryReadProperty(ref reader, options, PropFeatureBagFraction, null)) + { + continue; + } - if (value.FeatureBagFraction.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(value.FeatureBagFraction.Value); - } + if (propFeatureProcessors.TryReadProperty(ref reader, options, PropFeatureProcessors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.FeatureProcessors is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, value.FeatureProcessors, options); - } + if (propGamma.TryReadProperty(ref reader, options, PropGamma, null)) + { + continue; + } - if (value.Gamma.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(value.Gamma.Value); - } + if (propLambda.TryReadProperty(ref reader, options, PropLambda, null)) + { + continue; + } - if (value.Lambda.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(value.Lambda.Value); - } + if (propLossFunction.TryReadProperty(ref reader, options, PropLossFunction, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.LossFunction)) - { - writer.WritePropertyName("loss_function"); - writer.WriteStringValue(value.LossFunction); - } + if (propLossFunctionParameter.TryReadProperty(ref reader, options, PropLossFunctionParameter, null)) + { + continue; + } - if (value.LossFunctionParameter.HasValue) - { - writer.WritePropertyName("loss_function_parameter"); - writer.WriteNumberValue(value.LossFunctionParameter.Value); - } + if (propMaxOptimizationRoundsPerHyperparameter.TryReadProperty(ref reader, options, PropMaxOptimizationRoundsPerHyperparameter, null)) + { + continue; + } - if (value.MaxOptimizationRoundsPerHyperparameter.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(value.MaxOptimizationRoundsPerHyperparameter.Value); - } + if (propMaxTrees.TryReadProperty(ref reader, options, PropMaxTrees, null) || propMaxTrees.TryReadProperty(ref reader, options, PropMaxTrees1, null)) + { + continue; + } - if (value.MaxTrees.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(value.MaxTrees.Value); - } + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } - if (value.NumTopFeatureImportanceValues.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(value.NumTopFeatureImportanceValues.Value); - } + if (propPredictionFieldName.TryReadProperty(ref reader, options, PropPredictionFieldName, null)) + { + continue; + } - if (value.PredictionFieldName is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, value.PredictionFieldName, options); - } + if (propRandomizeSeed.TryReadProperty(ref reader, options, PropRandomizeSeed, null)) + { + continue; + } - if (value.RandomizeSeed.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(value.RandomizeSeed.Value); - } + if (propSoftTreeDepthLimit.TryReadProperty(ref reader, options, PropSoftTreeDepthLimit, null)) + { + continue; + } - if (value.SoftTreeDepthLimit.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(value.SoftTreeDepthLimit.Value); - } + if (propSoftTreeDepthTolerance.TryReadProperty(ref reader, options, PropSoftTreeDepthTolerance, null)) + { + continue; + } - if (value.SoftTreeDepthTolerance.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(value.SoftTreeDepthTolerance.Value); - } + if (propTrainingPercent.TryReadProperty(ref reader, options, PropTrainingPercent, null)) + { + continue; + } - if (value.TrainingPercent.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(value.TrainingPercent.Value); - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alpha = propAlpha.Value, + DependentVariable = propDependentVariable.Value, + DownsampleFactor = propDownsampleFactor.Value, + EarlyStoppingEnabled = propEarlyStoppingEnabled.Value, + Eta = propEta.Value, + EtaGrowthRatePerTree = propEtaGrowthRatePerTree.Value, + FeatureBagFraction = propFeatureBagFraction.Value, + FeatureProcessors = propFeatureProcessors.Value, + Gamma = propGamma.Value, + Lambda = propLambda.Value, + LossFunction = propLossFunction.Value, + LossFunctionParameter = propLossFunctionParameter.Value, + MaxOptimizationRoundsPerHyperparameter = propMaxOptimizationRoundsPerHyperparameter.Value, + MaxTrees = propMaxTrees.Value, + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + PredictionFieldName = propPredictionFieldName.Value, + RandomizeSeed = propRandomizeSeed.Value, + SoftTreeDepthLimit = propSoftTreeDepthLimit.Value, + SoftTreeDepthTolerance = propSoftTreeDepthTolerance.Value, + TrainingPercent = propTrainingPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlpha, value.Alpha, null, null); + writer.WriteProperty(options, PropDependentVariable, value.DependentVariable, null, null); + writer.WriteProperty(options, PropDownsampleFactor, value.DownsampleFactor, null, null); + writer.WriteProperty(options, PropEarlyStoppingEnabled, value.EarlyStoppingEnabled, null, null); + writer.WriteProperty(options, PropEta, value.Eta, null, null); + writer.WriteProperty(options, PropEtaGrowthRatePerTree, value.EtaGrowthRatePerTree, null, null); + writer.WriteProperty(options, PropFeatureBagFraction, value.FeatureBagFraction, null, null); + writer.WriteProperty(options, PropFeatureProcessors, value.FeatureProcessors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropGamma, value.Gamma, null, null); + writer.WriteProperty(options, PropLambda, value.Lambda, null, null); + writer.WriteProperty(options, PropLossFunction, value.LossFunction, null, null); + writer.WriteProperty(options, PropLossFunctionParameter, value.LossFunctionParameter, null, null); + writer.WriteProperty(options, PropMaxOptimizationRoundsPerHyperparameter, value.MaxOptimizationRoundsPerHyperparameter, null, null); + writer.WriteProperty(options, PropMaxTrees, value.MaxTrees, null, null); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropPredictionFieldName, value.PredictionFieldName, null, null); + writer.WriteProperty(options, PropRandomizeSeed, value.RandomizeSeed, null, null); + writer.WriteProperty(options, PropSoftTreeDepthLimit, value.SoftTreeDepthLimit, null, null); + writer.WriteProperty(options, PropSoftTreeDepthTolerance, value.SoftTreeDepthTolerance, null, null); + writer.WriteProperty(options, PropTrainingPercent, value.TrainingPercent, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(DataframeAnalysisRegressionConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionConverter))] public sealed partial class DataframeAnalysisRegression { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisRegression(string dependentVariable) + { + DependentVariable = dependentVariable; + } +#if NET7_0_OR_GREATER + public DataframeAnalysisRegression() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalysisRegression() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. @@ -304,7 +273,11 @@ public sealed partial class DataframeAnalysisRegression /// For regression analysis, the data type of the field must be numeric. /// /// - public string DependentVariable { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string DependentVariable { get; set; } /// /// @@ -346,7 +319,7 @@ public sealed partial class DataframeAnalysisRegression /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public ICollection? FeatureProcessors { get; set; } + public System.Collections.Generic.ICollection? FeatureProcessors { get; set; } /// /// @@ -430,52 +403,37 @@ public sealed partial class DataframeAnalysisRegression /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public double? TrainingPercent { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis(DataframeAnalysisRegression dataframeAnalysisRegression) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis.Regression(dataframeAnalysisRegression); + public Elastic.Clients.Elasticsearch.Percentage? TrainingPercent { get; set; } } -public sealed partial class DataframeAnalysisRegressionDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalysisRegressionDescriptor { - internal DataframeAnalysisRegressionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression instance) + { + Instance = instance; + } - public DataframeAnalysisRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisRegressionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? AlphaValue { get; set; } - private string DependentVariableValue { get; set; } - private double? DownsampleFactorValue { get; set; } - private bool? EarlyStoppingEnabledValue { get; set; } - private double? EtaValue { get; set; } - private double? EtaGrowthRatePerTreeValue { get; set; } - private double? FeatureBagFractionValue { get; set; } - private ICollection? FeatureProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FeatureProcessorsDescriptor { get; set; } - private Action> FeatureProcessorsDescriptorAction { get; set; } - private Action>[] FeatureProcessorsDescriptorActions { get; set; } - private double? GammaValue { get; set; } - private double? LambdaValue { get; set; } - private string? LossFunctionValue { get; set; } - private double? LossFunctionParameterValue { get; set; } - private int? MaxOptimizationRoundsPerHyperparameterValue { get; set; } - private int? MaxTreesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictionFieldNameValue { get; set; } - private double? RandomizeSeedValue { get; set; } - private int? SoftTreeDepthLimitValue { get; set; } - private double? SoftTreeDepthToleranceValue { get; set; } - private double? TrainingPercentValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor descriptor) => descriptor.Instance; /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. /// /// - public DataframeAnalysisRegressionDescriptor Alpha(double? alpha) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Alpha(double? value) { - AlphaValue = alpha; - return Self; + Instance.Alpha = value; + return this; } /// @@ -485,10 +443,10 @@ public DataframeAnalysisRegressionDescriptor Alpha(double? alpha) /// For regression analysis, the data type of the field must be numeric. /// /// - public DataframeAnalysisRegressionDescriptor DependentVariable(string dependentVariable) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor DependentVariable(string value) { - DependentVariableValue = dependentVariable; - return Self; + Instance.DependentVariable = value; + return this; } /// @@ -496,10 +454,10 @@ public DataframeAnalysisRegressionDescriptor DependentVariable(string /// Advanced configuration option. Controls the fraction of data that is used to compute the derivatives of the loss function for tree training. A small value results in the use of a small fraction of the data. If this value is set to be less than 1, accuracy typically improves. However, too small a value may result in poor convergence for the ensemble and so require more trees. By default, this value is calculated during hyperparameter optimization. It must be greater than zero and less than or equal to 1. /// /// - public DataframeAnalysisRegressionDescriptor DownsampleFactor(double? downsampleFactor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor DownsampleFactor(double? value) { - DownsampleFactorValue = downsampleFactor; - return Self; + Instance.DownsampleFactor = value; + return this; } /// @@ -507,10 +465,10 @@ public DataframeAnalysisRegressionDescriptor DownsampleFactor(double? /// Advanced configuration option. Specifies whether the training process should finish if it is not finding any better performing models. If disabled, the training process can take significantly longer and the chance of finding a better performing model is unremarkable. /// /// - public DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(bool? earlyStoppingEnabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(bool? value = true) { - EarlyStoppingEnabledValue = earlyStoppingEnabled; - return Self; + Instance.EarlyStoppingEnabled = value; + return this; } /// @@ -518,10 +476,10 @@ public DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(boo /// Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, larger forests cause slower training. By default, this value is calculated during hyperparameter optimization. It must be a value between 0.001 and 1. /// /// - public DataframeAnalysisRegressionDescriptor Eta(double? eta) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Eta(double? value) { - EtaValue = eta; - return Self; + Instance.Eta = value; + return this; } /// @@ -529,10 +487,10 @@ public DataframeAnalysisRegressionDescriptor Eta(double? eta) /// Advanced configuration option. Specifies the rate at which eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5% for each extra tree. By default, this value is calculated during hyperparameter optimization. It must be between 0.5 and 2. /// /// - public DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(double? etaGrowthRatePerTree) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(double? value) { - EtaGrowthRatePerTreeValue = etaGrowthRatePerTree; - return Self; + Instance.EtaGrowthRatePerTree = value; + return this; } /// @@ -540,10 +498,10 @@ public DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(dou /// Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor FeatureBagFraction(double? featureBagFraction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureBagFraction(double? value) { - FeatureBagFractionValue = featureBagFraction; - return Self; + Instance.FeatureBagFraction = value; + return this; } /// @@ -551,40 +509,38 @@ public DataframeAnalysisRegressionDescriptor FeatureBagFraction(doubl /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public DataframeAnalysisRegressionDescriptor FeatureProcessors(ICollection? featureProcessors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(System.Collections.Generic.ICollection? value) { - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsValue = featureProcessors; - return Self; + Instance.FeatureProcessors = value; + return this; } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(params Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor[] values) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptor = descriptor; - return Self; + Instance.FeatureProcessors = [.. values]; + return this; } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(Action> configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(params System.Action>[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(params Action>[] configure) - { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = configure; - return Self; + Instance.FeatureProcessors = items; + return this; } /// @@ -592,10 +548,10 @@ public DataframeAnalysisRegressionDescriptor FeatureProcessors(params /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies a linear penalty associated with the size of individual trees in the forest. A high gamma value causes training to prefer small trees. A small gamma value results in larger individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisRegressionDescriptor Gamma(double? gamma) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Gamma(double? value) { - GammaValue = gamma; - return Self; + Instance.Gamma = value; + return this; } /// @@ -603,10 +559,10 @@ public DataframeAnalysisRegressionDescriptor Gamma(double? gamma) /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularization term which applies to leaf weights of the individual trees in the forest. A high lambda value causes training to favor small leaf weights. This behavior makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. A small lambda value results in large individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisRegressionDescriptor Lambda(double? lambda) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Lambda(double? value) { - LambdaValue = lambda; - return Self; + Instance.Lambda = value; + return this; } /// @@ -614,10 +570,10 @@ public DataframeAnalysisRegressionDescriptor Lambda(double? lambda) /// The loss function used during regression. Available options are mse (mean squared error), msle (mean squared logarithmic error), huber (Pseudo-Huber loss). /// /// - public DataframeAnalysisRegressionDescriptor LossFunction(string? lossFunction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor LossFunction(string? value) { - LossFunctionValue = lossFunction; - return Self; + Instance.LossFunction = value; + return this; } /// @@ -625,10 +581,10 @@ public DataframeAnalysisRegressionDescriptor LossFunction(string? los /// A positive number that is used as a parameter to the loss_function. /// /// - public DataframeAnalysisRegressionDescriptor LossFunctionParameter(double? lossFunctionParameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor LossFunctionParameter(double? value) { - LossFunctionParameterValue = lossFunctionParameter; - return Self; + Instance.LossFunctionParameter = value; + return this; } /// @@ -636,10 +592,10 @@ public DataframeAnalysisRegressionDescriptor LossFunctionParameter(do /// Advanced configuration option. A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPerHyperparameter(int? maxOptimizationRoundsPerHyperparameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPerHyperparameter(int? value) { - MaxOptimizationRoundsPerHyperparameterValue = maxOptimizationRoundsPerHyperparameter; - return Self; + Instance.MaxOptimizationRoundsPerHyperparameter = value; + return this; } /// @@ -647,10 +603,10 @@ public DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPer /// Advanced configuration option. Defines the maximum number of decision trees in the forest. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor MaxTrees(int? maxTrees) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor MaxTrees(int? value) { - MaxTreesValue = maxTrees; - return Self; + Instance.MaxTrees = value; + return this; } /// @@ -658,10 +614,10 @@ public DataframeAnalysisRegressionDescriptor MaxTrees(int? maxTrees) /// Advanced configuration option. Specifies the maximum number of feature importance values per document to return. By default, no feature importance calculation occurs. /// /// - public DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -669,10 +625,10 @@ public DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceV /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// @@ -680,54 +636,54 @@ public DataframeAnalysisRegressionDescriptor PredictionFieldName(Elas /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor PredictionFieldName(System.Linq.Expressions.Expression> value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// /// - /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. + /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor RandomizeSeed(double? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.RandomizeSeed = value; + return this; } /// /// - /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). + /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. /// /// - public DataframeAnalysisRegressionDescriptor RandomizeSeed(double? randomizeSeed) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor SoftTreeDepthLimit(int? value) { - RandomizeSeedValue = randomizeSeed; - return Self; + Instance.SoftTreeDepthLimit = value; + return this; } /// /// - /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. + /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. /// /// - public DataframeAnalysisRegressionDescriptor SoftTreeDepthLimit(int? softTreeDepthLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(double? value) { - SoftTreeDepthLimitValue = softTreeDepthLimit; - return Self; + Instance.SoftTreeDepthTolerance = value; + return this; } /// /// - /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. + /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(double? softTreeDepthTolerance) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor TrainingPercent(Elastic.Clients.Elasticsearch.Percentage? value) { - SoftTreeDepthToleranceValue = softTreeDepthTolerance; - return Self; + Instance.TrainingPercent = value; + return this; } /// @@ -735,201 +691,49 @@ public DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(d /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisRegressionDescriptor TrainingPercent(double? trainingPercent) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor TrainingPercent(System.Func action) { - TrainingPercentValue = trainingPercent; - return Self; + Instance.TrainingPercent = Elastic.Clients.Elasticsearch.PercentageFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression Build(System.Action> action) { - writer.WriteStartObject(); - if (AlphaValue.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(AlphaValue.Value); - } - - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(DependentVariableValue); - if (DownsampleFactorValue.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(DownsampleFactorValue.Value); - } - - if (EarlyStoppingEnabledValue.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(EarlyStoppingEnabledValue.Value); - } - - if (EtaValue.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(EtaValue.Value); - } - - if (EtaGrowthRatePerTreeValue.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(EtaGrowthRatePerTreeValue.Value); - } - - if (FeatureBagFractionValue.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(FeatureBagFractionValue.Value); - } - - if (FeatureProcessorsDescriptor is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FeatureProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(FeatureProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - foreach (var action in FeatureProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FeatureProcessorsValue is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, FeatureProcessorsValue, options); - } - - if (GammaValue.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(GammaValue.Value); - } - - if (LambdaValue.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(LambdaValue.Value); - } - - if (!string.IsNullOrEmpty(LossFunctionValue)) - { - writer.WritePropertyName("loss_function"); - writer.WriteStringValue(LossFunctionValue); - } - - if (LossFunctionParameterValue.HasValue) - { - writer.WritePropertyName("loss_function_parameter"); - writer.WriteNumberValue(LossFunctionParameterValue.Value); - } - - if (MaxOptimizationRoundsPerHyperparameterValue.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(MaxOptimizationRoundsPerHyperparameterValue.Value); - } - - if (MaxTreesValue.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(MaxTreesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (PredictionFieldNameValue is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, PredictionFieldNameValue, options); - } - - if (RandomizeSeedValue.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(RandomizeSeedValue.Value); - } - - if (SoftTreeDepthLimitValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(SoftTreeDepthLimitValue.Value); - } - - if (SoftTreeDepthToleranceValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(SoftTreeDepthToleranceValue.Value); - } - - if (TrainingPercentValue.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(TrainingPercentValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalysisRegressionDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalysisRegressionDescriptor { - internal DataframeAnalysisRegressionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression Instance { get; init; } - public DataframeAnalysisRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression instance) { + Instance = instance; } - private double? AlphaValue { get; set; } - private string DependentVariableValue { get; set; } - private double? DownsampleFactorValue { get; set; } - private bool? EarlyStoppingEnabledValue { get; set; } - private double? EtaValue { get; set; } - private double? EtaGrowthRatePerTreeValue { get; set; } - private double? FeatureBagFractionValue { get; set; } - private ICollection? FeatureProcessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor FeatureProcessorsDescriptor { get; set; } - private Action FeatureProcessorsDescriptorAction { get; set; } - private Action[] FeatureProcessorsDescriptorActions { get; set; } - private double? GammaValue { get; set; } - private double? LambdaValue { get; set; } - private string? LossFunctionValue { get; set; } - private double? LossFunctionParameterValue { get; set; } - private int? MaxOptimizationRoundsPerHyperparameterValue { get; set; } - private int? MaxTreesValue { get; set; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictionFieldNameValue { get; set; } - private double? RandomizeSeedValue { get; set; } - private int? SoftTreeDepthLimitValue { get; set; } - private double? SoftTreeDepthToleranceValue { get; set; } - private double? TrainingPercentValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalysisRegressionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor descriptor) => descriptor.Instance; /// /// /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This parameter affects loss calculations by acting as a multiplier of the tree depth. Higher alpha values result in shallower trees and faster training times. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to zero. /// /// - public DataframeAnalysisRegressionDescriptor Alpha(double? alpha) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Alpha(double? value) { - AlphaValue = alpha; - return Self; + Instance.Alpha = value; + return this; } /// @@ -939,10 +743,10 @@ public DataframeAnalysisRegressionDescriptor Alpha(double? alpha) /// For regression analysis, the data type of the field must be numeric. /// /// - public DataframeAnalysisRegressionDescriptor DependentVariable(string dependentVariable) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor DependentVariable(string value) { - DependentVariableValue = dependentVariable; - return Self; + Instance.DependentVariable = value; + return this; } /// @@ -950,10 +754,10 @@ public DataframeAnalysisRegressionDescriptor DependentVariable(string dependentV /// Advanced configuration option. Controls the fraction of data that is used to compute the derivatives of the loss function for tree training. A small value results in the use of a small fraction of the data. If this value is set to be less than 1, accuracy typically improves. However, too small a value may result in poor convergence for the ensemble and so require more trees. By default, this value is calculated during hyperparameter optimization. It must be greater than zero and less than or equal to 1. /// /// - public DataframeAnalysisRegressionDescriptor DownsampleFactor(double? downsampleFactor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor DownsampleFactor(double? value) { - DownsampleFactorValue = downsampleFactor; - return Self; + Instance.DownsampleFactor = value; + return this; } /// @@ -961,10 +765,10 @@ public DataframeAnalysisRegressionDescriptor DownsampleFactor(double? downsample /// Advanced configuration option. Specifies whether the training process should finish if it is not finding any better performing models. If disabled, the training process can take significantly longer and the chance of finding a better performing model is unremarkable. /// /// - public DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(bool? earlyStoppingEnabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(bool? value = true) { - EarlyStoppingEnabledValue = earlyStoppingEnabled; - return Self; + Instance.EarlyStoppingEnabled = value; + return this; } /// @@ -972,10 +776,10 @@ public DataframeAnalysisRegressionDescriptor EarlyStoppingEnabled(bool? earlySto /// Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, larger forests cause slower training. By default, this value is calculated during hyperparameter optimization. It must be a value between 0.001 and 1. /// /// - public DataframeAnalysisRegressionDescriptor Eta(double? eta) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Eta(double? value) { - EtaValue = eta; - return Self; + Instance.Eta = value; + return this; } /// @@ -983,10 +787,10 @@ public DataframeAnalysisRegressionDescriptor Eta(double? eta) /// Advanced configuration option. Specifies the rate at which eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5% for each extra tree. By default, this value is calculated during hyperparameter optimization. It must be between 0.5 and 2. /// /// - public DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(double? etaGrowthRatePerTree) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(double? value) { - EtaGrowthRatePerTreeValue = etaGrowthRatePerTree; - return Self; + Instance.EtaGrowthRatePerTree = value; + return this; } /// @@ -994,10 +798,10 @@ public DataframeAnalysisRegressionDescriptor EtaGrowthRatePerTree(double? etaGro /// Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor FeatureBagFraction(double? featureBagFraction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureBagFraction(double? value) { - FeatureBagFractionValue = featureBagFraction; - return Self; + Instance.FeatureBagFraction = value; + return this; } /// @@ -1005,40 +809,55 @@ public DataframeAnalysisRegressionDescriptor FeatureBagFraction(double? featureB /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. /// /// - public DataframeAnalysisRegressionDescriptor FeatureProcessors(ICollection? featureProcessors) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(System.Collections.Generic.ICollection? value) { - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsValue = featureProcessors; - return Self; + Instance.FeatureProcessors = value; + return this; } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor descriptor) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(params Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessor[] values) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptor = descriptor; - return Self; + Instance.FeatureProcessors = [.. values]; + return this; } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(Action configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(params System.Action[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorActions = null; - FeatureProcessorsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } + + Instance.FeatureProcessors = items; + return this; } - public DataframeAnalysisRegressionDescriptor FeatureProcessors(params Action[] configure) + /// + /// + /// Advanced configuration option. A collection of feature preprocessors that modify one or more included fields. The analysis uses the resulting one or more features instead of the original document field. However, these features are ephemeral; they are not stored in the destination index. Multiple feature_processors entries can refer to the same document fields. Automatic categorical feature encoding still occurs for the fields that are unprocessed by a custom processor or that have categorical values. Use this property only if you want to override the automatic feature encoding of the specified fields. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor FeatureProcessors(params System.Action>[] actions) { - FeatureProcessorsValue = null; - FeatureProcessorsDescriptor = null; - FeatureProcessorsDescriptorAction = null; - FeatureProcessorsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor.Build(action)); + } + + Instance.FeatureProcessors = items; + return this; } /// @@ -1046,10 +865,10 @@ public DataframeAnalysisRegressionDescriptor FeatureProcessors(params Action /// - public DataframeAnalysisRegressionDescriptor Gamma(double? gamma) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Gamma(double? value) { - GammaValue = gamma; - return Self; + Instance.Gamma = value; + return this; } /// @@ -1057,10 +876,10 @@ public DataframeAnalysisRegressionDescriptor Gamma(double? gamma) /// Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularization term which applies to leaf weights of the individual trees in the forest. A high lambda value causes training to favor small leaf weights. This behavior makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. A small lambda value results in large individual trees and slower training. By default, this value is calculated during hyperparameter optimization. It must be a nonnegative value. /// /// - public DataframeAnalysisRegressionDescriptor Lambda(double? lambda) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor Lambda(double? value) { - LambdaValue = lambda; - return Self; + Instance.Lambda = value; + return this; } /// @@ -1068,10 +887,10 @@ public DataframeAnalysisRegressionDescriptor Lambda(double? lambda) /// The loss function used during regression. Available options are mse (mean squared error), msle (mean squared logarithmic error), huber (Pseudo-Huber loss). /// /// - public DataframeAnalysisRegressionDescriptor LossFunction(string? lossFunction) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor LossFunction(string? value) { - LossFunctionValue = lossFunction; - return Self; + Instance.LossFunction = value; + return this; } /// @@ -1079,10 +898,10 @@ public DataframeAnalysisRegressionDescriptor LossFunction(string? lossFunction) /// A positive number that is used as a parameter to the loss_function. /// /// - public DataframeAnalysisRegressionDescriptor LossFunctionParameter(double? lossFunctionParameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor LossFunctionParameter(double? value) { - LossFunctionParameterValue = lossFunctionParameter; - return Self; + Instance.LossFunctionParameter = value; + return this; } /// @@ -1090,10 +909,10 @@ public DataframeAnalysisRegressionDescriptor LossFunctionParameter(double? lossF /// Advanced configuration option. A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPerHyperparameter(int? maxOptimizationRoundsPerHyperparameter) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPerHyperparameter(int? value) { - MaxOptimizationRoundsPerHyperparameterValue = maxOptimizationRoundsPerHyperparameter; - return Self; + Instance.MaxOptimizationRoundsPerHyperparameter = value; + return this; } /// @@ -1101,10 +920,10 @@ public DataframeAnalysisRegressionDescriptor MaxOptimizationRoundsPerHyperparame /// Advanced configuration option. Defines the maximum number of decision trees in the forest. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization. /// /// - public DataframeAnalysisRegressionDescriptor MaxTrees(int? maxTrees) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor MaxTrees(int? value) { - MaxTreesValue = maxTrees; - return Self; + Instance.MaxTrees = value; + return this; } /// @@ -1112,10 +931,10 @@ public DataframeAnalysisRegressionDescriptor MaxTrees(int? maxTrees) /// Advanced configuration option. Specifies the maximum number of feature importance values per document to return. By default, no feature importance calculation occurs. /// /// - public DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceValues(int? value) { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -1123,10 +942,10 @@ public DataframeAnalysisRegressionDescriptor NumTopFeatureImportanceValues(int? /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor PredictionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// @@ -1134,54 +953,54 @@ public DataframeAnalysisRegressionDescriptor PredictionFieldName(Elastic.Clients /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor PredictionFieldName(System.Linq.Expressions.Expression> value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.PredictionFieldName = value; + return this; } /// /// - /// Defines the name of the prediction field in the results. Defaults to <dependent_variable>_prediction. + /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). /// /// - public DataframeAnalysisRegressionDescriptor PredictionFieldName(Expression> predictionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor RandomizeSeed(double? value) { - PredictionFieldNameValue = predictionFieldName; - return Self; + Instance.RandomizeSeed = value; + return this; } /// /// - /// Defines the seed for the random generator that is used to pick training data. By default, it is randomly generated. Set it to a specific value to use the same training data each time you start a job (assuming other related parameters such as source and analyzed_fields are the same). + /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. /// /// - public DataframeAnalysisRegressionDescriptor RandomizeSeed(double? randomizeSeed) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor SoftTreeDepthLimit(int? value) { - RandomizeSeedValue = randomizeSeed; - return Self; + Instance.SoftTreeDepthLimit = value; + return this; } /// /// - /// Advanced configuration option. Machine learning uses loss guided tree growing, which means that the decision trees grow where the regularized loss decreases most quickly. This soft limit combines with the soft_tree_depth_tolerance to penalize trees that exceed the specified depth; the regularized loss increases quickly beyond this depth. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0. + /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. /// /// - public DataframeAnalysisRegressionDescriptor SoftTreeDepthLimit(int? softTreeDepthLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(double? value) { - SoftTreeDepthLimitValue = softTreeDepthLimit; - return Self; + Instance.SoftTreeDepthTolerance = value; + return this; } /// /// - /// Advanced configuration option. This option controls how quickly the regularized loss increases when the tree depth exceeds soft_tree_depth_limit. By default, this value is calculated during hyperparameter optimization. It must be greater than or equal to 0.01. + /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(double? softTreeDepthTolerance) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor TrainingPercent(Elastic.Clients.Elasticsearch.Percentage? value) { - SoftTreeDepthToleranceValue = softTreeDepthTolerance; - return Self; + Instance.TrainingPercent = value; + return this; } /// @@ -1189,156 +1008,17 @@ public DataframeAnalysisRegressionDescriptor SoftTreeDepthTolerance(double? soft /// Defines what percentage of the eligible documents that will be used for training. Documents that are ignored by the analysis (for example those that contain arrays with more than one value) won’t be included in the calculation for used percentage. /// /// - public DataframeAnalysisRegressionDescriptor TrainingPercent(double? trainingPercent) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor TrainingPercent(System.Func action) { - TrainingPercentValue = trainingPercent; - return Self; + Instance.TrainingPercent = Elastic.Clients.Elasticsearch.PercentageFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression Build(System.Action action) { - writer.WriteStartObject(); - if (AlphaValue.HasValue) - { - writer.WritePropertyName("alpha"); - writer.WriteNumberValue(AlphaValue.Value); - } - - writer.WritePropertyName("dependent_variable"); - writer.WriteStringValue(DependentVariableValue); - if (DownsampleFactorValue.HasValue) - { - writer.WritePropertyName("downsample_factor"); - writer.WriteNumberValue(DownsampleFactorValue.Value); - } - - if (EarlyStoppingEnabledValue.HasValue) - { - writer.WritePropertyName("early_stopping_enabled"); - writer.WriteBooleanValue(EarlyStoppingEnabledValue.Value); - } - - if (EtaValue.HasValue) - { - writer.WritePropertyName("eta"); - writer.WriteNumberValue(EtaValue.Value); - } - - if (EtaGrowthRatePerTreeValue.HasValue) - { - writer.WritePropertyName("eta_growth_rate_per_tree"); - writer.WriteNumberValue(EtaGrowthRatePerTreeValue.Value); - } - - if (FeatureBagFractionValue.HasValue) - { - writer.WritePropertyName("feature_bag_fraction"); - writer.WriteNumberValue(FeatureBagFractionValue.Value); - } - - if (FeatureProcessorsDescriptor is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FeatureProcessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorAction is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(FeatureProcessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FeatureProcessorsDescriptorActions is not null) - { - writer.WritePropertyName("feature_processors"); - writer.WriteStartArray(); - foreach (var action in FeatureProcessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisFeatureProcessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FeatureProcessorsValue is not null) - { - writer.WritePropertyName("feature_processors"); - JsonSerializer.Serialize(writer, FeatureProcessorsValue, options); - } - - if (GammaValue.HasValue) - { - writer.WritePropertyName("gamma"); - writer.WriteNumberValue(GammaValue.Value); - } - - if (LambdaValue.HasValue) - { - writer.WritePropertyName("lambda"); - writer.WriteNumberValue(LambdaValue.Value); - } - - if (!string.IsNullOrEmpty(LossFunctionValue)) - { - writer.WritePropertyName("loss_function"); - writer.WriteStringValue(LossFunctionValue); - } - - if (LossFunctionParameterValue.HasValue) - { - writer.WritePropertyName("loss_function_parameter"); - writer.WriteNumberValue(LossFunctionParameterValue.Value); - } - - if (MaxOptimizationRoundsPerHyperparameterValue.HasValue) - { - writer.WritePropertyName("max_optimization_rounds_per_hyperparameter"); - writer.WriteNumberValue(MaxOptimizationRoundsPerHyperparameterValue.Value); - } - - if (MaxTreesValue.HasValue) - { - writer.WritePropertyName("max_trees"); - writer.WriteNumberValue(MaxTreesValue.Value); - } - - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (PredictionFieldNameValue is not null) - { - writer.WritePropertyName("prediction_field_name"); - JsonSerializer.Serialize(writer, PredictionFieldNameValue, options); - } - - if (RandomizeSeedValue.HasValue) - { - writer.WritePropertyName("randomize_seed"); - writer.WriteNumberValue(RandomizeSeedValue.Value); - } - - if (SoftTreeDepthLimitValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_limit"); - writer.WriteNumberValue(SoftTreeDepthLimitValue.Value); - } - - if (SoftTreeDepthToleranceValue.HasValue) - { - writer.WritePropertyName("soft_tree_depth_tolerance"); - writer.WriteNumberValue(SoftTreeDepthToleranceValue.Value); - } - - if (TrainingPercentValue.HasValue) - { - writer.WritePropertyName("training_percent"); - writer.WriteNumberValue(TrainingPercentValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegressionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalytics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalytics.g.cs index 8bbbde9a90b..d80c45ac957 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalytics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalytics.g.cs @@ -17,71 +17,200 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAssignmentExplanation = System.Text.Json.JsonEncodedText.Encode("assignment_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropDataCounts = System.Text.Json.JsonEncodedText.Encode("data_counts"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryUsage = System.Text.Json.JsonEncodedText.Encode("memory_usage"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropProgress = System.Text.Json.JsonEncodedText.Encode("progress"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalytics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignmentExplanation = default; + LocalJsonValue propDataCounts = default; + LocalJsonValue propId = default; + LocalJsonValue propMemoryUsage = default; + LocalJsonValue propNode = default; + LocalJsonValue> propProgress = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignmentExplanation.TryReadProperty(ref reader, options, PropAssignmentExplanation, null)) + { + continue; + } + + if (propDataCounts.TryReadProperty(ref reader, options, PropDataCounts, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMemoryUsage.TryReadProperty(ref reader, options, PropMemoryUsage, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propProgress.TryReadProperty(ref reader, options, PropProgress, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalytics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AssignmentExplanation = propAssignmentExplanation.Value, + DataCounts = propDataCounts.Value, + Id = propId.Value, + MemoryUsage = propMemoryUsage.Value, + Node = propNode.Value, + Progress = propProgress.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalytics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignmentExplanation, value.AssignmentExplanation, null, null); + writer.WriteProperty(options, PropDataCounts, value.DataCounts, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMemoryUsage, value.MemoryUsage, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropProgress, value.Progress, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsConverter))] public sealed partial class DataframeAnalytics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalytics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts dataCounts, string id, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage memoryUsage, System.Collections.Generic.IReadOnlyCollection progress, Elastic.Clients.Elasticsearch.MachineLearning.DataframeState state) + { + DataCounts = dataCounts; + Id = id; + MemoryUsage = memoryUsage; + Progress = progress; + State = state; + } +#if NET7_0_OR_GREATER + public DataframeAnalytics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalytics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalytics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For running jobs only, contains messages relating to the selection of a node to run the job. /// /// - [JsonInclude, JsonPropertyName("assignment_explanation")] - public string? AssignmentExplanation { get; init; } + public string? AssignmentExplanation { get; set; } /// /// /// An object that provides counts for the quantity of documents skipped, used in training, or available for testing. /// /// - [JsonInclude, JsonPropertyName("data_counts")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts DataCounts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts DataCounts { get; set; } /// /// /// The unique identifier of the data frame analytics job. /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// An object describing memory usage of the analytics. It is present only after the job is started and memory usage is reported. /// /// - [JsonInclude, JsonPropertyName("memory_usage")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage MemoryUsage { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage MemoryUsage { get; set; } /// /// /// Contains properties for the node that runs the job. This information is available only for running jobs. /// /// - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.NodeAttributes? Node { get; init; } + public Elastic.Clients.Elasticsearch.NodeAttributes? Node { get; set; } /// /// /// The progress report of the data frame analytics job by phase. /// /// - [JsonInclude, JsonPropertyName("progress")] - public IReadOnlyCollection Progress { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Progress { get; set; } /// /// /// The status of the data frame analytics job, which can be one of the following values: failed, started, starting, stopping, stopped. /// /// - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeState State { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeState State { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsAuthorization.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsAuthorization.g.cs index 62c5d3ba6d5..10fb142ea61 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsAuthorization.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsAuthorization.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsAuthorizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropServiceAccount = System.Text.Json.JsonEncodedText.Encode("service_account"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue propServiceAccount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propServiceAccount.TryReadProperty(ref reader, options, PropServiceAccount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Roles = propRoles.Value, + ServiceAccount = propServiceAccount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropServiceAccount, value.ServiceAccount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorizationConverter))] public sealed partial class DataframeAnalyticsAuthorization { +#if NET7_0_OR_GREATER + public DataframeAnalyticsAuthorization() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeAnalyticsAuthorization() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If an API key was used for the most recent update to the job, its name and identifier are listed in the response. /// /// - [JsonInclude, JsonPropertyName("api_key")] - public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; set; } /// /// /// If a user ID was used for the most recent update to the job, its roles at the time of the update are listed in the response. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } /// /// /// If a service account was used for the most recent update to the job, the account name is listed in the response. /// /// - [JsonInclude, JsonPropertyName("service_account")] - public string? ServiceAccount { get; init; } + public string? ServiceAccount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsDestination.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsDestination.g.cs index b353378f8c8..ca5accd66ce 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsDestination.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsDestination.g.cs @@ -17,66 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsDestinationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propResultsField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + ResultsField = propResultsField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationConverter))] public sealed partial class DataframeAnalyticsDestination { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.IndexName index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsDestination() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsDestination() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines the destination index to store the results of the data frame analytics job. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } /// /// /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. /// /// - [JsonInclude, JsonPropertyName("results_field")] public Elastic.Clients.Elasticsearch.Field? ResultsField { get; set; } } -public sealed partial class DataframeAnalyticsDestinationDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalyticsDestinationDescriptor { - internal DataframeAnalyticsDestinationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Instance { get; init; } - public DataframeAnalyticsDestinationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsDestinationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Defines the destination index to store the results of the data frame analytics job. - /// - /// - public DataframeAnalyticsDestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsDestinationDescriptor() { - IndexValue = index; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) => descriptor.Instance; + /// /// - /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. + /// Defines the destination index to store the results of the data frame analytics job. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - ResultsFieldValue = resultsField; - return Self; + Instance.Index = value; + return this; } /// @@ -84,10 +150,10 @@ public DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.C /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -95,58 +161,49 @@ public DataframeAnalyticsDestinationDescriptor ResultsField(E /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (ResultsFieldValue is not null) - { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalyticsDestinationDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalyticsDestinationDescriptor { - internal DataframeAnalyticsDestinationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Instance { get; init; } - public DataframeAnalyticsDestinationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsDestinationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Defines the destination index to store the results of the data frame analytics job. - /// - /// - public DataframeAnalyticsDestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsDestinationDescriptor() { - IndexValue = index; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor descriptor) => descriptor.Instance; + /// /// - /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. + /// Defines the destination index to store the results of the data frame analytics job. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - ResultsFieldValue = resultsField; - return Self; + Instance.Index = value; + return this; } /// @@ -154,10 +211,10 @@ public DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.Clients.Elas /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -165,23 +222,17 @@ public DataframeAnalyticsDestinationDescriptor ResultsField(E /// Defines the name of the field in which to store the results of the analysis. Defaults to ml. /// /// - public DataframeAnalyticsDestinationDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - if (ResultsFieldValue is not null) - { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestinationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsFieldSelection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsFieldSelection.g.cs index 331e606604f..ce8f4e583c2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsFieldSelection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsFieldSelection.g.cs @@ -17,63 +17,179 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsFieldSelectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureType = System.Text.Json.JsonEncodedText.Encode("feature_type"); + private static readonly System.Text.Json.JsonEncodedText PropIsIncluded = System.Text.Json.JsonEncodedText.Encode("is_included"); + private static readonly System.Text.Json.JsonEncodedText PropIsRequired = System.Text.Json.JsonEncodedText.Encode("is_required"); + private static readonly System.Text.Json.JsonEncodedText PropMappingTypes = System.Text.Json.JsonEncodedText.Encode("mapping_types"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsFieldSelection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFeatureType = default; + LocalJsonValue propIsIncluded = default; + LocalJsonValue propIsRequired = default; + LocalJsonValue> propMappingTypes = default; + LocalJsonValue propName = default; + LocalJsonValue propReason = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureType.TryReadProperty(ref reader, options, PropFeatureType, null)) + { + continue; + } + + if (propIsIncluded.TryReadProperty(ref reader, options, PropIsIncluded, null)) + { + continue; + } + + if (propIsRequired.TryReadProperty(ref reader, options, PropIsRequired, null)) + { + continue; + } + + if (propMappingTypes.TryReadProperty(ref reader, options, PropMappingTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsFieldSelection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureType = propFeatureType.Value, + IsIncluded = propIsIncluded.Value, + IsRequired = propIsRequired.Value, + MappingTypes = propMappingTypes.Value, + Name = propName.Value, + Reason = propReason.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsFieldSelection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureType, value.FeatureType, null, null); + writer.WriteProperty(options, PropIsIncluded, value.IsIncluded, null, null); + writer.WriteProperty(options, PropIsRequired, value.IsRequired, null, null); + writer.WriteProperty(options, PropMappingTypes, value.MappingTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsFieldSelectionConverter))] public sealed partial class DataframeAnalyticsFieldSelection { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsFieldSelection(bool isIncluded, bool isRequired, System.Collections.Generic.IReadOnlyCollection mappingTypes, string name) + { + IsIncluded = isIncluded; + IsRequired = isRequired; + MappingTypes = mappingTypes; + Name = name; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsFieldSelection() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsFieldSelection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsFieldSelection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The feature type of this field for the analysis. May be categorical or numerical. /// /// - [JsonInclude, JsonPropertyName("feature_type")] - public string? FeatureType { get; init; } + public string? FeatureType { get; set; } /// /// /// Whether the field is selected to be included in the analysis. /// /// - [JsonInclude, JsonPropertyName("is_included")] - public bool IsIncluded { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsIncluded { get; set; } /// /// /// Whether the field is required. /// /// - [JsonInclude, JsonPropertyName("is_required")] - public bool IsRequired { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsRequired { get; set; } /// /// /// The mapping types of the field. /// /// - [JsonInclude, JsonPropertyName("mapping_types")] - public IReadOnlyCollection MappingTypes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MappingTypes { get; set; } /// /// /// The field name. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// The reason a field is not selected to be included in the analysis. /// /// - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } + public string? Reason { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsMemoryEstimation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsMemoryEstimation.g.cs index c2e75b6aea1..d1e395b5c49 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsMemoryEstimation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsMemoryEstimation.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsMemoryEstimationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpectedMemoryWithDisk = System.Text.Json.JsonEncodedText.Encode("expected_memory_with_disk"); + private static readonly System.Text.Json.JsonEncodedText PropExpectedMemoryWithoutDisk = System.Text.Json.JsonEncodedText.Encode("expected_memory_without_disk"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpectedMemoryWithDisk = default; + LocalJsonValue propExpectedMemoryWithoutDisk = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpectedMemoryWithDisk.TryReadProperty(ref reader, options, PropExpectedMemoryWithDisk, null)) + { + continue; + } + + if (propExpectedMemoryWithoutDisk.TryReadProperty(ref reader, options, PropExpectedMemoryWithoutDisk, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpectedMemoryWithDisk = propExpectedMemoryWithDisk.Value, + ExpectedMemoryWithoutDisk = propExpectedMemoryWithoutDisk.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpectedMemoryWithDisk, value.ExpectedMemoryWithDisk, null, null); + writer.WriteProperty(options, PropExpectedMemoryWithoutDisk, value.ExpectedMemoryWithoutDisk, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsMemoryEstimationConverter))] public sealed partial class DataframeAnalyticsMemoryEstimation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsMemoryEstimation(string expectedMemoryWithDisk, string expectedMemoryWithoutDisk) + { + ExpectedMemoryWithDisk = expectedMemoryWithDisk; + ExpectedMemoryWithoutDisk = expectedMemoryWithoutDisk; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsMemoryEstimation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsMemoryEstimation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsMemoryEstimation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Estimated memory usage under the assumption that overflowing to disk is allowed during data frame analytics. expected_memory_with_disk is usually smaller than expected_memory_without_disk as using disk allows to limit the main memory needed to perform data frame analytics. /// /// - [JsonInclude, JsonPropertyName("expected_memory_with_disk")] - public string ExpectedMemoryWithDisk { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ExpectedMemoryWithDisk { get; set; } /// /// /// Estimated memory usage under the assumption that the whole data frame analytics should happen in memory (i.e. without overflowing to disk). /// /// - [JsonInclude, JsonPropertyName("expected_memory_without_disk")] - public string ExpectedMemoryWithoutDisk { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ExpectedMemoryWithoutDisk { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSource.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSource.g.cs index 76b55d521f2..8406c123a9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSource.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSource.g.cs @@ -17,32 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsSourceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndices = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propRuntimeMappings = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Query = propQuery.Value, + RuntimeMappings = propRuntimeMappings.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceConverter))] public sealed partial class DataframeAnalyticsSource { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Indices indices) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsSource() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsSource() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Index or indices on which to perform the analysis. It can be a single index or index pattern as well as an array of indices or patterns. NOTE: If your source indices contain documents with the same IDs, only the document that is indexed last appears in the destination index. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.Indices Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get; set; } /// /// /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -50,44 +137,44 @@ public sealed partial class DataframeAnalyticsSource /// Definitions of runtime fields that will become part of the mapping of the destination index. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } /// /// /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. /// /// - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? Source { get; set; } } -public sealed partial class DataframeAnalyticsSourceDescriptor : SerializableDescriptor> +public readonly partial struct DataframeAnalyticsSourceDescriptor { - internal DataframeAnalyticsSourceDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Instance { get; init; } - public DataframeAnalyticsSourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSourceDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSourceDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) => descriptor.Instance; /// /// /// Index or indices on which to perform the analysis. It can be a single index or index pattern as well as an array of indices or patterns. NOTE: If your source indices contain documents with the same IDs, only the document that is indexed last appears in the destination index. /// /// - public DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -95,28 +182,32 @@ public DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Ela /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. /// /// - public DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public DataframeAnalyticsSourceDescriptor Query(Action> configure) + /// + /// + /// Definitions of runtime fields that will become part of the mapping of the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = value; + return this; } /// @@ -124,114 +215,121 @@ public DataframeAnalyticsSourceDescriptor Query(Action /// - public DataframeAnalyticsSourceDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings() { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// /// - /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// Definitions of runtime fields that will become part of the mapping of the destination index. /// /// - public DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? source) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings(System.Action>? action) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - public DataframeAnalyticsSourceDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) + { + Instance.Source = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source() + { + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; + } + + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source(System.Action? action) + { + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeAnalyticsSourceDescriptor : SerializableDescriptor +public readonly partial struct DataframeAnalyticsSourceDescriptor { - internal DataframeAnalyticsSourceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSourceDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource instance) + { + Instance = instance; + } - public DataframeAnalyticsSourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) => descriptor.Instance; /// /// /// Index or indices on which to perform the analysis. It can be a single index or index pattern as well as an array of indices or patterns. NOTE: If your source indices contain documents with the same IDs, only the document that is indexed last appears in the destination index. /// /// - public DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -239,28 +337,32 @@ public DataframeAnalyticsSourceDescriptor Indices(Elastic.Clients.Elasticsearch. /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. /// /// - public DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public DataframeAnalyticsSourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public DataframeAnalyticsSourceDescriptor Query(Action configure) + /// + /// + /// The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: {"match_all": {}}. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -268,84 +370,125 @@ public DataframeAnalyticsSourceDescriptor Query(Action /// - public DataframeAnalyticsSourceDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } /// /// - /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// Definitions of runtime fields that will become part of the mapping of the destination index. /// /// - public DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? source) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings() { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } - public DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + /// + /// + /// Definitions of runtime fields that will become part of the mapping of the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings(System.Action? action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - public DataframeAnalyticsSourceDescriptor Source(Action configure) + /// + /// + /// Definitions of runtime fields that will become part of the mapping of the destination index. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor RuntimeMappings(System.Action>? action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) + { + Instance.Source = value; + return this; + } + + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source() + { + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; + } + + /// + /// + /// Specify includes and/or `excludes patterns to select which fields will be present in the destination. Fields that are excluded cannot be included in the analysis. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor Source(System.Action? action) + { + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsDataCounts.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsDataCounts.g.cs index be8a4a23b11..93fd1c7c655 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsDataCounts.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsDataCounts.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsStatsDataCountsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSkippedDocsCount = System.Text.Json.JsonEncodedText.Encode("skipped_docs_count"); + private static readonly System.Text.Json.JsonEncodedText PropTestDocsCount = System.Text.Json.JsonEncodedText.Encode("test_docs_count"); + private static readonly System.Text.Json.JsonEncodedText PropTrainingDocsCount = System.Text.Json.JsonEncodedText.Encode("training_docs_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSkippedDocsCount = default; + LocalJsonValue propTestDocsCount = default; + LocalJsonValue propTrainingDocsCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSkippedDocsCount.TryReadProperty(ref reader, options, PropSkippedDocsCount, null)) + { + continue; + } + + if (propTestDocsCount.TryReadProperty(ref reader, options, PropTestDocsCount, null)) + { + continue; + } + + if (propTrainingDocsCount.TryReadProperty(ref reader, options, PropTrainingDocsCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SkippedDocsCount = propSkippedDocsCount.Value, + TestDocsCount = propTestDocsCount.Value, + TrainingDocsCount = propTrainingDocsCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCounts value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSkippedDocsCount, value.SkippedDocsCount, null, null); + writer.WriteProperty(options, PropTestDocsCount, value.TestDocsCount, null, null); + writer.WriteProperty(options, PropTrainingDocsCount, value.TrainingDocsCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsDataCountsConverter))] public sealed partial class DataframeAnalyticsStatsDataCounts { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsStatsDataCounts(int skippedDocsCount, int testDocsCount, int trainingDocsCount) + { + SkippedDocsCount = skippedDocsCount; + TestDocsCount = testDocsCount; + TrainingDocsCount = trainingDocsCount; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsStatsDataCounts() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsStatsDataCounts() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsStatsDataCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of documents that are skipped during the analysis because they contained values that are not supported by the analysis. For example, outlier detection does not support missing fields so it skips documents with missing fields. Likewise, all types of analysis skip documents that contain arrays with more than one element. /// /// - [JsonInclude, JsonPropertyName("skipped_docs_count")] - public int SkippedDocsCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int SkippedDocsCount { get; set; } /// /// /// The number of documents that are not used for training the model and can be used for testing. /// /// - [JsonInclude, JsonPropertyName("test_docs_count")] - public int TestDocsCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TestDocsCount { get; set; } /// /// /// The number of documents that are used for training the model. /// /// - [JsonInclude, JsonPropertyName("training_docs_count")] - public int TrainingDocsCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TrainingDocsCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsMemoryUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsMemoryUsage.g.cs index 53e45c571df..4edacb8e013 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsMemoryUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsMemoryUsage.g.cs @@ -17,47 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsStatsMemoryUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemoryReestimateBytes = System.Text.Json.JsonEncodedText.Encode("memory_reestimate_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPeakUsageBytes = System.Text.Json.JsonEncodedText.Encode("peak_usage_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemoryReestimateBytes = default; + LocalJsonValue propPeakUsageBytes = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemoryReestimateBytes.TryReadProperty(ref reader, options, PropMemoryReestimateBytes, null)) + { + continue; + } + + if (propPeakUsageBytes.TryReadProperty(ref reader, options, PropPeakUsageBytes, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MemoryReestimateBytes = propMemoryReestimateBytes.Value, + PeakUsageBytes = propPeakUsageBytes.Value, + Status = propStatus.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemoryReestimateBytes, value.MemoryReestimateBytes, null, null); + writer.WriteProperty(options, PropPeakUsageBytes, value.PeakUsageBytes, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsMemoryUsageConverter))] public sealed partial class DataframeAnalyticsStatsMemoryUsage { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsStatsMemoryUsage(long peakUsageBytes, string status) + { + PeakUsageBytes = peakUsageBytes; + Status = status; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsStatsMemoryUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsStatsMemoryUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsStatsMemoryUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// This value is present when the status is hard_limit and it is a new estimate of how much memory the job needs. /// /// - [JsonInclude, JsonPropertyName("memory_reestimate_bytes")] - public long? MemoryReestimateBytes { get; init; } + public long? MemoryReestimateBytes { get; set; } /// /// /// The number of bytes used at the highest peak of memory usage. /// /// - [JsonInclude, JsonPropertyName("peak_usage_bytes")] - public long PeakUsageBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long PeakUsageBytes { get; set; } /// /// /// The memory usage status. /// /// - [JsonInclude, JsonPropertyName("status")] - public string Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Status { get; set; } /// /// /// The timestamp when memory usage was calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } + public System.DateTimeOffset? Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsProgress.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsProgress.g.cs index 8731ecaf8d8..bf56705484a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsProgress.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsStatsProgress.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsStatsProgressConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPhase = System.Text.Json.JsonEncodedText.Encode("phase"); + private static readonly System.Text.Json.JsonEncodedText PropProgressPercent = System.Text.Json.JsonEncodedText.Encode("progress_percent"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsProgress Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPhase = default; + LocalJsonValue propProgressPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPhase.TryReadProperty(ref reader, options, PropPhase, null)) + { + continue; + } + + if (propProgressPercent.TryReadProperty(ref reader, options, PropProgressPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Phase = propPhase.Value, + ProgressPercent = propProgressPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsProgress value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPhase, value.Phase, null, null); + writer.WriteProperty(options, PropProgressPercent, value.ProgressPercent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsStatsProgressConverter))] public sealed partial class DataframeAnalyticsStatsProgress { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsStatsProgress(string phase, int progressPercent) + { + Phase = phase; + ProgressPercent = progressPercent; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsStatsProgress() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsStatsProgress() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsStatsProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines the phase of the data frame analytics job. /// /// - [JsonInclude, JsonPropertyName("phase")] - public string Phase { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Phase { get; set; } /// /// /// The progress that the data frame analytics job has made expressed in percentage. /// /// - [JsonInclude, JsonPropertyName("progress_percent")] - public int ProgressPercent { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ProgressPercent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSummary.g.cs index 5b03b680d55..955d9cefccc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeAnalyticsSummary.g.cs @@ -17,48 +17,220 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeAnalyticsSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyStart = System.Text.Json.JsonEncodedText.Encode("allow_lazy_start"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyStart = default; + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propAuthorization = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propId = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyStart.TryReadProperty(ref reader, options, PropAllowLazyStart, null)) + { + continue; + } + + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyStart = propAllowLazyStart.Value, + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + Authorization = propAuthorization.Value, + CreateTime = propCreateTime.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Id = propId.Value, + MaxNumThreads = propMaxNumThreads.Value, + Meta = propMeta.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyStart, value.AllowLazyStart, null, null); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSummaryConverter))] public sealed partial class DataframeAnalyticsSummary { - [JsonInclude, JsonPropertyName("allow_lazy_start")] - public bool? AllowLazyStart { get; init; } - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; init; } - [JsonInclude, JsonPropertyName("analyzed_fields")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeAnalyticsSummary(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination dest, string id, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + { + Analysis = analysis; + Dest = dest; + Id = id; + Source = source; + } +#if NET7_0_OR_GREATER + public DataframeAnalyticsSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeAnalyticsSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeAnalyticsSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? AllowLazyStart { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } /// /// /// The security privileges that the job uses to run its queries. If Elastic Stack security features were disabled at the time of the most recent update to the job, this property is omitted. /// /// - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public long? CreateTime { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("max_num_threads")] - public int? MaxNumThreads { get; init; } - [JsonInclude, JsonPropertyName("_meta")] - public IReadOnlyDictionary? Meta { get; init; } - [JsonInclude, JsonPropertyName("model_memory_limit")] - public string? ModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsAuthorization? Authorization { get; set; } + public System.DateTimeOffset? CreateTime { get; set; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsDestination Dest { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public int? MaxNumThreads { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } + public string? ModelMemoryLimit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } + public string? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummary.g.cs index b231268d838..881d3623ee1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummary.g.cs @@ -17,25 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeClassificationSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccuracy = System.Text.Json.JsonEncodedText.Encode("accuracy"); + private static readonly System.Text.Json.JsonEncodedText PropAucRoc = System.Text.Json.JsonEncodedText.Encode("auc_roc"); + private static readonly System.Text.Json.JsonEncodedText PropMulticlassConfusionMatrix = System.Text.Json.JsonEncodedText.Encode("multiclass_confusion_matrix"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropRecall = System.Text.Json.JsonEncodedText.Encode("recall"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccuracy = default; + LocalJsonValue propAucRoc = default; + LocalJsonValue propMulticlassConfusionMatrix = default; + LocalJsonValue propPrecision = default; + LocalJsonValue propRecall = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccuracy.TryReadProperty(ref reader, options, PropAccuracy, null)) + { + continue; + } + + if (propAucRoc.TryReadProperty(ref reader, options, PropAucRoc, null)) + { + continue; + } + + if (propMulticlassConfusionMatrix.TryReadProperty(ref reader, options, PropMulticlassConfusionMatrix, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, null)) + { + continue; + } + + if (propRecall.TryReadProperty(ref reader, options, PropRecall, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Accuracy = propAccuracy.Value, + AucRoc = propAucRoc.Value, + MulticlassConfusionMatrix = propMulticlassConfusionMatrix.Value, + Precision = propPrecision.Value, + Recall = propRecall.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccuracy, value.Accuracy, null, null); + writer.WriteProperty(options, PropAucRoc, value.AucRoc, null, null); + writer.WriteProperty(options, PropMulticlassConfusionMatrix, value.MulticlassConfusionMatrix, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, null); + writer.WriteProperty(options, PropRecall, value.Recall, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryConverter))] public sealed partial class DataframeClassificationSummary { +#if NET7_0_OR_GREATER + public DataframeClassificationSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeClassificationSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeClassificationSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Accuracy of predictions (per-class and overall). /// /// - [JsonInclude, JsonPropertyName("accuracy")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracy? Accuracy { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracy? Accuracy { get; set; } /// /// @@ -43,30 +130,26 @@ public sealed partial class DataframeClassificationSummary /// It is calculated for a specific class (provided as "class_name") treated as positive. /// /// - [JsonInclude, JsonPropertyName("auc_roc")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc? AucRoc { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc? AucRoc { get; set; } /// /// /// Multiclass confusion matrix. /// /// - [JsonInclude, JsonPropertyName("multiclass_confusion_matrix")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrix? MulticlassConfusionMatrix { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrix? MulticlassConfusionMatrix { get; set; } /// /// /// Precision of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("precision")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecision? Precision { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecision? Precision { get; set; } /// /// /// Recall of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("recall")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecall? Recall { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecall? Recall { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryAccuracy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryAccuracy.g.cs index 592c12fbcad..05657fa40ca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryAccuracy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryAccuracy.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeClassificationSummaryAccuracyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + private static readonly System.Text.Json.JsonEncodedText PropOverallAccuracy = System.Text.Json.JsonEncodedText.Encode("overall_accuracy"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propClasses = default; + LocalJsonValue propOverallAccuracy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propOverallAccuracy.TryReadProperty(ref reader, options, PropOverallAccuracy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classes = propClasses.Value, + OverallAccuracy = propOverallAccuracy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverallAccuracy, value.OverallAccuracy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryAccuracyConverter))] public sealed partial class DataframeClassificationSummaryAccuracy { - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection Classes { get; init; } - [JsonInclude, JsonPropertyName("overall_accuracy")] - public double OverallAccuracy { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeClassificationSummaryAccuracy(System.Collections.Generic.IReadOnlyCollection classes, double overallAccuracy) + { + Classes = classes; + OverallAccuracy = overallAccuracy; + } +#if NET7_0_OR_GREATER + public DataframeClassificationSummaryAccuracy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeClassificationSummaryAccuracy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeClassificationSummaryAccuracy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Classes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double OverallAccuracy { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryMulticlassConfusionMatrix.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryMulticlassConfusionMatrix.g.cs index 74261a863b8..e10dd3a3ddd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryMulticlassConfusionMatrix.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryMulticlassConfusionMatrix.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeClassificationSummaryMulticlassConfusionMatrixConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfusionMatrix = System.Text.Json.JsonEncodedText.Encode("confusion_matrix"); + private static readonly System.Text.Json.JsonEncodedText PropOtherActualClassCount = System.Text.Json.JsonEncodedText.Encode("other_actual_class_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrix Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propConfusionMatrix = default; + LocalJsonValue propOtherActualClassCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfusionMatrix.TryReadProperty(ref reader, options, PropConfusionMatrix, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propOtherActualClassCount.TryReadProperty(ref reader, options, PropOtherActualClassCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ConfusionMatrix = propConfusionMatrix.Value, + OtherActualClassCount = propOtherActualClassCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrix value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfusionMatrix, value.ConfusionMatrix, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOtherActualClassCount, value.OtherActualClassCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryMulticlassConfusionMatrixConverter))] public sealed partial class DataframeClassificationSummaryMulticlassConfusionMatrix { - [JsonInclude, JsonPropertyName("confusion_matrix")] - public IReadOnlyCollection ConfusionMatrix { get; init; } - [JsonInclude, JsonPropertyName("other_actual_class_count")] - public int OtherActualClassCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeClassificationSummaryMulticlassConfusionMatrix(System.Collections.Generic.IReadOnlyCollection confusionMatrix, int otherActualClassCount) + { + ConfusionMatrix = confusionMatrix; + OtherActualClassCount = otherActualClassCount; + } +#if NET7_0_OR_GREATER + public DataframeClassificationSummaryMulticlassConfusionMatrix() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeClassificationSummaryMulticlassConfusionMatrix() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeClassificationSummaryMulticlassConfusionMatrix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ConfusionMatrix { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int OtherActualClassCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryPrecision.g.cs index b3c5d6671aa..a973742a53a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryPrecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryPrecision.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeClassificationSummaryPrecisionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvgPrecision = System.Text.Json.JsonEncodedText.Encode("avg_precision"); + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecision Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvgPrecision = default; + LocalJsonValue> propClasses = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvgPrecision.TryReadProperty(ref reader, options, PropAvgPrecision, null)) + { + continue; + } + + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvgPrecision = propAvgPrecision.Value, + Classes = propClasses.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecision value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvgPrecision, value.AvgPrecision, null, null); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryPrecisionConverter))] public sealed partial class DataframeClassificationSummaryPrecision { - [JsonInclude, JsonPropertyName("avg_precision")] - public double AvgPrecision { get; init; } - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection Classes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeClassificationSummaryPrecision(double avgPrecision, System.Collections.Generic.IReadOnlyCollection classes) + { + AvgPrecision = avgPrecision; + Classes = classes; + } +#if NET7_0_OR_GREATER + public DataframeClassificationSummaryPrecision() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeClassificationSummaryPrecision() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeClassificationSummaryPrecision(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double AvgPrecision { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Classes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryRecall.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryRecall.g.cs index ca1f1943c28..c522a11c3fa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryRecall.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeClassificationSummaryRecall.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeClassificationSummaryRecallConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvgRecall = System.Text.Json.JsonEncodedText.Encode("avg_recall"); + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecall Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvgRecall = default; + LocalJsonValue> propClasses = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvgRecall.TryReadProperty(ref reader, options, PropAvgRecall, null)) + { + continue; + } + + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvgRecall = propAvgRecall.Value, + Classes = propClasses.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecall value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvgRecall, value.AvgRecall, null, null); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeClassificationSummaryRecallConverter))] public sealed partial class DataframeClassificationSummaryRecall { - [JsonInclude, JsonPropertyName("avg_recall")] - public double AvgRecall { get; init; } - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection Classes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeClassificationSummaryRecall(double avgRecall, System.Collections.Generic.IReadOnlyCollection classes) + { + AvgRecall = avgRecall; + Classes = classes; + } +#if NET7_0_OR_GREATER + public DataframeClassificationSummaryRecall() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeClassificationSummaryRecall() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeClassificationSummaryRecall(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double AvgRecall { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Classes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluation.g.cs index 28d0462487e..4fb266c9311 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluation.g.cs @@ -17,241 +17,372 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(DataframeEvaluationConverter))] -public sealed partial class DataframeEvaluation +internal sealed partial class DataframeEvaluationConverter : System.Text.Json.Serialization.JsonConverter { - internal DataframeEvaluation(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantOutlierDetection = System.Text.Json.JsonEncodedText.Encode("outlier_detection"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); - public static DataframeEvaluation Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification dataframeEvaluationClassification) => new DataframeEvaluation("classification", dataframeEvaluationClassification); - public static DataframeEvaluation OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection dataframeEvaluationOutlierDetection) => new DataframeEvaluation("outlier_detection", dataframeEvaluationOutlierDetection); - public static DataframeEvaluation Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression dataframeEvaluationRegression) => new DataframeEvaluation("regression", dataframeEvaluationRegression); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class DataframeEvaluationConverter : JsonConverter -{ - public override DataframeEvaluation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantOutlierDetection)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantOutlierDetection.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "outlier_detection") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DataframeEvaluation' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DataframeEvaluation(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, DataframeEvaluation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification)value.Variant, options); - break; - case "outlier_detection": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification)value.Variant, null, null); + break; + case "outlier_detection": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation)}'."); } writer.WriteEndObject(); } } -public sealed partial class DataframeEvaluationDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationConverter))] +public sealed partial class DataframeEvaluation { - internal DataframeEvaluationDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public DataframeEvaluation() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection? OutlierDetection { get => GetVariant("outlier_detection"); set => SetVariant("outlier_detection", value); } + + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation { OutlierDetection = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression value) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation { Regression = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } - public DataframeEvaluationDescriptor() : base() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct DataframeEvaluationDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Instance { get; init; } - private DataframeEvaluationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private DataframeEvaluationDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataframeEvaluationDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification dataframeEvaluationClassification) => Set(dataframeEvaluationClassification, "classification"); - public DataframeEvaluationDescriptor Classification(Action> configure) => Set(configure, "classification"); - public DataframeEvaluationDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection dataframeEvaluationOutlierDetection) => Set(dataframeEvaluationOutlierDetection, "outlier_detection"); - public DataframeEvaluationDescriptor OutlierDetection(Action> configure) => Set(configure, "outlier_detection"); - public DataframeEvaluationDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression dataframeEvaluationRegression) => Set(dataframeEvaluationRegression, "regression"); - public DataframeEvaluationDescriptor Regression(Action> configure) => Set(configure, "regression"); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Classification(System.Action> action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection? value) + { + Instance.OutlierDetection = value; + return this; + } + + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor OutlierDetection(System.Action> action) + { + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Regression(System.Action> action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeEvaluationDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationDescriptor { - internal DataframeEvaluationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor descriptor) => descriptor.Instance; - public DataframeEvaluationDescriptor() : base() + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification? value) { + Instance.Classification = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Classification(System.Action action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor.Build(action); + return this; + } - private DataframeEvaluationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Classification evaluation evaluates the results of a classification analysis which outputs a prediction that identifies to which of the classes each document belongs. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Classification(System.Action> action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor.Build(action); + return this; } - private DataframeEvaluationDescriptor Set(object variant, string variantName) + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.OutlierDetection = value; + return this; } - public DataframeEvaluationDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification dataframeEvaluationClassification) => Set(dataframeEvaluationClassification, "classification"); - public DataframeEvaluationDescriptor Classification(Action configure) => Set(configure, "classification"); - public DataframeEvaluationDescriptor OutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection dataframeEvaluationOutlierDetection) => Set(dataframeEvaluationOutlierDetection, "outlier_detection"); - public DataframeEvaluationDescriptor OutlierDetection(Action configure) => Set(configure, "outlier_detection"); - public DataframeEvaluationDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression dataframeEvaluationRegression) => Set(dataframeEvaluationRegression, "regression"); - public DataframeEvaluationDescriptor Regression(Action configure) => Set(configure, "regression"); + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor OutlierDetection(System.Action action) + { + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Outlier detection evaluates the results of an outlier detection analysis which outputs the probability that each document is an outlier. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor OutlierDetection(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.OutlierDetection = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression? value) + { + Instance.Regression = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Regression(System.Action action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression evaluation evaluates the results of a regression analysis which outputs a prediction of values. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor Regression(System.Action> action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClass.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClass.g.cs index 2baed4fcc75..f5b389cb2d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClass.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClass.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationClassConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClass Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClass(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClass value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassConverter))] public sealed partial class DataframeEvaluationClass { - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } - [JsonInclude, JsonPropertyName("value")] - public double Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClass(string className, double value) + { + ClassName = className; + Value = value; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationClass() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationClass() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationClass(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassification.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassification.g.cs index 506c353f166..99d1cc731b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassification.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassification.g.cs @@ -17,32 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationClassificationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActualField = System.Text.Json.JsonEncodedText.Encode("actual_field"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedField = System.Text.Json.JsonEncodedText.Encode("predicted_field"); + private static readonly System.Text.Json.JsonEncodedText PropTopClassesField = System.Text.Json.JsonEncodedText.Encode("top_classes_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActualField = default; + LocalJsonValue propMetrics = default; + LocalJsonValue propPredictedField = default; + LocalJsonValue propTopClassesField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActualField.TryReadProperty(ref reader, options, PropActualField, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, null)) + { + continue; + } + + if (propPredictedField.TryReadProperty(ref reader, options, PropPredictedField, null)) + { + continue; + } + + if (propTopClassesField.TryReadProperty(ref reader, options, PropTopClassesField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActualField = propActualField.Value, + Metrics = propMetrics.Value, + PredictedField = propPredictedField.Value, + TopClassesField = propTopClassesField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActualField, value.ActualField, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, null); + writer.WriteProperty(options, PropPredictedField, value.PredictedField, null, null); + writer.WriteProperty(options, PropTopClassesField, value.TopClassesField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationConverter))] public sealed partial class DataframeEvaluationClassification { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Field actualField) + { + ActualField = actualField; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationClassification() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationClassification() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - [JsonInclude, JsonPropertyName("actual_field")] - public Elastic.Clients.Elasticsearch.Field ActualField { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field ActualField { get; set; } /// /// /// Specifies the metrics that are used for the evaluation. /// /// - [JsonInclude, JsonPropertyName("metrics")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? Metrics { get; set; } /// @@ -50,7 +137,6 @@ public sealed partial class DataframeEvaluationClassification /// The field in the index which contains the predicted value, in other words the results of the classification analysis. /// /// - [JsonInclude, JsonPropertyName("predicted_field")] public Elastic.Clients.Elasticsearch.Field? PredictedField { get; set; } /// @@ -58,47 +144,37 @@ public sealed partial class DataframeEvaluationClassification /// The field of the index which is an array of documents of the form { "class_name": XXX, "class_probability": YYY }. This field must be defined as nested in the mappings. /// /// - [JsonInclude, JsonPropertyName("top_classes_field")] public Elastic.Clients.Elasticsearch.Field? TopClassesField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(DataframeEvaluationClassification dataframeEvaluationClassification) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation.Classification(dataframeEvaluationClassification); } -public sealed partial class DataframeEvaluationClassificationDescriptor : SerializableDescriptor> +public readonly partial struct DataframeEvaluationClassificationDescriptor { - internal DataframeEvaluationClassificationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification Instance { get; init; } - public DataframeEvaluationClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictedFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TopClassesFieldValue { get; set; } - - /// - /// - /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). - /// - /// - public DataframeEvaluationClassificationDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationDescriptor() { - ActualFieldValue = actualField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationClassificationDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -106,10 +182,10 @@ public DataframeEvaluationClassificationDescriptor ActualField /// - public DataframeEvaluationClassificationDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -117,50 +193,32 @@ public DataframeEvaluationClassificationDescriptor ActualField(Expres /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? metrics) - { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor descriptor) - { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationClassificationDescriptor Metrics(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? value) { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = value; + return this; } /// /// - /// The field in the index which contains the predicted value, in other words the results of the classification analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field? predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics() { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor.Build(null); + return this; } /// /// - /// The field in the index which contains the predicted value, in other words the results of the classification analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics(System.Action? action) { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor.Build(action); + return this; } /// @@ -168,21 +226,21 @@ public DataframeEvaluationClassificationDescriptor PredictedField /// - public DataframeEvaluationClassificationDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field? value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } /// /// - /// The field of the index which is an array of documents of the form { "class_name": XXX, "class_probability": YYY }. This field must be defined as nested in the mappings. + /// The field in the index which contains the predicted value, in other words the results of the classification analysis. /// /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Elastic.Clients.Elasticsearch.Field? topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor PredictedField(System.Linq.Expressions.Expression> value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.PredictedField = value; + return this; } /// @@ -190,10 +248,10 @@ public DataframeEvaluationClassificationDescriptor TopClassesField(El /// The field of the index which is an array of documents of the form { "class_name": XXX, "class_probability": YYY }. This field must be defined as nested in the mappings. /// /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Expression> topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor TopClassesField(Elastic.Clients.Elasticsearch.Field? value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.TopClassesField = value; + return this; } /// @@ -201,84 +259,49 @@ public DataframeEvaluationClassificationDescriptor TopClassesField /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Expression> topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor TopClassesField(System.Linq.Expressions.Expression> value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.TopClassesField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - if (PredictedFieldValue is not null) - { - writer.WritePropertyName("predicted_field"); - JsonSerializer.Serialize(writer, PredictedFieldValue, options); - } - - if (TopClassesFieldValue is not null) - { - writer.WritePropertyName("top_classes_field"); - JsonSerializer.Serialize(writer, TopClassesFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeEvaluationClassificationDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationClassificationDescriptor { - internal DataframeEvaluationClassificationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification Instance { get; init; } - public DataframeEvaluationClassificationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? PredictedFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TopClassesFieldValue { get; set; } - - /// - /// - /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). - /// - /// - public DataframeEvaluationClassificationDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationDescriptor() { - ActualFieldValue = actualField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor descriptor) => descriptor.Instance; + /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationClassificationDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -286,10 +309,10 @@ public DataframeEvaluationClassificationDescriptor ActualField /// - public DataframeEvaluationClassificationDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -297,50 +320,32 @@ public DataframeEvaluationClassificationDescriptor ActualField(Expres /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? metrics) - { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics? value) { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationClassificationDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = value; + return this; } /// /// - /// The field in the index which contains the predicted value, in other words the results of the classification analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field? predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics() { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor.Build(null); + return this; } /// /// - /// The field in the index which contains the predicted value, in other words the results of the classification analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationClassificationDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor Metrics(System.Action? action) { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor.Build(action); + return this; } /// @@ -348,21 +353,21 @@ public DataframeEvaluationClassificationDescriptor PredictedField /// - public DataframeEvaluationClassificationDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field? value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } /// /// - /// The field of the index which is an array of documents of the form { "class_name": XXX, "class_probability": YYY }. This field must be defined as nested in the mappings. + /// The field in the index which contains the predicted value, in other words the results of the classification analysis. /// /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Elastic.Clients.Elasticsearch.Field? topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor PredictedField(System.Linq.Expressions.Expression> value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.PredictedField = value; + return this; } /// @@ -370,10 +375,10 @@ public DataframeEvaluationClassificationDescriptor TopClassesField(Elastic.Clien /// The field of the index which is an array of documents of the form { "class_name": XXX, "class_probability": YYY }. This field must be defined as nested in the mappings. /// /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Expression> topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor TopClassesField(Elastic.Clients.Elasticsearch.Field? value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.TopClassesField = value; + return this; } /// @@ -381,45 +386,17 @@ public DataframeEvaluationClassificationDescriptor TopClassesField /// - public DataframeEvaluationClassificationDescriptor TopClassesField(Expression> topClassesField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor TopClassesField(System.Linq.Expressions.Expression> value) { - TopClassesFieldValue = topClassesField; - return Self; + Instance.TopClassesField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - if (PredictedFieldValue is not null) - { - writer.WritePropertyName("predicted_field"); - JsonSerializer.Serialize(writer, PredictedFieldValue, options); - } - - if (TopClassesFieldValue is not null) - { - writer.WritePropertyName("top_classes_field"); - JsonSerializer.Serialize(writer, TopClassesFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassification(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetrics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetrics.g.cs index 545ba7f9664..96b83526078 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetrics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetrics.g.cs @@ -17,32 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationClassificationMetricsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccuracy = System.Text.Json.JsonEncodedText.Encode("accuracy"); + private static readonly System.Text.Json.JsonEncodedText PropAucRoc = System.Text.Json.JsonEncodedText.Encode("auc_roc"); + private static readonly System.Text.Json.JsonEncodedText PropMulticlassConfusionMatrix = System.Text.Json.JsonEncodedText.Encode("multiclass_confusion_matrix"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropRecall = System.Text.Json.JsonEncodedText.Encode("recall"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAccuracy = default; + LocalJsonValue propAucRoc = default; + LocalJsonValue?> propMulticlassConfusionMatrix = default; + LocalJsonValue?> propPrecision = default; + LocalJsonValue?> propRecall = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccuracy.TryReadProperty(ref reader, options, PropAccuracy, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAucRoc.TryReadProperty(ref reader, options, PropAucRoc, null)) + { + continue; + } + + if (propMulticlassConfusionMatrix.TryReadProperty(ref reader, options, PropMulticlassConfusionMatrix, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRecall.TryReadProperty(ref reader, options, PropRecall, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Accuracy = propAccuracy.Value, + AucRoc = propAucRoc.Value, + MulticlassConfusionMatrix = propMulticlassConfusionMatrix.Value, + Precision = propPrecision.Value, + Recall = propRecall.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccuracy, value.Accuracy, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAucRoc, value.AucRoc, null, null); + writer.WriteProperty(options, PropMulticlassConfusionMatrix, value.MulticlassConfusionMatrix, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPrecision, value.Precision, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRecall, value.Recall, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsConverter))] public sealed partial class DataframeEvaluationClassificationMetrics { +#if NET7_0_OR_GREATER + public DataframeEvaluationClassificationMetrics() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationClassificationMetrics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Accuracy of predictions (per-class and overall). /// /// - [JsonInclude, JsonPropertyName("accuracy")] - public IDictionary? Accuracy { get; set; } + public System.Collections.Generic.IDictionary? Accuracy { get; set; } /// /// /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. /// /// - [JsonInclude, JsonPropertyName("auc_roc")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? AucRoc { get; set; } /// @@ -50,51 +136,80 @@ public sealed partial class DataframeEvaluationClassificationMetrics /// Multiclass confusion matrix. /// /// - [JsonInclude, JsonPropertyName("multiclass_confusion_matrix")] - public IDictionary? MulticlassConfusionMatrix { get; set; } + public System.Collections.Generic.IDictionary? MulticlassConfusionMatrix { get; set; } /// /// /// Precision of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("precision")] - public IDictionary? Precision { get; set; } + public System.Collections.Generic.IDictionary? Precision { get; set; } /// /// /// Recall of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("recall")] - public IDictionary? Recall { get; set; } + public System.Collections.Generic.IDictionary? Recall { get; set; } } -public sealed partial class DataframeEvaluationClassificationMetricsDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationClassificationMetricsDescriptor { - internal DataframeEvaluationClassificationMetricsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics instance) + { + Instance = instance; + } - public DataframeEvaluationClassificationMetricsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationMetricsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary? AccuracyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? AucRocValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor AucRocDescriptor { get; set; } - private Action AucRocDescriptorAction { get; set; } - private IDictionary? MulticlassConfusionMatrixValue { get; set; } - private IDictionary? PrecisionValue { get; set; } - private IDictionary? RecallValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor descriptor) => descriptor.Instance; /// /// /// Accuracy of predictions (per-class and overall). /// /// - public DataframeEvaluationClassificationMetricsDescriptor Accuracy(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Accuracy(System.Collections.Generic.IDictionary? value) { - AccuracyValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Accuracy = value; + return this; + } + + /// + /// + /// Accuracy of predictions (per-class and overall). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Accuracy() + { + Instance.Accuracy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Accuracy of predictions (per-class and overall). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Accuracy(System.Action? action) + { + Instance.Accuracy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AddAccuracy(string key, object value) + { + Instance.Accuracy ??= new System.Collections.Generic.Dictionary(); + Instance.Accuracy.Add(key, value); + return this; } /// @@ -102,28 +217,32 @@ public DataframeEvaluationClassificationMetricsDescriptor Accuracy(Func /// - public DataframeEvaluationClassificationMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? aucRoc) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? value) { - AucRocDescriptor = null; - AucRocDescriptorAction = null; - AucRocValue = aucRoc; - return Self; + Instance.AucRoc = value; + return this; } - public DataframeEvaluationClassificationMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor descriptor) + /// + /// + /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AucRoc() { - AucRocValue = null; - AucRocDescriptorAction = null; - AucRocDescriptor = descriptor; - return Self; + Instance.AucRoc = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor.Build(null); + return this; } - public DataframeEvaluationClassificationMetricsDescriptor AucRoc(Action configure) + /// + /// + /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AucRoc(System.Action? action) { - AucRocValue = null; - AucRocDescriptor = null; - AucRocDescriptorAction = configure; - return Self; + Instance.AucRoc = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor.Build(action); + return this; } /// @@ -131,10 +250,39 @@ public DataframeEvaluationClassificationMetricsDescriptor AucRoc(Action /// - public DataframeEvaluationClassificationMetricsDescriptor MulticlassConfusionMatrix(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor MulticlassConfusionMatrix(System.Collections.Generic.IDictionary? value) { - MulticlassConfusionMatrixValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.MulticlassConfusionMatrix = value; + return this; + } + + /// + /// + /// Multiclass confusion matrix. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor MulticlassConfusionMatrix() + { + Instance.MulticlassConfusionMatrix = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Multiclass confusion matrix. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor MulticlassConfusionMatrix(System.Action? action) + { + Instance.MulticlassConfusionMatrix = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AddMulticlassConfusionMatrix(string key, object value) + { + Instance.MulticlassConfusionMatrix ??= new System.Collections.Generic.Dictionary(); + Instance.MulticlassConfusionMatrix.Add(key, value); + return this; } /// @@ -142,66 +290,91 @@ public DataframeEvaluationClassificationMetricsDescriptor MulticlassConfusionMat /// Precision of predictions (per-class and average). /// /// - public DataframeEvaluationClassificationMetricsDescriptor Precision(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Precision(System.Collections.Generic.IDictionary? value) { - PrecisionValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Precision = value; + return this; } /// /// - /// Recall of predictions (per-class and average). + /// Precision of predictions (per-class and average). /// /// - public DataframeEvaluationClassificationMetricsDescriptor Recall(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Precision() { - RecallValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Precision = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Precision of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Precision(System.Action? action) { - writer.WriteStartObject(); - if (AccuracyValue is not null) - { - writer.WritePropertyName("accuracy"); - JsonSerializer.Serialize(writer, AccuracyValue, options); - } + Instance.Precision = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (AucRocDescriptor is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, AucRocDescriptor, options); - } - else if (AucRocDescriptorAction is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor(AucRocDescriptorAction), options); - } - else if (AucRocValue is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, AucRocValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AddPrecision(string key, object value) + { + Instance.Precision ??= new System.Collections.Generic.Dictionary(); + Instance.Precision.Add(key, value); + return this; + } - if (MulticlassConfusionMatrixValue is not null) - { - writer.WritePropertyName("multiclass_confusion_matrix"); - JsonSerializer.Serialize(writer, MulticlassConfusionMatrixValue, options); - } + /// + /// + /// Recall of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Recall(System.Collections.Generic.IDictionary? value) + { + Instance.Recall = value; + return this; + } - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } + /// + /// + /// Recall of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Recall() + { + Instance.Recall = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Recall of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor Recall(System.Action? action) + { + Instance.Recall = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor AddRecall(string key, object value) + { + Instance.Recall ??= new System.Collections.Generic.Dictionary(); + Instance.Recall.Add(key, value); + return this; + } - if (RecallValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("recall"); - JsonSerializer.Serialize(writer, RecallValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetricsAucRoc.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetricsAucRoc.g.cs index 2fed2d49533..9ae2088ecd1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetricsAucRoc.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationClassificationMetricsAucRoc.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationClassificationMetricsAucRocConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeCurve = System.Text.Json.JsonEncodedText.Encode("include_curve"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propIncludeCurve = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propIncludeCurve.TryReadProperty(ref reader, options, PropIncludeCurve, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + IncludeCurve = propIncludeCurve.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropIncludeCurve, value.IncludeCurve, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocConverter))] public sealed partial class DataframeEvaluationClassificationMetricsAucRoc { +#if NET7_0_OR_GREATER + public DataframeEvaluationClassificationMetricsAucRoc() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationClassificationMetricsAucRoc() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Name of the only class that is treated as positive during AUC ROC calculation. Other classes are treated as negative ("one-vs-all" strategy). All the evaluated documents must have class_name in the list of their top classes. /// /// - [JsonInclude, JsonPropertyName("class_name")] public Elastic.Clients.Elasticsearch.Name? ClassName { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class DataframeEvaluationClassificationMetricsAucRoc /// Whether or not the curve should be returned in addition to the score. Default value is false. /// /// - [JsonInclude, JsonPropertyName("include_curve")] public bool? IncludeCurve { get; set; } } -public sealed partial class DataframeEvaluationClassificationMetricsAucRocDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationClassificationMetricsAucRocDescriptor { - internal DataframeEvaluationClassificationMetricsAucRocDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc Instance { get; init; } - public DataframeEvaluationClassificationMetricsAucRocDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationMetricsAucRocDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Name? ClassNameValue { get; set; } - private bool? IncludeCurveValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationClassificationMetricsAucRocDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor descriptor) => descriptor.Instance; /// /// /// Name of the only class that is treated as positive during AUC ROC calculation. Other classes are treated as negative ("one-vs-all" strategy). All the evaluated documents must have class_name in the list of their top classes. /// /// - public DataframeEvaluationClassificationMetricsAucRocDescriptor ClassName(Elastic.Clients.Elasticsearch.Name? className) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor ClassName(Elastic.Clients.Elasticsearch.Name? value) { - ClassNameValue = className; - return Self; + Instance.ClassName = value; + return this; } /// @@ -73,27 +140,22 @@ public DataframeEvaluationClassificationMetricsAucRocDescriptor ClassName(Elasti /// Whether or not the curve should be returned in addition to the score. Default value is false. /// /// - public DataframeEvaluationClassificationMetricsAucRocDescriptor IncludeCurve(bool? includeCurve = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor IncludeCurve(bool? value = true) { - IncludeCurveValue = includeCurve; - return Self; + Instance.IncludeCurve = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc Build(System.Action? action) { - writer.WriteStartObject(); - if (ClassNameValue is not null) + if (action is null) { - writer.WritePropertyName("class_name"); - JsonSerializer.Serialize(writer, ClassNameValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IncludeCurveValue.HasValue) - { - writer.WritePropertyName("include_curve"); - writer.WriteBooleanValue(IncludeCurveValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetection.g.cs index ff32e4ff559..77513fb014d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetection.g.cs @@ -17,32 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationOutlierDetectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActualField = System.Text.Json.JsonEncodedText.Encode("actual_field"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedProbabilityField = System.Text.Json.JsonEncodedText.Encode("predicted_probability_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActualField = default; + LocalJsonValue propMetrics = default; + LocalJsonValue propPredictedProbabilityField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActualField.TryReadProperty(ref reader, options, PropActualField, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, null)) + { + continue; + } + + if (propPredictedProbabilityField.TryReadProperty(ref reader, options, PropPredictedProbabilityField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActualField = propActualField.Value, + Metrics = propMetrics.Value, + PredictedProbabilityField = propPredictedProbabilityField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActualField, value.ActualField, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, null); + writer.WriteProperty(options, PropPredictedProbabilityField, value.PredictedProbabilityField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionConverter))] public sealed partial class DataframeEvaluationOutlierDetection { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Field actualField, Elastic.Clients.Elasticsearch.Field predictedProbabilityField) + { + ActualField = actualField; + PredictedProbabilityField = predictedProbabilityField; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationOutlierDetection() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationOutlierDetection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - [JsonInclude, JsonPropertyName("actual_field")] - public Elastic.Clients.Elasticsearch.Field ActualField { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field ActualField { get; set; } /// /// /// Specifies the metrics that are used for the evaluation. /// /// - [JsonInclude, JsonPropertyName("metrics")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? Metrics { get; set; } /// @@ -50,35 +129,41 @@ public sealed partial class DataframeEvaluationOutlierDetection /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. /// /// - [JsonInclude, JsonPropertyName("predicted_probability_field")] - public Elastic.Clients.Elasticsearch.Field PredictedProbabilityField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(DataframeEvaluationOutlierDetection dataframeEvaluationOutlierDetection) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation.OutlierDetection(dataframeEvaluationOutlierDetection); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field PredictedProbabilityField { get; set; } } -public sealed partial class DataframeEvaluationOutlierDetectionDescriptor : SerializableDescriptor> +public readonly partial struct DataframeEvaluationOutlierDetectionDescriptor { - internal DataframeEvaluationOutlierDetectionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection Instance { get; init; } - public DataframeEvaluationOutlierDetectionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PredictedProbabilityFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor descriptor) => descriptor.Instance; /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -86,21 +171,21 @@ public DataframeEvaluationOutlierDetectionDescriptor ActualField(Elas /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// /// - /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? value) { - ActualFieldValue = actualField; - return Self; + Instance.Metrics = value; + return this; } /// @@ -108,39 +193,21 @@ public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expr /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? metrics) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics() { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor descriptor) - { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor.Build(null); + return this; } /// /// - /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Elastic.Clients.Elasticsearch.Field predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics(System.Action? action) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor.Build(action); + return this; } /// @@ -148,10 +215,10 @@ public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabi /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. /// /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Expression> predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Elastic.Clients.Elasticsearch.Field value) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.PredictedProbabilityField = value; + return this; } /// @@ -159,62 +226,49 @@ public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabi /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. /// /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Expression> predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(System.Linq.Expressions.Expression> value) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.PredictedProbabilityField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - writer.WritePropertyName("predicted_probability_field"); - JsonSerializer.Serialize(writer, PredictedProbabilityFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeEvaluationOutlierDetectionDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationOutlierDetectionDescriptor { - internal DataframeEvaluationOutlierDetectionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection Instance { get; init; } - public DataframeEvaluationOutlierDetectionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PredictedProbabilityFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor descriptor) => descriptor.Instance; /// /// /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -222,21 +276,21 @@ public DataframeEvaluationOutlierDetectionDescriptor ActualField(Elastic.Clients /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// /// - /// The field of the index which contains the ground truth. The data type of this field can be boolean or integer. If the data type is integer, the value has to be either 0 (false) or 1 (true). + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? value) { - ActualFieldValue = actualField; - return Self; + Instance.Metrics = value; + return this; } /// @@ -244,39 +298,21 @@ public DataframeEvaluationOutlierDetectionDescriptor ActualField(Expr /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics? metrics) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics() { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor descriptor) - { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationOutlierDetectionDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor.Build(null); + return this; } /// /// - /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. + /// Specifies the metrics that are used for the evaluation. /// /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Elastic.Clients.Elasticsearch.Field predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor Metrics(System.Action? action) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor.Build(action); + return this; } /// @@ -284,10 +320,10 @@ public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(E /// The field of the index that defines the probability of whether the item belongs to the class in question or not. It’s the field that contains the results of the analysis. /// /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Expression> predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Elastic.Clients.Elasticsearch.Field value) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.PredictedProbabilityField = value; + return this; } /// @@ -295,35 +331,17 @@ public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField /// - public DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(Expression> predictedProbabilityField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor PredictedProbabilityField(System.Linq.Expressions.Expression> value) { - PredictedProbabilityFieldValue = predictedProbabilityField; - return Self; + Instance.PredictedProbabilityField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - writer.WritePropertyName("predicted_probability_field"); - JsonSerializer.Serialize(writer, PredictedProbabilityFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetectionMetrics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetectionMetrics.g.cs index b5f6efcb923..baf967a46b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetectionMetrics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationOutlierDetectionMetrics.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationOutlierDetectionMetricsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAucRoc = System.Text.Json.JsonEncodedText.Encode("auc_roc"); + private static readonly System.Text.Json.JsonEncodedText PropConfusionMatrix = System.Text.Json.JsonEncodedText.Encode("confusion_matrix"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropRecall = System.Text.Json.JsonEncodedText.Encode("recall"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAucRoc = default; + LocalJsonValue?> propConfusionMatrix = default; + LocalJsonValue?> propPrecision = default; + LocalJsonValue?> propRecall = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAucRoc.TryReadProperty(ref reader, options, PropAucRoc, null)) + { + continue; + } + + if (propConfusionMatrix.TryReadProperty(ref reader, options, PropConfusionMatrix, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRecall.TryReadProperty(ref reader, options, PropRecall, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AucRoc = propAucRoc.Value, + ConfusionMatrix = propConfusionMatrix.Value, + Precision = propPrecision.Value, + Recall = propRecall.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAucRoc, value.AucRoc, null, null); + writer.WriteProperty(options, PropConfusionMatrix, value.ConfusionMatrix, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPrecision, value.Precision, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRecall, value.Recall, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsConverter))] public sealed partial class DataframeEvaluationOutlierDetectionMetrics { +#if NET7_0_OR_GREATER + public DataframeEvaluationOutlierDetectionMetrics() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationOutlierDetectionMetrics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. /// /// - [JsonInclude, JsonPropertyName("auc_roc")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? AucRoc { get; set; } /// @@ -42,68 +120,95 @@ public sealed partial class DataframeEvaluationOutlierDetectionMetrics /// Accuracy of predictions (per-class and overall). /// /// - [JsonInclude, JsonPropertyName("confusion_matrix")] - public IDictionary? ConfusionMatrix { get; set; } + public System.Collections.Generic.IDictionary? ConfusionMatrix { get; set; } /// /// /// Precision of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("precision")] - public IDictionary? Precision { get; set; } + public System.Collections.Generic.IDictionary? Precision { get; set; } /// /// /// Recall of predictions (per-class and average). /// /// - [JsonInclude, JsonPropertyName("recall")] - public IDictionary? Recall { get; set; } + public System.Collections.Generic.IDictionary? Recall { get; set; } } -public sealed partial class DataframeEvaluationOutlierDetectionMetricsDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationOutlierDetectionMetricsDescriptor { - internal DataframeEvaluationOutlierDetectionMetricsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics Instance { get; init; } - public DataframeEvaluationOutlierDetectionMetricsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? AucRocValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor AucRocDescriptor { get; set; } - private Action AucRocDescriptorAction { get; set; } - private IDictionary? ConfusionMatrixValue { get; set; } - private IDictionary? PrecisionValue { get; set; } - private IDictionary? RecallValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationOutlierDetectionMetricsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor descriptor) => descriptor.Instance; /// /// /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. /// /// - public DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? aucRoc) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRoc? value) { - AucRocDescriptor = null; - AucRocDescriptorAction = null; - AucRocValue = aucRoc; - return Self; + Instance.AucRoc = value; + return this; } - public DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor descriptor) + /// + /// + /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc() { - AucRocValue = null; - AucRocDescriptorAction = null; - AucRocDescriptor = descriptor; - return Self; + Instance.AucRoc = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor.Build(null); + return this; } - public DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(Action configure) + /// + /// + /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. It is calculated for a specific class (provided as "class_name") treated as positive. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(System.Action? action) + { + Instance.AucRoc = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor.Build(action); + return this; + } + + /// + /// + /// Accuracy of predictions (per-class and overall). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor ConfusionMatrix(System.Collections.Generic.IDictionary? value) + { + Instance.ConfusionMatrix = value; + return this; + } + + /// + /// + /// Accuracy of predictions (per-class and overall). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor ConfusionMatrix() { - AucRocValue = null; - AucRocDescriptor = null; - AucRocDescriptorAction = configure; - return Self; + Instance.ConfusionMatrix = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -111,10 +216,17 @@ public DataframeEvaluationOutlierDetectionMetricsDescriptor AucRoc(Action /// - public DataframeEvaluationOutlierDetectionMetricsDescriptor ConfusionMatrix(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor ConfusionMatrix(System.Action? action) + { + Instance.ConfusionMatrix = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AddConfusionMatrix(string key, object value) { - ConfusionMatrixValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.ConfusionMatrix ??= new System.Collections.Generic.Dictionary(); + Instance.ConfusionMatrix.Add(key, value); + return this; } /// @@ -122,10 +234,39 @@ public DataframeEvaluationOutlierDetectionMetricsDescriptor ConfusionMatrix(Func /// Precision of predictions (per-class and average). /// /// - public DataframeEvaluationOutlierDetectionMetricsDescriptor Precision(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Precision(System.Collections.Generic.IDictionary? value) { - PrecisionValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Precision = value; + return this; + } + + /// + /// + /// Precision of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Precision() + { + Instance.Precision = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Precision of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Precision(System.Action? action) + { + Instance.Precision = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AddPrecision(string key, object value) + { + Instance.Precision ??= new System.Collections.Generic.Dictionary(); + Instance.Precision.Add(key, value); + return this; } /// @@ -133,49 +274,51 @@ public DataframeEvaluationOutlierDetectionMetricsDescriptor Precision(Func /// - public DataframeEvaluationOutlierDetectionMetricsDescriptor Recall(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Recall(System.Collections.Generic.IDictionary? value) { - RecallValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Recall = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Recall of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Recall() { - writer.WriteStartObject(); - if (AucRocDescriptor is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, AucRocDescriptor, options); - } - else if (AucRocDescriptorAction is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationClassificationMetricsAucRocDescriptor(AucRocDescriptorAction), options); - } - else if (AucRocValue is not null) - { - writer.WritePropertyName("auc_roc"); - JsonSerializer.Serialize(writer, AucRocValue, options); - } + Instance.Recall = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (ConfusionMatrixValue is not null) - { - writer.WritePropertyName("confusion_matrix"); - JsonSerializer.Serialize(writer, ConfusionMatrixValue, options); - } + /// + /// + /// Recall of predictions (per-class and average). + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor Recall(System.Action? action) + { + Instance.Recall = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor AddRecall(string key, object value) + { + Instance.Recall ??= new System.Collections.Generic.Dictionary(); + Instance.Recall.Add(key, value); + return this; + } - if (RecallValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("recall"); - JsonSerializer.Serialize(writer, RecallValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetricsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationOutlierDetectionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegression.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegression.g.cs index dcac1f28c36..8997c5ef594 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegression.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegression.g.cs @@ -17,32 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationRegressionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActualField = System.Text.Json.JsonEncodedText.Encode("actual_field"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedField = System.Text.Json.JsonEncodedText.Encode("predicted_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActualField = default; + LocalJsonValue propMetrics = default; + LocalJsonValue propPredictedField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActualField.TryReadProperty(ref reader, options, PropActualField, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, null)) + { + continue; + } + + if (propPredictedField.TryReadProperty(ref reader, options, PropPredictedField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActualField = propActualField.Value, + Metrics = propMetrics.Value, + PredictedField = propPredictedField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActualField, value.ActualField, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, null); + writer.WriteProperty(options, PropPredictedField, value.PredictedField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionConverter))] public sealed partial class DataframeEvaluationRegression { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Field actualField, Elastic.Clients.Elasticsearch.Field predictedField) + { + ActualField = actualField; + PredictedField = predictedField; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationRegression() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationRegression() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field of the index which contains the ground truth. The data type of this field must be numerical. /// /// - [JsonInclude, JsonPropertyName("actual_field")] - public Elastic.Clients.Elasticsearch.Field ActualField { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field ActualField { get; set; } /// /// /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - [JsonInclude, JsonPropertyName("metrics")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? Metrics { get; set; } /// @@ -50,35 +129,41 @@ public sealed partial class DataframeEvaluationRegression /// The field in the index that contains the predicted value, in other words the results of the regression analysis. /// /// - [JsonInclude, JsonPropertyName("predicted_field")] - public Elastic.Clients.Elasticsearch.Field PredictedField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation(DataframeEvaluationRegression dataframeEvaluationRegression) => Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluation.Regression(dataframeEvaluationRegression); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field PredictedField { get; set; } } -public sealed partial class DataframeEvaluationRegressionDescriptor : SerializableDescriptor> +public readonly partial struct DataframeEvaluationRegressionDescriptor { - internal DataframeEvaluationRegressionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression Instance { get; init; } - public DataframeEvaluationRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PredictedFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor descriptor) => descriptor.Instance; /// /// /// The field of the index which contains the ground truth. The data type of this field must be numerical. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -86,21 +171,21 @@ public DataframeEvaluationRegressionDescriptor ActualField(Elastic.Cl /// The field of the index which contains the ground truth. The data type of this field must be numerical. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// /// - /// The field of the index which contains the ground truth. The data type of this field must be numerical. + /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? value) { - ActualFieldValue = actualField; - return Self; + Instance.Metrics = value; + return this; } /// @@ -108,39 +193,21 @@ public DataframeEvaluationRegressionDescriptor ActualField(Expression /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? metrics) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics() { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor descriptor) - { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationRegressionDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor.Build(null); + return this; } /// /// - /// The field in the index that contains the predicted value, in other words the results of the regression analysis. + /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics(System.Action? action) { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor.Build(action); + return this; } /// @@ -148,10 +215,10 @@ public DataframeEvaluationRegressionDescriptor PredictedField(Elastic /// The field in the index that contains the predicted value, in other words the results of the regression analysis. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } /// @@ -159,62 +226,49 @@ public DataframeEvaluationRegressionDescriptor PredictedField /// The field in the index that contains the predicted value, in other words the results of the regression analysis. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor PredictedField(System.Linq.Expressions.Expression> value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - writer.WritePropertyName("predicted_field"); - JsonSerializer.Serialize(writer, PredictedFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframeEvaluationRegressionDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationRegressionDescriptor { - internal DataframeEvaluationRegressionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression Instance { get; init; } - public DataframeEvaluationRegressionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field ActualFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor MetricsDescriptor { get; set; } - private Action MetricsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PredictedFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor descriptor) => descriptor.Instance; /// /// /// The field of the index which contains the ground truth. The data type of this field must be numerical. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor ActualField(Elastic.Clients.Elasticsearch.Field value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// @@ -222,21 +276,21 @@ public DataframeEvaluationRegressionDescriptor ActualField(Elastic.Clients.Elast /// The field of the index which contains the ground truth. The data type of this field must be numerical. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor ActualField(System.Linq.Expressions.Expression> value) { - ActualFieldValue = actualField; - return Self; + Instance.ActualField = value; + return this; } /// /// - /// The field of the index which contains the ground truth. The data type of this field must be numerical. + /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor ActualField(Expression> actualField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? value) { - ActualFieldValue = actualField; - return Self; + Instance.Metrics = value; + return this; } /// @@ -244,39 +298,21 @@ public DataframeEvaluationRegressionDescriptor ActualField(Expression /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics? metrics) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics() { - MetricsDescriptor = null; - MetricsDescriptorAction = null; - MetricsValue = metrics; - return Self; - } - - public DataframeEvaluationRegressionDescriptor Metrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor descriptor) - { - MetricsValue = null; - MetricsDescriptorAction = null; - MetricsDescriptor = descriptor; - return Self; - } - - public DataframeEvaluationRegressionDescriptor Metrics(Action configure) - { - MetricsValue = null; - MetricsDescriptor = null; - MetricsDescriptorAction = configure; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor.Build(null); + return this; } /// /// - /// The field in the index that contains the predicted value, in other words the results of the regression analysis. + /// Specifies the metrics that are used for the evaluation. For more information on mse, msle, and huber, consult the Jupyter notebook on regression loss functions. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor Metrics(System.Action? action) { - PredictedFieldValue = predictedField; - return Self; + Instance.Metrics = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor.Build(action); + return this; } /// @@ -284,10 +320,10 @@ public DataframeEvaluationRegressionDescriptor PredictedField(Elastic.Clients.El /// The field in the index that contains the predicted value, in other words the results of the regression analysis. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor PredictedField(Elastic.Clients.Elasticsearch.Field value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } /// @@ -295,35 +331,17 @@ public DataframeEvaluationRegressionDescriptor PredictedField /// The field in the index that contains the predicted value, in other words the results of the regression analysis. /// /// - public DataframeEvaluationRegressionDescriptor PredictedField(Expression> predictedField) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor PredictedField(System.Linq.Expressions.Expression> value) { - PredictedFieldValue = predictedField; - return Self; + Instance.PredictedField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("actual_field"); - JsonSerializer.Serialize(writer, ActualFieldValue, options); - if (MetricsDescriptor is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsDescriptor, options); - } - else if (MetricsDescriptorAction is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor(MetricsDescriptorAction), options); - } - else if (MetricsValue is not null) - { - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - } - - writer.WritePropertyName("predicted_field"); - JsonSerializer.Serialize(writer, PredictedFieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegression(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetrics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetrics.g.cs index b51e1bbb650..9814777fad3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetrics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetrics.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationRegressionMetricsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHuber = System.Text.Json.JsonEncodedText.Encode("huber"); + private static readonly System.Text.Json.JsonEncodedText PropMse = System.Text.Json.JsonEncodedText.Encode("mse"); + private static readonly System.Text.Json.JsonEncodedText PropMsle = System.Text.Json.JsonEncodedText.Encode("msle"); + private static readonly System.Text.Json.JsonEncodedText PropRSquared = System.Text.Json.JsonEncodedText.Encode("r_squared"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHuber = default; + LocalJsonValue?> propMse = default; + LocalJsonValue propMsle = default; + LocalJsonValue?> propRSquared = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHuber.TryReadProperty(ref reader, options, PropHuber, null)) + { + continue; + } + + if (propMse.TryReadProperty(ref reader, options, PropMse, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMsle.TryReadProperty(ref reader, options, PropMsle, null)) + { + continue; + } + + if (propRSquared.TryReadProperty(ref reader, options, PropRSquared, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Huber = propHuber.Value, + Mse = propMse.Value, + Msle = propMsle.Value, + RSquared = propRSquared.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHuber, value.Huber, null, null); + writer.WriteProperty(options, PropMse, value.Mse, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMsle, value.Msle, null, null); + writer.WriteProperty(options, PropRSquared, value.RSquared, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsConverter))] public sealed partial class DataframeEvaluationRegressionMetrics { +#if NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetrics() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetrics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Pseudo Huber loss function. /// /// - [JsonInclude, JsonPropertyName("huber")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber? Huber { get; set; } /// @@ -42,15 +120,13 @@ public sealed partial class DataframeEvaluationRegressionMetrics /// Average squared difference between the predicted values and the actual (ground truth) value. For more information, read this wiki article. /// /// - [JsonInclude, JsonPropertyName("mse")] - public IDictionary? Mse { get; set; } + public System.Collections.Generic.IDictionary? Mse { get; set; } /// /// /// Average squared difference between the logarithm of the predicted values and the logarithm of the actual (ground truth) value. /// /// - [JsonInclude, JsonPropertyName("msle")] public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle? Msle { get; set; } /// @@ -58,54 +134,70 @@ public sealed partial class DataframeEvaluationRegressionMetrics /// Proportion of the variance in the dependent variable that is predictable from the independent variables. /// /// - [JsonInclude, JsonPropertyName("r_squared")] - public IDictionary? RSquared { get; set; } + public System.Collections.Generic.IDictionary? RSquared { get; set; } } -public sealed partial class DataframeEvaluationRegressionMetricsDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationRegressionMetricsDescriptor { - internal DataframeEvaluationRegressionMetricsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics Instance { get; init; } - public DataframeEvaluationRegressionMetricsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber? HuberValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor HuberDescriptor { get; set; } - private Action HuberDescriptorAction { get; set; } - private IDictionary? MseValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle? MsleValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor MsleDescriptor { get; set; } - private Action MsleDescriptorAction { get; set; } - private IDictionary? RSquaredValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Pseudo Huber loss function. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Huber(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber? value) + { + Instance.Huber = value; + return this; + } /// /// /// Pseudo Huber loss function. /// /// - public DataframeEvaluationRegressionMetricsDescriptor Huber(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber? huber) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Huber() { - HuberDescriptor = null; - HuberDescriptorAction = null; - HuberValue = huber; - return Self; + Instance.Huber = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor.Build(null); + return this; } - public DataframeEvaluationRegressionMetricsDescriptor Huber(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor descriptor) + /// + /// + /// Pseudo Huber loss function. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Huber(System.Action? action) { - HuberValue = null; - HuberDescriptorAction = null; - HuberDescriptor = descriptor; - return Self; + Instance.Huber = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor.Build(action); + return this; } - public DataframeEvaluationRegressionMetricsDescriptor Huber(Action configure) + /// + /// + /// Average squared difference between the predicted values and the actual (ground truth) value. For more information, read this wiki article. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Mse(System.Collections.Generic.IDictionary? value) { - HuberValue = null; - HuberDescriptor = null; - HuberDescriptorAction = configure; - return Self; + Instance.Mse = value; + return this; } /// @@ -113,10 +205,28 @@ public DataframeEvaluationRegressionMetricsDescriptor Huber(Action /// - public DataframeEvaluationRegressionMetricsDescriptor Mse(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Mse() { - MseValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Mse = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Average squared difference between the predicted values and the actual (ground truth) value. For more information, read this wiki article. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Mse(System.Action? action) + { + Instance.Mse = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor AddMse(string key, object value) + { + Instance.Mse ??= new System.Collections.Generic.Dictionary(); + Instance.Mse.Add(key, value); + return this; } /// @@ -124,28 +234,32 @@ public DataframeEvaluationRegressionMetricsDescriptor Mse(Func /// - public DataframeEvaluationRegressionMetricsDescriptor Msle(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle? msle) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Msle(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle? value) { - MsleDescriptor = null; - MsleDescriptorAction = null; - MsleValue = msle; - return Self; + Instance.Msle = value; + return this; } - public DataframeEvaluationRegressionMetricsDescriptor Msle(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor descriptor) + /// + /// + /// Average squared difference between the logarithm of the predicted values and the logarithm of the actual (ground truth) value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Msle() { - MsleValue = null; - MsleDescriptorAction = null; - MsleDescriptor = descriptor; - return Self; + Instance.Msle = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor.Build(null); + return this; } - public DataframeEvaluationRegressionMetricsDescriptor Msle(Action configure) + /// + /// + /// Average squared difference between the logarithm of the predicted values and the logarithm of the actual (ground truth) value. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor Msle(System.Action? action) { - MsleValue = null; - MsleDescriptor = null; - MsleDescriptorAction = configure; - return Self; + Instance.Msle = Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor.Build(action); + return this; } /// @@ -153,59 +267,51 @@ public DataframeEvaluationRegressionMetricsDescriptor Msle(Action /// - public DataframeEvaluationRegressionMetricsDescriptor RSquared(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor RSquared(System.Collections.Generic.IDictionary? value) { - RSquaredValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.RSquared = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Proportion of the variance in the dependent variable that is predictable from the independent variables. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor RSquared() { - writer.WriteStartObject(); - if (HuberDescriptor is not null) - { - writer.WritePropertyName("huber"); - JsonSerializer.Serialize(writer, HuberDescriptor, options); - } - else if (HuberDescriptorAction is not null) - { - writer.WritePropertyName("huber"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor(HuberDescriptorAction), options); - } - else if (HuberValue is not null) - { - writer.WritePropertyName("huber"); - JsonSerializer.Serialize(writer, HuberValue, options); - } + Instance.RSquared = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (MseValue is not null) - { - writer.WritePropertyName("mse"); - JsonSerializer.Serialize(writer, MseValue, options); - } + /// + /// + /// Proportion of the variance in the dependent variable that is predictable from the independent variables. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor RSquared(System.Action? action) + { + Instance.RSquared = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (MsleDescriptor is not null) - { - writer.WritePropertyName("msle"); - JsonSerializer.Serialize(writer, MsleDescriptor, options); - } - else if (MsleDescriptorAction is not null) - { - writer.WritePropertyName("msle"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor(MsleDescriptorAction), options); - } - else if (MsleValue is not null) - { - writer.WritePropertyName("msle"); - JsonSerializer.Serialize(writer, MsleValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor AddRSquared(string key, object value) + { + Instance.RSquared ??= new System.Collections.Generic.Dictionary(); + Instance.RSquared.Add(key, value); + return this; + } - if (RSquaredValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("r_squared"); - JsonSerializer.Serialize(writer, RSquaredValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetrics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsHuber.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsHuber.g.cs index 6d769206db2..083a5cbd37f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsHuber.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsHuber.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationRegressionMetricsHuberConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDelta = System.Text.Json.JsonEncodedText.Encode("delta"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDelta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDelta.TryReadProperty(ref reader, options, PropDelta, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Delta = propDelta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDelta, value.Delta, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberConverter))] public sealed partial class DataframeEvaluationRegressionMetricsHuber { +#if NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetricsHuber() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetricsHuber() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Approximates 1/2 (prediction - actual)2 for values much less than delta and approximates a straight line with slope delta for values much larger than delta. Defaults to 1. Delta needs to be greater than 0. /// /// - [JsonInclude, JsonPropertyName("delta")] public double? Delta { get; set; } } -public sealed partial class DataframeEvaluationRegressionMetricsHuberDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationRegressionMetricsHuberDescriptor { - internal DataframeEvaluationRegressionMetricsHuberDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber Instance { get; init; } - public DataframeEvaluationRegressionMetricsHuberDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsHuberDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber instance) { + Instance = instance; } - private double? DeltaValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsHuberDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor descriptor) => descriptor.Instance; /// /// /// Approximates 1/2 (prediction - actual)2 for values much less than delta and approximates a straight line with slope delta for values much larger than delta. Defaults to 1. Delta needs to be greater than 0. /// /// - public DataframeEvaluationRegressionMetricsHuberDescriptor Delta(double? delta) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor Delta(double? value) { - DeltaValue = delta; - return Self; + Instance.Delta = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber Build(System.Action? action) { - writer.WriteStartObject(); - if (DeltaValue.HasValue) + if (action is null) { - writer.WritePropertyName("delta"); - writer.WriteNumberValue(DeltaValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuberDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsHuber(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsMsle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsMsle.g.cs index 6b8c57abcc7..1ca8cf39e01 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsMsle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationRegressionMetricsMsle.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationRegressionMetricsMsleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOffset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Offset = propOffset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleConverter))] public sealed partial class DataframeEvaluationRegressionMetricsMsle { +#if NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetricsMsle() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeEvaluationRegressionMetricsMsle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines the transition point at which you switch from minimizing quadratic error to minimizing quadratic log error. Defaults to 1. /// /// - [JsonInclude, JsonPropertyName("offset")] public double? Offset { get; set; } } -public sealed partial class DataframeEvaluationRegressionMetricsMsleDescriptor : SerializableDescriptor +public readonly partial struct DataframeEvaluationRegressionMetricsMsleDescriptor { - internal DataframeEvaluationRegressionMetricsMsleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle Instance { get; init; } - public DataframeEvaluationRegressionMetricsMsleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsMsleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle instance) { + Instance = instance; } - private double? OffsetValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationRegressionMetricsMsleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor descriptor) => descriptor.Instance; /// /// /// Defines the transition point at which you switch from minimizing quadratic error to minimizing quadratic log error. Defaults to 1. /// /// - public DataframeEvaluationRegressionMetricsMsleDescriptor Offset(double? offset) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor Offset(double? value) { - OffsetValue = offset; - return Self; + Instance.Offset = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle Build(System.Action? action) { - writer.WriteStartObject(); - if (OffsetValue.HasValue) + if (action is null) { - writer.WritePropertyName("offset"); - writer.WriteNumberValue(OffsetValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsleDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationRegressionMetricsMsle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRoc.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRoc.g.cs index b2448c23170..0ad4ca0031f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRoc.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRoc.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationSummaryAucRocConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurve = System.Text.Json.JsonEncodedText.Encode("curve"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCurve = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurve.TryReadProperty(ref reader, options, PropCurve, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Curve = propCurve.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurve, value.Curve, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRocConverter))] public sealed partial class DataframeEvaluationSummaryAucRoc { - [JsonInclude, JsonPropertyName("curve")] - public IReadOnlyCollection? Curve { get; init; } - [JsonInclude, JsonPropertyName("value")] - public double Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationSummaryAucRoc(double value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationSummaryAucRoc() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationSummaryAucRoc() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationSummaryAucRoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Curve { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRocCurveItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRocCurveItem.g.cs index 2d08bddff11..d704afc5bcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRocCurveItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationSummaryAucRocCurveItem.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationSummaryAucRocCurveItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFpr = System.Text.Json.JsonEncodedText.Encode("fpr"); + private static readonly System.Text.Json.JsonEncodedText PropThreshold = System.Text.Json.JsonEncodedText.Encode("threshold"); + private static readonly System.Text.Json.JsonEncodedText PropTpr = System.Text.Json.JsonEncodedText.Encode("tpr"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRocCurveItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFpr = default; + LocalJsonValue propThreshold = default; + LocalJsonValue propTpr = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFpr.TryReadProperty(ref reader, options, PropFpr, null)) + { + continue; + } + + if (propThreshold.TryReadProperty(ref reader, options, PropThreshold, null)) + { + continue; + } + + if (propTpr.TryReadProperty(ref reader, options, PropTpr, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRocCurveItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fpr = propFpr.Value, + Threshold = propThreshold.Value, + Tpr = propTpr.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRocCurveItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFpr, value.Fpr, null, null); + writer.WriteProperty(options, PropThreshold, value.Threshold, null, null); + writer.WriteProperty(options, PropTpr, value.Tpr, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRocCurveItemConverter))] public sealed partial class DataframeEvaluationSummaryAucRocCurveItem { - [JsonInclude, JsonPropertyName("fpr")] - public double Fpr { get; init; } - [JsonInclude, JsonPropertyName("threshold")] - public double Threshold { get; init; } - [JsonInclude, JsonPropertyName("tpr")] - public double Tpr { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationSummaryAucRocCurveItem(double fpr, double threshold, double tpr) + { + Fpr = fpr; + Threshold = threshold; + Tpr = tpr; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationSummaryAucRocCurveItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationSummaryAucRocCurveItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationSummaryAucRocCurveItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Fpr { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Threshold { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Tpr { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationValue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationValue.g.cs index 2850ff64e44..5d33d18d711 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationValue.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeEvaluationValue.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeEvaluationValueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValueConverter))] public sealed partial class DataframeEvaluationValue { - [JsonInclude, JsonPropertyName("value")] - public double Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframeEvaluationValue(double value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public DataframeEvaluationValue() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframeEvaluationValue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeEvaluationValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeOutlierDetectionSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeOutlierDetectionSummary.g.cs index aa926f5bca4..8e09c5a9fd8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeOutlierDetectionSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeOutlierDetectionSummary.g.cs @@ -17,47 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeOutlierDetectionSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAucRoc = System.Text.Json.JsonEncodedText.Encode("auc_roc"); + private static readonly System.Text.Json.JsonEncodedText PropConfusionMatrix = System.Text.Json.JsonEncodedText.Encode("confusion_matrix"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropRecall = System.Text.Json.JsonEncodedText.Encode("recall"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAucRoc = default; + LocalJsonValue?> propConfusionMatrix = default; + LocalJsonValue?> propPrecision = default; + LocalJsonValue?> propRecall = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAucRoc.TryReadProperty(ref reader, options, PropAucRoc, null)) + { + continue; + } + + if (propConfusionMatrix.TryReadProperty(ref reader, options, PropConfusionMatrix, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRecall.TryReadProperty(ref reader, options, PropRecall, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AucRoc = propAucRoc.Value, + ConfusionMatrix = propConfusionMatrix.Value, + Precision = propPrecision.Value, + Recall = propRecall.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAucRoc, value.AucRoc, null, null); + writer.WriteProperty(options, PropConfusionMatrix, value.ConfusionMatrix, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPrecision, value.Precision, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRecall, value.Recall, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeOutlierDetectionSummaryConverter))] public sealed partial class DataframeOutlierDetectionSummary { +#if NET7_0_OR_GREATER + public DataframeOutlierDetectionSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeOutlierDetectionSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeOutlierDetectionSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The AUC ROC (area under the curve of the receiver operating characteristic) score and optionally the curve. /// /// - [JsonInclude, JsonPropertyName("auc_roc")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc? AucRoc { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationSummaryAucRoc? AucRoc { get; set; } /// /// /// Set the different thresholds of the outlier score at where the metrics (tp - true positive, fp - false positive, tn - true negative, fn - false negative) are calculated. /// /// - [JsonInclude, JsonPropertyName("confusion_matrix")] - public IReadOnlyDictionary? ConfusionMatrix { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? ConfusionMatrix { get; set; } /// /// /// Set the different thresholds of the outlier score at where the metric is calculated. /// /// - [JsonInclude, JsonPropertyName("precision")] - public IReadOnlyDictionary? Precision { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Precision { get; set; } /// /// /// Set the different thresholds of the outlier score at where the metric is calculated. /// /// - [JsonInclude, JsonPropertyName("recall")] - public IReadOnlyDictionary? Recall { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Recall { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframePreviewConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframePreviewConfig.g.cs index 69818982617..d2c74fbf910 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframePreviewConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframePreviewConfig.g.cs @@ -17,368 +17,300 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframePreviewConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalysis = System.Text.Json.JsonEncodedText.Encode("analysis"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzedFields = System.Text.Json.JsonEncodedText.Encode("analyzed_fields"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumThreads = System.Text.Json.JsonEncodedText.Encode("max_num_threads"); + private static readonly System.Text.Json.JsonEncodedText PropModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalysis = default; + LocalJsonValue propAnalyzedFields = default; + LocalJsonValue propMaxNumThreads = default; + LocalJsonValue propModelMemoryLimit = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalysis.TryReadProperty(ref reader, options, PropAnalysis, null)) + { + continue; + } + + if (propAnalyzedFields.TryReadProperty(ref reader, options, PropAnalyzedFields, null)) + { + continue; + } + + if (propMaxNumThreads.TryReadProperty(ref reader, options, PropMaxNumThreads, null)) + { + continue; + } + + if (propModelMemoryLimit.TryReadProperty(ref reader, options, PropModelMemoryLimit, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analysis = propAnalysis.Value, + AnalyzedFields = propAnalyzedFields.Value, + MaxNumThreads = propMaxNumThreads.Value, + ModelMemoryLimit = propModelMemoryLimit.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalysis, value.Analysis, null, null); + writer.WriteProperty(options, PropAnalyzedFields, value.AnalyzedFields, null, null); + writer.WriteProperty(options, PropMaxNumThreads, value.MaxNumThreads, null, null); + writer.WriteProperty(options, PropModelMemoryLimit, value.ModelMemoryLimit, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigConverter))] public sealed partial class DataframePreviewConfig { - [JsonInclude, JsonPropertyName("analysis")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } - [JsonInclude, JsonPropertyName("analyzed_fields")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframePreviewConfig(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis, Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + { + Analysis = analysis; + Source = source; + } +#if NET7_0_OR_GREATER + public DataframePreviewConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataframePreviewConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis Analysis { get; set; } public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFields { get; set; } - [JsonInclude, JsonPropertyName("max_num_threads")] public int? MaxNumThreads { get; set; } - [JsonInclude, JsonPropertyName("model_memory_limit")] public string? ModelMemoryLimit { get; set; } - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource Source { get; set; } } -public sealed partial class DataframePreviewConfigDescriptor : SerializableDescriptor> +public readonly partial struct DataframePreviewConfigDescriptor { - internal DataframePreviewConfigDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig Instance { get; init; } - public DataframePreviewConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframePreviewConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action> AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action> SourceDescriptorAction { get; set; } - - public DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframePreviewConfigDescriptor() { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) - { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor descriptor) => descriptor.Instance; - public DataframePreviewConfigDescriptor Analysis(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis value) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.Analysis = value; + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Analysis(System.Action> action) { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = value; + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields() { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public DataframePreviewConfigDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields(System.Action? action) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } - public DataframePreviewConfigDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor MaxNumThreads(int? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.MaxNumThreads = value; + return this; } - public DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor ModelMemoryLimit(string? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.ModelMemoryLimit = value; + return this; } - public DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource value) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public DataframePreviewConfigDescriptor Source(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Source(System.Action> action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig Build(System.Action> action) { - writer.WriteStartObject(); - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } - - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } - - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } - - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } - - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DataframePreviewConfigDescriptor : SerializableDescriptor +public readonly partial struct DataframePreviewConfigDescriptor { - internal DataframePreviewConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig Instance { get; init; } - public DataframePreviewConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframePreviewConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis AnalysisValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor AnalysisDescriptor { get; set; } - private Action AnalysisDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? AnalyzedFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor AnalyzedFieldsDescriptor { get; set; } - private Action AnalyzedFieldsDescriptorAction { get; set; } - private int? MaxNumThreadsValue { get; set; } - private string? ModelMemoryLimitValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - - public DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis analysis) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataframePreviewConfigDescriptor() { - AnalysisDescriptor = null; - AnalysisDescriptorAction = null; - AnalysisValue = analysis; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Analysis(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysis value) { - AnalysisValue = null; - AnalysisDescriptorAction = null; - AnalysisDescriptor = descriptor; - return Self; + Instance.Analysis = value; + return this; } - public DataframePreviewConfigDescriptor Analysis(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Analysis(System.Action action) { - AnalysisValue = null; - AnalysisDescriptor = null; - AnalysisDescriptorAction = configure; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? analyzedFields) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Analysis(System.Action> action) { - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsValue = analyzedFields; - return Self; + Instance.Analysis = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor.Build(action); + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFields? value) { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptorAction = null; - AnalyzedFieldsDescriptor = descriptor; - return Self; + Instance.AnalyzedFields = value; + return this; } - public DataframePreviewConfigDescriptor AnalyzedFields(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields() { - AnalyzedFieldsValue = null; - AnalyzedFieldsDescriptor = null; - AnalyzedFieldsDescriptorAction = configure; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(null); + return this; } - public DataframePreviewConfigDescriptor MaxNumThreads(int? maxNumThreads) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor AnalyzedFields(System.Action? action) { - MaxNumThreadsValue = maxNumThreads; - return Self; + Instance.AnalyzedFields = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor.Build(action); + return this; } - public DataframePreviewConfigDescriptor ModelMemoryLimit(string? modelMemoryLimit) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor MaxNumThreads(int? value) { - ModelMemoryLimitValue = modelMemoryLimit; - return Self; + Instance.MaxNumThreads = value; + return this; } - public DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource source) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor ModelMemoryLimit(string? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.ModelMemoryLimit = value; + return this; } - public DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Source(Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSource value) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Source = value; + return this; } - public DataframePreviewConfigDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Source(System.Action action) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor Source(System.Action> action) { - writer.WriteStartObject(); - if (AnalysisDescriptor is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisDescriptor, options); - } - else if (AnalysisDescriptorAction is not null) - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisDescriptor(AnalysisDescriptorAction), options); - } - else - { - writer.WritePropertyName("analysis"); - JsonSerializer.Serialize(writer, AnalysisValue, options); - } - - if (AnalyzedFieldsDescriptor is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsDescriptor, options); - } - else if (AnalyzedFieldsDescriptorAction is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalysisAnalyzedFieldsDescriptor(AnalyzedFieldsDescriptorAction), options); - } - else if (AnalyzedFieldsValue is not null) - { - writer.WritePropertyName("analyzed_fields"); - JsonSerializer.Serialize(writer, AnalyzedFieldsValue, options); - } - - if (MaxNumThreadsValue.HasValue) - { - writer.WritePropertyName("max_num_threads"); - writer.WriteNumberValue(MaxNumThreadsValue.Value); - } - - if (!string.IsNullOrEmpty(ModelMemoryLimitValue)) - { - writer.WritePropertyName("model_memory_limit"); - writer.WriteStringValue(ModelMemoryLimitValue); - } - - if (SourceDescriptor is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor(SourceDescriptorAction), options); - } - else - { - writer.WritePropertyName("source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + Instance.Source = Elastic.Clients.Elasticsearch.MachineLearning.DataframeAnalyticsSourceDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DataframePreviewConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeRegressionSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeRegressionSummary.g.cs index dc727132b26..d08bfa2afde 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeRegressionSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DataframeRegressionSummary.g.cs @@ -17,47 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DataframeRegressionSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHuber = System.Text.Json.JsonEncodedText.Encode("huber"); + private static readonly System.Text.Json.JsonEncodedText PropMse = System.Text.Json.JsonEncodedText.Encode("mse"); + private static readonly System.Text.Json.JsonEncodedText PropMsle = System.Text.Json.JsonEncodedText.Encode("msle"); + private static readonly System.Text.Json.JsonEncodedText PropRSquared = System.Text.Json.JsonEncodedText.Encode("r_squared"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHuber = default; + LocalJsonValue propMse = default; + LocalJsonValue propMsle = default; + LocalJsonValue propRSquared = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHuber.TryReadProperty(ref reader, options, PropHuber, null)) + { + continue; + } + + if (propMse.TryReadProperty(ref reader, options, PropMse, null)) + { + continue; + } + + if (propMsle.TryReadProperty(ref reader, options, PropMsle, null)) + { + continue; + } + + if (propRSquared.TryReadProperty(ref reader, options, PropRSquared, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Huber = propHuber.Value, + Mse = propMse.Value, + Msle = propMsle.Value, + RSquared = propRSquared.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHuber, value.Huber, null, null); + writer.WriteProperty(options, PropMse, value.Mse, null, null); + writer.WriteProperty(options, PropMsle, value.Msle, null, null); + writer.WriteProperty(options, PropRSquared, value.RSquared, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DataframeRegressionSummaryConverter))] public sealed partial class DataframeRegressionSummary { +#if NET7_0_OR_GREATER + public DataframeRegressionSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataframeRegressionSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataframeRegressionSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Pseudo Huber loss function. /// /// - [JsonInclude, JsonPropertyName("huber")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Huber { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Huber { get; set; } /// /// /// Average squared difference between the predicted values and the actual (ground truth) value. /// /// - [JsonInclude, JsonPropertyName("mse")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Mse { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Mse { get; set; } /// /// /// Average squared difference between the logarithm of the predicted values and the logarithm of the actual (ground truth) value. /// /// - [JsonInclude, JsonPropertyName("msle")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Msle { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? Msle { get; set; } /// /// /// Proportion of the variance in the dependent variable that is predictable from the independent variables. /// /// - [JsonInclude, JsonPropertyName("r_squared")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? RSquared { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DataframeEvaluationValue? RSquared { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Defaults.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Defaults.g.cs index a62f088ab68..13d971352a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Defaults.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Defaults.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DefaultsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyDetectors = System.Text.Json.JsonEncodedText.Encode("anomaly_detectors"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeeds = System.Text.Json.JsonEncodedText.Encode("datafeeds"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Defaults Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyDetectors = default; + LocalJsonValue propDatafeeds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyDetectors.TryReadProperty(ref reader, options, PropAnomalyDetectors, null)) + { + continue; + } + + if (propDatafeeds.TryReadProperty(ref reader, options, PropDatafeeds, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Defaults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyDetectors = propAnomalyDetectors.Value, + Datafeeds = propDatafeeds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Defaults value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyDetectors, value.AnomalyDetectors, null, null); + writer.WriteProperty(options, PropDatafeeds, value.Datafeeds, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DefaultsConverter))] public sealed partial class Defaults { - [JsonInclude, JsonPropertyName("anomaly_detectors")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors AnomalyDetectors { get; init; } - [JsonInclude, JsonPropertyName("datafeeds")] - public Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds Datafeeds { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Defaults(Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors anomalyDetectors, Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds datafeeds) + { + AnomalyDetectors = anomalyDetectors; + Datafeeds = datafeeds; + } +#if NET7_0_OR_GREATER + public Defaults() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Defaults() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Defaults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnomalyDetectors AnomalyDetectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Datafeeds Datafeeds { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Definition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Definition.g.cs index 66f2ca47873..b3c34cd0a08 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Definition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Definition.g.cs @@ -17,90 +17,160 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DefinitionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPreprocessors = System.Text.Json.JsonEncodedText.Encode("preprocessors"); + private static readonly System.Text.Json.JsonEncodedText PropTrainedModel = System.Text.Json.JsonEncodedText.Encode("trained_model"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Definition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propPreprocessors = default; + LocalJsonValue propTrainedModel = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPreprocessors.TryReadProperty(ref reader, options, PropPreprocessors, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTrainedModel.TryReadProperty(ref reader, options, PropTrainedModel, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Definition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Preprocessors = propPreprocessors.Value, + TrainedModel = propTrainedModel.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Definition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPreprocessors, value.Preprocessors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTrainedModel, value.TrainedModel, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DefinitionConverter))] public sealed partial class Definition { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Definition(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel trainedModel) + { + TrainedModel = trainedModel; + } +#if NET7_0_OR_GREATER + public Definition() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Definition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Definition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Collection of preprocessors /// /// - [JsonInclude, JsonPropertyName("preprocessors")] - public ICollection? Preprocessors { get; set; } + public System.Collections.Generic.ICollection? Preprocessors { get; set; } /// /// /// The definition of the trained model. /// /// - [JsonInclude, JsonPropertyName("trained_model")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel TrainedModel { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel TrainedModel { get; set; } } -public sealed partial class DefinitionDescriptor : SerializableDescriptor +public readonly partial struct DefinitionDescriptor { - internal DefinitionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Definition Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DefinitionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Definition instance) + { + Instance = instance; + } - public DefinitionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DefinitionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Definition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? PreprocessorsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor PreprocessorsDescriptor { get; set; } - private Action PreprocessorsDescriptorAction { get; set; } - private Action[] PreprocessorsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel TrainedModelValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor TrainedModelDescriptor { get; set; } - private Action TrainedModelDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Definition instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Definition(Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor descriptor) => descriptor.Instance; /// /// /// Collection of preprocessors /// /// - public DefinitionDescriptor Preprocessors(ICollection? preprocessors) + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor Preprocessors(System.Collections.Generic.ICollection? value) { - PreprocessorsDescriptor = null; - PreprocessorsDescriptorAction = null; - PreprocessorsDescriptorActions = null; - PreprocessorsValue = preprocessors; - return Self; + Instance.Preprocessors = value; + return this; } - public DefinitionDescriptor Preprocessors(Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor descriptor) + /// + /// + /// Collection of preprocessors + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor Preprocessors(params Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor[] values) { - PreprocessorsValue = null; - PreprocessorsDescriptorAction = null; - PreprocessorsDescriptorActions = null; - PreprocessorsDescriptor = descriptor; - return Self; + Instance.Preprocessors = [.. values]; + return this; } - public DefinitionDescriptor Preprocessors(Action configure) + /// + /// + /// Collection of preprocessors + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor Preprocessors(params System.Action[] actions) { - PreprocessorsValue = null; - PreprocessorsDescriptor = null; - PreprocessorsDescriptorActions = null; - PreprocessorsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor.Build(action)); + } - public DefinitionDescriptor Preprocessors(params Action[] configure) - { - PreprocessorsValue = null; - PreprocessorsDescriptor = null; - PreprocessorsDescriptorAction = null; - PreprocessorsDescriptorActions = configure; - return Self; + Instance.Preprocessors = items; + return this; } /// @@ -108,80 +178,39 @@ public DefinitionDescriptor Preprocessors(params Action /// - public DefinitionDescriptor TrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel trainedModel) + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor TrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel value) { - TrainedModelDescriptor = null; - TrainedModelDescriptorAction = null; - TrainedModelValue = trainedModel; - return Self; + Instance.TrainedModel = value; + return this; } - public DefinitionDescriptor TrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor descriptor) + /// + /// + /// The definition of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor TrainedModel() { - TrainedModelValue = null; - TrainedModelDescriptorAction = null; - TrainedModelDescriptor = descriptor; - return Self; + Instance.TrainedModel = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor.Build(null); + return this; } - public DefinitionDescriptor TrainedModel(Action configure) + /// + /// + /// The definition of the trained model. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor TrainedModel(System.Action? action) { - TrainedModelValue = null; - TrainedModelDescriptor = null; - TrainedModelDescriptorAction = configure; - return Self; + Instance.TrainedModel = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Definition Build(System.Action action) { - writer.WriteStartObject(); - if (PreprocessorsDescriptor is not null) - { - writer.WritePropertyName("preprocessors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, PreprocessorsDescriptor, options); - writer.WriteEndArray(); - } - else if (PreprocessorsDescriptorAction is not null) - { - writer.WritePropertyName("preprocessors"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor(PreprocessorsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (PreprocessorsDescriptorActions is not null) - { - writer.WritePropertyName("preprocessors"); - writer.WriteStartArray(); - foreach (var action in PreprocessorsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (PreprocessorsValue is not null) - { - writer.WritePropertyName("preprocessors"); - JsonSerializer.Serialize(writer, PreprocessorsValue, options); - } - - if (TrainedModelDescriptor is not null) - { - writer.WritePropertyName("trained_model"); - JsonSerializer.Serialize(writer, TrainedModelDescriptor, options); - } - else if (TrainedModelDescriptorAction is not null) - { - writer.WritePropertyName("trained_model"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(TrainedModelDescriptorAction), options); - } - else - { - writer.WritePropertyName("trained_model"); - JsonSerializer.Serialize(writer, TrainedModelValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DefinitionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Definition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DelayedDataCheckConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DelayedDataCheckConfig.g.cs index d391e614ac7..01b381290f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DelayedDataCheckConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DelayedDataCheckConfig.g.cs @@ -17,18 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DelayedDataCheckConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCheckWindow = System.Text.Json.JsonEncodedText.Encode("check_window"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCheckWindow = default; + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCheckWindow.TryReadProperty(ref reader, options, PropCheckWindow, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CheckWindow = propCheckWindow.Value, + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCheckWindow, value.CheckWindow, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigConverter))] public sealed partial class DelayedDataCheckConfig { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelayedDataCheckConfig(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public DelayedDataCheckConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DelayedDataCheckConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The window of time that is searched for late data. This window of time ends with the latest finalized bucket. @@ -36,7 +103,6 @@ public sealed partial class DelayedDataCheckConfig /// In particular, the default check_window span calculation is based on the maximum of 2h or 8 * bucket_span. /// /// - [JsonInclude, JsonPropertyName("check_window")] public Elastic.Clients.Elasticsearch.Duration? CheckWindow { get; set; } /// @@ -44,20 +110,31 @@ public sealed partial class DelayedDataCheckConfig /// Specifies whether the datafeed periodically checks for delayed data. /// /// - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class DelayedDataCheckConfigDescriptor : SerializableDescriptor +public readonly partial struct DelayedDataCheckConfigDescriptor { - internal DelayedDataCheckConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig Instance { get; init; } - public DelayedDataCheckConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelayedDataCheckConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? CheckWindowValue { get; set; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DelayedDataCheckConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor descriptor) => descriptor.Instance; /// /// @@ -66,10 +143,10 @@ public DelayedDataCheckConfigDescriptor() : base() /// In particular, the default check_window span calculation is based on the maximum of 2h or 8 * bucket_span. /// /// - public DelayedDataCheckConfigDescriptor CheckWindow(Elastic.Clients.Elasticsearch.Duration? checkWindow) + public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor CheckWindow(Elastic.Clients.Elasticsearch.Duration? value) { - CheckWindowValue = checkWindow; - return Self; + Instance.CheckWindow = value; + return this; } /// @@ -77,23 +154,17 @@ public DelayedDataCheckConfigDescriptor CheckWindow(Elastic.Clients.Elasticsearc /// Specifies whether the datafeed periodically checks for delayed data. /// /// - public DelayedDataCheckConfigDescriptor Enabled(bool enabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig Build(System.Action action) { - writer.WriteStartObject(); - if (CheckWindowValue is not null) - { - writer.WritePropertyName("check_window"); - JsonSerializer.Serialize(writer, CheckWindowValue, options); - } - - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DelayedDataCheckConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectionRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectionRule.g.cs index 2753259aa9e..d65f8f5df66 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectionRule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectionRule.g.cs @@ -17,67 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DetectionRuleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropConditions = System.Text.Json.JsonEncodedText.Encode("conditions"); + private static readonly System.Text.Json.JsonEncodedText PropScope = System.Text.Json.JsonEncodedText.Encode("scope"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propActions = default; + LocalJsonValue?> propConditions = default; + LocalJsonValue?> propScope = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propConditions.TryReadProperty(ref reader, options, PropConditions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propScope.TryReadProperty(ref reader, options, PropScope, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + Conditions = propConditions.Value, + Scope = propScope.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropConditions, value.Conditions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScope, value.Scope, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleConverter))] public sealed partial class DetectionRule { +#if NET7_0_OR_GREATER + public DetectionRule() + { + } +#endif +#if !NET7_0_OR_GREATER + public DetectionRule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The set of actions to be triggered when the rule applies. If more than one action is specified the effects of all actions are combined. /// /// - [JsonInclude, JsonPropertyName("actions")] - public ICollection? Actions { get; set; } + public System.Collections.Generic.ICollection? Actions { get; set; } /// /// /// An array of numeric conditions when the rule applies. A rule must either have a non-empty scope or at least one condition. Multiple conditions are combined together with a logical AND. /// /// - [JsonInclude, JsonPropertyName("conditions")] - public ICollection? Conditions { get; set; } + public System.Collections.Generic.ICollection? Conditions { get; set; } /// /// /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. /// /// - [JsonInclude, JsonPropertyName("scope")] - public IDictionary? Scope { get; set; } + public System.Collections.Generic.IDictionary? Scope { get; set; } } -public sealed partial class DetectionRuleDescriptor : SerializableDescriptor> +public readonly partial struct DetectionRuleDescriptor { - internal DetectionRuleDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule Instance { get; init; } - public DetectionRuleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectionRuleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule instance) { + Instance = instance; } - private ICollection? ActionsValue { get; set; } - private ICollection? ConditionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor ConditionsDescriptor { get; set; } - private Action ConditionsDescriptorAction { get; set; } - private Action[] ConditionsDescriptorActions { get; set; } - private IDictionary ScopeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectionRuleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The set of actions to be triggered when the rule applies. If more than one action is specified the effects of all actions are combined. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Actions(System.Collections.Generic.ICollection? value) + { + Instance.Actions = value; + return this; + } /// /// /// The set of actions to be triggered when the rule applies. If more than one action is specified the effects of all actions are combined. /// /// - public DetectionRuleDescriptor Actions(ICollection? actions) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Actions(params Elastic.Clients.Elasticsearch.MachineLearning.RuleAction[] values) { - ActionsValue = actions; - return Self; + Instance.Actions = [.. values]; + return this; } /// @@ -85,40 +167,49 @@ public DetectionRuleDescriptor Actions(ICollection /// - public DetectionRuleDescriptor Conditions(ICollection? conditions) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(System.Collections.Generic.ICollection? value) { - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = null; - ConditionsValue = conditions; - return Self; + Instance.Conditions = value; + return this; } - public DetectionRuleDescriptor Conditions(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor descriptor) + /// + /// + /// An array of numeric conditions when the rule applies. A rule must either have a non-empty scope or at least one condition. Multiple conditions are combined together with a logical AND. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(params Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition[] values) { - ConditionsValue = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = null; - ConditionsDescriptor = descriptor; - return Self; + Instance.Conditions = [.. values]; + return this; } - public DetectionRuleDescriptor Conditions(Action configure) + /// + /// + /// An array of numeric conditions when the rule applies. A rule must either have a non-empty scope or at least one condition. Multiple conditions are combined together with a logical AND. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(params System.Action[] actions) { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorActions = null; - ConditionsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor.Build(action)); + } + + Instance.Conditions = items; + return this; } - public DetectionRuleDescriptor Conditions(params Action[] configure) + /// + /// + /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope(System.Collections.Generic.IDictionary? value) { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = configure; - return Self; + Instance.Scope = value; + return this; } /// @@ -126,86 +217,126 @@ public DetectionRuleDescriptor Conditions(params Actionby_field_name, over_field_name, or partition_field_name. /// /// - public DetectionRuleDescriptor Scope(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope() { - ScopeValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Scope = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope(System.Action>? action) { - writer.WriteStartObject(); - if (ActionsValue is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + Instance.Scope = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef.Build(action); + return this; + } - if (ConditionsDescriptor is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ConditionsDescriptor, options); - writer.WriteEndArray(); - } - else if (ConditionsDescriptorAction is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(ConditionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ConditionsDescriptorActions is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - foreach (var action in ConditionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, value); + return this; + } - writer.WriteEndArray(); - } - else if (ConditionsValue is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, value); + return this; + } - if (ScopeValue is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("scope"); - JsonSerializer.Serialize(writer, ScopeValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DetectionRuleDescriptor : SerializableDescriptor +public readonly partial struct DetectionRuleDescriptor { - internal DetectionRuleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectionRuleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule instance) + { + Instance = instance; + } - public DetectionRuleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectionRuleDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ActionsValue { get; set; } - private ICollection? ConditionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor ConditionsDescriptor { get; set; } - private Action ConditionsDescriptorAction { get; set; } - private Action[] ConditionsDescriptorActions { get; set; } - private IDictionary ScopeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) => descriptor.Instance; /// /// /// The set of actions to be triggered when the rule applies. If more than one action is specified the effects of all actions are combined. /// /// - public DetectionRuleDescriptor Actions(ICollection? actions) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Actions(System.Collections.Generic.ICollection? value) + { + Instance.Actions = value; + return this; + } + + /// + /// + /// The set of actions to be triggered when the rule applies. If more than one action is specified the effects of all actions are combined. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Actions(params Elastic.Clients.Elasticsearch.MachineLearning.RuleAction[] values) + { + Instance.Actions = [.. values]; + return this; + } + + /// + /// + /// An array of numeric conditions when the rule applies. A rule must either have a non-empty scope or at least one condition. Multiple conditions are combined together with a logical AND. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(System.Collections.Generic.ICollection? value) + { + Instance.Conditions = value; + return this; + } + + /// + /// + /// An array of numeric conditions when the rule applies. A rule must either have a non-empty scope or at least one condition. Multiple conditions are combined together with a logical AND. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(params Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition[] values) { - ActionsValue = actions; - return Self; + Instance.Conditions = [.. values]; + return this; } /// @@ -213,40 +344,49 @@ public DetectionRuleDescriptor Actions(ICollection /// - public DetectionRuleDescriptor Conditions(ICollection? conditions) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Conditions(params System.Action[] actions) { - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = null; - ConditionsValue = conditions; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor.Build(action)); + } + + Instance.Conditions = items; + return this; } - public DetectionRuleDescriptor Conditions(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor descriptor) + /// + /// + /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope(System.Collections.Generic.IDictionary? value) { - ConditionsValue = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = null; - ConditionsDescriptor = descriptor; - return Self; + Instance.Scope = value; + return this; } - public DetectionRuleDescriptor Conditions(Action configure) + /// + /// + /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope() { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorActions = null; - ConditionsDescriptorAction = configure; - return Self; + Instance.Scope = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef.Build(null); + return this; } - public DetectionRuleDescriptor Conditions(params Action[] configure) + /// + /// + /// A scope of series where the rule applies. A rule must either have a non-empty scope or at least one condition. By default, the scope includes all series. Scoping is allowed for any of the fields that are also specified in by_field_name, over_field_name, or partition_field_name. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope(System.Action? action) { - ConditionsValue = null; - ConditionsDescriptor = null; - ConditionsDescriptorAction = null; - ConditionsDescriptorActions = configure; - return Self; + Instance.Scope = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef.Build(action); + return this; } /// @@ -254,58 +394,50 @@ public DetectionRuleDescriptor Conditions(params Actionby_field_name, over_field_name, or partition_field_name. /// /// - public DetectionRuleDescriptor Scope(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor Scope(System.Action>? action) { - ScopeValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Scope = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldFilterRef.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) { - writer.WriteStartObject(); - if (ActionsValue is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, value); + return this; + } - if (ConditionsDescriptor is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ConditionsDescriptor, options); - writer.WriteEndArray(); - } - else if (ConditionsDescriptorAction is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(ConditionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ConditionsDescriptorActions is not null) - { - writer.WritePropertyName("conditions"); - writer.WriteStartArray(); - foreach (var action in ConditionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, value); + return this; + } - writer.WriteEndArray(); - } - else if (ConditionsValue is not null) - { - writer.WritePropertyName("conditions"); - JsonSerializer.Serialize(writer, ConditionsValue, options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } - if (ScopeValue is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor AddScope(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.Scope ??= new System.Collections.Generic.Dictionary(); + Instance.Scope.Add(key, Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("scope"); - JsonSerializer.Serialize(writer, ScopeValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Detector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Detector.g.cs index 82ad7bed40d..54c5e795de9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Detector.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Detector.g.cs @@ -17,24 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DetectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropByFieldName = System.Text.Json.JsonEncodedText.Encode("by_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropCustomRules = System.Text.Json.JsonEncodedText.Encode("custom_rules"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorDescription = System.Text.Json.JsonEncodedText.Encode("detector_description"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorIndex = System.Text.Json.JsonEncodedText.Encode("detector_index"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeFrequent = System.Text.Json.JsonEncodedText.Encode("exclude_frequent"); + private static readonly System.Text.Json.JsonEncodedText PropFieldName = System.Text.Json.JsonEncodedText.Encode("field_name"); + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldName = System.Text.Json.JsonEncodedText.Encode("over_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldName = System.Text.Json.JsonEncodedText.Encode("partition_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropUseNull = System.Text.Json.JsonEncodedText.Encode("use_null"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Detector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propByFieldName = default; + LocalJsonValue?> propCustomRules = default; + LocalJsonValue propDetectorDescription = default; + LocalJsonValue propDetectorIndex = default; + LocalJsonValue propExcludeFrequent = default; + LocalJsonValue propFieldName = default; + LocalJsonValue propFunction = default; + LocalJsonValue propOverFieldName = default; + LocalJsonValue propPartitionFieldName = default; + LocalJsonValue propUseNull = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propByFieldName.TryReadProperty(ref reader, options, PropByFieldName, null)) + { + continue; + } + + if (propCustomRules.TryReadProperty(ref reader, options, PropCustomRules, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDetectorDescription.TryReadProperty(ref reader, options, PropDetectorDescription, null)) + { + continue; + } + + if (propDetectorIndex.TryReadProperty(ref reader, options, PropDetectorIndex, null)) + { + continue; + } + + if (propExcludeFrequent.TryReadProperty(ref reader, options, PropExcludeFrequent, null)) + { + continue; + } + + if (propFieldName.TryReadProperty(ref reader, options, PropFieldName, null)) + { + continue; + } + + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propOverFieldName.TryReadProperty(ref reader, options, PropOverFieldName, null)) + { + continue; + } + + if (propPartitionFieldName.TryReadProperty(ref reader, options, PropPartitionFieldName, null)) + { + continue; + } + + if (propUseNull.TryReadProperty(ref reader, options, PropUseNull, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ByFieldName = propByFieldName.Value, + CustomRules = propCustomRules.Value, + DetectorDescription = propDetectorDescription.Value, + DetectorIndex = propDetectorIndex.Value, + ExcludeFrequent = propExcludeFrequent.Value, + FieldName = propFieldName.Value, + Function = propFunction.Value, + OverFieldName = propOverFieldName.Value, + PartitionFieldName = propPartitionFieldName.Value, + UseNull = propUseNull.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Detector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropByFieldName, value.ByFieldName, null, null); + writer.WriteProperty(options, PropCustomRules, value.CustomRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDetectorDescription, value.DetectorDescription, null, null); + writer.WriteProperty(options, PropDetectorIndex, value.DetectorIndex, null, null); + writer.WriteProperty(options, PropExcludeFrequent, value.ExcludeFrequent, null, null); + writer.WriteProperty(options, PropFieldName, value.FieldName, null, null); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropOverFieldName, value.OverFieldName, null, null); + writer.WriteProperty(options, PropPartitionFieldName, value.PartitionFieldName, null, null); + writer.WriteProperty(options, PropUseNull, value.UseNull, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DetectorConverter))] public sealed partial class Detector { +#if NET7_0_OR_GREATER + public Detector() + { + } +#endif +#if !NET7_0_OR_GREATER + public Detector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. /// /// - [JsonInclude, JsonPropertyName("by_field_name")] public Elastic.Clients.Elasticsearch.Field? ByFieldName { get; set; } /// @@ -42,15 +174,13 @@ public sealed partial class Detector /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - [JsonInclude, JsonPropertyName("custom_rules")] - public ICollection? CustomRules { get; set; } + public System.Collections.Generic.ICollection? CustomRules { get; set; } /// /// /// A description of the detector. /// /// - [JsonInclude, JsonPropertyName("detector_description")] public string? DetectorDescription { get; set; } /// @@ -58,7 +188,6 @@ public sealed partial class Detector /// A unique identifier for the detector. This identifier is based on the order of the detectors in the analysis_config, starting at zero. If you specify a value for this property, it is ignored. /// /// - [JsonInclude, JsonPropertyName("detector_index")] public int? DetectorIndex { get; set; } /// @@ -66,7 +195,6 @@ public sealed partial class Detector /// If set, frequent entities are excluded from influencing the anomaly results. Entities can be considered frequent over time or frequent in a population. If you are working with both over and by fields, you can set exclude_frequent to all for both fields, or to by or over for those specific fields. /// /// - [JsonInclude, JsonPropertyName("exclude_frequent")] public Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? ExcludeFrequent { get; set; } /// @@ -74,7 +202,6 @@ public sealed partial class Detector /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. /// /// - [JsonInclude, JsonPropertyName("field_name")] public Elastic.Clients.Elasticsearch.Field? FieldName { get; set; } /// @@ -82,7 +209,6 @@ public sealed partial class Detector /// The analysis function that is used. For example, count, rare, mean, min, max, or sum. /// /// - [JsonInclude, JsonPropertyName("function")] public string? Function { get; set; } /// @@ -90,7 +216,6 @@ public sealed partial class Detector /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. /// /// - [JsonInclude, JsonPropertyName("over_field_name")] public Elastic.Clients.Elasticsearch.Field? OverFieldName { get; set; } /// @@ -98,7 +223,6 @@ public sealed partial class Detector /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. /// /// - [JsonInclude, JsonPropertyName("partition_field_name")] public Elastic.Clients.Elasticsearch.Field? PartitionFieldName { get; set; } /// @@ -106,52 +230,37 @@ public sealed partial class Detector /// Defines whether a new series is used as the null series when there is no value for the by or partition fields. /// /// - [JsonInclude, JsonPropertyName("use_null")] public bool? UseNull { get; set; } } -public sealed partial class DetectorDescriptor : SerializableDescriptor> +public readonly partial struct DetectorDescriptor { - internal DetectorDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Detector Instance { get; init; } - public DetectorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? ByFieldNameValue { get; set; } - private ICollection? CustomRulesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor CustomRulesDescriptor { get; set; } - private Action> CustomRulesDescriptorAction { get; set; } - private Action>[] CustomRulesDescriptorActions { get; set; } - private string? DetectorDescriptionValue { get; set; } - private int? DetectorIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? ExcludeFrequentValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldNameValue { get; set; } - private string? FunctionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? OverFieldNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PartitionFieldNameValue { get; set; } - private bool? UseNullValue { get; set; } - - /// - /// - /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. - /// - /// - public DetectorDescriptor ByFieldName(Elastic.Clients.Elasticsearch.Field? byFieldName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorDescriptor() { - ByFieldNameValue = byFieldName; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) => descriptor.Instance; + /// /// /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. /// /// - public DetectorDescriptor ByFieldName(Expression> byFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ByFieldName(Elastic.Clients.Elasticsearch.Field? value) { - ByFieldNameValue = byFieldName; - return Self; + Instance.ByFieldName = value; + return this; } /// @@ -159,10 +268,10 @@ public DetectorDescriptor ByFieldName(Expression /// - public DetectorDescriptor ByFieldName(Expression> byFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ByFieldName(System.Linq.Expressions.Expression> value) { - ByFieldNameValue = byFieldName; - return Self; + Instance.ByFieldName = value; + return this; } /// @@ -170,95 +279,71 @@ public DetectorDescriptor ByFieldName(Expression /// - public DetectorDescriptor CustomRules(ICollection? customRules) - { - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesValue = customRules; - return Self; - } - - public DetectorDescriptor CustomRules(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) - { - CustomRulesValue = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptor = descriptor; - return Self; - } - - public DetectorDescriptor CustomRules(Action> configure) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(System.Collections.Generic.ICollection? value) { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptorAction = configure; - return Self; - } - - public DetectorDescriptor CustomRules(params Action>[] configure) - { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = configure; - return Self; + Instance.CustomRules = value; + return this; } /// /// - /// A description of the detector. + /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - public DetectorDescriptor DetectorDescription(string? detectorDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(params Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule[] values) { - DetectorDescriptionValue = detectorDescription; - return Self; + Instance.CustomRules = [.. values]; + return this; } /// /// - /// A unique identifier for the detector. This identifier is based on the order of the detectors in the analysis_config, starting at zero. If you specify a value for this property, it is ignored. + /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - public DetectorDescriptor DetectorIndex(int? detectorIndex) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(params System.Action>?[] actions) { - DetectorIndexValue = detectorIndex; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } + + Instance.CustomRules = items; + return this; } /// /// - /// If set, frequent entities are excluded from influencing the anomaly results. Entities can be considered frequent over time or frequent in a population. If you are working with both over and by fields, you can set exclude_frequent to all for both fields, or to by or over for those specific fields. + /// A description of the detector. /// /// - public DetectorDescriptor ExcludeFrequent(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? excludeFrequent) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorDescription(string? value) { - ExcludeFrequentValue = excludeFrequent; - return Self; + Instance.DetectorDescription = value; + return this; } /// /// - /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. + /// A unique identifier for the detector. This identifier is based on the order of the detectors in the analysis_config, starting at zero. If you specify a value for this property, it is ignored. /// /// - public DetectorDescriptor FieldName(Elastic.Clients.Elasticsearch.Field? fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorIndex(int? value) { - FieldNameValue = fieldName; - return Self; + Instance.DetectorIndex = value; + return this; } /// /// - /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. + /// If set, frequent entities are excluded from influencing the anomaly results. Entities can be considered frequent over time or frequent in a population. If you are working with both over and by fields, you can set exclude_frequent to all for both fields, or to by or over for those specific fields. /// /// - public DetectorDescriptor FieldName(Expression> fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ExcludeFrequent(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? value) { - FieldNameValue = fieldName; - return Self; + Instance.ExcludeFrequent = value; + return this; } /// @@ -266,32 +351,32 @@ public DetectorDescriptor FieldName(Expressionfield_name cannot contain double quotes or backslashes. /// /// - public DetectorDescriptor FieldName(Expression> fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor FieldName(Elastic.Clients.Elasticsearch.Field? value) { - FieldNameValue = fieldName; - return Self; + Instance.FieldName = value; + return this; } /// /// - /// The analysis function that is used. For example, count, rare, mean, min, max, or sum. + /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. /// /// - public DetectorDescriptor Function(string? function) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor FieldName(System.Linq.Expressions.Expression> value) { - FunctionValue = function; - return Self; + Instance.FieldName = value; + return this; } /// /// - /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. + /// The analysis function that is used. For example, count, rare, mean, min, max, or sum. /// /// - public DetectorDescriptor OverFieldName(Elastic.Clients.Elasticsearch.Field? overFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor Function(string? value) { - OverFieldNameValue = overFieldName; - return Self; + Instance.Function = value; + return this; } /// @@ -299,10 +384,10 @@ public DetectorDescriptor OverFieldName(Elastic.Clients.Elasticsearch /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. /// /// - public DetectorDescriptor OverFieldName(Expression> overFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor OverFieldName(Elastic.Clients.Elasticsearch.Field? value) { - OverFieldNameValue = overFieldName; - return Self; + Instance.OverFieldName = value; + return this; } /// @@ -310,21 +395,10 @@ public DetectorDescriptor OverFieldName(Expression /// - public DetectorDescriptor OverFieldName(Expression> overFieldName) - { - OverFieldNameValue = overFieldName; - return Self; - } - - /// - /// - /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. - /// - /// - public DetectorDescriptor PartitionFieldName(Elastic.Clients.Elasticsearch.Field? partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor OverFieldName(System.Linq.Expressions.Expression> value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.OverFieldName = value; + return this; } /// @@ -332,10 +406,10 @@ public DetectorDescriptor PartitionFieldName(Elastic.Clients.Elastics /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. /// /// - public DetectorDescriptor PartitionFieldName(Expression> partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor PartitionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.PartitionFieldName = value; + return this; } /// @@ -343,10 +417,10 @@ public DetectorDescriptor PartitionFieldName(Expression /// - public DetectorDescriptor PartitionFieldName(Expression> partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor PartitionFieldName(System.Linq.Expressions.Expression> value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.PartitionFieldName = value; + return this; } /// @@ -354,146 +428,54 @@ public DetectorDescriptor PartitionFieldName(Expression /// - public DetectorDescriptor UseNull(bool? useNull = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor UseNull(bool? value = true) { - UseNullValue = useNull; - return Self; + Instance.UseNull = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Detector Build(System.Action>? action) { - writer.WriteStartObject(); - if (ByFieldNameValue is not null) - { - writer.WritePropertyName("by_field_name"); - JsonSerializer.Serialize(writer, ByFieldNameValue, options); - } - - if (CustomRulesDescriptor is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, CustomRulesDescriptor, options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorAction is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(CustomRulesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorActions is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - foreach (var action in CustomRulesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (CustomRulesValue is not null) - { - writer.WritePropertyName("custom_rules"); - JsonSerializer.Serialize(writer, CustomRulesValue, options); - } - - if (!string.IsNullOrEmpty(DetectorDescriptionValue)) - { - writer.WritePropertyName("detector_description"); - writer.WriteStringValue(DetectorDescriptionValue); - } - - if (DetectorIndexValue.HasValue) - { - writer.WritePropertyName("detector_index"); - writer.WriteNumberValue(DetectorIndexValue.Value); - } - - if (ExcludeFrequentValue is not null) - { - writer.WritePropertyName("exclude_frequent"); - JsonSerializer.Serialize(writer, ExcludeFrequentValue, options); - } - - if (FieldNameValue is not null) + if (action is null) { - writer.WritePropertyName("field_name"); - JsonSerializer.Serialize(writer, FieldNameValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(FunctionValue)) - { - writer.WritePropertyName("function"); - writer.WriteStringValue(FunctionValue); - } - - if (OverFieldNameValue is not null) - { - writer.WritePropertyName("over_field_name"); - JsonSerializer.Serialize(writer, OverFieldNameValue, options); - } - - if (PartitionFieldNameValue is not null) - { - writer.WritePropertyName("partition_field_name"); - JsonSerializer.Serialize(writer, PartitionFieldNameValue, options); - } - - if (UseNullValue.HasValue) - { - writer.WritePropertyName("use_null"); - writer.WriteBooleanValue(UseNullValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DetectorDescriptor : SerializableDescriptor +public readonly partial struct DetectorDescriptor { - internal DetectorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Detector Instance { get; init; } - public DetectorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? ByFieldNameValue { get; set; } - private ICollection? CustomRulesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor CustomRulesDescriptor { get; set; } - private Action CustomRulesDescriptorAction { get; set; } - private Action[] CustomRulesDescriptorActions { get; set; } - private string? DetectorDescriptionValue { get; set; } - private int? DetectorIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? ExcludeFrequentValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? FieldNameValue { get; set; } - private string? FunctionValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? OverFieldNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PartitionFieldNameValue { get; set; } - private bool? UseNullValue { get; set; } - - /// - /// - /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. - /// - /// - public DetectorDescriptor ByFieldName(Elastic.Clients.Elasticsearch.Field? byFieldName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorDescriptor() { - ByFieldNameValue = byFieldName; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Detector instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor descriptor) => descriptor.Instance; + /// /// /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to their own history. It is used for finding unusual values in the context of the split. /// /// - public DetectorDescriptor ByFieldName(Expression> byFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ByFieldName(Elastic.Clients.Elasticsearch.Field? value) { - ByFieldNameValue = byFieldName; - return Self; + Instance.ByFieldName = value; + return this; } /// @@ -501,10 +483,10 @@ public DetectorDescriptor ByFieldName(Expression /// - public DetectorDescriptor ByFieldName(Expression> byFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ByFieldName(System.Linq.Expressions.Expression> value) { - ByFieldNameValue = byFieldName; - return Self; + Instance.ByFieldName = value; + return this; } /// @@ -512,139 +494,121 @@ public DetectorDescriptor ByFieldName(Expression /// - public DetectorDescriptor CustomRules(ICollection? customRules) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(System.Collections.Generic.ICollection? value) { - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesValue = customRules; - return Self; - } - - public DetectorDescriptor CustomRules(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) - { - CustomRulesValue = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptor = descriptor; - return Self; - } - - public DetectorDescriptor CustomRules(Action configure) - { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptorAction = configure; - return Self; - } - - public DetectorDescriptor CustomRules(params Action[] configure) - { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = configure; - return Self; + Instance.CustomRules = value; + return this; } /// /// - /// A description of the detector. + /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - public DetectorDescriptor DetectorDescription(string? detectorDescription) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(params Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule[] values) { - DetectorDescriptionValue = detectorDescription; - return Self; + Instance.CustomRules = [.. values]; + return this; } /// /// - /// A unique identifier for the detector. This identifier is based on the order of the detectors in the analysis_config, starting at zero. If you specify a value for this property, it is ignored. + /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - public DetectorDescriptor DetectorIndex(int? detectorIndex) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(params System.Action?[] actions) { - DetectorIndexValue = detectorIndex; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } + + Instance.CustomRules = items; + return this; } /// /// - /// If set, frequent entities are excluded from influencing the anomaly results. Entities can be considered frequent over time or frequent in a population. If you are working with both over and by fields, you can set exclude_frequent to all for both fields, or to by or over for those specific fields. + /// Custom rules enable you to customize the way detectors operate. For example, a rule may dictate conditions under which results should be skipped. Kibana refers to custom rules as job rules. /// /// - public DetectorDescriptor ExcludeFrequent(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? excludeFrequent) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor CustomRules(params System.Action>?[] actions) { - ExcludeFrequentValue = excludeFrequent; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } + + Instance.CustomRules = items; + return this; } /// /// - /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. + /// A description of the detector. /// /// - public DetectorDescriptor FieldName(Elastic.Clients.Elasticsearch.Field? fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorDescription(string? value) { - FieldNameValue = fieldName; - return Self; + Instance.DetectorDescription = value; + return this; } /// /// - /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. + /// A unique identifier for the detector. This identifier is based on the order of the detectors in the analysis_config, starting at zero. If you specify a value for this property, it is ignored. /// /// - public DetectorDescriptor FieldName(Expression> fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor DetectorIndex(int? value) { - FieldNameValue = fieldName; - return Self; + Instance.DetectorIndex = value; + return this; } /// /// - /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. + /// If set, frequent entities are excluded from influencing the anomaly results. Entities can be considered frequent over time or frequent in a population. If you are working with both over and by fields, you can set exclude_frequent to all for both fields, or to by or over for those specific fields. /// /// - public DetectorDescriptor FieldName(Expression> fieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor ExcludeFrequent(Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? value) { - FieldNameValue = fieldName; - return Self; + Instance.ExcludeFrequent = value; + return this; } /// /// - /// The analysis function that is used. For example, count, rare, mean, min, max, or sum. + /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. /// /// - public DetectorDescriptor Function(string? function) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor FieldName(Elastic.Clients.Elasticsearch.Field? value) { - FunctionValue = function; - return Self; + Instance.FieldName = value; + return this; } /// /// - /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. + /// The field that the detector uses in the function. If you use an event rate function such as count or rare, do not specify this field. The field_name cannot contain double quotes or backslashes. /// /// - public DetectorDescriptor OverFieldName(Elastic.Clients.Elasticsearch.Field? overFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor FieldName(System.Linq.Expressions.Expression> value) { - OverFieldNameValue = overFieldName; - return Self; + Instance.FieldName = value; + return this; } /// /// - /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. + /// The analysis function that is used. For example, count, rare, mean, min, max, or sum. /// /// - public DetectorDescriptor OverFieldName(Expression> overFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor Function(string? value) { - OverFieldNameValue = overFieldName; - return Self; + Instance.Function = value; + return this; } /// @@ -652,21 +616,21 @@ public DetectorDescriptor OverFieldName(Expression /// - public DetectorDescriptor OverFieldName(Expression> overFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor OverFieldName(Elastic.Clients.Elasticsearch.Field? value) { - OverFieldNameValue = overFieldName; - return Self; + Instance.OverFieldName = value; + return this; } /// /// - /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. + /// The field used to split the data. In particular, this property is used for analyzing the splits with respect to the history of all splits. It is used for finding unusual values in the population of all splits. /// /// - public DetectorDescriptor PartitionFieldName(Elastic.Clients.Elasticsearch.Field? partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor OverFieldName(System.Linq.Expressions.Expression> value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.OverFieldName = value; + return this; } /// @@ -674,10 +638,10 @@ public DetectorDescriptor PartitionFieldName(Elastic.Clients.Elasticsearch.Field /// The field used to segment the analysis. When you use this property, you have completely independent baselines for each value of this field. /// /// - public DetectorDescriptor PartitionFieldName(Expression> partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor PartitionFieldName(Elastic.Clients.Elasticsearch.Field? value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.PartitionFieldName = value; + return this; } /// @@ -685,10 +649,10 @@ public DetectorDescriptor PartitionFieldName(Expression /// - public DetectorDescriptor PartitionFieldName(Expression> partitionFieldName) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor PartitionFieldName(System.Linq.Expressions.Expression> value) { - PartitionFieldNameValue = partitionFieldName; - return Self; + Instance.PartitionFieldName = value; + return this; } /// @@ -696,100 +660,22 @@ public DetectorDescriptor PartitionFieldName(Expression /// - public DetectorDescriptor UseNull(bool? useNull = true) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor UseNull(bool? value = true) { - UseNullValue = useNull; - return Self; + Instance.UseNull = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Detector Build(System.Action? action) { - writer.WriteStartObject(); - if (ByFieldNameValue is not null) + if (action is null) { - writer.WritePropertyName("by_field_name"); - JsonSerializer.Serialize(writer, ByFieldNameValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CustomRulesDescriptor is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, CustomRulesDescriptor, options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorAction is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(CustomRulesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorActions is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - foreach (var action in CustomRulesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (CustomRulesValue is not null) - { - writer.WritePropertyName("custom_rules"); - JsonSerializer.Serialize(writer, CustomRulesValue, options); - } - - if (!string.IsNullOrEmpty(DetectorDescriptionValue)) - { - writer.WritePropertyName("detector_description"); - writer.WriteStringValue(DetectorDescriptionValue); - } - - if (DetectorIndexValue.HasValue) - { - writer.WritePropertyName("detector_index"); - writer.WriteNumberValue(DetectorIndexValue.Value); - } - - if (ExcludeFrequentValue is not null) - { - writer.WritePropertyName("exclude_frequent"); - JsonSerializer.Serialize(writer, ExcludeFrequentValue, options); - } - - if (FieldNameValue is not null) - { - writer.WritePropertyName("field_name"); - JsonSerializer.Serialize(writer, FieldNameValue, options); - } - - if (!string.IsNullOrEmpty(FunctionValue)) - { - writer.WritePropertyName("function"); - writer.WriteStringValue(FunctionValue); - } - - if (OverFieldNameValue is not null) - { - writer.WritePropertyName("over_field_name"); - JsonSerializer.Serialize(writer, OverFieldNameValue, options); - } - - if (PartitionFieldNameValue is not null) - { - writer.WritePropertyName("partition_field_name"); - JsonSerializer.Serialize(writer, PartitionFieldNameValue, options); - } - - if (UseNullValue.HasValue) - { - writer.WritePropertyName("use_null"); - writer.WriteBooleanValue(UseNullValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Detector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorRead.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorRead.g.cs index fb201c57572..e2a0dd70c88 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorRead.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorRead.g.cs @@ -17,18 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DetectorReadConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropByFieldName = System.Text.Json.JsonEncodedText.Encode("by_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropCustomRules = System.Text.Json.JsonEncodedText.Encode("custom_rules"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorDescription = System.Text.Json.JsonEncodedText.Encode("detector_description"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorIndex = System.Text.Json.JsonEncodedText.Encode("detector_index"); + private static readonly System.Text.Json.JsonEncodedText PropExcludeFrequent = System.Text.Json.JsonEncodedText.Encode("exclude_frequent"); + private static readonly System.Text.Json.JsonEncodedText PropFieldName = System.Text.Json.JsonEncodedText.Encode("field_name"); + private static readonly System.Text.Json.JsonEncodedText PropFunction = System.Text.Json.JsonEncodedText.Encode("function"); + private static readonly System.Text.Json.JsonEncodedText PropOverFieldName = System.Text.Json.JsonEncodedText.Encode("over_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropPartitionFieldName = System.Text.Json.JsonEncodedText.Encode("partition_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropUseNull = System.Text.Json.JsonEncodedText.Encode("use_null"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DetectorRead Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propByFieldName = default; + LocalJsonValue?> propCustomRules = default; + LocalJsonValue propDetectorDescription = default; + LocalJsonValue propDetectorIndex = default; + LocalJsonValue propExcludeFrequent = default; + LocalJsonValue propFieldName = default; + LocalJsonValue propFunction = default; + LocalJsonValue propOverFieldName = default; + LocalJsonValue propPartitionFieldName = default; + LocalJsonValue propUseNull = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propByFieldName.TryReadProperty(ref reader, options, PropByFieldName, null)) + { + continue; + } + + if (propCustomRules.TryReadProperty(ref reader, options, PropCustomRules, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDetectorDescription.TryReadProperty(ref reader, options, PropDetectorDescription, null)) + { + continue; + } + + if (propDetectorIndex.TryReadProperty(ref reader, options, PropDetectorIndex, null)) + { + continue; + } + + if (propExcludeFrequent.TryReadProperty(ref reader, options, PropExcludeFrequent, null)) + { + continue; + } + + if (propFieldName.TryReadProperty(ref reader, options, PropFieldName, null)) + { + continue; + } + + if (propFunction.TryReadProperty(ref reader, options, PropFunction, null)) + { + continue; + } + + if (propOverFieldName.TryReadProperty(ref reader, options, PropOverFieldName, null)) + { + continue; + } + + if (propPartitionFieldName.TryReadProperty(ref reader, options, PropPartitionFieldName, null)) + { + continue; + } + + if (propUseNull.TryReadProperty(ref reader, options, PropUseNull, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DetectorRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ByFieldName = propByFieldName.Value, + CustomRules = propCustomRules.Value, + DetectorDescription = propDetectorDescription.Value, + DetectorIndex = propDetectorIndex.Value, + ExcludeFrequent = propExcludeFrequent.Value, + FieldName = propFieldName.Value, + Function = propFunction.Value, + OverFieldName = propOverFieldName.Value, + PartitionFieldName = propPartitionFieldName.Value, + UseNull = propUseNull.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DetectorRead value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropByFieldName, value.ByFieldName, null, null); + writer.WriteProperty(options, PropCustomRules, value.CustomRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDetectorDescription, value.DetectorDescription, null, null); + writer.WriteProperty(options, PropDetectorIndex, value.DetectorIndex, null, null); + writer.WriteProperty(options, PropExcludeFrequent, value.ExcludeFrequent, null, null); + writer.WriteProperty(options, PropFieldName, value.FieldName, null, null); + writer.WriteProperty(options, PropFunction, value.Function, null, null); + writer.WriteProperty(options, PropOverFieldName, value.OverFieldName, null, null); + writer.WriteProperty(options, PropPartitionFieldName, value.PartitionFieldName, null, null); + writer.WriteProperty(options, PropUseNull, value.UseNull, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DetectorReadConverter))] public sealed partial class DetectorRead { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorRead(string function) + { + Function = function; + } +#if NET7_0_OR_GREATER + public DetectorRead() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DetectorRead() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DetectorRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field used to split the data. @@ -36,8 +175,7 @@ public sealed partial class DetectorRead /// It is used for finding unusual values in the context of the split. /// /// - [JsonInclude, JsonPropertyName("by_field_name")] - public string? ByFieldName { get; init; } + public string? ByFieldName { get; set; } /// /// @@ -46,16 +184,14 @@ public sealed partial class DetectorRead /// Kibana refers to custom rules as job rules. /// /// - [JsonInclude, JsonPropertyName("custom_rules")] - public IReadOnlyCollection? CustomRules { get; init; } + public System.Collections.Generic.IReadOnlyCollection? CustomRules { get; set; } /// /// /// A description of the detector. /// /// - [JsonInclude, JsonPropertyName("detector_description")] - public string? DetectorDescription { get; init; } + public string? DetectorDescription { get; set; } /// /// @@ -63,8 +199,7 @@ public sealed partial class DetectorRead /// This identifier is based on the order of the detectors in the analysis_config, starting at zero. /// /// - [JsonInclude, JsonPropertyName("detector_index")] - public int? DetectorIndex { get; init; } + public int? DetectorIndex { get; set; } /// /// @@ -74,8 +209,7 @@ public sealed partial class DetectorRead /// If you are working with both over and by fields, then you can set exclude_frequent to all for both fields, or to by or over for those specific fields. /// /// - [JsonInclude, JsonPropertyName("exclude_frequent")] - public Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? ExcludeFrequent { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ExcludeFrequent? ExcludeFrequent { get; set; } /// /// @@ -83,8 +217,7 @@ public sealed partial class DetectorRead /// If you use an event rate function such as count or rare, do not specify this field. /// /// - [JsonInclude, JsonPropertyName("field_name")] - public string? FieldName { get; init; } + public string? FieldName { get; set; } /// /// @@ -92,8 +225,11 @@ public sealed partial class DetectorRead /// For example, count, rare, mean, min, max, and sum. /// /// - [JsonInclude, JsonPropertyName("function")] - public string Function { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Function { get; set; } /// /// @@ -102,8 +238,7 @@ public sealed partial class DetectorRead /// It is used for finding unusual values in the population of all splits. /// /// - [JsonInclude, JsonPropertyName("over_field_name")] - public string? OverFieldName { get; init; } + public string? OverFieldName { get; set; } /// /// @@ -111,14 +246,12 @@ public sealed partial class DetectorRead /// When you use this property, you have completely independent baselines for each value of this field. /// /// - [JsonInclude, JsonPropertyName("partition_field_name")] - public string? PartitionFieldName { get; init; } + public string? PartitionFieldName { get; set; } /// /// /// Defines whether a new series is used as the null series when there is no value for the by or partition fields. /// /// - [JsonInclude, JsonPropertyName("use_null")] - public bool? UseNull { get; init; } + public bool? UseNull { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorUpdate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorUpdate.g.cs index a08ff5d8000..beb10ce4a73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorUpdate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DetectorUpdate.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DetectorUpdateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCustomRules = System.Text.Json.JsonEncodedText.Encode("custom_rules"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDetectorIndex = System.Text.Json.JsonEncodedText.Encode("detector_index"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCustomRules = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDetectorIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCustomRules.TryReadProperty(ref reader, options, PropCustomRules, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDetectorIndex.TryReadProperty(ref reader, options, PropDetectorIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CustomRules = propCustomRules.Value, + Description = propDescription.Value, + DetectorIndex = propDetectorIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCustomRules, value.CustomRules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDetectorIndex, value.DetectorIndex, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateConverter))] public sealed partial class DetectorUpdate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorUpdate(int detectorIndex) + { + DetectorIndex = detectorIndex; + } +#if NET7_0_OR_GREATER + public DetectorUpdate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DetectorUpdate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of custom rule objects, which enable you to customize the way detectors operate. @@ -36,15 +112,13 @@ public sealed partial class DetectorUpdate /// Kibana refers to custom rules as job rules. /// /// - [JsonInclude, JsonPropertyName("custom_rules")] - public ICollection? CustomRules { get; set; } + public System.Collections.Generic.ICollection? CustomRules { get; set; } /// /// /// A description of the detector. /// /// - [JsonInclude, JsonPropertyName("description")] public string? Description { get; set; } /// @@ -53,24 +127,31 @@ public sealed partial class DetectorUpdate /// This identifier is based on the order of the detectors in the analysis_config, starting at zero. /// /// - [JsonInclude, JsonPropertyName("detector_index")] - public int DetectorIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DetectorIndex { get; set; } } -public sealed partial class DetectorUpdateDescriptor : SerializableDescriptor> +public readonly partial struct DetectorUpdateDescriptor { - internal DetectorUpdateDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate instance) + { + Instance = instance; + } - public DetectorUpdateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorUpdateDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? CustomRulesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor CustomRulesDescriptor { get; set; } - private Action> CustomRulesDescriptorAction { get; set; } - private Action>[] CustomRulesDescriptorActions { get; set; } - private string? DescriptionValue { get; set; } - private int DetectorIndexValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor descriptor) => descriptor.Instance; /// /// @@ -79,40 +160,42 @@ public DetectorUpdateDescriptor() : base() /// Kibana refers to custom rules as job rules. /// /// - public DetectorUpdateDescriptor CustomRules(ICollection? customRules) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(System.Collections.Generic.ICollection? value) { - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesValue = customRules; - return Self; + Instance.CustomRules = value; + return this; } - public DetectorUpdateDescriptor CustomRules(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) + /// + /// + /// An array of custom rule objects, which enable you to customize the way detectors operate. + /// For example, a rule may dictate to the detector conditions under which results should be skipped. + /// Kibana refers to custom rules as job rules. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(params Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule[] values) { - CustomRulesValue = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptor = descriptor; - return Self; + Instance.CustomRules = [.. values]; + return this; } - public DetectorUpdateDescriptor CustomRules(Action> configure) + /// + /// + /// An array of custom rule objects, which enable you to customize the way detectors operate. + /// For example, a rule may dictate to the detector conditions under which results should be skipped. + /// Kibana refers to custom rules as job rules. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(params System.Action>?[] actions) { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } - public DetectorUpdateDescriptor CustomRules(params Action>[] configure) - { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = configure; - return Self; + Instance.CustomRules = items; + return this; } /// @@ -120,10 +203,10 @@ public DetectorUpdateDescriptor CustomRules(params Action /// - public DetectorUpdateDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -132,72 +215,39 @@ public DetectorUpdateDescriptor Description(string? description) /// This identifier is based on the order of the detectors in the analysis_config, starting at zero. /// /// - public DetectorUpdateDescriptor DetectorIndex(int detectorIndex) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor DetectorIndex(int value) { - DetectorIndexValue = detectorIndex; - return Self; + Instance.DetectorIndex = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate Build(System.Action> action) { - writer.WriteStartObject(); - if (CustomRulesDescriptor is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, CustomRulesDescriptor, options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorAction is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(CustomRulesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorActions is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - foreach (var action in CustomRulesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (CustomRulesValue is not null) - { - writer.WritePropertyName("custom_rules"); - JsonSerializer.Serialize(writer, CustomRulesValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("detector_index"); - writer.WriteNumberValue(DetectorIndexValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DetectorUpdateDescriptor : SerializableDescriptor +public readonly partial struct DetectorUpdateDescriptor { - internal DetectorUpdateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate Instance { get; init; } - public DetectorUpdateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate instance) { + Instance = instance; } - private ICollection? CustomRulesValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor CustomRulesDescriptor { get; set; } - private Action CustomRulesDescriptorAction { get; set; } - private Action[] CustomRulesDescriptorActions { get; set; } - private string? DescriptionValue { get; set; } - private int DetectorIndexValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetectorUpdateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor descriptor) => descriptor.Instance; /// /// @@ -206,40 +256,61 @@ public DetectorUpdateDescriptor() : base() /// Kibana refers to custom rules as job rules. /// /// - public DetectorUpdateDescriptor CustomRules(ICollection? customRules) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(System.Collections.Generic.ICollection? value) { - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesValue = customRules; - return Self; + Instance.CustomRules = value; + return this; } - public DetectorUpdateDescriptor CustomRules(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor descriptor) + /// + /// + /// An array of custom rule objects, which enable you to customize the way detectors operate. + /// For example, a rule may dictate to the detector conditions under which results should be skipped. + /// Kibana refers to custom rules as job rules. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(params Elastic.Clients.Elasticsearch.MachineLearning.DetectionRule[] values) { - CustomRulesValue = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptor = descriptor; - return Self; + Instance.CustomRules = [.. values]; + return this; } - public DetectorUpdateDescriptor CustomRules(Action configure) + /// + /// + /// An array of custom rule objects, which enable you to customize the way detectors operate. + /// For example, a rule may dictate to the detector conditions under which results should be skipped. + /// Kibana refers to custom rules as job rules. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(params System.Action?[] actions) { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorActions = null; - CustomRulesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } + + Instance.CustomRules = items; + return this; } - public DetectorUpdateDescriptor CustomRules(params Action[] configure) + /// + /// + /// An array of custom rule objects, which enable you to customize the way detectors operate. + /// For example, a rule may dictate to the detector conditions under which results should be skipped. + /// Kibana refers to custom rules as job rules. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor CustomRules(params System.Action>?[] actions) { - CustomRulesValue = null; - CustomRulesDescriptor = null; - CustomRulesDescriptorAction = null; - CustomRulesDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor.Build(action)); + } + + Instance.CustomRules = items; + return this; } /// @@ -247,10 +318,10 @@ public DetectorUpdateDescriptor CustomRules(params Action /// - public DetectorUpdateDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -259,54 +330,17 @@ public DetectorUpdateDescriptor Description(string? description) /// This identifier is based on the order of the detectors in the analysis_config, starting at zero. /// /// - public DetectorUpdateDescriptor DetectorIndex(int detectorIndex) + public Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor DetectorIndex(int value) { - DetectorIndexValue = detectorIndex; - return Self; + Instance.DetectorIndex = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate Build(System.Action action) { - writer.WriteStartObject(); - if (CustomRulesDescriptor is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, CustomRulesDescriptor, options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorAction is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(CustomRulesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (CustomRulesDescriptorActions is not null) - { - writer.WritePropertyName("custom_rules"); - writer.WriteStartArray(); - foreach (var action in CustomRulesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.DetectionRuleDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (CustomRulesValue is not null) - { - writer.WritePropertyName("custom_rules"); - JsonSerializer.Serialize(writer, CustomRulesValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - writer.WritePropertyName("detector_index"); - writer.WriteNumberValue(DetectorIndexValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.DetectorUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeCompact.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeCompact.g.cs index 22ee787581f..17e08b2042b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeCompact.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeCompact.g.cs @@ -17,31 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DiscoveryNodeCompactConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + Id = propId.Value, + Name = propName.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Alternative representation of DiscoveryNode used in ml.get_job_stats and ml.get_datafeed_stats /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompactConverter))] public sealed partial class DiscoveryNodeCompact { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string EphemeralId { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiscoveryNodeCompact(System.Collections.Generic.IReadOnlyDictionary attributes, string ephemeralId, string id, string name, string transportAddress) + { + Attributes = attributes; + EphemeralId = ephemeralId; + Id = id; + Name = name; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public DiscoveryNodeCompact() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DiscoveryNodeCompact() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiscoveryNodeCompact(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string EphemeralId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeContent.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeContent.g.cs index e24cf838d53..0c32aab8ff7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeContent.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/DiscoveryNodeContent.g.cs @@ -17,34 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class DiscoveryNodeContentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropExternalId = System.Text.Json.JsonEncodedText.Encode("external_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxIndexVersion = System.Text.Json.JsonEncodedText.Encode("max_index_version"); + private static readonly System.Text.Json.JsonEncodedText PropMinIndexVersion = System.Text.Json.JsonEncodedText.Encode("min_index_version"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeContent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propExternalId = default; + LocalJsonValue propMaxIndexVersion = default; + LocalJsonValue propMinIndexVersion = default; + LocalJsonValue propName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propExternalId.TryReadProperty(ref reader, options, PropExternalId, null)) + { + continue; + } + + if (propMaxIndexVersion.TryReadProperty(ref reader, options, PropMaxIndexVersion, null)) + { + continue; + } + + if (propMinIndexVersion.TryReadProperty(ref reader, options, PropMinIndexVersion, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeContent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + ExternalId = propExternalId.Value, + MaxIndexVersion = propMaxIndexVersion.Value, + MinIndexVersion = propMinIndexVersion.Value, + Name = propName.Value, + Roles = propRoles.Value, + TransportAddress = propTransportAddress.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeContent value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropExternalId, value.ExternalId, null, null); + writer.WriteProperty(options, PropMaxIndexVersion, value.MaxIndexVersion, null, null); + writer.WriteProperty(options, PropMinIndexVersion, value.MinIndexVersion, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeContentConverter))] public sealed partial class DiscoveryNodeContent { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string EphemeralId { get; init; } - [JsonInclude, JsonPropertyName("external_id")] - public string ExternalId { get; init; } - [JsonInclude, JsonPropertyName("max_index_version")] - public int MaxIndexVersion { get; init; } - [JsonInclude, JsonPropertyName("min_index_version")] - public int MinIndexVersion { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DiscoveryNodeContent(System.Collections.Generic.IReadOnlyDictionary attributes, string ephemeralId, string externalId, int maxIndexVersion, int minIndexVersion, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, string version) + { + Attributes = attributes; + EphemeralId = ephemeralId; + ExternalId = externalId; + MaxIndexVersion = maxIndexVersion; + MinIndexVersion = minIndexVersion; + Roles = roles; + TransportAddress = transportAddress; + Version = version; + } +#if NET7_0_OR_GREATER + public DiscoveryNodeContent() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DiscoveryNodeContent() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DiscoveryNodeContent(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string EphemeralId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ExternalId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxIndexVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MinIndexVersion { get; set; } + public string? Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Ensemble.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Ensemble.g.cs index d9c603a5abc..e2574577432 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Ensemble.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Ensemble.g.cs @@ -17,195 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class EnsembleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregateOutput = System.Text.Json.JsonEncodedText.Encode("aggregate_output"); + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureNames = System.Text.Json.JsonEncodedText.Encode("feature_names"); + private static readonly System.Text.Json.JsonEncodedText PropTargetType = System.Text.Json.JsonEncodedText.Encode("target_type"); + private static readonly System.Text.Json.JsonEncodedText PropTrainedModels = System.Text.Json.JsonEncodedText.Encode("trained_models"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Ensemble Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregateOutput = default; + LocalJsonValue?> propClassificationLabels = default; + LocalJsonValue?> propFeatureNames = default; + LocalJsonValue propTargetType = default; + LocalJsonValue> propTrainedModels = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregateOutput.TryReadProperty(ref reader, options, PropAggregateOutput, null)) + { + continue; + } + + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureNames.TryReadProperty(ref reader, options, PropFeatureNames, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTargetType.TryReadProperty(ref reader, options, PropTargetType, null)) + { + continue; + } + + if (propTrainedModels.TryReadProperty(ref reader, options, PropTrainedModels, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Ensemble(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AggregateOutput = propAggregateOutput.Value, + ClassificationLabels = propClassificationLabels.Value, + FeatureNames = propFeatureNames.Value, + TargetType = propTargetType.Value, + TrainedModels = propTrainedModels.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Ensemble value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregateOutput, value.AggregateOutput, null, null); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureNames, value.FeatureNames, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTargetType, value.TargetType, null, null); + writer.WriteProperty(options, PropTrainedModels, value.TrainedModels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.EnsembleConverter))] public sealed partial class Ensemble { - [JsonInclude, JsonPropertyName("aggregate_output")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Ensemble(System.Collections.Generic.ICollection trainedModels) + { + TrainedModels = trainedModels; + } +#if NET7_0_OR_GREATER + public Ensemble() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Ensemble() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ensemble(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput? AggregateOutput { get; set; } - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection? ClassificationLabels { get; set; } - [JsonInclude, JsonPropertyName("feature_names")] - public ICollection? FeatureNames { get; set; } - [JsonInclude, JsonPropertyName("target_type")] + public System.Collections.Generic.ICollection? ClassificationLabels { get; set; } + public System.Collections.Generic.ICollection? FeatureNames { get; set; } public string? TargetType { get; set; } - [JsonInclude, JsonPropertyName("trained_models")] - public ICollection TrainedModels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection TrainedModels { get; set; } } -public sealed partial class EnsembleDescriptor : SerializableDescriptor +public readonly partial struct EnsembleDescriptor { - internal EnsembleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Ensemble Instance { get; init; } - public EnsembleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnsembleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Ensemble instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput? AggregateOutputValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor AggregateOutputDescriptor { get; set; } - private Action AggregateOutputDescriptorAction { get; set; } - private ICollection? ClassificationLabelsValue { get; set; } - private ICollection? FeatureNamesValue { get; set; } - private string? TargetTypeValue { get; set; } - private ICollection TrainedModelsValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor TrainedModelsDescriptor { get; set; } - private Action TrainedModelsDescriptorAction { get; set; } - private Action[] TrainedModelsDescriptorActions { get; set; } - - public EnsembleDescriptor AggregateOutput(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput? aggregateOutput) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EnsembleDescriptor() { - AggregateOutputDescriptor = null; - AggregateOutputDescriptorAction = null; - AggregateOutputValue = aggregateOutput; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Ensemble(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public EnsembleDescriptor AggregateOutput(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Ensemble instance) => new Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Ensemble(Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor AggregateOutput(Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutput? value) { - AggregateOutputValue = null; - AggregateOutputDescriptorAction = null; - AggregateOutputDescriptor = descriptor; - return Self; + Instance.AggregateOutput = value; + return this; } - public EnsembleDescriptor AggregateOutput(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor AggregateOutput() { - AggregateOutputValue = null; - AggregateOutputDescriptor = null; - AggregateOutputDescriptorAction = configure; - return Self; + Instance.AggregateOutput = Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor.Build(null); + return this; } - public EnsembleDescriptor ClassificationLabels(ICollection? classificationLabels) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor AggregateOutput(System.Action? action) { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance.AggregateOutput = Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor.Build(action); + return this; } - public EnsembleDescriptor FeatureNames(ICollection? featureNames) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor ClassificationLabels(System.Collections.Generic.ICollection? value) { - FeatureNamesValue = featureNames; - return Self; + Instance.ClassificationLabels = value; + return this; } - public EnsembleDescriptor TargetType(string? targetType) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor ClassificationLabels(params string[] values) { - TargetTypeValue = targetType; - return Self; + Instance.ClassificationLabels = [.. values]; + return this; } - public EnsembleDescriptor TrainedModels(ICollection trainedModels) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor FeatureNames(System.Collections.Generic.ICollection? value) { - TrainedModelsDescriptor = null; - TrainedModelsDescriptorAction = null; - TrainedModelsDescriptorActions = null; - TrainedModelsValue = trainedModels; - return Self; + Instance.FeatureNames = value; + return this; } - public EnsembleDescriptor TrainedModels(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor FeatureNames(params string[] values) { - TrainedModelsValue = null; - TrainedModelsDescriptorAction = null; - TrainedModelsDescriptorActions = null; - TrainedModelsDescriptor = descriptor; - return Self; + Instance.FeatureNames = [.. values]; + return this; } - public EnsembleDescriptor TrainedModels(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor TargetType(string? value) { - TrainedModelsValue = null; - TrainedModelsDescriptor = null; - TrainedModelsDescriptorActions = null; - TrainedModelsDescriptorAction = configure; - return Self; + Instance.TargetType = value; + return this; } - public EnsembleDescriptor TrainedModels(params Action[] configure) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor TrainedModels(System.Collections.Generic.ICollection value) { - TrainedModelsValue = null; - TrainedModelsDescriptor = null; - TrainedModelsDescriptorAction = null; - TrainedModelsDescriptorActions = configure; - return Self; + Instance.TrainedModels = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor TrainedModels(params Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel[] values) { - writer.WriteStartObject(); - if (AggregateOutputDescriptor is not null) - { - writer.WritePropertyName("aggregate_output"); - JsonSerializer.Serialize(writer, AggregateOutputDescriptor, options); - } - else if (AggregateOutputDescriptorAction is not null) - { - writer.WritePropertyName("aggregate_output"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.AggregateOutputDescriptor(AggregateOutputDescriptorAction), options); - } - else if (AggregateOutputValue is not null) - { - writer.WritePropertyName("aggregate_output"); - JsonSerializer.Serialize(writer, AggregateOutputValue, options); - } - - if (ClassificationLabelsValue is not null) - { - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - } - - if (FeatureNamesValue is not null) - { - writer.WritePropertyName("feature_names"); - JsonSerializer.Serialize(writer, FeatureNamesValue, options); - } - - if (!string.IsNullOrEmpty(TargetTypeValue)) - { - writer.WritePropertyName("target_type"); - writer.WriteStringValue(TargetTypeValue); - } + Instance.TrainedModels = [.. values]; + return this; + } - if (TrainedModelsDescriptor is not null) - { - writer.WritePropertyName("trained_models"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, TrainedModelsDescriptor, options); - writer.WriteEndArray(); - } - else if (TrainedModelsDescriptorAction is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor TrainedModels(params System.Action?[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("trained_models"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(TrainedModelsDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor.Build(action)); } - else if (TrainedModelsDescriptorActions is not null) - { - writer.WritePropertyName("trained_models"); - writer.WriteStartArray(); - foreach (var action in TrainedModelsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("trained_models"); - JsonSerializer.Serialize(writer, TrainedModelsValue, options); - } + Instance.TrainedModels = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Ensemble Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Ensemble(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ExponentialAverageCalculationContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ExponentialAverageCalculationContext.g.cs index d9d92226dab..f9a306941b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ExponentialAverageCalculationContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ExponentialAverageCalculationContext.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ExponentialAverageCalculationContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIncrementalMetricValueMs = System.Text.Json.JsonEncodedText.Encode("incremental_metric_value_ms"); + private static readonly System.Text.Json.JsonEncodedText PropLatestTimestamp = System.Text.Json.JsonEncodedText.Encode("latest_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropPreviousExponentialAverageMs = System.Text.Json.JsonEncodedText.Encode("previous_exponential_average_ms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContext Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIncrementalMetricValueMs = default; + LocalJsonValue propLatestTimestamp = default; + LocalJsonValue propPreviousExponentialAverageMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIncrementalMetricValueMs.TryReadProperty(ref reader, options, PropIncrementalMetricValueMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propLatestTimestamp.TryReadProperty(ref reader, options, PropLatestTimestamp, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propPreviousExponentialAverageMs.TryReadProperty(ref reader, options, PropPreviousExponentialAverageMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IncrementalMetricValueMs = propIncrementalMetricValueMs.Value, + LatestTimestamp = propLatestTimestamp.Value, + PreviousExponentialAverageMs = propPreviousExponentialAverageMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContext value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIncrementalMetricValueMs, value.IncrementalMetricValueMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropLatestTimestamp, value.LatestTimestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropPreviousExponentialAverageMs, value.PreviousExponentialAverageMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ExponentialAverageCalculationContextConverter))] public sealed partial class ExponentialAverageCalculationContext { - [JsonInclude, JsonPropertyName("incremental_metric_value_ms")] - public double IncrementalMetricValueMs { get; init; } - [JsonInclude, JsonPropertyName("latest_timestamp")] - public long? LatestTimestamp { get; init; } - [JsonInclude, JsonPropertyName("previous_exponential_average_ms")] - public double? PreviousExponentialAverageMs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExponentialAverageCalculationContext(System.TimeSpan incrementalMetricValueMs) + { + IncrementalMetricValueMs = incrementalMetricValueMs; + } +#if NET7_0_OR_GREATER + public ExponentialAverageCalculationContext() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExponentialAverageCalculationContext() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExponentialAverageCalculationContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan IncrementalMetricValueMs { get; set; } + public System.DateTimeOffset? LatestTimestamp { get; set; } + public System.TimeSpan? PreviousExponentialAverageMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceOptions.g.cs index 690cc69cb4c..edb30011fca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceOptions.g.cs @@ -17,23 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class FillMaskInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaskToken = System.Text.Json.JsonEncodedText.Encode("mask_token"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaskToken = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaskToken.TryReadProperty(ref reader, options, PropMaskToken, null)) + { + continue; + } + + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaskToken = propMaskToken.Value, + NumTopClasses = propNumTopClasses.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaskToken, value.MaskToken, null, null); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Fill mask inference options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsConverter))] public sealed partial class FillMaskInferenceOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + { + Vocabulary = vocabulary; + } +#if NET7_0_OR_GREATER + public FillMaskInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FillMaskInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The string/token which will be removed from incoming documents and replaced with the inference prediction(s). @@ -43,7 +137,6 @@ public sealed partial class FillMaskInferenceOptions /// otherwise the request will fail. /// /// - [JsonInclude, JsonPropertyName("mask_token")] public string? MaskToken { get; set; } /// @@ -51,7 +144,6 @@ public sealed partial class FillMaskInferenceOptions /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -59,7 +151,6 @@ public sealed partial class FillMaskInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -67,12 +158,12 @@ public sealed partial class FillMaskInferenceOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - [JsonInclude, JsonPropertyName("vocabulary")] - public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(FillMaskInferenceOptions fillMaskInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.FillMask(fillMaskInferenceOptions); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } } /// @@ -80,23 +171,24 @@ public sealed partial class FillMaskInferenceOptions /// Fill mask inference options /// /// -public sealed partial class FillMaskInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct FillMaskInferenceOptionsDescriptor { - internal FillMaskInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FillMaskInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions instance) + { + Instance = instance; + } - public FillMaskInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FillMaskInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? MaskTokenValue { get; set; } - private int? NumTopClassesValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary VocabularyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor VocabularyDescriptor { get; set; } - private Action VocabularyDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// @@ -107,10 +199,10 @@ public FillMaskInferenceOptionsDescriptor() : base() /// otherwise the request will fail. /// /// - public FillMaskInferenceOptionsDescriptor MaskToken(string? maskToken) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor MaskToken(string? value) { - MaskTokenValue = maskToken; - return Self; + Instance.MaskToken = value; + return this; } /// @@ -118,10 +210,10 @@ public FillMaskInferenceOptionsDescriptor MaskToken(string? maskToken) /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public FillMaskInferenceOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -129,10 +221,10 @@ public FillMaskInferenceOptionsDescriptor NumTopClasses(int? numTopClasses) /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public FillMaskInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -140,107 +232,40 @@ public FillMaskInferenceOptionsDescriptor ResultsField(string? resultsField) /// The tokenization options to update when inferring /// /// - public FillMaskInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public FillMaskInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public FillMaskInferenceOptionsDescriptor Tokenization(Action configure) - { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; - } - - public FillMaskInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor Tokenization(System.Action action) { - VocabularyDescriptor = null; - VocabularyDescriptorAction = null; - VocabularyValue = vocabulary; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public FillMaskInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary value) { - VocabularyValue = null; - VocabularyDescriptorAction = null; - VocabularyDescriptor = descriptor; - return Self; + Instance.Vocabulary = value; + return this; } - public FillMaskInferenceOptionsDescriptor Vocabulary(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor Vocabulary(System.Action action) { - VocabularyValue = null; - VocabularyDescriptor = null; - VocabularyDescriptorAction = configure; - return Self; + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(MaskTokenValue)) - { - writer.WritePropertyName("mask_token"); - writer.WriteStringValue(MaskTokenValue); - } - - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - if (VocabularyDescriptor is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyDescriptor, options); - } - else if (VocabularyDescriptorAction is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(VocabularyDescriptorAction), options); - } - else - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceUpdateOptions.g.cs index d1664f2c7f0..26750344e69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FillMaskInferenceUpdateOptions.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class FillMaskInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumTopClasses = propNumTopClasses.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsConverter))] public sealed partial class FillMaskInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public FillMaskInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public FillMaskInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class FillMaskInferenceUpdateOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -50,35 +118,37 @@ public sealed partial class FillMaskInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(FillMaskInferenceUpdateOptions fillMaskInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.FillMask(fillMaskInferenceUpdateOptions); } -public sealed partial class FillMaskInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct FillMaskInferenceUpdateOptionsDescriptor { - internal FillMaskInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions Instance { get; init; } - public FillMaskInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FillMaskInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions instance) { + Instance = instance; } - private int? NumTopClassesValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FillMaskInferenceUpdateOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public FillMaskInferenceUpdateOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -86,10 +156,10 @@ public FillMaskInferenceUpdateOptionsDescriptor NumTopClasses(int? numTopClasses /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public FillMaskInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -97,61 +167,44 @@ public FillMaskInferenceUpdateOptionsDescriptor ResultsField(string? resultsFiel /// The tokenization options to update when inferring /// /// - public FillMaskInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public FillMaskInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public FillMaskInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Filter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Filter.g.cs index a998d01f78e..2d5356c2422 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Filter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Filter.g.cs @@ -17,39 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class FilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFilterId = System.Text.Json.JsonEncodedText.Encode("filter_id"); + private static readonly System.Text.Json.JsonEncodedText PropItems = System.Text.Json.JsonEncodedText.Encode("items"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Filter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propFilterId = default; + LocalJsonValue> propItems = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFilterId.TryReadProperty(ref reader, options, PropFilterId, null)) + { + continue; + } + + if (propItems.TryReadProperty(ref reader, options, PropItems, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + FilterId = propFilterId.Value, + Items = propItems.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Filter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFilterId, value.FilterId, null, null); + writer.WriteProperty(options, PropItems, value.Items, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FilterConverter))] public sealed partial class Filter { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Filter(string filterId, System.Collections.Generic.IReadOnlyCollection items) + { + FilterId = filterId; + Items = items; + } +#if NET7_0_OR_GREATER + public Filter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Filter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Filter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A description of the filter. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// A string that uniquely identifies a filter. /// /// - [JsonInclude, JsonPropertyName("filter_id")] - public string FilterId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string FilterId { get; set; } /// /// /// An array of strings which is the filter item list. /// /// - [JsonInclude, JsonPropertyName("items")] - public IReadOnlyCollection Items { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Items { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FilterRef.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FilterRef.g.cs index b5dd20cc056..a97cacb7104 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FilterRef.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FilterRef.g.cs @@ -17,55 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class FilterRefConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilterId = System.Text.Json.JsonEncodedText.Encode("filter_id"); + private static readonly System.Text.Json.JsonEncodedText PropFilterType = System.Text.Json.JsonEncodedText.Encode("filter_type"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FilterRef Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilterId = default; + LocalJsonValue propFilterType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilterId.TryReadProperty(ref reader, options, PropFilterId, null)) + { + continue; + } + + if (propFilterType.TryReadProperty(ref reader, options, PropFilterType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FilterRef(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FilterId = propFilterId.Value, + FilterType = propFilterType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FilterRef value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilterId, value.FilterId, null, null); + writer.WriteProperty(options, PropFilterType, value.FilterType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FilterRefConverter))] public sealed partial class FilterRef { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterRef(Elastic.Clients.Elasticsearch.Id filterId) + { + FilterId = filterId; + } +#if NET7_0_OR_GREATER + public FilterRef() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FilterRef() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FilterRef(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The identifier for the filter. /// /// - [JsonInclude, JsonPropertyName("filter_id")] - public Elastic.Clients.Elasticsearch.Id FilterId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id FilterId { get; set; } /// /// /// If set to include, the rule applies for values in the filter. If set to exclude, the rule applies for values not in the filter. /// /// - [JsonInclude, JsonPropertyName("filter_type")] public Elastic.Clients.Elasticsearch.MachineLearning.FilterType? FilterType { get; set; } } -public sealed partial class FilterRefDescriptor : SerializableDescriptor +public readonly partial struct FilterRefDescriptor { - internal FilterRefDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.FilterRef Instance { get; init; } - public FilterRefDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterRefDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FilterRef instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id FilterIdValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.FilterType? FilterTypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FilterRefDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.FilterRef(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FilterRef instance) => new Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.FilterRef(Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor descriptor) => descriptor.Instance; /// /// /// The identifier for the filter. /// /// - public FilterRefDescriptor FilterId(Elastic.Clients.Elasticsearch.Id filterId) + public Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor FilterId(Elastic.Clients.Elasticsearch.Id value) { - FilterIdValue = filterId; - return Self; + Instance.FilterId = value; + return this; } /// @@ -73,23 +150,17 @@ public FilterRefDescriptor FilterId(Elastic.Clients.Elasticsearch.Id filterId) /// If set to include, the rule applies for values in the filter. If set to exclude, the rule applies for values not in the filter. /// /// - public FilterRefDescriptor FilterType(Elastic.Clients.Elasticsearch.MachineLearning.FilterType? filterType) + public Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor FilterType(Elastic.Clients.Elasticsearch.MachineLearning.FilterType? value) { - FilterTypeValue = filterType; - return Self; + Instance.FilterType = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.FilterRef Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("filter_id"); - JsonSerializer.Serialize(writer, FilterIdValue, options); - if (FilterTypeValue is not null) - { - writer.WritePropertyName("filter_type"); - JsonSerializer.Serialize(writer, FilterTypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FilterRefDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.FilterRef(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FrequencyEncodingPreprocessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FrequencyEncodingPreprocessor.g.cs index a5115879616..75dbd6e9f1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FrequencyEncodingPreprocessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/FrequencyEncodingPreprocessor.g.cs @@ -17,67 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class FrequencyEncodingPreprocessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFrequencyMap = System.Text.Json.JsonEncodedText.Encode("frequency_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFeatureName = default; + LocalJsonValue propField = default; + LocalJsonValue> propFrequencyMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFrequencyMap.TryReadProperty(ref reader, options, PropFrequencyMap, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureName = propFeatureName.Value, + Field = propField.Value, + FrequencyMap = propFrequencyMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFrequencyMap, value.FrequencyMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorConverter))] public sealed partial class FrequencyEncodingPreprocessor { - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; set; } - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } - [JsonInclude, JsonPropertyName("frequency_map")] - public IDictionary FrequencyMap { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(FrequencyEncodingPreprocessor frequencyEncodingPreprocessor) => Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor.FrequencyEncoding(frequencyEncodingPreprocessor); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequencyEncodingPreprocessor(string featureName, string field, System.Collections.Generic.IDictionary frequencyMap) + { + FeatureName = featureName; + Field = field; + FrequencyMap = frequencyMap; + } +#if NET7_0_OR_GREATER + public FrequencyEncodingPreprocessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FrequencyEncodingPreprocessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FrequencyEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary FrequencyMap { get; set; } } -public sealed partial class FrequencyEncodingPreprocessorDescriptor : SerializableDescriptor +public readonly partial struct FrequencyEncodingPreprocessorDescriptor { - internal FrequencyEncodingPreprocessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor Instance { get; init; } - public FrequencyEncodingPreprocessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequencyEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor instance) { + Instance = instance; } - private string FeatureNameValue { get; set; } - private string FieldValue { get; set; } - private IDictionary FrequencyMapValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FrequencyEncodingPreprocessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public FrequencyEncodingPreprocessorDescriptor FeatureName(string featureName) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor FeatureName(string value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } - public FrequencyEncodingPreprocessorDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FrequencyEncodingPreprocessorDescriptor FrequencyMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor FrequencyMap(System.Collections.Generic.IDictionary value) { - FrequencyMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FrequencyMap = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor FrequencyMap() { - writer.WriteStartObject(); - writer.WritePropertyName("feature_name"); - writer.WriteStringValue(FeatureNameValue); - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - writer.WritePropertyName("frequency_map"); - JsonSerializer.Serialize(writer, FrequencyMapValue, options); - writer.WriteEndObject(); + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor FrequencyMap(System.Action? action) + { + Instance.FrequencyMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor AddFrequencyMap(string key, double value) + { + Instance.FrequencyMap ??= new System.Collections.Generic.Dictionary(); + Instance.FrequencyMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/GeoResults.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/GeoResults.g.cs index 4839e17a6e9..653e1e38b13 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/GeoResults.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/GeoResults.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class GeoResultsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActualPoint = System.Text.Json.JsonEncodedText.Encode("actual_point"); + private static readonly System.Text.Json.JsonEncodedText PropTypicalPoint = System.Text.Json.JsonEncodedText.Encode("typical_point"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.GeoResults Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActualPoint = default; + LocalJsonValue propTypicalPoint = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActualPoint.TryReadProperty(ref reader, options, PropActualPoint, null)) + { + continue; + } + + if (propTypicalPoint.TryReadProperty(ref reader, options, PropTypicalPoint, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.GeoResults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ActualPoint = propActualPoint.Value, + TypicalPoint = propTypicalPoint.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.GeoResults value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActualPoint, value.ActualPoint, null, null); + writer.WriteProperty(options, PropTypicalPoint, value.TypicalPoint, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.GeoResultsConverter))] public sealed partial class GeoResults { +#if NET7_0_OR_GREATER + public GeoResults() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoResults() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoResults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The actual value for the bucket formatted as a geo_point. /// /// - [JsonInclude, JsonPropertyName("actual_point")] - public string? ActualPoint { get; init; } + public string? ActualPoint { get; set; } /// /// /// The typical value for the bucket formatted as a geo_point. /// /// - [JsonInclude, JsonPropertyName("typical_point")] - public string? TypicalPoint { get; init; } + public string? TypicalPoint { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Hyperparameter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Hyperparameter.g.cs index dbb7f9071db..1a266d5b7d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Hyperparameter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Hyperparameter.g.cs @@ -17,55 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class HyperparameterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAbsoluteImportance = System.Text.Json.JsonEncodedText.Encode("absolute_importance"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRelativeImportance = System.Text.Json.JsonEncodedText.Encode("relative_importance"); + private static readonly System.Text.Json.JsonEncodedText PropSupplied = System.Text.Json.JsonEncodedText.Encode("supplied"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Hyperparameter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAbsoluteImportance = default; + LocalJsonValue propName = default; + LocalJsonValue propRelativeImportance = default; + LocalJsonValue propSupplied = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAbsoluteImportance.TryReadProperty(ref reader, options, PropAbsoluteImportance, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRelativeImportance.TryReadProperty(ref reader, options, PropRelativeImportance, null)) + { + continue; + } + + if (propSupplied.TryReadProperty(ref reader, options, PropSupplied, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Hyperparameter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AbsoluteImportance = propAbsoluteImportance.Value, + Name = propName.Value, + RelativeImportance = propRelativeImportance.Value, + Supplied = propSupplied.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Hyperparameter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAbsoluteImportance, value.AbsoluteImportance, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRelativeImportance, value.RelativeImportance, null, null); + writer.WriteProperty(options, PropSupplied, value.Supplied, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.HyperparameterConverter))] public sealed partial class Hyperparameter { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Hyperparameter(string name, bool supplied, double value) + { + Name = name; + Supplied = supplied; + Value = value; + } +#if NET7_0_OR_GREATER + public Hyperparameter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Hyperparameter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Hyperparameter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A positive number showing how much the parameter influences the variation of the loss function. For hyperparameters with values that are not specified by the user but tuned during hyperparameter optimization. /// /// - [JsonInclude, JsonPropertyName("absolute_importance")] - public double? AbsoluteImportance { get; init; } + public double? AbsoluteImportance { get; set; } /// /// /// Name of the hyperparameter. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// A number between 0 and 1 showing the proportion of influence on the variation of the loss function among all tuned hyperparameters. For hyperparameters with values that are not specified by the user but tuned during hyperparameter optimization. /// /// - [JsonInclude, JsonPropertyName("relative_importance")] - public double? RelativeImportance { get; init; } + public double? RelativeImportance { get; set; } /// /// /// Indicates if the hyperparameter is specified by the user (true) or optimized (false). /// /// - [JsonInclude, JsonPropertyName("supplied")] - public bool Supplied { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Supplied { get; set; } /// /// /// The value of the hyperparameter, either optimized or specified by the user. /// /// - [JsonInclude, JsonPropertyName("value")] - public double Value { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigCreate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigCreate.g.cs index 7521192e9fc..a5ee7c1bd46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigCreate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigCreate.g.cs @@ -17,351 +17,974 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -/// -/// -/// Inference configuration provided when storing the model config -/// -/// -[JsonConverter(typeof(InferenceConfigCreateConverter))] -public sealed partial class InferenceConfigCreate -{ - internal InferenceConfigCreate(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static InferenceConfigCreate Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => new InferenceConfigCreate("classification", classificationInferenceOptions); - public static InferenceConfigCreate FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions fillMaskInferenceOptions) => new InferenceConfigCreate("fill_mask", fillMaskInferenceOptions); - public static InferenceConfigCreate Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions nerInferenceOptions) => new InferenceConfigCreate("ner", nerInferenceOptions); - public static InferenceConfigCreate PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions passThroughInferenceOptions) => new InferenceConfigCreate("pass_through", passThroughInferenceOptions); - public static InferenceConfigCreate QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions questionAnsweringInferenceOptions) => new InferenceConfigCreate("question_answering", questionAnsweringInferenceOptions); - public static InferenceConfigCreate Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => new InferenceConfigCreate("regression", regressionInferenceOptions); - public static InferenceConfigCreate TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions textClassificationInferenceOptions) => new InferenceConfigCreate("text_classification", textClassificationInferenceOptions); - public static InferenceConfigCreate TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions textEmbeddingInferenceOptions) => new InferenceConfigCreate("text_embedding", textEmbeddingInferenceOptions); - public static InferenceConfigCreate TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions textExpansionInferenceOptions) => new InferenceConfigCreate("text_expansion", textExpansionInferenceOptions); - public static InferenceConfigCreate ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions zeroShotClassificationInferenceOptions) => new InferenceConfigCreate("zero_shot_classification", zeroShotClassificationInferenceOptions); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class InferenceConfigCreateConverter : JsonConverter +internal sealed partial class InferenceConfigCreateConverter : System.Text.Json.Serialization.JsonConverter { - public override InferenceConfigCreate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantFillMask = System.Text.Json.JsonEncodedText.Encode("fill_mask"); + private static readonly System.Text.Json.JsonEncodedText VariantLearningToRank = System.Text.Json.JsonEncodedText.Encode("learning_to_rank"); + private static readonly System.Text.Json.JsonEncodedText VariantNer = System.Text.Json.JsonEncodedText.Encode("ner"); + private static readonly System.Text.Json.JsonEncodedText VariantPassThrough = System.Text.Json.JsonEncodedText.Encode("pass_through"); + private static readonly System.Text.Json.JsonEncodedText VariantQuestionAnswering = System.Text.Json.JsonEncodedText.Encode("question_answering"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); + private static readonly System.Text.Json.JsonEncodedText VariantTextClassification = System.Text.Json.JsonEncodedText.Encode("text_classification"); + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + private static readonly System.Text.Json.JsonEncodedText VariantTextExpansion = System.Text.Json.JsonEncodedText.Encode("text_expansion"); + private static readonly System.Text.Json.JsonEncodedText VariantZeroShotClassification = System.Text.Json.JsonEncodedText.Encode("zero_shot_classification"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantFillMask)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantFillMask.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantLearningToRank)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLearningToRank.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fill_mask") + if (reader.ValueTextEquals(VariantNer)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNer.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ner") + if (reader.ValueTextEquals(VariantPassThrough)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPassThrough.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "pass_through") + if (reader.ValueTextEquals(VariantQuestionAnswering)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantQuestionAnswering.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "question_answering") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (reader.ValueTextEquals(VariantTextClassification)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_classification") + if (reader.ValueTextEquals(VariantTextEmbedding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextEmbedding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_embedding") + if (reader.ValueTextEquals(VariantTextExpansion)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextExpansion.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_expansion") + if (reader.ValueTextEquals(VariantZeroShotClassification)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantZeroShotClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "zero_shot_classification") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'InferenceConfigCreate' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new InferenceConfigCreate(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, InferenceConfigCreate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, options); - break; - case "fill_mask": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions)value.Variant, options); - break; - case "ner": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions)value.Variant, options); - break; - case "pass_through": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions)value.Variant, options); - break; - case "question_answering": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, options); - break; - case "text_classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions)value.Variant, options); - break; - case "text_embedding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions)value.Variant, options); - break; - case "text_expansion": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions)value.Variant, options); - break; - case "zero_shot_classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, null, null); + break; + case "fill_mask": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions)value.Variant, null, null); + break; + case "learning_to_rank": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig)value.Variant, null, null); + break; + case "ner": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions)value.Variant, null, null); + break; + case "pass_through": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions)value.Variant, null, null); + break; + case "question_answering": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, null, null); + break; + case "text_classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions)value.Variant, null, null); + break; + case "text_embedding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions)value.Variant, null, null); + break; + case "text_expansion": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions)value.Variant, null, null); + break; + case "zero_shot_classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate)}'."); } writer.WriteEndObject(); } } -public sealed partial class InferenceConfigCreateDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateConverter))] +public sealed partial class InferenceConfigCreate { - internal InferenceConfigCreateDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public InferenceConfigCreate() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfigCreate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public InferenceConfigCreateDescriptor() : base() + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions? FillMask { get => GetVariant("fill_mask"); set => SetVariant("fill_mask", value); } + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig? LearningToRank { get => GetVariant("learning_to_rank"); set => SetVariant("learning_to_rank", value); } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions? Ner { get => GetVariant("ner"); set => SetVariant("ner", value); } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions? PassThrough { get => GetVariant("pass_through"); set => SetVariant("pass_through", value); } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions? QuestionAnswering { get => GetVariant("question_answering"); set => SetVariant("question_answering", value); } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions? TextClassification { get => GetVariant("text_classification"); set => SetVariant("text_classification", value); } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions? TextEmbedding { get => GetVariant("text_embedding"); set => SetVariant("text_embedding", value); } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions? TextExpansion { get => GetVariant("text_expansion"); set => SetVariant("text_expansion", value); } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions? ZeroShotClassification { get => GetVariant("zero_shot_classification"); set => SetVariant("zero_shot_classification", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { FillMask = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { LearningToRank = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { Ner = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { PassThrough = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { QuestionAnswering = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { Regression = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { TextClassification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { TextEmbedding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { TextExpansion = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate { ZeroShotClassification = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} - private InferenceConfigCreateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +public readonly partial struct InferenceConfigCreateDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigCreateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private InferenceConfigCreateDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigCreateDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public InferenceConfigCreateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigCreateDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigCreateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions fillMaskInferenceOptions) => Set(fillMaskInferenceOptions, "fill_mask"); - public InferenceConfigCreateDescriptor FillMask(Action configure) => Set(configure, "fill_mask"); - public InferenceConfigCreateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions nerInferenceOptions) => Set(nerInferenceOptions, "ner"); - public InferenceConfigCreateDescriptor Ner(Action configure) => Set(configure, "ner"); - public InferenceConfigCreateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions passThroughInferenceOptions) => Set(passThroughInferenceOptions, "pass_through"); - public InferenceConfigCreateDescriptor PassThrough(Action configure) => Set(configure, "pass_through"); - public InferenceConfigCreateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions questionAnsweringInferenceOptions) => Set(questionAnsweringInferenceOptions, "question_answering"); - public InferenceConfigCreateDescriptor QuestionAnswering(Action configure) => Set(configure, "question_answering"); - public InferenceConfigCreateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigCreateDescriptor Regression(Action> configure) => Set(configure, "regression"); - public InferenceConfigCreateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions textClassificationInferenceOptions) => Set(textClassificationInferenceOptions, "text_classification"); - public InferenceConfigCreateDescriptor TextClassification(Action configure) => Set(configure, "text_classification"); - public InferenceConfigCreateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions textEmbeddingInferenceOptions) => Set(textEmbeddingInferenceOptions, "text_embedding"); - public InferenceConfigCreateDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); - public InferenceConfigCreateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions textExpansionInferenceOptions) => Set(textExpansionInferenceOptions, "text_expansion"); - public InferenceConfigCreateDescriptor TextExpansion(Action configure) => Set(configure, "text_expansion"); - public InferenceConfigCreateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions zeroShotClassificationInferenceOptions) => Set(zeroShotClassificationInferenceOptions, "zero_shot_classification"); - public InferenceConfigCreateDescriptor ZeroShotClassification(Action configure) => Set(configure, "zero_shot_classification"); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification() + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions? value) + { + Instance.FillMask = value; + return this; + } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor FillMask(System.Action action) + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor LearningToRank(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig? value) + { + Instance.LearningToRank = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor LearningToRank(System.Action> action) + { + Instance.LearningToRank = Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor.Build(action); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions? value) + { + Instance.Ner = value; + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner() + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner(System.Action? action) + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions? value) + { + Instance.PassThrough = value; + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough() + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough(System.Action? action) + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions? value) + { + Instance.QuestionAnswering = value; + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering() + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering(System.Action? action) + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions? value) + { + Instance.TextClassification = value; + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification() + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification(System.Action? action) + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions? value) + { + Instance.TextEmbedding = value; + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextEmbedding(System.Action action) + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions? value) + { + Instance.TextExpansion = value; + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextExpansion(System.Action action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions? value) + { + Instance.ZeroShotClassification = value; + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor ZeroShotClassification(System.Action action) + { + Instance.ZeroShotClassification = Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigCreateDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigCreateDescriptor { - internal InferenceConfigCreateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigCreateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate instance) + { + Instance = instance; + } - public InferenceConfigCreateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigCreateDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor descriptor) => descriptor.Instance; - private InferenceConfigCreateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = value; + return this; } - private InferenceConfigCreateDescriptor Set(object variant, string variantName) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; } - public InferenceConfigCreateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigCreateDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigCreateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions fillMaskInferenceOptions) => Set(fillMaskInferenceOptions, "fill_mask"); - public InferenceConfigCreateDescriptor FillMask(Action configure) => Set(configure, "fill_mask"); - public InferenceConfigCreateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions nerInferenceOptions) => Set(nerInferenceOptions, "ner"); - public InferenceConfigCreateDescriptor Ner(Action configure) => Set(configure, "ner"); - public InferenceConfigCreateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions passThroughInferenceOptions) => Set(passThroughInferenceOptions, "pass_through"); - public InferenceConfigCreateDescriptor PassThrough(Action configure) => Set(configure, "pass_through"); - public InferenceConfigCreateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions questionAnsweringInferenceOptions) => Set(questionAnsweringInferenceOptions, "question_answering"); - public InferenceConfigCreateDescriptor QuestionAnswering(Action configure) => Set(configure, "question_answering"); - public InferenceConfigCreateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigCreateDescriptor Regression(Action configure) => Set(configure, "regression"); - public InferenceConfigCreateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions textClassificationInferenceOptions) => Set(textClassificationInferenceOptions, "text_classification"); - public InferenceConfigCreateDescriptor TextClassification(Action configure) => Set(configure, "text_classification"); - public InferenceConfigCreateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions textEmbeddingInferenceOptions) => Set(textEmbeddingInferenceOptions, "text_embedding"); - public InferenceConfigCreateDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); - public InferenceConfigCreateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions textExpansionInferenceOptions) => Set(textExpansionInferenceOptions, "text_expansion"); - public InferenceConfigCreateDescriptor TextExpansion(Action configure) => Set(configure, "text_expansion"); - public InferenceConfigCreateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions zeroShotClassificationInferenceOptions) => Set(zeroShotClassificationInferenceOptions, "zero_shot_classification"); - public InferenceConfigCreateDescriptor ZeroShotClassification(Action configure) => Set(configure, "zero_shot_classification"); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.FillMask = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor FillMask(System.Action action) + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceOptionsDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor LearningToRank(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig? value) + { + Instance.LearningToRank = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor LearningToRank(System.Action action) + { + Instance.LearningToRank = Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor LearningToRank(System.Action> action) + { + Instance.LearningToRank = Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor.Build(action); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions? value) + { + Instance.Ner = value; + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner() + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Ner(System.Action? action) + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions? value) + { + Instance.PassThrough = value; + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough() + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor PassThrough(System.Action? action) + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions? value) + { + Instance.QuestionAnswering = value; + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering() + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Question answering configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor QuestionAnswering(System.Action? action) + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression(System.Action? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions? value) + { + Instance.TextClassification = value; + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification() + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextClassification(System.Action? action) + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions? value) + { + Instance.TextEmbedding = value; + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextEmbedding(System.Action action) + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions? value) + { + Instance.TextExpansion = value; + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor TextExpansion(System.Action action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions? value) + { + Instance.ZeroShotClassification = value; + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor ZeroShotClassification(System.Action action) + { + Instance.ZeroShotClassification = Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigUpdate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigUpdate.g.cs index fea26716443..5540d0cfc3c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigUpdate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceConfigUpdate.g.cs @@ -17,346 +17,974 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(InferenceConfigUpdateConverter))] -public sealed partial class InferenceConfigUpdate -{ - internal InferenceConfigUpdate(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static InferenceConfigUpdate Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => new InferenceConfigUpdate("classification", classificationInferenceOptions); - public static InferenceConfigUpdate FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions fillMaskInferenceUpdateOptions) => new InferenceConfigUpdate("fill_mask", fillMaskInferenceUpdateOptions); - public static InferenceConfigUpdate Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions nerInferenceUpdateOptions) => new InferenceConfigUpdate("ner", nerInferenceUpdateOptions); - public static InferenceConfigUpdate PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions passThroughInferenceUpdateOptions) => new InferenceConfigUpdate("pass_through", passThroughInferenceUpdateOptions); - public static InferenceConfigUpdate QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions questionAnsweringInferenceUpdateOptions) => new InferenceConfigUpdate("question_answering", questionAnsweringInferenceUpdateOptions); - public static InferenceConfigUpdate Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => new InferenceConfigUpdate("regression", regressionInferenceOptions); - public static InferenceConfigUpdate TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions textClassificationInferenceUpdateOptions) => new InferenceConfigUpdate("text_classification", textClassificationInferenceUpdateOptions); - public static InferenceConfigUpdate TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions textEmbeddingInferenceUpdateOptions) => new InferenceConfigUpdate("text_embedding", textEmbeddingInferenceUpdateOptions); - public static InferenceConfigUpdate TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions textExpansionInferenceUpdateOptions) => new InferenceConfigUpdate("text_expansion", textExpansionInferenceUpdateOptions); - public static InferenceConfigUpdate ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions zeroShotClassificationInferenceUpdateOptions) => new InferenceConfigUpdate("zero_shot_classification", zeroShotClassificationInferenceUpdateOptions); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class InferenceConfigUpdateConverter : JsonConverter +internal sealed partial class InferenceConfigUpdateConverter : System.Text.Json.Serialization.JsonConverter { - public override InferenceConfigUpdate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText VariantClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText VariantFillMask = System.Text.Json.JsonEncodedText.Encode("fill_mask"); + private static readonly System.Text.Json.JsonEncodedText VariantNer = System.Text.Json.JsonEncodedText.Encode("ner"); + private static readonly System.Text.Json.JsonEncodedText VariantPassThrough = System.Text.Json.JsonEncodedText.Encode("pass_through"); + private static readonly System.Text.Json.JsonEncodedText VariantQuestionAnswering = System.Text.Json.JsonEncodedText.Encode("question_answering"); + private static readonly System.Text.Json.JsonEncodedText VariantRegression = System.Text.Json.JsonEncodedText.Encode("regression"); + private static readonly System.Text.Json.JsonEncodedText VariantTextClassification = System.Text.Json.JsonEncodedText.Encode("text_classification"); + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + private static readonly System.Text.Json.JsonEncodedText VariantTextExpansion = System.Text.Json.JsonEncodedText.Encode("text_expansion"); + private static readonly System.Text.Json.JsonEncodedText VariantZeroShotClassification = System.Text.Json.JsonEncodedText.Encode("zero_shot_classification"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantClassification)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "classification") + if (reader.ValueTextEquals(VariantFillMask)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFillMask.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fill_mask") + if (reader.ValueTextEquals(VariantNer)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNer.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ner") + if (reader.ValueTextEquals(VariantPassThrough)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPassThrough.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "pass_through") + if (reader.ValueTextEquals(VariantQuestionAnswering)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantQuestionAnswering.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "question_answering") + if (reader.ValueTextEquals(VariantRegression)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegression.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regression") + if (reader.ValueTextEquals(VariantTextClassification)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_classification") + if (reader.ValueTextEquals(VariantTextEmbedding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextEmbedding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_embedding") + if (reader.ValueTextEquals(VariantTextExpansion)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextExpansion.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_expansion") + if (reader.ValueTextEquals(VariantZeroShotClassification)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantZeroShotClassification.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "zero_shot_classification") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'InferenceConfigUpdate' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new InferenceConfigUpdate(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, InferenceConfigUpdate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, options); - break; - case "fill_mask": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions)value.Variant, options); - break; - case "ner": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions)value.Variant, options); - break; - case "pass_through": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions)value.Variant, options); - break; - case "question_answering": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions)value.Variant, options); - break; - case "regression": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, options); - break; - case "text_classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions)value.Variant, options); - break; - case "text_embedding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions)value.Variant, options); - break; - case "text_expansion": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions)value.Variant, options); - break; - case "zero_shot_classification": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions)value.Variant, options); - break; - } + case null: + break; + case "classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions)value.Variant, null, null); + break; + case "fill_mask": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions)value.Variant, null, null); + break; + case "ner": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions)value.Variant, null, null); + break; + case "pass_through": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions)value.Variant, null, null); + break; + case "question_answering": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions)value.Variant, null, null); + break; + case "regression": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions)value.Variant, null, null); + break; + case "text_classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions)value.Variant, null, null); + break; + case "text_embedding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions)value.Variant, null, null); + break; + case "text_expansion": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions)value.Variant, null, null); + break; + case "zero_shot_classification": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate)}'."); } writer.WriteEndObject(); } } -public sealed partial class InferenceConfigUpdateDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateConverter))] +public sealed partial class InferenceConfigUpdate { - internal InferenceConfigUpdateDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public InferenceConfigUpdate() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceConfigUpdate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public InferenceConfigUpdateDescriptor() : base() + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? Classification { get => GetVariant("classification"); set => SetVariant("classification", value); } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions? FillMask { get => GetVariant("fill_mask"); set => SetVariant("fill_mask", value); } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions? Ner { get => GetVariant("ner"); set => SetVariant("ner", value); } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions? PassThrough { get => GetVariant("pass_through"); set => SetVariant("pass_through", value); } + + /// + /// + /// Question answering configuration for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions? QuestionAnswering { get => GetVariant("question_answering"); set => SetVariant("question_answering", value); } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? Regression { get => GetVariant("regression"); set => SetVariant("regression", value); } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions? TextClassification { get => GetVariant("text_classification"); set => SetVariant("text_classification", value); } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions? TextEmbedding { get => GetVariant("text_embedding"); set => SetVariant("text_embedding", value); } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions? TextExpansion { get => GetVariant("text_expansion"); set => SetVariant("text_expansion", value); } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions? ZeroShotClassification { get => GetVariant("zero_shot_classification"); set => SetVariant("zero_shot_classification", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { Classification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { FillMask = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { Ner = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { PassThrough = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { QuestionAnswering = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { Regression = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { TextClassification = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { TextEmbedding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { TextExpansion = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions value) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate { ZeroShotClassification = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} - private InferenceConfigUpdateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +public readonly partial struct InferenceConfigUpdateDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private InferenceConfigUpdateDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigUpdateDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public InferenceConfigUpdateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigUpdateDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigUpdateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions fillMaskInferenceUpdateOptions) => Set(fillMaskInferenceUpdateOptions, "fill_mask"); - public InferenceConfigUpdateDescriptor FillMask(Action configure) => Set(configure, "fill_mask"); - public InferenceConfigUpdateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions nerInferenceUpdateOptions) => Set(nerInferenceUpdateOptions, "ner"); - public InferenceConfigUpdateDescriptor Ner(Action configure) => Set(configure, "ner"); - public InferenceConfigUpdateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions passThroughInferenceUpdateOptions) => Set(passThroughInferenceUpdateOptions, "pass_through"); - public InferenceConfigUpdateDescriptor PassThrough(Action configure) => Set(configure, "pass_through"); - public InferenceConfigUpdateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions questionAnsweringInferenceUpdateOptions) => Set(questionAnsweringInferenceUpdateOptions, "question_answering"); - public InferenceConfigUpdateDescriptor QuestionAnswering(Action configure) => Set(configure, "question_answering"); - public InferenceConfigUpdateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigUpdateDescriptor Regression(Action> configure) => Set(configure, "regression"); - public InferenceConfigUpdateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions textClassificationInferenceUpdateOptions) => Set(textClassificationInferenceUpdateOptions, "text_classification"); - public InferenceConfigUpdateDescriptor TextClassification(Action configure) => Set(configure, "text_classification"); - public InferenceConfigUpdateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions textEmbeddingInferenceUpdateOptions) => Set(textEmbeddingInferenceUpdateOptions, "text_embedding"); - public InferenceConfigUpdateDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); - public InferenceConfigUpdateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions textExpansionInferenceUpdateOptions) => Set(textExpansionInferenceUpdateOptions, "text_expansion"); - public InferenceConfigUpdateDescriptor TextExpansion(Action configure) => Set(configure, "text_expansion"); - public InferenceConfigUpdateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions zeroShotClassificationInferenceUpdateOptions) => Set(zeroShotClassificationInferenceUpdateOptions, "zero_shot_classification"); - public InferenceConfigUpdateDescriptor ZeroShotClassification(Action configure) => Set(configure, "zero_shot_classification"); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Classification = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification() + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions? value) + { + Instance.FillMask = value; + return this; + } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask() + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask(System.Action? action) + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions? value) + { + Instance.Ner = value; + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner() + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner(System.Action? action) + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions? value) + { + Instance.PassThrough = value; + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough() + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough(System.Action? action) + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Question answering configuration for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions? value) + { + Instance.QuestionAnswering = value; + return this; + } + + /// + /// + /// Question answering configuration for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor QuestionAnswering(System.Action action) + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions? value) + { + Instance.TextClassification = value; + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification() + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification(System.Action? action) + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions? value) + { + Instance.TextEmbedding = value; + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding() + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding(System.Action? action) + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions? value) + { + Instance.TextExpansion = value; + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion() + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion(System.Action? action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions? value) + { + Instance.ZeroShotClassification = value; + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor ZeroShotClassification(System.Action action) + { + Instance.ZeroShotClassification = Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class InferenceConfigUpdateDescriptor : SerializableDescriptor +public readonly partial struct InferenceConfigUpdateDescriptor { - internal InferenceConfigUpdateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate instance) + { + Instance = instance; + } - public InferenceConfigUpdateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InferenceConfigUpdateDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor descriptor) => descriptor.Instance; - private InferenceConfigUpdateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Classification = value; + return this; } - private InferenceConfigUpdateDescriptor Set(object variant, string variantName) + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(null); + return this; } - public InferenceConfigUpdateDescriptor Classification(Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptions classificationInferenceOptions) => Set(classificationInferenceOptions, "classification"); - public InferenceConfigUpdateDescriptor Classification(Action configure) => Set(configure, "classification"); - public InferenceConfigUpdateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions fillMaskInferenceUpdateOptions) => Set(fillMaskInferenceUpdateOptions, "fill_mask"); - public InferenceConfigUpdateDescriptor FillMask(Action configure) => Set(configure, "fill_mask"); - public InferenceConfigUpdateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions nerInferenceUpdateOptions) => Set(nerInferenceUpdateOptions, "ner"); - public InferenceConfigUpdateDescriptor Ner(Action configure) => Set(configure, "ner"); - public InferenceConfigUpdateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions passThroughInferenceUpdateOptions) => Set(passThroughInferenceUpdateOptions, "pass_through"); - public InferenceConfigUpdateDescriptor PassThrough(Action configure) => Set(configure, "pass_through"); - public InferenceConfigUpdateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions questionAnsweringInferenceUpdateOptions) => Set(questionAnsweringInferenceUpdateOptions, "question_answering"); - public InferenceConfigUpdateDescriptor QuestionAnswering(Action configure) => Set(configure, "question_answering"); - public InferenceConfigUpdateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions regressionInferenceOptions) => Set(regressionInferenceOptions, "regression"); - public InferenceConfigUpdateDescriptor Regression(Action configure) => Set(configure, "regression"); - public InferenceConfigUpdateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions textClassificationInferenceUpdateOptions) => Set(textClassificationInferenceUpdateOptions, "text_classification"); - public InferenceConfigUpdateDescriptor TextClassification(Action configure) => Set(configure, "text_classification"); - public InferenceConfigUpdateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions textEmbeddingInferenceUpdateOptions) => Set(textEmbeddingInferenceUpdateOptions, "text_embedding"); - public InferenceConfigUpdateDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); - public InferenceConfigUpdateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions textExpansionInferenceUpdateOptions) => Set(textExpansionInferenceUpdateOptions, "text_expansion"); - public InferenceConfigUpdateDescriptor TextExpansion(Action configure) => Set(configure, "text_expansion"); - public InferenceConfigUpdateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions zeroShotClassificationInferenceUpdateOptions) => Set(zeroShotClassificationInferenceUpdateOptions, "zero_shot_classification"); - public InferenceConfigUpdateDescriptor ZeroShotClassification(Action configure) => Set(configure, "zero_shot_classification"); + /// + /// + /// Classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Classification(System.Action? action) + { + Instance.Classification = Elastic.Clients.Elasticsearch.MachineLearning.ClassificationInferenceOptionsDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask(Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptions? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.FillMask = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask() + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Fill mask configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor FillMask(System.Action? action) + { + Instance.FillMask = Elastic.Clients.Elasticsearch.MachineLearning.FillMaskInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions? value) + { + Instance.Ner = value; + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner() + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Named entity recognition configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Ner(System.Action? action) + { + Instance.Ner = Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions? value) + { + Instance.PassThrough = value; + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough() + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Pass through configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor PassThrough(System.Action? action) + { + Instance.PassThrough = Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Question answering configuration for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor QuestionAnswering(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions? value) + { + Instance.QuestionAnswering = value; + return this; + } + + /// + /// + /// Question answering configuration for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor QuestionAnswering(System.Action action) + { + Instance.QuestionAnswering = Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions? value) + { + Instance.Regression = value; + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression() + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression(System.Action? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Regression configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor Regression(System.Action>? action) + { + Instance.Regression = Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions? value) + { + Instance.TextClassification = value; + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification() + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextClassification(System.Action? action) + { + Instance.TextClassification = Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions? value) + { + Instance.TextEmbedding = value; + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding() + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text embedding configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextEmbedding(System.Action? action) + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions? value) + { + Instance.TextExpansion = value; + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion() + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor.Build(null); + return this; + } + + /// + /// + /// Text expansion configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor TextExpansion(System.Action? action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor ZeroShotClassification(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions? value) + { + Instance.ZeroShotClassification = value; + return this; + } + + /// + /// + /// Zeroshot classification configuration for inference. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor ZeroShotClassification(System.Action action) + { + Instance.ZeroShotClassification = Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdateDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceResponseResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceResponseResult.g.cs index afa959c72f1..123fb584671 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceResponseResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/InferenceResponseResult.g.cs @@ -17,33 +17,155 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class InferenceResponseResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEntities = System.Text.Json.JsonEncodedText.Encode("entities"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureImportance = System.Text.Json.JsonEncodedText.Encode("feature_importance"); + private static readonly System.Text.Json.JsonEncodedText PropIsTruncated = System.Text.Json.JsonEncodedText.Encode("is_truncated"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedValue = System.Text.Json.JsonEncodedText.Encode("predicted_value"); + private static readonly System.Text.Json.JsonEncodedText PropPredictedValueSequence = System.Text.Json.JsonEncodedText.Encode("predicted_value_sequence"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionProbability = System.Text.Json.JsonEncodedText.Encode("prediction_probability"); + private static readonly System.Text.Json.JsonEncodedText PropPredictionScore = System.Text.Json.JsonEncodedText.Encode("prediction_score"); + private static readonly System.Text.Json.JsonEncodedText PropTopClasses = System.Text.Json.JsonEncodedText.Encode("top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropWarning = System.Text.Json.JsonEncodedText.Encode("warning"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.InferenceResponseResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propEntities = default; + LocalJsonValue?> propFeatureImportance = default; + LocalJsonValue propIsTruncated = default; + LocalJsonValue>?> propPredictedValue = default; + LocalJsonValue propPredictedValueSequence = default; + LocalJsonValue propPredictionProbability = default; + LocalJsonValue propPredictionScore = default; + LocalJsonValue?> propTopClasses = default; + LocalJsonValue propWarning = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEntities.TryReadProperty(ref reader, options, PropEntities, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureImportance.TryReadProperty(ref reader, options, PropFeatureImportance, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIsTruncated.TryReadProperty(ref reader, options, PropIsTruncated, null)) + { + continue; + } + + if (propPredictedValue.TryReadProperty(ref reader, options, PropPredictedValue, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propPredictedValueSequence.TryReadProperty(ref reader, options, PropPredictedValueSequence, null)) + { + continue; + } + + if (propPredictionProbability.TryReadProperty(ref reader, options, PropPredictionProbability, null)) + { + continue; + } + + if (propPredictionScore.TryReadProperty(ref reader, options, PropPredictionScore, null)) + { + continue; + } + + if (propTopClasses.TryReadProperty(ref reader, options, PropTopClasses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propWarning.TryReadProperty(ref reader, options, PropWarning, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.InferenceResponseResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Entities = propEntities.Value, + FeatureImportance = propFeatureImportance.Value, + IsTruncated = propIsTruncated.Value, + PredictedValue = propPredictedValue.Value, + PredictedValueSequence = propPredictedValueSequence.Value, + PredictionProbability = propPredictionProbability.Value, + PredictionScore = propPredictionScore.Value, + TopClasses = propTopClasses.Value, + Warning = propWarning.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.InferenceResponseResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEntities, value.Entities, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureImportance, value.FeatureImportance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIsTruncated, value.IsTruncated, null, null); + writer.WriteProperty(options, PropPredictedValue, value.PredictedValue, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropPredictedValueSequence, value.PredictedValueSequence, null, null); + writer.WriteProperty(options, PropPredictionProbability, value.PredictionProbability, null, null); + writer.WriteProperty(options, PropPredictionScore, value.PredictionScore, null, null); + writer.WriteProperty(options, PropTopClasses, value.TopClasses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropWarning, value.Warning, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InferenceResponseResultConverter))] public sealed partial class InferenceResponseResult { +#if NET7_0_OR_GREATER + public InferenceResponseResult() + { + } +#endif +#if !NET7_0_OR_GREATER + public InferenceResponseResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InferenceResponseResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the model is trained for named entity recognition (NER) tasks, the response contains the recognized entities. /// /// - [JsonInclude, JsonPropertyName("entities")] - public IReadOnlyCollection? Entities { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Entities { get; set; } /// /// /// The feature importance for the inference results. Relevant only for classification or regression models /// /// - [JsonInclude, JsonPropertyName("feature_importance")] - public IReadOnlyCollection? FeatureImportance { get; init; } + public System.Collections.Generic.IReadOnlyCollection? FeatureImportance { get; set; } /// /// @@ -51,8 +173,7 @@ public sealed partial class InferenceResponseResult /// is present only when it is true. /// /// - [JsonInclude, JsonPropertyName("is_truncated")] - public bool? IsTruncated { get; init; } + public bool? IsTruncated { get; set; } /// /// @@ -65,9 +186,7 @@ public sealed partial class InferenceResponseResult /// For classification models, it may be an integer, double, boolean or string depending on prediction type /// /// - [JsonInclude, JsonPropertyName("predicted_value")] - [SingleOrManyCollectionConverter(typeof(object))] - public IReadOnlyCollection? PredictedValue { get; init; } + public System.Collections.Generic.ICollection>? PredictedValue { get; set; } /// /// @@ -76,24 +195,21 @@ public sealed partial class InferenceResponseResult /// Additionally /// /// - [JsonInclude, JsonPropertyName("predicted_value_sequence")] - public string? PredictedValueSequence { get; init; } + public string? PredictedValueSequence { get; set; } /// /// /// Specifies a probability for the predicted value. /// /// - [JsonInclude, JsonPropertyName("prediction_probability")] - public double? PredictionProbability { get; init; } + public double? PredictionProbability { get; set; } /// /// /// Specifies a confidence score for the predicted value. /// /// - [JsonInclude, JsonPropertyName("prediction_score")] - public double? PredictionScore { get; init; } + public double? PredictionScore { get; set; } /// /// @@ -101,14 +217,12 @@ public sealed partial class InferenceResponseResult /// class entries. /// /// - [JsonInclude, JsonPropertyName("top_classes")] - public IReadOnlyCollection? TopClasses { get; init; } + public System.Collections.Generic.IReadOnlyCollection? TopClasses { get; set; } /// /// /// If the request failed, the response contains the reason for the failure. /// /// - [JsonInclude, JsonPropertyName("warning")] - public string? Warning { get; init; } + public string? Warning { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influence.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influence.g.cs index b9a3b169a2b..ea78fee2a7f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influence.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influence.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class InfluenceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInfluencerFieldName = System.Text.Json.JsonEncodedText.Encode("influencer_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencerFieldValues = System.Text.Json.JsonEncodedText.Encode("influencer_field_values"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Influence Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInfluencerFieldName = default; + LocalJsonValue> propInfluencerFieldValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInfluencerFieldName.TryReadProperty(ref reader, options, PropInfluencerFieldName, null)) + { + continue; + } + + if (propInfluencerFieldValues.TryReadProperty(ref reader, options, PropInfluencerFieldValues, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Influence(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InfluencerFieldName = propInfluencerFieldName.Value, + InfluencerFieldValues = propInfluencerFieldValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Influence value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInfluencerFieldName, value.InfluencerFieldName, null, null); + writer.WriteProperty(options, PropInfluencerFieldValues, value.InfluencerFieldValues, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InfluenceConverter))] public sealed partial class Influence { - [JsonInclude, JsonPropertyName("influencer_field_name")] - public string InfluencerFieldName { get; init; } - [JsonInclude, JsonPropertyName("influencer_field_values")] - public IReadOnlyCollection InfluencerFieldValues { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Influence(string influencerFieldName, System.Collections.Generic.IReadOnlyCollection influencerFieldValues) + { + InfluencerFieldName = influencerFieldName; + InfluencerFieldValues = influencerFieldValues; + } +#if NET7_0_OR_GREATER + public Influence() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Influence() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Influence(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string InfluencerFieldName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection InfluencerFieldValues { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influencer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influencer.g.cs index cb85dcef0e6..6974ec97aaf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influencer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Influencer.g.cs @@ -17,25 +17,185 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class InfluencerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropFoo = System.Text.Json.JsonEncodedText.Encode("foo"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencerFieldName = System.Text.Json.JsonEncodedText.Encode("influencer_field_name"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencerFieldValue = System.Text.Json.JsonEncodedText.Encode("influencer_field_value"); + private static readonly System.Text.Json.JsonEncodedText PropInfluencerScore = System.Text.Json.JsonEncodedText.Encode("influencer_score"); + private static readonly System.Text.Json.JsonEncodedText PropInitialInfluencerScore = System.Text.Json.JsonEncodedText.Encode("initial_influencer_score"); + private static readonly System.Text.Json.JsonEncodedText PropIsInterim = System.Text.Json.JsonEncodedText.Encode("is_interim"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropProbability = System.Text.Json.JsonEncodedText.Encode("probability"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Influencer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketSpan = default; + LocalJsonValue propFoo = default; + LocalJsonValue propInfluencerFieldName = default; + LocalJsonValue propInfluencerFieldValue = default; + LocalJsonValue propInfluencerScore = default; + LocalJsonValue propInitialInfluencerScore = default; + LocalJsonValue propIsInterim = default; + LocalJsonValue propJobId = default; + LocalJsonValue propProbability = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker)))) + { + continue; + } + + if (propFoo.TryReadProperty(ref reader, options, PropFoo, null)) + { + continue; + } + + if (propInfluencerFieldName.TryReadProperty(ref reader, options, PropInfluencerFieldName, null)) + { + continue; + } + + if (propInfluencerFieldValue.TryReadProperty(ref reader, options, PropInfluencerFieldValue, null)) + { + continue; + } + + if (propInfluencerScore.TryReadProperty(ref reader, options, PropInfluencerScore, null)) + { + continue; + } + + if (propInitialInfluencerScore.TryReadProperty(ref reader, options, PropInitialInfluencerScore, null)) + { + continue; + } + + if (propIsInterim.TryReadProperty(ref reader, options, PropIsInterim, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propProbability.TryReadProperty(ref reader, options, PropProbability, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Influencer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketSpan = propBucketSpan.Value, + Foo = propFoo.Value, + InfluencerFieldName = propInfluencerFieldName.Value, + InfluencerFieldValue = propInfluencerFieldValue.Value, + InfluencerScore = propInfluencerScore.Value, + InitialInfluencerScore = propInitialInfluencerScore.Value, + IsInterim = propIsInterim.Value, + JobId = propJobId.Value, + Probability = propProbability.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Influencer value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker))); + writer.WriteProperty(options, PropFoo, value.Foo, null, null); + writer.WriteProperty(options, PropInfluencerFieldName, value.InfluencerFieldName, null, null); + writer.WriteProperty(options, PropInfluencerFieldValue, value.InfluencerFieldValue, null, null); + writer.WriteProperty(options, PropInfluencerScore, value.InfluencerScore, null, null); + writer.WriteProperty(options, PropInitialInfluencerScore, value.InitialInfluencerScore, null, null); + writer.WriteProperty(options, PropIsInterim, value.IsInterim, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropProbability, value.Probability, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InfluencerConverter))] public sealed partial class Influencer { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Influencer(System.TimeSpan bucketSpan, string influencerFieldName, string influencerFieldValue, double influencerScore, double initialInfluencerScore, bool isInterim, string jobId, double probability, string resultType, System.DateTimeOffset timestamp) + { + BucketSpan = bucketSpan; + InfluencerFieldName = influencerFieldName; + InfluencerFieldValue = influencerFieldValue; + InfluencerScore = influencerScore; + InitialInfluencerScore = initialInfluencerScore; + IsInterim = isInterim; + JobId = jobId; + Probability = probability; + ResultType = resultType; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public Influencer() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Influencer() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Influencer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The length of the bucket in seconds. This value matches the bucket span that is specified in the job. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public long BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan BucketSpan { get; set; } /// /// @@ -44,24 +204,29 @@ public sealed partial class Influencer /// information enables you to filter the anomaly results more easily. /// /// - [JsonInclude, JsonPropertyName("foo")] - public string? Foo { get; init; } + public string? Foo { get; set; } /// /// /// The field name of the influencer. /// /// - [JsonInclude, JsonPropertyName("influencer_field_name")] - public string InfluencerFieldName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InfluencerFieldName { get; set; } /// /// /// The entity that influenced, contributed to, or was to blame for the anomaly. /// /// - [JsonInclude, JsonPropertyName("influencer_field_value")] - public string InfluencerFieldValue { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string InfluencerFieldValue { get; set; } /// /// @@ -70,8 +235,11 @@ public sealed partial class Influencer /// data is analyzed. /// /// - [JsonInclude, JsonPropertyName("influencer_score")] - public double InfluencerScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double InfluencerScore { get; set; } /// /// @@ -79,24 +247,33 @@ public sealed partial class Influencer /// This is the initial value that was calculated at the time the bucket was processed. /// /// - [JsonInclude, JsonPropertyName("initial_influencer_score")] - public double InitialInfluencerScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double InitialInfluencerScore { get; set; } /// /// /// If true, this is an interim result. In other words, the results are calculated based on partial input data. /// /// - [JsonInclude, JsonPropertyName("is_interim")] - public bool IsInterim { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsInterim { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// @@ -105,22 +282,31 @@ public sealed partial class Influencer /// interpretation of this value. /// /// - [JsonInclude, JsonPropertyName("probability")] - public double Probability { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double Probability { get; set; } /// /// /// Internal. This value is always set to influencer. /// /// - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Input.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Input.g.cs index db1ccc9437f..4e161a45874 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Input.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Input.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class InputConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldNames = System.Text.Json.JsonEncodedText.Encode("field_names"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Input Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFieldNames = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldNames.TryReadProperty(ref reader, options, PropFieldNames, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Input(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldNames = propFieldNames.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Input value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldNames, value.FieldNames, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.InputConverter))] public sealed partial class Input { - [JsonInclude, JsonPropertyName("field_names")] - public Elastic.Clients.Elasticsearch.Names FieldNames { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Input(Elastic.Clients.Elasticsearch.Names fieldNames) + { + FieldNames = fieldNames; + } +#if NET7_0_OR_GREATER + public Input() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Input() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Input(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names FieldNames { get; set; } } -public sealed partial class InputDescriptor : SerializableDescriptor +public readonly partial struct InputDescriptor { - internal InputDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Input Instance { get; init; } - public InputDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Input instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Names FieldNamesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Input(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public InputDescriptor FieldNames(Elastic.Clients.Elasticsearch.Names fieldNames) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Input instance) => new Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Input(Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor FieldNames(Elastic.Clients.Elasticsearch.Names value) { - FieldNamesValue = fieldNames; - return Self; + Instance.FieldNames = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Input Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field_names"); - JsonSerializer.Serialize(writer, FieldNamesValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.InputDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Input(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Job.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Job.g.cs index 2c4568b96af..f2943c7e2c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Job.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Job.g.cs @@ -17,26 +17,290 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLazyOpen = System.Text.Json.JsonEncodedText.Encode("allow_lazy_open"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisConfig = System.Text.Json.JsonEncodedText.Encode("analysis_config"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisLimits = System.Text.Json.JsonEncodedText.Encode("analysis_limits"); + private static readonly System.Text.Json.JsonEncodedText PropBackgroundPersistInterval = System.Text.Json.JsonEncodedText.Encode("background_persist_interval"); + private static readonly System.Text.Json.JsonEncodedText PropBlocked = System.Text.Json.JsonEncodedText.Encode("blocked"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropCustomSettings = System.Text.Json.JsonEncodedText.Encode("custom_settings"); + private static readonly System.Text.Json.JsonEncodedText PropDailyModelSnapshotRetentionAfterDays = System.Text.Json.JsonEncodedText.Encode("daily_model_snapshot_retention_after_days"); + private static readonly System.Text.Json.JsonEncodedText PropDataDescription = System.Text.Json.JsonEncodedText.Encode("data_description"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeedConfig = System.Text.Json.JsonEncodedText.Encode("datafeed_config"); + private static readonly System.Text.Json.JsonEncodedText PropDeleting = System.Text.Json.JsonEncodedText.Encode("deleting"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropFinishedTime = System.Text.Json.JsonEncodedText.Encode("finished_time"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropJobType = System.Text.Json.JsonEncodedText.Encode("job_type"); + private static readonly System.Text.Json.JsonEncodedText PropJobVersion = System.Text.Json.JsonEncodedText.Encode("job_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelPlotConfig = System.Text.Json.JsonEncodedText.Encode("model_plot_config"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotId = System.Text.Json.JsonEncodedText.Encode("model_snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSnapshotRetentionDays = System.Text.Json.JsonEncodedText.Encode("model_snapshot_retention_days"); + private static readonly System.Text.Json.JsonEncodedText PropRenormalizationWindowDays = System.Text.Json.JsonEncodedText.Encode("renormalization_window_days"); + private static readonly System.Text.Json.JsonEncodedText PropResultsIndexName = System.Text.Json.JsonEncodedText.Encode("results_index_name"); + private static readonly System.Text.Json.JsonEncodedText PropResultsRetentionDays = System.Text.Json.JsonEncodedText.Encode("results_retention_days"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Job Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLazyOpen = default; + LocalJsonValue propAnalysisConfig = default; + LocalJsonValue propAnalysisLimits = default; + LocalJsonValue propBackgroundPersistInterval = default; + LocalJsonValue propBlocked = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propCustomSettings = default; + LocalJsonValue propDailyModelSnapshotRetentionAfterDays = default; + LocalJsonValue propDataDescription = default; + LocalJsonValue propDatafeedConfig = default; + LocalJsonValue propDeleting = default; + LocalJsonValue propDescription = default; + LocalJsonValue propFinishedTime = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propJobId = default; + LocalJsonValue propJobType = default; + LocalJsonValue propJobVersion = default; + LocalJsonValue propModelPlotConfig = default; + LocalJsonValue propModelSnapshotId = default; + LocalJsonValue propModelSnapshotRetentionDays = default; + LocalJsonValue propRenormalizationWindowDays = default; + LocalJsonValue propResultsIndexName = default; + LocalJsonValue propResultsRetentionDays = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLazyOpen.TryReadProperty(ref reader, options, PropAllowLazyOpen, null)) + { + continue; + } + + if (propAnalysisConfig.TryReadProperty(ref reader, options, PropAnalysisConfig, null)) + { + continue; + } + + if (propAnalysisLimits.TryReadProperty(ref reader, options, PropAnalysisLimits, null)) + { + continue; + } + + if (propBackgroundPersistInterval.TryReadProperty(ref reader, options, PropBackgroundPersistInterval, null)) + { + continue; + } + + if (propBlocked.TryReadProperty(ref reader, options, PropBlocked, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propCustomSettings.TryReadProperty(ref reader, options, PropCustomSettings, null)) + { + continue; + } + + if (propDailyModelSnapshotRetentionAfterDays.TryReadProperty(ref reader, options, PropDailyModelSnapshotRetentionAfterDays, null)) + { + continue; + } + + if (propDataDescription.TryReadProperty(ref reader, options, PropDataDescription, null)) + { + continue; + } + + if (propDatafeedConfig.TryReadProperty(ref reader, options, PropDatafeedConfig, null)) + { + continue; + } + + if (propDeleting.TryReadProperty(ref reader, options, PropDeleting, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propFinishedTime.TryReadProperty(ref reader, options, PropFinishedTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propJobType.TryReadProperty(ref reader, options, PropJobType, null)) + { + continue; + } + + if (propJobVersion.TryReadProperty(ref reader, options, PropJobVersion, null)) + { + continue; + } + + if (propModelPlotConfig.TryReadProperty(ref reader, options, PropModelPlotConfig, null)) + { + continue; + } + + if (propModelSnapshotId.TryReadProperty(ref reader, options, PropModelSnapshotId, null)) + { + continue; + } + + if (propModelSnapshotRetentionDays.TryReadProperty(ref reader, options, PropModelSnapshotRetentionDays, null)) + { + continue; + } + + if (propRenormalizationWindowDays.TryReadProperty(ref reader, options, PropRenormalizationWindowDays, null)) + { + continue; + } + + if (propResultsIndexName.TryReadProperty(ref reader, options, PropResultsIndexName, null)) + { + continue; + } + + if (propResultsRetentionDays.TryReadProperty(ref reader, options, PropResultsRetentionDays, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Job(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLazyOpen = propAllowLazyOpen.Value, + AnalysisConfig = propAnalysisConfig.Value, + AnalysisLimits = propAnalysisLimits.Value, + BackgroundPersistInterval = propBackgroundPersistInterval.Value, + Blocked = propBlocked.Value, + CreateTime = propCreateTime.Value, + CustomSettings = propCustomSettings.Value, + DailyModelSnapshotRetentionAfterDays = propDailyModelSnapshotRetentionAfterDays.Value, + DataDescription = propDataDescription.Value, + DatafeedConfig = propDatafeedConfig.Value, + Deleting = propDeleting.Value, + Description = propDescription.Value, + FinishedTime = propFinishedTime.Value, + Groups = propGroups.Value, + JobId = propJobId.Value, + JobType = propJobType.Value, + JobVersion = propJobVersion.Value, + ModelPlotConfig = propModelPlotConfig.Value, + ModelSnapshotId = propModelSnapshotId.Value, + ModelSnapshotRetentionDays = propModelSnapshotRetentionDays.Value, + RenormalizationWindowDays = propRenormalizationWindowDays.Value, + ResultsIndexName = propResultsIndexName.Value, + ResultsRetentionDays = propResultsRetentionDays.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Job value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLazyOpen, value.AllowLazyOpen, null, null); + writer.WriteProperty(options, PropAnalysisConfig, value.AnalysisConfig, null, null); + writer.WriteProperty(options, PropAnalysisLimits, value.AnalysisLimits, null, null); + writer.WriteProperty(options, PropBackgroundPersistInterval, value.BackgroundPersistInterval, null, null); + writer.WriteProperty(options, PropBlocked, value.Blocked, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropCustomSettings, value.CustomSettings, null, null); + writer.WriteProperty(options, PropDailyModelSnapshotRetentionAfterDays, value.DailyModelSnapshotRetentionAfterDays, null, null); + writer.WriteProperty(options, PropDataDescription, value.DataDescription, null, null); + writer.WriteProperty(options, PropDatafeedConfig, value.DatafeedConfig, null, null); + writer.WriteProperty(options, PropDeleting, value.Deleting, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropFinishedTime, value.FinishedTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropJobType, value.JobType, null, null); + writer.WriteProperty(options, PropJobVersion, value.JobVersion, null, null); + writer.WriteProperty(options, PropModelPlotConfig, value.ModelPlotConfig, null, null); + writer.WriteProperty(options, PropModelSnapshotId, value.ModelSnapshotId, null, null); + writer.WriteProperty(options, PropModelSnapshotRetentionDays, value.ModelSnapshotRetentionDays, null, null); + writer.WriteProperty(options, PropRenormalizationWindowDays, value.RenormalizationWindowDays, null, null); + writer.WriteProperty(options, PropResultsIndexName, value.ResultsIndexName, null, null); + writer.WriteProperty(options, PropResultsRetentionDays, value.ResultsRetentionDays, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobConverter))] public sealed partial class Job { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Job(bool allowLazyOpen, Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig analysisConfig, Elastic.Clients.Elasticsearch.MachineLearning.DataDescription dataDescription, string jobId, long modelSnapshotRetentionDays, string resultsIndexName) + { + AllowLazyOpen = allowLazyOpen; + AnalysisConfig = analysisConfig; + DataDescription = dataDescription; + JobId = jobId; + ModelSnapshotRetentionDays = modelSnapshotRetentionDays; + ResultsIndexName = resultsIndexName; + } +#if NET7_0_OR_GREATER + public Job() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Job() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Job(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Advanced configuration option. /// Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. /// /// - [JsonInclude, JsonPropertyName("allow_lazy_open")] - public bool AllowLazyOpen { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowLazyOpen { get; set; } /// /// @@ -44,8 +308,11 @@ public sealed partial class Job /// After you create a job, you cannot change the analysis configuration; all the properties are informational. /// /// - [JsonInclude, JsonPropertyName("analysis_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfig { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AnalysisConfig AnalysisConfig { get; set; } /// /// @@ -54,8 +321,7 @@ public sealed partial class Job /// They do not control the memory used by other processes, for example the Elasticsearch Java processes. /// /// - [JsonInclude, JsonPropertyName("analysis_limits")] - public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimits { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.AnalysisLimits? AnalysisLimits { get; set; } /// /// @@ -65,12 +331,9 @@ public sealed partial class Job /// The smallest allowed value is 1 hour. /// /// - [JsonInclude, JsonPropertyName("background_persist_interval")] - public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; init; } - [JsonInclude, JsonPropertyName("blocked")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobBlocked? Blocked { get; init; } - [JsonInclude, JsonPropertyName("create_time")] - public DateTimeOffset? CreateTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? BackgroundPersistInterval { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobBlocked? Blocked { get; set; } + public System.DateTimeOffset? CreateTime { get; set; } /// /// @@ -78,8 +341,7 @@ public sealed partial class Job /// Contains custom metadata about the job. /// /// - [JsonInclude, JsonPropertyName("custom_settings")] - public object? CustomSettings { get; init; } + public object? CustomSettings { get; set; } /// /// @@ -89,8 +351,7 @@ public sealed partial class Job /// Valid values range from 0 to model_snapshot_retention_days. /// /// - [JsonInclude, JsonPropertyName("daily_model_snapshot_retention_after_days")] - public long? DailyModelSnapshotRetentionAfterDays { get; init; } + public long? DailyModelSnapshotRetentionAfterDays { get; set; } /// /// @@ -100,8 +361,11 @@ public sealed partial class Job /// Only the results for anomaly detection are retained. /// /// - [JsonInclude, JsonPropertyName("data_description")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataDescription DataDescription { get; set; } /// /// @@ -109,8 +373,7 @@ public sealed partial class Job /// You can associate only one datafeed with each anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("datafeed_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.Datafeed? DatafeedConfig { get; set; } /// /// @@ -118,16 +381,14 @@ public sealed partial class Job /// It is only reported when true. /// /// - [JsonInclude, JsonPropertyName("deleting")] - public bool? Deleting { get; init; } + public bool? Deleting { get; set; } /// /// /// A description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// @@ -135,8 +396,7 @@ public sealed partial class Job /// This property is informational; you cannot change its value. /// /// - [JsonInclude, JsonPropertyName("finished_time")] - public DateTimeOffset? FinishedTime { get; init; } + public System.DateTimeOffset? FinishedTime { get; set; } /// /// @@ -144,8 +404,7 @@ public sealed partial class Job /// A job can belong to no groups or many. /// /// - [JsonInclude, JsonPropertyName("groups")] - public IReadOnlyCollection? Groups { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Groups { get; set; } /// /// @@ -154,24 +413,25 @@ public sealed partial class Job /// It must start and end with alphanumeric characters. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// Reserved for future use, currently set to anomaly_detector. /// /// - [JsonInclude, JsonPropertyName("job_type")] - public string? JobType { get; init; } + public string? JobType { get; set; } /// /// /// The machine learning configuration version number at which the the job was created. /// /// - [JsonInclude, JsonPropertyName("job_version")] - public string? JobVersion { get; init; } + public string? JobVersion { get; set; } /// /// @@ -180,10 +440,8 @@ public sealed partial class Job /// Model plot provides a simplified and indicative view of the model and its bounds. /// /// - [JsonInclude, JsonPropertyName("model_plot_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; init; } - [JsonInclude, JsonPropertyName("model_snapshot_id")] - public string? ModelSnapshotId { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig? ModelPlotConfig { get; set; } + public string? ModelSnapshotId { get; set; } /// /// @@ -193,8 +451,11 @@ public sealed partial class Job /// By default, snapshots ten days older than the newest snapshot are deleted. /// /// - [JsonInclude, JsonPropertyName("model_snapshot_retention_days")] - public long ModelSnapshotRetentionDays { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ModelSnapshotRetentionDays { get; set; } /// /// @@ -203,8 +464,7 @@ public sealed partial class Job /// The default value is the longer of 30 days or 100 bucket_spans. /// /// - [JsonInclude, JsonPropertyName("renormalization_window_days")] - public long? RenormalizationWindowDays { get; init; } + public long? RenormalizationWindowDays { get; set; } /// /// @@ -212,8 +472,11 @@ public sealed partial class Job /// The default value is shared, which generates an index named .ml-anomalies-shared. /// /// - [JsonInclude, JsonPropertyName("results_index_name")] - public string ResultsIndexName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultsIndexName { get; set; } /// /// @@ -226,6 +489,5 @@ public sealed partial class Job /// Annotations added by users are retained forever. /// /// - [JsonInclude, JsonPropertyName("results_retention_days")] - public long? ResultsRetentionDays { get; init; } + public long? ResultsRetentionDays { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobBlocked.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobBlocked.g.cs index 612647b2eca..abbd0d6fa4c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobBlocked.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobBlocked.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobBlockedConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropTaskId = System.Text.Json.JsonEncodedText.Encode("task_id"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobBlocked Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReason = default; + LocalJsonValue propTaskId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propTaskId.TryReadProperty(ref reader, options, PropTaskId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JobBlocked(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Reason = propReason.Value, + TaskId = propTaskId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobBlocked value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropTaskId, value.TaskId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedConverter))] public sealed partial class JobBlocked { - [JsonInclude, JsonPropertyName("reason")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason Reason { get; init; } - [JsonInclude, JsonPropertyName("task_id")] - public Elastic.Clients.Elasticsearch.TaskId? TaskId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobBlocked(Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason reason) + { + Reason = reason; + } +#if NET7_0_OR_GREATER + public JobBlocked() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobBlocked() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobBlocked(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobBlockedReason Reason { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? TaskId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobForecastStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobForecastStatistics.g.cs index 151d5765fae..7c5a573bd17 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobForecastStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobForecastStatistics.g.cs @@ -17,28 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobForecastStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForecastedJobs = System.Text.Json.JsonEncodedText.Encode("forecasted_jobs"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryBytes = System.Text.Json.JsonEncodedText.Encode("memory_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropRecords = System.Text.Json.JsonEncodedText.Encode("records"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForecastedJobs = default; + LocalJsonValue propMemoryBytes = default; + LocalJsonValue propProcessingTimeMs = default; + LocalJsonValue propRecords = default; + LocalJsonValue?> propStatus = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForecastedJobs.TryReadProperty(ref reader, options, PropForecastedJobs, null)) + { + continue; + } + + if (propMemoryBytes.TryReadProperty(ref reader, options, PropMemoryBytes, null)) + { + continue; + } + + if (propProcessingTimeMs.TryReadProperty(ref reader, options, PropProcessingTimeMs, null)) + { + continue; + } + + if (propRecords.TryReadProperty(ref reader, options, PropRecords, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForecastedJobs = propForecastedJobs.Value, + MemoryBytes = propMemoryBytes.Value, + ProcessingTimeMs = propProcessingTimeMs.Value, + Records = propRecords.Value, + Status = propStatus.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForecastedJobs, value.ForecastedJobs, null, null); + writer.WriteProperty(options, PropMemoryBytes, value.MemoryBytes, null, null); + writer.WriteProperty(options, PropProcessingTimeMs, value.ProcessingTimeMs, null, null); + writer.WriteProperty(options, PropRecords, value.Records, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatisticsConverter))] public sealed partial class JobForecastStatistics { - [JsonInclude, JsonPropertyName("forecasted_jobs")] - public int ForecastedJobs { get; init; } - [JsonInclude, JsonPropertyName("memory_bytes")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? MemoryBytes { get; init; } - [JsonInclude, JsonPropertyName("processing_time_ms")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? ProcessingTimeMs { get; init; } - [JsonInclude, JsonPropertyName("records")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? Records { get; init; } - [JsonInclude, JsonPropertyName("status")] - public IReadOnlyDictionary? Status { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobForecastStatistics(int forecastedJobs, long total) + { + ForecastedJobs = forecastedJobs; + Total = total; + } +#if NET7_0_OR_GREATER + public JobForecastStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobForecastStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobForecastStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int ForecastedJobs { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? MemoryBytes { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? ProcessingTimeMs { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? Records { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStatistics.g.cs index f4f896549d3..7fb1c45513a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStatistics.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value, + Max = propMax.Value, + Min = propMin.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobStatisticsConverter))] public sealed partial class JobStatistics { - [JsonInclude, JsonPropertyName("avg")] - public double Avg { get; init; } - [JsonInclude, JsonPropertyName("max")] - public double Max { get; init; } - [JsonInclude, JsonPropertyName("min")] - public double Min { get; init; } - [JsonInclude, JsonPropertyName("total")] - public double Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobStatistics(double avg, double max, double min, double total) + { + Avg = avg; + Max = max; + Min = min; + Total = total; + } +#if NET7_0_OR_GREATER + public JobStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Avg { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Max { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Min { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStats.g.cs index 5f5315c52db..92ba4fda1dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobStats.g.cs @@ -17,25 +17,168 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAssignmentExplanation = System.Text.Json.JsonEncodedText.Encode("assignment_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropDataCounts = System.Text.Json.JsonEncodedText.Encode("data_counts"); + private static readonly System.Text.Json.JsonEncodedText PropDeleting = System.Text.Json.JsonEncodedText.Encode("deleting"); + private static readonly System.Text.Json.JsonEncodedText PropForecastsStats = System.Text.Json.JsonEncodedText.Encode("forecasts_stats"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeStats = System.Text.Json.JsonEncodedText.Encode("model_size_stats"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropOpenTime = System.Text.Json.JsonEncodedText.Encode("open_time"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropTimingStats = System.Text.Json.JsonEncodedText.Encode("timing_stats"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignmentExplanation = default; + LocalJsonValue propDataCounts = default; + LocalJsonValue propDeleting = default; + LocalJsonValue propForecastsStats = default; + LocalJsonValue propJobId = default; + LocalJsonValue propModelSizeStats = default; + LocalJsonValue propNode = default; + LocalJsonValue propOpenTime = default; + LocalJsonValue propState = default; + LocalJsonValue propTimingStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignmentExplanation.TryReadProperty(ref reader, options, PropAssignmentExplanation, null)) + { + continue; + } + + if (propDataCounts.TryReadProperty(ref reader, options, PropDataCounts, null)) + { + continue; + } + + if (propDeleting.TryReadProperty(ref reader, options, PropDeleting, null)) + { + continue; + } + + if (propForecastsStats.TryReadProperty(ref reader, options, PropForecastsStats, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propModelSizeStats.TryReadProperty(ref reader, options, PropModelSizeStats, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propOpenTime.TryReadProperty(ref reader, options, PropOpenTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propTimingStats.TryReadProperty(ref reader, options, PropTimingStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JobStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AssignmentExplanation = propAssignmentExplanation.Value, + DataCounts = propDataCounts.Value, + Deleting = propDeleting.Value, + ForecastsStats = propForecastsStats.Value, + JobId = propJobId.Value, + ModelSizeStats = propModelSizeStats.Value, + Node = propNode.Value, + OpenTime = propOpenTime.Value, + State = propState.Value, + TimingStats = propTimingStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignmentExplanation, value.AssignmentExplanation, null, null); + writer.WriteProperty(options, PropDataCounts, value.DataCounts, null, null); + writer.WriteProperty(options, PropDeleting, value.Deleting, null, null); + writer.WriteProperty(options, PropForecastsStats, value.ForecastsStats, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropModelSizeStats, value.ModelSizeStats, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropOpenTime, value.OpenTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropTimingStats, value.TimingStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobStatsConverter))] public sealed partial class JobStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobStats(Elastic.Clients.Elasticsearch.MachineLearning.DataCounts dataCounts, Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics forecastsStats, string jobId, Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats modelSizeStats, Elastic.Clients.Elasticsearch.MachineLearning.JobState state, Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats timingStats) + { + DataCounts = dataCounts; + ForecastsStats = forecastsStats; + JobId = jobId; + ModelSizeStats = modelSizeStats; + State = state; + TimingStats = timingStats; + } +#if NET7_0_OR_GREATER + public JobStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For open anomaly detection jobs only, contains messages relating to the selection of a node to run the job. /// /// - [JsonInclude, JsonPropertyName("assignment_explanation")] - public string? AssignmentExplanation { get; init; } + public string? AssignmentExplanation { get; set; } /// /// @@ -44,16 +187,18 @@ public sealed partial class JobStats /// If a model snapshot is reverted or old results are deleted, the job counts are not reset. /// /// - [JsonInclude, JsonPropertyName("data_counts")] - public Elastic.Clients.Elasticsearch.MachineLearning.DataCounts DataCounts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DataCounts DataCounts { get; set; } /// /// /// Indicates that the process of deleting the job is in progress but not yet completed. It is only reported when true. /// /// - [JsonInclude, JsonPropertyName("deleting")] - public bool? Deleting { get; init; } + public bool? Deleting { get; set; } /// /// @@ -61,24 +206,33 @@ public sealed partial class JobStats /// Some statistics are omitted if no forecasts have been made. /// /// - [JsonInclude, JsonPropertyName("forecasts_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics ForecastsStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobForecastStatistics ForecastsStats { get; set; } /// /// /// Identifier for the anomaly detection job. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// An object that provides information about the size and contents of the model. /// /// - [JsonInclude, JsonPropertyName("model_size_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats ModelSizeStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats ModelSizeStats { get; set; } /// /// @@ -86,30 +240,34 @@ public sealed partial class JobStats /// This information is available only for open jobs. /// /// - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact? Node { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DiscoveryNodeCompact? Node { get; set; } /// /// /// For open jobs only, the elapsed time for which the job has been open. /// /// - [JsonInclude, JsonPropertyName("open_time")] - public DateTimeOffset? OpenTime { get; init; } + public System.DateTimeOffset? OpenTime { get; set; } /// /// /// The status of the anomaly detection job, which can be one of the following values: closed, closing, failed, opened, opening. /// /// - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobState State { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobState State { get; set; } /// /// /// An object that provides statistical information about timing aspect of this job. /// /// - [JsonInclude, JsonPropertyName("timing_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats TimingStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats TimingStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobTimingStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobTimingStats.g.cs index 884bb992621..364ff2fd7a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobTimingStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JobTimingStats.g.cs @@ -17,32 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JobTimingStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAverageBucketProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("average_bucket_processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropBucketCount = System.Text.Json.JsonEncodedText.Encode("bucket_count"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAverageBucketProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("exponential_average_bucket_processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAverageBucketProcessingTimePerHourMs = System.Text.Json.JsonEncodedText.Encode("exponential_average_bucket_processing_time_per_hour_ms"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaximumBucketProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("maximum_bucket_processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumBucketProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("minimum_bucket_processing_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropTotalBucketProcessingTimeMs = System.Text.Json.JsonEncodedText.Encode("total_bucket_processing_time_ms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAverageBucketProcessingTimeMs = default; + LocalJsonValue propBucketCount = default; + LocalJsonValue propExponentialAverageBucketProcessingTimeMs = default; + LocalJsonValue propExponentialAverageBucketProcessingTimePerHourMs = default; + LocalJsonValue propJobId = default; + LocalJsonValue propMaximumBucketProcessingTimeMs = default; + LocalJsonValue propMinimumBucketProcessingTimeMs = default; + LocalJsonValue propTotalBucketProcessingTimeMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAverageBucketProcessingTimeMs.TryReadProperty(ref reader, options, PropAverageBucketProcessingTimeMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propBucketCount.TryReadProperty(ref reader, options, PropBucketCount, null)) + { + continue; + } + + if (propExponentialAverageBucketProcessingTimeMs.TryReadProperty(ref reader, options, PropExponentialAverageBucketProcessingTimeMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propExponentialAverageBucketProcessingTimePerHourMs.TryReadProperty(ref reader, options, PropExponentialAverageBucketProcessingTimePerHourMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaximumBucketProcessingTimeMs.TryReadProperty(ref reader, options, PropMaximumBucketProcessingTimeMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propMinimumBucketProcessingTimeMs.TryReadProperty(ref reader, options, PropMinimumBucketProcessingTimeMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalBucketProcessingTimeMs.TryReadProperty(ref reader, options, PropTotalBucketProcessingTimeMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AverageBucketProcessingTimeMs = propAverageBucketProcessingTimeMs.Value, + BucketCount = propBucketCount.Value, + ExponentialAverageBucketProcessingTimeMs = propExponentialAverageBucketProcessingTimeMs.Value, + ExponentialAverageBucketProcessingTimePerHourMs = propExponentialAverageBucketProcessingTimePerHourMs.Value, + JobId = propJobId.Value, + MaximumBucketProcessingTimeMs = propMaximumBucketProcessingTimeMs.Value, + MinimumBucketProcessingTimeMs = propMinimumBucketProcessingTimeMs.Value, + TotalBucketProcessingTimeMs = propTotalBucketProcessingTimeMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAverageBucketProcessingTimeMs, value.AverageBucketProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropBucketCount, value.BucketCount, null, null); + writer.WriteProperty(options, PropExponentialAverageBucketProcessingTimeMs, value.ExponentialAverageBucketProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropExponentialAverageBucketProcessingTimePerHourMs, value.ExponentialAverageBucketProcessingTimePerHourMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaximumBucketProcessingTimeMs, value.MaximumBucketProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropMinimumBucketProcessingTimeMs, value.MinimumBucketProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalBucketProcessingTimeMs, value.TotalBucketProcessingTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JobTimingStatsConverter))] public sealed partial class JobTimingStats { - [JsonInclude, JsonPropertyName("average_bucket_processing_time_ms")] - public double? AverageBucketProcessingTimeMs { get; init; } - [JsonInclude, JsonPropertyName("bucket_count")] - public long BucketCount { get; init; } - [JsonInclude, JsonPropertyName("exponential_average_bucket_processing_time_ms")] - public double? ExponentialAverageBucketProcessingTimeMs { get; init; } - [JsonInclude, JsonPropertyName("exponential_average_bucket_processing_time_per_hour_ms")] - public double ExponentialAverageBucketProcessingTimePerHourMs { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("maximum_bucket_processing_time_ms")] - public double? MaximumBucketProcessingTimeMs { get; init; } - [JsonInclude, JsonPropertyName("minimum_bucket_processing_time_ms")] - public double? MinimumBucketProcessingTimeMs { get; init; } - [JsonInclude, JsonPropertyName("total_bucket_processing_time_ms")] - public double TotalBucketProcessingTimeMs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobTimingStats(long bucketCount, System.TimeSpan exponentialAverageBucketProcessingTimePerHourMs, string jobId, System.TimeSpan totalBucketProcessingTimeMs) + { + BucketCount = bucketCount; + ExponentialAverageBucketProcessingTimePerHourMs = exponentialAverageBucketProcessingTimePerHourMs; + JobId = jobId; + TotalBucketProcessingTimeMs = totalBucketProcessingTimeMs; + } +#if NET7_0_OR_GREATER + public JobTimingStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobTimingStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobTimingStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.TimeSpan? AverageBucketProcessingTimeMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BucketCount { get; set; } + public System.TimeSpan? ExponentialAverageBucketProcessingTimeMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ExponentialAverageBucketProcessingTimePerHourMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public System.TimeSpan? MaximumBucketProcessingTimeMs { get; set; } + public System.TimeSpan? MinimumBucketProcessingTimeMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalBucketProcessingTimeMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JvmStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JvmStats.g.cs index 5764fc527ab..ca8dbb9c8fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JvmStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/JvmStats.g.cs @@ -17,63 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class JvmStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHeapMax = System.Text.Json.JsonEncodedText.Encode("heap_max"); + private static readonly System.Text.Json.JsonEncodedText PropHeapMaxInBytes = System.Text.Json.JsonEncodedText.Encode("heap_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropJavaInference = System.Text.Json.JsonEncodedText.Encode("java_inference"); + private static readonly System.Text.Json.JsonEncodedText PropJavaInferenceInBytes = System.Text.Json.JsonEncodedText.Encode("java_inference_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropJavaInferenceMax = System.Text.Json.JsonEncodedText.Encode("java_inference_max"); + private static readonly System.Text.Json.JsonEncodedText PropJavaInferenceMaxInBytes = System.Text.Json.JsonEncodedText.Encode("java_inference_max_in_bytes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.JvmStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHeapMax = default; + LocalJsonValue propHeapMaxInBytes = default; + LocalJsonValue propJavaInference = default; + LocalJsonValue propJavaInferenceInBytes = default; + LocalJsonValue propJavaInferenceMax = default; + LocalJsonValue propJavaInferenceMaxInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHeapMax.TryReadProperty(ref reader, options, PropHeapMax, null)) + { + continue; + } + + if (propHeapMaxInBytes.TryReadProperty(ref reader, options, PropHeapMaxInBytes, null)) + { + continue; + } + + if (propJavaInference.TryReadProperty(ref reader, options, PropJavaInference, null)) + { + continue; + } + + if (propJavaInferenceInBytes.TryReadProperty(ref reader, options, PropJavaInferenceInBytes, null)) + { + continue; + } + + if (propJavaInferenceMax.TryReadProperty(ref reader, options, PropJavaInferenceMax, null)) + { + continue; + } + + if (propJavaInferenceMaxInBytes.TryReadProperty(ref reader, options, PropJavaInferenceMaxInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.JvmStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HeapMax = propHeapMax.Value, + HeapMaxInBytes = propHeapMaxInBytes.Value, + JavaInference = propJavaInference.Value, + JavaInferenceInBytes = propJavaInferenceInBytes.Value, + JavaInferenceMax = propJavaInferenceMax.Value, + JavaInferenceMaxInBytes = propJavaInferenceMaxInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.JvmStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHeapMax, value.HeapMax, null, null); + writer.WriteProperty(options, PropHeapMaxInBytes, value.HeapMaxInBytes, null, null); + writer.WriteProperty(options, PropJavaInference, value.JavaInference, null, null); + writer.WriteProperty(options, PropJavaInferenceInBytes, value.JavaInferenceInBytes, null, null); + writer.WriteProperty(options, PropJavaInferenceMax, value.JavaInferenceMax, null, null); + writer.WriteProperty(options, PropJavaInferenceMaxInBytes, value.JavaInferenceMaxInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.JvmStatsConverter))] public sealed partial class JvmStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JvmStats(int heapMaxInBytes, int javaInferenceInBytes, int javaInferenceMaxInBytes) + { + HeapMaxInBytes = heapMaxInBytes; + JavaInferenceInBytes = javaInferenceInBytes; + JavaInferenceMaxInBytes = javaInferenceMaxInBytes; + } +#if NET7_0_OR_GREATER + public JvmStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JvmStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JvmStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Maximum amount of memory available for use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_max")] - public Elastic.Clients.Elasticsearch.ByteSize? HeapMax { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? HeapMax { get; set; } /// /// /// Maximum amount of memory, in bytes, available for use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_max_in_bytes")] - public int HeapMaxInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int HeapMaxInBytes { get; set; } /// /// /// Amount of Java heap currently being used for caching inference models. /// /// - [JsonInclude, JsonPropertyName("java_inference")] - public Elastic.Clients.Elasticsearch.ByteSize? JavaInference { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? JavaInference { get; set; } /// /// /// Amount of Java heap, in bytes, currently being used for caching inference models. /// /// - [JsonInclude, JsonPropertyName("java_inference_in_bytes")] - public int JavaInferenceInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int JavaInferenceInBytes { get; set; } /// /// /// Maximum amount of Java heap to be used for caching inference models. /// /// - [JsonInclude, JsonPropertyName("java_inference_max")] - public Elastic.Clients.Elasticsearch.ByteSize? JavaInferenceMax { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? JavaInferenceMax { get; set; } /// /// /// Maximum amount of Java heap, in bytes, to be used for caching inference models. /// /// - [JsonInclude, JsonPropertyName("java_inference_max_in_bytes")] - public int JavaInferenceMaxInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int JavaInferenceMaxInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/LearningToRankConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/LearningToRankConfig.g.cs new file mode 100644 index 00000000000..499c549a9af --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/LearningToRankConfig.g.cs @@ -0,0 +1,293 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.MachineLearning; + +internal sealed partial class LearningToRankConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaultParams = System.Text.Json.JsonEncodedText.Encode("default_params"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureExtractors = System.Text.Json.JsonEncodedText.Encode("feature_extractors"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDefaultParams = default; + LocalJsonValue>?> propFeatureExtractors = default; + LocalJsonValue propNumTopFeatureImportanceValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaultParams.TryReadProperty(ref reader, options, PropDefaultParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFeatureExtractors.TryReadProperty(ref reader, options, PropFeatureExtractors, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DefaultParams = propDefaultParams.Value, + FeatureExtractors = propFeatureExtractors.Value, + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaultParams, value.DefaultParams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFeatureExtractors, value.FeatureExtractors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigConverter))] +public sealed partial class LearningToRankConfig +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankConfig(int numTopFeatureImportanceValues) + { + NumTopFeatureImportanceValues = numTopFeatureImportanceValues; + } +#if NET7_0_OR_GREATER + public LearningToRankConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public LearningToRankConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IDictionary? DefaultParams { get; set; } + public System.Collections.Generic.ICollection>? FeatureExtractors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumTopFeatureImportanceValues { get; set; } +} + +public readonly partial struct LearningToRankConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams(System.Collections.Generic.IDictionary? value) + { + Instance.DefaultParams = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams() + { + Instance.DefaultParams = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams(System.Action? action) + { + Instance.DefaultParams = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor AddDefaultParam(string key, object value) + { + Instance.DefaultParams ??= new System.Collections.Generic.Dictionary(); + Instance.DefaultParams.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(System.Collections.Generic.ICollection>? value) + { + Instance.FeatureExtractors = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(params System.Collections.Generic.IDictionary[] values) + { + Instance.FeatureExtractors = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor.Build(action)); + } + + Instance.FeatureExtractors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor NumTopFeatureImportanceValues(int value) + { + Instance.NumTopFeatureImportanceValues = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct LearningToRankConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LearningToRankConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams(System.Collections.Generic.IDictionary? value) + { + Instance.DefaultParams = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams() + { + Instance.DefaultParams = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor DefaultParams(System.Action? action) + { + Instance.DefaultParams = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor AddDefaultParam(string key, object value) + { + Instance.DefaultParams ??= new System.Collections.Generic.Dictionary(); + Instance.DefaultParams.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(System.Collections.Generic.ICollection>? value) + { + Instance.FeatureExtractors = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(params System.Collections.Generic.IDictionary[] values) + { + Instance.FeatureExtractors = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(params System.Action?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor.Build(action)); + } + + Instance.FeatureExtractors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor FeatureExtractors(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringQueryFeatureExtractor.Build(action)); + } + + Instance.FeatureExtractors = items; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor NumTopFeatureImportanceValues(int value) + { + Instance.NumTopFeatureImportanceValues = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.LearningToRankConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Limits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Limits.g.cs index 3672829ff72..022e2a46f55 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Limits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Limits.g.cs @@ -17,26 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class LimitsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEffectiveMaxModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("effective_max_model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropMaxModelMemoryLimit = System.Text.Json.JsonEncodedText.Encode("max_model_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSingleMlNodeProcessors = System.Text.Json.JsonEncodedText.Encode("max_single_ml_node_processors"); + private static readonly System.Text.Json.JsonEncodedText PropTotalMlMemory = System.Text.Json.JsonEncodedText.Encode("total_ml_memory"); + private static readonly System.Text.Json.JsonEncodedText PropTotalMlProcessors = System.Text.Json.JsonEncodedText.Encode("total_ml_processors"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Limits Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEffectiveMaxModelMemoryLimit = default; + LocalJsonValue propMaxModelMemoryLimit = default; + LocalJsonValue propMaxSingleMlNodeProcessors = default; + LocalJsonValue propTotalMlMemory = default; + LocalJsonValue propTotalMlProcessors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEffectiveMaxModelMemoryLimit.TryReadProperty(ref reader, options, PropEffectiveMaxModelMemoryLimit, null)) + { + continue; + } + + if (propMaxModelMemoryLimit.TryReadProperty(ref reader, options, PropMaxModelMemoryLimit, null)) + { + continue; + } + + if (propMaxSingleMlNodeProcessors.TryReadProperty(ref reader, options, PropMaxSingleMlNodeProcessors, null)) + { + continue; + } + + if (propTotalMlMemory.TryReadProperty(ref reader, options, PropTotalMlMemory, null)) + { + continue; + } + + if (propTotalMlProcessors.TryReadProperty(ref reader, options, PropTotalMlProcessors, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Limits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EffectiveMaxModelMemoryLimit = propEffectiveMaxModelMemoryLimit.Value, + MaxModelMemoryLimit = propMaxModelMemoryLimit.Value, + MaxSingleMlNodeProcessors = propMaxSingleMlNodeProcessors.Value, + TotalMlMemory = propTotalMlMemory.Value, + TotalMlProcessors = propTotalMlProcessors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Limits value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEffectiveMaxModelMemoryLimit, value.EffectiveMaxModelMemoryLimit, null, null); + writer.WriteProperty(options, PropMaxModelMemoryLimit, value.MaxModelMemoryLimit, null, null); + writer.WriteProperty(options, PropMaxSingleMlNodeProcessors, value.MaxSingleMlNodeProcessors, null, null); + writer.WriteProperty(options, PropTotalMlMemory, value.TotalMlMemory, null, null); + writer.WriteProperty(options, PropTotalMlProcessors, value.TotalMlProcessors, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.LimitsConverter))] public sealed partial class Limits { - [JsonInclude, JsonPropertyName("effective_max_model_memory_limit")] - public Elastic.Clients.Elasticsearch.ByteSize? EffectiveMaxModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("max_model_memory_limit")] - public Elastic.Clients.Elasticsearch.ByteSize? MaxModelMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("max_single_ml_node_processors")] - public int? MaxSingleMlNodeProcessors { get; init; } - [JsonInclude, JsonPropertyName("total_ml_memory")] - public Elastic.Clients.Elasticsearch.ByteSize TotalMlMemory { get; init; } - [JsonInclude, JsonPropertyName("total_ml_processors")] - public int? TotalMlProcessors { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Limits(Elastic.Clients.Elasticsearch.ByteSize totalMlMemory) + { + TotalMlMemory = totalMlMemory; + } +#if NET7_0_OR_GREATER + public Limits() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Limits() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Limits(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ByteSize? EffectiveMaxModelMemoryLimit { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? MaxModelMemoryLimit { get; set; } + public int? MaxSingleMlNodeProcessors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize TotalMlMemory { get; set; } + public int? TotalMlProcessors { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemMlStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemMlStats.g.cs index 5f3ac1ed87f..c4245e70ba3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemMlStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemMlStats.g.cs @@ -17,95 +17,248 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class MemMlStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnomalyDetectors = System.Text.Json.JsonEncodedText.Encode("anomaly_detectors"); + private static readonly System.Text.Json.JsonEncodedText PropAnomalyDetectorsInBytes = System.Text.Json.JsonEncodedText.Encode("anomaly_detectors_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrameAnalytics = System.Text.Json.JsonEncodedText.Encode("data_frame_analytics"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrameAnalyticsInBytes = System.Text.Json.JsonEncodedText.Encode("data_frame_analytics_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInBytes = System.Text.Json.JsonEncodedText.Encode("max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNativeCodeOverhead = System.Text.Json.JsonEncodedText.Encode("native_code_overhead"); + private static readonly System.Text.Json.JsonEncodedText PropNativeCodeOverheadInBytes = System.Text.Json.JsonEncodedText.Encode("native_code_overhead_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNativeInference = System.Text.Json.JsonEncodedText.Encode("native_inference"); + private static readonly System.Text.Json.JsonEncodedText PropNativeInferenceInBytes = System.Text.Json.JsonEncodedText.Encode("native_inference_in_bytes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnomalyDetectors = default; + LocalJsonValue propAnomalyDetectorsInBytes = default; + LocalJsonValue propDataFrameAnalytics = default; + LocalJsonValue propDataFrameAnalyticsInBytes = default; + LocalJsonValue propMax = default; + LocalJsonValue propMaxInBytes = default; + LocalJsonValue propNativeCodeOverhead = default; + LocalJsonValue propNativeCodeOverheadInBytes = default; + LocalJsonValue propNativeInference = default; + LocalJsonValue propNativeInferenceInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnomalyDetectors.TryReadProperty(ref reader, options, PropAnomalyDetectors, null)) + { + continue; + } + + if (propAnomalyDetectorsInBytes.TryReadProperty(ref reader, options, PropAnomalyDetectorsInBytes, null)) + { + continue; + } + + if (propDataFrameAnalytics.TryReadProperty(ref reader, options, PropDataFrameAnalytics, null)) + { + continue; + } + + if (propDataFrameAnalyticsInBytes.TryReadProperty(ref reader, options, PropDataFrameAnalyticsInBytes, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMaxInBytes.TryReadProperty(ref reader, options, PropMaxInBytes, null)) + { + continue; + } + + if (propNativeCodeOverhead.TryReadProperty(ref reader, options, PropNativeCodeOverhead, null)) + { + continue; + } + + if (propNativeCodeOverheadInBytes.TryReadProperty(ref reader, options, PropNativeCodeOverheadInBytes, null)) + { + continue; + } + + if (propNativeInference.TryReadProperty(ref reader, options, PropNativeInference, null)) + { + continue; + } + + if (propNativeInferenceInBytes.TryReadProperty(ref reader, options, PropNativeInferenceInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnomalyDetectors = propAnomalyDetectors.Value, + AnomalyDetectorsInBytes = propAnomalyDetectorsInBytes.Value, + DataFrameAnalytics = propDataFrameAnalytics.Value, + DataFrameAnalyticsInBytes = propDataFrameAnalyticsInBytes.Value, + Max = propMax.Value, + MaxInBytes = propMaxInBytes.Value, + NativeCodeOverhead = propNativeCodeOverhead.Value, + NativeCodeOverheadInBytes = propNativeCodeOverheadInBytes.Value, + NativeInference = propNativeInference.Value, + NativeInferenceInBytes = propNativeInferenceInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnomalyDetectors, value.AnomalyDetectors, null, null); + writer.WriteProperty(options, PropAnomalyDetectorsInBytes, value.AnomalyDetectorsInBytes, null, null); + writer.WriteProperty(options, PropDataFrameAnalytics, value.DataFrameAnalytics, null, null); + writer.WriteProperty(options, PropDataFrameAnalyticsInBytes, value.DataFrameAnalyticsInBytes, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMaxInBytes, value.MaxInBytes, null, null); + writer.WriteProperty(options, PropNativeCodeOverhead, value.NativeCodeOverhead, null, null); + writer.WriteProperty(options, PropNativeCodeOverheadInBytes, value.NativeCodeOverheadInBytes, null, null); + writer.WriteProperty(options, PropNativeInference, value.NativeInference, null, null); + writer.WriteProperty(options, PropNativeInferenceInBytes, value.NativeInferenceInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MemMlStatsConverter))] public sealed partial class MemMlStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MemMlStats(int anomalyDetectorsInBytes, int dataFrameAnalyticsInBytes, int maxInBytes, int nativeCodeOverheadInBytes, int nativeInferenceInBytes) + { + AnomalyDetectorsInBytes = anomalyDetectorsInBytes; + DataFrameAnalyticsInBytes = dataFrameAnalyticsInBytes; + MaxInBytes = maxInBytes; + NativeCodeOverheadInBytes = nativeCodeOverheadInBytes; + NativeInferenceInBytes = nativeInferenceInBytes; + } +#if NET7_0_OR_GREATER + public MemMlStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MemMlStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MemMlStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Amount of native memory set aside for anomaly detection jobs. /// /// - [JsonInclude, JsonPropertyName("anomaly_detectors")] - public Elastic.Clients.Elasticsearch.ByteSize? AnomalyDetectors { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? AnomalyDetectors { get; set; } /// /// /// Amount of native memory, in bytes, set aside for anomaly detection jobs. /// /// - [JsonInclude, JsonPropertyName("anomaly_detectors_in_bytes")] - public int AnomalyDetectorsInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AnomalyDetectorsInBytes { get; set; } /// /// /// Amount of native memory set aside for data frame analytics jobs. /// /// - [JsonInclude, JsonPropertyName("data_frame_analytics")] - public Elastic.Clients.Elasticsearch.ByteSize? DataFrameAnalytics { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? DataFrameAnalytics { get; set; } /// /// /// Amount of native memory, in bytes, set aside for data frame analytics jobs. /// /// - [JsonInclude, JsonPropertyName("data_frame_analytics_in_bytes")] - public int DataFrameAnalyticsInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int DataFrameAnalyticsInBytes { get; set; } /// /// /// Maximum amount of native memory (separate to the JVM heap) that may be used by machine learning native processes. /// /// - [JsonInclude, JsonPropertyName("max")] - public Elastic.Clients.Elasticsearch.ByteSize? Max { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Max { get; set; } /// /// /// Maximum amount of native memory (separate to the JVM heap), in bytes, that may be used by machine learning native processes. /// /// - [JsonInclude, JsonPropertyName("max_in_bytes")] - public int MaxInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxInBytes { get; set; } /// /// /// Amount of native memory set aside for loading machine learning native code shared libraries. /// /// - [JsonInclude, JsonPropertyName("native_code_overhead")] - public Elastic.Clients.Elasticsearch.ByteSize? NativeCodeOverhead { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? NativeCodeOverhead { get; set; } /// /// /// Amount of native memory, in bytes, set aside for loading machine learning native code shared libraries. /// /// - [JsonInclude, JsonPropertyName("native_code_overhead_in_bytes")] - public int NativeCodeOverheadInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NativeCodeOverheadInBytes { get; set; } /// /// /// Amount of native memory set aside for trained models that have a PyTorch model_type. /// /// - [JsonInclude, JsonPropertyName("native_inference")] - public Elastic.Clients.Elasticsearch.ByteSize? NativeInference { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? NativeInference { get; set; } /// /// /// Amount of native memory, in bytes, set aside for trained models that have a PyTorch model_type. /// /// - [JsonInclude, JsonPropertyName("native_inference_in_bytes")] - public int NativeInferenceInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NativeInferenceInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemStats.g.cs index 3d749746cf3..b47331c0792 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/MemStats.g.cs @@ -17,26 +17,121 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class MemStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdjustedTotal = System.Text.Json.JsonEncodedText.Encode("adjusted_total"); + private static readonly System.Text.Json.JsonEncodedText PropAdjustedTotalInBytes = System.Text.Json.JsonEncodedText.Encode("adjusted_total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.MemStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdjustedTotal = default; + LocalJsonValue propAdjustedTotalInBytes = default; + LocalJsonValue propMl = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdjustedTotal.TryReadProperty(ref reader, options, PropAdjustedTotal, null)) + { + continue; + } + + if (propAdjustedTotalInBytes.TryReadProperty(ref reader, options, PropAdjustedTotalInBytes, null)) + { + continue; + } + + if (propMl.TryReadProperty(ref reader, options, PropMl, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.MemStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdjustedTotal = propAdjustedTotal.Value, + AdjustedTotalInBytes = propAdjustedTotalInBytes.Value, + Ml = propMl.Value, + Total = propTotal.Value, + TotalInBytes = propTotalInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.MemStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdjustedTotal, value.AdjustedTotal, null, null); + writer.WriteProperty(options, PropAdjustedTotalInBytes, value.AdjustedTotalInBytes, null, null); + writer.WriteProperty(options, PropMl, value.Ml, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MemStatsConverter))] public sealed partial class MemStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MemStats(int adjustedTotalInBytes, Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats ml, int totalInBytes) + { + AdjustedTotalInBytes = adjustedTotalInBytes; + Ml = ml; + TotalInBytes = totalInBytes; + } +#if NET7_0_OR_GREATER + public MemStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MemStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MemStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the amount of physical memory has been overridden using the es.total_memory_bytes system property /// then this reports the overridden value. Otherwise it reports the same value as total. /// /// - [JsonInclude, JsonPropertyName("adjusted_total")] - public Elastic.Clients.Elasticsearch.ByteSize? AdjustedTotal { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? AdjustedTotal { get; set; } /// /// @@ -44,30 +139,38 @@ public sealed partial class MemStats /// then this reports the overridden value in bytes. Otherwise it reports the same value as total_in_bytes. /// /// - [JsonInclude, JsonPropertyName("adjusted_total_in_bytes")] - public int AdjustedTotalInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AdjustedTotalInBytes { get; set; } /// /// /// Contains statistics about machine learning use of native memory on the node. /// /// - [JsonInclude, JsonPropertyName("ml")] - public Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats Ml { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.MemMlStats Ml { get; set; } /// /// /// Total amount of physical memory. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.ByteSize? Total { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Total { get; set; } /// /// /// Total amount of physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public int TotalInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Memory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Memory.g.cs index b71e5a755fd..635650aec8b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Memory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Memory.g.cs @@ -17,60 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class MemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropJvm = System.Text.Json.JsonEncodedText.Encode("jvm"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Memory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propJvm = default; + LocalJsonValue propMem = default; + LocalJsonValue propName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propJvm.TryReadProperty(ref reader, options, PropJvm, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Memory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + Jvm = propJvm.Value, + Mem = propMem.Value, + Name = propName.Value, + Roles = propRoles.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Memory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropJvm, value.Jvm, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.MemoryConverter))] public sealed partial class Memory { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string EphemeralId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Memory(System.Collections.Generic.IReadOnlyDictionary attributes, string ephemeralId, Elastic.Clients.Elasticsearch.MachineLearning.JvmStats jvm, Elastic.Clients.Elasticsearch.MachineLearning.MemStats mem, string name, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress) + { + Attributes = attributes; + EphemeralId = ephemeralId; + Jvm = jvm; + Mem = mem; + Name = name; + Roles = roles; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public Memory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Memory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Memory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string EphemeralId { get; set; } /// /// /// Contains Java Virtual Machine (JVM) statistics for the node. /// /// - [JsonInclude, JsonPropertyName("jvm")] - public Elastic.Clients.Elasticsearch.MachineLearning.JvmStats Jvm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JvmStats Jvm { get; set; } /// /// /// Contains statistics about memory usage for the node. /// /// - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.MachineLearning.MemStats Mem { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.MemStats Mem { get; set; } /// /// /// Human-readable identifier for the node. Based on the Node name setting setting. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// Roles assigned to the node. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } /// /// /// The host and port where transport HTTP connections are accepted. /// /// - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPackageConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPackageConfig.g.cs index 43aca84a8a6..af574532ceb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPackageConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPackageConfig.g.cs @@ -17,44 +17,209 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ModelPackageConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumVersion = System.Text.Json.JsonEncodedText.Encode("minimum_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelRepository = System.Text.Json.JsonEncodedText.Encode("model_repository"); + private static readonly System.Text.Json.JsonEncodedText PropModelType = System.Text.Json.JsonEncodedText.Encode("model_type"); + private static readonly System.Text.Json.JsonEncodedText PropPackagedModelId = System.Text.Json.JsonEncodedText.Encode("packaged_model_id"); + private static readonly System.Text.Json.JsonEncodedText PropPlatformArchitecture = System.Text.Json.JsonEncodedText.Encode("platform_architecture"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixStrings = System.Text.Json.JsonEncodedText.Encode("prefix_strings"); + private static readonly System.Text.Json.JsonEncodedText PropSha256 = System.Text.Json.JsonEncodedText.Encode("sha256"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropTags = System.Text.Json.JsonEncodedText.Encode("tags"); + private static readonly System.Text.Json.JsonEncodedText PropVocabularyFile = System.Text.Json.JsonEncodedText.Encode("vocabulary_file"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreateTime = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propInferenceConfig = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propMinimumVersion = default; + LocalJsonValue propModelRepository = default; + LocalJsonValue propModelType = default; + LocalJsonValue propPackagedModelId = default; + LocalJsonValue propPlatformArchitecture = default; + LocalJsonValue propPrefixStrings = default; + LocalJsonValue propSha256 = default; + LocalJsonValue propSize = default; + LocalJsonValue?> propTags = default; + LocalJsonValue propVocabularyFile = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMinimumVersion.TryReadProperty(ref reader, options, PropMinimumVersion, null)) + { + continue; + } + + if (propModelRepository.TryReadProperty(ref reader, options, PropModelRepository, null)) + { + continue; + } + + if (propModelType.TryReadProperty(ref reader, options, PropModelType, null)) + { + continue; + } + + if (propPackagedModelId.TryReadProperty(ref reader, options, PropPackagedModelId, null)) + { + continue; + } + + if (propPlatformArchitecture.TryReadProperty(ref reader, options, PropPlatformArchitecture, null)) + { + continue; + } + + if (propPrefixStrings.TryReadProperty(ref reader, options, PropPrefixStrings, null)) + { + continue; + } + + if (propSha256.TryReadProperty(ref reader, options, PropSha256, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propTags.TryReadProperty(ref reader, options, PropTags, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propVocabularyFile.TryReadProperty(ref reader, options, PropVocabularyFile, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CreateTime = propCreateTime.Value, + Description = propDescription.Value, + InferenceConfig = propInferenceConfig.Value, + Metadata = propMetadata.Value, + MinimumVersion = propMinimumVersion.Value, + ModelRepository = propModelRepository.Value, + ModelType = propModelType.Value, + PackagedModelId = propPackagedModelId.Value, + PlatformArchitecture = propPlatformArchitecture.Value, + PrefixStrings = propPrefixStrings.Value, + Sha256 = propSha256.Value, + Size = propSize.Value, + Tags = propTags.Value, + VocabularyFile = propVocabularyFile.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMinimumVersion, value.MinimumVersion, null, null); + writer.WriteProperty(options, PropModelRepository, value.ModelRepository, null, null); + writer.WriteProperty(options, PropModelType, value.ModelType, null, null); + writer.WriteProperty(options, PropPackagedModelId, value.PackagedModelId, null, null); + writer.WriteProperty(options, PropPlatformArchitecture, value.PlatformArchitecture, null, null); + writer.WriteProperty(options, PropPrefixStrings, value.PrefixStrings, null, null); + writer.WriteProperty(options, PropSha256, value.Sha256, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropTags, value.Tags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVocabularyFile, value.VocabularyFile, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfigConverter))] public sealed partial class ModelPackageConfig { - [JsonInclude, JsonPropertyName("create_time")] - public long? CreateTime { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("inference_config")] - public IReadOnlyDictionary? InferenceConfig { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary? Metadata { get; init; } - [JsonInclude, JsonPropertyName("minimum_version")] - public string? MinimumVersion { get; init; } - [JsonInclude, JsonPropertyName("model_repository")] - public string? ModelRepository { get; init; } - [JsonInclude, JsonPropertyName("model_type")] - public string? ModelType { get; init; } - [JsonInclude, JsonPropertyName("packaged_model_id")] - public string PackagedModelId { get; init; } - [JsonInclude, JsonPropertyName("platform_architecture")] - public string? PlatformArchitecture { get; init; } - [JsonInclude, JsonPropertyName("prefix_strings")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; init; } - [JsonInclude, JsonPropertyName("sha256")] - public string? Sha256 { get; init; } - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize? Size { get; init; } - [JsonInclude, JsonPropertyName("tags")] - public IReadOnlyCollection? Tags { get; init; } - [JsonInclude, JsonPropertyName("vocabulary_file")] - public string? VocabularyFile { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelPackageConfig(string packagedModelId) + { + PackagedModelId = packagedModelId; + } +#if NET7_0_OR_GREATER + public ModelPackageConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ModelPackageConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModelPackageConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.DateTimeOffset? CreateTime { get; set; } + public string? Description { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? InferenceConfig { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } + public string? MinimumVersion { get; set; } + public string? ModelRepository { get; set; } + public string? ModelType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PackagedModelId { get; set; } + public string? PlatformArchitecture { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; set; } + public string? Sha256 { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Tags { get; set; } + public string? VocabularyFile { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPlotConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPlotConfig.g.cs index 3201aa9ff69..432d22547d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPlotConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelPlotConfig.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ModelPlotConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnnotationsEnabled = System.Text.Json.JsonEncodedText.Encode("annotations_enabled"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnnotationsEnabled = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnnotationsEnabled.TryReadProperty(ref reader, options, PropAnnotationsEnabled, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnnotationsEnabled = propAnnotationsEnabled.Value, + Enabled = propEnabled.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnnotationsEnabled, value.AnnotationsEnabled, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigConverter))] public sealed partial class ModelPlotConfig { +#if NET7_0_OR_GREATER + public ModelPlotConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public ModelPlotConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, enables calculation and storage of the model change annotations for each entity that is being analyzed. /// /// - [JsonInclude, JsonPropertyName("annotations_enabled")] public bool? AnnotationsEnabled { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class ModelPlotConfig /// If true, enables calculation and storage of the model bounds for each entity that is being analyzed. /// /// - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } /// @@ -50,53 +118,48 @@ public sealed partial class ModelPlotConfig /// Limits data collection to this comma separated list of partition or by field values. If terms are not specified or it is an empty string, no filtering is applied. Wildcards are not supported. Only the specified terms can be viewed when using the Single Metric Viewer. /// /// - [JsonInclude, JsonPropertyName("terms")] public Elastic.Clients.Elasticsearch.Field? Terms { get; set; } } -public sealed partial class ModelPlotConfigDescriptor : SerializableDescriptor> +public readonly partial struct ModelPlotConfigDescriptor { - internal ModelPlotConfigDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig Instance { get; init; } - public ModelPlotConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelPlotConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig instance) { + Instance = instance; } - private bool? AnnotationsEnabledValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TermsValue { get; set; } - - /// - /// - /// If true, enables calculation and storage of the model change annotations for each entity that is being analyzed. - /// - /// - public ModelPlotConfigDescriptor AnnotationsEnabled(bool? annotationsEnabled = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelPlotConfigDescriptor() { - AnnotationsEnabledValue = annotationsEnabled; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) => descriptor.Instance; + /// /// - /// If true, enables calculation and storage of the model bounds for each entity that is being analyzed. + /// If true, enables calculation and storage of the model change annotations for each entity that is being analyzed. /// /// - public ModelPlotConfigDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor AnnotationsEnabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.AnnotationsEnabled = value; + return this; } /// /// - /// Limits data collection to this comma separated list of partition or by field values. If terms are not specified or it is an empty string, no filtering is applied. Wildcards are not supported. Only the specified terms can be viewed when using the Single Metric Viewer. + /// If true, enables calculation and storage of the model bounds for each entity that is being analyzed. /// /// - public ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch.Field? terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Enabled(bool? value = true) { - TermsValue = terms; - return Self; + Instance.Enabled = value; + return this; } /// @@ -104,10 +167,10 @@ public ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch. /// Limits data collection to this comma separated list of partition or by field values. If terms are not specified or it is an empty string, no filtering is applied. Wildcards are not supported. Only the specified terms can be viewed when using the Single Metric Viewer. /// /// - public ModelPlotConfigDescriptor Terms(Expression> terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch.Field? value) { - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } /// @@ -115,80 +178,65 @@ public ModelPlotConfigDescriptor Terms(Expression /// - public ModelPlotConfigDescriptor Terms(Expression> terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Terms(System.Linq.Expressions.Expression> value) { - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig Build(System.Action>? action) { - writer.WriteStartObject(); - if (AnnotationsEnabledValue.HasValue) + if (action is null) { - writer.WritePropertyName("annotations_enabled"); - writer.WriteBooleanValue(AnnotationsEnabledValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (TermsValue is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ModelPlotConfigDescriptor : SerializableDescriptor +public readonly partial struct ModelPlotConfigDescriptor { - internal ModelPlotConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig Instance { get; init; } - public ModelPlotConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelPlotConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig instance) { + Instance = instance; } - private bool? AnnotationsEnabledValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? TermsValue { get; set; } - - /// - /// - /// If true, enables calculation and storage of the model change annotations for each entity that is being analyzed. - /// - /// - public ModelPlotConfigDescriptor AnnotationsEnabled(bool? annotationsEnabled = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelPlotConfigDescriptor() { - AnnotationsEnabledValue = annotationsEnabled; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor descriptor) => descriptor.Instance; + /// /// - /// If true, enables calculation and storage of the model bounds for each entity that is being analyzed. + /// If true, enables calculation and storage of the model change annotations for each entity that is being analyzed. /// /// - public ModelPlotConfigDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor AnnotationsEnabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.AnnotationsEnabled = value; + return this; } /// /// - /// Limits data collection to this comma separated list of partition or by field values. If terms are not specified or it is an empty string, no filtering is applied. Wildcards are not supported. Only the specified terms can be viewed when using the Single Metric Viewer. + /// If true, enables calculation and storage of the model bounds for each entity that is being analyzed. /// /// - public ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch.Field? terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Enabled(bool? value = true) { - TermsValue = terms; - return Self; + Instance.Enabled = value; + return this; } /// @@ -196,10 +244,10 @@ public ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch.Field? term /// Limits data collection to this comma separated list of partition or by field values. If terms are not specified or it is an empty string, no filtering is applied. Wildcards are not supported. Only the specified terms can be viewed when using the Single Metric Viewer. /// /// - public ModelPlotConfigDescriptor Terms(Expression> terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Terms(Elastic.Clients.Elasticsearch.Field? value) { - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } /// @@ -207,33 +255,22 @@ public ModelPlotConfigDescriptor Terms(Expression /// - public ModelPlotConfigDescriptor Terms(Expression> terms) + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor Terms(System.Linq.Expressions.Expression> value) { - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig Build(System.Action? action) { - writer.WriteStartObject(); - if (AnnotationsEnabledValue.HasValue) - { - writer.WritePropertyName("annotations_enabled"); - writer.WriteBooleanValue(AnnotationsEnabledValue.Value); - } - - if (EnabledValue.HasValue) + if (action is null) { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TermsValue is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ModelPlotConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSizeStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSizeStats.g.cs index dd2dbaa443e..595fb1b9af8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSizeStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSizeStats.g.cs @@ -17,60 +17,364 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ModelSizeStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAssignmentMemoryBasis = System.Text.Json.JsonEncodedText.Encode("assignment_memory_basis"); + private static readonly System.Text.Json.JsonEncodedText PropBucketAllocationFailuresCount = System.Text.Json.JsonEncodedText.Encode("bucket_allocation_failures_count"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizationStatus = System.Text.Json.JsonEncodedText.Encode("categorization_status"); + private static readonly System.Text.Json.JsonEncodedText PropCategorizedDocCount = System.Text.Json.JsonEncodedText.Encode("categorized_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropDeadCategoryCount = System.Text.Json.JsonEncodedText.Encode("dead_category_count"); + private static readonly System.Text.Json.JsonEncodedText PropFailedCategoryCount = System.Text.Json.JsonEncodedText.Encode("failed_category_count"); + private static readonly System.Text.Json.JsonEncodedText PropFrequentCategoryCount = System.Text.Json.JsonEncodedText.Encode("frequent_category_count"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropLogTime = System.Text.Json.JsonEncodedText.Encode("log_time"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryStatus = System.Text.Json.JsonEncodedText.Encode("memory_status"); + private static readonly System.Text.Json.JsonEncodedText PropModelBytes = System.Text.Json.JsonEncodedText.Encode("model_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropModelBytesExceeded = System.Text.Json.JsonEncodedText.Encode("model_bytes_exceeded"); + private static readonly System.Text.Json.JsonEncodedText PropModelBytesMemoryLimit = System.Text.Json.JsonEncodedText.Encode("model_bytes_memory_limit"); + private static readonly System.Text.Json.JsonEncodedText PropOutputMemoryAllocatorBytes = System.Text.Json.JsonEncodedText.Encode("output_memory_allocator_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPeakModelBytes = System.Text.Json.JsonEncodedText.Encode("peak_model_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropRareCategoryCount = System.Text.Json.JsonEncodedText.Encode("rare_category_count"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTotalByFieldCount = System.Text.Json.JsonEncodedText.Encode("total_by_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCategoryCount = System.Text.Json.JsonEncodedText.Encode("total_category_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalOverFieldCount = System.Text.Json.JsonEncodedText.Encode("total_over_field_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalPartitionFieldCount = System.Text.Json.JsonEncodedText.Encode("total_partition_field_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignmentMemoryBasis = default; + LocalJsonValue propBucketAllocationFailuresCount = default; + LocalJsonValue propCategorizationStatus = default; + LocalJsonValue propCategorizedDocCount = default; + LocalJsonValue propDeadCategoryCount = default; + LocalJsonValue propFailedCategoryCount = default; + LocalJsonValue propFrequentCategoryCount = default; + LocalJsonValue propJobId = default; + LocalJsonValue propLogTime = default; + LocalJsonValue propMemoryStatus = default; + LocalJsonValue propModelBytes = default; + LocalJsonValue propModelBytesExceeded = default; + LocalJsonValue propModelBytesMemoryLimit = default; + LocalJsonValue propOutputMemoryAllocatorBytes = default; + LocalJsonValue propPeakModelBytes = default; + LocalJsonValue propRareCategoryCount = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTotalByFieldCount = default; + LocalJsonValue propTotalCategoryCount = default; + LocalJsonValue propTotalOverFieldCount = default; + LocalJsonValue propTotalPartitionFieldCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignmentMemoryBasis.TryReadProperty(ref reader, options, PropAssignmentMemoryBasis, null)) + { + continue; + } + + if (propBucketAllocationFailuresCount.TryReadProperty(ref reader, options, PropBucketAllocationFailuresCount, null)) + { + continue; + } + + if (propCategorizationStatus.TryReadProperty(ref reader, options, PropCategorizationStatus, null)) + { + continue; + } + + if (propCategorizedDocCount.TryReadProperty(ref reader, options, PropCategorizedDocCount, null)) + { + continue; + } + + if (propDeadCategoryCount.TryReadProperty(ref reader, options, PropDeadCategoryCount, null)) + { + continue; + } + + if (propFailedCategoryCount.TryReadProperty(ref reader, options, PropFailedCategoryCount, null)) + { + continue; + } + + if (propFrequentCategoryCount.TryReadProperty(ref reader, options, PropFrequentCategoryCount, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propLogTime.TryReadProperty(ref reader, options, PropLogTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propMemoryStatus.TryReadProperty(ref reader, options, PropMemoryStatus, null)) + { + continue; + } + + if (propModelBytes.TryReadProperty(ref reader, options, PropModelBytes, null)) + { + continue; + } + + if (propModelBytesExceeded.TryReadProperty(ref reader, options, PropModelBytesExceeded, null)) + { + continue; + } + + if (propModelBytesMemoryLimit.TryReadProperty(ref reader, options, PropModelBytesMemoryLimit, null)) + { + continue; + } + + if (propOutputMemoryAllocatorBytes.TryReadProperty(ref reader, options, PropOutputMemoryAllocatorBytes, null)) + { + continue; + } + + if (propPeakModelBytes.TryReadProperty(ref reader, options, PropPeakModelBytes, null)) + { + continue; + } + + if (propRareCategoryCount.TryReadProperty(ref reader, options, PropRareCategoryCount, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (propTotalByFieldCount.TryReadProperty(ref reader, options, PropTotalByFieldCount, null)) + { + continue; + } + + if (propTotalCategoryCount.TryReadProperty(ref reader, options, PropTotalCategoryCount, null)) + { + continue; + } + + if (propTotalOverFieldCount.TryReadProperty(ref reader, options, PropTotalOverFieldCount, null)) + { + continue; + } + + if (propTotalPartitionFieldCount.TryReadProperty(ref reader, options, PropTotalPartitionFieldCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AssignmentMemoryBasis = propAssignmentMemoryBasis.Value, + BucketAllocationFailuresCount = propBucketAllocationFailuresCount.Value, + CategorizationStatus = propCategorizationStatus.Value, + CategorizedDocCount = propCategorizedDocCount.Value, + DeadCategoryCount = propDeadCategoryCount.Value, + FailedCategoryCount = propFailedCategoryCount.Value, + FrequentCategoryCount = propFrequentCategoryCount.Value, + JobId = propJobId.Value, + LogTime = propLogTime.Value, + MemoryStatus = propMemoryStatus.Value, + ModelBytes = propModelBytes.Value, + ModelBytesExceeded = propModelBytesExceeded.Value, + ModelBytesMemoryLimit = propModelBytesMemoryLimit.Value, + OutputMemoryAllocatorBytes = propOutputMemoryAllocatorBytes.Value, + PeakModelBytes = propPeakModelBytes.Value, + RareCategoryCount = propRareCategoryCount.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value, + TotalByFieldCount = propTotalByFieldCount.Value, + TotalCategoryCount = propTotalCategoryCount.Value, + TotalOverFieldCount = propTotalOverFieldCount.Value, + TotalPartitionFieldCount = propTotalPartitionFieldCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignmentMemoryBasis, value.AssignmentMemoryBasis, null, null); + writer.WriteProperty(options, PropBucketAllocationFailuresCount, value.BucketAllocationFailuresCount, null, null); + writer.WriteProperty(options, PropCategorizationStatus, value.CategorizationStatus, null, null); + writer.WriteProperty(options, PropCategorizedDocCount, value.CategorizedDocCount, null, null); + writer.WriteProperty(options, PropDeadCategoryCount, value.DeadCategoryCount, null, null); + writer.WriteProperty(options, PropFailedCategoryCount, value.FailedCategoryCount, null, null); + writer.WriteProperty(options, PropFrequentCategoryCount, value.FrequentCategoryCount, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropLogTime, value.LogTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropMemoryStatus, value.MemoryStatus, null, null); + writer.WriteProperty(options, PropModelBytes, value.ModelBytes, null, null); + writer.WriteProperty(options, PropModelBytesExceeded, value.ModelBytesExceeded, null, null); + writer.WriteProperty(options, PropModelBytesMemoryLimit, value.ModelBytesMemoryLimit, null, null); + writer.WriteProperty(options, PropOutputMemoryAllocatorBytes, value.OutputMemoryAllocatorBytes, null, null); + writer.WriteProperty(options, PropPeakModelBytes, value.PeakModelBytes, null, null); + writer.WriteProperty(options, PropRareCategoryCount, value.RareCategoryCount, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteProperty(options, PropTotalByFieldCount, value.TotalByFieldCount, null, null); + writer.WriteProperty(options, PropTotalCategoryCount, value.TotalCategoryCount, null, null); + writer.WriteProperty(options, PropTotalOverFieldCount, value.TotalOverFieldCount, null, null); + writer.WriteProperty(options, PropTotalPartitionFieldCount, value.TotalPartitionFieldCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStatsConverter))] public sealed partial class ModelSizeStats { - [JsonInclude, JsonPropertyName("assignment_memory_basis")] - public string? AssignmentMemoryBasis { get; init; } - [JsonInclude, JsonPropertyName("bucket_allocation_failures_count")] - public long BucketAllocationFailuresCount { get; init; } - [JsonInclude, JsonPropertyName("categorization_status")] - public Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus CategorizationStatus { get; init; } - [JsonInclude, JsonPropertyName("categorized_doc_count")] - public int CategorizedDocCount { get; init; } - [JsonInclude, JsonPropertyName("dead_category_count")] - public int DeadCategoryCount { get; init; } - [JsonInclude, JsonPropertyName("failed_category_count")] - public int FailedCategoryCount { get; init; } - [JsonInclude, JsonPropertyName("frequent_category_count")] - public int FrequentCategoryCount { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("log_time")] - public DateTimeOffset LogTime { get; init; } - [JsonInclude, JsonPropertyName("memory_status")] - public Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus MemoryStatus { get; init; } - [JsonInclude, JsonPropertyName("model_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize ModelBytes { get; init; } - [JsonInclude, JsonPropertyName("model_bytes_exceeded")] - public Elastic.Clients.Elasticsearch.ByteSize? ModelBytesExceeded { get; init; } - [JsonInclude, JsonPropertyName("model_bytes_memory_limit")] - public Elastic.Clients.Elasticsearch.ByteSize? ModelBytesMemoryLimit { get; init; } - [JsonInclude, JsonPropertyName("output_memory_allocator_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? OutputMemoryAllocatorBytes { get; init; } - [JsonInclude, JsonPropertyName("peak_model_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? PeakModelBytes { get; init; } - [JsonInclude, JsonPropertyName("rare_category_count")] - public int RareCategoryCount { get; init; } - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } - [JsonInclude, JsonPropertyName("total_by_field_count")] - public long TotalByFieldCount { get; init; } - [JsonInclude, JsonPropertyName("total_category_count")] - public int TotalCategoryCount { get; init; } - [JsonInclude, JsonPropertyName("total_over_field_count")] - public long TotalOverFieldCount { get; init; } - [JsonInclude, JsonPropertyName("total_partition_field_count")] - public long TotalPartitionFieldCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelSizeStats(long bucketAllocationFailuresCount, Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus categorizationStatus, int categorizedDocCount, int deadCategoryCount, int failedCategoryCount, int frequentCategoryCount, string jobId, System.DateTimeOffset logTime, Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus memoryStatus, Elastic.Clients.Elasticsearch.ByteSize modelBytes, int rareCategoryCount, string resultType, long totalByFieldCount, int totalCategoryCount, long totalOverFieldCount, long totalPartitionFieldCount) + { + BucketAllocationFailuresCount = bucketAllocationFailuresCount; + CategorizationStatus = categorizationStatus; + CategorizedDocCount = categorizedDocCount; + DeadCategoryCount = deadCategoryCount; + FailedCategoryCount = failedCategoryCount; + FrequentCategoryCount = frequentCategoryCount; + JobId = jobId; + LogTime = logTime; + MemoryStatus = memoryStatus; + ModelBytes = modelBytes; + RareCategoryCount = rareCategoryCount; + ResultType = resultType; + TotalByFieldCount = totalByFieldCount; + TotalCategoryCount = totalCategoryCount; + TotalOverFieldCount = totalOverFieldCount; + TotalPartitionFieldCount = totalPartitionFieldCount; + } +#if NET7_0_OR_GREATER + public ModelSizeStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ModelSizeStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModelSizeStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? AssignmentMemoryBasis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long BucketAllocationFailuresCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.CategorizationStatus CategorizationStatus { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int CategorizedDocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DeadCategoryCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int FailedCategoryCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int FrequentCategoryCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset LogTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.MemoryStatus MemoryStatus { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize ModelBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? ModelBytesExceeded { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? ModelBytesMemoryLimit { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? OutputMemoryAllocatorBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? PeakModelBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RareCategoryCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } + public long? Timestamp { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalByFieldCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalCategoryCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalOverFieldCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalPartitionFieldCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshot.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshot.g.cs index 7b4f7aa1c74..f8e7025a2e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshot.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshot.g.cs @@ -17,95 +17,253 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ModelSnapshotConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropLatestRecordTimeStamp = System.Text.Json.JsonEncodedText.Encode("latest_record_time_stamp"); + private static readonly System.Text.Json.JsonEncodedText PropLatestResultTimeStamp = System.Text.Json.JsonEncodedText.Encode("latest_result_time_stamp"); + private static readonly System.Text.Json.JsonEncodedText PropMinVersion = System.Text.Json.JsonEncodedText.Encode("min_version"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeStats = System.Text.Json.JsonEncodedText.Encode("model_size_stats"); + private static readonly System.Text.Json.JsonEncodedText PropRetain = System.Text.Json.JsonEncodedText.Encode("retain"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshotDocCount = System.Text.Json.JsonEncodedText.Encode("snapshot_doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshotId = System.Text.Json.JsonEncodedText.Encode("snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDescription = default; + LocalJsonValue propJobId = default; + LocalJsonValue propLatestRecordTimeStamp = default; + LocalJsonValue propLatestResultTimeStamp = default; + LocalJsonValue propMinVersion = default; + LocalJsonValue propModelSizeStats = default; + LocalJsonValue propRetain = default; + LocalJsonValue propSnapshotDocCount = default; + LocalJsonValue propSnapshotId = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propLatestRecordTimeStamp.TryReadProperty(ref reader, options, PropLatestRecordTimeStamp, null)) + { + continue; + } + + if (propLatestResultTimeStamp.TryReadProperty(ref reader, options, PropLatestResultTimeStamp, null)) + { + continue; + } + + if (propMinVersion.TryReadProperty(ref reader, options, PropMinVersion, null)) + { + continue; + } + + if (propModelSizeStats.TryReadProperty(ref reader, options, PropModelSizeStats, null)) + { + continue; + } + + if (propRetain.TryReadProperty(ref reader, options, PropRetain, null)) + { + continue; + } + + if (propSnapshotDocCount.TryReadProperty(ref reader, options, PropSnapshotDocCount, null)) + { + continue; + } + + if (propSnapshotId.TryReadProperty(ref reader, options, PropSnapshotId, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Description = propDescription.Value, + JobId = propJobId.Value, + LatestRecordTimeStamp = propLatestRecordTimeStamp.Value, + LatestResultTimeStamp = propLatestResultTimeStamp.Value, + MinVersion = propMinVersion.Value, + ModelSizeStats = propModelSizeStats.Value, + Retain = propRetain.Value, + SnapshotDocCount = propSnapshotDocCount.Value, + SnapshotId = propSnapshotId.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshot value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropLatestRecordTimeStamp, value.LatestRecordTimeStamp, null, null); + writer.WriteProperty(options, PropLatestResultTimeStamp, value.LatestResultTimeStamp, null, null); + writer.WriteProperty(options, PropMinVersion, value.MinVersion, null, null); + writer.WriteProperty(options, PropModelSizeStats, value.ModelSizeStats, null, null); + writer.WriteProperty(options, PropRetain, value.Retain, null, null); + writer.WriteProperty(options, PropSnapshotDocCount, value.SnapshotDocCount, null, null); + writer.WriteProperty(options, PropSnapshotId, value.SnapshotId, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshotConverter))] public sealed partial class ModelSnapshot { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelSnapshot(string jobId, string minVersion, bool retain, long snapshotDocCount, string snapshotId, long timestamp) + { + JobId = jobId; + MinVersion = minVersion; + Retain = retain; + SnapshotDocCount = snapshotDocCount; + SnapshotId = snapshotId; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public ModelSnapshot() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ModelSnapshot() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModelSnapshot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An optional description of the job. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// A numerical character string that uniquely identifies the job that the snapshot was created for. /// /// - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } /// /// /// The timestamp of the latest processed record. /// /// - [JsonInclude, JsonPropertyName("latest_record_time_stamp")] - public int? LatestRecordTimeStamp { get; init; } + public int? LatestRecordTimeStamp { get; set; } /// /// /// The timestamp of the latest bucket result. /// /// - [JsonInclude, JsonPropertyName("latest_result_time_stamp")] - public int? LatestResultTimeStamp { get; init; } + public int? LatestResultTimeStamp { get; set; } /// /// /// The minimum version required to be able to restore the model snapshot. /// /// - [JsonInclude, JsonPropertyName("min_version")] - public string MinVersion { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string MinVersion { get; set; } /// /// /// Summary information describing the model. /// /// - [JsonInclude, JsonPropertyName("model_size_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats? ModelSizeStats { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelSizeStats? ModelSizeStats { get; set; } /// /// /// If true, this snapshot will not be deleted during automatic cleanup of snapshots older than model_snapshot_retention_days. However, this snapshot will be deleted when the job is deleted. The default value is false. /// /// - [JsonInclude, JsonPropertyName("retain")] - public bool Retain { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Retain { get; set; } /// /// /// For internal use only. /// /// - [JsonInclude, JsonPropertyName("snapshot_doc_count")] - public long SnapshotDocCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long SnapshotDocCount { get; set; } /// /// /// A numerical character string that uniquely identifies the model snapshot. /// /// - [JsonInclude, JsonPropertyName("snapshot_id")] - public string SnapshotId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string SnapshotId { get; set; } /// /// /// The creation timestamp for the snapshot. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshotUpgrade.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshotUpgrade.g.cs index 289fbe89638..0e8421a6bcb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshotUpgrade.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ModelSnapshotUpgrade.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ModelSnapshotUpgradeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAssignmentExplanation = System.Text.Json.JsonEncodedText.Encode("assignment_explanation"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshotId = System.Text.Json.JsonEncodedText.Encode("snapshot_id"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshotUpgrade Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAssignmentExplanation = default; + LocalJsonValue propJobId = default; + LocalJsonValue> propNode = default; + LocalJsonValue propSnapshotId = default; + LocalJsonValue propState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAssignmentExplanation.TryReadProperty(ref reader, options, PropAssignmentExplanation, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null))) + { + continue; + } + + if (propSnapshotId.TryReadProperty(ref reader, options, PropSnapshotId, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshotUpgrade(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AssignmentExplanation = propAssignmentExplanation.Value, + JobId = propJobId.Value, + Node = propNode.Value, + SnapshotId = propSnapshotId.Value, + State = propState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshotUpgrade value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAssignmentExplanation, value.AssignmentExplanation, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null)); + writer.WriteProperty(options, PropSnapshotId, value.SnapshotId, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ModelSnapshotUpgradeConverter))] public sealed partial class ModelSnapshotUpgrade { - [JsonInclude, JsonPropertyName("assignment_explanation")] - public string AssignmentExplanation { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("node")] - public KeyValuePair Node { get; init; } - [JsonInclude, JsonPropertyName("snapshot_id")] - public string SnapshotId { get; init; } - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState State { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelSnapshotUpgrade(string assignmentExplanation, string jobId, System.Collections.Generic.KeyValuePair node, string snapshotId, Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState state) + { + AssignmentExplanation = assignmentExplanation; + JobId = jobId; + Node = node; + SnapshotId = snapshotId; + State = state; + } +#if NET7_0_OR_GREATER + public ModelSnapshotUpgrade() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ModelSnapshotUpgrade() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ModelSnapshotUpgrade(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string AssignmentExplanation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.KeyValuePair Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string SnapshotId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.SnapshotUpgradeState State { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NativeCode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NativeCode.g.cs index 8b41fbba4a0..0e35401c319 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NativeCode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NativeCode.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NativeCodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuildHash = System.Text.Json.JsonEncodedText.Encode("build_hash"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NativeCode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuildHash = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuildHash.TryReadProperty(ref reader, options, PropBuildHash, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NativeCode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BuildHash = propBuildHash.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NativeCode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuildHash, value.BuildHash, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NativeCodeConverter))] public sealed partial class NativeCode { - [JsonInclude, JsonPropertyName("build_hash")] - public string BuildHash { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NativeCode(string buildHash, string version) + { + BuildHash = buildHash; + Version = version; + } +#if NET7_0_OR_GREATER + public NativeCode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NativeCode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NativeCode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string BuildHash { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceOptions.g.cs index 23a58807b46..daa75ea4f80 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceOptions.g.cs @@ -17,37 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NerInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClassificationLabels = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassificationLabels = propClassificationLabels.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Named entity recognition options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsConverter))] public sealed partial class NerInferenceOptions { +#if NET7_0_OR_GREATER + public NerInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public NerInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NerInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The token classification labels. Must be IOB formatted tags /// /// - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection? ClassificationLabels { get; set; } + public System.Collections.Generic.ICollection? ClassificationLabels { get; set; } /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -55,12 +132,8 @@ public sealed partial class NerInferenceOptions /// The tokenization options /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - [JsonInclude, JsonPropertyName("vocabulary")] public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? Vocabulary { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(NerInferenceOptions nerInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.Ner(nerInferenceOptions); } /// @@ -68,145 +141,102 @@ public sealed partial class NerInferenceOptions /// Named entity recognition options /// /// -public sealed partial class NerInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct NerInferenceOptionsDescriptor { - internal NerInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NerInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions instance) + { + Instance = instance; + } - public NerInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NerInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ClassificationLabelsValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? VocabularyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor VocabularyDescriptor { get; set; } - private Action VocabularyDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The token classification labels. Must be IOB formatted tags /// /// - public NerInferenceOptionsDescriptor ClassificationLabels(ICollection? classificationLabels) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor ClassificationLabels(System.Collections.Generic.ICollection? value) { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance.ClassificationLabels = value; + return this; } /// /// - /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. + /// The token classification labels. Must be IOB formatted tags /// /// - public NerInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor ClassificationLabels(params string[] values) { - ResultsFieldValue = resultsField; - return Self; + Instance.ClassificationLabels = [.. values]; + return this; } /// /// - /// The tokenization options + /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public NerInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor ResultsField(string? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.ResultsField = value; + return this; } - public NerInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public NerInferenceOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = value; + return this; } - public NerInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? vocabulary) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor Tokenization(System.Action action) { - VocabularyDescriptor = null; - VocabularyDescriptorAction = null; - VocabularyValue = vocabulary; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public NerInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? value) { - VocabularyValue = null; - VocabularyDescriptorAction = null; - VocabularyDescriptor = descriptor; - return Self; + Instance.Vocabulary = value; + return this; } - public NerInferenceOptionsDescriptor Vocabulary(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor Vocabulary(System.Action action) { - VocabularyValue = null; - VocabularyDescriptor = null; - VocabularyDescriptorAction = configure; - return Self; + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (ClassificationLabelsValue is not null) - { - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) + if (action is null) { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (VocabularyDescriptor is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyDescriptor, options); - } - else if (VocabularyDescriptorAction is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(VocabularyDescriptorAction), options); - } - else if (VocabularyValue is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceUpdateOptions.g.cs index 2e91e884414..e0f016b3fb8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NerInferenceUpdateOptions.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NerInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsConverter))] public sealed partial class NerInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public NerInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public NerInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -42,34 +102,37 @@ public sealed partial class NerInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(NerInferenceUpdateOptions nerInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.Ner(nerInferenceUpdateOptions); } -public sealed partial class NerInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct NerInferenceUpdateOptionsDescriptor { - internal NerInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NerInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions instance) + { + Instance = instance; + } - public NerInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NerInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public NerInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -77,55 +140,44 @@ public NerInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) /// The tokenization options to update when inferring /// /// - public NerInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public NerInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public NerInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) + if (action is null) { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); + return new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.NerInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpBertTokenizationConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpBertTokenizationConfig.g.cs index 558ae372f55..2902d6e024e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpBertTokenizationConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpBertTokenizationConfig.g.cs @@ -17,29 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NlpBertTokenizationConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoLowerCase = System.Text.Json.JsonEncodedText.Encode("do_lower_case"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSequenceLength = System.Text.Json.JsonEncodedText.Encode("max_sequence_length"); + private static readonly System.Text.Json.JsonEncodedText PropSpan = System.Text.Json.JsonEncodedText.Encode("span"); + private static readonly System.Text.Json.JsonEncodedText PropTruncate = System.Text.Json.JsonEncodedText.Encode("truncate"); + private static readonly System.Text.Json.JsonEncodedText PropWithSpecialTokens = System.Text.Json.JsonEncodedText.Encode("with_special_tokens"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoLowerCase = default; + LocalJsonValue propMaxSequenceLength = default; + LocalJsonValue propSpan = default; + LocalJsonValue propTruncate = default; + LocalJsonValue propWithSpecialTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoLowerCase.TryReadProperty(ref reader, options, PropDoLowerCase, null)) + { + continue; + } + + if (propMaxSequenceLength.TryReadProperty(ref reader, options, PropMaxSequenceLength, null)) + { + continue; + } + + if (propSpan.TryReadProperty(ref reader, options, PropSpan, null)) + { + continue; + } + + if (propTruncate.TryReadProperty(ref reader, options, PropTruncate, null)) + { + continue; + } + + if (propWithSpecialTokens.TryReadProperty(ref reader, options, PropWithSpecialTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DoLowerCase = propDoLowerCase.Value, + MaxSequenceLength = propMaxSequenceLength.Value, + Span = propSpan.Value, + Truncate = propTruncate.Value, + WithSpecialTokens = propWithSpecialTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoLowerCase, value.DoLowerCase, null, null); + writer.WriteProperty(options, PropMaxSequenceLength, value.MaxSequenceLength, null, null); + writer.WriteProperty(options, PropSpan, value.Span, null, null); + writer.WriteProperty(options, PropTruncate, value.Truncate, null, null); + writer.WriteProperty(options, PropWithSpecialTokens, value.WithSpecialTokens, null, null); + writer.WriteEndObject(); + } +} + /// /// /// BERT and MPNet tokenization configuration options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigConverter))] public sealed partial class NlpBertTokenizationConfig { +#if NET7_0_OR_GREATER + public NlpBertTokenizationConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public NlpBertTokenizationConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Should the tokenizer lower case the text /// /// - [JsonInclude, JsonPropertyName("do_lower_case")] public bool? DoLowerCase { get; set; } /// @@ -47,7 +134,6 @@ public sealed partial class NlpBertTokenizationConfig /// Maximum input sequence length for the model /// /// - [JsonInclude, JsonPropertyName("max_sequence_length")] public int? MaxSequenceLength { get; set; } /// @@ -55,7 +141,6 @@ public sealed partial class NlpBertTokenizationConfig /// Tokenization spanning options. Special value of -1 indicates no spanning takes place /// /// - [JsonInclude, JsonPropertyName("span")] public int? Span { get; set; } /// @@ -63,7 +148,6 @@ public sealed partial class NlpBertTokenizationConfig /// Should tokenization input be automatically truncated before sending to the model for inference /// /// - [JsonInclude, JsonPropertyName("truncate")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? Truncate { get; set; } /// @@ -71,7 +155,6 @@ public sealed partial class NlpBertTokenizationConfig /// Is tokenization completed with special tokens /// /// - [JsonInclude, JsonPropertyName("with_special_tokens")] public bool? WithSpecialTokens { get; set; } } @@ -80,29 +163,34 @@ public sealed partial class NlpBertTokenizationConfig /// BERT and MPNet tokenization configuration options /// /// -public sealed partial class NlpBertTokenizationConfigDescriptor : SerializableDescriptor +public readonly partial struct NlpBertTokenizationConfigDescriptor { - internal NlpBertTokenizationConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpBertTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig instance) + { + Instance = instance; + } - public NlpBertTokenizationConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpBertTokenizationConfigDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? DoLowerCaseValue { get; set; } - private int? MaxSequenceLengthValue { get; set; } - private int? SpanValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? TruncateValue { get; set; } - private bool? WithSpecialTokensValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor descriptor) => descriptor.Instance; /// /// /// Should the tokenizer lower case the text /// /// - public NlpBertTokenizationConfigDescriptor DoLowerCase(bool? doLowerCase = true) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor DoLowerCase(bool? value = true) { - DoLowerCaseValue = doLowerCase; - return Self; + Instance.DoLowerCase = value; + return this; } /// @@ -110,10 +198,10 @@ public NlpBertTokenizationConfigDescriptor DoLowerCase(bool? doLowerCase = true) /// Maximum input sequence length for the model /// /// - public NlpBertTokenizationConfigDescriptor MaxSequenceLength(int? maxSequenceLength) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor MaxSequenceLength(int? value) { - MaxSequenceLengthValue = maxSequenceLength; - return Self; + Instance.MaxSequenceLength = value; + return this; } /// @@ -121,10 +209,10 @@ public NlpBertTokenizationConfigDescriptor MaxSequenceLength(int? maxSequenceLen /// Tokenization spanning options. Special value of -1 indicates no spanning takes place /// /// - public NlpBertTokenizationConfigDescriptor Span(int? span) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor Span(int? value) { - SpanValue = span; - return Self; + Instance.Span = value; + return this; } /// @@ -132,10 +220,10 @@ public NlpBertTokenizationConfigDescriptor Span(int? span) /// Should tokenization input be automatically truncated before sending to the model for inference /// /// - public NlpBertTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? truncate) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? value) { - TruncateValue = truncate; - return Self; + Instance.Truncate = value; + return this; } /// @@ -143,45 +231,22 @@ public NlpBertTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearc /// Is tokenization completed with special tokens /// /// - public NlpBertTokenizationConfigDescriptor WithSpecialTokens(bool? withSpecialTokens = true) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor WithSpecialTokens(bool? value = true) { - WithSpecialTokensValue = withSpecialTokens; - return Self; + Instance.WithSpecialTokens = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig Build(System.Action? action) { - writer.WriteStartObject(); - if (DoLowerCaseValue.HasValue) - { - writer.WritePropertyName("do_lower_case"); - writer.WriteBooleanValue(DoLowerCaseValue.Value); - } - - if (MaxSequenceLengthValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_sequence_length"); - writer.WriteNumberValue(MaxSequenceLengthValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SpanValue.HasValue) - { - writer.WritePropertyName("span"); - writer.WriteNumberValue(SpanValue.Value); - } - - if (TruncateValue is not null) - { - writer.WritePropertyName("truncate"); - JsonSerializer.Serialize(writer, TruncateValue, options); - } - - if (WithSpecialTokensValue.HasValue) - { - writer.WritePropertyName("with_special_tokens"); - writer.WriteBooleanValue(WithSpecialTokensValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpRobertaTokenizationConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpRobertaTokenizationConfig.g.cs index 5fbef7b055f..9aa5b04df80 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpRobertaTokenizationConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpRobertaTokenizationConfig.g.cs @@ -17,29 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NlpRobertaTokenizationConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAddPrefixSpace = System.Text.Json.JsonEncodedText.Encode("add_prefix_space"); + private static readonly System.Text.Json.JsonEncodedText PropDoLowerCase = System.Text.Json.JsonEncodedText.Encode("do_lower_case"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSequenceLength = System.Text.Json.JsonEncodedText.Encode("max_sequence_length"); + private static readonly System.Text.Json.JsonEncodedText PropSpan = System.Text.Json.JsonEncodedText.Encode("span"); + private static readonly System.Text.Json.JsonEncodedText PropTruncate = System.Text.Json.JsonEncodedText.Encode("truncate"); + private static readonly System.Text.Json.JsonEncodedText PropWithSpecialTokens = System.Text.Json.JsonEncodedText.Encode("with_special_tokens"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAddPrefixSpace = default; + LocalJsonValue propDoLowerCase = default; + LocalJsonValue propMaxSequenceLength = default; + LocalJsonValue propSpan = default; + LocalJsonValue propTruncate = default; + LocalJsonValue propWithSpecialTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAddPrefixSpace.TryReadProperty(ref reader, options, PropAddPrefixSpace, null)) + { + continue; + } + + if (propDoLowerCase.TryReadProperty(ref reader, options, PropDoLowerCase, null)) + { + continue; + } + + if (propMaxSequenceLength.TryReadProperty(ref reader, options, PropMaxSequenceLength, null)) + { + continue; + } + + if (propSpan.TryReadProperty(ref reader, options, PropSpan, null)) + { + continue; + } + + if (propTruncate.TryReadProperty(ref reader, options, PropTruncate, null)) + { + continue; + } + + if (propWithSpecialTokens.TryReadProperty(ref reader, options, PropWithSpecialTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AddPrefixSpace = propAddPrefixSpace.Value, + DoLowerCase = propDoLowerCase.Value, + MaxSequenceLength = propMaxSequenceLength.Value, + Span = propSpan.Value, + Truncate = propTruncate.Value, + WithSpecialTokens = propWithSpecialTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAddPrefixSpace, value.AddPrefixSpace, null, null); + writer.WriteProperty(options, PropDoLowerCase, value.DoLowerCase, null, null); + writer.WriteProperty(options, PropMaxSequenceLength, value.MaxSequenceLength, null, null); + writer.WriteProperty(options, PropSpan, value.Span, null, null); + writer.WriteProperty(options, PropTruncate, value.Truncate, null, null); + writer.WriteProperty(options, PropWithSpecialTokens, value.WithSpecialTokens, null, null); + writer.WriteEndObject(); + } +} + /// /// /// RoBERTa tokenization configuration options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigConverter))] public sealed partial class NlpRobertaTokenizationConfig { +#if NET7_0_OR_GREATER + public NlpRobertaTokenizationConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public NlpRobertaTokenizationConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Should the tokenizer prefix input with a space character /// /// - [JsonInclude, JsonPropertyName("add_prefix_space")] public bool? AddPrefixSpace { get; set; } /// @@ -47,7 +143,6 @@ public sealed partial class NlpRobertaTokenizationConfig /// Should the tokenizer lower case the text /// /// - [JsonInclude, JsonPropertyName("do_lower_case")] public bool? DoLowerCase { get; set; } /// @@ -55,7 +150,6 @@ public sealed partial class NlpRobertaTokenizationConfig /// Maximum input sequence length for the model /// /// - [JsonInclude, JsonPropertyName("max_sequence_length")] public int? MaxSequenceLength { get; set; } /// @@ -63,7 +157,6 @@ public sealed partial class NlpRobertaTokenizationConfig /// Tokenization spanning options. Special value of -1 indicates no spanning takes place /// /// - [JsonInclude, JsonPropertyName("span")] public int? Span { get; set; } /// @@ -71,7 +164,6 @@ public sealed partial class NlpRobertaTokenizationConfig /// Should tokenization input be automatically truncated before sending to the model for inference /// /// - [JsonInclude, JsonPropertyName("truncate")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? Truncate { get; set; } /// @@ -79,10 +171,7 @@ public sealed partial class NlpRobertaTokenizationConfig /// Is tokenization completed with special tokens /// /// - [JsonInclude, JsonPropertyName("with_special_tokens")] public bool? WithSpecialTokens { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(NlpRobertaTokenizationConfig nlpRobertaTokenizationConfig) => Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig.Roberta(nlpRobertaTokenizationConfig); } /// @@ -90,30 +179,34 @@ public sealed partial class NlpRobertaTokenizationConfig /// RoBERTa tokenization configuration options /// /// -public sealed partial class NlpRobertaTokenizationConfigDescriptor : SerializableDescriptor +public readonly partial struct NlpRobertaTokenizationConfigDescriptor { - internal NlpRobertaTokenizationConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig Instance { get; init; } - public NlpRobertaTokenizationConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpRobertaTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig instance) { + Instance = instance; } - private bool? AddPrefixSpaceValue { get; set; } - private bool? DoLowerCaseValue { get; set; } - private int? MaxSequenceLengthValue { get; set; } - private int? SpanValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? TruncateValue { get; set; } - private bool? WithSpecialTokensValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpRobertaTokenizationConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor descriptor) => descriptor.Instance; /// /// /// Should the tokenizer prefix input with a space character /// /// - public NlpRobertaTokenizationConfigDescriptor AddPrefixSpace(bool? addPrefixSpace = true) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor AddPrefixSpace(bool? value = true) { - AddPrefixSpaceValue = addPrefixSpace; - return Self; + Instance.AddPrefixSpace = value; + return this; } /// @@ -121,10 +214,10 @@ public NlpRobertaTokenizationConfigDescriptor AddPrefixSpace(bool? addPrefixSpac /// Should the tokenizer lower case the text /// /// - public NlpRobertaTokenizationConfigDescriptor DoLowerCase(bool? doLowerCase = true) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor DoLowerCase(bool? value = true) { - DoLowerCaseValue = doLowerCase; - return Self; + Instance.DoLowerCase = value; + return this; } /// @@ -132,10 +225,10 @@ public NlpRobertaTokenizationConfigDescriptor DoLowerCase(bool? doLowerCase = tr /// Maximum input sequence length for the model /// /// - public NlpRobertaTokenizationConfigDescriptor MaxSequenceLength(int? maxSequenceLength) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor MaxSequenceLength(int? value) { - MaxSequenceLengthValue = maxSequenceLength; - return Self; + Instance.MaxSequenceLength = value; + return this; } /// @@ -143,10 +236,10 @@ public NlpRobertaTokenizationConfigDescriptor MaxSequenceLength(int? maxSequence /// Tokenization spanning options. Special value of -1 indicates no spanning takes place /// /// - public NlpRobertaTokenizationConfigDescriptor Span(int? span) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor Span(int? value) { - SpanValue = span; - return Self; + Instance.Span = value; + return this; } /// @@ -154,10 +247,10 @@ public NlpRobertaTokenizationConfigDescriptor Span(int? span) /// Should tokenization input be automatically truncated before sending to the model for inference /// /// - public NlpRobertaTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? truncate) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? value) { - TruncateValue = truncate; - return Self; + Instance.Truncate = value; + return this; } /// @@ -165,51 +258,22 @@ public NlpRobertaTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticse /// Is tokenization completed with special tokens /// /// - public NlpRobertaTokenizationConfigDescriptor WithSpecialTokens(bool? withSpecialTokens = true) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor WithSpecialTokens(bool? value = true) { - WithSpecialTokensValue = withSpecialTokens; - return Self; + Instance.WithSpecialTokens = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig Build(System.Action? action) { - writer.WriteStartObject(); - if (AddPrefixSpaceValue.HasValue) - { - writer.WritePropertyName("add_prefix_space"); - writer.WriteBooleanValue(AddPrefixSpaceValue.Value); - } - - if (DoLowerCaseValue.HasValue) + if (action is null) { - writer.WritePropertyName("do_lower_case"); - writer.WriteBooleanValue(DoLowerCaseValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MaxSequenceLengthValue.HasValue) - { - writer.WritePropertyName("max_sequence_length"); - writer.WriteNumberValue(MaxSequenceLengthValue.Value); - } - - if (SpanValue.HasValue) - { - writer.WritePropertyName("span"); - writer.WriteNumberValue(SpanValue.Value); - } - - if (TruncateValue is not null) - { - writer.WritePropertyName("truncate"); - JsonSerializer.Serialize(writer, TruncateValue, options); - } - - if (WithSpecialTokensValue.HasValue) - { - writer.WritePropertyName("with_special_tokens"); - writer.WriteBooleanValue(WithSpecialTokensValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpTokenizationUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpTokenizationUpdateOptions.g.cs index 35b07f64f17..a664c82e64f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpTokenizationUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/NlpTokenizationUpdateOptions.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class NlpTokenizationUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSpan = System.Text.Json.JsonEncodedText.Encode("span"); + private static readonly System.Text.Json.JsonEncodedText PropTruncate = System.Text.Json.JsonEncodedText.Encode("truncate"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSpan = default; + LocalJsonValue propTruncate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSpan.TryReadProperty(ref reader, options, PropSpan, null)) + { + continue; + } + + if (propTruncate.TryReadProperty(ref reader, options, PropTruncate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Span = propSpan.Value, + Truncate = propTruncate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSpan, value.Span, null, null); + writer.WriteProperty(options, PropTruncate, value.Truncate, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsConverter))] public sealed partial class NlpTokenizationUpdateOptions { +#if NET7_0_OR_GREATER + public NlpTokenizationUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public NlpTokenizationUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Span options to apply /// /// - [JsonInclude, JsonPropertyName("span")] public int? Span { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class NlpTokenizationUpdateOptions /// Truncate options to apply /// /// - [JsonInclude, JsonPropertyName("truncate")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? Truncate { get; set; } } -public sealed partial class NlpTokenizationUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct NlpTokenizationUpdateOptionsDescriptor { - internal NlpTokenizationUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions Instance { get; init; } - public NlpTokenizationUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpTokenizationUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions instance) { + Instance = instance; } - private int? SpanValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? TruncateValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NlpTokenizationUpdateOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// Span options to apply /// /// - public NlpTokenizationUpdateOptionsDescriptor Span(int? span) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor Span(int? value) { - SpanValue = span; - return Self; + Instance.Span = value; + return this; } /// @@ -73,27 +140,22 @@ public NlpTokenizationUpdateOptionsDescriptor Span(int? span) /// Truncate options to apply /// /// - public NlpTokenizationUpdateOptionsDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? truncate) + public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? value) { - TruncateValue = truncate; - return Self; + Instance.Truncate = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (SpanValue.HasValue) + if (action is null) { - writer.WritePropertyName("span"); - writer.WriteNumberValue(SpanValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TruncateValue is not null) - { - writer.WritePropertyName("truncate"); - JsonSerializer.Serialize(writer, TruncateValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OneHotEncodingPreprocessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OneHotEncodingPreprocessor.g.cs index 0b3439fe854..5d1a99a4b77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OneHotEncodingPreprocessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OneHotEncodingPreprocessor.g.cs @@ -17,56 +17,153 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class OneHotEncodingPreprocessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropHotMap = System.Text.Json.JsonEncodedText.Encode("hot_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue> propHotMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propHotMap.TryReadProperty(ref reader, options, PropHotMap, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + HotMap = propHotMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropHotMap, value.HotMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorConverter))] public sealed partial class OneHotEncodingPreprocessor { - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } - [JsonInclude, JsonPropertyName("hot_map")] - public IDictionary HotMap { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OneHotEncodingPreprocessor(string field, System.Collections.Generic.IDictionary hotMap) + { + Field = field; + HotMap = hotMap; + } +#if NET7_0_OR_GREATER + public OneHotEncodingPreprocessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OneHotEncodingPreprocessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OneHotEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(OneHotEncodingPreprocessor oneHotEncodingPreprocessor) => Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor.OneHotEncoding(oneHotEncodingPreprocessor); + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary HotMap { get; set; } } -public sealed partial class OneHotEncodingPreprocessorDescriptor : SerializableDescriptor +public readonly partial struct OneHotEncodingPreprocessorDescriptor { - internal OneHotEncodingPreprocessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor Instance { get; init; } - public OneHotEncodingPreprocessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OneHotEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor instance) { + Instance = instance; } - private string FieldValue { get; set; } - private IDictionary HotMapValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OneHotEncodingPreprocessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor descriptor) => descriptor.Instance; - public OneHotEncodingPreprocessorDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public OneHotEncodingPreprocessorDescriptor HotMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor HotMap(System.Collections.Generic.IDictionary value) { - HotMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.HotMap = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor HotMap() { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - writer.WritePropertyName("hot_map"); - JsonSerializer.Serialize(writer, HotMapValue, options); - writer.WriteEndObject(); + Instance.HotMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor HotMap(System.Action? action) + { + Instance.HotMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor AddHotMap(string key, string value) + { + Instance.HotMap ??= new System.Collections.Generic.Dictionary(); + Instance.HotMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucket.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucket.g.cs index d68ea60d31a..a2152a3cf17 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucket.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucket.g.cs @@ -17,71 +17,205 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class OverallBucketConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBucketSpan = System.Text.Json.JsonEncodedText.Encode("bucket_span"); + private static readonly System.Text.Json.JsonEncodedText PropIsInterim = System.Text.Json.JsonEncodedText.Encode("is_interim"); + private static readonly System.Text.Json.JsonEncodedText PropJobs = System.Text.Json.JsonEncodedText.Encode("jobs"); + private static readonly System.Text.Json.JsonEncodedText PropOverallScore = System.Text.Json.JsonEncodedText.Encode("overall_score"); + private static readonly System.Text.Json.JsonEncodedText PropResultType = System.Text.Json.JsonEncodedText.Encode("result_type"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampString = System.Text.Json.JsonEncodedText.Encode("timestamp_string"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.OverallBucket Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBucketSpan = default; + LocalJsonValue propIsInterim = default; + LocalJsonValue> propJobs = default; + LocalJsonValue propOverallScore = default; + LocalJsonValue propResultType = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTimestampString = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBucketSpan.TryReadProperty(ref reader, options, PropBucketSpan, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker)))) + { + continue; + } + + if (propIsInterim.TryReadProperty(ref reader, options, PropIsInterim, null)) + { + continue; + } + + if (propJobs.TryReadProperty(ref reader, options, PropJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propOverallScore.TryReadProperty(ref reader, options, PropOverallScore, null)) + { + continue; + } + + if (propResultType.TryReadProperty(ref reader, options, PropResultType, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimestampString.TryReadProperty(ref reader, options, PropTimestampString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.OverallBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BucketSpan = propBucketSpan.Value, + IsInterim = propIsInterim.Value, + Jobs = propJobs.Value, + OverallScore = propOverallScore.Value, + ResultType = propResultType.Value, + Timestamp = propTimestamp.Value, + TimestampString = propTimestampString.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.OverallBucket value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBucketSpan, value.BucketSpan, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanSecondsMarker))); + writer.WriteProperty(options, PropIsInterim, value.IsInterim, null, null); + writer.WriteProperty(options, PropJobs, value.Jobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOverallScore, value.OverallScore, null, null); + writer.WriteProperty(options, PropResultType, value.ResultType, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimestampString, value.TimestampString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.OverallBucketConverter))] public sealed partial class OverallBucket { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OverallBucket(System.TimeSpan bucketSpan, bool isInterim, System.Collections.Generic.IReadOnlyCollection jobs, double overallScore, string resultType, System.DateTimeOffset timestamp) + { + BucketSpan = bucketSpan; + IsInterim = isInterim; + Jobs = jobs; + OverallScore = overallScore; + ResultType = resultType; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public OverallBucket() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OverallBucket() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OverallBucket(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The length of the bucket in seconds. Matches the job with the longest bucket_span value. /// /// - [JsonInclude, JsonPropertyName("bucket_span")] - public long BucketSpan { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan BucketSpan { get; set; } /// /// /// If true, this is an interim result. In other words, the results are calculated based on partial input data. /// /// - [JsonInclude, JsonPropertyName("is_interim")] - public bool IsInterim { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool IsInterim { get; set; } /// /// /// An array of objects that contain the max_anomaly_score per job_id. /// /// - [JsonInclude, JsonPropertyName("jobs")] - public IReadOnlyCollection Jobs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Jobs { get; set; } /// /// /// The top_n average of the maximum bucket anomaly_score per job. /// /// - [JsonInclude, JsonPropertyName("overall_score")] - public double OverallScore { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double OverallScore { get; set; } /// /// /// Internal. This is always set to overall_bucket. /// /// - [JsonInclude, JsonPropertyName("result_type")] - public string ResultType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ResultType { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } /// /// /// The start time of the bucket for which these results were calculated. /// /// - [JsonInclude, JsonPropertyName("timestamp_string")] - public DateTimeOffset? TimestampString { get; init; } + public System.DateTimeOffset? TimestampString { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucketJob.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucketJob.g.cs index b731902f3a7..24910e8eea6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucketJob.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/OverallBucketJob.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class OverallBucketJobConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAnomalyScore = System.Text.Json.JsonEncodedText.Encode("max_anomaly_score"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.OverallBucketJob Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propJobId = default; + LocalJsonValue propMaxAnomalyScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propMaxAnomalyScore.TryReadProperty(ref reader, options, PropMaxAnomalyScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.OverallBucketJob(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + JobId = propJobId.Value, + MaxAnomalyScore = propMaxAnomalyScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.OverallBucketJob value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropMaxAnomalyScore, value.MaxAnomalyScore, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.OverallBucketJobConverter))] public sealed partial class OverallBucketJob { - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("max_anomaly_score")] - public double MaxAnomalyScore { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OverallBucketJob(string jobId, double maxAnomalyScore) + { + JobId = jobId; + MaxAnomalyScore = maxAnomalyScore; + } +#if NET7_0_OR_GREATER + public OverallBucketJob() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public OverallBucketJob() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OverallBucketJob(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double MaxAnomalyScore { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Page.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Page.g.cs index 43f81ff7dce..50bc0409b47 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Page.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Page.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class PageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Page Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFrom = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Page(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + From = propFrom.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Page value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PageConverter))] public sealed partial class Page { +#if NET7_0_OR_GREATER + public Page() + { + } +#endif +#if !NET7_0_OR_GREATER + public Page() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Page(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Skips the specified number of items. /// /// - [JsonInclude, JsonPropertyName("from")] public int? From { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class Page /// Specifies the maximum number of items to obtain. /// /// - [JsonInclude, JsonPropertyName("size")] public int? Size { get; set; } } -public sealed partial class PageDescriptor : SerializableDescriptor +public readonly partial struct PageDescriptor { - internal PageDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Page Instance { get; init; } - public PageDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PageDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Page instance) { + Instance = instance; } - private int? FromValue { get; set; } - private int? SizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PageDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Page(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Page instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Page(Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor descriptor) => descriptor.Instance; /// /// /// Skips the specified number of items. /// /// - public PageDescriptor From(int? from) + public Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor From(int? value) { - FromValue = from; - return Self; + Instance.From = value; + return this; } /// @@ -73,27 +140,22 @@ public PageDescriptor From(int? from) /// Specifies the maximum number of items to obtain. /// /// - public PageDescriptor Size(int? size) + public Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor Size(int? value) { - SizeValue = size; - return Self; + Instance.Size = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Page Build(System.Action? action) { - writer.WriteStartObject(); - if (FromValue.HasValue) + if (action is null) { - writer.WritePropertyName("from"); - writer.WriteNumberValue(FromValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.Page(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SizeValue.HasValue) - { - writer.WritePropertyName("size"); - writer.WriteNumberValue(SizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PageDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Page(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceOptions.g.cs index 59ddfeeda9d..e83b0707138 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceOptions.g.cs @@ -17,29 +17,98 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class PassThroughInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Pass through configuration options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsConverter))] public sealed partial class PassThroughInferenceOptions { +#if NET7_0_OR_GREATER + public PassThroughInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public PassThroughInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -47,12 +116,8 @@ public sealed partial class PassThroughInferenceOptions /// The tokenization options /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - [JsonInclude, JsonPropertyName("vocabulary")] public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? Vocabulary { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(PassThroughInferenceOptions passThroughInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.PassThrough(passThroughInferenceOptions); } /// @@ -60,31 +125,34 @@ public sealed partial class PassThroughInferenceOptions /// Pass through configuration options /// /// -public sealed partial class PassThroughInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct PassThroughInferenceOptionsDescriptor { - internal PassThroughInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassThroughInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions instance) + { + Instance = instance; + } - public PassThroughInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassThroughInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? VocabularyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor VocabularyDescriptor { get; set; } - private Action VocabularyDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public PassThroughInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -92,95 +160,45 @@ public PassThroughInferenceOptionsDescriptor ResultsField(string? resultsField) /// The tokenization options /// /// - public PassThroughInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public PassThroughInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public PassThroughInferenceOptionsDescriptor Tokenization(Action configure) - { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; - } - - public PassThroughInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? vocabulary) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor Tokenization(System.Action action) { - VocabularyDescriptor = null; - VocabularyDescriptorAction = null; - VocabularyValue = vocabulary; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public PassThroughInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? value) { - VocabularyValue = null; - VocabularyDescriptorAction = null; - VocabularyDescriptor = descriptor; - return Self; + Instance.Vocabulary = value; + return this; } - public PassThroughInferenceOptionsDescriptor Vocabulary(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor Vocabulary(System.Action action) { - VocabularyValue = null; - VocabularyDescriptor = null; - VocabularyDescriptorAction = configure; - return Self; + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) + if (action is null) { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); + return new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - if (VocabularyDescriptor is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyDescriptor, options); - } - else if (VocabularyDescriptorAction is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(VocabularyDescriptorAction), options); - } - else if (VocabularyValue is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceUpdateOptions.g.cs index b06353c9a57..425f7cb9abe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PassThroughInferenceUpdateOptions.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class PassThroughInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsConverter))] public sealed partial class PassThroughInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public PassThroughInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public PassThroughInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -42,34 +102,37 @@ public sealed partial class PassThroughInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(PassThroughInferenceUpdateOptions passThroughInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.PassThrough(passThroughInferenceUpdateOptions); } -public sealed partial class PassThroughInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct PassThroughInferenceUpdateOptionsDescriptor { - internal PassThroughInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassThroughInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions instance) + { + Instance = instance; + } - public PassThroughInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassThroughInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public PassThroughInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -77,55 +140,44 @@ public PassThroughInferenceUpdateOptionsDescriptor ResultsField(string? resultsF /// The tokenization options to update when inferring /// /// - public PassThroughInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public PassThroughInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public PassThroughInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) + if (action is null) { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); + return new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PassThroughInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PerPartitionCategorization.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PerPartitionCategorization.g.cs index 027651a57dd..45fd29983cb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PerPartitionCategorization.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/PerPartitionCategorization.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class PerPartitionCategorizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropStopOnWarn = System.Text.Json.JsonEncodedText.Encode("stop_on_warn"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propStopOnWarn = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propStopOnWarn.TryReadProperty(ref reader, options, PropStopOnWarn, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + StopOnWarn = propStopOnWarn.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropStopOnWarn, value.StopOnWarn, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationConverter))] public sealed partial class PerPartitionCategorization { +#if NET7_0_OR_GREATER + public PerPartitionCategorization() + { + } +#endif +#if !NET7_0_OR_GREATER + public PerPartitionCategorization() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PerPartitionCategorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// To enable this setting, you must also set the partition_field_name property to the same value in every detector that uses the keyword mlcategory. Otherwise, job creation fails. /// /// - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class PerPartitionCategorization /// This setting can be set to true only if per-partition categorization is enabled. If true, both categorization and subsequent anomaly detection stops for partitions where the categorization status changes to warn. This setting makes it viable to have a job where it is expected that categorization works well for some partitions but not others; you do not pay the cost of bad categorization forever in the partitions where it works badly. /// /// - [JsonInclude, JsonPropertyName("stop_on_warn")] public bool? StopOnWarn { get; set; } } -public sealed partial class PerPartitionCategorizationDescriptor : SerializableDescriptor +public readonly partial struct PerPartitionCategorizationDescriptor { - internal PerPartitionCategorizationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization Instance { get; init; } - public PerPartitionCategorizationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PerPartitionCategorizationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization instance) { + Instance = instance; } - private bool? EnabledValue { get; set; } - private bool? StopOnWarnValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PerPartitionCategorizationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization(Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor descriptor) => descriptor.Instance; /// /// /// To enable this setting, you must also set the partition_field_name property to the same value in every detector that uses the keyword mlcategory. Otherwise, job creation fails. /// /// - public PerPartitionCategorizationDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } /// @@ -73,27 +140,22 @@ public PerPartitionCategorizationDescriptor Enabled(bool? enabled = true) /// This setting can be set to true only if per-partition categorization is enabled. If true, both categorization and subsequent anomaly detection stops for partitions where the categorization status changes to warn. This setting makes it viable to have a job where it is expected that categorization works well for some partitions but not others; you do not pay the cost of bad categorization forever in the partitions where it works badly. /// /// - public PerPartitionCategorizationDescriptor StopOnWarn(bool? stopOnWarn = true) + public Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor StopOnWarn(bool? value = true) { - StopOnWarnValue = stopOnWarn; - return Self; + Instance.StopOnWarn = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization Build(System.Action? action) { - writer.WriteStartObject(); - if (EnabledValue.HasValue) + if (action is null) { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StopOnWarnValue.HasValue) - { - writer.WritePropertyName("stop_on_warn"); - writer.WriteBooleanValue(StopOnWarnValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorizationDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.PerPartitionCategorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Preprocessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Preprocessor.g.cs index c20929f486d..3815ff3062e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Preprocessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Preprocessor.g.cs @@ -17,241 +17,198 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(PreprocessorConverter))] -public sealed partial class Preprocessor +internal sealed partial class PreprocessorConverter : System.Text.Json.Serialization.JsonConverter { - internal Preprocessor(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText VariantFrequencyEncoding = System.Text.Json.JsonEncodedText.Encode("frequency_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantOneHotEncoding = System.Text.Json.JsonEncodedText.Encode("one_hot_encoding"); + private static readonly System.Text.Json.JsonEncodedText VariantTargetMeanEncoding = System.Text.Json.JsonEncodedText.Encode("target_mean_encoding"); - public static Preprocessor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor frequencyEncodingPreprocessor) => new Preprocessor("frequency_encoding", frequencyEncodingPreprocessor); - public static Preprocessor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor oneHotEncodingPreprocessor) => new Preprocessor("one_hot_encoding", oneHotEncodingPreprocessor); - public static Preprocessor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor targetMeanEncodingPreprocessor) => new Preprocessor("target_mean_encoding", targetMeanEncodingPreprocessor); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class PreprocessorConverter : JsonConverter -{ - public override Preprocessor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantFrequencyEncoding)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantFrequencyEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "frequency_encoding") + if (reader.ValueTextEquals(VariantOneHotEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantOneHotEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "one_hot_encoding") + if (reader.ValueTextEquals(VariantTargetMeanEncoding)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTargetMeanEncoding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "target_mean_encoding") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Preprocessor' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Preprocessor(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Preprocessor value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "frequency_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor)value.Variant, options); - break; - case "one_hot_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor)value.Variant, options); - break; - case "target_mean_encoding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor)value.Variant, options); - break; - } + case null: + break; + case "frequency_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor)value.Variant, null, null); + break; + case "one_hot_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor)value.Variant, null, null); + break; + case "target_mean_encoding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor)}'."); } writer.WriteEndObject(); } } -public sealed partial class PreprocessorDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorConverter))] +public sealed partial class Preprocessor { - internal PreprocessorDescriptor(Action> configure) => configure.Invoke(this); - - public PreprocessorDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Preprocessor() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private PreprocessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public Preprocessor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private PreprocessorDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Preprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - public PreprocessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor frequencyEncodingPreprocessor) => Set(frequencyEncodingPreprocessor, "frequency_encoding"); - public PreprocessorDescriptor FrequencyEncoding(Action configure) => Set(configure, "frequency_encoding"); - public PreprocessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor oneHotEncodingPreprocessor) => Set(oneHotEncodingPreprocessor, "one_hot_encoding"); - public PreprocessorDescriptor OneHotEncoding(Action configure) => Set(configure, "one_hot_encoding"); - public PreprocessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor targetMeanEncodingPreprocessor) => Set(targetMeanEncodingPreprocessor, "target_mean_encoding"); - public PreprocessorDescriptor TargetMeanEncoding(Action configure) => Set(configure, "target_mean_encoding"); + public Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor? FrequencyEncoding { get => GetVariant("frequency_encoding"); set => SetVariant("frequency_encoding", value); } + public Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor? OneHotEncoding { get => GetVariant("one_hot_encoding"); set => SetVariant("one_hot_encoding", value); } + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor? TargetMeanEncoding { get => GetVariant("target_mean_encoding"); set => SetVariant("target_mean_encoding", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor value) => new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor { FrequencyEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor value) => new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor { OneHotEncoding = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor value) => new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor { TargetMeanEncoding = value }; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class PreprocessorDescriptor : SerializableDescriptor +public readonly partial struct PreprocessorDescriptor { - internal PreprocessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor Instance { get; init; } - public PreprocessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PreprocessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor? value) + { + Instance.FrequencyEncoding = value; + return this; + } - private PreprocessorDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor FrequencyEncoding(System.Action action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.FrequencyEncoding = Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessorDescriptor.Build(action); + return this; } - private PreprocessorDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.OneHotEncoding = value; + return this; } - public PreprocessorDescriptor FrequencyEncoding(Elastic.Clients.Elasticsearch.MachineLearning.FrequencyEncodingPreprocessor frequencyEncodingPreprocessor) => Set(frequencyEncodingPreprocessor, "frequency_encoding"); - public PreprocessorDescriptor FrequencyEncoding(Action configure) => Set(configure, "frequency_encoding"); - public PreprocessorDescriptor OneHotEncoding(Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessor oneHotEncodingPreprocessor) => Set(oneHotEncodingPreprocessor, "one_hot_encoding"); - public PreprocessorDescriptor OneHotEncoding(Action configure) => Set(configure, "one_hot_encoding"); - public PreprocessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor targetMeanEncodingPreprocessor) => Set(targetMeanEncodingPreprocessor, "target_mean_encoding"); - public PreprocessorDescriptor TargetMeanEncoding(Action configure) => Set(configure, "target_mean_encoding"); + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor OneHotEncoding(System.Action action) + { + Instance.OneHotEncoding = Elastic.Clients.Elasticsearch.MachineLearning.OneHotEncodingPreprocessorDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor TargetMeanEncoding(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.TargetMeanEncoding = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor TargetMeanEncoding(System.Action action) + { + Instance.TargetMeanEncoding = Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.PreprocessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QueryFeatureExtractor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QueryFeatureExtractor.g.cs new file mode 100644 index 00000000000..c1102a62db5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QueryFeatureExtractor.g.cs @@ -0,0 +1,230 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.MachineLearning; + +internal sealed partial class QueryFeatureExtractorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaultScore = System.Text.Json.JsonEncodedText.Encode("default_score"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefaultScore = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaultScore.TryReadProperty(ref reader, options, PropDefaultScore, null)) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DefaultScore = propDefaultScore.Value, + FeatureName = propFeatureName.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaultScore, value.DefaultScore, null, null); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorConverter))] +public sealed partial class QueryFeatureExtractor +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryFeatureExtractor(string featureName, Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + FeatureName = featureName; + Query = query; + } +#if NET7_0_OR_GREATER + public QueryFeatureExtractor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryFeatureExtractor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public float? DefaultScore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } +} + +public readonly partial struct QueryFeatureExtractorDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryFeatureExtractorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryFeatureExtractorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor DefaultScore(float? value) + { + Instance.DefaultScore = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor FeatureName(string value) + { + Instance.FeatureName = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) + { + Instance.Query = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct QueryFeatureExtractorDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryFeatureExtractorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryFeatureExtractorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor DefaultScore(float? value) + { + Instance.DefaultScore = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor FeatureName(string value) + { + Instance.FeatureName = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) + { + Instance.Query = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor Query(System.Action action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor Query(System.Action> action) + { + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.QueryFeatureExtractor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceOptions.g.cs index 6b03df7f95d..52636601311 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceOptions.g.cs @@ -17,29 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class QuestionAnsweringInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAnswerLength = System.Text.Json.JsonEncodedText.Encode("max_answer_length"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAnswerLength = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAnswerLength.TryReadProperty(ref reader, options, PropMaxAnswerLength, null)) + { + continue; + } + + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAnswerLength = propMaxAnswerLength.Value, + NumTopClasses = propNumTopClasses.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAnswerLength, value.MaxAnswerLength, null, null); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Question answering inference options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsConverter))] public sealed partial class QuestionAnsweringInferenceOptions { +#if NET7_0_OR_GREATER + public QuestionAnsweringInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public QuestionAnsweringInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum answer length to consider /// /// - [JsonInclude, JsonPropertyName("max_answer_length")] public int? MaxAnswerLength { get; set; } /// @@ -47,7 +125,6 @@ public sealed partial class QuestionAnsweringInferenceOptions /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -55,7 +132,6 @@ public sealed partial class QuestionAnsweringInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -63,10 +139,7 @@ public sealed partial class QuestionAnsweringInferenceOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(QuestionAnsweringInferenceOptions questionAnsweringInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.QuestionAnswering(questionAnsweringInferenceOptions); } /// @@ -74,30 +147,34 @@ public sealed partial class QuestionAnsweringInferenceOptions /// Question answering inference options /// /// -public sealed partial class QuestionAnsweringInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct QuestionAnsweringInferenceOptionsDescriptor { - internal QuestionAnsweringInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions Instance { get; init; } - public QuestionAnsweringInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QuestionAnsweringInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions instance) { + Instance = instance; } - private int? MaxAnswerLengthValue { get; set; } - private int? NumTopClassesValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QuestionAnsweringInferenceOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The maximum answer length to consider /// /// - public QuestionAnsweringInferenceOptionsDescriptor MaxAnswerLength(int? maxAnswerLength) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor MaxAnswerLength(int? value) { - MaxAnswerLengthValue = maxAnswerLength; - return Self; + Instance.MaxAnswerLength = value; + return this; } /// @@ -105,10 +182,10 @@ public QuestionAnsweringInferenceOptionsDescriptor MaxAnswerLength(int? maxAnswe /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public QuestionAnsweringInferenceOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -116,10 +193,10 @@ public QuestionAnsweringInferenceOptionsDescriptor NumTopClasses(int? numTopClas /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public QuestionAnsweringInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -127,67 +204,33 @@ public QuestionAnsweringInferenceOptionsDescriptor ResultsField(string? resultsF /// The tokenization options to update when inferring /// /// - public QuestionAnsweringInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public QuestionAnsweringInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public QuestionAnsweringInferenceOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor Tokenization(System.Action action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (MaxAnswerLengthValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_answer_length"); - writer.WriteNumberValue(MaxAnswerLengthValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceUpdateOptions.g.cs index 59ab9ece332..cfdcc7af759 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/QuestionAnsweringInferenceUpdateOptions.g.cs @@ -17,24 +17,117 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class QuestionAnsweringInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxAnswerLength = System.Text.Json.JsonEncodedText.Encode("max_answer_length"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropQuestion = System.Text.Json.JsonEncodedText.Encode("question"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxAnswerLength = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propQuestion = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxAnswerLength.TryReadProperty(ref reader, options, PropMaxAnswerLength, null)) + { + continue; + } + + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propQuestion.TryReadProperty(ref reader, options, PropQuestion, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxAnswerLength = propMaxAnswerLength.Value, + NumTopClasses = propNumTopClasses.Value, + Question = propQuestion.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxAnswerLength, value.MaxAnswerLength, null, null); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropQuestion, value.Question, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsConverter))] public sealed partial class QuestionAnsweringInferenceUpdateOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QuestionAnsweringInferenceUpdateOptions(string question) + { + Question = question; + } +#if NET7_0_OR_GREATER + public QuestionAnsweringInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QuestionAnsweringInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QuestionAnsweringInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum answer length to consider for extraction /// /// - [JsonInclude, JsonPropertyName("max_answer_length")] public int? MaxAnswerLength { get; set; } /// @@ -42,7 +135,6 @@ public sealed partial class QuestionAnsweringInferenceUpdateOptions /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -50,15 +142,17 @@ public sealed partial class QuestionAnsweringInferenceUpdateOptions /// The question to answer given the inference context /// /// - [JsonInclude, JsonPropertyName("question")] - public string Question { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Question { get; set; } /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -66,37 +160,37 @@ public sealed partial class QuestionAnsweringInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(QuestionAnsweringInferenceUpdateOptions questionAnsweringInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.QuestionAnswering(questionAnsweringInferenceUpdateOptions); } -public sealed partial class QuestionAnsweringInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct QuestionAnsweringInferenceUpdateOptionsDescriptor { - internal QuestionAnsweringInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QuestionAnsweringInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions instance) + { + Instance = instance; + } - public QuestionAnsweringInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QuestionAnsweringInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? MaxAnswerLengthValue { get; set; } - private int? NumTopClassesValue { get; set; } - private string QuestionValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The maximum answer length to consider for extraction /// /// - public QuestionAnsweringInferenceUpdateOptionsDescriptor MaxAnswerLength(int? maxAnswerLength) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor MaxAnswerLength(int? value) { - MaxAnswerLengthValue = maxAnswerLength; - return Self; + Instance.MaxAnswerLength = value; + return this; } /// @@ -104,10 +198,10 @@ public QuestionAnsweringInferenceUpdateOptionsDescriptor MaxAnswerLength(int? ma /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public QuestionAnsweringInferenceUpdateOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -115,10 +209,10 @@ public QuestionAnsweringInferenceUpdateOptionsDescriptor NumTopClasses(int? numT /// The question to answer given the inference context /// /// - public QuestionAnsweringInferenceUpdateOptionsDescriptor Question(string question) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor Question(string value) { - QuestionValue = question; - return Self; + Instance.Question = value; + return this; } /// @@ -126,10 +220,10 @@ public QuestionAnsweringInferenceUpdateOptionsDescriptor Question(string questio /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public QuestionAnsweringInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -137,69 +231,39 @@ public QuestionAnsweringInferenceUpdateOptionsDescriptor ResultsField(string? re /// The tokenization options to update when inferring /// /// - public QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions Build(System.Action action) { - writer.WriteStartObject(); - if (MaxAnswerLengthValue.HasValue) - { - writer.WritePropertyName("max_answer_length"); - writer.WriteNumberValue(MaxAnswerLengthValue.Value); - } - - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - writer.WritePropertyName("question"); - writer.WriteStringValue(QuestionValue); - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.QuestionAnsweringInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RegressionInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RegressionInferenceOptions.g.cs index 97fe7e673b3..fa3ef84e1d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RegressionInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RegressionInferenceOptions.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class RegressionInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumTopFeatureImportanceValues = System.Text.Json.JsonEncodedText.Encode("num_top_feature_importance_values"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumTopFeatureImportanceValues = default; + LocalJsonValue propResultsField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumTopFeatureImportanceValues.TryReadProperty(ref reader, options, PropNumTopFeatureImportanceValues, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumTopFeatureImportanceValues = propNumTopFeatureImportanceValues.Value, + ResultsField = propResultsField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumTopFeatureImportanceValues, value.NumTopFeatureImportanceValues, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsConverter))] public sealed partial class RegressionInferenceOptions { +#if NET7_0_OR_GREATER + public RegressionInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public RegressionInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the maximum number of feature importance values per document. /// /// - [JsonInclude, JsonPropertyName("num_top_feature_importance_values")] public int? NumTopFeatureImportanceValues { get; set; } /// @@ -42,45 +102,37 @@ public sealed partial class RegressionInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public Elastic.Clients.Elasticsearch.Field? ResultsField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig(RegressionInferenceOptions regressionInferenceOptions) => Elastic.Clients.Elasticsearch.Aggregations.InferenceConfig.Regression(regressionInferenceOptions); - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(RegressionInferenceOptions regressionInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.Regression(regressionInferenceOptions); - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(RegressionInferenceOptions regressionInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.Regression(regressionInferenceOptions); } -public sealed partial class RegressionInferenceOptionsDescriptor : SerializableDescriptor> +public readonly partial struct RegressionInferenceOptionsDescriptor { - internal RegressionInferenceOptionsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions Instance { get; init; } - public RegressionInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegressionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions instance) { + Instance = instance; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Specifies the maximum number of feature importance values per document. - /// - /// - public RegressionInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegressionInferenceOptionsDescriptor() { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. + /// Specifies the maximum number of feature importance values per document. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -88,10 +140,10 @@ public RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clie /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -99,62 +151,54 @@ public RegressionInferenceOptionsDescriptor ResultsField(Expr /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions Build(System.Action>? action) { - writer.WriteStartObject(); - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (ResultsFieldValue is not null) + if (action is null) { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RegressionInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct RegressionInferenceOptionsDescriptor { - internal RegressionInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions Instance { get; init; } - public RegressionInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegressionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions instance) { + Instance = instance; } - private int? NumTopFeatureImportanceValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? ResultsFieldValue { get; set; } - - /// - /// - /// Specifies the maximum number of feature importance values per document. - /// - /// - public RegressionInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? numTopFeatureImportanceValues) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegressionInferenceOptionsDescriptor() { - NumTopFeatureImportanceValuesValue = numTopFeatureImportanceValues; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor descriptor) => descriptor.Instance; + /// /// - /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. + /// Specifies the maximum number of feature importance values per document. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor NumTopFeatureImportanceValues(int? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.NumTopFeatureImportanceValues = value; + return this; } /// @@ -162,10 +206,10 @@ public RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clients.Elastic /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor ResultsField(Elastic.Clients.Elasticsearch.Field? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -173,27 +217,22 @@ public RegressionInferenceOptionsDescriptor ResultsField(Expr /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public RegressionInferenceOptionsDescriptor ResultsField(Expression> resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor ResultsField(System.Linq.Expressions.Expression> value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (NumTopFeatureImportanceValuesValue.HasValue) - { - writer.WritePropertyName("num_top_feature_importance_values"); - writer.WriteNumberValue(NumTopFeatureImportanceValuesValue.Value); - } - - if (ResultsFieldValue is not null) + if (action is null) { - writer.WritePropertyName("results_field"); - JsonSerializer.Serialize(writer, ResultsFieldValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.RegressionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RuleCondition.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RuleCondition.g.cs index 77554d4e4f8..c3e6436660c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RuleCondition.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RuleCondition.g.cs @@ -17,64 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class RuleConditionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAppliesTo = System.Text.Json.JsonEncodedText.Encode("applies_to"); + private static readonly System.Text.Json.JsonEncodedText PropOperator = System.Text.Json.JsonEncodedText.Encode("operator"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAppliesTo = default; + LocalJsonValue propOperator = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAppliesTo.TryReadProperty(ref reader, options, PropAppliesTo, null)) + { + continue; + } + + if (propOperator.TryReadProperty(ref reader, options, PropOperator, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AppliesTo = propAppliesTo.Value, + Operator = propOperator.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAppliesTo, value.AppliesTo, null, null); + writer.WriteProperty(options, PropOperator, value.Operator, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionConverter))] public sealed partial class RuleCondition { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleCondition(Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo appliesTo, Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator @operator, double value) + { + AppliesTo = appliesTo; + Operator = @operator; + Value = value; + } +#if NET7_0_OR_GREATER + public RuleCondition() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuleCondition() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuleCondition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the result property to which the condition applies. If your detector uses lat_long, metric, rare, or freq_rare functions, you can only specify conditions that apply to time. /// /// - [JsonInclude, JsonPropertyName("applies_to")] - public Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo AppliesTo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo AppliesTo { get; set; } /// /// /// Specifies the condition operator. The available options are greater than, greater than or equals, less than, and less than or equals. /// /// - [JsonInclude, JsonPropertyName("operator")] - public Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator Operator { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator Operator { get; set; } /// /// /// The value that is compared against the applies_to field using the operator. /// /// - [JsonInclude, JsonPropertyName("value")] - public double Value { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Value { get; set; } } -public sealed partial class RuleConditionDescriptor : SerializableDescriptor +public readonly partial struct RuleConditionDescriptor { - internal RuleConditionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleConditionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition instance) + { + Instance = instance; + } - public RuleConditionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleConditionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo AppliesToValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator OperatorValue { get; set; } - private double ValueValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition instance) => new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition(Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the result property to which the condition applies. If your detector uses lat_long, metric, rare, or freq_rare functions, you can only specify conditions that apply to time. /// /// - public RuleConditionDescriptor AppliesTo(Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo appliesTo) + public Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor AppliesTo(Elastic.Clients.Elasticsearch.MachineLearning.AppliesTo value) { - AppliesToValue = appliesTo; - return Self; + Instance.AppliesTo = value; + return this; } /// @@ -82,10 +176,10 @@ public RuleConditionDescriptor AppliesTo(Elastic.Clients.Elasticsearch.MachineLe /// Specifies the condition operator. The available options are greater than, greater than or equals, less than, and less than or equals. /// /// - public RuleConditionDescriptor Operator(Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator value) + public Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor Operator(Elastic.Clients.Elasticsearch.MachineLearning.ConditionOperator value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -93,21 +187,17 @@ public RuleConditionDescriptor Operator(Elastic.Clients.Elasticsearch.MachineLea /// The value that is compared against the applies_to field using the operator. /// /// - public RuleConditionDescriptor Value(double value) + public Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor Value(double value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("applies_to"); - JsonSerializer.Serialize(writer, AppliesToValue, options); - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - writer.WritePropertyName("value"); - writer.WriteNumberValue(ValueValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.RuleConditionDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.RuleCondition(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RunningStateSearchInterval.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RunningStateSearchInterval.g.cs index f551b5a9d8e..23ef4f07d8e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RunningStateSearchInterval.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/RunningStateSearchInterval.g.cs @@ -17,47 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class RunningStateSearchIntervalConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropEndMs = System.Text.Json.JsonEncodedText.Encode("end_ms"); + private static readonly System.Text.Json.JsonEncodedText PropStart = System.Text.Json.JsonEncodedText.Encode("start"); + private static readonly System.Text.Json.JsonEncodedText PropStartMs = System.Text.Json.JsonEncodedText.Encode("start_ms"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchInterval Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnd = default; + LocalJsonValue propEndMs = default; + LocalJsonValue propStart = default; + LocalJsonValue propStartMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnd.TryReadProperty(ref reader, options, PropEnd, null)) + { + continue; + } + + if (propEndMs.TryReadProperty(ref reader, options, PropEndMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propStart.TryReadProperty(ref reader, options, PropStart, null)) + { + continue; + } + + if (propStartMs.TryReadProperty(ref reader, options, PropStartMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchInterval(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + End = propEnd.Value, + EndMs = propEndMs.Value, + Start = propStart.Value, + StartMs = propStartMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchInterval value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnd, value.End, null, null); + writer.WriteProperty(options, PropEndMs, value.EndMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropStart, value.Start, null, null); + writer.WriteProperty(options, PropStartMs, value.StartMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.RunningStateSearchIntervalConverter))] public sealed partial class RunningStateSearchInterval { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RunningStateSearchInterval(System.TimeSpan endMs, System.TimeSpan startMs) + { + EndMs = endMs; + StartMs = startMs; + } +#if NET7_0_OR_GREATER + public RunningStateSearchInterval() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RunningStateSearchInterval() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RunningStateSearchInterval(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The end time. /// /// - [JsonInclude, JsonPropertyName("end")] - public Elastic.Clients.Elasticsearch.Duration? End { get; init; } + public Elastic.Clients.Elasticsearch.Duration? End { get; set; } /// /// /// The end time as an epoch in milliseconds. /// /// - [JsonInclude, JsonPropertyName("end_ms")] - public long EndMs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan EndMs { get; set; } /// /// /// The start time. /// /// - [JsonInclude, JsonPropertyName("start")] - public Elastic.Clients.Elasticsearch.Duration? Start { get; init; } + public Elastic.Clients.Elasticsearch.Duration? Start { get; set; } /// /// /// The start time as an epoch in milliseconds. /// /// - [JsonInclude, JsonPropertyName("start_ms")] - public long StartMs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan StartMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TargetMeanEncodingPreprocessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TargetMeanEncodingPreprocessor.g.cs index 6e46c48c41a..fd3dd5a0e1a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TargetMeanEncodingPreprocessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TargetMeanEncodingPreprocessor.g.cs @@ -17,78 +17,195 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TargetMeanEncodingPreprocessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaultValue = System.Text.Json.JsonEncodedText.Encode("default_value"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropTargetMap = System.Text.Json.JsonEncodedText.Encode("target_map"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefaultValue = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue propField = default; + LocalJsonValue> propTargetMap = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaultValue.TryReadProperty(ref reader, options, PropDefaultValue, null)) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propTargetMap.TryReadProperty(ref reader, options, PropTargetMap, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DefaultValue = propDefaultValue.Value, + FeatureName = propFeatureName.Value, + Field = propField.Value, + TargetMap = propTargetMap.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaultValue, value.DefaultValue, null, null); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropTargetMap, value.TargetMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorConverter))] public sealed partial class TargetMeanEncodingPreprocessor { - [JsonInclude, JsonPropertyName("default_value")] - public double DefaultValue { get; set; } - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; set; } - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } - [JsonInclude, JsonPropertyName("target_map")] - public IDictionary TargetMap { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor(TargetMeanEncodingPreprocessor targetMeanEncodingPreprocessor) => Elastic.Clients.Elasticsearch.MachineLearning.Preprocessor.TargetMeanEncoding(targetMeanEncodingPreprocessor); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TargetMeanEncodingPreprocessor(double defaultValue, string featureName, string field, System.Collections.Generic.IDictionary targetMap) + { + DefaultValue = defaultValue; + FeatureName = featureName; + Field = field; + TargetMap = targetMap; + } +#if NET7_0_OR_GREATER + public TargetMeanEncodingPreprocessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TargetMeanEncodingPreprocessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TargetMeanEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double DefaultValue { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary TargetMap { get; set; } } -public sealed partial class TargetMeanEncodingPreprocessorDescriptor : SerializableDescriptor +public readonly partial struct TargetMeanEncodingPreprocessorDescriptor { - internal TargetMeanEncodingPreprocessorDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor Instance { get; init; } - public TargetMeanEncodingPreprocessorDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TargetMeanEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor instance) { + Instance = instance; } - private double DefaultValueValue { get; set; } - private string FeatureNameValue { get; set; } - private string FieldValue { get; set; } - private IDictionary TargetMapValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TargetMeanEncodingPreprocessorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public TargetMeanEncodingPreprocessorDescriptor DefaultValue(double defaultValue) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor(Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor DefaultValue(double value) { - DefaultValueValue = defaultValue; - return Self; + Instance.DefaultValue = value; + return this; } - public TargetMeanEncodingPreprocessorDescriptor FeatureName(string featureName) + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor FeatureName(string value) { - FeatureNameValue = featureName; - return Self; + Instance.FeatureName = value; + return this; } - public TargetMeanEncodingPreprocessorDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TargetMeanEncodingPreprocessorDescriptor TargetMap(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor TargetMap(System.Collections.Generic.IDictionary value) { - TargetMapValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TargetMap = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor TargetMap() { - writer.WriteStartObject(); - writer.WritePropertyName("default_value"); - writer.WriteNumberValue(DefaultValueValue); - writer.WritePropertyName("feature_name"); - writer.WriteStringValue(FeatureNameValue); - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - writer.WritePropertyName("target_map"); - JsonSerializer.Serialize(writer, TargetMapValue, options); - writer.WriteEndObject(); + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor TargetMap(System.Action? action) + { + Instance.TargetMap = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringDouble.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor AddTargetMap(string key, double value) + { + Instance.TargetMap ??= new System.Collections.Generic.Dictionary(); + Instance.TargetMap.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessorDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TargetMeanEncodingPreprocessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceOptions.g.cs index 9532c4a0e49..1dd085b1cd1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceOptions.g.cs @@ -17,37 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextClassificationInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClassificationLabels = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassificationLabels = propClassificationLabels.Value, + NumTopClasses = propNumTopClasses.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Text classification configuration options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsConverter))] public sealed partial class TextClassificationInferenceOptions { +#if NET7_0_OR_GREATER + public TextClassificationInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextClassificationInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels /// /// - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection? ClassificationLabels { get; set; } + public System.Collections.Generic.ICollection? ClassificationLabels { get; set; } /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -55,7 +141,6 @@ public sealed partial class TextClassificationInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -63,10 +148,8 @@ public sealed partial class TextClassificationInferenceOptions /// The tokenization options /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(TextClassificationInferenceOptions textClassificationInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.TextClassification(textClassificationInferenceOptions); + public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? Vocabulary { get; set; } } /// @@ -74,30 +157,45 @@ public sealed partial class TextClassificationInferenceOptions /// Text classification configuration options /// /// -public sealed partial class TextClassificationInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextClassificationInferenceOptionsDescriptor { - internal TextClassificationInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions Instance { get; init; } - public TextClassificationInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions instance) { + Instance = instance; } - private ICollection? ClassificationLabelsValue { get; set; } - private int? NumTopClassesValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextClassificationInferenceOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor ClassificationLabels(System.Collections.Generic.ICollection? value) + { + Instance.ClassificationLabels = value; + return this; + } /// /// /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels /// /// - public TextClassificationInferenceOptionsDescriptor ClassificationLabels(ICollection? classificationLabels) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor ClassificationLabels(params string[] values) { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance.ClassificationLabels = [.. values]; + return this; } /// @@ -105,10 +203,10 @@ public TextClassificationInferenceOptionsDescriptor ClassificationLabels(ICollec /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public TextClassificationInferenceOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -116,10 +214,10 @@ public TextClassificationInferenceOptionsDescriptor NumTopClasses(int? numTopCla /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextClassificationInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -127,67 +225,45 @@ public TextClassificationInferenceOptionsDescriptor ResultsField(string? results /// The tokenization options /// /// - public TextClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor Tokenization(System.Action action) { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public TextClassificationInferenceOptionsDescriptor Tokenization(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary? value) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Vocabulary = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor Vocabulary(System.Action action) { - writer.WriteStartObject(); - if (ClassificationLabelsValue is not null) - { - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - } - - if (NumTopClassesValue.HasValue) - { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; + } - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceUpdateOptions.g.cs index d35725e43fe..2b8941efac8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextClassificationInferenceUpdateOptions.g.cs @@ -17,32 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextClassificationInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropNumTopClasses = System.Text.Json.JsonEncodedText.Encode("num_top_classes"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClassificationLabels = default; + LocalJsonValue propNumTopClasses = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNumTopClasses.TryReadProperty(ref reader, options, PropNumTopClasses, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassificationLabels = propClassificationLabels.Value, + NumTopClasses = propNumTopClasses.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNumTopClasses, value.NumTopClasses, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsConverter))] public sealed partial class TextClassificationInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public TextClassificationInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextClassificationInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels /// /// - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection? ClassificationLabels { get; set; } + public System.Collections.Generic.ICollection? ClassificationLabels { get; set; } /// /// /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - [JsonInclude, JsonPropertyName("num_top_classes")] public int? NumTopClasses { get; set; } /// @@ -50,7 +127,6 @@ public sealed partial class TextClassificationInferenceUpdateOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -58,36 +134,48 @@ public sealed partial class TextClassificationInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(TextClassificationInferenceUpdateOptions textClassificationInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.TextClassification(textClassificationInferenceUpdateOptions); } -public sealed partial class TextClassificationInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextClassificationInferenceUpdateOptionsDescriptor { - internal TextClassificationInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextClassificationInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions instance) + { + Instance = instance; + } - public TextClassificationInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextClassificationInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ClassificationLabelsValue { get; set; } - private int? NumTopClassesValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels /// /// - public TextClassificationInferenceUpdateOptionsDescriptor ClassificationLabels(ICollection? classificationLabels) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor ClassificationLabels(System.Collections.Generic.ICollection? value) { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance.ClassificationLabels = value; + return this; + } + + /// + /// + /// Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor ClassificationLabels(params string[] values) + { + Instance.ClassificationLabels = [.. values]; + return this; } /// @@ -95,10 +183,10 @@ public TextClassificationInferenceUpdateOptionsDescriptor ClassificationLabels(I /// Specifies the number of top class predictions to return. Defaults to 0. /// /// - public TextClassificationInferenceUpdateOptionsDescriptor NumTopClasses(int? numTopClasses) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor NumTopClasses(int? value) { - NumTopClassesValue = numTopClasses; - return Self; + Instance.NumTopClasses = value; + return this; } /// @@ -106,10 +194,10 @@ public TextClassificationInferenceUpdateOptionsDescriptor NumTopClasses(int? num /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextClassificationInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -117,67 +205,44 @@ public TextClassificationInferenceUpdateOptionsDescriptor ResultsField(string? r /// The tokenization options to update when inferring /// /// - public TextClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public TextClassificationInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (ClassificationLabelsValue is not null) - { - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - } - - if (NumTopClassesValue.HasValue) + if (action is null) { - writer.WritePropertyName("num_top_classes"); - writer.WriteNumberValue(NumTopClassesValue.Value); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceOptions.g.cs index 104024cca83..25437e0274c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceOptions.g.cs @@ -17,29 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextEmbeddingInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmbeddingSize = System.Text.Json.JsonEncodedText.Encode("embedding_size"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEmbeddingSize = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmbeddingSize.TryReadProperty(ref reader, options, PropEmbeddingSize, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EmbeddingSize = propEmbeddingSize.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmbeddingSize, value.EmbeddingSize, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Text embedding inference options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsConverter))] public sealed partial class TextEmbeddingInferenceOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + { + Vocabulary = vocabulary; + } +#if NET7_0_OR_GREATER + public TextEmbeddingInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextEmbeddingInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of dimensions in the embedding output /// /// - [JsonInclude, JsonPropertyName("embedding_size")] public int? EmbeddingSize { get; set; } /// @@ -47,7 +131,6 @@ public sealed partial class TextEmbeddingInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -55,12 +138,12 @@ public sealed partial class TextEmbeddingInferenceOptions /// The tokenization options /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - [JsonInclude, JsonPropertyName("vocabulary")] - public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(TextEmbeddingInferenceOptions textEmbeddingInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.TextEmbedding(textEmbeddingInferenceOptions); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } } /// @@ -68,32 +151,34 @@ public sealed partial class TextEmbeddingInferenceOptions /// Text embedding inference options /// /// -public sealed partial class TextEmbeddingInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextEmbeddingInferenceOptionsDescriptor { - internal TextEmbeddingInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions instance) + { + Instance = instance; + } - public TextEmbeddingInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? EmbeddingSizeValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary VocabularyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor VocabularyDescriptor { get; set; } - private Action VocabularyDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The number of dimensions in the embedding output /// /// - public TextEmbeddingInferenceOptionsDescriptor EmbeddingSize(int? embeddingSize) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor EmbeddingSize(int? value) { - EmbeddingSizeValue = embeddingSize; - return Self; + Instance.EmbeddingSize = value; + return this; } /// @@ -101,10 +186,10 @@ public TextEmbeddingInferenceOptionsDescriptor EmbeddingSize(int? embeddingSize) /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextEmbeddingInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -112,101 +197,40 @@ public TextEmbeddingInferenceOptionsDescriptor ResultsField(string? resultsField /// The tokenization options /// /// - public TextEmbeddingInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextEmbeddingInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public TextEmbeddingInferenceOptionsDescriptor Tokenization(Action configure) - { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; - } - - public TextEmbeddingInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor Tokenization(System.Action action) { - VocabularyDescriptor = null; - VocabularyDescriptorAction = null; - VocabularyValue = vocabulary; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public TextEmbeddingInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary value) { - VocabularyValue = null; - VocabularyDescriptorAction = null; - VocabularyDescriptor = descriptor; - return Self; + Instance.Vocabulary = value; + return this; } - public TextEmbeddingInferenceOptionsDescriptor Vocabulary(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor Vocabulary(System.Action action) { - VocabularyValue = null; - VocabularyDescriptor = null; - VocabularyDescriptorAction = configure; - return Self; + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions Build(System.Action action) { - writer.WriteStartObject(); - if (EmbeddingSizeValue.HasValue) - { - writer.WritePropertyName("embedding_size"); - writer.WriteNumberValue(EmbeddingSizeValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - if (VocabularyDescriptor is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyDescriptor, options); - } - else if (VocabularyDescriptorAction is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(VocabularyDescriptorAction), options); - } - else - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceUpdateOptions.g.cs index 0c7719ffe79..e784c8d0632 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextEmbeddingInferenceUpdateOptions.g.cs @@ -17,104 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextEmbeddingInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsConverter))] public sealed partial class TextEmbeddingInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public TextEmbeddingInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextEmbeddingInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(TextEmbeddingInferenceUpdateOptions textEmbeddingInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.TextEmbedding(textEmbeddingInferenceUpdateOptions); } -public sealed partial class TextEmbeddingInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextEmbeddingInferenceUpdateOptionsDescriptor { - internal TextEmbeddingInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions instance) + { + Instance = instance; + } - public TextEmbeddingInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextEmbeddingInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - public TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) + if (action is null) { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextEmbeddingInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceOptions.g.cs index 9f4c5398307..d88795f9b22 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceOptions.g.cs @@ -17,29 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextExpansionInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + private static readonly System.Text.Json.JsonEncodedText PropVocabulary = System.Text.Json.JsonEncodedText.Encode("vocabulary"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + LocalJsonValue propVocabulary = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (propVocabulary.TryReadProperty(ref reader, options, PropVocabulary, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value, + Vocabulary = propVocabulary.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteProperty(options, PropVocabulary, value.Vocabulary, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Text expansion inference options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsConverter))] public sealed partial class TextExpansionInferenceOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + { + Vocabulary = vocabulary; + } +#if NET7_0_OR_GREATER + public TextExpansionInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextExpansionInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -47,12 +122,12 @@ public sealed partial class TextExpansionInferenceOptions /// The tokenization options /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - [JsonInclude, JsonPropertyName("vocabulary")] - public Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(TextExpansionInferenceOptions textExpansionInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.TextExpansion(textExpansionInferenceOptions); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Vocabulary { get; set; } } /// @@ -60,31 +135,34 @@ public sealed partial class TextExpansionInferenceOptions /// Text expansion inference options /// /// -public sealed partial class TextExpansionInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextExpansionInferenceOptionsDescriptor { - internal TextExpansionInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions instance) + { + Instance = instance; + } - public TextExpansionInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary VocabularyValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor VocabularyDescriptor { get; set; } - private Action VocabularyDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextExpansionInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -92,95 +170,40 @@ public TextExpansionInferenceOptionsDescriptor ResultsField(string? resultsField /// The tokenization options /// /// - public TextExpansionInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextExpansionInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) - { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; - } - - public TextExpansionInferenceOptionsDescriptor Tokenization(Action configure) - { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; - } - - public TextExpansionInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary vocabulary) + /// + /// + /// The tokenization options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor Tokenization(System.Action action) { - VocabularyDescriptor = null; - VocabularyDescriptorAction = null; - VocabularyValue = vocabulary; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - public TextExpansionInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary value) { - VocabularyValue = null; - VocabularyDescriptorAction = null; - VocabularyDescriptor = descriptor; - return Self; + Instance.Vocabulary = value; + return this; } - public TextExpansionInferenceOptionsDescriptor Vocabulary(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor Vocabulary(System.Action action) { - VocabularyValue = null; - VocabularyDescriptor = null; - VocabularyDescriptorAction = configure; - return Self; + Instance.Vocabulary = Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - if (VocabularyDescriptor is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyDescriptor, options); - } - else if (VocabularyDescriptorAction is not null) - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(VocabularyDescriptorAction), options); - } - else - { - writer.WritePropertyName("vocabulary"); - JsonSerializer.Serialize(writer, VocabularyValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceUpdateOptions.g.cs index 033183f8f70..c6caa789bee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TextExpansionInferenceUpdateOptions.g.cs @@ -17,104 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TextExpansionInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsConverter))] public sealed partial class TextExpansionInferenceUpdateOptions { +#if NET7_0_OR_GREATER + public TextExpansionInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextExpansionInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(TextExpansionInferenceUpdateOptions textExpansionInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.TextExpansion(textExpansionInferenceUpdateOptions); } -public sealed partial class TextExpansionInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct TextExpansionInferenceUpdateOptionsDescriptor { - internal TextExpansionInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions instance) + { + Instance = instance; + } - public TextExpansionInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public TextExpansionInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } - public TextExpansionInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public TextExpansionInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public TextExpansionInferenceUpdateOptionsDescriptor Tokenization(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) + if (action is null) { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TextExpansionInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TokenizationConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TokenizationConfig.g.cs index e3dc630aebf..83e5ef67bab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TokenizationConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TokenizationConfig.g.cs @@ -17,261 +17,360 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; -/// -/// -/// Tokenization options stored in inference configuration -/// -/// -[JsonConverter(typeof(TokenizationConfigConverter))] -public sealed partial class TokenizationConfig +internal sealed partial class TokenizationConfigConverter : System.Text.Json.Serialization.JsonConverter { - internal TokenizationConfig(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static TokenizationConfig Bert(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => new TokenizationConfig("bert", nlpBertTokenizationConfig); - public static TokenizationConfig BertJa(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => new TokenizationConfig("bert_ja", nlpBertTokenizationConfig); - public static TokenizationConfig Mpnet(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => new TokenizationConfig("mpnet", nlpBertTokenizationConfig); - public static TokenizationConfig Roberta(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig nlpRobertaTokenizationConfig) => new TokenizationConfig("roberta", nlpRobertaTokenizationConfig); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } + private static readonly System.Text.Json.JsonEncodedText VariantBert = System.Text.Json.JsonEncodedText.Encode("bert"); + private static readonly System.Text.Json.JsonEncodedText VariantBertJa = System.Text.Json.JsonEncodedText.Encode("bert_ja"); + private static readonly System.Text.Json.JsonEncodedText VariantMpnet = System.Text.Json.JsonEncodedText.Encode("mpnet"); + private static readonly System.Text.Json.JsonEncodedText VariantRoberta = System.Text.Json.JsonEncodedText.Encode("roberta"); + private static readonly System.Text.Json.JsonEncodedText VariantXlmRoberta = System.Text.Json.JsonEncodedText.Encode("xlm_roberta"); - return false; - } -} - -internal sealed partial class TokenizationConfigConverter : JsonConverter -{ - public override TokenizationConfig Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBert)) { - throw new JsonException("Expected a property name token."); + variantType = VariantBert.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBertJa)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantBertJa.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "bert") + if (reader.ValueTextEquals(VariantMpnet)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMpnet.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "bert_ja") + if (reader.ValueTextEquals(VariantRoberta)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRoberta.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "mpnet") + if (reader.ValueTextEquals(VariantXlmRoberta)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantXlmRoberta.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "roberta") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'TokenizationConfig' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new TokenizationConfig(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, TokenizationConfig value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "bert": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, options); - break; - case "bert_ja": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, options); - break; - case "mpnet": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, options); - break; - case "roberta": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig)value.Variant, options); - break; - } + case null: + break; + case "bert": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, null, null); + break; + case "bert_ja": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, null, null); + break; + case "mpnet": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig)value.Variant, null, null); + break; + case "roberta": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig)value.Variant, null, null); + break; + case "xlm_roberta": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig)}'."); } writer.WriteEndObject(); } } -public sealed partial class TokenizationConfigDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigConverter))] +public sealed partial class TokenizationConfig { - internal TokenizationConfigDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public TokenizationConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public TokenizationConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public TokenizationConfigDescriptor() : base() + /// + /// + /// Indicates BERT tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? Bert { get => GetVariant("bert"); set => SetVariant("bert", value); } + + /// + /// + /// Indicates BERT Japanese tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? BertJa { get => GetVariant("bert_ja"); set => SetVariant("bert_ja", value); } + + /// + /// + /// Indicates MPNET tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? Mpnet { get => GetVariant("mpnet"); set => SetVariant("mpnet", value); } + + /// + /// + /// Indicates RoBERTa tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig? Roberta { get => GetVariant("roberta"); set => SetVariant("roberta", value); } + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig? XlmRoberta { get => GetVariant("xlm_roberta"); set => SetVariant("xlm_roberta", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig value) => new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig { Roberta = value }; + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig value) => new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig { XlmRoberta = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} + +public readonly partial struct TokenizationConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig Instance { get; init; } - private TokenizationConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private TokenizationConfigDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenizationConfigDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TokenizationConfigDescriptor Bert(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "bert"); - public TokenizationConfigDescriptor Bert(Action configure) => Set(configure, "bert"); - public TokenizationConfigDescriptor BertJa(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "bert_ja"); - public TokenizationConfigDescriptor BertJa(Action configure) => Set(configure, "bert_ja"); - public TokenizationConfigDescriptor Mpnet(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "mpnet"); - public TokenizationConfigDescriptor Mpnet(Action configure) => Set(configure, "mpnet"); - public TokenizationConfigDescriptor Roberta(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig nlpRobertaTokenizationConfig) => Set(nlpRobertaTokenizationConfig, "roberta"); - public TokenizationConfigDescriptor Roberta(Action configure) => Set(configure, "roberta"); + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Indicates BERT tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Bert(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Bert = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Indicates BERT tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Bert() + { + Instance.Bert = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Indicates BERT tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Bert(System.Action? action) + { + Instance.Bert = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(action); + return this; } -} -public sealed partial class TokenizationConfigDescriptor : SerializableDescriptor -{ - internal TokenizationConfigDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Indicates BERT Japanese tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor BertJa(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? value) + { + Instance.BertJa = value; + return this; + } - public TokenizationConfigDescriptor() : base() + /// + /// + /// Indicates BERT Japanese tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor BertJa() { + Instance.BertJa = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(null); + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Indicates BERT Japanese tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor BertJa(System.Action? action) + { + Instance.BertJa = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(action); + return this; + } - private TokenizationConfigDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Indicates MPNET tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Mpnet(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Mpnet = value; + return this; } - private TokenizationConfigDescriptor Set(object variant, string variantName) + /// + /// + /// Indicates MPNET tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Mpnet() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Mpnet = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(null); + return this; } - public TokenizationConfigDescriptor Bert(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "bert"); - public TokenizationConfigDescriptor Bert(Action configure) => Set(configure, "bert"); - public TokenizationConfigDescriptor BertJa(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "bert_ja"); - public TokenizationConfigDescriptor BertJa(Action configure) => Set(configure, "bert_ja"); - public TokenizationConfigDescriptor Mpnet(Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfig nlpBertTokenizationConfig) => Set(nlpBertTokenizationConfig, "mpnet"); - public TokenizationConfigDescriptor Mpnet(Action configure) => Set(configure, "mpnet"); - public TokenizationConfigDescriptor Roberta(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig nlpRobertaTokenizationConfig) => Set(nlpRobertaTokenizationConfig, "roberta"); - public TokenizationConfigDescriptor Roberta(Action configure) => Set(configure, "roberta"); + /// + /// + /// Indicates MPNET tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Mpnet(System.Action? action) + { + Instance.Mpnet = Elastic.Clients.Elasticsearch.MachineLearning.NlpBertTokenizationConfigDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Indicates RoBERTa tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Roberta(Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfig? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Roberta = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Indicates RoBERTa tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Roberta() + { + Instance.Roberta = Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Indicates RoBERTa tokenization and its options + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor Roberta(System.Action? action) + { + Instance.Roberta = Elastic.Clients.Elasticsearch.MachineLearning.NlpRobertaTokenizationConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor XlmRoberta(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig? value) + { + Instance.XlmRoberta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor XlmRoberta() + { + Instance.XlmRoberta = Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor XlmRoberta(System.Action? action) + { + Instance.XlmRoberta = Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TopClassEntry.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TopClassEntry.g.cs index 519dbf7dda1..0a519d8c330 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TopClassEntry.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TopClassEntry.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TopClassEntryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropClassProbability = System.Text.Json.JsonEncodedText.Encode("class_probability"); + private static readonly System.Text.Json.JsonEncodedText PropClassScore = System.Text.Json.JsonEncodedText.Encode("class_score"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TopClassEntry Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propClassProbability = default; + LocalJsonValue propClassScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propClassProbability.TryReadProperty(ref reader, options, PropClassProbability, null)) + { + continue; + } + + if (propClassScore.TryReadProperty(ref reader, options, PropClassScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TopClassEntry(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + ClassProbability = propClassProbability.Value, + ClassScore = propClassScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TopClassEntry value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropClassProbability, value.ClassProbability, null, null); + writer.WriteProperty(options, PropClassScore, value.ClassScore, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TopClassEntryConverter))] public sealed partial class TopClassEntry { - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } - [JsonInclude, JsonPropertyName("class_probability")] - public double ClassProbability { get; init; } - [JsonInclude, JsonPropertyName("class_score")] - public double ClassScore { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopClassEntry(string className, double classProbability, double classScore) + { + ClassName = className; + ClassProbability = classProbability; + ClassScore = classScore; + } +#if NET7_0_OR_GREATER + public TopClassEntry() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopClassEntry() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopClassEntry(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ClassProbability { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ClassScore { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportance.g.cs index 01bb1eae32d..411f0441b09 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportance.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TotalFeatureImportanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propClasses = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue> propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classes = propClasses.Value, + FeatureName = propFeatureName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceConverter))] public sealed partial class TotalFeatureImportance { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TotalFeatureImportance(System.Collections.Generic.IReadOnlyCollection classes, string featureName, System.Collections.Generic.IReadOnlyCollection importance) + { + Classes = classes; + FeatureName = featureName; + Importance = importance; + } +#if NET7_0_OR_GREATER + public TotalFeatureImportance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TotalFeatureImportance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TotalFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the trained model is a classification model, feature importance statistics are gathered per target class value. /// /// - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection Classes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Classes { get; set; } /// /// /// The feature for which this importance was calculated. /// /// - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } /// /// /// A collection of feature importance statistics related to the training data set for this particular feature. /// /// - [JsonInclude, JsonPropertyName("importance")] - public IReadOnlyCollection Importance { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceClass.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceClass.g.cs index c56d9982740..38bd0bebd1d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceClass.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceClass.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TotalFeatureImportanceClassConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceClass Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue> propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceClass(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceClass value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceClassConverter))] public sealed partial class TotalFeatureImportanceClass { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TotalFeatureImportanceClass(string className, System.Collections.Generic.IReadOnlyCollection importance) + { + ClassName = className; + Importance = importance; + } +#if NET7_0_OR_GREATER + public TotalFeatureImportanceClass() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TotalFeatureImportanceClass() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TotalFeatureImportanceClass(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The target class value. Could be a string, boolean, or number. /// /// - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } /// /// /// A collection of feature importance statistics related to the training data set for this particular feature. /// /// - [JsonInclude, JsonPropertyName("importance")] - public IReadOnlyCollection Importance { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceStatistics.g.cs index dfc44ddb0af..b2a4b23d729 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TotalFeatureImportanceStatistics.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TotalFeatureImportanceStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMeanMagnitude = System.Text.Json.JsonEncodedText.Encode("mean_magnitude"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMax = default; + LocalJsonValue propMeanMagnitude = default; + LocalJsonValue propMin = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMeanMagnitude.TryReadProperty(ref reader, options, PropMeanMagnitude, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Max = propMax.Value, + MeanMagnitude = propMeanMagnitude.Value, + Min = propMin.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMeanMagnitude, value.MeanMagnitude, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TotalFeatureImportanceStatisticsConverter))] public sealed partial class TotalFeatureImportanceStatistics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TotalFeatureImportanceStatistics(int max, double meanMagnitude, int min) + { + Max = max; + MeanMagnitude = meanMagnitude; + Min = min; + } +#if NET7_0_OR_GREATER + public TotalFeatureImportanceStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TotalFeatureImportanceStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TotalFeatureImportanceStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The maximum importance value across all the training data for this feature. /// /// - [JsonInclude, JsonPropertyName("max")] - public int Max { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Max { get; set; } /// /// /// The average magnitude of this feature across all the training data. This value is the average of the absolute values of the importance for this feature. /// /// - [JsonInclude, JsonPropertyName("mean_magnitude")] - public double MeanMagnitude { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + double MeanMagnitude { get; set; } /// /// /// The minimum importance value across all the training data for this feature. /// /// - [JsonInclude, JsonPropertyName("min")] - public int Min { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Min { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModel.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModel.g.cs index 51214bbbb67..cee0310e6fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModel.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModel.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnsemble = System.Text.Json.JsonEncodedText.Encode("ensemble"); + private static readonly System.Text.Json.JsonEncodedText PropTree = System.Text.Json.JsonEncodedText.Encode("tree"); + private static readonly System.Text.Json.JsonEncodedText PropTreeNode = System.Text.Json.JsonEncodedText.Encode("tree_node"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnsemble = default; + LocalJsonValue propTree = default; + LocalJsonValue propTreeNode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnsemble.TryReadProperty(ref reader, options, PropEnsemble, null)) + { + continue; + } + + if (propTree.TryReadProperty(ref reader, options, PropTree, null)) + { + continue; + } + + if (propTreeNode.TryReadProperty(ref reader, options, PropTreeNode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Ensemble = propEnsemble.Value, + Tree = propTree.Value, + TreeNode = propTreeNode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnsemble, value.Ensemble, null, null); + writer.WriteProperty(options, PropTree, value.Tree, null, null); + writer.WriteProperty(options, PropTreeNode, value.TreeNode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConverter))] public sealed partial class TrainedModel { +#if NET7_0_OR_GREATER + public TrainedModel() + { + } +#endif +#if !NET7_0_OR_GREATER + public TrainedModel() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The definition for an ensemble model /// /// - [JsonInclude, JsonPropertyName("ensemble")] public Elastic.Clients.Elasticsearch.MachineLearning.Ensemble? Ensemble { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class TrainedModel /// The definition for a binary decision tree. /// /// - [JsonInclude, JsonPropertyName("tree")] public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree? Tree { get; set; } /// @@ -63,55 +131,48 @@ public sealed partial class TrainedModel /// /// /// - [JsonInclude, JsonPropertyName("tree_node")] public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode? TreeNode { get; set; } } -public sealed partial class TrainedModelDescriptor : SerializableDescriptor +public readonly partial struct TrainedModelDescriptor { - internal TrainedModelDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel Instance { get; init; } - public TrainedModelDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.MachineLearning.Ensemble? EnsembleValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor EnsembleDescriptor { get; set; } - private Action EnsembleDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree? TreeValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor TreeDescriptor { get; set; } - private Action TreeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode? TreeNodeValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor TreeNodeDescriptor { get; set; } - private Action TreeNodeDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor descriptor) => descriptor.Instance; /// /// /// The definition for an ensemble model /// /// - public TrainedModelDescriptor Ensemble(Elastic.Clients.Elasticsearch.MachineLearning.Ensemble? ensemble) - { - EnsembleDescriptor = null; - EnsembleDescriptorAction = null; - EnsembleValue = ensemble; - return Self; - } - - public TrainedModelDescriptor Ensemble(Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor Ensemble(Elastic.Clients.Elasticsearch.MachineLearning.Ensemble? value) { - EnsembleValue = null; - EnsembleDescriptorAction = null; - EnsembleDescriptor = descriptor; - return Self; + Instance.Ensemble = value; + return this; } - public TrainedModelDescriptor Ensemble(Action configure) + /// + /// + /// The definition for an ensemble model + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor Ensemble(System.Action action) { - EnsembleValue = null; - EnsembleDescriptor = null; - EnsembleDescriptorAction = configure; - return Self; + Instance.Ensemble = Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor.Build(action); + return this; } /// @@ -119,28 +180,21 @@ public TrainedModelDescriptor Ensemble(Action /// - public TrainedModelDescriptor Tree(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree? tree) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor Tree(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree? value) { - TreeDescriptor = null; - TreeDescriptorAction = null; - TreeValue = tree; - return Self; + Instance.Tree = value; + return this; } - public TrainedModelDescriptor Tree(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor descriptor) - { - TreeValue = null; - TreeDescriptorAction = null; - TreeDescriptor = descriptor; - return Self; - } - - public TrainedModelDescriptor Tree(Action configure) + /// + /// + /// The definition for a binary decision tree. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor Tree(System.Action action) { - TreeValue = null; - TreeDescriptor = null; - TreeDescriptorAction = configure; - return Self; + Instance.Tree = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor.Build(action); + return this; } /// @@ -161,81 +215,46 @@ public TrainedModelDescriptor Tree(Action /// /// - public TrainedModelDescriptor TreeNode(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode? treeNode) - { - TreeNodeDescriptor = null; - TreeNodeDescriptorAction = null; - TreeNodeValue = treeNode; - return Self; - } - - public TrainedModelDescriptor TreeNode(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor TreeNode(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode? value) { - TreeNodeValue = null; - TreeNodeDescriptorAction = null; - TreeNodeDescriptor = descriptor; - return Self; + Instance.TreeNode = value; + return this; } - public TrainedModelDescriptor TreeNode(Action configure) + /// + /// + /// The definition of a node in a tree. + /// There are two major types of nodes: leaf nodes and not-leaf nodes. + /// + /// + /// + /// + /// Leaf nodes only need node_index and leaf_value defined. + /// + /// + /// + /// + /// All other nodes need split_feature, left_child, right_child, threshold, decision_type, and default_left defined. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor TreeNode(System.Action action) { - TreeNodeValue = null; - TreeNodeDescriptor = null; - TreeNodeDescriptorAction = configure; - return Self; + Instance.TreeNode = Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel Build(System.Action? action) { - writer.WriteStartObject(); - if (EnsembleDescriptor is not null) - { - writer.WritePropertyName("ensemble"); - JsonSerializer.Serialize(writer, EnsembleDescriptor, options); - } - else if (EnsembleDescriptorAction is not null) - { - writer.WritePropertyName("ensemble"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.EnsembleDescriptor(EnsembleDescriptorAction), options); - } - else if (EnsembleValue is not null) - { - writer.WritePropertyName("ensemble"); - JsonSerializer.Serialize(writer, EnsembleValue, options); - } - - if (TreeDescriptor is not null) - { - writer.WritePropertyName("tree"); - JsonSerializer.Serialize(writer, TreeDescriptor, options); - } - else if (TreeDescriptorAction is not null) - { - writer.WritePropertyName("tree"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor(TreeDescriptorAction), options); - } - else if (TreeValue is not null) + if (action is null) { - writer.WritePropertyName("tree"); - JsonSerializer.Serialize(writer, TreeValue, options); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TreeNodeDescriptor is not null) - { - writer.WritePropertyName("tree_node"); - JsonSerializer.Serialize(writer, TreeNodeDescriptor, options); - } - else if (TreeNodeDescriptorAction is not null) - { - writer.WritePropertyName("tree_node"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(TreeNodeDescriptorAction), options); - } - else if (TreeNodeValue is not null) - { - writer.WritePropertyName("tree_node"); - JsonSerializer.Serialize(writer, TreeNodeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModel(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignment.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignment.g.cs index d32ae7d74e4..4f995474ce2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignment.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignment.g.cs @@ -17,48 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelAssignmentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropAssignmentState = System.Text.Json.JsonEncodedText.Encode("assignment_state"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAssignedAllocations = System.Text.Json.JsonEncodedText.Encode("max_assigned_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingTable = System.Text.Json.JsonEncodedText.Encode("routing_table"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropTaskParameters = System.Text.Json.JsonEncodedText.Encode("task_parameters"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + LocalJsonValue propAssignmentState = default; + LocalJsonValue propMaxAssignedAllocations = default; + LocalJsonValue propReason = default; + LocalJsonValue> propRoutingTable = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propTaskParameters = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (propAssignmentState.TryReadProperty(ref reader, options, PropAssignmentState, null)) + { + continue; + } + + if (propMaxAssignedAllocations.TryReadProperty(ref reader, options, PropMaxAssignedAllocations, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRoutingTable.TryReadProperty(ref reader, options, PropRoutingTable, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propTaskParameters.TryReadProperty(ref reader, options, PropTaskParameters, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value, + AssignmentState = propAssignmentState.Value, + MaxAssignedAllocations = propMaxAssignedAllocations.Value, + Reason = propReason.Value, + RoutingTable = propRoutingTable.Value, + StartTime = propStartTime.Value, + TaskParameters = propTaskParameters.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteProperty(options, PropAssignmentState, value.AssignmentState, null, null); + writer.WriteProperty(options, PropMaxAssignedAllocations, value.MaxAssignedAllocations, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRoutingTable, value.RoutingTable, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropTaskParameters, value.TaskParameters, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentConverter))] public sealed partial class TrainedModelAssignment { - [JsonInclude, JsonPropertyName("adaptive_allocations")] - public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelAssignment(Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState assignmentState, System.Collections.Generic.IReadOnlyDictionary routingTable, System.DateTimeOffset startTime, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters taskParameters) + { + AssignmentState = assignmentState; + RoutingTable = routingTable; + StartTime = startTime; + TaskParameters = taskParameters; + } +#if NET7_0_OR_GREATER + public TrainedModelAssignment() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelAssignment() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelAssignment(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; set; } /// /// /// The overall assignment state. /// /// - [JsonInclude, JsonPropertyName("assignment_state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState AssignmentState { get; init; } - [JsonInclude, JsonPropertyName("max_assigned_allocations")] - public int? MaxAssignedAllocations { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState AssignmentState { get; set; } + public int? MaxAssignedAllocations { get; set; } + public string? Reason { get; set; } /// /// /// The allocation state for each node. /// /// - [JsonInclude, JsonPropertyName("routing_table")] - public IReadOnlyDictionary RoutingTable { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary RoutingTable { get; set; } /// /// /// The timestamp when the deployment started. /// /// - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset StartTime { get; init; } - [JsonInclude, JsonPropertyName("task_parameters")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters TaskParameters { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters TaskParameters { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingStateAndReason.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingStateAndReason.g.cs new file mode 100644 index 00000000000..30e32ed2df0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingStateAndReason.g.cs @@ -0,0 +1,117 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.MachineLearning; + +internal sealed partial class TrainedModelAssignmentRoutingStateAndReasonConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingState = System.Text.Json.JsonEncodedText.Encode("routing_state"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReason Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReason = default; + LocalJsonValue propRoutingState = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRoutingState.TryReadProperty(ref reader, options, PropRoutingState, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReason(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Reason = propReason.Value, + RoutingState = propRoutingState.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReason value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRoutingState, value.RoutingState, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReasonConverter))] +public sealed partial class TrainedModelAssignmentRoutingStateAndReason +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelAssignmentRoutingStateAndReason(Elastic.Clients.Elasticsearch.MachineLearning.RoutingState routingState) + { + RoutingState = routingState; + } +#if NET7_0_OR_GREATER + public TrainedModelAssignmentRoutingStateAndReason() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelAssignmentRoutingStateAndReason() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelAssignmentRoutingStateAndReason(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The reason for the current state. It is usually populated only when the + /// routing_state is failed. + /// + /// + public string? Reason { get; set; } + + /// + /// + /// The current routing state. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.RoutingState RoutingState { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingTable.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingTable.g.cs index c9dea667748..0d3f658d81c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingTable.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentRoutingTable.g.cs @@ -17,25 +17,115 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelAssignmentRoutingTableConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentAllocations = System.Text.Json.JsonEncodedText.Encode("current_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingState = System.Text.Json.JsonEncodedText.Encode("routing_state"); + private static readonly System.Text.Json.JsonEncodedText PropTargetAllocations = System.Text.Json.JsonEncodedText.Encode("target_allocations"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingTable Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentAllocations = default; + LocalJsonValue propReason = default; + LocalJsonValue propRoutingState = default; + LocalJsonValue propTargetAllocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentAllocations.TryReadProperty(ref reader, options, PropCurrentAllocations, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRoutingState.TryReadProperty(ref reader, options, PropRoutingState, null)) + { + continue; + } + + if (propTargetAllocations.TryReadProperty(ref reader, options, PropTargetAllocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingTable(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentAllocations = propCurrentAllocations.Value, + Reason = propReason.Value, + RoutingState = propRoutingState.Value, + TargetAllocations = propTargetAllocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingTable value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentAllocations, value.CurrentAllocations, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRoutingState, value.RoutingState, null, null); + writer.WriteProperty(options, PropTargetAllocations, value.TargetAllocations, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingTableConverter))] public sealed partial class TrainedModelAssignmentRoutingTable { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelAssignmentRoutingTable(int currentAllocations, Elastic.Clients.Elasticsearch.MachineLearning.RoutingState routingState, int targetAllocations) + { + CurrentAllocations = currentAllocations; + RoutingState = routingState; + TargetAllocations = targetAllocations; + } +#if NET7_0_OR_GREATER + public TrainedModelAssignmentRoutingTable() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelAssignmentRoutingTable() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelAssignmentRoutingTable(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Current number of allocations. /// /// - [JsonInclude, JsonPropertyName("current_allocations")] - public int CurrentAllocations { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int CurrentAllocations { get; set; } /// /// @@ -43,22 +133,27 @@ public sealed partial class TrainedModelAssignmentRoutingTable /// routing_state is failed. /// /// - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } + public string? Reason { get; set; } /// /// /// The current routing state. /// /// - [JsonInclude, JsonPropertyName("routing_state")] - public Elastic.Clients.Elasticsearch.MachineLearning.RoutingState RoutingState { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.RoutingState RoutingState { get; set; } /// /// /// Target number of allocations. /// /// - [JsonInclude, JsonPropertyName("target_allocations")] - public int TargetAllocations { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TargetAllocations { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentTaskParameters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentTaskParameters.g.cs index 7bcdb74834d..00748dbf6b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentTaskParameters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelAssignmentTaskParameters.g.cs @@ -17,77 +17,250 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelAssignmentTaskParametersConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheSize = System.Text.Json.JsonEncodedText.Encode("cache_size"); + private static readonly System.Text.Json.JsonEncodedText PropDeploymentId = System.Text.Json.JsonEncodedText.Encode("deployment_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelBytes = System.Text.Json.JsonEncodedText.Encode("model_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("number_of_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropPerAllocationMemoryBytes = System.Text.Json.JsonEncodedText.Encode("per_allocation_memory_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPerDeploymentMemoryBytes = System.Text.Json.JsonEncodedText.Encode("per_deployment_memory_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropQueueCapacity = System.Text.Json.JsonEncodedText.Encode("queue_capacity"); + private static readonly System.Text.Json.JsonEncodedText PropThreadsPerAllocation = System.Text.Json.JsonEncodedText.Encode("threads_per_allocation"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheSize = default; + LocalJsonValue propDeploymentId = default; + LocalJsonValue propModelBytes = default; + LocalJsonValue propModelId = default; + LocalJsonValue propNumberOfAllocations = default; + LocalJsonValue propPerAllocationMemoryBytes = default; + LocalJsonValue propPerDeploymentMemoryBytes = default; + LocalJsonValue propPriority = default; + LocalJsonValue propQueueCapacity = default; + LocalJsonValue propThreadsPerAllocation = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheSize.TryReadProperty(ref reader, options, PropCacheSize, null)) + { + continue; + } + + if (propDeploymentId.TryReadProperty(ref reader, options, PropDeploymentId, null)) + { + continue; + } + + if (propModelBytes.TryReadProperty(ref reader, options, PropModelBytes, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propNumberOfAllocations.TryReadProperty(ref reader, options, PropNumberOfAllocations, null)) + { + continue; + } + + if (propPerAllocationMemoryBytes.TryReadProperty(ref reader, options, PropPerAllocationMemoryBytes, null)) + { + continue; + } + + if (propPerDeploymentMemoryBytes.TryReadProperty(ref reader, options, PropPerDeploymentMemoryBytes, null)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propQueueCapacity.TryReadProperty(ref reader, options, PropQueueCapacity, null)) + { + continue; + } + + if (propThreadsPerAllocation.TryReadProperty(ref reader, options, PropThreadsPerAllocation, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheSize = propCacheSize.Value, + DeploymentId = propDeploymentId.Value, + ModelBytes = propModelBytes.Value, + ModelId = propModelId.Value, + NumberOfAllocations = propNumberOfAllocations.Value, + PerAllocationMemoryBytes = propPerAllocationMemoryBytes.Value, + PerDeploymentMemoryBytes = propPerDeploymentMemoryBytes.Value, + Priority = propPriority.Value, + QueueCapacity = propQueueCapacity.Value, + ThreadsPerAllocation = propThreadsPerAllocation.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParameters value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheSize, value.CacheSize, null, null); + writer.WriteProperty(options, PropDeploymentId, value.DeploymentId, null, null); + writer.WriteProperty(options, PropModelBytes, value.ModelBytes, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropNumberOfAllocations, value.NumberOfAllocations, null, null); + writer.WriteProperty(options, PropPerAllocationMemoryBytes, value.PerAllocationMemoryBytes, null, null); + writer.WriteProperty(options, PropPerDeploymentMemoryBytes, value.PerDeploymentMemoryBytes, null, null); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropQueueCapacity, value.QueueCapacity, null, null); + writer.WriteProperty(options, PropThreadsPerAllocation, value.ThreadsPerAllocation, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentTaskParametersConverter))] public sealed partial class TrainedModelAssignmentTaskParameters { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelAssignmentTaskParameters(string deploymentId, Elastic.Clients.Elasticsearch.ByteSize modelBytes, string modelId, int numberOfAllocations, Elastic.Clients.Elasticsearch.ByteSize perAllocationMemoryBytes, Elastic.Clients.Elasticsearch.ByteSize perDeploymentMemoryBytes, Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority priority, int queueCapacity, int threadsPerAllocation) + { + DeploymentId = deploymentId; + ModelBytes = modelBytes; + ModelId = modelId; + NumberOfAllocations = numberOfAllocations; + PerAllocationMemoryBytes = perAllocationMemoryBytes; + PerDeploymentMemoryBytes = perDeploymentMemoryBytes; + Priority = priority; + QueueCapacity = queueCapacity; + ThreadsPerAllocation = threadsPerAllocation; + } +#if NET7_0_OR_GREATER + public TrainedModelAssignmentTaskParameters() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelAssignmentTaskParameters() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelAssignmentTaskParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The size of the trained model cache. /// /// - [JsonInclude, JsonPropertyName("cache_size")] - public Elastic.Clients.Elasticsearch.ByteSize? CacheSize { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? CacheSize { get; set; } /// /// /// The unique identifier for the trained model deployment. /// /// - [JsonInclude, JsonPropertyName("deployment_id")] - public string DeploymentId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string DeploymentId { get; set; } /// /// /// The size of the trained model in bytes. /// /// - [JsonInclude, JsonPropertyName("model_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize ModelBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize ModelBytes { get; set; } /// /// /// The unique identifier for the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } /// /// /// The total number of allocations this model is assigned across ML nodes. /// /// - [JsonInclude, JsonPropertyName("number_of_allocations")] - public int NumberOfAllocations { get; init; } - [JsonInclude, JsonPropertyName("per_allocation_memory_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize PerAllocationMemoryBytes { get; init; } - [JsonInclude, JsonPropertyName("per_deployment_memory_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize PerDeploymentMemoryBytes { get; init; } - [JsonInclude, JsonPropertyName("priority")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority Priority { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumberOfAllocations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize PerAllocationMemoryBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize PerDeploymentMemoryBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority Priority { get; set; } /// /// /// Number of inference requests are allowed in the queue at a time. /// /// - [JsonInclude, JsonPropertyName("queue_capacity")] - public int QueueCapacity { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int QueueCapacity { get; set; } /// /// /// Number of threads per allocation. /// /// - [JsonInclude, JsonPropertyName("threads_per_allocation")] - public int ThreadsPerAllocation { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int ThreadsPerAllocation { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfig.g.cs index c1a941f530a..020a88aab20 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfig.g.cs @@ -17,146 +17,379 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompressedDefinition = System.Text.Json.JsonEncodedText.Encode("compressed_definition"); + private static readonly System.Text.Json.JsonEncodedText PropCreatedBy = System.Text.Json.JsonEncodedText.Encode("created_by"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultFieldMap = System.Text.Json.JsonEncodedText.Encode("default_field_map"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedHeapMemoryUsageBytes = System.Text.Json.JsonEncodedText.Encode("estimated_heap_memory_usage_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedOperations = System.Text.Json.JsonEncodedText.Encode("estimated_operations"); + private static readonly System.Text.Json.JsonEncodedText PropFullyDefined = System.Text.Json.JsonEncodedText.Encode("fully_defined"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceConfig = System.Text.Json.JsonEncodedText.Encode("inference_config"); + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropLicenseLevel = System.Text.Json.JsonEncodedText.Encode("license_level"); + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelPackage = System.Text.Json.JsonEncodedText.Encode("model_package"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeBytes = System.Text.Json.JsonEncodedText.Encode("model_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropModelType = System.Text.Json.JsonEncodedText.Encode("model_type"); + private static readonly System.Text.Json.JsonEncodedText PropPlatformArchitecture = System.Text.Json.JsonEncodedText.Encode("platform_architecture"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixStrings = System.Text.Json.JsonEncodedText.Encode("prefix_strings"); + private static readonly System.Text.Json.JsonEncodedText PropTags = System.Text.Json.JsonEncodedText.Encode("tags"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompressedDefinition = default; + LocalJsonValue propCreatedBy = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue?> propDefaultFieldMap = default; + LocalJsonValue propDescription = default; + LocalJsonValue propEstimatedHeapMemoryUsageBytes = default; + LocalJsonValue propEstimatedOperations = default; + LocalJsonValue propFullyDefined = default; + LocalJsonValue propInferenceConfig = default; + LocalJsonValue propInput = default; + LocalJsonValue propLicenseLevel = default; + LocalJsonValue propLocation = default; + LocalJsonValue propMetadata = default; + LocalJsonValue propModelId = default; + LocalJsonValue propModelPackage = default; + LocalJsonValue propModelSizeBytes = default; + LocalJsonValue propModelType = default; + LocalJsonValue propPlatformArchitecture = default; + LocalJsonValue propPrefixStrings = default; + LocalJsonValue> propTags = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompressedDefinition.TryReadProperty(ref reader, options, PropCompressedDefinition, null)) + { + continue; + } + + if (propCreatedBy.TryReadProperty(ref reader, options, PropCreatedBy, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propDefaultFieldMap.TryReadProperty(ref reader, options, PropDefaultFieldMap, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEstimatedHeapMemoryUsageBytes.TryReadProperty(ref reader, options, PropEstimatedHeapMemoryUsageBytes, null)) + { + continue; + } + + if (propEstimatedOperations.TryReadProperty(ref reader, options, PropEstimatedOperations, null)) + { + continue; + } + + if (propFullyDefined.TryReadProperty(ref reader, options, PropFullyDefined, null)) + { + continue; + } + + if (propInferenceConfig.TryReadProperty(ref reader, options, PropInferenceConfig, null)) + { + continue; + } + + if (propInput.TryReadProperty(ref reader, options, PropInput, null)) + { + continue; + } + + if (propLicenseLevel.TryReadProperty(ref reader, options, PropLicenseLevel, null)) + { + continue; + } + + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propModelPackage.TryReadProperty(ref reader, options, PropModelPackage, null)) + { + continue; + } + + if (propModelSizeBytes.TryReadProperty(ref reader, options, PropModelSizeBytes, null)) + { + continue; + } + + if (propModelType.TryReadProperty(ref reader, options, PropModelType, null)) + { + continue; + } + + if (propPlatformArchitecture.TryReadProperty(ref reader, options, PropPlatformArchitecture, null)) + { + continue; + } + + if (propPrefixStrings.TryReadProperty(ref reader, options, PropPrefixStrings, null)) + { + continue; + } + + if (propTags.TryReadProperty(ref reader, options, PropTags, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompressedDefinition = propCompressedDefinition.Value, + CreatedBy = propCreatedBy.Value, + CreateTime = propCreateTime.Value, + DefaultFieldMap = propDefaultFieldMap.Value, + Description = propDescription.Value, + EstimatedHeapMemoryUsageBytes = propEstimatedHeapMemoryUsageBytes.Value, + EstimatedOperations = propEstimatedOperations.Value, + FullyDefined = propFullyDefined.Value, + InferenceConfig = propInferenceConfig.Value, + Input = propInput.Value, + LicenseLevel = propLicenseLevel.Value, + Location = propLocation.Value, + Metadata = propMetadata.Value, + ModelId = propModelId.Value, + ModelPackage = propModelPackage.Value, + ModelSizeBytes = propModelSizeBytes.Value, + ModelType = propModelType.Value, + PlatformArchitecture = propPlatformArchitecture.Value, + PrefixStrings = propPrefixStrings.Value, + Tags = propTags.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompressedDefinition, value.CompressedDefinition, null, null); + writer.WriteProperty(options, PropCreatedBy, value.CreatedBy, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropDefaultFieldMap, value.DefaultFieldMap, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEstimatedHeapMemoryUsageBytes, value.EstimatedHeapMemoryUsageBytes, null, null); + writer.WriteProperty(options, PropEstimatedOperations, value.EstimatedOperations, null, null); + writer.WriteProperty(options, PropFullyDefined, value.FullyDefined, null, null); + writer.WriteProperty(options, PropInferenceConfig, value.InferenceConfig, null, null); + writer.WriteProperty(options, PropInput, value.Input, null, null); + writer.WriteProperty(options, PropLicenseLevel, value.LicenseLevel, null, null); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropModelPackage, value.ModelPackage, null, null); + writer.WriteProperty(options, PropModelSizeBytes, value.ModelSizeBytes, null, null); + writer.WriteProperty(options, PropModelType, value.ModelType, null, null); + writer.WriteProperty(options, PropPlatformArchitecture, value.PlatformArchitecture, null, null); + writer.WriteProperty(options, PropPrefixStrings, value.PrefixStrings, null, null); + writer.WriteProperty(options, PropTags, value.Tags, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigConverter))] public sealed partial class TrainedModelConfig { - [JsonInclude, JsonPropertyName("compressed_definition")] - public string? CompressedDefinition { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelConfig(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput input, string modelId, System.Collections.Generic.IReadOnlyCollection tags) + { + Input = input; + ModelId = modelId; + Tags = tags; + } +#if NET7_0_OR_GREATER + public TrainedModelConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? CompressedDefinition { get; set; } /// /// /// Information on the creator of the trained model. /// /// - [JsonInclude, JsonPropertyName("created_by")] - public string? CreatedBy { get; init; } + public string? CreatedBy { get; set; } /// /// /// The time when the trained model was created. /// /// - [JsonInclude, JsonPropertyName("create_time")] - public DateTimeOffset? CreateTime { get; init; } + public System.DateTimeOffset? CreateTime { get; set; } /// /// /// Any field map described in the inference configuration takes precedence. /// /// - [JsonInclude, JsonPropertyName("default_field_map")] - public IReadOnlyDictionary? DefaultFieldMap { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? DefaultFieldMap { get; set; } /// /// /// The free-text description of the trained model. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// The estimated heap usage in bytes to keep the trained model in memory. /// /// - [JsonInclude, JsonPropertyName("estimated_heap_memory_usage_bytes")] - public int? EstimatedHeapMemoryUsageBytes { get; init; } + public int? EstimatedHeapMemoryUsageBytes { get; set; } /// /// /// The estimated number of operations to use the trained model. /// /// - [JsonInclude, JsonPropertyName("estimated_operations")] - public int? EstimatedOperations { get; init; } + public int? EstimatedOperations { get; set; } /// /// /// True if the full model definition is present. /// /// - [JsonInclude, JsonPropertyName("fully_defined")] - public bool? FullyDefined { get; init; } + public bool? FullyDefined { get; set; } /// /// /// The default configuration for inference. This can be either a regression, classification, or one of the many NLP focused configurations. It must match the underlying definition.trained_model's target_type. For pre-packaged models such as ELSER the config is not required. /// /// - [JsonInclude, JsonPropertyName("inference_config")] - public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfig { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate? InferenceConfig { get; set; } /// /// /// The input field names for the model definition. /// /// - [JsonInclude, JsonPropertyName("input")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput Input { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput Input { get; set; } /// /// /// The license level of the trained model. /// /// - [JsonInclude, JsonPropertyName("license_level")] - public string? LicenseLevel { get; init; } - [JsonInclude, JsonPropertyName("location")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation? Location { get; init; } + public string? LicenseLevel { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation? Location { get; set; } /// /// /// An object containing metadata about the trained model. For example, models created by data frame analytics contain analysis_config and input objects. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata? Metadata { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata? Metadata { get; set; } /// /// /// Identifier for the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } - [JsonInclude, JsonPropertyName("model_package")] - public Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig? ModelPackage { get; init; } - [JsonInclude, JsonPropertyName("model_size_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? ModelSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.ModelPackageConfig? ModelPackage { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? ModelSizeBytes { get; set; } /// /// /// The model type /// /// - [JsonInclude, JsonPropertyName("model_type")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelType { get; init; } - [JsonInclude, JsonPropertyName("prefix_strings")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelType? ModelType { get; set; } + public string? PlatformArchitecture { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings? PrefixStrings { get; set; } /// /// /// A comma delimited string of tags. A trained model can have many tags, or none. /// /// - [JsonInclude, JsonPropertyName("tags")] - public IReadOnlyCollection Tags { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Tags { get; set; } /// /// /// The Elasticsearch version number in which the trained model was created. /// /// - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } + public string? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigInput.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigInput.g.cs index 381a787e0fa..4591a80649b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigInput.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigInput.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelConfigInputConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFieldNames = System.Text.Json.JsonEncodedText.Encode("field_names"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFieldNames = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFieldNames.TryReadProperty(ref reader, options, PropFieldNames, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FieldNames = propFieldNames.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInput value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFieldNames, value.FieldNames, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigInputConverter))] public sealed partial class TrainedModelConfigInput { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelConfigInput(Elastic.Clients.Elasticsearch.Fields fieldNames) + { + FieldNames = fieldNames; + } +#if NET7_0_OR_GREATER + public TrainedModelConfigInput() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelConfigInput() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelConfigInput(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An array of input field names for the model. /// /// - [JsonInclude, JsonPropertyName("field_names")] - public IReadOnlyCollection FieldNames { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields FieldNames { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigMetadata.g.cs index f53c2df3bd2..f343462b19c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelConfigMetadata.g.cs @@ -17,41 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelConfigMetadataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureImportanceBaseline = System.Text.Json.JsonEncodedText.Encode("feature_importance_baseline"); + private static readonly System.Text.Json.JsonEncodedText PropHyperparameters = System.Text.Json.JsonEncodedText.Encode("hyperparameters"); + private static readonly System.Text.Json.JsonEncodedText PropModelAliases = System.Text.Json.JsonEncodedText.Encode("model_aliases"); + private static readonly System.Text.Json.JsonEncodedText PropTotalFeatureImportance = System.Text.Json.JsonEncodedText.Encode("total_feature_importance"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFeatureImportanceBaseline = default; + LocalJsonValue?> propHyperparameters = default; + LocalJsonValue?> propModelAliases = default; + LocalJsonValue?> propTotalFeatureImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureImportanceBaseline.TryReadProperty(ref reader, options, PropFeatureImportanceBaseline, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHyperparameters.TryReadProperty(ref reader, options, PropHyperparameters, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propModelAliases.TryReadProperty(ref reader, options, PropModelAliases, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTotalFeatureImportance.TryReadProperty(ref reader, options, PropTotalFeatureImportance, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureImportanceBaseline = propFeatureImportanceBaseline.Value, + Hyperparameters = propHyperparameters.Value, + ModelAliases = propModelAliases.Value, + TotalFeatureImportance = propTotalFeatureImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureImportanceBaseline, value.FeatureImportanceBaseline, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHyperparameters, value.Hyperparameters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropModelAliases, value.ModelAliases, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotalFeatureImportance, value.TotalFeatureImportance, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelConfigMetadataConverter))] public sealed partial class TrainedModelConfigMetadata { +#if NET7_0_OR_GREATER + public TrainedModelConfigMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + public TrainedModelConfigMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelConfigMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// An object that contains the baseline for feature importance values. For regression analysis, it is a single value. For classification analysis, there is a value for each class. /// /// - [JsonInclude, JsonPropertyName("feature_importance_baseline")] - public IReadOnlyDictionary? FeatureImportanceBaseline { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? FeatureImportanceBaseline { get; set; } /// /// /// List of the available hyperparameters optimized during the fine_parameter_tuning phase as well as specified by the user. /// /// - [JsonInclude, JsonPropertyName("hyperparameters")] - public IReadOnlyCollection? Hyperparameters { get; init; } - [JsonInclude, JsonPropertyName("model_aliases")] - public IReadOnlyCollection? ModelAliases { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Hyperparameters { get; set; } + public System.Collections.Generic.IReadOnlyCollection? ModelAliases { get; set; } /// /// /// An array of the total feature importance for each feature used from the training data set. This array of objects is returned if data frame analytics trained the model and the request includes total_feature_importance in the include request parameter. /// /// - [JsonInclude, JsonPropertyName("total_feature_importance")] - public IReadOnlyCollection? TotalFeatureImportance { get; init; } + public System.Collections.Generic.IReadOnlyCollection? TotalFeatureImportance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentAllocationStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentAllocationStatus.g.cs index 3eba4c44990..a775e89c3c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentAllocationStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentAllocationStatus.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelDeploymentAllocationStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocationCount = System.Text.Json.JsonEncodedText.Encode("allocation_count"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropTargetAllocationCount = System.Text.Json.JsonEncodedText.Encode("target_allocation_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocationCount = default; + LocalJsonValue propState = default; + LocalJsonValue propTargetAllocationCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocationCount.TryReadProperty(ref reader, options, PropAllocationCount, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propTargetAllocationCount.TryReadProperty(ref reader, options, PropTargetAllocationCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocationCount = propAllocationCount.Value, + State = propState.Value, + TargetAllocationCount = propTargetAllocationCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocationCount, value.AllocationCount, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropTargetAllocationCount, value.TargetAllocationCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatusConverter))] public sealed partial class TrainedModelDeploymentAllocationStatus { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelDeploymentAllocationStatus(int allocationCount, Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState state, int targetAllocationCount) + { + AllocationCount = allocationCount; + State = state; + TargetAllocationCount = targetAllocationCount; + } +#if NET7_0_OR_GREATER + public TrainedModelDeploymentAllocationStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelDeploymentAllocationStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelDeploymentAllocationStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The current number of nodes where the model is allocated. /// /// - [JsonInclude, JsonPropertyName("allocation_count")] - public int AllocationCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AllocationCount { get; set; } /// /// /// The detailed allocation state related to the nodes. /// /// - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState State { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAllocationState State { get; set; } /// /// /// The desired number of nodes for model allocation. /// /// - [JsonInclude, JsonPropertyName("target_allocation_count")] - public int TargetAllocationCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int TargetAllocationCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentNodesStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentNodesStats.g.cs index e8ee05e782a..82fb4e35a7c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentNodesStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentNodesStats.g.cs @@ -17,129 +17,336 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelDeploymentNodesStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAverageInferenceTimeMs = System.Text.Json.JsonEncodedText.Encode("average_inference_time_ms"); + private static readonly System.Text.Json.JsonEncodedText PropAverageInferenceTimeMsExcludingCacheHits = System.Text.Json.JsonEncodedText.Encode("average_inference_time_ms_excluding_cache_hits"); + private static readonly System.Text.Json.JsonEncodedText PropAverageInferenceTimeMsLastMinute = System.Text.Json.JsonEncodedText.Encode("average_inference_time_ms_last_minute"); + private static readonly System.Text.Json.JsonEncodedText PropErrorCount = System.Text.Json.JsonEncodedText.Encode("error_count"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCacheHitCount = System.Text.Json.JsonEncodedText.Encode("inference_cache_hit_count"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCacheHitCountLastMinute = System.Text.Json.JsonEncodedText.Encode("inference_cache_hit_count_last_minute"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCount = System.Text.Json.JsonEncodedText.Encode("inference_count"); + private static readonly System.Text.Json.JsonEncodedText PropLastAccess = System.Text.Json.JsonEncodedText.Encode("last_access"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("number_of_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfPendingRequests = System.Text.Json.JsonEncodedText.Encode("number_of_pending_requests"); + private static readonly System.Text.Json.JsonEncodedText PropPeakThroughputPerMinute = System.Text.Json.JsonEncodedText.Encode("peak_throughput_per_minute"); + private static readonly System.Text.Json.JsonEncodedText PropRejectedExecutionCount = System.Text.Json.JsonEncodedText.Encode("rejected_execution_count"); + private static readonly System.Text.Json.JsonEncodedText PropRoutingState = System.Text.Json.JsonEncodedText.Encode("routing_state"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropThreadsPerAllocation = System.Text.Json.JsonEncodedText.Encode("threads_per_allocation"); + private static readonly System.Text.Json.JsonEncodedText PropThroughputLastMinute = System.Text.Json.JsonEncodedText.Encode("throughput_last_minute"); + private static readonly System.Text.Json.JsonEncodedText PropTimeoutCount = System.Text.Json.JsonEncodedText.Encode("timeout_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentNodesStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAverageInferenceTimeMs = default; + LocalJsonValue propAverageInferenceTimeMsExcludingCacheHits = default; + LocalJsonValue propAverageInferenceTimeMsLastMinute = default; + LocalJsonValue propErrorCount = default; + LocalJsonValue propInferenceCacheHitCount = default; + LocalJsonValue propInferenceCacheHitCountLastMinute = default; + LocalJsonValue propInferenceCount = default; + LocalJsonValue propLastAccess = default; + LocalJsonValue?> propNode = default; + LocalJsonValue propNumberOfAllocations = default; + LocalJsonValue propNumberOfPendingRequests = default; + LocalJsonValue propPeakThroughputPerMinute = default; + LocalJsonValue propRejectedExecutionCount = default; + LocalJsonValue propRoutingState = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propThreadsPerAllocation = default; + LocalJsonValue propThroughputLastMinute = default; + LocalJsonValue propTimeoutCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAverageInferenceTimeMs.TryReadProperty(ref reader, options, PropAverageInferenceTimeMs, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propAverageInferenceTimeMsExcludingCacheHits.TryReadProperty(ref reader, options, PropAverageInferenceTimeMsExcludingCacheHits, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propAverageInferenceTimeMsLastMinute.TryReadProperty(ref reader, options, PropAverageInferenceTimeMsLastMinute, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propErrorCount.TryReadProperty(ref reader, options, PropErrorCount, null)) + { + continue; + } + + if (propInferenceCacheHitCount.TryReadProperty(ref reader, options, PropInferenceCacheHitCount, null)) + { + continue; + } + + if (propInferenceCacheHitCountLastMinute.TryReadProperty(ref reader, options, PropInferenceCacheHitCountLastMinute, null)) + { + continue; + } + + if (propInferenceCount.TryReadProperty(ref reader, options, PropInferenceCount, null)) + { + continue; + } + + if (propLastAccess.TryReadProperty(ref reader, options, PropLastAccess, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, static System.Collections.Generic.KeyValuePair? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null))) + { + continue; + } + + if (propNumberOfAllocations.TryReadProperty(ref reader, options, PropNumberOfAllocations, null)) + { + continue; + } + + if (propNumberOfPendingRequests.TryReadProperty(ref reader, options, PropNumberOfPendingRequests, null)) + { + continue; + } + + if (propPeakThroughputPerMinute.TryReadProperty(ref reader, options, PropPeakThroughputPerMinute, null)) + { + continue; + } + + if (propRejectedExecutionCount.TryReadProperty(ref reader, options, PropRejectedExecutionCount, null)) + { + continue; + } + + if (propRoutingState.TryReadProperty(ref reader, options, PropRoutingState, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propThreadsPerAllocation.TryReadProperty(ref reader, options, PropThreadsPerAllocation, null)) + { + continue; + } + + if (propThroughputLastMinute.TryReadProperty(ref reader, options, PropThroughputLastMinute, null)) + { + continue; + } + + if (propTimeoutCount.TryReadProperty(ref reader, options, PropTimeoutCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentNodesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AverageInferenceTimeMs = propAverageInferenceTimeMs.Value, + AverageInferenceTimeMsExcludingCacheHits = propAverageInferenceTimeMsExcludingCacheHits.Value, + AverageInferenceTimeMsLastMinute = propAverageInferenceTimeMsLastMinute.Value, + ErrorCount = propErrorCount.Value, + InferenceCacheHitCount = propInferenceCacheHitCount.Value, + InferenceCacheHitCountLastMinute = propInferenceCacheHitCountLastMinute.Value, + InferenceCount = propInferenceCount.Value, + LastAccess = propLastAccess.Value, + Node = propNode.Value, + NumberOfAllocations = propNumberOfAllocations.Value, + NumberOfPendingRequests = propNumberOfPendingRequests.Value, + PeakThroughputPerMinute = propPeakThroughputPerMinute.Value, + RejectedExecutionCount = propRejectedExecutionCount.Value, + RoutingState = propRoutingState.Value, + StartTime = propStartTime.Value, + ThreadsPerAllocation = propThreadsPerAllocation.Value, + ThroughputLastMinute = propThroughputLastMinute.Value, + TimeoutCount = propTimeoutCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentNodesStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAverageInferenceTimeMs, value.AverageInferenceTimeMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropAverageInferenceTimeMsExcludingCacheHits, value.AverageInferenceTimeMsExcludingCacheHits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropAverageInferenceTimeMsLastMinute, value.AverageInferenceTimeMsLastMinute, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropErrorCount, value.ErrorCount, null, null); + writer.WriteProperty(options, PropInferenceCacheHitCount, value.InferenceCacheHitCount, null, null); + writer.WriteProperty(options, PropInferenceCacheHitCountLastMinute, value.InferenceCacheHitCountLastMinute, null, null); + writer.WriteProperty(options, PropInferenceCount, value.InferenceCount, null, null); + writer.WriteProperty(options, PropLastAccess, value.LastAccess, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropNode, value.Node, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair? v) => w.WriteKeyValuePairValue(o, v, null, null)); + writer.WriteProperty(options, PropNumberOfAllocations, value.NumberOfAllocations, null, null); + writer.WriteProperty(options, PropNumberOfPendingRequests, value.NumberOfPendingRequests, null, null); + writer.WriteProperty(options, PropPeakThroughputPerMinute, value.PeakThroughputPerMinute, null, null); + writer.WriteProperty(options, PropRejectedExecutionCount, value.RejectedExecutionCount, null, null); + writer.WriteProperty(options, PropRoutingState, value.RoutingState, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropThreadsPerAllocation, value.ThreadsPerAllocation, null, null); + writer.WriteProperty(options, PropThroughputLastMinute, value.ThroughputLastMinute, null, null); + writer.WriteProperty(options, PropTimeoutCount, value.TimeoutCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentNodesStatsConverter))] public sealed partial class TrainedModelDeploymentNodesStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelDeploymentNodesStats(long peakThroughputPerMinute, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReason routingState, int throughputLastMinute) + { + PeakThroughputPerMinute = peakThroughputPerMinute; + RoutingState = routingState; + ThroughputLastMinute = throughputLastMinute; + } +#if NET7_0_OR_GREATER + public TrainedModelDeploymentNodesStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelDeploymentNodesStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelDeploymentNodesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The average time for each inference call to complete on this node. /// /// - [JsonInclude, JsonPropertyName("average_inference_time_ms")] - public double? AverageInferenceTimeMs { get; init; } + public System.TimeSpan? AverageInferenceTimeMs { get; set; } /// /// /// The average time for each inference call to complete on this node, excluding cache /// /// - [JsonInclude, JsonPropertyName("average_inference_time_ms_excluding_cache_hits")] - public double? AverageInferenceTimeMsExcludingCacheHits { get; init; } - [JsonInclude, JsonPropertyName("average_inference_time_ms_last_minute")] - public double? AverageInferenceTimeMsLastMinute { get; init; } + public System.TimeSpan? AverageInferenceTimeMsExcludingCacheHits { get; set; } + public System.TimeSpan? AverageInferenceTimeMsLastMinute { get; set; } /// /// /// The number of errors when evaluating the trained model. /// /// - [JsonInclude, JsonPropertyName("error_count")] - public int? ErrorCount { get; init; } - [JsonInclude, JsonPropertyName("inference_cache_hit_count")] - public long? InferenceCacheHitCount { get; init; } - [JsonInclude, JsonPropertyName("inference_cache_hit_count_last_minute")] - public long? InferenceCacheHitCountLastMinute { get; init; } + public int? ErrorCount { get; set; } + public long? InferenceCacheHitCount { get; set; } + public long? InferenceCacheHitCountLastMinute { get; set; } /// /// /// The total number of inference calls made against this node for this model. /// /// - [JsonInclude, JsonPropertyName("inference_count")] - public long? InferenceCount { get; init; } + public long? InferenceCount { get; set; } /// /// /// The epoch time stamp of the last inference call for the model on this node. /// /// - [JsonInclude, JsonPropertyName("last_access")] - public long? LastAccess { get; init; } + public System.DateTimeOffset? LastAccess { get; set; } /// /// /// Information pertaining to the node. /// /// - [JsonInclude, JsonPropertyName("node")] - public KeyValuePair? Node { get; init; } + public System.Collections.Generic.KeyValuePair? Node { get; set; } /// /// /// The number of allocations assigned to this node. /// /// - [JsonInclude, JsonPropertyName("number_of_allocations")] - public int? NumberOfAllocations { get; init; } + public int? NumberOfAllocations { get; set; } /// /// /// The number of inference requests queued to be processed. /// /// - [JsonInclude, JsonPropertyName("number_of_pending_requests")] - public int? NumberOfPendingRequests { get; init; } - [JsonInclude, JsonPropertyName("peak_throughput_per_minute")] - public long PeakThroughputPerMinute { get; init; } + public int? NumberOfPendingRequests { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PeakThroughputPerMinute { get; set; } /// /// /// The number of inference requests that were not processed because the queue was full. /// /// - [JsonInclude, JsonPropertyName("rejection_execution_count")] - public int? RejectionExecutionCount { get; init; } + public int? RejectedExecutionCount { get; set; } /// /// /// The current routing state and reason for the current routing state for this allocation. /// /// - [JsonInclude, JsonPropertyName("routing_state")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingTable RoutingState { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignmentRoutingStateAndReason RoutingState { get; set; } /// /// /// The epoch timestamp when the allocation started. /// /// - [JsonInclude, JsonPropertyName("start_time")] - public long? StartTime { get; init; } + public System.DateTimeOffset? StartTime { get; set; } /// /// /// The number of threads used by each allocation during inference. /// /// - [JsonInclude, JsonPropertyName("threads_per_allocation")] - public int? ThreadsPerAllocation { get; init; } - [JsonInclude, JsonPropertyName("throughput_last_minute")] - public int ThroughputLastMinute { get; init; } + public int? ThreadsPerAllocation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ThroughputLastMinute { get; set; } /// /// /// The number of inference requests that timed out before being processed. /// /// - [JsonInclude, JsonPropertyName("timeout_count")] - public int? TimeoutCount { get; init; } + public int? TimeoutCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentStats.g.cs index 80ed519735f..74d0a1fa91f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelDeploymentStats.g.cs @@ -17,62 +17,279 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelDeploymentStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveAllocations = System.Text.Json.JsonEncodedText.Encode("adaptive_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropAllocationStatus = System.Text.Json.JsonEncodedText.Encode("allocation_status"); + private static readonly System.Text.Json.JsonEncodedText PropCacheSize = System.Text.Json.JsonEncodedText.Encode("cache_size"); + private static readonly System.Text.Json.JsonEncodedText PropDeploymentId = System.Text.Json.JsonEncodedText.Encode("deployment_id"); + private static readonly System.Text.Json.JsonEncodedText PropErrorCount = System.Text.Json.JsonEncodedText.Encode("error_count"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCount = System.Text.Json.JsonEncodedText.Encode("inference_count"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfAllocations = System.Text.Json.JsonEncodedText.Encode("number_of_allocations"); + private static readonly System.Text.Json.JsonEncodedText PropPeakThroughputPerMinute = System.Text.Json.JsonEncodedText.Encode("peak_throughput_per_minute"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropQueueCapacity = System.Text.Json.JsonEncodedText.Encode("queue_capacity"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRejectedExecutionCount = System.Text.Json.JsonEncodedText.Encode("rejected_execution_count"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropThreadsPerAllocation = System.Text.Json.JsonEncodedText.Encode("threads_per_allocation"); + private static readonly System.Text.Json.JsonEncodedText PropTimeoutCount = System.Text.Json.JsonEncodedText.Encode("timeout_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdaptiveAllocations = default; + LocalJsonValue propAllocationStatus = default; + LocalJsonValue propCacheSize = default; + LocalJsonValue propDeploymentId = default; + LocalJsonValue propErrorCount = default; + LocalJsonValue propInferenceCount = default; + LocalJsonValue propModelId = default; + LocalJsonValue> propNodes = default; + LocalJsonValue propNumberOfAllocations = default; + LocalJsonValue propPeakThroughputPerMinute = default; + LocalJsonValue propPriority = default; + LocalJsonValue propQueueCapacity = default; + LocalJsonValue propReason = default; + LocalJsonValue propRejectedExecutionCount = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propState = default; + LocalJsonValue propThreadsPerAllocation = default; + LocalJsonValue propTimeoutCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveAllocations.TryReadProperty(ref reader, options, PropAdaptiveAllocations, null)) + { + continue; + } + + if (propAllocationStatus.TryReadProperty(ref reader, options, PropAllocationStatus, null)) + { + continue; + } + + if (propCacheSize.TryReadProperty(ref reader, options, PropCacheSize, null)) + { + continue; + } + + if (propDeploymentId.TryReadProperty(ref reader, options, PropDeploymentId, null)) + { + continue; + } + + if (propErrorCount.TryReadProperty(ref reader, options, PropErrorCount, null)) + { + continue; + } + + if (propInferenceCount.TryReadProperty(ref reader, options, PropInferenceCount, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propNumberOfAllocations.TryReadProperty(ref reader, options, PropNumberOfAllocations, null)) + { + continue; + } + + if (propPeakThroughputPerMinute.TryReadProperty(ref reader, options, PropPeakThroughputPerMinute, null)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propQueueCapacity.TryReadProperty(ref reader, options, PropQueueCapacity, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRejectedExecutionCount.TryReadProperty(ref reader, options, PropRejectedExecutionCount, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propThreadsPerAllocation.TryReadProperty(ref reader, options, PropThreadsPerAllocation, null)) + { + continue; + } + + if (propTimeoutCount.TryReadProperty(ref reader, options, PropTimeoutCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveAllocations = propAdaptiveAllocations.Value, + AllocationStatus = propAllocationStatus.Value, + CacheSize = propCacheSize.Value, + DeploymentId = propDeploymentId.Value, + ErrorCount = propErrorCount.Value, + InferenceCount = propInferenceCount.Value, + ModelId = propModelId.Value, + Nodes = propNodes.Value, + NumberOfAllocations = propNumberOfAllocations.Value, + PeakThroughputPerMinute = propPeakThroughputPerMinute.Value, + Priority = propPriority.Value, + QueueCapacity = propQueueCapacity.Value, + Reason = propReason.Value, + RejectedExecutionCount = propRejectedExecutionCount.Value, + StartTime = propStartTime.Value, + State = propState.Value, + ThreadsPerAllocation = propThreadsPerAllocation.Value, + TimeoutCount = propTimeoutCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveAllocations, value.AdaptiveAllocations, null, null); + writer.WriteProperty(options, PropAllocationStatus, value.AllocationStatus, null, null); + writer.WriteProperty(options, PropCacheSize, value.CacheSize, null, null); + writer.WriteProperty(options, PropDeploymentId, value.DeploymentId, null, null); + writer.WriteProperty(options, PropErrorCount, value.ErrorCount, null, null); + writer.WriteProperty(options, PropInferenceCount, value.InferenceCount, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNumberOfAllocations, value.NumberOfAllocations, null, null); + writer.WriteProperty(options, PropPeakThroughputPerMinute, value.PeakThroughputPerMinute, null, null); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropQueueCapacity, value.QueueCapacity, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRejectedExecutionCount, value.RejectedExecutionCount, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropThreadsPerAllocation, value.ThreadsPerAllocation, null, null); + writer.WriteProperty(options, PropTimeoutCount, value.TimeoutCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStatsConverter))] public sealed partial class TrainedModelDeploymentStats { - [JsonInclude, JsonPropertyName("adaptive_allocations")] - public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelDeploymentStats(string deploymentId, string modelId, System.Collections.Generic.IReadOnlyCollection nodes, long peakThroughputPerMinute, Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority priority, System.DateTimeOffset startTime) + { + DeploymentId = deploymentId; + ModelId = modelId; + Nodes = nodes; + PeakThroughputPerMinute = peakThroughputPerMinute; + Priority = priority; + StartTime = startTime; + } +#if NET7_0_OR_GREATER + public TrainedModelDeploymentStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelDeploymentStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelDeploymentStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.MachineLearning.AdaptiveAllocationsSettings? AdaptiveAllocations { get; set; } /// /// /// The detailed allocation status for the deployment. /// /// - [JsonInclude, JsonPropertyName("allocation_status")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatus? AllocationStatus { get; init; } - [JsonInclude, JsonPropertyName("cache_size")] - public Elastic.Clients.Elasticsearch.ByteSize? CacheSize { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentAllocationStatus? AllocationStatus { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? CacheSize { get; set; } /// /// /// The unique identifier for the trained model deployment. /// /// - [JsonInclude, JsonPropertyName("deployment_id")] - public string DeploymentId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string DeploymentId { get; set; } /// /// /// The sum of error_count for all nodes in the deployment. /// /// - [JsonInclude, JsonPropertyName("error_count")] - public int? ErrorCount { get; init; } + public int? ErrorCount { get; set; } /// /// /// The sum of inference_count for all nodes in the deployment. /// /// - [JsonInclude, JsonPropertyName("inference_count")] - public int? InferenceCount { get; init; } + public int? InferenceCount { get; set; } /// /// /// The unique identifier for the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } /// /// @@ -80,28 +297,35 @@ public sealed partial class TrainedModelDeploymentStats /// In serverless, stats are reported for a single unnamed virtual node. /// /// - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyCollection Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Nodes { get; set; } /// /// /// The number of allocations requested. /// /// - [JsonInclude, JsonPropertyName("number_of_allocations")] - public int? NumberOfAllocations { get; init; } - [JsonInclude, JsonPropertyName("peak_throughput_per_minute")] - public long PeakThroughputPerMinute { get; init; } - [JsonInclude, JsonPropertyName("priority")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority Priority { get; init; } + public int? NumberOfAllocations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PeakThroughputPerMinute { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainingPriority Priority { get; set; } /// /// /// The number of inference requests that can be queued before new requests are rejected. /// /// - [JsonInclude, JsonPropertyName("queue_capacity")] - public int? QueueCapacity { get; init; } + public int? QueueCapacity { get; set; } /// /// @@ -109,8 +333,7 @@ public sealed partial class TrainedModelDeploymentStats /// the model is not deployed to a node. /// /// - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } + public string? Reason { get; set; } /// /// @@ -120,38 +343,37 @@ public sealed partial class TrainedModelDeploymentStats /// trained model deployment API. /// /// - [JsonInclude, JsonPropertyName("rejected_execution_count")] - public int? RejectedExecutionCount { get; init; } + public int? RejectedExecutionCount { get; set; } /// /// /// The epoch timestamp when the deployment started. /// /// - [JsonInclude, JsonPropertyName("start_time")] - public long StartTime { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTime { get; set; } /// /// /// The overall state of the deployment. /// /// - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState? State { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.DeploymentAssignmentState? State { get; set; } /// /// /// The number of threads used be each allocation during inference. /// /// - [JsonInclude, JsonPropertyName("threads_per_allocation")] - public int? ThreadsPerAllocation { get; init; } + public int? ThreadsPerAllocation { get; set; } /// /// /// The sum of timeout_count for all nodes in the deployment. /// /// - [JsonInclude, JsonPropertyName("timeout_count")] - public int? TimeoutCount { get; init; } + public int? TimeoutCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelEntities.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelEntities.g.cs index 453bb725a1f..512c9ae6c73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelEntities.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelEntities.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelEntitiesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropClassProbability = System.Text.Json.JsonEncodedText.Encode("class_probability"); + private static readonly System.Text.Json.JsonEncodedText PropEndPos = System.Text.Json.JsonEncodedText.Encode("end_pos"); + private static readonly System.Text.Json.JsonEncodedText PropEntity = System.Text.Json.JsonEncodedText.Encode("entity"); + private static readonly System.Text.Json.JsonEncodedText PropStartPos = System.Text.Json.JsonEncodedText.Encode("start_pos"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelEntities Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propClassProbability = default; + LocalJsonValue propEndPos = default; + LocalJsonValue propEntity = default; + LocalJsonValue propStartPos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propClassProbability.TryReadProperty(ref reader, options, PropClassProbability, null)) + { + continue; + } + + if (propEndPos.TryReadProperty(ref reader, options, PropEndPos, null)) + { + continue; + } + + if (propEntity.TryReadProperty(ref reader, options, PropEntity, null)) + { + continue; + } + + if (propStartPos.TryReadProperty(ref reader, options, PropStartPos, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelEntities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + ClassProbability = propClassProbability.Value, + EndPos = propEndPos.Value, + Entity = propEntity.Value, + StartPos = propStartPos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelEntities value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropClassProbability, value.ClassProbability, null, null); + writer.WriteProperty(options, PropEndPos, value.EndPos, null, null); + writer.WriteProperty(options, PropEntity, value.Entity, null, null); + writer.WriteProperty(options, PropStartPos, value.StartPos, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelEntitiesConverter))] public sealed partial class TrainedModelEntities { - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } - [JsonInclude, JsonPropertyName("class_probability")] - public double ClassProbability { get; init; } - [JsonInclude, JsonPropertyName("end_pos")] - public int EndPos { get; init; } - [JsonInclude, JsonPropertyName("entity")] - public string Entity { get; init; } - [JsonInclude, JsonPropertyName("start_pos")] - public int StartPos { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelEntities(string className, double classProbability, int endPos, string entity, int startPos) + { + ClassName = className; + ClassProbability = classProbability; + EndPos = endPos; + Entity = entity; + StartPos = startPos; + } +#if NET7_0_OR_GREATER + public TrainedModelEntities() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelEntities() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelEntities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ClassProbability { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int EndPos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Entity { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int StartPos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceClassImportance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceClassImportance.g.cs index 1c7680a98b7..92651cbcca6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceClassImportance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceClassImportance.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelInferenceClassImportanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassName = System.Text.Json.JsonEncodedText.Encode("class_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceClassImportance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassName = default; + LocalJsonValue propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassName.TryReadProperty(ref reader, options, PropClassName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceClassImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassName = propClassName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceClassImportance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassName, value.ClassName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceClassImportanceConverter))] public sealed partial class TrainedModelInferenceClassImportance { - [JsonInclude, JsonPropertyName("class_name")] - public string ClassName { get; init; } - [JsonInclude, JsonPropertyName("importance")] - public double Importance { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelInferenceClassImportance(string className, double importance) + { + ClassName = className; + Importance = importance; + } +#if NET7_0_OR_GREATER + public TrainedModelInferenceClassImportance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelInferenceClassImportance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelInferenceClassImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string ClassName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceFeatureImportance.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceFeatureImportance.g.cs index ecacc5f6e75..a997e9f1320 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceFeatureImportance.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceFeatureImportance.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelInferenceFeatureImportanceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropImportance = System.Text.Json.JsonEncodedText.Encode("importance"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceFeatureImportance Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClasses = default; + LocalJsonValue propFeatureName = default; + LocalJsonValue propImportance = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClasses.TryReadProperty(ref reader, options, PropClasses, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propImportance.TryReadProperty(ref reader, options, PropImportance, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classes = propClasses.Value, + FeatureName = propFeatureName.Value, + Importance = propImportance.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceFeatureImportance value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClasses, value.Classes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropImportance, value.Importance, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceFeatureImportanceConverter))] public sealed partial class TrainedModelInferenceFeatureImportance { - [JsonInclude, JsonPropertyName("classes")] - public IReadOnlyCollection? Classes { get; init; } - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; init; } - [JsonInclude, JsonPropertyName("importance")] - public double? Importance { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelInferenceFeatureImportance(string featureName) + { + FeatureName = featureName; + } +#if NET7_0_OR_GREATER + public TrainedModelInferenceFeatureImportance() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelInferenceFeatureImportance() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelInferenceFeatureImportance(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Classes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public double? Importance { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceStats.g.cs index 2d95a8bd78f..f77da4125b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelInferenceStats.g.cs @@ -17,18 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelInferenceStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheMissCount = System.Text.Json.JsonEncodedText.Encode("cache_miss_count"); + private static readonly System.Text.Json.JsonEncodedText PropFailureCount = System.Text.Json.JsonEncodedText.Encode("failure_count"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCount = System.Text.Json.JsonEncodedText.Encode("inference_count"); + private static readonly System.Text.Json.JsonEncodedText PropMissingAllFieldsCount = System.Text.Json.JsonEncodedText.Encode("missing_all_fields_count"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheMissCount = default; + LocalJsonValue propFailureCount = default; + LocalJsonValue propInferenceCount = default; + LocalJsonValue propMissingAllFieldsCount = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheMissCount.TryReadProperty(ref reader, options, PropCacheMissCount, null)) + { + continue; + } + + if (propFailureCount.TryReadProperty(ref reader, options, PropFailureCount, null)) + { + continue; + } + + if (propInferenceCount.TryReadProperty(ref reader, options, PropInferenceCount, null)) + { + continue; + } + + if (propMissingAllFieldsCount.TryReadProperty(ref reader, options, PropMissingAllFieldsCount, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheMissCount = propCacheMissCount.Value, + FailureCount = propFailureCount.Value, + InferenceCount = propInferenceCount.Value, + MissingAllFieldsCount = propMissingAllFieldsCount.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheMissCount, value.CacheMissCount, null, null); + writer.WriteProperty(options, PropFailureCount, value.FailureCount, null, null); + writer.WriteProperty(options, PropInferenceCount, value.InferenceCount, null, null); + writer.WriteProperty(options, PropMissingAllFieldsCount, value.MissingAllFieldsCount, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStatsConverter))] public sealed partial class TrainedModelInferenceStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelInferenceStats(int cacheMissCount, int failureCount, int inferenceCount, int missingAllFieldsCount, System.DateTimeOffset timestamp) + { + CacheMissCount = cacheMissCount; + FailureCount = failureCount; + InferenceCount = inferenceCount; + MissingAllFieldsCount = missingAllFieldsCount; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public TrainedModelInferenceStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelInferenceStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelInferenceStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of times the model was loaded for inference and was not retrieved from the cache. @@ -37,16 +135,22 @@ public sealed partial class TrainedModelInferenceStats /// Refer to general machine learning settings for the appropriate settings. /// /// - [JsonInclude, JsonPropertyName("cache_miss_count")] - public int CacheMissCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int CacheMissCount { get; set; } /// /// /// The number of failures when using the model for inference. /// /// - [JsonInclude, JsonPropertyName("failure_count")] - public int FailureCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int FailureCount { get; set; } /// /// @@ -54,22 +158,31 @@ public sealed partial class TrainedModelInferenceStats /// This is across all inference contexts, including all pipelines. /// /// - [JsonInclude, JsonPropertyName("inference_count")] - public int InferenceCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int InferenceCount { get; set; } /// /// /// The number of inference calls where all the training features for the model were missing. /// /// - [JsonInclude, JsonPropertyName("missing_all_fields_count")] - public int MissingAllFieldsCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int MissingAllFieldsCount { get; set; } /// /// /// The time when the statistics were last updated. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocation.g.cs index fdff8a5fd07..684d9d7c9e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocation.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelLocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationConverter))] public sealed partial class TrainedModelLocation { - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex Index { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelLocation(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public TrainedModelLocation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelLocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex Index { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocationIndex.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocationIndex.g.cs index 1fbc092e2d9..e15135bb496 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocationIndex.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelLocationIndex.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelLocationIndexConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndex value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelLocationIndexConverter))] public sealed partial class TrainedModelLocationIndex { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelLocationIndex(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public TrainedModelLocationIndex() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelLocationIndex() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelLocationIndex(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelPrefixStrings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelPrefixStrings.g.cs index 65407e2243c..51d56942d9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelPrefixStrings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelPrefixStrings.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelPrefixStringsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIngest = default; + LocalJsonValue propSearch = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Ingest = propIngest.Value, + Search = propSearch.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsConverter))] public sealed partial class TrainedModelPrefixStrings { +#if NET7_0_OR_GREATER + public TrainedModelPrefixStrings() + { + } +#endif +#if !NET7_0_OR_GREATER + public TrainedModelPrefixStrings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// String prepended to input at ingest /// /// - [JsonInclude, JsonPropertyName("ingest")] public string? Ingest { get; set; } /// @@ -42,30 +102,37 @@ public sealed partial class TrainedModelPrefixStrings /// String prepended to input at search /// /// - [JsonInclude, JsonPropertyName("search")] public string? Search { get; set; } } -public sealed partial class TrainedModelPrefixStringsDescriptor : SerializableDescriptor +public readonly partial struct TrainedModelPrefixStringsDescriptor { - internal TrainedModelPrefixStringsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings Instance { get; init; } - public TrainedModelPrefixStringsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelPrefixStringsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings instance) { + Instance = instance; } - private string? IngestValue { get; set; } - private string? SearchValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelPrefixStringsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor descriptor) => descriptor.Instance; /// /// /// String prepended to input at ingest /// /// - public TrainedModelPrefixStringsDescriptor Ingest(string? ingest) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor Ingest(string? value) { - IngestValue = ingest; - return Self; + Instance.Ingest = value; + return this; } /// @@ -73,27 +140,22 @@ public TrainedModelPrefixStringsDescriptor Ingest(string? ingest) /// String prepended to input at search /// /// - public TrainedModelPrefixStringsDescriptor Search(string? search) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor Search(string? value) { - SearchValue = search; - return Self; + Instance.Search = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings Build(System.Action? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(IngestValue)) + if (action is null) { - writer.WritePropertyName("ingest"); - writer.WriteStringValue(IngestValue); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(SearchValue)) - { - writer.WritePropertyName("search"); - writer.WriteStringValue(SearchValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStringsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelPrefixStrings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelSizeStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelSizeStats.g.cs index 7048a148aa7..79e2dd7c0c0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelSizeStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelSizeStats.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelSizeStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropModelSizeBytes = System.Text.Json.JsonEncodedText.Encode("model_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropRequiredNativeMemoryBytes = System.Text.Json.JsonEncodedText.Encode("required_native_memory_bytes"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModelSizeBytes = default; + LocalJsonValue propRequiredNativeMemoryBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModelSizeBytes.TryReadProperty(ref reader, options, PropModelSizeBytes, null)) + { + continue; + } + + if (propRequiredNativeMemoryBytes.TryReadProperty(ref reader, options, PropRequiredNativeMemoryBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModelSizeBytes = propModelSizeBytes.Value, + RequiredNativeMemoryBytes = propRequiredNativeMemoryBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModelSizeBytes, value.ModelSizeBytes, null, null); + writer.WriteProperty(options, PropRequiredNativeMemoryBytes, value.RequiredNativeMemoryBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStatsConverter))] public sealed partial class TrainedModelSizeStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelSizeStats(Elastic.Clients.Elasticsearch.ByteSize modelSizeBytes, Elastic.Clients.Elasticsearch.ByteSize requiredNativeMemoryBytes) + { + ModelSizeBytes = modelSizeBytes; + RequiredNativeMemoryBytes = requiredNativeMemoryBytes; + } +#if NET7_0_OR_GREATER + public TrainedModelSizeStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelSizeStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelSizeStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The size of the model in bytes. /// /// - [JsonInclude, JsonPropertyName("model_size_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize ModelSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize ModelSizeBytes { get; set; } /// /// /// The amount of memory required to load the model in bytes. /// /// - [JsonInclude, JsonPropertyName("required_native_memory_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize RequiredNativeMemoryBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize RequiredNativeMemoryBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelStats.g.cs index 71aee4afa81..cc33acbf791 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelStats.g.cs @@ -17,33 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeploymentStats = System.Text.Json.JsonEncodedText.Encode("deployment_stats"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceStats = System.Text.Json.JsonEncodedText.Encode("inference_stats"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeStats = System.Text.Json.JsonEncodedText.Encode("model_size_stats"); + private static readonly System.Text.Json.JsonEncodedText PropPipelineCount = System.Text.Json.JsonEncodedText.Encode("pipeline_count"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeploymentStats = default; + LocalJsonValue propInferenceStats = default; + LocalJsonValue?> propIngest = default; + LocalJsonValue propModelId = default; + LocalJsonValue propModelSizeStats = default; + LocalJsonValue propPipelineCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeploymentStats.TryReadProperty(ref reader, options, PropDeploymentStats, null)) + { + continue; + } + + if (propInferenceStats.TryReadProperty(ref reader, options, PropInferenceStats, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propModelSizeStats.TryReadProperty(ref reader, options, PropModelSizeStats, null)) + { + continue; + } + + if (propPipelineCount.TryReadProperty(ref reader, options, PropPipelineCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeploymentStats = propDeploymentStats.Value, + InferenceStats = propInferenceStats.Value, + Ingest = propIngest.Value, + ModelId = propModelId.Value, + ModelSizeStats = propModelSizeStats.Value, + PipelineCount = propPipelineCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeploymentStats, value.DeploymentStats, null, null); + writer.WriteProperty(options, PropInferenceStats, value.InferenceStats, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropModelSizeStats, value.ModelSizeStats, null, null); + writer.WriteProperty(options, PropPipelineCount, value.PipelineCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelStatsConverter))] public sealed partial class TrainedModelStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelStats(string modelId, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats modelSizeStats, int pipelineCount) + { + ModelId = modelId; + ModelSizeStats = modelSizeStats; + PipelineCount = pipelineCount; + } +#if NET7_0_OR_GREATER + public TrainedModelStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A collection of deployment stats, which is present when the models are deployed. /// /// - [JsonInclude, JsonPropertyName("deployment_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStats? DeploymentStats { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelDeploymentStats? DeploymentStats { get; set; } /// /// /// A collection of inference stats fields. /// /// - [JsonInclude, JsonPropertyName("inference_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStats? InferenceStats { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelInferenceStats? InferenceStats { get; set; } /// /// @@ -52,30 +155,38 @@ public sealed partial class TrainedModelStats /// The format matches the ingest section in the nodes stats API. /// /// - [JsonInclude, JsonPropertyName("ingest")] - public IReadOnlyDictionary? Ingest { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Ingest { get; set; } /// /// /// The unique identifier of the trained model. /// /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } /// /// /// A collection of model size stats. /// /// - [JsonInclude, JsonPropertyName("model_size_stats")] - public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats ModelSizeStats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelSizeStats ModelSizeStats { get; set; } /// /// /// The number of ingest pipelines that currently refer to the model. /// /// - [JsonInclude, JsonPropertyName("pipeline_count")] - public int PipelineCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int PipelineCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTree.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTree.g.cs index 999f4f1efd1..227d976723c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTree.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTree.g.cs @@ -17,146 +17,196 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelTreeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureNames = System.Text.Json.JsonEncodedText.Encode("feature_names"); + private static readonly System.Text.Json.JsonEncodedText PropTargetType = System.Text.Json.JsonEncodedText.Encode("target_type"); + private static readonly System.Text.Json.JsonEncodedText PropTreeStructure = System.Text.Json.JsonEncodedText.Encode("tree_structure"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClassificationLabels = default; + LocalJsonValue> propFeatureNames = default; + LocalJsonValue propTargetType = default; + LocalJsonValue> propTreeStructure = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureNames.TryReadProperty(ref reader, options, PropFeatureNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTargetType.TryReadProperty(ref reader, options, PropTargetType, null)) + { + continue; + } + + if (propTreeStructure.TryReadProperty(ref reader, options, PropTreeStructure, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassificationLabels = propClassificationLabels.Value, + FeatureNames = propFeatureNames.Value, + TargetType = propTargetType.Value, + TreeStructure = propTreeStructure.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureNames, value.FeatureNames, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTargetType, value.TargetType, null, null); + writer.WriteProperty(options, PropTreeStructure, value.TreeStructure, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeConverter))] public sealed partial class TrainedModelTree { - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection? ClassificationLabels { get; set; } - [JsonInclude, JsonPropertyName("feature_names")] - public ICollection FeatureNames { get; set; } - [JsonInclude, JsonPropertyName("target_type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTree(System.Collections.Generic.ICollection featureNames, System.Collections.Generic.ICollection treeStructure) + { + FeatureNames = featureNames; + TreeStructure = treeStructure; + } +#if NET7_0_OR_GREATER + public TrainedModelTree() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelTree() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelTree(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? ClassificationLabels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection FeatureNames { get; set; } public string? TargetType { get; set; } - [JsonInclude, JsonPropertyName("tree_structure")] - public ICollection TreeStructure { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection TreeStructure { get; set; } } -public sealed partial class TrainedModelTreeDescriptor : SerializableDescriptor +public readonly partial struct TrainedModelTreeDescriptor { - internal TrainedModelTreeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree Instance { get; init; } - public TrainedModelTreeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTreeDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree instance) { + Instance = instance; } - private ICollection? ClassificationLabelsValue { get; set; } - private ICollection FeatureNamesValue { get; set; } - private string? TargetTypeValue { get; set; } - private ICollection TreeStructureValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor TreeStructureDescriptor { get; set; } - private Action TreeStructureDescriptorAction { get; set; } - private Action[] TreeStructureDescriptorActions { get; set; } - - public TrainedModelTreeDescriptor ClassificationLabels(ICollection? classificationLabels) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTreeDescriptor() { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TrainedModelTreeDescriptor FeatureNames(ICollection featureNames) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor ClassificationLabels(System.Collections.Generic.ICollection? value) { - FeatureNamesValue = featureNames; - return Self; + Instance.ClassificationLabels = value; + return this; } - public TrainedModelTreeDescriptor TargetType(string? targetType) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor ClassificationLabels(params string[] values) { - TargetTypeValue = targetType; - return Self; + Instance.ClassificationLabels = [.. values]; + return this; } - public TrainedModelTreeDescriptor TreeStructure(ICollection treeStructure) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor FeatureNames(System.Collections.Generic.ICollection value) { - TreeStructureDescriptor = null; - TreeStructureDescriptorAction = null; - TreeStructureDescriptorActions = null; - TreeStructureValue = treeStructure; - return Self; + Instance.FeatureNames = value; + return this; } - public TrainedModelTreeDescriptor TreeStructure(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor descriptor) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor FeatureNames(params string[] values) { - TreeStructureValue = null; - TreeStructureDescriptorAction = null; - TreeStructureDescriptorActions = null; - TreeStructureDescriptor = descriptor; - return Self; + Instance.FeatureNames = [.. values]; + return this; } - public TrainedModelTreeDescriptor TreeStructure(Action configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor TargetType(string? value) { - TreeStructureValue = null; - TreeStructureDescriptor = null; - TreeStructureDescriptorActions = null; - TreeStructureDescriptorAction = configure; - return Self; + Instance.TargetType = value; + return this; } - public TrainedModelTreeDescriptor TreeStructure(params Action[] configure) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor TreeStructure(System.Collections.Generic.ICollection value) { - TreeStructureValue = null; - TreeStructureDescriptor = null; - TreeStructureDescriptorAction = null; - TreeStructureDescriptorActions = configure; - return Self; + Instance.TreeStructure = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor TreeStructure(params Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode[] values) { - writer.WriteStartObject(); - if (ClassificationLabelsValue is not null) - { - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - } - - writer.WritePropertyName("feature_names"); - JsonSerializer.Serialize(writer, FeatureNamesValue, options); - if (!string.IsNullOrEmpty(TargetTypeValue)) - { - writer.WritePropertyName("target_type"); - writer.WriteStringValue(TargetTypeValue); - } + Instance.TreeStructure = [.. values]; + return this; + } - if (TreeStructureDescriptor is not null) - { - writer.WritePropertyName("tree_structure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, TreeStructureDescriptor, options); - writer.WriteEndArray(); - } - else if (TreeStructureDescriptorAction is not null) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor TreeStructure(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("tree_structure"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(TreeStructureDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor.Build(action)); } - else if (TreeStructureDescriptorActions is not null) - { - writer.WritePropertyName("tree_structure"); - writer.WriteStartArray(); - foreach (var action in TreeStructureDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("tree_structure"); - JsonSerializer.Serialize(writer, TreeStructureValue, options); - } + Instance.TreeStructure = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTree(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTreeNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTreeNode.g.cs index 6714345eada..c0c23ace428 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTreeNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TrainedModelTreeNode.g.cs @@ -17,163 +17,241 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TrainedModelTreeNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDecisionType = System.Text.Json.JsonEncodedText.Encode("decision_type"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultLeft = System.Text.Json.JsonEncodedText.Encode("default_left"); + private static readonly System.Text.Json.JsonEncodedText PropLeafValue = System.Text.Json.JsonEncodedText.Encode("leaf_value"); + private static readonly System.Text.Json.JsonEncodedText PropLeftChild = System.Text.Json.JsonEncodedText.Encode("left_child"); + private static readonly System.Text.Json.JsonEncodedText PropNodeIndex = System.Text.Json.JsonEncodedText.Encode("node_index"); + private static readonly System.Text.Json.JsonEncodedText PropRightChild = System.Text.Json.JsonEncodedText.Encode("right_child"); + private static readonly System.Text.Json.JsonEncodedText PropSplitFeature = System.Text.Json.JsonEncodedText.Encode("split_feature"); + private static readonly System.Text.Json.JsonEncodedText PropSplitGain = System.Text.Json.JsonEncodedText.Encode("split_gain"); + private static readonly System.Text.Json.JsonEncodedText PropThreshold = System.Text.Json.JsonEncodedText.Encode("threshold"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDecisionType = default; + LocalJsonValue propDefaultLeft = default; + LocalJsonValue propLeafValue = default; + LocalJsonValue propLeftChild = default; + LocalJsonValue propNodeIndex = default; + LocalJsonValue propRightChild = default; + LocalJsonValue propSplitFeature = default; + LocalJsonValue propSplitGain = default; + LocalJsonValue propThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDecisionType.TryReadProperty(ref reader, options, PropDecisionType, null)) + { + continue; + } + + if (propDefaultLeft.TryReadProperty(ref reader, options, PropDefaultLeft, null)) + { + continue; + } + + if (propLeafValue.TryReadProperty(ref reader, options, PropLeafValue, null)) + { + continue; + } + + if (propLeftChild.TryReadProperty(ref reader, options, PropLeftChild, null)) + { + continue; + } + + if (propNodeIndex.TryReadProperty(ref reader, options, PropNodeIndex, null)) + { + continue; + } + + if (propRightChild.TryReadProperty(ref reader, options, PropRightChild, null)) + { + continue; + } + + if (propSplitFeature.TryReadProperty(ref reader, options, PropSplitFeature, null)) + { + continue; + } + + if (propSplitGain.TryReadProperty(ref reader, options, PropSplitGain, null)) + { + continue; + } + + if (propThreshold.TryReadProperty(ref reader, options, PropThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DecisionType = propDecisionType.Value, + DefaultLeft = propDefaultLeft.Value, + LeafValue = propLeafValue.Value, + LeftChild = propLeftChild.Value, + NodeIndex = propNodeIndex.Value, + RightChild = propRightChild.Value, + SplitFeature = propSplitFeature.Value, + SplitGain = propSplitGain.Value, + Threshold = propThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDecisionType, value.DecisionType, null, null); + writer.WriteProperty(options, PropDefaultLeft, value.DefaultLeft, null, null); + writer.WriteProperty(options, PropLeafValue, value.LeafValue, null, null); + writer.WriteProperty(options, PropLeftChild, value.LeftChild, null, null); + writer.WriteProperty(options, PropNodeIndex, value.NodeIndex, null, null); + writer.WriteProperty(options, PropRightChild, value.RightChild, null, null); + writer.WriteProperty(options, PropSplitFeature, value.SplitFeature, null, null); + writer.WriteProperty(options, PropSplitGain, value.SplitGain, null, null); + writer.WriteProperty(options, PropThreshold, value.Threshold, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeConverter))] public sealed partial class TrainedModelTreeNode { - [JsonInclude, JsonPropertyName("decision_type")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTreeNode(int nodeIndex) + { + NodeIndex = nodeIndex; + } +#if NET7_0_OR_GREATER + public TrainedModelTreeNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TrainedModelTreeNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TrainedModelTreeNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? DecisionType { get; set; } - [JsonInclude, JsonPropertyName("default_left")] public bool? DefaultLeft { get; set; } - [JsonInclude, JsonPropertyName("leaf_value")] public double? LeafValue { get; set; } - [JsonInclude, JsonPropertyName("left_child")] public int? LeftChild { get; set; } - [JsonInclude, JsonPropertyName("node_index")] - public int NodeIndex { get; set; } - [JsonInclude, JsonPropertyName("right_child")] + public +#if NET7_0_OR_GREATER + required +#endif + int NodeIndex { get; set; } public int? RightChild { get; set; } - [JsonInclude, JsonPropertyName("split_feature")] public int? SplitFeature { get; set; } - [JsonInclude, JsonPropertyName("split_gain")] public int? SplitGain { get; set; } - [JsonInclude, JsonPropertyName("threshold")] public double? Threshold { get; set; } } -public sealed partial class TrainedModelTreeNodeDescriptor : SerializableDescriptor +public readonly partial struct TrainedModelTreeNodeDescriptor { - internal TrainedModelTreeNodeDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode Instance { get; init; } - public TrainedModelTreeNodeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTreeNodeDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode instance) { + Instance = instance; } - private string? DecisionTypeValue { get; set; } - private bool? DefaultLeftValue { get; set; } - private double? LeafValueValue { get; set; } - private int? LeftChildValue { get; set; } - private int NodeIndexValue { get; set; } - private int? RightChildValue { get; set; } - private int? SplitFeatureValue { get; set; } - private int? SplitGainValue { get; set; } - private double? ThresholdValue { get; set; } - - public TrainedModelTreeNodeDescriptor DecisionType(string? decisionType) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TrainedModelTreeNodeDescriptor() { - DecisionTypeValue = decisionType; - return Self; + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TrainedModelTreeNodeDescriptor DefaultLeft(bool? defaultLeft = true) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode instance) => new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode(Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor DecisionType(string? value) { - DefaultLeftValue = defaultLeft; - return Self; + Instance.DecisionType = value; + return this; } - public TrainedModelTreeNodeDescriptor LeafValue(double? leafValue) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor DefaultLeft(bool? value = true) { - LeafValueValue = leafValue; - return Self; + Instance.DefaultLeft = value; + return this; } - public TrainedModelTreeNodeDescriptor LeftChild(int? leftChild) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor LeafValue(double? value) { - LeftChildValue = leftChild; - return Self; + Instance.LeafValue = value; + return this; } - public TrainedModelTreeNodeDescriptor NodeIndex(int nodeIndex) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor LeftChild(int? value) { - NodeIndexValue = nodeIndex; - return Self; + Instance.LeftChild = value; + return this; } - public TrainedModelTreeNodeDescriptor RightChild(int? rightChild) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor NodeIndex(int value) { - RightChildValue = rightChild; - return Self; + Instance.NodeIndex = value; + return this; } - public TrainedModelTreeNodeDescriptor SplitFeature(int? splitFeature) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor RightChild(int? value) { - SplitFeatureValue = splitFeature; - return Self; + Instance.RightChild = value; + return this; } - public TrainedModelTreeNodeDescriptor SplitGain(int? splitGain) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor SplitFeature(int? value) { - SplitGainValue = splitGain; - return Self; + Instance.SplitFeature = value; + return this; } - public TrainedModelTreeNodeDescriptor Threshold(double? threshold) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor SplitGain(int? value) { - ThresholdValue = threshold; - return Self; + Instance.SplitGain = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor Threshold(double? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(DecisionTypeValue)) - { - writer.WritePropertyName("decision_type"); - writer.WriteStringValue(DecisionTypeValue); - } - - if (DefaultLeftValue.HasValue) - { - writer.WritePropertyName("default_left"); - writer.WriteBooleanValue(DefaultLeftValue.Value); - } - - if (LeafValueValue.HasValue) - { - writer.WritePropertyName("leaf_value"); - writer.WriteNumberValue(LeafValueValue.Value); - } - - if (LeftChildValue.HasValue) - { - writer.WritePropertyName("left_child"); - writer.WriteNumberValue(LeftChildValue.Value); - } - - writer.WritePropertyName("node_index"); - writer.WriteNumberValue(NodeIndexValue); - if (RightChildValue.HasValue) - { - writer.WritePropertyName("right_child"); - writer.WriteNumberValue(RightChildValue.Value); - } - - if (SplitFeatureValue.HasValue) - { - writer.WritePropertyName("split_feature"); - writer.WriteNumberValue(SplitFeatureValue.Value); - } - - if (SplitGainValue.HasValue) - { - writer.WritePropertyName("split_gain"); - writer.WriteNumberValue(SplitGainValue.Value); - } - - if (ThresholdValue.HasValue) - { - writer.WritePropertyName("threshold"); - writer.WriteNumberValue(ThresholdValue.Value); - } + Instance.Threshold = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNodeDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelTreeNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TransformAuthorization.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TransformAuthorization.g.cs index c21114cb7a3..a8502082a73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TransformAuthorization.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/TransformAuthorization.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class TransformAuthorizationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropServiceAccount = System.Text.Json.JsonEncodedText.Encode("service_account"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApiKey = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue propServiceAccount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propServiceAccount.TryReadProperty(ref reader, options, PropServiceAccount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + Roles = propRoles.Value, + ServiceAccount = propServiceAccount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropServiceAccount, value.ServiceAccount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorizationConverter))] public sealed partial class TransformAuthorization { +#if NET7_0_OR_GREATER + public TransformAuthorization() + { + } +#endif +#if !NET7_0_OR_GREATER + public TransformAuthorization() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformAuthorization(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If an API key was used for the most recent update to the transform, its name and identifier are listed in the response. /// /// - [JsonInclude, JsonPropertyName("api_key")] - public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.ApiKeyAuthorization? ApiKey { get; set; } /// /// /// If a user ID was used for the most recent update to the transform, its roles at the time of the update are listed in the response. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } /// /// /// If a service account was used for the most recent update to the transform, the account name is listed in the response. /// /// - [JsonInclude, JsonPropertyName("service_account")] - public string? ServiceAccount { get; init; } + public string? ServiceAccount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Vocabulary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Vocabulary.g.cs index 67bd786aa45..916332e96b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Vocabulary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Vocabulary.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class VocabularyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyConverter))] public sealed partial class Vocabulary { - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Vocabulary(Elastic.Clients.Elasticsearch.IndexName index) + { + Index = index; + } +#if NET7_0_OR_GREATER + public Vocabulary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Vocabulary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Vocabulary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } } -public sealed partial class VocabularyDescriptor : SerializableDescriptor +public readonly partial struct VocabularyDescriptor { - internal VocabularyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Instance { get; init; } - public VocabularyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VocabularyDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VocabularyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public VocabularyDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary instance) => new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary(Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.VocabularyDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Vocabulary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Weights.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Weights.g.cs index 1be64ee8c9b..c0dea484dfe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Weights.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/Weights.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class WeightsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropWeightsValue = System.Text.Json.JsonEncodedText.Encode("weights"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.Weights Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propWeightsValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propWeightsValue.TryReadProperty(ref reader, options, PropWeightsValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.Weights(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + WeightsValue = propWeightsValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.Weights value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropWeightsValue, value.WeightsValue, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.WeightsConverter))] public sealed partial class Weights { - [JsonInclude, JsonPropertyName("weights")] - public double WeightsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Weights(double weightsValue) + { + WeightsValue = weightsValue; + } +#if NET7_0_OR_GREATER + public Weights() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Weights() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Weights(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double WeightsValue { get; set; } } -public sealed partial class WeightsDescriptor : SerializableDescriptor +public readonly partial struct WeightsDescriptor { - internal WeightsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.Weights Instance { get; init; } - public WeightsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Weights instance) { + Instance = instance; } - private double WeightsValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.Weights(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public WeightsDescriptor WeightsValue(double weightsValue) + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.Weights instance) => new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.Weights(Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor WeightsValue(double value) { - WeightsValueValue = weightsValue; - return Self; + Instance.WeightsValue = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.Weights Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("weights"); - writer.WriteNumberValue(WeightsValueValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.WeightsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.Weights(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/XlmRobertaTokenizationConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/XlmRobertaTokenizationConfig.g.cs new file mode 100644 index 00000000000..0e4f03a24f8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/XlmRobertaTokenizationConfig.g.cs @@ -0,0 +1,242 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.MachineLearning; + +internal sealed partial class XlmRobertaTokenizationConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoLowerCase = System.Text.Json.JsonEncodedText.Encode("do_lower_case"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSequenceLength = System.Text.Json.JsonEncodedText.Encode("max_sequence_length"); + private static readonly System.Text.Json.JsonEncodedText PropSpan = System.Text.Json.JsonEncodedText.Encode("span"); + private static readonly System.Text.Json.JsonEncodedText PropTruncate = System.Text.Json.JsonEncodedText.Encode("truncate"); + private static readonly System.Text.Json.JsonEncodedText PropWithSpecialTokens = System.Text.Json.JsonEncodedText.Encode("with_special_tokens"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoLowerCase = default; + LocalJsonValue propMaxSequenceLength = default; + LocalJsonValue propSpan = default; + LocalJsonValue propTruncate = default; + LocalJsonValue propWithSpecialTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoLowerCase.TryReadProperty(ref reader, options, PropDoLowerCase, null)) + { + continue; + } + + if (propMaxSequenceLength.TryReadProperty(ref reader, options, PropMaxSequenceLength, null)) + { + continue; + } + + if (propSpan.TryReadProperty(ref reader, options, PropSpan, null)) + { + continue; + } + + if (propTruncate.TryReadProperty(ref reader, options, PropTruncate, null)) + { + continue; + } + + if (propWithSpecialTokens.TryReadProperty(ref reader, options, PropWithSpecialTokens, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DoLowerCase = propDoLowerCase.Value, + MaxSequenceLength = propMaxSequenceLength.Value, + Span = propSpan.Value, + Truncate = propTruncate.Value, + WithSpecialTokens = propWithSpecialTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoLowerCase, value.DoLowerCase, null, null); + writer.WriteProperty(options, PropMaxSequenceLength, value.MaxSequenceLength, null, null); + writer.WriteProperty(options, PropSpan, value.Span, null, null); + writer.WriteProperty(options, PropTruncate, value.Truncate, null, null); + writer.WriteProperty(options, PropWithSpecialTokens, value.WithSpecialTokens, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigConverter))] +public sealed partial class XlmRobertaTokenizationConfig +{ +#if NET7_0_OR_GREATER + public XlmRobertaTokenizationConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public XlmRobertaTokenizationConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Should the tokenizer lower case the text + /// + /// + public bool? DoLowerCase { get; set; } + + /// + /// + /// Maximum input sequence length for the model + /// + /// + public int? MaxSequenceLength { get; set; } + + /// + /// + /// Tokenization spanning options. Special value of -1 indicates no spanning takes place + /// + /// + public int? Span { get; set; } + + /// + /// + /// Should tokenization input be automatically truncated before sending to the model for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? Truncate { get; set; } + + /// + /// + /// Is tokenization completed with special tokens + /// + /// + public bool? WithSpecialTokens { get; set; } +} + +public readonly partial struct XlmRobertaTokenizationConfigDescriptor +{ + internal Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XlmRobertaTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public XlmRobertaTokenizationConfigDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig instance) => new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Should the tokenizer lower case the text + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor DoLowerCase(bool? value = true) + { + Instance.DoLowerCase = value; + return this; + } + + /// + /// + /// Maximum input sequence length for the model + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor MaxSequenceLength(int? value) + { + Instance.MaxSequenceLength = value; + return this; + } + + /// + /// + /// Tokenization spanning options. Special value of -1 indicates no spanning takes place + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor Span(int? value) + { + Instance.Span = value; + return this; + } + + /// + /// + /// Should tokenization input be automatically truncated before sending to the model for inference + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor Truncate(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationTruncate? value) + { + Instance.Truncate = value; + return this; + } + + /// + /// + /// Is tokenization completed with special tokens + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor WithSpecialTokens(bool? value = true) + { + Instance.WithSpecialTokens = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfigDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.XlmRobertaTokenizationConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceOptions.g.cs index 92693735a72..cc838106081 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceOptions.g.cs @@ -17,38 +17,143 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ZeroShotClassificationInferenceOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassificationLabels = System.Text.Json.JsonEncodedText.Encode("classification_labels"); + private static readonly System.Text.Json.JsonEncodedText PropHypothesisTemplate = System.Text.Json.JsonEncodedText.Encode("hypothesis_template"); + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropMultiLabel = System.Text.Json.JsonEncodedText.Encode("multi_label"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propClassificationLabels = default; + LocalJsonValue propHypothesisTemplate = default; + LocalJsonValue?> propLabels = default; + LocalJsonValue propMultiLabel = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassificationLabels.TryReadProperty(ref reader, options, PropClassificationLabels, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propHypothesisTemplate.TryReadProperty(ref reader, options, PropHypothesisTemplate, null)) + { + continue; + } + + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMultiLabel.TryReadProperty(ref reader, options, PropMultiLabel, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClassificationLabels = propClassificationLabels.Value, + HypothesisTemplate = propHypothesisTemplate.Value, + Labels = propLabels.Value, + MultiLabel = propMultiLabel.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassificationLabels, value.ClassificationLabels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHypothesisTemplate, value.HypothesisTemplate, null, null); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMultiLabel, value.MultiLabel, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Zero shot classification configuration options /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsConverter))] public sealed partial class ZeroShotClassificationInferenceOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceOptions(System.Collections.Generic.ICollection classificationLabels) + { + ClassificationLabels = classificationLabels; + } +#if NET7_0_OR_GREATER + public ZeroShotClassificationInferenceOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ZeroShotClassificationInferenceOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ZeroShotClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The zero shot classification labels indicating entailment, neutral, and contradiction /// Must contain exactly and only entailment, neutral, and contradiction /// /// - [JsonInclude, JsonPropertyName("classification_labels")] - public ICollection ClassificationLabels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection ClassificationLabels { get; set; } /// /// /// Hypothesis template used when tokenizing labels for prediction /// /// - [JsonInclude, JsonPropertyName("hypothesis_template")] public string? HypothesisTemplate { get; set; } /// @@ -56,15 +161,13 @@ public sealed partial class ZeroShotClassificationInferenceOptions /// The labels to predict. /// /// - [JsonInclude, JsonPropertyName("labels")] - public ICollection? Labels { get; set; } + public System.Collections.Generic.ICollection? Labels { get; set; } /// /// /// Indicates if more than one true label exists. /// /// - [JsonInclude, JsonPropertyName("multi_label")] public bool? MultiLabel { get; set; } /// @@ -72,7 +175,6 @@ public sealed partial class ZeroShotClassificationInferenceOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -80,10 +182,7 @@ public sealed partial class ZeroShotClassificationInferenceOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate(ZeroShotClassificationInferenceOptions zeroShotClassificationInferenceOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigCreate.ZeroShotClassification(zeroShotClassificationInferenceOptions); } /// @@ -91,22 +190,24 @@ public sealed partial class ZeroShotClassificationInferenceOptions /// Zero shot classification configuration options /// /// -public sealed partial class ZeroShotClassificationInferenceOptionsDescriptor : SerializableDescriptor +public readonly partial struct ZeroShotClassificationInferenceOptionsDescriptor { - internal ZeroShotClassificationInferenceOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions instance) + { + Instance = instance; + } - public ZeroShotClassificationInferenceOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection ClassificationLabelsValue { get; set; } - private string? HypothesisTemplateValue { get; set; } - private ICollection? LabelsValue { get; set; } - private bool? MultiLabelValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor descriptor) => descriptor.Instance; /// /// @@ -114,10 +215,22 @@ public ZeroShotClassificationInferenceOptionsDescriptor() : base() /// Must contain exactly and only entailment, neutral, and contradiction /// /// - public ZeroShotClassificationInferenceOptionsDescriptor ClassificationLabels(ICollection classificationLabels) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor ClassificationLabels(System.Collections.Generic.ICollection value) { - ClassificationLabelsValue = classificationLabels; - return Self; + Instance.ClassificationLabels = value; + return this; + } + + /// + /// + /// The zero shot classification labels indicating entailment, neutral, and contradiction + /// Must contain exactly and only entailment, neutral, and contradiction + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor ClassificationLabels(params string[] values) + { + Instance.ClassificationLabels = [.. values]; + return this; } /// @@ -125,10 +238,10 @@ public ZeroShotClassificationInferenceOptionsDescriptor ClassificationLabels(ICo /// Hypothesis template used when tokenizing labels for prediction /// /// - public ZeroShotClassificationInferenceOptionsDescriptor HypothesisTemplate(string? hypothesisTemplate) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor HypothesisTemplate(string? value) { - HypothesisTemplateValue = hypothesisTemplate; - return Self; + Instance.HypothesisTemplate = value; + return this; } /// @@ -136,108 +249,72 @@ public ZeroShotClassificationInferenceOptionsDescriptor HypothesisTemplate(strin /// The labels to predict. /// /// - public ZeroShotClassificationInferenceOptionsDescriptor Labels(ICollection? labels) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor Labels(System.Collections.Generic.ICollection? value) { - LabelsValue = labels; - return Self; + Instance.Labels = value; + return this; } /// /// - /// Indicates if more than one true label exists. + /// The labels to predict. /// /// - public ZeroShotClassificationInferenceOptionsDescriptor MultiLabel(bool? multiLabel = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor Labels(params string[] values) { - MultiLabelValue = multiLabel; - return Self; + Instance.Labels = [.. values]; + return this; } /// /// - /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. + /// Indicates if more than one true label exists. /// /// - public ZeroShotClassificationInferenceOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor MultiLabel(bool? value = true) { - ResultsFieldValue = resultsField; - return Self; + Instance.MultiLabel = value; + return this; } /// /// - /// The tokenization options to update when inferring + /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public ZeroShotClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor ResultsField(string? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.ResultsField = value; + return this; } - public ZeroShotClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfig? value) { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = value; + return this; } - public ZeroShotClassificationInferenceOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor Tokenization(System.Action action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("classification_labels"); - JsonSerializer.Serialize(writer, ClassificationLabelsValue, options); - if (!string.IsNullOrEmpty(HypothesisTemplateValue)) - { - writer.WritePropertyName("hypothesis_template"); - writer.WriteStringValue(HypothesisTemplateValue); - } - - if (LabelsValue is not null) - { - writer.WritePropertyName("labels"); - JsonSerializer.Serialize(writer, LabelsValue, options); - } - - if (MultiLabelValue.HasValue) - { - writer.WritePropertyName("multi_label"); - writer.WriteBooleanValue(MultiLabelValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.TokenizationConfigDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceUpdateOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceUpdateOptions.g.cs index d42a5777652..1397aa5982b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceUpdateOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MachineLearning/ZeroShotClassificationInferenceUpdateOptions.g.cs @@ -17,32 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.MachineLearning; +internal sealed partial class ZeroShotClassificationInferenceUpdateOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropMultiLabel = System.Text.Json.JsonEncodedText.Encode("multi_label"); + private static readonly System.Text.Json.JsonEncodedText PropResultsField = System.Text.Json.JsonEncodedText.Encode("results_field"); + private static readonly System.Text.Json.JsonEncodedText PropTokenization = System.Text.Json.JsonEncodedText.Encode("tokenization"); + + public override Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propLabels = default; + LocalJsonValue propMultiLabel = default; + LocalJsonValue propResultsField = default; + LocalJsonValue propTokenization = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMultiLabel.TryReadProperty(ref reader, options, PropMultiLabel, null)) + { + continue; + } + + if (propResultsField.TryReadProperty(ref reader, options, PropResultsField, null)) + { + continue; + } + + if (propTokenization.TryReadProperty(ref reader, options, PropTokenization, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Labels = propLabels.Value, + MultiLabel = propMultiLabel.Value, + ResultsField = propResultsField.Value, + Tokenization = propTokenization.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMultiLabel, value.MultiLabel, null, null); + writer.WriteProperty(options, PropResultsField, value.ResultsField, null, null); + writer.WriteProperty(options, PropTokenization, value.Tokenization, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsConverter))] public sealed partial class ZeroShotClassificationInferenceUpdateOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceUpdateOptions(System.Collections.Generic.ICollection labels) + { + Labels = labels; + } +#if NET7_0_OR_GREATER + public ZeroShotClassificationInferenceUpdateOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ZeroShotClassificationInferenceUpdateOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ZeroShotClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The labels to predict. /// /// - [JsonInclude, JsonPropertyName("labels")] - public ICollection Labels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Labels { get; set; } /// /// /// Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value. /// /// - [JsonInclude, JsonPropertyName("multi_label")] public bool? MultiLabel { get; set; } /// @@ -50,7 +137,6 @@ public sealed partial class ZeroShotClassificationInferenceUpdateOptions /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - [JsonInclude, JsonPropertyName("results_field")] public string? ResultsField { get; set; } /// @@ -58,36 +144,48 @@ public sealed partial class ZeroShotClassificationInferenceUpdateOptions /// The tokenization options to update when inferring /// /// - [JsonInclude, JsonPropertyName("tokenization")] public Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? Tokenization { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate(ZeroShotClassificationInferenceUpdateOptions zeroShotClassificationInferenceUpdateOptions) => Elastic.Clients.Elasticsearch.MachineLearning.InferenceConfigUpdate.ZeroShotClassification(zeroShotClassificationInferenceUpdateOptions); } -public sealed partial class ZeroShotClassificationInferenceUpdateOptionsDescriptor : SerializableDescriptor +public readonly partial struct ZeroShotClassificationInferenceUpdateOptionsDescriptor { - internal ZeroShotClassificationInferenceUpdateOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions instance) + { + Instance = instance; + } - public ZeroShotClassificationInferenceUpdateOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ZeroShotClassificationInferenceUpdateOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection LabelsValue { get; set; } - private bool? MultiLabelValue { get; set; } - private string? ResultsFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? TokenizationValue { get; set; } - private Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor TokenizationDescriptor { get; set; } - private Action TokenizationDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions instance) => new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor descriptor) => descriptor.Instance; /// /// /// The labels to predict. /// /// - public ZeroShotClassificationInferenceUpdateOptionsDescriptor Labels(ICollection labels) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor Labels(System.Collections.Generic.ICollection value) { - LabelsValue = labels; - return Self; + Instance.Labels = value; + return this; + } + + /// + /// + /// The labels to predict. + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor Labels(params string[] values) + { + Instance.Labels = [.. values]; + return this; } /// @@ -95,10 +193,10 @@ public ZeroShotClassificationInferenceUpdateOptionsDescriptor Labels(ICollection /// Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value. /// /// - public ZeroShotClassificationInferenceUpdateOptionsDescriptor MultiLabel(bool? multiLabel = true) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor MultiLabel(bool? value = true) { - MultiLabelValue = multiLabel; - return Self; + Instance.MultiLabel = value; + return this; } /// @@ -106,10 +204,10 @@ public ZeroShotClassificationInferenceUpdateOptionsDescriptor MultiLabel(bool? m /// The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. /// /// - public ZeroShotClassificationInferenceUpdateOptionsDescriptor ResultsField(string? resultsField) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor ResultsField(string? value) { - ResultsFieldValue = resultsField; - return Self; + Instance.ResultsField = value; + return this; } /// @@ -117,63 +215,39 @@ public ZeroShotClassificationInferenceUpdateOptionsDescriptor ResultsField(strin /// The tokenization options to update when inferring /// /// - public ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? tokenization) + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptions? value) { - TokenizationDescriptor = null; - TokenizationDescriptorAction = null; - TokenizationValue = tokenization; - return Self; + Instance.Tokenization = value; + return this; } - public ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization(Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor descriptor) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization() { - TokenizationValue = null; - TokenizationDescriptorAction = null; - TokenizationDescriptor = descriptor; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(null); + return this; } - public ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization(Action configure) + /// + /// + /// The tokenization options to update when inferring + /// + /// + public Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor Tokenization(System.Action? action) { - TokenizationValue = null; - TokenizationDescriptor = null; - TokenizationDescriptorAction = configure; - return Self; + Instance.Tokenization = Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("labels"); - JsonSerializer.Serialize(writer, LabelsValue, options); - if (MultiLabelValue.HasValue) - { - writer.WritePropertyName("multi_label"); - writer.WriteBooleanValue(MultiLabelValue.Value); - } - - if (!string.IsNullOrEmpty(ResultsFieldValue)) - { - writer.WritePropertyName("results_field"); - writer.WriteStringValue(ResultsFieldValue); - } - - if (TokenizationDescriptor is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationDescriptor, options); - } - else if (TokenizationDescriptorAction is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.MachineLearning.NlpTokenizationUpdateOptionsDescriptor(TokenizationDescriptorAction), options); - } - else if (TokenizationValue is not null) - { - writer.WritePropertyName("tokenization"); - JsonSerializer.Serialize(writer, TokenizationValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptionsDescriptor(new Elastic.Clients.Elasticsearch.MachineLearning.ZeroShotClassificationInferenceUpdateOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AggregateMetricDoubleProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AggregateMetricDoubleProperty.g.cs index b1417a7bf30..cb6ab28d31f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AggregateMetricDoubleProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AggregateMetricDoubleProperty.g.cs @@ -17,25 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class AggregateMetricDoubleProperty : IProperty +internal sealed partial class AggregateMetricDoublePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefaultMetric = System.Text.Json.JsonEncodedText.Encode("default_metric"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefaultMetric = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue> propMetrics = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefaultMetric.TryReadProperty(ref reader, options, PropDefaultMetric, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DefaultMetric = propDefaultMetric.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Metrics = propMetrics.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefaultMetric, value.DefaultMetric, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyConverter))] +public sealed partial class AggregateMetricDoubleProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("default_metric")] - public string DefaultMetric { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateMetricDoubleProperty(string defaultMetric, System.Collections.Generic.ICollection metrics) + { + DefaultMetric = defaultMetric; + Metrics = metrics; + } +#if NET7_0_OR_GREATER + public AggregateMetricDoubleProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AggregateMetricDoubleProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string DefaultMetric { get; set; } public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -43,75 +182,66 @@ public sealed partial class AggregateMetricDoubleProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("metrics")] - public ICollection Metrics { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Metrics { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "aggregate_metric_double"; } -public sealed partial class AggregateMetricDoublePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct AggregateMetricDoublePropertyDescriptor { - internal AggregateMetricDoublePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty Instance { get; init; } - public AggregateMetricDoublePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateMetricDoublePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty instance) { + Instance = instance; } - private string DefaultMetricValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } - - public AggregateMetricDoublePropertyDescriptor DefaultMetric(string defaultMetric) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateMetricDoublePropertyDescriptor() { - DefaultMetricValue = defaultMetric; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public AggregateMetricDoublePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor DefaultMetric(string value) { - DynamicValue = dynamic; - return Self; + Instance.DefaultMetric = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -119,172 +249,139 @@ public AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? ignor /// Metadata about the field. /// /// - public AggregateMetricDoublePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Metrics(ICollection metrics) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta() { - MetricsValue = metrics; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Metrics(System.Collections.Generic.ICollection value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Metrics = value; + return this; } - public AggregateMetricDoublePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Metrics(params string[] values) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Metrics = [.. values]; + return this; } - public AggregateMetricDoublePropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("default_metric"); - writer.WriteStringValue(DefaultMetricValue); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("aggregate_metric_double"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) + { + Instance.TimeSeriesMetric = value; + return this; } - AggregateMetricDoubleProperty IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty Build(System.Action> action) { - DefaultMetric = DefaultMetricValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Metrics = MetricsValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class AggregateMetricDoublePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct AggregateMetricDoublePropertyDescriptor { - internal AggregateMetricDoublePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateMetricDoublePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty instance) + { + Instance = instance; + } - public AggregateMetricDoublePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AggregateMetricDoublePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string DefaultMetricValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private ICollection MetricsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor descriptor) => descriptor.Instance; - public AggregateMetricDoublePropertyDescriptor DefaultMetric(string defaultMetric) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor DefaultMetric(string value) { - DefaultMetricValue = defaultMetric; - return Self; + Instance.DefaultMetric = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public AggregateMetricDoublePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -292,114 +389,88 @@ public AggregateMetricDoublePropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public AggregateMetricDoublePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public AggregateMetricDoublePropertyDescriptor Metrics(ICollection metrics) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta() { - MetricsValue = metrics; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public AggregateMetricDoublePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Metrics(System.Collections.Generic.ICollection value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Metrics = value; + return this; } - public AggregateMetricDoublePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Metrics(params string[] values) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Metrics = [.. values]; + return this; } - public AggregateMetricDoublePropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("default_metric"); - writer.WriteStringValue(DefaultMetricValue); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("aggregate_metric_double"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) + { + Instance.TimeSeriesMetric = value; + return this; } - AggregateMetricDoubleProperty IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty Build(System.Action action) { - DefaultMetric = DefaultMetricValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Metrics = MetricsValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AllField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AllField.g.cs index 82fcb7b2366..16f5fd65eba 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AllField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/AllField.g.cs @@ -17,142 +17,302 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class AllFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropOmitNorms = System.Text.Json.JsonEncodedText.Encode("omit_norms"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropStoreTermVectorOffsets = System.Text.Json.JsonEncodedText.Encode("store_term_vector_offsets"); + private static readonly System.Text.Json.JsonEncodedText PropStoreTermVectorPayloads = System.Text.Json.JsonEncodedText.Encode("store_term_vector_payloads"); + private static readonly System.Text.Json.JsonEncodedText PropStoreTermVectorPositions = System.Text.Json.JsonEncodedText.Encode("store_term_vector_positions"); + private static readonly System.Text.Json.JsonEncodedText PropStoreTermVectors = System.Text.Json.JsonEncodedText.Encode("store_term_vectors"); + + public override Elastic.Clients.Elasticsearch.Mapping.AllField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propOmitNorms = default; + LocalJsonValue propSearchAnalyzer = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propStore = default; + LocalJsonValue propStoreTermVectorOffsets = default; + LocalJsonValue propStoreTermVectorPayloads = default; + LocalJsonValue propStoreTermVectorPositions = default; + LocalJsonValue propStoreTermVectors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propOmitNorms.TryReadProperty(ref reader, options, PropOmitNorms, null)) + { + continue; + } + + if (propSearchAnalyzer.TryReadProperty(ref reader, options, PropSearchAnalyzer, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propStoreTermVectorOffsets.TryReadProperty(ref reader, options, PropStoreTermVectorOffsets, null)) + { + continue; + } + + if (propStoreTermVectorPayloads.TryReadProperty(ref reader, options, PropStoreTermVectorPayloads, null)) + { + continue; + } + + if (propStoreTermVectorPositions.TryReadProperty(ref reader, options, PropStoreTermVectorPositions, null)) + { + continue; + } + + if (propStoreTermVectors.TryReadProperty(ref reader, options, PropStoreTermVectors, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.AllField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Enabled = propEnabled.Value, + OmitNorms = propOmitNorms.Value, + SearchAnalyzer = propSearchAnalyzer.Value, + Similarity = propSimilarity.Value, + Store = propStore.Value, + StoreTermVectorOffsets = propStoreTermVectorOffsets.Value, + StoreTermVectorPayloads = propStoreTermVectorPayloads.Value, + StoreTermVectorPositions = propStoreTermVectorPositions.Value, + StoreTermVectors = propStoreTermVectors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.AllField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropOmitNorms, value.OmitNorms, null, null); + writer.WriteProperty(options, PropSearchAnalyzer, value.SearchAnalyzer, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropStoreTermVectorOffsets, value.StoreTermVectorOffsets, null, null); + writer.WriteProperty(options, PropStoreTermVectorPayloads, value.StoreTermVectorPayloads, null, null); + writer.WriteProperty(options, PropStoreTermVectorPositions, value.StoreTermVectorPositions, null, null); + writer.WriteProperty(options, PropStoreTermVectors, value.StoreTermVectors, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.AllFieldConverter))] public sealed partial class AllField { - [JsonInclude, JsonPropertyName("analyzer")] - public string Analyzer { get; set; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } - [JsonInclude, JsonPropertyName("omit_norms")] - public bool OmitNorms { get; set; } - [JsonInclude, JsonPropertyName("search_analyzer")] - public string SearchAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("similarity")] - public string Similarity { get; set; } - [JsonInclude, JsonPropertyName("store")] - public bool Store { get; set; } - [JsonInclude, JsonPropertyName("store_term_vector_offsets")] - public bool StoreTermVectorOffsets { get; set; } - [JsonInclude, JsonPropertyName("store_term_vector_payloads")] - public bool StoreTermVectorPayloads { get; set; } - [JsonInclude, JsonPropertyName("store_term_vector_positions")] - public bool StoreTermVectorPositions { get; set; } - [JsonInclude, JsonPropertyName("store_term_vectors")] - public bool StoreTermVectors { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllField(string analyzer, bool enabled, bool omitNorms, string searchAnalyzer, string similarity, bool store, bool storeTermVectorOffsets, bool storeTermVectorPayloads, bool storeTermVectorPositions, bool storeTermVectors) + { + Analyzer = analyzer; + Enabled = enabled; + OmitNorms = omitNorms; + SearchAnalyzer = searchAnalyzer; + Similarity = similarity; + Store = store; + StoreTermVectorOffsets = storeTermVectorOffsets; + StoreTermVectorPayloads = storeTermVectorPayloads; + StoreTermVectorPositions = storeTermVectorPositions; + StoreTermVectors = storeTermVectors; + } +#if NET7_0_OR_GREATER + public AllField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AllField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AllField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Analyzer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool OmitNorms { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string SearchAnalyzer { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Similarity { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Store { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool StoreTermVectorOffsets { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool StoreTermVectorPayloads { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool StoreTermVectorPositions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool StoreTermVectors { get; set; } } -public sealed partial class AllFieldDescriptor : SerializableDescriptor +public readonly partial struct AllFieldDescriptor { - internal AllFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.AllField Instance { get; init; } - public AllFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.AllField instance) { + Instance = instance; } - private string AnalyzerValue { get; set; } - private bool EnabledValue { get; set; } - private bool OmitNormsValue { get; set; } - private string SearchAnalyzerValue { get; set; } - private string SimilarityValue { get; set; } - private bool StoreValue { get; set; } - private bool StoreTermVectorOffsetsValue { get; set; } - private bool StoreTermVectorPayloadsValue { get; set; } - private bool StoreTermVectorPositionsValue { get; set; } - private bool StoreTermVectorsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AllFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.AllField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.AllField instance) => new Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.AllField(Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor descriptor) => descriptor.Instance; - public AllFieldDescriptor Analyzer(string analyzer) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor Analyzer(string value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public AllFieldDescriptor Enabled(bool enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - public AllFieldDescriptor OmitNorms(bool omitNorms = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor OmitNorms(bool value = true) { - OmitNormsValue = omitNorms; - return Self; + Instance.OmitNorms = value; + return this; } - public AllFieldDescriptor SearchAnalyzer(string searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor SearchAnalyzer(string value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public AllFieldDescriptor Similarity(string similarity) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor Similarity(string value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - public AllFieldDescriptor Store(bool store = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor Store(bool value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public AllFieldDescriptor StoreTermVectorOffsets(bool storeTermVectorOffsets = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor StoreTermVectorOffsets(bool value = true) { - StoreTermVectorOffsetsValue = storeTermVectorOffsets; - return Self; + Instance.StoreTermVectorOffsets = value; + return this; } - public AllFieldDescriptor StoreTermVectorPayloads(bool storeTermVectorPayloads = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor StoreTermVectorPayloads(bool value = true) { - StoreTermVectorPayloadsValue = storeTermVectorPayloads; - return Self; + Instance.StoreTermVectorPayloads = value; + return this; } - public AllFieldDescriptor StoreTermVectorPositions(bool storeTermVectorPositions = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor StoreTermVectorPositions(bool value = true) { - StoreTermVectorPositionsValue = storeTermVectorPositions; - return Self; + Instance.StoreTermVectorPositions = value; + return this; } - public AllFieldDescriptor StoreTermVectors(bool storeTermVectors = true) + public Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor StoreTermVectors(bool value = true) { - StoreTermVectorsValue = storeTermVectors; - return Self; + Instance.StoreTermVectors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.AllField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WritePropertyName("omit_norms"); - writer.WriteBooleanValue(OmitNormsValue); - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue); - writer.WritePropertyName("store_term_vector_offsets"); - writer.WriteBooleanValue(StoreTermVectorOffsetsValue); - writer.WritePropertyName("store_term_vector_payloads"); - writer.WriteBooleanValue(StoreTermVectorPayloadsValue); - writer.WritePropertyName("store_term_vector_positions"); - writer.WriteBooleanValue(StoreTermVectorPositionsValue); - writer.WritePropertyName("store_term_vectors"); - writer.WriteBooleanValue(StoreTermVectorsValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.AllField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BinaryProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BinaryProperty.g.cs index eb7a74b2dfd..e876e8c452b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BinaryProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BinaryProperty.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class BinaryProperty : IProperty +internal sealed partial class BinaryPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.BinaryProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyConverter))] +public sealed partial class BinaryProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public BinaryProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public BinaryProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -46,79 +172,73 @@ public sealed partial class BinaryProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "binary"; } -public sealed partial class BinaryPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct BinaryPropertyDescriptor { - internal BinaryPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.BinaryProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BinaryPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty instance) + { + Instance = instance; + } - public BinaryPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BinaryPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor descriptor) => descriptor.Instance; - public BinaryPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public BinaryPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public BinaryPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public BinaryPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BinaryPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -126,180 +246,144 @@ public BinaryPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public BinaryPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public BinaryPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public BinaryPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public BinaryPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + Instance.Store = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (PropertiesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.BinaryProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } +public readonly partial struct BinaryPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.BinaryProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("binary"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BinaryPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty instance) + { + Instance = instance; } - BinaryProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BinaryPropertyDescriptor() { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} + Instance = new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } -public sealed partial class BinaryPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal BinaryPropertyDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor descriptor) => descriptor.Instance; - public BinaryPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public BinaryPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public BinaryPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public BinaryPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public BinaryPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BinaryPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BinaryPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -307,116 +391,81 @@ public BinaryPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public BinaryPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public BinaryPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public BinaryPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public BinaryPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.BinaryProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("binary"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.BinaryProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - BinaryProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BooleanProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BooleanProperty.g.cs index 3823bc9de08..b7c6ef3ec61 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BooleanProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/BooleanProperty.g.cs @@ -17,34 +17,230 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class BooleanProperty : IProperty +internal sealed partial class BooleanPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("boost")] + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.BooleanProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fielddata = propFielddata.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyConverter))] +public sealed partial class BooleanProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public BooleanProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public BooleanProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fielddata")] public Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? Fielddata { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] + public bool? IgnoreMalformed { get; set; } public bool? Index { get; set; } /// @@ -52,123 +248,113 @@ public sealed partial class BooleanProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? NullValue { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] + public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] + /// + /// + /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. + /// + /// + public bool? TimeSeriesDimension { get; set; } + public string Type => "boolean"; } -public sealed partial class BooleanPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct BooleanPropertyDescriptor { - internal BooleanPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.BooleanProperty Instance { get; init; } - public BooleanPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BooleanPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor FielddataDescriptor { get; set; } - private Action FielddataDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BooleanPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor descriptor) => descriptor.Instance; - public BooleanPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public BooleanPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public BooleanPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public BooleanPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? fielddata) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FielddataDescriptor = null; - FielddataDescriptorAction = null; - FielddataValue = fielddata; - return Self; + Instance.Dynamic = value; + return this; } - public BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? value) { - FielddataValue = null; - FielddataDescriptorAction = null; - FielddataDescriptor = descriptor; - return Self; + Instance.Fielddata = value; + return this; } - public BooleanPropertyDescriptor Fielddata(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fielddata(System.Action action) { - FielddataValue = null; - FielddataDescriptor = null; - FielddataDescriptorAction = configure; - return Self; + Instance.Fielddata = Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor.Build(action); + return this; } - public BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BooleanPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public BooleanPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public BooleanPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -176,290 +362,215 @@ public BooleanPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public BooleanPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public BooleanPropertyDescriptor NullValue(bool? nullValue = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public BooleanPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor NullValue(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public BooleanPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - StoreValue = store; - return Self; + Instance.OnScriptError = value; + return this; } - public BooleanPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FielddataDescriptor is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataDescriptor, options); - } - else if (FielddataDescriptorAction is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction), options); - } - else if (FielddataValue is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteBooleanValue(NullValueValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("boolean"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? BuildFielddata() + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - if (FielddataValue is not null) - { - return FielddataValue; - } + Instance.SyntheticSourceKeep = value; + return this; + } - if ((object)FielddataDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + /// + /// + /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor TimeSeriesDimension(bool? value = true) + { + Instance.TimeSeriesDimension = value; + return this; + } - if (FielddataDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.BooleanProperty Build(System.Action>? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - BooleanProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fielddata = BuildFielddata(), - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class BooleanPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct BooleanPropertyDescriptor { - internal BooleanPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.BooleanProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BooleanPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty instance) + { + Instance = instance; + } - public BooleanPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BooleanPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor FielddataDescriptor { get; set; } - private Action FielddataDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public BooleanPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public BooleanPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public BooleanPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public BooleanPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? fielddata) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? value) { - FielddataDescriptor = null; - FielddataDescriptorAction = null; - FielddataValue = fielddata; - return Self; + Instance.Fielddata = value; + return this; } - public BooleanPropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fielddata(System.Action action) { - FielddataValue = null; - FielddataDescriptorAction = null; - FielddataDescriptor = descriptor; - return Self; + Instance.Fielddata = Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor.Build(action); + return this; } - public BooleanPropertyDescriptor Fielddata(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FielddataValue = null; - FielddataDescriptor = null; - FielddataDescriptorAction = configure; - return Self; + Instance.Fields = value; + return this; } - public BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fields(System.Action action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BooleanPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public BooleanPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public BooleanPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public BooleanPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -467,184 +578,122 @@ public BooleanPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public BooleanPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public BooleanPropertyDescriptor NullValue(bool? nullValue = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public BooleanPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor NullValue(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public BooleanPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - StoreValue = store; - return Self; + Instance.OnScriptError = value; + return this; } - public BooleanPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FielddataDescriptor is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataDescriptor, options); - } - else if (FielddataDescriptorAction is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction), options); - } - else if (FielddataValue is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteBooleanValue(NullValueValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("boolean"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? BuildFielddata() + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - if (FielddataValue is not null) - { - return FielddataValue; - } + Instance.SyntheticSourceKeep = value; + return this; + } - if ((object)FielddataDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + /// + /// + /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor TimeSeriesDimension(bool? value = true) + { + Instance.TimeSeriesDimension = value; + return this; + } - if (FielddataDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.BooleanProperty Build(System.Action? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - BooleanProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fielddata = BuildFielddata(), - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.BooleanProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ByteNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ByteNumberProperty.g.cs index 3d0ed7df7e3..e3aa8d3565f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ByteNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ByteNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class ByteNumberProperty : IProperty +internal sealed partial class ByteNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyConverter))] +public sealed partial class ByteNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public ByteNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ByteNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class ByteNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public byte? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class ByteNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class ByteNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "byte"; } -public sealed partial class ByteNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ByteNumberPropertyDescriptor { - internal ByteNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty Instance { get; init; } - public ByteNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ByteNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private byte? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ByteNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public ByteNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public ByteNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public ByteNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ByteNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public ByteNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ByteNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ByteNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public ByteNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public ByteNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ByteNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ByteNumberPropertyDescriptor NullValue(byte? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ByteNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor NullValue(byte? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public ByteNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public ByteNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ByteNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clien /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ByteNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public ByteNumberPropertyDescriptor TimeSeriesDimension(bool? timeSer /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ByteNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct ByteNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("byte"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ByteNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ByteNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - ByteNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class ByteNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal ByteNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public ByteNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private byte? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public ByteNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public ByteNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public ByteNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public ByteNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public ByteNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ByteNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ByteNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public ByteNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public ByteNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public ByteNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ByteNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ByteNumberPropertyDescriptor NullValue(byte? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor NullValue(byte? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public ByteNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public ByteNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ByteNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ByteNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ByteNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public ByteNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elastics /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ByteNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public ByteNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimensio /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ByteNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("byte"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - ByteNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompletionProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompletionProperty.g.cs index e5852e1fc41..fb08a98c18e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompletionProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompletionProperty.g.cs @@ -17,34 +17,211 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class CompletionProperty : IProperty +internal sealed partial class CompletionPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMaxInputLength = System.Text.Json.JsonEncodedText.Encode("max_input_length"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropPreservePositionIncrements = System.Text.Json.JsonEncodedText.Encode("preserve_position_increments"); + private static readonly System.Text.Json.JsonEncodedText PropPreserveSeparators = System.Text.Json.JsonEncodedText.Encode("preserve_separators"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.CompletionProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue?> propContexts = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propMaxInputLength = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPreservePositionIncrements = default; + LocalJsonValue propPreserveSeparators = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSearchAnalyzer = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMaxInputLength.TryReadProperty(ref reader, options, PropMaxInputLength, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPreservePositionIncrements.TryReadProperty(ref reader, options, PropPreservePositionIncrements, null)) + { + continue; + } + + if (propPreserveSeparators.TryReadProperty(ref reader, options, PropPreserveSeparators, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSearchAnalyzer.TryReadProperty(ref reader, options, PropSearchAnalyzer, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Contexts = propContexts.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + MaxInputLength = propMaxInputLength.Value, + Meta = propMeta.Value, + PreservePositionIncrements = propPreservePositionIncrements.Value, + PreserveSeparators = propPreserveSeparators.Value, + Properties = propProperties.Value, + SearchAnalyzer = propSearchAnalyzer.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMaxInputLength, value.MaxInputLength, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPreservePositionIncrements, value.PreservePositionIncrements, null, null); + writer.WriteProperty(options, PropPreserveSeparators, value.PreserveSeparators, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSearchAnalyzer, value.SearchAnalyzer, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyConverter))] +public sealed partial class CompletionProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("analyzer")] +#if NET7_0_OR_GREATER + public CompletionProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public CompletionProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Analyzer { get; set; } - [JsonInclude, JsonPropertyName("contexts")] - public ICollection? Contexts { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public System.Collections.Generic.ICollection? Contexts { get; set; } public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("max_input_length")] public int? MaxInputLength { get; set; } /// @@ -52,142 +229,112 @@ public sealed partial class CompletionProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("preserve_position_increments")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? PreservePositionIncrements { get; set; } - [JsonInclude, JsonPropertyName("preserve_separators")] public bool? PreserveSeparators { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("search_analyzer")] public string? SearchAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "completion"; } -public sealed partial class CompletionPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct CompletionPropertyDescriptor { - internal CompletionPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.CompletionProperty Instance { get; init; } - public CompletionPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private ICollection? ContextsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor ContextsDescriptor { get; set; } - private Action> ContextsDescriptorAction { get; set; } - private Action>[] ContextsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private int? MaxInputLengthValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PreservePositionIncrementsValue { get; set; } - private bool? PreserveSeparatorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public CompletionPropertyDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionPropertyDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public CompletionPropertyDescriptor Contexts(ICollection? contexts) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Analyzer(string? value) { - ContextsDescriptor = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = null; - ContextsValue = contexts; - return Self; + Instance.Analyzer = value; + return this; } - public CompletionPropertyDescriptor Contexts(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(System.Collections.Generic.ICollection? value) { - ContextsValue = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = null; - ContextsDescriptor = descriptor; - return Self; + Instance.Contexts = value; + return this; } - public CompletionPropertyDescriptor Contexts(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(params Elastic.Clients.Elasticsearch.Mapping.SuggestContext[] values) { - ContextsValue = null; - ContextsDescriptor = null; - ContextsDescriptorActions = null; - ContextsDescriptorAction = configure; - return Self; + Instance.Contexts = [.. values]; + return this; } - public CompletionPropertyDescriptor Contexts(params Action>[] configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(params System.Action>[] actions) { - ContextsValue = null; - ContextsDescriptor = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor.Build(action)); + } + + Instance.Contexts = items; + return this; } - public CompletionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public CompletionPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public CompletionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public CompletionPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public CompletionPropertyDescriptor MaxInputLength(int? maxInputLength) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor MaxInputLength(int? value) { - MaxInputLengthValue = maxInputLength; - return Self; + Instance.MaxInputLength = value; + return this; } /// @@ -195,346 +342,232 @@ public CompletionPropertyDescriptor MaxInputLength(int? maxInputLengt /// Metadata about the field. /// /// - public CompletionPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public CompletionPropertyDescriptor PreservePositionIncrements(bool? preservePositionIncrements = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta() { - PreservePositionIncrementsValue = preservePositionIncrements; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public CompletionPropertyDescriptor PreserveSeparators(bool? preserveSeparators = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta(System.Action? action) { - PreserveSeparatorsValue = preserveSeparators; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor PreservePositionIncrements(bool? value = true) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PreservePositionIncrements = value; + return this; } - public CompletionPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor PreserveSeparators(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PreserveSeparators = value; + return this; } - public CompletionPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = value; + return this; } - public CompletionPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Properties(System.Action> action) { - StoreValue = store; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor SearchAnalyzer(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SearchAnalyzer = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (ContextsDescriptor is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ContextsDescriptor, options); - writer.WriteEndArray(); - } - else if (ContextsDescriptorAction is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(ContextsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ContextsDescriptorActions is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - foreach (var action in ContextsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ContextsValue is not null) - { - writer.WritePropertyName("contexts"); - JsonSerializer.Serialize(writer, ContextsValue, options); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MaxInputLengthValue.HasValue) - { - writer.WritePropertyName("max_input_length"); - writer.WriteNumberValue(MaxInputLengthValue.Value); - } + Instance.Store = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (PreservePositionIncrementsValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.CompletionProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("preserve_position_increments"); - writer.WriteBooleanValue(PreservePositionIncrementsValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (PreserveSeparatorsValue.HasValue) - { - writer.WritePropertyName("preserve_separators"); - writer.WriteBooleanValue(PreserveSeparatorsValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } +public readonly partial struct CompletionPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.CompletionProperty Instance { get; init; } - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty instance) + { + Instance = instance; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompletionPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor descriptor) => descriptor.Instance; - writer.WritePropertyName("type"); - writer.WriteStringValue("completion"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; } - private ICollection? BuildContexts() + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(System.Collections.Generic.ICollection? value) { - if (ContextsValue is not null) - { - return ContextsValue; - } + Instance.Contexts = value; + return this; + } - if ((object)ContextsDescriptor is IBuildableDescriptor?> buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(params Elastic.Clients.Elasticsearch.Mapping.SuggestContext[] values) + { + Instance.Contexts = [.. values]; + return this; + } - if (ContextsDescriptorAction is not null) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(ContextsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor?> buildableFromAction) - { - return buildableFromAction.Build(); - } + items.Add(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor.Build(action)); } - return null; - } - - CompletionProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Contexts = BuildContexts(), - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - MaxInputLength = MaxInputLengthValue, - Meta = MetaValue, - PreservePositionIncrements = PreservePositionIncrementsValue, - PreserveSeparators = PreserveSeparatorsValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} - -public sealed partial class CompletionPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal CompletionPropertyDescriptor(Action configure) => configure.Invoke(this); - - public CompletionPropertyDescriptor() : base() - { + Instance.Contexts = items; + return this; } - private string? AnalyzerValue { get; set; } - private ICollection? ContextsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor ContextsDescriptor { get; set; } - private Action ContextsDescriptorAction { get; set; } - private Action[] ContextsDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private int? MaxInputLengthValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PreservePositionIncrementsValue { get; set; } - private bool? PreserveSeparatorsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public CompletionPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Contexts(params System.Action>[] actions) { - AnalyzerValue = analyzer; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor.Build(action)); + } - public CompletionPropertyDescriptor Contexts(ICollection? contexts) - { - ContextsDescriptor = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = null; - ContextsValue = contexts; - return Self; + Instance.Contexts = items; + return this; } - public CompletionPropertyDescriptor Contexts(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - ContextsValue = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = null; - ContextsDescriptor = descriptor; - return Self; + Instance.CopyTo = value; + return this; } - public CompletionPropertyDescriptor Contexts(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - ContextsValue = null; - ContextsDescriptor = null; - ContextsDescriptorActions = null; - ContextsDescriptorAction = configure; - return Self; + Instance.CopyTo = value; + return this; } - public CompletionPropertyDescriptor Contexts(params Action[] configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor DocValues(bool? value = true) { - ContextsValue = null; - ContextsDescriptor = null; - ContextsDescriptorAction = null; - ContextsDescriptorActions = configure; - return Self; + Instance.DocValues = value; + return this; } - public CompletionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public CompletionPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public CompletionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public CompletionPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor MaxInputLength(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.MaxInputLength = value; + return this; } - public CompletionPropertyDescriptor IgnoreAbove(int? ignoreAbove) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Meta = value; + return this; } - public CompletionPropertyDescriptor MaxInputLength(int? maxInputLength) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta() { - MaxInputLengthValue = maxInputLength; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -542,225 +575,77 @@ public CompletionPropertyDescriptor MaxInputLength(int? maxInputLength) /// Metadata about the field. /// /// - public CompletionPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Meta(System.Action? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public CompletionPropertyDescriptor PreservePositionIncrements(bool? preservePositionIncrements = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor AddMeta(string key, string value) { - PreservePositionIncrementsValue = preservePositionIncrements; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public CompletionPropertyDescriptor PreserveSeparators(bool? preserveSeparators = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor PreservePositionIncrements(bool? value = true) { - PreserveSeparatorsValue = preserveSeparators; - return Self; + Instance.PreservePositionIncrements = value; + return this; } - public CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor PreserveSeparators(bool? value = true) { - PropertiesValue = properties; - return Self; + Instance.PreserveSeparators = value; + return this; } - public CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public CompletionPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Properties(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Properties(System.Action> action) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public CompletionPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor SearchAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public CompletionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (ContextsDescriptor is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ContextsDescriptor, options); - writer.WriteEndArray(); - } - else if (ContextsDescriptorAction is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(ContextsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ContextsDescriptorActions is not null) - { - writer.WritePropertyName("contexts"); - writer.WriteStartArray(); - foreach (var action in ContextsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ContextsValue is not null) - { - writer.WritePropertyName("contexts"); - JsonSerializer.Serialize(writer, ContextsValue, options); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MaxInputLengthValue.HasValue) - { - writer.WritePropertyName("max_input_length"); - writer.WriteNumberValue(MaxInputLengthValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PreservePositionIncrementsValue.HasValue) - { - writer.WritePropertyName("preserve_position_increments"); - writer.WriteBooleanValue(PreservePositionIncrementsValue.Value); - } - - if (PreserveSeparatorsValue.HasValue) - { - writer.WritePropertyName("preserve_separators"); - writer.WriteBooleanValue(PreserveSeparatorsValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("completion"); - writer.WriteEndObject(); + Instance.SyntheticSourceKeep = value; + return this; } - private ICollection? BuildContexts() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.CompletionProperty Build(System.Action? action) { - if (ContextsValue is not null) + if (action is null) { - return ContextsValue; + return new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if ((object)ContextsDescriptor is IBuildableDescriptor?> buildable) - { - return buildable.Build(); - } - - if (ContextsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(ContextsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor?> buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - CompletionProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Contexts = BuildContexts(), - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - MaxInputLength = MaxInputLengthValue, - Meta = MetaValue, - PreservePositionIncrements = PreservePositionIncrementsValue, - PreserveSeparators = PreserveSeparatorsValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.CompletionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompositeSubField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompositeSubField.g.cs index 6d8b8077651..19cbccf5278 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompositeSubField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CompositeSubField.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class CompositeSubFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.CompositeSubField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.CompositeSubField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.CompositeSubField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldConverter))] public sealed partial class CompositeSubField { - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType Type { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeSubField(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public CompositeSubField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompositeSubField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompositeSubField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType Type { get; set; } } -public sealed partial class CompositeSubFieldDescriptor : SerializableDescriptor +public readonly partial struct CompositeSubFieldDescriptor { - internal CompositeSubFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.CompositeSubField Instance { get; init; } - public CompositeSubFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeSubFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompositeSubField instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompositeSubFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.CompositeSubField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public CompositeSubFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType type) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.CompositeSubField instance) => new Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.CompositeSubField(Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.CompositeSubField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.CompositeSubField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ConstantKeywordProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ConstantKeywordProperty.g.cs index d8a59989901..745b951a28e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ConstantKeywordProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ConstantKeywordProperty.g.cs @@ -17,23 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class ConstantKeywordProperty : IProperty +internal sealed partial class ConstantKeywordPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyConverter))] +public sealed partial class ConstantKeywordProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public ConstantKeywordProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ConstantKeywordProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,66 +152,56 @@ public sealed partial class ConstantKeywordProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "constant_keyword"; - [JsonInclude, JsonPropertyName("value")] public object? Value { get; set; } } -public sealed partial class ConstantKeywordPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ConstantKeywordPropertyDescriptor { - internal ConstantKeywordPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty Instance { get; init; } - public ConstantKeywordPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private object? ValueValue { get; set; } - - public ConstantKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantKeywordPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public ConstantKeywordPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ConstantKeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -108,152 +209,126 @@ public ConstantKeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove /// Metadata about the field. /// /// - public ConstantKeywordPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ConstantKeywordPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ConstantKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - public ConstantKeywordPropertyDescriptor Value(object? value) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Properties(System.Action> action) { - ValueValue = value; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Value(object? value) + { + Instance.Value = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("constant_keyword"); - if (ValueValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ConstantKeywordProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - Value = ValueValue - }; } -public sealed partial class ConstantKeywordPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ConstantKeywordPropertyDescriptor { - internal ConstantKeywordPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty instance) + { + Instance = instance; + } - public ConstantKeywordPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantKeywordPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private object? ValueValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor descriptor) => descriptor.Instance; - public ConstantKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public ConstantKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ConstantKeywordPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ConstantKeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -261,102 +336,81 @@ public ConstantKeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public ConstantKeywordPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ConstantKeywordPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ConstantKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - public ConstantKeywordPropertyDescriptor Value(object? value) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Properties(System.Action action) { - ValueValue = value; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor Value(object? value) + { + Instance.Value = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("constant_keyword"); - if (ValueValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ConstantKeywordProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - Value = ValueValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CountedKeywordProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CountedKeywordProperty.g.cs new file mode 100644 index 00000000000..d5c4839fb17 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/CountedKeywordProperty.g.cs @@ -0,0 +1,415 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Mapping; + +internal sealed partial class CountedKeywordPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyConverter))] +public sealed partial class CountedKeywordProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public CountedKeywordProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public CountedKeywordProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } + public int? IgnoreAbove { get; set; } + public bool? Index { get; set; } + + /// + /// + /// Metadata about the field. + /// + /// + public System.Collections.Generic.IDictionary? Meta { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } + + public string Type => "counted_keyword"; +} + +public readonly partial struct CountedKeywordPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountedKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountedKeywordPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) + { + Instance.Dynamic = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Fields(System.Action> action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor IgnoreAbove(int? value) + { + Instance.IgnoreAbove = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Index(bool? value = true) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Properties = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct CountedKeywordPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountedKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountedKeywordPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) + { + Instance.Dynamic = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Fields(System.Action action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Fields(System.Action> action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor IgnoreAbove(int? value) + { + Instance.IgnoreAbove = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Index(bool? value = true) + { + Instance.Index = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Properties = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Properties(System.Action action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DataStreamTimestamp.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DataStreamTimestamp.g.cs index 1849c20d24d..dade8ef8acc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DataStreamTimestamp.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DataStreamTimestamp.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class DataStreamTimestampConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampConverter))] public sealed partial class DataStreamTimestamp { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamTimestamp(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public DataStreamTimestamp() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreamTimestamp() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreamTimestamp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class DataStreamTimestampDescriptor : SerializableDescriptor +public readonly partial struct DataStreamTimestampDescriptor { - internal DataStreamTimestampDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp Instance { get; init; } - public DataStreamTimestampDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamTimestampDescriptor(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp instance) { + Instance = instance; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreamTimestampDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DataStreamTimestampDescriptor Enabled(bool enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp instance) => new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateNanosProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateNanosProperty.g.cs index b674b09bf8e..5403a3d5cf2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateNanosProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateNanosProperty.g.cs @@ -17,36 +17,230 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DateNanosProperty : IProperty +internal sealed partial class DateNanosPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("boost")] + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropPrecisionStep = System.Text.Json.JsonEncodedText.Encode("precision_step"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propFormat = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propPrecisionStep = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propPrecisionStep.TryReadProperty(ref reader, options, PropPrecisionStep, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + Format = propFormat.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + PrecisionStep = propPrecisionStep.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropPrecisionStep, value.PrecisionStep, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyConverter))] +public sealed partial class DateNanosProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public DateNanosProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateNanosProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,113 +248,101 @@ public sealed partial class DateNanosProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] - public DateTimeOffset? NullValue { get; set; } - [JsonInclude, JsonPropertyName("precision_step")] + public System.Collections.Generic.IDictionary? Meta { get; set; } + public System.DateTimeOffset? NullValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } public int? PrecisionStep { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] + public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "date_nanos"; } -public sealed partial class DateNanosPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DateNanosPropertyDescriptor { - internal DateNanosPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty Instance { get; init; } - public DateNanosPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateNanosPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private DateTimeOffset? NullValueValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateNanosPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DateNanosPropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DateNanosPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DateNanosPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DateNanosPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DateNanosPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateNanosPropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DateNanosPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DateNanosPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DateNanosPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -168,264 +350,204 @@ public DateNanosPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DateNanosPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DateNanosPropertyDescriptor NullValue(DateTimeOffset? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DateNanosPropertyDescriptor PrecisionStep(int? precisionStep) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta(System.Action? action) { - PrecisionStepValue = precisionStep; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor NullValue(System.DateTimeOffset? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public DateNanosPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public DateNanosPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor PrecisionStep(int? value) { - StoreValue = store; - return Self; + Instance.PrecisionStep = value; + return this; } - public DateNanosPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("date_nanos"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DateNanosProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class DateNanosPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DateNanosPropertyDescriptor { - internal DateNanosPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty Instance { get; init; } - public DateNanosPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateNanosPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private DateTimeOffset? NullValueValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateNanosPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DateNanosPropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DateNanosPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DateNanosPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DateNanosPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DateNanosPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Fields(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateNanosPropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Fields(System.Action> action) { - FormatValue = format; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateNanosPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Format(string? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Format = value; + return this; } - public DateNanosPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor IgnoreAbove(int? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DateNanosPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor IgnoreMalformed(bool? value = true) { - IndexValue = index; - return Self; + Instance.IgnoreMalformed = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Index(bool? value = true) + { + Instance.Index = value; + return this; } /// @@ -433,170 +555,117 @@ public DateNanosPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DateNanosPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DateNanosPropertyDescriptor NullValue(DateTimeOffset? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DateNanosPropertyDescriptor PrecisionStep(int? precisionStep) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Meta(System.Action? action) { - PrecisionStepValue = precisionStep; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor NullValue(System.DateTimeOffset? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public DateNanosPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public DateNanosPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor PrecisionStep(int? value) { - StoreValue = store; - return Self; + Instance.PrecisionStep = value; + return this; } - public DateNanosPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("date_nanos"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DateNanosProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateProperty.g.cs index aa0ba132652..300216c795a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateProperty.g.cs @@ -17,40 +17,250 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DateProperty : IProperty +internal sealed partial class DatePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropPrecisionStep = System.Text.Json.JsonEncodedText.Encode("precision_step"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DateProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propFields = default; + LocalJsonValue propFormat = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propPrecisionStep = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propPrecisionStep.TryReadProperty(ref reader, options, PropPrecisionStep, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fielddata = propFielddata.Value, + Fields = propFields.Value, + Format = propFormat.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Locale = propLocale.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + PrecisionStep = propPrecisionStep.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DateProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropPrecisionStep, value.PrecisionStep, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DatePropertyConverter))] +public sealed partial class DateProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public DateProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fielddata")] public Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? Fielddata { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -58,147 +268,119 @@ public sealed partial class DateProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] - public DateTimeOffset? NullValue { get; set; } - [JsonInclude, JsonPropertyName("precision_step")] + public System.Collections.Generic.IDictionary? Meta { get; set; } + public System.DateTimeOffset? NullValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } public int? PrecisionStep { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] + public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "date"; } -public sealed partial class DatePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DatePropertyDescriptor { - internal DatePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateProperty Instance { get; init; } - public DatePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor FielddataDescriptor { get; set; } - private Action FielddataDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private string? LocaleValue { get; set; } - private IDictionary? MetaValue { get; set; } - private DateTimeOffset? NullValueValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public DatePropertyDescriptor Boost(double? boost) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatePropertyDescriptor() { - BoostValue = boost; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DatePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Boost(double? value) { - CopyToValue = copyTo; - return Self; + Instance.Boost = value; + return this; } - public DatePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DatePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? fielddata) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor DocValues(bool? value = true) { - FielddataDescriptor = null; - FielddataDescriptorAction = null; - FielddataValue = fielddata; - return Self; + Instance.DocValues = value; + return this; } - public DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FielddataValue = null; - FielddataDescriptorAction = null; - FielddataDescriptor = descriptor; - return Self; + Instance.Dynamic = value; + return this; } - public DatePropertyDescriptor Fielddata(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? value) { - FielddataValue = null; - FielddataDescriptor = null; - FielddataDescriptorAction = configure; - return Self; + Instance.Fielddata = value; + return this; } - public DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fielddata(System.Action action) { - FieldsValue = fields; - return Self; + Instance.Fielddata = Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor.Build(action); + return this; } - public DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DatePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DatePropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DatePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DatePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DatePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public DatePropertyDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -206,346 +388,222 @@ public DatePropertyDescriptor Locale(string? locale) /// Metadata about the field. /// /// - public DatePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DatePropertyDescriptor NullValue(DateTimeOffset? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DatePropertyDescriptor PrecisionStep(int? precisionStep) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta(System.Action? action) { - PrecisionStepValue = precisionStep; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor NullValue(System.DateTimeOffset? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public DatePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public DatePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor PrecisionStep(int? value) { - StoreValue = store; - return Self; + Instance.PrecisionStep = value; + return this; } - public DatePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FielddataDescriptor is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataDescriptor, options); - } - else if (FielddataDescriptorAction is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction), options); - } - else if (FielddataValue is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("date"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? BuildFielddata() + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Store(bool? value = true) { - if (FielddataValue is not null) - { - return FielddataValue; - } + Instance.Store = value; + return this; + } - if ((object)FielddataDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (FielddataDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateProperty Build(System.Action>? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - DateProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fielddata = BuildFielddata(), - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Locale = LocaleValue, - Meta = MetaValue, - NullValue = NullValueValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class DatePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DatePropertyDescriptor { - internal DatePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateProperty instance) + { + Instance = instance; + } - public DatePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DatePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor FielddataDescriptor { get; set; } - private Action FielddataDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private string? LocaleValue { get; set; } - private IDictionary? MetaValue { get; set; } - private DateTimeOffset? NullValueValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor descriptor) => descriptor.Instance; - public DatePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DatePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DatePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DatePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? fielddata) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FielddataDescriptor = null; - FielddataDescriptorAction = null; - FielddataValue = fielddata; - return Self; + Instance.Dynamic = value; + return this; } - public DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fielddata(Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? value) { - FielddataValue = null; - FielddataDescriptorAction = null; - FielddataDescriptor = descriptor; - return Self; + Instance.Fielddata = value; + return this; } - public DatePropertyDescriptor Fielddata(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fielddata(System.Action action) { - FielddataValue = null; - FielddataDescriptor = null; - FielddataDescriptorAction = configure; - return Self; + Instance.Fielddata = Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor.Build(action); + return this; } - public DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DatePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DatePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DatePropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DatePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DatePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DatePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public DatePropertyDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -553,218 +611,117 @@ public DatePropertyDescriptor Locale(string? locale) /// Metadata about the field. /// /// - public DatePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DatePropertyDescriptor NullValue(DateTimeOffset? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DatePropertyDescriptor PrecisionStep(int? precisionStep) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Meta(System.Action? action) { - PrecisionStepValue = precisionStep; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor NullValue(System.DateTimeOffset? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public DatePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public DatePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor PrecisionStep(int? value) { - StoreValue = store; - return Self; + Instance.PrecisionStep = value; + return this; } - public DatePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FielddataDescriptor is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataDescriptor, options); - } - else if (FielddataDescriptorAction is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction), options); - } - else if (FielddataValue is not null) - { - writer.WritePropertyName("fielddata"); - JsonSerializer.Serialize(writer, FielddataValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("date"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddata? BuildFielddata() + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor Store(bool? value = true) { - if (FielddataValue is not null) - { - return FielddataValue; - } + Instance.Store = value; + return this; + } - if ((object)FielddataDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (FielddataDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateProperty Build(System.Action? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.NumericFielddataDescriptor(FielddataDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - DateProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fielddata = BuildFielddata(), - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Locale = LocaleValue, - Meta = MetaValue, - NullValue = NullValueValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateRangeProperty.g.cs index b0d04f9d26a..c1fbe6edf8f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DateRangeProperty.g.cs @@ -17,36 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DateRangeProperty : IProperty +internal sealed partial class DateRangePropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("boost")] + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propFormat = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + Format = propFormat.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyConverter))] +public sealed partial class DateRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public DateRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DateRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,107 +212,97 @@ public sealed partial class DateRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "date_range"; } -public sealed partial class DateRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DateRangePropertyDescriptor { - internal DateRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty instance) + { + Instance = instance; + } - public DateRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor descriptor) => descriptor.Instance; - public DateRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DateRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public DateRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DateRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DateRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DateRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateRangePropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DateRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DateRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -162,236 +310,168 @@ public DateRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DateRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DateRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DateRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public DateRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("date_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DateRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class DateRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DateRangePropertyDescriptor { - internal DateRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty Instance { get; init; } - public DateRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public DateRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public DateRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public DateRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DateRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public DateRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DateRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DateRangePropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DateRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DateRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -399,144 +479,81 @@ public DateRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DateRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DateRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DateRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public DateRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("date_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DateRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorIndexOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorIndexOptions.g.cs index b511d9b0955..6c5d0af94dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorIndexOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorIndexOptions.g.cs @@ -17,18 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class DenseVectorIndexOptionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfidenceInterval = System.Text.Json.JsonEncodedText.Encode("confidence_interval"); + private static readonly System.Text.Json.JsonEncodedText PropEfConstruction = System.Text.Json.JsonEncodedText.Encode("ef_construction"); + private static readonly System.Text.Json.JsonEncodedText PropM = System.Text.Json.JsonEncodedText.Encode("m"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConfidenceInterval = default; + LocalJsonValue propEfConstruction = default; + LocalJsonValue propM = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfidenceInterval.TryReadProperty(ref reader, options, PropConfidenceInterval, null)) + { + continue; + } + + if (propEfConstruction.TryReadProperty(ref reader, options, PropEfConstruction, null)) + { + continue; + } + + if (propM.TryReadProperty(ref reader, options, PropM, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ConfidenceInterval = propConfidenceInterval.Value, + EfConstruction = propEfConstruction.Value, + M = propM.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfidenceInterval, value.ConfidenceInterval, null, null); + writer.WriteProperty(options, PropEfConstruction, value.EfConstruction, null, null); + writer.WriteProperty(options, PropM, value.M, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsConverter))] public sealed partial class DenseVectorIndexOptions { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public DenseVectorIndexOptions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DenseVectorIndexOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The confidence interval to use when quantizing the vectors. Can be any value between and including 0.90 and @@ -47,7 +132,6 @@ public sealed partial class DenseVectorIndexOptions /// Only applicable to int8_hnsw, int4_hnsw, int8_flat, and int4_flat index types. /// /// - [JsonInclude, JsonPropertyName("confidence_interval")] public float? ConfidenceInterval { get; set; } /// @@ -55,10 +139,9 @@ public sealed partial class DenseVectorIndexOptions /// The number of candidates to track while assembling the list of nearest neighbors for each new node. /// /// - /// Only applicable to hnsw, int8_hnsw, and int4_hnsw index types. + /// Only applicable to hnsw, int8_hnsw, bbq_hnsw, and int4_hnsw index types. /// /// - [JsonInclude, JsonPropertyName("ef_construction")] public int? EfConstruction { get; set; } /// @@ -66,33 +149,41 @@ public sealed partial class DenseVectorIndexOptions /// The number of neighbors each node will be connected to in the HNSW graph. /// /// - /// Only applicable to hnsw, int8_hnsw, and int4_hnsw index types. + /// Only applicable to hnsw, int8_hnsw, bbq_hnsw, and int4_hnsw index types. /// /// - [JsonInclude, JsonPropertyName("m")] - public int? m { get; set; } + public int? M { get; set; } /// /// /// The type of kNN algorithm to use. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType Type { get; set; } } -public sealed partial class DenseVectorIndexOptionsDescriptor : SerializableDescriptor +public readonly partial struct DenseVectorIndexOptionsDescriptor { - internal DenseVectorIndexOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorIndexOptionsDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions instance) + { + Instance = instance; + } - public DenseVectorIndexOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorIndexOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? ConfidenceIntervalValue { get; set; } - private int? EfConstructionValue { get; set; } - private int? mValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions instance) => new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor descriptor) => descriptor.Instance; /// /// @@ -112,10 +203,10 @@ public DenseVectorIndexOptionsDescriptor() : base() /// Only applicable to int8_hnsw, int4_hnsw, int8_flat, and int4_flat index types. /// /// - public DenseVectorIndexOptionsDescriptor ConfidenceInterval(float? confidenceInterval) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor ConfidenceInterval(float? value) { - ConfidenceIntervalValue = confidenceInterval; - return Self; + Instance.ConfidenceInterval = value; + return this; } /// @@ -123,13 +214,13 @@ public DenseVectorIndexOptionsDescriptor ConfidenceInterval(float? confidenceInt /// The number of candidates to track while assembling the list of nearest neighbors for each new node. /// /// - /// Only applicable to hnsw, int8_hnsw, and int4_hnsw index types. + /// Only applicable to hnsw, int8_hnsw, bbq_hnsw, and int4_hnsw index types. /// /// - public DenseVectorIndexOptionsDescriptor EfConstruction(int? efConstruction) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor EfConstruction(int? value) { - EfConstructionValue = efConstruction; - return Self; + Instance.EfConstruction = value; + return this; } /// @@ -137,13 +228,13 @@ public DenseVectorIndexOptionsDescriptor EfConstruction(int? efConstruction) /// The number of neighbors each node will be connected to in the HNSW graph. /// /// - /// Only applicable to hnsw, int8_hnsw, and int4_hnsw index types. + /// Only applicable to hnsw, int8_hnsw, bbq_hnsw, and int4_hnsw index types. /// /// - public DenseVectorIndexOptionsDescriptor m(int? m) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor M(int? value) { - mValue = m; - return Self; + Instance.M = value; + return this; } /// @@ -151,35 +242,17 @@ public DenseVectorIndexOptionsDescriptor m(int? m) /// The type of kNN algorithm to use. /// /// - public DenseVectorIndexOptionsDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType type) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions Build(System.Action action) { - writer.WriteStartObject(); - if (ConfidenceIntervalValue.HasValue) - { - writer.WritePropertyName("confidence_interval"); - writer.WriteNumberValue(ConfidenceIntervalValue.Value); - } - - if (EfConstructionValue.HasValue) - { - writer.WritePropertyName("ef_construction"); - writer.WriteNumberValue(EfConstructionValue.Value); - } - - if (mValue.HasValue) - { - writer.WritePropertyName("m"); - writer.WriteNumberValue(mValue.Value); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs index b05fbb4e3a3..fb0e1a963ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs @@ -17,27 +17,175 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DenseVectorProperty : IProperty +internal sealed partial class DenseVectorPropertyConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropDims = System.Text.Json.JsonEncodedText.Encode("dims"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropElementType = System.Text.Json.JsonEncodedText.Encode("element_type"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDims = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propElementType = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDims.TryReadProperty(ref reader, options, PropDims, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propElementType.TryReadProperty(ref reader, options, PropElementType, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dims = propDims.Value, + Dynamic = propDynamic.Value, + ElementType = propElementType.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Similarity = propSimilarity.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDims, value.Dims, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropElementType, value.ElementType, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyConverter))] +public sealed partial class DenseVectorProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public DenseVectorProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DenseVectorProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of vector dimensions. Can't exceed 4096. If dims is not specified, it will be set to the length of /// the first vector added to the field. /// /// - [JsonInclude, JsonPropertyName("dims")] public int? Dims { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } /// @@ -45,11 +193,8 @@ public sealed partial class DenseVectorProperty : IProperty /// The data type used to encode vectors. The supported data types are float (default), byte, and bit. /// /// - [JsonInclude, JsonPropertyName("element_type")] public Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? ElementType { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -57,7 +202,6 @@ public sealed partial class DenseVectorProperty : IProperty /// If true, you can search this field using the kNN search API. /// /// - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -70,7 +214,6 @@ public sealed partial class DenseVectorProperty : IProperty /// This parameter can only be specified when index is true. /// /// - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? IndexOptions { get; set; } /// @@ -78,9 +221,7 @@ public sealed partial class DenseVectorProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } /// @@ -102,36 +243,30 @@ public sealed partial class DenseVectorProperty : IProperty /// This parameter can only be specified when index is true. /// /// - [JsonInclude, JsonPropertyName("similarity")] public Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? Similarity { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "dense_vector"; } -public sealed partial class DenseVectorPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DenseVectorPropertyDescriptor { - internal DenseVectorPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty instance) + { + Instance = instance; + } - public DenseVectorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int? DimsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? ElementTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? IndexOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor IndexOptionsDescriptor { get; set; } - private Action IndexOptionsDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? SimilarityValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor descriptor) => descriptor.Instance; /// /// @@ -139,16 +274,16 @@ public DenseVectorPropertyDescriptor() : base() /// the first vector added to the field. /// /// - public DenseVectorPropertyDescriptor Dims(int? dims) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Dims(int? value) { - DimsValue = dims; - return Self; + Instance.Dims = value; + return this; } - public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } /// @@ -156,47 +291,55 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elastics /// The data type used to encode vectors. The supported data types are float (default), byte, and bit. /// /// - public DenseVectorPropertyDescriptor ElementType(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? elementType) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor ElementType(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? value) { - ElementTypeValue = elementType; - return Self; + Instance.ElementType = value; + return this; } - public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DenseVectorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DenseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + /// + /// + /// If true, you can search this field using the kNN search API. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } /// /// - /// If true, you can search this field using the kNN search API. + /// An optional section that configures the kNN indexing algorithm. The HNSW algorithm has two internal parameters + /// that influence how the data structure is built. These can be adjusted to improve the accuracy of results, at the + /// expense of slower indexing speed. + /// + /// + /// This parameter can only be specified when index is true. /// /// - public DenseVectorPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? value) { - IndexValue = index; - return Self; + Instance.IndexOptions = value; + return this; } /// @@ -209,28 +352,32 @@ public DenseVectorPropertyDescriptor Index(bool? index = true) /// This parameter can only be specified when index is true. /// /// - public DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IndexOptions(System.Action action) { - IndexOptionsDescriptor = null; - IndexOptionsDescriptorAction = null; - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor.Build(action); + return this; } - public DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexOptionsValue = null; - IndexOptionsDescriptorAction = null; - IndexOptionsDescriptor = descriptor; - return Self; + Instance.Meta = value; + return this; } - public DenseVectorPropertyDescriptor IndexOptions(Action configure) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta() { - IndexOptionsValue = null; - IndexOptionsDescriptor = null; - IndexOptionsDescriptorAction = configure; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -238,30 +385,29 @@ public DenseVectorPropertyDescriptor IndexOptions(Action /// - public DenseVectorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta(System.Action? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public DenseVectorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } /// @@ -283,163 +429,50 @@ public DenseVectorPropertyDescriptor Properties(Actionindex is true. /// /// - public DenseVectorPropertyDescriptor Similarity(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? similarity) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Similarity(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - public DenseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (DimsValue.HasValue) - { - writer.WritePropertyName("dims"); - writer.WriteNumberValue(DimsValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (ElementTypeValue is not null) - { - writer.WritePropertyName("element_type"); - JsonSerializer.Serialize(writer, ElementTypeValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsDescriptor is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsDescriptor, options); - } - else if (IndexOptionsDescriptorAction is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(IndexOptionsDescriptorAction), options); - } - else if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (SimilarityValue is not null) - { - writer.WritePropertyName("similarity"); - JsonSerializer.Serialize(writer, SimilarityValue, options); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("dense_vector"); - writer.WriteEndObject(); + Instance.SyntheticSourceKeep = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? BuildIndexOptions() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty Build(System.Action>? action) { - if (IndexOptionsValue is not null) - { - return IndexOptionsValue; - } - - if ((object)IndexOptionsDescriptor is IBuildableDescriptor buildable) + if (action is null) { - return buildable.Build(); + return new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexOptionsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(IndexOptionsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DenseVectorProperty IBuildableDescriptor.Build() => new() - { - Dims = DimsValue, - Dynamic = DynamicValue, - ElementType = ElementTypeValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = BuildIndexOptions(), - Meta = MetaValue, - Properties = PropertiesValue, - Similarity = SimilarityValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class DenseVectorPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DenseVectorPropertyDescriptor { - internal DenseVectorPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty Instance { get; init; } - public DenseVectorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty instance) { + Instance = instance; } - private int? DimsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? ElementTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? IndexOptionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor IndexOptionsDescriptor { get; set; } - private Action IndexOptionsDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? SimilarityValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DenseVectorPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor descriptor) => descriptor.Instance; /// /// @@ -447,16 +480,16 @@ public DenseVectorPropertyDescriptor() : base() /// the first vector added to the field. /// /// - public DenseVectorPropertyDescriptor Dims(int? dims) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Dims(int? value) { - DimsValue = dims; - return Self; + Instance.Dims = value; + return this; } - public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } /// @@ -464,36 +497,34 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mappi /// The data type used to encode vectors. The supported data types are float (default), byte, and bit. /// /// - public DenseVectorPropertyDescriptor ElementType(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? elementType) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor ElementType(Elastic.Clients.Elasticsearch.Mapping.DenseVectorElementType? value) { - ElementTypeValue = elementType; - return Self; + Instance.ElementType = value; + return this; } - public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DenseVectorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DenseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -501,10 +532,10 @@ public DenseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// If true, you can search this field using the kNN search API. /// /// - public DenseVectorPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -517,28 +548,37 @@ public DenseVectorPropertyDescriptor Index(bool? index = true) /// This parameter can only be specified when index is true. /// /// - public DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? value) { - IndexOptionsDescriptor = null; - IndexOptionsDescriptorAction = null; - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public DenseVectorPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor descriptor) + /// + /// + /// An optional section that configures the kNN indexing algorithm. The HNSW algorithm has two internal parameters + /// that influence how the data structure is built. These can be adjusted to improve the accuracy of results, at the + /// expense of slower indexing speed. + /// + /// + /// This parameter can only be specified when index is true. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor IndexOptions(System.Action action) { - IndexOptionsValue = null; - IndexOptionsDescriptorAction = null; - IndexOptionsDescriptor = descriptor; - return Self; + Instance.IndexOptions = Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor.Build(action); + return this; } - public DenseVectorPropertyDescriptor IndexOptions(Action configure) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexOptionsValue = null; - IndexOptionsDescriptor = null; - IndexOptionsDescriptorAction = configure; - return Self; + Instance.Meta = value; + return this; } /// @@ -546,30 +586,46 @@ public DenseVectorPropertyDescriptor IndexOptions(Action /// - public DenseVectorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public DenseVectorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Properties(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } /// @@ -591,138 +647,28 @@ public DenseVectorPropertyDescriptor Properties(Actionindex is true. /// /// - public DenseVectorPropertyDescriptor Similarity(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? similarity) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor Similarity(Elastic.Clients.Elasticsearch.Mapping.DenseVectorSimilarity? value) { - SimilarityValue = similarity; - return Self; + Instance.Similarity = value; + return this; } - public DenseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (DimsValue.HasValue) - { - writer.WritePropertyName("dims"); - writer.WriteNumberValue(DimsValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (ElementTypeValue is not null) - { - writer.WritePropertyName("element_type"); - JsonSerializer.Serialize(writer, ElementTypeValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsDescriptor is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsDescriptor, options); - } - else if (IndexOptionsDescriptorAction is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(IndexOptionsDescriptorAction), options); - } - else if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (SimilarityValue is not null) - { - writer.WritePropertyName("similarity"); - JsonSerializer.Serialize(writer, SimilarityValue, options); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("dense_vector"); - writer.WriteEndObject(); + Instance.SyntheticSourceKeep = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptions? BuildIndexOptions() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty Build(System.Action? action) { - if (IndexOptionsValue is not null) + if (action is null) { - return IndexOptionsValue; + return new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if ((object)IndexOptionsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (IndexOptionsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorIndexOptionsDescriptor(IndexOptionsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DenseVectorProperty IBuildableDescriptor.Build() => new() - { - Dims = DimsValue, - Dynamic = DynamicValue, - ElementType = ElementTypeValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = BuildIndexOptions(), - Meta = MetaValue, - Properties = PropertiesValue, - Similarity = SimilarityValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleNumberProperty.g.cs index 850d6e8d65d..3df5bb65fea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DoubleNumberProperty : IProperty +internal sealed partial class DoubleNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyConverter))] +public sealed partial class DoubleNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public DoubleNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DoubleNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class DoubleNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public double? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class DoubleNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class DoubleNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "double"; } -public sealed partial class DoubleNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DoubleNumberPropertyDescriptor { - internal DoubleNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty Instance { get; init; } - public DoubleNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public DoubleNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public DoubleNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public DoubleNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DoubleNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DoubleNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public DoubleNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public DoubleNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DoubleNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DoubleNumberPropertyDescriptor NullValue(double? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DoubleNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor NullValue(double? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public DoubleNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public DoubleNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DoubleNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Cli /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? timeS /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public DoubleNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct DoubleNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("double"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - DoubleNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class DoubleNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal DoubleNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public DoubleNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public DoubleNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public DoubleNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public DoubleNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public DoubleNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DoubleNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DoubleNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public DoubleNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public DoubleNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public DoubleNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DoubleNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DoubleNumberPropertyDescriptor NullValue(double? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor NullValue(double? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public DoubleNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public DoubleNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public DoubleNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DoubleNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DoubleNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public DoubleNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasti /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public DoubleNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimens /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public DoubleNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("double"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - DoubleNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleRangeProperty.g.cs index c4c7f2c9284..7c8eb06b433 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DoubleRangeProperty.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DoubleRangeProperty : IProperty +internal sealed partial class DoubleRangePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyConverter))] +public sealed partial class DoubleRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public DoubleRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DoubleRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,100 +202,91 @@ public sealed partial class DoubleRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "double_range"; } -public sealed partial class DoubleRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DoubleRangePropertyDescriptor { - internal DoubleRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty Instance { get; init; } - public DoubleRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public DoubleRangePropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DoubleRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public DoubleRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DoubleRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DoubleRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -153,222 +294,162 @@ public DoubleRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DoubleRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DoubleRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DoubleRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public DoubleRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("double_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DoubleRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class DoubleRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DoubleRangePropertyDescriptor { - internal DoubleRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty Instance { get; init; } - public DoubleRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DoubleRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public DoubleRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public DoubleRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DoubleRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public DoubleRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DoubleRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DoubleRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DoubleRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -376,137 +457,81 @@ public DoubleRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public DoubleRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DoubleRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DoubleRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public DoubleRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("double_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - DoubleRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicProperty.g.cs index 4738c3bce8a..22cfb98740d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicProperty.g.cs @@ -17,52 +17,364 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class DynamicProperty : IProperty +internal sealed partial class DynamicPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEagerGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("eager_global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPhrases = System.Text.Json.JsonEncodedText.Encode("index_phrases"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPrefixes = System.Text.Json.JsonEncodedText.Encode("index_prefixes"); + private static readonly System.Text.Json.JsonEncodedText PropLocale = System.Text.Json.JsonEncodedText.Encode("locale"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropPositionIncrementGap = System.Text.Json.JsonEncodedText.Encode("position_increment_gap"); + private static readonly System.Text.Json.JsonEncodedText PropPrecisionStep = System.Text.Json.JsonEncodedText.Encode("precision_step"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSearchQuoteAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_quote_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTermVector = System.Text.Json.JsonEncodedText.Encode("term_vector"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.DynamicProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEagerGlobalOrdinals = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFields = default; + LocalJsonValue propFormat = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue propIndexPhrases = default; + LocalJsonValue propIndexPrefixes = default; + LocalJsonValue propLocale = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNorms = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propPositionIncrementGap = default; + LocalJsonValue propPrecisionStep = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propSearchAnalyzer = default; + LocalJsonValue propSearchQuoteAnalyzer = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTermVector = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEagerGlobalOrdinals.TryReadProperty(ref reader, options, PropEagerGlobalOrdinals, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propIndexPhrases.TryReadProperty(ref reader, options, PropIndexPhrases, null)) + { + continue; + } + + if (propIndexPrefixes.TryReadProperty(ref reader, options, PropIndexPrefixes, null)) + { + continue; + } + + if (propLocale.TryReadProperty(ref reader, options, PropLocale, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propPositionIncrementGap.TryReadProperty(ref reader, options, PropPositionIncrementGap, null)) + { + continue; + } + + if (propPrecisionStep.TryReadProperty(ref reader, options, PropPrecisionStep, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSearchAnalyzer.TryReadProperty(ref reader, options, PropSearchAnalyzer, null)) + { + continue; + } + + if (propSearchQuoteAnalyzer.TryReadProperty(ref reader, options, PropSearchQuoteAnalyzer, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTermVector.TryReadProperty(ref reader, options, PropTermVector, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + EagerGlobalOrdinals = propEagerGlobalOrdinals.Value, + Enabled = propEnabled.Value, + Fields = propFields.Value, + Format = propFormat.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + IndexPhrases = propIndexPhrases.Value, + IndexPrefixes = propIndexPrefixes.Value, + Locale = propLocale.Value, + Meta = propMeta.Value, + Norms = propNorms.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + PositionIncrementGap = propPositionIncrementGap.Value, + PrecisionStep = propPrecisionStep.Value, + Properties = propProperties.Value, + Script = propScript.Value, + SearchAnalyzer = propSearchAnalyzer.Value, + SearchQuoteAnalyzer = propSearchQuoteAnalyzer.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TermVector = propTermVector.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEagerGlobalOrdinals, value.EagerGlobalOrdinals, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropIndexPhrases, value.IndexPhrases, null, null); + writer.WriteProperty(options, PropIndexPrefixes, value.IndexPrefixes, null, null); + writer.WriteProperty(options, PropLocale, value.Locale, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropPositionIncrementGap, value.PositionIncrementGap, null, null); + writer.WriteProperty(options, PropPrecisionStep, value.PrecisionStep, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSearchAnalyzer, value.SearchAnalyzer, null, null); + writer.WriteProperty(options, PropSearchQuoteAnalyzer, value.SearchQuoteAnalyzer, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTermVector, value.TermVector, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyConverter))] +public sealed partial class DynamicProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("analyzer")] +#if NET7_0_OR_GREATER + public DynamicProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public DynamicProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Analyzer { get; set; } - [JsonInclude, JsonPropertyName("boost")] public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("eager_global_ordinals")] public bool? EagerGlobalOrdinals { get; set; } - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } - [JsonInclude, JsonPropertyName("index_phrases")] public bool? IndexPhrases { get; set; } - [JsonInclude, JsonPropertyName("index_prefixes")] public Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixes { get; set; } - [JsonInclude, JsonPropertyName("locale")] public string? Locale { get; set; } /// @@ -70,215 +382,167 @@ public sealed partial class DynamicProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("norms")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? Norms { get; set; } - [JsonInclude, JsonPropertyName("null_value")] public Elastic.Clients.Elasticsearch.FieldValue? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("position_increment_gap")] public int? PositionIncrementGap { get; set; } - [JsonInclude, JsonPropertyName("precision_step")] public int? PrecisionStep { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("search_analyzer")] public string? SearchAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("search_quote_analyzer")] public string? SearchQuoteAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("term_vector")] public Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVector { get; set; } - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "{dynamic_type}"; } -public sealed partial class DynamicPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct DynamicPropertyDescriptor { - internal DynamicPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DynamicProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty instance) + { + Instance = instance; + } - public DynamicPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private bool? IndexPhrasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor IndexPrefixesDescriptor { get; set; } - private Action IndexPrefixesDescriptorAction { get; set; } - private string? LocaleValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private int? PositionIncrementGapValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor descriptor) => descriptor.Instance; - public DynamicPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public DynamicPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DynamicPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public DynamicPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DynamicPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public DynamicPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public DynamicPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Dynamic = value; + return this; } - public DynamicPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Enabled(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.Enabled = value; + return this; } - public DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public DynamicPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DynamicPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DynamicPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DynamicPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public DynamicPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public DynamicPropertyDescriptor IndexPhrases(bool? indexPhrases = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPhrases(bool? value = true) { - IndexPhrasesValue = indexPhrases; - return Self; + Instance.IndexPhrases = value; + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? indexPrefixes) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? value) { - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesValue = indexPrefixes; - return Self; + Instance.IndexPrefixes = value; + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes() { - IndexPrefixesValue = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesDescriptor = descriptor; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(null); + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes(System.Action? action) { - IndexPrefixesValue = null; - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = configure; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -286,596 +550,300 @@ public DynamicPropertyDescriptor Locale(string? locale) /// Metadata about the field. /// /// - public DynamicPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DynamicPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DynamicPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.FieldValue? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DynamicPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DynamicPropertyDescriptor PositionIncrementGap(int? positionIncrementGap) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Norms(bool? value = true) { - PositionIncrementGapValue = positionIncrementGap; - return Self; + Instance.Norms = value; + return this; } - public DynamicPropertyDescriptor PrecisionStep(int? precisionStep) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.FieldValue? value) { - PrecisionStepValue = precisionStep; - return Self; + Instance.NullValue = value; + return this; } - public DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = properties; - return Self; + Instance.OnScriptError = value; + return this; } - public DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor PositionIncrementGap(int? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositionIncrementGap = value; + return this; } - public DynamicPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor PrecisionStep(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PrecisionStep = value; + return this; } - public DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = value; + return this; } - public DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Properties(System.Action> action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } - public DynamicPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script() { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DynamicPropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script(System.Action? action) { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SearchAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public DynamicPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SearchQuoteAnalyzer(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public DynamicPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Store(bool? value = true) { - TermVectorValue = termVector; - return Self; + Instance.Store = value; + return this; } - public DynamicPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (IndexPhrasesValue.HasValue) - { - writer.WritePropertyName("index_phrases"); - writer.WriteBooleanValue(IndexPhrasesValue.Value); - } - - if (IndexPrefixesDescriptor is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesDescriptor, options); - } - else if (IndexPrefixesDescriptorAction is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction), options); - } - else if (IndexPrefixesValue is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesValue, options); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PositionIncrementGapValue.HasValue) - { - writer.WritePropertyName("position_increment_gap"); - writer.WriteNumberValue(PositionIncrementGapValue.Value); - } - - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TermVectorValue is not null) - { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("{dynamic_type}"); - writer.WriteEndObject(); + Instance.TermVector = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? BuildIndexPrefixes() + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - if (IndexPrefixesValue is not null) - { - return IndexPrefixesValue; - } - - if ((object)IndexPrefixesDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (IndexPrefixesDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + Instance.TimeSeriesMetric = value; + return this; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DynamicProperty Build(System.Action>? action) { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) + if (action is null) { - return buildable.Build(); + return new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - DynamicProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Enabled = EnabledValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - IndexPhrases = IndexPhrasesValue, - IndexPrefixes = BuildIndexPrefixes(), - Locale = LocaleValue, - Meta = MetaValue, - Norms = NormsValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - PositionIncrementGap = PositionIncrementGapValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Script = BuildScript(), - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class DynamicPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct DynamicPropertyDescriptor { - internal DynamicPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DynamicProperty Instance { get; init; } - public DynamicPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private string? FormatValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private bool? IndexPhrasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor IndexPrefixesDescriptor { get; set; } - private Action IndexPrefixesDescriptorAction { get; set; } - private string? LocaleValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private int? PositionIncrementGapValue { get; set; } - private int? PrecisionStepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - public DynamicPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Boost(double? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Boost = value; + return this; } - public DynamicPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public DynamicPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public DynamicPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public DynamicPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public DynamicPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public DynamicPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public DynamicPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - public DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public DynamicPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DynamicPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public DynamicPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public DynamicPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public DynamicPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public DynamicPropertyDescriptor IndexPhrases(bool? indexPhrases = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPhrases(bool? value = true) { - IndexPhrasesValue = indexPhrases; - return Self; + Instance.IndexPhrases = value; + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? indexPrefixes) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? value) { - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesValue = indexPrefixes; - return Self; + Instance.IndexPrefixes = value; + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes() { - IndexPrefixesValue = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesDescriptor = descriptor; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(null); + return this; } - public DynamicPropertyDescriptor IndexPrefixes(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor IndexPrefixes(System.Action? action) { - IndexPrefixesValue = null; - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = configure; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Locale(string? locale) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Locale(string? value) { - LocaleValue = locale; - return Self; + Instance.Locale = value; + return this; } /// @@ -883,416 +851,153 @@ public DynamicPropertyDescriptor Locale(string? locale) /// Metadata about the field. /// /// - public DynamicPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public DynamicPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public DynamicPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.FieldValue? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public DynamicPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public DynamicPropertyDescriptor PositionIncrementGap(int? positionIncrementGap) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Norms(bool? value = true) { - PositionIncrementGapValue = positionIncrementGap; - return Self; + Instance.Norms = value; + return this; } - public DynamicPropertyDescriptor PrecisionStep(int? precisionStep) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.FieldValue? value) { - PrecisionStepValue = precisionStep; - return Self; + Instance.NullValue = value; + return this; } - public DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = properties; - return Self; + Instance.OnScriptError = value; + return this; } - public DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor PositionIncrementGap(int? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositionIncrementGap = value; + return this; } - public DynamicPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor PrecisionStep(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PrecisionStep = value; + return this; } - public DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = value; + return this; } - public DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Properties(System.Action action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Properties(System.Action> action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Script = value; + return this; } - public DynamicPropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script() { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public DynamicPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public DynamicPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SearchAnalyzer(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public DynamicPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SearchQuoteAnalyzer(string? value) { - TermVectorValue = termVector; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public DynamicPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor Store(bool? value = true) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (IndexPhrasesValue.HasValue) - { - writer.WritePropertyName("index_phrases"); - writer.WriteBooleanValue(IndexPhrasesValue.Value); - } - - if (IndexPrefixesDescriptor is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesDescriptor, options); - } - else if (IndexPrefixesDescriptorAction is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction), options); - } - else if (IndexPrefixesValue is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesValue, options); - } - - if (!string.IsNullOrEmpty(LocaleValue)) - { - writer.WritePropertyName("locale"); - writer.WriteStringValue(LocaleValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PositionIncrementGapValue.HasValue) - { - writer.WritePropertyName("position_increment_gap"); - writer.WriteNumberValue(PositionIncrementGapValue.Value); - } - - if (PrecisionStepValue.HasValue) - { - writer.WritePropertyName("precision_step"); - writer.WriteNumberValue(PrecisionStepValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TermVectorValue is not null) - { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("{dynamic_type}"); - writer.WriteEndObject(); + Instance.SyntheticSourceKeep = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? BuildIndexPrefixes() + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) { - if (IndexPrefixesValue is not null) - { - return IndexPrefixesValue; - } - - if ((object)IndexPrefixesDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (IndexPrefixesDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + Instance.TermVector = value; + return this; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + public Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + Instance.TimeSeriesMetric = value; + return this; + } - if (ScriptDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DynamicProperty Build(System.Action? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - DynamicProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Enabled = EnabledValue, - Fields = FieldsValue, - Format = FormatValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - IndexPhrases = IndexPhrasesValue, - IndexPrefixes = BuildIndexPrefixes(), - Locale = LocaleValue, - Meta = MetaValue, - Norms = NormsValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - PositionIncrementGap = PositionIncrementGapValue, - PrecisionStep = PrecisionStepValue, - Properties = PropertiesValue, - Script = BuildScript(), - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DynamicProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs index fa40241afaa..3b5530ee031 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs @@ -17,519 +17,512 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -[JsonConverter(typeof(DynamicTemplateConverter))] -public sealed partial class DynamicTemplate -{ - internal DynamicTemplate(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static DynamicTemplate Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => new DynamicTemplate("mapping", property); - public static DynamicTemplate Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => new DynamicTemplate("runtime", property); - - [JsonInclude, JsonPropertyName("match")] - public ICollection? Match { get; set; } - [JsonInclude, JsonPropertyName("match_mapping_type")] - public ICollection? MatchMappingType { get; set; } - [JsonInclude, JsonPropertyName("match_pattern")] - public Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPattern { get; set; } - [JsonInclude, JsonPropertyName("path_match")] - public ICollection? PathMatch { get; set; } - [JsonInclude, JsonPropertyName("path_unmatch")] - public ICollection? PathUnmatch { get; set; } - [JsonInclude, JsonPropertyName("unmatch")] - public ICollection? Unmatch { get; set; } - [JsonInclude, JsonPropertyName("unmatch_mapping_type")] - public ICollection? UnmatchMappingType { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class DynamicTemplateConverter : JsonConverter +internal sealed partial class DynamicTemplateConverter : System.Text.Json.Serialization.JsonConverter { - public override DynamicTemplate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropMatchMappingType = System.Text.Json.JsonEncodedText.Encode("match_mapping_type"); + private static readonly System.Text.Json.JsonEncodedText PropMatchPattern = System.Text.Json.JsonEncodedText.Encode("match_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropPathMatch = System.Text.Json.JsonEncodedText.Encode("path_match"); + private static readonly System.Text.Json.JsonEncodedText PropPathUnmatch = System.Text.Json.JsonEncodedText.Encode("path_unmatch"); + private static readonly System.Text.Json.JsonEncodedText PropUnmatch = System.Text.Json.JsonEncodedText.Encode("unmatch"); + private static readonly System.Text.Json.JsonEncodedText PropUnmatchMappingType = System.Text.Json.JsonEncodedText.Encode("unmatch_mapping_type"); + private static readonly System.Text.Json.JsonEncodedText VariantMapping = System.Text.Json.JsonEncodedText.Encode("mapping"); + private static readonly System.Text.Json.JsonEncodedText VariantRuntime = System.Text.Json.JsonEncodedText.Encode("runtime"); + + public override Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - ICollection? matchValue = default; - ICollection? matchMappingTypeValue = default; - Elastic.Clients.Elasticsearch.Mapping.MatchType? matchPatternValue = default; - ICollection? pathMatchValue = default; - ICollection? pathUnmatchValue = default; - ICollection? unmatchValue = default; - ICollection? unmatchMappingTypeValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propMatch = default; + LocalJsonValue?> propMatchMappingType = default; + LocalJsonValue propMatchPattern = default; + LocalJsonValue?> propPathMatch = default; + LocalJsonValue?> propPathUnmatch = default; + LocalJsonValue?> propUnmatch = default; + LocalJsonValue?> propUnmatchMappingType = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (propMatch.TryReadProperty(ref reader, options, PropMatch, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "match") + if (propMatchMappingType.TryReadProperty(ref reader, options, PropMatchMappingType, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - matchValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); continue; } - if (propertyName == "match_mapping_type") + if (propMatchPattern.TryReadProperty(ref reader, options, PropMatchPattern, null)) { - matchMappingTypeValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); continue; } - if (propertyName == "match_pattern") + if (propPathMatch.TryReadProperty(ref reader, options, PropPathMatch, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - matchPatternValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "path_match") + if (propPathUnmatch.TryReadProperty(ref reader, options, PropPathUnmatch, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - pathMatchValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); continue; } - if (propertyName == "path_unmatch") + if (propUnmatch.TryReadProperty(ref reader, options, PropUnmatch, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - pathUnmatchValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); continue; } - if (propertyName == "unmatch") + if (propUnmatchMappingType.TryReadProperty(ref reader, options, PropUnmatchMappingType, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) { - unmatchValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); continue; } - if (propertyName == "unmatch_mapping_type") + if (reader.ValueTextEquals(VariantMapping)) { - unmatchMappingTypeValue = SingleOrManySerializationHelper.Deserialize(ref reader, options); + variantType = VariantMapping.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "mapping") + if (reader.ValueTextEquals(VariantRuntime)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRuntime.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "runtime") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DynamicTemplate' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new DynamicTemplate(variantNameValue, variantValue); - result.Match = matchValue; - result.MatchMappingType = matchMappingTypeValue; - result.MatchPattern = matchPatternValue; - result.PathMatch = pathMatchValue; - result.PathUnmatch = pathUnmatchValue; - result.Unmatch = unmatchValue; - result.UnmatchMappingType = unmatchMappingTypeValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Match = propMatch.Value, + MatchMappingType = propMatchMappingType.Value, + MatchPattern = propMatchPattern.Value, + PathMatch = propPathMatch.Value, + PathUnmatch = propPathUnmatch.Value, + Unmatch = propUnmatch.Value, + UnmatchMappingType = propUnmatchMappingType.Value + }; } - public override void Write(Utf8JsonWriter writer, DynamicTemplate value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Match is not null) - { - writer.WritePropertyName("match"); - SingleOrManySerializationHelper.Serialize(value.Match, writer, options); - } - - if (value.MatchMappingType is not null) + switch (value.VariantType) { - writer.WritePropertyName("match_mapping_type"); - SingleOrManySerializationHelper.Serialize(value.MatchMappingType, writer, options); + case null: + break; + case "mapping": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Mapping.IProperty)value.Variant, null, null); + break; + case "runtime": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Mapping.RuntimeField)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate)}'."); } - if (value.MatchPattern is not null) - { - writer.WritePropertyName("match_pattern"); - JsonSerializer.Serialize(writer, value.MatchPattern, options); - } - - if (value.PathMatch is not null) - { - writer.WritePropertyName("path_match"); - SingleOrManySerializationHelper.Serialize(value.PathMatch, writer, options); - } - - if (value.PathUnmatch is not null) - { - writer.WritePropertyName("path_unmatch"); - SingleOrManySerializationHelper.Serialize(value.PathUnmatch, writer, options); - } + writer.WriteProperty(options, PropMatch, value.Match, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMatchMappingType, value.MatchMappingType, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMatchPattern, value.MatchPattern, null, null); + writer.WriteProperty(options, PropPathMatch, value.PathMatch, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPathUnmatch, value.PathUnmatch, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUnmatch, value.Unmatch, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUnmatchMappingType, value.UnmatchMappingType, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} - if (value.Unmatch is not null) - { - writer.WritePropertyName("unmatch"); - SingleOrManySerializationHelper.Serialize(value.Unmatch, writer, options); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateConverter))] +public sealed partial class DynamicTemplate +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public DynamicTemplate() + { + } +#endif +#if !NET7_0_OR_GREATER + public DynamicTemplate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - if (value.UnmatchMappingType is not null) + public Elastic.Clients.Elasticsearch.Mapping.IProperty? Mapping { get => GetVariant("mapping"); set => SetVariant("mapping", value); } + public Elastic.Clients.Elasticsearch.Mapping.RuntimeField? Runtime { get => GetVariant("runtime"); set => SetVariant("runtime", value); } + public System.Collections.Generic.ICollection? Match { get; set; } + public System.Collections.Generic.ICollection? MatchMappingType { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPattern { get; set; } + public System.Collections.Generic.ICollection? PathMatch { get; set; } + public System.Collections.Generic.ICollection? PathUnmatch { get; set; } + public System.Collections.Generic.ICollection? Unmatch { get; set; } + public System.Collections.Generic.ICollection? UnmatchMappingType { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DateProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.IpProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.PointProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.TextProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Mapping = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate { Runtime = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName("unmatch_mapping_type"); - SingleOrManySerializationHelper.Serialize(value.UnmatchMappingType, writer, options); + return result; } - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "mapping": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Mapping.IProperty)value.Variant, options); - break; - case "runtime": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Mapping.IProperty)value.Variant, options); - break; - } - } + return default; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class DynamicTemplateDescriptor : SerializableDescriptor> +public readonly partial struct DynamicTemplateDescriptor { - internal DynamicTemplateDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate Instance { get; init; } - public DynamicTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicTemplateDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicTemplateDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private DynamicTemplateDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate instance) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Mapping = value; + return this; } - private ICollection? MatchValue { get; set; } - private ICollection? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } - private ICollection? PathMatchValue { get; set; } - private ICollection? PathUnmatchValue { get; set; } - private ICollection? UnmatchValue { get; set; } - private ICollection? UnmatchMappingTypeValue { get; set; } - - public DynamicTemplateDescriptor Match(ICollection? match) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Mapping(System.Func, Elastic.Clients.Elasticsearch.Mapping.IProperty> action) { - MatchValue = match; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.Mapping.PropertyFactory.Build(action); + return this; } - public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.RuntimeField? value) { - MatchMappingTypeValue = matchMappingType; - return Self; + Instance.Runtime = value; + return this; } - public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Mapping.MatchType? matchPattern) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Runtime(System.Action> action) { - MatchPatternValue = matchPattern; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action); + return this; } - public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Match(System.Collections.Generic.ICollection? value) { - PathMatchValue = pathMatch; - return Self; + Instance.Match = value; + return this; } - public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Match(params string[] values) { - PathUnmatchValue = pathUnmatch; - return Self; + Instance.Match = [.. values]; + return this; } - public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchMappingType(System.Collections.Generic.ICollection? value) { - UnmatchValue = unmatch; - return Self; + Instance.MatchMappingType = value; + return this; } - public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchMappingType(params string[] values) { - UnmatchMappingTypeValue = unmatchMappingType; - return Self; + Instance.MatchMappingType = [.. values]; + return this; } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "mapping"); - public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "runtime"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Mapping.MatchType? value) { - writer.WriteStartObject(); - if (MatchValue is not null) - { - writer.WritePropertyName("match"); - SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); - } + Instance.MatchPattern = value; + return this; + } - if (MatchMappingTypeValue is not null) - { - writer.WritePropertyName("match_mapping_type"); - SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathMatch(System.Collections.Generic.ICollection? value) + { + Instance.PathMatch = value; + return this; + } - if (MatchPatternValue is not null) - { - writer.WritePropertyName("match_pattern"); - JsonSerializer.Serialize(writer, MatchPatternValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathMatch(params string[] values) + { + Instance.PathMatch = [.. values]; + return this; + } - if (PathMatchValue is not null) - { - writer.WritePropertyName("path_match"); - SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathUnmatch(System.Collections.Generic.ICollection? value) + { + Instance.PathUnmatch = value; + return this; + } - if (PathUnmatchValue is not null) - { - writer.WritePropertyName("path_unmatch"); - SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathUnmatch(params string[] values) + { + Instance.PathUnmatch = [.. values]; + return this; + } - if (UnmatchValue is not null) - { - writer.WritePropertyName("unmatch"); - SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Unmatch(System.Collections.Generic.ICollection? value) + { + Instance.Unmatch = value; + return this; + } - if (UnmatchMappingTypeValue is not null) - { - writer.WritePropertyName("unmatch_mapping_type"); - SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Unmatch(params string[] values) + { + Instance.Unmatch = [.. values]; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor UnmatchMappingType(System.Collections.Generic.ICollection? value) + { + Instance.UnmatchMappingType = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor UnmatchMappingType(params string[] values) + { + Instance.UnmatchMappingType = [.. values]; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DynamicTemplateDescriptor : SerializableDescriptor +public readonly partial struct DynamicTemplateDescriptor { - internal DynamicTemplateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate Instance { get; init; } - public DynamicTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicTemplateDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DynamicTemplateDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private DynamicTemplateDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate instance) => new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Mapping = value; + return this; } - private ICollection? MatchValue { get; set; } - private ICollection? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } - private ICollection? PathMatchValue { get; set; } - private ICollection? PathUnmatchValue { get; set; } - private ICollection? UnmatchValue { get; set; } - private ICollection? UnmatchMappingTypeValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Mapping(System.Func action) + { + Instance.Mapping = Elastic.Clients.Elasticsearch.Mapping.PropertyFactory.Build(action); + return this; + } - public DynamicTemplateDescriptor Match(ICollection? match) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Mapping(System.Func, Elastic.Clients.Elasticsearch.Mapping.IProperty> action) { - MatchValue = match; - return Self; + Instance.Mapping = Elastic.Clients.Elasticsearch.Mapping.PropertyFactory.Build(action); + return this; } - public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.RuntimeField? value) { - MatchMappingTypeValue = matchMappingType; - return Self; + Instance.Runtime = value; + return this; } - public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Mapping.MatchType? matchPattern) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Runtime(System.Action action) { - MatchPatternValue = matchPattern; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action); + return this; } - public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Runtime(System.Action> action) { - PathMatchValue = pathMatch; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action); + return this; } - public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Match(System.Collections.Generic.ICollection? value) { - PathUnmatchValue = pathUnmatch; - return Self; + Instance.Match = value; + return this; } - public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Match(params string[] values) { - UnmatchValue = unmatch; - return Self; + Instance.Match = [.. values]; + return this; } - public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchMappingType(System.Collections.Generic.ICollection? value) { - UnmatchMappingTypeValue = unmatchMappingType; - return Self; + Instance.MatchMappingType = value; + return this; } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "mapping"); - public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "runtime"); + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchMappingType(params string[] values) + { + Instance.MatchMappingType = [.. values]; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Mapping.MatchType? value) { - writer.WriteStartObject(); - if (MatchValue is not null) - { - writer.WritePropertyName("match"); - SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); - } + Instance.MatchPattern = value; + return this; + } - if (MatchMappingTypeValue is not null) - { - writer.WritePropertyName("match_mapping_type"); - SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathMatch(System.Collections.Generic.ICollection? value) + { + Instance.PathMatch = value; + return this; + } - if (MatchPatternValue is not null) - { - writer.WritePropertyName("match_pattern"); - JsonSerializer.Serialize(writer, MatchPatternValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathMatch(params string[] values) + { + Instance.PathMatch = [.. values]; + return this; + } - if (PathMatchValue is not null) - { - writer.WritePropertyName("path_match"); - SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathUnmatch(System.Collections.Generic.ICollection? value) + { + Instance.PathUnmatch = value; + return this; + } - if (PathUnmatchValue is not null) - { - writer.WritePropertyName("path_unmatch"); - SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor PathUnmatch(params string[] values) + { + Instance.PathUnmatch = [.. values]; + return this; + } - if (UnmatchValue is not null) - { - writer.WritePropertyName("unmatch"); - SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Unmatch(System.Collections.Generic.ICollection? value) + { + Instance.Unmatch = value; + return this; + } - if (UnmatchMappingTypeValue is not null) - { - writer.WritePropertyName("unmatch_mapping_type"); - SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor Unmatch(params string[] values) + { + Instance.Unmatch = [.. values]; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor UnmatchMappingType(System.Collections.Generic.ICollection? value) + { + Instance.UnmatchMappingType = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor UnmatchMappingType(params string[] values) + { + Instance.UnmatchMappingType = [.. values]; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor(new Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldAliasProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldAliasProperty.g.cs index b724d80015d..9d5e3704a1e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldAliasProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldAliasProperty.g.cs @@ -17,23 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class FieldAliasProperty : IProperty +internal sealed partial class FieldAliasPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPath = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Path = propPath.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyConverter))] +public sealed partial class FieldAliasProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("dynamic")] +#if NET7_0_OR_GREATER + public FieldAliasProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public FieldAliasProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,65 +152,55 @@ public sealed partial class FieldAliasProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("path")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Field? Path { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "alias"; } -public sealed partial class FieldAliasPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct FieldAliasPropertyDescriptor { - internal FieldAliasPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty Instance { get; init; } - public FieldAliasPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAliasPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public FieldAliasPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAliasPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public FieldAliasPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FieldAliasPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -107,164 +208,132 @@ public FieldAliasPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public FieldAliasPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FieldAliasPropertyDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta() { - PathValue = path; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FieldAliasPropertyDescriptor Path(Expression> path) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta(System.Action? action) { - PathValue = path; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FieldAliasPropertyDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor AddMeta(string key, string value) { - PathValue = path; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PropertiesValue = properties; - return Self; + Instance.Path = value; + return this; } - public FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Path(System.Linq.Expressions.Expression> value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Path = value; + return this; } - public FieldAliasPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public FieldAliasPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("alias"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FieldAliasProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Path = PathValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class FieldAliasPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FieldAliasPropertyDescriptor { - internal FieldAliasPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAliasPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty instance) + { + Instance = instance; + } - public FieldAliasPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAliasPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor descriptor) => descriptor.Instance; - public FieldAliasPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FieldAliasPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FieldAliasPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FieldAliasPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -272,114 +341,87 @@ public FieldAliasPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public FieldAliasPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FieldAliasPropertyDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta() { - PathValue = path; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FieldAliasPropertyDescriptor Path(Expression> path) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Meta(System.Action? action) { - PathValue = path; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FieldAliasPropertyDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor AddMeta(string key, string value) { - PathValue = path; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PropertiesValue = properties; - return Self; + Instance.Path = value; + return this; } - public FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Path(System.Linq.Expressions.Expression> value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Path = value; + return this; } - public FieldAliasPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public FieldAliasPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("alias"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FieldAliasProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Path = PathValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldMapping.g.cs index da7f8c1938c..3c386286c9c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldMapping.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class FieldMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropMapping = System.Text.Json.JsonEncodedText.Encode("mapping"); + + public override Elastic.Clients.Elasticsearch.Mapping.FieldMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFullName = default; + LocalJsonValue> propMapping = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propMapping.TryReadProperty(ref reader, options, PropMapping, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FieldMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FullName = propFullName.Value, + Mapping = propMapping.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FieldMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropMapping, value.Mapping, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FieldMappingConverter))] public sealed partial class FieldMapping { - [JsonInclude, JsonPropertyName("full_name")] - public string FullName { get; init; } - [JsonInclude, JsonPropertyName("mapping")] - public Elastic.Clients.Elasticsearch.Mapping.Properties Mapping { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMapping(string fullName, System.Collections.Generic.KeyValuePair mapping) + { + FullName = fullName; + Mapping = mapping; + } +#if NET7_0_OR_GREATER + public FieldMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.KeyValuePair Mapping { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldNamesField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldNamesField.g.cs index 16074d6d703..42ae8880a3a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldNamesField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FieldNamesField.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class FieldNamesFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Mapping.FieldNamesField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FieldNamesField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FieldNamesField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldConverter))] public sealed partial class FieldNamesField { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldNamesField(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public FieldNamesField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldNamesField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldNamesField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class FieldNamesFieldDescriptor : SerializableDescriptor +public readonly partial struct FieldNamesFieldDescriptor { - internal FieldNamesFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FieldNamesField Instance { get; init; } - public FieldNamesFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldNamesFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField instance) { + Instance = instance; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldNamesFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FieldNamesField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public FieldNamesFieldDescriptor Enabled(bool enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField instance) => new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FieldNamesField(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FieldNamesField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FieldNamesField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FlattenedProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FlattenedProperty.g.cs index f58d487bcc0..93c85f39f5a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FlattenedProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FlattenedProperty.g.cs @@ -17,35 +17,212 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class FlattenedProperty : IProperty +internal sealed partial class FlattenedPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDepthLimit = System.Text.Json.JsonEncodedText.Encode("depth_limit"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEagerGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("eager_global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropSplitQueriesOnWhitespace = System.Text.Json.JsonEncodedText.Encode("split_queries_on_whitespace"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propDepthLimit = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEagerGlobalOrdinals = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propSplitQueriesOnWhitespace = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propDepthLimit.TryReadProperty(ref reader, options, PropDepthLimit, null)) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEagerGlobalOrdinals.TryReadProperty(ref reader, options, PropEagerGlobalOrdinals, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propSplitQueriesOnWhitespace.TryReadProperty(ref reader, options, PropSplitQueriesOnWhitespace, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + DepthLimit = propDepthLimit.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + EagerGlobalOrdinals = propEagerGlobalOrdinals.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + Properties = propProperties.Value, + Similarity = propSimilarity.Value, + SplitQueriesOnWhitespace = propSplitQueriesOnWhitespace.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDepthLimit, value.DepthLimit, null, null); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEagerGlobalOrdinals, value.EagerGlobalOrdinals, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropSplitQueriesOnWhitespace, value.SplitQueriesOnWhitespace, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyConverter))] +public sealed partial class FlattenedProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public FlattenedProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public FlattenedProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("depth_limit")] public int? DepthLimit { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("eager_global_ordinals")] public bool? EagerGlobalOrdinals { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } /// @@ -53,113 +230,93 @@ public sealed partial class FlattenedProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } - [JsonInclude, JsonPropertyName("split_queries_on_whitespace")] public bool? SplitQueriesOnWhitespace { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "flattened"; } -public sealed partial class FlattenedPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct FlattenedPropertyDescriptor { - internal FlattenedPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty Instance { get; init; } - public FlattenedPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlattenedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private int? DepthLimitValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? SplitQueriesOnWhitespaceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public FlattenedPropertyDescriptor Boost(double? boost) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlattenedPropertyDescriptor() { - BoostValue = boost; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public FlattenedPropertyDescriptor DepthLimit(int? depthLimit) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Boost(double? value) { - DepthLimitValue = depthLimit; - return Self; + Instance.Boost = value; + return this; } - public FlattenedPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor DepthLimit(int? value) { - DocValuesValue = docValues; - return Self; + Instance.DepthLimit = value; + return this; } - public FlattenedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public FlattenedPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Dynamic = value; + return this; } - public FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public FlattenedPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FlattenedPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FlattenedPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } /// @@ -167,264 +324,174 @@ public FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elast /// Metadata about the field. /// /// - public FlattenedPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FlattenedPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FlattenedPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public FlattenedPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SimilarityValue = similarity; - return Self; + Instance.Properties = value; + return this; } - public FlattenedPropertyDescriptor SplitQueriesOnWhitespace(bool? splitQueriesOnWhitespace = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Properties(System.Action> action) { - SplitQueriesOnWhitespaceValue = splitQueriesOnWhitespace; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FlattenedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Similarity(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Similarity = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor SplitQueriesOnWhitespace(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DepthLimitValue.HasValue) - { - writer.WritePropertyName("depth_limit"); - writer.WriteNumberValue(DepthLimitValue.Value); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } + Instance.SplitQueriesOnWhitespace = value; + return this; + } - if (SplitQueriesOnWhitespaceValue.HasValue) - { - writer.WritePropertyName("split_queries_on_whitespace"); - writer.WriteBooleanValue(SplitQueriesOnWhitespaceValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("flattened"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FlattenedProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - DepthLimit = DepthLimitValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Similarity = SimilarityValue, - SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class FlattenedPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FlattenedPropertyDescriptor { - internal FlattenedPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty Instance { get; init; } - public FlattenedPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlattenedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private int? DepthLimitValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? SplitQueriesOnWhitespaceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FlattenedPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor descriptor) => descriptor.Instance; - public FlattenedPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public FlattenedPropertyDescriptor DepthLimit(int? depthLimit) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor DepthLimit(int? value) { - DepthLimitValue = depthLimit; - return Self; + Instance.DepthLimit = value; + return this; } - public FlattenedPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public FlattenedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public FlattenedPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FlattenedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FlattenedPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FlattenedPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FlattenedPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } /// @@ -432,170 +499,93 @@ public FlattenedPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Ma /// Metadata about the field. /// /// - public FlattenedPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FlattenedPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FlattenedPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public FlattenedPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SimilarityValue = similarity; - return Self; + Instance.Properties = value; + return this; } - public FlattenedPropertyDescriptor SplitQueriesOnWhitespace(bool? splitQueriesOnWhitespace = true) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Properties(System.Action action) { - SplitQueriesOnWhitespaceValue = splitQueriesOnWhitespace; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FlattenedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor Similarity(string? value) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DepthLimitValue.HasValue) - { - writer.WritePropertyName("depth_limit"); - writer.WriteNumberValue(DepthLimitValue.Value); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Similarity = value; + return this; + } - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor SplitQueriesOnWhitespace(bool? value = true) + { + Instance.SplitQueriesOnWhitespace = value; + return this; + } - if (SplitQueriesOnWhitespaceValue.HasValue) - { - writer.WritePropertyName("split_queries_on_whitespace"); - writer.WriteBooleanValue(SplitQueriesOnWhitespaceValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("flattened"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FlattenedProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - DepthLimit = DepthLimitValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Similarity = SimilarityValue, - SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatNumberProperty.g.cs index 71055b76a19..dea713017d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class FloatNumberProperty : IProperty +internal sealed partial class FloatNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyConverter))] +public sealed partial class FloatNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public FloatNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public FloatNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class FloatNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public float? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class FloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class FloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "float"; } -public sealed partial class FloatNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct FloatNumberPropertyDescriptor { - internal FloatNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty Instance { get; init; } - public FloatNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private float? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public FloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public FloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public FloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public FloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public FloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public FloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public FloatNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public FloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public FloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FloatNumberPropertyDescriptor NullValue(float? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor NullValue(float? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public FloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public FloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public FloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clie /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public FloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public FloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSe /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public FloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct FloatNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("float"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - FloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class FloatNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal FloatNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public FloatNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private float? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public FloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public FloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public FloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public FloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public FloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public FloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public FloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public FloatNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public FloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public FloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FloatNumberPropertyDescriptor NullValue(float? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor NullValue(float? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public FloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public FloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public FloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public FloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public FloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public FloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elastic /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public FloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public FloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimensi /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public FloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("float"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - FloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatRangeProperty.g.cs index d27758883b2..287a7928cb7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/FloatRangeProperty.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class FloatRangeProperty : IProperty +internal sealed partial class FloatRangePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyConverter))] +public sealed partial class FloatRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public FloatRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public FloatRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,100 +202,91 @@ public sealed partial class FloatRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "float_range"; } -public sealed partial class FloatRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct FloatRangePropertyDescriptor { - internal FloatRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty Instance { get; init; } - public FloatRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public FloatRangePropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public FloatRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public FloatRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public FloatRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public FloatRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public FloatRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FloatRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -153,222 +294,162 @@ public FloatRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public FloatRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FloatRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FloatRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public FloatRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("float_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FloatRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class FloatRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct FloatRangePropertyDescriptor { - internal FloatRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty Instance { get; init; } - public FloatRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FloatRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public FloatRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public FloatRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public FloatRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public FloatRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public FloatRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public FloatRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public FloatRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public FloatRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -376,137 +457,81 @@ public FloatRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public FloatRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public FloatRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public FloatRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public FloatRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("float_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - FloatRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs index e78b7c5d4c7..fb1f38600e3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs @@ -17,34 +17,211 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class GeoPointProperty : IProperty +internal sealed partial class GeoPointPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreZValue = System.Text.Json.JsonEncodedText.Encode("ignore_z_value"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIgnoreZValue = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIgnoreZValue.TryReadProperty(ref reader, options, PropIgnoreZValue, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + IgnoreZValue = propIgnoreZValue.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIgnoreZValue, value.IgnoreZValue, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyConverter))] +public sealed partial class GeoPointProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public GeoPointProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoPointProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("ignore_z_value")] public bool? IgnoreZValue { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,111 +229,94 @@ public sealed partial class GeoPointProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.GeoLocation? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "geo_point"; } -public sealed partial class GeoPointPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct GeoPointPropertyDescriptor { - internal GeoPointPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty instance) + { + Instance = instance; + } - public GeoPointPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPointPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor descriptor) => descriptor.Instance; - public GeoPointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public GeoPointPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public GeoPointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public GeoPointPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public GeoPointPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public GeoPointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } - public GeoPointPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -164,318 +324,198 @@ public GeoPointPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public GeoPointPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public GeoPointPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.GeoLocation? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public GeoPointPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta(System.Action? action) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.GeoLocation? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public GeoPointPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor NullValue(System.Func action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - public GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.OnScriptError = value; + return this; } - public GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Properties = value; + return this; } - public GeoPointPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Properties(System.Action> action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - StoreValue = store; - return Self; + Instance.Script = value; + return this; } - public GeoPointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script() { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script(System.Action? action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("geo_point"); - writer.WriteEndObject(); + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Store(bool? value = true) { - if (ScriptValue is not null) - { - return ScriptValue; - } + Instance.Store = value; + return this; + } - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (ScriptDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty Build(System.Action>? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - GeoPointProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class GeoPointPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct GeoPointPropertyDescriptor { - internal GeoPointPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty instance) + { + Instance = instance; + } - public GeoPointPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPointPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public GeoPointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public GeoPointPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public GeoPointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public GeoPointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public GeoPointPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public GeoPointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } - public GeoPointPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -483,228 +523,117 @@ public GeoPointPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public GeoPointPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public GeoPointPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.GeoLocation? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public GeoPointPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Meta(System.Action? action) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.GeoLocation? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public GeoPointPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor NullValue(System.Func action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - public GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.OnScriptError = value; + return this; } - public GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Properties = value; + return this; } - public GeoPointPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Properties(System.Action action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Properties(System.Action> action) { - StoreValue = store; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoPointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Script = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script() { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue is not null) - { - writer.WritePropertyName("null_value"); - JsonSerializer.Serialize(writer, NullValueValue, options); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("geo_point"); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor Store(bool? value = true) { - if (ScriptValue is not null) - { - return ScriptValue; - } + Instance.Store = value; + return this; + } - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (ScriptDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty Build(System.Action? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - GeoPointProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoShapeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoShapeProperty.g.cs index 2c10ba3ebc0..1b7fe867e80 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoShapeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoShapeProperty.g.cs @@ -17,62 +17,233 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class GeoShapePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreZValue = System.Text.Json.JsonEncodedText.Encode("ignore_z_value"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropOrientation = System.Text.Json.JsonEncodedText.Encode("orientation"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropStrategy = System.Text.Json.JsonEncodedText.Encode("strategy"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIgnoreZValue = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propOrientation = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propStrategy = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIgnoreZValue.TryReadProperty(ref reader, options, PropIgnoreZValue, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOrientation.TryReadProperty(ref reader, options, PropOrientation, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propStrategy.TryReadProperty(ref reader, options, PropStrategy, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + IgnoreZValue = propIgnoreZValue.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Orientation = propOrientation.Value, + Properties = propProperties.Value, + Store = propStore.Value, + Strategy = propStrategy.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIgnoreZValue, value.IgnoreZValue, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOrientation, value.Orientation, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropStrategy, value.Strategy, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + /// /// /// The geo_shape data type facilitates the indexing of and searching with arbitrary geo shapes such as rectangles /// and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class GeoShapeProperty : IProperty +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyConverter))] +public sealed partial class GeoShapeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("coerce")] +#if NET7_0_OR_GREATER + public GeoShapeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoShapeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("ignore_z_value")] public bool? IgnoreZValue { get; set; } + public bool? Index { get; set; } /// /// /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("orientation")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? Orientation { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("strategy")] public Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? Strategy { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "geo_shape"; } @@ -81,91 +252,91 @@ public sealed partial class GeoShapeProperty : IProperty /// The geo_shape data type facilitates the indexing of and searching with arbitrary geo shapes such as rectangles /// and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class GeoShapePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct GeoShapePropertyDescriptor { - internal GeoShapePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty instance) + { + Instance = instance; + } - public GeoShapePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? OrientationValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? StrategyValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor descriptor) => descriptor.Instance; - public GeoShapePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public GeoShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public GeoShapePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public GeoShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public GeoShapePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoShapePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public GeoShapePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public GeoShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Index(bool? value = true) + { + Instance.Index = value; + return this; } /// @@ -173,165 +344,89 @@ public GeoShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = t /// Metadata about the field. /// /// - public GeoShapePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public GeoShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? orientation) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta() { - OrientationValue = orientation; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public GeoShapePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Orientation = value; + return this; } - public GeoShapePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public GeoShapePropertyDescriptor Strategy(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? strategy) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Properties(System.Action> action) { - StrategyValue = strategy; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Strategy(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? value) { - writer.WriteStartObject(); - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (OrientationValue is not null) - { - writer.WritePropertyName("orientation"); - JsonSerializer.Serialize(writer, OrientationValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + Instance.Strategy = value; + return this; + } - if (StrategyValue is not null) - { - writer.WritePropertyName("strategy"); - JsonSerializer.Serialize(writer, StrategyValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("geo_shape"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - GeoShapeProperty IBuildableDescriptor.Build() => new() - { - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - Orientation = OrientationValue, - Properties = PropertiesValue, - Store = StoreValue, - Strategy = StrategyValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } /// @@ -339,91 +434,97 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The geo_shape data type facilitates the indexing of and searching with arbitrary geo shapes such as rectangles /// and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class GeoShapePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct GeoShapePropertyDescriptor { - internal GeoShapePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty instance) + { + Instance = instance; + } - public GeoShapePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? OrientationValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? StrategyValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Coerce(bool? value = true) + { + Instance.Coerce = value; + return this; + } - public GeoShapePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public GeoShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public GeoShapePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public GeoShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public GeoShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoShapePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoShapePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public GeoShapePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public GeoShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Index(bool? value = true) + { + Instance.Index = value; + return this; } /// @@ -431,163 +532,93 @@ public GeoShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) /// Metadata about the field. /// /// - public GeoShapePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public GeoShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? orientation) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta() { - OrientationValue = orientation; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public GeoShapePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Orientation = value; + return this; } - public GeoShapePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public GeoShapePropertyDescriptor Strategy(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? strategy) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Properties(System.Action action) { - StrategyValue = strategy; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public GeoShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (OrientationValue is not null) - { - writer.WritePropertyName("orientation"); - JsonSerializer.Serialize(writer, OrientationValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor Strategy(Elastic.Clients.Elasticsearch.Mapping.GeoStrategy? value) + { + Instance.Strategy = value; + return this; + } - if (StrategyValue is not null) - { - writer.WritePropertyName("strategy"); - JsonSerializer.Serialize(writer, StrategyValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("geo_shape"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - GeoShapeProperty IBuildableDescriptor.Build() => new() - { - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - Orientation = OrientationValue, - Properties = PropertiesValue, - Store = StoreValue, - Strategy = StrategyValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HalfFloatNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HalfFloatNumberProperty.g.cs index fa6266c6b1e..c7214bd5462 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HalfFloatNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HalfFloatNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class HalfFloatNumberProperty : IProperty +internal sealed partial class HalfFloatNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyConverter))] +public sealed partial class HalfFloatNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public HalfFloatNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public HalfFloatNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class HalfFloatNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public float? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class HalfFloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class HalfFloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "half_float"; } -public sealed partial class HalfFloatNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct HalfFloatNumberPropertyDescriptor { - internal HalfFloatNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty Instance { get; init; } - public HalfFloatNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HalfFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private float? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HalfFloatNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public HalfFloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public HalfFloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public HalfFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public HalfFloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public HalfFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public HalfFloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public HalfFloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public HalfFloatNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public HalfFloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public HalfFloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public HalfFloatNumberPropertyDescriptor NullValue(float? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor NullValue(float? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public HalfFloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public HalfFloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic. /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? ti /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public HalfFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct HalfFloatNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("half_float"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HalfFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HalfFloatNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - HalfFloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class HalfFloatNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal HalfFloatNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public HalfFloatNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private float? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public HalfFloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public HalfFloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public HalfFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public HalfFloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public HalfFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public HalfFloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public HalfFloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public HalfFloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public HalfFloatNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public HalfFloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public HalfFloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public HalfFloatNumberPropertyDescriptor NullValue(float? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor NullValue(float? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public HalfFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public HalfFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public HalfFloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public HalfFloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public HalfFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Ela /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public HalfFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDim /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public HalfFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("half_float"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - HalfFloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HistogramProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HistogramProperty.g.cs index 4cc969ef2b6..2aafaa6a2a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HistogramProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/HistogramProperty.g.cs @@ -17,25 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class HistogramProperty : IProperty +internal sealed partial class HistogramPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.HistogramProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyConverter))] +public sealed partial class HistogramProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public HistogramProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public HistogramProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } /// @@ -43,69 +153,60 @@ public sealed partial class HistogramProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "histogram"; } -public sealed partial class HistogramPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct HistogramPropertyDescriptor { - internal HistogramPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.HistogramProperty Instance { get; init; } - public HistogramPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public HistogramPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public HistogramPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HistogramPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public HistogramPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } /// @@ -113,152 +214,126 @@ public HistogramPropertyDescriptor IgnoreMalformed(bool? ignoreMalfor /// Metadata about the field. /// /// - public HistogramPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public HistogramPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public HistogramPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.HistogramProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("histogram"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HistogramProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class HistogramPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct HistogramPropertyDescriptor { - internal HistogramPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.HistogramProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty instance) + { + Instance = instance; + } - public HistogramPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor descriptor) => descriptor.Instance; - public HistogramPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public HistogramPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HistogramPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public HistogramPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public HistogramPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } /// @@ -266,96 +341,75 @@ public HistogramPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) /// Metadata about the field. /// /// - public HistogramPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public HistogramPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public HistogramPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.HistogramProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("histogram"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.HistogramProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - HistogramProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IcuCollationProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IcuCollationProperty.g.cs index 7ad289bd77d..d0af9e5dc94 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IcuCollationProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IcuCollationProperty.g.cs @@ -17,40 +17,304 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class IcuCollationProperty : IProperty +internal sealed partial class IcuCollationPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("alternate")] + private static readonly System.Text.Json.JsonEncodedText PropAlternate = System.Text.Json.JsonEncodedText.Encode("alternate"); + private static readonly System.Text.Json.JsonEncodedText PropCaseFirst = System.Text.Json.JsonEncodedText.Encode("case_first"); + private static readonly System.Text.Json.JsonEncodedText PropCaseLevel = System.Text.Json.JsonEncodedText.Encode("case_level"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropCountry = System.Text.Json.JsonEncodedText.Encode("country"); + private static readonly System.Text.Json.JsonEncodedText PropDecomposition = System.Text.Json.JsonEncodedText.Encode("decomposition"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropHiraganaQuaternaryMode = System.Text.Json.JsonEncodedText.Encode("hiragana_quaternary_mode"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("language"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropNumeric = System.Text.Json.JsonEncodedText.Encode("numeric"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropStrength = System.Text.Json.JsonEncodedText.Encode("strength"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropVariableTop = System.Text.Json.JsonEncodedText.Encode("variable_top"); + private static readonly System.Text.Json.JsonEncodedText PropVariant = System.Text.Json.JsonEncodedText.Encode("variant"); + + public override Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlternate = default; + LocalJsonValue propCaseFirst = default; + LocalJsonValue propCaseLevel = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propCountry = default; + LocalJsonValue propDecomposition = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propHiraganaQuaternaryMode = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue propLanguage = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNorms = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propNumeric = default; + LocalJsonValue propProperties = default; + LocalJsonValue propRules = default; + LocalJsonValue propStore = default; + LocalJsonValue propStrength = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propVariableTop = default; + LocalJsonValue propVariant = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlternate.TryReadProperty(ref reader, options, PropAlternate, null)) + { + continue; + } + + if (propCaseFirst.TryReadProperty(ref reader, options, PropCaseFirst, null)) + { + continue; + } + + if (propCaseLevel.TryReadProperty(ref reader, options, PropCaseLevel, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propCountry.TryReadProperty(ref reader, options, PropCountry, null)) + { + continue; + } + + if (propDecomposition.TryReadProperty(ref reader, options, PropDecomposition, null)) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propHiraganaQuaternaryMode.TryReadProperty(ref reader, options, PropHiraganaQuaternaryMode, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propNumeric.TryReadProperty(ref reader, options, PropNumeric, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propRules.TryReadProperty(ref reader, options, PropRules, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propStrength.TryReadProperty(ref reader, options, PropStrength, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propVariableTop.TryReadProperty(ref reader, options, PropVariableTop, null)) + { + continue; + } + + if (propVariant.TryReadProperty(ref reader, options, PropVariant, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Alternate = propAlternate.Value, + CaseFirst = propCaseFirst.Value, + CaseLevel = propCaseLevel.Value, + CopyTo = propCopyTo.Value, + Country = propCountry.Value, + Decomposition = propDecomposition.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + HiraganaQuaternaryMode = propHiraganaQuaternaryMode.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + Language = propLanguage.Value, + Meta = propMeta.Value, + Norms = propNorms.Value, + NullValue = propNullValue.Value, + Numeric = propNumeric.Value, + Properties = propProperties.Value, + Rules = propRules.Value, + Store = propStore.Value, + Strength = propStrength.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + VariableTop = propVariableTop.Value, + Variant = propVariant.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlternate, value.Alternate, null, null); + writer.WriteProperty(options, PropCaseFirst, value.CaseFirst, null, null); + writer.WriteProperty(options, PropCaseLevel, value.CaseLevel, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropCountry, value.Country, null, null); + writer.WriteProperty(options, PropDecomposition, value.Decomposition, null, null); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropHiraganaQuaternaryMode, value.HiraganaQuaternaryMode, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropNumeric, value.Numeric, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropRules, value.Rules, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropStrength, value.Strength, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropVariableTop, value.VariableTop, null, null); + writer.WriteProperty(options, PropVariant, value.Variant, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyConverter))] +public sealed partial class IcuCollationProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public IcuCollationProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public IcuCollationProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? Alternate { get; set; } - [JsonInclude, JsonPropertyName("case_first")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirst { get; set; } - [JsonInclude, JsonPropertyName("case_level")] public bool? CaseLevel { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("country")] public string? Country { get; set; } - [JsonInclude, JsonPropertyName("decomposition")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? Decomposition { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("hiragana_quaternary_mode")] public bool? HiraganaQuaternaryMode { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -58,11 +322,8 @@ public sealed partial class IcuCollationProperty : IProperty /// Should the field be searchable? /// /// - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } - [JsonInclude, JsonPropertyName("language")] public string? Language { get; set; } /// @@ -70,9 +331,7 @@ public sealed partial class IcuCollationProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("norms")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? Norms { get; set; } /// @@ -80,142 +339,115 @@ public sealed partial class IcuCollationProperty : IProperty /// Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. /// /// - [JsonInclude, JsonPropertyName("null_value")] public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("numeric")] public bool? Numeric { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("rules")] public string? Rules { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("strength")] public Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? Strength { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "icu_collation_keyword"; - [JsonInclude, JsonPropertyName("variable_top")] public string? VariableTop { get; set; } - [JsonInclude, JsonPropertyName("variant")] public string? Variant { get; set; } } -public sealed partial class IcuCollationPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct IcuCollationPropertyDescriptor { - internal IcuCollationPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty Instance { get; init; } - public IcuCollationPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? AlternateValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirstValue { get; set; } - private bool? CaseLevelValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private string? CountryValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? DecompositionValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private bool? HiraganaQuaternaryModeValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private string? LanguageValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private string? NullValueValue { get; set; } - private bool? NumericValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? RulesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? StrengthValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private string? VariableTopValue { get; set; } - private string? VariantValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor descriptor) => descriptor.Instance; - public IcuCollationPropertyDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? alternate) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? value) { - AlternateValue = alternate; - return Self; + Instance.Alternate = value; + return this; } - public IcuCollationPropertyDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? caseFirst) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? value) { - CaseFirstValue = caseFirst; - return Self; + Instance.CaseFirst = value; + return this; } - public IcuCollationPropertyDescriptor CaseLevel(bool? caseLevel = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CaseLevel(bool? value = true) { - CaseLevelValue = caseLevel; - return Self; + Instance.CaseLevel = value; + return this; } - public IcuCollationPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IcuCollationPropertyDescriptor Country(string? country) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CountryValue = country; - return Self; + Instance.CopyTo = value; + return this; } - public IcuCollationPropertyDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? decomposition) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Country(string? value) { - DecompositionValue = decomposition; - return Self; + Instance.Country = value; + return this; } - public IcuCollationPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? value) { - DocValuesValue = docValues; - return Self; + Instance.Decomposition = value; + return this; } - public IcuCollationPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public IcuCollationPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor HiraganaQuaternaryMode(bool? hiraganaQuaternaryMode = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor HiraganaQuaternaryMode(bool? value = true) { - HiraganaQuaternaryModeValue = hiraganaQuaternaryMode; - return Self; + Instance.HiraganaQuaternaryMode = value; + return this; } - public IcuCollationPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -223,22 +455,22 @@ public IcuCollationPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Should the field be searchable? /// /// - public IcuCollationPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public IcuCollationPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public IcuCollationPropertyDescriptor Language(string? language) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Language(string? value) { - LanguageValue = language; - return Self; + Instance.Language = value; + return this; } /// @@ -246,391 +478,227 @@ public IcuCollationPropertyDescriptor Language(string? language) /// Metadata about the field. /// /// - public IcuCollationPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IcuCollationPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// /// - /// Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. + /// Metadata about the field. /// /// - public IcuCollationPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IcuCollationPropertyDescriptor Numeric(bool? numeric = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor AddMeta(string key, string value) { - NumericValue = numeric; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Norms(bool? value = true) { - PropertiesValue = properties; - return Self; + Instance.Norms = value; + return this; } - public IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor NullValue(string? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public IcuCollationPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Numeric(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Numeric = value; + return this; } - public IcuCollationPropertyDescriptor Rules(string? rules) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - RulesValue = rules; - return Self; + Instance.Properties = value; + return this; } - public IcuCollationPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Properties(System.Action> action) { - StoreValue = store; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? strength) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Rules(string? value) { - StrengthValue = strength; - return Self; + Instance.Rules = value; + return this; } - public IcuCollationPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; } - public IcuCollationPropertyDescriptor VariableTop(string? variableTop) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? value) { - VariableTopValue = variableTop; - return Self; + Instance.Strength = value; + return this; } - public IcuCollationPropertyDescriptor Variant(string? variant) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - VariantValue = variant; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor VariableTop(string? value) { - writer.WriteStartObject(); - if (AlternateValue is not null) - { - writer.WritePropertyName("alternate"); - JsonSerializer.Serialize(writer, AlternateValue, options); - } - - if (CaseFirstValue is not null) - { - writer.WritePropertyName("case_first"); - JsonSerializer.Serialize(writer, CaseFirstValue, options); - } - - if (CaseLevelValue.HasValue) - { - writer.WritePropertyName("case_level"); - writer.WriteBooleanValue(CaseLevelValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (!string.IsNullOrEmpty(CountryValue)) - { - writer.WritePropertyName("country"); - writer.WriteStringValue(CountryValue); - } - - if (DecompositionValue is not null) - { - writer.WritePropertyName("decomposition"); - JsonSerializer.Serialize(writer, DecompositionValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (HiraganaQuaternaryModeValue.HasValue) - { - writer.WritePropertyName("hiragana_quaternary_mode"); - writer.WriteBooleanValue(HiraganaQuaternaryModeValue.Value); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (!string.IsNullOrEmpty(LanguageValue)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(LanguageValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (NumericValue.HasValue) - { - writer.WritePropertyName("numeric"); - writer.WriteBooleanValue(NumericValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(RulesValue)) - { - writer.WritePropertyName("rules"); - writer.WriteStringValue(RulesValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (StrengthValue is not null) - { - writer.WritePropertyName("strength"); - JsonSerializer.Serialize(writer, StrengthValue, options); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + Instance.VariableTop = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_collation_keyword"); - if (!string.IsNullOrEmpty(VariableTopValue)) - { - writer.WritePropertyName("variable_top"); - writer.WriteStringValue(VariableTopValue); - } + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Variant(string? value) + { + Instance.Variant = value; + return this; + } - if (!string.IsNullOrEmpty(VariantValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("variant"); - writer.WriteStringValue(VariantValue); + return new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IcuCollationProperty IBuildableDescriptor.Build() => new() - { - Alternate = AlternateValue, - CaseFirst = CaseFirstValue, - CaseLevel = CaseLevelValue, - CopyTo = CopyToValue, - Country = CountryValue, - Decomposition = DecompositionValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - HiraganaQuaternaryMode = HiraganaQuaternaryModeValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Language = LanguageValue, - Meta = MetaValue, - Norms = NormsValue, - NullValue = NullValueValue, - Numeric = NumericValue, - Properties = PropertiesValue, - Rules = RulesValue, - Store = StoreValue, - Strength = StrengthValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - VariableTop = VariableTopValue, - Variant = VariantValue - }; } -public sealed partial class IcuCollationPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IcuCollationPropertyDescriptor { - internal IcuCollationPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty Instance { get; init; } - public IcuCollationPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? AlternateValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirstValue { get; set; } - private bool? CaseLevelValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private string? CountryValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? DecompositionValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private bool? HiraganaQuaternaryModeValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private string? LanguageValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private string? NullValueValue { get; set; } - private bool? NumericValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? RulesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? StrengthValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private string? VariableTopValue { get; set; } - private string? VariantValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IcuCollationPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? value) + { + Instance.Alternate = value; + return this; + } - public IcuCollationPropertyDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? alternate) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? value) { - AlternateValue = alternate; - return Self; + Instance.CaseFirst = value; + return this; } - public IcuCollationPropertyDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? caseFirst) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CaseLevel(bool? value = true) { - CaseFirstValue = caseFirst; - return Self; + Instance.CaseLevel = value; + return this; } - public IcuCollationPropertyDescriptor CaseLevel(bool? caseLevel = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CaseLevelValue = caseLevel; - return Self; + Instance.CopyTo = value; + return this; } - public IcuCollationPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IcuCollationPropertyDescriptor Country(string? country) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Country(string? value) { - CountryValue = country; - return Self; + Instance.Country = value; + return this; } - public IcuCollationPropertyDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? decomposition) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? value) { - DecompositionValue = decomposition; - return Self; + Instance.Decomposition = value; + return this; } - public IcuCollationPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public IcuCollationPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor HiraganaQuaternaryMode(bool? hiraganaQuaternaryMode = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor HiraganaQuaternaryMode(bool? value = true) { - HiraganaQuaternaryModeValue = hiraganaQuaternaryMode; - return Self; + Instance.HiraganaQuaternaryMode = value; + return this; } - public IcuCollationPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -638,22 +706,22 @@ public IcuCollationPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Should the field be searchable? /// /// - public IcuCollationPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public IcuCollationPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public IcuCollationPropertyDescriptor Language(string? language) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Language(string? value) { - LanguageValue = language; - return Self; + Instance.Language = value; + return this; } /// @@ -661,275 +729,128 @@ public IcuCollationPropertyDescriptor Language(string? language) /// Metadata about the field. /// /// - public IcuCollationPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IcuCollationPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// /// - /// Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. + /// Metadata about the field. /// /// - public IcuCollationPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IcuCollationPropertyDescriptor Numeric(bool? numeric = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor AddMeta(string key, string value) { - NumericValue = numeric; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Norms(bool? value = true) { - PropertiesValue = properties; - return Self; + Instance.Norms = value; + return this; } - public IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor NullValue(string? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public IcuCollationPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Numeric(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Numeric = value; + return this; } - public IcuCollationPropertyDescriptor Rules(string? rules) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - RulesValue = rules; - return Self; + Instance.Properties = value; + return this; } - public IcuCollationPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Properties(System.Action action) { - StoreValue = store; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? strength) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Properties(System.Action> action) { - StrengthValue = strength; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IcuCollationPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Rules(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Rules = value; + return this; } - public IcuCollationPropertyDescriptor VariableTop(string? variableTop) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Store(bool? value = true) { - VariableTopValue = variableTop; - return Self; + Instance.Store = value; + return this; } - public IcuCollationPropertyDescriptor Variant(string? variant) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? value) { - VariantValue = variant; - return Self; + Instance.Strength = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (AlternateValue is not null) - { - writer.WritePropertyName("alternate"); - JsonSerializer.Serialize(writer, AlternateValue, options); - } - - if (CaseFirstValue is not null) - { - writer.WritePropertyName("case_first"); - JsonSerializer.Serialize(writer, CaseFirstValue, options); - } - - if (CaseLevelValue.HasValue) - { - writer.WritePropertyName("case_level"); - writer.WriteBooleanValue(CaseLevelValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (!string.IsNullOrEmpty(CountryValue)) - { - writer.WritePropertyName("country"); - writer.WriteStringValue(CountryValue); - } - - if (DecompositionValue is not null) - { - writer.WritePropertyName("decomposition"); - JsonSerializer.Serialize(writer, DecompositionValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (HiraganaQuaternaryModeValue.HasValue) - { - writer.WritePropertyName("hiragana_quaternary_mode"); - writer.WriteBooleanValue(HiraganaQuaternaryModeValue.Value); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (!string.IsNullOrEmpty(LanguageValue)) - { - writer.WritePropertyName("language"); - writer.WriteStringValue(LanguageValue); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (NumericValue.HasValue) - { - writer.WritePropertyName("numeric"); - writer.WriteBooleanValue(NumericValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(RulesValue)) - { - writer.WritePropertyName("rules"); - writer.WriteStringValue(RulesValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (StrengthValue is not null) - { - writer.WritePropertyName("strength"); - JsonSerializer.Serialize(writer, StrengthValue, options); - } + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor VariableTop(string? value) + { + Instance.VariableTop = value; + return this; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("icu_collation_keyword"); - if (!string.IsNullOrEmpty(VariableTopValue)) - { - writer.WritePropertyName("variable_top"); - writer.WriteStringValue(VariableTopValue); - } + public Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor Variant(string? value) + { + Instance.Variant = value; + return this; + } - if (!string.IsNullOrEmpty(VariantValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("variant"); - writer.WriteStringValue(VariantValue); + return new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IcuCollationProperty IBuildableDescriptor.Build() => new() - { - Alternate = AlternateValue, - CaseFirst = CaseFirstValue, - CaseLevel = CaseLevelValue, - CopyTo = CopyToValue, - Country = CountryValue, - Decomposition = DecompositionValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - HiraganaQuaternaryMode = HiraganaQuaternaryModeValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Language = LanguageValue, - Meta = MetaValue, - Norms = NormsValue, - NullValue = NullValueValue, - Numeric = NumericValue, - Properties = PropertiesValue, - Rules = RulesValue, - Store = StoreValue, - Strength = StrengthValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - VariableTop = VariableTopValue, - Variant = VariantValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IndexField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IndexField.g.cs index 54cb017efe2..8c6943b2cd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IndexField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IndexField.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class IndexFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Mapping.IndexField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IndexField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IndexField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IndexFieldConverter))] public sealed partial class IndexField { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexField(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public IndexField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class IndexFieldDescriptor : SerializableDescriptor +public readonly partial struct IndexFieldDescriptor { - internal IndexFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IndexField Instance { get; init; } - public IndexFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.IndexField instance) { + Instance = instance; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IndexField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IndexFieldDescriptor Enabled(bool enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.IndexField instance) => new Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IndexField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IndexField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerNumberProperty.g.cs index 14674ebd906..8c28bc0ad6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class IntegerNumberProperty : IProperty +internal sealed partial class IntegerNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyConverter))] +public sealed partial class IntegerNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public IntegerNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public IntegerNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class IntegerNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public int? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class IntegerNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class IntegerNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "integer"; } -public sealed partial class IntegerNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct IntegerNumberPropertyDescriptor { - internal IntegerNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty Instance { get; init; } - public IntegerNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private int? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IntegerNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public IntegerNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public IntegerNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IntegerNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public IntegerNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public IntegerNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public IntegerNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IntegerNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public IntegerNumberPropertyDescriptor NullValue(int? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IntegerNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor NullValue(int? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public IntegerNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public IntegerNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public IntegerNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Cl /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? time /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IntegerNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct IntegerNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("integer"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - IntegerNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class IntegerNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal IntegerNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IntegerNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private int? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public IntegerNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public IntegerNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public IntegerNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public IntegerNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IntegerNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public IntegerNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public IntegerNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public IntegerNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public IntegerNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IntegerNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IntegerNumberPropertyDescriptor NullValue(int? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor NullValue(int? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public IntegerNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public IntegerNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public IntegerNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public IntegerNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public IntegerNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public IntegerNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elast /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public IntegerNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimen /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IntegerNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("integer"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - IntegerNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerRangeProperty.g.cs index de6b052568b..23388acac9f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IntegerRangeProperty.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class IntegerRangeProperty : IProperty +internal sealed partial class IntegerRangePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyConverter))] +public sealed partial class IntegerRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public IntegerRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public IntegerRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,100 +202,91 @@ public sealed partial class IntegerRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "integer_range"; } -public sealed partial class IntegerRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct IntegerRangePropertyDescriptor { - internal IntegerRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty Instance { get; init; } - public IntegerRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IntegerRangePropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public IntegerRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public IntegerRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public IntegerRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IntegerRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -153,222 +294,162 @@ public IntegerRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IntegerRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IntegerRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IntegerRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public IntegerRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("integer_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IntegerRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class IntegerRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IntegerRangePropertyDescriptor { - internal IntegerRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty Instance { get; init; } - public IntegerRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntegerRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IntegerRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public IntegerRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IntegerRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public IntegerRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public IntegerRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IntegerRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IntegerRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -376,137 +457,81 @@ public IntegerRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IntegerRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IntegerRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IntegerRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public IntegerRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("integer_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IntegerRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpProperty.g.cs index a7e773c1450..e4691667ada 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpProperty.g.cs @@ -17,34 +17,220 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class IpProperty : IProperty +internal sealed partial class IpPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("boost")] + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.IpProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IpProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IpPropertyConverter))] +public sealed partial class IpProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public IpProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public IpProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,19 +238,12 @@ public sealed partial class IpProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -72,100 +251,110 @@ public sealed partial class IpProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "ip"; } -public sealed partial class IpPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct IpPropertyDescriptor { - internal IpPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IpProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpProperty instance) + { + Instance = instance; + } - public IpPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IpPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public IpPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IpPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public IpPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IpPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public IpPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public IpPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -173,78 +362,71 @@ public IpPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IpPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta(System.Action? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IpPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor AddMeta(string key, string value) { - NullValueValue = nullValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IpPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor NullValue(string? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.NullValue = value; + return this; } - public IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = properties; - return Self; + Instance.OnScriptError = value; + return this; } - public IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public IpPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public IpPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -252,258 +434,131 @@ public IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elast /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IpPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IpProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } +public readonly partial struct IpPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.IpProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("ip"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - IpProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class IpPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal IpPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IpPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; + } - public IpPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor DocValues(bool? value = true) { - BoostValue = boost; - return Self; + Instance.DocValues = value; + return this; } - public IpPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public IpPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public IpPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IpPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public IpPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public IpPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public IpPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -511,78 +566,77 @@ public IpPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IpPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Meta(System.Action? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IpPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor AddMeta(string key, string value) { - NullValueValue = nullValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IpPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor NullValue(string? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.NullValue = value; + return this; } - public IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = properties; - return Self; + Instance.OnScriptError = value; + return this; } - public IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public IpPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Properties(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public IpPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public IpPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -590,167 +644,22 @@ public IpPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Ma /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public IpPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IpProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) + if (action is null) { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("ip"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IpProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - IpProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpRangeProperty.g.cs index ae250c3913b..c162146f6a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/IpRangeProperty.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class IpRangeProperty : IProperty +internal sealed partial class IpRangePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyConverter))] +public sealed partial class IpRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public IpRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public IpRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,100 +202,91 @@ public sealed partial class IpRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "ip_range"; } -public sealed partial class IpRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct IpRangePropertyDescriptor { - internal IpRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty Instance { get; init; } - public IpRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public IpRangePropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public IpRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public IpRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IpRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public IpRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public IpRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IpRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -153,222 +294,162 @@ public IpRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IpRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IpRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IpRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public IpRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("ip_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IpRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class IpRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct IpRangePropertyDescriptor { - internal IpRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty Instance { get; init; } - public IpRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public IpRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public IpRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public IpRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public IpRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public IpRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public IpRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public IpRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public IpRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -376,137 +457,81 @@ public IpRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public IpRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public IpRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public IpRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public IpRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("ip_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - IpRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/JoinProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/JoinProperty.g.cs index 7bed45378a0..717bf19d7d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/JoinProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/JoinProperty.g.cs @@ -17,25 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class JoinProperty : IProperty +internal sealed partial class JoinPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEagerGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("eager_global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRelations = System.Text.Json.JsonEncodedText.Encode("relations"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.JoinProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propEagerGlobalOrdinals = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue>?> propRelations = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEagerGlobalOrdinals.TryReadProperty(ref reader, options, PropEagerGlobalOrdinals, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propRelations.TryReadProperty(ref reader, options, PropRelations, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + EagerGlobalOrdinals = propEagerGlobalOrdinals.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Relations = propRelations.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.JoinProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEagerGlobalOrdinals, value.EagerGlobalOrdinals, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropRelations, value.Relations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.JoinPropertyConverter))] +public sealed partial class JoinProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("dynamic")] +#if NET7_0_OR_GREATER + public JoinProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public JoinProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("eager_global_ordinals")] public bool? EagerGlobalOrdinals { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -43,72 +162,61 @@ public sealed partial class JoinProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("relations")] - public IDictionary>>? Relations { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] + public System.Collections.Generic.IDictionary>? Relations { get; set; } public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "join"; } -public sealed partial class JoinPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct JoinPropertyDescriptor { - internal JoinPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.JoinProperty Instance { get; init; } - public JoinPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.JoinProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private IDictionary>>? RelationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public JoinPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public JoinPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.JoinProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Dynamic = value; + return this; } - public JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public JoinPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public JoinPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -116,166 +224,158 @@ public JoinPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public JoinPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public JoinPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public JoinPropertyDescriptor Relations(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - RelationsValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Properties = value; + return this; } - public JoinPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations(System.Collections.Generic.IDictionary>? value) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } + Instance.Relations = value; + return this; + } - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations() + { + Instance.Relations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; + } - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations(System.Action? action) + { + Instance.Relations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddRelation(string key, System.Collections.Generic.ICollection value) + { + Instance.Relations ??= new System.Collections.Generic.Dictionary>(); + Instance.Relations.Add(key, value); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddRelation(string key, params string[] values) + { + Instance.Relations ??= new System.Collections.Generic.Dictionary>(); + Instance.Relations.Add(key, [.. values]); + return this; + } - if (RelationsValue is not null) - { - writer.WritePropertyName("relations"); - JsonSerializer.Serialize(writer, RelationsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.JoinProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("join"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - JoinProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Relations = RelationsValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class JoinPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct JoinPropertyDescriptor { - internal JoinPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.JoinProperty Instance { get; init; } - public JoinPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.JoinProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private IDictionary>>? RelationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JoinPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.JoinProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor descriptor) => descriptor.Instance; - public JoinPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public JoinPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public JoinPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public JoinPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public JoinPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -283,109 +383,107 @@ public JoinPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public JoinPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public JoinPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public JoinPropertyDescriptor Relations(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - RelationsValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Properties = value; + return this; } - public JoinPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations(System.Collections.Generic.IDictionary>? value) + { + Instance.Relations = value; + return this; + } - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations() + { + Instance.Relations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; + } - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor Relations(System.Action? action) + { + Instance.Relations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddRelation(string key, System.Collections.Generic.ICollection value) + { + Instance.Relations ??= new System.Collections.Generic.Dictionary>(); + Instance.Relations.Add(key, value); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor AddRelation(string key, params string[] values) + { + Instance.Relations ??= new System.Collections.Generic.Dictionary>(); + Instance.Relations.Add(key, [.. values]); + return this; + } - if (RelationsValue is not null) - { - writer.WritePropertyName("relations"); - JsonSerializer.Serialize(writer, RelationsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.JoinProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("join"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.JoinProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - JoinProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Relations = RelationsValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs index 928b56f5be7..334bb4016b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs @@ -17,36 +17,266 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class KeywordProperty : IProperty +internal sealed partial class KeywordPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("boost")] + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEagerGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("eager_global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizer = System.Text.Json.JsonEncodedText.Encode("normalizer"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropSplitQueriesOnWhitespace = System.Text.Json.JsonEncodedText.Encode("split_queries_on_whitespace"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.KeywordProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEagerGlobalOrdinals = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNormalizer = default; + LocalJsonValue propNorms = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propSplitQueriesOnWhitespace = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEagerGlobalOrdinals.TryReadProperty(ref reader, options, PropEagerGlobalOrdinals, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNormalizer.TryReadProperty(ref reader, options, PropNormalizer, null)) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propSplitQueriesOnWhitespace.TryReadProperty(ref reader, options, PropSplitQueriesOnWhitespace, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + EagerGlobalOrdinals = propEagerGlobalOrdinals.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + Meta = propMeta.Value, + Normalizer = propNormalizer.Value, + Norms = propNorms.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Similarity = propSimilarity.Value, + SplitQueriesOnWhitespace = propSplitQueriesOnWhitespace.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEagerGlobalOrdinals, value.EagerGlobalOrdinals, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNormalizer, value.Normalizer, null, null); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropSplitQueriesOnWhitespace, value.SplitQueriesOnWhitespace, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyConverter))] +public sealed partial class KeywordProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public KeywordProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeywordProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("eager_global_ordinals")] public bool? EagerGlobalOrdinals { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } /// @@ -54,27 +284,16 @@ public sealed partial class KeywordProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("normalizer")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public string? Normalizer { get; set; } - [JsonInclude, JsonPropertyName("norms")] public bool? Norms { get; set; } - [JsonInclude, JsonPropertyName("null_value")] public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } - [JsonInclude, JsonPropertyName("split_queries_on_whitespace")] public bool? SplitQueriesOnWhitespace { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -82,111 +301,94 @@ public sealed partial class KeywordProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "keyword"; } -public sealed partial class KeywordPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct KeywordPropertyDescriptor { - internal KeywordPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.KeywordProperty Instance { get; init; } - public KeywordPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NormalizerValue { get; set; } - private bool? NormsValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? SimilarityValue { get; set; } - private bool? SplitQueriesOnWhitespaceValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public KeywordPropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public KeywordPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public KeywordPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public KeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public KeywordPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Dynamic = value; + return this; } - public KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public KeywordPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public KeywordPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } /// @@ -194,102 +396,117 @@ public KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elastic /// Metadata about the field. /// /// - public KeywordPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public KeywordPropertyDescriptor Normalizer(string? normalizer) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta() { - NormalizerValue = normalizer; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public KeywordPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta(System.Action? action) { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public KeywordPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor AddMeta(string key, string value) { - NullValueValue = nullValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Normalizer(string? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Normalizer = value; + return this; } - public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Norms(bool? value = true) { - PropertiesValue = properties; - return Self; + Instance.Norms = value; + return this; } - public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor NullValue(string? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public KeywordPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = value; + return this; } - public KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Properties(System.Action> action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } - public KeywordPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script() { - SimilarityValue = similarity; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public KeywordPropertyDescriptor SplitQueriesOnWhitespace(bool? splitQueriesOnWhitespace = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script(System.Action? action) { - SplitQueriesOnWhitespaceValue = splitQueriesOnWhitespace; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Similarity(string? value) { - StoreValue = store; - return Self; + Instance.Similarity = value; + return this; } - public KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor SplitQueriesOnWhitespace(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SplitQueriesOnWhitespace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -297,304 +514,137 @@ public KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients. /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public KeywordPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.KeywordProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NormalizerValue)) - { - writer.WritePropertyName("normalizer"); - writer.WriteStringValue(NormalizerValue); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (!string.IsNullOrEmpty(NullValueValue)) + if (action is null) { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); + return new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } - - if (SplitQueriesOnWhitespaceValue.HasValue) - { - writer.WritePropertyName("split_queries_on_whitespace"); - writer.WriteBooleanValue(SplitQueriesOnWhitespaceValue.Value); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } +public readonly partial struct KeywordPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.KeywordProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("keyword"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KeywordPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - KeywordProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Meta = MetaValue, - Normalizer = NormalizerValue, - Norms = NormsValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Similarity = SimilarityValue, - SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class KeywordPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal KeywordPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public KeywordPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NormalizerValue { get; set; } - private bool? NormsValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private string? SimilarityValue { get; set; } - private bool? SplitQueriesOnWhitespaceValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; + } - public KeywordPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor DocValues(bool? value = true) { - BoostValue = boost; - return Self; + Instance.DocValues = value; + return this; } - public KeywordPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public KeywordPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public KeywordPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DynamicValue = dynamic; - return Self; + Instance.Fields = value; + return this; } - public KeywordPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Fields(System.Action action) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public KeywordPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Index(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Index = value; + return this; } - public KeywordPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IndexOptions = value; + return this; } - public KeywordPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } - public KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta() { - IndexOptionsValue = indexOptions; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -602,102 +652,101 @@ public KeywordPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapp /// Metadata about the field. /// /// - public KeywordPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Meta(System.Action? action) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public KeywordPropertyDescriptor Normalizer(string? normalizer) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor AddMeta(string key, string value) { - NormalizerValue = normalizer; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public KeywordPropertyDescriptor Norms(bool? norms = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Normalizer(string? value) { - NormsValue = norms; - return Self; + Instance.Normalizer = value; + return this; } - public KeywordPropertyDescriptor NullValue(string? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Norms(bool? value = true) { - NullValueValue = nullValue; - return Self; + Instance.Norms = value; + return this; } - public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor NullValue(string? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.NullValue = value; + return this; } - public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = properties; - return Self; + Instance.OnScriptError = value; + return this; } - public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public KeywordPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Properties(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public KeywordPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public KeywordPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Script(System.Action? action) { - SimilarityValue = similarity; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public KeywordPropertyDescriptor SplitQueriesOnWhitespace(bool? splitQueriesOnWhitespace = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Similarity(string? value) { - SplitQueriesOnWhitespaceValue = splitQueriesOnWhitespace; - return Self; + Instance.Similarity = value; + return this; } - public KeywordPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor SplitQueriesOnWhitespace(bool? value = true) { - StoreValue = store; - return Self; + Instance.SplitQueriesOnWhitespace = value; + return this; } - public KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -705,202 +754,22 @@ public KeywordPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsear /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public KeywordPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.KeywordProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NormalizerValue)) - { - writer.WritePropertyName("normalizer"); - writer.WriteStringValue(NormalizerValue); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } - - if (SplitQueriesOnWhitespaceValue.HasValue) - { - writer.WritePropertyName("split_queries_on_whitespace"); - writer.WriteBooleanValue(SplitQueriesOnWhitespaceValue.Value); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("keyword"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.KeywordProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - KeywordProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - Meta = MetaValue, - Normalizer = NormalizerValue, - Norms = NormsValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Similarity = SimilarityValue, - SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongNumberProperty.g.cs index e9cf13c2661..a76c3b762a8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class LongNumberProperty : IProperty +internal sealed partial class LongNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyConverter))] +public sealed partial class LongNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public LongNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public LongNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class LongNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public long? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class LongNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class LongNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "long"; } -public sealed partial class LongNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct LongNumberPropertyDescriptor { - internal LongNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty Instance { get; init; } - public LongNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public LongNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public LongNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public LongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public LongNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public LongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public LongNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public LongNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public LongNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public LongNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public LongNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public LongNumberPropertyDescriptor NullValue(long? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public LongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor NullValue(long? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public LongNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public LongNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public LongNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clien /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public LongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public LongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSer /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public LongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct LongNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("long"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - LongNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class LongNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal LongNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public LongNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public LongNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public LongNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public LongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public LongNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public LongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public LongNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public LongNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public LongNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public LongNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public LongNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public LongNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public LongNumberPropertyDescriptor NullValue(long? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor NullValue(long? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public LongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public LongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public LongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public LongNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public LongNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public LongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elastics /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public LongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public LongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimensio /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public LongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("long"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - LongNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongRangeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongRangeProperty.g.cs index db676111088..079547bd19d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongRangeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/LongRangeProperty.g.cs @@ -17,34 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class LongRangeProperty : IProperty +internal sealed partial class LongRangePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyConverter))] +public sealed partial class LongRangeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public LongRangeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public LongRangeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -52,100 +202,91 @@ public sealed partial class LongRangeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "long_range"; } -public sealed partial class LongRangePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct LongRangePropertyDescriptor { - internal LongRangePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty Instance { get; init; } - public LongRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public LongRangePropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public LongRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public LongRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public LongRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public LongRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public LongRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public LongRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -153,222 +294,162 @@ public LongRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public LongRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public LongRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public LongRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public LongRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("long_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LongRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class LongRangePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct LongRangePropertyDescriptor { - internal LongRangePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty Instance { get; init; } - public LongRangePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LongRangePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public LongRangePropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public LongRangePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public LongRangePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public LongRangePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public LongRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public LongRangePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongRangePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public LongRangePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public LongRangePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -376,137 +457,81 @@ public LongRangePropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public LongRangePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public LongRangePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public LongRangePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public LongRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("long_range"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - LongRangeProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/MatchOnlyTextProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/MatchOnlyTextProperty.g.cs index 4f7566ec1b8..fc024575c4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/MatchOnlyTextProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/MatchOnlyTextProperty.g.cs @@ -17,16 +17,77 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class MatchOnlyTextPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propFields = default; + LocalJsonValue?> propMeta = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + Fields = propFields.Value, + Meta = propMeta.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A variant of text that trades scoring and efficiency of positional queries for space efficiency. This field @@ -36,16 +97,31 @@ namespace Elastic.Clients.Elasticsearch.Mapping; /// to verify whether a phrase matches. All queries return constant scores that are equal to 1.0. /// /// -public sealed partial class MatchOnlyTextProperty : IProperty +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyConverter))] +public sealed partial class MatchOnlyTextProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { +#if NET7_0_OR_GREATER + public MatchOnlyTextProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public MatchOnlyTextProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Allows you to copy the values of multiple fields into a group /// field, which can then be queried as a single field. /// /// - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } /// @@ -54,7 +130,6 @@ public sealed partial class MatchOnlyTextProperty : IProperty /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. /// /// - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } /// @@ -62,10 +137,8 @@ public sealed partial class MatchOnlyTextProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "match_only_text"; } @@ -78,17 +151,24 @@ public sealed partial class MatchOnlyTextProperty : IProperty /// to verify whether a phrase matches. All queries return constant scores that are equal to 1.0. /// /// -public sealed partial class MatchOnlyTextPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct MatchOnlyTextPropertyDescriptor { - internal MatchOnlyTextPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty Instance { get; init; } - public MatchOnlyTextPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchOnlyTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private IDictionary? MetaValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchOnlyTextPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,10 +176,22 @@ public MatchOnlyTextPropertyDescriptor() : base() /// field, which can then be queried as a single field. /// /// - public MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; + } + + /// + /// + /// Allows you to copy the values of multiple fields into a group + /// field, which can then be queried as a single field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; } /// @@ -108,24 +200,33 @@ public MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elastic /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. /// /// - public MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one + /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public MatchOnlyTextPropertyDescriptor Fields(Action> configure) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Meta = value; + return this; } /// @@ -133,44 +234,42 @@ public MatchOnlyTextPropertyDescriptor Fields(Action /// - public MatchOnlyTextPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta(System.Action? action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } - if (MetaValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("match_only_text"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - MatchOnlyTextProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - Fields = FieldsValue, - Meta = MetaValue - }; } /// @@ -182,17 +281,36 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// to verify whether a phrase matches. All queries return constant scores that are equal to 1.0. /// /// -public sealed partial class MatchOnlyTextPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct MatchOnlyTextPropertyDescriptor { - internal MatchOnlyTextPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty Instance { get; init; } - public MatchOnlyTextPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchOnlyTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private IDictionary? MetaValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchOnlyTextPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Allows you to copy the values of multiple fields into a group + /// field, which can then be queried as a single field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } /// /// @@ -200,10 +318,22 @@ public MatchOnlyTextPropertyDescriptor() : base() /// field, which can then be queried as a single field. /// /// - public MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; + } + + /// + /// + /// Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one + /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - CopyToValue = copyTo; - return Self; + Instance.Fields = value; + return this; } /// @@ -212,24 +342,33 @@ public MatchOnlyTextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fiel /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. /// /// - public MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Fields(System.Action action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public MatchOnlyTextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one + /// field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public MatchOnlyTextPropertyDescriptor Fields(Action> configure) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Meta = value; + return this; } /// @@ -237,42 +376,40 @@ public MatchOnlyTextPropertyDescriptor Fields(Action /// - public MatchOnlyTextPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor Meta(System.Action? action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } - if (MetaValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("match_only_text"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - MatchOnlyTextProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - Fields = FieldsValue, - Meta = MetaValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Murmur3HashProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Murmur3HashProperty.g.cs index f800395efef..b8c2e22dd8f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Murmur3HashProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Murmur3HashProperty.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class Murmur3HashProperty : IProperty +internal sealed partial class Murmur3HashPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyConverter))] +public sealed partial class Murmur3HashProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public Murmur3HashProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public Murmur3HashProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -46,79 +172,73 @@ public sealed partial class Murmur3HashProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "murmur3"; } -public sealed partial class Murmur3HashPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct Murmur3HashPropertyDescriptor { - internal Murmur3HashPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Murmur3HashPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty instance) + { + Instance = instance; + } - public Murmur3HashPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Murmur3HashPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor descriptor) => descriptor.Instance; - public Murmur3HashPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public Murmur3HashPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public Murmur3HashPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public Murmur3HashPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public Murmur3HashPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -126,180 +246,144 @@ public Murmur3HashPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public Murmur3HashPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public Murmur3HashPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public Murmur3HashPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public Murmur3HashPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + Instance.Store = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (PropertiesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } +public readonly partial struct Murmur3HashPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("murmur3"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Murmur3HashPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty instance) + { + Instance = instance; } - Murmur3HashProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Murmur3HashPropertyDescriptor() { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} + Instance = new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } -public sealed partial class Murmur3HashPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal Murmur3HashPropertyDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor descriptor) => descriptor.Instance; - public Murmur3HashPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public Murmur3HashPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public Murmur3HashPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public Murmur3HashPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public Murmur3HashPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public Murmur3HashPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public Murmur3HashPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -307,116 +391,81 @@ public Murmur3HashPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public Murmur3HashPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public Murmur3HashPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public Murmur3HashPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public Murmur3HashPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("murmur3"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - Murmur3HashProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/NestedProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/NestedProperty.g.cs index ddb85aa7699..5b518745f45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/NestedProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/NestedProperty.g.cs @@ -17,32 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class NestedProperty : IProperty +internal sealed partial class NestedPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeInParent = System.Text.Json.JsonEncodedText.Encode("include_in_parent"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeInRoot = System.Text.Json.JsonEncodedText.Encode("include_in_root"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.NestedProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIncludeInParent = default; + LocalJsonValue propIncludeInRoot = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIncludeInParent.TryReadProperty(ref reader, options, PropIncludeInParent, null)) + { + continue; + } + + if (propIncludeInRoot.TryReadProperty(ref reader, options, PropIncludeInRoot, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + Dynamic = propDynamic.Value, + Enabled = propEnabled.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IncludeInParent = propIncludeInParent.Value, + IncludeInRoot = propIncludeInRoot.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.NestedProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIncludeInParent, value.IncludeInParent, null, null); + writer.WriteProperty(options, PropIncludeInRoot, value.IncludeInRoot, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.NestedPropertyConverter))] +public sealed partial class NestedProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public NestedProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public NestedProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("include_in_parent")] public bool? IncludeInParent { get; set; } - [JsonInclude, JsonPropertyName("include_in_root")] public bool? IncludeInRoot { get; set; } /// @@ -50,93 +192,85 @@ public sealed partial class NestedProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "nested"; } -public sealed partial class NestedPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct NestedPropertyDescriptor { - internal NestedPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.NestedProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.NestedProperty instance) + { + Instance = instance; + } - public NestedPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IncludeInParentValue { get; set; } - private bool? IncludeInRootValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.NestedProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor descriptor) => descriptor.Instance; - public NestedPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public NestedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public NestedPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EnabledValue = enabled; - return Self; + Instance.Dynamic = value; + return this; } - public NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Enabled(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.Enabled = value; + return this; } - public NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public NestedPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public NestedPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public NestedPropertyDescriptor IncludeInParent(bool? includeInParent = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IncludeInParent(bool? value = true) { - IncludeInParentValue = includeInParent; - return Self; + Instance.IncludeInParent = value; + return this; } - public NestedPropertyDescriptor IncludeInRoot(bool? includeInRoot = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IncludeInRoot(bool? value = true) { - IncludeInRootValue = includeInRoot; - return Self; + Instance.IncludeInRoot = value; + return this; } /// @@ -144,208 +278,156 @@ public NestedPropertyDescriptor IncludeInRoot(bool? includeInRoot = t /// Metadata about the field. /// /// - public NestedPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public NestedPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public NestedPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public NestedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IncludeInParentValue.HasValue) - { - writer.WritePropertyName("include_in_parent"); - writer.WriteBooleanValue(IncludeInParentValue.Value); - } - - if (IncludeInRootValue.HasValue) - { - writer.WritePropertyName("include_in_root"); - writer.WriteBooleanValue(IncludeInRootValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.NestedProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("nested"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NestedProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Enabled = EnabledValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IncludeInParent = IncludeInParentValue, - IncludeInRoot = IncludeInRootValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class NestedPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct NestedPropertyDescriptor { - internal NestedPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.NestedProperty Instance { get; init; } - public NestedPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.NestedProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IncludeInParentValue { get; set; } - private bool? IncludeInRootValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public NestedPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.NestedProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public NestedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public NestedPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EnabledValue = enabled; - return Self; + Instance.Dynamic = value; + return this; } - public NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Enabled(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.Enabled = value; + return this; } - public NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public NestedPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Fields(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public NestedPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Fields(System.Action> action) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public NestedPropertyDescriptor IncludeInParent(bool? includeInParent = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IgnoreAbove(int? value) { - IncludeInParentValue = includeInParent; - return Self; + Instance.IgnoreAbove = value; + return this; } - public NestedPropertyDescriptor IncludeInRoot(bool? includeInRoot = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IncludeInParent(bool? value = true) { - IncludeInRootValue = includeInRoot; - return Self; + Instance.IncludeInParent = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor IncludeInRoot(bool? value = true) + { + Instance.IncludeInRoot = value; + return this; } /// @@ -353,130 +435,81 @@ public NestedPropertyDescriptor IncludeInRoot(bool? includeInRoot = true) /// Metadata about the field. /// /// - public NestedPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public NestedPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public NestedPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public NestedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IncludeInParentValue.HasValue) - { - writer.WritePropertyName("include_in_parent"); - writer.WriteBooleanValue(IncludeInParentValue.Value); - } - - if (IncludeInRootValue.HasValue) - { - writer.WritePropertyName("include_in_root"); - writer.WriteBooleanValue(IncludeInRootValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.NestedProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("nested"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.NestedProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - NestedProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Enabled = EnabledValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IncludeInParent = IncludeInParentValue, - IncludeInRoot = IncludeInRootValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ObjectProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ObjectProperty.g.cs index 32b66e7cd6f..46d6a62cb1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ObjectProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ObjectProperty.g.cs @@ -17,28 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class ObjectProperty : IProperty +internal sealed partial class ObjectPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSubobjects = System.Text.Json.JsonEncodedText.Encode("subobjects"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.ObjectProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSubobjects = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSubobjects.TryReadProperty(ref reader, options, PropSubobjects, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + Dynamic = propDynamic.Value, + Enabled = propEnabled.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + Subobjects = propSubobjects.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSubobjects, value.Subobjects, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyConverter))] +public sealed partial class ObjectProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public ObjectProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ObjectProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -46,82 +181,74 @@ public sealed partial class ObjectProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("subobjects")] - public bool? Subobjects { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] + public Elastic.Clients.Elasticsearch.Mapping.Subobjects? Subobjects { get; set; } public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] - public string Type => "object"; + public string? Type => "object"; } -public sealed partial class ObjectPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ObjectPropertyDescriptor { - internal ObjectPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ObjectProperty Instance { get; init; } - public ObjectPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private bool? SubobjectsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ObjectPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public ObjectPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EnabledValue = enabled; - return Self; + Instance.Dynamic = value; + return this; } - public ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Enabled(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.Enabled = value; + return this; } - public ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public ObjectPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ObjectPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -129,194 +256,150 @@ public ObjectPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public ObjectPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ObjectPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ObjectPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public ObjectPropertyDescriptor Subobjects(bool? subobjects = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Properties(System.Action> action) { - SubobjectsValue = subobjects; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Subobjects(Elastic.Clients.Elasticsearch.Mapping.Subobjects? value) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Subobjects = value; + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (StoreValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ObjectProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SubobjectsValue.HasValue) - { - writer.WritePropertyName("subobjects"); - writer.WriteBooleanValue(SubobjectsValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } +public readonly partial struct ObjectPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.ObjectProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("object"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty instance) + { + Instance = instance; } - ObjectProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ObjectPropertyDescriptor() { - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Enabled = EnabledValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - Subobjects = SubobjectsValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} + Instance = new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } -public sealed partial class ObjectPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal ObjectPropertyDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor descriptor) => descriptor.Instance; - public ObjectPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private bool? SubobjectsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public ObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public ObjectPropertyDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Enabled(bool? value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - public ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public ObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ObjectPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ObjectPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -324,129 +407,87 @@ public ObjectPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public ObjectPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ObjectPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ObjectPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public ObjectPropertyDescriptor Subobjects(bool? subobjects = true) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Properties(System.Action action) { - SubobjectsValue = subobjects; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor Subobjects(Elastic.Clients.Elasticsearch.Mapping.Subobjects? value) + { + Instance.Subobjects = value; + return this; + } - if (SubobjectsValue.HasValue) - { - writer.WritePropertyName("subobjects"); - writer.WriteBooleanValue(SubobjectsValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ObjectProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("object"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ObjectProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Enabled = EnabledValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - Subobjects = SubobjectsValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PassthroughObjectProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PassthroughObjectProperty.g.cs new file mode 100644 index 00000000000..25e884b6864 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PassthroughObjectProperty.g.cs @@ -0,0 +1,515 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Mapping; + +internal sealed partial class PassthroughObjectPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPriority = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + Dynamic = propDynamic.Value, + Enabled = propEnabled.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Priority = propPriority.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyConverter))] +public sealed partial class PassthroughObjectProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public PassthroughObjectProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public PassthroughObjectProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } + public bool? Enabled { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } + public int? IgnoreAbove { get; set; } + + /// + /// + /// Metadata about the field. + /// + /// + public System.Collections.Generic.IDictionary? Meta { get; set; } + public int? Priority { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } + public bool? Store { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } + public bool? TimeSeriesDimension { get; set; } + + public string? Type => "passthrough"; +} + +public readonly partial struct PassthroughObjectPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassthroughObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassthroughObjectPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) + { + Instance.Dynamic = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Enabled(bool? value = true) + { + Instance.Enabled = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Fields(System.Action> action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor IgnoreAbove(int? value) + { + Instance.IgnoreAbove = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Priority(int? value) + { + Instance.Priority = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Properties = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor TimeSeriesDimension(bool? value = true) + { + Instance.TimeSeriesDimension = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct PassthroughObjectPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassthroughObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PassthroughObjectPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) + { + Instance.CopyTo = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) + { + Instance.Dynamic = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Enabled(bool? value = true) + { + Instance.Enabled = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Fields(System.Action action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Fields(System.Action> action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor IgnoreAbove(int? value) + { + Instance.IgnoreAbove = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Priority(int? value) + { + Instance.Priority = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) + { + Instance.Properties = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Properties(System.Action action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor TimeSeriesDimension(bool? value = true) + { + Instance.TimeSeriesDimension = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PercolatorProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PercolatorProperty.g.cs index 2cae62921b4..5577e8d6690 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PercolatorProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PercolatorProperty.g.cs @@ -17,23 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class PercolatorProperty : IProperty +internal sealed partial class PercolatorPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyConverter))] +public sealed partial class PercolatorProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public PercolatorProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public PercolatorProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,62 +143,54 @@ public sealed partial class PercolatorProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "percolator"; } -public sealed partial class PercolatorPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct PercolatorPropertyDescriptor { - internal PercolatorPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty Instance { get; init; } - public PercolatorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolatorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public PercolatorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolatorPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public PercolatorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PercolatorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -104,138 +198,120 @@ public PercolatorPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public PercolatorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public PercolatorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PercolatorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("percolator"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PercolatorProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class PercolatorPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PercolatorPropertyDescriptor { - internal PercolatorPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty Instance { get; init; } - public PercolatorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolatorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolatorPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PercolatorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public PercolatorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PercolatorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PercolatorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -243,89 +319,75 @@ public PercolatorPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public PercolatorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public PercolatorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PercolatorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("percolator"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PercolatorProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PointProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PointProperty.g.cs index 42fd6aa0286..16344f2d164 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PointProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/PointProperty.g.cs @@ -17,32 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class PointProperty : IProperty +internal sealed partial class PointPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreZValue = System.Text.Json.JsonEncodedText.Encode("ignore_z_value"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.PointProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIgnoreZValue = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIgnoreZValue.TryReadProperty(ref reader, options, PropIgnoreZValue, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + IgnoreZValue = propIgnoreZValue.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.PointProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIgnoreZValue, value.IgnoreZValue, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.PointPropertyConverter))] +public sealed partial class PointProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public PointProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public PointProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("ignore_z_value")] public bool? IgnoreZValue { get; set; } /// @@ -50,96 +201,86 @@ public sealed partial class PointProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "point"; } -public sealed partial class PointPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct PointPropertyDescriptor { - internal PointPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.PointProperty Instance { get; init; } - public PointPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PointProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PointProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public PointPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public PointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public PointPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PointPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public PointPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public PointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } /// @@ -147,222 +288,162 @@ public PointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true /// Metadata about the field. /// /// - public PointPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public PointPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PointPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public PointPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public PointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PointProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("point"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PointProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class PointPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct PointPropertyDescriptor { - internal PointPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.PointProperty Instance { get; init; } - public PointPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PointProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PointPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.PointProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public PointPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public PointPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public PointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public PointPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PointPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public PointPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public PointPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public PointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } /// @@ -370,143 +451,87 @@ public PointPropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) /// Metadata about the field. /// /// - public PointPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public PointPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public PointPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public PointPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public PointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.PointProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("point"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.PointProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - PointProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs index 9cf52241069..a3132684259 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Properties.g.cs @@ -17,586 +17,4342 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public partial class Properties : IsADictionary +public partial class Properties : Elastic.Clients.Elasticsearch.IsADictionary { public Properties() { } - public Properties(IDictionary container) : base(container) + public Properties(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public void Add(Elastic.Clients.Elasticsearch.PropertyName name, IProperty property) => BackingDictionary.Add(Sanitize(name), property); - public bool TryGetProperty(Elastic.Clients.Elasticsearch.PropertyName name, [NotNullWhen(returnValue: true)] out IProperty property) => BackingDictionary.TryGetValue(Sanitize(name), out property); + public void Add(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IProperty value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetProperty(Elastic.Clients.Elasticsearch.PropertyName key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Mapping.IProperty value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public bool TryGetProperty(Elastic.Clients.Elasticsearch.PropertyName name, [NotNullWhen(returnValue: true)] out T? property) where T : class, IProperty + public bool TryGetProperty(Elastic.Clients.Elasticsearch.PropertyName key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, IProperty { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - property = finalValue; + value = finalValue; return true; } - property = null; + value = null; return false; } } -public sealed partial class PropertiesDescriptor : IsADictionaryDescriptor, Properties, Elastic.Clients.Elasticsearch.PropertyName, IProperty> +public readonly partial struct PropertiesDescriptor { - public PropertiesDescriptor() : base(new Properties()) - { - } - - public PropertiesDescriptor(Properties properties) : base(properties ?? new Properties()) - { - } - - public PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, AggregateMetricDoubleProperty>(propertyName, null); - public PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, AggregateMetricDoubleProperty>(propertyName, configure); - public PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName propertyName, AggregateMetricDoubleProperty aggregateMetricDoubleProperty) => AssignVariant(propertyName, aggregateMetricDoubleProperty); - public PropertiesDescriptor AggregateMetricDouble(Expression> propertyName) => AssignVariant, AggregateMetricDoubleProperty>(propertyName, null); - public PropertiesDescriptor AggregateMetricDouble(Expression> propertyName, Action> configure) => AssignVariant, AggregateMetricDoubleProperty>(propertyName, configure); - public PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, BinaryProperty>(propertyName, null); - public PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, BinaryProperty>(propertyName, configure); - public PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName propertyName, BinaryProperty binaryProperty) => AssignVariant(propertyName, binaryProperty); - public PropertiesDescriptor Binary(Expression> propertyName) => AssignVariant, BinaryProperty>(propertyName, null); - public PropertiesDescriptor Binary(Expression> propertyName, Action> configure) => AssignVariant, BinaryProperty>(propertyName, configure); - public PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, BooleanProperty>(propertyName, null); - public PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, BooleanProperty>(propertyName, configure); - public PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName propertyName, BooleanProperty booleanProperty) => AssignVariant(propertyName, booleanProperty); - public PropertiesDescriptor Boolean(Expression> propertyName) => AssignVariant, BooleanProperty>(propertyName, null); - public PropertiesDescriptor Boolean(Expression> propertyName, Action> configure) => AssignVariant, BooleanProperty>(propertyName, configure); - public PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ByteNumberProperty>(propertyName, null); - public PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ByteNumberProperty>(propertyName, configure); - public PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, ByteNumberProperty byteNumberProperty) => AssignVariant(propertyName, byteNumberProperty); - public PropertiesDescriptor ByteNumber(Expression> propertyName) => AssignVariant, ByteNumberProperty>(propertyName, null); - public PropertiesDescriptor ByteNumber(Expression> propertyName, Action> configure) => AssignVariant, ByteNumberProperty>(propertyName, configure); - public PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, CompletionProperty>(propertyName, null); - public PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, CompletionProperty>(propertyName, configure); - public PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName propertyName, CompletionProperty completionProperty) => AssignVariant(propertyName, completionProperty); - public PropertiesDescriptor Completion(Expression> propertyName) => AssignVariant, CompletionProperty>(propertyName, null); - public PropertiesDescriptor Completion(Expression> propertyName, Action> configure) => AssignVariant, CompletionProperty>(propertyName, configure); - public PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ConstantKeywordProperty>(propertyName, null); - public PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ConstantKeywordProperty>(propertyName, configure); - public PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName propertyName, ConstantKeywordProperty constantKeywordProperty) => AssignVariant(propertyName, constantKeywordProperty); - public PropertiesDescriptor ConstantKeyword(Expression> propertyName) => AssignVariant, ConstantKeywordProperty>(propertyName, null); - public PropertiesDescriptor ConstantKeyword(Expression> propertyName, Action> configure) => AssignVariant, ConstantKeywordProperty>(propertyName, configure); - public PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DateNanosProperty>(propertyName, null); - public PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DateNanosProperty>(propertyName, configure); - public PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName propertyName, DateNanosProperty dateNanosProperty) => AssignVariant(propertyName, dateNanosProperty); - public PropertiesDescriptor DateNanos(Expression> propertyName) => AssignVariant, DateNanosProperty>(propertyName, null); - public PropertiesDescriptor DateNanos(Expression> propertyName, Action> configure) => AssignVariant, DateNanosProperty>(propertyName, configure); - public PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DateProperty>(propertyName, null); - public PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DateProperty>(propertyName, configure); - public PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName propertyName, DateProperty dateProperty) => AssignVariant(propertyName, dateProperty); - public PropertiesDescriptor Date(Expression> propertyName) => AssignVariant, DateProperty>(propertyName, null); - public PropertiesDescriptor Date(Expression> propertyName, Action> configure) => AssignVariant, DateProperty>(propertyName, configure); - public PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DateRangeProperty>(propertyName, null); - public PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DateRangeProperty>(propertyName, configure); - public PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, DateRangeProperty dateRangeProperty) => AssignVariant(propertyName, dateRangeProperty); - public PropertiesDescriptor DateRange(Expression> propertyName) => AssignVariant, DateRangeProperty>(propertyName, null); - public PropertiesDescriptor DateRange(Expression> propertyName, Action> configure) => AssignVariant, DateRangeProperty>(propertyName, configure); - public PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DenseVectorProperty>(propertyName, null); - public PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DenseVectorProperty>(propertyName, configure); - public PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName, DenseVectorProperty denseVectorProperty) => AssignVariant(propertyName, denseVectorProperty); - public PropertiesDescriptor DenseVector(Expression> propertyName) => AssignVariant, DenseVectorProperty>(propertyName, null); - public PropertiesDescriptor DenseVector(Expression> propertyName, Action> configure) => AssignVariant, DenseVectorProperty>(propertyName, configure); - public PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DoubleNumberProperty>(propertyName, null); - public PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DoubleNumberProperty>(propertyName, configure); - public PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, DoubleNumberProperty doubleNumberProperty) => AssignVariant(propertyName, doubleNumberProperty); - public PropertiesDescriptor DoubleNumber(Expression> propertyName) => AssignVariant, DoubleNumberProperty>(propertyName, null); - public PropertiesDescriptor DoubleNumber(Expression> propertyName, Action> configure) => AssignVariant, DoubleNumberProperty>(propertyName, configure); - public PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DoubleRangeProperty>(propertyName, null); - public PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DoubleRangeProperty>(propertyName, configure); - public PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, DoubleRangeProperty doubleRangeProperty) => AssignVariant(propertyName, doubleRangeProperty); - public PropertiesDescriptor DoubleRange(Expression> propertyName) => AssignVariant, DoubleRangeProperty>(propertyName, null); - public PropertiesDescriptor DoubleRange(Expression> propertyName, Action> configure) => AssignVariant, DoubleRangeProperty>(propertyName, configure); - public PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, DynamicProperty>(propertyName, null); - public PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, DynamicProperty>(propertyName, configure); - public PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName propertyName, DynamicProperty dynamicProperty) => AssignVariant(propertyName, dynamicProperty); - public PropertiesDescriptor Dynamic(Expression> propertyName) => AssignVariant, DynamicProperty>(propertyName, null); - public PropertiesDescriptor Dynamic(Expression> propertyName, Action> configure) => AssignVariant, DynamicProperty>(propertyName, configure); - public PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, FieldAliasProperty>(propertyName, null); - public PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, FieldAliasProperty>(propertyName, configure); - public PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName propertyName, FieldAliasProperty fieldAliasProperty) => AssignVariant(propertyName, fieldAliasProperty); - public PropertiesDescriptor FieldAlias(Expression> propertyName) => AssignVariant, FieldAliasProperty>(propertyName, null); - public PropertiesDescriptor FieldAlias(Expression> propertyName, Action> configure) => AssignVariant, FieldAliasProperty>(propertyName, configure); - public PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, FlattenedProperty>(propertyName, null); - public PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, FlattenedProperty>(propertyName, configure); - public PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName propertyName, FlattenedProperty flattenedProperty) => AssignVariant(propertyName, flattenedProperty); - public PropertiesDescriptor Flattened(Expression> propertyName) => AssignVariant, FlattenedProperty>(propertyName, null); - public PropertiesDescriptor Flattened(Expression> propertyName, Action> configure) => AssignVariant, FlattenedProperty>(propertyName, configure); - public PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, FloatNumberProperty>(propertyName, null); - public PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, FloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, FloatNumberProperty floatNumberProperty) => AssignVariant(propertyName, floatNumberProperty); - public PropertiesDescriptor FloatNumber(Expression> propertyName) => AssignVariant, FloatNumberProperty>(propertyName, null); - public PropertiesDescriptor FloatNumber(Expression> propertyName, Action> configure) => AssignVariant, FloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, FloatRangeProperty>(propertyName, null); - public PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, FloatRangeProperty>(propertyName, configure); - public PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, FloatRangeProperty floatRangeProperty) => AssignVariant(propertyName, floatRangeProperty); - public PropertiesDescriptor FloatRange(Expression> propertyName) => AssignVariant, FloatRangeProperty>(propertyName, null); - public PropertiesDescriptor FloatRange(Expression> propertyName, Action> configure) => AssignVariant, FloatRangeProperty>(propertyName, configure); - public PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, GeoPointProperty>(propertyName, null); - public PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, GeoPointProperty>(propertyName, configure); - public PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName propertyName, GeoPointProperty geoPointProperty) => AssignVariant(propertyName, geoPointProperty); - public PropertiesDescriptor GeoPoint(Expression> propertyName) => AssignVariant, GeoPointProperty>(propertyName, null); - public PropertiesDescriptor GeoPoint(Expression> propertyName, Action> configure) => AssignVariant, GeoPointProperty>(propertyName, configure); - public PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, GeoShapeProperty>(propertyName, null); - public PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, GeoShapeProperty>(propertyName, configure); - public PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName propertyName, GeoShapeProperty geoShapeProperty) => AssignVariant(propertyName, geoShapeProperty); - public PropertiesDescriptor GeoShape(Expression> propertyName) => AssignVariant, GeoShapeProperty>(propertyName, null); - public PropertiesDescriptor GeoShape(Expression> propertyName, Action> configure) => AssignVariant, GeoShapeProperty>(propertyName, configure); - public PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, HalfFloatNumberProperty>(propertyName, null); - public PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, HalfFloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, HalfFloatNumberProperty halfFloatNumberProperty) => AssignVariant(propertyName, halfFloatNumberProperty); - public PropertiesDescriptor HalfFloatNumber(Expression> propertyName) => AssignVariant, HalfFloatNumberProperty>(propertyName, null); - public PropertiesDescriptor HalfFloatNumber(Expression> propertyName, Action> configure) => AssignVariant, HalfFloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, HistogramProperty>(propertyName, null); - public PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, HistogramProperty>(propertyName, configure); - public PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName propertyName, HistogramProperty histogramProperty) => AssignVariant(propertyName, histogramProperty); - public PropertiesDescriptor Histogram(Expression> propertyName) => AssignVariant, HistogramProperty>(propertyName, null); - public PropertiesDescriptor Histogram(Expression> propertyName, Action> configure) => AssignVariant, HistogramProperty>(propertyName, configure); - public PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, IcuCollationProperty>(propertyName, null); - public PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, IcuCollationProperty>(propertyName, configure); - public PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName propertyName, IcuCollationProperty icuCollationProperty) => AssignVariant(propertyName, icuCollationProperty); - public PropertiesDescriptor IcuCollation(Expression> propertyName) => AssignVariant, IcuCollationProperty>(propertyName, null); - public PropertiesDescriptor IcuCollation(Expression> propertyName, Action> configure) => AssignVariant, IcuCollationProperty>(propertyName, configure); - public PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, IntegerNumberProperty>(propertyName, null); - public PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, IntegerNumberProperty>(propertyName, configure); - public PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, IntegerNumberProperty integerNumberProperty) => AssignVariant(propertyName, integerNumberProperty); - public PropertiesDescriptor IntegerNumber(Expression> propertyName) => AssignVariant, IntegerNumberProperty>(propertyName, null); - public PropertiesDescriptor IntegerNumber(Expression> propertyName, Action> configure) => AssignVariant, IntegerNumberProperty>(propertyName, configure); - public PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, IntegerRangeProperty>(propertyName, null); - public PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, IntegerRangeProperty>(propertyName, configure); - public PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, IntegerRangeProperty integerRangeProperty) => AssignVariant(propertyName, integerRangeProperty); - public PropertiesDescriptor IntegerRange(Expression> propertyName) => AssignVariant, IntegerRangeProperty>(propertyName, null); - public PropertiesDescriptor IntegerRange(Expression> propertyName, Action> configure) => AssignVariant, IntegerRangeProperty>(propertyName, configure); - public PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, IpProperty>(propertyName, null); - public PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, IpProperty>(propertyName, configure); - public PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName propertyName, IpProperty ipProperty) => AssignVariant(propertyName, ipProperty); - public PropertiesDescriptor Ip(Expression> propertyName) => AssignVariant, IpProperty>(propertyName, null); - public PropertiesDescriptor Ip(Expression> propertyName, Action> configure) => AssignVariant, IpProperty>(propertyName, configure); - public PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, IpRangeProperty>(propertyName, null); - public PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, IpRangeProperty>(propertyName, configure); - public PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, IpRangeProperty ipRangeProperty) => AssignVariant(propertyName, ipRangeProperty); - public PropertiesDescriptor IpRange(Expression> propertyName) => AssignVariant, IpRangeProperty>(propertyName, null); - public PropertiesDescriptor IpRange(Expression> propertyName, Action> configure) => AssignVariant, IpRangeProperty>(propertyName, configure); - public PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, JoinProperty>(propertyName, null); - public PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, JoinProperty>(propertyName, configure); - public PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName propertyName, JoinProperty joinProperty) => AssignVariant(propertyName, joinProperty); - public PropertiesDescriptor Join(Expression> propertyName) => AssignVariant, JoinProperty>(propertyName, null); - public PropertiesDescriptor Join(Expression> propertyName, Action> configure) => AssignVariant, JoinProperty>(propertyName, configure); - public PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, KeywordProperty>(propertyName, null); - public PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, KeywordProperty>(propertyName, configure); - public PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName propertyName, KeywordProperty keywordProperty) => AssignVariant(propertyName, keywordProperty); - public PropertiesDescriptor Keyword(Expression> propertyName) => AssignVariant, KeywordProperty>(propertyName, null); - public PropertiesDescriptor Keyword(Expression> propertyName, Action> configure) => AssignVariant, KeywordProperty>(propertyName, configure); - public PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, LongNumberProperty>(propertyName, null); - public PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, LongNumberProperty>(propertyName, configure); - public PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, LongNumberProperty longNumberProperty) => AssignVariant(propertyName, longNumberProperty); - public PropertiesDescriptor LongNumber(Expression> propertyName) => AssignVariant, LongNumberProperty>(propertyName, null); - public PropertiesDescriptor LongNumber(Expression> propertyName, Action> configure) => AssignVariant, LongNumberProperty>(propertyName, configure); - public PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, LongRangeProperty>(propertyName, null); - public PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, LongRangeProperty>(propertyName, configure); - public PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName propertyName, LongRangeProperty longRangeProperty) => AssignVariant(propertyName, longRangeProperty); - public PropertiesDescriptor LongRange(Expression> propertyName) => AssignVariant, LongRangeProperty>(propertyName, null); - public PropertiesDescriptor LongRange(Expression> propertyName, Action> configure) => AssignVariant, LongRangeProperty>(propertyName, configure); - public PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, MatchOnlyTextProperty>(propertyName, null); - public PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, MatchOnlyTextProperty>(propertyName, configure); - public PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName propertyName, MatchOnlyTextProperty matchOnlyTextProperty) => AssignVariant(propertyName, matchOnlyTextProperty); - public PropertiesDescriptor MatchOnlyText(Expression> propertyName) => AssignVariant, MatchOnlyTextProperty>(propertyName, null); - public PropertiesDescriptor MatchOnlyText(Expression> propertyName, Action> configure) => AssignVariant, MatchOnlyTextProperty>(propertyName, configure); - public PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, Murmur3HashProperty>(propertyName, null); - public PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, Murmur3HashProperty>(propertyName, configure); - public PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName propertyName, Murmur3HashProperty murmur3HashProperty) => AssignVariant(propertyName, murmur3HashProperty); - public PropertiesDescriptor Murmur3Hash(Expression> propertyName) => AssignVariant, Murmur3HashProperty>(propertyName, null); - public PropertiesDescriptor Murmur3Hash(Expression> propertyName, Action> configure) => AssignVariant, Murmur3HashProperty>(propertyName, configure); - public PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, NestedProperty>(propertyName, null); - public PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, NestedProperty>(propertyName, configure); - public PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName propertyName, NestedProperty nestedProperty) => AssignVariant(propertyName, nestedProperty); - public PropertiesDescriptor Nested(Expression> propertyName) => AssignVariant, NestedProperty>(propertyName, null); - public PropertiesDescriptor Nested(Expression> propertyName, Action> configure) => AssignVariant, NestedProperty>(propertyName, configure); - public PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ObjectProperty>(propertyName, null); - public PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ObjectProperty>(propertyName, configure); - public PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName propertyName, ObjectProperty objectProperty) => AssignVariant(propertyName, objectProperty); - public PropertiesDescriptor Object(Expression> propertyName) => AssignVariant, ObjectProperty>(propertyName, null); - public PropertiesDescriptor Object(Expression> propertyName, Action> configure) => AssignVariant, ObjectProperty>(propertyName, configure); - public PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, PercolatorProperty>(propertyName, null); - public PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, PercolatorProperty>(propertyName, configure); - public PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName propertyName, PercolatorProperty percolatorProperty) => AssignVariant(propertyName, percolatorProperty); - public PropertiesDescriptor Percolator(Expression> propertyName) => AssignVariant, PercolatorProperty>(propertyName, null); - public PropertiesDescriptor Percolator(Expression> propertyName, Action> configure) => AssignVariant, PercolatorProperty>(propertyName, configure); - public PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, PointProperty>(propertyName, null); - public PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, PointProperty>(propertyName, configure); - public PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName propertyName, PointProperty pointProperty) => AssignVariant(propertyName, pointProperty); - public PropertiesDescriptor Point(Expression> propertyName) => AssignVariant, PointProperty>(propertyName, null); - public PropertiesDescriptor Point(Expression> propertyName, Action> configure) => AssignVariant, PointProperty>(propertyName, configure); - public PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, RankFeatureProperty>(propertyName, null); - public PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, RankFeatureProperty>(propertyName, configure); - public PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName propertyName, RankFeatureProperty rankFeatureProperty) => AssignVariant(propertyName, rankFeatureProperty); - public PropertiesDescriptor RankFeature(Expression> propertyName) => AssignVariant, RankFeatureProperty>(propertyName, null); - public PropertiesDescriptor RankFeature(Expression> propertyName, Action> configure) => AssignVariant, RankFeatureProperty>(propertyName, configure); - public PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, RankFeaturesProperty>(propertyName, null); - public PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, RankFeaturesProperty>(propertyName, configure); - public PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName propertyName, RankFeaturesProperty rankFeaturesProperty) => AssignVariant(propertyName, rankFeaturesProperty); - public PropertiesDescriptor RankFeatures(Expression> propertyName) => AssignVariant, RankFeaturesProperty>(propertyName, null); - public PropertiesDescriptor RankFeatures(Expression> propertyName, Action> configure) => AssignVariant, RankFeaturesProperty>(propertyName, configure); - public PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ScaledFloatNumberProperty>(propertyName, null); - public PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ScaledFloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, ScaledFloatNumberProperty scaledFloatNumberProperty) => AssignVariant(propertyName, scaledFloatNumberProperty); - public PropertiesDescriptor ScaledFloatNumber(Expression> propertyName) => AssignVariant, ScaledFloatNumberProperty>(propertyName, null); - public PropertiesDescriptor ScaledFloatNumber(Expression> propertyName, Action> configure) => AssignVariant, ScaledFloatNumberProperty>(propertyName, configure); - public PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, SearchAsYouTypeProperty>(propertyName, null); - public PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, SearchAsYouTypeProperty>(propertyName, configure); - public PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName propertyName, SearchAsYouTypeProperty searchAsYouTypeProperty) => AssignVariant(propertyName, searchAsYouTypeProperty); - public PropertiesDescriptor SearchAsYouType(Expression> propertyName) => AssignVariant, SearchAsYouTypeProperty>(propertyName, null); - public PropertiesDescriptor SearchAsYouType(Expression> propertyName, Action> configure) => AssignVariant, SearchAsYouTypeProperty>(propertyName, configure); - public PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant(propertyName, null); - public PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action configure) => AssignVariant(propertyName, configure); - public PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName propertyName, SemanticTextProperty semanticTextProperty) => AssignVariant(propertyName, semanticTextProperty); - public PropertiesDescriptor SemanticText(Expression> propertyName) => AssignVariant(propertyName, null); - public PropertiesDescriptor SemanticText(Expression> propertyName, Action configure) => AssignVariant(propertyName, configure); - public PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ShapeProperty>(propertyName, null); - public PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ShapeProperty>(propertyName, configure); - public PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName propertyName, ShapeProperty shapeProperty) => AssignVariant(propertyName, shapeProperty); - public PropertiesDescriptor Shape(Expression> propertyName) => AssignVariant, ShapeProperty>(propertyName, null); - public PropertiesDescriptor Shape(Expression> propertyName, Action> configure) => AssignVariant, ShapeProperty>(propertyName, configure); - public PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, ShortNumberProperty>(propertyName, null); - public PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, ShortNumberProperty>(propertyName, configure); - public PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, ShortNumberProperty shortNumberProperty) => AssignVariant(propertyName, shortNumberProperty); - public PropertiesDescriptor ShortNumber(Expression> propertyName) => AssignVariant, ShortNumberProperty>(propertyName, null); - public PropertiesDescriptor ShortNumber(Expression> propertyName, Action> configure) => AssignVariant, ShortNumberProperty>(propertyName, configure); - public PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, SparseVectorProperty>(propertyName, null); - public PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, SparseVectorProperty>(propertyName, configure); - public PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName propertyName, SparseVectorProperty sparseVectorProperty) => AssignVariant(propertyName, sparseVectorProperty); - public PropertiesDescriptor SparseVector(Expression> propertyName) => AssignVariant, SparseVectorProperty>(propertyName, null); - public PropertiesDescriptor SparseVector(Expression> propertyName, Action> configure) => AssignVariant, SparseVectorProperty>(propertyName, configure); - public PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, TextProperty>(propertyName, null); - public PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, TextProperty>(propertyName, configure); - public PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName propertyName, TextProperty textProperty) => AssignVariant(propertyName, textProperty); - public PropertiesDescriptor Text(Expression> propertyName) => AssignVariant, TextProperty>(propertyName, null); - public PropertiesDescriptor Text(Expression> propertyName, Action> configure) => AssignVariant, TextProperty>(propertyName, configure); - public PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, TokenCountProperty>(propertyName, null); - public PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, TokenCountProperty>(propertyName, configure); - public PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName propertyName, TokenCountProperty tokenCountProperty) => AssignVariant(propertyName, tokenCountProperty); - public PropertiesDescriptor TokenCount(Expression> propertyName) => AssignVariant, TokenCountProperty>(propertyName, null); - public PropertiesDescriptor TokenCount(Expression> propertyName, Action> configure) => AssignVariant, TokenCountProperty>(propertyName, configure); - public PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, UnsignedLongNumberProperty>(propertyName, null); - public PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, UnsignedLongNumberProperty>(propertyName, configure); - public PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName propertyName, UnsignedLongNumberProperty unsignedLongNumberProperty) => AssignVariant(propertyName, unsignedLongNumberProperty); - public PropertiesDescriptor UnsignedLongNumber(Expression> propertyName) => AssignVariant, UnsignedLongNumberProperty>(propertyName, null); - public PropertiesDescriptor UnsignedLongNumber(Expression> propertyName, Action> configure) => AssignVariant, UnsignedLongNumberProperty>(propertyName, configure); - public PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, VersionProperty>(propertyName, null); - public PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, VersionProperty>(propertyName, configure); - public PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName propertyName, VersionProperty versionProperty) => AssignVariant(propertyName, versionProperty); - public PropertiesDescriptor Version(Expression> propertyName) => AssignVariant, VersionProperty>(propertyName, null); - public PropertiesDescriptor Version(Expression> propertyName, Action> configure) => AssignVariant, VersionProperty>(propertyName, configure); - public PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName propertyName) => AssignVariant, WildcardProperty>(propertyName, null); - public PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName propertyName, Action> configure) => AssignVariant, WildcardProperty>(propertyName, configure); - public PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName propertyName, WildcardProperty wildcardProperty) => AssignVariant(propertyName, wildcardProperty); - public PropertiesDescriptor Wildcard(Expression> propertyName) => AssignVariant, WildcardProperty>(propertyName, null); - public PropertiesDescriptor Wildcard(Expression> propertyName, Action> configure) => AssignVariant, WildcardProperty>(propertyName, configure); -} + private readonly Elastic.Clients.Elasticsearch.Mapping.Properties _items = new(); -internal sealed partial class PropertyInterfaceConverter : JsonConverter -{ - public override IProperty Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private Elastic.Clients.Elasticsearch.Mapping.Properties Value => _items; + + public PropertiesDescriptor() { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } + } - switch (type) - { - case "aggregate_metric_double": - return JsonSerializer.Deserialize(ref reader, options); - case "binary": - return JsonSerializer.Deserialize(ref reader, options); - case "boolean": - return JsonSerializer.Deserialize(ref reader, options); - case "byte": - return JsonSerializer.Deserialize(ref reader, options); - case "completion": - return JsonSerializer.Deserialize(ref reader, options); - case "constant_keyword": - return JsonSerializer.Deserialize(ref reader, options); - case "date_nanos": - return JsonSerializer.Deserialize(ref reader, options); - case "date": - return JsonSerializer.Deserialize(ref reader, options); - case "date_range": - return JsonSerializer.Deserialize(ref reader, options); - case "dense_vector": - return JsonSerializer.Deserialize(ref reader, options); - case "double": - return JsonSerializer.Deserialize(ref reader, options); - case "double_range": - return JsonSerializer.Deserialize(ref reader, options); - case "{dynamic_type}": - return JsonSerializer.Deserialize(ref reader, options); - case "alias": - return JsonSerializer.Deserialize(ref reader, options); - case "flattened": - return JsonSerializer.Deserialize(ref reader, options); - case "float": - return JsonSerializer.Deserialize(ref reader, options); - case "float_range": - return JsonSerializer.Deserialize(ref reader, options); - case "geo_point": - return JsonSerializer.Deserialize(ref reader, options); - case "geo_shape": - return JsonSerializer.Deserialize(ref reader, options); - case "half_float": - return JsonSerializer.Deserialize(ref reader, options); - case "histogram": - return JsonSerializer.Deserialize(ref reader, options); - case "icu_collation_keyword": - return JsonSerializer.Deserialize(ref reader, options); - case "integer": - return JsonSerializer.Deserialize(ref reader, options); - case "integer_range": - return JsonSerializer.Deserialize(ref reader, options); - case "ip": - return JsonSerializer.Deserialize(ref reader, options); - case "ip_range": - return JsonSerializer.Deserialize(ref reader, options); - case "join": - return JsonSerializer.Deserialize(ref reader, options); - case "keyword": - return JsonSerializer.Deserialize(ref reader, options); - case "long": - return JsonSerializer.Deserialize(ref reader, options); - case "long_range": - return JsonSerializer.Deserialize(ref reader, options); - case "match_only_text": - return JsonSerializer.Deserialize(ref reader, options); - case "murmur3": - return JsonSerializer.Deserialize(ref reader, options); - case "nested": - return JsonSerializer.Deserialize(ref reader, options); - case "object": - return JsonSerializer.Deserialize(ref reader, options); - case "percolator": - return JsonSerializer.Deserialize(ref reader, options); - case "point": - return JsonSerializer.Deserialize(ref reader, options); - case "rank_feature": - return JsonSerializer.Deserialize(ref reader, options); - case "rank_features": - return JsonSerializer.Deserialize(ref reader, options); - case "scaled_float": - return JsonSerializer.Deserialize(ref reader, options); - case "search_as_you_type": - return JsonSerializer.Deserialize(ref reader, options); - case "semantic_text": - return JsonSerializer.Deserialize(ref reader, options); - case "shape": - return JsonSerializer.Deserialize(ref reader, options); - case "short": - return JsonSerializer.Deserialize(ref reader, options); - case "sparse_vector": - return JsonSerializer.Deserialize(ref reader, options); - case "text": - return JsonSerializer.Deserialize(ref reader, options); - case "token_count": - return JsonSerializer.Deserialize(ref reader, options); - case "unsigned_long": - return JsonSerializer.Deserialize(ref reader, options); - case "version": - return JsonSerializer.Deserialize(ref reader, options); - case "wildcard": - return JsonSerializer.Deserialize(ref reader, options); - default: - return JsonSerializer.Deserialize(ref reader, options); - } + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) + { + _items.Add(key, value); + return this; } - public override void Write(Utf8JsonWriter writer, IProperty value, JsonSerializerOptions options) + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + _items.Add(key, value); + return this; + } - switch (value.Type) - { - case "aggregate_metric_double": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty), options); - return; - case "binary": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty), options); - return; - case "boolean": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty), options); - return; - case "byte": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty), options); - return; - case "completion": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty), options); - return; - case "constant_keyword": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty), options); - return; - case "date_nanos": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty), options); - return; - case "date": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DateProperty), options); - return; - case "date_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty), options); - return; - case "dense_vector": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty), options); - return; - case "double": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty), options); - return; - case "double_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty), options); - return; - case "{dynamic_type}": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty), options); - return; - case "alias": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty), options); - return; - case "flattened": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty), options); - return; - case "float": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty), options); - return; - case "float_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty), options); - return; - case "geo_point": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty), options); - return; - case "geo_shape": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty), options); - return; - case "half_float": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty), options); - return; - case "histogram": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty), options); - return; - case "icu_collation_keyword": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty), options); - return; - case "integer": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty), options); - return; - case "integer_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty), options); - return; - case "ip": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.IpProperty), options); - return; - case "ip_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty), options); - return; - case "join": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.JoinProperty), options); - return; - case "keyword": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty), options); - return; - case "long": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty), options); - return; - case "long_range": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty), options); - return; - case "match_only_text": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty), options); - return; - case "murmur3": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty), options); - return; - case "nested": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.NestedProperty), options); - return; - case "object": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty), options); - return; - case "percolator": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty), options); - return; - case "point": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.PointProperty), options); - return; - case "rank_feature": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty), options); - return; - case "rank_features": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty), options); - return; - case "scaled_float": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty), options); - return; - case "search_as_you_type": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty), options); - return; - case "semantic_text": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty), options); - return; - case "shape": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty), options); - return; - case "short": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty), options); - return; - case "sparse_vector": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty), options); - return; - case "text": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.TextProperty), options); - return; - case "token_count": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty), options); - return; - case "unsigned_long": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty), options); - return; - case "version": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.VersionProperty), options); - return; - case "wildcard": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; - } + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null)); + return this; } -} -[JsonConverter(typeof(PropertyInterfaceConverter))] -public partial interface IProperty -{ - public string? Type { get; } + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(System.Linq.Expressions.Expression> key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.Properties Build(System.Action>? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.Properties(); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); + action.Invoke(builder); + return builder.Value; + } +} + +public readonly partial struct PropertiesDescriptor +{ + private readonly Elastic.Clients.Elasticsearch.Mapping.Properties _items = new(); + + private Elastic.Clients.Elasticsearch.Mapping.Properties Value => _items; + + public PropertiesDescriptor() + { + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Dynamic(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(System.Linq.Expressions.Expression> key, System.Action action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(Elastic.Clients.Elasticsearch.PropertyName key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor AggregateMetricDouble(System.Linq.Expressions.Expression> key, System.Action> action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FieldAlias(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Binary(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Boolean(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ByteNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Completion(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ConstantKeyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor CountedKeyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Date(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateNanos(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DateRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DenseVector(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor DoubleRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Flattened(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor FloatRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoPoint(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor GeoShape(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor HalfFloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Histogram(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IcuCollation(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IntegerRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Ip(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor IpRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Join(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Keyword(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor LongRange(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor MatchOnlyText(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Murmur3Hash(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Nested(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Object(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor PassthroughObject(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Percolator(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Point(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeature(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor RankFeatures(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ScaledFloatNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SearchAsYouType(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SemanticText(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Shape(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor ShortNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor SparseVector(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Text(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor TokenCount(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor UnsignedLongNumber(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Version(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key, Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + _items.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key, System.Action? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(Elastic.Clients.Elasticsearch.PropertyName key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor Wildcard(System.Linq.Expressions.Expression> key, System.Action>? action) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.Properties Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.Properties(); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); + action.Invoke(builder); + return builder.Value; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Property.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Property.g.cs new file mode 100644 index 00000000000..e94b1191e4d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/Property.g.cs @@ -0,0 +1,2065 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Mapping; + +internal sealed partial class IPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.IProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = "object"; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "{dynamic_type}" => reader.ReadValue(options, null), + "aggregate_metric_double" => reader.ReadValue(options, null), + "alias" => reader.ReadValue(options, null), + "binary" => reader.ReadValue(options, null), + "boolean" => reader.ReadValue(options, null), + "byte" => reader.ReadValue(options, null), + "completion" => reader.ReadValue(options, null), + "constant_keyword" => reader.ReadValue(options, null), + "counted_keyword" => reader.ReadValue(options, null), + "date" => reader.ReadValue(options, null), + "date_nanos" => reader.ReadValue(options, null), + "date_range" => reader.ReadValue(options, null), + "dense_vector" => reader.ReadValue(options, null), + "double" => reader.ReadValue(options, null), + "double_range" => reader.ReadValue(options, null), + "flattened" => reader.ReadValue(options, null), + "float" => reader.ReadValue(options, null), + "float_range" => reader.ReadValue(options, null), + "geo_point" => reader.ReadValue(options, null), + "geo_shape" => reader.ReadValue(options, null), + "half_float" => reader.ReadValue(options, null), + "histogram" => reader.ReadValue(options, null), + "icu_collation_keyword" => reader.ReadValue(options, null), + "integer" => reader.ReadValue(options, null), + "integer_range" => reader.ReadValue(options, null), + "ip" => reader.ReadValue(options, null), + "ip_range" => reader.ReadValue(options, null), + "join" => reader.ReadValue(options, null), + "keyword" => reader.ReadValue(options, null), + "long" => reader.ReadValue(options, null), + "long_range" => reader.ReadValue(options, null), + "match_only_text" => reader.ReadValue(options, null), + "murmur3" => reader.ReadValue(options, null), + "nested" => reader.ReadValue(options, null), + "object" => reader.ReadValue(options, null), + "passthrough" => reader.ReadValue(options, null), + "percolator" => reader.ReadValue(options, null), + "point" => reader.ReadValue(options, null), + "rank_feature" => reader.ReadValue(options, null), + "rank_features" => reader.ReadValue(options, null), + "scaled_float" => reader.ReadValue(options, null), + "search_as_you_type" => reader.ReadValue(options, null), + "semantic_text" => reader.ReadValue(options, null), + "shape" => reader.ReadValue(options, null), + "short" => reader.ReadValue(options, null), + "sparse_vector" => reader.ReadValue(options, null), + "text" => reader.ReadValue(options, null), + "token_count" => reader.ReadValue(options, null), + "unsigned_long" => reader.ReadValue(options, null), + "version" => reader.ReadValue(options, null), + "wildcard" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Mapping.IProperty)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.IProperty value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "{dynamic_type}": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DynamicProperty)value, null); + break; + case "aggregate_metric_double": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty)value, null); + break; + case "alias": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty)value, null); + break; + case "binary": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.BinaryProperty)value, null); + break; + case "boolean": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.BooleanProperty)value, null); + break; + case "byte": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty)value, null); + break; + case "completion": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.CompletionProperty)value, null); + break; + case "constant_keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty)value, null); + break; + case "counted_keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty)value, null); + break; + case "date": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DateProperty)value, null); + break; + case "date_nanos": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty)value, null); + break; + case "date_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty)value, null); + break; + case "dense_vector": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty)value, null); + break; + case "double": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty)value, null); + break; + case "double_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty)value, null); + break; + case "flattened": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty)value, null); + break; + case "float": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty)value, null); + break; + case "float_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty)value, null); + break; + case "geo_point": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty)value, null); + break; + case "geo_shape": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty)value, null); + break; + case "half_float": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty)value, null); + break; + case "histogram": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.HistogramProperty)value, null); + break; + case "icu_collation_keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty)value, null); + break; + case "integer": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty)value, null); + break; + case "integer_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty)value, null); + break; + case "ip": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.IpProperty)value, null); + break; + case "ip_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty)value, null); + break; + case "join": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.JoinProperty)value, null); + break; + case "keyword": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.KeywordProperty)value, null); + break; + case "long": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty)value, null); + break; + case "long_range": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty)value, null); + break; + case "match_only_text": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty)value, null); + break; + case "murmur3": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty)value, null); + break; + case "nested": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.NestedProperty)value, null); + break; + case "object": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ObjectProperty)value, null); + break; + case "passthrough": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty)value, null); + break; + case "percolator": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty)value, null); + break; + case "point": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.PointProperty)value, null); + break; + case "rank_feature": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty)value, null); + break; + case "rank_features": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty)value, null); + break; + case "scaled_float": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty)value, null); + break; + case "search_as_you_type": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty)value, null); + break; + case "semantic_text": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty)value, null); + break; + case "shape": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ShapeProperty)value, null); + break; + case "short": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty)value, null); + break; + case "sparse_vector": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty)value, null); + break; + case "text": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.TextProperty)value, null); + break; + case "token_count": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty)value, null); + break; + case "unsigned_long": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty)value, null); + break; + case "version": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.VersionProperty)value, null); + break; + case "wildcard": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Mapping.WildcardProperty)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Mapping.IProperty)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.IPropertyConverter))] +public partial interface IProperty +{ + public string Type { get; } +} + +public readonly partial struct PropertyFactory +{ + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic() + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty AggregateMetricDouble(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty AggregateMetricDouble(System.Action> action) + { + return Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias() + { + return Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary() + { + return Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean() + { + return Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion() + { + return Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword() + { + return Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword() + { + return Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date(Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date() + { + return Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos() + { + return Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange() + { + return Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector() + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange() + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened() + { + return Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange() + { + return Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint() + { + return Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape() + { + return Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram() + { + return Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation() + { + return Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange() + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip(Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip() + { + return Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange() + { + return Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join(Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join() + { + return Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword() + { + return Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange() + { + return Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText() + { + return Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash() + { + return Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested(Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested() + { + return Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object() + { + return Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject() + { + return Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator() + { + return Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point(Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point() + { + return Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature() + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures() + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType() + { + return Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText() + { + return Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape() + { + return Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector() + { + return Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text(Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text() + { + return Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount() + { + return Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version(Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version() + { + return Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard() + { + return Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IProperty Build(System.Func, Elastic.Clients.Elasticsearch.Mapping.IProperty> action) + { + var builder = new Elastic.Clients.Elasticsearch.Mapping.PropertyFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct PropertyFactory +{ + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic() + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Dynamic(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DynamicPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty AggregateMetricDouble(Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoubleProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty AggregateMetricDouble(System.Action action) + { + return Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty AggregateMetricDouble(System.Action> action) + { + return Elastic.Clients.Elasticsearch.Mapping.AggregateMetricDoublePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias(Elastic.Clients.Elasticsearch.Mapping.FieldAliasProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias() + { + return Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FieldAlias(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FieldAliasPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary(Elastic.Clients.Elasticsearch.Mapping.BinaryProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary() + { + return Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Binary(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BinaryPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean(Elastic.Clients.Elasticsearch.Mapping.BooleanProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean() + { + return Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Boolean(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.BooleanPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber(Elastic.Clients.Elasticsearch.Mapping.ByteNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ByteNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ByteNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion(Elastic.Clients.Elasticsearch.Mapping.CompletionProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion() + { + return Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Completion(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CompletionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword(Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword() + { + return Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ConstantKeyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ConstantKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword(Elastic.Clients.Elasticsearch.Mapping.CountedKeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword() + { + return Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty CountedKeyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.CountedKeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date(Elastic.Clients.Elasticsearch.Mapping.DateProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date() + { + return Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Date(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DatePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos(Elastic.Clients.Elasticsearch.Mapping.DateNanosProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos() + { + return Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateNanos(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateNanosPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange(Elastic.Clients.Elasticsearch.Mapping.DateRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange() + { + return Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DateRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DateRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector(Elastic.Clients.Elasticsearch.Mapping.DenseVectorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector() + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DenseVector(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DenseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber(Elastic.Clients.Elasticsearch.Mapping.DoubleNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange(Elastic.Clients.Elasticsearch.Mapping.DoubleRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange() + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty DoubleRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.DoubleRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened(Elastic.Clients.Elasticsearch.Mapping.FlattenedProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened() + { + return Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Flattened(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FlattenedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber(Elastic.Clients.Elasticsearch.Mapping.FloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange(Elastic.Clients.Elasticsearch.Mapping.FloatRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange() + { + return Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty FloatRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.FloatRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint(Elastic.Clients.Elasticsearch.Mapping.GeoPointProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint() + { + return Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoPoint(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoPointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape(Elastic.Clients.Elasticsearch.Mapping.GeoShapeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape() + { + return Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty GeoShape(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.GeoShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber(Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty HalfFloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HalfFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram(Elastic.Clients.Elasticsearch.Mapping.HistogramProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram() + { + return Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Histogram(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.HistogramPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation(Elastic.Clients.Elasticsearch.Mapping.IcuCollationProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation() + { + return Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IcuCollation(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IcuCollationPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber(Elastic.Clients.Elasticsearch.Mapping.IntegerNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange(Elastic.Clients.Elasticsearch.Mapping.IntegerRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange() + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IntegerRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IntegerRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip(Elastic.Clients.Elasticsearch.Mapping.IpProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip() + { + return Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Ip(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange(Elastic.Clients.Elasticsearch.Mapping.IpRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange() + { + return Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty IpRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.IpRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join(Elastic.Clients.Elasticsearch.Mapping.JoinProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join() + { + return Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Join(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.JoinPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword(Elastic.Clients.Elasticsearch.Mapping.KeywordProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword() + { + return Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Keyword(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.KeywordPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber(Elastic.Clients.Elasticsearch.Mapping.LongNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange(Elastic.Clients.Elasticsearch.Mapping.LongRangeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange() + { + return Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty LongRange(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.LongRangePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText(Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText() + { + return Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty MatchOnlyText(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.MatchOnlyTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash(Elastic.Clients.Elasticsearch.Mapping.Murmur3HashProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash() + { + return Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Murmur3Hash(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.Murmur3HashPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested(Elastic.Clients.Elasticsearch.Mapping.NestedProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested() + { + return Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Nested(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.NestedPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object(Elastic.Clients.Elasticsearch.Mapping.ObjectProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object() + { + return Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Object(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject(Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject() + { + return Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty PassthroughObject(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PassthroughObjectPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator(Elastic.Clients.Elasticsearch.Mapping.PercolatorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator() + { + return Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Percolator(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PercolatorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point(Elastic.Clients.Elasticsearch.Mapping.PointProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point() + { + return Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Point(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.PointPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature() + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeature(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures() + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty RankFeatures(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ScaledFloatNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType() + { + return Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SearchAsYouType(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText() + { + return Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SemanticText(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape() + { + return Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Shape(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty ShortNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector() + { + return Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty SparseVector(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text(Elastic.Clients.Elasticsearch.Mapping.TextProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text() + { + return Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Text(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount() + { + return Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty TokenCount(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber() + { + return Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty UnsignedLongNumber(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version(Elastic.Clients.Elasticsearch.Mapping.VersionProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version() + { + return Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Version(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard() + { + return Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Mapping.IProperty Wildcard(System.Action>? action) + { + return Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.IProperty Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.Mapping.PropertyFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeatureProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeatureProperty.g.cs index f69e0dd7818..27eab76564a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeatureProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeatureProperty.g.cs @@ -17,23 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class RankFeatureProperty : IProperty +internal sealed partial class RankFeaturePropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropPositiveScoreImpact = System.Text.Json.JsonEncodedText.Encode("positive_score_impact"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPositiveScoreImpact = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPositiveScoreImpact.TryReadProperty(ref reader, options, PropPositiveScoreImpact, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + PositiveScoreImpact = propPositiveScoreImpact.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPositiveScoreImpact, value.PositiveScoreImpact, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyConverter))] +public sealed partial class RankFeatureProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public RankFeatureProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankFeatureProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,65 +152,55 @@ public sealed partial class RankFeatureProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("positive_score_impact")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? PositiveScoreImpact { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "rank_feature"; } -public sealed partial class RankFeaturePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct RankFeaturePropertyDescriptor { - internal RankFeaturePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty Instance { get; init; } - public RankFeaturePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PositiveScoreImpactValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public RankFeaturePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturePropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public RankFeaturePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -107,152 +208,126 @@ public RankFeaturePropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public RankFeaturePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public RankFeaturePropertyDescriptor PositiveScoreImpact(bool? positiveScoreImpact = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta() { - PositiveScoreImpactValue = positiveScoreImpact; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public RankFeaturePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor PositiveScoreImpact(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositiveScoreImpact = value; + return this; } - public RankFeaturePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PositiveScoreImpactValue.HasValue) - { - writer.WritePropertyName("positive_score_impact"); - writer.WriteBooleanValue(PositiveScoreImpactValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("rank_feature"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RankFeatureProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - PositiveScoreImpact = PositiveScoreImpactValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class RankFeaturePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct RankFeaturePropertyDescriptor { - internal RankFeaturePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty instance) + { + Instance = instance; + } - public RankFeaturePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PositiveScoreImpactValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor descriptor) => descriptor.Instance; - public RankFeaturePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public RankFeaturePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -260,102 +335,81 @@ public RankFeaturePropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public RankFeaturePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public RankFeaturePropertyDescriptor PositiveScoreImpact(bool? positiveScoreImpact = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta() { - PositiveScoreImpactValue = positiveScoreImpact; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public RankFeaturePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor PositiveScoreImpact(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositiveScoreImpact = value; + return this; } - public RankFeaturePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PositiveScoreImpactValue.HasValue) - { - writer.WritePropertyName("positive_score_impact"); - writer.WriteBooleanValue(PositiveScoreImpactValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("rank_feature"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RankFeatureProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RankFeatureProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - PositiveScoreImpact = PositiveScoreImpactValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeaturesProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeaturesProperty.g.cs index 783a6e62b7c..26737fb521b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeaturesProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RankFeaturesProperty.g.cs @@ -17,23 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class RankFeaturesProperty : IProperty +internal sealed partial class RankFeaturesPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropPositiveScoreImpact = System.Text.Json.JsonEncodedText.Encode("positive_score_impact"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPositiveScoreImpact = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPositiveScoreImpact.TryReadProperty(ref reader, options, PropPositiveScoreImpact, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + PositiveScoreImpact = propPositiveScoreImpact.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPositiveScoreImpact, value.PositiveScoreImpact, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyConverter))] +public sealed partial class RankFeaturesProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public RankFeaturesProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankFeaturesProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,65 +152,55 @@ public sealed partial class RankFeaturesProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("positive_score_impact")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? PositiveScoreImpact { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "rank_features"; } -public sealed partial class RankFeaturesPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct RankFeaturesPropertyDescriptor { - internal RankFeaturesPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty Instance { get; init; } - public RankFeaturesPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturesPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PositiveScoreImpactValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public RankFeaturesPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturesPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public RankFeaturesPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturesPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -107,152 +208,126 @@ public RankFeaturesPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public RankFeaturesPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public RankFeaturesPropertyDescriptor PositiveScoreImpact(bool? positiveScoreImpact = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta() { - PositiveScoreImpactValue = positiveScoreImpact; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public RankFeaturesPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor PositiveScoreImpact(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositiveScoreImpact = value; + return this; } - public RankFeaturesPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (PositiveScoreImpactValue.HasValue) - { - writer.WritePropertyName("positive_score_impact"); - writer.WriteBooleanValue(PositiveScoreImpactValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("rank_features"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RankFeaturesProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - PositiveScoreImpact = PositiveScoreImpactValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class RankFeaturesPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct RankFeaturesPropertyDescriptor { - internal RankFeaturesPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturesPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty instance) + { + Instance = instance; + } - public RankFeaturesPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeaturesPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? PositiveScoreImpactValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor descriptor) => descriptor.Instance; - public RankFeaturesPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public RankFeaturesPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturesPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public RankFeaturesPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -260,102 +335,81 @@ public RankFeaturesPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public RankFeaturesPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public RankFeaturesPropertyDescriptor PositiveScoreImpact(bool? positiveScoreImpact = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta() { - PositiveScoreImpactValue = positiveScoreImpact; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public RankFeaturesPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor PositiveScoreImpact(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositiveScoreImpact = value; + return this; } - public RankFeaturesPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PositiveScoreImpactValue.HasValue) - { - writer.WritePropertyName("positive_score_impact"); - writer.WriteBooleanValue(PositiveScoreImpactValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("rank_features"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RankFeaturesProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - RankFeaturesProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - PositiveScoreImpact = PositiveScoreImpactValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RoutingField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RoutingField.g.cs index 7f830541a9a..64a38fb09f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RoutingField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RoutingField.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class RoutingFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRequired = System.Text.Json.JsonEncodedText.Encode("required"); + + public override Elastic.Clients.Elasticsearch.Mapping.RoutingField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRequired = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRequired.TryReadProperty(ref reader, options, PropRequired, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.RoutingField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Required = propRequired.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RoutingField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRequired, value.Required, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldConverter))] public sealed partial class RoutingField { - [JsonInclude, JsonPropertyName("required")] - public bool Required { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoutingField(bool required) + { + Required = required; + } +#if NET7_0_OR_GREATER + public RoutingField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoutingField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoutingField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Required { get; set; } } -public sealed partial class RoutingFieldDescriptor : SerializableDescriptor +public readonly partial struct RoutingFieldDescriptor { - internal RoutingFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RoutingField Instance { get; init; } - public RoutingFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoutingFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RoutingField instance) { + Instance = instance; } - private bool RequiredValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoutingFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.RoutingField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public RoutingFieldDescriptor Required(bool required = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RoutingField instance) => new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RoutingField(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor Required(bool value = true) { - RequiredValue = required; - return Self; + Instance.Required = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RoutingField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("required"); - writer.WriteBooleanValue(RequiredValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RoutingField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeField.g.cs index 3570e56eb3f..2b911a997c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeField.g.cs @@ -17,40 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class RuntimeFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFetchFields = System.Text.Json.JsonEncodedText.Encode("fetch_fields"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropInputField = System.Text.Json.JsonEncodedText.Encode("input_field"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropTargetField = System.Text.Json.JsonEncodedText.Encode("target_field"); + private static readonly System.Text.Json.JsonEncodedText PropTargetIndex = System.Text.Json.JsonEncodedText.Encode("target_index"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.RuntimeField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFetchFields = default; + LocalJsonValue?> propFields = default; + LocalJsonValue propFormat = default; + LocalJsonValue propInputField = default; + LocalJsonValue propScript = default; + LocalJsonValue propTargetField = default; + LocalJsonValue propTargetIndex = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFetchFields.TryReadProperty(ref reader, options, PropFetchFields, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propInputField.TryReadProperty(ref reader, options, PropInputField, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propTargetField.TryReadProperty(ref reader, options, PropTargetField, null)) + { + continue; + } + + if (propTargetIndex.TryReadProperty(ref reader, options, PropTargetIndex, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FetchFields = propFetchFields.Value, + Fields = propFields.Value, + Format = propFormat.Value, + InputField = propInputField.Value, + Script = propScript.Value, + TargetField = propTargetField.Value, + TargetIndex = propTargetIndex.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFetchFields, value.FetchFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropInputField, value.InputField, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropTargetField, value.TargetField, null, null); + writer.WriteProperty(options, PropTargetIndex, value.TargetIndex, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldConverter))] public sealed partial class RuntimeField { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeField(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public RuntimeField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuntimeField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// For type lookup /// /// - [JsonInclude, JsonPropertyName("fetch_fields")] - public ICollection? FetchFields { get; set; } + public System.Collections.Generic.ICollection? FetchFields { get; set; } /// /// /// For type composite /// /// - [JsonInclude, JsonPropertyName("fields")] - public IDictionary? Fields { get; set; } + public System.Collections.Generic.IDictionary? Fields { get; set; } /// /// /// A custom format for date type runtime fields. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } /// @@ -58,7 +176,6 @@ public sealed partial class RuntimeField /// For type lookup /// /// - [JsonInclude, JsonPropertyName("input_field")] public Elastic.Clients.Elasticsearch.Field? InputField { get; set; } /// @@ -66,7 +183,6 @@ public sealed partial class RuntimeField /// Painless script executed at query time. /// /// - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } /// @@ -74,7 +190,6 @@ public sealed partial class RuntimeField /// For type lookup /// /// - [JsonInclude, JsonPropertyName("target_field")] public Elastic.Clients.Elasticsearch.Field? TargetField { get; set; } /// @@ -82,7 +197,6 @@ public sealed partial class RuntimeField /// For type lookup /// /// - [JsonInclude, JsonPropertyName("target_index")] public Elastic.Clients.Elasticsearch.IndexName? TargetIndex { get; set; } /// @@ -90,71 +204,80 @@ public sealed partial class RuntimeField /// Field type, which can be: boolean, composite, date, double, geo_point, ip,keyword, long, or lookup. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType Type { get; set; } } -public sealed partial class RuntimeFieldDescriptor : SerializableDescriptor> +public readonly partial struct RuntimeFieldDescriptor { - internal RuntimeFieldDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RuntimeField Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeField instance) + { + Instance = instance; + } - public RuntimeFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? FetchFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor FetchFieldsDescriptor { get; set; } - private Action> FetchFieldsDescriptorAction { get; set; } - private Action>[] FetchFieldsDescriptorActions { get; set; } - private IDictionary FieldsValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? InputFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? TargetIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeField instance) => new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor descriptor) => descriptor.Instance; /// /// /// For type lookup /// /// - public RuntimeFieldDescriptor FetchFields(ICollection? fetchFields) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(System.Collections.Generic.ICollection? value) { - FetchFieldsDescriptor = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = null; - FetchFieldsValue = fetchFields; - return Self; + Instance.FetchFields = value; + return this; } - public RuntimeFieldDescriptor FetchFields(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor descriptor) + /// + /// + /// For type lookup + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(params Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields[] values) { - FetchFieldsValue = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = null; - FetchFieldsDescriptor = descriptor; - return Self; + Instance.FetchFields = [.. values]; + return this; } - public RuntimeFieldDescriptor FetchFields(Action> configure) + /// + /// + /// For type lookup + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(params System.Action>[] actions) { - FetchFieldsValue = null; - FetchFieldsDescriptor = null; - FetchFieldsDescriptorActions = null; - FetchFieldsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor.Build(action)); + } + + Instance.FetchFields = items; + return this; } - public RuntimeFieldDescriptor FetchFields(params Action>[] configure) + /// + /// + /// For type composite + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields(System.Collections.Generic.IDictionary? value) { - FetchFieldsValue = null; - FetchFieldsDescriptor = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = configure; - return Self; + Instance.Fields = value; + return this; } /// @@ -162,32 +285,46 @@ public RuntimeFieldDescriptor FetchFields(params Actioncomposite /// /// - public RuntimeFieldDescriptor Fields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields() { - FieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField.Build(null); + return this; } /// /// - /// A custom format for date type runtime fields. + /// For type composite /// /// - public RuntimeFieldDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields(System.Action? action) { - FormatValue = format; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor AddField(string key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubField value) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor AddField(string key, System.Action action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor.Build(action)); + return this; } /// /// - /// For type lookup + /// A custom format for date type runtime fields. /// /// - public RuntimeFieldDescriptor InputField(Elastic.Clients.Elasticsearch.Field? inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Format(string? value) { - InputFieldValue = inputField; - return Self; + Instance.Format = value; + return this; } /// @@ -195,10 +332,10 @@ public RuntimeFieldDescriptor InputField(Elastic.Clients.Elasticsearc /// For type lookup /// /// - public RuntimeFieldDescriptor InputField(Expression> inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor InputField(Elastic.Clients.Elasticsearch.Field? value) { - InputFieldValue = inputField; - return Self; + Instance.InputField = value; + return this; } /// @@ -206,10 +343,10 @@ public RuntimeFieldDescriptor InputField(Expressionlookup /// /// - public RuntimeFieldDescriptor InputField(Expression> inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor InputField(System.Linq.Expressions.Expression> value) { - InputFieldValue = inputField; - return Self; + Instance.InputField = value; + return this; } /// @@ -217,39 +354,32 @@ public RuntimeFieldDescriptor InputField(Expression /// - public RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) - { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; - } - - public RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public RuntimeFieldDescriptor Script(Action configure) + /// + /// + /// Painless script executed at query time. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// For type lookup + /// Painless script executed at query time. /// /// - public RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script(System.Action? action) { - TargetFieldValue = targetField; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -257,10 +387,10 @@ public RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsear /// For type lookup /// /// - public RuntimeFieldDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -268,10 +398,10 @@ public RuntimeFieldDescriptor TargetField(Expressionlookup /// /// - public RuntimeFieldDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -279,10 +409,10 @@ public RuntimeFieldDescriptor TargetField(Expressionlookup /// /// - public RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName? targetIndex) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName? value) { - TargetIndexValue = targetIndex; - return Self; + Instance.TargetIndex = value; + return this; } /// @@ -290,159 +420,94 @@ public RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsear /// Field type, which can be: boolean, composite, date, double, geo_point, ip,keyword, long, or lookup. /// /// - public RuntimeFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType type) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RuntimeField Build(System.Action> action) { - writer.WriteStartObject(); - if (FetchFieldsDescriptor is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FetchFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FetchFieldsDescriptorAction is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(FetchFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FetchFieldsDescriptorActions is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - foreach (var action in FetchFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FetchFieldsValue is not null) - { - writer.WritePropertyName("fetch_fields"); - JsonSerializer.Serialize(writer, FetchFieldsValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (InputFieldValue is not null) - { - writer.WritePropertyName("input_field"); - JsonSerializer.Serialize(writer, InputFieldValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TargetIndexValue is not null) - { - writer.WritePropertyName("target_index"); - JsonSerializer.Serialize(writer, TargetIndexValue, options); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RuntimeFieldDescriptor : SerializableDescriptor +public readonly partial struct RuntimeFieldDescriptor { - internal RuntimeFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RuntimeField Instance { get; init; } - public RuntimeFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeField instance) { + Instance = instance; } - private ICollection? FetchFieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor FetchFieldsDescriptor { get; set; } - private Action FetchFieldsDescriptorAction { get; set; } - private Action[] FetchFieldsDescriptorActions { get; set; } - private IDictionary FieldsValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? InputFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field? TargetFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? TargetIndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeField instance) => new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor descriptor) => descriptor.Instance; /// /// /// For type lookup /// /// - public RuntimeFieldDescriptor FetchFields(ICollection? fetchFields) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(System.Collections.Generic.ICollection? value) { - FetchFieldsDescriptor = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = null; - FetchFieldsValue = fetchFields; - return Self; + Instance.FetchFields = value; + return this; } - public RuntimeFieldDescriptor FetchFields(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor descriptor) + /// + /// + /// For type lookup + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(params Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields[] values) { - FetchFieldsValue = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = null; - FetchFieldsDescriptor = descriptor; - return Self; + Instance.FetchFields = [.. values]; + return this; } - public RuntimeFieldDescriptor FetchFields(Action configure) + /// + /// + /// For type lookup + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(params System.Action[] actions) { - FetchFieldsValue = null; - FetchFieldsDescriptor = null; - FetchFieldsDescriptorActions = null; - FetchFieldsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor.Build(action)); + } + + Instance.FetchFields = items; + return this; } - public RuntimeFieldDescriptor FetchFields(params Action[] configure) + /// + /// + /// For type lookup + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor FetchFields(params System.Action>[] actions) { - FetchFieldsValue = null; - FetchFieldsDescriptor = null; - FetchFieldsDescriptorAction = null; - FetchFieldsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor.Build(action)); + } + + Instance.FetchFields = items; + return this; } /// @@ -450,43 +515,57 @@ public RuntimeFieldDescriptor FetchFields(params Actioncomposite /// /// - public RuntimeFieldDescriptor Fields(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields(System.Collections.Generic.IDictionary? value) { - FieldsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Fields = value; + return this; } /// /// - /// A custom format for date type runtime fields. + /// For type composite /// /// - public RuntimeFieldDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields() { - FormatValue = format; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField.Build(null); + return this; } /// /// - /// For type lookup + /// For type composite /// /// - public RuntimeFieldDescriptor InputField(Elastic.Clients.Elasticsearch.Field? inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Fields(System.Action? action) + { + Instance.Fields = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCompositeSubField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor AddField(string key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubField value) { - InputFieldValue = inputField; - return Self; + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor AddField(string key, System.Action action) + { + Instance.Fields ??= new System.Collections.Generic.Dictionary(); + Instance.Fields.Add(key, Elastic.Clients.Elasticsearch.Mapping.CompositeSubFieldDescriptor.Build(action)); + return this; } /// /// - /// For type lookup + /// A custom format for date type runtime fields. /// /// - public RuntimeFieldDescriptor InputField(Expression> inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Format(string? value) { - InputFieldValue = inputField; - return Self; + Instance.Format = value; + return this; } /// @@ -494,50 +573,54 @@ public RuntimeFieldDescriptor InputField(Expressionlookup /// /// - public RuntimeFieldDescriptor InputField(Expression> inputField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor InputField(Elastic.Clients.Elasticsearch.Field? value) { - InputFieldValue = inputField; - return Self; + Instance.InputField = value; + return this; } /// /// - /// Painless script executed at query time. + /// For type lookup /// /// - public RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor InputField(System.Linq.Expressions.Expression> value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.InputField = value; + return this; } - public RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Painless script executed at query time. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public RuntimeFieldDescriptor Script(Action configure) + /// + /// + /// Painless script executed at query time. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } /// /// - /// For type lookup + /// Painless script executed at query time. /// /// - public RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Script(System.Action? action) { - TargetFieldValue = targetField; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } /// @@ -545,10 +628,10 @@ public RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? t /// For type lookup /// /// - public RuntimeFieldDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetField(Elastic.Clients.Elasticsearch.Field? value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -556,10 +639,10 @@ public RuntimeFieldDescriptor TargetField(Expressionlookup /// /// - public RuntimeFieldDescriptor TargetField(Expression> targetField) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetField(System.Linq.Expressions.Expression> value) { - TargetFieldValue = targetField; - return Self; + Instance.TargetField = value; + return this; } /// @@ -567,10 +650,10 @@ public RuntimeFieldDescriptor TargetField(Expressionlookup /// /// - public RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName? targetIndex) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexName? value) { - TargetIndexValue = targetIndex; - return Self; + Instance.TargetIndex = value; + return this; } /// @@ -578,94 +661,17 @@ public RuntimeFieldDescriptor TargetIndex(Elastic.Clients.Elasticsearch.IndexNam /// Field type, which can be: boolean, composite, date, double, geo_point, ip,keyword, long, or lookup. /// /// - public RuntimeFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType type) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor Type(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RuntimeField Build(System.Action action) { - writer.WriteStartObject(); - if (FetchFieldsDescriptor is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FetchFieldsDescriptor, options); - writer.WriteEndArray(); - } - else if (FetchFieldsDescriptorAction is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(FetchFieldsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FetchFieldsDescriptorActions is not null) - { - writer.WritePropertyName("fetch_fields"); - writer.WriteStartArray(); - foreach (var action in FetchFieldsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FetchFieldsValue is not null) - { - writer.WritePropertyName("fetch_fields"); - JsonSerializer.Serialize(writer, FetchFieldsValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (InputFieldValue is not null) - { - writer.WritePropertyName("input_field"); - JsonSerializer.Serialize(writer, InputFieldValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TargetFieldValue is not null) - { - writer.WritePropertyName("target_field"); - JsonSerializer.Serialize(writer, TargetFieldValue, options); - } - - if (TargetIndexValue is not null) - { - writer.WritePropertyName("target_index"); - JsonSerializer.Serialize(writer, TargetIndexValue, options); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RuntimeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeFieldFetchFields.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeFieldFetchFields.g.cs index e541c98952f..b6f23d5712d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeFieldFetchFields.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/RuntimeFieldFetchFields.g.cs @@ -17,120 +17,190 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class RuntimeFieldFetchFieldsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + + public override Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsConverter))] public sealed partial class RuntimeFieldFetchFields { - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("format")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public RuntimeFieldFetchFields() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuntimeFieldFetchFields() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? Format { get; set; } } -public sealed partial class RuntimeFieldFetchFieldsDescriptor : SerializableDescriptor> +public readonly partial struct RuntimeFieldFetchFieldsDescriptor { - internal RuntimeFieldFetchFieldsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields Instance { get; init; } - public RuntimeFieldFetchFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldFetchFieldsDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - - public RuntimeFieldFetchFieldsDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldFetchFieldsDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RuntimeFieldFetchFieldsDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields instance) => new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RuntimeFieldFetchFieldsDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RuntimeFieldFetchFieldsDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RuntimeFieldFetchFieldsDescriptor : SerializableDescriptor +public readonly partial struct RuntimeFieldFetchFieldsDescriptor { - internal RuntimeFieldFetchFieldsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields Instance { get; init; } - public RuntimeFieldFetchFieldsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldFetchFieldsDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - - public RuntimeFieldFetchFieldsDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldFetchFieldsDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RuntimeFieldFetchFieldsDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields instance) => new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RuntimeFieldFetchFieldsDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RuntimeFieldFetchFieldsDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFieldsDescriptor(new Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldFetchFields(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ScaledFloatNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ScaledFloatNumberProperty.g.cs index 1b85fda0509..3d3db47587f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ScaledFloatNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ScaledFloatNumberProperty.g.cs @@ -17,36 +17,248 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class ScaledFloatNumberProperty : IProperty +internal sealed partial class ScaledFloatNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScalingFactor = System.Text.Json.JsonEncodedText.Encode("scaling_factor"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScalingFactor = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScalingFactor.TryReadProperty(ref reader, options, PropScalingFactor, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + ScalingFactor = propScalingFactor.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScalingFactor, value.ScalingFactor, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyConverter))] +public sealed partial class ScaledFloatNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public ScaledFloatNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScaledFloatNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,21 +266,13 @@ public sealed partial class ScaledFloatNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public double? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("scaling_factor")] public double? ScalingFactor { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -76,7 +280,6 @@ public sealed partial class ScaledFloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -84,109 +287,94 @@ public sealed partial class ScaledFloatNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "scaled_float"; } -public sealed partial class ScaledFloatNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ScaledFloatNumberPropertyDescriptor { - internal ScaledFloatNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty Instance { get; init; } - public ScaledFloatNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScaledFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private double? ScalingFactorValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScaledFloatNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor descriptor) => descriptor.Instance; - public ScaledFloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public ScaledFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ScaledFloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ScaledFloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -194,84 +382,99 @@ public ScaledFloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ScaledFloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ScaledFloatNumberPropertyDescriptor NullValue(double? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ScaledFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta(System.Action? action) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor NullValue(double? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public ScaledFloatNumberPropertyDescriptor ScalingFactor(double? scalingFactor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - ScalingFactorValue = scalingFactor; - return Self; + Instance.Properties = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor ScalingFactor(double? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.ScalingFactor = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script() { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script(System.Action? action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -279,10 +482,10 @@ public ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elasti /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -290,288 +493,137 @@ public ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ScaledFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) + if (action is null) { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScalingFactorValue.HasValue) - { - writer.WritePropertyName("scaling_factor"); - writer.WriteNumberValue(ScalingFactorValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct ScaledFloatNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("scaled_float"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScaledFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScaledFloatNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - ScaledFloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - ScalingFactor = ScalingFactorValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class ScaledFloatNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal ScaledFloatNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public ScaledFloatNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private double? ScalingFactorValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public ScaledFloatNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public ScaledFloatNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public ScaledFloatNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ScaledFloatNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public ScaledFloatNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -579,84 +631,83 @@ public ScaledFloatNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ScaledFloatNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ScaledFloatNumberPropertyDescriptor NullValue(double? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor NullValue(double? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public ScaledFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor ScalingFactor(double? scalingFactor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor ScalingFactor(double? value) { - ScalingFactorValue = scalingFactor; - return Self; + Instance.ScalingFactor = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScaledFloatNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ScaledFloatNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -664,10 +715,10 @@ public ScaledFloatNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.E /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -675,188 +726,22 @@ public ScaledFloatNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesD /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ScaledFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScalingFactorValue.HasValue) + if (action is null) { - writer.WritePropertyName("scaling_factor"); - writer.WriteNumberValue(ScalingFactorValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("scaled_float"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ScaledFloatNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - ScaledFloatNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - ScalingFactor = ScalingFactorValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SearchAsYouTypeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SearchAsYouTypeProperty.g.cs index ccfb13d6ed1..46970d27001 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SearchAsYouTypeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SearchAsYouTypeProperty.g.cs @@ -17,34 +17,229 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class SearchAsYouTypeProperty : IProperty +internal sealed partial class SearchAsYouTypePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropMaxShingleSize = System.Text.Json.JsonEncodedText.Encode("max_shingle_size"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSearchQuoteAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_quote_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTermVector = System.Text.Json.JsonEncodedText.Encode("term_vector"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue propMaxShingleSize = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNorms = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSearchAnalyzer = default; + LocalJsonValue propSearchQuoteAnalyzer = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTermVector = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propMaxShingleSize.TryReadProperty(ref reader, options, PropMaxShingleSize, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSearchAnalyzer.TryReadProperty(ref reader, options, PropSearchAnalyzer, null)) + { + continue; + } + + if (propSearchQuoteAnalyzer.TryReadProperty(ref reader, options, PropSearchQuoteAnalyzer, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTermVector.TryReadProperty(ref reader, options, PropTermVector, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + CopyTo = propCopyTo.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + MaxShingleSize = propMaxShingleSize.Value, + Meta = propMeta.Value, + Norms = propNorms.Value, + Properties = propProperties.Value, + SearchAnalyzer = propSearchAnalyzer.Value, + SearchQuoteAnalyzer = propSearchQuoteAnalyzer.Value, + Similarity = propSimilarity.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TermVector = propTermVector.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropMaxShingleSize, value.MaxShingleSize, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSearchAnalyzer, value.SearchAnalyzer, null, null); + writer.WriteProperty(options, PropSearchQuoteAnalyzer, value.SearchQuoteAnalyzer, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTermVector, value.TermVector, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyConverter))] +public sealed partial class SearchAsYouTypeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("analyzer")] +#if NET7_0_OR_GREATER + public SearchAsYouTypeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public SearchAsYouTypeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Analyzer { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } - [JsonInclude, JsonPropertyName("max_shingle_size")] public int? MaxShingleSize { get; set; } /// @@ -52,115 +247,96 @@ public sealed partial class SearchAsYouTypeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("norms")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? Norms { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("search_analyzer")] public string? SearchAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("search_quote_analyzer")] public string? SearchQuoteAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("term_vector")] public Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVector { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "search_as_you_type"; } -public sealed partial class SearchAsYouTypePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct SearchAsYouTypePropertyDescriptor { - internal SearchAsYouTypePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAsYouTypePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty instance) + { + Instance = instance; + } - public SearchAsYouTypePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAsYouTypePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private int? MaxShingleSizeValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor descriptor) => descriptor.Instance; - public SearchAsYouTypePropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public SearchAsYouTypePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public SearchAsYouTypePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public SearchAsYouTypePropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public SearchAsYouTypePropertyDescriptor MaxShingleSize(int? maxShingleSize) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor MaxShingleSize(int? value) { - MaxShingleSizeValue = maxShingleSize; - return Self; + Instance.MaxShingleSize = value; + return this; } /// @@ -168,292 +344,192 @@ public SearchAsYouTypePropertyDescriptor MaxShingleSize(int? maxShing /// Metadata about the field. /// /// - public SearchAsYouTypePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public SearchAsYouTypePropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Norms(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Norms = value; + return this; } - public SearchAsYouTypePropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = value; + return this; } - public SearchAsYouTypePropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Properties(System.Action> action) { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SearchAnalyzer(string? value) { - SimilarityValue = similarity; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SearchQuoteAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Similarity(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Similarity = value; + return this; } - public SearchAsYouTypePropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Store(bool? value = true) { - TermVectorValue = termVector; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MaxShingleSizeValue.HasValue) - { - writer.WritePropertyName("max_shingle_size"); - writer.WriteNumberValue(MaxShingleSizeValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) + { + Instance.TermVector = value; + return this; + } - if (TermVectorValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("search_as_you_type"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SearchAsYouTypeProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - MaxShingleSize = MaxShingleSizeValue, - Meta = MetaValue, - Norms = NormsValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Similarity = SimilarityValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue - }; } -public sealed partial class SearchAsYouTypePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SearchAsYouTypePropertyDescriptor { - internal SearchAsYouTypePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty Instance { get; init; } - public SearchAsYouTypePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAsYouTypePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private int? MaxShingleSizeValue { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAsYouTypePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SearchAsYouTypePropertyDescriptor Analyzer(string? analyzer) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public SearchAsYouTypePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public SearchAsYouTypePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Fields(System.Action action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Fields(System.Action> action) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor IgnoreAbove(int? value) { - IndexValue = index; - return Self; + Instance.IgnoreAbove = value; + return this; } - public SearchAsYouTypePropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Index(bool? value = true) { - IndexOptionsValue = indexOptions; - return Self; + Instance.Index = value; + return this; } - public SearchAsYouTypePropertyDescriptor MaxShingleSize(int? maxShingleSize) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - MaxShingleSizeValue = maxShingleSize; - return Self; + Instance.IndexOptions = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor MaxShingleSize(int? value) + { + Instance.MaxShingleSize = value; + return this; } /// @@ -461,202 +537,111 @@ public SearchAsYouTypePropertyDescriptor MaxShingleSize(int? maxShingleSize) /// Metadata about the field. /// /// - public SearchAsYouTypePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public SearchAsYouTypePropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public SearchAsYouTypePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Norms(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Norms = value; + return this; } - public SearchAsYouTypePropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = value; + return this; } - public SearchAsYouTypePropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Properties(System.Action action) { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Properties(System.Action> action) { - SimilarityValue = similarity; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SearchAsYouTypePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SearchAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SearchQuoteAnalyzer(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public SearchAsYouTypePropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Similarity(string? value) { - TermVectorValue = termVector; - return Self; + Instance.Similarity = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (MaxShingleSizeValue.HasValue) - { - writer.WritePropertyName("max_shingle_size"); - writer.WriteNumberValue(MaxShingleSizeValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) + { + Instance.TermVector = value; + return this; + } - if (TermVectorValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("search_as_you_type"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SearchAsYouTypeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SearchAsYouTypeProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - CopyTo = CopyToValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - MaxShingleSize = MaxShingleSizeValue, - Meta = MetaValue, - Norms = NormsValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Similarity = SimilarityValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SemanticTextProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SemanticTextProperty.g.cs index 25d160139c7..23dcca746c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SemanticTextProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SemanticTextProperty.g.cs @@ -17,18 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class SemanticTextProperty : IProperty +internal sealed partial class SemanticTextPropertyConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropSearchInferenceId = System.Text.Json.JsonEncodedText.Encode("search_inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInferenceId = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propSearchInferenceId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSearchInferenceId.TryReadProperty(ref reader, options, PropSearchInferenceId, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InferenceId = propInferenceId.Value, + Meta = propMeta.Value, + SearchInferenceId = propSearchInferenceId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSearchInferenceId, value.SearchInferenceId, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyConverter))] +public sealed partial class SemanticTextProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public SemanticTextProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public SemanticTextProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Inference endpoint that will be used to generate embeddings for the field. @@ -36,10 +114,8 @@ public sealed partial class SemanticTextProperty : IProperty /// If search_inference_id is specified, the inference endpoint will only be used at index time. /// /// - [JsonInclude, JsonPropertyName("inference_id")] public Elastic.Clients.Elasticsearch.Id? InferenceId { get; set; } - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } /// /// @@ -48,24 +124,29 @@ public sealed partial class SemanticTextProperty : IProperty /// If not specified, the inference endpoint defined by inference_id will be used at both index and query time. /// /// - [JsonInclude, JsonPropertyName("search_inference_id")] public Elastic.Clients.Elasticsearch.Id? SearchInferenceId { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "semantic_text"; } -public sealed partial class SemanticTextPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SemanticTextPropertyDescriptor { - internal SemanticTextPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty Instance { get; init; } - public SemanticTextPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? InferenceIdValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? SearchInferenceIdValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticTextPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor descriptor) => descriptor.Instance; /// /// @@ -74,16 +155,35 @@ public SemanticTextPropertyDescriptor() : base() /// If search_inference_id is specified, the inference endpoint will only be used at index time. /// /// - public SemanticTextPropertyDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? inferenceId) + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.InferenceId = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - InferenceIdValue = inferenceId; - return Self; + Instance.Meta = value; + return this; } - public SemanticTextPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } /// @@ -93,42 +193,106 @@ public SemanticTextPropertyDescriptor Meta(Func /// If not specified, the inference endpoint defined by inference_id will be used at both index and query time. /// /// - public SemanticTextPropertyDescriptor SearchInferenceId(Elastic.Clients.Elasticsearch.Id? searchInferenceId) + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor SearchInferenceId(Elastic.Clients.Elasticsearch.Id? value) { - SearchInferenceIdValue = searchInferenceId; - return Self; + Instance.SearchInferenceId = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (InferenceIdValue is not null) + if (action is null) { - writer.WritePropertyName("inference_id"); - JsonSerializer.Serialize(writer, InferenceIdValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SearchInferenceIdValue is not null) - { - writer.WritePropertyName("search_inference_id"); - JsonSerializer.Serialize(writer, SearchInferenceIdValue, options); - } +public readonly partial struct SemanticTextPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("semantic_text"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty instance) + { + Instance = instance; } - SemanticTextProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticTextPropertyDescriptor() { - InferenceId = InferenceIdValue, - Meta = MetaValue, - SearchInferenceId = SearchInferenceIdValue - }; + Instance = new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Inference endpoint that will be used to generate embeddings for the field. + /// This parameter cannot be updated. Use the Create inference API to create the endpoint. + /// If search_inference_id is specified, the inference endpoint will only be used at index time. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.InferenceId = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor AddMeta(string key, string value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + /// + /// + /// Inference endpoint that will be used to generate embeddings at query time. + /// You can update this parameter by using the Update mapping API. Use the Create inference API to create the endpoint. + /// If not specified, the inference endpoint defined by inference_id will be used at both index and query time. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor SearchInferenceId(Elastic.Clients.Elasticsearch.Id? value) + { + Instance.SearchInferenceId = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.SemanticTextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SemanticTextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShapeProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShapeProperty.g.cs index 1c11744d207..f3bf3ee4815 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShapeProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShapeProperty.g.cs @@ -17,41 +17,200 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class ShapePropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreZValue = System.Text.Json.JsonEncodedText.Encode("ignore_z_value"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropOrientation = System.Text.Json.JsonEncodedText.Encode("orientation"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.ShapeProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIgnoreZValue = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propOrientation = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIgnoreZValue.TryReadProperty(ref reader, options, PropIgnoreZValue, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOrientation.TryReadProperty(ref reader, options, PropOrientation, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + IgnoreZValue = propIgnoreZValue.Value, + Meta = propMeta.Value, + Orientation = propOrientation.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ShapeProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIgnoreZValue, value.IgnoreZValue, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOrientation, value.Orientation, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + /// /// /// The shape data type facilitates the indexing of and searching with arbitrary x, y cartesian shapes such as /// rectangles and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class ShapeProperty : IProperty +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ShapePropertyConverter))] +public sealed partial class ShapeProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("coerce")] +#if NET7_0_OR_GREATER + public ShapeProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShapeProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("ignore_z_value")] public bool? IgnoreZValue { get; set; } /// @@ -59,18 +218,12 @@ public sealed partial class ShapeProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("orientation")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? Orientation { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "shape"; } @@ -79,90 +232,85 @@ public sealed partial class ShapeProperty : IProperty /// The shape data type facilitates the indexing of and searching with arbitrary x, y cartesian shapes such as /// rectangles and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class ShapePropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ShapePropertyDescriptor { - internal ShapePropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ShapeProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty instance) + { + Instance = instance; + } - public ShapePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapePropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? OrientationValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor descriptor) => descriptor.Instance; - public ShapePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Coerce(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.Coerce = value; + return this; } - public ShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ShapePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public ShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public ShapePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShapePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ShapePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } /// @@ -170,152 +318,83 @@ public ShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true /// Metadata about the field. /// /// - public ShapePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? orientation) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta() { - OrientationValue = orientation; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ShapePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Orientation = value; + return this; } - public ShapePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public ShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (OrientationValue is not null) - { - writer.WritePropertyName("orientation"); - JsonSerializer.Serialize(writer, OrientationValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ShapeProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("shape"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ShapeProperty IBuildableDescriptor.Build() => new() - { - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - Orientation = OrientationValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } /// @@ -323,90 +402,91 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The shape data type facilitates the indexing of and searching with arbitrary x, y cartesian shapes such as /// rectangles and polygons. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class ShapePropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct ShapePropertyDescriptor { - internal ShapePropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ShapeProperty Instance { get; init; } - public ShapePropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty instance) { + Instance = instance; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IgnoreZValueValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? OrientationValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapePropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShapeProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Coerce(bool? value = true) + { + Instance.Coerce = value; + return this; + } - public ShapePropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public ShapePropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ShapePropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public ShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public ShapePropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShapePropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShapePropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ShapePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor IgnoreZValue(bool? value = true) { - IgnoreZValueValue = ignoreZValue; - return Self; + Instance.IgnoreZValue = value; + return this; } /// @@ -414,150 +494,87 @@ public ShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) /// Metadata about the field. /// /// - public ShapePropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public ShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? orientation) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta() { - OrientationValue = orientation; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ShapePropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Orientation(Elastic.Clients.Elasticsearch.Mapping.GeoOrientation? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Orientation = value; + return this; } - public ShapePropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public ShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IgnoreZValueValue.HasValue) - { - writer.WritePropertyName("ignore_z_value"); - writer.WriteBooleanValue(IgnoreZValueValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (OrientationValue is not null) - { - writer.WritePropertyName("orientation"); - JsonSerializer.Serialize(writer, OrientationValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ShapeProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("shape"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ShapePropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ShapeProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - ShapeProperty IBuildableDescriptor.Build() => new() - { - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - IgnoreZValue = IgnoreZValueValue, - Meta = MetaValue, - Orientation = OrientationValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShortNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShortNumberProperty.g.cs index 86726793733..88f2b1cf293 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShortNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/ShortNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class ShortNumberProperty : IProperty +internal sealed partial class ShortNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyConverter))] +public sealed partial class ShortNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public ShortNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShortNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class ShortNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public short? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class ShortNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class ShortNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "short"; } -public sealed partial class ShortNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct ShortNumberPropertyDescriptor { - internal ShortNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty Instance { get; init; } - public ShortNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShortNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private short? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShortNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public ShortNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public ShortNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public ShortNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public ShortNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public ShortNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ShortNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ShortNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public ShortNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public ShortNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ShortNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public ShortNumberPropertyDescriptor NullValue(short? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public ShortNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor NullValue(short? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public ShortNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public ShortNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ShortNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clie /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ShortNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public ShortNumberPropertyDescriptor TimeSeriesDimension(bool? timeSe /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ShortNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct ShortNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("short"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShortNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShortNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - ShortNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class ShortNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal ShortNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public ShortNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private short? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public ShortNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public ShortNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public ShortNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public ShortNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public ShortNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public ShortNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public ShortNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public ShortNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public ShortNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public ShortNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public ShortNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public ShortNumberPropertyDescriptor NullValue(short? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor NullValue(short? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public ShortNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public ShortNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ShortNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ShortNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ShortNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public ShortNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elastic /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ShortNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public ShortNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimensi /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public ShortNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("short"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.ShortNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.ShortNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - ShortNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SizeField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SizeField.g.cs index 9255a8a5cbf..e967b01d7ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SizeField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SizeField.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class SizeFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Mapping.SizeField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SizeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SizeField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SizeFieldConverter))] public sealed partial class SizeField { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SizeField(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public SizeField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SizeField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SizeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } -public sealed partial class SizeFieldDescriptor : SerializableDescriptor +public readonly partial struct SizeFieldDescriptor { - internal SizeFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SizeField Instance { get; init; } - public SizeFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SizeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.SizeField instance) { + Instance = instance; } - private bool EnabledValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SizeFieldDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.SizeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SizeFieldDescriptor Enabled(bool enabled = true) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.SizeField instance) => new Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SizeField(Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor Enabled(bool value = true) { - EnabledValue = enabled; - return Self; + Instance.Enabled = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SizeField Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SizeField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SourceField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SourceField.g.cs index 9e6c2c0e626..dff20e7d5da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SourceField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SourceField.g.cs @@ -17,122 +17,200 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class SourceFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropCompressThreshold = System.Text.Json.JsonEncodedText.Encode("compress_threshold"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropExcludes = System.Text.Json.JsonEncodedText.Encode("excludes"); + private static readonly System.Text.Json.JsonEncodedText PropIncludes = System.Text.Json.JsonEncodedText.Encode("includes"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + + public override Elastic.Clients.Elasticsearch.Mapping.SourceField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompress = default; + LocalJsonValue propCompressThreshold = default; + LocalJsonValue propEnabled = default; + LocalJsonValue?> propExcludes = default; + LocalJsonValue?> propIncludes = default; + LocalJsonValue propMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propCompressThreshold.TryReadProperty(ref reader, options, PropCompressThreshold, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propExcludes.TryReadProperty(ref reader, options, PropExcludes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIncludes.TryReadProperty(ref reader, options, PropIncludes, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SourceField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Compress = propCompress.Value, + CompressThreshold = propCompressThreshold.Value, + Enabled = propEnabled.Value, + Excludes = propExcludes.Value, + Includes = propIncludes.Value, + Mode = propMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SourceField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropCompressThreshold, value.CompressThreshold, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropExcludes, value.Excludes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIncludes, value.Includes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SourceFieldConverter))] public sealed partial class SourceField { - [JsonInclude, JsonPropertyName("compress")] +#if NET7_0_OR_GREATER + public SourceField() + { + } +#endif +#if !NET7_0_OR_GREATER + public SourceField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SourceField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("compress_threshold")] public string? CompressThreshold { get; set; } - [JsonInclude, JsonPropertyName("enabled")] public bool? Enabled { get; set; } - [JsonInclude, JsonPropertyName("excludes")] - public ICollection? Excludes { get; set; } - [JsonInclude, JsonPropertyName("includes")] - public ICollection? Includes { get; set; } - [JsonInclude, JsonPropertyName("mode")] + public System.Collections.Generic.ICollection? Excludes { get; set; } + public System.Collections.Generic.ICollection? Includes { get; set; } public Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode? Mode { get; set; } } -public sealed partial class SourceFieldDescriptor : SerializableDescriptor +public readonly partial struct SourceFieldDescriptor { - internal SourceFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SourceField Instance { get; init; } - public SourceFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.SourceField instance) { + Instance = instance; } - private bool? CompressValue { get; set; } - private string? CompressThresholdValue { get; set; } - private bool? EnabledValue { get; set; } - private ICollection? ExcludesValue { get; set; } - private ICollection? IncludesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode? ModeValue { get; set; } - - public SourceFieldDescriptor Compress(bool? compress = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFieldDescriptor() { - CompressValue = compress; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.SourceField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SourceFieldDescriptor CompressThreshold(string? compressThreshold) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(Elastic.Clients.Elasticsearch.Mapping.SourceField instance) => new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SourceField(Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Compress(bool? value = true) { - CompressThresholdValue = compressThreshold; - return Self; + Instance.Compress = value; + return this; } - public SourceFieldDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor CompressThreshold(string? value) { - EnabledValue = enabled; - return Self; + Instance.CompressThreshold = value; + return this; } - public SourceFieldDescriptor Excludes(ICollection? excludes) + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Enabled(bool? value = true) { - ExcludesValue = excludes; - return Self; + Instance.Enabled = value; + return this; } - public SourceFieldDescriptor Includes(ICollection? includes) + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Excludes(System.Collections.Generic.ICollection? value) { - IncludesValue = includes; - return Self; + Instance.Excludes = value; + return this; } - public SourceFieldDescriptor Mode(Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode? mode) + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Excludes(params string[] values) { - ModeValue = mode; - return Self; + Instance.Excludes = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Includes(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } - - if (!string.IsNullOrEmpty(CompressThresholdValue)) - { - writer.WritePropertyName("compress_threshold"); - writer.WriteStringValue(CompressThresholdValue); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } + Instance.Includes = value; + return this; + } - if (ExcludesValue is not null) - { - writer.WritePropertyName("excludes"); - JsonSerializer.Serialize(writer, ExcludesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Includes(params string[] values) + { + Instance.Includes = [.. values]; + return this; + } - if (IncludesValue is not null) - { - writer.WritePropertyName("includes"); - JsonSerializer.Serialize(writer, IncludesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor Mode(Elastic.Clients.Elasticsearch.Mapping.SourceFieldMode? value) + { + Instance.Mode = value; + return this; + } - if (ModeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SourceField Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SourceField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SourceField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SparseVectorProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SparseVectorProperty.g.cs index cecbc772afe..de1cdc3a393 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SparseVectorProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SparseVectorProperty.g.cs @@ -17,23 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class SparseVectorProperty : IProperty +internal sealed partial class SparseVectorPropertyConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("dynamic")] + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyConverter))] +public sealed partial class SparseVectorProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty +{ +#if NET7_0_OR_GREATER + public SparseVectorProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public SparseVectorProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -41,62 +143,54 @@ public sealed partial class SparseVectorProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "sparse_vector"; } -public sealed partial class SparseVectorPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct SparseVectorPropertyDescriptor { - internal SparseVectorPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty Instance { get; init; } - public SparseVectorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public SparseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorPropertyDescriptor() { - DynamicValue = dynamic; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public SparseVectorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SparseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -104,138 +198,120 @@ public SparseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public SparseVectorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public SparseVectorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public SparseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("sparse_vector"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SparseVectorProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class SparseVectorPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct SparseVectorPropertyDescriptor { - internal SparseVectorPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty Instance { get; init; } - public SparseVectorPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public SparseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public SparseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SparseVectorPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public SparseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -243,89 +319,75 @@ public SparseVectorPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public SparseVectorPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public SparseVectorPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public SparseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Properties(System.Action action) { - writer.WriteStartObject(); - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor Properties(System.Action> action) + { + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("sparse_vector"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SparseVectorPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SparseVectorProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - SparseVectorProperty IBuildableDescriptor.Build() => new() - { - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SuggestContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SuggestContext.g.cs index b5734ee7257..99d72d72401 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SuggestContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/SuggestContext.g.cs @@ -17,168 +17,230 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class SuggestContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropPrecision = System.Text.Json.JsonEncodedText.Encode("precision"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.SuggestContext Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propPath = default; + LocalJsonValue?> propPrecision = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propPrecision.TryReadProperty(ref reader, options, PropPrecision, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Path = propPath.Value, + Precision = propPrecision.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.SuggestContext value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropPrecision, value.Precision, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.SuggestContextConverter))] public sealed partial class SuggestContext { - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } - [JsonInclude, JsonPropertyName("path")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestContext(Elastic.Clients.Elasticsearch.Name name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public SuggestContext() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SuggestContext() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } public Elastic.Clients.Elasticsearch.Field? Path { get; set; } - [JsonInclude, JsonPropertyName("precision")] - public object? Precision { get; set; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; set; } + public Elastic.Clients.Elasticsearch.Union? Precision { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } -public sealed partial class SuggestContextDescriptor : SerializableDescriptor> +public readonly partial struct SuggestContextDescriptor { - internal SuggestContextDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SuggestContext Instance { get; init; } - public SuggestContextDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private object? PrecisionValue { get; set; } - private string TypeValue { get; set; } - - public SuggestContextDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestContextDescriptor() { - NameValue = name; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SuggestContextDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) => new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - PathValue = path; - return Self; + Instance.Name = value; + return this; } - public SuggestContextDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public SuggestContextDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public SuggestContextDescriptor Precision(object? precision) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Precision(Elastic.Clients.Elasticsearch.Union? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } - public SuggestContextDescriptor Type(string type) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Type(string value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SuggestContext Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } - - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SuggestContextDescriptor : SerializableDescriptor +public readonly partial struct SuggestContextDescriptor { - internal SuggestContextDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.SuggestContext Instance { get; init; } - public SuggestContextDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private object? PrecisionValue { get; set; } - private string TypeValue { get; set; } - - public SuggestContextDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SuggestContextDescriptor() { - NameValue = name; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SuggestContextDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(Elastic.Clients.Elasticsearch.Mapping.SuggestContext instance) => new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - PathValue = path; - return Self; + Instance.Name = value; + return this; } - public SuggestContextDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public SuggestContextDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public SuggestContextDescriptor Precision(object? precision) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Precision(Elastic.Clients.Elasticsearch.Union? value) { - PrecisionValue = precision; - return Self; + Instance.Precision = value; + return this; } - public SuggestContextDescriptor Type(string type) + public Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor Type(string value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.SuggestContext Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } - - if (PrecisionValue is not null) - { - writer.WritePropertyName("precision"); - JsonSerializer.Serialize(writer, PrecisionValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.SuggestContextDescriptor(new Elastic.Clients.Elasticsearch.Mapping.SuggestContext(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextIndexPrefixes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextIndexPrefixes.g.cs index 5284b0a7a8d..814be0b047b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextIndexPrefixes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextIndexPrefixes.g.cs @@ -17,54 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class TextIndexPrefixesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxChars = System.Text.Json.JsonEncodedText.Encode("max_chars"); + private static readonly System.Text.Json.JsonEncodedText PropMinChars = System.Text.Json.JsonEncodedText.Encode("min_chars"); + + public override Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxChars = default; + LocalJsonValue propMinChars = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxChars.TryReadProperty(ref reader, options, PropMaxChars, null)) + { + continue; + } + + if (propMinChars.TryReadProperty(ref reader, options, PropMinChars, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxChars = propMaxChars.Value, + MinChars = propMinChars.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxChars, value.MaxChars, null, null); + writer.WriteProperty(options, PropMinChars, value.MinChars, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesConverter))] public sealed partial class TextIndexPrefixes { - [JsonInclude, JsonPropertyName("max_chars")] - public int MaxChars { get; set; } - [JsonInclude, JsonPropertyName("min_chars")] - public int MinChars { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextIndexPrefixes(int maxChars, int minChars) + { + MaxChars = maxChars; + MinChars = minChars; + } +#if NET7_0_OR_GREATER + public TextIndexPrefixes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextIndexPrefixes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextIndexPrefixes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int MaxChars { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MinChars { get; set; } } -public sealed partial class TextIndexPrefixesDescriptor : SerializableDescriptor +public readonly partial struct TextIndexPrefixesDescriptor { - internal TextIndexPrefixesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextIndexPrefixesDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes instance) + { + Instance = instance; + } - public TextIndexPrefixesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextIndexPrefixesDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private int MaxCharsValue { get; set; } - private int MinCharsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes instance) => new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor descriptor) => descriptor.Instance; - public TextIndexPrefixesDescriptor MaxChars(int maxChars) + public Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor MaxChars(int value) { - MaxCharsValue = maxChars; - return Self; + Instance.MaxChars = value; + return this; } - public TextIndexPrefixesDescriptor MinChars(int minChars) + public Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor MinChars(int value) { - MinCharsValue = minChars; - return Self; + Instance.MinChars = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes Build(System.Action? action) { - writer.WriteStartObject(); - writer.WritePropertyName("max_chars"); - writer.WriteNumberValue(MaxCharsValue); - writer.WritePropertyName("min_chars"); - writer.WriteNumberValue(MinCharsValue); - writer.WriteEndObject(); + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextProperty.g.cs index 59b1a3383c3..6eeca87fb60 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TextProperty.g.cs @@ -17,44 +17,288 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class TextProperty : IProperty +internal sealed partial class TextPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEagerGlobalOrdinals = System.Text.Json.JsonEncodedText.Encode("eager_global_ordinals"); + private static readonly System.Text.Json.JsonEncodedText PropFielddata = System.Text.Json.JsonEncodedText.Encode("fielddata"); + private static readonly System.Text.Json.JsonEncodedText PropFielddataFrequencyFilter = System.Text.Json.JsonEncodedText.Encode("fielddata_frequency_filter"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexOptions = System.Text.Json.JsonEncodedText.Encode("index_options"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPhrases = System.Text.Json.JsonEncodedText.Encode("index_phrases"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPrefixes = System.Text.Json.JsonEncodedText.Encode("index_prefixes"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNorms = System.Text.Json.JsonEncodedText.Encode("norms"); + private static readonly System.Text.Json.JsonEncodedText PropPositionIncrementGap = System.Text.Json.JsonEncodedText.Encode("position_increment_gap"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSearchQuoteAnalyzer = System.Text.Json.JsonEncodedText.Encode("search_quote_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropSimilarity = System.Text.Json.JsonEncodedText.Encode("similarity"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTermVector = System.Text.Json.JsonEncodedText.Encode("term_vector"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.TextProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEagerGlobalOrdinals = default; + LocalJsonValue propFielddata = default; + LocalJsonValue propFielddataFrequencyFilter = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue propIndexOptions = default; + LocalJsonValue propIndexPhrases = default; + LocalJsonValue propIndexPrefixes = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNorms = default; + LocalJsonValue propPositionIncrementGap = default; + LocalJsonValue propProperties = default; + LocalJsonValue propSearchAnalyzer = default; + LocalJsonValue propSearchQuoteAnalyzer = default; + LocalJsonValue propSimilarity = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTermVector = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEagerGlobalOrdinals.TryReadProperty(ref reader, options, PropEagerGlobalOrdinals, null)) + { + continue; + } + + if (propFielddata.TryReadProperty(ref reader, options, PropFielddata, null)) + { + continue; + } + + if (propFielddataFrequencyFilter.TryReadProperty(ref reader, options, PropFielddataFrequencyFilter, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexOptions.TryReadProperty(ref reader, options, PropIndexOptions, null)) + { + continue; + } + + if (propIndexPhrases.TryReadProperty(ref reader, options, PropIndexPhrases, null)) + { + continue; + } + + if (propIndexPrefixes.TryReadProperty(ref reader, options, PropIndexPrefixes, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNorms.TryReadProperty(ref reader, options, PropNorms, null)) + { + continue; + } + + if (propPositionIncrementGap.TryReadProperty(ref reader, options, PropPositionIncrementGap, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propSearchAnalyzer.TryReadProperty(ref reader, options, PropSearchAnalyzer, null)) + { + continue; + } + + if (propSearchQuoteAnalyzer.TryReadProperty(ref reader, options, PropSearchQuoteAnalyzer, null)) + { + continue; + } + + if (propSimilarity.TryReadProperty(ref reader, options, PropSimilarity, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTermVector.TryReadProperty(ref reader, options, PropTermVector, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + Dynamic = propDynamic.Value, + EagerGlobalOrdinals = propEagerGlobalOrdinals.Value, + Fielddata = propFielddata.Value, + FielddataFrequencyFilter = propFielddataFrequencyFilter.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + IndexOptions = propIndexOptions.Value, + IndexPhrases = propIndexPhrases.Value, + IndexPrefixes = propIndexPrefixes.Value, + Meta = propMeta.Value, + Norms = propNorms.Value, + PositionIncrementGap = propPositionIncrementGap.Value, + Properties = propProperties.Value, + SearchAnalyzer = propSearchAnalyzer.Value, + SearchQuoteAnalyzer = propSearchQuoteAnalyzer.Value, + Similarity = propSimilarity.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TermVector = propTermVector.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TextProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEagerGlobalOrdinals, value.EagerGlobalOrdinals, null, null); + writer.WriteProperty(options, PropFielddata, value.Fielddata, null, null); + writer.WriteProperty(options, PropFielddataFrequencyFilter, value.FielddataFrequencyFilter, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexOptions, value.IndexOptions, null, null); + writer.WriteProperty(options, PropIndexPhrases, value.IndexPhrases, null, null); + writer.WriteProperty(options, PropIndexPrefixes, value.IndexPrefixes, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNorms, value.Norms, null, null); + writer.WriteProperty(options, PropPositionIncrementGap, value.PositionIncrementGap, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropSearchAnalyzer, value.SearchAnalyzer, null, null); + writer.WriteProperty(options, PropSearchQuoteAnalyzer, value.SearchQuoteAnalyzer, null, null); + writer.WriteProperty(options, PropSimilarity, value.Similarity, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTermVector, value.TermVector, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TextPropertyConverter))] +public sealed partial class TextProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("analyzer")] +#if NET7_0_OR_GREATER + public TextProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public TextProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Analyzer { get; set; } - [JsonInclude, JsonPropertyName("boost")] public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("eager_global_ordinals")] public bool? EagerGlobalOrdinals { get; set; } - [JsonInclude, JsonPropertyName("fielddata")] public bool? Fielddata { get; set; } - [JsonInclude, JsonPropertyName("fielddata_frequency_filter")] public Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? FielddataFrequencyFilter { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } - [JsonInclude, JsonPropertyName("index_options")] public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; } - [JsonInclude, JsonPropertyName("index_phrases")] public bool? IndexPhrases { get; set; } - [JsonInclude, JsonPropertyName("index_prefixes")] public Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixes { get; set; } /// @@ -62,193 +306,145 @@ public sealed partial class TextProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("norms")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? Norms { get; set; } - [JsonInclude, JsonPropertyName("position_increment_gap")] public int? PositionIncrementGap { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("search_analyzer")] public string? SearchAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("search_quote_analyzer")] public string? SearchQuoteAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("term_vector")] public Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVector { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "text"; } -public sealed partial class TextPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct TextPropertyDescriptor { - internal TextPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TextProperty Instance { get; init; } - public TextPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextProperty instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private bool? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? FielddataFrequencyFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor FielddataFrequencyFilterDescriptor { get; set; } - private Action FielddataFrequencyFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private bool? IndexPhrasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor IndexPrefixesDescriptor { get; set; } - private Action IndexPrefixesDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private int? PositionIncrementGapValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } - - public TextPropertyDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextPropertyDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TextPropertyDescriptor Boost(double? boost) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Analyzer(string? value) { - BoostValue = boost; - return Self; + Instance.Analyzer = value; + return this; } - public TextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Boost(double? value) { - CopyToValue = copyTo; - return Self; + Instance.Boost = value; + return this; } - public TextPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public TextPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.CopyTo = value; + return this; } - public TextPropertyDescriptor Fielddata(bool? fielddata = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FielddataValue = fielddata; - return Self; + Instance.Dynamic = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? fielddataFrequencyFilter) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - FielddataFrequencyFilterDescriptor = null; - FielddataFrequencyFilterDescriptorAction = null; - FielddataFrequencyFilterValue = fielddataFrequencyFilter; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fielddata(bool? value = true) { - FielddataFrequencyFilterValue = null; - FielddataFrequencyFilterDescriptorAction = null; - FielddataFrequencyFilterDescriptor = descriptor; - return Self; + Instance.Fielddata = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? value) { - FielddataFrequencyFilterValue = null; - FielddataFrequencyFilterDescriptor = null; - FielddataFrequencyFilterDescriptorAction = configure; - return Self; + Instance.FielddataFrequencyFilter = value; + return this; } - public TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor FielddataFrequencyFilter(System.Action action) { - FieldsValue = fields; - return Self; + Instance.FielddataFrequencyFilter = Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public TextPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public TextPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public TextPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public TextPropertyDescriptor IndexPhrases(bool? indexPhrases = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPhrases(bool? value = true) { - IndexPhrasesValue = indexPhrases; - return Self; + Instance.IndexPhrases = value; + return this; } - public TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? indexPrefixes) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? value) { - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesValue = indexPrefixes; - return Self; + Instance.IndexPrefixes = value; + return this; } - public TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes() { - IndexPrefixesValue = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesDescriptor = descriptor; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(null); + return this; } - public TextPropertyDescriptor IndexPrefixes(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes(System.Action? action) { - IndexPrefixesValue = null; - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = configure; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(action); + return this; } /// @@ -256,484 +452,246 @@ public TextPropertyDescriptor IndexPrefixes(Action /// - public TextPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public TextPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public TextPropertyDescriptor PositionIncrementGap(int? positionIncrementGap) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta(System.Action? action) { - PositionIncrementGapValue = positionIncrementGap; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Norms(bool? value = true) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Norms = value; + return this; } - public TextPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor PositionIncrementGap(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositionIncrementGap = value; + return this; } - public TextPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = value; + return this; } - public TextPropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Properties(System.Action> action) { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SearchAnalyzer(string? value) { - SimilarityValue = similarity; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public TextPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SearchQuoteAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public TextPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Similarity(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Similarity = value; + return this; } - public TextPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Store(bool? value = true) { - TermVectorValue = termVector; - return Self; + Instance.Store = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FielddataValue.HasValue) - { - writer.WritePropertyName("fielddata"); - writer.WriteBooleanValue(FielddataValue.Value); - } - - if (FielddataFrequencyFilterDescriptor is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, FielddataFrequencyFilterDescriptor, options); - } - else if (FielddataFrequencyFilterDescriptorAction is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(FielddataFrequencyFilterDescriptorAction), options); - } - else if (FielddataFrequencyFilterValue is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, FielddataFrequencyFilterValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (IndexPhrasesValue.HasValue) - { - writer.WritePropertyName("index_phrases"); - writer.WriteBooleanValue(IndexPhrasesValue.Value); - } - - if (IndexPrefixesDescriptor is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesDescriptor, options); - } - else if (IndexPrefixesDescriptorAction is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction), options); - } - else if (IndexPrefixesValue is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (PositionIncrementGapValue.HasValue) - { - writer.WritePropertyName("position_increment_gap"); - writer.WriteNumberValue(PositionIncrementGapValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TermVectorValue is not null) - { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("text"); - writer.WriteEndObject(); + Instance.SyntheticSourceKeep = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? BuildFielddataFrequencyFilter() + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) { - if (FielddataFrequencyFilterValue is not null) - { - return FielddataFrequencyFilterValue; - } - - if ((object)FielddataFrequencyFilterDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (FielddataFrequencyFilterDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(FielddataFrequencyFilterDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + Instance.TermVector = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? BuildIndexPrefixes() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TextProperty Build(System.Action>? action) { - if (IndexPrefixesValue is not null) + if (action is null) { - return IndexPrefixesValue; + return new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if ((object)IndexPrefixesDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (IndexPrefixesDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - TextProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - CopyTo = CopyToValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fielddata = FielddataValue, - FielddataFrequencyFilter = BuildFielddataFrequencyFilter(), - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - IndexPhrases = IndexPhrasesValue, - IndexPrefixes = BuildIndexPrefixes(), - Meta = MetaValue, - Norms = NormsValue, - PositionIncrementGap = PositionIncrementGapValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Similarity = SimilarityValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } -public sealed partial class TextPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct TextPropertyDescriptor { - internal TextPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TextProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextProperty instance) + { + Instance = instance; + } - public TextPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EagerGlobalOrdinalsValue { get; set; } - private bool? FielddataValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? FielddataFrequencyFilterValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor FielddataFrequencyFilterDescriptor { get; set; } - private Action FielddataFrequencyFilterDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; } - private bool? IndexPhrasesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? IndexPrefixesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor IndexPrefixesDescriptor { get; set; } - private Action IndexPrefixesDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NormsValue { get; set; } - private int? PositionIncrementGapValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private string? SearchAnalyzerValue { get; set; } - private string? SearchQuoteAnalyzerValue { get; set; } - private string? SimilarityValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? TermVectorValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TextProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor descriptor) => descriptor.Instance; - public TextPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public TextPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public TextPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DynamicValue = dynamic; - return Self; + Instance.CopyTo = value; + return this; } - public TextPropertyDescriptor EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EagerGlobalOrdinalsValue = eagerGlobalOrdinals; - return Self; + Instance.Dynamic = value; + return this; } - public TextPropertyDescriptor Fielddata(bool? fielddata = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor EagerGlobalOrdinals(bool? value = true) { - FielddataValue = fielddata; - return Self; + Instance.EagerGlobalOrdinals = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? fielddataFrequencyFilter) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fielddata(bool? value = true) { - FielddataFrequencyFilterDescriptor = null; - FielddataFrequencyFilterDescriptorAction = null; - FielddataFrequencyFilterValue = fielddataFrequencyFilter; - return Self; + Instance.Fielddata = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor FielddataFrequencyFilter(Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? value) { - FielddataFrequencyFilterValue = null; - FielddataFrequencyFilterDescriptorAction = null; - FielddataFrequencyFilterDescriptor = descriptor; - return Self; + Instance.FielddataFrequencyFilter = value; + return this; } - public TextPropertyDescriptor FielddataFrequencyFilter(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor FielddataFrequencyFilter(System.Action action) { - FielddataFrequencyFilterValue = null; - FielddataFrequencyFilterDescriptor = null; - FielddataFrequencyFilterDescriptorAction = configure; - return Self; + Instance.FielddataFrequencyFilter = Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public TextPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public TextPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public TextPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? value) { - IndexOptionsValue = indexOptions; - return Self; + Instance.IndexOptions = value; + return this; } - public TextPropertyDescriptor IndexPhrases(bool? indexPhrases = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPhrases(bool? value = true) { - IndexPhrasesValue = indexPhrases; - return Self; + Instance.IndexPhrases = value; + return this; } - public TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? indexPrefixes) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? value) { - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesValue = indexPrefixes; - return Self; + Instance.IndexPrefixes = value; + return this; } - public TextPropertyDescriptor IndexPrefixes(Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes() { - IndexPrefixesValue = null; - IndexPrefixesDescriptorAction = null; - IndexPrefixesDescriptor = descriptor; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(null); + return this; } - public TextPropertyDescriptor IndexPrefixes(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor IndexPrefixes(System.Action? action) { - IndexPrefixesValue = null; - IndexPrefixesDescriptor = null; - IndexPrefixesDescriptorAction = configure; - return Self; + Instance.IndexPrefixes = Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor.Build(action); + return this; } /// @@ -741,318 +699,117 @@ public TextPropertyDescriptor IndexPrefixes(Action /// - public TextPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public TextPropertyDescriptor Norms(bool? norms = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta() { - NormsValue = norms; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public TextPropertyDescriptor PositionIncrementGap(int? positionIncrementGap) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Meta(System.Action? action) { - PositionIncrementGapValue = positionIncrementGap; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = properties; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Norms(bool? value = true) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Norms = value; + return this; } - public TextPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor PositionIncrementGap(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.PositionIncrementGap = value; + return this; } - public TextPropertyDescriptor SearchAnalyzer(string? searchAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SearchAnalyzerValue = searchAnalyzer; - return Self; + Instance.Properties = value; + return this; } - public TextPropertyDescriptor SearchQuoteAnalyzer(string? searchQuoteAnalyzer) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Properties(System.Action action) { - SearchQuoteAnalyzerValue = searchQuoteAnalyzer; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Similarity(string? similarity) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Properties(System.Action> action) { - SimilarityValue = similarity; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TextPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SearchAnalyzer(string? value) { - StoreValue = store; - return Self; + Instance.SearchAnalyzer = value; + return this; } - public TextPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SearchQuoteAnalyzer(string? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SearchQuoteAnalyzer = value; + return this; } - public TextPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? termVector) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Similarity(string? value) { - TermVectorValue = termVector; - return Self; + Instance.Similarity = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EagerGlobalOrdinalsValue.HasValue) - { - writer.WritePropertyName("eager_global_ordinals"); - writer.WriteBooleanValue(EagerGlobalOrdinalsValue.Value); - } - - if (FielddataValue.HasValue) - { - writer.WritePropertyName("fielddata"); - writer.WriteBooleanValue(FielddataValue.Value); - } - - if (FielddataFrequencyFilterDescriptor is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, FielddataFrequencyFilterDescriptor, options); - } - else if (FielddataFrequencyFilterDescriptorAction is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(FielddataFrequencyFilterDescriptorAction), options); - } - else if (FielddataFrequencyFilterValue is not null) - { - writer.WritePropertyName("fielddata_frequency_filter"); - JsonSerializer.Serialize(writer, FielddataFrequencyFilterValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (IndexOptionsValue is not null) - { - writer.WritePropertyName("index_options"); - JsonSerializer.Serialize(writer, IndexOptionsValue, options); - } - - if (IndexPhrasesValue.HasValue) - { - writer.WritePropertyName("index_phrases"); - writer.WriteBooleanValue(IndexPhrasesValue.Value); - } - - if (IndexPrefixesDescriptor is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesDescriptor, options); - } - else if (IndexPrefixesDescriptorAction is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction), options); - } - else if (IndexPrefixesValue is not null) - { - writer.WritePropertyName("index_prefixes"); - JsonSerializer.Serialize(writer, IndexPrefixesValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NormsValue.HasValue) - { - writer.WritePropertyName("norms"); - writer.WriteBooleanValue(NormsValue.Value); - } - - if (PositionIncrementGapValue.HasValue) - { - writer.WritePropertyName("position_increment_gap"); - writer.WriteNumberValue(PositionIncrementGapValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (!string.IsNullOrEmpty(SearchAnalyzerValue)) - { - writer.WritePropertyName("search_analyzer"); - writer.WriteStringValue(SearchAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SearchQuoteAnalyzerValue)) - { - writer.WritePropertyName("search_quote_analyzer"); - writer.WriteStringValue(SearchQuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(SimilarityValue)) - { - writer.WritePropertyName("similarity"); - writer.WriteStringValue(SimilarityValue); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TermVectorValue is not null) - { - writer.WritePropertyName("term_vector"); - JsonSerializer.Serialize(writer, TermVectorValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("text"); - writer.WriteEndObject(); + Instance.Store = value; + return this; } - private Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilter? BuildFielddataFrequencyFilter() + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - if (FielddataFrequencyFilterValue is not null) - { - return FielddataFrequencyFilterValue; - } - - if ((object)FielddataFrequencyFilterDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (FielddataFrequencyFilterDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.IndexManagement.FielddataFrequencyFilterDescriptor(FielddataFrequencyFilterDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + Instance.SyntheticSourceKeep = value; + return this; } - private Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixes? BuildIndexPrefixes() + public Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor TermVector(Elastic.Clients.Elasticsearch.Mapping.TermVectorOption? value) { - if (IndexPrefixesValue is not null) - { - return IndexPrefixesValue; - } - - if ((object)IndexPrefixesDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + Instance.TermVector = value; + return this; + } - if (IndexPrefixesDescriptorAction is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TextProperty Build(System.Action? action) + { + if (action is null) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.TextIndexPrefixesDescriptor(IndexPrefixesDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } + return new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - return null; - } - - TextProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - CopyTo = CopyToValue, - Dynamic = DynamicValue, - EagerGlobalOrdinals = EagerGlobalOrdinalsValue, - Fielddata = FielddataValue, - FielddataFrequencyFilter = BuildFielddataFrequencyFilter(), - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - IndexOptions = IndexOptionsValue, - IndexPhrases = IndexPhrasesValue, - IndexPrefixes = BuildIndexPrefixes(), - Meta = MetaValue, - Norms = NormsValue, - PositionIncrementGap = PositionIncrementGapValue, - Properties = PropertiesValue, - SearchAnalyzer = SearchAnalyzerValue, - SearchQuoteAnalyzer = SearchQuoteAnalyzerValue, - Similarity = SimilarityValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TermVector = TermVectorValue - }; + var builder = new Elastic.Clients.Elasticsearch.Mapping.TextPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TextProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TokenCountProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TokenCountProperty.g.cs index a0e6f6a9248..114ed3d8f93 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TokenCountProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TokenCountProperty.g.cs @@ -17,36 +17,203 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class TokenCountProperty : IProperty +internal sealed partial class TokenCountPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropEnablePositionIncrements = System.Text.Json.JsonEncodedText.Encode("enable_position_increments"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propEnablePositionIncrements = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propEnablePositionIncrements.TryReadProperty(ref reader, options, PropEnablePositionIncrements, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + EnablePositionIncrements = propEnablePositionIncrements.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropEnablePositionIncrements, value.EnablePositionIncrements, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyConverter))] +public sealed partial class TokenCountProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("analyzer")] +#if NET7_0_OR_GREATER + public TokenCountProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public TokenCountProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public string? Analyzer { get; set; } - [JsonInclude, JsonPropertyName("boost")] public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("enable_position_increments")] public bool? EnablePositionIncrements { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,110 +221,98 @@ public sealed partial class TokenCountProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public double? NullValue { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "token_count"; } -public sealed partial class TokenCountPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct TokenCountPropertyDescriptor { - internal TokenCountPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenCountPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty instance) + { + Instance = instance; + } - public TokenCountPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenCountPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnablePositionIncrementsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor descriptor) => descriptor.Instance; - public TokenCountPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } - public TokenCountPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Boost(double? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TokenCountPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public TokenCountPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public TokenCountPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public TokenCountPropertyDescriptor EnablePositionIncrements(bool? enablePositionIncrements = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - EnablePositionIncrementsValue = enablePositionIncrements; - return Self; + Instance.Dynamic = value; + return this; } - public TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor EnablePositionIncrements(bool? value = true) { - FieldsValue = fields; - return Self; + Instance.EnablePositionIncrements = value; + return this; } - public TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public TokenCountPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TokenCountPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public TokenCountPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -165,250 +320,174 @@ public TokenCountPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public TokenCountPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public TokenCountPropertyDescriptor NullValue(double? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TokenCountPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor NullValue(double? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public TokenCountPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public TokenCountPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnablePositionIncrementsValue.HasValue) - { - writer.WritePropertyName("enable_position_increments"); - writer.WriteBooleanValue(EnablePositionIncrementsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("token_count"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - TokenCountProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EnablePositionIncrements = EnablePositionIncrementsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } -public sealed partial class TokenCountPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct TokenCountPropertyDescriptor { - internal TokenCountPropertyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenCountPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty instance) + { + Instance = instance; + } - public TokenCountPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenCountPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private double? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private bool? EnablePositionIncrementsValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private double? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } - public TokenCountPropertyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Boost(double? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Boost = value; + return this; } - public TokenCountPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public TokenCountPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public TokenCountPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public TokenCountPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public TokenCountPropertyDescriptor EnablePositionIncrements(bool? enablePositionIncrements = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor EnablePositionIncrements(bool? value = true) { - EnablePositionIncrementsValue = enablePositionIncrements; - return Self; + Instance.EnablePositionIncrements = value; + return this; } - public TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public TokenCountPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TokenCountPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TokenCountPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } - public TokenCountPropertyDescriptor Index(bool? index = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Index(bool? value = true) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -416,157 +495,87 @@ public TokenCountPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public TokenCountPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public TokenCountPropertyDescriptor NullValue(double? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TokenCountPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor NullValue(double? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public TokenCountPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public TokenCountPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (EnablePositionIncrementsValue.HasValue) - { - writer.WritePropertyName("enable_position_increments"); - writer.WriteBooleanValue(EnablePositionIncrementsValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("token_count"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.TokenCountPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TokenCountProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - TokenCountProperty IBuildableDescriptor.Build() => new() - { - Analyzer = AnalyzerValue, - Boost = BoostValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - EnablePositionIncrements = EnablePositionIncrementsValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TypeMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TypeMapping.g.cs index ced1bb98c0a..e01dcebd005 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TypeMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/TypeMapping.g.cs @@ -17,972 +17,793 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +internal sealed partial class TypeMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllField = System.Text.Json.JsonEncodedText.Encode("all_field"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreamTimestamp = System.Text.Json.JsonEncodedText.Encode("_data_stream_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropDateDetection = System.Text.Json.JsonEncodedText.Encode("date_detection"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicDateFormats = System.Text.Json.JsonEncodedText.Encode("dynamic_date_formats"); + private static readonly System.Text.Json.JsonEncodedText PropDynamicTemplates = System.Text.Json.JsonEncodedText.Encode("dynamic_templates"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFieldNames = System.Text.Json.JsonEncodedText.Encode("_field_names"); + private static readonly System.Text.Json.JsonEncodedText PropIndexField = System.Text.Json.JsonEncodedText.Encode("index_field"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropNumericDetection = System.Text.Json.JsonEncodedText.Encode("numeric_detection"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("_routing"); + private static readonly System.Text.Json.JsonEncodedText PropRuntime = System.Text.Json.JsonEncodedText.Encode("runtime"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("_size"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropSubobjects = System.Text.Json.JsonEncodedText.Encode("subobjects"); + + public override Elastic.Clients.Elasticsearch.Mapping.TypeMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllField = default; + LocalJsonValue propDataStreamTimestamp = default; + LocalJsonValue propDateDetection = default; + LocalJsonValue propDynamic = default; + LocalJsonValue?> propDynamicDateFormats = default; + LocalJsonValue>?> propDynamicTemplates = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFieldNames = default; + LocalJsonValue propIndexField = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNumericDetection = default; + LocalJsonValue propProperties = default; + LocalJsonValue propRouting = default; + LocalJsonValue?> propRuntime = default; + LocalJsonValue propSize = default; + LocalJsonValue propSource = default; + LocalJsonValue propSubobjects = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllField.TryReadProperty(ref reader, options, PropAllField, null)) + { + continue; + } + + if (propDataStreamTimestamp.TryReadProperty(ref reader, options, PropDataStreamTimestamp, null)) + { + continue; + } + + if (propDateDetection.TryReadProperty(ref reader, options, PropDateDetection, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propDynamicDateFormats.TryReadProperty(ref reader, options, PropDynamicDateFormats, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDynamicTemplates.TryReadProperty(ref reader, options, PropDynamicTemplates, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)))) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFieldNames.TryReadProperty(ref reader, options, PropFieldNames, null)) + { + continue; + } + + if (propIndexField.TryReadProperty(ref reader, options, PropIndexField, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNumericDetection.TryReadProperty(ref reader, options, PropNumericDetection, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propRuntime.TryReadProperty(ref reader, options, PropRuntime, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSubobjects.TryReadProperty(ref reader, options, PropSubobjects, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllField = propAllField.Value, + DataStreamTimestamp = propDataStreamTimestamp.Value, + DateDetection = propDateDetection.Value, + Dynamic = propDynamic.Value, + DynamicDateFormats = propDynamicDateFormats.Value, + DynamicTemplates = propDynamicTemplates.Value, + Enabled = propEnabled.Value, + FieldNames = propFieldNames.Value, + IndexField = propIndexField.Value, + Meta = propMeta.Value, + NumericDetection = propNumericDetection.Value, + Properties = propProperties.Value, + Routing = propRouting.Value, + Runtime = propRuntime.Value, + Size = propSize.Value, + Source = propSource.Value, + Subobjects = propSubobjects.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.TypeMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllField, value.AllField, null, null); + writer.WriteProperty(options, PropDataStreamTimestamp, value.DataStreamTimestamp, null, null); + writer.WriteProperty(options, PropDateDetection, value.DateDetection, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropDynamicDateFormats, value.DynamicDateFormats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDynamicTemplates, value.DynamicTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null))); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFieldNames, value.FieldNames, null, null); + writer.WriteProperty(options, PropIndexField, value.IndexField, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNumericDetection, value.NumericDetection, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropRuntime, value.Runtime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSubobjects, value.Subobjects, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.TypeMappingConverter))] public sealed partial class TypeMapping { - [JsonInclude, JsonPropertyName("all_field")] +#if NET7_0_OR_GREATER + public TypeMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + public TypeMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Mapping.AllField? AllField { get; set; } - [JsonInclude, JsonPropertyName("_data_stream_timestamp")] public Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? DataStreamTimestamp { get; set; } - [JsonInclude, JsonPropertyName("date_detection")] public bool? DateDetection { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("dynamic_date_formats")] - public ICollection? DynamicDateFormats { get; set; } - [JsonInclude, JsonPropertyName("dynamic_templates")] - public ICollection>? DynamicTemplates { get; set; } - [JsonInclude, JsonPropertyName("enabled")] + public System.Collections.Generic.ICollection? DynamicDateFormats { get; set; } + public System.Collections.Generic.ICollection>? DynamicTemplates { get; set; } public bool? Enabled { get; set; } - [JsonInclude, JsonPropertyName("_field_names")] public Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNames { get; set; } - [JsonInclude, JsonPropertyName("index_field")] public Elastic.Clients.Elasticsearch.Mapping.IndexField? IndexField { get; set; } - [JsonInclude, JsonPropertyName("_meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("numeric_detection")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public bool? NumericDetection { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("_routing")] public Elastic.Clients.Elasticsearch.Mapping.RoutingField? Routing { get; set; } - [JsonInclude, JsonPropertyName("runtime")] - public IDictionary? Runtime { get; set; } - [JsonInclude, JsonPropertyName("_size")] + public System.Collections.Generic.IDictionary? Runtime { get; set; } public Elastic.Clients.Elasticsearch.Mapping.SizeField? Size { get; set; } - [JsonInclude, JsonPropertyName("_source")] public Elastic.Clients.Elasticsearch.Mapping.SourceField? Source { get; set; } - [JsonInclude, JsonPropertyName("subobjects")] - public bool? Subobjects { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.Subobjects? Subobjects { get; set; } } -public sealed partial class TypeMappingDescriptor : SerializableDescriptor> +public readonly partial struct TypeMappingDescriptor { - internal TypeMappingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TypeMapping Instance { get; init; } - public TypeMappingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeMappingDescriptor(Elastic.Clients.Elasticsearch.Mapping.TypeMapping instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.AllField? AllFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor AllFieldDescriptor { get; set; } - private Action AllFieldDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? DataStreamTimestampValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor DataStreamTimestampDescriptor { get; set; } - private Action DataStreamTimestampDescriptorAction { get; set; } - private bool? DateDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private ICollection? DynamicDateFormatsValue { get; set; } - private ICollection>? DynamicTemplatesValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNamesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor FieldNamesDescriptor { get; set; } - private Action FieldNamesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexField? IndexFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor IndexFieldDescriptor { get; set; } - private Action IndexFieldDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NumericDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingField? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private IDictionary> RuntimeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SizeField? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor SizeDescriptor { get; set; } - private Action SizeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceField? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private bool? SubobjectsValue { get; set; } - - public TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllField? allField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeMappingDescriptor() { - AllFieldDescriptor = null; - AllFieldDescriptorAction = null; - AllFieldValue = allField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(Elastic.Clients.Elasticsearch.Mapping.TypeMapping instance) => new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllField? value) { - AllFieldValue = null; - AllFieldDescriptorAction = null; - AllFieldDescriptor = descriptor; - return Self; + Instance.AllField = value; + return this; } - public TypeMappingDescriptor AllField(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AllField(System.Action action) { - AllFieldValue = null; - AllFieldDescriptor = null; - AllFieldDescriptorAction = configure; - return Self; + Instance.AllField = Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? dataStreamTimestamp) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? value) { - DataStreamTimestampDescriptor = null; - DataStreamTimestampDescriptorAction = null; - DataStreamTimestampValue = dataStreamTimestamp; - return Self; + Instance.DataStreamTimestamp = value; + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DataStreamTimestamp(System.Action action) { - DataStreamTimestampValue = null; - DataStreamTimestampDescriptorAction = null; - DataStreamTimestampDescriptor = descriptor; - return Self; + Instance.DataStreamTimestamp = Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor.Build(action); + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DateDetection(bool? value = true) { - DataStreamTimestampValue = null; - DataStreamTimestampDescriptor = null; - DataStreamTimestampDescriptorAction = configure; - return Self; + Instance.DateDetection = value; + return this; } - public TypeMappingDescriptor DateDetection(bool? dateDetection = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DateDetectionValue = dateDetection; - return Self; + Instance.Dynamic = value; + return this; } - public TypeMappingDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicDateFormats(System.Collections.Generic.ICollection? value) { - DynamicValue = dynamic; - return Self; + Instance.DynamicDateFormats = value; + return this; } - public TypeMappingDescriptor DynamicDateFormats(ICollection? dynamicDateFormats) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicDateFormats(params string[] values) { - DynamicDateFormatsValue = dynamicDateFormats; - return Self; + Instance.DynamicDateFormats = [.. values]; + return this; } - public TypeMappingDescriptor DynamicTemplates(ICollection>? dynamicTemplates) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates(System.Collections.Generic.ICollection>? value) { - DynamicTemplatesValue = dynamicTemplates; - return Self; + Instance.DynamicTemplates = value; + return this; } - public TypeMappingDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates() { - EnabledValue = enabled; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(null); + return this; } - public TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? fieldNames) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates(System.Action>? action) { - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = null; - FieldNamesValue = fieldNames; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; } - public TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddDynamicTemplate(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) { - FieldNamesValue = null; - FieldNamesDescriptorAction = null; - FieldNamesDescriptor = descriptor; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public TypeMappingDescriptor FieldNames(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddDynamicTemplate(string key, System.Action> action) { - FieldNamesValue = null; - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = configure; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; } - public TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexField? indexField) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Enabled(bool? value = true) { - IndexFieldDescriptor = null; - IndexFieldDescriptorAction = null; - IndexFieldValue = indexField; - return Self; + Instance.Enabled = value; + return this; } - public TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? value) { - IndexFieldValue = null; - IndexFieldDescriptorAction = null; - IndexFieldDescriptor = descriptor; - return Self; + Instance.FieldNames = value; + return this; } - public TypeMappingDescriptor IndexField(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor FieldNames(System.Action action) { - IndexFieldValue = null; - IndexFieldDescriptor = null; - IndexFieldDescriptorAction = configure; - return Self; + Instance.FieldNames = Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexField? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.IndexField = value; + return this; } - public TypeMappingDescriptor NumericDetection(bool? numericDetection = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor IndexField(System.Action action) { - NumericDetectionValue = numericDetection; - return Self; + Instance.IndexField = Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta(System.Collections.Generic.IDictionary? value) { - PropertiesValue = properties; - return Self; + Instance.Meta = value; + return this; } - public TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta() { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public TypeMappingDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta(System.Action? action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? routing) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddMeta(string key, object value) { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor NumericDetection(bool? value = true) { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.NumericDetection = value; + return this; } - public TypeMappingDescriptor Routing(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.Properties = value; + return this; } - public TypeMappingDescriptor Runtime(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Properties(System.Action> action) { - RuntimeValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeField? size) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? value) { - SizeDescriptor = null; - SizeDescriptorAction = null; - SizeValue = size; - return Self; + Instance.Routing = value; + return this; } - public TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Routing(System.Action action) { - SizeValue = null; - SizeDescriptorAction = null; - SizeDescriptor = descriptor; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Size(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime(System.Collections.Generic.IDictionary? value) { - SizeValue = null; - SizeDescriptor = null; - SizeDescriptorAction = configure; - return Self; + Instance.Runtime = value; + return this; } - public TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? source) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime() { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField.Build(null); + return this; } - public TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime(System.Action>? action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField.Build(action); + return this; } - public TypeMappingDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddRuntime(string key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; } - public TypeMappingDescriptor Subobjects(bool? subobjects = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddRuntime(string key, System.Action> action) { - SubobjectsValue = subobjects; - return Self; + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeField? value) { - writer.WriteStartObject(); - if (AllFieldDescriptor is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, AllFieldDescriptor, options); - } - else if (AllFieldDescriptorAction is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor(AllFieldDescriptorAction), options); - } - else if (AllFieldValue is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, AllFieldValue, options); - } - - if (DataStreamTimestampDescriptor is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, DataStreamTimestampDescriptor, options); - } - else if (DataStreamTimestampDescriptorAction is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor(DataStreamTimestampDescriptorAction), options); - } - else if (DataStreamTimestampValue is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, DataStreamTimestampValue, options); - } - - if (DateDetectionValue.HasValue) - { - writer.WritePropertyName("date_detection"); - writer.WriteBooleanValue(DateDetectionValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (DynamicDateFormatsValue is not null) - { - writer.WritePropertyName("dynamic_date_formats"); - JsonSerializer.Serialize(writer, DynamicDateFormatsValue, options); - } - - if (DynamicTemplatesValue is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, DynamicTemplatesValue, options); - } - - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } - - if (FieldNamesDescriptor is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesDescriptor, options); - } - else if (FieldNamesDescriptorAction is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(FieldNamesDescriptorAction), options); - } - else if (FieldNamesValue is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesValue, options); - } - - if (IndexFieldDescriptor is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, IndexFieldDescriptor, options); - } - else if (IndexFieldDescriptorAction is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor(IndexFieldDescriptorAction), options); - } - else if (IndexFieldValue is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, IndexFieldValue, options); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NumericDetectionValue.HasValue) - { - writer.WritePropertyName("numeric_detection"); - writer.WriteBooleanValue(NumericDetectionValue.Value); - } + Instance.Size = value; + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Size(System.Action action) + { + Instance.Size = Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor.Build(action); + return this; + } - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? value) + { + Instance.Source = value; + return this; + } - if (RuntimeValue is not null) - { - writer.WritePropertyName("runtime"); - JsonSerializer.Serialize(writer, RuntimeValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source() + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(null); + return this; + } - if (SizeDescriptor is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, SizeDescriptor, options); - } - else if (SizeDescriptorAction is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor(SizeDescriptorAction), options); - } - else if (SizeValue is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, SizeValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source(System.Action? action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(action); + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Subobjects(Elastic.Clients.Elasticsearch.Mapping.Subobjects? value) + { + Instance.Subobjects = value; + return this; + } - if (SubobjectsValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TypeMapping Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("subobjects"); - writer.WriteBooleanValue(SubobjectsValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TypeMappingDescriptor : SerializableDescriptor +public readonly partial struct TypeMappingDescriptor { - internal TypeMappingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.TypeMapping Instance { get; init; } - public TypeMappingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeMappingDescriptor(Elastic.Clients.Elasticsearch.Mapping.TypeMapping instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Mapping.AllField? AllFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor AllFieldDescriptor { get; set; } - private Action AllFieldDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? DataStreamTimestampValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor DataStreamTimestampDescriptor { get; set; } - private Action DataStreamTimestampDescriptorAction { get; set; } - private bool? DateDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private ICollection? DynamicDateFormatsValue { get; set; } - private ICollection>? DynamicTemplatesValue { get; set; } - private bool? EnabledValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? FieldNamesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor FieldNamesDescriptor { get; set; } - private Action FieldNamesDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexField? IndexFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor IndexFieldDescriptor { get; set; } - private Action IndexFieldDescriptorAction { get; set; } - private IDictionary? MetaValue { get; set; } - private bool? NumericDetectionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingField? RoutingValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor RoutingDescriptor { get; set; } - private Action RoutingDescriptorAction { get; set; } - private IDictionary RuntimeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SizeField? SizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor SizeDescriptor { get; set; } - private Action SizeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceField? SourceValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor SourceDescriptor { get; set; } - private Action SourceDescriptorAction { get; set; } - private bool? SubobjectsValue { get; set; } - - public TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllField? allField) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeMappingDescriptor() { - AllFieldDescriptor = null; - AllFieldDescriptorAction = null; - AllFieldValue = allField; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(Elastic.Clients.Elasticsearch.Mapping.TypeMapping instance) => new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AllField(Elastic.Clients.Elasticsearch.Mapping.AllField? value) { - AllFieldValue = null; - AllFieldDescriptorAction = null; - AllFieldDescriptor = descriptor; - return Self; + Instance.AllField = value; + return this; } - public TypeMappingDescriptor AllField(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AllField(System.Action action) { - AllFieldValue = null; - AllFieldDescriptor = null; - AllFieldDescriptorAction = configure; - return Self; + Instance.AllField = Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? dataStreamTimestamp) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestamp? value) { - DataStreamTimestampDescriptor = null; - DataStreamTimestampDescriptorAction = null; - DataStreamTimestampValue = dataStreamTimestamp; - return Self; + Instance.DataStreamTimestamp = value; + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DataStreamTimestamp(System.Action action) { - DataStreamTimestampValue = null; - DataStreamTimestampDescriptorAction = null; - DataStreamTimestampDescriptor = descriptor; - return Self; + Instance.DataStreamTimestamp = Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor.Build(action); + return this; } - public TypeMappingDescriptor DataStreamTimestamp(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DateDetection(bool? value = true) { - DataStreamTimestampValue = null; - DataStreamTimestampDescriptor = null; - DataStreamTimestampDescriptorAction = configure; - return Self; + Instance.DateDetection = value; + return this; } - public TypeMappingDescriptor DateDetection(bool? dateDetection = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DateDetectionValue = dateDetection; - return Self; + Instance.Dynamic = value; + return this; } - public TypeMappingDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicDateFormats(System.Collections.Generic.ICollection? value) { - DynamicValue = dynamic; - return Self; + Instance.DynamicDateFormats = value; + return this; } - public TypeMappingDescriptor DynamicDateFormats(ICollection? dynamicDateFormats) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicDateFormats(params string[] values) { - DynamicDateFormatsValue = dynamicDateFormats; - return Self; + Instance.DynamicDateFormats = [.. values]; + return this; } - public TypeMappingDescriptor DynamicTemplates(ICollection>? dynamicTemplates) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates(System.Collections.Generic.ICollection>? value) { - DynamicTemplatesValue = dynamicTemplates; - return Self; + Instance.DynamicTemplates = value; + return this; } - public TypeMappingDescriptor Enabled(bool? enabled = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates() { - EnabledValue = enabled; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(null); + return this; } - public TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? fieldNames) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates(System.Action? action) { - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = null; - FieldNamesValue = fieldNames; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; } - public TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor DynamicTemplates(System.Action>? action) { - FieldNamesValue = null; - FieldNamesDescriptorAction = null; - FieldNamesDescriptor = descriptor; - return Self; + Instance.DynamicTemplates = Elastic.Clients.Elasticsearch.Fluent.FluentCollectionOfKeyValuePairOfStringDynamicTemplate.Build(action); + return this; } - public TypeMappingDescriptor FieldNames(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddDynamicTemplate(string key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate value) { - FieldNamesValue = null; - FieldNamesDescriptor = null; - FieldNamesDescriptorAction = configure; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, value)); + return this; } - public TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexField? indexField) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddDynamicTemplate(string key, System.Action action) { - IndexFieldDescriptor = null; - IndexFieldDescriptorAction = null; - IndexFieldValue = indexField; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; } - public TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddDynamicTemplate(string key, System.Action> action) { - IndexFieldValue = null; - IndexFieldDescriptorAction = null; - IndexFieldDescriptor = descriptor; - return Self; + Instance.DynamicTemplates ??= new System.Collections.Generic.List>(); + Instance.DynamicTemplates.Add(new System.Collections.Generic.KeyValuePair(key, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplateDescriptor.Build(action))); + return this; } - public TypeMappingDescriptor IndexField(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Enabled(bool? value = true) { - IndexFieldValue = null; - IndexFieldDescriptor = null; - IndexFieldDescriptorAction = configure; - return Self; + Instance.Enabled = value; + return this; } - public TypeMappingDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor FieldNames(Elastic.Clients.Elasticsearch.Mapping.FieldNamesField? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.FieldNames = value; + return this; } - public TypeMappingDescriptor NumericDetection(bool? numericDetection = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor FieldNames(System.Action action) { - NumericDetectionValue = numericDetection; - return Self; + Instance.FieldNames = Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor IndexField(Elastic.Clients.Elasticsearch.Mapping.IndexField? value) { - PropertiesValue = properties; - return Self; + Instance.IndexField = value; + return this; } - public TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor IndexField(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.IndexField = Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta(System.Collections.Generic.IDictionary? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = value; + return this; } - public TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? routing) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta() { - RoutingDescriptor = null; - RoutingDescriptorAction = null; - RoutingValue = routing; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Meta(System.Action? action) { - RoutingValue = null; - RoutingDescriptorAction = null; - RoutingDescriptor = descriptor; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; } - public TypeMappingDescriptor Routing(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddMeta(string key, object value) { - RoutingValue = null; - RoutingDescriptor = null; - RoutingDescriptorAction = configure; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public TypeMappingDescriptor Runtime(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor NumericDetection(bool? value = true) { - RuntimeValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.NumericDetection = value; + return this; } - public TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeField? size) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - SizeDescriptor = null; - SizeDescriptorAction = null; - SizeValue = size; - return Self; + Instance.Properties = value; + return this; } - public TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Properties(System.Action action) { - SizeValue = null; - SizeDescriptorAction = null; - SizeDescriptor = descriptor; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Size(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Properties(System.Action> action) { - SizeValue = null; - SizeDescriptor = null; - SizeDescriptorAction = configure; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? source) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Routing(Elastic.Clients.Elasticsearch.Mapping.RoutingField? value) { - SourceDescriptor = null; - SourceDescriptorAction = null; - SourceValue = source; - return Self; + Instance.Routing = value; + return this; } - public TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Routing(System.Action action) { - SourceValue = null; - SourceDescriptorAction = null; - SourceDescriptor = descriptor; - return Self; + Instance.Routing = Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor.Build(action); + return this; } - public TypeMappingDescriptor Source(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime(System.Collections.Generic.IDictionary? value) { - SourceValue = null; - SourceDescriptor = null; - SourceDescriptorAction = configure; - return Self; + Instance.Runtime = value; + return this; } - public TypeMappingDescriptor Subobjects(bool? subobjects = true) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime() { - SubobjectsValue = subobjects; - return Self; + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime(System.Action? action) { - writer.WriteStartObject(); - if (AllFieldDescriptor is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, AllFieldDescriptor, options); - } - else if (AllFieldDescriptorAction is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.AllFieldDescriptor(AllFieldDescriptorAction), options); - } - else if (AllFieldValue is not null) - { - writer.WritePropertyName("all_field"); - JsonSerializer.Serialize(writer, AllFieldValue, options); - } - - if (DataStreamTimestampDescriptor is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, DataStreamTimestampDescriptor, options); - } - else if (DataStreamTimestampDescriptorAction is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.DataStreamTimestampDescriptor(DataStreamTimestampDescriptorAction), options); - } - else if (DataStreamTimestampValue is not null) - { - writer.WritePropertyName("_data_stream_timestamp"); - JsonSerializer.Serialize(writer, DataStreamTimestampValue, options); - } - - if (DateDetectionValue.HasValue) - { - writer.WritePropertyName("date_detection"); - writer.WriteBooleanValue(DateDetectionValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (DynamicDateFormatsValue is not null) - { - writer.WritePropertyName("dynamic_date_formats"); - JsonSerializer.Serialize(writer, DynamicDateFormatsValue, options); - } - - if (DynamicTemplatesValue is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, DynamicTemplatesValue, options); - } + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField.Build(action); + return this; + } - if (EnabledValue.HasValue) - { - writer.WritePropertyName("enabled"); - writer.WriteBooleanValue(EnabledValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Runtime(System.Action>? action) + { + Instance.Runtime = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRuntimeField.Build(action); + return this; + } - if (FieldNamesDescriptor is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesDescriptor, options); - } - else if (FieldNamesDescriptorAction is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.FieldNamesFieldDescriptor(FieldNamesDescriptorAction), options); - } - else if (FieldNamesValue is not null) - { - writer.WritePropertyName("_field_names"); - JsonSerializer.Serialize(writer, FieldNamesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddRuntime(string key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, value); + return this; + } - if (IndexFieldDescriptor is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, IndexFieldDescriptor, options); - } - else if (IndexFieldDescriptorAction is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.IndexFieldDescriptor(IndexFieldDescriptorAction), options); - } - else if (IndexFieldValue is not null) - { - writer.WritePropertyName("index_field"); - JsonSerializer.Serialize(writer, IndexFieldValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddRuntime(string key, System.Action action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("_meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor AddRuntime(string key, System.Action> action) + { + Instance.Runtime ??= new System.Collections.Generic.Dictionary(); + Instance.Runtime.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } - if (NumericDetectionValue.HasValue) - { - writer.WritePropertyName("numeric_detection"); - writer.WriteBooleanValue(NumericDetectionValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Size(Elastic.Clients.Elasticsearch.Mapping.SizeField? value) + { + Instance.Size = value; + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Size(System.Action action) + { + Instance.Size = Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor.Build(action); + return this; + } - if (RoutingDescriptor is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingDescriptor, options); - } - else if (RoutingDescriptorAction is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.RoutingFieldDescriptor(RoutingDescriptorAction), options); - } - else if (RoutingValue is not null) - { - writer.WritePropertyName("_routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source(Elastic.Clients.Elasticsearch.Mapping.SourceField? value) + { + Instance.Source = value; + return this; + } - if (RuntimeValue is not null) - { - writer.WritePropertyName("runtime"); - JsonSerializer.Serialize(writer, RuntimeValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source() + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(null); + return this; + } - if (SizeDescriptor is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, SizeDescriptor, options); - } - else if (SizeDescriptorAction is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SizeFieldDescriptor(SizeDescriptorAction), options); - } - else if (SizeValue is not null) - { - writer.WritePropertyName("_size"); - JsonSerializer.Serialize(writer, SizeValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Source(System.Action? action) + { + Instance.Source = Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor.Build(action); + return this; + } - if (SourceDescriptor is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceDescriptor, options); - } - else if (SourceDescriptorAction is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Mapping.SourceFieldDescriptor(SourceDescriptorAction), options); - } - else if (SourceValue is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, SourceValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor Subobjects(Elastic.Clients.Elasticsearch.Mapping.Subobjects? value) + { + Instance.Subobjects = value; + return this; + } - if (SubobjectsValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.TypeMapping Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("subobjects"); - writer.WriteBooleanValue(SubobjectsValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor(new Elastic.Clients.Elasticsearch.Mapping.TypeMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/UnsignedLongNumberProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/UnsignedLongNumberProperty.g.cs index 62babbd8409..10fef02df29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/UnsignedLongNumberProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/UnsignedLongNumberProperty.g.cs @@ -17,36 +17,239 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class UnsignedLongNumberProperty : IProperty +internal sealed partial class UnsignedLongNumberPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCoerce = System.Text.Json.JsonEncodedText.Encode("coerce"); + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreMalformed = System.Text.Json.JsonEncodedText.Encode("ignore_malformed"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropOnScriptError = System.Text.Json.JsonEncodedText.Encode("on_script_error"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesDimension = System.Text.Json.JsonEncodedText.Encode("time_series_dimension"); + private static readonly System.Text.Json.JsonEncodedText PropTimeSeriesMetric = System.Text.Json.JsonEncodedText.Encode("time_series_metric"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCoerce = default; + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue propIgnoreMalformed = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propOnScriptError = default; + LocalJsonValue propProperties = default; + LocalJsonValue propScript = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + LocalJsonValue propTimeSeriesDimension = default; + LocalJsonValue propTimeSeriesMetric = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCoerce.TryReadProperty(ref reader, options, PropCoerce, null)) + { + continue; + } + + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propIgnoreMalformed.TryReadProperty(ref reader, options, PropIgnoreMalformed, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propOnScriptError.TryReadProperty(ref reader, options, PropOnScriptError, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (propTimeSeriesDimension.TryReadProperty(ref reader, options, PropTimeSeriesDimension, null)) + { + continue; + } + + if (propTimeSeriesMetric.TryReadProperty(ref reader, options, PropTimeSeriesMetric, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Coerce = propCoerce.Value, + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + IgnoreMalformed = propIgnoreMalformed.Value, + Index = propIndex.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + OnScriptError = propOnScriptError.Value, + Properties = propProperties.Value, + Script = propScript.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value, + TimeSeriesDimension = propTimeSeriesDimension.Value, + TimeSeriesMetric = propTimeSeriesMetric.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCoerce, value.Coerce, null, null); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropIgnoreMalformed, value.IgnoreMalformed, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropOnScriptError, value.OnScriptError, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropTimeSeriesDimension, value.TimeSeriesDimension, null, null); + writer.WriteProperty(options, PropTimeSeriesMetric, value.TimeSeriesMetric, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyConverter))] +public sealed partial class UnsignedLongNumberProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("boost")] +#if NET7_0_OR_GREATER + public UnsignedLongNumberProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public UnsignedLongNumberProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public double? Boost { get; set; } - [JsonInclude, JsonPropertyName("coerce")] public bool? Coerce { get; set; } - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } - [JsonInclude, JsonPropertyName("ignore_malformed")] public bool? IgnoreMalformed { get; set; } - [JsonInclude, JsonPropertyName("index")] public bool? Index { get; set; } /// @@ -54,19 +257,12 @@ public sealed partial class UnsignedLongNumberProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public long? NullValue { get; set; } - [JsonInclude, JsonPropertyName("on_script_error")] public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("script")] public Elastic.Clients.Elasticsearch.Script? Script { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } /// @@ -74,7 +270,6 @@ public sealed partial class UnsignedLongNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_dimension")] public bool? TimeSeriesDimension { get; set; } /// @@ -82,108 +277,105 @@ public sealed partial class UnsignedLongNumberProperty : IProperty /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - [JsonInclude, JsonPropertyName("time_series_metric")] public Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetric { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "unsigned_long"; } -public sealed partial class UnsignedLongNumberPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct UnsignedLongNumberPropertyDescriptor { - internal UnsignedLongNumberPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty Instance { get; init; } - public UnsignedLongNumberPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnsignedLongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty instance) { + Instance = instance; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnsignedLongNumberPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public UnsignedLongNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Coerce(bool? value = true) { - BoostValue = boost; - return Self; + Instance.Coerce = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CoerceValue = coerce; - return Self; + Instance.CopyTo = value; + return this; } - public UnsignedLongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public UnsignedLongNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor IgnoreAbove(int? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public UnsignedLongNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public UnsignedLongNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Index(bool? value = true) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Index = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IndexValue = index; - return Self; + Instance.Meta = value; + return this; } /// @@ -191,78 +383,82 @@ public UnsignedLongNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public UnsignedLongNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public UnsignedLongNumberPropertyDescriptor NullValue(long? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta(System.Action? action) { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor AddMeta(string key, string value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor NullValue(long? value) { - PropertiesValue = properties; - return Self; + Instance.NullValue = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.OnScriptError = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Properties(System.Action> action) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public UnsignedLongNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script(System.Action? action) { - StoreValue = store; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Store(bool? value = true) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Store = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -270,10 +466,10 @@ public UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elast /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -281,280 +477,137 @@ public UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public UnsignedLongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) - { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); - } - - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) + if (action is null) { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } +public readonly partial struct UnsignedLongNumberPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("unsigned_long"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnsignedLongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script? BuildScript() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UnsignedLongNumberPropertyDescriptor() { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + Instance = new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - return null; - } - - UnsignedLongNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; -} + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor descriptor) => descriptor.Instance; -public sealed partial class UnsignedLongNumberPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal UnsignedLongNumberPropertyDescriptor(Action configure) => configure.Invoke(this); + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Boost(double? value) + { + Instance.Boost = value; + return this; + } - public UnsignedLongNumberPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Coerce(bool? value = true) { + Instance.Coerce = value; + return this; } - private double? BoostValue { get; set; } - private bool? CoerceValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private bool? IgnoreMalformedValue { get; set; } - private bool? IndexValue { get; set; } - private IDictionary? MetaValue { get; set; } - private long? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - private bool? TimeSeriesDimensionValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? TimeSeriesMetricValue { get; set; } + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) + { + Instance.CopyTo = value; + return this; + } - public UnsignedLongNumberPropertyDescriptor Boost(double? boost) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - BoostValue = boost; - return Self; + Instance.CopyTo = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Coerce(bool? coerce = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor DocValues(bool? value = true) { - CoerceValue = coerce; - return Self; + Instance.DocValues = value; + return this; } - public UnsignedLongNumberPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - CopyToValue = copyTo; - return Self; + Instance.Dynamic = value; + return this; } - public UnsignedLongNumberPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - DocValuesValue = docValues; - return Self; + Instance.Fields = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Fields(System.Action action) { - DynamicValue = dynamic; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Fields(System.Action> action) { - FieldsValue = fields; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor IgnoreAbove(int? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreAbove = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor IgnoreMalformed(bool? value = true) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.IgnoreMalformed = value; + return this; } - public UnsignedLongNumberPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Index(bool? value = true) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.Index = value; + return this; } - public UnsignedLongNumberPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - IgnoreMalformedValue = ignoreMalformed; - return Self; + Instance.Meta = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Index(bool? index = true) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta() { - IndexValue = index; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } /// @@ -562,78 +615,77 @@ public UnsignedLongNumberPropertyDescriptor Index(bool? index = true) /// Metadata about the field. /// /// - public UnsignedLongNumberPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor AddMeta(string key, string value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public UnsignedLongNumberPropertyDescriptor NullValue(long? nullValue) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor NullValue(long? value) { - NullValueValue = nullValue; - return Self; + Instance.NullValue = value; + return this; } - public UnsignedLongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? value) { - OnScriptErrorValue = onScriptError; - return Self; + Instance.OnScriptError = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - PropertiesValue = properties; - return Self; + Instance.Properties = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Properties(System.Action action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Properties(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? script) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public UnsignedLongNumberPropertyDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public UnsignedLongNumberPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor Store(bool? value = true) { - StoreValue = store; - return Self; + Instance.Store = value; + return this; } - public UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.SyntheticSourceKeep = value; + return this; } /// @@ -641,10 +693,10 @@ public UnsignedLongNumberPropertyDescriptor SyntheticSourceKeep(Elastic.Clients. /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeriesDimension = true) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? value = true) { - TimeSeriesDimensionValue = timeSeriesDimension; - return Self; + Instance.TimeSeriesDimension = value; + return this; } /// @@ -652,181 +704,22 @@ public UnsignedLongNumberPropertyDescriptor TimeSeriesDimension(bool? timeSeries /// For internal use by Elastic only. Marks the field as a time series dimension. Defaults to false. /// /// - public UnsignedLongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? timeSeriesMetric) + public Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor TimeSeriesMetric(Elastic.Clients.Elasticsearch.Mapping.TimeSeriesMetricType? value) { - TimeSeriesMetricValue = timeSeriesMetric; - return Self; + Instance.TimeSeriesMetric = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CoerceValue.HasValue) + if (action is null) { - writer.WritePropertyName("coerce"); - writer.WriteBooleanValue(CoerceValue.Value); + return new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (IgnoreMalformedValue.HasValue) - { - writer.WritePropertyName("ignore_malformed"); - writer.WriteBooleanValue(IgnoreMalformedValue.Value); - } - - if (IndexValue.HasValue) - { - writer.WritePropertyName("index"); - writer.WriteBooleanValue(IndexValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (NullValueValue.HasValue) - { - writer.WritePropertyName("null_value"); - writer.WriteNumberValue(NullValueValue.Value); - } - - if (OnScriptErrorValue is not null) - { - writer.WritePropertyName("on_script_error"); - JsonSerializer.Serialize(writer, OnScriptErrorValue, options); - } - - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else if (ScriptValue is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } - - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } - - if (TimeSeriesDimensionValue.HasValue) - { - writer.WritePropertyName("time_series_dimension"); - writer.WriteBooleanValue(TimeSeriesDimensionValue.Value); - } - - if (TimeSeriesMetricValue is not null) - { - writer.WritePropertyName("time_series_metric"); - JsonSerializer.Serialize(writer, TimeSeriesMetricValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("unsigned_long"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.UnsignedLongNumberProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - private Elastic.Clients.Elasticsearch.Script? BuildScript() - { - if (ScriptValue is not null) - { - return ScriptValue; - } - - if ((object)ScriptDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } - - if (ScriptDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; - } - - UnsignedLongNumberProperty IBuildableDescriptor.Build() => new() - { - Boost = BoostValue, - Coerce = CoerceValue, - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - IgnoreMalformed = IgnoreMalformedValue, - Index = IndexValue, - Meta = MetaValue, - NullValue = NullValueValue, - OnScriptError = OnScriptErrorValue, - Properties = PropertiesValue, - Script = BuildScript(), - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue, - TimeSeriesDimension = TimeSeriesDimensionValue, - TimeSeriesMetric = TimeSeriesMetricValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/VersionProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/VersionProperty.g.cs index a47cc0b2ba0..787561e779c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/VersionProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/VersionProperty.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class VersionProperty : IProperty +internal sealed partial class VersionPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.VersionProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.VersionProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.VersionPropertyConverter))] +public sealed partial class VersionProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public VersionProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public VersionProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -46,79 +172,73 @@ public sealed partial class VersionProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("properties")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "version"; } -public sealed partial class VersionPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct VersionPropertyDescriptor { - internal VersionPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.VersionProperty Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VersionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.VersionProperty instance) + { + Instance = instance; + } - public VersionPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VersionPropertyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.VersionProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor descriptor) => descriptor.Instance; - public VersionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public VersionPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public VersionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public VersionPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public VersionPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -126,180 +246,144 @@ public VersionPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public VersionPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public VersionPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public VersionPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public VersionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } + Instance.Store = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (PropertiesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.VersionProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } +public readonly partial struct VersionPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.VersionProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("version"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VersionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.VersionProperty instance) + { + Instance = instance; } - VersionProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VersionPropertyDescriptor() { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} + Instance = new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } -public sealed partial class VersionPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal VersionPropertyDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.VersionProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor descriptor) => descriptor.Instance; - public VersionPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public VersionPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public VersionPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public VersionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public VersionPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public VersionPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public VersionPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -307,116 +391,81 @@ public VersionPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public VersionPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta() { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public VersionPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor AddMeta(string key, string value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public VersionPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public VersionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.VersionProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("version"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.VersionPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.VersionProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - VersionProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/WildcardProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/WildcardProperty.g.cs index 3ea44163a71..5ea0c1ae8bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/WildcardProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/WildcardProperty.g.cs @@ -17,28 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class WildcardProperty : IProperty +internal sealed partial class WildcardPropertyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCopyTo = System.Text.Json.JsonEncodedText.Encode("copy_to"); + private static readonly System.Text.Json.JsonEncodedText PropDocValues = System.Text.Json.JsonEncodedText.Encode("doc_values"); + private static readonly System.Text.Json.JsonEncodedText PropDynamic = System.Text.Json.JsonEncodedText.Encode("dynamic"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreAbove = System.Text.Json.JsonEncodedText.Encode("ignore_above"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText PropNullValue = System.Text.Json.JsonEncodedText.Encode("null_value"); + private static readonly System.Text.Json.JsonEncodedText PropProperties = System.Text.Json.JsonEncodedText.Encode("properties"); + private static readonly System.Text.Json.JsonEncodedText PropStore = System.Text.Json.JsonEncodedText.Encode("store"); + private static readonly System.Text.Json.JsonEncodedText PropSyntheticSourceKeep = System.Text.Json.JsonEncodedText.Encode("synthetic_source_keep"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Mapping.WildcardProperty Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCopyTo = default; + LocalJsonValue propDocValues = default; + LocalJsonValue propDynamic = default; + LocalJsonValue propFields = default; + LocalJsonValue propIgnoreAbove = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propNullValue = default; + LocalJsonValue propProperties = default; + LocalJsonValue propStore = default; + LocalJsonValue propSyntheticSourceKeep = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCopyTo.TryReadProperty(ref reader, options, PropCopyTo, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propDocValues.TryReadProperty(ref reader, options, PropDocValues, null)) + { + continue; + } + + if (propDynamic.TryReadProperty(ref reader, options, PropDynamic, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propIgnoreAbove.TryReadProperty(ref reader, options, PropIgnoreAbove, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNullValue.TryReadProperty(ref reader, options, PropNullValue, null)) + { + continue; + } + + if (propProperties.TryReadProperty(ref reader, options, PropProperties, null)) + { + continue; + } + + if (propStore.TryReadProperty(ref reader, options, PropStore, null)) + { + continue; + } + + if (propSyntheticSourceKeep.TryReadProperty(ref reader, options, PropSyntheticSourceKeep, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CopyTo = propCopyTo.Value, + DocValues = propDocValues.Value, + Dynamic = propDynamic.Value, + Fields = propFields.Value, + IgnoreAbove = propIgnoreAbove.Value, + Meta = propMeta.Value, + NullValue = propNullValue.Value, + Properties = propProperties.Value, + Store = propStore.Value, + SyntheticSourceKeep = propSyntheticSourceKeep.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Mapping.WildcardProperty value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCopyTo, value.CopyTo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropDocValues, value.DocValues, null, null); + writer.WriteProperty(options, PropDynamic, value.Dynamic, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropIgnoreAbove, value.IgnoreAbove, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNullValue, value.NullValue, null, null); + writer.WriteProperty(options, PropProperties, value.Properties, null, null); + writer.WriteProperty(options, PropStore, value.Store, null, null); + writer.WriteProperty(options, PropSyntheticSourceKeep, value.SyntheticSourceKeep, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyConverter))] +public sealed partial class WildcardProperty : Elastic.Clients.Elasticsearch.Mapping.IProperty { - [JsonInclude, JsonPropertyName("copy_to")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public WildcardProperty() + { + } +#endif +#if !NET7_0_OR_GREATER + public WildcardProperty() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; } - [JsonInclude, JsonPropertyName("doc_values")] public bool? DocValues { get; set; } - [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } - [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } - [JsonInclude, JsonPropertyName("ignore_above")] public int? IgnoreAbove { get; set; } /// @@ -46,82 +181,74 @@ public sealed partial class WildcardProperty : IProperty /// Metadata about the field. /// /// - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - [JsonInclude, JsonPropertyName("null_value")] + public System.Collections.Generic.IDictionary? Meta { get; set; } public string? NullValue { get; set; } - [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } - [JsonInclude, JsonPropertyName("store")] public bool? Store { get; set; } - [JsonInclude, JsonPropertyName("synthetic_source_keep")] public Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeep { get; set; } - [JsonInclude, JsonPropertyName("type")] public string Type => "wildcard"; } -public sealed partial class WildcardPropertyDescriptor : SerializableDescriptor>, IBuildableDescriptor +public readonly partial struct WildcardPropertyDescriptor { - internal WildcardPropertyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Mapping.WildcardProperty Instance { get; init; } - public WildcardPropertyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardPropertyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public WildcardPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public WildcardPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - DocValuesValue = docValues; - return Self; + Instance.CopyTo = value; + return this; } - public WildcardPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor DocValues(bool? value = true) { - DynamicValue = dynamic; - return Self; + Instance.DocValues = value; + return this; } - public WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - FieldsValue = fields; - return Self; + Instance.Dynamic = value; + return this; } - public WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = value; + return this; } - public WildcardPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public WildcardPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -129,194 +256,150 @@ public WildcardPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public WildcardPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public WildcardPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public WildcardPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public WildcardPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public WildcardPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Properties(System.Action> action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Store(bool? value = true) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + Instance.Store = value; + return this; + } - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (PropertiesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.WildcardProperty Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (SyntheticSourceKeepValue is not null) - { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); - } +public readonly partial struct WildcardPropertyDescriptor +{ + internal Elastic.Clients.Elasticsearch.Mapping.WildcardProperty Instance { get; init; } - writer.WritePropertyName("type"); - writer.WriteStringValue("wildcard"); - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty instance) + { + Instance = instance; } - WildcardProperty IBuildableDescriptor.Build() => new() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardPropertyDescriptor() { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; -} + Instance = new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } -public sealed partial class WildcardPropertyDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal WildcardPropertyDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(Elastic.Clients.Elasticsearch.Mapping.WildcardProperty instance) => new Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor descriptor) => descriptor.Instance; - public WildcardPropertyDescriptor() : base() + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? value) { + Instance.CopyTo = value; + return this; } - private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; } - private bool? DocValuesValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } - private int? IgnoreAboveValue { get; set; } - private IDictionary? MetaValue { get; set; } - private string? NullValueValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } - private bool? StoreValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? SyntheticSourceKeepValue { get; set; } - - public WildcardPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor CopyTo(params System.Linq.Expressions.Expression>[] value) { - CopyToValue = copyTo; - return Self; + Instance.CopyTo = value; + return this; } - public WildcardPropertyDescriptor DocValues(bool? docValues = true) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor DocValues(bool? value = true) { - DocValuesValue = docValues; - return Self; + Instance.DocValues = value; + return this; } - public WildcardPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? value) { - DynamicValue = dynamic; - return Self; + Instance.Dynamic = value; + return this; } - public WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - public WildcardPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Fields(System.Action action) { - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public WildcardPropertyDescriptor Fields(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Fields(System.Action> action) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - FieldsValue = descriptor.PromisedValue; - return Self; + Instance.Fields = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - public WildcardPropertyDescriptor IgnoreAbove(int? ignoreAbove) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor IgnoreAbove(int? value) { - IgnoreAboveValue = ignoreAbove; - return Self; + Instance.IgnoreAbove = value; + return this; } /// @@ -324,129 +407,87 @@ public WildcardPropertyDescriptor IgnoreAbove(int? ignoreAbove) /// Metadata about the field. /// /// - public WildcardPropertyDescriptor Meta(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta(System.Collections.Generic.IDictionary? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Meta = value; + return this; } - public WildcardPropertyDescriptor NullValue(string? nullValue) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta() { - NullValueValue = nullValue; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; } - public WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) + /// + /// + /// Metadata about the field. + /// + /// + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Meta(System.Action? action) { - PropertiesValue = properties; - return Self; + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; } - public WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor AddMeta(string key, string value) { - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; } - public WildcardPropertyDescriptor Properties(Action> configure) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor NullValue(string? value) { - var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor(); - configure?.Invoke(descriptor); - PropertiesValue = descriptor.PromisedValue; - return Self; + Instance.NullValue = value; + return this; } - public WildcardPropertyDescriptor Store(bool? store = true) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? value) { - StoreValue = store; - return Self; + Instance.Properties = value; + return this; } - public WildcardPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? syntheticSourceKeep) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Properties(System.Action action) { - SyntheticSourceKeepValue = syntheticSourceKeep; - return Self; + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Properties(System.Action> action) { - writer.WriteStartObject(); - if (CopyToValue is not null) - { - writer.WritePropertyName("copy_to"); - JsonSerializer.Serialize(writer, CopyToValue, options); - } - - if (DocValuesValue.HasValue) - { - writer.WritePropertyName("doc_values"); - writer.WriteBooleanValue(DocValuesValue.Value); - } - - if (DynamicValue is not null) - { - writer.WritePropertyName("dynamic"); - JsonSerializer.Serialize(writer, DynamicValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IgnoreAboveValue.HasValue) - { - writer.WritePropertyName("ignore_above"); - writer.WriteNumberValue(IgnoreAboveValue.Value); - } - - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } - - if (!string.IsNullOrEmpty(NullValueValue)) - { - writer.WritePropertyName("null_value"); - writer.WriteStringValue(NullValueValue); - } + Instance.Properties = Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor.Build(action); + return this; + } - if (PropertiesValue is not null) - { - writer.WritePropertyName("properties"); - JsonSerializer.Serialize(writer, PropertiesValue, options); - } + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor Store(bool? value = true) + { + Instance.Store = value; + return this; + } - if (StoreValue.HasValue) - { - writer.WritePropertyName("store"); - writer.WriteBooleanValue(StoreValue.Value); - } + public Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor SyntheticSourceKeep(Elastic.Clients.Elasticsearch.Mapping.SyntheticSourceKeepEnum? value) + { + Instance.SyntheticSourceKeep = value; + return this; + } - if (SyntheticSourceKeepValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Mapping.WildcardProperty Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("synthetic_source_keep"); - JsonSerializer.Serialize(writer, SyntheticSourceKeepValue, options); + return new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WritePropertyName("type"); - writer.WriteStringValue("wildcard"); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Mapping.WildcardPropertyDescriptor(new Elastic.Clients.Elasticsearch.Mapping.WildcardProperty(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - WildcardProperty IBuildableDescriptor.Build() => new() - { - CopyTo = CopyToValue, - DocValues = DocValuesValue, - Dynamic = DynamicValue, - Fields = FieldsValue, - IgnoreAbove = IgnoreAboveValue, - Meta = MetaValue, - NullValue = NullValueValue, - Properties = PropertiesValue, - Store = StoreValue, - SyntheticSourceKeep = SyntheticSourceKeepValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MergesStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MergesStats.g.cs index 3d1ad0d141c..1db8f5dcd8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MergesStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MergesStats.g.cs @@ -17,48 +17,274 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class MergesStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentDocs = System.Text.Json.JsonEncodedText.Encode("current_docs"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentSize = System.Text.Json.JsonEncodedText.Encode("current_size"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentSizeInBytes = System.Text.Json.JsonEncodedText.Encode("current_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalAutoThrottle = System.Text.Json.JsonEncodedText.Encode("total_auto_throttle"); + private static readonly System.Text.Json.JsonEncodedText PropTotalAutoThrottleInBytes = System.Text.Json.JsonEncodedText.Encode("total_auto_throttle_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDocs = System.Text.Json.JsonEncodedText.Encode("total_docs"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSize = System.Text.Json.JsonEncodedText.Encode("total_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalStoppedTime = System.Text.Json.JsonEncodedText.Encode("total_stopped_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalStoppedTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_stopped_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottledTime = System.Text.Json.JsonEncodedText.Encode("total_throttled_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottledTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_throttled_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.MergesStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrent = default; + LocalJsonValue propCurrentDocs = default; + LocalJsonValue propCurrentSize = default; + LocalJsonValue propCurrentSizeInBytes = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalAutoThrottle = default; + LocalJsonValue propTotalAutoThrottleInBytes = default; + LocalJsonValue propTotalDocs = default; + LocalJsonValue propTotalSize = default; + LocalJsonValue propTotalSizeInBytes = default; + LocalJsonValue propTotalStoppedTime = default; + LocalJsonValue propTotalStoppedTimeInMillis = default; + LocalJsonValue propTotalThrottledTime = default; + LocalJsonValue propTotalThrottledTimeInMillis = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propCurrentDocs.TryReadProperty(ref reader, options, PropCurrentDocs, null)) + { + continue; + } + + if (propCurrentSize.TryReadProperty(ref reader, options, PropCurrentSize, null)) + { + continue; + } + + if (propCurrentSizeInBytes.TryReadProperty(ref reader, options, PropCurrentSizeInBytes, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalAutoThrottle.TryReadProperty(ref reader, options, PropTotalAutoThrottle, null)) + { + continue; + } + + if (propTotalAutoThrottleInBytes.TryReadProperty(ref reader, options, PropTotalAutoThrottleInBytes, null)) + { + continue; + } + + if (propTotalDocs.TryReadProperty(ref reader, options, PropTotalDocs, null)) + { + continue; + } + + if (propTotalSize.TryReadProperty(ref reader, options, PropTotalSize, null)) + { + continue; + } + + if (propTotalSizeInBytes.TryReadProperty(ref reader, options, PropTotalSizeInBytes, null)) + { + continue; + } + + if (propTotalStoppedTime.TryReadProperty(ref reader, options, PropTotalStoppedTime, null)) + { + continue; + } + + if (propTotalStoppedTimeInMillis.TryReadProperty(ref reader, options, PropTotalStoppedTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalThrottledTime.TryReadProperty(ref reader, options, PropTotalThrottledTime, null)) + { + continue; + } + + if (propTotalThrottledTimeInMillis.TryReadProperty(ref reader, options, PropTotalThrottledTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.MergesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Current = propCurrent.Value, + CurrentDocs = propCurrentDocs.Value, + CurrentSize = propCurrentSize.Value, + CurrentSizeInBytes = propCurrentSizeInBytes.Value, + Total = propTotal.Value, + TotalAutoThrottle = propTotalAutoThrottle.Value, + TotalAutoThrottleInBytes = propTotalAutoThrottleInBytes.Value, + TotalDocs = propTotalDocs.Value, + TotalSize = propTotalSize.Value, + TotalSizeInBytes = propTotalSizeInBytes.Value, + TotalStoppedTime = propTotalStoppedTime.Value, + TotalStoppedTimeInMillis = propTotalStoppedTimeInMillis.Value, + TotalThrottledTime = propTotalThrottledTime.Value, + TotalThrottledTimeInMillis = propTotalThrottledTimeInMillis.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.MergesStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropCurrentDocs, value.CurrentDocs, null, null); + writer.WriteProperty(options, PropCurrentSize, value.CurrentSize, null, null); + writer.WriteProperty(options, PropCurrentSizeInBytes, value.CurrentSizeInBytes, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalAutoThrottle, value.TotalAutoThrottle, null, null); + writer.WriteProperty(options, PropTotalAutoThrottleInBytes, value.TotalAutoThrottleInBytes, null, null); + writer.WriteProperty(options, PropTotalDocs, value.TotalDocs, null, null); + writer.WriteProperty(options, PropTotalSize, value.TotalSize, null, null); + writer.WriteProperty(options, PropTotalSizeInBytes, value.TotalSizeInBytes, null, null); + writer.WriteProperty(options, PropTotalStoppedTime, value.TotalStoppedTime, null, null); + writer.WriteProperty(options, PropTotalStoppedTimeInMillis, value.TotalStoppedTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalThrottledTime, value.TotalThrottledTime, null, null); + writer.WriteProperty(options, PropTotalThrottledTimeInMillis, value.TotalThrottledTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.MergesStatsConverter))] public sealed partial class MergesStats { - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } - [JsonInclude, JsonPropertyName("current_docs")] - public long CurrentDocs { get; init; } - [JsonInclude, JsonPropertyName("current_size")] - public string? CurrentSize { get; init; } - [JsonInclude, JsonPropertyName("current_size_in_bytes")] - public long CurrentSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } - [JsonInclude, JsonPropertyName("total_auto_throttle")] - public string? TotalAutoThrottle { get; init; } - [JsonInclude, JsonPropertyName("total_auto_throttle_in_bytes")] - public long TotalAutoThrottleInBytes { get; init; } - [JsonInclude, JsonPropertyName("total_docs")] - public long TotalDocs { get; init; } - [JsonInclude, JsonPropertyName("total_size")] - public string? TotalSize { get; init; } - [JsonInclude, JsonPropertyName("total_size_in_bytes")] - public long TotalSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("total_stopped_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalStoppedTime { get; init; } - [JsonInclude, JsonPropertyName("total_stopped_time_in_millis")] - public long TotalStoppedTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_throttled_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalThrottledTime { get; init; } - [JsonInclude, JsonPropertyName("total_throttled_time_in_millis")] - public long TotalThrottledTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MergesStats(long current, long currentDocs, long currentSizeInBytes, long total, long totalAutoThrottleInBytes, long totalDocs, long totalSizeInBytes, System.TimeSpan totalStoppedTimeInMillis, System.TimeSpan totalThrottledTimeInMillis, System.TimeSpan totalTimeInMillis) + { + Current = current; + CurrentDocs = currentDocs; + CurrentSizeInBytes = currentSizeInBytes; + Total = total; + TotalAutoThrottleInBytes = totalAutoThrottleInBytes; + TotalDocs = totalDocs; + TotalSizeInBytes = totalSizeInBytes; + TotalStoppedTimeInMillis = totalStoppedTimeInMillis; + TotalThrottledTimeInMillis = totalThrottledTimeInMillis; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public MergesStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MergesStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MergesStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CurrentDocs { get; set; } + public string? CurrentSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CurrentSizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } + public string? TotalAutoThrottle { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalAutoThrottleInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalDocs { get; set; } + public string? TotalSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeInBytes { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalStoppedTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalStoppedTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalThrottledTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalThrottledTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NestedSortValue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NestedSortValue.g.cs index 155c4903a9d..f7dfc437035 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NestedSortValue.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NestedSortValue.g.cs @@ -17,296 +17,261 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class NestedSortValueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMaxChildren = System.Text.Json.JsonEncodedText.Encode("max_children"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + + public override Elastic.Clients.Elasticsearch.NestedSortValue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue propMaxChildren = default; + LocalJsonValue propNested = default; + LocalJsonValue propPath = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propMaxChildren.TryReadProperty(ref reader, options, PropMaxChildren, null)) + { + continue; + } + + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + MaxChildren = propMaxChildren.Value, + Nested = propNested.Value, + Path = propPath.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NestedSortValue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropMaxChildren, value.MaxChildren, null, null); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NestedSortValueConverter))] public sealed partial class NestedSortValue { - [JsonInclude, JsonPropertyName("filter")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedSortValue(Elastic.Clients.Elasticsearch.Field path) + { + Path = path; + } +#if NET7_0_OR_GREATER + public NestedSortValue() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NestedSortValue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } - [JsonInclude, JsonPropertyName("max_children")] public int? MaxChildren { get; set; } - [JsonInclude, JsonPropertyName("nested")] public Elastic.Clients.Elasticsearch.NestedSortValue? Nested { get; set; } - [JsonInclude, JsonPropertyName("path")] - public Elastic.Clients.Elasticsearch.Field Path { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Path { get; set; } } -public sealed partial class NestedSortValueDescriptor : SerializableDescriptor> +public readonly partial struct NestedSortValueDescriptor { - internal NestedSortValueDescriptor(Action> configure) => configure.Invoke(this); - - public NestedSortValueDescriptor() : base() - { - } - - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private int? MaxChildrenValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action> NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } + internal Elastic.Clients.Elasticsearch.NestedSortValue Instance { get; init; } - public NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedSortValueDescriptor(Elastic.Clients.Elasticsearch.NestedSortValue instance) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance = instance; } - public NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedSortValueDescriptor() { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NestedSortValueDescriptor Filter(Action> configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; - } + public static explicit operator Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(Elastic.Clients.Elasticsearch.NestedSortValue instance) => new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) => descriptor.Instance; - public NestedSortValueDescriptor MaxChildren(int? maxChildren) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - MaxChildrenValue = maxChildren; - return Self; + Instance.Filter = value; + return this; } - public NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Filter(System.Action> action) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor MaxChildren(int? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.MaxChildren = value; + return this; } - public NestedSortValueDescriptor Nested(Action> configure) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = value; + return this; } - public NestedSortValueDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Nested(System.Action> action) { - PathValue = path; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public NestedSortValueDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.NestedSortValue Build(System.Action> action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MaxChildrenValue.HasValue) - { - writer.WritePropertyName("max_children"); - writer.WriteNumberValue(MaxChildrenValue.Value); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(new Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NestedSortValueDescriptor : SerializableDescriptor +public readonly partial struct NestedSortValueDescriptor { - internal NestedSortValueDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.NestedSortValue Instance { get; init; } - public NestedSortValueDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedSortValueDescriptor(Elastic.Clients.Elasticsearch.NestedSortValue instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private int? MaxChildrenValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } - - public NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedSortValueDescriptor() { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance = new Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(Elastic.Clients.Elasticsearch.NestedSortValue instance) => new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public NestedSortValueDescriptor Filter(Action configure) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor MaxChildren(int? maxChildren) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Filter(System.Action> action) { - MaxChildrenValue = maxChildren; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor MaxChildren(int? value) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.MaxChildren = value; + return this; } - public NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Nested = value; + return this; } - public NestedSortValueDescriptor Nested(Action configure) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Nested(System.Action action) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Nested(System.Action> action) { - PathValue = path; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public NestedSortValueDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public NestedSortValueDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.NestedSortValueDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.NestedSortValue Build(System.Action action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MaxChildrenValue.HasValue) - { - writer.WritePropertyName("max_children"); - writer.WriteNumberValue(MaxChildrenValue.Value); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(new Elastic.Clients.Elasticsearch.NestedSortValue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeAttributes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeAttributes.g.cs index 4516eb05e16..4c34f974941 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeAttributes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeAttributes.g.cs @@ -17,55 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class NodeAttributesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropEphemeralId = System.Text.Json.JsonEncodedText.Encode("ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.NodeAttributes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttributes = default; + LocalJsonValue propEphemeralId = default; + LocalJsonValue propId = default; + LocalJsonValue propName = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEphemeralId.TryReadProperty(ref reader, options, PropEphemeralId, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.NodeAttributes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + EphemeralId = propEphemeralId.Value, + Id = propId.Value, + Name = propName.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NodeAttributes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEphemeralId, value.EphemeralId, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NodeAttributesConverter))] public sealed partial class NodeAttributes { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeAttributes(System.Collections.Generic.IReadOnlyDictionary attributes, string ephemeralId, string name, string transportAddress) + { + Attributes = attributes; + EphemeralId = ephemeralId; + Name = name; + TransportAddress = transportAddress; + } +#if NET7_0_OR_GREATER + public NodeAttributes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeAttributes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeAttributes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Lists node attributes. /// /// - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } /// /// /// The ephemeral ID of the node. /// /// - [JsonInclude, JsonPropertyName("ephemeral_id")] - public string EphemeralId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string EphemeralId { get; set; } /// /// /// The unique identifier of the node. /// /// - [JsonInclude, JsonPropertyName("id")] - public string? Id { get; init; } + public string? Id { get; set; } /// /// /// The unique identifier of the node. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// The host and port where transport HTTP connections are accepted. /// /// - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeShard.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeShard.g.cs index 5621406094b..75f16ab99e8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeShard.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeShard.g.cs @@ -17,36 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class NodeShardConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocationId = System.Text.Json.JsonEncodedText.Encode("allocation_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropRecoverySource = System.Text.Json.JsonEncodedText.Encode("recovery_source"); + private static readonly System.Text.Json.JsonEncodedText PropRelocatingNode = System.Text.Json.JsonEncodedText.Encode("relocating_node"); + private static readonly System.Text.Json.JsonEncodedText PropRelocationFailureInfo = System.Text.Json.JsonEncodedText.Encode("relocation_failure_info"); + private static readonly System.Text.Json.JsonEncodedText PropShard = System.Text.Json.JsonEncodedText.Encode("shard"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropUnassignedInfo = System.Text.Json.JsonEncodedText.Encode("unassigned_info"); + + public override Elastic.Clients.Elasticsearch.NodeShard Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAllocationId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propNode = default; + LocalJsonValue propPrimary = default; + LocalJsonValue?> propRecoverySource = default; + LocalJsonValue propRelocatingNode = default; + LocalJsonValue propRelocationFailureInfo = default; + LocalJsonValue propShard = default; + LocalJsonValue propState = default; + LocalJsonValue propUnassignedInfo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocationId.TryReadProperty(ref reader, options, PropAllocationId, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propRecoverySource.TryReadProperty(ref reader, options, PropRecoverySource, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRelocatingNode.TryReadProperty(ref reader, options, PropRelocatingNode, null)) + { + continue; + } + + if (propRelocationFailureInfo.TryReadProperty(ref reader, options, PropRelocationFailureInfo, null)) + { + continue; + } + + if (propShard.TryReadProperty(ref reader, options, PropShard, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propUnassignedInfo.TryReadProperty(ref reader, options, PropUnassignedInfo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.NodeShard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocationId = propAllocationId.Value, + Index = propIndex.Value, + Node = propNode.Value, + Primary = propPrimary.Value, + RecoverySource = propRecoverySource.Value, + RelocatingNode = propRelocatingNode.Value, + RelocationFailureInfo = propRelocationFailureInfo.Value, + Shard = propShard.Value, + State = propState.Value, + UnassignedInfo = propUnassignedInfo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NodeShard value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocationId, value.AllocationId, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropRecoverySource, value.RecoverySource, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRelocatingNode, value.RelocatingNode, null, null); + writer.WriteProperty(options, PropRelocationFailureInfo, value.RelocationFailureInfo, null, null); + writer.WriteProperty(options, PropShard, value.Shard, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropUnassignedInfo, value.UnassignedInfo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NodeShardConverter))] public sealed partial class NodeShard { - [JsonInclude, JsonPropertyName("allocation_id")] - public IReadOnlyDictionary? AllocationId { get; init; } - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("node")] - public string? Node { get; init; } - [JsonInclude, JsonPropertyName("primary")] - public bool Primary { get; init; } - [JsonInclude, JsonPropertyName("recovery_source")] - public IReadOnlyDictionary? RecoverySource { get; init; } - [JsonInclude, JsonPropertyName("relocating_node")] - public string? RelocatingNode { get; init; } - [JsonInclude, JsonPropertyName("relocation_failure_info")] - public Elastic.Clients.Elasticsearch.RelocationFailureInfo? RelocationFailureInfo { get; init; } - [JsonInclude, JsonPropertyName("shard")] - public int Shard { get; init; } - [JsonInclude, JsonPropertyName("state")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState State { get; init; } - [JsonInclude, JsonPropertyName("unassigned_info")] - public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeShard(string index, bool primary, int shard, Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState state) + { + Index = index; + Primary = primary; + Shard = shard; + State = state; + } +#if NET7_0_OR_GREATER + public NodeShard() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeShard() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeShard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? AllocationId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public string? Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Primary { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? RecoverySource { get; set; } + public string? RelocatingNode { get; set; } + public Elastic.Clients.Elasticsearch.RelocationFailureInfo? RelocationFailureInfo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Shard { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexManagement.ShardRoutingState State { get; set; } + public Elastic.Clients.Elasticsearch.Cluster.UnassignedInformation? UnassignedInfo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeStatistics.g.cs index 22d8be00e59..a08e819955c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/NodeStatistics.g.cs @@ -17,46 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class NodeStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessful = System.Text.Json.JsonEncodedText.Encode("successful"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.NodeStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFailed = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue propSuccessful = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSuccessful.TryReadProperty(ref reader, options, PropSuccessful, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.NodeStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Failed = propFailed.Value, + Failures = propFailures.Value, + Successful = propSuccessful.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.NodeStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSuccessful, value.Successful, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + /// /// /// Contains statistics about the number of nodes selected by the request. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.NodeStatisticsConverter))] public sealed partial class NodeStatistics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeStatistics(int failed, int successful, int total) + { + Failed = failed; + Successful = successful; + Total = total; + } +#if NET7_0_OR_GREATER + public NodeStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of nodes that rejected the request or failed to respond. If this value is not 0, a reason for the rejection or failure is included in the response. /// /// - [JsonInclude, JsonPropertyName("failed")] - public int Failed { get; init; } - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Failed { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } /// /// /// Number of nodes that responded successfully to the request. /// /// - [JsonInclude, JsonPropertyName("successful")] - public int Successful { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Successful { get; set; } /// /// /// Total number of nodes selected by the request. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/AdaptiveSelection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/AdaptiveSelection.g.cs index b186d569db0..eca1c35f769 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/AdaptiveSelection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/AdaptiveSelection.g.cs @@ -17,71 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class AdaptiveSelectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvgQueueSize = System.Text.Json.JsonEncodedText.Encode("avg_queue_size"); + private static readonly System.Text.Json.JsonEncodedText PropAvgResponseTime = System.Text.Json.JsonEncodedText.Encode("avg_response_time"); + private static readonly System.Text.Json.JsonEncodedText PropAvgResponseTimeNs = System.Text.Json.JsonEncodedText.Encode("avg_response_time_ns"); + private static readonly System.Text.Json.JsonEncodedText PropAvgServiceTime = System.Text.Json.JsonEncodedText.Encode("avg_service_time"); + private static readonly System.Text.Json.JsonEncodedText PropAvgServiceTimeNs = System.Text.Json.JsonEncodedText.Encode("avg_service_time_ns"); + private static readonly System.Text.Json.JsonEncodedText PropOutgoingSearches = System.Text.Json.JsonEncodedText.Encode("outgoing_searches"); + private static readonly System.Text.Json.JsonEncodedText PropRank = System.Text.Json.JsonEncodedText.Encode("rank"); + + public override Elastic.Clients.Elasticsearch.Nodes.AdaptiveSelection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvgQueueSize = default; + LocalJsonValue propAvgResponseTime = default; + LocalJsonValue propAvgResponseTimeNs = default; + LocalJsonValue propAvgServiceTime = default; + LocalJsonValue propAvgServiceTimeNs = default; + LocalJsonValue propOutgoingSearches = default; + LocalJsonValue propRank = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvgQueueSize.TryReadProperty(ref reader, options, PropAvgQueueSize, null)) + { + continue; + } + + if (propAvgResponseTime.TryReadProperty(ref reader, options, PropAvgResponseTime, null)) + { + continue; + } + + if (propAvgResponseTimeNs.TryReadProperty(ref reader, options, PropAvgResponseTimeNs, null)) + { + continue; + } + + if (propAvgServiceTime.TryReadProperty(ref reader, options, PropAvgServiceTime, null)) + { + continue; + } + + if (propAvgServiceTimeNs.TryReadProperty(ref reader, options, PropAvgServiceTimeNs, null)) + { + continue; + } + + if (propOutgoingSearches.TryReadProperty(ref reader, options, PropOutgoingSearches, null)) + { + continue; + } + + if (propRank.TryReadProperty(ref reader, options, PropRank, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.AdaptiveSelection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AvgQueueSize = propAvgQueueSize.Value, + AvgResponseTime = propAvgResponseTime.Value, + AvgResponseTimeNs = propAvgResponseTimeNs.Value, + AvgServiceTime = propAvgServiceTime.Value, + AvgServiceTimeNs = propAvgServiceTimeNs.Value, + OutgoingSearches = propOutgoingSearches.Value, + Rank = propRank.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.AdaptiveSelection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvgQueueSize, value.AvgQueueSize, null, null); + writer.WriteProperty(options, PropAvgResponseTime, value.AvgResponseTime, null, null); + writer.WriteProperty(options, PropAvgResponseTimeNs, value.AvgResponseTimeNs, null, null); + writer.WriteProperty(options, PropAvgServiceTime, value.AvgServiceTime, null, null); + writer.WriteProperty(options, PropAvgServiceTimeNs, value.AvgServiceTimeNs, null, null); + writer.WriteProperty(options, PropOutgoingSearches, value.OutgoingSearches, null, null); + writer.WriteProperty(options, PropRank, value.Rank, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.AdaptiveSelectionConverter))] public sealed partial class AdaptiveSelection { +#if NET7_0_OR_GREATER + public AdaptiveSelection() + { + } +#endif +#if !NET7_0_OR_GREATER + public AdaptiveSelection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AdaptiveSelection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The exponentially weighted moving average queue size of search requests on the keyed node. /// /// - [JsonInclude, JsonPropertyName("avg_queue_size")] - public long? AvgQueueSize { get; init; } + public long? AvgQueueSize { get; set; } /// /// /// The exponentially weighted moving average response time of search requests on the keyed node. /// /// - [JsonInclude, JsonPropertyName("avg_response_time")] - public Elastic.Clients.Elasticsearch.Duration? AvgResponseTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? AvgResponseTime { get; set; } /// /// /// The exponentially weighted moving average response time, in nanoseconds, of search requests on the keyed node. /// /// - [JsonInclude, JsonPropertyName("avg_response_time_ns")] - public long? AvgResponseTimeNs { get; init; } + public long? AvgResponseTimeNs { get; set; } /// /// /// The exponentially weighted moving average service time of search requests on the keyed node. /// /// - [JsonInclude, JsonPropertyName("avg_service_time")] - public Elastic.Clients.Elasticsearch.Duration? AvgServiceTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? AvgServiceTime { get; set; } /// /// /// The exponentially weighted moving average service time, in nanoseconds, of search requests on the keyed node. /// /// - [JsonInclude, JsonPropertyName("avg_service_time_ns")] - public long? AvgServiceTimeNs { get; init; } + public long? AvgServiceTimeNs { get; set; } /// /// /// The number of outstanding search requests to the keyed node from the node these stats are for. /// /// - [JsonInclude, JsonPropertyName("outgoing_searches")] - public long? OutgoingSearches { get; init; } + public long? OutgoingSearches { get; set; } /// /// /// The rank of this node; used for shard selection when routing search requests. /// /// - [JsonInclude, JsonPropertyName("rank")] - public string? Rank { get; init; } + public string? Rank { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Breaker.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Breaker.g.cs index b12d1045956..546d2e417a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Breaker.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Breaker.g.cs @@ -17,63 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class BreakerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEstimatedSize = System.Text.Json.JsonEncodedText.Encode("estimated_size"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedSizeInBytes = System.Text.Json.JsonEncodedText.Encode("estimated_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropLimitSize = System.Text.Json.JsonEncodedText.Encode("limit_size"); + private static readonly System.Text.Json.JsonEncodedText PropLimitSizeInBytes = System.Text.Json.JsonEncodedText.Encode("limit_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropOverhead = System.Text.Json.JsonEncodedText.Encode("overhead"); + private static readonly System.Text.Json.JsonEncodedText PropTripped = System.Text.Json.JsonEncodedText.Encode("tripped"); + + public override Elastic.Clients.Elasticsearch.Nodes.Breaker Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEstimatedSize = default; + LocalJsonValue propEstimatedSizeInBytes = default; + LocalJsonValue propLimitSize = default; + LocalJsonValue propLimitSizeInBytes = default; + LocalJsonValue propOverhead = default; + LocalJsonValue propTripped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEstimatedSize.TryReadProperty(ref reader, options, PropEstimatedSize, null)) + { + continue; + } + + if (propEstimatedSizeInBytes.TryReadProperty(ref reader, options, PropEstimatedSizeInBytes, null)) + { + continue; + } + + if (propLimitSize.TryReadProperty(ref reader, options, PropLimitSize, null)) + { + continue; + } + + if (propLimitSizeInBytes.TryReadProperty(ref reader, options, PropLimitSizeInBytes, null)) + { + continue; + } + + if (propOverhead.TryReadProperty(ref reader, options, PropOverhead, null)) + { + continue; + } + + if (propTripped.TryReadProperty(ref reader, options, PropTripped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Breaker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EstimatedSize = propEstimatedSize.Value, + EstimatedSizeInBytes = propEstimatedSizeInBytes.Value, + LimitSize = propLimitSize.Value, + LimitSizeInBytes = propLimitSizeInBytes.Value, + Overhead = propOverhead.Value, + Tripped = propTripped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Breaker value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEstimatedSize, value.EstimatedSize, null, null); + writer.WriteProperty(options, PropEstimatedSizeInBytes, value.EstimatedSizeInBytes, null, null); + writer.WriteProperty(options, PropLimitSize, value.LimitSize, null, null); + writer.WriteProperty(options, PropLimitSizeInBytes, value.LimitSizeInBytes, null, null); + writer.WriteProperty(options, PropOverhead, value.Overhead, null, null); + writer.WriteProperty(options, PropTripped, value.Tripped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.BreakerConverter))] public sealed partial class Breaker { +#if NET7_0_OR_GREATER + public Breaker() + { + } +#endif +#if !NET7_0_OR_GREATER + public Breaker() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Breaker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Estimated memory used for the operation. /// /// - [JsonInclude, JsonPropertyName("estimated_size")] - public string? EstimatedSize { get; init; } + public string? EstimatedSize { get; set; } /// /// /// Estimated memory used, in bytes, for the operation. /// /// - [JsonInclude, JsonPropertyName("estimated_size_in_bytes")] - public long? EstimatedSizeInBytes { get; init; } + public long? EstimatedSizeInBytes { get; set; } /// /// /// Memory limit for the circuit breaker. /// /// - [JsonInclude, JsonPropertyName("limit_size")] - public string? LimitSize { get; init; } + public string? LimitSize { get; set; } /// /// /// Memory limit, in bytes, for the circuit breaker. /// /// - [JsonInclude, JsonPropertyName("limit_size_in_bytes")] - public long? LimitSizeInBytes { get; init; } + public long? LimitSizeInBytes { get; set; } /// /// /// A constant that all estimates for the circuit breaker are multiplied with to calculate a final estimate. /// /// - [JsonInclude, JsonPropertyName("overhead")] - public float? Overhead { get; init; } + public float? Overhead { get; set; } /// /// /// Total number of times the circuit breaker has been triggered and prevented an out of memory error. /// /// - [JsonInclude, JsonPropertyName("tripped")] - public float? Tripped { get; init; } + public float? Tripped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cgroup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cgroup.g.cs index dbdd1a0c9e8..baf1b100a9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cgroup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cgroup.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CgroupConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText PropCpuacct = System.Text.Json.JsonEncodedText.Encode("cpuacct"); + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + + public override Elastic.Clients.Elasticsearch.Nodes.Cgroup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCpu = default; + LocalJsonValue propCpuacct = default; + LocalJsonValue propMemory = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCpu.TryReadProperty(ref reader, options, PropCpu, null)) + { + continue; + } + + if (propCpuacct.TryReadProperty(ref reader, options, PropCpuacct, null)) + { + continue; + } + + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Cgroup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cpu = propCpu.Value, + Cpuacct = propCpuacct.Value, + Memory = propMemory.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Cgroup value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCpu, value.Cpu, null, null); + writer.WriteProperty(options, PropCpuacct, value.Cpuacct, null, null); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CgroupConverter))] public sealed partial class Cgroup { +#if NET7_0_OR_GREATER + public Cgroup() + { + } +#endif +#if !NET7_0_OR_GREATER + public Cgroup() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Cgroup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about cpu control group for the node. /// /// - [JsonInclude, JsonPropertyName("cpu")] - public Elastic.Clients.Elasticsearch.Nodes.CgroupCpu? Cpu { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.CgroupCpu? Cpu { get; set; } /// /// /// Contains statistics about cpuacct control group for the node. /// /// - [JsonInclude, JsonPropertyName("cpuacct")] - public Elastic.Clients.Elasticsearch.Nodes.CpuAcct? Cpuacct { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.CpuAcct? Cpuacct { get; set; } /// /// /// Contains statistics about the memory control group for the node. /// /// - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.Nodes.CgroupMemory? Memory { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.CgroupMemory? Memory { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpu.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpu.g.cs index 5573b0965ef..e321961c21a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpu.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpu.g.cs @@ -17,47 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CgroupCpuConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCfsPeriodMicros = System.Text.Json.JsonEncodedText.Encode("cfs_period_micros"); + private static readonly System.Text.Json.JsonEncodedText PropCfsQuotaMicros = System.Text.Json.JsonEncodedText.Encode("cfs_quota_micros"); + private static readonly System.Text.Json.JsonEncodedText PropControlGroup = System.Text.Json.JsonEncodedText.Encode("control_group"); + private static readonly System.Text.Json.JsonEncodedText PropStat = System.Text.Json.JsonEncodedText.Encode("stat"); + + public override Elastic.Clients.Elasticsearch.Nodes.CgroupCpu Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCfsPeriodMicros = default; + LocalJsonValue propCfsQuotaMicros = default; + LocalJsonValue propControlGroup = default; + LocalJsonValue propStat = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCfsPeriodMicros.TryReadProperty(ref reader, options, PropCfsPeriodMicros, null)) + { + continue; + } + + if (propCfsQuotaMicros.TryReadProperty(ref reader, options, PropCfsQuotaMicros, null)) + { + continue; + } + + if (propControlGroup.TryReadProperty(ref reader, options, PropControlGroup, null)) + { + continue; + } + + if (propStat.TryReadProperty(ref reader, options, PropStat, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.CgroupCpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CfsPeriodMicros = propCfsPeriodMicros.Value, + CfsQuotaMicros = propCfsQuotaMicros.Value, + ControlGroup = propControlGroup.Value, + Stat = propStat.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.CgroupCpu value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCfsPeriodMicros, value.CfsPeriodMicros, null, null); + writer.WriteProperty(options, PropCfsQuotaMicros, value.CfsQuotaMicros, null, null); + writer.WriteProperty(options, PropControlGroup, value.ControlGroup, null, null); + writer.WriteProperty(options, PropStat, value.Stat, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CgroupCpuConverter))] public sealed partial class CgroupCpu { +#if NET7_0_OR_GREATER + public CgroupCpu() + { + } +#endif +#if !NET7_0_OR_GREATER + public CgroupCpu() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CgroupCpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The period of time, in microseconds, for how regularly all tasks in the same cgroup as the Elasticsearch process should have their access to CPU resources reallocated. /// /// - [JsonInclude, JsonPropertyName("cfs_period_micros")] - public int? CfsPeriodMicros { get; init; } + public int? CfsPeriodMicros { get; set; } /// /// /// The total amount of time, in microseconds, for which all tasks in the same cgroup as the Elasticsearch process can run during one period cfs_period_micros. /// /// - [JsonInclude, JsonPropertyName("cfs_quota_micros")] - public int? CfsQuotaMicros { get; init; } + public int? CfsQuotaMicros { get; set; } /// /// /// The cpu control group to which the Elasticsearch process belongs. /// /// - [JsonInclude, JsonPropertyName("control_group")] - public string? ControlGroup { get; init; } + public string? ControlGroup { get; set; } /// /// /// Contains CPU statistics for the node. /// /// - [JsonInclude, JsonPropertyName("stat")] - public Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStat? Stat { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStat? Stat { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpuStat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpuStat.g.cs index ed250976749..cb451e3d9dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpuStat.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupCpuStat.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CgroupCpuStatConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumberOfElapsedPeriods = System.Text.Json.JsonEncodedText.Encode("number_of_elapsed_periods"); + private static readonly System.Text.Json.JsonEncodedText PropNumberOfTimesThrottled = System.Text.Json.JsonEncodedText.Encode("number_of_times_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropTimeThrottledNanos = System.Text.Json.JsonEncodedText.Encode("time_throttled_nanos"); + + public override Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumberOfElapsedPeriods = default; + LocalJsonValue propNumberOfTimesThrottled = default; + LocalJsonValue propTimeThrottledNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumberOfElapsedPeriods.TryReadProperty(ref reader, options, PropNumberOfElapsedPeriods, null)) + { + continue; + } + + if (propNumberOfTimesThrottled.TryReadProperty(ref reader, options, PropNumberOfTimesThrottled, null)) + { + continue; + } + + if (propTimeThrottledNanos.TryReadProperty(ref reader, options, PropTimeThrottledNanos, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumberOfElapsedPeriods = propNumberOfElapsedPeriods.Value, + NumberOfTimesThrottled = propNumberOfTimesThrottled.Value, + TimeThrottledNanos = propTimeThrottledNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStat value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumberOfElapsedPeriods, value.NumberOfElapsedPeriods, null, null); + writer.WriteProperty(options, PropNumberOfTimesThrottled, value.NumberOfTimesThrottled, null, null); + writer.WriteProperty(options, PropTimeThrottledNanos, value.TimeThrottledNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CgroupCpuStatConverter))] public sealed partial class CgroupCpuStat { +#if NET7_0_OR_GREATER + public CgroupCpuStat() + { + } +#endif +#if !NET7_0_OR_GREATER + public CgroupCpuStat() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CgroupCpuStat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of reporting periods (as specified by cfs_period_micros) that have elapsed. /// /// - [JsonInclude, JsonPropertyName("number_of_elapsed_periods")] - public long? NumberOfElapsedPeriods { get; init; } + public long? NumberOfElapsedPeriods { get; set; } /// /// /// The number of times all tasks in the same cgroup as the Elasticsearch process have been throttled. /// /// - [JsonInclude, JsonPropertyName("number_of_times_throttled")] - public long? NumberOfTimesThrottled { get; init; } + public long? NumberOfTimesThrottled { get; set; } /// /// /// The total amount of time, in nanoseconds, for which all tasks in the same cgroup as the Elasticsearch process have been throttled. /// /// - [JsonInclude, JsonPropertyName("time_throttled_nanos")] - public long? TimeThrottledNanos { get; init; } + public System.TimeSpan? TimeThrottledNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupMemory.g.cs index 49c8355d6c0..56151811f56 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CgroupMemory.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CgroupMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropControlGroup = System.Text.Json.JsonEncodedText.Encode("control_group"); + private static readonly System.Text.Json.JsonEncodedText PropLimitInBytes = System.Text.Json.JsonEncodedText.Encode("limit_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsageInBytes = System.Text.Json.JsonEncodedText.Encode("usage_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.CgroupMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propControlGroup = default; + LocalJsonValue propLimitInBytes = default; + LocalJsonValue propUsageInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propControlGroup.TryReadProperty(ref reader, options, PropControlGroup, null)) + { + continue; + } + + if (propLimitInBytes.TryReadProperty(ref reader, options, PropLimitInBytes, null)) + { + continue; + } + + if (propUsageInBytes.TryReadProperty(ref reader, options, PropUsageInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.CgroupMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ControlGroup = propControlGroup.Value, + LimitInBytes = propLimitInBytes.Value, + UsageInBytes = propUsageInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.CgroupMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropControlGroup, value.ControlGroup, null, null); + writer.WriteProperty(options, PropLimitInBytes, value.LimitInBytes, null, null); + writer.WriteProperty(options, PropUsageInBytes, value.UsageInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CgroupMemoryConverter))] public sealed partial class CgroupMemory { +#if NET7_0_OR_GREATER + public CgroupMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + public CgroupMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CgroupMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The memory control group to which the Elasticsearch process belongs. /// /// - [JsonInclude, JsonPropertyName("control_group")] - public string? ControlGroup { get; init; } + public string? ControlGroup { get; set; } /// /// @@ -44,8 +113,7 @@ public sealed partial class CgroupMemory /// Any value that is too large to parse into a long almost certainly means no limit has been set for the cgroup. /// /// - [JsonInclude, JsonPropertyName("limit_in_bytes")] - public string? LimitInBytes { get; init; } + public string? LimitInBytes { get; set; } /// /// @@ -53,6 +121,5 @@ public sealed partial class CgroupMemory /// This value is stored as a string for consistency with limit_in_bytes. /// /// - [JsonInclude, JsonPropertyName("usage_in_bytes")] - public string? UsageInBytes { get; init; } + public string? UsageInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Client.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Client.g.cs index 0e92f7c3396..bdf388d08be 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Client.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Client.g.cs @@ -17,98 +17,230 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ClientConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAgent = System.Text.Json.JsonEncodedText.Encode("agent"); + private static readonly System.Text.Json.JsonEncodedText PropClosedTimeMillis = System.Text.Json.JsonEncodedText.Encode("closed_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropLastRequestTimeMillis = System.Text.Json.JsonEncodedText.Encode("last_request_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropLastUri = System.Text.Json.JsonEncodedText.Encode("last_uri"); + private static readonly System.Text.Json.JsonEncodedText PropLocalAddress = System.Text.Json.JsonEncodedText.Encode("local_address"); + private static readonly System.Text.Json.JsonEncodedText PropOpenedTimeMillis = System.Text.Json.JsonEncodedText.Encode("opened_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteAddress = System.Text.Json.JsonEncodedText.Encode("remote_address"); + private static readonly System.Text.Json.JsonEncodedText PropRequestCount = System.Text.Json.JsonEncodedText.Encode("request_count"); + private static readonly System.Text.Json.JsonEncodedText PropRequestSizeBytes = System.Text.Json.JsonEncodedText.Encode("request_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropXOpaqueId = System.Text.Json.JsonEncodedText.Encode("x_opaque_id"); + + public override Elastic.Clients.Elasticsearch.Nodes.Client Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAgent = default; + LocalJsonValue propClosedTimeMillis = default; + LocalJsonValue propId = default; + LocalJsonValue propLastRequestTimeMillis = default; + LocalJsonValue propLastUri = default; + LocalJsonValue propLocalAddress = default; + LocalJsonValue propOpenedTimeMillis = default; + LocalJsonValue propRemoteAddress = default; + LocalJsonValue propRequestCount = default; + LocalJsonValue propRequestSizeBytes = default; + LocalJsonValue propXOpaqueId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAgent.TryReadProperty(ref reader, options, PropAgent, null)) + { + continue; + } + + if (propClosedTimeMillis.TryReadProperty(ref reader, options, PropClosedTimeMillis, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propLastRequestTimeMillis.TryReadProperty(ref reader, options, PropLastRequestTimeMillis, null)) + { + continue; + } + + if (propLastUri.TryReadProperty(ref reader, options, PropLastUri, null)) + { + continue; + } + + if (propLocalAddress.TryReadProperty(ref reader, options, PropLocalAddress, null)) + { + continue; + } + + if (propOpenedTimeMillis.TryReadProperty(ref reader, options, PropOpenedTimeMillis, null)) + { + continue; + } + + if (propRemoteAddress.TryReadProperty(ref reader, options, PropRemoteAddress, null)) + { + continue; + } + + if (propRequestCount.TryReadProperty(ref reader, options, PropRequestCount, null)) + { + continue; + } + + if (propRequestSizeBytes.TryReadProperty(ref reader, options, PropRequestSizeBytes, null)) + { + continue; + } + + if (propXOpaqueId.TryReadProperty(ref reader, options, PropXOpaqueId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Client(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Agent = propAgent.Value, + ClosedTimeMillis = propClosedTimeMillis.Value, + Id = propId.Value, + LastRequestTimeMillis = propLastRequestTimeMillis.Value, + LastUri = propLastUri.Value, + LocalAddress = propLocalAddress.Value, + OpenedTimeMillis = propOpenedTimeMillis.Value, + RemoteAddress = propRemoteAddress.Value, + RequestCount = propRequestCount.Value, + RequestSizeBytes = propRequestSizeBytes.Value, + XOpaqueId = propXOpaqueId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Client value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAgent, value.Agent, null, null); + writer.WriteProperty(options, PropClosedTimeMillis, value.ClosedTimeMillis, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropLastRequestTimeMillis, value.LastRequestTimeMillis, null, null); + writer.WriteProperty(options, PropLastUri, value.LastUri, null, null); + writer.WriteProperty(options, PropLocalAddress, value.LocalAddress, null, null); + writer.WriteProperty(options, PropOpenedTimeMillis, value.OpenedTimeMillis, null, null); + writer.WriteProperty(options, PropRemoteAddress, value.RemoteAddress, null, null); + writer.WriteProperty(options, PropRequestCount, value.RequestCount, null, null); + writer.WriteProperty(options, PropRequestSizeBytes, value.RequestSizeBytes, null, null); + writer.WriteProperty(options, PropXOpaqueId, value.XOpaqueId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClientConverter))] public sealed partial class Client { +#if NET7_0_OR_GREATER + public Client() + { + } +#endif +#if !NET7_0_OR_GREATER + public Client() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Client(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Reported agent for the HTTP client. /// If unavailable, this property is not included in the response. /// /// - [JsonInclude, JsonPropertyName("agent")] - public string? Agent { get; init; } + public string? Agent { get; set; } /// /// /// Time at which the client closed the connection if the connection is closed. /// /// - [JsonInclude, JsonPropertyName("closed_time_millis")] - public long? ClosedTimeMillis { get; init; } + public long? ClosedTimeMillis { get; set; } /// /// /// Unique ID for the HTTP client. /// /// - [JsonInclude, JsonPropertyName("id")] - public long? Id { get; init; } + public long? Id { get; set; } /// /// /// Time of the most recent request from this client. /// /// - [JsonInclude, JsonPropertyName("last_request_time_millis")] - public long? LastRequestTimeMillis { get; init; } + public long? LastRequestTimeMillis { get; set; } /// /// /// The URI of the client’s most recent request. /// /// - [JsonInclude, JsonPropertyName("last_uri")] - public string? LastUri { get; init; } + public string? LastUri { get; set; } /// /// /// Local address for the HTTP connection. /// /// - [JsonInclude, JsonPropertyName("local_address")] - public string? LocalAddress { get; init; } + public string? LocalAddress { get; set; } /// /// /// Time at which the client opened the connection. /// /// - [JsonInclude, JsonPropertyName("opened_time_millis")] - public long? OpenedTimeMillis { get; init; } + public long? OpenedTimeMillis { get; set; } /// /// /// Remote address for the HTTP connection. /// /// - [JsonInclude, JsonPropertyName("remote_address")] - public string? RemoteAddress { get; init; } + public string? RemoteAddress { get; set; } /// /// /// Number of requests from this client. /// /// - [JsonInclude, JsonPropertyName("request_count")] - public long? RequestCount { get; init; } + public long? RequestCount { get; set; } /// /// /// Cumulative size in bytes of all requests from this client. /// /// - [JsonInclude, JsonPropertyName("request_size_bytes")] - public long? RequestSizeBytes { get; init; } + public long? RequestSizeBytes { get; set; } /// /// @@ -116,6 +248,5 @@ public sealed partial class Client /// If unavailable, this property is not included in the response. /// /// - [JsonInclude, JsonPropertyName("x_opaque_id")] - public string? XOpaqueId { get; init; } + public string? XOpaqueId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterAppliedStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterAppliedStats.g.cs index 184ca339b8a..b2aab8c7da8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterAppliedStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterAppliedStats.g.cs @@ -17,18 +17,69 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ClusterAppliedStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRecordings = System.Text.Json.JsonEncodedText.Encode("recordings"); + + public override Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propRecordings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRecordings.TryReadProperty(ref reader, options, PropRecordings, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Recordings = propRecordings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRecordings, value.Recordings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStatsConverter))] public sealed partial class ClusterAppliedStats { - [JsonInclude, JsonPropertyName("recordings")] - public IReadOnlyCollection? Recordings { get; init; } +#if NET7_0_OR_GREATER + public ClusterAppliedStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClusterAppliedStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterAppliedStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? Recordings { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateQueue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateQueue.g.cs index 0c83ff282b1..480530769fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateQueue.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateQueue.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ClusterStateQueueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCommitted = System.Text.Json.JsonEncodedText.Encode("committed"); + private static readonly System.Text.Json.JsonEncodedText PropPending = System.Text.Json.JsonEncodedText.Encode("pending"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCommitted = default; + LocalJsonValue propPending = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCommitted.TryReadProperty(ref reader, options, PropCommitted, null)) + { + continue; + } + + if (propPending.TryReadProperty(ref reader, options, PropPending, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Committed = propCommitted.Value, + Pending = propPending.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCommitted, value.Committed, null, null); + writer.WriteProperty(options, PropPending, value.Pending, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueueConverter))] public sealed partial class ClusterStateQueue { +#if NET7_0_OR_GREATER + public ClusterStateQueue() + { + } +#endif +#if !NET7_0_OR_GREATER + public ClusterStateQueue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterStateQueue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of committed cluster states in queue. /// /// - [JsonInclude, JsonPropertyName("committed")] - public long? Committed { get; init; } + public long? Committed { get; set; } /// /// /// Number of pending cluster states in queue. /// /// - [JsonInclude, JsonPropertyName("pending")] - public long? Pending { get; init; } + public long? Pending { get; set; } /// /// /// Total number of cluster states in queue. /// /// - [JsonInclude, JsonPropertyName("total")] - public long? Total { get; init; } + public long? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateUpdate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateUpdate.g.cs index 3a675dc1145..9c832de2c25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateUpdate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ClusterStateUpdate.g.cs @@ -17,65 +17,243 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ClusterStateUpdateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCommitTime = System.Text.Json.JsonEncodedText.Encode("commit_time"); + private static readonly System.Text.Json.JsonEncodedText PropCommitTimeMillis = System.Text.Json.JsonEncodedText.Encode("commit_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTime = System.Text.Json.JsonEncodedText.Encode("completion_time"); + private static readonly System.Text.Json.JsonEncodedText PropCompletionTimeMillis = System.Text.Json.JsonEncodedText.Encode("completion_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropComputationTime = System.Text.Json.JsonEncodedText.Encode("computation_time"); + private static readonly System.Text.Json.JsonEncodedText PropComputationTimeMillis = System.Text.Json.JsonEncodedText.Encode("computation_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropContextConstructionTime = System.Text.Json.JsonEncodedText.Encode("context_construction_time"); + private static readonly System.Text.Json.JsonEncodedText PropContextConstructionTimeMillis = System.Text.Json.JsonEncodedText.Encode("context_construction_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMasterApplyTime = System.Text.Json.JsonEncodedText.Encode("master_apply_time"); + private static readonly System.Text.Json.JsonEncodedText PropMasterApplyTimeMillis = System.Text.Json.JsonEncodedText.Encode("master_apply_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropNotificationTime = System.Text.Json.JsonEncodedText.Encode("notification_time"); + private static readonly System.Text.Json.JsonEncodedText PropNotificationTimeMillis = System.Text.Json.JsonEncodedText.Encode("notification_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropPublicationTime = System.Text.Json.JsonEncodedText.Encode("publication_time"); + private static readonly System.Text.Json.JsonEncodedText PropPublicationTimeMillis = System.Text.Json.JsonEncodedText.Encode("publication_time_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.ClusterStateUpdate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCommitTime = default; + LocalJsonValue propCommitTimeMillis = default; + LocalJsonValue propCompletionTime = default; + LocalJsonValue propCompletionTimeMillis = default; + LocalJsonValue propComputationTime = default; + LocalJsonValue propComputationTimeMillis = default; + LocalJsonValue propContextConstructionTime = default; + LocalJsonValue propContextConstructionTimeMillis = default; + LocalJsonValue propCount = default; + LocalJsonValue propMasterApplyTime = default; + LocalJsonValue propMasterApplyTimeMillis = default; + LocalJsonValue propNotificationTime = default; + LocalJsonValue propNotificationTimeMillis = default; + LocalJsonValue propPublicationTime = default; + LocalJsonValue propPublicationTimeMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCommitTime.TryReadProperty(ref reader, options, PropCommitTime, null)) + { + continue; + } + + if (propCommitTimeMillis.TryReadProperty(ref reader, options, PropCommitTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propCompletionTime.TryReadProperty(ref reader, options, PropCompletionTime, null)) + { + continue; + } + + if (propCompletionTimeMillis.TryReadProperty(ref reader, options, PropCompletionTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propComputationTime.TryReadProperty(ref reader, options, PropComputationTime, null)) + { + continue; + } + + if (propComputationTimeMillis.TryReadProperty(ref reader, options, PropComputationTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propContextConstructionTime.TryReadProperty(ref reader, options, PropContextConstructionTime, null)) + { + continue; + } + + if (propContextConstructionTimeMillis.TryReadProperty(ref reader, options, PropContextConstructionTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMasterApplyTime.TryReadProperty(ref reader, options, PropMasterApplyTime, null)) + { + continue; + } + + if (propMasterApplyTimeMillis.TryReadProperty(ref reader, options, PropMasterApplyTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propNotificationTime.TryReadProperty(ref reader, options, PropNotificationTime, null)) + { + continue; + } + + if (propNotificationTimeMillis.TryReadProperty(ref reader, options, PropNotificationTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propPublicationTime.TryReadProperty(ref reader, options, PropPublicationTime, null)) + { + continue; + } + + if (propPublicationTimeMillis.TryReadProperty(ref reader, options, PropPublicationTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ClusterStateUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CommitTime = propCommitTime.Value, + CommitTimeMillis = propCommitTimeMillis.Value, + CompletionTime = propCompletionTime.Value, + CompletionTimeMillis = propCompletionTimeMillis.Value, + ComputationTime = propComputationTime.Value, + ComputationTimeMillis = propComputationTimeMillis.Value, + ContextConstructionTime = propContextConstructionTime.Value, + ContextConstructionTimeMillis = propContextConstructionTimeMillis.Value, + Count = propCount.Value, + MasterApplyTime = propMasterApplyTime.Value, + MasterApplyTimeMillis = propMasterApplyTimeMillis.Value, + NotificationTime = propNotificationTime.Value, + NotificationTimeMillis = propNotificationTimeMillis.Value, + PublicationTime = propPublicationTime.Value, + PublicationTimeMillis = propPublicationTimeMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ClusterStateUpdate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCommitTime, value.CommitTime, null, null); + writer.WriteProperty(options, PropCommitTimeMillis, value.CommitTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropCompletionTime, value.CompletionTime, null, null); + writer.WriteProperty(options, PropCompletionTimeMillis, value.CompletionTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropComputationTime, value.ComputationTime, null, null); + writer.WriteProperty(options, PropComputationTimeMillis, value.ComputationTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropContextConstructionTime, value.ContextConstructionTime, null, null); + writer.WriteProperty(options, PropContextConstructionTimeMillis, value.ContextConstructionTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMasterApplyTime, value.MasterApplyTime, null, null); + writer.WriteProperty(options, PropMasterApplyTimeMillis, value.MasterApplyTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropNotificationTime, value.NotificationTime, null, null); + writer.WriteProperty(options, PropNotificationTimeMillis, value.NotificationTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropPublicationTime, value.PublicationTime, null, null); + writer.WriteProperty(options, PropPublicationTimeMillis, value.PublicationTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ClusterStateUpdateConverter))] public sealed partial class ClusterStateUpdate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterStateUpdate(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public ClusterStateUpdate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterStateUpdate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterStateUpdate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The cumulative amount of time spent waiting for a successful cluster state update to commit, which measures the time from the start of each publication until a majority of the master-eligible nodes have written the state to disk and confirmed the write to the elected master. /// /// - [JsonInclude, JsonPropertyName("commit_time")] - public Elastic.Clients.Elasticsearch.Duration? CommitTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? CommitTime { get; set; } /// /// /// The cumulative amount of time, in milliseconds, spent waiting for a successful cluster state update to commit, which measures the time from the start of each publication until a majority of the master-eligible nodes have written the state to disk and confirmed the write to the elected master. /// /// - [JsonInclude, JsonPropertyName("commit_time_millis")] - public long? CommitTimeMillis { get; init; } + public System.TimeSpan? CommitTimeMillis { get; set; } /// /// /// The cumulative amount of time spent waiting for a successful cluster state update to complete, which measures the time from the start of each publication until all the other nodes have notified the elected master that they have applied the cluster state. /// /// - [JsonInclude, JsonPropertyName("completion_time")] - public Elastic.Clients.Elasticsearch.Duration? CompletionTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? CompletionTime { get; set; } /// /// /// The cumulative amount of time, in milliseconds, spent waiting for a successful cluster state update to complete, which measures the time from the start of each publication until all the other nodes have notified the elected master that they have applied the cluster state. /// /// - [JsonInclude, JsonPropertyName("completion_time_millis")] - public long? CompletionTimeMillis { get; init; } + public System.TimeSpan? CompletionTimeMillis { get; set; } /// /// /// The cumulative amount of time spent computing no-op cluster state updates since the node started. /// /// - [JsonInclude, JsonPropertyName("computation_time")] - public Elastic.Clients.Elasticsearch.Duration? ComputationTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? ComputationTime { get; set; } /// /// /// The cumulative amount of time, in milliseconds, spent computing no-op cluster state updates since the node started. /// /// - [JsonInclude, JsonPropertyName("computation_time_millis")] - public long? ComputationTimeMillis { get; init; } + public System.TimeSpan? ComputationTimeMillis { get; set; } /// /// @@ -83,8 +261,7 @@ public sealed partial class ClusterStateUpdate /// This statistic includes the time spent computing the difference between the current and new cluster state preparing a serialized representation of this difference. /// /// - [JsonInclude, JsonPropertyName("context_construction_time")] - public Elastic.Clients.Elasticsearch.Duration? ContextConstructionTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? ContextConstructionTime { get; set; } /// /// @@ -92,48 +269,46 @@ public sealed partial class ClusterStateUpdate /// This statistic includes the time spent computing the difference between the current and new cluster state preparing a serialized representation of this difference. /// /// - [JsonInclude, JsonPropertyName("context_construction_time_millis")] - public long? ContextConstructionTimeMillis { get; init; } + public System.TimeSpan? ContextConstructionTimeMillis { get; set; } /// /// /// The number of cluster state update attempts that did not change the cluster state since the node started. /// /// - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// The cumulative amount of time spent successfully applying cluster state updates on the elected master since the node started. /// /// - [JsonInclude, JsonPropertyName("master_apply_time")] - public Elastic.Clients.Elasticsearch.Duration? MasterApplyTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? MasterApplyTime { get; set; } /// /// /// The cumulative amount of time, in milliseconds, spent successfully applying cluster state updates on the elected master since the node started. /// /// - [JsonInclude, JsonPropertyName("master_apply_time_millis")] - public long? MasterApplyTimeMillis { get; init; } + public System.TimeSpan? MasterApplyTimeMillis { get; set; } /// /// /// The cumulative amount of time spent notifying listeners of a no-op cluster state update since the node started. /// /// - [JsonInclude, JsonPropertyName("notification_time")] - public Elastic.Clients.Elasticsearch.Duration? NotificationTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? NotificationTime { get; set; } /// /// /// The cumulative amount of time, in milliseconds, spent notifying listeners of a no-op cluster state update since the node started. /// /// - [JsonInclude, JsonPropertyName("notification_time_millis")] - public long? NotificationTimeMillis { get; init; } + public System.TimeSpan? NotificationTimeMillis { get; set; } /// /// @@ -141,8 +316,7 @@ public sealed partial class ClusterStateUpdate /// This includes the time measured by context_construction_time, commit_time, completion_time and master_apply_time. /// /// - [JsonInclude, JsonPropertyName("publication_time")] - public Elastic.Clients.Elasticsearch.Duration? PublicationTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? PublicationTime { get; set; } /// /// @@ -150,6 +324,5 @@ public sealed partial class ClusterStateUpdate /// This includes the time measured by context_construction_time, commit_time, completion_time and master_apply_time. /// /// - [JsonInclude, JsonPropertyName("publication_time_millis")] - public long? PublicationTimeMillis { get; init; } + public System.TimeSpan? PublicationTimeMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Context.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Context.g.cs index 0a2e66b9b87..b2545231f48 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Context.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Context.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ContextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheEvictions = System.Text.Json.JsonEncodedText.Encode("cache_evictions"); + private static readonly System.Text.Json.JsonEncodedText PropCompilationLimitTriggered = System.Text.Json.JsonEncodedText.Encode("compilation_limit_triggered"); + private static readonly System.Text.Json.JsonEncodedText PropCompilations = System.Text.Json.JsonEncodedText.Encode("compilations"); + private static readonly System.Text.Json.JsonEncodedText PropContext2 = System.Text.Json.JsonEncodedText.Encode("context"); + + public override Elastic.Clients.Elasticsearch.Nodes.Context Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheEvictions = default; + LocalJsonValue propCompilationLimitTriggered = default; + LocalJsonValue propCompilations = default; + LocalJsonValue propContext2 = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheEvictions.TryReadProperty(ref reader, options, PropCacheEvictions, null)) + { + continue; + } + + if (propCompilationLimitTriggered.TryReadProperty(ref reader, options, PropCompilationLimitTriggered, null)) + { + continue; + } + + if (propCompilations.TryReadProperty(ref reader, options, PropCompilations, null)) + { + continue; + } + + if (propContext2.TryReadProperty(ref reader, options, PropContext2, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Context(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheEvictions = propCacheEvictions.Value, + CompilationLimitTriggered = propCompilationLimitTriggered.Value, + Compilations = propCompilations.Value, + Context2 = propContext2.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Context value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheEvictions, value.CacheEvictions, null, null); + writer.WriteProperty(options, PropCompilationLimitTriggered, value.CompilationLimitTriggered, null, null); + writer.WriteProperty(options, PropCompilations, value.Compilations, null, null); + writer.WriteProperty(options, PropContext2, value.Context2, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ContextConverter))] public sealed partial class Context { - [JsonInclude, JsonPropertyName("cache_evictions")] - public long? CacheEvictions { get; init; } - [JsonInclude, JsonPropertyName("compilation_limit_triggered")] - public long? CompilationLimitTriggered { get; init; } - [JsonInclude, JsonPropertyName("compilations")] - public long? Compilations { get; init; } - [JsonInclude, JsonPropertyName("context")] - public string? Context2 { get; init; } +#if NET7_0_OR_GREATER + public Context() + { + } +#endif +#if !NET7_0_OR_GREATER + public Context() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Context(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? CacheEvictions { get; set; } + public long? CompilationLimitTriggered { get; set; } + public long? Compilations { get; set; } + public string? Context2 { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cpu.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cpu.g.cs index 42ccf0f102b..276e918336c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cpu.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Cpu.g.cs @@ -17,32 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CpuConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLoadAverage = System.Text.Json.JsonEncodedText.Encode("load_average"); + private static readonly System.Text.Json.JsonEncodedText PropPercent = System.Text.Json.JsonEncodedText.Encode("percent"); + private static readonly System.Text.Json.JsonEncodedText PropSys = System.Text.Json.JsonEncodedText.Encode("sys"); + private static readonly System.Text.Json.JsonEncodedText PropSysInMillis = System.Text.Json.JsonEncodedText.Encode("sys_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInMillis = System.Text.Json.JsonEncodedText.Encode("total_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + private static readonly System.Text.Json.JsonEncodedText PropUserInMillis = System.Text.Json.JsonEncodedText.Encode("user_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.Cpu Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propLoadAverage = default; + LocalJsonValue propPercent = default; + LocalJsonValue propSys = default; + LocalJsonValue propSysInMillis = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInMillis = default; + LocalJsonValue propUser = default; + LocalJsonValue propUserInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLoadAverage.TryReadProperty(ref reader, options, PropLoadAverage, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPercent.TryReadProperty(ref reader, options, PropPercent, null)) + { + continue; + } + + if (propSys.TryReadProperty(ref reader, options, PropSys, null)) + { + continue; + } + + if (propSysInMillis.TryReadProperty(ref reader, options, PropSysInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInMillis.TryReadProperty(ref reader, options, PropTotalInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (propUserInMillis.TryReadProperty(ref reader, options, PropUserInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Cpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + LoadAverage = propLoadAverage.Value, + Percent = propPercent.Value, + Sys = propSys.Value, + SysInMillis = propSysInMillis.Value, + Total = propTotal.Value, + TotalInMillis = propTotalInMillis.Value, + User = propUser.Value, + UserInMillis = propUserInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Cpu value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLoadAverage, value.LoadAverage, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPercent, value.Percent, null, null); + writer.WriteProperty(options, PropSys, value.Sys, null, null); + writer.WriteProperty(options, PropSysInMillis, value.SysInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInMillis, value.TotalInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteProperty(options, PropUserInMillis, value.UserInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CpuConverter))] public sealed partial class Cpu { - [JsonInclude, JsonPropertyName("load_average")] - public IReadOnlyDictionary? LoadAverage { get; init; } - [JsonInclude, JsonPropertyName("percent")] - public int? Percent { get; init; } - [JsonInclude, JsonPropertyName("sys")] - public Elastic.Clients.Elasticsearch.Duration? Sys { get; init; } - [JsonInclude, JsonPropertyName("sys_in_millis")] - public long? SysInMillis { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Duration? Total { get; init; } - [JsonInclude, JsonPropertyName("total_in_millis")] - public long? TotalInMillis { get; init; } - [JsonInclude, JsonPropertyName("user")] - public Elastic.Clients.Elasticsearch.Duration? User { get; init; } - [JsonInclude, JsonPropertyName("user_in_millis")] - public long? UserInMillis { get; init; } +#if NET7_0_OR_GREATER + public Cpu() + { + } +#endif +#if !NET7_0_OR_GREATER + public Cpu() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Cpu(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? LoadAverage { get; set; } + public int? Percent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Sys { get; set; } + public System.TimeSpan? SysInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Total { get; set; } + public System.TimeSpan? TotalInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? User { get; set; } + public System.TimeSpan? UserInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CpuAcct.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CpuAcct.g.cs index 7be66a203e6..6fe40b1d472 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CpuAcct.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/CpuAcct.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class CpuAcctConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropControlGroup = System.Text.Json.JsonEncodedText.Encode("control_group"); + private static readonly System.Text.Json.JsonEncodedText PropUsageNanos = System.Text.Json.JsonEncodedText.Encode("usage_nanos"); + + public override Elastic.Clients.Elasticsearch.Nodes.CpuAcct Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propControlGroup = default; + LocalJsonValue propUsageNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propControlGroup.TryReadProperty(ref reader, options, PropControlGroup, null)) + { + continue; + } + + if (propUsageNanos.TryReadProperty(ref reader, options, PropUsageNanos, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.CpuAcct(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ControlGroup = propControlGroup.Value, + UsageNanos = propUsageNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.CpuAcct value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropControlGroup, value.ControlGroup, null, null); + writer.WriteProperty(options, PropUsageNanos, value.UsageNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.CpuAcctConverter))] public sealed partial class CpuAcct { +#if NET7_0_OR_GREATER + public CpuAcct() + { + } +#endif +#if !NET7_0_OR_GREATER + public CpuAcct() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CpuAcct(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The cpuacct control group to which the Elasticsearch process belongs. /// /// - [JsonInclude, JsonPropertyName("control_group")] - public string? ControlGroup { get; init; } + public string? ControlGroup { get; set; } /// /// /// The total CPU time, in nanoseconds, consumed by all tasks in the same cgroup as the Elasticsearch process. /// /// - [JsonInclude, JsonPropertyName("usage_nanos")] - public long? UsageNanos { get; init; } + public System.TimeSpan? UsageNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DataPathStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DataPathStats.g.cs index 051acae57e8..4fafe3c6ffd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DataPathStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DataPathStats.g.cs @@ -17,101 +17,272 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class DataPathStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropAvailableInBytes = System.Text.Json.JsonEncodedText.Encode("available_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropDiskQueue = System.Text.Json.JsonEncodedText.Encode("disk_queue"); + private static readonly System.Text.Json.JsonEncodedText PropDiskReads = System.Text.Json.JsonEncodedText.Encode("disk_reads"); + private static readonly System.Text.Json.JsonEncodedText PropDiskReadSize = System.Text.Json.JsonEncodedText.Encode("disk_read_size"); + private static readonly System.Text.Json.JsonEncodedText PropDiskReadSizeInBytes = System.Text.Json.JsonEncodedText.Encode("disk_read_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropDiskWrites = System.Text.Json.JsonEncodedText.Encode("disk_writes"); + private static readonly System.Text.Json.JsonEncodedText PropDiskWriteSize = System.Text.Json.JsonEncodedText.Encode("disk_write_size"); + private static readonly System.Text.Json.JsonEncodedText PropDiskWriteSizeInBytes = System.Text.Json.JsonEncodedText.Encode("disk_write_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFree = System.Text.Json.JsonEncodedText.Encode("free"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMount = System.Text.Json.JsonEncodedText.Encode("mount"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.DataPathStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propAvailableInBytes = default; + LocalJsonValue propDiskQueue = default; + LocalJsonValue propDiskReads = default; + LocalJsonValue propDiskReadSize = default; + LocalJsonValue propDiskReadSizeInBytes = default; + LocalJsonValue propDiskWrites = default; + LocalJsonValue propDiskWriteSize = default; + LocalJsonValue propDiskWriteSizeInBytes = default; + LocalJsonValue propFree = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propMount = default; + LocalJsonValue propPath = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInBytes = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propAvailableInBytes.TryReadProperty(ref reader, options, PropAvailableInBytes, null)) + { + continue; + } + + if (propDiskQueue.TryReadProperty(ref reader, options, PropDiskQueue, null)) + { + continue; + } + + if (propDiskReads.TryReadProperty(ref reader, options, PropDiskReads, null)) + { + continue; + } + + if (propDiskReadSize.TryReadProperty(ref reader, options, PropDiskReadSize, null)) + { + continue; + } + + if (propDiskReadSizeInBytes.TryReadProperty(ref reader, options, PropDiskReadSizeInBytes, null)) + { + continue; + } + + if (propDiskWrites.TryReadProperty(ref reader, options, PropDiskWrites, null)) + { + continue; + } + + if (propDiskWriteSize.TryReadProperty(ref reader, options, PropDiskWriteSize, null)) + { + continue; + } + + if (propDiskWriteSizeInBytes.TryReadProperty(ref reader, options, PropDiskWriteSizeInBytes, null)) + { + continue; + } + + if (propFree.TryReadProperty(ref reader, options, PropFree, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propMount.TryReadProperty(ref reader, options, PropMount, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.DataPathStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + AvailableInBytes = propAvailableInBytes.Value, + DiskQueue = propDiskQueue.Value, + DiskReads = propDiskReads.Value, + DiskReadSize = propDiskReadSize.Value, + DiskReadSizeInBytes = propDiskReadSizeInBytes.Value, + DiskWrites = propDiskWrites.Value, + DiskWriteSize = propDiskWriteSize.Value, + DiskWriteSizeInBytes = propDiskWriteSizeInBytes.Value, + Free = propFree.Value, + FreeInBytes = propFreeInBytes.Value, + Mount = propMount.Value, + Path = propPath.Value, + Total = propTotal.Value, + TotalInBytes = propTotalInBytes.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.DataPathStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropAvailableInBytes, value.AvailableInBytes, null, null); + writer.WriteProperty(options, PropDiskQueue, value.DiskQueue, null, null); + writer.WriteProperty(options, PropDiskReads, value.DiskReads, null, null); + writer.WriteProperty(options, PropDiskReadSize, value.DiskReadSize, null, null); + writer.WriteProperty(options, PropDiskReadSizeInBytes, value.DiskReadSizeInBytes, null, null); + writer.WriteProperty(options, PropDiskWrites, value.DiskWrites, null, null); + writer.WriteProperty(options, PropDiskWriteSize, value.DiskWriteSize, null, null); + writer.WriteProperty(options, PropDiskWriteSizeInBytes, value.DiskWriteSizeInBytes, null, null); + writer.WriteProperty(options, PropFree, value.Free, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropMount, value.Mount, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.DataPathStatsConverter))] public sealed partial class DataPathStats { +#if NET7_0_OR_GREATER + public DataPathStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public DataPathStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataPathStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total amount of disk space available to this Java virtual machine on this file store. /// /// - [JsonInclude, JsonPropertyName("available")] - public string? Available { get; init; } + public string? Available { get; set; } /// /// /// Total number of bytes available to this Java virtual machine on this file store. /// /// - [JsonInclude, JsonPropertyName("available_in_bytes")] - public long? AvailableInBytes { get; init; } - [JsonInclude, JsonPropertyName("disk_queue")] - public string? DiskQueue { get; init; } - [JsonInclude, JsonPropertyName("disk_reads")] - public long? DiskReads { get; init; } - [JsonInclude, JsonPropertyName("disk_read_size")] - public string? DiskReadSize { get; init; } - [JsonInclude, JsonPropertyName("disk_read_size_in_bytes")] - public long? DiskReadSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("disk_writes")] - public long? DiskWrites { get; init; } - [JsonInclude, JsonPropertyName("disk_write_size")] - public string? DiskWriteSize { get; init; } - [JsonInclude, JsonPropertyName("disk_write_size_in_bytes")] - public long? DiskWriteSizeInBytes { get; init; } + public long? AvailableInBytes { get; set; } + public string? DiskQueue { get; set; } + public long? DiskReads { get; set; } + public string? DiskReadSize { get; set; } + public long? DiskReadSizeInBytes { get; set; } + public long? DiskWrites { get; set; } + public string? DiskWriteSize { get; set; } + public long? DiskWriteSizeInBytes { get; set; } /// /// /// Total amount of unallocated disk space in the file store. /// /// - [JsonInclude, JsonPropertyName("free")] - public string? Free { get; init; } + public string? Free { get; set; } /// /// /// Total number of unallocated bytes in the file store. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long? FreeInBytes { get; init; } + public long? FreeInBytes { get; set; } /// /// /// Mount point of the file store (for example: /dev/sda2). /// /// - [JsonInclude, JsonPropertyName("mount")] - public string? Mount { get; init; } + public string? Mount { get; set; } /// /// /// Path to the file store. /// /// - [JsonInclude, JsonPropertyName("path")] - public string? Path { get; init; } + public string? Path { get; set; } /// /// /// Total size of the file store. /// /// - [JsonInclude, JsonPropertyName("total")] - public string? Total { get; init; } + public string? Total { get; set; } /// /// /// Total size of the file store in bytes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long? TotalInBytes { get; init; } + public long? TotalInBytes { get; set; } /// /// /// Type of the file store (ex: ext4). /// /// - [JsonInclude, JsonPropertyName("type")] - public string? Type { get; init; } + public string? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DeprecationIndexing.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DeprecationIndexing.g.cs index dd91cb8eef7..d73c1f7644f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DeprecationIndexing.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/DeprecationIndexing.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class DeprecationIndexingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexing Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, static Elastic.Clients.Elasticsearch.Union (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexing(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexing value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexingConverter))] public sealed partial class DeprecationIndexing { - [JsonInclude, JsonPropertyName("enabled")] - public object Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeprecationIndexing(Elastic.Clients.Elasticsearch.Union enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public DeprecationIndexing() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DeprecationIndexing() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DeprecationIndexing(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Union Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Discovery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Discovery.g.cs index 67c3e3b670a..0c6c164c6e7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Discovery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Discovery.g.cs @@ -17,28 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class DiscoveryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusterApplierStats = System.Text.Json.JsonEncodedText.Encode("cluster_applier_stats"); + private static readonly System.Text.Json.JsonEncodedText PropClusterStateQueue = System.Text.Json.JsonEncodedText.Encode("cluster_state_queue"); + private static readonly System.Text.Json.JsonEncodedText PropClusterStateUpdate = System.Text.Json.JsonEncodedText.Encode("cluster_state_update"); + private static readonly System.Text.Json.JsonEncodedText PropPublishedClusterStates = System.Text.Json.JsonEncodedText.Encode("published_cluster_states"); + private static readonly System.Text.Json.JsonEncodedText PropSerializedClusterStates = System.Text.Json.JsonEncodedText.Encode("serialized_cluster_states"); + + public override Elastic.Clients.Elasticsearch.Nodes.Discovery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusterApplierStats = default; + LocalJsonValue propClusterStateQueue = default; + LocalJsonValue?> propClusterStateUpdate = default; + LocalJsonValue propPublishedClusterStates = default; + LocalJsonValue propSerializedClusterStates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusterApplierStats.TryReadProperty(ref reader, options, PropClusterApplierStats, null)) + { + continue; + } + + if (propClusterStateQueue.TryReadProperty(ref reader, options, PropClusterStateQueue, null)) + { + continue; + } + + if (propClusterStateUpdate.TryReadProperty(ref reader, options, PropClusterStateUpdate, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPublishedClusterStates.TryReadProperty(ref reader, options, PropPublishedClusterStates, null)) + { + continue; + } + + if (propSerializedClusterStates.TryReadProperty(ref reader, options, PropSerializedClusterStates, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Discovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ClusterApplierStats = propClusterApplierStats.Value, + ClusterStateQueue = propClusterStateQueue.Value, + ClusterStateUpdate = propClusterStateUpdate.Value, + PublishedClusterStates = propPublishedClusterStates.Value, + SerializedClusterStates = propSerializedClusterStates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Discovery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusterApplierStats, value.ClusterApplierStats, null, null); + writer.WriteProperty(options, PropClusterStateQueue, value.ClusterStateQueue, null, null); + writer.WriteProperty(options, PropClusterStateUpdate, value.ClusterStateUpdate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPublishedClusterStates, value.PublishedClusterStates, null, null); + writer.WriteProperty(options, PropSerializedClusterStates, value.SerializedClusterStates, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.DiscoveryConverter))] public sealed partial class Discovery { - [JsonInclude, JsonPropertyName("cluster_applier_stats")] - public Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStats? ClusterApplierStats { get; init; } +#if NET7_0_OR_GREATER + public Discovery() + { + } +#endif +#if !NET7_0_OR_GREATER + public Discovery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Discovery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.ClusterAppliedStats? ClusterApplierStats { get; set; } /// /// /// Contains statistics for the cluster state queue of the node. /// /// - [JsonInclude, JsonPropertyName("cluster_state_queue")] - public Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueue? ClusterStateQueue { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.ClusterStateQueue? ClusterStateQueue { get; set; } /// /// @@ -48,16 +134,13 @@ public sealed partial class Discovery /// The human-readable fields with a _time suffix are only returned if requested with the ?human=true query parameter. /// /// - [JsonInclude, JsonPropertyName("cluster_state_update")] - public IReadOnlyDictionary? ClusterStateUpdate { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? ClusterStateUpdate { get; set; } /// /// /// Contains statistics for the published cluster states of the node. /// /// - [JsonInclude, JsonPropertyName("published_cluster_states")] - public Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStates? PublishedClusterStates { get; init; } - [JsonInclude, JsonPropertyName("serialized_cluster_states")] - public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterState? SerializedClusterStates { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStates? PublishedClusterStates { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterState? SerializedClusterStates { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ExtendedMemoryStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ExtendedMemoryStats.g.cs index 38aa4ffd6ad..e24f5239b10 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ExtendedMemoryStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ExtendedMemoryStats.g.cs @@ -17,76 +17,215 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ExtendedMemoryStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdjustedTotalInBytes = System.Text.Json.JsonEncodedText.Encode("adjusted_total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreePercent = System.Text.Json.JsonEncodedText.Encode("free_percent"); + private static readonly System.Text.Json.JsonEncodedText PropResident = System.Text.Json.JsonEncodedText.Encode("resident"); + private static readonly System.Text.Json.JsonEncodedText PropResidentInBytes = System.Text.Json.JsonEncodedText.Encode("resident_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropShare = System.Text.Json.JsonEncodedText.Encode("share"); + private static readonly System.Text.Json.JsonEncodedText PropShareInBytes = System.Text.Json.JsonEncodedText.Encode("share_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalVirtual = System.Text.Json.JsonEncodedText.Encode("total_virtual"); + private static readonly System.Text.Json.JsonEncodedText PropTotalVirtualInBytes = System.Text.Json.JsonEncodedText.Encode("total_virtual_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedInBytes = System.Text.Json.JsonEncodedText.Encode("used_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedPercent = System.Text.Json.JsonEncodedText.Encode("used_percent"); + + public override Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdjustedTotalInBytes = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propFreePercent = default; + LocalJsonValue propResident = default; + LocalJsonValue propResidentInBytes = default; + LocalJsonValue propShare = default; + LocalJsonValue propShareInBytes = default; + LocalJsonValue propTotalInBytes = default; + LocalJsonValue propTotalVirtual = default; + LocalJsonValue propTotalVirtualInBytes = default; + LocalJsonValue propUsedInBytes = default; + LocalJsonValue propUsedPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdjustedTotalInBytes.TryReadProperty(ref reader, options, PropAdjustedTotalInBytes, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propFreePercent.TryReadProperty(ref reader, options, PropFreePercent, null)) + { + continue; + } + + if (propResident.TryReadProperty(ref reader, options, PropResident, null)) + { + continue; + } + + if (propResidentInBytes.TryReadProperty(ref reader, options, PropResidentInBytes, null)) + { + continue; + } + + if (propShare.TryReadProperty(ref reader, options, PropShare, null)) + { + continue; + } + + if (propShareInBytes.TryReadProperty(ref reader, options, PropShareInBytes, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (propTotalVirtual.TryReadProperty(ref reader, options, PropTotalVirtual, null)) + { + continue; + } + + if (propTotalVirtualInBytes.TryReadProperty(ref reader, options, PropTotalVirtualInBytes, null)) + { + continue; + } + + if (propUsedInBytes.TryReadProperty(ref reader, options, PropUsedInBytes, null)) + { + continue; + } + + if (propUsedPercent.TryReadProperty(ref reader, options, PropUsedPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdjustedTotalInBytes = propAdjustedTotalInBytes.Value, + FreeInBytes = propFreeInBytes.Value, + FreePercent = propFreePercent.Value, + Resident = propResident.Value, + ResidentInBytes = propResidentInBytes.Value, + Share = propShare.Value, + ShareInBytes = propShareInBytes.Value, + TotalInBytes = propTotalInBytes.Value, + TotalVirtual = propTotalVirtual.Value, + TotalVirtualInBytes = propTotalVirtualInBytes.Value, + UsedInBytes = propUsedInBytes.Value, + UsedPercent = propUsedPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdjustedTotalInBytes, value.AdjustedTotalInBytes, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropFreePercent, value.FreePercent, null, null); + writer.WriteProperty(options, PropResident, value.Resident, null, null); + writer.WriteProperty(options, PropResidentInBytes, value.ResidentInBytes, null, null); + writer.WriteProperty(options, PropShare, value.Share, null, null); + writer.WriteProperty(options, PropShareInBytes, value.ShareInBytes, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteProperty(options, PropTotalVirtual, value.TotalVirtual, null, null); + writer.WriteProperty(options, PropTotalVirtualInBytes, value.TotalVirtualInBytes, null, null); + writer.WriteProperty(options, PropUsedInBytes, value.UsedInBytes, null, null); + writer.WriteProperty(options, PropUsedPercent, value.UsedPercent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStatsConverter))] public sealed partial class ExtendedMemoryStats { +#if NET7_0_OR_GREATER + public ExtendedMemoryStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public ExtendedMemoryStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExtendedMemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the amount of physical memory has been overridden using the es.total_memory_bytes system property then this reports the overridden value in bytes. /// Otherwise it reports the same value as total_in_bytes. /// /// - [JsonInclude, JsonPropertyName("adjusted_total_in_bytes")] - public long? AdjustedTotalInBytes { get; init; } + public long? AdjustedTotalInBytes { get; set; } /// /// /// Amount of free physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long? FreeInBytes { get; init; } + public long? FreeInBytes { get; set; } /// /// /// Percentage of free memory. /// /// - [JsonInclude, JsonPropertyName("free_percent")] - public int? FreePercent { get; init; } - [JsonInclude, JsonPropertyName("resident")] - public string? Resident { get; init; } - [JsonInclude, JsonPropertyName("resident_in_bytes")] - public long? ResidentInBytes { get; init; } - [JsonInclude, JsonPropertyName("share")] - public string? Share { get; init; } - [JsonInclude, JsonPropertyName("share_in_bytes")] - public long? ShareInBytes { get; init; } + public int? FreePercent { get; set; } + public string? Resident { get; set; } + public long? ResidentInBytes { get; set; } + public string? Share { get; set; } + public long? ShareInBytes { get; set; } /// /// /// Total amount of physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long? TotalInBytes { get; init; } - [JsonInclude, JsonPropertyName("total_virtual")] - public string? TotalVirtual { get; init; } - [JsonInclude, JsonPropertyName("total_virtual_in_bytes")] - public long? TotalVirtualInBytes { get; init; } + public long? TotalInBytes { get; set; } + public string? TotalVirtual { get; set; } + public long? TotalVirtualInBytes { get; set; } /// /// /// Amount of used physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("used_in_bytes")] - public long? UsedInBytes { get; init; } + public long? UsedInBytes { get; set; } /// /// /// Percentage of used memory. /// /// - [JsonInclude, JsonPropertyName("used_percent")] - public int? UsedPercent { get; init; } + public int? UsedPercent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystem.g.cs index 49c11657ba0..13c9c18f141 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystem.g.cs @@ -17,33 +17,110 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class FileSystemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropIoStats = System.Text.Json.JsonEncodedText.Encode("io_stats"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Nodes.FileSystem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propData = default; + LocalJsonValue propIoStats = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIoStats.TryReadProperty(ref reader, options, PropIoStats, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.FileSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + IoStats = propIoStats.Value, + Timestamp = propTimestamp.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.FileSystem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIoStats, value.IoStats, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.FileSystemConverter))] public sealed partial class FileSystem { +#if NET7_0_OR_GREATER + public FileSystem() + { + } +#endif +#if !NET7_0_OR_GREATER + public FileSystem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// List of all file stores. /// /// - [JsonInclude, JsonPropertyName("data")] - public IReadOnlyCollection? Data { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Data { get; set; } /// /// /// Contains I/O statistics for the node. /// /// - [JsonInclude, JsonPropertyName("io_stats")] - public Elastic.Clients.Elasticsearch.Nodes.IoStats? IoStats { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.IoStats? IoStats { get; set; } /// /// @@ -51,14 +128,12 @@ public sealed partial class FileSystem /// Recorded in milliseconds since the Unix Epoch. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } + public long? Timestamp { get; set; } /// /// /// Contains statistics for all file stores of the node. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Nodes.FileSystemTotal? Total { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.FileSystemTotal? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystemTotal.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystemTotal.g.cs index 2e297dcc9bf..62fa4708641 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystemTotal.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/FileSystemTotal.g.cs @@ -17,18 +17,115 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class FileSystemTotalConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropAvailableInBytes = System.Text.Json.JsonEncodedText.Encode("available_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFree = System.Text.Json.JsonEncodedText.Encode("free"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.FileSystemTotal Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propAvailableInBytes = default; + LocalJsonValue propFree = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propAvailableInBytes.TryReadProperty(ref reader, options, PropAvailableInBytes, null)) + { + continue; + } + + if (propFree.TryReadProperty(ref reader, options, PropFree, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.FileSystemTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + AvailableInBytes = propAvailableInBytes.Value, + Free = propFree.Value, + FreeInBytes = propFreeInBytes.Value, + Total = propTotal.Value, + TotalInBytes = propTotalInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.FileSystemTotal value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropAvailableInBytes, value.AvailableInBytes, null, null); + writer.WriteProperty(options, PropFree, value.Free, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.FileSystemTotalConverter))] public sealed partial class FileSystemTotal { +#if NET7_0_OR_GREATER + public FileSystemTotal() + { + } +#endif +#if !NET7_0_OR_GREATER + public FileSystemTotal() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileSystemTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total disk space available to this Java virtual machine on all file stores. @@ -36,8 +133,7 @@ public sealed partial class FileSystemTotal /// This is the actual amount of free disk space the Elasticsearch node can utilise. /// /// - [JsonInclude, JsonPropertyName("available")] - public string? Available { get; init; } + public string? Available { get; set; } /// /// @@ -46,38 +142,33 @@ public sealed partial class FileSystemTotal /// This is the actual amount of free disk space the Elasticsearch node can utilise. /// /// - [JsonInclude, JsonPropertyName("available_in_bytes")] - public long? AvailableInBytes { get; init; } + public long? AvailableInBytes { get; set; } /// /// /// Total unallocated disk space in all file stores. /// /// - [JsonInclude, JsonPropertyName("free")] - public string? Free { get; init; } + public string? Free { get; set; } /// /// /// Total number of unallocated bytes in all file stores. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long? FreeInBytes { get; init; } + public long? FreeInBytes { get; set; } /// /// /// Total size of all file stores. /// /// - [JsonInclude, JsonPropertyName("total")] - public string? Total { get; init; } + public string? Total { get; set; } /// /// /// Total size of all file stores in bytes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long? TotalInBytes { get; init; } + public long? TotalInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollector.g.cs index 44cb1134a22..4bafb501675 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollector.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollector.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class GarbageCollectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollectors = System.Text.Json.JsonEncodedText.Encode("collectors"); + + public override Elastic.Clients.Elasticsearch.Nodes.GarbageCollector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCollectors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollectors.TryReadProperty(ref reader, options, PropCollectors, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.GarbageCollector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collectors = propCollectors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.GarbageCollector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollectors, value.Collectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.GarbageCollectorConverter))] public sealed partial class GarbageCollector { +#if NET7_0_OR_GREATER + public GarbageCollector() + { + } +#endif +#if !NET7_0_OR_GREATER + public GarbageCollector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GarbageCollector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about JVM garbage collectors for the node. /// /// - [JsonInclude, JsonPropertyName("collectors")] - public IReadOnlyDictionary? Collectors { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Collectors { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollectorTotal.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollectorTotal.g.cs index 5597b632c34..0167567d61a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollectorTotal.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/GarbageCollectorTotal.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class GarbageCollectorTotalConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollectionCount = System.Text.Json.JsonEncodedText.Encode("collection_count"); + private static readonly System.Text.Json.JsonEncodedText PropCollectionTime = System.Text.Json.JsonEncodedText.Encode("collection_time"); + private static readonly System.Text.Json.JsonEncodedText PropCollectionTimeInMillis = System.Text.Json.JsonEncodedText.Encode("collection_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.GarbageCollectorTotal Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollectionCount = default; + LocalJsonValue propCollectionTime = default; + LocalJsonValue propCollectionTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollectionCount.TryReadProperty(ref reader, options, PropCollectionCount, null)) + { + continue; + } + + if (propCollectionTime.TryReadProperty(ref reader, options, PropCollectionTime, null)) + { + continue; + } + + if (propCollectionTimeInMillis.TryReadProperty(ref reader, options, PropCollectionTimeInMillis, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.GarbageCollectorTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CollectionCount = propCollectionCount.Value, + CollectionTime = propCollectionTime.Value, + CollectionTimeInMillis = propCollectionTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.GarbageCollectorTotal value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollectionCount, value.CollectionCount, null, null); + writer.WriteProperty(options, PropCollectionTime, value.CollectionTime, null, null); + writer.WriteProperty(options, PropCollectionTimeInMillis, value.CollectionTimeInMillis, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.GarbageCollectorTotalConverter))] public sealed partial class GarbageCollectorTotal { +#if NET7_0_OR_GREATER + public GarbageCollectorTotal() + { + } +#endif +#if !NET7_0_OR_GREATER + public GarbageCollectorTotal() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GarbageCollectorTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of JVM garbage collectors that collect objects. /// /// - [JsonInclude, JsonPropertyName("collection_count")] - public long? CollectionCount { get; init; } + public long? CollectionCount { get; set; } /// /// /// Total time spent by JVM collecting objects. /// /// - [JsonInclude, JsonPropertyName("collection_time")] - public string? CollectionTime { get; init; } + public string? CollectionTime { get; set; } /// /// /// Total time, in milliseconds, spent by JVM collecting objects. /// /// - [JsonInclude, JsonPropertyName("collection_time_in_millis")] - public long? CollectionTimeInMillis { get; init; } + public long? CollectionTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Http.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Http.g.cs index 987f8bd961b..cd2b2b9a767 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Http.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Http.g.cs @@ -17,48 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class HttpConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClients = System.Text.Json.JsonEncodedText.Encode("clients"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentOpen = System.Text.Json.JsonEncodedText.Encode("current_open"); + private static readonly System.Text.Json.JsonEncodedText PropRoutes = System.Text.Json.JsonEncodedText.Encode("routes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalOpened = System.Text.Json.JsonEncodedText.Encode("total_opened"); + + public override Elastic.Clients.Elasticsearch.Nodes.Http Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propClients = default; + LocalJsonValue propCurrentOpen = default; + LocalJsonValue> propRoutes = default; + LocalJsonValue propTotalOpened = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClients.TryReadProperty(ref reader, options, PropClients, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCurrentOpen.TryReadProperty(ref reader, options, PropCurrentOpen, null)) + { + continue; + } + + if (propRoutes.TryReadProperty(ref reader, options, PropRoutes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTotalOpened.TryReadProperty(ref reader, options, PropTotalOpened, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Http(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Clients = propClients.Value, + CurrentOpen = propCurrentOpen.Value, + Routes = propRoutes.Value, + TotalOpened = propTotalOpened.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Http value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClients, value.Clients, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCurrentOpen, value.CurrentOpen, null, null); + writer.WriteProperty(options, PropRoutes, value.Routes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTotalOpened, value.TotalOpened, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HttpConverter))] public sealed partial class Http { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Http(System.Collections.Generic.IReadOnlyDictionary routes) + { + Routes = routes; + } +#if NET7_0_OR_GREATER + public Http() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Http() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Http(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Information on current and recently-closed HTTP client connections. /// Clients that have been closed longer than the http.client_stats.closed_channels.max_age setting will not be represented here. /// /// - [JsonInclude, JsonPropertyName("clients")] - public IReadOnlyCollection? Clients { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Clients { get; set; } /// /// /// Current number of open HTTP connections for the node. /// /// - [JsonInclude, JsonPropertyName("current_open")] - public int? CurrentOpen { get; init; } + public int? CurrentOpen { get; set; } /// /// /// Detailed HTTP stats broken down by route /// /// - [JsonInclude, JsonPropertyName("routes")] - public IReadOnlyDictionary Routes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Routes { get; set; } /// /// /// Total number of HTTP connections opened for the node. /// /// - [JsonInclude, JsonPropertyName("total_opened")] - public long? TotalOpened { get; init; } + public long? TotalOpened { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRoute.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRoute.g.cs index 5a7a73b0dbd..af81213f663 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRoute.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRoute.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class HttpRouteConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRequests = System.Text.Json.JsonEncodedText.Encode("requests"); + private static readonly System.Text.Json.JsonEncodedText PropResponses = System.Text.Json.JsonEncodedText.Encode("responses"); + + public override Elastic.Clients.Elasticsearch.Nodes.HttpRoute Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRequests = default; + LocalJsonValue propResponses = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRequests.TryReadProperty(ref reader, options, PropRequests, null)) + { + continue; + } + + if (propResponses.TryReadProperty(ref reader, options, PropResponses, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.HttpRoute(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Requests = propRequests.Value, + Responses = propResponses.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.HttpRoute value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRequests, value.Requests, null, null); + writer.WriteProperty(options, PropResponses, value.Responses, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HttpRouteConverter))] public sealed partial class HttpRoute { - [JsonInclude, JsonPropertyName("requests")] - public Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests Requests { get; init; } - [JsonInclude, JsonPropertyName("responses")] - public Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses Responses { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HttpRoute(Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests requests, Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses responses) + { + Requests = requests; + Responses = responses; + } +#if NET7_0_OR_GREATER + public HttpRoute() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HttpRoute() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HttpRoute(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests Requests { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses Responses { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteRequests.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteRequests.g.cs index dc7a3eed1e9..fe3801894bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteRequests.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteRequests.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class HttpRouteRequestsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropSizeHistogram = System.Text.Json.JsonEncodedText.Encode("size_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propSizeHistogram = default; + LocalJsonValue propTotalSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propSizeHistogram.TryReadProperty(ref reader, options, PropSizeHistogram, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTotalSizeInBytes.TryReadProperty(ref reader, options, PropTotalSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + SizeHistogram = propSizeHistogram.Value, + TotalSizeInBytes = propTotalSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequests value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropSizeHistogram, value.SizeHistogram, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotalSizeInBytes, value.TotalSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HttpRouteRequestsConverter))] public sealed partial class HttpRouteRequests { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("size_histogram")] - public IReadOnlyCollection SizeHistogram { get; init; } - [JsonInclude, JsonPropertyName("total_size_in_bytes")] - public long TotalSizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HttpRouteRequests(long count, System.Collections.Generic.IReadOnlyCollection sizeHistogram, long totalSizeInBytes) + { + Count = count; + SizeHistogram = sizeHistogram; + TotalSizeInBytes = totalSizeInBytes; + } +#if NET7_0_OR_GREATER + public HttpRouteRequests() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HttpRouteRequests() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HttpRouteRequests(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection SizeHistogram { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteResponses.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteResponses.g.cs index af52dc353ce..1365e007d6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteResponses.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/HttpRouteResponses.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class HttpRouteResponsesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropHandlingTimeHistogram = System.Text.Json.JsonEncodedText.Encode("handling_time_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropSizeHistogram = System.Text.Json.JsonEncodedText.Encode("size_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propHandlingTimeHistogram = default; + LocalJsonValue> propSizeHistogram = default; + LocalJsonValue propTotalSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propHandlingTimeHistogram.TryReadProperty(ref reader, options, PropHandlingTimeHistogram, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propSizeHistogram.TryReadProperty(ref reader, options, PropSizeHistogram, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTotalSizeInBytes.TryReadProperty(ref reader, options, PropTotalSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + HandlingTimeHistogram = propHandlingTimeHistogram.Value, + SizeHistogram = propSizeHistogram.Value, + TotalSizeInBytes = propTotalSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponses value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropHandlingTimeHistogram, value.HandlingTimeHistogram, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSizeHistogram, value.SizeHistogram, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotalSizeInBytes, value.TotalSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.HttpRouteResponsesConverter))] public sealed partial class HttpRouteResponses { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("handling_time_histogram")] - public IReadOnlyCollection HandlingTimeHistogram { get; init; } - [JsonInclude, JsonPropertyName("size_histogram")] - public IReadOnlyCollection SizeHistogram { get; init; } - [JsonInclude, JsonPropertyName("total_size_in_bytes")] - public long TotalSizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HttpRouteResponses(long count, System.Collections.Generic.IReadOnlyCollection handlingTimeHistogram, System.Collections.Generic.IReadOnlyCollection sizeHistogram, long totalSizeInBytes) + { + Count = count; + HandlingTimeHistogram = handlingTimeHistogram; + SizeHistogram = sizeHistogram; + TotalSizeInBytes = totalSizeInBytes; + } +#if NET7_0_OR_GREATER + public HttpRouteResponses() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HttpRouteResponses() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HttpRouteResponses(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection HandlingTimeHistogram { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection SizeHistogram { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressure.g.cs index b8f86f7d675..cadbcbd2926 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressure.g.cs @@ -17,23 +17,74 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IndexingPressureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + + public override Elastic.Clients.Elasticsearch.Nodes.IndexingPressure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemory = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Memory = propMemory.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IndexingPressure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IndexingPressureConverter))] public sealed partial class IndexingPressure { +#if NET7_0_OR_GREATER + public IndexingPressure() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexingPressure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics for memory consumption from indexing load. /// /// - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemory? Memory { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemory? Memory { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressureMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressureMemory.g.cs index 5b13bd2eba6..f9599a6d567 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressureMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IndexingPressureMemory.g.cs @@ -17,25 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IndexingPressureMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropLimit = System.Text.Json.JsonEncodedText.Encode("limit"); + private static readonly System.Text.Json.JsonEncodedText PropLimitInBytes = System.Text.Json.JsonEncodedText.Encode("limit_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrent = default; + LocalJsonValue propLimit = default; + LocalJsonValue propLimitInBytes = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propLimit.TryReadProperty(ref reader, options, PropLimit, null)) + { + continue; + } + + if (propLimitInBytes.TryReadProperty(ref reader, options, PropLimitInBytes, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Current = propCurrent.Value, + Limit = propLimit.Value, + LimitInBytes = propLimitInBytes.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropLimit, value.Limit, null, null); + writer.WriteProperty(options, PropLimitInBytes, value.LimitInBytes, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IndexingPressureMemoryConverter))] public sealed partial class IndexingPressureMemory { +#if NET7_0_OR_GREATER + public IndexingPressureMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + public IndexingPressureMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexingPressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics for current indexing load. /// /// - [JsonInclude, JsonPropertyName("current")] - public Elastic.Clients.Elasticsearch.Nodes.PressureMemory? Current { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.PressureMemory? Current { get; set; } /// /// @@ -43,8 +121,7 @@ public sealed partial class IndexingPressureMemory /// Replica requests have an automatic limit that is 1.5x this value. /// /// - [JsonInclude, JsonPropertyName("limit")] - public Elastic.Clients.Elasticsearch.ByteSize? Limit { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Limit { get; set; } /// /// @@ -52,14 +129,12 @@ public sealed partial class IndexingPressureMemory /// Replica requests have an automatic limit that is 1.5x this value. /// /// - [JsonInclude, JsonPropertyName("limit_in_bytes")] - public long? LimitInBytes { get; init; } + public long? LimitInBytes { get; set; } /// /// /// Contains statistics for the cumulative indexing load since the node started. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Nodes.PressureMemory? Total { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.PressureMemory? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Ingest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Ingest.g.cs index b313cac7a44..e60bfde60cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Ingest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Ingest.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IngestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPipelines = System.Text.Json.JsonEncodedText.Encode("pipelines"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Nodes.Ingest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propPipelines = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPipelines.TryReadProperty(ref reader, options, PropPipelines, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Ingest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Pipelines = propPipelines.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Ingest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPipelines, value.Pipelines, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IngestConverter))] public sealed partial class Ingest { +#if NET7_0_OR_GREATER + public Ingest() + { + } +#endif +#if !NET7_0_OR_GREATER + public Ingest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ingest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about ingest pipelines for the node. /// /// - [JsonInclude, JsonPropertyName("pipelines")] - public IReadOnlyDictionary? Pipelines { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Pipelines { get; set; } /// /// /// Contains statistics about ingest operations for the node. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Nodes.IngestTotal? Total { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.IngestTotal? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestStats.g.cs index 03ebdc03a38..f9afe03d76a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestStats.g.cs @@ -17,41 +17,168 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IngestStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropIngestedAsFirstPipelineInBytes = System.Text.Json.JsonEncodedText.Encode("ingested_as_first_pipeline_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + private static readonly System.Text.Json.JsonEncodedText PropProducedAsFirstPipelineInBytes = System.Text.Json.JsonEncodedText.Encode("produced_as_first_pipeline_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.IngestStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propCurrent = default; + LocalJsonValue propFailed = default; + LocalJsonValue propIngestedAsFirstPipelineInBytes = default; + LocalJsonValue>> propProcessors = default; + LocalJsonValue propProducedAsFirstPipelineInBytes = default; + LocalJsonValue propTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propIngestedAsFirstPipelineInBytes.TryReadProperty(ref reader, options, PropIngestedAsFirstPipelineInBytes, null)) + { + continue; + } + + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.IReadOnlyCollection> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)!)) + { + continue; + } + + if (propProducedAsFirstPipelineInBytes.TryReadProperty(ref reader, options, PropProducedAsFirstPipelineInBytes, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IngestStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Current = propCurrent.Value, + Failed = propFailed.Value, + IngestedAsFirstPipelineInBytes = propIngestedAsFirstPipelineInBytes.Value, + Processors = propProcessors.Value, + ProducedAsFirstPipelineInBytes = propProducedAsFirstPipelineInBytes.Value, + TimeInMillis = propTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IngestStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropIngestedAsFirstPipelineInBytes, value.IngestedAsFirstPipelineInBytes, null, null); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection> v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropProducedAsFirstPipelineInBytes, value.ProducedAsFirstPipelineInBytes, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IngestStatsConverter))] public sealed partial class IngestStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestStats(long count, long current, long failed, long ingestedAsFirstPipelineInBytes, System.Collections.Generic.IReadOnlyCollection> processors, long producedAsFirstPipelineInBytes, System.TimeSpan timeInMillis) + { + Count = count; + Current = current; + Failed = failed; + IngestedAsFirstPipelineInBytes = ingestedAsFirstPipelineInBytes; + Processors = processors; + ProducedAsFirstPipelineInBytes = producedAsFirstPipelineInBytes; + TimeInMillis = timeInMillis; + } +#if NET7_0_OR_GREATER + public IngestStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IngestStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IngestStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of documents ingested during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// Total number of documents currently being ingested. /// /// - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } /// /// /// Total number of failed ingest operations during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("failed")] - public long Failed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Failed { get; set; } /// /// @@ -60,16 +187,22 @@ public sealed partial class IngestStats /// Thus, it is not present on pipelines which only serve as a final pipeline after a default pipeline, a pipeline run after a reroute processor, or pipelines in pipeline processors. /// /// - [JsonInclude, JsonPropertyName("ingested_as_first_pipeline_in_bytes")] - public long IngestedAsFirstPipelineInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long IngestedAsFirstPipelineInBytes { get; set; } /// /// /// Total number of ingest processors. /// /// - [JsonInclude, JsonPropertyName("processors")] - public IReadOnlyCollection> Processors { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection> Processors { get; set; } /// /// @@ -79,14 +212,20 @@ public sealed partial class IngestStats /// In situations where there are subsequent pipelines, the value represents the size of the document after all pipelines have run. /// /// - [JsonInclude, JsonPropertyName("produced_as_first_pipeline_in_bytes")] - public long ProducedAsFirstPipelineInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ProducedAsFirstPipelineInBytes { get; set; } /// /// /// Total time, in milliseconds, spent preprocessing ingest documents during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestTotal.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestTotal.g.cs index 9984b1514d1..f95c3188193 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestTotal.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IngestTotal.g.cs @@ -17,47 +17,147 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IngestTotalConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.IngestTotal Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propCurrent = default; + LocalJsonValue propFailed = default; + LocalJsonValue propTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IngestTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Current = propCurrent.Value, + Failed = propFailed.Value, + TimeInMillis = propTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IngestTotal value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IngestTotalConverter))] public sealed partial class IngestTotal { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestTotal(long count, long current, long failed, System.TimeSpan timeInMillis) + { + Count = count; + Current = current; + Failed = failed; + TimeInMillis = timeInMillis; + } +#if NET7_0_OR_GREATER + public IngestTotal() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IngestTotal() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IngestTotal(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of documents ingested during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } /// /// /// Total number of documents currently being ingested. /// /// - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } /// /// /// Total number of failed ingest operations during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("failed")] - public long Failed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Failed { get; set; } /// /// /// Total time, in milliseconds, spent preprocessing ingest documents during the lifetime of this node. /// /// - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStatDevice.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStatDevice.g.cs index 4491afcdce6..dc9b44f066d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStatDevice.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStatDevice.g.cs @@ -17,63 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IoStatDeviceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeviceName = System.Text.Json.JsonEncodedText.Encode("device_name"); + private static readonly System.Text.Json.JsonEncodedText PropOperations = System.Text.Json.JsonEncodedText.Encode("operations"); + private static readonly System.Text.Json.JsonEncodedText PropReadKilobytes = System.Text.Json.JsonEncodedText.Encode("read_kilobytes"); + private static readonly System.Text.Json.JsonEncodedText PropReadOperations = System.Text.Json.JsonEncodedText.Encode("read_operations"); + private static readonly System.Text.Json.JsonEncodedText PropWriteKilobytes = System.Text.Json.JsonEncodedText.Encode("write_kilobytes"); + private static readonly System.Text.Json.JsonEncodedText PropWriteOperations = System.Text.Json.JsonEncodedText.Encode("write_operations"); + + public override Elastic.Clients.Elasticsearch.Nodes.IoStatDevice Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeviceName = default; + LocalJsonValue propOperations = default; + LocalJsonValue propReadKilobytes = default; + LocalJsonValue propReadOperations = default; + LocalJsonValue propWriteKilobytes = default; + LocalJsonValue propWriteOperations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeviceName.TryReadProperty(ref reader, options, PropDeviceName, null)) + { + continue; + } + + if (propOperations.TryReadProperty(ref reader, options, PropOperations, null)) + { + continue; + } + + if (propReadKilobytes.TryReadProperty(ref reader, options, PropReadKilobytes, null)) + { + continue; + } + + if (propReadOperations.TryReadProperty(ref reader, options, PropReadOperations, null)) + { + continue; + } + + if (propWriteKilobytes.TryReadProperty(ref reader, options, PropWriteKilobytes, null)) + { + continue; + } + + if (propWriteOperations.TryReadProperty(ref reader, options, PropWriteOperations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IoStatDevice(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeviceName = propDeviceName.Value, + Operations = propOperations.Value, + ReadKilobytes = propReadKilobytes.Value, + ReadOperations = propReadOperations.Value, + WriteKilobytes = propWriteKilobytes.Value, + WriteOperations = propWriteOperations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IoStatDevice value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeviceName, value.DeviceName, null, null); + writer.WriteProperty(options, PropOperations, value.Operations, null, null); + writer.WriteProperty(options, PropReadKilobytes, value.ReadKilobytes, null, null); + writer.WriteProperty(options, PropReadOperations, value.ReadOperations, null, null); + writer.WriteProperty(options, PropWriteKilobytes, value.WriteKilobytes, null, null); + writer.WriteProperty(options, PropWriteOperations, value.WriteOperations, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IoStatDeviceConverter))] public sealed partial class IoStatDevice { +#if NET7_0_OR_GREATER + public IoStatDevice() + { + } +#endif +#if !NET7_0_OR_GREATER + public IoStatDevice() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IoStatDevice(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The Linux device name. /// /// - [JsonInclude, JsonPropertyName("device_name")] - public string? DeviceName { get; init; } + public string? DeviceName { get; set; } /// /// /// The total number of read and write operations for the device completed since starting Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("operations")] - public long? Operations { get; init; } + public long? Operations { get; set; } /// /// /// The total number of kilobytes read for the device since starting Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("read_kilobytes")] - public long? ReadKilobytes { get; init; } + public long? ReadKilobytes { get; set; } /// /// /// The total number of read operations for the device completed since starting Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("read_operations")] - public long? ReadOperations { get; init; } + public long? ReadOperations { get; set; } /// /// /// The total number of kilobytes written for the device since starting Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("write_kilobytes")] - public long? WriteKilobytes { get; init; } + public long? WriteKilobytes { get; set; } /// /// /// The total number of write operations for the device completed since starting Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("write_operations")] - public long? WriteOperations { get; init; } + public long? WriteOperations { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStats.g.cs index d855273dd20..387c3d49c73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/IoStats.g.cs @@ -17,32 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class IoStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDevices = System.Text.Json.JsonEncodedText.Encode("devices"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Nodes.IoStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDevices = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDevices.TryReadProperty(ref reader, options, PropDevices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.IoStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Devices = propDevices.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.IoStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDevices, value.Devices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.IoStatsConverter))] public sealed partial class IoStats { +#if NET7_0_OR_GREATER + public IoStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public IoStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IoStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Array of disk metrics for each device that is backing an Elasticsearch data path. /// These disk metrics are probed periodically and averages between the last probe and the current probe are computed. /// /// - [JsonInclude, JsonPropertyName("devices")] - public IReadOnlyCollection? Devices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Devices { get; set; } /// /// /// The sum of the disk metrics for all devices that back an Elasticsearch data path. /// /// - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Nodes.IoStatDevice? Total { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.IoStatDevice? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Jvm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Jvm.g.cs index c4697505562..551c29fe2d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Jvm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Jvm.g.cs @@ -17,65 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class JvmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBufferPools = System.Text.Json.JsonEncodedText.Encode("buffer_pools"); + private static readonly System.Text.Json.JsonEncodedText PropClasses = System.Text.Json.JsonEncodedText.Encode("classes"); + private static readonly System.Text.Json.JsonEncodedText PropGc = System.Text.Json.JsonEncodedText.Encode("gc"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropThreads = System.Text.Json.JsonEncodedText.Encode("threads"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropUptime = System.Text.Json.JsonEncodedText.Encode("uptime"); + private static readonly System.Text.Json.JsonEncodedText PropUptimeInMillis = System.Text.Json.JsonEncodedText.Encode("uptime_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.Jvm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propBufferPools = default; + LocalJsonValue propClasses = default; + LocalJsonValue propGc = default; + LocalJsonValue propMem = default; + LocalJsonValue propThreads = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propUptime = default; + LocalJsonValue propUptimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBufferPools.TryReadProperty(ref reader, options, PropBufferPools, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propClasses.TryReadProperty(ref reader, options, PropClasses, null)) + { + continue; + } + + if (propGc.TryReadProperty(ref reader, options, PropGc, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propThreads.TryReadProperty(ref reader, options, PropThreads, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (propUptime.TryReadProperty(ref reader, options, PropUptime, null)) + { + continue; + } + + if (propUptimeInMillis.TryReadProperty(ref reader, options, PropUptimeInMillis, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Jvm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BufferPools = propBufferPools.Value, + Classes = propClasses.Value, + Gc = propGc.Value, + Mem = propMem.Value, + Threads = propThreads.Value, + Timestamp = propTimestamp.Value, + Uptime = propUptime.Value, + UptimeInMillis = propUptimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Jvm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBufferPools, value.BufferPools, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropClasses, value.Classes, null, null); + writer.WriteProperty(options, PropGc, value.Gc, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropThreads, value.Threads, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteProperty(options, PropUptime, value.Uptime, null, null); + writer.WriteProperty(options, PropUptimeInMillis, value.UptimeInMillis, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.JvmConverter))] public sealed partial class Jvm { +#if NET7_0_OR_GREATER + public Jvm() + { + } +#endif +#if !NET7_0_OR_GREATER + public Jvm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Jvm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains statistics about JVM buffer pools for the node. /// /// - [JsonInclude, JsonPropertyName("buffer_pools")] - public IReadOnlyDictionary? BufferPools { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? BufferPools { get; set; } /// /// /// Contains statistics about classes loaded by JVM for the node. /// /// - [JsonInclude, JsonPropertyName("classes")] - public Elastic.Clients.Elasticsearch.Nodes.JvmClasses? Classes { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.JvmClasses? Classes { get; set; } /// /// /// Contains statistics about JVM garbage collectors for the node. /// /// - [JsonInclude, JsonPropertyName("gc")] - public Elastic.Clients.Elasticsearch.Nodes.GarbageCollector? Gc { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.GarbageCollector? Gc { get; set; } /// /// /// Contains JVM memory usage statistics for the node. /// /// - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStats? Mem { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStats? Mem { get; set; } /// /// /// Contains statistics about JVM thread usage for the node. /// /// - [JsonInclude, JsonPropertyName("threads")] - public Elastic.Clients.Elasticsearch.Nodes.JvmThreads? Threads { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.JvmThreads? Threads { get; set; } /// /// /// Last time JVM statistics were refreshed. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } + public long? Timestamp { get; set; } /// /// @@ -83,14 +192,12 @@ public sealed partial class Jvm /// Only returned if the human query parameter is true. /// /// - [JsonInclude, JsonPropertyName("uptime")] - public string? Uptime { get; init; } + public string? Uptime { get; set; } /// /// /// JVM uptime in milliseconds. /// /// - [JsonInclude, JsonPropertyName("uptime_in_millis")] - public long? UptimeInMillis { get; init; } + public long? UptimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmClasses.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmClasses.g.cs index ad88dabff74..b04612e5aa7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmClasses.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmClasses.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class JvmClassesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentLoadedCount = System.Text.Json.JsonEncodedText.Encode("current_loaded_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalLoadedCount = System.Text.Json.JsonEncodedText.Encode("total_loaded_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalUnloadedCount = System.Text.Json.JsonEncodedText.Encode("total_unloaded_count"); + + public override Elastic.Clients.Elasticsearch.Nodes.JvmClasses Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentLoadedCount = default; + LocalJsonValue propTotalLoadedCount = default; + LocalJsonValue propTotalUnloadedCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentLoadedCount.TryReadProperty(ref reader, options, PropCurrentLoadedCount, null)) + { + continue; + } + + if (propTotalLoadedCount.TryReadProperty(ref reader, options, PropTotalLoadedCount, null)) + { + continue; + } + + if (propTotalUnloadedCount.TryReadProperty(ref reader, options, PropTotalUnloadedCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.JvmClasses(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentLoadedCount = propCurrentLoadedCount.Value, + TotalLoadedCount = propTotalLoadedCount.Value, + TotalUnloadedCount = propTotalUnloadedCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.JvmClasses value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentLoadedCount, value.CurrentLoadedCount, null, null); + writer.WriteProperty(options, PropTotalLoadedCount, value.TotalLoadedCount, null, null); + writer.WriteProperty(options, PropTotalUnloadedCount, value.TotalUnloadedCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.JvmClassesConverter))] public sealed partial class JvmClasses { +#if NET7_0_OR_GREATER + public JvmClasses() + { + } +#endif +#if !NET7_0_OR_GREATER + public JvmClasses() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JvmClasses(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of classes currently loaded by JVM. /// /// - [JsonInclude, JsonPropertyName("current_loaded_count")] - public long? CurrentLoadedCount { get; init; } + public long? CurrentLoadedCount { get; set; } /// /// /// Total number of classes loaded since the JVM started. /// /// - [JsonInclude, JsonPropertyName("total_loaded_count")] - public long? TotalLoadedCount { get; init; } + public long? TotalLoadedCount { get; set; } /// /// /// Total number of classes unloaded since the JVM started. /// /// - [JsonInclude, JsonPropertyName("total_unloaded_count")] - public long? TotalUnloadedCount { get; init; } + public long? TotalUnloadedCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmMemoryStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmMemoryStats.g.cs index e7caecef5c5..fbfcc345887 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmMemoryStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmMemoryStats.g.cs @@ -17,71 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class JvmMemoryStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHeapCommittedInBytes = System.Text.Json.JsonEncodedText.Encode("heap_committed_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapMaxInBytes = System.Text.Json.JsonEncodedText.Encode("heap_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapUsedInBytes = System.Text.Json.JsonEncodedText.Encode("heap_used_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapUsedPercent = System.Text.Json.JsonEncodedText.Encode("heap_used_percent"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapCommittedInBytes = System.Text.Json.JsonEncodedText.Encode("non_heap_committed_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapUsedInBytes = System.Text.Json.JsonEncodedText.Encode("non_heap_used_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPools = System.Text.Json.JsonEncodedText.Encode("pools"); + + public override Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHeapCommittedInBytes = default; + LocalJsonValue propHeapMaxInBytes = default; + LocalJsonValue propHeapUsedInBytes = default; + LocalJsonValue propHeapUsedPercent = default; + LocalJsonValue propNonHeapCommittedInBytes = default; + LocalJsonValue propNonHeapUsedInBytes = default; + LocalJsonValue?> propPools = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHeapCommittedInBytes.TryReadProperty(ref reader, options, PropHeapCommittedInBytes, null)) + { + continue; + } + + if (propHeapMaxInBytes.TryReadProperty(ref reader, options, PropHeapMaxInBytes, null)) + { + continue; + } + + if (propHeapUsedInBytes.TryReadProperty(ref reader, options, PropHeapUsedInBytes, null)) + { + continue; + } + + if (propHeapUsedPercent.TryReadProperty(ref reader, options, PropHeapUsedPercent, null)) + { + continue; + } + + if (propNonHeapCommittedInBytes.TryReadProperty(ref reader, options, PropNonHeapCommittedInBytes, null)) + { + continue; + } + + if (propNonHeapUsedInBytes.TryReadProperty(ref reader, options, PropNonHeapUsedInBytes, null)) + { + continue; + } + + if (propPools.TryReadProperty(ref reader, options, PropPools, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + HeapCommittedInBytes = propHeapCommittedInBytes.Value, + HeapMaxInBytes = propHeapMaxInBytes.Value, + HeapUsedInBytes = propHeapUsedInBytes.Value, + HeapUsedPercent = propHeapUsedPercent.Value, + NonHeapCommittedInBytes = propNonHeapCommittedInBytes.Value, + NonHeapUsedInBytes = propNonHeapUsedInBytes.Value, + Pools = propPools.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHeapCommittedInBytes, value.HeapCommittedInBytes, null, null); + writer.WriteProperty(options, PropHeapMaxInBytes, value.HeapMaxInBytes, null, null); + writer.WriteProperty(options, PropHeapUsedInBytes, value.HeapUsedInBytes, null, null); + writer.WriteProperty(options, PropHeapUsedPercent, value.HeapUsedPercent, null, null); + writer.WriteProperty(options, PropNonHeapCommittedInBytes, value.NonHeapCommittedInBytes, null, null); + writer.WriteProperty(options, PropNonHeapUsedInBytes, value.NonHeapUsedInBytes, null, null); + writer.WriteProperty(options, PropPools, value.Pools, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.JvmMemoryStatsConverter))] public sealed partial class JvmMemoryStats { +#if NET7_0_OR_GREATER + public JvmMemoryStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public JvmMemoryStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JvmMemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Amount of memory, in bytes, available for use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_committed_in_bytes")] - public long? HeapCommittedInBytes { get; init; } + public long? HeapCommittedInBytes { get; set; } /// /// /// Maximum amount of memory, in bytes, available for use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_max_in_bytes")] - public long? HeapMaxInBytes { get; init; } + public long? HeapMaxInBytes { get; set; } /// /// /// Memory, in bytes, currently in use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_used_in_bytes")] - public long? HeapUsedInBytes { get; init; } + public long? HeapUsedInBytes { get; set; } /// /// /// Percentage of memory currently in use by the heap. /// /// - [JsonInclude, JsonPropertyName("heap_used_percent")] - public long? HeapUsedPercent { get; init; } + public long? HeapUsedPercent { get; set; } /// /// /// Amount of non-heap memory available, in bytes. /// /// - [JsonInclude, JsonPropertyName("non_heap_committed_in_bytes")] - public long? NonHeapCommittedInBytes { get; init; } + public long? NonHeapCommittedInBytes { get; set; } /// /// /// Non-heap memory used, in bytes. /// /// - [JsonInclude, JsonPropertyName("non_heap_used_in_bytes")] - public long? NonHeapUsedInBytes { get; init; } + public long? NonHeapUsedInBytes { get; set; } /// /// /// Contains statistics about heap memory usage for the node. /// /// - [JsonInclude, JsonPropertyName("pools")] - public IReadOnlyDictionary? Pools { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Pools { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmThreads.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmThreads.g.cs index 6fc0a88632f..b9c827ed7ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmThreads.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/JvmThreads.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class JvmThreadsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropPeakCount = System.Text.Json.JsonEncodedText.Encode("peak_count"); + + public override Elastic.Clients.Elasticsearch.Nodes.JvmThreads Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propPeakCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propPeakCount.TryReadProperty(ref reader, options, PropPeakCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.JvmThreads(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + PeakCount = propPeakCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.JvmThreads value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropPeakCount, value.PeakCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.JvmThreadsConverter))] public sealed partial class JvmThreads { +#if NET7_0_OR_GREATER + public JvmThreads() + { + } +#endif +#if !NET7_0_OR_GREATER + public JvmThreads() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JvmThreads(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of active threads in use by JVM. /// /// - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } + public long? Count { get; set; } /// /// /// Highest number of threads used by JVM. /// /// - [JsonInclude, JsonPropertyName("peak_count")] - public long? PeakCount { get; init; } + public long? PeakCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/KeyedProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/KeyedProcessor.g.cs index 4660b5cfb13..58912b8dfb1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/KeyedProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/KeyedProcessor.g.cs @@ -17,20 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class KeyedProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.KeyedProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStats = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.KeyedProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stats = propStats.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.KeyedProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.KeyedProcessorConverter))] public sealed partial class KeyedProcessor { - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Nodes.Processor? Stats { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string? Type { get; init; } +#if NET7_0_OR_GREATER + public KeyedProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + public KeyedProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KeyedProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.Processor? Stats { get; set; } + public string? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/MemoryStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/MemoryStats.g.cs index 6bc1ce8f4c5..de64118d19b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/MemoryStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/MemoryStats.g.cs @@ -17,60 +17,183 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class MemoryStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdjustedTotalInBytes = System.Text.Json.JsonEncodedText.Encode("adjusted_total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFreeInBytes = System.Text.Json.JsonEncodedText.Encode("free_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropResident = System.Text.Json.JsonEncodedText.Encode("resident"); + private static readonly System.Text.Json.JsonEncodedText PropResidentInBytes = System.Text.Json.JsonEncodedText.Encode("resident_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropShare = System.Text.Json.JsonEncodedText.Encode("share"); + private static readonly System.Text.Json.JsonEncodedText PropShareInBytes = System.Text.Json.JsonEncodedText.Encode("share_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalVirtual = System.Text.Json.JsonEncodedText.Encode("total_virtual"); + private static readonly System.Text.Json.JsonEncodedText PropTotalVirtualInBytes = System.Text.Json.JsonEncodedText.Encode("total_virtual_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedInBytes = System.Text.Json.JsonEncodedText.Encode("used_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.MemoryStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAdjustedTotalInBytes = default; + LocalJsonValue propFreeInBytes = default; + LocalJsonValue propResident = default; + LocalJsonValue propResidentInBytes = default; + LocalJsonValue propShare = default; + LocalJsonValue propShareInBytes = default; + LocalJsonValue propTotalInBytes = default; + LocalJsonValue propTotalVirtual = default; + LocalJsonValue propTotalVirtualInBytes = default; + LocalJsonValue propUsedInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdjustedTotalInBytes.TryReadProperty(ref reader, options, PropAdjustedTotalInBytes, null)) + { + continue; + } + + if (propFreeInBytes.TryReadProperty(ref reader, options, PropFreeInBytes, null)) + { + continue; + } + + if (propResident.TryReadProperty(ref reader, options, PropResident, null)) + { + continue; + } + + if (propResidentInBytes.TryReadProperty(ref reader, options, PropResidentInBytes, null)) + { + continue; + } + + if (propShare.TryReadProperty(ref reader, options, PropShare, null)) + { + continue; + } + + if (propShareInBytes.TryReadProperty(ref reader, options, PropShareInBytes, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (propTotalVirtual.TryReadProperty(ref reader, options, PropTotalVirtual, null)) + { + continue; + } + + if (propTotalVirtualInBytes.TryReadProperty(ref reader, options, PropTotalVirtualInBytes, null)) + { + continue; + } + + if (propUsedInBytes.TryReadProperty(ref reader, options, PropUsedInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.MemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdjustedTotalInBytes = propAdjustedTotalInBytes.Value, + FreeInBytes = propFreeInBytes.Value, + Resident = propResident.Value, + ResidentInBytes = propResidentInBytes.Value, + Share = propShare.Value, + ShareInBytes = propShareInBytes.Value, + TotalInBytes = propTotalInBytes.Value, + TotalVirtual = propTotalVirtual.Value, + TotalVirtualInBytes = propTotalVirtualInBytes.Value, + UsedInBytes = propUsedInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.MemoryStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdjustedTotalInBytes, value.AdjustedTotalInBytes, null, null); + writer.WriteProperty(options, PropFreeInBytes, value.FreeInBytes, null, null); + writer.WriteProperty(options, PropResident, value.Resident, null, null); + writer.WriteProperty(options, PropResidentInBytes, value.ResidentInBytes, null, null); + writer.WriteProperty(options, PropShare, value.Share, null, null); + writer.WriteProperty(options, PropShareInBytes, value.ShareInBytes, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteProperty(options, PropTotalVirtual, value.TotalVirtual, null, null); + writer.WriteProperty(options, PropTotalVirtualInBytes, value.TotalVirtualInBytes, null, null); + writer.WriteProperty(options, PropUsedInBytes, value.UsedInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.MemoryStatsConverter))] public sealed partial class MemoryStats { +#if NET7_0_OR_GREATER + public MemoryStats() + { + } +#endif +#if !NET7_0_OR_GREATER + public MemoryStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MemoryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If the amount of physical memory has been overridden using the es.total_memory_bytes system property then this reports the overridden value in bytes. /// Otherwise it reports the same value as total_in_bytes. /// /// - [JsonInclude, JsonPropertyName("adjusted_total_in_bytes")] - public long? AdjustedTotalInBytes { get; init; } + public long? AdjustedTotalInBytes { get; set; } /// /// /// Amount of free physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("free_in_bytes")] - public long? FreeInBytes { get; init; } - [JsonInclude, JsonPropertyName("resident")] - public string? Resident { get; init; } - [JsonInclude, JsonPropertyName("resident_in_bytes")] - public long? ResidentInBytes { get; init; } - [JsonInclude, JsonPropertyName("share")] - public string? Share { get; init; } - [JsonInclude, JsonPropertyName("share_in_bytes")] - public long? ShareInBytes { get; init; } + public long? FreeInBytes { get; set; } + public string? Resident { get; set; } + public long? ResidentInBytes { get; set; } + public string? Share { get; set; } + public long? ShareInBytes { get; set; } /// /// /// Total amount of physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long? TotalInBytes { get; init; } - [JsonInclude, JsonPropertyName("total_virtual")] - public string? TotalVirtual { get; init; } - [JsonInclude, JsonPropertyName("total_virtual_in_bytes")] - public long? TotalVirtualInBytes { get; init; } + public long? TotalInBytes { get; set; } + public string? TotalVirtual { get; set; } + public long? TotalVirtualInBytes { get; set; } /// /// /// Amount of used physical memory in bytes. /// /// - [JsonInclude, JsonPropertyName("used_in_bytes")] - public long? UsedInBytes { get; init; } + public long? UsedInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeBufferPool.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeBufferPool.g.cs index 8e389d0f344..286a31df671 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeBufferPool.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeBufferPool.g.cs @@ -17,55 +17,138 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeBufferPoolConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCapacity = System.Text.Json.JsonEncodedText.Encode("total_capacity"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCapacityInBytes = System.Text.Json.JsonEncodedText.Encode("total_capacity_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsed = System.Text.Json.JsonEncodedText.Encode("used"); + private static readonly System.Text.Json.JsonEncodedText PropUsedInBytes = System.Text.Json.JsonEncodedText.Encode("used_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeBufferPool Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propTotalCapacity = default; + LocalJsonValue propTotalCapacityInBytes = default; + LocalJsonValue propUsed = default; + LocalJsonValue propUsedInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTotalCapacity.TryReadProperty(ref reader, options, PropTotalCapacity, null)) + { + continue; + } + + if (propTotalCapacityInBytes.TryReadProperty(ref reader, options, PropTotalCapacityInBytes, null)) + { + continue; + } + + if (propUsed.TryReadProperty(ref reader, options, PropUsed, null)) + { + continue; + } + + if (propUsedInBytes.TryReadProperty(ref reader, options, PropUsedInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeBufferPool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + TotalCapacity = propTotalCapacity.Value, + TotalCapacityInBytes = propTotalCapacityInBytes.Value, + Used = propUsed.Value, + UsedInBytes = propUsedInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeBufferPool value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTotalCapacity, value.TotalCapacity, null, null); + writer.WriteProperty(options, PropTotalCapacityInBytes, value.TotalCapacityInBytes, null, null); + writer.WriteProperty(options, PropUsed, value.Used, null, null); + writer.WriteProperty(options, PropUsedInBytes, value.UsedInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeBufferPoolConverter))] public sealed partial class NodeBufferPool { +#if NET7_0_OR_GREATER + public NodeBufferPool() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeBufferPool() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeBufferPool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of buffer pools. /// /// - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } + public long? Count { get; set; } /// /// /// Total capacity of buffer pools. /// /// - [JsonInclude, JsonPropertyName("total_capacity")] - public string? TotalCapacity { get; init; } + public string? TotalCapacity { get; set; } /// /// /// Total capacity of buffer pools in bytes. /// /// - [JsonInclude, JsonPropertyName("total_capacity_in_bytes")] - public long? TotalCapacityInBytes { get; init; } + public long? TotalCapacityInBytes { get; set; } /// /// /// Size of buffer pools. /// /// - [JsonInclude, JsonPropertyName("used")] - public string? Used { get; init; } + public string? Used { get; set; } /// /// /// Size of buffer pools in bytes. /// /// - [JsonInclude, JsonPropertyName("used_in_bytes")] - public long? UsedInBytes { get; init; } + public long? UsedInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfo.g.cs index 95bc018a1a3..9ca45578720 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfo.g.cs @@ -17,112 +17,402 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropBuildFlavor = System.Text.Json.JsonEncodedText.Encode("build_flavor"); + private static readonly System.Text.Json.JsonEncodedText PropBuildHash = System.Text.Json.JsonEncodedText.Encode("build_hash"); + private static readonly System.Text.Json.JsonEncodedText PropBuildType = System.Text.Json.JsonEncodedText.Encode("build_type"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropJvm = System.Text.Json.JsonEncodedText.Encode("jvm"); + private static readonly System.Text.Json.JsonEncodedText PropModules = System.Text.Json.JsonEncodedText.Encode("modules"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropNetwork = System.Text.Json.JsonEncodedText.Encode("network"); + private static readonly System.Text.Json.JsonEncodedText PropOs = System.Text.Json.JsonEncodedText.Encode("os"); + private static readonly System.Text.Json.JsonEncodedText PropPlugins = System.Text.Json.JsonEncodedText.Encode("plugins"); + private static readonly System.Text.Json.JsonEncodedText PropProcess = System.Text.Json.JsonEncodedText.Encode("process"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropThreadPool = System.Text.Json.JsonEncodedText.Encode("thread_pool"); + private static readonly System.Text.Json.JsonEncodedText PropTotalIndexingBuffer = System.Text.Json.JsonEncodedText.Encode("total_indexing_buffer"); + private static readonly System.Text.Json.JsonEncodedText PropTotalIndexingBufferInBytes = System.Text.Json.JsonEncodedText.Encode("total_indexing_buffer_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue> propAttributes = default; + LocalJsonValue propBuildFlavor = default; + LocalJsonValue propBuildHash = default; + LocalJsonValue propBuildType = default; + LocalJsonValue propHost = default; + LocalJsonValue propHttp = default; + LocalJsonValue propIngest = default; + LocalJsonValue propIp = default; + LocalJsonValue propJvm = default; + LocalJsonValue?> propModules = default; + LocalJsonValue propName = default; + LocalJsonValue propNetwork = default; + LocalJsonValue propOs = default; + LocalJsonValue?> propPlugins = default; + LocalJsonValue propProcess = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propSettings = default; + LocalJsonValue?> propThreadPool = default; + LocalJsonValue propTotalIndexingBuffer = default; + LocalJsonValue propTotalIndexingBufferInBytes = default; + LocalJsonValue propTransport = default; + LocalJsonValue propTransportAddress = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propBuildFlavor.TryReadProperty(ref reader, options, PropBuildFlavor, null)) + { + continue; + } + + if (propBuildHash.TryReadProperty(ref reader, options, PropBuildHash, null)) + { + continue; + } + + if (propBuildType.TryReadProperty(ref reader, options, PropBuildType, null)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, null)) + { + continue; + } + + if (propJvm.TryReadProperty(ref reader, options, PropJvm, null)) + { + continue; + } + + if (propModules.TryReadProperty(ref reader, options, PropModules, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propNetwork.TryReadProperty(ref reader, options, PropNetwork, null)) + { + continue; + } + + if (propOs.TryReadProperty(ref reader, options, PropOs, null)) + { + continue; + } + + if (propPlugins.TryReadProperty(ref reader, options, PropPlugins, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propProcess.TryReadProperty(ref reader, options, PropProcess, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propThreadPool.TryReadProperty(ref reader, options, PropThreadPool, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTotalIndexingBuffer.TryReadProperty(ref reader, options, PropTotalIndexingBuffer, null)) + { + continue; + } + + if (propTotalIndexingBufferInBytes.TryReadProperty(ref reader, options, PropTotalIndexingBufferInBytes, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + Attributes = propAttributes.Value, + BuildFlavor = propBuildFlavor.Value, + BuildHash = propBuildHash.Value, + BuildType = propBuildType.Value, + Host = propHost.Value, + Http = propHttp.Value, + Ingest = propIngest.Value, + Ip = propIp.Value, + Jvm = propJvm.Value, + Modules = propModules.Value, + Name = propName.Value, + Network = propNetwork.Value, + Os = propOs.Value, + Plugins = propPlugins.Value, + Process = propProcess.Value, + Roles = propRoles.Value, + Settings = propSettings.Value, + ThreadPool = propThreadPool.Value, + TotalIndexingBuffer = propTotalIndexingBuffer.Value, + TotalIndexingBufferInBytes = propTotalIndexingBufferInBytes.Value, + Transport = propTransport.Value, + TransportAddress = propTransportAddress.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropBuildFlavor, value.BuildFlavor, null, null); + writer.WriteProperty(options, PropBuildHash, value.BuildHash, null, null); + writer.WriteProperty(options, PropBuildType, value.BuildType, null, null); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, null); + writer.WriteProperty(options, PropJvm, value.Jvm, null, null); + writer.WriteProperty(options, PropModules, value.Modules, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropNetwork, value.Network, null, null); + writer.WriteProperty(options, PropOs, value.Os, null, null); + writer.WriteProperty(options, PropPlugins, value.Plugins, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProcess, value.Process, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropThreadPool, value.ThreadPool, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTotalIndexingBuffer, value.TotalIndexingBuffer, null, null); + writer.WriteProperty(options, PropTotalIndexingBufferInBytes, value.TotalIndexingBufferInBytes, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoConverter))] public sealed partial class NodeInfo { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyDictionary? Aggregations { get; init; } - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary Attributes { get; init; } - [JsonInclude, JsonPropertyName("build_flavor")] - public string BuildFlavor { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfo(System.Collections.Generic.IReadOnlyDictionary attributes, string buildFlavor, string buildHash, string buildType, string host, string ip, string name, System.Collections.Generic.IReadOnlyCollection roles, string transportAddress, string version) + { + Attributes = attributes; + BuildFlavor = buildFlavor; + BuildHash = buildHash; + BuildType = buildType; + Host = host; + Ip = ip; + Name = name; + Roles = roles; + TransportAddress = transportAddress; + Version = version; + } +#if NET7_0_OR_GREATER + public NodeInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attributes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildFlavor { get; set; } /// /// /// Short hash of the last git commit in this release. /// /// - [JsonInclude, JsonPropertyName("build_hash")] - public string BuildHash { get; init; } - [JsonInclude, JsonPropertyName("build_type")] - public string BuildType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildHash { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string BuildType { get; set; } /// /// /// The node’s host name. /// /// - [JsonInclude, JsonPropertyName("host")] - public string Host { get; init; } - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttp? Http { get; init; } - [JsonInclude, JsonPropertyName("ingest")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngest? Ingest { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Host { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttp? Http { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngest? Ingest { get; set; } /// /// /// The node’s IP address. /// /// - [JsonInclude, JsonPropertyName("ip")] - public string Ip { get; init; } - [JsonInclude, JsonPropertyName("jvm")] - public Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfo? Jvm { get; init; } - [JsonInclude, JsonPropertyName("modules")] - public IReadOnlyCollection? Modules { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Ip { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfo? Jvm { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Modules { get; set; } /// /// /// The node's name /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("network")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetwork? Network { get; init; } - [JsonInclude, JsonPropertyName("os")] - public Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfo? Os { get; init; } - [JsonInclude, JsonPropertyName("plugins")] - public IReadOnlyCollection? Plugins { get; init; } - [JsonInclude, JsonPropertyName("process")] - public Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfo? Process { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettings? Settings { get; init; } - [JsonInclude, JsonPropertyName("thread_pool")] - public IReadOnlyDictionary? ThreadPool { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetwork? Network { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfo? Os { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Plugins { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfo? Process { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettings? Settings { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? ThreadPool { get; set; } /// /// /// Total heap allowed to be used to hold recently indexed documents before they must be written to disk. This size is a shared pool across all shards on this node, and is controlled by Indexing Buffer settings. /// /// - [JsonInclude, JsonPropertyName("total_indexing_buffer")] - public long? TotalIndexingBuffer { get; init; } + public long? TotalIndexingBuffer { get; set; } /// /// /// Same as total_indexing_buffer, but expressed in bytes. /// /// - [JsonInclude, JsonPropertyName("total_indexing_buffer_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalIndexingBufferInBytes { get; init; } - [JsonInclude, JsonPropertyName("transport")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransport? Transport { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalIndexingBufferInBytes { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransport? Transport { get; set; } /// /// /// Host and port where transport HTTP connections are accepted. /// /// - [JsonInclude, JsonPropertyName("transport_address")] - public string TransportAddress { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string TransportAddress { get; set; } /// /// /// Elasticsearch version running on this node. /// /// - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAction.g.cs index 2d64c1b9ea5..9d39f6efaf3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAction.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoActionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDestructiveRequiresName = System.Text.Json.JsonEncodedText.Encode("destructive_requires_name"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoAction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDestructiveRequiresName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDestructiveRequiresName.TryReadProperty(ref reader, options, PropDestructiveRequiresName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DestructiveRequiresName = propDestructiveRequiresName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoAction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDestructiveRequiresName, value.DestructiveRequiresName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoActionConverter))] public sealed partial class NodeInfoAction { - [JsonInclude, JsonPropertyName("destructive_requires_name")] - public string DestructiveRequiresName { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoAction(string destructiveRequiresName) + { + DestructiveRequiresName = destructiveRequiresName; + } +#if NET7_0_OR_GREATER + public NodeInfoAction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoAction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string DestructiveRequiresName { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAggregation.g.cs index 73b52c6e3f3..bcf6cdc36be 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoAggregation.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTypes = System.Text.Json.JsonEncodedText.Encode("types"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propTypes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTypes.TryReadProperty(ref reader, options, PropTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Types = propTypes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTypes, value.Types, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoAggregationConverter))] public sealed partial class NodeInfoAggregation { - [JsonInclude, JsonPropertyName("types")] - public IReadOnlyCollection Types { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoAggregation(System.Collections.Generic.IReadOnlyCollection types) + { + Types = types; + } +#if NET7_0_OR_GREATER + public NodeInfoAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Types { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoBootstrap.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoBootstrap.g.cs index 50c4955a934..22db306b523 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoBootstrap.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoBootstrap.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoBootstrapConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMemoryLock = System.Text.Json.JsonEncodedText.Encode("memory_lock"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrap Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMemoryLock = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMemoryLock.TryReadProperty(ref reader, options, PropMemoryLock, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrap(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MemoryLock = propMemoryLock.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrap value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMemoryLock, value.MemoryLock, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrapConverter))] public sealed partial class NodeInfoBootstrap { - [JsonInclude, JsonPropertyName("memory_lock")] - public string MemoryLock { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoBootstrap(string memoryLock) + { + MemoryLock = memoryLock; + } +#if NET7_0_OR_GREATER + public NodeInfoBootstrap() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoBootstrap() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoBootstrap(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string MemoryLock { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoClient.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoClient.g.cs index f064476a3f4..d6cd8bdd8f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoClient.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoClientConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoClient Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoClient(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoClient value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoClientConverter))] public sealed partial class NodeInfoClient { - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoClient(string type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public NodeInfoClient() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoClient() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoClient(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoDiscover.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoDiscover.g.cs index 82482a861f6..f216a269074 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoDiscover.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoDiscover.g.cs @@ -17,75 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -internal sealed partial class NodeInfoDiscoverConverter : JsonConverter +internal sealed partial class NodeInfoDiscoverConverter : System.Text.Json.Serialization.JsonConverter { - public override NodeInfoDiscover Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropSeedHosts = System.Text.Json.JsonEncodedText.Encode("seed_hosts"); + private static readonly System.Text.Json.JsonEncodedText PropSeedProviders = System.Text.Json.JsonEncodedText.Encode("seed_providers"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscover Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyCollection? seedHosts = default; - IReadOnlyCollection? seedProviders = default; - string? type = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propSeedHosts = default; + LocalJsonValue?> propSeedProviders = default; + System.Collections.Generic.Dictionary? propSettings = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propSeedHosts.TryReadProperty(ref reader, options, PropSeedHosts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { - var property = reader.GetString(); - if (property == "seed_hosts") - { - seedHosts = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "seed_providers") - { - seedProviders = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; + } - if (property == "type") - { - type = JsonSerializer.Deserialize(ref reader, options); - continue; - } + if (propSeedProviders.TryReadProperty(ref reader, options, PropSeedProviders, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; } + + propSettings ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out object value, null, null); + propSettings[key] = value; } - return new NodeInfoDiscover { SeedHosts = seedHosts, SeedProviders = seedProviders, Settings = additionalProperties, Type = type }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SeedHosts = propSeedHosts.Value, + SeedProviders = propSeedProviders.Value, + Settings = propSettings, + Type = propType.Value + }; } - public override void Write(Utf8JsonWriter writer, NodeInfoDiscover value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscover value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'NodeInfoDiscover' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropSeedHosts, value.SeedHosts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSeedProviders, value.SeedProviders, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + if (value.Settings is not null) + { + foreach (var item in value.Settings) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } -[JsonConverter(typeof(NodeInfoDiscoverConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscoverConverter))] public sealed partial class NodeInfoDiscover { - public IReadOnlyCollection? SeedHosts { get; init; } - public IReadOnlyCollection? SeedProviders { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoDiscover() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoDiscover() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoDiscover(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyCollection? SeedHosts { get; set; } + public System.Collections.Generic.IReadOnlyCollection? SeedProviders { get; set; } /// /// /// Additional or alternative settings /// /// - public IReadOnlyDictionary Settings { get; init; } - public string? Type { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Settings { get; set; } + public string? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoHttp.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoHttp.g.cs index 2e4ac027378..fea1534a566 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoHttp.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoHttp.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoHttpConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoundAddress = System.Text.Json.JsonEncodedText.Encode("bound_address"); + private static readonly System.Text.Json.JsonEncodedText PropMaxContentLength = System.Text.Json.JsonEncodedText.Encode("max_content_length"); + private static readonly System.Text.Json.JsonEncodedText PropMaxContentLengthInBytes = System.Text.Json.JsonEncodedText.Encode("max_content_length_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPublishAddress = System.Text.Json.JsonEncodedText.Encode("publish_address"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttp Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBoundAddress = default; + LocalJsonValue propMaxContentLength = default; + LocalJsonValue propMaxContentLengthInBytes = default; + LocalJsonValue propPublishAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoundAddress.TryReadProperty(ref reader, options, PropBoundAddress, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMaxContentLength.TryReadProperty(ref reader, options, PropMaxContentLength, null)) + { + continue; + } + + if (propMaxContentLengthInBytes.TryReadProperty(ref reader, options, PropMaxContentLengthInBytes, null)) + { + continue; + } + + if (propPublishAddress.TryReadProperty(ref reader, options, PropPublishAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BoundAddress = propBoundAddress.Value, + MaxContentLength = propMaxContentLength.Value, + MaxContentLengthInBytes = propMaxContentLengthInBytes.Value, + PublishAddress = propPublishAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttp value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoundAddress, value.BoundAddress, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxContentLength, value.MaxContentLength, null, null); + writer.WriteProperty(options, PropMaxContentLengthInBytes, value.MaxContentLengthInBytes, null, null); + writer.WriteProperty(options, PropPublishAddress, value.PublishAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoHttpConverter))] public sealed partial class NodeInfoHttp { - [JsonInclude, JsonPropertyName("bound_address")] - public IReadOnlyCollection BoundAddress { get; init; } - [JsonInclude, JsonPropertyName("max_content_length")] - public Elastic.Clients.Elasticsearch.ByteSize? MaxContentLength { get; init; } - [JsonInclude, JsonPropertyName("max_content_length_in_bytes")] - public long MaxContentLengthInBytes { get; init; } - [JsonInclude, JsonPropertyName("publish_address")] - public string PublishAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoHttp(System.Collections.Generic.IReadOnlyCollection boundAddress, long maxContentLengthInBytes, string publishAddress) + { + BoundAddress = boundAddress; + MaxContentLengthInBytes = maxContentLengthInBytes; + PublishAddress = publishAddress; + } +#if NET7_0_OR_GREATER + public NodeInfoHttp() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoHttp() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoHttp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BoundAddress { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? MaxContentLength { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxContentLengthInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PublishAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngest.g.cs index d9ae0766eee..158808bafc1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngest.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoIngestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropProcessors = System.Text.Json.JsonEncodedText.Encode("processors"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propProcessors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propProcessors.TryReadProperty(ref reader, options, PropProcessors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Processors = propProcessors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropProcessors, value.Processors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestConverter))] public sealed partial class NodeInfoIngest { - [JsonInclude, JsonPropertyName("processors")] - public IReadOnlyCollection Processors { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoIngest(System.Collections.Generic.IReadOnlyCollection processors) + { + Processors = processors; + } +#if NET7_0_OR_GREATER + public NodeInfoIngest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoIngest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Processors { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestDownloader.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestDownloader.g.cs index ac4fa4f3c42..c3351267c2e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestDownloader.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestDownloader.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoIngestDownloaderConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloaderConverter))] public sealed partial class NodeInfoIngestDownloader { - [JsonInclude, JsonPropertyName("enabled")] - public string Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoIngestDownloader(string enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public NodeInfoIngestDownloader() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoIngestDownloader() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoIngestDownloader(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestInfo.g.cs index 8044782be08..b5db0dcafa6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestInfo.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoIngestInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDownloader = System.Text.Json.JsonEncodedText.Encode("downloader"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDownloader = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDownloader.TryReadProperty(ref reader, options, PropDownloader, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Downloader = propDownloader.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDownloader, value.Downloader, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfoConverter))] public sealed partial class NodeInfoIngestInfo { - [JsonInclude, JsonPropertyName("downloader")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader Downloader { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoIngestInfo(Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader downloader) + { + Downloader = downloader; + } +#if NET7_0_OR_GREATER + public NodeInfoIngestInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoIngestInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoIngestInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestDownloader Downloader { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestProcessor.g.cs index b8f99908cac..f6b5bd4af43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoIngestProcessor.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoIngestProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestProcessorConverter))] public sealed partial class NodeInfoIngestProcessor { - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoIngestProcessor(string type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public NodeInfoIngestProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoIngestProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoIngestProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoJvmMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoJvmMemory.g.cs index d8a639e25a2..e0e311c9b7e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoJvmMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoJvmMemory.g.cs @@ -17,36 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoJvmMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDirectMax = System.Text.Json.JsonEncodedText.Encode("direct_max"); + private static readonly System.Text.Json.JsonEncodedText PropDirectMaxInBytes = System.Text.Json.JsonEncodedText.Encode("direct_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapInit = System.Text.Json.JsonEncodedText.Encode("heap_init"); + private static readonly System.Text.Json.JsonEncodedText PropHeapInitInBytes = System.Text.Json.JsonEncodedText.Encode("heap_init_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropHeapMax = System.Text.Json.JsonEncodedText.Encode("heap_max"); + private static readonly System.Text.Json.JsonEncodedText PropHeapMaxInBytes = System.Text.Json.JsonEncodedText.Encode("heap_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapInit = System.Text.Json.JsonEncodedText.Encode("non_heap_init"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapInitInBytes = System.Text.Json.JsonEncodedText.Encode("non_heap_init_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapMax = System.Text.Json.JsonEncodedText.Encode("non_heap_max"); + private static readonly System.Text.Json.JsonEncodedText PropNonHeapMaxInBytes = System.Text.Json.JsonEncodedText.Encode("non_heap_max_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDirectMax = default; + LocalJsonValue propDirectMaxInBytes = default; + LocalJsonValue propHeapInit = default; + LocalJsonValue propHeapInitInBytes = default; + LocalJsonValue propHeapMax = default; + LocalJsonValue propHeapMaxInBytes = default; + LocalJsonValue propNonHeapInit = default; + LocalJsonValue propNonHeapInitInBytes = default; + LocalJsonValue propNonHeapMax = default; + LocalJsonValue propNonHeapMaxInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDirectMax.TryReadProperty(ref reader, options, PropDirectMax, null)) + { + continue; + } + + if (propDirectMaxInBytes.TryReadProperty(ref reader, options, PropDirectMaxInBytes, null)) + { + continue; + } + + if (propHeapInit.TryReadProperty(ref reader, options, PropHeapInit, null)) + { + continue; + } + + if (propHeapInitInBytes.TryReadProperty(ref reader, options, PropHeapInitInBytes, null)) + { + continue; + } + + if (propHeapMax.TryReadProperty(ref reader, options, PropHeapMax, null)) + { + continue; + } + + if (propHeapMaxInBytes.TryReadProperty(ref reader, options, PropHeapMaxInBytes, null)) + { + continue; + } + + if (propNonHeapInit.TryReadProperty(ref reader, options, PropNonHeapInit, null)) + { + continue; + } + + if (propNonHeapInitInBytes.TryReadProperty(ref reader, options, PropNonHeapInitInBytes, null)) + { + continue; + } + + if (propNonHeapMax.TryReadProperty(ref reader, options, PropNonHeapMax, null)) + { + continue; + } + + if (propNonHeapMaxInBytes.TryReadProperty(ref reader, options, PropNonHeapMaxInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DirectMax = propDirectMax.Value, + DirectMaxInBytes = propDirectMaxInBytes.Value, + HeapInit = propHeapInit.Value, + HeapInitInBytes = propHeapInitInBytes.Value, + HeapMax = propHeapMax.Value, + HeapMaxInBytes = propHeapMaxInBytes.Value, + NonHeapInit = propNonHeapInit.Value, + NonHeapInitInBytes = propNonHeapInitInBytes.Value, + NonHeapMax = propNonHeapMax.Value, + NonHeapMaxInBytes = propNonHeapMaxInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDirectMax, value.DirectMax, null, null); + writer.WriteProperty(options, PropDirectMaxInBytes, value.DirectMaxInBytes, null, null); + writer.WriteProperty(options, PropHeapInit, value.HeapInit, null, null); + writer.WriteProperty(options, PropHeapInitInBytes, value.HeapInitInBytes, null, null); + writer.WriteProperty(options, PropHeapMax, value.HeapMax, null, null); + writer.WriteProperty(options, PropHeapMaxInBytes, value.HeapMaxInBytes, null, null); + writer.WriteProperty(options, PropNonHeapInit, value.NonHeapInit, null, null); + writer.WriteProperty(options, PropNonHeapInitInBytes, value.NonHeapInitInBytes, null, null); + writer.WriteProperty(options, PropNonHeapMax, value.NonHeapMax, null, null); + writer.WriteProperty(options, PropNonHeapMaxInBytes, value.NonHeapMaxInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemoryConverter))] public sealed partial class NodeInfoJvmMemory { - [JsonInclude, JsonPropertyName("direct_max")] - public Elastic.Clients.Elasticsearch.ByteSize? DirectMax { get; init; } - [JsonInclude, JsonPropertyName("direct_max_in_bytes")] - public long DirectMaxInBytes { get; init; } - [JsonInclude, JsonPropertyName("heap_init")] - public Elastic.Clients.Elasticsearch.ByteSize? HeapInit { get; init; } - [JsonInclude, JsonPropertyName("heap_init_in_bytes")] - public long HeapInitInBytes { get; init; } - [JsonInclude, JsonPropertyName("heap_max")] - public Elastic.Clients.Elasticsearch.ByteSize? HeapMax { get; init; } - [JsonInclude, JsonPropertyName("heap_max_in_bytes")] - public long HeapMaxInBytes { get; init; } - [JsonInclude, JsonPropertyName("non_heap_init")] - public Elastic.Clients.Elasticsearch.ByteSize? NonHeapInit { get; init; } - [JsonInclude, JsonPropertyName("non_heap_init_in_bytes")] - public long NonHeapInitInBytes { get; init; } - [JsonInclude, JsonPropertyName("non_heap_max")] - public Elastic.Clients.Elasticsearch.ByteSize? NonHeapMax { get; init; } - [JsonInclude, JsonPropertyName("non_heap_max_in_bytes")] - public long NonHeapMaxInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoJvmMemory(long directMaxInBytes, long heapInitInBytes, long heapMaxInBytes, long nonHeapInitInBytes, long nonHeapMaxInBytes) + { + DirectMaxInBytes = directMaxInBytes; + HeapInitInBytes = heapInitInBytes; + HeapMaxInBytes = heapMaxInBytes; + NonHeapInitInBytes = nonHeapInitInBytes; + NonHeapMaxInBytes = nonHeapMaxInBytes; + } +#if NET7_0_OR_GREATER + public NodeInfoJvmMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoJvmMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoJvmMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ByteSize? DirectMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DirectMaxInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? HeapInit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long HeapInitInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? HeapMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long HeapMaxInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? NonHeapInit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NonHeapInitInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? NonHeapMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NonHeapMaxInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoMemory.g.cs index 61395f760b8..1e6aa6869db 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoMemory.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalInBytes = System.Text.Json.JsonEncodedText.Encode("total_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTotal = default; + LocalJsonValue propTotalInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalInBytes.TryReadProperty(ref reader, options, PropTotalInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Total = propTotal.Value, + TotalInBytes = propTotalInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalInBytes, value.TotalInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemoryConverter))] public sealed partial class NodeInfoMemory { - [JsonInclude, JsonPropertyName("total")] - public string Total { get; init; } - [JsonInclude, JsonPropertyName("total_in_bytes")] - public long TotalInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoMemory(string total, long totalInBytes) + { + Total = total; + TotalInBytes = totalInBytes; + } +#if NET7_0_OR_GREATER + public NodeInfoMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Total { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetwork.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetwork.g.cs index da1d524b882..3164acbad0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetwork.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetwork.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoNetworkConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPrimaryInterface = System.Text.Json.JsonEncodedText.Encode("primary_interface"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshInterval = System.Text.Json.JsonEncodedText.Encode("refresh_interval"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetwork Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPrimaryInterface = default; + LocalJsonValue propRefreshInterval = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPrimaryInterface.TryReadProperty(ref reader, options, PropPrimaryInterface, null)) + { + continue; + } + + if (propRefreshInterval.TryReadProperty(ref reader, options, PropRefreshInterval, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetwork(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PrimaryInterface = propPrimaryInterface.Value, + RefreshInterval = propRefreshInterval.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetwork value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPrimaryInterface, value.PrimaryInterface, null, null); + writer.WriteProperty(options, PropRefreshInterval, value.RefreshInterval, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkConverter))] public sealed partial class NodeInfoNetwork { - [JsonInclude, JsonPropertyName("primary_interface")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface PrimaryInterface { get; init; } - [JsonInclude, JsonPropertyName("refresh_interval")] - public int RefreshInterval { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoNetwork(Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface primaryInterface, int refreshInterval) + { + PrimaryInterface = primaryInterface; + RefreshInterval = refreshInterval; + } +#if NET7_0_OR_GREATER + public NodeInfoNetwork() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoNetwork() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoNetwork(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface PrimaryInterface { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int RefreshInterval { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetworkInterface.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetworkInterface.g.cs index efb7d96d678..6ab85b6bc51 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetworkInterface.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoNetworkInterface.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoNetworkInterfaceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAddress = System.Text.Json.JsonEncodedText.Encode("address"); + private static readonly System.Text.Json.JsonEncodedText PropMacAddress = System.Text.Json.JsonEncodedText.Encode("mac_address"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAddress = default; + LocalJsonValue propMacAddress = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAddress.TryReadProperty(ref reader, options, PropAddress, null)) + { + continue; + } + + if (propMacAddress.TryReadProperty(ref reader, options, PropMacAddress, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Address = propAddress.Value, + MacAddress = propMacAddress.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterface value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAddress, value.Address, null, null); + writer.WriteProperty(options, PropMacAddress, value.MacAddress, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoNetworkInterfaceConverter))] public sealed partial class NodeInfoNetworkInterface { - [JsonInclude, JsonPropertyName("address")] - public string Address { get; init; } - [JsonInclude, JsonPropertyName("mac_address")] - public string MacAddress { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoNetworkInterface(string address, string macAddress, string name) + { + Address = address; + MacAddress = macAddress; + Name = name; + } +#if NET7_0_OR_GREATER + public NodeInfoNetworkInterface() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoNetworkInterface() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoNetworkInterface(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Address { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string MacAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoOSCPU.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoOSCPU.g.cs index d81b65ee069..8b547d314d3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoOSCPU.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoOSCPU.g.cs @@ -17,32 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoOSCPUConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheSize = System.Text.Json.JsonEncodedText.Encode("cache_size"); + private static readonly System.Text.Json.JsonEncodedText PropCacheSizeInBytes = System.Text.Json.JsonEncodedText.Encode("cache_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCoresPerSocket = System.Text.Json.JsonEncodedText.Encode("cores_per_socket"); + private static readonly System.Text.Json.JsonEncodedText PropMhz = System.Text.Json.JsonEncodedText.Encode("mhz"); + private static readonly System.Text.Json.JsonEncodedText PropModel = System.Text.Json.JsonEncodedText.Encode("model"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCores = System.Text.Json.JsonEncodedText.Encode("total_cores"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSockets = System.Text.Json.JsonEncodedText.Encode("total_sockets"); + private static readonly System.Text.Json.JsonEncodedText PropVendor = System.Text.Json.JsonEncodedText.Encode("vendor"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPU Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheSize = default; + LocalJsonValue propCacheSizeInBytes = default; + LocalJsonValue propCoresPerSocket = default; + LocalJsonValue propMhz = default; + LocalJsonValue propModel = default; + LocalJsonValue propTotalCores = default; + LocalJsonValue propTotalSockets = default; + LocalJsonValue propVendor = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheSize.TryReadProperty(ref reader, options, PropCacheSize, null)) + { + continue; + } + + if (propCacheSizeInBytes.TryReadProperty(ref reader, options, PropCacheSizeInBytes, null)) + { + continue; + } + + if (propCoresPerSocket.TryReadProperty(ref reader, options, PropCoresPerSocket, null)) + { + continue; + } + + if (propMhz.TryReadProperty(ref reader, options, PropMhz, null)) + { + continue; + } + + if (propModel.TryReadProperty(ref reader, options, PropModel, null)) + { + continue; + } + + if (propTotalCores.TryReadProperty(ref reader, options, PropTotalCores, null)) + { + continue; + } + + if (propTotalSockets.TryReadProperty(ref reader, options, PropTotalSockets, null)) + { + continue; + } + + if (propVendor.TryReadProperty(ref reader, options, PropVendor, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPU(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheSize = propCacheSize.Value, + CacheSizeInBytes = propCacheSizeInBytes.Value, + CoresPerSocket = propCoresPerSocket.Value, + Mhz = propMhz.Value, + Model = propModel.Value, + TotalCores = propTotalCores.Value, + TotalSockets = propTotalSockets.Value, + Vendor = propVendor.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPU value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheSize, value.CacheSize, null, null); + writer.WriteProperty(options, PropCacheSizeInBytes, value.CacheSizeInBytes, null, null); + writer.WriteProperty(options, PropCoresPerSocket, value.CoresPerSocket, null, null); + writer.WriteProperty(options, PropMhz, value.Mhz, null, null); + writer.WriteProperty(options, PropModel, value.Model, null, null); + writer.WriteProperty(options, PropTotalCores, value.TotalCores, null, null); + writer.WriteProperty(options, PropTotalSockets, value.TotalSockets, null, null); + writer.WriteProperty(options, PropVendor, value.Vendor, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPUConverter))] public sealed partial class NodeInfoOSCPU { - [JsonInclude, JsonPropertyName("cache_size")] - public string CacheSize { get; init; } - [JsonInclude, JsonPropertyName("cache_size_in_bytes")] - public int CacheSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("cores_per_socket")] - public int CoresPerSocket { get; init; } - [JsonInclude, JsonPropertyName("mhz")] - public int Mhz { get; init; } - [JsonInclude, JsonPropertyName("model")] - public string Model { get; init; } - [JsonInclude, JsonPropertyName("total_cores")] - public int TotalCores { get; init; } - [JsonInclude, JsonPropertyName("total_sockets")] - public int TotalSockets { get; init; } - [JsonInclude, JsonPropertyName("vendor")] - public string Vendor { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoOSCPU(string cacheSize, int cacheSizeInBytes, int coresPerSocket, int mhz, string model, int totalCores, int totalSockets, string vendor) + { + CacheSize = cacheSize; + CacheSizeInBytes = cacheSizeInBytes; + CoresPerSocket = coresPerSocket; + Mhz = mhz; + Model = model; + TotalCores = totalCores; + TotalSockets = totalSockets; + Vendor = vendor; + } +#if NET7_0_OR_GREATER + public NodeInfoOSCPU() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoOSCPU() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoOSCPU(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string CacheSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int CacheSizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int CoresPerSocket { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Mhz { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Model { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalCores { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int TotalSockets { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Vendor { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoPath.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoPath.g.cs index d80db597c5b..4b2295e3832 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoPath.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoPath.g.cs @@ -17,25 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoPathConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropHome = System.Text.Json.JsonEncodedText.Encode("home"); + private static readonly System.Text.Json.JsonEncodedText PropLogs = System.Text.Json.JsonEncodedText.Encode("logs"); + private static readonly System.Text.Json.JsonEncodedText PropRepo = System.Text.Json.JsonEncodedText.Encode("repo"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoPath Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propData = default; + LocalJsonValue propHome = default; + LocalJsonValue propLogs = default; + LocalJsonValue?> propRepo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propHome.TryReadProperty(ref reader, options, PropHome, null)) + { + continue; + } + + if (propLogs.TryReadProperty(ref reader, options, PropLogs, null)) + { + continue; + } + + if (propRepo.TryReadProperty(ref reader, options, PropRepo, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoPath(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Home = propHome.Value, + Logs = propLogs.Value, + Repo = propRepo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoPath value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHome, value.Home, null, null); + writer.WriteProperty(options, PropLogs, value.Logs, null, null); + writer.WriteProperty(options, PropRepo, value.Repo, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoPathConverter))] public sealed partial class NodeInfoPath { - [JsonInclude, JsonPropertyName("data")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? Data { get; init; } - [JsonInclude, JsonPropertyName("home")] - public string? Home { get; init; } - [JsonInclude, JsonPropertyName("logs")] - public string? Logs { get; init; } - [JsonInclude, JsonPropertyName("repo")] - public IReadOnlyCollection? Repo { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoPath() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoPath() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoPath(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Data { get; set; } + public string? Home { get; set; } + public string? Logs { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Repo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositories.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositories.g.cs index 543b865db20..985ef88a8c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositories.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositories.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoRepositoriesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropUrl = System.Text.Json.JsonEncodedText.Encode("url"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositories Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUrl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUrl.TryReadProperty(ref reader, options, PropUrl, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositories(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Url = propUrl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositories value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUrl, value.Url, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesConverter))] public sealed partial class NodeInfoRepositories { - [JsonInclude, JsonPropertyName("url")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl Url { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoRepositories(Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl url) + { + Url = url; + } +#if NET7_0_OR_GREATER + public NodeInfoRepositories() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoRepositories() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoRepositories(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl Url { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositoriesUrl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositoriesUrl.g.cs index 8b331278625..1d1c5f3c24e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositoriesUrl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoRepositoriesUrl.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoRepositoriesUrlConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowedUrls = System.Text.Json.JsonEncodedText.Encode("allowed_urls"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowedUrls = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowedUrls.TryReadProperty(ref reader, options, PropAllowedUrls, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowedUrls = propAllowedUrls.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrl value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowedUrls, value.AllowedUrls, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositoriesUrlConverter))] public sealed partial class NodeInfoRepositoriesUrl { - [JsonInclude, JsonPropertyName("allowed_urls")] - public string AllowedUrls { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoRepositoriesUrl(string allowedUrls) + { + AllowedUrls = allowedUrls; + } +#if NET7_0_OR_GREATER + public NodeInfoRepositoriesUrl() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoRepositoriesUrl() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoRepositoriesUrl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string AllowedUrls { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoScript.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoScript.g.cs index a337db042a8..b2760463c7c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoScript.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoScript.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoScriptConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowedTypes = System.Text.Json.JsonEncodedText.Encode("allowed_types"); + private static readonly System.Text.Json.JsonEncodedText PropDisableMaxCompilationsRate = System.Text.Json.JsonEncodedText.Encode("disable_max_compilations_rate"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoScript Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowedTypes = default; + LocalJsonValue propDisableMaxCompilationsRate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowedTypes.TryReadProperty(ref reader, options, PropAllowedTypes, null)) + { + continue; + } + + if (propDisableMaxCompilationsRate.TryReadProperty(ref reader, options, PropDisableMaxCompilationsRate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowedTypes = propAllowedTypes.Value, + DisableMaxCompilationsRate = propDisableMaxCompilationsRate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoScript value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowedTypes, value.AllowedTypes, null, null); + writer.WriteProperty(options, PropDisableMaxCompilationsRate, value.DisableMaxCompilationsRate, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoScriptConverter))] public sealed partial class NodeInfoScript { - [JsonInclude, JsonPropertyName("allowed_types")] - public string AllowedTypes { get; init; } - [JsonInclude, JsonPropertyName("disable_max_compilations_rate")] - public string? DisableMaxCompilationsRate { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoScript(string allowedTypes) + { + AllowedTypes = allowedTypes; + } +#if NET7_0_OR_GREATER + public NodeInfoScript() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoScript() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string AllowedTypes { get; set; } + public string? DisableMaxCompilationsRate { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearch.g.cs index bdd14afe213..dcb60b62647 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearch.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSearchConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRemote = System.Text.Json.JsonEncodedText.Encode("remote"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRemote = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRemote.TryReadProperty(ref reader, options, PropRemote, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Remote = propRemote.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRemote, value.Remote, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchConverter))] public sealed partial class NodeInfoSearch { - [JsonInclude, JsonPropertyName("remote")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote Remote { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSearch(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote remote) + { + Remote = remote; + } +#if NET7_0_OR_GREATER + public NodeInfoSearch() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSearch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSearch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote Remote { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearchRemote.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearchRemote.g.cs index 7264d9627d1..5e7ac51257b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearchRemote.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSearchRemote.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSearchRemoteConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConnect = System.Text.Json.JsonEncodedText.Encode("connect"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConnect = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConnect.TryReadProperty(ref reader, options, PropConnect, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Connect = propConnect.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemote value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConnect, value.Connect, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearchRemoteConverter))] public sealed partial class NodeInfoSearchRemote { - [JsonInclude, JsonPropertyName("connect")] - public string Connect { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSearchRemote(string connect) + { + Connect = connect; + } +#if NET7_0_OR_GREATER + public NodeInfoSearchRemote() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSearchRemote() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSearchRemote(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Connect { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettings.g.cs index 7338c3d1df9..91d78036381 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettings.g.cs @@ -17,46 +17,234 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropBootstrap = System.Text.Json.JsonEncodedText.Encode("bootstrap"); + private static readonly System.Text.Json.JsonEncodedText PropClient = System.Text.Json.JsonEncodedText.Encode("client"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDiscovery = System.Text.Json.JsonEncodedText.Encode("discovery"); + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropNetwork = System.Text.Json.JsonEncodedText.Encode("network"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropRepositories = System.Text.Json.JsonEncodedText.Encode("repositories"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + private static readonly System.Text.Json.JsonEncodedText PropXpack = System.Text.Json.JsonEncodedText.Encode("xpack"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propBootstrap = default; + LocalJsonValue propClient = default; + LocalJsonValue propCluster = default; + LocalJsonValue propDiscovery = default; + LocalJsonValue propHttp = default; + LocalJsonValue propIngest = default; + LocalJsonValue propNetwork = default; + LocalJsonValue propNode = default; + LocalJsonValue propPath = default; + LocalJsonValue propRepositories = default; + LocalJsonValue propScript = default; + LocalJsonValue propSearch = default; + LocalJsonValue propTransport = default; + LocalJsonValue propXpack = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propBootstrap.TryReadProperty(ref reader, options, PropBootstrap, null)) + { + continue; + } + + if (propClient.TryReadProperty(ref reader, options, PropClient, null)) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, null)) + { + continue; + } + + if (propDiscovery.TryReadProperty(ref reader, options, PropDiscovery, null)) + { + continue; + } + + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propNetwork.TryReadProperty(ref reader, options, PropNetwork, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propRepositories.TryReadProperty(ref reader, options, PropRepositories, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (propXpack.TryReadProperty(ref reader, options, PropXpack, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Bootstrap = propBootstrap.Value, + Client = propClient.Value, + Cluster = propCluster.Value, + Discovery = propDiscovery.Value, + Http = propHttp.Value, + Ingest = propIngest.Value, + Network = propNetwork.Value, + Node = propNode.Value, + Path = propPath.Value, + Repositories = propRepositories.Value, + Script = propScript.Value, + Search = propSearch.Value, + Transport = propTransport.Value, + Xpack = propXpack.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropBootstrap, value.Bootstrap, null, null); + writer.WriteProperty(options, PropClient, value.Client, null, null); + writer.WriteProperty(options, PropCluster, value.Cluster, null, null); + writer.WriteProperty(options, PropDiscovery, value.Discovery, null, null); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropNetwork, value.Network, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropRepositories, value.Repositories, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteProperty(options, PropXpack, value.Xpack, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsConverter))] public sealed partial class NodeInfoSettings { - [JsonInclude, JsonPropertyName("action")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoAction? Action { get; init; } - [JsonInclude, JsonPropertyName("bootstrap")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrap? Bootstrap { get; init; } - [JsonInclude, JsonPropertyName("client")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoClient? Client { get; init; } - [JsonInclude, JsonPropertyName("cluster")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster Cluster { get; init; } - [JsonInclude, JsonPropertyName("discovery")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscover? Discovery { get; init; } - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp Http { get; init; } - [JsonInclude, JsonPropertyName("ingest")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngest? Ingest { get; init; } - [JsonInclude, JsonPropertyName("network")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetwork? Network { get; init; } - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode Node { get; init; } - [JsonInclude, JsonPropertyName("path")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoPath? Path { get; init; } - [JsonInclude, JsonPropertyName("repositories")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositories? Repositories { get; init; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoScript? Script { get; init; } - [JsonInclude, JsonPropertyName("search")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearch? Search { get; init; } - [JsonInclude, JsonPropertyName("transport")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport Transport { get; init; } - [JsonInclude, JsonPropertyName("xpack")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpack? Xpack { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettings(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster cluster, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp http, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode node, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport transport) + { + Cluster = cluster; + Http = http; + Node = node; + Transport = transport; + } +#if NET7_0_OR_GREATER + public NodeInfoSettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoAction? Action { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoBootstrap? Bootstrap { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoClient? Client { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster Cluster { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoDiscover? Discovery { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp Http { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngest? Ingest { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetwork? Network { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode Node { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoPath? Path { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoRepositories? Repositories { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoScript? Script { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSearch? Search { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport Transport { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpack? Xpack { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsCluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsCluster.g.cs index 0308d9c0a18..695994ef49b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsCluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsCluster.g.cs @@ -17,26 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsClusterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeprecationIndexing = System.Text.Json.JsonEncodedText.Encode("deprecation_indexing"); + private static readonly System.Text.Json.JsonEncodedText PropElection = System.Text.Json.JsonEncodedText.Encode("election"); + private static readonly System.Text.Json.JsonEncodedText PropInitialMasterNodes = System.Text.Json.JsonEncodedText.Encode("initial_master_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeprecationIndexing = default; + LocalJsonValue propElection = default; + LocalJsonValue?> propInitialMasterNodes = default; + LocalJsonValue propName = default; + LocalJsonValue propRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeprecationIndexing.TryReadProperty(ref reader, options, PropDeprecationIndexing, null)) + { + continue; + } + + if (propElection.TryReadProperty(ref reader, options, PropElection, null)) + { + continue; + } + + if (propInitialMasterNodes.TryReadProperty(ref reader, options, PropInitialMasterNodes, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeprecationIndexing = propDeprecationIndexing.Value, + Election = propElection.Value, + InitialMasterNodes = propInitialMasterNodes.Value, + Name = propName.Value, + Routing = propRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsCluster value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeprecationIndexing, value.DeprecationIndexing, null, null); + writer.WriteProperty(options, PropElection, value.Election, null, null); + writer.WriteProperty(options, PropInitialMasterNodes, value.InitialMasterNodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterConverter))] public sealed partial class NodeInfoSettingsCluster { - [JsonInclude, JsonPropertyName("deprecation_indexing")] - public Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexing? DeprecationIndexing { get; init; } - [JsonInclude, JsonPropertyName("election")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection Election { get; init; } - [JsonInclude, JsonPropertyName("initial_master_nodes")] - public IReadOnlyCollection? InitialMasterNodes { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("routing")] - public Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? Routing { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsCluster(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection election, string name) + { + Election = election; + Name = name; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsCluster() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsCluster() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsCluster(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.DeprecationIndexing? DeprecationIndexing { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection Election { get; set; } + public System.Collections.Generic.IReadOnlyCollection? InitialMasterNodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexRouting? Routing { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsClusterElection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsClusterElection.g.cs index 7ae65fdafe3..3036f61e73a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsClusterElection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsClusterElection.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsClusterElectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStrategy = System.Text.Json.JsonEncodedText.Encode("strategy"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStrategy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStrategy.TryReadProperty(ref reader, options, PropStrategy, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Strategy = propStrategy.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStrategy, value.Strategy, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsClusterElectionConverter))] public sealed partial class NodeInfoSettingsClusterElection { - [JsonInclude, JsonPropertyName("strategy")] - public string Strategy { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsClusterElection(string strategy) + { + Strategy = strategy; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsClusterElection() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsClusterElection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsClusterElection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Strategy { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttp.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttp.g.cs index accd4ab886e..e89a5404168 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttp.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttp.g.cs @@ -17,24 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsHttpConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompression = System.Text.Json.JsonEncodedText.Encode("compression"); + private static readonly System.Text.Json.JsonEncodedText PropPort = System.Text.Json.JsonEncodedText.Encode("port"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropTypeDefault = System.Text.Json.JsonEncodedText.Encode("type.default"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCompression = default; + LocalJsonValue?> propPort = default; + LocalJsonValue propType = default; + LocalJsonValue propTypeDefault = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompression.TryReadProperty(ref reader, options, PropCompression, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propPort.TryReadProperty(ref reader, options, PropPort, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propTypeDefault.TryReadProperty(ref reader, options, PropTypeDefault, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Compression = propCompression.Value, + Port = propPort.Value, + Type = propType.Value, + TypeDefault = propTypeDefault.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttp value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompression, value.Compression, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropPort, value.Port, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropTypeDefault, value.TypeDefault, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpConverter))] public sealed partial class NodeInfoSettingsHttp { - [JsonInclude, JsonPropertyName("compression")] - public object? Compression { get; init; } - [JsonInclude, JsonPropertyName("port")] - public object? Port { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType Type { get; init; } - [JsonInclude, JsonPropertyName("type.default")] - public string? TypeDefault { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsHttp(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsHttp() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsHttp() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsHttp(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Union? Compression { get; set; } + public Elastic.Clients.Elasticsearch.Union? Port { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType Type { get; set; } + public string? TypeDefault { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttpType.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttpType.g.cs index 59254699ab8..a7e521ff4b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttpType.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsHttpType.g.cs @@ -17,18 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsHttpTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefault = System.Text.Json.JsonEncodedText.Encode("default"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Default = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefault = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefault.TryReadProperty(ref reader, options, PropDefault, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Default = propDefault.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefault, value.Default, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsHttpTypeConverter))] public sealed partial class NodeInfoSettingsHttpType { - [JsonInclude, JsonPropertyName("default")] - public string Default { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsHttpType(string @default) + { + Default = @default; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsHttpType() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsHttpType() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsHttpType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Default { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsIngest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsIngest.g.cs index 312d3c9ac9c..7a7331023a4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsIngest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsIngest.g.cs @@ -17,84 +17,399 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsIngestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAppend = System.Text.Json.JsonEncodedText.Encode("append"); + private static readonly System.Text.Json.JsonEncodedText PropAttachment = System.Text.Json.JsonEncodedText.Encode("attachment"); + private static readonly System.Text.Json.JsonEncodedText PropBytes = System.Text.Json.JsonEncodedText.Encode("bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCircle = System.Text.Json.JsonEncodedText.Encode("circle"); + private static readonly System.Text.Json.JsonEncodedText PropConvert = System.Text.Json.JsonEncodedText.Encode("convert"); + private static readonly System.Text.Json.JsonEncodedText PropCsv = System.Text.Json.JsonEncodedText.Encode("csv"); + private static readonly System.Text.Json.JsonEncodedText PropDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText PropDateIndexName = System.Text.Json.JsonEncodedText.Encode("date_index_name"); + private static readonly System.Text.Json.JsonEncodedText PropDissect = System.Text.Json.JsonEncodedText.Encode("dissect"); + private static readonly System.Text.Json.JsonEncodedText PropDotExpander = System.Text.Json.JsonEncodedText.Encode("dot_expander"); + private static readonly System.Text.Json.JsonEncodedText PropDrop = System.Text.Json.JsonEncodedText.Encode("drop"); + private static readonly System.Text.Json.JsonEncodedText PropEnrich = System.Text.Json.JsonEncodedText.Encode("enrich"); + private static readonly System.Text.Json.JsonEncodedText PropFail = System.Text.Json.JsonEncodedText.Encode("fail"); + private static readonly System.Text.Json.JsonEncodedText PropForeach = System.Text.Json.JsonEncodedText.Encode("foreach"); + private static readonly System.Text.Json.JsonEncodedText PropGeoip = System.Text.Json.JsonEncodedText.Encode("geoip"); + private static readonly System.Text.Json.JsonEncodedText PropGrok = System.Text.Json.JsonEncodedText.Encode("grok"); + private static readonly System.Text.Json.JsonEncodedText PropGsub = System.Text.Json.JsonEncodedText.Encode("gsub"); + private static readonly System.Text.Json.JsonEncodedText PropInference = System.Text.Json.JsonEncodedText.Encode("inference"); + private static readonly System.Text.Json.JsonEncodedText PropJoin = System.Text.Json.JsonEncodedText.Encode("join"); + private static readonly System.Text.Json.JsonEncodedText PropJson = System.Text.Json.JsonEncodedText.Encode("json"); + private static readonly System.Text.Json.JsonEncodedText PropKv = System.Text.Json.JsonEncodedText.Encode("kv"); + private static readonly System.Text.Json.JsonEncodedText PropLowercase = System.Text.Json.JsonEncodedText.Encode("lowercase"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropRemove = System.Text.Json.JsonEncodedText.Encode("remove"); + private static readonly System.Text.Json.JsonEncodedText PropRename = System.Text.Json.JsonEncodedText.Encode("rename"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropSet = System.Text.Json.JsonEncodedText.Encode("set"); + private static readonly System.Text.Json.JsonEncodedText PropSetSecurityUser = System.Text.Json.JsonEncodedText.Encode("set_security_user"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropSplit = System.Text.Json.JsonEncodedText.Encode("split"); + private static readonly System.Text.Json.JsonEncodedText PropTrim = System.Text.Json.JsonEncodedText.Encode("trim"); + private static readonly System.Text.Json.JsonEncodedText PropUppercase = System.Text.Json.JsonEncodedText.Encode("uppercase"); + private static readonly System.Text.Json.JsonEncodedText PropUrlDecode = System.Text.Json.JsonEncodedText.Encode("urldecode"); + private static readonly System.Text.Json.JsonEncodedText PropUserAgent = System.Text.Json.JsonEncodedText.Encode("user_agent"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAppend = default; + LocalJsonValue propAttachment = default; + LocalJsonValue propBytes = default; + LocalJsonValue propCircle = default; + LocalJsonValue propConvert = default; + LocalJsonValue propCsv = default; + LocalJsonValue propDate = default; + LocalJsonValue propDateIndexName = default; + LocalJsonValue propDissect = default; + LocalJsonValue propDotExpander = default; + LocalJsonValue propDrop = default; + LocalJsonValue propEnrich = default; + LocalJsonValue propFail = default; + LocalJsonValue propForeach = default; + LocalJsonValue propGeoip = default; + LocalJsonValue propGrok = default; + LocalJsonValue propGsub = default; + LocalJsonValue propInference = default; + LocalJsonValue propJoin = default; + LocalJsonValue propJson = default; + LocalJsonValue propKv = default; + LocalJsonValue propLowercase = default; + LocalJsonValue propPipeline = default; + LocalJsonValue propRemove = default; + LocalJsonValue propRename = default; + LocalJsonValue propScript = default; + LocalJsonValue propSet = default; + LocalJsonValue propSetSecurityUser = default; + LocalJsonValue propSort = default; + LocalJsonValue propSplit = default; + LocalJsonValue propTrim = default; + LocalJsonValue propUppercase = default; + LocalJsonValue propUrlDecode = default; + LocalJsonValue propUserAgent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAppend.TryReadProperty(ref reader, options, PropAppend, null)) + { + continue; + } + + if (propAttachment.TryReadProperty(ref reader, options, PropAttachment, null)) + { + continue; + } + + if (propBytes.TryReadProperty(ref reader, options, PropBytes, null)) + { + continue; + } + + if (propCircle.TryReadProperty(ref reader, options, PropCircle, null)) + { + continue; + } + + if (propConvert.TryReadProperty(ref reader, options, PropConvert, null)) + { + continue; + } + + if (propCsv.TryReadProperty(ref reader, options, PropCsv, null)) + { + continue; + } + + if (propDate.TryReadProperty(ref reader, options, PropDate, null)) + { + continue; + } + + if (propDateIndexName.TryReadProperty(ref reader, options, PropDateIndexName, null)) + { + continue; + } + + if (propDissect.TryReadProperty(ref reader, options, PropDissect, null)) + { + continue; + } + + if (propDotExpander.TryReadProperty(ref reader, options, PropDotExpander, null)) + { + continue; + } + + if (propDrop.TryReadProperty(ref reader, options, PropDrop, null)) + { + continue; + } + + if (propEnrich.TryReadProperty(ref reader, options, PropEnrich, null)) + { + continue; + } + + if (propFail.TryReadProperty(ref reader, options, PropFail, null)) + { + continue; + } + + if (propForeach.TryReadProperty(ref reader, options, PropForeach, null)) + { + continue; + } + + if (propGeoip.TryReadProperty(ref reader, options, PropGeoip, null)) + { + continue; + } + + if (propGrok.TryReadProperty(ref reader, options, PropGrok, null)) + { + continue; + } + + if (propGsub.TryReadProperty(ref reader, options, PropGsub, null)) + { + continue; + } + + if (propInference.TryReadProperty(ref reader, options, PropInference, null)) + { + continue; + } + + if (propJoin.TryReadProperty(ref reader, options, PropJoin, null)) + { + continue; + } + + if (propJson.TryReadProperty(ref reader, options, PropJson, null)) + { + continue; + } + + if (propKv.TryReadProperty(ref reader, options, PropKv, null)) + { + continue; + } + + if (propLowercase.TryReadProperty(ref reader, options, PropLowercase, null)) + { + continue; + } + + if (propPipeline.TryReadProperty(ref reader, options, PropPipeline, null)) + { + continue; + } + + if (propRemove.TryReadProperty(ref reader, options, PropRemove, null)) + { + continue; + } + + if (propRename.TryReadProperty(ref reader, options, PropRename, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propSet.TryReadProperty(ref reader, options, PropSet, null)) + { + continue; + } + + if (propSetSecurityUser.TryReadProperty(ref reader, options, PropSetSecurityUser, null)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propSplit.TryReadProperty(ref reader, options, PropSplit, null)) + { + continue; + } + + if (propTrim.TryReadProperty(ref reader, options, PropTrim, null)) + { + continue; + } + + if (propUppercase.TryReadProperty(ref reader, options, PropUppercase, null)) + { + continue; + } + + if (propUrlDecode.TryReadProperty(ref reader, options, PropUrlDecode, null)) + { + continue; + } + + if (propUserAgent.TryReadProperty(ref reader, options, PropUserAgent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Append = propAppend.Value, + Attachment = propAttachment.Value, + Bytes = propBytes.Value, + Circle = propCircle.Value, + Convert = propConvert.Value, + Csv = propCsv.Value, + Date = propDate.Value, + DateIndexName = propDateIndexName.Value, + Dissect = propDissect.Value, + DotExpander = propDotExpander.Value, + Drop = propDrop.Value, + Enrich = propEnrich.Value, + Fail = propFail.Value, + Foreach = propForeach.Value, + Geoip = propGeoip.Value, + Grok = propGrok.Value, + Gsub = propGsub.Value, + Inference = propInference.Value, + Join = propJoin.Value, + Json = propJson.Value, + Kv = propKv.Value, + Lowercase = propLowercase.Value, + Pipeline = propPipeline.Value, + Remove = propRemove.Value, + Rename = propRename.Value, + Script = propScript.Value, + Set = propSet.Value, + SetSecurityUser = propSetSecurityUser.Value, + Sort = propSort.Value, + Split = propSplit.Value, + Trim = propTrim.Value, + Uppercase = propUppercase.Value, + UrlDecode = propUrlDecode.Value, + UserAgent = propUserAgent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAppend, value.Append, null, null); + writer.WriteProperty(options, PropAttachment, value.Attachment, null, null); + writer.WriteProperty(options, PropBytes, value.Bytes, null, null); + writer.WriteProperty(options, PropCircle, value.Circle, null, null); + writer.WriteProperty(options, PropConvert, value.Convert, null, null); + writer.WriteProperty(options, PropCsv, value.Csv, null, null); + writer.WriteProperty(options, PropDate, value.Date, null, null); + writer.WriteProperty(options, PropDateIndexName, value.DateIndexName, null, null); + writer.WriteProperty(options, PropDissect, value.Dissect, null, null); + writer.WriteProperty(options, PropDotExpander, value.DotExpander, null, null); + writer.WriteProperty(options, PropDrop, value.Drop, null, null); + writer.WriteProperty(options, PropEnrich, value.Enrich, null, null); + writer.WriteProperty(options, PropFail, value.Fail, null, null); + writer.WriteProperty(options, PropForeach, value.Foreach, null, null); + writer.WriteProperty(options, PropGeoip, value.Geoip, null, null); + writer.WriteProperty(options, PropGrok, value.Grok, null, null); + writer.WriteProperty(options, PropGsub, value.Gsub, null, null); + writer.WriteProperty(options, PropInference, value.Inference, null, null); + writer.WriteProperty(options, PropJoin, value.Join, null, null); + writer.WriteProperty(options, PropJson, value.Json, null, null); + writer.WriteProperty(options, PropKv, value.Kv, null, null); + writer.WriteProperty(options, PropLowercase, value.Lowercase, null, null); + writer.WriteProperty(options, PropPipeline, value.Pipeline, null, null); + writer.WriteProperty(options, PropRemove, value.Remove, null, null); + writer.WriteProperty(options, PropRename, value.Rename, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropSet, value.Set, null, null); + writer.WriteProperty(options, PropSetSecurityUser, value.SetSecurityUser, null, null); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropSplit, value.Split, null, null); + writer.WriteProperty(options, PropTrim, value.Trim, null, null); + writer.WriteProperty(options, PropUppercase, value.Uppercase, null, null); + writer.WriteProperty(options, PropUrlDecode, value.UrlDecode, null, null); + writer.WriteProperty(options, PropUserAgent, value.UserAgent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsIngestConverter))] public sealed partial class NodeInfoSettingsIngest { - [JsonInclude, JsonPropertyName("append")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Append { get; init; } - [JsonInclude, JsonPropertyName("attachment")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Attachment { get; init; } - [JsonInclude, JsonPropertyName("bytes")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Bytes { get; init; } - [JsonInclude, JsonPropertyName("circle")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Circle { get; init; } - [JsonInclude, JsonPropertyName("convert")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Convert { get; init; } - [JsonInclude, JsonPropertyName("csv")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Csv { get; init; } - [JsonInclude, JsonPropertyName("date")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Date { get; init; } - [JsonInclude, JsonPropertyName("date_index_name")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? DateIndexName { get; init; } - [JsonInclude, JsonPropertyName("dissect")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Dissect { get; init; } - [JsonInclude, JsonPropertyName("dot_expander")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? DotExpander { get; init; } - [JsonInclude, JsonPropertyName("drop")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Drop { get; init; } - [JsonInclude, JsonPropertyName("enrich")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Enrich { get; init; } - [JsonInclude, JsonPropertyName("fail")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Fail { get; init; } - [JsonInclude, JsonPropertyName("foreach")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Foreach { get; init; } - [JsonInclude, JsonPropertyName("geoip")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Geoip { get; init; } - [JsonInclude, JsonPropertyName("grok")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Grok { get; init; } - [JsonInclude, JsonPropertyName("gsub")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Gsub { get; init; } - [JsonInclude, JsonPropertyName("inference")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Inference { get; init; } - [JsonInclude, JsonPropertyName("join")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Join { get; init; } - [JsonInclude, JsonPropertyName("json")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Json { get; init; } - [JsonInclude, JsonPropertyName("kv")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Kv { get; init; } - [JsonInclude, JsonPropertyName("lowercase")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Lowercase { get; init; } - [JsonInclude, JsonPropertyName("pipeline")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Pipeline { get; init; } - [JsonInclude, JsonPropertyName("remove")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Remove { get; init; } - [JsonInclude, JsonPropertyName("rename")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Rename { get; init; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Script { get; init; } - [JsonInclude, JsonPropertyName("set")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Set { get; init; } - [JsonInclude, JsonPropertyName("set_security_user")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? SetSecurityUser { get; init; } - [JsonInclude, JsonPropertyName("sort")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Sort { get; init; } - [JsonInclude, JsonPropertyName("split")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Split { get; init; } - [JsonInclude, JsonPropertyName("trim")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Trim { get; init; } - [JsonInclude, JsonPropertyName("uppercase")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Uppercase { get; init; } - [JsonInclude, JsonPropertyName("urldecode")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? UrlDecode { get; init; } - [JsonInclude, JsonPropertyName("user_agent")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? UserAgent { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoSettingsIngest() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoSettingsIngest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsIngest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Append { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Attachment { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Bytes { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Circle { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Convert { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Csv { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Date { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? DateIndexName { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Dissect { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? DotExpander { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Drop { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Enrich { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Fail { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Foreach { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Geoip { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Grok { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Gsub { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Inference { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Join { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Json { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Kv { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Lowercase { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Pipeline { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Remove { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Rename { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Script { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Set { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? SetSecurityUser { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Sort { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Split { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Trim { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? Uppercase { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? UrlDecode { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoIngestInfo? UserAgent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNetwork.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNetwork.g.cs index 34db00f7452..9a80686d650 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNetwork.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNetwork.g.cs @@ -17,19 +17,69 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsNetworkConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetwork Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propHost = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHost.TryReadProperty(ref reader, options, PropHost, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetwork(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Host = propHost.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetwork value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHost, value.Host, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNetworkConverter))] public sealed partial class NodeInfoSettingsNetwork { - [JsonInclude, JsonPropertyName("host")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? Host { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoSettingsNetwork() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoSettingsNetwork() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsNetwork(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Host { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNode.g.cs index b80c6e372dd..6b90805a837 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsNode.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttr = System.Text.Json.JsonEncodedText.Encode("attr"); + private static readonly System.Text.Json.JsonEncodedText PropMaxLocalStorageNodes = System.Text.Json.JsonEncodedText.Encode("max_local_storage_nodes"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAttr = default; + LocalJsonValue propMaxLocalStorageNodes = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttr.TryReadProperty(ref reader, options, PropAttr, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propMaxLocalStorageNodes.TryReadProperty(ref reader, options, PropMaxLocalStorageNodes, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attr = propAttr.Value, + MaxLocalStorageNodes = propMaxLocalStorageNodes.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttr, value.Attr, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMaxLocalStorageNodes, value.MaxLocalStorageNodes, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsNodeConverter))] public sealed partial class NodeInfoSettingsNode { - [JsonInclude, JsonPropertyName("attr")] - public IReadOnlyDictionary Attr { get; init; } - [JsonInclude, JsonPropertyName("max_local_storage_nodes")] - public string? MaxLocalStorageNodes { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsNode(System.Collections.Generic.IReadOnlyDictionary attr, string name) + { + Attr = attr; + Name = name; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Attr { get; set; } + public string? MaxLocalStorageNodes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransport.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransport.g.cs index d4d6f35146e..a0b2a4d5ad5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransport.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransport.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsTransportConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropTypeDefault = System.Text.Json.JsonEncodedText.Encode("type.default"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFeatures = default; + LocalJsonValue propType = default; + LocalJsonValue propTypeDefault = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propTypeDefault.TryReadProperty(ref reader, options, PropTypeDefault, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Features = propFeatures.Value, + Type = propType.Value, + TypeDefault = propTypeDefault.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransport value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatures, value.Features, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropTypeDefault, value.TypeDefault, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportConverter))] public sealed partial class NodeInfoSettingsTransport { - [JsonInclude, JsonPropertyName("features")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeatures? Features { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType Type { get; init; } - [JsonInclude, JsonPropertyName("type.default")] - public string? TypeDefault { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsTransport(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsTransport() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsTransport() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsTransport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeatures? Features { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType Type { get; set; } + public string? TypeDefault { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportFeatures.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportFeatures.g.cs index 2cf50228502..bd7d494e12d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportFeatures.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportFeatures.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsTransportFeaturesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropXPack = System.Text.Json.JsonEncodedText.Encode("x-pack"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeatures Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propXPack = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propXPack.TryReadProperty(ref reader, options, PropXPack, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeatures(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + XPack = propXPack.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeatures value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropXPack, value.XPack, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportFeaturesConverter))] public sealed partial class NodeInfoSettingsTransportFeatures { - [JsonInclude, JsonPropertyName("x-pack")] - public string XPack { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsTransportFeatures(string xPack) + { + XPack = xPack; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsTransportFeatures() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsTransportFeatures() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsTransportFeatures(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string XPack { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportType.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportType.g.cs index 4ffc3899a83..0636c5dec13 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportType.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoSettingsTransportType.g.cs @@ -17,18 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoSettingsTransportTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDefault = System.Text.Json.JsonEncodedText.Encode("default"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Default = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDefault = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDefault.TryReadProperty(ref reader, options, PropDefault, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Default = propDefault.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDefault, value.Default, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoSettingsTransportTypeConverter))] public sealed partial class NodeInfoSettingsTransportType { - [JsonInclude, JsonPropertyName("default")] - public string Default { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoSettingsTransportType(string @default) + { + Default = @default; + } +#if NET7_0_OR_GREATER + public NodeInfoSettingsTransportType() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoSettingsTransportType() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoSettingsTransportType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Default { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoTransport.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoTransport.g.cs index f35843cc9aa..ad0ef21b011 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoTransport.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoTransport.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoTransportConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoundAddress = System.Text.Json.JsonEncodedText.Encode("bound_address"); + private static readonly System.Text.Json.JsonEncodedText PropProfiles = System.Text.Json.JsonEncodedText.Encode("profiles"); + private static readonly System.Text.Json.JsonEncodedText PropPublishAddress = System.Text.Json.JsonEncodedText.Encode("publish_address"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransport Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propBoundAddress = default; + LocalJsonValue> propProfiles = default; + LocalJsonValue propPublishAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoundAddress.TryReadProperty(ref reader, options, PropBoundAddress, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propProfiles.TryReadProperty(ref reader, options, PropProfiles, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propPublishAddress.TryReadProperty(ref reader, options, PropPublishAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BoundAddress = propBoundAddress.Value, + Profiles = propProfiles.Value, + PublishAddress = propPublishAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransport value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoundAddress, value.BoundAddress, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropProfiles, value.Profiles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPublishAddress, value.PublishAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoTransportConverter))] public sealed partial class NodeInfoTransport { - [JsonInclude, JsonPropertyName("bound_address")] - public IReadOnlyCollection BoundAddress { get; init; } - [JsonInclude, JsonPropertyName("profiles")] - public IReadOnlyDictionary Profiles { get; init; } - [JsonInclude, JsonPropertyName("publish_address")] - public string PublishAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoTransport(System.Collections.Generic.IReadOnlyCollection boundAddress, System.Collections.Generic.IReadOnlyDictionary profiles, string publishAddress) + { + BoundAddress = boundAddress; + Profiles = profiles; + PublishAddress = publishAddress; + } +#if NET7_0_OR_GREATER + public NodeInfoTransport() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoTransport() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoTransport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection BoundAddress { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Profiles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PublishAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpack.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpack.g.cs index eaefaf620c0..2e1b95bb251 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpack.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpack.g.cs @@ -17,24 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLicense = System.Text.Json.JsonEncodedText.Encode("license"); + private static readonly System.Text.Json.JsonEncodedText PropMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText PropNotification = System.Text.Json.JsonEncodedText.Encode("notification"); + private static readonly System.Text.Json.JsonEncodedText PropSecurity = System.Text.Json.JsonEncodedText.Encode("security"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpack Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLicense = default; + LocalJsonValue propMl = default; + LocalJsonValue?> propNotification = default; + LocalJsonValue propSecurity = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLicense.TryReadProperty(ref reader, options, PropLicense, null)) + { + continue; + } + + if (propMl.TryReadProperty(ref reader, options, PropMl, null)) + { + continue; + } + + if (propNotification.TryReadProperty(ref reader, options, PropNotification, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSecurity.TryReadProperty(ref reader, options, PropSecurity, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpack(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + License = propLicense.Value, + Ml = propMl.Value, + Notification = propNotification.Value, + Security = propSecurity.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpack value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLicense, value.License, null, null); + writer.WriteProperty(options, PropMl, value.Ml, null, null); + writer.WriteProperty(options, PropNotification, value.Notification, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSecurity, value.Security, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackConverter))] public sealed partial class NodeInfoXpack { - [JsonInclude, JsonPropertyName("license")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicense? License { get; init; } - [JsonInclude, JsonPropertyName("ml")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMl? Ml { get; init; } - [JsonInclude, JsonPropertyName("notification")] - public IReadOnlyDictionary? Notification { get; init; } - [JsonInclude, JsonPropertyName("security")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity Security { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpack(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity security) + { + Security = security; + } +#if NET7_0_OR_GREATER + public NodeInfoXpack() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpack() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpack(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicense? License { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMl? Ml { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Notification { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity Security { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicense.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicense.g.cs index 37dc8b495e5..c8e61f343b0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicense.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicense.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackLicenseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSelfGenerated = System.Text.Json.JsonEncodedText.Encode("self_generated"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicense Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSelfGenerated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSelfGenerated.TryReadProperty(ref reader, options, PropSelfGenerated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicense(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SelfGenerated = propSelfGenerated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicense value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSelfGenerated, value.SelfGenerated, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseConverter))] public sealed partial class NodeInfoXpackLicense { - [JsonInclude, JsonPropertyName("self_generated")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType SelfGenerated { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackLicense(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType selfGenerated) + { + SelfGenerated = selfGenerated; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackLicense() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackLicense() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackLicense(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType SelfGenerated { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicenseType.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicenseType.g.cs index 74f541ddb91..24ed5753f22 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicenseType.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackLicenseType.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackLicenseTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackLicenseTypeConverter))] public sealed partial class NodeInfoXpackLicenseType { - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackLicenseType(string type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackLicenseType() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackLicenseType() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackLicenseType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackMl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackMl.g.cs index e33170cb330..40a686df83d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackMl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackMl.g.cs @@ -17,18 +17,69 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackMlConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropUseAutoMachineMemoryPercent = System.Text.Json.JsonEncodedText.Encode("use_auto_machine_memory_percent"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMl Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propUseAutoMachineMemoryPercent = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propUseAutoMachineMemoryPercent.TryReadProperty(ref reader, options, PropUseAutoMachineMemoryPercent, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + UseAutoMachineMemoryPercent = propUseAutoMachineMemoryPercent.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMl value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropUseAutoMachineMemoryPercent, value.UseAutoMachineMemoryPercent, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackMlConverter))] public sealed partial class NodeInfoXpackMl { - [JsonInclude, JsonPropertyName("use_auto_machine_memory_percent")] - public bool? UseAutoMachineMemoryPercent { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoXpackMl() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoXpackMl() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackMl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public bool? UseAutoMachineMemoryPercent { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurity.g.cs index ca42856289e..e01f8bb74c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurity.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurity.g.cs @@ -17,24 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecurityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAuthc = System.Text.Json.JsonEncodedText.Encode("authc"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAuthc = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propHttp = default; + LocalJsonValue propTransport = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAuthc.TryReadProperty(ref reader, options, PropAuthc, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Authc = propAuthc.Value, + Enabled = propEnabled.Value, + Http = propHttp.Value, + Transport = propTransport.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurity value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAuthc, value.Authc, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityConverter))] public sealed partial class NodeInfoXpackSecurity { - [JsonInclude, JsonPropertyName("authc")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthc? Authc { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public string Enabled { get; init; } - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl? Http { get; init; } - [JsonInclude, JsonPropertyName("transport")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl? Transport { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackSecurity(string enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecurity() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackSecurity() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthc? Authc { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Enabled { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl? Http { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl? Transport { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthc.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthc.g.cs index 1d408079467..0a97cdeee5b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthc.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthc.g.cs @@ -17,20 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecurityAuthcConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRealms = System.Text.Json.JsonEncodedText.Encode("realms"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthc Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRealms = default; + LocalJsonValue propToken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRealms.TryReadProperty(ref reader, options, PropRealms, null)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Realms = propRealms.Value, + Token = propToken.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthc value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRealms, value.Realms, null, null); + writer.WriteProperty(options, PropToken, value.Token, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcConverter))] public sealed partial class NodeInfoXpackSecurityAuthc { - [JsonInclude, JsonPropertyName("realms")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealms? Realms { get; init; } - [JsonInclude, JsonPropertyName("token")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcToken? Token { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthc() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthc() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecurityAuthc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealms? Realms { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcToken? Token { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealms.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealms.g.cs index bb9bf0fb1db..6a996f2b0f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealms.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealms.g.cs @@ -17,22 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecurityAuthcRealmsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFile = System.Text.Json.JsonEncodedText.Encode("file"); + private static readonly System.Text.Json.JsonEncodedText PropNative = System.Text.Json.JsonEncodedText.Encode("native"); + private static readonly System.Text.Json.JsonEncodedText PropPki = System.Text.Json.JsonEncodedText.Encode("pki"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealms Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFile = default; + LocalJsonValue?> propNative = default; + LocalJsonValue?> propPki = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFile.TryReadProperty(ref reader, options, PropFile, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propNative.TryReadProperty(ref reader, options, PropNative, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPki.TryReadProperty(ref reader, options, PropPki, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealms(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + File = propFile.Value, + Native = propNative.Value, + Pki = propPki.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealms value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFile, value.File, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNative, value.Native, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPki, value.Pki, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealmsConverter))] public sealed partial class NodeInfoXpackSecurityAuthcRealms { - [JsonInclude, JsonPropertyName("file")] - public IReadOnlyDictionary? File { get; init; } - [JsonInclude, JsonPropertyName("native")] - public IReadOnlyDictionary? Native { get; init; } - [JsonInclude, JsonPropertyName("pki")] - public IReadOnlyDictionary? Pki { get; init; } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthcRealms() + { + } +#endif +#if !NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthcRealms() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecurityAuthcRealms(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? File { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Native { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Pki { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealmsStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealmsStatus.g.cs index 75c1627b2b7..f00739c3567 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealmsStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcRealmsStatus.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecurityAuthcRealmsStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealmsStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propOrder = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealmsStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Order = propOrder.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealmsStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcRealmsStatusConverter))] public sealed partial class NodeInfoXpackSecurityAuthcRealmsStatus { - [JsonInclude, JsonPropertyName("enabled")] - public string? Enabled { get; init; } - [JsonInclude, JsonPropertyName("order")] - public string Order { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackSecurityAuthcRealmsStatus(string order) + { + Order = order; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthcRealmsStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackSecurityAuthcRealmsStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecurityAuthcRealmsStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Order { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcToken.g.cs index 676999f8e03..f0fc59b6f99 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecurityAuthcToken.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecurityAuthcTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecurityAuthcTokenConverter))] public sealed partial class NodeInfoXpackSecurityAuthcToken { - [JsonInclude, JsonPropertyName("enabled")] - public string Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackSecurityAuthcToken(string enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecurityAuthcToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackSecurityAuthcToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecurityAuthcToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecuritySsl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecuritySsl.g.cs index f7702777a51..8ccad76c892 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecuritySsl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeInfoXpackSecuritySsl.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeInfoXpackSecuritySslConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSsl = System.Text.Json.JsonEncodedText.Encode("ssl"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propSsl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSsl.TryReadProperty(ref reader, options, PropSsl, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Ssl = propSsl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySsl value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSsl, value.Ssl, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeInfoXpackSecuritySslConverter))] public sealed partial class NodeInfoXpackSecuritySsl { - [JsonInclude, JsonPropertyName("ssl")] - public IReadOnlyDictionary Ssl { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeInfoXpackSecuritySsl(System.Collections.Generic.IReadOnlyDictionary ssl) + { + Ssl = ssl; + } +#if NET7_0_OR_GREATER + public NodeInfoXpackSecuritySsl() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeInfoXpackSecuritySsl() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeInfoXpackSecuritySsl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Ssl { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeJvmInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeJvmInfo.g.cs index 47707519655..a37d973a767 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeJvmInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeJvmInfo.g.cs @@ -17,135 +17,240 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; -internal sealed partial class NodeJvmInfoConverter : JsonConverter +internal sealed partial class NodeJvmInfoConverter : System.Text.Json.Serialization.JsonConverter { - public override NodeJvmInfo Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropGcCollectors = System.Text.Json.JsonEncodedText.Encode("gc_collectors"); + private static readonly System.Text.Json.JsonEncodedText PropInputArguments = System.Text.Json.JsonEncodedText.Encode("input_arguments"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryPools = System.Text.Json.JsonEncodedText.Encode("memory_pools"); + private static readonly System.Text.Json.JsonEncodedText PropPid = System.Text.Json.JsonEncodedText.Encode("pid"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropUsingBundledJdk = System.Text.Json.JsonEncodedText.Encode("using_bundled_jdk"); + private static readonly System.Text.Json.JsonEncodedText PropUsingBundledJdk1 = System.Text.Json.JsonEncodedText.Encode("bundled_jdk"); + private static readonly System.Text.Json.JsonEncodedText PropUsingCompressedOrdinaryObjectPointers = System.Text.Json.JsonEncodedText.Encode("using_compressed_ordinary_object_pointers"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVmName = System.Text.Json.JsonEncodedText.Encode("vm_name"); + private static readonly System.Text.Json.JsonEncodedText PropVmVendor = System.Text.Json.JsonEncodedText.Encode("vm_vendor"); + private static readonly System.Text.Json.JsonEncodedText PropVmVersion = System.Text.Json.JsonEncodedText.Encode("vm_version"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyCollection gcCollectors = default; - IReadOnlyCollection inputArguments = default; - Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory mem = default; - IReadOnlyCollection memoryPools = default; - int pid = default; - long startTimeInMillis = default; - bool usingBundledJdk = default; - object? usingCompressedOrdinaryObjectPointers = default; - string version = default; - string vmName = default; - string vmVendor = default; - string vmVersion = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propGcCollectors = default; + LocalJsonValue> propInputArguments = default; + LocalJsonValue propMem = default; + LocalJsonValue> propMemoryPools = default; + LocalJsonValue propPid = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propUsingBundledJdk = default; + LocalJsonValue?> propUsingCompressedOrdinaryObjectPointers = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVmName = default; + LocalJsonValue propVmVendor = default; + LocalJsonValue propVmVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propGcCollectors.TryReadProperty(ref reader, options, PropGcCollectors, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propInputArguments.TryReadProperty(ref reader, options, PropInputArguments, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propMemoryPools.TryReadProperty(ref reader, options, PropMemoryPools, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPid.TryReadProperty(ref reader, options, PropPid, null)) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propUsingBundledJdk.TryReadProperty(ref reader, options, PropUsingBundledJdk, null) || propUsingBundledJdk.TryReadProperty(ref reader, options, PropUsingBundledJdk1, null)) + { + continue; + } + + if (propUsingCompressedOrdinaryObjectPointers.TryReadProperty(ref reader, options, PropUsingCompressedOrdinaryObjectPointers, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.True | Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.False, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) { - var property = reader.GetString(); - if (property == "gc_collectors") - { - gcCollectors = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "input_arguments") - { - inputArguments = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "mem") - { - mem = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "memory_pools") - { - memoryPools = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "pid") - { - pid = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "start_time_in_millis") - { - startTimeInMillis = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "using_bundled_jdk" || property == "bundled_jdk") - { - usingBundledJdk = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "using_compressed_ordinary_object_pointers") - { - usingCompressedOrdinaryObjectPointers = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "version") - { - version = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "vm_name") - { - vmName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "vm_vendor") - { - vmVendor = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "vm_version") - { - vmVersion = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } + + if (propVmName.TryReadProperty(ref reader, options, PropVmName, null)) + { + continue; + } + + if (propVmVendor.TryReadProperty(ref reader, options, PropVmVendor, null)) + { + continue; + } + + if (propVmVersion.TryReadProperty(ref reader, options, PropVmVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return new NodeJvmInfo { GcCollectors = gcCollectors, InputArguments = inputArguments, Mem = mem, MemoryPools = memoryPools, Pid = pid, StartTimeInMillis = startTimeInMillis, UsingBundledJdk = usingBundledJdk, UsingCompressedOrdinaryObjectPointers = usingCompressedOrdinaryObjectPointers, Version = version, VmName = vmName, VmVendor = vmVendor, VmVersion = vmVersion }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GcCollectors = propGcCollectors.Value, + InputArguments = propInputArguments.Value, + Mem = propMem.Value, + MemoryPools = propMemoryPools.Value, + Pid = propPid.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + UsingBundledJdk = propUsingBundledJdk.Value, + UsingCompressedOrdinaryObjectPointers = propUsingCompressedOrdinaryObjectPointers.Value, + Version = propVersion.Value, + VmName = propVmName.Value, + VmVendor = propVmVendor.Value, + VmVersion = propVmVersion.Value + }; } - public override void Write(Utf8JsonWriter writer, NodeJvmInfo value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfo value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'NodeJvmInfo' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropGcCollectors, value.GcCollectors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInputArguments, value.InputArguments, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropMemoryPools, value.MemoryPools, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPid, value.Pid, null, null); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropUsingBundledJdk, value.UsingBundledJdk, null, null); + writer.WriteProperty(options, PropUsingCompressedOrdinaryObjectPointers, value.UsingCompressedOrdinaryObjectPointers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVmName, value.VmName, null, null); + writer.WriteProperty(options, PropVmVendor, value.VmVendor, null, null); + writer.WriteProperty(options, PropVmVersion, value.VmVersion, null, null); + writer.WriteEndObject(); } } -[JsonConverter(typeof(NodeJvmInfoConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeJvmInfoConverter))] public sealed partial class NodeJvmInfo { - public IReadOnlyCollection GcCollectors { get; init; } - public IReadOnlyCollection InputArguments { get; init; } - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory Mem { get; init; } - public IReadOnlyCollection MemoryPools { get; init; } - public int Pid { get; init; } - public long StartTimeInMillis { get; init; } - public bool UsingBundledJdk { get; init; } - public object? UsingCompressedOrdinaryObjectPointers { get; init; } - public string Version { get; init; } - public string VmName { get; init; } - public string VmVendor { get; init; } - public string VmVersion { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeJvmInfo(System.Collections.Generic.IReadOnlyCollection gcCollectors, System.Collections.Generic.IReadOnlyCollection inputArguments, Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory mem, System.Collections.Generic.IReadOnlyCollection memoryPools, int pid, System.DateTimeOffset startTimeInMillis, bool usingBundledJdk, string version, string vmName, string vmVendor, string vmVersion) + { + GcCollectors = gcCollectors; + InputArguments = inputArguments; + Mem = mem; + MemoryPools = memoryPools; + Pid = pid; + StartTimeInMillis = startTimeInMillis; + UsingBundledJdk = usingBundledJdk; + Version = version; + VmName = vmName; + VmVendor = vmVendor; + VmVersion = vmVersion; + } +#if NET7_0_OR_GREATER + public NodeJvmInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeJvmInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeJvmInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection GcCollectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection InputArguments { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.NodeInfoJvmMemory Mem { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection MemoryPools { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Pid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool UsingBundledJdk { get; set; } + public Elastic.Clients.Elasticsearch.Union? UsingCompressedOrdinaryObjectPointers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmVendor { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string VmVersion { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeOperatingSystemInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeOperatingSystemInfo.g.cs index c620a9ad5c5..01eb879235c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeOperatingSystemInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeOperatingSystemInfo.g.cs @@ -17,71 +17,229 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeOperatingSystemInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllocatedProcessors = System.Text.Json.JsonEncodedText.Encode("allocated_processors"); + private static readonly System.Text.Json.JsonEncodedText PropArch = System.Text.Json.JsonEncodedText.Encode("arch"); + private static readonly System.Text.Json.JsonEncodedText PropAvailableProcessors = System.Text.Json.JsonEncodedText.Encode("available_processors"); + private static readonly System.Text.Json.JsonEncodedText PropCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropPrettyName = System.Text.Json.JsonEncodedText.Encode("pretty_name"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshIntervalInMillis = System.Text.Json.JsonEncodedText.Encode("refresh_interval_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropSwap = System.Text.Json.JsonEncodedText.Encode("swap"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllocatedProcessors = default; + LocalJsonValue propArch = default; + LocalJsonValue propAvailableProcessors = default; + LocalJsonValue propCpu = default; + LocalJsonValue propMem = default; + LocalJsonValue propName = default; + LocalJsonValue propPrettyName = default; + LocalJsonValue propRefreshIntervalInMillis = default; + LocalJsonValue propSwap = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllocatedProcessors.TryReadProperty(ref reader, options, PropAllocatedProcessors, null)) + { + continue; + } + + if (propArch.TryReadProperty(ref reader, options, PropArch, null)) + { + continue; + } + + if (propAvailableProcessors.TryReadProperty(ref reader, options, PropAvailableProcessors, null)) + { + continue; + } + + if (propCpu.TryReadProperty(ref reader, options, PropCpu, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propPrettyName.TryReadProperty(ref reader, options, PropPrettyName, null)) + { + continue; + } + + if (propRefreshIntervalInMillis.TryReadProperty(ref reader, options, PropRefreshIntervalInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propSwap.TryReadProperty(ref reader, options, PropSwap, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllocatedProcessors = propAllocatedProcessors.Value, + Arch = propArch.Value, + AvailableProcessors = propAvailableProcessors.Value, + Cpu = propCpu.Value, + Mem = propMem.Value, + Name = propName.Value, + PrettyName = propPrettyName.Value, + RefreshIntervalInMillis = propRefreshIntervalInMillis.Value, + Swap = propSwap.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllocatedProcessors, value.AllocatedProcessors, null, null); + writer.WriteProperty(options, PropArch, value.Arch, null, null); + writer.WriteProperty(options, PropAvailableProcessors, value.AvailableProcessors, null, null); + writer.WriteProperty(options, PropCpu, value.Cpu, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropPrettyName, value.PrettyName, null, null); + writer.WriteProperty(options, PropRefreshIntervalInMillis, value.RefreshIntervalInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropSwap, value.Swap, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeOperatingSystemInfoConverter))] public sealed partial class NodeOperatingSystemInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeOperatingSystemInfo(string arch, int availableProcessors, string name, string prettyName, System.TimeSpan refreshIntervalInMillis, string version) + { + Arch = arch; + AvailableProcessors = availableProcessors; + Name = name; + PrettyName = prettyName; + RefreshIntervalInMillis = refreshIntervalInMillis; + Version = version; + } +#if NET7_0_OR_GREATER + public NodeOperatingSystemInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeOperatingSystemInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeOperatingSystemInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of processors actually used to calculate thread pool size. This number can be set with the node.processors setting of a node and defaults to the number of processors reported by the OS. /// /// - [JsonInclude, JsonPropertyName("allocated_processors")] - public int? AllocatedProcessors { get; init; } + public int? AllocatedProcessors { get; set; } /// /// /// Name of the JVM architecture (ex: amd64, x86) /// /// - [JsonInclude, JsonPropertyName("arch")] - public string Arch { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Arch { get; set; } /// /// /// Number of processors available to the Java virtual machine /// /// - [JsonInclude, JsonPropertyName("available_processors")] - public int AvailableProcessors { get; init; } - [JsonInclude, JsonPropertyName("cpu")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPU? Cpu { get; init; } - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory? Mem { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int AvailableProcessors { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoOSCPU? Cpu { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory? Mem { get; set; } /// /// /// Name of the operating system (ex: Linux, Windows, Mac OS X) /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("pretty_name")] - public string PrettyName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string PrettyName { get; set; } /// /// /// Refresh interval for the OS statistics /// /// - [JsonInclude, JsonPropertyName("refresh_interval_in_millis")] - public long RefreshIntervalInMillis { get; init; } - [JsonInclude, JsonPropertyName("swap")] - public Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory? Swap { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RefreshIntervalInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.NodeInfoMemory? Swap { get; set; } /// /// /// Version of the operating system /// /// - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeProcessInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeProcessInfo.g.cs index 58ee8e44bed..02ee3d90233 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeProcessInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeProcessInfo.g.cs @@ -17,39 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeProcessInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMlockall = System.Text.Json.JsonEncodedText.Encode("mlockall"); + private static readonly System.Text.Json.JsonEncodedText PropRefreshIntervalInMillis = System.Text.Json.JsonEncodedText.Encode("refresh_interval_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propMlockall = default; + LocalJsonValue propRefreshIntervalInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMlockall.TryReadProperty(ref reader, options, PropMlockall, null)) + { + continue; + } + + if (propRefreshIntervalInMillis.TryReadProperty(ref reader, options, PropRefreshIntervalInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Mlockall = propMlockall.Value, + RefreshIntervalInMillis = propRefreshIntervalInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMlockall, value.Mlockall, null, null); + writer.WriteProperty(options, PropRefreshIntervalInMillis, value.RefreshIntervalInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeProcessInfoConverter))] public sealed partial class NodeProcessInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeProcessInfo(long id, bool mlockall, System.TimeSpan refreshIntervalInMillis) + { + Id = id; + Mlockall = mlockall; + RefreshIntervalInMillis = refreshIntervalInMillis; + } +#if NET7_0_OR_GREATER + public NodeProcessInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeProcessInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeProcessInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Process identifier (PID) /// /// - [JsonInclude, JsonPropertyName("id")] - public long Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Id { get; set; } /// /// /// Indicates if the process address space has been successfully locked in memory /// /// - [JsonInclude, JsonPropertyName("mlockall")] - public bool Mlockall { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Mlockall { get; set; } /// /// /// Refresh interval for the process statistics /// /// - [JsonInclude, JsonPropertyName("refresh_interval_in_millis")] - public long RefreshIntervalInMillis { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RefreshIntervalInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeReloadResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeReloadResult.g.cs index b55c403a77b..257c3323d3c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeReloadResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeReloadResult.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeReloadResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropReloadException = System.Text.Json.JsonEncodedText.Encode("reload_exception"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeReloadResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propReloadException = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propReloadException.TryReadProperty(ref reader, options, PropReloadException, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeReloadResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + ReloadException = propReloadException.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeReloadResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropReloadException, value.ReloadException, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeReloadResultConverter))] public sealed partial class NodeReloadResult { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("reload_exception")] - public Elastic.Clients.Elasticsearch.ErrorCause? ReloadException { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeReloadResult(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public NodeReloadResult() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeReloadResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeReloadResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public Elastic.Clients.Elasticsearch.ErrorCause? ReloadException { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeThreadPoolInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeThreadPoolInfo.g.cs index 82df7a018fc..4c7a7451161 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeThreadPoolInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeThreadPoolInfo.g.cs @@ -17,28 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeThreadPoolInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCore = System.Text.Json.JsonEncodedText.Encode("core"); + private static readonly System.Text.Json.JsonEncodedText PropKeepAlive = System.Text.Json.JsonEncodedText.Encode("keep_alive"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropQueueSize = System.Text.Json.JsonEncodedText.Encode("queue_size"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeThreadPoolInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCore = default; + LocalJsonValue propKeepAlive = default; + LocalJsonValue propMax = default; + LocalJsonValue propQueueSize = default; + LocalJsonValue propSize = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCore.TryReadProperty(ref reader, options, PropCore, null)) + { + continue; + } + + if (propKeepAlive.TryReadProperty(ref reader, options, PropKeepAlive, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propQueueSize.TryReadProperty(ref reader, options, PropQueueSize, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeThreadPoolInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Core = propCore.Value, + KeepAlive = propKeepAlive.Value, + Max = propMax.Value, + QueueSize = propQueueSize.Value, + Size = propSize.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeThreadPoolInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCore, value.Core, null, null); + writer.WriteProperty(options, PropKeepAlive, value.KeepAlive, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropQueueSize, value.QueueSize, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeThreadPoolInfoConverter))] public sealed partial class NodeThreadPoolInfo { - [JsonInclude, JsonPropertyName("core")] - public int? Core { get; init; } - [JsonInclude, JsonPropertyName("keep_alive")] - public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get; init; } - [JsonInclude, JsonPropertyName("max")] - public int? Max { get; init; } - [JsonInclude, JsonPropertyName("queue_size")] - public int QueueSize { get; init; } - [JsonInclude, JsonPropertyName("size")] - public int? Size { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeThreadPoolInfo(int queueSize, string type) + { + QueueSize = queueSize; + Type = type; + } +#if NET7_0_OR_GREATER + public NodeThreadPoolInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeThreadPoolInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeThreadPoolInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? Core { get; set; } + public Elastic.Clients.Elasticsearch.Duration? KeepAlive { get; set; } + public int? Max { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int QueueSize { get; set; } + public int? Size { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeUsage.g.cs index a941b0e91db..87634cc3b71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/NodeUsage.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class NodeUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropRestActions = System.Text.Json.JsonEncodedText.Encode("rest_actions"); + private static readonly System.Text.Json.JsonEncodedText PropSince = System.Text.Json.JsonEncodedText.Encode("since"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.Nodes.NodeUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propAggregations = default; + LocalJsonValue> propRestActions = default; + LocalJsonValue propSince = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRestActions.TryReadProperty(ref reader, options, PropRestActions, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propSince.TryReadProperty(ref reader, options, PropSince, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.NodeUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Aggregations = propAggregations.Value, + RestActions = propRestActions.Value, + Since = propSince.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.NodeUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRestActions, value.RestActions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSince, value.Since, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.NodeUsageConverter))] public sealed partial class NodeUsage { - [JsonInclude, JsonPropertyName("aggregations")] - public IReadOnlyDictionary Aggregations { get; init; } - [JsonInclude, JsonPropertyName("rest_actions")] - public IReadOnlyDictionary RestActions { get; init; } - [JsonInclude, JsonPropertyName("since")] - public long Since { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public long Timestamp { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeUsage(System.Collections.Generic.IReadOnlyDictionary aggregations, System.Collections.Generic.IReadOnlyDictionary restActions, System.DateTimeOffset since, System.DateTimeOffset timestamp) + { + Aggregations = aggregations; + RestActions = restActions; + Since = since; + Timestamp = timestamp; + } +#if NET7_0_OR_GREATER + public NodeUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Aggregations { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary RestActions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Since { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/OperatingSystem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/OperatingSystem.g.cs index 94a8abd1f8e..295b3dac164 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/OperatingSystem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/OperatingSystem.g.cs @@ -17,26 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class OperatingSystemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCgroup = System.Text.Json.JsonEncodedText.Encode("cgroup"); + private static readonly System.Text.Json.JsonEncodedText PropCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropSwap = System.Text.Json.JsonEncodedText.Encode("swap"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.Nodes.OperatingSystem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCgroup = default; + LocalJsonValue propCpu = default; + LocalJsonValue propMem = default; + LocalJsonValue propSwap = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCgroup.TryReadProperty(ref reader, options, PropCgroup, null)) + { + continue; + } + + if (propCpu.TryReadProperty(ref reader, options, PropCpu, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propSwap.TryReadProperty(ref reader, options, PropSwap, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.OperatingSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cgroup = propCgroup.Value, + Cpu = propCpu.Value, + Mem = propMem.Value, + Swap = propSwap.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.OperatingSystem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCgroup, value.Cgroup, null, null); + writer.WriteProperty(options, PropCpu, value.Cpu, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropSwap, value.Swap, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.OperatingSystemConverter))] public sealed partial class OperatingSystem { - [JsonInclude, JsonPropertyName("cgroup")] - public Elastic.Clients.Elasticsearch.Nodes.Cgroup? Cgroup { get; init; } - [JsonInclude, JsonPropertyName("cpu")] - public Elastic.Clients.Elasticsearch.Nodes.Cpu? Cpu { get; init; } - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStats? Mem { get; init; } - [JsonInclude, JsonPropertyName("swap")] - public Elastic.Clients.Elasticsearch.Nodes.MemoryStats? Swap { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } +#if NET7_0_OR_GREATER + public OperatingSystem() + { + } +#endif +#if !NET7_0_OR_GREATER + public OperatingSystem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal OperatingSystem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.Cgroup? Cgroup { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.Cpu? Cpu { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.ExtendedMemoryStats? Mem { get; set; } + public Elastic.Clients.Elasticsearch.Nodes.MemoryStats? Swap { get; set; } + public long? Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Pool.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Pool.g.cs index 44a46846cdf..1a600eb9812 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Pool.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Pool.g.cs @@ -17,47 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class PoolConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxInBytes = System.Text.Json.JsonEncodedText.Encode("max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPeakMaxInBytes = System.Text.Json.JsonEncodedText.Encode("peak_max_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPeakUsedInBytes = System.Text.Json.JsonEncodedText.Encode("peak_used_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUsedInBytes = System.Text.Json.JsonEncodedText.Encode("used_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.Pool Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxInBytes = default; + LocalJsonValue propPeakMaxInBytes = default; + LocalJsonValue propPeakUsedInBytes = default; + LocalJsonValue propUsedInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxInBytes.TryReadProperty(ref reader, options, PropMaxInBytes, null)) + { + continue; + } + + if (propPeakMaxInBytes.TryReadProperty(ref reader, options, PropPeakMaxInBytes, null)) + { + continue; + } + + if (propPeakUsedInBytes.TryReadProperty(ref reader, options, PropPeakUsedInBytes, null)) + { + continue; + } + + if (propUsedInBytes.TryReadProperty(ref reader, options, PropUsedInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Pool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxInBytes = propMaxInBytes.Value, + PeakMaxInBytes = propPeakMaxInBytes.Value, + PeakUsedInBytes = propPeakUsedInBytes.Value, + UsedInBytes = propUsedInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Pool value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxInBytes, value.MaxInBytes, null, null); + writer.WriteProperty(options, PropPeakMaxInBytes, value.PeakMaxInBytes, null, null); + writer.WriteProperty(options, PropPeakUsedInBytes, value.PeakUsedInBytes, null, null); + writer.WriteProperty(options, PropUsedInBytes, value.UsedInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.PoolConverter))] public sealed partial class Pool { +#if NET7_0_OR_GREATER + public Pool() + { + } +#endif +#if !NET7_0_OR_GREATER + public Pool() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Pool(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Maximum amount of memory, in bytes, available for use by the heap. /// /// - [JsonInclude, JsonPropertyName("max_in_bytes")] - public long? MaxInBytes { get; init; } + public long? MaxInBytes { get; set; } /// /// /// Largest amount of memory, in bytes, historically used by the heap. /// /// - [JsonInclude, JsonPropertyName("peak_max_in_bytes")] - public long? PeakMaxInBytes { get; init; } + public long? PeakMaxInBytes { get; set; } /// /// /// Largest amount of memory, in bytes, historically used by the heap. /// /// - [JsonInclude, JsonPropertyName("peak_used_in_bytes")] - public long? PeakUsedInBytes { get; init; } + public long? PeakUsedInBytes { get; set; } /// /// /// Memory, in bytes, used by the heap. /// /// - [JsonInclude, JsonPropertyName("used_in_bytes")] - public long? UsedInBytes { get; init; } + public long? UsedInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PressureMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PressureMemory.g.cs index fdc693758e6..92ef43b4c8e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PressureMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PressureMemory.g.cs @@ -17,33 +17,191 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class PressureMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText PropAllInBytes = System.Text.Json.JsonEncodedText.Encode("all_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCombinedCoordinatingAndPrimary = System.Text.Json.JsonEncodedText.Encode("combined_coordinating_and_primary"); + private static readonly System.Text.Json.JsonEncodedText PropCombinedCoordinatingAndPrimaryInBytes = System.Text.Json.JsonEncodedText.Encode("combined_coordinating_and_primary_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinating = System.Text.Json.JsonEncodedText.Encode("coordinating"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingInBytes = System.Text.Json.JsonEncodedText.Encode("coordinating_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCoordinatingRejections = System.Text.Json.JsonEncodedText.Encode("coordinating_rejections"); + private static readonly System.Text.Json.JsonEncodedText PropPrimary = System.Text.Json.JsonEncodedText.Encode("primary"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryInBytes = System.Text.Json.JsonEncodedText.Encode("primary_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryRejections = System.Text.Json.JsonEncodedText.Encode("primary_rejections"); + private static readonly System.Text.Json.JsonEncodedText PropReplica = System.Text.Json.JsonEncodedText.Encode("replica"); + private static readonly System.Text.Json.JsonEncodedText PropReplicaInBytes = System.Text.Json.JsonEncodedText.Encode("replica_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropReplicaRejections = System.Text.Json.JsonEncodedText.Encode("replica_rejections"); + + public override Elastic.Clients.Elasticsearch.Nodes.PressureMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue propAllInBytes = default; + LocalJsonValue propCombinedCoordinatingAndPrimary = default; + LocalJsonValue propCombinedCoordinatingAndPrimaryInBytes = default; + LocalJsonValue propCoordinating = default; + LocalJsonValue propCoordinatingInBytes = default; + LocalJsonValue propCoordinatingRejections = default; + LocalJsonValue propPrimary = default; + LocalJsonValue propPrimaryInBytes = default; + LocalJsonValue propPrimaryRejections = default; + LocalJsonValue propReplica = default; + LocalJsonValue propReplicaInBytes = default; + LocalJsonValue propReplicaRejections = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propAllInBytes.TryReadProperty(ref reader, options, PropAllInBytes, null)) + { + continue; + } + + if (propCombinedCoordinatingAndPrimary.TryReadProperty(ref reader, options, PropCombinedCoordinatingAndPrimary, null)) + { + continue; + } + + if (propCombinedCoordinatingAndPrimaryInBytes.TryReadProperty(ref reader, options, PropCombinedCoordinatingAndPrimaryInBytes, null)) + { + continue; + } + + if (propCoordinating.TryReadProperty(ref reader, options, PropCoordinating, null)) + { + continue; + } + + if (propCoordinatingInBytes.TryReadProperty(ref reader, options, PropCoordinatingInBytes, null)) + { + continue; + } + + if (propCoordinatingRejections.TryReadProperty(ref reader, options, PropCoordinatingRejections, null)) + { + continue; + } + + if (propPrimary.TryReadProperty(ref reader, options, PropPrimary, null)) + { + continue; + } + + if (propPrimaryInBytes.TryReadProperty(ref reader, options, PropPrimaryInBytes, null)) + { + continue; + } + + if (propPrimaryRejections.TryReadProperty(ref reader, options, PropPrimaryRejections, null)) + { + continue; + } + + if (propReplica.TryReadProperty(ref reader, options, PropReplica, null)) + { + continue; + } + + if (propReplicaInBytes.TryReadProperty(ref reader, options, PropReplicaInBytes, null)) + { + continue; + } + + if (propReplicaRejections.TryReadProperty(ref reader, options, PropReplicaRejections, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.PressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + AllInBytes = propAllInBytes.Value, + CombinedCoordinatingAndPrimary = propCombinedCoordinatingAndPrimary.Value, + CombinedCoordinatingAndPrimaryInBytes = propCombinedCoordinatingAndPrimaryInBytes.Value, + Coordinating = propCoordinating.Value, + CoordinatingInBytes = propCoordinatingInBytes.Value, + CoordinatingRejections = propCoordinatingRejections.Value, + Primary = propPrimary.Value, + PrimaryInBytes = propPrimaryInBytes.Value, + PrimaryRejections = propPrimaryRejections.Value, + Replica = propReplica.Value, + ReplicaInBytes = propReplicaInBytes.Value, + ReplicaRejections = propReplicaRejections.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.PressureMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropAllInBytes, value.AllInBytes, null, null); + writer.WriteProperty(options, PropCombinedCoordinatingAndPrimary, value.CombinedCoordinatingAndPrimary, null, null); + writer.WriteProperty(options, PropCombinedCoordinatingAndPrimaryInBytes, value.CombinedCoordinatingAndPrimaryInBytes, null, null); + writer.WriteProperty(options, PropCoordinating, value.Coordinating, null, null); + writer.WriteProperty(options, PropCoordinatingInBytes, value.CoordinatingInBytes, null, null); + writer.WriteProperty(options, PropCoordinatingRejections, value.CoordinatingRejections, null, null); + writer.WriteProperty(options, PropPrimary, value.Primary, null, null); + writer.WriteProperty(options, PropPrimaryInBytes, value.PrimaryInBytes, null, null); + writer.WriteProperty(options, PropPrimaryRejections, value.PrimaryRejections, null, null); + writer.WriteProperty(options, PropReplica, value.Replica, null, null); + writer.WriteProperty(options, PropReplicaInBytes, value.ReplicaInBytes, null, null); + writer.WriteProperty(options, PropReplicaRejections, value.ReplicaRejections, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.PressureMemoryConverter))] public sealed partial class PressureMemory { +#if NET7_0_OR_GREATER + public PressureMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + public PressureMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PressureMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Memory consumed by indexing requests in the coordinating, primary, or replica stage. /// /// - [JsonInclude, JsonPropertyName("all")] - public Elastic.Clients.Elasticsearch.ByteSize? All { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? All { get; set; } /// /// /// Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage. /// /// - [JsonInclude, JsonPropertyName("all_in_bytes")] - public long? AllInBytes { get; init; } + public long? AllInBytes { get; set; } /// /// @@ -51,8 +209,7 @@ public sealed partial class PressureMemory /// This value is not the sum of coordinating and primary as a node can reuse the coordinating memory if the primary stage is executed locally. /// /// - [JsonInclude, JsonPropertyName("combined_coordinating_and_primary")] - public Elastic.Clients.Elasticsearch.ByteSize? CombinedCoordinatingAndPrimary { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? CombinedCoordinatingAndPrimary { get; set; } /// /// @@ -60,78 +217,68 @@ public sealed partial class PressureMemory /// This value is not the sum of coordinating and primary as a node can reuse the coordinating memory if the primary stage is executed locally. /// /// - [JsonInclude, JsonPropertyName("combined_coordinating_and_primary_in_bytes")] - public long? CombinedCoordinatingAndPrimaryInBytes { get; init; } + public long? CombinedCoordinatingAndPrimaryInBytes { get; set; } /// /// /// Memory consumed by indexing requests in the coordinating stage. /// /// - [JsonInclude, JsonPropertyName("coordinating")] - public Elastic.Clients.Elasticsearch.ByteSize? Coordinating { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Coordinating { get; set; } /// /// /// Memory consumed, in bytes, by indexing requests in the coordinating stage. /// /// - [JsonInclude, JsonPropertyName("coordinating_in_bytes")] - public long? CoordinatingInBytes { get; init; } + public long? CoordinatingInBytes { get; set; } /// /// /// Number of indexing requests rejected in the coordinating stage. /// /// - [JsonInclude, JsonPropertyName("coordinating_rejections")] - public long? CoordinatingRejections { get; init; } + public long? CoordinatingRejections { get; set; } /// /// /// Memory consumed by indexing requests in the primary stage. /// /// - [JsonInclude, JsonPropertyName("primary")] - public Elastic.Clients.Elasticsearch.ByteSize? Primary { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Primary { get; set; } /// /// /// Memory consumed, in bytes, by indexing requests in the primary stage. /// /// - [JsonInclude, JsonPropertyName("primary_in_bytes")] - public long? PrimaryInBytes { get; init; } + public long? PrimaryInBytes { get; set; } /// /// /// Number of indexing requests rejected in the primary stage. /// /// - [JsonInclude, JsonPropertyName("primary_rejections")] - public long? PrimaryRejections { get; init; } + public long? PrimaryRejections { get; set; } /// /// /// Memory consumed by indexing requests in the replica stage. /// /// - [JsonInclude, JsonPropertyName("replica")] - public Elastic.Clients.Elasticsearch.ByteSize? Replica { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Replica { get; set; } /// /// /// Memory consumed, in bytes, by indexing requests in the replica stage. /// /// - [JsonInclude, JsonPropertyName("replica_in_bytes")] - public long? ReplicaInBytes { get; init; } + public long? ReplicaInBytes { get; set; } /// /// /// Number of indexing requests rejected in the replica stage. /// /// - [JsonInclude, JsonPropertyName("replica_rejections")] - public long? ReplicaRejections { get; init; } + public long? ReplicaRejections { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Process.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Process.g.cs index b84d136121e..aedcb9977e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Process.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Process.g.cs @@ -17,49 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ProcessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCpu = System.Text.Json.JsonEncodedText.Encode("cpu"); + private static readonly System.Text.Json.JsonEncodedText PropMaxFileDescriptors = System.Text.Json.JsonEncodedText.Encode("max_file_descriptors"); + private static readonly System.Text.Json.JsonEncodedText PropMem = System.Text.Json.JsonEncodedText.Encode("mem"); + private static readonly System.Text.Json.JsonEncodedText PropOpenFileDescriptors = System.Text.Json.JsonEncodedText.Encode("open_file_descriptors"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + + public override Elastic.Clients.Elasticsearch.Nodes.Process Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCpu = default; + LocalJsonValue propMaxFileDescriptors = default; + LocalJsonValue propMem = default; + LocalJsonValue propOpenFileDescriptors = default; + LocalJsonValue propTimestamp = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCpu.TryReadProperty(ref reader, options, PropCpu, null)) + { + continue; + } + + if (propMaxFileDescriptors.TryReadProperty(ref reader, options, PropMaxFileDescriptors, null)) + { + continue; + } + + if (propMem.TryReadProperty(ref reader, options, PropMem, null)) + { + continue; + } + + if (propOpenFileDescriptors.TryReadProperty(ref reader, options, PropOpenFileDescriptors, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Process(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cpu = propCpu.Value, + MaxFileDescriptors = propMaxFileDescriptors.Value, + Mem = propMem.Value, + OpenFileDescriptors = propOpenFileDescriptors.Value, + Timestamp = propTimestamp.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Process value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCpu, value.Cpu, null, null); + writer.WriteProperty(options, PropMaxFileDescriptors, value.MaxFileDescriptors, null, null); + writer.WriteProperty(options, PropMem, value.Mem, null, null); + writer.WriteProperty(options, PropOpenFileDescriptors, value.OpenFileDescriptors, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ProcessConverter))] public sealed partial class Process { +#if NET7_0_OR_GREATER + public Process() + { + } +#endif +#if !NET7_0_OR_GREATER + public Process() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Process(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Contains CPU statistics for the node. /// /// - [JsonInclude, JsonPropertyName("cpu")] - public Elastic.Clients.Elasticsearch.Nodes.Cpu? Cpu { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Cpu? Cpu { get; set; } /// /// /// Maximum number of file descriptors allowed on the system, or -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("max_file_descriptors")] - public int? MaxFileDescriptors { get; init; } + public int? MaxFileDescriptors { get; set; } /// /// /// Contains virtual memory statistics for the node. /// /// - [JsonInclude, JsonPropertyName("mem")] - public Elastic.Clients.Elasticsearch.Nodes.MemoryStats? Mem { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.MemoryStats? Mem { get; set; } /// /// /// Number of opened file descriptors associated with the current or -1 if not supported. /// /// - [JsonInclude, JsonPropertyName("open_file_descriptors")] - public int? OpenFileDescriptors { get; init; } + public int? OpenFileDescriptors { get; set; } /// /// @@ -67,6 +151,5 @@ public sealed partial class Process /// Recorded in milliseconds since the Unix Epoch. /// /// - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } + public long? Timestamp { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Processor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Processor.g.cs index 04f8de05d1a..fbe829ac1d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Processor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Processor.g.cs @@ -17,47 +17,122 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.Processor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propCurrent = default; + LocalJsonValue propFailed = default; + LocalJsonValue propTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Current = propCurrent.Value, + Failed = propFailed.Value, + TimeInMillis = propTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Processor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ProcessorConverter))] public sealed partial class Processor { +#if NET7_0_OR_GREATER + public Processor() + { + } +#endif +#if !NET7_0_OR_GREATER + public Processor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Processor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of documents transformed by the processor. /// /// - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } + public long? Count { get; set; } /// /// /// Number of documents currently being transformed by the processor. /// /// - [JsonInclude, JsonPropertyName("current")] - public long? Current { get; init; } + public long? Current { get; set; } /// /// /// Number of failed operations for the processor. /// /// - [JsonInclude, JsonPropertyName("failed")] - public long? Failed { get; init; } + public long? Failed { get; set; } /// /// /// Time, in milliseconds, spent by the processor transforming documents. /// /// - [JsonInclude, JsonPropertyName("time_in_millis")] - public long? TimeInMillis { get; init; } + public System.TimeSpan? TimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PublishedClusterStates.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PublishedClusterStates.g.cs index dfa95da252d..df25ae134bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PublishedClusterStates.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/PublishedClusterStates.g.cs @@ -17,39 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class PublishedClusterStatesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompatibleDiffs = System.Text.Json.JsonEncodedText.Encode("compatible_diffs"); + private static readonly System.Text.Json.JsonEncodedText PropFullStates = System.Text.Json.JsonEncodedText.Encode("full_states"); + private static readonly System.Text.Json.JsonEncodedText PropIncompatibleDiffs = System.Text.Json.JsonEncodedText.Encode("incompatible_diffs"); + + public override Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStates Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompatibleDiffs = default; + LocalJsonValue propFullStates = default; + LocalJsonValue propIncompatibleDiffs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompatibleDiffs.TryReadProperty(ref reader, options, PropCompatibleDiffs, null)) + { + continue; + } + + if (propFullStates.TryReadProperty(ref reader, options, PropFullStates, null)) + { + continue; + } + + if (propIncompatibleDiffs.TryReadProperty(ref reader, options, PropIncompatibleDiffs, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStates(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompatibleDiffs = propCompatibleDiffs.Value, + FullStates = propFullStates.Value, + IncompatibleDiffs = propIncompatibleDiffs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStates value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompatibleDiffs, value.CompatibleDiffs, null, null); + writer.WriteProperty(options, PropFullStates, value.FullStates, null, null); + writer.WriteProperty(options, PropIncompatibleDiffs, value.IncompatibleDiffs, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.PublishedClusterStatesConverter))] public sealed partial class PublishedClusterStates { +#if NET7_0_OR_GREATER + public PublishedClusterStates() + { + } +#endif +#if !NET7_0_OR_GREATER + public PublishedClusterStates() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PublishedClusterStates(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of compatible differences between published cluster states. /// /// - [JsonInclude, JsonPropertyName("compatible_diffs")] - public long? CompatibleDiffs { get; init; } + public long? CompatibleDiffs { get; set; } /// /// /// Number of published cluster states. /// /// - [JsonInclude, JsonPropertyName("full_states")] - public long? FullStates { get; init; } + public long? FullStates { get; set; } /// /// /// Number of incompatible differences between published cluster states. /// /// - [JsonInclude, JsonPropertyName("incompatible_diffs")] - public long? IncompatibleDiffs { get; init; } + public long? IncompatibleDiffs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Recording.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Recording.g.cs index fce3921ac60..7a891bf7acd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Recording.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Recording.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class RecordingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCumulativeExecutionCount = System.Text.Json.JsonEncodedText.Encode("cumulative_execution_count"); + private static readonly System.Text.Json.JsonEncodedText PropCumulativeExecutionTime = System.Text.Json.JsonEncodedText.Encode("cumulative_execution_time"); + private static readonly System.Text.Json.JsonEncodedText PropCumulativeExecutionTimeMillis = System.Text.Json.JsonEncodedText.Encode("cumulative_execution_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Nodes.Recording Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCumulativeExecutionCount = default; + LocalJsonValue propCumulativeExecutionTime = default; + LocalJsonValue propCumulativeExecutionTimeMillis = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCumulativeExecutionCount.TryReadProperty(ref reader, options, PropCumulativeExecutionCount, null)) + { + continue; + } + + if (propCumulativeExecutionTime.TryReadProperty(ref reader, options, PropCumulativeExecutionTime, null)) + { + continue; + } + + if (propCumulativeExecutionTimeMillis.TryReadProperty(ref reader, options, PropCumulativeExecutionTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Recording(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CumulativeExecutionCount = propCumulativeExecutionCount.Value, + CumulativeExecutionTime = propCumulativeExecutionTime.Value, + CumulativeExecutionTimeMillis = propCumulativeExecutionTimeMillis.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Recording value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCumulativeExecutionCount, value.CumulativeExecutionCount, null, null); + writer.WriteProperty(options, PropCumulativeExecutionTime, value.CumulativeExecutionTime, null, null); + writer.WriteProperty(options, PropCumulativeExecutionTimeMillis, value.CumulativeExecutionTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.RecordingConverter))] public sealed partial class Recording { - [JsonInclude, JsonPropertyName("cumulative_execution_count")] - public long? CumulativeExecutionCount { get; init; } - [JsonInclude, JsonPropertyName("cumulative_execution_time")] - public Elastic.Clients.Elasticsearch.Duration? CumulativeExecutionTime { get; init; } - [JsonInclude, JsonPropertyName("cumulative_execution_time_millis")] - public long? CumulativeExecutionTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } +#if NET7_0_OR_GREATER + public Recording() + { + } +#endif +#if !NET7_0_OR_GREATER + public Recording() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Recording(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? CumulativeExecutionCount { get; set; } + public Elastic.Clients.Elasticsearch.Duration? CumulativeExecutionTime { get; set; } + public System.TimeSpan? CumulativeExecutionTimeMillis { get; set; } + public string? Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryLocation.g.cs index 7869dcef892..db3aea96be2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryLocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryLocation.g.cs @@ -17,34 +17,111 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class RepositoryLocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBasePath = System.Text.Json.JsonEncodedText.Encode("base_path"); + private static readonly System.Text.Json.JsonEncodedText PropBucket = System.Text.Json.JsonEncodedText.Encode("bucket"); + private static readonly System.Text.Json.JsonEncodedText PropContainer = System.Text.Json.JsonEncodedText.Encode("container"); + + public override Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBasePath = default; + LocalJsonValue propBucket = default; + LocalJsonValue propContainer = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBasePath.TryReadProperty(ref reader, options, PropBasePath, null)) + { + continue; + } + + if (propBucket.TryReadProperty(ref reader, options, PropBucket, null)) + { + continue; + } + + if (propContainer.TryReadProperty(ref reader, options, PropContainer, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BasePath = propBasePath.Value, + Bucket = propBucket.Value, + Container = propContainer.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBasePath, value.BasePath, null, null); + writer.WriteProperty(options, PropBucket, value.Bucket, null, null); + writer.WriteProperty(options, PropContainer, value.Container, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.RepositoryLocationConverter))] public sealed partial class RepositoryLocation { - [JsonInclude, JsonPropertyName("base_path")] - public string BasePath { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryLocation(string basePath) + { + BasePath = basePath; + } +#if NET7_0_OR_GREATER + public RepositoryLocation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RepositoryLocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryLocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string BasePath { get; set; } /// /// /// Bucket name (GCP, S3) /// /// - [JsonInclude, JsonPropertyName("bucket")] - public string? Bucket { get; init; } + public string? Bucket { get; set; } /// /// /// Container name (Azure) /// /// - [JsonInclude, JsonPropertyName("container")] - public string? Container { get; init; } + public string? Container { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryMeteringInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryMeteringInformation.g.cs index 2d07c149965..90fa8ad9893 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryMeteringInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RepositoryMeteringInformation.g.cs @@ -17,18 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class RepositoryMeteringInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropArchived = System.Text.Json.JsonEncodedText.Encode("archived"); + private static readonly System.Text.Json.JsonEncodedText PropClusterVersion = System.Text.Json.JsonEncodedText.Encode("cluster_version"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryEphemeralId = System.Text.Json.JsonEncodedText.Encode("repository_ephemeral_id"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryLocation = System.Text.Json.JsonEncodedText.Encode("repository_location"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryName = System.Text.Json.JsonEncodedText.Encode("repository_name"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryStartedAt = System.Text.Json.JsonEncodedText.Encode("repository_started_at"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryStoppedAt = System.Text.Json.JsonEncodedText.Encode("repository_stopped_at"); + private static readonly System.Text.Json.JsonEncodedText PropRepositoryType = System.Text.Json.JsonEncodedText.Encode("repository_type"); + private static readonly System.Text.Json.JsonEncodedText PropRequestCounts = System.Text.Json.JsonEncodedText.Encode("request_counts"); + + public override Elastic.Clients.Elasticsearch.Nodes.RepositoryMeteringInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propArchived = default; + LocalJsonValue propClusterVersion = default; + LocalJsonValue propRepositoryEphemeralId = default; + LocalJsonValue propRepositoryLocation = default; + LocalJsonValue propRepositoryName = default; + LocalJsonValue propRepositoryStartedAt = default; + LocalJsonValue propRepositoryStoppedAt = default; + LocalJsonValue propRepositoryType = default; + LocalJsonValue propRequestCounts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propArchived.TryReadProperty(ref reader, options, PropArchived, null)) + { + continue; + } + + if (propClusterVersion.TryReadProperty(ref reader, options, PropClusterVersion, null)) + { + continue; + } + + if (propRepositoryEphemeralId.TryReadProperty(ref reader, options, PropRepositoryEphemeralId, null)) + { + continue; + } + + if (propRepositoryLocation.TryReadProperty(ref reader, options, PropRepositoryLocation, null)) + { + continue; + } + + if (propRepositoryName.TryReadProperty(ref reader, options, PropRepositoryName, null)) + { + continue; + } + + if (propRepositoryStartedAt.TryReadProperty(ref reader, options, PropRepositoryStartedAt, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propRepositoryStoppedAt.TryReadProperty(ref reader, options, PropRepositoryStoppedAt, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propRepositoryType.TryReadProperty(ref reader, options, PropRepositoryType, null)) + { + continue; + } + + if (propRequestCounts.TryReadProperty(ref reader, options, PropRequestCounts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.RepositoryMeteringInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Archived = propArchived.Value, + ClusterVersion = propClusterVersion.Value, + RepositoryEphemeralId = propRepositoryEphemeralId.Value, + RepositoryLocation = propRepositoryLocation.Value, + RepositoryName = propRepositoryName.Value, + RepositoryStartedAt = propRepositoryStartedAt.Value, + RepositoryStoppedAt = propRepositoryStoppedAt.Value, + RepositoryType = propRepositoryType.Value, + RequestCounts = propRequestCounts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.RepositoryMeteringInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropArchived, value.Archived, null, null); + writer.WriteProperty(options, PropClusterVersion, value.ClusterVersion, null, null); + writer.WriteProperty(options, PropRepositoryEphemeralId, value.RepositoryEphemeralId, null, null); + writer.WriteProperty(options, PropRepositoryLocation, value.RepositoryLocation, null, null); + writer.WriteProperty(options, PropRepositoryName, value.RepositoryName, null, null); + writer.WriteProperty(options, PropRepositoryStartedAt, value.RepositoryStartedAt, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropRepositoryStoppedAt, value.RepositoryStoppedAt, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropRepositoryType, value.RepositoryType, null, null); + writer.WriteProperty(options, PropRequestCounts, value.RequestCounts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.RepositoryMeteringInformationConverter))] public sealed partial class RepositoryMeteringInformation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RepositoryMeteringInformation(bool archived, string repositoryEphemeralId, Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation repositoryLocation, string repositoryName, System.DateTimeOffset repositoryStartedAt, string repositoryType, Elastic.Clients.Elasticsearch.Nodes.RequestCounts requestCounts) + { + Archived = archived; + RepositoryEphemeralId = repositoryEphemeralId; + RepositoryLocation = repositoryLocation; + RepositoryName = repositoryName; + RepositoryStartedAt = repositoryStartedAt; + RepositoryType = repositoryType; + RequestCounts = requestCounts; + } +#if NET7_0_OR_GREATER + public RepositoryMeteringInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RepositoryMeteringInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RepositoryMeteringInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A flag that tells whether or not this object has been archived. When a repository is closed or updated the @@ -36,8 +172,11 @@ public sealed partial class RepositoryMeteringInformation /// repository metering information of previous repository instantiations. /// /// - [JsonInclude, JsonPropertyName("archived")] - public bool Archived { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Archived { get; set; } /// /// @@ -47,62 +186,78 @@ public sealed partial class RepositoryMeteringInformation /// information deletions, i.e. deleting archived repositories metering information that we haven’t observed yet. /// /// - [JsonInclude, JsonPropertyName("cluster_version")] - public long? ClusterVersion { get; init; } + public long? ClusterVersion { get; set; } /// /// /// An identifier that changes every time the repository is updated. /// /// - [JsonInclude, JsonPropertyName("repository_ephemeral_id")] - public string RepositoryEphemeralId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RepositoryEphemeralId { get; set; } /// /// /// Represents an unique location within the repository. /// /// - [JsonInclude, JsonPropertyName("repository_location")] - public Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation RepositoryLocation { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.RepositoryLocation RepositoryLocation { get; set; } /// /// /// Repository name. /// /// - [JsonInclude, JsonPropertyName("repository_name")] - public string RepositoryName { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RepositoryName { get; set; } /// /// /// Time the repository was created or updated. Recorded in milliseconds since the Unix Epoch. /// /// - [JsonInclude, JsonPropertyName("repository_started_at")] - public long RepositoryStartedAt { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset RepositoryStartedAt { get; set; } /// /// /// Time the repository was deleted or updated. Recorded in milliseconds since the Unix Epoch. /// /// - [JsonInclude, JsonPropertyName("repository_stopped_at")] - public long? RepositoryStoppedAt { get; init; } + public System.DateTimeOffset? RepositoryStoppedAt { get; set; } /// /// /// Repository type. /// /// - [JsonInclude, JsonPropertyName("repository_type")] - public string RepositoryType { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RepositoryType { get; set; } /// /// /// An object with the number of request performed against the repository grouped by request type. /// /// - [JsonInclude, JsonPropertyName("request_counts")] - public Elastic.Clients.Elasticsearch.Nodes.RequestCounts RequestCounts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Nodes.RequestCounts RequestCounts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RequestCounts.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RequestCounts.g.cs index 0fde25b366b..d848d96f017 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RequestCounts.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/RequestCounts.g.cs @@ -17,41 +17,180 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class RequestCountsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropGetBlob = System.Text.Json.JsonEncodedText.Encode("GetBlob"); + private static readonly System.Text.Json.JsonEncodedText PropGetBlobProperties = System.Text.Json.JsonEncodedText.Encode("GetBlobProperties"); + private static readonly System.Text.Json.JsonEncodedText PropGetObject = System.Text.Json.JsonEncodedText.Encode("GetObject"); + private static readonly System.Text.Json.JsonEncodedText PropInsertObject = System.Text.Json.JsonEncodedText.Encode("InsertObject"); + private static readonly System.Text.Json.JsonEncodedText PropListBlobs = System.Text.Json.JsonEncodedText.Encode("ListBlobs"); + private static readonly System.Text.Json.JsonEncodedText PropListObjects = System.Text.Json.JsonEncodedText.Encode("ListObjects"); + private static readonly System.Text.Json.JsonEncodedText PropPutBlob = System.Text.Json.JsonEncodedText.Encode("PutBlob"); + private static readonly System.Text.Json.JsonEncodedText PropPutBlock = System.Text.Json.JsonEncodedText.Encode("PutBlock"); + private static readonly System.Text.Json.JsonEncodedText PropPutBlockList = System.Text.Json.JsonEncodedText.Encode("PutBlockList"); + private static readonly System.Text.Json.JsonEncodedText PropPutMultipartObject = System.Text.Json.JsonEncodedText.Encode("PutMultipartObject"); + private static readonly System.Text.Json.JsonEncodedText PropPutObject = System.Text.Json.JsonEncodedText.Encode("PutObject"); + + public override Elastic.Clients.Elasticsearch.Nodes.RequestCounts Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propGetBlob = default; + LocalJsonValue propGetBlobProperties = default; + LocalJsonValue propGetObject = default; + LocalJsonValue propInsertObject = default; + LocalJsonValue propListBlobs = default; + LocalJsonValue propListObjects = default; + LocalJsonValue propPutBlob = default; + LocalJsonValue propPutBlock = default; + LocalJsonValue propPutBlockList = default; + LocalJsonValue propPutMultipartObject = default; + LocalJsonValue propPutObject = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propGetBlob.TryReadProperty(ref reader, options, PropGetBlob, null)) + { + continue; + } + + if (propGetBlobProperties.TryReadProperty(ref reader, options, PropGetBlobProperties, null)) + { + continue; + } + + if (propGetObject.TryReadProperty(ref reader, options, PropGetObject, null)) + { + continue; + } + + if (propInsertObject.TryReadProperty(ref reader, options, PropInsertObject, null)) + { + continue; + } + + if (propListBlobs.TryReadProperty(ref reader, options, PropListBlobs, null)) + { + continue; + } + + if (propListObjects.TryReadProperty(ref reader, options, PropListObjects, null)) + { + continue; + } + + if (propPutBlob.TryReadProperty(ref reader, options, PropPutBlob, null)) + { + continue; + } + + if (propPutBlock.TryReadProperty(ref reader, options, PropPutBlock, null)) + { + continue; + } + + if (propPutBlockList.TryReadProperty(ref reader, options, PropPutBlockList, null)) + { + continue; + } + + if (propPutMultipartObject.TryReadProperty(ref reader, options, PropPutMultipartObject, null)) + { + continue; + } + + if (propPutObject.TryReadProperty(ref reader, options, PropPutObject, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.RequestCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + GetBlob = propGetBlob.Value, + GetBlobProperties = propGetBlobProperties.Value, + GetObject = propGetObject.Value, + InsertObject = propInsertObject.Value, + ListBlobs = propListBlobs.Value, + ListObjects = propListObjects.Value, + PutBlob = propPutBlob.Value, + PutBlock = propPutBlock.Value, + PutBlockList = propPutBlockList.Value, + PutMultipartObject = propPutMultipartObject.Value, + PutObject = propPutObject.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.RequestCounts value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropGetBlob, value.GetBlob, null, null); + writer.WriteProperty(options, PropGetBlobProperties, value.GetBlobProperties, null, null); + writer.WriteProperty(options, PropGetObject, value.GetObject, null, null); + writer.WriteProperty(options, PropInsertObject, value.InsertObject, null, null); + writer.WriteProperty(options, PropListBlobs, value.ListBlobs, null, null); + writer.WriteProperty(options, PropListObjects, value.ListObjects, null, null); + writer.WriteProperty(options, PropPutBlob, value.PutBlob, null, null); + writer.WriteProperty(options, PropPutBlock, value.PutBlock, null, null); + writer.WriteProperty(options, PropPutBlockList, value.PutBlockList, null, null); + writer.WriteProperty(options, PropPutMultipartObject, value.PutMultipartObject, null, null); + writer.WriteProperty(options, PropPutObject, value.PutObject, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.RequestCountsConverter))] public sealed partial class RequestCounts { +#if NET7_0_OR_GREATER + public RequestCounts() + { + } +#endif +#if !NET7_0_OR_GREATER + public RequestCounts() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RequestCounts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of Get Blob requests (Azure) /// /// - [JsonInclude, JsonPropertyName("GetBlob")] - public long? Getblob { get; init; } + public long? GetBlob { get; set; } /// /// /// Number of Get Blob Properties requests (Azure) /// /// - [JsonInclude, JsonPropertyName("GetBlobProperties")] - public long? Getblobproperties { get; init; } + public long? GetBlobProperties { get; set; } /// /// /// Number of get object requests (GCP, S3) /// /// - [JsonInclude, JsonPropertyName("GetObject")] - public long? Getobject { get; init; } + public long? GetObject { get; set; } /// /// @@ -60,62 +199,54 @@ public sealed partial class RequestCounts /// since they are billed as an individual operation. (GCP) /// /// - [JsonInclude, JsonPropertyName("InsertObject")] - public long? Insertobject { get; init; } + public long? InsertObject { get; set; } /// /// /// Number of List Blobs requests (Azure) /// /// - [JsonInclude, JsonPropertyName("ListBlobs")] - public long? Listblobs { get; init; } + public long? ListBlobs { get; set; } /// /// /// Number of list objects requests (GCP, S3) /// /// - [JsonInclude, JsonPropertyName("ListObjects")] - public long? Listobjects { get; init; } + public long? ListObjects { get; set; } /// /// /// Number of Put Blob requests (Azure) /// /// - [JsonInclude, JsonPropertyName("PutBlob")] - public long? Putblob { get; init; } + public long? PutBlob { get; set; } /// /// /// Number of Put Block (Azure) /// /// - [JsonInclude, JsonPropertyName("PutBlock")] - public long? Putblock { get; init; } + public long? PutBlock { get; set; } /// /// /// Number of Put Block List requests /// /// - [JsonInclude, JsonPropertyName("PutBlockList")] - public long? Putblocklist { get; init; } + public long? PutBlockList { get; set; } /// /// /// Number of Multipart requests, including CreateMultipartUpload, UploadPart and CompleteMultipartUpload requests (S3) /// /// - [JsonInclude, JsonPropertyName("PutMultipartObject")] - public long? Putmultipartobject { get; init; } + public long? PutMultipartObject { get; set; } /// /// /// Number of PutObject requests (S3) /// /// - [JsonInclude, JsonPropertyName("PutObject")] - public long? Putobject { get; init; } + public long? PutObject { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ScriptCache.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ScriptCache.g.cs index 7f5a4870972..28106c42c3b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ScriptCache.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ScriptCache.g.cs @@ -17,41 +17,116 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ScriptCacheConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheEvictions = System.Text.Json.JsonEncodedText.Encode("cache_evictions"); + private static readonly System.Text.Json.JsonEncodedText PropCompilationLimitTriggered = System.Text.Json.JsonEncodedText.Encode("compilation_limit_triggered"); + private static readonly System.Text.Json.JsonEncodedText PropCompilations = System.Text.Json.JsonEncodedText.Encode("compilations"); + private static readonly System.Text.Json.JsonEncodedText PropContext = System.Text.Json.JsonEncodedText.Encode("context"); + + public override Elastic.Clients.Elasticsearch.Nodes.ScriptCache Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheEvictions = default; + LocalJsonValue propCompilationLimitTriggered = default; + LocalJsonValue propCompilations = default; + LocalJsonValue propContext = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheEvictions.TryReadProperty(ref reader, options, PropCacheEvictions, null)) + { + continue; + } + + if (propCompilationLimitTriggered.TryReadProperty(ref reader, options, PropCompilationLimitTriggered, null)) + { + continue; + } + + if (propCompilations.TryReadProperty(ref reader, options, PropCompilations, null)) + { + continue; + } + + if (propContext.TryReadProperty(ref reader, options, PropContext, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ScriptCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheEvictions = propCacheEvictions.Value, + CompilationLimitTriggered = propCompilationLimitTriggered.Value, + Compilations = propCompilations.Value, + Context = propContext.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ScriptCache value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheEvictions, value.CacheEvictions, null, null); + writer.WriteProperty(options, PropCompilationLimitTriggered, value.CompilationLimitTriggered, null, null); + writer.WriteProperty(options, PropCompilations, value.Compilations, null, null); + writer.WriteProperty(options, PropContext, value.Context, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ScriptCacheConverter))] public sealed partial class ScriptCache { +#if NET7_0_OR_GREATER + public ScriptCache() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScriptCache() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of times the script cache has evicted old data. /// /// - [JsonInclude, JsonPropertyName("cache_evictions")] - public long? CacheEvictions { get; init; } + public long? CacheEvictions { get; set; } /// /// /// Total number of times the script compilation circuit breaker has limited inline script compilations. /// /// - [JsonInclude, JsonPropertyName("compilation_limit_triggered")] - public long? CompilationLimitTriggered { get; init; } + public long? CompilationLimitTriggered { get; set; } /// /// /// Total number of inline script compilations performed by the node. /// /// - [JsonInclude, JsonPropertyName("compilations")] - public long? Compilations { get; init; } - [JsonInclude, JsonPropertyName("context")] - public string? Context { get; init; } + public long? Compilations { get; set; } + public string? Context { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Scripting.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Scripting.g.cs index d1228beda2a..66b7e7620b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Scripting.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Scripting.g.cs @@ -17,49 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ScriptingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheEvictions = System.Text.Json.JsonEncodedText.Encode("cache_evictions"); + private static readonly System.Text.Json.JsonEncodedText PropCompilationLimitTriggered = System.Text.Json.JsonEncodedText.Encode("compilation_limit_triggered"); + private static readonly System.Text.Json.JsonEncodedText PropCompilations = System.Text.Json.JsonEncodedText.Encode("compilations"); + private static readonly System.Text.Json.JsonEncodedText PropCompilationsHistory = System.Text.Json.JsonEncodedText.Encode("compilations_history"); + private static readonly System.Text.Json.JsonEncodedText PropContexts = System.Text.Json.JsonEncodedText.Encode("contexts"); + + public override Elastic.Clients.Elasticsearch.Nodes.Scripting Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheEvictions = default; + LocalJsonValue propCompilationLimitTriggered = default; + LocalJsonValue propCompilations = default; + LocalJsonValue?> propCompilationsHistory = default; + LocalJsonValue?> propContexts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheEvictions.TryReadProperty(ref reader, options, PropCacheEvictions, null)) + { + continue; + } + + if (propCompilationLimitTriggered.TryReadProperty(ref reader, options, PropCompilationLimitTriggered, null)) + { + continue; + } + + if (propCompilations.TryReadProperty(ref reader, options, PropCompilations, null)) + { + continue; + } + + if (propCompilationsHistory.TryReadProperty(ref reader, options, PropCompilationsHistory, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propContexts.TryReadProperty(ref reader, options, PropContexts, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Scripting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheEvictions = propCacheEvictions.Value, + CompilationLimitTriggered = propCompilationLimitTriggered.Value, + Compilations = propCompilations.Value, + CompilationsHistory = propCompilationsHistory.Value, + Contexts = propContexts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Scripting value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheEvictions, value.CacheEvictions, null, null); + writer.WriteProperty(options, PropCompilationLimitTriggered, value.CompilationLimitTriggered, null, null); + writer.WriteProperty(options, PropCompilations, value.Compilations, null, null); + writer.WriteProperty(options, PropCompilationsHistory, value.CompilationsHistory, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropContexts, value.Contexts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ScriptingConverter))] public sealed partial class Scripting { +#if NET7_0_OR_GREATER + public Scripting() + { + } +#endif +#if !NET7_0_OR_GREATER + public Scripting() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Scripting(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of times the script cache has evicted old data. /// /// - [JsonInclude, JsonPropertyName("cache_evictions")] - public long? CacheEvictions { get; init; } + public long? CacheEvictions { get; set; } /// /// /// Total number of times the script compilation circuit breaker has limited inline script compilations. /// /// - [JsonInclude, JsonPropertyName("compilation_limit_triggered")] - public long? CompilationLimitTriggered { get; init; } + public long? CompilationLimitTriggered { get; set; } /// /// /// Total number of inline script compilations performed by the node. /// /// - [JsonInclude, JsonPropertyName("compilations")] - public long? Compilations { get; init; } + public long? Compilations { get; set; } /// /// /// Contains this recent history of script compilations. /// /// - [JsonInclude, JsonPropertyName("compilations_history")] - public IReadOnlyDictionary? CompilationsHistory { get; init; } - [JsonInclude, JsonPropertyName("contexts")] - public IReadOnlyCollection? Contexts { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? CompilationsHistory { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Contexts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterState.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterState.g.cs index b8f005db9e4..c2db84c06e1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterState.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterState.g.cs @@ -17,26 +17,85 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class SerializedClusterStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiffs = System.Text.Json.JsonEncodedText.Encode("diffs"); + private static readonly System.Text.Json.JsonEncodedText PropFullStates = System.Text.Json.JsonEncodedText.Encode("full_states"); + + public override Elastic.Clients.Elasticsearch.Nodes.SerializedClusterState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDiffs = default; + LocalJsonValue propFullStates = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDiffs.TryReadProperty(ref reader, options, PropDiffs, null)) + { + continue; + } + + if (propFullStates.TryReadProperty(ref reader, options, PropFullStates, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.SerializedClusterState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Diffs = propDiffs.Value, + FullStates = propFullStates.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.SerializedClusterState value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDiffs, value.Diffs, null, null); + writer.WriteProperty(options, PropFullStates, value.FullStates, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateConverter))] public sealed partial class SerializedClusterState { - [JsonInclude, JsonPropertyName("diffs")] - public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail? Diffs { get; init; } +#if NET7_0_OR_GREATER + public SerializedClusterState() + { + } +#endif +#if !NET7_0_OR_GREATER + public SerializedClusterState() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SerializedClusterState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail? Diffs { get; set; } /// /// /// Number of published cluster states. /// /// - [JsonInclude, JsonPropertyName("full_states")] - public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail? FullStates { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail? FullStates { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterStateDetail.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterStateDetail.g.cs index b57a19b0027..8ba51414af9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterStateDetail.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SerializedClusterStateDetail.g.cs @@ -17,26 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class SerializedClusterStateDetailConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCompressedSize = System.Text.Json.JsonEncodedText.Encode("compressed_size"); + private static readonly System.Text.Json.JsonEncodedText PropCompressedSizeInBytes = System.Text.Json.JsonEncodedText.Encode("compressed_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropUncompressedSize = System.Text.Json.JsonEncodedText.Encode("uncompressed_size"); + private static readonly System.Text.Json.JsonEncodedText PropUncompressedSizeInBytes = System.Text.Json.JsonEncodedText.Encode("uncompressed_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCompressedSize = default; + LocalJsonValue propCompressedSizeInBytes = default; + LocalJsonValue propCount = default; + LocalJsonValue propUncompressedSize = default; + LocalJsonValue propUncompressedSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCompressedSize.TryReadProperty(ref reader, options, PropCompressedSize, null)) + { + continue; + } + + if (propCompressedSizeInBytes.TryReadProperty(ref reader, options, PropCompressedSizeInBytes, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propUncompressedSize.TryReadProperty(ref reader, options, PropUncompressedSize, null)) + { + continue; + } + + if (propUncompressedSizeInBytes.TryReadProperty(ref reader, options, PropUncompressedSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CompressedSize = propCompressedSize.Value, + CompressedSizeInBytes = propCompressedSizeInBytes.Value, + Count = propCount.Value, + UncompressedSize = propUncompressedSize.Value, + UncompressedSizeInBytes = propUncompressedSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetail value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCompressedSize, value.CompressedSize, null, null); + writer.WriteProperty(options, PropCompressedSizeInBytes, value.CompressedSizeInBytes, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropUncompressedSize, value.UncompressedSize, null, null); + writer.WriteProperty(options, PropUncompressedSizeInBytes, value.UncompressedSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.SerializedClusterStateDetailConverter))] public sealed partial class SerializedClusterStateDetail { - [JsonInclude, JsonPropertyName("compressed_size")] - public string? CompressedSize { get; init; } - [JsonInclude, JsonPropertyName("compressed_size_in_bytes")] - public long? CompressedSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } - [JsonInclude, JsonPropertyName("uncompressed_size")] - public string? UncompressedSize { get; init; } - [JsonInclude, JsonPropertyName("uncompressed_size_in_bytes")] - public long? UncompressedSizeInBytes { get; init; } +#if NET7_0_OR_GREATER + public SerializedClusterStateDetail() + { + } +#endif +#if !NET7_0_OR_GREATER + public SerializedClusterStateDetail() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SerializedClusterStateDetail(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? CompressedSize { get; set; } + public long? CompressedSizeInBytes { get; set; } + public long? Count { get; set; } + public string? UncompressedSize { get; set; } + public long? UncompressedSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SizeHttpHistogram.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SizeHttpHistogram.g.cs index 0014092d70b..5299ab4a963 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SizeHttpHistogram.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/SizeHttpHistogram.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class SizeHttpHistogramConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropGeBytes = System.Text.Json.JsonEncodedText.Encode("ge_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropLtBytes = System.Text.Json.JsonEncodedText.Encode("lt_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.SizeHttpHistogram Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propGeBytes = default; + LocalJsonValue propLtBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propGeBytes.TryReadProperty(ref reader, options, PropGeBytes, null)) + { + continue; + } + + if (propLtBytes.TryReadProperty(ref reader, options, PropLtBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.SizeHttpHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + GeBytes = propGeBytes.Value, + LtBytes = propLtBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.SizeHttpHistogram value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropGeBytes, value.GeBytes, null, null); + writer.WriteProperty(options, PropLtBytes, value.LtBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.SizeHttpHistogramConverter))] public sealed partial class SizeHttpHistogram { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("ge_bytes")] - public long? GeBytes { get; init; } - [JsonInclude, JsonPropertyName("lt_bytes")] - public long? LtBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SizeHttpHistogram(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public SizeHttpHistogram() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SizeHttpHistogram() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SizeHttpHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public long? GeBytes { get; set; } + public long? LtBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Stats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Stats.g.cs index 069731edd49..b6186f43493 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Stats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Stats.g.cs @@ -17,115 +17,342 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class StatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAdaptiveSelection = System.Text.Json.JsonEncodedText.Encode("adaptive_selection"); + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropBreakers = System.Text.Json.JsonEncodedText.Encode("breakers"); + private static readonly System.Text.Json.JsonEncodedText PropDiscovery = System.Text.Json.JsonEncodedText.Encode("discovery"); + private static readonly System.Text.Json.JsonEncodedText PropFs = System.Text.Json.JsonEncodedText.Encode("fs"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropIndexingPressure = System.Text.Json.JsonEncodedText.Encode("indexing_pressure"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIngest = System.Text.Json.JsonEncodedText.Encode("ingest"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropJvm = System.Text.Json.JsonEncodedText.Encode("jvm"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOs = System.Text.Json.JsonEncodedText.Encode("os"); + private static readonly System.Text.Json.JsonEncodedText PropProcess = System.Text.Json.JsonEncodedText.Encode("process"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropScriptCache = System.Text.Json.JsonEncodedText.Encode("script_cache"); + private static readonly System.Text.Json.JsonEncodedText PropThreadPool = System.Text.Json.JsonEncodedText.Encode("thread_pool"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.Nodes.Stats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAdaptiveSelection = default; + LocalJsonValue?> propAttributes = default; + LocalJsonValue?> propBreakers = default; + LocalJsonValue propDiscovery = default; + LocalJsonValue propFs = default; + LocalJsonValue propHost = default; + LocalJsonValue propHttp = default; + LocalJsonValue propIndexingPressure = default; + LocalJsonValue propIndices = default; + LocalJsonValue propIngest = default; + LocalJsonValue?> propIp = default; + LocalJsonValue propJvm = default; + LocalJsonValue propName = default; + LocalJsonValue propOs = default; + LocalJsonValue propProcess = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue propScript = default; + LocalJsonValue>?> propScriptCache = default; + LocalJsonValue?> propThreadPool = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTransport = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAdaptiveSelection.TryReadProperty(ref reader, options, PropAdaptiveSelection, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propBreakers.TryReadProperty(ref reader, options, PropBreakers, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propDiscovery.TryReadProperty(ref reader, options, PropDiscovery, null)) + { + continue; + } + + if (propFs.TryReadProperty(ref reader, options, PropFs, null)) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propIndexingPressure.TryReadProperty(ref reader, options, PropIndexingPressure, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propIngest.TryReadProperty(ref reader, options, PropIngest, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propJvm.TryReadProperty(ref reader, options, PropJvm, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propOs.TryReadProperty(ref reader, options, PropOs, null)) + { + continue; + } + + if (propProcess.TryReadProperty(ref reader, options, PropProcess, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propScriptCache.TryReadProperty(ref reader, options, PropScriptCache, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propThreadPool.TryReadProperty(ref reader, options, PropThreadPool, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Stats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AdaptiveSelection = propAdaptiveSelection.Value, + Attributes = propAttributes.Value, + Breakers = propBreakers.Value, + Discovery = propDiscovery.Value, + Fs = propFs.Value, + Host = propHost.Value, + Http = propHttp.Value, + IndexingPressure = propIndexingPressure.Value, + Indices = propIndices.Value, + Ingest = propIngest.Value, + Ip = propIp.Value, + Jvm = propJvm.Value, + Name = propName.Value, + Os = propOs.Value, + Process = propProcess.Value, + Roles = propRoles.Value, + Script = propScript.Value, + ScriptCache = propScriptCache.Value, + ThreadPool = propThreadPool.Value, + Timestamp = propTimestamp.Value, + Transport = propTransport.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Stats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAdaptiveSelection, value.AdaptiveSelection, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropBreakers, value.Breakers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDiscovery, value.Discovery, null, null); + writer.WriteProperty(options, PropFs, value.Fs, null, null); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropIndexingPressure, value.IndexingPressure, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropIngest, value.Ingest, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropJvm, value.Jvm, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropOs, value.Os, null, null); + writer.WriteProperty(options, PropProcess, value.Process, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropScriptCache, value.ScriptCache, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropThreadPool, value.ThreadPool, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.StatsConverter))] public sealed partial class Stats { +#if NET7_0_OR_GREATER + public Stats() + { + } +#endif +#if !NET7_0_OR_GREATER + public Stats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Stats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Statistics about adaptive replica selection. /// /// - [JsonInclude, JsonPropertyName("adaptive_selection")] - public IReadOnlyDictionary? AdaptiveSelection { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? AdaptiveSelection { get; set; } /// /// /// Contains a list of attributes for the node. /// /// - [JsonInclude, JsonPropertyName("attributes")] - [ReadOnlyFieldDictionaryConverter(typeof(string))] - public IReadOnlyDictionary? Attributes { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Attributes { get; set; } /// /// /// Statistics about the field data circuit breaker. /// /// - [JsonInclude, JsonPropertyName("breakers")] - public IReadOnlyDictionary? Breakers { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Breakers { get; set; } /// /// /// Contains node discovery statistics for the node. /// /// - [JsonInclude, JsonPropertyName("discovery")] - public Elastic.Clients.Elasticsearch.Nodes.Discovery? Discovery { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Discovery? Discovery { get; set; } /// /// /// File system information, data path, free disk space, read/write stats. /// /// - [JsonInclude, JsonPropertyName("fs")] - public Elastic.Clients.Elasticsearch.Nodes.FileSystem? Fs { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.FileSystem? Fs { get; set; } /// /// /// Network host for the node, based on the network host setting. /// /// - [JsonInclude, JsonPropertyName("host")] - public string? Host { get; init; } + public string? Host { get; set; } /// /// /// HTTP connection information. /// /// - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Nodes.Http? Http { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Http? Http { get; set; } /// /// /// Contains indexing pressure statistics for the node. /// /// - [JsonInclude, JsonPropertyName("indexing_pressure")] - public Elastic.Clients.Elasticsearch.Nodes.IndexingPressure? IndexingPressure { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.IndexingPressure? IndexingPressure { get; set; } /// /// /// Indices stats about size, document count, indexing and deletion times, search times, field cache size, merges and flushes. /// /// - [JsonInclude, JsonPropertyName("indices")] - public Elastic.Clients.Elasticsearch.IndexManagement.ShardStats? Indices { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.ShardStats? Indices { get; set; } /// /// /// Statistics about ingest preprocessing. /// /// - [JsonInclude, JsonPropertyName("ingest")] - public Elastic.Clients.Elasticsearch.Nodes.Ingest? Ingest { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Ingest? Ingest { get; set; } /// /// /// IP address and port for the node. /// /// - [JsonInclude, JsonPropertyName("ip")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection? Ip { get; init; } + public System.Collections.Generic.ICollection? Ip { get; set; } /// /// /// JVM stats, memory pool information, garbage collection, buffer pools, number of loaded/unloaded classes. /// /// - [JsonInclude, JsonPropertyName("jvm")] - public Elastic.Clients.Elasticsearch.Nodes.Jvm? Jvm { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Jvm? Jvm { get; set; } /// /// @@ -133,66 +360,56 @@ public sealed partial class Stats /// Based on the node name setting. /// /// - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } + public string? Name { get; set; } /// /// /// Operating system stats, load average, mem, swap. /// /// - [JsonInclude, JsonPropertyName("os")] - public Elastic.Clients.Elasticsearch.Nodes.OperatingSystem? Os { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.OperatingSystem? Os { get; set; } /// /// /// Process statistics, memory consumption, cpu usage, open file descriptors. /// /// - [JsonInclude, JsonPropertyName("process")] - public Elastic.Clients.Elasticsearch.Nodes.Process? Process { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Process? Process { get; set; } /// /// /// Roles assigned to the node. /// /// - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } /// /// /// Contains script statistics for the node. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Nodes.Scripting? Script { get; init; } - [JsonInclude, JsonPropertyName("script_cache")] - public IReadOnlyDictionary>>? ScriptCache { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Scripting? Script { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>? ScriptCache { get; set; } /// /// /// Statistics about each thread pool, including current size, queue and rejected tasks. /// /// - [JsonInclude, JsonPropertyName("thread_pool")] - public IReadOnlyDictionary? ThreadPool { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public long? Timestamp { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? ThreadPool { get; set; } + public long? Timestamp { get; set; } /// /// /// Transport statistics about sent and received bytes in cluster communication. /// /// - [JsonInclude, JsonPropertyName("transport")] - public Elastic.Clients.Elasticsearch.Nodes.Transport? Transport { get; init; } + public Elastic.Clients.Elasticsearch.Nodes.Transport? Transport { get; set; } /// /// /// Host and port for the transport layer, used for internal communication between nodes in a cluster. /// /// - [JsonInclude, JsonPropertyName("transport_address")] - public string? TransportAddress { get; init; } + public string? TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ThreadCount.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ThreadCount.g.cs index 5f29e71f522..9777c645bd0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ThreadCount.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/ThreadCount.g.cs @@ -17,63 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class ThreadCountConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText PropCompleted = System.Text.Json.JsonEncodedText.Encode("completed"); + private static readonly System.Text.Json.JsonEncodedText PropLargest = System.Text.Json.JsonEncodedText.Encode("largest"); + private static readonly System.Text.Json.JsonEncodedText PropQueue = System.Text.Json.JsonEncodedText.Encode("queue"); + private static readonly System.Text.Json.JsonEncodedText PropRejected = System.Text.Json.JsonEncodedText.Encode("rejected"); + private static readonly System.Text.Json.JsonEncodedText PropThreads = System.Text.Json.JsonEncodedText.Encode("threads"); + + public override Elastic.Clients.Elasticsearch.Nodes.ThreadCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActive = default; + LocalJsonValue propCompleted = default; + LocalJsonValue propLargest = default; + LocalJsonValue propQueue = default; + LocalJsonValue propRejected = default; + LocalJsonValue propThreads = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActive.TryReadProperty(ref reader, options, PropActive, null)) + { + continue; + } + + if (propCompleted.TryReadProperty(ref reader, options, PropCompleted, null)) + { + continue; + } + + if (propLargest.TryReadProperty(ref reader, options, PropLargest, null)) + { + continue; + } + + if (propQueue.TryReadProperty(ref reader, options, PropQueue, null)) + { + continue; + } + + if (propRejected.TryReadProperty(ref reader, options, PropRejected, null)) + { + continue; + } + + if (propThreads.TryReadProperty(ref reader, options, PropThreads, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.ThreadCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Active = propActive.Value, + Completed = propCompleted.Value, + Largest = propLargest.Value, + Queue = propQueue.Value, + Rejected = propRejected.Value, + Threads = propThreads.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.ThreadCount value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActive, value.Active, null, null); + writer.WriteProperty(options, PropCompleted, value.Completed, null, null); + writer.WriteProperty(options, PropLargest, value.Largest, null, null); + writer.WriteProperty(options, PropQueue, value.Queue, null, null); + writer.WriteProperty(options, PropRejected, value.Rejected, null, null); + writer.WriteProperty(options, PropThreads, value.Threads, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.ThreadCountConverter))] public sealed partial class ThreadCount { +#if NET7_0_OR_GREATER + public ThreadCount() + { + } +#endif +#if !NET7_0_OR_GREATER + public ThreadCount() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ThreadCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of active threads in the thread pool. /// /// - [JsonInclude, JsonPropertyName("active")] - public long? Active { get; init; } + public long? Active { get; set; } /// /// /// Number of tasks completed by the thread pool executor. /// /// - [JsonInclude, JsonPropertyName("completed")] - public long? Completed { get; init; } + public long? Completed { get; set; } /// /// /// Highest number of active threads in the thread pool. /// /// - [JsonInclude, JsonPropertyName("largest")] - public long? Largest { get; init; } + public long? Largest { get; set; } /// /// /// Number of tasks in queue for the thread pool. /// /// - [JsonInclude, JsonPropertyName("queue")] - public long? Queue { get; init; } + public long? Queue { get; set; } /// /// /// Number of tasks rejected by the thread pool executor. /// /// - [JsonInclude, JsonPropertyName("rejected")] - public long? Rejected { get; init; } + public long? Rejected { get; set; } /// /// /// Number of threads in the thread pool. /// /// - [JsonInclude, JsonPropertyName("threads")] - public long? Threads { get; init; } + public long? Threads { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TimeHttpHistogram.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TimeHttpHistogram.g.cs index 71bc31a204f..351c660c236 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TimeHttpHistogram.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TimeHttpHistogram.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class TimeHttpHistogramConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropGeMillis = System.Text.Json.JsonEncodedText.Encode("ge_millis"); + private static readonly System.Text.Json.JsonEncodedText PropLtMillis = System.Text.Json.JsonEncodedText.Encode("lt_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.TimeHttpHistogram Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propGeMillis = default; + LocalJsonValue propLtMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propGeMillis.TryReadProperty(ref reader, options, PropGeMillis, null)) + { + continue; + } + + if (propLtMillis.TryReadProperty(ref reader, options, PropLtMillis, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.TimeHttpHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + GeMillis = propGeMillis.Value, + LtMillis = propLtMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.TimeHttpHistogram value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropGeMillis, value.GeMillis, null, null); + writer.WriteProperty(options, PropLtMillis, value.LtMillis, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.TimeHttpHistogramConverter))] public sealed partial class TimeHttpHistogram { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("ge_millis")] - public long? GeMillis { get; init; } - [JsonInclude, JsonPropertyName("lt_millis")] - public long? LtMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeHttpHistogram(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public TimeHttpHistogram() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TimeHttpHistogram() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeHttpHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public long? GeMillis { get; set; } + public long? LtMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Transport.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Transport.g.cs index a21a0c3b5e6..720ab418ac9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Transport.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/Transport.g.cs @@ -17,65 +17,192 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class TransportConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInboundHandlingTimeHistogram = System.Text.Json.JsonEncodedText.Encode("inbound_handling_time_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropOutboundHandlingTimeHistogram = System.Text.Json.JsonEncodedText.Encode("outbound_handling_time_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropRxCount = System.Text.Json.JsonEncodedText.Encode("rx_count"); + private static readonly System.Text.Json.JsonEncodedText PropRxSize = System.Text.Json.JsonEncodedText.Encode("rx_size"); + private static readonly System.Text.Json.JsonEncodedText PropRxSizeInBytes = System.Text.Json.JsonEncodedText.Encode("rx_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropServerOpen = System.Text.Json.JsonEncodedText.Encode("server_open"); + private static readonly System.Text.Json.JsonEncodedText PropTotalOutboundConnections = System.Text.Json.JsonEncodedText.Encode("total_outbound_connections"); + private static readonly System.Text.Json.JsonEncodedText PropTxCount = System.Text.Json.JsonEncodedText.Encode("tx_count"); + private static readonly System.Text.Json.JsonEncodedText PropTxSize = System.Text.Json.JsonEncodedText.Encode("tx_size"); + private static readonly System.Text.Json.JsonEncodedText PropTxSizeInBytes = System.Text.Json.JsonEncodedText.Encode("tx_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Nodes.Transport Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propInboundHandlingTimeHistogram = default; + LocalJsonValue?> propOutboundHandlingTimeHistogram = default; + LocalJsonValue propRxCount = default; + LocalJsonValue propRxSize = default; + LocalJsonValue propRxSizeInBytes = default; + LocalJsonValue propServerOpen = default; + LocalJsonValue propTotalOutboundConnections = default; + LocalJsonValue propTxCount = default; + LocalJsonValue propTxSize = default; + LocalJsonValue propTxSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInboundHandlingTimeHistogram.TryReadProperty(ref reader, options, PropInboundHandlingTimeHistogram, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOutboundHandlingTimeHistogram.TryReadProperty(ref reader, options, PropOutboundHandlingTimeHistogram, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRxCount.TryReadProperty(ref reader, options, PropRxCount, null)) + { + continue; + } + + if (propRxSize.TryReadProperty(ref reader, options, PropRxSize, null)) + { + continue; + } + + if (propRxSizeInBytes.TryReadProperty(ref reader, options, PropRxSizeInBytes, null)) + { + continue; + } + + if (propServerOpen.TryReadProperty(ref reader, options, PropServerOpen, null)) + { + continue; + } + + if (propTotalOutboundConnections.TryReadProperty(ref reader, options, PropTotalOutboundConnections, null)) + { + continue; + } + + if (propTxCount.TryReadProperty(ref reader, options, PropTxCount, null)) + { + continue; + } + + if (propTxSize.TryReadProperty(ref reader, options, PropTxSize, null)) + { + continue; + } + + if (propTxSizeInBytes.TryReadProperty(ref reader, options, PropTxSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.Transport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InboundHandlingTimeHistogram = propInboundHandlingTimeHistogram.Value, + OutboundHandlingTimeHistogram = propOutboundHandlingTimeHistogram.Value, + RxCount = propRxCount.Value, + RxSize = propRxSize.Value, + RxSizeInBytes = propRxSizeInBytes.Value, + ServerOpen = propServerOpen.Value, + TotalOutboundConnections = propTotalOutboundConnections.Value, + TxCount = propTxCount.Value, + TxSize = propTxSize.Value, + TxSizeInBytes = propTxSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.Transport value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInboundHandlingTimeHistogram, value.InboundHandlingTimeHistogram, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOutboundHandlingTimeHistogram, value.OutboundHandlingTimeHistogram, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRxCount, value.RxCount, null, null); + writer.WriteProperty(options, PropRxSize, value.RxSize, null, null); + writer.WriteProperty(options, PropRxSizeInBytes, value.RxSizeInBytes, null, null); + writer.WriteProperty(options, PropServerOpen, value.ServerOpen, null, null); + writer.WriteProperty(options, PropTotalOutboundConnections, value.TotalOutboundConnections, null, null); + writer.WriteProperty(options, PropTxCount, value.TxCount, null, null); + writer.WriteProperty(options, PropTxSize, value.TxSize, null, null); + writer.WriteProperty(options, PropTxSizeInBytes, value.TxSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.TransportConverter))] public sealed partial class Transport { +#if NET7_0_OR_GREATER + public Transport() + { + } +#endif +#if !NET7_0_OR_GREATER + public Transport() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Transport(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The distribution of the time spent handling each inbound message on a transport thread, represented as a histogram. /// /// - [JsonInclude, JsonPropertyName("inbound_handling_time_histogram")] - public IReadOnlyCollection? InboundHandlingTimeHistogram { get; init; } + public System.Collections.Generic.IReadOnlyCollection? InboundHandlingTimeHistogram { get; set; } /// /// /// The distribution of the time spent sending each outbound transport message on a transport thread, represented as a histogram. /// /// - [JsonInclude, JsonPropertyName("outbound_handling_time_histogram")] - public IReadOnlyCollection? OutboundHandlingTimeHistogram { get; init; } + public System.Collections.Generic.IReadOnlyCollection? OutboundHandlingTimeHistogram { get; set; } /// /// /// Total number of RX (receive) packets received by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("rx_count")] - public long? RxCount { get; init; } + public long? RxCount { get; set; } /// /// /// Size of RX packets received by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("rx_size")] - public string? RxSize { get; init; } + public string? RxSize { get; set; } /// /// /// Size, in bytes, of RX packets received by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("rx_size_in_bytes")] - public long? RxSizeInBytes { get; init; } + public long? RxSizeInBytes { get; set; } /// /// /// Current number of inbound TCP connections used for internal communication between nodes. /// /// - [JsonInclude, JsonPropertyName("server_open")] - public int? ServerOpen { get; init; } + public int? ServerOpen { get; set; } /// /// @@ -84,30 +211,26 @@ public sealed partial class Transport /// Transport connections are typically long-lived so this statistic should remain constant in a stable cluster. /// /// - [JsonInclude, JsonPropertyName("total_outbound_connections")] - public long? TotalOutboundConnections { get; init; } + public long? TotalOutboundConnections { get; set; } /// /// /// Total number of TX (transmit) packets sent by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("tx_count")] - public long? TxCount { get; init; } + public long? TxCount { get; set; } /// /// /// Size of TX packets sent by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("tx_size")] - public string? TxSize { get; init; } + public string? TxSize { get; set; } /// /// /// Size, in bytes, of TX packets sent by the node during internal cluster communication. /// /// - [JsonInclude, JsonPropertyName("tx_size_in_bytes")] - public long? TxSizeInBytes { get; init; } + public long? TxSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TransportHistogram.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TransportHistogram.g.cs index 281b2412ac0..50ce61703a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TransportHistogram.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Nodes/TransportHistogram.g.cs @@ -17,33 +17,101 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Nodes; +internal sealed partial class TransportHistogramConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropGeMillis = System.Text.Json.JsonEncodedText.Encode("ge_millis"); + private static readonly System.Text.Json.JsonEncodedText PropLtMillis = System.Text.Json.JsonEncodedText.Encode("lt_millis"); + + public override Elastic.Clients.Elasticsearch.Nodes.TransportHistogram Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propGeMillis = default; + LocalJsonValue propLtMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propGeMillis.TryReadProperty(ref reader, options, PropGeMillis, null)) + { + continue; + } + + if (propLtMillis.TryReadProperty(ref reader, options, PropLtMillis, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Nodes.TransportHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + GeMillis = propGeMillis.Value, + LtMillis = propLtMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Nodes.TransportHistogram value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropGeMillis, value.GeMillis, null, null); + writer.WriteProperty(options, PropLtMillis, value.LtMillis, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Nodes.TransportHistogramConverter))] public sealed partial class TransportHistogram { +#if NET7_0_OR_GREATER + public TransportHistogram() + { + } +#endif +#if !NET7_0_OR_GREATER + public TransportHistogram() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransportHistogram(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of times a transport thread took a period of time within the bounds of this bucket to handle an inbound message. /// /// - [JsonInclude, JsonPropertyName("count")] - public long? Count { get; init; } + public long? Count { get; set; } /// /// /// The inclusive lower bound of the bucket in milliseconds. May be omitted on the first bucket if this bucket has no lower bound. /// /// - [JsonInclude, JsonPropertyName("ge_millis")] - public long? GeMillis { get; init; } + public long? GeMillis { get; set; } /// /// @@ -51,6 +119,5 @@ public sealed partial class TransportHistogram /// May be omitted on the last bucket if this bucket has no upper bound. /// /// - [JsonInclude, JsonPropertyName("lt_millis")] - public long? LtMillis { get; init; } + public long? LtMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Percentage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Percentage.g.cs new file mode 100644 index 00000000000..303dd050b02 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Percentage.g.cs @@ -0,0 +1,94 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +internal sealed partial class PercentageConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Percentage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Percentage(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Percentage(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Percentage)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Percentage value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PercentageConverter))] +public sealed partial class Percentage : Elastic.Clients.Elasticsearch.Union +{ + public Percentage(string value) : base(value) + { + } + + public Percentage(float value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Percentage(string value) => new Elastic.Clients.Elasticsearch.Percentage(value); + public static implicit operator Elastic.Clients.Elasticsearch.Percentage(float value) => new Elastic.Clients.Elasticsearch.Percentage(value); +} + +public readonly partial struct PercentageFactory +{ + public Elastic.Clients.Elasticsearch.Percentage Value(string value) + { + return new Elastic.Clients.Elasticsearch.Percentage(value); + } + + public Elastic.Clients.Elasticsearch.Percentage Value(float value) + { + return new Elastic.Clients.Elasticsearch.Percentage(value); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Percentage Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.PercentageFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PluginStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PluginStats.g.cs index c76a436e28b..80ea451895f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/PluginStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/PluginStats.g.cs @@ -17,34 +17,199 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class PluginStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassname = System.Text.Json.JsonEncodedText.Encode("classname"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropElasticsearchVersion = System.Text.Json.JsonEncodedText.Encode("elasticsearch_version"); + private static readonly System.Text.Json.JsonEncodedText PropExtendedPlugins = System.Text.Json.JsonEncodedText.Encode("extended_plugins"); + private static readonly System.Text.Json.JsonEncodedText PropHasNativeController = System.Text.Json.JsonEncodedText.Encode("has_native_controller"); + private static readonly System.Text.Json.JsonEncodedText PropJavaVersion = System.Text.Json.JsonEncodedText.Encode("java_version"); + private static readonly System.Text.Json.JsonEncodedText PropLicensed = System.Text.Json.JsonEncodedText.Encode("licensed"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.PluginStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassname = default; + LocalJsonValue propDescription = default; + LocalJsonValue propElasticsearchVersion = default; + LocalJsonValue> propExtendedPlugins = default; + LocalJsonValue propHasNativeController = default; + LocalJsonValue propJavaVersion = default; + LocalJsonValue propLicensed = default; + LocalJsonValue propName = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassname.TryReadProperty(ref reader, options, PropClassname, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propElasticsearchVersion.TryReadProperty(ref reader, options, PropElasticsearchVersion, null)) + { + continue; + } + + if (propExtendedPlugins.TryReadProperty(ref reader, options, PropExtendedPlugins, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propHasNativeController.TryReadProperty(ref reader, options, PropHasNativeController, null)) + { + continue; + } + + if (propJavaVersion.TryReadProperty(ref reader, options, PropJavaVersion, null)) + { + continue; + } + + if (propLicensed.TryReadProperty(ref reader, options, PropLicensed, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.PluginStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classname = propClassname.Value, + Description = propDescription.Value, + ElasticsearchVersion = propElasticsearchVersion.Value, + ExtendedPlugins = propExtendedPlugins.Value, + HasNativeController = propHasNativeController.Value, + JavaVersion = propJavaVersion.Value, + Licensed = propLicensed.Value, + Name = propName.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.PluginStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassname, value.Classname, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropElasticsearchVersion, value.ElasticsearchVersion, null, null); + writer.WriteProperty(options, PropExtendedPlugins, value.ExtendedPlugins, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHasNativeController, value.HasNativeController, null, null); + writer.WriteProperty(options, PropJavaVersion, value.JavaVersion, null, null); + writer.WriteProperty(options, PropLicensed, value.Licensed, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.PluginStatsConverter))] public sealed partial class PluginStats { - [JsonInclude, JsonPropertyName("classname")] - public string Classname { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string Description { get; init; } - [JsonInclude, JsonPropertyName("elasticsearch_version")] - public string ElasticsearchVersion { get; init; } - [JsonInclude, JsonPropertyName("extended_plugins")] - public IReadOnlyCollection ExtendedPlugins { get; init; } - [JsonInclude, JsonPropertyName("has_native_controller")] - public bool HasNativeController { get; init; } - [JsonInclude, JsonPropertyName("java_version")] - public string JavaVersion { get; init; } - [JsonInclude, JsonPropertyName("licensed")] - public bool Licensed { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PluginStats(string classname, string description, string elasticsearchVersion, System.Collections.Generic.IReadOnlyCollection extendedPlugins, bool hasNativeController, string javaVersion, bool licensed, string name, string version) + { + Classname = classname; + Description = description; + ElasticsearchVersion = elasticsearchVersion; + ExtendedPlugins = extendedPlugins; + HasNativeController = hasNativeController; + JavaVersion = javaVersion; + Licensed = licensed; + Name = name; + Version = version; + } +#if NET7_0_OR_GREATER + public PluginStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PluginStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PluginStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Classname { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ElasticsearchVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ExtendedPlugins { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool HasNativeController { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JavaVersion { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Licensed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryCacheStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryCacheStats.g.cs index f4f41c034f5..b9e21f3120d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryCacheStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryCacheStats.g.cs @@ -17,80 +17,227 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class QueryCacheStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCacheCount = System.Text.Json.JsonEncodedText.Encode("cache_count"); + private static readonly System.Text.Json.JsonEncodedText PropCacheSize = System.Text.Json.JsonEncodedText.Encode("cache_size"); + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropHitCount = System.Text.Json.JsonEncodedText.Encode("hit_count"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySize = System.Text.Json.JsonEncodedText.Encode("memory_size"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySizeInBytes = System.Text.Json.JsonEncodedText.Encode("memory_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMissCount = System.Text.Json.JsonEncodedText.Encode("miss_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalCount = System.Text.Json.JsonEncodedText.Encode("total_count"); + + public override Elastic.Clients.Elasticsearch.QueryCacheStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCacheCount = default; + LocalJsonValue propCacheSize = default; + LocalJsonValue propEvictions = default; + LocalJsonValue propHitCount = default; + LocalJsonValue propMemorySize = default; + LocalJsonValue propMemorySizeInBytes = default; + LocalJsonValue propMissCount = default; + LocalJsonValue propTotalCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCacheCount.TryReadProperty(ref reader, options, PropCacheCount, null)) + { + continue; + } + + if (propCacheSize.TryReadProperty(ref reader, options, PropCacheSize, null)) + { + continue; + } + + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propHitCount.TryReadProperty(ref reader, options, PropHitCount, null)) + { + continue; + } + + if (propMemorySize.TryReadProperty(ref reader, options, PropMemorySize, null)) + { + continue; + } + + if (propMemorySizeInBytes.TryReadProperty(ref reader, options, PropMemorySizeInBytes, null)) + { + continue; + } + + if (propMissCount.TryReadProperty(ref reader, options, PropMissCount, null)) + { + continue; + } + + if (propTotalCount.TryReadProperty(ref reader, options, PropTotalCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryCacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CacheCount = propCacheCount.Value, + CacheSize = propCacheSize.Value, + Evictions = propEvictions.Value, + HitCount = propHitCount.Value, + MemorySize = propMemorySize.Value, + MemorySizeInBytes = propMemorySizeInBytes.Value, + MissCount = propMissCount.Value, + TotalCount = propTotalCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryCacheStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCacheCount, value.CacheCount, null, null); + writer.WriteProperty(options, PropCacheSize, value.CacheSize, null, null); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropHitCount, value.HitCount, null, null); + writer.WriteProperty(options, PropMemorySize, value.MemorySize, null, null); + writer.WriteProperty(options, PropMemorySizeInBytes, value.MemorySizeInBytes, null, null); + writer.WriteProperty(options, PropMissCount, value.MissCount, null, null); + writer.WriteProperty(options, PropTotalCount, value.TotalCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryCacheStatsConverter))] public sealed partial class QueryCacheStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryCacheStats(long cacheCount, long cacheSize, long evictions, long hitCount, long memorySizeInBytes, long missCount, long totalCount) + { + CacheCount = cacheCount; + CacheSize = cacheSize; + Evictions = evictions; + HitCount = hitCount; + MemorySizeInBytes = memorySizeInBytes; + MissCount = missCount; + TotalCount = totalCount; + } +#if NET7_0_OR_GREATER + public QueryCacheStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryCacheStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryCacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of entries added to the query cache across all shards assigned to selected nodes. /// This number includes current and evicted entries. /// /// - [JsonInclude, JsonPropertyName("cache_count")] - public long CacheCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long CacheCount { get; set; } /// /// /// Total number of entries currently in the query cache across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("cache_size")] - public long CacheSize { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long CacheSize { get; set; } /// /// /// Total number of query cache evictions across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("evictions")] - public long Evictions { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Evictions { get; set; } /// /// /// Total count of query cache hits across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("hit_count")] - public long HitCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long HitCount { get; set; } /// /// /// Total amount of memory used for the query cache across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("memory_size")] - public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? MemorySize { get; set; } /// /// /// Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("memory_size_in_bytes")] - public long MemorySizeInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemorySizeInBytes { get; set; } /// /// /// Total count of query cache misses across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("miss_count")] - public long MissCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MissCount { get; set; } /// /// /// Total count of hits and misses in the query cache across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("total_count")] - public long TotalCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs index bbf7f54b574..71659109a87 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs @@ -17,18 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class BoolQuery +internal sealed partial class BoolQueryConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropMust = System.Text.Json.JsonEncodedText.Encode("must"); + private static readonly System.Text.Json.JsonEncodedText PropMustNot = System.Text.Json.JsonEncodedText.Encode("must_not"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropShould = System.Text.Json.JsonEncodedText.Encode("should"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue?> propMust = default; + LocalJsonValue?> propMustNot = default; + LocalJsonValue propQueryName = default; + LocalJsonValue?> propShould = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propMust.TryReadProperty(ref reader, options, PropMust, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMustNot.TryReadProperty(ref reader, options, PropMustNot, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propShould.TryReadProperty(ref reader, options, PropShould, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Filter = propFilter.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Must = propMust.Value, + MustNot = propMustNot.Value, + QueryName = propQueryName.Value, + Should = propShould.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropMust, value.Must, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMustNot, value.MustNot, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropShould, value.Should, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryConverter))] +public partial class BoolQuery +{ +#if NET7_0_OR_GREATER + public BoolQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public BoolQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +143,6 @@ public sealed partial class BoolQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -46,16 +151,13 @@ public sealed partial class BoolQuery /// However, unlike must, the score of the query will be ignored. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Specifies the number or percentage of should clauses returned documents must match. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -63,9 +165,7 @@ public sealed partial class BoolQuery /// The clause (query) must appear in matching documents and will contribute to the score. /// /// - [JsonInclude, JsonPropertyName("must")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Must { get; set; } + public System.Collections.Generic.ICollection? Must { get; set; } /// /// @@ -73,10 +173,7 @@ public sealed partial class BoolQuery /// Because scoring is ignored, a score of 0 is returned for all documents. /// /// - [JsonInclude, JsonPropertyName("must_not")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? MustNot { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public System.Collections.Generic.ICollection? MustNot { get; set; } public string? QueryName { get; set; } /// @@ -84,43 +181,27 @@ public sealed partial class BoolQuery /// The clause (query) should appear in the matching document. /// /// - [JsonInclude, JsonPropertyName("should")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Should { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Bool(boolQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Bool(boolQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Bool(boolQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Bool(boolQuery); + public System.Collections.Generic.ICollection? Should { get; set; } } -public sealed partial class BoolQueryDescriptor : SerializableDescriptor> +public readonly partial struct BoolQueryDescriptor { - internal BoolQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoolQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery instance) + { + Instance = instance; + } - public BoolQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoolQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private ICollection? MustValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MustDescriptor { get; set; } - private Action> MustDescriptorAction { get; set; } - private Action>[] MustDescriptorActions { get; set; } - private ICollection? MustNotValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MustNotDescriptor { get; set; } - private Action> MustNotDescriptorAction { get; set; } - private Action>[] MustNotDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } - private ICollection? ShouldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ShouldDescriptor { get; set; } - private Action> ShouldDescriptorAction { get; set; } - private Action>[] ShouldDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -130,10 +211,10 @@ public BoolQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public BoolQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -142,40 +223,40 @@ public BoolQueryDescriptor Boost(float? boost) /// However, unlike must, the score of the query will be ignored. /// /// - public BoolQueryDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public BoolQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The clause (query) must appear in matching documents. + /// However, unlike must, the score of the query will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public BoolQueryDescriptor Filter(Action> configure) + /// + /// + /// The clause (query) must appear in matching documents. + /// However, unlike must, the score of the query will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public BoolQueryDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -183,10 +264,10 @@ public BoolQueryDescriptor Filter(params Actionshould clauses returned documents must match. /// /// - public BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -194,40 +275,38 @@ public BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elastic /// The clause (query) must appear in matching documents and will contribute to the score. /// /// - public BoolQueryDescriptor Must(ICollection? must) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(System.Collections.Generic.ICollection? value) { - MustDescriptor = null; - MustDescriptorAction = null; - MustDescriptorActions = null; - MustValue = must; - return Self; + Instance.Must = value; + return this; } - public BoolQueryDescriptor Must(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The clause (query) must appear in matching documents and will contribute to the score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - MustValue = null; - MustDescriptorAction = null; - MustDescriptorActions = null; - MustDescriptor = descriptor; - return Self; + Instance.Must = [.. values]; + return this; } - public BoolQueryDescriptor Must(Action> configure) + /// + /// + /// The clause (query) must appear in matching documents and will contribute to the score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(params System.Action>[] actions) { - MustValue = null; - MustDescriptor = null; - MustDescriptorActions = null; - MustDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public BoolQueryDescriptor Must(params Action>[] configure) - { - MustValue = null; - MustDescriptor = null; - MustDescriptorAction = null; - MustDescriptorActions = configure; - return Self; + Instance.Must = items; + return this; } /// @@ -236,46 +315,46 @@ public BoolQueryDescriptor Must(params Action0 is returned for all documents. /// /// - public BoolQueryDescriptor MustNot(ICollection? mustNot) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(System.Collections.Generic.ICollection? value) { - MustNotDescriptor = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = null; - MustNotValue = mustNot; - return Self; + Instance.MustNot = value; + return this; } - public BoolQueryDescriptor MustNot(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The clause (query) must not appear in the matching documents. + /// Because scoring is ignored, a score of 0 is returned for all documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - MustNotValue = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = null; - MustNotDescriptor = descriptor; - return Self; + Instance.MustNot = [.. values]; + return this; } - public BoolQueryDescriptor MustNot(Action> configure) + /// + /// + /// The clause (query) must not appear in the matching documents. + /// Because scoring is ignored, a score of 0 is returned for all documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(params System.Action>[] actions) { - MustNotValue = null; - MustNotDescriptor = null; - MustNotDescriptorActions = null; - MustNotDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public BoolQueryDescriptor MustNot(params Action>[] configure) - { - MustNotValue = null; - MustNotDescriptor = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = configure; - return Self; + Instance.MustNot = items; + return this; } - public BoolQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -283,210 +362,72 @@ public BoolQueryDescriptor QueryName(string? queryName) /// The clause (query) should appear in the matching document. /// /// - public BoolQueryDescriptor Should(ICollection? should) - { - ShouldDescriptor = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = null; - ShouldValue = should; - return Self; - } - - public BoolQueryDescriptor Should(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(System.Collections.Generic.ICollection? value) { - ShouldValue = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = null; - ShouldDescriptor = descriptor; - return Self; + Instance.Should = value; + return this; } - public BoolQueryDescriptor Should(Action> configure) - { - ShouldValue = null; - ShouldDescriptor = null; - ShouldDescriptorActions = null; - ShouldDescriptorAction = configure; - return Self; - } - - public BoolQueryDescriptor Should(params Action>[] configure) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - ShouldValue = null; - ShouldDescriptor = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = configure; - return Self; + Instance.Should = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(params System.Action>[] actions) { - writer.WriteStartObject(); - if (BoostValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MustDescriptor is not null) - { - writer.WritePropertyName("must"); - JsonSerializer.Serialize(writer, MustDescriptor, options); - } - else if (MustDescriptorAction is not null) - { - writer.WritePropertyName("must"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MustDescriptorAction), options); - } - else if (MustDescriptorActions is not null) - { - writer.WritePropertyName("must"); - if (MustDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MustDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (MustDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MustValue is not null) - { - writer.WritePropertyName("must"); - SingleOrManySerializationHelper.Serialize(MustValue, writer, options); - } - - if (MustNotDescriptor is not null) - { - writer.WritePropertyName("must_not"); - JsonSerializer.Serialize(writer, MustNotDescriptor, options); - } - else if (MustNotDescriptorAction is not null) - { - writer.WritePropertyName("must_not"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MustNotDescriptorAction), options); - } - else if (MustNotDescriptorActions is not null) - { - writer.WritePropertyName("must_not"); - if (MustNotDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MustNotDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (MustNotDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MustNotValue is not null) - { - writer.WritePropertyName("must_not"); - SingleOrManySerializationHelper.Serialize(MustNotValue, writer, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ShouldDescriptor is not null) - { - writer.WritePropertyName("should"); - JsonSerializer.Serialize(writer, ShouldDescriptor, options); - } - else if (ShouldDescriptorAction is not null) - { - writer.WritePropertyName("should"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(ShouldDescriptorAction), options); - } - else if (ShouldDescriptorActions is not null) - { - writer.WritePropertyName("should"); - if (ShouldDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in ShouldDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } + Instance.Should = items; + return this; + } - if (ShouldDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (ShouldValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("should"); - SingleOrManySerializationHelper.Serialize(ShouldValue, writer, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class BoolQueryDescriptor : SerializableDescriptor +public readonly partial struct BoolQueryDescriptor { - internal BoolQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery Instance { get; init; } - public BoolQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoolQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private ICollection? MustValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MustDescriptor { get; set; } - private Action MustDescriptorAction { get; set; } - private Action[] MustDescriptorActions { get; set; } - private ICollection? MustNotValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MustNotDescriptor { get; set; } - private Action MustNotDescriptorAction { get; set; } - private Action[] MustNotDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } - private ICollection? ShouldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ShouldDescriptor { get; set; } - private Action ShouldDescriptorAction { get; set; } - private Action[] ShouldDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoolQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -496,10 +437,10 @@ public BoolQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public BoolQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -508,40 +449,58 @@ public BoolQueryDescriptor Boost(float? boost) /// However, unlike must, the score of the query will be ignored. /// /// - public BoolQueryDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public BoolQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The clause (query) must appear in matching documents. + /// However, unlike must, the score of the query will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public BoolQueryDescriptor Filter(Action configure) + /// + /// + /// The clause (query) must appear in matching documents. + /// However, unlike must, the score of the query will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public BoolQueryDescriptor Filter(params Action[] configure) + /// + /// + /// The clause (query) must appear in matching documents. + /// However, unlike must, the score of the query will be ignored. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -549,10 +508,10 @@ public BoolQueryDescriptor Filter(params Actionshould clauses returned documents must match. /// /// - public BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -560,40 +519,55 @@ public BoolQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.Mini /// The clause (query) must appear in matching documents and will contribute to the score. /// /// - public BoolQueryDescriptor Must(ICollection? must) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(System.Collections.Generic.ICollection? value) { - MustDescriptor = null; - MustDescriptorAction = null; - MustDescriptorActions = null; - MustValue = must; - return Self; + Instance.Must = value; + return this; } - public BoolQueryDescriptor Must(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// The clause (query) must appear in matching documents and will contribute to the score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - MustValue = null; - MustDescriptorAction = null; - MustDescriptorActions = null; - MustDescriptor = descriptor; - return Self; + Instance.Must = [.. values]; + return this; } - public BoolQueryDescriptor Must(Action configure) + /// + /// + /// The clause (query) must appear in matching documents and will contribute to the score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(params System.Action[] actions) { - MustValue = null; - MustDescriptor = null; - MustDescriptorActions = null; - MustDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Must = items; + return this; } - public BoolQueryDescriptor Must(params Action[] configure) + /// + /// + /// The clause (query) must appear in matching documents and will contribute to the score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Must(params System.Action>[] actions) { - MustValue = null; - MustDescriptor = null; - MustDescriptorAction = null; - MustDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Must = items; + return this; } /// @@ -602,226 +576,132 @@ public BoolQueryDescriptor Must(params Action0 is returned for all documents. /// /// - public BoolQueryDescriptor MustNot(ICollection? mustNot) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(System.Collections.Generic.ICollection? value) { - MustNotDescriptor = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = null; - MustNotValue = mustNot; - return Self; + Instance.MustNot = value; + return this; } - public BoolQueryDescriptor MustNot(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - MustNotValue = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = null; - MustNotDescriptor = descriptor; - return Self; - } - - public BoolQueryDescriptor MustNot(Action configure) + /// + /// + /// The clause (query) must not appear in the matching documents. + /// Because scoring is ignored, a score of 0 is returned for all documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - MustNotValue = null; - MustNotDescriptor = null; - MustNotDescriptorActions = null; - MustNotDescriptorAction = configure; - return Self; + Instance.MustNot = [.. values]; + return this; } - public BoolQueryDescriptor MustNot(params Action[] configure) + /// + /// + /// The clause (query) must not appear in the matching documents. + /// Because scoring is ignored, a score of 0 is returned for all documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(params System.Action[] actions) { - MustNotValue = null; - MustNotDescriptor = null; - MustNotDescriptorAction = null; - MustNotDescriptorActions = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public BoolQueryDescriptor QueryName(string? queryName) - { - QueryNameValue = queryName; - return Self; + Instance.MustNot = items; + return this; } /// /// - /// The clause (query) should appear in the matching document. + /// The clause (query) must not appear in the matching documents. + /// Because scoring is ignored, a score of 0 is returned for all documents. /// /// - public BoolQueryDescriptor Should(ICollection? should) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor MustNot(params System.Action>[] actions) { - ShouldDescriptor = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = null; - ShouldValue = should; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.MustNot = items; + return this; } - public BoolQueryDescriptor Should(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor QueryName(string? value) { - ShouldValue = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = null; - ShouldDescriptor = descriptor; - return Self; + Instance.QueryName = value; + return this; } - public BoolQueryDescriptor Should(Action configure) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(System.Collections.Generic.ICollection? value) { - ShouldValue = null; - ShouldDescriptor = null; - ShouldDescriptorActions = null; - ShouldDescriptorAction = configure; - return Self; + Instance.Should = value; + return this; } - public BoolQueryDescriptor Should(params Action[] configure) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - ShouldValue = null; - ShouldDescriptor = null; - ShouldDescriptorAction = null; - ShouldDescriptorActions = configure; - return Self; + Instance.Should = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(params System.Action[] actions) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MustDescriptor is not null) - { - writer.WritePropertyName("must"); - JsonSerializer.Serialize(writer, MustDescriptor, options); - } - else if (MustDescriptorAction is not null) - { - writer.WritePropertyName("must"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MustDescriptorAction), options); - } - else if (MustDescriptorActions is not null) - { - writer.WritePropertyName("must"); - if (MustDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MustDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (MustDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MustValue is not null) - { - writer.WritePropertyName("must"); - SingleOrManySerializationHelper.Serialize(MustValue, writer, options); - } - - if (MustNotDescriptor is not null) - { - writer.WritePropertyName("must_not"); - JsonSerializer.Serialize(writer, MustNotDescriptor, options); - } - else if (MustNotDescriptorAction is not null) - { - writer.WritePropertyName("must_not"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MustNotDescriptorAction), options); - } - else if (MustNotDescriptorActions is not null) - { - writer.WritePropertyName("must_not"); - if (MustNotDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in MustNotDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (MustNotDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (MustNotValue is not null) - { - writer.WritePropertyName("must_not"); - SingleOrManySerializationHelper.Serialize(MustNotValue, writer, options); - } + Instance.Should = items; + return this; + } - if (!string.IsNullOrEmpty(QueryNameValue)) + /// + /// + /// The clause (query) should appear in the matching document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor Should(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); } - if (ShouldDescriptor is not null) - { - writer.WritePropertyName("should"); - JsonSerializer.Serialize(writer, ShouldDescriptor, options); - } - else if (ShouldDescriptorAction is not null) - { - writer.WritePropertyName("should"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(ShouldDescriptorAction), options); - } - else if (ShouldDescriptorActions is not null) - { - writer.WritePropertyName("should"); - if (ShouldDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in ShouldDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } + Instance.Should = items; + return this; + } - if (ShouldDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (ShouldValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("should"); - SingleOrManySerializationHelper.Serialize(ShouldValue, writer, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoostingQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoostingQuery.g.cs index a88e559cafb..cd734f376ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoostingQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoostingQuery.g.cs @@ -17,18 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class BoostingQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropNegative = System.Text.Json.JsonEncodedText.Encode("negative"); + private static readonly System.Text.Json.JsonEncodedText PropNegativeBoost = System.Text.Json.JsonEncodedText.Encode("negative_boost"); + private static readonly System.Text.Json.JsonEncodedText PropPositive = System.Text.Json.JsonEncodedText.Encode("positive"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propNegative = default; + LocalJsonValue propNegativeBoost = default; + LocalJsonValue propPositive = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propNegative.TryReadProperty(ref reader, options, PropNegative, null)) + { + continue; + } + + if (propNegativeBoost.TryReadProperty(ref reader, options, PropNegativeBoost, null)) + { + continue; + } + + if (propPositive.TryReadProperty(ref reader, options, PropPositive, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Negative = propNegative.Value, + NegativeBoost = propNegativeBoost.Value, + Positive = propPositive.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropNegative, value.Negative, null, null); + writer.WriteProperty(options, PropNegativeBoost, value.NegativeBoost, null, null); + writer.WriteProperty(options, PropPositive, value.Positive, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryConverter))] public sealed partial class BoostingQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoostingQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query negative, double negativeBoost, Elastic.Clients.Elasticsearch.QueryDsl.Query positive) + { + Negative = negative; + NegativeBoost = negativeBoost; + Positive = positive; + } +#if NET7_0_OR_GREATER + public BoostingQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BoostingQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +133,6 @@ public sealed partial class BoostingQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,47 +140,54 @@ public sealed partial class BoostingQuery /// Query used to decrease the relevance score of matching documents. /// /// - [JsonInclude, JsonPropertyName("negative")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Negative { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Negative { get; set; } /// /// /// Floating point number between 0 and 1.0 used to decrease the relevance scores of documents matching the negative query. /// /// - [JsonInclude, JsonPropertyName("negative_boost")] - public double NegativeBoost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double NegativeBoost { get; set; } /// /// /// Any returned documents must match this query. /// /// - [JsonInclude, JsonPropertyName("positive")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Positive { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Positive { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(BoostingQuery boostingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Boosting(boostingQuery); } -public sealed partial class BoostingQueryDescriptor : SerializableDescriptor> +public readonly partial struct BoostingQueryDescriptor { - internal BoostingQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery Instance { get; init; } - public BoostingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoostingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query NegativeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor NegativeDescriptor { get; set; } - private Action> NegativeDescriptorAction { get; set; } - private double NegativeBoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query PositiveValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PositiveDescriptor { get; set; } - private Action> PositiveDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoostingQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -95,10 +197,10 @@ public BoostingQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public BoostingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -106,28 +208,21 @@ public BoostingQueryDescriptor Boost(float? boost) /// Query used to decrease the relevance score of matching documents. /// /// - public BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.Query negative) - { - NegativeDescriptor = null; - NegativeDescriptorAction = null; - NegativeValue = negative; - return Self; - } - - public BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - NegativeValue = null; - NegativeDescriptorAction = null; - NegativeDescriptor = descriptor; - return Self; + Instance.Negative = value; + return this; } - public BoostingQueryDescriptor Negative(Action> configure) + /// + /// + /// Query used to decrease the relevance score of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Negative(System.Action> action) { - NegativeValue = null; - NegativeDescriptor = null; - NegativeDescriptorAction = configure; - return Self; + Instance.Negative = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -135,10 +230,10 @@ public BoostingQueryDescriptor Negative(Actionnegative query. /// /// - public BoostingQueryDescriptor NegativeBoost(double negativeBoost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor NegativeBoost(double value) { - NegativeBoostValue = negativeBoost; - return Self; + Instance.NegativeBoost = value; + return this; } /// @@ -146,106 +241,56 @@ public BoostingQueryDescriptor NegativeBoost(double negativeBoost) /// Any returned documents must match this query. /// /// - public BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.Query positive) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - PositiveDescriptor = null; - PositiveDescriptorAction = null; - PositiveValue = positive; - return Self; + Instance.Positive = value; + return this; } - public BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Any returned documents must match this query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Positive(System.Action> action) { - PositiveValue = null; - PositiveDescriptorAction = null; - PositiveDescriptor = descriptor; - return Self; + Instance.Positive = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public BoostingQueryDescriptor Positive(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor QueryName(string? value) { - PositiveValue = null; - PositiveDescriptor = null; - PositiveDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public BoostingQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (NegativeDescriptor is not null) - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, NegativeDescriptor, options); - } - else if (NegativeDescriptorAction is not null) - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(NegativeDescriptorAction), options); - } - else - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, NegativeValue, options); - } - - writer.WritePropertyName("negative_boost"); - writer.WriteNumberValue(NegativeBoostValue); - if (PositiveDescriptor is not null) - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, PositiveDescriptor, options); - } - else if (PositiveDescriptorAction is not null) - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PositiveDescriptorAction), options); - } - else - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, PositiveValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class BoostingQueryDescriptor : SerializableDescriptor +public readonly partial struct BoostingQueryDescriptor { - internal BoostingQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoostingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery instance) + { + Instance = instance; + } - public BoostingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BoostingQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query NegativeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor NegativeDescriptor { get; set; } - private Action NegativeDescriptorAction { get; set; } - private double NegativeBoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query PositiveValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor PositiveDescriptor { get; set; } - private Action PositiveDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -255,10 +300,10 @@ public BoostingQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public BoostingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -266,28 +311,32 @@ public BoostingQueryDescriptor Boost(float? boost) /// Query used to decrease the relevance score of matching documents. /// /// - public BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.Query negative) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - NegativeDescriptor = null; - NegativeDescriptorAction = null; - NegativeValue = negative; - return Self; + Instance.Negative = value; + return this; } - public BoostingQueryDescriptor Negative(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to decrease the relevance score of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Negative(System.Action action) { - NegativeValue = null; - NegativeDescriptorAction = null; - NegativeDescriptor = descriptor; - return Self; + Instance.Negative = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public BoostingQueryDescriptor Negative(Action configure) + /// + /// + /// Query used to decrease the relevance score of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Negative(System.Action> action) { - NegativeValue = null; - NegativeDescriptor = null; - NegativeDescriptorAction = configure; - return Self; + Instance.Negative = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -295,10 +344,10 @@ public BoostingQueryDescriptor Negative(Actionnegative query. /// /// - public BoostingQueryDescriptor NegativeBoost(double negativeBoost) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor NegativeBoost(double value) { - NegativeBoostValue = negativeBoost; - return Self; + Instance.NegativeBoost = value; + return this; } /// @@ -306,85 +355,45 @@ public BoostingQueryDescriptor NegativeBoost(double negativeBoost) /// Any returned documents must match this query. /// /// - public BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.Query positive) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - PositiveDescriptor = null; - PositiveDescriptorAction = null; - PositiveValue = positive; - return Self; + Instance.Positive = value; + return this; } - public BoostingQueryDescriptor Positive(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Any returned documents must match this query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Positive(System.Action action) { - PositiveValue = null; - PositiveDescriptorAction = null; - PositiveDescriptor = descriptor; - return Self; + Instance.Positive = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public BoostingQueryDescriptor Positive(Action configure) + /// + /// + /// Any returned documents must match this query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor Positive(System.Action> action) { - PositiveValue = null; - PositiveDescriptor = null; - PositiveDescriptorAction = configure; - return Self; + Instance.Positive = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public BoostingQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (NegativeDescriptor is not null) - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, NegativeDescriptor, options); - } - else if (NegativeDescriptorAction is not null) - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(NegativeDescriptorAction), options); - } - else - { - writer.WritePropertyName("negative"); - JsonSerializer.Serialize(writer, NegativeValue, options); - } - - writer.WritePropertyName("negative_boost"); - writer.WriteNumberValue(NegativeBoostValue); - if (PositiveDescriptor is not null) - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, PositiveDescriptor, options); - } - else if (PositiveDescriptorAction is not null) - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(PositiveDescriptorAction), options); - } - else - { - writer.WritePropertyName("positive"); - JsonSerializer.Serialize(writer, PositiveValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CombinedFieldsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CombinedFieldsQuery.g.cs index 387ff96f3a0..3df02392259 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CombinedFieldsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CombinedFieldsQuery.g.cs @@ -17,24 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class CombinedFieldsQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAutoGenerateSynonymsPhraseQuery = System.Text.Json.JsonEncodedText.Encode("auto_generate_synonyms_phrase_query"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropOperator = System.Text.Json.JsonEncodedText.Encode("operator"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropZeroTermsQuery = System.Text.Json.JsonEncodedText.Encode("zero_terms_query"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAutoGenerateSynonymsPhraseQuery = default; + LocalJsonValue propBoost = default; + LocalJsonValue propFields = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propOperator = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propZeroTermsQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAutoGenerateSynonymsPhraseQuery.TryReadProperty(ref reader, options, PropAutoGenerateSynonymsPhraseQuery, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propOperator.TryReadProperty(ref reader, options, PropOperator, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propZeroTermsQuery.TryReadProperty(ref reader, options, PropZeroTermsQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AutoGenerateSynonymsPhraseQuery = propAutoGenerateSynonymsPhraseQuery.Value, + Boost = propBoost.Value, + Fields = propFields.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Operator = propOperator.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + ZeroTermsQuery = propZeroTermsQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAutoGenerateSynonymsPhraseQuery, value.AutoGenerateSynonymsPhraseQuery, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropOperator, value.Operator, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropZeroTermsQuery, value.ZeroTermsQuery, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryConverter))] public sealed partial class CombinedFieldsQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Fields fields, string query) + { + Fields = fields; + Query = query; + } +#if NET7_0_OR_GREATER + public CombinedFieldsQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CombinedFieldsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - [JsonInclude, JsonPropertyName("auto_generate_synonyms_phrase_query")] public bool? AutoGenerateSynonymsPhraseQuery { get; set; } /// @@ -45,7 +166,6 @@ public sealed partial class CombinedFieldsQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -53,16 +173,17 @@ public sealed partial class CombinedFieldsQuery /// List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(FieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Fields { get; set; } /// /// /// Minimum number of clauses that must match for a document to be returned. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -70,7 +191,6 @@ public sealed partial class CombinedFieldsQuery /// Boolean logic used to interpret text in the query value. /// /// - [JsonInclude, JsonPropertyName("operator")] public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? Operator { get; set; } /// @@ -79,9 +199,11 @@ public sealed partial class CombinedFieldsQuery /// The combined_fields query analyzes the provided text before performing a search. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -89,38 +211,37 @@ public sealed partial class CombinedFieldsQuery /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - [JsonInclude, JsonPropertyName("zero_terms_query")] public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? ZeroTermsQuery { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(CombinedFieldsQuery combinedFieldsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.CombinedFields(combinedFieldsQuery); } -public sealed partial class CombinedFieldsQueryDescriptor : SerializableDescriptor> +public readonly partial struct CombinedFieldsQueryDescriptor { - internal CombinedFieldsQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery Instance { get; init; } - public CombinedFieldsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CombinedFieldsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery instance) { + Instance = instance; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? OperatorValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? ZeroTermsQueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CombinedFieldsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor descriptor) => descriptor.Instance; /// /// /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -131,10 +252,21 @@ public CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery( /// A value greater than 1.0 increases the relevance score. /// /// - public CombinedFieldsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + /// + /// + /// List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) { - BoostValue = boost; - return Self; + Instance.Fields = value; + return this; } /// @@ -142,10 +274,10 @@ public CombinedFieldsQueryDescriptor Boost(float? boost) /// List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer. /// /// - public CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -153,10 +285,10 @@ public CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticse /// Minimum number of clauses that must match for a document to be returned. /// /// - public CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -164,10 +296,10 @@ public CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clien /// Boolean logic used to interpret text in the query value. /// /// - public CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -176,16 +308,16 @@ public CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elastic /// The combined_fields query analyzes the provided text before performing a search. /// /// - public CombinedFieldsQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public CombinedFieldsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -193,85 +325,49 @@ public CombinedFieldsQueryDescriptor QueryName(string? queryName) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public CombinedFieldsQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class CombinedFieldsQueryDescriptor : SerializableDescriptor +public readonly partial struct CombinedFieldsQueryDescriptor { - internal CombinedFieldsQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CombinedFieldsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery instance) + { + Instance = instance; + } - public CombinedFieldsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CombinedFieldsQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? OperatorValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor descriptor) => descriptor.Instance; /// /// /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -282,10 +378,21 @@ public CombinedFieldsQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoG /// A value greater than 1.0 increases the relevance score. /// /// - public CombinedFieldsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + /// + /// + /// List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) { - BoostValue = boost; - return Self; + Instance.Fields = value; + return this; } /// @@ -293,10 +400,10 @@ public CombinedFieldsQueryDescriptor Boost(float? boost) /// List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer. /// /// - public CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -304,10 +411,10 @@ public CombinedFieldsQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields /// Minimum number of clauses that must match for a document to be returned. /// /// - public CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -315,10 +422,10 @@ public CombinedFieldsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elastics /// Boolean logic used to interpret text in the query value. /// /// - public CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsOperator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -327,16 +434,16 @@ public CombinedFieldsQueryDescriptor Operator(Elastic.Clients.Elasticsearch.Quer /// The combined_fields query analyzes the provided text before performing a search. /// /// - public CombinedFieldsQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public CombinedFieldsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -344,55 +451,17 @@ public CombinedFieldsQueryDescriptor QueryName(string? queryName) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public CombinedFieldsQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsZeroTerms? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery Build(System.Action action) { - writer.WriteStartObject(); - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CommonTermsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CommonTermsQuery.g.cs new file mode 100644 index 00000000000..e1516f81024 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/CommonTermsQuery.g.cs @@ -0,0 +1,394 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class CommonTermsQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCutoffFrequency = System.Text.Json.JsonEncodedText.Encode("cutoff_frequency"); + private static readonly System.Text.Json.JsonEncodedText PropHighFreqOperator = System.Text.Json.JsonEncodedText.Encode("high_freq_operator"); + private static readonly System.Text.Json.JsonEncodedText PropLowFreqOperator = System.Text.Json.JsonEncodedText.Encode("low_freq_operator"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + reader.Read(); + propField.ReadPropertyName(ref reader, options, null); + reader.Read(); + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Query = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCutoffFrequency = default; + LocalJsonValue propHighFreqOperator = default; + LocalJsonValue propLowFreqOperator = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCutoffFrequency.TryReadProperty(ref reader, options, PropCutoffFrequency, null)) + { + continue; + } + + if (propHighFreqOperator.TryReadProperty(ref reader, options, PropHighFreqOperator, null)) + { + continue; + } + + if (propLowFreqOperator.TryReadProperty(ref reader, options, PropLowFreqOperator, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + CutoffFrequency = propCutoffFrequency.Value, + Field = propField.Value, + HighFreqOperator = propHighFreqOperator.Value, + LowFreqOperator = propLowFreqOperator.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCutoffFrequency, value.CutoffFrequency, null, null); + writer.WriteProperty(options, PropHighFreqOperator, value.HighFreqOperator, null, null); + writer.WriteProperty(options, PropLowFreqOperator, value.LowFreqOperator, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryConverter))] +public sealed partial class CommonTermsQuery +{ + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CommonTermsQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonTermsQuery(Elastic.Clients.Elasticsearch.Field field, string query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public CommonTermsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Analyzer { get; set; } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public double? CutoffFrequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Operator? HighFreqOperator { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.Operator? LowFreqOperator { get; set; } + public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } + public string? QueryName { get; set; } +} + +public readonly partial struct CommonTermsQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonTermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonTermsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor CutoffFrequency(double? value) + { + Instance.CutoffFrequency = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor HighFreqOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.HighFreqOperator = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor LowFreqOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.LowFreqOperator = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) + { + Instance.MinimumShouldMatch = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Query(string value) + { + Instance.Query = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct CommonTermsQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonTermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CommonTermsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Analyzer(string? value) + { + Instance.Analyzer = value; + return this; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor CutoffFrequency(double? value) + { + Instance.CutoffFrequency = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor HighFreqOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.HighFreqOperator = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor LowFreqOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.LowFreqOperator = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) + { + Instance.MinimumShouldMatch = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor Query(string value) + { + Instance.Query = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ConstantScoreQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ConstantScoreQuery.g.cs index 2c41c2aefd3..165fc90fdf5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ConstantScoreQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ConstantScoreQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ConstantScoreQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFilter = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Filter = propFilter.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryConverter))] public sealed partial class ConstantScoreQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query filter) + { + Filter = filter; + } +#if NET7_0_OR_GREATER + public ConstantScoreQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ConstantScoreQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +113,6 @@ public sealed partial class ConstantScoreQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -47,27 +122,32 @@ public sealed partial class ConstantScoreQuery /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. /// /// - [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Filter { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Filter { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ConstantScoreQuery constantScoreQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.ConstantScore(constantScoreQuery); } -public sealed partial class ConstantScoreQueryDescriptor : SerializableDescriptor> +public readonly partial struct ConstantScoreQueryDescriptor { - internal ConstantScoreQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery instance) + { + Instance = instance; + } - public ConstantScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantScoreQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -77,10 +157,10 @@ public ConstantScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ConstantScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -90,84 +170,58 @@ public ConstantScoreQueryDescriptor Boost(float? boost) /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. /// /// - public ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query filter) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter query you wish to run. Any returned documents must match this query. + /// Filter queries do not calculate relevance scores. + /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ConstantScoreQueryDescriptor Filter(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor QueryName(string? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public ConstantScoreQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ConstantScoreQueryDescriptor : SerializableDescriptor +public readonly partial struct ConstantScoreQueryDescriptor { - internal ConstantScoreQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery instance) + { + Instance = instance; + } - public ConstantScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ConstantScoreQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -177,10 +231,10 @@ public ConstantScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ConstantScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -190,67 +244,49 @@ public ConstantScoreQueryDescriptor Boost(float? boost) /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. /// /// - public ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query filter) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public ConstantScoreQueryDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Filter query you wish to run. Any returned documents must match this query. + /// Filter queries do not calculate relevance scores. + /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ConstantScoreQueryDescriptor Filter(Action configure) + /// + /// + /// Filter query you wish to run. Any returned documents must match this query. + /// Filter queries do not calculate relevance scores. + /// To speed up performance, Elasticsearch automatically caches frequently used filter queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ConstantScoreQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDecayFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDecayFunction.g.cs index 2694b98502b..159f96c5fea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDecayFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDecayFunction.g.cs @@ -17,72 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class DateDecayFunctionConverter : JsonConverter +internal sealed partial class DateDecayFunctionConverter : System.Text.Json.Serialization.JsonConverter { - public override DateDecayFunction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new DateDecayFunction(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var property = reader.GetString(); - if (property == "multi_value_mode") - { - variant.MultiValueMode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Placement = JsonSerializer.Deserialize>(ref reader, options); - } - } - - return variant; - } + private static readonly System.Text.Json.JsonEncodedText PropMultiValueMode = System.Text.Json.JsonEncodedText.Encode("multi_value_mode"); - public override void Write(Utf8JsonWriter writer, DateDecayFunction value, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - writer.WriteStartObject(); - if (value.Field is not null && value.Placement is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMultiValueMode = default; + LocalJsonValue> propPlacement = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (!options.TryGetClientSettings(out var settings)) + if (propMultiValueMode.TryReadProperty(ref reader, options, PropMultiValueMode, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Placement, options); + propField.Initialized = propPlacement.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propPlacement.Value, null, null); } - if (value.MultiValueMode is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, value.MultiValueMode, options); - } + Field = propField.Value, + MultiValueMode = propMultiValueMode.Value, + Placement = propPlacement.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMultiValueMode, value.MultiValueMode, null, null); + writer.WriteProperty(options, value.Field, value.Placement, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(DateDecayFunctionConverter))] -public sealed partial class DateDecayFunction +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionConverter))] +public sealed partial class DateDecayFunction : Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction { - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDecayFunction(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + { + Field = field; + Placement = placement; + } +#if NET7_0_OR_GREATER + public DateDecayFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateDecayFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -90,37 +100,44 @@ public sealed partial class DateDecayFunction /// /// public Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueMode { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction.Type => "date"; } -public sealed partial class DateDecayFunctionDescriptor : SerializableDescriptor> +public readonly partial struct DateDecayFunctionDescriptor { - internal DateDecayFunctionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction Instance { get; init; } - public DateDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public DateDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DateDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DateDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -128,66 +145,68 @@ public DateDecayFunctionDescriptor Field(Expression /// - public DateDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public DateDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateDecayFunctionDescriptor : SerializableDescriptor +public readonly partial struct DateDecayFunctionDescriptor { - internal DateDecayFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction Instance { get; init; } - public DateDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public DateDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public DateDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DateDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -195,34 +214,35 @@ public DateDecayFunctionDescriptor Field(Expression /// - public DateDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public DateDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDistanceFeatureQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDistanceFeatureQuery.g.cs index bfa49e3ec4b..f162df44c42 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDistanceFeatureQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateDistanceFeatureQuery.g.cs @@ -17,18 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class DateDistanceFeatureQuery +internal sealed partial class DateDistanceFeatureQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropOrigin = System.Text.Json.JsonEncodedText.Encode("origin"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propOrigin = default; + LocalJsonValue propPivot = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propOrigin.TryReadProperty(ref reader, options, PropOrigin, null)) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Origin = propOrigin.Value, + Pivot = propPivot.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropOrigin, value.Origin, null, null); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryConverter))] +public sealed partial class DateDistanceFeatureQuery : Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.DateMath origin, Elastic.Clients.Elasticsearch.Duration pivot) + { + Field = field; + Origin = origin; + Pivot = pivot; + } +#if NET7_0_OR_GREATER + public DateDistanceFeatureQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateDistanceFeatureQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +133,6 @@ public sealed partial class DateDistanceFeatureQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -48,8 +143,11 @@ public sealed partial class DateDistanceFeatureQuery /// have an doc_values mapping parameter value of true, which is the default. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -59,8 +157,11 @@ public sealed partial class DateDistanceFeatureQuery /// If the field value is a geo_point field, the origin value must be a geopoint. /// /// - [JsonInclude, JsonPropertyName("origin")] - public Elastic.Clients.Elasticsearch.DateMath Origin { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.DateMath Origin { get; set; } /// /// @@ -68,25 +169,34 @@ public sealed partial class DateDistanceFeatureQuery /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - [JsonInclude, JsonPropertyName("pivot")] - public Elastic.Clients.Elasticsearch.Duration Pivot { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration Pivot { get; set; } public string? QueryName { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery.Type => "date"; } -public sealed partial class DateDistanceFeatureQueryDescriptor : SerializableDescriptor> +public readonly partial struct DateDistanceFeatureQueryDescriptor { - internal DateDistanceFeatureQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery Instance { get; init; } - public DateDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath OriginValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration PivotValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDistanceFeatureQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,10 +206,10 @@ public DateDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DateDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -110,10 +220,10 @@ public DateDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -124,24 +234,10 @@ public DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elast /// have an doc_values mapping parameter value of true, which is the default. /// /// - public DateDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - /// - /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. - /// - /// - public DateDistanceFeatureQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -152,10 +248,10 @@ public DateDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.DateMath origin) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.DateMath value) { - OriginValue = origin; - return Self; + Instance.Origin = value; + return this; } /// @@ -164,56 +260,45 @@ public DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elas /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public DateDistanceFeatureQueryDescriptor Pivot(Elastic.Clients.Elasticsearch.Duration pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Pivot(Elastic.Clients.Elasticsearch.Duration value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public DateDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateDistanceFeatureQueryDescriptor : SerializableDescriptor +public readonly partial struct DateDistanceFeatureQueryDescriptor { - internal DateDistanceFeatureQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery Instance { get; init; } - public DateDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath OriginValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration PivotValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateDistanceFeatureQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -223,10 +308,10 @@ public DateDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DateDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -237,10 +322,10 @@ public DateDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -251,24 +336,10 @@ public DateDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Fi /// have an doc_values mapping parameter value of true, which is the default. /// /// - public DateDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - /// - /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. - /// - /// - public DateDistanceFeatureQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -279,10 +350,10 @@ public DateDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.DateMath origin) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.DateMath value) { - OriginValue = origin; - return Self; + Instance.Origin = value; + return this; } /// @@ -291,39 +362,23 @@ public DateDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.D /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public DateDistanceFeatureQueryDescriptor Pivot(Elastic.Clients.Elasticsearch.Duration pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor Pivot(Elastic.Clients.Elasticsearch.Duration value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public DateDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs index 537b0a37d46..2a390e134a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs @@ -17,168 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class DateRangeQueryConverter : JsonConverter +internal sealed partial class DateRangeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override DateRangeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText PropGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText PropLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText PropLte = System.Text.Json.JsonEncodedText.Encode("lte"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new DateRangeQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFormat = default; + LocalJsonValue propFrom = default; + LocalJsonValue propGt = default; + LocalJsonValue propGte = default; + LocalJsonValue propLt = default; + LocalJsonValue propLte = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRelation = default; + LocalJsonValue propTimeZone = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "format") - { - variant.Format = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gt") - { - variant.Gt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gte") - { - variant.Gte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lt") - { - variant.Lt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lte") - { - variant.Lte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "relation") - { - variant.Relation = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "time_zone") - { - variant.TimeZone = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - reader.Read(); - return variant; - } + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, DateRangeQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize DateRangeQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Format)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(value.Format); - } + if (propGt.TryReadProperty(ref reader, options, PropGt, null)) + { + continue; + } - if (value.Gt is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, value.Gt, options); - } + if (propGte.TryReadProperty(ref reader, options, PropGte, null)) + { + continue; + } - if (value.Gte is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, value.Gte, options); - } + if (propLt.TryReadProperty(ref reader, options, PropLt, null)) + { + continue; + } - if (value.Lt is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, value.Lt, options); - } + if (propLte.TryReadProperty(ref reader, options, PropLte, null)) + { + continue; + } - if (value.Lte is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, value.Lte, options); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } - if (value.Relation is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, value.Relation, options); + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.TimeZone)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(value.TimeZone); - } + Boost = propBoost.Value, + Field = propField.Value, + Format = propFormat.Value, + From = propFrom.Value, + Gt = propGt.Value, + Gte = propGte.Value, + Lt = propLt.Value, + Lte = propLte.Value, + QueryName = propQueryName.Value, + Relation = propRelation.Value, + TimeZone = propTimeZone.Value, + To = propTo.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropGt, value.Gt, null, null); + writer.WriteProperty(options, PropGte, value.Gte, null, null); + writer.WriteProperty(options, PropLt, value.Lt, null, null); + writer.WriteProperty(options, PropLte, value.Lte, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(DateRangeQueryConverter))] -public sealed partial class DateRangeQuery +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryConverter))] +public sealed partial class DateRangeQuery : Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public DateRangeQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } +#if NET7_0_OR_GREATER + public DateRangeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// @@ -189,7 +191,11 @@ public DateRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -197,6 +203,7 @@ public DateRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public string? Format { get; set; } + public Elastic.Clients.Elasticsearch.DateMath? From { get; set; } /// /// @@ -240,26 +247,29 @@ public DateRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public string? TimeZone { get; set; } + public Elastic.Clients.Elasticsearch.DateMath? To { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery.Type => "date"; } -public sealed partial class DateRangeQueryDescriptor : SerializableDescriptor> +public readonly partial struct DateRangeQueryDescriptor { - internal DateRangeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery Instance { get; init; } - public DateRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? GtValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? GteValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? LtValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } - private string? TimeZoneValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -269,28 +279,22 @@ public DateRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DateRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public DateRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DateRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public DateRangeQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -298,10 +302,16 @@ public DateRangeQueryDescriptor Field(Expressiondate values in the query. /// /// - public DateRangeQueryDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Format(string? value) + { + Instance.Format = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor From(Elastic.Clients.Elasticsearch.DateMath? value) { - FormatValue = format; - return Self; + Instance.From = value; + return this; } /// @@ -309,10 +319,10 @@ public DateRangeQueryDescriptor Format(string? format) /// Greater than. /// /// - public DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.DateMath? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.DateMath? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -320,10 +330,10 @@ public DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.Date /// Greater than or equal to. /// /// - public DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.DateMath? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.DateMath? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -331,10 +341,10 @@ public DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.Dat /// Less than. /// /// - public DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.DateMath? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.DateMath? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -342,16 +352,16 @@ public DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.Date /// Less than or equal to. /// /// - public DateRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.DateMath? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.DateMath? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public DateRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -359,10 +369,10 @@ public DateRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -370,96 +380,45 @@ public DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearc /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query to UTC. /// /// - public DateRangeQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor To(Elastic.Clients.Elasticsearch.DateMath? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GtValue is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, GtValue, options); - } - - if (GteValue is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, GteValue, options); - } - - if (LtValue is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, LtValue, options); - } - - if (LteValue is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, LteValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateRangeQueryDescriptor : SerializableDescriptor +public readonly partial struct DateRangeQueryDescriptor { - internal DateRangeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery instance) + { + Instance = instance; + } - public DateRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? GtValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? GteValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? LtValue { get; set; } - private Elastic.Clients.Elasticsearch.DateMath? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -469,28 +428,22 @@ public DateRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DateRangeQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public DateRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public DateRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public DateRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -498,10 +451,16 @@ public DateRangeQueryDescriptor Field(Expressiondate values in the query. /// /// - public DateRangeQueryDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor From(Elastic.Clients.Elasticsearch.DateMath? value) + { + Instance.From = value; + return this; } /// @@ -509,10 +468,10 @@ public DateRangeQueryDescriptor Format(string? format) /// Greater than. /// /// - public DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.DateMath? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.DateMath? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -520,10 +479,10 @@ public DateRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.DateMath? gt) /// Greater than or equal to. /// /// - public DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.DateMath? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.DateMath? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -531,10 +490,10 @@ public DateRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.DateMath? gte) /// Less than. /// /// - public DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.DateMath? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.DateMath? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -542,16 +501,16 @@ public DateRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.DateMath? lt) /// Less than or equal to. /// /// - public DateRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.DateMath? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.DateMath? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public DateRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -559,10 +518,10 @@ public DateRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -570,74 +529,23 @@ public DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl. /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query to UTC. /// /// - public DateRangeQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor To(Elastic.Clients.Elasticsearch.DateMath? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GtValue is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, GtValue, options); - } - - if (GteValue is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, GteValue, options); - } - - if (LtValue is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, LtValue, options); - } - - if (LteValue is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, LteValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayFunction.g.cs new file mode 100644 index 00000000000..ffe3b7efa1d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayFunction.g.cs @@ -0,0 +1,179 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class IDecayFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return reader.ReadValue(options, null); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction v: + writer.WriteValue(options, v, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionConverter))] +public partial interface IDecayFunction +{ + public string Type { get; } +} + +public readonly partial struct IDecayFunctionFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Date(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Geo(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Geo(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Numeric(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Numeric(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Build(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct IDecayFunctionFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Date(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Date(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Geo(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Geo(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Geo(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Numeric(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Numeric(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Numeric(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Untyped(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayPlacement.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayPlacement.g.cs index cd6e15ce644..af918efeb5c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayPlacement.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DecayPlacement.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class DecayPlacementConverter : System.Text.Json.Serialization.JsonConverter> +{ + private static readonly System.Text.Json.JsonEncodedText PropDecay = System.Text.Json.JsonEncodedText.Encode("decay"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + private static readonly System.Text.Json.JsonEncodedText PropOrigin = System.Text.Json.JsonEncodedText.Encode("origin"); + private static readonly System.Text.Json.JsonEncodedText PropScale = System.Text.Json.JsonEncodedText.Encode("scale"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDecay = default; + LocalJsonValue propOffset = default; + LocalJsonValue propOrigin = default; + LocalJsonValue propScale = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDecay.TryReadProperty(ref reader, options, PropDecay, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (propOrigin.TryReadProperty(ref reader, options, PropOrigin, null)) + { + continue; + } + + if (propScale.TryReadProperty(ref reader, options, PropScale, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Decay = propDecay.Value, + Offset = propOffset.Value, + Origin = propOrigin.Value, + Scale = propScale.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDecay, value.Decay, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteProperty(options, PropOrigin, value.Origin, null, null); + writer.WriteProperty(options, PropScale, value.Scale, null, null); + writer.WriteEndObject(); + } +} + +internal sealed partial class DecayPlacementConverterFactory : System.Text.Json.Serialization.JsonConverterFactory +{ + public override bool CanConvert(System.Type typeToConvert) + { + return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(DecayPlacement<,>); + } + + public override System.Text.Json.Serialization.JsonConverter CreateConverter(System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); +#pragma warning disable IL3050 + var converter = (System.Text.Json.Serialization.JsonConverter)System.Activator.CreateInstance(typeof(DecayPlacementConverter<,>).MakeGenericType(args[0], args[1]), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, binder: null, args: null, culture: null)!; +#pragma warning restore IL3050 + return converter; + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementConverterFactory))] public sealed partial class DecayPlacement { +#if NET7_0_OR_GREATER + public DecayPlacement() + { + } +#endif +#if !NET7_0_OR_GREATER + public DecayPlacement() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines how documents are scored at the distance given at scale. /// /// - [JsonInclude, JsonPropertyName("decay")] public double? Decay { get; set; } /// @@ -42,8 +137,6 @@ public sealed partial class DecayPlacement /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined offset. /// /// - [JsonInclude, JsonPropertyName("offset")] - [SourceConverter] public TScale? Offset { get; set; } /// @@ -51,8 +144,6 @@ public sealed partial class DecayPlacement /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. /// /// - [JsonInclude, JsonPropertyName("origin")] - [SourceConverter] public TOrigin? Origin { get; set; } /// @@ -60,7 +151,335 @@ public sealed partial class DecayPlacement /// Defines the distance from origin + offset at which the computed score will equal decay parameter. /// /// - [JsonInclude, JsonPropertyName("scale")] - [SourceConverter] public TScale? Scale { get; set; } +} + +public readonly partial struct DecayPlacementOfDateMathDurationDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfDateMathDurationDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfDateMathDurationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines how documents are scored at the distance given at scale. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor Decay(double? value) + { + Instance.Decay = value; + return this; + } + + /// + /// + /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined offset. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor Offset(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Offset = value; + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor Origin(Elastic.Clients.Elasticsearch.DateMath? value) + { + Instance.Origin = value; + return this; + } + + /// + /// + /// Defines the distance from origin + offset at which the computed score will equal decay parameter. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor Scale(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Scale = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDateMathDurationDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct DecayPlacementOfGeoLocationStringDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfGeoLocationStringDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfGeoLocationStringDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines how documents are scored at the distance given at scale. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Decay(double? value) + { + Instance.Decay = value; + return this; + } + + /// + /// + /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined offset. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Offset(string? value) + { + Instance.Offset = value; + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation? value) + { + Instance.Origin = value; + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Origin() + { + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(null); + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Origin(System.Func? action) + { + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; + } + + /// + /// + /// Defines the distance from origin + offset at which the computed score will equal decay parameter. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor Scale(string? value) + { + Instance.Scale = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct DecayPlacementOfDoubleDoubleDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfDoubleDoubleDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfDoubleDoubleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines how documents are scored at the distance given at scale. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor Decay(double? value) + { + Instance.Decay = value; + return this; + } + + /// + /// + /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined offset. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor Offset(double? value) + { + Instance.Offset = value; + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor Origin(double? value) + { + Instance.Origin = value; + return this; + } + + /// + /// + /// Defines the distance from origin + offset at which the computed score will equal decay parameter. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor Scale(double? value) + { + Instance.Scale = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct DecayPlacementOfObjectObjectDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfObjectObjectDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DecayPlacementOfObjectObjectDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines how documents are scored at the distance given at scale. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor Decay(double? value) + { + Instance.Decay = value; + return this; + } + + /// + /// + /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined offset. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor Offset(object? value) + { + Instance.Offset = value; + return this; + } + + /// + /// + /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor Origin(object? value) + { + Instance.Origin = value; + return this; + } + + /// + /// + /// Defines the distance from origin + offset at which the computed score will equal decay parameter. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor Scale(object? value) + { + Instance.Scale = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DisMaxQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DisMaxQuery.g.cs index 56f0f2a6188..2d406ab452b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DisMaxQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DisMaxQuery.g.cs @@ -17,18 +17,103 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class DisMaxQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueries = System.Text.Json.JsonEncodedText.Encode("queries"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropTieBreaker = System.Text.Json.JsonEncodedText.Encode("tie_breaker"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue> propQueries = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propTieBreaker = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueries.TryReadProperty(ref reader, options, PropQueries, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propTieBreaker.TryReadProperty(ref reader, options, PropTieBreaker, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Queries = propQueries.Value, + QueryName = propQueryName.Value, + TieBreaker = propTieBreaker.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueries, value.Queries, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropTieBreaker, value.TieBreaker, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryConverter))] public sealed partial class DisMaxQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisMaxQuery(System.Collections.Generic.ICollection queries) + { + Queries = queries; + } +#if NET7_0_OR_GREATER + public DisMaxQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DisMaxQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +122,6 @@ public sealed partial class DisMaxQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -47,9 +131,11 @@ public sealed partial class DisMaxQuery /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. /// /// - [JsonInclude, JsonPropertyName("queries")] - public ICollection Queries { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Queries { get; set; } public string? QueryName { get; set; } /// @@ -57,27 +143,27 @@ public sealed partial class DisMaxQuery /// Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses. /// /// - [JsonInclude, JsonPropertyName("tie_breaker")] public double? TieBreaker { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(DisMaxQuery disMaxQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.DisMax(disMaxQuery); } -public sealed partial class DisMaxQueryDescriptor : SerializableDescriptor> +public readonly partial struct DisMaxQueryDescriptor { - internal DisMaxQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisMaxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery instance) + { + Instance = instance; + } - public DisMaxQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisMaxQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private ICollection QueriesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueriesDescriptor { get; set; } - private Action> QueriesDescriptorAction { get; set; } - private Action>[] QueriesDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } - private double? TieBreakerValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -87,10 +173,10 @@ public DisMaxQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DisMaxQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -100,46 +186,48 @@ public DisMaxQueryDescriptor Boost(float? boost) /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. /// /// - public DisMaxQueryDescriptor Queries(ICollection queries) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(System.Collections.Generic.ICollection value) { - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = null; - QueriesValue = queries; - return Self; + Instance.Queries = value; + return this; } - public DisMaxQueryDescriptor Queries(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// One or more query clauses. + /// Returned documents must match one or more of these queries. + /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - QueriesValue = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = null; - QueriesDescriptor = descriptor; - return Self; + Instance.Queries = [.. values]; + return this; } - public DisMaxQueryDescriptor Queries(Action> configure) + /// + /// + /// One or more query clauses. + /// Returned documents must match one or more of these queries. + /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(params System.Action>[] actions) { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorActions = null; - QueriesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public DisMaxQueryDescriptor Queries(params Action>[] configure) - { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = configure; - return Self; + Instance.Queries = items; + return this; } - public DisMaxQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -147,83 +235,39 @@ public DisMaxQueryDescriptor QueryName(string? queryName) /// Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses. /// /// - public DisMaxQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (QueriesDescriptor is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, QueriesDescriptor, options); - writer.WriteEndArray(); - } - else if (QueriesDescriptorAction is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueriesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (QueriesDescriptorActions is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - foreach (var action in QueriesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DisMaxQueryDescriptor : SerializableDescriptor +public readonly partial struct DisMaxQueryDescriptor { - internal DisMaxQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery Instance { get; init; } - public DisMaxQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisMaxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private ICollection QueriesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueriesDescriptor { get; set; } - private Action QueriesDescriptorAction { get; set; } - private Action[] QueriesDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } - private double? TieBreakerValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DisMaxQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -233,10 +277,10 @@ public DisMaxQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public DisMaxQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -246,46 +290,67 @@ public DisMaxQueryDescriptor Boost(float? boost) /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. /// /// - public DisMaxQueryDescriptor Queries(ICollection queries) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(System.Collections.Generic.ICollection value) { - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = null; - QueriesValue = queries; - return Self; + Instance.Queries = value; + return this; } - public DisMaxQueryDescriptor Queries(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// One or more query clauses. + /// Returned documents must match one or more of these queries. + /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - QueriesValue = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = null; - QueriesDescriptor = descriptor; - return Self; + Instance.Queries = [.. values]; + return this; } - public DisMaxQueryDescriptor Queries(Action configure) + /// + /// + /// One or more query clauses. + /// Returned documents must match one or more of these queries. + /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(params System.Action[] actions) { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorActions = null; - QueriesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Queries = items; + return this; } - public DisMaxQueryDescriptor Queries(params Action[] configure) + /// + /// + /// One or more query clauses. + /// Returned documents must match one or more of these queries. + /// If a document matches multiple queries, Elasticsearch uses the highest relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor Queries(params System.Action>[] actions) { - QueriesValue = null; - QueriesDescriptor = null; - QueriesDescriptorAction = null; - QueriesDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Queries = items; + return this; } - public DisMaxQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -293,64 +358,17 @@ public DisMaxQueryDescriptor QueryName(string? queryName) /// Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses. /// /// - public DisMaxQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (QueriesDescriptor is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, QueriesDescriptor, options); - writer.WriteEndArray(); - } - else if (QueriesDescriptorAction is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueriesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (QueriesDescriptorActions is not null) - { - writer.WritePropertyName("queries"); - writer.WriteStartArray(); - foreach (var action in QueriesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("queries"); - JsonSerializer.Serialize(writer, QueriesValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DistanceFeatureQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DistanceFeatureQuery.g.cs new file mode 100644 index 00000000000..e1f2b3fbef0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DistanceFeatureQuery.g.cs @@ -0,0 +1,151 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class IDistanceFeatureQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return reader.ReadValue(options, null); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery v: + writer.WriteValue(options, v, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryConverter))] +public partial interface IDistanceFeatureQuery +{ + public string Type { get; } +} + +public readonly partial struct IDistanceFeatureQueryFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Date(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Geo(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Geo(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Build(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct IDistanceFeatureQueryFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Date(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Date(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Geo(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Geo(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Geo(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Untyped(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs index a2913d4e92e..fca370f3210 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ExistsQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryConverter))] public sealed partial class ExistsQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public ExistsQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ExistsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +113,6 @@ public sealed partial class ExistsQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,28 +120,32 @@ public sealed partial class ExistsQuery /// Name of the field you wish to search. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Exists(existsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Exists(existsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Exists(existsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Exists(existsQuery); } -public sealed partial class ExistsQueryDescriptor : SerializableDescriptor> +public readonly partial struct ExistsQueryDescriptor { - internal ExistsQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery Instance { get; init; } - public ExistsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -76,10 +155,10 @@ public ExistsQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ExistsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -87,10 +166,10 @@ public ExistsQueryDescriptor Boost(float? boost) /// Name of the field you wish to search. /// /// - public ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -98,61 +177,45 @@ public ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// Name of the field you wish to search. /// /// - public ExistsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - /// - /// - /// Name of the field you wish to search. - /// - /// - public ExistsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; + Instance.QueryName = value; + return this; } - public ExistsQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ExistsQueryDescriptor : SerializableDescriptor +public readonly partial struct ExistsQueryDescriptor { - internal ExistsQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery instance) + { + Instance = instance; + } - public ExistsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ExistsQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -162,21 +225,10 @@ public ExistsQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ExistsQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - /// - /// - /// Name of the field you wish to search. - /// - /// - public ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } /// @@ -184,10 +236,10 @@ public ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// Name of the field you wish to search. /// /// - public ExistsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -195,35 +247,23 @@ public ExistsQueryDescriptor Field(Expression /// - public ExistsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ExistsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldAndFormat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldAndFormat.g.cs index 3f01188d339..120f097efd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldAndFormat.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldAndFormat.g.cs @@ -17,39 +17,125 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class FieldAndFormatConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeUnmapped = System.Text.Json.JsonEncodedText.Encode("include_unmapped"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propFormat = default; + LocalJsonValue propIncludeUnmapped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propIncludeUnmapped.TryReadProperty(ref reader, options, PropIncludeUnmapped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Format = propFormat.Value, + IncludeUnmapped = propIncludeUnmapped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropIncludeUnmapped, value.IncludeUnmapped, null, null); + writer.WriteEndObject(); + } +} + /// /// /// A reference to a field with formatting instructions on how to return the value /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatConverter))] public sealed partial class FieldAndFormat { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAndFormat(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public FieldAndFormat() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldAndFormat() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A wildcard pattern. The request returns values for field names matching this pattern. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The format in which the values are returned. /// /// - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("include_unmapped")] public bool? IncludeUnmapped { get; set; } } @@ -58,38 +144,34 @@ public sealed partial class FieldAndFormat /// A reference to a field with formatting instructions on how to return the value /// /// -public sealed partial class FieldAndFormatDescriptor : SerializableDescriptor> +public readonly partial struct FieldAndFormatDescriptor { - internal FieldAndFormatDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat Instance { get; init; } - public FieldAndFormatDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAndFormatDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private bool? IncludeUnmappedValue { get; set; } - - /// - /// - /// A wildcard pattern. The request returns values for field names matching this pattern. - /// - /// - public FieldAndFormatDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAndFormatDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) => descriptor.Instance; + /// /// /// A wildcard pattern. The request returns values for field names matching this pattern. /// /// - public FieldAndFormatDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -97,10 +179,10 @@ public FieldAndFormatDescriptor Field(Expression /// - public FieldAndFormatDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -108,36 +190,24 @@ public FieldAndFormatDescriptor Field(Expression /// - public FieldAndFormatDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public FieldAndFormatDescriptor IncludeUnmapped(bool? includeUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor IncludeUnmapped(bool? value = true) { - IncludeUnmappedValue = includeUnmapped; - return Self; + Instance.IncludeUnmapped = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IncludeUnmappedValue.HasValue) - { - writer.WritePropertyName("include_unmapped"); - writer.WriteBooleanValue(IncludeUnmappedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } @@ -146,38 +216,34 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// A reference to a field with formatting instructions on how to return the value /// /// -public sealed partial class FieldAndFormatDescriptor : SerializableDescriptor +public readonly partial struct FieldAndFormatDescriptor { - internal FieldAndFormatDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat Instance { get; init; } - public FieldAndFormatDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAndFormatDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private bool? IncludeUnmappedValue { get; set; } - - /// - /// - /// A wildcard pattern. The request returns values for field names matching this pattern. - /// - /// - public FieldAndFormatDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldAndFormatDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor descriptor) => descriptor.Instance; + /// /// /// A wildcard pattern. The request returns values for field names matching this pattern. /// /// - public FieldAndFormatDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -185,10 +251,10 @@ public FieldAndFormatDescriptor Field(Expression /// - public FieldAndFormatDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -196,35 +262,23 @@ public FieldAndFormatDescriptor Field(Expression /// - public FieldAndFormatDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public FieldAndFormatDescriptor IncludeUnmapped(bool? includeUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor IncludeUnmapped(bool? value = true) { - IncludeUnmappedValue = includeUnmapped; - return Self; + Instance.IncludeUnmapped = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IncludeUnmappedValue.HasValue) - { - writer.WritePropertyName("include_unmapped"); - writer.WriteBooleanValue(IncludeUnmappedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormatDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldAndFormat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldLookup.g.cs index 157f53f5c02..d601e11c33d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldLookup.g.cs @@ -17,32 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class FieldLookupConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPath = default; + LocalJsonValue propRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Path = propPath.Value, + Routing = propRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupConverter))] public sealed partial class FieldLookup { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldLookup(Elastic.Clients.Elasticsearch.Id id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public FieldLookup() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldLookup() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// id of the document. /// /// - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } /// /// /// Index from which to retrieve the document. /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -50,7 +137,6 @@ public sealed partial class FieldLookup /// Name of the field. /// /// - [JsonInclude, JsonPropertyName("path")] public Elastic.Clients.Elasticsearch.Field? Path { get; set; } /// @@ -58,54 +144,48 @@ public sealed partial class FieldLookup /// Custom routing value. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } } -public sealed partial class FieldLookupDescriptor : SerializableDescriptor> +public readonly partial struct FieldLookupDescriptor { - internal FieldLookupDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup Instance { get; init; } - public FieldLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - - /// - /// - /// id of the document. - /// - /// - public FieldLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldLookupDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) => descriptor.Instance; + /// /// - /// Index from which to retrieve the document. + /// id of the document. /// /// - public FieldLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IndexValue = index; - return Self; + Instance.Id = value; + return this; } /// /// - /// Name of the field. + /// Index from which to retrieve the document. /// /// - public FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - PathValue = path; - return Self; + Instance.Index = value; + return this; } /// @@ -113,10 +193,10 @@ public FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field /// Name of the field. /// /// - public FieldLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -124,10 +204,10 @@ public FieldLookupDescriptor Path(Expression /// - public FieldLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -135,83 +215,60 @@ public FieldLookupDescriptor Path(Expression> /// Custom routing value. /// /// - public FieldLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldLookupDescriptor : SerializableDescriptor +public readonly partial struct FieldLookupDescriptor { - internal FieldLookupDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup Instance { get; init; } - public FieldLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - - /// - /// - /// id of the document. - /// - /// - public FieldLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldLookupDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) => descriptor.Instance; + /// /// - /// Index from which to retrieve the document. + /// id of the document. /// /// - public FieldLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IndexValue = index; - return Self; + Instance.Id = value; + return this; } /// /// - /// Name of the field. + /// Index from which to retrieve the document. /// /// - public FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - PathValue = path; - return Self; + Instance.Index = value; + return this; } /// @@ -219,10 +276,10 @@ public FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field? path) /// Name of the field. /// /// - public FieldLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field? value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -230,10 +287,10 @@ public FieldLookupDescriptor Path(Expression /// - public FieldLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -241,35 +298,17 @@ public FieldLookupDescriptor Path(Expression> /// Custom routing value. /// /// - public FieldLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (PathValue is not null) - { - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldValueFactorScoreFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldValueFactorScoreFunction.g.cs index 0e09903ac26..2e81ddb14c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldValueFactorScoreFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FieldValueFactorScoreFunction.g.cs @@ -17,24 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class FieldValueFactorScoreFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFactor = System.Text.Json.JsonEncodedText.Encode("factor"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText PropModifier = System.Text.Json.JsonEncodedText.Encode("modifier"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFactor = default; + LocalJsonValue propField = default; + LocalJsonValue propMissing = default; + LocalJsonValue propModifier = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFactor.TryReadProperty(ref reader, options, PropFactor, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMissing.TryReadProperty(ref reader, options, PropMissing, null)) + { + continue; + } + + if (propModifier.TryReadProperty(ref reader, options, PropModifier, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Factor = propFactor.Value, + Field = propField.Value, + Missing = propMissing.Value, + Modifier = propModifier.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFactor, value.Factor, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMissing, value.Missing, null, null); + writer.WriteProperty(options, PropModifier, value.Modifier, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionConverter))] public sealed partial class FieldValueFactorScoreFunction { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public FieldValueFactorScoreFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldValueFactorScoreFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Optional factor to multiply the field value with. /// /// - [JsonInclude, JsonPropertyName("factor")] public double? Factor { get; set; } /// @@ -42,8 +126,11 @@ public sealed partial class FieldValueFactorScoreFunction /// Field to be extracted from the document. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -51,7 +138,6 @@ public sealed partial class FieldValueFactorScoreFunction /// The modifier and factor are still applied to it as though it were read from the document. /// /// - [JsonInclude, JsonPropertyName("missing")] public double? Missing { get; set; } /// @@ -59,45 +145,37 @@ public sealed partial class FieldValueFactorScoreFunction /// Modifier to apply to the field value. /// /// - [JsonInclude, JsonPropertyName("modifier")] public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? Modifier { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(FieldValueFactorScoreFunction fieldValueFactorScoreFunction) => Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore.FieldValueFactor(fieldValueFactorScoreFunction); } -public sealed partial class FieldValueFactorScoreFunctionDescriptor : SerializableDescriptor> +public readonly partial struct FieldValueFactorScoreFunctionDescriptor { - internal FieldValueFactorScoreFunctionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction Instance { get; init; } - public FieldValueFactorScoreFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldValueFactorScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction instance) { + Instance = instance; } - private double? FactorValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private double? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? ModifierValue { get; set; } - - /// - /// - /// Optional factor to multiply the field value with. - /// - /// - public FieldValueFactorScoreFunctionDescriptor Factor(double? factor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldValueFactorScoreFunctionDescriptor() { - FactorValue = factor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor descriptor) => descriptor.Instance; + /// /// - /// Field to be extracted from the document. + /// Optional factor to multiply the field value with. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Factor(double? value) { - FieldValue = field; - return Self; + Instance.Factor = value; + return this; } /// @@ -105,10 +183,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients. /// Field to be extracted from the document. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -116,10 +194,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Expressi /// Field to be extracted from the document. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -128,10 +206,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Expression /// - public FieldValueFactorScoreFunctionDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -139,72 +217,49 @@ public FieldValueFactorScoreFunctionDescriptor Missing(double? missin /// Modifier to apply to the field value. /// /// - public FieldValueFactorScoreFunctionDescriptor Modifier(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? modifier) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Modifier(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? value) { - ModifierValue = modifier; - return Self; + Instance.Modifier = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction Build(System.Action> action) { - writer.WriteStartObject(); - if (FactorValue.HasValue) - { - writer.WritePropertyName("factor"); - writer.WriteNumberValue(FactorValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (ModifierValue is not null) - { - writer.WritePropertyName("modifier"); - JsonSerializer.Serialize(writer, ModifierValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldValueFactorScoreFunctionDescriptor : SerializableDescriptor +public readonly partial struct FieldValueFactorScoreFunctionDescriptor { - internal FieldValueFactorScoreFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction Instance { get; init; } - public FieldValueFactorScoreFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldValueFactorScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction instance) { + Instance = instance; } - private double? FactorValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private double? MissingValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? ModifierValue { get; set; } - - /// - /// - /// Optional factor to multiply the field value with. - /// - /// - public FieldValueFactorScoreFunctionDescriptor Factor(double? factor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldValueFactorScoreFunctionDescriptor() { - FactorValue = factor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor descriptor) => descriptor.Instance; + /// /// - /// Field to be extracted from the document. + /// Optional factor to multiply the field value with. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Factor(double? value) { - FieldValue = field; - return Self; + Instance.Factor = value; + return this; } /// @@ -212,10 +267,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients.Elasticsear /// Field to be extracted from the document. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -223,10 +278,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Expressi /// Field to be extracted from the document. /// /// - public FieldValueFactorScoreFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -235,10 +290,10 @@ public FieldValueFactorScoreFunctionDescriptor Field(Expression /// - public FieldValueFactorScoreFunctionDescriptor Missing(double? missing) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Missing(double? value) { - MissingValue = missing; - return Self; + Instance.Missing = value; + return this; } /// @@ -246,35 +301,17 @@ public FieldValueFactorScoreFunctionDescriptor Missing(double? missing) /// Modifier to apply to the field value. /// /// - public FieldValueFactorScoreFunctionDescriptor Modifier(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? modifier) + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor Modifier(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorModifier? value) { - ModifierValue = modifier; - return Self; + Instance.Modifier = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction Build(System.Action action) { - writer.WriteStartObject(); - if (FactorValue.HasValue) - { - writer.WritePropertyName("factor"); - writer.WriteNumberValue(FactorValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (MissingValue.HasValue) - { - writer.WritePropertyName("missing"); - writer.WriteNumberValue(MissingValue.Value); - } - - if (ModifierValue is not null) - { - writer.WritePropertyName("modifier"); - JsonSerializer.Serialize(writer, ModifierValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScore.g.cs index 15eea6a6ae2..a6852e96464 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScore.g.cs @@ -17,394 +17,681 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(FunctionScoreConverter))] -public sealed partial class FunctionScore +internal sealed partial class FunctionScoreConverter : System.Text.Json.Serialization.JsonConverter { - internal FunctionScore(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static FunctionScore Exp(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => new FunctionScore("exp", decayFunction); - public static FunctionScore Exp(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => new FunctionScore("exp", decayFunction); - public static FunctionScore Exp(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => new FunctionScore("exp", decayFunction); - public static FunctionScore Exp(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => new FunctionScore("exp", decayFunction); - public static FunctionScore FieldValueFactor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction fieldValueFactorScoreFunction) => new FunctionScore("field_value_factor", fieldValueFactorScoreFunction); - public static FunctionScore Gauss(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => new FunctionScore("gauss", decayFunction); - public static FunctionScore Gauss(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => new FunctionScore("gauss", decayFunction); - public static FunctionScore Gauss(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => new FunctionScore("gauss", decayFunction); - public static FunctionScore Gauss(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => new FunctionScore("gauss", decayFunction); - public static FunctionScore Linear(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => new FunctionScore("linear", decayFunction); - public static FunctionScore Linear(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => new FunctionScore("linear", decayFunction); - public static FunctionScore Linear(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => new FunctionScore("linear", decayFunction); - public static FunctionScore Linear(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => new FunctionScore("linear", decayFunction); - public static FunctionScore RandomScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction randomScoreFunction) => new FunctionScore("random_score", randomScoreFunction); - public static FunctionScore ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction scriptScoreFunction) => new FunctionScore("script_score", scriptScoreFunction); - - [JsonInclude, JsonPropertyName("filter")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } - [JsonInclude, JsonPropertyName("weight")] - public double? Weight { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropWeight = System.Text.Json.JsonEncodedText.Encode("weight"); + private static readonly System.Text.Json.JsonEncodedText VariantExp = System.Text.Json.JsonEncodedText.Encode("exp"); + private static readonly System.Text.Json.JsonEncodedText VariantFieldValueFactor = System.Text.Json.JsonEncodedText.Encode("field_value_factor"); + private static readonly System.Text.Json.JsonEncodedText VariantGauss = System.Text.Json.JsonEncodedText.Encode("gauss"); + private static readonly System.Text.Json.JsonEncodedText VariantLinear = System.Text.Json.JsonEncodedText.Encode("linear"); + private static readonly System.Text.Json.JsonEncodedText VariantRandomScore = System.Text.Json.JsonEncodedText.Encode("random_score"); + private static readonly System.Text.Json.JsonEncodedText VariantScriptScore = System.Text.Json.JsonEncodedText.Encode("script_score"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue propWeight = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class FunctionScoreConverter : JsonConverter -{ - public override FunctionScore Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - Elastic.Clients.Elasticsearch.QueryDsl.Query? filterValue = default; - double? weightValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "filter") + if (propWeight.TryReadProperty(ref reader, options, PropWeight, null)) { - filterValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "weight") + if (reader.ValueTextEquals(VariantExp)) { - weightValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantExp.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "exp") + if (reader.ValueTextEquals(VariantFieldValueFactor)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFieldValueFactor.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "field_value_factor") + if (reader.ValueTextEquals(VariantGauss)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGauss.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "gauss") + if (reader.ValueTextEquals(VariantLinear)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantLinear.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "linear") + if (reader.ValueTextEquals(VariantRandomScore)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRandomScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "random_score") + if (reader.ValueTextEquals(VariantScriptScore)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScriptScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "script_score") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'FunctionScore' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new FunctionScore(variantNameValue, variantValue); - result.Filter = filterValue; - result.Weight = weightValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Filter = propFilter.Value, + Weight = propWeight.Value + }; } - public override void Write(Utf8JsonWriter writer, FunctionScore value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Filter is not null) + switch (value.VariantType) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, value.Filter, options); + case null: + break; + case "exp": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction)value.Variant, null, null); + break; + case "field_value_factor": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction)value.Variant, null, null); + break; + case "gauss": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction)value.Variant, null, null); + break; + case "linear": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction)value.Variant, null, null); + break; + case "random_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction)value.Variant, null, null); + break; + case "script_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore)}'."); } - if (value.Weight.HasValue) - { - writer.WritePropertyName("weight"); - writer.WriteNumberValue(value.Weight.Value); - } + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropWeight, value.Weight, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreConverter))] +public sealed partial class FunctionScore +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public FunctionScore() + { + } +#endif +#if !NET7_0_OR_GREATER + public FunctionScore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? Exp { get => GetVariant("exp"); set => SetVariant("exp", value); } + + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction? FieldValueFactor { get => GetVariant("field_value_factor"); set => SetVariant("field_value_factor", value); } + + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? Gauss { get => GetVariant("gauss"); set => SetVariant("gauss", value); } + + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? Linear { get => GetVariant("linear"); set => SetVariant("linear", value); } + + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction? RandomScore { get => GetVariant("random_score"); set => SetVariant("random_score", value); } + + /// + /// + /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction? ScriptScore { get => GetVariant("script_score"); set => SetVariant("script_score", value); } + public Elastic.Clients.Elasticsearch.QueryDsl.Query? Filter { get; set; } + public double? Weight { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction value) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore { FieldValueFactor = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction value) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore { RandomScore = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction value) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore { ScriptScore = value }; - if (value.VariantName is not null && value.Variant is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "exp": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "field_value_factor": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction)value.Variant, options); - break; - case "gauss": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "linear": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "random_score": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction)value.Variant, options); - break; - case "script_score": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction)value.Variant, options); - break; - } + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class FunctionScoreDescriptor : SerializableDescriptor> +public readonly partial struct FunctionScoreDescriptor { - internal FunctionScoreDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore Instance { get; init; } - public FunctionScoreDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor descriptor) => descriptor.Instance; - private FunctionScoreDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Exp = value; + return this; } - private FunctionScoreDescriptor Set(object variant, string variantName) + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Exp(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Exp = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private double? WeightValue { get; set; } + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FieldValueFactor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction? value) + { + Instance.FieldValueFactor = value; + return this; + } - public FunctionScoreDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FieldValueFactor(System.Action> action) { - FilterValue = filter; - return Self; + Instance.FieldValueFactor = Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor.Build(action); + return this; } - public FunctionScoreDescriptor Weight(double? weight) + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) { - WeightValue = weight; - return Self; + Instance.Gauss = value; + return this; } - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor FieldValueFactor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction fieldValueFactorScoreFunction) => Set(fieldValueFactorScoreFunction, "field_value_factor"); - public FunctionScoreDescriptor FieldValueFactor(Action> configure) => Set(configure, "field_value_factor"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor RandomScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction randomScoreFunction) => Set(randomScoreFunction, "random_score"); - public FunctionScoreDescriptor RandomScore(Action> configure) => Set(configure, "random_score"); - public FunctionScoreDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction scriptScoreFunction) => Set(scriptScoreFunction, "script_score"); - public FunctionScoreDescriptor ScriptScore(Action configure) => Set(configure, "script_score"); + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Gauss(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + Instance.Gauss = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) { - writer.WriteStartObject(); - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + Instance.Linear = value; + return this; + } - if (WeightValue.HasValue) - { - writer.WritePropertyName("weight"); - writer.WriteNumberValue(WeightValue.Value); - } + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Linear(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction? value) + { + Instance.RandomScore = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore() + { + Instance.RandomScore = Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore(System.Action>? action) + { + Instance.RandomScore = Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor.Build(action); + return this; + } + + /// + /// + /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction? value) + { + Instance.ScriptScore = value; + return this; + } + + /// + /// + /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor ScriptScore(System.Action action) + { + Instance.ScriptScore = Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Filter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Weight(double? value) + { + Instance.Weight = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FunctionScoreDescriptor : SerializableDescriptor +public readonly partial struct FunctionScoreDescriptor { - internal FunctionScoreDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore Instance { get; init; } - public FunctionScoreDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor descriptor) => descriptor.Instance; - private FunctionScoreDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Exp = value; + return this; } - private FunctionScoreDescriptor Set(object variant, string variantName) + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Exp(System.Func action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Exp = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? FilterValue { get; set; } - private double? WeightValue { get; set; } + /// + /// + /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Exp(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + Instance.Exp = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } - public FunctionScoreDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? filter) + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FieldValueFactor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction? value) { - FilterValue = filter; - return Self; + Instance.FieldValueFactor = value; + return this; } - public FunctionScoreDescriptor Weight(double? weight) + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FieldValueFactor(System.Action action) { - WeightValue = weight; - return Self; + Instance.FieldValueFactor = Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor.Build(action); + return this; } - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor Exp(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "exp"); - public FunctionScoreDescriptor FieldValueFactor(Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunction fieldValueFactorScoreFunction) => Set(fieldValueFactorScoreFunction, "field_value_factor"); - public FunctionScoreDescriptor FieldValueFactor(Action configure) => Set(configure, "field_value_factor"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "gauss"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction decayFunction) => Set(decayFunction, "linear"); - public FunctionScoreDescriptor RandomScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction randomScoreFunction) => Set(randomScoreFunction, "random_score"); - public FunctionScoreDescriptor RandomScore(Action configure) => Set(configure, "random_score"); - public FunctionScoreDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction scriptScoreFunction) => Set(scriptScoreFunction, "script_score"); - public FunctionScoreDescriptor ScriptScore(Action configure) => Set(configure, "script_score"); + /// + /// + /// Function allows you to use a field from a document to influence the score. + /// It’s similar to using the script_score function, however, it avoids the overhead of scripting. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FieldValueFactor(System.Action> action) + { + Instance.FieldValueFactor = Elastic.Clients.Elasticsearch.QueryDsl.FieldValueFactorScoreFunctionDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Gauss(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) { - writer.WriteStartObject(); - if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } + Instance.Gauss = value; + return this; + } - if (WeightValue.HasValue) - { - writer.WritePropertyName("weight"); - writer.WriteNumberValue(WeightValue.Value); - } + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Gauss(System.Func action) + { + Instance.Gauss = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Gauss(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + Instance.Gauss = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction? value) + { + Instance.Linear = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Linear(System.Func action) + { + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } + + /// + /// + /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Linear(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction> action) + { + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunctionFactory.Build(action); + return this; + } + + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction? value) + { + Instance.RandomScore = value; + return this; + } + + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore() + { + Instance.RandomScore = Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor.Build(null); + return this; + } + + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore(System.Action? action) + { + Instance.RandomScore = Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor.Build(action); + return this; + } + + /// + /// + /// Generates scores that are uniformly distributed from 0 up to but not including 1. + /// In case you want scores to be reproducible, it is possible to provide a seed and field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor RandomScore(System.Action>? action) + { + Instance.RandomScore = Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor.Build(action); + return this; + } + + /// + /// + /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction? value) + { + Instance.ScriptScore = value; + return this; + } + + /// + /// + /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor ScriptScore(System.Action action) + { + Instance.ScriptScore = Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) + { + Instance.Filter = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Filter(System.Action action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor Weight(double? value) + { + Instance.Weight = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScoreQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScoreQuery.g.cs index 0b27f35c415..534056a0ae0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScoreQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FunctionScoreQuery.g.cs @@ -17,18 +17,142 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class FunctionScoreQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropBoostMode = System.Text.Json.JsonEncodedText.Encode("boost_mode"); + private static readonly System.Text.Json.JsonEncodedText PropFunctions = System.Text.Json.JsonEncodedText.Encode("functions"); + private static readonly System.Text.Json.JsonEncodedText PropMaxBoost = System.Text.Json.JsonEncodedText.Encode("max_boost"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScoreMode = System.Text.Json.JsonEncodedText.Encode("score_mode"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue?>(options, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)); + return new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Functions = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propBoostMode = default; + LocalJsonValue?> propFunctions = default; + LocalJsonValue propMaxBoost = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScoreMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propBoostMode.TryReadProperty(ref reader, options, PropBoostMode, null)) + { + continue; + } + + if (propFunctions.TryReadProperty(ref reader, options, PropFunctions, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMaxBoost.TryReadProperty(ref reader, options, PropMaxBoost, null)) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScoreMode.TryReadProperty(ref reader, options, PropScoreMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + BoostMode = propBoostMode.Value, + Functions = propFunctions.Value, + MaxBoost = propMaxBoost.Value, + MinScore = propMinScore.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + ScoreMode = propScoreMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropBoostMode, value.BoostMode, null, null); + writer.WriteProperty(options, PropFunctions, value.Functions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxBoost, value.MaxBoost, null, null); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScoreMode, value.ScoreMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryConverter))] public sealed partial class FunctionScoreQuery { +#if NET7_0_OR_GREATER + public FunctionScoreQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public FunctionScoreQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +161,6 @@ public sealed partial class FunctionScoreQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +168,6 @@ public sealed partial class FunctionScoreQuery /// Defines how he newly computed score is combined with the score of the query /// /// - [JsonInclude, JsonPropertyName("boost_mode")] public Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? BoostMode { get; set; } /// @@ -53,15 +175,13 @@ public sealed partial class FunctionScoreQuery /// One or more functions that compute a new score for each document returned by the query. /// /// - [JsonInclude, JsonPropertyName("functions")] - public ICollection? Functions { get; set; } + public System.Collections.Generic.ICollection? Functions { get; set; } /// /// /// Restricts the new score to not exceed the provided limit. /// /// - [JsonInclude, JsonPropertyName("max_boost")] public double? MaxBoost { get; set; } /// @@ -69,7 +189,6 @@ public sealed partial class FunctionScoreQuery /// Excludes documents that do not meet the provided score threshold. /// /// - [JsonInclude, JsonPropertyName("min_score")] public double? MinScore { get; set; } /// @@ -77,9 +196,7 @@ public sealed partial class FunctionScoreQuery /// A query that determines the documents for which a new score is computed. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -87,33 +204,27 @@ public sealed partial class FunctionScoreQuery /// Specifies how the computed scores are combined /// /// - [JsonInclude, JsonPropertyName("score_mode")] public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? ScoreMode { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(FunctionScoreQuery functionScoreQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.FunctionScore(functionScoreQuery); } -public sealed partial class FunctionScoreQueryDescriptor : SerializableDescriptor> +public readonly partial struct FunctionScoreQueryDescriptor { - internal FunctionScoreQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery instance) + { + Instance = instance; + } - public FunctionScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? BoostModeValue { get; set; } - private ICollection? FunctionsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FunctionsDescriptor { get; set; } - private Action> FunctionsDescriptorAction { get; set; } - private Action>[] FunctionsDescriptorActions { get; set; } - private double? MaxBoostValue { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? ScoreModeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -123,10 +234,10 @@ public FunctionScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public FunctionScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -134,10 +245,10 @@ public FunctionScoreQueryDescriptor Boost(float? boost) /// Defines how he newly computed score is combined with the score of the query /// /// - public FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? boostMode) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? value) { - BoostModeValue = boostMode; - return Self; + Instance.BoostMode = value; + return this; } /// @@ -145,40 +256,38 @@ public FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elastic /// One or more functions that compute a new score for each document returned by the query. /// /// - public FunctionScoreQueryDescriptor Functions(ICollection? functions) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(System.Collections.Generic.ICollection? value) { - FunctionsDescriptor = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = null; - FunctionsValue = functions; - return Self; + Instance.Functions = value; + return this; } - public FunctionScoreQueryDescriptor Functions(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor descriptor) + /// + /// + /// One or more functions that compute a new score for each document returned by the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(params Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore[] values) { - FunctionsValue = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = null; - FunctionsDescriptor = descriptor; - return Self; + Instance.Functions = [.. values]; + return this; } - public FunctionScoreQueryDescriptor Functions(Action> configure) + /// + /// + /// One or more functions that compute a new score for each document returned by the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(params System.Action>[] actions) { - FunctionsValue = null; - FunctionsDescriptor = null; - FunctionsDescriptorActions = null; - FunctionsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor.Build(action)); + } - public FunctionScoreQueryDescriptor Functions(params Action>[] configure) - { - FunctionsValue = null; - FunctionsDescriptor = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = configure; - return Self; + Instance.Functions = items; + return this; } /// @@ -186,10 +295,10 @@ public FunctionScoreQueryDescriptor Functions(params Action /// - public FunctionScoreQueryDescriptor MaxBoost(double? maxBoost) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor MaxBoost(double? value) { - MaxBoostValue = maxBoost; - return Self; + Instance.MaxBoost = value; + return this; } /// @@ -197,10 +306,10 @@ public FunctionScoreQueryDescriptor MaxBoost(double? maxBoost) /// Excludes documents that do not meet the provided score threshold. /// /// - public FunctionScoreQueryDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor MinScore(double? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -208,34 +317,27 @@ public FunctionScoreQueryDescriptor MinScore(double? minScore) /// A query that determines the documents for which a new score is computed. /// /// - public FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public FunctionScoreQueryDescriptor Query(Action> configure) + /// + /// + /// A query that determines the documents for which a new score is computed. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FunctionScoreQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -243,123 +345,44 @@ public FunctionScoreQueryDescriptor QueryName(string? queryName) /// Specifies how the computed scores are combined /// /// - public FunctionScoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery Build(System.Action>? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (BoostModeValue is not null) - { - writer.WritePropertyName("boost_mode"); - JsonSerializer.Serialize(writer, BoostModeValue, options); - } - - if (FunctionsDescriptor is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FunctionsDescriptor, options); - writer.WriteEndArray(); - } - else if (FunctionsDescriptorAction is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(FunctionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FunctionsDescriptorActions is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - foreach (var action in FunctionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FunctionsValue is not null) - { - writer.WritePropertyName("functions"); - JsonSerializer.Serialize(writer, FunctionsValue, options); - } - - if (MaxBoostValue.HasValue) - { - writer.WritePropertyName("max_boost"); - writer.WriteNumberValue(MaxBoostValue.Value); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) + if (action is null) { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FunctionScoreQueryDescriptor : SerializableDescriptor +public readonly partial struct FunctionScoreQueryDescriptor { - internal FunctionScoreQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery Instance { get; init; } - public FunctionScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? BoostModeValue { get; set; } - private ICollection? FunctionsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor FunctionsDescriptor { get; set; } - private Action FunctionsDescriptorAction { get; set; } - private Action[] FunctionsDescriptorActions { get; set; } - private double? MaxBoostValue { get; set; } - private double? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? ScoreModeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FunctionScoreQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -369,10 +392,10 @@ public FunctionScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public FunctionScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -380,10 +403,10 @@ public FunctionScoreQueryDescriptor Boost(float? boost) /// Defines how he newly computed score is combined with the score of the query /// /// - public FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? boostMode) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionBoostMode? value) { - BoostModeValue = boostMode; - return Self; + Instance.BoostMode = value; + return this; } /// @@ -391,40 +414,55 @@ public FunctionScoreQueryDescriptor BoostMode(Elastic.Clients.Elasticsearch.Quer /// One or more functions that compute a new score for each document returned by the query. /// /// - public FunctionScoreQueryDescriptor Functions(ICollection? functions) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(System.Collections.Generic.ICollection? value) { - FunctionsDescriptor = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = null; - FunctionsValue = functions; - return Self; + Instance.Functions = value; + return this; } - public FunctionScoreQueryDescriptor Functions(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor descriptor) + /// + /// + /// One or more functions that compute a new score for each document returned by the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(params Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore[] values) { - FunctionsValue = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = null; - FunctionsDescriptor = descriptor; - return Self; + Instance.Functions = [.. values]; + return this; } - public FunctionScoreQueryDescriptor Functions(Action configure) + /// + /// + /// One or more functions that compute a new score for each document returned by the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(params System.Action[] actions) { - FunctionsValue = null; - FunctionsDescriptor = null; - FunctionsDescriptorActions = null; - FunctionsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor.Build(action)); + } + + Instance.Functions = items; + return this; } - public FunctionScoreQueryDescriptor Functions(params Action[] configure) + /// + /// + /// One or more functions that compute a new score for each document returned by the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Functions(params System.Action>[] actions) { - FunctionsValue = null; - FunctionsDescriptor = null; - FunctionsDescriptorAction = null; - FunctionsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor.Build(action)); + } + + Instance.Functions = items; + return this; } /// @@ -432,10 +470,10 @@ public FunctionScoreQueryDescriptor Functions(params Action /// - public FunctionScoreQueryDescriptor MaxBoost(double? maxBoost) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor MaxBoost(double? value) { - MaxBoostValue = maxBoost; - return Self; + Instance.MaxBoost = value; + return this; } /// @@ -443,10 +481,10 @@ public FunctionScoreQueryDescriptor MaxBoost(double? maxBoost) /// Excludes documents that do not meet the provided score threshold. /// /// - public FunctionScoreQueryDescriptor MinScore(double? minScore) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor MinScore(double? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -454,34 +492,38 @@ public FunctionScoreQueryDescriptor MinScore(double? minScore) /// A query that determines the documents for which a new score is computed. /// /// - public FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public FunctionScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A query that determines the documents for which a new score is computed. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FunctionScoreQueryDescriptor Query(Action configure) + /// + /// + /// A query that determines the documents for which a new score is computed. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public FunctionScoreQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -489,98 +531,22 @@ public FunctionScoreQueryDescriptor QueryName(string? queryName) /// Specifies how the computed scores are combined /// /// - public FunctionScoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (BoostModeValue is not null) - { - writer.WritePropertyName("boost_mode"); - JsonSerializer.Serialize(writer, BoostModeValue, options); - } - - if (FunctionsDescriptor is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, FunctionsDescriptor, options); - writer.WriteEndArray(); - } - else if (FunctionsDescriptorAction is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(FunctionsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (FunctionsDescriptorActions is not null) - { - writer.WritePropertyName("functions"); - writer.WriteStartArray(); - foreach (var action in FunctionsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (FunctionsValue is not null) - { - writer.WritePropertyName("functions"); - JsonSerializer.Serialize(writer, FunctionsValue, options); - } - - if (MaxBoostValue.HasValue) + if (action is null) { - writer.WritePropertyName("max_boost"); - writer.WriteNumberValue(MaxBoostValue.Value); + return new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs index 511e2e5009d..308cc716ea6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/FuzzyQuery.g.cs @@ -17,153 +17,162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class FuzzyQueryConverter : JsonConverter +internal sealed partial class FuzzyQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override FuzzyQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropMaxExpansions = System.Text.Json.JsonEncodedText.Encode("max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropTranspositions = System.Text.Json.JsonEncodedText.Encode("transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new FuzzyQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzziness") - { - variant.Fuzziness = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_expansions") - { - variant.MaxExpansions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "prefix_length") - { - variant.PrefixLength = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rewrite") - { - variant.Rewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "transpositions") - { - variant.Transpositions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Value = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, FuzzyQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize FuzzyQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propMaxExpansions = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propTranspositions = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.Fuzziness is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, value.Fuzziness, options); - } + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } - if (value.MaxExpansions.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(value.MaxExpansions.Value); - } + if (propMaxExpansions.TryReadProperty(ref reader, options, PropMaxExpansions, null)) + { + continue; + } - if (value.PrefixLength.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(value.PrefixLength.Value); - } + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Rewrite)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(value.Rewrite); + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } + + if (propTranspositions.TryReadProperty(ref reader, options, PropTranspositions, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Transpositions.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(value.Transpositions.Value); - } + Boost = propBoost.Value, + Field = propField.Value, + Fuzziness = propFuzziness.Value, + MaxExpansions = propMaxExpansions.Value, + PrefixLength = propPrefixLength.Value, + QueryName = propQueryName.Value, + Rewrite = propRewrite.Value, + Transpositions = propTranspositions.Value, + Value = propValue.Value + }; + } - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, value.Value, options); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropMaxExpansions, value.MaxExpansions, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropTranspositions, value.Transpositions, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(FuzzyQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryConverter))] public sealed partial class FuzzyQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public FuzzyQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FuzzyQuery(Elastic.Clients.Elasticsearch.Field field, object value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public FuzzyQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -173,7 +182,11 @@ public FuzzyQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -216,28 +229,31 @@ public FuzzyQuery(Elastic.Clients.Elasticsearch.Field field) /// Term you wish to find in the provided field. /// /// - public object Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(FuzzyQuery fuzzyQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Fuzzy(fuzzyQuery); + public +#if NET7_0_OR_GREATER + required +#endif + object Value { get; set; } } -public sealed partial class FuzzyQueryDescriptor : SerializableDescriptor> +public readonly partial struct FuzzyQueryDescriptor { - internal FuzzyQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery Instance { get; init; } - public FuzzyQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FuzzyQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private bool? TranspositionsValue { get; set; } - private object ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FuzzyQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -247,28 +263,33 @@ public FuzzyQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public FuzzyQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public FuzzyQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FuzzyQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FuzzyQueryDescriptor Field(Expression> field) + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldValue = field; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -276,10 +297,10 @@ public FuzzyQueryDescriptor Field(Expression> /// Maximum edit distance allowed for matching. /// /// - public FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -287,10 +308,10 @@ public FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.F /// Maximum number of variations created. /// /// - public FuzzyQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -298,16 +319,16 @@ public FuzzyQueryDescriptor MaxExpansions(int? maxExpansions) /// Number of beginning characters left unchanged when creating expansions. /// /// - public FuzzyQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } - public FuzzyQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -315,10 +336,10 @@ public FuzzyQueryDescriptor QueryName(string? queryName) /// Number of beginning characters left unchanged when creating expansions. /// /// - public FuzzyQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -326,10 +347,10 @@ public FuzzyQueryDescriptor Rewrite(string? rewrite) /// Indicates whether edits include transpositions of two adjacent characters (for example ab to ba). /// /// - public FuzzyQueryDescriptor Transpositions(bool? transpositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Transpositions(bool? value = true) { - TranspositionsValue = transpositions; - return Self; + Instance.Transpositions = value; + return this; } /// @@ -337,85 +358,39 @@ public FuzzyQueryDescriptor Transpositions(bool? transpositions = tru /// Term you wish to find in the provided field. /// /// - public FuzzyQueryDescriptor Value(object value) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Value(object value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (TranspositionsValue.HasValue) - { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(TranspositionsValue.Value); - } - - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FuzzyQueryDescriptor : SerializableDescriptor +public readonly partial struct FuzzyQueryDescriptor { - internal FuzzyQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FuzzyQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery instance) + { + Instance = instance; + } - public FuzzyQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FuzzyQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private bool? TranspositionsValue { get; set; } - private object ValueValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -425,28 +400,33 @@ public FuzzyQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public FuzzyQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public FuzzyQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FuzzyQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public FuzzyQueryDescriptor Field(Expression> field) + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldValue = field; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -454,10 +434,10 @@ public FuzzyQueryDescriptor Field(Expression> /// Maximum edit distance allowed for matching. /// /// - public FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -465,10 +445,10 @@ public FuzzyQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? f /// Maximum number of variations created. /// /// - public FuzzyQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -476,16 +456,16 @@ public FuzzyQueryDescriptor MaxExpansions(int? maxExpansions) /// Number of beginning characters left unchanged when creating expansions. /// /// - public FuzzyQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } - public FuzzyQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -493,10 +473,10 @@ public FuzzyQueryDescriptor QueryName(string? queryName) /// Number of beginning characters left unchanged when creating expansions. /// /// - public FuzzyQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -504,10 +484,10 @@ public FuzzyQueryDescriptor Rewrite(string? rewrite) /// Indicates whether edits include transpositions of two adjacent characters (for example ab to ba). /// /// - public FuzzyQueryDescriptor Transpositions(bool? transpositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Transpositions(bool? value = true) { - TranspositionsValue = transpositions; - return Self; + Instance.Transpositions = value; + return this; } /// @@ -515,64 +495,17 @@ public FuzzyQueryDescriptor Transpositions(bool? transpositions = true) /// Term you wish to find in the provided field. /// /// - public FuzzyQueryDescriptor Value(object value) + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor Value(object value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (TranspositionsValue.HasValue) - { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(TranspositionsValue.Value); - } - - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs index 8833c66c219..1c7a81df2da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs @@ -17,107 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class GeoBoundingBoxQueryConverter : JsonConverter +internal sealed partial class GeoBoundingBoxQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoBoundingBoxQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropValidationMethod = System.Text.Json.JsonEncodedText.Encode("validation_method"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new GeoBoundingBoxQuery(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propBoundingBox = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propType = default; + LocalJsonValue propValidationMethod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignore_unmapped") - { - variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "validation_method") - { - variant.ValidationMethod = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.BoundingBox = JsonSerializer.Deserialize(ref reader, options); + continue; } - } - - return variant; - } - public override void Write(Utf8JsonWriter writer, GeoBoundingBoxQuery value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.BoundingBox is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.BoundingBox, options); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } - if (value.IgnoreUnmapped.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(value.IgnoreUnmapped.Value); - } + if (propValidationMethod.TryReadProperty(ref reader, options, PropValidationMethod, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + propField.Initialized = propBoundingBox.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propBoundingBox.Value, null, null); } - if (value.ValidationMethod is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, value.ValidationMethod, options); - } + Boost = propBoost.Value, + BoundingBox = propBoundingBox.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + QueryName = propQueryName.Value, +#pragma warning disable CS0618 + Type = propType.Value +#pragma warning restore CS0618 +, + ValidationMethod = propValidationMethod.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropType, value.Type, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropValidationMethod, value.ValidationMethod, null, null); + writer.WriteProperty(options, value.Field, value.BoundingBox, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(GeoBoundingBoxQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryConverter))] public sealed partial class GeoBoundingBoxQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.GeoBounds boundingBox, Elastic.Clients.Elasticsearch.Field field) + { + BoundingBox = boundingBox; + Field = field; + } +#if NET7_0_OR_GREATER + public GeoBoundingBoxQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoBoundingBoxQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -127,8 +139,16 @@ public sealed partial class GeoBoundingBoxQuery /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.GeoBounds BoundingBox { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoBounds BoundingBox { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -138,6 +158,8 @@ public sealed partial class GeoBoundingBoxQuery /// public bool? IgnoreUnmapped { get; set; } public string? QueryName { get; set; } + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution? Type { get; set; } /// /// @@ -146,24 +168,26 @@ public sealed partial class GeoBoundingBoxQuery /// /// public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(GeoBoundingBoxQuery geoBoundingBoxQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.GeoBoundingBox(geoBoundingBoxQuery); } -public sealed partial class GeoBoundingBoxQueryDescriptor : SerializableDescriptor> +public readonly partial struct GeoBoundingBoxQueryDescriptor { - internal GeoBoundingBoxQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundingBoxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery instance) + { + Instance = instance; + } - public GeoBoundingBoxQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundingBoxQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoBounds BoundingBoxValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -173,34 +197,34 @@ public GeoBoundingBoxQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoBoundingBoxQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds boundingBox) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds value) { - BoundingBoxValue = boundingBox; - return Self; + Instance.BoundingBox = value; + return this; } - public GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor BoundingBox(System.Func action) { - FieldValue = field; - return Self; + Instance.BoundingBox = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } - public GeoBoundingBoxQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoBoundingBoxQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -209,16 +233,23 @@ public GeoBoundingBoxQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor QueryName(string? value) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.QueryName = value; + return this; } - public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution? value) { - QueryNameValue = queryName; - return Self; + Instance.Type = value; + return this; } /// @@ -227,64 +258,39 @@ public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) /// Set to COERCE to also try to infer correct latitude or longitude. /// /// - public GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) { - ValidationMethodValue = validationMethod; - return Self; + Instance.ValidationMethod = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null && BoundingBoxValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, BoundingBoxValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ValidationMethodValue is not null) - { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, ValidationMethodValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoBoundingBoxQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoBoundingBoxQueryDescriptor { - internal GeoBoundingBoxQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundingBoxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery instance) + { + Instance = instance; + } - public GeoBoundingBoxQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoBoundingBoxQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoBounds BoundingBoxValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -294,34 +300,34 @@ public GeoBoundingBoxQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoBoundingBoxQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds boundingBox) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds value) { - BoundingBoxValue = boundingBox; - return Self; + Instance.BoundingBox = value; + return this; } - public GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor BoundingBox(System.Func action) { - FieldValue = field; - return Self; + Instance.BoundingBox = Elastic.Clients.Elasticsearch.GeoBoundsFactory.Build(action); + return this; } - public GeoBoundingBoxQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoBoundingBoxQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -330,16 +336,23 @@ public GeoBoundingBoxQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; + } + + [System.Obsolete("Deprecated in '7.14.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.GeoExecution? value) + { + Instance.Type = value; + return this; } /// @@ -348,46 +361,17 @@ public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) /// Set to COERCE to also try to infer correct latitude or longitude. /// /// - public GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) { - ValidationMethodValue = validationMethod; - return Self; + Instance.ValidationMethod = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery Build(System.Action action) { - writer.WriteStartObject(); - if (FieldValue is not null && BoundingBoxValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, BoundingBoxValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ValidationMethodValue is not null) - { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, ValidationMethodValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDecayFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDecayFunction.g.cs index 446768423be..ef268d2083f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDecayFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDecayFunction.g.cs @@ -17,72 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class GeoDecayFunctionConverter : JsonConverter +internal sealed partial class GeoDecayFunctionConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoDecayFunction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new GeoDecayFunction(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var property = reader.GetString(); - if (property == "multi_value_mode") - { - variant.MultiValueMode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Placement = JsonSerializer.Deserialize>(ref reader, options); - } - } - - return variant; - } + private static readonly System.Text.Json.JsonEncodedText PropMultiValueMode = System.Text.Json.JsonEncodedText.Encode("multi_value_mode"); - public override void Write(Utf8JsonWriter writer, GeoDecayFunction value, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - writer.WriteStartObject(); - if (value.Field is not null && value.Placement is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMultiValueMode = default; + LocalJsonValue> propPlacement = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (!options.TryGetClientSettings(out var settings)) + if (propMultiValueMode.TryReadProperty(ref reader, options, PropMultiValueMode, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Placement, options); + propField.Initialized = propPlacement.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propPlacement.Value, null, null); } - if (value.MultiValueMode is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, value.MultiValueMode, options); - } + Field = propField.Value, + MultiValueMode = propMultiValueMode.Value, + Placement = propPlacement.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMultiValueMode, value.MultiValueMode, null, null); + writer.WriteProperty(options, value.Field, value.Placement, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(GeoDecayFunctionConverter))] -public sealed partial class GeoDecayFunction +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionConverter))] +public sealed partial class GeoDecayFunction : Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction { - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDecayFunction(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + { + Field = field; + Placement = placement; + } +#if NET7_0_OR_GREATER + public GeoDecayFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoDecayFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -90,37 +100,44 @@ public sealed partial class GeoDecayFunction /// /// public Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueMode { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction.Type => "geo"; } -public sealed partial class GeoDecayFunctionDescriptor : SerializableDescriptor> +public readonly partial struct GeoDecayFunctionDescriptor { - internal GeoDecayFunctionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction Instance { get; init; } - public GeoDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public GeoDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GeoDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -128,66 +145,68 @@ public GeoDecayFunctionDescriptor Field(Expression /// - public GeoDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public GeoDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoDecayFunctionDescriptor : SerializableDescriptor +public readonly partial struct GeoDecayFunctionDescriptor { - internal GeoDecayFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction Instance { get; init; } - public GeoDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public GeoDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GeoDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -195,34 +214,35 @@ public GeoDecayFunctionDescriptor Field(Expression /// - public GeoDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public GeoDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfGeoLocationStringDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceFeatureQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceFeatureQuery.g.cs index 5c04cad4816..b964d97488c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceFeatureQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceFeatureQuery.g.cs @@ -17,18 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class GeoDistanceFeatureQuery +internal sealed partial class GeoDistanceFeatureQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropOrigin = System.Text.Json.JsonEncodedText.Encode("origin"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propOrigin = default; + LocalJsonValue propPivot = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propOrigin.TryReadProperty(ref reader, options, PropOrigin, null)) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Origin = propOrigin.Value, + Pivot = propPivot.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropOrigin, value.Origin, null, null); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryConverter))] +public sealed partial class GeoDistanceFeatureQuery : Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.GeoLocation origin, string pivot) + { + Field = field; + Origin = origin; + Pivot = pivot; + } +#if NET7_0_OR_GREATER + public GeoDistanceFeatureQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoDistanceFeatureQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +133,6 @@ public sealed partial class GeoDistanceFeatureQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -48,8 +143,11 @@ public sealed partial class GeoDistanceFeatureQuery /// have an doc_values mapping parameter value of true, which is the default. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -59,8 +157,11 @@ public sealed partial class GeoDistanceFeatureQuery /// If the field value is a geo_point field, the origin value must be a geopoint. /// /// - [JsonInclude, JsonPropertyName("origin")] - public Elastic.Clients.Elasticsearch.GeoLocation Origin { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation Origin { get; set; } /// /// @@ -68,25 +169,34 @@ public sealed partial class GeoDistanceFeatureQuery /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - [JsonInclude, JsonPropertyName("pivot")] - public string Pivot { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Pivot { get; set; } public string? QueryName { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery.Type => "geo"; } -public sealed partial class GeoDistanceFeatureQueryDescriptor : SerializableDescriptor> +public readonly partial struct GeoDistanceFeatureQueryDescriptor { - internal GeoDistanceFeatureQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery instance) + { + Instance = instance; + } - public GeoDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceFeatureQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation OriginValue { get; set; } - private string PivotValue { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,10 +206,10 @@ public GeoDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -110,10 +220,10 @@ public GeoDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -124,24 +234,24 @@ public GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasti /// have an doc_values mapping parameter value of true, which is the default. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. + /// Date or point of origin used to calculate distances. + /// If the field value is a date or date_nanos field, the origin value must be a date. + /// Date Math, such as now-1h, is supported. + /// If the field value is a geo_point field, the origin value must be a geopoint. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation value) { - FieldValue = field; - return Self; + Instance.Origin = value; + return this; } /// @@ -152,10 +262,10 @@ public GeoDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation origin) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Origin(System.Func action) { - OriginValue = origin; - return Self; + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -164,56 +274,45 @@ public GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elast /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public GeoDistanceFeatureQueryDescriptor Pivot(string pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Pivot(string value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public GeoDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - writer.WriteStringValue(PivotValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoDistanceFeatureQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoDistanceFeatureQueryDescriptor { - internal GeoDistanceFeatureQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery instance) + { + Instance = instance; + } - public GeoDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceFeatureQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation OriginValue { get; set; } - private string PivotValue { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -223,10 +322,10 @@ public GeoDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -237,10 +336,10 @@ public GeoDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -251,24 +350,24 @@ public GeoDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Fie /// have an doc_values mapping parameter value of true, which is the default. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. + /// Date or point of origin used to calculate distances. + /// If the field value is a date or date_nanos field, the origin value must be a date. + /// Date Math, such as now-1h, is supported. + /// If the field value is a geo_point field, the origin value must be a geopoint. /// /// - public GeoDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation value) { - FieldValue = field; - return Self; + Instance.Origin = value; + return this; } /// @@ -279,10 +378,10 @@ public GeoDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.GeoLocation origin) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Origin(System.Func action) { - OriginValue = origin; - return Self; + Instance.Origin = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } /// @@ -291,39 +390,23 @@ public GeoDistanceFeatureQueryDescriptor Origin(Elastic.Clients.Elasticsearch.Ge /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public GeoDistanceFeatureQueryDescriptor Pivot(string pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor Pivot(string value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public GeoDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - writer.WriteStringValue(PivotValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs index 04dae04ae98..c0a3fe2a67f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoDistanceQuery.g.cs @@ -17,127 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class GeoDistanceQueryConverter : JsonConverter +internal sealed partial class GeoDistanceQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoDistanceQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDistance = System.Text.Json.JsonEncodedText.Encode("distance"); + private static readonly System.Text.Json.JsonEncodedText PropDistanceType = System.Text.Json.JsonEncodedText.Encode("distance_type"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValidationMethod = System.Text.Json.JsonEncodedText.Encode("validation_method"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new GeoDistanceQuery(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propDistance = default; + LocalJsonValue propDistanceType = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propLocation = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValidationMethod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "distance") - { - variant.Distance = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "distance_type") - { - variant.DistanceType = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignore_unmapped") - { - variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "validation_method") - { - variant.ValidationMethod = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Location = JsonSerializer.Deserialize(ref reader, options); + continue; } - } - return variant; - } - - public override void Write(Utf8JsonWriter writer, GeoDistanceQuery value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.Location is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propDistance.TryReadProperty(ref reader, options, PropDistance, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Location, options); - } + if (propDistanceType.TryReadProperty(ref reader, options, PropDistanceType, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } - writer.WritePropertyName("distance"); - writer.WriteStringValue(value.Distance); - if (value.DistanceType is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, value.DistanceType, options); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.IgnoreUnmapped.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(value.IgnoreUnmapped.Value); - } + if (propValidationMethod.TryReadProperty(ref reader, options, PropValidationMethod, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + propField.Initialized = propLocation.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propLocation.Value, null, null); } - if (value.ValidationMethod is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, value.ValidationMethod, options); - } + Boost = propBoost.Value, + Distance = propDistance.Value, + DistanceType = propDistanceType.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + Location = propLocation.Value, + QueryName = propQueryName.Value, + ValidationMethod = propValidationMethod.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDistance, value.Distance, null, null); + writer.WriteProperty(options, PropDistanceType, value.DistanceType, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValidationMethod, value.ValidationMethod, null, null); + writer.WriteProperty(options, value.Field, value.Location, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(GeoDistanceQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryConverter))] public sealed partial class GeoDistanceQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceQuery(string distance, Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.GeoLocation location) + { + Distance = distance; + Field = field; + Location = location; + } +#if NET7_0_OR_GREATER + public GeoDistanceQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoDistanceQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -154,7 +150,11 @@ public sealed partial class GeoDistanceQuery /// Points which fall into this circle are considered to be matches. /// /// - public string Distance { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Distance { get; set; } /// /// @@ -163,7 +163,11 @@ public sealed partial class GeoDistanceQuery /// /// public Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceType { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -172,7 +176,11 @@ public sealed partial class GeoDistanceQuery /// /// public bool? IgnoreUnmapped { get; set; } - public Elastic.Clients.Elasticsearch.GeoLocation Location { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation Location { get; set; } public string? QueryName { get; set; } /// @@ -182,26 +190,26 @@ public sealed partial class GeoDistanceQuery /// /// public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(GeoDistanceQuery geoDistanceQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.GeoDistance(geoDistanceQuery); } -public sealed partial class GeoDistanceQueryDescriptor : SerializableDescriptor> +public readonly partial struct GeoDistanceQueryDescriptor { - internal GeoDistanceQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery instance) + { + Instance = instance; + } - public GeoDistanceQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private string DistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation LocationValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -211,10 +219,10 @@ public GeoDistanceQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoDistanceQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -223,10 +231,10 @@ public GeoDistanceQueryDescriptor Boost(float? boost) /// Points which fall into this circle are considered to be matches. /// /// - public GeoDistanceQueryDescriptor Distance(string distance) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Distance(string value) { - DistanceValue = distance; - return Self; + Instance.Distance = value; + return this; } /// @@ -235,28 +243,22 @@ public GeoDistanceQueryDescriptor Distance(string distance) /// Set to plane for a faster calculation that's inaccurate on long distances and close to the poles. /// /// - public GeoDistanceQueryDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) - { - DistanceTypeValue = distanceType; - return Self; - } - - public GeoDistanceQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - FieldValue = field; - return Self; + Instance.DistanceType = value; + return this; } - public GeoDistanceQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -265,22 +267,28 @@ public GeoDistanceQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoDistanceQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation value) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.Location = value; + return this; } - public GeoDistanceQueryDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation location) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Location(System.Func action) { - LocationValue = location; - return Self; + Instance.Location = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - public GeoDistanceQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -289,74 +297,39 @@ public GeoDistanceQueryDescriptor QueryName(string? queryName) /// Set to COERCE to also try to infer correct latitude or longitude. /// /// - public GeoDistanceQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) { - ValidationMethodValue = validationMethod; - return Self; + Instance.ValidationMethod = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null && LocationValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("distance"); - writer.WriteStringValue(DistanceValue); - if (DistanceTypeValue is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ValidationMethodValue is not null) - { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, ValidationMethodValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoDistanceQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoDistanceQueryDescriptor { - internal GeoDistanceQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery instance) + { + Instance = instance; + } - public GeoDistanceQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoDistanceQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private string DistanceValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoDistanceType? DistanceTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation LocationValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -366,10 +339,10 @@ public GeoDistanceQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoDistanceQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -378,10 +351,10 @@ public GeoDistanceQueryDescriptor Boost(float? boost) /// Points which fall into this circle are considered to be matches. /// /// - public GeoDistanceQueryDescriptor Distance(string distance) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Distance(string value) { - DistanceValue = distance; - return Self; + Instance.Distance = value; + return this; } /// @@ -390,28 +363,22 @@ public GeoDistanceQueryDescriptor Distance(string distance) /// Set to plane for a faster calculation that's inaccurate on long distances and close to the poles. /// /// - public GeoDistanceQueryDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? distanceType) - { - DistanceTypeValue = distanceType; - return Self; - } - - public GeoDistanceQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor DistanceType(Elastic.Clients.Elasticsearch.GeoDistanceType? value) { - FieldValue = field; - return Self; + Instance.DistanceType = value; + return this; } - public GeoDistanceQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoDistanceQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -420,22 +387,28 @@ public GeoDistanceQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoDistanceQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation value) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.Location = value; + return this; } - public GeoDistanceQueryDescriptor Location(Elastic.Clients.Elasticsearch.GeoLocation location) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor Location(System.Func action) { - LocationValue = location; - return Self; + Instance.Location = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - public GeoDistanceQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -444,54 +417,17 @@ public GeoDistanceQueryDescriptor QueryName(string? queryName) /// Set to COERCE to also try to infer correct latitude or longitude. /// /// - public GeoDistanceQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) { - ValidationMethodValue = validationMethod; - return Self; + Instance.ValidationMethod = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery Build(System.Action action) { - writer.WriteStartObject(); - if (FieldValue is not null && LocationValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, LocationValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("distance"); - writer.WriteStringValue(DistanceValue); - if (DistanceTypeValue is not null) - { - writer.WritePropertyName("distance_type"); - JsonSerializer.Serialize(writer, DistanceTypeValue, options); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ValidationMethodValue is not null) - { - writer.WritePropertyName("validation_method"); - JsonSerializer.Serialize(writer, ValidationMethodValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoGridQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoGridQuery.g.cs index bb5ec2e3665..01c6ddebd99 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoGridQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoGridQuery.g.cs @@ -17,218 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(GeoGridQueryConverter))] -public sealed partial class GeoGridQuery +internal sealed partial class GeoGridQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal GeoGridQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText VariantGeogrid = System.Text.Json.JsonEncodedText.Encode("geogrid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeohash = System.Text.Json.JsonEncodedText.Encode("geohash"); + private static readonly System.Text.Json.JsonEncodedText VariantGeohex = System.Text.Json.JsonEncodedText.Encode("geohex"); - public static GeoGridQuery Geogrid(string s) => new GeoGridQuery("geogrid", s); - public static GeoGridQuery Geohash(string s) => new GeoGridQuery("geohash", s); - public static GeoGridQuery Geohex(string s) => new GeoGridQuery("geohex", s); - - /// - /// - /// Floating point number used to decrease or increase the relevance scores of the query. - /// Boost values are relative to the default value of 1.0. - /// A boost value between 0 and 1.0 decreases the relevance score. - /// A value greater than 1.0 increases the relevance score. - /// - /// - [JsonInclude, JsonPropertyName("boost")] - public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("_name")] - public string? QueryName { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class GeoGridQueryConverter : JsonConverter -{ - public override GeoGridQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - object? variantValue = default; - string? variantNameValue = default; - float? boostValue = default; - string? queryNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "boost") + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) { - boostValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "_name") + if (reader.ValueTextEquals(VariantGeogrid)) { - queryNameValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantGeogrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geogrid") + if (reader.ValueTextEquals(VariantGeohash)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeohash.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geohash") + if (reader.ValueTextEquals(VariantGeohex)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeohex.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geohex") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'GeoGridQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); reader.Read(); - var result = new GeoGridQuery(variantNameValue, variantValue); - result.Boost = boostValue; - result.Field = fieldName; - result.QueryName = queryNameValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Boost = propBoost.Value, + Field = propField.Value, + QueryName = propQueryName.Value + }; } - public override void Write(Utf8JsonWriter writer, GeoGridQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery value, System.Text.Json.JsonSerializerOptions options) { - if (value.Field is null) - throw new JsonException("Unable to serialize GeoGridQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); + writer.WritePropertyName(options, value.Field, null); writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } - - if (!string.IsNullOrEmpty(value.QueryName)) + switch (value.VariantType) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } - - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "geogrid": - JsonSerializer.Serialize(writer, (string)value.Variant, options); - break; - case "geohash": - JsonSerializer.Serialize(writer, (string)value.Variant, options); - break; - case "geohex": - JsonSerializer.Serialize(writer, (string)value.Variant, options); - break; - } + case null: + break; + case "geogrid": + writer.WriteProperty(options, value.VariantType, (string)value.Variant, null, null); + break; + case "geohash": + writer.WriteProperty(options, value.VariantType, (string)value.Variant, null, null); + break; + case "geohex": + writer.WriteProperty(options, value.VariantType, (string)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery)}'."); } + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -public sealed partial class GeoGridQueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryConverter))] +public sealed partial class GeoGridQuery { - internal GeoGridQueryDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } - public GeoGridQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridQuery(Elastic.Clients.Elasticsearch.Field field) { + Field = field; } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private GeoGridQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#if NET7_0_OR_GREATER + public GeoGridQuery() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private GeoGridQueryDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + public string? Geogrid { get => GetVariant("geogrid"); set => SetVariant("geogrid", value); } + public string? Geohash { get => GetVariant("geohash"); set => SetVariant("geohash", value); } + public string? Geohex { get => GetVariant("geohex"); set => SetVariant("geohex", value); } /// /// @@ -238,111 +164,147 @@ private GeoGridQueryDescriptor Set(object variant, string variantName /// A value greater than 1.0 increases the relevance score. /// /// - public GeoGridQueryDescriptor Boost(float? boost) + public float? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public string? QueryName { get; set; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - BoostValue = boost; - return Self; + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - public GeoGridQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { - FieldValue = field; - return Self; + VariantType = type; + Variant = value; } +} + +public readonly partial struct GeoGridQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery Instance { get; init; } - public GeoGridQueryDescriptor Field(Expression> field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery instance) { - FieldValue = field; - return Self; + Instance = instance; } - public GeoGridQueryDescriptor Field(Expression> field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridQueryDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GeoGridQueryDescriptor QueryName(string? queryName) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geogrid(string? value) { - QueryNameValue = queryName; - return Self; + Instance.Geogrid = value; + return this; } - public GeoGridQueryDescriptor Geogrid(string s) => Set(s, "geogrid"); - public GeoGridQueryDescriptor Geohash(string s) => Set(s, "geohash"); - public GeoGridQueryDescriptor Geohex(string s) => Set(s, "geohex"); + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geohash(string? value) + { + Instance.Geohash = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geohex(string? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } + Instance.Geohex = value; + return this; + } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoGridQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoGridQueryDescriptor { - internal GeoGridQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery Instance { get; init; } - public GeoGridQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoGridQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private GeoGridQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geogrid(string? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Geogrid = value; + return this; } - private GeoGridQueryDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geohash(string? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Geohash = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Geohex(string? value) + { + Instance.Geohex = value; + return this; + } /// /// @@ -352,73 +314,35 @@ private GeoGridQueryDescriptor Set(object variant, string variantName) /// A value greater than 1.0 increases the relevance score. /// /// - public GeoGridQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public GeoGridQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoGridQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoGridQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; + Instance.QueryName = value; + return this; } - public GeoGridQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery Build(System.Action action) { - QueryNameValue = queryName; - return Self; - } - - public GeoGridQueryDescriptor Geogrid(string s) => Set(s, "geogrid"); - public GeoGridQueryDescriptor Geohash(string s) => Set(s, "geohash"); - public GeoGridQueryDescriptor Geohex(string s) => Set(s, "geohex"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } -} +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonPoints.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonPoints.g.cs new file mode 100644 index 00000000000..17cca22679c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonPoints.g.cs @@ -0,0 +1,147 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class GeoPolygonPointsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPoints = System.Text.Json.JsonEncodedText.Encode("points"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propPoints = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPoints.TryReadProperty(ref reader, options, PropPoints, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Points = propPoints.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPoints, value.Points, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsConverter))] +public sealed partial class GeoPolygonPoints +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonPoints(System.Collections.Generic.ICollection points) + { + Points = points; + } +#if NET7_0_OR_GREATER + public GeoPolygonPoints() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoPolygonPoints() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoPolygonPoints(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Points { get; set; } +} + +public readonly partial struct GeoPolygonPointsDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonPointsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonPointsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor Points(System.Collections.Generic.ICollection value) + { + Instance.Points = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor Points(params Elastic.Clients.Elasticsearch.GeoLocation[] values) + { + Instance.Points = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor Points(params System.Func[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action)); + } + + Instance.Points = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs new file mode 100644 index 00000000000..2fd1cef7711 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoPolygonQuery.g.cs @@ -0,0 +1,308 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class GeoPolygonQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValidationMethod = System.Text.Json.JsonEncodedText.Encode("validation_method"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propPolygon = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValidationMethod = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propValidationMethod.TryReadProperty(ref reader, options, PropValidationMethod, null)) + { + continue; + } + + propField.Initialized = propPolygon.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propPolygon.Value, null, null); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + Polygon = propPolygon.Value, + QueryName = propQueryName.Value, + ValidationMethod = propValidationMethod.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValidationMethod, value.ValidationMethod, null, null); + writer.WriteProperty(options, value.Field, value.Polygon, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryConverter))] +public sealed partial class GeoPolygonQuery +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints polygon) + { + Field = field; + Polygon = polygon; + } +#if NET7_0_OR_GREATER + public GeoPolygonQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoPolygonQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public bool? IgnoreUnmapped { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints Polygon { get; set; } + public string? QueryName { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } +} + +public readonly partial struct GeoPolygonQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Polygon(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints value) + { + Instance.Polygon = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Polygon(System.Action action) + { + Instance.Polygon = Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) + { + Instance.ValidationMethod = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct GeoPolygonQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoPolygonQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Polygon(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPoints value) + { + Instance.Polygon = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor Polygon(System.Action action) + { + Instance.Polygon = Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonPointsDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? value) + { + Instance.ValidationMethod = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeFieldQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeFieldQuery.g.cs index 061f17eee7c..06458d927c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeFieldQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeFieldQuery.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class GeoShapeFieldQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexedShape = System.Text.Json.JsonEncodedText.Encode("indexed_shape"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropShape = System.Text.Json.JsonEncodedText.Encode("shape"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexedShape = default; + LocalJsonValue propRelation = default; + LocalJsonValue propShape = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexedShape.TryReadProperty(ref reader, options, PropIndexedShape, null)) + { + continue; + } + + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propShape.TryReadProperty(ref reader, options, PropShape, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexedShape = propIndexedShape.Value, + Relation = propRelation.Value, + Shape = propShape.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexedShape, value.IndexedShape, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropShape, value.Shape, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryConverter))] public sealed partial class GeoShapeFieldQuery { +#if NET7_0_OR_GREATER + public GeoShapeFieldQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public GeoShapeFieldQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Query using an indexed shape retrieved from the the specified document and path. /// /// - [JsonInclude, JsonPropertyName("indexed_shape")] public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShape { get; set; } /// @@ -42,53 +111,49 @@ public sealed partial class GeoShapeFieldQuery /// Spatial relation operator used to search a geo field. /// /// - [JsonInclude, JsonPropertyName("relation")] public Elastic.Clients.Elasticsearch.GeoShapeRelation? Relation { get; set; } - [JsonInclude, JsonPropertyName("shape")] public object? Shape { get; set; } } -public sealed partial class GeoShapeFieldQueryDescriptor : SerializableDescriptor> +public readonly partial struct GeoShapeFieldQueryDescriptor { - internal GeoShapeFieldQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Instance { get; init; } - public GeoShapeFieldQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor IndexedShapeDescriptor { get; set; } - private Action> IndexedShapeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? RelationValue { get; set; } - private object? ShapeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeFieldQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Query using an indexed shape retrieved from the the specified document and path. /// /// - public GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? indexedShape) - { - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = null; - IndexedShapeValue = indexedShape; - return Self; - } - - public GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? value) { - IndexedShapeValue = null; - IndexedShapeDescriptorAction = null; - IndexedShapeDescriptor = descriptor; - return Self; + Instance.IndexedShape = value; + return this; } - public GeoShapeFieldQueryDescriptor IndexedShape(Action> configure) + /// + /// + /// Query using an indexed shape retrieved from the the specified document and path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor IndexedShape(System.Action> action) { - IndexedShapeValue = null; - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = configure; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } /// @@ -96,94 +161,82 @@ public GeoShapeFieldQueryDescriptor IndexedShape(Action /// - public GeoShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - public GeoShapeFieldQueryDescriptor Shape(object? shape) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor Shape(object? value) { - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Build(System.Action>? action) { - writer.WriteStartObject(); - if (IndexedShapeDescriptor is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeDescriptor, options); - } - else if (IndexedShapeDescriptorAction is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(IndexedShapeDescriptorAction), options); - } - else if (IndexedShapeValue is not null) + if (action is null) { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (ShapeValue is not null) - { - writer.WritePropertyName("shape"); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoShapeFieldQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoShapeFieldQueryDescriptor { - internal GeoShapeFieldQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Instance { get; init; } - public GeoShapeFieldQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor IndexedShapeDescriptor { get; set; } - private Action IndexedShapeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? RelationValue { get; set; } - private object? ShapeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeFieldQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Query using an indexed shape retrieved from the the specified document and path. /// /// - public GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? indexedShape) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? value) { - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = null; - IndexedShapeValue = indexedShape; - return Self; + Instance.IndexedShape = value; + return this; } - public GeoShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) + /// + /// + /// Query using an indexed shape retrieved from the the specified document and path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor IndexedShape(System.Action action) { - IndexedShapeValue = null; - IndexedShapeDescriptorAction = null; - IndexedShapeDescriptor = descriptor; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } - public GeoShapeFieldQueryDescriptor IndexedShape(Action configure) + /// + /// + /// Query using an indexed shape retrieved from the the specified document and path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor IndexedShape(System.Action> action) { - IndexedShapeValue = null; - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = configure; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } /// @@ -191,49 +244,28 @@ public GeoShapeFieldQueryDescriptor IndexedShape(Action /// - public GeoShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - public GeoShapeFieldQueryDescriptor Shape(object? shape) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor Shape(object? value) { - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexedShapeDescriptor is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeDescriptor, options); - } - else if (IndexedShapeDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(IndexedShapeDescriptorAction), options); - } - else if (IndexedShapeValue is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeValue, options); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ShapeValue is not null) - { - writer.WritePropertyName("shape"); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs index ec6e5429145..2e381d444b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoShapeQuery.g.cs @@ -17,95 +17,95 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class GeoShapeQueryConverter : JsonConverter +internal sealed partial class GeoShapeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override GeoShapeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new GeoShapeQuery(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propShape = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignore_unmapped") - { - variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Shape = JsonSerializer.Deserialize(ref reader, options); + continue; } - } - return variant; - } - - public override void Write(Utf8JsonWriter writer, GeoShapeQuery value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.Shape is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Shape, options); - } - - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.IgnoreUnmapped.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(value.IgnoreUnmapped.Value); + propField.Initialized = propShape.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propShape.Value, null, null); } - if (!string.IsNullOrEmpty(value.QueryName)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + Boost = propBoost.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + QueryName = propQueryName.Value, + Shape = propShape.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, value.Field, value.Shape, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(GeoShapeQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryConverter))] public sealed partial class GeoShapeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery shape) + { + Field = field; + Shape = shape; + } +#if NET7_0_OR_GREATER + public GeoShapeQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GeoShapeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -115,7 +115,11 @@ public sealed partial class GeoShapeQuery /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -125,26 +129,31 @@ public sealed partial class GeoShapeQuery /// public bool? IgnoreUnmapped { get; set; } public string? QueryName { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Shape { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(GeoShapeQuery geoShapeQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.GeoShape(geoShapeQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery Shape { get; set; } } -public sealed partial class GeoShapeQueryDescriptor : SerializableDescriptor> +public readonly partial struct GeoShapeQueryDescriptor { - internal GeoShapeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery Instance { get; init; } - public GeoShapeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery ShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor ShapeDescriptor { get; set; } - private Action> ShapeDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -154,28 +163,22 @@ public GeoShapeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoShapeQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public GeoShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public GeoShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -184,89 +187,63 @@ public GeoShapeQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoShapeQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public GeoShapeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery shape) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery value) { - ShapeDescriptor = null; - ShapeDescriptorAction = null; - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - public GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape() { - ShapeValue = null; - ShapeDescriptorAction = null; - ShapeDescriptor = descriptor; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor.Build(null); + return this; } - public GeoShapeQueryDescriptor Shape(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape(System.Action>? action) { - ShapeValue = null; - ShapeDescriptor = null; - ShapeDescriptorAction = configure; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null && ShapeValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GeoShapeQueryDescriptor : SerializableDescriptor +public readonly partial struct GeoShapeQueryDescriptor { - internal GeoShapeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery Instance { get; init; } - public GeoShapeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery ShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor ShapeDescriptor { get; set; } - private Action ShapeDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GeoShapeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -276,28 +253,22 @@ public GeoShapeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public GeoShapeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public GeoShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public GeoShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public GeoShapeQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -306,70 +277,47 @@ public GeoShapeQueryDescriptor Field(Expressionfalse to throw an exception if the field is not mapped. /// /// - public GeoShapeQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public GeoShapeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery shape) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQuery value) { - ShapeDescriptor = null; - ShapeDescriptorAction = null; - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - public GeoShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape() { - ShapeValue = null; - ShapeDescriptorAction = null; - ShapeDescriptor = descriptor; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor.Build(null); + return this; } - public GeoShapeQueryDescriptor Shape(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape(System.Action? action) { - ShapeValue = null; - ShapeDescriptor = null; - ShapeDescriptorAction = configure; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor Shape(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null && ShapeValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeFieldQueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasChildQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasChildQuery.g.cs index 4402b2d7c9c..27ecb9b868a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasChildQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasChildQuery.g.cs @@ -17,18 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class HasChildQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropMaxChildren = System.Text.Json.JsonEncodedText.Encode("max_children"); + private static readonly System.Text.Json.JsonEncodedText PropMinChildren = System.Text.Json.JsonEncodedText.Encode("min_children"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScoreMode = System.Text.Json.JsonEncodedText.Encode("score_mode"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propInnerHits = default; + LocalJsonValue propMaxChildren = default; + LocalJsonValue propMinChildren = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScoreMode = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, null)) + { + continue; + } + + if (propMaxChildren.TryReadProperty(ref reader, options, PropMaxChildren, null)) + { + continue; + } + + if (propMinChildren.TryReadProperty(ref reader, options, PropMinChildren, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScoreMode.TryReadProperty(ref reader, options, PropScoreMode, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + InnerHits = propInnerHits.Value, + MaxChildren = propMaxChildren.Value, + MinChildren = propMinChildren.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + ScoreMode = propScoreMode.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, null); + writer.WriteProperty(options, PropMaxChildren, value.MaxChildren, null, null); + writer.WriteProperty(options, PropMinChildren, value.MinChildren, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScoreMode, value.ScoreMode, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryConverter))] public sealed partial class HasChildQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasChildQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query query, string type) + { + Query = query; + Type = type; + } +#if NET7_0_OR_GREATER + public HasChildQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HasChildQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +168,6 @@ public sealed partial class HasChildQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +175,6 @@ public sealed partial class HasChildQuery /// Indicates whether to ignore an unmapped type and not return any documents instead of an error. /// /// - [JsonInclude, JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } /// @@ -53,7 +182,6 @@ public sealed partial class HasChildQuery /// If defined, each search hit will contain inner hits. /// /// - [JsonInclude, JsonPropertyName("inner_hits")] public Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHits { get; set; } /// @@ -62,7 +190,6 @@ public sealed partial class HasChildQuery /// If the parent document exceeds this limit, it is excluded from the search results. /// /// - [JsonInclude, JsonPropertyName("max_children")] public int? MaxChildren { get; set; } /// @@ -71,7 +198,6 @@ public sealed partial class HasChildQuery /// If the parent document does not meet this limit, it is excluded from the search results. /// /// - [JsonInclude, JsonPropertyName("min_children")] public int? MinChildren { get; set; } /// @@ -80,9 +206,11 @@ public sealed partial class HasChildQuery /// If a child document matches the search, the query returns the parent document. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } public string? QueryName { get; set; } /// @@ -90,7 +218,6 @@ public sealed partial class HasChildQuery /// Indicates how scores for matching child documents affect the root parent document’s relevance score. /// /// - [JsonInclude, JsonPropertyName("score_mode")] public Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreMode { get; set; } /// @@ -98,33 +225,31 @@ public sealed partial class HasChildQuery /// Name of the child relationship mapped for the join field. /// /// - [JsonInclude, JsonPropertyName("type")] - public string Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(HasChildQuery hasChildQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.HasChild(hasChildQuery); + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } -public sealed partial class HasChildQueryDescriptor : SerializableDescriptor> +public readonly partial struct HasChildQueryDescriptor { - internal HasChildQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasChildQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery instance) + { + Instance = instance; + } - public HasChildQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasChildQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action> InnerHitsDescriptorAction { get; set; } - private int? MaxChildrenValue { get; set; } - private int? MinChildrenValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreModeValue { get; set; } - private string TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -134,10 +259,10 @@ public HasChildQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public HasChildQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -145,10 +270,10 @@ public HasChildQueryDescriptor Boost(float? boost) /// Indicates whether to ignore an unmapped type and not return any documents instead of an error. /// /// - public HasChildQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -156,28 +281,32 @@ public HasChildQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = /// If defined, each search hit will contain inner hits. /// /// - public HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = value; + return this; } - public HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits() { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public HasChildQueryDescriptor InnerHits(Action> configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits(System.Action>? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -186,10 +315,10 @@ public HasChildQueryDescriptor InnerHits(Action /// - public HasChildQueryDescriptor MaxChildren(int? maxChildren) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor MaxChildren(int? value) { - MaxChildrenValue = maxChildren; - return Self; + Instance.MaxChildren = value; + return this; } /// @@ -198,10 +327,10 @@ public HasChildQueryDescriptor MaxChildren(int? maxChildren) /// If the parent document does not meet this limit, it is excluded from the search results. /// /// - public HasChildQueryDescriptor MinChildren(int? minChildren) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor MinChildren(int? value) { - MinChildrenValue = minChildren; - return Self; + Instance.MinChildren = value; + return this; } /// @@ -210,34 +339,28 @@ public HasChildQueryDescriptor MinChildren(int? minChildren) /// If a child document matches the search, the query returns the parent document. /// /// - public HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public HasChildQueryDescriptor Query(Action> configure) + /// + /// + /// Query you wish to run on child documents of the type field. + /// If a child document matches the search, the query returns the parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasChildQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -245,10 +368,10 @@ public HasChildQueryDescriptor QueryName(string? queryName) /// Indicates how scores for matching child documents affect the root parent document’s relevance score. /// /// - public HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } /// @@ -256,110 +379,39 @@ public HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearc /// Name of the child relationship mapped for the join field. /// /// - public HasChildQueryDescriptor Type(string type) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Type(string value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - if (MaxChildrenValue.HasValue) - { - writer.WritePropertyName("max_children"); - writer.WriteNumberValue(MaxChildrenValue.Value); - } - - if (MinChildrenValue.HasValue) - { - writer.WritePropertyName("min_children"); - writer.WriteNumberValue(MinChildrenValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class HasChildQueryDescriptor : SerializableDescriptor +public readonly partial struct HasChildQueryDescriptor { - internal HasChildQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasChildQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery instance) + { + Instance = instance; + } - public HasChildQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasChildQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action InnerHitsDescriptorAction { get; set; } - private int? MaxChildrenValue { get; set; } - private int? MinChildrenValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreModeValue { get; set; } - private string TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -369,10 +421,10 @@ public HasChildQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public HasChildQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -380,10 +432,10 @@ public HasChildQueryDescriptor Boost(float? boost) /// Indicates whether to ignore an unmapped type and not return any documents instead of an error. /// /// - public HasChildQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -391,28 +443,43 @@ public HasChildQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) /// If defined, each search hit will contain inner hits. /// /// - public HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = value; + return this; } - public HasChildQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits() { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public HasChildQueryDescriptor InnerHits(Action configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits(System.Action? action) + { + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; + } + + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor InnerHits(System.Action>? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -421,10 +488,10 @@ public HasChildQueryDescriptor InnerHits(Action /// - public HasChildQueryDescriptor MaxChildren(int? maxChildren) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor MaxChildren(int? value) { - MaxChildrenValue = maxChildren; - return Self; + Instance.MaxChildren = value; + return this; } /// @@ -433,10 +500,10 @@ public HasChildQueryDescriptor MaxChildren(int? maxChildren) /// If the parent document does not meet this limit, it is excluded from the search results. /// /// - public HasChildQueryDescriptor MinChildren(int? minChildren) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor MinChildren(int? value) { - MinChildrenValue = minChildren; - return Self; + Instance.MinChildren = value; + return this; } /// @@ -445,34 +512,40 @@ public HasChildQueryDescriptor MinChildren(int? minChildren) /// If a child document matches the search, the query returns the parent document. /// /// - public HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public HasChildQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query you wish to run on child documents of the type field. + /// If a child document matches the search, the query returns the parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasChildQueryDescriptor Query(Action configure) + /// + /// + /// Query you wish to run on child documents of the type field. + /// If a child document matches the search, the query returns the parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasChildQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -480,10 +553,10 @@ public HasChildQueryDescriptor QueryName(string? queryName) /// Indicates how scores for matching child documents affect the root parent document’s relevance score. /// /// - public HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } /// @@ -491,85 +564,17 @@ public HasChildQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl. /// Name of the child relationship mapped for the join field. /// /// - public HasChildQueryDescriptor Type(string type) + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor Type(string value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - if (MaxChildrenValue.HasValue) - { - writer.WritePropertyName("max_children"); - writer.WriteNumberValue(MaxChildrenValue.Value); - } - - if (MinChildrenValue.HasValue) - { - writer.WritePropertyName("min_children"); - writer.WriteNumberValue(MinChildrenValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasParentQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasParentQuery.g.cs index a7ef01711c0..22ea3783d2c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasParentQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/HasParentQuery.g.cs @@ -17,18 +17,131 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class HasParentQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropParentType = System.Text.Json.JsonEncodedText.Encode("parent_type"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScore = System.Text.Json.JsonEncodedText.Encode("score"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propInnerHits = default; + LocalJsonValue propParentType = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScore = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, null)) + { + continue; + } + + if (propParentType.TryReadProperty(ref reader, options, PropParentType, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScore.TryReadProperty(ref reader, options, PropScore, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + InnerHits = propInnerHits.Value, + ParentType = propParentType.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + Score = propScore.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, null); + writer.WriteProperty(options, PropParentType, value.ParentType, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScore, value.Score, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryConverter))] public sealed partial class HasParentQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasParentQuery(string parentType, Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + ParentType = parentType; + Query = query; + } +#if NET7_0_OR_GREATER + public HasParentQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HasParentQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +150,6 @@ public sealed partial class HasParentQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -46,7 +158,6 @@ public sealed partial class HasParentQuery /// You can use this parameter to query multiple indices that may not contain the parent_type. /// /// - [JsonInclude, JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } /// @@ -54,7 +165,6 @@ public sealed partial class HasParentQuery /// If defined, each search hit will contain inner hits. /// /// - [JsonInclude, JsonPropertyName("inner_hits")] public Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHits { get; set; } /// @@ -62,8 +172,11 @@ public sealed partial class HasParentQuery /// Name of the parent relationship mapped for the join field. /// /// - [JsonInclude, JsonPropertyName("parent_type")] - public string ParentType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ParentType { get; set; } /// /// @@ -71,9 +184,11 @@ public sealed partial class HasParentQuery /// If a parent document matches the search, the query returns its child documents. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } public string? QueryName { get; set; } /// @@ -81,31 +196,27 @@ public sealed partial class HasParentQuery /// Indicates whether the relevance score of a matching parent document is aggregated into its child documents. /// /// - [JsonInclude, JsonPropertyName("score")] public bool? Score { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(HasParentQuery hasParentQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.HasParent(hasParentQuery); } -public sealed partial class HasParentQueryDescriptor : SerializableDescriptor> +public readonly partial struct HasParentQueryDescriptor { - internal HasParentQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery Instance { get; init; } - public HasParentQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasParentQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action> InnerHitsDescriptorAction { get; set; } - private string ParentTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private bool? ScoreValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasParentQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -115,10 +226,10 @@ public HasParentQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public HasParentQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -127,10 +238,10 @@ public HasParentQueryDescriptor Boost(float? boost) /// You can use this parameter to query multiple indices that may not contain the parent_type. /// /// - public HasParentQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -138,28 +249,32 @@ public HasParentQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = /// If defined, each search hit will contain inner hits. /// /// - public HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = value; + return this; } - public HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits() { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public HasParentQueryDescriptor InnerHits(Action> configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits(System.Action>? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -167,10 +282,10 @@ public HasParentQueryDescriptor InnerHits(Actionjoin field. /// /// - public HasParentQueryDescriptor ParentType(string parentType) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor ParentType(string value) { - ParentTypeValue = parentType; - return Self; + Instance.ParentType = value; + return this; } /// @@ -179,34 +294,28 @@ public HasParentQueryDescriptor ParentType(string parentType) /// If a parent document matches the search, the query returns its child documents. /// /// - public HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) - { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; - } - - public HasParentQueryDescriptor Query(Action> configure) + /// + /// + /// Query you wish to run on parent documents of the parent_type field. + /// If a parent document matches the search, the query returns its child documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasParentQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -214,96 +323,39 @@ public HasParentQueryDescriptor QueryName(string? queryName) /// Indicates whether the relevance score of a matching parent document is aggregated into its child documents. /// /// - public HasParentQueryDescriptor Score(bool? score = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Score(bool? value = true) { - ScoreValue = score; - return Self; + Instance.Score = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - writer.WritePropertyName("parent_type"); - writer.WriteStringValue(ParentTypeValue); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreValue.HasValue) - { - writer.WritePropertyName("score"); - writer.WriteBooleanValue(ScoreValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class HasParentQueryDescriptor : SerializableDescriptor +public readonly partial struct HasParentQueryDescriptor { - internal HasParentQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery Instance { get; init; } - public HasParentQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasParentQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action InnerHitsDescriptorAction { get; set; } - private string ParentTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private bool? ScoreValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasParentQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -313,10 +365,10 @@ public HasParentQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public HasParentQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -325,10 +377,21 @@ public HasParentQueryDescriptor Boost(float? boost) /// You can use this parameter to query multiple indices that may not contain the parent_type. /// /// - public HasParentQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor IgnoreUnmapped(bool? value = true) + { + Instance.IgnoreUnmapped = value; + return this; + } + + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.InnerHits = value; + return this; } /// @@ -336,28 +399,32 @@ public HasParentQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) /// If defined, each search hit will contain inner hits. /// /// - public HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits() { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public HasParentQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits(System.Action? action) { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } - public HasParentQueryDescriptor InnerHits(Action configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor InnerHits(System.Action>? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -365,10 +432,10 @@ public HasParentQueryDescriptor InnerHits(Actionjoin field. /// /// - public HasParentQueryDescriptor ParentType(string parentType) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor ParentType(string value) { - ParentTypeValue = parentType; - return Self; + Instance.ParentType = value; + return this; } /// @@ -377,34 +444,40 @@ public HasParentQueryDescriptor ParentType(string parentType) /// If a parent document matches the search, the query returns its child documents. /// /// - public HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public HasParentQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query you wish to run on parent documents of the parent_type field. + /// If a parent document matches the search, the query returns its child documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasParentQueryDescriptor Query(Action configure) + /// + /// + /// Query you wish to run on parent documents of the parent_type field. + /// If a parent document matches the search, the query returns its child documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public HasParentQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -412,73 +485,17 @@ public HasParentQueryDescriptor QueryName(string? queryName) /// Indicates whether the relevance score of a matching parent document is aggregated into its child documents. /// /// - public HasParentQueryDescriptor Score(bool? score = true) + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor Score(bool? value = true) { - ScoreValue = score; - return Self; + Instance.Score = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - writer.WritePropertyName("parent_type"); - writer.WriteStringValue(ParentTypeValue); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreValue.HasValue) - { - writer.WritePropertyName("score"); - writer.WriteBooleanValue(ScoreValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs index f805f200673..245fe27b1cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs @@ -17,18 +17,88 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IdsQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + QueryName = propQueryName.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValues, value.Values, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryConverter))] public sealed partial class IdsQuery { +#if NET7_0_OR_GREATER + public IdsQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public IdsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IdsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,9 +107,7 @@ public sealed partial class IdsQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -47,26 +115,27 @@ public sealed partial class IdsQuery /// An array of document IDs. /// /// - [JsonInclude, JsonPropertyName("values")] public Elastic.Clients.Elasticsearch.Ids? Values { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Ids(idsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Ids(idsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Ids(idsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Ids(idsQuery); } -public sealed partial class IdsQueryDescriptor : SerializableDescriptor +public readonly partial struct IdsQueryDescriptor { - internal IdsQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IdsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery instance) + { + Instance = instance; + } - public IdsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IdsQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Ids? ValuesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery(Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -76,16 +145,16 @@ public IdsQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public IdsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public IdsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -93,33 +162,22 @@ public IdsQueryDescriptor QueryName(string? queryName) /// An array of document IDs. /// /// - public IdsQueryDescriptor Values(Elastic.Clients.Elasticsearch.Ids? values) + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor Values(Elastic.Clients.Elasticsearch.Ids? value) { - ValuesValue = values; - return Self; + Instance.Values = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) + if (action is null) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); + return new Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ValuesValue is not null) - { - writer.WritePropertyName("values"); - JsonSerializer.Serialize(writer, ValuesValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Intervals.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Intervals.g.cs index dc8261d52d0..8dab9b80ef0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Intervals.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Intervals.g.cs @@ -17,286 +17,597 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(IntervalsConverter))] -public sealed partial class Intervals +internal sealed partial class IntervalsConverter : System.Text.Json.Serialization.JsonConverter { - internal Intervals(string variantName, object variant) + private static readonly System.Text.Json.JsonEncodedText VariantAllOf = System.Text.Json.JsonEncodedText.Encode("all_of"); + private static readonly System.Text.Json.JsonEncodedText VariantAnyOf = System.Text.Json.JsonEncodedText.Encode("any_of"); + private static readonly System.Text.Json.JsonEncodedText VariantFuzzy = System.Text.Json.JsonEncodedText.Encode("fuzzy"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.Intervals Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Intervals AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => new Intervals("all_of", intervalsAllOf); - public static Intervals AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => new Intervals("any_of", intervalsAnyOf); - public static Intervals Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => new Intervals("fuzzy", intervalsFuzzy); - public static Intervals Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => new Intervals("match", intervalsMatch); - public static Intervals Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => new Intervals("prefix", intervalsPrefix); - public static Intervals Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => new Intervals("wildcard", intervalsWildcard); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class IntervalsConverter : JsonConverter -{ - public override Intervals Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAllOf)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAllOf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "all_of") + if (reader.ValueTextEquals(VariantAnyOf)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAnyOf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "any_of") + if (reader.ValueTextEquals(VariantFuzzy)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFuzzy.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fuzzy") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Intervals' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Intervals(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Intervals value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.Intervals value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "all_of": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf)value.Variant, options); - break; - case "any_of": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf)value.Variant, options); - break; - case "fuzzy": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard)value.Variant, options); - break; - } + case null: + break; + case "all_of": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf)value.Variant, null, null); + break; + case "any_of": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf)value.Variant, null, null); + break; + case "fuzzy": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.Intervals)}'."); } writer.WriteEndObject(); } } -public sealed partial class IntervalsDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsConverter))] +public sealed partial class Intervals +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Intervals() + { + } +#endif +#if !NET7_0_OR_GREATER + public Intervals() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? AllOf { get => GetVariant("all_of"); set => SetVariant("all_of", value); } + + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? AnyOf { get => GetVariant("any_of"); set => SetVariant("any_of", value); } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? Fuzzy { get => GetVariant("fuzzy"); set => SetVariant("fuzzy", value); } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { AllOf = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { AnyOf = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { Fuzzy = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { Match = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { Prefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard value) => new Elastic.Clients.Elasticsearch.QueryDsl.Intervals { Wildcard = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} + +public readonly partial struct IntervalsDescriptor { - internal IntervalsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.Intervals Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Intervals instance) + { + Instance = instance; + } - public IntervalsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Intervals instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) => descriptor.Instance; - private IntervalsDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.AllOf = value; + return this; } - private IntervalsDescriptor Set(object variant, string variantName) + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AllOf(System.Action> action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; } - public IntervalsDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => Set(intervalsAllOf, "all_of"); - public IntervalsDescriptor AllOf(Action> configure) => Set(configure, "all_of"); - public IntervalsDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => Set(intervalsAnyOf, "any_of"); - public IntervalsDescriptor AnyOf(Action> configure) => Set(configure, "any_of"); - public IntervalsDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => Set(intervalsFuzzy, "fuzzy"); - public IntervalsDescriptor Fuzzy(Action> configure) => Set(configure, "fuzzy"); - public IntervalsDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => Set(intervalsMatch, "match"); - public IntervalsDescriptor Match(Action> configure) => Set(configure, "match"); - public IntervalsDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => Set(intervalsPrefix, "prefix"); - public IntervalsDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public IntervalsDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => Set(intervalsWildcard, "wildcard"); - public IntervalsDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? value) + { + Instance.AnyOf = value; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AnyOf(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? value) + { + Instance.Fuzzy = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Fuzzy(System.Action> action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Intervals Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsDescriptor : SerializableDescriptor +public readonly partial struct IntervalsDescriptor { - internal IntervalsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.Intervals Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Intervals instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Intervals instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) => descriptor.Instance; - public IntervalsDescriptor() : base() + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? value) { + Instance.AllOf = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AllOf(System.Action action) + { + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; + } - private IntervalsDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AllOf(System.Action> action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; } - private IntervalsDescriptor Set(object variant, string variantName) + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.AnyOf = value; + return this; } - public IntervalsDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => Set(intervalsAllOf, "all_of"); - public IntervalsDescriptor AllOf(Action configure) => Set(configure, "all_of"); - public IntervalsDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => Set(intervalsAnyOf, "any_of"); - public IntervalsDescriptor AnyOf(Action configure) => Set(configure, "any_of"); - public IntervalsDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => Set(intervalsFuzzy, "fuzzy"); - public IntervalsDescriptor Fuzzy(Action configure) => Set(configure, "fuzzy"); - public IntervalsDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => Set(intervalsMatch, "match"); - public IntervalsDescriptor Match(Action configure) => Set(configure, "match"); - public IntervalsDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => Set(intervalsPrefix, "prefix"); - public IntervalsDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public IntervalsDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => Set(intervalsWildcard, "wildcard"); - public IntervalsDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AnyOf(System.Action action) + { + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor AnyOf(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? value) + { + Instance.Fuzzy = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Fuzzy(System.Action action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Fuzzy(System.Action> action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Match(System.Action action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Intervals Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.Intervals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAllOf.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAllOf.g.cs index b23b4fe152a..32c726ec3a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAllOf.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAllOf.g.cs @@ -17,24 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsAllOfConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIntervals = System.Text.Json.JsonEncodedText.Encode("intervals"); + private static readonly System.Text.Json.JsonEncodedText PropMaxGaps = System.Text.Json.JsonEncodedText.Encode("max_gaps"); + private static readonly System.Text.Json.JsonEncodedText PropOrdered = System.Text.Json.JsonEncodedText.Encode("ordered"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue> propIntervals = default; + LocalJsonValue propMaxGaps = default; + LocalJsonValue propOrdered = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIntervals.TryReadProperty(ref reader, options, PropIntervals, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMaxGaps.TryReadProperty(ref reader, options, PropMaxGaps, null)) + { + continue; + } + + if (propOrdered.TryReadProperty(ref reader, options, PropOrdered, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + Intervals = propIntervals.Value, + MaxGaps = propMaxGaps.Value, + Ordered = propOrdered.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIntervals, value.Intervals, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxGaps, value.MaxGaps, null, null); + writer.WriteProperty(options, PropOrdered, value.Ordered, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfConverter))] public sealed partial class IntervalsAllOf { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAllOf(System.Collections.Generic.ICollection intervals) + { + Intervals = intervals; + } +#if NET7_0_OR_GREATER + public IntervalsAllOf() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsAllOf() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Rule used to filter returned intervals. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? Filter { get; set; } /// @@ -42,8 +126,11 @@ public sealed partial class IntervalsAllOf /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. /// /// - [JsonInclude, JsonPropertyName("intervals")] - public ICollection Intervals { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Intervals { get; set; } /// /// @@ -51,7 +138,6 @@ public sealed partial class IntervalsAllOf /// Intervals produced by the rules further apart than this are not considered matches. /// /// - [JsonInclude, JsonPropertyName("max_gaps")] public int? MaxGaps { get; set; } /// @@ -59,58 +145,48 @@ public sealed partial class IntervalsAllOf /// If true, intervals produced by the rules should appear in the order in which they are specified. /// /// - [JsonInclude, JsonPropertyName("ordered")] public bool? Ordered { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsAllOf intervalsAllOf) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.AllOf(intervalsAllOf); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsAllOf intervalsAllOf) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.AllOf(intervalsAllOf); } -public sealed partial class IntervalsAllOfDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsAllOfDescriptor { - internal IntervalsAllOfDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAllOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf instance) + { + Instance = instance; + } - public IntervalsAllOfDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAllOfDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private ICollection IntervalsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor IntervalsDescriptor { get; set; } - private Action> IntervalsDescriptorAction { get; set; } - private Action>[] IntervalsDescriptorActions { get; set; } - private int? MaxGapsValue { get; set; } - private bool? OrderedValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor descriptor) => descriptor.Instance; /// /// /// Rule used to filter returned intervals. /// /// - public IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public IntervalsAllOfDescriptor Filter(Action> configure) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// @@ -118,40 +194,38 @@ public IntervalsAllOfDescriptor Filter(Action /// - public IntervalsAllOfDescriptor Intervals(ICollection intervals) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(System.Collections.Generic.ICollection value) { - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsValue = intervals; - return Self; + Instance.Intervals = value; + return this; } - public IntervalsAllOfDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) + /// + /// + /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(params Elastic.Clients.Elasticsearch.QueryDsl.Intervals[] values) { - IntervalsValue = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsDescriptor = descriptor; - return Self; + Instance.Intervals = [.. values]; + return this; } - public IntervalsAllOfDescriptor Intervals(Action> configure) + /// + /// + /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(params System.Action>[] actions) { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorActions = null; - IntervalsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); + } - public IntervalsAllOfDescriptor Intervals(params Action>[] configure) - { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = configure; - return Self; + Instance.Intervals = items; + return this; } /// @@ -160,10 +234,10 @@ public IntervalsAllOfDescriptor Intervals(params Action /// - public IntervalsAllOfDescriptor MaxGaps(int? maxGaps) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor MaxGaps(int? value) { - MaxGapsValue = maxGaps; - return Self; + Instance.MaxGaps = value; + return this; } /// @@ -171,123 +245,71 @@ public IntervalsAllOfDescriptor MaxGaps(int? maxGaps) /// If true, intervals produced by the rules should appear in the order in which they are specified. /// /// - public IntervalsAllOfDescriptor Ordered(bool? ordered = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Ordered(bool? value = true) { - OrderedValue = ordered; - return Self; + Instance.Ordered = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf Build(System.Action> action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IntervalsDescriptor is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IntervalsDescriptor, options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorAction is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(IntervalsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorActions is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - foreach (var action in IntervalsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("intervals"); - JsonSerializer.Serialize(writer, IntervalsValue, options); - } - - if (MaxGapsValue.HasValue) - { - writer.WritePropertyName("max_gaps"); - writer.WriteNumberValue(MaxGapsValue.Value); - } - - if (OrderedValue.HasValue) - { - writer.WritePropertyName("ordered"); - writer.WriteBooleanValue(OrderedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsAllOfDescriptor : SerializableDescriptor +public readonly partial struct IntervalsAllOfDescriptor { - internal IntervalsAllOfDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf Instance { get; init; } - public IntervalsAllOfDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAllOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private ICollection IntervalsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor IntervalsDescriptor { get; set; } - private Action IntervalsDescriptorAction { get; set; } - private Action[] IntervalsDescriptorActions { get; set; } - private int? MaxGapsValue { get; set; } - private bool? OrderedValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAllOfDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor descriptor) => descriptor.Instance; /// /// /// Rule used to filter returned intervals. /// /// - public IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public IntervalsAllOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } - public IntervalsAllOfDescriptor Filter(Action configure) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// @@ -295,40 +317,55 @@ public IntervalsAllOfDescriptor Filter(Action /// - public IntervalsAllOfDescriptor Intervals(ICollection intervals) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(System.Collections.Generic.ICollection value) { - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsValue = intervals; - return Self; + Instance.Intervals = value; + return this; } - public IntervalsAllOfDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) + /// + /// + /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(params Elastic.Clients.Elasticsearch.QueryDsl.Intervals[] values) { - IntervalsValue = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsDescriptor = descriptor; - return Self; + Instance.Intervals = [.. values]; + return this; } - public IntervalsAllOfDescriptor Intervals(Action configure) + /// + /// + /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(params System.Action[] actions) { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorActions = null; - IntervalsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); + } + + Instance.Intervals = items; + return this; } - public IntervalsAllOfDescriptor Intervals(params Action[] configure) + /// + /// + /// An array of rules to combine. All rules must produce a match in a document for the overall source to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Intervals(params System.Action>[] actions) { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); + } + + Instance.Intervals = items; + return this; } /// @@ -337,10 +374,10 @@ public IntervalsAllOfDescriptor Intervals(params Action /// - public IntervalsAllOfDescriptor MaxGaps(int? maxGaps) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor MaxGaps(int? value) { - MaxGapsValue = maxGaps; - return Self; + Instance.MaxGaps = value; + return this; } /// @@ -348,74 +385,17 @@ public IntervalsAllOfDescriptor MaxGaps(int? maxGaps) /// If true, intervals produced by the rules should appear in the order in which they are specified. /// /// - public IntervalsAllOfDescriptor Ordered(bool? ordered = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor Ordered(bool? value = true) { - OrderedValue = ordered; - return Self; + Instance.Ordered = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf Build(System.Action action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IntervalsDescriptor is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IntervalsDescriptor, options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorAction is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(IntervalsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorActions is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - foreach (var action in IntervalsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("intervals"); - JsonSerializer.Serialize(writer, IntervalsValue, options); - } - - if (MaxGapsValue.HasValue) - { - writer.WritePropertyName("max_gaps"); - writer.WriteNumberValue(MaxGapsValue.Value); - } - - if (OrderedValue.HasValue) - { - writer.WritePropertyName("ordered"); - writer.WriteBooleanValue(OrderedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAnyOf.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAnyOf.g.cs index 3507d232dac..7c2662dc30d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAnyOf.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsAnyOf.g.cs @@ -17,24 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsAnyOfConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropIntervals = System.Text.Json.JsonEncodedText.Encode("intervals"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFilter = default; + LocalJsonValue> propIntervals = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propIntervals.TryReadProperty(ref reader, options, PropIntervals, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + Intervals = propIntervals.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropIntervals, value.Intervals, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfConverter))] public sealed partial class IntervalsAnyOf { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAnyOf(System.Collections.Generic.ICollection intervals) + { + Intervals = intervals; + } +#if NET7_0_OR_GREATER + public IntervalsAnyOf() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsAnyOf() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Rule used to filter returned intervals. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? Filter { get; set; } /// @@ -42,56 +108,52 @@ public sealed partial class IntervalsAnyOf /// An array of rules to match. /// /// - [JsonInclude, JsonPropertyName("intervals")] - public ICollection Intervals { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsAnyOf intervalsAnyOf) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.AnyOf(intervalsAnyOf); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsAnyOf intervalsAnyOf) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.AnyOf(intervalsAnyOf); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Intervals { get; set; } } -public sealed partial class IntervalsAnyOfDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsAnyOfDescriptor { - internal IntervalsAnyOfDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAnyOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf instance) + { + Instance = instance; + } - public IntervalsAnyOfDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAnyOfDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private ICollection IntervalsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor IntervalsDescriptor { get; set; } - private Action> IntervalsDescriptorAction { get; set; } - private Action>[] IntervalsDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor descriptor) => descriptor.Instance; /// /// /// Rule used to filter returned intervals. /// /// - public IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public IntervalsAnyOfDescriptor Filter(Action> configure) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// @@ -99,139 +161,99 @@ public IntervalsAnyOfDescriptor Filter(Action /// - public IntervalsAnyOfDescriptor Intervals(ICollection intervals) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(System.Collections.Generic.ICollection value) { - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsValue = intervals; - return Self; + Instance.Intervals = value; + return this; } - public IntervalsAnyOfDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) - { - IntervalsValue = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsDescriptor = descriptor; - return Self; - } - - public IntervalsAnyOfDescriptor Intervals(Action> configure) - { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorActions = null; - IntervalsDescriptorAction = configure; - return Self; - } - - public IntervalsAnyOfDescriptor Intervals(params Action>[] configure) + /// + /// + /// An array of rules to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(params Elastic.Clients.Elasticsearch.QueryDsl.Intervals[] values) { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = configure; - return Self; + Instance.Intervals = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of rules to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IntervalsDescriptor is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IntervalsDescriptor, options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorAction is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(IntervalsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorActions is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - foreach (var action in IntervalsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("intervals"); - JsonSerializer.Serialize(writer, IntervalsValue, options); - } + Instance.Intervals = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsAnyOfDescriptor : SerializableDescriptor +public readonly partial struct IntervalsAnyOfDescriptor { - internal IntervalsAnyOfDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf Instance { get; init; } - public IntervalsAnyOfDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAnyOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private ICollection IntervalsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor IntervalsDescriptor { get; set; } - private Action IntervalsDescriptorAction { get; set; } - private Action[] IntervalsDescriptorActions { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsAnyOfDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor descriptor) => descriptor.Instance; /// /// /// Rule used to filter returned intervals. /// /// - public IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public IntervalsAnyOfDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } - public IntervalsAnyOfDescriptor Filter(Action configure) + /// + /// + /// Rule used to filter returned intervals. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Filter(System.Action> action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// @@ -239,92 +261,62 @@ public IntervalsAnyOfDescriptor Filter(Action /// - public IntervalsAnyOfDescriptor Intervals(ICollection intervals) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(System.Collections.Generic.ICollection value) { - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsValue = intervals; - return Self; + Instance.Intervals = value; + return this; } - public IntervalsAnyOfDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor descriptor) + /// + /// + /// An array of rules to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(params Elastic.Clients.Elasticsearch.QueryDsl.Intervals[] values) { - IntervalsValue = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = null; - IntervalsDescriptor = descriptor; - return Self; + Instance.Intervals = [.. values]; + return this; } - public IntervalsAnyOfDescriptor Intervals(Action configure) + /// + /// + /// An array of rules to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(params System.Action[] actions) { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorActions = null; - IntervalsDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); + } - public IntervalsAnyOfDescriptor Intervals(params Action[] configure) - { - IntervalsValue = null; - IntervalsDescriptor = null; - IntervalsDescriptorAction = null; - IntervalsDescriptorActions = configure; - return Self; + Instance.Intervals = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// An array of rules to match. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor Intervals(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action)); } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (IntervalsDescriptor is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IntervalsDescriptor, options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorAction is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(IntervalsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IntervalsDescriptorActions is not null) - { - writer.WritePropertyName("intervals"); - writer.WriteStartArray(); - foreach (var action in IntervalsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("intervals"); - JsonSerializer.Serialize(writer, IntervalsValue, options); - } + Instance.Intervals = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFilter.g.cs index 09e338e1fe9..47db45df36b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFilter.g.cs @@ -17,331 +17,832 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(IntervalsFilterConverter))] -public sealed partial class IntervalsFilter -{ - internal IntervalsFilter(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static IntervalsFilter After(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("after", intervalsContainer); - public static IntervalsFilter Before(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("before", intervalsContainer); - public static IntervalsFilter ContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("contained_by", intervalsContainer); - public static IntervalsFilter Containing(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("containing", intervalsContainer); - public static IntervalsFilter NotContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("not_contained_by", intervalsContainer); - public static IntervalsFilter NotContaining(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("not_containing", intervalsContainer); - public static IntervalsFilter NotOverlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("not_overlapping", intervalsContainer); - public static IntervalsFilter Overlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => new IntervalsFilter("overlapping", intervalsContainer); - public static IntervalsFilter Script(Elastic.Clients.Elasticsearch.Script script) => new IntervalsFilter("script", script); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class IntervalsFilterConverter : JsonConverter +internal sealed partial class IntervalsFilterConverter : System.Text.Json.Serialization.JsonConverter { - public override IntervalsFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText VariantAfter = System.Text.Json.JsonEncodedText.Encode("after"); + private static readonly System.Text.Json.JsonEncodedText VariantBefore = System.Text.Json.JsonEncodedText.Encode("before"); + private static readonly System.Text.Json.JsonEncodedText VariantContainedBy = System.Text.Json.JsonEncodedText.Encode("contained_by"); + private static readonly System.Text.Json.JsonEncodedText VariantContaining = System.Text.Json.JsonEncodedText.Encode("containing"); + private static readonly System.Text.Json.JsonEncodedText VariantNotContainedBy = System.Text.Json.JsonEncodedText.Encode("not_contained_by"); + private static readonly System.Text.Json.JsonEncodedText VariantNotContaining = System.Text.Json.JsonEncodedText.Encode("not_containing"); + private static readonly System.Text.Json.JsonEncodedText VariantNotOverlapping = System.Text.Json.JsonEncodedText.Encode("not_overlapping"); + private static readonly System.Text.Json.JsonEncodedText VariantOverlapping = System.Text.Json.JsonEncodedText.Encode("overlapping"); + private static readonly System.Text.Json.JsonEncodedText VariantScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAfter)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAfter.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "after") + if (reader.ValueTextEquals(VariantBefore)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantBefore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "before") + if (reader.ValueTextEquals(VariantContainedBy)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantContainedBy.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "contained_by") + if (reader.ValueTextEquals(VariantContaining)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantContaining.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "containing") + if (reader.ValueTextEquals(VariantNotContainedBy)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNotContainedBy.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "not_contained_by") + if (reader.ValueTextEquals(VariantNotContaining)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNotContaining.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "not_containing") + if (reader.ValueTextEquals(VariantNotOverlapping)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNotOverlapping.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "not_overlapping") + if (reader.ValueTextEquals(VariantOverlapping)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantOverlapping.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "overlapping") + if (reader.ValueTextEquals(VariantScript)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScript.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "script") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'IntervalsFilter' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new IntervalsFilter(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, IntervalsFilter value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "after": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "before": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "contained_by": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "containing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "not_contained_by": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "not_containing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "not_overlapping": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "overlapping": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, options); - break; - case "script": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Script)value.Variant, options); - break; - } + case null: + break; + case "after": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "before": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "contained_by": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "containing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "not_contained_by": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "not_containing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "not_overlapping": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "overlapping": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.Intervals)value.Variant, null, null); + break; + case "script": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Script)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter)}'."); } writer.WriteEndObject(); } } -public sealed partial class IntervalsFilterDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterConverter))] +public sealed partial class IntervalsFilter { - internal IntervalsFilterDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public IntervalsFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + public IntervalsFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public IntervalsFilterDescriptor() : base() + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? After { get => GetVariant("after"); set => SetVariant("after", value); } + + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? Before { get => GetVariant("before"); set => SetVariant("before", value); } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? ContainedBy { get => GetVariant("contained_by"); set => SetVariant("contained_by", value); } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? Containing { get => GetVariant("containing"); set => SetVariant("containing", value); } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? NotContainedBy { get => GetVariant("not_contained_by"); set => SetVariant("not_contained_by", value); } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? NotContaining { get => GetVariant("not_containing"); set => SetVariant("not_containing", value); } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? NotOverlapping { get => GetVariant("not_overlapping"); set => SetVariant("not_overlapping", value); } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.Intervals? Overlapping { get => GetVariant("overlapping"); set => SetVariant("overlapping", value); } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.Script? Script { get => GetVariant("script"); set => SetVariant("script", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Script value) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter { Script = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } +} + +public readonly partial struct IntervalsFilterDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter Instance { get; init; } - private IntervalsFilterDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFilterDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private IntervalsFilterDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFilterDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public IntervalsFilterDescriptor After(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "after"); - public IntervalsFilterDescriptor After(Action> configure) => Set(configure, "after"); - public IntervalsFilterDescriptor Before(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "before"); - public IntervalsFilterDescriptor Before(Action> configure) => Set(configure, "before"); - public IntervalsFilterDescriptor ContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "contained_by"); - public IntervalsFilterDescriptor ContainedBy(Action> configure) => Set(configure, "contained_by"); - public IntervalsFilterDescriptor Containing(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "containing"); - public IntervalsFilterDescriptor Containing(Action> configure) => Set(configure, "containing"); - public IntervalsFilterDescriptor NotContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_contained_by"); - public IntervalsFilterDescriptor NotContainedBy(Action> configure) => Set(configure, "not_contained_by"); - public IntervalsFilterDescriptor NotContaining(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_containing"); - public IntervalsFilterDescriptor NotContaining(Action> configure) => Set(configure, "not_containing"); - public IntervalsFilterDescriptor NotOverlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_overlapping"); - public IntervalsFilterDescriptor NotOverlapping(Action> configure) => Set(configure, "not_overlapping"); - public IntervalsFilterDescriptor Overlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "overlapping"); - public IntervalsFilterDescriptor Overlapping(Action> configure) => Set(configure, "overlapping"); - public IntervalsFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script script) => Set(script, "script"); - public IntervalsFilterDescriptor Script(Action configure) => Set(configure, "script"); + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor After(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.After = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor After(System.Action> action) + { + Instance.After = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Before(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.Before = value; + return this; + } + + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Before(System.Action> action) + { + Instance.Before = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor ContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.ContainedBy = value; + return this; + } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor ContainedBy(System.Action> action) + { + Instance.ContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Containing(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.Containing = value; + return this; + } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Containing(System.Action> action) + { + Instance.Containing = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotContainedBy = value; + return this; + } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContainedBy(System.Action> action) + { + Instance.NotContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContaining(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotContaining = value; + return this; + } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContaining(System.Action> action) + { + Instance.NotContaining = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotOverlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotOverlapping = value; + return this; + } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotOverlapping(System.Action> action) + { + Instance.NotOverlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Overlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.Overlapping = value; + return this; + } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Overlapping(System.Action> action) + { + Instance.Overlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsFilterDescriptor : SerializableDescriptor +public readonly partial struct IntervalsFilterDescriptor { - internal IntervalsFilterDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter Instance { get; init; } - public IntervalsFilterDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFilterDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFilterDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private IntervalsFilterDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor After(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.After = value; + return this; } - private IntervalsFilterDescriptor Set(object variant, string variantName) + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor After(System.Action action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.After = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; } - public IntervalsFilterDescriptor After(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "after"); - public IntervalsFilterDescriptor After(Action configure) => Set(configure, "after"); - public IntervalsFilterDescriptor Before(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "before"); - public IntervalsFilterDescriptor Before(Action configure) => Set(configure, "before"); - public IntervalsFilterDescriptor ContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "contained_by"); - public IntervalsFilterDescriptor ContainedBy(Action configure) => Set(configure, "contained_by"); - public IntervalsFilterDescriptor Containing(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "containing"); - public IntervalsFilterDescriptor Containing(Action configure) => Set(configure, "containing"); - public IntervalsFilterDescriptor NotContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_contained_by"); - public IntervalsFilterDescriptor NotContainedBy(Action configure) => Set(configure, "not_contained_by"); - public IntervalsFilterDescriptor NotContaining(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_containing"); - public IntervalsFilterDescriptor NotContaining(Action configure) => Set(configure, "not_containing"); - public IntervalsFilterDescriptor NotOverlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "not_overlapping"); - public IntervalsFilterDescriptor NotOverlapping(Action configure) => Set(configure, "not_overlapping"); - public IntervalsFilterDescriptor Overlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals intervalsContainer) => Set(intervalsContainer, "overlapping"); - public IntervalsFilterDescriptor Overlapping(Action configure) => Set(configure, "overlapping"); - public IntervalsFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script script) => Set(script, "script"); - public IntervalsFilterDescriptor Script(Action configure) => Set(configure, "script"); + /// + /// + /// Query used to return intervals that follow an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor After(System.Action> action) + { + Instance.After = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Before(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Before = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Before(System.Action action) + { + Instance.Before = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Query used to return intervals that occur before an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Before(System.Action> action) + { + Instance.Before = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor ContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.ContainedBy = value; + return this; + } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor ContainedBy(System.Action action) + { + Instance.ContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor ContainedBy(System.Action> action) + { + Instance.ContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Containing(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.Containing = value; + return this; + } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Containing(System.Action action) + { + Instance.Containing = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Containing(System.Action> action) + { + Instance.Containing = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContainedBy(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotContainedBy = value; + return this; + } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContainedBy(System.Action action) + { + Instance.NotContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that are not contained by an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContainedBy(System.Action> action) + { + Instance.NotContainedBy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContaining(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotContaining = value; + return this; + } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContaining(System.Action action) + { + Instance.NotContaining = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not contain an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotContaining(System.Action> action) + { + Instance.NotContaining = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotOverlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.NotOverlapping = value; + return this; + } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotOverlapping(System.Action action) + { + Instance.NotOverlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that do not overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor NotOverlapping(System.Action> action) + { + Instance.NotOverlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Overlapping(Elastic.Clients.Elasticsearch.QueryDsl.Intervals? value) + { + Instance.Overlapping = value; + return this; + } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Overlapping(System.Action action) + { + Instance.Overlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Query used to return intervals that overlap with an interval from the filter rule. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Overlapping(System.Action> action) + { + Instance.Overlapping = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsDescriptor.Build(action); + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script(Elastic.Clients.Elasticsearch.Script? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script() + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; + } + + /// + /// + /// Script used to return matching documents. + /// This script must return a boolean value: true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor Script(System.Action? action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFuzzy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFuzzy.g.cs index d89f5c56adf..dca4c85cd89 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFuzzy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsFuzzy.g.cs @@ -17,24 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsFuzzyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText PropTranspositions = System.Text.Json.JsonEncodedText.Encode("transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropUseField = System.Text.Json.JsonEncodedText.Encode("use_field"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propTerm = default; + LocalJsonValue propTranspositions = default; + LocalJsonValue propUseField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (propTerm.TryReadProperty(ref reader, options, PropTerm, null)) + { + continue; + } + + if (propTranspositions.TryReadProperty(ref reader, options, PropTranspositions, null)) + { + continue; + } + + if (propUseField.TryReadProperty(ref reader, options, PropUseField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Fuzziness = propFuzziness.Value, + PrefixLength = propPrefixLength.Value, + Term = propTerm.Value, + Transpositions = propTranspositions.Value, + UseField = propUseField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropTerm, value.Term, null, null); + writer.WriteProperty(options, PropTranspositions, value.Transpositions, null, null); + writer.WriteProperty(options, PropUseField, value.UseField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyConverter))] public sealed partial class IntervalsFuzzy { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFuzzy(string term) + { + Term = term; + } +#if NET7_0_OR_GREATER + public IntervalsFuzzy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsFuzzy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to normalize the term. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -42,7 +144,6 @@ public sealed partial class IntervalsFuzzy /// Maximum edit distance allowed for matching. /// /// - [JsonInclude, JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } /// @@ -50,7 +151,6 @@ public sealed partial class IntervalsFuzzy /// Number of beginning characters left unchanged when creating expansions. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } /// @@ -58,15 +158,17 @@ public sealed partial class IntervalsFuzzy /// The term to match. /// /// - [JsonInclude, JsonPropertyName("term")] - public string Term { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Term { get; set; } /// /// /// Indicates whether edits include transpositions of two adjacent characters (for example, ab to ba). /// /// - [JsonInclude, JsonPropertyName("transpositions")] public bool? Transpositions { get; set; } /// @@ -75,37 +177,37 @@ public sealed partial class IntervalsFuzzy /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - [JsonInclude, JsonPropertyName("use_field")] public Elastic.Clients.Elasticsearch.Field? UseField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsFuzzy intervalsFuzzy) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.Fuzzy(intervalsFuzzy); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsFuzzy intervalsFuzzy) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.Fuzzy(intervalsFuzzy); } -public sealed partial class IntervalsFuzzyDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsFuzzyDescriptor { - internal IntervalsFuzzyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy Instance { get; init; } - public IntervalsFuzzyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFuzzyDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string TermValue { get; set; } - private bool? TranspositionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFuzzyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to normalize the term. /// /// - public IntervalsFuzzyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -113,55 +215,54 @@ public IntervalsFuzzyDescriptor Analyzer(string? analyzer) /// Maximum edit distance allowed for matching. /// /// - public IntervalsFuzzyDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = value; + return this; } /// /// - /// Number of beginning characters left unchanged when creating expansions. + /// Maximum edit distance allowed for matching. /// /// - public IntervalsFuzzyDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Fuzziness(System.Func action) { - PrefixLengthValue = prefixLength; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// /// - /// The term to match. + /// Number of beginning characters left unchanged when creating expansions. /// /// - public IntervalsFuzzyDescriptor Term(string term) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor PrefixLength(int? value) { - TermValue = term; - return Self; + Instance.PrefixLength = value; + return this; } /// /// - /// Indicates whether edits include transpositions of two adjacent characters (for example, ab to ba). + /// The term to match. /// /// - public IntervalsFuzzyDescriptor Transpositions(bool? transpositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Term(string value) { - TranspositionsValue = transpositions; - return Self; + Instance.Term = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Indicates whether edits include transpositions of two adjacent characters (for example, ab to ba). /// /// - public IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Transpositions(bool? value = true) { - UseFieldValue = useField; - return Self; + Instance.Transpositions = value; + return this; } /// @@ -170,10 +271,10 @@ public IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearc /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsFuzzyDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -182,75 +283,49 @@ public IntervalsFuzzyDescriptor UseField(Expressionterm is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsFuzzyDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("term"); - writer.WriteStringValue(TermValue); - if (TranspositionsValue.HasValue) - { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(TranspositionsValue.Value); - } - - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsFuzzyDescriptor : SerializableDescriptor +public readonly partial struct IntervalsFuzzyDescriptor { - internal IntervalsFuzzyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFuzzyDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy instance) + { + Instance = instance; + } - public IntervalsFuzzyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsFuzzyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string TermValue { get; set; } - private bool? TranspositionsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to normalize the term. /// /// - public IntervalsFuzzyDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -258,55 +333,54 @@ public IntervalsFuzzyDescriptor Analyzer(string? analyzer) /// Maximum edit distance allowed for matching. /// /// - public IntervalsFuzzyDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = value; + return this; } /// /// - /// Number of beginning characters left unchanged when creating expansions. + /// Maximum edit distance allowed for matching. /// /// - public IntervalsFuzzyDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Fuzziness(System.Func action) { - PrefixLengthValue = prefixLength; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// /// - /// The term to match. + /// Number of beginning characters left unchanged when creating expansions. /// /// - public IntervalsFuzzyDescriptor Term(string term) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor PrefixLength(int? value) { - TermValue = term; - return Self; + Instance.PrefixLength = value; + return this; } /// /// - /// Indicates whether edits include transpositions of two adjacent characters (for example, ab to ba). + /// The term to match. /// /// - public IntervalsFuzzyDescriptor Transpositions(bool? transpositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Term(string value) { - TranspositionsValue = transpositions; - return Self; + Instance.Term = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Indicates whether edits include transpositions of two adjacent characters (for example, ab to ba). /// /// - public IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor Transpositions(bool? value = true) { - UseFieldValue = useField; - return Self; + Instance.Transpositions = value; + return this; } /// @@ -315,10 +389,10 @@ public IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearch.Field? us /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsFuzzyDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -327,47 +401,17 @@ public IntervalsFuzzyDescriptor UseField(Expressionterm is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsFuzzyDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("term"); - writer.WriteStringValue(TermValue); - if (TranspositionsValue.HasValue) - { - writer.WritePropertyName("transpositions"); - writer.WriteBooleanValue(TranspositionsValue.Value); - } - - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsMatch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsMatch.g.cs index 1303252ac15..800a6c26a73 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsMatch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsMatch.g.cs @@ -17,24 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsMatchConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMaxGaps = System.Text.Json.JsonEncodedText.Encode("max_gaps"); + private static readonly System.Text.Json.JsonEncodedText PropOrdered = System.Text.Json.JsonEncodedText.Encode("ordered"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropUseField = System.Text.Json.JsonEncodedText.Encode("use_field"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propFilter = default; + LocalJsonValue propMaxGaps = default; + LocalJsonValue propOrdered = default; + LocalJsonValue propQuery = default; + LocalJsonValue propUseField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, null)) + { + continue; + } + + if (propMaxGaps.TryReadProperty(ref reader, options, PropMaxGaps, null)) + { + continue; + } + + if (propOrdered.TryReadProperty(ref reader, options, PropOrdered, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propUseField.TryReadProperty(ref reader, options, PropUseField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Filter = propFilter.Value, + MaxGaps = propMaxGaps.Value, + Ordered = propOrdered.Value, + Query = propQuery.Value, + UseField = propUseField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, null); + writer.WriteProperty(options, PropMaxGaps, value.MaxGaps, null, null); + writer.WriteProperty(options, PropOrdered, value.Ordered, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropUseField, value.UseField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchConverter))] public sealed partial class IntervalsMatch { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsMatch(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public IntervalsMatch() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsMatch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to analyze terms in the query. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -42,7 +144,6 @@ public sealed partial class IntervalsMatch /// An optional interval filter. /// /// - [JsonInclude, JsonPropertyName("filter")] public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? Filter { get; set; } /// @@ -51,7 +152,6 @@ public sealed partial class IntervalsMatch /// Terms further apart than this are not considered matches. /// /// - [JsonInclude, JsonPropertyName("max_gaps")] public int? MaxGaps { get; set; } /// @@ -59,7 +159,6 @@ public sealed partial class IntervalsMatch /// If true, matching terms must appear in their specified order. /// /// - [JsonInclude, JsonPropertyName("ordered")] public bool? Ordered { get; set; } /// @@ -67,8 +166,11 @@ public sealed partial class IntervalsMatch /// Text you wish to find in the provided field. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } /// /// @@ -76,39 +178,37 @@ public sealed partial class IntervalsMatch /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - [JsonInclude, JsonPropertyName("use_field")] public Elastic.Clients.Elasticsearch.Field? UseField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsMatch intervalsMatch) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.Match(intervalsMatch); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsMatch intervalsMatch) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.Match(intervalsMatch); } -public sealed partial class IntervalsMatchDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsMatchDescriptor { - internal IntervalsMatchDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch Instance { get; init; } - public IntervalsMatchDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsMatchDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private int? MaxGapsValue { get; set; } - private bool? OrderedValue { get; set; } - private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsMatchDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to analyze terms in the query. /// /// - public IntervalsMatchDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -116,74 +216,55 @@ public IntervalsMatchDescriptor Analyzer(string? analyzer) /// An optional interval filter. /// /// - public IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) - { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; - } - - public IntervalsMatchDescriptor Filter(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = value; + return this; } /// /// - /// Maximum number of positions between the matching terms. - /// Terms further apart than this are not considered matches. + /// An optional interval filter. /// /// - public IntervalsMatchDescriptor MaxGaps(int? maxGaps) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Filter(System.Action> action) { - MaxGapsValue = maxGaps; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// /// - /// If true, matching terms must appear in their specified order. + /// Maximum number of positions between the matching terms. + /// Terms further apart than this are not considered matches. /// /// - public IntervalsMatchDescriptor Ordered(bool? ordered = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor MaxGaps(int? value) { - OrderedValue = ordered; - return Self; + Instance.MaxGaps = value; + return this; } /// /// - /// Text you wish to find in the provided field. + /// If true, matching terms must appear in their specified order. /// /// - public IntervalsMatchDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Ordered(bool? value = true) { - QueryValue = query; - return Self; + Instance.Ordered = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Text you wish to find in the provided field. /// /// - public IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Query(string value) { - UseFieldValue = useField; - return Self; + Instance.Query = value; + return this; } /// @@ -192,10 +273,10 @@ public IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearc /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsMatchDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -204,87 +285,49 @@ public IntervalsMatchDescriptor UseField(Expressionterm is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsMatchDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MaxGapsValue.HasValue) - { - writer.WritePropertyName("max_gaps"); - writer.WriteNumberValue(MaxGapsValue.Value); - } - - if (OrderedValue.HasValue) - { - writer.WritePropertyName("ordered"); - writer.WriteBooleanValue(OrderedValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsMatchDescriptor : SerializableDescriptor +public readonly partial struct IntervalsMatchDescriptor { - internal IntervalsMatchDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsMatchDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch instance) + { + Instance = instance; + } - public IntervalsMatchDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsMatchDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private int? MaxGapsValue { get; set; } - private bool? OrderedValue { get; set; } - private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to analyze terms in the query. /// /// - public IntervalsMatchDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -292,74 +335,66 @@ public IntervalsMatchDescriptor Analyzer(string? analyzer) /// An optional interval filter. /// /// - public IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? filter) - { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterValue = filter; - return Self; - } - - public IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter? value) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = value; + return this; } - public IntervalsMatchDescriptor Filter(Action configure) + /// + /// + /// An optional interval filter. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Filter(System.Action action) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = configure; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// /// - /// Maximum number of positions between the matching terms. - /// Terms further apart than this are not considered matches. + /// An optional interval filter. /// /// - public IntervalsMatchDescriptor MaxGaps(int? maxGaps) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Filter(System.Action> action) { - MaxGapsValue = maxGaps; - return Self; + Instance.Filter = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor.Build(action); + return this; } /// /// - /// If true, matching terms must appear in their specified order. + /// Maximum number of positions between the matching terms. + /// Terms further apart than this are not considered matches. /// /// - public IntervalsMatchDescriptor Ordered(bool? ordered = true) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor MaxGaps(int? value) { - OrderedValue = ordered; - return Self; + Instance.MaxGaps = value; + return this; } /// /// - /// Text you wish to find in the provided field. + /// If true, matching terms must appear in their specified order. /// /// - public IntervalsMatchDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Ordered(bool? value = true) { - QueryValue = query; - return Self; + Instance.Ordered = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Text you wish to find in the provided field. /// /// - public IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor Query(string value) { - UseFieldValue = useField; - return Self; + Instance.Query = value; + return this; } /// @@ -368,10 +403,10 @@ public IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearch.Field? us /// The term is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsMatchDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -380,57 +415,17 @@ public IntervalsMatchDescriptor UseField(Expressionterm is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsMatchDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilterDescriptor(FilterDescriptorAction), options); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterValue, options); - } - - if (MaxGapsValue.HasValue) - { - writer.WritePropertyName("max_gaps"); - writer.WriteNumberValue(MaxGapsValue.Value); - } - - if (OrderedValue.HasValue) - { - writer.WritePropertyName("ordered"); - writer.WriteBooleanValue(OrderedValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsPrefix.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsPrefix.g.cs index 118a55188ec..d353c7cdc98 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsPrefix.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsPrefix.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsPrefixConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText PropUseField = System.Text.Json.JsonEncodedText.Encode("use_field"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propPrefix = default; + LocalJsonValue propUseField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propPrefix.TryReadProperty(ref reader, options, PropPrefix, null)) + { + continue; + } + + if (propUseField.TryReadProperty(ref reader, options, PropUseField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Prefix = propPrefix.Value, + UseField = propUseField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropPrefix, value.Prefix, null, null); + writer.WriteProperty(options, PropUseField, value.UseField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixConverter))] public sealed partial class IntervalsPrefix { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsPrefix(string prefix) + { + Prefix = prefix; + } +#if NET7_0_OR_GREATER + public IntervalsPrefix() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsPrefix() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to analyze the prefix. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -42,8 +117,11 @@ public sealed partial class IntervalsPrefix /// Beginning characters of terms you wish to find in the top-level field. /// /// - [JsonInclude, JsonPropertyName("prefix")] - public string Prefix { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Prefix { get; set; } /// /// @@ -51,57 +129,48 @@ public sealed partial class IntervalsPrefix /// The prefix is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - [JsonInclude, JsonPropertyName("use_field")] public Elastic.Clients.Elasticsearch.Field? UseField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsPrefix intervalsPrefix) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.Prefix(intervalsPrefix); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsPrefix intervalsPrefix) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.Prefix(intervalsPrefix); } -public sealed partial class IntervalsPrefixDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsPrefixDescriptor { - internal IntervalsPrefixDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix Instance { get; init; } - public IntervalsPrefixDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsPrefixDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private string PrefixValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } - - /// - /// - /// Analyzer used to analyze the prefix. - /// - /// - public IntervalsPrefixDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsPrefixDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor descriptor) => descriptor.Instance; + /// /// - /// Beginning characters of terms you wish to find in the top-level field. + /// Analyzer used to analyze the prefix. /// /// - public IntervalsPrefixDescriptor Prefix(string prefix) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor Analyzer(string? value) { - PrefixValue = prefix; - return Self; + Instance.Analyzer = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The prefix is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Beginning characters of terms you wish to find in the top-level field. /// /// - public IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor Prefix(string value) { - UseFieldValue = useField; - return Self; + Instance.Prefix = value; + return this; } /// @@ -110,10 +179,10 @@ public IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsear /// The prefix is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsPrefixDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -122,77 +191,60 @@ public IntervalsPrefixDescriptor UseField(Expressionprefix is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsPrefixDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsPrefixDescriptor : SerializableDescriptor +public readonly partial struct IntervalsPrefixDescriptor { - internal IntervalsPrefixDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix Instance { get; init; } - public IntervalsPrefixDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsPrefixDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private string PrefixValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } - - /// - /// - /// Analyzer used to analyze the prefix. - /// - /// - public IntervalsPrefixDescriptor Analyzer(string? analyzer) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsPrefixDescriptor() { - AnalyzerValue = analyzer; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor descriptor) => descriptor.Instance; + /// /// - /// Beginning characters of terms you wish to find in the top-level field. + /// Analyzer used to analyze the prefix. /// /// - public IntervalsPrefixDescriptor Prefix(string prefix) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor Analyzer(string? value) { - PrefixValue = prefix; - return Self; + Instance.Analyzer = value; + return this; } /// /// - /// If specified, match intervals from this field rather than the top-level field. - /// The prefix is normalized using the search analyzer from this field, unless analyzer is specified separately. + /// Beginning characters of terms you wish to find in the top-level field. /// /// - public IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor Prefix(string value) { - UseFieldValue = useField; - return Self; + Instance.Prefix = value; + return this; } /// @@ -201,10 +253,10 @@ public IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsearch.Field? u /// The prefix is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsPrefixDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -213,29 +265,17 @@ public IntervalsPrefixDescriptor UseField(Expressionprefix is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsPrefixDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("prefix"); - writer.WriteStringValue(PrefixValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsQuery.g.cs index bf1ea817e74..daf99ae5fbb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsQuery.g.cs @@ -17,251 +17,404 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(IntervalsQueryConverter))] -public sealed partial class IntervalsQuery +internal sealed partial class IntervalsQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal IntervalsQuery(string variantName, object variant) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText VariantAllOf = System.Text.Json.JsonEncodedText.Encode("all_of"); + private static readonly System.Text.Json.JsonEncodedText VariantAnyOf = System.Text.Json.JsonEncodedText.Encode("any_of"); + private static readonly System.Text.Json.JsonEncodedText VariantFuzzy = System.Text.Json.JsonEncodedText.Encode("fuzzy"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static IntervalsQuery AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => new IntervalsQuery("all_of", intervalsAllOf); - public static IntervalsQuery AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => new IntervalsQuery("any_of", intervalsAnyOf); - public static IntervalsQuery Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => new IntervalsQuery("fuzzy", intervalsFuzzy); - public static IntervalsQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => new IntervalsQuery("match", intervalsMatch); - public static IntervalsQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => new IntervalsQuery("prefix", intervalsPrefix); - public static IntervalsQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => new IntervalsQuery("wildcard", intervalsWildcard); - - /// - /// - /// Floating point number used to decrease or increase the relevance scores of the query. - /// Boost values are relative to the default value of 1.0. - /// A boost value between 0 and 1.0 decreases the relevance score. - /// A value greater than 1.0 increases the relevance score. - /// - /// - [JsonInclude, JsonPropertyName("boost")] - public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("_name")] - public string? QueryName { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class IntervalsQueryConverter : JsonConverter -{ - public override IntervalsQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - object? variantValue = default; - string? variantNameValue = default; - float? boostValue = default; - string? queryNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "boost") + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) { - boostValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "_name") + if (reader.ValueTextEquals(VariantAllOf)) { - queryNameValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantAllOf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "all_of") + if (reader.ValueTextEquals(VariantAnyOf)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAnyOf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "any_of") + if (reader.ValueTextEquals(VariantFuzzy)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFuzzy.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fuzzy") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'IntervalsQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); reader.Read(); - var result = new IntervalsQuery(variantNameValue, variantValue); - result.Boost = boostValue; - result.Field = fieldName; - result.QueryName = queryNameValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Boost = propBoost.Value, + Field = propField.Value, + QueryName = propQueryName.Value + }; } - public override void Write(Utf8JsonWriter writer, IntervalsQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery value, System.Text.Json.JsonSerializerOptions options) { - if (value.Field is null) - throw new JsonException("Unable to serialize IntervalsQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); + writer.WritePropertyName(options, value.Field, null); writer.WriteStartObject(); - if (value.Boost.HasValue) + switch (value.VariantType) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); + case null: + break; + case "all_of": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf)value.Variant, null, null); + break; + case "any_of": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf)value.Variant, null, null); + break; + case "fuzzy": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery)}'."); } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryConverter))] +public sealed partial class IntervalsQuery +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public IntervalsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? AllOf { get => GetVariant("all_of"); set => SetVariant("all_of", value); } + + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? AnyOf { get => GetVariant("any_of"); set => SetVariant("any_of", value); } + + /// + /// + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? Fuzzy { get => GetVariant("fuzzy"); set => SetVariant("fuzzy", value); } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } - if (value.VariantName is not null && value.Variant is not null) + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public string? QueryName { get; set; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "all_of": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf)value.Variant, options); - break; - case "any_of": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf)value.Variant, options); - break; - case "fuzzy": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard)value.Variant, options); - break; - } + return result; } - writer.WriteEndObject(); - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class IntervalsQueryDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsQueryDescriptor { - internal IntervalsQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? value) + { + Instance.AllOf = value; + return this; + } + + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AllOf(System.Action> action) + { + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; + } - public IntervalsQueryDescriptor() : base() + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? value) + { + Instance.AnyOf = value; + return this; + } + + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AnyOf(System.Action> action) + { + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? value) + { + Instance.Fuzzy = value; + return this; + } + + /// + /// + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Fuzzy(System.Action> action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Match(System.Action> action) { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? value) + { + Instance.Prefix = value; + return this; + } - private IntervalsQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Prefix(System.Action> action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; } - private IntervalsQueryDescriptor Set(object variant, string variantName) + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Wildcard = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } /// /// @@ -271,205 +424,293 @@ private IntervalsQueryDescriptor Set(object variant, string variantNa /// A value greater than 1.0 increases the relevance score. /// /// - public IntervalsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public IntervalsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public IntervalsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public IntervalsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; + Instance.QueryName = value; + return this; } - public IntervalsQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public IntervalsQueryDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => Set(intervalsAllOf, "all_of"); - public IntervalsQueryDescriptor AllOf(Action> configure) => Set(configure, "all_of"); - public IntervalsQueryDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => Set(intervalsAnyOf, "any_of"); - public IntervalsQueryDescriptor AnyOf(Action> configure) => Set(configure, "any_of"); - public IntervalsQueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => Set(intervalsFuzzy, "fuzzy"); - public IntervalsQueryDescriptor Fuzzy(Action> configure) => Set(configure, "fuzzy"); - public IntervalsQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => Set(intervalsMatch, "match"); - public IntervalsQueryDescriptor Match(Action> configure) => Set(configure, "match"); - public IntervalsQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => Set(intervalsPrefix, "prefix"); - public IntervalsQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public IntervalsQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => Set(intervalsWildcard, "wildcard"); - public IntervalsQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); +public readonly partial struct IntervalsQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery instance) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } + Instance = instance; + } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor descriptor) => descriptor.Instance; - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf? value) + { + Instance.AllOf = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AllOf(System.Action action) + { + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; } -} -public sealed partial class IntervalsQueryDescriptor : SerializableDescriptor -{ - internal IntervalsQueryDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// Returns matches that span a combination of other rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AllOf(System.Action> action) + { + Instance.AllOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOfDescriptor.Build(action); + return this; + } - public IntervalsQueryDescriptor() : base() + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf? value) { + Instance.AnyOf = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AnyOf(System.Action action) + { + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; + } - private IntervalsQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Returns intervals produced by any of its sub-rules. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor AnyOf(System.Action> action) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.AnyOf = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOfDescriptor.Build(action); + return this; } - private IntervalsQueryDescriptor Set(object variant, string variantName) + /// + /// + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Fuzzy = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } + /// + /// + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Fuzzy(System.Action action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; + } /// /// - /// Floating point number used to decrease or increase the relevance scores of the query. - /// Boost values are relative to the default value of 1.0. - /// A boost value between 0 and 1.0 decreases the relevance score. - /// A value greater than 1.0 increases the relevance score. + /// Matches terms that are similar to the provided term, within an edit distance defined by fuzziness. /// /// - public IntervalsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Fuzzy(System.Action> action) { - BoostValue = boost; - return Self; + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzyDescriptor.Build(action); + return this; } - public IntervalsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch? value) { - FieldValue = field; - return Self; + Instance.Match = value; + return this; } - public IntervalsQueryDescriptor Field(Expression> field) + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Match(System.Action action) { - FieldValue = field; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; } - public IntervalsQueryDescriptor Field(Expression> field) + /// + /// + /// Matches analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Match(System.Action> action) { - FieldValue = field; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatchDescriptor.Build(action); + return this; } - public IntervalsQueryDescriptor QueryName(string? queryName) + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix? value) { - QueryNameValue = queryName; - return Self; + Instance.Prefix = value; + return this; } - public IntervalsQueryDescriptor AllOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAllOf intervalsAllOf) => Set(intervalsAllOf, "all_of"); - public IntervalsQueryDescriptor AllOf(Action configure) => Set(configure, "all_of"); - public IntervalsQueryDescriptor AnyOf(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsAnyOf intervalsAnyOf) => Set(intervalsAnyOf, "any_of"); - public IntervalsQueryDescriptor AnyOf(Action configure) => Set(configure, "any_of"); - public IntervalsQueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFuzzy intervalsFuzzy) => Set(intervalsFuzzy, "fuzzy"); - public IntervalsQueryDescriptor Fuzzy(Action configure) => Set(configure, "fuzzy"); - public IntervalsQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsMatch intervalsMatch) => Set(intervalsMatch, "match"); - public IntervalsQueryDescriptor Match(Action configure) => Set(configure, "match"); - public IntervalsQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefix intervalsPrefix) => Set(intervalsPrefix, "prefix"); - public IntervalsQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public IntervalsQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard intervalsWildcard) => Set(intervalsWildcard, "wildcard"); - public IntervalsQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Matches terms that start with a specified set of characters. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Prefix(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsPrefixDescriptor.Build(action); + return this; + } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard? value) + { + Instance.Wildcard = value; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Matches terms using a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsWildcard.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsWildcard.g.cs index aab99b10389..d15bccb1e00 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsWildcard.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IntervalsWildcard.g.cs @@ -17,25 +17,100 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class IntervalsWildcardConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropPattern = System.Text.Json.JsonEncodedText.Encode("pattern"); + private static readonly System.Text.Json.JsonEncodedText PropUseField = System.Text.Json.JsonEncodedText.Encode("use_field"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propPattern = default; + LocalJsonValue propUseField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propPattern.TryReadProperty(ref reader, options, PropPattern, null)) + { + continue; + } + + if (propUseField.TryReadProperty(ref reader, options, PropUseField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Pattern = propPattern.Value, + UseField = propUseField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropPattern, value.Pattern, null, null); + writer.WriteProperty(options, PropUseField, value.UseField, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardConverter))] public sealed partial class IntervalsWildcard { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsWildcard(string pattern) + { + Pattern = pattern; + } +#if NET7_0_OR_GREATER + public IntervalsWildcard() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IntervalsWildcard() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to analyze the pattern. /// Defaults to the top-level field's analyzer. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -43,8 +118,11 @@ public sealed partial class IntervalsWildcard /// Wildcard pattern used to find matching terms. /// /// - [JsonInclude, JsonPropertyName("pattern")] - public string Pattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Pattern { get; set; } /// /// @@ -52,24 +130,27 @@ public sealed partial class IntervalsWildcard /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - [JsonInclude, JsonPropertyName("use_field")] public Elastic.Clients.Elasticsearch.Field? UseField { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Intervals(IntervalsWildcard intervalsWildcard) => Elastic.Clients.Elasticsearch.QueryDsl.Intervals.Wildcard(intervalsWildcard); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery(IntervalsWildcard intervalsWildcard) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery.Wildcard(intervalsWildcard); } -public sealed partial class IntervalsWildcardDescriptor : SerializableDescriptor> +public readonly partial struct IntervalsWildcardDescriptor { - internal IntervalsWildcardDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard Instance { get; init; } - public IntervalsWildcardDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsWildcardDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private string PatternValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsWildcardDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor descriptor) => descriptor.Instance; /// /// @@ -77,10 +158,10 @@ public IntervalsWildcardDescriptor() : base() /// Defaults to the top-level field's analyzer. /// /// - public IntervalsWildcardDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -88,10 +169,10 @@ public IntervalsWildcardDescriptor Analyzer(string? analyzer) /// Wildcard pattern used to find matching terms. /// /// - public IntervalsWildcardDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor Pattern(string value) { - PatternValue = pattern; - return Self; + Instance.Pattern = value; + return this; } /// @@ -100,10 +181,10 @@ public IntervalsWildcardDescriptor Pattern(string pattern) /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -112,56 +193,39 @@ public IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticse /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsWildcardDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - /// - /// - /// If specified, match intervals from this field rather than the top-level field. - /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. - /// - /// - public IntervalsWildcardDescriptor UseField(Expression> useField) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard Build(System.Action> action) { - UseFieldValue = useField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IntervalsWildcardDescriptor : SerializableDescriptor +public readonly partial struct IntervalsWildcardDescriptor { - internal IntervalsWildcardDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsWildcardDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard instance) + { + Instance = instance; + } - public IntervalsWildcardDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IntervalsWildcardDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private string PatternValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? UseFieldValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard instance) => new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor descriptor) => descriptor.Instance; /// /// @@ -169,10 +233,10 @@ public IntervalsWildcardDescriptor() : base() /// Defaults to the top-level field's analyzer. /// /// - public IntervalsWildcardDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -180,10 +244,10 @@ public IntervalsWildcardDescriptor Analyzer(string? analyzer) /// Wildcard pattern used to find matching terms. /// /// - public IntervalsWildcardDescriptor Pattern(string pattern) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor Pattern(string value) { - PatternValue = pattern; - return Self; + Instance.Pattern = value; + return this; } /// @@ -192,10 +256,10 @@ public IntervalsWildcardDescriptor Pattern(string pattern) /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticsearch.Field? useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticsearch.Field? value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } /// @@ -204,41 +268,17 @@ public IntervalsWildcardDescriptor UseField(Elastic.Clients.Elasticsearch.Field? /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. /// /// - public IntervalsWildcardDescriptor UseField(Expression> useField) + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor UseField(System.Linq.Expressions.Expression> value) { - UseFieldValue = useField; - return Self; + Instance.UseField = value; + return this; } - /// - /// - /// If specified, match intervals from this field rather than the top-level field. - /// The pattern is normalized using the search analyzer from this field, unless analyzer is specified separately. - /// - /// - public IntervalsWildcardDescriptor UseField(Expression> useField) - { - UseFieldValue = useField; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - writer.WritePropertyName("pattern"); - writer.WriteStringValue(PatternValue); - if (UseFieldValue is not null) - { - writer.WritePropertyName("use_field"); - JsonSerializer.Serialize(writer, UseFieldValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcardDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.IntervalsWildcard(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs index f175c27f412..41ea1c1efa0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs @@ -17,32 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class LikeConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.Like Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.QueryDsl.Like(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.QueryDsl.Like(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.Like)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.Like value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Text that we want similar documents for or a lookup to a document's field for the text. /// -/// Learn more about this API in the Elasticsearch documentation. +/// Learn more about this API in the Elasticsearch documentation. /// -public sealed partial class Like : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.LikeConverter))] +public sealed partial class Like : Elastic.Clients.Elasticsearch.Union +{ + public Like(string value) : base(value) + { + } + + public Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Like(string value) => new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument value) => new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); +} + +public readonly partial struct LikeFactory { - public Like(string Text) : base(Text) + public Elastic.Clients.Elasticsearch.QueryDsl.Like Text(string value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document() + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document(System.Action>? action) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor.Build(action)); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Like Build(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.Like> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct LikeFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.Like Text(string value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document() + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor.Build(null)); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document(System.Action? action) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.Like Document(System.Action>? action) { + return new Elastic.Clients.Elasticsearch.QueryDsl.Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor.Build(action)); } - public Like(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Document) : base(Document) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Like Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/LikeDocument.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/LikeDocument.g.cs index 181ce211247..3b00df20070 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/LikeDocument.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/LikeDocument.g.cs @@ -17,27 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class LikeDocumentConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPerFieldAnalyzer = System.Text.Json.JsonEncodedText.Encode("per_field_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoc = default; + LocalJsonValue propFields = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue?> propPerFieldAnalyzer = default; + LocalJsonValue propRouting = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPerFieldAnalyzer.TryReadProperty(ref reader, options, PropPerFieldAnalyzer, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Doc = propDoc.Value, + Fields = propFields.Value, + Id = propId.Value, + Index = propIndex.Value, + PerFieldAnalyzer = propPerFieldAnalyzer.Value, + Routing = propRouting.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPerFieldAnalyzer, value.PerFieldAnalyzer, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentConverter))] public sealed partial class LikeDocument { +#if NET7_0_OR_GREATER + public LikeDocument() + { + } +#endif +#if !NET7_0_OR_GREATER + public LikeDocument() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A document not present in the index. /// /// - [JsonInclude, JsonPropertyName("doc")] public object? Doc { get; set; } - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(FieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -45,7 +157,6 @@ public sealed partial class LikeDocument /// ID of a document. /// /// - [JsonInclude, JsonPropertyName("_id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -53,7 +164,6 @@ public sealed partial class LikeDocument /// Index of a document. /// /// - [JsonInclude, JsonPropertyName("_index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -61,48 +171,52 @@ public sealed partial class LikeDocument /// Overrides the default analyzer. /// /// - [JsonInclude, JsonPropertyName("per_field_analyzer")] - public IDictionary? PerFieldAnalyzer { get; set; } - [JsonInclude, JsonPropertyName("routing")] + public System.Collections.Generic.IDictionary? PerFieldAnalyzer { get; set; } public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } - [JsonInclude, JsonPropertyName("version_type")] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } } -public sealed partial class LikeDocumentDescriptor : SerializableDescriptor> +public readonly partial struct LikeDocumentDescriptor { - internal LikeDocumentDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LikeDocumentDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument instance) + { + Instance = instance; + } - public LikeDocumentDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LikeDocumentDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private object? DocValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private IDictionary? PerFieldAnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument instance) => new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor descriptor) => descriptor.Instance; /// /// /// A document not present in the index. /// /// - public LikeDocumentDescriptor Doc(object? doc) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Doc(object? value) + { + Instance.Doc = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - DocValue = doc; - return Self; + Instance.Fields = value; + return this; } - public LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -110,10 +224,10 @@ public LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fi /// ID of a document. /// /// - public LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -121,10 +235,10 @@ public LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id /// Index of a document. /// /// - public LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -132,117 +246,120 @@ public LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.Ind /// Overrides the default analyzer. /// /// - public LikeDocumentDescriptor PerFieldAnalyzer(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer(System.Collections.Generic.IDictionary? value) { - PerFieldAnalyzerValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PerFieldAnalyzer = value; + return this; } - public LikeDocumentDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + /// + /// + /// Overrides the default analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer() { - RoutingValue = routing; - return Self; + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(null); + return this; } - public LikeDocumentDescriptor Version(long? version) + /// + /// + /// Overrides the default analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer(System.Action>? action) { - VersionValue = version; - return Self; + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(action); + return this; } - public LikeDocumentDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor AddPerFieldAnalyzer(Elastic.Clients.Elasticsearch.Field key, string value) { - VersionTypeValue = versionType; - return Self; + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor AddPerFieldAnalyzer(System.Linq.Expressions.Expression> key, string value) { - writer.WriteStartObject(); - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - JsonSerializer.Serialize(writer, DocValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; + } - if (PerFieldAnalyzerValue is not null) - { - writer.WritePropertyName("per_field_analyzer"); - JsonSerializer.Serialize(writer, PerFieldAnalyzerValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - if (VersionTypeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class LikeDocumentDescriptor : SerializableDescriptor +public readonly partial struct LikeDocumentDescriptor { - internal LikeDocumentDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Instance { get; init; } - public LikeDocumentDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LikeDocumentDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument instance) { + Instance = instance; } - private object? DocValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private IDictionary? PerFieldAnalyzerValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LikeDocumentDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument instance) => new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor descriptor) => descriptor.Instance; /// /// /// A document not present in the index. /// /// - public LikeDocumentDescriptor Doc(object? doc) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Doc(object? value) { - DocValue = doc; - return Self; + Instance.Doc = value; + return this; } - public LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; } /// @@ -250,10 +367,10 @@ public LikeDocumentDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? field /// ID of a document. /// /// - public LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -261,10 +378,10 @@ public LikeDocumentDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// Index of a document. /// /// - public LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -272,81 +389,87 @@ public LikeDocumentDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? ind /// Overrides the default analyzer. /// /// - public LikeDocumentDescriptor PerFieldAnalyzer(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer(System.Collections.Generic.IDictionary? value) { - PerFieldAnalyzerValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.PerFieldAnalyzer = value; + return this; } - public LikeDocumentDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + /// + /// + /// Overrides the default analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer() { - RoutingValue = routing; - return Self; + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(null); + return this; } - public LikeDocumentDescriptor Version(long? version) + /// + /// + /// Overrides the default analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer(System.Action? action) { - VersionValue = version; - return Self; + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(action); + return this; } - public LikeDocumentDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + /// + /// + /// Overrides the default analyzer. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor PerFieldAnalyzer(System.Action>? action) { - VersionTypeValue = versionType; - return Self; + Instance.PerFieldAnalyzer = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldString.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor AddPerFieldAnalyzer(Elastic.Clients.Elasticsearch.Field key, string value) { - writer.WriteStartObject(); - if (DocValue is not null) - { - writer.WritePropertyName("doc"); - JsonSerializer.Serialize(writer, DocValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IdValue is not null) - { - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - } + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; + } - if (IndexValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor AddPerFieldAnalyzer(System.Linq.Expressions.Expression> key, string value) + { + Instance.PerFieldAnalyzer ??= new System.Collections.Generic.Dictionary(); + Instance.PerFieldAnalyzer.Add(key, value); + return this; + } - if (PerFieldAnalyzerValue is not null) - { - writer.WritePropertyName("per_field_analyzer"); - JsonSerializer.Serialize(writer, PerFieldAnalyzerValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) + { + Instance.Routing = value; + return this; + } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - if (VersionTypeValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocumentDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.LikeDocument(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs index d3a4a66a503..8387034c1f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class MatchAllQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryConverter))] public sealed partial class MatchAllQuery { +#if NET7_0_OR_GREATER + public MatchAllQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public MatchAllQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchAllQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,27 +98,28 @@ public sealed partial class MatchAllQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchAll(matchAllQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.MatchAll(matchAllQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.MatchAll(matchAllQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.MatchAll(matchAllQuery); } -public sealed partial class MatchAllQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchAllQueryDescriptor { - internal MatchAllQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery Instance { get; init; } - public MatchAllQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchAllQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchAllQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -67,33 +129,28 @@ public MatchAllQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public MatchAllQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchAllQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) + if (action is null) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs index 4d56cdd27b8..341261a8d6b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchBoolPrefixQuery.g.cs @@ -17,189 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class MatchBoolPrefixQueryConverter : JsonConverter +internal sealed partial class MatchBoolPrefixQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override MatchBoolPrefixQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyRewrite = System.Text.Json.JsonEncodedText.Encode("fuzzy_rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyTranspositions = System.Text.Json.JsonEncodedText.Encode("fuzzy_transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropMaxExpansions = System.Text.Json.JsonEncodedText.Encode("max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropOperator = System.Text.Json.JsonEncodedText.Encode("operator"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new MatchBoolPrefixQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "analyzer") - { - variant.Analyzer = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzziness") - { - variant.Fuzziness = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzzy_rewrite") - { - variant.FuzzyRewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzzy_transpositions") - { - variant.FuzzyTranspositions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_expansions") - { - variant.MaxExpansions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "minimum_should_match") - { - variant.MinimumShouldMatch = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "operator") - { - variant.Operator = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "prefix_length") - { - variant.PrefixLength = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Query = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, MatchBoolPrefixQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize MatchBoolPrefixQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Analyzer)) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propFuzzyRewrite = default; + LocalJsonValue propFuzzyTranspositions = default; + LocalJsonValue propMaxExpansions = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propOperator = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(value.Analyzer); - } + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.Fuzziness is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, value.Fuzziness, options); - } + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.FuzzyRewrite)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(value.FuzzyRewrite); - } + if (propFuzzyRewrite.TryReadProperty(ref reader, options, PropFuzzyRewrite, null)) + { + continue; + } - if (value.FuzzyTranspositions.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(value.FuzzyTranspositions.Value); - } + if (propFuzzyTranspositions.TryReadProperty(ref reader, options, PropFuzzyTranspositions, null)) + { + continue; + } - if (value.MaxExpansions.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(value.MaxExpansions.Value); - } + if (propMaxExpansions.TryReadProperty(ref reader, options, PropMaxExpansions, null)) + { + continue; + } - if (value.MinimumShouldMatch is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, value.MinimumShouldMatch, options); - } + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } - if (value.Operator is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, value.Operator, options); - } + if (propOperator.TryReadProperty(ref reader, options, PropOperator, null)) + { + continue; + } - if (value.PrefixLength.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(value.PrefixLength.Value); - } + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(value.Query); - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + Field = propField.Value, + Fuzziness = propFuzziness.Value, + FuzzyRewrite = propFuzzyRewrite.Value, + FuzzyTranspositions = propFuzzyTranspositions.Value, + MaxExpansions = propMaxExpansions.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Operator = propOperator.Value, + PrefixLength = propPrefixLength.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropFuzzyRewrite, value.FuzzyRewrite, null, null); + writer.WriteProperty(options, PropFuzzyTranspositions, value.FuzzyTranspositions, null, null); + writer.WriteProperty(options, PropMaxExpansions, value.MaxExpansions, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropOperator, value.Operator, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(MatchBoolPrefixQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryConverter))] public sealed partial class MatchBoolPrefixQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Field field, string query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public MatchBoolPrefixQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert the text in the query value into tokens. @@ -216,7 +216,11 @@ public MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -280,42 +284,42 @@ public MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// The last term is used in a prefix query. /// /// - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchBoolPrefixQuery matchBoolPrefixQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchBoolPrefix(matchBoolPrefixQuery); } -public sealed partial class MatchBoolPrefixQueryDescriptor : SerializableDescriptor> +public readonly partial struct MatchBoolPrefixQueryDescriptor { - internal MatchBoolPrefixQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery Instance { get; init; } - public MatchBoolPrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchBoolPrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchBoolPrefixQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchBoolPrefixQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -326,28 +330,34 @@ public MatchBoolPrefixQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchBoolPrefixQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Expression> field) + /// + /// + /// Maximum edit distance allowed for matching. + /// Can be applied to the term subqueries constructed for all terms but the final term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldValue = field; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -356,10 +366,10 @@ public MatchBoolPrefixQueryDescriptor Field(Expression /// - public MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -368,10 +378,10 @@ public MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elast /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -380,10 +390,10 @@ public MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? fuzzyRewri /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -392,10 +402,10 @@ public MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? fuzzy /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -404,10 +414,10 @@ public MatchBoolPrefixQueryDescriptor MaxExpansions(int? maxExpansion /// Applied to the constructed bool query. /// /// - public MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -416,10 +426,10 @@ public MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clie /// Applied to the constructed bool query. /// /// - public MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -428,10 +438,10 @@ public MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasti /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -440,122 +450,55 @@ public MatchBoolPrefixQueryDescriptor PrefixLength(int? prefixLength) /// The last term is used in a prefix query. /// /// - public MatchBoolPrefixQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchBoolPrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MatchBoolPrefixQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchBoolPrefixQueryDescriptor { - internal MatchBoolPrefixQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery Instance { get; init; } - public MatchBoolPrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchBoolPrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchBoolPrefixQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchBoolPrefixQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -566,28 +509,34 @@ public MatchBoolPrefixQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchBoolPrefixQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchBoolPrefixQueryDescriptor Field(Expression> field) + /// + /// + /// Maximum edit distance allowed for matching. + /// Can be applied to the term subqueries constructed for all terms but the final term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldValue = field; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -596,10 +545,10 @@ public MatchBoolPrefixQueryDescriptor Field(Expression /// - public MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -608,10 +557,10 @@ public MatchBoolPrefixQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fu /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -620,10 +569,10 @@ public MatchBoolPrefixQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -632,10 +581,10 @@ public MatchBoolPrefixQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositi /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -644,10 +593,10 @@ public MatchBoolPrefixQueryDescriptor MaxExpansions(int? maxExpansions) /// Applied to the constructed bool query. /// /// - public MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -656,10 +605,10 @@ public MatchBoolPrefixQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elastic /// Applied to the constructed bool query. /// /// - public MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -668,10 +617,10 @@ public MatchBoolPrefixQueryDescriptor Operator(Elastic.Clients.Elasticsearch.Que /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MatchBoolPrefixQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -680,88 +629,23 @@ public MatchBoolPrefixQueryDescriptor PrefixLength(int? prefixLength) /// The last term is used in a prefix query. /// /// - public MatchBoolPrefixQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchBoolPrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchNoneQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchNoneQuery.g.cs index df46a139f4c..d675eb01e36 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchNoneQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchNoneQuery.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class MatchNoneQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryConverter))] public sealed partial class MatchNoneQuery { +#if NET7_0_OR_GREATER + public MatchNoneQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public MatchNoneQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchNoneQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,24 +98,28 @@ public sealed partial class MatchNoneQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchNoneQuery matchNoneQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchNone(matchNoneQuery); } -public sealed partial class MatchNoneQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchNoneQueryDescriptor { - internal MatchNoneQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery Instance { get; init; } - public MatchNoneQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchNoneQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchNoneQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -64,33 +129,28 @@ public MatchNoneQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public MatchNoneQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchNoneQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) + if (action is null) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs index 3a1f22002b6..ab695bd426f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhrasePrefixQuery.g.cs @@ -17,141 +17,153 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class MatchPhrasePrefixQueryConverter : JsonConverter +internal sealed partial class MatchPhrasePrefixQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override MatchPhrasePrefixQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropMaxExpansions = System.Text.Json.JsonEncodedText.Encode("max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropSlop = System.Text.Json.JsonEncodedText.Encode("slop"); + private static readonly System.Text.Json.JsonEncodedText PropZeroTermsQuery = System.Text.Json.JsonEncodedText.Encode("zero_terms_query"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new MatchPhrasePrefixQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "analyzer") - { - variant.Analyzer = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_expansions") - { - variant.MaxExpansions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "slop") - { - variant.Slop = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "zero_terms_query") - { - variant.ZeroTermsQuery = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Query = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, MatchPhrasePrefixQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize MatchPhrasePrefixQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Analyzer)) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propMaxExpansions = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propSlop = default; + LocalJsonValue propZeroTermsQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(value.Analyzer); - } + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.MaxExpansions.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(value.MaxExpansions.Value); - } + if (propMaxExpansions.TryReadProperty(ref reader, options, PropMaxExpansions, null)) + { + continue; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(value.Query); - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.Slop.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(value.Slop.Value); + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propSlop.TryReadProperty(ref reader, options, PropSlop, null)) + { + continue; + } + + if (propZeroTermsQuery.TryReadProperty(ref reader, options, PropZeroTermsQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ZeroTermsQuery is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, value.ZeroTermsQuery, options); - } + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + Field = propField.Value, + MaxExpansions = propMaxExpansions.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + Slop = propSlop.Value, + ZeroTermsQuery = propZeroTermsQuery.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropMaxExpansions, value.MaxExpansions, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropSlop, value.Slop, null, null); + writer.WriteProperty(options, PropZeroTermsQuery, value.ZeroTermsQuery, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(MatchPhrasePrefixQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryConverter))] public sealed partial class MatchPhrasePrefixQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Field field, string query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public MatchPhrasePrefixQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert text in the query value into tokens. @@ -168,7 +180,11 @@ public MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -182,7 +198,11 @@ public MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// Text you wish to find in the provided field. /// /// - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -198,36 +218,36 @@ public MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchPhrasePrefixQuery matchPhrasePrefixQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchPhrasePrefix(matchPhrasePrefixQuery); } -public sealed partial class MatchPhrasePrefixQueryDescriptor : SerializableDescriptor> +public readonly partial struct MatchPhrasePrefixQueryDescriptor { - internal MatchPhrasePrefixQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhrasePrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery instance) + { + Instance = instance; + } - public MatchPhrasePrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhrasePrefixQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert text in the query value into tokens. /// /// - public MatchPhrasePrefixQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -238,28 +258,22 @@ public MatchPhrasePrefixQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchPhrasePrefixQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public MatchPhrasePrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public MatchPhrasePrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchPhrasePrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -267,10 +281,10 @@ public MatchPhrasePrefixQueryDescriptor Field(Expression /// - public MatchPhrasePrefixQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -278,16 +292,16 @@ public MatchPhrasePrefixQueryDescriptor MaxExpansions(int? maxExpansi /// Text you wish to find in the provided field. /// /// - public MatchPhrasePrefixQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchPhrasePrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -295,10 +309,10 @@ public MatchPhrasePrefixQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MatchPhrasePrefixQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -306,88 +320,49 @@ public MatchPhrasePrefixQueryDescriptor Slop(int? slop) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchPhrasePrefixQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MatchPhrasePrefixQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchPhrasePrefixQueryDescriptor { - internal MatchPhrasePrefixQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhrasePrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery instance) + { + Instance = instance; + } - public MatchPhrasePrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhrasePrefixQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert text in the query value into tokens. /// /// - public MatchPhrasePrefixQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -398,28 +373,22 @@ public MatchPhrasePrefixQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchPhrasePrefixQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchPhrasePrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchPhrasePrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public MatchPhrasePrefixQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -427,10 +396,10 @@ public MatchPhrasePrefixQueryDescriptor Field(Expression /// - public MatchPhrasePrefixQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -438,16 +407,16 @@ public MatchPhrasePrefixQueryDescriptor MaxExpansions(int? maxExpansions) /// Text you wish to find in the provided field. /// /// - public MatchPhrasePrefixQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchPhrasePrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -455,10 +424,10 @@ public MatchPhrasePrefixQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MatchPhrasePrefixQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -466,58 +435,17 @@ public MatchPhrasePrefixQueryDescriptor Slop(int? slop) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchPhrasePrefixQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs index ff6632c7399..4250d0d893e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchPhraseQuery.g.cs @@ -17,129 +17,144 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class MatchPhraseQueryConverter : JsonConverter +internal sealed partial class MatchPhraseQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override MatchPhraseQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropSlop = System.Text.Json.JsonEncodedText.Encode("slop"); + private static readonly System.Text.Json.JsonEncodedText PropZeroTermsQuery = System.Text.Json.JsonEncodedText.Encode("zero_terms_query"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new MatchPhraseQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "analyzer") - { - variant.Analyzer = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "slop") - { - variant.Slop = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "zero_terms_query") - { - variant.ZeroTermsQuery = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Query = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, MatchPhraseQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize MatchPhraseQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Analyzer)) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propSlop = default; + LocalJsonValue propZeroTermsQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(value.Analyzer); - } + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - writer.WritePropertyName("query"); - writer.WriteStringValue(value.Query); - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - if (value.Slop.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(value.Slop.Value); + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propSlop.TryReadProperty(ref reader, options, PropSlop, null)) + { + continue; + } + + if (propZeroTermsQuery.TryReadProperty(ref reader, options, PropZeroTermsQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ZeroTermsQuery is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, value.ZeroTermsQuery, options); - } + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + Field = propField.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + Slop = propSlop.Value, + ZeroTermsQuery = propZeroTermsQuery.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropSlop, value.Slop, null, null); + writer.WriteProperty(options, PropZeroTermsQuery, value.ZeroTermsQuery, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(MatchPhraseQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryConverter))] public sealed partial class MatchPhraseQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public MatchPhraseQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhraseQuery(Elastic.Clients.Elasticsearch.Field field, string query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public MatchPhraseQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert the text in the query value into tokens. @@ -156,14 +171,22 @@ public MatchPhraseQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Query terms that are analyzed and turned into a phrase query. /// /// - public string Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -179,35 +202,36 @@ public MatchPhraseQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchPhraseQuery matchPhraseQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchPhrase(matchPhraseQuery); } -public sealed partial class MatchPhraseQueryDescriptor : SerializableDescriptor> +public readonly partial struct MatchPhraseQueryDescriptor { - internal MatchPhraseQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhraseQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery instance) + { + Instance = instance; + } - public MatchPhraseQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhraseQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchPhraseQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -218,28 +242,22 @@ public MatchPhraseQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchPhraseQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchPhraseQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchPhraseQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public MatchPhraseQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -247,16 +265,16 @@ public MatchPhraseQueryDescriptor Field(Expression /// - public MatchPhraseQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchPhraseQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -264,10 +282,10 @@ public MatchPhraseQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MatchPhraseQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -275,81 +293,49 @@ public MatchPhraseQueryDescriptor Slop(int? slop) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchPhraseQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MatchPhraseQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchPhraseQueryDescriptor { - internal MatchPhraseQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery Instance { get; init; } - public MatchPhraseQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhraseQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchPhraseQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchPhraseQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -360,28 +346,22 @@ public MatchPhraseQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MatchPhraseQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public MatchPhraseQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public MatchPhraseQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchPhraseQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -389,16 +369,16 @@ public MatchPhraseQueryDescriptor Field(Expression /// - public MatchPhraseQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchPhraseQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -406,10 +386,10 @@ public MatchPhraseQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MatchPhraseQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -417,52 +397,17 @@ public MatchPhraseQueryDescriptor Slop(int? slop) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchPhraseQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs index 21611f7384a..435a43bf959 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs @@ -17,225 +17,231 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class MatchQueryConverter : JsonConverter +internal sealed partial class MatchQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override MatchQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropAutoGenerateSynonymsPhraseQuery = System.Text.Json.JsonEncodedText.Encode("auto_generate_synonyms_phrase_query"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCutoffFrequency = System.Text.Json.JsonEncodedText.Encode("cutoff_frequency"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyRewrite = System.Text.Json.JsonEncodedText.Encode("fuzzy_rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyTranspositions = System.Text.Json.JsonEncodedText.Encode("fuzzy_transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropMaxExpansions = System.Text.Json.JsonEncodedText.Encode("max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropOperator = System.Text.Json.JsonEncodedText.Encode("operator"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropZeroTermsQuery = System.Text.Json.JsonEncodedText.Encode("zero_terms_query"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new MatchQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "analyzer") - { - variant.Analyzer = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "auto_generate_synonyms_phrase_query") - { - variant.AutoGenerateSynonymsPhraseQuery = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzziness") - { - variant.Fuzziness = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzzy_rewrite") - { - variant.FuzzyRewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "fuzzy_transpositions") - { - variant.FuzzyTranspositions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lenient") - { - variant.Lenient = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_expansions") - { - variant.MaxExpansions = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "minimum_should_match") - { - variant.MinimumShouldMatch = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "operator") - { - variant.Operator = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "prefix_length") - { - variant.PrefixLength = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "query") - { - variant.Query = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "zero_terms_query") - { - variant.ZeroTermsQuery = JsonSerializer.Deserialize(ref reader, options); - continue; - } + Field = propField.Value, + Query = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propAutoGenerateSynonymsPhraseQuery = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCutoffFrequency = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propFuzzyRewrite = default; + LocalJsonValue propFuzzyTranspositions = default; + LocalJsonValue propLenient = default; + LocalJsonValue propMaxExpansions = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propOperator = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propZeroTermsQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; } - } - reader.Read(); - return variant; - } + if (propAutoGenerateSynonymsPhraseQuery.TryReadProperty(ref reader, options, PropAutoGenerateSynonymsPhraseQuery, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, MatchQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize MatchQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(value.Analyzer)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(value.Analyzer); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.AutoGenerateSynonymsPhraseQuery.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(value.AutoGenerateSynonymsPhraseQuery.Value); - } + if (propCutoffFrequency.TryReadProperty(ref reader, options, PropCutoffFrequency, null)) + { + continue; + } - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } - if (value.Fuzziness is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, value.Fuzziness, options); - } + if (propFuzzyRewrite.TryReadProperty(ref reader, options, PropFuzzyRewrite, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.FuzzyRewrite)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(value.FuzzyRewrite); - } + if (propFuzzyTranspositions.TryReadProperty(ref reader, options, PropFuzzyTranspositions, null)) + { + continue; + } - if (value.FuzzyTranspositions.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(value.FuzzyTranspositions.Value); - } + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } - if (value.Lenient.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(value.Lenient.Value); - } + if (propMaxExpansions.TryReadProperty(ref reader, options, PropMaxExpansions, null)) + { + continue; + } - if (value.MaxExpansions.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(value.MaxExpansions.Value); - } + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } - if (value.MinimumShouldMatch is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, value.MinimumShouldMatch, options); - } + if (propOperator.TryReadProperty(ref reader, options, PropOperator, null)) + { + continue; + } - if (value.Operator is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, value.Operator, options); - } + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } - if (value.PrefixLength.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(value.PrefixLength.Value); - } + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, value.Query, options); - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.ZeroTermsQuery is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, value.ZeroTermsQuery, options); + if (propZeroTermsQuery.TryReadProperty(ref reader, options, PropZeroTermsQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + AutoGenerateSynonymsPhraseQuery = propAutoGenerateSynonymsPhraseQuery.Value, + Boost = propBoost.Value, +#pragma warning disable CS0618 + CutoffFrequency = propCutoffFrequency.Value +#pragma warning restore CS0618 + , + Field = propField.Value, + Fuzziness = propFuzziness.Value, + FuzzyRewrite = propFuzzyRewrite.Value, + FuzzyTranspositions = propFuzzyTranspositions.Value, + Lenient = propLenient.Value, + MaxExpansions = propMaxExpansions.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Operator = propOperator.Value, + PrefixLength = propPrefixLength.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + ZeroTermsQuery = propZeroTermsQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropAutoGenerateSynonymsPhraseQuery, value.AutoGenerateSynonymsPhraseQuery, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropCutoffFrequency, value.CutoffFrequency, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropFuzzyRewrite, value.FuzzyRewrite, null, null); + writer.WriteProperty(options, PropFuzzyTranspositions, value.FuzzyTranspositions, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropMaxExpansions, value.MaxExpansions, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropOperator, value.Operator, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropZeroTermsQuery, value.ZeroTermsQuery, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(MatchQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryConverter))] public sealed partial class MatchQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public MatchQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchQuery(Elastic.Clients.Elasticsearch.Field field, object query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public MatchQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert the text in the query value into tokens. @@ -259,7 +265,13 @@ public MatchQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + [System.Obsolete("Deprecated in '7.3.0'.")] + public double? CutoffFrequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -322,7 +334,11 @@ public MatchQuery(Elastic.Clients.Elasticsearch.Field field) /// Text, number, boolean value or date you wish to find in the provided field. /// /// - public object Query { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Query { get; set; } public string? QueryName { get; set; } /// @@ -331,46 +347,36 @@ public MatchQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Match(matchQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Match(matchQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Match(matchQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Match(matchQuery); } -public sealed partial class MatchQueryDescriptor : SerializableDescriptor> +public readonly partial struct MatchQueryDescriptor { - internal MatchQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery instance) + { + Instance = instance; + } - public MatchQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private object QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -378,10 +384,10 @@ public MatchQueryDescriptor Analyzer(string? analyzer) /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -392,28 +398,29 @@ public MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? aut /// A value greater than 1.0 increases the relevance score. /// /// - public MatchQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor CutoffFrequency(double? value) { - FieldValue = field; - return Self; + Instance.CutoffFrequency = value; + return this; } - public MatchQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -421,10 +428,21 @@ public MatchQueryDescriptor Field(Expression> /// Maximum edit distance allowed for matching. /// /// - public MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = value; + return this; + } + + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Fuzziness(System.Func action) + { + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -432,10 +450,10 @@ public MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.F /// Method used to rewrite the query. /// /// - public MatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -443,10 +461,10 @@ public MatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public MatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -454,10 +472,10 @@ public MatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTransposit /// If true, format-based errors, such as providing a text query value for a numeric field, are ignored. /// /// - public MatchQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -465,10 +483,10 @@ public MatchQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of terms to which the query will expand. /// /// - public MatchQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -476,10 +494,10 @@ public MatchQueryDescriptor MaxExpansions(int? maxExpansions) /// Minimum number of clauses that must match for a document to be returned. /// /// - public MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -487,10 +505,10 @@ public MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasti /// Boolean logic used to interpret text in the query value. /// /// - public MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -498,10 +516,10 @@ public MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.Qu /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public MatchQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -509,16 +527,16 @@ public MatchQueryDescriptor PrefixLength(int? prefixLength) /// Text, number, boolean value or date you wish to find in the provided field. /// /// - public MatchQueryDescriptor Query(object query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Query(object value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -526,137 +544,49 @@ public MatchQueryDescriptor QueryName(string? queryName) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MatchQueryDescriptor : SerializableDescriptor +public readonly partial struct MatchQueryDescriptor { - internal MatchQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery Instance { get; init; } - public MatchQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private object QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MatchQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -664,10 +594,10 @@ public MatchQueryDescriptor Analyzer(string? analyzer) /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -678,28 +608,40 @@ public MatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSy /// A value greater than 1.0 increases the relevance score. /// /// - public MatchQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public MatchQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor CutoffFrequency(double? value) { - FieldValue = field; - return Self; + Instance.CutoffFrequency = value; + return this; } - public MatchQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public MatchQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldValue = field; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -707,10 +649,10 @@ public MatchQueryDescriptor Field(Expression> /// Maximum edit distance allowed for matching. /// /// - public MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -718,10 +660,10 @@ public MatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? f /// Method used to rewrite the query. /// /// - public MatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -729,10 +671,10 @@ public MatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public MatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -740,10 +682,10 @@ public MatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true /// If true, format-based errors, such as providing a text query value for a numeric field, are ignored. /// /// - public MatchQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -751,10 +693,10 @@ public MatchQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of terms to which the query will expand. /// /// - public MatchQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -762,10 +704,10 @@ public MatchQueryDescriptor MaxExpansions(int? maxExpansions) /// Minimum number of clauses that must match for a document to be returned. /// /// - public MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -773,10 +715,10 @@ public MatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.Min /// Boolean logic used to interpret text in the query value. /// /// - public MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -784,10 +726,10 @@ public MatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Oper /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public MatchQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -795,16 +737,16 @@ public MatchQueryDescriptor PrefixLength(int? prefixLength) /// Text, number, boolean value or date you wish to find in the provided field. /// /// - public MatchQueryDescriptor Query(object query) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor Query(object value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MatchQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -812,100 +754,17 @@ public MatchQueryDescriptor QueryName(string? queryName) /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MoreLikeThisQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MoreLikeThisQuery.g.cs index 30e777edcfb..328455dacb6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MoreLikeThisQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MoreLikeThisQuery.g.cs @@ -17,25 +17,253 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class MoreLikeThisQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropBoostTerms = System.Text.Json.JsonEncodedText.Encode("boost_terms"); + private static readonly System.Text.Json.JsonEncodedText PropFailOnUnsupportedField = System.Text.Json.JsonEncodedText.Encode("fail_on_unsupported_field"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropLike = System.Text.Json.JsonEncodedText.Encode("like"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDocFreq = System.Text.Json.JsonEncodedText.Encode("max_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMaxQueryTerms = System.Text.Json.JsonEncodedText.Encode("max_query_terms"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWordLength = System.Text.Json.JsonEncodedText.Encode("max_word_length"); + private static readonly System.Text.Json.JsonEncodedText PropMinDocFreq = System.Text.Json.JsonEncodedText.Encode("min_doc_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropMinTermFreq = System.Text.Json.JsonEncodedText.Encode("min_term_freq"); + private static readonly System.Text.Json.JsonEncodedText PropMinWordLength = System.Text.Json.JsonEncodedText.Encode("min_word_length"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropStopWords = System.Text.Json.JsonEncodedText.Encode("stop_words"); + private static readonly System.Text.Json.JsonEncodedText PropUnlike = System.Text.Json.JsonEncodedText.Encode("unlike"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propBoost = default; + LocalJsonValue propBoostTerms = default; + LocalJsonValue propFailOnUnsupportedField = default; + LocalJsonValue propFields = default; + LocalJsonValue propInclude = default; + LocalJsonValue> propLike = default; + LocalJsonValue propMaxDocFreq = default; + LocalJsonValue propMaxQueryTerms = default; + LocalJsonValue propMaxWordLength = default; + LocalJsonValue propMinDocFreq = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propMinTermFreq = default; + LocalJsonValue propMinWordLength = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRouting = default; + LocalJsonValue?> propStopWords = default; + LocalJsonValue?> propUnlike = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propBoostTerms.TryReadProperty(ref reader, options, PropBoostTerms, null)) + { + continue; + } + + if (propFailOnUnsupportedField.TryReadProperty(ref reader, options, PropFailOnUnsupportedField, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propLike.TryReadProperty(ref reader, options, PropLike, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propMaxDocFreq.TryReadProperty(ref reader, options, PropMaxDocFreq, null)) + { + continue; + } + + if (propMaxQueryTerms.TryReadProperty(ref reader, options, PropMaxQueryTerms, null)) + { + continue; + } + + if (propMaxWordLength.TryReadProperty(ref reader, options, PropMaxWordLength, null)) + { + continue; + } + + if (propMinDocFreq.TryReadProperty(ref reader, options, PropMinDocFreq, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propMinTermFreq.TryReadProperty(ref reader, options, PropMinTermFreq, null)) + { + continue; + } + + if (propMinWordLength.TryReadProperty(ref reader, options, PropMinWordLength, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propStopWords.TryReadProperty(ref reader, options, PropStopWords, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propUnlike.TryReadProperty(ref reader, options, PropUnlike, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionType.TryReadProperty(ref reader, options, PropVersionType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + Boost = propBoost.Value, + BoostTerms = propBoostTerms.Value, + FailOnUnsupportedField = propFailOnUnsupportedField.Value, + Fields = propFields.Value, + Include = propInclude.Value, + Like = propLike.Value, + MaxDocFreq = propMaxDocFreq.Value, + MaxQueryTerms = propMaxQueryTerms.Value, + MaxWordLength = propMaxWordLength.Value, + MinDocFreq = propMinDocFreq.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + MinTermFreq = propMinTermFreq.Value, + MinWordLength = propMinWordLength.Value, + QueryName = propQueryName.Value, + Routing = propRouting.Value, + StopWords = propStopWords.Value, + Unlike = propUnlike.Value, + Version = propVersion.Value, + VersionType = propVersionType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropBoostTerms, value.BoostTerms, null, null); + writer.WriteProperty(options, PropFailOnUnsupportedField, value.FailOnUnsupportedField, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropLike, value.Like, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMaxDocFreq, value.MaxDocFreq, null, null); + writer.WriteProperty(options, PropMaxQueryTerms, value.MaxQueryTerms, null, null); + writer.WriteProperty(options, PropMaxWordLength, value.MaxWordLength, null, null); + writer.WriteProperty(options, PropMinDocFreq, value.MinDocFreq, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropMinTermFreq, value.MinTermFreq, null, null); + writer.WriteProperty(options, PropMinWordLength, value.MinWordLength, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropStopWords, value.StopWords, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUnlike, value.Unlike, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionType, value.VersionType, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryConverter))] public sealed partial class MoreLikeThisQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoreLikeThisQuery(System.Collections.Generic.ICollection like) + { + Like = like; + } +#if NET7_0_OR_GREATER + public MoreLikeThisQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MoreLikeThisQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The analyzer that is used to analyze the free form text. /// Defaults to the analyzer associated with the first field in fields. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -46,7 +274,6 @@ public sealed partial class MoreLikeThisQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -56,7 +283,6 @@ public sealed partial class MoreLikeThisQuery /// Defaults to deactivated (0). /// /// - [JsonInclude, JsonPropertyName("boost_terms")] public double? BoostTerms { get; set; } /// @@ -64,7 +290,6 @@ public sealed partial class MoreLikeThisQuery /// Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (text or keyword). /// /// - [JsonInclude, JsonPropertyName("fail_on_unsupported_field")] public bool? FailOnUnsupportedField { get; set; } /// @@ -73,8 +298,6 @@ public sealed partial class MoreLikeThisQuery /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(FieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -82,7 +305,6 @@ public sealed partial class MoreLikeThisQuery /// Specifies whether the input documents should also be included in the search results returned. /// /// - [JsonInclude, JsonPropertyName("include")] public bool? Include { get; set; } /// @@ -90,16 +312,17 @@ public sealed partial class MoreLikeThisQuery /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. /// /// - [JsonInclude, JsonPropertyName("like")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Like))] - public ICollection Like { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Like { get; set; } /// /// /// The maximum document frequency above which the terms are ignored from the input document. /// /// - [JsonInclude, JsonPropertyName("max_doc_freq")] public int? MaxDocFreq { get; set; } /// @@ -107,7 +330,6 @@ public sealed partial class MoreLikeThisQuery /// The maximum number of query terms that can be selected. /// /// - [JsonInclude, JsonPropertyName("max_query_terms")] public int? MaxQueryTerms { get; set; } /// @@ -116,7 +338,6 @@ public sealed partial class MoreLikeThisQuery /// Defaults to unbounded (0). /// /// - [JsonInclude, JsonPropertyName("max_word_length")] public int? MaxWordLength { get; set; } /// @@ -124,7 +345,6 @@ public sealed partial class MoreLikeThisQuery /// The minimum document frequency below which the terms are ignored from the input document. /// /// - [JsonInclude, JsonPropertyName("min_doc_freq")] public int? MinDocFreq { get; set; } /// @@ -132,7 +352,6 @@ public sealed partial class MoreLikeThisQuery /// After the disjunctive query has been formed, this parameter controls the number of terms that must match. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -140,7 +359,6 @@ public sealed partial class MoreLikeThisQuery /// The minimum term frequency below which the terms are ignored from the input document. /// /// - [JsonInclude, JsonPropertyName("min_term_freq")] public int? MinTermFreq { get; set; } /// @@ -148,11 +366,8 @@ public sealed partial class MoreLikeThisQuery /// The minimum word length below which the terms are ignored. /// /// - [JsonInclude, JsonPropertyName("min_word_length")] public int? MinWordLength { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -161,54 +376,36 @@ public sealed partial class MoreLikeThisQuery /// Any word in this set is ignored. /// /// - [JsonInclude, JsonPropertyName("stop_words")] - [SingleOrManyCollectionConverter(typeof(string))] - public ICollection? StopWords { get; set; } + public System.Collections.Generic.ICollection? StopWords { get; set; } /// /// /// Used in combination with like to exclude documents that match a set of terms. /// /// - [JsonInclude, JsonPropertyName("unlike")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Like))] - public ICollection? Unlike { get; set; } - [JsonInclude, JsonPropertyName("version")] + public System.Collections.Generic.ICollection? Unlike { get; set; } public long? Version { get; set; } - [JsonInclude, JsonPropertyName("version_type")] public Elastic.Clients.Elasticsearch.VersionType? VersionType { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MoreLikeThisQuery moreLikeThisQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MoreLikeThis(moreLikeThisQuery); } -public sealed partial class MoreLikeThisQueryDescriptor : SerializableDescriptor> +public readonly partial struct MoreLikeThisQueryDescriptor { - internal MoreLikeThisQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoreLikeThisQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery instance) + { + Instance = instance; + } - public MoreLikeThisQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoreLikeThisQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private double? BoostTermsValue { get; set; } - private bool? FailOnUnsupportedFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private bool? IncludeValue { get; set; } - private ICollection LikeValue { get; set; } - private int? MaxDocFreqValue { get; set; } - private int? MaxQueryTermsValue { get; set; } - private int? MaxWordLengthValue { get; set; } - private int? MinDocFreqValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private int? MinTermFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private ICollection? StopWordsValue { get; set; } - private ICollection? UnlikeValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -216,10 +413,10 @@ public MoreLikeThisQueryDescriptor() : base() /// Defaults to the analyzer associated with the first field in fields. /// /// - public MoreLikeThisQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -230,10 +427,10 @@ public MoreLikeThisQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MoreLikeThisQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -243,10 +440,10 @@ public MoreLikeThisQueryDescriptor Boost(float? boost) /// Defaults to deactivated (0). /// /// - public MoreLikeThisQueryDescriptor BoostTerms(double? boostTerms) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor BoostTerms(double? value) { - BoostTermsValue = boostTerms; - return Self; + Instance.BoostTerms = value; + return this; } /// @@ -254,10 +451,22 @@ public MoreLikeThisQueryDescriptor BoostTerms(double? boostTerms) /// Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (text or keyword). /// /// - public MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? failOnUnsupportedField = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? value = true) + { + Instance.FailOnUnsupportedField = value; + return this; + } + + /// + /// + /// A list of fields to fetch and analyze the text from. + /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FailOnUnsupportedFieldValue = failOnUnsupportedField; - return Self; + Instance.Fields = value; + return this; } /// @@ -266,10 +475,10 @@ public MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? failO /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -277,10 +486,32 @@ public MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsear /// Specifies whether the input documents should also be included in the search results returned. /// /// - public MoreLikeThisQueryDescriptor Include(bool? include = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Include(bool? value = true) + { + Instance.Include = value; + return this; + } + + /// + /// + /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(System.Collections.Generic.ICollection value) + { + Instance.Like = value; + return this; + } + + /// + /// + /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(params Elastic.Clients.Elasticsearch.QueryDsl.Like[] values) { - IncludeValue = include; - return Self; + Instance.Like = [.. values]; + return this; } /// @@ -288,10 +519,16 @@ public MoreLikeThisQueryDescriptor Include(bool? include = true) /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. /// /// - public MoreLikeThisQueryDescriptor Like(ICollection like) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(params System.Func, Elastic.Clients.Elasticsearch.QueryDsl.Like>[] actions) { - LikeValue = like; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); + } + + Instance.Like = items; + return this; } /// @@ -299,10 +536,10 @@ public MoreLikeThisQueryDescriptor Like(ICollection /// - public MoreLikeThisQueryDescriptor MaxDocFreq(int? maxDocFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxDocFreq(int? value) { - MaxDocFreqValue = maxDocFreq; - return Self; + Instance.MaxDocFreq = value; + return this; } /// @@ -310,10 +547,10 @@ public MoreLikeThisQueryDescriptor MaxDocFreq(int? maxDocFreq) /// The maximum number of query terms that can be selected. /// /// - public MoreLikeThisQueryDescriptor MaxQueryTerms(int? maxQueryTerms) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxQueryTerms(int? value) { - MaxQueryTermsValue = maxQueryTerms; - return Self; + Instance.MaxQueryTerms = value; + return this; } /// @@ -322,10 +559,10 @@ public MoreLikeThisQueryDescriptor MaxQueryTerms(int? maxQueryTerms) /// Defaults to unbounded (0). /// /// - public MoreLikeThisQueryDescriptor MaxWordLength(int? maxWordLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxWordLength(int? value) { - MaxWordLengthValue = maxWordLength; - return Self; + Instance.MaxWordLength = value; + return this; } /// @@ -333,10 +570,10 @@ public MoreLikeThisQueryDescriptor MaxWordLength(int? maxWordLength) /// The minimum document frequency below which the terms are ignored from the input document. /// /// - public MoreLikeThisQueryDescriptor MinDocFreq(int? minDocFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinDocFreq(int? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -344,10 +581,10 @@ public MoreLikeThisQueryDescriptor MinDocFreq(int? minDocFreq) /// After the disjunctive query has been formed, this parameter controls the number of terms that must match. /// /// - public MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -355,10 +592,10 @@ public MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients /// The minimum term frequency below which the terms are ignored from the input document. /// /// - public MoreLikeThisQueryDescriptor MinTermFreq(int? minTermFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinTermFreq(int? value) { - MinTermFreqValue = minTermFreq; - return Self; + Instance.MinTermFreq = value; + return this; } /// @@ -366,22 +603,22 @@ public MoreLikeThisQueryDescriptor MinTermFreq(int? minTermFreq) /// The minimum word length below which the terms are ignored. /// /// - public MoreLikeThisQueryDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } - public MoreLikeThisQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -390,186 +627,102 @@ public MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsea /// Any word in this set is ignored. /// /// - public MoreLikeThisQueryDescriptor StopWords(ICollection? stopWords) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor StopWords(System.Collections.Generic.ICollection? value) { - StopWordsValue = stopWords; - return Self; + Instance.StopWords = value; + return this; } /// /// - /// Used in combination with like to exclude documents that match a set of terms. + /// An array of stop words. + /// Any word in this set is ignored. /// /// - public MoreLikeThisQueryDescriptor Unlike(ICollection? unlike) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor StopWords(params string[] values) { - UnlikeValue = unlike; - return Self; + Instance.StopWords = [.. values]; + return this; } - public MoreLikeThisQueryDescriptor Version(long? version) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.Unlike = value; + return this; } - public MoreLikeThisQueryDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(params Elastic.Clients.Elasticsearch.QueryDsl.Like[] values) { - VersionTypeValue = versionType; - return Self; + Instance.Unlike = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(params System.Func, Elastic.Clients.Elasticsearch.QueryDsl.Like>[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (BoostTermsValue.HasValue) - { - writer.WritePropertyName("boost_terms"); - writer.WriteNumberValue(BoostTermsValue.Value); - } - - if (FailOnUnsupportedFieldValue.HasValue) - { - writer.WritePropertyName("fail_on_unsupported_field"); - writer.WriteBooleanValue(FailOnUnsupportedFieldValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IncludeValue.HasValue) - { - writer.WritePropertyName("include"); - writer.WriteBooleanValue(IncludeValue.Value); - } - - writer.WritePropertyName("like"); - SingleOrManySerializationHelper.Serialize(LikeValue, writer, options); - if (MaxDocFreqValue.HasValue) - { - writer.WritePropertyName("max_doc_freq"); - writer.WriteNumberValue(MaxDocFreqValue.Value); - } - - if (MaxQueryTermsValue.HasValue) - { - writer.WritePropertyName("max_query_terms"); - writer.WriteNumberValue(MaxQueryTermsValue.Value); - } - - if (MaxWordLengthValue.HasValue) - { - writer.WritePropertyName("max_word_length"); - writer.WriteNumberValue(MaxWordLengthValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MinTermFreqValue.HasValue) - { - writer.WritePropertyName("min_term_freq"); - writer.WriteNumberValue(MinTermFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (StopWordsValue is not null) - { - writer.WritePropertyName("stop_words"); - SingleOrManySerializationHelper.Serialize(StopWordsValue, writer, options); - } - - if (UnlikeValue is not null) - { - writer.WritePropertyName("unlike"); - SingleOrManySerializationHelper.Serialize(UnlikeValue, writer, options); - } + Instance.Unlike = items; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MoreLikeThisQueryDescriptor : SerializableDescriptor +public readonly partial struct MoreLikeThisQueryDescriptor { - internal MoreLikeThisQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoreLikeThisQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery instance) + { + Instance = instance; + } - public MoreLikeThisQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MoreLikeThisQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private float? BoostValue { get; set; } - private double? BoostTermsValue { get; set; } - private bool? FailOnUnsupportedFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private bool? IncludeValue { get; set; } - private ICollection LikeValue { get; set; } - private int? MaxDocFreqValue { get; set; } - private int? MaxQueryTermsValue { get; set; } - private int? MaxWordLengthValue { get; set; } - private int? MinDocFreqValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private int? MinTermFreqValue { get; set; } - private int? MinWordLengthValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private ICollection? StopWordsValue { get; set; } - private ICollection? UnlikeValue { get; set; } - private long? VersionValue { get; set; } - private Elastic.Clients.Elasticsearch.VersionType? VersionTypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -577,10 +730,10 @@ public MoreLikeThisQueryDescriptor() : base() /// Defaults to the analyzer associated with the first field in fields. /// /// - public MoreLikeThisQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -591,10 +744,10 @@ public MoreLikeThisQueryDescriptor Analyzer(string? analyzer) /// A value greater than 1.0 increases the relevance score. /// /// - public MoreLikeThisQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -604,10 +757,10 @@ public MoreLikeThisQueryDescriptor Boost(float? boost) /// Defaults to deactivated (0). /// /// - public MoreLikeThisQueryDescriptor BoostTerms(double? boostTerms) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor BoostTerms(double? value) { - BoostTermsValue = boostTerms; - return Self; + Instance.BoostTerms = value; + return this; } /// @@ -615,10 +768,22 @@ public MoreLikeThisQueryDescriptor BoostTerms(double? boostTerms) /// Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (text or keyword). /// /// - public MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? failOnUnsupportedField = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? value = true) + { + Instance.FailOnUnsupportedField = value; + return this; + } + + /// + /// + /// A list of fields to fetch and analyze the text from. + /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FailOnUnsupportedFieldValue = failOnUnsupportedField; - return Self; + Instance.Fields = value; + return this; } /// @@ -627,10 +792,10 @@ public MoreLikeThisQueryDescriptor FailOnUnsupportedField(bool? failOnUnsupporte /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -638,10 +803,49 @@ public MoreLikeThisQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? /// Specifies whether the input documents should also be included in the search results returned. /// /// - public MoreLikeThisQueryDescriptor Include(bool? include = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Include(bool? value = true) + { + Instance.Include = value; + return this; + } + + /// + /// + /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(System.Collections.Generic.ICollection value) + { + Instance.Like = value; + return this; + } + + /// + /// + /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(params Elastic.Clients.Elasticsearch.QueryDsl.Like[] values) + { + Instance.Like = [.. values]; + return this; + } + + /// + /// + /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(params System.Func[] actions) { - IncludeValue = include; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); + } + + Instance.Like = items; + return this; } /// @@ -649,10 +853,16 @@ public MoreLikeThisQueryDescriptor Include(bool? include = true) /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents. /// /// - public MoreLikeThisQueryDescriptor Like(ICollection like) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Like(params System.Func, Elastic.Clients.Elasticsearch.QueryDsl.Like>[] actions) { - LikeValue = like; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); + } + + Instance.Like = items; + return this; } /// @@ -660,10 +870,10 @@ public MoreLikeThisQueryDescriptor Like(ICollection /// - public MoreLikeThisQueryDescriptor MaxDocFreq(int? maxDocFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxDocFreq(int? value) { - MaxDocFreqValue = maxDocFreq; - return Self; + Instance.MaxDocFreq = value; + return this; } /// @@ -671,10 +881,10 @@ public MoreLikeThisQueryDescriptor MaxDocFreq(int? maxDocFreq) /// The maximum number of query terms that can be selected. /// /// - public MoreLikeThisQueryDescriptor MaxQueryTerms(int? maxQueryTerms) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxQueryTerms(int? value) { - MaxQueryTermsValue = maxQueryTerms; - return Self; + Instance.MaxQueryTerms = value; + return this; } /// @@ -683,10 +893,10 @@ public MoreLikeThisQueryDescriptor MaxQueryTerms(int? maxQueryTerms) /// Defaults to unbounded (0). /// /// - public MoreLikeThisQueryDescriptor MaxWordLength(int? maxWordLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MaxWordLength(int? value) { - MaxWordLengthValue = maxWordLength; - return Self; + Instance.MaxWordLength = value; + return this; } /// @@ -694,10 +904,10 @@ public MoreLikeThisQueryDescriptor MaxWordLength(int? maxWordLength) /// The minimum document frequency below which the terms are ignored from the input document. /// /// - public MoreLikeThisQueryDescriptor MinDocFreq(int? minDocFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinDocFreq(int? value) { - MinDocFreqValue = minDocFreq; - return Self; + Instance.MinDocFreq = value; + return this; } /// @@ -705,10 +915,10 @@ public MoreLikeThisQueryDescriptor MinDocFreq(int? minDocFreq) /// After the disjunctive query has been formed, this parameter controls the number of terms that must match. /// /// - public MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -716,10 +926,10 @@ public MoreLikeThisQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsea /// The minimum term frequency below which the terms are ignored from the input document. /// /// - public MoreLikeThisQueryDescriptor MinTermFreq(int? minTermFreq) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinTermFreq(int? value) { - MinTermFreqValue = minTermFreq; - return Self; + Instance.MinTermFreq = value; + return this; } /// @@ -727,22 +937,22 @@ public MoreLikeThisQueryDescriptor MinTermFreq(int? minTermFreq) /// The minimum word length below which the terms are ignored. /// /// - public MoreLikeThisQueryDescriptor MinWordLength(int? minWordLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor MinWordLength(int? value) { - MinWordLengthValue = minWordLength; - return Self; + Instance.MinWordLength = value; + return this; } - public MoreLikeThisQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -751,154 +961,97 @@ public MoreLikeThisQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing /// Any word in this set is ignored. /// /// - public MoreLikeThisQueryDescriptor StopWords(ICollection? stopWords) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor StopWords(System.Collections.Generic.ICollection? value) { - StopWordsValue = stopWords; - return Self; + Instance.StopWords = value; + return this; } /// /// - /// Used in combination with like to exclude documents that match a set of terms. + /// An array of stop words. + /// Any word in this set is ignored. /// /// - public MoreLikeThisQueryDescriptor Unlike(ICollection? unlike) + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor StopWords(params string[] values) { - UnlikeValue = unlike; - return Self; + Instance.StopWords = [.. values]; + return this; } - public MoreLikeThisQueryDescriptor Version(long? version) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(System.Collections.Generic.ICollection? value) { - VersionValue = version; - return Self; + Instance.Unlike = value; + return this; } - public MoreLikeThisQueryDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? versionType) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(params Elastic.Clients.Elasticsearch.QueryDsl.Like[] values) { - VersionTypeValue = versionType; - return Self; + Instance.Unlike = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(params System.Func[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (BoostTermsValue.HasValue) - { - writer.WritePropertyName("boost_terms"); - writer.WriteNumberValue(BoostTermsValue.Value); - } - - if (FailOnUnsupportedFieldValue.HasValue) - { - writer.WritePropertyName("fail_on_unsupported_field"); - writer.WriteBooleanValue(FailOnUnsupportedFieldValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (IncludeValue.HasValue) - { - writer.WritePropertyName("include"); - writer.WriteBooleanValue(IncludeValue.Value); - } - - writer.WritePropertyName("like"); - SingleOrManySerializationHelper.Serialize(LikeValue, writer, options); - if (MaxDocFreqValue.HasValue) - { - writer.WritePropertyName("max_doc_freq"); - writer.WriteNumberValue(MaxDocFreqValue.Value); - } - - if (MaxQueryTermsValue.HasValue) - { - writer.WritePropertyName("max_query_terms"); - writer.WriteNumberValue(MaxQueryTermsValue.Value); - } - - if (MaxWordLengthValue.HasValue) - { - writer.WritePropertyName("max_word_length"); - writer.WriteNumberValue(MaxWordLengthValue.Value); - } - - if (MinDocFreqValue.HasValue) - { - writer.WritePropertyName("min_doc_freq"); - writer.WriteNumberValue(MinDocFreqValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MinTermFreqValue.HasValue) - { - writer.WritePropertyName("min_term_freq"); - writer.WriteNumberValue(MinTermFreqValue.Value); - } - - if (MinWordLengthValue.HasValue) - { - writer.WritePropertyName("min_word_length"); - writer.WriteNumberValue(MinWordLengthValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); } - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } + Instance.Unlike = items; + return this; + } - if (StopWordsValue is not null) + /// + /// + /// Used in combination with like to exclude documents that match a set of terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Unlike(params System.Func, Elastic.Clients.Elasticsearch.QueryDsl.Like>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("stop_words"); - SingleOrManySerializationHelper.Serialize(StopWordsValue, writer, options); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.LikeFactory.Build(action)); } - if (UnlikeValue is not null) - { - writer.WritePropertyName("unlike"); - SingleOrManySerializationHelper.Serialize(UnlikeValue, writer, options); - } + Instance.Unlike = items; + return this; + } - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor Version(long? value) + { + Instance.Version = value; + return this; + } - if (VersionTypeValue is not null) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, VersionTypeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor VersionType(Elastic.Clients.Elasticsearch.VersionType? value) + { + Instance.VersionType = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MultiMatchQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MultiMatchQuery.g.cs index 8a01d0b1f4c..5a3b609c678 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MultiMatchQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MultiMatchQuery.g.cs @@ -17,24 +17,249 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class MultiMatchQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropAutoGenerateSynonymsPhraseQuery = System.Text.Json.JsonEncodedText.Encode("auto_generate_synonyms_phrase_query"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCutoffFrequency = System.Text.Json.JsonEncodedText.Encode("cutoff_frequency"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyRewrite = System.Text.Json.JsonEncodedText.Encode("fuzzy_rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyTranspositions = System.Text.Json.JsonEncodedText.Encode("fuzzy_transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropMaxExpansions = System.Text.Json.JsonEncodedText.Encode("max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropOperator = System.Text.Json.JsonEncodedText.Encode("operator"); + private static readonly System.Text.Json.JsonEncodedText PropPrefixLength = System.Text.Json.JsonEncodedText.Encode("prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropSlop = System.Text.Json.JsonEncodedText.Encode("slop"); + private static readonly System.Text.Json.JsonEncodedText PropTieBreaker = System.Text.Json.JsonEncodedText.Encode("tie_breaker"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropZeroTermsQuery = System.Text.Json.JsonEncodedText.Encode("zero_terms_query"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propAutoGenerateSynonymsPhraseQuery = default; + LocalJsonValue propBoost = default; + LocalJsonValue propCutoffFrequency = default; + LocalJsonValue propFields = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propFuzzyRewrite = default; + LocalJsonValue propFuzzyTranspositions = default; + LocalJsonValue propLenient = default; + LocalJsonValue propMaxExpansions = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propOperator = default; + LocalJsonValue propPrefixLength = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propSlop = default; + LocalJsonValue propTieBreaker = default; + LocalJsonValue propType = default; + LocalJsonValue propZeroTermsQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propAutoGenerateSynonymsPhraseQuery.TryReadProperty(ref reader, options, PropAutoGenerateSynonymsPhraseQuery, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCutoffFrequency.TryReadProperty(ref reader, options, PropCutoffFrequency, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } + + if (propFuzzyRewrite.TryReadProperty(ref reader, options, PropFuzzyRewrite, null)) + { + continue; + } + + if (propFuzzyTranspositions.TryReadProperty(ref reader, options, PropFuzzyTranspositions, null)) + { + continue; + } + + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (propMaxExpansions.TryReadProperty(ref reader, options, PropMaxExpansions, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propOperator.TryReadProperty(ref reader, options, PropOperator, null)) + { + continue; + } + + if (propPrefixLength.TryReadProperty(ref reader, options, PropPrefixLength, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propSlop.TryReadProperty(ref reader, options, PropSlop, null)) + { + continue; + } + + if (propTieBreaker.TryReadProperty(ref reader, options, PropTieBreaker, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propZeroTermsQuery.TryReadProperty(ref reader, options, PropZeroTermsQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + AutoGenerateSynonymsPhraseQuery = propAutoGenerateSynonymsPhraseQuery.Value, + Boost = propBoost.Value, +#pragma warning disable CS0618 + CutoffFrequency = propCutoffFrequency.Value +#pragma warning restore CS0618 +, + Fields = propFields.Value, + Fuzziness = propFuzziness.Value, + FuzzyRewrite = propFuzzyRewrite.Value, + FuzzyTranspositions = propFuzzyTranspositions.Value, + Lenient = propLenient.Value, + MaxExpansions = propMaxExpansions.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Operator = propOperator.Value, + PrefixLength = propPrefixLength.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + Slop = propSlop.Value, + TieBreaker = propTieBreaker.Value, + Type = propType.Value, + ZeroTermsQuery = propZeroTermsQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropAutoGenerateSynonymsPhraseQuery, value.AutoGenerateSynonymsPhraseQuery, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropCutoffFrequency, value.CutoffFrequency, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropFuzzyRewrite, value.FuzzyRewrite, null, null); + writer.WriteProperty(options, PropFuzzyTranspositions, value.FuzzyTranspositions, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropMaxExpansions, value.MaxExpansions, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropOperator, value.Operator, null, null); + writer.WriteProperty(options, PropPrefixLength, value.PrefixLength, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropSlop, value.Slop, null, null); + writer.WriteProperty(options, PropTieBreaker, value.TieBreaker, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropZeroTermsQuery, value.ZeroTermsQuery, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryConverter))] public sealed partial class MultiMatchQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiMatchQuery(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public MultiMatchQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MultiMatchQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -42,7 +267,6 @@ public sealed partial class MultiMatchQuery /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - [JsonInclude, JsonPropertyName("auto_generate_synonyms_phrase_query")] public bool? AutoGenerateSynonymsPhraseQuery { get; set; } /// @@ -53,8 +277,9 @@ public sealed partial class MultiMatchQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } + [System.Obsolete("Deprecated in '7.3.0'.")] + public double? CutoffFrequency { get; set; } /// /// @@ -62,8 +287,6 @@ public sealed partial class MultiMatchQuery /// Defaults to the index.query.default_field index settings, which in turn defaults to *. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -71,7 +294,6 @@ public sealed partial class MultiMatchQuery /// Maximum edit distance allowed for matching. /// /// - [JsonInclude, JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } /// @@ -79,7 +301,6 @@ public sealed partial class MultiMatchQuery /// Method used to rewrite the query. /// /// - [JsonInclude, JsonPropertyName("fuzzy_rewrite")] public string? FuzzyRewrite { get; set; } /// @@ -88,7 +309,6 @@ public sealed partial class MultiMatchQuery /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - [JsonInclude, JsonPropertyName("fuzzy_transpositions")] public bool? FuzzyTranspositions { get; set; } /// @@ -96,7 +316,6 @@ public sealed partial class MultiMatchQuery /// If true, format-based errors, such as providing a text query value for a numeric field, are ignored. /// /// - [JsonInclude, JsonPropertyName("lenient")] public bool? Lenient { get; set; } /// @@ -104,7 +323,6 @@ public sealed partial class MultiMatchQuery /// Maximum number of terms to which the query will expand. /// /// - [JsonInclude, JsonPropertyName("max_expansions")] public int? MaxExpansions { get; set; } /// @@ -112,7 +330,6 @@ public sealed partial class MultiMatchQuery /// Minimum number of clauses that must match for a document to be returned. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -120,7 +337,6 @@ public sealed partial class MultiMatchQuery /// Boolean logic used to interpret text in the query value. /// /// - [JsonInclude, JsonPropertyName("operator")] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? Operator { get; set; } /// @@ -128,7 +344,6 @@ public sealed partial class MultiMatchQuery /// Number of beginning characters left unchanged for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("prefix_length")] public int? PrefixLength { get; set; } /// @@ -136,9 +351,11 @@ public sealed partial class MultiMatchQuery /// Text, number, boolean value or date you wish to find in the provided field. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -146,7 +363,6 @@ public sealed partial class MultiMatchQuery /// Maximum number of positions allowed between matching tokens. /// /// - [JsonInclude, JsonPropertyName("slop")] public int? Slop { get; set; } /// @@ -154,7 +370,6 @@ public sealed partial class MultiMatchQuery /// Determines how scores for each per-term blended query and scores across groups are combined. /// /// - [JsonInclude, JsonPropertyName("tie_breaker")] public double? TieBreaker { get; set; } /// @@ -162,7 +377,6 @@ public sealed partial class MultiMatchQuery /// How the multi_match query is executed internally. /// /// - [JsonInclude, JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? Type { get; set; } /// @@ -170,48 +384,37 @@ public sealed partial class MultiMatchQuery /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - [JsonInclude, JsonPropertyName("zero_terms_query")] public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MultiMatchQuery multiMatchQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MultiMatch(multiMatchQuery); } -public sealed partial class MultiMatchQueryDescriptor : SerializableDescriptor> +public readonly partial struct MultiMatchQueryDescriptor { - internal MultiMatchQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiMatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery instance) + { + Instance = instance; + } - public MultiMatchQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiMatchQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private double? TieBreakerValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? TypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MultiMatchQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -219,10 +422,10 @@ public MultiMatchQueryDescriptor Analyzer(string? analyzer) /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -233,10 +436,17 @@ public MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool /// A value greater than 1.0 increases the relevance score. /// /// - public MultiMatchQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor CutoffFrequency(double? value) + { + Instance.CutoffFrequency = value; + return this; } /// @@ -245,10 +455,33 @@ public MultiMatchQueryDescriptor Boost(float? boost) /// Defaults to the index.query.default_field index settings, which in turn defaults to *. /// /// - public MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// The fields to be queried. + /// Defaults to the index.query.default_field index settings, which in turn defaults to *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; + } + + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) + { + Instance.Fuzziness = value; + return this; } /// @@ -256,10 +489,10 @@ public MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch /// Maximum edit distance allowed for matching. /// /// - public MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -267,10 +500,10 @@ public MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsea /// Method used to rewrite the query. /// /// - public MultiMatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -279,10 +512,10 @@ public MultiMatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MultiMatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -290,10 +523,10 @@ public MultiMatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTrans /// If true, format-based errors, such as providing a text query value for a numeric field, are ignored. /// /// - public MultiMatchQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -301,10 +534,10 @@ public MultiMatchQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of terms to which the query will expand. /// /// - public MultiMatchQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -312,10 +545,10 @@ public MultiMatchQueryDescriptor MaxExpansions(int? maxExpansions) /// Minimum number of clauses that must match for a document to be returned. /// /// - public MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -323,10 +556,10 @@ public MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.E /// Boolean logic used to interpret text in the query value. /// /// - public MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -334,10 +567,10 @@ public MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsear /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public MultiMatchQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -345,16 +578,16 @@ public MultiMatchQueryDescriptor PrefixLength(int? prefixLength) /// Text, number, boolean value or date you wish to find in the provided field. /// /// - public MultiMatchQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MultiMatchQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -362,10 +595,10 @@ public MultiMatchQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MultiMatchQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -373,10 +606,10 @@ public MultiMatchQueryDescriptor Slop(int? slop) /// Determines how scores for each per-term blended query and scores across groups are combined. /// /// - public MultiMatchQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } /// @@ -384,10 +617,10 @@ public MultiMatchQueryDescriptor TieBreaker(double? tieBreaker) /// How the multi_match query is executed internally. /// /// - public MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? type) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } /// @@ -395,159 +628,49 @@ public MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.Q /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MultiMatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class MultiMatchQueryDescriptor : SerializableDescriptor +public readonly partial struct MultiMatchQueryDescriptor { - internal MultiMatchQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiMatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery instance) + { + Instance = instance; + } - public MultiMatchQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MultiMatchQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxExpansionsValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? OperatorValue { get; set; } - private int? PrefixLengthValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } - private double? TieBreakerValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? TypeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert the text in the query value into tokens. /// /// - public MultiMatchQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -555,10 +678,10 @@ public MultiMatchQueryDescriptor Analyzer(string? analyzer) /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -569,10 +692,17 @@ public MultiMatchQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGener /// A value greater than 1.0 increases the relevance score. /// /// - public MultiMatchQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor CutoffFrequency(double? value) { - BoostValue = boost; - return Self; + Instance.CutoffFrequency = value; + return this; } /// @@ -581,10 +711,22 @@ public MultiMatchQueryDescriptor Boost(float? boost) /// Defaults to the index.query.default_field index settings, which in turn defaults to *. /// /// - public MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// The fields to be queried. + /// Defaults to the index.query.default_field index settings, which in turn defaults to *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; } /// @@ -592,10 +734,21 @@ public MultiMatchQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fi /// Maximum edit distance allowed for matching. /// /// - public MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = value; + return this; + } + + /// + /// + /// Maximum edit distance allowed for matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Fuzziness(System.Func action) + { + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -603,10 +756,10 @@ public MultiMatchQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzzine /// Method used to rewrite the query. /// /// - public MultiMatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -615,10 +768,10 @@ public MultiMatchQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// Can be applied to the term subqueries constructed for all terms but the final term. /// /// - public MultiMatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -626,10 +779,10 @@ public MultiMatchQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = /// If true, format-based errors, such as providing a text query value for a numeric field, are ignored. /// /// - public MultiMatchQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -637,10 +790,10 @@ public MultiMatchQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of terms to which the query will expand. /// /// - public MultiMatchQueryDescriptor MaxExpansions(int? maxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor MaxExpansions(int? value) { - MaxExpansionsValue = maxExpansions; - return Self; + Instance.MaxExpansions = value; + return this; } /// @@ -648,10 +801,10 @@ public MultiMatchQueryDescriptor MaxExpansions(int? maxExpansions) /// Minimum number of clauses that must match for a document to be returned. /// /// - public MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -659,10 +812,10 @@ public MultiMatchQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearc /// Boolean logic used to interpret text in the query value. /// /// - public MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - OperatorValue = value; - return Self; + Instance.Operator = value; + return this; } /// @@ -670,10 +823,10 @@ public MultiMatchQueryDescriptor Operator(Elastic.Clients.Elasticsearch.QueryDsl /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public MultiMatchQueryDescriptor PrefixLength(int? prefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor PrefixLength(int? value) { - PrefixLengthValue = prefixLength; - return Self; + Instance.PrefixLength = value; + return this; } /// @@ -681,16 +834,16 @@ public MultiMatchQueryDescriptor PrefixLength(int? prefixLength) /// Text, number, boolean value or date you wish to find in the provided field. /// /// - public MultiMatchQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public MultiMatchQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -698,10 +851,10 @@ public MultiMatchQueryDescriptor QueryName(string? queryName) /// Maximum number of positions allowed between matching tokens. /// /// - public MultiMatchQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } /// @@ -709,10 +862,10 @@ public MultiMatchQueryDescriptor Slop(int? slop) /// Determines how scores for each per-term blended query and scores across groups are combined. /// /// - public MultiMatchQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } /// @@ -720,10 +873,10 @@ public MultiMatchQueryDescriptor TieBreaker(double? tieBreaker) /// How the multi_match query is executed internally. /// /// - public MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? type) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } /// @@ -731,119 +884,17 @@ public MultiMatchQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.Tex /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a stop filter. /// /// - public MultiMatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? zeroTermsQuery) + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor ZeroTermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? value) { - ZeroTermsQueryValue = zeroTermsQuery; - return Self; + Instance.ZeroTermsQuery = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxExpansionsValue.HasValue) - { - writer.WritePropertyName("max_expansions"); - writer.WriteNumberValue(MaxExpansionsValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (OperatorValue is not null) - { - writer.WritePropertyName("operator"); - JsonSerializer.Serialize(writer, OperatorValue, options); - } - - if (PrefixLengthValue.HasValue) - { - writer.WritePropertyName("prefix_length"); - writer.WriteNumberValue(PrefixLengthValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - if (ZeroTermsQueryValue is not null) - { - writer.WritePropertyName("zero_terms_query"); - JsonSerializer.Serialize(writer, ZeroTermsQueryValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NestedQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NestedQuery.g.cs index 0f79c2ce37f..ff09150b73d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NestedQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NestedQuery.g.cs @@ -17,18 +17,131 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class NestedQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropInnerHits = System.Text.Json.JsonEncodedText.Encode("inner_hits"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScoreMode = System.Text.Json.JsonEncodedText.Encode("score_mode"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propInnerHits = default; + LocalJsonValue propPath = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScoreMode = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propInnerHits.TryReadProperty(ref reader, options, PropInnerHits, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScoreMode.TryReadProperty(ref reader, options, PropScoreMode, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + InnerHits = propInnerHits.Value, + Path = propPath.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + ScoreMode = propScoreMode.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropInnerHits, value.InnerHits, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScoreMode, value.ScoreMode, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryConverter))] public sealed partial class NestedQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedQuery(Elastic.Clients.Elasticsearch.Field path, Elastic.Clients.Elasticsearch.QueryDsl.Query query) + { + Path = path; + Query = query; + } +#if NET7_0_OR_GREATER + public NestedQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NestedQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +150,6 @@ public sealed partial class NestedQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +157,6 @@ public sealed partial class NestedQuery /// Indicates whether to ignore an unmapped path and not return any documents instead of an error. /// /// - [JsonInclude, JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } /// @@ -53,7 +164,6 @@ public sealed partial class NestedQuery /// If defined, each search hit will contain inner hits. /// /// - [JsonInclude, JsonPropertyName("inner_hits")] public Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHits { get; set; } /// @@ -61,17 +171,22 @@ public sealed partial class NestedQuery /// Path to the nested object you wish to search. /// /// - [JsonInclude, JsonPropertyName("path")] - public Elastic.Clients.Elasticsearch.Field Path { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Path { get; set; } /// /// /// Query you wish to run on nested objects in the path. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } public string? QueryName { get; set; } /// @@ -79,31 +194,27 @@ public sealed partial class NestedQuery /// How scores for matching child objects affect the root parent document’s relevance score. /// /// - [JsonInclude, JsonPropertyName("score_mode")] public Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreMode { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(NestedQuery nestedQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Nested(nestedQuery); } -public sealed partial class NestedQueryDescriptor : SerializableDescriptor> +public readonly partial struct NestedQueryDescriptor { - internal NestedQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery instance) + { + Instance = instance; + } - public NestedQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action> InnerHitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreModeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -113,10 +224,10 @@ public NestedQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public NestedQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -124,10 +235,10 @@ public NestedQueryDescriptor Boost(float? boost) /// Indicates whether to ignore an unmapped path and not return any documents instead of an error. /// /// - public NestedQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -135,39 +246,32 @@ public NestedQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = tr /// If defined, each search hit will contain inner hits. /// /// - public NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) - { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; - } - - public NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = value; + return this; } - public NestedQueryDescriptor InnerHits(Action> configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits() { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } /// /// - /// Path to the nested object you wish to search. + /// If defined, each search hit will contain inner hits. /// /// - public NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits(System.Action>? action) { - PathValue = path; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -175,10 +279,10 @@ public NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field /// Path to the nested object you wish to search. /// /// - public NestedQueryDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -186,10 +290,10 @@ public NestedQueryDescriptor Path(Expression /// - public NestedQueryDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -197,34 +301,27 @@ public NestedQueryDescriptor Path(Expression> /// Query you wish to run on nested objects in the path. /// /// - public NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) - { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; - } - - public NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = value; + return this; } - public NestedQueryDescriptor Query(Action> configure) + /// + /// + /// Query you wish to run on nested objects in the path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -232,96 +329,39 @@ public NestedQueryDescriptor QueryName(string? queryName) /// How scores for matching child objects affect the root parent document’s relevance score. /// /// - public NestedQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NestedQueryDescriptor : SerializableDescriptor +public readonly partial struct NestedQueryDescriptor { - internal NestedQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery instance) + { + Instance = instance; + } - public NestedQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NestedQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } - private Action InnerHitsDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? ScoreModeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -331,10 +371,10 @@ public NestedQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public NestedQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -342,10 +382,10 @@ public NestedQueryDescriptor Boost(float? boost) /// Indicates whether to ignore an unmapped path and not return any documents instead of an error. /// /// - public NestedQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } /// @@ -353,39 +393,43 @@ public NestedQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) /// If defined, each search hit will contain inner hits. /// /// - public NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? innerHits) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHits? value) { - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = null; - InnerHitsValue = innerHits; - return Self; + Instance.InnerHits = value; + return this; } - public NestedQueryDescriptor InnerHits(Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor descriptor) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits() { - InnerHitsValue = null; - InnerHitsDescriptorAction = null; - InnerHitsDescriptor = descriptor; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(null); + return this; } - public NestedQueryDescriptor InnerHits(Action configure) + /// + /// + /// If defined, each search hit will contain inner hits. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits(System.Action? action) { - InnerHitsValue = null; - InnerHitsDescriptor = null; - InnerHitsDescriptorAction = configure; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// /// - /// Path to the nested object you wish to search. + /// If defined, each search hit will contain inner hits. /// /// - public NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor InnerHits(System.Action>? action) { - PathValue = path; - return Self; + Instance.InnerHits = Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor.Build(action); + return this; } /// @@ -393,10 +437,10 @@ public NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field path) /// Path to the nested object you wish to search. /// /// - public NestedQueryDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -404,10 +448,10 @@ public NestedQueryDescriptor Path(Expression /// - public NestedQueryDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } /// @@ -415,34 +459,38 @@ public NestedQueryDescriptor Path(Expression> /// Query you wish to run on nested objects in the path. /// /// - public NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public NestedQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query you wish to run on nested objects in the path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedQueryDescriptor Query(Action configure) + /// + /// + /// Query you wish to run on nested objects in the path. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public NestedQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -450,73 +498,17 @@ public NestedQueryDescriptor QueryName(string? queryName) /// How scores for matching child objects affect the root parent document’s relevance score. /// /// - public NestedQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? scoreMode) + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor ScoreMode(Elastic.Clients.Elasticsearch.QueryDsl.ChildScoreMode? value) { - ScoreModeValue = scoreMode; - return Self; + Instance.ScoreMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (InnerHitsDescriptor is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsDescriptor, options); - } - else if (InnerHitsDescriptorAction is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor(InnerHitsDescriptorAction), options); - } - else if (InnerHitsValue is not null) - { - writer.WritePropertyName("inner_hits"); - JsonSerializer.Serialize(writer, InnerHitsValue, options); - } - - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScoreModeValue is not null) - { - writer.WritePropertyName("score_mode"); - JsonSerializer.Serialize(writer, ScoreModeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs index cfbc2a0079e..5facaf08a84 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs @@ -17,144 +17,152 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class NumberRangeQueryConverter : JsonConverter +internal sealed partial class NumberRangeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override NumberRangeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText PropGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText PropLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText PropLte = System.Text.Json.JsonEncodedText.Encode("lte"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new NumberRangeQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFrom = default; + LocalJsonValue propGt = default; + LocalJsonValue propGte = default; + LocalJsonValue propLt = default; + LocalJsonValue propLte = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRelation = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gt") - { - variant.Gt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gte") - { - variant.Gte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lt") - { - variant.Lt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lte") - { - variant.Lte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "relation") - { - variant.Relation = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - reader.Read(); - return variant; - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, NumberRangeQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize NumberRangeQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propGt.TryReadProperty(ref reader, options, PropGt, null)) + { + continue; + } - if (value.Gt.HasValue) - { - writer.WritePropertyName("gt"); - writer.WriteNumberValue(value.Gt.Value); - } + if (propGte.TryReadProperty(ref reader, options, PropGte, null)) + { + continue; + } - if (value.Gte.HasValue) - { - writer.WritePropertyName("gte"); - writer.WriteNumberValue(value.Gte.Value); - } + if (propLt.TryReadProperty(ref reader, options, PropLt, null)) + { + continue; + } - if (value.Lt.HasValue) - { - writer.WritePropertyName("lt"); - writer.WriteNumberValue(value.Lt.Value); - } + if (propLte.TryReadProperty(ref reader, options, PropLte, null)) + { + continue; + } - if (value.Lte.HasValue) - { - writer.WritePropertyName("lte"); - writer.WriteNumberValue(value.Lte.Value); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Relation is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, value.Relation, options); - } + Boost = propBoost.Value, + Field = propField.Value, + From = propFrom.Value, + Gt = propGt.Value, + Gte = propGte.Value, + Lt = propLt.Value, + Lte = propLte.Value, + QueryName = propQueryName.Value, + Relation = propRelation.Value, + To = propTo.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropGt, value.Gt, null, null); + writer.WriteProperty(options, PropGte, value.Gte, null, null); + writer.WriteProperty(options, PropLt, value.Lt, null, null); + writer.WriteProperty(options, PropLte, value.Lte, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(NumberRangeQueryConverter))] -public sealed partial class NumberRangeQuery +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryConverter))] +public sealed partial class NumberRangeQuery : Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public NumberRangeQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } +#if NET7_0_OR_GREATER + public NumberRangeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// @@ -165,35 +173,40 @@ public NumberRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public double? From { get; set; } /// /// /// Greater than. /// /// - public double? Gt { get; set; } + public Elastic.Clients.Elasticsearch.Number? Gt { get; set; } /// /// /// Greater than or equal to. /// /// - public double? Gte { get; set; } + public Elastic.Clients.Elasticsearch.Number? Gte { get; set; } /// /// /// Less than. /// /// - public double? Lt { get; set; } + public Elastic.Clients.Elasticsearch.Number? Lt { get; set; } /// /// /// Less than or equal to. /// /// - public double? Lte { get; set; } + public Elastic.Clients.Elasticsearch.Number? Lte { get; set; } public string? QueryName { get; set; } /// @@ -202,24 +215,29 @@ public NumberRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? Relation { get; set; } + public double? To { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery.Type => "number"; } -public sealed partial class NumberRangeQueryDescriptor : SerializableDescriptor> +public readonly partial struct NumberRangeQueryDescriptor { - internal NumberRangeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumberRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery instance) + { + Instance = instance; + } - public NumberRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumberRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private double? GtValue { get; set; } - private double? GteValue { get; set; } - private double? LtValue { get; set; } - private double? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -229,28 +247,28 @@ public NumberRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public NumberRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public NumberRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumberRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumberRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor From(double? value) { - FieldValue = field; - return Self; + Instance.From = value; + return this; } /// @@ -258,10 +276,10 @@ public NumberRangeQueryDescriptor Field(Expression /// - public NumberRangeQueryDescriptor Gt(double? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.Number? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -269,10 +287,10 @@ public NumberRangeQueryDescriptor Gt(double? gt) /// Greater than or equal to. /// /// - public NumberRangeQueryDescriptor Gte(double? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.Number? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -280,10 +298,10 @@ public NumberRangeQueryDescriptor Gte(double? gte) /// Less than. /// /// - public NumberRangeQueryDescriptor Lt(double? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.Number? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -291,16 +309,16 @@ public NumberRangeQueryDescriptor Lt(double? lt) /// Less than or equal to. /// /// - public NumberRangeQueryDescriptor Lte(double? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.Number? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public NumberRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -308,82 +326,45 @@ public NumberRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public NumberRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor To(double? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (GtValue.HasValue) - { - writer.WritePropertyName("gt"); - writer.WriteNumberValue(GtValue.Value); - } - - if (GteValue.HasValue) - { - writer.WritePropertyName("gte"); - writer.WriteNumberValue(GteValue.Value); - } - - if (LtValue.HasValue) - { - writer.WritePropertyName("lt"); - writer.WriteNumberValue(LtValue.Value); - } - - if (LteValue.HasValue) - { - writer.WritePropertyName("lte"); - writer.WriteNumberValue(LteValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NumberRangeQueryDescriptor : SerializableDescriptor +public readonly partial struct NumberRangeQueryDescriptor { - internal NumberRangeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumberRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery instance) + { + Instance = instance; + } - public NumberRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumberRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private double? GtValue { get; set; } - private double? GteValue { get; set; } - private double? LtValue { get; set; } - private double? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -393,28 +374,28 @@ public NumberRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public NumberRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public NumberRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumberRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumberRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor From(double? value) { - FieldValue = field; - return Self; + Instance.From = value; + return this; } /// @@ -422,10 +403,10 @@ public NumberRangeQueryDescriptor Field(Expression /// - public NumberRangeQueryDescriptor Gt(double? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Gt(Elastic.Clients.Elasticsearch.Number? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -433,10 +414,10 @@ public NumberRangeQueryDescriptor Gt(double? gt) /// Greater than or equal to. /// /// - public NumberRangeQueryDescriptor Gte(double? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Gte(Elastic.Clients.Elasticsearch.Number? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -444,10 +425,10 @@ public NumberRangeQueryDescriptor Gte(double? gte) /// Less than. /// /// - public NumberRangeQueryDescriptor Lt(double? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Lt(Elastic.Clients.Elasticsearch.Number? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -455,16 +436,16 @@ public NumberRangeQueryDescriptor Lt(double? lt) /// Less than or equal to. /// /// - public NumberRangeQueryDescriptor Lte(double? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Lte(Elastic.Clients.Elasticsearch.Number? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public NumberRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -472,62 +453,23 @@ public NumberRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public NumberRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor To(double? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (GtValue.HasValue) - { - writer.WritePropertyName("gt"); - writer.WriteNumberValue(GtValue.Value); - } - - if (GteValue.HasValue) - { - writer.WritePropertyName("gte"); - writer.WriteNumberValue(GteValue.Value); - } - - if (LtValue.HasValue) - { - writer.WritePropertyName("lt"); - writer.WriteNumberValue(LtValue.Value); - } - - if (LteValue.HasValue) - { - writer.WritePropertyName("lte"); - writer.WriteNumberValue(LteValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumericDecayFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumericDecayFunction.g.cs index 7b69411a236..ddbf89dac18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumericDecayFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumericDecayFunction.g.cs @@ -17,72 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class NumericDecayFunctionConverter : JsonConverter +internal sealed partial class NumericDecayFunctionConverter : System.Text.Json.Serialization.JsonConverter { - public override NumericDecayFunction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new NumericDecayFunction(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var property = reader.GetString(); - if (property == "multi_value_mode") - { - variant.MultiValueMode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Placement = JsonSerializer.Deserialize>(ref reader, options); - } - } - - return variant; - } + private static readonly System.Text.Json.JsonEncodedText PropMultiValueMode = System.Text.Json.JsonEncodedText.Encode("multi_value_mode"); - public override void Write(Utf8JsonWriter writer, NumericDecayFunction value, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - writer.WriteStartObject(); - if (value.Field is not null && value.Placement is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMultiValueMode = default; + LocalJsonValue> propPlacement = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (!options.TryGetClientSettings(out var settings)) + if (propMultiValueMode.TryReadProperty(ref reader, options, PropMultiValueMode, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Placement, options); + propField.Initialized = propPlacement.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propPlacement.Value, null, null); } - if (value.MultiValueMode is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, value.MultiValueMode, options); - } + Field = propField.Value, + MultiValueMode = propMultiValueMode.Value, + Placement = propPlacement.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMultiValueMode, value.MultiValueMode, null, null); + writer.WriteProperty(options, value.Field, value.Placement, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(NumericDecayFunctionConverter))] -public sealed partial class NumericDecayFunction +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionConverter))] +public sealed partial class NumericDecayFunction : Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction { - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericDecayFunction(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + { + Field = field; + Placement = placement; + } +#if NET7_0_OR_GREATER + public NumericDecayFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NumericDecayFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -90,37 +100,44 @@ public sealed partial class NumericDecayFunction /// /// public Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueMode { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction.Type => "numeric"; } -public sealed partial class NumericDecayFunctionDescriptor : SerializableDescriptor> +public readonly partial struct NumericDecayFunctionDescriptor { - internal NumericDecayFunctionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction Instance { get; init; } - public NumericDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public NumericDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NumericDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumericDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -128,66 +145,68 @@ public NumericDecayFunctionDescriptor Field(Expression /// - public NumericDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public NumericDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class NumericDecayFunctionDescriptor : SerializableDescriptor +public readonly partial struct NumericDecayFunctionDescriptor { - internal NumericDecayFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction Instance { get; init; } - public NumericDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public NumericDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NumericDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public NumericDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public NumericDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -195,34 +214,35 @@ public NumericDecayFunctionDescriptor Field(Expression /// - public NumericDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public NumericDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfDoubleDoubleDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.NumericDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ParentIdQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ParentIdQuery.g.cs index baa18ceeb38..fafb54237ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ParentIdQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ParentIdQuery.g.cs @@ -17,18 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ParentIdQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propId = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Id = propId.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + QueryName = propQueryName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryConverter))] public sealed partial class ParentIdQuery { +#if NET7_0_OR_GREATER + public ParentIdQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public ParentIdQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ParentIdQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +125,6 @@ public sealed partial class ParentIdQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +132,6 @@ public sealed partial class ParentIdQuery /// ID of the parent document. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -53,9 +139,7 @@ public sealed partial class ParentIdQuery /// Indicates whether to ignore an unmapped type and not return any documents instead of an error. /// /// - [JsonInclude, JsonPropertyName("ignore_unmapped")] public bool? IgnoreUnmapped { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -63,25 +147,27 @@ public sealed partial class ParentIdQuery /// Name of the child relationship mapped for the join field. /// /// - [JsonInclude, JsonPropertyName("type")] public string? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ParentIdQuery parentIdQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.ParentId(parentIdQuery); } -public sealed partial class ParentIdQueryDescriptor : SerializableDescriptor +public readonly partial struct ParentIdQueryDescriptor { - internal ParentIdQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery Instance { get; init; } - public ParentIdQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentIdQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private string? TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentIdQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -91,10 +177,10 @@ public ParentIdQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ParentIdQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -102,10 +188,10 @@ public ParentIdQueryDescriptor Boost(float? boost) /// ID of the parent document. /// /// - public ParentIdQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -113,16 +199,16 @@ public ParentIdQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// Indicates whether to ignore an unmapped type and not return any documents instead of an error. /// /// - public ParentIdQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public ParentIdQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -130,45 +216,22 @@ public ParentIdQueryDescriptor QueryName(string? queryName) /// Name of the child relationship mapped for the join field. /// /// - public ParentIdQueryDescriptor Type(string? type) + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor Type(string? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IdValue is not null) + if (action is null) { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(TypeValue)) - { - writer.WritePropertyName("type"); - writer.WriteStringValue(TypeValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PercolateQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PercolateQuery.g.cs index c20798d7bb4..fe7c7e1e82e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PercolateQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PercolateQuery.g.cs @@ -17,18 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class PercolateQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDocument = System.Text.Json.JsonEncodedText.Encode("document"); + private static readonly System.Text.Json.JsonEncodedText PropDocuments = System.Text.Json.JsonEncodedText.Encode("documents"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropPreference = System.Text.Json.JsonEncodedText.Encode("preference"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propDocument = default; + LocalJsonValue?> propDocuments = default; + LocalJsonValue propField = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propName = default; + LocalJsonValue propPreference = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRouting = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propDocument.TryReadProperty(ref reader, options, PropDocument, null)) + { + continue; + } + + if (propDocuments.TryReadProperty(ref reader, options, PropDocuments, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propPreference.TryReadProperty(ref reader, options, PropPreference, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Document = propDocument.Value, + Documents = propDocuments.Value, + Field = propField.Value, + Id = propId.Value, + Index = propIndex.Value, + Name = propName.Value, + Preference = propPreference.Value, + QueryName = propQueryName.Value, + Routing = propRouting.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDocument, value.Document, null, null); + writer.WriteProperty(options, PropDocuments, value.Documents, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropPreference, value.Preference, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryConverter))] public sealed partial class PercolateQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolateQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public PercolateQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PercolateQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +185,6 @@ public sealed partial class PercolateQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +192,6 @@ public sealed partial class PercolateQuery /// The source of the document being percolated. /// /// - [JsonInclude, JsonPropertyName("document")] public object? Document { get; set; } /// @@ -53,23 +199,24 @@ public sealed partial class PercolateQuery /// An array of sources of the documents being percolated. /// /// - [JsonInclude, JsonPropertyName("documents")] - public ICollection? Documents { get; set; } + public System.Collections.Generic.ICollection? Documents { get; set; } /// /// /// Field that holds the indexed queries. The field must use the percolator mapping type. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The ID of a stored document to percolate. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -77,7 +224,6 @@ public sealed partial class PercolateQuery /// The index of a stored document to percolate. /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -85,7 +231,6 @@ public sealed partial class PercolateQuery /// The suffix used for the _percolator_document_slot field when multiple percolate queries are specified. /// /// - [JsonInclude, JsonPropertyName("name")] public string? Name { get; set; } /// @@ -93,9 +238,7 @@ public sealed partial class PercolateQuery /// Preference used to fetch document to percolate. /// /// - [JsonInclude, JsonPropertyName("preference")] public string? Preference { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -103,7 +246,6 @@ public sealed partial class PercolateQuery /// Routing used to fetch document to percolate. /// /// - [JsonInclude, JsonPropertyName("routing")] public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } /// @@ -111,31 +253,27 @@ public sealed partial class PercolateQuery /// The expected version of a stored document to percolate. /// /// - [JsonInclude, JsonPropertyName("version")] public long? Version { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(PercolateQuery percolateQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Percolate(percolateQuery); } -public sealed partial class PercolateQueryDescriptor : SerializableDescriptor> +public readonly partial struct PercolateQueryDescriptor { - internal PercolateQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolateQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery instance) + { + Instance = instance; + } - public PercolateQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolateQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private object? DocumentValue { get; set; } - private ICollection? DocumentsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private string? NameValue { get; set; } - private string? PreferenceValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private long? VersionValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -145,10 +283,10 @@ public PercolateQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public PercolateQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -156,10 +294,10 @@ public PercolateQueryDescriptor Boost(float? boost) /// The source of the document being percolated. /// /// - public PercolateQueryDescriptor Document(object? document) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Document(object? value) { - DocumentValue = document; - return Self; + Instance.Document = value; + return this; } /// @@ -167,21 +305,21 @@ public PercolateQueryDescriptor Document(object? document) /// An array of sources of the documents being percolated. /// /// - public PercolateQueryDescriptor Documents(ICollection? documents) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Documents(System.Collections.Generic.ICollection? value) { - DocumentsValue = documents; - return Self; + Instance.Documents = value; + return this; } /// /// - /// Field that holds the indexed queries. The field must use the percolator mapping type. + /// An array of sources of the documents being percolated. /// /// - public PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Documents(params object[] values) { - FieldValue = field; - return Self; + Instance.Documents = [.. values]; + return this; } /// @@ -189,10 +327,10 @@ public PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.F /// Field that holds the indexed queries. The field must use the percolator mapping type. /// /// - public PercolateQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -200,10 +338,10 @@ public PercolateQueryDescriptor Field(Expressionpercolator mapping type. /// /// - public PercolateQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -211,10 +349,10 @@ public PercolateQueryDescriptor Field(Expression /// - public PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -222,10 +360,10 @@ public PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? /// The index of a stored document to percolate. /// /// - public PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -233,10 +371,10 @@ public PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.I /// The suffix used for the _percolator_document_slot field when multiple percolate queries are specified. /// /// - public PercolateQueryDescriptor Name(string? name) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Name(string? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -244,16 +382,16 @@ public PercolateQueryDescriptor Name(string? name) /// Preference used to fetch document to percolate. /// /// - public PercolateQueryDescriptor Preference(string? preference) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Preference(string? value) { - PreferenceValue = preference; - return Self; + Instance.Preference = value; + return this; } - public PercolateQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -261,10 +399,10 @@ public PercolateQueryDescriptor QueryName(string? queryName) /// Routing used to fetch document to percolate. /// /// - public PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -272,100 +410,39 @@ public PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch /// The expected version of a stored document to percolate. /// /// - public PercolateQueryDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DocumentValue is not null) - { - writer.WritePropertyName("document"); - JsonSerializer.Serialize(writer, DocumentValue, options); - } - - if (DocumentsValue is not null) - { - writer.WritePropertyName("documents"); - JsonSerializer.Serialize(writer, DocumentsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (!string.IsNullOrEmpty(NameValue)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); - } - - if (!string.IsNullOrEmpty(PreferenceValue)) - { - writer.WritePropertyName("preference"); - writer.WriteStringValue(PreferenceValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PercolateQueryDescriptor : SerializableDescriptor +public readonly partial struct PercolateQueryDescriptor { - internal PercolateQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery Instance { get; init; } - public PercolateQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolateQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private object? DocumentValue { get; set; } - private ICollection? DocumentsValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private string? NameValue { get; set; } - private string? PreferenceValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - private long? VersionValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PercolateQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -375,10 +452,10 @@ public PercolateQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public PercolateQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -386,10 +463,10 @@ public PercolateQueryDescriptor Boost(float? boost) /// The source of the document being percolated. /// /// - public PercolateQueryDescriptor Document(object? document) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Document(object? value) { - DocumentValue = document; - return Self; + Instance.Document = value; + return this; } /// @@ -397,21 +474,21 @@ public PercolateQueryDescriptor Document(object? document) /// An array of sources of the documents being percolated. /// /// - public PercolateQueryDescriptor Documents(ICollection? documents) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Documents(System.Collections.Generic.ICollection? value) { - DocumentsValue = documents; - return Self; + Instance.Documents = value; + return this; } /// /// - /// Field that holds the indexed queries. The field must use the percolator mapping type. + /// An array of sources of the documents being percolated. /// /// - public PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Documents(params object[] values) { - FieldValue = field; - return Self; + Instance.Documents = [.. values]; + return this; } /// @@ -419,10 +496,10 @@ public PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// Field that holds the indexed queries. The field must use the percolator mapping type. /// /// - public PercolateQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -430,10 +507,10 @@ public PercolateQueryDescriptor Field(Expressionpercolator mapping type. /// /// - public PercolateQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -441,10 +518,10 @@ public PercolateQueryDescriptor Field(Expression /// - public PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -452,10 +529,10 @@ public PercolateQueryDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// The index of a stored document to percolate. /// /// - public PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -463,10 +540,10 @@ public PercolateQueryDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? i /// The suffix used for the _percolator_document_slot field when multiple percolate queries are specified. /// /// - public PercolateQueryDescriptor Name(string? name) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Name(string? value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -474,16 +551,16 @@ public PercolateQueryDescriptor Name(string? name) /// Preference used to fetch document to percolate. /// /// - public PercolateQueryDescriptor Preference(string? preference) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Preference(string? value) { - PreferenceValue = preference; - return Self; + Instance.Preference = value; + return this; } - public PercolateQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -491,10 +568,10 @@ public PercolateQueryDescriptor QueryName(string? queryName) /// Routing used to fetch document to percolate. /// /// - public PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } /// @@ -502,77 +579,17 @@ public PercolateQueryDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? r /// The expected version of a stored document to percolate. /// /// - public PercolateQueryDescriptor Version(long? version) + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor Version(long? value) { - VersionValue = version; - return Self; + Instance.Version = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DocumentValue is not null) - { - writer.WritePropertyName("document"); - JsonSerializer.Serialize(writer, DocumentValue, options); - } - - if (DocumentsValue is not null) - { - writer.WritePropertyName("documents"); - JsonSerializer.Serialize(writer, DocumentsValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - } - - if (!string.IsNullOrEmpty(NameValue)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(NameValue); - } - - if (!string.IsNullOrEmpty(PreferenceValue)) - { - writer.WritePropertyName("preference"); - writer.WriteStringValue(PreferenceValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - if (VersionValue.HasValue) - { - writer.WritePropertyName("version"); - writer.WriteNumberValue(VersionValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedDoc.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedDoc.g.cs index 41e1d42111d..a068e6c3a29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedDoc.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedDoc.g.cs @@ -17,55 +17,132 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class PinnedDocConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocConverter))] public sealed partial class PinnedDoc { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedDoc(Elastic.Clients.Elasticsearch.Id id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public PinnedDoc() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PinnedDoc() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PinnedDoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The unique document ID. /// /// - [JsonInclude, JsonPropertyName("_id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } /// /// /// The index that contains the document. /// /// - [JsonInclude, JsonPropertyName("_index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } } -public sealed partial class PinnedDocDescriptor : SerializableDescriptor +public readonly partial struct PinnedDocDescriptor { - internal PinnedDocDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc Instance { get; init; } - public PinnedDocDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedDocDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedDocDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor descriptor) => descriptor.Instance; /// /// /// The unique document ID. /// /// - public PinnedDocDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -73,19 +150,17 @@ public PinnedDocDescriptor Id(Elastic.Clients.Elasticsearch.Id id) /// The index that contains the document. /// /// - public PinnedDocDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("_id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedQuery.g.cs index 26dd33fbbfb..369ae9d7b7d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PinnedQuery.g.cs @@ -17,215 +17,274 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(PinnedQueryConverter))] -public sealed partial class PinnedQuery +internal sealed partial class PinnedQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal PinnedQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static PinnedQuery Docs(IReadOnlyCollection pinnedDoc) => new PinnedQuery("docs", pinnedDoc); - public static PinnedQuery Ids(IReadOnlyCollection id) => new PinnedQuery("ids", id); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropOrganic = System.Text.Json.JsonEncodedText.Encode("organic"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText VariantDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText VariantIds = System.Text.Json.JsonEncodedText.Encode("ids"); - /// - /// - /// Floating point number used to decrease or increase the relevance scores of the query. - /// Boost values are relative to the default value of 1.0. - /// A boost value between 0 and 1.0 decreases the relevance score. - /// A value greater than 1.0 increases the relevance score. - /// - /// - [JsonInclude, JsonPropertyName("boost")] - public float? Boost { get; set; } - - /// - /// - /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. - /// - /// - [JsonInclude, JsonPropertyName("organic")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Organic { get; set; } - [JsonInclude, JsonPropertyName("_name")] - public string? QueryName { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propOrganic = default; + LocalJsonValue propQueryName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class PinnedQueryConverter : JsonConverter -{ - public override PinnedQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - float? boostValue = default; - Elastic.Clients.Elasticsearch.QueryDsl.Query organicValue = default; - string? queryNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "boost") + if (propOrganic.TryReadProperty(ref reader, options, PropOrganic, null)) { - boostValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "organic") + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) { - organicValue = JsonSerializer.Deserialize(ref reader, options); continue; } - if (propertyName == "_name") + if (reader.ValueTextEquals(VariantDocs)) { - queryNameValue = JsonSerializer.Deserialize(ref reader, options); + variantType = VariantDocs.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); continue; } - if (propertyName == "docs") + if (reader.ValueTextEquals(VariantIds)) { - variantValue = JsonSerializer.Deserialize?>(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIds.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); continue; } - if (propertyName == "ids") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize?>(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'PinnedQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new PinnedQuery(variantNameValue, variantValue); - result.Boost = boostValue; - result.Organic = organicValue; - result.QueryName = queryNameValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Boost = propBoost.Value, + Organic = propOrganic.Value, + QueryName = propQueryName.Value + }; } - public override void Write(Utf8JsonWriter writer, PinnedQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Boost.HasValue) + switch (value.VariantType) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); + case null: + break; + case "docs": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.ICollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + case "ids": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.ICollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery)}'."); } - if (value.Organic is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, value.Organic, options); - } + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropOrganic, value.Organic, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryConverter))] +public sealed partial class PinnedQuery +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query organic) + { + Organic = organic; + } +#if NET7_0_OR_GREATER + public PinnedQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PinnedQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public System.Collections.Generic.ICollection? Docs { get => GetVariant>("docs"); set => SetVariant("docs", value); } - if (value.VariantName is not null && value.Variant is not null) + /// + /// + /// Document IDs listed in the order they are to appear in results. + /// Required if docs is not specified. + /// + /// + public System.Collections.Generic.ICollection? Ids { get => GetVariant>("ids"); set => SetVariant("ids", value); } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + + /// + /// + /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Organic { get; set; } + public string? QueryName { get; set; } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "docs": - JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); - break; - case "ids": - JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); - break; - } + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class PinnedQueryDescriptor : SerializableDescriptor> +public readonly partial struct PinnedQueryDescriptor { - internal PinnedQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery instance) + { + Instance = instance; + } - public PinnedQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(System.Collections.Generic.ICollection? value) + { + Instance.Docs = value; + return this; + } + + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(params Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc[] values) + { + Instance.Docs = [.. values]; + return this; + } - private PinnedQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(params System.Action[] actions) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - private PinnedQueryDescriptor Set(object variant, string variantName) + /// + /// + /// Document IDs listed in the order they are to appear in results. + /// Required if docs is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Ids(System.Collections.Generic.ICollection? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Ids = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query OrganicValue { get; set; } - private string? QueryNameValue { get; set; } + /// + /// + /// Document IDs listed in the order they are to appear in results. + /// Required if docs is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) + { + Instance.Ids = [.. values]; + return this; + } /// /// @@ -235,10 +294,10 @@ private PinnedQueryDescriptor Set(object variant, string variantName) /// A value greater than 1.0 increases the relevance score. /// /// - public PinnedQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -246,94 +305,122 @@ public PinnedQueryDescriptor Boost(float? boost) /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. /// /// - public PinnedQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query organic) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - OrganicValue = organic; - return Self; + Instance.Organic = value; + return this; } - public PinnedQueryDescriptor QueryName(string? queryName) + /// + /// + /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Organic(System.Action> action) { - QueryNameValue = queryName; - return Self; + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public PinnedQueryDescriptor Docs(IReadOnlyCollection pinnedDoc) => Set(pinnedDoc, "docs"); - public PinnedQueryDescriptor Docs(Action configure) => Set(configure, "docs"); - public PinnedQueryDescriptor Ids(IReadOnlyCollection id) => Set(id, "ids"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor QueryName(string? value) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (OrganicValue is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicValue, options); - } + Instance.QueryName = value; + return this; + } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } +public readonly partial struct PinnedQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery Instance { get; init; } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PinnedQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class PinnedQueryDescriptor : SerializableDescriptor -{ - internal PinnedQueryDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor descriptor) => descriptor.Instance; - public PinnedQueryDescriptor() : base() + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(System.Collections.Generic.ICollection? value) { + Instance.Docs = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(params Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc[] values) + { + Instance.Docs = [.. values]; + return this; + } - private PinnedQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Documents listed in the order they are to appear in results. + /// Required if ids is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Docs(params System.Action[] actions) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - private PinnedQueryDescriptor Set(object variant, string variantName) + /// + /// + /// Document IDs listed in the order they are to appear in results. + /// Required if docs is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Ids(System.Collections.Generic.ICollection? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Ids = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query OrganicValue { get; set; } - private string? QueryNameValue { get; set; } + /// + /// + /// Document IDs listed in the order they are to appear in results. + /// Required if docs is not specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) + { + Instance.Ids = [.. values]; + return this; + } /// /// @@ -343,10 +430,10 @@ private PinnedQueryDescriptor Set(object variant, string variantName) /// A value greater than 1.0 increases the relevance score. /// /// - public PinnedQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -354,56 +441,45 @@ public PinnedQueryDescriptor Boost(float? boost) /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. /// /// - public PinnedQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query organic) + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - OrganicValue = organic; - return Self; + Instance.Organic = value; + return this; } - public PinnedQueryDescriptor QueryName(string? queryName) + /// + /// + /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Organic(System.Action action) { - QueryNameValue = queryName; - return Self; + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public PinnedQueryDescriptor Docs(IReadOnlyCollection pinnedDoc) => Set(pinnedDoc, "docs"); - public PinnedQueryDescriptor Docs(Action configure) => Set(configure, "docs"); - public PinnedQueryDescriptor Ids(IReadOnlyCollection id) => Set(id, "ids"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Any choice of query used to rank documents which will be ranked below the "pinned" documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor Organic(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (OrganicValue is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs index bf5373da149..8cadf02b325 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs @@ -17,117 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class PrefixQueryConverter : JsonConverter +internal sealed partial class PrefixQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override PrefixQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCaseInsensitive = System.Text.Json.JsonEncodedText.Encode("case_insensitive"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new PrefixQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "case_insensitive") - { - variant.CaseInsensitive = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rewrite") - { - variant.Rewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Value = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, PrefixQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize PrefixQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCaseInsensitive = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.CaseInsensitive.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(value.CaseInsensitive.Value); - } + if (propCaseInsensitive.TryReadProperty(ref reader, options, PropCaseInsensitive, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.Rewrite)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(value.Rewrite); - } + Boost = propBoost.Value, + CaseInsensitive = propCaseInsensitive.Value, + Field = propField.Value, + QueryName = propQueryName.Value, + Rewrite = propRewrite.Value, + Value = propValue.Value + }; + } - writer.WritePropertyName("value"); - writer.WriteStringValue(value.Value); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCaseInsensitive, value.CaseInsensitive, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(PrefixQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryConverter))] public sealed partial class PrefixQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public PrefixQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrefixQuery(Elastic.Clients.Elasticsearch.Field field, string value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public PrefixQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -145,7 +163,11 @@ public PrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public bool? CaseInsensitive { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } /// @@ -160,28 +182,31 @@ public PrefixQuery(Elastic.Clients.Elasticsearch.Field field) /// Beginning characters of terms you wish to find in the provided field. /// /// - public string Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Prefix(prefixQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Prefix(prefixQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Prefix(prefixQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Prefix(prefixQuery); + public +#if NET7_0_OR_GREATER + required +#endif + string Value { get; set; } } -public sealed partial class PrefixQueryDescriptor : SerializableDescriptor> +public readonly partial struct PrefixQueryDescriptor { - internal PrefixQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery Instance { get; init; } - public PrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrefixQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -191,10 +216,10 @@ public PrefixQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public PrefixQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -203,34 +228,28 @@ public PrefixQueryDescriptor Boost(float? boost) /// Default is false which means the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public PrefixQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public PrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public PrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -238,10 +257,10 @@ public PrefixQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public PrefixQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -249,64 +268,39 @@ public PrefixQueryDescriptor Rewrite(string? rewrite) /// Beginning characters of terms you wish to find in the provided field. /// /// - public PrefixQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Value(string value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PrefixQueryDescriptor : SerializableDescriptor +public readonly partial struct PrefixQueryDescriptor { - internal PrefixQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery Instance { get; init; } - public PrefixQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrefixQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -316,10 +310,10 @@ public PrefixQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public PrefixQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -328,34 +322,28 @@ public PrefixQueryDescriptor Boost(float? boost) /// Default is false which means the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public PrefixQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public PrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public PrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PrefixQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public PrefixQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -363,10 +351,10 @@ public PrefixQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public PrefixQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -374,46 +362,17 @@ public PrefixQueryDescriptor Rewrite(string? rewrite) /// Beginning characters of terms you wish to find in the provided field. /// /// - public PrefixQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor Value(string value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs index f1dd33535f6..d39ba7c2663 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs @@ -17,1065 +17,4787 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -/// -/// -/// An Elasticsearch Query DSL (Domain Specific Language) object that defines a query. -/// -/// -[JsonConverter(typeof(QueryConverter))] -public sealed partial class Query +internal sealed partial class QueryConverter : System.Text.Json.Serialization.JsonConverter { - internal Query(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Query Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new Query("bool", boolQuery); - public static Query Boosting(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery boostingQuery) => new Query("boosting", boostingQuery); - public static Query CombinedFields(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery combinedFieldsQuery) => new Query("combined_fields", combinedFieldsQuery); - public static Query ConstantScore(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery constantScoreQuery) => new Query("constant_score", constantScoreQuery); - public static Query DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery disMaxQuery) => new Query("dis_max", disMaxQuery); - public static Query DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery distanceFeatureQuery) => new Query("distance_feature", distanceFeatureQuery); - public static Query DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery distanceFeatureQuery) => new Query("distance_feature", distanceFeatureQuery); - public static Query DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery distanceFeatureQuery) => new Query("distance_feature", distanceFeatureQuery); - public static Query Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new Query("exists", existsQuery); - public static Query FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => new Query("function_score", functionScoreQuery); - public static Query Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => new Query("fuzzy", fuzzyQuery); - public static Query GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery geoBoundingBoxQuery) => new Query("geo_bounding_box", geoBoundingBoxQuery); - public static Query GeoDistance(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery geoDistanceQuery) => new Query("geo_distance", geoDistanceQuery); - public static Query GeoGrid(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery geoGridQuery) => new Query("geo_grid", geoGridQuery); - public static Query GeoShape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery geoShapeQuery) => new Query("geo_shape", geoShapeQuery); - public static Query HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery hasChildQuery) => new Query("has_child", hasChildQuery); - public static Query HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery hasParentQuery) => new Query("has_parent", hasParentQuery); - public static Query Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new Query("ids", idsQuery); - public static Query Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery intervalsQuery) => new Query("intervals", intervalsQuery); - public static Query Knn(Elastic.Clients.Elasticsearch.KnnQuery knnQuery) => new Query("knn", knnQuery); - public static Query Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new Query("match", matchQuery); - public static Query MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new Query("match_all", matchAllQuery); - public static Query MatchBoolPrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery matchBoolPrefixQuery) => new Query("match_bool_prefix", matchBoolPrefixQuery); - public static Query MatchNone(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery matchNoneQuery) => new Query("match_none", matchNoneQuery); - public static Query MatchPhrase(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery matchPhraseQuery) => new Query("match_phrase", matchPhraseQuery); - public static Query MatchPhrasePrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery matchPhrasePrefixQuery) => new Query("match_phrase_prefix", matchPhrasePrefixQuery); - public static Query MoreLikeThis(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery moreLikeThisQuery) => new Query("more_like_this", moreLikeThisQuery); - public static Query MultiMatch(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery multiMatchQuery) => new Query("multi_match", multiMatchQuery); - public static Query Nested(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery nestedQuery) => new Query("nested", nestedQuery); - public static Query ParentId(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery parentIdQuery) => new Query("parent_id", parentIdQuery); - public static Query Percolate(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery percolateQuery) => new Query("percolate", percolateQuery); - public static Query Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery pinnedQuery) => new Query("pinned", pinnedQuery); - public static Query Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new Query("prefix", prefixQuery); - public static Query QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery queryStringQuery) => new Query("query_string", queryStringQuery); - public static Query Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new Query("range", rangeQuery); - public static Query Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new Query("range", rangeQuery); - public static Query Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new Query("range", rangeQuery); - public static Query Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new Query("range", rangeQuery); - public static Query RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery rankFeatureQuery) => new Query("rank_feature", rankFeatureQuery); - public static Query RawJson(Elastic.Clients.Elasticsearch.QueryDsl.RawJsonQuery rawJsonQuery) => new Query("raw_json", rawJsonQuery); - public static Query Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery regexpQuery) => new Query("regexp", regexpQuery); - public static Query Rule(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery ruleQuery) => new Query("rule", ruleQuery); - public static Query Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery scriptQuery) => new Query("script", scriptQuery); - public static Query ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery scriptScoreQuery) => new Query("script_score", scriptScoreQuery); - public static Query Semantic(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery semanticQuery) => new Query("semantic", semanticQuery); - public static Query Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery shapeQuery) => new Query("shape", shapeQuery); - public static Query SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new Query("simple_query_string", simpleQueryStringQuery); - public static Query SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => new Query("span_containing", spanContainingQuery); - public static Query SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new Query("span_field_masking", spanFieldMaskingQuery); - public static Query SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => new Query("span_first", spanFirstQuery); - public static Query SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new Query("span_multi", spanMultiTermQuery); - public static Query SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => new Query("span_near", spanNearQuery); - public static Query SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => new Query("span_not", spanNotQuery); - public static Query SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => new Query("span_or", spanOrQuery); - public static Query SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => new Query("span_term", spanTermQuery); - public static Query SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => new Query("span_within", spanWithinQuery); - public static Query SparseVector(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery sparseVectorQuery) => new Query("sparse_vector", sparseVectorQuery); - public static Query Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new Query("term", termQuery); - public static Query Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new Query("terms", termsQuery); - public static Query TermsSet(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery termsSetQuery) => new Query("terms_set", termsSetQuery); - public static Query Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new Query("wildcard", wildcardQuery); - public static Query Wrapper(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery wrapperQuery) => new Query("wrapper", wrapperQuery); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantBool = System.Text.Json.JsonEncodedText.Encode("bool"); + private static readonly System.Text.Json.JsonEncodedText VariantBoosting = System.Text.Json.JsonEncodedText.Encode("boosting"); + private static readonly System.Text.Json.JsonEncodedText VariantCombinedFields = System.Text.Json.JsonEncodedText.Encode("combined_fields"); + private static readonly System.Text.Json.JsonEncodedText VariantCommon = System.Text.Json.JsonEncodedText.Encode("common"); + private static readonly System.Text.Json.JsonEncodedText VariantConstantScore = System.Text.Json.JsonEncodedText.Encode("constant_score"); + private static readonly System.Text.Json.JsonEncodedText VariantDisMax = System.Text.Json.JsonEncodedText.Encode("dis_max"); + private static readonly System.Text.Json.JsonEncodedText VariantDistanceFeature = System.Text.Json.JsonEncodedText.Encode("distance_feature"); + private static readonly System.Text.Json.JsonEncodedText VariantExists = System.Text.Json.JsonEncodedText.Encode("exists"); + private static readonly System.Text.Json.JsonEncodedText VariantFunctionScore = System.Text.Json.JsonEncodedText.Encode("function_score"); + private static readonly System.Text.Json.JsonEncodedText VariantFuzzy = System.Text.Json.JsonEncodedText.Encode("fuzzy"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoBoundingBox = System.Text.Json.JsonEncodedText.Encode("geo_bounding_box"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoDistance = System.Text.Json.JsonEncodedText.Encode("geo_distance"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoGrid = System.Text.Json.JsonEncodedText.Encode("geo_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoPolygon = System.Text.Json.JsonEncodedText.Encode("geo_polygon"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoShape = System.Text.Json.JsonEncodedText.Encode("geo_shape"); + private static readonly System.Text.Json.JsonEncodedText VariantHasChild = System.Text.Json.JsonEncodedText.Encode("has_child"); + private static readonly System.Text.Json.JsonEncodedText VariantHasParent = System.Text.Json.JsonEncodedText.Encode("has_parent"); + private static readonly System.Text.Json.JsonEncodedText VariantIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText VariantIntervals = System.Text.Json.JsonEncodedText.Encode("intervals"); + private static readonly System.Text.Json.JsonEncodedText VariantKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchAll = System.Text.Json.JsonEncodedText.Encode("match_all"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchBoolPrefix = System.Text.Json.JsonEncodedText.Encode("match_bool_prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchNone = System.Text.Json.JsonEncodedText.Encode("match_none"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchPhrase = System.Text.Json.JsonEncodedText.Encode("match_phrase"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchPhrasePrefix = System.Text.Json.JsonEncodedText.Encode("match_phrase_prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantMoreLikeThis = System.Text.Json.JsonEncodedText.Encode("more_like_this"); + private static readonly System.Text.Json.JsonEncodedText VariantMultiMatch = System.Text.Json.JsonEncodedText.Encode("multi_match"); + private static readonly System.Text.Json.JsonEncodedText VariantNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText VariantParentId = System.Text.Json.JsonEncodedText.Encode("parent_id"); + private static readonly System.Text.Json.JsonEncodedText VariantPercolate = System.Text.Json.JsonEncodedText.Encode("percolate"); + private static readonly System.Text.Json.JsonEncodedText VariantPinned = System.Text.Json.JsonEncodedText.Encode("pinned"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantQueryString = System.Text.Json.JsonEncodedText.Encode("query_string"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantRankFeature = System.Text.Json.JsonEncodedText.Encode("rank_feature"); + private static readonly System.Text.Json.JsonEncodedText VariantRegexp = System.Text.Json.JsonEncodedText.Encode("regexp"); + private static readonly System.Text.Json.JsonEncodedText VariantRule = System.Text.Json.JsonEncodedText.Encode("rule"); + private static readonly System.Text.Json.JsonEncodedText VariantScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText VariantScriptScore = System.Text.Json.JsonEncodedText.Encode("script_score"); + private static readonly System.Text.Json.JsonEncodedText VariantSemantic = System.Text.Json.JsonEncodedText.Encode("semantic"); + private static readonly System.Text.Json.JsonEncodedText VariantShape = System.Text.Json.JsonEncodedText.Encode("shape"); + private static readonly System.Text.Json.JsonEncodedText VariantSimpleQueryString = System.Text.Json.JsonEncodedText.Encode("simple_query_string"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanContaining = System.Text.Json.JsonEncodedText.Encode("span_containing"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanFieldMasking = System.Text.Json.JsonEncodedText.Encode("span_field_masking"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanFirst = System.Text.Json.JsonEncodedText.Encode("span_first"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanMulti = System.Text.Json.JsonEncodedText.Encode("span_multi"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanNear = System.Text.Json.JsonEncodedText.Encode("span_near"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanNot = System.Text.Json.JsonEncodedText.Encode("span_not"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanOr = System.Text.Json.JsonEncodedText.Encode("span_or"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanTerm = System.Text.Json.JsonEncodedText.Encode("span_term"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanWithin = System.Text.Json.JsonEncodedText.Encode("span_within"); + private static readonly System.Text.Json.JsonEncodedText VariantSparseVector = System.Text.Json.JsonEncodedText.Encode("sparse_vector"); + private static readonly System.Text.Json.JsonEncodedText VariantTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantTermsSet = System.Text.Json.JsonEncodedText.Encode("terms_set"); + private static readonly System.Text.Json.JsonEncodedText VariantTextExpansion = System.Text.Json.JsonEncodedText.Encode("text_expansion"); + private static readonly System.Text.Json.JsonEncodedText VariantType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText VariantWeightedTokens = System.Text.Json.JsonEncodedText.Encode("weighted_tokens"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); + private static readonly System.Text.Json.JsonEncodedText VariantWrapper = System.Text.Json.JsonEncodedText.Encode("wrapper"); -internal sealed partial class QueryConverter : JsonConverter -{ - public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.Query Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } + if (reader.ValueTextEquals(VariantBool)) + { + variantType = VariantBool.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBoosting)) + { + variantType = VariantBoosting.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (reader.ValueTextEquals(VariantCombinedFields)) + { + variantType = VariantCombinedFields.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (reader.ValueTextEquals(VariantCommon)) { - throw new JsonException("Expected a property name token."); + variantType = VariantCommon.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantConstantScore)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantConstantScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "bool") + if (reader.ValueTextEquals(VariantDisMax)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDisMax.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "boosting") + if (reader.ValueTextEquals(VariantDistanceFeature)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDistanceFeature.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "combined_fields") + if (reader.ValueTextEquals(VariantExists)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExists.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "constant_score") + if (reader.ValueTextEquals(VariantFunctionScore)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFunctionScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "dis_max") + if (reader.ValueTextEquals(VariantFuzzy)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFuzzy.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "distance_feature") + if (reader.ValueTextEquals(VariantGeoBoundingBox)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoBoundingBox.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "exists") + if (reader.ValueTextEquals(VariantGeoDistance)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoDistance.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "function_score") + if (reader.ValueTextEquals(VariantGeoGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "fuzzy") + if (reader.ValueTextEquals(VariantGeoPolygon)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoPolygon.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_bounding_box") + if (reader.ValueTextEquals(VariantGeoShape)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeoShape.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_distance") + if (reader.ValueTextEquals(VariantHasChild)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantHasChild.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_grid") + if (reader.ValueTextEquals(VariantHasParent)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantHasParent.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geo_shape") + if (reader.ValueTextEquals(VariantIds)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIds.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "has_child") + if (reader.ValueTextEquals(VariantIntervals)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIntervals.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "has_parent") + if (reader.ValueTextEquals(VariantKnn)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantKnn.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ids") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "intervals") + if (reader.ValueTextEquals(VariantMatchAll)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchAll.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "knn") + if (reader.ValueTextEquals(VariantMatchBoolPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchBoolPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantMatchNone)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchNone.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_all") + if (reader.ValueTextEquals(VariantMatchPhrase)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchPhrase.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_bool_prefix") + if (reader.ValueTextEquals(VariantMatchPhrasePrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchPhrasePrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_none") + if (reader.ValueTextEquals(VariantMoreLikeThis)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMoreLikeThis.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_phrase") + if (reader.ValueTextEquals(VariantMultiMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMultiMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_phrase_prefix") + if (reader.ValueTextEquals(VariantNested)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantNested.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "more_like_this") + if (reader.ValueTextEquals(VariantParentId)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantParentId.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "multi_match") + if (reader.ValueTextEquals(VariantPercolate)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPercolate.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "nested") + if (reader.ValueTextEquals(VariantPinned)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPinned.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "parent_id") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "percolate") + if (reader.ValueTextEquals(VariantQueryString)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantQueryString.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "pinned") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantRankFeature)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRankFeature.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "query_string") + if (reader.ValueTextEquals(VariantRegexp)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRegexp.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantRule)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRule.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rank_feature") + if (reader.ValueTextEquals(VariantScript)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScript.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "raw_json") + if (reader.ValueTextEquals(VariantScriptScore)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantScriptScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "regexp") + if (reader.ValueTextEquals(VariantSemantic)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSemantic.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rule") + if (reader.ValueTextEquals(VariantShape)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantShape.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "script") + if (reader.ValueTextEquals(VariantSimpleQueryString)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSimpleQueryString.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "script_score") + if (reader.ValueTextEquals(VariantSpanContaining)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanContaining.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "semantic") + if (reader.ValueTextEquals(VariantSpanFieldMasking)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanFieldMasking.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "shape") + if (reader.ValueTextEquals(VariantSpanFirst)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanFirst.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "simple_query_string") + if (reader.ValueTextEquals(VariantSpanMulti)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanMulti.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_containing") + if (reader.ValueTextEquals(VariantSpanNear)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanNear.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_field_masking") + if (reader.ValueTextEquals(VariantSpanNot)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanNot.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_first") + if (reader.ValueTextEquals(VariantSpanOr)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanOr.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_multi") + if (reader.ValueTextEquals(VariantSpanTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_near") + if (reader.ValueTextEquals(VariantSpanWithin)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanWithin.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_not") + if (reader.ValueTextEquals(VariantSparseVector)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSparseVector.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_or") + if (reader.ValueTextEquals(VariantTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_term") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_within") + if (reader.ValueTextEquals(VariantTermsSet)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTermsSet.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "sparse_vector") + if (reader.ValueTextEquals(VariantTextExpansion)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextExpansion.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "term") + if (reader.ValueTextEquals(VariantType)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantType.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantWeightedTokens)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWeightedTokens.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms_set") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (reader.ValueTextEquals(VariantWrapper)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWrapper.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wrapper") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Query' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Query(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.Query value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "bool": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); - break; - case "boosting": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery)value.Variant, options); - break; - case "combined_fields": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery)value.Variant, options); - break; - case "constant_score": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery)value.Variant, options); - break; - case "dis_max": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery)value.Variant, options); - break; - case "distance_feature": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "exists": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); - break; - case "function_score": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery)value.Variant, options); - break; - case "fuzzy": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery)value.Variant, options); - break; - case "geo_bounding_box": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery)value.Variant, options); - break; - case "geo_distance": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery)value.Variant, options); - break; - case "geo_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery)value.Variant, options); - break; - case "geo_shape": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery)value.Variant, options); - break; - case "has_child": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery)value.Variant, options); - break; - case "has_parent": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery)value.Variant, options); - break; - case "ids": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); - break; - case "intervals": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery)value.Variant, options); - break; - case "knn": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.KnnQuery)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); - break; - case "match_all": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); - break; - case "match_bool_prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery)value.Variant, options); - break; - case "match_none": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery)value.Variant, options); - break; - case "match_phrase": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery)value.Variant, options); - break; - case "match_phrase_prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery)value.Variant, options); - break; - case "more_like_this": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery)value.Variant, options); - break; - case "multi_match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery)value.Variant, options); - break; - case "nested": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery)value.Variant, options); - break; - case "parent_id": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery)value.Variant, options); - break; - case "percolate": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery)value.Variant, options); - break; - case "pinned": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); - break; - case "query_string": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "rank_feature": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery)value.Variant, options); - break; - case "raw_json": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RawJsonQuery)value.Variant, options); - break; - case "regexp": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery)value.Variant, options); - break; - case "rule": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery)value.Variant, options); - break; - case "script": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery)value.Variant, options); - break; - case "script_score": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery)value.Variant, options); - break; - case "semantic": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery)value.Variant, options); - break; - case "shape": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery)value.Variant, options); - break; - case "simple_query_string": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); - break; - case "span_containing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, options); - break; - case "span_field_masking": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; - case "span_first": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, options); - break; - case "span_multi": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery)value.Variant, options); - break; - case "span_near": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery)value.Variant, options); - break; - case "span_not": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery)value.Variant, options); - break; - case "span_or": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery)value.Variant, options); - break; - case "span_term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery)value.Variant, options); - break; - case "span_within": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery)value.Variant, options); - break; - case "sparse_vector": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery)value.Variant, options); - break; - case "term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); - break; - case "terms_set": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); - break; - case "wrapper": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery)value.Variant, options); - break; - } + case null: + break; + case "bool": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, null, null); + break; + case "boosting": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery)value.Variant, null, null); + break; + case "combined_fields": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery)value.Variant, null, null); + break; + case "common": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery)value.Variant, null, null); + break; + case "constant_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery)value.Variant, null, null); + break; + case "dis_max": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery)value.Variant, null, null); + break; + case "distance_feature": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery)value.Variant, null, null); + break; + case "exists": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, null, null); + break; + case "function_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery)value.Variant, null, null); + break; + case "fuzzy": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery)value.Variant, null, null); + break; + case "geo_bounding_box": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery)value.Variant, null, null); + break; + case "geo_distance": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery)value.Variant, null, null); + break; + case "geo_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery)value.Variant, null, null); + break; + case "geo_polygon": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery)value.Variant, null, null); + break; + case "geo_shape": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery)value.Variant, null, null); + break; + case "has_child": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery)value.Variant, null, null); + break; + case "has_parent": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery)value.Variant, null, null); + break; + case "ids": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, null, null); + break; + case "intervals": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery)value.Variant, null, null); + break; + case "knn": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.KnnQuery)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, null, null); + break; + case "match_all": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, null, null); + break; + case "match_bool_prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery)value.Variant, null, null); + break; + case "match_none": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery)value.Variant, null, null); + break; + case "match_phrase": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery)value.Variant, null, null); + break; + case "match_phrase_prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery)value.Variant, null, null); + break; + case "more_like_this": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery)value.Variant, null, null); + break; + case "multi_match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery)value.Variant, null, null); + break; + case "nested": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery)value.Variant, null, null); + break; + case "parent_id": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery)value.Variant, null, null); + break; + case "percolate": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery)value.Variant, null, null); + break; + case "pinned": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, null, null); + break; + case "query_string": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery)value.Variant, null, null); + break; + case "rank_feature": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery)value.Variant, null, null); + break; + case "regexp": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery)value.Variant, null, null); + break; + case "rule": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery)value.Variant, null, null); + break; + case "script": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery)value.Variant, null, null); + break; + case "script_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery)value.Variant, null, null); + break; + case "semantic": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery)value.Variant, null, null); + break; + case "shape": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery)value.Variant, null, null); + break; + case "simple_query_string": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, null, null); + break; + case "span_containing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, null, null); + break; + case "span_field_masking": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, null, null); + break; + case "span_first": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, null, null); + break; + case "span_multi": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery)value.Variant, null, null); + break; + case "span_near": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery)value.Variant, null, null); + break; + case "span_not": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery)value.Variant, null, null); + break; + case "span_or": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery)value.Variant, null, null); + break; + case "span_term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery)value.Variant, null, null); + break; + case "span_within": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery)value.Variant, null, null); + break; + case "sparse_vector": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery)value.Variant, null, null); + break; + case "term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, null, null); + break; + case "terms_set": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery)value.Variant, null, null); + break; + case "text_expansion": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery)value.Variant, null, null); + break; + case "type": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery)value.Variant, null, null); + break; + case "weighted_tokens": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, null, null); + break; + case "wrapper": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.Query)}'."); } writer.WriteEndObject(); } } -public sealed partial class QueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.QueryConverter))] +public sealed partial class Query { - internal QueryDescriptor(Action> configure) => configure.Invoke(this); - - public QueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private QueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private QueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public QueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public QueryDescriptor Bool(Action> configure) => Set(configure, "bool"); - public QueryDescriptor Boosting(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery boostingQuery) => Set(boostingQuery, "boosting"); - public QueryDescriptor Boosting(Action> configure) => Set(configure, "boosting"); - public QueryDescriptor CombinedFields(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery combinedFieldsQuery) => Set(combinedFieldsQuery, "combined_fields"); - public QueryDescriptor CombinedFields(Action> configure) => Set(configure, "combined_fields"); - public QueryDescriptor ConstantScore(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery constantScoreQuery) => Set(constantScoreQuery, "constant_score"); - public QueryDescriptor ConstantScore(Action> configure) => Set(configure, "constant_score"); - public QueryDescriptor DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery disMaxQuery) => Set(disMaxQuery, "dis_max"); - public QueryDescriptor DisMax(Action> configure) => Set(configure, "dis_max"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public QueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); - public QueryDescriptor FunctionScore(Action> configure) => Set(configure, "function_score"); - public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); - public QueryDescriptor Fuzzy(Action> configure) => Set(configure, "fuzzy"); - public QueryDescriptor GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery geoBoundingBoxQuery) => Set(geoBoundingBoxQuery, "geo_bounding_box"); - public QueryDescriptor GeoBoundingBox(Action> configure) => Set(configure, "geo_bounding_box"); - public QueryDescriptor GeoDistance(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery geoDistanceQuery) => Set(geoDistanceQuery, "geo_distance"); - public QueryDescriptor GeoDistance(Action> configure) => Set(configure, "geo_distance"); - public QueryDescriptor GeoGrid(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery geoGridQuery) => Set(geoGridQuery, "geo_grid"); - public QueryDescriptor GeoGrid(Action> configure) => Set(configure, "geo_grid"); - public QueryDescriptor GeoShape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery geoShapeQuery) => Set(geoShapeQuery, "geo_shape"); - public QueryDescriptor GeoShape(Action> configure) => Set(configure, "geo_shape"); - public QueryDescriptor HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery hasChildQuery) => Set(hasChildQuery, "has_child"); - public QueryDescriptor HasChild(Action> configure) => Set(configure, "has_child"); - public QueryDescriptor HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery hasParentQuery) => Set(hasParentQuery, "has_parent"); - public QueryDescriptor HasParent(Action> configure) => Set(configure, "has_parent"); - public QueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public QueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public QueryDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery intervalsQuery) => Set(intervalsQuery, "intervals"); - public QueryDescriptor Intervals(Action> configure) => Set(configure, "intervals"); - public QueryDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery knnQuery) => Set(knnQuery, "knn"); - public QueryDescriptor Knn(Action> configure) => Set(configure, "knn"); - public QueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public QueryDescriptor Match(Action> configure) => Set(configure, "match"); - public QueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public QueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public QueryDescriptor MatchBoolPrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery matchBoolPrefixQuery) => Set(matchBoolPrefixQuery, "match_bool_prefix"); - public QueryDescriptor MatchBoolPrefix(Action> configure) => Set(configure, "match_bool_prefix"); - public QueryDescriptor MatchNone(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery matchNoneQuery) => Set(matchNoneQuery, "match_none"); - public QueryDescriptor MatchNone(Action configure) => Set(configure, "match_none"); - public QueryDescriptor MatchPhrase(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery matchPhraseQuery) => Set(matchPhraseQuery, "match_phrase"); - public QueryDescriptor MatchPhrase(Action> configure) => Set(configure, "match_phrase"); - public QueryDescriptor MatchPhrasePrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery matchPhrasePrefixQuery) => Set(matchPhrasePrefixQuery, "match_phrase_prefix"); - public QueryDescriptor MatchPhrasePrefix(Action> configure) => Set(configure, "match_phrase_prefix"); - public QueryDescriptor MoreLikeThis(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery moreLikeThisQuery) => Set(moreLikeThisQuery, "more_like_this"); - public QueryDescriptor MoreLikeThis(Action> configure) => Set(configure, "more_like_this"); - public QueryDescriptor MultiMatch(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery multiMatchQuery) => Set(multiMatchQuery, "multi_match"); - public QueryDescriptor MultiMatch(Action> configure) => Set(configure, "multi_match"); - public QueryDescriptor Nested(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery nestedQuery) => Set(nestedQuery, "nested"); - public QueryDescriptor Nested(Action> configure) => Set(configure, "nested"); - public QueryDescriptor ParentId(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery parentIdQuery) => Set(parentIdQuery, "parent_id"); - public QueryDescriptor ParentId(Action configure) => Set(configure, "parent_id"); - public QueryDescriptor Percolate(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery percolateQuery) => Set(percolateQuery, "percolate"); - public QueryDescriptor Percolate(Action> configure) => Set(configure, "percolate"); - public QueryDescriptor Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery pinnedQuery) => Set(pinnedQuery, "pinned"); - public QueryDescriptor Pinned(Action> configure) => Set(configure, "pinned"); - public QueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public QueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public QueryDescriptor QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery queryStringQuery) => Set(queryStringQuery, "query_string"); - public QueryDescriptor QueryString(Action> configure) => Set(configure, "query_string"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery rankFeatureQuery) => Set(rankFeatureQuery, "rank_feature"); - public QueryDescriptor RankFeature(Action> configure) => Set(configure, "rank_feature"); - public QueryDescriptor RawJson(Elastic.Clients.Elasticsearch.QueryDsl.RawJsonQuery rawJsonQuery) => Set(rawJsonQuery, "raw_json"); - public QueryDescriptor Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery regexpQuery) => Set(regexpQuery, "regexp"); - public QueryDescriptor Regexp(Action> configure) => Set(configure, "regexp"); - public QueryDescriptor Rule(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery ruleQuery) => Set(ruleQuery, "rule"); - public QueryDescriptor Rule(Action> configure) => Set(configure, "rule"); - public QueryDescriptor Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery scriptQuery) => Set(scriptQuery, "script"); - public QueryDescriptor Script(Action configure) => Set(configure, "script"); - public QueryDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery scriptScoreQuery) => Set(scriptScoreQuery, "script_score"); - public QueryDescriptor ScriptScore(Action> configure) => Set(configure, "script_score"); - public QueryDescriptor Semantic(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery semanticQuery) => Set(semanticQuery, "semantic"); - public QueryDescriptor Semantic(Action configure) => Set(configure, "semantic"); - public QueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery shapeQuery) => Set(shapeQuery, "shape"); - public QueryDescriptor Shape(Action> configure) => Set(configure, "shape"); - public QueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public QueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); - public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); - public QueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); - public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); - public QueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); - public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); - public QueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); - public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); - public QueryDescriptor SpanMulti(Action> configure) => Set(configure, "span_multi"); - public QueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => Set(spanNearQuery, "span_near"); - public QueryDescriptor SpanNear(Action> configure) => Set(configure, "span_near"); - public QueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => Set(spanNotQuery, "span_not"); - public QueryDescriptor SpanNot(Action> configure) => Set(configure, "span_not"); - public QueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => Set(spanOrQuery, "span_or"); - public QueryDescriptor SpanOr(Action> configure) => Set(configure, "span_or"); - public QueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => Set(spanTermQuery, "span_term"); - public QueryDescriptor SpanTerm(Action> configure) => Set(configure, "span_term"); - public QueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => Set(spanWithinQuery, "span_within"); - public QueryDescriptor SpanWithin(Action> configure) => Set(configure, "span_within"); - public QueryDescriptor SparseVector(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery sparseVectorQuery) => Set(sparseVectorQuery, "sparse_vector"); - public QueryDescriptor SparseVector(Action> configure) => Set(configure, "sparse_vector"); - public QueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public QueryDescriptor Term(Action> configure) => Set(configure, "term"); - public QueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public QueryDescriptor Terms(Action> configure) => Set(configure, "terms"); - public QueryDescriptor TermsSet(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery termsSetQuery) => Set(termsSetQuery, "terms_set"); - public QueryDescriptor TermsSet(Action> configure) => Set(configure, "terms_set"); - public QueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public QueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); - public QueryDescriptor Wrapper(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery wrapperQuery) => Set(wrapperQuery, "wrapper"); - public QueryDescriptor Wrapper(Action configure) => Set(configure, "wrapper"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Query() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + } +#endif +#if !NET7_0_OR_GREATER + public Query() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? Bool { get => GetVariant("bool"); set => SetVariant("bool", value); } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery? Boosting { get => GetVariant("boosting"); set => SetVariant("boosting", value); } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery? CombinedFields { get => GetVariant("combined_fields"); set => SetVariant("combined_fields", value); } + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery? Common { get => GetVariant("common"); set => SetVariant("common", value); } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery? ConstantScore { get => GetVariant("constant_score"); set => SetVariant("constant_score", value); } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery? DisMax { get => GetVariant("dis_max"); set => SetVariant("dis_max", value); } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery? DistanceFeature { get => GetVariant("distance_feature"); set => SetVariant("distance_feature", value); } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? Exists { get => GetVariant("exists"); set => SetVariant("exists", value); } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery? FunctionScore { get => GetVariant("function_score"); set => SetVariant("function_score", value); } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery? Fuzzy { get => GetVariant("fuzzy"); set => SetVariant("fuzzy", value); } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery? GeoBoundingBox { get => GetVariant("geo_bounding_box"); set => SetVariant("geo_bounding_box", value); } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery? GeoDistance { get => GetVariant("geo_distance"); set => SetVariant("geo_distance", value); } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery? GeoGrid { get => GetVariant("geo_grid"); set => SetVariant("geo_grid", value); } + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery? GeoPolygon { get => GetVariant("geo_polygon"); set => SetVariant("geo_polygon", value); } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery? GeoShape { get => GetVariant("geo_shape"); set => SetVariant("geo_shape", value); } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery? HasChild { get => GetVariant("has_child"); set => SetVariant("has_child", value); } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery? HasParent { get => GetVariant("has_parent"); set => SetVariant("has_parent", value); } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? Ids { get => GetVariant("ids"); set => SetVariant("ids", value); } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery? Intervals { get => GetVariant("intervals"); set => SetVariant("intervals", value); } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.KnnQuery? Knn { get => GetVariant("knn"); set => SetVariant("knn", value); } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? MatchAll { get => GetVariant("match_all"); set => SetVariant("match_all", value); } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery? MatchBoolPrefix { get => GetVariant("match_bool_prefix"); set => SetVariant("match_bool_prefix", value); } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery? MatchNone { get => GetVariant("match_none"); set => SetVariant("match_none", value); } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery? MatchPhrase { get => GetVariant("match_phrase"); set => SetVariant("match_phrase", value); } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery? MatchPhrasePrefix { get => GetVariant("match_phrase_prefix"); set => SetVariant("match_phrase_prefix", value); } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery? MoreLikeThis { get => GetVariant("more_like_this"); set => SetVariant("more_like_this", value); } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery? MultiMatch { get => GetVariant("multi_match"); set => SetVariant("multi_match", value); } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery? Nested { get => GetVariant("nested"); set => SetVariant("nested", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery? ParentId { get => GetVariant("parent_id"); set => SetVariant("parent_id", value); } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery? Percolate { get => GetVariant("percolate"); set => SetVariant("percolate", value); } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery? Pinned { get => GetVariant("pinned"); set => SetVariant("pinned", value); } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery? QueryString { get => GetVariant("query_string"); set => SetVariant("query_string", value); } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery? RankFeature { get => GetVariant("rank_feature"); set => SetVariant("rank_feature", value); } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery? Regexp { get => GetVariant("regexp"); set => SetVariant("regexp", value); } + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery? Rule { get => GetVariant("rule"); set => SetVariant("rule", value); } + + /// + /// + /// Filters documents based on a provided script. + /// The script query is typically used in a filter context. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery? Script { get => GetVariant("script"); set => SetVariant("script", value); } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery? ScriptScore { get => GetVariant("script_score"); set => SetVariant("script_score", value); } + + /// + /// + /// A semantic query to semantic_text field types + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery? Semantic { get => GetVariant("semantic"); set => SetVariant("semantic", value); } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery? Shape { get => GetVariant("shape"); set => SetVariant("shape", value); } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? SimpleQueryString { get => GetVariant("simple_query_string"); set => SetVariant("simple_query_string", value); } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? SpanContaining { get => GetVariant("span_containing"); set => SetVariant("span_containing", value); } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? SpanFieldMasking { get => GetVariant("span_field_masking"); set => SetVariant("span_field_masking", value); } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? SpanFirst { get => GetVariant("span_first"); set => SetVariant("span_first", value); } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? SpanMulti { get => GetVariant("span_multi"); set => SetVariant("span_multi", value); } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? SpanNear { get => GetVariant("span_near"); set => SetVariant("span_near", value); } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? SpanNot { get => GetVariant("span_not"); set => SetVariant("span_not", value); } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? SpanOr { get => GetVariant("span_or"); set => SetVariant("span_or", value); } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? SpanTerm { get => GetVariant("span_term"); set => SetVariant("span_term", value); } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? SpanWithin { get => GetVariant("span_within"); set => SetVariant("span_within", value); } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery? SparseVector { get => GetVariant("sparse_vector"); set => SetVariant("sparse_vector", value); } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? Term { get => GetVariant("term"); set => SetVariant("term", value); } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery? TermsSet { get => GetVariant("terms_set"); set => SetVariant("terms_set", value); } + + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + [System.Obsolete("Deprecated in '8.15.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery? TextExpansion { get => GetVariant("text_expansion"); set => SetVariant("text_expansion", value); } + [System.Obsolete("Deprecated in '7.0.0'. https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html")] + public Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery? Type { get => GetVariant("type"); set => SetVariant("type", value); } + + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + [System.Obsolete("Deprecated in '8.15.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery? WeightedTokens { get => GetVariant("weighted_tokens"); set => SetVariant("weighted_tokens", value); } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } + + /// + /// + /// A query that accepts any other query as base64 encoded string. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery? Wrapper { get => GetVariant("wrapper"); set => SetVariant("wrapper", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Bool = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Boosting = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { CombinedFields = value }; +#pragma warning disable CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Common = value }; +#pragma warning restore CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { ConstantScore = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { DisMax = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { DistanceFeature = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { DistanceFeature = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { DistanceFeature = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Exists = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { FunctionScore = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Fuzzy = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { GeoBoundingBox = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { GeoDistance = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { GeoGrid = value }; +#pragma warning disable CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { GeoPolygon = value }; +#pragma warning restore CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { GeoShape = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { HasChild = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { HasParent = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Ids = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Intervals = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.KnnQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Knn = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Match = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MatchAll = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MatchBoolPrefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MatchNone = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MatchPhrase = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MatchPhrasePrefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MoreLikeThis = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { MultiMatch = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Nested = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { ParentId = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Percolate = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Pinned = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Prefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { QueryString = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { RankFeature = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Regexp = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Rule = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Script = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { ScriptScore = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Semantic = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Shape = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SimpleQueryString = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanContaining = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanFieldMasking = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanFirst = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanMulti = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanNear = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanNot = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanOr = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanTerm = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SpanWithin = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { SparseVector = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Term = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { TermsSet = value }; +#pragma warning disable CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { TextExpansion = value }; +#pragma warning restore CS0618 +#pragma warning disable CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Type = value }; +#pragma warning restore CS0618 +#pragma warning disable CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { WeightedTokens = value }; +#pragma warning restore CS0618 + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Wildcard = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.Query { Wrapper = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class QueryDescriptor : SerializableDescriptor +public readonly partial struct QueryDescriptor { - internal QueryDescriptor(Action configure) => configure.Invoke(this); - - public QueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private QueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private QueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public QueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public QueryDescriptor Bool(Action configure) => Set(configure, "bool"); - public QueryDescriptor Boosting(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery boostingQuery) => Set(boostingQuery, "boosting"); - public QueryDescriptor Boosting(Action configure) => Set(configure, "boosting"); - public QueryDescriptor CombinedFields(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery combinedFieldsQuery) => Set(combinedFieldsQuery, "combined_fields"); - public QueryDescriptor CombinedFields(Action configure) => Set(configure, "combined_fields"); - public QueryDescriptor ConstantScore(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery constantScoreQuery) => Set(constantScoreQuery, "constant_score"); - public QueryDescriptor ConstantScore(Action configure) => Set(configure, "constant_score"); - public QueryDescriptor DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery disMaxQuery) => Set(disMaxQuery, "dis_max"); - public QueryDescriptor DisMax(Action configure) => Set(configure, "dis_max"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.DateDistanceFeatureQuery distanceFeatureQuery) => Set(distanceFeatureQuery, "distance_feature"); - public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public QueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); - public QueryDescriptor FunctionScore(Action configure) => Set(configure, "function_score"); - public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); - public QueryDescriptor Fuzzy(Action configure) => Set(configure, "fuzzy"); - public QueryDescriptor GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery geoBoundingBoxQuery) => Set(geoBoundingBoxQuery, "geo_bounding_box"); - public QueryDescriptor GeoBoundingBox(Action configure) => Set(configure, "geo_bounding_box"); - public QueryDescriptor GeoDistance(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery geoDistanceQuery) => Set(geoDistanceQuery, "geo_distance"); - public QueryDescriptor GeoDistance(Action configure) => Set(configure, "geo_distance"); - public QueryDescriptor GeoGrid(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery geoGridQuery) => Set(geoGridQuery, "geo_grid"); - public QueryDescriptor GeoGrid(Action configure) => Set(configure, "geo_grid"); - public QueryDescriptor GeoShape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery geoShapeQuery) => Set(geoShapeQuery, "geo_shape"); - public QueryDescriptor GeoShape(Action configure) => Set(configure, "geo_shape"); - public QueryDescriptor HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery hasChildQuery) => Set(hasChildQuery, "has_child"); - public QueryDescriptor HasChild(Action configure) => Set(configure, "has_child"); - public QueryDescriptor HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery hasParentQuery) => Set(hasParentQuery, "has_parent"); - public QueryDescriptor HasParent(Action configure) => Set(configure, "has_parent"); - public QueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public QueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public QueryDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery intervalsQuery) => Set(intervalsQuery, "intervals"); - public QueryDescriptor Intervals(Action configure) => Set(configure, "intervals"); - public QueryDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery knnQuery) => Set(knnQuery, "knn"); - public QueryDescriptor Knn(Action configure) => Set(configure, "knn"); - public QueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public QueryDescriptor Match(Action configure) => Set(configure, "match"); - public QueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public QueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public QueryDescriptor MatchBoolPrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery matchBoolPrefixQuery) => Set(matchBoolPrefixQuery, "match_bool_prefix"); - public QueryDescriptor MatchBoolPrefix(Action configure) => Set(configure, "match_bool_prefix"); - public QueryDescriptor MatchNone(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery matchNoneQuery) => Set(matchNoneQuery, "match_none"); - public QueryDescriptor MatchNone(Action configure) => Set(configure, "match_none"); - public QueryDescriptor MatchPhrase(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery matchPhraseQuery) => Set(matchPhraseQuery, "match_phrase"); - public QueryDescriptor MatchPhrase(Action configure) => Set(configure, "match_phrase"); - public QueryDescriptor MatchPhrasePrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery matchPhrasePrefixQuery) => Set(matchPhrasePrefixQuery, "match_phrase_prefix"); - public QueryDescriptor MatchPhrasePrefix(Action configure) => Set(configure, "match_phrase_prefix"); - public QueryDescriptor MoreLikeThis(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery moreLikeThisQuery) => Set(moreLikeThisQuery, "more_like_this"); - public QueryDescriptor MoreLikeThis(Action configure) => Set(configure, "more_like_this"); - public QueryDescriptor MultiMatch(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery multiMatchQuery) => Set(multiMatchQuery, "multi_match"); - public QueryDescriptor MultiMatch(Action configure) => Set(configure, "multi_match"); - public QueryDescriptor Nested(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery nestedQuery) => Set(nestedQuery, "nested"); - public QueryDescriptor Nested(Action configure) => Set(configure, "nested"); - public QueryDescriptor ParentId(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery parentIdQuery) => Set(parentIdQuery, "parent_id"); - public QueryDescriptor ParentId(Action configure) => Set(configure, "parent_id"); - public QueryDescriptor Percolate(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery percolateQuery) => Set(percolateQuery, "percolate"); - public QueryDescriptor Percolate(Action configure) => Set(configure, "percolate"); - public QueryDescriptor Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery pinnedQuery) => Set(pinnedQuery, "pinned"); - public QueryDescriptor Pinned(Action configure) => Set(configure, "pinned"); - public QueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public QueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public QueryDescriptor QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery queryStringQuery) => Set(queryStringQuery, "query_string"); - public QueryDescriptor QueryString(Action configure) => Set(configure, "query_string"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public QueryDescriptor RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery rankFeatureQuery) => Set(rankFeatureQuery, "rank_feature"); - public QueryDescriptor RankFeature(Action configure) => Set(configure, "rank_feature"); - public QueryDescriptor RawJson(Elastic.Clients.Elasticsearch.QueryDsl.RawJsonQuery rawJsonQuery) => Set(rawJsonQuery, "raw_json"); - public QueryDescriptor Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery regexpQuery) => Set(regexpQuery, "regexp"); - public QueryDescriptor Regexp(Action configure) => Set(configure, "regexp"); - public QueryDescriptor Rule(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery ruleQuery) => Set(ruleQuery, "rule"); - public QueryDescriptor Rule(Action configure) => Set(configure, "rule"); - public QueryDescriptor Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery scriptQuery) => Set(scriptQuery, "script"); - public QueryDescriptor Script(Action configure) => Set(configure, "script"); - public QueryDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery scriptScoreQuery) => Set(scriptScoreQuery, "script_score"); - public QueryDescriptor ScriptScore(Action configure) => Set(configure, "script_score"); - public QueryDescriptor Semantic(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery semanticQuery) => Set(semanticQuery, "semantic"); - public QueryDescriptor Semantic(Action configure) => Set(configure, "semantic"); - public QueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery shapeQuery) => Set(shapeQuery, "shape"); - public QueryDescriptor Shape(Action configure) => Set(configure, "shape"); - public QueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public QueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); - public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); - public QueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); - public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); - public QueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); - public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); - public QueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); - public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); - public QueryDescriptor SpanMulti(Action configure) => Set(configure, "span_multi"); - public QueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => Set(spanNearQuery, "span_near"); - public QueryDescriptor SpanNear(Action configure) => Set(configure, "span_near"); - public QueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => Set(spanNotQuery, "span_not"); - public QueryDescriptor SpanNot(Action configure) => Set(configure, "span_not"); - public QueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => Set(spanOrQuery, "span_or"); - public QueryDescriptor SpanOr(Action configure) => Set(configure, "span_or"); - public QueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => Set(spanTermQuery, "span_term"); - public QueryDescriptor SpanTerm(Action configure) => Set(configure, "span_term"); - public QueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => Set(spanWithinQuery, "span_within"); - public QueryDescriptor SpanWithin(Action configure) => Set(configure, "span_within"); - public QueryDescriptor SparseVector(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery sparseVectorQuery) => Set(sparseVectorQuery, "sparse_vector"); - public QueryDescriptor SparseVector(Action configure) => Set(configure, "sparse_vector"); - public QueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public QueryDescriptor Term(Action configure) => Set(configure, "term"); - public QueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public QueryDescriptor Terms(Action configure) => Set(configure, "terms"); - public QueryDescriptor TermsSet(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery termsSetQuery) => Set(termsSetQuery, "terms_set"); - public QueryDescriptor TermsSet(Action configure) => Set(configure, "terms_set"); - public QueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public QueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); - public QueryDescriptor Wrapper(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery wrapperQuery) => Set(wrapperQuery, "wrapper"); - public QueryDescriptor Wrapper(Action configure) => Set(configure, "wrapper"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal Elastic.Clients.Elasticsearch.QueryDsl.Query Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Query instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance = instance; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WriteEndObject(); + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Query instance) => new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Boosting(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery? value) + { + Instance.Boosting = value; + return this; + } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Boosting(System.Action> action) + { + Instance.Boosting = Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor CombinedFields(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery? value) + { + Instance.CombinedFields = value; + return this; + } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor CombinedFields(System.Action> action) + { + Instance.CombinedFields = Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Common(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery? value) + { + Instance.Common = value; + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Common(System.Action> action) + { + Instance.Common = Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ConstantScore(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery? value) + { + Instance.ConstantScore = value; + return this; + } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ConstantScore(System.Action> action) + { + Instance.ConstantScore = Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery? value) + { + Instance.DisMax = value; + return this; + } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DisMax(System.Action> action) + { + Instance.DisMax = Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery? value) + { + Instance.DistanceFeature = value; + return this; + } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DistanceFeature(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery> action) + { + Instance.DistanceFeature = Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery? value) + { + Instance.FunctionScore = value; + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore() + { + Instance.FunctionScore = Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore(System.Action>? action) + { + Instance.FunctionScore = Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery? value) + { + Instance.Fuzzy = value; + return this; + } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Fuzzy(System.Action> action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery? value) + { + Instance.GeoBoundingBox = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoBoundingBox(System.Action> action) + { + Instance.GeoBoundingBox = Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoDistance(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery? value) + { + Instance.GeoDistance = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoDistance(System.Action> action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoGrid(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery? value) + { + Instance.GeoGrid = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoGrid(System.Action> action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoPolygon(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery? value) + { + Instance.GeoPolygon = value; + return this; + } + + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoPolygon(System.Action> action) + { + Instance.GeoPolygon = Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoShape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery? value) + { + Instance.GeoShape = value; + return this; + } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoShape(System.Action> action) + { + Instance.GeoShape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery? value) + { + Instance.HasChild = value; + return this; + } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasChild(System.Action> action) + { + Instance.HasChild = Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery? value) + { + Instance.HasParent = value; + return this; + } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasParent(System.Action> action) + { + Instance.HasParent = Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery? value) + { + Instance.Intervals = value; + return this; + } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Intervals(System.Action> action) + { + Instance.Intervals = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery? value) + { + Instance.Knn = value; + return this; + } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Knn(System.Action> action) + { + Instance.Knn = Elastic.Clients.Elasticsearch.KnnQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchBoolPrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery? value) + { + Instance.MatchBoolPrefix = value; + return this; + } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchBoolPrefix(System.Action> action) + { + Instance.MatchBoolPrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery? value) + { + Instance.MatchNone = value; + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone() + { + Instance.MatchNone = Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone(System.Action? action) + { + Instance.MatchNone = Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrase(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery? value) + { + Instance.MatchPhrase = value; + return this; + } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrase(System.Action> action) + { + Instance.MatchPhrase = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrasePrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery? value) + { + Instance.MatchPhrasePrefix = value; + return this; + } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrasePrefix(System.Action> action) + { + Instance.MatchPhrasePrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MoreLikeThis(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery? value) + { + Instance.MoreLikeThis = value; + return this; + } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MoreLikeThis(System.Action> action) + { + Instance.MoreLikeThis = Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MultiMatch(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery? value) + { + Instance.MultiMatch = value; + return this; + } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MultiMatch(System.Action> action) + { + Instance.MultiMatch = Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Nested(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery? value) + { + Instance.Nested = value; + return this; + } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Nested(System.Action> action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery? value) + { + Instance.ParentId = value; + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId() + { + Instance.ParentId = Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId(System.Action? action) + { + Instance.ParentId = Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Percolate(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery? value) + { + Instance.Percolate = value; + return this; + } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Percolate(System.Action> action) + { + Instance.Percolate = Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery? value) + { + Instance.Pinned = value; + return this; + } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Pinned(System.Action> action) + { + Instance.Pinned = Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery? value) + { + Instance.QueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryString(System.Action> action) + { + Instance.QueryString = Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery? value) + { + Instance.RankFeature = value; + return this; + } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor RankFeature(System.Action> action) + { + Instance.RankFeature = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery? value) + { + Instance.Regexp = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Regexp(System.Action> action) + { + Instance.Regexp = Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Rule(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery? value) + { + Instance.Rule = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Rule(System.Action> action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Filters documents based on a provided script. + /// The script query is typically used in a filter context. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Filters documents based on a provided script. + /// The script query is typically used in a filter context. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Script(System.Action action) + { + Instance.Script = Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery? value) + { + Instance.ScriptScore = value; + return this; + } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ScriptScore(System.Action> action) + { + Instance.ScriptScore = Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A semantic query to semantic_text field types + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Semantic(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery? value) + { + Instance.Semantic = value; + return this; + } + + /// + /// + /// A semantic query to semantic_text field types + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Semantic(System.Action action) + { + Instance.Semantic = Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery? value) + { + Instance.Shape = value; + return this; + } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Shape(System.Action> action) + { + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? value) + { + Instance.SpanContaining = value; + return this; + } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanContaining(System.Action> action) + { + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? value) + { + Instance.SpanFieldMasking = value; + return this; + } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFieldMasking(System.Action> action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? value) + { + Instance.SpanFirst = value; + return this; + } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFirst(System.Action> action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? value) + { + Instance.SpanMulti = value; + return this; + } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanMulti(System.Action> action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? value) + { + Instance.SpanNear = value; + return this; + } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNear(System.Action> action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? value) + { + Instance.SpanNot = value; + return this; + } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNot(System.Action> action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? value) + { + Instance.SpanOr = value; + return this; + } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanOr(System.Action> action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? value) + { + Instance.SpanTerm = value; + return this; + } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanTerm(System.Action> action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? value) + { + Instance.SpanWithin = value; + return this; + } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanWithin(System.Action> action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SparseVector(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery? value) + { + Instance.SparseVector = value; + return this; + } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SparseVector(System.Action> action) + { + Instance.SparseVector = Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TermsSet(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery? value) + { + Instance.TermsSet = value; + return this; + } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TermsSet(System.Action> action) + { + Instance.TermsSet = Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TextExpansion(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery? value) + { + Instance.TextExpansion = value; + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TextExpansion(System.Action> action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.0.0'. https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery? value) + { + Instance.Type = value; + return this; + } + + [System.Obsolete("Deprecated in '7.0.0'. https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Type(System.Action action) + { + Instance.Type = Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor WeightedTokens(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery? value) + { + Instance.WeightedTokens = value; + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor WeightedTokens(System.Action> action) + { + Instance.WeightedTokens = Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A query that accepts any other query as base64 encoded string. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wrapper(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery? value) + { + Instance.Wrapper = value; + return this; + } + + /// + /// + /// A query that accepts any other query as base64 encoded string. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wrapper(System.Action action) + { + Instance.Wrapper = Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Query Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct QueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.Query Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Query instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.Query instance) => new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool(System.Action? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Boosting(Elastic.Clients.Elasticsearch.QueryDsl.BoostingQuery? value) + { + Instance.Boosting = value; + return this; + } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Boosting(System.Action action) + { + Instance.Boosting = Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching a positive query while reducing the relevance score of documents that also match a negative query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Boosting(System.Action> action) + { + Instance.Boosting = Elastic.Clients.Elasticsearch.QueryDsl.BoostingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor CombinedFields(Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQuery? value) + { + Instance.CombinedFields = value; + return this; + } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor CombinedFields(System.Action action) + { + Instance.CombinedFields = Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The combined_fields query supports searching multiple text fields as if their contents had been indexed into one combined field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor CombinedFields(System.Action> action) + { + Instance.CombinedFields = Elastic.Clients.Elasticsearch.QueryDsl.CombinedFieldsQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Common(Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQuery? value) + { + Instance.Common = value; + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Common(System.Action action) + { + Instance.Common = Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.3.0'.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Common(System.Action> action) + { + Instance.Common = Elastic.Clients.Elasticsearch.QueryDsl.CommonTermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ConstantScore(Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQuery? value) + { + Instance.ConstantScore = value; + return this; + } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ConstantScore(System.Action action) + { + Instance.ConstantScore = Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps a filter query and returns every matching document with a relevance score equal to the boost parameter value. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ConstantScore(System.Action> action) + { + Instance.ConstantScore = Elastic.Clients.Elasticsearch.QueryDsl.ConstantScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery? value) + { + Instance.DisMax = value; + return this; + } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DisMax(System.Action action) + { + Instance.DisMax = Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents matching one or more wrapped queries, called query clauses or clauses. + /// If a returned document matches multiple query clauses, the dis_max query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DisMax(System.Action> action) + { + Instance.DisMax = Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DistanceFeature(Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery? value) + { + Instance.DistanceFeature = value; + return this; + } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DistanceFeature(System.Func action) + { + Instance.DistanceFeature = Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryFactory.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents closer to a provided origin date or point. + /// For example, you can use this query to give more weight to documents closer to a certain date or location. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor DistanceFeature(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery> action) + { + Instance.DistanceFeature = Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Exists(System.Action action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery? value) + { + Instance.FunctionScore = value; + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore() + { + Instance.FunctionScore = Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore(System.Action? action) + { + Instance.FunctionScore = Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The function_score enables you to modify the score of documents that are retrieved by a query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FunctionScore(System.Action>? action) + { + Instance.FunctionScore = Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery? value) + { + Instance.Fuzzy = value; + return this; + } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Fuzzy(System.Action action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Fuzzy(System.Action> action) + { + Instance.Fuzzy = Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery? value) + { + Instance.GeoBoundingBox = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoBoundingBox(System.Action action) + { + Instance.GeoBoundingBox = Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a bounding box. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoBoundingBox(System.Action> action) + { + Instance.GeoBoundingBox = Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoDistance(Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQuery? value) + { + Instance.GeoDistance = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoDistance(System.Action action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values within a given distance of a geopoint. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoDistance(System.Action> action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.QueryDsl.GeoDistanceQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoGrid(Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQuery? value) + { + Instance.GeoGrid = value; + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoGrid(System.Action action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches geo_point and geo_shape values that intersect a grid cell from a GeoGrid aggregation. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoGrid(System.Action> action) + { + Instance.GeoGrid = Elastic.Clients.Elasticsearch.QueryDsl.GeoGridQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoPolygon(Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQuery? value) + { + Instance.GeoPolygon = value; + return this; + } + + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoPolygon(System.Action action) + { + Instance.GeoPolygon = Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.12.0'. Use geo-shape instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoPolygon(System.Action> action) + { + Instance.GeoPolygon = Elastic.Clients.Elasticsearch.QueryDsl.GeoPolygonQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoShape(Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQuery? value) + { + Instance.GeoShape = value; + return this; + } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoShape(System.Action action) + { + Instance.GeoShape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Filter documents indexed using either the geo_shape or the geo_point type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor GeoShape(System.Action> action) + { + Instance.GeoShape = Elastic.Clients.Elasticsearch.QueryDsl.GeoShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery? value) + { + Instance.HasChild = value; + return this; + } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasChild(System.Action action) + { + Instance.HasChild = Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns parent documents whose joined child documents match a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasChild(System.Action> action) + { + Instance.HasChild = Elastic.Clients.Elasticsearch.QueryDsl.HasChildQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery? value) + { + Instance.HasParent = value; + return this; + } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasParent(System.Action action) + { + Instance.HasParent = Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns child documents whose joined parent document matches a provided query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor HasParent(System.Action> action) + { + Instance.HasParent = Elastic.Clients.Elasticsearch.QueryDsl.HasParentQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Intervals(Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQuery? value) + { + Instance.Intervals = value; + return this; + } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Intervals(System.Action action) + { + Instance.Intervals = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on the order and proximity of matching terms. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Intervals(System.Action> action) + { + Instance.Intervals = Elastic.Clients.Elasticsearch.QueryDsl.IntervalsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery? value) + { + Instance.Knn = value; + return this; + } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Knn(System.Action action) + { + Instance.Knn = Elastic.Clients.Elasticsearch.KnnQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Finds the k nearest vectors to a query vector, as measured by a similarity + /// metric. knn query finds nearest vectors through approximate search on indexed + /// dense_vectors. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Knn(System.Action> action) + { + Instance.Knn = Elastic.Clients.Elasticsearch.KnnQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Match(System.Action action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchBoolPrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQuery? value) + { + Instance.MatchBoolPrefix = value; + return this; + } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchBoolPrefix(System.Action action) + { + Instance.MatchBoolPrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes its input and constructs a bool query from the terms. + /// Each term except the last is used in a term query. + /// The last term is used in a prefix query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchBoolPrefix(System.Action> action) + { + Instance.MatchBoolPrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchBoolPrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone(Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQuery? value) + { + Instance.MatchNone = value; + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone() + { + Instance.MatchNone = Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches no documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchNone(System.Action? action) + { + Instance.MatchNone = Elastic.Clients.Elasticsearch.QueryDsl.MatchNoneQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrase(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQuery? value) + { + Instance.MatchPhrase = value; + return this; + } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrase(System.Action action) + { + Instance.MatchPhrase = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Analyzes the text and creates a phrase query out of the analyzed text. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrase(System.Action> action) + { + Instance.MatchPhrase = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhraseQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrasePrefix(Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQuery? value) + { + Instance.MatchPhrasePrefix = value; + return this; + } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrasePrefix(System.Action action) + { + Instance.MatchPhrasePrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain the words of a provided text, in the same order as provided. + /// The last term of the provided text is treated as a prefix, matching any words that begin with that term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchPhrasePrefix(System.Action> action) + { + Instance.MatchPhrasePrefix = Elastic.Clients.Elasticsearch.QueryDsl.MatchPhrasePrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MoreLikeThis(Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQuery? value) + { + Instance.MoreLikeThis = value; + return this; + } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MoreLikeThis(System.Action action) + { + Instance.MoreLikeThis = Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that are "like" a given set of documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MoreLikeThis(System.Action> action) + { + Instance.MoreLikeThis = Elastic.Clients.Elasticsearch.QueryDsl.MoreLikeThisQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MultiMatch(Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQuery? value) + { + Instance.MultiMatch = value; + return this; + } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MultiMatch(System.Action action) + { + Instance.MultiMatch = Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Enables you to search for a provided text, number, date or boolean value across multiple fields. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MultiMatch(System.Action> action) + { + Instance.MultiMatch = Elastic.Clients.Elasticsearch.QueryDsl.MultiMatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Nested(Elastic.Clients.Elasticsearch.QueryDsl.NestedQuery? value) + { + Instance.Nested = value; + return this; + } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Nested(System.Action action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another query to search nested fields. + /// If an object matches the search, the nested query returns the root parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Nested(System.Action> action) + { + Instance.Nested = Elastic.Clients.Elasticsearch.QueryDsl.NestedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId(Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQuery? value) + { + Instance.ParentId = value; + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId() + { + Instance.ParentId = Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns child documents joined to a specific parent document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ParentId(System.Action? action) + { + Instance.ParentId = Elastic.Clients.Elasticsearch.QueryDsl.ParentIdQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Percolate(Elastic.Clients.Elasticsearch.QueryDsl.PercolateQuery? value) + { + Instance.Percolate = value; + return this; + } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Percolate(System.Action action) + { + Instance.Percolate = Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches queries stored in an index. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Percolate(System.Action> action) + { + Instance.Percolate = Elastic.Clients.Elasticsearch.QueryDsl.PercolateQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery? value) + { + Instance.Pinned = value; + return this; + } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Pinned(System.Action action) + { + Instance.Pinned = Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Promotes selected documents to rank higher than those matching a given query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Pinned(System.Action> action) + { + Instance.Pinned = Elastic.Clients.Elasticsearch.QueryDsl.PinnedQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery? value) + { + Instance.QueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryString(System.Action action) + { + Instance.QueryString = Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a strict syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryString(System.Action> action) + { + Instance.QueryString = Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Range(System.Func action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery? value) + { + Instance.RankFeature = value; + return this; + } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor RankFeature(System.Action action) + { + Instance.RankFeature = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Boosts the relevance score of documents based on the numeric value of a rank_feature or rank_features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor RankFeature(System.Action> action) + { + Instance.RankFeature = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery? value) + { + Instance.Regexp = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Regexp(System.Action action) + { + Instance.Regexp = Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a regular expression. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Regexp(System.Action> action) + { + Instance.Regexp = Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Rule(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery? value) + { + Instance.Rule = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Rule(System.Action action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Rule(System.Action> action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Filters documents based on a provided script. + /// The script query is typically used in a filter context. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery? value) + { + Instance.Script = value; + return this; + } + + /// + /// + /// Filters documents based on a provided script. + /// The script query is typically used in a filter context. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Script(System.Action action) + { + Instance.Script = Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery? value) + { + Instance.ScriptScore = value; + return this; + } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ScriptScore(System.Action action) + { + Instance.ScriptScore = Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Uses a script to provide a custom score for returned documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor ScriptScore(System.Action> action) + { + Instance.ScriptScore = Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A semantic query to semantic_text field types + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Semantic(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery? value) + { + Instance.Semantic = value; + return this; + } + + /// + /// + /// A semantic query to semantic_text field types + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Semantic(System.Action action) + { + Instance.Semantic = Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery? value) + { + Instance.Shape = value; + return this; + } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Shape(System.Action action) + { + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Queries documents that contain fields indexed using the shape type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Shape(System.Action> action) + { + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SimpleQueryString(System.Action action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? value) + { + Instance.SpanContaining = value; + return this; + } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanContaining(System.Action action) + { + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which enclose another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanContaining(System.Action> action) + { + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? value) + { + Instance.SpanFieldMasking = value; + return this; + } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFieldMasking(System.Action action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wrapper to allow span queries to participate in composite single-field span queries by lying about their search field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFieldMasking(System.Action> action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? value) + { + Instance.SpanFirst = value; + return this; + } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFirst(System.Action action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans near the beginning of a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanFirst(System.Action> action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? value) + { + Instance.SpanMulti = value; + return this; + } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanMulti(System.Action action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query) as a span query, so it can be nested. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanMulti(System.Action> action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? value) + { + Instance.SpanNear = value; + return this; + } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNear(System.Action action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans which are near one another. + /// You can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNear(System.Action> action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? value) + { + Instance.SpanNot = value; + return this; + } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNot(System.Action action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanNot(System.Action> action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? value) + { + Instance.SpanOr = value; + return this; + } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanOr(System.Action action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches the union of its span clauses. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanOr(System.Action> action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? value) + { + Instance.SpanTerm = value; + return this; + } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanTerm(System.Action action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches spans containing a term. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanTerm(System.Action> action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? value) + { + Instance.SpanWithin = value; + return this; + } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanWithin(System.Action action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns matches which are enclosed inside another span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SpanWithin(System.Action> action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SparseVector(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery? value) + { + Instance.SparseVector = value; + return this; + } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SparseVector(System.Action action) + { + Instance.SparseVector = Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor SparseVector(System.Action> action) + { + Instance.SparseVector = Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Term(System.Action action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Terms(System.Action action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TermsSet(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery? value) + { + Instance.TermsSet = value; + return this; + } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TermsSet(System.Action action) + { + Instance.TermsSet = Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a minimum number of exact terms in a provided field. + /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TermsSet(System.Action> action) + { + Instance.TermsSet = Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TextExpansion(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery? value) + { + Instance.TextExpansion = value; + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TextExpansion(System.Action action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor TextExpansion(System.Action> action) + { + Instance.TextExpansion = Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '7.0.0'. https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery? value) + { + Instance.Type = value; + return this; + } + + [System.Obsolete("Deprecated in '7.0.0'. https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html")] + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Type(System.Action action) + { + Instance.Type = Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor WeightedTokens(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery? value) + { + Instance.WeightedTokens = value; + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor WeightedTokens(System.Action action) + { + Instance.WeightedTokens = Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor.Build(action); + return this; + } + + [System.Obsolete("Deprecated in '8.15.0'.")] + /// + /// + /// Supports returning text_expansion query results by sending in precomputed tokens with the query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor WeightedTokens(System.Action> action) + { + Instance.WeightedTokens = Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A query that accepts any other query as base64 encoded string. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wrapper(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery? value) + { + Instance.Wrapper = value; + return this; + } + + /// + /// + /// A query that accepts any other query as base64 encoded string. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor Wrapper(System.Action action) + { + Instance.Wrapper = Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.Query Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.Query(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryStringQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryStringQuery.g.cs index c805604bc93..9afc585991c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryStringQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryStringQuery.g.cs @@ -17,24 +17,315 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class QueryStringQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowLeadingWildcard = System.Text.Json.JsonEncodedText.Encode("allow_leading_wildcard"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzeWildcard = System.Text.Json.JsonEncodedText.Encode("analyze_wildcard"); + private static readonly System.Text.Json.JsonEncodedText PropAutoGenerateSynonymsPhraseQuery = System.Text.Json.JsonEncodedText.Encode("auto_generate_synonyms_phrase_query"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultField = System.Text.Json.JsonEncodedText.Encode("default_field"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultOperator = System.Text.Json.JsonEncodedText.Encode("default_operator"); + private static readonly System.Text.Json.JsonEncodedText PropEnablePositionIncrements = System.Text.Json.JsonEncodedText.Encode("enable_position_increments"); + private static readonly System.Text.Json.JsonEncodedText PropEscape = System.Text.Json.JsonEncodedText.Encode("escape"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFuzziness = System.Text.Json.JsonEncodedText.Encode("fuzziness"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyMaxExpansions = System.Text.Json.JsonEncodedText.Encode("fuzzy_max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyPrefixLength = System.Text.Json.JsonEncodedText.Encode("fuzzy_prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyRewrite = System.Text.Json.JsonEncodedText.Encode("fuzzy_rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyTranspositions = System.Text.Json.JsonEncodedText.Encode("fuzzy_transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDeterminizedStates = System.Text.Json.JsonEncodedText.Encode("max_determinized_states"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropPhraseSlop = System.Text.Json.JsonEncodedText.Encode("phrase_slop"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropQuoteAnalyzer = System.Text.Json.JsonEncodedText.Encode("quote_analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropQuoteFieldSuffix = System.Text.Json.JsonEncodedText.Encode("quote_field_suffix"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropTieBreaker = System.Text.Json.JsonEncodedText.Encode("tie_breaker"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowLeadingWildcard = default; + LocalJsonValue propAnalyzer = default; + LocalJsonValue propAnalyzeWildcard = default; + LocalJsonValue propAutoGenerateSynonymsPhraseQuery = default; + LocalJsonValue propBoost = default; + LocalJsonValue propDefaultField = default; + LocalJsonValue propDefaultOperator = default; + LocalJsonValue propEnablePositionIncrements = default; + LocalJsonValue propEscape = default; + LocalJsonValue propFields = default; + LocalJsonValue propFuzziness = default; + LocalJsonValue propFuzzyMaxExpansions = default; + LocalJsonValue propFuzzyPrefixLength = default; + LocalJsonValue propFuzzyRewrite = default; + LocalJsonValue propFuzzyTranspositions = default; + LocalJsonValue propLenient = default; + LocalJsonValue propMaxDeterminizedStates = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propPhraseSlop = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propQuoteAnalyzer = default; + LocalJsonValue propQuoteFieldSuffix = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propTieBreaker = default; + LocalJsonValue propTimeZone = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowLeadingWildcard.TryReadProperty(ref reader, options, PropAllowLeadingWildcard, null)) + { + continue; + } + + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propAnalyzeWildcard.TryReadProperty(ref reader, options, PropAnalyzeWildcard, null)) + { + continue; + } + + if (propAutoGenerateSynonymsPhraseQuery.TryReadProperty(ref reader, options, PropAutoGenerateSynonymsPhraseQuery, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propDefaultField.TryReadProperty(ref reader, options, PropDefaultField, null)) + { + continue; + } + + if (propDefaultOperator.TryReadProperty(ref reader, options, PropDefaultOperator, null)) + { + continue; + } + + if (propEnablePositionIncrements.TryReadProperty(ref reader, options, PropEnablePositionIncrements, null)) + { + continue; + } + + if (propEscape.TryReadProperty(ref reader, options, PropEscape, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFuzziness.TryReadProperty(ref reader, options, PropFuzziness, null)) + { + continue; + } + + if (propFuzzyMaxExpansions.TryReadProperty(ref reader, options, PropFuzzyMaxExpansions, null)) + { + continue; + } + + if (propFuzzyPrefixLength.TryReadProperty(ref reader, options, PropFuzzyPrefixLength, null)) + { + continue; + } + + if (propFuzzyRewrite.TryReadProperty(ref reader, options, PropFuzzyRewrite, null)) + { + continue; + } + + if (propFuzzyTranspositions.TryReadProperty(ref reader, options, PropFuzzyTranspositions, null)) + { + continue; + } + + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (propMaxDeterminizedStates.TryReadProperty(ref reader, options, PropMaxDeterminizedStates, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propPhraseSlop.TryReadProperty(ref reader, options, PropPhraseSlop, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propQuoteAnalyzer.TryReadProperty(ref reader, options, PropQuoteAnalyzer, null)) + { + continue; + } + + if (propQuoteFieldSuffix.TryReadProperty(ref reader, options, PropQuoteFieldSuffix, null)) + { + continue; + } + + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } + + if (propTieBreaker.TryReadProperty(ref reader, options, PropTieBreaker, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowLeadingWildcard = propAllowLeadingWildcard.Value, + Analyzer = propAnalyzer.Value, + AnalyzeWildcard = propAnalyzeWildcard.Value, + AutoGenerateSynonymsPhraseQuery = propAutoGenerateSynonymsPhraseQuery.Value, + Boost = propBoost.Value, + DefaultField = propDefaultField.Value, + DefaultOperator = propDefaultOperator.Value, + EnablePositionIncrements = propEnablePositionIncrements.Value, + Escape = propEscape.Value, + Fields = propFields.Value, + Fuzziness = propFuzziness.Value, + FuzzyMaxExpansions = propFuzzyMaxExpansions.Value, + FuzzyPrefixLength = propFuzzyPrefixLength.Value, + FuzzyRewrite = propFuzzyRewrite.Value, + FuzzyTranspositions = propFuzzyTranspositions.Value, + Lenient = propLenient.Value, + MaxDeterminizedStates = propMaxDeterminizedStates.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + PhraseSlop = propPhraseSlop.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + QuoteAnalyzer = propQuoteAnalyzer.Value, + QuoteFieldSuffix = propQuoteFieldSuffix.Value, + Rewrite = propRewrite.Value, + TieBreaker = propTieBreaker.Value, + TimeZone = propTimeZone.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowLeadingWildcard, value.AllowLeadingWildcard, null, null); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropAnalyzeWildcard, value.AnalyzeWildcard, null, null); + writer.WriteProperty(options, PropAutoGenerateSynonymsPhraseQuery, value.AutoGenerateSynonymsPhraseQuery, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDefaultField, value.DefaultField, null, null); + writer.WriteProperty(options, PropDefaultOperator, value.DefaultOperator, null, null); + writer.WriteProperty(options, PropEnablePositionIncrements, value.EnablePositionIncrements, null, null); + writer.WriteProperty(options, PropEscape, value.Escape, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFuzziness, value.Fuzziness, null, null); + writer.WriteProperty(options, PropFuzzyMaxExpansions, value.FuzzyMaxExpansions, null, null); + writer.WriteProperty(options, PropFuzzyPrefixLength, value.FuzzyPrefixLength, null, null); + writer.WriteProperty(options, PropFuzzyRewrite, value.FuzzyRewrite, null, null); + writer.WriteProperty(options, PropFuzzyTranspositions, value.FuzzyTranspositions, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropMaxDeterminizedStates, value.MaxDeterminizedStates, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropPhraseSlop, value.PhraseSlop, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropQuoteAnalyzer, value.QuoteAnalyzer, null, null); + writer.WriteProperty(options, PropQuoteFieldSuffix, value.QuoteFieldSuffix, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropTieBreaker, value.TieBreaker, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryConverter))] public sealed partial class QueryStringQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryStringQuery(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public QueryStringQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryStringQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// If true, the wildcard characters * and ? are allowed as the first character of the query string. /// /// - [JsonInclude, JsonPropertyName("allow_leading_wildcard")] public bool? AllowLeadingWildcard { get; set; } /// @@ -42,7 +333,6 @@ public sealed partial class QueryStringQuery /// Analyzer used to convert text in the query string into tokens. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -50,7 +340,6 @@ public sealed partial class QueryStringQuery /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - [JsonInclude, JsonPropertyName("analyze_wildcard")] public bool? AnalyzeWildcard { get; set; } /// @@ -58,7 +347,6 @@ public sealed partial class QueryStringQuery /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - [JsonInclude, JsonPropertyName("auto_generate_synonyms_phrase_query")] public bool? AutoGenerateSynonymsPhraseQuery { get; set; } /// @@ -69,7 +357,6 @@ public sealed partial class QueryStringQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -79,7 +366,6 @@ public sealed partial class QueryStringQuery /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - [JsonInclude, JsonPropertyName("default_field")] public Elastic.Clients.Elasticsearch.Field? DefaultField { get; set; } /// @@ -87,7 +373,6 @@ public sealed partial class QueryStringQuery /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - [JsonInclude, JsonPropertyName("default_operator")] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get; set; } /// @@ -95,9 +380,7 @@ public sealed partial class QueryStringQuery /// If true, enable position increments in queries constructed from a query_string search. /// /// - [JsonInclude, JsonPropertyName("enable_position_increments")] public bool? EnablePositionIncrements { get; set; } - [JsonInclude, JsonPropertyName("escape")] public bool? Escape { get; set; } /// @@ -105,8 +388,6 @@ public sealed partial class QueryStringQuery /// Array of fields to search. Supports wildcards (*). /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(FieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -114,7 +395,6 @@ public sealed partial class QueryStringQuery /// Maximum edit distance allowed for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("fuzziness")] public Elastic.Clients.Elasticsearch.Fuzziness? Fuzziness { get; set; } /// @@ -122,7 +402,6 @@ public sealed partial class QueryStringQuery /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("fuzzy_max_expansions")] public int? FuzzyMaxExpansions { get; set; } /// @@ -130,7 +409,6 @@ public sealed partial class QueryStringQuery /// Number of beginning characters left unchanged for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("fuzzy_prefix_length")] public int? FuzzyPrefixLength { get; set; } /// @@ -138,7 +416,6 @@ public sealed partial class QueryStringQuery /// Method used to rewrite the query. /// /// - [JsonInclude, JsonPropertyName("fuzzy_rewrite")] public string? FuzzyRewrite { get; set; } /// @@ -146,7 +423,6 @@ public sealed partial class QueryStringQuery /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - [JsonInclude, JsonPropertyName("fuzzy_transpositions")] public bool? FuzzyTranspositions { get; set; } /// @@ -154,7 +430,6 @@ public sealed partial class QueryStringQuery /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - [JsonInclude, JsonPropertyName("lenient")] public bool? Lenient { get; set; } /// @@ -162,7 +437,6 @@ public sealed partial class QueryStringQuery /// Maximum number of automaton states required for the query. /// /// - [JsonInclude, JsonPropertyName("max_determinized_states")] public int? MaxDeterminizedStates { get; set; } /// @@ -170,7 +444,6 @@ public sealed partial class QueryStringQuery /// Minimum number of clauses that must match for a document to be returned. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -178,7 +451,6 @@ public sealed partial class QueryStringQuery /// Maximum number of positions allowed between matching tokens for phrases. /// /// - [JsonInclude, JsonPropertyName("phrase_slop")] public double? PhraseSlop { get; set; } /// @@ -186,9 +458,11 @@ public sealed partial class QueryStringQuery /// Query string you wish to parse and use for search. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -197,7 +471,6 @@ public sealed partial class QueryStringQuery /// For quoted text, this parameter overrides the analyzer specified in the analyzer parameter. /// /// - [JsonInclude, JsonPropertyName("quote_analyzer")] public string? QuoteAnalyzer { get; set; } /// @@ -206,7 +479,6 @@ public sealed partial class QueryStringQuery /// You can use this suffix to use a different analysis method for exact matches. /// /// - [JsonInclude, JsonPropertyName("quote_field_suffix")] public string? QuoteFieldSuffix { get; set; } /// @@ -214,7 +486,6 @@ public sealed partial class QueryStringQuery /// Method used to rewrite the query. /// /// - [JsonInclude, JsonPropertyName("rewrite")] public string? Rewrite { get; set; } /// @@ -222,7 +493,6 @@ public sealed partial class QueryStringQuery /// How to combine the queries generated from the individual search terms in the resulting dis_max query. /// /// - [JsonInclude, JsonPropertyName("tie_breaker")] public double? TieBreaker { get; set; } /// @@ -230,7 +500,6 @@ public sealed partial class QueryStringQuery /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } /// @@ -238,57 +507,37 @@ public sealed partial class QueryStringQuery /// Determines how the query matches and scores documents. /// /// - [JsonInclude, JsonPropertyName("type")] public Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(QueryStringQuery queryStringQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.QueryString(queryStringQuery); } -public sealed partial class QueryStringQueryDescriptor : SerializableDescriptor> +public readonly partial struct QueryStringQueryDescriptor { - internal QueryStringQueryDescriptor(Action> configure) => configure.Invoke(this); - - public QueryStringQueryDescriptor() : base() - { - } - - private bool? AllowLeadingWildcardValue { get; set; } - private string? AnalyzerValue { get; set; } - private bool? AnalyzeWildcardValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DefaultFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperatorValue { get; set; } - private bool? EnablePositionIncrementsValue { get; set; } - private bool? EscapeValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? FuzzyMaxExpansionsValue { get; set; } - private int? FuzzyPrefixLengthValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxDeterminizedStatesValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private double? PhraseSlopValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private string? QuoteAnalyzerValue { get; set; } - private string? QuoteFieldSuffixValue { get; set; } - private string? RewriteValue { get; set; } - private double? TieBreakerValue { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? TypeValue { get; set; } + internal Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryStringQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor descriptor) => descriptor.Instance; /// /// /// If true, the wildcard characters * and ? are allowed as the first character of the query string. /// /// - public QueryStringQueryDescriptor AllowLeadingWildcard(bool? allowLeadingWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AllowLeadingWildcard(bool? value = true) { - AllowLeadingWildcardValue = allowLeadingWildcard; - return Self; + Instance.AllowLeadingWildcard = value; + return this; } /// @@ -296,10 +545,10 @@ public QueryStringQueryDescriptor AllowLeadingWildcard(bool? allowLea /// Analyzer used to convert text in the query string into tokens. /// /// - public QueryStringQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -307,10 +556,10 @@ public QueryStringQueryDescriptor Analyzer(string? analyzer) /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - public QueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AnalyzeWildcard(bool? value = true) { - AnalyzeWildcardValue = analyzeWildcard; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// @@ -318,10 +567,10 @@ public QueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildca /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -332,10 +581,10 @@ public QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(boo /// A value greater than 1.0 increases the relevance score. /// /// - public QueryStringQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -345,10 +594,10 @@ public QueryStringQueryDescriptor Boost(float? boost) /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasticsearch.Field? defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasticsearch.Field? value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultField = value; + return this; } /// @@ -358,62 +607,71 @@ public QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasti /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public QueryStringQueryDescriptor DefaultField(Expression> defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultField(System.Linq.Expressions.Expression> value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultField = value; + return this; } /// /// - /// Default field to search if no field is provided in the query string. - /// Supports wildcards (*). - /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - public QueryStringQueryDescriptor DefaultField(Expression> defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultOperator = value; + return this; } /// /// - /// Default boolean logic used to interpret text in the query string if no operators are specified. + /// If true, enable position increments in queries constructed from a query_string search. /// /// - public QueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor EnablePositionIncrements(bool? value = true) + { + Instance.EnablePositionIncrements = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Escape(bool? value = true) { - DefaultOperatorValue = defaultOperator; - return Self; + Instance.Escape = value; + return this; } /// /// - /// If true, enable position increments in queries constructed from a query_string search. + /// Array of fields to search. Supports wildcards (*). /// /// - public QueryStringQueryDescriptor EnablePositionIncrements(bool? enablePositionIncrements = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - EnablePositionIncrementsValue = enablePositionIncrements; - return Self; + Instance.Fields = value; + return this; } - public QueryStringQueryDescriptor Escape(bool? escape = true) + /// + /// + /// Array of fields to search. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - EscapeValue = escape; - return Self; + Instance.Fields = value; + return this; } /// /// - /// Array of fields to search. Supports wildcards (*). + /// Maximum edit distance allowed for fuzzy matching. /// /// - public QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldsValue = fields; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -421,10 +679,10 @@ public QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearc /// Maximum edit distance allowed for fuzzy matching. /// /// - public QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -432,10 +690,10 @@ public QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticse /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - public QueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyMaxExpansions(int? value) { - FuzzyMaxExpansionsValue = fuzzyMaxExpansions; - return Self; + Instance.FuzzyMaxExpansions = value; + return this; } /// @@ -443,10 +701,10 @@ public QueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExp /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public QueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyPrefixLength(int? value) { - FuzzyPrefixLengthValue = fuzzyPrefixLength; - return Self; + Instance.FuzzyPrefixLength = value; + return this; } /// @@ -454,10 +712,10 @@ public QueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixL /// Method used to rewrite the query. /// /// - public QueryStringQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -465,10 +723,10 @@ public QueryStringQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public QueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -476,10 +734,10 @@ public QueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTran /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - public QueryStringQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -487,10 +745,10 @@ public QueryStringQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of automaton states required for the query. /// /// - public QueryStringQueryDescriptor MaxDeterminizedStates(int? maxDeterminizedStates) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor MaxDeterminizedStates(int? value) { - MaxDeterminizedStatesValue = maxDeterminizedStates; - return Self; + Instance.MaxDeterminizedStates = value; + return this; } /// @@ -498,10 +756,10 @@ public QueryStringQueryDescriptor MaxDeterminizedStates(int? maxDeter /// Minimum number of clauses that must match for a document to be returned. /// /// - public QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -509,10 +767,10 @@ public QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients. /// Maximum number of positions allowed between matching tokens for phrases. /// /// - public QueryStringQueryDescriptor PhraseSlop(double? phraseSlop) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor PhraseSlop(double? value) { - PhraseSlopValue = phraseSlop; - return Self; + Instance.PhraseSlop = value; + return this; } /// @@ -520,16 +778,16 @@ public QueryStringQueryDescriptor PhraseSlop(double? phraseSlop) /// Query string you wish to parse and use for search. /// /// - public QueryStringQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryStringQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -538,10 +796,10 @@ public QueryStringQueryDescriptor QueryName(string? queryName) /// For quoted text, this parameter overrides the analyzer specified in the analyzer parameter. /// /// - public QueryStringQueryDescriptor QuoteAnalyzer(string? quoteAnalyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QuoteAnalyzer(string? value) { - QuoteAnalyzerValue = quoteAnalyzer; - return Self; + Instance.QuoteAnalyzer = value; + return this; } /// @@ -550,10 +808,10 @@ public QueryStringQueryDescriptor QuoteAnalyzer(string? quoteAnalyzer /// You can use this suffix to use a different analysis method for exact matches. /// /// - public QueryStringQueryDescriptor QuoteFieldSuffix(string? quoteFieldSuffix) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QuoteFieldSuffix(string? value) { - QuoteFieldSuffixValue = quoteFieldSuffix; - return Self; + Instance.QuoteFieldSuffix = value; + return this; } /// @@ -561,10 +819,10 @@ public QueryStringQueryDescriptor QuoteFieldSuffix(string? quoteField /// Method used to rewrite the query. /// /// - public QueryStringQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -572,10 +830,10 @@ public QueryStringQueryDescriptor Rewrite(string? rewrite) /// How to combine the queries generated from the individual search terms in the resulting dis_max query. /// /// - public QueryStringQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } /// @@ -583,10 +841,10 @@ public QueryStringQueryDescriptor TieBreaker(double? tieBreaker) /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC. /// /// - public QueryStringQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } /// @@ -594,222 +852,49 @@ public QueryStringQueryDescriptor TimeZone(string? timeZone) /// Determines how the query matches and scores documents. /// /// - public QueryStringQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? type) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (AllowLeadingWildcardValue.HasValue) - { - writer.WritePropertyName("allow_leading_wildcard"); - writer.WriteBooleanValue(AllowLeadingWildcardValue.Value); - } - - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AnalyzeWildcardValue.HasValue) - { - writer.WritePropertyName("analyze_wildcard"); - writer.WriteBooleanValue(AnalyzeWildcardValue.Value); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DefaultFieldValue is not null) - { - writer.WritePropertyName("default_field"); - JsonSerializer.Serialize(writer, DefaultFieldValue, options); - } - - if (DefaultOperatorValue is not null) - { - writer.WritePropertyName("default_operator"); - JsonSerializer.Serialize(writer, DefaultOperatorValue, options); - } - - if (EnablePositionIncrementsValue.HasValue) - { - writer.WritePropertyName("enable_position_increments"); - writer.WriteBooleanValue(EnablePositionIncrementsValue.Value); - } - - if (EscapeValue.HasValue) - { - writer.WritePropertyName("escape"); - writer.WriteBooleanValue(EscapeValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (FuzzyMaxExpansionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_max_expansions"); - writer.WriteNumberValue(FuzzyMaxExpansionsValue.Value); - } - - if (FuzzyPrefixLengthValue.HasValue) - { - writer.WritePropertyName("fuzzy_prefix_length"); - writer.WriteNumberValue(FuzzyPrefixLengthValue.Value); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxDeterminizedStatesValue.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(MaxDeterminizedStatesValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (PhraseSlopValue.HasValue) - { - writer.WritePropertyName("phrase_slop"); - writer.WriteNumberValue(PhraseSlopValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(QuoteAnalyzerValue)) - { - writer.WritePropertyName("quote_analyzer"); - writer.WriteStringValue(QuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(QuoteFieldSuffixValue)) - { - writer.WritePropertyName("quote_field_suffix"); - writer.WriteStringValue(QuoteFieldSuffixValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } +public readonly partial struct QueryStringQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery Instance { get; init; } - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryStringQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class QueryStringQueryDescriptor : SerializableDescriptor -{ - internal QueryStringQueryDescriptor(Action configure) => configure.Invoke(this); - - public QueryStringQueryDescriptor() : base() - { - } - - private bool? AllowLeadingWildcardValue { get; set; } - private string? AnalyzerValue { get; set; } - private bool? AnalyzeWildcardValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? DefaultFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperatorValue { get; set; } - private bool? EnablePositionIncrementsValue { get; set; } - private bool? EscapeValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.Fuzziness? FuzzinessValue { get; set; } - private int? FuzzyMaxExpansionsValue { get; set; } - private int? FuzzyPrefixLengthValue { get; set; } - private string? FuzzyRewriteValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private int? MaxDeterminizedStatesValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private double? PhraseSlopValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private string? QuoteAnalyzerValue { get; set; } - private string? QuoteFieldSuffixValue { get; set; } - private string? RewriteValue { get; set; } - private double? TieBreakerValue { get; set; } - private string? TimeZoneValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? TypeValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor descriptor) => descriptor.Instance; /// /// /// If true, the wildcard characters * and ? are allowed as the first character of the query string. /// /// - public QueryStringQueryDescriptor AllowLeadingWildcard(bool? allowLeadingWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AllowLeadingWildcard(bool? value = true) { - AllowLeadingWildcardValue = allowLeadingWildcard; - return Self; + Instance.AllowLeadingWildcard = value; + return this; } /// @@ -817,10 +902,10 @@ public QueryStringQueryDescriptor AllowLeadingWildcard(bool? allowLeadingWildcar /// Analyzer used to convert text in the query string into tokens. /// /// - public QueryStringQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -828,10 +913,10 @@ public QueryStringQueryDescriptor Analyzer(string? analyzer) /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - public QueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AnalyzeWildcard(bool? value = true) { - AnalyzeWildcardValue = analyzeWildcard; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// @@ -839,10 +924,10 @@ public QueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) /// If true, match phrase queries are automatically created for multi-term synonyms. /// /// - public QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -853,10 +938,10 @@ public QueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGene /// A value greater than 1.0 increases the relevance score. /// /// - public QueryStringQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -866,10 +951,10 @@ public QueryStringQueryDescriptor Boost(float? boost) /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasticsearch.Field? defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasticsearch.Field? value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultField = value; + return this; } /// @@ -879,62 +964,71 @@ public QueryStringQueryDescriptor DefaultField(Elastic.Clients.Elasticsearch.Fie /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public QueryStringQueryDescriptor DefaultField(Expression> defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultField(System.Linq.Expressions.Expression> value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultField = value; + return this; } /// /// - /// Default field to search if no field is provided in the query string. - /// Supports wildcards (*). - /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - public QueryStringQueryDescriptor DefaultField(Expression> defaultField) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - DefaultFieldValue = defaultField; - return Self; + Instance.DefaultOperator = value; + return this; } /// /// - /// Default boolean logic used to interpret text in the query string if no operators are specified. + /// If true, enable position increments in queries constructed from a query_string search. /// /// - public QueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor EnablePositionIncrements(bool? value = true) { - DefaultOperatorValue = defaultOperator; - return Self; + Instance.EnablePositionIncrements = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Escape(bool? value = true) + { + Instance.Escape = value; + return this; } /// /// - /// If true, enable position increments in queries constructed from a query_string search. + /// Array of fields to search. Supports wildcards (*). /// /// - public QueryStringQueryDescriptor EnablePositionIncrements(bool? enablePositionIncrements = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - EnablePositionIncrementsValue = enablePositionIncrements; - return Self; + Instance.Fields = value; + return this; } - public QueryStringQueryDescriptor Escape(bool? escape = true) + /// + /// + /// Array of fields to search. Supports wildcards (*). + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - EscapeValue = escape; - return Self; + Instance.Fields = value; + return this; } /// /// - /// Array of fields to search. Supports wildcards (*). + /// Maximum edit distance allowed for fuzzy matching. /// /// - public QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? value) { - FieldsValue = fields; - return Self; + Instance.Fuzziness = value; + return this; } /// @@ -942,10 +1036,10 @@ public QueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? f /// Maximum edit distance allowed for fuzzy matching. /// /// - public QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzziness? fuzziness) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Fuzziness(System.Func action) { - FuzzinessValue = fuzziness; - return Self; + Instance.Fuzziness = Elastic.Clients.Elasticsearch.FuzzinessFactory.Build(action); + return this; } /// @@ -953,10 +1047,10 @@ public QueryStringQueryDescriptor Fuzziness(Elastic.Clients.Elasticsearch.Fuzzin /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - public QueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyMaxExpansions(int? value) { - FuzzyMaxExpansionsValue = fuzzyMaxExpansions; - return Self; + Instance.FuzzyMaxExpansions = value; + return this; } /// @@ -964,10 +1058,10 @@ public QueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansions) /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public QueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyPrefixLength(int? value) { - FuzzyPrefixLengthValue = fuzzyPrefixLength; - return Self; + Instance.FuzzyPrefixLength = value; + return this; } /// @@ -975,10 +1069,10 @@ public QueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength) /// Method used to rewrite the query. /// /// - public QueryStringQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyRewrite(string? value) { - FuzzyRewriteValue = fuzzyRewrite; - return Self; + Instance.FuzzyRewrite = value; + return this; } /// @@ -986,10 +1080,10 @@ public QueryStringQueryDescriptor FuzzyRewrite(string? fuzzyRewrite) /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public QueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -997,10 +1091,10 @@ public QueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - public QueryStringQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -1008,10 +1102,10 @@ public QueryStringQueryDescriptor Lenient(bool? lenient = true) /// Maximum number of automaton states required for the query. /// /// - public QueryStringQueryDescriptor MaxDeterminizedStates(int? maxDeterminizedStates) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor MaxDeterminizedStates(int? value) { - MaxDeterminizedStatesValue = maxDeterminizedStates; - return Self; + Instance.MaxDeterminizedStates = value; + return this; } /// @@ -1019,10 +1113,10 @@ public QueryStringQueryDescriptor MaxDeterminizedStates(int? maxDeterminizedStat /// Minimum number of clauses that must match for a document to be returned. /// /// - public QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -1030,10 +1124,10 @@ public QueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsear /// Maximum number of positions allowed between matching tokens for phrases. /// /// - public QueryStringQueryDescriptor PhraseSlop(double? phraseSlop) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor PhraseSlop(double? value) { - PhraseSlopValue = phraseSlop; - return Self; + Instance.PhraseSlop = value; + return this; } /// @@ -1041,16 +1135,16 @@ public QueryStringQueryDescriptor PhraseSlop(double? phraseSlop) /// Query string you wish to parse and use for search. /// /// - public QueryStringQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public QueryStringQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -1059,10 +1153,10 @@ public QueryStringQueryDescriptor QueryName(string? queryName) /// For quoted text, this parameter overrides the analyzer specified in the analyzer parameter. /// /// - public QueryStringQueryDescriptor QuoteAnalyzer(string? quoteAnalyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QuoteAnalyzer(string? value) { - QuoteAnalyzerValue = quoteAnalyzer; - return Self; + Instance.QuoteAnalyzer = value; + return this; } /// @@ -1071,10 +1165,10 @@ public QueryStringQueryDescriptor QuoteAnalyzer(string? quoteAnalyzer) /// You can use this suffix to use a different analysis method for exact matches. /// /// - public QueryStringQueryDescriptor QuoteFieldSuffix(string? quoteFieldSuffix) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor QuoteFieldSuffix(string? value) { - QuoteFieldSuffixValue = quoteFieldSuffix; - return Self; + Instance.QuoteFieldSuffix = value; + return this; } /// @@ -1082,10 +1176,10 @@ public QueryStringQueryDescriptor QuoteFieldSuffix(string? quoteFieldSuffix) /// Method used to rewrite the query. /// /// - public QueryStringQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -1093,10 +1187,10 @@ public QueryStringQueryDescriptor Rewrite(string? rewrite) /// How to combine the queries generated from the individual search terms in the resulting dis_max query. /// /// - public QueryStringQueryDescriptor TieBreaker(double? tieBreaker) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor TieBreaker(double? value) { - TieBreakerValue = tieBreaker; - return Self; + Instance.TieBreaker = value; + return this; } /// @@ -1104,10 +1198,10 @@ public QueryStringQueryDescriptor TieBreaker(double? tieBreaker) /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC. /// /// - public QueryStringQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } /// @@ -1115,173 +1209,17 @@ public QueryStringQueryDescriptor TimeZone(string? timeZone) /// Determines how the query matches and scores documents. /// /// - public QueryStringQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? type) + public Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor Type(Elastic.Clients.Elasticsearch.QueryDsl.TextQueryType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery Build(System.Action action) { - writer.WriteStartObject(); - if (AllowLeadingWildcardValue.HasValue) - { - writer.WritePropertyName("allow_leading_wildcard"); - writer.WriteBooleanValue(AllowLeadingWildcardValue.Value); - } - - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AnalyzeWildcardValue.HasValue) - { - writer.WritePropertyName("analyze_wildcard"); - writer.WriteBooleanValue(AnalyzeWildcardValue.Value); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DefaultFieldValue is not null) - { - writer.WritePropertyName("default_field"); - JsonSerializer.Serialize(writer, DefaultFieldValue, options); - } - - if (DefaultOperatorValue is not null) - { - writer.WritePropertyName("default_operator"); - JsonSerializer.Serialize(writer, DefaultOperatorValue, options); - } - - if (EnablePositionIncrementsValue.HasValue) - { - writer.WritePropertyName("enable_position_increments"); - writer.WriteBooleanValue(EnablePositionIncrementsValue.Value); - } - - if (EscapeValue.HasValue) - { - writer.WritePropertyName("escape"); - writer.WriteBooleanValue(EscapeValue.Value); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FuzzinessValue is not null) - { - writer.WritePropertyName("fuzziness"); - JsonSerializer.Serialize(writer, FuzzinessValue, options); - } - - if (FuzzyMaxExpansionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_max_expansions"); - writer.WriteNumberValue(FuzzyMaxExpansionsValue.Value); - } - - if (FuzzyPrefixLengthValue.HasValue) - { - writer.WritePropertyName("fuzzy_prefix_length"); - writer.WriteNumberValue(FuzzyPrefixLengthValue.Value); - } - - if (!string.IsNullOrEmpty(FuzzyRewriteValue)) - { - writer.WritePropertyName("fuzzy_rewrite"); - writer.WriteStringValue(FuzzyRewriteValue); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MaxDeterminizedStatesValue.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(MaxDeterminizedStatesValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (PhraseSlopValue.HasValue) - { - writer.WritePropertyName("phrase_slop"); - writer.WriteNumberValue(PhraseSlopValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(QuoteAnalyzerValue)) - { - writer.WritePropertyName("quote_analyzer"); - writer.WriteStringValue(QuoteAnalyzerValue); - } - - if (!string.IsNullOrEmpty(QuoteFieldSuffixValue)) - { - writer.WritePropertyName("quote_field_suffix"); - writer.WriteStringValue(QuoteFieldSuffixValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (TieBreakerValue.HasValue) - { - writer.WritePropertyName("tie_breaker"); - writer.WriteNumberValue(TieBreakerValue.Value); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RandomScoreFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RandomScoreFunction.g.cs index b6ff83606d3..0f11f388f4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RandomScoreFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RandomScoreFunction.g.cs @@ -17,130 +17,181 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class RandomScoreFunction +internal sealed partial class RandomScoreFunctionConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("seed")] - public object? Seed { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropSeed = System.Text.Json.JsonEncodedText.Encode("seed"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propSeed = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propSeed.TryReadProperty(ref reader, options, PropSeed, static Elastic.Clients.Elasticsearch.Union? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadUnionValue(o, static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String), null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Seed = propSeed.Value + }; + } - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(RandomScoreFunction randomScoreFunction) => Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore.RandomScore(randomScoreFunction); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropSeed, value.Seed, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Union? v) => w.WriteUnionValue(o, v, null, null)); + writer.WriteEndObject(); + } } -public sealed partial class RandomScoreFunctionDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionConverter))] +public sealed partial class RandomScoreFunction { - internal RandomScoreFunctionDescriptor(Action> configure) => configure.Invoke(this); - - public RandomScoreFunctionDescriptor() : base() +#if NET7_0_OR_GREATER + public RandomScoreFunction() { } +#endif +#if !NET7_0_OR_GREATER + public RandomScoreFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private object? SeedValue { get; set; } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } + public Elastic.Clients.Elasticsearch.Union? Seed { get; set; } +} + +public readonly partial struct RandomScoreFunctionDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction Instance { get; init; } - public RandomScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction instance) { - FieldValue = field; - return Self; + Instance = instance; } - public RandomScoreFunctionDescriptor Field(Expression> field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomScoreFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RandomScoreFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RandomScoreFunctionDescriptor Seed(object? seed) + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - SeedValue = seed; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Seed(Elastic.Clients.Elasticsearch.Union? value) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } + Instance.Seed = value; + return this; + } - if (SeedValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("seed"); - JsonSerializer.Serialize(writer, SeedValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RandomScoreFunctionDescriptor : SerializableDescriptor +public readonly partial struct RandomScoreFunctionDescriptor { - internal RandomScoreFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction Instance { get; init; } - public RandomScoreFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private object? SeedValue { get; set; } - - public RandomScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RandomScoreFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RandomScoreFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RandomScoreFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RandomScoreFunctionDescriptor Seed(object? seed) + public Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor Seed(Elastic.Clients.Elasticsearch.Union? value) { - SeedValue = seed; - return Self; + Instance.Seed = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction Build(System.Action? action) { - writer.WriteStartObject(); - if (FieldValue is not null) + if (action is null) { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SeedValue is not null) - { - writer.WritePropertyName("seed"); - JsonSerializer.Serialize(writer, SeedValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RandomScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs new file mode 100644 index 00000000000..203f12cb1b3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs @@ -0,0 +1,179 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class IRangeQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + return reader.ReadValue(options, null); + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery value, System.Text.Json.JsonSerializerOptions options) + { + switch (value) + { + case Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery v: + writer.WriteValue(options, v, null); + break; + case Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery v: + writer.WriteValue(options, v, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryConverter))] +public partial interface IRangeQuery +{ + public string Type { get; } +} + +public readonly partial struct IRangeQueryFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Date(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Number(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Number(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Term(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Build(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct IRangeQueryFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Date(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Date(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Date(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Number(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Number(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Number(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Term(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Term(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Untyped(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Untyped(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Untyped(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLinear.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLinear.g.cs index d966813637c..0e74db7bbfa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLinear.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLinear.g.cs @@ -17,31 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RankFeatureFunctionLinearConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearConverter))] public sealed partial class RankFeatureFunctionLinear { +#if NET7_0_OR_GREATER + public RankFeatureFunctionLinear() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankFeatureFunctionLinear() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } } -public sealed partial class RankFeatureFunctionLinearDescriptor : SerializableDescriptor +public readonly partial struct RankFeatureFunctionLinearDescriptor { - internal RankFeatureFunctionLinearDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear Instance { get; init; } - public RankFeatureFunctionLinearDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionLinearDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear instance) { + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionLinearDescriptor() { - writer.WriteStartObject(); - writer.WriteEndObject(); + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor descriptor) => descriptor.Instance; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLogarithm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLogarithm.g.cs index 87715f57f1b..49d3c82b2e9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLogarithm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionLogarithm.g.cs @@ -17,53 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RankFeatureFunctionLogarithmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScalingFactor = System.Text.Json.JsonEncodedText.Encode("scaling_factor"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScalingFactor = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScalingFactor.TryReadProperty(ref reader, options, PropScalingFactor, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ScalingFactor = propScalingFactor.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScalingFactor, value.ScalingFactor, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmConverter))] public sealed partial class RankFeatureFunctionLogarithm { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionLogarithm(float scalingFactor) + { + ScalingFactor = scalingFactor; + } +#if NET7_0_OR_GREATER + public RankFeatureFunctionLogarithm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankFeatureFunctionLogarithm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureFunctionLogarithm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Configurable scaling factor. /// /// - [JsonInclude, JsonPropertyName("scaling_factor")] - public float ScalingFactor { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float ScalingFactor { get; set; } } -public sealed partial class RankFeatureFunctionLogarithmDescriptor : SerializableDescriptor +public readonly partial struct RankFeatureFunctionLogarithmDescriptor { - internal RankFeatureFunctionLogarithmDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm Instance { get; init; } - public RankFeatureFunctionLogarithmDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionLogarithmDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm instance) { + Instance = instance; } - private float ScalingFactorValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionLogarithmDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor descriptor) => descriptor.Instance; /// /// /// Configurable scaling factor. /// /// - public RankFeatureFunctionLogarithmDescriptor ScalingFactor(float scalingFactor) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor ScalingFactor(float value) { - ScalingFactorValue = scalingFactor; - return Self; + Instance.ScalingFactor = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("scaling_factor"); - writer.WriteNumberValue(ScalingFactorValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSaturation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSaturation.g.cs index 30dfde4ff0b..a96d6fd63ac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSaturation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSaturation.g.cs @@ -17,57 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RankFeatureFunctionSaturationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPivot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Pivot = propPivot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationConverter))] public sealed partial class RankFeatureFunctionSaturation { +#if NET7_0_OR_GREATER + public RankFeatureFunctionSaturation() + { + } +#endif +#if !NET7_0_OR_GREATER + public RankFeatureFunctionSaturation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Configurable pivot value so that the result will be less than 0.5. /// /// - [JsonInclude, JsonPropertyName("pivot")] public float? Pivot { get; set; } } -public sealed partial class RankFeatureFunctionSaturationDescriptor : SerializableDescriptor +public readonly partial struct RankFeatureFunctionSaturationDescriptor { - internal RankFeatureFunctionSaturationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation Instance { get; init; } - public RankFeatureFunctionSaturationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionSaturationDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation instance) { + Instance = instance; } - private float? PivotValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionSaturationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor descriptor) => descriptor.Instance; /// /// /// Configurable pivot value so that the result will be less than 0.5. /// /// - public RankFeatureFunctionSaturationDescriptor Pivot(float? pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor Pivot(float? value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation Build(System.Action? action) { - writer.WriteStartObject(); - if (PivotValue.HasValue) + if (action is null) { - writer.WritePropertyName("pivot"); - writer.WriteNumberValue(PivotValue.Value); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSigmoid.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSigmoid.g.cs index e14d8ecdf3f..bacef49c5ed 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSigmoid.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureFunctionSigmoid.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RankFeatureFunctionSigmoidConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExponent = System.Text.Json.JsonEncodedText.Encode("exponent"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExponent = default; + LocalJsonValue propPivot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExponent.TryReadProperty(ref reader, options, PropExponent, null)) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Exponent = propExponent.Value, + Pivot = propPivot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExponent, value.Exponent, null, null); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidConverter))] public sealed partial class RankFeatureFunctionSigmoid { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionSigmoid(float exponent, float pivot) + { + Exponent = exponent; + Pivot = pivot; + } +#if NET7_0_OR_GREATER + public RankFeatureFunctionSigmoid() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankFeatureFunctionSigmoid() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureFunctionSigmoid(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Configurable Exponent. /// /// - [JsonInclude, JsonPropertyName("exponent")] - public float Exponent { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float Exponent { get; set; } /// /// /// Configurable pivot value so that the result will be less than 0.5. /// /// - [JsonInclude, JsonPropertyName("pivot")] - public float Pivot { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + float Pivot { get; set; } } -public sealed partial class RankFeatureFunctionSigmoidDescriptor : SerializableDescriptor +public readonly partial struct RankFeatureFunctionSigmoidDescriptor { - internal RankFeatureFunctionSigmoidDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid Instance { get; init; } - public RankFeatureFunctionSigmoidDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionSigmoidDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid instance) { + Instance = instance; } - private float ExponentValue { get; set; } - private float PivotValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureFunctionSigmoidDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor descriptor) => descriptor.Instance; /// /// /// Configurable Exponent. /// /// - public RankFeatureFunctionSigmoidDescriptor Exponent(float exponent) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor Exponent(float value) { - ExponentValue = exponent; - return Self; + Instance.Exponent = value; + return this; } /// @@ -73,19 +155,17 @@ public RankFeatureFunctionSigmoidDescriptor Exponent(float exponent) /// Configurable pivot value so that the result will be less than 0.5. /// /// - public RankFeatureFunctionSigmoidDescriptor Pivot(float pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor Pivot(float value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("exponent"); - writer.WriteNumberValue(ExponentValue); - writer.WritePropertyName("pivot"); - writer.WriteNumberValue(PivotValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureQuery.g.cs index 465f5e088ec..64ad3c18046 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RankFeatureQuery.g.cs @@ -17,18 +17,130 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RankFeatureQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropLinear = System.Text.Json.JsonEncodedText.Encode("linear"); + private static readonly System.Text.Json.JsonEncodedText PropLog = System.Text.Json.JsonEncodedText.Encode("log"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropSaturation = System.Text.Json.JsonEncodedText.Encode("saturation"); + private static readonly System.Text.Json.JsonEncodedText PropSigmoid = System.Text.Json.JsonEncodedText.Encode("sigmoid"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propLinear = default; + LocalJsonValue propLog = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propSaturation = default; + LocalJsonValue propSigmoid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propLinear.TryReadProperty(ref reader, options, PropLinear, null)) + { + continue; + } + + if (propLog.TryReadProperty(ref reader, options, PropLog, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propSaturation.TryReadProperty(ref reader, options, PropSaturation, null)) + { + continue; + } + + if (propSigmoid.TryReadProperty(ref reader, options, PropSigmoid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Linear = propLinear.Value, + Log = propLog.Value, + QueryName = propQueryName.Value, + Saturation = propSaturation.Value, + Sigmoid = propSigmoid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropLinear, value.Linear, null, null); + writer.WriteProperty(options, PropLog, value.Log, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropSaturation, value.Saturation, null, null); + writer.WriteProperty(options, PropSigmoid, value.Sigmoid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryConverter))] public sealed partial class RankFeatureQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public RankFeatureQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RankFeatureQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +149,6 @@ public sealed partial class RankFeatureQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,15 +156,17 @@ public sealed partial class RankFeatureQuery /// rank_feature or rank_features field used to boost relevance scores. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// Linear function used to boost relevance scores based on the value of the rank feature field. /// /// - [JsonInclude, JsonPropertyName("linear")] public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? Linear { get; set; } /// @@ -61,9 +174,7 @@ public sealed partial class RankFeatureQuery /// Logarithmic function used to boost relevance scores based on the value of the rank feature field. /// /// - [JsonInclude, JsonPropertyName("log")] public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? Log { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -71,7 +182,6 @@ public sealed partial class RankFeatureQuery /// Saturation function used to boost relevance scores based on the value of the rank feature field. /// /// - [JsonInclude, JsonPropertyName("saturation")] public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? Saturation { get; set; } /// @@ -79,35 +189,27 @@ public sealed partial class RankFeatureQuery /// Sigmoid function used to boost relevance scores based on the value of the rank feature field. /// /// - [JsonInclude, JsonPropertyName("sigmoid")] public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? Sigmoid { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(RankFeatureQuery rankFeatureQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.RankFeature(rankFeatureQuery); } -public sealed partial class RankFeatureQueryDescriptor : SerializableDescriptor> +public readonly partial struct RankFeatureQueryDescriptor { - internal RankFeatureQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery instance) + { + Instance = instance; + } - public RankFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? LinearValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor LinearDescriptor { get; set; } - private Action LinearDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? LogValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor LogDescriptor { get; set; } - private Action LogDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? SaturationValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor SaturationDescriptor { get; set; } - private Action SaturationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? SigmoidValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor SigmoidDescriptor { get; set; } - private Action SigmoidDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -117,10 +219,10 @@ public RankFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RankFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -128,10 +230,10 @@ public RankFeatureQueryDescriptor Boost(float? boost) /// rank_feature or rank_features field used to boost relevance scores. /// /// - public RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -139,21 +241,21 @@ public RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch /// rank_feature or rank_features field used to boost relevance scores. /// /// - public RankFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// rank_feature or rank_features field used to boost relevance scores. + /// Linear function used to boost relevance scores based on the value of the rank feature field. /// /// - public RankFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? value) { - FieldValue = field; - return Self; + Instance.Linear = value; + return this; } /// @@ -161,28 +263,21 @@ public RankFeatureQueryDescriptor Field(Expressionfield. /// /// - public RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? linear) - { - LinearDescriptor = null; - LinearDescriptorAction = null; - LinearValue = linear; - return Self; - } - - public RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear() { - LinearValue = null; - LinearDescriptorAction = null; - LinearDescriptor = descriptor; - return Self; + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor.Build(null); + return this; } - public RankFeatureQueryDescriptor Linear(Action configure) + /// + /// + /// Linear function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear(System.Action? action) { - LinearValue = null; - LinearDescriptor = null; - LinearDescriptorAction = configure; - return Self; + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor.Build(action); + return this; } /// @@ -190,34 +285,38 @@ public RankFeatureQueryDescriptor Linear(Actionfield. /// /// - public RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? log) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? value) { - LogDescriptor = null; - LogDescriptorAction = null; - LogValue = log; - return Self; + Instance.Log = value; + return this; } - public RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor descriptor) + /// + /// + /// Logarithmic function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Log(System.Action action) { - LogValue = null; - LogDescriptorAction = null; - LogDescriptor = descriptor; - return Self; + Instance.Log = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor.Build(action); + return this; } - public RankFeatureQueryDescriptor Log(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor QueryName(string? value) { - LogValue = null; - LogDescriptor = null; - LogDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public RankFeatureQueryDescriptor QueryName(string? queryName) + /// + /// + /// Saturation function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? value) { - QueryNameValue = queryName; - return Self; + Instance.Saturation = value; + return this; } /// @@ -225,28 +324,32 @@ public RankFeatureQueryDescriptor QueryName(string? queryName) /// Saturation function used to boost relevance scores based on the value of the rank feature field. /// /// - public RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? saturation) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation() { - SaturationDescriptor = null; - SaturationDescriptorAction = null; - SaturationValue = saturation; - return Self; + Instance.Saturation = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor.Build(null); + return this; } - public RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor descriptor) + /// + /// + /// Saturation function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation(System.Action? action) { - SaturationValue = null; - SaturationDescriptorAction = null; - SaturationDescriptor = descriptor; - return Self; + Instance.Saturation = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor.Build(action); + return this; } - public RankFeatureQueryDescriptor Saturation(Action configure) + /// + /// + /// Sigmoid function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? value) { - SaturationValue = null; - SaturationDescriptor = null; - SaturationDescriptorAction = configure; - return Self; + Instance.Sigmoid = value; + return this; } /// @@ -254,138 +357,39 @@ public RankFeatureQueryDescriptor Saturation(Actionfield. /// /// - public RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? sigmoid) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Sigmoid(System.Action action) { - SigmoidDescriptor = null; - SigmoidDescriptorAction = null; - SigmoidValue = sigmoid; - return Self; + Instance.Sigmoid = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor.Build(action); + return this; } - public RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor descriptor) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery Build(System.Action> action) { - SigmoidValue = null; - SigmoidDescriptorAction = null; - SigmoidDescriptor = descriptor; - return Self; + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public RankFeatureQueryDescriptor Sigmoid(Action configure) - { - SigmoidValue = null; - SigmoidDescriptor = null; - SigmoidDescriptorAction = configure; - return Self; - } +public readonly partial struct RankFeatureQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery instance) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LinearDescriptor is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, LinearDescriptor, options); - } - else if (LinearDescriptorAction is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor(LinearDescriptorAction), options); - } - else if (LinearValue is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, LinearValue, options); - } - - if (LogDescriptor is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, LogDescriptor, options); - } - else if (LogDescriptorAction is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor(LogDescriptorAction), options); - } - else if (LogValue is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, LogValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SaturationDescriptor is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, SaturationDescriptor, options); - } - else if (SaturationDescriptorAction is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor(SaturationDescriptorAction), options); - } - else if (SaturationValue is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, SaturationValue, options); - } - - if (SigmoidDescriptor is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, SigmoidDescriptor, options); - } - else if (SigmoidDescriptorAction is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor(SigmoidDescriptorAction), options); - } - else if (SigmoidValue is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, SigmoidValue, options); - } - - writer.WriteEndObject(); + Instance = instance; } -} - -public sealed partial class RankFeatureQueryDescriptor : SerializableDescriptor -{ - internal RankFeatureQueryDescriptor(Action configure) => configure.Invoke(this); - public RankFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankFeatureQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? LinearValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor LinearDescriptor { get; set; } - private Action LinearDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? LogValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor LogDescriptor { get; set; } - private Action LogDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? SaturationValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor SaturationDescriptor { get; set; } - private Action SaturationDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? SigmoidValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor SigmoidDescriptor { get; set; } - private Action SigmoidDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -395,10 +399,10 @@ public RankFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RankFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -406,10 +410,10 @@ public RankFeatureQueryDescriptor Boost(float? boost) /// rank_feature or rank_features field used to boost relevance scores. /// /// - public RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -417,21 +421,21 @@ public RankFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field fiel /// rank_feature or rank_features field used to boost relevance scores. /// /// - public RankFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// rank_feature or rank_features field used to boost relevance scores. + /// Linear function used to boost relevance scores based on the value of the rank feature field. /// /// - public RankFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? value) { - FieldValue = field; - return Self; + Instance.Linear = value; + return this; } /// @@ -439,28 +443,21 @@ public RankFeatureQueryDescriptor Field(Expressionfield. /// /// - public RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinear? linear) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear() { - LinearDescriptor = null; - LinearDescriptorAction = null; - LinearValue = linear; - return Self; + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor.Build(null); + return this; } - public RankFeatureQueryDescriptor Linear(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor descriptor) - { - LinearValue = null; - LinearDescriptorAction = null; - LinearDescriptor = descriptor; - return Self; - } - - public RankFeatureQueryDescriptor Linear(Action configure) + /// + /// + /// Linear function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Linear(System.Action? action) { - LinearValue = null; - LinearDescriptor = null; - LinearDescriptorAction = configure; - return Self; + Instance.Linear = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor.Build(action); + return this; } /// @@ -468,34 +465,27 @@ public RankFeatureQueryDescriptor Linear(Actionfield. /// /// - public RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? log) - { - LogDescriptor = null; - LogDescriptorAction = null; - LogValue = log; - return Self; - } - - public RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Log(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithm? value) { - LogValue = null; - LogDescriptorAction = null; - LogDescriptor = descriptor; - return Self; + Instance.Log = value; + return this; } - public RankFeatureQueryDescriptor Log(Action configure) + /// + /// + /// Logarithmic function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Log(System.Action action) { - LogValue = null; - LogDescriptor = null; - LogDescriptorAction = configure; - return Self; + Instance.Log = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor.Build(action); + return this; } - public RankFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -503,28 +493,32 @@ public RankFeatureQueryDescriptor QueryName(string? queryName) /// Saturation function used to boost relevance scores based on the value of the rank feature field. /// /// - public RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? saturation) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturation? value) { - SaturationDescriptor = null; - SaturationDescriptorAction = null; - SaturationValue = saturation; - return Self; + Instance.Saturation = value; + return this; } - public RankFeatureQueryDescriptor Saturation(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor descriptor) + /// + /// + /// Saturation function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation() { - SaturationValue = null; - SaturationDescriptorAction = null; - SaturationDescriptor = descriptor; - return Self; + Instance.Saturation = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor.Build(null); + return this; } - public RankFeatureQueryDescriptor Saturation(Action configure) + /// + /// + /// Saturation function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Saturation(System.Action? action) { - SaturationValue = null; - SaturationDescriptor = null; - SaturationDescriptorAction = configure; - return Self; + Instance.Saturation = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor.Build(action); + return this; } /// @@ -532,111 +526,28 @@ public RankFeatureQueryDescriptor Saturation(Actionfield. /// /// - public RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? sigmoid) - { - SigmoidDescriptor = null; - SigmoidDescriptorAction = null; - SigmoidValue = sigmoid; - return Self; - } - - public RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Sigmoid(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoid? value) { - SigmoidValue = null; - SigmoidDescriptorAction = null; - SigmoidDescriptor = descriptor; - return Self; + Instance.Sigmoid = value; + return this; } - public RankFeatureQueryDescriptor Sigmoid(Action configure) + /// + /// + /// Sigmoid function used to boost relevance scores based on the value of the rank feature field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor Sigmoid(System.Action action) { - SigmoidValue = null; - SigmoidDescriptor = null; - SigmoidDescriptorAction = configure; - return Self; + Instance.Sigmoid = Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (LinearDescriptor is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, LinearDescriptor, options); - } - else if (LinearDescriptorAction is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLinearDescriptor(LinearDescriptorAction), options); - } - else if (LinearValue is not null) - { - writer.WritePropertyName("linear"); - JsonSerializer.Serialize(writer, LinearValue, options); - } - - if (LogDescriptor is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, LogDescriptor, options); - } - else if (LogDescriptorAction is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionLogarithmDescriptor(LogDescriptorAction), options); - } - else if (LogValue is not null) - { - writer.WritePropertyName("log"); - JsonSerializer.Serialize(writer, LogValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SaturationDescriptor is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, SaturationDescriptor, options); - } - else if (SaturationDescriptorAction is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSaturationDescriptor(SaturationDescriptorAction), options); - } - else if (SaturationValue is not null) - { - writer.WritePropertyName("saturation"); - JsonSerializer.Serialize(writer, SaturationValue, options); - } - - if (SigmoidDescriptor is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, SigmoidDescriptor, options); - } - else if (SigmoidDescriptorAction is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureFunctionSigmoidDescriptor(SigmoidDescriptorAction), options); - } - else if (SigmoidValue is not null) - { - writer.WritePropertyName("sigmoid"); - JsonSerializer.Serialize(writer, SigmoidValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs index 4d47a0cbec5..ab93b14e809 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RegexpQuery.g.cs @@ -17,141 +17,153 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class RegexpQueryConverter : JsonConverter +internal sealed partial class RegexpQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override RegexpQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCaseInsensitive = System.Text.Json.JsonEncodedText.Encode("case_insensitive"); + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropMaxDeterminizedStates = System.Text.Json.JsonEncodedText.Encode("max_determinized_states"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new RegexpQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "case_insensitive") - { - variant.CaseInsensitive = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "flags") - { - variant.Flags = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_determinized_states") - { - variant.MaxDeterminizedStates = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rewrite") - { - variant.Rewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Value = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, RegexpQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize RegexpQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCaseInsensitive = default; + LocalJsonValue propFlags = default; + LocalJsonValue propMaxDeterminizedStates = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.CaseInsensitive.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(value.CaseInsensitive.Value); - } + if (propCaseInsensitive.TryReadProperty(ref reader, options, PropCaseInsensitive, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Flags)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(value.Flags); - } + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } - if (value.MaxDeterminizedStates.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(value.MaxDeterminizedStates.Value); - } + if (propMaxDeterminizedStates.TryReadProperty(ref reader, options, PropMaxDeterminizedStates, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.Rewrite)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(value.Rewrite); - } + Boost = propBoost.Value, + CaseInsensitive = propCaseInsensitive.Value, + Field = propField.Value, + Flags = propFlags.Value, + MaxDeterminizedStates = propMaxDeterminizedStates.Value, + QueryName = propQueryName.Value, + Rewrite = propRewrite.Value, + Value = propValue.Value + }; + } - writer.WritePropertyName("value"); - writer.WriteStringValue(value.Value); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCaseInsensitive, value.CaseInsensitive, null, null); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropMaxDeterminizedStates, value.MaxDeterminizedStates, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(RegexpQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryConverter))] public sealed partial class RegexpQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public RegexpQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexpQuery(Elastic.Clients.Elasticsearch.Field field, string value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public RegexpQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -169,7 +181,11 @@ public RegexpQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public bool? CaseInsensitive { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -198,27 +214,31 @@ public RegexpQuery(Elastic.Clients.Elasticsearch.Field field) /// Regular expression for terms you wish to find in the provided field. /// /// - public string Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(RegexpQuery regexpQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Regexp(regexpQuery); + public +#if NET7_0_OR_GREATER + required +#endif + string Value { get; set; } } -public sealed partial class RegexpQueryDescriptor : SerializableDescriptor> +public readonly partial struct RegexpQueryDescriptor { - internal RegexpQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexpQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery instance) + { + Instance = instance; + } - public RegexpQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexpQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FlagsValue { get; set; } - private int? MaxDeterminizedStatesValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string ValueValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -228,10 +248,10 @@ public RegexpQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RegexpQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -240,28 +260,22 @@ public RegexpQueryDescriptor Boost(float? boost) /// When false, case sensitivity of matching depends on the underlying field’s mapping. /// /// - public RegexpQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public RegexpQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public RegexpQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RegexpQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -269,10 +283,10 @@ public RegexpQueryDescriptor Field(Expression /// Enables optional operators for the regular expression. /// /// - public RegexpQueryDescriptor Flags(string? flags) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Flags(string? value) { - FlagsValue = flags; - return Self; + Instance.Flags = value; + return this; } /// @@ -280,16 +294,16 @@ public RegexpQueryDescriptor Flags(string? flags) /// Maximum number of automaton states required for the query. /// /// - public RegexpQueryDescriptor MaxDeterminizedStates(int? maxDeterminizedStates) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor MaxDeterminizedStates(int? value) { - MaxDeterminizedStatesValue = maxDeterminizedStates; - return Self; + Instance.MaxDeterminizedStates = value; + return this; } - public RegexpQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -297,10 +311,10 @@ public RegexpQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public RegexpQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -308,78 +322,39 @@ public RegexpQueryDescriptor Rewrite(string? rewrite) /// Regular expression for terms you wish to find in the provided field. /// /// - public RegexpQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Value(string value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } - - if (MaxDeterminizedStatesValue.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(MaxDeterminizedStatesValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RegexpQueryDescriptor : SerializableDescriptor +public readonly partial struct RegexpQueryDescriptor { - internal RegexpQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexpQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery instance) + { + Instance = instance; + } - public RegexpQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RegexpQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FlagsValue { get; set; } - private int? MaxDeterminizedStatesValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string ValueValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -389,10 +364,10 @@ public RegexpQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RegexpQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -401,28 +376,22 @@ public RegexpQueryDescriptor Boost(float? boost) /// When false, case sensitivity of matching depends on the underlying field’s mapping. /// /// - public RegexpQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor CaseInsensitive(bool? value = true) { - CaseInsensitiveValue = caseInsensitive; - return Self; + Instance.CaseInsensitive = value; + return this; } - public RegexpQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public RegexpQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public RegexpQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -430,10 +399,10 @@ public RegexpQueryDescriptor Field(Expression /// Enables optional operators for the regular expression. /// /// - public RegexpQueryDescriptor Flags(string? flags) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Flags(string? value) { - FlagsValue = flags; - return Self; + Instance.Flags = value; + return this; } /// @@ -441,16 +410,16 @@ public RegexpQueryDescriptor Flags(string? flags) /// Maximum number of automaton states required for the query. /// /// - public RegexpQueryDescriptor MaxDeterminizedStates(int? maxDeterminizedStates) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor MaxDeterminizedStates(int? value) { - MaxDeterminizedStatesValue = maxDeterminizedStates; - return Self; + Instance.MaxDeterminizedStates = value; + return this; } - public RegexpQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -458,10 +427,10 @@ public RegexpQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public RegexpQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -469,58 +438,17 @@ public RegexpQueryDescriptor Rewrite(string? rewrite) /// Regular expression for terms you wish to find in the provided field. /// /// - public RegexpQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor Value(string value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(FlagsValue)) - { - writer.WritePropertyName("flags"); - writer.WriteStringValue(FlagsValue); - } - - if (MaxDeterminizedStatesValue.HasValue) - { - writer.WritePropertyName("max_determinized_states"); - writer.WriteNumberValue(MaxDeterminizedStatesValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RuleQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RuleQuery.g.cs index 36f59b913f3..0c3c74d149f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RuleQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RuleQuery.g.cs @@ -17,18 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class RuleQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropMatchCriteria = System.Text.Json.JsonEncodedText.Encode("match_criteria"); + private static readonly System.Text.Json.JsonEncodedText PropOrganic = System.Text.Json.JsonEncodedText.Encode("organic"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRulesetIds = System.Text.Json.JsonEncodedText.Encode("ruleset_ids"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propMatchCriteria = default; + LocalJsonValue propOrganic = default; + LocalJsonValue propQueryName = default; + LocalJsonValue> propRulesetIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propMatchCriteria.TryReadProperty(ref reader, options, PropMatchCriteria, null)) + { + continue; + } + + if (propOrganic.TryReadProperty(ref reader, options, PropOrganic, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propRulesetIds.TryReadProperty(ref reader, options, PropRulesetIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + MatchCriteria = propMatchCriteria.Value, + Organic = propOrganic.Value, + QueryName = propQueryName.Value, + RulesetIds = propRulesetIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropMatchCriteria, value.MatchCriteria, null, null); + writer.WriteProperty(options, PropOrganic, value.Organic, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRulesetIds, value.RulesetIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryConverter))] public sealed partial class RuleQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleQuery(object matchCriteria, Elastic.Clients.Elasticsearch.QueryDsl.Query organic, System.Collections.Generic.ICollection rulesetIds) + { + MatchCriteria = matchCriteria; + Organic = organic; + RulesetIds = rulesetIds; + } +#if NET7_0_OR_GREATER + public RuleQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuleQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,35 +133,43 @@ public sealed partial class RuleQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("match_criteria")] - public object MatchCriteria { get; set; } - [JsonInclude, JsonPropertyName("organic")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Organic { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + object MatchCriteria { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Organic { get; set; } public string? QueryName { get; set; } - [JsonInclude, JsonPropertyName("ruleset_ids")] - public ICollection RulesetIds { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(RuleQuery ruleQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Rule(ruleQuery); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection RulesetIds { get; set; } } -public sealed partial class RuleQueryDescriptor : SerializableDescriptor> +public readonly partial struct RuleQueryDescriptor { - internal RuleQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery instance) + { + Instance = instance; + } - public RuleQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private object MatchCriteriaValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query OrganicValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor OrganicDescriptor { get; set; } - private Action> OrganicDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private ICollection RulesetIdsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -75,108 +179,75 @@ public RuleQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RuleQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public RuleQueryDescriptor MatchCriteria(object matchCriteria) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor MatchCriteria(object value) { - MatchCriteriaValue = matchCriteria; - return Self; + Instance.MatchCriteria = value; + return this; } - public RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query organic) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - OrganicDescriptor = null; - OrganicDescriptorAction = null; - OrganicValue = organic; - return Self; + Instance.Organic = value; + return this; } - public RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Organic(System.Action> action) { - OrganicValue = null; - OrganicDescriptorAction = null; - OrganicDescriptor = descriptor; - return Self; + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RuleQueryDescriptor Organic(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor QueryName(string? value) { - OrganicValue = null; - OrganicDescriptor = null; - OrganicDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public RuleQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor RulesetIds(System.Collections.Generic.ICollection value) { - QueryNameValue = queryName; - return Self; + Instance.RulesetIds = value; + return this; } - public RuleQueryDescriptor RulesetIds(ICollection rulesetIds) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor RulesetIds(params Elastic.Clients.Elasticsearch.Id[] values) { - RulesetIdsValue = rulesetIds; - return Self; + Instance.RulesetIds = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("match_criteria"); - JsonSerializer.Serialize(writer, MatchCriteriaValue, options); - if (OrganicDescriptor is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicDescriptor, options); - } - else if (OrganicDescriptorAction is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(OrganicDescriptorAction), options); - } - else - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("ruleset_ids"); - JsonSerializer.Serialize(writer, RulesetIdsValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RuleQueryDescriptor : SerializableDescriptor +public readonly partial struct RuleQueryDescriptor { - internal RuleQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery instance) + { + Instance = instance; + } - public RuleQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private object MatchCriteriaValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query OrganicValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor OrganicDescriptor { get; set; } - private Action OrganicDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private ICollection RulesetIdsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -186,89 +257,59 @@ public RuleQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public RuleQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public RuleQueryDescriptor MatchCriteria(object matchCriteria) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor MatchCriteria(object value) { - MatchCriteriaValue = matchCriteria; - return Self; + Instance.MatchCriteria = value; + return this; } - public RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query organic) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - OrganicDescriptor = null; - OrganicDescriptorAction = null; - OrganicValue = organic; - return Self; + Instance.Organic = value; + return this; } - public RuleQueryDescriptor Organic(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Organic(System.Action action) { - OrganicValue = null; - OrganicDescriptorAction = null; - OrganicDescriptor = descriptor; - return Self; + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RuleQueryDescriptor Organic(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor Organic(System.Action> action) { - OrganicValue = null; - OrganicDescriptor = null; - OrganicDescriptorAction = configure; - return Self; + Instance.Organic = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public RuleQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public RuleQueryDescriptor RulesetIds(ICollection rulesetIds) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor RulesetIds(System.Collections.Generic.ICollection value) { - RulesetIdsValue = rulesetIds; - return Self; + Instance.RulesetIds = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor RulesetIds(params Elastic.Clients.Elasticsearch.Id[] values) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("match_criteria"); - JsonSerializer.Serialize(writer, MatchCriteriaValue, options); - if (OrganicDescriptor is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicDescriptor, options); - } - else if (OrganicDescriptorAction is not null) - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(OrganicDescriptorAction), options); - } - else - { - writer.WritePropertyName("organic"); - JsonSerializer.Serialize(writer, OrganicValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + Instance.RulesetIds = [.. values]; + return this; + } - writer.WritePropertyName("ruleset_ids"); - JsonSerializer.Serialize(writer, RulesetIdsValue, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.RuleQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.RuleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptQuery.g.cs index 1e152a3caae..02c477b11fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ScriptQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + QueryName = propQueryName.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryConverter))] public sealed partial class ScriptQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptQuery(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,9 +113,7 @@ public sealed partial class ScriptQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -48,25 +122,31 @@ public sealed partial class ScriptQuery /// This script must return a boolean value, true or false. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ScriptQuery scriptQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Script(scriptQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class ScriptQueryDescriptor : SerializableDescriptor +public readonly partial struct ScriptQueryDescriptor { - internal ScriptQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery Instance { get; init; } - public ScriptQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -76,16 +156,16 @@ public ScriptQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ScriptQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public ScriptQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -94,61 +174,41 @@ public ScriptQueryDescriptor QueryName(string? queryName) /// This script must return a boolean value, true or false. /// /// - public ScriptQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScriptQueryDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Contains a script to run as a query. + /// This script must return a boolean value, true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptQueryDescriptor Script(Action configure) + /// + /// + /// Contains a script to run as a query. + /// This script must return a boolean value, true or false. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreFunction.g.cs index a6df27b8a0b..3bd5be19dc1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreFunction.g.cs @@ -17,89 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ScriptScoreFunctionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionConverter))] public sealed partial class ScriptScoreFunction { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreFunction(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptScoreFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptScoreFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A script that computes a score. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore(ScriptScoreFunction scriptScoreFunction) => Elastic.Clients.Elasticsearch.QueryDsl.FunctionScore.ScriptScore(scriptScoreFunction); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class ScriptScoreFunctionDescriptor : SerializableDescriptor +public readonly partial struct ScriptScoreFunctionDescriptor { - internal ScriptScoreFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction Instance { get; init; } - public ScriptScoreFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreFunctionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor descriptor) => descriptor.Instance; /// /// /// A script that computes a score. /// /// - public ScriptScoreFunctionDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScriptScoreFunctionDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// A script that computes a score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptScoreFunctionDescriptor Script(Action configure) + /// + /// + /// A script that computes a score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction Build(System.Action action) { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreQuery.g.cs index 351a940d4f8..6aee73013f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ScriptScoreQuery.g.cs @@ -17,18 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ScriptScoreQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + MinScore = propMinScore.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryConverter))] public sealed partial class ScriptScoreQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query query, Elastic.Clients.Elasticsearch.Script script) + { + Query = query; + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptScoreQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptScoreQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +132,6 @@ public sealed partial class ScriptScoreQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,7 +139,6 @@ public sealed partial class ScriptScoreQuery /// Documents with a score lower than this floating point number are excluded from the search results. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -53,9 +146,11 @@ public sealed partial class ScriptScoreQuery /// Query used to return documents. /// /// - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Query { get; set; } public string? QueryName { get; set; } /// @@ -64,29 +159,31 @@ public sealed partial class ScriptScoreQuery /// Important: final relevance scores from the script_score query cannot be negative. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ScriptScoreQuery scriptScoreQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.ScriptScore(scriptScoreQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class ScriptScoreQueryDescriptor : SerializableDescriptor> +public readonly partial struct ScriptScoreQueryDescriptor { - internal ScriptScoreQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery instance) + { + Instance = instance; + } - public ScriptScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private float? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,10 +193,10 @@ public ScriptScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ScriptScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -107,10 +204,10 @@ public ScriptScoreQueryDescriptor Boost(float? boost) /// Documents with a score lower than this floating point number are excluded from the search results. /// /// - public ScriptScoreQueryDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -118,34 +215,39 @@ public ScriptScoreQueryDescriptor MinScore(float? minScore) /// Query used to return documents. /// /// - public ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to return documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ScriptScoreQueryDescriptor Query(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor QueryName(string? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public ScriptScoreQueryDescriptor QueryName(string? queryName) + /// + /// + /// Script used to compute the score of documents returned by the query. + /// Important: final relevance scores from the script_score query cannot be negative. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - QueryNameValue = queryName; - return Self; + Instance.Script = value; + return this; } /// @@ -154,104 +256,51 @@ public ScriptScoreQueryDescriptor QueryName(string? queryName) /// Important: final relevance scores from the script_score query cannot be negative. /// /// - public ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script() { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Script used to compute the score of documents returned by the query. + /// Important: final relevance scores from the script_score query cannot be negative. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ScriptScoreQueryDescriptor Script(Action configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery Build(System.Action> action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ScriptScoreQueryDescriptor : SerializableDescriptor +public readonly partial struct ScriptScoreQueryDescriptor { - internal ScriptScoreQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery Instance { get; init; } - public ScriptScoreQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private float? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptScoreQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -261,10 +310,10 @@ public ScriptScoreQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ScriptScoreQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -272,10 +321,10 @@ public ScriptScoreQueryDescriptor Boost(float? boost) /// Documents with a score lower than this floating point number are excluded from the search results. /// /// - public ScriptScoreQueryDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -283,34 +332,38 @@ public ScriptScoreQueryDescriptor MinScore(float? minScore) /// Query used to return documents. /// /// - public ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query query) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public ScriptScoreQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query used to return documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ScriptScoreQueryDescriptor Query(Action configure) + /// + /// + /// Query used to return documents. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public ScriptScoreQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -319,83 +372,41 @@ public ScriptScoreQueryDescriptor QueryName(string? queryName) /// Important: final relevance scores from the script_score query cannot be negative. /// /// - public ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScriptScoreQueryDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Script used to compute the score of documents returned by the query. + /// Important: final relevance scores from the script_score query cannot be negative. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptScoreQueryDescriptor Script(Action configure) + /// + /// + /// Script used to compute the score of documents returned by the query. + /// Important: final relevance scores from the script_score query cannot be negative. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SemanticQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SemanticQuery.g.cs index a3d088ca0c8..1baa42a0d02 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SemanticQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SemanticQuery.g.cs @@ -17,18 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SemanticQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryConverter))] public sealed partial class SemanticQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticQuery(string field, string query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public SemanticQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SemanticQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SemanticQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +123,6 @@ public sealed partial class SemanticQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,34 +130,43 @@ public sealed partial class SemanticQuery /// The field to query, which must be a semantic_text field type /// /// - [JsonInclude, JsonPropertyName("field")] - public string Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Field { get; set; } /// /// /// The query text /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SemanticQuery semanticQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Semantic(semanticQuery); } -public sealed partial class SemanticQueryDescriptor : SerializableDescriptor +public readonly partial struct SemanticQueryDescriptor { - internal SemanticQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery Instance { get; init; } - public SemanticQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private string FieldValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SemanticQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery(Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -82,10 +176,10 @@ public SemanticQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SemanticQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -93,10 +187,10 @@ public SemanticQueryDescriptor Boost(float? boost) /// The field to query, which must be a semantic_text field type /// /// - public SemanticQueryDescriptor Field(string field) + public Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor Field(string value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -104,37 +198,23 @@ public SemanticQueryDescriptor Field(string field) /// The query text /// /// - public SemanticQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SemanticQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SemanticQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SemanticQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeFieldQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeFieldQuery.g.cs index 1b2ce8fb269..511c29975d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeFieldQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeFieldQuery.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class ShapeFieldQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndexedShape = System.Text.Json.JsonEncodedText.Encode("indexed_shape"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropShape = System.Text.Json.JsonEncodedText.Encode("shape"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndexedShape = default; + LocalJsonValue propRelation = default; + LocalJsonValue propShape = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndexedShape.TryReadProperty(ref reader, options, PropIndexedShape, null)) + { + continue; + } + + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propShape.TryReadProperty(ref reader, options, PropShape, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndexedShape = propIndexedShape.Value, + Relation = propRelation.Value, + Shape = propShape.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndexedShape, value.IndexedShape, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropShape, value.Shape, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryConverter))] public sealed partial class ShapeFieldQuery { +#if NET7_0_OR_GREATER + public ShapeFieldQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public ShapeFieldQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Queries using a pre-indexed shape. /// /// - [JsonInclude, JsonPropertyName("indexed_shape")] public Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShape { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class ShapeFieldQuery /// Spatial relation between the query shape and the document shape. /// /// - [JsonInclude, JsonPropertyName("relation")] public Elastic.Clients.Elasticsearch.GeoShapeRelation? Relation { get; set; } /// @@ -50,51 +118,48 @@ public sealed partial class ShapeFieldQuery /// Queries using an inline shape definition in GeoJSON or Well Known Text (WKT) format. /// /// - [JsonInclude, JsonPropertyName("shape")] public object? Shape { get; set; } } -public sealed partial class ShapeFieldQueryDescriptor : SerializableDescriptor> +public readonly partial struct ShapeFieldQueryDescriptor { - internal ShapeFieldQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Instance { get; init; } - public ShapeFieldQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor IndexedShapeDescriptor { get; set; } - private Action> IndexedShapeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? RelationValue { get; set; } - private object? ShapeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeFieldQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Queries using a pre-indexed shape. /// /// - public ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? indexedShape) - { - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = null; - IndexedShapeValue = indexedShape; - return Self; - } - - public ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? value) { - IndexedShapeValue = null; - IndexedShapeDescriptorAction = null; - IndexedShapeDescriptor = descriptor; - return Self; + Instance.IndexedShape = value; + return this; } - public ShapeFieldQueryDescriptor IndexedShape(Action> configure) + /// + /// + /// Queries using a pre-indexed shape. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor IndexedShape(System.Action> action) { - IndexedShapeValue = null; - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = configure; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } /// @@ -102,10 +167,10 @@ public ShapeFieldQueryDescriptor IndexedShape(Action /// - public ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -113,88 +178,76 @@ public ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsear /// Queries using an inline shape definition in GeoJSON or Well Known Text (WKT) format. /// /// - public ShapeFieldQueryDescriptor Shape(object? shape) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor Shape(object? value) { - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Build(System.Action>? action) { - writer.WriteStartObject(); - if (IndexedShapeDescriptor is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeDescriptor, options); - } - else if (IndexedShapeDescriptorAction is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(IndexedShapeDescriptorAction), options); - } - else if (IndexedShapeValue is not null) + if (action is null) { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (ShapeValue is not null) - { - writer.WritePropertyName("shape"); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ShapeFieldQueryDescriptor : SerializableDescriptor +public readonly partial struct ShapeFieldQueryDescriptor { - internal ShapeFieldQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Instance { get; init; } - public ShapeFieldQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? IndexedShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor IndexedShapeDescriptor { get; set; } - private Action IndexedShapeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.GeoShapeRelation? RelationValue { get; set; } - private object? ShapeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeFieldQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Queries using a pre-indexed shape. /// /// - public ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? indexedShape) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookup? value) { - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = null; - IndexedShapeValue = indexedShape; - return Self; + Instance.IndexedShape = value; + return this; } - public ShapeFieldQueryDescriptor IndexedShape(Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor descriptor) + /// + /// + /// Queries using a pre-indexed shape. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor IndexedShape(System.Action action) { - IndexedShapeValue = null; - IndexedShapeDescriptorAction = null; - IndexedShapeDescriptor = descriptor; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } - public ShapeFieldQueryDescriptor IndexedShape(Action configure) + /// + /// + /// Queries using a pre-indexed shape. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor IndexedShape(System.Action> action) { - IndexedShapeValue = null; - IndexedShapeDescriptor = null; - IndexedShapeDescriptorAction = configure; - return Self; + Instance.IndexedShape = Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor.Build(action); + return this; } /// @@ -202,10 +255,10 @@ public ShapeFieldQueryDescriptor IndexedShape(Action /// - public ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShapeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -213,43 +266,22 @@ public ShapeFieldQueryDescriptor Relation(Elastic.Clients.Elasticsearch.GeoShape /// Queries using an inline shape definition in GeoJSON or Well Known Text (WKT) format. /// /// - public ShapeFieldQueryDescriptor Shape(object? shape) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor Shape(object? value) { - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexedShapeDescriptor is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeDescriptor, options); - } - else if (IndexedShapeDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.FieldLookupDescriptor(IndexedShapeDescriptorAction), options); - } - else if (IndexedShapeValue is not null) - { - writer.WritePropertyName("indexed_shape"); - JsonSerializer.Serialize(writer, IndexedShapeValue, options); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); + return new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (ShapeValue is not null) - { - writer.WritePropertyName("shape"); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs index 9b313e9a20a..476ab5d1838 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ShapeQuery.g.cs @@ -17,95 +17,95 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class ShapeQueryConverter : JsonConverter +internal sealed partial class ShapeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override ShapeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnmapped = System.Text.Json.JsonEncodedText.Encode("ignore_unmapped"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new ShapeQuery(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propIgnoreUnmapped = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propShape = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignore_unmapped") - { - variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Shape = JsonSerializer.Deserialize(ref reader, options); + continue; } - } - return variant; - } - - public override void Write(Utf8JsonWriter writer, ShapeQuery value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.Shape is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propIgnoreUnmapped.TryReadProperty(ref reader, options, PropIgnoreUnmapped, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Shape, options); - } - - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.IgnoreUnmapped.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(value.IgnoreUnmapped.Value); + propField.Initialized = propShape.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propShape.Value, null, null); } - if (!string.IsNullOrEmpty(value.QueryName)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + Boost = propBoost.Value, + Field = propField.Value, + IgnoreUnmapped = propIgnoreUnmapped.Value, + QueryName = propQueryName.Value, + Shape = propShape.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropIgnoreUnmapped, value.IgnoreUnmapped, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, value.Field, value.Shape, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(ShapeQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryConverter))] public sealed partial class ShapeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery shape) + { + Field = field; + Shape = shape; + } +#if NET7_0_OR_GREATER + public ShapeQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShapeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -115,7 +115,11 @@ public sealed partial class ShapeQuery /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -124,26 +128,31 @@ public sealed partial class ShapeQuery /// public bool? IgnoreUnmapped { get; set; } public string? QueryName { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Shape { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ShapeQuery shapeQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Shape(shapeQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery Shape { get; set; } } -public sealed partial class ShapeQueryDescriptor : SerializableDescriptor> +public readonly partial struct ShapeQueryDescriptor { - internal ShapeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery Instance { get; init; } - public ShapeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery ShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor ShapeDescriptor { get; set; } - private Action> ShapeDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -153,28 +162,22 @@ public ShapeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ShapeQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public ShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public ShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -182,89 +185,63 @@ public ShapeQueryDescriptor Field(Expression> /// When set to true the query ignores an unmapped field and will not match any documents. /// /// - public ShapeQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public ShapeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery shape) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery value) { - ShapeDescriptor = null; - ShapeDescriptorAction = null; - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - public ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape() { - ShapeValue = null; - ShapeDescriptorAction = null; - ShapeDescriptor = descriptor; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor.Build(null); + return this; } - public ShapeQueryDescriptor Shape(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape(System.Action>? action) { - ShapeValue = null; - ShapeDescriptor = null; - ShapeDescriptorAction = configure; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null && ShapeValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ShapeQueryDescriptor : SerializableDescriptor +public readonly partial struct ShapeQueryDescriptor { - internal ShapeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery Instance { get; init; } - public ShapeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? IgnoreUnmappedValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery ShapeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor ShapeDescriptor { get; set; } - private Action ShapeDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShapeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -274,28 +251,22 @@ public ShapeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public ShapeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public ShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public ShapeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public ShapeQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -303,70 +274,47 @@ public ShapeQueryDescriptor Field(Expression> /// When set to true the query ignores an unmapped field and will not match any documents. /// /// - public ShapeQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor IgnoreUnmapped(bool? value = true) { - IgnoreUnmappedValue = ignoreUnmapped; - return Self; + Instance.IgnoreUnmapped = value; + return this; } - public ShapeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery shape) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQuery value) { - ShapeDescriptor = null; - ShapeDescriptorAction = null; - ShapeValue = shape; - return Self; + Instance.Shape = value; + return this; } - public ShapeQueryDescriptor Shape(Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape() { - ShapeValue = null; - ShapeDescriptorAction = null; - ShapeDescriptor = descriptor; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor.Build(null); + return this; } - public ShapeQueryDescriptor Shape(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape(System.Action? action) { - ShapeValue = null; - ShapeDescriptor = null; - ShapeDescriptorAction = configure; - return Self; + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor Shape(System.Action>? action) { - writer.WriteStartObject(); - if (FieldValue is not null && ShapeValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, ShapeValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (IgnoreUnmappedValue.HasValue) - { - writer.WritePropertyName("ignore_unmapped"); - writer.WriteBooleanValue(IgnoreUnmappedValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + Instance.Shape = Elastic.Clients.Elasticsearch.QueryDsl.ShapeFieldQueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.ShapeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs index 14e77720775..79131858d88 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs @@ -17,24 +17,207 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SimpleQueryStringQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyzer = System.Text.Json.JsonEncodedText.Encode("analyzer"); + private static readonly System.Text.Json.JsonEncodedText PropAnalyzeWildcard = System.Text.Json.JsonEncodedText.Encode("analyze_wildcard"); + private static readonly System.Text.Json.JsonEncodedText PropAutoGenerateSynonymsPhraseQuery = System.Text.Json.JsonEncodedText.Encode("auto_generate_synonyms_phrase_query"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDefaultOperator = System.Text.Json.JsonEncodedText.Encode("default_operator"); + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropFlags = System.Text.Json.JsonEncodedText.Encode("flags"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyMaxExpansions = System.Text.Json.JsonEncodedText.Encode("fuzzy_max_expansions"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyPrefixLength = System.Text.Json.JsonEncodedText.Encode("fuzzy_prefix_length"); + private static readonly System.Text.Json.JsonEncodedText PropFuzzyTranspositions = System.Text.Json.JsonEncodedText.Encode("fuzzy_transpositions"); + private static readonly System.Text.Json.JsonEncodedText PropLenient = System.Text.Json.JsonEncodedText.Encode("lenient"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropQuoteFieldSuffix = System.Text.Json.JsonEncodedText.Encode("quote_field_suffix"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyzer = default; + LocalJsonValue propAnalyzeWildcard = default; + LocalJsonValue propAutoGenerateSynonymsPhraseQuery = default; + LocalJsonValue propBoost = default; + LocalJsonValue propDefaultOperator = default; + LocalJsonValue propFields = default; + LocalJsonValue propFlags = default; + LocalJsonValue propFuzzyMaxExpansions = default; + LocalJsonValue propFuzzyPrefixLength = default; + LocalJsonValue propFuzzyTranspositions = default; + LocalJsonValue propLenient = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propQuoteFieldSuffix = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyzer.TryReadProperty(ref reader, options, PropAnalyzer, null)) + { + continue; + } + + if (propAnalyzeWildcard.TryReadProperty(ref reader, options, PropAnalyzeWildcard, null)) + { + continue; + } + + if (propAutoGenerateSynonymsPhraseQuery.TryReadProperty(ref reader, options, PropAutoGenerateSynonymsPhraseQuery, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propDefaultOperator.TryReadProperty(ref reader, options, PropDefaultOperator, null)) + { + continue; + } + + if (propFields.TryReadProperty(ref reader, options, PropFields, null)) + { + continue; + } + + if (propFlags.TryReadProperty(ref reader, options, PropFlags, null)) + { + continue; + } + + if (propFuzzyMaxExpansions.TryReadProperty(ref reader, options, PropFuzzyMaxExpansions, null)) + { + continue; + } + + if (propFuzzyPrefixLength.TryReadProperty(ref reader, options, PropFuzzyPrefixLength, null)) + { + continue; + } + + if (propFuzzyTranspositions.TryReadProperty(ref reader, options, PropFuzzyTranspositions, null)) + { + continue; + } + + if (propLenient.TryReadProperty(ref reader, options, PropLenient, null)) + { + continue; + } + + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propQuoteFieldSuffix.TryReadProperty(ref reader, options, PropQuoteFieldSuffix, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Analyzer = propAnalyzer.Value, + AnalyzeWildcard = propAnalyzeWildcard.Value, + AutoGenerateSynonymsPhraseQuery = propAutoGenerateSynonymsPhraseQuery.Value, + Boost = propBoost.Value, + DefaultOperator = propDefaultOperator.Value, + Fields = propFields.Value, + Flags = propFlags.Value, + FuzzyMaxExpansions = propFuzzyMaxExpansions.Value, + FuzzyPrefixLength = propFuzzyPrefixLength.Value, + FuzzyTranspositions = propFuzzyTranspositions.Value, + Lenient = propLenient.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value, + QuoteFieldSuffix = propQuoteFieldSuffix.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyzer, value.Analyzer, null, null); + writer.WriteProperty(options, PropAnalyzeWildcard, value.AnalyzeWildcard, null, null); + writer.WriteProperty(options, PropAutoGenerateSynonymsPhraseQuery, value.AutoGenerateSynonymsPhraseQuery, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDefaultOperator, value.DefaultOperator, null, null); + writer.WriteProperty(options, PropFields, value.Fields, null, null); + writer.WriteProperty(options, PropFlags, value.Flags, null, null); + writer.WriteProperty(options, PropFuzzyMaxExpansions, value.FuzzyMaxExpansions, null, null); + writer.WriteProperty(options, PropFuzzyPrefixLength, value.FuzzyPrefixLength, null, null); + writer.WriteProperty(options, PropFuzzyTranspositions, value.FuzzyTranspositions, null, null); + writer.WriteProperty(options, PropLenient, value.Lenient, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropQuoteFieldSuffix, value.QuoteFieldSuffix, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryConverter))] public sealed partial class SimpleQueryStringQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleQueryStringQuery(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public SimpleQueryStringQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SimpleQueryStringQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Analyzer used to convert text in the query string into tokens. /// /// - [JsonInclude, JsonPropertyName("analyzer")] public string? Analyzer { get; set; } /// @@ -42,7 +225,6 @@ public sealed partial class SimpleQueryStringQuery /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - [JsonInclude, JsonPropertyName("analyze_wildcard")] public bool? AnalyzeWildcard { get; set; } /// @@ -50,7 +232,6 @@ public sealed partial class SimpleQueryStringQuery /// If true, the parser creates a match_phrase query for each multi-position token. /// /// - [JsonInclude, JsonPropertyName("auto_generate_synonyms_phrase_query")] public bool? AutoGenerateSynonymsPhraseQuery { get; set; } /// @@ -61,7 +242,6 @@ public sealed partial class SimpleQueryStringQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -69,7 +249,6 @@ public sealed partial class SimpleQueryStringQuery /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - [JsonInclude, JsonPropertyName("default_operator")] public Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperator { get; set; } /// @@ -80,8 +259,6 @@ public sealed partial class SimpleQueryStringQuery /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(FieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Fields { get; set; } /// @@ -89,15 +266,13 @@ public sealed partial class SimpleQueryStringQuery /// List of enabled operators for the simple query string syntax. /// /// - [JsonInclude, JsonPropertyName("flags")] - public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlag? Flags { get; set; } + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags? Flags { get; set; } /// /// /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("fuzzy_max_expansions")] public int? FuzzyMaxExpansions { get; set; } /// @@ -105,7 +280,6 @@ public sealed partial class SimpleQueryStringQuery /// Number of beginning characters left unchanged for fuzzy matching. /// /// - [JsonInclude, JsonPropertyName("fuzzy_prefix_length")] public int? FuzzyPrefixLength { get; set; } /// @@ -113,7 +287,6 @@ public sealed partial class SimpleQueryStringQuery /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - [JsonInclude, JsonPropertyName("fuzzy_transpositions")] public bool? FuzzyTranspositions { get; set; } /// @@ -121,7 +294,6 @@ public sealed partial class SimpleQueryStringQuery /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - [JsonInclude, JsonPropertyName("lenient")] public bool? Lenient { get; set; } /// @@ -129,7 +301,6 @@ public sealed partial class SimpleQueryStringQuery /// Minimum number of clauses that must match for a document to be returned. /// /// - [JsonInclude, JsonPropertyName("minimum_should_match")] public Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatch { get; set; } /// @@ -137,9 +308,11 @@ public sealed partial class SimpleQueryStringQuery /// Query string in the simple query string syntax you wish to parse and use for search. /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } /// @@ -147,48 +320,37 @@ public sealed partial class SimpleQueryStringQuery /// Suffix appended to quoted text in the query string. /// /// - [JsonInclude, JsonPropertyName("quote_field_suffix")] public string? QuoteFieldSuffix { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SimpleQueryString(simpleQueryStringQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.SimpleQueryString(simpleQueryStringQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.SimpleQueryString(simpleQueryStringQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.SimpleQueryString(simpleQueryStringQuery); } -public sealed partial class SimpleQueryStringQueryDescriptor : SerializableDescriptor> +public readonly partial struct SimpleQueryStringQueryDescriptor { - internal SimpleQueryStringQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery Instance { get; init; } - public SimpleQueryStringQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleQueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery instance) { + Instance = instance; } - private string? AnalyzerValue { get; set; } - private bool? AnalyzeWildcardValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperatorValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlag? FlagsValue { get; set; } - private int? FuzzyMaxExpansionsValue { get; set; } - private int? FuzzyPrefixLengthValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private string? QuoteFieldSuffixValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleQueryStringQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert text in the query string into tokens. /// /// - public SimpleQueryStringQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -196,10 +358,10 @@ public SimpleQueryStringQueryDescriptor Analyzer(string? analyzer) /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - public SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? value = true) { - AnalyzeWildcardValue = analyzeWildcard; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// @@ -207,10 +369,10 @@ public SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? analyze /// If true, the parser creates a match_phrase query for each multi-position token. /// /// - public SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -221,10 +383,10 @@ public SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQue /// A value greater than 1.0 increases the relevance score. /// /// - public SimpleQueryStringQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -232,10 +394,24 @@ public SimpleQueryStringQueryDescriptor Boost(float? boost) /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - public SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) + { + Instance.DefaultOperator = value; + return this; + } + + /// + /// + /// Array of fields you wish to search. + /// Accepts wildcard expressions. + /// You also can boost relevance scores for matches to particular fields using a caret (^) notation. + /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - DefaultOperatorValue = defaultOperator; - return Self; + Instance.Fields = value; + return this; } /// @@ -246,10 +422,10 @@ public SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clien /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -257,10 +433,10 @@ public SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasti /// List of enabled operators for the simple query string syntax. /// /// - public SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlag? flags) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags? value) { - FlagsValue = flags; - return Self; + Instance.Flags = value; + return this; } /// @@ -268,10 +444,10 @@ public SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elastic /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - public SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? value) { - FuzzyMaxExpansionsValue = fuzzyMaxExpansions; - return Self; + Instance.FuzzyMaxExpansions = value; + return this; } /// @@ -279,10 +455,10 @@ public SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzy /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? value) { - FuzzyPrefixLengthValue = fuzzyPrefixLength; - return Self; + Instance.FuzzyPrefixLength = value; + return this; } /// @@ -290,10 +466,10 @@ public SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyP /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -301,10 +477,10 @@ public SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? fuz /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - public SimpleQueryStringQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -312,10 +488,10 @@ public SimpleQueryStringQueryDescriptor Lenient(bool? lenient = true) /// Minimum number of clauses that must match for a document to be returned. /// /// - public SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -323,16 +499,16 @@ public SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Cl /// Query string in the simple query string syntax you wish to parse and use for search. /// /// - public SimpleQueryStringQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SimpleQueryStringQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -340,138 +516,49 @@ public SimpleQueryStringQueryDescriptor QueryName(string? queryName) /// Suffix appended to quoted text in the query string. /// /// - public SimpleQueryStringQueryDescriptor QuoteFieldSuffix(string? quoteFieldSuffix) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor QuoteFieldSuffix(string? value) { - QuoteFieldSuffixValue = quoteFieldSuffix; - return Self; + Instance.QuoteFieldSuffix = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AnalyzeWildcardValue.HasValue) - { - writer.WritePropertyName("analyze_wildcard"); - writer.WriteBooleanValue(AnalyzeWildcardValue.Value); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DefaultOperatorValue is not null) - { - writer.WritePropertyName("default_operator"); - JsonSerializer.Serialize(writer, DefaultOperatorValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FlagsValue is not null) - { - writer.WritePropertyName("flags"); - JsonSerializer.Serialize(writer, FlagsValue, options); - } - - if (FuzzyMaxExpansionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_max_expansions"); - writer.WriteNumberValue(FuzzyMaxExpansionsValue.Value); - } - - if (FuzzyPrefixLengthValue.HasValue) - { - writer.WritePropertyName("fuzzy_prefix_length"); - writer.WriteNumberValue(FuzzyPrefixLengthValue.Value); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(QuoteFieldSuffixValue)) - { - writer.WritePropertyName("quote_field_suffix"); - writer.WriteStringValue(QuoteFieldSuffixValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SimpleQueryStringQueryDescriptor : SerializableDescriptor +public readonly partial struct SimpleQueryStringQueryDescriptor { - internal SimpleQueryStringQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleQueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery instance) + { + Instance = instance; + } - public SimpleQueryStringQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SimpleQueryStringQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? AnalyzerValue { get; set; } - private bool? AnalyzeWildcardValue { get; set; } - private bool? AutoGenerateSynonymsPhraseQueryValue { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Operator? DefaultOperatorValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? FieldsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlag? FlagsValue { get; set; } - private int? FuzzyMaxExpansionsValue { get; set; } - private int? FuzzyPrefixLengthValue { get; set; } - private bool? FuzzyTranspositionsValue { get; set; } - private bool? LenientValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } - private string? QuoteFieldSuffixValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor descriptor) => descriptor.Instance; /// /// /// Analyzer used to convert text in the query string into tokens. /// /// - public SimpleQueryStringQueryDescriptor Analyzer(string? analyzer) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Analyzer(string? value) { - AnalyzerValue = analyzer; - return Self; + Instance.Analyzer = value; + return this; } /// @@ -479,10 +566,10 @@ public SimpleQueryStringQueryDescriptor Analyzer(string? analyzer) /// If true, the query attempts to analyze wildcard terms in the query string. /// /// - public SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? value = true) { - AnalyzeWildcardValue = analyzeWildcard; - return Self; + Instance.AnalyzeWildcard = value; + return this; } /// @@ -490,10 +577,10 @@ public SimpleQueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = /// If true, the parser creates a match_phrase query for each multi-position token. /// /// - public SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? autoGenerateSynonymsPhraseQuery = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? value = true) { - AutoGenerateSynonymsPhraseQueryValue = autoGenerateSynonymsPhraseQuery; - return Self; + Instance.AutoGenerateSynonymsPhraseQuery = value; + return this; } /// @@ -504,10 +591,10 @@ public SimpleQueryStringQueryDescriptor AutoGenerateSynonymsPhraseQuery(bool? au /// A value greater than 1.0 increases the relevance score. /// /// - public SimpleQueryStringQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -515,10 +602,10 @@ public SimpleQueryStringQueryDescriptor Boost(float? boost) /// Default boolean logic used to interpret text in the query string if no operators are specified. /// /// - public SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? defaultOperator) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elasticsearch.QueryDsl.Operator? value) { - DefaultOperatorValue = defaultOperator; - return Self; + Instance.DefaultOperator = value; + return this; } /// @@ -529,10 +616,24 @@ public SimpleQueryStringQueryDescriptor DefaultOperator(Elastic.Clients.Elastics /// Defaults to the index.query.default_field index setting, which has a default value of *. /// /// - public SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? fields) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fields? value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; + } + + /// + /// + /// Array of fields you wish to search. + /// Accepts wildcard expressions. + /// You also can boost relevance scores for matches to particular fields using a caret (^) notation. + /// Defaults to the index.query.default_field index setting, which has a default value of *. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Fields(params System.Linq.Expressions.Expression>[] value) + { + Instance.Fields = value; + return this; } /// @@ -540,10 +641,10 @@ public SimpleQueryStringQueryDescriptor Fields(Elastic.Clients.Elasticsearch.Fie /// List of enabled operators for the simple query string syntax. /// /// - public SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlag? flags) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringFlags? value) { - FlagsValue = flags; - return Self; + Instance.Flags = value; + return this; } /// @@ -551,10 +652,10 @@ public SimpleQueryStringQueryDescriptor Flags(Elastic.Clients.Elasticsearch.Quer /// Maximum number of terms to which the query expands for fuzzy matching. /// /// - public SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansions) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? value) { - FuzzyMaxExpansionsValue = fuzzyMaxExpansions; - return Self; + Instance.FuzzyMaxExpansions = value; + return this; } /// @@ -562,10 +663,10 @@ public SimpleQueryStringQueryDescriptor FuzzyMaxExpansions(int? fuzzyMaxExpansio /// Number of beginning characters left unchanged for fuzzy matching. /// /// - public SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? value) { - FuzzyPrefixLengthValue = fuzzyPrefixLength; - return Self; + Instance.FuzzyPrefixLength = value; + return this; } /// @@ -573,10 +674,10 @@ public SimpleQueryStringQueryDescriptor FuzzyPrefixLength(int? fuzzyPrefixLength /// If true, edits for fuzzy matching include transpositions of two adjacent characters (for example, ab to ba). /// /// - public SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTranspositions = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? value = true) { - FuzzyTranspositionsValue = fuzzyTranspositions; - return Self; + Instance.FuzzyTranspositions = value; + return this; } /// @@ -584,10 +685,10 @@ public SimpleQueryStringQueryDescriptor FuzzyTranspositions(bool? fuzzyTransposi /// If true, format-based errors, such as providing a text value for a numeric field, are ignored. /// /// - public SimpleQueryStringQueryDescriptor Lenient(bool? lenient = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Lenient(bool? value = true) { - LenientValue = lenient; - return Self; + Instance.Lenient = value; + return this; } /// @@ -595,10 +696,10 @@ public SimpleQueryStringQueryDescriptor Lenient(bool? lenient = true) /// Minimum number of clauses that must match for a document to be returned. /// /// - public SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -606,16 +707,16 @@ public SimpleQueryStringQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elast /// Query string in the simple query string syntax you wish to parse and use for search. /// /// - public SimpleQueryStringQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SimpleQueryStringQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -623,101 +724,17 @@ public SimpleQueryStringQueryDescriptor QueryName(string? queryName) /// Suffix appended to quoted text in the query string. /// /// - public SimpleQueryStringQueryDescriptor QuoteFieldSuffix(string? quoteFieldSuffix) + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor QuoteFieldSuffix(string? value) { - QuoteFieldSuffixValue = quoteFieldSuffix; - return Self; + Instance.QuoteFieldSuffix = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(AnalyzerValue)) - { - writer.WritePropertyName("analyzer"); - writer.WriteStringValue(AnalyzerValue); - } - - if (AnalyzeWildcardValue.HasValue) - { - writer.WritePropertyName("analyze_wildcard"); - writer.WriteBooleanValue(AnalyzeWildcardValue.Value); - } - - if (AutoGenerateSynonymsPhraseQueryValue.HasValue) - { - writer.WritePropertyName("auto_generate_synonyms_phrase_query"); - writer.WriteBooleanValue(AutoGenerateSynonymsPhraseQueryValue.Value); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DefaultOperatorValue is not null) - { - writer.WritePropertyName("default_operator"); - JsonSerializer.Serialize(writer, DefaultOperatorValue, options); - } - - if (FieldsValue is not null) - { - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - } - - if (FlagsValue is not null) - { - writer.WritePropertyName("flags"); - JsonSerializer.Serialize(writer, FlagsValue, options); - } - - if (FuzzyMaxExpansionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_max_expansions"); - writer.WriteNumberValue(FuzzyMaxExpansionsValue.Value); - } - - if (FuzzyPrefixLengthValue.HasValue) - { - writer.WritePropertyName("fuzzy_prefix_length"); - writer.WriteNumberValue(FuzzyPrefixLengthValue.Value); - } - - if (FuzzyTranspositionsValue.HasValue) - { - writer.WritePropertyName("fuzzy_transpositions"); - writer.WriteBooleanValue(FuzzyTranspositionsValue.Value); - } - - if (LenientValue.HasValue) - { - writer.WritePropertyName("lenient"); - writer.WriteBooleanValue(LenientValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(QuoteFieldSuffixValue)) - { - writer.WritePropertyName("quote_field_suffix"); - writer.WriteStringValue(QuoteFieldSuffixValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanContainingQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanContainingQuery.g.cs index a5390343656..5b089e0fbdb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanContainingQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanContainingQuery.g.cs @@ -17,26 +17,115 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanContainingQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBig = System.Text.Json.JsonEncodedText.Encode("big"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropLittle = System.Text.Json.JsonEncodedText.Encode("little"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBig = default; + LocalJsonValue propBoost = default; + LocalJsonValue propLittle = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBig.TryReadProperty(ref reader, options, PropBig, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propLittle.TryReadProperty(ref reader, options, PropLittle, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Big = propBig.Value, + Boost = propBoost.Value, + Little = propLittle.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBig, value.Big, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropLittle, value.Little, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryConverter))] public sealed partial class SpanContainingQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanContainingQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + { + Big = big; + Little = little; + } +#if NET7_0_OR_GREATER + public SpanContainingQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanContainingQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Can be any span query. /// Matching spans from big that contain matches from little are returned. /// /// - [JsonInclude, JsonPropertyName("big")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Big { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Big { get; set; } /// /// @@ -46,7 +135,6 @@ public sealed partial class SpanContainingQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -55,31 +143,32 @@ public sealed partial class SpanContainingQuery /// Matching spans from big that contain matches from little are returned. /// /// - [JsonInclude, JsonPropertyName("little")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Little { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Little { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanContainingQuery spanContainingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanContaining(spanContainingQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanContainingQuery spanContainingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanContaining(spanContainingQuery); } -public sealed partial class SpanContainingQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanContainingQueryDescriptor { - internal SpanContainingQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanContainingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery instance) + { + Instance = instance; + } - public SpanContainingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanContainingQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery BigValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor BigDescriptor { get; set; } - private Action> BigDescriptorAction { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery LittleValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor LittleDescriptor { get; set; } - private Action> LittleDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -87,28 +176,22 @@ public SpanContainingQueryDescriptor() : base() /// Matching spans from big that contain matches from little are returned. /// /// - public SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - BigDescriptor = null; - BigDescriptorAction = null; - BigValue = big; - return Self; + Instance.Big = value; + return this; } - public SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) - { - BigValue = null; - BigDescriptorAction = null; - BigDescriptor = descriptor; - return Self; - } - - public SpanContainingQueryDescriptor Big(Action> configure) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Big(System.Action> action) { - BigValue = null; - BigDescriptor = null; - BigDescriptorAction = configure; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -119,10 +202,10 @@ public SpanContainingQueryDescriptor Big(Action /// - public SpanContainingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -131,103 +214,57 @@ public SpanContainingQueryDescriptor Boost(float? boost) /// Matching spans from big that contain matches from little are returned. /// /// - public SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - LittleDescriptor = null; - LittleDescriptorAction = null; - LittleValue = little; - return Self; + Instance.Little = value; + return this; } - public SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Little(System.Action> action) { - LittleValue = null; - LittleDescriptorAction = null; - LittleDescriptor = descriptor; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanContainingQueryDescriptor Little(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor QueryName(string? value) { - LittleValue = null; - LittleDescriptor = null; - LittleDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public SpanContainingQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BigDescriptor is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigDescriptor, options); - } - else if (BigDescriptorAction is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(BigDescriptorAction), options); - } - else - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (LittleDescriptor is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleDescriptor, options); - } - else if (LittleDescriptorAction is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(LittleDescriptorAction), options); - } - else - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanContainingQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanContainingQueryDescriptor { - internal SpanContainingQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery Instance { get; init; } - public SpanContainingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanContainingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery BigValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor BigDescriptor { get; set; } - private Action BigDescriptorAction { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery LittleValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor LittleDescriptor { get; set; } - private Action LittleDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanContainingQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -235,28 +272,34 @@ public SpanContainingQueryDescriptor() : base() /// Matching spans from big that contain matches from little are returned. /// /// - public SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - BigDescriptor = null; - BigDescriptorAction = null; - BigValue = big; - return Self; + Instance.Big = value; + return this; } - public SpanContainingQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Big(System.Action action) { - BigValue = null; - BigDescriptorAction = null; - BigDescriptor = descriptor; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanContainingQueryDescriptor Big(Action configure) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Big(System.Action> action) { - BigValue = null; - BigDescriptor = null; - BigDescriptorAction = configure; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -267,10 +310,10 @@ public SpanContainingQueryDescriptor Big(Action /// - public SpanContainingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -279,83 +322,47 @@ public SpanContainingQueryDescriptor Boost(float? boost) /// Matching spans from big that contain matches from little are returned. /// /// - public SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - LittleDescriptor = null; - LittleDescriptorAction = null; - LittleValue = little; - return Self; + Instance.Little = value; + return this; } - public SpanContainingQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Little(System.Action action) { - LittleValue = null; - LittleDescriptorAction = null; - LittleDescriptor = descriptor; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanContainingQueryDescriptor Little(Action configure) + /// + /// + /// Can be any span query. + /// Matching spans from big that contain matches from little are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor Little(System.Action> action) { - LittleValue = null; - LittleDescriptor = null; - LittleDescriptorAction = configure; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanContainingQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BigDescriptor is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigDescriptor, options); - } - else if (BigDescriptorAction is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(BigDescriptorAction), options); - } - else - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (LittleDescriptor is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleDescriptor, options); - } - else if (LittleDescriptorAction is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(LittleDescriptorAction), options); - } - else - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs index 3d39f8c88de..0ffcd92c68e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs @@ -17,18 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanFieldMaskingQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryConverter))] public sealed partial class SpanFieldMaskingQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery query) + { + Field = field; + Query = query; + } +#if NET7_0_OR_GREATER + public SpanFieldMaskingQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanFieldMaskingQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,33 +123,38 @@ public sealed partial class SpanFieldMaskingQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - [JsonInclude, JsonPropertyName("query")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Query { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanFieldMasking(spanFieldMaskingQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanFieldMasking(spanFieldMaskingQuery); } -public sealed partial class SpanFieldMaskingQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanFieldMaskingQueryDescriptor { - internal SpanFieldMaskingQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery Instance { get; init; } - public SpanFieldMaskingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFieldMaskingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFieldMaskingQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -73,111 +164,69 @@ public SpanFieldMaskingQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanFieldMaskingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - FieldValue = field; - return Self; + Instance.Query = value; + return this; } - public SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery query) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor QueryName(string? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.QueryName = value; + return this; } - public SpanFieldMaskingQueryDescriptor Query(Action> configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery Build(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } +} - public SpanFieldMaskingQueryDescriptor QueryName(string? queryName) - { - QueryNameValue = queryName; - return Self; - } +public readonly partial struct SpanFieldMaskingQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery Instance { get; init; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFieldMaskingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery instance) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + Instance = instance; } -} - -public sealed partial class SpanFieldMaskingQueryDescriptor : SerializableDescriptor -{ - internal SpanFieldMaskingQueryDescriptor(Action configure) => configure.Invoke(this); - public SpanFieldMaskingQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFieldMaskingQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -187,93 +236,53 @@ public SpanFieldMaskingQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanFieldMaskingQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanFieldMaskingQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - FieldValue = field; - return Self; + Instance.Query = value; + return this; } - public SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery query) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Query(System.Action action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFieldMaskingQueryDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFieldMaskingQueryDescriptor Query(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor QueryName(string? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public SpanFieldMaskingQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery Build(System.Action action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(QueryDescriptorAction), options); - } - else - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFirstQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFirstQuery.g.cs index 297e674249e..ba660394ce2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFirstQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFirstQuery.g.cs @@ -17,18 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanFirstQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropEnd = System.Text.Json.JsonEncodedText.Encode("end"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propEnd = default; + LocalJsonValue propMatch = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propEnd.TryReadProperty(ref reader, options, PropEnd, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + End = propEnd.Value, + Match = propMatch.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropEnd, value.End, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryConverter))] public sealed partial class SpanFirstQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFirstQuery(int end, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery match) + { + End = end; + Match = match; + } +#if NET7_0_OR_GREATER + public SpanFirstQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanFirstQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +123,6 @@ public sealed partial class SpanFirstQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,37 +130,43 @@ public sealed partial class SpanFirstQuery /// Controls the maximum end position permitted in a match. /// /// - [JsonInclude, JsonPropertyName("end")] - public int End { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int End { get; set; } /// /// /// Can be any other span type query. /// /// - [JsonInclude, JsonPropertyName("match")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Match { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Match { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanFirstQuery spanFirstQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanFirst(spanFirstQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanFirstQuery spanFirstQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanFirst(spanFirstQuery); } -public sealed partial class SpanFirstQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanFirstQueryDescriptor { - internal SpanFirstQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery Instance { get; init; } - public SpanFirstQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFirstQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private int EndValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor MatchDescriptor { get; set; } - private Action> MatchDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFirstQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -85,10 +176,10 @@ public SpanFirstQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanFirstQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -96,10 +187,10 @@ public SpanFirstQueryDescriptor Boost(float? boost) /// Controls the maximum end position permitted in a match. /// /// - public SpanFirstQueryDescriptor End(int end) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor End(int value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -107,87 +198,56 @@ public SpanFirstQueryDescriptor End(int end) /// Can be any other span type query. /// /// - public SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery match) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = value; + return this; } - public SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any other span type query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFirstQueryDescriptor Match(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor QueryName(string? value) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public SpanFirstQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("end"); - writer.WriteNumberValue(EndValue); - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(MatchDescriptorAction), options); - } - else - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanFirstQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanFirstQueryDescriptor { - internal SpanFirstQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFirstQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery instance) + { + Instance = instance; + } - public SpanFirstQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanFirstQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private int EndValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor MatchDescriptor { get; set; } - private Action MatchDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -197,10 +257,10 @@ public SpanFirstQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanFirstQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -208,10 +268,10 @@ public SpanFirstQueryDescriptor Boost(float? boost) /// Controls the maximum end position permitted in a match. /// /// - public SpanFirstQueryDescriptor End(int end) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor End(int value) { - EndValue = end; - return Self; + Instance.End = value; + return this; } /// @@ -219,69 +279,45 @@ public SpanFirstQueryDescriptor End(int end) /// Can be any other span type query. /// /// - public SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery match) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = value; + return this; } - public SpanFirstQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any other span type query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Match(System.Action action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFirstQueryDescriptor Match(Action configure) + /// + /// + /// Can be any other span type query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanFirstQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("end"); - writer.WriteNumberValue(EndValue); - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(MatchDescriptorAction), options); - } - else - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanMultiTermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanMultiTermQuery.g.cs index 5f9210cd9c0..3f5d9da6351 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanMultiTermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanMultiTermQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanMultiTermQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propMatch = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Match = propMatch.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryConverter))] public sealed partial class SpanMultiTermQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanMultiTermQuery(Elastic.Clients.Elasticsearch.QueryDsl.Query match) + { + Match = match; + } +#if NET7_0_OR_GREATER + public SpanMultiTermQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanMultiTermQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +113,6 @@ public sealed partial class SpanMultiTermQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,28 +120,32 @@ public sealed partial class SpanMultiTermQuery /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). /// /// - [JsonInclude, JsonPropertyName("match")] - public Elastic.Clients.Elasticsearch.QueryDsl.Query Match { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.Query Match { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanMultiTermQuery spanMultiTermQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanMulti(spanMultiTermQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanMultiTermQuery spanMultiTermQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanMulti(spanMultiTermQuery); } -public sealed partial class SpanMultiTermQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanMultiTermQueryDescriptor { - internal SpanMultiTermQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery Instance { get; init; } - public SpanMultiTermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanMultiTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchDescriptor { get; set; } - private Action> MatchDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanMultiTermQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -76,10 +155,10 @@ public SpanMultiTermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanMultiTermQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -87,84 +166,56 @@ public SpanMultiTermQueryDescriptor Boost(float? boost) /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). /// /// - public SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.Query match) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = value; + return this; } - public SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SpanMultiTermQueryDescriptor Match(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor QueryName(string? value) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public SpanMultiTermQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MatchDescriptorAction), options); - } - else - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanMultiTermQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanMultiTermQueryDescriptor { - internal SpanMultiTermQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanMultiTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery instance) + { + Instance = instance; + } - public SpanMultiTermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanMultiTermQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query MatchValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor MatchDescriptor { get; set; } - private Action MatchDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -174,10 +225,10 @@ public SpanMultiTermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanMultiTermQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -185,67 +236,45 @@ public SpanMultiTermQueryDescriptor Boost(float? boost) /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). /// /// - public SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.Query match) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.Query value) { - MatchDescriptor = null; - MatchDescriptorAction = null; - MatchValue = match; - return Self; + Instance.Match = value; + return this; } - public SpanMultiTermQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Match(System.Action action) { - MatchValue = null; - MatchDescriptorAction = null; - MatchDescriptor = descriptor; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SpanMultiTermQueryDescriptor Match(Action configure) + /// + /// + /// Should be a multi term query (one of wildcard, fuzzy, prefix, range, or regexp query). + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor Match(System.Action> action) { - MatchValue = null; - MatchDescriptor = null; - MatchDescriptorAction = configure; - return Self; + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SpanMultiTermQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MatchDescriptor is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchDescriptor, options); - } - else if (MatchDescriptorAction is not null) - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(MatchDescriptorAction), options); - } - else - { - writer.WritePropertyName("match"); - JsonSerializer.Serialize(writer, MatchValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNearQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNearQuery.g.cs index 27110703b6d..2c0e6444b43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNearQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNearQuery.g.cs @@ -17,18 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanNearQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropClauses = System.Text.Json.JsonEncodedText.Encode("clauses"); + private static readonly System.Text.Json.JsonEncodedText PropInOrder = System.Text.Json.JsonEncodedText.Encode("in_order"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropSlop = System.Text.Json.JsonEncodedText.Encode("slop"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue> propClauses = default; + LocalJsonValue propInOrder = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propSlop = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propClauses.TryReadProperty(ref reader, options, PropClauses, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propInOrder.TryReadProperty(ref reader, options, PropInOrder, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propSlop.TryReadProperty(ref reader, options, PropSlop, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Clauses = propClauses.Value, + InOrder = propInOrder.Value, + QueryName = propQueryName.Value, + Slop = propSlop.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropClauses, value.Clauses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInOrder, value.InOrder, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropSlop, value.Slop, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryConverter))] public sealed partial class SpanNearQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNearQuery(System.Collections.Generic.ICollection clauses) + { + Clauses = clauses; + } +#if NET7_0_OR_GREATER + public SpanNearQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanNearQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +131,6 @@ public sealed partial class SpanNearQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,17 +138,18 @@ public sealed partial class SpanNearQuery /// Array of one or more other span type queries. /// /// - [JsonInclude, JsonPropertyName("clauses")] - public ICollection Clauses { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Clauses { get; set; } /// /// /// Controls whether matches are required to be in-order. /// /// - [JsonInclude, JsonPropertyName("in_order")] public bool? InOrder { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } /// @@ -63,29 +157,27 @@ public sealed partial class SpanNearQuery /// Controls the maximum number of intervening unmatched positions permitted. /// /// - [JsonInclude, JsonPropertyName("slop")] public int? Slop { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanNearQuery spanNearQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanNear(spanNearQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanNearQuery spanNearQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanNear(spanNearQuery); } -public sealed partial class SpanNearQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanNearQueryDescriptor { - internal SpanNearQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNearQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery instance) + { + Instance = instance; + } - public SpanNearQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNearQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private ICollection ClausesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ClausesDescriptor { get; set; } - private Action> ClausesDescriptorAction { get; set; } - private Action>[] ClausesDescriptorActions { get; set; } - private bool? InOrderValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -95,10 +187,10 @@ public SpanNearQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanNearQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -106,40 +198,38 @@ public SpanNearQueryDescriptor Boost(float? boost) /// Array of one or more other span type queries. /// /// - public SpanNearQueryDescriptor Clauses(ICollection clauses) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(System.Collections.Generic.ICollection value) { - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesValue = clauses; - return Self; + Instance.Clauses = value; + return this; } - public SpanNearQueryDescriptor Clauses(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(params Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery[] values) { - ClausesValue = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesDescriptor = descriptor; - return Self; + Instance.Clauses = [.. values]; + return this; } - public SpanNearQueryDescriptor Clauses(Action> configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(params System.Action>[] actions) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorActions = null; - ClausesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); + } - public SpanNearQueryDescriptor Clauses(params Action>[] configure) - { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = configure; - return Self; + Instance.Clauses = items; + return this; } /// @@ -147,16 +237,16 @@ public SpanNearQueryDescriptor Clauses(params Action /// - public SpanNearQueryDescriptor InOrder(bool? inOrder = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor InOrder(bool? value = true) { - InOrderValue = inOrder; - return Self; + Instance.InOrder = value; + return this; } - public SpanNearQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -164,90 +254,39 @@ public SpanNearQueryDescriptor QueryName(string? queryName) /// Controls the maximum number of intervening unmatched positions permitted. /// /// - public SpanNearQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (ClausesDescriptor is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ClausesDescriptor, options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorAction is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ClausesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorActions is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - foreach (var action in ClausesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("clauses"); - JsonSerializer.Serialize(writer, ClausesValue, options); - } - - if (InOrderValue.HasValue) - { - writer.WritePropertyName("in_order"); - writer.WriteBooleanValue(InOrderValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanNearQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanNearQueryDescriptor { - internal SpanNearQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery Instance { get; init; } - public SpanNearQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNearQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private ICollection ClausesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ClausesDescriptor { get; set; } - private Action ClausesDescriptorAction { get; set; } - private Action[] ClausesDescriptorActions { get; set; } - private bool? InOrderValue { get; set; } - private string? QueryNameValue { get; set; } - private int? SlopValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNearQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -257,10 +296,10 @@ public SpanNearQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanNearQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -268,40 +307,55 @@ public SpanNearQueryDescriptor Boost(float? boost) /// Array of one or more other span type queries. /// /// - public SpanNearQueryDescriptor Clauses(ICollection clauses) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(System.Collections.Generic.ICollection value) { - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesValue = clauses; - return Self; + Instance.Clauses = value; + return this; } - public SpanNearQueryDescriptor Clauses(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(params Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery[] values) { - ClausesValue = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesDescriptor = descriptor; - return Self; + Instance.Clauses = [.. values]; + return this; } - public SpanNearQueryDescriptor Clauses(Action configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(params System.Action[] actions) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorActions = null; - ClausesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); + } + + Instance.Clauses = items; + return this; } - public SpanNearQueryDescriptor Clauses(params Action[] configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Clauses(params System.Action>[] actions) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); + } + + Instance.Clauses = items; + return this; } /// @@ -309,16 +363,16 @@ public SpanNearQueryDescriptor Clauses(params Action /// - public SpanNearQueryDescriptor InOrder(bool? inOrder = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor InOrder(bool? value = true) { - InOrderValue = inOrder; - return Self; + Instance.InOrder = value; + return this; } - public SpanNearQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -326,70 +380,17 @@ public SpanNearQueryDescriptor QueryName(string? queryName) /// Controls the maximum number of intervening unmatched positions permitted. /// /// - public SpanNearQueryDescriptor Slop(int? slop) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor Slop(int? value) { - SlopValue = slop; - return Self; + Instance.Slop = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (ClausesDescriptor is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ClausesDescriptor, options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorAction is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ClausesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorActions is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - foreach (var action in ClausesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("clauses"); - JsonSerializer.Serialize(writer, ClausesValue, options); - } - - if (InOrderValue.HasValue) - { - writer.WritePropertyName("in_order"); - writer.WriteBooleanValue(InOrderValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (SlopValue.HasValue) - { - writer.WritePropertyName("slop"); - writer.WriteNumberValue(SlopValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNotQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNotQuery.g.cs index 8f27f83982c..93a7fab4a82 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNotQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanNotQuery.g.cs @@ -17,18 +17,131 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanNotQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropDist = System.Text.Json.JsonEncodedText.Encode("dist"); + private static readonly System.Text.Json.JsonEncodedText PropExclude = System.Text.Json.JsonEncodedText.Encode("exclude"); + private static readonly System.Text.Json.JsonEncodedText PropInclude = System.Text.Json.JsonEncodedText.Encode("include"); + private static readonly System.Text.Json.JsonEncodedText PropPost = System.Text.Json.JsonEncodedText.Encode("post"); + private static readonly System.Text.Json.JsonEncodedText PropPre = System.Text.Json.JsonEncodedText.Encode("pre"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propDist = default; + LocalJsonValue propExclude = default; + LocalJsonValue propInclude = default; + LocalJsonValue propPost = default; + LocalJsonValue propPre = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propDist.TryReadProperty(ref reader, options, PropDist, null)) + { + continue; + } + + if (propExclude.TryReadProperty(ref reader, options, PropExclude, null)) + { + continue; + } + + if (propInclude.TryReadProperty(ref reader, options, PropInclude, null)) + { + continue; + } + + if (propPost.TryReadProperty(ref reader, options, PropPost, null)) + { + continue; + } + + if (propPre.TryReadProperty(ref reader, options, PropPre, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Dist = propDist.Value, + Exclude = propExclude.Value, + Include = propInclude.Value, + Post = propPost.Value, + Pre = propPre.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropDist, value.Dist, null, null); + writer.WriteProperty(options, PropExclude, value.Exclude, null, null); + writer.WriteProperty(options, PropInclude, value.Include, null, null); + writer.WriteProperty(options, PropPost, value.Post, null, null); + writer.WriteProperty(options, PropPre, value.Pre, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryConverter))] public sealed partial class SpanNotQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNotQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery exclude, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery include) + { + Exclude = exclude; + Include = include; + } +#if NET7_0_OR_GREATER + public SpanNotQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanNotQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +150,6 @@ public sealed partial class SpanNotQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -46,7 +158,6 @@ public sealed partial class SpanNotQuery /// Equivalent to setting both pre and post. /// /// - [JsonInclude, JsonPropertyName("dist")] public int? Dist { get; set; } /// @@ -54,23 +165,28 @@ public sealed partial class SpanNotQuery /// Span query whose matches must not overlap those returned. /// /// - [JsonInclude, JsonPropertyName("exclude")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Exclude { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Exclude { get; set; } /// /// /// Span query whose matches are filtered. /// /// - [JsonInclude, JsonPropertyName("include")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Include { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Include { get; set; } /// /// /// The number of tokens after the include span that can’t have overlap with the exclude span. /// /// - [JsonInclude, JsonPropertyName("post")] public int? Post { get; set; } /// @@ -78,34 +194,28 @@ public sealed partial class SpanNotQuery /// The number of tokens before the include span that can’t have overlap with the exclude span. /// /// - [JsonInclude, JsonPropertyName("pre")] public int? Pre { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanNotQuery spanNotQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanNot(spanNotQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanNotQuery spanNotQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanNot(spanNotQuery); } -public sealed partial class SpanNotQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanNotQueryDescriptor { - internal SpanNotQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNotQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery instance) + { + Instance = instance; + } - public SpanNotQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNotQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private int? DistValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ExcludeDescriptor { get; set; } - private Action> ExcludeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor IncludeDescriptor { get; set; } - private Action> IncludeDescriptorAction { get; set; } - private int? PostValue { get; set; } - private int? PreValue { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -115,10 +225,10 @@ public SpanNotQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanNotQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -127,10 +237,10 @@ public SpanNotQueryDescriptor Boost(float? boost) /// Equivalent to setting both pre and post. /// /// - public SpanNotQueryDescriptor Dist(int? dist) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Dist(int? value) { - DistValue = dist; - return Self; + Instance.Dist = value; + return this; } /// @@ -138,28 +248,21 @@ public SpanNotQueryDescriptor Dist(int? dist) /// Span query whose matches must not overlap those returned. /// /// - public SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery exclude) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - ExcludeDescriptor = null; - ExcludeDescriptorAction = null; - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } - public SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) - { - ExcludeValue = null; - ExcludeDescriptorAction = null; - ExcludeDescriptor = descriptor; - return Self; - } - - public SpanNotQueryDescriptor Exclude(Action> configure) + /// + /// + /// Span query whose matches must not overlap those returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Exclude(System.Action> action) { - ExcludeValue = null; - ExcludeDescriptor = null; - ExcludeDescriptorAction = configure; - return Self; + Instance.Exclude = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -167,28 +270,21 @@ public SpanNotQueryDescriptor Exclude(Action /// - public SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery include) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - public SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) - { - IncludeValue = null; - IncludeDescriptorAction = null; - IncludeDescriptor = descriptor; - return Self; - } - - public SpanNotQueryDescriptor Include(Action> configure) + /// + /// + /// Span query whose matches are filtered. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Include(System.Action> action) { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorAction = configure; - return Self; + Instance.Include = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -196,10 +292,10 @@ public SpanNotQueryDescriptor Include(Action /// - public SpanNotQueryDescriptor Post(int? post) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Post(int? value) { - PostValue = post; - return Self; + Instance.Post = value; + return this; } /// @@ -207,106 +303,45 @@ public SpanNotQueryDescriptor Post(int? post) /// The number of tokens before the include span that can’t have overlap with the exclude span. /// /// - public SpanNotQueryDescriptor Pre(int? pre) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Pre(int? value) { - PreValue = pre; - return Self; + Instance.Pre = value; + return this; } - public SpanNotQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DistValue.HasValue) - { - writer.WritePropertyName("dist"); - writer.WriteNumberValue(DistValue.Value); - } - - if (ExcludeDescriptor is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeDescriptor, options); - } - else if (ExcludeDescriptorAction is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ExcludeDescriptorAction), options); - } - else - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (IncludeDescriptor is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeDescriptor, options); - } - else if (IncludeDescriptorAction is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(IncludeDescriptorAction), options); - } - else - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (PostValue.HasValue) - { - writer.WritePropertyName("post"); - writer.WriteNumberValue(PostValue.Value); - } - - if (PreValue.HasValue) - { - writer.WritePropertyName("pre"); - writer.WriteNumberValue(PreValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanNotQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanNotQueryDescriptor { - internal SpanNotQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNotQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery instance) + { + Instance = instance; + } - public SpanNotQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanNotQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private int? DistValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery ExcludeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ExcludeDescriptor { get; set; } - private Action ExcludeDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery IncludeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor IncludeDescriptor { get; set; } - private Action IncludeDescriptorAction { get; set; } - private int? PostValue { get; set; } - private int? PreValue { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -316,10 +351,10 @@ public SpanNotQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanNotQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -328,10 +363,10 @@ public SpanNotQueryDescriptor Boost(float? boost) /// Equivalent to setting both pre and post. /// /// - public SpanNotQueryDescriptor Dist(int? dist) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Dist(int? value) { - DistValue = dist; - return Self; + Instance.Dist = value; + return this; } /// @@ -339,28 +374,32 @@ public SpanNotQueryDescriptor Dist(int? dist) /// Span query whose matches must not overlap those returned. /// /// - public SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery exclude) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - ExcludeDescriptor = null; - ExcludeDescriptorAction = null; - ExcludeValue = exclude; - return Self; + Instance.Exclude = value; + return this; } - public SpanNotQueryDescriptor Exclude(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Span query whose matches must not overlap those returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Exclude(System.Action action) { - ExcludeValue = null; - ExcludeDescriptorAction = null; - ExcludeDescriptor = descriptor; - return Self; + Instance.Exclude = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanNotQueryDescriptor Exclude(Action configure) + /// + /// + /// Span query whose matches must not overlap those returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Exclude(System.Action> action) { - ExcludeValue = null; - ExcludeDescriptor = null; - ExcludeDescriptorAction = configure; - return Self; + Instance.Exclude = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -368,28 +407,32 @@ public SpanNotQueryDescriptor Exclude(Action /// - public SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery include) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - IncludeDescriptor = null; - IncludeDescriptorAction = null; - IncludeValue = include; - return Self; + Instance.Include = value; + return this; } - public SpanNotQueryDescriptor Include(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Span query whose matches are filtered. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Include(System.Action action) { - IncludeValue = null; - IncludeDescriptorAction = null; - IncludeDescriptor = descriptor; - return Self; + Instance.Include = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanNotQueryDescriptor Include(Action configure) + /// + /// + /// Span query whose matches are filtered. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Include(System.Action> action) { - IncludeValue = null; - IncludeDescriptor = null; - IncludeDescriptorAction = configure; - return Self; + Instance.Include = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -397,10 +440,10 @@ public SpanNotQueryDescriptor Include(Action /// - public SpanNotQueryDescriptor Post(int? post) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Post(int? value) { - PostValue = post; - return Self; + Instance.Post = value; + return this; } /// @@ -408,83 +451,23 @@ public SpanNotQueryDescriptor Post(int? post) /// The number of tokens before the include span that can’t have overlap with the exclude span. /// /// - public SpanNotQueryDescriptor Pre(int? pre) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor Pre(int? value) { - PreValue = pre; - return Self; + Instance.Pre = value; + return this; } - public SpanNotQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (DistValue.HasValue) - { - writer.WritePropertyName("dist"); - writer.WriteNumberValue(DistValue.Value); - } - - if (ExcludeDescriptor is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeDescriptor, options); - } - else if (ExcludeDescriptorAction is not null) - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ExcludeDescriptorAction), options); - } - else - { - writer.WritePropertyName("exclude"); - JsonSerializer.Serialize(writer, ExcludeValue, options); - } - - if (IncludeDescriptor is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeDescriptor, options); - } - else if (IncludeDescriptorAction is not null) - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(IncludeDescriptorAction), options); - } - else - { - writer.WritePropertyName("include"); - JsonSerializer.Serialize(writer, IncludeValue, options); - } - - if (PostValue.HasValue) - { - writer.WritePropertyName("post"); - writer.WriteNumberValue(PostValue.Value); - } - - if (PreValue.HasValue) - { - writer.WritePropertyName("pre"); - writer.WriteNumberValue(PreValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanOrQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanOrQuery.g.cs index e48d9a01f09..0bb8c1d4c29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanOrQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanOrQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanOrQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropClauses = System.Text.Json.JsonEncodedText.Encode("clauses"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue> propClauses = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propClauses.TryReadProperty(ref reader, options, PropClauses, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Clauses = propClauses.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropClauses, value.Clauses, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryConverter))] public sealed partial class SpanOrQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanOrQuery(System.Collections.Generic.ICollection clauses) + { + Clauses = clauses; + } +#if NET7_0_OR_GREATER + public SpanOrQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanOrQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +113,6 @@ public sealed partial class SpanOrQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -45,29 +120,32 @@ public sealed partial class SpanOrQuery /// Array of one or more other span type queries. /// /// - [JsonInclude, JsonPropertyName("clauses")] - public ICollection Clauses { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Clauses { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanOrQuery spanOrQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanOr(spanOrQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanOrQuery spanOrQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanOr(spanOrQuery); } -public sealed partial class SpanOrQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanOrQueryDescriptor { - internal SpanOrQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanOrQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery instance) + { + Instance = instance; + } - public SpanOrQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanOrQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private ICollection ClausesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ClausesDescriptor { get; set; } - private Action> ClausesDescriptorAction { get; set; } - private Action>[] ClausesDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -77,10 +155,10 @@ public SpanOrQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanOrQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -88,112 +166,73 @@ public SpanOrQueryDescriptor Boost(float? boost) /// Array of one or more other span type queries. /// /// - public SpanOrQueryDescriptor Clauses(ICollection clauses) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(System.Collections.Generic.ICollection value) { - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesValue = clauses; - return Self; + Instance.Clauses = value; + return this; } - public SpanOrQueryDescriptor Clauses(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(params Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery[] values) { - ClausesValue = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesDescriptor = descriptor; - return Self; + Instance.Clauses = [.. values]; + return this; } - public SpanOrQueryDescriptor Clauses(Action> configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(params System.Action>[] actions) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorActions = null; - ClausesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); + } - public SpanOrQueryDescriptor Clauses(params Action>[] configure) - { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = configure; - return Self; + Instance.Clauses = items; + return this; } - public SpanOrQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (ClausesDescriptor is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ClausesDescriptor, options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorAction is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ClausesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorActions is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - foreach (var action in ClausesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("clauses"); - JsonSerializer.Serialize(writer, ClausesValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanOrQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanOrQueryDescriptor { - internal SpanOrQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanOrQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery instance) + { + Instance = instance; + } - public SpanOrQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanOrQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private ICollection ClausesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor ClausesDescriptor { get; set; } - private Action ClausesDescriptorAction { get; set; } - private Action[] ClausesDescriptorActions { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -203,10 +242,10 @@ public SpanOrQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanOrQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -214,94 +253,68 @@ public SpanOrQueryDescriptor Boost(float? boost) /// Array of one or more other span type queries. /// /// - public SpanOrQueryDescriptor Clauses(ICollection clauses) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(System.Collections.Generic.ICollection value) { - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesValue = clauses; - return Self; + Instance.Clauses = value; + return this; } - public SpanOrQueryDescriptor Clauses(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) - { - ClausesValue = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = null; - ClausesDescriptor = descriptor; - return Self; - } - - public SpanOrQueryDescriptor Clauses(Action configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(params Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery[] values) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorActions = null; - ClausesDescriptorAction = configure; - return Self; + Instance.Clauses = [.. values]; + return this; } - public SpanOrQueryDescriptor Clauses(params Action[] configure) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(params System.Action[] actions) { - ClausesValue = null; - ClausesDescriptor = null; - ClausesDescriptorAction = null; - ClausesDescriptorActions = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); + } - public SpanOrQueryDescriptor QueryName(string? queryName) - { - QueryNameValue = queryName; - return Self; + Instance.Clauses = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Array of one or more other span type queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor Clauses(params System.Action>[] actions) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (ClausesDescriptor is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ClausesDescriptor, options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action)); } - else if (ClausesDescriptorAction is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(ClausesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ClausesDescriptorActions is not null) - { - writer.WritePropertyName("clauses"); - writer.WriteStartArray(); - foreach (var action in ClausesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("clauses"); - JsonSerializer.Serialize(writer, ClausesValue, options); - } + Instance.Clauses = items; + return this; + } - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs index 68096795d8c..57b43f3c42a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs @@ -17,344 +17,872 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(SpanQueryConverter))] -public sealed partial class SpanQuery -{ - internal SpanQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static SpanQuery SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => new SpanQuery("span_containing", spanContainingQuery); - public static SpanQuery SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new SpanQuery("span_field_masking", spanFieldMaskingQuery); - public static SpanQuery SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => new SpanQuery("span_first", spanFirstQuery); - public static SpanQuery SpanGap(KeyValuePair integer) => new SpanQuery("span_gap", integer); - public static SpanQuery SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new SpanQuery("span_multi", spanMultiTermQuery); - public static SpanQuery SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => new SpanQuery("span_near", spanNearQuery); - public static SpanQuery SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => new SpanQuery("span_not", spanNotQuery); - public static SpanQuery SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => new SpanQuery("span_or", spanOrQuery); - public static SpanQuery SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => new SpanQuery("span_term", spanTermQuery); - public static SpanQuery SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => new SpanQuery("span_within", spanWithinQuery); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class SpanQueryConverter : JsonConverter +internal sealed partial class SpanQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override SpanQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText VariantSpanContaining = System.Text.Json.JsonEncodedText.Encode("span_containing"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanFieldMasking = System.Text.Json.JsonEncodedText.Encode("span_field_masking"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanFirst = System.Text.Json.JsonEncodedText.Encode("span_first"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanGap = System.Text.Json.JsonEncodedText.Encode("span_gap"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanMulti = System.Text.Json.JsonEncodedText.Encode("span_multi"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanNear = System.Text.Json.JsonEncodedText.Encode("span_near"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanNot = System.Text.Json.JsonEncodedText.Encode("span_not"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanOr = System.Text.Json.JsonEncodedText.Encode("span_or"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanTerm = System.Text.Json.JsonEncodedText.Encode("span_term"); + private static readonly System.Text.Json.JsonEncodedText VariantSpanWithin = System.Text.Json.JsonEncodedText.Encode("span_within"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantSpanContaining)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantSpanContaining.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "span_containing") + if (reader.ValueTextEquals(VariantSpanFieldMasking)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanFieldMasking.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_field_masking") + if (reader.ValueTextEquals(VariantSpanFirst)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanFirst.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_first") + if (reader.ValueTextEquals(VariantSpanGap)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanGap.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.KeyValuePair (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue(o, null, null)); continue; } - if (propertyName == "span_gap") + if (reader.ValueTextEquals(VariantSpanMulti)) { - variantValue = JsonSerializer.Deserialize?>(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanMulti.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_multi") + if (reader.ValueTextEquals(VariantSpanNear)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanNear.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_near") + if (reader.ValueTextEquals(VariantSpanNot)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanNot.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_not") + if (reader.ValueTextEquals(VariantSpanOr)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanOr.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_or") + if (reader.ValueTextEquals(VariantSpanTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_term") + if (reader.ValueTextEquals(VariantSpanWithin)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSpanWithin.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "span_within") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'SpanQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new SpanQuery(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, SpanQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "span_containing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, options); - break; - case "span_field_masking": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; - case "span_first": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, options); - break; - case "span_gap": - JsonSerializer.Serialize>(writer, (KeyValuePair)value.Variant, options); - break; - case "span_multi": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery)value.Variant, options); - break; - case "span_near": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery)value.Variant, options); - break; - case "span_not": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery)value.Variant, options); - break; - case "span_or": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery)value.Variant, options); - break; - case "span_term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery)value.Variant, options); - break; - case "span_within": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery)value.Variant, options); - break; - } + case null: + break; + case "span_containing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, null, null); + break; + case "span_field_masking": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, null, null); + break; + case "span_first": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, null, null); + break; + case "span_gap": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.KeyValuePair)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair v) => w.WriteKeyValuePairValue(o, v, null, null)); + break; + case "span_multi": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery)value.Variant, null, null); + break; + case "span_near": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery)value.Variant, null, null); + break; + case "span_not": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery)value.Variant, null, null); + break; + case "span_or": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery)value.Variant, null, null); + break; + case "span_term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery)value.Variant, null, null); + break; + case "span_within": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery)}'."); } writer.WriteEndObject(); } } -public sealed partial class SpanQueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryConverter))] +public sealed partial class SpanQuery { - internal SpanQueryDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public SpanQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public SpanQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? SpanContaining { get => GetVariant("span_containing"); set => SetVariant("span_containing", value); } + + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? SpanFieldMasking { get => GetVariant("span_field_masking"); set => SetVariant("span_field_masking", value); } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? SpanFirst { get => GetVariant("span_first"); set => SetVariant("span_first", value); } + public System.Collections.Generic.KeyValuePair? SpanGap { get => GetVariant>("span_gap"); set => SetVariant("span_gap", value); } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? SpanMulti { get => GetVariant("span_multi"); set => SetVariant("span_multi", value); } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? SpanNear { get => GetVariant("span_near"); set => SetVariant("span_near", value); } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? SpanNot { get => GetVariant("span_not"); set => SetVariant("span_not", value); } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? SpanOr { get => GetVariant("span_or"); set => SetVariant("span_or", value); } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? SpanTerm { get => GetVariant("span_term"); set => SetVariant("span_term", value); } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? SpanWithin { get => GetVariant("span_within"); set => SetVariant("span_within", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanContaining = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanFieldMasking = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanFirst = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(System.Collections.Generic.KeyValuePair value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanGap = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanMulti = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanNear = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanNot = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanOr = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanTerm = value }; + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery value) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery { SpanWithin = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } - public SpanQueryDescriptor() : base() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct SpanQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Instance { get; init; } - private SpanQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private SpanQueryDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanQueryDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); - public SpanQueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); - public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); - public SpanQueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); - public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); - public SpanQueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); - public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap"); - public SpanQueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); - public SpanQueryDescriptor SpanMulti(Action> configure) => Set(configure, "span_multi"); - public SpanQueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => Set(spanNearQuery, "span_near"); - public SpanQueryDescriptor SpanNear(Action> configure) => Set(configure, "span_near"); - public SpanQueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => Set(spanNotQuery, "span_not"); - public SpanQueryDescriptor SpanNot(Action> configure) => Set(configure, "span_not"); - public SpanQueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => Set(spanOrQuery, "span_or"); - public SpanQueryDescriptor SpanOr(Action> configure) => Set(configure, "span_or"); - public SpanQueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => Set(spanTermQuery, "span_term"); - public SpanQueryDescriptor SpanTerm(Action> configure) => Set(configure, "span_term"); - public SpanQueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => Set(spanWithinQuery, "span_within"); - public SpanQueryDescriptor SpanWithin(Action> configure) => Set(configure, "span_within"); + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.SpanContaining = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanContaining(System.Action> action) + { + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? value) + { + Instance.SpanFieldMasking = value; + return this; + } + + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFieldMasking(System.Action> action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? value) + { + Instance.SpanFirst = value; + return this; + } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFirst(System.Action> action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(System.Collections.Generic.KeyValuePair? value) + { + Instance.SpanGap = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(Elastic.Clients.Elasticsearch.Field key, int value) + { + Instance.SpanGap = new System.Collections.Generic.KeyValuePair(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(System.Linq.Expressions.Expression> key, int value) + { + Instance.SpanGap = new System.Collections.Generic.KeyValuePair(key, value); + return this; + } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? value) + { + Instance.SpanMulti = value; + return this; + } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanMulti(System.Action> action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? value) + { + Instance.SpanNear = value; + return this; + } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNear(System.Action> action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? value) + { + Instance.SpanNot = value; + return this; + } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNot(System.Action> action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? value) + { + Instance.SpanOr = value; + return this; + } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanOr(System.Action> action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? value) + { + Instance.SpanTerm = value; + return this; + } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanTerm(System.Action> action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? value) + { + Instance.SpanWithin = value; + return this; + } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanWithin(System.Action> action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanQueryDescriptor { - internal SpanQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Instance { get; init; } - public SpanQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) => descriptor.Instance; - private SpanQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.SpanContaining = value; + return this; } - private SpanQueryDescriptor Set(object variant, string variantName) + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanContaining(System.Action action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; } - public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); - public SpanQueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); - public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); - public SpanQueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); - public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); - public SpanQueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); - public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap"); - public SpanQueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); - public SpanQueryDescriptor SpanMulti(Action configure) => Set(configure, "span_multi"); - public SpanQueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => Set(spanNearQuery, "span_near"); - public SpanQueryDescriptor SpanNear(Action configure) => Set(configure, "span_near"); - public SpanQueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery spanNotQuery) => Set(spanNotQuery, "span_not"); - public SpanQueryDescriptor SpanNot(Action configure) => Set(configure, "span_not"); - public SpanQueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery spanOrQuery) => Set(spanOrQuery, "span_or"); - public SpanQueryDescriptor SpanOr(Action configure) => Set(configure, "span_or"); - public SpanQueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery spanTermQuery) => Set(spanTermQuery, "span_term"); - public SpanQueryDescriptor SpanTerm(Action configure) => Set(configure, "span_term"); - public SpanQueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery spanWithinQuery) => Set(spanWithinQuery, "span_within"); - public SpanQueryDescriptor SpanWithin(Action configure) => Set(configure, "span_within"); + /// + /// + /// Accepts a list of span queries, but only returns those spans which also match a second span query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanContaining(System.Action> action) + { + Instance.SpanContaining = Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQueryDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.SpanFieldMasking = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFieldMasking(System.Action action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Allows queries like span_near or span_or across different fields. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFieldMasking(System.Action> action) + { + Instance.SpanFieldMasking = Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery? value) + { + Instance.SpanFirst = value; + return this; + } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFirst(System.Action action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts another span query whose matches must appear within the first N positions of the field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanFirst(System.Action> action) + { + Instance.SpanFirst = Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQueryDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(System.Collections.Generic.KeyValuePair? value) + { + Instance.SpanGap = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(Elastic.Clients.Elasticsearch.Field key, int value) + { + Instance.SpanGap = new System.Collections.Generic.KeyValuePair(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanGap(System.Linq.Expressions.Expression> key, int value) + { + Instance.SpanGap = new System.Collections.Generic.KeyValuePair(key, value); + return this; + } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery? value) + { + Instance.SpanMulti = value; + return this; + } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanMulti(System.Action action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps a term, range, prefix, wildcard, regexp, or fuzzy query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanMulti(System.Action> action) + { + Instance.SpanMulti = Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery? value) + { + Instance.SpanNear = value; + return this; + } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNear(System.Action action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNear(System.Action> action) + { + Instance.SpanNear = Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNot(Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQuery? value) + { + Instance.SpanNot = value; + return this; + } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNot(System.Action action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Wraps another span query, and excludes any documents which match that query. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanNot(System.Action> action) + { + Instance.SpanNot = Elastic.Clients.Elasticsearch.QueryDsl.SpanNotQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanOr(Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQuery? value) + { + Instance.SpanOr = value; + return this; + } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanOr(System.Action action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Combines multiple span queries and returns documents which match any of the specified queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanOr(System.Action> action) + { + Instance.SpanOr = Elastic.Clients.Elasticsearch.QueryDsl.SpanOrQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanTerm(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery? value) + { + Instance.SpanTerm = value; + return this; + } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanTerm(System.Action action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The equivalent of the term query but for use with other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanTerm(System.Action> action) + { + Instance.SpanTerm = Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanWithin(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery? value) + { + Instance.SpanWithin = value; + return this; + } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanWithin(System.Action action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor SpanWithin(System.Action> action) + { + Instance.SpanWithin = Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs index 80695af511c..64a6d292c43 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanTermQuery.g.cs @@ -17,93 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class SpanTermQueryConverter : JsonConverter +internal sealed partial class SpanTermQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override SpanTermQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropValue1 = System.Text.Json.JsonEncodedText.Encode("term"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new SpanTermQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } + Field = propField.Value, + Value = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null) || propValue.TryReadProperty(ref reader, options, PropValue1, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); reader.Read(); - return variant; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + QueryName = propQueryName.Value, + Value = propValue.Value + }; } - public override void Write(Utf8JsonWriter writer, SpanTermQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery value, System.Text.Json.JsonSerializerOptions options) { - if (value.Field is null) - throw new JsonException("Unable to serialize SpanTermQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); + writer.WritePropertyName(options, value.Field, null); writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } - - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(value.Value); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(SpanTermQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryConverter))] public sealed partial class SpanTermQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public SpanTermQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanTermQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.FieldValue value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public SpanTermQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -113,26 +138,37 @@ public SpanTermQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } - public string Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanTermQuery spanTermQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanTerm(spanTermQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanTermQuery spanTermQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanTerm(spanTermQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.FieldValue Value { get; set; } } -public sealed partial class SpanTermQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanTermQueryDescriptor { - internal SpanTermQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery Instance { get; init; } - public SpanTermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanTermQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -142,80 +178,63 @@ public SpanTermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanTermQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public SpanTermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public SpanTermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanTermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanTermQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public SpanTermQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanTermQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanTermQueryDescriptor { - internal SpanTermQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery Instance { get; init; } - public SpanTermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanTermQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -225,64 +244,41 @@ public SpanTermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public SpanTermQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public SpanTermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public SpanTermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanTermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SpanTermQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public SpanTermQueryDescriptor Value(string value) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanTermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanWithinQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanWithinQuery.g.cs index db21c718441..bc30350a122 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanWithinQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanWithinQuery.g.cs @@ -17,26 +17,115 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class SpanWithinQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBig = System.Text.Json.JsonEncodedText.Encode("big"); + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropLittle = System.Text.Json.JsonEncodedText.Encode("little"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBig = default; + LocalJsonValue propBoost = default; + LocalJsonValue propLittle = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBig.TryReadProperty(ref reader, options, PropBig, null)) + { + continue; + } + + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propLittle.TryReadProperty(ref reader, options, PropLittle, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Big = propBig.Value, + Boost = propBoost.Value, + Little = propLittle.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBig, value.Big, null, null); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropLittle, value.Little, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryConverter))] public sealed partial class SpanWithinQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanWithinQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big, Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + { + Big = big; + Little = little; + } +#if NET7_0_OR_GREATER + public SpanWithinQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SpanWithinQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Can be any span query. /// Matching spans from little that are enclosed within big are returned. /// /// - [JsonInclude, JsonPropertyName("big")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Big { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Big { get; set; } /// /// @@ -46,7 +135,6 @@ public sealed partial class SpanWithinQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -55,31 +143,32 @@ public sealed partial class SpanWithinQuery /// Matching spans from little that are enclosed within big are returned. /// /// - [JsonInclude, JsonPropertyName("little")] - public Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Little { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery Little { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanWithinQuery spanWithinQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanWithin(spanWithinQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanWithinQuery spanWithinQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanWithin(spanWithinQuery); } -public sealed partial class SpanWithinQueryDescriptor : SerializableDescriptor> +public readonly partial struct SpanWithinQueryDescriptor { - internal SpanWithinQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanWithinQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery instance) + { + Instance = instance; + } - public SpanWithinQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanWithinQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery BigValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor BigDescriptor { get; set; } - private Action> BigDescriptorAction { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery LittleValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor LittleDescriptor { get; set; } - private Action> LittleDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -87,28 +176,22 @@ public SpanWithinQueryDescriptor() : base() /// Matching spans from little that are enclosed within big are returned. /// /// - public SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - BigDescriptor = null; - BigDescriptorAction = null; - BigValue = big; - return Self; + Instance.Big = value; + return this; } - public SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) - { - BigValue = null; - BigDescriptorAction = null; - BigDescriptor = descriptor; - return Self; - } - - public SpanWithinQueryDescriptor Big(Action> configure) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Big(System.Action> action) { - BigValue = null; - BigDescriptor = null; - BigDescriptorAction = configure; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -119,10 +202,10 @@ public SpanWithinQueryDescriptor Big(Action /// - public SpanWithinQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -131,103 +214,57 @@ public SpanWithinQueryDescriptor Boost(float? boost) /// Matching spans from little that are enclosed within big are returned. /// /// - public SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - LittleDescriptor = null; - LittleDescriptorAction = null; - LittleValue = little; - return Self; + Instance.Little = value; + return this; } - public SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Little(System.Action> action) { - LittleValue = null; - LittleDescriptorAction = null; - LittleDescriptor = descriptor; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanWithinQueryDescriptor Little(Action> configure) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor QueryName(string? value) { - LittleValue = null; - LittleDescriptor = null; - LittleDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public SpanWithinQueryDescriptor QueryName(string? queryName) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery Build(System.Action> action) { - QueryNameValue = queryName; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (BigDescriptor is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigDescriptor, options); - } - else if (BigDescriptorAction is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(BigDescriptorAction), options); - } - else - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (LittleDescriptor is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleDescriptor, options); - } - else if (LittleDescriptorAction is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(LittleDescriptorAction), options); - } - else - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SpanWithinQueryDescriptor : SerializableDescriptor +public readonly partial struct SpanWithinQueryDescriptor { - internal SpanWithinQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery Instance { get; init; } - public SpanWithinQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanWithinQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery BigValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor BigDescriptor { get; set; } - private Action BigDescriptorAction { get; set; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery LittleValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor LittleDescriptor { get; set; } - private Action LittleDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SpanWithinQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -235,28 +272,34 @@ public SpanWithinQueryDescriptor() : base() /// Matching spans from little that are enclosed within big are returned. /// /// - public SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery big) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - BigDescriptor = null; - BigDescriptorAction = null; - BigValue = big; - return Self; + Instance.Big = value; + return this; } - public SpanWithinQueryDescriptor Big(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Big(System.Action action) { - BigValue = null; - BigDescriptorAction = null; - BigDescriptor = descriptor; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanWithinQueryDescriptor Big(Action configure) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Big(System.Action> action) { - BigValue = null; - BigDescriptor = null; - BigDescriptorAction = configure; - return Self; + Instance.Big = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } /// @@ -267,10 +310,10 @@ public SpanWithinQueryDescriptor Big(Action /// - public SpanWithinQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -279,83 +322,47 @@ public SpanWithinQueryDescriptor Boost(float? boost) /// Matching spans from little that are enclosed within big are returned. /// /// - public SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery little) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery value) { - LittleDescriptor = null; - LittleDescriptorAction = null; - LittleValue = little; - return Self; + Instance.Little = value; + return this; } - public SpanWithinQueryDescriptor Little(Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor descriptor) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Little(System.Action action) { - LittleValue = null; - LittleDescriptorAction = null; - LittleDescriptor = descriptor; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanWithinQueryDescriptor Little(Action configure) + /// + /// + /// Can be any span query. + /// Matching spans from little that are enclosed within big are returned. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor Little(System.Action> action) { - LittleValue = null; - LittleDescriptor = null; - LittleDescriptorAction = configure; - return Self; + Instance.Little = Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor.Build(action); + return this; } - public SpanWithinQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BigDescriptor is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigDescriptor, options); - } - else if (BigDescriptorAction is not null) - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(BigDescriptorAction), options); - } - else - { - writer.WritePropertyName("big"); - JsonSerializer.Serialize(writer, BigValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (LittleDescriptor is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleDescriptor, options); - } - else if (LittleDescriptorAction is not null) - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.SpanQueryDescriptor(LittleDescriptorAction), options); - } - else - { - writer.WritePropertyName("little"); - JsonSerializer.Serialize(writer, LittleValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SpanWithinQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SparseVectorQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SparseVectorQuery.g.cs index cb6c959ad3d..c62b0df0ee0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SparseVectorQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SparseVectorQuery.g.cs @@ -17,36 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -[JsonConverter(typeof(SparseVectorQueryConverter))] -public sealed partial class SparseVectorQuery +internal sealed partial class SparseVectorQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal SparseVectorQuery(string variantName, object variant) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropPrune = System.Text.Json.JsonEncodedText.Encode("prune"); + private static readonly System.Text.Json.JsonEncodedText PropPruningConfig = System.Text.Json.JsonEncodedText.Encode("pruning_config"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText VariantInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propPrune = default; + LocalJsonValue propPruningConfig = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propPrune.TryReadProperty(ref reader, options, PropPrune, null)) + { + continue; + } + + if (propPruningConfig.TryReadProperty(ref reader, options, PropPruningConfig, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (reader.ValueTextEquals(VariantInferenceId)) + { + variantType = VariantInferenceId.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Boost = propBoost.Value, + Field = propField.Value, + Prune = propPrune.Value, + PruningConfig = propPruningConfig.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; } - internal object Variant { get; } - internal string VariantName { get; } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + switch (value.VariantType) + { + case null: + break; + case "inference_id": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Id)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery)}'."); + } - public static SparseVectorQuery InferenceId(Elastic.Clients.Elasticsearch.Id id) => new SparseVectorQuery("inference_id", id); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropPrune, value.Prune, null, null); + writer.WriteProperty(options, PropPruningConfig, value.PruningConfig, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryConverter))] +public sealed partial class SparseVectorQuery +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public SparseVectorQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SparseVectorQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The inference ID to use to convert the query text into token-weight pairs. + /// It must be the same inference ID that was used to create the tokens from the input text. + /// Only one of inference_id and query_vector is allowed. + /// If inference_id is specified, query must also be specified. + /// Only one of inference_id or query_vector may be supplied in a request. + /// + /// + public Elastic.Clients.Elasticsearch.Id? InferenceId { get => GetVariant("inference_id"); set => SetVariant("inference_id", value); } /// /// @@ -56,7 +178,6 @@ internal SparseVectorQuery(string variantName, object variant) /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -65,8 +186,11 @@ internal SparseVectorQuery(string variantName, object variant) /// This field must be a mapped sparse_vector field. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -75,7 +199,6 @@ internal SparseVectorQuery(string variantName, object variant) /// Default: false /// /// - [JsonInclude, JsonPropertyName("prune")] public bool? Prune { get; set; } /// @@ -86,7 +209,6 @@ internal SparseVectorQuery(string variantName, object variant) /// If prune is set to true but pruning_config is not specified, default values will be used. /// /// - [JsonInclude, JsonPropertyName("pruning_config")] public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? PruningConfig { get; set; } /// @@ -95,203 +217,62 @@ internal SparseVectorQuery(string variantName, object variant) /// If inference_id is specified, query must also be specified. /// /// - [JsonInclude, JsonPropertyName("query")] public string? Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class SparseVectorQueryConverter : JsonConverter -{ - public override SparseVectorQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - float? boostValue = default; - Elastic.Clients.Elasticsearch.Field fieldValue = default; - bool? pruneValue = default; - Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? pruningConfigValue = default; - string? queryValue = default; - string? queryNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); - } - - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "boost") - { - boostValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "field") - { - fieldValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "prune") - { - pruneValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "pruning_config") - { - pruningConfigValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "query") - { - queryValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "_name") - { - queryNameValue = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (propertyName == "inference_id") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'SparseVectorQuery' from the response."); + return result; } - var result = new SparseVectorQuery(variantNameValue, variantValue); - result.Boost = boostValue; - result.Field = fieldValue; - result.Prune = pruneValue; - result.PruningConfig = pruningConfigValue; - result.Query = queryValue; - result.QueryName = queryNameValue; - return result; + return default; } - public override void Write(Utf8JsonWriter writer, SparseVectorQuery value, JsonSerializerOptions options) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } - - if (value.Field is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, value.Field, options); - } - - if (value.Prune.HasValue) - { - writer.WritePropertyName("prune"); - writer.WriteBooleanValue(value.Prune.Value); - } - - if (value.PruningConfig is not null) - { - writer.WritePropertyName("pruning_config"); - JsonSerializer.Serialize(writer, value.PruningConfig, options); - } - - if (!string.IsNullOrEmpty(value.Query)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(value.Query); - } - - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } - - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "inference_id": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Id)value.Variant, options); - break; - } - } - - writer.WriteEndObject(); + VariantType = type; + Variant = value; } } -public sealed partial class SparseVectorQueryDescriptor : SerializableDescriptor> +public readonly partial struct SparseVectorQueryDescriptor { - internal SparseVectorQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery Instance { get; init; } - public SparseVectorQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private SparseVectorQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorQueryDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private SparseVectorQueryDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference ID to use to convert the query text into token-weight pairs. + /// It must be the same inference ID that was used to create the tokens from the input text. + /// Only one of inference_id and query_vector is allowed. + /// If inference_id is specified, query must also be specified. + /// Only one of inference_id or query_vector may be supplied in a request. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.InferenceId = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? PruneValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? PruningConfigValue { get; set; } - private string? QueryValue { get; set; } - private string? QueryNameValue { get; set; } - /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -300,10 +281,10 @@ private SparseVectorQueryDescriptor Set(object variant, string varian /// A value greater than 1.0 increases the relevance score. /// /// - public SparseVectorQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -312,10 +293,10 @@ public SparseVectorQueryDescriptor Boost(float? boost) /// This field must be a mapped sparse_vector field. /// /// - public SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -324,35 +305,37 @@ public SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearc /// This field must be a mapped sparse_vector field. /// /// - public SparseVectorQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the field that contains the token-weight pairs to be searched against. - /// This field must be a mapped sparse_vector field. + /// Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. + /// If prune is true but the pruning_config is not specified, pruning will occur but default values will be used. + /// Default: false /// /// - public SparseVectorQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Prune(bool? value = true) { - FieldValue = field; - return Self; + Instance.Prune = value; + return this; } /// /// - /// Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. - /// If prune is true but the pruning_config is not specified, pruning will occur but default values will be used. - /// Default: false + /// Optional pruning configuration. + /// If enabled, this will omit non-significant tokens from the query in order to improve query performance. + /// This is only used if prune is set to true. + /// If prune is set to true but pruning_config is not specified, default values will be used. /// /// - public SparseVectorQueryDescriptor Prune(bool? prune = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) { - PruneValue = prune; - return Self; + Instance.PruningConfig = value; + return this; } /// @@ -363,10 +346,24 @@ public SparseVectorQueryDescriptor Prune(bool? prune = true) /// If prune is set to true but pruning_config is not specified, default values will be used. /// /// - public SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? pruningConfig) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig() { - PruningConfigValue = pruningConfig; - return Self; + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; + } + + /// + /// + /// Optional pruning configuration. + /// If enabled, this will omit non-significant tokens from the query in order to improve query performance. + /// This is only used if prune is set to true. + /// If prune is set to true but pruning_config is not specified, default values will be used. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig(System.Action? action) + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; } /// @@ -375,114 +372,61 @@ public SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elas /// If inference_id is specified, query must also be specified. /// /// - public SparseVectorQueryDescriptor Query(string? query) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Query(string? value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SparseVectorQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public SparseVectorQueryDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id id) => Set(id, "inference_id"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (PruneValue.HasValue) - { - writer.WritePropertyName("prune"); - writer.WriteBooleanValue(PruneValue.Value); - } - - if (PruningConfigValue is not null) - { - writer.WritePropertyName("pruning_config"); - JsonSerializer.Serialize(writer, PruningConfigValue, options); - } - - if (!string.IsNullOrEmpty(QueryValue)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SparseVectorQueryDescriptor : SerializableDescriptor +public readonly partial struct SparseVectorQueryDescriptor { - internal SparseVectorQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery Instance { get; init; } - public SparseVectorQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private SparseVectorQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SparseVectorQueryDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private SparseVectorQueryDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The inference ID to use to convert the query text into token-weight pairs. + /// It must be the same inference ID that was used to create the tokens from the input text. + /// Only one of inference_id and query_vector is allowed. + /// If inference_id is specified, query must also be specified. + /// Only one of inference_id or query_vector may be supplied in a request. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.InferenceId = value; + return this; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private bool? PruneValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? PruningConfigValue { get; set; } - private string? QueryValue { get; set; } - private string? QueryNameValue { get; set; } - /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -491,10 +435,10 @@ private SparseVectorQueryDescriptor Set(object variant, string variantName) /// A value greater than 1.0 increases the relevance score. /// /// - public SparseVectorQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -503,10 +447,10 @@ public SparseVectorQueryDescriptor Boost(float? boost) /// This field must be a mapped sparse_vector field. /// /// - public SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -515,35 +459,51 @@ public SparseVectorQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field fie /// This field must be a mapped sparse_vector field. /// /// - public SparseVectorQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The name of the field that contains the token-weight pairs to be searched against. - /// This field must be a mapped sparse_vector field. + /// Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. + /// If prune is true but the pruning_config is not specified, pruning will occur but default values will be used. + /// Default: false /// /// - public SparseVectorQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Prune(bool? value = true) { - FieldValue = field; - return Self; + Instance.Prune = value; + return this; } /// /// - /// Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. - /// If prune is true but the pruning_config is not specified, pruning will occur but default values will be used. - /// Default: false + /// Optional pruning configuration. + /// If enabled, this will omit non-significant tokens from the query in order to improve query performance. + /// This is only used if prune is set to true. + /// If prune is set to true but pruning_config is not specified, default values will be used. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) + { + Instance.PruningConfig = value; + return this; + } + + /// + /// + /// Optional pruning configuration. + /// If enabled, this will omit non-significant tokens from the query in order to improve query performance. + /// This is only used if prune is set to true. + /// If prune is set to true but pruning_config is not specified, default values will be used. /// /// - public SparseVectorQueryDescriptor Prune(bool? prune = true) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig() { - PruneValue = prune; - return Self; + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; } /// @@ -554,10 +514,10 @@ public SparseVectorQueryDescriptor Prune(bool? prune = true) /// If prune is set to true but pruning_config is not specified, default values will be used. /// /// - public SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? pruningConfig) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor PruningConfig(System.Action? action) { - PruningConfigValue = pruningConfig; - return Self; + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; } /// @@ -566,72 +526,23 @@ public SparseVectorQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.Q /// If inference_id is specified, query must also be specified. /// /// - public SparseVectorQueryDescriptor Query(string? query) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor Query(string? value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SparseVectorQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - public SparseVectorQueryDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id id) => Set(id, "inference_id"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - if (PruneValue.HasValue) - { - writer.WritePropertyName("prune"); - writer.WriteBooleanValue(PruneValue.Value); - } - - if (PruningConfigValue is not null) - { - writer.WritePropertyName("pruning_config"); - JsonSerializer.Serialize(writer, PruningConfigValue, options); - } - - if (!string.IsNullOrEmpty(QueryValue)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.SparseVectorQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs index 3a3e17909a0..90c9e99c82b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs @@ -17,105 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class TermQueryConverter : JsonConverter +internal sealed partial class TermQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override TermQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCaseInsensitive = System.Text.Json.JsonEncodedText.Encode("case_insensitive"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TermQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new TermQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Value = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCaseInsensitive = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propCaseInsensitive.TryReadProperty(ref reader, options, PropCaseInsensitive, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "case_insensitive") - { - variant.CaseInsensitive = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); reader.Read(); - return variant; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + CaseInsensitive = propCaseInsensitive.Value, + Field = propField.Value, + QueryName = propQueryName.Value, + Value = propValue.Value + }; } - public override void Write(Utf8JsonWriter writer, TermQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermQuery value, System.Text.Json.JsonSerializerOptions options) { - if (value.Field is null) - throw new JsonException("Unable to serialize TermQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); + writer.WritePropertyName(options, value.Field, null); writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } - - if (value.CaseInsensitive.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(value.CaseInsensitive.Value); - } - - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } - - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, value.Value, options); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCaseInsensitive, value.CaseInsensitive, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(TermQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermQueryConverter))] public sealed partial class TermQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public TermQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.FieldValue value) + { + Field = field; + Value = value; + } +#if NET7_0_OR_GREATER + public TermQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -133,7 +154,11 @@ public TermQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public bool? CaseInsensitive { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } /// @@ -141,27 +166,31 @@ public TermQuery(Elastic.Clients.Elasticsearch.Field field) /// Term you wish to find in the provided field. /// /// - public Elastic.Clients.Elasticsearch.FieldValue Value { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(TermQuery termQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Term(termQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Term(termQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Term(termQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Term(termQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.FieldValue Value { get; set; } } -public sealed partial class TermQueryDescriptor : SerializableDescriptor> +public readonly partial struct TermQueryDescriptor { - internal TermQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermQuery Instance { get; init; } - public TermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -171,10 +200,10 @@ public TermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -183,34 +212,28 @@ public TermQueryDescriptor Boost(float? boost) /// When false, the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public TermQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public TermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public TermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -218,57 +241,39 @@ public TermQueryDescriptor QueryName(string? queryName) /// Term you wish to find in the provided field. /// /// - public TermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermQueryDescriptor : SerializableDescriptor +public readonly partial struct TermQueryDescriptor { - internal TermQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermQuery Instance { get; init; } - public TermQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.FieldValue ValueValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -278,10 +283,10 @@ public TermQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -290,34 +295,28 @@ public TermQueryDescriptor Boost(float? boost) /// When false, the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public TermQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public TermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public TermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -325,40 +324,17 @@ public TermQueryDescriptor QueryName(string? queryName) /// Term you wish to find in the provided field. /// /// - public TermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) + public Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor Value(Elastic.Clients.Elasticsearch.FieldValue value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("value"); - JsonSerializer.Serialize(writer, ValueValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermRangeQuery.g.cs index 5e175e78f1b..c096df4a21a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermRangeQuery.g.cs @@ -17,144 +17,152 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class TermRangeQueryConverter : JsonConverter +internal sealed partial class TermRangeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override TermRangeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText PropGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText PropLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText PropLte = System.Text.Json.JsonEncodedText.Encode("lte"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new TermRangeQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFrom = default; + LocalJsonValue propGt = default; + LocalJsonValue propGte = default; + LocalJsonValue propLt = default; + LocalJsonValue propLte = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRelation = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gt") - { - variant.Gt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gte") - { - variant.Gte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lt") - { - variant.Lt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lte") - { - variant.Lte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "relation") - { - variant.Relation = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - reader.Read(); - return variant; - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, TermRangeQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize TermRangeQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propGt.TryReadProperty(ref reader, options, PropGt, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Gt)) - { - writer.WritePropertyName("gt"); - writer.WriteStringValue(value.Gt); - } + if (propGte.TryReadProperty(ref reader, options, PropGte, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Gte)) - { - writer.WritePropertyName("gte"); - writer.WriteStringValue(value.Gte); - } + if (propLt.TryReadProperty(ref reader, options, PropLt, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Lt)) - { - writer.WritePropertyName("lt"); - writer.WriteStringValue(value.Lt); - } + if (propLte.TryReadProperty(ref reader, options, PropLte, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Lte)) - { - writer.WritePropertyName("lte"); - writer.WriteStringValue(value.Lte); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.Relation is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, value.Relation, options); - } + Boost = propBoost.Value, + Field = propField.Value, + From = propFrom.Value, + Gt = propGt.Value, + Gte = propGte.Value, + Lt = propLt.Value, + Lte = propLte.Value, + QueryName = propQueryName.Value, + Relation = propRelation.Value, + To = propTo.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropGt, value.Gt, null, null); + writer.WriteProperty(options, PropGte, value.Gte, null, null); + writer.WriteProperty(options, PropLt, value.Lt, null, null); + writer.WriteProperty(options, PropLte, value.Lte, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(TermRangeQueryConverter))] -public sealed partial class TermRangeQuery +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryConverter))] +public sealed partial class TermRangeQuery : Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public TermRangeQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } +#if NET7_0_OR_GREATER + public TermRangeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// @@ -165,7 +173,12 @@ public TermRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + public string? From { get; set; } /// /// @@ -202,24 +215,29 @@ public TermRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? Relation { get; set; } + public string? To { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery.Type => "term"; } -public sealed partial class TermRangeQueryDescriptor : SerializableDescriptor> +public readonly partial struct TermRangeQueryDescriptor { - internal TermRangeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery instance) + { + Instance = instance; + } - public TermRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? GtValue { get; set; } - private string? GteValue { get; set; } - private string? LtValue { get; set; } - private string? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -229,28 +247,28 @@ public TermRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TermRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor From(string? value) { - FieldValue = field; - return Self; + Instance.From = value; + return this; } /// @@ -258,10 +276,10 @@ public TermRangeQueryDescriptor Field(Expression /// - public TermRangeQueryDescriptor Gt(string? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Gt(string? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -269,10 +287,10 @@ public TermRangeQueryDescriptor Gt(string? gt) /// Greater than or equal to. /// /// - public TermRangeQueryDescriptor Gte(string? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Gte(string? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -280,10 +298,10 @@ public TermRangeQueryDescriptor Gte(string? gte) /// Less than. /// /// - public TermRangeQueryDescriptor Lt(string? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Lt(string? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -291,16 +309,16 @@ public TermRangeQueryDescriptor Lt(string? lt) /// Less than or equal to. /// /// - public TermRangeQueryDescriptor Lte(string? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Lte(string? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public TermRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -308,82 +326,45 @@ public TermRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public TermRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor To(string? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(GtValue)) - { - writer.WritePropertyName("gt"); - writer.WriteStringValue(GtValue); - } - - if (!string.IsNullOrEmpty(GteValue)) - { - writer.WritePropertyName("gte"); - writer.WriteStringValue(GteValue); - } - - if (!string.IsNullOrEmpty(LtValue)) - { - writer.WritePropertyName("lt"); - writer.WriteStringValue(LtValue); - } - - if (!string.IsNullOrEmpty(LteValue)) - { - writer.WritePropertyName("lte"); - writer.WriteStringValue(LteValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermRangeQueryDescriptor : SerializableDescriptor +public readonly partial struct TermRangeQueryDescriptor { - internal TermRangeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery instance) + { + Instance = instance; + } - public TermRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? GtValue { get; set; } - private string? GteValue { get; set; } - private string? LtValue { get; set; } - private string? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -393,28 +374,28 @@ public TermRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TermRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor From(string? value) { - FieldValue = field; - return Self; + Instance.From = value; + return this; } /// @@ -422,10 +403,10 @@ public TermRangeQueryDescriptor Field(Expression /// - public TermRangeQueryDescriptor Gt(string? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Gt(string? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -433,10 +414,10 @@ public TermRangeQueryDescriptor Gt(string? gt) /// Greater than or equal to. /// /// - public TermRangeQueryDescriptor Gte(string? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Gte(string? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -444,10 +425,10 @@ public TermRangeQueryDescriptor Gte(string? gte) /// Less than. /// /// - public TermRangeQueryDescriptor Lt(string? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Lt(string? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -455,16 +436,16 @@ public TermRangeQueryDescriptor Lt(string? lt) /// Less than or equal to. /// /// - public TermRangeQueryDescriptor Lte(string? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Lte(string? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public TermRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -472,62 +453,23 @@ public TermRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public TermRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor To(string? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(GtValue)) - { - writer.WritePropertyName("gt"); - writer.WriteStringValue(GtValue); - } - - if (!string.IsNullOrEmpty(GteValue)) - { - writer.WritePropertyName("gte"); - writer.WriteStringValue(GteValue); - } - - if (!string.IsNullOrEmpty(LtValue)) - { - writer.WritePropertyName("lt"); - writer.WriteStringValue(LtValue); - } - - if (!string.IsNullOrEmpty(LteValue)) - { - writer.WritePropertyName("lte"); - writer.WriteStringValue(LteValue); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsLookup.g.cs index 66466c122fb..f69feabd664 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsLookup.g.cs @@ -17,160 +17,235 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class TermsLookupConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPath = System.Text.Json.JsonEncodedText.Encode("path"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPath = default; + LocalJsonValue propRouting = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPath.TryReadProperty(ref reader, options, PropPath, null)) + { + continue; + } + + if (propRouting.TryReadProperty(ref reader, options, PropRouting, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Index = propIndex.Value, + Path = propPath.Value, + Routing = propRouting.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPath, value.Path, null, null); + writer.WriteProperty(options, PropRouting, value.Routing, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupConverter))] public sealed partial class TermsLookup { - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.IndexName Index { get; set; } - [JsonInclude, JsonPropertyName("path")] - public Elastic.Clients.Elasticsearch.Field Path { get; set; } - [JsonInclude, JsonPropertyName("routing")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsLookup(Elastic.Clients.Elasticsearch.Id id, Elastic.Clients.Elasticsearch.IndexName index, Elastic.Clients.Elasticsearch.Field path) + { + Id = id; + Index = index; + Path = path; + } +#if NET7_0_OR_GREATER + public TermsLookup() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermsLookup() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.IndexName Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Path { get; set; } public Elastic.Clients.Elasticsearch.Routing? Routing { get; set; } } -public sealed partial class TermsLookupDescriptor : SerializableDescriptor> +public readonly partial struct TermsLookupDescriptor { - internal TermsLookupDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Instance { get; init; } - public TermsLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - - public TermsLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsLookupDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TermsLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IndexValue = index; - return Self; + Instance.Id = value; + return this; } - public TermsLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - PathValue = path; - return Self; + Instance.Index = value; + return this; } - public TermsLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public TermsLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public TermsLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermsLookupDescriptor : SerializableDescriptor +public readonly partial struct TermsLookupDescriptor { - internal TermsLookupDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Instance { get; init; } - public TermsLookupDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Field PathValue { get; set; } - private Elastic.Clients.Elasticsearch.Routing? RoutingValue { get; set; } - - public TermsLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsLookupDescriptor() { - IdValue = id; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public TermsLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IndexValue = index; - return Self; + Instance.Id = value; + return this; } - public TermsLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Index(Elastic.Clients.Elasticsearch.IndexName value) { - PathValue = path; - return Self; + Instance.Index = value; + return this; } - public TermsLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Path(Elastic.Clients.Elasticsearch.Field value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public TermsLookupDescriptor Path(Expression> path) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Path(System.Linq.Expressions.Expression> value) { - PathValue = path; - return Self; + Instance.Path = value; + return this; } - public TermsLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? routing) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor Routing(Elastic.Clients.Elasticsearch.Routing? value) { - RoutingValue = routing; - return Self; + Instance.Routing = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); - writer.WritePropertyName("path"); - JsonSerializer.Serialize(writer, PathValue, options); - if (RoutingValue is not null) - { - writer.WritePropertyName("routing"); - JsonSerializer.Serialize(writer, RoutingValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs index a56cf458603..ca8e81625c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs @@ -17,83 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class TermsQueryConverter : JsonConverter +internal sealed partial class TermsQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override TermsQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new TermsQuery(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Terms = JsonSerializer.Deserialize(ref reader, options); + continue; } - } - return variant; - } - - public override void Write(Utf8JsonWriter writer, TermsQuery value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Field is not null && value.Terms is not null) - { - if (!options.TryGetClientSettings(out var settings)) + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Terms, options); + propField.Initialized = propTerms.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propTerms.Value, null, null); } - if (value.Boost.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } - - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + Boost = propBoost.Value, + Field = propField.Value, + QueryName = propQueryName.Value, + Terms = propTerms.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, value.Field, value.Terms, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(TermsQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryConverter))] public sealed partial class TermsQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsQuery(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField terms) + { + Field = field; + Terms = terms; + } +#if NET7_0_OR_GREATER + public TermsQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermsQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -103,28 +106,37 @@ public sealed partial class TermsQuery /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Terms { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Terms(termsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Terms(termsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Terms(termsQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Terms(termsQuery); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Terms { get; set; } } -public sealed partial class TermsQueryDescriptor : SerializableDescriptor> +public readonly partial struct TermsQueryDescriptor { - internal TermsQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery Instance { get; init; } - public TermsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField TermsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -134,80 +146,69 @@ public TermsQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; + Instance.QueryName = value; + return this; } - public TermsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField value) { - QueryNameValue = queryName; - return Self; + Instance.Terms = value; + return this; } - public TermsQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField terms) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Terms(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField> action) { - TermsValue = terms; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null && TermsValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermsQueryDescriptor : SerializableDescriptor +public readonly partial struct TermsQueryDescriptor { - internal TermsQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery Instance { get; init; } - public TermsQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField TermsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -217,64 +218,53 @@ public TermsQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermsQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; + Instance.QueryName = value; + return this; } - public TermsQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField value) { - QueryNameValue = queryName; - return Self; + Instance.Terms = value; + return this; } - public TermsQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField terms) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Terms(System.Func action) { - TermsValue = terms; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor Terms(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField> action) { - writer.WriteStartObject(); - if (FieldValue is not null && TermsValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldFactory.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs index 3f56dc6eba9..dc9146ecff1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs @@ -17,26 +17,123 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class TermsQueryField : Union, Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup> +internal sealed partial class TermsQueryFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldConverter))] +public sealed partial class TermsQueryField : Elastic.Clients.Elasticsearch.Union, Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup> +{ + public TermsQueryField(System.Collections.Generic.ICollection value) : base(value) + { + } + + public TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(Elastic.Clients.Elasticsearch.FieldValue[] value) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup value) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); +} + +public readonly partial struct TermsQueryFieldFactory { - public TermsQueryField(IReadOnlyCollection Value) : base(Value) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Value(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Value(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField([.. values]); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Lookup(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Lookup(System.Action> action) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor.Build(action)); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Build(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldFactory(); + return action.Invoke(builder); + } +} + +public readonly partial struct TermsQueryFieldFactory +{ + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Value(System.Collections.Generic.ICollection value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Value(params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField([.. values]); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Lookup(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup value) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(value); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Lookup(System.Action action) + { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor.Build(action)); + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Lookup(System.Action> action) { + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookupDescriptor.Build(action)); } - public TermsQueryField(Elastic.Clients.Elasticsearch.QueryDsl.TermsLookup Lookup) : base(Lookup) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryFieldFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs index dab8941c77b..765975ada69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsSetQuery.g.cs @@ -17,129 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class TermsSetQueryConverter : JsonConverter +internal sealed partial class TermsSetQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override TermsSetQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatch = System.Text.Json.JsonEncodedText.Encode("minimum_should_match"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatchField = System.Text.Json.JsonEncodedText.Encode("minimum_should_match_field"); + private static readonly System.Text.Json.JsonEncodedText PropMinimumShouldMatchScript = System.Text.Json.JsonEncodedText.Encode("minimum_should_match_script"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new TermsSetQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propMinimumShouldMatch = default; + LocalJsonValue propMinimumShouldMatchField = default; + LocalJsonValue propMinimumShouldMatchScript = default; + LocalJsonValue propQueryName = default; + LocalJsonValue> propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "minimum_should_match") - { - variant.MinimumShouldMatch = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "minimum_should_match_field") - { - variant.MinimumShouldMatchField = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "minimum_should_match_script") - { - variant.MinimumShouldMatchScript = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "terms") - { - variant.Terms = JsonSerializer.Deserialize>(ref reader, options); - continue; - } + continue; } - } - reader.Read(); - return variant; - } + if (propMinimumShouldMatch.TryReadProperty(ref reader, options, PropMinimumShouldMatch, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, TermsSetQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize TermsSetQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propMinimumShouldMatchField.TryReadProperty(ref reader, options, PropMinimumShouldMatchField, null)) + { + continue; + } - if (value.MinimumShouldMatch is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, value.MinimumShouldMatch, options); - } + if (propMinimumShouldMatchScript.TryReadProperty(ref reader, options, PropMinimumShouldMatchScript, null)) + { + continue; + } - if (value.MinimumShouldMatchField is not null) - { - writer.WritePropertyName("minimum_should_match_field"); - JsonSerializer.Serialize(writer, value.MinimumShouldMatchField, options); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (value.MinimumShouldMatchScript is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, value.MinimumShouldMatchScript, options); + if (propTerms.TryReadProperty(ref reader, options, PropTerms, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.QueryName)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + Boost = propBoost.Value, + Field = propField.Value, + MinimumShouldMatch = propMinimumShouldMatch.Value, + MinimumShouldMatchField = propMinimumShouldMatchField.Value, + MinimumShouldMatchScript = propMinimumShouldMatchScript.Value, + QueryName = propQueryName.Value, + Terms = propTerms.Value + }; + } - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, value.Terms, options); + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropMinimumShouldMatch, value.MinimumShouldMatch, null, null); + writer.WriteProperty(options, PropMinimumShouldMatchField, value.MinimumShouldMatchField, null, null); + writer.WriteProperty(options, PropMinimumShouldMatchScript, value.MinimumShouldMatchScript, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(TermsSetQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryConverter))] public sealed partial class TermsSetQuery { + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public TermsSetQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsSetQuery(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection terms) + { + Field = field; + Terms = terms; + } +#if NET7_0_OR_GREATER + public TermsSetQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -149,7 +153,11 @@ public TermsSetQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -178,28 +186,31 @@ public TermsSetQuery(Elastic.Clients.Elasticsearch.Field field) /// Array of terms you wish to find in the provided field. /// /// - public ICollection Terms { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(TermsSetQuery termsSetQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.TermsSet(termsSetQuery); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Terms { get; set; } } -public sealed partial class TermsSetQueryDescriptor : SerializableDescriptor> +public readonly partial struct TermsSetQueryDescriptor { - internal TermsSetQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsSetQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery instance) + { + Instance = instance; + } - public TermsSetQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsSetQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? MinimumShouldMatchFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? MinimumShouldMatchScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor MinimumShouldMatchScriptDescriptor { get; set; } - private Action MinimumShouldMatchScriptDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private ICollection TermsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -209,28 +220,22 @@ public TermsSetQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermsSetQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public TermsSetQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsSetQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public TermsSetQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -238,10 +243,10 @@ public TermsSetQueryDescriptor Field(Expression /// - public TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -249,10 +254,10 @@ public TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Ela /// Numeric field containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Clients.Elasticsearch.Field? minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Clients.Elasticsearch.Field? value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchField = value; + return this; } /// @@ -260,21 +265,21 @@ public TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Client /// Numeric field containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Expression> minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchField(System.Linq.Expressions.Expression> value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchField = value; + return this; } /// /// - /// Numeric field containing the number of matching terms required to return a document. + /// Custom script containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Expression> minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.Script? value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchScript = value; + return this; } /// @@ -282,34 +287,38 @@ public TermsSetQueryDescriptor MinimumShouldMatchField(Expression /// - public TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.Script? minimumShouldMatchScript) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript() { - MinimumShouldMatchScriptDescriptor = null; - MinimumShouldMatchScriptDescriptorAction = null; - MinimumShouldMatchScriptValue = minimumShouldMatchScript; - return Self; + Instance.MinimumShouldMatchScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Custom script containing the number of matching terms required to return a document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript(System.Action? action) { - MinimumShouldMatchScriptValue = null; - MinimumShouldMatchScriptDescriptorAction = null; - MinimumShouldMatchScriptDescriptor = descriptor; - return Self; + Instance.MinimumShouldMatchScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TermsSetQueryDescriptor MinimumShouldMatchScript(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor QueryName(string? value) { - MinimumShouldMatchScriptValue = null; - MinimumShouldMatchScriptDescriptor = null; - MinimumShouldMatchScriptDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public TermsSetQueryDescriptor QueryName(string? queryName) + /// + /// + /// Array of terms you wish to find in the provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Terms(System.Collections.Generic.ICollection value) { - QueryNameValue = queryName; - return Self; + Instance.Terms = value; + return this; } /// @@ -317,83 +326,39 @@ public TermsSetQueryDescriptor QueryName(string? queryName) /// Array of terms you wish to find in the provided field. /// /// - public TermsSetQueryDescriptor Terms(ICollection terms) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Terms(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - TermsValue = terms; - return Self; + Instance.Terms = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MinimumShouldMatchFieldValue is not null) - { - writer.WritePropertyName("minimum_should_match_field"); - JsonSerializer.Serialize(writer, MinimumShouldMatchFieldValue, options); - } - - if (MinimumShouldMatchScriptDescriptor is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, MinimumShouldMatchScriptDescriptor, options); - } - else if (MinimumShouldMatchScriptDescriptorAction is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(MinimumShouldMatchScriptDescriptorAction), options); - } - else if (MinimumShouldMatchScriptValue is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, MinimumShouldMatchScriptValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermsSetQueryDescriptor : SerializableDescriptor +public readonly partial struct TermsSetQueryDescriptor { - internal TermsSetQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsSetQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery instance) + { + Instance = instance; + } - public TermsSetQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsSetQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.MinimumShouldMatch? MinimumShouldMatchValue { get; set; } - private Elastic.Clients.Elasticsearch.Field? MinimumShouldMatchFieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Script? MinimumShouldMatchScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor MinimumShouldMatchScriptDescriptor { get; set; } - private Action MinimumShouldMatchScriptDescriptorAction { get; set; } - private string? QueryNameValue { get; set; } - private ICollection TermsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -403,28 +368,22 @@ public TermsSetQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public TermsSetQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public TermsSetQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public TermsSetQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public TermsSetQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -432,10 +391,10 @@ public TermsSetQueryDescriptor Field(Expression /// - public TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? minimumShouldMatch) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch.MinimumShouldMatch? value) { - MinimumShouldMatchValue = minimumShouldMatch; - return Self; + Instance.MinimumShouldMatch = value; + return this; } /// @@ -443,10 +402,10 @@ public TermsSetQueryDescriptor MinimumShouldMatch(Elastic.Clients.Elasticsearch. /// Numeric field containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Clients.Elasticsearch.Field? minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Clients.Elasticsearch.Field? value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchField = value; + return this; } /// @@ -454,21 +413,21 @@ public TermsSetQueryDescriptor MinimumShouldMatchField(Elastic.Clients.Elasticse /// Numeric field containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Expression> minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchField(System.Linq.Expressions.Expression> value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchField = value; + return this; } /// /// - /// Numeric field containing the number of matching terms required to return a document. + /// Custom script containing the number of matching terms required to return a document. /// /// - public TermsSetQueryDescriptor MinimumShouldMatchField(Expression> minimumShouldMatchField) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.Script? value) { - MinimumShouldMatchFieldValue = minimumShouldMatchField; - return Self; + Instance.MinimumShouldMatchScript = value; + return this; } /// @@ -476,34 +435,38 @@ public TermsSetQueryDescriptor MinimumShouldMatchField(Expression /// - public TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.Script? minimumShouldMatchScript) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript() { - MinimumShouldMatchScriptDescriptor = null; - MinimumShouldMatchScriptDescriptorAction = null; - MinimumShouldMatchScriptValue = minimumShouldMatchScript; - return Self; + Instance.MinimumShouldMatchScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public TermsSetQueryDescriptor MinimumShouldMatchScript(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// Custom script containing the number of matching terms required to return a document. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor MinimumShouldMatchScript(System.Action? action) { - MinimumShouldMatchScriptValue = null; - MinimumShouldMatchScriptDescriptorAction = null; - MinimumShouldMatchScriptDescriptor = descriptor; - return Self; + Instance.MinimumShouldMatchScript = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public TermsSetQueryDescriptor MinimumShouldMatchScript(Action configure) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor QueryName(string? value) { - MinimumShouldMatchScriptValue = null; - MinimumShouldMatchScriptDescriptor = null; - MinimumShouldMatchScriptDescriptorAction = configure; - return Self; + Instance.QueryName = value; + return this; } - public TermsSetQueryDescriptor QueryName(string? queryName) + /// + /// + /// Array of terms you wish to find in the provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Terms(System.Collections.Generic.ICollection value) { - QueryNameValue = queryName; - return Self; + Instance.Terms = value; + return this; } /// @@ -511,62 +474,17 @@ public TermsSetQueryDescriptor QueryName(string? queryName) /// Array of terms you wish to find in the provided field. /// /// - public TermsSetQueryDescriptor Terms(ICollection terms) + public Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor Terms(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - TermsValue = terms; - return Self; + Instance.Terms = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (MinimumShouldMatchValue is not null) - { - writer.WritePropertyName("minimum_should_match"); - JsonSerializer.Serialize(writer, MinimumShouldMatchValue, options); - } - - if (MinimumShouldMatchFieldValue is not null) - { - writer.WritePropertyName("minimum_should_match_field"); - JsonSerializer.Serialize(writer, MinimumShouldMatchFieldValue, options); - } - - if (MinimumShouldMatchScriptDescriptor is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, MinimumShouldMatchScriptDescriptor, options); - } - else if (MinimumShouldMatchScriptDescriptorAction is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(MinimumShouldMatchScriptDescriptorAction), options); - } - else if (MinimumShouldMatchScriptValue is not null) - { - writer.WritePropertyName("minimum_should_match_script"); - JsonSerializer.Serialize(writer, MinimumShouldMatchScriptValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TermsSetQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TextExpansionQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TextExpansionQuery.g.cs new file mode 100644 index 00000000000..5af194ed7b9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TextExpansionQuery.g.cs @@ -0,0 +1,413 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class TextExpansionQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelText = System.Text.Json.JsonEncodedText.Encode("model_text"); + private static readonly System.Text.Json.JsonEncodedText PropPruningConfig = System.Text.Json.JsonEncodedText.Encode("pruning_config"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + reader.Read(); + propField.ReadPropertyName(ref reader, options, null); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propModelId = default; + LocalJsonValue propModelText = default; + LocalJsonValue propPruningConfig = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propModelText.TryReadProperty(ref reader, options, PropModelText, null)) + { + continue; + } + + if (propPruningConfig.TryReadProperty(ref reader, options, PropPruningConfig, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + ModelId = propModelId.Value, + ModelText = propModelText.Value, + PruningConfig = propPruningConfig.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropModelText, value.ModelText, null, null); + writer.WriteProperty(options, PropPruningConfig, value.PruningConfig, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryConverter))] +public sealed partial class TextExpansionQuery +{ + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextExpansionQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionQuery(Elastic.Clients.Elasticsearch.Field field, string modelId, string modelText) + { + Field = field; + ModelId = modelId; + ModelText = modelText; + } +#if NET7_0_OR_GREATER + public TextExpansionQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + + /// + /// + /// The text expansion NLP model to use + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + + /// + /// + /// The query text + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string ModelText { get; set; } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? PruningConfig { get; set; } + public string? QueryName { get; set; } +} + +public readonly partial struct TextExpansionQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The text expansion NLP model to use + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The query text + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor ModelText(string value) + { + Instance.ModelText = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) + { + Instance.PruningConfig = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig() + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig(System.Action? action) + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct TextExpansionQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextExpansionQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// The text expansion NLP model to use + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor ModelId(string value) + { + Instance.ModelId = value; + return this; + } + + /// + /// + /// The query text + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor ModelText(string value) + { + Instance.ModelText = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) + { + Instance.PruningConfig = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig() + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor PruningConfig(System.Action? action) + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TextExpansionQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TokenPruningConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TokenPruningConfig.g.cs index 01f8b4e9499..6d7eda07928 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TokenPruningConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TokenPruningConfig.g.cs @@ -17,24 +17,93 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class TokenPruningConfigConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOnlyScorePrunedTokens = System.Text.Json.JsonEncodedText.Encode("only_score_pruned_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropTokensFreqRatioThreshold = System.Text.Json.JsonEncodedText.Encode("tokens_freq_ratio_threshold"); + private static readonly System.Text.Json.JsonEncodedText PropTokensWeightThreshold = System.Text.Json.JsonEncodedText.Encode("tokens_weight_threshold"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOnlyScorePrunedTokens = default; + LocalJsonValue propTokensFreqRatioThreshold = default; + LocalJsonValue propTokensWeightThreshold = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOnlyScorePrunedTokens.TryReadProperty(ref reader, options, PropOnlyScorePrunedTokens, null)) + { + continue; + } + + if (propTokensFreqRatioThreshold.TryReadProperty(ref reader, options, PropTokensFreqRatioThreshold, null)) + { + continue; + } + + if (propTokensWeightThreshold.TryReadProperty(ref reader, options, PropTokensWeightThreshold, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + OnlyScorePrunedTokens = propOnlyScorePrunedTokens.Value, + TokensFreqRatioThreshold = propTokensFreqRatioThreshold.Value, + TokensWeightThreshold = propTokensWeightThreshold.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOnlyScorePrunedTokens, value.OnlyScorePrunedTokens, null, null); + writer.WriteProperty(options, PropTokensFreqRatioThreshold, value.TokensFreqRatioThreshold, null, null); + writer.WriteProperty(options, PropTokensWeightThreshold, value.TokensWeightThreshold, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigConverter))] public sealed partial class TokenPruningConfig { +#if NET7_0_OR_GREATER + public TokenPruningConfig() + { + } +#endif +#if !NET7_0_OR_GREATER + public TokenPruningConfig() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TokenPruningConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Whether to only score pruned tokens, vs only scoring kept tokens. /// /// - [JsonInclude, JsonPropertyName("only_score_pruned_tokens")] public bool? OnlyScorePrunedTokens { get; set; } /// @@ -42,7 +111,6 @@ public sealed partial class TokenPruningConfig /// Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned. /// /// - [JsonInclude, JsonPropertyName("tokens_freq_ratio_threshold")] public int? TokensFreqRatioThreshold { get; set; } /// @@ -50,31 +118,37 @@ public sealed partial class TokenPruningConfig /// Tokens whose weight is less than this threshold are considered nonsignificant and pruned. /// /// - [JsonInclude, JsonPropertyName("tokens_weight_threshold")] public float? TokensWeightThreshold { get; set; } } -public sealed partial class TokenPruningConfigDescriptor : SerializableDescriptor +public readonly partial struct TokenPruningConfigDescriptor { - internal TokenPruningConfigDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenPruningConfigDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig instance) + { + Instance = instance; + } - public TokenPruningConfigDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TokenPruningConfigDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? OnlyScorePrunedTokensValue { get; set; } - private int? TokensFreqRatioThresholdValue { get; set; } - private float? TokensWeightThresholdValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor descriptor) => descriptor.Instance; /// /// /// Whether to only score pruned tokens, vs only scoring kept tokens. /// /// - public TokenPruningConfigDescriptor OnlyScorePrunedTokens(bool? onlyScorePrunedTokens = true) + public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor OnlyScorePrunedTokens(bool? value = true) { - OnlyScorePrunedTokensValue = onlyScorePrunedTokens; - return Self; + Instance.OnlyScorePrunedTokens = value; + return this; } /// @@ -82,10 +156,10 @@ public TokenPruningConfigDescriptor OnlyScorePrunedTokens(bool? onlyScorePrunedT /// Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned. /// /// - public TokenPruningConfigDescriptor TokensFreqRatioThreshold(int? tokensFreqRatioThreshold) + public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor TokensFreqRatioThreshold(int? value) { - TokensFreqRatioThresholdValue = tokensFreqRatioThreshold; - return Self; + Instance.TokensFreqRatioThreshold = value; + return this; } /// @@ -93,33 +167,22 @@ public TokenPruningConfigDescriptor TokensFreqRatioThreshold(int? tokensFreqRati /// Tokens whose weight is less than this threshold are considered nonsignificant and pruned. /// /// - public TokenPruningConfigDescriptor TokensWeightThreshold(float? tokensWeightThreshold) + public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor TokensWeightThreshold(float? value) { - TokensWeightThresholdValue = tokensWeightThreshold; - return Self; + Instance.TokensWeightThreshold = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig Build(System.Action? action) { - writer.WriteStartObject(); - if (OnlyScorePrunedTokensValue.HasValue) - { - writer.WritePropertyName("only_score_pruned_tokens"); - writer.WriteBooleanValue(OnlyScorePrunedTokensValue.Value); - } - - if (TokensFreqRatioThresholdValue.HasValue) + if (action is null) { - writer.WritePropertyName("tokens_freq_ratio_threshold"); - writer.WriteNumberValue(TokensFreqRatioThresholdValue.Value); + return new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TokensWeightThresholdValue.HasValue) - { - writer.WritePropertyName("tokens_weight_threshold"); - writer.WriteNumberValue(TokensWeightThresholdValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TypeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TypeQuery.g.cs new file mode 100644 index 00000000000..527d9d711b2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TypeQuery.g.cs @@ -0,0 +1,177 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class TypeQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + QueryName = propQueryName.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryConverter))] +public sealed partial class TypeQuery +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeQuery(string value) + { + Value = value; + } +#if NET7_0_OR_GREATER + public TypeQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TypeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TypeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public string? QueryName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Value { get; set; } +} + +public readonly partial struct TypeQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TypeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery(Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor Value(string value) + { + Instance.Value = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.TypeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.TypeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDecayFunction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDecayFunction.g.cs index 0972c6b4a4a..4e7f947ae19 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDecayFunction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDecayFunction.g.cs @@ -17,72 +17,82 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class UntypedDecayFunctionConverter : JsonConverter +internal sealed partial class UntypedDecayFunctionConverter : System.Text.Json.Serialization.JsonConverter { - public override UntypedDecayFunction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new UntypedDecayFunction(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var property = reader.GetString(); - if (property == "multi_value_mode") - { - variant.MultiValueMode = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - variant.Field = property; - reader.Read(); - variant.Placement = JsonSerializer.Deserialize>(ref reader, options); - } - } - - return variant; - } + private static readonly System.Text.Json.JsonEncodedText PropMultiValueMode = System.Text.Json.JsonEncodedText.Encode("multi_value_mode"); - public override void Write(Utf8JsonWriter writer, UntypedDecayFunction value, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - writer.WriteStartObject(); - if (value.Field is not null && value.Placement is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMultiValueMode = default; + LocalJsonValue> propPlacement = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (!options.TryGetClientSettings(out var settings)) + if (propMultiValueMode.TryReadProperty(ref reader, options, PropMultiValueMode, null)) { - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + continue; } - var propertyName = settings.Inferrer.Field(value.Field); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, value.Placement, options); + propField.Initialized = propPlacement.Initialized = true; + reader.ReadProperty(options, out propField.Value, out propPlacement.Value, null, null); } - if (value.MultiValueMode is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, value.MultiValueMode, options); - } + Field = propField.Value, + MultiValueMode = propMultiValueMode.Value, + Placement = propPlacement.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMultiValueMode, value.MultiValueMode, null, null); + writer.WriteProperty(options, value.Field, value.Placement, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(UntypedDecayFunctionConverter))] -public sealed partial class UntypedDecayFunction +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionConverter))] +public sealed partial class UntypedDecayFunction : Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction { - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDecayFunction(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + { + Field = field; + Placement = placement; + } +#if NET7_0_OR_GREATER + public UntypedDecayFunction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UntypedDecayFunction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -90,37 +100,44 @@ public sealed partial class UntypedDecayFunction /// /// public Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueMode { get; set; } - public Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement Placement { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDecayFunction.Type => "untyped"; } -public sealed partial class UntypedDecayFunctionDescriptor : SerializableDescriptor> +public readonly partial struct UntypedDecayFunctionDescriptor { - internal UntypedDecayFunctionDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction Instance { get; init; } - public UntypedDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public UntypedDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public UntypedDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public UntypedDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -128,66 +145,68 @@ public UntypedDecayFunctionDescriptor Field(Expression /// - public UntypedDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public UntypedDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UntypedDecayFunctionDescriptor : SerializableDescriptor +public readonly partial struct UntypedDecayFunctionDescriptor { - internal UntypedDecayFunctionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction Instance { get; init; } - public UntypedDecayFunctionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? MultiValueModeValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement PlacementValue { get; set; } - - public UntypedDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDecayFunctionDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public UntypedDecayFunctionDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public UntypedDecayFunctionDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -195,34 +214,35 @@ public UntypedDecayFunctionDescriptor Field(Expression /// - public UntypedDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? multiValueMode) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor MultiValueMode(Elastic.Clients.Elasticsearch.QueryDsl.MultiValueMode? value) { - MultiValueModeValue = multiValueMode; - return Self; + Instance.MultiValueMode = value; + return this; } - public UntypedDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement placement) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement(Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement value) { - PlacementValue = placement; - return Self; + Instance.Placement = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement() { - writer.WriteStartObject(); - if (FieldValue is not null && PlacementValue is not null) - { - var propertyName = settings.Inferrer.Field(FieldValue); - writer.WritePropertyName(propertyName); - JsonSerializer.Serialize(writer, PlacementValue, options); - } + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor.Build(null); + return this; + } - if (MultiValueModeValue is not null) - { - writer.WritePropertyName("multi_value_mode"); - JsonSerializer.Serialize(writer, MultiValueModeValue, options); - } + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor Placement(System.Action? action) + { + Instance.Placement = Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacementOfObjectObjectDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunctionDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDecayFunction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDistanceFeatureQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDistanceFeatureQuery.g.cs index 728ae35facf..3ee0b466432 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDistanceFeatureQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedDistanceFeatureQuery.g.cs @@ -17,18 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -public sealed partial class UntypedDistanceFeatureQuery +internal sealed partial class UntypedDistanceFeatureQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropOrigin = System.Text.Json.JsonEncodedText.Encode("origin"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propField = default; + LocalJsonValue propOrigin = default; + LocalJsonValue propPivot = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propOrigin.TryReadProperty(ref reader, options, PropOrigin, null)) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + Origin = propOrigin.Value, + Pivot = propPivot.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropOrigin, value.Origin, null, null); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryConverter))] +public sealed partial class UntypedDistanceFeatureQuery : Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Field field, object origin, object pivot) + { + Field = field; + Origin = origin; + Pivot = pivot; + } +#if NET7_0_OR_GREATER + public UntypedDistanceFeatureQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UntypedDistanceFeatureQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +133,6 @@ public sealed partial class UntypedDistanceFeatureQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -48,8 +143,11 @@ public sealed partial class UntypedDistanceFeatureQuery /// have an doc_values mapping parameter value of true, which is the default. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -59,8 +157,11 @@ public sealed partial class UntypedDistanceFeatureQuery /// If the field value is a geo_point field, the origin value must be a geopoint. /// /// - [JsonInclude, JsonPropertyName("origin")] - public object Origin { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Origin { get; set; } /// /// @@ -68,25 +169,34 @@ public sealed partial class UntypedDistanceFeatureQuery /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - [JsonInclude, JsonPropertyName("pivot")] - public object Pivot { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + object Pivot { get; set; } public string? QueryName { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IDistanceFeatureQuery.Type => "untyped"; } -public sealed partial class UntypedDistanceFeatureQueryDescriptor : SerializableDescriptor> +public readonly partial struct UntypedDistanceFeatureQueryDescriptor { - internal UntypedDistanceFeatureQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery Instance { get; init; } - public UntypedDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private object OriginValue { get; set; } - private object PivotValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDistanceFeatureQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,10 +206,10 @@ public UntypedDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public UntypedDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -110,10 +220,10 @@ public UntypedDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -124,24 +234,10 @@ public UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.El /// have an doc_values mapping parameter value of true, which is the default. /// /// - public UntypedDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - /// - /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. - /// - /// - public UntypedDistanceFeatureQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -152,10 +248,10 @@ public UntypedDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public UntypedDistanceFeatureQueryDescriptor Origin(object origin) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Origin(object value) { - OriginValue = origin; - return Self; + Instance.Origin = value; + return this; } /// @@ -164,56 +260,45 @@ public UntypedDistanceFeatureQueryDescriptor Origin(object origin) /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public UntypedDistanceFeatureQueryDescriptor Pivot(object pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Pivot(object value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public UntypedDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery Build(System.Action> action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UntypedDistanceFeatureQueryDescriptor : SerializableDescriptor +public readonly partial struct UntypedDistanceFeatureQueryDescriptor { - internal UntypedDistanceFeatureQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery Instance { get; init; } - public UntypedDistanceFeatureQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private object OriginValue { get; set; } - private object PivotValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedDistanceFeatureQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -223,10 +308,10 @@ public UntypedDistanceFeatureQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public UntypedDistanceFeatureQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -237,10 +322,10 @@ public UntypedDistanceFeatureQueryDescriptor Boost(float? boost) /// have an doc_values mapping parameter value of true, which is the default. /// /// - public UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -251,24 +336,10 @@ public UntypedDistanceFeatureQueryDescriptor Field(Elastic.Clients.Elasticsearch /// have an doc_values mapping parameter value of true, which is the default. /// /// - public UntypedDistanceFeatureQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - /// - /// - /// Name of the field used to calculate distances. This field must meet the following criteria: - /// be a date, date_nanos or geo_point field; - /// have an index mapping parameter value of true, which is the default; - /// have an doc_values mapping parameter value of true, which is the default. - /// - /// - public UntypedDistanceFeatureQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -279,10 +350,10 @@ public UntypedDistanceFeatureQueryDescriptor Field(Expressiongeo_point field, the origin value must be a geopoint. /// /// - public UntypedDistanceFeatureQueryDescriptor Origin(object origin) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Origin(object value) { - OriginValue = origin; - return Self; + Instance.Origin = value; + return this; } /// @@ -291,39 +362,23 @@ public UntypedDistanceFeatureQueryDescriptor Origin(object origin) /// If the field value is a date or date_nanos field, the pivot value must be a time unit, such as 1h or 10d. If the field value is a geo_point field, the pivot value must be a distance unit, such as 1km or 12m. /// /// - public UntypedDistanceFeatureQueryDescriptor Pivot(object pivot) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor Pivot(object value) { - PivotValue = pivot; - return Self; + Instance.Pivot = value; + return this; } - public UntypedDistanceFeatureQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("origin"); - JsonSerializer.Serialize(writer, OriginValue, options); - writer.WritePropertyName("pivot"); - JsonSerializer.Serialize(writer, PivotValue, options); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedDistanceFeatureQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedRangeQuery.g.cs index 582463372a6..77bc5431175 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedRangeQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/UntypedRangeQuery.g.cs @@ -17,168 +17,170 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class UntypedRangeQueryConverter : JsonConverter +internal sealed partial class UntypedRangeQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override UntypedRangeQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropFrom = System.Text.Json.JsonEncodedText.Encode("from"); + private static readonly System.Text.Json.JsonEncodedText PropGt = System.Text.Json.JsonEncodedText.Encode("gt"); + private static readonly System.Text.Json.JsonEncodedText PropGte = System.Text.Json.JsonEncodedText.Encode("gte"); + private static readonly System.Text.Json.JsonEncodedText PropLt = System.Text.Json.JsonEncodedText.Encode("lt"); + private static readonly System.Text.Json.JsonEncodedText PropLte = System.Text.Json.JsonEncodedText.Encode("lte"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + private static readonly System.Text.Json.JsonEncodedText PropTo = System.Text.Json.JsonEncodedText.Encode("to"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new UntypedRangeQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propFormat = default; + LocalJsonValue propFrom = default; + LocalJsonValue propGt = default; + LocalJsonValue propGte = default; + LocalJsonValue propLt = default; + LocalJsonValue propLte = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRelation = default; + LocalJsonValue propTimeZone = default; + LocalJsonValue propTo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "format") - { - variant.Format = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gt") - { - variant.Gt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "gte") - { - variant.Gte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lt") - { - variant.Lt = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "lte") - { - variant.Lte = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "relation") - { - variant.Relation = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "time_zone") - { - variant.TimeZone = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - reader.Read(); - return variant; - } + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, UntypedRangeQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize UntypedRangeQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propFrom.TryReadProperty(ref reader, options, PropFrom, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Format)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(value.Format); - } + if (propGt.TryReadProperty(ref reader, options, PropGt, null)) + { + continue; + } - if (value.Gt is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, value.Gt, options); - } + if (propGte.TryReadProperty(ref reader, options, PropGte, null)) + { + continue; + } - if (value.Gte is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, value.Gte, options); - } + if (propLt.TryReadProperty(ref reader, options, PropLt, null)) + { + continue; + } - if (value.Lt is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, value.Lt, options); - } + if (propLte.TryReadProperty(ref reader, options, PropLte, null)) + { + continue; + } - if (value.Lte is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, value.Lte, options); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } - if (value.Relation is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, value.Relation, options); + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (propTo.TryReadProperty(ref reader, options, PropTo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.TimeZone)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(value.TimeZone); - } + Boost = propBoost.Value, + Field = propField.Value, + Format = propFormat.Value, + From = propFrom.Value, + Gt = propGt.Value, + Gte = propGte.Value, + Lt = propLt.Value, + Lte = propLte.Value, + QueryName = propQueryName.Value, + Relation = propRelation.Value, + TimeZone = propTimeZone.Value, + To = propTo.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropFrom, value.From, null, null); + writer.WriteProperty(options, PropGt, value.Gt, null, null); + writer.WriteProperty(options, PropGte, value.Gte, null, null); + writer.WriteProperty(options, PropLt, value.Lt, null, null); + writer.WriteProperty(options, PropLte, value.Lte, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteProperty(options, PropTo, value.To, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(UntypedRangeQueryConverter))] -public sealed partial class UntypedRangeQuery +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryConverter))] +public sealed partial class UntypedRangeQuery : Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public UntypedRangeQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } +#if NET7_0_OR_GREATER + public UntypedRangeQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// @@ -189,7 +191,11 @@ public UntypedRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public float? Boost { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -197,6 +203,7 @@ public UntypedRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public string? Format { get; set; } + public object? From { get; set; } /// /// @@ -240,26 +247,29 @@ public UntypedRangeQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public string? TimeZone { get; set; } + public object? To { get; set; } + + string Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery.Type => "untyped"; } -public sealed partial class UntypedRangeQueryDescriptor : SerializableDescriptor> +public readonly partial struct UntypedRangeQueryDescriptor { - internal UntypedRangeQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery Instance { get; init; } - public UntypedRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private object? GtValue { get; set; } - private object? GteValue { get; set; } - private object? LtValue { get; set; } - private object? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } - private string? TimeZoneValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedRangeQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -269,28 +279,22 @@ public UntypedRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public UntypedRangeQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } - public UntypedRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public UntypedRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - public UntypedRangeQueryDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -298,10 +302,16 @@ public UntypedRangeQueryDescriptor Field(Expressiondate values in the query. /// /// - public UntypedRangeQueryDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Format(string? value) + { + Instance.Format = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor From(object? value) { - FormatValue = format; - return Self; + Instance.From = value; + return this; } /// @@ -309,10 +319,10 @@ public UntypedRangeQueryDescriptor Format(string? format) /// Greater than. /// /// - public UntypedRangeQueryDescriptor Gt(object? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Gt(object? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -320,10 +330,10 @@ public UntypedRangeQueryDescriptor Gt(object? gt) /// Greater than or equal to. /// /// - public UntypedRangeQueryDescriptor Gte(object? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Gte(object? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -331,10 +341,10 @@ public UntypedRangeQueryDescriptor Gte(object? gte) /// Less than. /// /// - public UntypedRangeQueryDescriptor Lt(object? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Lt(object? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -342,16 +352,16 @@ public UntypedRangeQueryDescriptor Lt(object? lt) /// Less than or equal to. /// /// - public UntypedRangeQueryDescriptor Lte(object? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Lte(object? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public UntypedRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -359,10 +369,10 @@ public UntypedRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -370,96 +380,45 @@ public UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticse /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query to UTC. /// /// - public UntypedRangeQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor To(object? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GtValue is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, GtValue, options); - } - - if (GteValue is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, GteValue, options); - } - - if (LtValue is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, LtValue, options); - } - - if (LteValue is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, LteValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class UntypedRangeQueryDescriptor : SerializableDescriptor +public readonly partial struct UntypedRangeQueryDescriptor { - internal UntypedRangeQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery instance) + { + Instance = instance; + } - public UntypedRangeQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UntypedRangeQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? FormatValue { get; set; } - private object? GtValue { get; set; } - private object? GteValue { get; set; } - private object? LtValue { get; set; } - private object? LteValue { get; set; } - private string? QueryNameValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -469,28 +428,22 @@ public UntypedRangeQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public UntypedRangeQueryDescriptor Boost(float? boost) - { - BoostValue = boost; - return Self; - } - - public UntypedRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Boost(float? value) { - FieldValue = field; - return Self; + Instance.Boost = value; + return this; } - public UntypedRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public UntypedRangeQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -498,10 +451,16 @@ public UntypedRangeQueryDescriptor Field(Expressiondate values in the query. /// /// - public UntypedRangeQueryDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor From(object? value) + { + Instance.From = value; + return this; } /// @@ -509,10 +468,10 @@ public UntypedRangeQueryDescriptor Format(string? format) /// Greater than. /// /// - public UntypedRangeQueryDescriptor Gt(object? gt) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Gt(object? value) { - GtValue = gt; - return Self; + Instance.Gt = value; + return this; } /// @@ -520,10 +479,10 @@ public UntypedRangeQueryDescriptor Gt(object? gt) /// Greater than or equal to. /// /// - public UntypedRangeQueryDescriptor Gte(object? gte) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Gte(object? value) { - GteValue = gte; - return Self; + Instance.Gte = value; + return this; } /// @@ -531,10 +490,10 @@ public UntypedRangeQueryDescriptor Gte(object? gte) /// Less than. /// /// - public UntypedRangeQueryDescriptor Lt(object? lt) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Lt(object? value) { - LtValue = lt; - return Self; + Instance.Lt = value; + return this; } /// @@ -542,16 +501,16 @@ public UntypedRangeQueryDescriptor Lt(object? lt) /// Less than or equal to. /// /// - public UntypedRangeQueryDescriptor Lte(object? lte) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Lte(object? value) { - LteValue = lte; - return Self; + Instance.Lte = value; + return this; } - public UntypedRangeQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -559,10 +518,10 @@ public UntypedRangeQueryDescriptor QueryName(string? queryName) /// Indicates how the range query matches values for range fields. /// /// - public UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? value) { - RelationValue = relation; - return Self; + Instance.Relation = value; + return this; } /// @@ -570,74 +529,23 @@ public UntypedRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryD /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query to UTC. /// /// - public UntypedRangeQueryDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor To(object? value) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (GtValue is not null) - { - writer.WritePropertyName("gt"); - JsonSerializer.Serialize(writer, GtValue, options); - } - - if (GteValue is not null) - { - writer.WritePropertyName("gte"); - JsonSerializer.Serialize(writer, GteValue, options); - } - - if (LtValue is not null) - { - writer.WritePropertyName("lt"); - JsonSerializer.Serialize(writer, LtValue, options); - } - - if (LteValue is not null) - { - writer.WritePropertyName("lte"); - JsonSerializer.Serialize(writer, LteValue, options); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (RelationValue is not null) - { - writer.WritePropertyName("relation"); - JsonSerializer.Serialize(writer, RelationValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } + Instance.To = value; + return this; + } - writer.WriteEndObject(); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WeightedTokensQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WeightedTokensQuery.g.cs new file mode 100644 index 00000000000..387bd281b0c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WeightedTokensQuery.g.cs @@ -0,0 +1,428 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.QueryDsl; + +internal sealed partial class WeightedTokensQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropPruningConfig = System.Text.Json.JsonEncodedText.Encode("pruning_config"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropTokens = System.Text.Json.JsonEncodedText.Encode("tokens"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + reader.Read(); + propField.ReadPropertyName(ref reader, options, null); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propPruningConfig = default; + LocalJsonValue propQueryName = default; + LocalJsonValue> propTokens = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propPruningConfig.TryReadProperty(ref reader, options, PropPruningConfig, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (propTokens.TryReadProperty(ref reader, options, PropTokens, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Field = propField.Value, + PruningConfig = propPruningConfig.Value, + QueryName = propQueryName.Value, + Tokens = propTokens.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropPruningConfig, value.PruningConfig, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropTokens, value.Tokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryConverter))] +public sealed partial class WeightedTokensQuery +{ + [System.Obsolete("The type contains additional required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WeightedTokensQuery(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedTokensQuery(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.IDictionary tokens) + { + Field = field; + Tokens = tokens; + } +#if NET7_0_OR_GREATER + public WeightedTokensQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public float? Boost { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? PruningConfig { get; set; } + public string? QueryName { get; set; } + + /// + /// + /// The tokens representing this query + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IDictionary Tokens { get; set; } +} + +public readonly partial struct WeightedTokensQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedTokensQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedTokensQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) + { + Instance.PruningConfig = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig() + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig(System.Action? action) + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens(System.Collections.Generic.IDictionary value) + { + Instance.Tokens = value; + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens() + { + Instance.Tokens = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat.Build(null); + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens(System.Action? action) + { + Instance.Tokens = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor AddToken(string key, float value) + { + Instance.Tokens ??= new System.Collections.Generic.Dictionary(); + Instance.Tokens.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct WeightedTokensQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedTokensQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WeightedTokensQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Floating point number used to decrease or increase the relevance scores of the query. + /// Boost values are relative to the default value of 1.0. + /// A boost value between 0 and 1.0 decreases the relevance score. + /// A value greater than 1.0 increases the relevance score. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Boost(float? value) + { + Instance.Boost = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Field(System.Linq.Expressions.Expression> value) + { + Instance.Field = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig(Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfig? value) + { + Instance.PruningConfig = value; + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig() + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(null); + return this; + } + + /// + /// + /// Token pruning configurations + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor PruningConfig(System.Action? action) + { + Instance.PruningConfig = Elastic.Clients.Elasticsearch.QueryDsl.TokenPruningConfigDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor QueryName(string? value) + { + Instance.QueryName = value; + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens(System.Collections.Generic.IDictionary value) + { + Instance.Tokens = value; + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens() + { + Instance.Tokens = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat.Build(null); + return this; + } + + /// + /// + /// The tokens representing this query + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor Tokens(System.Action? action) + { + Instance.Tokens = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringFloat.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor AddToken(string key, float value) + { + Instance.Tokens ??= new System.Collections.Generic.Dictionary(); + Instance.Tokens.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.WeightedTokensQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs index 5b449de8d98..f3aa63bca5c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs @@ -17,132 +17,136 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; -internal sealed partial class WildcardQueryConverter : JsonConverter +internal sealed partial class WildcardQueryConverter : System.Text.Json.Serialization.JsonConverter { - public override WildcardQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropCaseInsensitive = System.Text.Json.JsonEncodedText.Encode("case_insensitive"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + private static readonly System.Text.Json.JsonEncodedText PropRewrite = System.Text.Json.JsonEncodedText.Encode("rewrite"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + private static readonly System.Text.Json.JsonEncodedText PropWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; reader.Read(); - var fieldName = reader.GetString(); + propField.ReadPropertyName(ref reader, options, null); reader.Read(); - var variant = new WildcardQuery(fieldName); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) { - if (reader.TokenType == JsonTokenType.PropertyName) + var value = reader.ReadValue(options, null); + reader.Read(); + return new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - var property = reader.GetString(); - if (property == "boost") - { - variant.Boost = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "case_insensitive") - { - variant.CaseInsensitive = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_name") - { - variant.QueryName = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "rewrite") - { - variant.Rewrite = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "value") - { - variant.Value = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "wildcard") - { - variant.Wildcard = JsonSerializer.Deserialize(ref reader, options); - continue; - } - } + Field = propField.Value, + Value = value + }; } - reader.Read(); - return variant; - } - - public override void Write(Utf8JsonWriter writer, WildcardQuery value, JsonSerializerOptions options) - { - if (value.Field is null) - throw new JsonException("Unable to serialize WildcardQuery because the `Field` property is not set. Field name queries must include a valid field name."); - if (!options.TryGetClientSettings(out var settings)) - throw new JsonException("Unable to retrieve client settings required to infer field."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(value.Field)); - writer.WriteStartObject(); - if (value.Boost.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propCaseInsensitive = default; + LocalJsonValue propQueryName = default; + LocalJsonValue propRewrite = default; + LocalJsonValue propValue = default; + LocalJsonValue propWildcard = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(value.Boost.Value); - } + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } - if (value.CaseInsensitive.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(value.CaseInsensitive.Value); - } + if (propCaseInsensitive.TryReadProperty(ref reader, options, PropCaseInsensitive, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.QueryName)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(value.QueryName); - } + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Rewrite)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(value.Rewrite); - } + if (propRewrite.TryReadProperty(ref reader, options, PropRewrite, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.Value)) - { - writer.WritePropertyName("value"); - writer.WriteStringValue(value.Value); + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (propWildcard.TryReadProperty(ref reader, options, PropWildcard, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (!string.IsNullOrEmpty(value.Wildcard)) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + reader.Read(); + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("wildcard"); - writer.WriteStringValue(value.Wildcard); - } + Boost = propBoost.Value, + CaseInsensitive = propCaseInsensitive.Value, + Field = propField.Value, + QueryName = propQueryName.Value, + Rewrite = propRewrite.Value, + Value = propValue.Value, + Wildcard = propWildcard.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(options, value.Field, null); + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropCaseInsensitive, value.CaseInsensitive, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteProperty(options, PropRewrite, value.Rewrite, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteProperty(options, PropWildcard, value.Wildcard, null, null); writer.WriteEndObject(); writer.WriteEndObject(); } } -[JsonConverter(typeof(WildcardQueryConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryConverter))] public sealed partial class WildcardQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] public WildcardQuery(Elastic.Clients.Elasticsearch.Field field) { - if (field is null) - throw new ArgumentNullException(nameof(field)); Field = field; } +#if NET7_0_OR_GREATER + public WildcardQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } /// /// @@ -160,7 +164,11 @@ public WildcardQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public bool? CaseInsensitive { get; set; } - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } public string? QueryName { get; set; } /// @@ -183,28 +191,26 @@ public WildcardQuery(Elastic.Clients.Elasticsearch.Field field) /// /// public string? Wildcard { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Wildcard(wildcardQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Wildcard(wildcardQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Security.RoleQuery.Wildcard(wildcardQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Wildcard(wildcardQuery); } -public sealed partial class WildcardQueryDescriptor : SerializableDescriptor> +public readonly partial struct WildcardQueryDescriptor { - internal WildcardQueryDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery Instance { get; init; } - public WildcardQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string? ValueValue { get; set; } - private string? WildcardValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -214,10 +220,10 @@ public WildcardQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public WildcardQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -225,34 +231,28 @@ public WildcardQueryDescriptor Boost(float? boost) /// Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public WildcardQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) - { - CaseInsensitiveValue = caseInsensitive; - return Self; - } - - public WildcardQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor CaseInsensitive(bool? value = true) { - FieldValue = field; - return Self; + Instance.CaseInsensitive = value; + return this; } - public WildcardQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public WildcardQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public WildcardQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -260,10 +260,10 @@ public WildcardQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public WildcardQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -271,10 +271,10 @@ public WildcardQueryDescriptor Rewrite(string? rewrite) /// Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set. /// /// - public WildcardQueryDescriptor Value(string? value) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Value(string? value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } /// @@ -282,75 +282,39 @@ public WildcardQueryDescriptor Value(string? value) /// Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set. /// /// - public WildcardQueryDescriptor Wildcard(string? wildcard) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Wildcard(string? value) { - WildcardValue = wildcard; - return Self; + Instance.Wildcard = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery Build(System.Action> action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (!string.IsNullOrEmpty(ValueValue)) - { - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - } - - if (!string.IsNullOrEmpty(WildcardValue)) - { - writer.WritePropertyName("wildcard"); - writer.WriteStringValue(WildcardValue); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class WildcardQueryDescriptor : SerializableDescriptor +public readonly partial struct WildcardQueryDescriptor { - internal WildcardQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery instance) + { + Instance = instance; + } - public WildcardQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WildcardQueryDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private float? BoostValue { get; set; } - private bool? CaseInsensitiveValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private string? QueryNameValue { get; set; } - private string? RewriteValue { get; set; } - private string? ValueValue { get; set; } - private string? WildcardValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -360,10 +324,10 @@ public WildcardQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public WildcardQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -371,34 +335,28 @@ public WildcardQueryDescriptor Boost(float? boost) /// Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping. /// /// - public WildcardQueryDescriptor CaseInsensitive(bool? caseInsensitive = true) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor CaseInsensitive(bool? value = true) { - CaseInsensitiveValue = caseInsensitive; - return Self; + Instance.CaseInsensitive = value; + return this; } - public WildcardQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public WildcardQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public WildcardQueryDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor QueryName(string? value) { - FieldValue = field; - return Self; - } - - public WildcardQueryDescriptor QueryName(string? queryName) - { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } /// @@ -406,10 +364,10 @@ public WildcardQueryDescriptor QueryName(string? queryName) /// Method used to rewrite the query. /// /// - public WildcardQueryDescriptor Rewrite(string? rewrite) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Rewrite(string? value) { - RewriteValue = rewrite; - return Self; + Instance.Rewrite = value; + return this; } /// @@ -417,10 +375,10 @@ public WildcardQueryDescriptor Rewrite(string? rewrite) /// Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set. /// /// - public WildcardQueryDescriptor Value(string? value) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Value(string? value) { - ValueValue = value; - return Self; + Instance.Value = value; + return this; } /// @@ -428,56 +386,17 @@ public WildcardQueryDescriptor Value(string? value) /// Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set. /// /// - public WildcardQueryDescriptor Wildcard(string? wildcard) + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor Wildcard(string? value) { - WildcardValue = wildcard; - return Self; + Instance.Wildcard = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery Build(System.Action action) { - if (FieldValue is null) - throw new JsonException("Unable to serialize field name query descriptor with a null field. Ensure you use a suitable descriptor constructor or call the Field method, passing a non-null value for the field argument."); - writer.WriteStartObject(); - writer.WritePropertyName(settings.Inferrer.Field(FieldValue)); - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - if (CaseInsensitiveValue.HasValue) - { - writer.WritePropertyName("case_insensitive"); - writer.WriteBooleanValue(CaseInsensitiveValue.Value); - } - - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - if (!string.IsNullOrEmpty(RewriteValue)) - { - writer.WritePropertyName("rewrite"); - writer.WriteStringValue(RewriteValue); - } - - if (!string.IsNullOrEmpty(ValueValue)) - { - writer.WritePropertyName("value"); - writer.WriteStringValue(ValueValue); - } - - if (!string.IsNullOrEmpty(WildcardValue)) - { - writer.WritePropertyName("wildcard"); - writer.WriteStringValue(WildcardValue); - } - - writer.WriteEndObject(); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WrapperQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WrapperQuery.g.cs index f946f834295..f72bda4553f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WrapperQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WrapperQuery.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class WrapperQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoost = System.Text.Json.JsonEncodedText.Encode("boost"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropQueryName = System.Text.Json.JsonEncodedText.Encode("_name"); + + public override Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoost = default; + LocalJsonValue propQuery = default; + LocalJsonValue propQueryName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoost.TryReadProperty(ref reader, options, PropBoost, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propQueryName.TryReadProperty(ref reader, options, PropQueryName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Boost = propBoost.Value, + Query = propQuery.Value, + QueryName = propQueryName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoost, value.Boost, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropQueryName, value.QueryName, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryConverter))] public sealed partial class WrapperQuery { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WrapperQuery(string query) + { + Query = query; + } +#if NET7_0_OR_GREATER + public WrapperQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WrapperQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WrapperQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Floating point number used to decrease or increase the relevance scores of the query. @@ -37,7 +113,6 @@ public sealed partial class WrapperQuery /// A value greater than 1.0 increases the relevance score. /// /// - [JsonInclude, JsonPropertyName("boost")] public float? Boost { get; set; } /// @@ -46,25 +121,32 @@ public sealed partial class WrapperQuery /// The binary data format can be any of JSON, YAML, CBOR or SMILE encodings /// /// - [JsonInclude, JsonPropertyName("query")] - public string Query { get; set; } - [JsonInclude, JsonPropertyName("_name")] + public +#if NET7_0_OR_GREATER + required +#endif + string Query { get; set; } public string? QueryName { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(WrapperQuery wrapperQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Wrapper(wrapperQuery); } -public sealed partial class WrapperQueryDescriptor : SerializableDescriptor +public readonly partial struct WrapperQueryDescriptor { - internal WrapperQueryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery Instance { get; init; } - public WrapperQueryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WrapperQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery instance) { + Instance = instance; } - private float? BoostValue { get; set; } - private string QueryValue { get; set; } - private string? QueryNameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WrapperQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery instance) => new Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery(Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor descriptor) => descriptor.Instance; /// /// @@ -74,10 +156,10 @@ public WrapperQueryDescriptor() : base() /// A value greater than 1.0 increases the relevance score. /// /// - public WrapperQueryDescriptor Boost(float? boost) + public Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor Boost(float? value) { - BoostValue = boost; - return Self; + Instance.Boost = value; + return this; } /// @@ -86,35 +168,23 @@ public WrapperQueryDescriptor Boost(float? boost) /// The binary data format can be any of JSON, YAML, CBOR or SMILE encodings /// /// - public WrapperQueryDescriptor Query(string query) + public Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor Query(string value) { - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public WrapperQueryDescriptor QueryName(string? queryName) + public Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor QueryName(string? value) { - QueryNameValue = queryName; - return Self; + Instance.QueryName = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery Build(System.Action action) { - writer.WriteStartObject(); - if (BoostValue.HasValue) - { - writer.WritePropertyName("boost"); - writer.WriteNumberValue(BoostValue.Value); - } - - writer.WritePropertyName("query"); - writer.WriteStringValue(QueryValue); - if (!string.IsNullOrEmpty(QueryNameValue)) - { - writer.WritePropertyName("_name"); - writer.WriteStringValue(QueryNameValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryDsl.WrapperQueryDescriptor(new Elastic.Clients.Elasticsearch.QueryDsl.WrapperQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRule.g.cs index 157ded6328a..a8f71cdbfcc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRule.g.cs @@ -17,26 +17,126 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; +internal sealed partial class QueryRuleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropCriteria = System.Text.Json.JsonEncodedText.Encode("criteria"); + private static readonly System.Text.Json.JsonEncodedText PropPriority = System.Text.Json.JsonEncodedText.Encode("priority"); + private static readonly System.Text.Json.JsonEncodedText PropRuleId = System.Text.Json.JsonEncodedText.Encode("rule_id"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActions = default; + LocalJsonValue> propCriteria = default; + LocalJsonValue propPriority = default; + LocalJsonValue propRuleId = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, null)) + { + continue; + } + + if (propCriteria.TryReadProperty(ref reader, options, PropCriteria, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPriority.TryReadProperty(ref reader, options, PropPriority, null)) + { + continue; + } + + if (propRuleId.TryReadProperty(ref reader, options, PropRuleId, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + Criteria = propCriteria.Value, + Priority = propPriority.Value, + RuleId = propRuleId.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRule value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, null); + writer.WriteProperty(options, PropCriteria, value.Criteria, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPriority, value.Priority, null, null); + writer.WriteProperty(options, PropRuleId, value.RuleId, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleConverter))] public sealed partial class QueryRule { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRule(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions actions, System.Collections.Generic.ICollection criteria, Elastic.Clients.Elasticsearch.Id ruleId, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType type) + { + Actions = actions; + Criteria = criteria; + RuleId = ruleId; + Type = type; + } +#if NET7_0_OR_GREATER + public QueryRule() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryRule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The actions to take when the rule is matched. /// The format of this action depends on the rule type. /// /// - [JsonInclude, JsonPropertyName("actions")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Actions { get; set; } /// /// @@ -44,10 +144,11 @@ public sealed partial class QueryRule /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. /// /// - [JsonInclude, JsonPropertyName("criteria")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria))] - public ICollection Criteria { get; set; } - [JsonInclude, JsonPropertyName("priority")] + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Criteria { get; set; } public int? Priority { get; set; } /// @@ -55,8 +156,11 @@ public sealed partial class QueryRule /// A unique identifier for the rule. /// /// - [JsonInclude, JsonPropertyName("rule_id")] - public Elastic.Clients.Elasticsearch.Id RuleId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id RuleId { get; set; } /// /// @@ -65,28 +169,31 @@ public sealed partial class QueryRule /// exclude will exclude specific documents from search results. /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType Type { get; set; } } -public sealed partial class QueryRuleDescriptor : SerializableDescriptor +public readonly partial struct QueryRuleDescriptor { - internal QueryRuleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.QueryRule Instance { get; init; } - public QueryRuleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRule instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions ActionsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor ActionsDescriptor { get; set; } - private Action ActionsDescriptorAction { get; set; } - private ICollection CriteriaValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor CriteriaDescriptor { get; set; } - private Action CriteriaDescriptorAction { get; set; } - private Action[] CriteriaDescriptorActions { get; set; } - private int? PriorityValue { get; set; } - private Elastic.Clients.Elasticsearch.Id RuleIdValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType TypeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.QueryRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRule instance) => new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRule(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor descriptor) => descriptor.Instance; /// /// @@ -94,28 +201,34 @@ public QueryRuleDescriptor() : base() /// The format of this action depends on the rule type. /// /// - public QueryRuleDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions actions) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions value) { - ActionsDescriptor = null; - ActionsDescriptorAction = null; - ActionsValue = actions; - return Self; + Instance.Actions = value; + return this; } - public QueryRuleDescriptor Actions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor descriptor) + /// + /// + /// The actions to take when the rule is matched. + /// The format of this action depends on the rule type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Actions() { - ActionsValue = null; - ActionsDescriptorAction = null; - ActionsDescriptor = descriptor; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor.Build(null); + return this; } - public QueryRuleDescriptor Actions(Action configure) + /// + /// + /// The actions to take when the rule is matched. + /// The format of this action depends on the rule type. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Actions(System.Action? action) { - ActionsValue = null; - ActionsDescriptor = null; - ActionsDescriptorAction = configure; - return Self; + Instance.Actions = Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor.Build(action); + return this; } /// @@ -124,46 +237,46 @@ public QueryRuleDescriptor Actions(Action /// - public QueryRuleDescriptor Criteria(ICollection criteria) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Criteria(System.Collections.Generic.ICollection value) { - CriteriaDescriptor = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = null; - CriteriaValue = criteria; - return Self; + Instance.Criteria = value; + return this; } - public QueryRuleDescriptor Criteria(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor descriptor) + /// + /// + /// The criteria that must be met for the rule to be applied. + /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Criteria(params Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria[] values) { - CriteriaValue = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = null; - CriteriaDescriptor = descriptor; - return Self; + Instance.Criteria = [.. values]; + return this; } - public QueryRuleDescriptor Criteria(Action configure) + /// + /// + /// The criteria that must be met for the rule to be applied. + /// If multiple criteria are specified for a rule, all criteria must be met for the rule to be applied. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Criteria(params System.Action[] actions) { - CriteriaValue = null; - CriteriaDescriptor = null; - CriteriaDescriptorActions = null; - CriteriaDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor.Build(action)); + } - public QueryRuleDescriptor Criteria(params Action[] configure) - { - CriteriaValue = null; - CriteriaDescriptor = null; - CriteriaDescriptorAction = null; - CriteriaDescriptorActions = configure; - return Self; + Instance.Criteria = items; + return this; } - public QueryRuleDescriptor Priority(int? priority) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Priority(int? value) { - PriorityValue = priority; - return Self; + Instance.Priority = value; + return this; } /// @@ -171,10 +284,10 @@ public QueryRuleDescriptor Priority(int? priority) /// A unique identifier for the rule. /// /// - public QueryRuleDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor RuleId(Elastic.Clients.Elasticsearch.Id value) { - RuleIdValue = ruleId; - return Self; + Instance.RuleId = value; + return this; } /// @@ -184,70 +297,17 @@ public QueryRuleDescriptor RuleId(Elastic.Clients.Elasticsearch.Id ruleId) /// exclude will exclude specific documents from search results. /// /// - public QueryRuleDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType type) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.QueryRule Build(System.Action action) { - writer.WriteStartObject(); - if (ActionsDescriptor is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsDescriptor, options); - } - else if (ActionsDescriptorAction is not null) - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor(ActionsDescriptorAction), options); - } - else - { - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - } - - if (CriteriaDescriptor is not null) - { - writer.WritePropertyName("criteria"); - JsonSerializer.Serialize(writer, CriteriaDescriptor, options); - } - else if (CriteriaDescriptorAction is not null) - { - writer.WritePropertyName("criteria"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(CriteriaDescriptorAction), options); - } - else if (CriteriaDescriptorActions is not null) - { - writer.WritePropertyName("criteria"); - if (CriteriaDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in CriteriaDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(action), options); - } - - if (CriteriaDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("criteria"); - SingleOrManySerializationHelper.Serialize(CriteriaValue, writer, options); - } - - if (PriorityValue.HasValue) - { - writer.WritePropertyName("priority"); - writer.WriteNumberValue(PriorityValue.Value); - } - - writer.WritePropertyName("rule_id"); - JsonSerializer.Serialize(writer, RuleIdValue, options); - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.QueryRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleActions.g.cs index 90b30f342bf..b70f765d0bc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleActions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleActions.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; +internal sealed partial class QueryRuleActionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocs = System.Text.Json.JsonEncodedText.Encode("docs"); + private static readonly System.Text.Json.JsonEncodedText PropIds = System.Text.Json.JsonEncodedText.Encode("ids"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propDocs = default; + LocalJsonValue?> propIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocs.TryReadProperty(ref reader, options, PropDocs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIds.TryReadProperty(ref reader, options, PropIds, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Docs = propDocs.Value, + Ids = propIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocs, value.Docs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIds, value.Ids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsConverter))] public sealed partial class QueryRuleActions { +#if NET7_0_OR_GREATER + public QueryRuleActions() + { + } +#endif +#if !NET7_0_OR_GREATER + public QueryRuleActions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRuleActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The documents to apply the rule to. @@ -49,8 +110,7 @@ public sealed partial class QueryRuleActions /// /// /// - [JsonInclude, JsonPropertyName("docs")] - public ICollection? Docs { get; set; } + public System.Collections.Generic.ICollection? Docs { get; set; } /// /// @@ -58,23 +118,27 @@ public sealed partial class QueryRuleActions /// Only one of ids or docs may be specified and at least one must be specified. /// /// - [JsonInclude, JsonPropertyName("ids")] - public ICollection? Ids { get; set; } + public System.Collections.Generic.ICollection? Ids { get; set; } } -public sealed partial class QueryRuleActionsDescriptor : SerializableDescriptor +public readonly partial struct QueryRuleActionsDescriptor { - internal QueryRuleActionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleActionsDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions instance) + { + Instance = instance; + } - public QueryRuleActionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleActionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? DocsValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor DocsDescriptor { get; set; } - private Action DocsDescriptorAction { get; set; } - private Action[] DocsDescriptorActions { get; set; } - private ICollection? IdsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions instance) => new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor descriptor) => descriptor.Instance; /// /// @@ -96,40 +160,80 @@ public QueryRuleActionsDescriptor() : base() /// /// /// - public QueryRuleActionsDescriptor Docs(ICollection? docs) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor Docs(System.Collections.Generic.ICollection? value) { - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsValue = docs; - return Self; + Instance.Docs = value; + return this; } - public QueryRuleActionsDescriptor Docs(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor descriptor) + /// + /// + /// The documents to apply the rule to. + /// Only one of ids or docs may be specified and at least one must be specified. + /// There is a maximum value of 100 documents in a rule. + /// You can specify the following attributes for each document: + /// + /// + /// + /// + /// _index: The index of the document to pin. + /// + /// + /// + /// + /// _id: The unique document ID. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor Docs(params Elastic.Clients.Elasticsearch.QueryDsl.PinnedDoc[] values) { - DocsValue = null; - DocsDescriptorAction = null; - DocsDescriptorActions = null; - DocsDescriptor = descriptor; - return Self; + Instance.Docs = [.. values]; + return this; } - public QueryRuleActionsDescriptor Docs(Action configure) + /// + /// + /// The documents to apply the rule to. + /// Only one of ids or docs may be specified and at least one must be specified. + /// There is a maximum value of 100 documents in a rule. + /// You can specify the following attributes for each document: + /// + /// + /// + /// + /// _index: The index of the document to pin. + /// + /// + /// + /// + /// _id: The unique document ID. + /// + /// + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor Docs(params System.Action[] actions) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorActions = null; - DocsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor.Build(action)); + } + + Instance.Docs = items; + return this; } - public QueryRuleActionsDescriptor Docs(params Action[] configure) + /// + /// + /// The unique document IDs of the documents to apply the rule to. + /// Only one of ids or docs may be specified and at least one must be specified. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor Ids(System.Collections.Generic.ICollection? value) { - DocsValue = null; - DocsDescriptor = null; - DocsDescriptorAction = null; - DocsDescriptorActions = configure; - return Self; + Instance.Ids = value; + return this; } /// @@ -138,52 +242,22 @@ public QueryRuleActionsDescriptor Docs(params Actionids or docs may be specified and at least one must be specified. /// /// - public QueryRuleActionsDescriptor Ids(ICollection? ids) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor Ids(params Elastic.Clients.Elasticsearch.Id[] values) { - IdsValue = ids; - return Self; + Instance.Ids = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions Build(System.Action? action) { - writer.WriteStartObject(); - if (DocsDescriptor is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, DocsDescriptor, options); - writer.WriteEndArray(); - } - else if (DocsDescriptorAction is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor(DocsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (DocsDescriptorActions is not null) - { - writer.WritePropertyName("docs"); - writer.WriteStartArray(); - foreach (var action in DocsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.PinnedDocDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (DocsValue is not null) - { - writer.WritePropertyName("docs"); - JsonSerializer.Serialize(writer, DocsValue, options); - } - - if (IdsValue is not null) + if (action is null) { - writer.WritePropertyName("ids"); - JsonSerializer.Serialize(writer, IdsValue, options); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActionsDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleCriteria.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleCriteria.g.cs index 42bd4563f2a..38b952b29a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleCriteria.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRuleCriteria.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; +internal sealed partial class QueryRuleCriteriaConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropValues = System.Text.Json.JsonEncodedText.Encode("values"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMetadata = default; + LocalJsonValue propType = default; + LocalJsonValue?> propValues = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propValues.TryReadProperty(ref reader, options, PropValues, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Metadata = propMetadata.Value, + Type = propType.Value, + Values = propValues.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropValues, value.Values, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaConverter))] public sealed partial class QueryRuleCriteria { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleCriteria(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType type) + { + Type = type; + } +#if NET7_0_OR_GREATER + public QueryRuleCriteria() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryRuleCriteria() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRuleCriteria(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The metadata field to match against. @@ -36,7 +112,6 @@ public sealed partial class QueryRuleCriteria /// It is required for all criteria types except always. /// /// - [JsonInclude, JsonPropertyName("metadata")] public string? Metadata { get; set; } /// @@ -96,8 +171,11 @@ public sealed partial class QueryRuleCriteria /// /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType Type { get; set; } /// /// @@ -106,21 +184,27 @@ public sealed partial class QueryRuleCriteria /// It is required for all criteria types except always. /// /// - [JsonInclude, JsonPropertyName("values")] - public ICollection? Values { get; set; } + public System.Collections.Generic.ICollection? Values { get; set; } } -public sealed partial class QueryRuleCriteriaDescriptor : SerializableDescriptor +public readonly partial struct QueryRuleCriteriaDescriptor { - internal QueryRuleCriteriaDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleCriteriaDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria instance) + { + Instance = instance; + } - public QueryRuleCriteriaDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRuleCriteriaDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType TypeValue { get; set; } - private ICollection? ValuesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria instance) => new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor descriptor) => descriptor.Instance; /// /// @@ -129,10 +213,10 @@ public QueryRuleCriteriaDescriptor() : base() /// It is required for all criteria types except always. /// /// - public QueryRuleCriteriaDescriptor Metadata(string? metadata) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor Metadata(string? value) { - MetadataValue = metadata; - return Self; + Instance.Metadata = value; + return this; } /// @@ -192,10 +276,10 @@ public QueryRuleCriteriaDescriptor Metadata(string? metadata) /// /// /// - public QueryRuleCriteriaDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType type) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaType value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } /// @@ -205,29 +289,30 @@ public QueryRuleCriteriaDescriptor Type(Elastic.Clients.Elasticsearch.QueryRules /// It is required for all criteria types except always. /// /// - public QueryRuleCriteriaDescriptor Values(ICollection? values) + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor Values(System.Collections.Generic.ICollection? value) { - ValuesValue = values; - return Self; + Instance.Values = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The values to match against the metadata field. + /// Only one value must match for the criteria to be met. + /// It is required for all criteria types except always. + /// + /// + public Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor Values(params object[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(MetadataValue)) - { - writer.WritePropertyName("metadata"); - writer.WriteStringValue(MetadataValue); - } - - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - if (ValuesValue is not null) - { - writer.WritePropertyName("values"); - JsonSerializer.Serialize(writer, ValuesValue, options); - } + Instance.Values = [.. values]; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteriaDescriptor(new Elastic.Clients.Elasticsearch.QueryRules.QueryRuleCriteria(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetListItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetListItem.g.cs index d6c376465ec..4d737d54b53 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetListItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetListItem.g.cs @@ -17,18 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; +internal sealed partial class QueryRulesetListItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRuleCriteriaTypesCounts = System.Text.Json.JsonEncodedText.Encode("rule_criteria_types_counts"); + private static readonly System.Text.Json.JsonEncodedText PropRulesetId = System.Text.Json.JsonEncodedText.Encode("ruleset_id"); + private static readonly System.Text.Json.JsonEncodedText PropRuleTotalCount = System.Text.Json.JsonEncodedText.Encode("rule_total_count"); + private static readonly System.Text.Json.JsonEncodedText PropRuleTypeCounts = System.Text.Json.JsonEncodedText.Encode("rule_type_counts"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetListItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRuleCriteriaTypesCounts = default; + LocalJsonValue propRulesetId = default; + LocalJsonValue propRuleTotalCount = default; + LocalJsonValue> propRuleTypeCounts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRuleCriteriaTypesCounts.TryReadProperty(ref reader, options, PropRuleCriteriaTypesCounts, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRulesetId.TryReadProperty(ref reader, options, PropRulesetId, null)) + { + continue; + } + + if (propRuleTotalCount.TryReadProperty(ref reader, options, PropRuleTotalCount, null)) + { + continue; + } + + if (propRuleTypeCounts.TryReadProperty(ref reader, options, PropRuleTypeCounts, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetListItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RuleCriteriaTypesCounts = propRuleCriteriaTypesCounts.Value, + RulesetId = propRulesetId.Value, + RuleTotalCount = propRuleTotalCount.Value, + RuleTypeCounts = propRuleTypeCounts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetListItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRuleCriteriaTypesCounts, value.RuleCriteriaTypesCounts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRulesetId, value.RulesetId, null, null); + writer.WriteProperty(options, PropRuleTotalCount, value.RuleTotalCount, null, null); + writer.WriteProperty(options, PropRuleTypeCounts, value.RuleTypeCounts, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetListItemConverter))] public sealed partial class QueryRulesetListItem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRulesetListItem(System.Collections.Generic.IReadOnlyDictionary ruleCriteriaTypesCounts, string rulesetId, int ruleTotalCount, System.Collections.Generic.IReadOnlyDictionary ruleTypeCounts) + { + RuleCriteriaTypesCounts = ruleCriteriaTypesCounts; + RulesetId = rulesetId; + RuleTotalCount = ruleTotalCount; + RuleTypeCounts = ruleTypeCounts; + } +#if NET7_0_OR_GREATER + public QueryRulesetListItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryRulesetListItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRulesetListItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A map of criteria type (for example, exact) to the number of rules of that type. @@ -37,30 +125,42 @@ public sealed partial class QueryRulesetListItem /// NOTE: The counts in rule_criteria_types_counts may be larger than the value of rule_total_count because a rule may have multiple criteria. /// /// - [JsonInclude, JsonPropertyName("rule_criteria_types_counts")] - public IReadOnlyDictionary RuleCriteriaTypesCounts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary RuleCriteriaTypesCounts { get; set; } /// /// /// A unique identifier for the ruleset. /// /// - [JsonInclude, JsonPropertyName("ruleset_id")] - public string RulesetId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RulesetId { get; set; } /// /// /// The number of rules associated with the ruleset. /// /// - [JsonInclude, JsonPropertyName("rule_total_count")] - public int RuleTotalCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int RuleTotalCount { get; set; } /// /// /// A map of rule type (for example, pinned) to the number of rules of that type. /// /// - [JsonInclude, JsonPropertyName("rule_type_counts")] - public IReadOnlyDictionary RuleTypeCounts { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary RuleTypeCounts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetMatchedRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetMatchedRule.g.cs index 6fa1ac86998..0e35687326e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetMatchedRule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryRules/QueryRulesetMatchedRule.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.QueryRules; +internal sealed partial class QueryRulesetMatchedRuleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRuleId = System.Text.Json.JsonEncodedText.Encode("rule_id"); + private static readonly System.Text.Json.JsonEncodedText PropRulesetId = System.Text.Json.JsonEncodedText.Encode("ruleset_id"); + + public override Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetMatchedRule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRuleId = default; + LocalJsonValue propRulesetId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRuleId.TryReadProperty(ref reader, options, PropRuleId, null)) + { + continue; + } + + if (propRulesetId.TryReadProperty(ref reader, options, PropRulesetId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetMatchedRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RuleId = propRuleId.Value, + RulesetId = propRulesetId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetMatchedRule value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRuleId, value.RuleId, null, null); + writer.WriteProperty(options, PropRulesetId, value.RulesetId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryRules.QueryRulesetMatchedRuleConverter))] public sealed partial class QueryRulesetMatchedRule { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRulesetMatchedRule(string ruleId, string rulesetId) + { + RuleId = ruleId; + RulesetId = rulesetId; + } +#if NET7_0_OR_GREATER + public QueryRulesetMatchedRule() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryRulesetMatchedRule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRulesetMatchedRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Rule unique identifier within that ruleset /// /// - [JsonInclude, JsonPropertyName("rule_id")] - public string RuleId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RuleId { get; set; } /// /// /// Ruleset unique identifier /// /// - [JsonInclude, JsonPropertyName("ruleset_id")] - public string RulesetId { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string RulesetId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryVectorBuilder.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryVectorBuilder.g.cs index 77354d637e6..c86fe1ca9b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryVectorBuilder.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryVectorBuilder.g.cs @@ -17,211 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[JsonConverter(typeof(QueryVectorBuilderConverter))] -public sealed partial class QueryVectorBuilder +internal sealed partial class QueryVectorBuilderConverter : System.Text.Json.Serialization.JsonConverter { - internal QueryVectorBuilder(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static QueryVectorBuilder TextEmbedding(Elastic.Clients.Elasticsearch.TextEmbedding textEmbedding) => new QueryVectorBuilder("text_embedding", textEmbedding); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); -internal sealed partial class QueryVectorBuilderConverter : JsonConverter -{ - public override QueryVectorBuilder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.QueryVectorBuilder Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantTextEmbedding)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantTextEmbedding.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "text_embedding") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'QueryVectorBuilder' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new QueryVectorBuilder(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, QueryVectorBuilder value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.QueryVectorBuilder value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "text_embedding": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.TextEmbedding)value.Variant, options); - break; - } + case null: + break; + case "text_embedding": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.TextEmbedding)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.QueryVectorBuilder)}'."); } writer.WriteEndObject(); } } -public sealed partial class QueryVectorBuilderDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.QueryVectorBuilderConverter))] +public sealed partial class QueryVectorBuilder { - internal QueryVectorBuilderDescriptor(Action> configure) => configure.Invoke(this); - - public QueryVectorBuilderDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public QueryVectorBuilder() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private QueryVectorBuilderDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public QueryVectorBuilder() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private QueryVectorBuilderDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - public QueryVectorBuilderDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.TextEmbedding textEmbedding) => Set(textEmbedding, "text_embedding"); - public QueryVectorBuilderDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); + public Elastic.Clients.Elasticsearch.TextEmbedding? TextEmbedding { get => GetVariant("text_embedding"); set => SetVariant("text_embedding", value); } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public static implicit operator Elastic.Clients.Elasticsearch.QueryVectorBuilder(Elastic.Clients.Elasticsearch.TextEmbedding value) => new Elastic.Clients.Elasticsearch.QueryVectorBuilder { TextEmbedding = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + return result; } - writer.WriteEndObject(); + return default; } -} - -public sealed partial class QueryVectorBuilderDescriptor : SerializableDescriptor -{ - internal QueryVectorBuilderDescriptor(Action configure) => configure.Invoke(this); - public QueryVectorBuilderDescriptor() : base() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct QueryVectorBuilderDescriptor +{ + internal Elastic.Clients.Elasticsearch.QueryVectorBuilder Instance { get; init; } - private QueryVectorBuilderDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryVectorBuilderDescriptor(Elastic.Clients.Elasticsearch.QueryVectorBuilder instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private QueryVectorBuilderDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryVectorBuilderDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public QueryVectorBuilderDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.TextEmbedding textEmbedding) => Set(textEmbedding, "text_embedding"); - public QueryVectorBuilderDescriptor TextEmbedding(Action configure) => Set(configure, "text_embedding"); + public static explicit operator Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(Elastic.Clients.Elasticsearch.QueryVectorBuilder instance) => new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.QueryVectorBuilder(Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor TextEmbedding(Elastic.Clients.Elasticsearch.TextEmbedding? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.TextEmbedding = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor TextEmbedding(System.Action action) + { + Instance.TextEmbedding = Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.QueryVectorBuilder Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor(new Elastic.Clients.Elasticsearch.QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs index 62c90d43295..842bb5964c5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RRFRetriever.g.cs @@ -17,33 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RRFRetrieverConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropRankConstant = System.Text.Json.JsonEncodedText.Encode("rank_constant"); + private static readonly System.Text.Json.JsonEncodedText PropRankWindowSize = System.Text.Json.JsonEncodedText.Encode("rank_window_size"); + private static readonly System.Text.Json.JsonEncodedText PropRetrievers = System.Text.Json.JsonEncodedText.Encode("retrievers"); + + public override Elastic.Clients.Elasticsearch.RRFRetriever Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFilter = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propRankConstant = default; + LocalJsonValue propRankWindowSize = default; + LocalJsonValue> propRetrievers = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propRankConstant.TryReadProperty(ref reader, options, PropRankConstant, null)) + { + continue; + } + + if (propRankWindowSize.TryReadProperty(ref reader, options, PropRankWindowSize, null)) + { + continue; + } + + if (propRetrievers.TryReadProperty(ref reader, options, PropRetrievers, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + MinScore = propMinScore.Value, + RankConstant = propRankConstant.Value, + RankWindowSize = propRankWindowSize.Value, + Retrievers = propRetrievers.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RRFRetriever value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropRankConstant, value.RankConstant, null, null); + writer.WriteProperty(options, PropRankWindowSize, value.RankWindowSize, null, null); + writer.WriteProperty(options, PropRetrievers, value.Retrievers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RRFRetrieverConverter))] public sealed partial class RRFRetriever { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RRFRetriever(System.Collections.Generic.ICollection retrievers) + { + Retrievers = retrievers; + } +#if NET7_0_OR_GREATER + public RRFRetriever() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RRFRetriever() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Query to filter the documents that can match. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -51,7 +142,6 @@ public sealed partial class RRFRetriever /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. /// /// - [JsonInclude, JsonPropertyName("rank_constant")] public int? RankConstant { get; set; } /// @@ -59,7 +149,6 @@ public sealed partial class RRFRetriever /// This value determines the size of the individual result sets per query. /// /// - [JsonInclude, JsonPropertyName("rank_window_size")] public int? RankWindowSize { get; set; } /// @@ -67,71 +156,69 @@ public sealed partial class RRFRetriever /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. /// /// - [JsonInclude, JsonPropertyName("retrievers")] - public ICollection Retrievers { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Retriever(RRFRetriever rRFRetriever) => Elastic.Clients.Elasticsearch.Retriever.Rrf(rRFRetriever); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Retrievers { get; set; } } -public sealed partial class RRFRetrieverDescriptor : SerializableDescriptor> +public readonly partial struct RrfRetrieverDescriptor { - internal RRFRetrieverDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RRFRetriever Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRetrieverDescriptor(Elastic.Clients.Elasticsearch.RRFRetriever instance) + { + Instance = instance; + } - public RRFRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRetrieverDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private float? MinScoreValue { get; set; } - private int? RankConstantValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private ICollection RetrieversValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieversDescriptor { get; set; } - private Action> RetrieversDescriptorAction { get; set; } - private Action>[] RetrieversDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(Elastic.Clients.Elasticsearch.RRFRetriever instance) => new Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Query to filter the documents that can match. /// /// - public RRFRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public RRFRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public RRFRetrieverDescriptor Filter(Action> configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public RRFRetrieverDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -139,10 +226,10 @@ public RRFRetrieverDescriptor Filter(params Action /// - public RRFRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -150,10 +237,10 @@ public RRFRetrieverDescriptor MinScore(float? minScore) /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. /// /// - public RRFRetrieverDescriptor RankConstant(int? rankConstant) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankConstant(int? value) { - RankConstantValue = rankConstant; - return Self; + Instance.RankConstant = value; + return this; } /// @@ -161,10 +248,10 @@ public RRFRetrieverDescriptor RankConstant(int? rankConstant) /// This value determines the size of the individual result sets per query. /// /// - public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -172,186 +259,122 @@ public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. /// /// - public RRFRetrieverDescriptor Retrievers(ICollection retrievers) - { - RetrieversDescriptor = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = null; - RetrieversValue = retrievers; - return Self; - } - - public RRFRetrieverDescriptor Retrievers(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection value) { - RetrieversValue = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = null; - RetrieversDescriptor = descriptor; - return Self; + Instance.Retrievers = value; + return this; } - public RRFRetrieverDescriptor Retrievers(Action> configure) - { - RetrieversValue = null; - RetrieversDescriptor = null; - RetrieversDescriptorActions = null; - RetrieversDescriptorAction = configure; - return Self; - } - - public RRFRetrieverDescriptor Retrievers(params Action>[] configure) + /// + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Retriever[] values) { - RetrieversValue = null; - RetrieversDescriptor = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = configure; - return Self; + Instance.Retrievers = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action>[] actions) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (RankConstantValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("rank_constant"); - writer.WriteNumberValue(RankConstantValue.Value); + items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); } - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - if (RetrieversDescriptor is not null) - { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RetrieversDescriptor, options); - writer.WriteEndArray(); - } - else if (RetrieversDescriptorAction is not null) - { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieversDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RetrieversDescriptorActions is not null) - { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - foreach (var action in RetrieversDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("retrievers"); - JsonSerializer.Serialize(writer, RetrieversValue, options); - } + Instance.Retrievers = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RRFRetriever Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(new Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RRFRetrieverDescriptor : SerializableDescriptor +public readonly partial struct RrfRetrieverDescriptor { - internal RRFRetrieverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RRFRetriever Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRetrieverDescriptor(Elastic.Clients.Elasticsearch.RRFRetriever instance) + { + Instance = instance; + } - public RRFRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRetrieverDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private float? MinScoreValue { get; set; } - private int? RankConstantValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private ICollection RetrieversValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieversDescriptor { get; set; } - private Action RetrieversDescriptorAction { get; set; } - private Action[] RetrieversDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(Elastic.Clients.Elasticsearch.RRFRetriever instance) => new Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Query to filter the documents that can match. /// /// - public RRFRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public RRFRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public RRFRetrieverDescriptor Filter(Action configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public RRFRetrieverDescriptor Filter(params Action[] configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -359,10 +382,10 @@ public RRFRetrieverDescriptor Filter(params Action /// - public RRFRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -370,10 +393,10 @@ public RRFRetrieverDescriptor MinScore(float? minScore) /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. /// /// - public RRFRetrieverDescriptor RankConstant(int? rankConstant) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankConstant(int? value) { - RankConstantValue = rankConstant; - return Self; + Instance.RankConstant = value; + return this; } /// @@ -381,10 +404,10 @@ public RRFRetrieverDescriptor RankConstant(int? rankConstant) /// This value determines the size of the individual result sets per query. /// /// - public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -392,123 +415,62 @@ public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. /// /// - public RRFRetrieverDescriptor Retrievers(ICollection retrievers) - { - RetrieversDescriptor = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = null; - RetrieversValue = retrievers; - return Self; - } - - public RRFRetrieverDescriptor Retrievers(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) - { - RetrieversValue = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = null; - RetrieversDescriptor = descriptor; - return Self; - } - - public RRFRetrieverDescriptor Retrievers(Action configure) + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(System.Collections.Generic.ICollection value) { - RetrieversValue = null; - RetrieversDescriptor = null; - RetrieversDescriptorActions = null; - RetrieversDescriptorAction = configure; - return Self; + Instance.Retrievers = value; + return this; } - public RRFRetrieverDescriptor Retrievers(params Action[] configure) + /// + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params Elastic.Clients.Elasticsearch.Retriever[] values) { - RetrieversValue = null; - RetrieversDescriptor = null; - RetrieversDescriptorAction = null; - RetrieversDescriptorActions = configure; - return Self; + Instance.Retrievers = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action[] actions) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinScoreValue.HasValue) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); + items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); } - if (RankConstantValue.HasValue) - { - writer.WritePropertyName("rank_constant"); - writer.WriteNumberValue(RankConstantValue.Value); - } - - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } + Instance.Retrievers = items; + return this; + } - if (RetrieversDescriptor is not null) - { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RetrieversDescriptor, options); - writer.WriteEndArray(); - } - else if (RetrieversDescriptorAction is not null) + /// + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + /// + public Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor Retrievers(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieversDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action)); } - else if (RetrieversDescriptorActions is not null) - { - writer.WritePropertyName("retrievers"); - writer.WriteStartArray(); - foreach (var action in RetrieversDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(action), options); - } - writer.WriteEndArray(); - } - else - { - writer.WritePropertyName("retrievers"); - JsonSerializer.Serialize(writer, RetrieversValue, options); - } + Instance.Retrievers = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RRFRetriever Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor(new Elastic.Clients.Elasticsearch.RRFRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rank.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rank.g.cs index 272931dfaa7..c0da33d94bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rank.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rank.g.cs @@ -17,211 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[JsonConverter(typeof(RankConverter))] -public sealed partial class Rank +internal sealed partial class RankConverter : System.Text.Json.Serialization.JsonConverter { - internal Rank(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Rank Rrf(Elastic.Clients.Elasticsearch.RrfRank rrfRank) => new Rank("rrf", rrfRank); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantRrf = System.Text.Json.JsonEncodedText.Encode("rrf"); -internal sealed partial class RankConverter : JsonConverter -{ - public override Rank Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Rank Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantRrf)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantRrf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "rrf") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Rank' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Rank(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Rank value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rank value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "rrf": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.RrfRank)value.Variant, options); - break; - } + case null: + break; + case "rrf": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.RrfRank)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Rank)}'."); } writer.WriteEndObject(); } } -public sealed partial class RankDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RankConverter))] +public sealed partial class Rank { - internal RankDescriptor(Action> configure) => configure.Invoke(this); - - public RankDescriptor() : base() + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Rank() { } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RankDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor +#endif +#if !NET7_0_OR_GREATER + public Rank() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; } - - private RankDescriptor Set(object variant, string variantName) +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Rank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + _ = sentinel; } - public RankDescriptor Rrf(Elastic.Clients.Elasticsearch.RrfRank rrfRank) => Set(rrfRank, "rrf"); - public RankDescriptor Rrf(Action configure) => Set(configure, "rrf"); + /// + /// + /// The reciprocal rank fusion parameters + /// + /// + public Elastic.Clients.Elasticsearch.RrfRank? Rrf { get => GetVariant("rrf"); set => SetVariant("rrf", value); } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public static implicit operator Elastic.Clients.Elasticsearch.Rank(Elastic.Clients.Elasticsearch.RrfRank value) => new Elastic.Clients.Elasticsearch.Rank { Rrf = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class RankDescriptor : SerializableDescriptor +public readonly partial struct RankDescriptor { - internal RankDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rank Instance { get; init; } - public RankDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankDescriptor(Elastic.Clients.Elasticsearch.Rank instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RankDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RankDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Rank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private RankDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.RankDescriptor(Elastic.Clients.Elasticsearch.Rank instance) => new Elastic.Clients.Elasticsearch.RankDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rank(Elastic.Clients.Elasticsearch.RankDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The reciprocal rank fusion parameters + /// + /// + public Elastic.Clients.Elasticsearch.RankDescriptor Rrf(Elastic.Clients.Elasticsearch.RrfRank? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Rrf = value; + return this; } - public RankDescriptor Rrf(Elastic.Clients.Elasticsearch.RrfRank rrfRank) => Set(rrfRank, "rrf"); - public RankDescriptor Rrf(Action configure) => Set(configure, "rrf"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The reciprocal rank fusion parameters + /// + /// + public Elastic.Clients.Elasticsearch.RankDescriptor Rrf() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Rrf = Elastic.Clients.Elasticsearch.RrfRankDescriptor.Build(null); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// The reciprocal rank fusion parameters + /// + /// + public Elastic.Clients.Elasticsearch.RankDescriptor Rrf(System.Action? action) + { + Instance.Rrf = Elastic.Clients.Elasticsearch.RrfRankDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rank Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RankDescriptor(new Elastic.Clients.Elasticsearch.Rank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RecoveryStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RecoveryStats.g.cs index 120f68afc24..613c2dfe6f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RecoveryStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RecoveryStats.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RecoveryStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentAsSource = System.Text.Json.JsonEncodedText.Encode("current_as_source"); + private static readonly System.Text.Json.JsonEncodedText PropCurrentAsTarget = System.Text.Json.JsonEncodedText.Encode("current_as_target"); + private static readonly System.Text.Json.JsonEncodedText PropThrottleTime = System.Text.Json.JsonEncodedText.Encode("throttle_time"); + private static readonly System.Text.Json.JsonEncodedText PropThrottleTimeInMillis = System.Text.Json.JsonEncodedText.Encode("throttle_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.RecoveryStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrentAsSource = default; + LocalJsonValue propCurrentAsTarget = default; + LocalJsonValue propThrottleTime = default; + LocalJsonValue propThrottleTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentAsSource.TryReadProperty(ref reader, options, PropCurrentAsSource, null)) + { + continue; + } + + if (propCurrentAsTarget.TryReadProperty(ref reader, options, PropCurrentAsTarget, null)) + { + continue; + } + + if (propThrottleTime.TryReadProperty(ref reader, options, PropThrottleTime, null)) + { + continue; + } + + if (propThrottleTimeInMillis.TryReadProperty(ref reader, options, PropThrottleTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RecoveryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentAsSource = propCurrentAsSource.Value, + CurrentAsTarget = propCurrentAsTarget.Value, + ThrottleTime = propThrottleTime.Value, + ThrottleTimeInMillis = propThrottleTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RecoveryStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentAsSource, value.CurrentAsSource, null, null); + writer.WriteProperty(options, PropCurrentAsTarget, value.CurrentAsTarget, null, null); + writer.WriteProperty(options, PropThrottleTime, value.ThrottleTime, null, null); + writer.WriteProperty(options, PropThrottleTimeInMillis, value.ThrottleTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RecoveryStatsConverter))] public sealed partial class RecoveryStats { - [JsonInclude, JsonPropertyName("current_as_source")] - public long CurrentAsSource { get; init; } - [JsonInclude, JsonPropertyName("current_as_target")] - public long CurrentAsTarget { get; init; } - [JsonInclude, JsonPropertyName("throttle_time")] - public Elastic.Clients.Elasticsearch.Duration? ThrottleTime { get; init; } - [JsonInclude, JsonPropertyName("throttle_time_in_millis")] - public long ThrottleTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecoveryStats(long currentAsSource, long currentAsTarget, System.TimeSpan throttleTimeInMillis) + { + CurrentAsSource = currentAsSource; + CurrentAsTarget = currentAsTarget; + ThrottleTimeInMillis = throttleTimeInMillis; + } +#if NET7_0_OR_GREATER + public RecoveryStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RecoveryStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RecoveryStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long CurrentAsSource { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CurrentAsTarget { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ThrottleTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ThrottleTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RefreshStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RefreshStats.g.cs index 0210232ce4e..24b1319ae65 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RefreshStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RefreshStats.g.cs @@ -17,28 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RefreshStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExternalTotal = System.Text.Json.JsonEncodedText.Encode("external_total"); + private static readonly System.Text.Json.JsonEncodedText PropExternalTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("external_total_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropListeners = System.Text.Json.JsonEncodedText.Encode("listeners"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.RefreshStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExternalTotal = default; + LocalJsonValue propExternalTotalTimeInMillis = default; + LocalJsonValue propListeners = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExternalTotal.TryReadProperty(ref reader, options, PropExternalTotal, null)) + { + continue; + } + + if (propExternalTotalTimeInMillis.TryReadProperty(ref reader, options, PropExternalTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propListeners.TryReadProperty(ref reader, options, PropListeners, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RefreshStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExternalTotal = propExternalTotal.Value, + ExternalTotalTimeInMillis = propExternalTotalTimeInMillis.Value, + Listeners = propListeners.Value, + Total = propTotal.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RefreshStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExternalTotal, value.ExternalTotal, null, null); + writer.WriteProperty(options, PropExternalTotalTimeInMillis, value.ExternalTotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropListeners, value.Listeners, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RefreshStatsConverter))] public sealed partial class RefreshStats { - [JsonInclude, JsonPropertyName("external_total")] - public long ExternalTotal { get; init; } - [JsonInclude, JsonPropertyName("external_total_time_in_millis")] - public long ExternalTotalTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("listeners")] - public long Listeners { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RefreshStats(long externalTotal, System.TimeSpan externalTotalTimeInMillis, long listeners, long total, System.TimeSpan totalTimeInMillis) + { + ExternalTotal = externalTotal; + ExternalTotalTimeInMillis = externalTotalTimeInMillis; + Listeners = listeners; + Total = total; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public RefreshStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RefreshStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RefreshStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long ExternalTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ExternalTotalTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Listeners { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RelocationFailureInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RelocationFailureInfo.g.cs index 5fdf68c44d5..87d5962daef 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RelocationFailureInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RelocationFailureInfo.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RelocationFailureInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailedAttempts = System.Text.Json.JsonEncodedText.Encode("failed_attempts"); + + public override Elastic.Clients.Elasticsearch.RelocationFailureInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFailedAttempts = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailedAttempts.TryReadProperty(ref reader, options, PropFailedAttempts, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RelocationFailureInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FailedAttempts = propFailedAttempts.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RelocationFailureInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailedAttempts, value.FailedAttempts, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RelocationFailureInfoConverter))] public sealed partial class RelocationFailureInfo { - [JsonInclude, JsonPropertyName("failed_attempts")] - public int FailedAttempts { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RelocationFailureInfo(int failedAttempts) + { + FailedAttempts = failedAttempts; + } +#if NET7_0_OR_GREATER + public RelocationFailureInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RelocationFailureInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RelocationFailureInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int FailedAttempts { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RequestCacheStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RequestCacheStats.g.cs index 11f9829cc65..81dfb1f18bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RequestCacheStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RequestCacheStats.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RequestCacheStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropHitCount = System.Text.Json.JsonEncodedText.Encode("hit_count"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySize = System.Text.Json.JsonEncodedText.Encode("memory_size"); + private static readonly System.Text.Json.JsonEncodedText PropMemorySizeInBytes = System.Text.Json.JsonEncodedText.Encode("memory_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMissCount = System.Text.Json.JsonEncodedText.Encode("miss_count"); + + public override Elastic.Clients.Elasticsearch.RequestCacheStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEvictions = default; + LocalJsonValue propHitCount = default; + LocalJsonValue propMemorySize = default; + LocalJsonValue propMemorySizeInBytes = default; + LocalJsonValue propMissCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propHitCount.TryReadProperty(ref reader, options, PropHitCount, null)) + { + continue; + } + + if (propMemorySize.TryReadProperty(ref reader, options, PropMemorySize, null)) + { + continue; + } + + if (propMemorySizeInBytes.TryReadProperty(ref reader, options, PropMemorySizeInBytes, null)) + { + continue; + } + + if (propMissCount.TryReadProperty(ref reader, options, PropMissCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RequestCacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Evictions = propEvictions.Value, + HitCount = propHitCount.Value, + MemorySize = propMemorySize.Value, + MemorySizeInBytes = propMemorySizeInBytes.Value, + MissCount = propMissCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RequestCacheStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropHitCount, value.HitCount, null, null); + writer.WriteProperty(options, PropMemorySize, value.MemorySize, null, null); + writer.WriteProperty(options, PropMemorySizeInBytes, value.MemorySizeInBytes, null, null); + writer.WriteProperty(options, PropMissCount, value.MissCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RequestCacheStatsConverter))] public sealed partial class RequestCacheStats { - [JsonInclude, JsonPropertyName("evictions")] - public long Evictions { get; init; } - [JsonInclude, JsonPropertyName("hit_count")] - public long HitCount { get; init; } - [JsonInclude, JsonPropertyName("memory_size")] - public string? MemorySize { get; init; } - [JsonInclude, JsonPropertyName("memory_size_in_bytes")] - public long MemorySizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("miss_count")] - public long MissCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestCacheStats(long evictions, long hitCount, long memorySizeInBytes, long missCount) + { + Evictions = evictions; + HitCount = hitCount; + MemorySizeInBytes = memorySizeInBytes; + MissCount = missCount; + } +#if NET7_0_OR_GREATER + public RequestCacheStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RequestCacheStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RequestCacheStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Evictions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long HitCount { get; set; } + public string? MemorySize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemorySizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MissCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RescoreVector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RescoreVector.g.cs new file mode 100644 index 00000000000..baa8c4c6554 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RescoreVector.g.cs @@ -0,0 +1,139 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +internal sealed partial class RescoreVectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOversample = System.Text.Json.JsonEncodedText.Encode("oversample"); + + public override Elastic.Clients.Elasticsearch.RescoreVector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOversample = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOversample.TryReadProperty(ref reader, options, PropOversample, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RescoreVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Oversample = propOversample.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RescoreVector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOversample, value.Oversample, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RescoreVectorConverter))] +public sealed partial class RescoreVector +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreVector(float oversample) + { + Oversample = oversample; + } +#if NET7_0_OR_GREATER + public RescoreVector() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RescoreVector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RescoreVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Applies the specified oversample factor to k on the approximate kNN search + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + float Oversample { get; set; } +} + +public readonly partial struct RescoreVectorDescriptor +{ + internal Elastic.Clients.Elasticsearch.RescoreVector Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreVectorDescriptor(Elastic.Clients.Elasticsearch.RescoreVector instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RescoreVectorDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RescoreVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.RescoreVectorDescriptor(Elastic.Clients.Elasticsearch.RescoreVector instance) => new Elastic.Clients.Elasticsearch.RescoreVectorDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RescoreVector(Elastic.Clients.Elasticsearch.RescoreVectorDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Applies the specified oversample factor to k on the approximate kNN search + /// + /// + public Elastic.Clients.Elasticsearch.RescoreVectorDescriptor Oversample(float value) + { + Instance.Oversample = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RescoreVector Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RescoreVectorDescriptor(new Elastic.Clients.Elasticsearch.RescoreVector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retries.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retries.g.cs index e1d9e9efe76..da7d0b3928d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retries.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retries.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RetriesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBulk = System.Text.Json.JsonEncodedText.Encode("bulk"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.Retries Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBulk = default; + LocalJsonValue propSearch = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBulk.TryReadProperty(ref reader, options, PropBulk, null)) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Retries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Bulk = propBulk.Value, + Search = propSearch.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Retries value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBulk, value.Bulk, null, null); + writer.WriteProperty(options, PropSearch, value.Search, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RetriesConverter))] public sealed partial class Retries { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Retries(long bulk, long search) + { + Bulk = bulk; + Search = search; + } +#if NET7_0_OR_GREATER + public Retries() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Retries() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Retries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of bulk actions retried. /// /// - [JsonInclude, JsonPropertyName("bulk")] - public long Bulk { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Bulk { get; set; } /// /// /// The number of search actions retried. /// /// - [JsonInclude, JsonPropertyName("search")] - public long Search { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Search { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retriever.g.cs index 5a79a236a6a..f7d1e6f2f9c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Retriever.g.cs @@ -17,271 +17,544 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[JsonConverter(typeof(RetrieverConverter))] -public sealed partial class Retriever +internal sealed partial class RetrieverConverter : System.Text.Json.Serialization.JsonConverter { - internal Retriever(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static Retriever Knn(Elastic.Clients.Elasticsearch.KnnRetriever knnRetriever) => new Retriever("knn", knnRetriever); - public static Retriever Rrf(Elastic.Clients.Elasticsearch.RRFRetriever rRFRetriever) => new Retriever("rrf", rRFRetriever); - public static Retriever Rule(Elastic.Clients.Elasticsearch.RuleRetriever ruleRetriever) => new Retriever("rule", ruleRetriever); - public static Retriever Standard(Elastic.Clients.Elasticsearch.StandardRetriever standardRetriever) => new Retriever("standard", standardRetriever); - public static Retriever TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityReranker textSimilarityReranker) => new Retriever("text_similarity_reranker", textSimilarityReranker); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantKnn = System.Text.Json.JsonEncodedText.Encode("knn"); + private static readonly System.Text.Json.JsonEncodedText VariantRrf = System.Text.Json.JsonEncodedText.Encode("rrf"); + private static readonly System.Text.Json.JsonEncodedText VariantRule = System.Text.Json.JsonEncodedText.Encode("rule"); + private static readonly System.Text.Json.JsonEncodedText VariantStandard = System.Text.Json.JsonEncodedText.Encode("standard"); + private static readonly System.Text.Json.JsonEncodedText VariantTextSimilarityReranker = System.Text.Json.JsonEncodedText.Encode("text_similarity_reranker"); -internal sealed partial class RetrieverConverter : JsonConverter -{ - public override Retriever Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Retriever Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantKnn)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantKnn.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "knn") + if (reader.ValueTextEquals(VariantRrf)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRrf.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rrf") + if (reader.ValueTextEquals(VariantRule)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRule.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "rule") + if (reader.ValueTextEquals(VariantStandard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantStandard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "standard") + if (reader.ValueTextEquals(VariantTextSimilarityReranker)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTextSimilarityReranker.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "text_similarity_reranker") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Retriever' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Retriever(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Retriever value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Retriever value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "knn": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.KnnRetriever)value.Variant, options); - break; - case "rrf": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.RRFRetriever)value.Variant, options); - break; - case "rule": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.RuleRetriever)value.Variant, options); - break; - case "standard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.StandardRetriever)value.Variant, options); - break; - case "text_similarity_reranker": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.TextSimilarityReranker)value.Variant, options); - break; - } + case null: + break; + case "knn": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.KnnRetriever)value.Variant, null, null); + break; + case "rrf": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.RRFRetriever)value.Variant, null, null); + break; + case "rule": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.RuleRetriever)value.Variant, null, null); + break; + case "standard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.StandardRetriever)value.Variant, null, null); + break; + case "text_similarity_reranker": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.TextSimilarityReranker)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Retriever)}'."); } writer.WriteEndObject(); } } -public sealed partial class RetrieverDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RetrieverConverter))] +public sealed partial class Retriever { - internal RetrieverDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Retriever() + { + } +#endif +#if !NET7_0_OR_GREATER + public Retriever() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public RetrieverDescriptor() : base() + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.KnnRetriever? Knn { get => GetVariant("knn"); set => SetVariant("knn", value); } + + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RRFRetriever? Rrf { get => GetVariant("rrf"); set => SetVariant("rrf", value); } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetriever? Rule { get => GetVariant("rule"); set => SetVariant("rule", value); } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetriever? Standard { get => GetVariant("standard"); set => SetVariant("standard", value); } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityReranker? TextSimilarityReranker { get => GetVariant("text_similarity_reranker"); set => SetVariant("text_similarity_reranker", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.KnnRetriever value) => new Elastic.Clients.Elasticsearch.Retriever { Knn = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.RRFRetriever value) => new Elastic.Clients.Elasticsearch.Retriever { Rrf = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.RuleRetriever value) => new Elastic.Clients.Elasticsearch.Retriever { Rule = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.StandardRetriever value) => new Elastic.Clients.Elasticsearch.Retriever { Standard = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.TextSimilarityReranker value) => new Elastic.Clients.Elasticsearch.Retriever { TextSimilarityReranker = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct RetrieverDescriptor +{ + internal Elastic.Clients.Elasticsearch.Retriever Instance { get; init; } - private RetrieverDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieverDescriptor(Elastic.Clients.Elasticsearch.Retriever instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private RetrieverDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieverDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.KnnRetriever knnRetriever) => Set(knnRetriever, "knn"); - public RetrieverDescriptor Knn(Action> configure) => Set(configure, "knn"); - public RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.RRFRetriever rRFRetriever) => Set(rRFRetriever, "rrf"); - public RetrieverDescriptor Rrf(Action> configure) => Set(configure, "rrf"); - public RetrieverDescriptor Rule(Elastic.Clients.Elasticsearch.RuleRetriever ruleRetriever) => Set(ruleRetriever, "rule"); - public RetrieverDescriptor Rule(Action> configure) => Set(configure, "rule"); - public RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.StandardRetriever standardRetriever) => Set(standardRetriever, "standard"); - public RetrieverDescriptor Standard(Action> configure) => Set(configure, "standard"); - public RetrieverDescriptor TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityReranker textSimilarityReranker) => Set(textSimilarityReranker, "text_similarity_reranker"); - public RetrieverDescriptor TextSimilarityReranker(Action> configure) => Set(configure, "text_similarity_reranker"); + public static explicit operator Elastic.Clients.Elasticsearch.RetrieverDescriptor(Elastic.Clients.Elasticsearch.Retriever instance) => new Elastic.Clients.Elasticsearch.RetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.KnnRetriever? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Knn = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Knn(System.Action> action) + { + Instance.Knn = Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.RRFRetriever? value) + { + Instance.Rrf = value; + return this; + } + + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rrf(System.Action> action) + { + Instance.Rrf = Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rule(Elastic.Clients.Elasticsearch.RuleRetriever? value) + { + Instance.Rule = value; + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rule(System.Action> action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.StandardRetriever? value) + { + Instance.Standard = value; + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard() + { + Instance.Standard = Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor.Build(null); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard(System.Action>? action) + { + Instance.Standard = Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityReranker? value) + { + Instance.TextSimilarityReranker = value; + return this; + } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor TextSimilarityReranker(System.Action> action) + { + Instance.TextSimilarityReranker = Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Retriever Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.RetrieverDescriptor(new Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RetrieverDescriptor : SerializableDescriptor +public readonly partial struct RetrieverDescriptor { - internal RetrieverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Retriever Instance { get; init; } - public RetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieverDescriptor(Elastic.Clients.Elasticsearch.Retriever instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieverDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private RetrieverDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.RetrieverDescriptor(Elastic.Clients.Elasticsearch.Retriever instance) => new Elastic.Clients.Elasticsearch.RetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.KnnRetriever? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Knn = value; + return this; } - private RetrieverDescriptor Set(object variant, string variantName) + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Knn(System.Action action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Knn = Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor.Build(action); + return this; } - public RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.KnnRetriever knnRetriever) => Set(knnRetriever, "knn"); - public RetrieverDescriptor Knn(Action configure) => Set(configure, "knn"); - public RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.RRFRetriever rRFRetriever) => Set(rRFRetriever, "rrf"); - public RetrieverDescriptor Rrf(Action configure) => Set(configure, "rrf"); - public RetrieverDescriptor Rule(Elastic.Clients.Elasticsearch.RuleRetriever ruleRetriever) => Set(ruleRetriever, "rule"); - public RetrieverDescriptor Rule(Action configure) => Set(configure, "rule"); - public RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.StandardRetriever standardRetriever) => Set(standardRetriever, "standard"); - public RetrieverDescriptor Standard(Action configure) => Set(configure, "standard"); - public RetrieverDescriptor TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityReranker textSimilarityReranker) => Set(textSimilarityReranker, "text_similarity_reranker"); - public RetrieverDescriptor TextSimilarityReranker(Action configure) => Set(configure, "text_similarity_reranker"); + /// + /// + /// A retriever that replaces the functionality of a knn search. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Knn(System.Action> action) + { + Instance.Knn = Elastic.Clients.Elasticsearch.KnnRetrieverDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.RRFRetriever? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Rrf = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rrf(System.Action action) + { + Instance.Rrf = Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// A retriever that produces top documents from reciprocal rank fusion (RRF). + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rrf(System.Action> action) + { + Instance.Rrf = Elastic.Clients.Elasticsearch.RrfRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rule(Elastic.Clients.Elasticsearch.RuleRetriever? value) + { + Instance.Rule = value; + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rule(System.Action action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a rule query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Rule(System.Action> action) + { + Instance.Rule = Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.StandardRetriever? value) + { + Instance.Standard = value; + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard() + { + Instance.Standard = Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor.Build(null); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard(System.Action? action) + { + Instance.Standard = Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that replaces the functionality of a traditional query. + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor Standard(System.Action>? action) + { + Instance.Standard = Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityReranker? value) + { + Instance.TextSimilarityReranker = value; + return this; + } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor TextSimilarityReranker(System.Action action) + { + Instance.TextSimilarityReranker = Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor.Build(action); + return this; + } + + /// + /// + /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI + /// + /// + public Elastic.Clients.Elasticsearch.RetrieverDescriptor TextSimilarityReranker(System.Action> action) + { + Instance.TextSimilarityReranker = Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Retriever Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RetrieverDescriptor(new Elastic.Clients.Elasticsearch.Retriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/DateHistogramGrouping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/DateHistogramGrouping.g.cs index e9d3eb82d8d..b8abd3c7b62 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/DateHistogramGrouping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/DateHistogramGrouping.g.cs @@ -17,24 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class DateHistogramGroupingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCalendarInterval = System.Text.Json.JsonEncodedText.Encode("calendar_interval"); + private static readonly System.Text.Json.JsonEncodedText PropDelay = System.Text.Json.JsonEncodedText.Encode("delay"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFixedInterval = System.Text.Json.JsonEncodedText.Encode("fixed_interval"); + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCalendarInterval = default; + LocalJsonValue propDelay = default; + LocalJsonValue propField = default; + LocalJsonValue propFixedInterval = default; + LocalJsonValue propFormat = default; + LocalJsonValue propInterval = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCalendarInterval.TryReadProperty(ref reader, options, PropCalendarInterval, null)) + { + continue; + } + + if (propDelay.TryReadProperty(ref reader, options, PropDelay, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFixedInterval.TryReadProperty(ref reader, options, PropFixedInterval, null)) + { + continue; + } + + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CalendarInterval = propCalendarInterval.Value, + Delay = propDelay.Value, + Field = propField.Value, + FixedInterval = propFixedInterval.Value, + Format = propFormat.Value, + Interval = propInterval.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCalendarInterval, value.CalendarInterval, null, null); + writer.WriteProperty(options, PropDelay, value.Delay, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFixedInterval, value.FixedInterval, null, null); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropInterval, value.Interval, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingConverter))] public sealed partial class DateHistogramGrouping { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramGrouping(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public DateHistogramGrouping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DateHistogramGrouping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The interval of time buckets to be generated when rolling up. /// /// - [JsonInclude, JsonPropertyName("calendar_interval")] public Elastic.Clients.Elasticsearch.Duration? CalendarInterval { get; set; } /// @@ -46,7 +157,6 @@ public sealed partial class DateHistogramGrouping /// You need to specify a delay that matches the longest period of time you expect out-of-order data to arrive. /// /// - [JsonInclude, JsonPropertyName("delay")] public Elastic.Clients.Elasticsearch.Duration? Delay { get; set; } /// @@ -54,19 +164,19 @@ public sealed partial class DateHistogramGrouping /// The date field that is to be rolled up. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// The interval of time buckets to be generated when rolling up. /// /// - [JsonInclude, JsonPropertyName("fixed_interval")] public Elastic.Clients.Elasticsearch.Duration? FixedInterval { get; set; } - [JsonInclude, JsonPropertyName("format")] public string? Format { get; set; } - [JsonInclude, JsonPropertyName("interval")] public Elastic.Clients.Elasticsearch.Duration? Interval { get; set; } /// @@ -76,35 +186,37 @@ public sealed partial class DateHistogramGrouping /// By default, rollup documents are stored in UTC. /// /// - [JsonInclude, JsonPropertyName("time_zone")] public string? TimeZone { get; set; } } -public sealed partial class DateHistogramGroupingDescriptor : SerializableDescriptor> +public readonly partial struct DateHistogramGroupingDescriptor { - internal DateHistogramGroupingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping instance) + { + Instance = instance; + } - public DateHistogramGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramGroupingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? DelayValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? IntervalValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor descriptor) => descriptor.Instance; /// /// /// The interval of time buckets to be generated when rolling up. /// /// - public DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Duration? calendarInterval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Duration? value) { - CalendarIntervalValue = calendarInterval; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -116,21 +228,10 @@ public DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clien /// You need to specify a delay that matches the longest period of time you expect out-of-order data to arrive. /// /// - public DateHistogramGroupingDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? delay) - { - DelayValue = delay; - return Self; - } - - /// - /// - /// The date field that is to be rolled up. - /// - /// - public DateHistogramGroupingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? value) { - FieldValue = field; - return Self; + Instance.Delay = value; + return this; } /// @@ -138,10 +239,10 @@ public DateHistogramGroupingDescriptor Field(Elastic.Clients.Elastics /// The date field that is to be rolled up. /// /// - public DateHistogramGroupingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -149,10 +250,10 @@ public DateHistogramGroupingDescriptor Field(Expression /// - public DateHistogramGroupingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -160,22 +261,22 @@ public DateHistogramGroupingDescriptor Field(Expression /// - public DateHistogramGroupingDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? fixedInterval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } - public DateHistogramGroupingDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? interval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } /// @@ -185,82 +286,49 @@ public DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elast /// By default, rollup documents are stored in UTC. /// /// - public DateHistogramGroupingDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping Build(System.Action> action) { - writer.WriteStartObject(); - if (CalendarIntervalValue is not null) - { - writer.WritePropertyName("calendar_interval"); - JsonSerializer.Serialize(writer, CalendarIntervalValue, options); - } - - if (DelayValue is not null) - { - writer.WritePropertyName("delay"); - JsonSerializer.Serialize(writer, DelayValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FixedIntervalValue is not null) - { - writer.WritePropertyName("fixed_interval"); - JsonSerializer.Serialize(writer, FixedIntervalValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IntervalValue is not null) - { - writer.WritePropertyName("interval"); - JsonSerializer.Serialize(writer, IntervalValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class DateHistogramGroupingDescriptor : SerializableDescriptor +public readonly partial struct DateHistogramGroupingDescriptor { - internal DateHistogramGroupingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping instance) + { + Instance = instance; + } - public DateHistogramGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DateHistogramGroupingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration? CalendarIntervalValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? DelayValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? FixedIntervalValue { get; set; } - private string? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? IntervalValue { get; set; } - private string? TimeZoneValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor descriptor) => descriptor.Instance; /// /// /// The interval of time buckets to be generated when rolling up. /// /// - public DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Duration? calendarInterval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clients.Elasticsearch.Duration? value) { - CalendarIntervalValue = calendarInterval; - return Self; + Instance.CalendarInterval = value; + return this; } /// @@ -272,10 +340,10 @@ public DateHistogramGroupingDescriptor CalendarInterval(Elastic.Clients.Elastics /// You need to specify a delay that matches the longest period of time you expect out-of-order data to arrive. /// /// - public DateHistogramGroupingDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? delay) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? value) { - DelayValue = delay; - return Self; + Instance.Delay = value; + return this; } /// @@ -283,10 +351,10 @@ public DateHistogramGroupingDescriptor Delay(Elastic.Clients.Elasticsearch.Durat /// The date field that is to be rolled up. /// /// - public DateHistogramGroupingDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -294,21 +362,10 @@ public DateHistogramGroupingDescriptor Field(Elastic.Clients.Elasticsearch.Field /// The date field that is to be rolled up. /// /// - public DateHistogramGroupingDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; - } - - /// - /// - /// The date field that is to be rolled up. - /// - /// - public DateHistogramGroupingDescriptor Field(Expression> field) - { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -316,22 +373,22 @@ public DateHistogramGroupingDescriptor Field(Expression /// - public DateHistogramGroupingDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? fixedInterval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor FixedInterval(Elastic.Clients.Elasticsearch.Duration? value) { - FixedIntervalValue = fixedInterval; - return Self; + Instance.FixedInterval = value; + return this; } - public DateHistogramGroupingDescriptor Format(string? format) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Format(string? value) { - FormatValue = format; - return Self; + Instance.Format = value; + return this; } - public DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? interval) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elasticsearch.Duration? value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } /// @@ -341,53 +398,17 @@ public DateHistogramGroupingDescriptor Interval(Elastic.Clients.Elasticsearch.Du /// By default, rollup documents are stored in UTC. /// /// - public DateHistogramGroupingDescriptor TimeZone(string? timeZone) + public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor TimeZone(string? value) { - TimeZoneValue = timeZone; - return Self; + Instance.TimeZone = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping Build(System.Action action) { - writer.WriteStartObject(); - if (CalendarIntervalValue is not null) - { - writer.WritePropertyName("calendar_interval"); - JsonSerializer.Serialize(writer, CalendarIntervalValue, options); - } - - if (DelayValue is not null) - { - writer.WritePropertyName("delay"); - JsonSerializer.Serialize(writer, DelayValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - if (FixedIntervalValue is not null) - { - writer.WritePropertyName("fixed_interval"); - JsonSerializer.Serialize(writer, FixedIntervalValue, options); - } - - if (!string.IsNullOrEmpty(FormatValue)) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(FormatValue); - } - - if (IntervalValue is not null) - { - writer.WritePropertyName("interval"); - JsonSerializer.Serialize(writer, IntervalValue, options); - } - - if (!string.IsNullOrEmpty(TimeZoneValue)) - { - writer.WritePropertyName("time_zone"); - writer.WriteStringValue(TimeZoneValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/FieldMetric.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/FieldMetric.g.cs index 724b1020dd8..ce3af48be26 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/FieldMetric.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/FieldMetric.g.cs @@ -17,55 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class FieldMetricConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + + public override Elastic.Clients.Elasticsearch.Rollup.FieldMetric Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue> propMetrics = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Metrics = propMetrics.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.FieldMetric value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.FieldMetricConverter))] public sealed partial class FieldMetric { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMetric(Elastic.Clients.Elasticsearch.Field field, System.Collections.Generic.ICollection metrics) + { + Field = field; + Metrics = metrics; + } +#if NET7_0_OR_GREATER + public FieldMetric() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldMetric() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The field to collect metrics for. This must be a numeric of some kind. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// /// An array of metrics to collect for the field. At least one metric must be configured. /// /// - [JsonInclude, JsonPropertyName("metrics")] - public ICollection Metrics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Metrics { get; set; } } -public sealed partial class FieldMetricDescriptor : SerializableDescriptor> +public readonly partial struct FieldMetricDescriptor { - internal FieldMetricDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.FieldMetric Instance { get; init; } - public FieldMetricDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMetricDescriptor(Elastic.Clients.Elasticsearch.Rollup.FieldMetric instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection MetricsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMetricDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(Elastic.Clients.Elasticsearch.Rollup.FieldMetric instance) => new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor descriptor) => descriptor.Instance; /// /// /// The field to collect metrics for. This must be a numeric of some kind. /// /// - public FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -73,21 +155,21 @@ public FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Fiel /// The field to collect metrics for. This must be a numeric of some kind. /// /// - public FieldMetricDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to collect metrics for. This must be a numeric of some kind. + /// An array of metrics to collect for the field. At least one metric must be configured. /// /// - public FieldMetricDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Metrics(System.Collections.Generic.ICollection value) { - FieldValue = field; - return Self; + Instance.Metrics = value; + return this; } /// @@ -95,43 +177,49 @@ public FieldMetricDescriptor Field(Expression /// An array of metrics to collect for the field. At least one metric must be configured. /// /// - public FieldMetricDescriptor Metrics(ICollection metrics) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Metrics(params Elastic.Clients.Elasticsearch.Rollup.Metric[] values) { - MetricsValue = metrics; - return Self; + Instance.Metrics = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.FieldMetric Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(new Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldMetricDescriptor : SerializableDescriptor +public readonly partial struct FieldMetricDescriptor { - internal FieldMetricDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.FieldMetric Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMetricDescriptor(Elastic.Clients.Elasticsearch.Rollup.FieldMetric instance) + { + Instance = instance; + } - public FieldMetricDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldMetricDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private ICollection MetricsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(Elastic.Clients.Elasticsearch.Rollup.FieldMetric instance) => new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor descriptor) => descriptor.Instance; /// /// /// The field to collect metrics for. This must be a numeric of some kind. /// /// - public FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -139,21 +227,21 @@ public FieldMetricDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// The field to collect metrics for. This must be a numeric of some kind. /// /// - public FieldMetricDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// /// - /// The field to collect metrics for. This must be a numeric of some kind. + /// An array of metrics to collect for the field. At least one metric must be configured. /// /// - public FieldMetricDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Metrics(System.Collections.Generic.ICollection value) { - FieldValue = field; - return Self; + Instance.Metrics = value; + return this; } /// @@ -161,19 +249,17 @@ public FieldMetricDescriptor Field(Expression /// An array of metrics to collect for the field. At least one metric must be configured. /// /// - public FieldMetricDescriptor Metrics(ICollection metrics) + public Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor Metrics(params Elastic.Clients.Elasticsearch.Rollup.Metric[] values) { - MetricsValue = metrics; - return Self; + Instance.Metrics = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.FieldMetric Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("metrics"); - JsonSerializer.Serialize(writer, MetricsValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.FieldMetricDescriptor(new Elastic.Clients.Elasticsearch.Rollup.FieldMetric(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/Groupings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/Groupings.g.cs index b484b891d30..c466c9ef3cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/Groupings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/Groupings.g.cs @@ -17,25 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class GroupingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDateHistogram = System.Text.Json.JsonEncodedText.Encode("date_histogram"); + private static readonly System.Text.Json.JsonEncodedText PropHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText PropTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + + public override Elastic.Clients.Elasticsearch.Rollup.Groupings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDateHistogram = default; + LocalJsonValue propHistogram = default; + LocalJsonValue propTerms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDateHistogram.TryReadProperty(ref reader, options, PropDateHistogram, null)) + { + continue; + } + + if (propHistogram.TryReadProperty(ref reader, options, PropHistogram, null)) + { + continue; + } + + if (propTerms.TryReadProperty(ref reader, options, PropTerms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DateHistogram = propDateHistogram.Value, + Histogram = propHistogram.Value, + Terms = propTerms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.Groupings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDateHistogram, value.DateHistogram, null, null); + writer.WriteProperty(options, PropHistogram, value.Histogram, null, null); + writer.WriteProperty(options, PropTerms, value.Terms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.GroupingsConverter))] public sealed partial class Groupings { +#if NET7_0_OR_GREATER + public Groupings() + { + } +#endif +#if !NET7_0_OR_GREATER + public Groupings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A date histogram group aggregates a date field into time-based buckets. /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. /// /// - [JsonInclude, JsonPropertyName("date_histogram")] public Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? DateHistogram { get; set; } /// @@ -43,7 +112,6 @@ public sealed partial class Groupings /// The histogram group aggregates one or more numeric fields into numeric histogram intervals. /// /// - [JsonInclude, JsonPropertyName("histogram")] public Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? Histogram { get; set; } /// @@ -53,27 +121,27 @@ public sealed partial class Groupings /// This can be potentially costly for high-cardinality groups such as IP addresses, especially if the time-bucket is particularly sparse. /// /// - [JsonInclude, JsonPropertyName("terms")] public Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? Terms { get; set; } } -public sealed partial class GroupingsDescriptor : SerializableDescriptor> +public readonly partial struct GroupingsDescriptor { - internal GroupingsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.Groupings Instance { get; init; } - public GroupingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GroupingsDescriptor(Elastic.Clients.Elasticsearch.Rollup.Groupings instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? DateHistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor DateHistogramDescriptor { get; set; } - private Action> DateHistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? HistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor HistogramDescriptor { get; set; } - private Action> HistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor TermsDescriptor { get; set; } - private Action> TermsDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GroupingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(Elastic.Clients.Elasticsearch.Rollup.Groupings instance) => new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor descriptor) => descriptor.Instance; /// /// @@ -81,28 +149,22 @@ public GroupingsDescriptor() : base() /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. /// /// - public GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? dateHistogram) - { - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = null; - DateHistogramValue = dateHistogram; - return Self; - } - - public GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? value) { - DateHistogramValue = null; - DateHistogramDescriptorAction = null; - DateHistogramDescriptor = descriptor; - return Self; + Instance.DateHistogram = value; + return this; } - public GroupingsDescriptor DateHistogram(Action> configure) + /// + /// + /// A date histogram group aggregates a date field into time-based buckets. + /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor DateHistogram(System.Action> action) { - DateHistogramValue = null; - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = configure; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor.Build(action); + return this; } /// @@ -110,28 +172,21 @@ public GroupingsDescriptor DateHistogram(Action /// - public GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? histogram) - { - HistogramDescriptor = null; - HistogramDescriptorAction = null; - HistogramValue = histogram; - return Self; - } - - public GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? value) { - HistogramValue = null; - HistogramDescriptorAction = null; - HistogramDescriptor = descriptor; - return Self; + Instance.Histogram = value; + return this; } - public GroupingsDescriptor Histogram(Action> configure) + /// + /// + /// The histogram group aggregates one or more numeric fields into numeric histogram intervals. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Histogram(System.Action> action) { - HistogramValue = null; - HistogramDescriptor = null; - HistogramDescriptorAction = configure; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor.Build(action); + return this; } /// @@ -141,102 +196,57 @@ public GroupingsDescriptor Histogram(Action /// - public GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? terms) - { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsValue = terms; - return Self; - } - - public GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? value) { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptor = descriptor; - return Self; + Instance.Terms = value; + return this; } - public GroupingsDescriptor Terms(Action> configure) + /// + /// + /// The terms group can be used on keyword or numeric fields to allow bucketing via the terms aggregation at a later point. + /// The indexer enumerates and stores all values of a field for each time-period. + /// This can be potentially costly for high-cardinality groups such as IP addresses, especially if the time-bucket is particularly sparse. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Terms(System.Action> action) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = configure; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.Groupings Build(System.Action>? action) { - writer.WriteStartObject(); - if (DateHistogramDescriptor is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramDescriptor, options); - } - else if (DateHistogramDescriptorAction is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(DateHistogramDescriptorAction), options); - } - else if (DateHistogramValue is not null) + if (action is null) { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramValue, options); + return new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (HistogramDescriptor is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramDescriptor, options); - } - else if (HistogramDescriptorAction is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(HistogramDescriptorAction), options); - } - else if (HistogramValue is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramValue, options); - } - - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - } - else if (TermsDescriptorAction is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(TermsDescriptorAction), options); - } - else if (TermsValue is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GroupingsDescriptor : SerializableDescriptor +public readonly partial struct GroupingsDescriptor { - internal GroupingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.Groupings Instance { get; init; } - public GroupingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GroupingsDescriptor(Elastic.Clients.Elasticsearch.Rollup.Groupings instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? DateHistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor DateHistogramDescriptor { get; set; } - private Action DateHistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? HistogramValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor HistogramDescriptor { get; set; } - private Action HistogramDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? TermsValue { get; set; } - private Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor TermsDescriptor { get; set; } - private Action TermsDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GroupingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(Elastic.Clients.Elasticsearch.Rollup.Groupings instance) => new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor descriptor) => descriptor.Instance; /// /// @@ -244,28 +254,34 @@ public GroupingsDescriptor() : base() /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. /// /// - public GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? dateHistogram) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGrouping? value) { - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = null; - DateHistogramValue = dateHistogram; - return Self; + Instance.DateHistogram = value; + return this; } - public GroupingsDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor descriptor) + /// + /// + /// A date histogram group aggregates a date field into time-based buckets. + /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor DateHistogram(System.Action action) { - DateHistogramValue = null; - DateHistogramDescriptorAction = null; - DateHistogramDescriptor = descriptor; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor.Build(action); + return this; } - public GroupingsDescriptor DateHistogram(Action configure) + /// + /// + /// A date histogram group aggregates a date field into time-based buckets. + /// This group is mandatory; you currently cannot roll up documents without a timestamp and a date_histogram group. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor DateHistogram(System.Action> action) { - DateHistogramValue = null; - DateHistogramDescriptor = null; - DateHistogramDescriptorAction = configure; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor.Build(action); + return this; } /// @@ -273,28 +289,32 @@ public GroupingsDescriptor DateHistogram(Action /// - public GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? histogram) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping? value) { - HistogramDescriptor = null; - HistogramDescriptorAction = null; - HistogramValue = histogram; - return Self; + Instance.Histogram = value; + return this; } - public GroupingsDescriptor Histogram(Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor descriptor) + /// + /// + /// The histogram group aggregates one or more numeric fields into numeric histogram intervals. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Histogram(System.Action action) { - HistogramValue = null; - HistogramDescriptorAction = null; - HistogramDescriptor = descriptor; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor.Build(action); + return this; } - public GroupingsDescriptor Histogram(Action configure) + /// + /// + /// The histogram group aggregates one or more numeric fields into numeric histogram intervals. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Histogram(System.Action> action) { - HistogramValue = null; - HistogramDescriptor = null; - HistogramDescriptorAction = configure; - return Self; + Instance.Histogram = Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor.Build(action); + return this; } /// @@ -304,81 +324,48 @@ public GroupingsDescriptor Histogram(Action /// - public GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? terms) + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping? value) { - TermsDescriptor = null; - TermsDescriptorAction = null; - TermsValue = terms; - return Self; + Instance.Terms = value; + return this; } - public GroupingsDescriptor Terms(Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor descriptor) + /// + /// + /// The terms group can be used on keyword or numeric fields to allow bucketing via the terms aggregation at a later point. + /// The indexer enumerates and stores all values of a field for each time-period. + /// This can be potentially costly for high-cardinality groups such as IP addresses, especially if the time-bucket is particularly sparse. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Terms(System.Action action) { - TermsValue = null; - TermsDescriptorAction = null; - TermsDescriptor = descriptor; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor.Build(action); + return this; } - public GroupingsDescriptor Terms(Action configure) + /// + /// + /// The terms group can be used on keyword or numeric fields to allow bucketing via the terms aggregation at a later point. + /// The indexer enumerates and stores all values of a field for each time-period. + /// This can be potentially costly for high-cardinality groups such as IP addresses, especially if the time-bucket is particularly sparse. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor Terms(System.Action> action) { - TermsValue = null; - TermsDescriptor = null; - TermsDescriptorAction = configure; - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.Groupings Build(System.Action? action) { - writer.WriteStartObject(); - if (DateHistogramDescriptor is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramDescriptor, options); - } - else if (DateHistogramDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.DateHistogramGroupingDescriptor(DateHistogramDescriptorAction), options); - } - else if (DateHistogramValue is not null) - { - writer.WritePropertyName("date_histogram"); - JsonSerializer.Serialize(writer, DateHistogramValue, options); - } - - if (HistogramDescriptor is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramDescriptor, options); - } - else if (HistogramDescriptorAction is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(HistogramDescriptorAction), options); - } - else if (HistogramValue is not null) - { - writer.WritePropertyName("histogram"); - JsonSerializer.Serialize(writer, HistogramValue, options); + return new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (TermsDescriptor is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsDescriptor, options); - } - else if (TermsDescriptorAction is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(TermsDescriptorAction), options); - } - else if (TermsValue is not null) - { - writer.WritePropertyName("terms"); - JsonSerializer.Serialize(writer, TermsValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.GroupingsDescriptor(new Elastic.Clients.Elasticsearch.Rollup.Groupings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/HistogramGrouping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/HistogramGrouping.g.cs index 01f81c216af..3325dd147ec 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/HistogramGrouping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/HistogramGrouping.g.cs @@ -17,18 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class HistogramGroupingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropInterval = System.Text.Json.JsonEncodedText.Encode("interval"); + + public override Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFields = default; + LocalJsonValue propInterval = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propInterval.TryReadProperty(ref reader, options, PropInterval, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Interval = propInterval.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropInterval, value.Interval, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingConverter))] public sealed partial class HistogramGrouping { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramGrouping(Elastic.Clients.Elasticsearch.Fields fields, long interval) + { + Fields = fields; + Interval = interval; + } +#if NET7_0_OR_GREATER + public HistogramGrouping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HistogramGrouping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The set of fields that you wish to build histograms for. @@ -36,9 +104,11 @@ public sealed partial class HistogramGrouping /// Order does not matter. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Fields { get; set; } /// /// @@ -47,20 +117,44 @@ public sealed partial class HistogramGrouping /// Note that only one interval can be specified in the histogram group, meaning that all fields being grouped via the histogram must share the same interval. /// /// - [JsonInclude, JsonPropertyName("interval")] - public long Interval { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Interval { get; set; } } -public sealed partial class HistogramGroupingDescriptor : SerializableDescriptor> +public readonly partial struct HistogramGroupingDescriptor { - internal HistogramGroupingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping instance) + { + Instance = instance; + } - public HistogramGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramGroupingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private long IntervalValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The set of fields that you wish to build histograms for. + /// All fields specified must be some kind of numeric. + /// Order does not matter. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) + { + Instance.Fields = value; + return this; + } /// /// @@ -69,10 +163,10 @@ public HistogramGroupingDescriptor() : base() /// Order does not matter. /// /// - public HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -82,33 +176,52 @@ public HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsear /// Note that only one interval can be specified in the histogram group, meaning that all fields being grouped via the histogram must share the same interval. /// /// - public HistogramGroupingDescriptor Interval(long interval) + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Interval(long value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class HistogramGroupingDescriptor : SerializableDescriptor +public readonly partial struct HistogramGroupingDescriptor { - internal HistogramGroupingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping instance) + { + Instance = instance; + } - public HistogramGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HistogramGroupingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } - private long IntervalValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The set of fields that you wish to build histograms for. + /// All fields specified must be some kind of numeric. + /// Order does not matter. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) + { + Instance.Fields = value; + return this; + } /// /// @@ -117,10 +230,10 @@ public HistogramGroupingDescriptor() : base() /// Order does not matter. /// /// - public HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } /// @@ -130,19 +243,17 @@ public HistogramGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields f /// Note that only one interval can be specified in the histogram group, meaning that all fields being grouped via the histogram must share the same interval. /// /// - public HistogramGroupingDescriptor Interval(long interval) + public Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor Interval(long value) { - IntervalValue = interval; - return Self; + Instance.Interval = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - writer.WritePropertyName("interval"); - writer.WriteNumberValue(IntervalValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Rollup.HistogramGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.HistogramGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/IndexCapabilities.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/IndexCapabilities.g.cs index 6e42a89542c..8fe16299a11 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/IndexCapabilities.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/IndexCapabilities.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class IndexCapabilitiesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRollupJobs = System.Text.Json.JsonEncodedText.Encode("rollup_jobs"); + + public override Elastic.Clients.Elasticsearch.Rollup.IndexCapabilities Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRollupJobs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRollupJobs.TryReadProperty(ref reader, options, PropRollupJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.IndexCapabilities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RollupJobs = propRollupJobs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.IndexCapabilities value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRollupJobs, value.RollupJobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.IndexCapabilitiesConverter))] public sealed partial class IndexCapabilities { - [JsonInclude, JsonPropertyName("rollup_jobs")] - public IReadOnlyCollection RollupJobs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexCapabilities(System.Collections.Generic.IReadOnlyCollection rollupJobs) + { + RollupJobs = rollupJobs; + } +#if NET7_0_OR_GREATER + public IndexCapabilities() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexCapabilities() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexCapabilities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RollupJobs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilities.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilities.g.cs index 14261858c28..2168132f25f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilities.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilities.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupCapabilitiesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRollupJobs = System.Text.Json.JsonEncodedText.Encode("rollup_jobs"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupCapabilities Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propRollupJobs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRollupJobs.TryReadProperty(ref reader, options, PropRollupJobs, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupCapabilities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RollupJobs = propRollupJobs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupCapabilities value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRollupJobs, value.RollupJobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupCapabilitiesConverter))] public sealed partial class RollupCapabilities { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupCapabilities(System.Collections.Generic.IReadOnlyCollection rollupJobs) + { + RollupJobs = rollupJobs; + } +#if NET7_0_OR_GREATER + public RollupCapabilities() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupCapabilities() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupCapabilities(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// There can be multiple, independent jobs configured for a single index or index pattern. Each of these jobs may have different configurations, so the API returns a list of all the various configurations available. /// /// - [JsonInclude, JsonPropertyName("rollup_jobs")] - public IReadOnlyCollection RollupJobs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection RollupJobs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilitySummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilitySummary.g.cs index 45fffa5a070..bda00b0cbcf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilitySummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupCapabilitySummary.g.cs @@ -17,25 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupCapabilitySummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPattern = System.Text.Json.JsonEncodedText.Encode("index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropRollupIndex = System.Text.Json.JsonEncodedText.Encode("rollup_index"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupCapabilitySummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propFields = default; + LocalJsonValue propIndexPattern = default; + LocalJsonValue propJobId = default; + LocalJsonValue propRollupIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)) + { + continue; + } + + if (propIndexPattern.TryReadProperty(ref reader, options, PropIndexPattern, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propRollupIndex.TryReadProperty(ref reader, options, PropRollupIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupCapabilitySummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + IndexPattern = propIndexPattern.Value, + JobId = propJobId.Value, + RollupIndex = propRollupIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupCapabilitySummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropIndexPattern, value.IndexPattern, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropRollupIndex, value.RollupIndex, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupCapabilitySummaryConverter))] public sealed partial class RollupCapabilitySummary { - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(IReadOnlyCollection))] - public IReadOnlyDictionary> Fields { get; init; } - [JsonInclude, JsonPropertyName("index_pattern")] - public string IndexPattern { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("rollup_index")] - public string RollupIndex { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupCapabilitySummary(System.Collections.Generic.IReadOnlyDictionary> fields, string indexPattern, string jobId, string rollupIndex) + { + Fields = fields; + IndexPattern = indexPattern; + JobId = jobId; + RollupIndex = rollupIndex; + } +#if NET7_0_OR_GREATER + public RollupCapabilitySummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupCapabilitySummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupCapabilitySummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RollupIndex { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupFieldSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupFieldSummary.g.cs index 86e1f711161..52e003d7aa3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupFieldSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupFieldSummary.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupFieldSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAgg = System.Text.Json.JsonEncodedText.Encode("agg"); + private static readonly System.Text.Json.JsonEncodedText PropCalendarInterval = System.Text.Json.JsonEncodedText.Encode("calendar_interval"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupFieldSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAgg = default; + LocalJsonValue propCalendarInterval = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAgg.TryReadProperty(ref reader, options, PropAgg, null)) + { + continue; + } + + if (propCalendarInterval.TryReadProperty(ref reader, options, PropCalendarInterval, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupFieldSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Agg = propAgg.Value, + CalendarInterval = propCalendarInterval.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupFieldSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAgg, value.Agg, null, null); + writer.WriteProperty(options, PropCalendarInterval, value.CalendarInterval, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupFieldSummaryConverter))] public sealed partial class RollupFieldSummary { - [JsonInclude, JsonPropertyName("agg")] - public string Agg { get; init; } - [JsonInclude, JsonPropertyName("calendar_interval")] - public Elastic.Clients.Elasticsearch.Duration? CalendarInterval { get; init; } - [JsonInclude, JsonPropertyName("time_zone")] - public string? TimeZone { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupFieldSummary(string agg) + { + Agg = agg; + } +#if NET7_0_OR_GREATER + public RollupFieldSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupFieldSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupFieldSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Agg { get; set; } + public Elastic.Clients.Elasticsearch.Duration? CalendarInterval { get; set; } + public string? TimeZone { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJob.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJob.g.cs index 156bc4d18f1..748ca80f3f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJob.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJob.g.cs @@ -17,25 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJob Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConfig = default; + LocalJsonValue propStats = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJob(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Config = propConfig.Value, + Stats = propStats.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJob value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobConverter))] public sealed partial class RollupJob { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJob(Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration config, Elastic.Clients.Elasticsearch.Rollup.RollupJobStats stats, Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus status) + { + Config = config; + Stats = stats; + Status = status; + } +#if NET7_0_OR_GREATER + public RollupJob() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJob() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJob(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The rollup job configuration. /// /// - [JsonInclude, JsonPropertyName("config")] - public Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration Config { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration Config { get; set; } /// /// @@ -44,14 +125,20 @@ public sealed partial class RollupJob /// If a node is restarted, these stats are reset. /// /// - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Rollup.RollupJobStats Stats { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.RollupJobStats Stats { get; set; } /// /// /// The current status of the indexer for the rollup job. /// /// - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus Status { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobConfiguration.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobConfiguration.g.cs index a0533b83fe7..ef1de6fd02d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobConfiguration.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobConfiguration.g.cs @@ -17,32 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobConfigurationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCron = System.Text.Json.JsonEncodedText.Encode("cron"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPattern = System.Text.Json.JsonEncodedText.Encode("index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropMetrics = System.Text.Json.JsonEncodedText.Encode("metrics"); + private static readonly System.Text.Json.JsonEncodedText PropPageSize = System.Text.Json.JsonEncodedText.Encode("page_size"); + private static readonly System.Text.Json.JsonEncodedText PropRollupIndex = System.Text.Json.JsonEncodedText.Encode("rollup_index"); + private static readonly System.Text.Json.JsonEncodedText PropTimeout = System.Text.Json.JsonEncodedText.Encode("timeout"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCron = default; + LocalJsonValue propGroups = default; + LocalJsonValue propId = default; + LocalJsonValue propIndexPattern = default; + LocalJsonValue> propMetrics = default; + LocalJsonValue propPageSize = default; + LocalJsonValue propRollupIndex = default; + LocalJsonValue propTimeout = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCron.TryReadProperty(ref reader, options, PropCron, null)) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIndexPattern.TryReadProperty(ref reader, options, PropIndexPattern, null)) + { + continue; + } + + if (propMetrics.TryReadProperty(ref reader, options, PropMetrics, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propPageSize.TryReadProperty(ref reader, options, PropPageSize, null)) + { + continue; + } + + if (propRollupIndex.TryReadProperty(ref reader, options, PropRollupIndex, null)) + { + continue; + } + + if (propTimeout.TryReadProperty(ref reader, options, PropTimeout, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cron = propCron.Value, + Groups = propGroups.Value, + Id = propId.Value, + IndexPattern = propIndexPattern.Value, + Metrics = propMetrics.Value, + PageSize = propPageSize.Value, + RollupIndex = propRollupIndex.Value, + Timeout = propTimeout.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJobConfiguration value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCron, value.Cron, null, null); + writer.WriteProperty(options, PropGroups, value.Groups, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndexPattern, value.IndexPattern, null, null); + writer.WriteProperty(options, PropMetrics, value.Metrics, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPageSize, value.PageSize, null, null); + writer.WriteProperty(options, PropRollupIndex, value.RollupIndex, null, null); + writer.WriteProperty(options, PropTimeout, value.Timeout, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobConfigurationConverter))] public sealed partial class RollupJobConfiguration { - [JsonInclude, JsonPropertyName("cron")] - public string Cron { get; init; } - [JsonInclude, JsonPropertyName("groups")] - public Elastic.Clients.Elasticsearch.Rollup.Groupings Groups { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("index_pattern")] - public string IndexPattern { get; init; } - [JsonInclude, JsonPropertyName("metrics")] - public IReadOnlyCollection Metrics { get; init; } - [JsonInclude, JsonPropertyName("page_size")] - public long PageSize { get; init; } - [JsonInclude, JsonPropertyName("rollup_index")] - public string RollupIndex { get; init; } - [JsonInclude, JsonPropertyName("timeout")] - public Elastic.Clients.Elasticsearch.Duration Timeout { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJobConfiguration(string cron, Elastic.Clients.Elasticsearch.Rollup.Groupings groups, string id, string indexPattern, System.Collections.Generic.IReadOnlyCollection metrics, long pageSize, string rollupIndex, Elastic.Clients.Elasticsearch.Duration timeout) + { + Cron = cron; + Groups = groups; + Id = id; + IndexPattern = indexPattern; + Metrics = metrics; + PageSize = pageSize; + RollupIndex = rollupIndex; + Timeout = timeout; + } +#if NET7_0_OR_GREATER + public RollupJobConfiguration() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJobConfiguration() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJobConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Cron { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.Groupings Groups { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Metrics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PageSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RollupIndex { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration Timeout { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStats.g.cs index bad88c5d7e0..014b36f37d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStats.g.cs @@ -17,40 +17,244 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocumentsProcessed = System.Text.Json.JsonEncodedText.Encode("documents_processed"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFailures = System.Text.Json.JsonEncodedText.Encode("index_failures"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTimeInMs = System.Text.Json.JsonEncodedText.Encode("index_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTotal = System.Text.Json.JsonEncodedText.Encode("index_total"); + private static readonly System.Text.Json.JsonEncodedText PropPagesProcessed = System.Text.Json.JsonEncodedText.Encode("pages_processed"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTimeInMs = System.Text.Json.JsonEncodedText.Encode("processing_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTotal = System.Text.Json.JsonEncodedText.Encode("processing_total"); + private static readonly System.Text.Json.JsonEncodedText PropRollupsIndexed = System.Text.Json.JsonEncodedText.Encode("rollups_indexed"); + private static readonly System.Text.Json.JsonEncodedText PropSearchFailures = System.Text.Json.JsonEncodedText.Encode("search_failures"); + private static readonly System.Text.Json.JsonEncodedText PropSearchTimeInMs = System.Text.Json.JsonEncodedText.Encode("search_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropSearchTotal = System.Text.Json.JsonEncodedText.Encode("search_total"); + private static readonly System.Text.Json.JsonEncodedText PropTriggerCount = System.Text.Json.JsonEncodedText.Encode("trigger_count"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJobStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocumentsProcessed = default; + LocalJsonValue propIndexFailures = default; + LocalJsonValue propIndexTimeInMs = default; + LocalJsonValue propIndexTotal = default; + LocalJsonValue propPagesProcessed = default; + LocalJsonValue propProcessingTimeInMs = default; + LocalJsonValue propProcessingTotal = default; + LocalJsonValue propRollupsIndexed = default; + LocalJsonValue propSearchFailures = default; + LocalJsonValue propSearchTimeInMs = default; + LocalJsonValue propSearchTotal = default; + LocalJsonValue propTriggerCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocumentsProcessed.TryReadProperty(ref reader, options, PropDocumentsProcessed, null)) + { + continue; + } + + if (propIndexFailures.TryReadProperty(ref reader, options, PropIndexFailures, null)) + { + continue; + } + + if (propIndexTimeInMs.TryReadProperty(ref reader, options, PropIndexTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propIndexTotal.TryReadProperty(ref reader, options, PropIndexTotal, null)) + { + continue; + } + + if (propPagesProcessed.TryReadProperty(ref reader, options, PropPagesProcessed, null)) + { + continue; + } + + if (propProcessingTimeInMs.TryReadProperty(ref reader, options, PropProcessingTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propProcessingTotal.TryReadProperty(ref reader, options, PropProcessingTotal, null)) + { + continue; + } + + if (propRollupsIndexed.TryReadProperty(ref reader, options, PropRollupsIndexed, null)) + { + continue; + } + + if (propSearchFailures.TryReadProperty(ref reader, options, PropSearchFailures, null)) + { + continue; + } + + if (propSearchTimeInMs.TryReadProperty(ref reader, options, PropSearchTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propSearchTotal.TryReadProperty(ref reader, options, PropSearchTotal, null)) + { + continue; + } + + if (propTriggerCount.TryReadProperty(ref reader, options, PropTriggerCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJobStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocumentsProcessed = propDocumentsProcessed.Value, + IndexFailures = propIndexFailures.Value, + IndexTimeInMs = propIndexTimeInMs.Value, + IndexTotal = propIndexTotal.Value, + PagesProcessed = propPagesProcessed.Value, + ProcessingTimeInMs = propProcessingTimeInMs.Value, + ProcessingTotal = propProcessingTotal.Value, + RollupsIndexed = propRollupsIndexed.Value, + SearchFailures = propSearchFailures.Value, + SearchTimeInMs = propSearchTimeInMs.Value, + SearchTotal = propSearchTotal.Value, + TriggerCount = propTriggerCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJobStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocumentsProcessed, value.DocumentsProcessed, null, null); + writer.WriteProperty(options, PropIndexFailures, value.IndexFailures, null, null); + writer.WriteProperty(options, PropIndexTimeInMs, value.IndexTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropIndexTotal, value.IndexTotal, null, null); + writer.WriteProperty(options, PropPagesProcessed, value.PagesProcessed, null, null); + writer.WriteProperty(options, PropProcessingTimeInMs, value.ProcessingTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropProcessingTotal, value.ProcessingTotal, null, null); + writer.WriteProperty(options, PropRollupsIndexed, value.RollupsIndexed, null, null); + writer.WriteProperty(options, PropSearchFailures, value.SearchFailures, null, null); + writer.WriteProperty(options, PropSearchTimeInMs, value.SearchTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropSearchTotal, value.SearchTotal, null, null); + writer.WriteProperty(options, PropTriggerCount, value.TriggerCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobStatsConverter))] public sealed partial class RollupJobStats { - [JsonInclude, JsonPropertyName("documents_processed")] - public long DocumentsProcessed { get; init; } - [JsonInclude, JsonPropertyName("index_failures")] - public long IndexFailures { get; init; } - [JsonInclude, JsonPropertyName("index_time_in_ms")] - public long IndexTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("index_total")] - public long IndexTotal { get; init; } - [JsonInclude, JsonPropertyName("pages_processed")] - public long PagesProcessed { get; init; } - [JsonInclude, JsonPropertyName("processing_time_in_ms")] - public long ProcessingTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("processing_total")] - public long ProcessingTotal { get; init; } - [JsonInclude, JsonPropertyName("rollups_indexed")] - public long RollupsIndexed { get; init; } - [JsonInclude, JsonPropertyName("search_failures")] - public long SearchFailures { get; init; } - [JsonInclude, JsonPropertyName("search_time_in_ms")] - public long SearchTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("search_total")] - public long SearchTotal { get; init; } - [JsonInclude, JsonPropertyName("trigger_count")] - public long TriggerCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJobStats(long documentsProcessed, long indexFailures, System.TimeSpan indexTimeInMs, long indexTotal, long pagesProcessed, System.TimeSpan processingTimeInMs, long processingTotal, long rollupsIndexed, long searchFailures, System.TimeSpan searchTimeInMs, long searchTotal, long triggerCount) + { + DocumentsProcessed = documentsProcessed; + IndexFailures = indexFailures; + IndexTimeInMs = indexTimeInMs; + IndexTotal = indexTotal; + PagesProcessed = pagesProcessed; + ProcessingTimeInMs = processingTimeInMs; + ProcessingTotal = processingTotal; + RollupsIndexed = rollupsIndexed; + SearchFailures = searchFailures; + SearchTimeInMs = searchTimeInMs; + SearchTotal = searchTotal; + TriggerCount = triggerCount; + } +#if NET7_0_OR_GREATER + public RollupJobStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJobStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJobStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DocumentsProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan IndexTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PagesProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ProcessingTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ProcessingTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RollupsIndexed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SearchFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan SearchTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SearchTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TriggerCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStatus.g.cs index 2da0b9dbdce..bf00bb6fa71 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobStatus.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrentPosition = System.Text.Json.JsonEncodedText.Encode("current_position"); + private static readonly System.Text.Json.JsonEncodedText PropJobState = System.Text.Json.JsonEncodedText.Encode("job_state"); + private static readonly System.Text.Json.JsonEncodedText PropUpgradedDocId = System.Text.Json.JsonEncodedText.Encode("upgraded_doc_id"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propCurrentPosition = default; + LocalJsonValue propJobState = default; + LocalJsonValue propUpgradedDocId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrentPosition.TryReadProperty(ref reader, options, PropCurrentPosition, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propJobState.TryReadProperty(ref reader, options, PropJobState, null)) + { + continue; + } + + if (propUpgradedDocId.TryReadProperty(ref reader, options, PropUpgradedDocId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CurrentPosition = propCurrentPosition.Value, + JobState = propJobState.Value, + UpgradedDocId = propUpgradedDocId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJobStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrentPosition, value.CurrentPosition, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropJobState, value.JobState, null, null); + writer.WriteProperty(options, PropUpgradedDocId, value.UpgradedDocId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobStatusConverter))] public sealed partial class RollupJobStatus { - [JsonInclude, JsonPropertyName("current_position")] - public IReadOnlyDictionary? CurrentPosition { get; init; } - [JsonInclude, JsonPropertyName("job_state")] - public Elastic.Clients.Elasticsearch.Rollup.IndexingJobState JobState { get; init; } - [JsonInclude, JsonPropertyName("upgraded_doc_id")] - public bool? UpgradedDocId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJobStatus(Elastic.Clients.Elasticsearch.Rollup.IndexingJobState jobState) + { + JobState = jobState; + } +#if NET7_0_OR_GREATER + public RollupJobStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJobStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJobStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? CurrentPosition { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Rollup.IndexingJobState JobState { get; set; } + public bool? UpgradedDocId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummary.g.cs index a015ca60a97..df3531751b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummary.g.cs @@ -17,25 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndexPattern = System.Text.Json.JsonEncodedText.Encode("index_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropJobId = System.Text.Json.JsonEncodedText.Encode("job_id"); + private static readonly System.Text.Json.JsonEncodedText PropRollupIndex = System.Text.Json.JsonEncodedText.Encode("rollup_index"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJobSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>> propFields = default; + LocalJsonValue propIndexPattern = default; + LocalJsonValue propJobId = default; + LocalJsonValue propRollupIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)) + { + continue; + } + + if (propIndexPattern.TryReadProperty(ref reader, options, PropIndexPattern, null)) + { + continue; + } + + if (propJobId.TryReadProperty(ref reader, options, PropJobId, null)) + { + continue; + } + + if (propRollupIndex.TryReadProperty(ref reader, options, PropRollupIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJobSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + IndexPattern = propIndexPattern.Value, + JobId = propJobId.Value, + RollupIndex = propRollupIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJobSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropIndexPattern, value.IndexPattern, null, null); + writer.WriteProperty(options, PropJobId, value.JobId, null, null); + writer.WriteProperty(options, PropRollupIndex, value.RollupIndex, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobSummaryConverter))] public sealed partial class RollupJobSummary { - [JsonInclude, JsonPropertyName("fields")] - [ReadOnlyFieldDictionaryConverter(typeof(IReadOnlyCollection))] - public IReadOnlyDictionary> Fields { get; init; } - [JsonInclude, JsonPropertyName("index_pattern")] - public string IndexPattern { get; init; } - [JsonInclude, JsonPropertyName("job_id")] - public string JobId { get; init; } - [JsonInclude, JsonPropertyName("rollup_index")] - public string RollupIndex { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJobSummary(System.Collections.Generic.IReadOnlyDictionary> fields, string indexPattern, string jobId, string rollupIndex) + { + Fields = fields; + IndexPattern = indexPattern; + JobId = jobId; + RollupIndex = rollupIndex; + } +#if NET7_0_OR_GREATER + public RollupJobSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJobSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJobSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary> Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexPattern { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string JobId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RollupIndex { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummaryField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummaryField.g.cs index 2e85c3cf30e..c700b0d642e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummaryField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/RollupJobSummaryField.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class RollupJobSummaryFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAgg = System.Text.Json.JsonEncodedText.Encode("agg"); + private static readonly System.Text.Json.JsonEncodedText PropCalendarInterval = System.Text.Json.JsonEncodedText.Encode("calendar_interval"); + private static readonly System.Text.Json.JsonEncodedText PropTimeZone = System.Text.Json.JsonEncodedText.Encode("time_zone"); + + public override Elastic.Clients.Elasticsearch.Rollup.RollupJobSummaryField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAgg = default; + LocalJsonValue propCalendarInterval = default; + LocalJsonValue propTimeZone = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAgg.TryReadProperty(ref reader, options, PropAgg, null)) + { + continue; + } + + if (propCalendarInterval.TryReadProperty(ref reader, options, PropCalendarInterval, null)) + { + continue; + } + + if (propTimeZone.TryReadProperty(ref reader, options, PropTimeZone, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.RollupJobSummaryField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Agg = propAgg.Value, + CalendarInterval = propCalendarInterval.Value, + TimeZone = propTimeZone.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.RollupJobSummaryField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAgg, value.Agg, null, null); + writer.WriteProperty(options, PropCalendarInterval, value.CalendarInterval, null, null); + writer.WriteProperty(options, PropTimeZone, value.TimeZone, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.RollupJobSummaryFieldConverter))] public sealed partial class RollupJobSummaryField { - [JsonInclude, JsonPropertyName("agg")] - public string Agg { get; init; } - [JsonInclude, JsonPropertyName("calendar_interval")] - public Elastic.Clients.Elasticsearch.Duration? CalendarInterval { get; init; } - [JsonInclude, JsonPropertyName("time_zone")] - public string? TimeZone { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RollupJobSummaryField(string agg) + { + Agg = agg; + } +#if NET7_0_OR_GREATER + public RollupJobSummaryField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RollupJobSummaryField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RollupJobSummaryField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Agg { get; set; } + public Elastic.Clients.Elasticsearch.Duration? CalendarInterval { get; set; } + public string? TimeZone { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/TermsGrouping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/TermsGrouping.g.cs index 5a0659a009a..67fe846e222 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/TermsGrouping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Rollup/TermsGrouping.g.cs @@ -17,18 +17,76 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Rollup; +internal sealed partial class TermsGroupingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + + public override Elastic.Clients.Elasticsearch.Rollup.TermsGrouping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFields = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static Elastic.Clients.Elasticsearch.Fields (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Rollup.TermsGrouping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Rollup.TermsGroupingConverter))] public sealed partial class TermsGrouping { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsGrouping(Elastic.Clients.Elasticsearch.Fields fields) + { + Fields = fields; + } +#if NET7_0_OR_GREATER + public TermsGrouping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TermsGrouping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The set of fields that you wish to collect terms for. @@ -36,20 +94,31 @@ public sealed partial class TermsGrouping /// Order does not matter. /// /// - [JsonInclude, JsonPropertyName("fields")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields Fields { get; set; } } -public sealed partial class TermsGroupingDescriptor : SerializableDescriptor> +public readonly partial struct TermsGroupingDescriptor { - internal TermsGroupingDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.TermsGrouping Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping instance) + { + Instance = instance; + } - public TermsGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsGroupingDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor descriptor) => descriptor.Instance; /// /// @@ -58,30 +127,52 @@ public TermsGroupingDescriptor() : base() /// Order does not matter. /// /// - public TermsGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The set of fields that you wish to collect terms for. + /// This array can contain fields that are both keyword and numerics. + /// Order does not matter. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - writer.WriteEndObject(); + Instance.Fields = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.TermsGrouping Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TermsGroupingDescriptor : SerializableDescriptor +public readonly partial struct TermsGroupingDescriptor { - internal TermsGroupingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Rollup.TermsGrouping Instance { get; init; } - public TermsGroupingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields FieldsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TermsGroupingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(Elastic.Clients.Elasticsearch.Rollup.TermsGrouping instance) => new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor descriptor) => descriptor.Instance; /// /// @@ -90,17 +181,30 @@ public TermsGroupingDescriptor() : base() /// Order does not matter. /// /// - public TermsGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields fields) + public Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor Fields(Elastic.Clients.Elasticsearch.Fields value) { - FieldsValue = fields; - return Self; + Instance.Fields = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The set of fields that you wish to collect terms for. + /// This array can contain fields that are both keyword and numerics. + /// Order does not matter. + /// + /// + public Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor Fields(params System.Linq.Expressions.Expression>[] value) { - writer.WriteStartObject(); - writer.WritePropertyName("fields"); - JsonSerializer.Serialize(writer, FieldsValue, options); - writer.WriteEndObject(); + Instance.Fields = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Rollup.TermsGrouping Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Rollup.TermsGroupingDescriptor(new Elastic.Clients.Elasticsearch.Rollup.TermsGrouping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RrfRank.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RrfRank.g.cs index d2ab09e6875..07f5fc92086 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RrfRank.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RrfRank.g.cs @@ -17,24 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RrfRankConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRankConstant = System.Text.Json.JsonEncodedText.Encode("rank_constant"); + private static readonly System.Text.Json.JsonEncodedText PropRankWindowSize = System.Text.Json.JsonEncodedText.Encode("rank_window_size"); + + public override Elastic.Clients.Elasticsearch.RrfRank Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRankConstant = default; + LocalJsonValue propRankWindowSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRankConstant.TryReadProperty(ref reader, options, PropRankConstant, null)) + { + continue; + } + + if (propRankWindowSize.TryReadProperty(ref reader, options, PropRankWindowSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RrfRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RankConstant = propRankConstant.Value, + RankWindowSize = propRankWindowSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RrfRank value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRankConstant, value.RankConstant, null, null); + writer.WriteProperty(options, PropRankWindowSize, value.RankWindowSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RrfRankConverter))] public sealed partial class RrfRank { +#if NET7_0_OR_GREATER + public RrfRank() + { + } +#endif +#if !NET7_0_OR_GREATER + public RrfRank() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RrfRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// How much influence documents in individual result sets per query have over the final ranked result set /// /// - [JsonInclude, JsonPropertyName("rank_constant")] public long? RankConstant { get; set; } /// @@ -42,32 +102,37 @@ public sealed partial class RrfRank /// Size of the individual result sets per query /// /// - [JsonInclude, JsonPropertyName("rank_window_size")] public long? RankWindowSize { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Rank(RrfRank rrfRank) => Elastic.Clients.Elasticsearch.Rank.Rrf(rrfRank); } -public sealed partial class RrfRankDescriptor : SerializableDescriptor +public readonly partial struct RrfRankDescriptor { - internal RrfRankDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RrfRank Instance { get; init; } - public RrfRankDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRankDescriptor(Elastic.Clients.Elasticsearch.RrfRank instance) { + Instance = instance; } - private long? RankConstantValue { get; set; } - private long? RankWindowSizeValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RrfRankDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RrfRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.RrfRankDescriptor(Elastic.Clients.Elasticsearch.RrfRank instance) => new Elastic.Clients.Elasticsearch.RrfRankDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RrfRank(Elastic.Clients.Elasticsearch.RrfRankDescriptor descriptor) => descriptor.Instance; /// /// /// How much influence documents in individual result sets per query have over the final ranked result set /// /// - public RrfRankDescriptor RankConstant(long? rankConstant) + public Elastic.Clients.Elasticsearch.RrfRankDescriptor RankConstant(long? value) { - RankConstantValue = rankConstant; - return Self; + Instance.RankConstant = value; + return this; } /// @@ -75,27 +140,22 @@ public RrfRankDescriptor RankConstant(long? rankConstant) /// Size of the individual result sets per query /// /// - public RrfRankDescriptor RankWindowSize(long? rankWindowSize) + public Elastic.Clients.Elasticsearch.RrfRankDescriptor RankWindowSize(long? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RrfRank Build(System.Action? action) { - writer.WriteStartObject(); - if (RankConstantValue.HasValue) + if (action is null) { - writer.WritePropertyName("rank_constant"); - writer.WriteNumberValue(RankConstantValue.Value); + return new Elastic.Clients.Elasticsearch.RrfRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.RrfRankDescriptor(new Elastic.Clients.Elasticsearch.RrfRank(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RuleRetriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RuleRetriever.g.cs index 34346cfb0ce..d28da52f8dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/RuleRetriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/RuleRetriever.g.cs @@ -17,41 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class RuleRetrieverConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMatchCriteria = System.Text.Json.JsonEncodedText.Encode("match_criteria"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropRankWindowSize = System.Text.Json.JsonEncodedText.Encode("rank_window_size"); + private static readonly System.Text.Json.JsonEncodedText PropRetriever = System.Text.Json.JsonEncodedText.Encode("retriever"); + private static readonly System.Text.Json.JsonEncodedText PropRulesetIds = System.Text.Json.JsonEncodedText.Encode("ruleset_ids"); + + public override Elastic.Clients.Elasticsearch.RuleRetriever Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFilter = default; + LocalJsonValue propMatchCriteria = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propRankWindowSize = default; + LocalJsonValue propRetriever = default; + LocalJsonValue> propRulesetIds = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMatchCriteria.TryReadProperty(ref reader, options, PropMatchCriteria, null)) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propRankWindowSize.TryReadProperty(ref reader, options, PropRankWindowSize, null)) + { + continue; + } + + if (propRetriever.TryReadProperty(ref reader, options, PropRetriever, null)) + { + continue; + } + + if (propRulesetIds.TryReadProperty(ref reader, options, PropRulesetIds, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filter = propFilter.Value, + MatchCriteria = propMatchCriteria.Value, + MinScore = propMinScore.Value, + RankWindowSize = propRankWindowSize.Value, + Retriever = propRetriever.Value, + RulesetIds = propRulesetIds.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.RuleRetriever value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMatchCriteria, value.MatchCriteria, null, null); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropRankWindowSize, value.RankWindowSize, null, null); + writer.WriteProperty(options, PropRetriever, value.Retriever, null, null); + writer.WriteProperty(options, PropRulesetIds, value.RulesetIds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.RuleRetrieverConverter))] public sealed partial class RuleRetriever { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleRetriever(object matchCriteria, Elastic.Clients.Elasticsearch.Retriever retriever, System.Collections.Generic.ICollection rulesetIds) + { + MatchCriteria = matchCriteria; + Retriever = retriever; + RulesetIds = rulesetIds; + } +#if NET7_0_OR_GREATER + public RuleRetriever() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuleRetriever() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Query to filter the documents that can match. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// The match criteria that will determine if a rule in the provided rulesets should be applied. /// /// - [JsonInclude, JsonPropertyName("match_criteria")] - public object MatchCriteria { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object MatchCriteria { get; set; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -59,7 +164,6 @@ public sealed partial class RuleRetriever /// This value determines the size of the individual result set. /// /// - [JsonInclude, JsonPropertyName("rank_window_size")] public int? RankWindowSize { get; set; } /// @@ -67,79 +171,80 @@ public sealed partial class RuleRetriever /// The retriever whose results rules should be applied to. /// /// - [JsonInclude, JsonPropertyName("retriever")] - public Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; } /// /// /// The ruleset IDs containing the rules this retriever is evaluating against. /// /// - [JsonInclude, JsonPropertyName("ruleset_ids")] - public ICollection RulesetIds { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Retriever(RuleRetriever ruleRetriever) => Elastic.Clients.Elasticsearch.Retriever.Rule(ruleRetriever); + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection RulesetIds { get; set; } } -public sealed partial class RuleRetrieverDescriptor : SerializableDescriptor> +public readonly partial struct RuleRetrieverDescriptor { - internal RuleRetrieverDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RuleRetriever Instance { get; init; } - public RuleRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleRetrieverDescriptor(Elastic.Clients.Elasticsearch.RuleRetriever instance) { + Instance = instance; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private object MatchCriteriaValue { get; set; } - private float? MinScoreValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Retriever RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action> RetrieverDescriptorAction { get; set; } - private ICollection RulesetIdsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleRetrieverDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(Elastic.Clients.Elasticsearch.RuleRetriever instance) => new Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Query to filter the documents that can match. /// /// - public RuleRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public RuleRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public RuleRetrieverDescriptor Filter(Action> configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public RuleRetrieverDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -147,10 +252,10 @@ public RuleRetrieverDescriptor Filter(params Action /// - public RuleRetrieverDescriptor MatchCriteria(object matchCriteria) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor MatchCriteria(object value) { - MatchCriteriaValue = matchCriteria; - return Self; + Instance.MatchCriteria = value; + return this; } /// @@ -158,10 +263,10 @@ public RuleRetrieverDescriptor MatchCriteria(object matchCriteria) /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public RuleRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -169,10 +274,10 @@ public RuleRetrieverDescriptor MinScore(float? minScore) /// This value determines the size of the individual result set. /// /// - public RuleRetrieverDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -180,28 +285,32 @@ public RuleRetrieverDescriptor RankWindowSize(int? rankWindowSize) /// The retriever whose results rules should be applied to. /// /// - public RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever retriever) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.Retriever = value; + return this; } - public RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + /// + /// + /// The retriever whose results rules should be applied to. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Retriever(System.Action> action) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - public RuleRetrieverDescriptor Retriever(Action> configure) + /// + /// + /// The ruleset IDs containing the rules this retriever is evaluating against. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RulesetIds(System.Collections.Generic.ICollection value) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; + Instance.RulesetIds = value; + return this; } /// @@ -209,139 +318,94 @@ public RuleRetrieverDescriptor Retriever(Action /// - public RuleRetrieverDescriptor RulesetIds(ICollection rulesetIds) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RulesetIds(params Elastic.Clients.Elasticsearch.Id[] values) { - RulesetIdsValue = rulesetIds; - return Self; + Instance.RulesetIds = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RuleRetriever Build(System.Action> action) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - writer.WritePropertyName("match_criteria"); - JsonSerializer.Serialize(writer, MatchCriteriaValue, options); - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); - } - - writer.WritePropertyName("ruleset_ids"); - JsonSerializer.Serialize(writer, RulesetIdsValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(new Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RuleRetrieverDescriptor : SerializableDescriptor +public readonly partial struct RuleRetrieverDescriptor { - internal RuleRetrieverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.RuleRetriever Instance { get; init; } - public RuleRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleRetrieverDescriptor(Elastic.Clients.Elasticsearch.RuleRetriever instance) { + Instance = instance; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private object MatchCriteriaValue { get; set; } - private float? MinScoreValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Retriever RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action RetrieverDescriptorAction { get; set; } - private ICollection RulesetIdsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuleRetrieverDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(Elastic.Clients.Elasticsearch.RuleRetriever instance) => new Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Query to filter the documents that can match. /// /// - public RuleRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public RuleRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public RuleRetrieverDescriptor Filter(Action configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public RuleRetrieverDescriptor Filter(params Action[] configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -349,10 +413,10 @@ public RuleRetrieverDescriptor Filter(params Action /// - public RuleRetrieverDescriptor MatchCriteria(object matchCriteria) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor MatchCriteria(object value) { - MatchCriteriaValue = matchCriteria; - return Self; + Instance.MatchCriteria = value; + return this; } /// @@ -360,10 +424,10 @@ public RuleRetrieverDescriptor MatchCriteria(object matchCriteria) /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public RuleRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -371,10 +435,10 @@ public RuleRetrieverDescriptor MinScore(float? minScore) /// This value determines the size of the individual result set. /// /// - public RuleRetrieverDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -382,28 +446,32 @@ public RuleRetrieverDescriptor RankWindowSize(int? rankWindowSize) /// The retriever whose results rules should be applied to. /// /// - public RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever retriever) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.Retriever = value; + return this; } - public RuleRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + /// + /// + /// The retriever whose results rules should be applied to. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Retriever(System.Action action) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - public RuleRetrieverDescriptor Retriever(Action configure) + /// + /// + /// The retriever whose results rules should be applied to. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor Retriever(System.Action> action) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } /// @@ -411,76 +479,28 @@ public RuleRetrieverDescriptor Retriever(Action /// - public RuleRetrieverDescriptor RulesetIds(ICollection rulesetIds) + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RulesetIds(System.Collections.Generic.ICollection value) { - RulesetIdsValue = rulesetIds; - return Self; + Instance.RulesetIds = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The ruleset IDs containing the rules this retriever is evaluating against. + /// + /// + public Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor RulesetIds(params Elastic.Clients.Elasticsearch.Id[] values) { - writer.WriteStartObject(); - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - writer.WritePropertyName("match_criteria"); - JsonSerializer.Serialize(writer, MatchCriteriaValue, options); - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); - } + Instance.RulesetIds = [.. values]; + return this; + } - writer.WritePropertyName("ruleset_ids"); - JsonSerializer.Serialize(writer, RulesetIdsValue, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.RuleRetriever Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.RuleRetrieverDescriptor(new Elastic.Clients.Elasticsearch.RuleRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScoreSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScoreSort.g.cs index aced55cec12..2c746ec1963 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScoreSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScoreSort.g.cs @@ -17,47 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ScoreSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + + public override Elastic.Clients.Elasticsearch.ScoreSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propOrder = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScoreSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Order = propOrder.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScoreSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScoreSortConverter))] public sealed partial class ScoreSort { - [JsonInclude, JsonPropertyName("order")] +#if NET7_0_OR_GREATER + public ScoreSort() + { + } +#endif +#if !NET7_0_OR_GREATER + public ScoreSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScoreSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } } -public sealed partial class ScoreSortDescriptor : SerializableDescriptor +public readonly partial struct ScoreSortDescriptor { - internal ScoreSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScoreSort Instance { get; init; } - public ScoreSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScoreSortDescriptor(Elastic.Clients.Elasticsearch.ScoreSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScoreSortDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.ScoreSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ScoreSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public static explicit operator Elastic.Clients.Elasticsearch.ScoreSortDescriptor(Elastic.Clients.Elasticsearch.ScoreSort instance) => new Elastic.Clients.Elasticsearch.ScoreSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScoreSort(Elastic.Clients.Elasticsearch.ScoreSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.ScoreSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScoreSort Build(System.Action? action) { - writer.WriteStartObject(); - if (OrderValue is not null) + if (action is null) { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); + return new Elastic.Clients.Elasticsearch.ScoreSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.ScoreSortDescriptor(new Elastic.Clients.Elasticsearch.ScoreSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs index bb90104b52e..0ff4bb31a8e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs @@ -17,24 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ScriptConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropLang = System.Text.Json.JsonEncodedText.Encode("lang"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropParams = System.Text.Json.JsonEncodedText.Encode("params"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.Script Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType is not System.Text.Json.JsonTokenType.StartObject) + { + var value = reader.ReadValue(options, null); + return new Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Source = value + }; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propLang = default; + LocalJsonValue?> propOptions = default; + LocalJsonValue?> propParams = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propLang.TryReadProperty(ref reader, options, PropLang, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propParams.TryReadProperty(ref reader, options, PropParams, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Lang = propLang.Value, + Options = propOptions.Value, + Params = propParams.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Script value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropLang, value.Lang, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropParams, value.Params, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptConverter))] public sealed partial class Script { +#if NET7_0_OR_GREATER + public Script() + { + } +#endif +#if !NET7_0_OR_GREATER + public Script() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The id for a stored script. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -42,10 +138,8 @@ public sealed partial class Script /// Specifies the language the script is written in. /// /// - [JsonInclude, JsonPropertyName("lang")] public Elastic.Clients.Elasticsearch.ScriptLanguage? Lang { get; set; } - [JsonInclude, JsonPropertyName("options")] - public IDictionary? Options { get; set; } + public System.Collections.Generic.IDictionary? Options { get; set; } /// /// @@ -53,43 +147,44 @@ public sealed partial class Script /// Use parameters instead of hard-coded values to decrease compile time. /// /// - [JsonInclude, JsonPropertyName("params")] - public IDictionary? Params { get; set; } + public System.Collections.Generic.IDictionary? Params { get; set; } /// /// /// The script source. /// /// - [JsonInclude, JsonPropertyName("source")] public string? Source { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter(Script script) => Elastic.Clients.Elasticsearch.QueryDsl.IntervalsFilter.Script(script); } -public sealed partial class ScriptDescriptor : SerializableDescriptor +public readonly partial struct ScriptDescriptor { - internal ScriptDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Script Instance { get; init; } - public ScriptDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptDescriptor(Elastic.Clients.Elasticsearch.Script instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptLanguage? LangValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private IDictionary? ParamsValue { get; set; } - private string? SourceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.ScriptDescriptor(Elastic.Clients.Elasticsearch.Script instance) => new Elastic.Clients.Elasticsearch.ScriptDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) => descriptor.Instance; /// /// /// The id for a stored script. /// /// - public ScriptDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.ScriptDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -97,16 +192,35 @@ public ScriptDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// Specifies the language the script is written in. /// /// - public ScriptDescriptor Lang(Elastic.Clients.Elasticsearch.ScriptLanguage? lang) + public Elastic.Clients.Elasticsearch.ScriptDescriptor Lang(Elastic.Clients.Elasticsearch.ScriptLanguage? value) { - LangValue = lang; - return Self; + Instance.Lang = value; + return this; } - public ScriptDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.ScriptDescriptor Options(System.Collections.Generic.IDictionary? value) { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options = value; + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptDescriptor Options() + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptDescriptor Options(System.Action? action) + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.ScriptDescriptor AddOption(string key, string value) + { + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -115,56 +229,64 @@ public ScriptDescriptor Options(Func, FluentDic /// Use parameters instead of hard-coded values to decrease compile time. /// /// - public ScriptDescriptor Params(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.ScriptDescriptor Params(System.Collections.Generic.IDictionary? value) { - ParamsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Params = value; + return this; } /// /// - /// The script source. + /// Specifies any named parameters that are passed into the script as variables. + /// Use parameters instead of hard-coded values to decrease compile time. /// /// - public ScriptDescriptor Source(string? source) + public Elastic.Clients.Elasticsearch.ScriptDescriptor Params() { - SourceValue = source; - return Self; + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies any named parameters that are passed into the script as variables. + /// Use parameters instead of hard-coded values to decrease compile time. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptDescriptor Params(System.Action? action) { - writer.WriteStartObject(); - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - if (LangValue is not null) - { - writer.WritePropertyName("lang"); - JsonSerializer.Serialize(writer, LangValue, options); - } + Instance.Params = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } + public Elastic.Clients.Elasticsearch.ScriptDescriptor AddParam(string key, object value) + { + Instance.Params ??= new System.Collections.Generic.Dictionary(); + Instance.Params.Add(key, value); + return this; + } - if (ParamsValue is not null) - { - writer.WritePropertyName("params"); - JsonSerializer.Serialize(writer, ParamsValue, options); - } + /// + /// + /// The script source. + /// + /// + public Elastic.Clients.Elasticsearch.ScriptDescriptor Source(string? value) + { + Instance.Source = value; + return this; + } - if (!string.IsNullOrEmpty(SourceValue)) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Script Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); + return new Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.ScriptDescriptor(new Elastic.Clients.Elasticsearch.Script(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptField.g.cs index a05bf23c84c..3d72f6596cf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptField.g.cs @@ -17,92 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ScriptFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIgnoreFailure = System.Text.Json.JsonEncodedText.Encode("ignore_failure"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.ScriptField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIgnoreFailure = default; + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIgnoreFailure.TryReadProperty(ref reader, options, PropIgnoreFailure, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScriptField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IgnoreFailure = propIgnoreFailure.Value, + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIgnoreFailure, value.IgnoreFailure, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptFieldConverter))] public sealed partial class ScriptField { - [JsonInclude, JsonPropertyName("ignore_failure")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptField(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public bool? IgnoreFailure { get; set; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class ScriptFieldDescriptor : SerializableDescriptor +public readonly partial struct ScriptFieldDescriptor { - internal ScriptFieldDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScriptField Instance { get; init; } - public ScriptFieldDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptFieldDescriptor(Elastic.Clients.Elasticsearch.ScriptField instance) { + Instance = instance; } - private bool? IgnoreFailureValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - - public ScriptFieldDescriptor IgnoreFailure(bool? ignoreFailure = true) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptFieldDescriptor() { - IgnoreFailureValue = ignoreFailure; - return Self; + Instance = new Elastic.Clients.Elasticsearch.ScriptField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ScriptFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public static explicit operator Elastic.Clients.Elasticsearch.ScriptFieldDescriptor(Elastic.Clients.Elasticsearch.ScriptField instance) => new Elastic.Clients.Elasticsearch.ScriptFieldDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScriptField(Elastic.Clients.Elasticsearch.ScriptFieldDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.ScriptFieldDescriptor IgnoreFailure(bool? value = true) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.IgnoreFailure = value; + return this; } - public ScriptFieldDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.ScriptFieldDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public ScriptFieldDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.ScriptFieldDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ScriptFieldDescriptor Script(System.Action? action) { - writer.WriteStartObject(); - if (IgnoreFailureValue.HasValue) - { - writer.WritePropertyName("ignore_failure"); - writer.WriteBooleanValue(IgnoreFailureValue.Value); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScriptField Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ScriptFieldDescriptor(new Elastic.Clients.Elasticsearch.ScriptField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptSort.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptSort.g.cs index 8fe1578e5b6..47eadc2edf3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptSort.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ScriptSort.g.cs @@ -17,310 +17,277 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ScriptSortConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropNested = System.Text.Json.JsonEncodedText.Encode("nested"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.ScriptSort Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMode = default; + LocalJsonValue propNested = default; + LocalJsonValue propOrder = default; + LocalJsonValue propScript = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propNested.TryReadProperty(ref reader, options, PropNested, null)) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, null)) + { + continue; + } + + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Mode = propMode.Value, + Nested = propNested.Value, + Order = propOrder.Value, + Script = propScript.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ScriptSort value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropNested, value.Nested, null, null); + writer.WriteProperty(options, PropOrder, value.Order, null, null); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ScriptSortConverter))] public sealed partial class ScriptSort { - [JsonInclude, JsonPropertyName("mode")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptSort(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public ScriptSort() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ScriptSort() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.SortMode? Mode { get; set; } - [JsonInclude, JsonPropertyName("nested")] public Elastic.Clients.Elasticsearch.NestedSortValue? Nested { get; set; } - [JsonInclude, JsonPropertyName("order")] public Elastic.Clients.Elasticsearch.SortOrder? Order { get; set; } - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } - [JsonInclude, JsonPropertyName("type")] + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } public Elastic.Clients.Elasticsearch.ScriptSortType? Type { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(ScriptSort scriptSort) => Elastic.Clients.Elasticsearch.SortOptions.Script(scriptSort); } -public sealed partial class ScriptSortDescriptor : SerializableDescriptor> +public readonly partial struct ScriptSortDescriptor { - internal ScriptSortDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScriptSort Instance { get; init; } - public ScriptSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptSortDescriptor(Elastic.Clients.Elasticsearch.ScriptSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action> NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.ScriptSortType? TypeValue { get; set; } - - public ScriptSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptSortDescriptor() { - ModeValue = mode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public static explicit operator Elastic.Clients.Elasticsearch.ScriptSortDescriptor(Elastic.Clients.Elasticsearch.ScriptSort instance) => new Elastic.Clients.Elasticsearch.ScriptSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.ScriptSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.Mode = value; + return this; } - public ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Nested = value; + return this; } - public ScriptSortDescriptor Nested(Action> configure) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Nested(System.Action> action) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public ScriptSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - OrderValue = order; - return Self; + Instance.Order = value; + return this; } - public ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptSortDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - public ScriptSortDescriptor Type(Elastic.Clients.Elasticsearch.ScriptSortType? type) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Type(Elastic.Clients.Elasticsearch.ScriptSortType? value) { - TypeValue = type; - return Self; + Instance.Type = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScriptSort Build(System.Action> action) { - writer.WriteStartObject(); - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.ScriptSortDescriptor(new Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class ScriptSortDescriptor : SerializableDescriptor +public readonly partial struct ScriptSortDescriptor { - internal ScriptSortDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.ScriptSort Instance { get; init; } - public ScriptSortDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptSortDescriptor(Elastic.Clients.Elasticsearch.ScriptSort instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.SortMode? ModeValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValue? NestedValue { get; set; } - private Elastic.Clients.Elasticsearch.NestedSortValueDescriptor NestedDescriptor { get; set; } - private Action NestedDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.SortOrder? OrderValue { get; set; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } - private Elastic.Clients.Elasticsearch.ScriptSortType? TypeValue { get; set; } - - public ScriptSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? mode) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ScriptSortDescriptor() { - ModeValue = mode; - return Self; + Instance = new Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? nested) + public static explicit operator Elastic.Clients.Elasticsearch.ScriptSortDescriptor(Elastic.Clients.Elasticsearch.ScriptSort instance) => new Elastic.Clients.Elasticsearch.ScriptSortDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.ScriptSortDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Mode(Elastic.Clients.Elasticsearch.SortMode? value) { - NestedDescriptor = null; - NestedDescriptorAction = null; - NestedValue = nested; - return Self; + Instance.Mode = value; + return this; } - public ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValueDescriptor descriptor) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Nested(Elastic.Clients.Elasticsearch.NestedSortValue? value) { - NestedValue = null; - NestedDescriptorAction = null; - NestedDescriptor = descriptor; - return Self; + Instance.Nested = value; + return this; } - public ScriptSortDescriptor Nested(Action configure) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Nested(System.Action action) { - NestedValue = null; - NestedDescriptor = null; - NestedDescriptorAction = configure; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public ScriptSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? order) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Nested(System.Action> action) { - OrderValue = order; - return Self; + Instance.Nested = Elastic.Clients.Elasticsearch.NestedSortValueDescriptor.Build(action); + return this; } - public ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Order(Elastic.Clients.Elasticsearch.SortOrder? value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Order = value; + return this; } - public ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = value; + return this; } - public ScriptSortDescriptor Script(Action configure) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script() { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public ScriptSortDescriptor Type(Elastic.Clients.Elasticsearch.ScriptSortType? type) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Script(System.Action? action) { - TypeValue = type; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.ScriptSortDescriptor Type(Elastic.Clients.Elasticsearch.ScriptSortType? value) { - writer.WriteStartObject(); - if (ModeValue is not null) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, ModeValue, options); - } - - if (NestedDescriptor is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedDescriptor, options); - } - else if (NestedDescriptorAction is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.NestedSortValueDescriptor(NestedDescriptorAction), options); - } - else if (NestedValue is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, NestedValue, options); - } - - if (OrderValue is not null) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, OrderValue, options); - } - - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - if (TypeValue is not null) - { - writer.WritePropertyName("type"); - JsonSerializer.Serialize(writer, TypeValue, options); - } + Instance.Type = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.ScriptSort Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.ScriptSortDescriptor(new Elastic.Clients.Elasticsearch.ScriptSort(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/AnalyticsCollection.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/AnalyticsCollection.g.cs index 80c6a216325..2bea9437c0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/AnalyticsCollection.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/AnalyticsCollection.g.cs @@ -17,23 +17,84 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; +internal sealed partial class AnalyticsCollectionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEventDataStream = System.Text.Json.JsonEncodedText.Encode("event_data_stream"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.AnalyticsCollection Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEventDataStream = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEventDataStream.TryReadProperty(ref reader, options, PropEventDataStream, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.AnalyticsCollection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EventDataStream = propEventDataStream.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.AnalyticsCollection value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEventDataStream, value.EventDataStream, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.AnalyticsCollectionConverter))] public sealed partial class AnalyticsCollection { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyticsCollection(Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream eventDataStream) + { + EventDataStream = eventDataStream; + } +#if NET7_0_OR_GREATER + public AnalyticsCollection() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalyticsCollection() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyticsCollection(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Data stream for the collection. /// /// - [JsonInclude, JsonPropertyName("event_data_stream")] - public Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream EventDataStream { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream EventDataStream { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/EventDataStream.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/EventDataStream.g.cs index a498d360239..fc79283a65d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/EventDataStream.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/EventDataStream.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; +internal sealed partial class EventDataStreamConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.EventDataStream value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.EventDataStreamConverter))] public sealed partial class EventDataStream { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EventDataStream(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public EventDataStream() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EventDataStream() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EventDataStream(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplication.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplication.g.cs index 645430c37b4..6ee41e7ffd3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplication.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplication.g.cs @@ -17,179 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; -public sealed partial class SearchApplication +internal sealed partial class SearchApplicationConverter : System.Text.Json.Serialization.JsonConverter { - /// - /// - /// Analytics collection associated to the Search Application. - /// - /// - [JsonInclude, JsonPropertyName("analytics_collection_name")] - public Elastic.Clients.Elasticsearch.Name? AnalyticsCollectionName { get; set; } - - /// - /// - /// Indices that are part of the Search Application. - /// - /// - [JsonInclude, JsonPropertyName("indices")] - public ICollection Indices { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropAnalyticsCollectionName = System.Text.Json.JsonEncodedText.Encode("analytics_collection_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + private static readonly System.Text.Json.JsonEncodedText PropUpdatedAtMillis = System.Text.Json.JsonEncodedText.Encode("updated_at_millis"); - /// - /// - /// Search Application name. - /// - /// - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } + public override Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyticsCollectionName = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propName = default; + LocalJsonValue propTemplate = default; + LocalJsonValue propUpdatedAtMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyticsCollectionName.TryReadProperty(ref reader, options, PropAnalyticsCollectionName, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (propUpdatedAtMillis.TryReadProperty(ref reader, options, PropUpdatedAtMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - /// - /// - /// Search template to use on search operations. - /// - /// - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? Template { get; set; } + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalyticsCollectionName = propAnalyticsCollectionName.Value, + Indices = propIndices.Value, + Name = propName.Value, + Template = propTemplate.Value, + UpdatedAtMillis = propUpdatedAtMillis.Value + }; + } - /// - /// - /// Last time the Search Application was updated. - /// - /// - [JsonInclude, JsonPropertyName("updated_at_millis")] - public long UpdatedAtMillis { get; set; } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplication value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyticsCollectionName, value.AnalyticsCollectionName, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteProperty(options, PropUpdatedAtMillis, value.UpdatedAtMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } } -public sealed partial class SearchApplicationDescriptor : SerializableDescriptor +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationConverter))] +public sealed partial class SearchApplication { - internal SearchApplicationDescriptor(Action configure) => configure.Invoke(this); - - public SearchApplicationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplication(System.Collections.Generic.IReadOnlyCollection indices, string name, System.DateTimeOffset updatedAtMillis) { + Indices = indices; + Name = name; + UpdatedAtMillis = updatedAtMillis; + } +#if NET7_0_OR_GREATER + public SearchApplication() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchApplication() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchApplication(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - - private Elastic.Clients.Elasticsearch.Name? AnalyticsCollectionNameValue { get; set; } - private ICollection IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - private long UpdatedAtMillisValue { get; set; } /// /// /// Analytics collection associated to the Search Application. /// /// - public SearchApplicationDescriptor AnalyticsCollectionName(Elastic.Clients.Elasticsearch.Name? analyticsCollectionName) - { - AnalyticsCollectionNameValue = analyticsCollectionName; - return Self; - } + public string? AnalyticsCollectionName { get; set; } /// /// /// Indices that are part of the Search Application. /// /// - public SearchApplicationDescriptor Indices(ICollection indices) - { - IndicesValue = indices; - return Self; - } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } /// /// - /// Search Application name. + /// Search Application name /// /// - public SearchApplicationDescriptor Name(Elastic.Clients.Elasticsearch.Name name) - { - NameValue = name; - return Self; - } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// Search template to use on search operations. /// /// - public SearchApplicationDescriptor Template(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? template) - { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; - } - - public SearchApplicationDescriptor Template(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor descriptor) - { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; - } - - public SearchApplicationDescriptor Template(Action configure) - { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; - } + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? Template { get; set; } /// /// /// Last time the Search Application was updated. /// /// - public SearchApplicationDescriptor UpdatedAtMillis(long updatedAtMillis) - { - UpdatedAtMillisValue = updatedAtMillis; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (AnalyticsCollectionNameValue is not null) - { - writer.WritePropertyName("analytics_collection_name"); - JsonSerializer.Serialize(writer, AnalyticsCollectionNameValue, options); - } - - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor(TemplateDescriptorAction), options); - } - else if (TemplateValue is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } - - writer.WritePropertyName("updated_at_millis"); - writer.WriteNumberValue(UpdatedAtMillisValue); - writer.WriteEndObject(); - } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset UpdatedAtMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationListItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationListItem.g.cs deleted file mode 100644 index f660ec1cfd7..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationListItem.g.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.SearchApplication; - -public sealed partial class SearchApplicationListItem -{ - /// - /// - /// Analytics collection associated to the Search Application - /// - /// - [JsonInclude, JsonPropertyName("analytics_collection_name")] - public string? AnalyticsCollectionName { get; init; } - - /// - /// - /// Indices that are part of the Search Application - /// - /// - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - - /// - /// - /// Search Application name - /// - /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - - /// - /// - /// Last time the Search Application was updated - /// - /// - [JsonInclude, JsonPropertyName("updated_at_millis")] - public long UpdatedAtMillis { get; init; } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationParameters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationParameters.g.cs new file mode 100644 index 00000000000..0017694dc95 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationParameters.g.cs @@ -0,0 +1,215 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.SearchApplication; + +internal sealed partial class SearchApplicationParametersConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnalyticsCollectionName = System.Text.Json.JsonEncodedText.Encode("analytics_collection_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnalyticsCollectionName = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propTemplate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnalyticsCollectionName.TryReadProperty(ref reader, options, PropAnalyticsCollectionName, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AnalyticsCollectionName = propAnalyticsCollectionName.Value, + Indices = propIndices.Value, + Template = propTemplate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnalyticsCollectionName, value.AnalyticsCollectionName, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersConverter))] +public sealed partial class SearchApplicationParameters +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationParameters(System.Collections.Generic.ICollection indices) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public SearchApplicationParameters() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchApplicationParameters() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchApplicationParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Analytics collection associated to the Search Application. + /// + /// + public Elastic.Clients.Elasticsearch.Name? AnalyticsCollectionName { get; set; } + + /// + /// + /// Indices that are part of the Search Application. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Indices { get; set; } + + /// + /// + /// Search template to use on search operations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? Template { get; set; } +} + +public readonly partial struct SearchApplicationParametersDescriptor +{ + internal Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationParametersDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationParametersDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters instance) => new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Analytics collection associated to the Search Application. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor AnalyticsCollectionName(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.AnalyticsCollectionName = value; + return this; + } + + /// + /// + /// Indices that are part of the Search Application. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor Indices(System.Collections.Generic.ICollection value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// Indices that are part of the Search Application. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor Indices(params Elastic.Clients.Elasticsearch.IndexName[] values) + { + Instance.Indices = [.. values]; + return this; + } + + /// + /// + /// Search template to use on search operations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor Template(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate? value) + { + Instance.Template = value; + return this; + } + + /// + /// + /// Search template to use on search operations. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor Template(System.Action action) + { + Instance.Template = Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParametersDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationParameters(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationTemplate.g.cs index 3bbc380fe78..d7d9767e13b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchApplication/SearchApplicationTemplate.g.cs @@ -17,87 +17,145 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchApplication; +internal sealed partial class SearchApplicationTemplateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropScript = System.Text.Json.JsonEncodedText.Encode("script"); + + public override Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propScript = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propScript.TryReadProperty(ref reader, options, PropScript, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Script = propScript.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropScript, value.Script, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateConverter))] public sealed partial class SearchApplicationTemplate { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationTemplate(Elastic.Clients.Elasticsearch.Script script) + { + Script = script; + } +#if NET7_0_OR_GREATER + public SearchApplicationTemplate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchApplicationTemplate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchApplicationTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The associated mustache template. /// /// - [JsonInclude, JsonPropertyName("script")] - public Elastic.Clients.Elasticsearch.Script Script { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Script { get; set; } } -public sealed partial class SearchApplicationTemplateDescriptor : SerializableDescriptor +public readonly partial struct SearchApplicationTemplateDescriptor { - internal SearchApplicationTemplateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate Instance { get; init; } - public SearchApplicationTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationTemplateDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor ScriptDescriptor { get; set; } - private Action ScriptDescriptorAction { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchApplicationTemplateDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate instance) => new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate(Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor descriptor) => descriptor.Instance; /// /// /// The associated mustache template. /// /// - public SearchApplicationTemplateDescriptor Script(Elastic.Clients.Elasticsearch.Script script) + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor Script(Elastic.Clients.Elasticsearch.Script value) { - ScriptDescriptor = null; - ScriptDescriptorAction = null; - ScriptValue = script; - return Self; + Instance.Script = value; + return this; } - public SearchApplicationTemplateDescriptor Script(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + /// + /// + /// The associated mustache template. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor Script() { - ScriptValue = null; - ScriptDescriptorAction = null; - ScriptDescriptor = descriptor; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - public SearchApplicationTemplateDescriptor Script(Action configure) + /// + /// + /// The associated mustache template. + /// + /// + public Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor Script(System.Action? action) { - ScriptValue = null; - ScriptDescriptor = null; - ScriptDescriptorAction = configure; - return Self; + Instance.Script = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate Build(System.Action action) { - writer.WriteStartObject(); - if (ScriptDescriptor is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptDescriptor, options); - } - else if (ScriptDescriptorAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(ScriptDescriptorAction), options); - } - else - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, ScriptValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplateDescriptor(new Elastic.Clients.Elasticsearch.SearchApplication.SearchApplicationTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchStats.g.cs index 0f30d81224e..956170445cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchStats.g.cs @@ -17,52 +17,304 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class SearchStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFetchCurrent = System.Text.Json.JsonEncodedText.Encode("fetch_current"); + private static readonly System.Text.Json.JsonEncodedText PropFetchTime = System.Text.Json.JsonEncodedText.Encode("fetch_time"); + private static readonly System.Text.Json.JsonEncodedText PropFetchTimeInMillis = System.Text.Json.JsonEncodedText.Encode("fetch_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropFetchTotal = System.Text.Json.JsonEncodedText.Encode("fetch_total"); + private static readonly System.Text.Json.JsonEncodedText PropGroups = System.Text.Json.JsonEncodedText.Encode("groups"); + private static readonly System.Text.Json.JsonEncodedText PropOpenContexts = System.Text.Json.JsonEncodedText.Encode("open_contexts"); + private static readonly System.Text.Json.JsonEncodedText PropQueryCurrent = System.Text.Json.JsonEncodedText.Encode("query_current"); + private static readonly System.Text.Json.JsonEncodedText PropQueryTime = System.Text.Json.JsonEncodedText.Encode("query_time"); + private static readonly System.Text.Json.JsonEncodedText PropQueryTimeInMillis = System.Text.Json.JsonEncodedText.Encode("query_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropQueryTotal = System.Text.Json.JsonEncodedText.Encode("query_total"); + private static readonly System.Text.Json.JsonEncodedText PropScrollCurrent = System.Text.Json.JsonEncodedText.Encode("scroll_current"); + private static readonly System.Text.Json.JsonEncodedText PropScrollTime = System.Text.Json.JsonEncodedText.Encode("scroll_time"); + private static readonly System.Text.Json.JsonEncodedText PropScrollTimeInMillis = System.Text.Json.JsonEncodedText.Encode("scroll_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropScrollTotal = System.Text.Json.JsonEncodedText.Encode("scroll_total"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestCurrent = System.Text.Json.JsonEncodedText.Encode("suggest_current"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestTime = System.Text.Json.JsonEncodedText.Encode("suggest_time"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestTimeInMillis = System.Text.Json.JsonEncodedText.Encode("suggest_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropSuggestTotal = System.Text.Json.JsonEncodedText.Encode("suggest_total"); + + public override Elastic.Clients.Elasticsearch.SearchStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFetchCurrent = default; + LocalJsonValue propFetchTime = default; + LocalJsonValue propFetchTimeInMillis = default; + LocalJsonValue propFetchTotal = default; + LocalJsonValue?> propGroups = default; + LocalJsonValue propOpenContexts = default; + LocalJsonValue propQueryCurrent = default; + LocalJsonValue propQueryTime = default; + LocalJsonValue propQueryTimeInMillis = default; + LocalJsonValue propQueryTotal = default; + LocalJsonValue propScrollCurrent = default; + LocalJsonValue propScrollTime = default; + LocalJsonValue propScrollTimeInMillis = default; + LocalJsonValue propScrollTotal = default; + LocalJsonValue propSuggestCurrent = default; + LocalJsonValue propSuggestTime = default; + LocalJsonValue propSuggestTimeInMillis = default; + LocalJsonValue propSuggestTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFetchCurrent.TryReadProperty(ref reader, options, PropFetchCurrent, null)) + { + continue; + } + + if (propFetchTime.TryReadProperty(ref reader, options, PropFetchTime, null)) + { + continue; + } + + if (propFetchTimeInMillis.TryReadProperty(ref reader, options, PropFetchTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propFetchTotal.TryReadProperty(ref reader, options, PropFetchTotal, null)) + { + continue; + } + + if (propGroups.TryReadProperty(ref reader, options, PropGroups, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propOpenContexts.TryReadProperty(ref reader, options, PropOpenContexts, null)) + { + continue; + } + + if (propQueryCurrent.TryReadProperty(ref reader, options, PropQueryCurrent, null)) + { + continue; + } + + if (propQueryTime.TryReadProperty(ref reader, options, PropQueryTime, null)) + { + continue; + } + + if (propQueryTimeInMillis.TryReadProperty(ref reader, options, PropQueryTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propQueryTotal.TryReadProperty(ref reader, options, PropQueryTotal, null)) + { + continue; + } + + if (propScrollCurrent.TryReadProperty(ref reader, options, PropScrollCurrent, null)) + { + continue; + } + + if (propScrollTime.TryReadProperty(ref reader, options, PropScrollTime, null)) + { + continue; + } + + if (propScrollTimeInMillis.TryReadProperty(ref reader, options, PropScrollTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propScrollTotal.TryReadProperty(ref reader, options, PropScrollTotal, null)) + { + continue; + } + + if (propSuggestCurrent.TryReadProperty(ref reader, options, PropSuggestCurrent, null)) + { + continue; + } + + if (propSuggestTime.TryReadProperty(ref reader, options, PropSuggestTime, null)) + { + continue; + } + + if (propSuggestTimeInMillis.TryReadProperty(ref reader, options, PropSuggestTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propSuggestTotal.TryReadProperty(ref reader, options, PropSuggestTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FetchCurrent = propFetchCurrent.Value, + FetchTime = propFetchTime.Value, + FetchTimeInMillis = propFetchTimeInMillis.Value, + FetchTotal = propFetchTotal.Value, + Groups = propGroups.Value, + OpenContexts = propOpenContexts.Value, + QueryCurrent = propQueryCurrent.Value, + QueryTime = propQueryTime.Value, + QueryTimeInMillis = propQueryTimeInMillis.Value, + QueryTotal = propQueryTotal.Value, + ScrollCurrent = propScrollCurrent.Value, + ScrollTime = propScrollTime.Value, + ScrollTimeInMillis = propScrollTimeInMillis.Value, + ScrollTotal = propScrollTotal.Value, + SuggestCurrent = propSuggestCurrent.Value, + SuggestTime = propSuggestTime.Value, + SuggestTimeInMillis = propSuggestTimeInMillis.Value, + SuggestTotal = propSuggestTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFetchCurrent, value.FetchCurrent, null, null); + writer.WriteProperty(options, PropFetchTime, value.FetchTime, null, null); + writer.WriteProperty(options, PropFetchTimeInMillis, value.FetchTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropFetchTotal, value.FetchTotal, null, null); + writer.WriteProperty(options, PropGroups, value.Groups, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropOpenContexts, value.OpenContexts, null, null); + writer.WriteProperty(options, PropQueryCurrent, value.QueryCurrent, null, null); + writer.WriteProperty(options, PropQueryTime, value.QueryTime, null, null); + writer.WriteProperty(options, PropQueryTimeInMillis, value.QueryTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropQueryTotal, value.QueryTotal, null, null); + writer.WriteProperty(options, PropScrollCurrent, value.ScrollCurrent, null, null); + writer.WriteProperty(options, PropScrollTime, value.ScrollTime, null, null); + writer.WriteProperty(options, PropScrollTimeInMillis, value.ScrollTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropScrollTotal, value.ScrollTotal, null, null); + writer.WriteProperty(options, PropSuggestCurrent, value.SuggestCurrent, null, null); + writer.WriteProperty(options, PropSuggestTime, value.SuggestTime, null, null); + writer.WriteProperty(options, PropSuggestTimeInMillis, value.SuggestTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropSuggestTotal, value.SuggestTotal, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchStatsConverter))] public sealed partial class SearchStats { - [JsonInclude, JsonPropertyName("fetch_current")] - public long FetchCurrent { get; init; } - [JsonInclude, JsonPropertyName("fetch_time")] - public Elastic.Clients.Elasticsearch.Duration? FetchTime { get; init; } - [JsonInclude, JsonPropertyName("fetch_time_in_millis")] - public long FetchTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("fetch_total")] - public long FetchTotal { get; init; } - [JsonInclude, JsonPropertyName("groups")] - public IReadOnlyDictionary? Groups { get; init; } - [JsonInclude, JsonPropertyName("open_contexts")] - public long? OpenContexts { get; init; } - [JsonInclude, JsonPropertyName("query_current")] - public long QueryCurrent { get; init; } - [JsonInclude, JsonPropertyName("query_time")] - public Elastic.Clients.Elasticsearch.Duration? QueryTime { get; init; } - [JsonInclude, JsonPropertyName("query_time_in_millis")] - public long QueryTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("query_total")] - public long QueryTotal { get; init; } - [JsonInclude, JsonPropertyName("scroll_current")] - public long ScrollCurrent { get; init; } - [JsonInclude, JsonPropertyName("scroll_time")] - public Elastic.Clients.Elasticsearch.Duration? ScrollTime { get; init; } - [JsonInclude, JsonPropertyName("scroll_time_in_millis")] - public long ScrollTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("scroll_total")] - public long ScrollTotal { get; init; } - [JsonInclude, JsonPropertyName("suggest_current")] - public long SuggestCurrent { get; init; } - [JsonInclude, JsonPropertyName("suggest_time")] - public Elastic.Clients.Elasticsearch.Duration? SuggestTime { get; init; } - [JsonInclude, JsonPropertyName("suggest_time_in_millis")] - public long SuggestTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("suggest_total")] - public long SuggestTotal { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchStats(long fetchCurrent, System.TimeSpan fetchTimeInMillis, long fetchTotal, long queryCurrent, System.TimeSpan queryTimeInMillis, long queryTotal, long scrollCurrent, System.TimeSpan scrollTimeInMillis, long scrollTotal, long suggestCurrent, System.TimeSpan suggestTimeInMillis, long suggestTotal) + { + FetchCurrent = fetchCurrent; + FetchTimeInMillis = fetchTimeInMillis; + FetchTotal = fetchTotal; + QueryCurrent = queryCurrent; + QueryTimeInMillis = queryTimeInMillis; + QueryTotal = queryTotal; + ScrollCurrent = scrollCurrent; + ScrollTimeInMillis = scrollTimeInMillis; + ScrollTotal = scrollTotal; + SuggestCurrent = suggestCurrent; + SuggestTimeInMillis = suggestTimeInMillis; + SuggestTotal = suggestTotal; + } +#if NET7_0_OR_GREATER + public SearchStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long FetchCurrent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? FetchTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan FetchTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long FetchTotal { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Groups { get; set; } + public long? OpenContexts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long QueryCurrent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? QueryTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan QueryTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long QueryTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ScrollCurrent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? ScrollTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ScrollTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ScrollTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SuggestCurrent { get; set; } + public Elastic.Clients.Elasticsearch.Duration? SuggestTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan SuggestTimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SuggestTotal { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/MountedSnapshot.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/MountedSnapshot.g.cs index 09a36fd71df..a511c2063d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/MountedSnapshot.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/MountedSnapshot.g.cs @@ -17,23 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; +internal sealed partial class MountedSnapshotConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshot Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + LocalJsonValue propShards = default; + LocalJsonValue propSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Shards = propShards.Value, + Snapshot = propSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshot value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.MountedSnapshotConverter))] public sealed partial class MountedSnapshot { - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public string Snapshot { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MountedSnapshot(System.Collections.Generic.ICollection indices, Elastic.Clients.Elasticsearch.ShardStatistics shards, string snapshot) + { + Indices = indices; + Shards = shards; + Snapshot = snapshot; + } +#if NET7_0_OR_GREATER + public MountedSnapshot() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MountedSnapshot() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MountedSnapshot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Snapshot { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Node.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Node.g.cs index fc6c79ffd08..57c379a8934 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Node.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Node.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; +internal sealed partial class NodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSharedCache = System.Text.Json.JsonEncodedText.Encode("shared_cache"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.Node Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSharedCache = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSharedCache.TryReadProperty(ref reader, options, PropSharedCache, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.Node(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SharedCache = propSharedCache.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.Node value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSharedCache, value.SharedCache, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.NodeConverter))] public sealed partial class Node { - [JsonInclude, JsonPropertyName("shared_cache")] - public Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared SharedCache { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Node(Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared sharedCache) + { + SharedCache = sharedCache; + } +#if NET7_0_OR_GREATER + public Node() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Node() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Node(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared SharedCache { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Shared.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Shared.g.cs index af238a5419c..e4c293d10b9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Shared.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SearchableSnapshots/Shared.g.cs @@ -17,32 +17,184 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SearchableSnapshots; +internal sealed partial class SharedConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBytesReadInBytes = System.Text.Json.JsonEncodedText.Encode("bytes_read_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropBytesWrittenInBytes = System.Text.Json.JsonEncodedText.Encode("bytes_written_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropEvictions = System.Text.Json.JsonEncodedText.Encode("evictions"); + private static readonly System.Text.Json.JsonEncodedText PropNumRegions = System.Text.Json.JsonEncodedText.Encode("num_regions"); + private static readonly System.Text.Json.JsonEncodedText PropReads = System.Text.Json.JsonEncodedText.Encode("reads"); + private static readonly System.Text.Json.JsonEncodedText PropRegionSizeInBytes = System.Text.Json.JsonEncodedText.Encode("region_size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropWrites = System.Text.Json.JsonEncodedText.Encode("writes"); + + public override Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBytesReadInBytes = default; + LocalJsonValue propBytesWrittenInBytes = default; + LocalJsonValue propEvictions = default; + LocalJsonValue propNumRegions = default; + LocalJsonValue propReads = default; + LocalJsonValue propRegionSizeInBytes = default; + LocalJsonValue propSizeInBytes = default; + LocalJsonValue propWrites = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBytesReadInBytes.TryReadProperty(ref reader, options, PropBytesReadInBytes, null)) + { + continue; + } + + if (propBytesWrittenInBytes.TryReadProperty(ref reader, options, PropBytesWrittenInBytes, null)) + { + continue; + } + + if (propEvictions.TryReadProperty(ref reader, options, PropEvictions, null)) + { + continue; + } + + if (propNumRegions.TryReadProperty(ref reader, options, PropNumRegions, null)) + { + continue; + } + + if (propReads.TryReadProperty(ref reader, options, PropReads, null)) + { + continue; + } + + if (propRegionSizeInBytes.TryReadProperty(ref reader, options, PropRegionSizeInBytes, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (propWrites.TryReadProperty(ref reader, options, PropWrites, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BytesReadInBytes = propBytesReadInBytes.Value, + BytesWrittenInBytes = propBytesWrittenInBytes.Value, + Evictions = propEvictions.Value, + NumRegions = propNumRegions.Value, + Reads = propReads.Value, + RegionSizeInBytes = propRegionSizeInBytes.Value, + SizeInBytes = propSizeInBytes.Value, + Writes = propWrites.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SearchableSnapshots.Shared value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBytesReadInBytes, value.BytesReadInBytes, null, null); + writer.WriteProperty(options, PropBytesWrittenInBytes, value.BytesWrittenInBytes, null, null); + writer.WriteProperty(options, PropEvictions, value.Evictions, null, null); + writer.WriteProperty(options, PropNumRegions, value.NumRegions, null, null); + writer.WriteProperty(options, PropReads, value.Reads, null, null); + writer.WriteProperty(options, PropRegionSizeInBytes, value.RegionSizeInBytes, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteProperty(options, PropWrites, value.Writes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SearchableSnapshots.SharedConverter))] public sealed partial class Shared { - [JsonInclude, JsonPropertyName("bytes_read_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize BytesReadInBytes { get; init; } - [JsonInclude, JsonPropertyName("bytes_written_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize BytesWrittenInBytes { get; init; } - [JsonInclude, JsonPropertyName("evictions")] - public long Evictions { get; init; } - [JsonInclude, JsonPropertyName("num_regions")] - public int NumRegions { get; init; } - [JsonInclude, JsonPropertyName("reads")] - public long Reads { get; init; } - [JsonInclude, JsonPropertyName("region_size_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize RegionSizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public Elastic.Clients.Elasticsearch.ByteSize SizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("writes")] - public long Writes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Shared(Elastic.Clients.Elasticsearch.ByteSize bytesReadInBytes, Elastic.Clients.Elasticsearch.ByteSize bytesWrittenInBytes, long evictions, int numRegions, long reads, Elastic.Clients.Elasticsearch.ByteSize regionSizeInBytes, Elastic.Clients.Elasticsearch.ByteSize sizeInBytes, long writes) + { + BytesReadInBytes = bytesReadInBytes; + BytesWrittenInBytes = bytesWrittenInBytes; + Evictions = evictions; + NumRegions = numRegions; + Reads = reads; + RegionSizeInBytes = regionSizeInBytes; + SizeInBytes = sizeInBytes; + Writes = writes; + } +#if NET7_0_OR_GREATER + public Shared() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Shared() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Shared(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize BytesReadInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize BytesWrittenInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Evictions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NumRegions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Reads { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize RegionSizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize SizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Writes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Access.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Access.g.cs index 96dc9da83d0..ca774fa543a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Access.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Access.g.cs @@ -17,91 +17,150 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AccessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReplication = System.Text.Json.JsonEncodedText.Encode("replication"); + private static readonly System.Text.Json.JsonEncodedText PropSearch = System.Text.Json.JsonEncodedText.Encode("search"); + + public override Elastic.Clients.Elasticsearch.Security.Access Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propReplication = default; + LocalJsonValue?> propSearch = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReplication.TryReadProperty(ref reader, options, PropReplication, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSearch.TryReadProperty(ref reader, options, PropSearch, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Replication = propReplication.Value, + Search = propSearch.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.Access value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReplication, value.Replication, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSearch, value.Search, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AccessConverter))] public sealed partial class Access { +#if NET7_0_OR_GREATER + public Access() + { + } +#endif +#if !NET7_0_OR_GREATER + public Access() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of indices permission entries for cross-cluster replication. /// /// - [JsonInclude, JsonPropertyName("replication")] - public ICollection? Replication { get; set; } + public System.Collections.Generic.ICollection? Replication { get; set; } /// /// /// A list of indices permission entries for cross-cluster search. /// /// - [JsonInclude, JsonPropertyName("search")] - public ICollection? Search { get; set; } + public System.Collections.Generic.ICollection? Search { get; set; } } -public sealed partial class AccessDescriptor : SerializableDescriptor> +public readonly partial struct AccessDescriptor { - internal AccessDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.Access Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AccessDescriptor(Elastic.Clients.Elasticsearch.Security.Access instance) + { + Instance = instance; + } - public AccessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AccessDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ReplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor ReplicationDescriptor { get; set; } - private Action ReplicationDescriptorAction { get; set; } - private Action[] ReplicationDescriptorActions { get; set; } - private ICollection? SearchValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor SearchDescriptor { get; set; } - private Action> SearchDescriptorAction { get; set; } - private Action>[] SearchDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.AccessDescriptor(Elastic.Clients.Elasticsearch.Security.Access instance) => new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) => descriptor.Instance; /// /// /// A list of indices permission entries for cross-cluster replication. /// /// - public AccessDescriptor Replication(ICollection? replication) + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(System.Collections.Generic.ICollection? value) { - ReplicationDescriptor = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = null; - ReplicationValue = replication; - return Self; + Instance.Replication = value; + return this; } - public AccessDescriptor Replication(Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor descriptor) + /// + /// + /// A list of indices permission entries for cross-cluster replication. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(params Elastic.Clients.Elasticsearch.Security.ReplicationAccess[] values) { - ReplicationValue = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = null; - ReplicationDescriptor = descriptor; - return Self; + Instance.Replication = [.. values]; + return this; } - public AccessDescriptor Replication(Action configure) + /// + /// + /// A list of indices permission entries for cross-cluster replication. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(params System.Action[] actions) { - ReplicationValue = null; - ReplicationDescriptor = null; - ReplicationDescriptorActions = null; - ReplicationDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor.Build(action)); + } - public AccessDescriptor Replication(params Action[] configure) - { - ReplicationValue = null; - ReplicationDescriptor = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = configure; - return Self; + Instance.Replication = items; + return this; } /// @@ -109,167 +168,110 @@ public AccessDescriptor Replication(params Action /// - public AccessDescriptor Search(ICollection? search) - { - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchDescriptorActions = null; - SearchValue = search; - return Self; - } - - public AccessDescriptor Search(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor descriptor) - { - SearchValue = null; - SearchDescriptorAction = null; - SearchDescriptorActions = null; - SearchDescriptor = descriptor; - return Self; - } - - public AccessDescriptor Search(Action> configure) + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(System.Collections.Generic.ICollection? value) { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorActions = null; - SearchDescriptorAction = configure; - return Self; + Instance.Search = value; + return this; } - public AccessDescriptor Search(params Action>[] configure) + /// + /// + /// A list of indices permission entries for cross-cluster search. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(params Elastic.Clients.Elasticsearch.Security.SearchAccess[] values) { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchDescriptorActions = configure; - return Self; + Instance.Search = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of indices permission entries for cross-cluster search. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(params System.Action>[] actions) { - writer.WriteStartObject(); - if (ReplicationDescriptor is not null) - { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ReplicationDescriptor, options); - writer.WriteEndArray(); - } - else if (ReplicationDescriptorAction is not null) - { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(ReplicationDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ReplicationDescriptorActions is not null) - { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - foreach (var action in ReplicationDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ReplicationValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("replication"); - JsonSerializer.Serialize(writer, ReplicationValue, options); + items.Add(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor.Build(action)); } - if (SearchDescriptor is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, SearchDescriptor, options); - writer.WriteEndArray(); - } - else if (SearchDescriptorAction is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(SearchDescriptorAction), options); - writer.WriteEndArray(); - } - else if (SearchDescriptorActions is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - foreach (var action in SearchDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(action), options); - } + Instance.Search = items; + return this; + } - writer.WriteEndArray(); - } - else if (SearchValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.Access Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchValue, options); + return new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class AccessDescriptor : SerializableDescriptor +public readonly partial struct AccessDescriptor { - internal AccessDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.Access Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AccessDescriptor(Elastic.Clients.Elasticsearch.Security.Access instance) + { + Instance = instance; + } - public AccessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AccessDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? ReplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor ReplicationDescriptor { get; set; } - private Action ReplicationDescriptorAction { get; set; } - private Action[] ReplicationDescriptorActions { get; set; } - private ICollection? SearchValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor SearchDescriptor { get; set; } - private Action SearchDescriptorAction { get; set; } - private Action[] SearchDescriptorActions { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.AccessDescriptor(Elastic.Clients.Elasticsearch.Security.Access instance) => new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Security.AccessDescriptor descriptor) => descriptor.Instance; /// /// /// A list of indices permission entries for cross-cluster replication. /// /// - public AccessDescriptor Replication(ICollection? replication) + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(System.Collections.Generic.ICollection? value) { - ReplicationDescriptor = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = null; - ReplicationValue = replication; - return Self; + Instance.Replication = value; + return this; } - public AccessDescriptor Replication(Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor descriptor) + /// + /// + /// A list of indices permission entries for cross-cluster replication. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(params Elastic.Clients.Elasticsearch.Security.ReplicationAccess[] values) { - ReplicationValue = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = null; - ReplicationDescriptor = descriptor; - return Self; + Instance.Replication = [.. values]; + return this; } - public AccessDescriptor Replication(Action configure) + /// + /// + /// A list of indices permission entries for cross-cluster replication. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Replication(params System.Action[] actions) { - ReplicationValue = null; - ReplicationDescriptor = null; - ReplicationDescriptorActions = null; - ReplicationDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor.Build(action)); + } - public AccessDescriptor Replication(params Action[] configure) - { - ReplicationValue = null; - ReplicationDescriptor = null; - ReplicationDescriptorAction = null; - ReplicationDescriptorActions = configure; - return Self; + Instance.Replication = items; + return this; } /// @@ -277,107 +279,67 @@ public AccessDescriptor Replication(params Action /// - public AccessDescriptor Search(ICollection? search) + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(System.Collections.Generic.ICollection? value) { - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchDescriptorActions = null; - SearchValue = search; - return Self; + Instance.Search = value; + return this; } - public AccessDescriptor Search(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor descriptor) + /// + /// + /// A list of indices permission entries for cross-cluster search. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(params Elastic.Clients.Elasticsearch.Security.SearchAccess[] values) { - SearchValue = null; - SearchDescriptorAction = null; - SearchDescriptorActions = null; - SearchDescriptor = descriptor; - return Self; + Instance.Search = [.. values]; + return this; } - public AccessDescriptor Search(Action configure) + /// + /// + /// A list of indices permission entries for cross-cluster search. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(params System.Action[] actions) { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorActions = null; - SearchDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor.Build(action)); + } - public AccessDescriptor Search(params Action[] configure) - { - SearchValue = null; - SearchDescriptor = null; - SearchDescriptorAction = null; - SearchDescriptorActions = configure; - return Self; + Instance.Search = items; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of indices permission entries for cross-cluster search. + /// + /// + public Elastic.Clients.Elasticsearch.Security.AccessDescriptor Search(params System.Action>[] actions) { - writer.WriteStartObject(); - if (ReplicationDescriptor is not null) - { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ReplicationDescriptor, options); - writer.WriteEndArray(); - } - else if (ReplicationDescriptorAction is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(ReplicationDescriptorAction), options); - writer.WriteEndArray(); + items.Add(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor.Build(action)); } - else if (ReplicationDescriptorActions is not null) - { - writer.WritePropertyName("replication"); - writer.WriteStartArray(); - foreach (var action in ReplicationDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(action), options); - } - writer.WriteEndArray(); - } - else if (ReplicationValue is not null) - { - writer.WritePropertyName("replication"); - JsonSerializer.Serialize(writer, ReplicationValue, options); - } - - if (SearchDescriptor is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, SearchDescriptor, options); - writer.WriteEndArray(); - } - else if (SearchDescriptorAction is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(SearchDescriptorAction), options); - writer.WriteEndArray(); - } - else if (SearchDescriptorActions is not null) - { - writer.WritePropertyName("search"); - writer.WriteStartArray(); - foreach (var action in SearchDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(action), options); - } + Instance.Search = items; + return this; + } - writer.WriteEndArray(); - } - else if (SearchValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.Access Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("search"); - JsonSerializer.Serialize(writer, SearchValue, options); + return new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.AccessDescriptor(new Elastic.Clients.Elasticsearch.Security.Access(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs index 43a5eca1ad0..0c8769c9487 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs @@ -17,18 +17,218 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ApiKeyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAccess = System.Text.Json.JsonEncodedText.Encode("access"); + private static readonly System.Text.Json.JsonEncodedText PropCreation = System.Text.Json.JsonEncodedText.Encode("creation"); + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropInvalidated = System.Text.Json.JsonEncodedText.Encode("invalidated"); + private static readonly System.Text.Json.JsonEncodedText PropInvalidation = System.Text.Json.JsonEncodedText.Encode("invalidation"); + private static readonly System.Text.Json.JsonEncodedText PropLimitedBy = System.Text.Json.JsonEncodedText.Encode("limited_by"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropProfileUid = System.Text.Json.JsonEncodedText.Encode("profile_uid"); + private static readonly System.Text.Json.JsonEncodedText PropRealm = System.Text.Json.JsonEncodedText.Encode("realm"); + private static readonly System.Text.Json.JsonEncodedText PropRealmType = System.Text.Json.JsonEncodedText.Encode("realm_type"); + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptors = System.Text.Json.JsonEncodedText.Encode("role_descriptors"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("_sort"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.ApiKey Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAccess = default; + LocalJsonValue propCreation = default; + LocalJsonValue propExpiration = default; + LocalJsonValue propId = default; + LocalJsonValue propInvalidated = default; + LocalJsonValue propInvalidation = default; + LocalJsonValue>?> propLimitedBy = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue propName = default; + LocalJsonValue propProfileUid = default; + LocalJsonValue propRealm = default; + LocalJsonValue propRealmType = default; + LocalJsonValue?> propRoleDescriptors = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propType = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAccess.TryReadProperty(ref reader, options, PropAccess, null)) + { + continue; + } + + if (propCreation.TryReadProperty(ref reader, options, PropCreation, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propInvalidated.TryReadProperty(ref reader, options, PropInvalidated, null)) + { + continue; + } + + if (propInvalidation.TryReadProperty(ref reader, options, PropInvalidation, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propLimitedBy.TryReadProperty(ref reader, options, PropLimitedBy, static System.Collections.Generic.IReadOnlyCollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propProfileUid.TryReadProperty(ref reader, options, PropProfileUid, null)) + { + continue; + } + + if (propRealm.TryReadProperty(ref reader, options, PropRealm, null)) + { + continue; + } + + if (propRealmType.TryReadProperty(ref reader, options, PropRealmType, null)) + { + continue; + } + + if (propRoleDescriptors.TryReadProperty(ref reader, options, PropRoleDescriptors, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Access = propAccess.Value, + Creation = propCreation.Value, + Expiration = propExpiration.Value, + Id = propId.Value, + Invalidated = propInvalidated.Value, + Invalidation = propInvalidation.Value, + LimitedBy = propLimitedBy.Value, + Metadata = propMetadata.Value, + Name = propName.Value, + ProfileUid = propProfileUid.Value, + Realm = propRealm.Value, + RealmType = propRealmType.Value, + RoleDescriptors = propRoleDescriptors.Value, + Sort = propSort.Value, + Type = propType.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKey value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAccess, value.Access, null, null); + writer.WriteProperty(options, PropCreation, value.Creation, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropInvalidated, value.Invalidated, null, null); + writer.WriteProperty(options, PropInvalidation, value.Invalidation, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropLimitedBy, value.LimitedBy, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropProfileUid, value.ProfileUid, null, null); + writer.WriteProperty(options, PropRealm, value.Realm, null, null); + writer.WriteProperty(options, PropRealmType, value.RealmType, null, null); + writer.WriteProperty(options, PropRoleDescriptors, value.RoleDescriptors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyConverter))] public sealed partial class ApiKey { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKey(System.DateTimeOffset creation, string id, bool invalidated, System.Collections.Generic.IReadOnlyDictionary metadata, string name, string realm, Elastic.Clients.Elasticsearch.Security.ApiKeyType type, string username) + { + Creation = creation; + Id = id; + Invalidated = invalidated; + Metadata = metadata; + Name = name; + Realm = realm; + Type = type; + Username = username; + } +#if NET7_0_OR_GREATER + public ApiKey() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ApiKey() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The access granted to cross-cluster API keys. @@ -37,32 +237,36 @@ public sealed partial class ApiKey /// When specified, the new access assignment fully replaces the previously assigned access. /// /// - [JsonInclude, JsonPropertyName("access")] - public Elastic.Clients.Elasticsearch.Security.Access? Access { get; init; } + public Elastic.Clients.Elasticsearch.Security.Access? Access { get; set; } /// /// /// Creation time for the API key in milliseconds. /// /// - [JsonInclude, JsonPropertyName("creation")] - public long Creation { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Creation { get; set; } /// /// /// Expiration time for the API key in milliseconds. /// /// - [JsonInclude, JsonPropertyName("expiration")] - public long? Expiration { get; init; } + public System.DateTimeOffset? Expiration { get; set; } /// /// /// Id for the API key /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// @@ -70,16 +274,18 @@ public sealed partial class ApiKey /// If the key has been invalidated, it has a value of true. Otherwise, it is false. /// /// - [JsonInclude, JsonPropertyName("invalidated")] - public bool Invalidated { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Invalidated { get; set; } /// /// /// If the key has been invalidated, invalidation time in milliseconds. /// /// - [JsonInclude, JsonPropertyName("invalidation")] - public long? Invalidation { get; init; } + public System.DateTimeOffset? Invalidation { get; set; } /// /// @@ -88,48 +294,54 @@ public sealed partial class ApiKey /// An API key’s effective permissions are an intersection of its assigned privileges and the owner user’s permissions. /// /// - [JsonInclude, JsonPropertyName("limited_by")] - public IReadOnlyCollection>? LimitedBy { get; init; } + public System.Collections.Generic.IReadOnlyCollection>? LimitedBy { get; set; } /// /// /// Metadata of the API key /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } /// /// /// Name of the API key. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// /// The profile uid for the API key owner principal, if requested and if it exists /// /// - [JsonInclude, JsonPropertyName("profile_uid")] - public string? ProfileUid { get; init; } + public string? ProfileUid { get; set; } /// /// /// Realm name of the principal for which this API key was created. /// /// - [JsonInclude, JsonPropertyName("realm")] - public string Realm { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Realm { get; set; } /// /// /// Realm type of the principal for which this API key was created /// /// - [JsonInclude, JsonPropertyName("realm_type")] - public string? RealmType { get; init; } + public string? RealmType { get; set; } /// /// @@ -137,30 +349,34 @@ public sealed partial class ApiKey /// An empty role descriptor means the API key inherits the owner user’s permissions. /// /// - [JsonInclude, JsonPropertyName("role_descriptors")] - public IReadOnlyDictionary? RoleDescriptors { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? RoleDescriptors { get; set; } /// /// /// Sorting values when using the sort parameter with the security.query_api_keys API. /// /// - [JsonInclude, JsonPropertyName("_sort")] - public IReadOnlyCollection? Sort { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Sort { get; set; } /// /// /// The type of the API key (e.g. rest or cross_cluster). /// /// - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.Security.ApiKeyType Type { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.ApiKeyType Type { get; set; } /// /// /// Principal for which this API key was created /// /// - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs index 89c73ae7bc7..8206b61dafe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs @@ -17,436 +17,1162 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(ApiKeyAggregationConverter))] -public sealed partial class ApiKeyAggregation +internal sealed partial class ApiKeyAggregationConverter : System.Text.Json.Serialization.JsonConverter { - internal ApiKeyAggregation(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static ApiKeyAggregation Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => new ApiKeyAggregation("cardinality", cardinalityAggregation); - public static ApiKeyAggregation Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => new ApiKeyAggregation("composite", compositeAggregation); - public static ApiKeyAggregation DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => new ApiKeyAggregation("date_range", dateRangeAggregation); - public static ApiKeyAggregation Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => new ApiKeyAggregation("filter", apiKeyQueryContainer); - public static ApiKeyAggregation Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => new ApiKeyAggregation("filters", apiKeyFiltersAggregation); - public static ApiKeyAggregation Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => new ApiKeyAggregation("missing", missingAggregation); - public static ApiKeyAggregation Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => new ApiKeyAggregation("range", rangeAggregation); - public static ApiKeyAggregation Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => new ApiKeyAggregation("terms", termsAggregation); - public static ApiKeyAggregation ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => new ApiKeyAggregation("value_count", valueCountAggregation); - - /// - /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. - /// - /// - [JsonInclude, JsonPropertyName("aggregations")] - public IDictionary? Aggregations { get; set; } - [JsonInclude, JsonPropertyName("meta")] - public IDictionary? Meta { get; set; } - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("meta"); + private static readonly System.Text.Json.JsonEncodedText VariantCardinality = System.Text.Json.JsonEncodedText.Encode("cardinality"); + private static readonly System.Text.Json.JsonEncodedText VariantComposite = System.Text.Json.JsonEncodedText.Encode("composite"); + private static readonly System.Text.Json.JsonEncodedText VariantDateRange = System.Text.Json.JsonEncodedText.Encode("date_range"); + private static readonly System.Text.Json.JsonEncodedText VariantFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText VariantFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText VariantMissing = System.Text.Json.JsonEncodedText.Encode("missing"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantValueCount = System.Text.Json.JsonEncodedText.Encode("value_count"); -internal sealed partial class ApiKeyAggregationConverter : JsonConverter -{ - public override ApiKeyAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - IDictionary? aggregationsValue = default; - IDictionary? metaValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue?> propMeta = default; + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "aggregations") + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - aggregationsValue = JsonSerializer.Deserialize?>(ref reader, options); continue; } - if (propertyName == "meta") + if (reader.ValueTextEquals(VariantCardinality)) { - metaValue = JsonSerializer.Deserialize?>(ref reader, options); + variantType = VariantCardinality.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "cardinality") + if (reader.ValueTextEquals(VariantComposite)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantComposite.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "composite") + if (reader.ValueTextEquals(VariantDateRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantDateRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "date_range") + if (reader.ValueTextEquals(VariantFilter)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFilter.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "filter") + if (reader.ValueTextEquals(VariantFilters)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantFilters.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "filters") + if (reader.ValueTextEquals(VariantMissing)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMissing.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "missing") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantValueCount)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantValueCount.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "value_count") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyAggregation' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new ApiKeyAggregation(variantNameValue, variantValue); - result.Aggregations = aggregationsValue; - result.Meta = metaValue; - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant, + Aggregations = propAggregations.Value, + Meta = propMeta.Value + }; } - public override void Write(Utf8JsonWriter writer, ApiKeyAggregation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.Aggregations is not null) + switch (value.VariantType) { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); + case null: + break; + case "cardinality": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation)value.Variant, null, null); + break; + case "composite": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation)value.Variant, null, null); + break; + case "date_range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation)value.Variant, null, null); + break; + case "filter": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Security.ApiKeyQuery)value.Variant, null, null); + break; + case "filters": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation)value.Variant, null, null); + break; + case "missing": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, null, null); + break; + case "value_count": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation)}'."); } - if (value.Meta is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, value.Meta, options); - } + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationConverter))] +public sealed partial class ApiKeyAggregation +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public ApiKeyAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ApiKeyAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? Cardinality { get => GetVariant("cardinality"); set => SetVariant("cardinality", value); } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? Composite { get => GetVariant("composite"); set => SetVariant("composite", value); } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? DateRange { get => GetVariant("date_range"); set => SetVariant("date_range", value); } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? Filter { get => GetVariant("filter"); set => SetVariant("filter", value); } - if (value.VariantName is not null && value.Variant is not null) + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation? Filters { get => GetVariant("filters"); set => SetVariant("filters", value); } + public Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? Missing { get => GetVariant("missing"); set => SetVariant("missing", value); } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? ValueCount { get => GetVariant("value_count"); set => SetVariant("value_count", value); } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public System.Collections.Generic.IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Meta { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Cardinality = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Composite = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { DateRange = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Filter = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Filters = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Missing = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation { ValueCount = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "cardinality": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation)value.Variant, options); - break; - case "composite": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation)value.Variant, options); - break; - case "date_range": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation)value.Variant, options); - break; - case "filter": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.ApiKeyQuery)value.Variant, options); - break; - case "filters": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation)value.Variant, options); - break; - case "missing": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, options); - break; - case "value_count": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation)value.Variant, options); - break; - } + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ApiKeyAggregationDescriptor { - internal ApiKeyAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation instance) + { + Instance = instance; + } - public ApiKeyAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyAggregationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? value) + { + Instance.Cardinality = value; + return this; + } - private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(null); + return this; } - private ApiKeyAggregationDescriptor Set(object variant, string variantName) + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality(System.Action>? action) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; } - private IDictionary> AggregationsValue { get; set; } - private IDictionary? MetaValue { get; set; } + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? value) + { + Instance.Composite = value; + return this; + } /// /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite() + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. /// /// - public ApiKeyAggregationDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite(System.Action>? action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; } - public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? value) { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.DateRange = value; + return this; } - public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); - public ApiKeyAggregationDescriptor Cardinality(Action> configure) => Set(configure, "cardinality"); - public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); - public ApiKeyAggregationDescriptor Composite(Action> configure) => Set(configure, "composite"); - public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); - public ApiKeyAggregationDescriptor DateRange(Action> configure) => Set(configure, "date_range"); - public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); - public ApiKeyAggregationDescriptor Filter(Action> configure) => Set(configure, "filter"); - public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); - public ApiKeyAggregationDescriptor Filters(Action> configure) => Set(configure, "filters"); - public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); - public ApiKeyAggregationDescriptor Missing(Action> configure) => Set(configure, "missing"); - public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); - public ApiKeyAggregationDescriptor Range(Action> configure) => Set(configure, "range"); - public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public ApiKeyAggregationDescriptor Terms(Action> configure) => Set(configure, "terms"); - public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); - public ApiKeyAggregationDescriptor ValueCount(Action> configure) => Set(configure, "value_count"); + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange() + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(null); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange(System.Action>? action) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? value) + { + Instance.Filter = value; + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation? value) + { + Instance.Filters = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters() + { + Instance.Filters = Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor.Build(null); + return this; } -} -public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor -{ - internal ApiKeyAggregationDescriptor(Action configure) => configure.Invoke(this); + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters(System.Action>? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor.Build(action); + return this; + } - public ApiKeyAggregationDescriptor() : base() + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? value) { + Instance.Missing = value; + return this; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing(System.Action>? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } - private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Range = value; + return this; } - private ApiKeyAggregationDescriptor Set(object variant, string variantName) + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(null); + return this; } - private IDictionary AggregationsValue { get; set; } - private IDictionary? MetaValue { get; set; } + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range(System.Action>? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } /// /// - /// Sub-aggregations for this aggregation. - /// Only applies to bucket aggregations. + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. /// /// - public ApiKeyAggregationDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Terms = value; + return this; } - public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms() { - MetaValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; } - public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); - public ApiKeyAggregationDescriptor Cardinality(Action configure) => Set(configure, "cardinality"); - public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); - public ApiKeyAggregationDescriptor Composite(Action configure) => Set(configure, "composite"); - public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); - public ApiKeyAggregationDescriptor DateRange(Action configure) => Set(configure, "date_range"); - public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); - public ApiKeyAggregationDescriptor Filter(Action configure) => Set(configure, "filter"); - public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); - public ApiKeyAggregationDescriptor Filters(Action configure) => Set(configure, "filters"); - public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); - public ApiKeyAggregationDescriptor Missing(Action configure) => Set(configure, "missing"); - public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); - public ApiKeyAggregationDescriptor Range(Action configure) => Set(configure, "range"); - public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public ApiKeyAggregationDescriptor Terms(Action configure) => Set(configure, "terms"); - public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); - public ApiKeyAggregationDescriptor ValueCount(Action configure) => Set(configure, "value_count"); + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? value) { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.ValueCount = value; + return this; + } - if (MetaValue is not null) - { - writer.WritePropertyName("meta"); - JsonSerializer.Serialize(writer, MetaValue, options); - } + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount() + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(null); + return this; + } - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount(System.Action>? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } - writer.WriteEndObject(); + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(null); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct ApiKeyAggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation? value) + { + Instance.Cardinality = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality() + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality(System.Action? action) + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that calculates an approximate count of distinct values. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Cardinality(System.Action>? action) + { + Instance.Cardinality = Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation? value) + { + Instance.Composite = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite() + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite(System.Action? action) + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation that creates composite buckets from different sources. + /// Unlike the other multi-bucket aggregations, you can use the composite aggregation to paginate all buckets from a multi-level aggregation efficiently. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Composite(System.Action>? action) + { + Instance.Composite = Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation? value) + { + Instance.DateRange = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange() + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange(System.Action? action) + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor DateRange(System.Action>? action) + { + Instance.DateRange = Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? value) + { + Instance.Filter = value; + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filter(System.Action action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A single bucket aggregation that narrows the set of documents to those that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filter(System.Action> action) + { + Instance.Filter = Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation? value) + { + Instance.Filters = value; + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters() + { + Instance.Filters = Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters(System.Action? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket aggregation where each bucket contains the documents that match a query. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Filters(System.Action>? action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation? value) + { + Instance.Missing = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing() + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing(System.Action? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Missing(System.Action>? action) + { + Instance.Missing = Elastic.Clients.Elasticsearch.Aggregations.MissingAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range() + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range(System.Action? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Range(System.Action>? action) + { + Instance.Range = Elastic.Clients.Elasticsearch.Aggregations.RangeAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms() + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms(System.Action? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation? value) + { + Instance.ValueCount = value; + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount() + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(null); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount(System.Action? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor ValueCount(System.Action>? action) + { + Instance.ValueCount = Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregationDescriptor.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(null); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations(System.Action? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringApiKeyAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta(System.Collections.Generic.IDictionary? value) + { + Instance.Meta = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta() + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor Meta(System.Action? action) + { + Instance.Meta = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor AddMeta(string key, object value) + { + Instance.Meta ??= new System.Collections.Generic.Dictionary(); + Instance.Meta.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregationDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs index 0d576e3f567..dfa954dfe67 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs @@ -17,24 +17,102 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ApiKeyFiltersAggregationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFilters = System.Text.Json.JsonEncodedText.Encode("filters"); + private static readonly System.Text.Json.JsonEncodedText PropKeyed = System.Text.Json.JsonEncodedText.Encode("keyed"); + private static readonly System.Text.Json.JsonEncodedText PropOtherBucket = System.Text.Json.JsonEncodedText.Encode("other_bucket"); + private static readonly System.Text.Json.JsonEncodedText PropOtherBucketKey = System.Text.Json.JsonEncodedText.Encode("other_bucket_key"); + + public override Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFilters = default; + LocalJsonValue propKeyed = default; + LocalJsonValue propOtherBucket = default; + LocalJsonValue propOtherBucketKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFilters.TryReadProperty(ref reader, options, PropFilters, null)) + { + continue; + } + + if (propKeyed.TryReadProperty(ref reader, options, PropKeyed, null)) + { + continue; + } + + if (propOtherBucket.TryReadProperty(ref reader, options, PropOtherBucket, null)) + { + continue; + } + + if (propOtherBucketKey.TryReadProperty(ref reader, options, PropOtherBucketKey, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Filters = propFilters.Value, + Keyed = propKeyed.Value, + OtherBucket = propOtherBucket.Value, + OtherBucketKey = propOtherBucketKey.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFilters, value.Filters, null, null); + writer.WriteProperty(options, PropKeyed, value.Keyed, null, null); + writer.WriteProperty(options, PropOtherBucket, value.OtherBucket, null, null); + writer.WriteProperty(options, PropOtherBucketKey, value.OtherBucketKey, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationConverter))] public sealed partial class ApiKeyFiltersAggregation { +#if NET7_0_OR_GREATER + public ApiKeyFiltersAggregation() + { + } +#endif +#if !NET7_0_OR_GREATER + public ApiKeyFiltersAggregation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Collection of queries from which to build buckets. /// /// - [JsonInclude, JsonPropertyName("filters")] public Elastic.Clients.Elasticsearch.Aggregations.Buckets? Filters { get; set; } /// @@ -43,7 +121,6 @@ public sealed partial class ApiKeyFiltersAggregation /// Set to false to return the buckets as an array of objects. /// /// - [JsonInclude, JsonPropertyName("keyed")] public bool? Keyed { get; set; } /// @@ -51,7 +128,6 @@ public sealed partial class ApiKeyFiltersAggregation /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. /// /// - [JsonInclude, JsonPropertyName("other_bucket")] public bool? OtherBucket { get; set; } /// @@ -59,34 +135,48 @@ public sealed partial class ApiKeyFiltersAggregation /// The key with which the other bucket is returned. /// /// - [JsonInclude, JsonPropertyName("other_bucket_key")] public string? OtherBucketKey { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Filters(apiKeyFiltersAggregation); } -public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor> +public readonly partial struct ApiKeyFiltersAggregationDescriptor { - internal ApiKeyFiltersAggregationDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation Instance { get; init; } - public ApiKeyFiltersAggregationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyFiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } - private bool? KeyedValue { get; set; } - private bool? OtherBucketValue { get; set; } - private string? OtherBucketKeyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyFiltersAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor descriptor) => descriptor.Instance; /// /// /// Collection of queries from which to build buckets. /// /// - public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? value) { - FiltersValue = filters; - return Self; + Instance.Filters = value; + return this; + } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Filters(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfApiKeyQueryFactory.Build(action); + return this; } /// @@ -95,10 +185,10 @@ public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Ela /// Set to false to return the buckets as an array of objects. /// /// - public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Keyed(bool? value = true) { - KeyedValue = keyed; - return Self; + Instance.Keyed = value; + return this; } /// @@ -106,10 +196,10 @@ public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. /// /// - public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor OtherBucket(bool? value = true) { - OtherBucketValue = otherBucket; - return Self; + Instance.OtherBucket = value; + return this; } /// @@ -117,65 +207,76 @@ public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBuck /// The key with which the other bucket is returned. /// /// - public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? value) { - OtherBucketKeyValue = otherBucketKey; - return Self; + Instance.OtherBucketKey = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation Build(System.Action>? action) { - writer.WriteStartObject(); - if (FiltersValue is not null) + if (action is null) { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); + return new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (KeyedValue.HasValue) - { - writer.WritePropertyName("keyed"); - writer.WriteBooleanValue(KeyedValue.Value); - } + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (OtherBucketValue.HasValue) - { - writer.WritePropertyName("other_bucket"); - writer.WriteBooleanValue(OtherBucketValue.Value); - } +public readonly partial struct ApiKeyFiltersAggregationDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation Instance { get; init; } - if (!string.IsNullOrEmpty(OtherBucketKeyValue)) - { - writer.WritePropertyName("other_bucket_key"); - writer.WriteStringValue(OtherBucketKeyValue); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyFiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyFiltersAggregationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor -{ - internal ApiKeyFiltersAggregationDescriptor(Action configure) => configure.Invoke(this); + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor descriptor) => descriptor.Instance; - public ApiKeyFiltersAggregationDescriptor() : base() + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? value) { + Instance.Filters = value; + return this; } - private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } - private bool? KeyedValue { get; set; } - private bool? OtherBucketValue { get; set; } - private string? OtherBucketKeyValue { get; set; } + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Filters(System.Func> action) + { + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfApiKeyQueryFactory.Build(action); + return this; + } /// /// /// Collection of queries from which to build buckets. /// /// - public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Filters(System.Func, Elastic.Clients.Elasticsearch.Aggregations.Buckets> action) { - FiltersValue = filters; - return Self; + Instance.Filters = Elastic.Clients.Elasticsearch.Aggregations.BucketsOfApiKeyQueryFactory.Build(action); + return this; } /// @@ -184,10 +285,10 @@ public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch. /// Set to false to return the buckets as an array of objects. /// /// - public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor Keyed(bool? value = true) { - KeyedValue = keyed; - return Self; + Instance.Keyed = value; + return this; } /// @@ -195,10 +296,10 @@ public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. /// /// - public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor OtherBucket(bool? value = true) { - OtherBucketValue = otherBucket; - return Self; + Instance.OtherBucket = value; + return this; } /// @@ -206,39 +307,22 @@ public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) /// The key with which the other bucket is returned. /// /// - public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + public Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? value) { - OtherBucketKeyValue = otherBucketKey; - return Self; + Instance.OtherBucketKey = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation Build(System.Action? action) { - writer.WriteStartObject(); - if (FiltersValue is not null) - { - writer.WritePropertyName("filters"); - JsonSerializer.Serialize(writer, FiltersValue, options); - } - - if (KeyedValue.HasValue) - { - writer.WritePropertyName("keyed"); - writer.WriteBooleanValue(KeyedValue.Value); - } - - if (OtherBucketValue.HasValue) + if (action is null) { - writer.WritePropertyName("other_bucket"); - writer.WriteBooleanValue(OtherBucketValue.Value); + return new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(OtherBucketKeyValue)) - { - writer.WritePropertyName("other_bucket_key"); - writer.WriteStringValue(OtherBucketKeyValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregationDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs index c84a6c7b2b8..ade74684396 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs @@ -17,368 +17,1044 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(ApiKeyQueryConverter))] -public sealed partial class ApiKeyQuery +internal sealed partial class ApiKeyQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal ApiKeyQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static ApiKeyQuery Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new ApiKeyQuery("bool", boolQuery); - public static ApiKeyQuery Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new ApiKeyQuery("exists", existsQuery); - public static ApiKeyQuery Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new ApiKeyQuery("ids", idsQuery); - public static ApiKeyQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new ApiKeyQuery("match", matchQuery); - public static ApiKeyQuery MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new ApiKeyQuery("match_all", matchAllQuery); - public static ApiKeyQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new ApiKeyQuery("prefix", prefixQuery); - public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); - public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); - public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); - public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); - public static ApiKeyQuery SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new ApiKeyQuery("simple_query_string", simpleQueryStringQuery); - public static ApiKeyQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new ApiKeyQuery("term", termQuery); - public static ApiKeyQuery Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new ApiKeyQuery("terms", termsQuery); - public static ApiKeyQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new ApiKeyQuery("wildcard", wildcardQuery); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantBool = System.Text.Json.JsonEncodedText.Encode("bool"); + private static readonly System.Text.Json.JsonEncodedText VariantExists = System.Text.Json.JsonEncodedText.Encode("exists"); + private static readonly System.Text.Json.JsonEncodedText VariantIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchAll = System.Text.Json.JsonEncodedText.Encode("match_all"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantSimpleQueryString = System.Text.Json.JsonEncodedText.Encode("simple_query_string"); + private static readonly System.Text.Json.JsonEncodedText VariantTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); -internal sealed partial class ApiKeyQueryConverter : JsonConverter -{ - public override ApiKeyQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.ApiKeyQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBool)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantBool.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "bool") + if (reader.ValueTextEquals(VariantExists)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExists.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "exists") + if (reader.ValueTextEquals(VariantIds)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIds.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ids") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantMatchAll)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchAll.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_all") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantSimpleQueryString)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSimpleQueryString.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "simple_query_string") + if (reader.ValueTextEquals(VariantTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "term") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new ApiKeyQuery(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, ApiKeyQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApiKeyQuery value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "bool": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); - break; - case "exists": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); - break; - case "ids": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); - break; - case "match_all": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "simple_query_string": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); - break; - case "term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); - break; - } + case null: + break; + case "bool": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, null, null); + break; + case "exists": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, null, null); + break; + case "ids": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, null, null); + break; + case "match_all": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery)value.Variant, null, null); + break; + case "simple_query_string": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, null, null); + break; + case "term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery)}'."); } writer.WriteEndObject(); } } -public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryConverter))] +public sealed partial class ApiKeyQuery { - internal ApiKeyQueryDescriptor(Action> configure) => configure.Invoke(this); - - public ApiKeyQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private ApiKeyQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public ApiKeyQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); - public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public ApiKeyQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public ApiKeyQueryDescriptor Match(Action> configure) => Set(configure, "match"); - public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public ApiKeyQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public ApiKeyQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); - public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public ApiKeyQueryDescriptor Term(Action> configure) => Set(configure, "term"); - public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public ApiKeyQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); - public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public ApiKeyQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public ApiKeyQuery() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + } +#endif +#if !NET7_0_OR_GREATER + public ApiKeyQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? Bool { get => GetVariant("bool"); set => SetVariant("bool", value); } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? Exists { get => GetVariant("exists"); set => SetVariant("exists", value); } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? Ids { get => GetVariant("ids"); set => SetVariant("ids", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? MatchAll { get => GetVariant("match_all"); set => SetVariant("match_all", value); } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? SimpleQueryString { get => GetVariant("simple_query_string"); set => SetVariant("simple_query_string", value); } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? Term { get => GetVariant("term"); set => SetVariant("term", value); } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Bool = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Exists = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Ids = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Match = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { MatchAll = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Prefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { SimpleQueryString = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Term = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery value) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery { Wildcard = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor +public readonly partial struct ApiKeyQueryDescriptor { - internal ApiKeyQueryDescriptor(Action configure) => configure.Invoke(this); - - public ApiKeyQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private ApiKeyQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public ApiKeyQueryDescriptor Bool(Action configure) => Set(configure, "bool"); - public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public ApiKeyQueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public ApiKeyQueryDescriptor Match(Action configure) => Set(configure, "match"); - public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public ApiKeyQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public ApiKeyQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); - public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public ApiKeyQueryDescriptor Term(Action configure) => Set(configure, "term"); - public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public ApiKeyQueryDescriptor Terms(Action configure) => Set(configure, "terms"); - public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public ApiKeyQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal Elastic.Clients.Elasticsearch.Security.ApiKeyQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyQueryDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance = instance; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WriteEndObject(); + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct ApiKeyQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.ApiKeyQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyQueryDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApiKeyQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery instance) => new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool(System.Action? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches documents matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Exists(System.Action action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns documents based on their IDs. + /// This query uses document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Match(System.Action action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all documents, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Range(System.Func action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor SimpleQueryString(System.Action action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Term(System.Action action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Terms(System.Action action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns documents that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApiKeyQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs index 6c29ebc03a8..a8d22f6c94b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs @@ -17,77 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class ApplicationGlobalUserPrivileges +internal sealed partial class ApplicationGlobalUserPrivilegesConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("manage")] - public Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Manage { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropManage = System.Text.Json.JsonEncodedText.Encode("manage"); + + public override Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propManage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propManage.TryReadProperty(ref reader, options, PropManage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Manage = propManage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropManage, value.Manage, null, null); + writer.WriteEndObject(); + } } -public sealed partial class ApplicationGlobalUserPrivilegesDescriptor : SerializableDescriptor +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesConverter))] +public sealed partial class ApplicationGlobalUserPrivileges { - internal ApplicationGlobalUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); - - public ApplicationGlobalUserPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges manage) { + Manage = manage; + } +#if NET7_0_OR_GREATER + public ApplicationGlobalUserPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ApplicationGlobalUserPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - private Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges ManageValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor ManageDescriptor { get; set; } - private Action ManageDescriptorAction { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Manage { get; set; } +} + +public readonly partial struct ApplicationGlobalUserPrivilegesDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Instance { get; init; } - public ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges manage) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationGlobalUserPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges instance) { - ManageDescriptor = null; - ManageDescriptorAction = null; - ManageValue = manage; - return Self; + Instance = instance; } - public ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationGlobalUserPrivilegesDescriptor() { - ManageValue = null; - ManageDescriptorAction = null; - ManageDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ApplicationGlobalUserPrivilegesDescriptor Manage(Action configure) + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges value) { - ManageValue = null; - ManageDescriptor = null; - ManageDescriptorAction = configure; - return Self; + Instance.Manage = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor Manage(System.Action action) { - writer.WriteStartObject(); - if (ManageDescriptor is not null) - { - writer.WritePropertyName("manage"); - JsonSerializer.Serialize(writer, ManageDescriptor, options); - } - else if (ManageDescriptorAction is not null) - { - writer.WritePropertyName("manage"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor(ManageDescriptorAction), options); - } - else - { - writer.WritePropertyName("manage"); - JsonSerializer.Serialize(writer, ManageValue, options); - } + Instance.Manage = Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs index 8794e5e2679..25d66cf282c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs @@ -17,64 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ApplicationPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropResources = System.Text.Json.JsonEncodedText.Encode("resources"); + + public override Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApplication = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue> propResources = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, null)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propResources.TryReadProperty(ref reader, options, PropResources, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value, + Privileges = propPrivileges.Value, + Resources = propResources.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, null); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropResources, value.Resources, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesConverter))] public sealed partial class ApplicationPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivileges(string application, System.Collections.Generic.ICollection privileges, System.Collections.Generic.ICollection resources) + { + Application = application; + Privileges = privileges; + Resources = resources; + } +#if NET7_0_OR_GREATER + public ApplicationPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ApplicationPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApplicationPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the application to which this entry applies. /// /// - [JsonInclude, JsonPropertyName("application")] - public string Application { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Application { get; set; } /// /// /// A list of strings, where each element is the name of an application privilege or action. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } /// /// /// A list resources to which the privileges are applied. /// /// - [JsonInclude, JsonPropertyName("resources")] - public ICollection Resources { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Resources { get; set; } } -public sealed partial class ApplicationPrivilegesDescriptor : SerializableDescriptor +public readonly partial struct ApplicationPrivilegesDescriptor { - internal ApplicationPrivilegesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges instance) + { + Instance = instance; + } - public ApplicationPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivilegesDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string ApplicationValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private ICollection ResourcesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// The name of the application to which this entry applies. /// /// - public ApplicationPrivilegesDescriptor Application(string application) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor Application(string value) + { + Instance.Application = value; + return this; + } + + /// + /// + /// A list of strings, where each element is the name of an application privilege or action. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - ApplicationValue = application; - return Self; + Instance.Privileges = value; + return this; } /// @@ -82,10 +187,21 @@ public ApplicationPrivilegesDescriptor Application(string application) /// A list of strings, where each element is the name of an application privilege or action. /// /// - public ApplicationPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor Privileges(params string[] values) + { + Instance.Privileges = [.. values]; + return this; + } + + /// + /// + /// A list resources to which the privileges are applied. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor Resources(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Resources = value; + return this; } /// @@ -93,21 +209,17 @@ public ApplicationPrivilegesDescriptor Privileges(ICollection privileges /// A list resources to which the privileges are applied. /// /// - public ApplicationPrivilegesDescriptor Resources(ICollection resources) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor Resources(params string[] values) { - ResourcesValue = resources; - return Self; + Instance.Resources = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("application"); - writer.WriteStringValue(ApplicationValue); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - writer.WritePropertyName("resources"); - JsonSerializer.Serialize(writer, ResourcesValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs index a1722cdeb72..3bfa7fa5acf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs @@ -17,25 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ApplicationPrivilegesCheckConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropResources = System.Text.Json.JsonEncodedText.Encode("resources"); + + public override Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApplication = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue> propResources = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, null)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propResources.TryReadProperty(ref reader, options, PropResources, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value, + Privileges = propPrivileges.Value, + Resources = propResources.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, null); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropResources, value.Resources, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckConverter))] public sealed partial class ApplicationPrivilegesCheck { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivilegesCheck(string application, System.Collections.Generic.ICollection privileges, System.Collections.Generic.ICollection resources) + { + Application = application; + Privileges = privileges; + Resources = resources; + } +#if NET7_0_OR_GREATER + public ApplicationPrivilegesCheck() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ApplicationPrivilegesCheck() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ApplicationPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the application. /// /// - [JsonInclude, JsonPropertyName("application")] - public string Application { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Application { get; set; } /// /// @@ -43,39 +124,64 @@ public sealed partial class ApplicationPrivilegesCheck /// It may be either application privilege names or the names of actions that are granted by those privileges /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } /// /// /// A list of resource names against which the privileges should be checked. /// /// - [JsonInclude, JsonPropertyName("resources")] - public ICollection Resources { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Resources { get; set; } } -public sealed partial class ApplicationPrivilegesCheckDescriptor : SerializableDescriptor +public readonly partial struct ApplicationPrivilegesCheckDescriptor { - internal ApplicationPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck instance) + { + Instance = instance; + } - public ApplicationPrivilegesCheckDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ApplicationPrivilegesCheckDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string ApplicationValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private ICollection ResourcesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck instance) => new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor descriptor) => descriptor.Instance; /// /// /// The name of the application. /// /// - public ApplicationPrivilegesCheckDescriptor Application(string application) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor Application(string value) + { + Instance.Application = value; + return this; + } + + /// + /// + /// A list of the privileges that you want to check for the specified resources. + /// It may be either application privilege names or the names of actions that are granted by those privileges + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor Privileges(System.Collections.Generic.ICollection value) { - ApplicationValue = application; - return Self; + Instance.Privileges = value; + return this; } /// @@ -84,10 +190,21 @@ public ApplicationPrivilegesCheckDescriptor Application(string application) /// It may be either application privilege names or the names of actions that are granted by those privileges /// /// - public ApplicationPrivilegesCheckDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor Privileges(params string[] values) + { + Instance.Privileges = [.. values]; + return this; + } + + /// + /// + /// A list of resource names against which the privileges should be checked. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor Resources(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Resources = value; + return this; } /// @@ -95,21 +212,17 @@ public ApplicationPrivilegesCheckDescriptor Privileges(ICollection privi /// A list of resource names against which the privileges should be checked. /// /// - public ApplicationPrivilegesCheckDescriptor Resources(ICollection resources) + public Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor Resources(params string[] values) { - ResourcesValue = resources; - return Self; + Instance.Resources = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("application"); - writer.WriteStringValue(ApplicationValue); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - writer.WritePropertyName("resources"); - JsonSerializer.Serialize(writer, ResourcesValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateApiKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateApiKey.g.cs index ecd48deda3c..3ad51c742d5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateApiKey.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateApiKey.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticateApiKeyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticateApiKey Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticateApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticateApiKey value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticateApiKeyConverter))] public sealed partial class AuthenticateApiKey { - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticateApiKey(string id) + { + Id = id; + } +#if NET7_0_OR_GREATER + public AuthenticateApiKey() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AuthenticateApiKey() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticateApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public string? Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs index 650d249cefb..2c0737f7b90 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticateTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticateToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticateToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticateToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticateTokenConverter))] public sealed partial class AuthenticateToken { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string? Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticateToken(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public AuthenticateToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AuthenticateToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticateToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public string? Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs index ce94b486730..a0fa23a0e03 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs @@ -17,38 +17,209 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticatedUserConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationProvider = System.Text.Json.JsonEncodedText.Encode("authentication_provider"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationRealm = System.Text.Json.JsonEncodedText.Encode("authentication_realm"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationType = System.Text.Json.JsonEncodedText.Encode("authentication_type"); + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropLookupRealm = System.Text.Json.JsonEncodedText.Encode("lookup_realm"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropProfileUid = System.Text.Json.JsonEncodedText.Encode("profile_uid"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticatedUser Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAuthenticationProvider = default; + LocalJsonValue propAuthenticationRealm = default; + LocalJsonValue propAuthenticationType = default; + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue propLookupRealm = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue propProfileUid = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAuthenticationProvider.TryReadProperty(ref reader, options, PropAuthenticationProvider, null)) + { + continue; + } + + if (propAuthenticationRealm.TryReadProperty(ref reader, options, PropAuthenticationRealm, null)) + { + continue; + } + + if (propAuthenticationType.TryReadProperty(ref reader, options, PropAuthenticationType, null)) + { + continue; + } + + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propLookupRealm.TryReadProperty(ref reader, options, PropLookupRealm, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propProfileUid.TryReadProperty(ref reader, options, PropProfileUid, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticatedUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AuthenticationProvider = propAuthenticationProvider.Value, + AuthenticationRealm = propAuthenticationRealm.Value, + AuthenticationType = propAuthenticationType.Value, + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + LookupRealm = propLookupRealm.Value, + Metadata = propMetadata.Value, + ProfileUid = propProfileUid.Value, + Roles = propRoles.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticatedUser value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAuthenticationProvider, value.AuthenticationProvider, null, null); + writer.WriteProperty(options, PropAuthenticationRealm, value.AuthenticationRealm, null, null); + writer.WriteProperty(options, PropAuthenticationType, value.AuthenticationType, null, null); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropLookupRealm, value.LookupRealm, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProfileUid, value.ProfileUid, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticatedUserConverter))] public sealed partial class AuthenticatedUser { - [JsonInclude, JsonPropertyName("authentication_provider")] - public Elastic.Clients.Elasticsearch.Security.AuthenticationProvider? AuthenticationProvider { get; init; } - [JsonInclude, JsonPropertyName("authentication_realm")] - public Elastic.Clients.Elasticsearch.Security.UserRealm AuthenticationRealm { get; init; } - [JsonInclude, JsonPropertyName("authentication_type")] - public string AuthenticationType { get; init; } - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("lookup_realm")] - public Elastic.Clients.Elasticsearch.Security.UserRealm LookupRealm { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("profile_uid")] - public string? ProfileUid { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticatedUser(Elastic.Clients.Elasticsearch.Security.UserRealm authenticationRealm, string authenticationType, bool enabled, Elastic.Clients.Elasticsearch.Security.UserRealm lookupRealm, System.Collections.Generic.IReadOnlyDictionary metadata, System.Collections.Generic.IReadOnlyCollection roles, string username) + { + AuthenticationRealm = authenticationRealm; + AuthenticationType = authenticationType; + Enabled = enabled; + LookupRealm = lookupRealm; + Metadata = metadata; + Roles = roles; + Username = username; + } +#if NET7_0_OR_GREATER + public AuthenticatedUser() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AuthenticatedUser() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticatedUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Security.AuthenticationProvider? AuthenticationProvider { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserRealm AuthenticationRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string AuthenticationType { get; set; } + public string? Email { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public string? FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserRealm LookupRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public string? ProfileUid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Authentication.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Authentication.g.cs index ce5f188a6f8..ac054c3d05d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Authentication.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Authentication.g.cs @@ -17,38 +17,219 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApiKey = System.Text.Json.JsonEncodedText.Encode("api_key"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationRealm = System.Text.Json.JsonEncodedText.Encode("authentication_realm"); + private static readonly System.Text.Json.JsonEncodedText PropAuthenticationType = System.Text.Json.JsonEncodedText.Encode("authentication_type"); + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropLookupRealm = System.Text.Json.JsonEncodedText.Encode("lookup_realm"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropToken = System.Text.Json.JsonEncodedText.Encode("token"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.Authentication Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApiKey = default; + LocalJsonValue propAuthenticationRealm = default; + LocalJsonValue propAuthenticationType = default; + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue propLookupRealm = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue> propRoles = default; + LocalJsonValue?> propToken = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApiKey.TryReadProperty(ref reader, options, PropApiKey, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propAuthenticationRealm.TryReadProperty(ref reader, options, PropAuthenticationRealm, null)) + { + continue; + } + + if (propAuthenticationType.TryReadProperty(ref reader, options, PropAuthenticationType, null)) + { + continue; + } + + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propLookupRealm.TryReadProperty(ref reader, options, PropLookupRealm, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propToken.TryReadProperty(ref reader, options, PropToken, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.Authentication(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ApiKey = propApiKey.Value, + AuthenticationRealm = propAuthenticationRealm.Value, + AuthenticationType = propAuthenticationType.Value, + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + LookupRealm = propLookupRealm.Value, + Metadata = propMetadata.Value, + Roles = propRoles.Value, + Token = propToken.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.Authentication value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApiKey, value.ApiKey, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropAuthenticationRealm, value.AuthenticationRealm, null, null); + writer.WriteProperty(options, PropAuthenticationType, value.AuthenticationType, null, null); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropLookupRealm, value.LookupRealm, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropToken, value.Token, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticationConverter))] public sealed partial class Authentication { - [JsonInclude, JsonPropertyName("api_key")] - public IReadOnlyDictionary? ApiKey { get; init; } - [JsonInclude, JsonPropertyName("authentication_realm")] - public Elastic.Clients.Elasticsearch.Security.AuthenticationRealm AuthenticationRealm { get; init; } - [JsonInclude, JsonPropertyName("authentication_type")] - public string AuthenticationType { get; init; } - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("lookup_realm")] - public Elastic.Clients.Elasticsearch.Security.AuthenticationRealm LookupRealm { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("token")] - public IReadOnlyDictionary? Token { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Authentication(Elastic.Clients.Elasticsearch.Security.AuthenticationRealm authenticationRealm, string authenticationType, string? email, bool enabled, string? fullName, Elastic.Clients.Elasticsearch.Security.AuthenticationRealm lookupRealm, System.Collections.Generic.IReadOnlyDictionary metadata, System.Collections.Generic.IReadOnlyCollection roles, string username) + { + AuthenticationRealm = authenticationRealm; + AuthenticationType = authenticationType; + Email = email; + Enabled = enabled; + FullName = fullName; + LookupRealm = lookupRealm; + Metadata = metadata; + Roles = roles; + Username = username; + } +#if NET7_0_OR_GREATER + public Authentication() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Authentication() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Authentication(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? ApiKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.AuthenticationRealm AuthenticationRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string AuthenticationType { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string? Email { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string? FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.AuthenticationRealm LookupRealm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Token { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs index abe97c0156d..b30bbc4d87d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticationProviderConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticationProvider Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticationProvider(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticationProvider value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticationProviderConverter))] public sealed partial class AuthenticationProvider { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticationProvider(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public AuthenticationProvider() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AuthenticationProvider() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticationProvider(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationRealm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationRealm.g.cs index 818cba15063..b0e9baa99fa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationRealm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationRealm.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class AuthenticationRealmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDomain = System.Text.Json.JsonEncodedText.Encode("domain"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.AuthenticationRealm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDomain = default; + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDomain.TryReadProperty(ref reader, options, PropDomain, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.AuthenticationRealm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Domain = propDomain.Value, + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.AuthenticationRealm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDomain, value.Domain, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.AuthenticationRealmConverter))] public sealed partial class AuthenticationRealm { - [JsonInclude, JsonPropertyName("domain")] - public string? Domain { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AuthenticationRealm(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public AuthenticationRealm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AuthenticationRealm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AuthenticationRealm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Domain { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/BulkError.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/BulkError.g.cs index a77fb2ce0d3..ba7d3822ebe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/BulkError.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/BulkError.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class BulkErrorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + + public override Elastic.Clients.Elasticsearch.Security.BulkError Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDetails = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.BulkError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Details = propDetails.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.BulkError value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.BulkErrorConverter))] public sealed partial class BulkError { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BulkError(int count, System.Collections.Generic.IReadOnlyDictionary details) + { + Count = count; + Details = details; + } +#if NET7_0_OR_GREATER + public BulkError() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BulkError() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BulkError(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of errors /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Details about the errors, keyed by role name /// /// - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyDictionary Details { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Details { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs index a31b4e2523f..0196013fbf0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ClusterNodeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.ClusterNode Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ClusterNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ClusterNode value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ClusterNodeConverter))] public sealed partial class ClusterNode { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ClusterNode(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public ClusterNode() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ClusterNode() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ClusterNode(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs index 28b905eca81..5a170549f45 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class CreatedStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCreated = System.Text.Json.JsonEncodedText.Encode("created"); + + public override Elastic.Clients.Elasticsearch.Security.CreatedStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCreated = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCreated.TryReadProperty(ref reader, options, PropCreated, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.CreatedStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Created = propCreated.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.CreatedStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCreated, value.Created, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.CreatedStatusConverter))] public sealed partial class CreatedStatus { - [JsonInclude, JsonPropertyName("created")] - public bool Created { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreatedStatus(bool created) + { + Created = created; + } +#if NET7_0_OR_GREATER + public CreatedStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CreatedStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CreatedStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Created { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs deleted file mode 100644 index 60f44e7e5eb..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs +++ /dev/null @@ -1,251 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. -// -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ------------------------------------------------ -// -// This file is automatically generated. -// Please do not edit these files manually. -// -// ------------------------------------------------ - -#nullable restore - -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Security; - -[JsonConverter(typeof(FieldRuleConverter))] -public sealed partial class FieldRule -{ - internal FieldRule(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static FieldRule Dn(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("dn", names); - public static FieldRule Groups(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("groups", names); - public static FieldRule Username(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("username", names); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class FieldRuleConverter : JsonConverter -{ - public override FieldRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); - } - - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "dn") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - - if (propertyName == "groups") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - - if (propertyName == "username") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'FieldRule' from the response."); - } - - var result = new FieldRule(variantNameValue, variantValue); - return result; - } - - public override void Write(Utf8JsonWriter writer, FieldRule value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) - { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "dn": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); - break; - case "groups": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); - break; - case "username": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); - break; - } - } - - writer.WriteEndObject(); - } -} - -public sealed partial class FieldRuleDescriptor : SerializableDescriptor> -{ - internal FieldRuleDescriptor(Action> configure) => configure.Invoke(this); - - public FieldRuleDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private FieldRuleDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Names names) => Set(names, "dn"); - public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Names names) => Set(names, "groups"); - public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Names names) => Set(names, "username"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); - } -} - -public sealed partial class FieldRuleDescriptor : SerializableDescriptor -{ - internal FieldRuleDescriptor(Action configure) => configure.Invoke(this); - - public FieldRuleDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private FieldRuleDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Names names) => Set(names, "dn"); - public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Names names) => Set(names, "groups"); - public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Names names) => Set(names, "username"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } - - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } - - writer.WriteEndObject(); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs index 0876eb525c9..b8e709a65d8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs @@ -17,106 +17,193 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class FieldSecurityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExcept = System.Text.Json.JsonEncodedText.Encode("except"); + private static readonly System.Text.Json.JsonEncodedText PropGrant = System.Text.Json.JsonEncodedText.Encode("grant"); + + public override Elastic.Clients.Elasticsearch.Security.FieldSecurity Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExcept = default; + LocalJsonValue propGrant = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExcept.TryReadProperty(ref reader, options, PropExcept, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (propGrant.TryReadProperty(ref reader, options, PropGrant, static Elastic.Clients.Elasticsearch.Fields? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Except = propExcept.Value, + Grant = propGrant.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.FieldSecurity value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExcept, value.Except, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteProperty(options, PropGrant, value.Grant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Fields? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SingleOrManyFieldsMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.FieldSecurityConverter))] public sealed partial class FieldSecurity { - [JsonInclude, JsonPropertyName("except")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] +#if NET7_0_OR_GREATER + public FieldSecurity() + { + } +#endif +#if !NET7_0_OR_GREATER + public FieldSecurity() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Fields? Except { get; set; } - [JsonInclude, JsonPropertyName("grant")] - [JsonConverter(typeof(SingleOrManyFieldsConverter))] public Elastic.Clients.Elasticsearch.Fields? Grant { get; set; } } -public sealed partial class FieldSecurityDescriptor : SerializableDescriptor> +public readonly partial struct FieldSecurityDescriptor { - internal FieldSecurityDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.FieldSecurity Instance { get; init; } - public FieldSecurityDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSecurityDescriptor(Elastic.Clients.Elasticsearch.Security.FieldSecurity instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? ExceptValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? GrantValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSecurityDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(Elastic.Clients.Elasticsearch.Security.FieldSecurity instance) => new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) => descriptor.Instance; - public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? except) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? value) { - ExceptValue = except; - return Self; + Instance.Except = value; + return this; } - public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? grant) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Except(params System.Linq.Expressions.Expression>[] value) { - GrantValue = grant; - return Self; + Instance.Except = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? value) { - writer.WriteStartObject(); - if (ExceptValue is not null) - { - writer.WritePropertyName("except"); - JsonSerializer.Serialize(writer, ExceptValue, options); - } + Instance.Grant = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Grant(params System.Linq.Expressions.Expression>[] value) + { + Instance.Grant = value; + return this; + } - if (GrantValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.FieldSecurity Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("grant"); - JsonSerializer.Serialize(writer, GrantValue, options); + return new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class FieldSecurityDescriptor : SerializableDescriptor +public readonly partial struct FieldSecurityDescriptor { - internal FieldSecurityDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.FieldSecurity Instance { get; init; } - public FieldSecurityDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSecurityDescriptor(Elastic.Clients.Elasticsearch.Security.FieldSecurity instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Fields? ExceptValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields? GrantValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldSecurityDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(Elastic.Clients.Elasticsearch.Security.FieldSecurity instance) => new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) => descriptor.Instance; - public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? except) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? value) { - ExceptValue = except; - return Self; + Instance.Except = value; + return this; } - public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? grant) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Except(params System.Linq.Expressions.Expression>[] value) { - GrantValue = grant; - return Self; + Instance.Except = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? value) { - writer.WriteStartObject(); - if (ExceptValue is not null) - { - writer.WritePropertyName("except"); - JsonSerializer.Serialize(writer, ExceptValue, options); - } + Instance.Grant = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor Grant(params System.Linq.Expressions.Expression>[] value) + { + Instance.Grant = value; + return this; + } - if (GrantValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.FieldSecurity Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("grant"); - JsonSerializer.Serialize(writer, GrantValue, options); + return new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(new Elastic.Clients.Elasticsearch.Security.FieldSecurity(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs index d28bc0633ab..0f41eecbc24 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class FoundStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + + public override Elastic.Clients.Elasticsearch.Security.FoundStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFound = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.FoundStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Found = propFound.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.FoundStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.FoundStatusConverter))] public sealed partial class FoundStatus { - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FoundStatus(bool found) + { + Found = found; + } +#if NET7_0_OR_GREATER + public FoundStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FoundStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FoundStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs index aff8aa94906..8f74322a932 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class GetUserProfileErrorsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + + public override Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDetails = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Details = propDetails.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GetUserProfileErrorsConverter))] public sealed partial class GetUserProfileErrors { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyDictionary Details { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetUserProfileErrors(long count, System.Collections.Generic.IReadOnlyDictionary details) + { + Count = count; + Details = details; + } +#if NET7_0_OR_GREATER + public GetUserProfileErrors() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GetUserProfileErrors() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GetUserProfileErrors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Details { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs index 1b6be97614e..64f907bb683 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs @@ -17,77 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -public sealed partial class GlobalPrivilege +internal sealed partial class GlobalPrivilegeConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("application")] - public Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Application { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + + public override Elastic.Clients.Elasticsearch.Security.GlobalPrivilege Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApplication = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GlobalPrivilege(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GlobalPrivilege value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, null); + writer.WriteEndObject(); + } } -public sealed partial class GlobalPrivilegeDescriptor : SerializableDescriptor +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeConverter))] +public sealed partial class GlobalPrivilege { - internal GlobalPrivilegeDescriptor(Action configure) => configure.Invoke(this); - - public GlobalPrivilegeDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalPrivilege(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges application) { + Application = application; + } +#if NET7_0_OR_GREATER + public GlobalPrivilege() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GlobalPrivilege() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GlobalPrivilege(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; } - private Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges ApplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor ApplicationDescriptor { get; set; } - private Action ApplicationDescriptorAction { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Application { get; set; } +} + +public readonly partial struct GlobalPrivilegeDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.GlobalPrivilege Instance { get; init; } - public GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges application) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalPrivilegeDescriptor(Elastic.Clients.Elasticsearch.Security.GlobalPrivilege instance) { - ApplicationDescriptor = null; - ApplicationDescriptorAction = null; - ApplicationValue = application; - return Self; + Instance = instance; } - public GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor descriptor) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GlobalPrivilegeDescriptor() { - ApplicationValue = null; - ApplicationDescriptorAction = null; - ApplicationDescriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.GlobalPrivilege(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GlobalPrivilegeDescriptor Application(Action configure) + public static explicit operator Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(Elastic.Clients.Elasticsearch.Security.GlobalPrivilege instance) => new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GlobalPrivilege(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges value) { - ApplicationValue = null; - ApplicationDescriptor = null; - ApplicationDescriptorAction = configure; - return Self; + Instance.Application = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor Application(System.Action action) { - writer.WriteStartObject(); - if (ApplicationDescriptor is not null) - { - writer.WritePropertyName("application"); - JsonSerializer.Serialize(writer, ApplicationDescriptor, options); - } - else if (ApplicationDescriptorAction is not null) - { - writer.WritePropertyName("application"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor(ApplicationDescriptorAction), options); - } - else - { - writer.WritePropertyName("application"); - JsonSerializer.Serialize(writer, ApplicationValue, options); - } + Instance.Application = Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GlobalPrivilege Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(new Elastic.Clients.Elasticsearch.Security.GlobalPrivilege(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs index d88bfbbc6bf..736c908d450 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs @@ -17,24 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class GrantApiKeyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiration = System.Text.Json.JsonEncodedText.Encode("expiration"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptors = System.Text.Json.JsonEncodedText.Encode("role_descriptors"); + + public override Elastic.Clients.Elasticsearch.Security.GrantApiKey Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiration = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propName = default; + LocalJsonValue>?> propRoleDescriptors = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiration.TryReadProperty(ref reader, options, PropExpiration, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoleDescriptors.TryReadProperty(ref reader, options, PropRoleDescriptors, static System.Collections.Generic.ICollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue>(o, static System.Collections.Generic.IDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Expiration = propExpiration.Value, + Metadata = propMetadata.Value, + Name = propName.Value, + RoleDescriptors = propRoleDescriptors.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.GrantApiKey value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiration, value.Expiration, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoleDescriptors, value.RoleDescriptors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection>? v) => w.WriteSingleOrManyCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.GrantApiKeyConverter))] public sealed partial class GrantApiKey { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKey(Elastic.Clients.Elasticsearch.Name name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public GrantApiKey() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GrantApiKey() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Expiration time for the API key. By default, API keys never expire. /// /// - [JsonInclude, JsonPropertyName("expiration")] public string? Expiration { get; set; } /// @@ -44,10 +128,12 @@ public sealed partial class GrantApiKey /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } - [JsonInclude, JsonPropertyName("name")] - public Elastic.Clients.Elasticsearch.Name Name { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Name Name { get; set; } /// /// @@ -56,33 +142,50 @@ public sealed partial class GrantApiKey /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. /// /// - [JsonInclude, JsonPropertyName("role_descriptors")] - [SingleOrManyCollectionConverter(typeof(IReadOnlyDictionary))] - public ICollection>? RoleDescriptors { get; set; } + public System.Collections.Generic.ICollection>? RoleDescriptors { get; set; } } -public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor> +public readonly partial struct GrantApiKeyDescriptor { - internal GrantApiKeyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GrantApiKey Instance { get; init; } - public GrantApiKeyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKey instance) { + Instance = instance; } - private string? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private ICollection>? RoleDescriptorsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKey instance) => new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) => descriptor.Instance; /// /// /// Expiration time for the API key. By default, API keys never expire. /// /// - public GrantApiKeyDescriptor Expiration(string? expiration) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Expiration(string? value) + { + Instance.Expiration = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - ExpirationValue = expiration; - return Self; + Instance.Metadata = value; + return this; } /// @@ -92,16 +195,36 @@ public GrantApiKeyDescriptor Expiration(string? expiration) /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata() { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata(System.Action? action) { - NameValue = name; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name value) + { + Instance.Name = value; + return this; } /// @@ -111,61 +234,81 @@ public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. /// /// - public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(System.Collections.Generic.ICollection>? value) { - RoleDescriptorsValue = roleDescriptors; - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors for this API key. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(params System.Collections.Generic.IDictionary[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ExpirationValue)) - { - writer.WritePropertyName("expiration"); - writer.WriteStringValue(ExpirationValue); - } + Instance.RoleDescriptors = [.. values]; + return this; + } - if (MetadataValue is not null) + /// + /// + /// The role descriptors for this API key. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action)); } - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (RoleDescriptorsValue is not null) - { - writer.WritePropertyName("role_descriptors"); - SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); - } + Instance.RoleDescriptors = items; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GrantApiKey Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(new Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor +public readonly partial struct GrantApiKeyDescriptor { - internal GrantApiKeyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.GrantApiKey Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKey instance) + { + Instance = instance; + } - public GrantApiKeyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GrantApiKeyDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? ExpirationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } - private ICollection>? RoleDescriptorsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(Elastic.Clients.Elasticsearch.Security.GrantApiKey instance) => new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) => descriptor.Instance; /// /// /// Expiration time for the API key. By default, API keys never expire. /// /// - public GrantApiKeyDescriptor Expiration(string? expiration) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Expiration(string? value) { - ExpirationValue = expiration; - return Self; + Instance.Expiration = value; + return this; } /// @@ -175,16 +318,49 @@ public GrantApiKeyDescriptor Expiration(string? expiration) /// Within the metadata object, keys beginning with _ are reserved for system usage. /// /// - public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata(System.Collections.Generic.IDictionary? value) + { + Instance.Metadata = value; + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata() + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor AddMetadatum(string key, object value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } - public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name value) { - NameValue = name; - return Self; + Instance.Name = value; + return this; } /// @@ -194,35 +370,68 @@ public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name name) /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. /// /// - public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(System.Collections.Generic.ICollection>? value) { - RoleDescriptorsValue = roleDescriptors; - return Self; + Instance.RoleDescriptors = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The role descriptors for this API key. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(params System.Collections.Generic.IDictionary[] values) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ExpirationValue)) - { - writer.WritePropertyName("expiration"); - writer.WriteStringValue(ExpirationValue); - } + Instance.RoleDescriptors = [.. values]; + return this; + } - if (MetadataValue is not null) + /// + /// + /// The role descriptors for this API key. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(params System.Action?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action)); } - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - if (RoleDescriptorsValue is not null) + Instance.RoleDescriptors = items; + return this; + } + + /// + /// + /// The role descriptors for this API key. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor RoleDescriptors(params System.Action>?[] actions) + { + var items = new System.Collections.Generic.List>(); + foreach (var action in actions) { - writer.WritePropertyName("role_descriptors"); - SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); + items.Add(Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringRoleDescriptorx.Build(action)); } - writer.WriteEndObject(); + Instance.RoleDescriptors = items; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.GrantApiKey Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(new Elastic.Clients.Elasticsearch.Security.GrantApiKey(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs index 4c5b2db4bc6..80fa4daea18 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class HasPrivilegesUserProfileErrorsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + + public override Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propDetails = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Details = propDetails.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrorsConverter))] public sealed partial class HasPrivilegesUserProfileErrors { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("details")] - public IReadOnlyDictionary Details { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HasPrivilegesUserProfileErrors(long count, System.Collections.Generic.IReadOnlyDictionary details) + { + Count = count; + Details = details; + } +#if NET7_0_OR_GREATER + public HasPrivilegesUserProfileErrors() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HasPrivilegesUserProfileErrors() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HasPrivilegesUserProfileErrors(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Details { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs index c184dd519c1..1a0c6ff1265 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class HintConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropUids = System.Text.Json.JsonEncodedText.Encode("uids"); + + public override Elastic.Clients.Elasticsearch.Security.Hint Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propLabels = default; + LocalJsonValue?> propUids = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.IDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!))) + { + continue; + } + + if (propUids.TryReadProperty(ref reader, options, PropUids, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.Hint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Labels = propLabels.Value, + Uids = propUids.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.Hint value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + writer.WriteProperty(options, PropUids, value.Uids, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.HintConverter))] public sealed partial class Hint { +#if NET7_0_OR_GREATER + public Hint() + { + } +#endif +#if !NET7_0_OR_GREATER + public Hint() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Hint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A single key-value pair to match against the labels section @@ -36,28 +97,34 @@ public sealed partial class Hint /// at least one of the strings. /// /// - [JsonInclude, JsonPropertyName("labels")] - public IDictionary>>? Labels { get; set; } + public System.Collections.Generic.IDictionary>? Labels { get; set; } /// /// /// A list of profile UIDs to match against. /// /// - [JsonInclude, JsonPropertyName("uids")] - public ICollection? Uids { get; set; } + public System.Collections.Generic.ICollection? Uids { get; set; } } -public sealed partial class HintDescriptor : SerializableDescriptor +public readonly partial struct HintDescriptor { - internal HintDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.Hint Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HintDescriptor(Elastic.Clients.Elasticsearch.Security.Hint instance) + { + Instance = instance; + } - public HintDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HintDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.Hint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary>>? LabelsValue { get; set; } - private ICollection? UidsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.HintDescriptor(Elastic.Clients.Elasticsearch.Security.Hint instance) => new Elastic.Clients.Elasticsearch.Security.HintDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.Hint(Elastic.Clients.Elasticsearch.Security.HintDescriptor descriptor) => descriptor.Instance; /// /// @@ -66,10 +133,50 @@ public HintDescriptor() : base() /// at least one of the strings. /// /// - public HintDescriptor Labels(Func>>, FluentDictionary>>> selector) + public Elastic.Clients.Elasticsearch.Security.HintDescriptor Labels(System.Collections.Generic.IDictionary>? value) { - LabelsValue = selector?.Invoke(new FluentDictionary>>()); - return Self; + Instance.Labels = value; + return this; + } + + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HintDescriptor Labels() + { + Instance.Labels = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(null); + return this; + } + + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HintDescriptor Labels(System.Action? action) + { + Instance.Labels = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringCollectionOfString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HintDescriptor AddLabel(string key, System.Collections.Generic.ICollection value) + { + Instance.Labels ??= new System.Collections.Generic.Dictionary>(); + Instance.Labels.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.HintDescriptor AddLabel(string key, params string[] values) + { + Instance.Labels ??= new System.Collections.Generic.Dictionary>(); + Instance.Labels.Add(key, [.. values]); + return this; } /// @@ -77,27 +184,33 @@ public HintDescriptor Labels(Func /// - public HintDescriptor Uids(ICollection? uids) + public Elastic.Clients.Elasticsearch.Security.HintDescriptor Uids(System.Collections.Generic.ICollection? value) { - UidsValue = uids; - return Self; + Instance.Uids = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of profile UIDs to match against. + /// + /// + public Elastic.Clients.Elasticsearch.Security.HintDescriptor Uids(params string[] values) { - writer.WriteStartObject(); - if (LabelsValue is not null) - { - writer.WritePropertyName("labels"); - JsonSerializer.Serialize(writer, LabelsValue, options); - } + Instance.Uids = [.. values]; + return this; + } - if (UidsValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.Hint Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("uids"); - JsonSerializer.Serialize(writer, UidsValue, options); + return new Elastic.Clients.Elasticsearch.Security.Hint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.HintDescriptor(new Elastic.Clients.Elasticsearch.Security.Hint(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs index c5bcc5bb5bc..26d37cc0d4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs @@ -17,18 +17,95 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class IndexPrivilegesCheckConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + + public override Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue propNames = default; + LocalJsonValue> propPrivileges = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, null)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + Names = propNames.Value, + Privileges = propPrivileges.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, null); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckConverter))] public sealed partial class IndexPrivilegesCheck { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Indices names, System.Collections.Generic.ICollection privileges) + { + Names = names; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public IndexPrivilegesCheck() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexPrivilegesCheck() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. @@ -36,7 +113,6 @@ public sealed partial class IndexPrivilegesCheck /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] public bool? AllowRestrictedIndices { get; set; } /// @@ -44,29 +120,42 @@ public sealed partial class IndexPrivilegesCheck /// A list of indices. /// /// - [JsonInclude, JsonPropertyName("names")] - public Elastic.Clients.Elasticsearch.Indices Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Names { get; set; } /// /// /// A list of the privileges that you want to check for the specified indices. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } } -public sealed partial class IndexPrivilegesCheckDescriptor : SerializableDescriptor +public readonly partial struct IndexPrivilegesCheckDescriptor { - internal IndexPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexPrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck instance) + { + Instance = instance; + } - public IndexPrivilegesCheckDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexPrivilegesCheckDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices NamesValue { get; set; } - private ICollection PrivilegesValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck instance) => new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor descriptor) => descriptor.Instance; /// /// @@ -75,10 +164,10 @@ public IndexPrivilegesCheckDescriptor() : base() /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. /// /// - public IndexPrivilegesCheckDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -86,10 +175,10 @@ public IndexPrivilegesCheckDescriptor AllowRestrictedIndices(bool? allowRestrict /// A list of indices. /// /// - public IndexPrivilegesCheckDescriptor Names(Elastic.Clients.Elasticsearch.Indices names) + public Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor Names(Elastic.Clients.Elasticsearch.Indices value) { - NamesValue = names; - return Self; + Instance.Names = value; + return this; } /// @@ -97,25 +186,28 @@ public IndexPrivilegesCheckDescriptor Names(Elastic.Clients.Elasticsearch.Indice /// A list of the privileges that you want to check for the specified indices. /// /// - public IndexPrivilegesCheckDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor Privileges(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Privileges = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of the privileges that you want to check for the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.IndexPrivilege[] values) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } + Instance.Privileges = [.. values]; + return this; + } - writer.WritePropertyName("names"); - JsonSerializer.Serialize(writer, NamesValue, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs index 3be8e4dec8a..9cf65ee4b44 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs @@ -17,24 +17,118 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class IndicesPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSecurity = System.Text.Json.JsonEncodedText.Encode("field_security"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Security.IndicesPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue propFieldSecurity = default; + LocalJsonValue> propNames = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propFieldSecurity.TryReadProperty(ref reader, options, PropFieldSecurity, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + FieldSecurity = propFieldSecurity.Value, + Names = propNames.Value, + Privileges = propPrivileges.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.IndicesPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropFieldSecurity, value.FieldSecurity, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesConverter))] public sealed partial class IndicesPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesPrivileges(System.Collections.Generic.ICollection names, System.Collections.Generic.ICollection privileges) + { + Names = names; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public IndicesPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndicesPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] public bool? AllowRestrictedIndices { get; set; } /// @@ -42,7 +136,6 @@ public sealed partial class IndicesPrivileges /// The document fields that the owners of the role have read access to. /// /// - [JsonInclude, JsonPropertyName("field_security")] public Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurity { get; set; } /// @@ -50,52 +143,59 @@ public sealed partial class IndicesPrivileges /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexName))] - public ICollection Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } /// /// /// The index level privileges that owners of the role have on the specified indices. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } /// /// /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. /// /// - [JsonInclude, JsonPropertyName("query")] public object? Query { get; set; } } -public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor> +public readonly partial struct IndicesPrivilegesDescriptor { - internal IndicesPrivilegesDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.IndicesPrivileges Instance { get; init; } - public IndicesPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.IndicesPrivileges instance) { + Instance = instance; } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action> FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private object? QueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesPrivilegesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.IndicesPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -103,28 +203,32 @@ public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allow /// The document fields that the owners of the role have read access to. /// /// - public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public IndicesPrivilegesDescriptor FieldSecurity(Action> configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity(System.Action>? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// @@ -132,98 +236,93 @@ public IndicesPrivilegesDescriptor FieldSecurity(Action /// - public IndicesPrivilegesDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Names(System.Collections.Generic.ICollection value) { - NamesValue = names; - return Self; + Instance.Names = value; + return this; } /// /// - /// The index level privileges that owners of the role have on the specified indices. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - PrivilegesValue = privileges; - return Self; + Instance.Names = [.. values]; + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// The index level privileges that owners of the role have on the specified indices. /// /// - public IndicesPrivilegesDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - QueryValue = query; - return Self; + Instance.Privileges = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.IndexPrivilege[] values) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } - - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } + Instance.Privileges = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Query(object? value) + { + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.IndicesPrivileges Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor +public readonly partial struct IndicesPrivilegesDescriptor { - internal IndicesPrivilegesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.IndicesPrivileges Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.IndicesPrivileges instance) + { + Instance = instance; + } - public IndicesPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndicesPrivilegesDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private object? QueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.IndicesPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -231,98 +330,105 @@ public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedI /// The document fields that the owners of the role have read access to. /// /// - public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public IndicesPrivilegesDescriptor FieldSecurity(Action configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity(System.Action? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// The document fields that the owners of the role have read access to. /// /// - public IndicesPrivilegesDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor FieldSecurity(System.Action>? action) { - NamesValue = names; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// The index level privileges that owners of the role have on the specified indices. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Names(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Names = value; + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public IndicesPrivilegesDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - QueryValue = query; - return Self; + Instance.Names = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } + Instance.Privileges = value; + return this; + } - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.IndexPrivilege[] values) + { + Instance.Privileges = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor Query(object? value) + { + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.IndicesPrivileges Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.IndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs index 4949c3a2107..c77defe9da9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class KibanaTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Security.KibanaToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.KibanaToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.KibanaToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.KibanaTokenConverter))] public sealed partial class KibanaToken { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public KibanaToken(string name, string value) + { + Name = name; + Value = value; + } +#if NET7_0_OR_GREATER + public KibanaToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public KibanaToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal KibanaToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the bearer token for the elastic/kibana service account. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// @@ -43,6 +114,9 @@ public sealed partial class KibanaToken /// Use this value to authenticate the service account with Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("value")] - public string Value { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs index d0afcceeb18..7320ca241f2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs @@ -17,43 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ManageUserPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + + public override Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propApplications = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesConverter))] public sealed partial class ManageUserPrivileges { - [JsonInclude, JsonPropertyName("applications")] - public ICollection Applications { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ManageUserPrivileges(System.Collections.Generic.ICollection applications) + { + Applications = applications; + } +#if NET7_0_OR_GREATER + public ManageUserPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ManageUserPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ManageUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Applications { get; set; } } -public sealed partial class ManageUserPrivilegesDescriptor : SerializableDescriptor +public readonly partial struct ManageUserPrivilegesDescriptor { - internal ManageUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Instance { get; init; } - public ManageUserPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ManageUserPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges instance) { + Instance = instance; } - private ICollection ApplicationsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ManageUserPrivilegesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public ManageUserPrivilegesDescriptor Applications(ICollection applications) + public static explicit operator Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges(Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor Applications(System.Collections.Generic.ICollection value) { - ApplicationsValue = applications; - return Self; + Instance.Applications = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor Applications(params string[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, ApplicationsValue, options); - writer.WriteEndObject(); + Instance.Applications = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs index dd98a78661c..a164f7a1fc0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class NodesCredentialsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFileTokens = System.Text.Json.JsonEncodedText.Encode("file_tokens"); + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("_nodes"); + + public override Elastic.Clients.Elasticsearch.Security.NodesCredentials Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propFileTokens = default; + LocalJsonValue propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFileTokens.TryReadProperty(ref reader, options, PropFileTokens, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodes.TryReadProperty(ref reader, options, PropNodes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.NodesCredentials(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FileTokens = propFileTokens.Value, + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.NodesCredentials value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFileTokens, value.FileTokens, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodes, value.Nodes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.NodesCredentialsConverter))] public sealed partial class NodesCredentials { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesCredentials(System.Collections.Generic.IReadOnlyDictionary fileTokens, Elastic.Clients.Elasticsearch.NodeStatistics nodes) + { + FileTokens = fileTokens; + Nodes = nodes; + } +#if NET7_0_OR_GREATER + public NodesCredentials() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodesCredentials() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesCredentials(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// File-backed tokens collected from all nodes /// /// - [JsonInclude, JsonPropertyName("file_tokens")] - public IReadOnlyDictionary FileTokens { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary FileTokens { get; set; } /// /// /// General status showing how nodes respond to the above collection request /// /// - [JsonInclude, JsonPropertyName("_nodes")] - public Elastic.Clients.Elasticsearch.NodeStatistics Nodes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.NodeStatistics Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs index ad835da4388..6eab7703bd0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class NodesCredentialsFileTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodes = System.Text.Json.JsonEncodedText.Encode("nodes"); + + public override Elastic.Clients.Elasticsearch.Security.NodesCredentialsFileToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propNodes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodes.TryReadProperty(ref reader, options, PropNodes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.NodesCredentialsFileToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Nodes = propNodes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.NodesCredentialsFileToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodes, value.Nodes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.NodesCredentialsFileTokenConverter))] public sealed partial class NodesCredentialsFileToken { - [JsonInclude, JsonPropertyName("nodes")] - public IReadOnlyCollection Nodes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodesCredentialsFileToken(System.Collections.Generic.IReadOnlyCollection nodes) + { + Nodes = nodes; + } +#if NET7_0_OR_GREATER + public NodesCredentialsFileToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodesCredentialsFileToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodesCredentialsFileToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Nodes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs index d7c1368bee0..477bd09a043 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs @@ -17,88 +17,186 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class PrivilegeActionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Security.PrivilegeActions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propActions = default; + LocalJsonValue propApplication = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propApplication.TryReadProperty(ref reader, options, PropApplication, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PrivilegeActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + Application = propApplication.Value, + Metadata = propMetadata.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PrivilegeActions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropApplication, value.Application, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PrivilegeActionsConverter))] public sealed partial class PrivilegeActions { - [JsonInclude, JsonPropertyName("actions")] - public ICollection Actions { get; set; } - [JsonInclude, JsonPropertyName("application")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrivilegeActions(System.Collections.Generic.ICollection actions) + { + Actions = actions; + } +#if NET7_0_OR_GREATER + public PrivilegeActions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public PrivilegeActions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PrivilegeActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Actions { get; set; } public string? Application { get; set; } - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } - [JsonInclude, JsonPropertyName("name")] + public System.Collections.Generic.IDictionary? Metadata { get; set; } public Elastic.Clients.Elasticsearch.Name? Name { get; set; } } -public sealed partial class PrivilegeActionsDescriptor : SerializableDescriptor +public readonly partial struct PrivilegeActionsDescriptor { - internal PrivilegeActionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PrivilegeActions Instance { get; init; } - public PrivilegeActionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrivilegeActionsDescriptor(Elastic.Clients.Elasticsearch.Security.PrivilegeActions instance) { + Instance = instance; } - private ICollection ActionsValue { get; set; } - private string? ApplicationValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrivilegeActionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.PrivilegeActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public PrivilegeActionsDescriptor Actions(ICollection actions) + public static explicit operator Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor(Elastic.Clients.Elasticsearch.Security.PrivilegeActions instance) => new Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PrivilegeActions(Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Actions(System.Collections.Generic.ICollection value) { - ActionsValue = actions; - return Self; + Instance.Actions = value; + return this; } - public PrivilegeActionsDescriptor Application(string? application) + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Actions(params string[] values) { - ApplicationValue = application; - return Self; + Instance.Actions = [.. values]; + return this; } - public PrivilegeActionsDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Application(string? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Application = value; + return this; } - public PrivilegeActionsDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - NameValue = name; - return Self; + Instance.Metadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Metadata() { - writer.WriteStartObject(); - writer.WritePropertyName("actions"); - JsonSerializer.Serialize(writer, ActionsValue, options); - if (!string.IsNullOrEmpty(ApplicationValue)) - { - writer.WritePropertyName("application"); - writer.WriteStringValue(ApplicationValue); - } + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (NameValue is not null) - { - writer.WritePropertyName("name"); - JsonSerializer.Serialize(writer, NameValue, options); - } + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor Name(Elastic.Clients.Elasticsearch.Name? value) + { + Instance.Name = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PrivilegeActions Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.PrivilegeActionsDescriptor(new Elastic.Clients.Elasticsearch.Security.PrivilegeActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs index d4fb8f4856a..e9231390de1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs @@ -17,84 +17,140 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class PrivilegesCheckConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplication = System.Text.Json.JsonEncodedText.Encode("application"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplication = default; + LocalJsonValue?> propCluster = default; + LocalJsonValue?> propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplication.TryReadProperty(ref reader, options, PropApplication, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.PrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Application = propApplication.Value, + Cluster = propCluster.Value, + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.PrivilegesCheck value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplication, value.Application, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndex, value.Index, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.PrivilegesCheckConverter))] public sealed partial class PrivilegesCheck { - [JsonInclude, JsonPropertyName("application")] - public ICollection? Application { get; set; } +#if NET7_0_OR_GREATER + public PrivilegesCheck() + { + } +#endif +#if !NET7_0_OR_GREATER + public PrivilegesCheck() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? Application { get; set; } /// /// /// A list of the cluster privileges that you want to check. /// /// - [JsonInclude, JsonPropertyName("cluster")] - public ICollection? Cluster { get; set; } - [JsonInclude, JsonPropertyName("index")] - public ICollection? Index { get; set; } + public System.Collections.Generic.ICollection? Cluster { get; set; } + public System.Collections.Generic.ICollection? Index { get; set; } } -public sealed partial class PrivilegesCheckDescriptor : SerializableDescriptor +public readonly partial struct PrivilegesCheckDescriptor { - internal PrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Instance { get; init; } - public PrivilegesCheckDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck instance) { + Instance = instance; } - private ICollection? ApplicationValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } - private Action ApplicationDescriptorAction { get; set; } - private Action[] ApplicationDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private ICollection? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } - private Action IndexDescriptorAction { get; set; } - private Action[] IndexDescriptorActions { get; set; } - - public PrivilegesCheckDescriptor Application(ICollection? application) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PrivilegesCheckDescriptor() { - ApplicationDescriptor = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = null; - ApplicationValue = application; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.PrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PrivilegesCheckDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck instance) => new Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.PrivilegesCheck(Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Application(System.Collections.Generic.ICollection? value) { - ApplicationValue = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = null; - ApplicationDescriptor = descriptor; - return Self; + Instance.Application = value; + return this; } - public PrivilegesCheckDescriptor Application(Action configure) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Application(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheck[] values) { - ApplicationValue = null; - ApplicationDescriptor = null; - ApplicationDescriptorActions = null; - ApplicationDescriptorAction = configure; - return Self; + Instance.Application = [.. values]; + return this; } - public PrivilegesCheckDescriptor Application(params Action[] configure) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Application(params System.Action[] actions) { - ApplicationValue = null; - ApplicationDescriptor = null; - ApplicationDescriptorAction = null; - ApplicationDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor.Build(action)); + } + + Instance.Application = items; + return this; } /// @@ -102,119 +158,57 @@ public PrivilegesCheckDescriptor Application(params Action /// - public PrivilegesCheckDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ClusterValue = cluster; - return Self; + Instance.Cluster = value; + return this; } - public PrivilegesCheckDescriptor Index(ICollection? index) - { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexDescriptorActions = null; - IndexValue = index; - return Self; - } - - public PrivilegesCheckDescriptor Index(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor descriptor) + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptorActions = null; - IndexDescriptor = descriptor; - return Self; + Instance.Cluster = [.. values]; + return this; } - public PrivilegesCheckDescriptor Index(Action configure) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Index(System.Collections.Generic.ICollection? value) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorActions = null; - IndexDescriptorAction = configure; - return Self; + Instance.Index = value; + return this; } - public PrivilegesCheckDescriptor Index(params Action[] configure) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Index(params Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheck[] values) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexDescriptorActions = configure; - return Self; + Instance.Index = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor Index(params System.Action[] actions) { - writer.WriteStartObject(); - if (ApplicationDescriptor is not null) - { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationDescriptorAction is not null) - { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ApplicationDescriptorActions is not null) - { - writer.WritePropertyName("application"); - writer.WriteStartArray(); - foreach (var action in ApplicationDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ApplicationValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("application"); - JsonSerializer.Serialize(writer, ApplicationValue, options); + items.Add(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor.Build(action)); } - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } - - if (IndexDescriptor is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - writer.WriteEndArray(); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndexDescriptorActions is not null) - { - writer.WritePropertyName("index"); - writer.WriteStartArray(); - foreach (var action in IndexDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(action), options); - } + Instance.Index = items; + return this; + } - writer.WriteEndArray(); - } - else if (IndexValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.Security.PrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor(new Elastic.Clients.Elasticsearch.Security.PrivilegesCheck(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryRole.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryRole.g.cs index cbec368b368..d516d504c2b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryRole.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryRole.g.cs @@ -17,180 +17,237 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -internal sealed partial class QueryRoleConverter : JsonConverter +internal sealed partial class QueryRoleConverter : System.Text.Json.Serialization.JsonConverter { - public override QueryRole Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRestriction = System.Text.Json.JsonEncodedText.Encode("restriction"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("_sort"); + private static readonly System.Text.Json.JsonEncodedText PropTransientMetadata = System.Text.Json.JsonEncodedText.Encode("transient_metadata"); + + public override Elastic.Clients.Elasticsearch.Security.QueryRole Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyCollection? applications = default; - IReadOnlyCollection? cluster = default; - string? description = default; - IReadOnlyCollection? global = default; - IReadOnlyCollection? indices = default; - IReadOnlyDictionary? metadata = default; - string name = default; - IReadOnlyCollection? remoteCluster = default; - IReadOnlyCollection? remoteIndices = default; - Elastic.Clients.Elasticsearch.Security.Restriction? restriction = default; - IReadOnlyCollection? runAs = default; - IReadOnlyCollection? sort = default; - IReadOnlyDictionary? transientMetadata = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplications = default; + LocalJsonValue?> propCluster = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGlobal = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propName = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue propRestriction = default; + LocalJsonValue?> propRunAs = default; + LocalJsonValue?> propSort = default; + LocalJsonValue?> propTransientMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)) || propIndices.TryReadProperty(ref reader, options, PropIndices1, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { - var property = reader.GetString(); - if (property == "applications") - { - applications = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "cluster") - { - cluster = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "description") - { - description = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "global") - { - global = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "indices" || property == "index") - { - indices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "metadata") - { - metadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "name") - { - name = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "remote_cluster") - { - remoteCluster = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "remote_indices") - { - remoteIndices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "restriction") - { - restriction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "run_as") - { - runAs = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "_sort") - { - sort = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "transient_metadata") - { - transientMetadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; } + + if (propRestriction.TryReadProperty(ref reader, options, PropRestriction, null)) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTransientMetadata.TryReadProperty(ref reader, options, PropTransientMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return new QueryRole { Applications = applications, Cluster = cluster, Description = description, Global = global, Indices = indices, Metadata = metadata, Name = name, RemoteCluster = remoteCluster, RemoteIndices = remoteIndices, Restriction = restriction, RunAs = runAs, Sort = sort, TransientMetadata = transientMetadata }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryRole(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value, + Cluster = propCluster.Value, + Description = propDescription.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + Name = propName.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + Restriction = propRestriction.Value, + RunAs = propRunAs.Value, + Sort = propSort.Value, + TransientMetadata = propTransientMetadata.Value + }; } - public override void Write(Utf8JsonWriter writer, QueryRole value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryRole value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'QueryRole' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRestriction, value.Restriction, null, null); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransientMetadata, value.TransientMetadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); } } -[JsonConverter(typeof(QueryRoleConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryRoleConverter))] public sealed partial class QueryRole { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryRole(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public QueryRole() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryRole() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryRole(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of application privilege entries /// /// - public IReadOnlyCollection? Applications { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Applications { get; set; } /// /// /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. /// /// - public IReadOnlyCollection? Cluster { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Cluster { get; set; } /// /// /// Optional description of the role descriptor /// /// - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public IReadOnlyCollection? Global { get; init; } + public System.Collections.Generic.ICollection? Global { get; set; } /// /// /// A list of indices permissions entries. /// /// - public IReadOnlyCollection? Indices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Indices { get; set; } /// /// /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. /// /// - public IReadOnlyDictionary? Metadata { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } /// /// /// Name of the role. /// /// - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// @@ -198,21 +255,21 @@ public sealed partial class QueryRole /// NOTE: This is limited a subset of the cluster permissions. /// /// - public IReadOnlyCollection? RemoteCluster { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RemoteCluster { get; set; } /// /// /// A list of indices permissions for remote clusters. /// /// - public IReadOnlyCollection? RemoteIndices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RemoteIndices { get; set; } /// /// /// Restriction for when the role descriptor is allowed to be effective. /// /// - public Elastic.Clients.Elasticsearch.Security.Restriction? Restriction { get; init; } + public Elastic.Clients.Elasticsearch.Security.Restriction? Restriction { get; set; } /// /// @@ -221,7 +278,7 @@ public sealed partial class QueryRole /// For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. /// /// - public IReadOnlyCollection? RunAs { get; init; } - public IReadOnlyCollection? Sort { get; init; } - public IReadOnlyDictionary? TransientMetadata { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RunAs { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Sort { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? TransientMetadata { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs index c3842d55b4a..51ccd7ed9cd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs @@ -17,32 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class QueryUserConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropProfileUid = System.Text.Json.JsonEncodedText.Encode("profile_uid"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("_sort"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.QueryUser Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue propProfileUid = default; + LocalJsonValue> propRoles = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propProfileUid.TryReadProperty(ref reader, options, PropProfileUid, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.QueryUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + Metadata = propMetadata.Value, + ProfileUid = propProfileUid.Value, + Roles = propRoles.Value, + Sort = propSort.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.QueryUser value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProfileUid, value.ProfileUid, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.QueryUserConverter))] public sealed partial class QueryUser { - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("profile_uid")] - public string? ProfileUid { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("_sort")] - public IReadOnlyCollection? Sort { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public QueryUser(bool enabled, System.Collections.Generic.IReadOnlyDictionary metadata, System.Collections.Generic.IReadOnlyCollection roles, string username) + { + Enabled = enabled; + Metadata = metadata; + Roles = roles; + Username = username; + } +#if NET7_0_OR_GREATER + public QueryUser() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public QueryUser() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal QueryUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Email { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public string? FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public string? ProfileUid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Sort { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs index e370a03ab76..0e82871f4dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RealmInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.RealmInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RealmInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RealmInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RealmInfoConverter))] public sealed partial class RealmInfo { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RealmInfo(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public RealmInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RealmInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RealmInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteClusterPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteClusterPrivileges.g.cs index 0cdfc809bc0..2d4c502d1b6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteClusterPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteClusterPrivileges.g.cs @@ -17,38 +17,112 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RemoteClusterPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("clusters"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + + public override Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClusters = default; + LocalJsonValue> propPrivileges = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Clusters = propClusters.Value, + Privileges = propPrivileges.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + /// /// /// The subset of cluster level privileges that can be defined for remote clusters. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesConverter))] public sealed partial class RemoteClusterPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Names clusters, System.Collections.Generic.ICollection privileges) + { + Clusters = clusters; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public RemoteClusterPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RemoteClusterPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of cluster aliases to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("clusters")] - public Elastic.Clients.Elasticsearch.Names Clusters { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Clusters { get; set; } /// /// /// The cluster level privileges that owners of the role have on the remote cluster. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } } /// @@ -56,26 +130,34 @@ public sealed partial class RemoteClusterPrivileges /// The subset of cluster level privileges that can be defined for remote clusters. /// /// -public sealed partial class RemoteClusterPrivilegesDescriptor : SerializableDescriptor +public readonly partial struct RemoteClusterPrivilegesDescriptor { - internal RemoteClusterPrivilegesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges Instance { get; init; } - public RemoteClusterPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteClusterPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Names ClustersValue { get; set; } - private ICollection PrivilegesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteClusterPrivilegesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// A list of cluster aliases to which the permissions in this entry apply. /// /// - public RemoteClusterPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names clusters) + public Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names value) { - ClustersValue = clusters; - return Self; + Instance.Clusters = value; + return this; } /// @@ -83,19 +165,28 @@ public RemoteClusterPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch. /// The cluster level privileges that owners of the role have on the remote cluster. /// /// - public RemoteClusterPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Privileges = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The cluster level privileges that owners of the role have on the remote cluster. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilege[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("clusters"); - JsonSerializer.Serialize(writer, ClustersValue, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - writer.WriteEndObject(); + Instance.Privileges = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteIndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteIndicesPrivileges.g.cs index 61c9a3199b2..5fb8b33d475 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteIndicesPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteIndicesPrivileges.g.cs @@ -17,29 +17,133 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RemoteIndicesPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSecurity = System.Text.Json.JsonEncodedText.Encode("field_security"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue propClusters = default; + LocalJsonValue propFieldSecurity = default; + LocalJsonValue> propNames = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, null)) + { + continue; + } + + if (propFieldSecurity.TryReadProperty(ref reader, options, PropFieldSecurity, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + Clusters = propClusters.Value, + FieldSecurity = propFieldSecurity.Value, + Names = propNames.Value, + Privileges = propPrivileges.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, null); + writer.WriteProperty(options, PropFieldSecurity, value.FieldSecurity, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + /// /// /// The subset of index level privileges that can be defined for remote clusters. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesConverter))] public sealed partial class RemoteIndicesPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Names clusters, System.Collections.Generic.ICollection names, System.Collections.Generic.ICollection privileges) + { + Clusters = clusters; + Names = names; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public RemoteIndicesPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RemoteIndicesPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] public bool? AllowRestrictedIndices { get; set; } /// @@ -47,15 +151,17 @@ public sealed partial class RemoteIndicesPrivileges /// A list of cluster aliases to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("clusters")] - public Elastic.Clients.Elasticsearch.Names Clusters { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Names Clusters { get; set; } /// /// /// The document fields that the owners of the role have read access to. /// /// - [JsonInclude, JsonPropertyName("field_security")] public Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurity { get; set; } /// @@ -63,24 +169,28 @@ public sealed partial class RemoteIndicesPrivileges /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexName))] - public ICollection Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } /// /// /// The index level privileges that owners of the role have on the specified indices. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public ICollection Privileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Privileges { get; set; } /// /// /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. /// /// - [JsonInclude, JsonPropertyName("query")] public object? Query { get; set; } } @@ -89,32 +199,34 @@ public sealed partial class RemoteIndicesPrivileges /// The subset of index level privileges that can be defined for remote clusters. /// /// -public sealed partial class RemoteIndicesPrivilegesDescriptor : SerializableDescriptor> +public readonly partial struct RemoteIndicesPrivilegesDescriptor { - internal RemoteIndicesPrivilegesDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteIndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges instance) + { + Instance = instance; + } - public RemoteIndicesPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteIndicesPrivilegesDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Names ClustersValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action> FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private object? QueryValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -122,10 +234,10 @@ public RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? /// A list of cluster aliases to which the permissions in this entry apply. /// /// - public RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names clusters) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names value) { - ClustersValue = clusters; - return Self; + Instance.Clusters = value; + return this; } /// @@ -133,28 +245,32 @@ public RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Ela /// The document fields that the owners of the role have read access to. /// /// - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Action> configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity(System.Action>? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// @@ -162,72 +278,62 @@ public RemoteIndicesPrivilegesDescriptor FieldSecurity(Action /// - public RemoteIndicesPrivilegesDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Names(System.Collections.Generic.ICollection value) { - NamesValue = names; - return Self; + Instance.Names = value; + return this; } /// /// - /// The index level privileges that owners of the role have on the specified indices. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public RemoteIndicesPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - PrivilegesValue = privileges; - return Self; + Instance.Names = [.. values]; + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// The index level privileges that owners of the role have on the specified indices. /// /// - public RemoteIndicesPrivilegesDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - QueryValue = query; - return Self; + Instance.Privileges = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.IndexPrivilege[] values) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } - - writer.WritePropertyName("clusters"); - JsonSerializer.Serialize(writer, ClustersValue, options); - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } + Instance.Privileges = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Query(object? value) + { + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } @@ -236,32 +342,34 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o /// The subset of index level privileges that can be defined for remote clusters. /// /// -public sealed partial class RemoteIndicesPrivilegesDescriptor : SerializableDescriptor +public readonly partial struct RemoteIndicesPrivilegesDescriptor { - internal RemoteIndicesPrivilegesDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges Instance { get; init; } - public RemoteIndicesPrivilegesDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteIndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges instance) { + Instance = instance; } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Names ClustersValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private ICollection PrivilegesValue { get; set; } - private object? QueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteIndicesPrivilegesDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges instance) => new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -269,10 +377,10 @@ public RemoteIndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestr /// A list of cluster aliases to which the permissions in this entry apply. /// /// - public RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names clusters) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch.Names value) { - ClustersValue = clusters; - return Self; + Instance.Clusters = value; + return this; } /// @@ -280,100 +388,105 @@ public RemoteIndicesPrivilegesDescriptor Clusters(Elastic.Clients.Elasticsearch. /// The document fields that the owners of the role have read access to. /// /// - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public RemoteIndicesPrivilegesDescriptor FieldSecurity(Action configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity(System.Action? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// The document fields that the owners of the role have read access to. /// /// - public RemoteIndicesPrivilegesDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor FieldSecurity(System.Action>? action) { - NamesValue = names; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// The index level privileges that owners of the role have on the specified indices. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public RemoteIndicesPrivilegesDescriptor Privileges(ICollection privileges) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Names(System.Collections.Generic.ICollection value) { - PrivilegesValue = privileges; - return Self; + Instance.Names = value; + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public RemoteIndicesPrivilegesDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - QueryValue = query; - return Self; + Instance.Names = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Privileges(System.Collections.Generic.ICollection value) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } + Instance.Privileges = value; + return this; + } - writer.WritePropertyName("clusters"); - JsonSerializer.Serialize(writer, ClustersValue, options); - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Privileges(params Elastic.Clients.Elasticsearch.Security.IndexPrivilege[] values) + { + Instance.Privileges = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - writer.WritePropertyName("privileges"); - JsonSerializer.Serialize(writer, PrivilegesValue, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor Query(object? value) + { + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteUserIndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteUserIndicesPrivileges.g.cs index 1b0ea2f3c79..e1dd286a9d6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteUserIndicesPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RemoteUserIndicesPrivileges.g.cs @@ -17,58 +17,173 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RemoteUserIndicesPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropClusters = System.Text.Json.JsonEncodedText.Encode("clusters"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSecurity = System.Text.Json.JsonEncodedText.Encode("field_security"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Security.RemoteUserIndicesPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue> propClusters = default; + LocalJsonValue?> propFieldSecurity = default; + LocalJsonValue> propNames = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propClusters.TryReadProperty(ref reader, options, PropClusters, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propFieldSecurity.TryReadProperty(ref reader, options, PropFieldSecurity, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RemoteUserIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + Clusters = propClusters.Value, + FieldSecurity = propFieldSecurity.Value, + Names = propNames.Value, + Privileges = propPrivileges.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RemoteUserIndicesPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropClusters, value.Clusters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFieldSecurity, value.FieldSecurity, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RemoteUserIndicesPrivilegesConverter))] public sealed partial class RemoteUserIndicesPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoteUserIndicesPrivileges(bool allowRestrictedIndices, System.Collections.Generic.IReadOnlyCollection clusters, System.Collections.Generic.ICollection names, System.Collections.Generic.IReadOnlyCollection privileges) + { + AllowRestrictedIndices = allowRestrictedIndices; + Clusters = clusters; + Names = names; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public RemoteUserIndicesPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RemoteUserIndicesPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RemoteUserIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] - public bool AllowRestrictedIndices { get; init; } - [JsonInclude, JsonPropertyName("clusters")] - public IReadOnlyCollection Clusters { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowRestrictedIndices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Clusters { get; set; } /// /// /// The document fields that the owners of the role have read access to. /// /// - [JsonInclude, JsonPropertyName("field_security")] - public IReadOnlyCollection? FieldSecurity { get; init; } + public System.Collections.Generic.IReadOnlyCollection? FieldSecurity { get; set; } /// /// /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Names { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } /// /// /// The index level privileges that owners of the role have on the specified indices. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public IReadOnlyCollection Privileges { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Privileges { get; set; } /// /// /// Search queries that define the documents the user has access to. A document within the specified indices must match these queries for it to be accessible by the owners of the role. /// /// - [JsonInclude, JsonPropertyName("query")] - public object? Query { get; init; } + public object? Query { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ReplicationAccess.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ReplicationAccess.g.cs index 6a19a68c4ce..27b21e26992 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ReplicationAccess.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ReplicationAccess.g.cs @@ -17,24 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ReplicationAccessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + + public override Elastic.Clients.Elasticsearch.Security.ReplicationAccess Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue> propNames = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ReplicationAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + Names = propNames.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ReplicationAccess value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ReplicationAccessConverter))] public sealed partial class ReplicationAccess { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReplicationAccess(System.Collections.Generic.ICollection names) + { + Names = names; + } +#if NET7_0_OR_GREATER + public ReplicationAccess() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReplicationAccess() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReplicationAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// This needs to be set to true if the patterns in the names field should cover system indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] public bool? AllowRestrictedIndices { get; set; } /// @@ -42,31 +108,41 @@ public sealed partial class ReplicationAccess /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexName))] - public ICollection Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } } -public sealed partial class ReplicationAccessDescriptor : SerializableDescriptor +public readonly partial struct ReplicationAccessDescriptor { - internal ReplicationAccessDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.ReplicationAccess Instance { get; init; } - public ReplicationAccessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReplicationAccessDescriptor(Elastic.Clients.Elasticsearch.Security.ReplicationAccess instance) { + Instance = instance; } - private bool? AllowRestrictedIndicesValue { get; set; } - private ICollection NamesValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReplicationAccessDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.ReplicationAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(Elastic.Clients.Elasticsearch.Security.ReplicationAccess instance) => new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ReplicationAccess(Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor descriptor) => descriptor.Instance; /// /// /// This needs to be set to true if the patterns in the names field should cover system indices. /// /// - public ReplicationAccessDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -74,23 +150,28 @@ public ReplicationAccessDescriptor AllowRestrictedIndices(bool? allowRestrictedI /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public ReplicationAccessDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor Names(System.Collections.Generic.ICollection value) { - NamesValue = names; - return Self; + Instance.Names = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } + Instance.Names = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.ReplicationAccess Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.ReplicationAccessDescriptor(new Elastic.Clients.Elasticsearch.Security.ReplicationAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Restriction.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Restriction.g.cs index bedf71ce381..2196d55500b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Restriction.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Restriction.g.cs @@ -17,37 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RestrictionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropWorkflows = System.Text.Json.JsonEncodedText.Encode("workflows"); + + public override Elastic.Clients.Elasticsearch.Security.Restriction Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propWorkflows = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propWorkflows.TryReadProperty(ref reader, options, PropWorkflows, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.Restriction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Workflows = propWorkflows.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.Restriction value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropWorkflows, value.Workflows, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RestrictionConverter))] public sealed partial class Restriction { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Restriction(System.Collections.Generic.ICollection workflows) + { + Workflows = workflows; + } +#if NET7_0_OR_GREATER + public Restriction() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Restriction() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Restriction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of workflows to which the API key is restricted. /// NOTE: In order to use a role restriction, an API key must be created with a single role descriptor. /// /// - [JsonInclude, JsonPropertyName("workflows")] - public ICollection Workflows { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Workflows { get; set; } } -public sealed partial class RestrictionDescriptor : SerializableDescriptor +public readonly partial struct RestrictionDescriptor { - internal RestrictionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.Restriction Instance { get; init; } - public RestrictionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RestrictionDescriptor(Elastic.Clients.Elasticsearch.Security.Restriction instance) { + Instance = instance; } - private ICollection WorkflowsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RestrictionDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.Restriction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor(Elastic.Clients.Elasticsearch.Security.Restriction instance) => new Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.Restriction(Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor descriptor) => descriptor.Instance; /// /// @@ -55,17 +125,29 @@ public RestrictionDescriptor() : base() /// NOTE: In order to use a role restriction, an API key must be created with a single role descriptor. /// /// - public RestrictionDescriptor Workflows(ICollection workflows) + public Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor Workflows(System.Collections.Generic.ICollection value) { - WorkflowsValue = workflows; - return Self; + Instance.Workflows = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of workflows to which the API key is restricted. + /// NOTE: In order to use a role restriction, an API key must be created with a single role descriptor. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor Workflows(params Elastic.Clients.Elasticsearch.Security.RestrictionWorkflow[] values) { - writer.WriteStartObject(); - writer.WritePropertyName("workflows"); - JsonSerializer.Serialize(writer, WorkflowsValue, options); - writer.WriteEndObject(); + Instance.Workflows = [.. values]; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.Restriction Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor(new Elastic.Clients.Elasticsearch.Security.Restriction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs index 8804eee441c..ed339b9f494 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs @@ -17,38 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RoleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRoleTemplates = System.Text.Json.JsonEncodedText.Encode("role_templates"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropTransientMetadata = System.Text.Json.JsonEncodedText.Encode("transient_metadata"); + + public override Elastic.Clients.Elasticsearch.Security.Role Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propApplications = default; + LocalJsonValue> propCluster = default; + LocalJsonValue propDescription = default; + LocalJsonValue>>>?> propGlobal = default; + LocalJsonValue> propIndices = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue?> propRoleTemplates = default; + LocalJsonValue?> propRunAs = default; + LocalJsonValue?> propTransientMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.IReadOnlyDictionary>>>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>>>(o, null, static System.Collections.Generic.IReadOnlyDictionary>> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>>(o, null, static System.Collections.Generic.IReadOnlyDictionary> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)!)!))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRoleTemplates.TryReadProperty(ref reader, options, PropRoleTemplates, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTransientMetadata.TryReadProperty(ref reader, options, PropTransientMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.Role(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value, + Cluster = propCluster.Value, + Description = propDescription.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + RoleTemplates = propRoleTemplates.Value, + RunAs = propRunAs.Value, + TransientMetadata = propTransientMetadata.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.Role value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>>>? v) => w.WriteDictionaryValue>>>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>> v) => w.WriteDictionaryValue>>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary> v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))))); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRoleTemplates, value.RoleTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransientMetadata, value.TransientMetadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleConverter))] public sealed partial class Role { - [JsonInclude, JsonPropertyName("applications")] - public IReadOnlyCollection Applications { get; init; } - [JsonInclude, JsonPropertyName("cluster")] - public IReadOnlyCollection Cluster { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("global")] - public IReadOnlyDictionary>>>? Global { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("remote_cluster")] - public IReadOnlyCollection? RemoteCluster { get; init; } - [JsonInclude, JsonPropertyName("remote_indices")] - public IReadOnlyCollection? RemoteIndices { get; init; } - [JsonInclude, JsonPropertyName("role_templates")] - public IReadOnlyCollection? RoleTemplates { get; init; } - [JsonInclude, JsonPropertyName("run_as")] - public IReadOnlyCollection? RunAs { get; init; } - [JsonInclude, JsonPropertyName("transient_metadata")] - public IReadOnlyDictionary? TransientMetadata { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Role(System.Collections.Generic.IReadOnlyCollection applications, System.Collections.Generic.IReadOnlyCollection cluster, System.Collections.Generic.IReadOnlyCollection indices, System.Collections.Generic.IReadOnlyDictionary metadata) + { + Applications = applications; + Cluster = cluster; + Indices = indices; + Metadata = metadata; + } +#if NET7_0_OR_GREATER + public Role() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Role() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Role(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Applications { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Cluster { get; set; } + public string? Description { get; set; } + public System.Collections.Generic.IReadOnlyDictionary>>>? Global { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RemoteCluster { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RemoteIndices { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RoleTemplates { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RunAs { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? TransientMetadata { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs index bb8f8688391..97265974a2e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs @@ -17,188 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -internal sealed partial class RoleDescriptorConverter : JsonConverter +internal sealed partial class RoleDescriptorxConverter : System.Text.Json.Serialization.JsonConverter { - public override RoleDescriptor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRestriction = System.Text.Json.JsonEncodedText.Encode("restriction"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropTransientMetadata = System.Text.Json.JsonEncodedText.Encode("transient_metadata"); + + public override Elastic.Clients.Elasticsearch.Security.RoleDescriptorx Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new RoleDescriptor(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplications = default; + LocalJsonValue?> propCluster = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGlobal = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue propRestriction = default; + LocalJsonValue?> propRunAs = default; + LocalJsonValue?> propTransientMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { - var property = reader.GetString(); - if (property == "applications") - { - variant.Applications = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "cluster") - { - variant.Cluster = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "description") - { - variant.Description = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "global") - { - variant.Global = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "indices" || property == "index") - { - variant.Indices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "metadata") - { - variant.Metadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "remote_cluster") - { - variant.RemoteCluster = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "remote_indices") - { - variant.RemoteIndices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "restriction") - { - variant.Restriction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "run_as") - { - variant.RunAs = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "transient_metadata") - { - variant.TransientMetadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - public override void Write(Utf8JsonWriter writer, RoleDescriptor value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Applications is not null) - { - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, value.Applications, options); - } + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } - if (value.Cluster is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, value.Cluster, options); - } + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } - if (!string.IsNullOrEmpty(value.Description)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(value.Description); - } + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)) || propIndices.TryReadProperty(ref reader, options, PropIndices1, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Global is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, value.Global, options); - } + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.Indices is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, value.Indices, options); - } + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Metadata is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, value.Metadata, options); - } + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.RemoteCluster is not null) - { - writer.WritePropertyName("remote_cluster"); - JsonSerializer.Serialize(writer, value.RemoteCluster, options); - } + if (propRestriction.TryReadProperty(ref reader, options, PropRestriction, null)) + { + continue; + } - if (value.RemoteIndices is not null) - { - writer.WritePropertyName("remote_indices"); - JsonSerializer.Serialize(writer, value.RemoteIndices, options); - } + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } - if (value.Restriction is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, value.Restriction, options); - } + if (propTransientMetadata.TryReadProperty(ref reader, options, PropTransientMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - if (value.RunAs is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, value.RunAs, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.TransientMetadata is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("transient_metadata"); - JsonSerializer.Serialize(writer, value.TransientMetadata, options); - } + Applications = propApplications.Value, + Cluster = propCluster.Value, + Description = propDescription.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + Restriction = propRestriction.Value, + RunAs = propRunAs.Value, + TransientMetadata = propTransientMetadata.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleDescriptorx value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRestriction, value.Restriction, null, null); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransientMetadata, value.TransientMetadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); writer.WriteEndObject(); } } -[JsonConverter(typeof(RoleDescriptorConverter))] -public sealed partial class RoleDescriptor +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleDescriptorxConverter))] +public sealed partial class RoleDescriptorx { +#if NET7_0_OR_GREATER + public RoleDescriptorx() + { + } +#endif +#if !NET7_0_OR_GREATER + public RoleDescriptorx() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of application privilege entries /// /// - public ICollection? Applications { get; set; } + public System.Collections.Generic.ICollection? Applications { get; set; } /// /// /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. /// /// - public ICollection? Cluster { get; set; } + public System.Collections.Generic.ICollection? Cluster { get; set; } /// /// @@ -212,21 +198,21 @@ public sealed partial class RoleDescriptor /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public ICollection? Global { get; set; } + public System.Collections.Generic.ICollection? Global { get; set; } /// /// /// A list of indices permissions entries. /// /// - public ICollection? Indices { get; set; } + public System.Collections.Generic.ICollection? Indices { get; set; } /// /// /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. /// /// - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// @@ -234,14 +220,14 @@ public sealed partial class RoleDescriptor /// NOTE: This is limited a subset of the cluster permissions. /// /// - public ICollection? RemoteCluster { get; set; } + public System.Collections.Generic.ICollection? RemoteCluster { get; set; } /// /// /// A list of indices permissions for remote clusters. /// /// - public ICollection? RemoteIndices { get; set; } + public System.Collections.Generic.ICollection? RemoteIndices { get; set; } /// /// @@ -257,86 +243,77 @@ public sealed partial class RoleDescriptor /// For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. /// /// - public ICollection? RunAs { get; set; } - public IDictionary? TransientMetadata { get; set; } + public System.Collections.Generic.ICollection? RunAs { get; set; } + public System.Collections.Generic.IDictionary? TransientMetadata { get; set; } } -public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor> +public readonly partial struct RoleDescriptorxDescriptor { - internal RoleDescriptorDescriptor(Action> configure) => configure.Invoke(this); - - public RoleDescriptorDescriptor() : base() - { - } - - private ICollection? ApplicationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } - private Action ApplicationsDescriptorAction { get; set; } - private Action[] ApplicationsDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? GlobalValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor GlobalDescriptor { get; set; } - private Action GlobalDescriptorAction { get; set; } - private Action[] GlobalDescriptorActions { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } - private Action> IndicesDescriptorAction { get; set; } - private Action>[] IndicesDescriptorActions { get; set; } - private IDictionary? MetadataValue { get; set; } - private ICollection? RemoteClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor RemoteClusterDescriptor { get; set; } - private Action RemoteClusterDescriptorAction { get; set; } - private Action[] RemoteClusterDescriptorActions { get; set; } - private ICollection? RemoteIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor RemoteIndicesDescriptor { get; set; } - private Action> RemoteIndicesDescriptorAction { get; set; } - private Action>[] RemoteIndicesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Security.Restriction? RestrictionValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor RestrictionDescriptor { get; set; } - private Action RestrictionDescriptorAction { get; set; } - private ICollection? RunAsValue { get; set; } - private IDictionary? TransientMetadataValue { get; set; } + internal Elastic.Clients.Elasticsearch.Security.RoleDescriptorx Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorxDescriptor(Elastic.Clients.Elasticsearch.Security.RoleDescriptorx instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorxDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(Elastic.Clients.Elasticsearch.Security.RoleDescriptorx instance) => new Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor descriptor) => descriptor.Instance; /// /// /// A list of application privilege entries /// /// - public RoleDescriptorDescriptor Applications(ICollection? applications) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(System.Collections.Generic.ICollection? value) { - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsValue = applications; - return Self; + Instance.Applications = value; + return this; } - public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + /// + /// + /// A list of application privilege entries + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges[] values) { - ApplicationsValue = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptor = descriptor; - return Self; + Instance.Applications = [.. values]; + return this; } - public RoleDescriptorDescriptor Applications(Action configure) + /// + /// + /// A list of application privilege entries + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(params System.Action[] actions) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor.Build(action)); + } + + Instance.Applications = items; + return this; } - public RoleDescriptorDescriptor Applications(params Action[] configure) + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = configure; - return Self; + Instance.Cluster = value; + return this; } /// @@ -344,10 +321,10 @@ public RoleDescriptorDescriptor Applications(params Action /// - public RoleDescriptorDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - ClusterValue = cluster; - return Self; + Instance.Cluster = [.. values]; + return this; } /// @@ -355,10 +332,10 @@ public RoleDescriptorDescriptor Cluster(ICollection /// - public RoleDescriptorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Description(string? value) { - DescriptionValue = description; - return Self; + Instance.Description = value; + return this; } /// @@ -366,40 +343,49 @@ public RoleDescriptorDescriptor Description(string? description) /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public RoleDescriptorDescriptor Global(ICollection? global) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(System.Collections.Generic.ICollection? value) { - GlobalDescriptor = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = null; - GlobalValue = global; - return Self; + Instance.Global = value; + return this; } - public RoleDescriptorDescriptor Global(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor descriptor) + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(params Elastic.Clients.Elasticsearch.Security.GlobalPrivilege[] values) { - GlobalValue = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = null; - GlobalDescriptor = descriptor; - return Self; + Instance.Global = [.. values]; + return this; } - public RoleDescriptorDescriptor Global(Action configure) + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(params System.Action[] actions) { - GlobalValue = null; - GlobalDescriptor = null; - GlobalDescriptorActions = null; - GlobalDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor.Build(action)); + } + + Instance.Global = items; + return this; } - public RoleDescriptorDescriptor Global(params Action[] configure) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(System.Collections.Generic.ICollection? value) { - GlobalValue = null; - GlobalDescriptor = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = configure; - return Self; + Instance.Indices = value; + return this; } /// @@ -407,40 +393,49 @@ public RoleDescriptorDescriptor Global(params Action /// - public RoleDescriptorDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(params Elastic.Clients.Elasticsearch.Security.IndicesPrivileges[] values) { - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesValue = indices; - return Self; + Instance.Indices = [.. values]; + return this; } - public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(params System.Action>[] actions) { - IndicesValue = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public RoleDescriptorDescriptor Indices(Action> configure) + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorActions = null; - IndicesDescriptorAction = configure; - return Self; + Instance.Metadata = value; + return this; } - public RoleDescriptorDescriptor Indices(params Action>[] configure) + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata() { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = configure; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -448,10 +443,17 @@ public RoleDescriptorDescriptor Indices(params Action_ are reserved for system usage. /// /// - public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata(System.Action? action) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -460,40 +462,40 @@ public RoleDescriptorDescriptor Metadata(Func /// - public RoleDescriptorDescriptor RemoteCluster(ICollection? remoteCluster) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(System.Collections.Generic.ICollection? value) { - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterValue = remoteCluster; - return Self; + Instance.RemoteCluster = value; + return this; } - public RoleDescriptorDescriptor RemoteCluster(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor descriptor) + /// + /// + /// A list of cluster permissions for remote clusters. + /// NOTE: This is limited a subset of the cluster permissions. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(params Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges[] values) { - RemoteClusterValue = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptor = descriptor; - return Self; + Instance.RemoteCluster = [.. values]; + return this; } - public RoleDescriptorDescriptor RemoteCluster(Action configure) + /// + /// + /// A list of cluster permissions for remote clusters. + /// NOTE: This is limited a subset of the cluster permissions. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(params System.Action[] actions) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor.Build(action)); + } - public RoleDescriptorDescriptor RemoteCluster(params Action[] configure) - { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = configure; - return Self; + Instance.RemoteCluster = items; + return this; } /// @@ -501,40 +503,38 @@ public RoleDescriptorDescriptor RemoteCluster(params Action /// - public RoleDescriptorDescriptor RemoteIndices(ICollection? remoteIndices) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(System.Collections.Generic.ICollection? value) { - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesValue = remoteIndices; - return Self; + Instance.RemoteIndices = value; + return this; } - public RoleDescriptorDescriptor RemoteIndices(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions for remote clusters. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(params Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges[] values) { - RemoteIndicesValue = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptor = descriptor; - return Self; + Instance.RemoteIndices = [.. values]; + return this; } - public RoleDescriptorDescriptor RemoteIndices(Action> configure) + /// + /// + /// A list of indices permissions for remote clusters. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(params System.Action>[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } - public RoleDescriptorDescriptor RemoteIndices(params Action>[] configure) - { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = configure; - return Self; + Instance.RemoteIndices = items; + return this; } /// @@ -542,28 +542,34 @@ public RoleDescriptorDescriptor RemoteIndices(params Action /// - public RoleDescriptorDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.Restriction? restriction) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.Restriction? value) { - RestrictionDescriptor = null; - RestrictionDescriptorAction = null; - RestrictionValue = restriction; - return Self; + Instance.Restriction = value; + return this; } - public RoleDescriptorDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor descriptor) + /// + /// + /// Restriction for when the role descriptor is allowed to be effective. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Restriction(System.Action action) { - RestrictionValue = null; - RestrictionDescriptorAction = null; - RestrictionDescriptor = descriptor; - return Self; + Instance.Restriction = Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor.Build(action); + return this; } - public RoleDescriptorDescriptor Restriction(Action configure) + /// + /// + /// A list of users that the API keys can impersonate. + /// NOTE: In Elastic Cloud Serverless, the run-as feature is disabled. + /// For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RunAs(System.Collections.Generic.ICollection? value) { - RestrictionValue = null; - RestrictionDescriptor = null; - RestrictionDescriptorAction = configure; - return Self; + Instance.RunAs = value; + return this; } /// @@ -573,300 +579,118 @@ public RoleDescriptorDescriptor Restriction(Actionrun_as field, but a non-empty list will be rejected. /// /// - public RoleDescriptorDescriptor RunAs(ICollection? runAs) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RunAs(params string[] values) { - RunAsValue = runAs; - return Self; + Instance.RunAs = [.. values]; + return this; } - public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata(System.Collections.Generic.IDictionary? value) { - TransientMetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TransientMetadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata() { - writer.WriteStartObject(); - if (ApplicationsDescriptor is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorAction is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorActions is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - foreach (var action in ApplicationsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ApplicationsValue is not null) - { - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, ApplicationsValue, options); - } - - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GlobalDescriptor is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, GlobalDescriptor, options); - } - else if (GlobalDescriptorAction is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(GlobalDescriptorAction), options); - } - else if (GlobalDescriptorActions is not null) - { - writer.WritePropertyName("global"); - if (GlobalDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in GlobalDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(action), options); - } - - if (GlobalDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (GlobalValue is not null) - { - writer.WritePropertyName("global"); - SingleOrManySerializationHelper.Serialize(GlobalValue, writer, options); - } - - if (IndicesDescriptor is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorAction is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorActions is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - foreach (var action in IndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } - - if (RemoteClusterDescriptor is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteClusterDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorAction is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(RemoteClusterDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorActions is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - foreach (var action in RemoteClusterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(action), options); - } + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - writer.WriteEndArray(); - } - else if (RemoteClusterValue is not null) - { - writer.WritePropertyName("remote_cluster"); - JsonSerializer.Serialize(writer, RemoteClusterValue, options); - } + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata(System.Action? action) + { + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (RemoteIndicesDescriptor is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteIndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorAction is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(RemoteIndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorActions is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - foreach (var action in RemoteIndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(action), options); - } + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor AddTransientMetadatum(string key, object value) + { + Instance.TransientMetadata ??= new System.Collections.Generic.Dictionary(); + Instance.TransientMetadata.Add(key, value); + return this; + } - writer.WriteEndArray(); - } - else if (RemoteIndicesValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleDescriptorx Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("remote_indices"); - JsonSerializer.Serialize(writer, RemoteIndicesValue, options); + return new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (RestrictionDescriptor is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, RestrictionDescriptor, options); - } - else if (RestrictionDescriptorAction is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor(RestrictionDescriptorAction), options); - } - else if (RestrictionValue is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, RestrictionValue, options); - } + var builder = new Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } +public readonly partial struct RoleDescriptorxDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.RoleDescriptorx Instance { get; init; } - if (TransientMetadataValue is not null) - { - writer.WritePropertyName("transient_metadata"); - JsonSerializer.Serialize(writer, TransientMetadataValue, options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorxDescriptor(Elastic.Clients.Elasticsearch.Security.RoleDescriptorx instance) + { + Instance = instance; + } - writer.WriteEndObject(); + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorxDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } -} -public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor -{ - internal RoleDescriptorDescriptor(Action configure) => configure.Invoke(this); - - public RoleDescriptorDescriptor() : base() - { - } - - private ICollection? ApplicationsValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } - private Action ApplicationsDescriptorAction { get; set; } - private Action[] ApplicationsDescriptorActions { get; set; } - private ICollection? ClusterValue { get; set; } - private string? DescriptionValue { get; set; } - private ICollection? GlobalValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor GlobalDescriptor { get; set; } - private Action GlobalDescriptorAction { get; set; } - private Action[] GlobalDescriptorActions { get; set; } - private ICollection? IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } - private Action IndicesDescriptorAction { get; set; } - private Action[] IndicesDescriptorActions { get; set; } - private IDictionary? MetadataValue { get; set; } - private ICollection? RemoteClusterValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor RemoteClusterDescriptor { get; set; } - private Action RemoteClusterDescriptorAction { get; set; } - private Action[] RemoteClusterDescriptorActions { get; set; } - private ICollection? RemoteIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor RemoteIndicesDescriptor { get; set; } - private Action RemoteIndicesDescriptorAction { get; set; } - private Action[] RemoteIndicesDescriptorActions { get; set; } - private Elastic.Clients.Elasticsearch.Security.Restriction? RestrictionValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor RestrictionDescriptor { get; set; } - private Action RestrictionDescriptorAction { get; set; } - private ICollection? RunAsValue { get; set; } - private IDictionary? TransientMetadataValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(Elastic.Clients.Elasticsearch.Security.RoleDescriptorx instance) => new Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor descriptor) => descriptor.Instance; /// /// /// A list of application privilege entries /// /// - public RoleDescriptorDescriptor Applications(ICollection? applications) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(System.Collections.Generic.ICollection? value) { - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsValue = applications; - return Self; + Instance.Applications = value; + return this; } - public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + /// + /// + /// A list of application privilege entries + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(params Elastic.Clients.Elasticsearch.Security.ApplicationPrivileges[] values) { - ApplicationsValue = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptor = descriptor; - return Self; + Instance.Applications = [.. values]; + return this; } - public RoleDescriptorDescriptor Applications(Action configure) + /// + /// + /// A list of application privilege entries + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Applications(params System.Action[] actions) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorActions = null; - ApplicationsDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor.Build(action)); + } + + Instance.Applications = items; + return this; } - public RoleDescriptorDescriptor Applications(params Action[] configure) + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Cluster(System.Collections.Generic.ICollection? value) { - ApplicationsValue = null; - ApplicationsDescriptor = null; - ApplicationsDescriptorAction = null; - ApplicationsDescriptorActions = configure; - return Self; + Instance.Cluster = value; + return this; } /// @@ -874,10 +698,10 @@ public RoleDescriptorDescriptor Applications(params Action /// - public RoleDescriptorDescriptor Cluster(ICollection? cluster) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Cluster(params Elastic.Clients.Elasticsearch.Security.ClusterPrivilege[] values) { - ClusterValue = cluster; - return Self; + Instance.Cluster = [.. values]; + return this; } /// @@ -885,10 +709,21 @@ public RoleDescriptorDescriptor Cluster(ICollection /// - public RoleDescriptorDescriptor Description(string? description) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Description(string? value) + { + Instance.Description = value; + return this; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(System.Collections.Generic.ICollection? value) { - DescriptionValue = description; - return Self; + Instance.Global = value; + return this; } /// @@ -896,40 +731,49 @@ public RoleDescriptorDescriptor Description(string? description) /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public RoleDescriptorDescriptor Global(ICollection? global) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(params Elastic.Clients.Elasticsearch.Security.GlobalPrivilege[] values) { - GlobalDescriptor = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = null; - GlobalValue = global; - return Self; + Instance.Global = [.. values]; + return this; } - public RoleDescriptorDescriptor Global(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor descriptor) + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Global(params System.Action[] actions) { - GlobalValue = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = null; - GlobalDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor.Build(action)); + } + + Instance.Global = items; + return this; } - public RoleDescriptorDescriptor Global(Action configure) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(System.Collections.Generic.ICollection? value) { - GlobalValue = null; - GlobalDescriptor = null; - GlobalDescriptorActions = null; - GlobalDescriptorAction = configure; - return Self; + Instance.Indices = value; + return this; } - public RoleDescriptorDescriptor Global(params Action[] configure) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(params Elastic.Clients.Elasticsearch.Security.IndicesPrivileges[] values) { - GlobalValue = null; - GlobalDescriptor = null; - GlobalDescriptorAction = null; - GlobalDescriptorActions = configure; - return Self; + Instance.Indices = [.. values]; + return this; } /// @@ -937,40 +781,55 @@ public RoleDescriptorDescriptor Global(params Action /// - public RoleDescriptorDescriptor Indices(ICollection? indices) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(params System.Action[] actions) { - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesValue = indices; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions entries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Indices(params System.Action>[] actions) { - IndicesValue = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = null; - IndicesDescriptor = descriptor; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor.Build(action)); + } + + Instance.Indices = items; + return this; } - public RoleDescriptorDescriptor Indices(Action configure) + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorActions = null; - IndicesDescriptorAction = configure; - return Self; + Instance.Metadata = value; + return this; } - public RoleDescriptorDescriptor Indices(params Action[] configure) + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata() { - IndicesValue = null; - IndicesDescriptor = null; - IndicesDescriptorAction = null; - IndicesDescriptorActions = configure; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } /// @@ -978,10 +837,17 @@ public RoleDescriptorDescriptor Indices(params Action_ are reserved for system usage. /// /// - public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Metadata(System.Action? action) + { + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor AddMetadatum(string key, object value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; } /// @@ -990,40 +856,40 @@ public RoleDescriptorDescriptor Metadata(Func, /// NOTE: This is limited a subset of the cluster permissions. /// /// - public RoleDescriptorDescriptor RemoteCluster(ICollection? remoteCluster) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(System.Collections.Generic.ICollection? value) { - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterValue = remoteCluster; - return Self; + Instance.RemoteCluster = value; + return this; } - public RoleDescriptorDescriptor RemoteCluster(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor descriptor) + /// + /// + /// A list of cluster permissions for remote clusters. + /// NOTE: This is limited a subset of the cluster permissions. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(params Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivileges[] values) { - RemoteClusterValue = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptor = descriptor; - return Self; + Instance.RemoteCluster = [.. values]; + return this; } - public RoleDescriptorDescriptor RemoteCluster(Action configure) + /// + /// + /// A list of cluster permissions for remote clusters. + /// NOTE: This is limited a subset of the cluster permissions. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteCluster(params System.Action[] actions) { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorActions = null; - RemoteClusterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor.Build(action)); + } - public RoleDescriptorDescriptor RemoteCluster(params Action[] configure) - { - RemoteClusterValue = null; - RemoteClusterDescriptor = null; - RemoteClusterDescriptorAction = null; - RemoteClusterDescriptorActions = configure; - return Self; + Instance.RemoteCluster = items; + return this; } /// @@ -1031,40 +897,55 @@ public RoleDescriptorDescriptor RemoteCluster(params Action /// - public RoleDescriptorDescriptor RemoteIndices(ICollection? remoteIndices) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(System.Collections.Generic.ICollection? value) { - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesValue = remoteIndices; - return Self; + Instance.RemoteIndices = value; + return this; } - public RoleDescriptorDescriptor RemoteIndices(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor descriptor) + /// + /// + /// A list of indices permissions for remote clusters. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(params Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivileges[] values) { - RemoteIndicesValue = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptor = descriptor; - return Self; + Instance.RemoteIndices = [.. values]; + return this; } - public RoleDescriptorDescriptor RemoteIndices(Action configure) + /// + /// + /// A list of indices permissions for remote clusters. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(params System.Action[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorActions = null; - RemoteIndicesDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteIndices = items; + return this; } - public RoleDescriptorDescriptor RemoteIndices(params Action[] configure) + /// + /// + /// A list of indices permissions for remote clusters. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RemoteIndices(params System.Action>[] actions) { - RemoteIndicesValue = null; - RemoteIndicesDescriptor = null; - RemoteIndicesDescriptorAction = null; - RemoteIndicesDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor.Build(action)); + } + + Instance.RemoteIndices = items; + return this; } /// @@ -1072,28 +953,34 @@ public RoleDescriptorDescriptor RemoteIndices(params Action /// - public RoleDescriptorDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.Restriction? restriction) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.Restriction? value) { - RestrictionDescriptor = null; - RestrictionDescriptorAction = null; - RestrictionValue = restriction; - return Self; + Instance.Restriction = value; + return this; } - public RoleDescriptorDescriptor Restriction(Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor descriptor) + /// + /// + /// Restriction for when the role descriptor is allowed to be effective. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor Restriction(System.Action action) { - RestrictionValue = null; - RestrictionDescriptorAction = null; - RestrictionDescriptor = descriptor; - return Self; + Instance.Restriction = Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor.Build(action); + return this; } - public RoleDescriptorDescriptor Restriction(Action configure) + /// + /// + /// A list of users that the API keys can impersonate. + /// NOTE: In Elastic Cloud Serverless, the run-as feature is disabled. + /// For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RunAs(System.Collections.Generic.ICollection? value) { - RestrictionValue = null; - RestrictionDescriptor = null; - RestrictionDescriptorAction = configure; - return Self; + Instance.RunAs = value; + return this; } /// @@ -1103,220 +990,47 @@ public RoleDescriptorDescriptor Restriction(Actionrun_as field, but a non-empty list will be rejected. /// /// - public RoleDescriptorDescriptor RunAs(ICollection? runAs) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor RunAs(params string[] values) { - RunAsValue = runAs; - return Self; + Instance.RunAs = [.. values]; + return this; } - public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata(System.Collections.Generic.IDictionary? value) { - TransientMetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.TransientMetadata = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata() { - writer.WriteStartObject(); - if (ApplicationsDescriptor is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorAction is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); - writer.WriteEndArray(); - } - else if (ApplicationsDescriptorActions is not null) - { - writer.WritePropertyName("applications"); - writer.WriteStartArray(); - foreach (var action in ApplicationsDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (ApplicationsValue is not null) - { - writer.WritePropertyName("applications"); - JsonSerializer.Serialize(writer, ApplicationsValue, options); - } - - if (ClusterValue is not null) - { - writer.WritePropertyName("cluster"); - JsonSerializer.Serialize(writer, ClusterValue, options); - } - - if (!string.IsNullOrEmpty(DescriptionValue)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(DescriptionValue); - } - - if (GlobalDescriptor is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, GlobalDescriptor, options); - } - else if (GlobalDescriptorAction is not null) - { - writer.WritePropertyName("global"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(GlobalDescriptorAction), options); - } - else if (GlobalDescriptorActions is not null) - { - writer.WritePropertyName("global"); - if (GlobalDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in GlobalDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(action), options); - } - - if (GlobalDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (GlobalValue is not null) - { - writer.WritePropertyName("global"); - SingleOrManySerializationHelper.Serialize(GlobalValue, writer, options); - } - - if (IndicesDescriptor is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, IndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorAction is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (IndicesDescriptorActions is not null) - { - writer.WritePropertyName("indices"); - writer.WriteStartArray(); - foreach (var action in IndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } - - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } - - if (RemoteClusterDescriptor is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteClusterDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorAction is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(RemoteClusterDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteClusterDescriptorActions is not null) - { - writer.WritePropertyName("remote_cluster"); - writer.WriteStartArray(); - foreach (var action in RemoteClusterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteClusterPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RemoteClusterValue is not null) - { - writer.WritePropertyName("remote_cluster"); - JsonSerializer.Serialize(writer, RemoteClusterValue, options); - } - - if (RemoteIndicesDescriptor is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, RemoteIndicesDescriptor, options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorAction is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(RemoteIndicesDescriptorAction), options); - writer.WriteEndArray(); - } - else if (RemoteIndicesDescriptorActions is not null) - { - writer.WritePropertyName("remote_indices"); - writer.WriteStartArray(); - foreach (var action in RemoteIndicesDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RemoteIndicesPrivilegesDescriptor(action), options); - } - - writer.WriteEndArray(); - } - else if (RemoteIndicesValue is not null) - { - writer.WritePropertyName("remote_indices"); - JsonSerializer.Serialize(writer, RemoteIndicesValue, options); - } + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } - if (RestrictionDescriptor is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, RestrictionDescriptor, options); - } - else if (RestrictionDescriptorAction is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RestrictionDescriptor(RestrictionDescriptorAction), options); - } - else if (RestrictionValue is not null) - { - writer.WritePropertyName("restriction"); - JsonSerializer.Serialize(writer, RestrictionValue, options); - } + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor TransientMetadata(System.Action? action) + { + Instance.TransientMetadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (RunAsValue is not null) - { - writer.WritePropertyName("run_as"); - JsonSerializer.Serialize(writer, RunAsValue, options); - } + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor AddTransientMetadatum(string key, object value) + { + Instance.TransientMetadata ??= new System.Collections.Generic.Dictionary(); + Instance.TransientMetadata.Add(key, value); + return this; + } - if (TransientMetadataValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleDescriptorx Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("transient_metadata"); - JsonSerializer.Serialize(writer, TransientMetadataValue, options); + return new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.RoleDescriptorxDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleDescriptorx(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs index 0ce7e0a1c83..cc7938a56a3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs @@ -17,159 +17,217 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -internal sealed partial class RoleDescriptorReadConverter : JsonConverter +internal sealed partial class RoleDescriptorReadConverter : System.Text.Json.Serialization.JsonConverter { - public override RoleDescriptorRead Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropApplications = System.Text.Json.JsonEncodedText.Encode("applications"); + private static readonly System.Text.Json.JsonEncodedText PropCluster = System.Text.Json.JsonEncodedText.Encode("cluster"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropGlobal = System.Text.Json.JsonEncodedText.Encode("global"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropIndices1 = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteCluster = System.Text.Json.JsonEncodedText.Encode("remote_cluster"); + private static readonly System.Text.Json.JsonEncodedText PropRemoteIndices = System.Text.Json.JsonEncodedText.Encode("remote_indices"); + private static readonly System.Text.Json.JsonEncodedText PropRestriction = System.Text.Json.JsonEncodedText.Encode("restriction"); + private static readonly System.Text.Json.JsonEncodedText PropRunAs = System.Text.Json.JsonEncodedText.Encode("run_as"); + private static readonly System.Text.Json.JsonEncodedText PropTransientMetadata = System.Text.Json.JsonEncodedText.Encode("transient_metadata"); + + public override Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - IReadOnlyCollection? applications = default; - IReadOnlyCollection cluster = default; - string? description = default; - IReadOnlyCollection? global = default; - IReadOnlyCollection indices = default; - IReadOnlyDictionary? metadata = default; - IReadOnlyCollection? remoteCluster = default; - IReadOnlyCollection? remoteIndices = default; - Elastic.Clients.Elasticsearch.Security.Restriction? restriction = default; - IReadOnlyCollection? runAs = default; - IReadOnlyDictionary? transientMetadata = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propApplications = default; + LocalJsonValue> propCluster = default; + LocalJsonValue propDescription = default; + LocalJsonValue?> propGlobal = default; + LocalJsonValue> propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue?> propRemoteCluster = default; + LocalJsonValue?> propRemoteIndices = default; + LocalJsonValue propRestriction = default; + LocalJsonValue?> propRunAs = default; + LocalJsonValue?> propTransientMetadata = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propApplications.TryReadProperty(ref reader, options, PropApplications, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propCluster.TryReadProperty(ref reader, options, PropCluster, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propGlobal.TryReadProperty(ref reader, options, PropGlobal, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!) || propIndices.TryReadProperty(ref reader, options, PropIndices1, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propRemoteCluster.TryReadProperty(ref reader, options, PropRemoteCluster, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRemoteIndices.TryReadProperty(ref reader, options, PropRemoteIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) { - var property = reader.GetString(); - if (property == "applications") - { - applications = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "cluster") - { - cluster = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "description") - { - description = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "global") - { - global = SingleOrManySerializationHelper.Deserialize(ref reader, options); - continue; - } - - if (property == "indices" || property == "index") - { - indices = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "metadata") - { - metadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "remote_cluster") - { - remoteCluster = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "remote_indices") - { - remoteIndices = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "restriction") - { - restriction = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "run_as") - { - runAs = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "transient_metadata") - { - transientMetadata = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; } + + if (propRestriction.TryReadProperty(ref reader, options, PropRestriction, null)) + { + continue; + } + + if (propRunAs.TryReadProperty(ref reader, options, PropRunAs, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTransientMetadata.TryReadProperty(ref reader, options, PropTransientMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return new RoleDescriptorRead { Applications = applications, Cluster = cluster, Description = description, Global = global, Indices = indices, Metadata = metadata, RemoteCluster = remoteCluster, RemoteIndices = remoteIndices, Restriction = restriction, RunAs = runAs, TransientMetadata = transientMetadata }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Applications = propApplications.Value, + Cluster = propCluster.Value, + Description = propDescription.Value, + Global = propGlobal.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + RemoteCluster = propRemoteCluster.Value, + RemoteIndices = propRemoteIndices.Value, + Restriction = propRestriction.Value, + RunAs = propRunAs.Value, + TransientMetadata = propTransientMetadata.Value + }; } - public override void Write(Utf8JsonWriter writer, RoleDescriptorRead value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'RoleDescriptorRead' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropApplications, value.Applications, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropCluster, value.Cluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropGlobal, value.Global, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRemoteCluster, value.RemoteCluster, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRemoteIndices, value.RemoteIndices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRestriction, value.Restriction, null, null); + writer.WriteProperty(options, PropRunAs, value.RunAs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTransientMetadata, value.TransientMetadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); } } -[JsonConverter(typeof(RoleDescriptorReadConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleDescriptorReadConverter))] public sealed partial class RoleDescriptorRead { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorRead(System.Collections.Generic.IReadOnlyCollection cluster, System.Collections.Generic.IReadOnlyCollection indices) + { + Cluster = cluster; + Indices = indices; + } +#if NET7_0_OR_GREATER + public RoleDescriptorRead() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoleDescriptorRead() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleDescriptorRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of application privilege entries /// /// - public IReadOnlyCollection? Applications { get; init; } + public System.Collections.Generic.IReadOnlyCollection? Applications { get; set; } /// /// /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. /// /// - public IReadOnlyCollection Cluster { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Cluster { get; set; } /// /// /// An optional description of the role descriptor. /// /// - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. /// /// - public IReadOnlyCollection? Global { get; init; } + public System.Collections.Generic.ICollection? Global { get; set; } /// /// /// A list of indices permissions entries. /// /// - public IReadOnlyCollection Indices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } /// /// /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. /// /// - public IReadOnlyDictionary? Metadata { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } /// /// @@ -177,27 +235,27 @@ public sealed partial class RoleDescriptorRead /// NOTE: This is limited a subset of the cluster permissions. /// /// - public IReadOnlyCollection? RemoteCluster { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RemoteCluster { get; set; } /// /// /// A list of indices permissions for remote clusters. /// /// - public IReadOnlyCollection? RemoteIndices { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RemoteIndices { get; set; } /// /// /// A restriction for when the role descriptor is allowed to be effective. /// /// - public Elastic.Clients.Elasticsearch.Security.Restriction? Restriction { get; init; } + public Elastic.Clients.Elasticsearch.Security.Restriction? Restriction { get; set; } /// /// /// A list of users that the API keys can impersonate. /// /// - public IReadOnlyCollection? RunAs { get; init; } - public IReadOnlyDictionary? TransientMetadata { get; init; } + public System.Collections.Generic.IReadOnlyCollection? RunAs { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? TransientMetadata { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs index 6357dea001a..a5ac0649fda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RoleDescriptorWrapperConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRoleDescriptor = System.Text.Json.JsonEncodedText.Encode("role_descriptor"); + + public override Elastic.Clients.Elasticsearch.Security.RoleDescriptorWrapper Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRoleDescriptor = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRoleDescriptor.TryReadProperty(ref reader, options, PropRoleDescriptor, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleDescriptorWrapper(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + RoleDescriptor = propRoleDescriptor.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleDescriptorWrapper value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRoleDescriptor, value.RoleDescriptor, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleDescriptorWrapperConverter))] public sealed partial class RoleDescriptorWrapper { - [JsonInclude, JsonPropertyName("role_descriptor")] - public Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead RoleDescriptor { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleDescriptorWrapper(Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead roleDescriptor) + { + RoleDescriptor = roleDescriptor; + } +#if NET7_0_OR_GREATER + public RoleDescriptorWrapper() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoleDescriptorWrapper() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleDescriptorWrapper(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead RoleDescriptor { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs index 6ed27c86cc1..b5425920d2d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RoleMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropRoleTemplates = System.Text.Json.JsonEncodedText.Encode("role_templates"); + private static readonly System.Text.Json.JsonEncodedText PropRules = System.Text.Json.JsonEncodedText.Encode("rules"); + + public override Elastic.Clients.Elasticsearch.Security.RoleMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue?> propRoleTemplates = default; + LocalJsonValue propRules = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRoleTemplates.TryReadProperty(ref reader, options, PropRoleTemplates, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propRules.TryReadProperty(ref reader, options, PropRules, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Metadata = propMetadata.Value, + Roles = propRoles.Value, + RoleTemplates = propRoleTemplates.Value, + Rules = propRules.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRoleTemplates, value.RoleTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropRules, value.Rules, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleMappingConverter))] public sealed partial class RoleMapping { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } - [JsonInclude, JsonPropertyName("role_templates")] - public IReadOnlyCollection? RoleTemplates { get; init; } - [JsonInclude, JsonPropertyName("rules")] - public Elastic.Clients.Elasticsearch.Security.RoleMappingRule Rules { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMapping(bool enabled, System.Collections.Generic.IReadOnlyDictionary metadata, Elastic.Clients.Elasticsearch.Security.RoleMappingRule rules) + { + Enabled = enabled; + Metadata = metadata; + Rules = rules; + } +#if NET7_0_OR_GREATER + public RoleMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoleMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } + public System.Collections.Generic.IReadOnlyCollection? RoleTemplates { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.RoleMappingRule Rules { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs index 6a2b8369ad0..8b591a871b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs @@ -17,256 +17,411 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(RoleMappingRuleConverter))] -public sealed partial class RoleMappingRule +internal sealed partial class RoleMappingRuleConverter : System.Text.Json.Serialization.JsonConverter { - internal RoleMappingRule(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static RoleMappingRule All(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("all", roleMappingRule); - public static RoleMappingRule Any(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("any", roleMappingRule); - public static RoleMappingRule Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => new RoleMappingRule("except", roleMappingRule); - public static RoleMappingRule Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => new RoleMappingRule("field", fieldRule); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantAll = System.Text.Json.JsonEncodedText.Encode("all"); + private static readonly System.Text.Json.JsonEncodedText VariantAny = System.Text.Json.JsonEncodedText.Encode("any"); + private static readonly System.Text.Json.JsonEncodedText VariantExcept = System.Text.Json.JsonEncodedText.Encode("except"); + private static readonly System.Text.Json.JsonEncodedText VariantField = System.Text.Json.JsonEncodedText.Encode("field"); -internal sealed partial class RoleMappingRuleConverter : JsonConverter -{ - public override RoleMappingRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.RoleMappingRule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantAll)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantAll.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "all") + if (reader.ValueTextEquals(VariantAny)) { - variantValue = JsonSerializer.Deserialize?>(ref reader, options); - variantNameValue = propertyName; + variantType = VariantAny.Value; + reader.Read(); + variant = reader.ReadValue>(options, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!); continue; } - if (propertyName == "any") + if (reader.ValueTextEquals(VariantExcept)) { - variantValue = JsonSerializer.Deserialize?>(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExcept.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "except") + if (reader.ValueTextEquals(VariantField)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantField.Value; + reader.Read(); + variant = reader.ReadValue>>(options, static System.Collections.Generic.KeyValuePair> (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadKeyValuePairValue>(o, null, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)); continue; } - if (propertyName == "field") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RoleMappingRule' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new RoleMappingRule(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, RoleMappingRule value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleMappingRule value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "all": - JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); - break; - case "any": - JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); - break; - case "except": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.RoleMappingRule)value.Variant, options); - break; - case "field": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.FieldRule)value.Variant, options); - break; - } + case null: + break; + case "all": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.ICollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + case "any": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.ICollection)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteCollectionValue(o, v, null)); + break; + case "except": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Security.RoleMappingRule)value.Variant, null, null); + break; + case "field": + writer.WriteProperty(options, value.VariantType, (System.Collections.Generic.KeyValuePair>)value.Variant, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.KeyValuePair> v) => w.WriteKeyValuePairValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null))); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Security.RoleMappingRule)}'."); } writer.WriteEndObject(); } } -public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleConverter))] +public sealed partial class RoleMappingRule { - internal RoleMappingRuleDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public RoleMappingRule() + { + } +#endif +#if !NET7_0_OR_GREATER + public RoleMappingRule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.ICollection? All { get => GetVariant>("all"); set => SetVariant("all", value); } + public System.Collections.Generic.ICollection? Any { get => GetVariant>("any"); set => SetVariant("any", value); } + public Elastic.Clients.Elasticsearch.Security.RoleMappingRule? Except { get => GetVariant("except"); set => SetVariant("except", value); } + public System.Collections.Generic.KeyValuePair>? Field { get => GetVariant>>("field"); set => SetVariant("field", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleMappingRule(System.Collections.Generic.KeyValuePair> value) => new Elastic.Clients.Elasticsearch.Security.RoleMappingRule { Field = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } - public RoleMappingRuleDescriptor() : base() + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct RoleMappingRuleDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.RoleMappingRule Instance { get; init; } - private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMappingRuleDescriptor(Elastic.Clients.Elasticsearch.Security.RoleMappingRule instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private RoleMappingRuleDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMappingRuleDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); - public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); - public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); - public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); - public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); - public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); - public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => Set(fieldRule, "field"); - public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(Elastic.Clients.Elasticsearch.Security.RoleMappingRule instance) => new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(System.Collections.Generic.ICollection? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + Instance.All = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(params Elastic.Clients.Elasticsearch.Security.RoleMappingRule[] values) + { + Instance.All = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); + } + + Instance.All = items; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(System.Collections.Generic.ICollection? value) + { + Instance.Any = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(params Elastic.Clients.Elasticsearch.Security.RoleMappingRule[] values) + { + Instance.Any = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.Any = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? value) + { + Instance.Except = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Except(System.Action> action) + { + Instance.Except = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Collections.Generic.KeyValuePair>? value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Field key, params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Linq.Expressions.Expression> key, params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, [.. values]); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleMappingRule Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor +public readonly partial struct RoleMappingRuleDescriptor { - internal RoleMappingRuleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.RoleMappingRule Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMappingRuleDescriptor(Elastic.Clients.Elasticsearch.Security.RoleMappingRule instance) + { + Instance = instance; + } - public RoleMappingRuleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMappingRuleDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(Elastic.Clients.Elasticsearch.Security.RoleMappingRule instance) => new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor descriptor) => descriptor.Instance; - private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(System.Collections.Generic.ICollection? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.All = value; + return this; } - private RoleMappingRuleDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(params Elastic.Clients.Elasticsearch.Security.RoleMappingRule[] values) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.All = [.. values]; + return this; } - public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); - public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); - public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); - public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); - public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); - public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); - public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => Set(fieldRule, "field"); - public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); + } + + Instance.All = items; + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor All(params System.Action>[] actions) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + Instance.All = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(System.Collections.Generic.ICollection? value) + { + Instance.Any = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(params Elastic.Clients.Elasticsearch.Security.RoleMappingRule[] values) + { + Instance.Any = [.. values]; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(params System.Action[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); } - writer.WriteEndObject(); + Instance.Any = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Any(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action)); + } + + Instance.Any = items; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? value) + { + Instance.Except = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Except(System.Action action) + { + Instance.Except = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Except(System.Action> action) + { + Instance.Except = Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Collections.Generic.KeyValuePair>? value) + { + Instance.Field = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Field key, System.Collections.Generic.ICollection value) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Linq.Expressions.Expression> key, System.Collections.Generic.ICollection value) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Field key, params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, [.. values]); + return this; + } + + public Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor Field(System.Linq.Expressions.Expression> key, params Elastic.Clients.Elasticsearch.FieldValue[] values) + { + Instance.Field = new System.Collections.Generic.KeyValuePair>(key, [.. values]); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleMappingRule Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleMappingRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleQuery.g.cs index 862b9b99044..4668387e54f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleQuery.g.cs @@ -17,368 +17,1044 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(RoleQueryConverter))] -public sealed partial class RoleQuery +internal sealed partial class RoleQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal RoleQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static RoleQuery Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new RoleQuery("bool", boolQuery); - public static RoleQuery Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new RoleQuery("exists", existsQuery); - public static RoleQuery Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new RoleQuery("ids", idsQuery); - public static RoleQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new RoleQuery("match", matchQuery); - public static RoleQuery MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new RoleQuery("match_all", matchAllQuery); - public static RoleQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new RoleQuery("prefix", prefixQuery); - public static RoleQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); - public static RoleQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); - public static RoleQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); - public static RoleQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); - public static RoleQuery SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new RoleQuery("simple_query_string", simpleQueryStringQuery); - public static RoleQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new RoleQuery("term", termQuery); - public static RoleQuery Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new RoleQuery("terms", termsQuery); - public static RoleQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new RoleQuery("wildcard", wildcardQuery); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantBool = System.Text.Json.JsonEncodedText.Encode("bool"); + private static readonly System.Text.Json.JsonEncodedText VariantExists = System.Text.Json.JsonEncodedText.Encode("exists"); + private static readonly System.Text.Json.JsonEncodedText VariantIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchAll = System.Text.Json.JsonEncodedText.Encode("match_all"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantSimpleQueryString = System.Text.Json.JsonEncodedText.Encode("simple_query_string"); + private static readonly System.Text.Json.JsonEncodedText VariantTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); -internal sealed partial class RoleQueryConverter : JsonConverter -{ - public override RoleQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.RoleQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBool)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantBool.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "bool") + if (reader.ValueTextEquals(VariantExists)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExists.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "exists") + if (reader.ValueTextEquals(VariantIds)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIds.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ids") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantMatchAll)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchAll.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_all") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantSimpleQueryString)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSimpleQueryString.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "simple_query_string") + if (reader.ValueTextEquals(VariantTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "term") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RoleQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new RoleQuery(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, RoleQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleQuery value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "bool": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); - break; - case "exists": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); - break; - case "ids": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); - break; - case "match_all": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "simple_query_string": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); - break; - case "term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); - break; - } + case null: + break; + case "bool": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, null, null); + break; + case "exists": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, null, null); + break; + case "ids": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, null, null); + break; + case "match_all": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery)value.Variant, null, null); + break; + case "simple_query_string": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, null, null); + break; + case "term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Security.RoleQuery)}'."); } writer.WriteEndObject(); } } -public sealed partial class RoleQueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleQueryConverter))] +public sealed partial class RoleQuery { - internal RoleQueryDescriptor(Action> configure) => configure.Invoke(this); - - public RoleQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RoleQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private RoleQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public RoleQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); - public RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public RoleQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public RoleQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public RoleQueryDescriptor Match(Action> configure) => Set(configure, "match"); - public RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public RoleQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public RoleQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public RoleQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); - public RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public RoleQueryDescriptor Term(Action> configure) => Set(configure, "term"); - public RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public RoleQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); - public RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public RoleQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public RoleQuery() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + } +#endif +#if !NET7_0_OR_GREATER + public RoleQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? Bool { get => GetVariant("bool"); set => SetVariant("bool", value); } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? Exists { get => GetVariant("exists"); set => SetVariant("exists", value); } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? Ids { get => GetVariant("ids"); set => SetVariant("ids", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? MatchAll { get => GetVariant("match_all"); set => SetVariant("match_all", value); } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? SimpleQueryString { get => GetVariant("simple_query_string"); set => SetVariant("simple_query_string", value); } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? Term { get => GetVariant("term"); set => SetVariant("term", value); } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Bool = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Exists = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Ids = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Match = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { MatchAll = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Prefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { SimpleQueryString = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Term = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery value) => new Elastic.Clients.Elasticsearch.Security.RoleQuery { Wildcard = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class RoleQueryDescriptor : SerializableDescriptor +public readonly partial struct RoleQueryDescriptor { - internal RoleQueryDescriptor(Action configure) => configure.Invoke(this); - - public RoleQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RoleQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private RoleQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public RoleQueryDescriptor Bool(Action configure) => Set(configure, "bool"); - public RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public RoleQueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public RoleQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public RoleQueryDescriptor Match(Action configure) => Set(configure, "match"); - public RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public RoleQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public RoleQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public RoleQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); - public RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public RoleQueryDescriptor Term(Action configure) => Set(configure, "term"); - public RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public RoleQueryDescriptor Terms(Action configure) => Set(configure, "terms"); - public RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public RoleQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal Elastic.Clients.Elasticsearch.Security.RoleQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleQueryDescriptor(Elastic.Clients.Elasticsearch.Security.RoleQuery instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance = instance; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WriteEndObject(); + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(Elastic.Clients.Elasticsearch.Security.RoleQuery instance) => new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct RoleQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.RoleQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleQueryDescriptor(Elastic.Clients.Elasticsearch.Security.RoleQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(Elastic.Clients.Elasticsearch.Security.RoleQuery instance) => new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool(System.Action? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// matches roles matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Exists(System.Action action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns roles based on their IDs. + /// This query uses role document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Match(System.Action action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all roles, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Range(System.Func action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor SimpleQueryString(System.Action action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Term(System.Action action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Terms(System.Action action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns roles that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RoleQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs index 2e199816d95..2440efb702e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs @@ -17,92 +17,141 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class RoleTemplateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFormat = System.Text.Json.JsonEncodedText.Encode("format"); + private static readonly System.Text.Json.JsonEncodedText PropTemplate = System.Text.Json.JsonEncodedText.Encode("template"); + + public override Elastic.Clients.Elasticsearch.Security.RoleTemplate Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFormat = default; + LocalJsonValue propTemplate = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFormat.TryReadProperty(ref reader, options, PropFormat, null)) + { + continue; + } + + if (propTemplate.TryReadProperty(ref reader, options, PropTemplate, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.RoleTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Format = propFormat.Value, + Template = propTemplate.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.RoleTemplate value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFormat, value.Format, null, null); + writer.WriteProperty(options, PropTemplate, value.Template, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.RoleTemplateConverter))] public sealed partial class RoleTemplate { - [JsonInclude, JsonPropertyName("format")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleTemplate(Elastic.Clients.Elasticsearch.Script template) + { + Template = template; + } +#if NET7_0_OR_GREATER + public RoleTemplate() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoleTemplate() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Security.TemplateFormat? Format { get; set; } - [JsonInclude, JsonPropertyName("template")] - public Elastic.Clients.Elasticsearch.Script Template { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Script Template { get; set; } } -public sealed partial class RoleTemplateDescriptor : SerializableDescriptor +public readonly partial struct RoleTemplateDescriptor { - internal RoleTemplateDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.RoleTemplate Instance { get; init; } - public RoleTemplateDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleTemplateDescriptor(Elastic.Clients.Elasticsearch.Security.RoleTemplate instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Security.TemplateFormat? FormatValue { get; set; } - private Elastic.Clients.Elasticsearch.Script TemplateValue { get; set; } - private Elastic.Clients.Elasticsearch.ScriptDescriptor TemplateDescriptor { get; set; } - private Action TemplateDescriptorAction { get; set; } - - public RoleTemplateDescriptor Format(Elastic.Clients.Elasticsearch.Security.TemplateFormat? format) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleTemplateDescriptor() { - FormatValue = format; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Security.RoleTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.Script template) + public static explicit operator Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(Elastic.Clients.Elasticsearch.Security.RoleTemplate instance) => new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.RoleTemplate(Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor Format(Elastic.Clients.Elasticsearch.Security.TemplateFormat? value) { - TemplateDescriptor = null; - TemplateDescriptorAction = null; - TemplateValue = template; - return Self; + Instance.Format = value; + return this; } - public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.Script value) { - TemplateValue = null; - TemplateDescriptorAction = null; - TemplateDescriptor = descriptor; - return Self; + Instance.Template = value; + return this; } - public RoleTemplateDescriptor Template(Action configure) + public Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor Template() { - TemplateValue = null; - TemplateDescriptor = null; - TemplateDescriptorAction = configure; - return Self; + Instance.Template = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor Template(System.Action? action) { - writer.WriteStartObject(); - if (FormatValue is not null) - { - writer.WritePropertyName("format"); - JsonSerializer.Serialize(writer, FormatValue, options); - } - - if (TemplateDescriptor is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateDescriptor, options); - } - else if (TemplateDescriptorAction is not null) - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(TemplateDescriptorAction), options); - } - else - { - writer.WritePropertyName("template"); - JsonSerializer.Serialize(writer, TemplateValue, options); - } + Instance.Template = Elastic.Clients.Elasticsearch.ScriptDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.RoleTemplate Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(new Elastic.Clients.Elasticsearch.Security.RoleTemplate(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SearchAccess.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SearchAccess.g.cs index 04a4ac7ddc5..4f329afeb36 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SearchAccess.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SearchAccess.g.cs @@ -17,24 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class SearchAccessConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSecurity = System.Text.Json.JsonEncodedText.Encode("field_security"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Security.SearchAccess Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue propFieldSecurity = default; + LocalJsonValue> propNames = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propFieldSecurity.TryReadProperty(ref reader, options, PropFieldSecurity, null)) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + FieldSecurity = propFieldSecurity.Value, + Names = propNames.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SearchAccess value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropFieldSecurity, value.FieldSecurity, null, null); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SearchAccessConverter))] public sealed partial class SearchAccess { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAccess(System.Collections.Generic.ICollection names) + { + Names = names; + } +#if NET7_0_OR_GREATER + public SearchAccess() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchAccess() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] public bool? AllowRestrictedIndices { get; set; } /// @@ -42,7 +126,6 @@ public sealed partial class SearchAccess /// The document fields that the owners of the role have read access to. /// /// - [JsonInclude, JsonPropertyName("field_security")] public Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurity { get; set; } /// @@ -50,43 +133,48 @@ public sealed partial class SearchAccess /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.IndexName))] - public ICollection Names { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } /// /// /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. /// /// - [JsonInclude, JsonPropertyName("query")] public object? Query { get; set; } } -public sealed partial class SearchAccessDescriptor : SerializableDescriptor> +public readonly partial struct SearchAccessDescriptor { - internal SearchAccessDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SearchAccess Instance { get; init; } - public SearchAccessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAccessDescriptor(Elastic.Clients.Elasticsearch.Security.SearchAccess instance) { + Instance = instance; } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action> FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private object? QueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAccessDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(Elastic.Clients.Elasticsearch.Security.SearchAccess instance) => new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public SearchAccessDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -94,28 +182,32 @@ public SearchAccessDescriptor AllowRestrictedIndices(bool? allowRestr /// The document fields that the owners of the role have read access to. /// /// - public SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public SearchAccessDescriptor FieldSecurity(Action> configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity(System.Action>? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// @@ -123,84 +215,71 @@ public SearchAccessDescriptor FieldSecurity(Action /// - public SearchAccessDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Names(System.Collections.Generic.ICollection value) { - NamesValue = names; - return Self; + Instance.Names = value; + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public SearchAccessDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - QueryValue = query; - return Self; + Instance.Names = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Query(object? value) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } - - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } - - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SearchAccess Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(new Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SearchAccessDescriptor : SerializableDescriptor +public readonly partial struct SearchAccessDescriptor { - internal SearchAccessDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SearchAccess Instance { get; init; } - public SearchAccessDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAccessDescriptor(Elastic.Clients.Elasticsearch.Security.SearchAccess instance) { + Instance = instance; } - private bool? AllowRestrictedIndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } - private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } - private Action FieldSecurityDescriptorAction { get; set; } - private ICollection NamesValue { get; set; } - private object? QueryValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchAccessDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(Elastic.Clients.Elasticsearch.Security.SearchAccess instance) => new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor descriptor) => descriptor.Instance; /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - public SearchAccessDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor AllowRestrictedIndices(bool? value = true) { - AllowRestrictedIndicesValue = allowRestrictedIndices; - return Self; + Instance.AllowRestrictedIndices = value; + return this; } /// @@ -208,85 +287,83 @@ public SearchAccessDescriptor AllowRestrictedIndices(bool? allowRestrictedIndice /// The document fields that the owners of the role have read access to. /// /// - public SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? value) { - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = null; - FieldSecurityValue = fieldSecurity; - return Self; + Instance.FieldSecurity = value; + return this; } - public SearchAccessDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity() { - FieldSecurityValue = null; - FieldSecurityDescriptorAction = null; - FieldSecurityDescriptor = descriptor; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(null); + return this; } - public SearchAccessDescriptor FieldSecurity(Action configure) + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity(System.Action? action) { - FieldSecurityValue = null; - FieldSecurityDescriptor = null; - FieldSecurityDescriptorAction = configure; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// The document fields that the owners of the role have read access to. /// /// - public SearchAccessDescriptor Names(ICollection names) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor FieldSecurity(System.Action>? action) { - NamesValue = names; - return Self; + Instance.FieldSecurity = Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor.Build(action); + return this; } /// /// - /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - public SearchAccessDescriptor Query(object? query) + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Names(System.Collections.Generic.ICollection value) { - QueryValue = query; - return Self; + Instance.Names = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Names(params Elastic.Clients.Elasticsearch.IndexName[] values) { - writer.WriteStartObject(); - if (AllowRestrictedIndicesValue.HasValue) - { - writer.WritePropertyName("allow_restricted_indices"); - writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); - } - - if (FieldSecurityDescriptor is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); - } - else if (FieldSecurityDescriptorAction is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); - } - else if (FieldSecurityValue is not null) - { - writer.WritePropertyName("field_security"); - JsonSerializer.Serialize(writer, FieldSecurityValue, options); - } + Instance.Names = [.. values]; + return this; + } - writer.WritePropertyName("names"); - SingleOrManySerializationHelper.Serialize(NamesValue, writer, options); - if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor Query(object? value) + { + Instance.Query = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SearchAccess Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.SearchAccessDescriptor(new Elastic.Clients.Elasticsearch.Security.SearchAccess(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SecuritySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SecuritySettings.g.cs index 6fa6be1e3cf..26f4f51d28c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SecuritySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/SecuritySettings.g.cs @@ -17,136 +17,177 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class SecuritySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + + public override Elastic.Clients.Elasticsearch.Security.SecuritySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.SecuritySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.SecuritySettingsConverter))] public sealed partial class SecuritySettings { - [JsonInclude, JsonPropertyName("index")] +#if NET7_0_OR_GREATER + public SecuritySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public SecuritySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Index { get; set; } } -public sealed partial class SecuritySettingsDescriptor : SerializableDescriptor> +public readonly partial struct SecuritySettingsDescriptor { - internal SecuritySettingsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SecuritySettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecuritySettingsDescriptor(Elastic.Clients.Elasticsearch.Security.SecuritySettings instance) + { + Instance = instance; + } - public SecuritySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecuritySettingsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexDescriptor { get; set; } - private Action> IndexDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(Elastic.Clients.Elasticsearch.Security.SecuritySettings instance) => new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) => descriptor.Instance; - public SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? index) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index() { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptor = descriptor; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public SecuritySettingsDescriptor Index(Action> configure) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index(System.Action>? action) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = configure; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SecuritySettings Build(System.Action>? action) { - writer.WriteStartObject(); - if (IndexDescriptor is not null) + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexDescriptorAction), options); - } - else if (IndexValue is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SecuritySettingsDescriptor : SerializableDescriptor +public readonly partial struct SecuritySettingsDescriptor { - internal SecuritySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Security.SecuritySettings Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecuritySettingsDescriptor(Elastic.Clients.Elasticsearch.Security.SecuritySettings instance) + { + Instance = instance; + } - public SecuritySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecuritySettingsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? IndexValue { get; set; } - private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor IndexDescriptor { get; set; } - private Action IndexDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(Elastic.Clients.Elasticsearch.Security.SecuritySettings instance) => new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor descriptor) => descriptor.Instance; - public SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? index) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? value) { - IndexDescriptor = null; - IndexDescriptorAction = null; - IndexValue = index; - return Self; + Instance.Index = value; + return this; } - public SecuritySettingsDescriptor Index(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index() { - IndexValue = null; - IndexDescriptorAction = null; - IndexDescriptor = descriptor; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(null); + return this; } - public SecuritySettingsDescriptor Index(Action configure) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index(System.Action? action) { - IndexValue = null; - IndexDescriptor = null; - IndexDescriptorAction = configure; - return Self; + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor Index(System.Action>? action) { - writer.WriteStartObject(); - if (IndexDescriptor is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexDescriptor, options); - } - else if (IndexDescriptorAction is not null) - { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor(IndexDescriptorAction), options); - } - else if (IndexValue is not null) + Instance.Index = Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.SecuritySettings Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Security.SecuritySettingsDescriptor(new Elastic.Clients.Elasticsearch.Security.SecuritySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs index 0fa2564b996..1b39401c81f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class ServiceTokenConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Security.ServiceToken Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.ServiceToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.ServiceToken value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.ServiceTokenConverter))] public sealed partial class ServiceToken { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("value")] - public string Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ServiceToken(string name, string value) + { + Name = name; + Value = value; + } +#if NET7_0_OR_GREATER + public ServiceToken() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ServiceToken() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ServiceToken(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs index 1f3df93d64b..7e6ed4fd743 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class TotalUserProfilesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRelation = System.Text.Json.JsonEncodedText.Encode("relation"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.Security.TotalUserProfiles Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRelation = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRelation.TryReadProperty(ref reader, options, PropRelation, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.TotalUserProfiles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Relation = propRelation.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.TotalUserProfiles value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRelation, value.Relation, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.TotalUserProfilesConverter))] public sealed partial class TotalUserProfiles { - [JsonInclude, JsonPropertyName("relation")] - public string Relation { get; init; } - [JsonInclude, JsonPropertyName("value")] - public long Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TotalUserProfiles(string relation, long value) + { + Relation = relation; + Value = value; + } +#if NET7_0_OR_GREATER + public TotalUserProfiles() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TotalUserProfiles() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TotalUserProfiles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Relation { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs index f3a06dc3855..d5a5e577b5b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs @@ -17,30 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropProfileUid = System.Text.Json.JsonEncodedText.Encode("profile_uid"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.User Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEmail = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullName = default; + LocalJsonValue> propMetadata = default; + LocalJsonValue propProfileUid = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propProfileUid.TryReadProperty(ref reader, options, PropProfileUid, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.User(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Email = propEmail.Value, + Enabled = propEnabled.Value, + FullName = propFullName.Value, + Metadata = propMetadata.Value, + ProfileUid = propProfileUid.Value, + Roles = propRoles.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.User value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropProfileUid, value.ProfileUid, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserConverter))] public sealed partial class User { - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary Metadata { get; init; } - [JsonInclude, JsonPropertyName("profile_uid")] - public string? ProfileUid { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public User(bool enabled, System.Collections.Generic.IReadOnlyDictionary metadata, System.Collections.Generic.IReadOnlyCollection roles, string username) + { + Enabled = enabled; + Metadata = metadata; + Roles = roles; + Username = username; + } +#if NET7_0_OR_GREATER + public User() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public User() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal User(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Email { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public string? FullName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Metadata { get; set; } + public string? ProfileUid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs index 5bacdaccaa6..d71618c851c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs @@ -17,56 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserIndicesPrivilegesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAllowRestrictedIndices = System.Text.Json.JsonEncodedText.Encode("allow_restricted_indices"); + private static readonly System.Text.Json.JsonEncodedText PropFieldSecurity = System.Text.Json.JsonEncodedText.Encode("field_security"); + private static readonly System.Text.Json.JsonEncodedText PropNames = System.Text.Json.JsonEncodedText.Encode("names"); + private static readonly System.Text.Json.JsonEncodedText PropPrivileges = System.Text.Json.JsonEncodedText.Encode("privileges"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + + public override Elastic.Clients.Elasticsearch.Security.UserIndicesPrivileges Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAllowRestrictedIndices = default; + LocalJsonValue?> propFieldSecurity = default; + LocalJsonValue> propNames = default; + LocalJsonValue> propPrivileges = default; + LocalJsonValue propQuery = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAllowRestrictedIndices.TryReadProperty(ref reader, options, PropAllowRestrictedIndices, null)) + { + continue; + } + + if (propFieldSecurity.TryReadProperty(ref reader, options, PropFieldSecurity, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propNames.TryReadProperty(ref reader, options, PropNames, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (propPrivileges.TryReadProperty(ref reader, options, PropPrivileges, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AllowRestrictedIndices = propAllowRestrictedIndices.Value, + FieldSecurity = propFieldSecurity.Value, + Names = propNames.Value, + Privileges = propPrivileges.Value, + Query = propQuery.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserIndicesPrivileges value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAllowRestrictedIndices, value.AllowRestrictedIndices, null, null); + writer.WriteProperty(options, PropFieldSecurity, value.FieldSecurity, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropNames, value.Names, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropPrivileges, value.Privileges, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserIndicesPrivilegesConverter))] public sealed partial class UserIndicesPrivileges { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserIndicesPrivileges(bool allowRestrictedIndices, System.Collections.Generic.ICollection names, System.Collections.Generic.IReadOnlyCollection privileges) + { + AllowRestrictedIndices = allowRestrictedIndices; + Names = names; + Privileges = privileges; + } +#if NET7_0_OR_GREATER + public UserIndicesPrivileges() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserIndicesPrivileges() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserIndicesPrivileges(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. /// /// - [JsonInclude, JsonPropertyName("allow_restricted_indices")] - public bool AllowRestrictedIndices { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool AllowRestrictedIndices { get; set; } /// /// /// The document fields that the owners of the role have read access to. /// /// - [JsonInclude, JsonPropertyName("field_security")] - public IReadOnlyCollection? FieldSecurity { get; init; } + public System.Collections.Generic.IReadOnlyCollection? FieldSecurity { get; set; } /// /// /// A list of indices (or index name patterns) to which the permissions in this entry apply. /// /// - [JsonInclude, JsonPropertyName("names")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Names { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Names { get; set; } /// /// /// The index level privileges that owners of the role have on the specified indices. /// /// - [JsonInclude, JsonPropertyName("privileges")] - public IReadOnlyCollection Privileges { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Privileges { get; set; } /// /// /// Search queries that define the documents the user has access to. A document within the specified indices must match these queries for it to be accessible by the owners of the role. /// /// - [JsonInclude, JsonPropertyName("query")] - public object? Query { get; init; } + public object? Query { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs index 8745d1af77e..09f134ea338 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserProfileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Security.UserProfile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propData = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propLabels = default; + LocalJsonValue propUid = default; + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Enabled = propEnabled.Value, + Labels = propLabels.Value, + Uid = propUid.Value, + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserProfile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserProfileConverter))] public sealed partial class UserProfile { - [JsonInclude, JsonPropertyName("data")] - public IReadOnlyDictionary Data { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool? Enabled { get; init; } - [JsonInclude, JsonPropertyName("labels")] - public IReadOnlyDictionary Labels { get; init; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; init; } - [JsonInclude, JsonPropertyName("user")] - public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserProfile(System.Collections.Generic.IReadOnlyDictionary data, System.Collections.Generic.IReadOnlyDictionary labels, string uid, Elastic.Clients.Elasticsearch.Security.UserProfileUser user) + { + Data = data; + Labels = labels; + Uid = uid; + User = user; + } +#if NET7_0_OR_GREATER + public UserProfile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserProfile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserProfile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Data { get; set; } + public bool? Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Labels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs index b6edf632d5f..61437eb17cc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserProfileHitMetadataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropSeqNo = System.Text.Json.JsonEncodedText.Encode("_seq_no"); + + public override Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propSeqNo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) + { + continue; + } + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PrimaryTerm = propPrimaryTerm.Value, + SeqNo = propSeqNo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadataConverter))] public sealed partial class UserProfileHitMetadata { - [JsonInclude, JsonPropertyName("_primary_term")] - public long PrimaryTerm { get; init; } - [JsonInclude, JsonPropertyName("_seq_no")] - public long SeqNo { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserProfileHitMetadata(long primaryTerm, long seqNo) + { + PrimaryTerm = primaryTerm; + SeqNo = seqNo; + } +#if NET7_0_OR_GREATER + public UserProfileHitMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserProfileHitMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserProfileHitMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryTerm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SeqNo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs index 0c841277199..a600aa19269 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs @@ -17,28 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserProfileUserConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEmail = System.Text.Json.JsonEncodedText.Encode("email"); + private static readonly System.Text.Json.JsonEncodedText PropFullName = System.Text.Json.JsonEncodedText.Encode("full_name"); + private static readonly System.Text.Json.JsonEncodedText PropRealmDomain = System.Text.Json.JsonEncodedText.Encode("realm_domain"); + private static readonly System.Text.Json.JsonEncodedText PropRealmName = System.Text.Json.JsonEncodedText.Encode("realm_name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropUsername = System.Text.Json.JsonEncodedText.Encode("username"); + + public override Elastic.Clients.Elasticsearch.Security.UserProfileUser Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEmail = default; + LocalJsonValue propFullName = default; + LocalJsonValue propRealmDomain = default; + LocalJsonValue propRealmName = default; + LocalJsonValue> propRoles = default; + LocalJsonValue propUsername = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEmail.TryReadProperty(ref reader, options, PropEmail, null)) + { + continue; + } + + if (propFullName.TryReadProperty(ref reader, options, PropFullName, null)) + { + continue; + } + + if (propRealmDomain.TryReadProperty(ref reader, options, PropRealmDomain, null)) + { + continue; + } + + if (propRealmName.TryReadProperty(ref reader, options, PropRealmName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propUsername.TryReadProperty(ref reader, options, PropUsername, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserProfileUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Email = propEmail.Value, + FullName = propFullName.Value, + RealmDomain = propRealmDomain.Value, + RealmName = propRealmName.Value, + Roles = propRoles.Value, + Username = propUsername.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserProfileUser value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEmail, value.Email, null, null); + writer.WriteProperty(options, PropFullName, value.FullName, null, null); + writer.WriteProperty(options, PropRealmDomain, value.RealmDomain, null, null); + writer.WriteProperty(options, PropRealmName, value.RealmName, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropUsername, value.Username, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserProfileUserConverter))] public sealed partial class UserProfileUser { - [JsonInclude, JsonPropertyName("email")] - public string? Email { get; init; } - [JsonInclude, JsonPropertyName("full_name")] - public string? FullName { get; init; } - [JsonInclude, JsonPropertyName("realm_domain")] - public string? RealmDomain { get; init; } - [JsonInclude, JsonPropertyName("realm_name")] - public string RealmName { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection Roles { get; init; } - [JsonInclude, JsonPropertyName("username")] - public string Username { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserProfileUser(string realmName, System.Collections.Generic.IReadOnlyCollection roles, string username) + { + RealmName = realmName; + Roles = roles; + Username = username; + } +#if NET7_0_OR_GREATER + public UserProfileUser() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserProfileUser() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserProfileUser(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Email { get; set; } + public string? FullName { get; set; } + public string? RealmDomain { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string RealmName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Username { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs index fd3c5532dee..ce64bfae5c6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs @@ -17,30 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserProfileWithMetadataConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropData = System.Text.Json.JsonEncodedText.Encode("data"); + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("_doc"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropLabels = System.Text.Json.JsonEncodedText.Encode("labels"); + private static readonly System.Text.Json.JsonEncodedText PropLastSynchronized = System.Text.Json.JsonEncodedText.Encode("last_synchronized"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + private static readonly System.Text.Json.JsonEncodedText PropUser = System.Text.Json.JsonEncodedText.Encode("user"); + + public override Elastic.Clients.Elasticsearch.Security.UserProfileWithMetadata Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propData = default; + LocalJsonValue propDoc = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propLabels = default; + LocalJsonValue propLastSynchronized = default; + LocalJsonValue propUid = default; + LocalJsonValue propUser = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propData.TryReadProperty(ref reader, options, PropData, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propLabels.TryReadProperty(ref reader, options, PropLabels, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propLastSynchronized.TryReadProperty(ref reader, options, PropLastSynchronized, null)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (propUser.TryReadProperty(ref reader, options, PropUser, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserProfileWithMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Data = propData.Value, + Doc = propDoc.Value, + Enabled = propEnabled.Value, + Labels = propLabels.Value, + LastSynchronized = propLastSynchronized.Value, + Uid = propUid.Value, + User = propUser.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserProfileWithMetadata value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropData, value.Data, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropLabels, value.Labels, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropLastSynchronized, value.LastSynchronized, null, null); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteProperty(options, PropUser, value.User, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserProfileWithMetadataConverter))] public sealed partial class UserProfileWithMetadata { - [JsonInclude, JsonPropertyName("data")] - public IReadOnlyDictionary Data { get; init; } - [JsonInclude, JsonPropertyName("_doc")] - public Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool? Enabled { get; init; } - [JsonInclude, JsonPropertyName("labels")] - public IReadOnlyDictionary Labels { get; init; } - [JsonInclude, JsonPropertyName("last_synchronized")] - public long LastSynchronized { get; init; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; init; } - [JsonInclude, JsonPropertyName("user")] - public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserProfileWithMetadata(System.Collections.Generic.IReadOnlyDictionary data, Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata doc, System.Collections.Generic.IReadOnlyDictionary labels, long lastSynchronized, string uid, Elastic.Clients.Elasticsearch.Security.UserProfileUser user) + { + Data = data; + Doc = doc; + Labels = labels; + LastSynchronized = lastSynchronized; + Uid = uid; + User = user; + } +#if NET7_0_OR_GREATER + public UserProfileWithMetadata() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserProfileWithMetadata() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserProfileWithMetadata(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Data { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; set; } + public bool? Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Labels { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LastSynchronized { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs index 28be18858ab..0c9eaeabaf6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs @@ -17,368 +17,1044 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; -[JsonConverter(typeof(UserQueryConverter))] -public sealed partial class UserQuery +internal sealed partial class UserQueryConverter : System.Text.Json.Serialization.JsonConverter { - internal UserQuery(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } - - internal object Variant { get; } - internal string VariantName { get; } - - public static UserQuery Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new UserQuery("bool", boolQuery); - public static UserQuery Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new UserQuery("exists", existsQuery); - public static UserQuery Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new UserQuery("ids", idsQuery); - public static UserQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new UserQuery("match", matchQuery); - public static UserQuery MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new UserQuery("match_all", matchAllQuery); - public static UserQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new UserQuery("prefix", prefixQuery); - public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); - public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); - public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); - public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); - public static UserQuery SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new UserQuery("simple_query_string", simpleQueryStringQuery); - public static UserQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new UserQuery("term", termQuery); - public static UserQuery Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new UserQuery("terms", termsQuery); - public static UserQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new UserQuery("wildcard", wildcardQuery); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class - { - result = default; - if (Variant is T variant) - { - result = variant; - return true; - } - - return false; - } -} + private static readonly System.Text.Json.JsonEncodedText VariantBool = System.Text.Json.JsonEncodedText.Encode("bool"); + private static readonly System.Text.Json.JsonEncodedText VariantExists = System.Text.Json.JsonEncodedText.Encode("exists"); + private static readonly System.Text.Json.JsonEncodedText VariantIds = System.Text.Json.JsonEncodedText.Encode("ids"); + private static readonly System.Text.Json.JsonEncodedText VariantMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText VariantMatchAll = System.Text.Json.JsonEncodedText.Encode("match_all"); + private static readonly System.Text.Json.JsonEncodedText VariantPrefix = System.Text.Json.JsonEncodedText.Encode("prefix"); + private static readonly System.Text.Json.JsonEncodedText VariantRange = System.Text.Json.JsonEncodedText.Encode("range"); + private static readonly System.Text.Json.JsonEncodedText VariantSimpleQueryString = System.Text.Json.JsonEncodedText.Encode("simple_query_string"); + private static readonly System.Text.Json.JsonEncodedText VariantTerm = System.Text.Json.JsonEncodedText.Encode("term"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); + private static readonly System.Text.Json.JsonEncodedText VariantWildcard = System.Text.Json.JsonEncodedText.Encode("wildcard"); -internal sealed partial class UserQueryConverter : JsonConverter -{ - public override UserQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Elastic.Clients.Elasticsearch.Security.UserQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantBool)) { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantBool.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "bool") + if (reader.ValueTextEquals(VariantExists)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantExists.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "exists") + if (reader.ValueTextEquals(VariantIds)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantIds.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "ids") + if (reader.ValueTextEquals(VariantMatch)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatch.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match") + if (reader.ValueTextEquals(VariantMatchAll)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantMatchAll.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "match_all") + if (reader.ValueTextEquals(VariantPrefix)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantPrefix.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "prefix") + if (reader.ValueTextEquals(VariantRange)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantRange.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "range") + if (reader.ValueTextEquals(VariantSimpleQueryString)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantSimpleQueryString.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "simple_query_string") + if (reader.ValueTextEquals(VariantTerm)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerm.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "term") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (reader.ValueTextEquals(VariantWildcard)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantWildcard.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "wildcard") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'UserQuery' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new UserQuery(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, UserQuery value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserQuery value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "bool": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); - break; - case "exists": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); - break; - case "ids": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); - break; - case "match": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); - break; - case "match_all": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); - break; - case "prefix": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); - break; - case "range": - JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); - break; - case "simple_query_string": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); - break; - case "term": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); - break; - case "wildcard": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); - break; - } + case null: + break; + case "bool": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, null, null); + break; + case "exists": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, null, null); + break; + case "ids": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, null, null); + break; + case "match": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, null, null); + break; + case "match_all": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, null, null); + break; + case "prefix": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, null, null); + break; + case "range": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery)value.Variant, null, null); + break; + case "simple_query_string": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, null, null); + break; + case "term": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, null, null); + break; + case "wildcard": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Security.UserQuery)}'."); } writer.WriteEndObject(); } } -public sealed partial class UserQueryDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserQueryConverter))] +public sealed partial class UserQuery { - internal UserQueryDescriptor(Action> configure) => configure.Invoke(this); - - public UserQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private UserQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public UserQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); - public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public UserQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public UserQueryDescriptor Match(Action> configure) => Set(configure, "match"); - public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public UserQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public UserQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); - public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public UserQueryDescriptor Term(Action> configure) => Set(configure, "term"); - public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public UserQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); - public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public UserQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public UserQuery() { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + } +#endif +#if !NET7_0_OR_GREATER + public UserQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? Bool { get => GetVariant("bool"); set => SetVariant("bool", value); } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? Exists { get => GetVariant("exists"); set => SetVariant("exists", value); } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? Ids { get => GetVariant("ids"); set => SetVariant("ids", value); } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? Match { get => GetVariant("match"); set => SetVariant("match", value); } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? MatchAll { get => GetVariant("match_all"); set => SetVariant("match_all", value); } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? Prefix { get => GetVariant("prefix"); set => SetVariant("prefix", value); } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? Range { get => GetVariant("range"); set => SetVariant("range", value); } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? SimpleQueryString { get => GetVariant("simple_query_string"); set => SetVariant("simple_query_string", value); } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? Term { get => GetVariant("term"); set => SetVariant("term", value); } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? Wildcard { get => GetVariant("wildcard"); set => SetVariant("wildcard", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Bool = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Exists = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Ids = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Match = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { MatchAll = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Prefix = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Range = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { SimpleQueryString = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Term = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Terms = value }; + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery value) => new Elastic.Clients.Elasticsearch.Security.UserQuery { Wildcard = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; } - writer.WriteEndObject(); + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; } } -public sealed partial class UserQueryDescriptor : SerializableDescriptor +public readonly partial struct UserQueryDescriptor { - internal UserQueryDescriptor(Action configure) => configure.Invoke(this); - - public UserQueryDescriptor() : base() - { - } - - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor - { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; - } - - private UserQueryDescriptor Set(object variant, string variantName) - { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; - } - - public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); - public UserQueryDescriptor Bool(Action configure) => Set(configure, "bool"); - public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); - public UserQueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); - public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); - public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); - public UserQueryDescriptor Match(Action configure) => Set(configure, "match"); - public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); - public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); - public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); - public UserQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); - public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); - public UserQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); - public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); - public UserQueryDescriptor Term(Action configure) => Set(configure, "term"); - public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); - public UserQueryDescriptor Terms(Action configure) => Set(configure, "terms"); - public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); - public UserQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal Elastic.Clients.Elasticsearch.Security.UserQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserQueryDescriptor(Elastic.Clients.Elasticsearch.Security.UserQuery instance) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance = instance; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WriteEndObject(); + public static explicit operator Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(Elastic.Clients.Elasticsearch.Security.UserQuery instance) => new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UserQuery Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} + +public readonly partial struct UserQueryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Security.UserQuery Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserQueryDescriptor(Elastic.Clients.Elasticsearch.Security.UserQuery instance) + { + Instance = instance; + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserQueryDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(Elastic.Clients.Elasticsearch.Security.UserQuery instance) => new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery? value) + { + Instance.Bool = value; + return this; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool() + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool(System.Action? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// matches users matching boolean combinations of other queries. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Bool(System.Action>? action) + { + Instance.Bool = Elastic.Clients.Elasticsearch.QueryDsl.BoolQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery? value) + { + Instance.Exists = value; + return this; + } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Exists(System.Action action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an indexed value for a field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Exists(System.Action> action) + { + Instance.Exists = Elastic.Clients.Elasticsearch.QueryDsl.ExistsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery? value) + { + Instance.Ids = value; + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids() + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Returns users based on their IDs. + /// This query uses the user document IDs stored in the _id field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Ids(System.Action? action) + { + Instance.Ids = Elastic.Clients.Elasticsearch.QueryDsl.IdsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery? value) + { + Instance.Match = value; + return this; + } + + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Match(System.Action action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that match a provided text, number, date or boolean value. + /// The provided text is analyzed before matching. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Match(System.Action> action) + { + Instance.Match = Elastic.Clients.Elasticsearch.QueryDsl.MatchQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery? value) + { + Instance.MatchAll = value; + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll() + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(null); + return this; + } + + /// + /// + /// Matches all users, giving them all a _score of 1.0. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor MatchAll(System.Action? action) + { + Instance.MatchAll = Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery? value) + { + Instance.Prefix = value; + return this; + } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Prefix(System.Action action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain a specific prefix in a provided field. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Prefix(System.Action> action) + { + Instance.Prefix = Elastic.Clients.Elasticsearch.QueryDsl.PrefixQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery? value) + { + Instance.Range = value; + return this; + } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Range(System.Func action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms within a provided range. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Range(System.Func, Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery> action) + { + Instance.Range = Elastic.Clients.Elasticsearch.QueryDsl.IRangeQueryFactory.Build(action); + return this; + } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery? value) + { + Instance.SimpleQueryString = value; + return this; + } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor SimpleQueryString(System.Action action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor SimpleQueryString(System.Action> action) + { + Instance.SimpleQueryString = Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery? value) + { + Instance.Term = value; + return this; + } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Term(System.Action action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain an exact term in a provided field. + /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Term(System.Action> action) + { + Instance.Term = Elastic.Clients.Elasticsearch.QueryDsl.TermQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery? value) + { + Instance.Terms = value; + return this; + } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Terms(System.Action action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain one or more exact terms in a provided field. + /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Terms(System.Action> action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery? value) + { + Instance.Wildcard = value; + return this; + } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Wildcard(System.Action action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + /// + /// + /// Returns users that contain terms matching a wildcard pattern. + /// + /// + public Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor Wildcard(System.Action> action) + { + Instance.Wildcard = Elastic.Clients.Elasticsearch.QueryDsl.WildcardQueryDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Security.UserQuery Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(new Elastic.Clients.Elasticsearch.Security.UserQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs index bc09aff3c5f..d94d532b2c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Security; +internal sealed partial class UserRealmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Security.UserRealm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Security.UserRealm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Security.UserRealm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Security.UserRealmConverter))] public sealed partial class UserRealm { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public UserRealm(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public UserRealm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public UserRealm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal UserRealm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SegmentsStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SegmentsStats.g.cs index 6f46a8cd60d..e77280ab225 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SegmentsStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SegmentsStats.g.cs @@ -17,41 +17,323 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class SegmentsStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDocValuesMemory = System.Text.Json.JsonEncodedText.Encode("doc_values_memory"); + private static readonly System.Text.Json.JsonEncodedText PropDocValuesMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("doc_values_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropFileSizes = System.Text.Json.JsonEncodedText.Encode("file_sizes"); + private static readonly System.Text.Json.JsonEncodedText PropFixedBitSet = System.Text.Json.JsonEncodedText.Encode("fixed_bit_set"); + private static readonly System.Text.Json.JsonEncodedText PropFixedBitSetMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("fixed_bit_set_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropIndexWriterMaxMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("index_writer_max_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropIndexWriterMemory = System.Text.Json.JsonEncodedText.Encode("index_writer_memory"); + private static readonly System.Text.Json.JsonEncodedText PropIndexWriterMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("index_writer_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxUnsafeAutoIdTimestamp = System.Text.Json.JsonEncodedText.Encode("max_unsafe_auto_id_timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropNormsMemory = System.Text.Json.JsonEncodedText.Encode("norms_memory"); + private static readonly System.Text.Json.JsonEncodedText PropNormsMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("norms_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPointsMemory = System.Text.Json.JsonEncodedText.Encode("points_memory"); + private static readonly System.Text.Json.JsonEncodedText PropPointsMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("points_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropStoredFieldsMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("stored_fields_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropStoredMemory = System.Text.Json.JsonEncodedText.Encode("stored_memory"); + private static readonly System.Text.Json.JsonEncodedText PropTermsMemory = System.Text.Json.JsonEncodedText.Encode("terms_memory"); + private static readonly System.Text.Json.JsonEncodedText PropTermsMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("terms_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTermVectorsMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("term_vectors_memory_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTermVectoryMemory = System.Text.Json.JsonEncodedText.Encode("term_vectory_memory"); + private static readonly System.Text.Json.JsonEncodedText PropVersionMapMemory = System.Text.Json.JsonEncodedText.Encode("version_map_memory"); + private static readonly System.Text.Json.JsonEncodedText PropVersionMapMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("version_map_memory_in_bytes"); + + public override Elastic.Clients.Elasticsearch.SegmentsStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propDocValuesMemory = default; + LocalJsonValue propDocValuesMemoryInBytes = default; + LocalJsonValue> propFileSizes = default; + LocalJsonValue propFixedBitSet = default; + LocalJsonValue propFixedBitSetMemoryInBytes = default; + LocalJsonValue propIndexWriterMaxMemoryInBytes = default; + LocalJsonValue propIndexWriterMemory = default; + LocalJsonValue propIndexWriterMemoryInBytes = default; + LocalJsonValue propMaxUnsafeAutoIdTimestamp = default; + LocalJsonValue propMemory = default; + LocalJsonValue propMemoryInBytes = default; + LocalJsonValue propNormsMemory = default; + LocalJsonValue propNormsMemoryInBytes = default; + LocalJsonValue propPointsMemory = default; + LocalJsonValue propPointsMemoryInBytes = default; + LocalJsonValue propStoredFieldsMemoryInBytes = default; + LocalJsonValue propStoredMemory = default; + LocalJsonValue propTermsMemory = default; + LocalJsonValue propTermsMemoryInBytes = default; + LocalJsonValue propTermVectorsMemoryInBytes = default; + LocalJsonValue propTermVectoryMemory = default; + LocalJsonValue propVersionMapMemory = default; + LocalJsonValue propVersionMapMemoryInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDocValuesMemory.TryReadProperty(ref reader, options, PropDocValuesMemory, null)) + { + continue; + } + + if (propDocValuesMemoryInBytes.TryReadProperty(ref reader, options, PropDocValuesMemoryInBytes, null)) + { + continue; + } + + if (propFileSizes.TryReadProperty(ref reader, options, PropFileSizes, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propFixedBitSet.TryReadProperty(ref reader, options, PropFixedBitSet, null)) + { + continue; + } + + if (propFixedBitSetMemoryInBytes.TryReadProperty(ref reader, options, PropFixedBitSetMemoryInBytes, null)) + { + continue; + } + + if (propIndexWriterMaxMemoryInBytes.TryReadProperty(ref reader, options, PropIndexWriterMaxMemoryInBytes, null)) + { + continue; + } + + if (propIndexWriterMemory.TryReadProperty(ref reader, options, PropIndexWriterMemory, null)) + { + continue; + } + + if (propIndexWriterMemoryInBytes.TryReadProperty(ref reader, options, PropIndexWriterMemoryInBytes, null)) + { + continue; + } + + if (propMaxUnsafeAutoIdTimestamp.TryReadProperty(ref reader, options, PropMaxUnsafeAutoIdTimestamp, null)) + { + continue; + } + + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (propMemoryInBytes.TryReadProperty(ref reader, options, PropMemoryInBytes, null)) + { + continue; + } + + if (propNormsMemory.TryReadProperty(ref reader, options, PropNormsMemory, null)) + { + continue; + } + + if (propNormsMemoryInBytes.TryReadProperty(ref reader, options, PropNormsMemoryInBytes, null)) + { + continue; + } + + if (propPointsMemory.TryReadProperty(ref reader, options, PropPointsMemory, null)) + { + continue; + } + + if (propPointsMemoryInBytes.TryReadProperty(ref reader, options, PropPointsMemoryInBytes, null)) + { + continue; + } + + if (propStoredFieldsMemoryInBytes.TryReadProperty(ref reader, options, PropStoredFieldsMemoryInBytes, null)) + { + continue; + } + + if (propStoredMemory.TryReadProperty(ref reader, options, PropStoredMemory, null)) + { + continue; + } + + if (propTermsMemory.TryReadProperty(ref reader, options, PropTermsMemory, null)) + { + continue; + } + + if (propTermsMemoryInBytes.TryReadProperty(ref reader, options, PropTermsMemoryInBytes, null)) + { + continue; + } + + if (propTermVectorsMemoryInBytes.TryReadProperty(ref reader, options, PropTermVectorsMemoryInBytes, null)) + { + continue; + } + + if (propTermVectoryMemory.TryReadProperty(ref reader, options, PropTermVectoryMemory, null)) + { + continue; + } + + if (propVersionMapMemory.TryReadProperty(ref reader, options, PropVersionMapMemory, null)) + { + continue; + } + + if (propVersionMapMemoryInBytes.TryReadProperty(ref reader, options, PropVersionMapMemoryInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SegmentsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + DocValuesMemory = propDocValuesMemory.Value, + DocValuesMemoryInBytes = propDocValuesMemoryInBytes.Value, + FileSizes = propFileSizes.Value, + FixedBitSet = propFixedBitSet.Value, + FixedBitSetMemoryInBytes = propFixedBitSetMemoryInBytes.Value, + IndexWriterMaxMemoryInBytes = propIndexWriterMaxMemoryInBytes.Value, + IndexWriterMemory = propIndexWriterMemory.Value, + IndexWriterMemoryInBytes = propIndexWriterMemoryInBytes.Value, + MaxUnsafeAutoIdTimestamp = propMaxUnsafeAutoIdTimestamp.Value, + Memory = propMemory.Value, + MemoryInBytes = propMemoryInBytes.Value, + NormsMemory = propNormsMemory.Value, + NormsMemoryInBytes = propNormsMemoryInBytes.Value, + PointsMemory = propPointsMemory.Value, + PointsMemoryInBytes = propPointsMemoryInBytes.Value, + StoredFieldsMemoryInBytes = propStoredFieldsMemoryInBytes.Value, + StoredMemory = propStoredMemory.Value, + TermsMemory = propTermsMemory.Value, + TermsMemoryInBytes = propTermsMemoryInBytes.Value, + TermVectorsMemoryInBytes = propTermVectorsMemoryInBytes.Value, + TermVectoryMemory = propTermVectoryMemory.Value, + VersionMapMemory = propVersionMapMemory.Value, + VersionMapMemoryInBytes = propVersionMapMemoryInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SegmentsStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDocValuesMemory, value.DocValuesMemory, null, null); + writer.WriteProperty(options, PropDocValuesMemoryInBytes, value.DocValuesMemoryInBytes, null, null); + writer.WriteProperty(options, PropFileSizes, value.FileSizes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropFixedBitSet, value.FixedBitSet, null, null); + writer.WriteProperty(options, PropFixedBitSetMemoryInBytes, value.FixedBitSetMemoryInBytes, null, null); + writer.WriteProperty(options, PropIndexWriterMaxMemoryInBytes, value.IndexWriterMaxMemoryInBytes, null, null); + writer.WriteProperty(options, PropIndexWriterMemory, value.IndexWriterMemory, null, null); + writer.WriteProperty(options, PropIndexWriterMemoryInBytes, value.IndexWriterMemoryInBytes, null, null); + writer.WriteProperty(options, PropMaxUnsafeAutoIdTimestamp, value.MaxUnsafeAutoIdTimestamp, null, null); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteProperty(options, PropMemoryInBytes, value.MemoryInBytes, null, null); + writer.WriteProperty(options, PropNormsMemory, value.NormsMemory, null, null); + writer.WriteProperty(options, PropNormsMemoryInBytes, value.NormsMemoryInBytes, null, null); + writer.WriteProperty(options, PropPointsMemory, value.PointsMemory, null, null); + writer.WriteProperty(options, PropPointsMemoryInBytes, value.PointsMemoryInBytes, null, null); + writer.WriteProperty(options, PropStoredFieldsMemoryInBytes, value.StoredFieldsMemoryInBytes, null, null); + writer.WriteProperty(options, PropStoredMemory, value.StoredMemory, null, null); + writer.WriteProperty(options, PropTermsMemory, value.TermsMemory, null, null); + writer.WriteProperty(options, PropTermsMemoryInBytes, value.TermsMemoryInBytes, null, null); + writer.WriteProperty(options, PropTermVectorsMemoryInBytes, value.TermVectorsMemoryInBytes, null, null); + writer.WriteProperty(options, PropTermVectoryMemory, value.TermVectoryMemory, null, null); + writer.WriteProperty(options, PropVersionMapMemory, value.VersionMapMemory, null, null); + writer.WriteProperty(options, PropVersionMapMemoryInBytes, value.VersionMapMemoryInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SegmentsStatsConverter))] public sealed partial class SegmentsStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SegmentsStats(int count, long docValuesMemoryInBytes, System.Collections.Generic.IReadOnlyDictionary fileSizes, long fixedBitSetMemoryInBytes, long indexWriterMemoryInBytes, long maxUnsafeAutoIdTimestamp, long memoryInBytes, long normsMemoryInBytes, long pointsMemoryInBytes, long storedFieldsMemoryInBytes, long termsMemoryInBytes, long termVectorsMemoryInBytes, long versionMapMemoryInBytes) + { + Count = count; + DocValuesMemoryInBytes = docValuesMemoryInBytes; + FileSizes = fileSizes; + FixedBitSetMemoryInBytes = fixedBitSetMemoryInBytes; + IndexWriterMemoryInBytes = indexWriterMemoryInBytes; + MaxUnsafeAutoIdTimestamp = maxUnsafeAutoIdTimestamp; + MemoryInBytes = memoryInBytes; + NormsMemoryInBytes = normsMemoryInBytes; + PointsMemoryInBytes = pointsMemoryInBytes; + StoredFieldsMemoryInBytes = storedFieldsMemoryInBytes; + TermsMemoryInBytes = termsMemoryInBytes; + TermVectorsMemoryInBytes = termVectorsMemoryInBytes; + VersionMapMemoryInBytes = versionMapMemoryInBytes; + } +#if NET7_0_OR_GREATER + public SegmentsStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SegmentsStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SegmentsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Total number of segments across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Total amount of memory used for doc values across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("doc_values_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? DocValuesMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? DocValuesMemory { get; set; } /// /// /// Total amount, in bytes, of memory used for doc values across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("doc_values_memory_in_bytes")] - public long DocValuesMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocValuesMemoryInBytes { get; set; } /// /// @@ -59,8 +341,11 @@ public sealed partial class SegmentsStats /// To get information on segment files, use the node stats API. /// /// - [JsonInclude, JsonPropertyName("file_sizes")] - public IReadOnlyDictionary FileSizes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary FileSizes { get; set; } /// /// @@ -68,146 +353,166 @@ public sealed partial class SegmentsStats /// Fixed bit sets are used for nested object field types and type filters for join fields. /// /// - [JsonInclude, JsonPropertyName("fixed_bit_set")] - public Elastic.Clients.Elasticsearch.ByteSize? FixedBitSet { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? FixedBitSet { get; set; } /// /// /// Total amount of memory, in bytes, used by fixed bit sets across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("fixed_bit_set_memory_in_bytes")] - public long FixedBitSetMemoryInBytes { get; init; } - [JsonInclude, JsonPropertyName("index_writer_max_memory_in_bytes")] - public long? IndexWriterMaxMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long FixedBitSetMemoryInBytes { get; set; } + public long? IndexWriterMaxMemoryInBytes { get; set; } /// /// /// Total amount of memory used by all index writers across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("index_writer_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? IndexWriterMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? IndexWriterMemory { get; set; } /// /// /// Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("index_writer_memory_in_bytes")] - public long IndexWriterMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexWriterMemoryInBytes { get; set; } /// /// /// Unix timestamp, in milliseconds, of the most recently retried indexing request. /// /// - [JsonInclude, JsonPropertyName("max_unsafe_auto_id_timestamp")] - public long MaxUnsafeAutoIdTimestamp { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MaxUnsafeAutoIdTimestamp { get; set; } /// /// /// Total amount of memory used for segments across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.ByteSize? Memory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Memory { get; set; } /// /// /// Total amount, in bytes, of memory used for segments across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("memory_in_bytes")] - public long MemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemoryInBytes { get; set; } /// /// /// Total amount of memory used for normalization factors across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("norms_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? NormsMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? NormsMemory { get; set; } /// /// /// Total amount, in bytes, of memory used for normalization factors across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("norms_memory_in_bytes")] - public long NormsMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long NormsMemoryInBytes { get; set; } /// /// /// Total amount of memory used for points across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("points_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? PointsMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? PointsMemory { get; set; } /// /// /// Total amount, in bytes, of memory used for points across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("points_memory_in_bytes")] - public long PointsMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long PointsMemoryInBytes { get; set; } /// /// /// Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("stored_fields_memory_in_bytes")] - public long StoredFieldsMemoryInBytes { get; init; } - [JsonInclude, JsonPropertyName("stored_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? StoredMemory { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long StoredFieldsMemoryInBytes { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? StoredMemory { get; set; } /// /// /// Total amount of memory used for terms across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("terms_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? TermsMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TermsMemory { get; set; } /// /// /// Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("terms_memory_in_bytes")] - public long TermsMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TermsMemoryInBytes { get; set; } /// /// /// Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("term_vectors_memory_in_bytes")] - public long TermVectorsMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TermVectorsMemoryInBytes { get; set; } /// /// /// Total amount of memory used for term vectors across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("term_vectory_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? TermVectoryMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TermVectoryMemory { get; set; } /// /// /// Total amount of memory used by all version maps across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("version_map_memory")] - public Elastic.Clients.Elasticsearch.ByteSize? VersionMapMemory { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? VersionMapMemory { get; set; } /// /// /// Total amount, in bytes, of memory used by all version maps across all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("version_map_memory_in_bytes")] - public long VersionMapMemoryInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long VersionMapMemoryInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardFailure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardFailure.g.cs index 7861d307032..4d9eeff6c25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardFailure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardFailure.g.cs @@ -17,26 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ShardFailureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropShard = System.Text.Json.JsonEncodedText.Encode("shard"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.ShardFailure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propNode = default; + LocalJsonValue propReason = default; + LocalJsonValue propShard = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propShard.TryReadProperty(ref reader, options, PropShard, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ShardFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Node = propNode.Value, + Reason = propReason.Value, + Shard = propShard.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ShardFailure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropShard, value.Shard, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ShardFailureConverter))] public sealed partial class ShardFailure { - [JsonInclude, JsonPropertyName("index")] - public string? Index { get; init; } - [JsonInclude, JsonPropertyName("node")] - public string? Node { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public Elastic.Clients.Elasticsearch.ErrorCause Reason { get; init; } - [JsonInclude, JsonPropertyName("shard")] - public int Shard { get; init; } - [JsonInclude, JsonPropertyName("status")] - public string? Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardFailure(Elastic.Clients.Elasticsearch.ErrorCause reason, int shard) + { + Reason = reason; + Shard = shard; + } +#if NET7_0_OR_GREATER + public ShardFailure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardFailure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Index { get; set; } + public string? Node { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Shard { get; set; } + public string? Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardStatistics.g.cs index bd3a30849f6..12f0024f2c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ShardStatistics.g.cs @@ -17,43 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class ShardStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropSkipped = System.Text.Json.JsonEncodedText.Encode("skipped"); + private static readonly System.Text.Json.JsonEncodedText PropSuccessful = System.Text.Json.JsonEncodedText.Encode("successful"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.ShardStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFailed = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue propSkipped = default; + LocalJsonValue propSuccessful = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSkipped.TryReadProperty(ref reader, options, PropSkipped, null)) + { + continue; + } + + if (propSuccessful.TryReadProperty(ref reader, options, PropSuccessful, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.ShardStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Failed = propFailed.Value, + Failures = propFailures.Value, + Skipped = propSkipped.Value, + Successful = propSuccessful.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.ShardStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSkipped, value.Skipped, null, null); + writer.WriteProperty(options, PropSuccessful, value.Successful, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.ShardStatisticsConverter))] public sealed partial class ShardStatistics { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardStatistics(int failed, int successful, int total) + { + Failed = failed; + Successful = successful; + Total = total; + } +#if NET7_0_OR_GREATER + public ShardStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of shards the operation or search attempted to run on but failed. /// /// - [JsonInclude, JsonPropertyName("failed")] - public int Failed { get; init; } - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } - [JsonInclude, JsonPropertyName("skipped")] - public int? Skipped { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Failed { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } + public int? Skipped { get; set; } /// /// /// The number of shards the operation or search succeeded on. /// /// - [JsonInclude, JsonPropertyName("successful")] - public int Successful { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Successful { get; set; } /// /// /// The number of shards the operation or search will run on overall. /// /// - [JsonInclude, JsonPropertyName("total")] - public int Total { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/IngestDocumentSimulation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/IngestDocumentSimulation.g.cs index 42516255062..0310dba2d67 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/IngestDocumentSimulation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/IngestDocumentSimulation.g.cs @@ -17,89 +17,108 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Simulate; -internal sealed partial class IngestDocumentSimulationConverter : JsonConverter +internal sealed partial class IngestDocumentSimulationConverter : System.Text.Json.Serialization.JsonConverter { - public override IngestDocumentSimulation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropExecutedPipelines = System.Text.Json.JsonEncodedText.Encode("executed_pipelines"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoredFields = System.Text.Json.JsonEncodedText.Encode("ignored_fields"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("_source"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("_version"); + + public override Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - Elastic.Clients.Elasticsearch.ErrorCause? error = default; - IReadOnlyCollection executedPipelines = default; - string id = default; - IReadOnlyCollection>? ignoredFields = default; - string index = default; - IReadOnlyDictionary source = default; - long version = default; - Dictionary additionalProperties = null; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue> propExecutedPipelines = default; + LocalJsonValue propId = default; + LocalJsonValue>?> propIgnoredFields = default; + LocalJsonValue propIndex = default; + System.Collections.Generic.Dictionary? propMetadata = default; + LocalJsonValue> propSource = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propExecutedPipelines.TryReadProperty(ref reader, options, PropExecutedPipelines, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propIgnoredFields.TryReadProperty(ref reader, options, PropIgnoredFields, static System.Collections.Generic.IReadOnlyCollection>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue>(o, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!))) + { + continue; + } + + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) { - var property = reader.GetString(); - if (property == "error") - { - error = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "executed_pipelines") - { - executedPipelines = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "_id") - { - id = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "ignored_fields") - { - ignoredFields = JsonSerializer.Deserialize>?>(ref reader, options); - continue; - } - - if (property == "_index") - { - index = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "_source") - { - source = JsonSerializer.Deserialize>(ref reader, options); - continue; - } - - if (property == "_version") - { - version = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - additionalProperties ??= new Dictionary(); - var additionalValue = JsonSerializer.Deserialize(ref reader, options); - additionalProperties.Add(property, additionalValue); + continue; } + + propMetadata ??= new System.Collections.Generic.Dictionary(); + reader.ReadProperty(options, out string key, out string value, null, null); + propMetadata[key] = value; } - return new IngestDocumentSimulation { Error = error, ExecutedPipelines = executedPipelines, Id = id, IgnoredFields = ignoredFields, Index = index, Metadata = additionalProperties, Source = source, Version = version }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + ExecutedPipelines = propExecutedPipelines.Value, + Id = propId.Value, + IgnoredFields = propIgnoredFields.Value, + Index = propIndex.Value, + Metadata = propMetadata, + Source = propSource.Value, + Version = propVersion.Value + }; } - public override void Write(Utf8JsonWriter writer, IngestDocumentSimulation value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulation value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'IngestDocumentSimulation' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropExecutedPipelines, value.ExecutedPipelines, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIgnoredFields, value.IgnoredFields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection>? v) => w.WriteCollectionValue>(o, v, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null))); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + if (value.Metadata is not null) + { + foreach (var item in value.Metadata) + { + writer.WriteProperty(options, item.Key, item.Value, null, null); + } + } + + writer.WriteEndObject(); } } @@ -111,9 +130,35 @@ public override void Write(Utf8JsonWriter writer, IngestDocumentSimulation value /// document had been ingested into _index. /// /// -[JsonConverter(typeof(IngestDocumentSimulationConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulationConverter))] public sealed partial class IngestDocumentSimulation { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IngestDocumentSimulation(System.Collections.Generic.IReadOnlyCollection executedPipelines, string id, string index, System.Collections.Generic.IReadOnlyDictionary source, long version) + { + ExecutedPipelines = executedPipelines; + Id = id; + Index = index; + Source = source; + Version = version; + } +#if NET7_0_OR_GREATER + public IngestDocumentSimulation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IngestDocumentSimulation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IngestDocumentSimulation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Any error resulting from simulatng ingest on this doc. This can be an error generated by @@ -121,21 +166,29 @@ public sealed partial class IngestDocumentSimulation /// doc. /// /// - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } /// /// /// A list of the names of the pipelines executed on this document. /// /// - public IReadOnlyCollection ExecutedPipelines { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection ExecutedPipelines { get; set; } /// /// /// Identifier for the document. /// /// - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// @@ -144,27 +197,39 @@ public sealed partial class IngestDocumentSimulation /// would not be indexed into Elasticsearch. /// /// - public IReadOnlyCollection>? IgnoredFields { get; init; } + public System.Collections.Generic.IReadOnlyCollection>? IgnoredFields { get; set; } /// /// /// Name of the index that the document would be indexed into if this were not a simulation. /// /// - public string Index { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } /// /// /// Additional metadata /// /// - public IReadOnlyDictionary Metadata { get; init; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } /// /// /// JSON body for the document. /// /// - public IReadOnlyDictionary Source { get; init; } - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/SimulateIngestDocumentResult.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/SimulateIngestDocumentResult.g.cs index c1e3ae9f062..b746565fdf4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/SimulateIngestDocumentResult.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Simulate/SimulateIngestDocumentResult.g.cs @@ -17,18 +17,69 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Simulate; +internal sealed partial class SimulateIngestDocumentResultConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDoc = System.Text.Json.JsonEncodedText.Encode("doc"); + + public override Elastic.Clients.Elasticsearch.Simulate.SimulateIngestDocumentResult Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDoc = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDoc.TryReadProperty(ref reader, options, PropDoc, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Simulate.SimulateIngestDocumentResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Doc = propDoc.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Simulate.SimulateIngestDocumentResult value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDoc, value.Doc, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Simulate.SimulateIngestDocumentResultConverter))] public sealed partial class SimulateIngestDocumentResult { - [JsonInclude, JsonPropertyName("doc")] - public Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulation? Doc { get; init; } +#if NET7_0_OR_GREATER + public SimulateIngestDocumentResult() + { + } +#endif +#if !NET7_0_OR_GREATER + public SimulateIngestDocumentResult() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SimulateIngestDocumentResult(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Simulate.IngestDocumentSimulation? Doc { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SlicedScroll.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SlicedScroll.g.cs index f0ae833c493..66e4c3d76a7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SlicedScroll.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SlicedScroll.g.cs @@ -17,140 +17,208 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class SlicedScrollConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + + public override Elastic.Clients.Elasticsearch.SlicedScroll Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propId = default; + LocalJsonValue propMax = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Id = propId.Value, + Max = propMax.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SlicedScroll value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SlicedScrollConverter))] public sealed partial class SlicedScroll { - [JsonInclude, JsonPropertyName("field")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlicedScroll(Elastic.Clients.Elasticsearch.Id id, int max) + { + Id = id; + Max = max; + } +#if NET7_0_OR_GREATER + public SlicedScroll() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SlicedScroll() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + public Elastic.Clients.Elasticsearch.Field? Field { get; set; } - [JsonInclude, JsonPropertyName("id")] - public Elastic.Clients.Elasticsearch.Id Id { get; set; } - [JsonInclude, JsonPropertyName("max")] - public int Max { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Id Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Max { get; set; } } -public sealed partial class SlicedScrollDescriptor : SerializableDescriptor> +public readonly partial struct SlicedScrollDescriptor { - internal SlicedScrollDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SlicedScroll Instance { get; init; } - public SlicedScrollDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlicedScrollDescriptor(Elastic.Clients.Elasticsearch.SlicedScroll instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private int MaxValue { get; set; } - - public SlicedScrollDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlicedScrollDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SlicedScrollDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(Elastic.Clients.Elasticsearch.SlicedScroll instance) => new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SlicedScrollDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SlicedScrollDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } - public SlicedScrollDescriptor Max(int max) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Max(int value) { - MaxValue = max; - return Self; + Instance.Max = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SlicedScroll Build(System.Action> action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(new Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SlicedScrollDescriptor : SerializableDescriptor +public readonly partial struct SlicedScrollDescriptor { - internal SlicedScrollDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SlicedScroll Instance { get; init; } - public SlicedScrollDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlicedScrollDescriptor(Elastic.Clients.Elasticsearch.SlicedScroll instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field? FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Id IdValue { get; set; } - private int MaxValue { get; set; } - - public SlicedScrollDescriptor Field(Elastic.Clients.Elasticsearch.Field? field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlicedScrollDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SlicedScrollDescriptor Field(Expression> field) + public static explicit operator Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(Elastic.Clients.Elasticsearch.SlicedScroll instance) => new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.SlicedScrollDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Field(Elastic.Clients.Elasticsearch.Field? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SlicedScrollDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - public SlicedScrollDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Id(Elastic.Clients.Elasticsearch.Id value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } - public SlicedScrollDescriptor Max(int max) + public Elastic.Clients.Elasticsearch.SlicedScrollDescriptor Max(int value) { - MaxValue = max; - return Self; + Instance.Max = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SlicedScroll Build(System.Action action) { - writer.WriteStartObject(); - if (FieldValue is not null) - { - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - } - - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - writer.WritePropertyName("max"); - writer.WriteNumberValue(MaxValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.SlicedScrollDescriptor(new Elastic.Clients.Elasticsearch.SlicedScroll(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs index 3feca1bb407..e3418183568 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs @@ -17,31 +17,83 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class SlicesConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Slices Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.Number, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.String); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Slices(reader.ReadValue(options, null)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Slices(reader.ReadValue(options, null)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Slices)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Slices value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, null); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, null); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + /// /// /// Slices configuration used to parallelize a process. /// /// -public sealed partial class Slices : Union +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SlicesConverter))] +public sealed partial class Slices : Elastic.Clients.Elasticsearch.Union { - public Slices(int Value) : base(Value) + public Slices(int value) : base(value) + { + } + + public Slices(Elastic.Clients.Elasticsearch.SlicesCalculation value) : base(value) + { + } + + public static implicit operator Elastic.Clients.Elasticsearch.Slices(int value) => new Elastic.Clients.Elasticsearch.Slices(value); + public static implicit operator Elastic.Clients.Elasticsearch.Slices(Elastic.Clients.Elasticsearch.SlicesCalculation value) => new Elastic.Clients.Elasticsearch.Slices(value); +} + +public readonly partial struct SlicesFactory +{ + public Elastic.Clients.Elasticsearch.Slices Value(int value) + { + return new Elastic.Clients.Elasticsearch.Slices(value); + } + + public Elastic.Clients.Elasticsearch.Slices Computed(Elastic.Clients.Elasticsearch.SlicesCalculation value) { + return new Elastic.Clients.Elasticsearch.Slices(value); } - public Slices(Elastic.Clients.Elasticsearch.SlicesCalculation Computed) : base(Computed) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Slices Build(System.Func action) { + var builder = new Elastic.Clients.Elasticsearch.SlicesFactory(); + return action.Invoke(builder); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepository.g.cs index 3e1a7221ce1..6cf9b18bcc7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepository.g.cs @@ -17,128 +17,172 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class AzureRepository : IRepository +internal sealed partial class AzureRepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + + public override Elastic.Clients.Elasticsearch.Snapshot.AzureRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } + + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.AzureRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; + } - [JsonInclude, JsonPropertyName("type")] + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.AzureRepository value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryConverter))] +public sealed partial class AzureRepository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ +#if NET7_0_OR_GREATER + public AzureRepository() + { + } +#endif +#if !NET7_0_OR_GREATER + public AzureRepository() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings? Settings { get; set; } + + /// + /// + /// The Azure repository type. + /// + /// public string Type => "azure"; - [JsonInclude, JsonPropertyName("uuid")] public string? Uuid { get; set; } } -public sealed partial class AzureRepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor +public readonly partial struct AzureRepositoryDescriptor { - internal AzureRepositoryDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.AzureRepository Instance { get; init; } - public AzureRepositoryDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.AzureRepository instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } - - public AzureRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureRepositoryDescriptor() { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.AzureRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public AzureRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor descriptor) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.AzureRepository instance) => new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.AzureRepository(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings? value) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + Instance.Settings = value; + return this; } - public AzureRepositoryDescriptor Settings(Action configure) + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor Settings() { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor.Build(null); + return this; } - public AzureRepositoryDescriptor Uuid(string? uuid) + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor Settings(System.Action? action) { - UuidValue = uuid; - return Self; + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor Uuid(string? value) { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } - - writer.WritePropertyName("type"); - writer.WriteStringValue("azure"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } - - writer.WriteEndObject(); + Instance.Uuid = value; + return this; } - private Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings BuildSettings() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.AzureRepository Build(System.Action? action) { - if (SettingsValue is not null) - { - return SettingsValue; - } - - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) + if (action is null) { - return buildable.Build(); + return new Elastic.Clients.Elasticsearch.Snapshot.AzureRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } - - return null; + var builder = new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.AzureRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } - - AzureRepository IBuildableDescriptor.Build() => new() - { - Settings = BuildSettings(), - Uuid = UuidValue - }; } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepositorySettings.g.cs index 8e1d1f9b10d..2c314c0390e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/AzureRepositorySettings.g.cs @@ -17,167 +17,485 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class AzureRepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBasePath = System.Text.Json.JsonEncodedText.Encode("base_path"); + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropClient = System.Text.Json.JsonEncodedText.Encode("client"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropContainer = System.Text.Json.JsonEncodedText.Encode("container"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteObjectsMaxSize = System.Text.Json.JsonEncodedText.Encode("delete_objects_max_size"); + private static readonly System.Text.Json.JsonEncodedText PropLocationMode = System.Text.Json.JsonEncodedText.Encode("location_mode"); + private static readonly System.Text.Json.JsonEncodedText PropMaxConcurrentBatchDeletes = System.Text.Json.JsonEncodedText.Encode("max_concurrent_batch_deletes"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropReadonly = System.Text.Json.JsonEncodedText.Encode("readonly"); + + public override Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBasePath = default; + LocalJsonValue propChunkSize = default; + LocalJsonValue propClient = default; + LocalJsonValue propCompress = default; + LocalJsonValue propContainer = default; + LocalJsonValue propDeleteObjectsMaxSize = default; + LocalJsonValue propLocationMode = default; + LocalJsonValue propMaxConcurrentBatchDeletes = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propReadonly = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBasePath.TryReadProperty(ref reader, options, PropBasePath, null)) + { + continue; + } + + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) + { + continue; + } + + if (propClient.TryReadProperty(ref reader, options, PropClient, null)) + { + continue; + } + + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propContainer.TryReadProperty(ref reader, options, PropContainer, null)) + { + continue; + } + + if (propDeleteObjectsMaxSize.TryReadProperty(ref reader, options, PropDeleteObjectsMaxSize, null)) + { + continue; + } + + if (propLocationMode.TryReadProperty(ref reader, options, PropLocationMode, null)) + { + continue; + } + + if (propMaxConcurrentBatchDeletes.TryReadProperty(ref reader, options, PropMaxConcurrentBatchDeletes, null)) + { + continue; + } + + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } + + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } + + if (propReadonly.TryReadProperty(ref reader, options, PropReadonly, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BasePath = propBasePath.Value, + ChunkSize = propChunkSize.Value, + Client = propClient.Value, + Compress = propCompress.Value, + Container = propContainer.Value, + DeleteObjectsMaxSize = propDeleteObjectsMaxSize.Value, + LocationMode = propLocationMode.Value, + MaxConcurrentBatchDeletes = propMaxConcurrentBatchDeletes.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + Readonly = propReadonly.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBasePath, value.BasePath, null, null); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropClient, value.Client, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropContainer, value.Container, null, null); + writer.WriteProperty(options, PropDeleteObjectsMaxSize, value.DeleteObjectsMaxSize, null, null); + writer.WriteProperty(options, PropLocationMode, value.LocationMode, null, null); + writer.WriteProperty(options, PropMaxConcurrentBatchDeletes, value.MaxConcurrentBatchDeletes, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropReadonly, value.Readonly, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsConverter))] public sealed partial class AzureRepositorySettings { - [JsonInclude, JsonPropertyName("base_path")] +#if NET7_0_OR_GREATER + public AzureRepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public AzureRepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AzureRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The path to the repository data within the container. + /// It defaults to the root directory. + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments can share the same bucket. + /// + /// public string? BasePath { get; set; } - [JsonInclude, JsonPropertyName("chunk_size")] + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } - [JsonInclude, JsonPropertyName("client")] + + /// + /// + /// The name of the Azure repository client to use. + /// + /// public string? Client { get; set; } - [JsonInclude, JsonPropertyName("compress")] + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("container")] + + /// + /// + /// The Azure container. + /// + /// public string? Container { get; set; } - [JsonInclude, JsonPropertyName("location_mode")] + + /// + /// + /// The maxmimum batch size, between 1 and 256, used for BlobBatch requests. + /// Defaults to 256 which is the maximum number supported by the Azure blob batch API. + /// + /// + public int? DeleteObjectsMaxSize { get; set; } + + /// + /// + /// Either primary_only or secondary_only. + /// Note that if you set it to secondary_only, it will force readonly to true. + /// + /// public string? LocationMode { get; set; } - [JsonInclude, JsonPropertyName("max_restore_bytes_per_sec")] + + /// + /// + /// The maximum number of concurrent batch delete requests that will be submitted for any individual bulk delete with BlobBatch. + /// Note that the effective number of concurrent deletes is further limited by the Azure client connection and event loop thread limits. + /// Defaults to 10, minimum is 1, maximum is 100. + /// + /// + public int? MaxConcurrentBatchDeletes { get; set; } + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("max_snapshot_bytes_per_sec")] + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("readonly")] + + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// public bool? Readonly { get; set; } } -public sealed partial class AzureRepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct AzureRepositorySettingsDescriptor { - internal AzureRepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings Instance { get; init; } - public AzureRepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings instance) { + Instance = instance; } - private string? BasePathValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private string? ClientValue { get; set; } - private bool? CompressValue { get; set; } - private string? ContainerValue { get; set; } - private string? LocationModeValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private bool? ReadonlyValue { get; set; } - - public AzureRepositorySettingsDescriptor BasePath(string? basePath) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AzureRepositorySettingsDescriptor() { - BasePathValue = basePath; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public AzureRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The path to the repository data within the container. + /// It defaults to the root directory. + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments can share the same bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor BasePath(string? value) { - ChunkSizeValue = chunkSize; - return Self; + Instance.BasePath = value; + return this; } - public AzureRepositorySettingsDescriptor Client(string? client) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - ClientValue = client; - return Self; + Instance.ChunkSize = value; + return this; } - public AzureRepositorySettingsDescriptor Compress(bool? compress = true) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor ChunkSize(System.Func action) { - CompressValue = compress; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public AzureRepositorySettingsDescriptor Container(string? container) + /// + /// + /// The name of the Azure repository client to use. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor Client(string? value) { - ContainerValue = container; - return Self; + Instance.Client = value; + return this; } - public AzureRepositorySettingsDescriptor LocationMode(string? locationMode) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor Compress(bool? value = true) { - LocationModeValue = locationMode; - return Self; + Instance.Compress = value; + return this; } - public AzureRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The Azure container. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor Container(string? value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.Container = value; + return this; } - public AzureRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// The maxmimum batch size, between 1 and 256, used for BlobBatch requests. + /// Defaults to 256 which is the maximum number supported by the Azure blob batch API. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor DeleteObjectsMaxSize(int? value) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.DeleteObjectsMaxSize = value; + return this; } - public AzureRepositorySettingsDescriptor Readonly(bool? value = true) + /// + /// + /// Either primary_only or secondary_only. + /// Note that if you set it to secondary_only, it will force readonly to true. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor LocationMode(string? value) { - ReadonlyValue = value; - return Self; + Instance.LocationMode = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum number of concurrent batch delete requests that will be submitted for any individual bulk delete with BlobBatch. + /// Note that the effective number of concurrent deletes is further limited by the Azure client connection and event loop thread limits. + /// Defaults to 10, minimum is 1, maximum is 100. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor MaxConcurrentBatchDeletes(int? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BasePathValue)) - { - writer.WritePropertyName("base_path"); - writer.WriteStringValue(BasePathValue); - } - - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } - - if (!string.IsNullOrEmpty(ClientValue)) - { - writer.WritePropertyName("client"); - writer.WriteStringValue(ClientValue); - } + Instance.MaxConcurrentBatchDeletes = value; + return this; + } - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxRestoreBytesPerSec = value; + return this; + } - if (!string.IsNullOrEmpty(ContainerValue)) - { - writer.WritePropertyName("container"); - writer.WriteStringValue(ContainerValue); - } + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) + { + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (!string.IsNullOrEmpty(LocationModeValue)) - { - writer.WritePropertyName("location_mode"); - writer.WriteStringValue(LocationModeValue); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor Readonly(bool? value = true) + { + Instance.Readonly = value; + return this; + } - if (ReadonlyValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("readonly"); - writer.WriteBooleanValue(ReadonlyValue.Value); + return new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.AzureRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/BlobDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/BlobDetails.g.cs index cb468018d0d..b9d5dc548dc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/BlobDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/BlobDetails.g.cs @@ -17,25 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class BlobDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOverwritten = System.Text.Json.JsonEncodedText.Encode("overwritten"); + private static readonly System.Text.Json.JsonEncodedText PropReadEarly = System.Text.Json.JsonEncodedText.Encode("read_early"); + private static readonly System.Text.Json.JsonEncodedText PropReadEnd = System.Text.Json.JsonEncodedText.Encode("read_end"); + private static readonly System.Text.Json.JsonEncodedText PropReads = System.Text.Json.JsonEncodedText.Encode("reads"); + private static readonly System.Text.Json.JsonEncodedText PropReadStart = System.Text.Json.JsonEncodedText.Encode("read_start"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeBytes = System.Text.Json.JsonEncodedText.Encode("size_bytes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.BlobDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propOverwritten = default; + LocalJsonValue propReadEarly = default; + LocalJsonValue propReadEnd = default; + LocalJsonValue propReads = default; + LocalJsonValue propReadStart = default; + LocalJsonValue propSize = default; + LocalJsonValue propSizeBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propOverwritten.TryReadProperty(ref reader, options, PropOverwritten, null)) + { + continue; + } + + if (propReadEarly.TryReadProperty(ref reader, options, PropReadEarly, null)) + { + continue; + } + + if (propReadEnd.TryReadProperty(ref reader, options, PropReadEnd, null)) + { + continue; + } + + if (propReads.TryReadProperty(ref reader, options, PropReads, null)) + { + continue; + } + + if (propReadStart.TryReadProperty(ref reader, options, PropReadStart, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeBytes.TryReadProperty(ref reader, options, PropSizeBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.BlobDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Overwritten = propOverwritten.Value, + ReadEarly = propReadEarly.Value, + ReadEnd = propReadEnd.Value, + Reads = propReads.Value, + ReadStart = propReadStart.Value, + Size = propSize.Value, + SizeBytes = propSizeBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.BlobDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropOverwritten, value.Overwritten, null, null); + writer.WriteProperty(options, PropReadEarly, value.ReadEarly, null, null); + writer.WriteProperty(options, PropReadEnd, value.ReadEnd, null, null); + writer.WriteProperty(options, PropReads, value.Reads, null, null); + writer.WriteProperty(options, PropReadStart, value.ReadStart, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeBytes, value.SizeBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.BlobDetailsConverter))] public sealed partial class BlobDetails { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BlobDetails(string name, bool overwritten, bool readEarly, long readEnd, Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails reads, long readStart, Elastic.Clients.Elasticsearch.ByteSize size, long sizeBytes) + { + Name = name; + Overwritten = overwritten; + ReadEarly = readEarly; + ReadEnd = readEnd; + Reads = reads; + ReadStart = readStart; + Size = size; + SizeBytes = sizeBytes; + } +#if NET7_0_OR_GREATER + public BlobDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BlobDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BlobDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The name of the blob. /// /// - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } /// /// @@ -43,48 +174,69 @@ public sealed partial class BlobDetails /// /** /// /// - [JsonInclude, JsonPropertyName("overwritten")] - public bool Overwritten { get; init; } - [JsonInclude, JsonPropertyName("read_early")] - public bool ReadEarly { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Overwritten { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool ReadEarly { get; set; } /// /// /// The position, in bytes, at which read operations completed. /// /// - [JsonInclude, JsonPropertyName("read_end")] - public long ReadEnd { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReadEnd { get; set; } /// /// /// A description of every read operation performed on the blob. /// /// - [JsonInclude, JsonPropertyName("reads")] - public Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails Reads { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails Reads { get; set; } /// /// /// The position, in bytes, at which read operations started. /// /// - [JsonInclude, JsonPropertyName("read_start")] - public long ReadStart { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReadStart { get; set; } /// /// /// The size of the blob. /// /// - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize Size { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize Size { get; set; } /// /// /// The size of the blob in bytes. /// /// - [JsonInclude, JsonPropertyName("size_bytes")] - public long SizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CleanupRepositoryResults.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CleanupRepositoryResults.g.cs index d4f7a7f3738..c4a4c4f8259 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CleanupRepositoryResults.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CleanupRepositoryResults.g.cs @@ -17,31 +17,106 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class CleanupRepositoryResultsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeletedBlobs = System.Text.Json.JsonEncodedText.Encode("deleted_blobs"); + private static readonly System.Text.Json.JsonEncodedText PropDeletedBytes = System.Text.Json.JsonEncodedText.Encode("deleted_bytes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResults Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeletedBlobs = default; + LocalJsonValue propDeletedBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeletedBlobs.TryReadProperty(ref reader, options, PropDeletedBlobs, null)) + { + continue; + } + + if (propDeletedBytes.TryReadProperty(ref reader, options, PropDeletedBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeletedBlobs = propDeletedBlobs.Value, + DeletedBytes = propDeletedBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResults value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeletedBlobs, value.DeletedBlobs, null, null); + writer.WriteProperty(options, PropDeletedBytes, value.DeletedBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CleanupRepositoryResultsConverter))] public sealed partial class CleanupRepositoryResults { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CleanupRepositoryResults(long deletedBlobs, long deletedBytes) + { + DeletedBlobs = deletedBlobs; + DeletedBytes = deletedBytes; + } +#if NET7_0_OR_GREATER + public CleanupRepositoryResults() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CleanupRepositoryResults() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CleanupRepositoryResults(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// - /// Number of binary large objects (blobs) removed during cleanup. + /// The number of binary large objects (blobs) removed from the snapshot repository during cleanup operations. + /// A non-zero value indicates that unreferenced blobs were found and subsequently cleaned up. /// /// - [JsonInclude, JsonPropertyName("deleted_blobs")] - public long DeletedBlobs { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long DeletedBlobs { get; set; } /// /// - /// Number of bytes freed by cleanup operations. + /// The number of bytes freed by cleanup operations. /// /// - [JsonInclude, JsonPropertyName("deleted_bytes")] - public long DeletedBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long DeletedBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CompactNodeInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CompactNodeInfo.g.cs index cdbd4a37456..1857a0795b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CompactNodeInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/CompactNodeInfo.g.cs @@ -17,18 +17,86 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class CompactNodeInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Snapshot.CompactNodeInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.CompactNodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.CompactNodeInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.CompactNodeInfoConverter))] public sealed partial class CompactNodeInfo { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CompactNodeInfo(string name) + { + Name = name; + } +#if NET7_0_OR_GREATER + public CompactNodeInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CompactNodeInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CompactNodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// A human-readable name for the node. + /// You can set this name using the node.name property in elasticsearch.yml. + /// The default value is the machine's hostname. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/DetailsInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/DetailsInfo.g.cs index f0b69f04947..3618b89fa58 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/DetailsInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/DetailsInfo.g.cs @@ -17,25 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class DetailsInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBlob = System.Text.Json.JsonEncodedText.Encode("blob"); + private static readonly System.Text.Json.JsonEncodedText PropOverwriteElapsed = System.Text.Json.JsonEncodedText.Encode("overwrite_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropOverwriteElapsedNanos = System.Text.Json.JsonEncodedText.Encode("overwrite_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropWriteElapsed = System.Text.Json.JsonEncodedText.Encode("write_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropWriteElapsedNanos = System.Text.Json.JsonEncodedText.Encode("write_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropWriterNode = System.Text.Json.JsonEncodedText.Encode("writer_node"); + private static readonly System.Text.Json.JsonEncodedText PropWriteThrottled = System.Text.Json.JsonEncodedText.Encode("write_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropWriteThrottledNanos = System.Text.Json.JsonEncodedText.Encode("write_throttled_nanos"); + + public override Elastic.Clients.Elasticsearch.Snapshot.DetailsInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBlob = default; + LocalJsonValue propOverwriteElapsed = default; + LocalJsonValue propOverwriteElapsedNanos = default; + LocalJsonValue propWriteElapsed = default; + LocalJsonValue propWriteElapsedNanos = default; + LocalJsonValue propWriterNode = default; + LocalJsonValue propWriteThrottled = default; + LocalJsonValue propWriteThrottledNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBlob.TryReadProperty(ref reader, options, PropBlob, null)) + { + continue; + } + + if (propOverwriteElapsed.TryReadProperty(ref reader, options, PropOverwriteElapsed, null)) + { + continue; + } + + if (propOverwriteElapsedNanos.TryReadProperty(ref reader, options, PropOverwriteElapsedNanos, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propWriteElapsed.TryReadProperty(ref reader, options, PropWriteElapsed, null)) + { + continue; + } + + if (propWriteElapsedNanos.TryReadProperty(ref reader, options, PropWriteElapsedNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propWriterNode.TryReadProperty(ref reader, options, PropWriterNode, null)) + { + continue; + } + + if (propWriteThrottled.TryReadProperty(ref reader, options, PropWriteThrottled, null)) + { + continue; + } + + if (propWriteThrottledNanos.TryReadProperty(ref reader, options, PropWriteThrottledNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.DetailsInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Blob = propBlob.Value, + OverwriteElapsed = propOverwriteElapsed.Value, + OverwriteElapsedNanos = propOverwriteElapsedNanos.Value, + WriteElapsed = propWriteElapsed.Value, + WriteElapsedNanos = propWriteElapsedNanos.Value, + WriterNode = propWriterNode.Value, + WriteThrottled = propWriteThrottled.Value, + WriteThrottledNanos = propWriteThrottledNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.DetailsInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBlob, value.Blob, null, null); + writer.WriteProperty(options, PropOverwriteElapsed, value.OverwriteElapsed, null, null); + writer.WriteProperty(options, PropOverwriteElapsedNanos, value.OverwriteElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropWriteElapsed, value.WriteElapsed, null, null); + writer.WriteProperty(options, PropWriteElapsedNanos, value.WriteElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropWriterNode, value.WriterNode, null, null); + writer.WriteProperty(options, PropWriteThrottled, value.WriteThrottled, null, null); + writer.WriteProperty(options, PropWriteThrottledNanos, value.WriteThrottledNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.DetailsInfoConverter))] public sealed partial class DetailsInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DetailsInfo(Elastic.Clients.Elasticsearch.Snapshot.BlobDetails blob, Elastic.Clients.Elasticsearch.Duration writeElapsed, System.TimeSpan writeElapsedNanos, Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo writerNode, Elastic.Clients.Elasticsearch.Duration writeThrottled, System.TimeSpan writeThrottledNanos) + { + Blob = blob; + WriteElapsed = writeElapsed; + WriteElapsedNanos = writeElapsedNanos; + WriterNode = writerNode; + WriteThrottled = writeThrottled; + WriteThrottledNanos = writeThrottledNanos; + } +#if NET7_0_OR_GREATER + public DetailsInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DetailsInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DetailsInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A description of the blob that was written and read. /// /// - [JsonInclude, JsonPropertyName("blob")] - public Elastic.Clients.Elasticsearch.Snapshot.BlobDetails Blob { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.BlobDetails Blob { get; set; } /// /// @@ -43,8 +172,7 @@ public sealed partial class DetailsInfo /// If the blob was not overwritten, this information is omitted. /// /// - [JsonInclude, JsonPropertyName("overwrite_elapsed")] - public Elastic.Clients.Elasticsearch.Duration? OverwriteElapsed { get; init; } + public Elastic.Clients.Elasticsearch.Duration? OverwriteElapsed { get; set; } /// /// @@ -52,46 +180,60 @@ public sealed partial class DetailsInfo /// If the blob was not overwritten, this information is omitted. /// /// - [JsonInclude, JsonPropertyName("overwrite_elapsed_nanos")] - public long? OverwriteElapsedNanos { get; init; } + public System.TimeSpan? OverwriteElapsedNanos { get; set; } /// /// /// The elapsed time spent writing the blob. /// /// - [JsonInclude, JsonPropertyName("write_elapsed")] - public Elastic.Clients.Elasticsearch.Duration WriteElapsed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration WriteElapsed { get; set; } /// /// /// The elapsed time spent writing the blob, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("write_elapsed_nanos")] - public long WriteElapsedNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan WriteElapsedNanos { get; set; } /// /// /// The node which wrote the blob and coordinated the read operations. /// /// - [JsonInclude, JsonPropertyName("writer_node")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo WriterNode { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo WriterNode { get; set; } /// /// /// The length of time spent waiting for the max_snapshot_bytes_per_sec (or indices.recovery.max_bytes_per_sec if the recovery settings for managed services are set) throttle while writing the blob. /// /// - [JsonInclude, JsonPropertyName("write_throttled")] - public Elastic.Clients.Elasticsearch.Duration WriteThrottled { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration WriteThrottled { get; set; } /// /// /// The length of time spent waiting for the max_snapshot_bytes_per_sec (or indices.recovery.max_bytes_per_sec if the recovery settings for managed services are set) throttle while writing the blob, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("write_throttled_nanos")] - public long WriteThrottledNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan WriteThrottledNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/FileCountSnapshotStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/FileCountSnapshotStats.g.cs index 41353f26cf0..3fdec44cb69 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/FileCountSnapshotStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/FileCountSnapshotStats.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class FileCountSnapshotStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFileCount = System.Text.Json.JsonEncodedText.Encode("file_count"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFileCount = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFileCount.TryReadProperty(ref reader, options, PropFileCount, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FileCount = propFileCount.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFileCount, value.FileCount, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStatsConverter))] public sealed partial class FileCountSnapshotStats { - [JsonInclude, JsonPropertyName("file_count")] - public int FileCount { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FileCountSnapshotStats(int fileCount, long sizeInBytes) + { + FileCount = fileCount; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public FileCountSnapshotStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FileCountSnapshotStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FileCountSnapshotStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int FileCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepository.g.cs index 1fc0527dc81..64480c2e6bf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepository.g.cs @@ -17,128 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class GcsRepository : IRepository +internal sealed partial class GcsRepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "gcs"; + public override Elastic.Clients.Elasticsearch.Snapshot.GcsRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class GcsRepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal GcsRepositoryDescriptor(Action configure) => configure.Invoke(this); + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - public GcsRepositoryDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public GcsRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings settings) - { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.GcsRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; } - public GcsRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GcsRepository value, System.Text.Json.JsonSerializerOptions options) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); } +} - public GcsRepositoryDescriptor Settings(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryConverter))] +public sealed partial class GcsRepository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepository(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings settings) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Settings = settings; } - - public GcsRepositoryDescriptor Uuid(string? uuid) +#if NET7_0_OR_GREATER + public GcsRepository() { - UuidValue = uuid; - return Self; } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GcsRepository() { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GcsRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("gcs"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } + /// + /// + /// The repository settings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings Settings { get; set; } + + /// + /// + /// The Google Cloud Storage repository type. + /// + /// + public string Type => "gcs"; - writer.WriteEndObject(); + public string? Uuid { get; set; } +} + +public readonly partial struct GcsRepositoryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Snapshot.GcsRepository Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GcsRepository instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings BuildSettings() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepositoryDescriptor() { - if (SettingsValue is not null) - { - return SettingsValue; - } + Instance = new Elastic.Clients.Elasticsearch.Snapshot.GcsRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GcsRepository instance) => new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.GcsRepository(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor descriptor) => descriptor.Instance; - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings value) + { + Instance.Settings = value; + return this; + } - return null; + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor Settings(System.Action action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor.Build(action); + return this; } - GcsRepository IBuildableDescriptor.Build() => new() + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor Uuid(string? value) { - Settings = BuildSettings(), - Uuid = UuidValue - }; + Instance.Uuid = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.GcsRepository Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.GcsRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepositorySettings.g.cs index 7fd1822ac1c..0c74d9ee65b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/GcsRepositorySettings.g.cs @@ -17,163 +17,440 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class GcsRepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropApplicationName = System.Text.Json.JsonEncodedText.Encode("application_name"); + private static readonly System.Text.Json.JsonEncodedText PropBasePath = System.Text.Json.JsonEncodedText.Encode("base_path"); + private static readonly System.Text.Json.JsonEncodedText PropBucket = System.Text.Json.JsonEncodedText.Encode("bucket"); + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropClient = System.Text.Json.JsonEncodedText.Encode("client"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropReadonly = System.Text.Json.JsonEncodedText.Encode("readonly"); + + public override Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propApplicationName = default; + LocalJsonValue propBasePath = default; + LocalJsonValue propBucket = default; + LocalJsonValue propChunkSize = default; + LocalJsonValue propClient = default; + LocalJsonValue propCompress = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propReadonly = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propApplicationName.TryReadProperty(ref reader, options, PropApplicationName, null)) + { + continue; + } + + if (propBasePath.TryReadProperty(ref reader, options, PropBasePath, null)) + { + continue; + } + + if (propBucket.TryReadProperty(ref reader, options, PropBucket, null)) + { + continue; + } + + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) + { + continue; + } + + if (propClient.TryReadProperty(ref reader, options, PropClient, null)) + { + continue; + } + + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } + + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } + + if (propReadonly.TryReadProperty(ref reader, options, PropReadonly, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { +#pragma warning disable CS0618 + ApplicationName = propApplicationName.Value +#pragma warning restore CS0618 +, + BasePath = propBasePath.Value, + Bucket = propBucket.Value, + ChunkSize = propChunkSize.Value, + Client = propClient.Value, + Compress = propCompress.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + Readonly = propReadonly.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); +#pragma warning disable CS0618 + writer.WriteProperty(options, PropApplicationName, value.ApplicationName, null, null) +#pragma warning restore CS0618 + ; + writer.WriteProperty(options, PropBasePath, value.BasePath, null, null); + writer.WriteProperty(options, PropBucket, value.Bucket, null, null); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropClient, value.Client, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropReadonly, value.Readonly, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsConverter))] public sealed partial class GcsRepositorySettings { - [JsonInclude, JsonPropertyName("application_name")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepositorySettings(string bucket) + { + Bucket = bucket; + } +#if NET7_0_OR_GREATER + public GcsRepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public GcsRepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal GcsRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The name used by the client when it uses the Google Cloud Storage service. + /// + /// + [System.Obsolete("Deprecated in '6.3.0'.")] public string? ApplicationName { get; set; } - [JsonInclude, JsonPropertyName("base_path")] + + /// + /// + /// The path to the repository data within the bucket. + /// It defaults to the root of the bucket. + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments can share the same bucket. + /// + /// public string? BasePath { get; set; } - [JsonInclude, JsonPropertyName("bucket")] - public string Bucket { get; set; } - [JsonInclude, JsonPropertyName("chunk_size")] + + /// + /// + /// The name of the bucket to be used for snapshots. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Bucket { get; set; } + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } - [JsonInclude, JsonPropertyName("client")] + + /// + /// + /// The name of the client to use to connect to Google Cloud Storage. + /// + /// public string? Client { get; set; } - [JsonInclude, JsonPropertyName("compress")] + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("max_restore_bytes_per_sec")] + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("max_snapshot_bytes_per_sec")] + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("readonly")] + + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// public bool? Readonly { get; set; } } -public sealed partial class GcsRepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct GcsRepositorySettingsDescriptor { - internal GcsRepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings Instance { get; init; } - public GcsRepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings instance) { + Instance = instance; } - private string? ApplicationNameValue { get; set; } - private string? BasePathValue { get; set; } - private string BucketValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private string? ClientValue { get; set; } - private bool? CompressValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private bool? ReadonlyValue { get; set; } - - public GcsRepositorySettingsDescriptor ApplicationName(string? applicationName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GcsRepositorySettingsDescriptor() { - ApplicationNameValue = applicationName; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public GcsRepositorySettingsDescriptor BasePath(string? basePath) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor descriptor) => descriptor.Instance; + + [System.Obsolete("Deprecated in '6.3.0'.")] + /// + /// + /// The name used by the client when it uses the Google Cloud Storage service. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor ApplicationName(string? value) { - BasePathValue = basePath; - return Self; + Instance.ApplicationName = value; + return this; } - public GcsRepositorySettingsDescriptor Bucket(string bucket) + /// + /// + /// The path to the repository data within the bucket. + /// It defaults to the root of the bucket. + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments can share the same bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor BasePath(string? value) { - BucketValue = bucket; - return Self; + Instance.BasePath = value; + return this; } - public GcsRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + /// + /// + /// The name of the bucket to be used for snapshots. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor Bucket(string value) { - ChunkSizeValue = chunkSize; - return Self; + Instance.Bucket = value; + return this; } - public GcsRepositorySettingsDescriptor Client(string? client) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - ClientValue = client; - return Self; + Instance.ChunkSize = value; + return this; } - public GcsRepositorySettingsDescriptor Compress(bool? compress = true) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor ChunkSize(System.Func action) { - CompressValue = compress; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public GcsRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The name of the client to use to connect to Google Cloud Storage. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor Client(string? value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.Client = value; + return this; } - public GcsRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor Compress(bool? value = true) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.Compress = value; + return this; } - public GcsRepositorySettingsDescriptor Readonly(bool? value = true) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) { - ReadonlyValue = value; - return Self; + Instance.MaxRestoreBytesPerSec = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ApplicationNameValue)) - { - writer.WritePropertyName("application_name"); - writer.WriteStringValue(ApplicationNameValue); - } - - if (!string.IsNullOrEmpty(BasePathValue)) - { - writer.WritePropertyName("base_path"); - writer.WriteStringValue(BasePathValue); - } - - writer.WritePropertyName("bucket"); - writer.WriteStringValue(BucketValue); - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } - - if (!string.IsNullOrEmpty(ClientValue)) - { - writer.WritePropertyName("client"); - writer.WriteStringValue(ClientValue); - } - - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (ReadonlyValue.HasValue) - { - writer.WritePropertyName("readonly"); - writer.WriteBooleanValue(ReadonlyValue.Value); - } + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor Readonly(bool? value = true) + { + Instance.Readonly = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.GcsRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/IndexDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/IndexDetails.g.cs index d11e38a9995..98c8dc4804b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/IndexDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/IndexDetails.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class IndexDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMaxSegmentsPerShard = System.Text.Json.JsonEncodedText.Encode("max_segments_per_shard"); + private static readonly System.Text.Json.JsonEncodedText PropShardCount = System.Text.Json.JsonEncodedText.Encode("shard_count"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.IndexDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMaxSegmentsPerShard = default; + LocalJsonValue propShardCount = default; + LocalJsonValue propSize = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMaxSegmentsPerShard.TryReadProperty(ref reader, options, PropMaxSegmentsPerShard, null)) + { + continue; + } + + if (propShardCount.TryReadProperty(ref reader, options, PropShardCount, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.IndexDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + MaxSegmentsPerShard = propMaxSegmentsPerShard.Value, + ShardCount = propShardCount.Value, + Size = propSize.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.IndexDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMaxSegmentsPerShard, value.MaxSegmentsPerShard, null, null); + writer.WriteProperty(options, PropShardCount, value.ShardCount, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.IndexDetailsConverter))] public sealed partial class IndexDetails { - [JsonInclude, JsonPropertyName("max_segments_per_shard")] - public long MaxSegmentsPerShard { get; init; } - [JsonInclude, JsonPropertyName("shard_count")] - public int ShardCount { get; init; } - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize? Size { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IndexDetails(long maxSegmentsPerShard, int shardCount, long sizeInBytes) + { + MaxSegmentsPerShard = maxSegmentsPerShard; + ShardCount = shardCount; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public IndexDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IndexDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IndexDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long MaxSegmentsPerShard { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int ShardCount { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/InfoFeatureState.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/InfoFeatureState.g.cs index f5dfd870fd6..b5cb21af75c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/InfoFeatureState.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/InfoFeatureState.g.cs @@ -17,21 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class InfoFeatureStateConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureName = System.Text.Json.JsonEncodedText.Encode("feature_name"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + + public override Elastic.Clients.Elasticsearch.Snapshot.InfoFeatureState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFeatureName = default; + LocalJsonValue> propIndices = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureName.TryReadProperty(ref reader, options, PropFeatureName, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.ICollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.InfoFeatureState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureName = propFeatureName.Value, + Indices = propIndices.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.InfoFeatureState value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureName, value.FeatureName, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.InfoFeatureStateConverter))] public sealed partial class InfoFeatureState { - [JsonInclude, JsonPropertyName("feature_name")] - public string FeatureName { get; init; } - [JsonInclude, JsonPropertyName("indices")] - [SingleOrManyCollectionConverter(typeof(string))] - public IReadOnlyCollection Indices { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InfoFeatureState(string featureName, System.Collections.Generic.ICollection indices) + { + FeatureName = featureName; + Indices = indices; + } +#if NET7_0_OR_GREATER + public InfoFeatureState() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InfoFeatureState() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InfoFeatureState(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string FeatureName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.ICollection Indices { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadBlobDetails.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadBlobDetails.g.cs index 17acefa6cf2..db02f1ff1dd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadBlobDetails.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadBlobDetails.g.cs @@ -17,25 +17,156 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ReadBlobDetailsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBeforeWriteComplete = System.Text.Json.JsonEncodedText.Encode("before_write_complete"); + private static readonly System.Text.Json.JsonEncodedText PropElapsed = System.Text.Json.JsonEncodedText.Encode("elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropElapsedNanos = System.Text.Json.JsonEncodedText.Encode("elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropFirstByteTime = System.Text.Json.JsonEncodedText.Encode("first_byte_time"); + private static readonly System.Text.Json.JsonEncodedText PropFirstByteTimeNanos = System.Text.Json.JsonEncodedText.Encode("first_byte_time_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropFound = System.Text.Json.JsonEncodedText.Encode("found"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropThrottled = System.Text.Json.JsonEncodedText.Encode("throttled"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledNanos = System.Text.Json.JsonEncodedText.Encode("throttled_nanos"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBeforeWriteComplete = default; + LocalJsonValue propElapsed = default; + LocalJsonValue propElapsedNanos = default; + LocalJsonValue propFirstByteTime = default; + LocalJsonValue propFirstByteTimeNanos = default; + LocalJsonValue propFound = default; + LocalJsonValue propNode = default; + LocalJsonValue propThrottled = default; + LocalJsonValue propThrottledNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBeforeWriteComplete.TryReadProperty(ref reader, options, PropBeforeWriteComplete, null)) + { + continue; + } + + if (propElapsed.TryReadProperty(ref reader, options, PropElapsed, null)) + { + continue; + } + + if (propElapsedNanos.TryReadProperty(ref reader, options, PropElapsedNanos, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propFirstByteTime.TryReadProperty(ref reader, options, PropFirstByteTime, null)) + { + continue; + } + + if (propFirstByteTimeNanos.TryReadProperty(ref reader, options, PropFirstByteTimeNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propFound.TryReadProperty(ref reader, options, PropFound, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propThrottled.TryReadProperty(ref reader, options, PropThrottled, null)) + { + continue; + } + + if (propThrottledNanos.TryReadProperty(ref reader, options, PropThrottledNanos, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BeforeWriteComplete = propBeforeWriteComplete.Value, + Elapsed = propElapsed.Value, + ElapsedNanos = propElapsedNanos.Value, + FirstByteTime = propFirstByteTime.Value, + FirstByteTimeNanos = propFirstByteTimeNanos.Value, + Found = propFound.Value, + Node = propNode.Value, + Throttled = propThrottled.Value, + ThrottledNanos = propThrottledNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetails value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBeforeWriteComplete, value.BeforeWriteComplete, null, null); + writer.WriteProperty(options, PropElapsed, value.Elapsed, null, null); + writer.WriteProperty(options, PropElapsedNanos, value.ElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropFirstByteTime, value.FirstByteTime, null, null); + writer.WriteProperty(options, PropFirstByteTimeNanos, value.FirstByteTimeNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropFound, value.Found, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropThrottled, value.Throttled, null, null); + writer.WriteProperty(options, PropThrottledNanos, value.ThrottledNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ReadBlobDetailsConverter))] public sealed partial class ReadBlobDetails { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadBlobDetails(System.TimeSpan firstByteTimeNanos, bool found, Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo node) + { + FirstByteTimeNanos = firstByteTimeNanos; + Found = found; + Node = node; + } +#if NET7_0_OR_GREATER + public ReadBlobDetails() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReadBlobDetails() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReadBlobDetails(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Indicates whether the read operation may have started before the write operation was complete. /// /// - [JsonInclude, JsonPropertyName("before_write_complete")] - public bool? BeforeWriteComplete { get; init; } + public bool? BeforeWriteComplete { get; set; } /// /// @@ -43,8 +174,7 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("elapsed")] - public Elastic.Clients.Elasticsearch.Duration? Elapsed { get; init; } + public Elastic.Clients.Elasticsearch.Duration? Elapsed { get; set; } /// /// @@ -52,8 +182,7 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("elapsed_nanos")] - public long? ElapsedNanos { get; init; } + public System.TimeSpan? ElapsedNanos { get; set; } /// /// @@ -61,8 +190,7 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("first_byte_time")] - public Elastic.Clients.Elasticsearch.Duration? FirstByteTime { get; init; } + public Elastic.Clients.Elasticsearch.Duration? FirstByteTime { get; set; } /// /// @@ -70,8 +198,11 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("first_byte_time_nanos")] - public long FirstByteTimeNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan FirstByteTimeNanos { get; set; } /// /// @@ -79,16 +210,22 @@ public sealed partial class ReadBlobDetails /// If the read was started before the write completed or the write was ended before completion, it might be false. /// /// - [JsonInclude, JsonPropertyName("found")] - public bool Found { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Found { get; set; } /// /// /// The node that performed the read operation. /// /// - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo Node { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo Node { get; set; } /// /// @@ -96,8 +233,7 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("throttled")] - public Elastic.Clients.Elasticsearch.Duration? Throttled { get; init; } + public Elastic.Clients.Elasticsearch.Duration? Throttled { get; set; } /// /// @@ -105,6 +241,5 @@ public sealed partial class ReadBlobDetails /// If the blob was not found, this detail is omitted. /// /// - [JsonInclude, JsonPropertyName("throttled_nanos")] - public long? ThrottledNanos { get; init; } + public System.TimeSpan? ThrottledNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepository.g.cs index 5f41854cdd8..e8f41f8f1f3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepository.g.cs @@ -17,128 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class ReadOnlyUrlRepository : IRepository +internal sealed partial class ReadOnlyUrlRepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "url"; + public override Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class ReadOnlyUrlRepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal ReadOnlyUrlRepositoryDescriptor(Action configure) => configure.Invoke(this); + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - public ReadOnlyUrlRepositoryDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public ReadOnlyUrlRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings settings) - { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; } - public ReadOnlyUrlRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository value, System.Text.Json.JsonSerializerOptions options) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); } +} - public ReadOnlyUrlRepositoryDescriptor Settings(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryConverter))] +public sealed partial class ReadOnlyUrlRepository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings settings) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Settings = settings; } - - public ReadOnlyUrlRepositoryDescriptor Uuid(string? uuid) +#if NET7_0_OR_GREATER + public ReadOnlyUrlRepository() { - UuidValue = uuid; - return Self; } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReadOnlyUrlRepository() { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("url"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } + /// + /// + /// The repository settings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings Settings { get; set; } + + /// + /// + /// The read-only URL repository type. + /// + /// + public string Type => "url"; - writer.WriteEndObject(); + public string? Uuid { get; set; } +} + +public readonly partial struct ReadOnlyUrlRepositoryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings BuildSettings() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepositoryDescriptor() { - if (SettingsValue is not null) - { - return SettingsValue; - } + Instance = new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository instance) => new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor descriptor) => descriptor.Instance; - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings value) + { + Instance.Settings = value; + return this; + } - return null; + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor Settings(System.Action action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor.Build(action); + return this; } - ReadOnlyUrlRepository IBuildableDescriptor.Build() => new() + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor Uuid(string? value) { - Settings = BuildSettings(), - Uuid = UuidValue - }; + Instance.Uuid = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepositorySettings.g.cs index 1a839f7de98..49768335a28 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadOnlyUrlRepositorySettings.g.cs @@ -17,148 +17,447 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ReadOnlyUrlRepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropHttpMaxRetries = System.Text.Json.JsonEncodedText.Encode("http_max_retries"); + private static readonly System.Text.Json.JsonEncodedText PropHttpSocketTimeout = System.Text.Json.JsonEncodedText.Encode("http_socket_timeout"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumberOfSnapshots = System.Text.Json.JsonEncodedText.Encode("max_number_of_snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropUrl = System.Text.Json.JsonEncodedText.Encode("url"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkSize = default; + LocalJsonValue propCompress = default; + LocalJsonValue propHttpMaxRetries = default; + LocalJsonValue propHttpSocketTimeout = default; + LocalJsonValue propMaxNumberOfSnapshots = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propUrl = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) + { + continue; + } + + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propHttpMaxRetries.TryReadProperty(ref reader, options, PropHttpMaxRetries, null)) + { + continue; + } + + if (propHttpSocketTimeout.TryReadProperty(ref reader, options, PropHttpSocketTimeout, null)) + { + continue; + } + + if (propMaxNumberOfSnapshots.TryReadProperty(ref reader, options, PropMaxNumberOfSnapshots, null)) + { + continue; + } + + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } + + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } + + if (propUrl.TryReadProperty(ref reader, options, PropUrl, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkSize = propChunkSize.Value, + Compress = propCompress.Value, + HttpMaxRetries = propHttpMaxRetries.Value, + HttpSocketTimeout = propHttpSocketTimeout.Value, + MaxNumberOfSnapshots = propMaxNumberOfSnapshots.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + Url = propUrl.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropHttpMaxRetries, value.HttpMaxRetries, null, null); + writer.WriteProperty(options, PropHttpSocketTimeout, value.HttpSocketTimeout, null, null); + writer.WriteProperty(options, PropMaxNumberOfSnapshots, value.MaxNumberOfSnapshots, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropUrl, value.Url, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsConverter))] public sealed partial class ReadOnlyUrlRepositorySettings { - [JsonInclude, JsonPropertyName("chunk_size")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepositorySettings(string url) + { + Url = url; + } +#if NET7_0_OR_GREATER + public ReadOnlyUrlRepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReadOnlyUrlRepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReadOnlyUrlRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } - [JsonInclude, JsonPropertyName("compress")] + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("http_max_retries")] + + /// + /// + /// The maximum number of retries for HTTP and HTTPS URLs. + /// + /// public int? HttpMaxRetries { get; set; } - [JsonInclude, JsonPropertyName("http_socket_timeout")] + + /// + /// + /// The maximum wait time for data transfers over a connection. + /// + /// public Elastic.Clients.Elasticsearch.Duration? HttpSocketTimeout { get; set; } - [JsonInclude, JsonPropertyName("max_number_of_snapshots")] + + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// public int? MaxNumberOfSnapshots { get; set; } - [JsonInclude, JsonPropertyName("max_restore_bytes_per_sec")] + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("max_snapshot_bytes_per_sec")] + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("url")] - public string Url { get; set; } + + /// + /// + /// The URL location of the root of the shared filesystem repository. + /// The following protocols are supported: + /// + /// + /// + /// + /// file + /// + /// + /// + /// + /// ftp + /// + /// + /// + /// + /// http + /// + /// + /// + /// + /// https + /// + /// + /// + /// + /// jar + /// + /// + /// + /// + /// URLs using the HTTP, HTTPS, or FTP protocols must be explicitly allowed with the repositories.url.allowed_urls cluster setting. + /// This setting supports wildcards in the place of a host, path, query, or fragment in the URL. + /// + /// + /// URLs using the file protocol must point to the location of a shared filesystem accessible to all master and data nodes in the cluster. + /// This location must be registered in the path.repo setting. + /// You don't need to register URLs using the FTP, HTTP, HTTPS, or JAR protocols in the path.repo setting. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Url { get; set; } } -public sealed partial class ReadOnlyUrlRepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct ReadOnlyUrlRepositorySettingsDescriptor { - internal ReadOnlyUrlRepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings Instance { get; init; } - public ReadOnlyUrlRepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private bool? CompressValue { get; set; } - private int? HttpMaxRetriesValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration? HttpSocketTimeoutValue { get; set; } - private int? MaxNumberOfSnapshotsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private string UrlValue { get; set; } - - public ReadOnlyUrlRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadOnlyUrlRepositorySettingsDescriptor() { - ChunkSizeValue = chunkSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public ReadOnlyUrlRepositorySettingsDescriptor Compress(bool? compress = true) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - CompressValue = compress; - return Self; + Instance.ChunkSize = value; + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor HttpMaxRetries(int? httpMaxRetries) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor ChunkSize(System.Func action) { - HttpMaxRetriesValue = httpMaxRetries; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor HttpSocketTimeout(Elastic.Clients.Elasticsearch.Duration? httpSocketTimeout) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor Compress(bool? value = true) { - HttpSocketTimeoutValue = httpSocketTimeout; - return Self; + Instance.Compress = value; + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor MaxNumberOfSnapshots(int? maxNumberOfSnapshots) + /// + /// + /// The maximum number of retries for HTTP and HTTPS URLs. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor HttpMaxRetries(int? value) { - MaxNumberOfSnapshotsValue = maxNumberOfSnapshots; - return Self; + Instance.HttpMaxRetries = value; + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The maximum wait time for data transfers over a connection. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor HttpSocketTimeout(Elastic.Clients.Elasticsearch.Duration? value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.HttpSocketTimeout = value; + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor MaxNumberOfSnapshots(int? value) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.MaxNumberOfSnapshots = value; + return this; } - public ReadOnlyUrlRepositorySettingsDescriptor Url(string url) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) { - UrlValue = url; - return Self; + Instance.MaxRestoreBytesPerSec = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) { - writer.WriteStartObject(); - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } - - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } - - if (HttpMaxRetriesValue.HasValue) - { - writer.WritePropertyName("http_max_retries"); - writer.WriteNumberValue(HttpMaxRetriesValue.Value); - } - - if (HttpSocketTimeoutValue is not null) - { - writer.WritePropertyName("http_socket_timeout"); - JsonSerializer.Serialize(writer, HttpSocketTimeoutValue, options); - } + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxNumberOfSnapshotsValue.HasValue) - { - writer.WritePropertyName("max_number_of_snapshots"); - writer.WriteNumberValue(MaxNumberOfSnapshotsValue.Value); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// The URL location of the root of the shared filesystem repository. + /// The following protocols are supported: + /// + /// + /// + /// + /// file + /// + /// + /// + /// + /// ftp + /// + /// + /// + /// + /// http + /// + /// + /// + /// + /// https + /// + /// + /// + /// + /// jar + /// + /// + /// + /// + /// URLs using the HTTP, HTTPS, or FTP protocols must be explicitly allowed with the repositories.url.allowed_urls cluster setting. + /// This setting supports wildcards in the place of a host, path, query, or fragment in the URL. + /// + /// + /// URLs using the file protocol must point to the location of a shared filesystem accessible to all master and data nodes in the cluster. + /// This location must be registered in the path.repo setting. + /// You don't need to register URLs using the FTP, HTTP, HTTPS, or JAR protocols in the path.repo setting. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor Url(string value) + { + Instance.Url = value; + return this; + } - writer.WritePropertyName("url"); - writer.WriteStringValue(UrlValue); - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadSummaryInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadSummaryInfo.g.cs index 03a0d2e7847..9bbc62e7a19 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadSummaryInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ReadSummaryInfo.g.cs @@ -17,103 +17,294 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ReadSummaryInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWait = System.Text.Json.JsonEncodedText.Encode("max_wait"); + private static readonly System.Text.Json.JsonEncodedText PropMaxWaitNanos = System.Text.Json.JsonEncodedText.Encode("max_wait_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropTotalElapsed = System.Text.Json.JsonEncodedText.Encode("total_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropTotalElapsedNanos = System.Text.Json.JsonEncodedText.Encode("total_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSize = System.Text.Json.JsonEncodedText.Encode("total_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeBytes = System.Text.Json.JsonEncodedText.Encode("total_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottled = System.Text.Json.JsonEncodedText.Encode("total_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottledNanos = System.Text.Json.JsonEncodedText.Encode("total_throttled_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropTotalWait = System.Text.Json.JsonEncodedText.Encode("total_wait"); + private static readonly System.Text.Json.JsonEncodedText PropTotalWaitNanos = System.Text.Json.JsonEncodedText.Encode("total_wait_nanos"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propMaxWait = default; + LocalJsonValue propMaxWaitNanos = default; + LocalJsonValue propTotalElapsed = default; + LocalJsonValue propTotalElapsedNanos = default; + LocalJsonValue propTotalSize = default; + LocalJsonValue propTotalSizeBytes = default; + LocalJsonValue propTotalThrottled = default; + LocalJsonValue propTotalThrottledNanos = default; + LocalJsonValue propTotalWait = default; + LocalJsonValue propTotalWaitNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMaxWait.TryReadProperty(ref reader, options, PropMaxWait, null)) + { + continue; + } + + if (propMaxWaitNanos.TryReadProperty(ref reader, options, PropMaxWaitNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propTotalElapsed.TryReadProperty(ref reader, options, PropTotalElapsed, null)) + { + continue; + } + + if (propTotalElapsedNanos.TryReadProperty(ref reader, options, PropTotalElapsedNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propTotalSize.TryReadProperty(ref reader, options, PropTotalSize, null)) + { + continue; + } + + if (propTotalSizeBytes.TryReadProperty(ref reader, options, PropTotalSizeBytes, null)) + { + continue; + } + + if (propTotalThrottled.TryReadProperty(ref reader, options, PropTotalThrottled, null)) + { + continue; + } + + if (propTotalThrottledNanos.TryReadProperty(ref reader, options, PropTotalThrottledNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propTotalWait.TryReadProperty(ref reader, options, PropTotalWait, null)) + { + continue; + } + + if (propTotalWaitNanos.TryReadProperty(ref reader, options, PropTotalWaitNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + MaxWait = propMaxWait.Value, + MaxWaitNanos = propMaxWaitNanos.Value, + TotalElapsed = propTotalElapsed.Value, + TotalElapsedNanos = propTotalElapsedNanos.Value, + TotalSize = propTotalSize.Value, + TotalSizeBytes = propTotalSizeBytes.Value, + TotalThrottled = propTotalThrottled.Value, + TotalThrottledNanos = propTotalThrottledNanos.Value, + TotalWait = propTotalWait.Value, + TotalWaitNanos = propTotalWaitNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMaxWait, value.MaxWait, null, null); + writer.WriteProperty(options, PropMaxWaitNanos, value.MaxWaitNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropTotalElapsed, value.TotalElapsed, null, null); + writer.WriteProperty(options, PropTotalElapsedNanos, value.TotalElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropTotalSize, value.TotalSize, null, null); + writer.WriteProperty(options, PropTotalSizeBytes, value.TotalSizeBytes, null, null); + writer.WriteProperty(options, PropTotalThrottled, value.TotalThrottled, null, null); + writer.WriteProperty(options, PropTotalThrottledNanos, value.TotalThrottledNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropTotalWait, value.TotalWait, null, null); + writer.WriteProperty(options, PropTotalWaitNanos, value.TotalWaitNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfoConverter))] public sealed partial class ReadSummaryInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReadSummaryInfo(int count, Elastic.Clients.Elasticsearch.Duration maxWait, System.TimeSpan maxWaitNanos, Elastic.Clients.Elasticsearch.Duration totalElapsed, System.TimeSpan totalElapsedNanos, Elastic.Clients.Elasticsearch.ByteSize totalSize, long totalSizeBytes, Elastic.Clients.Elasticsearch.Duration totalThrottled, System.TimeSpan totalThrottledNanos, Elastic.Clients.Elasticsearch.Duration totalWait, System.TimeSpan totalWaitNanos) + { + Count = count; + MaxWait = maxWait; + MaxWaitNanos = maxWaitNanos; + TotalElapsed = totalElapsed; + TotalElapsedNanos = totalElapsedNanos; + TotalSize = totalSize; + TotalSizeBytes = totalSizeBytes; + TotalThrottled = totalThrottled; + TotalThrottledNanos = totalThrottledNanos; + TotalWait = totalWait; + TotalWaitNanos = totalWaitNanos; + } +#if NET7_0_OR_GREATER + public ReadSummaryInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ReadSummaryInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ReadSummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of read operations performed in the test. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The maximum time spent waiting for the first byte of any read request to be received. /// /// - [JsonInclude, JsonPropertyName("max_wait")] - public Elastic.Clients.Elasticsearch.Duration MaxWait { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration MaxWait { get; set; } /// /// /// The maximum time spent waiting for the first byte of any read request to be received, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("max_wait_nanos")] - public long MaxWaitNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan MaxWaitNanos { get; set; } /// /// /// The total elapsed time spent on reading blobs in the test. /// /// - [JsonInclude, JsonPropertyName("total_elapsed")] - public Elastic.Clients.Elasticsearch.Duration TotalElapsed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration TotalElapsed { get; set; } /// /// /// The total elapsed time spent on reading blobs in the test, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("total_elapsed_nanos")] - public long TotalElapsedNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalElapsedNanos { get; set; } /// /// /// The total size of all the blobs or partial blobs read in the test. /// /// - [JsonInclude, JsonPropertyName("total_size")] - public Elastic.Clients.Elasticsearch.ByteSize TotalSize { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize TotalSize { get; set; } /// /// /// The total size of all the blobs or partial blobs read in the test, in bytes. /// /// - [JsonInclude, JsonPropertyName("total_size_bytes")] - public long TotalSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeBytes { get; set; } /// /// /// The total time spent waiting due to the max_restore_bytes_per_sec or indices.recovery.max_bytes_per_sec throttles. /// /// - [JsonInclude, JsonPropertyName("total_throttled")] - public Elastic.Clients.Elasticsearch.Duration TotalThrottled { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration TotalThrottled { get; set; } /// /// /// The total time spent waiting due to the max_restore_bytes_per_sec or indices.recovery.max_bytes_per_sec throttles, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("total_throttled_nanos")] - public long TotalThrottledNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalThrottledNanos { get; set; } /// /// /// The total time spent waiting for the first byte of each read request to be received. /// /// - [JsonInclude, JsonPropertyName("total_wait")] - public Elastic.Clients.Elasticsearch.Duration TotalWait { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration TotalWait { get; set; } /// /// /// The total time spent waiting for the first byte of each read request to be received, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("total_wait_nanos")] - public long TotalWaitNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalWaitNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repositories.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repositories.g.cs index 09ae30fd4b8..b5cb718d7f8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repositories.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repositories.g.cs @@ -17,145 +17,48 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public partial class Repositories : IsADictionary +internal sealed partial class RepositoriesConverter : System.Text.Json.Serialization.JsonConverter { - public Repositories() + public override Elastic.Clients.Elasticsearch.Snapshot.Repositories Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { + return new Elastic.Clients.Elasticsearch.Snapshot.Repositories(reader.ReadValue?>(options, static System.Collections.Generic.Dictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))); } - public Repositories(IDictionary container) : base(container) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.Repositories value, System.Text.Json.JsonSerializerOptions options) { - } - - public void Add(string name, IRepository repository) => BackingDictionary.Add(Sanitize(name), repository); - public bool TryGetRepository(string name, [NotNullWhen(returnValue: true)] out IRepository repository) => BackingDictionary.TryGetValue(Sanitize(name), out repository); - - public bool TryGetRepository(string name, [NotNullWhen(returnValue: true)] out T? repository) where T : class, IRepository - { - if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue) - { - repository = finalValue; - return true; - } - - repository = null; - return false; + writer.WriteValue(options, value.BackingDictionary, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.Dictionary? v) => w.WriteDictionaryValue(o, v, null, null)); } } -public sealed partial class RepositoriesDescriptor : IsADictionaryDescriptor +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.RepositoriesConverter))] +public sealed partial class Repositories : Elastic.Clients.Elasticsearch.IsADictionary { - public RepositoriesDescriptor() : base(new Repositories()) + public Repositories() { } - public RepositoriesDescriptor(Repositories repositories) : base(repositories ?? new Repositories()) + public Repositories(System.Collections.Generic.IDictionary backingDictionary) : base(backingDictionary) { } - public RepositoriesDescriptor Azure(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor Azure(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor Azure(string repositoryName, AzureRepository azureRepository) => AssignVariant(repositoryName, azureRepository); - public RepositoriesDescriptor Gcs(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor Gcs(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor Gcs(string repositoryName, GcsRepository gcsRepository) => AssignVariant(repositoryName, gcsRepository); - public RepositoriesDescriptor ReadOnlyUrl(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor ReadOnlyUrl(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor ReadOnlyUrl(string repositoryName, ReadOnlyUrlRepository readOnlyUrlRepository) => AssignVariant(repositoryName, readOnlyUrlRepository); - public RepositoriesDescriptor S3(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor S3(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor S3(string repositoryName, S3Repository s3Repository) => AssignVariant(repositoryName, s3Repository); - public RepositoriesDescriptor SharedFileSystem(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor SharedFileSystem(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor SharedFileSystem(string repositoryName, SharedFileSystemRepository sharedFileSystemRepository) => AssignVariant(repositoryName, sharedFileSystemRepository); - public RepositoriesDescriptor SourceOnly(string repositoryName) => AssignVariant(repositoryName, null); - public RepositoriesDescriptor SourceOnly(string repositoryName, Action configure) => AssignVariant(repositoryName, configure); - public RepositoriesDescriptor SourceOnly(string repositoryName, SourceOnlyRepository sourceOnlyRepository) => AssignVariant(repositoryName, sourceOnlyRepository); -} - -internal sealed partial class RepositoryInterfaceConverter : JsonConverter -{ - public override IRepository Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var copiedReader = reader; - string? type = null; - using var jsonDoc = JsonDocument.ParseValue(ref copiedReader); - if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String) - { - type = readType.ToString(); - } - - switch (type) - { - case "azure": - return JsonSerializer.Deserialize(ref reader, options); - case "gcs": - return JsonSerializer.Deserialize(ref reader, options); - case "url": - return JsonSerializer.Deserialize(ref reader, options); - case "s3": - return JsonSerializer.Deserialize(ref reader, options); - case "fs": - return JsonSerializer.Deserialize(ref reader, options); - case "source": - return JsonSerializer.Deserialize(ref reader, options); - default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(IRepository)); - return null; - } - } + public void Add(string key, Elastic.Clients.Elasticsearch.Snapshot.IRepository value) => BackingDictionary.Add(Sanitize(key), value); + public bool TryGetRepository(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out Elastic.Clients.Elasticsearch.Snapshot.IRepository value) => BackingDictionary.TryGetValue(Sanitize(key), out value); - public override void Write(Utf8JsonWriter writer, IRepository value, JsonSerializerOptions options) + public bool TryGetRepository(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(returnValue: true)] out T? value) where T : class, IRepository { - if (value is null) + if (BackingDictionary.TryGetValue(Sanitize(key), out var matchedValue) && matchedValue is T finalValue) { - writer.WriteNullValue(); - return; + value = finalValue; + return true; } - switch (value.Type) - { - case "azure": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.AzureRepository), options); - return; - case "gcs": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.GcsRepository), options); - return; - case "url": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository), options); - return; - case "s3": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.S3Repository), options); - return; - case "fs": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository), options); - return; - case "source": - JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository), options); - return; - default: - var type = value.GetType(); - JsonSerializer.Serialize(writer, value, type, options); - return; - } + value = null; + return false; } -} - -[JsonConverter(typeof(RepositoryInterfaceConverter))] -public partial interface IRepository -{ - public string? Type { get; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repository.g.cs new file mode 100644 index 00000000000..7aa9a5f6df3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Repository.g.cs @@ -0,0 +1,165 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Snapshot; + +internal sealed partial class IRepositoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDiscriminator = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Snapshot.IRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + var readerSnapshot = reader; + string? discriminator = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.TryReadProperty(options, PropDiscriminator, ref discriminator, null)) + { + break; + } + + reader.Skip(); + } + + reader = readerSnapshot; + return discriminator switch + { + "azure" => reader.ReadValue(options, null), + "fs" => reader.ReadValue(options, null), + "gcs" => reader.ReadValue(options, null), + "s3" => reader.ReadValue(options, null), + "source" => reader.ReadValue(options, null), + "url" => reader.ReadValue(options, null), + _ => throw new System.Text.Json.JsonException($"Variant '{discriminator}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Snapshot.IRepository)}'.") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.IRepository value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Type) + { + case "azure": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.AzureRepository)value, null); + break; + case "fs": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository)value, null); + break; + case "gcs": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.GcsRepository)value, null); + break; + case "s3": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.S3Repository)value, null); + break; + case "source": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository)value, null); + break; + case "url": + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository)value, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.Type}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.Snapshot.IRepository)}'."); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.IRepositoryConverter))] +public partial interface IRepository +{ + public string Type { get; } +} + +public readonly partial struct RepositoryFactory +{ + public Elastic.Clients.Elasticsearch.Snapshot.IRepository Azure(Elastic.Clients.Elasticsearch.Snapshot.AzureRepository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository Azure() + { + return Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor.Build(null); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository Azure(System.Action? action) + { + return Elastic.Clients.Elasticsearch.Snapshot.AzureRepositoryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository SharedFileSystem(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository SharedFileSystem(System.Action action) + { + return Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository Gcs(Elastic.Clients.Elasticsearch.Snapshot.GcsRepository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository Gcs(System.Action action) + { + return Elastic.Clients.Elasticsearch.Snapshot.GcsRepositoryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository S3(Elastic.Clients.Elasticsearch.Snapshot.S3Repository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository S3(System.Action action) + { + return Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository SourceOnly(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository SourceOnly(System.Action action) + { + return Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor.Build(action); + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository ReadOnlyUrl(Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepository value) + { + return value; + } + + public Elastic.Clients.Elasticsearch.Snapshot.IRepository ReadOnlyUrl(System.Action action) + { + return Elastic.Clients.Elasticsearch.Snapshot.ReadOnlyUrlRepositoryDescriptor.Build(action); + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.IRepository Build(System.Func action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.RepositoryFactory(); + return action.Invoke(builder); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3Repository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3Repository.g.cs index 9c5b626d63f..971a5957cc6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3Repository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3Repository.g.cs @@ -17,128 +17,181 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class S3Repository : IRepository +internal sealed partial class S3RepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "s3"; + public override Elastic.Clients.Elasticsearch.Snapshot.S3Repository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class S3RepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal S3RepositoryDescriptor(Action configure) => configure.Invoke(this); + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - public S3RepositoryDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public S3RepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings settings) - { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.S3Repository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; } - public S3RepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.S3Repository value, System.Text.Json.JsonSerializerOptions options) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); } +} - public S3RepositoryDescriptor Settings(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryConverter))] +public sealed partial class S3Repository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3Repository(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings settings) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Settings = settings; } - - public S3RepositoryDescriptor Uuid(string? uuid) +#if NET7_0_OR_GREATER + public S3Repository() { - UuidValue = uuid; - return Self; } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public S3Repository() { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal S3Repository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("s3"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } + /// + /// + /// The repository settings. + /// + /// + /// NOTE: In addition to the specified settings, you can also use all non-secure client settings in the repository settings. + /// In this case, the client settings found in the repository settings will be merged with those of the named client used by the repository. + /// Conflicts between client and repository settings are resolved by the repository settings taking precedence over client settings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings Settings { get; set; } + + /// + /// + /// The S3 repository type. + /// + /// + public string Type => "s3"; - writer.WriteEndObject(); + public string? Uuid { get; set; } +} + +public readonly partial struct S3RepositoryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Snapshot.S3Repository Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3RepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.S3Repository instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings BuildSettings() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3RepositoryDescriptor() { - if (SettingsValue is not null) - { - return SettingsValue; - } + Instance = new Elastic.Clients.Elasticsearch.Snapshot.S3Repository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.S3Repository instance) => new Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.S3Repository(Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The repository settings. + /// + /// + /// NOTE: In addition to the specified settings, you can also use all non-secure client settings in the repository settings. + /// In this case, the client settings found in the repository settings will be merged with those of the named client used by the repository. + /// Conflicts between client and repository settings are resolved by the repository settings taking precedence over client settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings value) + { + Instance.Settings = value; + return this; + } - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + /// + /// + /// The repository settings. + /// + /// + /// NOTE: In addition to the specified settings, you can also use all non-secure client settings in the repository settings. + /// In this case, the client settings found in the repository settings will be merged with those of the named client used by the repository. + /// Conflicts between client and repository settings are resolved by the repository settings taking precedence over client settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor Settings(System.Action action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor.Build(action); + return this; + } - return null; + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor Uuid(string? value) + { + Instance.Uuid = value; + return this; } - S3Repository IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.S3Repository Build(System.Action action) { - Settings = BuildSettings(), - Uuid = UuidValue - }; + var builder = new Elastic.Clients.Elasticsearch.Snapshot.S3RepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.S3Repository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3RepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3RepositorySettings.g.cs index b2aad005d0f..156f20f0959 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3RepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/S3RepositorySettings.g.cs @@ -17,208 +17,755 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class S3RepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBasePath = System.Text.Json.JsonEncodedText.Encode("base_path"); + private static readonly System.Text.Json.JsonEncodedText PropBucket = System.Text.Json.JsonEncodedText.Encode("bucket"); + private static readonly System.Text.Json.JsonEncodedText PropBufferSize = System.Text.Json.JsonEncodedText.Encode("buffer_size"); + private static readonly System.Text.Json.JsonEncodedText PropCannedAcl = System.Text.Json.JsonEncodedText.Encode("canned_acl"); + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropClient = System.Text.Json.JsonEncodedText.Encode("client"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropDeleteObjectsMaxSize = System.Text.Json.JsonEncodedText.Encode("delete_objects_max_size"); + private static readonly System.Text.Json.JsonEncodedText PropGetRegisterRetryDelay = System.Text.Json.JsonEncodedText.Encode("get_register_retry_delay"); + private static readonly System.Text.Json.JsonEncodedText PropMaxMultipartParts = System.Text.Json.JsonEncodedText.Encode("max_multipart_parts"); + private static readonly System.Text.Json.JsonEncodedText PropMaxMultipartUploadCleanupSize = System.Text.Json.JsonEncodedText.Encode("max_multipart_upload_cleanup_size"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropReadonly = System.Text.Json.JsonEncodedText.Encode("readonly"); + private static readonly System.Text.Json.JsonEncodedText PropServerSideEncryption = System.Text.Json.JsonEncodedText.Encode("server_side_encryption"); + private static readonly System.Text.Json.JsonEncodedText PropStorageClass = System.Text.Json.JsonEncodedText.Encode("storage_class"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledDeleteRetryDelayIncrement = System.Text.Json.JsonEncodedText.Encode("throttled_delete_retry.delay_increment"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledDeleteRetryMaximumDelay = System.Text.Json.JsonEncodedText.Encode("throttled_delete_retry.maximum_delay"); + private static readonly System.Text.Json.JsonEncodedText PropThrottledDeleteRetryMaximumNumberOfRetries = System.Text.Json.JsonEncodedText.Encode("throttled_delete_retry.maximum_number_of_retries"); + + public override Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBasePath = default; + LocalJsonValue propBucket = default; + LocalJsonValue propBufferSize = default; + LocalJsonValue propCannedAcl = default; + LocalJsonValue propChunkSize = default; + LocalJsonValue propClient = default; + LocalJsonValue propCompress = default; + LocalJsonValue propDeleteObjectsMaxSize = default; + LocalJsonValue propGetRegisterRetryDelay = default; + LocalJsonValue propMaxMultipartParts = default; + LocalJsonValue propMaxMultipartUploadCleanupSize = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propReadonly = default; + LocalJsonValue propServerSideEncryption = default; + LocalJsonValue propStorageClass = default; + LocalJsonValue propThrottledDeleteRetryDelayIncrement = default; + LocalJsonValue propThrottledDeleteRetryMaximumDelay = default; + LocalJsonValue propThrottledDeleteRetryMaximumNumberOfRetries = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBasePath.TryReadProperty(ref reader, options, PropBasePath, null)) + { + continue; + } + + if (propBucket.TryReadProperty(ref reader, options, PropBucket, null)) + { + continue; + } + + if (propBufferSize.TryReadProperty(ref reader, options, PropBufferSize, null)) + { + continue; + } + + if (propCannedAcl.TryReadProperty(ref reader, options, PropCannedAcl, null)) + { + continue; + } + + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) + { + continue; + } + + if (propClient.TryReadProperty(ref reader, options, PropClient, null)) + { + continue; + } + + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propDeleteObjectsMaxSize.TryReadProperty(ref reader, options, PropDeleteObjectsMaxSize, null)) + { + continue; + } + + if (propGetRegisterRetryDelay.TryReadProperty(ref reader, options, PropGetRegisterRetryDelay, null)) + { + continue; + } + + if (propMaxMultipartParts.TryReadProperty(ref reader, options, PropMaxMultipartParts, null)) + { + continue; + } + + if (propMaxMultipartUploadCleanupSize.TryReadProperty(ref reader, options, PropMaxMultipartUploadCleanupSize, null)) + { + continue; + } + + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } + + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } + + if (propReadonly.TryReadProperty(ref reader, options, PropReadonly, null)) + { + continue; + } + + if (propServerSideEncryption.TryReadProperty(ref reader, options, PropServerSideEncryption, null)) + { + continue; + } + + if (propStorageClass.TryReadProperty(ref reader, options, PropStorageClass, null)) + { + continue; + } + + if (propThrottledDeleteRetryDelayIncrement.TryReadProperty(ref reader, options, PropThrottledDeleteRetryDelayIncrement, null)) + { + continue; + } + + if (propThrottledDeleteRetryMaximumDelay.TryReadProperty(ref reader, options, PropThrottledDeleteRetryMaximumDelay, null)) + { + continue; + } + + if (propThrottledDeleteRetryMaximumNumberOfRetries.TryReadProperty(ref reader, options, PropThrottledDeleteRetryMaximumNumberOfRetries, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BasePath = propBasePath.Value, + Bucket = propBucket.Value, + BufferSize = propBufferSize.Value, + CannedAcl = propCannedAcl.Value, + ChunkSize = propChunkSize.Value, + Client = propClient.Value, + Compress = propCompress.Value, + DeleteObjectsMaxSize = propDeleteObjectsMaxSize.Value, + GetRegisterRetryDelay = propGetRegisterRetryDelay.Value, + MaxMultipartParts = propMaxMultipartParts.Value, + MaxMultipartUploadCleanupSize = propMaxMultipartUploadCleanupSize.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + Readonly = propReadonly.Value, + ServerSideEncryption = propServerSideEncryption.Value, + StorageClass = propStorageClass.Value, + ThrottledDeleteRetryDelayIncrement = propThrottledDeleteRetryDelayIncrement.Value, + ThrottledDeleteRetryMaximumDelay = propThrottledDeleteRetryMaximumDelay.Value, + ThrottledDeleteRetryMaximumNumberOfRetries = propThrottledDeleteRetryMaximumNumberOfRetries.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBasePath, value.BasePath, null, null); + writer.WriteProperty(options, PropBucket, value.Bucket, null, null); + writer.WriteProperty(options, PropBufferSize, value.BufferSize, null, null); + writer.WriteProperty(options, PropCannedAcl, value.CannedAcl, null, null); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropClient, value.Client, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropDeleteObjectsMaxSize, value.DeleteObjectsMaxSize, null, null); + writer.WriteProperty(options, PropGetRegisterRetryDelay, value.GetRegisterRetryDelay, null, null); + writer.WriteProperty(options, PropMaxMultipartParts, value.MaxMultipartParts, null, null); + writer.WriteProperty(options, PropMaxMultipartUploadCleanupSize, value.MaxMultipartUploadCleanupSize, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropReadonly, value.Readonly, null, null); + writer.WriteProperty(options, PropServerSideEncryption, value.ServerSideEncryption, null, null); + writer.WriteProperty(options, PropStorageClass, value.StorageClass, null, null); + writer.WriteProperty(options, PropThrottledDeleteRetryDelayIncrement, value.ThrottledDeleteRetryDelayIncrement, null, null); + writer.WriteProperty(options, PropThrottledDeleteRetryMaximumDelay, value.ThrottledDeleteRetryMaximumDelay, null, null); + writer.WriteProperty(options, PropThrottledDeleteRetryMaximumNumberOfRetries, value.ThrottledDeleteRetryMaximumNumberOfRetries, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsConverter))] public sealed partial class S3RepositorySettings { - [JsonInclude, JsonPropertyName("base_path")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3RepositorySettings(string bucket) + { + Bucket = bucket; + } +#if NET7_0_OR_GREATER + public S3RepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public S3RepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal S3RepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The path to the repository data within its bucket. + /// It defaults to an empty string, meaning that the repository is at the root of the bucket. + /// The value of this setting should not start or end with a forward slash (/). + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments may share the same bucket. + /// + /// public string? BasePath { get; set; } - [JsonInclude, JsonPropertyName("bucket")] - public string Bucket { get; set; } - [JsonInclude, JsonPropertyName("buffer_size")] + + /// + /// + /// The name of the S3 bucket to use for snapshots. + /// The bucket name must adhere to Amazon's S3 bucket naming rules. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Bucket { get; set; } + + /// + /// + /// The minimum threshold below which the chunk is uploaded using a single request. + /// Beyond this threshold, the S3 repository will use the AWS Multipart Upload API to split the chunk into several parts, each of buffer_size length, and to upload each part in its own request. + /// Note that setting a buffer size lower than 5mb is not allowed since it will prevent the use of the Multipart API and may result in upload errors. + /// It is also not possible to set a buffer size greater than 5gb as it is the maximum upload size allowed by S3. + /// Defaults to 100mb or 5% of JVM heap, whichever is smaller. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? BufferSize { get; set; } - [JsonInclude, JsonPropertyName("canned_acl")] + + /// + /// + /// The S3 repository supports all S3 canned ACLs: private, public-read, public-read-write, authenticated-read, log-delivery-write, bucket-owner-read, bucket-owner-full-control. + /// You could specify a canned ACL using the canned_acl setting. + /// When the S3 repository creates buckets and objects, it adds the canned ACL into the buckets and objects. + /// + /// public string? CannedAcl { get; set; } - [JsonInclude, JsonPropertyName("chunk_size")] + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } - [JsonInclude, JsonPropertyName("client")] + + /// + /// + /// The name of the S3 client to use to connect to S3. + /// + /// public string? Client { get; set; } - [JsonInclude, JsonPropertyName("compress")] + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("max_restore_bytes_per_sec")] + + /// + /// + /// The maxmimum batch size, between 1 and 1000, used for DeleteObjects requests. + /// Defaults to 1000 which is the maximum number supported by the AWS DeleteObjects API. + /// + /// + public int? DeleteObjectsMaxSize { get; set; } + + /// + /// + /// The time to wait before trying again if an attempt to read a linearizable register fails. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? GetRegisterRetryDelay { get; set; } + + /// + /// + /// The maximum number of parts that Elasticsearch will write during a multipart upload of a single object. + /// Files which are larger than buffer_size × max_multipart_parts will be chunked into several smaller objects. + /// Elasticsearch may also split a file across multiple objects to satisfy other constraints such as the chunk_size limit. + /// Defaults to 10000 which is the maximum number of parts in a multipart upload in AWS S3. + /// + /// + public int? MaxMultipartParts { get; set; } + + /// + /// + /// The maximum number of possibly-dangling multipart uploads to clean up in each batch of snapshot deletions. + /// Defaults to 1000 which is the maximum number supported by the AWS ListMultipartUploads API. + /// If set to 0, Elasticsearch will not attempt to clean up dangling multipart uploads. + /// + /// + public int? MaxMultipartUploadCleanupSize { get; set; } + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("max_snapshot_bytes_per_sec")] + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("readonly")] + + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// public bool? Readonly { get; set; } - [JsonInclude, JsonPropertyName("server_side_encryption")] + + /// + /// + /// When set to true, files are encrypted on server side using an AES256 algorithm. + /// + /// public bool? ServerSideEncryption { get; set; } - [JsonInclude, JsonPropertyName("storage_class")] + + /// + /// + /// The S3 storage class for objects written to the repository. + /// Values may be standard, reduced_redundancy, standard_ia, onezone_ia, and intelligent_tiering. + /// + /// public string? StorageClass { get; set; } + + /// + /// + /// The delay before the first retry and the amount the delay is incremented by on each subsequent retry. + /// The default is 50ms and the minimum is 0ms. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? ThrottledDeleteRetryDelayIncrement { get; set; } + + /// + /// + /// The upper bound on how long the delays between retries will grow to. + /// The default is 5s and the minimum is 0ms. + /// + /// + public Elastic.Clients.Elasticsearch.Duration? ThrottledDeleteRetryMaximumDelay { get; set; } + + /// + /// + /// The number times to retry a throttled snapshot deletion. + /// The default is 10 and the minimum value is 0 which will disable retries altogether. + /// Note that if retries are enabled in the Azure client, each of these retries comprises that many client-level retries. + /// + /// + public int? ThrottledDeleteRetryMaximumNumberOfRetries { get; set; } } -public sealed partial class S3RepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct S3RepositorySettingsDescriptor { - internal S3RepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings Instance { get; init; } - public S3RepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3RepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings instance) { + Instance = instance; } - private string? BasePathValue { get; set; } - private string BucketValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? BufferSizeValue { get; set; } - private string? CannedAclValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private string? ClientValue { get; set; } - private bool? CompressValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private bool? ReadonlyValue { get; set; } - private bool? ServerSideEncryptionValue { get; set; } - private string? StorageClassValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public S3RepositorySettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public S3RepositorySettingsDescriptor BasePath(string? basePath) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// The path to the repository data within its bucket. + /// It defaults to an empty string, meaning that the repository is at the root of the bucket. + /// The value of this setting should not start or end with a forward slash (/). + /// + /// + /// NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. + /// Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments may share the same bucket. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor BasePath(string? value) { - BasePathValue = basePath; - return Self; + Instance.BasePath = value; + return this; } - public S3RepositorySettingsDescriptor Bucket(string bucket) + /// + /// + /// The name of the S3 bucket to use for snapshots. + /// The bucket name must adhere to Amazon's S3 bucket naming rules. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor Bucket(string value) { - BucketValue = bucket; - return Self; + Instance.Bucket = value; + return this; } - public S3RepositorySettingsDescriptor BufferSize(Elastic.Clients.Elasticsearch.ByteSize? bufferSize) + /// + /// + /// The minimum threshold below which the chunk is uploaded using a single request. + /// Beyond this threshold, the S3 repository will use the AWS Multipart Upload API to split the chunk into several parts, each of buffer_size length, and to upload each part in its own request. + /// Note that setting a buffer size lower than 5mb is not allowed since it will prevent the use of the Multipart API and may result in upload errors. + /// It is also not possible to set a buffer size greater than 5gb as it is the maximum upload size allowed by S3. + /// Defaults to 100mb or 5% of JVM heap, whichever is smaller. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor BufferSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - BufferSizeValue = bufferSize; - return Self; + Instance.BufferSize = value; + return this; } - public S3RepositorySettingsDescriptor CannedAcl(string? cannedAcl) + /// + /// + /// The minimum threshold below which the chunk is uploaded using a single request. + /// Beyond this threshold, the S3 repository will use the AWS Multipart Upload API to split the chunk into several parts, each of buffer_size length, and to upload each part in its own request. + /// Note that setting a buffer size lower than 5mb is not allowed since it will prevent the use of the Multipart API and may result in upload errors. + /// It is also not possible to set a buffer size greater than 5gb as it is the maximum upload size allowed by S3. + /// Defaults to 100mb or 5% of JVM heap, whichever is smaller. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor BufferSize(System.Func action) { - CannedAclValue = cannedAcl; - return Self; + Instance.BufferSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public S3RepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + /// + /// + /// The S3 repository supports all S3 canned ACLs: private, public-read, public-read-write, authenticated-read, log-delivery-write, bucket-owner-read, bucket-owner-full-control. + /// You could specify a canned ACL using the canned_acl setting. + /// When the S3 repository creates buckets and objects, it adds the canned ACL into the buckets and objects. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor CannedAcl(string? value) { - ChunkSizeValue = chunkSize; - return Self; + Instance.CannedAcl = value; + return this; } - public S3RepositorySettingsDescriptor Client(string? client) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - ClientValue = client; - return Self; + Instance.ChunkSize = value; + return this; } - public S3RepositorySettingsDescriptor Compress(bool? compress = true) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ChunkSize(System.Func action) { - CompressValue = compress; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public S3RepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The name of the S3 client to use to connect to S3. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor Client(string? value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.Client = value; + return this; } - public S3RepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor Compress(bool? value = true) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.Compress = value; + return this; } - public S3RepositorySettingsDescriptor Readonly(bool? value = true) + /// + /// + /// The maxmimum batch size, between 1 and 1000, used for DeleteObjects requests. + /// Defaults to 1000 which is the maximum number supported by the AWS DeleteObjects API. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor DeleteObjectsMaxSize(int? value) { - ReadonlyValue = value; - return Self; + Instance.DeleteObjectsMaxSize = value; + return this; } - public S3RepositorySettingsDescriptor ServerSideEncryption(bool? serverSideEncryption = true) + /// + /// + /// The time to wait before trying again if an attempt to read a linearizable register fails. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor GetRegisterRetryDelay(Elastic.Clients.Elasticsearch.Duration? value) { - ServerSideEncryptionValue = serverSideEncryption; - return Self; + Instance.GetRegisterRetryDelay = value; + return this; } - public S3RepositorySettingsDescriptor StorageClass(string? storageClass) + /// + /// + /// The maximum number of parts that Elasticsearch will write during a multipart upload of a single object. + /// Files which are larger than buffer_size × max_multipart_parts will be chunked into several smaller objects. + /// Elasticsearch may also split a file across multiple objects to satisfy other constraints such as the chunk_size limit. + /// Defaults to 10000 which is the maximum number of parts in a multipart upload in AWS S3. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxMultipartParts(int? value) { - StorageClassValue = storageClass; - return Self; + Instance.MaxMultipartParts = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum number of possibly-dangling multipart uploads to clean up in each batch of snapshot deletions. + /// Defaults to 1000 which is the maximum number supported by the AWS ListMultipartUploads API. + /// If set to 0, Elasticsearch will not attempt to clean up dangling multipart uploads. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxMultipartUploadCleanupSize(int? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(BasePathValue)) - { - writer.WritePropertyName("base_path"); - writer.WriteStringValue(BasePathValue); - } + Instance.MaxMultipartUploadCleanupSize = value; + return this; + } - writer.WritePropertyName("bucket"); - writer.WriteStringValue(BucketValue); - if (BufferSizeValue is not null) - { - writer.WritePropertyName("buffer_size"); - JsonSerializer.Serialize(writer, BufferSizeValue, options); - } + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxRestoreBytesPerSec = value; + return this; + } - if (!string.IsNullOrEmpty(CannedAclValue)) - { - writer.WritePropertyName("canned_acl"); - writer.WriteStringValue(CannedAclValue); - } + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) + { + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (!string.IsNullOrEmpty(ClientValue)) - { - writer.WritePropertyName("client"); - writer.WriteStringValue(ClientValue); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor Readonly(bool? value = true) + { + Instance.Readonly = value; + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// When set to true, files are encrypted on server side using an AES256 algorithm. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ServerSideEncryption(bool? value = true) + { + Instance.ServerSideEncryption = value; + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// The S3 storage class for objects written to the repository. + /// Values may be standard, reduced_redundancy, standard_ia, onezone_ia, and intelligent_tiering. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor StorageClass(string? value) + { + Instance.StorageClass = value; + return this; + } - if (ReadonlyValue.HasValue) - { - writer.WritePropertyName("readonly"); - writer.WriteBooleanValue(ReadonlyValue.Value); - } + /// + /// + /// The delay before the first retry and the amount the delay is incremented by on each subsequent retry. + /// The default is 50ms and the minimum is 0ms. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ThrottledDeleteRetryDelayIncrement(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.ThrottledDeleteRetryDelayIncrement = value; + return this; + } - if (ServerSideEncryptionValue.HasValue) - { - writer.WritePropertyName("server_side_encryption"); - writer.WriteBooleanValue(ServerSideEncryptionValue.Value); - } + /// + /// + /// The upper bound on how long the delays between retries will grow to. + /// The default is 5s and the minimum is 0ms. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ThrottledDeleteRetryMaximumDelay(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.ThrottledDeleteRetryMaximumDelay = value; + return this; + } - if (!string.IsNullOrEmpty(StorageClassValue)) - { - writer.WritePropertyName("storage_class"); - writer.WriteStringValue(StorageClassValue); - } + /// + /// + /// The number times to retry a throttled snapshot deletion. + /// The default is 10 and the minimum value is 0 which will disable retries altogether. + /// Note that if retries are enabled in the Azure client, each of these retries comprises that many client-level retries. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor ThrottledDeleteRetryMaximumNumberOfRetries(int? value) + { + Instance.ThrottledDeleteRetryMaximumNumberOfRetries = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.S3RepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStats.g.cs index cdf6c2f9e05..3f7d6582972 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStats.g.cs @@ -17,28 +17,189 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ShardsStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDone = System.Text.Json.JsonEncodedText.Encode("done"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropFinalizing = System.Text.Json.JsonEncodedText.Encode("finalizing"); + private static readonly System.Text.Json.JsonEncodedText PropInitializing = System.Text.Json.JsonEncodedText.Encode("initializing"); + private static readonly System.Text.Json.JsonEncodedText PropStarted = System.Text.Json.JsonEncodedText.Encode("started"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ShardsStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDone = default; + LocalJsonValue propFailed = default; + LocalJsonValue propFinalizing = default; + LocalJsonValue propInitializing = default; + LocalJsonValue propStarted = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDone.TryReadProperty(ref reader, options, PropDone, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propFinalizing.TryReadProperty(ref reader, options, PropFinalizing, null)) + { + continue; + } + + if (propInitializing.TryReadProperty(ref reader, options, PropInitializing, null)) + { + continue; + } + + if (propStarted.TryReadProperty(ref reader, options, PropStarted, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ShardsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Done = propDone.Value, + Failed = propFailed.Value, + Finalizing = propFinalizing.Value, + Initializing = propInitializing.Value, + Started = propStarted.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ShardsStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDone, value.Done, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropFinalizing, value.Finalizing, null, null); + writer.WriteProperty(options, PropInitializing, value.Initializing, null, null); + writer.WriteProperty(options, PropStarted, value.Started, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsConverter))] public sealed partial class ShardsStats { - [JsonInclude, JsonPropertyName("done")] - public long Done { get; init; } - [JsonInclude, JsonPropertyName("failed")] - public long Failed { get; init; } - [JsonInclude, JsonPropertyName("finalizing")] - public long Finalizing { get; init; } - [JsonInclude, JsonPropertyName("initializing")] - public long Initializing { get; init; } - [JsonInclude, JsonPropertyName("started")] - public long Started { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsStats(long done, long failed, long finalizing, long initializing, long started, long total) + { + Done = done; + Failed = failed; + Finalizing = finalizing; + Initializing = initializing; + Started = started; + Total = total; + } +#if NET7_0_OR_GREATER + public ShardsStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The number of shards that initialized, started, and finalized successfully. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Done { get; set; } + + /// + /// + /// The number of shards that failed to be included in the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Failed { get; set; } + + /// + /// + /// The number of shards that are finalizing but are not done. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Finalizing { get; set; } + + /// + /// + /// The number of shards that are still initializing. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Initializing { get; set; } + + /// + /// + /// The number of shards that have started but are not finalized. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Started { get; set; } + + /// + /// + /// The total number of shards included in the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummary.g.cs index 8fa7773db2d..a5594cfc862 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummary.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ShardsStatsSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIncremental = System.Text.Json.JsonEncodedText.Encode("incremental"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIncremental = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInMillis = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIncremental.TryReadProperty(ref reader, options, PropIncremental, null)) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Incremental = propIncremental.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + Time = propTime.Value, + TimeInMillis = propTimeInMillis.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIncremental, value.Incremental, null, null); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryConverter))] public sealed partial class ShardsStatsSummary { - [JsonInclude, JsonPropertyName("incremental")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem Incremental { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsStatsSummary(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem incremental, System.DateTimeOffset startTimeInMillis, System.TimeSpan timeInMillis, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem total) + { + Incremental = incremental; + StartTimeInMillis = startTimeInMillis; + TimeInMillis = timeInMillis; + Total = total; + } +#if NET7_0_OR_GREATER + public ShardsStatsSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsStatsSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsStatsSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem Incremental { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummaryItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummaryItem.g.cs index 789afdb5cc9..44f2a5c4c81 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummaryItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/ShardsStatsSummaryItem.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class ShardsStatsSummaryItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFileCount = System.Text.Json.JsonEncodedText.Encode("file_count"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propFileCount = default; + LocalJsonValue propSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFileCount.TryReadProperty(ref reader, options, PropFileCount, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FileCount = propFileCount.Value, + SizeInBytes = propSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFileCount, value.FileCount, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummaryItemConverter))] public sealed partial class ShardsStatsSummaryItem { - [JsonInclude, JsonPropertyName("file_count")] - public long FileCount { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ShardsStatsSummaryItem(long fileCount, long sizeInBytes) + { + FileCount = fileCount; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public ShardsStatsSummaryItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ShardsStatsSummaryItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ShardsStatsSummaryItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long FileCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepository.g.cs index ada5c85a200..05ae927b64b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepository.g.cs @@ -17,128 +17,166 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class SharedFileSystemRepository : IRepository +internal sealed partial class SharedFileSystemRepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "fs"; + public override Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class SharedFileSystemRepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal SharedFileSystemRepositoryDescriptor(Action configure) => configure.Invoke(this); + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - public SharedFileSystemRepositoryDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public SharedFileSystemRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings settings) - { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; } - public SharedFileSystemRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository value, System.Text.Json.JsonSerializerOptions options) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); } +} - public SharedFileSystemRepositoryDescriptor Settings(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryConverter))] +public sealed partial class SharedFileSystemRepository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings settings) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + Settings = settings; } - - public SharedFileSystemRepositoryDescriptor Uuid(string? uuid) +#if NET7_0_OR_GREATER + public SharedFileSystemRepository() { - UuidValue = uuid; - return Self; } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SharedFileSystemRepository() { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - writer.WritePropertyName("type"); - writer.WriteStringValue("fs"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } + /// + /// + /// The repository settings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings Settings { get; set; } + + /// + /// + /// The shared file system repository type. + /// + /// + public string Type => "fs"; - writer.WriteEndObject(); + public string? Uuid { get; set; } +} + +public readonly partial struct SharedFileSystemRepositoryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository instance) + { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings BuildSettings() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepositoryDescriptor() { - if (SettingsValue is not null) - { - return SettingsValue; - } + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository instance) => new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor descriptor) => descriptor.Instance; - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings value) + { + Instance.Settings = value; + return this; + } - return null; + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor Settings(System.Action action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor.Build(action); + return this; } - SharedFileSystemRepository IBuildableDescriptor.Build() => new() + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor Uuid(string? value) { - Settings = BuildSettings(), - Uuid = UuidValue - }; + Instance.Uuid = value; + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepositorySettings.g.cs index 9da76da8497..04bf0fa089f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SharedFileSystemRepositorySettings.g.cs @@ -17,133 +17,374 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SharedFileSystemRepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropLocation = System.Text.Json.JsonEncodedText.Encode("location"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumberOfSnapshots = System.Text.Json.JsonEncodedText.Encode("max_number_of_snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropReadonly = System.Text.Json.JsonEncodedText.Encode("readonly"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkSize = default; + LocalJsonValue propCompress = default; + LocalJsonValue propLocation = default; + LocalJsonValue propMaxNumberOfSnapshots = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propReadonly = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) + { + continue; + } + + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } + + if (propLocation.TryReadProperty(ref reader, options, PropLocation, null)) + { + continue; + } + + if (propMaxNumberOfSnapshots.TryReadProperty(ref reader, options, PropMaxNumberOfSnapshots, null)) + { + continue; + } + + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } + + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } + + if (propReadonly.TryReadProperty(ref reader, options, PropReadonly, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChunkSize = propChunkSize.Value, + Compress = propCompress.Value, + Location = propLocation.Value, + MaxNumberOfSnapshots = propMaxNumberOfSnapshots.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + Readonly = propReadonly.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropLocation, value.Location, null, null); + writer.WriteProperty(options, PropMaxNumberOfSnapshots, value.MaxNumberOfSnapshots, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropReadonly, value.Readonly, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsConverter))] public sealed partial class SharedFileSystemRepositorySettings { - [JsonInclude, JsonPropertyName("chunk_size")] + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepositorySettings(string location) + { + Location = location; + } +#if NET7_0_OR_GREATER + public SharedFileSystemRepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SharedFileSystemRepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SharedFileSystemRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } - [JsonInclude, JsonPropertyName("compress")] + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } - [JsonInclude, JsonPropertyName("location")] - public string Location { get; set; } - [JsonInclude, JsonPropertyName("max_number_of_snapshots")] + + /// + /// + /// The location of the shared filesystem used to store and retrieve snapshots. + /// This location must be registered in the path.repo setting on all master and data nodes in the cluster. + /// Unlike path.repo, this setting supports only a single file path. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Location { get; set; } + + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// public int? MaxNumberOfSnapshots { get; set; } - [JsonInclude, JsonPropertyName("max_restore_bytes_per_sec")] + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("max_snapshot_bytes_per_sec")] + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } - [JsonInclude, JsonPropertyName("readonly")] + + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// public bool? Readonly { get; set; } } -public sealed partial class SharedFileSystemRepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct SharedFileSystemRepositorySettingsDescriptor { - internal SharedFileSystemRepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings Instance { get; init; } - public SharedFileSystemRepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private bool? CompressValue { get; set; } - private string LocationValue { get; set; } - private int? MaxNumberOfSnapshotsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private bool? ReadonlyValue { get; set; } - - public SharedFileSystemRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SharedFileSystemRepositorySettingsDescriptor() { - ChunkSizeValue = chunkSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SharedFileSystemRepositorySettingsDescriptor Compress(bool? compress = true) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - CompressValue = compress; - return Self; + Instance.ChunkSize = value; + return this; } - public SharedFileSystemRepositorySettingsDescriptor Location(string location) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor ChunkSize(System.Func action) { - LocationValue = location; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public SharedFileSystemRepositorySettingsDescriptor MaxNumberOfSnapshots(int? maxNumberOfSnapshots) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor Compress(bool? value = true) { - MaxNumberOfSnapshotsValue = maxNumberOfSnapshots; - return Self; + Instance.Compress = value; + return this; } - public SharedFileSystemRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The location of the shared filesystem used to store and retrieve snapshots. + /// This location must be registered in the path.repo setting on all master and data nodes in the cluster. + /// Unlike path.repo, this setting supports only a single file path. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor Location(string value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.Location = value; + return this; } - public SharedFileSystemRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor MaxNumberOfSnapshots(int? value) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.MaxNumberOfSnapshots = value; + return this; } - public SharedFileSystemRepositorySettingsDescriptor Readonly(bool? value = true) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) { - ReadonlyValue = value; - return Self; + Instance.MaxRestoreBytesPerSec = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) { - writer.WriteStartObject(); - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } - - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } - - writer.WritePropertyName("location"); - writer.WriteStringValue(LocationValue); - if (MaxNumberOfSnapshotsValue.HasValue) - { - writer.WritePropertyName("max_number_of_snapshots"); - writer.WriteNumberValue(MaxNumberOfSnapshotsValue.Value); - } + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (ReadonlyValue.HasValue) - { - writer.WritePropertyName("readonly"); - writer.WriteBooleanValue(ReadonlyValue.Value); - } + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor Readonly(bool? value = true) + { + Instance.Readonly = value; + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.SharedFileSystemRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotIndexStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotIndexStats.g.cs index a0dbb2c6e49..c24c3c70d16 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotIndexStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotIndexStats.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotIndexStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropShardsStats = System.Text.Json.JsonEncodedText.Encode("shards_stats"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotIndexStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propShards = default; + LocalJsonValue propShardsStats = default; + LocalJsonValue propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propShards.TryReadProperty(ref reader, options, PropShards, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propShardsStats.TryReadProperty(ref reader, options, PropShardsStats, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotIndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Shards = propShards.Value, + ShardsStats = propShardsStats.Value, + Stats = propStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotIndexStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropShards, value.Shards, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropShardsStats, value.ShardsStats, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotIndexStatsConverter))] public sealed partial class SnapshotIndexStats { - [JsonInclude, JsonPropertyName("shards")] - public IReadOnlyDictionary Shards { get; init; } - [JsonInclude, JsonPropertyName("shards_stats")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStats ShardsStats { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats Stats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotIndexStats(System.Collections.Generic.IReadOnlyDictionary shards, Elastic.Clients.Elasticsearch.Snapshot.ShardsStats shardsStats, Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats stats) + { + Shards = shards; + ShardsStats = shardsStats; + Stats = stats; + } +#if NET7_0_OR_GREATER + public SnapshotIndexStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotIndexStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotIndexStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStats ShardsStats { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotInfo.g.cs index 0d1f801f65a..f9d744ae28b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotInfo.g.cs @@ -17,59 +17,289 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropDuration = System.Text.Json.JsonEncodedText.Encode("duration"); + private static readonly System.Text.Json.JsonEncodedText PropDurationInMillis = System.Text.Json.JsonEncodedText.Encode("duration_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropEndTime = System.Text.Json.JsonEncodedText.Encode("end_time"); + private static readonly System.Text.Json.JsonEncodedText PropEndTimeInMillis = System.Text.Json.JsonEncodedText.Encode("end_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropFailures = System.Text.Json.JsonEncodedText.Encode("failures"); + private static readonly System.Text.Json.JsonEncodedText PropFeatureStates = System.Text.Json.JsonEncodedText.Encode("feature_states"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeGlobalState = System.Text.Json.JsonEncodedText.Encode("include_global_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndexDetails = System.Text.Json.JsonEncodedText.Encode("index_details"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropStartTime = System.Text.Json.JsonEncodedText.Encode("start_time"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionId = System.Text.Json.JsonEncodedText.Encode("version_id"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propDataStreams = default; + LocalJsonValue propDuration = default; + LocalJsonValue propDurationInMillis = default; + LocalJsonValue propEndTime = default; + LocalJsonValue propEndTimeInMillis = default; + LocalJsonValue?> propFailures = default; + LocalJsonValue?> propFeatureStates = default; + LocalJsonValue propIncludeGlobalState = default; + LocalJsonValue?> propIndexDetails = default; + LocalJsonValue?> propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propReason = default; + LocalJsonValue propRepository = default; + LocalJsonValue propShards = default; + LocalJsonValue propSnapshot = default; + LocalJsonValue propStartTime = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propState = default; + LocalJsonValue propUuid = default; + LocalJsonValue propVersion = default; + LocalJsonValue propVersionId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propDuration.TryReadProperty(ref reader, options, PropDuration, null)) + { + continue; + } + + if (propDurationInMillis.TryReadProperty(ref reader, options, PropDurationInMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propEndTime.TryReadProperty(ref reader, options, PropEndTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propEndTimeInMillis.TryReadProperty(ref reader, options, PropEndTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propFailures.TryReadProperty(ref reader, options, PropFailures, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propFeatureStates.TryReadProperty(ref reader, options, PropFeatureStates, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIncludeGlobalState.TryReadProperty(ref reader, options, PropIncludeGlobalState, null)) + { + continue; + } + + if (propIndexDetails.TryReadProperty(ref reader, options, PropIndexDetails, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (propStartTime.TryReadProperty(ref reader, options, PropStartTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (propVersionId.TryReadProperty(ref reader, options, PropVersionId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DataStreams = propDataStreams.Value, + Duration = propDuration.Value, + DurationInMillis = propDurationInMillis.Value, + EndTime = propEndTime.Value, + EndTimeInMillis = propEndTimeInMillis.Value, + Failures = propFailures.Value, + FeatureStates = propFeatureStates.Value, + IncludeGlobalState = propIncludeGlobalState.Value, + IndexDetails = propIndexDetails.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + Reason = propReason.Value, + Repository = propRepository.Value, + Shards = propShards.Value, + Snapshot = propSnapshot.Value, + StartTime = propStartTime.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + State = propState.Value, + Uuid = propUuid.Value, + Version = propVersion.Value, + VersionId = propVersionId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDuration, value.Duration, null, null); + writer.WriteProperty(options, PropDurationInMillis, value.DurationInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropEndTime, value.EndTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropEndTimeInMillis, value.EndTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropFailures, value.Failures, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropFeatureStates, value.FeatureStates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIncludeGlobalState, value.IncludeGlobalState, null, null); + writer.WriteProperty(options, PropIndexDetails, value.IndexDetails, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteProperty(options, PropStartTime, value.StartTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteProperty(options, PropVersionId, value.VersionId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotInfoConverter))] public sealed partial class SnapshotInfo { - [JsonInclude, JsonPropertyName("data_streams")] - public IReadOnlyCollection DataStreams { get; init; } - [JsonInclude, JsonPropertyName("duration")] - public Elastic.Clients.Elasticsearch.Duration? Duration { get; init; } - [JsonInclude, JsonPropertyName("duration_in_millis")] - public long? DurationInMillis { get; init; } - [JsonInclude, JsonPropertyName("end_time")] - public DateTimeOffset? EndTime { get; init; } - [JsonInclude, JsonPropertyName("end_time_in_millis")] - public long? EndTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("failures")] - public IReadOnlyCollection? Failures { get; init; } - [JsonInclude, JsonPropertyName("feature_states")] - public IReadOnlyCollection? FeatureStates { get; init; } - [JsonInclude, JsonPropertyName("include_global_state")] - public bool? IncludeGlobalState { get; init; } - [JsonInclude, JsonPropertyName("index_details")] - [ReadOnlyIndexNameDictionaryConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.IndexDetails))] - public IReadOnlyDictionary? IndexDetails { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection? Indices { get; init; } - [JsonInclude, JsonPropertyName("metadata")] - public IReadOnlyDictionary? Metadata { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } - [JsonInclude, JsonPropertyName("repository")] - public string? Repository { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public string Snapshot { get; init; } - [JsonInclude, JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long? StartTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string? State { get; init; } - [JsonInclude, JsonPropertyName("uuid")] - public string Uuid { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } - [JsonInclude, JsonPropertyName("version_id")] - public long? VersionId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotInfo(System.Collections.Generic.IReadOnlyCollection dataStreams, string snapshot, string uuid) + { + DataStreams = dataStreams; + Snapshot = snapshot; + Uuid = uuid; + } +#if NET7_0_OR_GREATER + public SnapshotInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection DataStreams { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Duration { get; set; } + public System.TimeSpan? DurationInMillis { get; set; } + public System.DateTimeOffset? EndTime { get; set; } + public System.DateTimeOffset? EndTimeInMillis { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Failures { get; set; } + public System.Collections.Generic.IReadOnlyCollection? FeatureStates { get; set; } + public bool? IncludeGlobalState { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? IndexDetails { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Indices { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Metadata { get; set; } + public string? Reason { get; set; } + public string? Repository { get; set; } + public Elastic.Clients.Elasticsearch.ShardStatistics? Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Snapshot { get; set; } + public System.DateTimeOffset? StartTime { get; set; } + public System.DateTimeOffset? StartTimeInMillis { get; set; } + public string? State { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uuid { get; set; } + public string? Version { get; set; } + public long? VersionId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotNodeInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotNodeInfo.g.cs index 5f9098ecda0..df2ec293084 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotNodeInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotNodeInfo.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotNodeInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propName = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Name = propName.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotNodeInfoConverter))] public sealed partial class SnapshotNodeInfo { - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotNodeInfo(string id, string name) + { + Id = id; + Name = name; + } +#if NET7_0_OR_GREATER + public SnapshotNodeInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotNodeInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotNodeInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotResponseItem.g.cs index 6dfadcde582..0a9bf8bcd5a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotResponseItem.g.cs @@ -17,22 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotResponseItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropError = System.Text.Json.JsonEncodedText.Encode("error"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshots = System.Text.Json.JsonEncodedText.Encode("snapshots"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotResponseItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propError = default; + LocalJsonValue propRepository = default; + LocalJsonValue?> propSnapshots = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propSnapshots.TryReadProperty(ref reader, options, PropSnapshots, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotResponseItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Error = propError.Value, + Repository = propRepository.Value, + Snapshots = propSnapshots.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotResponseItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropSnapshots, value.Snapshots, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotResponseItemConverter))] public sealed partial class SnapshotResponseItem { - [JsonInclude, JsonPropertyName("error")] - public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; init; } - [JsonInclude, JsonPropertyName("repository")] - public string Repository { get; init; } - [JsonInclude, JsonPropertyName("snapshots")] - public IReadOnlyCollection? Snapshots { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotResponseItem(string repository) + { + Repository = repository; + } +#if NET7_0_OR_GREATER + public SnapshotResponseItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotResponseItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotResponseItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ErrorCause? Error { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Repository { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Snapshots { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotRestore.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotRestore.g.cs index 7b79e00fc45..364546172bd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotRestore.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotRestore.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotRestoreConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropShards = System.Text.Json.JsonEncodedText.Encode("shards"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestore Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propIndices = default; + LocalJsonValue propShards = default; + LocalJsonValue propSnapshot = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Shards = propShards.Value, + Snapshot = propSnapshot.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestore value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotRestoreConverter))] public sealed partial class SnapshotRestore { - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - [JsonInclude, JsonPropertyName("shards")] - public Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public string Snapshot { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotRestore(System.Collections.Generic.IReadOnlyCollection indices, Elastic.Clients.Elasticsearch.ShardStatistics shards, string snapshot) + { + Indices = indices; + Shards = shards; + Snapshot = snapshot; + } +#if NET7_0_OR_GREATER + public SnapshotRestore() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotRestore() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotRestore(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ShardStatistics Shards { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Snapshot { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardFailure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardFailure.g.cs index 06ff9ad73cc..5fb771dfb04 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardFailure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardFailure.g.cs @@ -17,28 +17,149 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotShardFailureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropIndexUuid = System.Text.Json.JsonEncodedText.Encode("index_uuid"); + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropShardId = System.Text.Json.JsonEncodedText.Encode("shard_id"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardFailure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propIndexUuid = default; + LocalJsonValue propNodeId = default; + LocalJsonValue propReason = default; + LocalJsonValue propShardId = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propIndexUuid.TryReadProperty(ref reader, options, PropIndexUuid, null)) + { + continue; + } + + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propShardId.TryReadProperty(ref reader, options, PropShardId, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + IndexUuid = propIndexUuid.Value, + NodeId = propNodeId.Value, + Reason = propReason.Value, + ShardId = propShardId.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardFailure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropIndexUuid, value.IndexUuid, null, null); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropShardId, value.ShardId, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardFailureConverter))] public sealed partial class SnapshotShardFailure { - [JsonInclude, JsonPropertyName("index")] - public string Index { get; init; } - [JsonInclude, JsonPropertyName("index_uuid")] - public string IndexUuid { get; init; } - [JsonInclude, JsonPropertyName("node_id")] - public string? NodeId { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string Reason { get; init; } - [JsonInclude, JsonPropertyName("shard_id")] - public string ShardId { get; init; } - [JsonInclude, JsonPropertyName("status")] - public string Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotShardFailure(string index, string indexUuid, string reason, string shardId, string status) + { + Index = index; + IndexUuid = indexUuid; + Reason = reason; + ShardId = shardId; + Status = status; + } +#if NET7_0_OR_GREATER + public SnapshotShardFailure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotShardFailure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotShardFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Index { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string IndexUuid { get; set; } + public string? NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ShardId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardsStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardsStatus.g.cs index a28bd85020c..eb973b1a399 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardsStatus.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotShardsStatus.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotShardsStatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropStage = System.Text.Json.JsonEncodedText.Encode("stage"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardsStatus Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propStage = default; + LocalJsonValue propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propStage.TryReadProperty(ref reader, options, PropStage, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardsStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Stage = propStage.Value, + Stats = propStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardsStatus value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropStage, value.Stage, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotShardsStatusConverter))] public sealed partial class SnapshotShardsStatus { - [JsonInclude, JsonPropertyName("stage")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage Stage { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary Stats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotShardsStatus(Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage stage, Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary stats) + { + Stage = stage; + Stats = stats; + } +#if NET7_0_OR_GREATER + public SnapshotShardsStatus() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotShardsStatus() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotShardsStatus(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsStage Stage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStatsSummary Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotStats.g.cs index 4d458c7f528..38c2ea0e401 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SnapshotStats.g.cs @@ -17,26 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SnapshotStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIncremental = System.Text.Json.JsonEncodedText.Encode("incremental"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + private static readonly System.Text.Json.JsonEncodedText PropTimeInMillis = System.Text.Json.JsonEncodedText.Encode("time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIncremental = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propTime = default; + LocalJsonValue propTimeInMillis = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIncremental.TryReadProperty(ref reader, options, PropIncremental, null)) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, null)) + { + continue; + } + + if (propTimeInMillis.TryReadProperty(ref reader, options, PropTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Incremental = propIncremental.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + Time = propTime.Value, + TimeInMillis = propTimeInMillis.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIncremental, value.Incremental, null, null); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTime, value.Time, null, null); + writer.WriteProperty(options, PropTimeInMillis, value.TimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SnapshotStatsConverter))] public sealed partial class SnapshotStats { - [JsonInclude, JsonPropertyName("incremental")] - public Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats Incremental { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("time")] - public Elastic.Clients.Elasticsearch.Duration? Time { get; init; } - [JsonInclude, JsonPropertyName("time_in_millis")] - public long TimeInMillis { get; init; } - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotStats(Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats incremental, System.DateTimeOffset startTimeInMillis, System.TimeSpan timeInMillis, Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats total) + { + Incremental = incremental; + StartTimeInMillis = startTimeInMillis; + TimeInMillis = timeInMillis; + Total = total; + } +#if NET7_0_OR_GREATER + public SnapshotStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// The number and size of files that still need to be copied as part of the incremental snapshot. + /// For completed snapshots, this property indicates the number and size of files that were not already in the repository and were copied as part of the incremental snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats Incremental { get; set; } + + /// + /// + /// The time, in milliseconds, when the snapshot creation process started. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Time { get; set; } + + /// + /// + /// The total time, in milliseconds, that it took for the snapshot process to complete. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TimeInMillis { get; set; } + + /// + /// + /// The total number and size of files that are referenced by the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.FileCountSnapshotStats Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepository.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepository.g.cs index 74aff93a8a5..e658bdab278 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepository.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepository.g.cs @@ -17,128 +17,177 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -public sealed partial class SourceOnlyRepository : IRepository +internal sealed partial class SourceOnlyRepositoryConverter : System.Text.Json.Serialization.JsonConverter { - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings Settings { get; set; } + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); - [JsonInclude, JsonPropertyName("type")] - public string Type => "source"; + public override Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSettings = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } - [JsonInclude, JsonPropertyName("uuid")] - public string? Uuid { get; set; } -} + if (reader.ValueTextEquals(PropType)) + { + reader.Skip(); + continue; + } -public sealed partial class SourceOnlyRepositoryDescriptor : SerializableDescriptor, IBuildableDescriptor -{ - internal SourceOnlyRepositoryDescriptor(Action configure) => configure.Invoke(this); + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } - public SourceOnlyRepositoryDescriptor() : base() - { - } + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } - private Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings SettingsValue { get; set; } - private Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor SettingsDescriptor { get; set; } - private Action SettingsDescriptorAction { get; set; } - private string? UuidValue { get; set; } + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } - public SourceOnlyRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings settings) - { - SettingsDescriptor = null; - SettingsDescriptorAction = null; - SettingsValue = settings; - return Self; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Settings = propSettings.Value, + Uuid = propUuid.Value + }; } - public SourceOnlyRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor descriptor) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository value, System.Text.Json.JsonSerializerOptions options) { - SettingsValue = null; - SettingsDescriptorAction = null; - SettingsDescriptor = descriptor; - return Self; + writer.WriteStartObject(); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); } +} - public SourceOnlyRepositoryDescriptor Settings(Action configure) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryConverter))] +public sealed partial class SourceOnlyRepository : Elastic.Clients.Elasticsearch.Snapshot.IRepository +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceOnlyRepository(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings settings) + { + Settings = settings; + } +#if NET7_0_OR_GREATER + public SourceOnlyRepository() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SourceOnlyRepository() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SourceOnlyRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) { - SettingsValue = null; - SettingsDescriptor = null; - SettingsDescriptorAction = configure; - return Self; + _ = sentinel; } - public SourceOnlyRepositoryDescriptor Uuid(string? uuid) + /// + /// + /// The repository settings. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings Settings { get; set; } + + /// + /// + /// The source-only repository type. + /// + /// + public string Type => "source"; + + public string? Uuid { get; set; } +} + +public readonly partial struct SourceOnlyRepositoryDescriptor +{ + internal Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceOnlyRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository instance) { - UuidValue = uuid; - return Self; + Instance = instance; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceOnlyRepositoryDescriptor() { - writer.WriteStartObject(); - if (SettingsDescriptor is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsDescriptor, options); - } - else if (SettingsDescriptorAction is not null) - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor(SettingsDescriptorAction), options); - } - else - { - writer.WritePropertyName("settings"); - JsonSerializer.Serialize(writer, SettingsValue, options); - } + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - writer.WritePropertyName("type"); - writer.WriteStringValue("source"); - if (!string.IsNullOrEmpty(UuidValue)) - { - writer.WritePropertyName("uuid"); - writer.WriteStringValue(UuidValue); - } + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository instance) => new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor descriptor) => descriptor.Instance; - writer.WriteEndObject(); + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor Settings(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings value) + { + Instance.Settings = value; + return this; } - private Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings BuildSettings() + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor Settings() { - if (SettingsValue is not null) - { - return SettingsValue; - } - - if ((object)SettingsDescriptor is IBuildableDescriptor buildable) - { - return buildable.Build(); - } + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor.Build(null); + return this; + } - if (SettingsDescriptorAction is not null) - { - var descriptor = new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor(SettingsDescriptorAction); - if ((object)descriptor is IBuildableDescriptor buildableFromAction) - { - return buildableFromAction.Build(); - } - } + /// + /// + /// The repository settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor Settings(System.Action? action) + { + Instance.Settings = Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor.Build(action); + return this; + } - return null; + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor Uuid(string? value) + { + Instance.Uuid = value; + return this; } - SourceOnlyRepository IBuildableDescriptor.Build() => new() + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository Build(System.Action action) { - Settings = BuildSettings(), - Uuid = UuidValue - }; + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositoryDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepository(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepositorySettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepositorySettings.g.cs index 2645bb9292e..b53950ba72b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepositorySettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SourceOnlyRepositorySettings.g.cs @@ -17,239 +17,368 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; -internal sealed partial class SourceOnlyRepositorySettingsConverter : JsonConverter +internal sealed partial class SourceOnlyRepositorySettingsConverter : System.Text.Json.Serialization.JsonConverter { - public override SourceOnlyRepositorySettings Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropChunkSize = System.Text.Json.JsonEncodedText.Encode("chunk_size"); + private static readonly System.Text.Json.JsonEncodedText PropCompress = System.Text.Json.JsonEncodedText.Encode("compress"); + private static readonly System.Text.Json.JsonEncodedText PropDelegateType = System.Text.Json.JsonEncodedText.Encode("delegate_type"); + private static readonly System.Text.Json.JsonEncodedText PropMaxNumberOfSnapshots = System.Text.Json.JsonEncodedText.Encode("max_number_of_snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropMaxRestoreBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_restore_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropMaxSnapshotBytesPerSec = System.Text.Json.JsonEncodedText.Encode("max_snapshot_bytes_per_sec"); + private static readonly System.Text.Json.JsonEncodedText PropReadOnly = System.Text.Json.JsonEncodedText.Encode("read_only"); + private static readonly System.Text.Json.JsonEncodedText PropReadOnly1 = System.Text.Json.JsonEncodedText.Encode("readonly"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new SourceOnlyRepositorySettings(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChunkSize = default; + LocalJsonValue propCompress = default; + LocalJsonValue propDelegateType = default; + LocalJsonValue propMaxNumberOfSnapshots = default; + LocalJsonValue propMaxRestoreBytesPerSec = default; + LocalJsonValue propMaxSnapshotBytesPerSec = default; + LocalJsonValue propReadOnly = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propChunkSize.TryReadProperty(ref reader, options, PropChunkSize, null)) { - var property = reader.GetString(); - if (property == "chunk_size") - { - variant.ChunkSize = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "compress") - { - variant.Compress = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "delegate_type") - { - variant.DelegateType = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_number_of_snapshots") - { - variant.MaxNumberOfSnapshots = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_restore_bytes_per_sec") - { - variant.MaxRestoreBytesPerSec = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "max_snapshot_bytes_per_sec") - { - variant.MaxSnapshotBytesPerSec = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "read_only" || property == "readonly") - { - variant.ReadOnly = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propCompress.TryReadProperty(ref reader, options, PropCompress, null)) + { + continue; + } - public override void Write(Utf8JsonWriter writer, SourceOnlyRepositorySettings value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.ChunkSize is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, value.ChunkSize, options); - } + if (propDelegateType.TryReadProperty(ref reader, options, PropDelegateType, null)) + { + continue; + } - if (value.Compress.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(value.Compress.Value); - } + if (propMaxNumberOfSnapshots.TryReadProperty(ref reader, options, PropMaxNumberOfSnapshots, null)) + { + continue; + } - if (!string.IsNullOrEmpty(value.DelegateType)) - { - writer.WritePropertyName("delegate_type"); - writer.WriteStringValue(value.DelegateType); - } + if (propMaxRestoreBytesPerSec.TryReadProperty(ref reader, options, PropMaxRestoreBytesPerSec, null)) + { + continue; + } - if (value.MaxNumberOfSnapshots.HasValue) - { - writer.WritePropertyName("max_number_of_snapshots"); - writer.WriteNumberValue(value.MaxNumberOfSnapshots.Value); - } + if (propMaxSnapshotBytesPerSec.TryReadProperty(ref reader, options, PropMaxSnapshotBytesPerSec, null)) + { + continue; + } - if (value.MaxRestoreBytesPerSec is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, value.MaxRestoreBytesPerSec, options); - } + if (propReadOnly.TryReadProperty(ref reader, options, PropReadOnly, null) || propReadOnly.TryReadProperty(ref reader, options, PropReadOnly1, null)) + { + continue; + } - if (value.MaxSnapshotBytesPerSec is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, value.MaxSnapshotBytesPerSec, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.ReadOnly.HasValue) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("read_only"); - writer.WriteBooleanValue(value.ReadOnly.Value); - } + ChunkSize = propChunkSize.Value, + Compress = propCompress.Value, + DelegateType = propDelegateType.Value, + MaxNumberOfSnapshots = propMaxNumberOfSnapshots.Value, + MaxRestoreBytesPerSec = propMaxRestoreBytesPerSec.Value, + MaxSnapshotBytesPerSec = propMaxSnapshotBytesPerSec.Value, + ReadOnly = propReadOnly.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChunkSize, value.ChunkSize, null, null); + writer.WriteProperty(options, PropCompress, value.Compress, null, null); + writer.WriteProperty(options, PropDelegateType, value.DelegateType, null, null); + writer.WriteProperty(options, PropMaxNumberOfSnapshots, value.MaxNumberOfSnapshots, null, null); + writer.WriteProperty(options, PropMaxRestoreBytesPerSec, value.MaxRestoreBytesPerSec, null, null); + writer.WriteProperty(options, PropMaxSnapshotBytesPerSec, value.MaxSnapshotBytesPerSec, null, null); + writer.WriteProperty(options, PropReadOnly, value.ReadOnly, null, null); writer.WriteEndObject(); } } -[JsonConverter(typeof(SourceOnlyRepositorySettingsConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsConverter))] public sealed partial class SourceOnlyRepositorySettings { +#if NET7_0_OR_GREATER + public SourceOnlyRepositorySettings() + { + } +#endif +#if !NET7_0_OR_GREATER + public SourceOnlyRepositorySettings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? ChunkSize { get; set; } + + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// public bool? Compress { get; set; } + + /// + /// + /// The delegated repository type. For valid values, refer to the type parameter. + /// Source repositories can use settings properties for its delegated repository type. + /// + /// public string? DelegateType { get; set; } + + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// public int? MaxNumberOfSnapshots { get; set; } + + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSec { get; set; } + + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// public Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSec { get; set; } + + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// public bool? ReadOnly { get; set; } } -public sealed partial class SourceOnlyRepositorySettingsDescriptor : SerializableDescriptor +public readonly partial struct SourceOnlyRepositorySettingsDescriptor { - internal SourceOnlyRepositorySettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings Instance { get; init; } - public SourceOnlyRepositorySettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceOnlyRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.ByteSize? ChunkSizeValue { get; set; } - private bool? CompressValue { get; set; } - private string? DelegateTypeValue { get; set; } - private int? MaxNumberOfSnapshotsValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxRestoreBytesPerSecValue { get; set; } - private Elastic.Clients.Elasticsearch.ByteSize? MaxSnapshotBytesPerSecValue { get; set; } - private bool? ReadOnlyValue { get; set; } - - public SourceOnlyRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? chunkSize) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceOnlyRepositorySettingsDescriptor() { - ChunkSizeValue = chunkSize; - return Self; + Instance = new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SourceOnlyRepositorySettingsDescriptor Compress(bool? compress = true) + public static explicit operator Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings instance) => new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor ChunkSize(Elastic.Clients.Elasticsearch.ByteSize? value) { - CompressValue = compress; - return Self; + Instance.ChunkSize = value; + return this; } - public SourceOnlyRepositorySettingsDescriptor DelegateType(string? delegateType) + /// + /// + /// Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. + /// It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. + /// Setting a value lower than the default can result in an increased number of API calls to the blob store during snapshot create and restore operations compared to using the default value and thus make both operations slower and more costly. + /// Specify the chunk size as a byte unit, for example: 10MB, 5KB, 500B. + /// The default varies by repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor ChunkSize(System.Func action) { - DelegateTypeValue = delegateType; - return Self; + Instance.ChunkSize = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; } - public SourceOnlyRepositorySettingsDescriptor MaxNumberOfSnapshots(int? maxNumberOfSnapshots) + /// + /// + /// When set to true, metadata files are stored in compressed format. + /// This setting doesn't affect index files that are already compressed by default. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor Compress(bool? value = true) { - MaxNumberOfSnapshotsValue = maxNumberOfSnapshots; - return Self; + Instance.Compress = value; + return this; } - public SourceOnlyRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxRestoreBytesPerSec) + /// + /// + /// The delegated repository type. For valid values, refer to the type parameter. + /// Source repositories can use settings properties for its delegated repository type. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor DelegateType(string? value) { - MaxRestoreBytesPerSecValue = maxRestoreBytesPerSec; - return Self; + Instance.DelegateType = value; + return this; } - public SourceOnlyRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? maxSnapshotBytesPerSec) + /// + /// + /// The maximum number of snapshots the repository can contain. + /// The default is Integer.MAX_VALUE, which is 2^31-1 or 2147483647. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor MaxNumberOfSnapshots(int? value) { - MaxSnapshotBytesPerSecValue = maxSnapshotBytesPerSec; - return Self; + Instance.MaxNumberOfSnapshots = value; + return this; } - public SourceOnlyRepositorySettingsDescriptor ReadOnly(bool? readOnly = true) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor MaxRestoreBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) { - ReadOnlyValue = readOnly; - return Self; + Instance.MaxRestoreBytesPerSec = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// The maximum snapshot restore rate per node. + /// It defaults to unlimited. + /// Note that restores are also throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor MaxRestoreBytesPerSec(System.Func action) { - writer.WriteStartObject(); - if (ChunkSizeValue is not null) - { - writer.WritePropertyName("chunk_size"); - JsonSerializer.Serialize(writer, ChunkSizeValue, options); - } - - if (CompressValue.HasValue) - { - writer.WritePropertyName("compress"); - writer.WriteBooleanValue(CompressValue.Value); - } - - if (!string.IsNullOrEmpty(DelegateTypeValue)) - { - writer.WritePropertyName("delegate_type"); - writer.WriteStringValue(DelegateTypeValue); - } + Instance.MaxRestoreBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxNumberOfSnapshotsValue.HasValue) - { - writer.WritePropertyName("max_number_of_snapshots"); - writer.WriteNumberValue(MaxNumberOfSnapshotsValue.Value); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor MaxSnapshotBytesPerSec(Elastic.Clients.Elasticsearch.ByteSize? value) + { + Instance.MaxSnapshotBytesPerSec = value; + return this; + } - if (MaxRestoreBytesPerSecValue is not null) - { - writer.WritePropertyName("max_restore_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxRestoreBytesPerSecValue, options); - } + /// + /// + /// The maximum snapshot creation rate per node. + /// It defaults to 40mb per second. + /// Note that if the recovery settings for managed services are set, then it defaults to unlimited, and the rate is additionally throttled through recovery settings. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor MaxSnapshotBytesPerSec(System.Func action) + { + Instance.MaxSnapshotBytesPerSec = Elastic.Clients.Elasticsearch.ByteSizeFactory.Build(action); + return this; + } - if (MaxSnapshotBytesPerSecValue is not null) - { - writer.WritePropertyName("max_snapshot_bytes_per_sec"); - JsonSerializer.Serialize(writer, MaxSnapshotBytesPerSecValue, options); - } + /// + /// + /// If true, the repository is read-only. + /// The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it. + /// + /// + /// Only a cluster with write access can create snapshots in the repository. + /// All other clusters connected to the repository should have the readonly parameter set to true. + /// + /// + /// If false, the cluster can write to the repository and create snapshots in it. + /// + /// + /// IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. + /// Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository. + /// + /// + public Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor ReadOnly(bool? value = true) + { + Instance.ReadOnly = value; + return this; + } - if (ReadOnlyValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("read_only"); - writer.WriteBooleanValue(ReadOnlyValue.Value); + return new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettingsDescriptor(new Elastic.Clients.Elasticsearch.Snapshot.SourceOnlyRepositorySettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Status.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Status.g.cs index cbd65a9c293..8ab6ad5b3ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Status.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/Status.g.cs @@ -17,32 +17,242 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class StatusConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIncludeGlobalState = System.Text.Json.JsonEncodedText.Encode("include_global_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropShardsStats = System.Text.Json.JsonEncodedText.Encode("shards_stats"); + private static readonly System.Text.Json.JsonEncodedText PropSnapshot = System.Text.Json.JsonEncodedText.Encode("snapshot"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + + public override Elastic.Clients.Elasticsearch.Snapshot.Status Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIncludeGlobalState = default; + LocalJsonValue> propIndices = default; + LocalJsonValue propRepository = default; + LocalJsonValue propShardsStats = default; + LocalJsonValue propSnapshot = default; + LocalJsonValue propState = default; + LocalJsonValue propStats = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIncludeGlobalState.TryReadProperty(ref reader, options, PropIncludeGlobalState, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propShardsStats.TryReadProperty(ref reader, options, PropShardsStats, null)) + { + continue; + } + + if (propSnapshot.TryReadProperty(ref reader, options, PropSnapshot, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.Status(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IncludeGlobalState = propIncludeGlobalState.Value, + Indices = propIndices.Value, + Repository = propRepository.Value, + ShardsStats = propShardsStats.Value, + Snapshot = propSnapshot.Value, + State = propState.Value, + Stats = propStats.Value, + Uuid = propUuid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.Status value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIncludeGlobalState, value.IncludeGlobalState, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropShardsStats, value.ShardsStats, null, null); + writer.WriteProperty(options, PropSnapshot, value.Snapshot, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.StatusConverter))] public sealed partial class Status { - [JsonInclude, JsonPropertyName("include_global_state")] - public bool IncludeGlobalState { get; init; } - [JsonInclude, JsonPropertyName("indices")] - public IReadOnlyDictionary Indices { get; init; } - [JsonInclude, JsonPropertyName("repository")] - public string Repository { get; init; } - [JsonInclude, JsonPropertyName("shards_stats")] - public Elastic.Clients.Elasticsearch.Snapshot.ShardsStats ShardsStats { get; init; } - [JsonInclude, JsonPropertyName("snapshot")] - public string Snapshot { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string State { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats Stats { get; init; } - [JsonInclude, JsonPropertyName("uuid")] - public string Uuid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Status(bool includeGlobalState, System.Collections.Generic.IReadOnlyDictionary indices, string repository, Elastic.Clients.Elasticsearch.Snapshot.ShardsStats shardsStats, string snapshot, string state, Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats stats, string uuid) + { + IncludeGlobalState = includeGlobalState; + Indices = indices; + Repository = repository; + ShardsStats = shardsStats; + Snapshot = snapshot; + State = state; + Stats = stats; + Uuid = uuid; + } +#if NET7_0_OR_GREATER + public Status() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Status() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Status(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Indicates whether the current cluster state is included in the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + bool IncludeGlobalState { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Indices { get; set; } + + /// + /// + /// The name of the repository that includes the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Repository { get; set; } + + /// + /// + /// Statistics for the shards in the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ShardsStats ShardsStats { get; set; } + + /// + /// + /// The name of the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Snapshot { get; set; } + + /// + /// + /// The current snapshot state: + /// + /// + /// + /// + /// FAILED: The snapshot finished with an error and failed to store any data. + /// + /// + /// + /// + /// STARTED: The snapshot is currently running. + /// + /// + /// + /// + /// SUCCESS: The snapshot completed. + /// + /// + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } + + /// + /// + /// Details about the number (file_count) and size (size_in_bytes) of files included in the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.SnapshotStats Stats { get; set; } + + /// + /// + /// The universally unique identifier (UUID) for the snapshot. + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Uuid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SummaryInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SummaryInfo.g.cs index ae1877ae6f4..92f1c112266 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SummaryInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/SummaryInfo.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class SummaryInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropRead = System.Text.Json.JsonEncodedText.Encode("read"); + private static readonly System.Text.Json.JsonEncodedText PropWrite = System.Text.Json.JsonEncodedText.Encode("write"); + + public override Elastic.Clients.Elasticsearch.Snapshot.SummaryInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propRead = default; + LocalJsonValue propWrite = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propRead.TryReadProperty(ref reader, options, PropRead, null)) + { + continue; + } + + if (propWrite.TryReadProperty(ref reader, options, PropWrite, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.SummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Read = propRead.Value, + Write = propWrite.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.SummaryInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropRead, value.Read, null, null); + writer.WriteProperty(options, PropWrite, value.Write, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.SummaryInfoConverter))] public sealed partial class SummaryInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SummaryInfo(Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo read, Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo write) + { + Read = read; + Write = write; + } +#if NET7_0_OR_GREATER + public SummaryInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SummaryInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A collection of statistics that summarise the results of the read operations in the test. /// /// - [JsonInclude, JsonPropertyName("read")] - public Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo Read { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.ReadSummaryInfo Read { get; set; } /// /// /// A collection of statistics that summarise the results of the write operations in the test. /// /// - [JsonInclude, JsonPropertyName("write")] - public Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo Write { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo Write { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/WriteSummaryInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/WriteSummaryInfo.g.cs index 0af04ba64da..d55f114338c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/WriteSummaryInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Snapshot/WriteSummaryInfo.g.cs @@ -17,71 +17,210 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Snapshot; +internal sealed partial class WriteSummaryInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalElapsed = System.Text.Json.JsonEncodedText.Encode("total_elapsed"); + private static readonly System.Text.Json.JsonEncodedText PropTotalElapsedNanos = System.Text.Json.JsonEncodedText.Encode("total_elapsed_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSize = System.Text.Json.JsonEncodedText.Encode("total_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeBytes = System.Text.Json.JsonEncodedText.Encode("total_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottled = System.Text.Json.JsonEncodedText.Encode("total_throttled"); + private static readonly System.Text.Json.JsonEncodedText PropTotalThrottledNanos = System.Text.Json.JsonEncodedText.Encode("total_throttled_nanos"); + + public override Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propTotalElapsed = default; + LocalJsonValue propTotalElapsedNanos = default; + LocalJsonValue propTotalSize = default; + LocalJsonValue propTotalSizeBytes = default; + LocalJsonValue propTotalThrottled = default; + LocalJsonValue propTotalThrottledNanos = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propTotalElapsed.TryReadProperty(ref reader, options, PropTotalElapsed, null)) + { + continue; + } + + if (propTotalElapsedNanos.TryReadProperty(ref reader, options, PropTotalElapsedNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propTotalSize.TryReadProperty(ref reader, options, PropTotalSize, null)) + { + continue; + } + + if (propTotalSizeBytes.TryReadProperty(ref reader, options, PropTotalSizeBytes, null)) + { + continue; + } + + if (propTotalThrottled.TryReadProperty(ref reader, options, PropTotalThrottled, null)) + { + continue; + } + + if (propTotalThrottledNanos.TryReadProperty(ref reader, options, PropTotalThrottledNanos, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + TotalElapsed = propTotalElapsed.Value, + TotalElapsedNanos = propTotalElapsedNanos.Value, + TotalSize = propTotalSize.Value, + TotalSizeBytes = propTotalSizeBytes.Value, + TotalThrottled = propTotalThrottled.Value, + TotalThrottledNanos = propTotalThrottledNanos.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropTotalElapsed, value.TotalElapsed, null, null); + writer.WriteProperty(options, PropTotalElapsedNanos, value.TotalElapsedNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropTotalSize, value.TotalSize, null, null); + writer.WriteProperty(options, PropTotalSizeBytes, value.TotalSizeBytes, null, null); + writer.WriteProperty(options, PropTotalThrottled, value.TotalThrottled, null, null); + writer.WriteProperty(options, PropTotalThrottledNanos, value.TotalThrottledNanos, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Snapshot.WriteSummaryInfoConverter))] public sealed partial class WriteSummaryInfo { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WriteSummaryInfo(int count, Elastic.Clients.Elasticsearch.Duration totalElapsed, System.TimeSpan totalElapsedNanos, Elastic.Clients.Elasticsearch.ByteSize totalSize, long totalSizeBytes, Elastic.Clients.Elasticsearch.Duration totalThrottled, long totalThrottledNanos) + { + Count = count; + TotalElapsed = totalElapsed; + TotalElapsedNanos = totalElapsedNanos; + TotalSize = totalSize; + TotalSizeBytes = totalSizeBytes; + TotalThrottled = totalThrottled; + TotalThrottledNanos = totalThrottledNanos; + } +#if NET7_0_OR_GREATER + public WriteSummaryInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WriteSummaryInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WriteSummaryInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The number of write operations performed in the test. /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// The total elapsed time spent on writing blobs in the test. /// /// - [JsonInclude, JsonPropertyName("total_elapsed")] - public Elastic.Clients.Elasticsearch.Duration TotalElapsed { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration TotalElapsed { get; set; } /// /// /// The total elapsed time spent on writing blobs in the test, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("total_elapsed_nanos")] - public long TotalElapsedNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalElapsedNanos { get; set; } /// /// /// The total size of all the blobs written in the test. /// /// - [JsonInclude, JsonPropertyName("total_size")] - public Elastic.Clients.Elasticsearch.ByteSize TotalSize { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ByteSize TotalSize { get; set; } /// /// /// The total size of all the blobs written in the test, in bytes. /// /// - [JsonInclude, JsonPropertyName("total_size_bytes")] - public long TotalSizeBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeBytes { get; set; } /// /// /// The total time spent waiting due to the max_snapshot_bytes_per_sec throttle. /// /// - [JsonInclude, JsonPropertyName("total_throttled")] - public Elastic.Clients.Elasticsearch.Duration TotalThrottled { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration TotalThrottled { get; set; } /// /// /// The total time spent waiting due to the max_snapshot_bytes_per_sec throttle, in nanoseconds. /// /// - [JsonInclude, JsonPropertyName("total_throttled_nanos")] - public long TotalThrottledNanos { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalThrottledNanos { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/InProgress.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/InProgress.g.cs index 54c1a3ce72b..d5b2141ac96 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/InProgress.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/InProgress.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class InProgressConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeMillis = System.Text.Json.JsonEncodedText.Encode("start_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropUuid = System.Text.Json.JsonEncodedText.Encode("uuid"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgress Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propStartTimeMillis = default; + LocalJsonValue propState = default; + LocalJsonValue propUuid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propStartTimeMillis.TryReadProperty(ref reader, options, PropStartTimeMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propUuid.TryReadProperty(ref reader, options, PropUuid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + StartTimeMillis = propStartTimeMillis.Value, + State = propState.Value, + Uuid = propUuid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgress value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropStartTimeMillis, value.StartTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropUuid, value.Uuid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgressConverter))] public sealed partial class InProgress { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("start_time_millis")] - public long StartTimeMillis { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string State { get; init; } - [JsonInclude, JsonPropertyName("uuid")] - public string Uuid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InProgress(string name, System.DateTimeOffset startTimeMillis, string state, string uuid) + { + Name = name; + StartTimeMillis = startTimeMillis; + State = state; + Uuid = uuid; + } +#if NET7_0_OR_GREATER + public InProgress() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public InProgress() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal InProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uuid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Invocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Invocation.g.cs index 81733de41ff..82c98e90fc6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Invocation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Invocation.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class InvocationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSnapshotName = System.Text.Json.JsonEncodedText.Encode("snapshot_name"); + private static readonly System.Text.Json.JsonEncodedText PropTime = System.Text.Json.JsonEncodedText.Encode("time"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSnapshotName = default; + LocalJsonValue propTime = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSnapshotName.TryReadProperty(ref reader, options, PropSnapshotName, null)) + { + continue; + } + + if (propTime.TryReadProperty(ref reader, options, PropTime, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SnapshotName = propSnapshotName.Value, + Time = propTime.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSnapshotName, value.SnapshotName, null, null); + writer.WriteProperty(options, PropTime, value.Time, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InvocationConverter))] public sealed partial class Invocation { - [JsonInclude, JsonPropertyName("snapshot_name")] - public string SnapshotName { get; init; } - [JsonInclude, JsonPropertyName("time")] - public DateTimeOffset Time { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Invocation(string snapshotName, System.DateTimeOffset time) + { + SnapshotName = snapshotName; + Time = time; + } +#if NET7_0_OR_GREATER + public Invocation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Invocation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Invocation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string SnapshotName { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Time { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Retention.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Retention.g.cs index 5fd8b5dceba..7cde765e56c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Retention.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Retention.g.cs @@ -17,64 +17,158 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class RetentionConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpireAfter = System.Text.Json.JsonEncodedText.Encode("expire_after"); + private static readonly System.Text.Json.JsonEncodedText PropMaxCount = System.Text.Json.JsonEncodedText.Encode("max_count"); + private static readonly System.Text.Json.JsonEncodedText PropMinCount = System.Text.Json.JsonEncodedText.Encode("min_count"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpireAfter = default; + LocalJsonValue propMaxCount = default; + LocalJsonValue propMinCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpireAfter.TryReadProperty(ref reader, options, PropExpireAfter, null)) + { + continue; + } + + if (propMaxCount.TryReadProperty(ref reader, options, PropMaxCount, null)) + { + continue; + } + + if (propMinCount.TryReadProperty(ref reader, options, PropMinCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpireAfter = propExpireAfter.Value, + MaxCount = propMaxCount.Value, + MinCount = propMinCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpireAfter, value.ExpireAfter, null, null); + writer.WriteProperty(options, PropMaxCount, value.MaxCount, null, null); + writer.WriteProperty(options, PropMinCount, value.MinCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionConverter))] public sealed partial class Retention { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Retention(Elastic.Clients.Elasticsearch.Duration expireAfter, int maxCount, int minCount) + { + ExpireAfter = expireAfter; + MaxCount = maxCount; + MinCount = minCount; + } +#if NET7_0_OR_GREATER + public Retention() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Retention() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Retention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Time period after which a snapshot is considered expired and eligible for deletion. SLM deletes expired snapshots based on the slm.retention_schedule. /// /// - [JsonInclude, JsonPropertyName("expire_after")] - public Elastic.Clients.Elasticsearch.Duration ExpireAfter { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration ExpireAfter { get; set; } /// /// /// Maximum number of snapshots to retain, even if the snapshots have not yet expired. If the number of snapshots in the repository exceeds this limit, the policy retains the most recent snapshots and deletes older snapshots. /// /// - [JsonInclude, JsonPropertyName("max_count")] - public int MaxCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MaxCount { get; set; } /// /// /// Minimum number of snapshots to retain, even if the snapshots have expired. /// /// - [JsonInclude, JsonPropertyName("min_count")] - public int MinCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int MinCount { get; set; } } -public sealed partial class RetentionDescriptor : SerializableDescriptor +public readonly partial struct RetentionDescriptor { - internal RetentionDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention instance) + { + Instance = instance; + } - public RetentionDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Duration ExpireAfterValue { get; set; } - private int MaxCountValue { get; set; } - private int MinCountValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor descriptor) => descriptor.Instance; /// /// /// Time period after which a snapshot is considered expired and eligible for deletion. SLM deletes expired snapshots based on the slm.retention_schedule. /// /// - public RetentionDescriptor ExpireAfter(Elastic.Clients.Elasticsearch.Duration expireAfter) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor ExpireAfter(Elastic.Clients.Elasticsearch.Duration value) { - ExpireAfterValue = expireAfter; - return Self; + Instance.ExpireAfter = value; + return this; } /// @@ -82,10 +176,10 @@ public RetentionDescriptor ExpireAfter(Elastic.Clients.Elasticsearch.Duration ex /// Maximum number of snapshots to retain, even if the snapshots have not yet expired. If the number of snapshots in the repository exceeds this limit, the policy retains the most recent snapshots and deletes older snapshots. /// /// - public RetentionDescriptor MaxCount(int maxCount) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor MaxCount(int value) { - MaxCountValue = maxCount; - return Self; + Instance.MaxCount = value; + return this; } /// @@ -93,21 +187,17 @@ public RetentionDescriptor MaxCount(int maxCount) /// Minimum number of snapshots to retain, even if the snapshots have expired. /// /// - public RetentionDescriptor MinCount(int minCount) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor MinCount(int value) { - MinCountValue = minCount; - return Self; + Instance.MinCount = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("expire_after"); - JsonSerializer.Serialize(writer, ExpireAfterValue, options); - writer.WritePropertyName("max_count"); - writer.WriteNumberValue(MaxCountValue); - writer.WritePropertyName("min_count"); - writer.WriteNumberValue(MinCountValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.RetentionDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmConfiguration.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmConfiguration.g.cs index 9d69d1752a0..8a058289062 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmConfiguration.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmConfiguration.g.cs @@ -17,33 +17,128 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class SlmConfigurationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFeatureStates = System.Text.Json.JsonEncodedText.Encode("feature_states"); + private static readonly System.Text.Json.JsonEncodedText PropIgnoreUnavailable = System.Text.Json.JsonEncodedText.Encode("ignore_unavailable"); + private static readonly System.Text.Json.JsonEncodedText PropIncludeGlobalState = System.Text.Json.JsonEncodedText.Encode("include_global_state"); + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("indices"); + private static readonly System.Text.Json.JsonEncodedText PropMetadata = System.Text.Json.JsonEncodedText.Encode("metadata"); + private static readonly System.Text.Json.JsonEncodedText PropPartial = System.Text.Json.JsonEncodedText.Encode("partial"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propFeatureStates = default; + LocalJsonValue propIgnoreUnavailable = default; + LocalJsonValue propIncludeGlobalState = default; + LocalJsonValue propIndices = default; + LocalJsonValue?> propMetadata = default; + LocalJsonValue propPartial = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFeatureStates.TryReadProperty(ref reader, options, PropFeatureStates, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIgnoreUnavailable.TryReadProperty(ref reader, options, PropIgnoreUnavailable, null)) + { + continue; + } + + if (propIncludeGlobalState.TryReadProperty(ref reader, options, PropIncludeGlobalState, null)) + { + continue; + } + + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propMetadata.TryReadProperty(ref reader, options, PropMetadata, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPartial.TryReadProperty(ref reader, options, PropPartial, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + FeatureStates = propFeatureStates.Value, + IgnoreUnavailable = propIgnoreUnavailable.Value, + IncludeGlobalState = propIncludeGlobalState.Value, + Indices = propIndices.Value, + Metadata = propMetadata.Value, + Partial = propPartial.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFeatureStates, value.FeatureStates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIgnoreUnavailable, value.IgnoreUnavailable, null, null); + writer.WriteProperty(options, PropIncludeGlobalState, value.IncludeGlobalState, null, null); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropMetadata, value.Metadata, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPartial, value.Partial, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationConverter))] public sealed partial class SlmConfiguration { +#if NET7_0_OR_GREATER + public SlmConfiguration() + { + } +#endif +#if !NET7_0_OR_GREATER + public SlmConfiguration() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlmConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A list of feature states to be included in this snapshot. A list of features available for inclusion in the snapshot and their descriptions be can be retrieved using the get features API. /// Each feature state includes one or more system indices containing data necessary for the function of that feature. Providing an empty array will include no feature states in the snapshot, regardless of the value of include_global_state. By default, all available feature states will be included in the snapshot if include_global_state is true, or no feature states if include_global_state is false. /// /// - [JsonInclude, JsonPropertyName("feature_states")] - public ICollection? FeatureStates { get; set; } + public System.Collections.Generic.ICollection? FeatureStates { get; set; } /// /// /// If false, the snapshot fails if any data stream or index in indices is missing or closed. If true, the snapshot ignores missing or closed data streams and indices. /// /// - [JsonInclude, JsonPropertyName("ignore_unavailable")] public bool? IgnoreUnavailable { get; set; } /// @@ -51,7 +146,6 @@ public sealed partial class SlmConfiguration /// If true, the current global state is included in the snapshot. /// /// - [JsonInclude, JsonPropertyName("include_global_state")] public bool? IncludeGlobalState { get; set; } /// @@ -60,7 +154,6 @@ public sealed partial class SlmConfiguration /// By default, a snapshot includes all data streams and indices in the cluster. If this argument is provided, the snapshot only includes the specified data streams and clusters. /// /// - [JsonInclude, JsonPropertyName("indices")] public Elastic.Clients.Elasticsearch.Indices? Indices { get; set; } /// @@ -68,32 +161,34 @@ public sealed partial class SlmConfiguration /// Attaches arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. Metadata must be less than 1024 bytes. /// /// - [JsonInclude, JsonPropertyName("metadata")] - public IDictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } /// /// /// If false, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. /// /// - [JsonInclude, JsonPropertyName("partial")] public bool? Partial { get; set; } } -public sealed partial class SlmConfigurationDescriptor : SerializableDescriptor +public readonly partial struct SlmConfigurationDescriptor { - internal SlmConfigurationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmConfigurationDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration instance) + { + Instance = instance; + } - public SlmConfigurationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmConfigurationDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private ICollection? FeatureStatesValue { get; set; } - private bool? IgnoreUnavailableValue { get; set; } - private bool? IncludeGlobalStateValue { get; set; } - private Elastic.Clients.Elasticsearch.Indices? IndicesValue { get; set; } - private IDictionary? MetadataValue { get; set; } - private bool? PartialValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration instance) => new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor descriptor) => descriptor.Instance; /// /// @@ -101,10 +196,22 @@ public SlmConfigurationDescriptor() : base() /// Each feature state includes one or more system indices containing data necessary for the function of that feature. Providing an empty array will include no feature states in the snapshot, regardless of the value of include_global_state. By default, all available feature states will be included in the snapshot if include_global_state is true, or no feature states if include_global_state is false. /// /// - public SlmConfigurationDescriptor FeatureStates(ICollection? featureStates) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor FeatureStates(System.Collections.Generic.ICollection? value) { - FeatureStatesValue = featureStates; - return Self; + Instance.FeatureStates = value; + return this; + } + + /// + /// + /// A list of feature states to be included in this snapshot. A list of features available for inclusion in the snapshot and their descriptions be can be retrieved using the get features API. + /// Each feature state includes one or more system indices containing data necessary for the function of that feature. Providing an empty array will include no feature states in the snapshot, regardless of the value of include_global_state. By default, all available feature states will be included in the snapshot if include_global_state is true, or no feature states if include_global_state is false. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor FeatureStates(params string[] values) + { + Instance.FeatureStates = [.. values]; + return this; } /// @@ -112,10 +219,10 @@ public SlmConfigurationDescriptor FeatureStates(ICollection? featureStat /// If false, the snapshot fails if any data stream or index in indices is missing or closed. If true, the snapshot ignores missing or closed data streams and indices. /// /// - public SlmConfigurationDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor IgnoreUnavailable(bool? value = true) { - IgnoreUnavailableValue = ignoreUnavailable; - return Self; + Instance.IgnoreUnavailable = value; + return this; } /// @@ -123,10 +230,10 @@ public SlmConfigurationDescriptor IgnoreUnavailable(bool? ignoreUnavailable = tr /// If true, the current global state is included in the snapshot. /// /// - public SlmConfigurationDescriptor IncludeGlobalState(bool? includeGlobalState = true) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor IncludeGlobalState(bool? value = true) { - IncludeGlobalStateValue = includeGlobalState; - return Self; + Instance.IncludeGlobalState = value; + return this; } /// @@ -135,10 +242,10 @@ public SlmConfigurationDescriptor IncludeGlobalState(bool? includeGlobalState = /// By default, a snapshot includes all data streams and indices in the cluster. If this argument is provided, the snapshot only includes the specified data streams and clusters. /// /// - public SlmConfigurationDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? indices) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -146,62 +253,62 @@ public SlmConfigurationDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? /// Attaches arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. Metadata must be less than 1024 bytes. /// /// - public SlmConfigurationDescriptor Metadata(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor Metadata(System.Collections.Generic.IDictionary? value) { - MetadataValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Metadata = value; + return this; } /// /// - /// If false, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. + /// Attaches arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. Metadata must be less than 1024 bytes. /// /// - public SlmConfigurationDescriptor Partial(bool? partial = true) + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor Metadata() { - PartialValue = partial; - return Self; + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Attaches arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. Metadata must be less than 1024 bytes. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor Metadata(System.Action? action) { - writer.WriteStartObject(); - if (FeatureStatesValue is not null) - { - writer.WritePropertyName("feature_states"); - JsonSerializer.Serialize(writer, FeatureStatesValue, options); - } - - if (IgnoreUnavailableValue.HasValue) - { - writer.WritePropertyName("ignore_unavailable"); - writer.WriteBooleanValue(IgnoreUnavailableValue.Value); - } - - if (IncludeGlobalStateValue.HasValue) - { - writer.WritePropertyName("include_global_state"); - writer.WriteBooleanValue(IncludeGlobalStateValue.Value); - } + Instance.Metadata = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } - if (IndicesValue is not null) - { - writer.WritePropertyName("indices"); - JsonSerializer.Serialize(writer, IndicesValue, options); - } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor AddMetadatum(string key, object value) + { + Instance.Metadata ??= new System.Collections.Generic.Dictionary(); + Instance.Metadata.Add(key, value); + return this; + } - if (MetadataValue is not null) - { - writer.WritePropertyName("metadata"); - JsonSerializer.Serialize(writer, MetadataValue, options); - } + /// + /// + /// If false, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available. + /// + /// + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor Partial(bool? value = true) + { + Instance.Partial = value; + return this; + } - if (PartialValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("partial"); - writer.WriteBooleanValue(PartialValue.Value); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfigurationDescriptor(new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmPolicy.g.cs index 4a8d4f7b298..bb43d0962c7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SlmPolicy.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class SlmPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropConfig = System.Text.Json.JsonEncodedText.Encode("config"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRepository = System.Text.Json.JsonEncodedText.Encode("repository"); + private static readonly System.Text.Json.JsonEncodedText PropRetention = System.Text.Json.JsonEncodedText.Encode("retention"); + private static readonly System.Text.Json.JsonEncodedText PropSchedule = System.Text.Json.JsonEncodedText.Encode("schedule"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propConfig = default; + LocalJsonValue propName = default; + LocalJsonValue propRepository = default; + LocalJsonValue propRetention = default; + LocalJsonValue propSchedule = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propConfig.TryReadProperty(ref reader, options, PropConfig, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRepository.TryReadProperty(ref reader, options, PropRepository, null)) + { + continue; + } + + if (propRetention.TryReadProperty(ref reader, options, PropRetention, null)) + { + continue; + } + + if (propSchedule.TryReadProperty(ref reader, options, PropSchedule, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Config = propConfig.Value, + Name = propName.Value, + Repository = propRepository.Value, + Retention = propRetention.Value, + Schedule = propSchedule.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropConfig, value.Config, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRepository, value.Repository, null, null); + writer.WriteProperty(options, PropRetention, value.Retention, null, null); + writer.WriteProperty(options, PropSchedule, value.Schedule, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicyConverter))] public sealed partial class SlmPolicy { - [JsonInclude, JsonPropertyName("config")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? Config { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("repository")] - public string Repository { get; init; } - [JsonInclude, JsonPropertyName("retention")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? Retention { get; init; } - [JsonInclude, JsonPropertyName("schedule")] - public string Schedule { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SlmPolicy(string name, string repository, string schedule) + { + Name = name; + Repository = repository; + Schedule = schedule; + } +#if NET7_0_OR_GREATER + public SlmPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SlmPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SlmPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmConfiguration? Config { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Repository { get; set; } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Retention? Retention { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Schedule { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SnapshotLifecycle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SnapshotLifecycle.g.cs index f4a9896f7d8..4275e774da4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SnapshotLifecycle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/SnapshotLifecycle.g.cs @@ -17,48 +17,198 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; +internal sealed partial class SnapshotLifecycleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropInProgress = System.Text.Json.JsonEncodedText.Encode("in_progress"); + private static readonly System.Text.Json.JsonEncodedText PropLastFailure = System.Text.Json.JsonEncodedText.Encode("last_failure"); + private static readonly System.Text.Json.JsonEncodedText PropLastSuccess = System.Text.Json.JsonEncodedText.Encode("last_success"); + private static readonly System.Text.Json.JsonEncodedText PropModifiedDate = System.Text.Json.JsonEncodedText.Encode("modified_date"); + private static readonly System.Text.Json.JsonEncodedText PropModifiedDateMillis = System.Text.Json.JsonEncodedText.Encode("modified_date_millis"); + private static readonly System.Text.Json.JsonEncodedText PropNextExecution = System.Text.Json.JsonEncodedText.Encode("next_execution"); + private static readonly System.Text.Json.JsonEncodedText PropNextExecutionMillis = System.Text.Json.JsonEncodedText.Encode("next_execution_millis"); + private static readonly System.Text.Json.JsonEncodedText PropPolicy = System.Text.Json.JsonEncodedText.Encode("policy"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propInProgress = default; + LocalJsonValue propLastFailure = default; + LocalJsonValue propLastSuccess = default; + LocalJsonValue propModifiedDate = default; + LocalJsonValue propModifiedDateMillis = default; + LocalJsonValue propNextExecution = default; + LocalJsonValue propNextExecutionMillis = default; + LocalJsonValue propPolicy = default; + LocalJsonValue propStats = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propInProgress.TryReadProperty(ref reader, options, PropInProgress, null)) + { + continue; + } + + if (propLastFailure.TryReadProperty(ref reader, options, PropLastFailure, null)) + { + continue; + } + + if (propLastSuccess.TryReadProperty(ref reader, options, PropLastSuccess, null)) + { + continue; + } + + if (propModifiedDate.TryReadProperty(ref reader, options, PropModifiedDate, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propModifiedDateMillis.TryReadProperty(ref reader, options, PropModifiedDateMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propNextExecution.TryReadProperty(ref reader, options, PropNextExecution, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propNextExecutionMillis.TryReadProperty(ref reader, options, PropNextExecutionMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propPolicy.TryReadProperty(ref reader, options, PropPolicy, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + InProgress = propInProgress.Value, + LastFailure = propLastFailure.Value, + LastSuccess = propLastSuccess.Value, + ModifiedDate = propModifiedDate.Value, + ModifiedDateMillis = propModifiedDateMillis.Value, + NextExecution = propNextExecution.Value, + NextExecutionMillis = propNextExecutionMillis.Value, + Policy = propPolicy.Value, + Stats = propStats.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropInProgress, value.InProgress, null, null); + writer.WriteProperty(options, PropLastFailure, value.LastFailure, null, null); + writer.WriteProperty(options, PropLastSuccess, value.LastSuccess, null, null); + writer.WriteProperty(options, PropModifiedDate, value.ModifiedDate, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropModifiedDateMillis, value.ModifiedDateMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropNextExecution, value.NextExecution, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropNextExecutionMillis, value.NextExecutionMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropPolicy, value.Policy, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SnapshotLifecycleConverter))] public sealed partial class SnapshotLifecycle { - [JsonInclude, JsonPropertyName("in_progress")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgress? InProgress { get; init; } - [JsonInclude, JsonPropertyName("last_failure")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation? LastFailure { get; init; } - [JsonInclude, JsonPropertyName("last_success")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation? LastSuccess { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SnapshotLifecycle(System.DateTimeOffset modifiedDateMillis, System.DateTimeOffset nextExecutionMillis, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy policy, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics stats, long version) + { + ModifiedDateMillis = modifiedDateMillis; + NextExecutionMillis = nextExecutionMillis; + Policy = policy; + Stats = stats; + Version = version; + } +#if NET7_0_OR_GREATER + public SnapshotLifecycle() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SnapshotLifecycle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SnapshotLifecycle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.InProgress? InProgress { get; set; } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation? LastFailure { get; set; } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Invocation? LastSuccess { get; set; } /// /// /// The last time the policy was modified. /// /// - [JsonInclude, JsonPropertyName("modified_date")] - public DateTimeOffset? ModifiedDate { get; init; } - [JsonInclude, JsonPropertyName("modified_date_millis")] - public long ModifiedDateMillis { get; init; } + public System.DateTimeOffset? ModifiedDate { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ModifiedDateMillis { get; set; } /// /// /// The next time the policy will run. /// /// - [JsonInclude, JsonPropertyName("next_execution")] - public DateTimeOffset? NextExecution { get; init; } - [JsonInclude, JsonPropertyName("next_execution_millis")] - public long NextExecutionMillis { get; init; } - [JsonInclude, JsonPropertyName("policy")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy Policy { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics Stats { get; init; } + public System.DateTimeOffset? NextExecution { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset NextExecutionMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.SlmPolicy Policy { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics Stats { get; set; } /// /// @@ -66,6 +216,9 @@ public sealed partial class SnapshotLifecycle /// Only the latest version is stored and incremented when the policy is updated. /// /// - [JsonInclude, JsonPropertyName("version")] - public long Version { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Statistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Statistics.g.cs index 60a4d0467ae..aa89a668523 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Statistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SnapshotLifecycleManagement/Statistics.g.cs @@ -17,119 +17,163 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; -internal sealed partial class StatisticsConverter : JsonConverter +internal sealed partial class StatisticsConverter : System.Text.Json.Serialization.JsonConverter { - public override Statistics Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropPolicy = System.Text.Json.JsonEncodedText.Encode("policy"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionDeletionTime = System.Text.Json.JsonEncodedText.Encode("retention_deletion_time"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionDeletionTimeMillis = System.Text.Json.JsonEncodedText.Encode("retention_deletion_time_millis"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionFailed = System.Text.Json.JsonEncodedText.Encode("retention_failed"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionRuns = System.Text.Json.JsonEncodedText.Encode("retention_runs"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionTimedOut = System.Text.Json.JsonEncodedText.Encode("retention_timed_out"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotDeletionFailures = System.Text.Json.JsonEncodedText.Encode("total_snapshot_deletion_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotDeletionFailures1 = System.Text.Json.JsonEncodedText.Encode("snapshot_deletion_failures"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsDeleted = System.Text.Json.JsonEncodedText.Encode("total_snapshots_deleted"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsDeleted1 = System.Text.Json.JsonEncodedText.Encode("snapshots_deleted"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsFailed = System.Text.Json.JsonEncodedText.Encode("total_snapshots_failed"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsFailed1 = System.Text.Json.JsonEncodedText.Encode("snapshots_failed"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsTaken = System.Text.Json.JsonEncodedText.Encode("total_snapshots_taken"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSnapshotsTaken1 = System.Text.Json.JsonEncodedText.Encode("snapshots_taken"); + + public override Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - string? policy = default; - Elastic.Clients.Elasticsearch.Duration? retentionDeletionTime = default; - long? retentionDeletionTimeMillis = default; - long? retentionFailed = default; - long? retentionRuns = default; - long? retentionTimedOut = default; - long? totalSnapshotDeletionFailures = default; - long? totalSnapshotsDeleted = default; - long? totalSnapshotsFailed = default; - long? totalSnapshotsTaken = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPolicy = default; + LocalJsonValue propRetentionDeletionTime = default; + LocalJsonValue propRetentionDeletionTimeMillis = default; + LocalJsonValue propRetentionFailed = default; + LocalJsonValue propRetentionRuns = default; + LocalJsonValue propRetentionTimedOut = default; + LocalJsonValue propTotalSnapshotDeletionFailures = default; + LocalJsonValue propTotalSnapshotsDeleted = default; + LocalJsonValue propTotalSnapshotsFailed = default; + LocalJsonValue propTotalSnapshotsTaken = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propPolicy.TryReadProperty(ref reader, options, PropPolicy, null)) + { + continue; + } + + if (propRetentionDeletionTime.TryReadProperty(ref reader, options, PropRetentionDeletionTime, null)) + { + continue; + } + + if (propRetentionDeletionTimeMillis.TryReadProperty(ref reader, options, PropRetentionDeletionTimeMillis, static System.TimeSpan? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propRetentionFailed.TryReadProperty(ref reader, options, PropRetentionFailed, null)) { - var property = reader.GetString(); - if (property == "policy") - { - policy = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "retention_deletion_time") - { - retentionDeletionTime = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "retention_deletion_time_millis") - { - retentionDeletionTimeMillis = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "retention_failed") - { - retentionFailed = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "retention_runs") - { - retentionRuns = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "retention_timed_out") - { - retentionTimedOut = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "total_snapshot_deletion_failures" || property == "snapshot_deletion_failures") - { - totalSnapshotDeletionFailures = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "total_snapshots_deleted" || property == "snapshots_deleted") - { - totalSnapshotsDeleted = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "total_snapshots_failed" || property == "snapshots_failed") - { - totalSnapshotsFailed = JsonSerializer.Deserialize(ref reader, options); - continue; - } - - if (property == "total_snapshots_taken" || property == "snapshots_taken") - { - totalSnapshotsTaken = JsonSerializer.Deserialize(ref reader, options); - continue; - } + continue; } + + if (propRetentionRuns.TryReadProperty(ref reader, options, PropRetentionRuns, null)) + { + continue; + } + + if (propRetentionTimedOut.TryReadProperty(ref reader, options, PropRetentionTimedOut, null)) + { + continue; + } + + if (propTotalSnapshotDeletionFailures.TryReadProperty(ref reader, options, PropTotalSnapshotDeletionFailures, null) || propTotalSnapshotDeletionFailures.TryReadProperty(ref reader, options, PropTotalSnapshotDeletionFailures1, null)) + { + continue; + } + + if (propTotalSnapshotsDeleted.TryReadProperty(ref reader, options, PropTotalSnapshotsDeleted, null) || propTotalSnapshotsDeleted.TryReadProperty(ref reader, options, PropTotalSnapshotsDeleted1, null)) + { + continue; + } + + if (propTotalSnapshotsFailed.TryReadProperty(ref reader, options, PropTotalSnapshotsFailed, null) || propTotalSnapshotsFailed.TryReadProperty(ref reader, options, PropTotalSnapshotsFailed1, null)) + { + continue; + } + + if (propTotalSnapshotsTaken.TryReadProperty(ref reader, options, PropTotalSnapshotsTaken, null) || propTotalSnapshotsTaken.TryReadProperty(ref reader, options, PropTotalSnapshotsTaken1, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return new Statistics { Policy = policy, RetentionDeletionTime = retentionDeletionTime, RetentionDeletionTimeMillis = retentionDeletionTimeMillis, RetentionFailed = retentionFailed, RetentionRuns = retentionRuns, RetentionTimedOut = retentionTimedOut, TotalSnapshotDeletionFailures = totalSnapshotDeletionFailures, TotalSnapshotsDeleted = totalSnapshotsDeleted, TotalSnapshotsFailed = totalSnapshotsFailed, TotalSnapshotsTaken = totalSnapshotsTaken }; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Policy = propPolicy.Value, + RetentionDeletionTime = propRetentionDeletionTime.Value, + RetentionDeletionTimeMillis = propRetentionDeletionTimeMillis.Value, + RetentionFailed = propRetentionFailed.Value, + RetentionRuns = propRetentionRuns.Value, + RetentionTimedOut = propRetentionTimedOut.Value, + TotalSnapshotDeletionFailures = propTotalSnapshotDeletionFailures.Value, + TotalSnapshotsDeleted = propTotalSnapshotsDeleted.Value, + TotalSnapshotsFailed = propTotalSnapshotsFailed.Value, + TotalSnapshotsTaken = propTotalSnapshotsTaken.Value + }; } - public override void Write(Utf8JsonWriter writer, Statistics value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics value, System.Text.Json.JsonSerializerOptions options) { - throw new NotImplementedException("'Statistics' is a readonly type, used only on responses and does not support being written to JSON."); + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicy, value.Policy, null, null); + writer.WriteProperty(options, PropRetentionDeletionTime, value.RetentionDeletionTime, null, null); + writer.WriteProperty(options, PropRetentionDeletionTimeMillis, value.RetentionDeletionTimeMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropRetentionFailed, value.RetentionFailed, null, null); + writer.WriteProperty(options, PropRetentionRuns, value.RetentionRuns, null, null); + writer.WriteProperty(options, PropRetentionTimedOut, value.RetentionTimedOut, null, null); + writer.WriteProperty(options, PropTotalSnapshotDeletionFailures, value.TotalSnapshotDeletionFailures, null, null); + writer.WriteProperty(options, PropTotalSnapshotsDeleted, value.TotalSnapshotsDeleted, null, null); + writer.WriteProperty(options, PropTotalSnapshotsFailed, value.TotalSnapshotsFailed, null, null); + writer.WriteProperty(options, PropTotalSnapshotsTaken, value.TotalSnapshotsTaken, null, null); + writer.WriteEndObject(); } } -[JsonConverter(typeof(StatisticsConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.StatisticsConverter))] public sealed partial class Statistics { - public string? Policy { get; init; } - public Elastic.Clients.Elasticsearch.Duration? RetentionDeletionTime { get; init; } - public long? RetentionDeletionTimeMillis { get; init; } - public long? RetentionFailed { get; init; } - public long? RetentionRuns { get; init; } - public long? RetentionTimedOut { get; init; } - public long? TotalSnapshotDeletionFailures { get; init; } - public long? TotalSnapshotsDeleted { get; init; } - public long? TotalSnapshotsFailed { get; init; } - public long? TotalSnapshotsTaken { get; init; } +#if NET7_0_OR_GREATER + public Statistics() + { + } +#endif +#if !NET7_0_OR_GREATER + public Statistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Statistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public string? Policy { get; set; } + public Elastic.Clients.Elasticsearch.Duration? RetentionDeletionTime { get; set; } + public System.TimeSpan? RetentionDeletionTimeMillis { get; set; } + public long? RetentionFailed { get; set; } + public long? RetentionRuns { get; set; } + public long? RetentionTimedOut { get; set; } + public long? TotalSnapshotDeletionFailures { get; set; } + public long? TotalSnapshotsDeleted { get; set; } + public long? TotalSnapshotsFailed { get; set; } + public long? TotalSnapshotsTaken { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SortOptions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SortOptions.g.cs index 4a1c125bc51..d53d19adad5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/SortOptions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/SortOptions.g.cs @@ -17,280 +17,370 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[JsonConverter(typeof(SortOptionsConverter))] -public sealed partial class SortOptions +internal sealed partial class SortOptionsConverter : System.Text.Json.Serialization.JsonConverter { - internal SortOptions(string variantName, object variant) + private static readonly System.Text.Json.JsonEncodedText VariantDoc = System.Text.Json.JsonEncodedText.Encode("_doc"); + private static readonly System.Text.Json.JsonEncodedText VariantGeoDistance = System.Text.Json.JsonEncodedText.Encode("_geo_distance"); + private static readonly System.Text.Json.JsonEncodedText VariantScore = System.Text.Json.JsonEncodedText.Encode("_score"); + private static readonly System.Text.Json.JsonEncodedText VariantScript = System.Text.Json.JsonEncodedText.Encode("_script"); + + public override Elastic.Clients.Elasticsearch.SortOptions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; + var readerSnapshot = reader; + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (reader.ValueTextEquals(VariantDoc)) + { + variantType = VariantDoc.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (reader.ValueTextEquals(VariantGeoDistance)) + { + variantType = VariantGeoDistance.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (reader.ValueTextEquals(VariantScore)) + { + variantType = VariantScore.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + if (reader.ValueTextEquals(VariantScript)) + { + variantType = VariantScript.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; + } + + reader = readerSnapshot; + variantType = ""; + variant = reader.ReadValue(options, null); + break; + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.SortOptions value, System.Text.Json.JsonSerializerOptions options) + { + if (value.VariantType is "" && value.Variant is not null) + { + writer.WriteValue(options, (Elastic.Clients.Elasticsearch.FieldSort)value.Variant, null); + return; + } + + writer.WriteStartObject(); + switch (value.VariantType) + { + case null: + break; + case "_doc": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.ScoreSort)value.Variant, null, null); + break; + case "_geo_distance": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.GeoDistanceSort)value.Variant, null, null); + break; + case "_score": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.ScoreSort)value.Variant, null, null); + break; + case "_script": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.ScriptSort)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.SortOptions)}'."); + } + + writer.WriteEndObject(); } +} - internal SortOptions(Elastic.Clients.Elasticsearch.Field field, object variant) +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.SortOptionsConverter))] +public sealed partial class SortOptions +{ + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public SortOptions() { - if (field is null) - throw new ArgumentNullException(nameof(field)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - AdditionalPropertyName = field; - Variant = variant; } +#endif +#if !NET7_0_OR_GREATER + public SortOptions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.ScoreSort? Doc { get => GetVariant("_doc"); set => SetVariant("_doc", value); } + public Elastic.Clients.Elasticsearch.FieldSort? Field { get => GetVariant(""); set => SetVariant("", value); } + public Elastic.Clients.Elasticsearch.GeoDistanceSort? GeoDistance { get => GetVariant("_geo_distance"); set => SetVariant("_geo_distance", value); } + public Elastic.Clients.Elasticsearch.ScoreSort? Score { get => GetVariant("_score"); set => SetVariant("_score", value); } + public Elastic.Clients.Elasticsearch.ScriptSort? Script { get => GetVariant("_script"); set => SetVariant("_script", value); } + + public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.FieldSort value) => new Elastic.Clients.Elasticsearch.SortOptions { Field = value }; + public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.GeoDistanceSort value) => new Elastic.Clients.Elasticsearch.SortOptions { GeoDistance = value }; + public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.ScriptSort value) => new Elastic.Clients.Elasticsearch.SortOptions { Script = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } - internal object Variant { get; } - internal string VariantName { get; } - internal Elastic.Clients.Elasticsearch.Field? AdditionalPropertyName { get; } + return default; + } - public static SortOptions Doc(Elastic.Clients.Elasticsearch.ScoreSort scoreSort) => new SortOptions("_doc", scoreSort); - public static SortOptions GeoDistance(Elastic.Clients.Elasticsearch.GeoDistanceSort geoDistanceSort) => new SortOptions("_geo_distance", geoDistanceSort); - public static SortOptions Score(Elastic.Clients.Elasticsearch.ScoreSort scoreSort) => new SortOptions("_score", scoreSort); - public static SortOptions Script(Elastic.Clients.Elasticsearch.ScriptSort scriptSort) => new SortOptions("_script", scriptSort); - public static SortOptions Field(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.FieldSort fieldSort) => new SortOptions(field, fieldSort); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) + { + VariantType = type; + Variant = value; + } } -public sealed partial class SortOptionsDescriptor : SerializableDescriptor> +public readonly partial struct SortOptionsDescriptor { - internal SortOptionsDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SortOptions Instance { get; init; } - public SortOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortOptionsDescriptor(Elastic.Clients.Elasticsearch.SortOptions instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - private Elastic.Clients.Elasticsearch.Field AdditionalPropertyName { get; set; } - private Elastic.Clients.Elasticsearch.FieldSort AdditionalPropertyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortOptionsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private SortOptionsDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.SortOptionsDescriptor(Elastic.Clients.Elasticsearch.SortOptions instance) => new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc(Elastic.Clients.Elasticsearch.ScoreSort? value) { - AdditionalPropertyValue = null; - AdditionalPropertyName = null; - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Doc = value; + return this; } - private SortOptionsDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc() { - AdditionalPropertyValue = null; - AdditionalPropertyName = null; - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Doc = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(null); + return this; } - private SortOptionsDescriptor Set(Action descriptorAction, Elastic.Clients.Elasticsearch.Field variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc(System.Action? action) { - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - ContainedVariantName = null; - Variant = null; - AdditionalPropertyValue = null; - AdditionalPropertyName = variantName; - ContainsVariant = true; - return Self; + Instance.Doc = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(action); + return this; } - private SortOptionsDescriptor Set(Elastic.Clients.Elasticsearch.FieldSort variant, Elastic.Clients.Elasticsearch.Field variantName) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.FieldSort? value) { - ContainedVariantName = null; - Variant = null; - AdditionalPropertyValue = variant; - AdditionalPropertyName = variantName; - ContainsVariant = true; - return Self; + Instance.Field = value; + return this; } - public SortOptionsDescriptor Doc(ScoreSort scoreSort) => Set(scoreSort, "_doc"); - public SortOptionsDescriptor Doc(Action configure) => Set(configure, "_doc"); - public SortOptionsDescriptor GeoDistance(GeoDistanceSort geoDistanceSort) => Set(geoDistanceSort, "_geo_distance"); - public SortOptionsDescriptor GeoDistance(Action> configure) => Set(configure, "_geo_distance"); - public SortOptionsDescriptor Score(ScoreSort scoreSort) => Set(scoreSort, "_score"); - public SortOptionsDescriptor Score(Action configure) => Set(configure, "_score"); - public SortOptionsDescriptor Script(ScriptSort scriptSort) => Set(scriptSort, "_script"); - public SortOptionsDescriptor Script(Action> configure) => Set(configure, "_script"); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field) => Set(FieldSort.Empty, field); - public SortOptionsDescriptor Field(Expression> field) => Set(FieldSort.Empty, field); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.FieldSort sort) => Set(sort, field); - public SortOptionsDescriptor Field(Expression> field, Elastic.Clients.Elasticsearch.FieldSort sort) => Set(sort, field); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field, Action> configure) => Set(configure, field); - public SortOptionsDescriptor Field(Expression> field, Action> configure) => Set(configure, field); + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Field(System.Action> action) + { + Instance.Field = Elastic.Clients.Elasticsearch.FieldSortDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor GeoDistance(Elastic.Clients.Elasticsearch.GeoDistanceSort? value) { - if (!ContainsVariant) - { - writer.WriteNullValue(); - return; - } + Instance.GeoDistance = value; + return this; + } - var fieldName = ContainedVariantName; - if (AdditionalPropertyName is IUrlParameter urlParameter) - { - fieldName = urlParameter.GetString(settings); - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor GeoDistance(System.Action> action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor.Build(action); + return this; + } - if ((Variant is not null && Variant.Equals(FieldSort.Empty)) || (AdditionalPropertyValue is not null && AdditionalPropertyValue.Equals(FieldSort.Empty))) - { - writer.WriteStringValue(fieldName); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score(Elastic.Clients.Elasticsearch.ScoreSort? value) + { + Instance.Score = value; + return this; + } - writer.WriteStartObject(); - writer.WritePropertyName(fieldName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score() + { + Instance.Score = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(null); + return this; + } - if (AdditionalPropertyValue is not null) - { - JsonSerializer.Serialize(writer, AdditionalPropertyValue, options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score(System.Action? action) + { + Instance.Score = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Script(Elastic.Clients.Elasticsearch.ScriptSort? value) + { + Instance.Script = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Script(System.Action> action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptSortDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SortOptions Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(new Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SortOptionsDescriptor : SerializableDescriptor +public readonly partial struct SortOptionsDescriptor { - internal SortOptionsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.SortOptions Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortOptionsDescriptor(Elastic.Clients.Elasticsearch.SortOptions instance) + { + Instance = instance; + } - public SortOptionsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SortOptionsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - private Elastic.Clients.Elasticsearch.Field AdditionalPropertyName { get; set; } - private Elastic.Clients.Elasticsearch.FieldSort AdditionalPropertyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.SortOptionsDescriptor(Elastic.Clients.Elasticsearch.SortOptions instance) => new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) => descriptor.Instance; - private SortOptionsDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc(Elastic.Clients.Elasticsearch.ScoreSort? value) { - AdditionalPropertyValue = null; - AdditionalPropertyName = null; - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.Doc = value; + return this; } - private SortOptionsDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc() { - AdditionalPropertyValue = null; - AdditionalPropertyName = null; - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Doc = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(null); + return this; } - private SortOptionsDescriptor Set(Action descriptorAction, Elastic.Clients.Elasticsearch.Field variantName) where T : Descriptor + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Doc(System.Action? action) { - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - ContainedVariantName = null; - Variant = null; - AdditionalPropertyValue = null; - AdditionalPropertyName = variantName; - ContainsVariant = true; - return Self; + Instance.Doc = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(action); + return this; } - private SortOptionsDescriptor Set(Elastic.Clients.Elasticsearch.FieldSort variant, Elastic.Clients.Elasticsearch.Field variantName) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.FieldSort? value) { - ContainedVariantName = null; - Variant = null; - AdditionalPropertyValue = variant; - AdditionalPropertyName = variantName; - ContainsVariant = true; - return Self; + Instance.Field = value; + return this; } - public SortOptionsDescriptor Doc(ScoreSort scoreSort) => Set(scoreSort, "_doc"); - public SortOptionsDescriptor Doc(Action configure) => Set(configure, "_doc"); - public SortOptionsDescriptor GeoDistance(GeoDistanceSort geoDistanceSort) => Set(geoDistanceSort, "_geo_distance"); - public SortOptionsDescriptor GeoDistance(Action configure) => Set(configure, "_geo_distance"); - public SortOptionsDescriptor GeoDistance(Action> configure) => Set(configure, "_geo_distance"); - public SortOptionsDescriptor Score(ScoreSort scoreSort) => Set(scoreSort, "_score"); - public SortOptionsDescriptor Score(Action configure) => Set(configure, "_score"); - public SortOptionsDescriptor Script(ScriptSort scriptSort) => Set(scriptSort, "_script"); - public SortOptionsDescriptor Script(Action configure) => Set(configure, "_script"); - public SortOptionsDescriptor Script(Action> configure) => Set(configure, "_script"); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field) => Set(FieldSort.Empty, field); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.FieldSort sort) => Set(sort, field); - public SortOptionsDescriptor Field(Elastic.Clients.Elasticsearch.Field field, Action configure) => Set(configure, field); + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Field(System.Action action) + { + Instance.Field = Elastic.Clients.Elasticsearch.FieldSortDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Field(System.Action> action) { - if (!ContainsVariant) - { - writer.WriteNullValue(); - return; - } + Instance.Field = Elastic.Clients.Elasticsearch.FieldSortDescriptor.Build(action); + return this; + } - var fieldName = ContainedVariantName; - if (AdditionalPropertyName is IUrlParameter urlParameter) - { - fieldName = urlParameter.GetString(settings); - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor GeoDistance(Elastic.Clients.Elasticsearch.GeoDistanceSort? value) + { + Instance.GeoDistance = value; + return this; + } - if ((Variant is not null && Variant.Equals(FieldSort.Empty)) || (AdditionalPropertyValue is not null && AdditionalPropertyValue.Equals(FieldSort.Empty))) - { - writer.WriteStringValue(fieldName); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor GeoDistance(System.Action action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor.Build(action); + return this; + } - writer.WriteStartObject(); - writer.WritePropertyName(fieldName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor GeoDistance(System.Action> action) + { + Instance.GeoDistance = Elastic.Clients.Elasticsearch.GeoDistanceSortDescriptor.Build(action); + return this; + } - if (AdditionalPropertyValue is not null) - { - JsonSerializer.Serialize(writer, AdditionalPropertyValue, options); - writer.WriteEndObject(); - return; - } + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score(Elastic.Clients.Elasticsearch.ScoreSort? value) + { + Instance.Score = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score() + { + Instance.Score = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(null); + return this; } -} + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Score(System.Action? action) + { + Instance.Score = Elastic.Clients.Elasticsearch.ScoreSortDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Script(Elastic.Clients.Elasticsearch.ScriptSort? value) + { + Instance.Script = value; + return this; + } + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Script(System.Action action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptSortDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.SortOptionsDescriptor Script(System.Action> action) + { + Instance.Script = Elastic.Clients.Elasticsearch.ScriptSortDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.SortOptions Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(new Elastic.Clients.Elasticsearch.SortOptions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Sql/Column.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Sql/Column.g.cs index 5f24db8ce1b..baa1777c8da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Sql/Column.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Sql/Column.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Sql; +internal sealed partial class ColumnConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Sql.Column Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propName = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Sql.Column(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Name = propName.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Sql.Column value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Sql.ColumnConverter))] public sealed partial class Column { - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Column(string name, string type) + { + Name = name; + Type = type; + } +#if NET7_0_OR_GREATER + public Column() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Column() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Column(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StandardRetriever.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StandardRetriever.g.cs index 2cac0294e41..621665cb133 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StandardRetriever.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StandardRetriever.g.cs @@ -17,24 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class StandardRetrieverConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCollapse = System.Text.Json.JsonEncodedText.Encode("collapse"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropSearchAfter = System.Text.Json.JsonEncodedText.Encode("search_after"); + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropTerminateAfter = System.Text.Json.JsonEncodedText.Encode("terminate_after"); + + public override Elastic.Clients.Elasticsearch.StandardRetriever Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCollapse = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propSearchAfter = default; + LocalJsonValue?> propSort = default; + LocalJsonValue propTerminateAfter = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCollapse.TryReadProperty(ref reader, options, PropCollapse, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propSearchAfter.TryReadProperty(ref reader, options, PropSearchAfter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSort.TryReadProperty(ref reader, options, PropSort, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propTerminateAfter.TryReadProperty(ref reader, options, PropTerminateAfter, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Collapse = propCollapse.Value, + Filter = propFilter.Value, + MinScore = propMinScore.Value, + Query = propQuery.Value, + SearchAfter = propSearchAfter.Value, + Sort = propSort.Value, + TerminateAfter = propTerminateAfter.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.StandardRetriever value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCollapse, value.Collapse, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropSearchAfter, value.SearchAfter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSort, value.Sort, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTerminateAfter, value.TerminateAfter, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.StandardRetrieverConverter))] public sealed partial class StandardRetriever { +#if NET7_0_OR_GREATER + public StandardRetriever() + { + } +#endif +#if !NET7_0_OR_GREATER + public StandardRetriever() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Collapses the top documents by a specified key into a single top document per key. /// /// - [JsonInclude, JsonPropertyName("collapse")] public Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? Collapse { get; set; } /// @@ -42,16 +147,13 @@ public sealed partial class StandardRetriever /// Query to filter the documents that can match. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -59,7 +161,6 @@ public sealed partial class StandardRetriever /// Defines a query to retrieve a set of top documents. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -67,82 +168,62 @@ public sealed partial class StandardRetriever /// Defines a search after object parameter used for pagination. /// /// - [JsonInclude, JsonPropertyName("search_after")] - public ICollection? SearchAfter { get; set; } + public System.Collections.Generic.ICollection? SearchAfter { get; set; } /// /// /// A sort object that that specifies the order of matching documents. /// /// - [JsonInclude, JsonPropertyName("sort")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] - public ICollection? Sort { get; set; } + public System.Collections.Generic.ICollection? Sort { get; set; } /// /// /// Maximum number of documents to collect for each shard. /// /// - [JsonInclude, JsonPropertyName("terminate_after")] public int? TerminateAfter { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Retriever(StandardRetriever standardRetriever) => Elastic.Clients.Elasticsearch.Retriever.Standard(standardRetriever); } -public sealed partial class StandardRetrieverDescriptor : SerializableDescriptor> +public readonly partial struct StandardRetrieverDescriptor { - internal StandardRetrieverDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.StandardRetriever Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardRetrieverDescriptor(Elastic.Clients.Elasticsearch.StandardRetriever instance) + { + Instance = instance; + } - public StandardRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardRetrieverDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action> CollapseDescriptorAction { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private float? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action> SortDescriptorAction { get; set; } - private Action>[] SortDescriptorActions { get; set; } - private int? TerminateAfterValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(Elastic.Clients.Elasticsearch.StandardRetriever instance) => new Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Collapses the top documents by a specified key into a single top document per key. /// /// - public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance.Collapse = value; + return this; } - public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) - { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; - } - - public StandardRetrieverDescriptor Collapse(Action> configure) + /// + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// @@ -150,40 +231,38 @@ public StandardRetrieverDescriptor Collapse(Action /// - public StandardRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public StandardRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public StandardRetrieverDescriptor Filter(Action> configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public StandardRetrieverDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -191,10 +270,10 @@ public StandardRetrieverDescriptor Filter(params Action /// - public StandardRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -202,28 +281,32 @@ public StandardRetrieverDescriptor MinScore(float? minScore) /// Defines a query to retrieve a set of top documents. /// /// - public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines a query to retrieve a set of top documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public StandardRetrieverDescriptor Query(Action> configure) + /// + /// + /// Defines a search after object parameter used for pagination. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.SearchAfter = value; + return this; } /// @@ -231,10 +314,10 @@ public StandardRetrieverDescriptor Query(Action /// - public StandardRetrieverDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = [.. values]; + return this; } /// @@ -242,40 +325,38 @@ public StandardRetrieverDescriptor SearchAfter(ICollection /// - public StandardRetrieverDescriptor Sort(ICollection? sort) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } - public StandardRetrieverDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + /// + /// + /// A sort object that that specifies the order of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.Sort = [.. values]; + return this; } - public StandardRetrieverDescriptor Sort(Action> configure) + /// + /// + /// A sort object that that specifies the order of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(params System.Action>[] actions) { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); + } - public StandardRetrieverDescriptor Sort(params Action>[] configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = items; + return this; } /// @@ -283,180 +364,76 @@ public StandardRetrieverDescriptor Sort(params Action /// - public StandardRetrieverDescriptor TerminateAfter(int? terminateAfter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor TerminateAfter(int? value) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.TerminateAfter = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.StandardRetriever Build(System.Action>? action) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } - - if (SearchAfterValue is not null) - { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); - } - - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) + if (action is null) { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); + return new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } - - if (TerminateAfterValue.HasValue) - { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class StandardRetrieverDescriptor : SerializableDescriptor +public readonly partial struct StandardRetrieverDescriptor { - internal StandardRetrieverDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.StandardRetriever Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardRetrieverDescriptor(Elastic.Clients.Elasticsearch.StandardRetriever instance) + { + Instance = instance; + } - public StandardRetrieverDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StandardRetrieverDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? CollapseValue { get; set; } - private Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } - private Action CollapseDescriptorAction { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private float? MinScoreValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private ICollection? SearchAfterValue { get; set; } - private ICollection? SortValue { get; set; } - private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } - private Action SortDescriptorAction { get; set; } - private Action[] SortDescriptorActions { get; set; } - private int? TerminateAfterValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(Elastic.Clients.Elasticsearch.StandardRetriever instance) => new Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor descriptor) => descriptor.Instance; /// /// /// Collapses the top documents by a specified key into a single top document per key. /// /// - public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? collapse) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapse? value) { - CollapseDescriptor = null; - CollapseDescriptorAction = null; - CollapseValue = collapse; - return Self; + Instance.Collapse = value; + return this; } - public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor descriptor) + /// + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Collapse(System.Action action) { - CollapseValue = null; - CollapseDescriptorAction = null; - CollapseDescriptor = descriptor; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } - public StandardRetrieverDescriptor Collapse(Action configure) + /// + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Collapse(System.Action> action) { - CollapseValue = null; - CollapseDescriptor = null; - CollapseDescriptorAction = configure; - return Self; + Instance.Collapse = Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor.Build(action); + return this; } /// @@ -464,40 +441,55 @@ public StandardRetrieverDescriptor Collapse(Action /// - public StandardRetrieverDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public StandardRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public StandardRetrieverDescriptor Filter(Action configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public StandardRetrieverDescriptor Filter(params Action[] configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -505,10 +497,10 @@ public StandardRetrieverDescriptor Filter(params Action /// - public StandardRetrieverDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -516,28 +508,32 @@ public StandardRetrieverDescriptor MinScore(float? minScore) /// Defines a query to retrieve a set of top documents. /// /// - public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Defines a query to retrieve a set of top documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public StandardRetrieverDescriptor Query(Action configure) + /// + /// + /// Defines a query to retrieve a set of top documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -545,175 +541,100 @@ public StandardRetrieverDescriptor Query(Action /// - public StandardRetrieverDescriptor SearchAfter(ICollection? searchAfter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor SearchAfter(System.Collections.Generic.ICollection? value) { - SearchAfterValue = searchAfter; - return Self; + Instance.SearchAfter = value; + return this; } /// /// - /// A sort object that that specifies the order of matching documents. + /// Defines a search after object parameter used for pagination. /// /// - public StandardRetrieverDescriptor Sort(ICollection? sort) - { - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortValue = sort; - return Self; - } - - public StandardRetrieverDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor SearchAfter(params Elastic.Clients.Elasticsearch.FieldValue[] values) { - SortValue = null; - SortDescriptorAction = null; - SortDescriptorActions = null; - SortDescriptor = descriptor; - return Self; + Instance.SearchAfter = [.. values]; + return this; } - public StandardRetrieverDescriptor Sort(Action configure) - { - SortValue = null; - SortDescriptor = null; - SortDescriptorActions = null; - SortDescriptorAction = configure; - return Self; - } - - public StandardRetrieverDescriptor Sort(params Action[] configure) + /// + /// + /// A sort object that that specifies the order of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(System.Collections.Generic.ICollection? value) { - SortValue = null; - SortDescriptor = null; - SortDescriptorAction = null; - SortDescriptorActions = configure; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Maximum number of documents to collect for each shard. + /// A sort object that that specifies the order of matching documents. /// /// - public StandardRetrieverDescriptor TerminateAfter(int? terminateAfter) + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(params Elastic.Clients.Elasticsearch.SortOptions[] values) { - TerminateAfterValue = terminateAfter; - return Self; + Instance.Sort = [.. values]; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// A sort object that that specifies the order of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(params System.Action[] actions) { - writer.WriteStartObject(); - if (CollapseDescriptor is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseDescriptor, options); - } - else if (CollapseDescriptorAction is not null) - { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); - } - else if (CollapseValue is not null) + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("collapse"); - JsonSerializer.Serialize(writer, CollapseValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.Sort = items; + return this; + } - if (SearchAfterValue is not null) + /// + /// + /// A sort object that that specifies the order of matching documents. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor Sort(params System.Action>[] actions) + { + var items = new System.Collections.Generic.List(); + foreach (var action in actions) { - writer.WritePropertyName("search_after"); - JsonSerializer.Serialize(writer, SearchAfterValue, options); + items.Add(Elastic.Clients.Elasticsearch.SortOptionsDescriptor.Build(action)); } - if (SortDescriptor is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortDescriptor, options); - } - else if (SortDescriptorAction is not null) - { - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); - } - else if (SortDescriptorActions is not null) - { - writer.WritePropertyName("sort"); - if (SortDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in SortDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); - } + Instance.Sort = items; + return this; + } - if (SortDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (SortValue is not null) - { - writer.WritePropertyName("sort"); - SingleOrManySerializationHelper.Serialize(SortValue, writer, options); - } + /// + /// + /// Maximum number of documents to collect for each shard. + /// + /// + public Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor TerminateAfter(int? value) + { + Instance.TerminateAfter = value; + return this; + } - if (TerminateAfterValue.HasValue) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.StandardRetriever Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("terminate_after"); - writer.WriteNumberValue(TerminateAfterValue.Value); + return new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.StandardRetrieverDescriptor(new Elastic.Clients.Elasticsearch.StandardRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoreStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoreStats.g.cs index 34ee7e0f00d..9e7c058cfe0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoreStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoreStats.g.cs @@ -17,49 +17,157 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class StoreStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropReserved = System.Text.Json.JsonEncodedText.Encode("reserved"); + private static readonly System.Text.Json.JsonEncodedText PropReservedInBytes = System.Text.Json.JsonEncodedText.Encode("reserved_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDataSetSize = System.Text.Json.JsonEncodedText.Encode("total_data_set_size"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDataSetSizeInBytes = System.Text.Json.JsonEncodedText.Encode("total_data_set_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.StoreStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propReserved = default; + LocalJsonValue propReservedInBytes = default; + LocalJsonValue propSize = default; + LocalJsonValue propSizeInBytes = default; + LocalJsonValue propTotalDataSetSize = default; + LocalJsonValue propTotalDataSetSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propReserved.TryReadProperty(ref reader, options, PropReserved, null)) + { + continue; + } + + if (propReservedInBytes.TryReadProperty(ref reader, options, PropReservedInBytes, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (propTotalDataSetSize.TryReadProperty(ref reader, options, PropTotalDataSetSize, null)) + { + continue; + } + + if (propTotalDataSetSizeInBytes.TryReadProperty(ref reader, options, PropTotalDataSetSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.StoreStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Reserved = propReserved.Value, + ReservedInBytes = propReservedInBytes.Value, + Size = propSize.Value, + SizeInBytes = propSizeInBytes.Value, + TotalDataSetSize = propTotalDataSetSize.Value, + TotalDataSetSizeInBytes = propTotalDataSetSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.StoreStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropReserved, value.Reserved, null, null); + writer.WriteProperty(options, PropReservedInBytes, value.ReservedInBytes, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteProperty(options, PropTotalDataSetSize, value.TotalDataSetSize, null, null); + writer.WriteProperty(options, PropTotalDataSetSizeInBytes, value.TotalDataSetSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.StoreStatsConverter))] public sealed partial class StoreStats { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StoreStats(long reservedInBytes, long sizeInBytes) + { + ReservedInBytes = reservedInBytes; + SizeInBytes = sizeInBytes; + } +#if NET7_0_OR_GREATER + public StoreStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StoreStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StoreStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// A prediction of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. /// /// - [JsonInclude, JsonPropertyName("reserved")] - public Elastic.Clients.Elasticsearch.ByteSize? Reserved { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Reserved { get; set; } /// /// /// A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. /// /// - [JsonInclude, JsonPropertyName("reserved_in_bytes")] - public long ReservedInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long ReservedInBytes { get; set; } /// /// /// Total size of all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("size")] - public Elastic.Clients.Elasticsearch.ByteSize? Size { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? Size { get; set; } /// /// /// Total size, in bytes, of all shards assigned to selected nodes. /// /// - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } /// /// @@ -67,8 +175,7 @@ public sealed partial class StoreStats /// This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices. /// /// - [JsonInclude, JsonPropertyName("total_data_set_size")] - public Elastic.Clients.Elasticsearch.ByteSize? TotalDataSetSize { get; init; } + public Elastic.Clients.Elasticsearch.ByteSize? TotalDataSetSize { get; set; } /// /// @@ -76,6 +183,5 @@ public sealed partial class StoreStats /// This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices. /// /// - [JsonInclude, JsonPropertyName("total_data_set_size_in_bytes")] - public long? TotalDataSetSizeInBytes { get; init; } + public long? TotalDataSetSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoredScript.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoredScript.g.cs index 60688ac17db..757643f3610 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoredScript.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StoredScript.g.cs @@ -17,28 +17,107 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class StoredScriptConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLanguage = System.Text.Json.JsonEncodedText.Encode("lang"); + private static readonly System.Text.Json.JsonEncodedText PropOptions = System.Text.Json.JsonEncodedText.Encode("options"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + + public override Elastic.Clients.Elasticsearch.StoredScript Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLanguage = default; + LocalJsonValue?> propOptions = default; + LocalJsonValue propSource = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLanguage.TryReadProperty(ref reader, options, PropLanguage, null)) + { + continue; + } + + if (propOptions.TryReadProperty(ref reader, options, PropOptions, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.StoredScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Language = propLanguage.Value, + Options = propOptions.Value, + Source = propSource.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.StoredScript value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLanguage, value.Language, null, null); + writer.WriteProperty(options, PropOptions, value.Options, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.StoredScriptConverter))] public sealed partial class StoredScript { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StoredScript(Elastic.Clients.Elasticsearch.ScriptLanguage language, string source) + { + Language = language; + Source = source; + } +#if NET7_0_OR_GREATER + public StoredScript() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public StoredScript() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal StoredScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The language the script is written in. - /// For serach templates, use mustache. + /// For search templates, use mustache. /// /// - [JsonInclude, JsonPropertyName("lang")] - public Elastic.Clients.Elasticsearch.ScriptLanguage Language { get; set; } - [JsonInclude, JsonPropertyName("options")] - public IDictionary? Options { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ScriptLanguage Language { get; set; } + public System.Collections.Generic.IDictionary? Options { get; set; } /// /// @@ -46,38 +125,67 @@ public sealed partial class StoredScript /// For search templates, an object containing the search template. /// /// - [JsonInclude, JsonPropertyName("source")] - public string Source { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Source { get; set; } } -public sealed partial class StoredScriptDescriptor : SerializableDescriptor +public readonly partial struct StoredScriptDescriptor { - internal StoredScriptDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.StoredScript Instance { get; init; } - public StoredScriptDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StoredScriptDescriptor(Elastic.Clients.Elasticsearch.StoredScript instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.ScriptLanguage LanguageValue { get; set; } - private IDictionary? OptionsValue { get; set; } - private string SourceValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StoredScriptDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.StoredScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.StoredScriptDescriptor(Elastic.Clients.Elasticsearch.StoredScript instance) => new Elastic.Clients.Elasticsearch.StoredScriptDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.StoredScript(Elastic.Clients.Elasticsearch.StoredScriptDescriptor descriptor) => descriptor.Instance; /// /// /// The language the script is written in. - /// For serach templates, use mustache. + /// For search templates, use mustache. /// /// - public StoredScriptDescriptor Language(Elastic.Clients.Elasticsearch.ScriptLanguage language) + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor Language(Elastic.Clients.Elasticsearch.ScriptLanguage value) + { + Instance.Language = value; + return this; + } + + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor Options(System.Collections.Generic.IDictionary? value) { - LanguageValue = language; - return Self; + Instance.Options = value; + return this; } - public StoredScriptDescriptor Options(Func, FluentDictionary> selector) + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor Options() { - OptionsValue = selector?.Invoke(new FluentDictionary()); - return Self; + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor Options(System.Action? action) + { + Instance.Options = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor AddOption(string key, string value) + { + Instance.Options ??= new System.Collections.Generic.Dictionary(); + Instance.Options.Add(key, value); + return this; } /// @@ -86,25 +194,17 @@ public StoredScriptDescriptor Options(Func, Flu /// For search templates, an object containing the search template. /// /// - public StoredScriptDescriptor Source(string source) + public Elastic.Clients.Elasticsearch.StoredScriptDescriptor Source(string value) { - SourceValue = source; - return Self; + Instance.Source = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.StoredScript Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("lang"); - JsonSerializer.Serialize(writer, LanguageValue, options); - if (OptionsValue is not null) - { - writer.WritePropertyName("options"); - JsonSerializer.Serialize(writer, OptionsValue, options); - } - - writer.WritePropertyName("source"); - writer.WriteStringValue(SourceValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.StoredScriptDescriptor(new Elastic.Clients.Elasticsearch.StoredScript(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRule.g.cs index b17b72d196f..a92480be02e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRule.g.cs @@ -17,25 +17,91 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; +internal sealed partial class SynonymRuleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + + public override Elastic.Clients.Elasticsearch.Synonyms.SynonymRule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propSynonyms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.SynonymRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Synonyms = propSynonyms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.SynonymRule value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleConverter))] public sealed partial class SynonymRule { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymRule(string synonyms) + { + Synonyms = synonyms; + } +#if NET7_0_OR_GREATER + public SynonymRule() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SynonymRule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SynonymRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The identifier for the synonym rule. /// If you do not specify a synonym rule ID when you create a rule, an identifier is created automatically by Elasticsearch. /// /// - [JsonInclude, JsonPropertyName("id")] public Elastic.Clients.Elasticsearch.Id? Id { get; set; } /// @@ -43,20 +109,31 @@ public sealed partial class SynonymRule /// The synonyms that conform the synonym rule in Solr format. /// /// - [JsonInclude, JsonPropertyName("synonyms")] - public string Synonyms { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Synonyms { get; set; } } -public sealed partial class SynonymRuleDescriptor : SerializableDescriptor +public readonly partial struct SynonymRuleDescriptor { - internal SynonymRuleDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.Synonyms.SynonymRule Instance { get; init; } - public SynonymRuleDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymRuleDescriptor(Elastic.Clients.Elasticsearch.Synonyms.SynonymRule instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } - private string SynonymsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymRuleDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Synonyms.SynonymRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(Elastic.Clients.Elasticsearch.Synonyms.SynonymRule instance) => new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Synonyms.SynonymRule(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor descriptor) => descriptor.Instance; /// /// @@ -64,10 +141,10 @@ public SynonymRuleDescriptor() : base() /// If you do not specify a synonym rule ID when you create a rule, an identifier is created automatically by Elasticsearch. /// /// - public SynonymRuleDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + public Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor Id(Elastic.Clients.Elasticsearch.Id? value) { - IdValue = id; - return Self; + Instance.Id = value; + return this; } /// @@ -75,23 +152,17 @@ public SynonymRuleDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) /// The synonyms that conform the synonym rule in Solr format. /// /// - public SynonymRuleDescriptor Synonyms(string synonyms) + public Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor Synonyms(string value) { - SynonymsValue = synonyms; - return Self; + Instance.Synonyms = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Synonyms.SynonymRule Build(System.Action action) { - writer.WriteStartObject(); - if (IdValue is not null) - { - writer.WritePropertyName("id"); - JsonSerializer.Serialize(writer, IdValue, options); - } - - writer.WritePropertyName("synonyms"); - writer.WriteStringValue(SynonymsValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleDescriptor(new Elastic.Clients.Elasticsearch.Synonyms.SynonymRule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRuleRead.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRuleRead.g.cs index 2161b1d30d7..4f722a08dca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRuleRead.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymRuleRead.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; +internal sealed partial class SynonymRuleReadConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropSynonyms = System.Text.Json.JsonEncodedText.Encode("synonyms"); + + public override Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleRead Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propId = default; + LocalJsonValue propSynonyms = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propSynonyms.TryReadProperty(ref reader, options, PropSynonyms, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Id = propId.Value, + Synonyms = propSynonyms.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleRead value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropSynonyms, value.Synonyms, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.SynonymRuleReadConverter))] public sealed partial class SynonymRuleRead { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymRuleRead(string id, string synonyms) + { + Id = id; + Synonyms = synonyms; + } +#if NET7_0_OR_GREATER + public SynonymRuleRead() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SynonymRuleRead() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SynonymRuleRead(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Synonym Rule identifier /// /// - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } /// /// /// Synonyms, in Solr format, that conform the synonym rule. See https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2 /// /// - [JsonInclude, JsonPropertyName("synonyms")] - public string Synonyms { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string Synonyms { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymsSetItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymsSetItem.g.cs index 520b247c814..01fd43c2345 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymsSetItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Synonyms/SynonymsSetItem.g.cs @@ -17,31 +17,105 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Synonyms; +internal sealed partial class SynonymsSetItemConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropSynonymsSet = System.Text.Json.JsonEncodedText.Encode("synonyms_set"); + + public override Elastic.Clients.Elasticsearch.Synonyms.SynonymsSetItem Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propSynonymsSet = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propSynonymsSet.TryReadProperty(ref reader, options, PropSynonymsSet, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Synonyms.SynonymsSetItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + SynonymsSet = propSynonymsSet.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Synonyms.SynonymsSetItem value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropSynonymsSet, value.SynonymsSet, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Synonyms.SynonymsSetItemConverter))] public sealed partial class SynonymsSetItem { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SynonymsSetItem(int count, string synonymsSet) + { + Count = count; + SynonymsSet = synonymsSet; + } +#if NET7_0_OR_GREATER + public SynonymsSetItem() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SynonymsSetItem() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SynonymsSetItem(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Number of synonym rules that the synonym set contains /// /// - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } /// /// /// Synonyms set identifier /// /// - [JsonInclude, JsonPropertyName("synonyms_set")] - public string SynonymsSet { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + string SynonymsSet { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TaskFailure.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TaskFailure.g.cs index 80b25b47fa1..e7ba59e7be4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TaskFailure.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TaskFailure.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TaskFailureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNodeId = System.Text.Json.JsonEncodedText.Encode("node_id"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropTaskId = System.Text.Json.JsonEncodedText.Encode("task_id"); + + public override Elastic.Clients.Elasticsearch.TaskFailure Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNodeId = default; + LocalJsonValue propReason = default; + LocalJsonValue propStatus = default; + LocalJsonValue propTaskId = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNodeId.TryReadProperty(ref reader, options, PropNodeId, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propTaskId.TryReadProperty(ref reader, options, PropTaskId, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TaskFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NodeId = propNodeId.Value, + Reason = propReason.Value, + Status = propStatus.Value, + TaskId = propTaskId.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TaskFailure value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNodeId, value.NodeId, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropTaskId, value.TaskId, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TaskFailureConverter))] public sealed partial class TaskFailure { - [JsonInclude, JsonPropertyName("node_id")] - public string NodeId { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public Elastic.Clients.Elasticsearch.ErrorCause Reason { get; init; } - [JsonInclude, JsonPropertyName("status")] - public string Status { get; init; } - [JsonInclude, JsonPropertyName("task_id")] - public long TaskId { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TaskFailure(string nodeId, Elastic.Clients.Elasticsearch.ErrorCause reason, string status, long taskId) + { + NodeId = nodeId; + Reason = reason; + Status = status; + TaskId = taskId; + } +#if NET7_0_OR_GREATER + public TaskFailure() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TaskFailure() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TaskFailure(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string NodeId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.ErrorCause Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TaskId { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/NodeTasks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/NodeTasks.g.cs index a7d91837797..016ef62d1e9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/NodeTasks.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/NodeTasks.g.cs @@ -17,30 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; +internal sealed partial class NodeTasksConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAttributes = System.Text.Json.JsonEncodedText.Encode("attributes"); + private static readonly System.Text.Json.JsonEncodedText PropHost = System.Text.Json.JsonEncodedText.Encode("host"); + private static readonly System.Text.Json.JsonEncodedText PropIp = System.Text.Json.JsonEncodedText.Encode("ip"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropTasks = System.Text.Json.JsonEncodedText.Encode("tasks"); + private static readonly System.Text.Json.JsonEncodedText PropTransportAddress = System.Text.Json.JsonEncodedText.Encode("transport_address"); + + public override Elastic.Clients.Elasticsearch.Tasks.NodeTasks Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAttributes = default; + LocalJsonValue propHost = default; + LocalJsonValue propIp = default; + LocalJsonValue propName = default; + LocalJsonValue?> propRoles = default; + LocalJsonValue> propTasks = default; + LocalJsonValue propTransportAddress = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAttributes.TryReadProperty(ref reader, options, PropAttributes, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propHost.TryReadProperty(ref reader, options, PropHost, null)) + { + continue; + } + + if (propIp.TryReadProperty(ref reader, options, PropIp, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propTasks.TryReadProperty(ref reader, options, PropTasks, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTransportAddress.TryReadProperty(ref reader, options, PropTransportAddress, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.NodeTasks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Attributes = propAttributes.Value, + Host = propHost.Value, + Ip = propIp.Value, + Name = propName.Value, + Roles = propRoles.Value, + Tasks = propTasks.Value, + TransportAddress = propTransportAddress.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.NodeTasks value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAttributes, value.Attributes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropHost, value.Host, null, null); + writer.WriteProperty(options, PropIp, value.Ip, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropRoles, value.Roles, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropTasks, value.Tasks, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTransportAddress, value.TransportAddress, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.NodeTasksConverter))] public sealed partial class NodeTasks { - [JsonInclude, JsonPropertyName("attributes")] - public IReadOnlyDictionary? Attributes { get; init; } - [JsonInclude, JsonPropertyName("host")] - public string? Host { get; init; } - [JsonInclude, JsonPropertyName("ip")] - public string? Ip { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string? Name { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public IReadOnlyCollection? Roles { get; init; } - [JsonInclude, JsonPropertyName("tasks")] - public IReadOnlyDictionary Tasks { get; init; } - [JsonInclude, JsonPropertyName("transport_address")] - public string? TransportAddress { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NodeTasks(System.Collections.Generic.IReadOnlyDictionary tasks) + { + Tasks = tasks; + } +#if NET7_0_OR_GREATER + public NodeTasks() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NodeTasks() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NodeTasks(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Attributes { get; set; } + public string? Host { get; set; } + public string? Ip { get; set; } + public string? Name { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Tasks { get; set; } + public string? TransportAddress { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/ParentTaskInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/ParentTaskInfo.g.cs index 7a5aee91b59..840375157f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/ParentTaskInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/ParentTaskInfo.g.cs @@ -17,26 +17,212 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; +internal sealed partial class ParentTaskInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropCancellable = System.Text.Json.JsonEncodedText.Encode("cancellable"); + private static readonly System.Text.Json.JsonEncodedText PropCancelled = System.Text.Json.JsonEncodedText.Encode("cancelled"); + private static readonly System.Text.Json.JsonEncodedText PropChildren = System.Text.Json.JsonEncodedText.Encode("children"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropParentTaskId = System.Text.Json.JsonEncodedText.Encode("parent_task_id"); + private static readonly System.Text.Json.JsonEncodedText PropRunningTime = System.Text.Json.JsonEncodedText.Encode("running_time"); + private static readonly System.Text.Json.JsonEncodedText PropRunningTimeInNanos = System.Text.Json.JsonEncodedText.Encode("running_time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propCancellable = default; + LocalJsonValue propCancelled = default; + LocalJsonValue?> propChildren = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propHeaders = default; + LocalJsonValue propId = default; + LocalJsonValue propNode = default; + LocalJsonValue propParentTaskId = default; + LocalJsonValue propRunningTime = default; + LocalJsonValue propRunningTimeInNanos = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propStatus = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propCancellable.TryReadProperty(ref reader, options, PropCancellable, null)) + { + continue; + } + + if (propCancelled.TryReadProperty(ref reader, options, PropCancelled, null)) + { + continue; + } + + if (propChildren.TryReadProperty(ref reader, options, PropChildren, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propParentTaskId.TryReadProperty(ref reader, options, PropParentTaskId, null)) + { + continue; + } + + if (propRunningTime.TryReadProperty(ref reader, options, PropRunningTime, null)) + { + continue; + } + + if (propRunningTimeInNanos.TryReadProperty(ref reader, options, PropRunningTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Cancellable = propCancellable.Value, + Cancelled = propCancelled.Value, + Children = propChildren.Value, + Description = propDescription.Value, + Headers = propHeaders.Value, + Id = propId.Value, + Node = propNode.Value, + ParentTaskId = propParentTaskId.Value, + RunningTime = propRunningTime.Value, + RunningTimeInNanos = propRunningTimeInNanos.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + Status = propStatus.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropCancellable, value.Cancellable, null, null); + writer.WriteProperty(options, PropCancelled, value.Cancelled, null, null); + writer.WriteProperty(options, PropChildren, value.Children, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropParentTaskId, value.ParentTaskId, null, null); + writer.WriteProperty(options, PropRunningTime, value.RunningTime, null, null); + writer.WriteProperty(options, PropRunningTimeInNanos, value.RunningTimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.ParentTaskInfoConverter))] public sealed partial class ParentTaskInfo { - [JsonInclude, JsonPropertyName("action")] - public string Action { get; init; } - [JsonInclude, JsonPropertyName("cancellable")] - public bool Cancellable { get; init; } - [JsonInclude, JsonPropertyName("cancelled")] - public bool? Cancelled { get; init; } - [JsonInclude, JsonPropertyName("children")] - public IReadOnlyCollection? Children { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ParentTaskInfo(string action, bool cancellable, System.Collections.Generic.IReadOnlyDictionary headers, long id, string node, System.TimeSpan runningTimeInNanos, System.DateTimeOffset startTimeInMillis, string type) + { + Action = action; + Cancellable = cancellable; + Headers = headers; + Id = id; + Node = node; + RunningTimeInNanos = runningTimeInNanos; + StartTimeInMillis = startTimeInMillis; + Type = type; + } +#if NET7_0_OR_GREATER + public ParentTaskInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public ParentTaskInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal ParentTaskInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Action { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Cancellable { get; set; } + public bool? Cancelled { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Children { get; set; } /// /// @@ -46,22 +232,34 @@ public sealed partial class ParentTaskInfo /// Many requests will have only an empty description because more detailed information about the request is not easily available or particularly helpful in identifying the request. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("headers")] - public IReadOnlyDictionary Headers { get; init; } - [JsonInclude, JsonPropertyName("id")] - public long Id { get; init; } - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("parent_task_id")] - public Elastic.Clients.Elasticsearch.TaskId? ParentTaskId { get; init; } - [JsonInclude, JsonPropertyName("running_time")] - public Elastic.Clients.Elasticsearch.Duration? RunningTime { get; init; } - [JsonInclude, JsonPropertyName("running_time_in_nanos")] - public long RunningTimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Headers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? ParentTaskId { get; set; } + public Elastic.Clients.Elasticsearch.Duration? RunningTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RunningTimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } /// /// @@ -71,8 +269,10 @@ public sealed partial class ParentTaskInfo /// Fields might be removed from the status for a particular request so any parsing you do of the status might break in minor releases. /// /// - [JsonInclude, JsonPropertyName("status")] - public object? Status { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public object? Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfo.g.cs index a07febde4e8..80fd06c5dfd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfo.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfo.g.cs @@ -17,24 +17,202 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; +internal sealed partial class TaskInfoConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropCancellable = System.Text.Json.JsonEncodedText.Encode("cancellable"); + private static readonly System.Text.Json.JsonEncodedText PropCancelled = System.Text.Json.JsonEncodedText.Encode("cancelled"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropParentTaskId = System.Text.Json.JsonEncodedText.Encode("parent_task_id"); + private static readonly System.Text.Json.JsonEncodedText PropRunningTime = System.Text.Json.JsonEncodedText.Encode("running_time"); + private static readonly System.Text.Json.JsonEncodedText PropRunningTimeInNanos = System.Text.Json.JsonEncodedText.Encode("running_time_in_nanos"); + private static readonly System.Text.Json.JsonEncodedText PropStartTimeInMillis = System.Text.Json.JsonEncodedText.Encode("start_time_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.Tasks.TaskInfo Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAction = default; + LocalJsonValue propCancellable = default; + LocalJsonValue propCancelled = default; + LocalJsonValue propDescription = default; + LocalJsonValue> propHeaders = default; + LocalJsonValue propId = default; + LocalJsonValue propNode = default; + LocalJsonValue propParentTaskId = default; + LocalJsonValue propRunningTime = default; + LocalJsonValue propRunningTimeInNanos = default; + LocalJsonValue propStartTimeInMillis = default; + LocalJsonValue propStatus = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, null)) + { + continue; + } + + if (propCancellable.TryReadProperty(ref reader, options, PropCancellable, null)) + { + continue; + } + + if (propCancelled.TryReadProperty(ref reader, options, PropCancelled, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propParentTaskId.TryReadProperty(ref reader, options, PropParentTaskId, null)) + { + continue; + } + + if (propRunningTime.TryReadProperty(ref reader, options, PropRunningTime, null)) + { + continue; + } + + if (propRunningTimeInNanos.TryReadProperty(ref reader, options, PropRunningTimeInNanos, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker)))) + { + continue; + } + + if (propStartTimeInMillis.TryReadProperty(ref reader, options, PropStartTimeInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Tasks.TaskInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Cancellable = propCancellable.Value, + Cancelled = propCancelled.Value, + Description = propDescription.Value, + Headers = propHeaders.Value, + Id = propId.Value, + Node = propNode.Value, + ParentTaskId = propParentTaskId.Value, + RunningTime = propRunningTime.Value, + RunningTimeInNanos = propRunningTimeInNanos.Value, + StartTimeInMillis = propStartTimeInMillis.Value, + Status = propStatus.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.TaskInfo value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, null); + writer.WriteProperty(options, PropCancellable, value.Cancellable, null, null); + writer.WriteProperty(options, PropCancelled, value.Cancelled, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropParentTaskId, value.ParentTaskId, null, null); + writer.WriteProperty(options, PropRunningTime, value.RunningTime, null, null); + writer.WriteProperty(options, PropRunningTimeInNanos, value.RunningTimeInNanos, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanNanosMarker))); + writer.WriteProperty(options, PropStartTimeInMillis, value.StartTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.TaskInfoConverter))] public sealed partial class TaskInfo { - [JsonInclude, JsonPropertyName("action")] - public string Action { get; init; } - [JsonInclude, JsonPropertyName("cancellable")] - public bool Cancellable { get; init; } - [JsonInclude, JsonPropertyName("cancelled")] - public bool? Cancelled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TaskInfo(string action, bool cancellable, System.Collections.Generic.IReadOnlyDictionary headers, long id, string node, System.TimeSpan runningTimeInNanos, System.DateTimeOffset startTimeInMillis, string type) + { + Action = action; + Cancellable = cancellable; + Headers = headers; + Id = id; + Node = node; + RunningTimeInNanos = runningTimeInNanos; + StartTimeInMillis = startTimeInMillis; + Type = type; + } +#if NET7_0_OR_GREATER + public TaskInfo() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TaskInfo() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TaskInfo(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Action { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Cancellable { get; set; } + public bool? Cancelled { get; set; } /// /// @@ -44,22 +222,34 @@ public sealed partial class TaskInfo /// Many requests will have only an empty description because more detailed information about the request is not easily available or particularly helpful in identifying the request. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("headers")] - public IReadOnlyDictionary Headers { get; init; } - [JsonInclude, JsonPropertyName("id")] - public long Id { get; init; } - [JsonInclude, JsonPropertyName("node")] - public string Node { get; init; } - [JsonInclude, JsonPropertyName("parent_task_id")] - public Elastic.Clients.Elasticsearch.TaskId? ParentTaskId { get; init; } - [JsonInclude, JsonPropertyName("running_time")] - public Elastic.Clients.Elasticsearch.Duration? RunningTime { get; init; } - [JsonInclude, JsonPropertyName("running_time_in_nanos")] - public long RunningTimeInNanos { get; init; } - [JsonInclude, JsonPropertyName("start_time_in_millis")] - public long StartTimeInMillis { get; init; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Headers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Id { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Node { get; set; } + public Elastic.Clients.Elasticsearch.TaskId? ParentTaskId { get; set; } + public Elastic.Clients.Elasticsearch.Duration? RunningTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan RunningTimeInNanos { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset StartTimeInMillis { get; set; } /// /// @@ -69,8 +259,10 @@ public sealed partial class TaskInfo /// Fields might be removed from the status for a particular request so any parsing you do of the status might break in minor releases. /// /// - [JsonInclude, JsonPropertyName("status")] - public object? Status { get; init; } - [JsonInclude, JsonPropertyName("type")] - public string Type { get; init; } + public object? Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs index 2edf37ad483..337cbc3d1e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs @@ -17,26 +17,58 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Tasks; -public sealed partial class TaskInfos : Union, IReadOnlyDictionary> +internal sealed partial class TaskInfosConverter : System.Text.Json.Serialization.JsonConverter +{ + public override Elastic.Clients.Elasticsearch.Tasks.TaskInfos Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + var selector = static (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => JsonUnionSelector.ByTokenType(ref r, o, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartArray, Elastic.Clients.Elasticsearch.Serialization.JsonTokenTypes.StartObject); + return selector(ref reader, options) switch + { + Elastic.Clients.Elasticsearch.UnionTag.T1 => new Elastic.Clients.Elasticsearch.Tasks.TaskInfos(reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)), + Elastic.Clients.Elasticsearch.UnionTag.T2 => new Elastic.Clients.Elasticsearch.Tasks.TaskInfos(reader.ReadValue>(options, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)), + _ => throw new System.InvalidOperationException($"Failed to select a union variant for type '{nameof(Elastic.Clients.Elasticsearch.Tasks.TaskInfos)}") + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Tasks.TaskInfos value, System.Text.Json.JsonSerializerOptions options) + { + switch (value.Tag) + { + case Elastic.Clients.Elasticsearch.UnionTag.T1: + { + writer.WriteValue(options, value.Value1, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + break; + } + + case Elastic.Clients.Elasticsearch.UnionTag.T2: + { + writer.WriteValue(options, value.Value2, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + break; + } + + default: + throw new System.InvalidOperationException($"Unrecognized tag value: {value.Tag}"); + } + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Tasks.TaskInfosConverter))] +public sealed partial class TaskInfos : Elastic.Clients.Elasticsearch.Union, System.Collections.Generic.IReadOnlyDictionary> { - public TaskInfos(IReadOnlyCollection Flat) : base(Flat) + public TaskInfos(System.Collections.Generic.IReadOnlyCollection value) : base(value) { } - public TaskInfos(IReadOnlyDictionary Grouped) : base(Grouped) + public TaskInfos(System.Collections.Generic.IReadOnlyDictionary value) : base(value) { } + + public static implicit operator Elastic.Clients.Elasticsearch.Tasks.TaskInfos(Elastic.Clients.Elasticsearch.Tasks.TaskInfo[] value) => new Elastic.Clients.Elasticsearch.Tasks.TaskInfos(value); + public static implicit operator Elastic.Clients.Elasticsearch.Tasks.TaskInfos(System.Collections.Generic.Dictionary value) => new Elastic.Clients.Elasticsearch.Tasks.TaskInfos(value); } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextEmbedding.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextEmbedding.g.cs index c5af95d55f3..3e5bba2a877 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextEmbedding.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextEmbedding.g.cs @@ -17,56 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TextEmbeddingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropModelId = System.Text.Json.JsonEncodedText.Encode("model_id"); + private static readonly System.Text.Json.JsonEncodedText PropModelText = System.Text.Json.JsonEncodedText.Encode("model_text"); + + public override Elastic.Clients.Elasticsearch.TextEmbedding Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propModelId = default; + LocalJsonValue propModelText = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propModelId.TryReadProperty(ref reader, options, PropModelId, null)) + { + continue; + } + + if (propModelText.TryReadProperty(ref reader, options, PropModelText, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextEmbedding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ModelId = propModelId.Value, + ModelText = propModelText.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextEmbedding value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropModelId, value.ModelId, null, null); + writer.WriteProperty(options, PropModelText, value.ModelText, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextEmbeddingConverter))] public sealed partial class TextEmbedding { - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; set; } - [JsonInclude, JsonPropertyName("model_text")] - public string ModelText { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbedding(string modelId, string modelText) + { + ModelId = modelId; + ModelText = modelText; + } +#if NET7_0_OR_GREATER + public TextEmbedding() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextEmbedding() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextEmbedding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } - public static implicit operator Elastic.Clients.Elasticsearch.QueryVectorBuilder(TextEmbedding textEmbedding) => Elastic.Clients.Elasticsearch.QueryVectorBuilder.TextEmbedding(textEmbedding); + public +#if NET7_0_OR_GREATER + required +#endif + string ModelId { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string ModelText { get; set; } } -public sealed partial class TextEmbeddingDescriptor : SerializableDescriptor +public readonly partial struct TextEmbeddingDescriptor { - internal TextEmbeddingDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextEmbedding Instance { get; init; } - public TextEmbeddingDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingDescriptor(Elastic.Clients.Elasticsearch.TextEmbedding instance) { + Instance = instance; } - private string ModelIdValue { get; set; } - private string ModelTextValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextEmbeddingDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TextEmbedding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public TextEmbeddingDescriptor ModelId(string modelId) + public static explicit operator Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor(Elastic.Clients.Elasticsearch.TextEmbedding instance) => new Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextEmbedding(Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor ModelId(string value) { - ModelIdValue = modelId; - return Self; + Instance.ModelId = value; + return this; } - public TextEmbeddingDescriptor ModelText(string modelText) + public Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor ModelText(string value) { - ModelTextValue = modelText; - return Self; + Instance.ModelText = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextEmbedding Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("model_id"); - writer.WriteStringValue(ModelIdValue); - writer.WritePropertyName("model_text"); - writer.WriteStringValue(ModelTextValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TextEmbeddingDescriptor(new Elastic.Clients.Elasticsearch.TextEmbedding(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextSimilarityReranker.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextSimilarityReranker.g.cs index 95ea8843489..ec5f68359d5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextSimilarityReranker.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextSimilarityReranker.g.cs @@ -17,24 +17,135 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TextSimilarityRerankerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropFilter = System.Text.Json.JsonEncodedText.Encode("filter"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceId = System.Text.Json.JsonEncodedText.Encode("inference_id"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceText = System.Text.Json.JsonEncodedText.Encode("inference_text"); + private static readonly System.Text.Json.JsonEncodedText PropMinScore = System.Text.Json.JsonEncodedText.Encode("min_score"); + private static readonly System.Text.Json.JsonEncodedText PropRankWindowSize = System.Text.Json.JsonEncodedText.Encode("rank_window_size"); + private static readonly System.Text.Json.JsonEncodedText PropRetriever = System.Text.Json.JsonEncodedText.Encode("retriever"); + + public override Elastic.Clients.Elasticsearch.TextSimilarityReranker Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue?> propFilter = default; + LocalJsonValue propInferenceId = default; + LocalJsonValue propInferenceText = default; + LocalJsonValue propMinScore = default; + LocalJsonValue propRankWindowSize = default; + LocalJsonValue propRetriever = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propFilter.TryReadProperty(ref reader, options, PropFilter, static System.Collections.Generic.ICollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadSingleOrManyCollectionValue(o, null))) + { + continue; + } + + if (propInferenceId.TryReadProperty(ref reader, options, PropInferenceId, null)) + { + continue; + } + + if (propInferenceText.TryReadProperty(ref reader, options, PropInferenceText, null)) + { + continue; + } + + if (propMinScore.TryReadProperty(ref reader, options, PropMinScore, null)) + { + continue; + } + + if (propRankWindowSize.TryReadProperty(ref reader, options, PropRankWindowSize, null)) + { + continue; + } + + if (propRetriever.TryReadProperty(ref reader, options, PropRetriever, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + Filter = propFilter.Value, + InferenceId = propInferenceId.Value, + InferenceText = propInferenceText.Value, + MinScore = propMinScore.Value, + RankWindowSize = propRankWindowSize.Value, + Retriever = propRetriever.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextSimilarityReranker value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropFilter, value.Filter, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.ICollection? v) => w.WriteSingleOrManyCollectionValue(o, v, null)); + writer.WriteProperty(options, PropInferenceId, value.InferenceId, null, null); + writer.WriteProperty(options, PropInferenceText, value.InferenceText, null, null); + writer.WriteProperty(options, PropMinScore, value.MinScore, null, null); + writer.WriteProperty(options, PropRankWindowSize, value.RankWindowSize, null, null); + writer.WriteProperty(options, PropRetriever, value.Retriever, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextSimilarityRerankerConverter))] public sealed partial class TextSimilarityReranker { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextSimilarityReranker(Elastic.Clients.Elasticsearch.Retriever retriever) + { + Retriever = retriever; + } +#if NET7_0_OR_GREATER + public TextSimilarityReranker() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TextSimilarityReranker() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text /// /// - [JsonInclude, JsonPropertyName("field")] public string? Field { get; set; } /// @@ -42,16 +153,13 @@ public sealed partial class TextSimilarityReranker /// Query to filter the documents that can match. /// /// - [JsonInclude, JsonPropertyName("filter")] - [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.QueryDsl.Query))] - public ICollection? Filter { get; set; } + public System.Collections.Generic.ICollection? Filter { get; set; } /// /// /// Unique identifier of the inference endpoint created using the inference API. /// /// - [JsonInclude, JsonPropertyName("inference_id")] public string? InferenceId { get; set; } /// @@ -59,7 +167,6 @@ public sealed partial class TextSimilarityReranker /// The text snippet used as the basis for similarity comparison /// /// - [JsonInclude, JsonPropertyName("inference_text")] public string? InferenceText { get; set; } /// @@ -67,7 +174,6 @@ public sealed partial class TextSimilarityReranker /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - [JsonInclude, JsonPropertyName("min_score")] public float? MinScore { get; set; } /// @@ -75,7 +181,6 @@ public sealed partial class TextSimilarityReranker /// This value determines how many documents we will consider from the nested retriever. /// /// - [JsonInclude, JsonPropertyName("rank_window_size")] public int? RankWindowSize { get; set; } /// @@ -83,42 +188,41 @@ public sealed partial class TextSimilarityReranker /// The nested retriever which will produce the first-level results, that will later be used for reranking. /// /// - [JsonInclude, JsonPropertyName("retriever")] - public Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.Retriever(TextSimilarityReranker textSimilarityReranker) => Elastic.Clients.Elasticsearch.Retriever.TextSimilarityReranker(textSimilarityReranker); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; } } -public sealed partial class TextSimilarityRerankerDescriptor : SerializableDescriptor> +public readonly partial struct TextSimilarityRerankerDescriptor { - internal TextSimilarityRerankerDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextSimilarityReranker Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextSimilarityRerankerDescriptor(Elastic.Clients.Elasticsearch.TextSimilarityReranker instance) + { + Instance = instance; + } - public TextSimilarityRerankerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextSimilarityRerankerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action> FilterDescriptorAction { get; set; } - private Action>[] FilterDescriptorActions { get; set; } - private string? InferenceIdValue { get; set; } - private string? InferenceTextValue { get; set; } - private float? MinScoreValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Retriever RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action> RetrieverDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(Elastic.Clients.Elasticsearch.TextSimilarityReranker instance) => new Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor descriptor) => descriptor.Instance; /// /// /// The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text /// /// - public TextSimilarityRerankerDescriptor Field(string? field) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Field(string? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -126,40 +230,38 @@ public TextSimilarityRerankerDescriptor Field(string? field) /// Query to filter the documents that can match. /// /// - public TextSimilarityRerankerDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public TextSimilarityRerankerDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public TextSimilarityRerankerDescriptor Filter(Action> configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; - } + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } - public TextSimilarityRerankerDescriptor Filter(params Action>[] configure) - { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + Instance.Filter = items; + return this; } /// @@ -167,10 +269,10 @@ public TextSimilarityRerankerDescriptor Filter(params Action /// - public TextSimilarityRerankerDescriptor InferenceId(string? inferenceId) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor InferenceId(string? value) { - InferenceIdValue = inferenceId; - return Self; + Instance.InferenceId = value; + return this; } /// @@ -178,10 +280,10 @@ public TextSimilarityRerankerDescriptor InferenceId(string? inference /// The text snippet used as the basis for similarity comparison /// /// - public TextSimilarityRerankerDescriptor InferenceText(string? inferenceText) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor InferenceText(string? value) { - InferenceTextValue = inferenceText; - return Self; + Instance.InferenceText = value; + return this; } /// @@ -189,10 +291,10 @@ public TextSimilarityRerankerDescriptor InferenceText(string? inferen /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public TextSimilarityRerankerDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -200,10 +302,10 @@ public TextSimilarityRerankerDescriptor MinScore(float? minScore) /// This value determines how many documents we will consider from the nested retriever. /// /// - public TextSimilarityRerankerDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -211,142 +313,60 @@ public TextSimilarityRerankerDescriptor RankWindowSize(int? rankWindo /// The nested retriever which will produce the first-level results, that will later be used for reranking. /// /// - public TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever retriever) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.Retriever = value; + return this; } - public TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + /// + /// + /// The nested retriever which will produce the first-level results, that will later be used for reranking. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Retriever(System.Action> action) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - public TextSimilarityRerankerDescriptor Retriever(Action> configure) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextSimilarityReranker Build(System.Action> action) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FieldValue)) - { - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (!string.IsNullOrEmpty(InferenceIdValue)) - { - writer.WritePropertyName("inference_id"); - writer.WriteStringValue(InferenceIdValue); - } - - if (!string.IsNullOrEmpty(InferenceTextValue)) - { - writer.WritePropertyName("inference_text"); - writer.WriteStringValue(InferenceTextValue); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(new Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TextSimilarityRerankerDescriptor : SerializableDescriptor +public readonly partial struct TextSimilarityRerankerDescriptor { - internal TextSimilarityRerankerDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TextSimilarityReranker Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextSimilarityRerankerDescriptor(Elastic.Clients.Elasticsearch.TextSimilarityReranker instance) + { + Instance = instance; + } - public TextSimilarityRerankerDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TextSimilarityRerankerDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private string? FieldValue { get; set; } - private ICollection? FilterValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } - private Action FilterDescriptorAction { get; set; } - private Action[] FilterDescriptorActions { get; set; } - private string? InferenceIdValue { get; set; } - private string? InferenceTextValue { get; set; } - private float? MinScoreValue { get; set; } - private int? RankWindowSizeValue { get; set; } - private Elastic.Clients.Elasticsearch.Retriever RetrieverValue { get; set; } - private Elastic.Clients.Elasticsearch.RetrieverDescriptor RetrieverDescriptor { get; set; } - private Action RetrieverDescriptorAction { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(Elastic.Clients.Elasticsearch.TextSimilarityReranker instance) => new Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor descriptor) => descriptor.Instance; /// /// /// The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text /// /// - public TextSimilarityRerankerDescriptor Field(string? field) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Field(string? value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -354,40 +374,55 @@ public TextSimilarityRerankerDescriptor Field(string? field) /// Query to filter the documents that can match. /// /// - public TextSimilarityRerankerDescriptor Filter(ICollection? filter) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(System.Collections.Generic.ICollection? value) { - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterValue = filter; - return Self; + Instance.Filter = value; + return this; } - public TextSimilarityRerankerDescriptor Filter(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(params Elastic.Clients.Elasticsearch.QueryDsl.Query[] values) { - FilterValue = null; - FilterDescriptorAction = null; - FilterDescriptorActions = null; - FilterDescriptor = descriptor; - return Self; + Instance.Filter = [.. values]; + return this; } - public TextSimilarityRerankerDescriptor Filter(Action configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(params System.Action[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorActions = null; - FilterDescriptorAction = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } - public TextSimilarityRerankerDescriptor Filter(params Action[] configure) + /// + /// + /// Query to filter the documents that can match. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Filter(params System.Action>[] actions) { - FilterValue = null; - FilterDescriptor = null; - FilterDescriptorAction = null; - FilterDescriptorActions = configure; - return Self; + var items = new System.Collections.Generic.List(); + foreach (var action in actions) + { + items.Add(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action)); + } + + Instance.Filter = items; + return this; } /// @@ -395,10 +430,10 @@ public TextSimilarityRerankerDescriptor Filter(params Action /// - public TextSimilarityRerankerDescriptor InferenceId(string? inferenceId) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor InferenceId(string? value) { - InferenceIdValue = inferenceId; - return Self; + Instance.InferenceId = value; + return this; } /// @@ -406,10 +441,10 @@ public TextSimilarityRerankerDescriptor InferenceId(string? inferenceId) /// The text snippet used as the basis for similarity comparison /// /// - public TextSimilarityRerankerDescriptor InferenceText(string? inferenceText) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor InferenceText(string? value) { - InferenceTextValue = inferenceText; - return Self; + Instance.InferenceText = value; + return this; } /// @@ -417,10 +452,10 @@ public TextSimilarityRerankerDescriptor InferenceText(string? inferenceText) /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. /// /// - public TextSimilarityRerankerDescriptor MinScore(float? minScore) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor MinScore(float? value) { - MinScoreValue = minScore; - return Self; + Instance.MinScore = value; + return this; } /// @@ -428,10 +463,10 @@ public TextSimilarityRerankerDescriptor MinScore(float? minScore) /// This value determines how many documents we will consider from the nested retriever. /// /// - public TextSimilarityRerankerDescriptor RankWindowSize(int? rankWindowSize) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor RankWindowSize(int? value) { - RankWindowSizeValue = rankWindowSize; - return Self; + Instance.RankWindowSize = value; + return this; } /// @@ -439,108 +474,39 @@ public TextSimilarityRerankerDescriptor RankWindowSize(int? rankWindowSize) /// The nested retriever which will produce the first-level results, that will later be used for reranking. /// /// - public TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever retriever) + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever value) { - RetrieverDescriptor = null; - RetrieverDescriptorAction = null; - RetrieverValue = retriever; - return Self; + Instance.Retriever = value; + return this; } - public TextSimilarityRerankerDescriptor Retriever(Elastic.Clients.Elasticsearch.RetrieverDescriptor descriptor) + /// + /// + /// The nested retriever which will produce the first-level results, that will later be used for reranking. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Retriever(System.Action action) { - RetrieverValue = null; - RetrieverDescriptorAction = null; - RetrieverDescriptor = descriptor; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - public TextSimilarityRerankerDescriptor Retriever(Action configure) + /// + /// + /// The nested retriever which will produce the first-level results, that will later be used for reranking. + /// + /// + public Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor Retriever(System.Action> action) { - RetrieverValue = null; - RetrieverDescriptor = null; - RetrieverDescriptorAction = configure; - return Self; + Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TextSimilarityReranker Build(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(FieldValue)) - { - writer.WritePropertyName("field"); - writer.WriteStringValue(FieldValue); - } - - if (FilterDescriptor is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, FilterDescriptor, options); - } - else if (FilterDescriptorAction is not null) - { - writer.WritePropertyName("filter"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); - } - else if (FilterDescriptorActions is not null) - { - writer.WritePropertyName("filter"); - if (FilterDescriptorActions.Length != 1) - writer.WriteStartArray(); - foreach (var action in FilterDescriptorActions) - { - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(action), options); - } - - if (FilterDescriptorActions.Length != 1) - writer.WriteEndArray(); - } - else if (FilterValue is not null) - { - writer.WritePropertyName("filter"); - SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); - } - - if (!string.IsNullOrEmpty(InferenceIdValue)) - { - writer.WritePropertyName("inference_id"); - writer.WriteStringValue(InferenceIdValue); - } - - if (!string.IsNullOrEmpty(InferenceTextValue)) - { - writer.WritePropertyName("inference_text"); - writer.WriteStringValue(InferenceTextValue); - } - - if (MinScoreValue.HasValue) - { - writer.WritePropertyName("min_score"); - writer.WriteNumberValue(MinScoreValue.Value); - } - - if (RankWindowSizeValue.HasValue) - { - writer.WritePropertyName("rank_window_size"); - writer.WriteNumberValue(RankWindowSizeValue.Value); - } - - if (RetrieverDescriptor is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverDescriptor, options); - } - else if (RetrieverDescriptorAction is not null) - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.RetrieverDescriptor(RetrieverDescriptorAction), options); - } - else - { - writer.WritePropertyName("retriever"); - JsonSerializer.Serialize(writer, RetrieverValue, options); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TextSimilarityRerankerDescriptor(new Elastic.Clients.Elasticsearch.TextSimilarityReranker(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/FieldStat.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/FieldStat.g.cs index 1476c5994f9..a1753e74641 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/FieldStat.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/FieldStat.g.cs @@ -17,34 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; +internal sealed partial class FieldStatConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCardinality = System.Text.Json.JsonEncodedText.Encode("cardinality"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropEarliest = System.Text.Json.JsonEncodedText.Encode("earliest"); + private static readonly System.Text.Json.JsonEncodedText PropLatest = System.Text.Json.JsonEncodedText.Encode("latest"); + private static readonly System.Text.Json.JsonEncodedText PropMaxValue = System.Text.Json.JsonEncodedText.Encode("max_value"); + private static readonly System.Text.Json.JsonEncodedText PropMeanValue = System.Text.Json.JsonEncodedText.Encode("mean_value"); + private static readonly System.Text.Json.JsonEncodedText PropMedianValue = System.Text.Json.JsonEncodedText.Encode("median_value"); + private static readonly System.Text.Json.JsonEncodedText PropMinValue = System.Text.Json.JsonEncodedText.Encode("min_value"); + private static readonly System.Text.Json.JsonEncodedText PropTopHits = System.Text.Json.JsonEncodedText.Encode("top_hits"); + + public override Elastic.Clients.Elasticsearch.TextStructure.FieldStat Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCardinality = default; + LocalJsonValue propCount = default; + LocalJsonValue propEarliest = default; + LocalJsonValue propLatest = default; + LocalJsonValue propMaxValue = default; + LocalJsonValue propMeanValue = default; + LocalJsonValue propMedianValue = default; + LocalJsonValue propMinValue = default; + LocalJsonValue> propTopHits = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCardinality.TryReadProperty(ref reader, options, PropCardinality, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propEarliest.TryReadProperty(ref reader, options, PropEarliest, null)) + { + continue; + } + + if (propLatest.TryReadProperty(ref reader, options, PropLatest, null)) + { + continue; + } + + if (propMaxValue.TryReadProperty(ref reader, options, PropMaxValue, null)) + { + continue; + } + + if (propMeanValue.TryReadProperty(ref reader, options, PropMeanValue, null)) + { + continue; + } + + if (propMedianValue.TryReadProperty(ref reader, options, PropMedianValue, null)) + { + continue; + } + + if (propMinValue.TryReadProperty(ref reader, options, PropMinValue, null)) + { + continue; + } + + if (propTopHits.TryReadProperty(ref reader, options, PropTopHits, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.FieldStat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cardinality = propCardinality.Value, + Count = propCount.Value, + Earliest = propEarliest.Value, + Latest = propLatest.Value, + MaxValue = propMaxValue.Value, + MeanValue = propMeanValue.Value, + MedianValue = propMedianValue.Value, + MinValue = propMinValue.Value, + TopHits = propTopHits.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.FieldStat value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCardinality, value.Cardinality, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropEarliest, value.Earliest, null, null); + writer.WriteProperty(options, PropLatest, value.Latest, null, null); + writer.WriteProperty(options, PropMaxValue, value.MaxValue, null, null); + writer.WriteProperty(options, PropMeanValue, value.MeanValue, null, null); + writer.WriteProperty(options, PropMedianValue, value.MedianValue, null, null); + writer.WriteProperty(options, PropMinValue, value.MinValue, null, null); + writer.WriteProperty(options, PropTopHits, value.TopHits, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.FieldStatConverter))] public sealed partial class FieldStat { - [JsonInclude, JsonPropertyName("cardinality")] - public int Cardinality { get; init; } - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("earliest")] - public string? Earliest { get; init; } - [JsonInclude, JsonPropertyName("latest")] - public string? Latest { get; init; } - [JsonInclude, JsonPropertyName("max_value")] - public int? MaxValue { get; init; } - [JsonInclude, JsonPropertyName("mean_value")] - public int? MeanValue { get; init; } - [JsonInclude, JsonPropertyName("median_value")] - public int? MedianValue { get; init; } - [JsonInclude, JsonPropertyName("min_value")] - public int? MinValue { get; init; } - [JsonInclude, JsonPropertyName("top_hits")] - public IReadOnlyCollection TopHits { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FieldStat(int cardinality, int count, System.Collections.Generic.IReadOnlyCollection topHits) + { + Cardinality = cardinality; + Count = count; + TopHits = topHits; + } +#if NET7_0_OR_GREATER + public FieldStat() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FieldStat() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FieldStat(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Cardinality { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public string? Earliest { get; set; } + public string? Latest { get; set; } + public int? MaxValue { get; set; } + public int? MeanValue { get; set; } + public int? MedianValue { get; set; } + public int? MinValue { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection TopHits { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedField.g.cs index c2ba885d920..1a176428607 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedField.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; +internal sealed partial class MatchedFieldConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropLength = System.Text.Json.JsonEncodedText.Encode("length"); + private static readonly System.Text.Json.JsonEncodedText PropMatch = System.Text.Json.JsonEncodedText.Encode("match"); + private static readonly System.Text.Json.JsonEncodedText PropOffset = System.Text.Json.JsonEncodedText.Encode("offset"); + + public override Elastic.Clients.Elasticsearch.TextStructure.MatchedField Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propLength = default; + LocalJsonValue propMatch = default; + LocalJsonValue propOffset = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propLength.TryReadProperty(ref reader, options, PropLength, null)) + { + continue; + } + + if (propMatch.TryReadProperty(ref reader, options, PropMatch, null)) + { + continue; + } + + if (propOffset.TryReadProperty(ref reader, options, PropOffset, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.MatchedField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Length = propLength.Value, + Match = propMatch.Value, + Offset = propOffset.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.MatchedField value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropLength, value.Length, null, null); + writer.WriteProperty(options, PropMatch, value.Match, null, null); + writer.WriteProperty(options, PropOffset, value.Offset, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.MatchedFieldConverter))] public sealed partial class MatchedField { - [JsonInclude, JsonPropertyName("length")] - public int Length { get; init; } - [JsonInclude, JsonPropertyName("match")] - public string Match { get; init; } - [JsonInclude, JsonPropertyName("offset")] - public int Offset { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchedField(int length, string match, int offset) + { + Length = length; + Match = match; + Offset = offset; + } +#if NET7_0_OR_GREATER + public MatchedField() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MatchedField() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchedField(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Length { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Match { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Offset { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedText.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedText.g.cs index 3b075c8cffd..5149634fdc0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedText.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/MatchedText.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; +internal sealed partial class MatchedTextConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropFields = System.Text.Json.JsonEncodedText.Encode("fields"); + private static readonly System.Text.Json.JsonEncodedText PropMatched = System.Text.Json.JsonEncodedText.Encode("matched"); + + public override Elastic.Clients.Elasticsearch.TextStructure.MatchedText Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue>?> propFields = default; + LocalJsonValue propMatched = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propFields.TryReadProperty(ref reader, options, PropFields, static System.Collections.Generic.IReadOnlyDictionary>? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue>(o, null, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!))) + { + continue; + } + + if (propMatched.TryReadProperty(ref reader, options, PropMatched, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.MatchedText(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Fields = propFields.Value, + Matched = propMatched.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.MatchedText value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropFields, value.Fields, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary>? v) => w.WriteDictionaryValue>(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null))); + writer.WriteProperty(options, PropMatched, value.Matched, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.MatchedTextConverter))] public sealed partial class MatchedText { - [JsonInclude, JsonPropertyName("fields")] - public IReadOnlyDictionary>? Fields { get; init; } - [JsonInclude, JsonPropertyName("matched")] - public bool Matched { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MatchedText(bool matched) + { + Matched = matched; + } +#if NET7_0_OR_GREATER + public MatchedText() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MatchedText() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MatchedText(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary>? Fields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Matched { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/TopHit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/TopHit.g.cs index a2eae50ae63..7d87a7d3592 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/TopHit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TextStructure/TopHit.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TextStructure; +internal sealed partial class TopHitConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropValue = System.Text.Json.JsonEncodedText.Encode("value"); + + public override Elastic.Clients.Elasticsearch.TextStructure.TopHit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propValue = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propValue.TryReadProperty(ref reader, options, PropValue, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TextStructure.TopHit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Value = propValue.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TextStructure.TopHit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropValue, value.Value, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TextStructure.TopHitConverter))] public sealed partial class TopHit { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("value")] - public object Value { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopHit(long count, object value) + { + Count = count; + Value = value; + } +#if NET7_0_OR_GREATER + public TopHit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopHit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopHit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + object Value { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs index b4b6c717942..cfa83af44b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs @@ -17,54 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TopLeftBottomRightGeoBoundsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBottomRight = System.Text.Json.JsonEncodedText.Encode("bottom_right"); + private static readonly System.Text.Json.JsonEncodedText PropTopLeft = System.Text.Json.JsonEncodedText.Encode("top_left"); + + public override Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBottomRight = default; + LocalJsonValue propTopLeft = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBottomRight.TryReadProperty(ref reader, options, PropBottomRight, null)) + { + continue; + } + + if (propTopLeft.TryReadProperty(ref reader, options, PropTopLeft, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BottomRight = propBottomRight.Value, + TopLeft = propTopLeft.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBottomRight, value.BottomRight, null, null); + writer.WriteProperty(options, PropTopLeft, value.TopLeft, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsConverter))] public sealed partial class TopLeftBottomRightGeoBounds { - [JsonInclude, JsonPropertyName("bottom_right")] - public Elastic.Clients.Elasticsearch.GeoLocation BottomRight { get; set; } - [JsonInclude, JsonPropertyName("top_left")] - public Elastic.Clients.Elasticsearch.GeoLocation TopLeft { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.GeoLocation bottomRight, Elastic.Clients.Elasticsearch.GeoLocation topLeft) + { + BottomRight = bottomRight; + TopLeft = topLeft; + } +#if NET7_0_OR_GREATER + public TopLeftBottomRightGeoBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopLeftBottomRightGeoBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation BottomRight { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation TopLeft { get; set; } } -public sealed partial class TopLeftBottomRightGeoBoundsDescriptor : SerializableDescriptor +public readonly partial struct TopLeftBottomRightGeoBoundsDescriptor { - internal TopLeftBottomRightGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopLeftBottomRightGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds instance) + { + Instance = instance; + } - public TopLeftBottomRightGeoBoundsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopLeftBottomRightGeoBoundsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoLocation BottomRightValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation TopLeftValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds instance) => new Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor descriptor) => descriptor.Instance; - public TopLeftBottomRightGeoBoundsDescriptor BottomRight(Elastic.Clients.Elasticsearch.GeoLocation bottomRight) + public Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor BottomRight(Elastic.Clients.Elasticsearch.GeoLocation value) { - BottomRightValue = bottomRight; - return Self; + Instance.BottomRight = value; + return this; } - public TopLeftBottomRightGeoBoundsDescriptor TopLeft(Elastic.Clients.Elasticsearch.GeoLocation topLeft) + public Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor BottomRight(System.Func action) { - TopLeftValue = topLeft; - return Self; + Instance.BottomRight = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor TopLeft(Elastic.Clients.Elasticsearch.GeoLocation value) { - writer.WriteStartObject(); - writer.WritePropertyName("bottom_right"); - JsonSerializer.Serialize(writer, BottomRightValue, options); - writer.WritePropertyName("top_left"); - JsonSerializer.Serialize(writer, TopLeftValue, options); - writer.WriteEndObject(); + Instance.TopLeft = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor TopLeft(System.Func action) + { + Instance.TopLeft = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBoundsDescriptor(new Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs index 4f92bf66e0f..750d71e2b07 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs @@ -17,54 +17,146 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TopRightBottomLeftGeoBoundsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBottomLeft = System.Text.Json.JsonEncodedText.Encode("bottom_left"); + private static readonly System.Text.Json.JsonEncodedText PropTopRight = System.Text.Json.JsonEncodedText.Encode("top_right"); + + public override Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBottomLeft = default; + LocalJsonValue propTopRight = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBottomLeft.TryReadProperty(ref reader, options, PropBottomLeft, null)) + { + continue; + } + + if (propTopRight.TryReadProperty(ref reader, options, PropTopRight, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BottomLeft = propBottomLeft.Value, + TopRight = propTopRight.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBottomLeft, value.BottomLeft, null, null); + writer.WriteProperty(options, PropTopRight, value.TopRight, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsConverter))] public sealed partial class TopRightBottomLeftGeoBounds { - [JsonInclude, JsonPropertyName("bottom_left")] - public Elastic.Clients.Elasticsearch.GeoLocation BottomLeft { get; set; } - [JsonInclude, JsonPropertyName("top_right")] - public Elastic.Clients.Elasticsearch.GeoLocation TopRight { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.GeoLocation bottomLeft, Elastic.Clients.Elasticsearch.GeoLocation topRight) + { + BottomLeft = bottomLeft; + TopRight = topRight; + } +#if NET7_0_OR_GREATER + public TopRightBottomLeftGeoBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TopRightBottomLeftGeoBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation BottomLeft { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.GeoLocation TopRight { get; set; } } -public sealed partial class TopRightBottomLeftGeoBoundsDescriptor : SerializableDescriptor +public readonly partial struct TopRightBottomLeftGeoBoundsDescriptor { - internal TopRightBottomLeftGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopRightBottomLeftGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds instance) + { + Instance = instance; + } - public TopRightBottomLeftGeoBoundsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TopRightBottomLeftGeoBoundsDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.GeoLocation BottomLeftValue { get; set; } - private Elastic.Clients.Elasticsearch.GeoLocation TopRightValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds instance) => new Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor descriptor) => descriptor.Instance; - public TopRightBottomLeftGeoBoundsDescriptor BottomLeft(Elastic.Clients.Elasticsearch.GeoLocation bottomLeft) + public Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor BottomLeft(Elastic.Clients.Elasticsearch.GeoLocation value) { - BottomLeftValue = bottomLeft; - return Self; + Instance.BottomLeft = value; + return this; } - public TopRightBottomLeftGeoBoundsDescriptor TopRight(Elastic.Clients.Elasticsearch.GeoLocation topRight) + public Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor BottomLeft(System.Func action) { - TopRightValue = topRight; - return Self; + Instance.BottomLeft = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor TopRight(Elastic.Clients.Elasticsearch.GeoLocation value) { - writer.WriteStartObject(); - writer.WritePropertyName("bottom_left"); - JsonSerializer.Serialize(writer, BottomLeftValue, options); - writer.WritePropertyName("top_right"); - JsonSerializer.Serialize(writer, TopRightValue, options); - writer.WriteEndObject(); + Instance.TopRight = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor TopRight(System.Func action) + { + Instance.TopRight = Elastic.Clients.Elasticsearch.GeoLocationFactory.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBoundsDescriptor(new Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/CheckpointStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/CheckpointStats.g.cs index f2d241771cc..3685030fc5a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/CheckpointStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/CheckpointStats.g.cs @@ -17,28 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class CheckpointStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCheckpoint = System.Text.Json.JsonEncodedText.Encode("checkpoint"); + private static readonly System.Text.Json.JsonEncodedText PropCheckpointProgress = System.Text.Json.JsonEncodedText.Encode("checkpoint_progress"); + private static readonly System.Text.Json.JsonEncodedText PropTimestamp = System.Text.Json.JsonEncodedText.Encode("timestamp"); + private static readonly System.Text.Json.JsonEncodedText PropTimestampMillis = System.Text.Json.JsonEncodedText.Encode("timestamp_millis"); + private static readonly System.Text.Json.JsonEncodedText PropTimeUpperBound = System.Text.Json.JsonEncodedText.Encode("time_upper_bound"); + private static readonly System.Text.Json.JsonEncodedText PropTimeUpperBoundMillis = System.Text.Json.JsonEncodedText.Encode("time_upper_bound_millis"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCheckpoint = default; + LocalJsonValue propCheckpointProgress = default; + LocalJsonValue propTimestamp = default; + LocalJsonValue propTimestampMillis = default; + LocalJsonValue propTimeUpperBound = default; + LocalJsonValue propTimeUpperBoundMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCheckpoint.TryReadProperty(ref reader, options, PropCheckpoint, null)) + { + continue; + } + + if (propCheckpointProgress.TryReadProperty(ref reader, options, PropCheckpointProgress, null)) + { + continue; + } + + if (propTimestamp.TryReadProperty(ref reader, options, PropTimestamp, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propTimestampMillis.TryReadProperty(ref reader, options, PropTimestampMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propTimeUpperBound.TryReadProperty(ref reader, options, PropTimeUpperBound, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propTimeUpperBoundMillis.TryReadProperty(ref reader, options, PropTimeUpperBoundMillis, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Checkpoint = propCheckpoint.Value, + CheckpointProgress = propCheckpointProgress.Value, + Timestamp = propTimestamp.Value, + TimestampMillis = propTimestampMillis.Value, + TimeUpperBound = propTimeUpperBound.Value, + TimeUpperBoundMillis = propTimeUpperBoundMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCheckpoint, value.Checkpoint, null, null); + writer.WriteProperty(options, PropCheckpointProgress, value.CheckpointProgress, null, null); + writer.WriteProperty(options, PropTimestamp, value.Timestamp, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropTimestampMillis, value.TimestampMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropTimeUpperBound, value.TimeUpperBound, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropTimeUpperBoundMillis, value.TimeUpperBoundMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStatsConverter))] public sealed partial class CheckpointStats { - [JsonInclude, JsonPropertyName("checkpoint")] - public long Checkpoint { get; init; } - [JsonInclude, JsonPropertyName("checkpoint_progress")] - public Elastic.Clients.Elasticsearch.TransformManagement.TransformProgress? CheckpointProgress { get; init; } - [JsonInclude, JsonPropertyName("timestamp")] - public DateTimeOffset? Timestamp { get; init; } - [JsonInclude, JsonPropertyName("timestamp_millis")] - public long? TimestampMillis { get; init; } - [JsonInclude, JsonPropertyName("time_upper_bound")] - public DateTimeOffset? TimeUpperBound { get; init; } - [JsonInclude, JsonPropertyName("time_upper_bound_millis")] - public long? TimeUpperBoundMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CheckpointStats(long checkpoint) + { + Checkpoint = checkpoint; + } +#if NET7_0_OR_GREATER + public CheckpointStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public CheckpointStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal CheckpointStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Checkpoint { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.TransformProgress? CheckpointProgress { get; set; } + public System.DateTimeOffset? Timestamp { get; set; } + public System.DateTimeOffset? TimestampMillis { get; set; } + public System.DateTimeOffset? TimeUpperBound { get; set; } + public System.DateTimeOffset? TimeUpperBoundMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Checkpointing.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Checkpointing.g.cs index 24f858b5113..b6229179118 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Checkpointing.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Checkpointing.g.cs @@ -17,28 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class CheckpointingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropChangesLastDetectedAt = System.Text.Json.JsonEncodedText.Encode("changes_last_detected_at"); + private static readonly System.Text.Json.JsonEncodedText PropChangesLastDetectedAtString = System.Text.Json.JsonEncodedText.Encode("changes_last_detected_at_string"); + private static readonly System.Text.Json.JsonEncodedText PropLast = System.Text.Json.JsonEncodedText.Encode("last"); + private static readonly System.Text.Json.JsonEncodedText PropLastSearchTime = System.Text.Json.JsonEncodedText.Encode("last_search_time"); + private static readonly System.Text.Json.JsonEncodedText PropLastSearchTimeString = System.Text.Json.JsonEncodedText.Encode("last_search_time_string"); + private static readonly System.Text.Json.JsonEncodedText PropNext = System.Text.Json.JsonEncodedText.Encode("next"); + private static readonly System.Text.Json.JsonEncodedText PropOperationsBehind = System.Text.Json.JsonEncodedText.Encode("operations_behind"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propChangesLastDetectedAt = default; + LocalJsonValue propChangesLastDetectedAtString = default; + LocalJsonValue propLast = default; + LocalJsonValue propLastSearchTime = default; + LocalJsonValue propLastSearchTimeString = default; + LocalJsonValue propNext = default; + LocalJsonValue propOperationsBehind = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propChangesLastDetectedAt.TryReadProperty(ref reader, options, PropChangesLastDetectedAt, null)) + { + continue; + } + + if (propChangesLastDetectedAtString.TryReadProperty(ref reader, options, PropChangesLastDetectedAtString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propLast.TryReadProperty(ref reader, options, PropLast, null)) + { + continue; + } + + if (propLastSearchTime.TryReadProperty(ref reader, options, PropLastSearchTime, null)) + { + continue; + } + + if (propLastSearchTimeString.TryReadProperty(ref reader, options, PropLastSearchTimeString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propNext.TryReadProperty(ref reader, options, PropNext, null)) + { + continue; + } + + if (propOperationsBehind.TryReadProperty(ref reader, options, PropOperationsBehind, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ChangesLastDetectedAt = propChangesLastDetectedAt.Value, + ChangesLastDetectedAtString = propChangesLastDetectedAtString.Value, + Last = propLast.Value, + LastSearchTime = propLastSearchTime.Value, + LastSearchTimeString = propLastSearchTimeString.Value, + Next = propNext.Value, + OperationsBehind = propOperationsBehind.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropChangesLastDetectedAt, value.ChangesLastDetectedAt, null, null); + writer.WriteProperty(options, PropChangesLastDetectedAtString, value.ChangesLastDetectedAtString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropLast, value.Last, null, null); + writer.WriteProperty(options, PropLastSearchTime, value.LastSearchTime, null, null); + writer.WriteProperty(options, PropLastSearchTimeString, value.LastSearchTimeString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropNext, value.Next, null, null); + writer.WriteProperty(options, PropOperationsBehind, value.OperationsBehind, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.CheckpointingConverter))] public sealed partial class Checkpointing { - [JsonInclude, JsonPropertyName("changes_last_detected_at")] - public long? ChangesLastDetectedAt { get; init; } - [JsonInclude, JsonPropertyName("changes_last_detected_at_date_time")] - public DateTimeOffset? ChangesLastDetectedAtDateTime { get; init; } - [JsonInclude, JsonPropertyName("last")] - public Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats Last { get; init; } - [JsonInclude, JsonPropertyName("last_search_time")] - public long? LastSearchTime { get; init; } - [JsonInclude, JsonPropertyName("next")] - public Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats? Next { get; init; } - [JsonInclude, JsonPropertyName("operations_behind")] - public long? OperationsBehind { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Checkpointing(Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats last) + { + Last = last; + } +#if NET7_0_OR_GREATER + public Checkpointing() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Checkpointing() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Checkpointing(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? ChangesLastDetectedAt { get; set; } + public System.DateTimeOffset? ChangesLastDetectedAtString { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats Last { get; set; } + public long? LastSearchTime { get; set; } + public System.DateTimeOffset? LastSearchTimeString { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.CheckpointStats? Next { get; set; } + public long? OperationsBehind { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Destination.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Destination.g.cs index 704be64863c..a43feda4ecc 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Destination.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Destination.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class DestinationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Destination Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndex = default; + LocalJsonValue propPipeline = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) + { + continue; + } + + if (propPipeline.TryReadProperty(ref reader, options, PropPipeline, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Index = propIndex.Value, + Pipeline = propPipeline.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Destination value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPipeline, value.Pipeline, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.DestinationConverter))] public sealed partial class Destination { +#if NET7_0_OR_GREATER + public Destination() + { + } +#endif +#if !NET7_0_OR_GREATER + public Destination() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The destination index for the transform. The mappings of the destination index are deduced based on the source @@ -36,7 +97,6 @@ public sealed partial class Destination /// transform. /// /// - [JsonInclude, JsonPropertyName("index")] public Elastic.Clients.Elasticsearch.IndexName? Index { get; set; } /// @@ -44,20 +104,27 @@ public sealed partial class Destination /// The unique identifier for an ingest pipeline. /// /// - [JsonInclude, JsonPropertyName("pipeline")] public string? Pipeline { get; set; } } -public sealed partial class DestinationDescriptor : SerializableDescriptor +public readonly partial struct DestinationDescriptor { - internal DestinationDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Destination Instance { get; init; } - public DestinationDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DestinationDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Destination instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.IndexName? IndexValue { get; set; } - private string? PipelineValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DestinationDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Destination instance) => new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Destination(Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor descriptor) => descriptor.Instance; /// /// @@ -66,10 +133,10 @@ public DestinationDescriptor() : base() /// transform. /// /// - public DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? index) + public Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? value) { - IndexValue = index; - return Self; + Instance.Index = value; + return this; } /// @@ -77,27 +144,22 @@ public DestinationDescriptor Index(Elastic.Clients.Elasticsearch.IndexName? inde /// The unique identifier for an ingest pipeline. /// /// - public DestinationDescriptor Pipeline(string? pipeline) + public Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor Pipeline(string? value) { - PipelineValue = pipeline; - return Self; + Instance.Pipeline = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Destination Build(System.Action? action) { - writer.WriteStartObject(); - if (IndexValue is not null) + if (action is null) { - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndexValue, options); + return new Elastic.Clients.Elasticsearch.TransformManagement.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (!string.IsNullOrEmpty(PipelineValue)) - { - writer.WritePropertyName("pipeline"); - writer.WriteStringValue(PipelineValue); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.DestinationDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Destination(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Latest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Latest.g.cs index 825a95aa3d9..72c8bce9bbf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Latest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Latest.g.cs @@ -17,56 +17,137 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class LatestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSort = System.Text.Json.JsonEncodedText.Encode("sort"); + private static readonly System.Text.Json.JsonEncodedText PropUniqueKey = System.Text.Json.JsonEncodedText.Encode("unique_key"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Latest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSort = default; + LocalJsonValue propUniqueKey = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSort.TryReadProperty(ref reader, options, PropSort, null)) + { + continue; + } + + if (propUniqueKey.TryReadProperty(ref reader, options, PropUniqueKey, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Sort = propSort.Value, + UniqueKey = propUniqueKey.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Latest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSort, value.Sort, null, null); + writer.WriteProperty(options, PropUniqueKey, value.UniqueKey, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.LatestConverter))] public sealed partial class Latest { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Latest(Elastic.Clients.Elasticsearch.Field sort, Elastic.Clients.Elasticsearch.Fields uniqueKey) + { + Sort = sort; + UniqueKey = uniqueKey; + } +#if NET7_0_OR_GREATER + public Latest() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Latest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies the date field that is used to identify the latest documents. /// /// - [JsonInclude, JsonPropertyName("sort")] - public Elastic.Clients.Elasticsearch.Field Sort { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Sort { get; set; } /// /// /// Specifies an array of one or more fields that are used to group the data. /// /// - [JsonInclude, JsonPropertyName("unique_key")] - [JsonConverter(typeof(FieldsConverter))] - public Elastic.Clients.Elasticsearch.Fields UniqueKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Fields UniqueKey { get; set; } } -public sealed partial class LatestDescriptor : SerializableDescriptor> +public readonly partial struct LatestDescriptor { - internal LatestDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Latest Instance { get; init; } - public LatestDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Latest instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields UniqueKeyValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Latest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the date field that is used to identify the latest documents. /// /// - public LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -74,21 +155,21 @@ public LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field sort /// Specifies the date field that is used to identify the latest documents. /// /// - public LatestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Specifies the date field that is used to identify the latest documents. + /// Specifies an array of one or more fields that are used to group the data. /// /// - public LatestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor UniqueKey(Elastic.Clients.Elasticsearch.Fields value) { - SortValue = sort; - return Self; + Instance.UniqueKey = value; + return this; } /// @@ -96,43 +177,49 @@ public LatestDescriptor Sort(Expression> sort /// Specifies an array of one or more fields that are used to group the data. /// /// - public LatestDescriptor UniqueKey(Elastic.Clients.Elasticsearch.Fields uniqueKey) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor UniqueKey(params System.Linq.Expressions.Expression>[] value) { - UniqueKeyValue = uniqueKey; - return Self; + Instance.UniqueKey = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Latest Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - writer.WritePropertyName("unique_key"); - JsonSerializer.Serialize(writer, UniqueKeyValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class LatestDescriptor : SerializableDescriptor +public readonly partial struct LatestDescriptor { - internal LatestDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Latest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Latest instance) + { + Instance = instance; + } - public LatestDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public LatestDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Field SortValue { get; set; } - private Elastic.Clients.Elasticsearch.Fields UniqueKeyValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Latest instance) => new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor descriptor) => descriptor.Instance; /// /// /// Specifies the date field that is used to identify the latest documents. /// /// - public LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// @@ -140,21 +227,21 @@ public LatestDescriptor Sort(Elastic.Clients.Elasticsearch.Field sort) /// Specifies the date field that is used to identify the latest documents. /// /// - public LatestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor Sort(System.Linq.Expressions.Expression> value) { - SortValue = sort; - return Self; + Instance.Sort = value; + return this; } /// /// - /// Specifies the date field that is used to identify the latest documents. + /// Specifies an array of one or more fields that are used to group the data. /// /// - public LatestDescriptor Sort(Expression> sort) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor UniqueKey(Elastic.Clients.Elasticsearch.Fields value) { - SortValue = sort; - return Self; + Instance.UniqueKey = value; + return this; } /// @@ -162,19 +249,17 @@ public LatestDescriptor Sort(Expression> sort /// Specifies an array of one or more fields that are used to group the data. /// /// - public LatestDescriptor UniqueKey(Elastic.Clients.Elasticsearch.Fields uniqueKey) + public Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor UniqueKey(params System.Linq.Expressions.Expression>[] value) { - UniqueKeyValue = uniqueKey; - return Self; + Instance.UniqueKey = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Latest Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("sort"); - JsonSerializer.Serialize(writer, SortValue, options); - writer.WritePropertyName("unique_key"); - JsonSerializer.Serialize(writer, UniqueKeyValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.LatestDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Latest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Pivot.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Pivot.g.cs index 446ea9688d1..0939c57ab1f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Pivot.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Pivot.g.cs @@ -17,67 +17,80 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -internal sealed partial class PivotConverter : JsonConverter +internal sealed partial class PivotConverter : System.Text.Json.Serialization.JsonConverter { - public override Pivot Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly System.Text.Json.JsonEncodedText PropAggregations = System.Text.Json.JsonEncodedText.Encode("aggregations"); + private static readonly System.Text.Json.JsonEncodedText PropAggregations1 = System.Text.Json.JsonEncodedText.Encode("aggs"); + private static readonly System.Text.Json.JsonEncodedText PropGroupBy = System.Text.Json.JsonEncodedText.Encode("group_by"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Pivot Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected JSON detected."); - var variant = new Pivot(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAggregations = default; + LocalJsonValue?> propGroupBy = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (reader.TokenType == JsonTokenType.PropertyName) + if (propAggregations.TryReadProperty(ref reader, options, PropAggregations, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)) || propAggregations.TryReadProperty(ref reader, options, PropAggregations1, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) { - var property = reader.GetString(); - if (property == "aggregations" || property == "aggs") - { - variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } - - if (property == "group_by") - { - variant.GroupBy = JsonSerializer.Deserialize?>(ref reader, options); - continue; - } + continue; } - } - return variant; - } + if (propGroupBy.TryReadProperty(ref reader, options, PropGroupBy, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } - public override void Write(Utf8JsonWriter writer, Pivot value, JsonSerializerOptions options) - { - writer.WriteStartObject(); - if (value.Aggregations is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, value.Aggregations, options); + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - if (value.GroupBy is not null) + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { - writer.WritePropertyName("group_by"); - JsonSerializer.Serialize(writer, value.GroupBy, options); - } + Aggregations = propAggregations.Value, + GroupBy = propGroupBy.Value + }; + } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Pivot value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregations, value.Aggregations, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropGroupBy, value.GroupBy, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); writer.WriteEndObject(); } } -[JsonConverter(typeof(PivotConverter))] +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PivotConverter))] public sealed partial class Pivot { +#if NET7_0_OR_GREATER + public Pivot() + { + } +#endif +#if !NET7_0_OR_GREATER + public Pivot() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket @@ -86,7 +99,7 @@ public sealed partial class Pivot /// average. /// /// - public IDictionary? Aggregations { get; set; } + public System.Collections.Generic.IDictionary? Aggregations { get; set; } /// /// @@ -94,19 +107,27 @@ public sealed partial class Pivot /// currently supported: date histogram, geotile grid, histogram, terms. /// /// - public IDictionary? GroupBy { get; set; } + public System.Collections.Generic.IDictionary? GroupBy { get; set; } } -public sealed partial class PivotDescriptor : SerializableDescriptor> +public readonly partial struct PivotDescriptor { - internal PivotDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Pivot Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Pivot instance) + { + Instance = instance; + } - public PivotDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary> AggregationsValue { get; set; } - private IDictionary> GroupByValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Pivot instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) => descriptor.Instance; /// /// @@ -116,10 +137,52 @@ public PivotDescriptor() : base() /// average. /// /// - public PivotDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations(System.Collections.Generic.IDictionary? value) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket + /// script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, + /// min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted + /// average. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } + + /// + /// + /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket + /// script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, + /// min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted + /// average. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -128,41 +191,110 @@ public PivotDescriptor Aggregations(Func /// - public PivotDescriptor GroupBy(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy(System.Collections.Generic.IDictionary? value) { - GroupByValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.GroupBy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are + /// currently supported: date histogram, geotile grid, histogram, terms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy() { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.GroupBy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy.Build(null); + return this; + } + + /// + /// + /// Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are + /// currently supported: date histogram, geotile grid, histogram, terms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy(System.Action>? action) + { + Instance.GroupBy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddGroupBy(string key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy value) + { + Instance.GroupBy ??= new System.Collections.Generic.Dictionary(); + Instance.GroupBy.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddGroupBy(string key, System.Action> action) + { + Instance.GroupBy ??= new System.Collections.Generic.Dictionary(); + Instance.GroupBy.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } - if (GroupByValue is not null) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Pivot Build(System.Action>? action) + { + if (action is null) { - writer.WritePropertyName("group_by"); - JsonSerializer.Serialize(writer, GroupByValue, options); + return new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PivotDescriptor : SerializableDescriptor +public readonly partial struct PivotDescriptor { - internal PivotDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Pivot Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Pivot instance) + { + Instance = instance; + } - public PivotDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private IDictionary AggregationsValue { get; set; } - private IDictionary GroupByValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Pivot instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket + /// script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, + /// min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted + /// average. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations(System.Collections.Generic.IDictionary? value) + { + Instance.Aggregations = value; + return this; + } + + /// + /// + /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket + /// script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, + /// min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted + /// average. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations() + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(null); + return this; + } /// /// @@ -172,10 +304,45 @@ public PivotDescriptor() : base() /// average. /// /// - public PivotDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations(System.Action? action) { - AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + /// + /// + /// Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket + /// script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, + /// min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted + /// average. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor Aggregations(System.Action>? action) + { + Instance.Aggregations = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringAggregation.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddAggregation(string key, Elastic.Clients.Elasticsearch.Aggregations.Aggregation value) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddAggregation(string key, System.Action action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddAggregation(string key, System.Action> action) + { + Instance.Aggregations ??= new System.Collections.Generic.Dictionary(); + Instance.Aggregations.Add(key, Elastic.Clients.Elasticsearch.Aggregations.AggregationDescriptor.Build(action)); + return this; } /// @@ -184,27 +351,79 @@ public PivotDescriptor Aggregations(Func /// - public PivotDescriptor GroupBy(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy(System.Collections.Generic.IDictionary? value) { - GroupByValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.GroupBy = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are + /// currently supported: date histogram, geotile grid, histogram, terms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy() { - writer.WriteStartObject(); - if (AggregationsValue is not null) - { - writer.WritePropertyName("aggregations"); - JsonSerializer.Serialize(writer, AggregationsValue, options); - } + Instance.GroupBy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy.Build(null); + return this; + } + + /// + /// + /// Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are + /// currently supported: date histogram, geotile grid, histogram, terms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy(System.Action? action) + { + Instance.GroupBy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy.Build(action); + return this; + } - if (GroupByValue is not null) + /// + /// + /// Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are + /// currently supported: date histogram, geotile grid, histogram, terms. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor GroupBy(System.Action>? action) + { + Instance.GroupBy = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringPivotGroupBy.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddGroupBy(string key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy value) + { + Instance.GroupBy ??= new System.Collections.Generic.Dictionary(); + Instance.GroupBy.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddGroupBy(string key, System.Action action) + { + Instance.GroupBy ??= new System.Collections.Generic.Dictionary(); + Instance.GroupBy.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor AddGroupBy(string key, System.Action> action) + { + Instance.GroupBy ??= new System.Collections.Generic.Dictionary(); + Instance.GroupBy.Add(key, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Pivot Build(System.Action? action) + { + if (action is null) { - writer.WritePropertyName("group_by"); - JsonSerializer.Serialize(writer, GroupByValue, options); + return new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PivotDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Pivot(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs index 94ea8f60c65..eb1c2904315 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/PivotGroupBy.g.cs @@ -17,256 +17,372 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -[JsonConverter(typeof(PivotGroupByConverter))] -public sealed partial class PivotGroupBy +internal sealed partial class PivotGroupByConverter : System.Text.Json.Serialization.JsonConverter { - internal PivotGroupBy(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } + private static readonly System.Text.Json.JsonEncodedText VariantDateHistogram = System.Text.Json.JsonEncodedText.Encode("date_histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantGeotileGrid = System.Text.Json.JsonEncodedText.Encode("geotile_grid"); + private static readonly System.Text.Json.JsonEncodedText VariantHistogram = System.Text.Json.JsonEncodedText.Encode("histogram"); + private static readonly System.Text.Json.JsonEncodedText VariantTerms = System.Text.Json.JsonEncodedText.Encode("terms"); - internal object Variant { get; } - internal string VariantName { get; } - - public static PivotGroupBy DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => new PivotGroupBy("date_histogram", dateHistogramAggregation); - public static PivotGroupBy GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => new PivotGroupBy("geotile_grid", geotileGridAggregation); - public static PivotGroupBy Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => new PivotGroupBy("histogram", histogramAggregation); - public static PivotGroupBy Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => new PivotGroupBy("terms", termsAggregation); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class PivotGroupByConverter : JsonConverter -{ - public override PivotGroupBy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantDateHistogram)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantDateHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "date_histogram") + if (reader.ValueTextEquals(VariantGeotileGrid)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantGeotileGrid.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "geotile_grid") + if (reader.ValueTextEquals(VariantHistogram)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantHistogram.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "histogram") + if (reader.ValueTextEquals(VariantTerms)) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + variantType = VariantTerms.Value; + reader.Read(); + variant = reader.ReadValue(options, null); continue; } - if (propertyName == "terms") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'PivotGroupBy' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new PivotGroupBy(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, PivotGroupBy value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "date_histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation)value.Variant, options); - break; - case "geotile_grid": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation)value.Variant, options); - break; - case "histogram": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation)value.Variant, options); - break; - case "terms": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, options); - break; - } + case null: + break; + case "date_histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation)value.Variant, null, null); + break; + case "geotile_grid": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation)value.Variant, null, null); + break; + case "histogram": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation)value.Variant, null, null); + break; + case "terms": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy)}'."); } writer.WriteEndObject(); } } -public sealed partial class PivotGroupByDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByConverter))] +public sealed partial class PivotGroupBy { - internal PivotGroupByDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public PivotGroupBy() + { + } +#endif +#if !NET7_0_OR_GREATER + public PivotGroupBy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? DateHistogram { get => GetVariant("date_histogram"); set => SetVariant("date_histogram", value); } + public Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? GeotileGrid { get => GetVariant("geotile_grid"); set => SetVariant("geotile_grid", value); } + public Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? Histogram { get => GetVariant("histogram"); set => SetVariant("histogram", value); } + public Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? Terms { get => GetVariant("terms"); set => SetVariant("terms", value); } - public PivotGroupByDescriptor() : base() + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation value) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy { DateHistogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation value) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy { GeotileGrid = value }; + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation value) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy { Histogram = value }; + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation value) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy { Terms = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct PivotGroupByDescriptor +{ + internal Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy Instance { get; init; } - private PivotGroupByDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotGroupByDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private PivotGroupByDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotGroupByDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public PivotGroupByDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); - public PivotGroupByDescriptor DateHistogram(Action> configure) => Set(configure, "date_histogram"); - public PivotGroupByDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); - public PivotGroupByDescriptor GeotileGrid(Action> configure) => Set(configure, "geotile_grid"); - public PivotGroupByDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); - public PivotGroupByDescriptor Histogram(Action> configure) => Set(configure, "histogram"); - public PivotGroupByDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public PivotGroupByDescriptor Terms(Action> configure) => Set(configure, "terms"); + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.DateHistogram = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram() + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(null); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram(System.Action>? action) + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? value) + { + Instance.GeotileGrid = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid() + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid(System.Action>? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? value) + { + Instance.Histogram = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram() + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram(System.Action>? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) + { + Instance.Terms = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms() + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class PivotGroupByDescriptor : SerializableDescriptor +public readonly partial struct PivotGroupByDescriptor { - internal PivotGroupByDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy Instance { get; init; } - public PivotGroupByDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotGroupByDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PivotGroupByDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - private PivotGroupByDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation? value) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance.DateHistogram = value; + return this; } - private PivotGroupByDescriptor Set(object variant, string variantName) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(null); + return this; } - public PivotGroupByDescriptor DateHistogram(Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregation dateHistogramAggregation) => Set(dateHistogramAggregation, "date_histogram"); - public PivotGroupByDescriptor DateHistogram(Action configure) => Set(configure, "date_histogram"); - public PivotGroupByDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation geotileGridAggregation) => Set(geotileGridAggregation, "geotile_grid"); - public PivotGroupByDescriptor GeotileGrid(Action configure) => Set(configure, "geotile_grid"); - public PivotGroupByDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation histogramAggregation) => Set(histogramAggregation, "histogram"); - public PivotGroupByDescriptor Histogram(Action configure) => Set(configure, "histogram"); - public PivotGroupByDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); - public PivotGroupByDescriptor Terms(Action configure) => Set(configure, "terms"); + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram(System.Action? action) + { + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor DateHistogram(System.Action>? action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.DateHistogram = Elastic.Clients.Elasticsearch.Aggregations.DateHistogramAggregationDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid(Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregation? value) + { + Instance.GeotileGrid = value; + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid() + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid(System.Action? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor GeotileGrid(System.Action>? action) + { + Instance.GeotileGrid = Elastic.Clients.Elasticsearch.Aggregations.GeotileGridAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram(Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregation? value) + { + Instance.Histogram = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram() + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram(System.Action? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Histogram(System.Action>? action) + { + Instance.Histogram = Elastic.Clients.Elasticsearch.Aggregations.HistogramAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation? value) + { + Instance.Terms = value; + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms() + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(null); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms(System.Action? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor Terms(System.Action>? action) + { + Instance.Terms = Elastic.Clients.Elasticsearch.Aggregations.TermsAggregationDescriptor.Build(action); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupByDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/RetentionPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/RetentionPolicy.g.cs index 3d3076933e0..17714bb5070 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/RetentionPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/RetentionPolicy.g.cs @@ -17,211 +17,222 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -[JsonConverter(typeof(RetentionPolicyConverter))] -public sealed partial class RetentionPolicy +internal sealed partial class RetentionPolicyConverter : System.Text.Json.Serialization.JsonConverter { - internal RetentionPolicy(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } + private static readonly System.Text.Json.JsonEncodedText VariantTime = System.Text.Json.JsonEncodedText.Encode("time"); - internal object Variant { get; } - internal string VariantName { get; } - - public static RetentionPolicy Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy retentionPolicy) => new RetentionPolicy("time", retentionPolicy); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class RetentionPolicyConverter : JsonConverter -{ - public override RetentionPolicy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantTime)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantTime.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "time") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RetentionPolicy' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new RetentionPolicy(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, RetentionPolicy value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "time": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy)value.Variant, options); - break; - } + case null: + break; + case "time": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy)}'."); } writer.WriteEndObject(); } } -public sealed partial class RetentionPolicyDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyConverter))] +public sealed partial class RetentionPolicy { - internal RetentionPolicyDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public RetentionPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + public RetentionPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy? Time { get => GetVariant("time"); set => SetVariant("time", value); } - public RetentionPolicyDescriptor() : base() + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy value) => new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy { Time = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct RetentionPolicyDescriptor +{ + internal Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy Instance { get; init; } - private RetentionPolicyDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private RetentionPolicyDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionPolicyDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public RetentionPolicyDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy retentionPolicy) => Set(retentionPolicy, "time"); - public RetentionPolicyDescriptor Time(Action> configure) => Set(configure, "time"); + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Time = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor Time(System.Action> action) + { + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class RetentionPolicyDescriptor : SerializableDescriptor +public readonly partial struct RetentionPolicyDescriptor { - internal RetentionPolicyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy Instance { get; init; } - public RetentionPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private RetentionPolicyDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetentionPolicyDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private RetentionPolicyDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Time = value; + return this; } - public RetentionPolicyDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy retentionPolicy) => Set(retentionPolicy, "time"); - public RetentionPolicyDescriptor Time(Action configure) => Set(configure, "time"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor Time(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Specifies that the transform uses a time field to set the retention policy. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor Time(System.Action> action) + { + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicyDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Settings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Settings.g.cs index 5933b35214d..758a9c88a74 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Settings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Settings.g.cs @@ -17,23 +17,120 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class SettingsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAlignCheckpoints = System.Text.Json.JsonEncodedText.Encode("align_checkpoints"); + private static readonly System.Text.Json.JsonEncodedText PropDatesAsEpochMillis = System.Text.Json.JsonEncodedText.Encode("dates_as_epoch_millis"); + private static readonly System.Text.Json.JsonEncodedText PropDeduceMappings = System.Text.Json.JsonEncodedText.Encode("deduce_mappings"); + private static readonly System.Text.Json.JsonEncodedText PropDocsPerSecond = System.Text.Json.JsonEncodedText.Encode("docs_per_second"); + private static readonly System.Text.Json.JsonEncodedText PropMaxPageSearchSize = System.Text.Json.JsonEncodedText.Encode("max_page_search_size"); + private static readonly System.Text.Json.JsonEncodedText PropUnattended = System.Text.Json.JsonEncodedText.Encode("unattended"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Settings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAlignCheckpoints = default; + LocalJsonValue propDatesAsEpochMillis = default; + LocalJsonValue propDeduceMappings = default; + LocalJsonValue propDocsPerSecond = default; + LocalJsonValue propMaxPageSearchSize = default; + LocalJsonValue propUnattended = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAlignCheckpoints.TryReadProperty(ref reader, options, PropAlignCheckpoints, null)) + { + continue; + } + + if (propDatesAsEpochMillis.TryReadProperty(ref reader, options, PropDatesAsEpochMillis, null)) + { + continue; + } + + if (propDeduceMappings.TryReadProperty(ref reader, options, PropDeduceMappings, null)) + { + continue; + } + + if (propDocsPerSecond.TryReadProperty(ref reader, options, PropDocsPerSecond, null)) + { + continue; + } + + if (propMaxPageSearchSize.TryReadProperty(ref reader, options, PropMaxPageSearchSize, null)) + { + continue; + } + + if (propUnattended.TryReadProperty(ref reader, options, PropUnattended, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Settings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AlignCheckpoints = propAlignCheckpoints.Value, + DatesAsEpochMillis = propDatesAsEpochMillis.Value, + DeduceMappings = propDeduceMappings.Value, + DocsPerSecond = propDocsPerSecond.Value, + MaxPageSearchSize = propMaxPageSearchSize.Value, + Unattended = propUnattended.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Settings value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAlignCheckpoints, value.AlignCheckpoints, null, null); + writer.WriteProperty(options, PropDatesAsEpochMillis, value.DatesAsEpochMillis, null, null); + writer.WriteProperty(options, PropDeduceMappings, value.DeduceMappings, null, null); + writer.WriteProperty(options, PropDocsPerSecond, value.DocsPerSecond, null, null); + writer.WriteProperty(options, PropMaxPageSearchSize, value.MaxPageSearchSize, null, null); + writer.WriteProperty(options, PropUnattended, value.Unattended, null, null); + writer.WriteEndObject(); + } +} + /// /// /// The source of the data for the transform. /// /// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.SettingsConverter))] public sealed partial class Settings { +#if NET7_0_OR_GREATER + public Settings() + { + } +#endif +#if !NET7_0_OR_GREATER + public Settings() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Settings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// Specifies whether the transform checkpoint ranges should be optimized for performance. Such optimization can align @@ -42,7 +139,6 @@ public sealed partial class Settings /// overall performance. /// /// - [JsonInclude, JsonPropertyName("align_checkpoints")] public bool? AlignCheckpoints { get; set; } /// @@ -51,7 +147,6 @@ public sealed partial class Settings /// the default for transforms created before version 7.11. For compatible output set this value to true. /// /// - [JsonInclude, JsonPropertyName("dates_as_epoch_millis")] public bool? DatesAsEpochMillis { get; set; } /// @@ -59,7 +154,6 @@ public sealed partial class Settings /// Specifies whether the transform should deduce the destination index mappings from the transform configuration. /// /// - [JsonInclude, JsonPropertyName("deduce_mappings")] public bool? DeduceMappings { get; set; } /// @@ -68,7 +162,6 @@ public sealed partial class Settings /// wait time between search requests. The default value is null, which disables throttling. /// /// - [JsonInclude, JsonPropertyName("docs_per_second")] public float? DocsPerSecond { get; set; } /// @@ -78,7 +171,6 @@ public sealed partial class Settings /// maximum is 65,536. /// /// - [JsonInclude, JsonPropertyName("max_page_search_size")] public int? MaxPageSearchSize { get; set; } /// @@ -88,7 +180,6 @@ public sealed partial class Settings /// validation. /// /// - [JsonInclude, JsonPropertyName("unattended")] public bool? Unattended { get; set; } } @@ -97,20 +188,24 @@ public sealed partial class Settings /// The source of the data for the transform. /// /// -public sealed partial class SettingsDescriptor : SerializableDescriptor +public readonly partial struct SettingsDescriptor { - internal SettingsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Settings Instance { get; init; } - public SettingsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Settings instance) { + Instance = instance; } - private bool? AlignCheckpointsValue { get; set; } - private bool? DatesAsEpochMillisValue { get; set; } - private bool? DeduceMappingsValue { get; set; } - private float? DocsPerSecondValue { get; set; } - private int? MaxPageSearchSizeValue { get; set; } - private bool? UnattendedValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SettingsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Settings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Settings instance) => new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Settings(Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor descriptor) => descriptor.Instance; /// /// @@ -120,10 +215,10 @@ public SettingsDescriptor() : base() /// overall performance. /// /// - public SettingsDescriptor AlignCheckpoints(bool? alignCheckpoints = true) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor AlignCheckpoints(bool? value = true) { - AlignCheckpointsValue = alignCheckpoints; - return Self; + Instance.AlignCheckpoints = value; + return this; } /// @@ -132,10 +227,10 @@ public SettingsDescriptor AlignCheckpoints(bool? alignCheckpoints = true) /// the default for transforms created before version 7.11. For compatible output set this value to true. /// /// - public SettingsDescriptor DatesAsEpochMillis(bool? datesAsEpochMillis = true) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor DatesAsEpochMillis(bool? value = true) { - DatesAsEpochMillisValue = datesAsEpochMillis; - return Self; + Instance.DatesAsEpochMillis = value; + return this; } /// @@ -143,10 +238,10 @@ public SettingsDescriptor DatesAsEpochMillis(bool? datesAsEpochMillis = true) /// Specifies whether the transform should deduce the destination index mappings from the transform configuration. /// /// - public SettingsDescriptor DeduceMappings(bool? deduceMappings = true) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor DeduceMappings(bool? value = true) { - DeduceMappingsValue = deduceMappings; - return Self; + Instance.DeduceMappings = value; + return this; } /// @@ -155,10 +250,10 @@ public SettingsDescriptor DeduceMappings(bool? deduceMappings = true) /// wait time between search requests. The default value is null, which disables throttling. /// /// - public SettingsDescriptor DocsPerSecond(float? docsPerSecond) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor DocsPerSecond(float? value) { - DocsPerSecondValue = docsPerSecond; - return Self; + Instance.DocsPerSecond = value; + return this; } /// @@ -168,10 +263,10 @@ public SettingsDescriptor DocsPerSecond(float? docsPerSecond) /// maximum is 65,536. /// /// - public SettingsDescriptor MaxPageSearchSize(int? maxPageSearchSize) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor MaxPageSearchSize(int? value) { - MaxPageSearchSizeValue = maxPageSearchSize; - return Self; + Instance.MaxPageSearchSize = value; + return this; } /// @@ -181,51 +276,22 @@ public SettingsDescriptor MaxPageSearchSize(int? maxPageSearchSize) /// validation. /// /// - public SettingsDescriptor Unattended(bool? unattended = true) + public Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor Unattended(bool? value = true) { - UnattendedValue = unattended; - return Self; + Instance.Unattended = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Settings Build(System.Action? action) { - writer.WriteStartObject(); - if (AlignCheckpointsValue.HasValue) - { - writer.WritePropertyName("align_checkpoints"); - writer.WriteBooleanValue(AlignCheckpointsValue.Value); - } - - if (DatesAsEpochMillisValue.HasValue) + if (action is null) { - writer.WritePropertyName("dates_as_epoch_millis"); - writer.WriteBooleanValue(DatesAsEpochMillisValue.Value); + return new Elastic.Clients.Elasticsearch.TransformManagement.Settings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - if (DeduceMappingsValue.HasValue) - { - writer.WritePropertyName("deduce_mappings"); - writer.WriteBooleanValue(DeduceMappingsValue.Value); - } - - if (DocsPerSecondValue.HasValue) - { - writer.WritePropertyName("docs_per_second"); - writer.WriteNumberValue(DocsPerSecondValue.Value); - } - - if (MaxPageSearchSizeValue.HasValue) - { - writer.WritePropertyName("max_page_search_size"); - writer.WriteNumberValue(MaxPageSearchSizeValue.Value); - } - - if (UnattendedValue.HasValue) - { - writer.WritePropertyName("unattended"); - writer.WriteBooleanValue(UnattendedValue.Value); - } - - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.SettingsDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Settings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Source.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Source.g.cs index 031a5d987af..f51deef51e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Source.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Source.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class SourceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndices = System.Text.Json.JsonEncodedText.Encode("index"); + private static readonly System.Text.Json.JsonEncodedText PropQuery = System.Text.Json.JsonEncodedText.Encode("query"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeMappings = System.Text.Json.JsonEncodedText.Encode("runtime_mappings"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.Source Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndices = default; + LocalJsonValue propQuery = default; + LocalJsonValue?> propRuntimeMappings = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndices.TryReadProperty(ref reader, options, PropIndices, null)) + { + continue; + } + + if (propQuery.TryReadProperty(ref reader, options, PropQuery, null)) + { + continue; + } + + if (propRuntimeMappings.TryReadProperty(ref reader, options, PropRuntimeMappings, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Indices = propIndices.Value, + Query = propQuery.Value, + RuntimeMappings = propRuntimeMappings.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Source value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndices, value.Indices, null, null); + writer.WriteProperty(options, PropQuery, value.Query, null, null); + writer.WriteProperty(options, PropRuntimeMappings, value.RuntimeMappings, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.SourceConverter))] public sealed partial class Source { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Source(Elastic.Clients.Elasticsearch.Indices indices) + { + Indices = indices; + } +#if NET7_0_OR_GREATER + public Source() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Source() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The source indices for the transform. It can be a single index, an index pattern (for example, "my-index-*""), an @@ -37,15 +113,17 @@ public sealed partial class Source /// any indices are in remote clusters then the master node and at least one transform node must have the remote_cluster_client node role. /// /// - [JsonInclude, JsonPropertyName("index")] - public Elastic.Clients.Elasticsearch.Indices Indices { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Indices Indices { get; set; } /// /// /// A query clause that retrieves a subset of data from the source index. /// /// - [JsonInclude, JsonPropertyName("query")] public Elastic.Clients.Elasticsearch.QueryDsl.Query? Query { get; set; } /// @@ -54,23 +132,27 @@ public sealed partial class Source /// nodes, including remote nodes, must be 7.12 or later. /// /// - [JsonInclude, JsonPropertyName("runtime_mappings")] - public IDictionary? RuntimeMappings { get; set; } + public System.Collections.Generic.IDictionary? RuntimeMappings { get; set; } } -public sealed partial class SourceDescriptor : SerializableDescriptor> +public readonly partial struct SourceDescriptor { - internal SourceDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Source Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Source instance) + { + Instance = instance; + } - public SourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor() { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action> QueryDescriptorAction { get; set; } - private IDictionary> RuntimeMappingsValue { get; set; } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Source instance) => new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) => descriptor.Instance; /// /// @@ -80,10 +162,21 @@ public SourceDescriptor() : base() /// any indices are in remote clusters then the master node and at least one transform node must have the remote_cluster_client node role. /// /// - public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) + { + Instance.Indices = value; + return this; + } + + /// + /// + /// A query clause that retrieves a subset of data from the source index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - IndicesValue = indices; - return Self; + Instance.Query = value; + return this; } /// @@ -91,28 +184,34 @@ public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices /// A query clause that retrieves a subset of data from the source index. /// /// - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Query(System.Action> action) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data + /// nodes, including remote nodes, must be 7.12 or later. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.RuntimeMappings = value; + return this; } - public SourceDescriptor Query(Action> configure) + /// + /// + /// Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data + /// nodes, including remote nodes, must be 7.12 or later. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings() { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; } /// @@ -121,56 +220,67 @@ public SourceDescriptor Query(Action /// - public SourceDescriptor RuntimeMappings(Func>, FluentDescriptorDictionary>> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings(System.Action>? action) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary>()); - return Self; + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } - writer.WriteEndObject(); + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Source Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SourceDescriptor : SerializableDescriptor +public readonly partial struct SourceDescriptor { - internal SourceDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Source Instance { get; init; } - public SourceDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Source instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Indices IndicesValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.Query? QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } - private Action QueryDescriptorAction { get; set; } - private IDictionary RuntimeMappingsValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Source instance) => new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor descriptor) => descriptor.Instance; /// /// @@ -180,10 +290,10 @@ public SourceDescriptor() : base() /// any indices are in remote clusters then the master node and at least one transform node must have the remote_cluster_client node role. /// /// - public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices value) { - IndicesValue = indices; - return Self; + Instance.Indices = value; + return this; } /// @@ -191,28 +301,32 @@ public SourceDescriptor Indices(Elastic.Clients.Elasticsearch.Indices indices) /// A query clause that retrieves a subset of data from the source index. /// /// - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? query) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.Query? value) { - QueryDescriptor = null; - QueryDescriptorAction = null; - QueryValue = query; - return Self; + Instance.Query = value; + return this; } - public SourceDescriptor Query(Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor descriptor) + /// + /// + /// A query clause that retrieves a subset of data from the source index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Query(System.Action action) { - QueryValue = null; - QueryDescriptorAction = null; - QueryDescriptor = descriptor; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } - public SourceDescriptor Query(Action configure) + /// + /// + /// A query clause that retrieves a subset of data from the source index. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor Query(System.Action> action) { - QueryValue = null; - QueryDescriptor = null; - QueryDescriptorAction = configure; - return Self; + Instance.Query = Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor.Build(action); + return this; } /// @@ -221,39 +335,95 @@ public SourceDescriptor Query(Action /// - public SourceDescriptor RuntimeMappings(Func, FluentDescriptorDictionary> selector) + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings(System.Collections.Generic.IDictionary? value) { - RuntimeMappingsValue = selector?.Invoke(new FluentDescriptorDictionary()); - return Self; + Instance.RuntimeMappings = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data + /// nodes, including remote nodes, must be 7.12 or later. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings() { - writer.WriteStartObject(); - writer.WritePropertyName("index"); - JsonSerializer.Serialize(writer, IndicesValue, options); - if (QueryDescriptor is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryDescriptor, options); - } - else if (QueryDescriptorAction is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); - } - else if (QueryValue is not null) - { - writer.WritePropertyName("query"); - JsonSerializer.Serialize(writer, QueryValue, options); - } + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(null); + return this; + } - if (RuntimeMappingsValue is not null) - { - writer.WritePropertyName("runtime_mappings"); - JsonSerializer.Serialize(writer, RuntimeMappingsValue, options); - } + /// + /// + /// Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data + /// nodes, including remote nodes, must be 7.12 or later. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings(System.Action? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } - writer.WriteEndObject(); + /// + /// + /// Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data + /// nodes, including remote nodes, must be 7.12 or later. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor RuntimeMappings(System.Action>? action) + { + Instance.RuntimeMappings = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfFieldRuntimeField.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, Elastic.Clients.Elasticsearch.Mapping.RuntimeField value) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, value); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(Elastic.Clients.Elasticsearch.Field key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + public Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor AddRuntimeMapping(System.Linq.Expressions.Expression> key, System.Action> action) + { + Instance.RuntimeMappings ??= new System.Collections.Generic.Dictionary(); + Instance.RuntimeMappings.Add(key, Elastic.Clients.Elasticsearch.Mapping.RuntimeFieldDescriptor.Build(action)); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Source Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.SourceDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Source(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Sync.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Sync.g.cs index 1cedf9c7a15..8280d0c4774 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Sync.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/Sync.g.cs @@ -17,211 +17,222 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; -[JsonConverter(typeof(SyncConverter))] -public sealed partial class Sync +internal sealed partial class SyncConverter : System.Text.Json.Serialization.JsonConverter { - internal Sync(string variantName, object variant) - { - if (variantName is null) - throw new ArgumentNullException(nameof(variantName)); - if (variant is null) - throw new ArgumentNullException(nameof(variant)); - if (string.IsNullOrWhiteSpace(variantName)) - throw new ArgumentException("Variant name must not be empty or whitespace."); - VariantName = variantName; - Variant = variant; - } + private static readonly System.Text.Json.JsonEncodedText VariantTime = System.Text.Json.JsonEncodedText.Encode("time"); - internal object Variant { get; } - internal string VariantName { get; } - - public static Sync Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync timeSync) => new Sync("time", timeSync); - - public bool TryGet([NotNullWhen(true)] out T? result) where T : class + public override Elastic.Clients.Elasticsearch.TransformManagement.Sync Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { - result = default; - if (Variant is T variant) + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + string? variantType = null; + object? variant = null; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - result = variant; - return true; - } - - return false; - } -} - -internal sealed partial class SyncConverter : JsonConverter -{ - public override Sync Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException("Expected start token."); - } - - object? variantValue = default; - string? variantNameValue = default; - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token."); - } - - if (reader.TokenType != JsonTokenType.PropertyName) + if (reader.ValueTextEquals(VariantTime)) { - throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + variantType = VariantTime.Value; + reader.Read(); + variant = reader.ReadValue(options, null); + continue; } - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "time") + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; + reader.Skip(); continue; } - throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Sync' from the response."); + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - var result = new Sync(variantNameValue, variantValue); - return result; + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + VariantType = variantType, + Variant = variant + }; } - public override void Write(Utf8JsonWriter writer, Sync value, JsonSerializerOptions options) + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.Sync value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - if (value.VariantName is not null && value.Variant is not null) + switch (value.VariantType) { - writer.WritePropertyName(value.VariantName); - switch (value.VariantName) - { - case "time": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.TransformManagement.TimeSync)value.Variant, options); - break; - } + case null: + break; + case "time": + writer.WriteProperty(options, value.VariantType, (Elastic.Clients.Elasticsearch.TransformManagement.TimeSync)value.Variant, null, null); + break; + default: + throw new System.Text.Json.JsonException($"Variant '{value.VariantType}' is not supported for type '{nameof(Elastic.Clients.Elasticsearch.TransformManagement.Sync)}'."); } writer.WriteEndObject(); } } -public sealed partial class SyncDescriptor : SerializableDescriptor> +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.SyncConverter))] +public sealed partial class Sync { - internal SyncDescriptor(Action> configure) => configure.Invoke(this); + internal string? VariantType { get; set; } + internal object? Variant { get; set; } +#if NET7_0_OR_GREATER + public Sync() + { + } +#endif +#if !NET7_0_OR_GREATER + public Sync() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSync? Time { get => GetVariant("time"); set => SetVariant("time", value); } - public SyncDescriptor() : base() + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync value) => new Elastic.Clients.Elasticsearch.TransformManagement.Sync { Time = value }; + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private T? GetVariant(string type) + { + if (string.Equals(VariantType, type, System.StringComparison.Ordinal) && Variant is T result) + { + return result; + } + + return default; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private void SetVariant(string type, T? value) { + VariantType = type; + Variant = value; } +} - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } +public readonly partial struct SyncDescriptor +{ + internal Elastic.Clients.Elasticsearch.TransformManagement.Sync Instance { get; init; } - private SyncDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Sync instance) { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = instance; } - private SyncDescriptor Set(object variant, string variantName) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SyncDescriptor() { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - public SyncDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync timeSync) => Set(timeSync, "time"); - public SyncDescriptor Time(Action> configure) => Set(configure, "time"); + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Sync instance) => new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) => descriptor.Instance; - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync? value) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Time = value; + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor Time(System.Action> action) + { + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Sync Build(System.Action> action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class SyncDescriptor : SerializableDescriptor +public readonly partial struct SyncDescriptor { - internal SyncDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.Sync Instance { get; init; } - public SyncDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Sync instance) { + Instance = instance; } - private bool ContainsVariant { get; set; } - private string ContainedVariantName { get; set; } - private object Variant { get; set; } - private Descriptor Descriptor { get; set; } - - private SyncDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SyncDescriptor() { - ContainedVariantName = variantName; - ContainsVariant = true; - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - Descriptor = descriptor; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } - private SyncDescriptor Set(object variant, string variantName) + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.Sync instance) => new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync? value) { - Variant = variant; - ContainedVariantName = variantName; - ContainsVariant = true; - return Self; + Instance.Time = value; + return this; } - public SyncDescriptor Time(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync timeSync) => Set(timeSync, "time"); - public SyncDescriptor Time(Action configure) => Set(configure, "time"); - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor Time(System.Action action) { - writer.WriteStartObject(); - if (!string.IsNullOrEmpty(ContainedVariantName)) - { - writer.WritePropertyName(ContainedVariantName); - if (Variant is not null) - { - JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); - writer.WriteEndObject(); - return; - } + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor.Build(action); + return this; + } - JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); - } + /// + /// + /// Specifies that the transform uses a time field to synchronize the source and destination indices. + /// + /// + public Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor Time(System.Action> action) + { + Instance.Time = Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor.Build(action); + return this; + } - writer.WriteEndObject(); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.Sync Build(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.SyncDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.Sync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeRetentionPolicy.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeRetentionPolicy.g.cs index d2c1e7e3346..f7bfed1a5b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeRetentionPolicy.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeRetentionPolicy.g.cs @@ -17,25 +17,96 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TimeRetentionPolicyConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + private static readonly System.Text.Json.JsonEncodedText PropMaxAge = System.Text.Json.JsonEncodedText.Encode("max_age"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propField = default; + LocalJsonValue propMaxAge = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (propMaxAge.TryReadProperty(ref reader, options, PropMaxAge, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Field = propField.Value, + MaxAge = propMaxAge.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteProperty(options, PropMaxAge, value.MaxAge, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyConverter))] public sealed partial class TimeRetentionPolicy { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Field field, Elastic.Clients.Elasticsearch.Duration maxAge) + { + Field = field; + MaxAge = maxAge; + } +#if NET7_0_OR_GREATER + public TimeRetentionPolicy() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TimeRetentionPolicy() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The date field that is used to calculate the age of the document. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } /// /// @@ -43,43 +114,41 @@ public sealed partial class TimeRetentionPolicy /// value are removed from the destination index. /// /// - [JsonInclude, JsonPropertyName("max_age")] - public Elastic.Clients.Elasticsearch.Duration MaxAge { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy(TimeRetentionPolicy timeRetentionPolicy) => Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy.Time(timeRetentionPolicy); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration MaxAge { get; set; } } -public sealed partial class TimeRetentionPolicyDescriptor : SerializableDescriptor> +public readonly partial struct TimeRetentionPolicyDescriptor { - internal TimeRetentionPolicyDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy Instance { get; init; } - public TimeRetentionPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeRetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration MaxAgeValue { get; set; } - - /// - /// - /// The date field that is used to calculate the age of the document. - /// - /// - public TimeRetentionPolicyDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeRetentionPolicyDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field that is used to calculate the age of the document. /// /// - public TimeRetentionPolicyDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -87,10 +156,10 @@ public TimeRetentionPolicyDescriptor Field(Expression /// - public TimeRetentionPolicyDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -99,54 +168,49 @@ public TimeRetentionPolicyDescriptor Field(Expression /// - public TimeRetentionPolicyDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration maxAge) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration value) { - MaxAgeValue = maxAge; - return Self; + Instance.MaxAge = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy Build(System.Action> action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("max_age"); - JsonSerializer.Serialize(writer, MaxAgeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TimeRetentionPolicyDescriptor : SerializableDescriptor +public readonly partial struct TimeRetentionPolicyDescriptor { - internal TimeRetentionPolicyDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy Instance { get; init; } - public TimeRetentionPolicyDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeRetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - private Elastic.Clients.Elasticsearch.Duration MaxAgeValue { get; set; } - - /// - /// - /// The date field that is used to calculate the age of the document. - /// - /// - public TimeRetentionPolicyDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeRetentionPolicyDescriptor() { - FieldValue = field; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy instance) => new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor descriptor) => descriptor.Instance; + /// /// /// The date field that is used to calculate the age of the document. /// /// - public TimeRetentionPolicyDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -154,10 +218,10 @@ public TimeRetentionPolicyDescriptor Field(Expression /// - public TimeRetentionPolicyDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -166,19 +230,17 @@ public TimeRetentionPolicyDescriptor Field(Expression /// - public TimeRetentionPolicyDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration maxAge) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor MaxAge(Elastic.Clients.Elasticsearch.Duration value) { - MaxAgeValue = maxAge; - return Self; + Instance.MaxAge = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WritePropertyName("max_age"); - JsonSerializer.Serialize(writer, MaxAgeValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicyDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.TimeRetentionPolicy(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeSync.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeSync.g.cs index b768bac425c..12692ee1dfb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeSync.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TimeSync.g.cs @@ -17,24 +17,90 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TimeSyncConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDelay = System.Text.Json.JsonEncodedText.Encode("delay"); + private static readonly System.Text.Json.JsonEncodedText PropField = System.Text.Json.JsonEncodedText.Encode("field"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TimeSync Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDelay = default; + LocalJsonValue propField = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDelay.TryReadProperty(ref reader, options, PropDelay, null)) + { + continue; + } + + if (propField.TryReadProperty(ref reader, options, PropField, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Delay = propDelay.Value, + Field = propField.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TimeSync value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDelay, value.Delay, null, null); + writer.WriteProperty(options, PropField, value.Field, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncConverter))] public sealed partial class TimeSync { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSync(Elastic.Clients.Elasticsearch.Field field) + { + Field = field; + } +#if NET7_0_OR_GREATER + public TimeSync() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TimeSync() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The time delay between the current time and the latest input data time. /// /// - [JsonInclude, JsonPropertyName("delay")] public Elastic.Clients.Elasticsearch.Duration? Delay { get; set; } /// @@ -44,45 +110,41 @@ public sealed partial class TimeSync /// accounts for data transmission delays. /// /// - [JsonInclude, JsonPropertyName("field")] - public Elastic.Clients.Elasticsearch.Field Field { get; set; } - - public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.Sync(TimeSync timeSync) => Elastic.Clients.Elasticsearch.TransformManagement.Sync.Time(timeSync); + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Field Field { get; set; } } -public sealed partial class TimeSyncDescriptor : SerializableDescriptor> +public readonly partial struct TimeSyncDescriptor { - internal TimeSyncDescriptor(Action> configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.TimeSync Instance { get; init; } - public TimeSyncDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? DelayValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The time delay between the current time and the latest input data time. - /// - /// - public TimeSyncDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? delay) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSyncDescriptor() { - DelayValue = delay; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync instance) => new Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor descriptor) => descriptor.Instance; + /// /// - /// The date field that is used to identify new documents in the source. In general, it’s a good idea to use a field - /// that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it - /// accounts for data transmission delays. + /// The time delay between the current time and the latest input data time. /// /// - public TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? value) { - FieldValue = field; - return Self; + Instance.Delay = value; + return this; } /// @@ -92,10 +154,10 @@ public TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field f /// accounts for data transmission delays. /// /// - public TimeSyncDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -105,60 +167,49 @@ public TimeSyncDescriptor Field(Expression /// - public TimeSyncDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.TimeSync Build(System.Action> action) { - writer.WriteStartObject(); - if (DelayValue is not null) - { - writer.WritePropertyName("delay"); - JsonSerializer.Serialize(writer, DelayValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } -public sealed partial class TimeSyncDescriptor : SerializableDescriptor +public readonly partial struct TimeSyncDescriptor { - internal TimeSyncDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.TransformManagement.TimeSync Instance { get; init; } - public TimeSyncDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync instance) { + Instance = instance; } - private Elastic.Clients.Elasticsearch.Duration? DelayValue { get; set; } - private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } - - /// - /// - /// The time delay between the current time and the latest input data time. - /// - /// - public TimeSyncDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? delay) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TimeSyncDescriptor() { - DelayValue = delay; - return Self; + Instance = new Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); } + public static explicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(Elastic.Clients.Elasticsearch.TransformManagement.TimeSync instance) => new Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor descriptor) => descriptor.Instance; + /// /// - /// The date field that is used to identify new documents in the source. In general, it’s a good idea to use a field - /// that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it - /// accounts for data transmission delays. + /// The time delay between the current time and the latest input data time. /// /// - public TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Delay(Elastic.Clients.Elasticsearch.Duration? value) { - FieldValue = field; - return Self; + Instance.Delay = value; + return this; } /// @@ -168,10 +219,10 @@ public TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field field) /// accounts for data transmission delays. /// /// - public TimeSyncDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Field(Elastic.Clients.Elasticsearch.Field value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } /// @@ -181,23 +232,17 @@ public TimeSyncDescriptor Field(Expression /// - public TimeSyncDescriptor Field(Expression> field) + public Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor Field(System.Linq.Expressions.Expression> value) { - FieldValue = field; - return Self; + Instance.Field = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.TransformManagement.TimeSync Build(System.Action action) { - writer.WriteStartObject(); - if (DelayValue is not null) - { - writer.WritePropertyName("delay"); - JsonSerializer.Serialize(writer, DelayValue, options); - } - - writer.WritePropertyName("field"); - JsonSerializer.Serialize(writer, FieldValue, options); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.TransformManagement.TimeSyncDescriptor(new Elastic.Clients.Elasticsearch.TransformManagement.TimeSync(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformHealthIssue.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformHealthIssue.g.cs new file mode 100644 index 00000000000..7caaf185ba6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformHealthIssue.g.cs @@ -0,0 +1,184 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.TransformManagement; + +internal sealed partial class TransformHealthIssueConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDetails = System.Text.Json.JsonEncodedText.Encode("details"); + private static readonly System.Text.Json.JsonEncodedText PropFirstOccurenceString = System.Text.Json.JsonEncodedText.Encode("first_occurence_string"); + private static readonly System.Text.Json.JsonEncodedText PropFirstOccurrence = System.Text.Json.JsonEncodedText.Encode("first_occurrence"); + private static readonly System.Text.Json.JsonEncodedText PropIssue = System.Text.Json.JsonEncodedText.Encode("issue"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformHealthIssue Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propDetails = default; + LocalJsonValue propFirstOccurenceString = default; + LocalJsonValue propFirstOccurrence = default; + LocalJsonValue propIssue = default; + LocalJsonValue propType = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDetails.TryReadProperty(ref reader, options, PropDetails, null)) + { + continue; + } + + if (propFirstOccurenceString.TryReadProperty(ref reader, options, PropFirstOccurenceString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propFirstOccurrence.TryReadProperty(ref reader, options, PropFirstOccurrence, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propIssue.TryReadProperty(ref reader, options, PropIssue, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformHealthIssue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Details = propDetails.Value, + FirstOccurenceString = propFirstOccurenceString.Value, + FirstOccurrence = propFirstOccurrence.Value, + Issue = propIssue.Value, + Type = propType.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformHealthIssue value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDetails, value.Details, null, null); + writer.WriteProperty(options, PropFirstOccurenceString, value.FirstOccurenceString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropFirstOccurrence, value.FirstOccurrence, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropIssue, value.Issue, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformHealthIssueConverter))] +public sealed partial class TransformHealthIssue +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformHealthIssue(int count, string issue, string type) + { + Count = count; + Issue = issue; + Type = type; + } +#if NET7_0_OR_GREATER + public TransformHealthIssue() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformHealthIssue() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformHealthIssue(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// Number of times this issue has occurred since it started + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + + /// + /// + /// Details about the issue + /// + /// + public string? Details { get; set; } + public System.DateTimeOffset? FirstOccurenceString { get; set; } + + /// + /// + /// The timestamp this issue occurred for for the first time + /// + /// + public System.DateTimeOffset? FirstOccurrence { get; set; } + + /// + /// + /// A description of the issue + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Issue { get; set; } + + /// + /// + /// The type of the issue + /// + /// + public +#if NET7_0_OR_GREATER + required +#endif + string Type { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformIndexerStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformIndexerStats.g.cs index 3945f47f036..cdd25615ced 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformIndexerStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformIndexerStats.g.cs @@ -17,50 +17,309 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TransformIndexerStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeleteTimeInMs = System.Text.Json.JsonEncodedText.Encode("delete_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropDocumentsDeleted = System.Text.Json.JsonEncodedText.Encode("documents_deleted"); + private static readonly System.Text.Json.JsonEncodedText PropDocumentsIndexed = System.Text.Json.JsonEncodedText.Encode("documents_indexed"); + private static readonly System.Text.Json.JsonEncodedText PropDocumentsProcessed = System.Text.Json.JsonEncodedText.Encode("documents_processed"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAvgCheckpointDurationMs = System.Text.Json.JsonEncodedText.Encode("exponential_avg_checkpoint_duration_ms"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAvgDocumentsIndexed = System.Text.Json.JsonEncodedText.Encode("exponential_avg_documents_indexed"); + private static readonly System.Text.Json.JsonEncodedText PropExponentialAvgDocumentsProcessed = System.Text.Json.JsonEncodedText.Encode("exponential_avg_documents_processed"); + private static readonly System.Text.Json.JsonEncodedText PropIndexFailures = System.Text.Json.JsonEncodedText.Encode("index_failures"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTimeInMs = System.Text.Json.JsonEncodedText.Encode("index_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropIndexTotal = System.Text.Json.JsonEncodedText.Encode("index_total"); + private static readonly System.Text.Json.JsonEncodedText PropPagesProcessed = System.Text.Json.JsonEncodedText.Encode("pages_processed"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTimeInMs = System.Text.Json.JsonEncodedText.Encode("processing_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropProcessingTotal = System.Text.Json.JsonEncodedText.Encode("processing_total"); + private static readonly System.Text.Json.JsonEncodedText PropSearchFailures = System.Text.Json.JsonEncodedText.Encode("search_failures"); + private static readonly System.Text.Json.JsonEncodedText PropSearchTimeInMs = System.Text.Json.JsonEncodedText.Encode("search_time_in_ms"); + private static readonly System.Text.Json.JsonEncodedText PropSearchTotal = System.Text.Json.JsonEncodedText.Encode("search_total"); + private static readonly System.Text.Json.JsonEncodedText PropTriggerCount = System.Text.Json.JsonEncodedText.Encode("trigger_count"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeleteTimeInMs = default; + LocalJsonValue propDocumentsDeleted = default; + LocalJsonValue propDocumentsIndexed = default; + LocalJsonValue propDocumentsProcessed = default; + LocalJsonValue propExponentialAvgCheckpointDurationMs = default; + LocalJsonValue propExponentialAvgDocumentsIndexed = default; + LocalJsonValue propExponentialAvgDocumentsProcessed = default; + LocalJsonValue propIndexFailures = default; + LocalJsonValue propIndexTimeInMs = default; + LocalJsonValue propIndexTotal = default; + LocalJsonValue propPagesProcessed = default; + LocalJsonValue propProcessingTimeInMs = default; + LocalJsonValue propProcessingTotal = default; + LocalJsonValue propSearchFailures = default; + LocalJsonValue propSearchTimeInMs = default; + LocalJsonValue propSearchTotal = default; + LocalJsonValue propTriggerCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeleteTimeInMs.TryReadProperty(ref reader, options, PropDeleteTimeInMs, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propDocumentsDeleted.TryReadProperty(ref reader, options, PropDocumentsDeleted, null)) + { + continue; + } + + if (propDocumentsIndexed.TryReadProperty(ref reader, options, PropDocumentsIndexed, null)) + { + continue; + } + + if (propDocumentsProcessed.TryReadProperty(ref reader, options, PropDocumentsProcessed, null)) + { + continue; + } + + if (propExponentialAvgCheckpointDurationMs.TryReadProperty(ref reader, options, PropExponentialAvgCheckpointDurationMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propExponentialAvgDocumentsIndexed.TryReadProperty(ref reader, options, PropExponentialAvgDocumentsIndexed, null)) + { + continue; + } + + if (propExponentialAvgDocumentsProcessed.TryReadProperty(ref reader, options, PropExponentialAvgDocumentsProcessed, null)) + { + continue; + } + + if (propIndexFailures.TryReadProperty(ref reader, options, PropIndexFailures, null)) + { + continue; + } + + if (propIndexTimeInMs.TryReadProperty(ref reader, options, PropIndexTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propIndexTotal.TryReadProperty(ref reader, options, PropIndexTotal, null)) + { + continue; + } + + if (propPagesProcessed.TryReadProperty(ref reader, options, PropPagesProcessed, null)) + { + continue; + } + + if (propProcessingTimeInMs.TryReadProperty(ref reader, options, PropProcessingTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propProcessingTotal.TryReadProperty(ref reader, options, PropProcessingTotal, null)) + { + continue; + } + + if (propSearchFailures.TryReadProperty(ref reader, options, PropSearchFailures, null)) + { + continue; + } + + if (propSearchTimeInMs.TryReadProperty(ref reader, options, PropSearchTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (propSearchTotal.TryReadProperty(ref reader, options, PropSearchTotal, null)) + { + continue; + } + + if (propTriggerCount.TryReadProperty(ref reader, options, PropTriggerCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DeleteTimeInMs = propDeleteTimeInMs.Value, + DocumentsDeleted = propDocumentsDeleted.Value, + DocumentsIndexed = propDocumentsIndexed.Value, + DocumentsProcessed = propDocumentsProcessed.Value, + ExponentialAvgCheckpointDurationMs = propExponentialAvgCheckpointDurationMs.Value, + ExponentialAvgDocumentsIndexed = propExponentialAvgDocumentsIndexed.Value, + ExponentialAvgDocumentsProcessed = propExponentialAvgDocumentsProcessed.Value, + IndexFailures = propIndexFailures.Value, + IndexTimeInMs = propIndexTimeInMs.Value, + IndexTotal = propIndexTotal.Value, + PagesProcessed = propPagesProcessed.Value, + ProcessingTimeInMs = propProcessingTimeInMs.Value, + ProcessingTotal = propProcessingTotal.Value, + SearchFailures = propSearchFailures.Value, + SearchTimeInMs = propSearchTimeInMs.Value, + SearchTotal = propSearchTotal.Value, + TriggerCount = propTriggerCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeleteTimeInMs, value.DeleteTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropDocumentsDeleted, value.DocumentsDeleted, null, null); + writer.WriteProperty(options, PropDocumentsIndexed, value.DocumentsIndexed, null, null); + writer.WriteProperty(options, PropDocumentsProcessed, value.DocumentsProcessed, null, null); + writer.WriteProperty(options, PropExponentialAvgCheckpointDurationMs, value.ExponentialAvgCheckpointDurationMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropExponentialAvgDocumentsIndexed, value.ExponentialAvgDocumentsIndexed, null, null); + writer.WriteProperty(options, PropExponentialAvgDocumentsProcessed, value.ExponentialAvgDocumentsProcessed, null, null); + writer.WriteProperty(options, PropIndexFailures, value.IndexFailures, null, null); + writer.WriteProperty(options, PropIndexTimeInMs, value.IndexTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropIndexTotal, value.IndexTotal, null, null); + writer.WriteProperty(options, PropPagesProcessed, value.PagesProcessed, null, null); + writer.WriteProperty(options, PropProcessingTimeInMs, value.ProcessingTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropProcessingTotal, value.ProcessingTotal, null, null); + writer.WriteProperty(options, PropSearchFailures, value.SearchFailures, null, null); + writer.WriteProperty(options, PropSearchTimeInMs, value.SearchTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteProperty(options, PropSearchTotal, value.SearchTotal, null, null); + writer.WriteProperty(options, PropTriggerCount, value.TriggerCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStatsConverter))] public sealed partial class TransformIndexerStats { - [JsonInclude, JsonPropertyName("delete_time_in_ms")] - public long? DeleteTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("documents_deleted")] - public long? DocumentsDeleted { get; init; } - [JsonInclude, JsonPropertyName("documents_indexed")] - public long DocumentsIndexed { get; init; } - [JsonInclude, JsonPropertyName("documents_processed")] - public long DocumentsProcessed { get; init; } - [JsonInclude, JsonPropertyName("exponential_avg_checkpoint_duration_ms")] - public double ExponentialAvgCheckpointDurationMs { get; init; } - [JsonInclude, JsonPropertyName("exponential_avg_documents_indexed")] - public double ExponentialAvgDocumentsIndexed { get; init; } - [JsonInclude, JsonPropertyName("exponential_avg_documents_processed")] - public double ExponentialAvgDocumentsProcessed { get; init; } - [JsonInclude, JsonPropertyName("index_failures")] - public long IndexFailures { get; init; } - [JsonInclude, JsonPropertyName("index_time_in_ms")] - public long IndexTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("index_total")] - public long IndexTotal { get; init; } - [JsonInclude, JsonPropertyName("pages_processed")] - public long PagesProcessed { get; init; } - [JsonInclude, JsonPropertyName("processing_time_in_ms")] - public long ProcessingTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("processing_total")] - public long ProcessingTotal { get; init; } - [JsonInclude, JsonPropertyName("search_failures")] - public long SearchFailures { get; init; } - [JsonInclude, JsonPropertyName("search_time_in_ms")] - public long SearchTimeInMs { get; init; } - [JsonInclude, JsonPropertyName("search_total")] - public long SearchTotal { get; init; } - [JsonInclude, JsonPropertyName("trigger_count")] - public long TriggerCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformIndexerStats(long documentsIndexed, long documentsProcessed, System.TimeSpan exponentialAvgCheckpointDurationMs, double exponentialAvgDocumentsIndexed, double exponentialAvgDocumentsProcessed, long indexFailures, System.TimeSpan indexTimeInMs, long indexTotal, long pagesProcessed, System.TimeSpan processingTimeInMs, long processingTotal, long searchFailures, System.TimeSpan searchTimeInMs, long searchTotal, long triggerCount) + { + DocumentsIndexed = documentsIndexed; + DocumentsProcessed = documentsProcessed; + ExponentialAvgCheckpointDurationMs = exponentialAvgCheckpointDurationMs; + ExponentialAvgDocumentsIndexed = exponentialAvgDocumentsIndexed; + ExponentialAvgDocumentsProcessed = exponentialAvgDocumentsProcessed; + IndexFailures = indexFailures; + IndexTimeInMs = indexTimeInMs; + IndexTotal = indexTotal; + PagesProcessed = pagesProcessed; + ProcessingTimeInMs = processingTimeInMs; + ProcessingTotal = processingTotal; + SearchFailures = searchFailures; + SearchTimeInMs = searchTimeInMs; + SearchTotal = searchTotal; + TriggerCount = triggerCount; + } +#if NET7_0_OR_GREATER + public TransformIndexerStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformIndexerStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformIndexerStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.DateTimeOffset? DeleteTimeInMs { get; set; } + public long? DocumentsDeleted { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocumentsIndexed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocumentsProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ExponentialAvgCheckpointDurationMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ExponentialAvgDocumentsIndexed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + double ExponentialAvgDocumentsProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan IndexTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PagesProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan ProcessingTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ProcessingTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SearchFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan SearchTimeInMs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SearchTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TriggerCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformProgress.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformProgress.g.cs index 6bfe814ef45..d4a0026b3a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformProgress.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformProgress.g.cs @@ -17,26 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TransformProgressConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocsIndexed = System.Text.Json.JsonEncodedText.Encode("docs_indexed"); + private static readonly System.Text.Json.JsonEncodedText PropDocsProcessed = System.Text.Json.JsonEncodedText.Encode("docs_processed"); + private static readonly System.Text.Json.JsonEncodedText PropDocsRemaining = System.Text.Json.JsonEncodedText.Encode("docs_remaining"); + private static readonly System.Text.Json.JsonEncodedText PropPercentComplete = System.Text.Json.JsonEncodedText.Encode("percent_complete"); + private static readonly System.Text.Json.JsonEncodedText PropTotalDocs = System.Text.Json.JsonEncodedText.Encode("total_docs"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformProgress Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocsIndexed = default; + LocalJsonValue propDocsProcessed = default; + LocalJsonValue propDocsRemaining = default; + LocalJsonValue propPercentComplete = default; + LocalJsonValue propTotalDocs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocsIndexed.TryReadProperty(ref reader, options, PropDocsIndexed, null)) + { + continue; + } + + if (propDocsProcessed.TryReadProperty(ref reader, options, PropDocsProcessed, null)) + { + continue; + } + + if (propDocsRemaining.TryReadProperty(ref reader, options, PropDocsRemaining, null)) + { + continue; + } + + if (propPercentComplete.TryReadProperty(ref reader, options, PropPercentComplete, null)) + { + continue; + } + + if (propTotalDocs.TryReadProperty(ref reader, options, PropTotalDocs, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocsIndexed = propDocsIndexed.Value, + DocsProcessed = propDocsProcessed.Value, + DocsRemaining = propDocsRemaining.Value, + PercentComplete = propPercentComplete.Value, + TotalDocs = propTotalDocs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformProgress value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocsIndexed, value.DocsIndexed, null, null); + writer.WriteProperty(options, PropDocsProcessed, value.DocsProcessed, null, null); + writer.WriteProperty(options, PropDocsRemaining, value.DocsRemaining, null, null); + writer.WriteProperty(options, PropPercentComplete, value.PercentComplete, null, null); + writer.WriteProperty(options, PropTotalDocs, value.TotalDocs, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformProgressConverter))] public sealed partial class TransformProgress { - [JsonInclude, JsonPropertyName("docs_indexed")] - public long DocsIndexed { get; init; } - [JsonInclude, JsonPropertyName("docs_processed")] - public long DocsProcessed { get; init; } - [JsonInclude, JsonPropertyName("docs_remaining")] - public long? DocsRemaining { get; init; } - [JsonInclude, JsonPropertyName("percent_complete")] - public double? PercentComplete { get; init; } - [JsonInclude, JsonPropertyName("total_docs")] - public long? TotalDocs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformProgress(long docsIndexed, long docsProcessed) + { + DocsIndexed = docsIndexed; + DocsProcessed = docsProcessed; + } +#if NET7_0_OR_GREATER + public TransformProgress() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformProgress() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformProgress(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DocsIndexed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocsProcessed { get; set; } + public long? DocsRemaining { get; set; } + public double? PercentComplete { get; set; } + public long? TotalDocs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStats.g.cs index 3f0df8267b7..fcb82953cb7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStats.g.cs @@ -17,30 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TransformStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCheckpointing = System.Text.Json.JsonEncodedText.Encode("checkpointing"); + private static readonly System.Text.Json.JsonEncodedText PropHealth = System.Text.Json.JsonEncodedText.Encode("health"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropNode = System.Text.Json.JsonEncodedText.Encode("node"); + private static readonly System.Text.Json.JsonEncodedText PropReason = System.Text.Json.JsonEncodedText.Encode("reason"); + private static readonly System.Text.Json.JsonEncodedText PropState = System.Text.Json.JsonEncodedText.Encode("state"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCheckpointing = default; + LocalJsonValue propHealth = default; + LocalJsonValue propId = default; + LocalJsonValue propNode = default; + LocalJsonValue propReason = default; + LocalJsonValue propState = default; + LocalJsonValue propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCheckpointing.TryReadProperty(ref reader, options, PropCheckpointing, null)) + { + continue; + } + + if (propHealth.TryReadProperty(ref reader, options, PropHealth, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propNode.TryReadProperty(ref reader, options, PropNode, null)) + { + continue; + } + + if (propReason.TryReadProperty(ref reader, options, PropReason, null)) + { + continue; + } + + if (propState.TryReadProperty(ref reader, options, PropState, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Checkpointing = propCheckpointing.Value, + Health = propHealth.Value, + Id = propId.Value, + Node = propNode.Value, + Reason = propReason.Value, + State = propState.Value, + Stats = propStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCheckpointing, value.Checkpointing, null, null); + writer.WriteProperty(options, PropHealth, value.Health, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropNode, value.Node, null, null); + writer.WriteProperty(options, PropReason, value.Reason, null, null); + writer.WriteProperty(options, PropState, value.State, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsConverter))] public sealed partial class TransformStats { - [JsonInclude, JsonPropertyName("checkpointing")] - public Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing Checkpointing { get; init; } - [JsonInclude, JsonPropertyName("health")] - public Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealth? Health { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("node")] - public Elastic.Clients.Elasticsearch.NodeAttributes? Node { get; init; } - [JsonInclude, JsonPropertyName("reason")] - public string? Reason { get; init; } - [JsonInclude, JsonPropertyName("state")] - public string State { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats Stats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformStats(Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing checkpointing, string id, string state, Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats stats) + { + Checkpointing = checkpointing; + Id = id; + State = state; + Stats = stats; + } +#if NET7_0_OR_GREATER + public TransformStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.Checkpointing Checkpointing { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealth? Health { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public Elastic.Clients.Elasticsearch.NodeAttributes? Node { get; set; } + public string? Reason { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string State { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.TransformIndexerStats Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStatsHealth.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStatsHealth.g.cs index 90f6734a7e4..9a6d16cb5a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStatsHealth.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformStatsHealth.g.cs @@ -17,18 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TransformStatsHealthConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIssues = System.Text.Json.JsonEncodedText.Encode("issues"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealth Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propIssues = default; + LocalJsonValue propStatus = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIssues.TryReadProperty(ref reader, options, PropIssues, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Issues = propIssues.Value, + Status = propStatus.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealth value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIssues, value.Issues, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformStatsHealthConverter))] public sealed partial class TransformStatsHealth { - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.HealthStatus Status { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformStatsHealth(Elastic.Clients.Elasticsearch.HealthStatus status) + { + Status = status; + } +#if NET7_0_OR_GREATER + public TransformStatsHealth() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformStatsHealth() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformStatsHealth(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + /// + /// + /// If a non-healthy status is returned, contains a list of issues of the transform. + /// + /// + public System.Collections.Generic.IReadOnlyCollection? Issues { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.HealthStatus Status { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformSummary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformSummary.g.cs index 264bced8522..eae1a5fc558 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformSummary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TransformManagement/TransformSummary.g.cs @@ -17,97 +17,282 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.TransformManagement; +internal sealed partial class TransformSummaryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAuthorization = System.Text.Json.JsonEncodedText.Encode("authorization"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTime = System.Text.Json.JsonEncodedText.Encode("create_time"); + private static readonly System.Text.Json.JsonEncodedText PropCreateTimeString = System.Text.Json.JsonEncodedText.Encode("create_time_string"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropDest = System.Text.Json.JsonEncodedText.Encode("dest"); + private static readonly System.Text.Json.JsonEncodedText PropFrequency = System.Text.Json.JsonEncodedText.Encode("frequency"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("id"); + private static readonly System.Text.Json.JsonEncodedText PropLatest = System.Text.Json.JsonEncodedText.Encode("latest"); + private static readonly System.Text.Json.JsonEncodedText PropMeta = System.Text.Json.JsonEncodedText.Encode("_meta"); + private static readonly System.Text.Json.JsonEncodedText PropPivot = System.Text.Json.JsonEncodedText.Encode("pivot"); + private static readonly System.Text.Json.JsonEncodedText PropRetentionPolicy = System.Text.Json.JsonEncodedText.Encode("retention_policy"); + private static readonly System.Text.Json.JsonEncodedText PropSettings = System.Text.Json.JsonEncodedText.Encode("settings"); + private static readonly System.Text.Json.JsonEncodedText PropSource = System.Text.Json.JsonEncodedText.Encode("source"); + private static readonly System.Text.Json.JsonEncodedText PropSync = System.Text.Json.JsonEncodedText.Encode("sync"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.TransformManagement.TransformSummary Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAuthorization = default; + LocalJsonValue propCreateTime = default; + LocalJsonValue propCreateTimeString = default; + LocalJsonValue propDescription = default; + LocalJsonValue propDest = default; + LocalJsonValue propFrequency = default; + LocalJsonValue propId = default; + LocalJsonValue propLatest = default; + LocalJsonValue?> propMeta = default; + LocalJsonValue propPivot = default; + LocalJsonValue propRetentionPolicy = default; + LocalJsonValue propSettings = default; + LocalJsonValue propSource = default; + LocalJsonValue propSync = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAuthorization.TryReadProperty(ref reader, options, PropAuthorization, null)) + { + continue; + } + + if (propCreateTime.TryReadProperty(ref reader, options, PropCreateTime, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propCreateTimeString.TryReadProperty(ref reader, options, PropCreateTimeString, static System.DateTimeOffset? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propDest.TryReadProperty(ref reader, options, PropDest, null)) + { + continue; + } + + if (propFrequency.TryReadProperty(ref reader, options, PropFrequency, null)) + { + continue; + } + + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } + + if (propLatest.TryReadProperty(ref reader, options, PropLatest, null)) + { + continue; + } + + if (propMeta.TryReadProperty(ref reader, options, PropMeta, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propPivot.TryReadProperty(ref reader, options, PropPivot, null)) + { + continue; + } + + if (propRetentionPolicy.TryReadProperty(ref reader, options, PropRetentionPolicy, null)) + { + continue; + } + + if (propSettings.TryReadProperty(ref reader, options, PropSettings, null)) + { + continue; + } + + if (propSource.TryReadProperty(ref reader, options, PropSource, null)) + { + continue; + } + + if (propSync.TryReadProperty(ref reader, options, PropSync, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TransformManagement.TransformSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Authorization = propAuthorization.Value, + CreateTime = propCreateTime.Value, + CreateTimeString = propCreateTimeString.Value, + Description = propDescription.Value, + Dest = propDest.Value, + Frequency = propFrequency.Value, + Id = propId.Value, + Latest = propLatest.Value, + Meta = propMeta.Value, + Pivot = propPivot.Value, + RetentionPolicy = propRetentionPolicy.Value, + Settings = propSettings.Value, + Source = propSource.Value, + Sync = propSync.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TransformManagement.TransformSummary value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAuthorization, value.Authorization, null, null); + writer.WriteProperty(options, PropCreateTime, value.CreateTime, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropCreateTimeString, value.CreateTimeString, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropDest, value.Dest, null, null); + writer.WriteProperty(options, PropFrequency, value.Frequency, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropLatest, value.Latest, null, null); + writer.WriteProperty(options, PropMeta, value.Meta, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropPivot, value.Pivot, null, null); + writer.WriteProperty(options, PropRetentionPolicy, value.RetentionPolicy, null, null); + writer.WriteProperty(options, PropSettings, value.Settings, null, null); + writer.WriteProperty(options, PropSource, value.Source, null, null); + writer.WriteProperty(options, PropSync, value.Sync, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TransformManagement.TransformSummaryConverter))] public sealed partial class TransformSummary { + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TransformSummary(Elastic.Clients.Elasticsearch.Core.Reindex.Destination dest, string id, Elastic.Clients.Elasticsearch.TransformManagement.Source source) + { + Dest = dest; + Id = id; + Source = source; + } +#if NET7_0_OR_GREATER + public TransformSummary() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TransformSummary() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TransformSummary(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + /// /// /// The security privileges that the transform uses to run its queries. If Elastic Stack security features were disabled at the time of the most recent update to the transform, this property is omitted. /// /// - [JsonInclude, JsonPropertyName("authorization")] - public Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization? Authorization { get; init; } + public Elastic.Clients.Elasticsearch.MachineLearning.TransformAuthorization? Authorization { get; set; } /// /// /// The time the transform was created. /// /// - [JsonInclude, JsonPropertyName("create_time")] - public long? CreateTime { get; init; } + public System.DateTimeOffset? CreateTime { get; set; } + public System.DateTimeOffset? CreateTimeString { get; set; } /// /// /// Free text description of the transform. /// /// - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } + public string? Description { get; set; } /// /// /// The destination for the transform. /// /// - [JsonInclude, JsonPropertyName("dest")] - public Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; init; } - [JsonInclude, JsonPropertyName("frequency")] - public Elastic.Clients.Elasticsearch.Duration? Frequency { get; init; } - [JsonInclude, JsonPropertyName("id")] - public string Id { get; init; } - [JsonInclude, JsonPropertyName("latest")] - public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; init; } - [JsonInclude, JsonPropertyName("_meta")] - public IReadOnlyDictionary? Meta { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Core.Reindex.Destination Dest { get; set; } + public Elastic.Clients.Elasticsearch.Duration? Frequency { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Id { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.Latest? Latest { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Meta { get; set; } /// /// /// The pivot method transforms the data by aggregating and grouping it. /// /// - [JsonInclude, JsonPropertyName("pivot")] - public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; init; } - [JsonInclude, JsonPropertyName("retention_policy")] - public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; init; } + public Elastic.Clients.Elasticsearch.TransformManagement.Pivot? Pivot { get; set; } + public Elastic.Clients.Elasticsearch.TransformManagement.RetentionPolicy? RetentionPolicy { get; set; } /// /// /// Defines optional transform settings. /// /// - [JsonInclude, JsonPropertyName("settings")] - public Elastic.Clients.Elasticsearch.TransformManagement.Settings? Settings { get; init; } + public Elastic.Clients.Elasticsearch.TransformManagement.Settings? Settings { get; set; } /// /// /// The source of the data for the transform. /// /// - [JsonInclude, JsonPropertyName("source")] - public Elastic.Clients.Elasticsearch.TransformManagement.Source Source { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.TransformManagement.Source Source { get; set; } /// /// /// Defines the properties transforms require to run continuously. /// /// - [JsonInclude, JsonPropertyName("sync")] - public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; init; } + public Elastic.Clients.Elasticsearch.TransformManagement.Sync? Sync { get; set; } /// /// /// The version of Elasticsearch that existed on the node when the transform was created. /// /// - [JsonInclude, JsonPropertyName("version")] - public string? Version { get; init; } + public string? Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TranslogStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TranslogStats.g.cs index 47e080f8c36..c7c8756614e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TranslogStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TranslogStats.g.cs @@ -17,30 +17,159 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class TranslogStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEarliestLastModifiedAge = System.Text.Json.JsonEncodedText.Encode("earliest_last_modified_age"); + private static readonly System.Text.Json.JsonEncodedText PropOperations = System.Text.Json.JsonEncodedText.Encode("operations"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + private static readonly System.Text.Json.JsonEncodedText PropSizeInBytes = System.Text.Json.JsonEncodedText.Encode("size_in_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropUncommittedOperations = System.Text.Json.JsonEncodedText.Encode("uncommitted_operations"); + private static readonly System.Text.Json.JsonEncodedText PropUncommittedSize = System.Text.Json.JsonEncodedText.Encode("uncommitted_size"); + private static readonly System.Text.Json.JsonEncodedText PropUncommittedSizeInBytes = System.Text.Json.JsonEncodedText.Encode("uncommitted_size_in_bytes"); + + public override Elastic.Clients.Elasticsearch.TranslogStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEarliestLastModifiedAge = default; + LocalJsonValue propOperations = default; + LocalJsonValue propSize = default; + LocalJsonValue propSizeInBytes = default; + LocalJsonValue propUncommittedOperations = default; + LocalJsonValue propUncommittedSize = default; + LocalJsonValue propUncommittedSizeInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEarliestLastModifiedAge.TryReadProperty(ref reader, options, PropEarliestLastModifiedAge, null)) + { + continue; + } + + if (propOperations.TryReadProperty(ref reader, options, PropOperations, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (propSizeInBytes.TryReadProperty(ref reader, options, PropSizeInBytes, null)) + { + continue; + } + + if (propUncommittedOperations.TryReadProperty(ref reader, options, PropUncommittedOperations, null)) + { + continue; + } + + if (propUncommittedSize.TryReadProperty(ref reader, options, PropUncommittedSize, null)) + { + continue; + } + + if (propUncommittedSizeInBytes.TryReadProperty(ref reader, options, PropUncommittedSizeInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.TranslogStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + EarliestLastModifiedAge = propEarliestLastModifiedAge.Value, + Operations = propOperations.Value, + Size = propSize.Value, + SizeInBytes = propSizeInBytes.Value, + UncommittedOperations = propUncommittedOperations.Value, + UncommittedSize = propUncommittedSize.Value, + UncommittedSizeInBytes = propUncommittedSizeInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.TranslogStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEarliestLastModifiedAge, value.EarliestLastModifiedAge, null, null); + writer.WriteProperty(options, PropOperations, value.Operations, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteProperty(options, PropSizeInBytes, value.SizeInBytes, null, null); + writer.WriteProperty(options, PropUncommittedOperations, value.UncommittedOperations, null, null); + writer.WriteProperty(options, PropUncommittedSize, value.UncommittedSize, null, null); + writer.WriteProperty(options, PropUncommittedSizeInBytes, value.UncommittedSizeInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.TranslogStatsConverter))] public sealed partial class TranslogStats { - [JsonInclude, JsonPropertyName("earliest_last_modified_age")] - public long EarliestLastModifiedAge { get; init; } - [JsonInclude, JsonPropertyName("operations")] - public long Operations { get; init; } - [JsonInclude, JsonPropertyName("size")] - public string? Size { get; init; } - [JsonInclude, JsonPropertyName("size_in_bytes")] - public long SizeInBytes { get; init; } - [JsonInclude, JsonPropertyName("uncommitted_operations")] - public int UncommittedOperations { get; init; } - [JsonInclude, JsonPropertyName("uncommitted_size")] - public string? UncommittedSize { get; init; } - [JsonInclude, JsonPropertyName("uncommitted_size_in_bytes")] - public long UncommittedSizeInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TranslogStats(long earliestLastModifiedAge, long operations, long sizeInBytes, int uncommittedOperations, long uncommittedSizeInBytes) + { + EarliestLastModifiedAge = earliestLastModifiedAge; + Operations = operations; + SizeInBytes = sizeInBytes; + UncommittedOperations = uncommittedOperations; + UncommittedSizeInBytes = uncommittedSizeInBytes; + } +#if NET7_0_OR_GREATER + public TranslogStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public TranslogStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal TranslogStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long EarliestLastModifiedAge { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Operations { get; set; } + public string? Size { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SizeInBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int UncommittedOperations { get; set; } + public string? UncommittedSize { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long UncommittedSizeInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/WarmerStats.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WarmerStats.g.cs index 04da0755db4..422f1555416 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/WarmerStats.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WarmerStats.g.cs @@ -17,24 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class WarmerStatsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCurrent = System.Text.Json.JsonEncodedText.Encode("current"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTime = System.Text.Json.JsonEncodedText.Encode("total_time"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMillis = System.Text.Json.JsonEncodedText.Encode("total_time_in_millis"); + + public override Elastic.Clients.Elasticsearch.WarmerStats Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCurrent = default; + LocalJsonValue propTotal = default; + LocalJsonValue propTotalTime = default; + LocalJsonValue propTotalTimeInMillis = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCurrent.TryReadProperty(ref reader, options, PropCurrent, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalTime.TryReadProperty(ref reader, options, PropTotalTime, null)) + { + continue; + } + + if (propTotalTimeInMillis.TryReadProperty(ref reader, options, PropTotalTimeInMillis, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.WarmerStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Current = propCurrent.Value, + Total = propTotal.Value, + TotalTime = propTotalTime.Value, + TotalTimeInMillis = propTotalTimeInMillis.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WarmerStats value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCurrent, value.Current, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalTime, value.TotalTime, null, null); + writer.WriteProperty(options, PropTotalTimeInMillis, value.TotalTimeInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.WarmerStatsConverter))] public sealed partial class WarmerStats { - [JsonInclude, JsonPropertyName("current")] - public long Current { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } - [JsonInclude, JsonPropertyName("total_time")] - public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_millis")] - public long TotalTimeInMillis { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WarmerStats(long current, long total, System.TimeSpan totalTimeInMillis) + { + Current = current; + Total = total; + TotalTimeInMillis = totalTimeInMillis; + } +#if NET7_0_OR_GREATER + public WarmerStats() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WarmerStats() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WarmerStats(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Current { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } + public Elastic.Clients.Elasticsearch.Duration? TotalTime { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMillis { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs index 284e190233d..137ace316df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs @@ -17,43 +17,113 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; +internal sealed partial class WktGeoBoundsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropWkt = System.Text.Json.JsonEncodedText.Encode("wkt"); + + public override Elastic.Clients.Elasticsearch.WktGeoBounds Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propWkt = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propWkt.TryReadProperty(ref reader, options, PropWkt, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.WktGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Wkt = propWkt.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.WktGeoBounds value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropWkt, value.Wkt, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.WktGeoBoundsConverter))] public sealed partial class WktGeoBounds { - [JsonInclude, JsonPropertyName("wkt")] - public string Wkt { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WktGeoBounds(string wkt) + { + Wkt = wkt; + } +#if NET7_0_OR_GREATER + public WktGeoBounds() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WktGeoBounds() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WktGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string Wkt { get; set; } } -public sealed partial class WktGeoBoundsDescriptor : SerializableDescriptor +public readonly partial struct WktGeoBoundsDescriptor { - internal WktGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + internal Elastic.Clients.Elasticsearch.WktGeoBounds Instance { get; init; } - public WktGeoBoundsDescriptor() : base() + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WktGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.WktGeoBounds instance) { + Instance = instance; } - private string WktValue { get; set; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WktGeoBoundsDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.WktGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } - public WktGeoBoundsDescriptor Wkt(string wkt) + public static explicit operator Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor(Elastic.Clients.Elasticsearch.WktGeoBounds instance) => new Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.WktGeoBounds(Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor descriptor) => descriptor.Instance; + + public Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor Wkt(string value) { - WktValue = wkt; - return Self; + Instance.Wkt = value; + return this; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.WktGeoBounds Build(System.Action action) { - writer.WriteStartObject(); - writer.WritePropertyName("wkt"); - writer.WriteStringValue(WktValue); - writer.WriteEndObject(); + var builder = new Elastic.Clients.Elasticsearch.WktGeoBoundsDescriptor(new Elastic.Clients.Elasticsearch.WktGeoBounds(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Analytics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Analytics.g.cs index 538fc9b2b69..0d9fdee8a57 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Analytics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Analytics.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class AnalyticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropStats = System.Text.Json.JsonEncodedText.Encode("stats"); + + public override Elastic.Clients.Elasticsearch.Xpack.Analytics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propStats.TryReadProperty(ref reader, options, PropStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Analytics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + Stats = propStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Analytics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropStats, value.Stats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.AnalyticsConverter))] public sealed partial class Analytics { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("stats")] - public Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics Stats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Analytics(bool available, bool enabled, Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics stats) + { + Available = available; + Enabled = enabled; + Stats = stats; + } +#if NET7_0_OR_GREATER + public Analytics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Analytics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Analytics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics Stats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/AnalyticsStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/AnalyticsStatistics.g.cs index 12c118671c8..441b1e7ebab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/AnalyticsStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/AnalyticsStatistics.g.cs @@ -17,34 +17,194 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class AnalyticsStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBoxplotUsage = System.Text.Json.JsonEncodedText.Encode("boxplot_usage"); + private static readonly System.Text.Json.JsonEncodedText PropCumulativeCardinalityUsage = System.Text.Json.JsonEncodedText.Encode("cumulative_cardinality_usage"); + private static readonly System.Text.Json.JsonEncodedText PropMovingPercentilesUsage = System.Text.Json.JsonEncodedText.Encode("moving_percentiles_usage"); + private static readonly System.Text.Json.JsonEncodedText PropMultiTermsUsage = System.Text.Json.JsonEncodedText.Encode("multi_terms_usage"); + private static readonly System.Text.Json.JsonEncodedText PropNormalizeUsage = System.Text.Json.JsonEncodedText.Encode("normalize_usage"); + private static readonly System.Text.Json.JsonEncodedText PropRateUsage = System.Text.Json.JsonEncodedText.Encode("rate_usage"); + private static readonly System.Text.Json.JsonEncodedText PropStringStatsUsage = System.Text.Json.JsonEncodedText.Encode("string_stats_usage"); + private static readonly System.Text.Json.JsonEncodedText PropTopMetricsUsage = System.Text.Json.JsonEncodedText.Encode("top_metrics_usage"); + private static readonly System.Text.Json.JsonEncodedText PropTTestUsage = System.Text.Json.JsonEncodedText.Encode("t_test_usage"); + + public override Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBoxplotUsage = default; + LocalJsonValue propCumulativeCardinalityUsage = default; + LocalJsonValue propMovingPercentilesUsage = default; + LocalJsonValue propMultiTermsUsage = default; + LocalJsonValue propNormalizeUsage = default; + LocalJsonValue propRateUsage = default; + LocalJsonValue propStringStatsUsage = default; + LocalJsonValue propTopMetricsUsage = default; + LocalJsonValue propTTestUsage = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBoxplotUsage.TryReadProperty(ref reader, options, PropBoxplotUsage, null)) + { + continue; + } + + if (propCumulativeCardinalityUsage.TryReadProperty(ref reader, options, PropCumulativeCardinalityUsage, null)) + { + continue; + } + + if (propMovingPercentilesUsage.TryReadProperty(ref reader, options, PropMovingPercentilesUsage, null)) + { + continue; + } + + if (propMultiTermsUsage.TryReadProperty(ref reader, options, PropMultiTermsUsage, null)) + { + continue; + } + + if (propNormalizeUsage.TryReadProperty(ref reader, options, PropNormalizeUsage, null)) + { + continue; + } + + if (propRateUsage.TryReadProperty(ref reader, options, PropRateUsage, null)) + { + continue; + } + + if (propStringStatsUsage.TryReadProperty(ref reader, options, PropStringStatsUsage, null)) + { + continue; + } + + if (propTopMetricsUsage.TryReadProperty(ref reader, options, PropTopMetricsUsage, null)) + { + continue; + } + + if (propTTestUsage.TryReadProperty(ref reader, options, PropTTestUsage, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BoxplotUsage = propBoxplotUsage.Value, + CumulativeCardinalityUsage = propCumulativeCardinalityUsage.Value, + MovingPercentilesUsage = propMovingPercentilesUsage.Value, + MultiTermsUsage = propMultiTermsUsage.Value, + NormalizeUsage = propNormalizeUsage.Value, + RateUsage = propRateUsage.Value, + StringStatsUsage = propStringStatsUsage.Value, + TopMetricsUsage = propTopMetricsUsage.Value, + TTestUsage = propTTestUsage.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBoxplotUsage, value.BoxplotUsage, null, null); + writer.WriteProperty(options, PropCumulativeCardinalityUsage, value.CumulativeCardinalityUsage, null, null); + writer.WriteProperty(options, PropMovingPercentilesUsage, value.MovingPercentilesUsage, null, null); + writer.WriteProperty(options, PropMultiTermsUsage, value.MultiTermsUsage, null, null); + writer.WriteProperty(options, PropNormalizeUsage, value.NormalizeUsage, null, null); + writer.WriteProperty(options, PropRateUsage, value.RateUsage, null, null); + writer.WriteProperty(options, PropStringStatsUsage, value.StringStatsUsage, null, null); + writer.WriteProperty(options, PropTopMetricsUsage, value.TopMetricsUsage, null, null); + writer.WriteProperty(options, PropTTestUsage, value.TTestUsage, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.AnalyticsStatisticsConverter))] public sealed partial class AnalyticsStatistics { - [JsonInclude, JsonPropertyName("boxplot_usage")] - public long BoxplotUsage { get; init; } - [JsonInclude, JsonPropertyName("cumulative_cardinality_usage")] - public long CumulativeCardinalityUsage { get; init; } - [JsonInclude, JsonPropertyName("moving_percentiles_usage")] - public long MovingPercentilesUsage { get; init; } - [JsonInclude, JsonPropertyName("multi_terms_usage")] - public long? MultiTermsUsage { get; init; } - [JsonInclude, JsonPropertyName("normalize_usage")] - public long NormalizeUsage { get; init; } - [JsonInclude, JsonPropertyName("rate_usage")] - public long RateUsage { get; init; } - [JsonInclude, JsonPropertyName("string_stats_usage")] - public long StringStatsUsage { get; init; } - [JsonInclude, JsonPropertyName("top_metrics_usage")] - public long TopMetricsUsage { get; init; } - [JsonInclude, JsonPropertyName("t_test_usage")] - public long TTestUsage { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public AnalyticsStatistics(long boxplotUsage, long cumulativeCardinalityUsage, long movingPercentilesUsage, long normalizeUsage, long rateUsage, long stringStatsUsage, long topMetricsUsage, long tTestUsage) + { + BoxplotUsage = boxplotUsage; + CumulativeCardinalityUsage = cumulativeCardinalityUsage; + MovingPercentilesUsage = movingPercentilesUsage; + NormalizeUsage = normalizeUsage; + RateUsage = rateUsage; + StringStatsUsage = stringStatsUsage; + TopMetricsUsage = topMetricsUsage; + TTestUsage = tTestUsage; + } +#if NET7_0_OR_GREATER + public AnalyticsStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public AnalyticsStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal AnalyticsStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long BoxplotUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CumulativeCardinalityUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MovingPercentilesUsage { get; set; } + public long? MultiTermsUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NormalizeUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long RateUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long StringStatsUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TopMetricsUsage { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TTestUsage { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Archive.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Archive.g.cs index d9e3680fe49..6beea570a3d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Archive.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Archive.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class ArchiveConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesCount = System.Text.Json.JsonEncodedText.Encode("indices_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.Archive Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propIndicesCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propIndicesCount.TryReadProperty(ref reader, options, PropIndicesCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Archive(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + IndicesCount = propIndicesCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Archive value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropIndicesCount, value.IndicesCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.ArchiveConverter))] public sealed partial class Archive { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("indices_count")] - public long IndicesCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Archive(bool available, bool enabled, long indicesCount) + { + Available = available; + Enabled = enabled; + IndicesCount = indicesCount; + } +#if NET7_0_OR_GREATER + public Archive() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Archive() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Archive(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndicesCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Audit.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Audit.g.cs index 132da819d02..9c6d766d973 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Audit.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Audit.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class AuditConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropOutputs = System.Text.Json.JsonEncodedText.Encode("outputs"); + + public override Elastic.Clients.Elasticsearch.Xpack.Audit Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue?> propOutputs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propOutputs.TryReadProperty(ref reader, options, PropOutputs, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Audit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Outputs = propOutputs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Audit value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropOutputs, value.Outputs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.AuditConverter))] public sealed partial class Audit { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("outputs")] - public IReadOnlyCollection? Outputs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Audit(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Audit() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Audit() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Audit(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Outputs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Base.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Base.g.cs index 420fd303292..79ec67994da 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Base.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Base.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class BaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Xpack.Base Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Base(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Base value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.BaseConverter))] public sealed partial class Base { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Base(bool available, bool enabled) + { + Available = available; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Base() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Base() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Base(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/BuildInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/BuildInformation.g.cs index e0a6b18adc6..ba02104dac6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/BuildInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/BuildInformation.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class BuildInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDate = System.Text.Json.JsonEncodedText.Encode("date"); + private static readonly System.Text.Json.JsonEncodedText PropHash = System.Text.Json.JsonEncodedText.Encode("hash"); + + public override Elastic.Clients.Elasticsearch.Xpack.BuildInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDate = default; + LocalJsonValue propHash = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDate.TryReadProperty(ref reader, options, PropDate, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker)))) + { + continue; + } + + if (propHash.TryReadProperty(ref reader, options, PropHash, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.BuildInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Date = propDate.Value, + Hash = propHash.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.BuildInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDate, value.Date, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMarker))); + writer.WriteProperty(options, PropHash, value.Hash, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.BuildInformationConverter))] public sealed partial class BuildInformation { - [JsonInclude, JsonPropertyName("date")] - public DateTimeOffset Date { get; init; } - [JsonInclude, JsonPropertyName("hash")] - public string Hash { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BuildInformation(System.DateTimeOffset date, string hash) + { + Date = date; + Hash = hash; + } +#if NET7_0_OR_GREATER + public BuildInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public BuildInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal BuildInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset Date { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Hash { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ccr.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ccr.g.cs index 0d569ae2799..4e6d4251610 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ccr.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ccr.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class CcrConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAutoFollowPatternsCount = System.Text.Json.JsonEncodedText.Encode("auto_follow_patterns_count"); + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFollowerIndicesCount = System.Text.Json.JsonEncodedText.Encode("follower_indices_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.Ccr Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAutoFollowPatternsCount = default; + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFollowerIndicesCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAutoFollowPatternsCount.TryReadProperty(ref reader, options, PropAutoFollowPatternsCount, null)) + { + continue; + } + + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFollowerIndicesCount.TryReadProperty(ref reader, options, PropFollowerIndicesCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Ccr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AutoFollowPatternsCount = propAutoFollowPatternsCount.Value, + Available = propAvailable.Value, + Enabled = propEnabled.Value, + FollowerIndicesCount = propFollowerIndicesCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Ccr value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAutoFollowPatternsCount, value.AutoFollowPatternsCount, null, null); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFollowerIndicesCount, value.FollowerIndicesCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.CcrConverter))] public sealed partial class Ccr { - [JsonInclude, JsonPropertyName("auto_follow_patterns_count")] - public int AutoFollowPatternsCount { get; init; } - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("follower_indices_count")] - public int FollowerIndicesCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Ccr(int autoFollowPatternsCount, bool available, bool enabled, int followerIndicesCount) + { + AutoFollowPatternsCount = autoFollowPatternsCount; + Available = available; + Enabled = enabled; + FollowerIndicesCount = followerIndicesCount; + } +#if NET7_0_OR_GREATER + public Ccr() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Ccr() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ccr(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int AutoFollowPatternsCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int FollowerIndicesCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Counter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Counter.g.cs index 120310b71a1..75ff09fecfd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Counter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Counter.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class CounterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.Counter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActive = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActive.TryReadProperty(ref reader, options, PropActive, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Counter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Active = propActive.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Counter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActive, value.Active, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.CounterConverter))] public sealed partial class Counter { - [JsonInclude, JsonPropertyName("active")] - public long Active { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Counter(long active, long total) + { + Active = active; + Total = total; + } +#if NET7_0_OR_GREATER + public Counter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Counter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Counter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Active { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataStreams.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataStreams.g.cs index 3bb13dcf397..cf55327a80f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataStreams.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataStreams.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class DataStreamsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams2 = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesCount = System.Text.Json.JsonEncodedText.Encode("indices_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.DataStreams Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propDataStreams2 = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propIndicesCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propDataStreams2.TryReadProperty(ref reader, options, PropDataStreams2, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propIndicesCount.TryReadProperty(ref reader, options, PropIndicesCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.DataStreams(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + DataStreams2 = propDataStreams2.Value, + Enabled = propEnabled.Value, + IndicesCount = propIndicesCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.DataStreams value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropDataStreams2, value.DataStreams2, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropIndicesCount, value.IndicesCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.DataStreamsConverter))] public sealed partial class DataStreams { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("data_streams")] - public long DataStreams2 { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("indices_count")] - public long IndicesCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataStreams(bool available, long dataStreams2, bool enabled, long indicesCount) + { + Available = available; + DataStreams2 = dataStreams2; + Enabled = enabled; + IndicesCount = indicesCount; + } +#if NET7_0_OR_GREATER + public DataStreams() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataStreams() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataStreams(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DataStreams2 { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndicesCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTierPhaseStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTierPhaseStatistics.g.cs index 63c34137165..217d00368c9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTierPhaseStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTierPhaseStatistics.g.cs @@ -17,36 +17,214 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class DataTierPhaseStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDocCount = System.Text.Json.JsonEncodedText.Encode("doc_count"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText PropNodeCount = System.Text.Json.JsonEncodedText.Encode("node_count"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryShardCount = System.Text.Json.JsonEncodedText.Encode("primary_shard_count"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryShardSizeAvgBytes = System.Text.Json.JsonEncodedText.Encode("primary_shard_size_avg_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryShardSizeMadBytes = System.Text.Json.JsonEncodedText.Encode("primary_shard_size_mad_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPrimaryShardSizeMedianBytes = System.Text.Json.JsonEncodedText.Encode("primary_shard_size_median_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropPrimarySizeBytes = System.Text.Json.JsonEncodedText.Encode("primary_size_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTotalShardCount = System.Text.Json.JsonEncodedText.Encode("total_shard_count"); + private static readonly System.Text.Json.JsonEncodedText PropTotalSizeBytes = System.Text.Json.JsonEncodedText.Encode("total_size_bytes"); + + public override Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDocCount = default; + LocalJsonValue propIndexCount = default; + LocalJsonValue propNodeCount = default; + LocalJsonValue propPrimaryShardCount = default; + LocalJsonValue propPrimaryShardSizeAvgBytes = default; + LocalJsonValue propPrimaryShardSizeMadBytes = default; + LocalJsonValue propPrimaryShardSizeMedianBytes = default; + LocalJsonValue propPrimarySizeBytes = default; + LocalJsonValue propTotalShardCount = default; + LocalJsonValue propTotalSizeBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDocCount.TryReadProperty(ref reader, options, PropDocCount, null)) + { + continue; + } + + if (propIndexCount.TryReadProperty(ref reader, options, PropIndexCount, null)) + { + continue; + } + + if (propNodeCount.TryReadProperty(ref reader, options, PropNodeCount, null)) + { + continue; + } + + if (propPrimaryShardCount.TryReadProperty(ref reader, options, PropPrimaryShardCount, null)) + { + continue; + } + + if (propPrimaryShardSizeAvgBytes.TryReadProperty(ref reader, options, PropPrimaryShardSizeAvgBytes, null)) + { + continue; + } + + if (propPrimaryShardSizeMadBytes.TryReadProperty(ref reader, options, PropPrimaryShardSizeMadBytes, null)) + { + continue; + } + + if (propPrimaryShardSizeMedianBytes.TryReadProperty(ref reader, options, PropPrimaryShardSizeMedianBytes, null)) + { + continue; + } + + if (propPrimarySizeBytes.TryReadProperty(ref reader, options, PropPrimarySizeBytes, null)) + { + continue; + } + + if (propTotalShardCount.TryReadProperty(ref reader, options, PropTotalShardCount, null)) + { + continue; + } + + if (propTotalSizeBytes.TryReadProperty(ref reader, options, PropTotalSizeBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + DocCount = propDocCount.Value, + IndexCount = propIndexCount.Value, + NodeCount = propNodeCount.Value, + PrimaryShardCount = propPrimaryShardCount.Value, + PrimaryShardSizeAvgBytes = propPrimaryShardSizeAvgBytes.Value, + PrimaryShardSizeMadBytes = propPrimaryShardSizeMadBytes.Value, + PrimaryShardSizeMedianBytes = propPrimaryShardSizeMedianBytes.Value, + PrimarySizeBytes = propPrimarySizeBytes.Value, + TotalShardCount = propTotalShardCount.Value, + TotalSizeBytes = propTotalSizeBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDocCount, value.DocCount, null, null); + writer.WriteProperty(options, PropIndexCount, value.IndexCount, null, null); + writer.WriteProperty(options, PropNodeCount, value.NodeCount, null, null); + writer.WriteProperty(options, PropPrimaryShardCount, value.PrimaryShardCount, null, null); + writer.WriteProperty(options, PropPrimaryShardSizeAvgBytes, value.PrimaryShardSizeAvgBytes, null, null); + writer.WriteProperty(options, PropPrimaryShardSizeMadBytes, value.PrimaryShardSizeMadBytes, null, null); + writer.WriteProperty(options, PropPrimaryShardSizeMedianBytes, value.PrimaryShardSizeMedianBytes, null, null); + writer.WriteProperty(options, PropPrimarySizeBytes, value.PrimarySizeBytes, null, null); + writer.WriteProperty(options, PropTotalShardCount, value.TotalShardCount, null, null); + writer.WriteProperty(options, PropTotalSizeBytes, value.TotalSizeBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatisticsConverter))] public sealed partial class DataTierPhaseStatistics { - [JsonInclude, JsonPropertyName("doc_count")] - public long DocCount { get; init; } - [JsonInclude, JsonPropertyName("index_count")] - public long IndexCount { get; init; } - [JsonInclude, JsonPropertyName("node_count")] - public long NodeCount { get; init; } - [JsonInclude, JsonPropertyName("primary_shard_count")] - public long PrimaryShardCount { get; init; } - [JsonInclude, JsonPropertyName("primary_shard_size_avg_bytes")] - public long PrimaryShardSizeAvgBytes { get; init; } - [JsonInclude, JsonPropertyName("primary_shard_size_mad_bytes")] - public long PrimaryShardSizeMadBytes { get; init; } - [JsonInclude, JsonPropertyName("primary_shard_size_median_bytes")] - public long PrimaryShardSizeMedianBytes { get; init; } - [JsonInclude, JsonPropertyName("primary_size_bytes")] - public long PrimarySizeBytes { get; init; } - [JsonInclude, JsonPropertyName("total_shard_count")] - public long TotalShardCount { get; init; } - [JsonInclude, JsonPropertyName("total_size_bytes")] - public long TotalSizeBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataTierPhaseStatistics(long docCount, long indexCount, long nodeCount, long primaryShardCount, long primaryShardSizeAvgBytes, long primaryShardSizeMadBytes, long primaryShardSizeMedianBytes, long primarySizeBytes, long totalShardCount, long totalSizeBytes) + { + DocCount = docCount; + IndexCount = indexCount; + NodeCount = nodeCount; + PrimaryShardCount = primaryShardCount; + PrimaryShardSizeAvgBytes = primaryShardSizeAvgBytes; + PrimaryShardSizeMadBytes = primaryShardSizeMadBytes; + PrimaryShardSizeMedianBytes = primaryShardSizeMedianBytes; + PrimarySizeBytes = primarySizeBytes; + TotalShardCount = totalShardCount; + TotalSizeBytes = totalSizeBytes; + } +#if NET7_0_OR_GREATER + public DataTierPhaseStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataTierPhaseStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataTierPhaseStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long DocCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long NodeCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryShardCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryShardSizeAvgBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryShardSizeMadBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimaryShardSizeMedianBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long PrimarySizeBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalShardCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long TotalSizeBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTiers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTiers.g.cs index 03a49a676b7..8741ebf9cbf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTiers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/DataTiers.g.cs @@ -17,30 +17,164 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class DataTiersConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropDataCold = System.Text.Json.JsonEncodedText.Encode("data_cold"); + private static readonly System.Text.Json.JsonEncodedText PropDataContent = System.Text.Json.JsonEncodedText.Encode("data_content"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrozen = System.Text.Json.JsonEncodedText.Encode("data_frozen"); + private static readonly System.Text.Json.JsonEncodedText PropDataHot = System.Text.Json.JsonEncodedText.Encode("data_hot"); + private static readonly System.Text.Json.JsonEncodedText PropDataWarm = System.Text.Json.JsonEncodedText.Encode("data_warm"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Xpack.DataTiers Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propDataCold = default; + LocalJsonValue propDataContent = default; + LocalJsonValue propDataFrozen = default; + LocalJsonValue propDataHot = default; + LocalJsonValue propDataWarm = default; + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propDataCold.TryReadProperty(ref reader, options, PropDataCold, null)) + { + continue; + } + + if (propDataContent.TryReadProperty(ref reader, options, PropDataContent, null)) + { + continue; + } + + if (propDataFrozen.TryReadProperty(ref reader, options, PropDataFrozen, null)) + { + continue; + } + + if (propDataHot.TryReadProperty(ref reader, options, PropDataHot, null)) + { + continue; + } + + if (propDataWarm.TryReadProperty(ref reader, options, PropDataWarm, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.DataTiers(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + DataCold = propDataCold.Value, + DataContent = propDataContent.Value, + DataFrozen = propDataFrozen.Value, + DataHot = propDataHot.Value, + DataWarm = propDataWarm.Value, + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.DataTiers value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropDataCold, value.DataCold, null, null); + writer.WriteProperty(options, PropDataContent, value.DataContent, null, null); + writer.WriteProperty(options, PropDataFrozen, value.DataFrozen, null, null); + writer.WriteProperty(options, PropDataHot, value.DataHot, null, null); + writer.WriteProperty(options, PropDataWarm, value.DataWarm, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.DataTiersConverter))] public sealed partial class DataTiers { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("data_cold")] - public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataCold { get; init; } - [JsonInclude, JsonPropertyName("data_content")] - public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataContent { get; init; } - [JsonInclude, JsonPropertyName("data_frozen")] - public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics? DataFrozen { get; init; } - [JsonInclude, JsonPropertyName("data_hot")] - public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataHot { get; init; } - [JsonInclude, JsonPropertyName("data_warm")] - public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataWarm { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DataTiers(bool available, Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics dataCold, Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics dataContent, Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics dataHot, Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics dataWarm, bool enabled) + { + Available = available; + DataCold = dataCold; + DataContent = dataContent; + DataHot = dataHot; + DataWarm = dataWarm; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public DataTiers() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public DataTiers() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal DataTiers(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataCold { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataContent { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics? DataFrozen { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataHot { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.DataTierPhaseStatistics DataWarm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Datafeed.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Datafeed.g.cs index 4c19e3aa874..53fbc5b2211 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Datafeed.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Datafeed.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class DatafeedConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.Xpack.Datafeed Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Datafeed(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Datafeed value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.DatafeedConverter))] public sealed partial class Datafeed { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Datafeed(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public Datafeed() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Datafeed() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Datafeed(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Eql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Eql.g.cs index aeeff39388f..bd1b9e90372 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Eql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Eql.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + private static readonly System.Text.Json.JsonEncodedText PropQueries = System.Text.Json.JsonEncodedText.Encode("queries"); + + public override Elastic.Clients.Elasticsearch.Xpack.Eql Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFeatures = default; + LocalJsonValue> propQueries = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, null)) + { + continue; + } + + if (propQueries.TryReadProperty(ref reader, options, PropQueries, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Eql(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + Features = propFeatures.Value, + Queries = propQueries.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Eql value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFeatures, value.Features, null, null); + writer.WriteProperty(options, PropQueries, value.Queries, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlConverter))] public sealed partial class Eql { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("features")] - public Elastic.Clients.Elasticsearch.Xpack.EqlFeatures Features { get; init; } - [JsonInclude, JsonPropertyName("queries")] - public IReadOnlyDictionary Queries { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Eql(bool available, bool enabled, Elastic.Clients.Elasticsearch.Xpack.EqlFeatures features, System.Collections.Generic.IReadOnlyDictionary queries) + { + Available = available; + Enabled = enabled; + Features = features; + Queries = queries; + } +#if NET7_0_OR_GREATER + public Eql() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Eql() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Eql(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.EqlFeatures Features { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Queries { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeatures.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeatures.g.cs index e820c76935f..09f122ef007 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeatures.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeatures.g.cs @@ -17,30 +17,169 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlFeaturesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEvent = System.Text.Json.JsonEncodedText.Encode("event"); + private static readonly System.Text.Json.JsonEncodedText PropJoin = System.Text.Json.JsonEncodedText.Encode("join"); + private static readonly System.Text.Json.JsonEncodedText PropJoins = System.Text.Json.JsonEncodedText.Encode("joins"); + private static readonly System.Text.Json.JsonEncodedText PropKeys = System.Text.Json.JsonEncodedText.Encode("keys"); + private static readonly System.Text.Json.JsonEncodedText PropPipes = System.Text.Json.JsonEncodedText.Encode("pipes"); + private static readonly System.Text.Json.JsonEncodedText PropSequence = System.Text.Json.JsonEncodedText.Encode("sequence"); + private static readonly System.Text.Json.JsonEncodedText PropSequences = System.Text.Json.JsonEncodedText.Encode("sequences"); + + public override Elastic.Clients.Elasticsearch.Xpack.EqlFeatures Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEvent = default; + LocalJsonValue propJoin = default; + LocalJsonValue propJoins = default; + LocalJsonValue propKeys = default; + LocalJsonValue propPipes = default; + LocalJsonValue propSequence = default; + LocalJsonValue propSequences = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEvent.TryReadProperty(ref reader, options, PropEvent, null)) + { + continue; + } + + if (propJoin.TryReadProperty(ref reader, options, PropJoin, null)) + { + continue; + } + + if (propJoins.TryReadProperty(ref reader, options, PropJoins, null)) + { + continue; + } + + if (propKeys.TryReadProperty(ref reader, options, PropKeys, null)) + { + continue; + } + + if (propPipes.TryReadProperty(ref reader, options, PropPipes, null)) + { + continue; + } + + if (propSequence.TryReadProperty(ref reader, options, PropSequence, null)) + { + continue; + } + + if (propSequences.TryReadProperty(ref reader, options, PropSequences, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.EqlFeatures(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Event = propEvent.Value, + Join = propJoin.Value, + Joins = propJoins.Value, + Keys = propKeys.Value, + Pipes = propPipes.Value, + Sequence = propSequence.Value, + Sequences = propSequences.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.EqlFeatures value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEvent, value.Event, null, null); + writer.WriteProperty(options, PropJoin, value.Join, null, null); + writer.WriteProperty(options, PropJoins, value.Joins, null, null); + writer.WriteProperty(options, PropKeys, value.Keys, null, null); + writer.WriteProperty(options, PropPipes, value.Pipes, null, null); + writer.WriteProperty(options, PropSequence, value.Sequence, null, null); + writer.WriteProperty(options, PropSequences, value.Sequences, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesConverter))] public sealed partial class EqlFeatures { - [JsonInclude, JsonPropertyName("event")] - public int Event { get; init; } - [JsonInclude, JsonPropertyName("join")] - public int Join { get; init; } - [JsonInclude, JsonPropertyName("joins")] - public Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin Joins { get; init; } - [JsonInclude, JsonPropertyName("keys")] - public Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys Keys { get; init; } - [JsonInclude, JsonPropertyName("pipes")] - public Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes Pipes { get; init; } - [JsonInclude, JsonPropertyName("sequence")] - public int Sequence { get; init; } - [JsonInclude, JsonPropertyName("sequences")] - public Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences Sequences { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlFeatures(int @event, int join, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin joins, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys keys, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes pipes, int sequence, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences sequences) + { + Event = @event; + Join = join; + Joins = joins; + Keys = keys; + Pipes = pipes; + Sequence = sequence; + Sequences = sequences; + } +#if NET7_0_OR_GREATER + public EqlFeatures() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EqlFeatures() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlFeatures(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Event { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Join { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin Joins { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys Keys { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes Pipes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Sequence { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences Sequences { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesJoin.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesJoin.g.cs index 0761d68af39..c783eb6b40c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesJoin.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesJoin.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlFeaturesJoinConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropJoinQueriesFiveOrMore = System.Text.Json.JsonEncodedText.Encode("join_queries_five_or_more"); + private static readonly System.Text.Json.JsonEncodedText PropJoinQueriesFour = System.Text.Json.JsonEncodedText.Encode("join_queries_four"); + private static readonly System.Text.Json.JsonEncodedText PropJoinQueriesThree = System.Text.Json.JsonEncodedText.Encode("join_queries_three"); + private static readonly System.Text.Json.JsonEncodedText PropJoinQueriesTwo = System.Text.Json.JsonEncodedText.Encode("join_queries_two"); + private static readonly System.Text.Json.JsonEncodedText PropJoinUntil = System.Text.Json.JsonEncodedText.Encode("join_until"); + + public override Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propJoinQueriesFiveOrMore = default; + LocalJsonValue propJoinQueriesFour = default; + LocalJsonValue propJoinQueriesThree = default; + LocalJsonValue propJoinQueriesTwo = default; + LocalJsonValue propJoinUntil = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propJoinQueriesFiveOrMore.TryReadProperty(ref reader, options, PropJoinQueriesFiveOrMore, null)) + { + continue; + } + + if (propJoinQueriesFour.TryReadProperty(ref reader, options, PropJoinQueriesFour, null)) + { + continue; + } + + if (propJoinQueriesThree.TryReadProperty(ref reader, options, PropJoinQueriesThree, null)) + { + continue; + } + + if (propJoinQueriesTwo.TryReadProperty(ref reader, options, PropJoinQueriesTwo, null)) + { + continue; + } + + if (propJoinUntil.TryReadProperty(ref reader, options, PropJoinUntil, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + JoinQueriesFiveOrMore = propJoinQueriesFiveOrMore.Value, + JoinQueriesFour = propJoinQueriesFour.Value, + JoinQueriesThree = propJoinQueriesThree.Value, + JoinQueriesTwo = propJoinQueriesTwo.Value, + JoinUntil = propJoinUntil.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoin value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropJoinQueriesFiveOrMore, value.JoinQueriesFiveOrMore, null, null); + writer.WriteProperty(options, PropJoinQueriesFour, value.JoinQueriesFour, null, null); + writer.WriteProperty(options, PropJoinQueriesThree, value.JoinQueriesThree, null, null); + writer.WriteProperty(options, PropJoinQueriesTwo, value.JoinQueriesTwo, null, null); + writer.WriteProperty(options, PropJoinUntil, value.JoinUntil, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesJoinConverter))] public sealed partial class EqlFeaturesJoin { - [JsonInclude, JsonPropertyName("join_queries_five_or_more")] - public int JoinQueriesFiveOrMore { get; init; } - [JsonInclude, JsonPropertyName("join_queries_four")] - public int JoinQueriesFour { get; init; } - [JsonInclude, JsonPropertyName("join_queries_three")] - public int JoinQueriesThree { get; init; } - [JsonInclude, JsonPropertyName("join_queries_two")] - public int JoinQueriesTwo { get; init; } - [JsonInclude, JsonPropertyName("join_until")] - public int JoinUntil { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlFeaturesJoin(int joinQueriesFiveOrMore, int joinQueriesFour, int joinQueriesThree, int joinQueriesTwo, int joinUntil) + { + JoinQueriesFiveOrMore = joinQueriesFiveOrMore; + JoinQueriesFour = joinQueriesFour; + JoinQueriesThree = joinQueriesThree; + JoinQueriesTwo = joinQueriesTwo; + JoinUntil = joinUntil; + } +#if NET7_0_OR_GREATER + public EqlFeaturesJoin() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EqlFeaturesJoin() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlFeaturesJoin(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int JoinQueriesFiveOrMore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinQueriesFour { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinQueriesThree { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinQueriesTwo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinUntil { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesKeys.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesKeys.g.cs index cf94aae096c..33d25e376ae 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesKeys.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesKeys.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlFeaturesKeysConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropJoinKeysFiveOrMore = System.Text.Json.JsonEncodedText.Encode("join_keys_five_or_more"); + private static readonly System.Text.Json.JsonEncodedText PropJoinKeysFour = System.Text.Json.JsonEncodedText.Encode("join_keys_four"); + private static readonly System.Text.Json.JsonEncodedText PropJoinKeysOne = System.Text.Json.JsonEncodedText.Encode("join_keys_one"); + private static readonly System.Text.Json.JsonEncodedText PropJoinKeysThree = System.Text.Json.JsonEncodedText.Encode("join_keys_three"); + private static readonly System.Text.Json.JsonEncodedText PropJoinKeysTwo = System.Text.Json.JsonEncodedText.Encode("join_keys_two"); + + public override Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propJoinKeysFiveOrMore = default; + LocalJsonValue propJoinKeysFour = default; + LocalJsonValue propJoinKeysOne = default; + LocalJsonValue propJoinKeysThree = default; + LocalJsonValue propJoinKeysTwo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propJoinKeysFiveOrMore.TryReadProperty(ref reader, options, PropJoinKeysFiveOrMore, null)) + { + continue; + } + + if (propJoinKeysFour.TryReadProperty(ref reader, options, PropJoinKeysFour, null)) + { + continue; + } + + if (propJoinKeysOne.TryReadProperty(ref reader, options, PropJoinKeysOne, null)) + { + continue; + } + + if (propJoinKeysThree.TryReadProperty(ref reader, options, PropJoinKeysThree, null)) + { + continue; + } + + if (propJoinKeysTwo.TryReadProperty(ref reader, options, PropJoinKeysTwo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + JoinKeysFiveOrMore = propJoinKeysFiveOrMore.Value, + JoinKeysFour = propJoinKeysFour.Value, + JoinKeysOne = propJoinKeysOne.Value, + JoinKeysThree = propJoinKeysThree.Value, + JoinKeysTwo = propJoinKeysTwo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeys value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropJoinKeysFiveOrMore, value.JoinKeysFiveOrMore, null, null); + writer.WriteProperty(options, PropJoinKeysFour, value.JoinKeysFour, null, null); + writer.WriteProperty(options, PropJoinKeysOne, value.JoinKeysOne, null, null); + writer.WriteProperty(options, PropJoinKeysThree, value.JoinKeysThree, null, null); + writer.WriteProperty(options, PropJoinKeysTwo, value.JoinKeysTwo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesKeysConverter))] public sealed partial class EqlFeaturesKeys { - [JsonInclude, JsonPropertyName("join_keys_five_or_more")] - public int JoinKeysFiveOrMore { get; init; } - [JsonInclude, JsonPropertyName("join_keys_four")] - public int JoinKeysFour { get; init; } - [JsonInclude, JsonPropertyName("join_keys_one")] - public int JoinKeysOne { get; init; } - [JsonInclude, JsonPropertyName("join_keys_three")] - public int JoinKeysThree { get; init; } - [JsonInclude, JsonPropertyName("join_keys_two")] - public int JoinKeysTwo { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlFeaturesKeys(int joinKeysFiveOrMore, int joinKeysFour, int joinKeysOne, int joinKeysThree, int joinKeysTwo) + { + JoinKeysFiveOrMore = joinKeysFiveOrMore; + JoinKeysFour = joinKeysFour; + JoinKeysOne = joinKeysOne; + JoinKeysThree = joinKeysThree; + JoinKeysTwo = joinKeysTwo; + } +#if NET7_0_OR_GREATER + public EqlFeaturesKeys() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EqlFeaturesKeys() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlFeaturesKeys(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int JoinKeysFiveOrMore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinKeysFour { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinKeysOne { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinKeysThree { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int JoinKeysTwo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesPipes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesPipes.g.cs index 19703894702..9ee625fcfdb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesPipes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesPipes.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlFeaturesPipesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPipeHead = System.Text.Json.JsonEncodedText.Encode("pipe_head"); + private static readonly System.Text.Json.JsonEncodedText PropPipeTail = System.Text.Json.JsonEncodedText.Encode("pipe_tail"); + + public override Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPipeHead = default; + LocalJsonValue propPipeTail = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPipeHead.TryReadProperty(ref reader, options, PropPipeHead, null)) + { + continue; + } + + if (propPipeTail.TryReadProperty(ref reader, options, PropPipeTail, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PipeHead = propPipeHead.Value, + PipeTail = propPipeTail.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPipeHead, value.PipeHead, null, null); + writer.WriteProperty(options, PropPipeTail, value.PipeTail, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesPipesConverter))] public sealed partial class EqlFeaturesPipes { - [JsonInclude, JsonPropertyName("pipe_head")] - public int PipeHead { get; init; } - [JsonInclude, JsonPropertyName("pipe_tail")] - public int PipeTail { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlFeaturesPipes(int pipeHead, int pipeTail) + { + PipeHead = pipeHead; + PipeTail = pipeTail; + } +#if NET7_0_OR_GREATER + public EqlFeaturesPipes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EqlFeaturesPipes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlFeaturesPipes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int PipeHead { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int PipeTail { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesSequences.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesSequences.g.cs index d96ca705d3f..26b79cfac41 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesSequences.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/EqlFeaturesSequences.g.cs @@ -17,28 +17,154 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class EqlFeaturesSequencesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSequenceMaxspan = System.Text.Json.JsonEncodedText.Encode("sequence_maxspan"); + private static readonly System.Text.Json.JsonEncodedText PropSequenceQueriesFiveOrMore = System.Text.Json.JsonEncodedText.Encode("sequence_queries_five_or_more"); + private static readonly System.Text.Json.JsonEncodedText PropSequenceQueriesFour = System.Text.Json.JsonEncodedText.Encode("sequence_queries_four"); + private static readonly System.Text.Json.JsonEncodedText PropSequenceQueriesThree = System.Text.Json.JsonEncodedText.Encode("sequence_queries_three"); + private static readonly System.Text.Json.JsonEncodedText PropSequenceQueriesTwo = System.Text.Json.JsonEncodedText.Encode("sequence_queries_two"); + private static readonly System.Text.Json.JsonEncodedText PropSequenceUntil = System.Text.Json.JsonEncodedText.Encode("sequence_until"); + + public override Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSequenceMaxspan = default; + LocalJsonValue propSequenceQueriesFiveOrMore = default; + LocalJsonValue propSequenceQueriesFour = default; + LocalJsonValue propSequenceQueriesThree = default; + LocalJsonValue propSequenceQueriesTwo = default; + LocalJsonValue propSequenceUntil = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSequenceMaxspan.TryReadProperty(ref reader, options, PropSequenceMaxspan, null)) + { + continue; + } + + if (propSequenceQueriesFiveOrMore.TryReadProperty(ref reader, options, PropSequenceQueriesFiveOrMore, null)) + { + continue; + } + + if (propSequenceQueriesFour.TryReadProperty(ref reader, options, PropSequenceQueriesFour, null)) + { + continue; + } + + if (propSequenceQueriesThree.TryReadProperty(ref reader, options, PropSequenceQueriesThree, null)) + { + continue; + } + + if (propSequenceQueriesTwo.TryReadProperty(ref reader, options, PropSequenceQueriesTwo, null)) + { + continue; + } + + if (propSequenceUntil.TryReadProperty(ref reader, options, PropSequenceUntil, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + SequenceMaxspan = propSequenceMaxspan.Value, + SequenceQueriesFiveOrMore = propSequenceQueriesFiveOrMore.Value, + SequenceQueriesFour = propSequenceQueriesFour.Value, + SequenceQueriesThree = propSequenceQueriesThree.Value, + SequenceQueriesTwo = propSequenceQueriesTwo.Value, + SequenceUntil = propSequenceUntil.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequences value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSequenceMaxspan, value.SequenceMaxspan, null, null); + writer.WriteProperty(options, PropSequenceQueriesFiveOrMore, value.SequenceQueriesFiveOrMore, null, null); + writer.WriteProperty(options, PropSequenceQueriesFour, value.SequenceQueriesFour, null, null); + writer.WriteProperty(options, PropSequenceQueriesThree, value.SequenceQueriesThree, null, null); + writer.WriteProperty(options, PropSequenceQueriesTwo, value.SequenceQueriesTwo, null, null); + writer.WriteProperty(options, PropSequenceUntil, value.SequenceUntil, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.EqlFeaturesSequencesConverter))] public sealed partial class EqlFeaturesSequences { - [JsonInclude, JsonPropertyName("sequence_maxspan")] - public int SequenceMaxspan { get; init; } - [JsonInclude, JsonPropertyName("sequence_queries_five_or_more")] - public int SequenceQueriesFiveOrMore { get; init; } - [JsonInclude, JsonPropertyName("sequence_queries_four")] - public int SequenceQueriesFour { get; init; } - [JsonInclude, JsonPropertyName("sequence_queries_three")] - public int SequenceQueriesThree { get; init; } - [JsonInclude, JsonPropertyName("sequence_queries_two")] - public int SequenceQueriesTwo { get; init; } - [JsonInclude, JsonPropertyName("sequence_until")] - public int SequenceUntil { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public EqlFeaturesSequences(int sequenceMaxspan, int sequenceQueriesFiveOrMore, int sequenceQueriesFour, int sequenceQueriesThree, int sequenceQueriesTwo, int sequenceUntil) + { + SequenceMaxspan = sequenceMaxspan; + SequenceQueriesFiveOrMore = sequenceQueriesFiveOrMore; + SequenceQueriesFour = sequenceQueriesFour; + SequenceQueriesThree = sequenceQueriesThree; + SequenceQueriesTwo = sequenceQueriesTwo; + SequenceUntil = sequenceUntil; + } +#if NET7_0_OR_GREATER + public EqlFeaturesSequences() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public EqlFeaturesSequences() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal EqlFeaturesSequences(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceMaxspan { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceQueriesFiveOrMore { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceQueriesFour { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceQueriesThree { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceQueriesTwo { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int SequenceUntil { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Feature.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Feature.g.cs index d31c476d398..21a1d1e2128 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Feature.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Feature.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class FeatureConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropDescription = System.Text.Json.JsonEncodedText.Encode("description"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropNativeCodeInfo = System.Text.Json.JsonEncodedText.Encode("native_code_info"); + + public override Elastic.Clients.Elasticsearch.Xpack.Feature Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propDescription = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propNativeCodeInfo = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propDescription.TryReadProperty(ref reader, options, PropDescription, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propNativeCodeInfo.TryReadProperty(ref reader, options, PropNativeCodeInfo, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Feature(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Description = propDescription.Value, + Enabled = propEnabled.Value, + NativeCodeInfo = propNativeCodeInfo.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Feature value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropDescription, value.Description, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropNativeCodeInfo, value.NativeCodeInfo, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.FeatureConverter))] public sealed partial class Feature { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("description")] - public string? Description { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("native_code_info")] - public Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformation? NativeCodeInfo { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Feature(bool available, bool enabled) + { + Available = available; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Feature() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Feature() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Feature(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public string? Description { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformation? NativeCodeInfo { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FeatureToggle.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FeatureToggle.g.cs index e547848815b..edd61d95cc8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FeatureToggle.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/FeatureToggle.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class FeatureToggleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + + public override Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.FeatureToggle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.FeatureToggle value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.FeatureToggleConverter))] public sealed partial class FeatureToggle { - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public FeatureToggle(bool enabled) + { + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public FeatureToggle() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public FeatureToggle() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal FeatureToggle(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Features.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Features.g.cs index 8648694b682..00d2b91c2f5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Features.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Features.g.cs @@ -17,72 +17,464 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class FeaturesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAggregateMetric = System.Text.Json.JsonEncodedText.Encode("aggregate_metric"); + private static readonly System.Text.Json.JsonEncodedText PropAnalytics = System.Text.Json.JsonEncodedText.Encode("analytics"); + private static readonly System.Text.Json.JsonEncodedText PropArchive = System.Text.Json.JsonEncodedText.Encode("archive"); + private static readonly System.Text.Json.JsonEncodedText PropCcr = System.Text.Json.JsonEncodedText.Encode("ccr"); + private static readonly System.Text.Json.JsonEncodedText PropDataStreams = System.Text.Json.JsonEncodedText.Encode("data_streams"); + private static readonly System.Text.Json.JsonEncodedText PropDataTiers = System.Text.Json.JsonEncodedText.Encode("data_tiers"); + private static readonly System.Text.Json.JsonEncodedText PropEnrich = System.Text.Json.JsonEncodedText.Encode("enrich"); + private static readonly System.Text.Json.JsonEncodedText PropEnterpriseSearch = System.Text.Json.JsonEncodedText.Encode("enterprise_search"); + private static readonly System.Text.Json.JsonEncodedText PropEql = System.Text.Json.JsonEncodedText.Encode("eql"); + private static readonly System.Text.Json.JsonEncodedText PropEsql = System.Text.Json.JsonEncodedText.Encode("esql"); + private static readonly System.Text.Json.JsonEncodedText PropGraph = System.Text.Json.JsonEncodedText.Encode("graph"); + private static readonly System.Text.Json.JsonEncodedText PropIlm = System.Text.Json.JsonEncodedText.Encode("ilm"); + private static readonly System.Text.Json.JsonEncodedText PropLogsdb = System.Text.Json.JsonEncodedText.Encode("logsdb"); + private static readonly System.Text.Json.JsonEncodedText PropLogstash = System.Text.Json.JsonEncodedText.Encode("logstash"); + private static readonly System.Text.Json.JsonEncodedText PropMl = System.Text.Json.JsonEncodedText.Encode("ml"); + private static readonly System.Text.Json.JsonEncodedText PropMonitoring = System.Text.Json.JsonEncodedText.Encode("monitoring"); + private static readonly System.Text.Json.JsonEncodedText PropRollup = System.Text.Json.JsonEncodedText.Encode("rollup"); + private static readonly System.Text.Json.JsonEncodedText PropRuntimeFields = System.Text.Json.JsonEncodedText.Encode("runtime_fields"); + private static readonly System.Text.Json.JsonEncodedText PropSearchableSnapshots = System.Text.Json.JsonEncodedText.Encode("searchable_snapshots"); + private static readonly System.Text.Json.JsonEncodedText PropSecurity = System.Text.Json.JsonEncodedText.Encode("security"); + private static readonly System.Text.Json.JsonEncodedText PropSlm = System.Text.Json.JsonEncodedText.Encode("slm"); + private static readonly System.Text.Json.JsonEncodedText PropSpatial = System.Text.Json.JsonEncodedText.Encode("spatial"); + private static readonly System.Text.Json.JsonEncodedText PropSql = System.Text.Json.JsonEncodedText.Encode("sql"); + private static readonly System.Text.Json.JsonEncodedText PropTransform = System.Text.Json.JsonEncodedText.Encode("transform"); + private static readonly System.Text.Json.JsonEncodedText PropUniversalProfiling = System.Text.Json.JsonEncodedText.Encode("universal_profiling"); + private static readonly System.Text.Json.JsonEncodedText PropVotingOnly = System.Text.Json.JsonEncodedText.Encode("voting_only"); + private static readonly System.Text.Json.JsonEncodedText PropWatcher = System.Text.Json.JsonEncodedText.Encode("watcher"); + + public override Elastic.Clients.Elasticsearch.Xpack.Features Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAggregateMetric = default; + LocalJsonValue propAnalytics = default; + LocalJsonValue propArchive = default; + LocalJsonValue propCcr = default; + LocalJsonValue propDataStreams = default; + LocalJsonValue propDataTiers = default; + LocalJsonValue propEnrich = default; + LocalJsonValue propEnterpriseSearch = default; + LocalJsonValue propEql = default; + LocalJsonValue propEsql = default; + LocalJsonValue propGraph = default; + LocalJsonValue propIlm = default; + LocalJsonValue propLogsdb = default; + LocalJsonValue propLogstash = default; + LocalJsonValue propMl = default; + LocalJsonValue propMonitoring = default; + LocalJsonValue propRollup = default; + LocalJsonValue propRuntimeFields = default; + LocalJsonValue propSearchableSnapshots = default; + LocalJsonValue propSecurity = default; + LocalJsonValue propSlm = default; + LocalJsonValue propSpatial = default; + LocalJsonValue propSql = default; + LocalJsonValue propTransform = default; + LocalJsonValue propUniversalProfiling = default; + LocalJsonValue propVotingOnly = default; + LocalJsonValue propWatcher = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAggregateMetric.TryReadProperty(ref reader, options, PropAggregateMetric, null)) + { + continue; + } + + if (propAnalytics.TryReadProperty(ref reader, options, PropAnalytics, null)) + { + continue; + } + + if (propArchive.TryReadProperty(ref reader, options, PropArchive, null)) + { + continue; + } + + if (propCcr.TryReadProperty(ref reader, options, PropCcr, null)) + { + continue; + } + + if (propDataStreams.TryReadProperty(ref reader, options, PropDataStreams, null)) + { + continue; + } + + if (propDataTiers.TryReadProperty(ref reader, options, PropDataTiers, null)) + { + continue; + } + + if (propEnrich.TryReadProperty(ref reader, options, PropEnrich, null)) + { + continue; + } + + if (propEnterpriseSearch.TryReadProperty(ref reader, options, PropEnterpriseSearch, null)) + { + continue; + } + + if (propEql.TryReadProperty(ref reader, options, PropEql, null)) + { + continue; + } + + if (propEsql.TryReadProperty(ref reader, options, PropEsql, null)) + { + continue; + } + + if (propGraph.TryReadProperty(ref reader, options, PropGraph, null)) + { + continue; + } + + if (propIlm.TryReadProperty(ref reader, options, PropIlm, null)) + { + continue; + } + + if (propLogsdb.TryReadProperty(ref reader, options, PropLogsdb, null)) + { + continue; + } + + if (propLogstash.TryReadProperty(ref reader, options, PropLogstash, null)) + { + continue; + } + + if (propMl.TryReadProperty(ref reader, options, PropMl, null)) + { + continue; + } + + if (propMonitoring.TryReadProperty(ref reader, options, PropMonitoring, null)) + { + continue; + } + + if (propRollup.TryReadProperty(ref reader, options, PropRollup, null)) + { + continue; + } + + if (propRuntimeFields.TryReadProperty(ref reader, options, PropRuntimeFields, null)) + { + continue; + } + + if (propSearchableSnapshots.TryReadProperty(ref reader, options, PropSearchableSnapshots, null)) + { + continue; + } + + if (propSecurity.TryReadProperty(ref reader, options, PropSecurity, null)) + { + continue; + } + + if (propSlm.TryReadProperty(ref reader, options, PropSlm, null)) + { + continue; + } + + if (propSpatial.TryReadProperty(ref reader, options, PropSpatial, null)) + { + continue; + } + + if (propSql.TryReadProperty(ref reader, options, PropSql, null)) + { + continue; + } + + if (propTransform.TryReadProperty(ref reader, options, PropTransform, null)) + { + continue; + } + + if (propUniversalProfiling.TryReadProperty(ref reader, options, PropUniversalProfiling, null)) + { + continue; + } + + if (propVotingOnly.TryReadProperty(ref reader, options, PropVotingOnly, null)) + { + continue; + } + + if (propWatcher.TryReadProperty(ref reader, options, PropWatcher, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Features(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + AggregateMetric = propAggregateMetric.Value, + Analytics = propAnalytics.Value, + Archive = propArchive.Value, + Ccr = propCcr.Value, + DataStreams = propDataStreams.Value, + DataTiers = propDataTiers.Value, + Enrich = propEnrich.Value, + EnterpriseSearch = propEnterpriseSearch.Value, + Eql = propEql.Value, + Esql = propEsql.Value, + Graph = propGraph.Value, + Ilm = propIlm.Value, + Logsdb = propLogsdb.Value, + Logstash = propLogstash.Value, + Ml = propMl.Value, + Monitoring = propMonitoring.Value, + Rollup = propRollup.Value, + RuntimeFields = propRuntimeFields.Value, + SearchableSnapshots = propSearchableSnapshots.Value, + Security = propSecurity.Value, + Slm = propSlm.Value, + Spatial = propSpatial.Value, + Sql = propSql.Value, + Transform = propTransform.Value, + UniversalProfiling = propUniversalProfiling.Value, + VotingOnly = propVotingOnly.Value, + Watcher = propWatcher.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Features value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAggregateMetric, value.AggregateMetric, null, null); + writer.WriteProperty(options, PropAnalytics, value.Analytics, null, null); + writer.WriteProperty(options, PropArchive, value.Archive, null, null); + writer.WriteProperty(options, PropCcr, value.Ccr, null, null); + writer.WriteProperty(options, PropDataStreams, value.DataStreams, null, null); + writer.WriteProperty(options, PropDataTiers, value.DataTiers, null, null); + writer.WriteProperty(options, PropEnrich, value.Enrich, null, null); + writer.WriteProperty(options, PropEnterpriseSearch, value.EnterpriseSearch, null, null); + writer.WriteProperty(options, PropEql, value.Eql, null, null); + writer.WriteProperty(options, PropEsql, value.Esql, null, null); + writer.WriteProperty(options, PropGraph, value.Graph, null, null); + writer.WriteProperty(options, PropIlm, value.Ilm, null, null); + writer.WriteProperty(options, PropLogsdb, value.Logsdb, null, null); + writer.WriteProperty(options, PropLogstash, value.Logstash, null, null); + writer.WriteProperty(options, PropMl, value.Ml, null, null); + writer.WriteProperty(options, PropMonitoring, value.Monitoring, null, null); + writer.WriteProperty(options, PropRollup, value.Rollup, null, null); + writer.WriteProperty(options, PropRuntimeFields, value.RuntimeFields, null, null); + writer.WriteProperty(options, PropSearchableSnapshots, value.SearchableSnapshots, null, null); + writer.WriteProperty(options, PropSecurity, value.Security, null, null); + writer.WriteProperty(options, PropSlm, value.Slm, null, null); + writer.WriteProperty(options, PropSpatial, value.Spatial, null, null); + writer.WriteProperty(options, PropSql, value.Sql, null, null); + writer.WriteProperty(options, PropTransform, value.Transform, null, null); + writer.WriteProperty(options, PropUniversalProfiling, value.UniversalProfiling, null, null); + writer.WriteProperty(options, PropVotingOnly, value.VotingOnly, null, null); + writer.WriteProperty(options, PropWatcher, value.Watcher, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.FeaturesConverter))] public sealed partial class Features { - [JsonInclude, JsonPropertyName("aggregate_metric")] - public Elastic.Clients.Elasticsearch.Xpack.Feature AggregateMetric { get; init; } - [JsonInclude, JsonPropertyName("analytics")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Analytics { get; init; } - [JsonInclude, JsonPropertyName("archive")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Archive { get; init; } - [JsonInclude, JsonPropertyName("ccr")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Ccr { get; init; } - [JsonInclude, JsonPropertyName("data_streams")] - public Elastic.Clients.Elasticsearch.Xpack.Feature DataStreams { get; init; } - [JsonInclude, JsonPropertyName("data_tiers")] - public Elastic.Clients.Elasticsearch.Xpack.Feature DataTiers { get; init; } - [JsonInclude, JsonPropertyName("enrich")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Enrich { get; init; } - [JsonInclude, JsonPropertyName("enterprise_search")] - public Elastic.Clients.Elasticsearch.Xpack.Feature EnterpriseSearch { get; init; } - [JsonInclude, JsonPropertyName("eql")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Eql { get; init; } - [JsonInclude, JsonPropertyName("esql")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Esql { get; init; } - [JsonInclude, JsonPropertyName("frozen_indices")] - public Elastic.Clients.Elasticsearch.Xpack.Feature FrozenIndices { get; init; } - [JsonInclude, JsonPropertyName("graph")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Graph { get; init; } - [JsonInclude, JsonPropertyName("ilm")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Ilm { get; init; } - [JsonInclude, JsonPropertyName("logsdb")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Logsdb { get; init; } - [JsonInclude, JsonPropertyName("logstash")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Logstash { get; init; } - [JsonInclude, JsonPropertyName("ml")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Ml { get; init; } - [JsonInclude, JsonPropertyName("monitoring")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Monitoring { get; init; } - [JsonInclude, JsonPropertyName("rollup")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Rollup { get; init; } - [JsonInclude, JsonPropertyName("runtime_fields")] - public Elastic.Clients.Elasticsearch.Xpack.Feature? RuntimeFields { get; init; } - [JsonInclude, JsonPropertyName("searchable_snapshots")] - public Elastic.Clients.Elasticsearch.Xpack.Feature SearchableSnapshots { get; init; } - [JsonInclude, JsonPropertyName("security")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Security { get; init; } - [JsonInclude, JsonPropertyName("slm")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Slm { get; init; } - [JsonInclude, JsonPropertyName("spatial")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Spatial { get; init; } - [JsonInclude, JsonPropertyName("sql")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Sql { get; init; } - [JsonInclude, JsonPropertyName("transform")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Transform { get; init; } - [JsonInclude, JsonPropertyName("universal_profiling")] - public Elastic.Clients.Elasticsearch.Xpack.Feature UniversalProfiling { get; init; } - [JsonInclude, JsonPropertyName("voting_only")] - public Elastic.Clients.Elasticsearch.Xpack.Feature VotingOnly { get; init; } - [JsonInclude, JsonPropertyName("watcher")] - public Elastic.Clients.Elasticsearch.Xpack.Feature Watcher { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Features(Elastic.Clients.Elasticsearch.Xpack.Feature aggregateMetric, Elastic.Clients.Elasticsearch.Xpack.Feature analytics, Elastic.Clients.Elasticsearch.Xpack.Feature archive, Elastic.Clients.Elasticsearch.Xpack.Feature ccr, Elastic.Clients.Elasticsearch.Xpack.Feature dataStreams, Elastic.Clients.Elasticsearch.Xpack.Feature dataTiers, Elastic.Clients.Elasticsearch.Xpack.Feature enrich, Elastic.Clients.Elasticsearch.Xpack.Feature enterpriseSearch, Elastic.Clients.Elasticsearch.Xpack.Feature eql, Elastic.Clients.Elasticsearch.Xpack.Feature esql, Elastic.Clients.Elasticsearch.Xpack.Feature graph, Elastic.Clients.Elasticsearch.Xpack.Feature ilm, Elastic.Clients.Elasticsearch.Xpack.Feature logsdb, Elastic.Clients.Elasticsearch.Xpack.Feature logstash, Elastic.Clients.Elasticsearch.Xpack.Feature ml, Elastic.Clients.Elasticsearch.Xpack.Feature monitoring, Elastic.Clients.Elasticsearch.Xpack.Feature rollup, Elastic.Clients.Elasticsearch.Xpack.Feature searchableSnapshots, Elastic.Clients.Elasticsearch.Xpack.Feature security, Elastic.Clients.Elasticsearch.Xpack.Feature slm, Elastic.Clients.Elasticsearch.Xpack.Feature spatial, Elastic.Clients.Elasticsearch.Xpack.Feature sql, Elastic.Clients.Elasticsearch.Xpack.Feature transform, Elastic.Clients.Elasticsearch.Xpack.Feature universalProfiling, Elastic.Clients.Elasticsearch.Xpack.Feature votingOnly, Elastic.Clients.Elasticsearch.Xpack.Feature watcher) + { + AggregateMetric = aggregateMetric; + Analytics = analytics; + Archive = archive; + Ccr = ccr; + DataStreams = dataStreams; + DataTiers = dataTiers; + Enrich = enrich; + EnterpriseSearch = enterpriseSearch; + Eql = eql; + Esql = esql; + Graph = graph; + Ilm = ilm; + Logsdb = logsdb; + Logstash = logstash; + Ml = ml; + Monitoring = monitoring; + Rollup = rollup; + SearchableSnapshots = searchableSnapshots; + Security = security; + Slm = slm; + Spatial = spatial; + Sql = sql; + Transform = transform; + UniversalProfiling = universalProfiling; + VotingOnly = votingOnly; + Watcher = watcher; + } +#if NET7_0_OR_GREATER + public Features() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Features() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Features(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature AggregateMetric { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Analytics { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Archive { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Ccr { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature DataStreams { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature DataTiers { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Enrich { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature EnterpriseSearch { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Eql { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Esql { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Graph { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Ilm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Logsdb { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Logstash { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Ml { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Monitoring { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Rollup { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Feature? RuntimeFields { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature SearchableSnapshots { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Security { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Slm { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Spatial { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Sql { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Transform { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature UniversalProfiling { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature VotingOnly { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Feature Watcher { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Flattened.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Flattened.g.cs index dccb63491cf..beea7377311 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Flattened.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Flattened.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class FlattenedConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFieldCount = System.Text.Json.JsonEncodedText.Encode("field_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.Flattened Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFieldCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFieldCount.TryReadProperty(ref reader, options, PropFieldCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Flattened(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + FieldCount = propFieldCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Flattened value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFieldCount, value.FieldCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.FlattenedConverter))] public sealed partial class Flattened { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("field_count")] - public int FieldCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Flattened(bool available, bool enabled, int fieldCount) + { + Available = available; + Enabled = enabled; + FieldCount = fieldCount; + } +#if NET7_0_OR_GREATER + public Flattened() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Flattened() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Flattened(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int FieldCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/HealthStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/HealthStatistics.g.cs index 6cabfd845bd..494a0a5b529 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/HealthStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/HealthStatistics.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class HealthStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropInvocations = System.Text.Json.JsonEncodedText.Encode("invocations"); + + public override Elastic.Clients.Elasticsearch.Xpack.HealthStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propInvocations = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propInvocations.TryReadProperty(ref reader, options, PropInvocations, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.HealthStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + Invocations = propInvocations.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.HealthStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropInvocations, value.Invocations, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.HealthStatisticsConverter))] public sealed partial class HealthStatistics { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("invocations")] - public Elastic.Clients.Elasticsearch.Xpack.Invocations Invocations { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public HealthStatistics(bool available, bool enabled, Elastic.Clients.Elasticsearch.Xpack.Invocations invocations) + { + Available = available; + Enabled = enabled; + Invocations = invocations; + } +#if NET7_0_OR_GREATER + public HealthStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public HealthStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal HealthStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Invocations Invocations { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ilm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ilm.g.cs index 5f1a8cd67db..c9d7dca702b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ilm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ilm.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class IlmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPolicyCount = System.Text.Json.JsonEncodedText.Encode("policy_count"); + private static readonly System.Text.Json.JsonEncodedText PropPolicyStats = System.Text.Json.JsonEncodedText.Encode("policy_stats"); + + public override Elastic.Clients.Elasticsearch.Xpack.Ilm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPolicyCount = default; + LocalJsonValue> propPolicyStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPolicyCount.TryReadProperty(ref reader, options, PropPolicyCount, null)) + { + continue; + } + + if (propPolicyStats.TryReadProperty(ref reader, options, PropPolicyStats, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Ilm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PolicyCount = propPolicyCount.Value, + PolicyStats = propPolicyStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Ilm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPolicyCount, value.PolicyCount, null, null); + writer.WriteProperty(options, PropPolicyStats, value.PolicyStats, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.IlmConverter))] public sealed partial class Ilm { - [JsonInclude, JsonPropertyName("policy_count")] - public int PolicyCount { get; init; } - [JsonInclude, JsonPropertyName("policy_stats")] - public IReadOnlyCollection PolicyStats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Ilm(int policyCount, System.Collections.Generic.IReadOnlyCollection policyStats) + { + PolicyCount = policyCount; + PolicyStats = policyStats; + } +#if NET7_0_OR_GREATER + public Ilm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Ilm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ilm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int PolicyCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection PolicyStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IlmPolicyStatistics.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IlmPolicyStatistics.g.cs index be0d3fda2f1..f51d4c70976 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IlmPolicyStatistics.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IlmPolicyStatistics.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class IlmPolicyStatisticsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropIndicesManaged = System.Text.Json.JsonEncodedText.Encode("indices_managed"); + private static readonly System.Text.Json.JsonEncodedText PropPhases = System.Text.Json.JsonEncodedText.Encode("phases"); + + public override Elastic.Clients.Elasticsearch.Xpack.IlmPolicyStatistics Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propIndicesManaged = default; + LocalJsonValue propPhases = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propIndicesManaged.TryReadProperty(ref reader, options, PropIndicesManaged, null)) + { + continue; + } + + if (propPhases.TryReadProperty(ref reader, options, PropPhases, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.IlmPolicyStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + IndicesManaged = propIndicesManaged.Value, + Phases = propPhases.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.IlmPolicyStatistics value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropIndicesManaged, value.IndicesManaged, null, null); + writer.WriteProperty(options, PropPhases, value.Phases, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.IlmPolicyStatisticsConverter))] public sealed partial class IlmPolicyStatistics { - [JsonInclude, JsonPropertyName("indices_managed")] - public int IndicesManaged { get; init; } - [JsonInclude, JsonPropertyName("phases")] - public Elastic.Clients.Elasticsearch.Xpack.Phases Phases { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IlmPolicyStatistics(int indicesManaged, Elastic.Clients.Elasticsearch.Xpack.Phases phases) + { + IndicesManaged = indicesManaged; + Phases = phases; + } +#if NET7_0_OR_GREATER + public IlmPolicyStatistics() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IlmPolicyStatistics() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IlmPolicyStatistics(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int IndicesManaged { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Phases Phases { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Invocations.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Invocations.g.cs index 620cd40ce5c..cf00013a53d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Invocations.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Invocations.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class InvocationsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.Invocations Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Invocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Invocations value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.InvocationsConverter))] public sealed partial class Invocations { - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Invocations(long total) + { + Total = total; + } +#if NET7_0_OR_GREATER + public Invocations() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Invocations() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Invocations(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IpFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IpFilter.g.cs index 63922a45741..7591bdc9b15 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IpFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/IpFilter.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class IpFilterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + + public override Elastic.Clients.Elasticsearch.Xpack.IpFilter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHttp = default; + LocalJsonValue propTransport = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.IpFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Http = propHttp.Value, + Transport = propTransport.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.IpFilter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.IpFilterConverter))] public sealed partial class IpFilter { - [JsonInclude, JsonPropertyName("http")] - public bool Http { get; init; } - [JsonInclude, JsonPropertyName("transport")] - public bool Transport { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public IpFilter(bool http, bool transport) + { + Http = http; + Transport = transport; + } +#if NET7_0_OR_GREATER + public IpFilter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public IpFilter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal IpFilter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Http { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Transport { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/JobUsage.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/JobUsage.g.cs index b6a7c4a4f12..3a77f4c2077 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/JobUsage.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/JobUsage.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class JobUsageConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropCreatedBy = System.Text.Json.JsonEncodedText.Encode("created_by"); + private static readonly System.Text.Json.JsonEncodedText PropDetectors = System.Text.Json.JsonEncodedText.Encode("detectors"); + private static readonly System.Text.Json.JsonEncodedText PropForecasts = System.Text.Json.JsonEncodedText.Encode("forecasts"); + private static readonly System.Text.Json.JsonEncodedText PropModelSize = System.Text.Json.JsonEncodedText.Encode("model_size"); + + public override Elastic.Clients.Elasticsearch.Xpack.JobUsage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue> propCreatedBy = default; + LocalJsonValue propDetectors = default; + LocalJsonValue propForecasts = default; + LocalJsonValue propModelSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propCreatedBy.TryReadProperty(ref reader, options, PropCreatedBy, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propDetectors.TryReadProperty(ref reader, options, PropDetectors, null)) + { + continue; + } + + if (propForecasts.TryReadProperty(ref reader, options, PropForecasts, null)) + { + continue; + } + + if (propModelSize.TryReadProperty(ref reader, options, PropModelSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.JobUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + CreatedBy = propCreatedBy.Value, + Detectors = propDetectors.Value, + Forecasts = propForecasts.Value, + ModelSize = propModelSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.JobUsage value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropCreatedBy, value.CreatedBy, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDetectors, value.Detectors, null, null); + writer.WriteProperty(options, PropForecasts, value.Forecasts, null, null); + writer.WriteProperty(options, PropModelSize, value.ModelSize, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.JobUsageConverter))] public sealed partial class JobUsage { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("created_by")] - public IReadOnlyDictionary CreatedBy { get; init; } - [JsonInclude, JsonPropertyName("detectors")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics Detectors { get; init; } - [JsonInclude, JsonPropertyName("forecasts")] - public Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts Forecasts { get; init; } - [JsonInclude, JsonPropertyName("model_size")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics ModelSize { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public JobUsage(int count, System.Collections.Generic.IReadOnlyDictionary createdBy, Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics detectors, Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts forecasts, Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics modelSize) + { + Count = count; + CreatedBy = createdBy; + Detectors = detectors; + Forecasts = forecasts; + ModelSize = modelSize; + } +#if NET7_0_OR_GREATER + public JobUsage() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public JobUsage() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal JobUsage(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary CreatedBy { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics Detectors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts Forecasts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics ModelSize { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MachineLearning.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MachineLearning.g.cs index 7dda0c6f6c4..40f30e25c63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MachineLearning.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MachineLearning.g.cs @@ -17,36 +17,175 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MachineLearningConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropDatafeeds = System.Text.Json.JsonEncodedText.Encode("datafeeds"); + private static readonly System.Text.Json.JsonEncodedText PropDataFrameAnalyticsJobs = System.Text.Json.JsonEncodedText.Encode("data_frame_analytics_jobs"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropInference = System.Text.Json.JsonEncodedText.Encode("inference"); + private static readonly System.Text.Json.JsonEncodedText PropJobs = System.Text.Json.JsonEncodedText.Encode("jobs"); + private static readonly System.Text.Json.JsonEncodedText PropNodeCount = System.Text.Json.JsonEncodedText.Encode("node_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.MachineLearning Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue> propDatafeeds = default; + LocalJsonValue propDataFrameAnalyticsJobs = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propInference = default; + LocalJsonValue> propJobs = default; + LocalJsonValue propNodeCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propDatafeeds.TryReadProperty(ref reader, options, PropDatafeeds, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propDataFrameAnalyticsJobs.TryReadProperty(ref reader, options, PropDataFrameAnalyticsJobs, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propInference.TryReadProperty(ref reader, options, PropInference, null)) + { + continue; + } + + if (propJobs.TryReadProperty(ref reader, options, PropJobs, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propNodeCount.TryReadProperty(ref reader, options, PropNodeCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MachineLearning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Datafeeds = propDatafeeds.Value, + DataFrameAnalyticsJobs = propDataFrameAnalyticsJobs.Value, + Enabled = propEnabled.Value, + Inference = propInference.Value, + Jobs = propJobs.Value, + NodeCount = propNodeCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MachineLearning value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropDatafeeds, value.Datafeeds, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropDataFrameAnalyticsJobs, value.DataFrameAnalyticsJobs, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropInference, value.Inference, null, null); + writer.WriteProperty(options, PropJobs, value.Jobs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropNodeCount, value.NodeCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MachineLearningConverter))] public sealed partial class MachineLearning { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("datafeeds")] - public IReadOnlyDictionary Datafeeds { get; init; } - [JsonInclude, JsonPropertyName("data_frame_analytics_jobs")] - public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs DataFrameAnalyticsJobs { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("inference")] - public Elastic.Clients.Elasticsearch.Xpack.MlInference Inference { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MachineLearning(bool available, System.Collections.Generic.IReadOnlyDictionary datafeeds, Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs dataFrameAnalyticsJobs, bool enabled, Elastic.Clients.Elasticsearch.Xpack.MlInference inference, System.Collections.Generic.IReadOnlyDictionary jobs, int nodeCount) + { + Available = available; + Datafeeds = datafeeds; + DataFrameAnalyticsJobs = dataFrameAnalyticsJobs; + Enabled = enabled; + Inference = inference; + Jobs = jobs; + NodeCount = nodeCount; + } +#if NET7_0_OR_GREATER + public MachineLearning() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MachineLearning() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MachineLearning(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Datafeeds { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs DataFrameAnalyticsJobs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInference Inference { get; set; } /// /// /// Job usage statistics. The _all entry is always present and gathers statistics for all jobs. /// /// - [JsonInclude, JsonPropertyName("jobs")] - public IReadOnlyDictionary Jobs { get; init; } - [JsonInclude, JsonPropertyName("node_count")] - public int NodeCount { get; init; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Jobs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int NodeCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MinimalLicenseInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MinimalLicenseInformation.g.cs index 3e02ab1c587..5b4c62bc26b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MinimalLicenseInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MinimalLicenseInformation.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MinimalLicenseInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropExpiryDateInMillis = System.Text.Json.JsonEncodedText.Encode("expiry_date_in_millis"); + private static readonly System.Text.Json.JsonEncodedText PropMode = System.Text.Json.JsonEncodedText.Encode("mode"); + private static readonly System.Text.Json.JsonEncodedText PropStatus = System.Text.Json.JsonEncodedText.Encode("status"); + private static readonly System.Text.Json.JsonEncodedText PropType = System.Text.Json.JsonEncodedText.Encode("type"); + private static readonly System.Text.Json.JsonEncodedText PropUid = System.Text.Json.JsonEncodedText.Encode("uid"); + + public override Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propExpiryDateInMillis = default; + LocalJsonValue propMode = default; + LocalJsonValue propStatus = default; + LocalJsonValue propType = default; + LocalJsonValue propUid = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propExpiryDateInMillis.TryReadProperty(ref reader, options, PropExpiryDateInMillis, static System.DateTimeOffset (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker)))) + { + continue; + } + + if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) + { + continue; + } + + if (propType.TryReadProperty(ref reader, options, PropType, null)) + { + continue; + } + + if (propUid.TryReadProperty(ref reader, options, PropUid, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ExpiryDateInMillis = propExpiryDateInMillis.Value, + Mode = propMode.Value, + Status = propStatus.Value, + Type = propType.Value, + Uid = propUid.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropExpiryDateInMillis, value.ExpiryDateInMillis, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.DateTimeOffset v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.DateTimeMillisMarker))); + writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropType, value.Type, null, null); + writer.WriteProperty(options, PropUid, value.Uid, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MinimalLicenseInformationConverter))] public sealed partial class MinimalLicenseInformation { - [JsonInclude, JsonPropertyName("expiry_date_in_millis")] - public long ExpiryDateInMillis { get; init; } - [JsonInclude, JsonPropertyName("mode")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Mode { get; init; } - [JsonInclude, JsonPropertyName("status")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus Status { get; init; } - [JsonInclude, JsonPropertyName("type")] - public Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; init; } - [JsonInclude, JsonPropertyName("uid")] - public string Uid { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MinimalLicenseInformation(System.DateTimeOffset expiryDateInMillis, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType mode, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus status, Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType type, string uid) + { + ExpiryDateInMillis = expiryDateInMillis; + Mode = mode; + Status = status; + Type = type; + Uid = uid; + } +#if NET7_0_OR_GREATER + public MinimalLicenseInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MinimalLicenseInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MinimalLicenseInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.DateTimeOffset ExpiryDateInMillis { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Mode { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseStatus Status { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.LicenseManagement.LicenseType Type { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Uid { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlCounter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlCounter.g.cs index 7345dd77661..121afd122e0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlCounter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlCounter.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlCounterConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlCounter Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlCounter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlCounter value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlCounterConverter))] public sealed partial class MlCounter { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlCounter(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public MlCounter() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlCounter() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlCounter(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobs.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobs.g.cs index 80bbc62ee26..94fcf70aef3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobs.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobs.g.cs @@ -17,24 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlDataFrameAnalyticsJobsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText PropAnalysisCounts = System.Text.Json.JsonEncodedText.Encode("analysis_counts"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryUsage = System.Text.Json.JsonEncodedText.Encode("memory_usage"); + private static readonly System.Text.Json.JsonEncodedText PropStopped = System.Text.Json.JsonEncodedText.Encode("stopped"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue propAnalysisCounts = default; + LocalJsonValue propMemoryUsage = default; + LocalJsonValue propStopped = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propAnalysisCounts.TryReadProperty(ref reader, options, PropAnalysisCounts, null)) + { + continue; + } + + if (propMemoryUsage.TryReadProperty(ref reader, options, PropMemoryUsage, null)) + { + continue; + } + + if (propStopped.TryReadProperty(ref reader, options, PropStopped, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + AnalysisCounts = propAnalysisCounts.Value, + MemoryUsage = propMemoryUsage.Value, + Stopped = propStopped.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobs value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropAnalysisCounts, value.AnalysisCounts, null, null); + writer.WriteProperty(options, PropMemoryUsage, value.MemoryUsage, null, null); + writer.WriteProperty(options, PropStopped, value.Stopped, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsConverter))] public sealed partial class MlDataFrameAnalyticsJobs { - [JsonInclude, JsonPropertyName("_all")] - public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount All { get; init; } - [JsonInclude, JsonPropertyName("analysis_counts")] - public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysis? AnalysisCounts { get; init; } - [JsonInclude, JsonPropertyName("memory_usage")] - public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemory? MemoryUsage { get; init; } - [JsonInclude, JsonPropertyName("stopped")] - public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount? Stopped { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlDataFrameAnalyticsJobs(Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount all) + { + All = all; + } +#if NET7_0_OR_GREATER + public MlDataFrameAnalyticsJobs() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlDataFrameAnalyticsJobs() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlDataFrameAnalyticsJobs(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount All { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysis? AnalysisCounts { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemory? MemoryUsage { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount? Stopped { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsAnalysis.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsAnalysis.g.cs index 9d9fbaa8399..fcc9656279c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsAnalysis.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsAnalysis.g.cs @@ -17,22 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlDataFrameAnalyticsJobsAnalysisConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText PropOutlierDetection = System.Text.Json.JsonEncodedText.Encode("outlier_detection"); + private static readonly System.Text.Json.JsonEncodedText PropRegression = System.Text.Json.JsonEncodedText.Encode("regression"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysis Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassification = default; + LocalJsonValue propOutlierDetection = default; + LocalJsonValue propRegression = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassification.TryReadProperty(ref reader, options, PropClassification, null)) + { + continue; + } + + if (propOutlierDetection.TryReadProperty(ref reader, options, PropOutlierDetection, null)) + { + continue; + } + + if (propRegression.TryReadProperty(ref reader, options, PropRegression, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classification = propClassification.Value, + OutlierDetection = propOutlierDetection.Value, + Regression = propRegression.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysis value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassification, value.Classification, null, null); + writer.WriteProperty(options, PropOutlierDetection, value.OutlierDetection, null, null); + writer.WriteProperty(options, PropRegression, value.Regression, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsAnalysisConverter))] public sealed partial class MlDataFrameAnalyticsJobsAnalysis { - [JsonInclude, JsonPropertyName("classification")] - public int? Classification { get; init; } - [JsonInclude, JsonPropertyName("outlier_detection")] - public int? OutlierDetection { get; init; } - [JsonInclude, JsonPropertyName("regression")] - public int? Regression { get; init; } +#if NET7_0_OR_GREATER + public MlDataFrameAnalyticsJobsAnalysis() + { + } +#endif +#if !NET7_0_OR_GREATER + public MlDataFrameAnalyticsJobsAnalysis() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlDataFrameAnalyticsJobsAnalysis(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? Classification { get; set; } + public int? OutlierDetection { get; set; } + public int? Regression { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsCount.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsCount.g.cs index 0a7209a5ec7..29946c8450f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsCount.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsCount.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlDataFrameAnalyticsJobsCountConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCount value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsCountConverter))] public sealed partial class MlDataFrameAnalyticsJobsCount { - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlDataFrameAnalyticsJobsCount(long count) + { + Count = count; + } +#if NET7_0_OR_GREATER + public MlDataFrameAnalyticsJobsCount() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlDataFrameAnalyticsJobsCount() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlDataFrameAnalyticsJobsCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsMemory.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsMemory.g.cs index b600c7f9d85..445bc79f2d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsMemory.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlDataFrameAnalyticsJobsMemory.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlDataFrameAnalyticsJobsMemoryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPeakUsageBytes = System.Text.Json.JsonEncodedText.Encode("peak_usage_bytes"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemory Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propPeakUsageBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPeakUsageBytes.TryReadProperty(ref reader, options, PropPeakUsageBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + PeakUsageBytes = propPeakUsageBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemory value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPeakUsageBytes, value.PeakUsageBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlDataFrameAnalyticsJobsMemoryConverter))] public sealed partial class MlDataFrameAnalyticsJobsMemory { - [JsonInclude, JsonPropertyName("peak_usage_bytes")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics PeakUsageBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlDataFrameAnalyticsJobsMemory(Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics peakUsageBytes) + { + PeakUsageBytes = peakUsageBytes; + } +#if NET7_0_OR_GREATER + public MlDataFrameAnalyticsJobsMemory() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlDataFrameAnalyticsJobsMemory() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlDataFrameAnalyticsJobsMemory(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics PeakUsageBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInference.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInference.g.cs index aa17db3f94a..8dd504f66f6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInference.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInference.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDeployments = System.Text.Json.JsonEncodedText.Encode("deployments"); + private static readonly System.Text.Json.JsonEncodedText PropIngestProcessors = System.Text.Json.JsonEncodedText.Encode("ingest_processors"); + private static readonly System.Text.Json.JsonEncodedText PropTrainedModels = System.Text.Json.JsonEncodedText.Encode("trained_models"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInference Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDeployments = default; + LocalJsonValue> propIngestProcessors = default; + LocalJsonValue propTrainedModels = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDeployments.TryReadProperty(ref reader, options, PropDeployments, null)) + { + continue; + } + + if (propIngestProcessors.TryReadProperty(ref reader, options, PropIngestProcessors, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTrainedModels.TryReadProperty(ref reader, options, PropTrainedModels, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Deployments = propDeployments.Value, + IngestProcessors = propIngestProcessors.Value, + TrainedModels = propTrainedModels.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInference value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDeployments, value.Deployments, null, null); + writer.WriteProperty(options, PropIngestProcessors, value.IngestProcessors, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTrainedModels, value.TrainedModels, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceConverter))] public sealed partial class MlInference { - [JsonInclude, JsonPropertyName("deployments")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeployments? Deployments { get; init; } - [JsonInclude, JsonPropertyName("ingest_processors")] - public IReadOnlyDictionary IngestProcessors { get; init; } - [JsonInclude, JsonPropertyName("trained_models")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels TrainedModels { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInference(System.Collections.Generic.IReadOnlyDictionary ingestProcessors, Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels trainedModels) + { + IngestProcessors = ingestProcessors; + TrainedModels = trainedModels; + } +#if NET7_0_OR_GREATER + public MlInference() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInference() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInference(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeployments? Deployments { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary IngestProcessors { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels TrainedModels { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeployments.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeployments.g.cs index b50292e908f..5ed3ef1929c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeployments.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeployments.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceDeploymentsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropInferenceCounts = System.Text.Json.JsonEncodedText.Encode("inference_counts"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizesBytes = System.Text.Json.JsonEncodedText.Encode("model_sizes_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropTimeMs = System.Text.Json.JsonEncodedText.Encode("time_ms"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeployments Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propInferenceCounts = default; + LocalJsonValue propModelSizesBytes = default; + LocalJsonValue propTimeMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propInferenceCounts.TryReadProperty(ref reader, options, PropInferenceCounts, null)) + { + continue; + } + + if (propModelSizesBytes.TryReadProperty(ref reader, options, PropModelSizesBytes, null)) + { + continue; + } + + if (propTimeMs.TryReadProperty(ref reader, options, PropTimeMs, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeployments(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + InferenceCounts = propInferenceCounts.Value, + ModelSizesBytes = propModelSizesBytes.Value, + TimeMs = propTimeMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeployments value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropInferenceCounts, value.InferenceCounts, null, null); + writer.WriteProperty(options, PropModelSizesBytes, value.ModelSizesBytes, null, null); + writer.WriteProperty(options, PropTimeMs, value.TimeMs, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsConverter))] public sealed partial class MlInferenceDeployments { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("inference_counts")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics InferenceCounts { get; init; } - [JsonInclude, JsonPropertyName("model_sizes_bytes")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics ModelSizesBytes { get; init; } - [JsonInclude, JsonPropertyName("time_ms")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs TimeMs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceDeployments(int count, Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics inferenceCounts, Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics modelSizesBytes, Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs timeMs) + { + Count = count; + InferenceCounts = inferenceCounts; + ModelSizesBytes = modelSizesBytes; + TimeMs = timeMs; + } +#if NET7_0_OR_GREATER + public MlInferenceDeployments() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceDeployments() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceDeployments(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics InferenceCounts { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics ModelSizesBytes { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs TimeMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeploymentsTimeMs.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeploymentsTimeMs.g.cs index 6f80030c46d..5437e05e256 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeploymentsTimeMs.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceDeploymentsTimeMs.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceDeploymentsTimeMsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvg = System.Text.Json.JsonEncodedText.Encode("avg"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvg = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvg.TryReadProperty(ref reader, options, PropAvg, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Avg = propAvg.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMs value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvg, value.Avg, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceDeploymentsTimeMsConverter))] public sealed partial class MlInferenceDeploymentsTimeMs { - [JsonInclude, JsonPropertyName("avg")] - public double Avg { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceDeploymentsTimeMs(double avg) + { + Avg = avg; + } +#if NET7_0_OR_GREATER + public MlInferenceDeploymentsTimeMs() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceDeploymentsTimeMs() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceDeploymentsTimeMs(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + double Avg { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessor.g.cs index fa1f1ed6c0e..58f43b78332 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessor.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceIngestProcessorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropNumDocsProcessed = System.Text.Json.JsonEncodedText.Encode("num_docs_processed"); + private static readonly System.Text.Json.JsonEncodedText PropNumFailures = System.Text.Json.JsonEncodedText.Encode("num_failures"); + private static readonly System.Text.Json.JsonEncodedText PropPipelines = System.Text.Json.JsonEncodedText.Encode("pipelines"); + private static readonly System.Text.Json.JsonEncodedText PropTimeMs = System.Text.Json.JsonEncodedText.Encode("time_ms"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessor Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propNumDocsProcessed = default; + LocalJsonValue propNumFailures = default; + LocalJsonValue propPipelines = default; + LocalJsonValue propTimeMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propNumDocsProcessed.TryReadProperty(ref reader, options, PropNumDocsProcessed, null)) + { + continue; + } + + if (propNumFailures.TryReadProperty(ref reader, options, PropNumFailures, null)) + { + continue; + } + + if (propPipelines.TryReadProperty(ref reader, options, PropPipelines, null)) + { + continue; + } + + if (propTimeMs.TryReadProperty(ref reader, options, PropTimeMs, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + NumDocsProcessed = propNumDocsProcessed.Value, + NumFailures = propNumFailures.Value, + Pipelines = propPipelines.Value, + TimeMs = propTimeMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessor value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropNumDocsProcessed, value.NumDocsProcessed, null, null); + writer.WriteProperty(options, PropNumFailures, value.NumFailures, null, null); + writer.WriteProperty(options, PropPipelines, value.Pipelines, null, null); + writer.WriteProperty(options, PropTimeMs, value.TimeMs, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorConverter))] public sealed partial class MlInferenceIngestProcessor { - [JsonInclude, JsonPropertyName("num_docs_processed")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount NumDocsProcessed { get; init; } - [JsonInclude, JsonPropertyName("num_failures")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount NumFailures { get; init; } - [JsonInclude, JsonPropertyName("pipelines")] - public Elastic.Clients.Elasticsearch.Xpack.MlCounter Pipelines { get; init; } - [JsonInclude, JsonPropertyName("time_ms")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount TimeMs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceIngestProcessor(Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount numDocsProcessed, Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount numFailures, Elastic.Clients.Elasticsearch.Xpack.MlCounter pipelines, Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount timeMs) + { + NumDocsProcessed = numDocsProcessed; + NumFailures = numFailures; + Pipelines = pipelines; + TimeMs = timeMs; + } +#if NET7_0_OR_GREATER + public MlInferenceIngestProcessor() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceIngestProcessor() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceIngestProcessor(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount NumDocsProcessed { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount NumFailures { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlCounter Pipelines { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount TimeMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessorCount.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessorCount.g.cs index 81432177e78..dd86b3e7290 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessorCount.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceIngestProcessorCount.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceIngestProcessorCountConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropMax = System.Text.Json.JsonEncodedText.Encode("max"); + private static readonly System.Text.Json.JsonEncodedText PropMin = System.Text.Json.JsonEncodedText.Encode("min"); + private static readonly System.Text.Json.JsonEncodedText PropSum = System.Text.Json.JsonEncodedText.Encode("sum"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propMax = default; + LocalJsonValue propMin = default; + LocalJsonValue propSum = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propMax.TryReadProperty(ref reader, options, PropMax, null)) + { + continue; + } + + if (propMin.TryReadProperty(ref reader, options, PropMin, null)) + { + continue; + } + + if (propSum.TryReadProperty(ref reader, options, PropSum, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Max = propMax.Value, + Min = propMin.Value, + Sum = propSum.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCount value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropMax, value.Max, null, null); + writer.WriteProperty(options, PropMin, value.Min, null, null); + writer.WriteProperty(options, PropSum, value.Sum, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceIngestProcessorCountConverter))] public sealed partial class MlInferenceIngestProcessorCount { - [JsonInclude, JsonPropertyName("max")] - public long Max { get; init; } - [JsonInclude, JsonPropertyName("min")] - public long Min { get; init; } - [JsonInclude, JsonPropertyName("sum")] - public long Sum { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceIngestProcessorCount(long max, long min, long sum) + { + Max = max; + Min = min; + Sum = sum; + } +#if NET7_0_OR_GREATER + public MlInferenceIngestProcessorCount() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceIngestProcessorCount() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceIngestProcessorCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Max { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Min { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Sum { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModels.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModels.g.cs index ba8ddee8101..d1509eddde8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModels.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModels.g.cs @@ -17,26 +17,119 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceTrainedModelsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedHeapMemoryUsageBytes = System.Text.Json.JsonEncodedText.Encode("estimated_heap_memory_usage_bytes"); + private static readonly System.Text.Json.JsonEncodedText PropEstimatedOperations = System.Text.Json.JsonEncodedText.Encode("estimated_operations"); + private static readonly System.Text.Json.JsonEncodedText PropModelSizeBytes = System.Text.Json.JsonEncodedText.Encode("model_size_bytes"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue propCount = default; + LocalJsonValue propEstimatedHeapMemoryUsageBytes = default; + LocalJsonValue propEstimatedOperations = default; + LocalJsonValue propModelSizeBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propEstimatedHeapMemoryUsageBytes.TryReadProperty(ref reader, options, PropEstimatedHeapMemoryUsageBytes, null)) + { + continue; + } + + if (propEstimatedOperations.TryReadProperty(ref reader, options, PropEstimatedOperations, null)) + { + continue; + } + + if (propModelSizeBytes.TryReadProperty(ref reader, options, PropModelSizeBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + Count = propCount.Value, + EstimatedHeapMemoryUsageBytes = propEstimatedHeapMemoryUsageBytes.Value, + EstimatedOperations = propEstimatedOperations.Value, + ModelSizeBytes = propModelSizeBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModels value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropEstimatedHeapMemoryUsageBytes, value.EstimatedHeapMemoryUsageBytes, null, null); + writer.WriteProperty(options, PropEstimatedOperations, value.EstimatedOperations, null, null); + writer.WriteProperty(options, PropModelSizeBytes, value.ModelSizeBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsConverter))] public sealed partial class MlInferenceTrainedModels { - [JsonInclude, JsonPropertyName("_all")] - public Elastic.Clients.Elasticsearch.Xpack.MlCounter All { get; init; } - [JsonInclude, JsonPropertyName("count")] - public Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCount? Count { get; init; } - [JsonInclude, JsonPropertyName("estimated_heap_memory_usage_bytes")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? EstimatedHeapMemoryUsageBytes { get; init; } - [JsonInclude, JsonPropertyName("estimated_operations")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? EstimatedOperations { get; init; } - [JsonInclude, JsonPropertyName("model_size_bytes")] - public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? ModelSizeBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceTrainedModels(Elastic.Clients.Elasticsearch.Xpack.MlCounter all) + { + All = all; + } +#if NET7_0_OR_GREATER + public MlInferenceTrainedModels() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceTrainedModels() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceTrainedModels(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.MlCounter All { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCount? Count { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? EstimatedHeapMemoryUsageBytes { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? EstimatedOperations { get; set; } + public Elastic.Clients.Elasticsearch.MachineLearning.JobStatistics? ModelSizeBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModelsCount.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModelsCount.g.cs index 146bf75c66d..5fbeca6e4c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModelsCount.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlInferenceTrainedModelsCount.g.cs @@ -17,32 +17,159 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlInferenceTrainedModelsCountConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropClassification = System.Text.Json.JsonEncodedText.Encode("classification"); + private static readonly System.Text.Json.JsonEncodedText PropNer = System.Text.Json.JsonEncodedText.Encode("ner"); + private static readonly System.Text.Json.JsonEncodedText PropOther = System.Text.Json.JsonEncodedText.Encode("other"); + private static readonly System.Text.Json.JsonEncodedText PropPassThrough = System.Text.Json.JsonEncodedText.Encode("pass_through"); + private static readonly System.Text.Json.JsonEncodedText PropPrepackaged = System.Text.Json.JsonEncodedText.Encode("prepackaged"); + private static readonly System.Text.Json.JsonEncodedText PropRegression = System.Text.Json.JsonEncodedText.Encode("regression"); + private static readonly System.Text.Json.JsonEncodedText PropTextEmbedding = System.Text.Json.JsonEncodedText.Encode("text_embedding"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propClassification = default; + LocalJsonValue propNer = default; + LocalJsonValue propOther = default; + LocalJsonValue propPassThrough = default; + LocalJsonValue propPrepackaged = default; + LocalJsonValue propRegression = default; + LocalJsonValue propTextEmbedding = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propClassification.TryReadProperty(ref reader, options, PropClassification, null)) + { + continue; + } + + if (propNer.TryReadProperty(ref reader, options, PropNer, null)) + { + continue; + } + + if (propOther.TryReadProperty(ref reader, options, PropOther, null)) + { + continue; + } + + if (propPassThrough.TryReadProperty(ref reader, options, PropPassThrough, null)) + { + continue; + } + + if (propPrepackaged.TryReadProperty(ref reader, options, PropPrepackaged, null)) + { + continue; + } + + if (propRegression.TryReadProperty(ref reader, options, PropRegression, null)) + { + continue; + } + + if (propTextEmbedding.TryReadProperty(ref reader, options, PropTextEmbedding, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Classification = propClassification.Value, + Ner = propNer.Value, + Other = propOther.Value, + PassThrough = propPassThrough.Value, + Prepackaged = propPrepackaged.Value, + Regression = propRegression.Value, + TextEmbedding = propTextEmbedding.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCount value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropClassification, value.Classification, null, null); + writer.WriteProperty(options, PropNer, value.Ner, null, null); + writer.WriteProperty(options, PropOther, value.Other, null, null); + writer.WriteProperty(options, PropPassThrough, value.PassThrough, null, null); + writer.WriteProperty(options, PropPrepackaged, value.Prepackaged, null, null); + writer.WriteProperty(options, PropRegression, value.Regression, null, null); + writer.WriteProperty(options, PropTextEmbedding, value.TextEmbedding, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlInferenceTrainedModelsCountConverter))] public sealed partial class MlInferenceTrainedModelsCount { - [JsonInclude, JsonPropertyName("classification")] - public long? Classification { get; init; } - [JsonInclude, JsonPropertyName("ner")] - public long? Ner { get; init; } - [JsonInclude, JsonPropertyName("other")] - public long Other { get; init; } - [JsonInclude, JsonPropertyName("pass_through")] - public long? PassThrough { get; init; } - [JsonInclude, JsonPropertyName("prepackaged")] - public long Prepackaged { get; init; } - [JsonInclude, JsonPropertyName("regression")] - public long? Regression { get; init; } - [JsonInclude, JsonPropertyName("text_embedding")] - public long? TextEmbedding { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlInferenceTrainedModelsCount(long other, long prepackaged, long total) + { + Other = other; + Prepackaged = prepackaged; + Total = total; + } +#if NET7_0_OR_GREATER + public MlInferenceTrainedModelsCount() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlInferenceTrainedModelsCount() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlInferenceTrainedModelsCount(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public long? Classification { get; set; } + public long? Ner { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Other { get; set; } + public long? PassThrough { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Prepackaged { get; set; } + public long? Regression { get; set; } + public long? TextEmbedding { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlJobForecasts.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlJobForecasts.g.cs index ced49dda3bc..a1e7e550f1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlJobForecasts.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/MlJobForecasts.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MlJobForecastsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropForecastedJobs = System.Text.Json.JsonEncodedText.Encode("forecasted_jobs"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propForecastedJobs = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propForecastedJobs.TryReadProperty(ref reader, options, PropForecastedJobs, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + ForecastedJobs = propForecastedJobs.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.MlJobForecasts value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropForecastedJobs, value.ForecastedJobs, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MlJobForecastsConverter))] public sealed partial class MlJobForecasts { - [JsonInclude, JsonPropertyName("forecasted_jobs")] - public long ForecastedJobs { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public MlJobForecasts(long forecastedJobs, long total) + { + ForecastedJobs = forecastedJobs; + Total = total; + } +#if NET7_0_OR_GREATER + public MlJobForecasts() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public MlJobForecasts() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal MlJobForecasts(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long ForecastedJobs { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Monitoring.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Monitoring.g.cs index 2381689892d..9e945064d25 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Monitoring.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Monitoring.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class MonitoringConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropCollectionEnabled = System.Text.Json.JsonEncodedText.Encode("collection_enabled"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropEnabledExporters = System.Text.Json.JsonEncodedText.Encode("enabled_exporters"); + + public override Elastic.Clients.Elasticsearch.Xpack.Monitoring Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propCollectionEnabled = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propEnabledExporters = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propCollectionEnabled.TryReadProperty(ref reader, options, PropCollectionEnabled, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propEnabledExporters.TryReadProperty(ref reader, options, PropEnabledExporters, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Monitoring(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + CollectionEnabled = propCollectionEnabled.Value, + Enabled = propEnabled.Value, + EnabledExporters = propEnabledExporters.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Monitoring value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropCollectionEnabled, value.CollectionEnabled, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropEnabledExporters, value.EnabledExporters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.MonitoringConverter))] public sealed partial class Monitoring { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("collection_enabled")] - public bool CollectionEnabled { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("enabled_exporters")] - public IReadOnlyDictionary EnabledExporters { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Monitoring(bool available, bool collectionEnabled, bool enabled, System.Collections.Generic.IReadOnlyDictionary enabledExporters) + { + Available = available; + CollectionEnabled = collectionEnabled; + Enabled = enabled; + EnabledExporters = enabledExporters; + } +#if NET7_0_OR_GREATER + public Monitoring() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Monitoring() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Monitoring(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool CollectionEnabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary EnabledExporters { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/NativeCodeInformation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/NativeCodeInformation.g.cs index e02ac911b76..2d9fdd2568c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/NativeCodeInformation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/NativeCodeInformation.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class NativeCodeInformationConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBuildHash = System.Text.Json.JsonEncodedText.Encode("build_hash"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + + public override Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformation Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBuildHash = default; + LocalJsonValue propVersion = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBuildHash.TryReadProperty(ref reader, options, PropBuildHash, null)) + { + continue; + } + + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BuildHash = propBuildHash.Value, + Version = propVersion.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformation value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBuildHash, value.BuildHash, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.NativeCodeInformationConverter))] public sealed partial class NativeCodeInformation { - [JsonInclude, JsonPropertyName("build_hash")] - public string BuildHash { get; init; } - [JsonInclude, JsonPropertyName("version")] - public string Version { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public NativeCodeInformation(string buildHash, string version) + { + BuildHash = buildHash; + Version = version; + } +#if NET7_0_OR_GREATER + public NativeCodeInformation() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public NativeCodeInformation() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal NativeCodeInformation(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + string BuildHash { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Version { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phase.g.cs index 9215ae75778..d34bf5c1b5b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phase.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phase.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class PhaseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + private static readonly System.Text.Json.JsonEncodedText PropMinAge = System.Text.Json.JsonEncodedText.Encode("min_age"); + + public override Elastic.Clients.Elasticsearch.Xpack.Phase Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propActions = default; + LocalJsonValue propMinAge = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propMinAge.TryReadProperty(ref reader, options, PropMinAge, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value, + MinAge = propMinAge.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Phase value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropMinAge, value.MinAge, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.PhaseConverter))] public sealed partial class Phase { - [JsonInclude, JsonPropertyName("actions")] - public IReadOnlyCollection Actions { get; init; } - [JsonInclude, JsonPropertyName("min_age")] - public long MinAge { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Phase(System.Collections.Generic.IReadOnlyCollection actions, System.TimeSpan minAge) + { + Actions = actions; + MinAge = minAge; + } +#if NET7_0_OR_GREATER + public Phase() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Phase() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Phase(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Actions { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan MinAge { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phases.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phases.g.cs index 8b1328b0b0c..a48eaf00486 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phases.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Phases.g.cs @@ -17,26 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class PhasesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCold = System.Text.Json.JsonEncodedText.Encode("cold"); + private static readonly System.Text.Json.JsonEncodedText PropDelete = System.Text.Json.JsonEncodedText.Encode("delete"); + private static readonly System.Text.Json.JsonEncodedText PropFrozen = System.Text.Json.JsonEncodedText.Encode("frozen"); + private static readonly System.Text.Json.JsonEncodedText PropHot = System.Text.Json.JsonEncodedText.Encode("hot"); + private static readonly System.Text.Json.JsonEncodedText PropWarm = System.Text.Json.JsonEncodedText.Encode("warm"); + + public override Elastic.Clients.Elasticsearch.Xpack.Phases Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCold = default; + LocalJsonValue propDelete = default; + LocalJsonValue propFrozen = default; + LocalJsonValue propHot = default; + LocalJsonValue propWarm = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCold.TryReadProperty(ref reader, options, PropCold, null)) + { + continue; + } + + if (propDelete.TryReadProperty(ref reader, options, PropDelete, null)) + { + continue; + } + + if (propFrozen.TryReadProperty(ref reader, options, PropFrozen, null)) + { + continue; + } + + if (propHot.TryReadProperty(ref reader, options, PropHot, null)) + { + continue; + } + + if (propWarm.TryReadProperty(ref reader, options, PropWarm, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Cold = propCold.Value, + Delete = propDelete.Value, + Frozen = propFrozen.Value, + Hot = propHot.Value, + Warm = propWarm.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Phases value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCold, value.Cold, null, null); + writer.WriteProperty(options, PropDelete, value.Delete, null, null); + writer.WriteProperty(options, PropFrozen, value.Frozen, null, null); + writer.WriteProperty(options, PropHot, value.Hot, null, null); + writer.WriteProperty(options, PropWarm, value.Warm, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.PhasesConverter))] public sealed partial class Phases { - [JsonInclude, JsonPropertyName("cold")] - public Elastic.Clients.Elasticsearch.Xpack.Phase? Cold { get; init; } - [JsonInclude, JsonPropertyName("delete")] - public Elastic.Clients.Elasticsearch.Xpack.Phase? Delete { get; init; } - [JsonInclude, JsonPropertyName("frozen")] - public Elastic.Clients.Elasticsearch.Xpack.Phase? Frozen { get; init; } - [JsonInclude, JsonPropertyName("hot")] - public Elastic.Clients.Elasticsearch.Xpack.Phase? Hot { get; init; } - [JsonInclude, JsonPropertyName("warm")] - public Elastic.Clients.Elasticsearch.Xpack.Phase? Warm { get; init; } +#if NET7_0_OR_GREATER + public Phases() + { + } +#endif +#if !NET7_0_OR_GREATER + public Phases() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Phases(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public Elastic.Clients.Elasticsearch.Xpack.Phase? Cold { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Phase? Delete { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Phase? Frozen { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Phase? Hot { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.Phase? Warm { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Realm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Realm.g.cs index 740351a98e7..7be84030ca5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Realm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Realm.g.cs @@ -17,36 +17,174 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class RealmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropCache = System.Text.Json.JsonEncodedText.Encode("cache"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropHasAuthorizationRealms = System.Text.Json.JsonEncodedText.Encode("has_authorization_realms"); + private static readonly System.Text.Json.JsonEncodedText PropHasDefaultUsernamePattern = System.Text.Json.JsonEncodedText.Encode("has_default_username_pattern"); + private static readonly System.Text.Json.JsonEncodedText PropHasTruststore = System.Text.Json.JsonEncodedText.Encode("has_truststore"); + private static readonly System.Text.Json.JsonEncodedText PropIsAuthenticationDelegated = System.Text.Json.JsonEncodedText.Encode("is_authentication_delegated"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropOrder = System.Text.Json.JsonEncodedText.Encode("order"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Xpack.Realm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue?> propCache = default; + LocalJsonValue propEnabled = default; + LocalJsonValue?> propHasAuthorizationRealms = default; + LocalJsonValue?> propHasDefaultUsernamePattern = default; + LocalJsonValue?> propHasTruststore = default; + LocalJsonValue?> propIsAuthenticationDelegated = default; + LocalJsonValue?> propName = default; + LocalJsonValue?> propOrder = default; + LocalJsonValue?> propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propCache.TryReadProperty(ref reader, options, PropCache, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propHasAuthorizationRealms.TryReadProperty(ref reader, options, PropHasAuthorizationRealms, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propHasDefaultUsernamePattern.TryReadProperty(ref reader, options, PropHasDefaultUsernamePattern, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propHasTruststore.TryReadProperty(ref reader, options, PropHasTruststore, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propIsAuthenticationDelegated.TryReadProperty(ref reader, options, PropIsAuthenticationDelegated, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propOrder.TryReadProperty(ref reader, options, PropOrder, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, static System.Collections.Generic.IReadOnlyCollection? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Realm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Cache = propCache.Value, + Enabled = propEnabled.Value, + HasAuthorizationRealms = propHasAuthorizationRealms.Value, + HasDefaultUsernamePattern = propHasDefaultUsernamePattern.Value, + HasTruststore = propHasTruststore.Value, + IsAuthenticationDelegated = propIsAuthenticationDelegated.Value, + Name = propName.Value, + Order = propOrder.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Realm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropCache, value.Cache, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropHasAuthorizationRealms, value.HasAuthorizationRealms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHasDefaultUsernamePattern, value.HasDefaultUsernamePattern, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropHasTruststore, value.HasTruststore, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropIsAuthenticationDelegated, value.IsAuthenticationDelegated, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropName, value.Name, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropOrder, value.Order, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropSize, value.Size, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection? v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.RealmConverter))] public sealed partial class Realm { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("cache")] - public IReadOnlyCollection? Cache { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("has_authorization_realms")] - public IReadOnlyCollection? HasAuthorizationRealms { get; init; } - [JsonInclude, JsonPropertyName("has_default_username_pattern")] - public IReadOnlyCollection? HasDefaultUsernamePattern { get; init; } - [JsonInclude, JsonPropertyName("has_truststore")] - public IReadOnlyCollection? HasTruststore { get; init; } - [JsonInclude, JsonPropertyName("is_authentication_delegated")] - public IReadOnlyCollection? IsAuthenticationDelegated { get; init; } - [JsonInclude, JsonPropertyName("name")] - public IReadOnlyCollection? Name { get; init; } - [JsonInclude, JsonPropertyName("order")] - public IReadOnlyCollection? Order { get; init; } - [JsonInclude, JsonPropertyName("size")] - public IReadOnlyCollection? Size { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Realm(bool available, bool enabled) + { + Available = available; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Realm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Realm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Realm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Cache { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public System.Collections.Generic.IReadOnlyCollection? HasAuthorizationRealms { get; set; } + public System.Collections.Generic.IReadOnlyCollection? HasDefaultUsernamePattern { get; set; } + public System.Collections.Generic.IReadOnlyCollection? HasTruststore { get; set; } + public System.Collections.Generic.IReadOnlyCollection? IsAuthenticationDelegated { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Name { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Order { get; set; } + public System.Collections.Generic.IReadOnlyCollection? Size { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RealmCache.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RealmCache.g.cs index 387dcdcf335..a8b36d6ae08 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RealmCache.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RealmCache.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class RealmCacheConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Xpack.RealmCache Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.RealmCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.RealmCache value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.RealmCacheConverter))] public sealed partial class RealmCache { - [JsonInclude, JsonPropertyName("size")] - public long Size { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RealmCache(long size) + { + Size = size; + } +#if NET7_0_OR_GREATER + public RealmCache() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RealmCache() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RealmCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Size { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RoleMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RoleMapping.g.cs index 05292438aca..c17052b22d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RoleMapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RoleMapping.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class RoleMappingConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Xpack.RoleMapping Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propEnabled = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.RoleMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Enabled = propEnabled.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.RoleMapping value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.RoleMappingConverter))] public sealed partial class RoleMapping { - [JsonInclude, JsonPropertyName("enabled")] - public int Enabled { get; init; } - [JsonInclude, JsonPropertyName("size")] - public int Size { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RoleMapping(int enabled, int size) + { + Enabled = enabled; + Size = size; + } +#if NET7_0_OR_GREATER + public RoleMapping() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RoleMapping() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RoleMapping(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int Size { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldTypes.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldTypes.g.cs index 362fada688a..ed5a977345a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldTypes.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldTypes.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class RuntimeFieldTypesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFieldTypes = System.Text.Json.JsonEncodedText.Encode("field_types"); + + public override Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypes Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propFieldTypes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFieldTypes.TryReadProperty(ref reader, options, PropFieldTypes, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + FieldTypes = propFieldTypes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypes value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFieldTypes, value.FieldTypes, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldTypesConverter))] public sealed partial class RuntimeFieldTypes { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("field_types")] - public IReadOnlyCollection FieldTypes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldTypes(bool available, bool enabled, System.Collections.Generic.IReadOnlyCollection fieldTypes) + { + Available = available; + Enabled = enabled; + FieldTypes = fieldTypes; + } +#if NET7_0_OR_GREATER + public RuntimeFieldTypes() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuntimeFieldTypes() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuntimeFieldTypes(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection FieldTypes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldsType.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldsType.g.cs index 1416aca66e2..f3228c2eddf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldsType.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/RuntimeFieldsType.g.cs @@ -17,44 +17,274 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class RuntimeFieldsTypeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCharsMax = System.Text.Json.JsonEncodedText.Encode("chars_max"); + private static readonly System.Text.Json.JsonEncodedText PropCharsTotal = System.Text.Json.JsonEncodedText.Encode("chars_total"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropDocMax = System.Text.Json.JsonEncodedText.Encode("doc_max"); + private static readonly System.Text.Json.JsonEncodedText PropDocTotal = System.Text.Json.JsonEncodedText.Encode("doc_total"); + private static readonly System.Text.Json.JsonEncodedText PropIndexCount = System.Text.Json.JsonEncodedText.Encode("index_count"); + private static readonly System.Text.Json.JsonEncodedText PropLang = System.Text.Json.JsonEncodedText.Encode("lang"); + private static readonly System.Text.Json.JsonEncodedText PropLinesMax = System.Text.Json.JsonEncodedText.Encode("lines_max"); + private static readonly System.Text.Json.JsonEncodedText PropLinesTotal = System.Text.Json.JsonEncodedText.Encode("lines_total"); + private static readonly System.Text.Json.JsonEncodedText PropName = System.Text.Json.JsonEncodedText.Encode("name"); + private static readonly System.Text.Json.JsonEncodedText PropScriptlessCount = System.Text.Json.JsonEncodedText.Encode("scriptless_count"); + private static readonly System.Text.Json.JsonEncodedText PropShadowedCount = System.Text.Json.JsonEncodedText.Encode("shadowed_count"); + private static readonly System.Text.Json.JsonEncodedText PropSourceMax = System.Text.Json.JsonEncodedText.Encode("source_max"); + private static readonly System.Text.Json.JsonEncodedText PropSourceTotal = System.Text.Json.JsonEncodedText.Encode("source_total"); + + public override Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldsType Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCharsMax = default; + LocalJsonValue propCharsTotal = default; + LocalJsonValue propCount = default; + LocalJsonValue propDocMax = default; + LocalJsonValue propDocTotal = default; + LocalJsonValue propIndexCount = default; + LocalJsonValue> propLang = default; + LocalJsonValue propLinesMax = default; + LocalJsonValue propLinesTotal = default; + LocalJsonValue propName = default; + LocalJsonValue propScriptlessCount = default; + LocalJsonValue propShadowedCount = default; + LocalJsonValue propSourceMax = default; + LocalJsonValue propSourceTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCharsMax.TryReadProperty(ref reader, options, PropCharsMax, null)) + { + continue; + } + + if (propCharsTotal.TryReadProperty(ref reader, options, PropCharsTotal, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propDocMax.TryReadProperty(ref reader, options, PropDocMax, null)) + { + continue; + } + + if (propDocTotal.TryReadProperty(ref reader, options, PropDocTotal, null)) + { + continue; + } + + if (propIndexCount.TryReadProperty(ref reader, options, PropIndexCount, null)) + { + continue; + } + + if (propLang.TryReadProperty(ref reader, options, PropLang, static System.Collections.Generic.IReadOnlyCollection (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadCollectionValue(o, null)!)) + { + continue; + } + + if (propLinesMax.TryReadProperty(ref reader, options, PropLinesMax, null)) + { + continue; + } + + if (propLinesTotal.TryReadProperty(ref reader, options, PropLinesTotal, null)) + { + continue; + } + + if (propName.TryReadProperty(ref reader, options, PropName, null)) + { + continue; + } + + if (propScriptlessCount.TryReadProperty(ref reader, options, PropScriptlessCount, null)) + { + continue; + } + + if (propShadowedCount.TryReadProperty(ref reader, options, PropShadowedCount, null)) + { + continue; + } + + if (propSourceMax.TryReadProperty(ref reader, options, PropSourceMax, null)) + { + continue; + } + + if (propSourceTotal.TryReadProperty(ref reader, options, PropSourceTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldsType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + CharsMax = propCharsMax.Value, + CharsTotal = propCharsTotal.Value, + Count = propCount.Value, + DocMax = propDocMax.Value, + DocTotal = propDocTotal.Value, + IndexCount = propIndexCount.Value, + Lang = propLang.Value, + LinesMax = propLinesMax.Value, + LinesTotal = propLinesTotal.Value, + Name = propName.Value, + ScriptlessCount = propScriptlessCount.Value, + ShadowedCount = propShadowedCount.Value, + SourceMax = propSourceMax.Value, + SourceTotal = propSourceTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldsType value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCharsMax, value.CharsMax, null, null); + writer.WriteProperty(options, PropCharsTotal, value.CharsTotal, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropDocMax, value.DocMax, null, null); + writer.WriteProperty(options, PropDocTotal, value.DocTotal, null, null); + writer.WriteProperty(options, PropIndexCount, value.IndexCount, null, null); + writer.WriteProperty(options, PropLang, value.Lang, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyCollection v) => w.WriteCollectionValue(o, v, null)); + writer.WriteProperty(options, PropLinesMax, value.LinesMax, null, null); + writer.WriteProperty(options, PropLinesTotal, value.LinesTotal, null, null); + writer.WriteProperty(options, PropName, value.Name, null, null); + writer.WriteProperty(options, PropScriptlessCount, value.ScriptlessCount, null, null); + writer.WriteProperty(options, PropShadowedCount, value.ShadowedCount, null, null); + writer.WriteProperty(options, PropSourceMax, value.SourceMax, null, null); + writer.WriteProperty(options, PropSourceTotal, value.SourceTotal, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.RuntimeFieldsTypeConverter))] public sealed partial class RuntimeFieldsType { - [JsonInclude, JsonPropertyName("chars_max")] - public long CharsMax { get; init; } - [JsonInclude, JsonPropertyName("chars_total")] - public long CharsTotal { get; init; } - [JsonInclude, JsonPropertyName("count")] - public long Count { get; init; } - [JsonInclude, JsonPropertyName("doc_max")] - public long DocMax { get; init; } - [JsonInclude, JsonPropertyName("doc_total")] - public long DocTotal { get; init; } - [JsonInclude, JsonPropertyName("index_count")] - public long IndexCount { get; init; } - [JsonInclude, JsonPropertyName("lang")] - public IReadOnlyCollection Lang { get; init; } - [JsonInclude, JsonPropertyName("lines_max")] - public long LinesMax { get; init; } - [JsonInclude, JsonPropertyName("lines_total")] - public long LinesTotal { get; init; } - [JsonInclude, JsonPropertyName("name")] - public string Name { get; init; } - [JsonInclude, JsonPropertyName("scriptless_count")] - public long ScriptlessCount { get; init; } - [JsonInclude, JsonPropertyName("shadowed_count")] - public long ShadowedCount { get; init; } - [JsonInclude, JsonPropertyName("source_max")] - public long SourceMax { get; init; } - [JsonInclude, JsonPropertyName("source_total")] - public long SourceTotal { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RuntimeFieldsType(long charsMax, long charsTotal, long count, long docMax, long docTotal, long indexCount, System.Collections.Generic.IReadOnlyCollection lang, long linesMax, long linesTotal, string name, long scriptlessCount, long shadowedCount, long sourceMax, long sourceTotal) + { + CharsMax = charsMax; + CharsTotal = charsTotal; + Count = count; + DocMax = docMax; + DocTotal = docTotal; + IndexCount = indexCount; + Lang = lang; + LinesMax = linesMax; + LinesTotal = linesTotal; + Name = name; + ScriptlessCount = scriptlessCount; + ShadowedCount = shadowedCount; + SourceMax = sourceMax; + SourceTotal = sourceTotal; + } +#if NET7_0_OR_GREATER + public RuntimeFieldsType() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public RuntimeFieldsType() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal RuntimeFieldsType(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long CharsMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long CharsTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long DocTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long IndexCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyCollection Lang { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LinesMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long LinesTotal { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + string Name { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ScriptlessCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long ShadowedCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SourceMax { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long SourceTotal { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SearchableSnapshots.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SearchableSnapshots.g.cs index bec733cbe70..d01e42f8558 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SearchableSnapshots.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SearchableSnapshots.g.cs @@ -17,26 +17,129 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SearchableSnapshotsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFullCopyIndicesCount = System.Text.Json.JsonEncodedText.Encode("full_copy_indices_count"); + private static readonly System.Text.Json.JsonEncodedText PropIndicesCount = System.Text.Json.JsonEncodedText.Encode("indices_count"); + private static readonly System.Text.Json.JsonEncodedText PropSharedCacheIndicesCount = System.Text.Json.JsonEncodedText.Encode("shared_cache_indices_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshots Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFullCopyIndicesCount = default; + LocalJsonValue propIndicesCount = default; + LocalJsonValue propSharedCacheIndicesCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFullCopyIndicesCount.TryReadProperty(ref reader, options, PropFullCopyIndicesCount, null)) + { + continue; + } + + if (propIndicesCount.TryReadProperty(ref reader, options, PropIndicesCount, null)) + { + continue; + } + + if (propSharedCacheIndicesCount.TryReadProperty(ref reader, options, PropSharedCacheIndicesCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshots(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + FullCopyIndicesCount = propFullCopyIndicesCount.Value, + IndicesCount = propIndicesCount.Value, + SharedCacheIndicesCount = propSharedCacheIndicesCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshots value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFullCopyIndicesCount, value.FullCopyIndicesCount, null, null); + writer.WriteProperty(options, PropIndicesCount, value.IndicesCount, null, null); + writer.WriteProperty(options, PropSharedCacheIndicesCount, value.SharedCacheIndicesCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SearchableSnapshotsConverter))] public sealed partial class SearchableSnapshots { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("full_copy_indices_count")] - public int? FullCopyIndicesCount { get; init; } - [JsonInclude, JsonPropertyName("indices_count")] - public int IndicesCount { get; init; } - [JsonInclude, JsonPropertyName("shared_cache_indices_count")] - public int? SharedCacheIndicesCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SearchableSnapshots(bool available, bool enabled, int indicesCount) + { + Available = available; + Enabled = enabled; + IndicesCount = indicesCount; + } +#if NET7_0_OR_GREATER + public SearchableSnapshots() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SearchableSnapshots() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SearchableSnapshots(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public int? FullCopyIndicesCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int IndicesCount { get; set; } + public int? SharedCacheIndicesCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Security.g.cs index 211ed2cfadf..6a4f04a390b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Security.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Security.g.cs @@ -17,44 +17,269 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAnonymous = System.Text.Json.JsonEncodedText.Encode("anonymous"); + private static readonly System.Text.Json.JsonEncodedText PropApiKeyService = System.Text.Json.JsonEncodedText.Encode("api_key_service"); + private static readonly System.Text.Json.JsonEncodedText PropAudit = System.Text.Json.JsonEncodedText.Encode("audit"); + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFips140 = System.Text.Json.JsonEncodedText.Encode("fips_140"); + private static readonly System.Text.Json.JsonEncodedText PropIpfilter = System.Text.Json.JsonEncodedText.Encode("ipfilter"); + private static readonly System.Text.Json.JsonEncodedText PropOperatorPrivileges = System.Text.Json.JsonEncodedText.Encode("operator_privileges"); + private static readonly System.Text.Json.JsonEncodedText PropRealms = System.Text.Json.JsonEncodedText.Encode("realms"); + private static readonly System.Text.Json.JsonEncodedText PropRoleMapping = System.Text.Json.JsonEncodedText.Encode("role_mapping"); + private static readonly System.Text.Json.JsonEncodedText PropRoles = System.Text.Json.JsonEncodedText.Encode("roles"); + private static readonly System.Text.Json.JsonEncodedText PropSsl = System.Text.Json.JsonEncodedText.Encode("ssl"); + private static readonly System.Text.Json.JsonEncodedText PropSystemKey = System.Text.Json.JsonEncodedText.Encode("system_key"); + private static readonly System.Text.Json.JsonEncodedText PropTokenService = System.Text.Json.JsonEncodedText.Encode("token_service"); + + public override Elastic.Clients.Elasticsearch.Xpack.Security Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAnonymous = default; + LocalJsonValue propApiKeyService = default; + LocalJsonValue propAudit = default; + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propFips140 = default; + LocalJsonValue propIpfilter = default; + LocalJsonValue propOperatorPrivileges = default; + LocalJsonValue> propRealms = default; + LocalJsonValue> propRoleMapping = default; + LocalJsonValue propRoles = default; + LocalJsonValue propSsl = default; + LocalJsonValue propSystemKey = default; + LocalJsonValue propTokenService = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAnonymous.TryReadProperty(ref reader, options, PropAnonymous, null)) + { + continue; + } + + if (propApiKeyService.TryReadProperty(ref reader, options, PropApiKeyService, null)) + { + continue; + } + + if (propAudit.TryReadProperty(ref reader, options, PropAudit, null)) + { + continue; + } + + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFips140.TryReadProperty(ref reader, options, PropFips140, null)) + { + continue; + } + + if (propIpfilter.TryReadProperty(ref reader, options, PropIpfilter, null)) + { + continue; + } + + if (propOperatorPrivileges.TryReadProperty(ref reader, options, PropOperatorPrivileges, null)) + { + continue; + } + + if (propRealms.TryReadProperty(ref reader, options, PropRealms, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRoleMapping.TryReadProperty(ref reader, options, PropRoleMapping, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propRoles.TryReadProperty(ref reader, options, PropRoles, null)) + { + continue; + } + + if (propSsl.TryReadProperty(ref reader, options, PropSsl, null)) + { + continue; + } + + if (propSystemKey.TryReadProperty(ref reader, options, PropSystemKey, null)) + { + continue; + } + + if (propTokenService.TryReadProperty(ref reader, options, PropTokenService, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Security(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Anonymous = propAnonymous.Value, + ApiKeyService = propApiKeyService.Value, + Audit = propAudit.Value, + Available = propAvailable.Value, + Enabled = propEnabled.Value, + Fips140 = propFips140.Value, + Ipfilter = propIpfilter.Value, + OperatorPrivileges = propOperatorPrivileges.Value, + Realms = propRealms.Value, + RoleMapping = propRoleMapping.Value, + Roles = propRoles.Value, + Ssl = propSsl.Value, + SystemKey = propSystemKey.Value, + TokenService = propTokenService.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Security value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAnonymous, value.Anonymous, null, null); + writer.WriteProperty(options, PropApiKeyService, value.ApiKeyService, null, null); + writer.WriteProperty(options, PropAudit, value.Audit, null, null); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFips140, value.Fips140, null, null); + writer.WriteProperty(options, PropIpfilter, value.Ipfilter, null, null); + writer.WriteProperty(options, PropOperatorPrivileges, value.OperatorPrivileges, null, null); + writer.WriteProperty(options, PropRealms, value.Realms, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoleMapping, value.RoleMapping, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropRoles, value.Roles, null, null); + writer.WriteProperty(options, PropSsl, value.Ssl, null, null); + writer.WriteProperty(options, PropSystemKey, value.SystemKey, null, null); + writer.WriteProperty(options, PropTokenService, value.TokenService, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityConverter))] public sealed partial class Security { - [JsonInclude, JsonPropertyName("anonymous")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Anonymous { get; init; } - [JsonInclude, JsonPropertyName("api_key_service")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle ApiKeyService { get; init; } - [JsonInclude, JsonPropertyName("audit")] - public Elastic.Clients.Elasticsearch.Xpack.Audit Audit { get; init; } - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("fips_140")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Fips140 { get; init; } - [JsonInclude, JsonPropertyName("ipfilter")] - public Elastic.Clients.Elasticsearch.Xpack.IpFilter Ipfilter { get; init; } - [JsonInclude, JsonPropertyName("operator_privileges")] - public Elastic.Clients.Elasticsearch.Xpack.Base OperatorPrivileges { get; init; } - [JsonInclude, JsonPropertyName("realms")] - public IReadOnlyDictionary Realms { get; init; } - [JsonInclude, JsonPropertyName("role_mapping")] - public IReadOnlyDictionary RoleMapping { get; init; } - [JsonInclude, JsonPropertyName("roles")] - public Elastic.Clients.Elasticsearch.Xpack.SecurityRoles Roles { get; init; } - [JsonInclude, JsonPropertyName("ssl")] - public Elastic.Clients.Elasticsearch.Xpack.Ssl Ssl { get; init; } - [JsonInclude, JsonPropertyName("system_key")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle? SystemKey { get; init; } - [JsonInclude, JsonPropertyName("token_service")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle TokenService { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Security(Elastic.Clients.Elasticsearch.Xpack.FeatureToggle anonymous, Elastic.Clients.Elasticsearch.Xpack.FeatureToggle apiKeyService, Elastic.Clients.Elasticsearch.Xpack.Audit audit, bool available, bool enabled, Elastic.Clients.Elasticsearch.Xpack.FeatureToggle fips140, Elastic.Clients.Elasticsearch.Xpack.IpFilter ipfilter, Elastic.Clients.Elasticsearch.Xpack.Base operatorPrivileges, System.Collections.Generic.IReadOnlyDictionary realms, System.Collections.Generic.IReadOnlyDictionary roleMapping, Elastic.Clients.Elasticsearch.Xpack.SecurityRoles roles, Elastic.Clients.Elasticsearch.Xpack.Ssl ssl, Elastic.Clients.Elasticsearch.Xpack.FeatureToggle tokenService) + { + Anonymous = anonymous; + ApiKeyService = apiKeyService; + Audit = audit; + Available = available; + Enabled = enabled; + Fips140 = fips140; + Ipfilter = ipfilter; + OperatorPrivileges = operatorPrivileges; + Realms = realms; + RoleMapping = roleMapping; + Roles = roles; + Ssl = ssl; + TokenService = tokenService; + } +#if NET7_0_OR_GREATER + public Security() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Security() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Security(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Anonymous { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle ApiKeyService { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Audit Audit { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Fips140 { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.IpFilter Ipfilter { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Base OperatorPrivileges { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Realms { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary RoleMapping { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SecurityRoles Roles { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Ssl Ssl { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle? SystemKey { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle TokenService { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRoles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRoles.g.cs index 030ac839f55..28551634a3f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRoles.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRoles.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityRolesConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDls = System.Text.Json.JsonEncodedText.Encode("dls"); + private static readonly System.Text.Json.JsonEncodedText PropFile = System.Text.Json.JsonEncodedText.Encode("file"); + private static readonly System.Text.Json.JsonEncodedText PropNative = System.Text.Json.JsonEncodedText.Encode("native"); + + public override Elastic.Clients.Elasticsearch.Xpack.SecurityRoles Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDls = default; + LocalJsonValue propFile = default; + LocalJsonValue propNative = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDls.TryReadProperty(ref reader, options, PropDls, null)) + { + continue; + } + + if (propFile.TryReadProperty(ref reader, options, PropFile, null)) + { + continue; + } + + if (propNative.TryReadProperty(ref reader, options, PropNative, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SecurityRoles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dls = propDls.Value, + File = propFile.Value, + Native = propNative.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SecurityRoles value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDls, value.Dls, null, null); + writer.WriteProperty(options, PropFile, value.File, null, null); + writer.WriteProperty(options, PropNative, value.Native, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesConverter))] public sealed partial class SecurityRoles { - [JsonInclude, JsonPropertyName("dls")] - public Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls Dls { get; init; } - [JsonInclude, JsonPropertyName("file")] - public Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile File { get; init; } - [JsonInclude, JsonPropertyName("native")] - public Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative Native { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecurityRoles(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls dls, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile file, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative native) + { + Dls = dls; + File = file; + Native = native; + } +#if NET7_0_OR_GREATER + public SecurityRoles() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SecurityRoles() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecurityRoles(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls Dls { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile File { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative Native { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDls.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDls.g.cs index fd9a684bbb6..ea791ac5f7d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDls.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDls.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityRolesDlsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropBitSetCache = System.Text.Json.JsonEncodedText.Encode("bit_set_cache"); + + public override Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBitSetCache = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propBitSetCache.TryReadProperty(ref reader, options, PropBitSetCache, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + BitSetCache = propBitSetCache.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDls value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropBitSetCache, value.BitSetCache, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsConverter))] public sealed partial class SecurityRolesDls { - [JsonInclude, JsonPropertyName("bit_set_cache")] - public Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache BitSetCache { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecurityRolesDls(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache bitSetCache) + { + BitSetCache = bitSetCache; + } +#if NET7_0_OR_GREATER + public SecurityRolesDls() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SecurityRolesDls() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecurityRolesDls(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache BitSetCache { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDlsBitSetCache.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDlsBitSetCache.g.cs index f98d3c6cab0..9be2b97ae94 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDlsBitSetCache.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesDlsBitSetCache.g.cs @@ -17,22 +17,104 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityRolesDlsBitSetCacheConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropMemory = System.Text.Json.JsonEncodedText.Encode("memory"); + private static readonly System.Text.Json.JsonEncodedText PropMemoryInBytes = System.Text.Json.JsonEncodedText.Encode("memory_in_bytes"); + + public override Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propMemory = default; + LocalJsonValue propMemoryInBytes = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propMemory.TryReadProperty(ref reader, options, PropMemory, null)) + { + continue; + } + + if (propMemoryInBytes.TryReadProperty(ref reader, options, PropMemoryInBytes, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Memory = propMemory.Value, + MemoryInBytes = propMemoryInBytes.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCache value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropMemory, value.Memory, null, null); + writer.WriteProperty(options, PropMemoryInBytes, value.MemoryInBytes, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesDlsBitSetCacheConverter))] public sealed partial class SecurityRolesDlsBitSetCache { - [JsonInclude, JsonPropertyName("count")] - public int Count { get; init; } - [JsonInclude, JsonPropertyName("memory")] - public Elastic.Clients.Elasticsearch.ByteSize? Memory { get; init; } - [JsonInclude, JsonPropertyName("memory_in_bytes")] - public long MemoryInBytes { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecurityRolesDlsBitSetCache(int count, long memoryInBytes) + { + Count = count; + MemoryInBytes = memoryInBytes; + } +#if NET7_0_OR_GREATER + public SecurityRolesDlsBitSetCache() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SecurityRolesDlsBitSetCache() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecurityRolesDlsBitSetCache(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + int Count { get; set; } + public Elastic.Clients.Elasticsearch.ByteSize? Memory { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long MemoryInBytes { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesFile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesFile.g.cs index ffa666dcac8..4131fcc4a5a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesFile.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesFile.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityRolesFileConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDls = System.Text.Json.JsonEncodedText.Encode("dls"); + private static readonly System.Text.Json.JsonEncodedText PropFls = System.Text.Json.JsonEncodedText.Encode("fls"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDls = default; + LocalJsonValue propFls = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDls.TryReadProperty(ref reader, options, PropDls, null)) + { + continue; + } + + if (propFls.TryReadProperty(ref reader, options, PropFls, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dls = propDls.Value, + Fls = propFls.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFile value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDls, value.Dls, null, null); + writer.WriteProperty(options, PropFls, value.Fls, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesFileConverter))] public sealed partial class SecurityRolesFile { - [JsonInclude, JsonPropertyName("dls")] - public bool Dls { get; init; } - [JsonInclude, JsonPropertyName("fls")] - public bool Fls { get; init; } - [JsonInclude, JsonPropertyName("size")] - public long Size { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecurityRolesFile(bool dls, bool fls, long size) + { + Dls = dls; + Fls = fls; + Size = size; + } +#if NET7_0_OR_GREATER + public SecurityRolesFile() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SecurityRolesFile() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecurityRolesFile(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Dls { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Fls { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Size { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesNative.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesNative.g.cs index d170e7a2fab..85cf68d5125 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesNative.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/SecurityRolesNative.g.cs @@ -17,22 +17,109 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SecurityRolesNativeConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropDls = System.Text.Json.JsonEncodedText.Encode("dls"); + private static readonly System.Text.Json.JsonEncodedText PropFls = System.Text.Json.JsonEncodedText.Encode("fls"); + private static readonly System.Text.Json.JsonEncodedText PropSize = System.Text.Json.JsonEncodedText.Encode("size"); + + public override Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propDls = default; + LocalJsonValue propFls = default; + LocalJsonValue propSize = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propDls.TryReadProperty(ref reader, options, PropDls, null)) + { + continue; + } + + if (propFls.TryReadProperty(ref reader, options, PropFls, null)) + { + continue; + } + + if (propSize.TryReadProperty(ref reader, options, PropSize, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Dls = propDls.Value, + Fls = propFls.Value, + Size = propSize.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNative value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropDls, value.Dls, null, null); + writer.WriteProperty(options, PropFls, value.Fls, null, null); + writer.WriteProperty(options, PropSize, value.Size, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SecurityRolesNativeConverter))] public sealed partial class SecurityRolesNative { - [JsonInclude, JsonPropertyName("dls")] - public bool Dls { get; init; } - [JsonInclude, JsonPropertyName("fls")] - public bool Fls { get; init; } - [JsonInclude, JsonPropertyName("size")] - public long Size { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SecurityRolesNative(bool dls, bool fls, long size) + { + Dls = dls; + Fls = fls; + Size = size; + } +#if NET7_0_OR_GREATER + public SecurityRolesNative() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public SecurityRolesNative() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal SecurityRolesNative(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Dls { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Fls { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Size { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Slm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Slm.g.cs index 27a52c04a4b..8347f67e75e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Slm.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Slm.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SlmConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropPolicyCount = System.Text.Json.JsonEncodedText.Encode("policy_count"); + private static readonly System.Text.Json.JsonEncodedText PropPolicyStats = System.Text.Json.JsonEncodedText.Encode("policy_stats"); + + public override Elastic.Clients.Elasticsearch.Xpack.Slm Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propPolicyCount = default; + LocalJsonValue propPolicyStats = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propPolicyCount.TryReadProperty(ref reader, options, PropPolicyCount, null)) + { + continue; + } + + if (propPolicyStats.TryReadProperty(ref reader, options, PropPolicyStats, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Slm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + PolicyCount = propPolicyCount.Value, + PolicyStats = propPolicyStats.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Slm value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropPolicyCount, value.PolicyCount, null, null); + writer.WriteProperty(options, PropPolicyStats, value.PolicyStats, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SlmConverter))] public sealed partial class Slm { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("policy_count")] - public int? PolicyCount { get; init; } - [JsonInclude, JsonPropertyName("policy_stats")] - public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics? PolicyStats { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Slm(bool available, bool enabled) + { + Available = available; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Slm() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Slm() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Slm(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public int? PolicyCount { get; set; } + public Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement.Statistics? PolicyStats { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Sql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Sql.g.cs index bb01bb673a0..026d24a2f4b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Sql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Sql.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SqlConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropFeatures = System.Text.Json.JsonEncodedText.Encode("features"); + private static readonly System.Text.Json.JsonEncodedText PropQueries = System.Text.Json.JsonEncodedText.Encode("queries"); + + public override Elastic.Clients.Elasticsearch.Xpack.Sql Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propEnabled = default; + LocalJsonValue> propFeatures = default; + LocalJsonValue> propQueries = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propFeatures.TryReadProperty(ref reader, options, PropFeatures, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propQueries.TryReadProperty(ref reader, options, PropQueries, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Sql(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Enabled = propEnabled.Value, + Features = propFeatures.Value, + Queries = propQueries.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Sql value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropFeatures, value.Features, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropQueries, value.Queries, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SqlConverter))] public sealed partial class Sql { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("features")] - public IReadOnlyDictionary Features { get; init; } - [JsonInclude, JsonPropertyName("queries")] - public IReadOnlyDictionary Queries { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Sql(bool available, bool enabled, System.Collections.Generic.IReadOnlyDictionary features, System.Collections.Generic.IReadOnlyDictionary queries) + { + Available = available; + Enabled = enabled; + Features = features; + Queries = queries; + } +#if NET7_0_OR_GREATER + public Sql() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Sql() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Sql(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Features { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Queries { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ssl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ssl.g.cs index 43f5fdeef8c..a4c4074d49e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ssl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Ssl.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class SslConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropHttp = System.Text.Json.JsonEncodedText.Encode("http"); + private static readonly System.Text.Json.JsonEncodedText PropTransport = System.Text.Json.JsonEncodedText.Encode("transport"); + + public override Elastic.Clients.Elasticsearch.Xpack.Ssl Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propHttp = default; + LocalJsonValue propTransport = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propHttp.TryReadProperty(ref reader, options, PropHttp, null)) + { + continue; + } + + if (propTransport.TryReadProperty(ref reader, options, PropTransport, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Ssl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Http = propHttp.Value, + Transport = propTransport.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Ssl value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropHttp, value.Http, null, null); + writer.WriteProperty(options, PropTransport, value.Transport, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.SslConverter))] public sealed partial class Ssl { - [JsonInclude, JsonPropertyName("http")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Http { get; init; } - [JsonInclude, JsonPropertyName("transport")] - public Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Transport { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Ssl(Elastic.Clients.Elasticsearch.Xpack.FeatureToggle http, Elastic.Clients.Elasticsearch.Xpack.FeatureToggle transport) + { + Http = http; + Transport = transport; + } +#if NET7_0_OR_GREATER + public Ssl() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Ssl() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Ssl(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Http { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.FeatureToggle Transport { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Vector.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Vector.g.cs index 3837f93624a..e67fd9d6660 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Vector.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Vector.g.cs @@ -17,26 +17,134 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class VectorConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropDenseVectorDimsAvgCount = System.Text.Json.JsonEncodedText.Encode("dense_vector_dims_avg_count"); + private static readonly System.Text.Json.JsonEncodedText PropDenseVectorFieldsCount = System.Text.Json.JsonEncodedText.Encode("dense_vector_fields_count"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropSparseVectorFieldsCount = System.Text.Json.JsonEncodedText.Encode("sparse_vector_fields_count"); + + public override Elastic.Clients.Elasticsearch.Xpack.Vector Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propDenseVectorDimsAvgCount = default; + LocalJsonValue propDenseVectorFieldsCount = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propSparseVectorFieldsCount = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propDenseVectorDimsAvgCount.TryReadProperty(ref reader, options, PropDenseVectorDimsAvgCount, null)) + { + continue; + } + + if (propDenseVectorFieldsCount.TryReadProperty(ref reader, options, PropDenseVectorFieldsCount, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propSparseVectorFieldsCount.TryReadProperty(ref reader, options, PropSparseVectorFieldsCount, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Vector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + DenseVectorDimsAvgCount = propDenseVectorDimsAvgCount.Value, + DenseVectorFieldsCount = propDenseVectorFieldsCount.Value, + Enabled = propEnabled.Value, + SparseVectorFieldsCount = propSparseVectorFieldsCount.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Vector value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropDenseVectorDimsAvgCount, value.DenseVectorDimsAvgCount, null, null); + writer.WriteProperty(options, PropDenseVectorFieldsCount, value.DenseVectorFieldsCount, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropSparseVectorFieldsCount, value.SparseVectorFieldsCount, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.VectorConverter))] public sealed partial class Vector { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("dense_vector_dims_avg_count")] - public int DenseVectorDimsAvgCount { get; init; } - [JsonInclude, JsonPropertyName("dense_vector_fields_count")] - public int DenseVectorFieldsCount { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("sparse_vector_fields_count")] - public int? SparseVectorFieldsCount { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Vector(bool available, int denseVectorDimsAvgCount, int denseVectorFieldsCount, bool enabled) + { + Available = available; + DenseVectorDimsAvgCount = denseVectorDimsAvgCount; + DenseVectorFieldsCount = denseVectorFieldsCount; + Enabled = enabled; + } +#if NET7_0_OR_GREATER + public Vector() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Vector() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Vector(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DenseVectorDimsAvgCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + int DenseVectorFieldsCount { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public int? SparseVectorFieldsCount { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Watcher.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Watcher.g.cs index 9d26dfbbfa1..72520a802fa 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Watcher.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/Watcher.g.cs @@ -17,26 +17,139 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAvailable = System.Text.Json.JsonEncodedText.Encode("available"); + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropEnabled = System.Text.Json.JsonEncodedText.Encode("enabled"); + private static readonly System.Text.Json.JsonEncodedText PropExecution = System.Text.Json.JsonEncodedText.Encode("execution"); + private static readonly System.Text.Json.JsonEncodedText PropWatch = System.Text.Json.JsonEncodedText.Encode("watch"); + + public override Elastic.Clients.Elasticsearch.Xpack.Watcher Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAvailable = default; + LocalJsonValue propCount = default; + LocalJsonValue propEnabled = default; + LocalJsonValue propExecution = default; + LocalJsonValue propWatch = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAvailable.TryReadProperty(ref reader, options, PropAvailable, null)) + { + continue; + } + + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propEnabled.TryReadProperty(ref reader, options, PropEnabled, null)) + { + continue; + } + + if (propExecution.TryReadProperty(ref reader, options, PropExecution, null)) + { + continue; + } + + if (propWatch.TryReadProperty(ref reader, options, PropWatch, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.Watcher(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Available = propAvailable.Value, + Count = propCount.Value, + Enabled = propEnabled.Value, + Execution = propExecution.Value, + Watch = propWatch.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.Watcher value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAvailable, value.Available, null, null); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropEnabled, value.Enabled, null, null); + writer.WriteProperty(options, PropExecution, value.Execution, null, null); + writer.WriteProperty(options, PropWatch, value.Watch, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherConverter))] public sealed partial class Watcher { - [JsonInclude, JsonPropertyName("available")] - public bool Available { get; init; } - [JsonInclude, JsonPropertyName("count")] - public Elastic.Clients.Elasticsearch.Xpack.Counter Count { get; init; } - [JsonInclude, JsonPropertyName("enabled")] - public bool Enabled { get; init; } - [JsonInclude, JsonPropertyName("execution")] - public Elastic.Clients.Elasticsearch.Xpack.WatcherActions Execution { get; init; } - [JsonInclude, JsonPropertyName("watch")] - public Elastic.Clients.Elasticsearch.Xpack.WatcherWatch Watch { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Watcher(bool available, Elastic.Clients.Elasticsearch.Xpack.Counter count, bool enabled, Elastic.Clients.Elasticsearch.Xpack.WatcherActions execution, Elastic.Clients.Elasticsearch.Xpack.WatcherWatch watch) + { + Available = available; + Count = count; + Enabled = enabled; + Execution = execution; + Watch = watch; + } +#if NET7_0_OR_GREATER + public Watcher() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public Watcher() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal Watcher(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + bool Available { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Counter Count { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + bool Enabled { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.WatcherActions Execution { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.WatcherWatch Watch { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActionTotals.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActionTotals.g.cs index 1094b1bd0cd..0c4cdf4a0ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActionTotals.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActionTotals.g.cs @@ -17,20 +17,94 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherActionTotalsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + private static readonly System.Text.Json.JsonEncodedText PropTotalTimeInMs = System.Text.Json.JsonEncodedText.Encode("total_time_in_ms"); + + public override Elastic.Clients.Elasticsearch.Xpack.WatcherActionTotals Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propTotal = default; + LocalJsonValue propTotalTimeInMs = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (propTotalTimeInMs.TryReadProperty(ref reader, options, PropTotalTimeInMs, static System.TimeSpan (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker)))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.WatcherActionTotals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Total = propTotal.Value, + TotalTimeInMs = propTotalTimeInMs.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.WatcherActionTotals value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteProperty(options, PropTotalTimeInMs, value.TotalTimeInMs, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.TimeSpan v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.TimeSpanMillisMarker))); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherActionTotalsConverter))] public sealed partial class WatcherActionTotals { - [JsonInclude, JsonPropertyName("total")] - public Elastic.Clients.Elasticsearch.Duration Total { get; init; } - [JsonInclude, JsonPropertyName("total_time_in_ms")] - public long TotalTimeInMs { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatcherActionTotals(Elastic.Clients.Elasticsearch.Duration total, System.TimeSpan totalTimeInMs) + { + Total = total; + TotalTimeInMs = totalTimeInMs; + } +#if NET7_0_OR_GREATER + public WatcherActionTotals() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatcherActionTotals() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatcherActionTotals(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Duration Total { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.TimeSpan TotalTimeInMs { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActions.g.cs index 9372f8fb7f1..803acd1ac3a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActions.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherActions.g.cs @@ -17,18 +17,79 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherActionsConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActions = System.Text.Json.JsonEncodedText.Encode("actions"); + + public override Elastic.Clients.Elasticsearch.Xpack.WatcherActions Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue> propActions = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActions.TryReadProperty(ref reader, options, PropActions, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.WatcherActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Actions = propActions.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.WatcherActions value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActions, value.Actions, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherActionsConverter))] public sealed partial class WatcherActions { - [JsonInclude, JsonPropertyName("actions")] - public IReadOnlyDictionary Actions { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatcherActions(System.Collections.Generic.IReadOnlyDictionary actions) + { + Actions = actions; + } +#if NET7_0_OR_GREATER + public WatcherActions() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatcherActions() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatcherActions(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Actions { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatch.g.cs index c865d7bd206..6ddf88fad22 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatch.g.cs @@ -17,24 +17,114 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherWatchConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAction = System.Text.Json.JsonEncodedText.Encode("action"); + private static readonly System.Text.Json.JsonEncodedText PropCondition = System.Text.Json.JsonEncodedText.Encode("condition"); + private static readonly System.Text.Json.JsonEncodedText PropInput = System.Text.Json.JsonEncodedText.Encode("input"); + private static readonly System.Text.Json.JsonEncodedText PropTrigger = System.Text.Json.JsonEncodedText.Encode("trigger"); + + public override Elastic.Clients.Elasticsearch.Xpack.WatcherWatch Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propAction = default; + LocalJsonValue?> propCondition = default; + LocalJsonValue> propInput = default; + LocalJsonValue propTrigger = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAction.TryReadProperty(ref reader, options, PropAction, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propCondition.TryReadProperty(ref reader, options, PropCondition, static System.Collections.Generic.IReadOnlyDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null))) + { + continue; + } + + if (propInput.TryReadProperty(ref reader, options, PropInput, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, null)!)) + { + continue; + } + + if (propTrigger.TryReadProperty(ref reader, options, PropTrigger, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.WatcherWatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Action = propAction.Value, + Condition = propCondition.Value, + Input = propInput.Value, + Trigger = propTrigger.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.WatcherWatch value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAction, value.Action, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropCondition, value.Condition, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropInput, value.Input, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropTrigger, value.Trigger, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherWatchConverter))] public sealed partial class WatcherWatch { - [JsonInclude, JsonPropertyName("action")] - public IReadOnlyDictionary? Action { get; init; } - [JsonInclude, JsonPropertyName("condition")] - public IReadOnlyDictionary? Condition { get; init; } - [JsonInclude, JsonPropertyName("input")] - public IReadOnlyDictionary Input { get; init; } - [JsonInclude, JsonPropertyName("trigger")] - public Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger Trigger { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatcherWatch(System.Collections.Generic.IReadOnlyDictionary input, Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger trigger) + { + Input = input; + Trigger = trigger; + } +#if NET7_0_OR_GREATER + public WatcherWatch() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatcherWatch() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatcherWatch(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public System.Collections.Generic.IReadOnlyDictionary? Action { get; set; } + public System.Collections.Generic.IReadOnlyDictionary? Condition { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + System.Collections.Generic.IReadOnlyDictionary Input { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger Trigger { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTrigger.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTrigger.g.cs index 8ff7b000de5..4d2979a4e1c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTrigger.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTrigger.g.cs @@ -17,20 +17,89 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherWatchTriggerConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText PropSchedule = System.Text.Json.JsonEncodedText.Encode("schedule"); + + public override Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAll = default; + LocalJsonValue propSchedule = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propSchedule.TryReadProperty(ref reader, options, PropSchedule, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + All = propAll.Value, + Schedule = propSchedule.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTrigger value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropSchedule, value.Schedule, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerConverter))] public sealed partial class WatcherWatchTrigger { - [JsonInclude, JsonPropertyName("_all")] - public Elastic.Clients.Elasticsearch.Xpack.Counter All { get; init; } - [JsonInclude, JsonPropertyName("schedule")] - public Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerSchedule? Schedule { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatcherWatchTrigger(Elastic.Clients.Elasticsearch.Xpack.Counter all) + { + All = all; + } +#if NET7_0_OR_GREATER + public WatcherWatchTrigger() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatcherWatchTrigger() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatcherWatchTrigger(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Counter All { get; set; } + public Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerSchedule? Schedule { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTriggerSchedule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTriggerSchedule.g.cs index 4224582c241..4f3d89d533a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTriggerSchedule.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/WatcherWatchTriggerSchedule.g.cs @@ -17,24 +17,124 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class WatcherWatchTriggerScheduleConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropActive = System.Text.Json.JsonEncodedText.Encode("active"); + private static readonly System.Text.Json.JsonEncodedText PropAll = System.Text.Json.JsonEncodedText.Encode("_all"); + private static readonly System.Text.Json.JsonEncodedText PropCron = System.Text.Json.JsonEncodedText.Encode("cron"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerSchedule Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propActive = default; + LocalJsonValue propAll = default; + LocalJsonValue propCron = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propActive.TryReadProperty(ref reader, options, PropActive, null)) + { + continue; + } + + if (propAll.TryReadProperty(ref reader, options, PropAll, null)) + { + continue; + } + + if (propCron.TryReadProperty(ref reader, options, PropCron, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerSchedule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Active = propActive.Value, + All = propAll.Value, + Cron = propCron.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerSchedule value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropActive, value.Active, null, null); + writer.WriteProperty(options, PropAll, value.All, null, null); + writer.WriteProperty(options, PropCron, value.Cron, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.WatcherWatchTriggerScheduleConverter))] public sealed partial class WatcherWatchTriggerSchedule { - [JsonInclude, JsonPropertyName("active")] - public long Active { get; init; } - [JsonInclude, JsonPropertyName("_all")] - public Elastic.Clients.Elasticsearch.Xpack.Counter All { get; init; } - [JsonInclude, JsonPropertyName("cron")] - public Elastic.Clients.Elasticsearch.Xpack.Counter Cron { get; init; } - [JsonInclude, JsonPropertyName("total")] - public long Total { get; init; } + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public WatcherWatchTriggerSchedule(long active, Elastic.Clients.Elasticsearch.Xpack.Counter all, Elastic.Clients.Elasticsearch.Xpack.Counter cron, long total) + { + Active = active; + All = all; + Cron = cron; + Total = total; + } +#if NET7_0_OR_GREATER + public WatcherWatchTriggerSchedule() + { + } +#endif +#if !NET7_0_OR_GREATER + [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] + public WatcherWatchTriggerSchedule() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal WatcherWatchTriggerSchedule(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER + required +#endif + long Active { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Counter All { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + Elastic.Clients.Elasticsearch.Xpack.Counter Cron { get; set; } + public +#if NET7_0_OR_GREATER + required +#endif + long Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/XpackUsageQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/XpackUsageQuery.g.cs index 271b6182cb8..06af498146f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/XpackUsageQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Xpack/XpackUsageQuery.g.cs @@ -17,24 +17,99 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Xpack; +internal sealed partial class XpackUsageQueryConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropCount = System.Text.Json.JsonEncodedText.Encode("count"); + private static readonly System.Text.Json.JsonEncodedText PropFailed = System.Text.Json.JsonEncodedText.Encode("failed"); + private static readonly System.Text.Json.JsonEncodedText PropPaging = System.Text.Json.JsonEncodedText.Encode("paging"); + private static readonly System.Text.Json.JsonEncodedText PropTotal = System.Text.Json.JsonEncodedText.Encode("total"); + + public override Elastic.Clients.Elasticsearch.Xpack.XpackUsageQuery Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propCount = default; + LocalJsonValue propFailed = default; + LocalJsonValue propPaging = default; + LocalJsonValue propTotal = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propCount.TryReadProperty(ref reader, options, PropCount, null)) + { + continue; + } + + if (propFailed.TryReadProperty(ref reader, options, PropFailed, null)) + { + continue; + } + + if (propPaging.TryReadProperty(ref reader, options, PropPaging, null)) + { + continue; + } + + if (propTotal.TryReadProperty(ref reader, options, PropTotal, null)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Xpack.XpackUsageQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Count = propCount.Value, + Failed = propFailed.Value, + Paging = propPaging.Value, + Total = propTotal.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Xpack.XpackUsageQuery value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropCount, value.Count, null, null); + writer.WriteProperty(options, PropFailed, value.Failed, null, null); + writer.WriteProperty(options, PropPaging, value.Paging, null, null); + writer.WriteProperty(options, PropTotal, value.Total, null, null); + writer.WriteEndObject(); + } +} + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Xpack.XpackUsageQueryConverter))] public sealed partial class XpackUsageQuery { - [JsonInclude, JsonPropertyName("count")] - public int? Count { get; init; } - [JsonInclude, JsonPropertyName("failed")] - public int? Failed { get; init; } - [JsonInclude, JsonPropertyName("paging")] - public int? Paging { get; init; } - [JsonInclude, JsonPropertyName("total")] - public int? Total { get; init; } +#if NET7_0_OR_GREATER + public XpackUsageQuery() + { + } +#endif +#if !NET7_0_OR_GREATER + public XpackUsageQuery() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal XpackUsageQuery(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public int? Count { get; set; } + public int? Failed { get; set; } + public int? Paging { get; set; } + public int? Total { get; set; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/GetAsyncSearchRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/GetAsyncSearchRequest.cs index 0df7e6e5abe..17d06d6e72a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/GetAsyncSearchRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/GetAsyncSearchRequest.cs @@ -6,18 +6,7 @@ namespace Elastic.Clients.Elasticsearch.AsyncSearch; public partial class GetAsyncSearchRequest { - // Any request may contain aggregations so we force typed_keys in order to successfully deserialise them. + // Any request may contain aggregations so we force `typed_keys` in order to successfully + // deserialize them. internal override void BeforeRequest() => TypedKeys = true; } - -public sealed partial class GetAsyncSearchRequestDescriptor -{ - // Any request may contain aggregations so we force typed_keys in order to successfully deserialise them. - internal override void BeforeRequest() => TypedKeys(true); -} - -public sealed partial class GetAsyncSearchRequestDescriptor -{ - // Any request may contain aggregations so we force typed_keys in order to successfully deserialise them. - internal override void BeforeRequest() => TypedKeys(true); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/SubmitAsyncSearchRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/SubmitAsyncSearchRequest.cs index a1ced0490e5..d12357c844c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/SubmitAsyncSearchRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/AsyncSearch/SubmitAsyncSearchRequest.cs @@ -9,24 +9,16 @@ namespace Elastic.Clients.Elasticsearch.AsyncSearch; public partial class SubmitAsyncSearchRequest { - // Any request may contain aggregations so we force typed_keys in order to successfully deserialise them. + // Any request may contain aggregations so we force typed_keys in order to successfully deserialize them. internal override void BeforeRequest() => TypedKeys = true; } -public sealed partial class SubmitAsyncSearchRequestDescriptor +public readonly partial struct SubmitAsyncSearchRequestDescriptor { - public SubmitAsyncSearchRequestDescriptor MatchAll(Action? selector = null) => selector is null ? Query(q => q.MatchAll(new MatchAllQuery())) : Query(q => q.MatchAll(selector)); - - internal override void BeforeRequest() => TypedKeys(true); + public SubmitAsyncSearchRequestDescriptor MatchAll(Action? action = null) => Query(q => q.MatchAll(action)); } -public sealed partial class SubmitAsyncSearchRequestDescriptor +public readonly partial struct SubmitAsyncSearchRequestDescriptor { - public SubmitAsyncSearchRequestDescriptor MatchAll() - { - Query(new MatchAllQuery()); - return Self; - } - - internal override void BeforeRequest() => TypedKeys(true); + public SubmitAsyncSearchRequestDescriptor MatchAll(Action? action = null) => Query(q => q.MatchAll(action)); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkRequest.cs index f23c1024675..d23f5e27f21 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkRequest.cs @@ -11,6 +11,7 @@ using Elastic.Clients.Elasticsearch.Core.Bulk; using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Clients.Elasticsearch.Requests; +using System.Runtime.InteropServices; namespace Elastic.Clients.Elasticsearch; @@ -26,7 +27,7 @@ public partial class BulkRequest : IStreamSerializable protected internal override IRequestConfiguration RequestConfig => RequestConfigSingleton; - public BulkOperationsCollection Operations { get; set; } + public BulkOperationsCollection? Operations { get; set; } public void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None) { @@ -73,186 +74,137 @@ public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings set } } -public sealed partial class BulkRequestDescriptor : IStreamSerializable +[StructLayout(LayoutKind.Auto)] +public readonly partial struct BulkRequestDescriptor { - private static readonly IRequestConfiguration RequestConfigSingleton = new RequestConfiguration - { - Accept = "application/json", - ContentType = "application/x-ndjson" - }; - - protected internal override IRequestConfiguration RequestConfig => RequestConfigSingleton; - - private readonly BulkOperationsCollection _operations = new(); - - public BulkRequestDescriptor Index(string index) - { - RouteValues.Optional("index", IndexName.Parse(index)); - return Self; - } - - public BulkRequestDescriptor Create(TSource document, Action> configure = null) + public BulkRequestDescriptor Create(TSource document, Action>? configure = null) { var descriptor = new BulkCreateOperationDescriptor(document); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Create(TSource document, IndexName index, Action> configure = null) + public BulkRequestDescriptor Create(TSource document, IndexName index, Action>? configure = null) { var descriptor = new BulkCreateOperationDescriptor(document, index); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Index(TSource document, Action> configure = null) + public BulkRequestDescriptor Index(TSource document, Action>? configure = null) { var descriptor = new BulkIndexOperationDescriptor(document); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Index(TSource document, IndexName index, Action> configure = null) + public BulkRequestDescriptor Index(TSource document, IndexName index, Action>? configure = null) { var descriptor = new BulkIndexOperationDescriptor(document, index); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } public BulkRequestDescriptor Update(BulkUpdateOperation update) { - _operations.Add(update); + Instance.Operations ??= new(); + Instance.Operations.Add(update); return this; } - public BulkRequestDescriptor Update(Action> configure) + public BulkRequestDescriptor Update(Action>? configure) { var descriptor = new BulkUpdateOperationDescriptor(); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Update(Action> configure) => + public BulkRequestDescriptor Update(Action>? configure) => Update(configure); - public BulkRequestDescriptor Delete(Id id, Action configure = null) + public BulkRequestDescriptor Delete(Id id, Action? configure = null) { var descriptor = new BulkDeleteOperationDescriptor(id); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Delete(string id, Action configure = null) + public BulkRequestDescriptor Delete(string id, Action? configure = null) { var descriptor = new BulkDeleteOperationDescriptor(id); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Delete(Action configure) + public BulkRequestDescriptor Delete(Action? configure) { var descriptor = new BulkDeleteOperationDescriptor(); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } - public BulkRequestDescriptor Delete(TSource documentToDelete, Action configure = null) + public BulkRequestDescriptor Delete(TSource documentToDelete, Action? configure = null) { var descriptor = new BulkDeleteOperationDescriptor(new Id(documentToDelete)); configure?.Invoke(descriptor); - _operations.Add(descriptor); + Instance.Operations ??= new(); + Instance.Operations.Add(descriptor.Instance); return this; } public BulkRequestDescriptor Delete(Action configure) => Delete(configure); public BulkRequestDescriptor CreateMany(IEnumerable documents, Action, TSource> bulkCreateSelector) => - AddOperations(documents, bulkCreateSelector, o => new BulkCreateOperationDescriptor(o)); + AddOperations(documents, bulkCreateSelector, o => new BulkCreateOperationDescriptor(o), x => x.Instance); public BulkRequestDescriptor CreateMany(IEnumerable documents) => - AddOperations(documents, null, o => new BulkCreateOperationDescriptor(o)); + AddOperations(documents, null, o => new BulkCreateOperationDescriptor(o), x => x.Instance); public BulkRequestDescriptor IndexMany(IEnumerable documents, Action, TSource> bulkIndexSelector) => - AddOperations(documents, bulkIndexSelector, o => new BulkIndexOperationDescriptor(o)); + AddOperations(documents, bulkIndexSelector, o => new BulkIndexOperationDescriptor(o), x => x.Instance); public BulkRequestDescriptor IndexMany(IEnumerable documents) => - AddOperations(documents, null, o => new BulkIndexOperationDescriptor(o)); + AddOperations(documents, null, o => new BulkIndexOperationDescriptor(o), x => x.Instance); public BulkRequestDescriptor UpdateMany(IEnumerable objects, Action, TSource> bulkIndexSelector) => - AddOperations(objects, bulkIndexSelector, o => new BulkUpdateOperationDescriptor().IdFrom(o)); + AddOperations(objects, bulkIndexSelector, o => new BulkUpdateOperationDescriptor().IdFrom(o), x => x.Instance); public BulkRequestDescriptor UpdateMany(IEnumerable objects) => - AddOperations(objects, null, o => new BulkUpdateOperationDescriptor().IdFrom(o)); + AddOperations(objects, null, o => new BulkUpdateOperationDescriptor().IdFrom(o), x => x.Instance); public BulkRequestDescriptor DeleteMany(IEnumerable objects, Action bulkDeleteSelector) => - AddOperations(objects, bulkDeleteSelector, obj => new BulkDeleteOperationDescriptor(new Id(obj))); + AddOperations(objects, bulkDeleteSelector, obj => new BulkDeleteOperationDescriptor(new Id(obj)), x => x.Instance); public BulkRequestDescriptor DeleteMany(IEnumerable ids, Action bulkDeleteSelector) => - AddOperations(ids, bulkDeleteSelector, id => new BulkDeleteOperationDescriptor(id)); + AddOperations(ids, bulkDeleteSelector, id => new BulkDeleteOperationDescriptor(id), x => x.Instance); public BulkRequestDescriptor DeleteMany(IEnumerable objects) => - AddOperations(objects, null, obj => new BulkDeleteOperationDescriptor(obj)); + AddOperations(objects, null, obj => new BulkDeleteOperationDescriptor(obj), x => x.Instance); public BulkRequestDescriptor DeleteMany(IndexName index, IEnumerable ids) => - AddOperations(ids, null, id => new BulkDeleteOperationDescriptor(id).Index(index)); - - public void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None) - { - if (_operations is null) - return; - - var index = Self.RouteValues.Get("index"); - - foreach (var op in _operations) - { - if (op is not IStreamSerializable serializable) - { - ThrowHelper.ThrowInvalidOperationForBulkWhenNotIStreamSerializable(); - return; - } - - op.PrepareIndex(index); - - serializable.Serialize(stream, settings, SerializationFormatting.None); - stream.WriteByte((byte)'\n'); - } - } - - public async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None) - { - if (_operations is null) - return; - - var index = Self.RouteValues.Get("index"); - - foreach (var op in _operations) - { - if (op is not IStreamSerializable serializable) - { - ThrowHelper.ThrowInvalidOperationForBulkWhenNotIStreamSerializable(); - return; - } - - op.PrepareIndex(index); - - await serializable.SerializeAsync(stream, settings, SerializationFormatting.None).ConfigureAwait(false); - stream.WriteByte((byte)'\n'); - } - } + AddOperations(ids, null, id => new BulkDeleteOperationDescriptor(id).Index(index), x => x.Instance); private BulkRequestDescriptor AddOperations( - IEnumerable objects, - Action configureDescriptor, - Func createDescriptor - ) where TDescriptor : IBulkOperation + IEnumerable? objects, + Action? configureDescriptor, + Func createDescriptor, + Func getInstance) { if (@objects == null) return this; @@ -269,10 +221,11 @@ Func createDescriptor configureDescriptor(descriptor, o); } - operations.Add(descriptor); + operations.Add(getInstance(descriptor)); } - _operations.AddRange(operations); - return Self; + Instance.Operations ??= new(); + Instance.Operations.AddRange(operations); + return this; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkResponse.cs index 10780cbce97..9bf5828c418 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/BulkResponse.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.Text.Json.Serialization; using System.Text; @@ -10,11 +11,10 @@ namespace Elastic.Clients.Elasticsearch; +// TODO: BulkRequest requires refactoring prior to 9.x release + public partial class BulkResponse { - [JsonConverter(typeof(BulkResponseItemConverter)), JsonPropertyName("items")] - public IReadOnlyList Items { get; init; } - [JsonIgnore] public IEnumerable ItemsWithErrors => !Items.HasAny() ? Enumerable.Empty() diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/CountRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/CountRequest.cs index 63dcddab77c..d6f384a2a04 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/CountRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/CountRequest.cs @@ -3,38 +3,35 @@ // See the LICENSE file in the project root for more information. using System; -using Elastic.Clients.Elasticsearch.QueryDsl; namespace Elastic.Clients.Elasticsearch; -public sealed partial class CountRequest : CountRequest -{ - //protected CountRequest TypedSelf => this; +// Allows the generator to correctly detect that this type is used as base type, even when no code +// has been generated yet. +public partial class CountRequest; - ////{index}/_count - public CountRequest() : base(typeof(TDocument)) +public sealed partial class CountRequest : + CountRequest +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountRequest() : + base(typeof(TDocument)) { } - ////{index}/_count - ///Optional, accepts null - public CountRequest(Indices index) : base(index) + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CountRequest(Indices index) : + base(index) { } } -public partial class CountRequestDescriptor +public readonly partial struct CountRequestDescriptor { + [Obsolete("Use 'Indices()' instead.")] public CountRequestDescriptor Index(Indices indices) { - RouteValues.Optional("index", indices); - return Self; - } - - public CountRequestDescriptor Query(Func configure) - { - var container = configure?.Invoke(new QueryDescriptor()); - QueryValue = container; - return Self; + Instance.Indices = indices; + return this; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/CreateRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/CreateRequest.cs deleted file mode 100644 index c5675311479..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/CreateRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch; - -public sealed partial class CreateRequest -{ - - public CreateRequest(Id id) : this(typeof(TDocument), id) - { - } - - public CreateRequest(TDocument documentWithId, IndexName index = null, Id id = null) - : this(index ?? typeof(TDocument), id ?? Id.From(documentWithId)) => - Document = documentWithId; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/DeleteRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/DeleteRequest.cs index c2a6e9ceb67..8fcd75be480 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/DeleteRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/DeleteRequest.cs @@ -2,15 +2,31 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Diagnostics.CodeAnalysis; + namespace Elastic.Clients.Elasticsearch; -public sealed partial class DeleteRequest : DeleteRequest +// Allows the generator to correctly detect that this type is used as base type, even when no code +// has been generated yet. +public partial class DeleteRequest; + +public sealed class DeleteRequest : DeleteRequest { - public DeleteRequest(IndexName index, Id id) : base(index, id) { } + [SetsRequiredMembers] + public DeleteRequest(IndexName index, Id id) : + base(index, id) + { + } - public DeleteRequest(Id id) : this(typeof(TDocument), id) + [SetsRequiredMembers] + public DeleteRequest(Id id) : + this(typeof(TDocument), id) { } - public DeleteRequest(TDocument documentWithId, IndexName index = null, Id id = null) : this(index ?? typeof(TDocument), id ?? Id.From(documentWithId)) { } + [SetsRequiredMembers] + public DeleteRequest(TDocument documentWithId) : + this(typeof(TDocument), Id.From(documentWithId)) + { + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Eql/EqlGetResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Eql/EqlGetResponse.cs index 7074fc78b8d..c56e306688f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Eql/EqlGetResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Eql/EqlGetResponse.cs @@ -2,10 +2,6 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -// TODO: Move away from shared project - -#if !ELASTICSEARCH_SERVERLESS - using System.Collections.Generic; using System.Text.Json.Serialization; @@ -16,7 +12,6 @@ public partial class EqlGetResponse private IReadOnlyCollection> _events; private IReadOnlyCollection> _sequences; - [JsonIgnore] public IReadOnlyCollection> Events => _events ??= Hits?.Events ?? EmptyReadOnly>.Collection; @@ -28,5 +23,3 @@ public partial class EqlGetResponse [JsonIgnore] public long Total => Hits?.Total.Value ?? -1; } - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ExistsRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/ExistsRequest.cs deleted file mode 100644 index abb03eb618c..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ExistsRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch; - -public partial class ExistsRequest -{ - public ExistsRequest(Type type, Id id) : base(r => r.Required("index", Infer.Index(type)).Required("id", id)) - { - } -} diff --git a/src/Elastic.Clients.Elasticsearch.Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs similarity index 88% rename from src/Elastic.Clients.Elasticsearch.Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs rename to src/Elastic.Clients.Elasticsearch/_Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs index 5b722d75ad6..e2f6549ef91 100644 --- a/src/Elastic.Clients.Elasticsearch.Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Extensions/CreateIndexRequestDescriptorExtensions.cs @@ -4,11 +4,7 @@ using System; -#if ELASTICSEARCH_SERVERLESS -namespace Elastic.Clients.Elasticsearch.Serverless.IndexManagement; -#else namespace Elastic.Clients.Elasticsearch.IndexManagement; -#endif public static class CreateIndexRequestDescriptorExtensions { @@ -18,6 +14,7 @@ public static class CreateIndexRequestDescriptorExtensions /// A descriptor for an index request. /// The name of the alias. /// The to allow fluent chaining of calls to configure the indexing request. + [Obsolete("Use 'Aliases(string)' instead.")] public static CreateIndexRequestDescriptor WithAlias(this CreateIndexRequestDescriptor descriptor, string aliasName) { #if NET8_0_OR_GREATER @@ -27,7 +24,7 @@ public static CreateIndexRequestDescriptor WithAlias(this CreateIndexRequestDesc throw new ArgumentNullException(nameof(aliasName)); #endif - descriptor.Aliases(a => a.Add(aliasName, static _ => { })); + descriptor.Aliases(aliasName); return descriptor; } @@ -38,6 +35,7 @@ public static CreateIndexRequestDescriptor WithAlias(this CreateIndexRequestDesc /// A fluent descriptor for an index request. /// The name of the alias. /// The to allow fluent chaining of calls to configure the indexing request. + [Obsolete("Use 'Aliases(string)' instead.")] public static CreateIndexRequestDescriptor WithAlias(this CreateIndexRequestDescriptor descriptor, string aliasName) { #if NET8_0_OR_GREATER @@ -47,7 +45,7 @@ public static CreateIndexRequestDescriptor WithAlias(this throw new ArgumentNullException(nameof(aliasName)); #endif - descriptor.Aliases(a => a.Add(aliasName, static _ => { })); + descriptor.Aliases(aliasName); return descriptor; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceRequestDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceRequestDescriptor.cs index 9c284eac810..f0f70a8daaf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceRequestDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceRequestDescriptor.cs @@ -4,14 +4,14 @@ namespace Elastic.Clients.Elasticsearch; -public partial class GetSourceRequestDescriptor +public readonly partial struct GetSourceRequestDescriptor { /// /// A shortcut into calling Index(typeof(TOther)). /// public GetSourceRequestDescriptor Index() { - RouteValues.Required("index", (IndexName)typeof(TOther)); - return Self; + Instance.Index = typeof(TOther); + return this; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceResponse.cs index 96cfa23efe7..19db7764bbb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/GetSourceResponse.cs @@ -2,29 +2,12 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Text.Json; -using System.IO; -using Elastic.Clients.Elasticsearch.Serialization; +using System; namespace Elastic.Clients.Elasticsearch; -public partial class GetSourceResponse : ISelfDeserializable +public partial class GetSourceResponse { - public TDocument Body { get; set; } - - public void Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - using var jsonDoc = JsonSerializer.Deserialize(ref reader); - - using var stream = new MemoryStream(); - - var writer = new Utf8JsonWriter(stream); - jsonDoc.WriteTo(writer); - writer.Flush(); - stream.Position = 0; - - var body = settings.SourceSerializer.Deserialize(stream); - - Body = body; - } + [Obsolete($"Use '{nameof(Source)}' instead.")] + public TDocument Body { get => Source; set => Source = value; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetAliasResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetAliasResponse.cs index d0a3fdcd288..7be09b3726d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetAliasResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetAliasResponse.cs @@ -9,12 +9,6 @@ namespace Elastic.Clients.Elasticsearch.IndexManagement; public partial class GetAliasResponse { - /// - /// A dictionary containing the organised by . - /// - [JsonIgnore] - public IReadOnlyDictionary Aliases => BackingDictionary; - /// /// Checks if a response is functionally valid or not. /// This is a client abstraction to have a single property to check whether there was something wrong with a request. diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetFieldMappingResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetFieldMappingResponse.cs index 9734623b3d1..2afdf7cbcfb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetFieldMappingResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetFieldMappingResponse.cs @@ -2,24 +2,17 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -// TODO: Move away from shared project - -#if !ELASTICSEARCH_SERVERLESS - using System; using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; + using Elastic.Clients.Elasticsearch.Mapping; namespace Elastic.Clients.Elasticsearch.IndexManagement; public partial class GetFieldMappingResponse { - [JsonIgnore] - public IReadOnlyDictionary FieldMappings => BackingDictionary; - - public IProperty? GetProperty(IndexName index, Field field) + public IProperty? GetProperty(string index, string field) { if (index is null) throw new ArgumentNullException(nameof(index)); @@ -32,13 +25,13 @@ public partial class GetFieldMappingResponse if (mappings is null) return null; - if (!mappings.TryGetValue(field, out var fieldMapping) || fieldMapping.Mapping is null) + if (!mappings.TryGetValue(field, out var fieldMapping)) return null; - return fieldMapping.Mapping.TryGetProperty(PropertyName.FromField(field), out var property) ? property : null; + return string.Equals(fieldMapping.Mapping.Key, field, StringComparison.Ordinal) ? fieldMapping.Mapping.Value : null; } - public bool TryGetProperty(IndexName index, Field field, out IProperty property) + public bool TryGetProperty(string index, string field, [NotNullWhen(true)] out IProperty? property) { property = null; @@ -53,46 +46,23 @@ public bool TryGetProperty(IndexName index, Field field, out IProperty property) if (mappings is null) return false; - if (!mappings.TryGetValue(field, out var fieldMapping) || fieldMapping.Mapping is null) + if (!mappings.TryGetValue(field, out var fieldMapping)) return false; - if (fieldMapping.Mapping.TryGetProperty(PropertyName.FromField(field), out var matched)) + if (string.Equals(fieldMapping.Mapping.Key, field, StringComparison.Ordinal)) { - property = matched; + property = fieldMapping.Mapping.Value; return true; } return false; } - public IProperty? PropertyFor(Field field) => PropertyFor(field, null); - - public IProperty? PropertyFor(Field field, IndexName index) => - GetProperty(index ?? Infer.Index(), field); - - public IProperty? PropertyFor(Expression> objectPath) - where T : class => - GetProperty(Infer.Index(), Infer.Field(objectPath)); - - public IProperty? PropertyFor(Expression> objectPath, IndexName index) - where T : class => - GetProperty(index, Infer.Field(objectPath)); - - public IProperty? PropertyFor(Expression> objectPath) - where T : class => - GetProperty(Infer.Index(), Infer.Field(objectPath)); - - public IProperty? PropertyFor(Expression> objectPath, IndexName index) - where T : class => - GetProperty(index, Infer.Field(objectPath)); - - private IReadOnlyDictionary MappingsFor(IndexName index) + private IReadOnlyDictionary? MappingsFor(string index) { - if (!FieldMappings.TryGetValue(index, out var indexMapping) || indexMapping.Mappings == null) + if (FieldMappings!.TryGetValue(index, out var indexMapping)) return null; return indexMapping.Mappings; } } - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetIndexResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetIndexResponse.cs deleted file mode 100644 index 9b33d1544fd..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetIndexResponse.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.IndexManagement; - -public partial class GetIndexResponse -{ - [JsonIgnore] - public IReadOnlyDictionary Indices => BackingDictionary; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetMappingResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetMappingResponse.cs index bfe6ac31e30..c47b62cc243 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetMappingResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexManagement/GetMappingResponse.cs @@ -2,27 +2,17 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; -using System.Text.Json.Serialization; using Elastic.Clients.Elasticsearch.Mapping; namespace Elastic.Clients.Elasticsearch.IndexManagement; -public partial class GetMappingResponse -{ - [JsonIgnore] - public IReadOnlyDictionary Indices => BackingDictionary; -} - public static class GetMappingResponseExtensions { - public static TypeMapping GetMappingFor(this GetMappingResponse response) => response.GetMappingFor(typeof(T)); - - public static TypeMapping GetMappingFor(this GetMappingResponse response, IndexName index) + public static TypeMapping? GetMappingFor(this GetMappingResponse response, string index) { if (index.IsNullOrEmpty()) return null; - return response.Indices.TryGetValue(index, out var indexMappings) ? indexMappings.Mappings : null; + return response.Mappings.TryGetValue(index, out var indexMappings) ? indexMappings.Mappings : null; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexRequest.cs index b1f8495634c..28790dfbf39 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/IndexRequest.cs @@ -2,33 +2,14 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Requests; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; public partial class IndexRequest { - public IndexRequest() : this(typeof(TDocument)) { } - - public IndexRequest(TDocument document, Id id) : this(typeof(TDocument), id) => Document = document; - protected override HttpMethod? DynamicHttpMethod => GetHttpMethod(this); - public IndexRequest(TDocument document, IndexName index = null, Id id = null) : this(index ?? typeof(TDocument), id ?? Id.From(document)) => Document = document; - - internal Request Self => this; - - [JsonIgnore] private Id? Id => RouteValues.Get("id"); - internal static HttpMethod GetHttpMethod(IndexRequest request) => request.Id?.StringOrLongValue != null || request.RouteValues.ContainsId ? HttpMethod.PUT : HttpMethod.POST; } - -public sealed partial class IndexRequestDescriptor -{ - internal Id _id; - - protected override HttpMethod? DynamicHttpMethod => _id is not null || RouteValues.ContainsId ? HttpMethod.PUT : HttpMethod.POST; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Ingest/GetPipelineResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/Ingest/GetPipelineResponse.cs deleted file mode 100644 index 22c85ee1f72..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/Ingest/GetPipelineResponse.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Ingest; - -public partial class GetPipelineResponse -{ - [JsonIgnore] - public IReadOnlyDictionary Pipelines => BackingDictionary; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchRequest.cs index c7fc45a28af..4ec8f52cd77 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchRequest.cs @@ -2,30 +2,47 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.IO; using System.Linq; using System.Text.Json.Serialization; +using System.Threading.Tasks; + +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; public partial class MultiSearchResponse { - public override bool IsValidResponse => base.IsValidResponse && (Responses?.All(b => b.Item1 is not null && b.Item1.Status == 200) ?? true); + public override bool IsValidResponse => base.IsValidResponse && (Responses?.All(b => b.Value1 is not null && b.Value1.Status == 200) ?? true); [JsonIgnore] public int TotalResponses => Responses.HasAny() ? Responses.Count() : 0; } -public sealed partial class MultiSearchRequestDescriptor +public partial class MultiSearchRequest : IStreamSerializable { - internal override void BeforeRequest() => TypedKeys(true); -} + internal override void BeforeRequest() => TypedKeys = true; -public sealed partial class MultiSearchRequestDescriptor -{ - internal override void BeforeRequest() => TypedKeys(true); -} + void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + { + if (Searches is null) + return; + foreach (var item in Searches) + { + if (item is IStreamSerializable serializable) + serializable.Serialize(stream, settings, formatting); + } + } -public partial class MultiSearchRequest -{ - internal override void BeforeRequest() => TypedKeys = true; + async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + { + if (Searches is null) + return; + foreach (var item in Searches) + { + if (item is IStreamSerializable serializable) + await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); + } + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchTemplateRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchTemplateRequest.cs new file mode 100644 index 00000000000..131a29d81c3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/MultiSearchTemplateRequest.cs @@ -0,0 +1,48 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Linq; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; + +namespace Elastic.Clients.Elasticsearch; + +public partial class MultiSearchTemplateResponse +{ + public override bool IsValidResponse => base.IsValidResponse && (Responses?.All(b => b.Value1 is not null && b.Value1.Status == 200) ?? true); + + [JsonIgnore] + public int TotalResponses => Responses.HasAny() ? Responses.Count() : 0; +} + +public partial class MultiSearchTemplateRequest : IStreamSerializable +{ + internal override void BeforeRequest() => TypedKeys = true; + + void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + { + if (SearchTemplates is null) + return; + foreach (var item in SearchTemplates) + { + if (item is IStreamSerializable serializable) + serializable.Serialize(stream, settings, formatting); + } + } + + async Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + { + if (SearchTemplates is null) + return; + foreach (var item in SearchTemplates) + { + if (item is IStreamSerializable serializable) + await serializable.SerializeAsync(stream, settings, formatting).ConfigureAwait(false); + } + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ResponseItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/ResponseItem.cs index f43dd53ef29..628116b44c1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ResponseItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/ResponseItem.cs @@ -3,9 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; +[JsonConverter(typeof(BulkResponseItemConverter))] public abstract partial class ResponseItem { public abstract string Operation { get; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ScrollResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/ScrollResponse.cs index 494b3b15084..c85fa4970d9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/ScrollResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/ScrollResponse.cs @@ -17,5 +17,5 @@ public partial class ScrollResponse public IReadOnlyCollection Documents => HitsMetadata.Hits.Select(s => s.Source).ToReadOnlyCollection(); [JsonIgnore] - public long Total => HitsMetadata?.Total?.Item1?.Value ?? HitsMetadata?.Total?.Item2 ?? -1; + public long Total => HitsMetadata?.Total?.Value1?.Value ?? HitsMetadata?.Total?.Value2 ?? -1; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchRequest.cs index f22e3e323c7..648e535c02f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchRequest.cs @@ -4,7 +4,11 @@ using System; using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; @@ -20,7 +24,7 @@ internal override void BeforeRequest() protected override (string ResolvedUrl, string UrlTemplate, Dictionary? resolvedRouteValues) ResolveUrl(RouteValues routeValues, IElasticsearchClientSettings settings) { - if (Pit is not null && !string.IsNullOrEmpty(Pit.Id ?? string.Empty) && routeValues.ContainsKey("index")) + if (!string.IsNullOrEmpty(Pit?.Id) && routeValues.ContainsKey("index")) { routeValues.Remove("index"); } @@ -29,6 +33,7 @@ protected override (string ResolvedUrl, string UrlTemplate, Dictionary : SearchRequest { public SearchRequest(Indices? indices) : base(indices) @@ -40,39 +45,38 @@ public SearchRequest() : base(typeof(TInferDocument)) } } -public sealed partial class SearchRequestDescriptor +public readonly partial struct SearchRequestDescriptor { - public SearchRequestDescriptor Index(Indices indices) - { - Self.RouteValues.Optional("index", indices); - return Self; - } + [Obsolete("Use 'Indices()' instead.")] + public SearchRequestDescriptor Index(Indices indices) => Indices(indices); public SearchRequestDescriptor Pit(string id, Action configure) { - PitValue = null; - PitDescriptorAction = null; configure += a => a.Id(id); - PitDescriptorAction = configure; - return Self; + return Pit(configure); } +} - internal override void BeforeRequest() - { - if (AggregationsValue is not null || /*AggregationsDescriptor is not null || AggregationsDescriptorAction is not null ||*/ - SuggestValue is not null || SuggestDescriptor is not null || SuggestDescriptorAction is not null) - { - TypedKeys(true); - } - } +internal sealed class SearchRequestOfTConverterFactory : + JsonConverterFactory +{ + public override bool CanConvert(Type typeToConvert) => + typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(SearchRequest<>); - protected override (string ResolvedUrl, string UrlTemplate, Dictionary? resolvedRouteValues) ResolveUrl(RouteValues routeValues, IElasticsearchClientSettings settings) + public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - if ((Self.PitValue is not null || Self.PitDescriptor is not null || Self.PitDescriptorAction is not null) && routeValues.ContainsKey("index")) - { - routeValues.Remove("index"); - } + var args = typeToConvert.GetGenericArguments(); - return base.ResolveUrl(routeValues, settings); + return (JsonConverter)Activator.CreateInstance(typeof(SearchRequestOfTConverter<>).MakeGenericType(args[0])); } } + +internal sealed class SearchRequestOfTConverter : + JsonConverter> +{ + public override SearchRequest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => + throw new NotSupportedException(); + + public override void Write(Utf8JsonWriter writer, SearchRequest value, JsonSerializerOptions options) => + writer.WriteValue(options, (SearchRequest)value); +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchResponse.cs index 22d4cd39207..d3bb84283e2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchResponse.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Api/SearchResponse.cs @@ -17,5 +17,5 @@ public partial class SearchResponse public IReadOnlyCollection Documents => HitsMetadata.Hits.Select(s => s.Source).ToReadOnlyCollection(); [JsonIgnore] - public long Total => HitsMetadata?.Total?.Item1?.Value ?? HitsMetadata?.Total?.Item2 ?? -1; + public long Total => HitsMetadata?.Total?.Value1?.Value ?? HitsMetadata?.Total?.Value2 ?? -1; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-BulkAll.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-BulkAll.cs index c1d02427932..013881b40b7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-BulkAll.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-BulkAll.cs @@ -2,8 +2,6 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !ELASTICSEARCH_SERVERLESS - using System; using System.Collections.Generic; using System.Threading; @@ -16,11 +14,11 @@ public virtual BulkAllObservable BulkAll(IEnumerable documents, Action< { var descriptor = new BulkAllRequestDescriptor(documents); configure?.Invoke(descriptor); - return BulkAll(descriptor, cancellationToken); + return BulkAll(descriptor.Instance, cancellationToken); } - public virtual BulkAllObservable BulkAll(IBulkAllRequest request, CancellationToken cancellationToken = default) => - new(this, request, cancellationToken); + public virtual BulkAllObservable BulkAll(IBulkAllRequest request, CancellationToken cancellationToken = default) + { + return new BulkAllObservable(this, request, cancellationToken); + } } - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-Manual.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-Manual.cs index 30b2a62e3f4..0fc47ca0df6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-Manual.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient-Manual.cs @@ -10,14 +10,14 @@ namespace Elastic.Clients.Elasticsearch; public partial class ElasticsearchClient { - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] public virtual UpdateResponse Update(TDocument document, TPartialDocument partialDocument, IndexName index, Id id) { var descriptor = new UpdateRequestDescriptor(index, id); descriptor.Upsert(document); descriptor.Doc(partialDocument); - descriptor.BeforeRequest(); - return DoRequest, UpdateResponse, UpdateRequestParameters>(descriptor); + var request = descriptor.Instance; + request.BeforeRequest(); + return DoRequest, UpdateResponse, UpdateRequestParameters>(request); } public virtual Task> UpdateAsync(TDocument document, TPartialDocument partialDocument, IndexName index, Id id, CancellationToken cancellationToken = default) @@ -25,8 +25,9 @@ public virtual Task> UpdateAsync(index, id); descriptor.Upsert(document); descriptor.Doc(partialDocument); - descriptor.BeforeRequest(); - return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); + var request = descriptor.Instance; + request.BeforeRequest(); + return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(request, cancellationToken); } public virtual Task> UpdateAsync(TDocument document, TPartialDocument partialDocument, Action> configureRequest, CancellationToken cancellationToken = default) @@ -35,7 +36,8 @@ public virtual Task> UpdateAsync, UpdateResponse, UpdateRequestParameters>(descriptor, cancellationToken); + var request = descriptor.Instance; + request.BeforeRequest(); + return DoRequestAsync, UpdateResponse, UpdateRequestParameters>(request, cancellationToken); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.Esql.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.Esql.cs index 76740e3fc05..4b65cf410e6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.Esql.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.Esql.cs @@ -12,12 +12,7 @@ using System.Threading; using Elastic.Transport; -#if ELASTICSEARCH_SERVERLESS -namespace Elastic.Clients.Elasticsearch.Serverless.Esql; -#else - namespace Elastic.Clients.Elasticsearch.Esql; -#endif public partial class EsqlNamespacedClient { @@ -32,8 +27,9 @@ public virtual Task QueryAsStreamAsync( { var descriptor = new EsqlQueryRequestDescriptor(); configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync, StreamResponse, EsqlQueryRequestParameters>(descriptor, cancellationToken); + var request = descriptor.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } /// @@ -47,8 +43,9 @@ public virtual Task QueryAsStreamAsync( { var descriptor = new EsqlQueryRequestDescriptor(); configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + var request = descriptor.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); } public virtual async Task> QueryAsObjectsAsync( diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndexManyExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndexManyExtensions.cs index 9002e2f13dd..b33c8521083 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndexManyExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndexManyExtensions.cs @@ -27,7 +27,6 @@ public static class IndexManyExtensions /// The type used to infer the default index and typename /// List of objects to index, Id will be inferred (Id property or IdProperty attribute on type) /// Override the inferred typename for T - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] public static BulkResponse IndexMany(this ElasticsearchClient client, IEnumerable @objects) where T : class { @@ -45,7 +44,6 @@ public static BulkResponse IndexMany(this ElasticsearchClient client, IEnumer /// List of objects to index, Id will be inferred (Id property or IdProperty attribute on type) /// Override the inferred indexname for T /// Override the inferred typename for T - [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] public static BulkResponse IndexMany(this ElasticsearchClient client, IEnumerable @objects, IndexName index) where T : class { diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndicesNamespace.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndicesNamespace.cs deleted file mode 100644 index f39de5b2c8c..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Client/IndicesNamespace.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -// TODO: Move away from shared project - -#if !ELASTICSEARCH_SERVERLESS - -using System.Threading.Tasks; -using System.Threading; -using System; - -namespace Elastic.Clients.Elasticsearch.IndexManagement; - -public partial class IndicesNamespacedClient -{ - public virtual GetAliasResponse GetAlias(Indices indicies, Action configureRequest) - { - var descriptor = new GetAliasRequestDescriptor(indicies, null); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequest(descriptor); - } - - public virtual Task GetAliasAsync(Indices indicies, Action configureRequest, CancellationToken cancellationToken = default) - { - var descriptor = new GetAliasRequestDescriptor(indicies, null); - configureRequest?.Invoke(descriptor); - descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); - } -} - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ClrTypeDefaults.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ClrTypeDefaults.cs index 18759b25600..b11c17d1d2d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ClrTypeDefaults.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ClrTypeDefaults.cs @@ -4,7 +4,6 @@ using System; using System.Linq.Expressions; -using Elastic.Clients.Elasticsearch.Fluent; namespace Elastic.Clients.Elasticsearch; @@ -45,7 +44,9 @@ public class ClrTypeMapping public sealed class ClrTypeMapping : ClrTypeMapping { - public ClrTypeMapping() : base(typeof(TDocument)) { } + public ClrTypeMapping() : base(typeof(TDocument)) + { + } /// /// Set a default Id property on CLR type that NEST will evaluate @@ -58,7 +59,7 @@ public ClrTypeMapping() : base(typeof(TDocument)) { } public Expression> RoutingProperty { get; set; } } -public sealed class ClrTypeMappingDescriptor : Descriptor +public sealed class ClrTypeMappingDescriptor { internal Type _clrType; internal string _indexName; @@ -83,9 +84,15 @@ public sealed class ClrTypeMappingDescriptor : Descriptor public ClrTypeMappingDescriptor DisableIdInference(bool disable = true) => Assign(disable, (a, v) => a._disableIdInference = v); + + private ClrTypeMappingDescriptor Assign(T value, Action action) + { + action.Invoke(this, value); + return this; + } } -public sealed class ClrTypeMappingDescriptor : Descriptor> +public sealed class ClrTypeMappingDescriptor { internal Type _clrType = typeof(TDocument); internal string _indexName; @@ -114,4 +121,10 @@ public ClrTypeMappingDescriptor RoutingProperty(Expression public ClrTypeMappingDescriptor DisableIdInference(bool disable = true) => Assign(disable, (a, v) => a._disableIdInference = v); + + private ClrTypeMappingDescriptor Assign(T value, Action, T> action) + { + action.Invoke(this, value); + return this; + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ElasticsearchClientSettings.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ElasticsearchClientSettings.cs index 164388c4ad0..4c655162fd6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ElasticsearchClientSettings.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/ElasticsearchClientSettings.cs @@ -9,13 +9,7 @@ using System.Linq.Expressions; using System.Reflection; -#if ELASTICSEARCH_SERVERLESS -using Elastic.Clients.Elasticsearch.Serverless.Esql; -using Elastic.Clients.Elasticsearch.Serverless.Fluent; -#else using Elastic.Clients.Elasticsearch.Esql; -using Elastic.Clients.Elasticsearch.Fluent; -#endif using Elastic.Clients.Elasticsearch.Serialization; @@ -26,6 +20,8 @@ namespace Elastic.Clients.Elasticsearch; +public class FluentDictionary : Dictionary; + /// public class ElasticsearchClientSettings : ElasticsearchClientSettingsBase { diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/IElasticsearchClientSettings.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/IElasticsearchClientSettings.cs index 5f480534fe5..37bf49198a6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/IElasticsearchClientSettings.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Configuration/IElasticsearchClientSettings.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using Elastic.Clients.Elasticsearch.Fluent; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMath.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMath.cs index b83b689a4f1..91293abf686 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMath.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMath.cs @@ -21,7 +21,9 @@ public abstract class DateMath public static DateMathExpression Now => new("now"); internal DateMath(string anchor) => Anchor = anchor; + internal DateMath(DateTime anchor) => Anchor = anchor; + internal DateMath(Union anchor, DateMathTime range, DateMathOperation operation) { anchor.ThrowIfNull(nameof(anchor)); @@ -45,10 +47,12 @@ internal DateMath(Union anchor, DateMathTime range, DateMathOp public static DateMath FromString(string dateMath) { - if (dateMath == null) return null; + if (dateMath == null) + return null; var match = DateMathRegex.Match(dateMath); - if (!match.Success) throw new ArgumentException($"Cannot create a {nameof(DateMathExpression)} out of '{dateMath}'"); + if (!match.Success) + throw new ArgumentException($"Cannot create a {nameof(DateMathExpression)} out of '{dateMath}'"); var math = new DateMathExpression(match.Groups["anchor"].Value); @@ -58,7 +62,8 @@ public static DateMath FromString(string dateMath) do { var nextRangeStart = rangeString.Substring(1).IndexOfAny(new[] { '+', '-', '/' }); - if (nextRangeStart == -1) nextRangeStart = rangeString.Length - 1; + if (nextRangeStart == -1) + nextRangeStart = rangeString.Length - 1; var unit = rangeString.Substring(1, nextRangeStart); if (rangeString.StartsWith("+", StringComparison.Ordinal)) { @@ -70,7 +75,8 @@ public static DateMath FromString(string dateMath) math = math.Subtract(unit); rangeString = rangeString.Substring(nextRangeStart + 1); } - else rangeString = null; + else + rangeString = null; } while (!rangeString.IsNullOrEmpty()); } @@ -89,7 +95,8 @@ public static DateMath FromString(string dateMath) public override string ToString() { - if (!IsValid) return string.Empty; + if (!IsValid) + return string.Empty; var separator = Round.HasValue || Ranges.HasAny() ? "||" : string.Empty; @@ -143,6 +150,7 @@ private static string ToMinThreeDecimalPlaces(DateTime dateTime) builder.Append(':'); AppendTwoDigitNumber(builder, offset.Minutes); break; + case DateTimeKind.Utc: builder.Append('Z'); break; @@ -168,7 +176,6 @@ internal sealed class DateMathConverter : JsonConverter // TODO: Performance - Review potential to avoid allocation on DateTime path and use Span var value = reader.GetString(); - reader.Read(); if (!value.Contains("|") && DateTime.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var dateTime)) return DateMath.Anchored(dateTime); @@ -178,12 +185,6 @@ internal sealed class DateMathConverter : JsonConverter public override void Write(Utf8JsonWriter writer, DateMath value, JsonSerializerOptions options) { - if (value is null) - { - writer.WriteNullValue(); - return; - } - writer.WriteStringValue(value.ToString()); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathOperation.cs index 97b6443ae32..1498e7538ba 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathOperation.cs @@ -6,11 +6,9 @@ using System.Runtime.Serialization; using System.Text.Json; using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[StringEnum] [JsonConverter(typeof(DateMathOperationConverter))] public enum DateMathOperation { diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathTimeUnit.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathTimeUnit.cs index 424df43497b..89a2facf99e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathTimeUnit.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/DateMath/DateMathTimeUnit.cs @@ -6,11 +6,9 @@ using System.Runtime.Serialization; using System.Text.Json; using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; -[StringEnum] [JsonConverter(typeof(DateMathTimeUnitConverter))] public enum DateMathTimeUnit { diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/Duration.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/Duration.cs index c419e74112d..4cb84be9e0e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/Duration.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/Duration.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; @@ -15,7 +17,13 @@ namespace Elastic.Clients.Elasticsearch; /// Represents a duration value. /// [JsonConverter(typeof(DurationConverter))] -public sealed class Duration : IComparable, IEquatable, IUrlParameter +public sealed class Duration : + IComparable, + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { private const double MicrosecondsInATick = 0.1; // 10 ticks = 1 microsecond private const double MillisecondsInADay = MillisecondsInAnHour * 24; @@ -390,6 +398,35 @@ private static string ExponentFormat(double d) var exponent = (int)((bits >> 52) & 0x7ffL); return new string('#', Math.Max(2, exponent)); } + + #region IParsable + + public static Duration Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Duration? result) + { + if (s is null) + { + result = null; + return false; + } + + try + { + result = new Duration(s); + } + catch + { + result = null; + return false; + } + + return true; + } + + #endregion IParsable } internal sealed class DurationConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/EnumValueParser.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/EnumValueParser.cs new file mode 100644 index 00000000000..0e5e1a821e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/EnumValueParser.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +#if !NET5_0_OR_GREATER +using System.Linq; +#endif + +namespace Elastic.Clients.Elasticsearch; + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +internal static class EnumValueParser + where T : struct, Enum +{ + private static readonly Dictionary ValueMap = new(StringComparer.OrdinalIgnoreCase); + + static EnumValueParser() + { +#if NET5_0_OR_GREATER + foreach (var value in Enum.GetValues()) +#else + foreach (var value in Enum.GetValues(typeof(T)).OfType()) +#endif + { + var name = value.ToString(); + ValueMap[name] = value; + + var field = typeof(T).GetField(name); + var attribute = (EnumMemberAttribute?)Attribute.GetCustomAttribute(field!, typeof(EnumMemberAttribute)); + if (attribute?.Value is not null) + { + ValueMap[attribute.Value] = value; + } + } + } + + public static bool TryParse(string input, out T result) + { + return ValueMap.TryGetValue(input, out result); + } + + public static T Parse(string input) + { + if (ValueMap.TryGetValue(input, out var result)) + { + return result; + } + + throw new ArgumentException($"Unknown member '{input}' for enum '{typeof(T).Name}'."); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Extensions/ExceptionExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Extensions/ExceptionExtensions.cs deleted file mode 100644 index 9bea6600ff0..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Extensions/ExceptionExtensions.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch; - -internal static class ExceptionExtensions -{ - internal static T ThrowWhen(this T @object, Func predicate, string exceptionMessage) - { - var x = predicate?.Invoke(@object); - if (x.GetValueOrDefault(false)) - throw new ArgumentException(exceptionMessage); - - return @object; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValue.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValue.cs index 9caff82f822..ae0c5110f50 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValue.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValue.cs @@ -8,9 +8,6 @@ using System.Diagnostics.CodeAnalysis; using System.Collections.Generic; using System.Globalization; - -using Elastic.Transport.Extensions; - using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; @@ -20,7 +17,8 @@ namespace Elastic.Clients.Elasticsearch; /// therefore cannot be specifically typed. /// [JsonConverter(typeof(FieldValueConverter))] -public readonly struct FieldValue : IEquatable +public readonly struct FieldValue : + IEquatable { internal FieldValue(ValueKind kind, object? value) { @@ -31,12 +29,12 @@ internal FieldValue(ValueKind kind, object? value) /// /// The kind of value contained within this . /// - public readonly ValueKind Kind { get; } + public ValueKind Kind { get; } /// - /// The value contained within within this . + /// The value contained within this . /// - public readonly object? Value { get; } + public object? Value { get; } /// /// An enumeration of the possible value kinds that the may contain. @@ -47,9 +45,7 @@ public enum ValueKind Double, Long, Boolean, - String, - LazyDocument, - Composite + String } /// @@ -95,45 +91,58 @@ public enum ValueKind /// The new . public static FieldValue String(string value) => new(ValueKind.String, value); - // These are not expected to be required for consumer values but are used internally. - internal static FieldValue Any(LazyJson value) => new(ValueKind.LazyDocument, value); - - internal static FieldValue Composite(object value) => new(ValueKind.Composite, value); + /// + /// Factory method to create a from an arbitrary value. + /// + /// The value to store. + /// The new . + /// If the given is not supported. + public static FieldValue FromValue(object? value) + { + return value switch + { + null => Null, + bool and true => True, + bool and false => False, + float v => v, + double v => v, + sbyte v => v, + short v => v, + int v => v, + long v => v, + byte v => v, + ushort v => v, + uint v => v, + ulong v => unchecked((long)v), + string v => v, + _ => throw new NotSupportedException($"Unsupported value type '{value!.GetType().Name}'.") + }; + } /// /// Checks if the value of . /// - public bool IsString => Kind == ValueKind.String; + public bool IsString => Kind is ValueKind.String; /// /// Checks if the value of . /// - public bool IsBool => Kind == ValueKind.Boolean; + public bool IsBool => Kind is ValueKind.Boolean; /// /// Checks if the value of . /// - public bool IsLong => Kind == ValueKind.Long; + public bool IsLong => Kind is ValueKind.Long; /// /// Checks if the value of . /// - public bool IsDouble => Kind == ValueKind.Double; - - /// - /// Checks if the value of . - /// - public bool IsLazyDocument => Kind == ValueKind.LazyDocument; + public bool IsDouble => Kind is ValueKind.Double; /// /// Checks if the value of . /// - public bool IsNull => Kind == ValueKind.Null; - - /// - /// Checks if the value of . - /// - public bool IsComposite => Kind == ValueKind.Composite; + public bool IsNull => Kind is ValueKind.Null; /// /// Gets the value when the value kind is . @@ -142,14 +151,14 @@ public enum ValueKind /// if the value kind is ; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// True if the value is a . - public bool TryGetString([NotNullWhen(returnValue: true)] out string? value) + public bool TryGetString([NotNullWhen(true)] out string? value) { value = null; if (!IsString) return false; - value = (string)Value; + value = (string)Value!; return true; } @@ -160,14 +169,14 @@ public bool TryGetString([NotNullWhen(returnValue: true)] out string? value) /// if the value kind is ; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// True if the value is a . - public bool TryGetBool([NotNullWhen(returnValue: true)] out bool? value) + public bool TryGetBool([NotNullWhen(true)] out bool? value) { value = null; if (!IsBool) return false; - value = (bool)Value; + value = (bool)Value!; return true; } @@ -178,14 +187,14 @@ public bool TryGetBool([NotNullWhen(returnValue: true)] out bool? value) /// if the value kind is ; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// True if the value is a . - public bool TryGetLong([NotNullWhen(returnValue: true)] out long? value) + public bool TryGetLong([NotNullWhen(true)] out long? value) { value = null; if (!IsLong) return false; - value = (long)Value; + value = (long)Value!; return true; } @@ -196,62 +205,14 @@ public bool TryGetLong([NotNullWhen(returnValue: true)] out long? value) /// if the value kind is ; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// True if the value is a . - public bool TryGetDouble([NotNullWhen(returnValue: true)] out double? value) + public bool TryGetDouble([NotNullWhen(true)] out double? value) { value = null; if (!IsDouble) return false; - value = (double)Value; - return true; - } - - /// - /// Gets the value when the value kind is . - /// - /// When this method returns, contains the value associated with this , - /// if the value kind is ; otherwise, the default value for the type of the value parameter. - /// This parameter is passed uninitialized. - /// True if the value is a . - public bool TryGetLazyDocument([NotNullWhen(returnValue: true)] out LazyJson? value) - { - value = null; - - if (!IsLazyDocument) - return false; - - value = (LazyJson)Value; - return true; - } - - /// - /// Gets the value when the value kind is and the value type is . - /// - /// The type expected for the value. - /// When this method returns, contains the value associated with this , - /// if the value kind is and the value type is ; otherwise, the default - /// value for the type of the value parameter. This parameter is passed uninitialized. - /// True if the value is of the specified type. - public bool TryGet([NotNullWhen(returnValue: true)] out T? value) - { - value = default; - - if (!IsComposite || Value is not T typedValue) - return false; - - value = typedValue; - return true; - } - - internal bool TryGetComposite([NotNullWhen(returnValue: true)] out object? value) - { - value = default; - - if (!IsComposite) - return false; - - value = Value; + value = (double)Value!; return true; } @@ -259,12 +220,10 @@ public override string ToString() => Kind switch { ValueKind.Null => "null", - ValueKind.Double => ((double)Value).ToString(CultureInfo.InvariantCulture), - ValueKind.Long => ((long)Value).ToString(CultureInfo.InvariantCulture), - ValueKind.Boolean => ((bool)Value).ToString(CultureInfo.InvariantCulture), - ValueKind.String => Value as string, - ValueKind.LazyDocument or ValueKind.Composite => throw new InvalidOperationException( - "Composite field value cannot be formatted as a string."), + ValueKind.Double => ((double)Value!).ToString(CultureInfo.InvariantCulture)!, + ValueKind.Long => ((long)Value!).ToString(CultureInfo.InvariantCulture)!, + ValueKind.Boolean => ((bool)Value!).ToString(CultureInfo.InvariantCulture)!, + ValueKind.String => (string)Value!, _ => throw new InvalidOperationException($"Unknown kind '{Kind}'") }; @@ -297,85 +256,3 @@ public override int GetHashCode() public static implicit operator FieldValue(double value) => Double(value); } - -internal sealed class FieldValueConverter : JsonConverter -{ - public override FieldValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - switch (reader.TokenType) - { - case JsonTokenType.Null: - return FieldValue.Null; - - case JsonTokenType.String: - var stringValue = reader.GetString(); - return FieldValue.String(stringValue); - - case JsonTokenType.Number: - if (reader.TryGetInt64(out var l)) - { - return FieldValue.Long(l); - } - else if (reader.TryGetDouble(out var d)) - { - return FieldValue.Double(d); - } - else - { - throw new JsonException("Unexpected number format which cannot be deserialised as a FieldValue."); - } - - case JsonTokenType.True: - return FieldValue.True; - - case JsonTokenType.False: - return FieldValue.False; - - case JsonTokenType.StartObject: - case JsonTokenType.StartArray: - var value = JsonSerializer.Deserialize(ref reader, options); - return FieldValue.Any(value); - } - - throw new JsonException($"Unexpected token type '{reader.TokenType}' read while deserializing a FieldValue."); - } - - public override void Write(Utf8JsonWriter writer, FieldValue value, JsonSerializerOptions options) - { - if (value.TryGetString(out var stringValue)) - { - writer.WriteStringValue(stringValue); - } - else if (value.TryGetBool(out var boolValue)) - { - writer.WriteBooleanValue(boolValue.Value); - } - else if (value.TryGetLong(out var longValue)) - { - writer.WriteNumberValue(longValue.Value); - } - else if (value.TryGetDouble(out var doubleValue)) - { - writer.WriteNumberValue(doubleValue.Value); - } - else if (value.TryGetLazyDocument(out var lazyDocument)) - { - writer.WriteRawValue(lazyDocument.Value.Bytes); - } - else if (value.TryGetComposite(out var objectValue)) - { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); - - settings.SourceSerializer.Serialize(objectValue, objectValue.GetType(), writer, null); - } - else if (value.Kind == FieldValue.ValueKind.Null) - { - writer.WriteNullValue(); - } - else - { - throw new JsonException($"Unsupported FieldValue kind. This is likely a bug and should be reported as an issue."); - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValueConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValueConverter.cs new file mode 100644 index 00000000000..58e04fb7f72 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValueConverter.cs @@ -0,0 +1,76 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +using System.Text.Json.Serialization; +using System.Text.Json; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +internal sealed class FieldValueConverter : + JsonConverter +{ + public override FieldValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case JsonTokenType.Null: + return FieldValue.Null; + + case JsonTokenType.String: + return FieldValue.String(reader.GetString()!); + + case JsonTokenType.Number: + if (reader.TryGetInt64(out var l)) + { + return FieldValue.Long(l); + } + + if (reader.TryGetDouble(out var d)) + { + return FieldValue.Double(d); + } + + throw new JsonException($"Unexpected number format while deserializing '{nameof(FieldValue)}'."); + + case JsonTokenType.True: + return FieldValue.True; + + case JsonTokenType.False: + return FieldValue.False; + } + + throw new JsonException($"Unexpected token type '{reader.TokenType}' read while deserializing '{nameof(FieldValue)}'."); + } + + public override void Write(Utf8JsonWriter writer, FieldValue value, JsonSerializerOptions options) + { + if (value.TryGetString(out var stringValue)) + { + writer.WriteValue(options, stringValue); + } + else if (value.TryGetBool(out var boolValue)) + { + writer.WriteValue(options, boolValue.Value); + } + else if (value.TryGetLong(out var longValue)) + { + writer.WriteValue(options, longValue.Value); + } + else if (value.TryGetDouble(out var doubleValue)) + { + writer.WriteValue(options, doubleValue.Value); + } + else if (value.Kind is FieldValue.ValueKind.Null) + { + writer.WriteNullValue(); + } + else + { + throw new JsonException($"ValueKind '{value.Kind}' is not supported. This is likely a bug and should be reported as an issue."); + } + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValues.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValues.cs index cf2ef28ec16..a46f39f5078 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValues.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValues.cs @@ -3,139 +3,131 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; -using System.Text.Json; + using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(FieldValuesConverter))] -public sealed class FieldValues : IsADictionary +public readonly struct FieldValues : + IEquatable, + IEnumerable { public static readonly FieldValues Empty = new(); - private static readonly HashSet NumericTypes = new() - { - typeof(int), typeof(double), typeof(decimal), - typeof(long), typeof(short), typeof(sbyte), - typeof(byte), typeof(ulong), typeof(ushort), - typeof(uint), typeof(float) - }; - - private readonly Inferrer _inferrer; - - private FieldValues() { } - - internal FieldValues(Inferrer inferrer, IDictionary container) - : base(container) => _inferrer = inferrer; + public IReadOnlyCollection Values { get; } - public TValue Value(Field field) + public FieldValues() { - var values = Values(field); - return values != null - ? values.FirstOrDefault() - : default; + Values = []; } - public TValue ValueOf(Expression> objectPath) + public FieldValues(IEnumerable values) { - var values = ValuesOf(objectPath); - return values != null - ? values.FirstOrDefault() - : default; + if (values is null) + { + throw new ArgumentNullException(nameof(values)); + } + + Values = [.. values]; } - public TValue[] Values(Field field) + public FieldValues(IEnumerable values) { - if (_inferrer == null) - return Array.Empty(); + if (values is null) + { + throw new ArgumentNullException(nameof(values)); + } - var path = _inferrer.Field(field); - return FieldArray(path); + Values = [.. values.Select(FieldValue.FromValue)]; } - public TValue[] ValuesOf(Expression> objectPath) + public FieldValues(IEnumerable values) { - if (_inferrer == null) - return Array.Empty(); + if (values is null) + { + throw new ArgumentNullException(nameof(values)); + } - var field = _inferrer.Field(objectPath); - return FieldArray(field); + Values = [.. values.Select(x => x)]; } - public static bool IsNumeric(Type myType) => NumericTypes.Contains(Nullable.GetUnderlyingType(myType) ?? myType); + public FieldValues(IEnumerable values) + { + if (values is null) + { + throw new ArgumentNullException(nameof(values)); + } - public static bool IsNullable(Type type) => type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); + Values = [.. values.Select(x => x)]; + } - private TValue[] FieldArray(string field) + public FieldValues(IEnumerable values) { - //unknown field - if (BackingDictionary == null || !BackingDictionary.TryGetValue(field, out var o)) - return null; - - //numerics are always returned as doubles by Elasticsearch. - if (!IsNumeric(typeof(TValue))) - return o.As(); - - //here we support casting to the desired numeric type whether its nullable or not. - if (!IsNullable(typeof(TValue))) - return o.As().Select(d => (TValue)Convert.ChangeType(d, typeof(TValue))).ToArray(); - - var underlyingType = Nullable.GetUnderlyingType(typeof(TValue)); - return o.As() - .Select(d => - { - if (d == null) - return default; - - return (TValue)Convert.ChangeType(d, underlyingType); - }) - .ToArray(); - } -} + if (values is null) + { + throw new ArgumentNullException(nameof(values)); + } -internal sealed class FieldValuesConverter : JsonConverter -{ - private IElasticsearchClientSettings _settings; + Values = [.. values.Select(x => x)]; + } - public override FieldValues? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public FieldValues(IEnumerable values) { - InitializeSettings(options); - - if (reader.TokenType != JsonTokenType.StartObject) + if (values is null) { - return null; + throw new ArgumentNullException(nameof(values)); } - var fields = new Dictionary(); + Values = [.. values.Select(x => x)]; + } - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + public FieldValues(IEnumerable values) + { + if (values is null) { - if (reader.TokenType != JsonTokenType.PropertyName) - throw new JsonException($"Unexpected token. Expected {JsonTokenType.PropertyName}, but read {reader.TokenType}"); - - var propertyName = reader.GetString(); - reader.Read(); - var lazyDocument = JsonSerializer.Deserialize(ref reader, options); - fields[propertyName] = lazyDocument; + throw new ArgumentNullException(nameof(values)); } - return new FieldValues(_settings.Inferrer, fields); + Values = [.. values.Select(x => x)]; } - public override void Write(Utf8JsonWriter writer, FieldValues value, JsonSerializerOptions options) => throw new NotImplementedException(); + public static implicit operator FieldValues(FieldValue[] values) => new(values); + + public static implicit operator FieldValues(object?[] values) => new(values); + + public static implicit operator FieldValues(string[] values) => new(values); + + public static implicit operator FieldValues(bool[] values) => new(values); + + public static implicit operator FieldValues(int[] values) => new(values); - private void InitializeSettings(JsonSerializerOptions options) + public static implicit operator FieldValues(long[] values) => new(values); + + public static implicit operator FieldValues(double[] values) => new(values); + + public static bool operator ==(FieldValues left, FieldValues right) => left.Equals(right); + + public static bool operator !=(FieldValues left, FieldValues right) => !(left == right); + + public override bool Equals(object? obj) => (obj is FieldValues other) && Equals(other); + + public override int GetHashCode() => Values.GetHashCode(); + + public bool Equals(FieldValues other) { - if (_settings is null) + if (ReferenceEquals(Values, other.Values)) { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); - - _settings = settings; + return true; } + + return Values.SequenceEqual(other.Values); } + + public IEnumerator GetEnumerator() => Values.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValuesConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValuesConverter.cs new file mode 100644 index 00000000000..2efb4847950 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fields/FieldValuesConverter.cs @@ -0,0 +1,68 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +using System.Text.Json.Serialization; +using System.Text.Json; + +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +internal sealed class FieldValuesConverter : + JsonConverter +{ + public override FieldValues Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var values = reader.ReadCollectionValue(options, null)!; + + return new(values); + } + + public override void Write(Utf8JsonWriter writer, FieldValues value, JsonSerializerOptions options) + { + writer.WriteCollectionValue(options, value.Values, null); + } +} + +internal sealed class SingleOrManyFieldValuesMarker; + +internal sealed class SingleOrManyFieldValuesMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public SingleOrManyFieldValuesMarkerConverter() + { + WrappedConverter = new SingleOrManyFieldValuesConverter(); + } + + public override SingleOrManyFieldValuesMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, SingleOrManyFieldValuesMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class SingleOrManyFieldValuesConverter : + JsonConverter +{ + public override FieldValues Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var values = reader.ReadSingleOrManyCollectionValue(options, null)!; + + return new(values); + } + + public override void Write(Utf8JsonWriter writer, FieldValues value, JsonSerializerOptions options) + { + writer.WriteSingleOrManyCollectionValue(options, value.Values, null); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Descriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Descriptor.cs deleted file mode 100644 index becbd038927..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Descriptor.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Serialization; - -namespace Elastic.Clients.Elasticsearch.Fluent; - -public abstract class Descriptor -{ - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal Descriptor() { } - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - // ReSharper disable once BaseObjectEqualsIsObjectEquals - //only used to hide by default - public override bool Equals(object obj) => base.Equals(obj); - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - // ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode - // only used to hide by default - public override int GetHashCode() => base.GetHashCode(); - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); -} - -public abstract class Descriptor : Descriptor - where TDescriptor : Descriptor -{ - private readonly TDescriptor _self; - - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal Descriptor() : base() => _self = (TDescriptor)this; - - [JsonIgnore] - [IgnoreDataMember] - protected TDescriptor Self => _self; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected TDescriptor Assign(TValue value, Action assign) => FluentAssign.Assign(_self, value, assign); -} - -public abstract class SerializableDescriptor : Descriptor, ISelfSerializable - where TDescriptor : SerializableDescriptor -{ - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal SerializableDescriptor(): base() { } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) => Serialize(writer, options, settings); - - protected abstract void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Fluent.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Fluent.cs deleted file mode 100644 index c3d9572a920..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Fluent.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.CompilerServices; - -namespace Elastic.Clients.Elasticsearch.Fluent; - -internal static class FluentAssign -{ - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static TDescriptor Assign(TDescriptor self, TValue value, Action assign) - where TDescriptor : Descriptor - { - assign(self, value); - return self; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/FluentDictionary.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/FluentDictionary.cs deleted file mode 100644 index ee895d79cb1..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/FluentDictionary.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -namespace Elastic.Clients.Elasticsearch.Fluent; - -/// -/// Used in the "fluent" syntax to support chained configuration of dictionary entries. -/// -/// The type for the keys of the . -/// The type for the values of the . -public class FluentDictionary : Dictionary -{ - public FluentDictionary() { } - - /// - /// Creates a new by copying the entries from the . - /// - /// The source from which entries will be copied. - public FluentDictionary(IDictionary source) - { - if (source == null) - return; - - foreach (var kv in source) - this[kv.Key] = kv.Value; - } - - /// - public new FluentDictionary Add(TKey key, TValue value) - { - base.Add(key, value); - return this; - } - - /// - public new FluentDictionary Remove(TKey key) - { - base.Remove(key); - return this; - } -} - -public class FluentDescriptorDictionary : Dictionary - where TDescriptor : Descriptor, new() -{ - public FluentDescriptorDictionary() { } - - public FluentDescriptorDictionary(IDictionary source) - { - if (source == null) - return; - - foreach (var kv in source) - this[kv.Key] = kv.Value; - } - - /// - public new FluentDescriptorDictionary Add(TKey key, TDescriptor value) - { - base.Add(key, value); - return this; - } - - /// - public FluentDescriptorDictionary Add(TKey key, Action configure) - { - var descriptor = new TDescriptor(); - configure?.Invoke(descriptor); - - base.Add(key, descriptor); - return this; - } - - /// - public new FluentDescriptorDictionary Remove(TKey key) - { - base.Remove(key); - return this; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/IBuildableDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/IBuildableDescriptor.cs deleted file mode 100644 index 697f243ae5a..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/IBuildableDescriptor.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Fluent; - -/// -/// Used to mark descriptors which can be used to build the object they describe. -/// -/// -/// This is most useful for descriptors of variants for internally-tagged unions where an IsADictionary is used -/// -/// -internal interface IBuildableDescriptor -{ - T Build(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IPromise.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IPromise.cs deleted file mode 100644 index 2f467d0347a..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IPromise.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Fluent; - -internal interface IPromise where TValue : class -{ - TValue Value { get; } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IsADictionaryDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IsADictionaryDescriptor.cs deleted file mode 100644 index f6b5ac2b798..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/IsADictionaryDescriptor.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch.Fluent; - -public abstract class IsADictionaryDescriptor - : PromiseDescriptor - where TDescriptor : IsADictionaryDescriptor - where TPromised : class, IIsADictionary -{ - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal IsADictionaryDescriptor(TPromised instance) : base(instance) { } - - protected TDescriptor Assign(TKey key, TValue value) - { - PromisedValue.Add(key, value); - return Self; - } - - private protected TDescriptor AssignVariant(TKey name, Action selector) - where TVariantDescriptor : Descriptor, IBuildableDescriptor, new() - where TProperty : TValue - { - var descriptor = new TVariantDescriptor(); - selector?.Invoke(descriptor); - return AssignVariant(name, descriptor.Build()); - } - - /// - /// May be overridden by derived types to add their own validation before assigning the variant. - /// e.g. . - /// - protected virtual TDescriptor AssignVariant(TKey name, TValue type) - { - type.ThrowIfNull(nameof(type)); - return Assign(name, type); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/PromiseDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/PromiseDescriptor.cs deleted file mode 100644 index 7eefb2578f5..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Fluent/Promise/PromiseDescriptor.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch.Fluent; - -public abstract class PromiseDescriptor : Descriptor, IPromise - where TDescriptor : PromiseDescriptor - where TValue : class -{ - internal readonly TValue PromisedValue; - - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal PromiseDescriptor(TValue instance) : base() - { - PromisedValue = instance; - Self = (TDescriptor)this; - } - - TValue IPromise.Value => PromisedValue; - - protected TDescriptor Self { get; } - - protected TDescriptor Assign(Action assigner) - { - assigner(PromisedValue); - return Self; - } - - protected TDescriptor Assign(TNewValue value, Action assigner) - { - assigner(PromisedValue, value); - return Self; - } - - protected TDescriptor Assign(TNewValue value, Action assigner, Action descriptorAction) - { - assigner(PromisedValue, value); - descriptorAction(Self); - return Self; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/IEnumStruct.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/IEnumStruct.cs deleted file mode 100644 index 0fc170344fe..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/IEnumStruct.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Core; - -internal interface IEnumStruct where TSelf : struct, IEnumStruct -{ - // TODO: Can be made static when targeting .NET 7 and higher - TSelf Create(string value); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/DocumentPath/DocumentPath.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/DocumentPath/DocumentPath.cs deleted file mode 100644 index 30daca886a1..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/DocumentPath/DocumentPath.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch; - -// MARKED INTERNAL AS WE MAY NO LONGER USE THIS TYPE -// TODO - REVIEW THIS -internal interface IDocumentPath -{ - Id Id { get; set; } - IndexName Index { get; set; } -} - -// MARKED INTERNAL AS WE MAY NO LONGER USE THIS TYPE -// TODO - REVIEW THIS -internal sealed class DocumentPath : IEquatable>, IDocumentPath -{ - public DocumentPath(T document) : this(Elasticsearch.Id.From(document)) => Document = document; - - public DocumentPath(Id id) - { - Self.Id = id; - Self.Index = typeof(T); - } - - internal T Document { get; set; } - internal IDocumentPath Self => this; - Id IDocumentPath.Id { get; set; } - IndexName IDocumentPath.Index { get; set; } - - public bool Equals(DocumentPath other) - { - IDocumentPath o = other, s = Self; - return s.Index.NullOrEquals(o.Index) && s.Id.NullOrEquals(o.Id) && (Document?.Equals(other.Document) ?? true); - } - - public static DocumentPath Id(Id id) => new(id); - - public static DocumentPath Id(T @object) => new(@object); - - public static implicit operator DocumentPath(T @object) => @object == null ? null : new DocumentPath(@object); - - public static implicit operator DocumentPath(Id id) => id == null ? null : new DocumentPath(id); - - public static implicit operator DocumentPath(long id) => new(id); - - public static implicit operator DocumentPath(string id) => id.IsNullOrEmpty() ? null : new DocumentPath(id); - - public static implicit operator DocumentPath(Guid id) => new(id); - - public DocumentPath Index(IndexName index) - { - if (index == null) - return this; - - Self.Index = index; - return this; - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = Self.Index?.GetHashCode() ?? 0; - hashCode = (hashCode * 397) ^ (Self.Id?.GetHashCode() ?? 0); - return hashCode; - } - } - - public override bool Equals(object obj) => obj switch - { - DocumentPath d => Equals(d), - _ => false, - }; - - public static bool operator ==(DocumentPath x, DocumentPath y) => Equals(x, y); - - public static bool operator !=(DocumentPath x, DocumentPath y) => !Equals(x, y); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/Field.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/Field.cs index 2b0aef9bd91..cb73354578e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/Field.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/Field.cs @@ -24,6 +24,9 @@ namespace Elastic.Clients.Elasticsearch; public sealed class Field : IEquatable, IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { private readonly object _comparisonValue; private readonly Type? _type; @@ -55,47 +58,25 @@ public sealed class Field : /// public double? Boost { get; set; } - /// - /// A format to apply to the field. - /// - /// - /// Can be used only for Doc Value Fields Elasticsearch 6.4.0+ - /// - public string? Format { get; set; } - internal bool CachableExpression { get; } #region Constructors - public Field(string name) : this(name, null, null) - { - } - - public Field(string name, double boost) : this(name, boost, null) - { - } - - public Field(string name, string format) : this(name, null, format) - { - } - - public Field(string name, double? boost, string? format) + public Field(string name, double? boost = null) { if (string.IsNullOrEmpty(name)) throw new ArgumentException($"{name} can not be null or empty.", nameof(name)); Name = ParseFieldName(name, out var b); Boost = b ?? boost; - Format = format; _comparisonValue = Name; } - public Field(Expression expression, double? boost = null, string? format = null) + public Field(Expression expression, double? boost = null) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); Boost = boost; - Format = format; _comparisonValue = expression.ComparisonValueFromExpression(out var type, out var cachable); _type = type; @@ -103,35 +84,39 @@ public Field(Expression expression, double? boost = null, string? format = null) CachableExpression = cachable; } - public Field(PropertyInfo property, double? boost = null, string? format = null) + public Field(PropertyInfo property, double? boost = null) { Property = property ?? throw new ArgumentNullException(nameof(property)); Boost = boost; - Format = format; _comparisonValue = property; _type = property.DeclaringType; } + public Field(string name) : this(name, null) + { + // Used internally by `KeyValuePairConverter`. + } + #endregion Constructors #region Factory Methods - public static Field? FromString(string? name) => string.IsNullOrEmpty(name) ? null : new Field(name); + public static Field FromString(string name) => new Field(name); - public static Field? FromExpression(Expression? expression) => expression is null ? null : new Field(expression); + public static Field FromExpression(Expression expression) => new Field(expression); - public static Field? FromProperty(PropertyInfo? property) => property is null ? null : new Field(property); + public static Field FromProperty(PropertyInfo property) => new Field(property); #endregion Factory Methods #region Conversion Operators - public static implicit operator Field?(string? name) => FromString(name); + public static implicit operator Field(string name) => FromString(name); - public static implicit operator Field?(Expression? expression) => FromExpression(expression); + public static implicit operator Field(Expression expression) => FromExpression(expression); - public static implicit operator Field?(PropertyInfo? property) => FromProperty(property); + public static implicit operator Field(PropertyInfo property) => FromProperty(property); #endregion Conversion Operators @@ -145,36 +130,36 @@ public Fields And(Field field) return new([this, field]); } - public Fields And(Expression> expression, double? boost = null, string? format = null) + public Fields And(Expression> expression, double? boost = null) { if (expression is null) throw new ArgumentNullException(nameof(expression)); - return new([this, new Field(expression, boost, format)]); + return new([this, new Field(expression, boost)]); } - public Fields And(Expression> expression, double? boost = null, string? format = null) + public Fields And(Expression> expression, double? boost = null) { if (expression is null) throw new ArgumentNullException(nameof(expression)); - return new([this, new Field(expression, boost, format)]); + return new([this, new Field(expression, boost)]); } - public Fields And(string field, double? boost = null, string? format = null) + public Fields And(string field, double? boost = null) { if (field is null) throw new ArgumentNullException(nameof(field)); - return new([this, new Field(field, boost, format)]); + return new([this, new Field(field, boost)]); } - public Fields And(PropertyInfo property, double? boost = null, string? format = null) + public Fields And(PropertyInfo property, double? boost = null) { if (property is null) throw new ArgumentNullException(nameof(property)); - return new([this, new Field(property, boost, format)]); + return new([this, new Field(property, boost)]); } #endregion Combinator Methods @@ -215,6 +200,26 @@ public override int GetHashCode() #endregion Equality + #region IParsable + + public static Field Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Field? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new Field(s); + return true; + } + + #endregion IParsable + #region IUrlParameter string IUrlParameter.GetString(ITransportConfiguration settings) @@ -234,7 +239,6 @@ string IUrlParameter.GetString(ITransportConfiguration settings) public override string ToString() => $"{Expression?.ToString() ?? PropertyDebug ?? Name}{(Boost.HasValue ? "^" + Boost.Value : string.Empty)}" + - $"{(!string.IsNullOrEmpty(Format) ? " format: " + Format : string.Empty)}" + $"{(_type == null ? string.Empty : " typeof: " + _type.Name)}"; internal string DebuggerDisplay => ToString(); @@ -243,12 +247,9 @@ public override string ToString() => #endregion Debugging - [return: NotNullIfNotNull(nameof(name))] - private static string? ParseFieldName(string? name, out double? boost) + private static string ParseFieldName(string name, out double? boost) { boost = null; - if (name is null) - return null; var caretIndex = name.IndexOf('^'); if (caretIndex == -1) diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/FieldConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/FieldConverter.cs index 43cfededc56..d32d7a1cfda 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/FieldConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Field/FieldConverter.cs @@ -5,104 +5,40 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; -internal sealed class FieldConverter : JsonConverter +internal sealed class FieldConverter : + JsonConverter { - private static readonly JsonEncodedText FieldProperty = JsonEncodedText.Encode("field"); - private static readonly JsonEncodedText FormatProperty = JsonEncodedText.Encode("format"); - - private IElasticsearchClientSettings _settings; - - public override void WriteAsPropertyName(Utf8JsonWriter writer, Field value, JsonSerializerOptions options) - { - InitializeSettings(options); - writer.WritePropertyName(((IUrlParameter)value).GetString(_settings)); - } - - public override Field ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => reader.GetString(); - - public override Field? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Field Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - switch (reader.TokenType) - { - case JsonTokenType.Null: - return null; + reader.ValidateToken(JsonTokenType.String); - case JsonTokenType.String: - return new Field(reader.GetString()); - - case JsonTokenType.StartObject: - return ReadObjectField(ref reader); - } - - return null; + return new Field(reader.GetString()!); } - private static Field ReadObjectField(ref Utf8JsonReader reader) + public override void Write(Utf8JsonWriter writer, Field value, JsonSerializerOptions options) { - var field = string.Empty; - var format = string.Empty; - - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - if (reader.ValueTextEquals(FieldProperty.EncodedUtf8Bytes)) - { - reader.Read(); - field = reader.GetString(); - } - else if (reader.ValueTextEquals(FormatProperty.EncodedUtf8Bytes)) - { - reader.Read(); - format = reader.GetString(); - } - else - { - throw new JsonException($"Unexpected property while reading `{nameof(Field)}`."); - } - } - } + var settings = options.GetContext(); + var fieldName = settings.Inferrer.Field(value); - if (!string.IsNullOrEmpty(field) && !string.IsNullOrEmpty(format)) - { - return new Field(field, format); - } - - throw new JsonException($"Unable to read `{nameof(Field)}` from JSON."); + writer.WriteStringValue(fieldName); } - public override void Write(Utf8JsonWriter writer, Field value, JsonSerializerOptions options) + public override Field ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - InitializeSettings(options); + reader.ValidateToken(JsonTokenType.PropertyName); - var fieldName = _settings.Inferrer.Field(value); - - if (string.IsNullOrEmpty(value.Format)) - { - writer.WriteStringValue(fieldName); - } - else - { - writer.WriteStartObject(); - writer.WriteString(FieldProperty, fieldName); - writer.WriteString(FormatProperty, value.Format); - writer.WriteEndObject(); - } + return new Field(reader.GetString()!); } - private void InitializeSettings(JsonSerializerOptions options) + public override void WriteAsPropertyName(Utf8JsonWriter writer, Field value, JsonSerializerOptions options) { - if (_settings is null) - { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + var settings = options.GetContext(); - _settings = settings; - } + writer.WritePropertyName(settings.Inferrer.Field(value)); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/Fields.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/Fields.cs index fc2aabc9eba..7fd300c5149 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/Fields.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/Fields.cs @@ -6,19 +6,26 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Linq.Expressions; using System.Reflection; +using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; +[JsonConverter(typeof(FieldsConverter))] [DebuggerDisplay($"{{{nameof(DebuggerDisplay)},nq}}")] public sealed class Fields : IEquatable, IEnumerable, IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { internal readonly List ListOfFields; @@ -26,129 +33,117 @@ public sealed class Fields : internal Fields() => ListOfFields = []; - internal Fields(IEnumerable fields) + internal Fields(IEnumerable fields) { if (fields is null) throw new ArgumentNullException(nameof(fields)); - ListOfFields = [.. fields.Where(f => f is not null)]; + ListOfFields = [.. fields]; } #endregion Constructors #region Factory Methods - public static Fields? FromField(Field? field) => field is null - ? null - : new Fields([field]); + public static Fields FromField(Field field) => new Fields([field]); - public static Fields? FromFields(Field[]? fields) => fields.IsNullOrEmpty() - ? null - : new Fields(fields!); + public static Fields FromFields(Field[]? fields) => new Fields(fields ?? []); - public static Fields? FromString(string? name) => name.IsNullOrEmptyCommaSeparatedList(out var split) - ? null + public static Fields FromString(string name) => name.IsNullOrEmptyCommaSeparatedList(out var split) + ? new Fields() : new Fields(split.Select(f => new Field(f))); - public static Fields? FromStrings(string[]? names) => names.IsNullOrEmpty() - ? null + public static Fields FromStrings(string[]? names) => names.IsNullOrEmpty() + ? new Fields() : new Fields(names!.Select(f => new Field(f))); - public static Fields? FromExpression(Expression? expression) => expression is null - ? null - : new Fields([new Field(expression)]); + public static Fields FromExpression(Expression expression) => new Fields([new Field(expression)]); - public static Fields? FromExpressions(Expression[]? expressions) => expressions.IsNullOrEmpty() - ? null + public static Fields FromExpressions(Expression[]? expressions) => expressions.IsNullOrEmpty() + ? new Fields() : new Fields(expressions!.Select(f => new Field(f))); - public static Fields? FromExpression(Expression>? expression) => expression is null - ? null - : new Fields([new Field(expression)]); + public static Fields FromExpression(Expression> expression) => new Fields([new Field(expression)]); - public static Fields? FromExpressions(Expression>[]? expressions) => expressions.IsNullOrEmpty() - ? null - : new Fields(expressions!.Select(f => new Field(f))); + public static Fields FromExpressions(Expression>[] expressions) => new Fields(expressions!.Select(f => new Field(f))); - public static Fields? FromProperty(PropertyInfo? property) => property is null - ? null - : new Fields([property]); + public static Fields FromProperty(PropertyInfo property) => new Fields([property]); - public static Fields? FromProperties(PropertyInfo[]? properties) => properties.IsNullOrEmpty() - ? null + public static Fields FromProperties(PropertyInfo[]? properties) => properties.IsNullOrEmpty() + ? new Fields() : new Fields(properties!.Select(f => new Field(f))); #endregion Factory Methods #region Conversion Operators - public static implicit operator Fields?(Field? field) => FromField(field); + public static implicit operator Fields(Field field) => FromField(field); - public static implicit operator Fields?(Field[]? fields) => FromFields(fields); + public static implicit operator Fields(Field[]? fields) => FromFields(fields); - public static implicit operator Fields?(string? name) => FromString(name); + public static implicit operator Fields(string name) => FromString(name); - public static implicit operator Fields?(string[]? names) => FromStrings(names); + public static implicit operator Fields(string[]? names) => FromStrings(names); - public static implicit operator Fields?(Expression? expression) => FromExpression(expression); + public static implicit operator Fields(Expression expression) => FromExpression(expression); - public static implicit operator Fields?(Expression[]? expressions) => FromExpressions(expressions); + public static implicit operator Fields(Expression[]? expressions) => FromExpressions(expressions); - public static implicit operator Fields?(PropertyInfo? property) => FromProperty(property); + public static implicit operator Fields(PropertyInfo property) => FromProperty(property); - public static implicit operator Fields?(PropertyInfo[]? properties) => FromProperties(properties); + public static implicit operator Fields(PropertyInfo[]? properties) => FromProperties(properties); #endregion Conversion Operators #region Combinator Methods - public Fields And(params Field?[] fields) + public Fields And(params Field[] fields) { if (fields is null) throw new ArgumentNullException(nameof(fields)); - ListOfFields.AddRange(fields.Where(f => f is not null)); + ListOfFields.AddRange(fields); return this; } - public Fields And(params string?[] names) + public Fields And(params string[] names) { if (names is null) throw new ArgumentNullException(nameof(names)); - ListOfFields.AddRange(names.Where(f => f is not null).Select(f => new Field(f))); + ListOfFields.AddRange(names.Select(f => new Field(f))); return this; } - public Fields And(params Expression>?[] expressions) + public Fields And(params Expression>[] expressions) { if (expressions is null) throw new ArgumentNullException(nameof(expressions)); - ListOfFields.AddRange(expressions.Where(f => f is not null).Select(f => new Field(f))); + ListOfFields.AddRange(expressions.Select(f => new Field(f))); return this; } - public Fields And(Expression> expression, double? boost = null, string? format = null) + public Fields And(Expression> expression, double? boost = null) where T : class { if (expression is null) throw new ArgumentNullException(nameof(expression)); - ListOfFields.Add(new Field(expression, boost, format)); + ListOfFields.Add(new Field(expression, boost)); return this; } - public Fields And(params PropertyInfo?[] properties) + public Fields And(params PropertyInfo[] properties) { if (properties is null) throw new ArgumentNullException(nameof(properties)); - ListOfFields.AddRange(properties.Where(x => x is not null).Select(f => new Field(f))); + ListOfFields.AddRange(properties.Select(f => new Field(f))); return this; } @@ -195,6 +190,44 @@ public override bool Equals(object? obj) => #endregion IEnumerable + #region IParsable + + public static Fields Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Fields? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new Fields(); + return true; + } + + var fields = new List(); + foreach (var item in list) + { + if (!Field.TryParse(item, provider, out var field)) + { + result = null; + return false; + } + + fields.Add(field); + } + + result = new Fields(fields); + return true; + } + + #endregion IParsable + #region IUrlParameter string IUrlParameter.GetString(ITransportConfiguration? settings) diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/FieldsConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/FieldsConverter.cs index f0a6b611f0f..69d0860e263 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/FieldsConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Fields/FieldsConverter.cs @@ -7,74 +7,60 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace Elastic.Clients.Elasticsearch; +namespace Elastic.Clients.Elasticsearch.Serialization; -internal sealed class FieldsConverter : JsonConverter +internal sealed class FieldsConverter : + JsonConverter { - public override Fields? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Fields Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - switch (reader.TokenType) - { - case JsonTokenType.Null: - return null; + var fields = reader.ReadCollectionValue(options, null)!; - case JsonTokenType.StartArray: - var fields = JsonSerializer.Deserialize>(ref reader, options); - return new Fields(fields); - - default: - throw new JsonException("Unexpected token."); - } + return new Fields(fields); } public override void Write(Utf8JsonWriter writer, Fields value, JsonSerializerOptions options) { - if (value is null) - { - writer.WriteNullValue(); - return; - } - - JsonSerializer.Serialize(writer, value.ListOfFields, options); + writer.WriteCollectionValue(options, value.ListOfFields, null); } } -internal sealed class SingleOrManyFieldsConverter : JsonConverter +internal sealed class SingleOrManyFieldsMarker; + +internal sealed class SingleOrManyFieldsMarkerConverter : + JsonConverter, + IMarkerTypeConverter { - public override Fields? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - switch (reader.TokenType) - { - case JsonTokenType.Null: - return null; + public JsonConverter WrappedConverter { get; } - case JsonTokenType.String: - var field = JsonSerializer.Deserialize(ref reader, options); - return new Fields([field]); + public SingleOrManyFieldsMarkerConverter() + { + WrappedConverter = new SingleOrManyFieldsConverter(); + } - case JsonTokenType.StartArray: - var fields = JsonSerializer.Deserialize>(ref reader, options); - return new Fields(fields); + public override SingleOrManyFieldsMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } - default: - throw new JsonException("Unexpected token."); - } + public override void Write(Utf8JsonWriter writer, SingleOrManyFieldsMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); } +} - public override void Write(Utf8JsonWriter writer, Fields value, JsonSerializerOptions options) +internal sealed class SingleOrManyFieldsConverter : + JsonConverter +{ + public override Fields Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (value is null) - { - writer.WriteNullValue(); - return; - } + var fields = reader.ReadSingleOrManyCollectionValue(options, null)!; - if (value.ListOfFields.Count == 1) - { - JsonSerializer.Serialize(writer, value.ListOfFields[0], options); - return; - } + return new Fields(fields); + } - JsonSerializer.Serialize(writer, value.ListOfFields, options); + public override void Write(Utf8JsonWriter writer, Fields value, JsonSerializerOptions options) + { + writer.WriteSingleOrManyCollectionValue(options, value.ListOfFields, null); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Id.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Id.cs index 1adab333a9e..be299083f95 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Id.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Id.cs @@ -4,16 +4,23 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(IdConverter))] -public class Id : IEquatable, IUrlParameter +public class Id : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { public Id(string id) { @@ -33,10 +40,10 @@ public Id(object document) Document = document; } - internal object Document { get; } + internal object? Document { get; } internal long? LongValue { get; } - internal string StringOrLongValue => StringValue ?? LongValue?.ToString(CultureInfo.InvariantCulture); - internal string StringValue { get; } + internal string? StringOrLongValue => StringValue ?? LongValue?.ToString(CultureInfo.InvariantCulture); + internal string? StringValue { get; } internal int Tag { get; } private string DebugDisplay => StringOrLongValue ?? "Id from instance typeof: " + Document?.GetType().Name; @@ -81,12 +88,16 @@ public override bool Equals(object obj) { case Id r: return Equals(r); + case string s: return Equals(s); + case int l: return Equals(l); + case long l: return Equals(l); + case Guid g: return Equals(g); } @@ -108,4 +119,24 @@ public override int GetHashCode() public static bool operator ==(Id left, Id right) => Equals(left, right); public static bool operator !=(Id left, Id right) => !Equals(left, right); + + #region IParsable + + public static Id Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Id? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new Id(s); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Ids.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Ids.cs index 7ca13c2d2b0..b642adb7958 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Ids.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Id/Ids.cs @@ -5,15 +5,22 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(IdsConverter))] -public partial class Ids : IUrlParameter, IEquatable +public class Ids : + IUrlParameter, + IEquatable +#if NET7_0_OR_GREATER + , IParsable +#endif { private readonly IList _ids; @@ -21,7 +28,7 @@ public partial class Ids : IUrlParameter, IEquatable public Ids(IList ids) => _ids = ids; - public Ids(IEnumerable ids) => _ids = ids.Select(i => new Id(i)).ToList(); + public Ids(IEnumerable ids) => _ids = ids.Select(i => new Id(i)).ToList(); public Ids(string value) { @@ -29,6 +36,11 @@ public Ids(string value) _ids = arr.Select(i => new Id(i)).ToList(); } + public Ids() + { + _ids = []; + } + internal IList IdsToSerialize => _ids; private string DebugDisplay => ((IUrlParameter)this).GetString(null); @@ -82,4 +94,42 @@ public override int GetHashCode() public static bool operator ==(Ids left, Ids right) => Equals(left, right); public static bool operator !=(Ids left, Ids right) => !Equals(left, right); + + #region IParsable + + public static Ids Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Ids? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new Ids(); + return true; + } + + var ids = new List(); + foreach (var item in list) + { + if (!Id.TryParse(item, provider, out var id)) + { + result = null; + return false; + } + + ids.Add(id); + } + + result = new Ids(ids); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/IndexName/IndexName.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/IndexName/IndexName.cs index 9109432ffa2..f84684a99c8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/IndexName/IndexName.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/IndexName/IndexName.cs @@ -4,7 +4,9 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; @@ -14,7 +16,12 @@ namespace Elastic.Clients.Elasticsearch; /// [JsonConverter(typeof(IndexNameConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public class IndexName : IEquatable, IUrlParameter +public class IndexName : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { private const char ClusterSeparator = ':'; @@ -134,4 +141,24 @@ private bool EqualsMarker(IndexName other) return Type is not null && other?.Type is not null && Type == other.Type; } + + #region IParsable + + public static IndexName Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out IndexName? result) + { + if (s is null) + { + result = null; + return false; + } + + result = Parse(s); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Indices/Indices.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Indices/Indices.cs index 60937ddbcf5..6c86df1180a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Indices/Indices.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Indices/Indices.cs @@ -6,9 +6,11 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -16,7 +18,13 @@ namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(IndicesJsonConverter))] -public sealed class Indices : IUrlParameter, IEnumerable, IEquatable +public sealed class Indices : + IUrlParameter, + IEnumerable, + IEquatable +#if NET7_0_OR_GREATER + , IParsable +#endif { private static readonly HashSet AllIndexList = new() { AllValue }; @@ -26,6 +34,11 @@ public sealed class Indices : IUrlParameter, IEnumerable, IEquatable< private readonly HashSet? _indices; private readonly bool _isAllIndices; + internal Indices() + { + _indices = []; + } + internal Indices(IndexName indexName) { if (indexName.Equals(AllValue) || indexName.Equals(WildcardValue)) @@ -188,55 +201,58 @@ public override int GetHashCode() IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerator GetEnumerator() => IndexNames.GetEnumerator(); -} -internal sealed class IndicesJsonConverter : JsonConverter -{ - private IElasticsearchClientSettings _settings; + #region IParsable + + public static Indices Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); - public override Indices? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Indices? result) { - if (reader.TokenType == JsonTokenType.String) + if (s is null) { - Indices indices = reader.GetString(); - return indices; + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new Indices(); + return true; } - else if (reader.TokenType == JsonTokenType.StartArray) + + var names = new List(); + foreach (var item in list) { - var indices = new List(); - while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + if (!IndexName.TryParse(item, provider, out var name)) { - var index = reader.GetString(); - indices.Add(index); + result = null; + return false; } - return new Indices(indices); + + names.Add(name); } - reader.Read(); - return null; + result = new Indices(names); + return true; } - public override void Write(Utf8JsonWriter writer, Indices value, JsonSerializerOptions options) - { - InitializeSettings(options); + #endregion IParsable +} - if (value == null) - { - writer.WriteNullValue(); - return; - } +internal sealed class IndicesJsonConverter : + JsonConverter +{ + public override Indices Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var indices = reader.ReadSingleOrManyCollectionValue(options, null)!; - writer.WriteStringValue(((IUrlParameter)value).GetString(_settings)); + return new Indices(indices); } - private void InitializeSettings(JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Indices value, JsonSerializerOptions options) { - if (_settings is null) - { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); - - _settings = settings; - } + writer.WriteSingleOrManyCollectionValue(options, value.IndexNames, null); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/JoinFieldRouting/Routing.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/JoinFieldRouting/Routing.cs index 9e5108a7101..22caa1b9cb0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/JoinFieldRouting/Routing.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/JoinFieldRouting/Routing.cs @@ -4,19 +4,26 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(RoutingConverter))] [DebuggerDisplay("{" + nameof(DebugDisplay) + ",nq}")] -public class Routing : IEquatable, IUrlParameter +public class Routing : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { - private static readonly char[] Separator = {','}; + private static readonly char[] Separator = { ',' }; internal Routing(Func documentGetter) { @@ -66,8 +73,10 @@ public bool Equals(Routing other) var t = DocumentGetter(); var o = other.DocumentGetter(); return t?.Equals(o) ?? false; + case 4: return Document?.Equals(other.Document) ?? false; + default: return StringEquals(StringOrLongValue, other.StringOrLongValue); } @@ -141,12 +150,16 @@ public override bool Equals(object obj) { case Routing r: return Equals(r); + case string s: return Equals(s); + case int l: return Equals(l); + case long l: return Equals(l); + case Guid g: return Equals(g); } @@ -167,10 +180,23 @@ public override int GetHashCode() } } - //internal bool ShouldSerialize(IJsonFormatterResolver formatterResolver) - //{ - // var inferrer = formatterResolver.GetConnectionSettings().Inferrer; - // var resolved = inferrer.Resolve(this); - // return !resolved.IsNullOrEmpty(); - //} + #region IParsable + + public static Routing Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Routing? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new Routing(s); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Metric/Metrics.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Metric/Metrics.cs index 68cc21015f3..408b0af7332 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Metric/Metrics.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Metric/Metrics.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; @@ -11,7 +13,12 @@ namespace Elastic.Clients.Elasticsearch; /// /// Represents a collection of unique metric names to be included in URL paths to limit the request. /// -public sealed class Metrics : IEquatable, IUrlParameter +public sealed class Metrics : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { private static readonly HashSet EmptyMetrics = new(); @@ -50,7 +57,8 @@ public Metrics(IEnumerable metrics) /// public bool Equals(Metrics other) { - if (other is null) return false; + if (other is null) + return false; // Equality is true when both instances have the same metric names. return Values.SetEquals(other.Values); @@ -82,16 +90,45 @@ public override int GetHashCode() } public static bool operator ==(Metrics left, Metrics right) => Equals(left, right); + public static bool operator !=(Metrics left, Metrics right) => !Equals(left, right); public static implicit operator Metrics(string metric) => new(metric); + public static implicit operator Metrics(string[] metrics) => new(metrics); /// public override bool Equals(object obj) { - if (obj is not Metrics metrics) return false; + if (obj is not Metrics metrics) + return false; return Equals(metrics); } + + #region IParsable + + public static Metrics Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Metrics? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new Metrics(string.Empty); + return true; + } + + result = new Metrics(list); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/PropertyName/PropertyName.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/PropertyName/PropertyName.cs index 8da6edd6523..40b1b161868 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/PropertyName/PropertyName.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/PropertyName/PropertyName.cs @@ -6,7 +6,9 @@ using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; +using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -116,3 +118,36 @@ public bool EqualsMarker(PropertyName other) => _type != null public static bool operator !=(PropertyName left, PropertyName right) => !Equals(left, right); } + +internal sealed class PropertyNameConverter : + JsonConverter +{ + public override PropertyName Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + reader.ValidateToken(JsonTokenType.String); + + return new PropertyName(reader.GetString()!); + } + + public override void Write(Utf8JsonWriter writer, PropertyName value, JsonSerializerOptions options) + { + var settings = options.GetContext(); + var fieldName = settings.Inferrer.PropertyName(value); + + writer.WriteStringValue(fieldName); + } + + public override PropertyName ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + reader.ValidateToken(JsonTokenType.PropertyName); + + return new PropertyName(reader.GetString()!); + } + + public override void WriteAsPropertyName(Utf8JsonWriter writer, PropertyName value, JsonSerializerOptions options) + { + var settings = options.GetContext(); + + writer.WritePropertyName(settings.Inferrer.PropertyName(value)); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Timestamp/Timestamp.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Timestamp/Timestamp.cs deleted file mode 100644 index 921f39a66d4..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Infer/Timestamp/Timestamp.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Globalization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch; - -public sealed class Timestamp : IUrlParameter, IEquatable -{ - internal readonly long Value; - - public Timestamp(long value) => Value = value; - - public bool Equals(Timestamp other) => Value == other.Value; - - string IUrlParameter.GetString(ITransportConfiguration settings) => GetString(); - - public override string ToString() => GetString(); - - private string GetString() => Value.ToString(CultureInfo.InvariantCulture); - - public static implicit operator Timestamp(DateTimeOffset categoryId) => new(categoryId.ToUnixTimeMilliseconds()); - - public static implicit operator Timestamp(long categoryId) => new(categoryId); - - public static implicit operator long(Timestamp categoryId) => categoryId.Value; - - public override bool Equals(object obj) => obj switch - { - int l => Value == l, - long l => Value == l, - Timestamp i => Value == i.Value, - _ => false, - }; - - public override int GetHashCode() => Value.GetHashCode(); - - public static bool operator ==(Timestamp left, Timestamp right) => Equals(left, right); - - public static bool operator !=(Timestamp left, Timestamp right) => !Equals(left, right); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/MinimumShouldMatch.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/MinimumShouldMatch.cs index b8a954eff2e..4d78325d1d5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/MinimumShouldMatch.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/MinimumShouldMatch.cs @@ -2,13 +2,24 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Clients.Elasticsearch.Serialization; + namespace Elastic.Clients.Elasticsearch; -public sealed class MinimumShouldMatch : Union +[JsonConverter(typeof(MinimumShouldMatchConverter))] +public sealed class MinimumShouldMatch : Union { - public MinimumShouldMatch(int count) : base(count) { } + public MinimumShouldMatch(int count) : base(count) + { + } - public MinimumShouldMatch(string percentage) : base(percentage) { } + public MinimumShouldMatch(string percentage) : base(percentage) + { + } public static MinimumShouldMatch Fixed(int count) => count; @@ -20,3 +31,33 @@ public MinimumShouldMatch(string percentage) : base(percentage) { } public static implicit operator MinimumShouldMatch(double second) => Percentage(second); } + +internal sealed class MinimumShouldMatchConverter : + JsonConverter +{ + public override MinimumShouldMatch Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.Number => new MinimumShouldMatch(reader.GetInt32()), + JsonTokenType.String => new MinimumShouldMatch(reader.GetString()!), + _ => throw reader.UnexpectedTokenException(JsonTokenType.Number, JsonTokenType.String) + }; + } + + public override void Write(Utf8JsonWriter writer, MinimumShouldMatch value, JsonSerializerOptions options) + { + try + { + value.Match( + writer.WriteNumberValue, + writer.WriteStringValue + ); + } + catch (InvalidOperationException e) + { + throw new JsonException("Invalid union variant.", e); + } + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Number/Number.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Number/Number.cs new file mode 100644 index 00000000000..9ffe30eefba --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Number/Number.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Globalization; +using System.Runtime.CompilerServices; + +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +[DebuggerDisplay("{DebugDisplay,nq}")] +[JsonConverter(typeof(NumberConverter))] +public readonly struct Number +{ + private readonly byte _tag; + private readonly long _data; + + public Number(long value) + { + _tag = 1; + _data = value; + } + + public Number(double value) + { + _tag = 2; + _data = Unsafe.As(ref value); + } + + public static implicit operator Number(long value) => new(value); + + public static implicit operator Number(double value) => new(value); + + public bool TryGetLong(out long value) + { + if (_tag is not 1) + { + value = 0L; + return false; + } + + value = _data; + return true; + } + + public bool TryGetDouble(out double value) + { + if (_tag is not 2) + { + value = 0.0d; + return false; + } + + value = Unsafe.As(ref Unsafe.AsRef(in _data)); + return true; + } + + internal string DebugDisplay => _tag switch + { + 1 => TryGetLong(out var l) ? l.ToString(CultureInfo.InvariantCulture) : string.Empty, + 2 => TryGetDouble(out var d) ? d.ToString(CultureInfo.InvariantCulture) : string.Empty, + _ => "" + }; +} + +internal sealed class NumberConverter : + JsonConverter +{ + public override Number Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + reader.ValidateToken(JsonTokenType.Number); + + if (reader.TryGetDouble(out var d)) + { + return new(d); + } + + if (reader.TryGetInt64(out var l)) + { + return new(l); + } + + throw new JsonException("Could not read JSON value as number."); + } + + public override void Write(Utf8JsonWriter writer, Number value, JsonSerializerOptions options) + { + if (value.TryGetDouble(out var d)) + { + writer.WriteNumberValue(d); + return; + } + + if (value.TryGetLong(out var l)) + { + writer.WriteNumberValue(l); + return; + } + + throw new JsonException($"The '{nameof(Number)}' does not contain a value."); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyFieldDictionary.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyFieldDictionary.cs deleted file mode 100644 index 018f0e82c46..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyFieldDictionary.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch; - -/// -/// A specialised readonly dictionary for data, keyed by . -/// This supports inferrence enabled lookups by ensuring keys are sanitized when storing the values and when performing lookups. -/// -/// -internal readonly struct ReadOnlyFieldDictionary : IReadOnlyDictionary -{ - private readonly Dictionary _backingDictionary; - private readonly IElasticsearchClientSettings? _settings; - - public ReadOnlyFieldDictionary() - { - _backingDictionary = new Dictionary(0); - _settings = null; - } - - internal ReadOnlyFieldDictionary(Dictionary source, IElasticsearchClientSettings settings) - { - _settings = settings; - - // This is an "optimised version" which doesn't cause a second dictionary to be allocated. - // Since we expect this to be used only for deserialisation, the keys received will already have been strings, - // so no further sanitisation is required. - - if (source == null) - { - _backingDictionary = new Dictionary(0); - return; - } - - _backingDictionary = source; - } - - private string Sanitize(Field key) => _settings is not null ? (key as IUrlParameter)?.GetString(_settings) : string.Empty; - - public TValue this[Field key] => _backingDictionary.TryGetValue(Sanitize(key), out var v) ? v : default; - public TValue this[string key] => _backingDictionary.TryGetValue(key, out var v) ? v : default; - - public IEnumerable Keys => _backingDictionary.Keys; - public IEnumerable Values => _backingDictionary.Values; - public int Count => _backingDictionary.Count; - public bool ContainsKey(Field key) => _backingDictionary.ContainsKey(Sanitize(key)); - public IEnumerator> GetEnumerator() => _backingDictionary.GetEnumerator(); - public bool TryGetValue(Field key, out TValue value) => _backingDictionary.TryGetValue(Sanitize(key), out value); - IEnumerator IEnumerable.GetEnumerator() => _backingDictionary.GetEnumerator(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyIndexNameDictionary.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyIndexNameDictionary.cs deleted file mode 100644 index e0e254f0906..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/ReadOnlyIndexNameDictionary.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch; - -/// -/// A specialised readonly dictionary for data, keyed by . -/// This supports inferrence enabled lookups by ensuring keys are sanitized when storing the values and when performing lookups. -/// -/// -internal readonly struct ReadOnlyIndexNameDictionary : IReadOnlyDictionary -{ - private readonly Dictionary _backingDictionary; - private readonly IElasticsearchClientSettings? _settings; - - public ReadOnlyIndexNameDictionary() - { - _backingDictionary = new Dictionary(0); - _settings = null; - } - - internal ReadOnlyIndexNameDictionary(Dictionary source, IElasticsearchClientSettings settings) - { - _settings = settings; - - // This is an "optimised version" which doesn't cause a second dictionary to be allocated. - // Since we expect this to be used only for deserialisation, the keys received will already have been strings, - // so no further sanitisation is required. - - if (source == null) - { - _backingDictionary = new Dictionary(0); - return; - } - - _backingDictionary = source; - } - - private string Sanitize(IndexName key) => _settings is not null ? (key as IUrlParameter)?.GetString(_settings) : string.Empty; - - public TValue this[IndexName key] => _backingDictionary.TryGetValue(Sanitize(key), out var v) ? v : default; - public TValue this[string key] => _backingDictionary.TryGetValue(key, out var v) ? v : default; - - public IEnumerable Keys => _backingDictionary.Keys; - public IEnumerable Values => _backingDictionary.Values; - public int Count => _backingDictionary.Count; - public bool ContainsKey(IndexName key) => _backingDictionary.ContainsKey(Sanitize(key)); - public IEnumerator> GetEnumerator() => _backingDictionary.GetEnumerator(); - public bool TryGetValue(IndexName key, out TValue value) => _backingDictionary.TryGetValue(Sanitize(key), out value); - IEnumerator IEnumerable.GetEnumerator() => _backingDictionary.GetEnumerator(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/PlainRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/PlainRequest.cs index 0feaf827f3d..c16a793569c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/PlainRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/PlainRequest.cs @@ -11,8 +11,6 @@ namespace Elastic.Clients.Elasticsearch.Requests; public abstract class PlainRequest : Request where TParameters : RequestParameters, new() { - private IRequestConfiguration? _requestConfiguration; // TODO: Remove this from the request classes and add to the endpoint methods instead - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. // We don't expect consumers to derive from this public base class. internal PlainRequest() { } @@ -36,7 +34,7 @@ public bool? ErrorTrace /// /// [JsonIgnore] - public string[] FilterPath + public string[]? FilterPath { get => Q("filter_path"); set => Q("filter_path", value); @@ -63,7 +61,7 @@ public bool? Pretty /// requests. /// [JsonIgnore] - public string SourceQueryString + public string? SourceQueryString { get => Q("source"); set => Q("source", value); @@ -73,9 +71,5 @@ public string SourceQueryString /// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries /// [JsonIgnore] - public IRequestConfiguration? RequestConfiguration - { - get => _requestConfiguration; - set => _requestConfiguration = value; - } + public IRequestConfiguration? RequestConfiguration { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/Request.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/Request.cs index 5d33f00b393..148011dcfa5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/Request.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/Request.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch.Requests; @@ -16,7 +17,8 @@ public abstract class Request { // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. // We don't expect consumers to derive from this public base class. - internal Request() { } + internal Request() + { } [JsonIgnore] protected internal virtual IRequestConfiguration? RequestConfig { get; set; } @@ -30,7 +32,7 @@ internal Request() { } internal abstract bool SupportsBody { get; } [JsonIgnore] - protected RouteValues RouteValues { get; } = new(); + protected internal RouteValues RouteValues { get; } = new(); /// /// Allows for per request replacement of the specified HTTP method, including scenarios such as indexing which @@ -50,12 +52,19 @@ internal Request() { } protected virtual (string ResolvedUrl, string UrlTemplate, Dictionary? resolvedRouteValues) ResolveUrl(RouteValues routeValues, IElasticsearchClientSettings settings) => ApiUrls.Resolve(routeValues, settings); - internal virtual void BeforeRequest() { } + internal virtual void BeforeRequest() + { } internal (string ResolvedUrl, string UrlTemplate, Dictionary? resolvedRouteValues) GetUrl(IElasticsearchClientSettings settings) => ResolveUrl(RouteValues, settings); [JsonIgnore] internal virtual string? OperationName { get; } + + protected TOut? P(string route) => RouteValues.Get(route); + + protected void PR(string route, object? value) => RouteValues.Required(route, value); + + protected void PO(string route, object? value) => RouteValues.Optional(route, value); } public abstract class Request : Request diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RequestDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RequestDescriptor.cs deleted file mode 100644 index 87d747be588..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RequestDescriptor.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Text.Json; - -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch.Requests; - -/// -/// Base class for all request descriptor types. -/// -public abstract partial class RequestDescriptor : - Request, ISelfSerializable - where TDescriptor : RequestDescriptor - where TParameters : RequestParameters, new() -{ - private readonly TDescriptor _descriptor; - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) => Serialize(writer, options, settings); - - // This internal ctor ensures that only types defined within the Elastic.Clients.Elasticsearch assembly can derive from this base class. - // We don't expect consumers to derive from this public base class. - internal RequestDescriptor() => _descriptor = (TDescriptor)this; - - protected abstract void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); - - internal RequestDescriptor(Func pathSelector) : base(pathSelector) => - _descriptor = (TDescriptor)this; - - protected TDescriptor Self => _descriptor; - - protected TDescriptor Qs(string name, object? value) - { - Q(name, value); - return _descriptor; - } - - protected TDescriptor Qs(string name, IStringable value) - { - Q(name, value.GetString()); - return _descriptor; - } - - /// - /// Specify settings for this request alone, handy if you need a custom timeout or want to bypass sniffing, retries - /// - public TDescriptor RequestConfiguration(Func configurationSelector) - { - RequestConfig = configurationSelector?.Invoke(RequestConfig is null - ? new RequestConfigurationDescriptor() - : new RequestConfigurationDescriptor(RequestConfig)) ?? RequestConfig; - return _descriptor; - } - - /// - /// A list of filters used to reduce the response. - /// - /// Use of response filtering can result in a response from Elasticsearch - /// that cannot be correctly deserialized to the respective response type for the request. - /// In such situations, use the low level client to issue the request and handle response deserialization. - /// - /// - public TDescriptor FilterPath(params string[] value) => Qs("filter_path", value); - - ///Return human-readable values for statistics. - public TDescriptor Human(bool? value) => Qs("human", value); - - ///Pretty format the returned JSON response. - public TDescriptor Pretty(bool? value) => Qs("pretty", value); - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - // ReSharper disable BaseObjectEqualsIsObjectEquals - public override bool Equals(object obj) => base.Equals(obj); - - /// - /// Hides the method. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - // ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode - public override int GetHashCode() => base.GetHashCode(); - // ReSharper restore BaseObjectEqualsIsObjectEquals -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RouteValues.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RouteValues.cs index 5265cb15d1c..bbef07f5635 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RouteValues.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Request/RouteValues.cs @@ -46,14 +46,14 @@ private RouteValues Route(string name, object? routeValue, bool required = true) switch (routeValue) { case null when !required: - { - if (!ContainsKey(name)) - return this; - Remove(name); - if (IsId(name)) - ContainsId = false; // invalidate cache + { + if (!ContainsKey(name)) return this; - } + Remove(name); + if (IsId(name)) + ContainsId = false; // invalidate cache + return this; + } case null: throw new ArgumentNullException(name, $"{name} is required to build a URL to this API."); diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/DictionaryResponse.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/DictionaryResponse.cs deleted file mode 100644 index e9a8537cfb8..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/DictionaryResponse.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -using Elastic.Transport.Products.Elasticsearch; - -namespace Elastic.Clients.Elasticsearch; - -public abstract class DictionaryResponse : ElasticsearchResponse -{ - internal DictionaryResponse(IReadOnlyDictionary dictionary) - { - if (dictionary is null) - throw new ArgumentNullException(nameof(dictionary)); - - BackingDictionary = dictionary; - } - - internal DictionaryResponse() => BackingDictionary = EmptyReadOnly.Dictionary; - - protected IReadOnlyDictionary BackingDictionary { get; } - - // TODO: Remove after exposing the values in the derived responses - [Obsolete("Temporary workaround. This field will be removed in the future and replaced by custom accessors in the derived classes.")] - public IReadOnlyDictionary Values => BackingDictionary; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/ResolvableDictionaryProxy.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/ResolvableDictionaryProxy.cs deleted file mode 100644 index 1edc6924b3f..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Response/ResolvableDictionaryProxy.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Elastic.Transport; -using System.Collections; -using System.Collections.Generic; - -namespace Elastic.Clients.Elasticsearch; - -/// -/// A proxy dictionary that is settings-aware to correctly handle IUrlParameter-based keys such as IndexName. -/// -public sealed class ResolvableDictionaryProxy : IIsAReadOnlyDictionary - where TKey : IUrlParameter -{ - private readonly IElasticsearchClientSettings _elasticsearchClientSettings; - - internal ResolvableDictionaryProxy(IElasticsearchClientSettings elasticsearchClientSettings, IReadOnlyDictionary backingDictionary) - { - _elasticsearchClientSettings = elasticsearchClientSettings; - - if (backingDictionary == null) - return; - - Original = backingDictionary; - - var dictionary = new Dictionary(backingDictionary.Count); - - foreach (var key in backingDictionary.Keys) - dictionary[Sanitize(key)] = backingDictionary[key]; - - BackingDictionary = dictionary; - } - - public int Count => BackingDictionary.Count; - - public TValue this[TKey key] => BackingDictionary.TryGetValue(Sanitize(key), out var v) ? v : default; - public TValue this[string key] => BackingDictionary.TryGetValue(key, out var v) ? v : default; - - public IEnumerable Keys => Original.Keys; - public IEnumerable ResolvedKeys => BackingDictionary.Keys; - - public IEnumerable Values => BackingDictionary.Values; - internal IReadOnlyDictionary BackingDictionary { get; } = EmptyReadOnly.Dictionary; - private IReadOnlyDictionary Original { get; } = EmptyReadOnly.Dictionary; - - IEnumerator IEnumerable.GetEnumerator() => Original.GetEnumerator(); - - IEnumerator> IEnumerable>.GetEnumerator() => - Original.GetEnumerator(); - - public bool ContainsKey(TKey key) => BackingDictionary.ContainsKey(Sanitize(key)); - - public bool TryGetValue(TKey key, out TValue value) => - BackingDictionary.TryGetValue(Sanitize(key), out value); - - private string Sanitize(TKey key) => key?.GetString(_elasticsearchClientSettings); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Static/Infer.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Static/Infer.cs index 15b320e96e7..7f50840fdac 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Static/Infer.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Static/Infer.cs @@ -53,19 +53,18 @@ public static Fields Fields(params Expression>[] fields) whe /// Create a strongly typed string field name representation of the path to a property /// e.g. p => p.Array.First().SubProperty.Field will return 'array.subProperty.field' /// - public static Field Field(Expression> path, double? boost = null, - string format = null) - => new(path, boost, format); + public static Field Field(Expression> path, double? boost = null) + => new(path, boost); /// - public static Field Field(Expression> path, double? boost = null, string format = null) - => new(path, boost, format); + public static Field Field(Expression> path, double? boost = null) + => new(path, boost); - public static Field Field(string field, double? boost = null, string format = null) => - new(field, boost, format); + public static Field Field(string field, double? boost = null) => + new(field, boost); - public static Field Field(PropertyInfo property, double? boost = null, string format = null) => - new(property, boost, format); + public static Field Field(PropertyInfo property, double? boost = null) => + new(property, boost); public static PropertyName Property(string property) => property; diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Union/Union.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Union/Union.cs index 95fcf32d3a8..71a6aaf353a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/Union/Union.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/Union/Union.cs @@ -6,77 +6,119 @@ namespace Elastic.Clients.Elasticsearch; +public enum UnionTag +{ + None, + T1, + T2 +} + +// TODO: Add default JsonConverter that only handles serialization? + /// -/// Represents the union of two types, and . Used -/// in scenarios where an Elasticsearch API may accept more than one different input data structure. +/// Represents the union of two types, and . /// -/// The first type -/// The second type -public class Union +/// The first type. +/// The second type. +public class Union { - internal readonly int Tag; - internal readonly TFirst Item1; - internal readonly TSecond Item2; + /// + /// A tag that signals which value type is encapsulated in the union. + /// + /// + /// This tag should be used as the discriminator in expressions before accessing the actual encapsulated + /// value in either or . + /// + /// As an alternative, the or method might be used to access the encapsulated value + /// in a safe way. + /// + /// + public UnionTag Tag { get; } + + /// + /// The value. This property is initialized only when contains . + /// + public T1? Value1 { get; } + + /// + /// The value. This property is initialized only when contains . + /// + public T2? Value2 { get; } /// - /// Creates an new instance of that encapsulates value + /// Creates a new instance of that encapsulates a of + /// type . /// - /// The value to encapsulate - public Union(TFirst item) + /// The value to encapsulate. + public Union(T1? value) { - Item1 = item; - Tag = 0; + Value1 = value; + Tag = UnionTag.T1; } /// - /// Creates an new instance of that encapsulates value + /// Creates a new instance of that encapsulates a of + /// type . /// - /// The value to encapsulate - public Union(TSecond item) + /// The value to encapsulate. + public Union(T2? value) { - Item2 = item; - Tag = 1; + Value2 = value; + Tag = UnionTag.T2; } /// - /// Runs an delegate against the encapsulated value + /// Runs an delegate against the encapsulated value. /// - /// The delegate to run when this instance encapsulates an instance of - /// The delegate to run when this instance encapsulates an instance of - public void Match(Action first, Action second) + /// The delegate to run when this instance encapsulates a value of type . + /// The delegate to run when this instance encapsulates a value of type . + public void Match(Action? first, Action? second) { switch (Tag) { - case 0: - first(Item1); + case UnionTag.T1: + first?.Invoke(Value1); break; - case 1: - second(Item2); + + case UnionTag.T2: + second?.Invoke(Value2); break; + default: - throw new Exception($"Unrecognized tag value: {Tag}"); + throw new InvalidOperationException($"Unrecognized tag value: {Tag}"); } } /// - /// Runs a delegate against the encapsulated value + /// Runs a delegate against the encapsulated value. /// - /// The delegate to run when this instance encapsulates an instance of - /// The delegate to run when this instance encapsulates an instance of - public T Match(Func first, Func second) + /// The delegate to run when this instance encapsulates a value of type . + /// The delegate to run when this instance encapsulates a value of type . + public T Match(Func first, Func second) { - switch (Tag) + if (first is null) { - case 0: - return first(Item1); - case 1: - return second(Item2); - default: - throw new Exception($"Unrecognized tag value: {Tag}"); + throw new ArgumentNullException(nameof(first)); } + + if (second is null) + { + throw new ArgumentNullException(nameof(second)); + } + + return Tag switch + { + UnionTag.T1 => first(Value1), + UnionTag.T2 => second(Value2), + _ => throw new InvalidOperationException($"Unrecognized tag value: {Tag}") + }; } - public static implicit operator Union(TFirst first) => new(first); +#pragma warning disable CA2225 + + public static implicit operator Union(T1? first) => new(first); + + public static implicit operator Union(T2? second) => new(second); - public static implicit operator Union(TSecond second) => new(second); +#pragma warning restore CA2225 } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamName.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamName.cs index 45de4980f85..f4e29f57e29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamName.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamName.cs @@ -4,15 +4,22 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(DataStreamNameConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class DataStreamName : IEquatable, IUrlParameter +public sealed class DataStreamName : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { internal DataStreamName(string dataStreamName) => Name = dataStreamName; @@ -53,6 +60,26 @@ public override int GetHashCode() return (TypeHashCode * 23) ^ (Name.GetHashCode()); } } + + #region IParsable + + public static DataStreamName Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out DataStreamName? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new DataStreamName(s); + return true; + } + + #endregion IParsable } internal sealed class DataStreamNameConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamNames.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamNames.cs index 3cf8c5e97d7..c5b71e481b2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamNames.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/DataStreamNames/DataStreamNames.cs @@ -6,16 +6,24 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(DataStreamNamesConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class DataStreamNames : IUrlParameter, IEnumerable, IEquatable +public sealed class DataStreamNames : + IUrlParameter, + IEnumerable, + IEquatable +#if NET7_0_OR_GREATER + , IParsable +#endif { internal readonly IList Names; @@ -96,6 +104,44 @@ public override int GetHashCode() } string IUrlParameter.GetString(ITransportConfiguration? settings) => ToString(); + + #region IParsable + + public static DataStreamNames Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out DataStreamNames? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new DataStreamNames(); + return true; + } + + var names = new List(); + foreach (var item in list) + { + if (!DataStreamName.TryParse(item, provider, out var name)) + { + result = null; + return false; + } + + names.Add(name); + } + + result = new DataStreamNames(names); + return true; + } + + #endregion IParsable } internal sealed class DataStreamNamesConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/IndexAlias/IndexAlias.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/IndexAlias/IndexAlias.cs index cf11c50cb3b..aefd6d71967 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/IndexAlias/IndexAlias.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/IndexAlias/IndexAlias.cs @@ -4,15 +4,22 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(IndexAliasConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public class IndexAlias : IEquatable, IUrlParameter +public class IndexAlias : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { internal IndexAlias(string index) => Alias = index; @@ -53,6 +60,26 @@ public override int GetHashCode() return (TypeHashCode * 397) ^ (Alias.GetHashCode()); } } + + #region IParsable + + public static IndexAlias Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out IndexAlias? result) + { + if (string.IsNullOrEmpty(s)) + { + result = null; + return false; + } + + result = new IndexAlias(s); + return true; + } + + #endregion IParsable } internal sealed class IndexAliasConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Name.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Name.cs index 906d3e34c38..844d550d1ca 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Name.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Name.cs @@ -4,7 +4,9 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -12,9 +14,22 @@ namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(StringAliasConverter))] -public sealed class Name : IEquatable, IUrlParameter +public sealed class Name : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { - public Name(string name) => Value = name?.Trim(); + public Name(string name) + { + if (name is null) + { + throw new ArgumentNullException(nameof(name)); + } + + Value = name.Trim(); + } internal string Value { get; } @@ -48,4 +63,24 @@ public override int GetHashCode() return result; } } + + #region IParsable + + public static Name Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Name? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new Name(s); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Names.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Names.cs index 63b058d3e26..56b28a8c905 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Names.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Name/Names.cs @@ -5,41 +5,52 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(NamesConverter))] -public sealed class Names : IEquatable, IUrlParameter +public sealed class Names : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { - public Names(IEnumerable names) : this(names?.Select(n => (Name)n).ToList()) + public Names() { + Values = []; } public Names(IEnumerable names) { - Value = names?.ToList(); - if (!Value.HasAny()) - throw new ArgumentException($"can not create {nameof(Names)} on an empty enumerable of ", nameof(names)); + Values = names?.ToList(); } - internal IList Value { get; } + public Names(IEnumerable names) : + this(names?.Select(n => (Name)n).ToList()) + { + } + + internal IList Values { get; init; } private string DebugDisplay => ((IUrlParameter)this).GetString(null); public override string ToString() => DebugDisplay; - public bool Equals(Names other) => EqualsAllIds(Value, other.Value); + public bool Equals(Names other) => EqualsAllIds(Values, other.Values); string IUrlParameter.GetString(ITransportConfiguration? settings) => - string.Join(",", Value.Cast().Select(n => n.GetString(settings))); + string.Join(",", Values.Cast().Select(n => n.GetString(settings))); - public static Names Parse(string names) => names.IsNullOrEmptyCommaSeparatedList(out var list) ? null : new Names(list); + public static Names Parse(string names) => names.IsNullOrEmptyCommaSeparatedList(out var list) ? new Names() : new Names(list); public static implicit operator Names(Name name) => name == null ? null : new Names(new[] { name }); @@ -65,46 +76,68 @@ private static bool EqualsAllIds(ICollection thisIds, ICollection ot public override bool Equals(object obj) => obj is string s ? Equals(Parse(s)) : obj is Names i && Equals(i); - public override int GetHashCode() => Value.GetHashCode(); -} + public override int GetHashCode() => Values.GetHashCode(); -internal sealed class NamesConverter : - JsonConverter -{ - public override Names? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + #region IParsable + + public static Names Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Names? result) { - switch (reader.TokenType) + if (s is null) { - case JsonTokenType.Null: - return null; + result = null; + return false; + } - case JsonTokenType.String: - var name = JsonSerializer.Deserialize(ref reader, options); - return new Names([name]); + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new Names(); + return true; + } - case JsonTokenType.StartArray: - var names = JsonSerializer.Deserialize>(ref reader, options); - return new Names(names); + var names = new List(); + foreach (var item in list) + { + if (!Name.TryParse(item, provider, out var name)) + { + result = null; + return false; + } - default: - throw new JsonException("Unexpected token."); + names.Add(name); } + + result = new Names { Values = names }; + return true; } - public override void Write(Utf8JsonWriter writer, Names value, JsonSerializerOptions options) + #endregion IParsable +} + +internal sealed class NamesConverter : + JsonConverter +{ + public override Names Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (value is null) + return reader.TokenType switch { - writer.WriteNullValue(); - return; - } + JsonTokenType.String => new Names([reader.ReadValue(options)]), + JsonTokenType.StartArray => new Names(reader.ReadValue>(options)), + _ => throw reader.UnexpectedTokenException(JsonTokenType.String, JsonTokenType.StartArray) + }; + } - if (value.Value.Count == 1) + public override void Write(Utf8JsonWriter writer, Names value, JsonSerializerOptions options) + { + if (value.Values is [{ } single]) { - JsonSerializer.Serialize(writer, value.Value[0], options); + writer.WriteValue(options, single); return; } - JsonSerializer.Serialize(writer, value.Value, options); + writer.WriteValue(options, value.Values); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/NodeIds/NodeIds.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/NodeIds/NodeIds.cs index 5537e7ff7a5..9b9d18fdafd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/NodeIds/NodeIds.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/NodeIds/NodeIds.cs @@ -5,30 +5,42 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class NodeIds : IEquatable, IUrlParameter +public sealed class NodeIds : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { + public NodeIds() + { + Values = []; + } + public NodeIds(IEnumerable nodeIds) { - Value = nodeIds?.ToList(); - if (!Value.HasAny()) + Values = nodeIds?.ToList(); + if (!Values.HasAny()) throw new ArgumentException($"Can not create {nameof(NodeIds)} on an empty enumerable of ", nameof(nodeIds)); } - internal IList Value { get; } + internal IList Values { get; } private string DebugDisplay => ((IUrlParameter)this).GetString(null); public override string ToString() => DebugDisplay; - public bool Equals(NodeIds other) => EqualsAllIds(Value, other.Value); + public bool Equals(NodeIds other) => EqualsAllIds(Values, other.Values); - string IUrlParameter.GetString(ITransportConfiguration? settings) => string.Join(",", Value); + string IUrlParameter.GetString(ITransportConfiguration? settings) => string.Join(",", Values); public static NodeIds Parse(string nodeIds) => nodeIds.IsNullOrEmptyCommaSeparatedList(out var nodes) ? null : new NodeIds(nodes); @@ -54,5 +66,31 @@ private static bool EqualsAllIds(ICollection thisIds, ICollection obj is string s ? Equals(Parse(s)) : obj is NodeIds i && Equals(i); - public override int GetHashCode() => Value.GetHashCode(); + public override int GetHashCode() => Values.GetHashCode(); + + #region IParsable + + public static NodeIds Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out NodeIds? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new NodeIds(); + return true; + } + + result = new NodeIds(list); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollId.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollId.cs index a7f26e6469e..13a4ca216fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollId.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollId.cs @@ -4,15 +4,22 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(ScrollIdConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class ScrollId : IEquatable, IUrlParameter +public sealed class ScrollId : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { internal ScrollId(string scrollId) => Id = scrollId; @@ -53,6 +60,26 @@ public override int GetHashCode() return (TypeHashCode * 23) ^ (Id.GetHashCode()); } } + + #region IParsable + + public static ScrollId Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out ScrollId? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new ScrollId(s); + return true; + } + + #endregion IParsable } internal sealed class ScrollIdConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollIds.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollIds.cs index 2a9028fce7a..c32ef7ead6e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollIds.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/ScrollIds/ScrollIds.cs @@ -6,16 +6,25 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; + +using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(ScrollIdsConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class ScrollIds : IUrlParameter, IEnumerable, IEquatable +public sealed class ScrollIds : + IUrlParameter, + IEnumerable, + IEquatable +#if NET7_0_OR_GREATER + , IParsable +#endif { internal readonly IList Ids; @@ -95,26 +104,67 @@ public override int GetHashCode() } string IUrlParameter.GetString(ITransportConfiguration? settings) => ToString(); + + #region IParsable + + public static ScrollIds Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out ScrollIds? result) + { + if (s is null) + { + result = null; + return false; + } + + if (s.IsNullOrEmptyCommaSeparatedList(out var list)) + { + result = new ScrollIds(); + return true; + } + + var ids = new List(); + foreach (var item in list) + { + if (!ScrollId.TryParse(item, provider, out var name)) + { + result = null; + return false; + } + + ids.Add(name); + } + + result = new ScrollIds(ids); + return true; + } + + #endregion IParsable } -internal sealed class ScrollIdsConverter : JsonConverter +internal sealed class ScrollIdsConverter : + JsonConverter { - public override ScrollIds? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override ScrollIds Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartArray) - throw new JsonException($"Expected {JsonTokenType.StartArray} token but read '{reader.TokenType}' token for ScrollIds."); - - return JsonSerializer.Deserialize(ref reader, options); + return reader.TokenType switch + { + JsonTokenType.String => new ScrollIds([reader.ReadValue(options)]), + JsonTokenType.StartArray => new ScrollIds(reader.ReadValue>(options)), + _ => throw new JsonException($"Expected JSON '{JsonTokenType.String}' or '{JsonTokenType.StartArray}' token, but got '{reader.TokenType}'.") + }; } public override void Write(Utf8JsonWriter writer, ScrollIds value, JsonSerializerOptions options) { - if (value is null) + if (value.Ids.Count == 1) { - writer.WriteNullValue(); + writer.WriteValue(options, value.Ids[0]); return; } - JsonSerializer.Serialize(writer, value.Ids, options); + writer.WriteValue(options, value.Ids); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/TaskId/TaskId.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/TaskId/TaskId.cs index 107e8da4cdb..bc57a747576 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/TaskId/TaskId.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/TaskId/TaskId.cs @@ -4,9 +4,11 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -14,7 +16,12 @@ namespace Elastic.Clients.Elasticsearch; [JsonConverter(typeof(TaskIdConverter))] [DebuggerDisplay("{DebugDisplay,nq}")] -public sealed class TaskId : IUrlParameter, IEquatable +public sealed class TaskId : + IUrlParameter, + IEquatable +#if NET7_0_OR_GREATER + , IParsable +#endif { /// /// A task id exists in the form [node_id]:[task_id]. @@ -68,6 +75,35 @@ public override int GetHashCode() return (NodeId.GetHashCode() * 397) ^ TaskNumber.GetHashCode(); } } + + #region IParsable + + public static TaskId Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out TaskId? result) + { + if (string.IsNullOrEmpty(s)) + { + result = null; + return false; + } + + try + { + result = new TaskId(s); + return true; + } + catch + { + result = null; + } + + return false; + } + + #endregion IParsable } internal sealed class TaskIdConverter : JsonConverter diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Username/Username.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Username/Username.cs index 65f8b734471..11e106fb014 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Username/Username.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Core/UrlParameters/Username/Username.cs @@ -4,7 +4,9 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -12,7 +14,12 @@ namespace Elastic.Clients.Elasticsearch; [DebuggerDisplay("{DebugDisplay,nq}")] [JsonConverter(typeof(StringAliasConverter))] -public class Username : IEquatable, IUrlParameter +public class Username : + IEquatable, + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { public Username(string name) => Value = name?.Trim(); @@ -48,4 +55,24 @@ public override int GetHashCode() return result; } } + + #region IParsable + + public static Username Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Username? result) + { + if (s is null) + { + result = null; + return false; + } + + result = new Username(s); + return true; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/IsExternalInit.cs b/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/IsExternalInit.cs deleted file mode 100644 index 6ba267c1f1a..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/IsExternalInit.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -#if !NET5_0_OR_GREATER || NETSTANDARD2_0 || NET461 - -namespace System.Runtime.CompilerServices; - -using System.ComponentModel; - -/// -/// Reserved to be used by the compiler for tracking metadata. -/// This class should not be used by developers in source code. -/// -[EditorBrowsable(EditorBrowsableState.Never)] -internal static class IsExternalInit -{ -} - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/NullableAttributes.cs b/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/NullableAttributes.cs deleted file mode 100644 index 8389e11206f..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/NullableAttributes.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#define INTERNAL_NULLABLE_ATTRIBUTES - -#pragma warning disable SA1402 // File may only contain a single type -#pragma warning disable SA1649 // File name should match first type name - -#if !NETCOREAPP3_1_OR_GREATER && !NETSTANDARD2_1_OR_GREATER || NET461 -namespace System.Diagnostics.CodeAnalysis; - -/// Specifies that null is allowed as an input even if the corresponding type disallows it. -[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class AllowNullAttribute : Attribute -{ } - -/// Specifies that null is disallowed as an input even if the corresponding type allows it. -[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class DisallowNullAttribute : Attribute -{ } - -/// Specifies that an output may be null even if the corresponding type disallows it. -[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class MaybeNullAttribute : Attribute -{ } - -/// Specifies that an output will not be null even if the corresponding type allows it. -[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class NotNullAttribute : Attribute -{ } - -/// Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. -[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class MaybeNullWhenAttribute : Attribute -{ - /// Initializes the attribute with the specified return value condition. - /// - /// The return value condition. If the method returns this value, the associated parameter may be null. - /// - public MaybeNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; - - /// Gets the return value condition. - public bool ReturnValue { get; } -} - -/// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. -[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class NotNullWhenAttribute : Attribute -{ - /// Initializes the attribute with the specified return value condition. - /// - /// The return value condition. If the method returns this value, the associated parameter will not be null. - /// - public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; - - /// Gets the return value condition. - public bool ReturnValue { get; } -} - -/// Specifies that the output will be non-null if the named parameter is non-null. -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class NotNullIfNotNullAttribute : Attribute -{ - /// Initializes the attribute with the associated parameter name. - /// - /// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. - /// - public NotNullIfNotNullAttribute(string parameterName) => ParameterName = parameterName; - - /// Gets the associated parameter name. - public string ParameterName { get; } -} - -/// Applied to a method that will never return under any circumstance. -[AttributeUsage(AttributeTargets.Method, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class DoesNotReturnAttribute : Attribute -{ } - -/// Specifies that the method will not return if the associated Boolean parameter is passed the specified value. -[AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES -internal -#else - public -#endif - sealed class DoesNotReturnIfAttribute : Attribute -{ - /// Initializes the attribute with the specified parameter value. - /// - /// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to - /// the associated parameter matches this value. - /// - public DoesNotReturnIfAttribute(bool parameterValue) => ParameterValue = parameterValue; - - /// Gets the condition parameter value. - public bool ParameterValue { get; } -} -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/TypeExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/TypeExtensions.cs deleted file mode 100644 index 61cdbf2d2bc..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/CrossPlatform/TypeExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Elastic.Clients.Elasticsearch; - -internal static class DotNetCoreTypeExtensions -{ - internal static bool TryGetGenericDictionaryArguments(this Type type, out Type[] genericArguments) - { - var genericDictionary = type.GetInterfaces() - .FirstOrDefault(t => - t.IsGenericType && ( - t.GetGenericTypeDefinition() == typeof(IDictionary<,>) || - t.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>))); - - if (genericDictionary == null) - { - genericArguments = new Type[0]; - return false; - } - - genericArguments = genericDictionary.GetGenericArguments(); - return true; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BlockingSubscribeExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BlockingSubscribeExtensions.cs index 6b1fc986a9d..7e62da93c05 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BlockingSubscribeExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BlockingSubscribeExtensions.cs @@ -2,10 +2,9 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !ELASTICSEARCH_SERVERLESS - using System; using System.Threading; + namespace Elastic.Clients.Elasticsearch; public static class BlockingSubscribeExtensions @@ -43,5 +42,3 @@ Func, Action, TObserver> factory return observer; } } - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllObservable.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllObservable.cs index e622b1436df..6bd0b47669e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllObservable.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllObservable.cs @@ -2,8 +2,6 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if !ELASTICSEARCH_SERVERLESS - using System; using System.Collections.Generic; using System.Linq; @@ -14,7 +12,6 @@ using Elastic.Transport.Extensions; using Elastic.Transport.Products.Elasticsearch; using Elastic.Clients.Elasticsearch.Core.Bulk; -using Elastic.Clients.Elasticsearch.Requests; namespace Elastic.Clients.Elasticsearch; @@ -149,11 +146,11 @@ private async Task BulkAsync(IList buffer, long page, int ba case IHelperCallable helperCallable when helperCallable.ParentMetaData is not null: s.RequestConfiguration(rc => rc.RequestMetaData(helperCallable.ParentMetaData)); break; + default: s.RequestConfiguration(rc => rc.RequestMetaData(RequestMetaDataFactory.BulkHelperRequestMetaData())); break; } - }, _compositeCancelToken).ConfigureAwait(false); _compositeCancelToken.ThrowIfCancellationRequested(); @@ -233,6 +230,7 @@ private async Task HandleBulkRequestAsync(IList buffer, long ThrowOnExhaustedRetries(); return await RetryDocumentsAsync(page, ++backOffRetries, buffer).ConfigureAwait(false); + case PipelineFailure.CouldNotStartSniffOnStartup: case PipelineFailure.BadAuthentication: case PipelineFailure.NoNodesAttempted: @@ -274,7 +272,8 @@ private Exception ThrowOnBadBulk(ElasticsearchResponse response, string message) private static bool RetryBulkActionPredicate(ResponseItem bulkResponseItem, T d) => bulkResponseItem.Status == 429; - private static void DroppedDocumentCallbackDefault(ResponseItem bulkResponseItem, T d) { } + private static void DroppedDocumentCallbackDefault(ResponseItem bulkResponseItem, T d) + { } public void Dispose() { @@ -297,5 +296,3 @@ public IDisposable Subscribe(IObserver observer) private static TransportException Throw(string message, ElasticsearchResponse details) => new(PipelineFailure.BadResponse, message, details); } - -#endif diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllRequest.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllRequest.cs index 131b127a268..c209dc4e546 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllRequest.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Helpers/BulkAllRequest.cs @@ -4,14 +4,15 @@ using System; using System.Collections.Generic; -using System.Text.Json; + using Elastic.Transport; using Elastic.Clients.Elasticsearch.Core.Bulk; -using Elastic.Clients.Elasticsearch.Fluent; namespace Elastic.Clients.Elasticsearch; -public sealed class BulkAllRequest : IBulkAllRequest, IHelperCallable +public sealed class BulkAllRequest : + IBulkAllRequest, + IHelperCallable { public BulkAllRequest(IEnumerable documents) { @@ -59,95 +60,121 @@ public BulkAllRequest(IEnumerable documents) RequestMetaData IHelperCallable.ParentMetaData { get => ParentMetaData; set => ParentMetaData = value; } } -public sealed class BulkAllRequestDescriptor : SerializableDescriptor>, IBulkAllRequest, IHelperCallable + +public sealed class BulkAllRequestDescriptor { - private readonly IEnumerable _documents; - - private int? _backOffRetries; - private Duration _backOffTime; - private ProducerConsumerBackPressure _backPressure; - private Action _bulkResponseCallback; - private IndexName _index; - private int? _maxDegreeOfParallism; - private int? _size; - private bool _refreshOnCompleted; - private Action> _bufferToBulk; - private Func _retryDocumentPredicate; - private Action _droppedDocumentCallback; - private Routing _routing; - private bool _continueAfterDroppedDocuments; - private string _pipeline; - private Indices _refreshIndices; - private Duration _timeout; - private WaitForActiveShards? _waitForActiveShards; - private RequestMetaData _requestMetaData; + internal BulkAllRequest Instance { get; } public BulkAllRequestDescriptor(IEnumerable documents) { - _documents = documents; - _index = typeof(T); + Instance = new(documents); } - int? IBulkAllRequest.BackOffRetries => _backOffRetries; - Duration? IBulkAllRequest.BackOffTime => _backOffTime; - ProducerConsumerBackPressure? IBulkAllRequest.BackPressure => _backPressure; - Action>? IBulkAllRequest.BufferToBulk => _bufferToBulk; - Action? IBulkAllRequest.BulkResponseCallback => _bulkResponseCallback; - bool IBulkAllRequest.ContinueAfterDroppedDocuments => _continueAfterDroppedDocuments; - IEnumerable IBulkAllRequest.Documents => _documents; - Action? IBulkAllRequest.DroppedDocumentCallback => _droppedDocumentCallback; - IndexName IBulkAllRequest.Index => _index; - int? IBulkAllRequest.MaxDegreeOfParallelism => _maxDegreeOfParallism; - string? IBulkAllRequest.Pipeline => _pipeline; - Indices? IBulkAllRequest.RefreshIndices => _refreshIndices; - bool IBulkAllRequest.RefreshOnCompleted => _refreshOnCompleted; - Func? IBulkAllRequest.RetryDocumentPredicate => _retryDocumentPredicate; - Routing? IBulkAllRequest.Routing => _routing; - int? IBulkAllRequest.Size => _size; - Duration? IBulkAllRequest.Timeout => _timeout; - WaitForActiveShards? IBulkAllRequest.WaitForActiveShards => _waitForActiveShards; - RequestMetaData IHelperCallable.ParentMetaData { get => _requestMetaData; set => _requestMetaData = value; } - - public BulkAllRequestDescriptor BackOffRetries(int? backOffRetries) => Assign(backOffRetries, (a, v) => a._backOffRetries = v); - - public BulkAllRequestDescriptor BackOffTime(Duration? backOffTime) => Assign(backOffTime, (a, v) => a._backOffTime = v); + public BulkAllRequestDescriptor BackOffRetries(int? backOffRetries) + { + Instance.BackOffRetries = backOffRetries; + return this; + } - public BulkAllRequestDescriptor BackPressure(int maxConcurrency, int? backPressureFactor = null) => - Assign(new ProducerConsumerBackPressure(backPressureFactor, maxConcurrency), (a, v) => a._backPressure = v); + public BulkAllRequestDescriptor BackOffTime(Duration? backOffTime) + { + Instance.BackOffTime = backOffTime; + return this; + } - public BulkAllRequestDescriptor BufferToBulk(Action> modifier) => Assign(modifier, (a, v) => a._bufferToBulk = v); + public BulkAllRequestDescriptor BackPressure(int maxConcurrency, int? backPressureFactor = null) + { + Instance.BackPressure = new ProducerConsumerBackPressure(backPressureFactor, maxConcurrency); + return this; + } - public BulkAllRequestDescriptor BulkResponseCallback(Action callback) => - Assign(callback, (a, v) => a._bulkResponseCallback = v); + public BulkAllRequestDescriptor BufferToBulk(Action> modifier) + { + Instance.BufferToBulk = modifier; + return this; + } - public BulkAllRequestDescriptor ContinueAfterDroppedDocuments(bool proceed = true) => Assign(proceed, (a, v) => a._continueAfterDroppedDocuments = v); + public BulkAllRequestDescriptor BulkResponseCallback(Action callback) + { + Instance.BulkResponseCallback = callback; + return this; + } - public BulkAllRequestDescriptor DroppedDocumentCallback(Action callback) => - Assign(callback, (a, v) => a._droppedDocumentCallback = v); + public BulkAllRequestDescriptor ContinueAfterDroppedDocuments(bool proceed = true) + { + Instance.ContinueAfterDroppedDocuments = proceed; + return this; + } - public BulkAllRequestDescriptor Index(IndexName index) => Assign(index, (a, v) => a._index = v); + public BulkAllRequestDescriptor DroppedDocumentCallback(Action callback) + { + Instance.DroppedDocumentCallback = callback; + return this; + } - public BulkAllRequestDescriptor Index() where TOther : class => Assign(typeof(TOther), (a, v) => a._index = v); + public BulkAllRequestDescriptor Index(IndexName index) + { + Instance.Index = index; + return this; + } - public BulkAllRequestDescriptor MaxDegreeOfParallelism(int? parallelism) => Assign(parallelism, (a, v) => a._maxDegreeOfParallism = v); + public BulkAllRequestDescriptor Index() where TOther : class + { + Instance.Index = typeof(TOther); + return this; + } - public BulkAllRequestDescriptor Pipeline(string pipeline) => Assign(pipeline, (a, v) => a._pipeline = v); + public BulkAllRequestDescriptor MaxDegreeOfParallelism(int? parallelism) + { + Instance.MaxDegreeOfParallelism = parallelism; + return this; + } - public BulkAllRequestDescriptor RefreshIndices(Indices indicesToRefresh) => Assign(indicesToRefresh, (a, v) => a._refreshIndices = v); + public BulkAllRequestDescriptor Pipeline(string pipeline) + { + Instance.Pipeline = pipeline; + return this; + } - public BulkAllRequestDescriptor RefreshOnCompleted(bool refreshOnCompleted = true) => Assign(refreshOnCompleted, (a, v) => a._refreshOnCompleted = v); + public BulkAllRequestDescriptor RefreshIndices(Indices indicesToRefresh) + { + Instance.RefreshIndices = indicesToRefresh; + return this; + } - public BulkAllRequestDescriptor RetryDocumentPredicate(Func predicate) => - Assign(predicate, (a, v) => a._retryDocumentPredicate = v); + public BulkAllRequestDescriptor RefreshOnCompleted(bool refreshOnCompleted = true) + { + Instance.RefreshOnCompleted = refreshOnCompleted; + return this; + } - public BulkAllRequestDescriptor Routing(Routing routing) => Assign(routing, (a, v) => a._routing = v); + public BulkAllRequestDescriptor RetryDocumentPredicate(Func predicate) + { + Instance.RetryDocumentPredicate = predicate; + return this; + } - public BulkAllRequestDescriptor Size(int? size) => Assign(size, (a, v) => a._size = v); + public BulkAllRequestDescriptor Routing(Routing routing) + { + Instance.Routing = routing; + return this; + } - public BulkAllRequestDescriptor Timeout(Duration timeout) => Assign(timeout, (a, v) => a._timeout = v); + public BulkAllRequestDescriptor Size(int? size) + { + Instance.Size = size; + return this; + } - public BulkAllRequestDescriptor WaitForActiveShards(WaitForActiveShards? shards) => Assign(shards, (a, v) => a._waitForActiveShards = v); + public BulkAllRequestDescriptor Timeout(Duration timeout) + { + Instance.Timeout = timeout; + return this; + } - // This descriptor is not serializable and gets converted to a BullAllObservable - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) => throw new NotImplementedException(); + public BulkAllRequestDescriptor WaitForActiveShards(WaitForActiveShards? shards) + { + Instance.WaitForActiveShards = shards; + return this; + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/ContextProvider.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/ContextProvider.cs new file mode 100644 index 00000000000..8e0f373b4de --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/ContextProvider.cs @@ -0,0 +1,99 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// Provides functionality to link a to by +/// registering this context provider to the global list. +/// +/// The type of the context data. +internal sealed class ContextProvider : + JsonConverterFactory +{ + private readonly Converter _converter; + + public ContextProvider(TContext context) + { + _converter = new Converter(context); + } + + /// + /// Retrieves the instance from the given . + /// + /// The to retrieve the context from. + /// The context linked to the given . + /// + /// If no for is registered to the given + /// instance. + /// + public static TContext GetContext(JsonSerializerOptions options) + { +#pragma warning disable IL2026, IL3050 + if (options.GetConverter(typeof(Marker)) is not Converter provider) +#pragma warning restore IL2026, IL3050 + { + throw new InvalidOperationException($"No context provider for type '{typeof(TContext).Name}' is " + + $"registered for the given 'JsonSerializerOptions' instance."); + } + + return provider.Context; + } + + /// + /// Tries to retrieve the instance from the given . + /// + /// The to retrieve the context from. + /// The context linked to the given . + /// + /// if the context was successfully retrieved from the given + /// or , if not. + /// + public static bool TryGetContext(JsonSerializerOptions options, [MaybeNullWhen(false)] out TContext context) + { +#pragma warning disable IL2026, IL3050 + if (options.GetConverter(typeof(Marker)) is not Converter provider) +#pragma warning restore IL2026, IL3050 + { + context = default; + return false; + } + + context = provider.Context; + return true; + } + + public override bool CanConvert(Type typeToConvert) + { + return typeToConvert == typeof(Marker); + } + + public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) + { + return _converter; + } + + private sealed class Marker; + + private sealed class Converter(TContext context) : + JsonConverter + { + public TContext Context { get; } = context; + + public override Marker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, Marker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeConverters.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeConverters.cs new file mode 100644 index 00000000000..365a4c6fe53 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeConverters.cs @@ -0,0 +1,335 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Buffers.Text; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +#region DateTime + +internal sealed class DateTimeMarker; + +internal sealed class DateTimeMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeMarkerConverter() + { + WrappedConverter = new DateTimeConverter(); + } + + public override DateTimeMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochMilliseconds(timestamp); + } + + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.Number => DateTimeHelper.FromEpochMilliseconds(reader.GetInt64()), + _ => throw new JsonException($"Expected JSON '{JsonTokenType.String}' or '{JsonTokenType.Number}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue(DateTimeHelper.ToEpochMilliseconds(value)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static DateTimeOffset ParseValue(ref Utf8JsonReader reader) + { + return DateTimeOffset.TryParse(reader.GetString()!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out var result) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(DateTimeOffset)}'."); + + // TODO: https://github.com/dotnet/runtime/issues/28942#issuecomment-724161375 + + //return Utf8Parser.TryParse(reader.ValueSpan, out DateTimeOffset result, out var consumed, 'O') && (consumed == reader.ValueSpan.Length) + // ? result + // : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(DateTimeOffset)}'."); + } +} + +#endregion DateTime + +#region DateTimeSeconds + +internal sealed class DateTimeSecondsMarker; + +internal sealed class DateTimeSecondsMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeSecondsMarkerConverter() + { + WrappedConverter = new DateTimeSecondsConverter(); + } + + public override DateTimeSecondsMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeSecondsMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeSecondsConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochSeconds(timestamp); + } + + reader.ValidateToken(JsonTokenType.Number); + + return DateTimeHelper.FromEpochSeconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue(DateTimeHelper.ToEpochSeconds(value)); + } +} + +#endregion DateTimeSeconds + +#region DateTimeMillis + +internal sealed class DateTimeMillisMarker; + +internal sealed class DateTimeMillisMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeMillisMarkerConverter() + { + WrappedConverter = new DateTimeMillisConverter(); + } + + public override DateTimeMillisMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeMillisMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeMillisConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochMilliseconds(timestamp); + } + + reader.ValidateToken(JsonTokenType.Number); + + return DateTimeHelper.FromEpochMilliseconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue(DateTimeHelper.ToEpochMilliseconds(value)); + } +} + +#endregion DateTimeMillis + +#region DateTimeNanos + +internal sealed class DateTimeNanosMarker; + +internal sealed class DateTimeNanosMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeNanosMarkerConverter() + { + WrappedConverter = new DateTimeNanosConverter(); + } + + public override DateTimeNanosMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeNanosMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeNanosConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochNanoseconds(timestamp); + } + + reader.ValidateToken(JsonTokenType.Number); + + return DateTimeHelper.FromEpochNanoseconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue(DateTimeHelper.ToEpochNanoseconds(value)); + } +} + +#endregion DateTimeNanos + +#region DateTimeSecondsFloat + +internal sealed class DateTimeSecondsFloatMarker; + +internal sealed class DateTimeSecondsFloatMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeSecondsFloatMarkerConverter() + { + WrappedConverter = new DateTimeSecondsFloatConverter(); + } + + public override DateTimeSecondsFloatMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeSecondsFloatMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeSecondsFloatConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out double timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochSeconds((long)timestamp); + } + + reader.ValidateToken(JsonTokenType.Number); + + return DateTimeHelper.FromEpochSeconds((long)reader.GetDouble()); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue((double)DateTimeHelper.ToEpochSeconds(value)); + } +} + +#endregion DateTimeSecondsFloat + +#region DateTimeMillisFloat + +internal sealed class DateTimeMillisFloatMarker; + +internal sealed class DateTimeMillisFloatMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public DateTimeMillisFloatMarkerConverter() + { + WrappedConverter = new DateTimeMillisFloatConverter(); + } + + public override DateTimeMillisFloatMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, DateTimeMillisFloatMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class DateTimeMillisFloatConverter : + JsonConverter +{ + public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out double timestamp, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return DateTimeHelper.FromEpochMilliseconds((long)timestamp); + } + + reader.ValidateToken(JsonTokenType.Number); + + return DateTimeHelper.FromEpochMilliseconds((long)reader.GetDouble()); + } + + public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) + { + writer.WriteNumberValue((double)DateTimeHelper.ToEpochMilliseconds(value)); + } +} + +#endregion DateTimeMillisFloat diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeHelper.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeHelper.cs new file mode 100644 index 00000000000..422194f6d41 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DateTimeHelper.cs @@ -0,0 +1,128 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// Utility class for converting between epoch time and objects. +/// +internal static class DateTimeHelper +{ + private const int DaysPerYear = 365; + private const int DaysPer4Years = DaysPerYear * 4 + 1; // 1461 + private const int DaysPer100Years = DaysPer4Years * 25 - 1; // 36524 + private const int DaysPer400Years = DaysPer100Years * 4 + 1; // 146097 + private const int DaysTo1970 = DaysPer400Years * 4 + DaysPer100Years * 3 + DaysPer4Years * 17 + DaysPerYear; // 719,162 + private const int DaysTo10000 = DaysPer400Years * 25 - 366; // 3652059 + + private const long DateTimeMinTicks = 0; + private const long DateTimeMaxTicks = DaysTo10000 * TimeSpan.TicksPerDay - 1; + private const long DateTimeUnixEpochTicks = DaysTo1970 * TimeSpan.TicksPerDay; + + private const long UnixMinSeconds = DateTimeMinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds; + private const long UnixMaxSeconds = DateTimeMaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds; + private const long UnixEpochSeconds = DateTimeUnixEpochTicks / TimeSpan.TicksPerSecond; // 62,135,596,800 + private const long UnixEpochMilliseconds = DateTimeUnixEpochTicks / TimeSpan.TicksPerMillisecond; // 62,135,596,800,000 + private const long UnixEpochNanoseconds = DateTimeUnixEpochTicks / TicksPerNanosecond; + + private const long TicksPerNanosecond = 100; + + /// + /// Converts epoch time in milliseconds to a UTC object. + /// + /// The number of milliseconds since Unix epoch (January 1st, 1970, 00:00:00 UTC). + /// A object representing the specified epoch time. + /// + /// Thrown when the milliseconds value would result in a outside the valid range. + /// + public static DateTimeOffset FromEpochMilliseconds(long milliseconds) + { + const long minMilliseconds = DateTimeMinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds; + const long maxMilliseconds = DateTimeMaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds; + + if (milliseconds is < minMilliseconds or > maxMilliseconds) + { + throw new ArgumentOutOfRangeException(nameof(milliseconds)); + } + + var ticks = milliseconds * TimeSpan.TicksPerMillisecond + DateTimeUnixEpochTicks; + return new DateTimeOffset(ticks, TimeSpan.Zero); + } + + /// + /// Converts a to epoch time in milliseconds. + /// + /// The to convert. + /// The number of milliseconds since Unix epoch. + public static long ToEpochMilliseconds(DateTimeOffset dateTime) + { + var milliseconds = dateTime.UtcDateTime.Ticks / TimeSpan.TicksPerMillisecond; + return milliseconds - UnixEpochMilliseconds; + } + + /// + /// Converts epoch time in seconds to a object. + /// + /// The number of seconds since Unix epoch (January 1st, 1970, 00:00:00 UTC). + /// A object representing the specified epoch time. + /// + /// Thrown when the seconds value would result in a outside the valid range. + /// + public static DateTimeOffset FromEpochSeconds(long seconds) + { + if (seconds is < UnixMinSeconds or > UnixMaxSeconds) + { + throw new ArgumentOutOfRangeException(nameof(seconds)); + } + + var ticks = seconds * TimeSpan.TicksPerSecond + DateTimeUnixEpochTicks; + return new DateTimeOffset(ticks, TimeSpan.Zero); + } + + /// + /// Converts a to epoch time in seconds. + /// + /// The to convert. + /// The number of seconds since Unix epoch. + public static long ToEpochSeconds(DateTimeOffset dateTime) + { + var seconds = dateTime.UtcDateTime.Ticks / TimeSpan.TicksPerSecond; + return seconds - UnixEpochSeconds; + } + + /// + /// Converts epoch time in nanoseconds to a object. + /// + /// The number of nanoseconds since Unix epoch (January 1st, 1970, 00:00:00 UTC). + /// A object representing the specified epoch time, + /// + /// Thrown when the nanoseconds value would result in a outside the valid range. + /// + public static DateTimeOffset FromEpochNanoseconds(long nanoseconds) + { + const long minNanoseconds = DateTimeMinTicks / TicksPerNanosecond - UnixEpochNanoseconds; + const long maxNanoseconds = DateTimeMaxTicks / TicksPerNanosecond - UnixEpochNanoseconds; + + if (nanoseconds is < minNanoseconds or > maxNanoseconds) + { + throw new ArgumentOutOfRangeException(nameof(nanoseconds)); + } + + var ticks = nanoseconds * TicksPerNanosecond + DateTimeUnixEpochTicks; + return new DateTimeOffset(ticks, TimeSpan.Zero); + } + + /// + /// Converts a to epoch time in nanoseconds. + /// + /// The to convert. + /// The number of nanoseconds since Unix epoch. + public static long ToEpochNanoseconds(DateTimeOffset dateTime) + { + var seconds = dateTime.UtcDateTime.Ticks / TicksPerNanosecond; + return seconds - UnixEpochNanoseconds; + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/DoubleWithFractionalPortionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DoubleWithFractionalPortionConverter.cs new file mode 100644 index 00000000000..dc5e553ff94 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DoubleWithFractionalPortionConverter.cs @@ -0,0 +1,107 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Buffers; +using System.Buffers.Text; +using System.Diagnostics; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal sealed class DoubleWithFractionalPortionConverter : + JsonConverter +{ + // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs#L78 + public const int MaximumFormatLength = 128 + 2; + + private static readonly StandardFormat DefaultFormat = StandardFormat.Parse("G17"); + private static readonly JsonEncodedText NaN = JsonEncodedText.Encode("NaN"u8); + private static readonly JsonEncodedText PositiveInfinity = JsonEncodedText.Encode("Infinity"u8); + private static readonly JsonEncodedText NegativeInfinity = JsonEncodedText.Encode("-Infinity"u8); + + public static ReadOnlySpan NonIntegerChars => "E."u8; + + public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType is not JsonTokenType.String) + { + return reader.GetDouble(); + } + + if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) + { + if (reader.ValueTextEquals(NaN)) + { + return double.NaN; + } + + if (reader.ValueTextEquals(PositiveInfinity)) + { + return double.PositiveInfinity; + } + + if (reader.ValueTextEquals(NegativeInfinity)) + { + return double.NegativeInfinity; + } + } + + if (!options.NumberHandling.HasFlag(JsonNumberHandling.AllowReadingFromString)) + { + return reader.GetDouble(); + } + + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out double result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException("Unable to convert JSON string value to 'double'."); + } + + public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options) + { + if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) + { + if (double.IsNaN(value)) + { + writer.WriteStringValue(NaN); + return; + } + + if (double.IsPositiveInfinity(value)) + { + writer.WriteStringValue(PositiveInfinity); + return; + } + + if (double.IsNegativeInfinity(value)) + { + writer.WriteStringValue(NegativeInfinity); + return; + } + } + + if (options.NumberHandling.HasFlag(JsonNumberHandling.WriteAsString)) + { + throw new NotImplementedException("'JsonNumberHandling.WriteAsString' is currently not supported."); + } + + Span buffer = stackalloc byte[MaximumFormatLength]; + + if (!Utf8Formatter.TryFormat(value, buffer, out var bytesWritten, DefaultFormat)) + { + throw new JsonException($"Could not convert value '{value}' to JSON number."); + } + + if (buffer.IndexOfAny(NonIntegerChars) == -1) + { + buffer[bytesWritten++] = (byte)'.'; + buffer[bytesWritten++] = (byte)'0'; + } + + writer.WriteRawValue(buffer[..bytesWritten], true); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/DynamicallyAccessed.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DynamicallyAccessed.cs new file mode 100644 index 00000000000..f96bddac162 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/DynamicallyAccessed.cs @@ -0,0 +1,30 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics.CodeAnalysis; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal static class DynamicallyAccessed +{ + public static void AllConstructors( + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | + DynamicallyAccessedMemberTypes.NonPublicConstructors)] + Type type) + { + } + + public static void PublicConstructors( + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] + Type type) + { + } + + public static void Interfaces( + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] + Type type) + { + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/EnumStructConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/EnumStructConverter.cs similarity index 59% rename from src/Elastic.Clients.Elasticsearch/_Shared/Serialization/EnumStructConverter.cs rename to src/Elastic.Clients.Elasticsearch/_Shared/Next/EnumStructConverter.cs index 7bfb00d91dc..e2570641c0f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/EnumStructConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/EnumStructConverter.cs @@ -5,27 +5,37 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Core; namespace Elastic.Clients.Elasticsearch.Serialization; -internal sealed class EnumStructConverter : JsonConverter where T : struct, IEnumStruct +internal sealed class EnumStructConverter : + JsonConverter + where T : struct, IEnumStruct { public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var value = reader.GetString(); - var instance = default(T).Create(value); + reader.ValidateToken(JsonTokenType.String); - return instance; + var value = reader.GetString()!; + +#if NET7_0_OR_GREATER + var result = T.Create(value); +#else + var result = default(T).Create(value); +#endif + + return result; } public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) { - var enumValue = value.ToString(); - - if (!string.IsNullOrEmpty(enumValue)) - writer.WriteStringValue(enumValue); + if (!string.IsNullOrEmpty(value.Value)) + { + writer.WriteStringValue(value.Value); + } else + { writer.WriteNullValue(); + } } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverterAttribute.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/IEnumStruct.cs similarity index 52% rename from src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverterAttribute.cs rename to src/Elastic.Clients.Elasticsearch/_Shared/Next/IEnumStruct.cs index b53215f504a..bc4fbf3d4df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverterAttribute.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/IEnumStruct.cs @@ -2,14 +2,20 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System; - namespace Elastic.Clients.Elasticsearch.Serialization; -[AttributeUsage(AttributeTargets.Interface)] -internal class InterfaceConverterAttribute : Attribute +internal interface IEnumStruct + where TSelf : struct, IEnumStruct { - public InterfaceConverterAttribute(Type converterType) => ConverterType = converterType; + public string Value { get; } + +#if NET7_0_OR_GREATER + + public static abstract TSelf Create(string value); + +#else + + public TSelf Create(string value); - public Type ConverterType { get; } +#endif } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/IMarkerTypeConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/IMarkerTypeConverter.cs new file mode 100644 index 00000000000..7561f3be0d2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/IMarkerTypeConverter.cs @@ -0,0 +1,18 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// Allows the code generator to use specialized converters on a per-property basis in custom converters. +/// +/// +/// See e.g. for an example. +/// +internal interface IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IUnionVerifiable.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonConstructorSentinel.cs similarity index 56% rename from src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IUnionVerifiable.cs rename to src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonConstructorSentinel.cs index 51fac87e1c9..ba1ddeeedf3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IUnionVerifiable.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonConstructorSentinel.cs @@ -4,7 +4,10 @@ namespace Elastic.Clients.Elasticsearch.Serialization; -internal interface IUnionVerifiable +/// +/// A sentinel type used to mark internal JSON constructors. +/// +internal sealed class JsonConstructorSentinel { - bool IsSuccessful { get; } + public static readonly JsonConstructorSentinel Instance = new(); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonReaderExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonReaderExtensions.cs new file mode 100644 index 00000000000..20d03118d3a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonReaderExtensions.cs @@ -0,0 +1,511 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// A delegate that reads a value from a given instance. +/// +/// The type of the value to read. +/// A reference to the instance. +/// The to use. +/// The value read from the . +internal delegate T? JsonReadFunc(ref Utf8JsonReader reader, JsonSerializerOptions options); + +// NOTE: +// The marker type concept allows us to use specialized converters on a per-property basis in custom converters. +// This basically emulates using the '[JsonConverter({ConverterType})]' attribute on property level. + +// NOTE: +// We make use of '[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]' for +// marker type parameters. +// The marker types are not actually constructed at any time, but this tricks the trimmer into checking the static +// constructor of all marker types. We use the static constructor to root the corresponding marker type converters, +// if the marker type has generic type arguments. + +internal static class JsonReaderExtensions +{ + #region General Purpose + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ValidateToken(this ref Utf8JsonReader reader, JsonTokenType expected) + { + if (reader.TokenType != expected) + { + throw new JsonException($"Expected JSON '{expected}' token, but got '{reader.TokenType}'."); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static JsonException UnexpectedTokenException(this ref Utf8JsonReader reader, params ReadOnlySpan expected) + { + string valid; + if (expected.Length <= 1) + { + valid = $"'{expected[0]}'"; + } + else + { + valid = string.Join(",", expected[..^2].ToArray().Select(x => $"'{x}'")); + valid += $" or '{expected[^1]}'"; + } + + return new JsonException($"Expected JSON {valid} token, but got '{reader.TokenType}'."); + } + + /// + /// Compares the JSON encoded text to the JSON token value in the source and returns if they match. + /// + /// A reference to the . + /// The JSON encoded text to compare against. + /// if the JSON token value in the source matches the JSON encoded look up text. + /// + /// This is an alternative version of the built-in method + /// with the only difference that this overload operates on pre-encoded JSON text. + /// + public static bool ValueTextEquals(this ref Utf8JsonReader reader, JsonEncodedText text) + { + return reader.HasValueSequence + ? CompareToSequence(ref reader, text.EncodedUtf8Bytes) + : reader.ValueSpan.SequenceEqual(text.EncodedUtf8Bytes); + + static bool CompareToSequence(ref Utf8JsonReader reader, ReadOnlySpan other) + { + var localSequence = reader.ValueSequence; + if (localSequence.Length != other.Length) + { + return false; + } + + var matchedSoFar = 0; + + foreach (var memory in localSequence) + { + var span = memory.Span; + + if (other[matchedSoFar..].StartsWith(span)) + { + matchedSoFar += span.Length; + } + else + { + return false; + } + } + + return true; + } + } + + #endregion General Purpose + + #region Default Generic Read Methods + + /// + /// Reads a value from a given instance using the default for the + /// type . + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// The value read from the instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T? ReadValue(this ref Utf8JsonReader reader, JsonSerializerOptions options) + { + var converter = options.GetConverter(null); + + if ((reader.TokenType is JsonTokenType.Null) && !converter.HandleNull) + { + return default; + } + + return converter.Read(ref reader, typeof(T), options); + } + + /// + /// Reads a value from a given instance using a specific that is + /// retrieved from the based on . + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// + /// The marker type that is used to retrieve a specific from the given . + /// + /// The value read from the instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T? ReadValueEx(this ref Utf8JsonReader reader, JsonSerializerOptions options, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type markerType) + { + var converter = options.GetConverter(markerType); + + if ((reader.TokenType is JsonTokenType.Null) && !converter.HandleNull) + { + return default; + } + + return converter.Read(ref reader, typeof(T), options); + } + + /// + /// Reads a property name value from a given instance using the default + /// for the type . + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// The property name value read from the instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T ReadPropertyName(this ref Utf8JsonReader reader, JsonSerializerOptions options) + { + Debug.Assert(reader.TokenType is JsonTokenType.PropertyName); + + if (typeof(T) == typeof(string)) + { + return (T)(object)reader.GetString()!; + } + + return options.GetConverter(null).ReadAsPropertyName(ref reader, typeof(T), options); + } + + /// + /// Reads a property name value from a given instance using a specific + /// that is retrieved from the based on . + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// + /// The marker type that is used to retrieve a specific from the given . + /// + /// The property name value read from the instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T ReadPropertyNameEx(this ref Utf8JsonReader reader, JsonSerializerOptions options, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type markerType) + { + Debug.Assert(reader.TokenType is JsonTokenType.PropertyName); + + return options.GetConverter(markerType).ReadAsPropertyName(ref reader, typeof(T), options); + } + + #endregion Default Generic Read Methods + + #region Delegate Based Read Methods + + /// + /// Reads a value from a given instance using a custom delegate. + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the value, or to use + /// the default converter for the type . + /// + /// The value read from the instance. + /// + /// This overload provides a streamlined entry-point for reading arbitrary values when using custom read delegates. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T? ReadValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readValue) + { + if (readValue is null) + { + return reader.ReadValue(options); + } + + return readValue(ref reader, options); + } + + /// + /// Reads a property name value from a given instance using a custom + /// delegate. + /// + /// The type of the value to read. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the property name value, or + /// to use the default converter for the type . + /// + /// The property name value read from the instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T? ReadPropertyName(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readValue) + { + if (readValue is null) + { + return reader.ReadPropertyName(options); + } + + return readValue(ref reader, options); + } + + /// + /// Reads a collection value from a given instance. + /// + /// The type of the items in the collection. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the collection items, or to use + /// the default converter for the item type . + /// + /// An instance of , or . + public static List? ReadCollectionValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readElement) + { + if (reader.TokenType is JsonTokenType.Null) + { + return null; + } + + reader.ValidateToken(JsonTokenType.StartArray); + + readElement ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + var result = new List(); + + while (reader.Read() && (reader.TokenType is not JsonTokenType.EndArray)) + { + result.Add(readElement(ref reader, options)); + } + + return result; + } + + /// + /// Reads a dictionary value from a given instance. + /// + /// The type of the keys in the dictionary. + /// The type of the values in the dictionary. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the dictionary key, or to use + /// the default converter for the type . + /// + /// /// + /// The delegate that should be called to read the dictionary values, or to use + /// the default converter for the type . + /// + /// An instance of , or . + /// If any dictionary key value is . + public static Dictionary? ReadDictionaryValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readKey, JsonReadFunc? readValue) + where TKey : notnull + { + if (reader.TokenType is JsonTokenType.Null) + { + return null; + } + + reader.ValidateToken(JsonTokenType.StartObject); + + readKey ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadPropertyName(ref r, o); + readValue ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + var result = new Dictionary(); + + while (reader.Read() && (reader.TokenType is not JsonTokenType.EndObject)) + { + var key = readKey(ref reader, options); + reader.Read(); + var value = readValue(ref reader, options); + + result[key] = value; + } + + return result; + } + + /// + /// Reads a value from a given instance. + /// + /// The type of the key. + /// The type of the value. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the key, or to use the default + /// converter for the type . + /// + /// /// + /// The delegate that should be called to read the value, or to use the default + /// converter for the type . + /// + /// An instance of . + public static KeyValuePair ReadKeyValuePairValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readKey, JsonReadFunc? readValue) + where TKey : notnull + { + if (reader.TokenType is JsonTokenType.Null) + { + throw new JsonException("JSON key-value pair must not be 'null'."); + } + + reader.ValidateToken(JsonTokenType.StartObject); + + readKey ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadPropertyName(ref r, o); + readValue ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + KeyValuePair result = default; + while (reader.Read() && (reader.TokenType is not JsonTokenType.EndObject)) + { + var key = readKey(ref reader, options); + reader.Read(); + var value = readValue(ref reader, options); + + result = new KeyValuePair(key, value); + } + + return result; + } + + /// + /// Reads an inline union value from a given instance. + /// + /// The first union type. + /// The second union type. + /// A reference to the . + /// The to use. + /// A function that selects the union variant (e.g. based on the current JSON token type). + /// + /// The delegate that should be called to read the first union variant type, or + /// to use the default converter for the type . + /// + /// + /// The delegate that should be called to read the second union variant type, or + /// to use the default converter for the type . + /// + /// An instance of , or . + /// If no matching union variant could be selected. + public static Union? ReadUnionValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonUnionSelectorFunc selector, JsonReadFunc? readType1, JsonReadFunc? readType2) + { + if (reader.TokenType is JsonTokenType.Null) + { + // TODO: We might want the selector to handle 'null'. + return null; + } + + return selector(ref reader, options) switch + { + UnionTag.T1 => (readType1 ?? (static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o))).Invoke(ref reader, options), + UnionTag.T2 => (readType2 ?? (static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o))).Invoke(ref reader, options), + _ => throw new InvalidOperationException($"Failed to select an union variant for union of type '{typeof(T1).Name}' or '{typeof(T2).Name}'.") + }; + } + + #region Specialized Read Methods + + /// + /// Reads a single item or collection value from a given instance. + /// + /// The type of the items in the collection. + /// A reference to the instance. + /// The to use. + /// + /// The delegate that should be called to read the collection items, or to use + /// the default converter for the item type . + /// + /// An instance of , or . + public static List? ReadSingleOrManyCollectionValue(this ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readElement) + { + if (reader.TokenType is JsonTokenType.Null) + { + return null; + } + + readElement ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + if (reader.TokenType is not JsonTokenType.StartArray) + { + return [readElement(ref reader, options)]; + } + + var result = new List(); + + while (reader.Read() && (reader.TokenType is not JsonTokenType.EndArray)) + { + result.Add(readElement(ref reader, options)); + } + + return result; + } + + // TODO: For 'object' or 'object | object[]' (single or many) shortcut properties: + // => we assume the canonical representation to be used most of the time + + #endregion Specialized Read Methods + + #endregion Delegate Based Read Methods + + #region Property Read Methods + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ReadProperty(this ref Utf8JsonReader reader, JsonSerializerOptions options, + [DisallowNull] out TName name, out TValue? value) + { + name = reader.ReadPropertyName(options); + reader.Read(); + value = reader.ReadValue(options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ReadProperty(this ref Utf8JsonReader reader, JsonSerializerOptions options, + [DisallowNull] out TName name, out TValue? value, + JsonReadFunc? readName, JsonReadFunc? readValue) + { + readName ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadPropertyName(ref r, o); + readValue ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + name = readName(ref reader, options) ?? throw new InvalidOperationException("JSON property name must not be 'null'."); + reader.Read(); + value = readValue(ref reader, options); + } + + /// + /// Checks, if the current property name token is equal to the given and proceeds to read + /// the corresponding value if the condition was met. + /// + /// The type of the value to read. + /// A reference to the . + /// The to use. + /// The property name to match. + /// Receives the deserialized value. + /// The delegate used to read the value. + /// if the value has been read or , if the property name did not match. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadProperty(this ref Utf8JsonReader reader, JsonSerializerOptions options, JsonEncodedText name, + ref T? value, JsonReadFunc? readValue) + { + Debug.Assert(reader.TokenType is JsonTokenType.PropertyName); + + if (!reader.ValueTextEquals(name)) + { + return false; + } + + readValue ??= static (ref Utf8JsonReader r, JsonSerializerOptions o) => ReadValue(ref r, o); + + reader.Read(); + value = readValue.Invoke(ref reader, options); + + return true; + } + + #endregion Property Read Methods +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonSerializerOptionsExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonSerializerOptionsExtensions.cs new file mode 100644 index 00000000000..a32fcc29962 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonSerializerOptionsExtensions.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +using System.Runtime.CompilerServices; + +using System.Text.Json.Serialization; +using System.Text.Json; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal static partial class JsonSerializerOptionsExtensions +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static JsonConverter GetConverter(this JsonSerializerOptions options, Type? markerType) + { + // Mimics the internal behavior of `JsonSerializer.Serialize()` and as well seems to be required in order + // to directly use converters like we do. + // When getting a default generic converter from `JsonSerializerOptions` that are not read-only, a + // `NotSupportedException` is thrown as soon as we call `converter.Read()` or `converter.Write()`. + options.MakeReadOnly(true); + +#pragma warning disable IL2026, IL3050 + var rawConverter = options.GetConverter(markerType ?? typeof(T)); +#pragma warning restore IL2026, IL3050 + + var converter = (JsonConverter)(rawConverter is IMarkerTypeConverter markerTypeConverter + ? markerTypeConverter.WrappedConverter + : rawConverter); + + return converter; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TContext GetContext(this JsonSerializerOptions options) + { + return ContextProvider.GetContext(options); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonUnionSelector.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonUnionSelector.cs new file mode 100644 index 00000000000..c26a4d51ed1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonUnionSelector.cs @@ -0,0 +1,98 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text.Json; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// A delegate that selects a union variant (e.g. based on the current JSON token type). +/// +/// A reference to a instance. +/// The to use. +/// The selected value. +/// +/// IMPORTANT: +/// The is passed by reference for best performance. If the selector function +/// implementation needs to advance the reader position, it must always operate on a copy of the original +/// or restore the reader state before returning. +/// +internal delegate UnionTag JsonUnionSelectorFunc(ref Utf8JsonReader reader, JsonSerializerOptions options); + +[Flags] +internal enum JsonTokenTypes +{ + None = 0, + StartObject = 1 << JsonTokenType.StartObject, + EndObject = 1 << JsonTokenType.EndObject, + StartArray = 1 << JsonTokenType.StartArray, + EndArray = 1 << JsonTokenType.EndArray, + String = 1 << JsonTokenType.String | 1 << JsonTokenType.PropertyName, + Number = 1 << JsonTokenType.Number, + True = 1 << JsonTokenType.True, + False = 1 << JsonTokenType.False +} + +internal static class JsonUnionSelector +{ + public static UnionTag ByTokenType(ref Utf8JsonReader reader, JsonSerializerOptions options, JsonTokenTypes first, JsonTokenTypes second) + { + _ = reader; + _ = options; + + if (((int)first & (1 << (int)reader.TokenType)) is not 0) + { + return UnionTag.T1; + } + + if (((int)second & (1 << (int)reader.TokenType)) is not 0) + { + return UnionTag.T2; + } + + return UnionTag.None; + } + + public static UnionTag ByPropertyOfT1(ref Utf8JsonReader reader, JsonSerializerOptions options, string name) + { + reader.ValidateToken(JsonTokenType.StartObject); + + var internalReader = reader; + + while (internalReader.Read() && (internalReader.TokenType is JsonTokenType.PropertyName)) + { + if (internalReader.ValueTextEquals(name)) + { + return UnionTag.T1; + } + + internalReader.Read(); + internalReader.Skip(); + } + + return UnionTag.T2; + } + + public static UnionTag ByPropertyOfT2(ref Utf8JsonReader reader, JsonSerializerOptions options, string name) + { + reader.ValidateToken(JsonTokenType.StartObject); + + var internalReader = reader; + + while (internalReader.Read() && (internalReader.TokenType is JsonTokenType.PropertyName)) + { + if (internalReader.ValueTextEquals(name)) + { + return UnionTag.T2; + } + + internalReader.Read(); + internalReader.Skip(); + } + + return UnionTag.T1; + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonWriterExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonWriterExtensions.cs new file mode 100644 index 00000000000..2e2f7ced77d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/JsonWriterExtensions.cs @@ -0,0 +1,356 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// A delegate that writes a value to a given instance. +/// +/// The type of the value to write. +/// The . +/// The to use. +/// The value to write. +internal delegate void JsonWriteFunc(Utf8JsonWriter writer, JsonSerializerOptions options, T? value); + +// NOTE: +// The marker type concept allows us to use specialized converters on a per-property basis in custom converters. +// This basically emulates using the '[JsonConverter({ConverterType})]' attribute on property level. + +// NOTE: +// We make use of '[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]' for +// marker type parameters. +// The marker types are not actually constructed at any time, but this tricks the trimmer into checking the static +// constructor of all marker types. We use the static constructor to root the corresponding marker type converters, +// if the marker type has generic type arguments. + +internal static class JsonWriterExtensions +{ + #region Default Generic Write Methods + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteValue(this Utf8JsonWriter writer, JsonSerializerOptions options, T? value) + { + var converter = options.GetConverter(null); + + if ((value is null) && !converter.HandleNull) + { + writer.WriteNullValue(); + return; + } + + converter.Write(writer, value, options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteValue(this Utf8JsonWriter writer, JsonSerializerOptions options, T? value) + where T : struct + { + var converter = options.GetConverter(null); + + if (value is null) + { + writer.WriteNullValue(); + return; + } + + converter.Write(writer, value!.Value, options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteValueEx(this Utf8JsonWriter writer, JsonSerializerOptions options, T? value, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type markerType) + { + var converter = options.GetConverter(markerType); + + if ((value is null) && !converter.HandleNull) + { + writer.WriteNullValue(); + return; + } + + converter.Write(writer, value, options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteValueEx(this Utf8JsonWriter writer, JsonSerializerOptions options, T? value, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type markerType) + where T : struct + { + var converter = options.GetConverter(markerType); + + if (value is null) + { + writer.WriteNullValue(); + return; + } + + converter.Write(writer, value.Value, options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WritePropertyName(this Utf8JsonWriter writer, JsonSerializerOptions options, [DisallowNull] T name) + { + if (typeof(T) == typeof(string)) + { + writer.WritePropertyName((string)(object)name); + return; + } + + if (typeof(T) == typeof(JsonEncodedText)) + { + writer.WritePropertyName(Unsafe.As(ref name)); + return; + } + + options.GetConverter(null).WriteAsPropertyName(writer, name, options); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WritePropertyNameEx(this Utf8JsonWriter writer, JsonSerializerOptions options, [DisallowNull] T name, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type markerType) + { + options.GetConverter(markerType).WriteAsPropertyName(writer, name, options); + } + + #endregion Default Generic Write Methods + + #region Delegate Based Write Methods + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteValue(this Utf8JsonWriter writer, JsonSerializerOptions options, T? value, + JsonWriteFunc? writeValue) + { + if (writeValue is null) + { + writer.WriteValue(options, value); + return; + } + + writeValue(writer, options, value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WritePropertyName(this Utf8JsonWriter writer, JsonSerializerOptions options, [DisallowNull] T name, + JsonWriteFunc? writeValue) + { + if (writeValue is null) + { + writer.WritePropertyName(options, name); + return; + } + + writeValue(writer, options, name); + } + + public static void WriteCollectionValue(this Utf8JsonWriter writer, JsonSerializerOptions options, IEnumerable? collection, + JsonWriteFunc? writeElement) + { + if (collection is null) + { + writer.WriteNullValue(); + return; + } + + writeElement ??= static (w, o, v) => WriteValue(w, o, v); + + writer.WriteStartArray(); + + foreach (var element in collection) + { + writeElement(writer, options, element); + } + + writer.WriteEndArray(); + } + + public static void WriteDictionaryValue(this Utf8JsonWriter writer, JsonSerializerOptions options, + IEnumerable>? dictionary, + JsonWriteFunc? writeKey, JsonWriteFunc? writeValue) + where TKey : notnull + { + if (dictionary is null) + { + writer.WriteNullValue(); + return; + } + + writeKey ??= static (w, o, v) => WritePropertyName(w, o, v!); + writeValue ??= static (w, o, v) => WriteValue(w, o, v); + + writer.WriteStartObject(); + + foreach (var pair in dictionary) + { + writeKey(writer, options, pair.Key); + writeValue(writer, options, pair.Value); + } + + writer.WriteEndObject(); + } + + public static void WriteKeyValuePairValue(this Utf8JsonWriter writer, JsonSerializerOptions options, + KeyValuePair value, + JsonWriteFunc? writeKey, JsonWriteFunc? writeValue) + where TKey : notnull + { + writeKey ??= static (w, o, v) => WritePropertyName(w, o, v!); + writeValue ??= static (w, o, v) => WriteValue(w, o, v); + + writer.WriteStartObject(); + writeKey(writer, options, value.Key); + writeValue(writer, options, value.Value); + writer.WriteEndObject(); + } + + public static void WriteKeyValuePairValue(this Utf8JsonWriter writer, JsonSerializerOptions options, + KeyValuePair? value, + JsonWriteFunc? writeKey, JsonWriteFunc? writeValue) + where TKey : notnull + { + if (value is null) + { + writer.WriteNullValue(); + return; + } + + writeKey ??= static (w, o, v) => WritePropertyName(w, o, v!); + writeValue ??= static (w, o, v) => WriteValue(w, o, v); + + writer.WriteStartObject(); + writeKey(writer, options, value.Value.Key); + writeValue(writer, options, value.Value.Value); + writer.WriteEndObject(); + } + + public static void WriteUnionValue(this Utf8JsonWriter writer, JsonSerializerOptions options, + Union? union, + JsonWriteFunc? writeType1, JsonWriteFunc? writeType2) + { + if (union is null) + { + writer.WriteNullValue(); + return; + } + + union.Match( + value => (writeType1 ?? (static (w, o, v) => WriteValue(w, o, v))).Invoke(writer, options, value), + value => (writeType2 ?? (static (w, o, v) => WriteValue(w, o, v))).Invoke(writer, options, value) + ); + } + + #endregion Delegate Based Write Methods + + #region Specialized Write Methods + + public static void WriteSingleOrManyCollectionValue(this Utf8JsonWriter writer, JsonSerializerOptions options, + IEnumerable? collection, + JsonWriteFunc? writeElement) + { + writeElement ??= static (w, o, v) => WriteValue(w, o, v); + + switch (collection) + { + case null: + writer.WriteNullValue(); + return; + + case IList and [{ } item]: + writeElement(writer, options, item); + return; + + case IReadOnlyList and [{ } item]: + writeElement(writer, options, item); + return; + + case ICollection { Count: 1 }: + writeElement(writer, options, collection.First()); + return; + + case IReadOnlyCollection { Count: 1 }: + writeElement(writer, options, collection.First()); + return; + } + + var value = collection.ToArray(); + if (value.Length is 1) + { + writeElement(writer, options, value.First()); + return; + } + + writer.WriteStartArray(); + + foreach (var element in value) + { + writeElement(writer, options, element); + } + + writer.WriteEndArray(); + } + + #endregion Specialized Write Methods + + #region Property Write Methods + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteProperty(this Utf8JsonWriter writer, JsonSerializerOptions options, + [DisallowNull] TName name, TValue value, + JsonIgnoreCondition? ignoreCondition = null) + { + var shouldIgnore = (ignoreCondition ?? options.DefaultIgnoreCondition) switch + { + JsonIgnoreCondition.Never => false, + JsonIgnoreCondition.Always => true, + JsonIgnoreCondition.WhenWritingDefault => EqualityComparer.Default.Equals(value, default), + JsonIgnoreCondition.WhenWritingNull => (value is null), + _ => throw new NotSupportedException("Unsupported JSON ignore condition.") + }; + + if (shouldIgnore) + { + return; + } + + writer.WritePropertyName(options, name); + writer.WriteValue(options, value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteProperty(this Utf8JsonWriter writer, JsonSerializerOptions options, + [DisallowNull] TName name, TValue value, + JsonWriteFunc? writeName, JsonWriteFunc? writeValue, + JsonIgnoreCondition? ignoreCondition = null) + { + var shouldIgnore = (ignoreCondition ?? options.DefaultIgnoreCondition) switch + { + JsonIgnoreCondition.Never => false, + JsonIgnoreCondition.Always => true, + JsonIgnoreCondition.WhenWritingDefault => EqualityComparer.Default.Equals(value, default), + JsonIgnoreCondition.WhenWritingNull => (value is null), + _ => throw new NotSupportedException("Unsupported JSON ignore condition.") + }; + + if (shouldIgnore) + { + return; + } + + writeName ??= static (w, o, v) => WritePropertyName(w, o, v!); + writeValue ??= static (w, o, v) => WriteValue(w, o, v); + + writeName(writer, options, name); + writeValue(writer, options, value); + } + + #endregion Property Write Methods +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/LocalJsonValue.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/LocalJsonValue.cs new file mode 100644 index 00000000000..3e5f701265f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/LocalJsonValue.cs @@ -0,0 +1,40 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; +using System.Text.Json; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal ref struct LocalJsonValue +{ + public T? Value; + public bool Initialized; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryReadProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, JsonEncodedText name, + JsonReadFunc? readValue) + { + var success = reader.TryReadProperty(options, name, ref Value, readValue); + Initialized |= success; + + return success; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void ReadValue(ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readValue) + { + Initialized = true; + Value = reader.ReadValue(options, readValue); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void ReadPropertyName(ref Utf8JsonReader reader, JsonSerializerOptions options, + JsonReadFunc? readValue) + { + Initialized = true; + Value = reader.ReadPropertyName(options, readValue); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ObjectToInferredTypesConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/ObjectToInferredTypesConverter.cs similarity index 59% rename from src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ObjectToInferredTypesConverter.cs rename to src/Elastic.Clients.Elasticsearch/_Shared/Next/ObjectToInferredTypesConverter.cs index 632b79272cb..0a0c0f7dd0a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ObjectToInferredTypesConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/ObjectToInferredTypesConverter.cs @@ -8,12 +8,12 @@ namespace Elastic.Clients.Elasticsearch.Serialization; -internal sealed class ObjectToInferredTypesConverter : JsonConverter +internal sealed class ObjectToInferredTypesConverter : + JsonConverter { - public override object Read( - ref Utf8JsonReader reader, - Type typeToConvert, - JsonSerializerOptions options) => reader.TokenType switch + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch { JsonTokenType.True => true, JsonTokenType.False => false, @@ -24,10 +24,14 @@ JsonTokenType.String when reader.TryGetDateTimeOffset(out var value) => value, JsonTokenType.String => reader.GetString()!, _ => JsonDocument.ParseValue(ref reader).RootElement.Clone() }; + } - public override void Write( - Utf8JsonWriter writer, - object objectToWrite, - JsonSerializerOptions options) => - JsonSerializer.Serialize(writer, objectToWrite, objectToWrite.GetType(), options); + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) + { + // TODO: Match `SourceMarker` values and delegate to the `SourceSerializer`. + +#pragma warning disable IL2026, IL3050 + JsonSerializer.Serialize(writer, value, value.GetType(), options); +#pragma warning restore IL2026, IL3050 + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/RequestResponseConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/RequestResponseConverter.cs new file mode 100644 index 00000000000..23f73518d47 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/RequestResponseConverter.cs @@ -0,0 +1,29 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Transport.Extensions; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +public sealed class RequestResponseConverter : + JsonConverter +{ + public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var settings = options.GetContext(); + + return settings.RequestResponseSerializer.Deserialize(ref reader); + } + + public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) + { + var settings = options.GetContext(); + + settings.RequestResponseSerializer.Serialize(value, writer); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/SingleWithFractionalPortionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/SingleWithFractionalPortionConverter.cs new file mode 100644 index 00000000000..2c0e0d225f7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/SingleWithFractionalPortionConverter.cs @@ -0,0 +1,107 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Buffers; +using System.Buffers.Text; +using System.Diagnostics; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal sealed class SingleWithFractionalPortionConverter : + JsonConverter +{ + // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs#L79 + public const int MaximumFormatLength = 128 + 2; + + private static readonly StandardFormat DefaultFormat = StandardFormat.Parse("G9"); + private static readonly JsonEncodedText NaN = JsonEncodedText.Encode("NaN"u8); + private static readonly JsonEncodedText PositiveInfinity = JsonEncodedText.Encode("Infinity"u8); + private static readonly JsonEncodedText NegativeInfinity = JsonEncodedText.Encode("-Infinity"u8); + + public static ReadOnlySpan NonIntegerChars => "E."u8; + + public override float Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType is not JsonTokenType.String) + { + return reader.GetSingle(); + } + + if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) + { + if (reader.ValueTextEquals(NaN)) + { + return float.NaN; + } + + if (reader.ValueTextEquals(PositiveInfinity)) + { + return float.PositiveInfinity; + } + + if (reader.ValueTextEquals(NegativeInfinity)) + { + return float.NegativeInfinity; + } + } + + if (!options.NumberHandling.HasFlag(JsonNumberHandling.AllowReadingFromString)) + { + return reader.GetSingle(); + } + + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out float result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException("Unable to convert JSON string value to 'float'."); + } + + public override void Write(Utf8JsonWriter writer, float value, JsonSerializerOptions options) + { + if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) + { + if (float.IsNaN(value)) + { + writer.WriteStringValue(NaN); + return; + } + + if (float.IsPositiveInfinity(value)) + { + writer.WriteStringValue(PositiveInfinity); + return; + } + + if (float.IsNegativeInfinity(value)) + { + writer.WriteStringValue(NegativeInfinity); + return; + } + } + + if (options.NumberHandling.HasFlag(JsonNumberHandling.WriteAsString)) + { + throw new NotImplementedException("'JsonNumberHandling.WriteAsString' is currently not supported."); + } + + Span buffer = stackalloc byte[MaximumFormatLength]; + + if (!Utf8Formatter.TryFormat(value, buffer, out var bytesWritten, DefaultFormat)) + { + throw new JsonException($"Could not convert value '{value}' to JSON number."); + } + + if (buffer.IndexOfAny(NonIntegerChars) == -1) + { + buffer[bytesWritten++] = (byte)'.'; + buffer[bytesWritten++] = (byte)'0'; + } + + writer.WriteRawValue(buffer[..bytesWritten], true); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/SourceConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/SourceConverter.cs new file mode 100644 index 00000000000..f52b062454f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/SourceConverter.cs @@ -0,0 +1,91 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Reflection; +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Transport.Extensions; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +public sealed class SourceMarker +{ + static SourceMarker() + { + DynamicallyAccessed.PublicConstructors(typeof(SourceMarkerConverter)); + } +} + +internal sealed class SourceMarkerConverter : + JsonConverter>, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public SourceMarkerConverter(IElasticsearchClientSettings settings) + { + WrappedConverter = new SourceConverter(settings); + } + + public override SourceMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, SourceMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class SourceMarkerConverterFactory(IElasticsearchClientSettings settings) : + JsonConverterFactory +{ + public override bool CanConvert(Type typeToConvert) + { + return typeToConvert.IsGenericType && + typeToConvert.GetGenericTypeDefinition() == typeof(SourceMarker<>); + } + + public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) + { + var args = typeToConvert.GetGenericArguments(); + +#pragma warning disable IL3050 // SourceMarker static constructor roots SourceMarkerConverter. + + var converter = (JsonConverter)Activator.CreateInstance( + typeof(SourceMarkerConverter<>).MakeGenericType(args[0]), + BindingFlags.Instance | BindingFlags.Public, + binder: null, + args: [settings], + culture: null)!; + +#pragma warning restore IL3050 + + return converter; + } +} + +internal sealed class SourceConverter : + JsonConverter +{ + private readonly IElasticsearchClientSettings _settings; + + public SourceConverter(IElasticsearchClientSettings settings) + { + _settings = settings; + } + + public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return _settings.SourceSerializer.Deserialize(ref reader); + } + + public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) + { + _settings.SourceSerializer.Serialize(value, writer); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/StringifiedConverters.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/StringifiedConverters.cs new file mode 100644 index 00000000000..9838571de76 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/StringifiedConverters.cs @@ -0,0 +1,158 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Buffers.Text; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +internal sealed class StringifiedBoolConverter : + JsonConverter +{ + public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.True => true, + JsonTokenType.False => false, + _ => throw new JsonException($"Expected JSON '{nameof(JsonTokenType.True)}' or '{JsonTokenType.False}' or '{JsonTokenType.String}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) + { + writer.WriteBooleanValue(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static bool ParseValue(ref Utf8JsonReader reader) + { + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out bool result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(Boolean)}'."); + } +} + +internal sealed class StringifiedIntConverter : + JsonConverter +{ + public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.Number => reader.GetInt32(), + _ => throw new JsonException($"Expected JSON '{nameof(JsonTokenType.Number)}' or '{JsonTokenType.String}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static int ParseValue(ref Utf8JsonReader reader) + { + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out int result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(Int32)}'."); + } +} + +internal sealed class StringifiedLongConverter : + JsonConverter +{ + public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.Number => reader.GetInt64(), + _ => throw new JsonException($"Expected JSON '{nameof(JsonTokenType.Number)}' or '{JsonTokenType.String}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static long ParseValue(ref Utf8JsonReader reader) + { + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out long result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(Int64)}'."); + } +} + +internal sealed class StringifiedSingleConverter : + JsonConverter +{ + public override float Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.Number => reader.GetSingle(), + _ => throw new JsonException($"Expected JSON '{nameof(JsonTokenType.Number)}' or '{JsonTokenType.String}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, float value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static float ParseValue(ref Utf8JsonReader reader) + { + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out float result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(Single)}'."); + } +} + +internal sealed class StringifiedDoubleConverter : + JsonConverter +{ + public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => ParseValue(ref reader), + JsonTokenType.Number => reader.GetDouble(), + _ => throw new JsonException($"Expected JSON '{nameof(JsonTokenType.Number)}' or '{JsonTokenType.String}' token, but got '{reader.TokenType}'.") + }; + } + + public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static double ParseValue(ref Utf8JsonReader reader) + { + Debug.Assert(!reader.HasValueSequence); + + return Utf8Parser.TryParse(reader.ValueSpan, out double result, out var consumed) && (consumed == reader.ValueSpan.Length) + ? result + : throw new JsonException($"Unable to convert JSON string value '{reader.GetString()!}' to '{nameof(Double)}'."); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanConverters.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanConverters.cs new file mode 100644 index 00000000000..5795fbbfb0d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanConverters.cs @@ -0,0 +1,271 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Buffers.Text; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Transport.Extensions; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +#region TimeSpanSeconds + +internal sealed class TimeSpanSecondsMarker; + +internal sealed class TimeSpanSecondsMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public TimeSpanSecondsMarkerConverter() + { + WrappedConverter = new TimeSpanSecondsConverter(); + } + + public override TimeSpanSecondsMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, TimeSpanSecondsMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class TimeSpanSecondsConverter : + JsonConverter +{ + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long value, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return TimeSpan.FromSeconds(value); + } + + reader.ValidateToken(JsonTokenType.Number); + + return TimeSpan.FromSeconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value.Seconds); + } +} + +#endregion TimeSpanSeconds + +#region TimeSpanMillis + +internal sealed class TimeSpanMillisMarker; + +internal sealed class TimeSpanMillisMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public TimeSpanMillisMarkerConverter() + { + WrappedConverter = new TimeSpanMillisConverter(); + } + + public override TimeSpanMillisMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, TimeSpanMillisMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class TimeSpanMillisConverter : + JsonConverter +{ + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long value, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return TimeSpan.FromMilliseconds(value); + } + + reader.ValidateToken(JsonTokenType.Number); + + return TimeSpan.FromMilliseconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value.Milliseconds); + } +} + +#endregion TimeSpanMillis + +#region TimeSpanNanos + +internal sealed class TimeSpanNanosMarker; + +internal sealed class TimeSpanNanosMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public TimeSpanNanosMarkerConverter() + { + WrappedConverter = new TimeSpanNanosConverter(); + } + + public override TimeSpanNanosMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, TimeSpanNanosMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class TimeSpanNanosConverter : + JsonConverter +{ + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out long value, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return TimeSpanHelper.FromNanoseconds(value); + } + + reader.ValidateToken(JsonTokenType.Number); + + return TimeSpanHelper.FromNanoseconds(reader.GetInt64()); + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteNumberValue(TimeSpanHelper.ToNanoseconds(value)); + } +} + +#endregion TimeSpanNanos + +#region TimeSpanSecondsFloat + +internal sealed class TimeSpanSecondsFloatMarker; + +internal sealed class TimeSpanSecondsFloatMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public TimeSpanSecondsFloatMarkerConverter() + { + WrappedConverter = new TimeSpanSecondsFloatConverter(); + } + + public override TimeSpanSecondsFloatMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, TimeSpanSecondsFloatMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class TimeSpanSecondsFloatConverter : + JsonConverter +{ + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out double value, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return TimeSpan.FromSeconds(value); + } + + reader.ValidateToken(JsonTokenType.Number); + + return TimeSpan.FromSeconds(reader.GetDouble()); + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value.TotalSeconds); + } +} + +#endregion TimeSpanSecondsFloat + +#region TimeSpanMillisFloat + +internal sealed class TimeSpanMillisFloatMarker; + +internal sealed class TimeSpanMillisFloatMarkerConverter : + JsonConverter, + IMarkerTypeConverter +{ + public JsonConverter WrappedConverter { get; } + + public TimeSpanMillisFloatMarkerConverter() + { + WrappedConverter = new TimeSpanMillisFloatConverter(); + } + + public override TimeSpanMillisFloatMarker Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, TimeSpanMillisFloatMarker value, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } +} + +internal sealed class TimeSpanMillisFloatConverter : + JsonConverter +{ + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if ((reader.TokenType is JsonTokenType.String) && Utf8Parser.TryParse(reader.ValueSpan, out double value, out var consumed) && + (consumed == reader.ValueSpan.Length)) + { + // Leniency for stringified numbers. + return TimeSpan.FromMilliseconds(value); + } + + reader.ValidateToken(JsonTokenType.Number); + + return TimeSpan.FromMilliseconds(reader.GetDouble()); + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value.TotalMilliseconds); + } +} + +#endregion TimeSpanMillisFloat diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanHelper.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanHelper.cs new file mode 100644 index 00000000000..f96f09c1c9e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Next/TimeSpanHelper.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +public static class TimeSpanHelper +{ + // 1 Tick = 100 nanoseconds + private const long NanosecondsPerTick = 100; + + /// + /// Converts nanoseconds to a value. + /// + /// The number of nanoseconds. + /// A representing the specified duration. + /// + /// Thrown when the nanoseconds value would result in a outside the valid range. + /// + public static TimeSpan FromNanoseconds(long nanoseconds) + { + try + { + // Convert nanoseconds to ticks (1 tick = 100 nanoseconds). + var ticks = nanoseconds / NanosecondsPerTick; + + // Handle remainder for higher precision. + var remainderNanoseconds = nanoseconds % NanosecondsPerTick; + if (remainderNanoseconds >= NanosecondsPerTick / 2) + { + ticks++; + } + + return new TimeSpan(ticks); + } + catch (ArgumentOutOfRangeException ex) + { + throw new ArgumentOutOfRangeException( + $"The nanoseconds value {nanoseconds} is outside the range of valid {nameof(TimeSpan)} values.", ex); + } + } + + /// + /// Converts a to nanoseconds. + /// + /// The value to convert. + /// The equivalent number of nanoseconds. + public static long ToNanoseconds(TimeSpan timeSpan) + { + return timeSpan.Ticks * NanosecondsPerTick; + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultRequestResponseSerializer.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultRequestResponseSerializer.cs index c0e8bfef918..bef7a01b64b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultRequestResponseSerializer.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultRequestResponseSerializer.cs @@ -2,10 +2,12 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; using System.Threading; using System.Threading.Tasks; @@ -20,16 +22,10 @@ internal sealed class DefaultRequestResponseSerializer : SystemTextJsonSerialize { private readonly IElasticsearchClientSettings _settings; -#if !NET8_0_OR_GREATER - private readonly object _lock = new(); -#endif - public DefaultRequestResponseSerializer(IElasticsearchClientSettings settings) : base(new DefaultRequestResponseSerializerOptionsProvider(settings)) { _settings = settings; - - LinkSettings(settings); } public override void Serialize(T data, Stream writableStream, @@ -49,37 +45,50 @@ public override Task SerializeAsync(T data, Stream stream, CancellationToken cancellationToken = default) { if (data is IStreamSerializable streamSerializable) + { return streamSerializable.SerializeAsync(stream, _settings, SerializationFormatting.None); + } return base.SerializeAsync(data, stream, formatting, cancellationToken); } - /// - /// Links the of this serializer to the given . - /// - private void LinkSettings(IElasticsearchClientSettings settings) + public override T Deserialize(Stream stream) + { + if (typeof(IStreamSerializable).IsAssignableFrom(typeof(T))) + { + } + + return base.Deserialize(stream); + } + + public override object? Deserialize(Type type, Stream stream) + { + if (typeof(IStreamSerializable).IsAssignableFrom(type)) + { + } + + return base.Deserialize(type, stream); + } + + public override ValueTask DeserializeAsync(Stream stream, CancellationToken cancellationToken = new CancellationToken()) + { + if (typeof(IStreamSerializable).IsAssignableFrom(typeof(T))) + { + } + + return base.DeserializeAsync(stream, cancellationToken); + } + + public override ValueTask DeserializeAsync(Type type, Stream stream, CancellationToken cancellationToken = new CancellationToken()) { - var options = GetJsonSerializerOptions(SerializationFormatting.None); - var indentedOptions = GetJsonSerializerOptions(SerializationFormatting.Indented); - -#if NET8_0_OR_GREATER - ElasticsearchClient.SettingsTable.TryAdd(options, settings); - ElasticsearchClient.SettingsTable.TryAdd(indentedOptions, settings); -#else - lock (_lock) + if (typeof(IStreamSerializable).IsAssignableFrom(type)) { - if (!ElasticsearchClient.SettingsTable.TryGetValue(options, out _)) - { - ElasticsearchClient.SettingsTable.Add(options, settings); - } - - if (!ElasticsearchClient.SettingsTable.TryGetValue(indentedOptions, out _)) - { - ElasticsearchClient.SettingsTable.Add(indentedOptions, settings); - } } -#endif + + return base.DeserializeAsync(type, stream, cancellationToken); } + + protected override bool SupportsFastPath(Type type) => !typeof(IStreamSerializable).IsAssignableFrom(type); } /// @@ -95,26 +104,40 @@ internal DefaultRequestResponseSerializerOptionsProvider(IElasticsearchClientSet private static IReadOnlyCollection CreateDefaultBuiltInConverters(IElasticsearchClientSettings settings) => [ - new KeyValuePairConverterFactory(settings), + // For context aware JsonConverter/JsonConverterFactory implementations. + new ContextProvider(settings), + new ObjectToInferredTypesConverter(), - new SourceConverterFactory(settings), - new SelfSerializableConverterFactory(settings), - new SelfDeserializableConverterFactory(settings), - new SelfTwoWaySerializableConverterFactory(settings), - // Explicitly registered before `IsADictionaryConverterFactory` as we want this specialised converter to match + + // Marker types + new SourceMarkerConverterFactory(settings), + new DateTimeMarkerConverter(), + new DateTimeSecondsMarkerConverter(), + new DateTimeMillisMarkerConverter(), + new DateTimeNanosMarkerConverter(), + new DateTimeSecondsFloatMarkerConverter(), + new DateTimeMillisFloatMarkerConverter(), + new TimeSpanSecondsMarkerConverter(), + new TimeSpanMillisMarkerConverter(), + new TimeSpanNanosMarkerConverter(), + new TimeSpanSecondsFloatMarkerConverter(), + new TimeSpanMillisFloatMarkerConverter(), + + new SingleOrManyFieldsMarkerConverter(), + new FieldValuesConverter(), - new IsADictionaryConverterFactory(), - new ResponseItemConverterFactory(), - new DictionaryResponseConverterFactory(settings), - new UnionConverter(), + // TODO: Remove after https://github.com/elastic/elasticsearch-specification/issues/2238 is implemented + new StringifiedBoolConverter(), + new StringifiedIntConverter(), new StringifiedLongConverter(), - new StringifiedIntegerConverter(), - new StringifiedBoolConverter() + new StringifiedSingleConverter(), + new StringifiedDoubleConverter(), ]; private static void MutateOptions(JsonSerializerOptions options) { + options.TypeInfoResolver = new DefaultJsonTypeInfoResolver(); options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; options.IncludeFields = true; options.NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals; diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultSourceSerializer.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultSourceSerializer.cs index 4402fd7b23a..60418a4afe6 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultSourceSerializer.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DefaultSourceSerializer.cs @@ -3,9 +3,10 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; - +using System.Text.Json.Serialization.Metadata; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch.Serialization; @@ -17,49 +18,19 @@ namespace Elastic.Clients.Elasticsearch.Serialization; public class DefaultSourceSerializer : SystemTextJsonSerializer { -#if !NET8_0_OR_GREATER - private readonly object _lock = new(); -#endif - /// /// Constructs a new instance that accepts an that can /// be provided to customize the default . /// - /// An instance to which this serializers + /// An instance to which this serializer /// will be linked. /// /// /// An optional to customize the configuration of the default . /// public DefaultSourceSerializer(IElasticsearchClientSettings settings, Action? configureOptions = null) : - base(new DefaultSourceSerializerOptionsProvider(configureOptions)) => - LinkSettings(settings); - - /// - /// Links the of this serializer to the given . - /// - private void LinkSettings(IElasticsearchClientSettings settings) + base(new DefaultSourceSerializerOptionsProvider(settings, configureOptions)) { - var options = GetJsonSerializerOptions(SerializationFormatting.None); - var indentedOptions = GetJsonSerializerOptions(SerializationFormatting.Indented); - -#if NET8_0_OR_GREATER - ElasticsearchClient.SettingsTable.TryAdd(options, settings); - ElasticsearchClient.SettingsTable.TryAdd(indentedOptions, settings); -#else - lock (_lock) - { - if (!ElasticsearchClient.SettingsTable.TryGetValue(options, out _)) - { - ElasticsearchClient.SettingsTable.Add(options, settings); - } - - if (!ElasticsearchClient.SettingsTable.TryGetValue(indentedOptions, out _)) - { - ElasticsearchClient.SettingsTable.Add(indentedOptions, settings); - } - } -#endif } } @@ -69,28 +40,33 @@ private void LinkSettings(IElasticsearchClientSettings settings) public class DefaultSourceSerializerOptionsProvider : TransportSerializerOptionsProvider { + public DefaultSourceSerializerOptionsProvider(IElasticsearchClientSettings settings, Action? configureOptions = null) : + base(CreateDefaultBuiltInConverters(settings), null, options => MutateOptions(options, configureOptions)) + { + } + + public DefaultSourceSerializerOptionsProvider(IElasticsearchClientSettings settings, bool registerDefaultConverters, Action? configureOptions = null) : + base(registerDefaultConverters ? CreateDefaultBuiltInConverters(settings) : [], null, options => MutateOptions(options, configureOptions)) + { + } + /// /// Returns an array of the built-in s that are used registered with the source serializer by default. /// - private static JsonConverter[] DefaultBuiltInConverters => + private static IReadOnlyCollection CreateDefaultBuiltInConverters(IElasticsearchClientSettings settings) => [ + // For context aware JsonConverter/JsonConverterFactory implementations. + new ContextProvider(settings), + new JsonStringEnumConverter(), new DoubleWithFractionalPortionConverter(), new SingleWithFractionalPortionConverter() ]; - public DefaultSourceSerializerOptionsProvider(Action? configureOptions = null) : - base(DefaultBuiltInConverters, null, options => MutateOptions(options, configureOptions)) - { - } - - public DefaultSourceSerializerOptionsProvider(bool registerDefaultConverters = true, Action? configureOptions = null) : - base(registerDefaultConverters ? DefaultBuiltInConverters : [], null, options => MutateOptions(options, configureOptions)) - { - } - private static void MutateOptions(JsonSerializerOptions options, Action? configureOptions) { + options.TypeInfoResolver = new DefaultJsonTypeInfoResolver(); + options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DictionaryResponseConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DictionaryResponseConverter.cs deleted file mode 100644 index 374b0667765..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DictionaryResponseConverter.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class DictionaryResponseConverterFactory : JsonConverterFactory -{ - private readonly IElasticsearchClientSettings _settings; - - public DictionaryResponseConverterFactory(IElasticsearchClientSettings settings) => _settings = settings; - - public override bool CanConvert(Type typeToConvert) => - typeToConvert.BaseType is not null && - typeToConvert.BaseType.IsGenericType && - typeToConvert.BaseType.GetGenericTypeDefinition() == typeof(DictionaryResponse<,>); - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) - { - var args = typeToConvert.BaseType.GetGenericArguments(); - - var keyType = args[0]; - var valueType = args[1]; - - if (keyType.IsClass) - { - if (keyType == typeof(IndexName)) - { - return (JsonConverter)Activator.CreateInstance( - typeof(ResolvableDictionaryResponseConverterInner<,,>).MakeGenericType(typeToConvert, keyType, valueType), _settings); - } - - return (JsonConverter)Activator.CreateInstance( - typeof(DictionaryResponseConverterInner<,,>).MakeGenericType(typeToConvert, keyType, valueType)); - } - - return null; - } - - private class DictionaryResponseConverterInner : JsonConverter - where TKey : class - where TType : DictionaryResponse, new() - { - public override TType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var dictionary = JsonSerializer.Deserialize>(ref reader, options); - - if (dictionary is null) - return null; - - return (TType)Activator.CreateInstance(typeof(TType), new object[] { dictionary }); - } - - public override void Write(Utf8JsonWriter writer, TType value, JsonSerializerOptions options) => - throw new NotImplementedException("Response converters do not support serialization."); - } - - private class ResolvableDictionaryResponseConverterInner : JsonConverter - where TKey : class, IUrlParameter - where TType : DictionaryResponse, new() - { - private readonly IElasticsearchClientSettings _settings; - - public ResolvableDictionaryResponseConverterInner(IElasticsearchClientSettings settings) => _settings = settings; - - public override TType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var dictionary = JsonSerializer.Deserialize>(ref reader, options); - - if (dictionary is null) - return null; - - var dictionaryProxy = new ResolvableDictionaryProxy(_settings, dictionary); - - return (TType)Activator.CreateInstance(typeof(TType), new object[] { dictionaryProxy }); - } - - public override void Write(Utf8JsonWriter writer, TType value, JsonSerializerOptions options) => - throw new NotImplementedException("Response converters do not support serialization."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DoubleWithFractionalPortionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DoubleWithFractionalPortionConverter.cs deleted file mode 100644 index 911f69f399e..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/DoubleWithFractionalPortionConverter.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -#if NETCOREAPP - -using System.Buffers.Text; - -#endif - -using System.Globalization; - -#if !NETCOREAPP - -using System.Text; - -#endif - -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class DoubleWithFractionalPortionConverter : JsonConverter -{ - public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.String) - return reader.GetDouble(); - - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) - { - // TODO: Handle 'reader.HasValueSequence' - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralNaN)) - return float.NaN; - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralPositiveInfinity)) - return float.PositiveInfinity; - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralNegativeInfinity)) - return float.NegativeInfinity; - } - - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowReadingFromString)) - { - var value = reader.GetString(); - - if (!double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) - ThrowHelper.ThrowJsonException($"Unable to parse '{value}' as a double."); - - return result; - } - - return reader.GetDouble(); - } - - public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options) - { - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) - { - switch (value) - { - case double.NaN: - writer.WriteStringValue(JsonConstants.EncodedNaN); - return; - - case double.PositiveInfinity: - writer.WriteStringValue(JsonConstants.EncodedPositiveInfinity); - return; - - case double.NegativeInfinity: - writer.WriteStringValue(JsonConstants.EncodedNegativeInfinity); - return; - } - } - - if (options.NumberHandling.HasFlag(JsonNumberHandling.WriteAsString)) - { - // TODO: Implement as needed - throw new NotImplementedException("The 'JsonNumberHandling.WriteAsString' is currently not supported."); - } - - // This code is based on: - // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs#L101 - -#if NETCOREAPP - Span utf8Text = stackalloc byte[JsonConstants.MaximumFormatDoubleLength]; - - if (Utf8Formatter.TryFormat(value, utf8Text, out var bytesWritten, JsonConstants.DoubleStandardFormat)) - { - if (utf8Text.IndexOfAny(JsonConstants.NonIntegerChars) == -1) - { - utf8Text[bytesWritten++] = (byte)'.'; - utf8Text[bytesWritten++] = (byte)'0'; - } - - writer.WriteRawValue(utf8Text[..bytesWritten], true); - return; - } -#else - var utf16Text = value.ToString(JsonConstants.DoubleFormatString, CultureInfo.InvariantCulture); - if (utf16Text.IndexOfAny(JsonConstants.NonIntegerChars) == -1) - { - utf16Text += ".0"; - } - - try - { - var utf8Text = Encoding.UTF8.GetBytes(utf16Text); - - writer.WriteRawValue(utf8Text, true); - return; - } - catch - { - // Swallow this and fall through to our general exception. - } -#endif - - ThrowHelper.ThrowJsonException("Unable to serialize double value."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/GenericConverterAttribute.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/GenericConverterAttribute.cs deleted file mode 100644 index efe2547dd06..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/GenericConverterAttribute.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -/// -/// A custom used to dynamically create -/// instances for generic classes and properties whose type arguments are unknown at compile time. -/// -internal class GenericConverterAttribute : - JsonConverterAttribute -{ - private readonly int _parameterCount; - - /// - /// The constructor. - /// - /// The open generic type of the JSON converter class. - /// - /// Set true to unwrap the generic type arguments of the source/target type before using them to create - /// the converter instance. - /// - /// This is especially useful, if the base converter is e.g. defined as MyBaseConverter{SomeType{T}} - /// but the annotated property already has the concrete type SomeType{T}. Unwrapping the generic - /// arguments will make sure to not incorrectly instantiate a converter class of type - /// MyBaseConverter{SomeType{SomeType{T}}}. - /// - /// - /// If is not a compatible generic type definition. - public GenericConverterAttribute(Type genericConverterType, bool unwrap = false) - { - if (!genericConverterType.IsGenericTypeDefinition) - { - throw new ArgumentException( - $"The generic JSON converter type '{genericConverterType.Name}' is not a generic type definition.", - nameof(genericConverterType)); - } - - GenericConverterType = genericConverterType; - Unwrap = unwrap; - - _parameterCount = GenericConverterType.GetTypeInfo().GenericTypeParameters.Length; - - if (!unwrap && (_parameterCount != 1)) - { - throw new ArgumentException( - $"The generic JSON converter type '{genericConverterType.Name}' must accept exactly 1 generic type " + - $"argument", - nameof(genericConverterType)); - } - } - - public Type GenericConverterType { get; } - - public bool Unwrap { get; } - - /// - public override JsonConverter? CreateConverter(Type typeToConvert) - { - if (!Unwrap) - return (JsonConverter)Activator.CreateInstance(GenericConverterType.MakeGenericType(typeToConvert)); - - var arguments = typeToConvert.GetGenericArguments(); - if (arguments.Length != _parameterCount) - { - throw new ArgumentException( - $"The generic JSON converter type '{GenericConverterType.Name}' is not compatible with the target " + - $"type '{typeToConvert.Name}'.", - nameof(typeToConvert)); - } - - return (JsonConverter)Activator.CreateInstance(GenericConverterType.MakeGenericType(arguments)); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ISourceMarker.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ISourceMarker.cs deleted file mode 100644 index 70308dd7f03..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ISourceMarker.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal interface ISourceMarker { } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IStreamSerializable.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IStreamSerializable.cs index 8bd24041108..ccd8a9b8c4e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IStreamSerializable.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IStreamSerializable.cs @@ -19,7 +19,7 @@ internal interface IStreamSerializable /// /// /// - void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None); + public void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None); /// /// Asynchronously serialize the object into the supplied . @@ -28,5 +28,5 @@ internal interface IStreamSerializable /// /// /// - Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None); + public Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverter.cs deleted file mode 100644 index dd48123d8f9..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/InterfaceConverter.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class InterfaceConverter : JsonConverter - where TConcrete : class, TInterface -{ - public override TInterface Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => - JsonSerializer.Deserialize(ref reader, options); - - public override void Write(Utf8JsonWriter writer, TInterface value, JsonSerializerOptions options) => - JsonSerializer.Serialize(writer, value, value.GetType(), options); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IntermediateSourceConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IntermediateSourceConverter.cs deleted file mode 100644 index abc4703b5f8..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IntermediateSourceConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class IntermediateSourceConverter : JsonConverter -{ - public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var converter = options.GetConverter(typeof(SourceMarker<>).MakeGenericType(typeToConvert)); - - if (converter is SourceConverter sourceConverter) - { - var source = sourceConverter.Read(ref reader, typeToConvert, options); - return source.Source; - } - - return default; - } - - public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) - { - var converter = options.GetConverter(typeof(SourceMarker<>).MakeGenericType(typeof(T))); - - if (converter is SourceConverter sourceConverter) - { - sourceConverter.Write(writer, new SourceMarker { Source = value }, options); - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IsADictionaryConverterFactory.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IsADictionaryConverterFactory.cs deleted file mode 100644 index 3d36da2a1ea..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/IsADictionaryConverterFactory.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Mapping; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class IsADictionaryConverterFactory : JsonConverterFactory -{ - public override bool CanConvert(Type typeToConvert) => - typeToConvert.Name != nameof(Properties) && // Properties has it's own converter assigned - typeToConvert.BaseType is not null && - typeToConvert.BaseType.IsGenericType && - typeToConvert.BaseType.GetGenericTypeDefinition() == typeof(IsADictionary<,>); - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) - { - var args = typeToConvert.BaseType.GetGenericArguments(); - - var keyType = args[0]; - var valueType = args[1]; - - if (keyType.IsClass) - { - return (JsonConverter)Activator.CreateInstance( - typeof(IsADictionaryConverterInner<,,>).MakeGenericType(typeToConvert, keyType, valueType)); - } - - return null; - } - - private class IsADictionaryConverterInner : JsonConverter - where TKey : class - where TType : IsADictionary, new() - { - public override TType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var dictionary = JsonSerializer.Deserialize>(ref reader, options); - - if (dictionary is null) - return null; - - return (TType)Activator.CreateInstance(typeof(TType), new object[] { dictionary }); - } - - public override void Write(Utf8JsonWriter writer, TType value, JsonSerializerOptions options) => - JsonSerializer.Serialize>(writer, value.BackingDictionary, options); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonConstants.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonConstants.cs deleted file mode 100644 index 3c28f552a46..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonConstants.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; - -#if NETCOREAPP - -using System.Buffers; - -#endif - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal static class JsonConstants -{ - public static ReadOnlySpan LiteralNaN => "NaN"u8; - public static ReadOnlySpan LiteralPositiveInfinity => "Infinity"u8; - public static ReadOnlySpan LiteralNegativeInfinity => "-Infinity"u8; - public static JsonEncodedText EncodedNaN => JsonEncodedText.Encode(LiteralNaN); - public static JsonEncodedText EncodedPositiveInfinity => JsonEncodedText.Encode(LiteralPositiveInfinity); - public static JsonEncodedText EncodedNegativeInfinity => JsonEncodedText.Encode(LiteralNegativeInfinity); - -#if NETCOREAPP - public static ReadOnlySpan NonIntegerChars => "E."u8; -#else - public static char[] NonIntegerChars => new[] { 'E', '.' }; -#endif - - public const string DoubleFormatString = "G17"; // 'R' does not roundtrip correctly in some cases prior to .NET Core 3 - public const string SingleFormatString = "G9"; // https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#round-trip-format-specifier-r - -#if NETCOREAPP - public static readonly StandardFormat DoubleStandardFormat = StandardFormat.Parse(DoubleFormatString); - public static readonly StandardFormat SingleStandardFormat = StandardFormat.Parse(SingleFormatString); - - public const int MaximumFormatDoubleLength = 128; // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs#L78 - public const int MaximumFormatSingleLength = 128; // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs#L79 -#endif -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonHelper.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonHelper.cs deleted file mode 100644 index 1e02bd31afc..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonHelper.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Text.Json; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal static class JsonHelper -{ - public static bool TryReadUntilStringPropertyValue(ref Utf8JsonReader reader, byte[] propertyNameBytes) - { - while (reader.Read()) - { - if (reader.TokenType == JsonTokenType.PropertyName && reader.ValueTextEquals(propertyNameBytes)) - { - reader.Read(); - return true; - } - } - - return false; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonSerializerOptionsExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonSerializerOptionsExtensions.cs index 3a8742c1962..a21336a2370 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonSerializerOptionsExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/JsonSerializerOptionsExtensions.cs @@ -2,12 +2,16 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Diagnostics.CodeAnalysis; using System.Text.Json; namespace Elastic.Clients.Elasticsearch.Serialization; -internal static class JsonSerializerOptionsExtensions +internal static partial class JsonSerializerOptionsExtensions { - internal static bool TryGetClientSettings(this JsonSerializerOptions options, out IElasticsearchClientSettings settings) => - ElasticsearchClient.SettingsTable.TryGetValue(options, out settings); + internal static bool TryGetClientSettings(this JsonSerializerOptions options, + [NotNullWhen(true)] out IElasticsearchClientSettings? settings) + { + return ContextProvider.TryGetContext(options, out settings); + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/KeyValuePairConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/KeyValuePairConverter.cs deleted file mode 100644 index 7a9d39935fe..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/KeyValuePairConverter.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class KeyValuePairConverterFactory : JsonConverterFactory -{ - private readonly IElasticsearchClientSettings _settings; - - public KeyValuePairConverterFactory(IElasticsearchClientSettings settings) => _settings = settings; - - public override bool CanConvert(Type typeToConvert) => typeToConvert.IsGenericType - && typeToConvert.Name == typeof(KeyValuePair<,>).Name - && typeof(IUrlParameter).IsAssignableFrom(typeToConvert.GetGenericArguments()[0]); - - public override JsonConverter CreateConverter( - Type type, - JsonSerializerOptions options) - { - var itemOneType = type.GetGenericArguments()[0]; - var itemTwoType = type.GetGenericArguments()[1]; - - return (JsonConverter)Activator.CreateInstance(typeof(KeyValuePairConverter<,>).MakeGenericType(itemOneType, itemTwoType), _settings); - } - - private class KeyValuePairConverter : JsonConverter> where TItem1 : class, IUrlParameter - { - private readonly IElasticsearchClientSettings _settings; - - public KeyValuePairConverter(IElasticsearchClientSettings settings) => _settings = settings; - - public override KeyValuePair Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException("Unexpected token for KeyValuePair"); - - reader.Read(); // property name (key) - var keyString = reader.GetString(); - - reader.Read(); // value - var value = JsonSerializer.Deserialize(ref reader, options); - - reader.Read(); // end object - - var key = (TItem1)Activator.CreateInstance(typeof(TItem1), keyString); - return new KeyValuePair(key, value); - } - - public override void Write(Utf8JsonWriter writer, KeyValuePair value, - JsonSerializerOptions options) - { - writer.WriteStartObject(); - writer.WritePropertyName(value.Key.GetString(_settings)); - JsonSerializer.Serialize(writer, value.Value, options); - writer.WriteEndObject(); - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/MultiItemUnionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/MultiItemUnionConverter.cs deleted file mode 100644 index 0aece1e358a..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/MultiItemUnionConverter.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Core; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -/// -/// A base converter for any multi-item (>2 items) unions. The code-generator creates a -/// derived type which populates the fields in its constructor. -/// IMPORTANT: This is a MVP implementation which meets the requirements for the currently -/// generated multi-item unions. Additional logic may be needed when we first encounter -/// other item types. In the interests of time, we are not covering all cases for now. -/// -internal abstract class MultiItemUnionConverter : JsonConverter - where TUnion : IComplexUnion - where TEnum : Enum -{ - // Used when serializing to specify the type for each enum kind. - protected Dictionary _types; - - // Used when creating an instance of the TUnion for a specific type. - protected Dictionary> _factories; - - // Used when deserializing objects, to determine which type we have. - protected Dictionary _uniquePropertyToType; - - protected Type _arrayType; // For now, we handle only unions with one item being defined as an array - - public override TUnion? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - const string exceptionMessage = "Unable to match JSON object to union item."; - - // Plan of attack!! - // - If the token is start object: - // - For types which are objects, we need to identify required properties - // - Determine if each object has a unique required property (if not we need to find unique combinations) - // - If none are unique, we may struggle, but we can also check for unique optional properties - // - If the token is a literal value, see if we have a matching literal available - // - If the token is the start of an array, do we have an array type identified (we currently only support one array-based item). - - if (_factories is null) - ThrowHelper.ThrowJsonException("No factories have been registered for deserialization."); - - // We'll be handling an object - if (reader.TokenType == JsonTokenType.StartObject) - { - var readerCopy = reader; // We need a copy to use when reading ahead - - if (_uniquePropertyToType is null) - ThrowHelper.ThrowJsonException(exceptionMessage); - - using var jsonDoc = JsonDocument.ParseValue(ref readerCopy); - - if (jsonDoc is null) - ThrowHelper.ThrowJsonException(exceptionMessage); - - Type? matchedType = null; - - // Loop through the unique properties of each possible object. - // Once we find a match we can stop checking any further. - foreach (var item in _uniquePropertyToType) - { - if (jsonDoc.RootElement.TryGetProperty(item.Key, out _)) - { - // We've matched a unique property in the JSON object, so now know the type - matchedType = item.Value; - break; - } - } - - if (matchedType is null) - ThrowHelper.ThrowJsonException(exceptionMessage); - - if (!_factories.TryGetValue(matchedType, out var factory)) - ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union object item."); - - // Since we now know the type and have the factory for that type, we can deserialize the object - // and pass it to the factory to create the instance. - - var value = JsonSerializer.Deserialize(ref reader, matchedType, options); - - return factory.Invoke(value); - } - - if (reader.TokenType == JsonTokenType.String) - { - var value = reader.GetString(); - reader.Read(); - - if (!_factories.TryGetValue(typeof(string), out var factory)) - ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union accepting a string value."); - - return factory.Invoke(value); - } - - if (reader.TokenType == JsonTokenType.StartArray) - { - if (_arrayType is null) - ThrowHelper.ThrowJsonException(exceptionMessage); - - if (!_factories.TryGetValue(_arrayType, out var factory)) - ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union accepting an array value."); - - var value = JsonSerializer.Deserialize(ref reader, _arrayType, options); - - return factory.Invoke(value); - } - - ThrowHelper.ThrowJsonException($"Unable to deserialize JSON representing {typeof(TUnion)}."); - - return default; // We never reach here! - } - - public override void Write(Utf8JsonWriter writer, TUnion value, JsonSerializerOptions options) - { - if (_types is null) - ThrowHelper.ThrowJsonException("No types have been registered for serialization."); - - if (value is null) - { - writer.WriteNullValue(); - return; - } - - var serializeAsType = _types[value.ValueKind]; - - JsonSerializer.Serialize(writer, value.Value, serializeAsType, options); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/NumericAliasConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/NumericAliasConverter.cs deleted file mode 100644 index 99d59a64379..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/NumericAliasConverter.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class NumericAliasConverter : JsonConverter -{ - public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var value = reader.GetInt64(); - - var instance = (T)Activator.CreateInstance( - typeof(T), - BindingFlags.Instance | BindingFlags.Public, - args: new object[] {value}, - binder: null, - culture: null)!; - - return instance; - } - - public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) => - throw new NotImplementedException(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/PropertyNameConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/PropertyNameConverter.cs deleted file mode 100644 index 8ed87f2be87..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/PropertyNameConverter.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class PropertyNameConverter : SettingsJsonConverter -{ - public override void WriteAsPropertyName(Utf8JsonWriter writer, PropertyName value, JsonSerializerOptions options) => - writer.WritePropertyName(((IUrlParameter)value).GetString(GetSettings(options))); - - public override PropertyName ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => - reader.GetString(); - - public override PropertyName? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.String) - { - PropertyName propertyName = reader.GetString(); - return propertyName; - } - - return null; - } - - public override void Write(Utf8JsonWriter writer, PropertyName? value, JsonSerializerOptions options) - { - if (value is null) - { - writer.WriteNullValue(); - return; - } - - var propertyName = GetSettings(options).Inferrer.PropertyName(value); - writer.WriteStringValue(propertyName); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/QueryConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/QueryConverter.cs deleted file mode 100644 index 2210f6ad23d..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/QueryConverter.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch.QueryDsl; - -// This converter is generated for the Query container type. We add the CanConvert override here (for now) -// as the Query type may be used in source POCOs. - -internal sealed partial class QueryConverter -{ - public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(Query); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyFieldDictionaryConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyFieldDictionaryConverter.cs deleted file mode 100644 index 231a7b85c4b..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyFieldDictionaryConverter.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class ReadOnlyFieldDictionaryConverterAttribute : JsonConverterAttribute -{ - public ReadOnlyFieldDictionaryConverterAttribute(Type valueType) => ValueType = valueType; - - public Type ValueType { get; } - - public override JsonConverter? CreateConverter(Type typeToConvert) => (JsonConverter)Activator.CreateInstance(typeof(ReadOnlyFieldDictionaryConverter<>).MakeGenericType(ValueType)); -} - -internal sealed class ReadOnlyFieldDictionaryConverter : JsonConverter> -{ - public override IReadOnlyDictionary? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (!options.TryGetClientSettings(out var clientSettings)) - { - throw new JsonException("Unable to retrieve client settings required for deserialisation."); - } - - var initialDictionary = JsonSerializer.Deserialize>(ref reader, options); - - var readOnlyDictionary = new ReadOnlyFieldDictionary(initialDictionary, clientSettings); - - return readOnlyDictionary; - } - - public override void Write(Utf8JsonWriter writer, IReadOnlyDictionary value, JsonSerializerOptions options) => throw new NotImplementedException(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyIndexNameDictionaryConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyIndexNameDictionaryConverter.cs deleted file mode 100644 index 4d585c65680..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ReadOnlyIndexNameDictionaryConverter.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class ReadOnlyIndexNameDictionaryConverter : JsonConverterAttribute -{ - public ReadOnlyIndexNameDictionaryConverter(Type valueType) => ValueType = valueType; - - public Type ValueType { get; } - - public override JsonConverter? CreateConverter(Type typeToConvert) => (JsonConverter)Activator.CreateInstance(typeof(ReadOnlyIndexNameDictionaryConverter<>).MakeGenericType(ValueType)); -} - -internal sealed class ReadOnlyIndexNameDictionaryConverter : JsonConverter> -{ - public override IReadOnlyDictionary? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (!options.TryGetClientSettings(out var clientSettings)) - { - throw new JsonException("Unable to retrieve client settings required for deserialisation."); - } - - var initialDictionary = JsonSerializer.Deserialize>(ref reader, options); - - var readOnlyDictionary = new ReadOnlyIndexNameDictionary(initialDictionary, clientSettings); - - return readOnlyDictionary; - } - - public override void Write(Utf8JsonWriter writer, IReadOnlyDictionary value, JsonSerializerOptions options) => throw new NotImplementedException(); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResolvableReadonlyDictionaryConverterFactory.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResolvableReadonlyDictionaryConverterFactory.cs deleted file mode 100644 index 16f0e433e36..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResolvableReadonlyDictionaryConverterFactory.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class ResolvableReadonlyDictionaryConverterFactory : JsonConverterFactory -{ - private readonly IElasticsearchClientSettings _settings; - - public ResolvableReadonlyDictionaryConverterFactory(IElasticsearchClientSettings settings) => _settings = settings; - - public override bool CanConvert(Type typeToConvert) - { - if (typeToConvert.BaseType is null || !typeToConvert.BaseType.IsGenericType || typeToConvert.BaseType.GetGenericTypeDefinition() != typeof(IsADictionary<,>)) - { - return false; - } - - var args = typeToConvert.BaseType.GetGenericArguments(); - - var keyType = args[0]; - - return keyType is not null && typeof(IUrlParameter).IsAssignableFrom(keyType); - } - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) - { - var args = typeToConvert.BaseType.GetGenericArguments(); - - var keyType = args[0]; - var valueType = args[1]; - - if (keyType.IsClass) - { - return (JsonConverter)Activator.CreateInstance( - typeof(ResolvableReadOnlyDictionaryConverterInner<,,>).MakeGenericType(typeToConvert, keyType, valueType), _settings); - } - - return null; - } - - private class ResolvableReadOnlyDictionaryConverterInner : JsonConverter> - where TKey : class, IUrlParameter - where TType : IReadOnlyDictionary - { - private readonly IElasticsearchClientSettings _settings; - - public ResolvableReadOnlyDictionaryConverterInner(IElasticsearchClientSettings settings) => _settings = settings; - - public override IReadOnlyDictionary? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var dictionary = JsonSerializer.Deserialize>(ref reader, options); - - if (dictionary is null) - return default; - - var dictionaryProxy = new ResolvableDictionaryProxy(_settings, dictionary); - - return dictionaryProxy; - } - - public override void Write(Utf8JsonWriter writer, IReadOnlyDictionary value, JsonSerializerOptions options) => - throw new NotImplementedException($"Serialization is not supported for '{typeof(TType)}'."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResponseItemConverterFactory.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResponseItemConverterFactory.cs deleted file mode 100644 index 06f503d1e55..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/ResponseItemConverterFactory.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Core.Get; -using Elastic.Clients.Elasticsearch.Core.MGet; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -/// -/// A converter factory able to provide a converter to handle (de)serializing . -/// -internal sealed class ResponseItemConverterFactory : JsonConverterFactory -{ - public override bool CanConvert(Type typeToConvert) => typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(MultiGetResponseItem<>); - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) - { - var documentType = typeToConvert.GetGenericArguments()[0]; - - return (JsonConverter)Activator.CreateInstance( - typeof(ResponseItemConverter<>).MakeGenericType(documentType)); - } - - private sealed class ResponseItemConverter : JsonConverter> - { - public override MultiGetResponseItem? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - const string exceptionMessage = "Unable to deserialize union."; - var readerCopy = reader; - - Exception getResultException = null; - Exception errorException = null; - - // TODO - Review and optimise performance, possibly read-ahead to check for the error property and then deserialise - // accordingly is better? - - try - { - var result = JsonSerializer.Deserialize(ref reader, options); - - if (result is not null && result.Error is not null) - { - return new MultiGetResponseItem(result); - } - } - catch (Exception ex) - { - errorException = ex; - } - - try - { - var result = JsonSerializer.Deserialize>(ref readerCopy, options); - - // If we have a version number, we can be sure this isn't an error - if (result is not null) - { - reader = readerCopy; // Ensure we swap the reader to reflect the data we have consumed. - return new MultiGetResponseItem(result); - } - } - catch (Exception ex) - { - getResultException = ex; - } - - Exception innerException = null; - - if (errorException is not null && getResultException is not null) - { - innerException = new AggregateException(errorException, getResultException); - } - else if (errorException is not null) - { - innerException = errorException; - } - else if (getResultException is not null) - { - innerException = getResultException; - } - - if (innerException is not null) - { - throw new JsonException(exceptionMessage, innerException); - } - - throw new JsonException(exceptionMessage); - } - - // Not implemented as this type is read-only on responses. - public override void Write(Utf8JsonWriter writer, MultiGetResponseItem value, JsonSerializerOptions options) => - throw new NotImplementedException("We never expect to serialize an instance of MultiGetResponseItem as its a read-only response type."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializable.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializable.cs deleted file mode 100644 index 1f40c872ca9..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializable.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Text.Json; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -/// -/// Marks a type to provide it's own serialization code. -/// IMPORTANT: This should only be used for types that are only ever serialized and never deserialised, such as descriptors. -/// -internal interface ISelfSerializable -{ - void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); -} - -internal interface ISelfDeserializable -{ - void Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, IElasticsearchClientSettings settings); -} - -internal interface ISelfTwoWaySerializable -{ - void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); - void Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, IElasticsearchClientSettings settings); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializableConverterFactory.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializableConverterFactory.cs deleted file mode 100644 index b1095fdc9d8..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SelfSerializableConverterFactory.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SelfSerializableConverterFactory : JsonConverterFactory -{ - private readonly SelfSerializableJsonConverter _converter; - - public SelfSerializableConverterFactory(IElasticsearchClientSettings settings) => _converter = new SelfSerializableJsonConverter(settings); - - public override bool CanConvert(Type typeToConvert) - { - var canSerialize = typeof(ISelfSerializable).IsAssignableFrom(typeToConvert); - return canSerialize; - } - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) => - _converter; - - private class SelfSerializableJsonConverter : JsonConverter - { - private readonly IElasticsearchClientSettings _settings; - - public SelfSerializableJsonConverter(IElasticsearchClientSettings settings) => _settings = settings; - - public override ISelfSerializable? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => default; - - public override void Write(Utf8JsonWriter writer, ISelfSerializable value, JsonSerializerOptions options) => value.Serialize(writer, options, _settings); - } -} - -internal sealed class SelfTwoWaySerializableConverterFactory : JsonConverterFactory -{ - private readonly SelfSerializableJsonConverter _converter; - - public SelfTwoWaySerializableConverterFactory(IElasticsearchClientSettings settings) => _converter = new SelfSerializableJsonConverter(settings); - - public override bool CanConvert(Type typeToConvert) - { - var canSerialize = typeof(ISelfTwoWaySerializable).IsAssignableFrom(typeToConvert); - return canSerialize; - } - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) => - _converter; - - private class SelfSerializableJsonConverter : JsonConverter - { - private readonly IElasticsearchClientSettings _settings; - - public SelfSerializableJsonConverter(IElasticsearchClientSettings settings) => _settings = settings; - - public override ISelfTwoWaySerializable? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var instance = (ISelfTwoWaySerializable)Activator.CreateInstance(typeToConvert, true); - instance.Deserialize(ref reader, options, _settings); - return instance; - } - - public override void Write(Utf8JsonWriter writer, ISelfTwoWaySerializable value, JsonSerializerOptions options) => value.Serialize(writer, options, _settings); - } -} - -internal sealed class SelfDeserializableConverterFactory : JsonConverterFactory -{ - private readonly IElasticsearchClientSettings _settings; - - public SelfDeserializableConverterFactory(IElasticsearchClientSettings settings) => _settings = settings; - - public override bool CanConvert(Type typeToConvert) - { - var canSerialize = typeof(ISelfDeserializable).IsAssignableFrom(typeToConvert); - return canSerialize; - } - - public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) => - (JsonConverter)Activator.CreateInstance(typeof(SelfDeserializableJsonConverter), _settings); - - private class SelfDeserializableJsonConverter : JsonConverter - { - private readonly IElasticsearchClientSettings _settings; - - public SelfDeserializableJsonConverter(IElasticsearchClientSettings settings) => _settings = settings; - - public override ISelfDeserializable? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var instance = (ISelfDeserializable)Activator.CreateInstance(typeToConvert); - instance.Deserialize(ref reader, options, _settings); - return instance; - } - - public override void Write(Utf8JsonWriter writer, ISelfDeserializable value, JsonSerializerOptions options) => throw new NotImplementedException(); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SettingsJsonConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SettingsJsonConverter.cs deleted file mode 100644 index 486bac3ae13..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SettingsJsonConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -/// -/// Used for derived converters which need access to in order to serialize. -/// -/// The type of object or value handled by the converter. -internal abstract class SettingsJsonConverter : JsonConverter -{ - private IElasticsearchClientSettings _settings; - - /// - /// Access the for a given instance. - /// - /// The for which the should be retrieved. - /// An instance related to the provided . - /// Thrown if a corresponding instance cannot be found for the . - protected IElasticsearchClientSettings GetSettings(JsonSerializerOptions options) - { - if (_settings is not null) - return _settings; - - // We avoid locking here as the result of accessing the settings should be idemopotent and low cost. - - if (options.TryGetClientSettings(out var settings)) - { - _settings = settings; - return _settings; - } - - throw new JsonException("Unable to retrieve ElasticsearchClientSettings settings from JsonSerializerOptions."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SimpleInterfaceConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SimpleInterfaceConverter.cs deleted file mode 100644 index 65a1a75c86a..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SimpleInterfaceConverter.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SimpleInterfaceConverter : JsonConverter where TConcrete : class, TInterface -{ - public override TInterface Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => - JsonSerializer.Deserialize(ref reader, options); - - public override void Write(Utf8JsonWriter writer, TInterface value, JsonSerializerOptions options) - => JsonSerializer.Serialize(writer, value, typeof(TConcrete), options); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionAttribute.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionAttribute.cs deleted file mode 100644 index 1761ab6db7b..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -[AttributeUsage(AttributeTargets.Property)] -internal class SingleOrManyCollectionConverterAttribute : JsonConverterAttribute -{ - public SingleOrManyCollectionConverterAttribute(Type convertType) => ConvertType = convertType; - - public Type ConvertType { get; } - - public override JsonConverter? CreateConverter(Type typeToConvert) => (JsonConverter)Activator.CreateInstance(typeof(SingleOrManyCollectionConverter<>).MakeGenericType(ConvertType)); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionConverter.cs deleted file mode 100644 index 0e76814ad14..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManyCollectionConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal class SingleOrManyCollectionConverter : JsonConverter> -{ - public override ICollection? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => - SingleOrManySerializationHelper.Deserialize(ref reader, options); - - public override void Write(Utf8JsonWriter writer, ICollection value, JsonSerializerOptions options) => - SingleOrManySerializationHelper.Serialize(value, writer, options); - - public override bool CanConvert(Type typeToConvert) => true; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManySerializationHelper.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManySerializationHelper.cs deleted file mode 100644 index da2689fa490..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleOrManySerializationHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal static class SingleOrManySerializationHelper -{ - public static List Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options) - { - switch (reader.TokenType) - { - case JsonTokenType.Null: - return [default]; - - case JsonTokenType.StartArray: - return JsonSerializer.Deserialize>(ref reader, options); - - default: - { - var item = (TItem)JsonSerializer.Deserialize(ref reader, typeof(TItem), options); - return [item]; - } - } - } - - public static void Serialize(ICollection value, Utf8JsonWriter writer, JsonSerializerOptions options) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - - case { Count: 1 }: - JsonSerializer.Serialize(writer, value.First(), options); - break; - - default: - JsonSerializer.Serialize(writer, value, options); - break; - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleWithFractionalPortionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleWithFractionalPortionConverter.cs deleted file mode 100644 index 279516fcfbf..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SingleWithFractionalPortionConverter.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -#if NETCOREAPP - -using System.Buffers.Text; - -#endif - -using System.Globalization; - -#if !NETCOREAPP - -using System.Text; - -#endif - -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SingleWithFractionalPortionConverter : JsonConverter -{ - public override float Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.String) - return reader.GetSingle(); - - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) - { - // TODO: Handle 'reader.HasValueSequence' - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralNaN)) - return float.NaN; - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralPositiveInfinity)) - return float.PositiveInfinity; - if (reader.ValueSpan.SequenceEqual(JsonConstants.LiteralNegativeInfinity)) - return float.NegativeInfinity; - } - - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowReadingFromString)) - { - var value = reader.GetString(); - - if (!float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) - ThrowHelper.ThrowJsonException($"Unable to parse '{value}' as a single."); - - return result; - } - - return reader.GetSingle(); - } - - public override void Write(Utf8JsonWriter writer, float value, JsonSerializerOptions options) - { - if (options.NumberHandling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals)) - { - switch (value) - { - case float.NaN: - writer.WriteStringValue(JsonConstants.EncodedNaN); - return; - - case float.PositiveInfinity: - writer.WriteStringValue(JsonConstants.EncodedPositiveInfinity); - return; - - case float.NegativeInfinity: - writer.WriteStringValue(JsonConstants.EncodedNegativeInfinity); - return; - } - } - - if (options.NumberHandling.HasFlag(JsonNumberHandling.WriteAsString)) - { - // TODO: Implement as needed - throw new NotImplementedException("The 'JsonNumberHandling.WriteAsString' is currently not supported."); - } - - // This code is based on: - // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs#L101 - -#if NETCOREAPP - Span utf8Text = stackalloc byte[JsonConstants.MaximumFormatSingleLength]; - - if (Utf8Formatter.TryFormat(value, utf8Text, out var bytesWritten, JsonConstants.SingleStandardFormat)) - { - if (utf8Text.IndexOfAny(JsonConstants.NonIntegerChars) == -1) - { - utf8Text[bytesWritten++] = (byte)'.'; - utf8Text[bytesWritten++] = (byte)'0'; - } - - writer.WriteRawValue(utf8Text[..bytesWritten], true); - return; - } -#else - var utf16Text = value.ToString(JsonConstants.SingleFormatString, CultureInfo.InvariantCulture); - if (utf16Text.IndexOfAny(JsonConstants.NonIntegerChars) == -1) - { - utf16Text += ".0"; - } - - try - { - var utf8Text = Encoding.UTF8.GetBytes(utf16Text); - - writer.WriteRawValue(utf8Text, true); - return; - } - catch - { - // Swallow this and fall through to our general exception. - } -#endif - - ThrowHelper.ThrowJsonException("Unable to serialize single value."); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverter.cs deleted file mode 100644 index 82292ea1155..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverter.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -using Elastic.Transport.Extensions; - -internal sealed class SourceConverter : JsonConverter> -{ - private readonly IElasticsearchClientSettings _settings; - - public SourceConverter(IElasticsearchClientSettings settings) => _settings = settings; - - public override SourceMarker? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => new() - { - Source = _settings.SourceSerializer.Deserialize(ref reader, null) - }; - - public override void Write(Utf8JsonWriter writer, SourceMarker value, JsonSerializerOptions options) => _settings.SourceSerializer.Serialize(value.Source, writer, null); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterAttribute.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterAttribute.cs deleted file mode 100644 index d7d3e06fb02..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SourceConverterAttribute : JsonConverterAttribute -{ - public override JsonConverter? CreateConverter(Type typeToConvert) => (JsonConverter)Activator.CreateInstance(typeof(IntermediateSourceConverter<>).MakeGenericType(typeToConvert)); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterFactory.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterFactory.cs deleted file mode 100644 index d576c964a4b..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceConverterFactory.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SourceConverterFactory : JsonConverterFactory -{ - private readonly IElasticsearchClientSettings _settings; - - public SourceConverterFactory(IElasticsearchClientSettings settings) => _settings = settings; - - public override bool CanConvert(Type typeToConvert) - { - if (!typeToConvert.IsGenericType) - return false; - - var canConvert = typeof(SourceMarker<>) == typeToConvert.GetGenericTypeDefinition(); - return canConvert; - } - - public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options) - { - var valueType = type.GetGenericArguments()[0]; - return (JsonConverter)Activator.CreateInstance(typeof(SourceConverter<>).MakeGenericType(valueType), _settings); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceMarker.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceMarker.cs deleted file mode 100644 index 7cb89ef1d84..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/SourceMarker.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class SourceMarker -{ - public T Source { get; set; } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/StringEnumAttribute.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/StringEnumAttribute.cs deleted file mode 100644 index 2bdf4c83d18..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/StringEnumAttribute.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Enum)] -public class StringEnumAttribute : Attribute { } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/Stringified.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/Stringified.cs deleted file mode 100644 index 36a51971fe9..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/Stringified.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class StringifiedLongConverter : JsonConverter -{ - public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedLong(ref reader); - - public override void Write(Utf8JsonWriter writer, long value, JsonSerializerOptions options) => writer.WriteNumberValue(value); - - public static long ReadStringifiedLong(ref Utf8JsonReader reader) - { - if (reader.TokenType == JsonTokenType.PropertyName) - reader.Read(); - - if (reader.TokenType == JsonTokenType.String) - { - var longString = reader.GetString(); - - if (!long.TryParse(longString, out var longValue)) - { - throw new JsonException("Unable to parse string value to long."); - } - - return longValue; - } - - return reader.GetInt64(); - } -} - -internal sealed class StringifiedIntegerConverter : JsonConverter -{ - public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedInteger(ref reader); - - public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) => writer.WriteNumberValue(value); - - public static int ReadStringifiedInteger(ref Utf8JsonReader reader) - { - if (reader.TokenType == JsonTokenType.PropertyName) - reader.Read(); - - if (reader.TokenType == JsonTokenType.String) - { - var intString = reader.GetString(); - - if (!int.TryParse(intString, out var intValue)) - { - throw new JsonException("Unable to parse string value to integer."); - } - - return intValue; - } - - return reader.GetInt32(); - } -} - -internal sealed class StringifiedBoolConverter : JsonConverter -{ - public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => ReadStringifiedBool(ref reader); - - public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) => writer.WriteBooleanValue(value); - - public static bool ReadStringifiedBool(ref Utf8JsonReader reader) - { - if (reader.TokenType == JsonTokenType.PropertyName) - reader.Read(); - - if (reader.TokenType == JsonTokenType.String) - { - var boolString = reader.GetString(); - - if (!bool.TryParse(boolString, out var boolValue)) - { - throw new JsonException("Unable to parse string value to bool."); - } - - return boolValue; - } - - return reader.GetBoolean(); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/TermsAggregateSerializationHelper.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/TermsAggregateSerializationHelper.cs deleted file mode 100644 index 87d1e8e6882..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/TermsAggregateSerializationHelper.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text; -using Elastic.Clients.Elasticsearch.Aggregations; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal static class TermsAggregateSerializationHelper -{ - private static readonly byte[] s_buckets = Encoding.UTF8.GetBytes("buckets"); - private static readonly byte[] s_key = Encoding.UTF8.GetBytes("key"); - private static readonly byte s_period = (byte)'.'; - - public static bool TryDeserializeTermsAggregate(string aggregateName, ref Utf8JsonReader reader, JsonSerializerOptions options, out IAggregate? aggregate) - { - aggregate = null; - - // We take a copy here so we can read forward to establish the term key type before we resume with final deserialization. - var readerCopy = reader; - - if (JsonHelper.TryReadUntilStringPropertyValue(ref readerCopy, s_buckets)) - { - if (readerCopy.TokenType != JsonTokenType.StartArray) - throw new Exception("TODO"); - - readerCopy.Read(); - - if (readerCopy.TokenType == JsonTokenType.EndArray) // We have no buckets - { - if (aggregateName.Equals("sterms", StringComparison.Ordinal)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - - if (aggregateName.Equals("lterms", StringComparison.Ordinal)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - - if (aggregateName.Equals("dterms", StringComparison.Ordinal)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - - if (aggregateName.Equals("multi_terms", StringComparison.Ordinal)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - - throw new JsonException($"Unable to deserialize empty terms aggregate for '{aggregateName}'."); - } - else - { - if (readerCopy.TokenType != JsonTokenType.StartObject) - throw new Exception("TODO"); // TODO! - - if (JsonHelper.TryReadUntilStringPropertyValue(ref readerCopy, s_key)) - { - if (readerCopy.TokenType == JsonTokenType.String) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - else if (readerCopy.TokenType == JsonTokenType.Number) - { - var value = readerCopy.ValueSpan; // TODO - May need to check for sequence - - if (value.IndexOf(s_period) > -1 && readerCopy.TryGetDouble(out _)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - else if (readerCopy.TryGetInt64(out _)) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - } - else if (readerCopy.TokenType == JsonTokenType.StartArray) - { - var agg = JsonSerializer.Deserialize(ref reader, options); - aggregate = agg; - return true; - } - else - { - throw new JsonException("Unhandled token type when parsing the terms aggregate response"); - } - } - } - } - - return false; - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/UnionConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/UnionConverter.cs deleted file mode 100644 index 25f61bf8fa9..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Serialization/UnionConverter.cs +++ /dev/null @@ -1,235 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Aggregations; - -namespace Elastic.Clients.Elasticsearch.Serialization; - -internal sealed class UnionConverter : JsonConverterFactory -{ - // Because converters registered on JsonSerializerOptions take priority over the JsonConverter attribute on the type, we need a way to - // mark those types we don't want to use the default union converter. This set is used for that purpose, until a better option can be - // found. - private static readonly HashSet TypesToSkip = new() - { - typeof(Core.Search.SourceConfig), - typeof(Script) - }; - - public override bool CanConvert(Type typeToConvert) => !TypesToSkip.Contains(typeToConvert) && - (typeToConvert.Name == typeof(Union<,>).Name || (typeToConvert.BaseType is not null && typeToConvert.BaseType.Name == typeof(Union<,>).Name)); - - public override JsonConverter CreateConverter( - Type type, - JsonSerializerOptions options) - { - if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Buckets<>)) - { - // TODO - Could potentially cache an instance for each bucket type and reuse it - var bucketType = type.GetGenericArguments()[0]; - return (JsonConverter)Activator.CreateInstance(typeof(BucketsConverter<>).MakeGenericType(bucketType)); - } - - // Fallback to generalised converter - - Type itemOneType, itemTwoType; - - if (type.Name == typeof(Union<,>).Name) - { - itemOneType = type.GetGenericArguments()[0]; - itemTwoType = type.GetGenericArguments()[1]; - } - else - { - itemOneType = type.BaseType.GetGenericArguments()[0]; - itemTwoType = type.BaseType.GetGenericArguments()[1]; - } - - JsonConverter converter; - - if (type.Name == typeof(Union<,>).Name) - { - converter = (JsonConverter)Activator.CreateInstance(typeof(UnionConverterInner<,>).MakeGenericType(itemOneType, itemTwoType)); - } - else - { - converter = (JsonConverter)Activator.CreateInstance(typeof(DerivedUnionConverterInner<,,>).MakeGenericType(type, itemOneType, itemTwoType)); - } - - return converter; - } - - private class DerivedUnionConverterInner : JsonConverter - where TType : Union - { - public override TType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - // TODO - Aggregate Exception if both fail - - var readerCopy = reader; - - try - { - var itemOne = JsonSerializer.Deserialize(ref readerCopy, options); - - if (itemOne is IUnionVerifiable verifiable) - { - if (verifiable.IsSuccessful) - { - reader = readerCopy; - return (TType)Activator.CreateInstance(typeof(TType), itemOne); - } - } - else if (itemOne is not null) - { - reader = readerCopy; - return (TType)Activator.CreateInstance(typeof(TType), itemOne); - } - } - catch - { - // TODO - Store for aggregate exception - } - - //if (reader.TokenType == JsonTokenType.StartObject) - //{ - // requiresEndObject = true; - // reader.Read(); - //} - - try - { - var itemTwo = JsonSerializer.Deserialize(ref reader, options); - - if (itemTwo is not null) - { - return (TType)Activator.CreateInstance(typeof(TType), itemTwo); - } - } - catch - { - // TODO - Store for aggregate exception - } - - throw new JsonException("Unable to deserialize union."); // TODO - Add inner aggregate exception. - } - - public override void Write(Utf8JsonWriter writer, TType value, - JsonSerializerOptions options) - { - switch (value.Tag) - { - case 0: - JsonSerializer.Serialize(writer, value.Item1, value.Item1!.GetType(), options); - return; - - case 1: - JsonSerializer.Serialize(writer, value.Item2, value.Item2!.GetType(), options); - return; - } - - throw new JsonException("Invalid union type."); - } - } - - private class UnionConverterInner : JsonConverter> - { - public override Union? Read(ref Utf8JsonReader reader, Type typeToConvert, - JsonSerializerOptions options) - { - var readerCopy = reader; - - try - { - var itemOne = JsonSerializer.Deserialize(ref readerCopy, options); - - if (itemOne is IUnionVerifiable verifiable) - { - if (verifiable.IsSuccessful) - { - reader = readerCopy; - return (Union)Activator.CreateInstance(typeof(Union), itemOne); - } - } - else if (itemOne is not null) - { - reader = readerCopy; - return (Union)Activator.CreateInstance(typeof(Union), itemOne); - } - } - catch - { - // TODO - Store for aggregate exception - } - - try - { - var itemTwo = JsonSerializer.Deserialize(ref reader, options); - - if (itemTwo is not null) - { - return (Union)Activator.CreateInstance(typeof(Union), itemTwo); - } - } - catch - { - // TODO - Store for aggregate exception - } - - throw new JsonException("Unable to deserialize union."); // TODO - Add inner aggregate exception. - } - - public override void Write(Utf8JsonWriter writer, Union value, - JsonSerializerOptions options) - { - switch (value.Tag) - { - case 0: - JsonSerializer.Serialize(writer, value.Item1, value.Item1!.GetType(), options); - return; - - case 1: - JsonSerializer.Serialize(writer, value.Item2, value.Item2!.GetType(), options); - return; - } - - throw new JsonException("Invalid union type"); - } - } - - private class BucketsConverter : JsonConverter> - { - public override Buckets? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.TokenType switch - { - JsonTokenType.Null => null, - JsonTokenType.StartArray => new(JsonSerializer.Deserialize>(ref reader, options)), - JsonTokenType.StartObject => new(JsonSerializer.Deserialize>(ref reader, options)), - _ => throw new JsonException("Invalid bucket type") - }; - } - - public override void Write(Utf8JsonWriter writer, Buckets value, JsonSerializerOptions options) - { - if (value.Item1 is { } item1) - { - JsonSerializer.Serialize(writer, item1, options); - return; - } - - if (value.Item2 is { } item2) - { - JsonSerializer.Serialize(writer, item2, options); - return; - } - - writer.WriteNullValue(); - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Aggregations/FieldDateMath.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Aggregations/FieldDateMath.cs new file mode 100644 index 00000000000..68ac1828ba9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Aggregations/FieldDateMath.cs @@ -0,0 +1,13 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Elastic.Clients.Elasticsearch.Aggregations; + +public sealed partial class FieldDateMath +{ + public static implicit operator FieldDateMath(DateTime dateTime) => new(DateMath.Anchored(dateTime)); + public static implicit operator FieldDateMath(string dateMath) => new(DateMath.FromString(dateMath)); +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/AsyncSearch/AsyncSearch.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/AsyncSearch/AsyncSearch.cs index 289ef7cf6be..d6567b523d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/AsyncSearch/AsyncSearch.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/AsyncSearch/AsyncSearch.cs @@ -26,5 +26,5 @@ public partial class AsyncSearch /// The total number of hits returned for this search. /// [JsonIgnore] - public long Total => HitsMetadata?.Total?.Item1?.Value ?? HitsMetadata?.Total?.Item2 ?? -1; + public long Total => HitsMetadata?.Total?.Value1?.Value ?? HitsMetadata?.Total?.Value2 ?? -1; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/ByteSize.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/ByteSize.cs new file mode 100644 index 00000000000..7cc245e088a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/ByteSize.cs @@ -0,0 +1,52 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +using Elastic.Transport; + +namespace Elastic.Clients.Elasticsearch; + +// TODO: Hand-craft this type for custom parsing. + +public partial class ByteSize : + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif +{ + public string GetString(ITransportConfiguration settings) => + Match( + v => v.ToString(CultureInfo.InvariantCulture), + v => v ?? string.Empty + ); + + #region IParsable + + public static ByteSize Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out ByteSize? result) + { + if (string.IsNullOrEmpty(s)) + { + result = null; + return false; + } + + if (long.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value)) + { + result = new ByteSize(value); + return true; + } + + result = new ByteSize(s); + return true; + } + + #endregion IParsable +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Cluster/WaitForNodes.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Cluster/WaitForNodes.cs new file mode 100644 index 00000000000..da34c4eeaff --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Cluster/WaitForNodes.cs @@ -0,0 +1,134 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +using Elastic.Transport; + +namespace Elastic.Clients.Elasticsearch.Cluster; + +public enum WaitForNodesCondition +{ + EqualTo, + LessThan, + LessThanOrEqualTo, + GreaterThan, + GreaterThanOrEqualTo +} + +public readonly struct WaitForNodes : + IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif +{ + public WaitForNodesCondition Condition { get; } + public int Nodes { get; } + + public WaitForNodes(int nodes) + { + Condition = WaitForNodesCondition.EqualTo; + Nodes = nodes; + } + + public WaitForNodes(WaitForNodesCondition condition, int nodes) + { + Condition = condition; + Nodes = nodes; + } + + public static implicit operator WaitForNodes(int nodes) + { + return new(nodes); + } + + public static WaitForNodes EqualTo(int nodes) + { + return new(nodes); + } + + public static WaitForNodes GreaterThan(int nodes) + { + return new(WaitForNodesCondition.GreaterThan, nodes); + } + + public static WaitForNodes GreaterThanOrEqualTo(int nodes) + { + return new(WaitForNodesCondition.GreaterThanOrEqualTo, nodes); + } + + public static WaitForNodes LessThan(int nodes) + { + return new(WaitForNodesCondition.LessThan, nodes); + } + + public static WaitForNodes LessThanOrEqualTo(int nodes) + { + return new(WaitForNodesCondition.LessThanOrEqualTo, nodes); + } + + #region IUrlParameter + + public string GetString(ITransportConfiguration settings) + { + var number = Nodes.ToString(CultureInfo.InvariantCulture); + + return Condition switch + { + WaitForNodesCondition.EqualTo => number, + WaitForNodesCondition.LessThan => $"<{number}", + WaitForNodesCondition.LessThanOrEqualTo => $"<={number}", + WaitForNodesCondition.GreaterThan => $">{number}", + WaitForNodesCondition.GreaterThanOrEqualTo => $">={number}", + _ => throw new ArgumentOutOfRangeException() + }; + } + + #endregion IUrlParameter + + #region IParsable + + public static WaitForNodes Parse(string s, IFormatProvider? provider) => throw new NotImplementedException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out WaitForNodes result) + { + if (string.IsNullOrEmpty(s)) + { + result = default; + return false; + } + + WaitForNodes? parsed = s switch + { + ['<', '=', ..] when TryParseInt(s[2..], out var nodes) => LessThanOrEqualTo(nodes), + ['<', ..] when TryParseInt(s[1..], out var nodes) => LessThan(nodes), + ['>', '=', ..] when TryParseInt(s[2..], out var nodes) => GreaterThanOrEqualTo(nodes), + ['>', ..] when TryParseInt(s[1..], out var nodes) => GreaterThan(nodes), + ['l', 'e', '(', .., ')'] when TryParseInt(s[3..^1], out var nodes) => LessThanOrEqualTo(nodes), + ['l', 't', '(', .., ')'] when TryParseInt(s[3..^1], out var nodes) => LessThan(nodes), + ['g', 'e', '(', .., ')'] when TryParseInt(s[3..^1], out var nodes) => GreaterThanOrEqualTo(nodes), + ['g', 't', '(', .., ')'] when TryParseInt(s[3..^1], out var nodes) => GreaterThan(nodes), + [..] when TryParseInt(s, out var nodes) => EqualTo(nodes), + _ => null + }; + + if (parsed is null) + { + result = default; + return false; + } + + result = parsed.Value; + return true; + + static bool TryParseInt(string s, out int result) + { + return int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out result); + } + } + + #endregion IParsable +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperation.cs index 34dc3cb2fb0..40bf512bb9f 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperation.cs @@ -19,6 +19,17 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; /// The type representing the document being created. public sealed class BulkCreateOperation : BulkOperation { + private static readonly System.Text.Json.JsonEncodedText PropDynamicTemplates = System.Text.Json.JsonEncodedText.Encode("dynamic_templates"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIfPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("if_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropIfSeqNo = System.Text.Json.JsonEncodedText.Encode("if_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropRequireAlias = System.Text.Json.JsonEncodedText.Encode("require_alias"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + /// /// Creates an instance of with the provided document serialized /// as source data. @@ -50,7 +61,7 @@ public sealed class BulkCreateOperation : BulkOperation /// defined in the template. And if a field is already defined in the mapping, then this parameter won’t be used. /// [JsonPropertyName("dynamic_templates")] - public Dictionary? DynamicTemplates { get; set; } + public IDictionary? DynamicTemplates { get; set; } /// protected override string Operation => "create"; @@ -88,6 +99,30 @@ protected override async Task SerializeAsync(Stream stream, IElasticsearchClient } } + private void SerializeOperationAction(IElasticsearchClientSettings settings, Utf8JsonWriter writer) + { + if (!settings.RequestResponseSerializer.TryGetJsonSerializerOptions(out var options)) + { + throw new InvalidOperationException("unreachable"); + } + + writer.WriteStartObject(); + writer.WritePropertyName(Operation); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamicTemplates, DynamicTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, Id, null, null); + writer.WriteProperty(options, PropIfPrimaryTerm, IfPrimaryTerm, null, null); + writer.WriteProperty(options, PropIfSeqNo, IfSequenceNumber, null, null); + writer.WriteProperty(options, PropIndex, Index, null, null); + writer.WriteProperty(options, PropPipeline, Pipeline, null, null); + writer.WriteProperty(options, PropRequireAlias, RequireAlias, null, null); + writer.WriteProperty(options, PropRouting, Routing, null, null); + writer.WriteProperty(options, PropVersion, Version, null, null); + writer.WriteProperty(options, PropVersionType, VersionType, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + private void SetValues(IElasticsearchClientSettings settings) { // This allocates but avoids serialising "routing":null etc. into the operation action @@ -116,13 +151,4 @@ private void SetValues(IElasticsearchClientSettings settings) Id = id; } } - - private void SerializeOperationAction(IElasticsearchClientSettings settings, Utf8JsonWriter writer) - { - var requestResponseSerializer = settings.RequestResponseSerializer; - writer.WriteStartObject(); - writer.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, writer, settings.MemoryStreamFactory); - writer.WriteEndObject(); - } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperationDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperationDescriptor.cs index 9b52cefff6d..5990cb8e531 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperationDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkCreateOperationDescriptor.cs @@ -4,78 +4,41 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; + using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public sealed class BulkCreateOperationDescriptor : BulkOperationDescriptor> +public sealed class BulkCreateOperationDescriptor : + BulkOperationDescriptor> { - private string _pipeline; - private Dictionary _dynamicTemplates; - - private static byte _newline => (byte)'\n'; - - private readonly TSource _document; - - public BulkCreateOperationDescriptor(TSource source) => _document = source; - - public BulkCreateOperationDescriptor(TSource source, IndexName index) : this(source) => IndexNameValue = index; - - public BulkCreateOperationDescriptor Pipeline(string pipeline) => Assign(pipeline, (a, v) => a._pipeline = v); - - public BulkCreateOperationDescriptor DynamicTemplates(Func, FluentDictionary> selector) => Assign(selector, (a, v) => a._dynamicTemplates = v?.Invoke(new FluentDictionary())); + internal new BulkCreateOperation Instance => (BulkCreateOperation)base.Instance; - protected override string Operation => "create"; - - protected override Type ClrType => typeof(TSource); - - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public BulkCreateOperationDescriptor(TSource source) : + base(new BulkCreateOperation(source)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory, formatting); - internalWriter.WriteEndObject(); - internalWriter.Flush(); - stream.WriteByte(_newline); - settings.SourceSerializer.Serialize(GetBody(), stream, formatting); } - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default) + public BulkCreateOperationDescriptor(TSource source, IndexName index) : + base(new BulkCreateOperation(source, index)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory, formatting); - internalWriter.WriteEndObject(); - await internalWriter.FlushAsync(cancellationToken).ConfigureAwait(false); - stream.WriteByte(_newline); - await settings.SourceSerializer.SerializeAsync(GetBody(), stream, formatting, cancellationToken).ConfigureAwait(false); } - protected override void SerializeInternal(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public BulkCreateOperationDescriptor Pipeline(string pipeline) { - if (!string.IsNullOrEmpty(_pipeline)) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, _pipeline, options); - } + Instance.Pipeline = pipeline; + return Self; + } - if (_dynamicTemplates is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, _dynamicTemplates, options); - } + public BulkCreateOperationDescriptor DynamicTemplates(IDictionary? value) + { + Instance.DynamicTemplates = value; + return Self; } - protected override object GetBody() => _document; + public BulkCreateOperationDescriptor DynamicTemplates(Action action) + { + Instance.DynamicTemplates = FluentDictionaryOfStringString.Build(action); + return this; + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperation.cs index 93db7a670f9..f2a59fec5a8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperation.cs @@ -12,53 +12,79 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public class BulkDeleteOperation : BulkOperation +public class BulkDeleteOperation : + BulkOperation { + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIfPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("if_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropIfSeqNo = System.Text.Json.JsonEncodedText.Encode("if_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + public BulkDeleteOperation(Id id) => Id = id; + /// protected override void Serialize(Stream stream, IElasticsearchClientSettings settings) { SetValues(settings); using var writer = new Utf8JsonWriter(stream); - SerializeInternal(settings, writer); + SerializeOperationAction(settings, writer); writer.Flush(); } + /// protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings) { SetValues(settings); var writer = new Utf8JsonWriter(stream); await using (writer.ConfigureAwait(false)) { - SerializeInternal(settings, writer); + SerializeOperationAction(settings, writer); await writer.FlushAsync().ConfigureAwait(false); } } - protected virtual void SetValues(IElasticsearchClientSettings settings) + private void SerializeOperationAction(IElasticsearchClientSettings settings, Utf8JsonWriter writer) { - } + if (!settings.RequestResponseSerializer.TryGetJsonSerializerOptions(out var options)) + { + throw new InvalidOperationException("unreachable"); + } - private void SerializeInternal(IElasticsearchClientSettings settings, Utf8JsonWriter writer) - { - var requestResponseSerializer = settings.RequestResponseSerializer; writer.WriteStartObject(); writer.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, writer, settings.MemoryStreamFactory); + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, Id, null, null); + writer.WriteProperty(options, PropIfPrimaryTerm, IfPrimaryTerm, null, null); + writer.WriteProperty(options, PropIfSeqNo, IfSequenceNumber, null, null); + writer.WriteProperty(options, PropIndex, Index, null, null); + writer.WriteProperty(options, PropRouting, Routing, null, null); + writer.WriteProperty(options, PropVersion, Version, null, null); + writer.WriteProperty(options, PropVersionType, VersionType, null, null); + writer.WriteEndObject(); writer.WriteEndObject(); } + protected virtual void SetValues(IElasticsearchClientSettings settings) + { + } + protected override string Operation => "delete"; protected override Type ClrType => null; } -public sealed class BulkDeleteOperation : BulkDeleteOperation +public sealed class BulkDeleteOperation : + BulkDeleteOperation { - public BulkDeleteOperation(T document) : base (new Id(document)) + public BulkDeleteOperation(T document) : base(new Id(document)) => Document = document; - public BulkDeleteOperation(Id id) : base(id) { } + public BulkDeleteOperation(Id id) : base(id) + { + } [JsonIgnore] public T Document { get; set; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperationDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperationDescriptor.cs index 64ccdf0566e..cf4bc4e2ec5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperationDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkDeleteOperationDescriptor.cs @@ -2,61 +2,43 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System; -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; - namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public class BulkDeleteOperationDescriptor : BulkOperationDescriptor +public class BulkDeleteOperationDescriptor : + BulkOperationDescriptor { - public BulkDeleteOperationDescriptor() { } - - public BulkDeleteOperationDescriptor(Id id) => Id(id); - - protected override string Operation => "delete"; + private new BulkDeleteOperation Instance => (BulkDeleteOperation)base.Instance; - protected override Type ClrType => null; - - protected override object GetBody() => null; + public BulkDeleteOperationDescriptor() : + base(new BulkDeleteOperation(null!)) + { + } - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public BulkDeleteOperationDescriptor(Id id) : + base(new BulkDeleteOperation(id)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory, formatting); - internalWriter.WriteEndObject(); - internalWriter.Flush(); } +} + +public sealed class BulkDeleteOperationDescriptor : + BulkOperationDescriptor +{ + private new BulkDeleteOperation Instance => (BulkDeleteOperation)base.Instance; - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default) + public BulkDeleteOperationDescriptor() : + base(new BulkDeleteOperation(null!)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory, formatting); - internalWriter.WriteEndObject(); - await internalWriter.FlushAsync(cancellationToken).ConfigureAwait(false); } - protected override void SerializeInternal(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public BulkDeleteOperationDescriptor(Id id) : + base(new BulkDeleteOperation(id)) { } -} -public sealed class BulkDeleteOperationDescriptor : BulkDeleteOperationDescriptor -{ - public BulkDeleteOperationDescriptor(TDocument documentToDelete) : base (new Id(documentToDelete)) + public BulkDeleteOperationDescriptor(TDocument documentToDelete) : + this(new Id(documentToDelete)) { - RoutingValue = new Routing(documentToDelete); - IndexNameValue = IndexName.From(); + Instance.Routing = new Routing(documentToDelete); + Instance.Index = IndexName.From(); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperation.cs index dcd9179a838..80c424861fe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperation.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Text.Json; -using System.Text.Json.Serialization; using System.Threading.Tasks; using Elastic.Transport.Extensions; using Elastic.Clients.Elasticsearch.Serialization; @@ -15,6 +14,17 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; public sealed class BulkIndexOperation : BulkOperation { + private static readonly System.Text.Json.JsonEncodedText PropDynamicTemplates = System.Text.Json.JsonEncodedText.Encode("dynamic_templates"); + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIfPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("if_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropIfSeqNo = System.Text.Json.JsonEncodedText.Encode("if_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropPipeline = System.Text.Json.JsonEncodedText.Encode("pipeline"); + private static readonly System.Text.Json.JsonEncodedText PropRequireAlias = System.Text.Json.JsonEncodedText.Encode("require_alias"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + /// /// Creates an instance of with the provided document serialized /// as source data. @@ -34,19 +44,65 @@ public sealed class BulkIndexOperation : BulkOperation /// The which can represent an index, alias or data stream. public BulkIndexOperation(T document, IndexName index) : this(document) => Index = index; - [JsonPropertyName("pipeline")] public string? Pipeline { get; set; } - [JsonPropertyName("dynamic_templates")] - public Dictionary? DynamicTemplates { get; set; } + public IDictionary? DynamicTemplates { get; set; } - [JsonIgnore] public T Document { get; set; } protected override string Operation => "index"; protected override Type ClrType => typeof(T); + /// + protected override void Serialize(Stream stream, IElasticsearchClientSettings settings) + { + SetValues(settings); + using var writer = new Utf8JsonWriter(stream); + SerializeOperationAction(settings, writer); + writer.Flush(); + stream.WriteByte(SerializationConstants.Newline); + settings.SourceSerializer.Serialize(Document, stream); + } + + /// + protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings) + { + SetValues(settings); + var writer = new Utf8JsonWriter(stream); + await using (writer.ConfigureAwait(false)) + { + SerializeOperationAction(settings, writer); + await writer.FlushAsync().ConfigureAwait(false); + stream.WriteByte(SerializationConstants.Newline); + await settings.SourceSerializer.SerializeAsync(Document, stream).ConfigureAwait(false); + } + } + + private void SerializeOperationAction(IElasticsearchClientSettings settings, Utf8JsonWriter writer) + { + if (!settings.RequestResponseSerializer.TryGetJsonSerializerOptions(out var options)) + { + throw new InvalidOperationException("unreachable"); + } + + writer.WriteStartObject(); + writer.WritePropertyName(Operation); + writer.WriteStartObject(); + writer.WriteProperty(options, PropDynamicTemplates, DynamicTemplates, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, null)); + writer.WriteProperty(options, PropId, Id, null, null); + writer.WriteProperty(options, PropIfPrimaryTerm, IfPrimaryTerm, null, null); + writer.WriteProperty(options, PropIfSeqNo, IfSequenceNumber, null, null); + writer.WriteProperty(options, PropIndex, Index, null, null); + writer.WriteProperty(options, PropPipeline, Pipeline, null, null); + writer.WriteProperty(options, PropRequireAlias, RequireAlias, null, null); + writer.WriteProperty(options, PropRouting, Routing, null, null); + writer.WriteProperty(options, PropVersion, Version, null, null); + writer.WriteProperty(options, PropVersionType, VersionType, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + private void SetValues(IElasticsearchClientSettings settings) { // This allocates but avoids serialising "routing":null etc. into the operation action @@ -75,37 +131,9 @@ private void SetValues(IElasticsearchClientSettings settings) Id = id; } } +} - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings) - { - SetValues(settings); - var writer = new Utf8JsonWriter(stream); - SerializeOperationAction(writer, settings); - writer.Flush(); - stream.WriteByte(SerializationConstants.Newline); - settings.SourceSerializer.Serialize(Document, stream); - } - - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings) - { - SetValues(settings); - var writer = new Utf8JsonWriter(stream); - await using (writer.ConfigureAwait(false)) - { - SerializeOperationAction(writer, settings); - await writer.FlushAsync().ConfigureAwait(false); - stream.WriteByte(SerializationConstants.Newline); - await settings.SourceSerializer.SerializeAsync(Document, stream).ConfigureAwait(false); - } - } - - private void SerializeOperationAction(Utf8JsonWriter writer, IElasticsearchClientSettings settings) - { - var requestResponseSerializer = settings.RequestResponseSerializer; - - writer.WriteStartObject(); - writer.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, writer); - writer.WriteEndObject(); - } +public class TestA +{ + public string X { get; set; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperationDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperationDescriptor.cs index ed64fce6c4a..857716bc77b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperationDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkIndexOperationDescriptor.cs @@ -4,85 +4,41 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; + using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using Elastic.Transport.Extensions; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public sealed class BulkIndexOperationDescriptor : BulkOperationDescriptor> +public sealed class BulkIndexOperationDescriptor : + BulkOperationDescriptor> { - private string _pipeline; - - private Dictionary _dynamicTemplates; - - private static byte _newline => (byte)'\n'; - - private readonly TSource _document; - - public BulkIndexOperationDescriptor(TSource source) => _document = source; - - public BulkIndexOperationDescriptor(TSource source, IndexName index) : this(source) => IndexNameValue = index; - - public BulkIndexOperationDescriptor Pipeline(string pipeline) => Assign(pipeline, (a, v) => a._pipeline = v); - - - public BulkIndexOperationDescriptor DynamicTemplates(Func, FluentDictionary> selector) => - Assign(selector, (a, v) => a._dynamicTemplates = v?.Invoke(new FluentDictionary())); + internal new BulkIndexOperation Instance => (BulkIndexOperation)base.Instance; - protected override string Operation => "index"; - - protected override Type ClrType => typeof(TSource); - - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public BulkIndexOperationDescriptor(TSource source) : + base(new BulkIndexOperation(source)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory); - internalWriter.WriteEndObject(); - internalWriter.Flush(); - stream.WriteByte(_newline); - settings.SourceSerializer.Serialize(_document, stream); } - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default) + public BulkIndexOperationDescriptor(TSource source, IndexName index) : base( + new BulkIndexOperation(source, index)) { - var requestResponseSerializer = settings.RequestResponseSerializer; - var internalWriter = new Utf8JsonWriter(stream); - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.Serialize(this, internalWriter, settings.MemoryStreamFactory); - internalWriter.WriteEndObject(); - await internalWriter.FlushAsync(cancellationToken).ConfigureAwait(false); - stream.WriteByte(_newline); - await settings.SourceSerializer.SerializeAsync(_document, stream, formatting, cancellationToken).ConfigureAwait(false); } - protected override void SerializeInternal(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public BulkIndexOperationDescriptor Pipeline(string pipeline) { - if (!string.IsNullOrEmpty(_pipeline)) - { - writer.WritePropertyName("pipeline"); - JsonSerializer.Serialize(writer, _pipeline, options); - } - - if (_dynamicTemplates is not null) - { - writer.WritePropertyName("dynamic_templates"); - JsonSerializer.Serialize(writer, _dynamicTemplates, options); - } + Instance.Pipeline = pipeline; + return Self; } - protected override object GetBody() => _document; - - protected override Id GetIdForOperation(Inferrer inferrer) => IdValue ?? new Id(_document); + public BulkIndexOperationDescriptor DynamicTemplates(IDictionary? value) + { + Instance.DynamicTemplates = value; + return Self; + } - protected override Routing GetRoutingForOperation(Inferrer inferrer) => RoutingValue ?? new Routing(_document); + public BulkIndexOperationDescriptor DynamicTemplates(Action action) + { + Instance.DynamicTemplates = FluentDictionaryOfStringString.Build(action); + return this; + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperation.cs index 562d60a61b7..66da03aa485 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperation.cs @@ -6,6 +6,7 @@ using System.IO; using System.Text.Json.Serialization; using System.Threading.Tasks; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; @@ -17,9 +18,12 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; /// /// This is an abstract class. /// -public abstract class BulkOperation : IBulkOperation, IStreamSerializable +public abstract class BulkOperation : + IBulkOperation, + IStreamSerializable { - internal BulkOperation() { } + internal BulkOperation() + { } /// /// The document ID. @@ -98,11 +102,11 @@ internal BulkOperation() { } /// The for the current client instance. protected abstract Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings); - void IBulkOperation.PrepareIndex(IndexName bulkRequestIndex) + void IBulkOperation.PrepareIndex(IndexName? bulkRequestIndex) { Index ??= bulkRequestIndex ?? ClrType; - if (bulkRequestIndex is not null && Index.Equals(bulkRequestIndex)) + if (bulkRequestIndex is not null && (Index?.Equals(bulkRequestIndex) ?? false)) Index = null; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperationDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperationDescriptor.cs index 0451a0ba7c8..e5bc6d44002 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperationDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkOperationDescriptor.cs @@ -2,146 +2,70 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System; -using System.IO; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; - namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public abstract class BulkOperationDescriptor : SerializableDescriptor, IBulkOperation, IStreamSerializable where TDescriptor : BulkOperationDescriptor +public abstract class BulkOperationDescriptor + where TDescriptor : BulkOperationDescriptor { - private long? _version; - private VersionType? _versionType; - private bool? _requireAlias; - - internal BulkOperationDescriptor() { } - - protected IndexName IndexNameValue { get; set; } - protected Id IdValue { get; set; } - protected Routing RoutingValue { get; set; } - protected long? IfSequenceNoValue { get; set; } - protected long? IfPrimaryTermValue { get; set; } - protected abstract string Operation { get; } - protected abstract Type ClrType { get; } - - public TDescriptor Id(Id id) => Assign(id, (a, v) => a.IdValue = v); - - public TDescriptor IfSequenceNumber(long? ifSequenceNumber) => Assign(ifSequenceNumber, (a, v) => a.IfSequenceNoValue = v); - - public TDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Assign(ifPrimaryTerm, (a, v) => a.IfPrimaryTermValue = v); - - public TDescriptor Index(IndexName index) => Assign(index, (a, v) => a.IndexNameValue = v); - - public TDescriptor Index() => Assign(typeof(T), (a, v) => a.IndexNameValue = v); - public TDescriptor RequireAlias(bool? requireAlias = true) => Assign(requireAlias, (a, v) => a._requireAlias = v); - - public TDescriptor Routing(Routing routing) => Assign(routing, (a, v) => a.RoutingValue = v); - - public TDescriptor Version(long version) => Assign(version, (a, v) => a._version = v); - - public TDescriptor VersionType(VersionType? versionType) => Assign(versionType, (a, v) => a._versionType = v); + protected TDescriptor Self => (TDescriptor)this; + internal BulkOperation Instance { get; } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal BulkOperationDescriptor(BulkOperation instance) { - IdValue = GetIdForOperation(settings.Inferrer); - RoutingValue = GetRoutingForOperation(settings.Inferrer); - - writer.WriteStartObject(); - - if (IdValue is not null) - { - // TODO - This flow is a bit inefficient and annoying just to get "clean" JSON - var id = IdValue.GetString(settings); - - if (!string.IsNullOrEmpty(id)) - { - writer.WritePropertyName("_id"); - writer.WriteStringValue(id); - } - } - - if (IfPrimaryTermValue.HasValue) - { - writer.WritePropertyName("if_primary_term"); - JsonSerializer.Serialize(writer, IfPrimaryTermValue.Value, options); - } - - if (IfSequenceNoValue.HasValue) - { - writer.WritePropertyName("if_seq_no"); - JsonSerializer.Serialize(writer, IfSequenceNoValue.Value, options); - } - - if (IndexNameValue is not null) - { - writer.WritePropertyName("_index"); - JsonSerializer.Serialize(writer, IndexNameValue, options); - } - - if (RoutingValue is not null) - { - // TODO - This flow is a bit inefficient and annoying just to get "clean" JSON - var value = RoutingValue.GetString(settings); - - if (!string.IsNullOrEmpty(value)) - { - writer.WritePropertyName("routing"); - writer.WriteStringValue(value); - } - } - - if (_requireAlias.HasValue) - { - writer.WritePropertyName("require_alias"); - JsonSerializer.Serialize(writer, _requireAlias.Value, options); - } - - if (_version.HasValue) - { - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, _version.Value, options); - } - - if (_versionType.HasValue) - { - writer.WritePropertyName("version_type"); - JsonSerializer.Serialize(writer, _versionType.Value, options); - } - - SerializeInternal(writer, options, settings); - - writer.WriteEndObject(); + Instance = instance; } - /// - /// Must be overridden in derived operations to write their own properties to the . - /// - protected abstract void SerializeInternal(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); - - protected abstract void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting); + public TDescriptor Id(Id id) + { + Instance.Id = id; + return Self; + } - protected abstract Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default); + public TDescriptor IfSequenceNumber(long? ifSequenceNumber) + { + Instance.IfSequenceNumber = ifSequenceNumber; + return Self; + } - void IStreamSerializable.Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) => Serialize(stream, settings, formatting); + public TDescriptor IfPrimaryTerm(long? ifPrimaryTerm) + { + Instance.IfPrimaryTerm = ifPrimaryTerm; + return Self; + } - Task IStreamSerializable.SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) => SerializeAsync(stream, settings, formatting); + public TDescriptor Index(IndexName index) + { + Instance.Index = index; + return Self; + } - protected abstract object GetBody(); + public TDescriptor Index() + { + Instance.Index = typeof(T); + return Self; + } - protected virtual Id GetIdForOperation(Inferrer inferrer) => IdValue ?? new Id(GetBody()); + public TDescriptor RequireAlias(bool? requireAlias = true) + { + Instance.RequireAlias = requireAlias; + return Self; + } - protected virtual Routing GetRoutingForOperation(Inferrer inferrer) => RoutingValue ?? new Routing(GetBody()); + public TDescriptor Routing(Routing routing) + { + Instance.Routing = routing; + return Self; + } - void IBulkOperation.PrepareIndex(IndexName bulkRequestIndex) + public TDescriptor Version(long version) { - IndexNameValue ??= bulkRequestIndex ?? ClrType; + Instance.Version = version; + return Self; + } - if (bulkRequestIndex is not null && IndexNameValue.Equals(bulkRequestIndex)) - IndexNameValue = null; + public TDescriptor VersionType(VersionType? versionType) + { + Instance.VersionType = versionType; + return Self; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkResponseItemConverter.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkResponseItemConverter.cs index 992bcd61e8d..380a81df2f7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkResponseItemConverter.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkResponseItemConverter.cs @@ -3,64 +3,164 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Serialization; + namespace Elastic.Clients.Elasticsearch.Core.Bulk; -internal sealed class BulkResponseItemConverter : JsonConverter> +internal sealed class BulkResponseItemConverter : JsonConverter { - public override IReadOnlyList? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + private static readonly JsonEncodedText PropError = JsonEncodedText.Encode("error"); + private static readonly JsonEncodedText PropForcedRefresh = JsonEncodedText.Encode("forced_refresh"); + private static readonly JsonEncodedText PropGet = JsonEncodedText.Encode("get"); + private static readonly JsonEncodedText PropId = JsonEncodedText.Encode("_id"); + private static readonly JsonEncodedText PropIndex = JsonEncodedText.Encode("_index"); + private static readonly JsonEncodedText PropPrimaryTerm = JsonEncodedText.Encode("_primary_term"); + private static readonly JsonEncodedText PropResult = JsonEncodedText.Encode("result"); + private static readonly JsonEncodedText PropSeqNo = JsonEncodedText.Encode("_seq_no"); + private static readonly JsonEncodedText PropShards = JsonEncodedText.Encode("_shards"); + private static readonly JsonEncodedText PropStatus = JsonEncodedText.Encode("status"); + private static readonly JsonEncodedText PropVersion = JsonEncodedText.Encode("_version"); + + public override ResponseItem Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType != JsonTokenType.StartArray) - throw new JsonException($"Unexpected token in bulk response items. Read {reader.TokenType} but was expecting {JsonTokenType.StartArray}."); + reader.ValidateToken(JsonTokenType.StartObject); + + reader.Read(); + + reader.ValidateToken(JsonTokenType.PropertyName); + + var operation = reader.ReadPropertyName(options); + reader.Read(); - var responseItems = new List(); + reader.ValidateToken(JsonTokenType.StartObject); - while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + LocalJsonValue propError = default; + LocalJsonValue propForcedRefresh = default; + LocalJsonValue>?> propGet = default; + LocalJsonValue propId = default; + LocalJsonValue propIndex = default; + LocalJsonValue propPrimaryTerm = default; + LocalJsonValue propResult = default; + LocalJsonValue propSeqNo = default; + LocalJsonValue propShards = default; + LocalJsonValue propStatus = default; + LocalJsonValue propVersion = default; + + while (reader.Read() && reader.TokenType is JsonTokenType.PropertyName) { - if (reader.TokenType != JsonTokenType.StartObject) - throw new JsonException($"Unexpected token in bulk response items. Read {reader.TokenType} but was expecting {JsonTokenType.StartObject}."); + if (propError.TryReadProperty(ref reader, options, PropError, null)) + { + continue; + } - reader.Read(); + if (propForcedRefresh.TryReadProperty(ref reader, options, PropForcedRefresh, null)) + { + continue; + } - if (reader.TokenType != JsonTokenType.PropertyName) - throw new JsonException($"Unexpected token in bulk response items. Read {reader.TokenType} but was expecting {JsonTokenType.PropertyName}."); + if (propGet.TryReadProperty(ref reader, options, PropGet, null)) + { + continue; + } - ResponseItem responseItem; + if (propId.TryReadProperty(ref reader, options, PropId, null)) + { + continue; + } - if (reader.ValueTextEquals("index")) + if (propIndex.TryReadProperty(ref reader, options, PropIndex, null)) { - responseItem = JsonSerializer.Deserialize(ref reader, options); + continue; } - else if (reader.ValueTextEquals("delete")) + + if (propPrimaryTerm.TryReadProperty(ref reader, options, PropPrimaryTerm, null)) { - responseItem = JsonSerializer.Deserialize(ref reader, options); + continue; } - else if (reader.ValueTextEquals("create")) + + if (propResult.TryReadProperty(ref reader, options, PropResult, null)) { - responseItem = JsonSerializer.Deserialize(ref reader, options); + continue; } - else if (reader.ValueTextEquals("update")) + + if (propSeqNo.TryReadProperty(ref reader, options, PropSeqNo, null)) { - responseItem = JsonSerializer.Deserialize(ref reader, options); + continue; } - else + + if (propShards.TryReadProperty(ref reader, options, PropShards, null)) + { + continue; + } + + if (propStatus.TryReadProperty(ref reader, options, PropStatus, null)) { - throw new JsonException("Unexpected operation type in bulk response items."); + continue; } - responseItems.Add(responseItem); + if (propVersion.TryReadProperty(ref reader, options, PropVersion, null)) + { + continue; + } - reader.Read(); + if (options.UnmappedMemberHandling is JsonUnmappedMemberHandling.Skip) + { + reader.Skip(); + } - if (reader.TokenType != JsonTokenType.EndObject) - throw new JsonException($"Unexpected token in bulk response items. Read {reader.TokenType} but was expecting {JsonTokenType.EndObject}."); + throw new JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); } - return responseItems; + reader.ValidateToken(JsonTokenType.EndObject); + + reader.Read(); + + reader.ValidateToken(JsonTokenType.EndObject); + + ResponseItem result = operation switch + { + OperationType.Update => new BulkUpdateResponseItem(JsonConstructorSentinel.Instance), + OperationType.Index => new BulkIndexResponseItem(JsonConstructorSentinel.Instance), + OperationType.Delete => new BulkDeleteResponseItem(JsonConstructorSentinel.Instance), + OperationType.Create => new CreateResponseItem(JsonConstructorSentinel.Instance), + _ => throw new InvalidOperationException() + }; + + result.Error = propError.Value; + result.ForcedRefresh = propForcedRefresh.Value; + result.Get = propGet.Value; + result.Id = propId.Value; + result.Index = propIndex.Value; + result.PrimaryTerm = propPrimaryTerm.Value; + result.Result = propResult.Value; + result.SeqNo = propSeqNo.Value; + result.Shards = propShards.Value; + result.Status = propStatus.Value; + result.Version = propVersion.Value; + + return result; } - public override void Write(Utf8JsonWriter writer, IReadOnlyList value, JsonSerializerOptions options) => throw new NotImplementedException(); + public override void Write(Utf8JsonWriter writer, ResponseItem value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WritePropertyName(value.Operation); + writer.WriteStartObject(); + writer.WriteProperty(options, PropError, value.Error, null, null); + writer.WriteProperty(options, PropForcedRefresh, value.ForcedRefresh, null, null); + writer.WriteProperty(options, PropGet, value.Get, null, null); + writer.WriteProperty(options, PropId, value.Id, null, null); + writer.WriteProperty(options, PropIndex, value.Index, null, null); + writer.WriteProperty(options, PropPrimaryTerm, value.PrimaryTerm, null, null); + writer.WriteProperty(options, PropResult, value.Result, null, null); + writer.WriteProperty(options, PropSeqNo, value.SeqNo, null, null); + writer.WriteProperty(options, PropShards, value.Shards, null, null); + writer.WriteProperty(options, PropStatus, value.Status, null, null); + writer.WriteProperty(options, PropVersion, value.Version, null, null); + writer.WriteEndObject(); + writer.WriteEndObject(); + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateBody.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateBody.cs index 1451045cb03..0b978370798 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateBody.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateBody.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; using System.Text.Json; using Elastic.Transport.Extensions; using Elastic.Clients.Elasticsearch.Core.Search; @@ -9,7 +10,7 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; -internal abstract class BulkUpdateBody : ISelfSerializable +internal abstract class BulkUpdateBody { public long? IfSequenceNumber { get; set; } @@ -17,7 +18,7 @@ internal abstract class BulkUpdateBody : ISelfSerializable protected abstract void SerializeProperties(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings); - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + internal void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -45,13 +46,13 @@ internal class BulkUpdateBody : BulkUpdateBody public TPartialUpdate PartialUpdate { get; set; } - public Script Script { get; set; } + public Script? Script { get; set; } public bool? ScriptedUpsert { get; set; } public TDocument Upsert { get; set; } - public Union Source { get; set; } + public Union? Source { get; set; } protected override void SerializeProperties(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { @@ -82,14 +83,23 @@ protected override void SerializeProperties(Utf8JsonWriter writer, JsonSerialize if (Upsert is not null) { writer.WritePropertyName("upsert"); - settings.SourceSerializer.Serialize(Upsert, writer, null); + settings.SourceSerializer.Serialize(Upsert, writer, settings.MemoryStreamFactory); } if (Source is not null) { writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, Source, options); + switch (Source.Tag) + { + case UnionTag.T1: + JsonSerializer.Serialize(writer, Source.Value1, options); + break; + case UnionTag.T2: + JsonSerializer.Serialize(writer, Source.Value2, options); + break; + default: + throw new InvalidOperationException(); + } } } } - diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperation.cs index d3ea1a0a78d..d6c19e053c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperation.cs @@ -2,56 +2,63 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; using System.IO; using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading; using System.Threading.Tasks; + using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; using Elastic.Transport.Extensions; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public abstract class BulkUpdateOperation : BulkOperation +public abstract class BulkUpdateOperation : + BulkOperation { - protected internal BulkUpdateOperation() : base() { } - - private static byte _newline => (byte)'\n'; + private static readonly System.Text.Json.JsonEncodedText PropId = System.Text.Json.JsonEncodedText.Encode("_id"); + private static readonly System.Text.Json.JsonEncodedText PropIfPrimaryTerm = System.Text.Json.JsonEncodedText.Encode("if_primary_term"); + private static readonly System.Text.Json.JsonEncodedText PropIfSeqNo = System.Text.Json.JsonEncodedText.Encode("if_seq_no"); + private static readonly System.Text.Json.JsonEncodedText PropIndex = System.Text.Json.JsonEncodedText.Encode("_index"); + private static readonly System.Text.Json.JsonEncodedText PropRequireAlias = System.Text.Json.JsonEncodedText.Encode("require_alias"); + private static readonly System.Text.Json.JsonEncodedText PropRetryOnConflict = System.Text.Json.JsonEncodedText.Encode("retry_on_conflict"); + private static readonly System.Text.Json.JsonEncodedText PropRouting = System.Text.Json.JsonEncodedText.Encode("routing"); + private static readonly System.Text.Json.JsonEncodedText PropVersion = System.Text.Json.JsonEncodedText.Encode("version"); + private static readonly System.Text.Json.JsonEncodedText PropVersionType = System.Text.Json.JsonEncodedText.Encode("version_type"); + + protected internal BulkUpdateOperation() : base() + { + } - [JsonPropertyName("retry_on_conflict")] public int? RetryOnConflict { get; set; } protected override string Operation => "update"; protected abstract void BeforeSerialize(IElasticsearchClientSettings settings); - /// - /// Serialise the operation action line for the NDJSON stream. - /// - /// - /// - protected abstract void WriteOperation(Utf8JsonWriter writer, JsonSerializerOptions options = null); - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings) { BeforeSerialize(settings); - var requestResponseSerializer = settings.RequestResponseSerializer; + if (!settings.RequestResponseSerializer.TryGetJsonSerializerOptions(out var options)) + { + throw new InvalidOperationException("unreachable"); + } - var internalWriter = new Utf8JsonWriter(stream); + using (var writer = new Utf8JsonWriter(stream)) + { + SerializeOperationAction(writer, options); + writer.Flush(); + } - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - WriteOperation(internalWriter, options); - internalWriter.WriteEndObject(); - internalWriter.Flush(); + stream.WriteByte(SerializationConstants.Newline); + var body = GetBody(); - stream.WriteByte(_newline); + using (var writer = new Utf8JsonWriter(stream)) + { + body.Serialize(writer, options, settings); + writer.Flush(); + } - var body = GetBody(); - settings.RequestResponseSerializer.Serialize(body, stream); stream.Flush(); } @@ -59,81 +66,57 @@ protected override async Task SerializeAsync(Stream stream, IElasticsearchClient { BeforeSerialize(settings); - var internalWriter = new Utf8JsonWriter(stream); - SerializeOperationAction(settings, internalWriter); - internalWriter.Flush(); + if (!settings.RequestResponseSerializer.TryGetJsonSerializerOptions(out var options)) + { + throw new InvalidOperationException("unreachable"); + } - stream.WriteByte(_newline); + var writer = new Utf8JsonWriter(stream); + await using (writer.ConfigureAwait(false)) + { + SerializeOperationAction(writer, options); + await writer.FlushAsync().ConfigureAwait(false); + } + stream.WriteByte(SerializationConstants.Newline); var body = GetBody(); - await settings.RequestResponseSerializer.SerializeAsync(body, stream).ConfigureAwait(false); + + writer = new Utf8JsonWriter(stream); + await using (writer.ConfigureAwait(false)) + { + body.Serialize(writer, options, settings); + await writer.FlushAsync().ConfigureAwait(false); + } + await stream.FlushAsync().ConfigureAwait(false); } - private void SerializeOperationAction(IElasticsearchClientSettings settings, Utf8JsonWriter writer) + private void SerializeOperationAction(Utf8JsonWriter writer, JsonSerializerOptions options) { - var requestResponseSerializer = settings.RequestResponseSerializer; writer.WriteStartObject(); writer.WritePropertyName(Operation); - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - WriteOperation(writer, options); + writer.WriteStartObject(); + writer.WriteProperty(options, PropId, Id, null, null); + writer.WriteProperty(options, PropIfPrimaryTerm, IfPrimaryTerm, null, null); + writer.WriteProperty(options, PropIfSeqNo, IfSequenceNumber, null, null); + writer.WriteProperty(options, PropIndex, Index, null, null); + writer.WriteProperty(options, PropRequireAlias, RequireAlias, null, null); + writer.WriteProperty(options, PropRetryOnConflict, RetryOnConflict, null, null); + writer.WriteProperty(options, PropRouting, Routing, null, null); + writer.WriteProperty(options, PropVersion, Version, null, null); + writer.WriteProperty(options, PropVersionType, VersionType, null, null); + writer.WriteEndObject(); writer.WriteEndObject(); } - protected abstract object GetBody(); + private protected abstract BulkUpdateBody GetBody(); } -public abstract class BulkUpdateOperationDescriptorBase : BulkOperationDescriptor> +public abstract class BulkUpdateOperationDescriptorBase : + BulkOperationDescriptor> { - private static byte _newline => (byte)'\n'; - - protected override string Operation => "update"; - - protected abstract void BeforeSerialize(IElasticsearchClientSettings settings); - - protected abstract void WriteOperation(Utf8JsonWriter writer, JsonSerializerOptions options = null); - - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting = SerializationFormatting.None) - { - BeforeSerialize(settings); - - var requestResponseSerializer = settings.RequestResponseSerializer; - - var internalWriter = new Utf8JsonWriter(stream); - - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - WriteOperation(internalWriter, options); - internalWriter.WriteEndObject(); - internalWriter.Flush(); - - stream.WriteByte(_newline); - var body = GetBody(); - settings.RequestResponseSerializer.Serialize(body, stream, formatting); - } - - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default) + protected BulkUpdateOperationDescriptorBase(BulkOperation instance) : + base(instance) { - BeforeSerialize(settings); - - var requestResponseSerializer = settings.RequestResponseSerializer; - - var internalWriter = new Utf8JsonWriter(stream); - - internalWriter.WriteStartObject(); - internalWriter.WritePropertyName(Operation); - - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - WriteOperation(internalWriter, options); - - internalWriter.WriteEndObject(); - internalWriter.Flush(); - - stream.WriteByte(_newline); - - var body = GetBody(); - - await settings.SourceSerializer.SerializeAsync(body, stream, formatting).ConfigureAwait(false); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationDescriptor.cs index 45b3802a956..960d57ddbab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationDescriptor.cs @@ -3,231 +3,83 @@ // See the LICENSE file in the project root for more information. using System; -using System.IO; -using System.Linq; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Elastic.Transport; -using Elastic.Transport.Extensions; + using Elastic.Clients.Elasticsearch.Core.Search; -using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public sealed class BulkUpdateOperationDescriptor : BulkOperationDescriptor> +public sealed class BulkUpdateOperationDescriptor : + BulkOperationDescriptor> { - private static byte _newline => (byte)'\n'; - - public BulkUpdateOperationDescriptor() { } - - public BulkUpdateOperationDescriptor(Id id) => Id(id); - - private TPartialDocument _document; - private TDocument _idFrom; - private TDocument _upsert; - private bool? _docAsUpsert; - private bool? _scriptedUpsert; - private int? _retriesOnConflict; - private Script _script; - private Union _source; - - private Action _scriptAction; - - protected override string Operation => "update"; - - protected override Type ClrType => typeof(TDocument); - - public BulkUpdateOperationDescriptor Doc(TPartialDocument document) => Assign(document, (a, v) => a._document = v); - - public BulkUpdateOperationDescriptor DocAsUpsert(bool? partialDocumentAsUpsert = true) => - Assign(partialDocumentAsUpsert, (a, v) => a._docAsUpsert = v); + internal new BulkUpdateOperation Instance => (BulkUpdateOperation)base.Instance; - public BulkUpdateOperationDescriptor IdFrom(TDocument idFrom, bool useAsUpsert = false) + public BulkUpdateOperationDescriptor() : + base(new BulkUpdateOperation(null!)) { - Assign(idFrom, (a, v) => a._idFrom = v); - return useAsUpsert ? Upsert(idFrom) : this; } - public BulkUpdateOperationDescriptor RetriesOnConflict(int? retriesOnConflict) => - Assign(retriesOnConflict, (a, v) => a._retriesOnConflict = v); - - public BulkUpdateOperationDescriptor Script(Action configure) + public BulkUpdateOperationDescriptor(Id id) : + base(new BulkUpdateOperation(id)) { - _script = null; - - return Assign(configure, (a, v) => a._scriptAction = v); } - public BulkUpdateOperationDescriptor Script(Script script) + public BulkUpdateOperationDescriptor Doc(TPartialDocument document) { - _scriptAction = null; - - return Assign(script, (a, v) => a._script = v); + Instance.Doc = document; + return Self; } - public BulkUpdateOperationDescriptor ScriptedUpsert(bool? scriptedUpsert = true) => - Assign(scriptedUpsert, (a, v) => a._scriptedUpsert = v); - - public BulkUpdateOperationDescriptor Source(Union source) => - Assign(source, (a, v) => a._source = v); - - public BulkUpdateOperationDescriptor Upsert(TDocument document) => Assign(document, (a, v) => a._upsert = v); - - protected override object GetBody() + public BulkUpdateOperationDescriptor DocAsUpsert(bool? partialDocumentAsUpsert = true) { - if (_scriptAction is not null) - return null; - - return new BulkUpdateBody - { - PartialUpdate = _document, - Script = _script, - Upsert = _upsert, - DocAsUpsert = _docAsUpsert, - ScriptedUpsert = _scriptedUpsert, - IfPrimaryTerm = IfPrimaryTermValue, - IfSequenceNumber = IfSequenceNoValue, - Source = _source - }; + Instance.DocAsUpsert = partialDocumentAsUpsert; + return Self; } - protected override void Serialize(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting) + public BulkUpdateOperationDescriptor IdFrom(TDocument idFrom, bool useAsUpsert = false) { - var requestResponseSerializer = settings.RequestResponseSerializer; - - var writer = new Utf8JsonWriter(stream); - - writer.WriteStartObject(); - writer.WritePropertyName(Operation); - - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - JsonSerializer.Serialize>(writer, this, options); - - writer.WriteEndObject(); - writer.Flush(); - - stream.WriteByte(_newline); - - var body = GetBody(); + Instance.Id = Elasticsearch.Id.From(idFrom); - // In the simple path, we have a BulkUpdateBody we can simply serialise. - // Only if we have some deferred delegates to configure descriptors so we need to manually serialise the data. - if (body is not null) + if (useAsUpsert) { - settings.RequestResponseSerializer.Serialize(body, stream, formatting); + Instance.Upsert = idFrom; } - else - { - writer = new Utf8JsonWriter(stream); - writer.WriteStartObject(); - - WriteBody(settings, writer, options); - writer.WriteEndObject(); - writer.Flush(); - } + return Self; } - private void WriteBody(IElasticsearchClientSettings settings, Utf8JsonWriter writer, JsonSerializerOptions options) + public BulkUpdateOperationDescriptor RetriesOnConflict(int? retriesOnConflict) { - if (_scriptAction is not null) - { - writer.WritePropertyName("script"); - JsonSerializer.Serialize(writer, new ScriptDescriptor(_scriptAction), options); - } - - if (_document is not null) - { - writer.WritePropertyName("doc"); - settings.SourceSerializer.Serialize(_document, writer, null); - } - - if (_scriptedUpsert.HasValue) - { - writer.WritePropertyName("scripted_upsert"); - JsonSerializer.Serialize(writer, _scriptedUpsert.Value, options); - } - - if (_docAsUpsert.HasValue) - { - writer.WritePropertyName("doc_as_upsert"); - JsonSerializer.Serialize(writer, _docAsUpsert.Value, options); - } - - if (_upsert is not null) - { - writer.WritePropertyName("upsert"); - settings.SourceSerializer.Serialize(_upsert, writer, null); - } - - if (_source is not null) - { - writer.WritePropertyName("_source"); - JsonSerializer.Serialize(writer, Source, options); - } + Instance.RetryOnConflict = retriesOnConflict; + return Self; } - protected override async Task SerializeAsync(Stream stream, IElasticsearchClientSettings settings, SerializationFormatting formatting, CancellationToken cancellationToken = default) + public BulkUpdateOperationDescriptor Script(Action configure) { - var requestResponseSerializer = settings.RequestResponseSerializer; - - var writer = new Utf8JsonWriter(stream); - - writer.WriteStartObject(); - writer.WritePropertyName(Operation); - - requestResponseSerializer.TryGetJsonSerializerOptions(out var options); - JsonSerializer.Serialize>(writer, this, options); - - writer.WriteEndObject(); - await writer.FlushAsync(cancellationToken).ConfigureAwait(false); - - stream.WriteByte(_newline); - - var body = GetBody(); - - // In the simple path, we have a BulkUpdateBody we can simply serialise. - // Only if we have some deferred delegates to configure descriptors so we need to manually serialise the data. - if (body is not null) - { - await settings.RequestResponseSerializer.SerializeAsync(body, stream, formatting, cancellationToken).ConfigureAwait(false); - } - else - { - writer = new Utf8JsonWriter(stream); - writer.WriteStartObject(); - - WriteBody(settings, writer, options); - - writer.WriteEndObject(); - await writer.FlushAsync(cancellationToken).ConfigureAwait(false); - } + Instance.Script = ScriptDescriptor.Build(configure); + return Self; } - protected override void SerializeInternal(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + public BulkUpdateOperationDescriptor Script(Script script) { - if (_retriesOnConflict.HasValue) - { - writer.WritePropertyName("retry_on_conflict"); - writer.WriteNumberValue(_retriesOnConflict.Value); - } + Instance.Script = script; + return Self; } - protected override Id GetIdForOperation(Inferrer inferrer) => - IdValue ?? new Id(new object[] { _idFrom, _upsert }.FirstOrDefault(o => o != null)); - - protected override Routing GetRoutingForOperation(Inferrer inferrer) + public BulkUpdateOperationDescriptor ScriptedUpsert(bool? scriptedUpsert = true) { - if (RoutingValue is not null) - return RoutingValue; - - if (_idFrom != null) - return new Routing(_idFrom); + Instance.ScriptedUpsert = scriptedUpsert; + return Self; + } - if (_upsert != null) - return new Routing(_upsert); + public BulkUpdateOperationDescriptor Source(Union source) + { + Instance.Source = source; + return Self; + } - return null; + public BulkUpdateOperationDescriptor Upsert(TDocument document) + { + Instance.Upsert = document; + return Self; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationT.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationT.cs index 0272e5f9ae0..117221be687 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationT.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationT.cs @@ -3,15 +3,14 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Linq; -using System.Text.Json; -using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Core.Search; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public sealed class BulkUpdateOperation : BulkUpdateOperation +public sealed class BulkUpdateOperation : + BulkUpdateOperation { public BulkUpdateOperation(Id id) => Id = id; @@ -32,31 +31,18 @@ public BulkUpdateOperation(TDocument idFrom, TPartialDocument update, bool useId protected override Type ClrType => typeof(TDocument); - [JsonPropertyName("pipeline")] - public string? Pipeline { get; set; } - - [JsonPropertyName("dynamic_templates")] - public Dictionary? DynamicTemplates { get; set; } - - [JsonIgnore] public TPartialDocument Doc { get; set; } - [JsonIgnore] public TDocument IdFrom { get; set; } - [JsonIgnore] public Script Script { get; set; } - [JsonIgnore] public bool? ScriptedUpsert { get; set; } - [JsonIgnore] public bool? DocAsUpsert { get; set; } - [JsonIgnore] public TDocument Upsert { get; set; } - [JsonIgnore] public Union Source { get; set; } protected override string Operation => "update"; @@ -75,9 +61,8 @@ protected override void BeforeSerialize(IElasticsearchClientSettings settings) } } - protected override void WriteOperation(Utf8JsonWriter writer, JsonSerializerOptions options = null) => JsonSerializer.Serialize(writer, this, options); - - protected override object GetBody() => new BulkUpdateBody { + private protected override BulkUpdateBody GetBody() => new BulkUpdateBody + { PartialUpdate = Doc, Script = Script, Upsert = Upsert, diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithPartial.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithPartial.cs index 8ad17bb279a..c17c681aafb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithPartial.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithPartial.cs @@ -3,8 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Text.Json; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; @@ -23,7 +21,6 @@ public BulkUpdateOperationWithPartial(Id id, IndexName index, TPartialDocument p PartialDocument = partialDocument; } - [JsonIgnore] public TPartialDocument PartialDocument { get; set; } protected override Type ClrType => null; @@ -32,12 +29,10 @@ public BulkUpdateOperationWithPartial(Id id, IndexName index, TPartialDocument p protected override void BeforeSerialize(IElasticsearchClientSettings settings) { - if (Index is null) - Index = settings.Inferrer.IndexName(); } - protected override void WriteOperation(Utf8JsonWriter writer, JsonSerializerOptions options = null) => - JsonSerializer.Serialize>(writer, this, options); - - protected override object GetBody() => new PartialBulkUpdateBody { PartialUpdate = PartialDocument }; + private protected override BulkUpdateBody GetBody() => new PartialBulkUpdateBody + { + PartialUpdate = PartialDocument + }; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithScript.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithScript.cs index d3feccab61d..ee57a72c935 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithScript.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/BulkUpdateOperationWithScript.cs @@ -3,12 +3,11 @@ // See the LICENSE file in the project root for more information. using System; -using System.Text.Json; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; -public class BulkUpdateOperationWithScript : BulkUpdateOperation +public class BulkUpdateOperationWithScript : + BulkUpdateOperation { public BulkUpdateOperationWithScript(Id id, Script script) { @@ -23,7 +22,6 @@ public BulkUpdateOperationWithScript(Id id, IndexName index, Script script) Script = script; } - [JsonIgnore] public Script Script { get; set; } protected override string Operation => "update"; @@ -34,9 +32,10 @@ protected override void BeforeSerialize(IElasticsearchClientSettings settings) { } - protected override void WriteOperation(Utf8JsonWriter writer, JsonSerializerOptions options = null) => JsonSerializer.Serialize(writer, this, options); - - protected override object GetBody() => new ScriptedBulkUpdateBody { Script = Script }; + private protected override BulkUpdateBody GetBody() => new ScriptedBulkUpdateBody + { + Script = Script + }; } public sealed class BulkUpdateOperationWithScript : BulkUpdateOperationWithScript @@ -45,8 +44,7 @@ public sealed class BulkUpdateOperationWithScript : BulkUpdateOperati public BulkUpdateOperationWithScript(TDocument upsert, Id id, IndexName index, Script script) : base(id, index, script) => Upsert = upsert; - [JsonIgnore] public TDocument Upsert { get; set; } - protected override object GetBody() => new ScriptedBulkUpdateBody { Script = Script, Upsert = Upsert }; + private protected override BulkUpdateBody GetBody() => new ScriptedBulkUpdateBody { Script = Script, Upsert = Upsert }; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/IBulkOperation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/IBulkOperation.cs index ed6e49ba40c..a31a876bc5a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/IBulkOperation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/IBulkOperation.cs @@ -10,5 +10,5 @@ namespace Elastic.Clients.Elasticsearch.Core.Bulk; /// Allows objects and descriptors to be stored in the same . public interface IBulkOperation { - void PrepareIndex(IndexName bulkRequestIndex); + void PrepareIndex(IndexName? bulkRequestIndex); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/PartialBulkUpdateBody.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/PartialBulkUpdateBody.cs index 256239bfe4f..8a0f875fd1b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/PartialBulkUpdateBody.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/PartialBulkUpdateBody.cs @@ -25,7 +25,7 @@ protected override void SerializeProperties(Utf8JsonWriter writer, JsonSerialize if (PartialUpdate is not null) { writer.WritePropertyName("doc"); - settings.SourceSerializer.Serialize(PartialUpdate, writer, null); + settings.SourceSerializer.Serialize(PartialUpdate, writer, settings.MemoryStreamFactory); } } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkCreateResponseItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkCreateResponseItem.cs index 6e183cbb35c..9a9b24dde46 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkCreateResponseItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkCreateResponseItem.cs @@ -2,9 +2,18 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using Elastic.Clients.Elasticsearch.Serialization; + +using System.Diagnostics.CodeAnalysis; + namespace Elastic.Clients.Elasticsearch.Core.Bulk; public sealed class CreateResponseItem : ResponseItem { public override string Operation => "create"; + + [SetsRequiredMembers] + internal CreateResponseItem(JsonConstructorSentinel sentinel) : base(sentinel) + { + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkDeleteResponseItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkDeleteResponseItem.cs index d7462faf2d5..a1f6467283e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkDeleteResponseItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkDeleteResponseItem.cs @@ -2,9 +2,18 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using Elastic.Clients.Elasticsearch.Serialization; + +using System.Diagnostics.CodeAnalysis; + namespace Elastic.Clients.Elasticsearch.Core.Bulk; public sealed class BulkDeleteResponseItem : ResponseItem { public override string Operation => "delete"; + + [SetsRequiredMembers] + internal BulkDeleteResponseItem(JsonConstructorSentinel sentinel) : base(sentinel) + { + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkIndexResponseItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkIndexResponseItem.cs index 4b6c0219107..de761aab242 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkIndexResponseItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkIndexResponseItem.cs @@ -2,9 +2,18 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using Elastic.Clients.Elasticsearch.Serialization; + +using System.Diagnostics.CodeAnalysis; + namespace Elastic.Clients.Elasticsearch.Core.Bulk; public sealed class BulkIndexResponseItem : ResponseItem { public override string Operation => "index"; + + [SetsRequiredMembers] + internal BulkIndexResponseItem(JsonConstructorSentinel sentinel) : base(sentinel) + { + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkUpdateResponseItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkUpdateResponseItem.cs index ac2530b6e5d..89b38ce991c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkUpdateResponseItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/Response/BulkUpdateResponseItem.cs @@ -2,9 +2,18 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Diagnostics.CodeAnalysis; + +using Elastic.Clients.Elasticsearch.Serialization; + namespace Elastic.Clients.Elasticsearch.Core.Bulk; public sealed class BulkUpdateResponseItem : ResponseItem { public override string Operation => "update"; + + [SetsRequiredMembers] + internal BulkUpdateResponseItem(JsonConstructorSentinel sentinel) : base(sentinel) + { + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/ScriptedBulkUpdateBody.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/ScriptedBulkUpdateBody.cs index 531f5c09240..ead19886ca3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/ScriptedBulkUpdateBody.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Bulk/ScriptedBulkUpdateBody.cs @@ -4,7 +4,6 @@ using System.Text.Json; using Elastic.Transport.Extensions; -using Elastic.Clients.Elasticsearch.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Bulk; @@ -37,7 +36,7 @@ protected override void SerializeProperties(Utf8JsonWriter writer, JsonSerialize if (Upsert is not null) { writer.WritePropertyName("upsert"); - settings.SourceSerializer.Serialize(Upsert, writer, null); + settings.SourceSerializer.Serialize(Upsert, writer, settings.MemoryStreamFactory); } } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/MSearch/SearchRequestItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/MSearch/SearchRequestItem.cs index cdf12c100a5..906b581163b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/MSearch/SearchRequestItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/MSearch/SearchRequestItem.cs @@ -3,11 +3,10 @@ // See the LICENSE file in the project root for more information. using System.IO; -using System.Text.Json; using System.Threading.Tasks; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; -using Elastic.Transport.Extensions; namespace Elastic.Clients.Elasticsearch.Core.MSearch; diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Search/SourceConfigParam.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Search/SourceConfigParam.cs index 2a1a1c6d706..e600887e147 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Search/SourceConfigParam.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Core/Search/SourceConfigParam.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics.CodeAnalysis; using Elastic.Transport; @@ -10,12 +11,45 @@ namespace Elastic.Clients.Elasticsearch.Core.Search; public partial class SourceConfigParam : IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { public string GetString(ITransportConfiguration settings) => - Tag switch + Match( + v => UrlFormatter.CreateString(v, settings), + v => UrlFormatter.CreateString(v, settings) + ); + + #region IParsable + + public static SourceConfigParam Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out SourceConfigParam? result) + { + if (s is null) + { + result = null; + return false; + } + + if (bool.TryParse(s, out var b)) { - 0 => UrlFormatter.CreateString(Item1, settings)!, - 1 => UrlFormatter.CreateString(Item2, settings)!, - _ => throw new InvalidOperationException() - }; + result = new SourceConfigParam(b); + return true; + } + + if (Fields.TryParse(s, provider, out var fields)) + { + result = new SourceConfigParam(fields); + return true; + } + + result = null; + return false; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/FieldSort.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/FieldSort.cs deleted file mode 100644 index ea4cd931ea7..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/FieldSort.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; -using Elastic.Clients.Elasticsearch.Mapping; - -namespace Elastic.Clients.Elasticsearch; - -[JsonConverter(typeof(FieldSortConverter))] -public partial class FieldSort -{ - public static FieldSort Empty { get; } = new(); -} - -internal sealed class FieldSortConverter : JsonConverter -{ - // This is temporarily a manual converter until we code-gen for shortcut properties. - // This serves as the template for those converters. - - public override FieldSort? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.StartObject) - { - string? format = null; - FieldValue? missing = null; - SortMode? mode = null; - NestedSortValue? nested = null; - FieldSortNumericType? numericType = null; - SortOrder? order = null; - FieldType? unmappedType = null; - - while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) - { - if (reader.TokenType == JsonTokenType.PropertyName) - { - var propertyName = reader.GetString(); - reader.Read(); - - switch (propertyName) - { - case "format": - format = reader.GetString(); - break; - case "missing": - missing = JsonSerializer.Deserialize(ref reader, options); - break; - case "mode": - mode = JsonSerializer.Deserialize(ref reader, options); - break; - case "nested": - nested = JsonSerializer.Deserialize(ref reader, options); - break; - case "numeric_type": - numericType = JsonSerializer.Deserialize(ref reader, options); - break; - case "order": - order = JsonSerializer.Deserialize(ref reader, options); - break; - case "unmapped_type": - unmappedType = JsonSerializer.Deserialize(ref reader, options); - break; - default: - throw new JsonException("Unexpected property while reading `Field`."); - } - } - } - - return new FieldSort - { - Format = format, - Missing = missing, - Mode = mode, - Nested = nested, - NumericType = numericType, - Order = order, - UnmappedType = unmappedType - }; - } - - else if (reader.TokenType == JsonTokenType.String) // Shortcut property - { - var sortOrder = JsonSerializer.Deserialize(ref reader, options); - return new FieldSort { Order = sortOrder }; - } - - throw new JsonException($"Unexpected JSON token '{reader.TokenType}' encountered while deserializing FieldSort."); - } - - public override void Write(Utf8JsonWriter writer, FieldSort value, JsonSerializerOptions options) - { - if (value is null) - { - writer.WriteNullValue(); - return; - } - - writer.WriteStartObject(); - - if (value.Format is not null) - { - writer.WritePropertyName("format"); - writer.WriteStringValue(value.Format); - } - - if (value.Missing.HasValue) - { - writer.WritePropertyName("missing"); - JsonSerializer.Serialize(writer, value.Missing.Value, options); - } - - if (value.Mode.HasValue) - { - writer.WritePropertyName("mode"); - JsonSerializer.Serialize(writer, value.Mode.Value, options); - } - - if (value.Nested is not null) - { - writer.WritePropertyName("nested"); - JsonSerializer.Serialize(writer, value.Nested, options); - } - - if (value.NumericType.HasValue) - { - writer.WritePropertyName("numeric_type"); - JsonSerializer.Serialize(writer, value.NumericType.Value, options); - } - - if (value.Order.HasValue) - { - writer.WritePropertyName("order"); - JsonSerializer.Serialize(writer, value.Order.Value, options); - } - - if (value.UnmappedType.HasValue) - { - writer.WritePropertyName("unmapped_type"); - JsonSerializer.Serialize(writer, value.UnmappedType.Value, options); - } - - writer.WriteEndObject(); - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoBounds.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoBounds.cs new file mode 100644 index 00000000000..2307706f29b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoBounds.cs @@ -0,0 +1,55 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch; + +[JsonConverter(typeof(GeoBoundsConverter))] +public sealed partial class GeoBounds +{ +} + +internal sealed class GeoBoundsConverter : + JsonConverter +{ + public override GeoBounds? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, GeoBounds value, JsonSerializerOptions options) + { + if (value.TryGetCoordinates(out var coordinates)) + { + writer.WriteValue(options, coordinates); + return; + } + + if (value.TryGetTopLeftBottomRight(out var topLeftBottomRight)) + { + writer.WriteValue(options, topLeftBottomRight); + return; + } + + if (value.TryGetTopRightBottomLeft(out var topRightBottomLeft)) + { + writer.WriteValue(options, topRightBottomLeft); + return; + } + + if (value.TryGetWkt(out var wkt)) + { + writer.WriteValue(options, wkt); + return; + } + + throw new JsonException($"Unrecognized '{typeof(GeoBounds)}' variant."); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoLocation.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoLocation.cs index e3a6e3b4d10..2b32d158871 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoLocation.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/GeoLocation.cs @@ -2,10 +2,56 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +using Elastic.Clients.Elasticsearch.Serialization; + namespace Elastic.Clients.Elasticsearch; +[JsonConverter(typeof(GeoLocationConverter))] public partial class GeoLocation { public static bool IsValidLatitude(double latitude) => latitude >= -90 && latitude <= 90; + public static bool IsValidLongitude(double longitude) => longitude >= -180 && longitude <= 180; } + +internal sealed class GeoLocationConverter : + JsonConverter +{ + public override GeoLocation? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new InvalidOperationException(); + } + + public override void Write(Utf8JsonWriter writer, GeoLocation value, JsonSerializerOptions options) + { + if (value.TryGetCoordinates(out var coordinates)) + { + writer.WriteCollectionValue(options, coordinates, null); + return; + } + + if (value.TryGetGeoHash(out var geoHash)) + { + writer.WriteValue(options, geoHash); + return; + } + + if (value.TryGetLatitudeLongitude(out var latitudeLongitude)) + { + writer.WriteValue(options, latitudeLongitude); + return; + } + + if (value.TryGetText(out var text)) + { + writer.WriteValue(options, text); + return; + } + + throw new JsonException($"Unrecognized '{typeof(GeoLocation)}' variant."); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Mapping/PropertiesDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Mapping/PropertiesDescriptor.cs index 9bfb6107178..f7cfedcf611 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Mapping/PropertiesDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Mapping/PropertiesDescriptor.cs @@ -5,234 +5,404 @@ using System; using System.Collections.Generic; using System.Linq.Expressions; -using Elastic.Clients.Elasticsearch.Fluent; namespace Elastic.Clients.Elasticsearch.Mapping; -public sealed partial class PropertiesDescriptor - : IsADictionaryDescriptor, Properties, PropertyName, IProperty> +public readonly partial struct PropertiesDescriptor { // SCALAR OVERLOADS // Scalar are manually added to a partial class which seems reasonable. // int - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, IntegerNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, IntegerNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, IntegerNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, IntegerNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, IntegerNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, IntegerNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, IntegerNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, IntegerNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, IntegerNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, IntegerNumberPropertyDescriptor.Build(configure)); + return this; + } // float - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, FloatNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, FloatNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, FloatNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, FloatNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, FloatNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, FloatNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, FloatNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, FloatNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, FloatNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, FloatNumberPropertyDescriptor.Build(configure)); + return this; + } // byte - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, ByteNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, ByteNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, ByteNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, ByteNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, ByteNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, ByteNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, ByteNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, ByteNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, ByteNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, ByteNumberPropertyDescriptor.Build(configure)); + return this; + } // short - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, ShortNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, ShortNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, ShortNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, ShortNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, ShortNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, ShortNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, ShortNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, ShortNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, ShortNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, ShortNumberPropertyDescriptor.Build(configure)); + return this; + } // long - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, LongNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, LongNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, LongNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, LongNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, LongNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, LongNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, LongNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, LongNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, LongNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, LongNumberPropertyDescriptor.Build(configure)); + return this; + } // decimal - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, DoubleNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } // double - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, DoubleNumberProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DoubleNumberProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DoubleNumberPropertyDescriptor.Build(configure)); + return this; + } // date time - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, DateProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } // date time offset - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, DateProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, DateProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, DatePropertyDescriptor.Build(configure)); + return this; + } // bool - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, BooleanProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, BooleanPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, BooleanProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, BooleanPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, BooleanProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, BooleanPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, BooleanProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, BooleanPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, BooleanProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, BooleanPropertyDescriptor.Build(configure)); + return this; + } // char - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, KeywordProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(null)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } // GUID - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, KeywordProperty>(propertyName, null); - - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); - - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); - - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); - - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, KeywordProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(null)); + return this; + } - // string + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName) => - AssignVariant, TextProperty>(propertyName, null); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) => - AssignVariant, TextProperty>(propertyName, configure); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) - public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) => - AssignVariant, TextProperty>(propertyName, configure); + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - // Skipping these for now - //public PropertiesDescriptor Boolean(Expression> fieldName) => - // AssignVariant, BooleanProperty>(fieldName, null); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, KeywordPropertyDescriptor.Build(configure)); + return this; + } - //public PropertiesDescriptor Boolean(Expression> fieldName, Action> configure) => - // AssignVariant, BooleanProperty>(fieldName, configure); + // string - // This will remain non-code-generated - protected override PropertiesDescriptor AssignVariant(PropertyName name, IProperty type) + public PropertiesDescriptor Scalar(Expression> propertyName) { - type.ThrowIfNull(nameof(type)); + _items.Add(propertyName, TextPropertyDescriptor.Build(null)); + return this; + } - if (name.IsConditionless()) - throw new ArgumentException($"Could not get property name for {type.GetType().Name} mapping."); + public PropertiesDescriptor Scalar(Expression> propertyName, Action> configure) + { + _items.Add(propertyName, TextPropertyDescriptor.Build(configure)); + return this; + } - return Assign(name, type); + public PropertiesDescriptor Scalar(Expression>> propertyName, Action> configure) + { + _items.Add(propertyName, TextPropertyDescriptor.Build(configure)); + return this; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/MultiSearchItem.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/MultiSearchItem.cs index 59a2008478d..e7d6cc2df8e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/MultiSearchItem.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/MultiSearchItem.cs @@ -17,5 +17,5 @@ public partial class MultiSearchItem public IReadOnlyCollection Documents => HitsMetadata.Hits.Select(s => s.Source).ToReadOnlyCollection(); [JsonIgnore] - public long Total => HitsMetadata?.Total?.Item1?.Value ?? HitsMetadata?.Total?.Item2 ?? -1; + public long Total => HitsMetadata?.Total?.Value1?.Value ?? HitsMetadata?.Total?.Value2 ?? -1; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/OpType.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/OpType.cs deleted file mode 100644 index ee10bfebc03..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/OpType.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch; - -[JsonConverter(typeof(OpTypeConverter))] -public partial struct OpType : IStringable -{ - public static OpType Index = new("index"); - public static OpType Create = new("create"); - - public OpType(string value) => Value = value; - - public string Value { get; } - - public static implicit operator OpType(string v) => new(v); - - public string GetString() => Value ?? string.Empty; -} - -internal sealed class OpTypeConverter : - JsonConverter -{ - public override OpType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType != JsonTokenType.String) - { - throw new JsonException("Unexpected token."); - } - - var value = reader.GetString(); - - return value switch - { - "index" => OpType.Index, - "create" => OpType.Create, - _ => throw new JsonException($"Unsupported value '{value}' for '{nameof(OpType)}' enum.") - }; - } - - public override void Write(Utf8JsonWriter writer, OpType value, JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/PointInTimeReferenceDescriptor.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/PointInTimeReferenceDescriptor.cs index 0370f78f5b8..45499cdfc79 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/PointInTimeReferenceDescriptor.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/PointInTimeReferenceDescriptor.cs @@ -4,7 +4,7 @@ namespace Elastic.Clients.Elasticsearch.Core.Search; -public sealed partial class PointInTimeReferenceDescriptor +public readonly partial struct PointInTimeReferenceDescriptor { - public PointInTimeReferenceDescriptor(string id) => IdValue = id; + public PointInTimeReferenceDescriptor(string id) => Instance.Id = id; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryAndExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryAndExtensions.cs index 493c1dcdccc..c4d226b8fb8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryAndExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryAndExtensions.cs @@ -12,26 +12,28 @@ internal static class BoolQueryAndExtensions { internal static Query CombineAsMust(this Query leftContainer, Query rightContainer) { - var hasLeftBool = leftContainer.TryGet(out var leftBool); - var hasRightBool = rightContainer.TryGet(out var rightBool); + var leftBool = leftContainer.Bool; + var hasLeftBool = (leftBool is not null); + var rightBool = rightContainer.Bool; + var hasRightBool = (rightBool is not null); - // neither side is a bool, no special handling needed wrap in a bool must + // Neither side is a `bool` Wrap in a `must`. if (!hasLeftBool && !hasRightBool) { - return CreateMustContainer(new List { leftContainer, rightContainer }); + return CreateMustContainer([leftContainer, rightContainer]); } - else if (TryHandleBoolsWithOnlyShouldClauses(leftContainer, rightContainer, leftBool, rightBool, out var query)) + if (TryHandleBoolsWithOnlyShouldClauses(leftContainer, rightContainer, leftBool, rightBool, out var query)) { return query; } - else if (TryHandleUnmergableBools(leftContainer, rightContainer, leftBool, rightBool, out query)) + if (TryHandleUnmergableBools(leftContainer, rightContainer, leftBool, rightBool, out query)) { return query; } - // neither side is unmergable so neither is a bool with should clauses + // Neither side is unmergable so neither is a bool with should clauses. var mustNotClauses = OrphanMustNots(leftContainer).EagerConcat(OrphanMustNots(rightContainer)); var filterClauses = OrphanFilters(leftContainer).EagerConcat(OrphanFilters(rightContainer)); @@ -88,7 +90,7 @@ private static bool TryHandleUnmergableBools(Query leftContainer, Query rightCon Filter = leftBool.Filter }; - query = leftBoolCopy; + query = new Query { Bool = leftBoolCopy }; } } @@ -118,7 +120,7 @@ private static bool TryHandleUnmergableBools(Query leftContainer, Query rightCon Filter = rightBool.Filter }; - query = rightBoolCopy; + query = new Query { Bool = rightBoolCopy }; } } @@ -161,7 +163,7 @@ private static bool TryHandleBoolsWithOnlyShouldClauses(Query leftContainer, Que } else { - query = CreateMustContainer(new List { leftContainer, rightContainer }); + query = CreateMustContainer([leftContainer, rightContainer]); query.HoldsOnlyShouldMusts = rightHasOnlyShoulds && leftHasOnlyShoulds; } @@ -169,36 +171,42 @@ private static bool TryHandleBoolsWithOnlyShouldClauses(Query leftContainer, Que } private static Query CreateMustContainer(Query left, Query right) => - CreateMustContainer(new List { left, right }); + CreateMustContainer([left, right]); private static Query CreateMustContainer(List mustClauses) => - Query.Bool(new BoolQuery() { Must = mustClauses.ToListOrNullIfEmpty() }); + new() { Bool = new() { Must = mustClauses.ToListOrNullIfEmpty() } }; private static Query CreateMustContainer( List mustClauses, List mustNotClauses, List filters - ) => Query.Bool(new BoolQuery + ) => new() { - Must = mustClauses.ToListOrNullIfEmpty(), - MustNot = mustNotClauses.ToListOrNullIfEmpty(), - Filter = filters.ToListOrNullIfEmpty() - }); + Bool = new() + { + Must = mustClauses.ToListOrNullIfEmpty(), + MustNot = mustNotClauses.ToListOrNullIfEmpty(), + Filter = filters.ToListOrNullIfEmpty() + } + }; - private static bool CanMergeAnd(this BoolQuery boolQuery) => - boolQuery != null && !boolQuery.Locked && !boolQuery.Should.HasAny(); + private static bool CanMergeAnd(this BoolQuery? boolQuery) => + boolQuery is { Locked: false } && !boolQuery.Should.HasAny(); - private static IEnumerable OrphanMusts(Query container) + private static IEnumerable? OrphanMusts(Query container) { - if (!container.TryGet(out var lBoolQuery)) - return new[] { container }; + var lBoolQuery = container.Bool; + if (lBoolQuery is null) + { + return [container]; + } return lBoolQuery.Must?.AsInstanceOrToListOrNull(); } - private static IEnumerable OrphanMustNots(Query container) => - !container.TryGet(out var boolQuery) ? null : (IEnumerable)(boolQuery.MustNot?.AsInstanceOrToListOrNull()); + private static IEnumerable? OrphanMustNots(Query container) => + container.Bool?.MustNot?.AsInstanceOrToListOrNull(); - private static IEnumerable OrphanFilters(Query container) => - !container.TryGet(out var boolQuery) ? null : (IEnumerable)(boolQuery.Filter?.AsInstanceOrToListOrNull()); + private static IEnumerable? OrphanFilters(Query container) => + container.Bool?.Filter?.AsInstanceOrToListOrNull(); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryExtensions.cs index 38af2755d39..2bb5648a019 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryExtensions.cs @@ -8,21 +8,21 @@ internal static class BoolQueryExtensions { internal static Query Self(this Query q) => q; - internal static bool HasOnlyShouldClauses(this BoolQuery boolQuery) => + internal static bool HasOnlyShouldClauses(this BoolQuery? boolQuery) => boolQuery != null && boolQuery.Should.HasAny() && !boolQuery.Must.HasAny() && !boolQuery.MustNot.HasAny() && !boolQuery.Filter.HasAny(); - internal static bool HasOnlyFilterClauses(this BoolQuery boolQuery) => + internal static bool HasOnlyFilterClauses(this BoolQuery? boolQuery) => boolQuery != null && !boolQuery.Should.HasAny() && !boolQuery.Must.HasAny() && !boolQuery.MustNot.HasAny() && boolQuery.Filter.HasAny(); - internal static bool HasOnlyMustNotClauses(this BoolQuery boolQuery) => + internal static bool HasOnlyMustNotClauses(this BoolQuery? boolQuery) => boolQuery != null && !boolQuery.Should.HasAny() && !boolQuery.Must.HasAny() && diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryOrExtensions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryOrExtensions.cs index 4ed4fca190d..70554b403b5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryOrExtensions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/BoolQueryOrExtensions.cs @@ -11,8 +11,10 @@ internal static class BoolQueryOrExtensions { internal static Query CombineAsShould(this Query leftContainer, Query rightContainer) { - var hasLeftBool = leftContainer.TryGet(out var leftBool); - var hasRightBool = rightContainer.TryGet(out var rightBool); + var leftBool = leftContainer.Bool; + var hasLeftBool = (leftBool is not null); + var rightBool = rightContainer.Bool; + var hasRightBool = (rightBool is not null); if (TryFlattenShould(leftContainer, rightContainer, leftBool, rightBool, out var c)) return c; @@ -20,8 +22,8 @@ internal static Query CombineAsShould(this Query leftContainer, Query rightConta var lHasShouldQueries = hasLeftBool && leftBool.Should.HasAny(); var rHasShouldQueries = hasRightBool && rightBool.Should.HasAny(); - var lq = lHasShouldQueries ? leftBool.Should : new[] { leftContainer }; - var rq = rHasShouldQueries ? rightBool.Should : new[] { rightContainer }; + var lq = lHasShouldQueries ? leftBool.Should : [leftContainer]; + var rq = rHasShouldQueries ? rightBool.Should : [rightContainer]; var shouldClauses = lq.EagerConcat(rq); @@ -39,7 +41,6 @@ private static bool TryFlattenShould(Query leftContainer, Query rightContainer, query = CreateShouldContainer(new List { leftContainer, rightContainer }); // Left can merge but right's bool can not. instead of wrapping into a new bool we inject the whole bool into left - else if (leftCanMerge && !rightCanMerge && rightBool is not null) { leftBool.Should = leftBool.Should.AddIfNotNull(rightContainer).ToArray(); @@ -55,14 +56,14 @@ private static bool TryFlattenShould(Query leftContainer, Query rightContainer, } private static bool CanMergeShould(this Query container) => - container.TryGet(out var boolQuery) && boolQuery.CanMergeShould(); + container.Bool?.CanMergeShould() ?? false; private static bool CanMergeShould(this BoolQuery boolQuery) => boolQuery is not null && !boolQuery.Locked && boolQuery.HasOnlyShouldClauses(); private static Query CreateShouldContainer(List shouldClauses) => - new BoolQuery + new() { - Should = shouldClauses.ToListOrNullIfEmpty() + Bool = new() { Should = shouldClauses.ToListOrNullIfEmpty() } }; } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/FunctionScore.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/FunctionScore.cs index 21248c619a2..3f8808f59c4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/FunctionScore.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/FunctionScore.cs @@ -8,20 +8,32 @@ namespace Elastic.Clients.Elasticsearch.QueryDsl; public partial class FunctionScore { - internal FunctionScore() { } - /// /// The weight score allows you to multiply the score by the provided weight. /// public static FunctionScore WeightScore(double weight) => new() { Weight = weight }; } -public partial class FunctionScoreDescriptor +public readonly partial struct FunctionScoreDescriptor { - public FunctionScoreDescriptor WeightScore(double weight) => Set(null, null).Weight(weight); + /// + /// The weight score allows you to multiply the score by the provided weight. + /// + public FunctionScoreDescriptor WeightScore(double weight) + { + Instance.Weight = weight; + return this; + } } -public partial class FunctionScoreDescriptor +public readonly partial struct FunctionScoreDescriptor { - public FunctionScoreDescriptor WeightScore(double weight) => Set(null, null).Weight(weight); + /// + /// The weight score allows you to multiply the score by the provided weight. + /// + public FunctionScoreDescriptor WeightScore(double weight) + { + Instance.Weight = weight; + return this; + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/Query.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/Query.cs index 772fd283d5d..1734cc5e8bb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/Query.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/Query.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.CodeAnalysis; namespace Elastic.Clients.Elasticsearch.QueryDsl; @@ -12,6 +11,7 @@ public partial class Query internal bool HoldsOnlyShouldMusts { get; set; } public static bool operator false(Query _) => false; + public static bool operator true(Query _) => false; public static Query operator &(Query leftContainer, Query rightContainer) => @@ -53,9 +53,43 @@ internal static Query Or(Query leftContainer, Query rightContainer) public static Query operator !(Query queryContainer) => queryContainer is null ? null - : Query.Bool(new BoolQuery { MustNot = new[] { queryContainer } }); + : new() { Bool = new() { MustNot = [queryContainer] } }; public static Query operator +(Query queryContainer) => queryContainer is null ? null - : Query.Bool(new BoolQuery { Filter = new[] { queryContainer } }); + : new() { Bool = new() { Filter = [queryContainer] } }; +} + +public readonly partial struct QueryDescriptor +{ + public static bool operator false(QueryDescriptor _) => false; + + public static bool operator true(QueryDescriptor _) => false; + + public static QueryDescriptor operator &(QueryDescriptor leftContainer, QueryDescriptor rightContainer) => + new(leftContainer.Instance & rightContainer.Instance); + + public static QueryDescriptor operator |(QueryDescriptor leftContainer, QueryDescriptor rightContainer) => + new(leftContainer.Instance | rightContainer.Instance); + + public static QueryDescriptor operator !(QueryDescriptor queryContainer) => new(!queryContainer.Instance); + + public static QueryDescriptor operator +(QueryDescriptor queryContainer) => new(+queryContainer.Instance); +} + +public readonly partial struct QueryDescriptor +{ + public static bool operator false(QueryDescriptor _) => false; + + public static bool operator true(QueryDescriptor _) => false; + + public static QueryDescriptor operator &(QueryDescriptor leftContainer, QueryDescriptor rightContainer) => + new(leftContainer.Instance & rightContainer.Instance); + + public static QueryDescriptor operator |(QueryDescriptor leftContainer, QueryDescriptor rightContainer) => + new(leftContainer.Instance | rightContainer.Instance); + + public static QueryDescriptor operator !(QueryDescriptor queryContainer) => new(!queryContainer.Instance); + + public static QueryDescriptor operator +(QueryDescriptor queryContainer) => new(+queryContainer.Instance); } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RangeQuery.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RangeQuery.cs index c4b7a918a9e..7724b70fe6a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RangeQuery.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RangeQuery.cs @@ -4,91 +4,100 @@ using System; -using Elastic.Clients.Elasticsearch.Fluent; - namespace Elastic.Clients.Elasticsearch.QueryDsl; -// TODO: This should be removed after implementing descriptor generation for union types - -public sealed partial class QueryDescriptor +public readonly partial struct IRangeQueryBuilder { - public QueryDescriptor Range(Action> configure) => ProxiedSet(configure, "range"); - - private QueryDescriptor ProxiedSet(Action descriptorAction, string variantName) where T : ProxiedDescriptor + [Obsolete("Use 'Date()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery DateRange(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) { - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - - return Set(descriptor.Result, variantName); + return value; } -} -public sealed partial class QueryDescriptor -{ - public QueryDescriptor Range(Action configure) => ProxiedSet(configure, "range"); - public QueryDescriptor Range(Action> configure) => ProxiedSet(configure, "range"); - - private QueryDescriptor ProxiedSet(Action descriptorAction, string variantName) where T : ProxiedDescriptor + [Obsolete("Use 'Date()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery DateRange(System.Action> action) { - var descriptor = (T)Activator.CreateInstance(typeof(T), true); - descriptorAction?.Invoke(descriptor); - - return Set(descriptor.Result, variantName); + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); } -} - -public abstract class ProxiedDescriptor : Descriptor - where T : Descriptor -{ - internal Descriptor Result { get; set; } - protected T SetResult(Action descriptorAction) where TD : Descriptor + [Obsolete("Use 'Number()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery NumberRange(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) { - var descriptor = (TD)Activator.CreateInstance(typeof(TD), true); - descriptorAction?.Invoke(descriptor); - Result = descriptor; - return Self; + return value; } -} -public sealed class RangeQueryDescriptor : ProxiedDescriptor> -{ - public RangeQueryDescriptor NumberRange(Action> configure) => - SetResult(configure); + [Obsolete("Use 'Number()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery NumberRange(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } - public RangeQueryDescriptor DateRange(Action> configure) => - SetResult(configure); + [Obsolete("Use 'Term()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery TermRange(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) + { + return value; + } - public RangeQueryDescriptor TermRange(Action> configure) => - SetResult(configure); + [Obsolete("Use 'Term()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery TermRange(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } } -public sealed class RangeQueryDescriptor : ProxiedDescriptor +public readonly partial struct IRangeQueryBuilder { - public RangeQueryDescriptor NumberRange(Action configure) => SetResult(configure); + [Obsolete("Use 'Date()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery DateRange(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery value) + { + return value; + } - public RangeQueryDescriptor NumberRange(Action> configure) => SetResult(configure); + [Obsolete("Use 'Date()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery DateRange(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); + } - public RangeQueryDescriptor DateRange(Action configure) => SetResult(configure); + [Obsolete("Use 'Date()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery DateRange(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQueryDescriptor.Build(action); + } - public RangeQueryDescriptor DateRange(Action> configure) => SetResult(configure); + [Obsolete("Use 'Number()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery NumberRange(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery value) + { + return value; + } - public RangeQueryDescriptor TermRange(Action configure) => SetResult(configure); + [Obsolete("Use 'Number()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery NumberRange(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } - public RangeQueryDescriptor TermRange(Action> configure) => SetResult(configure); -} + [Obsolete("Use 'Number()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery NumberRange(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQueryDescriptor.Build(action); + } -public sealed partial class NumberRangeQuery -{ - public static implicit operator Query(NumberRangeQuery numberRangeQuery) => Query.Range(numberRangeQuery); -} + [Obsolete("Use 'Term()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery TermRange(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery value) + { + return value; + } -public sealed partial class DateRangeQuery -{ - public static implicit operator Query(DateRangeQuery dateRangeQuery) => Query.Range(dateRangeQuery); -} + [Obsolete("Use 'Term()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery TermRange(System.Action action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } -public sealed partial class TermRangeQuery -{ - public static implicit operator Query(TermRangeQuery termRangeQuery) => Query.Range(termRangeQuery); + [Obsolete("Use 'Term()' instead.")] + public Elastic.Clients.Elasticsearch.QueryDsl.IRangeQuery TermRange(System.Action> action) + { + return Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQueryDescriptor.Build(action); + } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RawJsonQuery.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RawJsonQuery.cs deleted file mode 100644 index 4c1c879639e..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/QueryDsl/RawJsonQuery.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.QueryDsl; - -/// -/// Allows a query represented as a string of JSON to be defined. This can be useful when support for a built-in query is not yet available. -/// -[JsonConverter(typeof(RawJsonQueryConverter))] -public sealed class RawJsonQuery -{ - public RawJsonQuery(string rawQuery) => Raw = rawQuery; - - /// - /// The raw JSON representing the query to be executed. - /// - public string Raw { get; } - - public static implicit operator Query(RawJsonQuery rawJsonQuery) => Query.RawJson(rawJsonQuery); -} - -internal sealed class RawJsonQueryConverter : JsonConverter -{ - public override RawJsonQuery? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => throw new NotImplementedException("We never expect to deserialize a raw query."); - - public override void Write(Utf8JsonWriter writer, RawJsonQuery value, JsonSerializerOptions options) => writer.WriteRawValue(value.Raw); -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Ranges.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Ranges.cs deleted file mode 100644 index e6478ebe9db..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Ranges.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch; - -public class DateRange -{ - [JsonPropertyName("gt")] - public DateTimeOffset? GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public DateTimeOffset? GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public DateTimeOffset? LessThan { get; set; } - - [JsonPropertyName("lte")] - public DateTimeOffset? LessThanOrEqualTo { get; set; } -} - -public class DoubleRange -{ - [JsonPropertyName("gt")] - public double? GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public double? GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public double? LessThan { get; set; } - - [JsonPropertyName("lte")] - public double? LessThanOrEqualTo { get; set; } -} - -public class FloatRange -{ - [JsonPropertyName("gt")] - public float? GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public float? GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public float? LessThan { get; set; } - - [JsonPropertyName("lte")] - public float? LessThanOrEqualTo { get; set; } -} - -public class IntegerRange -{ - [JsonPropertyName("gt")] - public int? GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public int? GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public int? LessThan { get; set; } - - [JsonPropertyName("lte")] - public int? LessThanOrEqualTo { get; set; } -} - -public class LongRange -{ - [JsonPropertyName("gt")] - public long? GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public long? GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public long? LessThan { get; set; } - - [JsonPropertyName("lte")] - public long? LessThanOrEqualTo { get; set; } -} - -public class IpAddressRange -{ - [JsonPropertyName("gt")] - public string GreaterThan { get; set; } - - [JsonPropertyName("gte")] - public string GreaterThanOrEqualTo { get; set; } - - [JsonPropertyName("lt")] - public string LessThan { get; set; } - - [JsonPropertyName("lte")] - public string LessThanOrEqualTo { get; set; } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Refresh.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Refresh.cs deleted file mode 100644 index c4f41a86102..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Refresh.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Elastic.Transport; - -namespace Elastic.Clients.Elasticsearch; - -public partial struct Refresh : IStringable -{ - public static Refresh WaitFor = new("wait_for"); - public static Refresh True = new("true"); - public static Refresh False = new("false"); - - public Refresh(string value) => Value = value; - - public string Value { get; } - - public string GetString() => Value ?? string.Empty; -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Slices.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Slices.cs index baf72922b75..2d0b460f4ff 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/Slices.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/Slices.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using Elastic.Transport; @@ -11,12 +12,45 @@ namespace Elastic.Clients.Elasticsearch; public partial class Slices : IUrlParameter +#if NET7_0_OR_GREATER + , IParsable +#endif { public string GetString(ITransportConfiguration settings) => - Tag switch + Match( + v => v.ToString(CultureInfo.InvariantCulture), + v => UrlFormatter.CreateString(v, settings) + ); + + #region IParsable + + public static Slices Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + [NotNullWhen(true)] out Slices? result) + { + if (s is null) + { + result = null; + return false; + } + + if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value)) { - 0 => Item1.ToString(CultureInfo.InvariantCulture), - 1 => UrlFormatter.CreateString(Item2, settings)!, - _ => throw new InvalidOperationException() - }; + result = new Slices(value); + return true; + } + + if (EnumValueParser.TryParse(s, out var computed)) + { + result = new Slices(computed); + return true; + } + + result = null; + return false; + } + + #endregion IParsable } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/SortOptions.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/SortOptions.cs index 713272d31ff..c51f2e18253 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/SortOptions.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/SortOptions.cs @@ -3,122 +3,246 @@ // See the LICENSE file in the project root for more information. using System; +using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; + using Elastic.Clients.Elasticsearch.Serialization; using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; -public partial class SortOptions +public readonly partial struct SortOptionsDescriptor { - public static SortOptions Field(Field field) => new(field, FieldSort.Empty); + public SortOptionsDescriptor Field(Field field) + { + Instance.Field = new FieldSort(field); + return this; + } + + public SortOptionsDescriptor Field(Expression> field) + { + Instance.Field = new FieldSort(field); + return this; + } + + public SortOptionsDescriptor Field(Field field, Action>? action) + { + Instance.Field = new FieldSort(field); + + if (action is null) + { + return this; + } + + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, Action>? action) + { + Instance.Field = new FieldSort(field); + + if (action is null) + { + return this; + } + + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Field field, SortOrder order) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, SortOrder order) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + return this; + } + + public SortOptionsDescriptor Field(Field field, SortOrder order, Action>? action) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + if (action is null) + { + return this; + } + + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, SortOrder order, Action>? action) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + if (action is null) + { + return this; + } + + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } } -internal sealed class SortOptionsConverter : JsonConverter +public readonly partial struct SortOptionsDescriptor { - // We manually define this converter since we simplify SortCombinations union from the spec as SortOptions instance. - // This requires a custom read method to handle deserialization of the potential union JSON as specified. - - public override SortOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.StartObject) - { - reader.Read(); - if (reader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException("Expected a property name token representing the variant held within this container."); - } - - var propertyName = reader.GetString(); - reader.Read(); - if (propertyName == "_doc") - { - var variant = JsonSerializer.Deserialize(ref reader, options); - reader.Read(); - return new SortOptions(propertyName, variant); - } - - if (propertyName == "_score") - { - var variant = JsonSerializer.Deserialize(ref reader, options); - reader.Read(); - return new SortOptions(propertyName, variant); - } - - if (propertyName == "_script") - { - var variant = JsonSerializer.Deserialize(ref reader, options); - reader.Read(); - return new SortOptions(propertyName, variant); - } - - if (propertyName == "_geo_distance") - { - var variant = JsonSerializer.Deserialize(ref reader, options); - reader.Read(); - return new SortOptions(propertyName, variant); - } - - // For field sorts, the property name will be the field name - { - var variant = JsonSerializer.Deserialize(ref reader, options); - reader.Read(); - return new SortOptions(propertyName, variant); - } + public SortOptionsDescriptor Field(Field field) + { + Instance.Field = new FieldSort(field); + return this; + } + + public SortOptionsDescriptor Field(Expression> field) + { + Instance.Field = new FieldSort(field); + return this; + } + + public SortOptionsDescriptor Field(Field field, Action? action) + { + Instance.Field = new FieldSort(field); + + if (action is null) + { + return this; + } + + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Field field, Action>? action) + { + Instance.Field = new FieldSort(field); + + if (action is null) + { + return this; } - else if (reader.TokenType == JsonTokenType.String) + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, Action>? action) + { + Instance.Field = new FieldSort(field); + + if (action is null) { - var fieldName = reader.GetString(); - return SortOptions.Field(fieldName, FieldSort.Empty); + return this; } - throw new JsonException($"Unexpected JSON token '{reader.TokenType}' encountered while deserializing SortOptions."); + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; } - public override void Write(Utf8JsonWriter writer, SortOptions value, JsonSerializerOptions options) + public SortOptionsDescriptor Field(Field field, SortOrder order) { - if (!options.TryGetClientSettings(out var settings)) - ThrowHelper.ThrowJsonExceptionForMissingSettings(); + Instance.Field = new FieldSort(field) + { + Order = order + }; + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, SortOrder order) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; - string? fieldName = null; + return this; + } + + public SortOptionsDescriptor Field(Field field, SortOrder order, Action? action) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; - if (value.AdditionalPropertyName is IUrlParameter urlParameter) + if (action is null) { - fieldName = urlParameter.GetString(settings); + return this; } - // Special handling for shortcut on sorting with a basic field sort - if (value.Variant.Equals(FieldSort.Empty)) + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Field field, SortOrder order, Action>? action) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + if (action is null) { - writer.WriteStringValue(fieldName ?? value.VariantName); - return; + return this; } - writer.WriteStartObject(); - - writer.WritePropertyName(fieldName ?? value.VariantName); - - switch (value.VariantName) - { - case "_doc": - JsonSerializer.Serialize(writer, (ScoreSort)value.Variant, options); - break; - case "_score": - JsonSerializer.Serialize(writer, (ScoreSort)value.Variant, options); - break; - case "_script": - JsonSerializer.Serialize(writer, (ScriptSort)value.Variant, options); - break; - case "_geo_distance": - JsonSerializer.Serialize(writer, (GeoDistanceSort)value.Variant, options); - break; - default: - JsonSerializer.Serialize(writer, (FieldSort)value.Variant, options); - break; + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; + } + + public SortOptionsDescriptor Field(Expression> field, SortOrder order, Action>? action) + { + Instance.Field = new FieldSort(field) + { + Order = order + }; + + if (action is null) + { + return this; } - writer.WriteEndObject(); + var descriptor = new FieldSortDescriptor(Instance.Field); + action.Invoke(descriptor); + + return this; } } diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/SourceConfig.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/SourceConfig.cs index d9fdff1fba9..a8083944073 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/SourceConfig.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/SourceConfig.cs @@ -2,25 +2,21 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System; using System.Diagnostics.CodeAnalysis; -using System.Text.Json; -using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Core.Search; -[JsonConverter(typeof(SourceConfigConverter))] public partial class SourceConfig { - public bool HasBoolValue => Tag == 0; + public bool HasBoolValue => Tag == UnionTag.T1; - public bool HasSourceFilterValue => Tag == 1; + public bool HasSourceFilterValue => Tag == UnionTag.T2; public bool TryGetBool([NotNullWhen(returnValue: true)] out bool? value) { - if (Tag == 0) + if (Tag is UnionTag.T1) { - value = Item1; + value = Value1; return true; } @@ -30,9 +26,9 @@ public bool TryGetBool([NotNullWhen(returnValue: true)] out bool? value) public bool TryGetSourceFilter([NotNullWhen(returnValue: true)] out SourceFilter? value) { - if (Tag == 1) + if (Tag is UnionTag.T2) { - value = Item2; + value = Value2; return true; } @@ -40,35 +36,3 @@ public bool TryGetSourceFilter([NotNullWhen(returnValue: true)] out SourceFilter return false; } } - -internal class SourceConfigConverter : JsonConverter -{ - public override SourceConfig? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - switch (reader.TokenType) - { - case JsonTokenType.True: - case JsonTokenType.False: - var value = reader.GetBoolean(); - return new SourceConfig(value); - - case JsonTokenType.StartObject: - var sourceFilter = JsonSerializer.Deserialize(ref reader, options); - return new SourceConfig(sourceFilter); - } - - return null; - } - - public override void Write(Utf8JsonWriter writer, SourceConfig value, JsonSerializerOptions options) - { - if (value.HasBoolValue) - { - writer.WriteBooleanValue(value.Item1); - } - else - { - JsonSerializer.Serialize(writer, value.Item2, options); - } - } -} diff --git a/src/Elastic.Clients.Elasticsearch/_Shared/Types/WaitForActiveShards.cs b/src/Elastic.Clients.Elasticsearch/_Shared/Types/WaitForActiveShards.cs index e033e7af327..a1c3d80c85a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Shared/Types/WaitForActiveShards.cs +++ b/src/Elastic.Clients.Elasticsearch/_Shared/Types/WaitForActiveShards.cs @@ -2,11 +2,18 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System; +using System.Diagnostics.CodeAnalysis; + using Elastic.Transport; namespace Elastic.Clients.Elasticsearch; -public partial struct WaitForActiveShards : IStringable +public readonly struct WaitForActiveShards : + IStringable +#if NET7_0_OR_GREATER + , IParsable +#endif { public static WaitForActiveShards All = new("all"); @@ -15,7 +22,28 @@ public partial struct WaitForActiveShards : IStringable public string Value { get; } public static implicit operator WaitForActiveShards(int v) => new(v.ToString()); + public static implicit operator WaitForActiveShards(string v) => new(v); public string GetString() => Value ?? string.Empty; + + #region IParsable + + public static WaitForActiveShards Parse(string s, IFormatProvider? provider) => + TryParse(s, provider, out var result) ? result : throw new FormatException(); + + public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, + out WaitForActiveShards result) + { + if (s is null) + { + result = default; + return false; + } + + result = new WaitForActiveShards(s); + return true; + } + + #endregion IParsable } diff --git a/src/Playground/Person.cs b/src/Playground/Person.cs index 9fd093a4675..c1107bcfba3 100644 --- a/src/Playground/Person.cs +++ b/src/Playground/Person.cs @@ -4,7 +4,6 @@ using System.Runtime.Serialization; using Elastic.Clients.Elasticsearch; -using Newtonsoft.Json; namespace Playground { @@ -37,22 +36,4 @@ public class PersonV3 { public Guid SecondaryId { get; set; } = Guid.NewGuid(); } - - public class PersonV2 - { - [JsonProperty("foreName")] - public string? FirstName { get; init; } - - public string? LastName { get; init; } - - public int? Age { get; init; } - - public string? Email { get; init; } - - [JsonProperty("customisedName")] - public string ShouldNotSeeThisName => "Test"; - - [JsonIgnore] - public string Ignored => "SHOULD BE IGNORED"; - } } diff --git a/src/Playground/Program.cs b/src/Playground/Program.cs index 5a98fd06a95..ad854df1d61 100644 --- a/src/Playground/Program.cs +++ b/src/Playground/Program.cs @@ -18,14 +18,3 @@ var client = new ElasticsearchClient(settings); -var z = await client.SearchAsync(x => x.Index("person").Query(q => q.GeoShape(gs => gs.Shape(shape => shape.Shape(new {}))))); - -var r = await client.SearchAsync(x => x.Index("person").Query(q => q.MatchAll(ma => { })).FilterPath("took")); - -foreach (var hit in r.Hits) -{ - var highlights = hit.Highlight?["field"]; - if (highlights is { Count: > 0 }) - { - } -} diff --git a/tests/Tests.Core/Client/Serializers/TestSourceSerializerBase.cs b/tests/Tests.Core/Client/Serializers/TestSourceSerializerBase.cs deleted file mode 100644 index 6643bda9221..00000000000 --- a/tests/Tests.Core/Client/Serializers/TestSourceSerializerBase.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using Elastic.Clients.Elasticsearch; -using Elastic.Clients.Elasticsearch.JsonNetSerializer; -using Elastic.Transport; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using Tests.Domain; - -namespace Tests.Core.Client.Serializers -{ - public class TestSourceSerializer : ConnectionSettingsAwareSerializer - { - public TestSourceSerializer(Serializer builtinSerializer, IElasticsearchClientSettings connectionSettings) - : base(builtinSerializer, connectionSettings) { } - - protected override JsonSerializerSettings CreateJsonSerializerSettings() => - new() - { - NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Include - }; - - protected override IEnumerable CreateJsonConverters() - { - yield return new SourceOnlyUsingBuiltInConverter(); - //yield return new Domain.JsonConverters.DateTimeConverter(); - } - - protected override void ModifyContractResolver(ConnectionSettingsAwareContractResolver resolver) => - resolver.NamingStrategy = new CamelCaseNamingStrategy(); - } -} diff --git a/tests/Tests.Core/Client/Settings/TestElasticsearchClientSettings.cs b/tests/Tests.Core/Client/Settings/TestElasticsearchClientSettings.cs index 0a515f4d531..c8267b5d520 100644 --- a/tests/Tests.Core/Client/Settings/TestElasticsearchClientSettings.cs +++ b/tests/Tests.Core/Client/Settings/TestElasticsearchClientSettings.cs @@ -10,7 +10,6 @@ using Elastic.Clients.Elasticsearch; using Tests.Configuration; using Tests.Core.Extensions; -using Tests.Core.Client.Serializers; namespace Tests.Core.Client.Settings { @@ -76,7 +75,7 @@ private static SourceSerializerFactory CreateSerializerFactory(SourceSerializerF if (!TestConfiguration.Instance.Random.SourceSerializer) return null; - return (builtin, values) => new TestSourceSerializer(builtin, values); + return (builtin, values) => builtin; //new TestSourceSerializer(builtin, values); } private static NodePool CreatePool(Func, NodePool> createPool = null, diff --git a/tests/Tests.Core/Tests.Core.csproj b/tests/Tests.Core/Tests.Core.csproj index e67dc3a2ef3..6bd0841af68 100644 --- a/tests/Tests.Core/Tests.Core.csproj +++ b/tests/Tests.Core/Tests.Core.csproj @@ -6,13 +6,8 @@ False - - - - - - + diff --git a/tests/Tests.Domain/Project.cs b/tests/Tests.Domain/Project.cs index 4a11e882352..ecbddabc340 100644 --- a/tests/Tests.Domain/Project.cs +++ b/tests/Tests.Domain/Project.cs @@ -53,8 +53,6 @@ public class Project public int NumberOfContributors { get; set; } - public Ranges Ranges { get; set; } - public int? Rank { get; set; } public int? RequiredBranches => Branches?.Count(); @@ -93,7 +91,6 @@ public class Project //.RuleFor(p => p.ArbitraryShape, f => new PointGeoShape(new GeoCoordinate(f.Address.Latitude(), f.Address.Latitude()))) .RuleFor(p => p.NumberOfCommits, f => Gimme.Random.Number(1, 1000)) .RuleFor(p => p.NumberOfContributors, f => Gimme.Random.Number(1, 50)) - .RuleFor(p => p.Ranges, f => Ranges.Generator.Generate()) .RuleFor(p => p.Rank, f => Gimme.Random.Number(1, 100)) .RuleFor(p => p.Branches, f => Gimme.Random.ListItems(new List { "master", "dev", "release", "qa", "test" })) //.RuleFor(p => p.SourceOnly, f => diff --git a/tests/Tests.Domain/Ranges.cs b/tests/Tests.Domain/Ranges.cs deleted file mode 100644 index fa1771274fc..00000000000 --- a/tests/Tests.Domain/Ranges.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Bogus; -using System; -using Tests.Configuration; -using System.Net; -using Elastic.Clients.Elasticsearch; - -namespace Tests.Domain; - -public class Ranges -{ - //for deserialization - public Ranges() { } - - private Ranges(Faker faker) - { - bool R() => faker.Random.Bool(); - - SetDates(faker, R); - SetDoubles(faker, R); - SetFloats(faker, R); - SetIntegers(faker, R); - SetLongs(faker, R); - SetIps(faker, R); - } - - public DateRange Dates { get; set; } - public DoubleRange Doubles { get; set; } - public FloatRange Floats { get; set; } - - public static Faker Generator { get; } = - new Faker() - .UseSeed(TestConfiguration.Instance.Seed) - .CustomInstantiator((f) => new Ranges(f)); - - public IntegerRange Integers { get; set; } - public IpAddressRange Ips { get; set; } - public LongRange Longs { get; set; } - - private void SetDates(Faker faker, Func r) - { - var past = faker.Date.Past(faker.Random.Int(1, 19)); - var future = faker.Date.Future(faker.Random.Int(1, 10), past); - var d = new DateRange(); - SwapAssign(r(), past, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), future, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Dates = d; - } - - private void SetDoubles(Faker faker, Func r) - { - var low = faker.Random.Double(-121, 10000); - var high = faker.Random.Double(low, Math.Abs(low * 10)) + 2; - var d = new DoubleRange(); - SwapAssign(r(), low, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), high, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Doubles = d; - } - - private void SetFloats(Faker faker, Func r) - { - var low = faker.Random.Float(-2000, 10000); - var high = faker.Random.Float(low, Math.Abs(low * 10)) + 2; - var d = new FloatRange(); - SwapAssign(r(), low, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), high, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Floats = d; - } - - private void SetIntegers(Faker faker, Func r) - { - var low = faker.Random.Int(-100, 10000); - var high = faker.Random.Int(low, Math.Abs(low * 10)) + 2; - var d = new FloatRange(); - SwapAssign(r(), low, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), high, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Floats = d; - } - - private void SetLongs(Faker faker, Func r) - { - var low = faker.Random.Long(-100, 10000); - var high = faker.Random.Long(low, Math.Abs(low * 10)) + 2; - var d = new LongRange(); - SwapAssign(r(), low, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), high, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Longs = d; - } - - private void SetIps(Faker faker, Func r) - { - var low = faker.Internet.Ip(); - var high = faker.Internet.Ip(); - var lowBytes = IPAddress.Parse(low).GetAddressBytes(); - var highBytes = IPAddress.Parse(high).GetAddressBytes(); - for (var i = 0; i < lowBytes.Length; i++) - { - var comparison = lowBytes[i].CompareTo(highBytes[i]); - if (comparison == 0) - continue; - - if (comparison > 0) - { - var s = low; - low = high; - high = s; - } - - break; - } - var d = new IpAddressRange(); - SwapAssign(r(), low, v => d.GreaterThan = v, v => d.GreaterThanOrEqualTo = v); - SwapAssign(r(), high, v => d.LessThan = v, v => d.LessThanOrEqualTo = v); - Ips = d; - } - - private static void SwapAssign(bool b, T value, Action first, Action second) - { - if (b) - first(value); - else - second(value); - } -}